diff --git a/docs/_astro/App.ZqzL3Mo9.js b/docs/_astro/App.D0nqaVa5.js similarity index 85% rename from docs/_astro/App.ZqzL3Mo9.js rename to docs/_astro/App.D0nqaVa5.js index 16c39a8..0ba2988 100644 --- a/docs/_astro/App.ZqzL3Mo9.js +++ b/docs/_astro/App.D0nqaVa5.js @@ -1,4 +1,4 @@ -import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c as vy}from"./index.DIpCM_17.js";import{p as CL,a as bx}from"./index.DxhZiom7.js";import{t as Dr}from"./index.BH1EYZ08.js";var EM={exports:{}},on={};/** +import{j as Qt}from"./jsx-runtime.BFYNFNPI.js";import{g as Xd,r as Pm,a as Ae,c as my}from"./index.DIpCM_17.js";import{p as AL,a as Rm}from"./index.DxhZiom7.js";import{t as Dr}from"./index.BH1EYZ08.js";var MM={exports:{}},on={};/** * @license React * react-is.production.min.js * @@ -6,17 +6,17 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Lx=Symbol.for("react.element"),Fx=Symbol.for("react.portal"),Rm=Symbol.for("react.fragment"),bm=Symbol.for("react.strict_mode"),Lm=Symbol.for("react.profiler"),Fm=Symbol.for("react.provider"),Om=Symbol.for("react.context"),wL=Symbol.for("react.server_context"),Dm=Symbol.for("react.forward_ref"),Im=Symbol.for("react.suspense"),Nm=Symbol.for("react.suspense_list"),Bm=Symbol.for("react.memo"),Um=Symbol.for("react.lazy"),AL=Symbol.for("react.offscreen"),MM;MM=Symbol.for("react.module.reference");function Aa(g){if(typeof g=="object"&&g!==null){var t=g.$$typeof;switch(t){case Lx:switch(g=g.type,g){case Rm:case Lm:case bm:case Im:case Nm:return g;default:switch(g=g&&g.$$typeof,g){case wL:case Om:case Dm:case Um:case Bm:case Fm:return g;default:return t}}case Fx:return t}}}on.ContextConsumer=Om;on.ContextProvider=Fm;on.Element=Lx;on.ForwardRef=Dm;on.Fragment=Rm;on.Lazy=Um;on.Memo=Bm;on.Portal=Fx;on.Profiler=Lm;on.StrictMode=bm;on.Suspense=Im;on.SuspenseList=Nm;on.isAsyncMode=function(){return!1};on.isConcurrentMode=function(){return!1};on.isContextConsumer=function(g){return Aa(g)===Om};on.isContextProvider=function(g){return Aa(g)===Fm};on.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===Lx};on.isForwardRef=function(g){return Aa(g)===Dm};on.isFragment=function(g){return Aa(g)===Rm};on.isLazy=function(g){return Aa(g)===Um};on.isMemo=function(g){return Aa(g)===Bm};on.isPortal=function(g){return Aa(g)===Fx};on.isProfiler=function(g){return Aa(g)===Lm};on.isStrictMode=function(g){return Aa(g)===bm};on.isSuspense=function(g){return Aa(g)===Im};on.isSuspenseList=function(g){return Aa(g)===Nm};on.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===Rm||g===Lm||g===bm||g===Im||g===Nm||g===AL||typeof g=="object"&&g!==null&&(g.$$typeof===Um||g.$$typeof===Bm||g.$$typeof===Fm||g.$$typeof===Om||g.$$typeof===Dm||g.$$typeof===MM||g.getModuleId!==void 0)};on.typeOf=Aa;EM.exports=on;var CM=EM.exports;function PL(g){function t(tt,Y,Z,U,H){for(var J=0,_=0,q=0,at=0,ot,rt,gt=0,yt=0,Et,At=Et=ot=0,Pt=0,Vt=0,dt=0,ut=0,Rt=Z.length,Dt=Rt-1,Ht,Bt="",ne="",oe="",ge="",xe;Ptot)&&(ut=(Bt=Bt.replace(" ",":")).length),0U&&(U=(Y=Y.trim()).charCodeAt(0)),U){case 38:return Y.replace(o,"$1"+tt.trim());case 58:return tt.trim()+Y.replace(o,"$1"+tt.trim());default:if(0<1*Z&&0_.charCodeAt(8))break;case 115:H=H.replace(_,"-webkit-"+_)+";"+H;break;case 207:case 102:H=H.replace(_,"-webkit-"+(102Z.charCodeAt(0)&&(Z=Z.trim()),Q=Z,Z=[Q],0ot)&&(ut=(Bt=Bt.replace(" ",":")).length),0U&&(U=(Y=Y.trim()).charCodeAt(0)),U){case 38:return Y.replace(o,"$1"+tt.trim());case 58:return tt.trim()+Y.replace(o,"$1"+tt.trim());default:if(0<1*Z&&0_.charCodeAt(8))break;case 115:H=H.replace(_,"-webkit-"+_)+";"+H;break;case 207:case 102:H=H.replace(_,"-webkit-"+(102Z.charCodeAt(0)&&(Z=Z.trim()),Q=Z,Z=[Q],01?t-1:0),x=1;x0?" Args: "+i.join(", "):""))}var jL=function(){function g(i){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=i}var t=g.prototype;return t.indexOfGroup=function(i){for(var x=0,T=0;T=this.groupSizes.length){for(var T=this.groupSizes,E=T.length,s=E;i>=s;)(s<<=1)<0&&Xd(16,""+i);this.groupSizes=new Uint32Array(s),this.groupSizes.set(T),this.length=s;for(var y=E;y=this.length||this.groupSizes[i]===0)return x;for(var T=this.groupSizes[i],E=this.indexOfGroup(i),s=E+T,y=E;y=rd&&(rd=t+1),Zv.set(g,t),cm.set(t,g)},$L="style["+Yf+'][data-styled-version="5.3.6"]',QL=new RegExp("^"+Yf+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),_L=function(g,t,i){for(var x,T=i.split(","),E=0,s=T.length;E=0;r--){var p=e[r];if(p&&p.nodeType===1&&p.hasAttribute(Yf))return p}}(i),E=T!==void 0?T.nextSibling:null;x.setAttribute(Yf,"active"),x.setAttribute("data-styled-version","5.3.6");var s=tF();return s&&x.setAttribute("nonce",s),i.insertBefore(x,E),x},eF=function(){function g(i){var x=this.element=bM(i);x.appendChild(document.createTextNode("")),this.sheet=function(T){if(T.sheet)return T.sheet;for(var E=document.styleSheets,s=0,y=E.length;s=0){var T=document.createTextNode(x),E=this.nodes[i];return this.element.insertBefore(T,E||null),this.length++,!0}return!1},t.deleteRule=function(i){this.element.removeChild(this.nodes[i]),this.length--},t.getRule=function(i){return i0&&(h+=a+",")}),E+=""+r+p+'{content:"'+h+`"}/*!sc*/ -`}}}return E}(this)},g}(),sF=/(a)(d)/gi,kS=function(g){return String.fromCharCode(g+(g>25?39:97))};function gy(g){var t,i="";for(t=Math.abs(g);t>52;t=t/52|0)i=kS(t%52)+i;return(kS(t%52)+i).replace(sF,"$1-$2")}var Df=function(g,t){for(var i=t.length;i;)g=33*g^t.charCodeAt(--i);return g},FM=function(g){return Df(5381,g)};function aF(g){for(var t=0;t>>0);if(!i.hasNameForId(T,y)){var e=x(s,"."+y,void 0,T);i.insertRules(T,y,e)}E.push(y),this.staticRulesId=y}else{for(var r=this.rules.length,p=Df(this.baseHash,x.hash),h="",a=0;a>>0);if(!i.hasNameForId(T,f)){var o=x(h,"."+f,void 0,T);i.insertRules(T,f,o)}E.push(f)}}return E.join(" ")},g}(),hF=/^\s*\/\/.*$/gm,uF=[":","[",".","#"];function fF(g){var t,i,x,T,E=g===void 0?lh:g,s=E.options,y=s===void 0?lh:s,e=E.plugins,r=e===void 0?fm:e,p=new PL(y),h=[],a=function(u){function f(o){if(o)try{u(o+"}")}catch{}}return function(o,c,d,v,m,S,M,w,C,A){switch(o){case 1:if(C===0&&c.charCodeAt(0)===64)return u(c+";"),"";break;case 2:if(w===0)return c+"/*|*/";break;case 3:switch(w){case 102:case 112:return u(d[0]+c),"";default:return c+(A===0?"/*|*/":"")}case-2:c.split("/*|*/}").forEach(f)}}}(function(u){h.push(u)}),l=function(u,f,o){return f===0&&uF.indexOf(o[i.length])!==-1||o.match(T)?u:"."+t};function n(u,f,o,c){c===void 0&&(c="&");var d=u.replace(hF,""),v=f&&o?o+" "+f+" { "+d+" }":d;return t=c,i=f,x=new RegExp("\\"+i+"\\b","g"),T=new RegExp("(\\"+i+"\\b){2,}"),p(o||!f?"":f,v)}return p.use([].concat(r,[function(u,f,o){u===2&&o.length&&o[0].lastIndexOf(i)>0&&(o[0]=o[0].replace(x,l))},a,function(u){if(u===-2){var f=h;return h=[],f}}])),n.hash=r.length?r.reduce(function(u,f){return f.name||Xd(15),Df(u,f.name)},5381).toString():"",n}var OM=Pm.createContext();OM.Consumer;var DM=Pm.createContext(),cF=(DM.Consumer,new LM),yy=fF();function dF(){return Pe.useContext(OM)||cF}function pF(){return Pe.useContext(DM)||yy}var vF=function(){function g(t,i){var x=this;this.inject=function(T,E){E===void 0&&(E=yy);var s=x.name+E.hash;T.hasNameForId(x.id,s)||T.insertRules(x.id,s,E(x.rules,s,"@keyframes"))},this.toString=function(){return Xd(12,String(x.name))},this.name=t,this.id="sc-keyframes-"+t,this.rules=i}return g.prototype.getName=function(t){return t===void 0&&(t=yy),this.name+t.hash},g}(),mF=/([A-Z])/,gF=/([A-Z])/g,yF=/^ms-/,xF=function(g){return"-"+g.toLowerCase()};function KS(g){return mF.test(g)?g.replace(gF,xF).replace(yF,"-ms-"):g}var jS=function(g){return g==null||g===!1||g===""};function kf(g,t,i,x){if(Array.isArray(g)){for(var T,E=[],s=0,y=g.length;s1?t-1:0),x=1;x?@[\\\]^`{|}~-]+/g,MF=/(^-|-$)/g;function h0(g){return g.replace(EF,"-").replace(MF,"")}var CF=function(g){return gy(FM(g)>>>0)};function _p(g){return typeof g=="string"&&!0}var xy=function(g){return typeof g=="function"||typeof g=="object"&&g!==null&&!Array.isArray(g)},wF=function(g){return g!=="__proto__"&&g!=="constructor"&&g!=="prototype"};function AF(g,t,i){var x=g[i];xy(t)&&xy(x)?IM(x,t):g[i]=t}function IM(g){for(var t=arguments.length,i=new Array(t>1?t-1:0),x=1;x=0||(A[w]=S[w]);return A}(t,["componentId"]),m=d&&d+"-"+(_p(c)?c:h0(XS(c)));return BM(c,gl({},v,{attrs:a,componentId:m}),i)},Object.defineProperty(n,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(c){this._foldedDefaultProps=x?IM({},g.defaultProps,c):c}}),n.toString=function(){return"."+n.styledComponentId},T&&kL(n,g,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),n}var dm=function(g){return function t(i,x,T){if(T===void 0&&(T=lh),!CM.isValidElementType(x))return Xd(1,String(x));var E=function(){return i(x,T,SF.apply(void 0,arguments))};return E.withConfig=function(s){return t(i,x,gl({},T,{},s))},E.attrs=function(s){return t(i,x,gl({},T,{attrs:Array.prototype.concat(T.attrs,s).filter(Boolean)}))},E}(BM,g)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(g){dm[g]=dm(g)});var UM={exports:{}};(function(g,t){(function(x,T){g.exports=T()})(vy,()=>(()=>{var i={50792:s=>{var y=Object.prototype.hasOwnProperty,e="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(e=!1));function p(n,u,f){this.fn=n,this.context=u,this.once=f||!1}function h(n,u,f,o,c){if(typeof f!="function")throw new TypeError("The listener must be a function");var d=new p(f,o||n,c),v=e?e+u:u;return n._events[v]?n._events[v].fn?n._events[v]=[n._events[v],d]:n._events[v].push(d):(n._events[v]=d,n._eventsCount++),n}function a(n,u){--n._eventsCount===0?n._events=new r:delete n._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],f,o;if(this._eventsCount===0)return u;for(o in f=this._events)y.call(f,o)&&u.push(e?o.slice(1):o);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(f)):u},l.prototype.listeners=function(u){var f=e?e+u:u,o=this._events[f];if(!o)return[];if(o.fn)return[o.fn];for(var c=0,d=o.length,v=new Array(d);c{/** + */var Ir=typeof Symbol=="function"&&Symbol.for,Ox=Ir?Symbol.for("react.element"):60103,Dx=Ir?Symbol.for("react.portal"):60106,Gm=Ir?Symbol.for("react.fragment"):60107,Vm=Ir?Symbol.for("react.strict_mode"):60108,Hm=Ir?Symbol.for("react.profiler"):60114,Wm=Ir?Symbol.for("react.provider"):60109,Xm=Ir?Symbol.for("react.context"):60110,Ix=Ir?Symbol.for("react.async_mode"):60111,Ym=Ir?Symbol.for("react.concurrent_mode"):60111,km=Ir?Symbol.for("react.forward_ref"):60112,jm=Ir?Symbol.for("react.suspense"):60113,DL=Ir?Symbol.for("react.suspense_list"):60120,Km=Ir?Symbol.for("react.memo"):60115,Zm=Ir?Symbol.for("react.lazy"):60116,IL=Ir?Symbol.for("react.block"):60121,NL=Ir?Symbol.for("react.fundamental"):60117,BL=Ir?Symbol.for("react.responder"):60118,UL=Ir?Symbol.for("react.scope"):60119;function ra(g){if(typeof g=="object"&&g!==null){var t=g.$$typeof;switch(t){case Ox:switch(g=g.type,g){case Ix:case Ym:case Gm:case Hm:case Vm:case jm:return g;default:switch(g=g&&g.$$typeof,g){case Xm:case km:case Zm:case Km:case Wm:return g;default:return t}}case Dx:return t}}}function PM(g){return ra(g)===Ym}ln.AsyncMode=Ix;ln.ConcurrentMode=Ym;ln.ContextConsumer=Xm;ln.ContextProvider=Wm;ln.Element=Ox;ln.ForwardRef=km;ln.Fragment=Gm;ln.Lazy=Zm;ln.Memo=Km;ln.Portal=Dx;ln.Profiler=Hm;ln.StrictMode=Vm;ln.Suspense=jm;ln.isAsyncMode=function(g){return PM(g)||ra(g)===Ix};ln.isConcurrentMode=PM;ln.isContextConsumer=function(g){return ra(g)===Xm};ln.isContextProvider=function(g){return ra(g)===Wm};ln.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===Ox};ln.isForwardRef=function(g){return ra(g)===km};ln.isFragment=function(g){return ra(g)===Gm};ln.isLazy=function(g){return ra(g)===Zm};ln.isMemo=function(g){return ra(g)===Km};ln.isPortal=function(g){return ra(g)===Dx};ln.isProfiler=function(g){return ra(g)===Hm};ln.isStrictMode=function(g){return ra(g)===Vm};ln.isSuspense=function(g){return ra(g)===jm};ln.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===Gm||g===Ym||g===Hm||g===Vm||g===jm||g===DL||typeof g=="object"&&g!==null&&(g.$$typeof===Zm||g.$$typeof===Km||g.$$typeof===Wm||g.$$typeof===Xm||g.$$typeof===km||g.$$typeof===NL||g.$$typeof===BL||g.$$typeof===UL||g.$$typeof===IL)};ln.typeOf=ra;AM.exports=ln;var zL=AM.exports,Nx=zL,GL={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},VL={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},HL={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},RM={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Bx={};Bx[Nx.ForwardRef]=HL;Bx[Nx.Memo]=RM;function zS(g){return Nx.isMemo(g)?RM:Bx[g.$$typeof]||GL}var WL=Object.defineProperty,XL=Object.getOwnPropertyNames,GS=Object.getOwnPropertySymbols,YL=Object.getOwnPropertyDescriptor,kL=Object.getPrototypeOf,VS=Object.prototype;function bM(g,t,i){if(typeof t!="string"){if(VS){var x=kL(t);x&&x!==VS&&bM(g,x,i)}var T=XL(t);GS&&(T=T.concat(GS(t)));for(var E=zS(g),s=zS(t),y=0;y1?t-1:0),x=1;x0?" Args: "+i.join(", "):""))}var JL=function(){function g(i){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=i}var t=g.prototype;return t.indexOfGroup=function(i){for(var x=0,T=0;T=this.groupSizes.length){for(var T=this.groupSizes,E=T.length,s=E;i>=s;)(s<<=1)<0&&Yd(16,""+i);this.groupSizes=new Uint32Array(s),this.groupSizes.set(T),this.length=s;for(var y=E;y=this.length||this.groupSizes[i]===0)return x;for(var T=this.groupSizes[i],E=this.indexOfGroup(i),s=E+T,y=E;y=rd&&(rd=t+1),Jv.set(g,t),cm.set(t,g)},_L="style["+Yf+'][data-styled-version="5.3.6"]',qL=new RegExp("^"+Yf+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),tF=function(g,t,i){for(var x,T=i.split(","),E=0,s=T.length;E=0;r--){var p=e[r];if(p&&p.nodeType===1&&p.hasAttribute(Yf))return p}}(i),E=T!==void 0?T.nextSibling:null;x.setAttribute(Yf,"active"),x.setAttribute("data-styled-version","5.3.6");var s=iF();return s&&x.setAttribute("nonce",s),i.insertBefore(x,E),x},nF=function(){function g(i){var x=this.element=LM(i);x.appendChild(document.createTextNode("")),this.sheet=function(T){if(T.sheet)return T.sheet;for(var E=document.styleSheets,s=0,y=E.length;s=0){var T=document.createTextNode(x),E=this.nodes[i];return this.element.insertBefore(T,E||null),this.length++,!0}return!1},t.deleteRule=function(i){this.element.removeChild(this.nodes[i]),this.length--},t.getRule=function(i){return i0&&(h+=a+",")}),E+=""+r+p+'{content:"'+h+`"}/*!sc*/ +`}}}return E}(this)},g}(),oF=/(a)(d)/gi,YS=function(g){return String.fromCharCode(g+(g>25?39:97))};function yy(g){var t,i="";for(t=Math.abs(g);t>52;t=t/52|0)i=YS(t%52)+i;return(YS(t%52)+i).replace(oF,"$1-$2")}var Df=function(g,t){for(var i=t.length;i;)g=33*g^t.charCodeAt(--i);return g},OM=function(g){return Df(5381,g)};function lF(g){for(var t=0;t>>0);if(!i.hasNameForId(T,y)){var e=x(s,"."+y,void 0,T);i.insertRules(T,y,e)}E.push(y),this.staticRulesId=y}else{for(var r=this.rules.length,p=Df(this.baseHash,x.hash),h="",a=0;a>>0);if(!i.hasNameForId(T,f)){var o=x(h,"."+f,void 0,T);i.insertRules(T,f,o)}E.push(f)}}return E.join(" ")},g}(),fF=/^\s*\/\/.*$/gm,cF=[":","[",".","#"];function dF(g){var t,i,x,T,E=g===void 0?lh:g,s=E.options,y=s===void 0?lh:s,e=E.plugins,r=e===void 0?fm:e,p=new bL(y),h=[],a=function(u){function f(o){if(o)try{u(o+"}")}catch{}}return function(o,c,d,v,m,S,M,w,C,A){switch(o){case 1:if(C===0&&c.charCodeAt(0)===64)return u(c+";"),"";break;case 2:if(w===0)return c+"/*|*/";break;case 3:switch(w){case 102:case 112:return u(d[0]+c),"";default:return c+(A===0?"/*|*/":"")}case-2:c.split("/*|*/}").forEach(f)}}}(function(u){h.push(u)}),l=function(u,f,o){return f===0&&cF.indexOf(o[i.length])!==-1||o.match(T)?u:"."+t};function n(u,f,o,c){c===void 0&&(c="&");var d=u.replace(fF,""),v=f&&o?o+" "+f+" { "+d+" }":d;return t=c,i=f,x=new RegExp("\\"+i+"\\b","g"),T=new RegExp("(\\"+i+"\\b){2,}"),p(o||!f?"":f,v)}return p.use([].concat(r,[function(u,f,o){u===2&&o.length&&o[0].lastIndexOf(i)>0&&(o[0]=o[0].replace(x,l))},a,function(u){if(u===-2){var f=h;return h=[],f}}])),n.hash=r.length?r.reduce(function(u,f){return f.name||Yd(15),Df(u,f.name)},5381).toString():"",n}var DM=Pm.createContext();DM.Consumer;var IM=Pm.createContext(),pF=(IM.Consumer,new FM),xy=dF();function vF(){return Ae.useContext(DM)||pF}function mF(){return Ae.useContext(IM)||xy}var gF=function(){function g(t,i){var x=this;this.inject=function(T,E){E===void 0&&(E=xy);var s=x.name+E.hash;T.hasNameForId(x.id,s)||T.insertRules(x.id,s,E(x.rules,s,"@keyframes"))},this.toString=function(){return Yd(12,String(x.name))},this.name=t,this.id="sc-keyframes-"+t,this.rules=i}return g.prototype.getName=function(t){return t===void 0&&(t=xy),this.name+t.hash},g}(),yF=/([A-Z])/,xF=/([A-Z])/g,SF=/^ms-/,TF=function(g){return"-"+g.toLowerCase()};function kS(g){return yF.test(g)?g.replace(xF,TF).replace(SF,"-ms-"):g}var jS=function(g){return g==null||g===!1||g===""};function kf(g,t,i,x){if(Array.isArray(g)){for(var T,E=[],s=0,y=g.length;s1?t-1:0),x=1;x?@[\\\]^`{|}~-]+/g,wF=/(^-|-$)/g;function u0(g){return g.replace(CF,"-").replace(wF,"")}var AF=function(g){return yy(OM(g)>>>0)};function qp(g){return typeof g=="string"&&!0}var Sy=function(g){return typeof g=="function"||typeof g=="object"&&g!==null&&!Array.isArray(g)},PF=function(g){return g!=="__proto__"&&g!=="constructor"&&g!=="prototype"};function RF(g,t,i){var x=g[i];Sy(t)&&Sy(x)?NM(x,t):g[i]=t}function NM(g){for(var t=arguments.length,i=new Array(t>1?t-1:0),x=1;x=0||(A[w]=S[w]);return A}(t,["componentId"]),m=d&&d+"-"+(qp(c)?c:u0(WS(c)));return UM(c,yl({},v,{attrs:a,componentId:m}),i)},Object.defineProperty(n,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(c){this._foldedDefaultProps=x?NM({},g.defaultProps,c):c}}),n.toString=function(){return"."+n.styledComponentId},T&&KL(n,g,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),n}var dm=function(g){return function t(i,x,T){if(T===void 0&&(T=lh),!wM.isValidElementType(x))return Yd(1,String(x));var E=function(){return i(x,T,EF.apply(void 0,arguments))};return E.withConfig=function(s){return t(i,x,yl({},T,{},s))},E.attrs=function(s){return t(i,x,yl({},T,{attrs:Array.prototype.concat(T.attrs,s).filter(Boolean)}))},E}(UM,g)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(g){dm[g]=dm(g)});var zM={exports:{}};(function(g,t){(function(x,T){g.exports=T()})(my,()=>(()=>{var i={50792:s=>{var y=Object.prototype.hasOwnProperty,e="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(e=!1));function p(n,u,f){this.fn=n,this.context=u,this.once=f||!1}function h(n,u,f,o,c){if(typeof f!="function")throw new TypeError("The listener must be a function");var d=new p(f,o||n,c),v=e?e+u:u;return n._events[v]?n._events[v].fn?n._events[v]=[n._events[v],d]:n._events[v].push(d):(n._events[v]=d,n._eventsCount++),n}function a(n,u){--n._eventsCount===0?n._events=new r:delete n._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],f,o;if(this._eventsCount===0)return u;for(o in f=this._events)y.call(f,o)&&u.push(e?o.slice(1):o);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(f)):u},l.prototype.listeners=function(u){var f=e?e+u:u,o=this._events[f];if(!o)return[];if(o.fn)return[o.fn];for(var c=0,d=o.length,v=new Array(d);c{/** * @author samme * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -245,7 +245,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(42099),p=e(83419),h=e(90330),a=e(50792),l=e(74943),n=e(8443),u=e(95540),f=e(35154),o=e(36383),c=e(20283),d=e(41836),v=new p({Extends:a,initialize:function(S){a.call(this),this.game=S,this.textureManager=null,this.globalTimeScale=1,this.anims=new h,this.mixes=new h,this.paused=!1,this.name="AnimationManager",S.events.once(n.BOOT,this.boot,this)},boot:function(){this.textureManager=this.game.textures,this.game.events.once(n.DESTROY,this.destroy,this)},addMix:function(m,S,M){var w=this.anims,C=this.mixes,A=typeof m=="string"?m:m.key,P=typeof S=="string"?S:S.key;if(w.has(A)&&w.has(P)){var b=C.get(A);b||(b={}),b[P]=M,C.set(A,b)}return this},removeMix:function(m,S){var M=this.mixes,w=typeof m=="string"?m:m.key,C=M.get(w);if(C)if(S){var A=typeof S=="string"?S:S.key;C.hasOwnProperty(A)&&delete C[A]}else S||M.delete(w);return this},getMix:function(m,S){var M=this.mixes,w=typeof m=="string"?m:m.key,C=typeof S=="string"?S:S.key,A=M.get(w);return A&&A.hasOwnProperty(C)?A[C]:0},add:function(m,S){return this.anims.has(m)?(console.warn("Animation key exists: "+m),this):(S.key=m,this.anims.set(m,S),this.emit(l.ADD_ANIMATION,m,S),this)},exists:function(m){return this.anims.has(m)},createFromAseprite:function(m,S,M){var w=[],C=this.game.cache.json.get(m);if(!C)return console.warn("No Aseprite data found for: "+m),w;var A=this,P=f(C,"meta",null),b=f(C,"frames",null);if(P&&b){var O=f(P,"frameTags",[]);O.forEach(function(I){var D=[],B=u(I,"name",null),G=u(I,"from",0),z=u(I,"to",0),X=u(I,"direction","forward");if(B&&(!S||S&&S.indexOf(B)>-1)){for(var K=0,Q=G;Q<=z;Q++){var tt=Q.toString(),Y=b[tt];if(Y){var Z=u(Y,"duration",o.MAX_SAFE_INTEGER);D.push({key:m,frame:tt,duration:Z}),K+=Z}}X==="reverse"&&(D=D.reverse());var U={key:B,frames:D,duration:K,yoyo:X==="pingpong"},H;M?M.anims&&(H=M.anims.create(U)):H=A.create(U),H&&w.push(H)}})}return w},create:function(m){var S=m.key,M=!1;return S&&(M=this.get(S),M?console.warn("AnimationManager key already exists: "+S):(M=new r(this,S,m),this.anims.set(S,M),this.emit(l.ADD_ANIMATION,S,M))),M},fromJSON:function(m,S){S===void 0&&(S=!1),S&&this.anims.clear(),typeof m=="string"&&(m=JSON.parse(m));var M=[];if(m.hasOwnProperty("anims")&&Array.isArray(m.anims)){for(var w=0;w{/** + */var r=e(42099),p=e(83419),h=e(90330),a=e(50792),l=e(74943),n=e(8443),u=e(95540),f=e(35154),o=e(36383),c=e(20283),d=e(41836),v=new p({Extends:a,initialize:function(S){a.call(this),this.game=S,this.textureManager=null,this.globalTimeScale=1,this.anims=new h,this.mixes=new h,this.paused=!1,this.name="AnimationManager",S.events.once(n.BOOT,this.boot,this)},boot:function(){this.textureManager=this.game.textures,this.game.events.once(n.DESTROY,this.destroy,this)},addMix:function(m,S,M){var w=this.anims,C=this.mixes,A=typeof m=="string"?m:m.key,P=typeof S=="string"?S:S.key;if(w.has(A)&&w.has(P)){var b=C.get(A);b||(b={}),b[P]=M,C.set(A,b)}return this},removeMix:function(m,S){var M=this.mixes,w=typeof m=="string"?m:m.key,C=M.get(w);if(C)if(S){var A=typeof S=="string"?S:S.key;C.hasOwnProperty(A)&&delete C[A]}else S||M.delete(w);return this},getMix:function(m,S){var M=this.mixes,w=typeof m=="string"?m:m.key,C=typeof S=="string"?S:S.key,A=M.get(w);return A&&A.hasOwnProperty(C)?A[C]:0},add:function(m,S){return this.anims.has(m)?(console.warn("Animation key exists: "+m),this):(S.key=m,this.anims.set(m,S),this.emit(l.ADD_ANIMATION,m,S),this)},exists:function(m){return this.anims.has(m)},createFromAseprite:function(m,S,M){var w=[],C=this.game.cache.json.get(m);if(!C)return console.warn("No Aseprite data found for: "+m),w;var A=this,P=f(C,"meta",null),b=f(C,"frames",null);if(P&&b){var O=f(P,"frameTags",[]);O.forEach(function(I){var D=[],B=u(I,"name",null),G=u(I,"from",0),z=u(I,"to",0),X=u(I,"direction","forward");if(B&&(!S||S&&S.indexOf(B)>-1)){for(var j=0,Q=G;Q<=z;Q++){var tt=Q.toString(),Y=b[tt];if(Y){var Z=u(Y,"duration",o.MAX_SAFE_INTEGER);D.push({key:m,frame:tt,duration:Z}),j+=Z}}X==="reverse"&&(D=D.reverse());var U={key:B,frames:D,duration:j,yoyo:X==="pingpong"},H;M?M.anims&&(H=M.anims.create(U)):H=A.create(U),H&&w.push(H)}})}return w},create:function(m){var S=m.key,M=!1;return S&&(M=this.get(S),M?console.warn("AnimationManager key already exists: "+S):(M=new r(this,S,m),this.anims.set(S,M),this.emit(l.ADD_ANIMATION,S,M))),M},fromJSON:function(m,S){S===void 0&&(S=!1),S&&this.anims.clear(),typeof m=="string"&&(m=JSON.parse(m));var M=[];if(m.hasOwnProperty("anims")&&Array.isArray(m.anims)){for(var w=0;w{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -329,11 +329,11 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83419),p=e(31401),h=e(39506),a=e(50792),l=e(19715),n=e(87841),u=e(61340),f=e(80333),o=e(26099),c=new r({Extends:a,Mixins:[p.AlphaSingle,p.Visible],initialize:function(v,m,S,M){v===void 0&&(v=0),m===void 0&&(m=0),S===void 0&&(S=0),M===void 0&&(M=0),a.call(this),this.scene,this.sceneManager,this.scaleManager,this.cameraManager,this.id=0,this.name="",this.roundPixels=!1,this.useBounds=!1,this.worldView=new n,this.dirty=!0,this._x=v,this._y=m,this._width=S,this._height=M,this._bounds=new n,this._scrollX=0,this._scrollY=0,this._zoomX=1,this._zoomY=1,this._rotation=0,this.matrix=new u,this.transparent=!0,this.backgroundColor=f("rgba(0,0,0,0)"),this.disableCull=!1,this.culledObjects=[],this.midPoint=new o(S/2,M/2),this.originX=.5,this.originY=.5,this._customViewport=!1,this.mask=null,this._maskCamera=null,this.renderList=[],this.isSceneCamera=!0},addToRenderList:function(d){this.renderList.push(d)},setOrigin:function(d,v){return d===void 0&&(d=.5),v===void 0&&(v=d),this.originX=d,this.originY=v,this},getScroll:function(d,v,m){m===void 0&&(m=new o);var S=this.width*.5,M=this.height*.5;return m.x=d-S,m.y=v-M,this.useBounds&&(m.x=this.clampX(m.x),m.y=this.clampY(m.y)),m},centerOnX:function(d){var v=this.width*.5;return this.midPoint.x=d,this.scrollX=d-v,this.useBounds&&(this.scrollX=this.clampX(this.scrollX)),this},centerOnY:function(d){var v=this.height*.5;return this.midPoint.y=d,this.scrollY=d-v,this.useBounds&&(this.scrollY=this.clampY(this.scrollY)),this},centerOn:function(d,v){return this.centerOnX(d),this.centerOnY(v),this},centerToBounds:function(){if(this.useBounds){var d=this._bounds,v=this.width*.5,m=this.height*.5;this.midPoint.set(d.centerX,d.centerY),this.scrollX=d.centerX-v,this.scrollY=d.centerY-m}return this},centerToSize:function(){return this.scrollX=this.width*.5,this.scrollY=this.height*.5,this},cull:function(d){if(this.disableCull)return d;var v=this.matrix.matrix,m=v[0],S=v[1],M=v[2],w=v[3],C=m*w-S*M;if(!C)return d;var A=v[4],P=v[5],b=this.scrollX,O=this.scrollY,I=this.width,D=this.height,B=this.y,G=B+D,z=this.x,X=z+I,K=this.culledObjects,Q=d.length;C=1/C,K.length=0;for(var tt=0;ttz&&_B&&qM&&(d=M),d},clampY:function(d){var v=this._bounds,m=this.displayHeight,S=v.y+(m-this.height)/2,M=Math.max(S,S+v.height-m);return dM&&(d=M),d},removeBounds:function(){return this.useBounds=!1,this.dirty=!0,this._bounds.setEmpty(),this},setAngle:function(d){return d===void 0&&(d=0),this.rotation=h(d),this},setBackgroundColor:function(d){return d===void 0&&(d="rgba(0,0,0,0)"),this.backgroundColor=f(d),this.transparent=this.backgroundColor.alpha===0,this},setBounds:function(d,v,m,S,M){return M===void 0&&(M=!1),this._bounds.setTo(d,v,m,S),this.dirty=!0,this.useBounds=!0,M?this.centerToBounds():(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},getBounds:function(d){d===void 0&&(d=new n);var v=this._bounds;return d.setTo(v.x,v.y,v.width,v.height),d},setName:function(d){return d===void 0&&(d=""),this.name=d,this},setPosition:function(d,v){return v===void 0&&(v=d),this.x=d,this.y=v,this},setRotation:function(d){return d===void 0&&(d=0),this.rotation=d,this},setRoundPixels:function(d){return this.roundPixels=d,this},setScene:function(d,v){v===void 0&&(v=!0),this.scene&&this._customViewport&&this.sceneManager.customViewports--,this.scene=d,this.isSceneCamera=v;var m=d.sys;return this.sceneManager=m.game.scene,this.scaleManager=m.scale,this.cameraManager=m.cameras,this.updateSystem(),this},setScroll:function(d,v){return v===void 0&&(v=d),this.scrollX=d,this.scrollY=v,this},setSize:function(d,v){return v===void 0&&(v=d),this.width=d,this.height=v,this},setViewport:function(d,v,m,S){return this.x=d,this.y=v,this.width=m,this.height=S,this},setZoom:function(d,v){return d===void 0&&(d=1),v===void 0&&(v=d),d===0&&(d=.001),v===0&&(v=.001),this.zoomX=d,this.zoomY=v,this},setMask:function(d,v){return v===void 0&&(v=!0),this.mask=d,this._maskCamera=v?this.cameraManager.default:this,this},clearMask:function(d){return d===void 0&&(d=!1),d&&this.mask&&this.mask.destroy(),this.mask=null,this},toJSON:function(){var d={name:this.name,x:this.x,y:this.y,width:this.width,height:this.height,zoom:this.zoom,rotation:this.rotation,roundPixels:this.roundPixels,scrollX:this.scrollX,scrollY:this.scrollY,backgroundColor:this.backgroundColor.rgba};return this.useBounds&&(d.bounds={x:this._bounds.x,y:this._bounds.y,width:this._bounds.width,height:this._bounds.height}),d},update:function(){},setIsSceneCamera:function(d){return this.isSceneCamera=d,this},updateSystem:function(){if(!(!this.scaleManager||!this.isSceneCamera)){var d=this._x!==0||this._y!==0||this.scaleManager.width!==this._width||this.scaleManager.height!==this._height,v=this.sceneManager;d&&!this._customViewport?v.customViewports++:!d&&this._customViewport&&v.customViewports--,this.dirty=!0,this._customViewport=d}},destroy:function(){this.emit(l.DESTROY,this),this.removeAllListeners(),this.matrix.destroy(),this.culledObjects=[],this._customViewport&&this.sceneManager.customViewports--,this.renderList=[],this._bounds=null,this.scene=null,this.scaleManager=null,this.sceneManager=null,this.cameraManager=null},x:{get:function(){return this._x},set:function(d){this._x=d,this.updateSystem()}},y:{get:function(){return this._y},set:function(d){this._y=d,this.updateSystem()}},width:{get:function(){return this._width},set:function(d){this._width=d,this.updateSystem()}},height:{get:function(){return this._height},set:function(d){this._height=d,this.updateSystem()}},scrollX:{get:function(){return this._scrollX},set:function(d){d!==this._scrollX&&(this._scrollX=d,this.dirty=!0)}},scrollY:{get:function(){return this._scrollY},set:function(d){d!==this._scrollY&&(this._scrollY=d,this.dirty=!0)}},zoom:{get:function(){return(this._zoomX+this._zoomY)/2},set:function(d){this._zoomX=d,this._zoomY=d,this.dirty=!0}},zoomX:{get:function(){return this._zoomX},set:function(d){this._zoomX=d,this.dirty=!0}},zoomY:{get:function(){return this._zoomY},set:function(d){this._zoomY=d,this.dirty=!0}},rotation:{get:function(){return this._rotation},set:function(d){this._rotation=d,this.dirty=!0}},centerX:{get:function(){return this.x+.5*this.width}},centerY:{get:function(){return this.y+.5*this.height}},displayWidth:{get:function(){return this.width/this.zoomX}},displayHeight:{get:function(){return this.height/this.zoomY}}});s.exports=c},38058:(s,y,e)=>{/** + */var r=e(83419),p=e(31401),h=e(39506),a=e(50792),l=e(19715),n=e(87841),u=e(61340),f=e(80333),o=e(26099),c=new r({Extends:a,Mixins:[p.AlphaSingle,p.Visible],initialize:function(v,m,S,M){v===void 0&&(v=0),m===void 0&&(m=0),S===void 0&&(S=0),M===void 0&&(M=0),a.call(this),this.scene,this.sceneManager,this.scaleManager,this.cameraManager,this.id=0,this.name="",this.roundPixels=!1,this.useBounds=!1,this.worldView=new n,this.dirty=!0,this._x=v,this._y=m,this._width=S,this._height=M,this._bounds=new n,this._scrollX=0,this._scrollY=0,this._zoomX=1,this._zoomY=1,this._rotation=0,this.matrix=new u,this.transparent=!0,this.backgroundColor=f("rgba(0,0,0,0)"),this.disableCull=!1,this.culledObjects=[],this.midPoint=new o(S/2,M/2),this.originX=.5,this.originY=.5,this._customViewport=!1,this.mask=null,this._maskCamera=null,this.renderList=[],this.isSceneCamera=!0},addToRenderList:function(d){this.renderList.push(d)},setOrigin:function(d,v){return d===void 0&&(d=.5),v===void 0&&(v=d),this.originX=d,this.originY=v,this},getScroll:function(d,v,m){m===void 0&&(m=new o);var S=this.width*.5,M=this.height*.5;return m.x=d-S,m.y=v-M,this.useBounds&&(m.x=this.clampX(m.x),m.y=this.clampY(m.y)),m},centerOnX:function(d){var v=this.width*.5;return this.midPoint.x=d,this.scrollX=d-v,this.useBounds&&(this.scrollX=this.clampX(this.scrollX)),this},centerOnY:function(d){var v=this.height*.5;return this.midPoint.y=d,this.scrollY=d-v,this.useBounds&&(this.scrollY=this.clampY(this.scrollY)),this},centerOn:function(d,v){return this.centerOnX(d),this.centerOnY(v),this},centerToBounds:function(){if(this.useBounds){var d=this._bounds,v=this.width*.5,m=this.height*.5;this.midPoint.set(d.centerX,d.centerY),this.scrollX=d.centerX-v,this.scrollY=d.centerY-m}return this},centerToSize:function(){return this.scrollX=this.width*.5,this.scrollY=this.height*.5,this},cull:function(d){if(this.disableCull)return d;var v=this.matrix.matrix,m=v[0],S=v[1],M=v[2],w=v[3],C=m*w-S*M;if(!C)return d;var A=v[4],P=v[5],b=this.scrollX,O=this.scrollY,I=this.width,D=this.height,B=this.y,G=B+D,z=this.x,X=z+I,j=this.culledObjects,Q=d.length;C=1/C,j.length=0;for(var tt=0;ttz&&_B&&qM&&(d=M),d},clampY:function(d){var v=this._bounds,m=this.displayHeight,S=v.y+(m-this.height)/2,M=Math.max(S,S+v.height-m);return dM&&(d=M),d},removeBounds:function(){return this.useBounds=!1,this.dirty=!0,this._bounds.setEmpty(),this},setAngle:function(d){return d===void 0&&(d=0),this.rotation=h(d),this},setBackgroundColor:function(d){return d===void 0&&(d="rgba(0,0,0,0)"),this.backgroundColor=f(d),this.transparent=this.backgroundColor.alpha===0,this},setBounds:function(d,v,m,S,M){return M===void 0&&(M=!1),this._bounds.setTo(d,v,m,S),this.dirty=!0,this.useBounds=!0,M?this.centerToBounds():(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},getBounds:function(d){d===void 0&&(d=new n);var v=this._bounds;return d.setTo(v.x,v.y,v.width,v.height),d},setName:function(d){return d===void 0&&(d=""),this.name=d,this},setPosition:function(d,v){return v===void 0&&(v=d),this.x=d,this.y=v,this},setRotation:function(d){return d===void 0&&(d=0),this.rotation=d,this},setRoundPixels:function(d){return this.roundPixels=d,this},setScene:function(d,v){v===void 0&&(v=!0),this.scene&&this._customViewport&&this.sceneManager.customViewports--,this.scene=d,this.isSceneCamera=v;var m=d.sys;return this.sceneManager=m.game.scene,this.scaleManager=m.scale,this.cameraManager=m.cameras,this.updateSystem(),this},setScroll:function(d,v){return v===void 0&&(v=d),this.scrollX=d,this.scrollY=v,this},setSize:function(d,v){return v===void 0&&(v=d),this.width=d,this.height=v,this},setViewport:function(d,v,m,S){return this.x=d,this.y=v,this.width=m,this.height=S,this},setZoom:function(d,v){return d===void 0&&(d=1),v===void 0&&(v=d),d===0&&(d=.001),v===0&&(v=.001),this.zoomX=d,this.zoomY=v,this},setMask:function(d,v){return v===void 0&&(v=!0),this.mask=d,this._maskCamera=v?this.cameraManager.default:this,this},clearMask:function(d){return d===void 0&&(d=!1),d&&this.mask&&this.mask.destroy(),this.mask=null,this},toJSON:function(){var d={name:this.name,x:this.x,y:this.y,width:this.width,height:this.height,zoom:this.zoom,rotation:this.rotation,roundPixels:this.roundPixels,scrollX:this.scrollX,scrollY:this.scrollY,backgroundColor:this.backgroundColor.rgba};return this.useBounds&&(d.bounds={x:this._bounds.x,y:this._bounds.y,width:this._bounds.width,height:this._bounds.height}),d},update:function(){},setIsSceneCamera:function(d){return this.isSceneCamera=d,this},updateSystem:function(){if(!(!this.scaleManager||!this.isSceneCamera)){var d=this._x!==0||this._y!==0||this.scaleManager.width!==this._width||this.scaleManager.height!==this._height,v=this.sceneManager;d&&!this._customViewport?v.customViewports++:!d&&this._customViewport&&v.customViewports--,this.dirty=!0,this._customViewport=d}},destroy:function(){this.emit(l.DESTROY,this),this.removeAllListeners(),this.matrix.destroy(),this.culledObjects=[],this._customViewport&&this.sceneManager.customViewports--,this.renderList=[],this._bounds=null,this.scene=null,this.scaleManager=null,this.sceneManager=null,this.cameraManager=null},x:{get:function(){return this._x},set:function(d){this._x=d,this.updateSystem()}},y:{get:function(){return this._y},set:function(d){this._y=d,this.updateSystem()}},width:{get:function(){return this._width},set:function(d){this._width=d,this.updateSystem()}},height:{get:function(){return this._height},set:function(d){this._height=d,this.updateSystem()}},scrollX:{get:function(){return this._scrollX},set:function(d){d!==this._scrollX&&(this._scrollX=d,this.dirty=!0)}},scrollY:{get:function(){return this._scrollY},set:function(d){d!==this._scrollY&&(this._scrollY=d,this.dirty=!0)}},zoom:{get:function(){return(this._zoomX+this._zoomY)/2},set:function(d){this._zoomX=d,this._zoomY=d,this.dirty=!0}},zoomX:{get:function(){return this._zoomX},set:function(d){this._zoomX=d,this.dirty=!0}},zoomY:{get:function(){return this._zoomY},set:function(d){this._zoomY=d,this.dirty=!0}},rotation:{get:function(){return this._rotation},set:function(d){this._rotation=d,this.dirty=!0}},centerX:{get:function(){return this.x+.5*this.width}},centerY:{get:function(){return this.y+.5*this.height}},displayWidth:{get:function(){return this.width/this.zoomX}},displayHeight:{get:function(){return this.height/this.zoomY}}});s.exports=c},38058:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(71911),p=e(67502),h=e(45319),a=e(83419),l=e(31401),n=e(20052),u=e(19715),f=e(28915),o=e(87841),c=e(26099),d=new a({Extends:r,Mixins:[l.PostPipeline],initialize:function(m,S,M,w){r.call(this,m,S,M,w),this.initPostPipeline(),this.inputEnabled=!0,this.fadeEffect=new n.Fade(this),this.flashEffect=new n.Flash(this),this.shakeEffect=new n.Shake(this),this.panEffect=new n.Pan(this),this.rotateToEffect=new n.RotateTo(this),this.zoomEffect=new n.Zoom(this),this.lerp=new c(1,1),this.followOffset=new c,this.deadzone=null,this._follow=null},setDeadzone:function(v,m){if(v===void 0)this.deadzone=null;else{if(this.deadzone?(this.deadzone.width=v,this.deadzone.height=m):this.deadzone=new o(0,0,v,m),this._follow){var S=this.width/2,M=this.height/2,w=this._follow.x-this.followOffset.x,C=this._follow.y-this.followOffset.y;this.midPoint.set(w,C),this.scrollX=w-S,this.scrollY=C-M}p(this.deadzone,this.midPoint.x,this.midPoint.y)}return this},fadeIn:function(v,m,S,M,w,C){return this.fadeEffect.start(!1,v,m,S,M,!0,w,C)},fadeOut:function(v,m,S,M,w,C){return this.fadeEffect.start(!0,v,m,S,M,!0,w,C)},fadeFrom:function(v,m,S,M,w,C,A){return this.fadeEffect.start(!1,v,m,S,M,w,C,A)},fade:function(v,m,S,M,w,C,A){return this.fadeEffect.start(!0,v,m,S,M,w,C,A)},flash:function(v,m,S,M,w,C,A){return this.flashEffect.start(v,m,S,M,w,C,A)},shake:function(v,m,S,M,w){return this.shakeEffect.start(v,m,S,M,w)},pan:function(v,m,S,M,w,C,A){return this.panEffect.start(v,m,S,M,w,C,A)},rotateTo:function(v,m,S,M,w,C,A){return this.rotateToEffect.start(v,m,S,M,w,C,A)},zoomTo:function(v,m,S,M,w,C){return this.zoomEffect.start(v,m,S,M,w,C)},preRender:function(){this.renderList.length=0;var v=this.width,m=this.height,S=v*.5,M=m*.5,w=this.zoom,C=this.matrix,A=v*this.originX,P=m*this.originY,b=this._follow,O=this.deadzone,I=this.scrollX,D=this.scrollY;O&&p(O,this.midPoint.x,this.midPoint.y);var B=!1;if(b&&!this.panEffect.isRunning){var G=this.lerp,z=b.x-this.followOffset.x,X=b.y-this.followOffset.y;O?(zO.right&&(I=f(I,I+(z-O.right),G.x)),XO.bottom&&(D=f(D,D+(X-O.bottom),G.y))):(I=f(I,z-A,G.x),D=f(D,X-P,G.y)),B=!0}this.useBounds&&(I=this.clampX(I),D=this.clampY(D)),this.scrollX=I,this.scrollY=D;var K=I+S,Q=D+M;this.midPoint.set(K,Q);var tt=v/w,Y=m/w,Z=Math.floor(K-tt/2),U=Math.floor(Q-Y/2);this.worldView.setTo(Z,U,tt,Y),C.applyITRS(Math.floor(this.x+A),Math.floor(this.y+P),this.rotation,w,w),C.translate(-A,-P),this.shakeEffect.preRender(),B&&this.emit(u.FOLLOW_UPDATE,this,b)},setLerp:function(v,m){return v===void 0&&(v=1),m===void 0&&(m=v),this.lerp.set(v,m),this},setFollowOffset:function(v,m){return v===void 0&&(v=0),m===void 0&&(m=0),this.followOffset.set(v,m),this},startFollow:function(v,m,S,M,w,C){m===void 0&&(m=!1),S===void 0&&(S=1),M===void 0&&(M=S),w===void 0&&(w=0),C===void 0&&(C=w),this._follow=v,this.roundPixels=m,S=h(S,0,1),M=h(M,0,1),this.lerp.set(S,M),this.followOffset.set(w,C);var A=this.width/2,P=this.height/2,b=v.x-w,O=v.y-C;return this.midPoint.set(b,O),this.scrollX=b-A,this.scrollY=O-P,this.useBounds&&(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.rotateToEffect.reset(),this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(v,m){this.visible&&(this.rotateToEffect.update(v,m),this.panEffect.update(v,m),this.zoomEffect.update(v,m),this.shakeEffect.update(v,m),this.flashEffect.update(v,m),this.fadeEffect.update(v,m))},destroy:function(){this.resetFX(),r.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});s.exports=d},32743:(s,y,e)=>{/** + */var r=e(71911),p=e(67502),h=e(45319),a=e(83419),l=e(31401),n=e(20052),u=e(19715),f=e(28915),o=e(87841),c=e(26099),d=new a({Extends:r,Mixins:[l.PostPipeline],initialize:function(m,S,M,w){r.call(this,m,S,M,w),this.initPostPipeline(),this.inputEnabled=!0,this.fadeEffect=new n.Fade(this),this.flashEffect=new n.Flash(this),this.shakeEffect=new n.Shake(this),this.panEffect=new n.Pan(this),this.rotateToEffect=new n.RotateTo(this),this.zoomEffect=new n.Zoom(this),this.lerp=new c(1,1),this.followOffset=new c,this.deadzone=null,this._follow=null},setDeadzone:function(v,m){if(v===void 0)this.deadzone=null;else{if(this.deadzone?(this.deadzone.width=v,this.deadzone.height=m):this.deadzone=new o(0,0,v,m),this._follow){var S=this.width/2,M=this.height/2,w=this._follow.x-this.followOffset.x,C=this._follow.y-this.followOffset.y;this.midPoint.set(w,C),this.scrollX=w-S,this.scrollY=C-M}p(this.deadzone,this.midPoint.x,this.midPoint.y)}return this},fadeIn:function(v,m,S,M,w,C){return this.fadeEffect.start(!1,v,m,S,M,!0,w,C)},fadeOut:function(v,m,S,M,w,C){return this.fadeEffect.start(!0,v,m,S,M,!0,w,C)},fadeFrom:function(v,m,S,M,w,C,A){return this.fadeEffect.start(!1,v,m,S,M,w,C,A)},fade:function(v,m,S,M,w,C,A){return this.fadeEffect.start(!0,v,m,S,M,w,C,A)},flash:function(v,m,S,M,w,C,A){return this.flashEffect.start(v,m,S,M,w,C,A)},shake:function(v,m,S,M,w){return this.shakeEffect.start(v,m,S,M,w)},pan:function(v,m,S,M,w,C,A){return this.panEffect.start(v,m,S,M,w,C,A)},rotateTo:function(v,m,S,M,w,C,A){return this.rotateToEffect.start(v,m,S,M,w,C,A)},zoomTo:function(v,m,S,M,w,C){return this.zoomEffect.start(v,m,S,M,w,C)},preRender:function(){this.renderList.length=0;var v=this.width,m=this.height,S=v*.5,M=m*.5,w=this.zoom,C=this.matrix,A=v*this.originX,P=m*this.originY,b=this._follow,O=this.deadzone,I=this.scrollX,D=this.scrollY;O&&p(O,this.midPoint.x,this.midPoint.y);var B=!1;if(b&&!this.panEffect.isRunning){var G=this.lerp,z=b.x-this.followOffset.x,X=b.y-this.followOffset.y;O?(zO.right&&(I=f(I,I+(z-O.right),G.x)),XO.bottom&&(D=f(D,D+(X-O.bottom),G.y))):(I=f(I,z-A,G.x),D=f(D,X-P,G.y)),B=!0}this.useBounds&&(I=this.clampX(I),D=this.clampY(D)),this.scrollX=I,this.scrollY=D;var j=I+S,Q=D+M;this.midPoint.set(j,Q);var tt=v/w,Y=m/w,Z=Math.floor(j-tt/2),U=Math.floor(Q-Y/2);this.worldView.setTo(Z,U,tt,Y),C.applyITRS(Math.floor(this.x+A),Math.floor(this.y+P),this.rotation,w,w),C.translate(-A,-P),this.shakeEffect.preRender(),B&&this.emit(u.FOLLOW_UPDATE,this,b)},setLerp:function(v,m){return v===void 0&&(v=1),m===void 0&&(m=v),this.lerp.set(v,m),this},setFollowOffset:function(v,m){return v===void 0&&(v=0),m===void 0&&(m=0),this.followOffset.set(v,m),this},startFollow:function(v,m,S,M,w,C){m===void 0&&(m=!1),S===void 0&&(S=1),M===void 0&&(M=S),w===void 0&&(w=0),C===void 0&&(C=w),this._follow=v,this.roundPixels=m,S=h(S,0,1),M=h(M,0,1),this.lerp.set(S,M),this.followOffset.set(w,C);var A=this.width/2,P=this.height/2,b=v.x-w,O=v.y-C;return this.midPoint.set(b,O),this.scrollX=b-A,this.scrollY=O-P,this.useBounds&&(this.scrollX=this.clampX(this.scrollX),this.scrollY=this.clampY(this.scrollY)),this},stopFollow:function(){return this._follow=null,this},resetFX:function(){return this.rotateToEffect.reset(),this.panEffect.reset(),this.shakeEffect.reset(),this.flashEffect.reset(),this.fadeEffect.reset(),this},update:function(v,m){this.visible&&(this.rotateToEffect.update(v,m),this.panEffect.update(v,m),this.zoomEffect.update(v,m),this.shakeEffect.update(v,m),this.flashEffect.update(v,m),this.fadeEffect.update(v,m))},destroy:function(){this.resetFX(),r.prototype.destroy.call(this),this._follow=null,this.deadzone=null}});s.exports=d},32743:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -481,7 +481,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(40366),p=e(60848),h=e(24047),a=e(27919),l=e(83419),n=e(69547),u=e(83719),f=e(86054),o=e(45893),c=e(96391),d=e(82264),v=e(57264),m=e(50792),S=e(8443),M=e(7003),w=e(37277),C=e(77332),A=e(76531),P=e(60903),b=e(69442),O=e(17130),I=e(65898),D=e(51085),B=e(14747),G=new l({initialize:function(X){this.config=new n(X),this.renderer=null,this.domContainer=null,this.canvas=null,this.context=null,this.isBooted=!1,this.isRunning=!1,this.events=new m,this.anims=new p(this),this.textures=new O(this),this.cache=new h(this),this.registry=new o(this,new m),this.input=new M(this,this.config),this.scene=new P(this,this.config.sceneConfig),this.device=d,this.scale=new A(this,this.config),this.sound=null,this.sound=B.create(this),this.loop=new I(this,this.config.fps),this.plugins=new C(this,this.config),this.pendingDestroy=!1,this.removeCanvas=!1,this.noReturn=!1,this.hasFocus=!1,this.isPaused=!1,v(this.boot.bind(this))},boot:function(){if(!w.hasCore("EventEmitter")){console.warn("Aborting. Core Plugins missing.");return}this.isBooted=!0,this.config.preBoot(this),this.scale.preBoot(),f(this),u(this),c(this),r(this.canvas,this.config.parent),this.textures.once(b.READY,this.texturesReady,this),this.events.emit(S.BOOT)},texturesReady:function(){this.events.emit(S.READY),this.start()},start:function(){this.isRunning=!0,this.config.postBoot(this),this.renderer?this.loop.start(this.step.bind(this)):this.loop.start(this.headlessStep.bind(this)),D(this);var z=this.events;z.on(S.HIDDEN,this.onHidden,this),z.on(S.VISIBLE,this.onVisible,this),z.on(S.BLUR,this.onBlur,this),z.on(S.FOCUS,this.onFocus,this)},step:function(z,X){if(this.pendingDestroy)return this.runDestroy();if(!this.isPaused){var K=this.events;K.emit(S.PRE_STEP,z,X),K.emit(S.STEP,z,X),this.scene.update(z,X),K.emit(S.POST_STEP,z,X);var Q=this.renderer;Q.preRender(),K.emit(S.PRE_RENDER,Q,z,X),this.scene.render(Q),Q.postRender(),K.emit(S.POST_RENDER,Q,z,X)}},headlessStep:function(z,X){if(this.pendingDestroy)return this.runDestroy();if(!this.isPaused){var K=this.events;K.emit(S.PRE_STEP,z,X),K.emit(S.STEP,z,X),this.scene.update(z,X),K.emit(S.POST_STEP,z,X),this.scene.isProcessing=!1,K.emit(S.PRE_RENDER,null,z,X),K.emit(S.POST_RENDER,null,z,X)}},onHidden:function(){this.loop.pause(),this.events.emit(S.PAUSE)},pause:function(){var z=this.isPaused;this.isPaused=!0,z||this.events.emit(S.PAUSE)},onVisible:function(){this.loop.resume(),this.events.emit(S.RESUME)},resume:function(){var z=this.isPaused;this.isPaused=!1,z&&this.events.emit(S.RESUME)},onBlur:function(){this.hasFocus=!1,this.loop.blur()},onFocus:function(){this.hasFocus=!0,this.loop.focus()},getFrame:function(){return this.loop.frame},getTime:function(){return this.loop.now},destroy:function(z,X){X===void 0&&(X=!1),this.pendingDestroy=!0,this.removeCanvas=z,this.noReturn=X},runDestroy:function(){this.scene.destroy(),this.events.emit(S.DESTROY),this.events.removeAllListeners(),this.renderer&&this.renderer.destroy(),this.removeCanvas&&this.canvas&&(a.remove(this.canvas),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)),this.domContainer&&this.domContainer.parentNode&&this.domContainer.parentNode.removeChild(this.domContainer),this.loop.destroy(),this.pendingDestroy=!1}});s.exports=G},65898:(s,y,e)=>{/** + */var r=e(40366),p=e(60848),h=e(24047),a=e(27919),l=e(83419),n=e(69547),u=e(83719),f=e(86054),o=e(45893),c=e(96391),d=e(82264),v=e(57264),m=e(50792),S=e(8443),M=e(7003),w=e(37277),C=e(77332),A=e(76531),P=e(60903),b=e(69442),O=e(17130),I=e(65898),D=e(51085),B=e(14747),G=new l({initialize:function(X){this.config=new n(X),this.renderer=null,this.domContainer=null,this.canvas=null,this.context=null,this.isBooted=!1,this.isRunning=!1,this.events=new m,this.anims=new p(this),this.textures=new O(this),this.cache=new h(this),this.registry=new o(this,new m),this.input=new M(this,this.config),this.scene=new P(this,this.config.sceneConfig),this.device=d,this.scale=new A(this,this.config),this.sound=null,this.sound=B.create(this),this.loop=new I(this,this.config.fps),this.plugins=new C(this,this.config),this.pendingDestroy=!1,this.removeCanvas=!1,this.noReturn=!1,this.hasFocus=!1,this.isPaused=!1,v(this.boot.bind(this))},boot:function(){if(!w.hasCore("EventEmitter")){console.warn("Aborting. Core Plugins missing.");return}this.isBooted=!0,this.config.preBoot(this),this.scale.preBoot(),f(this),u(this),c(this),r(this.canvas,this.config.parent),this.textures.once(b.READY,this.texturesReady,this),this.events.emit(S.BOOT)},texturesReady:function(){this.events.emit(S.READY),this.start()},start:function(){this.isRunning=!0,this.config.postBoot(this),this.renderer?this.loop.start(this.step.bind(this)):this.loop.start(this.headlessStep.bind(this)),D(this);var z=this.events;z.on(S.HIDDEN,this.onHidden,this),z.on(S.VISIBLE,this.onVisible,this),z.on(S.BLUR,this.onBlur,this),z.on(S.FOCUS,this.onFocus,this)},step:function(z,X){if(this.pendingDestroy)return this.runDestroy();if(!this.isPaused){var j=this.events;j.emit(S.PRE_STEP,z,X),j.emit(S.STEP,z,X),this.scene.update(z,X),j.emit(S.POST_STEP,z,X);var Q=this.renderer;Q.preRender(),j.emit(S.PRE_RENDER,Q,z,X),this.scene.render(Q),Q.postRender(),j.emit(S.POST_RENDER,Q,z,X)}},headlessStep:function(z,X){if(this.pendingDestroy)return this.runDestroy();if(!this.isPaused){var j=this.events;j.emit(S.PRE_STEP,z,X),j.emit(S.STEP,z,X),this.scene.update(z,X),j.emit(S.POST_STEP,z,X),this.scene.isProcessing=!1,j.emit(S.PRE_RENDER,null,z,X),j.emit(S.POST_RENDER,null,z,X)}},onHidden:function(){this.loop.pause(),this.events.emit(S.PAUSE)},pause:function(){var z=this.isPaused;this.isPaused=!0,z||this.events.emit(S.PAUSE)},onVisible:function(){this.loop.resume(),this.events.emit(S.RESUME)},resume:function(){var z=this.isPaused;this.isPaused=!1,z&&this.events.emit(S.RESUME)},onBlur:function(){this.hasFocus=!1,this.loop.blur()},onFocus:function(){this.hasFocus=!0,this.loop.focus()},getFrame:function(){return this.loop.frame},getTime:function(){return this.loop.now},destroy:function(z,X){X===void 0&&(X=!1),this.pendingDestroy=!0,this.removeCanvas=z,this.noReturn=X},runDestroy:function(){this.scene.destroy(),this.events.emit(S.DESTROY),this.events.removeAllListeners(),this.renderer&&this.renderer.destroy(),this.removeCanvas&&this.canvas&&(a.remove(this.canvas),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)),this.domContainer&&this.domContainer.parentNode&&this.domContainer.parentNode.removeChild(this.domContainer),this.loop.destroy(),this.pendingDestroy=!1}});s.exports=G},65898:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1171,8 +1171,8 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var y=function(e,r,p,h){if(p===void 0&&(p=!1),h===void 0)return h={local:{x:0,y:0,width:0,height:0},global:{x:0,y:0,width:0,height:0},lines:{shortest:0,longest:0,lengths:null,height:0},wrappedText:"",words:[],characters:[],scaleX:0,scaleY:0},h;var a=e.text,l=a.length,n=e.maxWidth,u=e.wordWrapCharCode,f=Number.MAX_VALUE,o=Number.MAX_VALUE,c=0,d=0,v=e.fontData.chars,m=e.fontData.lineHeight,S=e.letterSpacing,M=e.lineSpacing,w=0,C=0,A=0,P=null,b=e._align,O=0,I=0,D=e.fontSize/e.fontData.size,B=D*e.scaleX,G=D*e.scaleY,z=null,X=0,K=[],Q=Number.MAX_VALUE,tt=0,Y=0,Z=0,U,H=[],J=[],_=null;if(n>0){for(U=0;Un||Vt>n?(rt.push(gt.i-1),gt.cr?(rt.push(gt.i+gt.word.length),ot=0,at=null):at=gt):gt.cr&&(rt.push(gt.i+gt.word.length),ot=0,at=null)}var dt=function(Oe,Be,Le){return Oe.substr(0,Be)+Le+Oe.substr(Be+1)};for(U=rt.length-1;U>=0;U--)a=dt(a,rt[U],` -`);h.wrappedText=a,l=a.length,H=[],_=null}var ut=0;for(U=0;Utt&&(tt=Z),ZO&&(f=O),o>I&&(o=I);var Dt=O+P.xAdvance,Ht=I+m;ctt&&(tt=Z),Z0)for(var ne=0;ne{/** + */var y=function(e,r,p,h){if(p===void 0&&(p=!1),h===void 0)return h={local:{x:0,y:0,width:0,height:0},global:{x:0,y:0,width:0,height:0},lines:{shortest:0,longest:0,lengths:null,height:0},wrappedText:"",words:[],characters:[],scaleX:0,scaleY:0},h;var a=e.text,l=a.length,n=e.maxWidth,u=e.wordWrapCharCode,f=Number.MAX_VALUE,o=Number.MAX_VALUE,c=0,d=0,v=e.fontData.chars,m=e.fontData.lineHeight,S=e.letterSpacing,M=e.lineSpacing,w=0,C=0,A=0,P=null,b=e._align,O=0,I=0,D=e.fontSize/e.fontData.size,B=D*e.scaleX,G=D*e.scaleY,z=null,X=0,j=[],Q=Number.MAX_VALUE,tt=0,Y=0,Z=0,U,H=[],J=[],_=null;if(n>0){for(U=0;Un||Vt>n?(rt.push(gt.i-1),gt.cr?(rt.push(gt.i+gt.word.length),ot=0,at=null):at=gt):gt.cr&&(rt.push(gt.i+gt.word.length),ot=0,at=null)}var dt=function(Oe,Be,Le){return Oe.substr(0,Be)+Le+Oe.substr(Be+1)};for(U=rt.length-1;U>=0;U--)a=dt(a,rt[U],` +`);h.wrappedText=a,l=a.length,H=[],_=null}var ut=0;for(U=0;Utt&&(tt=Z),ZO&&(f=O),o>I&&(o=I);var Dt=O+P.xAdvance,Ht=I+m;ctt&&(tt=Z),Z0)for(var re=0;re{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1180,11 +1180,11 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(35154),p=function(h,a){var l=a.width,n=a.height,u=Math.floor(l/2),f=Math.floor(n/2),o=r(a,"chars","");if(o!==""){var c=r(a,"image",""),d=h.sys.textures.getFrame(c),v=d.cutX,m=d.cutY,S=d.source.width,M=d.source.height,w=r(a,"offset.x",0),C=r(a,"offset.y",0),A=r(a,"spacing.x",0),P=r(a,"spacing.y",0),b=r(a,"lineSpacing",0),O=r(a,"charsPerRow",null);O===null&&(O=S/l,O>o.length&&(O=o.length));for(var I=w,D=C,B={retroFont:!0,font:c,size:l,lineHeight:n+b,chars:{}},G=0,z=0;z{/** + */var r=e(35154),p=function(h,a){var l=a.width,n=a.height,u=Math.floor(l/2),f=Math.floor(n/2),o=r(a,"chars","");if(o!==""){var c=r(a,"image",""),d=h.sys.textures.getFrame(c),v=d.cutX,m=d.cutY,S=d.source.width,M=d.source.height,w=r(a,"offset.x",0),C=r(a,"offset.y",0),A=r(a,"spacing.x",0),P=r(a,"spacing.y",0),b=r(a,"lineSpacing",0),O=r(a,"charsPerRow",null);O===null&&(O=S/l,O>o.length&&(O=o.length));for(var I=w,D=C,B={retroFont:!0,font:c,size:l,lineHeight:n+b,chars:{}},G=0,z=0;z{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */function y(r,p){return parseInt(r.getAttribute(p),10)}var e=function(r,p,h,a,l){h===void 0&&(h=0),a===void 0&&(a=0);var n=p.cutX,u=p.cutY,f=p.source.width,o=p.source.height,c=p.sourceIndex,d={},v=r.getElementsByTagName("info")[0],m=r.getElementsByTagName("common")[0];d.font=v.getAttribute("face"),d.size=y(v,"size"),d.lineHeight=y(m,"lineHeight")+a,d.chars={};var S=r.getElementsByTagName("char"),M=p!==void 0&&p.trimmed;if(M)var w=p.height,C=p.width;for(var A=0;A{/** + */function y(r,p){return parseInt(r.getAttribute(p),10)}var e=function(r,p,h,a,l){h===void 0&&(h=0),a===void 0&&(a=0);var n=p.cutX,u=p.cutY,f=p.source.width,o=p.source.height,c=p.sourceIndex,d={},v=r.getElementsByTagName("info")[0],m=r.getElementsByTagName("common")[0];d.font=v.getAttribute("face"),d.size=y(v,"size"),d.lineHeight=y(m,"lineHeight")+a,d.chars={};var S=r.getElementsByTagName("char"),M=p!==void 0&&p.trimmed;if(M)var w=p.height,C=p.width;for(var A=0;A{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1200,7 +1200,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(20926),p=function(h,a,l,n){var u=a._text,f=u.length,o=h.currentContext;if(!(f===0||!r(h,o,a,l,n))){l.addToRenderList(a);var c=a.fromAtlas?a.frame:a.texture.frames.__BASE,d=a.displayCallback,v=a.callbackData,m=a.fontData.chars,S=a.fontData.lineHeight,M=a._letterSpacing,w=0,C=0,A=0,P=null,b=0,O=0,I=0,D=0,B=0,G=0,z=null,X=0,K=a.frame.source.image,Q=c.cutX,tt=c.cutY,Y=0,Z=0,U=a._fontSize/a.fontData.size,H=a._align,J=0,_=0;a.getTextBounds(!1);var q=a._bounds.lines;H===1?_=(q.longest-q.lengths[0])/2:H===2&&(_=q.longest-q.lengths[0]),o.translate(-a.displayOriginX,-a.displayOriginY);var at=l.roundPixels;a.cropWidth>0&&a.cropHeight>0&&(o.beginPath(),o.rect(0,0,a.cropWidth,a.cropHeight),o.clip());for(var ot=0;ot{/** + */var r=e(20926),p=function(h,a,l,n){var u=a._text,f=u.length,o=h.currentContext;if(!(f===0||!r(h,o,a,l,n))){l.addToRenderList(a);var c=a.fromAtlas?a.frame:a.texture.frames.__BASE,d=a.displayCallback,v=a.callbackData,m=a.fontData.chars,S=a.fontData.lineHeight,M=a._letterSpacing,w=0,C=0,A=0,P=null,b=0,O=0,I=0,D=0,B=0,G=0,z=null,X=0,j=a.frame.source.image,Q=c.cutX,tt=c.cutY,Y=0,Z=0,U=a._fontSize/a.fontData.size,H=a._align,J=0,_=0;a.getTextBounds(!1);var q=a._bounds.lines;H===1?_=(q.longest-q.lengths[0])/2:H===2&&(_=q.longest-q.lengths[0]),o.translate(-a.displayOriginX,-a.displayOriginY);var at=l.roundPixels;a.cropWidth>0&&a.cropHeight>0&&(o.beginPath(),o.rect(0,0,a.cropWidth,a.cropHeight),o.clip());for(var ot=0;ot{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1216,7 +1216,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(91296),p=e(61340),h=e(70554),a=new p,l=function(n,u,f,o){var c=u.text,d=c.length;if(d!==0){f.addToRenderList(u);var v=n.pipelines.set(u.pipeline,u),m=r(u,f,o);n.pipelines.preBatch(u);var S=m.sprite,M=m.calc,w=a,C=u.cropWidth>0||u.cropHeight>0;C&&(v.flush(),n.pushScissor(M.tx,M.ty,u.cropWidth*M.scaleX,u.cropHeight*M.scaleY));var A=u.frame,P=A.glTexture,b=u.tintFill,O=h.getTintAppendFloatAlpha(u.tintTopLeft,f.alpha*u._alphaTL),I=h.getTintAppendFloatAlpha(u.tintTopRight,f.alpha*u._alphaTR),D=h.getTintAppendFloatAlpha(u.tintBottomLeft,f.alpha*u._alphaBL),B=h.getTintAppendFloatAlpha(u.tintBottomRight,f.alpha*u._alphaBR),G=v.setGameObject(u),z=0,X=0,K=0,Q=0,tt=u.letterSpacing,Y,Z=0,U=0,H,J=u.scrollX,_=u.scrollY,q=u.fontData,at=q.chars,ot=q.lineHeight,rt=u.fontSize/q.size,gt=0,yt=u._align,Et=0,At=0,Pt=u.getTextBounds(!1);u.maxWidth>0&&(c=Pt.wrappedText,d=c.length);var Vt=u._bounds.lines;yt===1?At=(Vt.longest-Vt.lengths[0])/2:yt===2&&(At=Vt.longest-Vt.lengths[0]);for(var dt=f.roundPixels,ut=u.displayCallback,Rt=u.callbackData,Dt=0;Dt{/** + */var r=e(91296),p=e(61340),h=e(70554),a=new p,l=function(n,u,f,o){var c=u.text,d=c.length;if(d!==0){f.addToRenderList(u);var v=n.pipelines.set(u.pipeline,u),m=r(u,f,o);n.pipelines.preBatch(u);var S=m.sprite,M=m.calc,w=a,C=u.cropWidth>0||u.cropHeight>0;C&&(v.flush(),n.pushScissor(M.tx,M.ty,u.cropWidth*M.scaleX,u.cropHeight*M.scaleY));var A=u.frame,P=A.glTexture,b=u.tintFill,O=h.getTintAppendFloatAlpha(u.tintTopLeft,f.alpha*u._alphaTL),I=h.getTintAppendFloatAlpha(u.tintTopRight,f.alpha*u._alphaTR),D=h.getTintAppendFloatAlpha(u.tintBottomLeft,f.alpha*u._alphaBL),B=h.getTintAppendFloatAlpha(u.tintBottomRight,f.alpha*u._alphaBR),G=v.setGameObject(u),z=0,X=0,j=0,Q=0,tt=u.letterSpacing,Y,Z=0,U=0,H,J=u.scrollX,_=u.scrollY,q=u.fontData,at=q.chars,ot=q.lineHeight,rt=u.fontSize/q.size,gt=0,yt=u._align,Et=0,At=0,Pt=u.getTextBounds(!1);u.maxWidth>0&&(c=Pt.wrappedText,d=c.length);var Vt=u._bounds.lines;yt===1?At=(Vt.longest-Vt.lengths[0])/2:yt===2&&(At=Vt.longest-Vt.lengths[0]);for(var dt=f.roundPixels,ut=u.displayCallback,Rt=u.callbackData,Dt=0;Dt{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1225,7 +1225,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(20926),p=function(h,a,l,n){var u=a._text,f=u.length,o=h.currentContext;if(!(f===0||!r(h,o,a,l,n))){l.addToRenderList(a);var c=a.fromAtlas?a.frame:a.texture.frames.__BASE,d=a.fontData.chars,v=a.fontData.lineHeight,m=a._letterSpacing,S=a._lineSpacing,M=0,w=0,C=0,A=null,P=0,b=0,O=0,I=0,D=0,B=0,G=null,z=0,X=c.source.image,K=c.cutX,Q=c.cutY,tt=a._fontSize/a.fontData.size,Y=a._align,Z=0,U=0,H=a.getTextBounds(!1);a.maxWidth>0&&(u=H.wrappedText,f=u.length);var J=a._bounds.lines;Y===1?U=(J.longest-J.lengths[0])/2:Y===2&&(U=J.longest-J.lengths[0]),o.translate(-a.displayOriginX,-a.displayOriginY);for(var _=l.roundPixels,q=0;q{/** + */var r=e(20926),p=function(h,a,l,n){var u=a._text,f=u.length,o=h.currentContext;if(!(f===0||!r(h,o,a,l,n))){l.addToRenderList(a);var c=a.fromAtlas?a.frame:a.texture.frames.__BASE,d=a.fontData.chars,v=a.fontData.lineHeight,m=a._letterSpacing,S=a._lineSpacing,M=0,w=0,C=0,A=null,P=0,b=0,O=0,I=0,D=0,B=0,G=null,z=0,X=c.source.image,j=c.cutX,Q=c.cutY,tt=a._fontSize/a.fontData.size,Y=a._align,Z=0,U=0,H=a.getTextBounds(!1);a.maxWidth>0&&(u=H.wrappedText,f=u.length);var J=a._bounds.lines;Y===1?U=(J.longest-J.lengths[0])/2:Y===2&&(U=J.longest-J.lengths[0]),o.translate(-a.displayOriginX,-a.displayOriginY);for(var _=l.roundPixels,q=0;q{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1241,7 +1241,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(3217),p=e(91296),h=e(70554),a=function(l,n,u,f){var o=n._text,c=o.length;if(c!==0){u.addToRenderList(n);var d=l.pipelines.set(n.pipeline,n),v=p(n,u,f).calc;l.pipelines.preBatch(n);var m=u.roundPixels,S=u.alpha,M=n.charColors,w=n.tintFill,C=h.getTintAppendFloatAlpha,A=C(n.tintTopLeft,S*n._alphaTL),P=C(n.tintTopRight,S*n._alphaTR),b=C(n.tintBottomLeft,S*n._alphaBL),O=C(n.tintBottomRight,S*n._alphaBR),I=n.frame.glTexture,D=d.setGameObject(n),B=n.getTextBounds(!1),G,z,X,K=B.characters,Q=n.dropShadowX,tt=n.dropShadowY,Y=Q!==0||tt!==0;if(Y){var Z=n.dropShadowColor,U=n.dropShadowAlpha,H=C(Z,S*U*n._alphaTL),J=C(Z,S*U*n._alphaTR),_=C(Z,S*U*n._alphaBL),q=C(Z,S*U*n._alphaBR);for(G=0;G{/** + */var r=e(3217),p=e(91296),h=e(70554),a=function(l,n,u,f){var o=n._text,c=o.length;if(c!==0){u.addToRenderList(n);var d=l.pipelines.set(n.pipeline,n),v=p(n,u,f).calc;l.pipelines.preBatch(n);var m=u.roundPixels,S=u.alpha,M=n.charColors,w=n.tintFill,C=h.getTintAppendFloatAlpha,A=C(n.tintTopLeft,S*n._alphaTL),P=C(n.tintTopRight,S*n._alphaTR),b=C(n.tintBottomLeft,S*n._alphaBL),O=C(n.tintBottomRight,S*n._alphaBR),I=n.frame.glTexture,D=d.setGameObject(n),B=n.getTextBounds(!1),G,z,X,j=B.characters,Q=n.dropShadowX,tt=n.dropShadowY,Y=Q!==0||tt!==0;if(Y){var Z=n.dropShadowColor,U=n.dropShadowAlpha,H=C(Z,S*U*n._alphaTL),J=C(Z,S*U*n._alphaTR),_=C(Z,S*U*n._alphaBL),q=C(Z,S*U*n._alphaBR);for(G=0;G{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1265,7 +1265,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(61340),p=e(70554),h=new r,a=function(l,n,u,f){var o=n.getRenderList(),c=u.alpha*n.alpha;if(!(o.length===0||c===0)){u.addToRenderList(n);var d=l.pipelines.set(this.pipeline,n),v=u.scrollX*n.scrollFactorX,m=u.scrollY*n.scrollFactorY,S=h.copyFrom(u.matrix);f&&(S.multiplyWithOffset(f,-v,-m),v=0,m=0);var M=n.x-v,w=n.y-m,C=-1,A=!1;l.pipelines.preBatch(n);for(var P=0;P{/** + */var r=e(61340),p=e(70554),h=new r,a=function(l,n,u,f){var o=n.getRenderList(),c=u.alpha*n.alpha;if(!(o.length===0||c===0)){u.addToRenderList(n);var d=l.pipelines.set(this.pipeline,n),v=u.scrollX*n.scrollFactorX,m=u.scrollY*n.scrollFactorY,S=h.copyFrom(u.matrix);f&&(S.multiplyWithOffset(f,-v,-m),v=0,m=0);var M=n.x-v,w=n.y-m,C=-1,A=!1;l.pipelines.preBatch(n);for(var P=0;P{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1535,11 +1535,11 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(85592),p=e(91296),h=e(61340),a=e(70554),l=function(c,d,v){this.x=c,this.y=d,this.width=v},n=function(c,d,v){this.points=[],this.pointsLength=1,this.points[0]=new l(c,d,v)},u=[],f=new h,o=function(c,d,v,m){if(d.commandBuffer.length!==0){v.addToRenderList(d);var S=c.pipelines.set(d.pipeline,d);c.pipelines.preBatch(d);for(var M=p(d,v,m).calc,w=f.loadIdentity(),C=d.commandBuffer,A=v.alpha*d.alpha,P=1,b=S.fillTint,O=S.strokeTint,I=0,D=0,B=0,G=.01,z=Math.PI*2,X,K=[],Q=0,tt=!0,Y=null,Z=a.getTintAppendFloatAlpha,U=0;U0&&(Dt=-z+Dt%z):Dt>z?Dt=z:Dt<0&&(Dt=z+Dt%z),Y===null&&(Y=new n(Vt+Math.cos(Rt)*ut,dt+Math.sin(Rt)*ut,P),K.push(Y),Pt+=G);Pt<1+Bt;)B=Dt*Pt+Rt,I=Vt+Math.cos(B)*ut,D=dt+Math.sin(B)*ut,Y.points.push(new l(I,D,P)),Pt+=G;B=Dt+Rt,I=Vt+Math.cos(B)*ut,D=dt+Math.sin(B)*ut,Y.points.push(new l(I,D,P));break}case r.FILL_RECT:{S.batchFillRect(C[++U],C[++U],C[++U],C[++U],w,M);break}case r.FILL_TRIANGLE:{S.batchFillTriangle(C[++U],C[++U],C[++U],C[++U],C[++U],C[++U],w,M);break}case r.STROKE_TRIANGLE:{S.batchStrokeTriangle(C[++U],C[++U],C[++U],C[++U],C[++U],C[++U],P,w,M);break}case r.LINE_TO:{Y!==null?Y.points.push(new l(C[++U],C[++U],P)):(Y=new n(C[++U],C[++U],P),K.push(Y));break}case r.MOVE_TO:{Y=new n(C[++U],C[++U],P),K.push(Y);break}case r.SAVE:{u.push(w.copyToArray());break}case r.RESTORE:{w.copyFromArray(u.pop());break}case r.TRANSLATE:{Vt=C[++U],dt=C[++U],w.translate(Vt,dt);break}case r.SCALE:{Vt=C[++U],dt=C[++U],w.scale(Vt,dt);break}case r.ROTATE:{w.rotate(C[++U]);break}}c.pipelines.postBatch(d)}};s.exports=o},26479:(s,y,e)=>{/** + */var r=e(85592),p=e(91296),h=e(61340),a=e(70554),l=function(c,d,v){this.x=c,this.y=d,this.width=v},n=function(c,d,v){this.points=[],this.pointsLength=1,this.points[0]=new l(c,d,v)},u=[],f=new h,o=function(c,d,v,m){if(d.commandBuffer.length!==0){v.addToRenderList(d);var S=c.pipelines.set(d.pipeline,d);c.pipelines.preBatch(d);for(var M=p(d,v,m).calc,w=f.loadIdentity(),C=d.commandBuffer,A=v.alpha*d.alpha,P=1,b=S.fillTint,O=S.strokeTint,I=0,D=0,B=0,G=.01,z=Math.PI*2,X,j=[],Q=0,tt=!0,Y=null,Z=a.getTintAppendFloatAlpha,U=0;U0&&(Dt=-z+Dt%z):Dt>z?Dt=z:Dt<0&&(Dt=z+Dt%z),Y===null&&(Y=new n(Vt+Math.cos(Rt)*ut,dt+Math.sin(Rt)*ut,P),j.push(Y),Pt+=G);Pt<1+Bt;)B=Dt*Pt+Rt,I=Vt+Math.cos(B)*ut,D=dt+Math.sin(B)*ut,Y.points.push(new l(I,D,P)),Pt+=G;B=Dt+Rt,I=Vt+Math.cos(B)*ut,D=dt+Math.sin(B)*ut,Y.points.push(new l(I,D,P));break}case r.FILL_RECT:{S.batchFillRect(C[++U],C[++U],C[++U],C[++U],w,M);break}case r.FILL_TRIANGLE:{S.batchFillTriangle(C[++U],C[++U],C[++U],C[++U],C[++U],C[++U],w,M);break}case r.STROKE_TRIANGLE:{S.batchStrokeTriangle(C[++U],C[++U],C[++U],C[++U],C[++U],C[++U],P,w,M);break}case r.LINE_TO:{Y!==null?Y.points.push(new l(C[++U],C[++U],P)):(Y=new n(C[++U],C[++U],P),j.push(Y));break}case r.MOVE_TO:{Y=new n(C[++U],C[++U],P),j.push(Y);break}case r.SAVE:{u.push(w.copyToArray());break}case r.RESTORE:{w.copyFromArray(u.pop());break}case r.TRANSLATE:{Vt=C[++U],dt=C[++U],w.translate(Vt,dt);break}case r.SCALE:{Vt=C[++U],dt=C[++U],w.scale(Vt,dt);break}case r.ROTATE:{w.rotate(C[++U]);break}}c.pipelines.postBatch(d)}};s.exports=o},26479:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(61061),p=e(83419),h=e(51708),a=e(50792),l=e(46710),n=e(95540),u=e(35154),f=e(97022),o=e(41212),c=e(88492),d=e(35072),v=e(68287),m=new p({Extends:a,initialize:function(M,w,C){a.call(this),C?w&&!Array.isArray(w)&&(w=[w]):Array.isArray(w)?o(w[0])&&(C=w,w=null):o(w)&&(C=w,w=null),this.scene=M,this.children=new d,this.isParent=!0,this.type="Group",this.classType=n(C,"classType",v),this.name=n(C,"name",""),this.active=n(C,"active",!0),this.maxSize=n(C,"maxSize",-1),this.defaultKey=n(C,"defaultKey",null),this.defaultFrame=n(C,"defaultFrame",null),this.runChildUpdate=n(C,"runChildUpdate",!1),this.createCallback=n(C,"createCallback",null),this.removeCallback=n(C,"removeCallback",null),this.createMultipleCallback=n(C,"createMultipleCallback",null),this.internalCreateCallback=n(C,"internalCreateCallback",null),this.internalRemoveCallback=n(C,"internalRemoveCallback",null),w&&this.addMultiple(w),C&&this.createMultiple(C),this.on(h.ADDED_TO_SCENE,this.addedToScene,this),this.on(h.REMOVED_FROM_SCENE,this.removedFromScene,this)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},create:function(S,M,w,C,A,P){if(S===void 0&&(S=0),M===void 0&&(M=0),w===void 0&&(w=this.defaultKey),C===void 0&&(C=this.defaultFrame),A===void 0&&(A=!0),P===void 0&&(P=!0),this.isFull())return null;var b=new this.classType(this.scene,S,M,w,C);return b.addToDisplayList(this.scene.sys.displayList),b.addToUpdateList(),b.visible=A,b.setActive(P),this.add(b),b},createMultiple:function(S){if(this.isFull())return[];Array.isArray(S)||(S=[S]);var M=[];if(S[0].key)for(var w=0;w=0;B--)if(D=z[B],D.active===w){if(G++,G===M)break}else D=null;return D?(typeof A=="number"&&(D.x=A),typeof P=="number"&&(D.y=P),D):C?this.create(A,P,b,O,I):null},get:function(S,M,w,C,A){return this.getFirst(!1,!0,S,M,w,C,A)},getFirstAlive:function(S,M,w,C,A,P){return this.getFirst(!0,S,M,w,C,A,P)},getFirstDead:function(S,M,w,C,A,P){return this.getFirst(!1,S,M,w,C,A,P)},playAnimation:function(S,M){return r.PlayAnimation(this.children.entries,S,M),this},isFull:function(){return this.maxSize===-1?!1:this.children.size>=this.maxSize},countActive:function(S){S===void 0&&(S=!0);for(var M=0,w=0;w{/** + */var r=e(61061),p=e(83419),h=e(51708),a=e(50792),l=e(46710),n=e(95540),u=e(35154),f=e(97022),o=e(41212),c=e(88492),d=e(35072),v=e(68287),m=new p({Extends:a,initialize:function(M,w,C){a.call(this),C?w&&!Array.isArray(w)&&(w=[w]):Array.isArray(w)?o(w[0])&&(C=w,w=null):o(w)&&(C=w,w=null),this.scene=M,this.children=new d,this.isParent=!0,this.type="Group",this.classType=n(C,"classType",v),this.name=n(C,"name",""),this.active=n(C,"active",!0),this.maxSize=n(C,"maxSize",-1),this.defaultKey=n(C,"defaultKey",null),this.defaultFrame=n(C,"defaultFrame",null),this.runChildUpdate=n(C,"runChildUpdate",!1),this.createCallback=n(C,"createCallback",null),this.removeCallback=n(C,"removeCallback",null),this.createMultipleCallback=n(C,"createMultipleCallback",null),this.internalCreateCallback=n(C,"internalCreateCallback",null),this.internalRemoveCallback=n(C,"internalRemoveCallback",null),w&&this.addMultiple(w),C&&this.createMultiple(C),this.on(h.ADDED_TO_SCENE,this.addedToScene,this),this.on(h.REMOVED_FROM_SCENE,this.removedFromScene,this)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},create:function(S,M,w,C,A,P){if(S===void 0&&(S=0),M===void 0&&(M=0),w===void 0&&(w=this.defaultKey),C===void 0&&(C=this.defaultFrame),A===void 0&&(A=!0),P===void 0&&(P=!0),this.isFull())return null;var b=new this.classType(this.scene,S,M,w,C);return b.addToDisplayList(this.scene.sys.displayList),b.addToUpdateList(),b.visible=A,b.setActive(P),this.add(b),b},createMultiple:function(S){if(this.isFull())return[];Array.isArray(S)||(S=[S]);var M=[];if(S[0].key)for(var w=0;w=0;B--)if(D=z[B],D.active===w){if(G++,G===M)break}else D=null;return D?(typeof A=="number"&&(D.x=A),typeof P=="number"&&(D.y=P),D):C?this.create(A,P,b,O,I):null},get:function(S,M,w,C,A){return this.getFirst(!1,!0,S,M,w,C,A)},getFirstAlive:function(S,M,w,C,A,P){return this.getFirst(!0,S,M,w,C,A,P)},getFirstDead:function(S,M,w,C,A,P){return this.getFirst(!1,S,M,w,C,A,P)},playAnimation:function(S,M){return r.PlayAnimation(this.children.entries,S,M),this},isFull:function(){return this.maxSize===-1?!1:this.children.size>=this.maxSize},countActive:function(S){S===void 0&&(S=!0);for(var M=0,w=0;w{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1615,7 +1615,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83419),p=e(31401),h=e(39506),a=e(83997),l=e(95643),n=e(34684),u=e(92515),f=e(91296),o=e(37867),c=e(29807),d=e(43396),v=e(19186),m=e(25836),S=e(39318),M=new r({Extends:l,Mixins:[p.AlphaSingle,p.BlendMode,p.Depth,p.Mask,p.Pipeline,p.PostPipeline,p.ScrollFactor,p.Size,p.Texture,p.Transform,p.Visible,c],initialize:function(C,A,P,b,O,I,D,B,G,z,X,K){A===void 0&&(A=0),P===void 0&&(P=0),b===void 0&&(b="__WHITE"),l.call(this,C,"Mesh"),this.faces=[],this.vertices=[],this.tintFill=!1,this.debugCallback=null,this.debugGraphic=null,this.hideCCW=!0,this.modelPosition=new m,this.modelScale=new m(1,1,1),this.modelRotation=new m,this.dirtyCache=[0,0,0,0,0,0,0,0,0,0,0,0],this.transformMatrix=new o,this.viewPosition=new m,this.viewMatrix=new o,this.projectionMatrix=new o,this.totalRendered=0,this.totalFrame=0,this.ignoreDirtyCache=!1,this.fov,this.displayOriginX=0,this.displayOriginY=0;var Q=C.sys.renderer;this.setPosition(A,P),this.setTexture(b,O),this.setSize(Q.width,Q.height),this.initPipeline(),this.initPostPipeline(),this.setPerspective(Q.width,Q.height),I&&this.addVertices(I,D,B,G,z,X,K)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},panX:function(w){return this.viewPosition.addScale(m.LEFT,w),this.dirtyCache[10]=1,this},panY:function(w){return this.viewPosition.y+=m.DOWN.y*w,this.dirtyCache[10]=1,this},panZ:function(w){return this.viewPosition.z+=w,this.dirtyCache[10]=1,this},setPerspective:function(w,C,A,P,b){return A===void 0&&(A=45),P===void 0&&(P=.01),b===void 0&&(b=1e3),this.fov=A,this.projectionMatrix.perspective(h(A),w/C,P,b),this.dirtyCache[10]=1,this.dirtyCache[11]=0,this},setOrtho:function(w,C,A,P){return w===void 0&&(w=this.scene.sys.renderer.getAspectRatio()),C===void 0&&(C=1),A===void 0&&(A=-1e3),P===void 0&&(P=1e3),this.fov=0,this.projectionMatrix.ortho(-w,w,-C,C,A,P),this.dirtyCache[10]=1,this.dirtyCache[11]=1,this},clear:function(){return this.faces.forEach(function(w){w.destroy()}),this.faces=[],this.vertices=[],this},addVerticesFromObj:function(w,C,A,P,b,O,I,D,B){var G=this.scene.sys.cache.obj.get(w),z;return G&&(z=n(G,this,C,A,P,b,O,I,D,B)),(!z||z.verts.length===0)&&console.warn("Mesh.addVerticesFromObj data empty:",w),this},sortByDepth:function(w,C){return w.depth-C.depth},depthSort:function(){return v(this.faces,this.sortByDepth),this},addVertex:function(w,C,A,P,b,O,I){var D=new S(w,C,A,P,b,O,I);return this.vertices.push(D),D},addFace:function(w,C,A){var P=new a(w,C,A);return this.faces.push(P),this.dirtyCache[9]=-1,P},addVertices:function(w,C,A,P,b,O,I){var D=u(w,C,A,P,b,O,I);return D?(this.faces=this.faces.concat(D.faces),this.vertices=this.vertices.concat(D.vertices)):console.warn("Mesh.addVertices data empty or invalid"),this.dirtyCache[9]=-1,this},getFaceCount:function(){return this.faces.length},getVertexCount:function(){return this.vertices.length},getFace:function(w){return this.faces[w]},hasFaceAt:function(w,C,A){A===void 0&&(A=this.scene.sys.cameras.main);for(var P=f(this,A).calc,b=this.faces,O=0;O{/** + */var r=e(83419),p=e(31401),h=e(39506),a=e(83997),l=e(95643),n=e(34684),u=e(92515),f=e(91296),o=e(37867),c=e(29807),d=e(43396),v=e(19186),m=e(25836),S=e(39318),M=new r({Extends:l,Mixins:[p.AlphaSingle,p.BlendMode,p.Depth,p.Mask,p.Pipeline,p.PostPipeline,p.ScrollFactor,p.Size,p.Texture,p.Transform,p.Visible,c],initialize:function(C,A,P,b,O,I,D,B,G,z,X,j){A===void 0&&(A=0),P===void 0&&(P=0),b===void 0&&(b="__WHITE"),l.call(this,C,"Mesh"),this.faces=[],this.vertices=[],this.tintFill=!1,this.debugCallback=null,this.debugGraphic=null,this.hideCCW=!0,this.modelPosition=new m,this.modelScale=new m(1,1,1),this.modelRotation=new m,this.dirtyCache=[0,0,0,0,0,0,0,0,0,0,0,0],this.transformMatrix=new o,this.viewPosition=new m,this.viewMatrix=new o,this.projectionMatrix=new o,this.totalRendered=0,this.totalFrame=0,this.ignoreDirtyCache=!1,this.fov,this.displayOriginX=0,this.displayOriginY=0;var Q=C.sys.renderer;this.setPosition(A,P),this.setTexture(b,O),this.setSize(Q.width,Q.height),this.initPipeline(),this.initPostPipeline(),this.setPerspective(Q.width,Q.height),I&&this.addVertices(I,D,B,G,z,X,j)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},panX:function(w){return this.viewPosition.addScale(m.LEFT,w),this.dirtyCache[10]=1,this},panY:function(w){return this.viewPosition.y+=m.DOWN.y*w,this.dirtyCache[10]=1,this},panZ:function(w){return this.viewPosition.z+=w,this.dirtyCache[10]=1,this},setPerspective:function(w,C,A,P,b){return A===void 0&&(A=45),P===void 0&&(P=.01),b===void 0&&(b=1e3),this.fov=A,this.projectionMatrix.perspective(h(A),w/C,P,b),this.dirtyCache[10]=1,this.dirtyCache[11]=0,this},setOrtho:function(w,C,A,P){return w===void 0&&(w=this.scene.sys.renderer.getAspectRatio()),C===void 0&&(C=1),A===void 0&&(A=-1e3),P===void 0&&(P=1e3),this.fov=0,this.projectionMatrix.ortho(-w,w,-C,C,A,P),this.dirtyCache[10]=1,this.dirtyCache[11]=1,this},clear:function(){return this.faces.forEach(function(w){w.destroy()}),this.faces=[],this.vertices=[],this},addVerticesFromObj:function(w,C,A,P,b,O,I,D,B){var G=this.scene.sys.cache.obj.get(w),z;return G&&(z=n(G,this,C,A,P,b,O,I,D,B)),(!z||z.verts.length===0)&&console.warn("Mesh.addVerticesFromObj data empty:",w),this},sortByDepth:function(w,C){return w.depth-C.depth},depthSort:function(){return v(this.faces,this.sortByDepth),this},addVertex:function(w,C,A,P,b,O,I){var D=new S(w,C,A,P,b,O,I);return this.vertices.push(D),D},addFace:function(w,C,A){var P=new a(w,C,A);return this.faces.push(P),this.dirtyCache[9]=-1,P},addVertices:function(w,C,A,P,b,O,I){var D=u(w,C,A,P,b,O,I);return D?(this.faces=this.faces.concat(D.faces),this.vertices=this.vertices.concat(D.vertices)):console.warn("Mesh.addVertices data empty or invalid"),this.dirtyCache[9]=-1,this},getFaceCount:function(){return this.faces.length},getVertexCount:function(){return this.vertices.length},getFace:function(w){return this.faces[w]},hasFaceAt:function(w,C,A){A===void 0&&(A=this.scene.sys.cameras.main);for(var P=f(this,A).calc,b=this.faces,O=0;O{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1635,7 +1635,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(91296),p=function(h,a,l,n){var u=a.faces,f=u.length;if(f!==0){l.addToRenderList(a);var o=h.pipelines.set(a.pipeline,a),c=r(a,l,n).calc;h.pipelines.preBatch(a);for(var d=o.setGameObject(a),v=o.vertexViewF32,m=o.vertexViewU32,S=o.vertexCount*o.currentShader.vertexComponentCount-1,M=a.tintFill,w=[],C=a.debugCallback,A=c.a,P=c.b,b=c.c,O=c.d,I=c.e,D=c.f,B=a.viewPosition.z,G=a.hideCCW,z=l.roundPixels,X=l.alpha*a.alpha,K=0,Q=0;Q{/** + */var r=e(91296),p=function(h,a,l,n){var u=a.faces,f=u.length;if(f!==0){l.addToRenderList(a);var o=h.pipelines.set(a.pipeline,a),c=r(a,l,n).calc;h.pipelines.preBatch(a);for(var d=o.setGameObject(a),v=o.vertexViewF32,m=o.vertexViewU32,S=o.vertexCount*o.currentShader.vertexComponentCount-1,M=a.tintFill,w=[],C=a.debugCallback,A=c.a,P=c.b,b=c.c,O=c.d,I=c.e,D=c.f,B=a.viewPosition.z,G=a.hideCCW,z=l.roundPixels,X=l.alpha*a.alpha,j=0,Q=0;Q{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1679,11 +1679,11 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83419),p=e(31401),h=e(53774),a=e(43459),l=e(26388),n=e(19909),u=e(76472),f=e(44777),o=e(20696),c=e(95643),d=e(95540),v=e(26546),m=e(24502),S=e(1985),M=e(97022),w=e(86091),C=e(73162),A=e(20074),P=e(56480),b=e(68875),O=e(87841),I=e(59996),D=e(72905),B=e(90668),G=e(19186),z=e(61340),X=e(26099),K=e(15994),Q=e(69601),tt=["active","advance","blendMode","colorEase","deathCallback","deathCallbackScope","duration","emitCallback","emitCallbackScope","follow","frequency","gravityX","gravityY","maxAliveParticles","maxParticles","name","emitting","particleBringToTop","particleClass","radial","sortCallback","sortOrderAsc","sortProperty","stopAfter","tintFill","timeScale","trackVisible","visible"],Y=["accelerationX","accelerationY","alpha","angle","bounce","color","delay","hold","lifespan","maxVelocityX","maxVelocityY","moveToX","moveToY","quantity","rotate","scaleX","scaleY","speedX","speedY","tint","x","y"],Z=new r({Extends:c,Mixins:[p.AlphaSingle,p.BlendMode,p.Depth,p.Mask,p.Pipeline,p.PostPipeline,p.ScrollFactor,p.Texture,p.Transform,p.Visible,B],initialize:function(H,J,_,q,at){c.call(this,H,"ParticleEmitter"),this.particleClass=P,this.ops={accelerationX:new f("accelerationX",0),accelerationY:new f("accelerationY",0),alpha:new f("alpha",1),angle:new f("angle",{min:0,max:360},!0),bounce:new f("bounce",0),color:new u("color"),delay:new f("delay",0,!0),hold:new f("hold",0,!0),lifespan:new f("lifespan",1e3,!0),maxVelocityX:new f("maxVelocityX",1e4),maxVelocityY:new f("maxVelocityY",1e4),moveToX:new f("moveToX",0),moveToY:new f("moveToY",0),quantity:new f("quantity",1,!0),rotate:new f("rotate",0),scaleX:new f("scaleX",1),scaleY:new f("scaleY",1),speedX:new f("speedX",0,!0),speedY:new f("speedY",0,!0),tint:new f("tint",16777215),x:new f("x",0),y:new f("y",0)},this.radial=!0,this.gravityX=0,this.gravityY=0,this.acceleration=!1,this.moveTo=!1,this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.maxParticles=0,this.maxAliveParticles=0,this.stopAfter=0,this.duration=0,this.frequency=0,this.emitting=!0,this.particleBringToTop=!0,this.timeScale=1,this.emitZones=[],this.deathZones=[],this.viewBounds=null,this.follow=null,this.followOffset=new X,this.trackVisible=!1,this.frames=[],this.randomFrame=!0,this.frameQuantity=1,this.anims=[],this.randomAnim=!0,this.animQuantity=1,this.dead=[],this.alive=[],this.counters=new Float32Array(10),this.skipping=!1,this.worldMatrix=new z,this.sortProperty="",this.sortOrderAsc=!0,this.sortCallback=this.depthSortCallback,this.processors=new C(this),this.tintFill=!1,this.initPipeline(),this.initPostPipeline(),this.setPosition(J,_),this.setTexture(q),at&&this.setConfig(at)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},setConfig:function(U){if(!U)return this;var H=0,J="",_=this.ops;for(H=0;H=this.animQuantity&&(this.animCounter=0,this.currentAnim=K(this.currentAnim+1,0,H)),J},setAnim:function(U,H,J){H===void 0&&(H=!0),J===void 0&&(J=1),this.randomAnim=H,this.animQuantity=J,this.currentAnim=0;var _=typeof U;if(this.anims.length=0,Array.isArray(U))this.anims=this.anims.concat(U);else if(_==="string")this.anims.push(U);else if(_==="object"){var q=U;U=d(q,"anims",null),U&&(this.anims=this.anims.concat(U));var at=d(q,"cycle",!1);this.randomAnim=!at,this.animQuantity=d(q,"quantity",J)}return this.anims.length===1&&(this.animQuantity=1,this.randomAnim=!1),this},setRadial:function(U){return U===void 0&&(U=!0),this.radial=U,this},addParticleBounds:function(U,H,J,_,q,at,ot,rt){if(typeof U=="object"){var gt=U;U=gt.x,H=gt.y,J=M(gt,"w")?gt.w:gt.width,_=M(gt,"h")?gt.h:gt.height}return this.addParticleProcessor(new Q(U,H,J,_,q,at,ot,rt))},setParticleSpeed:function(U,H){return H===void 0&&(H=U),this.ops.speedX.onChange(U),U===H?this.ops.speedY.active=!1:this.ops.speedY.onChange(H),this.radial=!0,this},setParticleScale:function(U,H){return U===void 0&&(U=1),H===void 0&&(H=U),this.ops.scaleX.onChange(U),this.ops.scaleY.onChange(H),this},setParticleGravity:function(U,H){return this.gravityX=U,this.gravityY=H,this},setParticleAlpha:function(U){return this.ops.alpha.onChange(U),this},setParticleTint:function(U){return this.ops.tint.onChange(U),this},setEmitterAngle:function(U){return this.ops.angle.onChange(U),this},setParticleLifespan:function(U){return this.ops.lifespan.onChange(U),this},setQuantity:function(U){return this.quantity=U,this},setFrequency:function(U,H){return this.frequency=U,this.flowCounter=U>0?U:0,H&&(this.quantity=H),this},addDeathZone:function(U){Array.isArray(U)||(U=[U]);for(var H,J=[],_=0;_-1&&(this.zoneTotal++,this.zoneTotal===_.total&&(this.zoneTotal=0,this.zoneIndex++,this.zoneIndex===J&&(this.zoneIndex=0)))}},getDeathZone:function(U){for(var H=this.deathZones,J=0;J=0&&(this.zoneIndex=H),this},addParticleProcessor:function(U){return this.processors.exists(U)||(U.emitter&&U.emitter.removeParticleProcessor(U),this.processors.add(U),U.emitter=this),U},removeParticleProcessor:function(U){return this.processors.exists(U)&&(this.processors.remove(U,!0),U.emitter=null),U},getProcessors:function(){return this.processors.getAll("active",!0)},createGravityWell:function(U){return this.addParticleProcessor(new m(U))},reserve:function(U){var H=this.dead;if(this.maxParticles>0){var J=this.getParticleCount();J+U>this.maxParticles&&(U=this.maxParticles-(J+U))}for(var _=0;_0&&this.getParticleCount()>=this.maxParticles?!0:this.maxAliveParticles>0&&this.getAliveParticleCount()>=this.maxAliveParticles},onParticleEmit:function(U,H){return U===void 0?(this.emitCallback=null,this.emitCallbackScope=null):typeof U=="function"&&(this.emitCallback=U,H&&(this.emitCallbackScope=H)),this},onParticleDeath:function(U,H){return U===void 0?(this.deathCallback=null,this.deathCallbackScope=null):typeof U=="function"&&(this.deathCallback=U,H&&(this.deathCallbackScope=H)),this},killAll:function(){for(var U=this.dead,H=this.alive;H.length>0;)U.push(H.pop());return this},forEachAlive:function(U,H){for(var J=this.alive,_=J.length,q=0;q<_;q++)U.call(H,J[q],this);return this},forEachDead:function(U,H){for(var J=this.dead,_=J.length,q=0;q<_;q++)U.call(H,J[q],this);return this},start:function(U,H){return U===void 0&&(U=0),this.emitting||(U>0&&this.fastForward(U),this.emitting=!0,this.resetCounters(this.frequency,!0),H!==void 0&&(this.duration=Math.abs(H)),this.emit(o.START,this)),this},stop:function(U){return U===void 0&&(U=!1),this.emitting&&(this.emitting=!1,U&&this.killAll(),this.emit(o.STOP,this)),this},pause:function(){return this.active=!1,this},resume:function(){return this.active=!0,this},setSortProperty:function(U,H){return U===void 0&&(U=""),H===void 0&&(H=this.true),this.sortProperty=U,this.sortOrderAsc=H,this.sortCallback=this.depthSortCallback,this},setSortCallback:function(U){return this.sortProperty!==""?U=this.depthSortCallback:U=null,this.sortCallback=U,this},depthSort:function(){return G(this.alive,this.sortCallback.bind(this)),this},depthSortCallback:function(U,H){var J=this.sortProperty;return this.sortOrderAsc?U[J]-H[J]:H[J]-U[J]},flow:function(U,H,J){return H===void 0&&(H=1),this.emitting=!1,this.frequency=U,this.quantity=H,J!==void 0&&(this.stopAfter=J),this.start()},explode:function(U,H,J){this.frequency=-1,this.resetCounters(-1,!0);var _=this.emitParticle(U,H,J);return this.emit(o.EXPLODE,this,_),_},emitParticleAt:function(U,H,J){return this.emitParticle(J,U,H)},emitParticle:function(U,H,J){if(!this.atLimit()){U===void 0&&(U=this.ops.quantity.onEmit());for(var _=this.dead,q=this.stopAfter,at=this.follow?this.follow.x+this.followOffset.x:H,ot=this.follow?this.follow.y+this.followOffset.y:J,rt=0;rt0&&(this.stopCounter++,this.stopCounter>=q)||this.atLimit())break}return gt}},fastForward:function(U,H){H===void 0&&(H=1e3/60);var J=0;for(this.skipping=!0;J0){var Et=this.deathCallback,At=this.deathCallbackScope;for(ot=gt-1;ot>=0;ot--){var Pt=rt[ot];q.splice(Pt.index,1),at.push(Pt.particle),Et&&Et.call(At,Pt.particle),Pt.particle.setPosition()}}if(!this.emitting&&!this.skipping){this.completeFlag===1&&q.length===0&&(this.completeFlag=0,this.emit(o.COMPLETE,this));return}if(this.frequency===0)this.emitParticle();else if(this.frequency>0)for(this.flowCounter-=H;this.flowCounter<=0;)this.emitParticle(),this.flowCounter+=this.frequency;this.skipping||(this.duration>0&&(this.elapsed+=H,this.elapsed>=this.duration&&this.stop()),this.stopAfter>0&&this.stopCounter>=this.stopAfter&&this.stop())},overlap:function(U){for(var H=this.getWorldTransformMatrix(),J=this.alive,_=J.length,q=[],at=0;at<_;at++){var ot=J[at];I(U,ot.getBounds(H))&&q.push(ot)}return q},getBounds:function(U,H,J,_){U===void 0&&(U=0),H===void 0&&(H=0),J===void 0&&(J=1e3/60),_===void 0&&(_=new O);var q=this.getWorldTransformMatrix(),at,ot,rt=this.alive,gt=!1;if(_.setTo(0,0,0,0),H>0){var yt=0;for(this.skipping=!0;yt0&&w(_,U,U),_},createEmitter:function(){throw new Error("createEmitter removed. See ParticleEmitter docs for info")},particleX:{get:function(){return this.ops.x.current},set:function(U){this.ops.x.onChange(U)}},particleY:{get:function(){return this.ops.y.current},set:function(U){this.ops.y.onChange(U)}},accelerationX:{get:function(){return this.ops.accelerationX.current},set:function(U){this.ops.accelerationX.onChange(U)}},accelerationY:{get:function(){return this.ops.accelerationY.current},set:function(U){this.ops.accelerationY.onChange(U)}},maxVelocityX:{get:function(){return this.ops.maxVelocityX.current},set:function(U){this.ops.maxVelocityX.onChange(U)}},maxVelocityY:{get:function(){return this.ops.maxVelocityY.current},set:function(U){this.ops.maxVelocityY.onChange(U)}},speed:{get:function(){return this.ops.speedX.current},set:function(U){this.ops.speedX.onChange(U),this.ops.speedY.onChange(U)}},speedX:{get:function(){return this.ops.speedX.current},set:function(U){this.ops.speedX.onChange(U)}},speedY:{get:function(){return this.ops.speedY.current},set:function(U){this.ops.speedY.onChange(U)}},moveToX:{get:function(){return this.ops.moveToX.current},set:function(U){this.ops.moveToX.onChange(U)}},moveToY:{get:function(){return this.ops.moveToY.current},set:function(U){this.ops.moveToY.onChange(U)}},bounce:{get:function(){return this.ops.bounce.current},set:function(U){this.ops.bounce.onChange(U)}},particleScaleX:{get:function(){return this.ops.scaleX.current},set:function(U){this.ops.scaleX.onChange(U)}},particleScaleY:{get:function(){return this.ops.scaleY.current},set:function(U){this.ops.scaleY.onChange(U)}},particleColor:{get:function(){return this.ops.color.current},set:function(U){this.ops.color.onChange(U)}},colorEase:{get:function(){return this.ops.color.easeName},set:function(U){this.ops.color.setEase(U)}},particleTint:{get:function(){return this.ops.tint.current},set:function(U){this.ops.tint.onChange(U)}},particleAlpha:{get:function(){return this.ops.alpha.current},set:function(U){this.ops.alpha.onChange(U)}},lifespan:{get:function(){return this.ops.lifespan.current},set:function(U){this.ops.lifespan.onChange(U)}},particleAngle:{get:function(){return this.ops.angle.current},set:function(U){this.ops.angle.onChange(U)}},particleRotate:{get:function(){return this.ops.rotate.current},set:function(U){this.ops.rotate.onChange(U)}},quantity:{get:function(){return this.ops.quantity.current},set:function(U){this.ops.quantity.onChange(U)}},delay:{get:function(){return this.ops.delay.current},set:function(U){this.ops.delay.onChange(U)}},hold:{get:function(){return this.ops.hold.current},set:function(U){this.ops.hold.onChange(U)}},flowCounter:{get:function(){return this.counters[0]},set:function(U){this.counters[0]=U}},frameCounter:{get:function(){return this.counters[1]},set:function(U){this.counters[1]=U}},animCounter:{get:function(){return this.counters[2]},set:function(U){this.counters[2]=U}},elapsed:{get:function(){return this.counters[3]},set:function(U){this.counters[3]=U}},stopCounter:{get:function(){return this.counters[4]},set:function(U){this.counters[4]=U}},completeFlag:{get:function(){return this.counters[5]},set:function(U){this.counters[5]=U}},zoneIndex:{get:function(){return this.counters[6]},set:function(U){this.counters[6]=U}},zoneTotal:{get:function(){return this.counters[7]},set:function(U){this.counters[7]=U}},currentFrame:{get:function(){return this.counters[8]},set:function(U){this.counters[8]=U}},currentAnim:{get:function(){return this.counters[9]},set:function(U){this.counters[9]=U}},preDestroy:function(){this.texture=null,this.frames=null,this.anims=null,this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.emitZones=null,this.deathZones=null,this.bounds=null,this.follow=null,this.counters=null;var U,H=this.ops;for(U=0;U{/** + */var r=e(83419),p=e(31401),h=e(53774),a=e(43459),l=e(26388),n=e(19909),u=e(76472),f=e(44777),o=e(20696),c=e(95643),d=e(95540),v=e(26546),m=e(24502),S=e(1985),M=e(97022),w=e(86091),C=e(73162),A=e(20074),P=e(56480),b=e(68875),O=e(87841),I=e(59996),D=e(72905),B=e(90668),G=e(19186),z=e(61340),X=e(26099),j=e(15994),Q=e(69601),tt=["active","advance","blendMode","colorEase","deathCallback","deathCallbackScope","duration","emitCallback","emitCallbackScope","follow","frequency","gravityX","gravityY","maxAliveParticles","maxParticles","name","emitting","particleBringToTop","particleClass","radial","sortCallback","sortOrderAsc","sortProperty","stopAfter","tintFill","timeScale","trackVisible","visible"],Y=["accelerationX","accelerationY","alpha","angle","bounce","color","delay","hold","lifespan","maxVelocityX","maxVelocityY","moveToX","moveToY","quantity","rotate","scaleX","scaleY","speedX","speedY","tint","x","y"],Z=new r({Extends:c,Mixins:[p.AlphaSingle,p.BlendMode,p.Depth,p.Mask,p.Pipeline,p.PostPipeline,p.ScrollFactor,p.Texture,p.Transform,p.Visible,B],initialize:function(H,J,_,q,at){c.call(this,H,"ParticleEmitter"),this.particleClass=P,this.ops={accelerationX:new f("accelerationX",0),accelerationY:new f("accelerationY",0),alpha:new f("alpha",1),angle:new f("angle",{min:0,max:360},!0),bounce:new f("bounce",0),color:new u("color"),delay:new f("delay",0,!0),hold:new f("hold",0,!0),lifespan:new f("lifespan",1e3,!0),maxVelocityX:new f("maxVelocityX",1e4),maxVelocityY:new f("maxVelocityY",1e4),moveToX:new f("moveToX",0),moveToY:new f("moveToY",0),quantity:new f("quantity",1,!0),rotate:new f("rotate",0),scaleX:new f("scaleX",1),scaleY:new f("scaleY",1),speedX:new f("speedX",0,!0),speedY:new f("speedY",0,!0),tint:new f("tint",16777215),x:new f("x",0),y:new f("y",0)},this.radial=!0,this.gravityX=0,this.gravityY=0,this.acceleration=!1,this.moveTo=!1,this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.maxParticles=0,this.maxAliveParticles=0,this.stopAfter=0,this.duration=0,this.frequency=0,this.emitting=!0,this.particleBringToTop=!0,this.timeScale=1,this.emitZones=[],this.deathZones=[],this.viewBounds=null,this.follow=null,this.followOffset=new X,this.trackVisible=!1,this.frames=[],this.randomFrame=!0,this.frameQuantity=1,this.anims=[],this.randomAnim=!0,this.animQuantity=1,this.dead=[],this.alive=[],this.counters=new Float32Array(10),this.skipping=!1,this.worldMatrix=new z,this.sortProperty="",this.sortOrderAsc=!0,this.sortCallback=this.depthSortCallback,this.processors=new C(this),this.tintFill=!1,this.initPipeline(),this.initPostPipeline(),this.setPosition(J,_),this.setTexture(q),at&&this.setConfig(at)},addedToScene:function(){this.scene.sys.updateList.add(this)},removedFromScene:function(){this.scene.sys.updateList.remove(this)},setConfig:function(U){if(!U)return this;var H=0,J="",_=this.ops;for(H=0;H=this.animQuantity&&(this.animCounter=0,this.currentAnim=j(this.currentAnim+1,0,H)),J},setAnim:function(U,H,J){H===void 0&&(H=!0),J===void 0&&(J=1),this.randomAnim=H,this.animQuantity=J,this.currentAnim=0;var _=typeof U;if(this.anims.length=0,Array.isArray(U))this.anims=this.anims.concat(U);else if(_==="string")this.anims.push(U);else if(_==="object"){var q=U;U=d(q,"anims",null),U&&(this.anims=this.anims.concat(U));var at=d(q,"cycle",!1);this.randomAnim=!at,this.animQuantity=d(q,"quantity",J)}return this.anims.length===1&&(this.animQuantity=1,this.randomAnim=!1),this},setRadial:function(U){return U===void 0&&(U=!0),this.radial=U,this},addParticleBounds:function(U,H,J,_,q,at,ot,rt){if(typeof U=="object"){var gt=U;U=gt.x,H=gt.y,J=M(gt,"w")?gt.w:gt.width,_=M(gt,"h")?gt.h:gt.height}return this.addParticleProcessor(new Q(U,H,J,_,q,at,ot,rt))},setParticleSpeed:function(U,H){return H===void 0&&(H=U),this.ops.speedX.onChange(U),U===H?this.ops.speedY.active=!1:this.ops.speedY.onChange(H),this.radial=!0,this},setParticleScale:function(U,H){return U===void 0&&(U=1),H===void 0&&(H=U),this.ops.scaleX.onChange(U),this.ops.scaleY.onChange(H),this},setParticleGravity:function(U,H){return this.gravityX=U,this.gravityY=H,this},setParticleAlpha:function(U){return this.ops.alpha.onChange(U),this},setParticleTint:function(U){return this.ops.tint.onChange(U),this},setEmitterAngle:function(U){return this.ops.angle.onChange(U),this},setParticleLifespan:function(U){return this.ops.lifespan.onChange(U),this},setQuantity:function(U){return this.quantity=U,this},setFrequency:function(U,H){return this.frequency=U,this.flowCounter=U>0?U:0,H&&(this.quantity=H),this},addDeathZone:function(U){Array.isArray(U)||(U=[U]);for(var H,J=[],_=0;_-1&&(this.zoneTotal++,this.zoneTotal===_.total&&(this.zoneTotal=0,this.zoneIndex++,this.zoneIndex===J&&(this.zoneIndex=0)))}},getDeathZone:function(U){for(var H=this.deathZones,J=0;J=0&&(this.zoneIndex=H),this},addParticleProcessor:function(U){return this.processors.exists(U)||(U.emitter&&U.emitter.removeParticleProcessor(U),this.processors.add(U),U.emitter=this),U},removeParticleProcessor:function(U){return this.processors.exists(U)&&(this.processors.remove(U,!0),U.emitter=null),U},getProcessors:function(){return this.processors.getAll("active",!0)},createGravityWell:function(U){return this.addParticleProcessor(new m(U))},reserve:function(U){var H=this.dead;if(this.maxParticles>0){var J=this.getParticleCount();J+U>this.maxParticles&&(U=this.maxParticles-(J+U))}for(var _=0;_0&&this.getParticleCount()>=this.maxParticles?!0:this.maxAliveParticles>0&&this.getAliveParticleCount()>=this.maxAliveParticles},onParticleEmit:function(U,H){return U===void 0?(this.emitCallback=null,this.emitCallbackScope=null):typeof U=="function"&&(this.emitCallback=U,H&&(this.emitCallbackScope=H)),this},onParticleDeath:function(U,H){return U===void 0?(this.deathCallback=null,this.deathCallbackScope=null):typeof U=="function"&&(this.deathCallback=U,H&&(this.deathCallbackScope=H)),this},killAll:function(){for(var U=this.dead,H=this.alive;H.length>0;)U.push(H.pop());return this},forEachAlive:function(U,H){for(var J=this.alive,_=J.length,q=0;q<_;q++)U.call(H,J[q],this);return this},forEachDead:function(U,H){for(var J=this.dead,_=J.length,q=0;q<_;q++)U.call(H,J[q],this);return this},start:function(U,H){return U===void 0&&(U=0),this.emitting||(U>0&&this.fastForward(U),this.emitting=!0,this.resetCounters(this.frequency,!0),H!==void 0&&(this.duration=Math.abs(H)),this.emit(o.START,this)),this},stop:function(U){return U===void 0&&(U=!1),this.emitting&&(this.emitting=!1,U&&this.killAll(),this.emit(o.STOP,this)),this},pause:function(){return this.active=!1,this},resume:function(){return this.active=!0,this},setSortProperty:function(U,H){return U===void 0&&(U=""),H===void 0&&(H=this.true),this.sortProperty=U,this.sortOrderAsc=H,this.sortCallback=this.depthSortCallback,this},setSortCallback:function(U){return this.sortProperty!==""?U=this.depthSortCallback:U=null,this.sortCallback=U,this},depthSort:function(){return G(this.alive,this.sortCallback.bind(this)),this},depthSortCallback:function(U,H){var J=this.sortProperty;return this.sortOrderAsc?U[J]-H[J]:H[J]-U[J]},flow:function(U,H,J){return H===void 0&&(H=1),this.emitting=!1,this.frequency=U,this.quantity=H,J!==void 0&&(this.stopAfter=J),this.start()},explode:function(U,H,J){this.frequency=-1,this.resetCounters(-1,!0);var _=this.emitParticle(U,H,J);return this.emit(o.EXPLODE,this,_),_},emitParticleAt:function(U,H,J){return this.emitParticle(J,U,H)},emitParticle:function(U,H,J){if(!this.atLimit()){U===void 0&&(U=this.ops.quantity.onEmit());for(var _=this.dead,q=this.stopAfter,at=this.follow?this.follow.x+this.followOffset.x:H,ot=this.follow?this.follow.y+this.followOffset.y:J,rt=0;rt0&&(this.stopCounter++,this.stopCounter>=q)||this.atLimit())break}return gt}},fastForward:function(U,H){H===void 0&&(H=1e3/60);var J=0;for(this.skipping=!0;J0){var Et=this.deathCallback,At=this.deathCallbackScope;for(ot=gt-1;ot>=0;ot--){var Pt=rt[ot];q.splice(Pt.index,1),at.push(Pt.particle),Et&&Et.call(At,Pt.particle),Pt.particle.setPosition()}}if(!this.emitting&&!this.skipping){this.completeFlag===1&&q.length===0&&(this.completeFlag=0,this.emit(o.COMPLETE,this));return}if(this.frequency===0)this.emitParticle();else if(this.frequency>0)for(this.flowCounter-=H;this.flowCounter<=0;)this.emitParticle(),this.flowCounter+=this.frequency;this.skipping||(this.duration>0&&(this.elapsed+=H,this.elapsed>=this.duration&&this.stop()),this.stopAfter>0&&this.stopCounter>=this.stopAfter&&this.stop())},overlap:function(U){for(var H=this.getWorldTransformMatrix(),J=this.alive,_=J.length,q=[],at=0;at<_;at++){var ot=J[at];I(U,ot.getBounds(H))&&q.push(ot)}return q},getBounds:function(U,H,J,_){U===void 0&&(U=0),H===void 0&&(H=0),J===void 0&&(J=1e3/60),_===void 0&&(_=new O);var q=this.getWorldTransformMatrix(),at,ot,rt=this.alive,gt=!1;if(_.setTo(0,0,0,0),H>0){var yt=0;for(this.skipping=!0;yt0&&w(_,U,U),_},createEmitter:function(){throw new Error("createEmitter removed. See ParticleEmitter docs for info")},particleX:{get:function(){return this.ops.x.current},set:function(U){this.ops.x.onChange(U)}},particleY:{get:function(){return this.ops.y.current},set:function(U){this.ops.y.onChange(U)}},accelerationX:{get:function(){return this.ops.accelerationX.current},set:function(U){this.ops.accelerationX.onChange(U)}},accelerationY:{get:function(){return this.ops.accelerationY.current},set:function(U){this.ops.accelerationY.onChange(U)}},maxVelocityX:{get:function(){return this.ops.maxVelocityX.current},set:function(U){this.ops.maxVelocityX.onChange(U)}},maxVelocityY:{get:function(){return this.ops.maxVelocityY.current},set:function(U){this.ops.maxVelocityY.onChange(U)}},speed:{get:function(){return this.ops.speedX.current},set:function(U){this.ops.speedX.onChange(U),this.ops.speedY.onChange(U)}},speedX:{get:function(){return this.ops.speedX.current},set:function(U){this.ops.speedX.onChange(U)}},speedY:{get:function(){return this.ops.speedY.current},set:function(U){this.ops.speedY.onChange(U)}},moveToX:{get:function(){return this.ops.moveToX.current},set:function(U){this.ops.moveToX.onChange(U)}},moveToY:{get:function(){return this.ops.moveToY.current},set:function(U){this.ops.moveToY.onChange(U)}},bounce:{get:function(){return this.ops.bounce.current},set:function(U){this.ops.bounce.onChange(U)}},particleScaleX:{get:function(){return this.ops.scaleX.current},set:function(U){this.ops.scaleX.onChange(U)}},particleScaleY:{get:function(){return this.ops.scaleY.current},set:function(U){this.ops.scaleY.onChange(U)}},particleColor:{get:function(){return this.ops.color.current},set:function(U){this.ops.color.onChange(U)}},colorEase:{get:function(){return this.ops.color.easeName},set:function(U){this.ops.color.setEase(U)}},particleTint:{get:function(){return this.ops.tint.current},set:function(U){this.ops.tint.onChange(U)}},particleAlpha:{get:function(){return this.ops.alpha.current},set:function(U){this.ops.alpha.onChange(U)}},lifespan:{get:function(){return this.ops.lifespan.current},set:function(U){this.ops.lifespan.onChange(U)}},particleAngle:{get:function(){return this.ops.angle.current},set:function(U){this.ops.angle.onChange(U)}},particleRotate:{get:function(){return this.ops.rotate.current},set:function(U){this.ops.rotate.onChange(U)}},quantity:{get:function(){return this.ops.quantity.current},set:function(U){this.ops.quantity.onChange(U)}},delay:{get:function(){return this.ops.delay.current},set:function(U){this.ops.delay.onChange(U)}},hold:{get:function(){return this.ops.hold.current},set:function(U){this.ops.hold.onChange(U)}},flowCounter:{get:function(){return this.counters[0]},set:function(U){this.counters[0]=U}},frameCounter:{get:function(){return this.counters[1]},set:function(U){this.counters[1]=U}},animCounter:{get:function(){return this.counters[2]},set:function(U){this.counters[2]=U}},elapsed:{get:function(){return this.counters[3]},set:function(U){this.counters[3]=U}},stopCounter:{get:function(){return this.counters[4]},set:function(U){this.counters[4]=U}},completeFlag:{get:function(){return this.counters[5]},set:function(U){this.counters[5]=U}},zoneIndex:{get:function(){return this.counters[6]},set:function(U){this.counters[6]=U}},zoneTotal:{get:function(){return this.counters[7]},set:function(U){this.counters[7]=U}},currentFrame:{get:function(){return this.counters[8]},set:function(U){this.counters[8]=U}},currentAnim:{get:function(){return this.counters[9]},set:function(U){this.counters[9]=U}},preDestroy:function(){this.texture=null,this.frames=null,this.anims=null,this.emitCallback=null,this.emitCallbackScope=null,this.deathCallback=null,this.deathCallbackScope=null,this.emitZones=null,this.deathZones=null,this.bounds=null,this.follow=null,this.counters=null;var U,H=this.ops;for(U=0;U{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(59996),p=e(61340),h=new p,a=new p,l=new p,n=new p,u=function(f,o,c,d){var v=h,m=a,S=l,M=n;d?(M.loadIdentity(),M.multiply(d),M.translate(o.x,o.y),M.rotate(o.rotation),M.scale(o.scaleX,o.scaleY)):M.applyITRS(o.x,o.y,o.rotation,o.scaleX,o.scaleY);var w=f.currentContext,C=c.roundPixels,A=c.alpha,P=o.alpha,b=o.alive,O=b.length,I=o.viewBounds;if(!(!o.visible||O===0||I&&!r(I,c.worldView))){o.sortCallback&&o.depthSort(),c.addToRenderList(o);var D=o.scrollFactorX,B=o.scrollFactorY;w.save(),w.globalCompositeOperation=f.blendModes[o.blendMode];for(var G=0;G0&&Q.height>0){var tt=-K.halfWidth,Y=-K.halfHeight;w.globalAlpha=X,w.save(),m.setToContext(w),C&&(tt=Math.round(tt),Y=Math.round(Y)),w.imageSmoothingEnabled=!K.source.scaleMode,w.drawImage(K.source.image,Q.x,Q.y,Q.width,Q.height,tt,Y,Q.width,Q.height),w.restore()}}}w.restore()}};s.exports=u},92730:(s,y,e)=>{/** + */var r=e(59996),p=e(61340),h=new p,a=new p,l=new p,n=new p,u=function(f,o,c,d){var v=h,m=a,S=l,M=n;d?(M.loadIdentity(),M.multiply(d),M.translate(o.x,o.y),M.rotate(o.rotation),M.scale(o.scaleX,o.scaleY)):M.applyITRS(o.x,o.y,o.rotation,o.scaleX,o.scaleY);var w=f.currentContext,C=c.roundPixels,A=c.alpha,P=o.alpha,b=o.alive,O=b.length,I=o.viewBounds;if(!(!o.visible||O===0||I&&!r(I,c.worldView))){o.sortCallback&&o.depthSort(),c.addToRenderList(o);var D=o.scrollFactorX,B=o.scrollFactorY;w.save(),w.globalCompositeOperation=f.blendModes[o.blendMode];for(var G=0;G0&&Q.height>0){var tt=-j.halfWidth,Y=-j.halfHeight;w.globalAlpha=X,w.save(),m.setToContext(w),C&&(tt=Math.round(tt),Y=Math.round(Y)),w.imageSmoothingEnabled=!j.source.scaleMode,w.drawImage(j.source.image,Q.x,Q.y,Q.width,Q.height,tt,Y,Q.width,Q.height),w.restore()}}}w.restore()}};s.exports=u},92730:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1699,7 +1699,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(59996),p=e(61340),h=e(70554),a=new p,l=new p,n=new p,u=new p,f=function(o,c,d,v){var m=o.pipelines.set(c.pipeline),S=a,M=l,w=n,C=u;v?(C.loadIdentity(),C.multiply(v),C.translate(c.x,c.y),C.rotate(c.rotation),C.scale(c.scaleX,c.scaleY)):C.applyITRS(c.x,c.y,c.rotation,c.scaleX,c.scaleY);var A=h.getTintAppendFloatAlpha,P=d.alpha,b=c.alpha;o.pipelines.preBatch(c);var O=c.alive,I=O.length,D=c.viewBounds;if(!(I===0||D&&!r(D,d.worldView))){c.sortCallback&&c.depthSort(),d.addToRenderList(c),S.copyFrom(d.matrix),S.multiplyWithOffset(C,-d.scrollX*c.scrollFactorX,-d.scrollY*c.scrollFactorY),o.setBlendMode(c.blendMode),c.mask&&(c.mask.preRenderWebGL(o,c,d),o.pipelines.set(c.pipeline));for(var B=c.tintFill,G,z,X=0;X{/** + */var r=e(59996),p=e(61340),h=e(70554),a=new p,l=new p,n=new p,u=new p,f=function(o,c,d,v){var m=o.pipelines.set(c.pipeline),S=a,M=l,w=n,C=u;v?(C.loadIdentity(),C.multiply(v),C.translate(c.x,c.y),C.rotate(c.rotation),C.scale(c.scaleX,c.scaleY)):C.applyITRS(c.x,c.y,c.rotation,c.scaleX,c.scaleY);var A=h.getTintAppendFloatAlpha,P=d.alpha,b=c.alpha;o.pipelines.preBatch(c);var O=c.alive,I=O.length,D=c.viewBounds;if(!(I===0||D&&!r(D,d.worldView))){c.sortCallback&&c.depthSort(),d.addToRenderList(c),S.copyFrom(d.matrix),S.multiplyWithOffset(C,-d.scrollX*c.scrollFactorX,-d.scrollY*c.scrollFactorY),o.setBlendMode(c.blendMode),c.mask&&(c.mask.preRenderWebGL(o,c,d),o.pipelines.set(c.pipeline));for(var B=c.tintFill,G,z,X=0;X{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1759,7 +1759,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(9674),p=e(83419),h=e(48803),a=e(90664),l=e(4703),n=e(45650),u=new p({Extends:l,initialize:function(o,c,d,v,m,S,M,w){v||(v="__DEFAULT"),l.call(this,o,c,d,v,m),this.type="Plane",this.anims=new r(this),this.gridWidth,this.gridHeight,this.isTiled,this._checkerboard=null,this.hideCCW=!1,this.setGridSize(S,M,w),this.setSizeToFrame(!1),this.setViewHeight()},originX:{get:function(){return .5}},originY:{get:function(){return .5}},setGridSize:function(f,o,c){f===void 0&&(f=8),o===void 0&&(o=8),c===void 0&&(c=!1);var d=!1;return c&&(d=!0),this.gridWidth=f,this.gridHeight=o,this.isTiled=c,this.clear(),h({mesh:this,widthSegments:f,heightSegments:o,isOrtho:!1,tile:c,flipY:d}),this},setSizeToFrame:function(f){f===void 0&&(f=!0);var o=this.frame;if(this.setPerspective(this.width/o.width,this.height/o.height),this._checkerboard&&this._checkerboard!==this.texture&&this.removeCheckerboard(),!f)return this;var c=this.gridWidth,d=this.gridHeight,v=this.vertices,m=o.u0,S=o.u1,M=o.v0,w=o.v1,C,A,P=0;if(this.isTiled)for(M=o.v1,w=o.v0,A=0;A7&&C>7?M.push(m.r,m.g,m.b,c):M.push(S.r,S.g,S.b,d);var A=this.scene.sys.textures.addUint8Array(n(),new Uint8Array(M),16,16);return this.removeCheckerboard(),this.setTexture(A),this.setSizeToFrame(),this.setViewHeight(v),this},removeCheckerboard:function(){this._checkerboard&&(this._checkerboard.destroy(),this._checkerboard=null)},play:function(f,o){return this.anims.play(f,o)},playReverse:function(f,o){return this.anims.playReverse(f,o)},playAfterDelay:function(f,o){return this.anims.playAfterDelay(f,o)},playAfterRepeat:function(f,o){return this.anims.playAfterRepeat(f,o)},stop:function(){return this.anims.stop()},stopAfterDelay:function(f){return this.anims.stopAfterDelay(f)},stopAfterRepeat:function(f){return this.anims.stopAfterRepeat(f)},stopOnFrame:function(f){return this.anims.stopOnFrame(f)},preUpdate:function(f,o){l.prototype.preUpdate.call(this,f,o),this.anims.update(f,o)},preDestroy:function(){this.clear(),this.removeCheckerboard(),this.anims.destroy(),this.anims=void 0,this.debugCallback=null,this.debugGraphic=null}});s.exports=u},56015:(s,y,e)=>{/** + */var r=e(9674),p=e(83419),h=e(48803),a=e(90664),l=e(4703),n=e(45650),u=new p({Extends:l,initialize:function(o,c,d,v,m,S,M,w){v||(v="__DEFAULT"),l.call(this,o,c,d,v,m),this.type="Plane",this.anims=new r(this),this.gridWidth,this.gridHeight,this.isTiled,this._checkerboard=null,this.hideCCW=!1,this.setGridSize(S,M,w),this.setSizeToFrame(!1),this.setViewHeight()},originX:{get:function(){return .5}},originY:{get:function(){return .5}},setGridSize:function(f,o,c){f===void 0&&(f=8),o===void 0&&(o=8),c===void 0&&(c=!1);var d=!1;return c&&(d=!0),this.gridWidth=f,this.gridHeight=o,this.isTiled=c,this.clear(),h({mesh:this,widthSegments:f,heightSegments:o,isOrtho:!1,tile:c,flipY:d}),this},setSizeToFrame:function(f){f===void 0&&(f=!0);var o=this.frame;if(this.setPerspective(this.width/o.width,this.height/o.height),this._checkerboard&&this._checkerboard!==this.texture&&this.removeCheckerboard(),!f)return this;var c=this.gridWidth,d=this.gridHeight,v=this.vertices,m=o.u0,S=o.u1,M=o.v0,w=o.v1,C,A,P=0;if(this.isTiled)for(M=o.v1,w=o.v0,A=0;A7&&C>7?M.push(m.r,m.g,m.b,c):M.push(S.r,S.g,S.b,d);var A=this.scene.sys.textures.addUint8Array(n(),new Uint8Array(M),16,16);return this.removeCheckerboard(),this.setTexture(A),this.setSizeToFrame(),this.setViewHeight(v),this},removeCheckerboard:function(){this._checkerboard&&(this._checkerboard.destroy(),this._checkerboard=null)},play:function(f,o){return this.anims.play(f,o)},playReverse:function(f,o){return this.anims.playReverse(f,o)},playAfterDelay:function(f,o){return this.anims.playAfterDelay(f,o)},playAfterRepeat:function(f,o){return this.anims.playAfterRepeat(f,o)},stop:function(){return this.anims.stop()},stopAfterDelay:function(f){return this.anims.stopAfterDelay(f)},stopAfterRepeat:function(f){return this.anims.stopAfterRepeat(f)},stopOnFrame:function(f){return this.anims.stopOnFrame(f)},preUpdate:function(f,o){l.prototype.preUpdate.call(this,f,o),this.anims.update(f,o)},preDestroy:function(){this.clear(),this.removeCheckerboard(),this.anims.destroy(),this.anims=void 0,this.debugCallback=null,this.debugGraphic=null}});s.exports=u},56015:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1823,7 +1823,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(91296),p=e(70554),h=function(a,l,n,u){n.addToRenderList(l);var f=a.pipelines.set(l.pipeline,l),o=r(l,n,u).calc,c=l.vertices,d=l.uv,v=l.colors,m=l.alphas,S=l.alpha,M=p.getTintAppendFloatAlpha,w=n.roundPixels,C=c.length,A=Math.floor(C*.5);f.flush(),a.pipelines.preBatch(l);var P=f.setGameObject(l),b=f.vertexViewF32,O=f.vertexViewU32,I=f.vertexCount*f.currentShader.vertexComponentCount-1,D=0,B=l.tintFill;l.dirty&&l.updateVertices();for(var G=l.debugCallback,z=[],X=0;X{/** + */var r=e(91296),p=e(70554),h=function(a,l,n,u){n.addToRenderList(l);var f=a.pipelines.set(l.pipeline,l),o=r(l,n,u).calc,c=l.vertices,d=l.uv,v=l.colors,m=l.alphas,S=l.alpha,M=p.getTintAppendFloatAlpha,w=n.roundPixels,C=c.length,A=Math.floor(C*.5);f.flush(),a.pipelines.preBatch(l);var P=f.setGameObject(l),b=f.vertexViewF32,O=f.vertexViewU32,I=f.vertexCount*f.currentShader.vertexComponentCount-1,D=0,B=l.tintFill;l.dirty&&l.updateVertices();for(var G=l.debugCallback,z=[],X=0;X{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1935,7 +1935,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(65960),p=e(75177),h=e(20926),a=function(l,n,u,f){u.addToRenderList(n);var o=l.currentContext;if(h(l,o,n,u,f)){var c=-n._displayOriginX,d=-n._displayOriginY,v=u.alpha*n.alpha,m=n.width,S=n.height,M=n.cellWidth,w=n.cellHeight,C=Math.ceil(m/M),A=Math.ceil(S/w),P=M,b=w,O=M-(C*M-m),I=w-(A*w-S),D=n.showCells,B=n.showAltCells,G=n.showOutline,z=0,X=0,K=0,Q=0,tt=0;if(G&&(P--,b--,O===M&&O--,I===w&&I--),D&&n.fillAlpha>0)for(r(o,n),X=0;X0)for(r(o,n,n.altFillColor,n.altFillAlpha*v),X=0;X0){for(p(o,n,n.outlineFillColor,n.outlineFillAlpha*v),z=1;z{/** + */var r=e(65960),p=e(75177),h=e(20926),a=function(l,n,u,f){u.addToRenderList(n);var o=l.currentContext;if(h(l,o,n,u,f)){var c=-n._displayOriginX,d=-n._displayOriginY,v=u.alpha*n.alpha,m=n.width,S=n.height,M=n.cellWidth,w=n.cellHeight,C=Math.ceil(m/M),A=Math.ceil(S/w),P=M,b=w,O=M-(C*M-m),I=w-(A*w-S),D=n.showCells,B=n.showAltCells,G=n.showOutline,z=0,X=0,j=0,Q=0,tt=0;if(G&&(P--,b--,O===M&&O--,I===w&&I--),D&&n.fillAlpha>0)for(r(o,n),X=0;X0)for(r(o,n,n.altFillColor,n.altFillAlpha*v),X=0;X0){for(p(o,n,n.outlineFillColor,n.outlineFillAlpha*v),z=1;z{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1947,7 +1947,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(91296),p=e(70554),h=function(a,l,n,u){n.addToRenderList(l);var f=a.pipelines.set(l.pipeline),o=r(l,n,u),c=f.calcMatrix.copyFrom(o.calc);c.translate(-l._displayOriginX,-l._displayOriginY);var d=n.alpha*l.alpha,v=l.width,m=l.height,S=l.cellWidth,M=l.cellHeight,w=Math.ceil(v/S),C=Math.ceil(m/M),A=S,P=M,b=S-(w*S-v),O=M-(C*M-m),I,D,B=l.showCells,G=l.showAltCells,z=l.showOutline,X=0,K=0,Q=0,tt=0,Y=0;if(z&&(A--,P--,b===S&&b--,O===M&&O--),a.pipelines.preBatch(l),B&&l.fillAlpha>0)for(I=f.fillTint,D=p.getTintAppendFloatAlpha(l.fillColor,l.fillAlpha*d),I.TL=D,I.TR=D,I.BL=D,I.BR=D,K=0;K0)for(I=f.fillTint,D=p.getTintAppendFloatAlpha(l.altFillColor,l.altFillAlpha*d),I.TL=D,I.TR=D,I.BL=D,I.BR=D,K=0;K0){var Z=f.strokeTint,U=p.getTintAppendFloatAlpha(l.outlineFillColor,l.outlineFillAlpha*d);for(Z.TL=U,Z.TR=U,Z.BL=U,Z.BR=U,X=1;X{/** + */var r=e(91296),p=e(70554),h=function(a,l,n,u){n.addToRenderList(l);var f=a.pipelines.set(l.pipeline),o=r(l,n,u),c=f.calcMatrix.copyFrom(o.calc);c.translate(-l._displayOriginX,-l._displayOriginY);var d=n.alpha*l.alpha,v=l.width,m=l.height,S=l.cellWidth,M=l.cellHeight,w=Math.ceil(v/S),C=Math.ceil(m/M),A=S,P=M,b=S-(w*S-v),O=M-(C*M-m),I,D,B=l.showCells,G=l.showAltCells,z=l.showOutline,X=0,j=0,Q=0,tt=0,Y=0;if(z&&(A--,P--,b===S&&b--,O===M&&O--),a.pipelines.preBatch(l),B&&l.fillAlpha>0)for(I=f.fillTint,D=p.getTintAppendFloatAlpha(l.fillColor,l.fillAlpha*d),I.TL=D,I.TR=D,I.BL=D,I.BR=D,j=0;j0)for(I=f.fillTint,D=p.getTintAppendFloatAlpha(l.altFillColor,l.altFillAlpha*d),I.TL=D,I.TR=D,I.BL=D,I.BR=D,j=0;j0){var Z=f.strokeTint,U=p.getTintAppendFloatAlpha(l.outlineFillColor,l.outlineFillAlpha*d);for(Z.TL=U,Z.TR=U,Z.BL=U,Z.BR=U,X=1;X{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -2125,13 +2125,13 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @license {@link https://opensource.org/licenses/MIT|MIT License} */var r=e(40366),p=e(27919),h=e(83419),a=e(31401),l=e(95643),n=e(14220),u=e(35154),f=e(35846),o=e(61771),c=e(35762),d=e(45650),v=new h({Extends:l,Mixins:[a.Alpha,a.BlendMode,a.ComputedSize,a.Crop,a.Depth,a.Flip,a.GetBounds,a.Mask,a.Origin,a.Pipeline,a.PostPipeline,a.ScrollFactor,a.Tint,a.Transform,a.Visible,o],initialize:function(S,M,w,C,A){M===void 0&&(M=0),w===void 0&&(w=0),l.call(this,S,"Text"),this.renderer=S.sys.renderer,this.setPosition(M,w),this.setOrigin(0,0),this.initPipeline(),this.initPostPipeline(!0),this.canvas=p.create(this),this.context,this.style=new c(this,A),this.autoRound=!0,this.splitRegExp=/(?:\r\n|\r|\n)/,this._text=void 0,this.padding={left:0,right:0,top:0,bottom:0},this.width=1,this.height=1,this.lineSpacing=0,this.letterSpacing=0,this.style.resolution===0&&(this.style.resolution=1),this._crop=this.resetCropObject(),this._textureKey=d(),this.texture=S.sys.textures.addCanvas(this._textureKey,this.canvas),this.context=this.texture.context,this.frame=this.texture.get(),this.frame.source.resolution=this.style.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.initRTL(),this.setText(C),A&&A.padding&&this.setPadding(A.padding),A&&A.lineSpacing&&this.setLineSpacing(A.lineSpacing)},initRTL:function(){this.style.rtl&&(this.canvas.dir="rtl",this.context.direction="rtl",this.canvas.style.display="none",r(this.canvas,this.scene.sys.canvas),this.originX=1)},runWordWrap:function(m){var S=this.style;if(S.wordWrapCallback){var M=S.wordWrapCallback.call(S.wordWrapCallbackScope,m,this);return Array.isArray(M)&&(M=M.join(` `)),M}else return S.wordWrapWidth?S.wordWrapUseAdvanced?this.advancedWordWrap(m,this.context,this.style.wordWrapWidth):this.basicWordWrap(m,this.context,this.style.wordWrapWidth):m},advancedWordWrap:function(m,S,M){for(var w="",C=m.replace(/ +/gi," ").split(this.splitRegExp),A=C.length,P=0;PD){if(G===0){for(var Q=X;Q.length&&(Q=Q.slice(0,-1),K=S.measureText(Q).width,!(K<=D)););if(!Q.length)throw new Error("wordWrapWidth < a single character");var tt=z.substr(Q.length);B[G]=tt,O+=Q}var Y=B[G].length?G:G+1,Z=B.slice(Y).join(" ").replace(/[ \n]*$/gi,"");C.splice(P+1,0,Z),A=C.length;break}else O+=X,D-=K}w+=O.replace(/[ \n]*$/gi,"")+` +`;continue}for(var D=M,B=b.split(" "),G=0;GD){if(G===0){for(var Q=X;Q.length&&(Q=Q.slice(0,-1),j=S.measureText(Q).width,!(j<=D)););if(!Q.length)throw new Error("wordWrapWidth < a single character");var tt=z.substr(Q.length);B[G]=tt,O+=Q}var Y=B[G].length?G:G+1,Z=B.slice(Y).join(" ").replace(/[ \n]*$/gi,"");C.splice(P+1,0,Z),A=C.length;break}else O+=X,D-=j}w+=O.replace(/[ \n]*$/gi,"")+` `}return w=w.replace(/[\s|\n]*$/gi,""),w},basicWordWrap:function(m,S,M){for(var w="",C=m.split(this.splitRegExp),A=C.length-1,P=S.measureText(" ").width,b=0;b<=A;b++){for(var O=M,I=C[b].split(" "),D=I.length-1,B=0;B<=D;B++){var G=I[B],z=S.measureText(G).width,X=z;BO&&B>0&&(w+=` `,O=M),w+=G,B0&&(z+=b.lineSpacing*X),M.rtl)G=D-G-O.left-O.right;else if(M.align==="right")G+=I-b.lineWidths[X];else if(M.align==="center")G+=(I-b.lineWidths[X])/2;else if(M.align==="justify"){var K=.85;if(b.lineWidths[X]/b.width>=K){var Q=b.width-b.lineWidths[X],tt=S.measureText(" ").width,Y=P[X].trim(),Z=Y.split(" ");Q+=(P[X].length-Y.length)*tt;for(var U=Math.floor(Q/tt),H=0;U>0;)Z[H]+=" ",H=(H+1)%(Z.length-1||1),--U;P[X]=Z.join(" ")}}if(this.autoRound&&(G=Math.round(G),z=Math.round(z)),M.strokeThickness&&(M.syncShadow(S,M.shadowStroke),S.strokeText(P[X],G,z)),M.color){M.syncShadow(S,M.shadowFill);var J=this.letterSpacing;if(J!==0)for(var _=0,q=P[X].split(""),at=0;at{/** +`+m:m);return M!==this._text&&(this._text=M,this.updateText()),this},setStyle:function(m){return this.style.setStyle(m)},setFont:function(m){return this.style.setFont(m)},setFontFamily:function(m){return this.style.setFontFamily(m)},setFontSize:function(m){return this.style.setFontSize(m)},setFontStyle:function(m){return this.style.setFontStyle(m)},setFixedSize:function(m,S){return this.style.setFixedSize(m,S)},setBackgroundColor:function(m){return this.style.setBackgroundColor(m)},setFill:function(m){return this.style.setFill(m)},setColor:function(m){return this.style.setColor(m)},setStroke:function(m,S){return this.style.setStroke(m,S)},setShadow:function(m,S,M,w,C,A){return this.style.setShadow(m,S,M,w,C,A)},setShadowOffset:function(m,S){return this.style.setShadowOffset(m,S)},setShadowColor:function(m){return this.style.setShadowColor(m)},setShadowBlur:function(m){return this.style.setShadowBlur(m)},setShadowStroke:function(m){return this.style.setShadowStroke(m)},setShadowFill:function(m){return this.style.setShadowFill(m)},setWordWrapWidth:function(m,S){return this.style.setWordWrapWidth(m,S)},setWordWrapCallback:function(m,S){return this.style.setWordWrapCallback(m,S)},setAlign:function(m){return this.style.setAlign(m)},setResolution:function(m){return this.style.setResolution(m)},setLineSpacing:function(m){return this.lineSpacing=m,this.updateText()},setLetterSpacing:function(m){return this.letterSpacing=m,this.updateText()},setPadding:function(m,S,M,w){if(typeof m=="object"){var C=m,A=u(C,"x",null);A!==null?(m=A,M=A):(m=u(C,"left",0),M=u(C,"right",m));var P=u(C,"y",null);P!==null?(S=P,w=P):(S=u(C,"top",0),w=u(C,"bottom",S))}else m===void 0&&(m=0),S===void 0&&(S=m),M===void 0&&(M=m),w===void 0&&(w=S);return this.padding.left=m,this.padding.top=S,this.padding.right=M,this.padding.bottom=w,this.updateText()},setMaxLines:function(m){return this.style.setMaxLines(m)},setRTL:function(m){m===void 0&&(m=!0);var S=this.style;return S.rtl===m?this:(S.rtl=m,m?(this.canvas.dir="rtl",this.context.direction="rtl",this.canvas.style.display="none",r(this.canvas,this.scene.sys.canvas)):(this.canvas.dir="ltr",this.context.direction="ltr"),S.align==="left"?S.align="right":S.align==="right"&&(S.align="left"),this)},updateText:function(){var m=this.canvas,S=this.context,M=this.style,w=M.resolution,C=M.metrics;M.syncFont(m,S);var A=this._text;(M.wordWrapWidth||M.wordWrapCallback)&&(A=this.runWordWrap(this._text));var P=A.split(this.splitRegExp),b=n(this,C,P),O=this.padding,I;M.fixedWidth===0?(this.width=b.width+O.left+O.right,I=b.width):(this.width=M.fixedWidth,I=this.width-O.left-O.right,I0&&(z+=b.lineSpacing*X),M.rtl)G=D-G-O.left-O.right;else if(M.align==="right")G+=I-b.lineWidths[X];else if(M.align==="center")G+=(I-b.lineWidths[X])/2;else if(M.align==="justify"){var j=.85;if(b.lineWidths[X]/b.width>=j){var Q=b.width-b.lineWidths[X],tt=S.measureText(" ").width,Y=P[X].trim(),Z=Y.split(" ");Q+=(P[X].length-Y.length)*tt;for(var U=Math.floor(Q/tt),H=0;U>0;)Z[H]+=" ",H=(H+1)%(Z.length-1||1),--U;P[X]=Z.join(" ")}}if(this.autoRound&&(G=Math.round(G),z=Math.round(z)),M.strokeThickness&&(M.syncShadow(S,M.shadowStroke),S.strokeText(P[X],G,z)),M.color){M.syncShadow(S,M.shadowFill);var J=this.letterSpacing;if(J!==0)for(var _=0,q=P[X].split(""),at=0;at{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -2611,19 +2611,19 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83419),p=e(87841),h=e(26099);function a(n,u,f,o){var c=n-f,d=u-o,v=c*c+d*d;return Math.sqrt(v)}var l=new r({initialize:function(u,f,o){this.vertex1=u,this.vertex2=f,this.vertex3=o,this.bounds=new p,this._inCenter=new h},getInCenter:function(n){n===void 0&&(n=!0);var u=this.vertex1,f=this.vertex2,o=this.vertex3,c,d,v,m,S,M;n?(c=u.x,d=u.y,v=f.x,m=f.y,S=o.x,M=o.y):(c=u.vx,d=u.vy,v=f.vx,m=f.vy,S=o.vx,M=o.vy);var w=a(S,M,v,m),C=a(c,d,S,M),A=a(v,m,c,d),P=w+C+A;return this._inCenter.set((c*w+v*C+S*A)/P,(d*w+m*C+M*A)/P)},contains:function(n,u,f){var o=this.vertex1,c=this.vertex2,d=this.vertex3,v=o.vx,m=o.vy,S=c.vx,M=c.vy,w=d.vx,C=d.vy;if(f){var A=f.a,P=f.b,b=f.c,O=f.d,I=f.e,D=f.f;v=o.vx*A+o.vy*b+I,m=o.vx*P+o.vy*O+D,S=c.vx*A+c.vy*b+I,M=c.vx*P+c.vy*O+D,w=d.vx*A+d.vy*b+I,C=d.vx*P+d.vy*O+D}var B=w-v,G=C-m,z=S-v,X=M-m,K=n-v,Q=u-m,tt=B*B+G*G,Y=B*z+G*X,Z=B*K+G*Q,U=z*z+X*X,H=z*K+X*Q,J=tt*U-Y*Y,_=J===0?0:1/J,q=(U*Z-Y*H)*_,at=(tt*H-Y*Z)*_;return q>=0&&at>=0&&q+at<1},isCounterClockwise:function(n){var u=this.vertex1,f=this.vertex2,o=this.vertex3,c=(f.vx-u.vx)*(o.vy-u.vy)-(f.vy-u.vy)*(o.vx-u.vx);return n<=0?c>=0:c<0},load:function(n,u,f,o,c){return f=this.vertex1.load(n,u,f,o,c),f=this.vertex2.load(n,u,f,o,c),f=this.vertex3.load(n,u,f,o,c),f},transformCoordinatesLocal:function(n,u,f,o){return this.vertex1.transformCoordinatesLocal(n,u,f,o),this.vertex2.transformCoordinatesLocal(n,u,f,o),this.vertex3.transformCoordinatesLocal(n,u,f,o),this},updateBounds:function(){var n=this.vertex1,u=this.vertex2,f=this.vertex3,o=this.bounds;return o.x=Math.min(n.vx,u.vx,f.vx),o.y=Math.min(n.vy,u.vy,f.vy),o.width=Math.max(n.vx,u.vx,f.vx)-o.x,o.height=Math.max(n.vy,u.vy,f.vy)-o.y,this},isInView:function(n,u,f,o,c,d,v,m,S,M,w){this.update(o,c,d,v,m,S,M,w);var C=this.vertex1,A=this.vertex2,P=this.vertex3;if(C.ta<=0&&A.ta<=0&&P.ta<=0||u&&!this.isCounterClockwise(f))return!1;var b=this.bounds;b.x=Math.min(C.tx,A.tx,P.tx),b.y=Math.min(C.ty,A.ty,P.ty),b.width=Math.max(C.tx,A.tx,P.tx)-b.x,b.height=Math.max(C.ty,A.ty,P.ty)-b.y;var O=n.x+n.width,I=n.y+n.height;return b.width<=0||b.height<=0||n.width<=0||n.height<=0?!1:!(b.rightO||b.y>I)},scrollUV:function(n,u){return this.vertex1.scrollUV(n,u),this.vertex2.scrollUV(n,u),this.vertex3.scrollUV(n,u),this},scaleUV:function(n,u){return this.vertex1.scaleUV(n,u),this.vertex2.scaleUV(n,u),this.vertex3.scaleUV(n,u),this},setColor:function(n){return this.vertex1.color=n,this.vertex2.color=n,this.vertex3.color=n,this},update:function(n,u,f,o,c,d,v,m){return this.vertex1.update(u,f,o,c,d,v,m,n),this.vertex2.update(u,f,o,c,d,v,m,n),this.vertex3.update(u,f,o,c,d,v,m,n),this},translate:function(n,u){u===void 0&&(u=0);var f=this.vertex1,o=this.vertex2,c=this.vertex3;return f.x+=n,f.y+=u,o.x+=n,o.y+=u,c.x+=n,c.y+=u,this},x:{get:function(){return this.getInCenter().x},set:function(n){var u=this.getInCenter();this.translate(n-u.x,0)}},y:{get:function(){return this.getInCenter().y},set:function(n){var u=this.getInCenter();this.translate(0,n-u.y)}},alpha:{get:function(){var n=this.vertex1,u=this.vertex2,f=this.vertex3;return(n.alpha+u.alpha+f.alpha)/3},set:function(n){this.vertex1.alpha=n,this.vertex2.alpha=n,this.vertex3.alpha=n}},depth:{get:function(){var n=this.vertex1,u=this.vertex2,f=this.vertex3;return(n.vz+u.vz+f.vz)/3}},destroy:function(){this.vertex1=null,this.vertex2=null,this.vertex3=null}});s.exports=l},48803:(s,y,e)=>{/** + */var r=e(83419),p=e(87841),h=e(26099);function a(n,u,f,o){var c=n-f,d=u-o,v=c*c+d*d;return Math.sqrt(v)}var l=new r({initialize:function(u,f,o){this.vertex1=u,this.vertex2=f,this.vertex3=o,this.bounds=new p,this._inCenter=new h},getInCenter:function(n){n===void 0&&(n=!0);var u=this.vertex1,f=this.vertex2,o=this.vertex3,c,d,v,m,S,M;n?(c=u.x,d=u.y,v=f.x,m=f.y,S=o.x,M=o.y):(c=u.vx,d=u.vy,v=f.vx,m=f.vy,S=o.vx,M=o.vy);var w=a(S,M,v,m),C=a(c,d,S,M),A=a(v,m,c,d),P=w+C+A;return this._inCenter.set((c*w+v*C+S*A)/P,(d*w+m*C+M*A)/P)},contains:function(n,u,f){var o=this.vertex1,c=this.vertex2,d=this.vertex3,v=o.vx,m=o.vy,S=c.vx,M=c.vy,w=d.vx,C=d.vy;if(f){var A=f.a,P=f.b,b=f.c,O=f.d,I=f.e,D=f.f;v=o.vx*A+o.vy*b+I,m=o.vx*P+o.vy*O+D,S=c.vx*A+c.vy*b+I,M=c.vx*P+c.vy*O+D,w=d.vx*A+d.vy*b+I,C=d.vx*P+d.vy*O+D}var B=w-v,G=C-m,z=S-v,X=M-m,j=n-v,Q=u-m,tt=B*B+G*G,Y=B*z+G*X,Z=B*j+G*Q,U=z*z+X*X,H=z*j+X*Q,J=tt*U-Y*Y,_=J===0?0:1/J,q=(U*Z-Y*H)*_,at=(tt*H-Y*Z)*_;return q>=0&&at>=0&&q+at<1},isCounterClockwise:function(n){var u=this.vertex1,f=this.vertex2,o=this.vertex3,c=(f.vx-u.vx)*(o.vy-u.vy)-(f.vy-u.vy)*(o.vx-u.vx);return n<=0?c>=0:c<0},load:function(n,u,f,o,c){return f=this.vertex1.load(n,u,f,o,c),f=this.vertex2.load(n,u,f,o,c),f=this.vertex3.load(n,u,f,o,c),f},transformCoordinatesLocal:function(n,u,f,o){return this.vertex1.transformCoordinatesLocal(n,u,f,o),this.vertex2.transformCoordinatesLocal(n,u,f,o),this.vertex3.transformCoordinatesLocal(n,u,f,o),this},updateBounds:function(){var n=this.vertex1,u=this.vertex2,f=this.vertex3,o=this.bounds;return o.x=Math.min(n.vx,u.vx,f.vx),o.y=Math.min(n.vy,u.vy,f.vy),o.width=Math.max(n.vx,u.vx,f.vx)-o.x,o.height=Math.max(n.vy,u.vy,f.vy)-o.y,this},isInView:function(n,u,f,o,c,d,v,m,S,M,w){this.update(o,c,d,v,m,S,M,w);var C=this.vertex1,A=this.vertex2,P=this.vertex3;if(C.ta<=0&&A.ta<=0&&P.ta<=0||u&&!this.isCounterClockwise(f))return!1;var b=this.bounds;b.x=Math.min(C.tx,A.tx,P.tx),b.y=Math.min(C.ty,A.ty,P.ty),b.width=Math.max(C.tx,A.tx,P.tx)-b.x,b.height=Math.max(C.ty,A.ty,P.ty)-b.y;var O=n.x+n.width,I=n.y+n.height;return b.width<=0||b.height<=0||n.width<=0||n.height<=0?!1:!(b.rightO||b.y>I)},scrollUV:function(n,u){return this.vertex1.scrollUV(n,u),this.vertex2.scrollUV(n,u),this.vertex3.scrollUV(n,u),this},scaleUV:function(n,u){return this.vertex1.scaleUV(n,u),this.vertex2.scaleUV(n,u),this.vertex3.scaleUV(n,u),this},setColor:function(n){return this.vertex1.color=n,this.vertex2.color=n,this.vertex3.color=n,this},update:function(n,u,f,o,c,d,v,m){return this.vertex1.update(u,f,o,c,d,v,m,n),this.vertex2.update(u,f,o,c,d,v,m,n),this.vertex3.update(u,f,o,c,d,v,m,n),this},translate:function(n,u){u===void 0&&(u=0);var f=this.vertex1,o=this.vertex2,c=this.vertex3;return f.x+=n,f.y+=u,o.x+=n,o.y+=u,c.x+=n,c.y+=u,this},x:{get:function(){return this.getInCenter().x},set:function(n){var u=this.getInCenter();this.translate(n-u.x,0)}},y:{get:function(){return this.getInCenter().y},set:function(n){var u=this.getInCenter();this.translate(0,n-u.y)}},alpha:{get:function(){var n=this.vertex1,u=this.vertex2,f=this.vertex3;return(n.alpha+u.alpha+f.alpha)/3},set:function(n){this.vertex1.alpha=n,this.vertex2.alpha=n,this.vertex3.alpha=n}},depth:{get:function(){var n=this.vertex1,u=this.vertex2,f=this.vertex3;return(n.vz+u.vz+f.vz)/3}},destroy:function(){this.vertex1=null,this.vertex2=null,this.vertex3=null}});s.exports=l},48803:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83997),p=e(95540),h=e(37867),a=e(25836),l=e(39318),n=new a,u=new a,f=new h,o=function(c){var d=p(c,"mesh"),v=p(c,"texture",null),m=p(c,"frame"),S=p(c,"width",1),M=p(c,"height",S),w=p(c,"widthSegments",1),C=p(c,"heightSegments",w),A=p(c,"x",0),P=p(c,"y",0),b=p(c,"z",0),O=p(c,"rotateX",0),I=p(c,"rotateY",0),D=p(c,"rotateZ",0),B=p(c,"zIsUp",!0),G=p(c,"isOrtho",d?d.dirtyCache[11]:!1),z=p(c,"colors",[16777215]),X=p(c,"alphas",[1]),K=p(c,"tile",!1),Q=p(c,"flipY",!1),tt=p(c,"width",null),Y={faces:[],verts:[]};n.set(A,P,b),u.set(O,I,D),f.fromRotationXYTranslation(u,n,B);var Z;if(!v&&d)v=d.texture,m||(Z=d.frame);else if(d&&typeof v=="string")v=d.scene.sys.textures.get(v);else if(!v)return Y;Z||(Z=v.get(m)),!tt&&G&&v&&d&&(S=Z.width/d.height,M=Z.height/d.height);var U=S/2,H=M/2,J=Math.floor(w),_=Math.floor(C),q=J+1,at=_+1,ot=S/J,rt=M/_,gt=[],yt=[],Et,At,Pt=0,Vt=1,dt=0,ut=1;Z&&(Pt=Z.u0,Vt=Z.u1,Q?(dt=Z.v1,ut=Z.v0):(dt=Z.v0,ut=Z.v1));var Rt=Vt-Pt,Dt=ut-dt;for(At=0;At{/** + */var r=e(83997),p=e(95540),h=e(37867),a=e(25836),l=e(39318),n=new a,u=new a,f=new h,o=function(c){var d=p(c,"mesh"),v=p(c,"texture",null),m=p(c,"frame"),S=p(c,"width",1),M=p(c,"height",S),w=p(c,"widthSegments",1),C=p(c,"heightSegments",w),A=p(c,"x",0),P=p(c,"y",0),b=p(c,"z",0),O=p(c,"rotateX",0),I=p(c,"rotateY",0),D=p(c,"rotateZ",0),B=p(c,"zIsUp",!0),G=p(c,"isOrtho",d?d.dirtyCache[11]:!1),z=p(c,"colors",[16777215]),X=p(c,"alphas",[1]),j=p(c,"tile",!1),Q=p(c,"flipY",!1),tt=p(c,"width",null),Y={faces:[],verts:[]};n.set(A,P,b),u.set(O,I,D),f.fromRotationXYTranslation(u,n,B);var Z;if(!v&&d)v=d.texture,m||(Z=d.frame);else if(d&&typeof v=="string")v=d.scene.sys.textures.get(v);else if(!v)return Y;Z||(Z=v.get(m)),!tt&&G&&v&&d&&(S=Z.width/d.height,M=Z.height/d.height);var U=S/2,H=M/2,J=Math.floor(w),_=Math.floor(C),q=J+1,at=_+1,ot=S/J,rt=M/_,gt=[],yt=[],Et,At,Pt=0,Vt=1,dt=0,ut=1;Z&&(Pt=Z.u0,Vt=Z.u1,Q?(dt=Z.v1,ut=Z.v0):(dt=Z.v0,ut=Z.v1));var Rt=Vt-Pt,Dt=ut-dt;for(At=0;At{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83997),p=e(37867),h=e(25836),a=e(39318),l=new h,n=new h,u=new p,f=function(o,c,d,v,m,S,M,w,C,A){d===void 0&&(d=1),v===void 0&&(v=0),m===void 0&&(m=0),S===void 0&&(S=0),M===void 0&&(M=0),w===void 0&&(w=0),C===void 0&&(C=0),A===void 0&&(A=!0);var P={faces:[],verts:[]},b=o.materials;l.set(v,m,S),n.set(M,w,C),u.fromRotationXYTranslation(n,l,A);for(var O=0;O{/** + */var r=e(83997),p=e(37867),h=e(25836),a=e(39318),l=new h,n=new h,u=new p,f=function(o,c,d,v,m,S,M,w,C,A){d===void 0&&(d=1),v===void 0&&(v=0),m===void 0&&(m=0),S===void 0&&(S=0),M===void 0&&(M=0),w===void 0&&(w=0),C===void 0&&(C=0),A===void 0&&(A=!0);var P={faces:[],verts:[]},b=o.materials;l.set(v,m,S),n.set(M,w,C),u.fromRotationXYTranslation(n,l,A);for(var O=0;O{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83997),p=e(39318),h=function(a,l,n,u,f,o,c,d){if(u===void 0&&(u=!1),o===void 0&&(o=16777215),c===void 0&&(c=1),d===void 0&&(d=!1),a.length!==l.length&&!u){console.warn("GenerateVerts: vertices and uvs count not equal");return}var v={faces:[],vertices:[]},m,S,M,w,C,A,P,b,O,I,D,B=u?3:2,G=Array.isArray(o),z=Array.isArray(c);if(Array.isArray(n)&&n.length>0)for(m=0;m{/** + */var r=e(83997),p=e(39318),h=function(a,l,n,u,f,o,c,d){if(u===void 0&&(u=!1),o===void 0&&(o=16777215),c===void 0&&(c=1),d===void 0&&(d=!1),a.length!==l.length&&!u){console.warn("GenerateVerts: vertices and uvs count not equal");return}var v={faces:[],vertices:[]},m,S,M,w,C,A,P,b,O,I,D,B=u?3:2,G=Array.isArray(o),z=Array.isArray(c);if(Array.isArray(n)&&n.length>0)for(m=0;m{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -2729,7 +2729,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */function y(Y,Z,U){U=U||2;var H=Z&&Z.length,J=H?Z[0]*U:Y.length,_=e(Y,0,J,U,!0),q=[];if(!_||_.next===_.prev)return q;var at,ot,rt,gt,yt,Et,At;if(H&&(_=u(Y,Z,_,U)),Y.length>80*U){at=rt=Y[0],ot=gt=Y[1];for(var Pt=U;Ptrt&&(rt=yt),Et>gt&&(gt=Et);At=Math.max(rt-at,gt-ot),At=At!==0?32767/At:0}return p(_,q,U,at,ot,At,0),q}function e(Y,Z,U,H,J){var _,q;if(J===tt(Y,Z,U,H)>0)for(_=Z;_=Z;_-=H)q=X(_,Y[_],Y[_+1],q);return q&&P(q,q.next)&&(K(q),q=q.next),q}function r(Y,Z){if(!Y)return Y;Z||(Z=Y);var U=Y,H;do if(H=!1,!U.steiner&&(P(U,U.next)||A(U.prev,U,U.next)===0)){if(K(U),U=Z=U.prev,U===U.next)break;H=!0}else U=U.next;while(H||U!==Z);return Z}function p(Y,Z,U,H,J,_,q){if(Y){!q&&_&&v(Y,H,J,_);for(var at=Y,ot,rt;Y.prev!==Y.next;){if(ot=Y.prev,rt=Y.next,_?a(Y,H,J,_):h(Y)){Z.push(ot.i/U|0),Z.push(Y.i/U|0),Z.push(rt.i/U|0),K(Y),Y=rt.next,at=rt.next;continue}if(Y=rt,Y===at){q?q===1?(Y=l(r(Y),Z,U),p(Y,Z,U,H,J,_,2)):q===2&&n(Y,Z,U,H,J,_):p(r(Y),Z,U,H,J,_,1);break}}}}function h(Y){var Z=Y.prev,U=Y,H=Y.next;if(A(Z,U,H)>=0)return!1;for(var J=Z.x,_=U.x,q=H.x,at=Z.y,ot=U.y,rt=H.y,gt=J<_?J_?J>q?J:q:_>q?_:q,At=at>ot?at>rt?at:rt:ot>rt?ot:rt,Pt=H.next;Pt!==Z;){if(Pt.x>=gt&&Pt.x<=Et&&Pt.y>=yt&&Pt.y<=At&&w(J,at,_,ot,q,rt,Pt.x,Pt.y)&&A(Pt.prev,Pt,Pt.next)>=0)return!1;Pt=Pt.next}return!0}function a(Y,Z,U,H){var J=Y.prev,_=Y,q=Y.next;if(A(J,_,q)>=0)return!1;for(var at=J.x,ot=_.x,rt=q.x,gt=J.y,yt=_.y,Et=q.y,At=atot?at>rt?at:rt:ot>rt?ot:rt,dt=gt>yt?gt>Et?gt:Et:yt>Et?yt:Et,ut=S(At,Pt,Z,U,H),Rt=S(Vt,dt,Z,U,H),Dt=Y.prevZ,Ht=Y.nextZ;Dt&&Dt.z>=ut&&Ht&&Ht.z<=Rt;){if(Dt.x>=At&&Dt.x<=Vt&&Dt.y>=Pt&&Dt.y<=dt&&Dt!==J&&Dt!==q&&w(at,gt,ot,yt,rt,Et,Dt.x,Dt.y)&&A(Dt.prev,Dt,Dt.next)>=0||(Dt=Dt.prevZ,Ht.x>=At&&Ht.x<=Vt&&Ht.y>=Pt&&Ht.y<=dt&&Ht!==J&&Ht!==q&&w(at,gt,ot,yt,rt,Et,Ht.x,Ht.y)&&A(Ht.prev,Ht,Ht.next)>=0))return!1;Ht=Ht.nextZ}for(;Dt&&Dt.z>=ut;){if(Dt.x>=At&&Dt.x<=Vt&&Dt.y>=Pt&&Dt.y<=dt&&Dt!==J&&Dt!==q&&w(at,gt,ot,yt,rt,Et,Dt.x,Dt.y)&&A(Dt.prev,Dt,Dt.next)>=0)return!1;Dt=Dt.prevZ}for(;Ht&&Ht.z<=Rt;){if(Ht.x>=At&&Ht.x<=Vt&&Ht.y>=Pt&&Ht.y<=dt&&Ht!==J&&Ht!==q&&w(at,gt,ot,yt,rt,Et,Ht.x,Ht.y)&&A(Ht.prev,Ht,Ht.next)>=0)return!1;Ht=Ht.nextZ}return!0}function l(Y,Z,U){var H=Y;do{var J=H.prev,_=H.next.next;!P(J,_)&&b(J,H,H.next,_)&&B(J,_)&&B(_,J)&&(Z.push(J.i/U|0),Z.push(H.i/U|0),Z.push(_.i/U|0),K(H),K(H.next),H=Y=_),H=H.next}while(H!==Y);return r(H)}function n(Y,Z,U,H,J,_){var q=Y;do{for(var at=q.next.next;at!==q.prev;){if(q.i!==at.i&&C(q,at)){var ot=z(q,at);q=r(q,q.next),ot=r(ot,ot.next),p(q,Z,U,H,J,_,0),p(ot,Z,U,H,J,_,0);return}at=at.next}q=q.next}while(q!==Y)}function u(Y,Z,U,H){var J=[],_,q,at,ot,rt;for(_=0,q=Z.length;_=U.next.y&&U.next.y!==U.y){var at=U.x+(J-U.y)*(U.next.x-U.x)/(U.next.y-U.y);if(at<=H&&at>_&&(_=at,q=U.x=U.x&&U.x>=rt&&H!==U.x&&w(Jq.x||U.x===q.x&&d(q,U)))&&(q=U,yt=Et)),U=U.next;while(U!==ot);return q}function d(Y,Z){return A(Y.prev,Y,Z.prev)<0&&A(Z.next,Y,Y.next)<0}function v(Y,Z,U,H){var J=Y;do J.z===0&&(J.z=S(J.x,J.y,Z,U,H)),J.prevZ=J.prev,J.nextZ=J.next,J=J.next;while(J!==Y);J.prevZ.nextZ=null,J.prevZ=null,m(J)}function m(Y){var Z,U,H,J,_,q,at,ot,rt=1;do{for(U=Y,Y=null,_=null,q=0;U;){for(q++,H=U,at=0,Z=0;Z0||ot>0&&H;)at!==0&&(ot===0||!H||U.z<=H.z)?(J=U,U=U.nextZ,at--):(J=H,H=H.nextZ,ot--),_?_.nextZ=J:Y=J,J.prevZ=_,_=J;U=H}_.nextZ=null,rt*=2}while(q>1);return Y}function S(Y,Z,U,H,J){return Y=(Y-U)*J|0,Z=(Z-H)*J|0,Y=(Y|Y<<8)&16711935,Y=(Y|Y<<4)&252645135,Y=(Y|Y<<2)&858993459,Y=(Y|Y<<1)&1431655765,Z=(Z|Z<<8)&16711935,Z=(Z|Z<<4)&252645135,Z=(Z|Z<<2)&858993459,Z=(Z|Z<<1)&1431655765,Y|Z<<1}function M(Y){var Z=Y,U=Y;do(Z.x=(Y-q)*(_-at)&&(Y-q)*(H-at)>=(U-q)*(Z-at)&&(U-q)*(_-at)>=(J-q)*(H-at)}function C(Y,Z){return Y.next.i!==Z.i&&Y.prev.i!==Z.i&&!D(Y,Z)&&(B(Y,Z)&&B(Z,Y)&&G(Y,Z)&&(A(Y.prev,Y,Z.prev)||A(Y,Z.prev,Z))||P(Y,Z)&&A(Y.prev,Y,Y.next)>0&&A(Z.prev,Z,Z.next)>0)}function A(Y,Z,U){return(Z.y-Y.y)*(U.x-Z.x)-(Z.x-Y.x)*(U.y-Z.y)}function P(Y,Z){return Y.x===Z.x&&Y.y===Z.y}function b(Y,Z,U,H){var J=I(A(Y,Z,U)),_=I(A(Y,Z,H)),q=I(A(U,H,Y)),at=I(A(U,H,Z));return!!(J!==_&&q!==at||J===0&&O(Y,U,Z)||_===0&&O(Y,H,Z)||q===0&&O(U,Y,H)||at===0&&O(U,Z,H))}function O(Y,Z,U){return Z.x<=Math.max(Y.x,U.x)&&Z.x>=Math.min(Y.x,U.x)&&Z.y<=Math.max(Y.y,U.y)&&Z.y>=Math.min(Y.y,U.y)}function I(Y){return Y>0?1:Y<0?-1:0}function D(Y,Z){var U=Y;do{if(U.i!==Y.i&&U.next.i!==Y.i&&U.i!==Z.i&&U.next.i!==Z.i&&b(U,U.next,Y,Z))return!0;U=U.next}while(U!==Y);return!1}function B(Y,Z){return A(Y.prev,Y,Y.next)<0?A(Y,Z,Y.next)>=0&&A(Y,Y.prev,Z)>=0:A(Y,Z,Y.prev)<0||A(Y,Y.next,Z)<0}function G(Y,Z){var U=Y,H=!1,J=(Y.x+Z.x)/2,_=(Y.y+Z.y)/2;do U.y>_!=U.next.y>_&&U.next.y!==U.y&&J<(U.next.x-U.x)*(_-U.y)/(U.next.y-U.y)+U.x&&(H=!H),U=U.next;while(U!==Y);return H}function z(Y,Z){var U=new Q(Y.i,Y.x,Y.y),H=new Q(Z.i,Z.x,Z.y),J=Y.next,_=Z.prev;return Y.next=Z,Z.prev=Y,U.next=J,J.prev=U,H.next=U,U.prev=H,_.next=H,H.prev=_,H}function X(Y,Z,U,H){var J=new Q(Y,Z,U);return H?(J.next=H.next,J.prev=H,H.next.prev=J,H.next=J):(J.prev=J,J.next=J),J}function K(Y){Y.next.prev=Y.prev,Y.prev.next=Y.next,Y.prevZ&&(Y.prevZ.nextZ=Y.nextZ),Y.nextZ&&(Y.nextZ.prevZ=Y.prevZ)}function Q(Y,Z,U){this.i=Y,this.x=Z,this.y=U,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}y.deviation=function(Y,Z,U,H){var J=Z&&Z.length,_=J?Z[0]*U:Y.length,q=Math.abs(tt(Y,0,_,U));if(J)for(var at=0,ot=Z.length;at0&&(H+=Y[J-1].length,U.holes.push(H))}return U},s.exports=y},13829:(s,y,e)=>{/** + */function y(Y,Z,U){U=U||2;var H=Z&&Z.length,J=H?Z[0]*U:Y.length,_=e(Y,0,J,U,!0),q=[];if(!_||_.next===_.prev)return q;var at,ot,rt,gt,yt,Et,At;if(H&&(_=u(Y,Z,_,U)),Y.length>80*U){at=rt=Y[0],ot=gt=Y[1];for(var Pt=U;Ptrt&&(rt=yt),Et>gt&&(gt=Et);At=Math.max(rt-at,gt-ot),At=At!==0?32767/At:0}return p(_,q,U,at,ot,At,0),q}function e(Y,Z,U,H,J){var _,q;if(J===tt(Y,Z,U,H)>0)for(_=Z;_=Z;_-=H)q=X(_,Y[_],Y[_+1],q);return q&&P(q,q.next)&&(j(q),q=q.next),q}function r(Y,Z){if(!Y)return Y;Z||(Z=Y);var U=Y,H;do if(H=!1,!U.steiner&&(P(U,U.next)||A(U.prev,U,U.next)===0)){if(j(U),U=Z=U.prev,U===U.next)break;H=!0}else U=U.next;while(H||U!==Z);return Z}function p(Y,Z,U,H,J,_,q){if(Y){!q&&_&&v(Y,H,J,_);for(var at=Y,ot,rt;Y.prev!==Y.next;){if(ot=Y.prev,rt=Y.next,_?a(Y,H,J,_):h(Y)){Z.push(ot.i/U|0),Z.push(Y.i/U|0),Z.push(rt.i/U|0),j(Y),Y=rt.next,at=rt.next;continue}if(Y=rt,Y===at){q?q===1?(Y=l(r(Y),Z,U),p(Y,Z,U,H,J,_,2)):q===2&&n(Y,Z,U,H,J,_):p(r(Y),Z,U,H,J,_,1);break}}}}function h(Y){var Z=Y.prev,U=Y,H=Y.next;if(A(Z,U,H)>=0)return!1;for(var J=Z.x,_=U.x,q=H.x,at=Z.y,ot=U.y,rt=H.y,gt=J<_?J_?J>q?J:q:_>q?_:q,At=at>ot?at>rt?at:rt:ot>rt?ot:rt,Pt=H.next;Pt!==Z;){if(Pt.x>=gt&&Pt.x<=Et&&Pt.y>=yt&&Pt.y<=At&&w(J,at,_,ot,q,rt,Pt.x,Pt.y)&&A(Pt.prev,Pt,Pt.next)>=0)return!1;Pt=Pt.next}return!0}function a(Y,Z,U,H){var J=Y.prev,_=Y,q=Y.next;if(A(J,_,q)>=0)return!1;for(var at=J.x,ot=_.x,rt=q.x,gt=J.y,yt=_.y,Et=q.y,At=atot?at>rt?at:rt:ot>rt?ot:rt,dt=gt>yt?gt>Et?gt:Et:yt>Et?yt:Et,ut=S(At,Pt,Z,U,H),Rt=S(Vt,dt,Z,U,H),Dt=Y.prevZ,Ht=Y.nextZ;Dt&&Dt.z>=ut&&Ht&&Ht.z<=Rt;){if(Dt.x>=At&&Dt.x<=Vt&&Dt.y>=Pt&&Dt.y<=dt&&Dt!==J&&Dt!==q&&w(at,gt,ot,yt,rt,Et,Dt.x,Dt.y)&&A(Dt.prev,Dt,Dt.next)>=0||(Dt=Dt.prevZ,Ht.x>=At&&Ht.x<=Vt&&Ht.y>=Pt&&Ht.y<=dt&&Ht!==J&&Ht!==q&&w(at,gt,ot,yt,rt,Et,Ht.x,Ht.y)&&A(Ht.prev,Ht,Ht.next)>=0))return!1;Ht=Ht.nextZ}for(;Dt&&Dt.z>=ut;){if(Dt.x>=At&&Dt.x<=Vt&&Dt.y>=Pt&&Dt.y<=dt&&Dt!==J&&Dt!==q&&w(at,gt,ot,yt,rt,Et,Dt.x,Dt.y)&&A(Dt.prev,Dt,Dt.next)>=0)return!1;Dt=Dt.prevZ}for(;Ht&&Ht.z<=Rt;){if(Ht.x>=At&&Ht.x<=Vt&&Ht.y>=Pt&&Ht.y<=dt&&Ht!==J&&Ht!==q&&w(at,gt,ot,yt,rt,Et,Ht.x,Ht.y)&&A(Ht.prev,Ht,Ht.next)>=0)return!1;Ht=Ht.nextZ}return!0}function l(Y,Z,U){var H=Y;do{var J=H.prev,_=H.next.next;!P(J,_)&&b(J,H,H.next,_)&&B(J,_)&&B(_,J)&&(Z.push(J.i/U|0),Z.push(H.i/U|0),Z.push(_.i/U|0),j(H),j(H.next),H=Y=_),H=H.next}while(H!==Y);return r(H)}function n(Y,Z,U,H,J,_){var q=Y;do{for(var at=q.next.next;at!==q.prev;){if(q.i!==at.i&&C(q,at)){var ot=z(q,at);q=r(q,q.next),ot=r(ot,ot.next),p(q,Z,U,H,J,_,0),p(ot,Z,U,H,J,_,0);return}at=at.next}q=q.next}while(q!==Y)}function u(Y,Z,U,H){var J=[],_,q,at,ot,rt;for(_=0,q=Z.length;_=U.next.y&&U.next.y!==U.y){var at=U.x+(J-U.y)*(U.next.x-U.x)/(U.next.y-U.y);if(at<=H&&at>_&&(_=at,q=U.x=U.x&&U.x>=rt&&H!==U.x&&w(Jq.x||U.x===q.x&&d(q,U)))&&(q=U,yt=Et)),U=U.next;while(U!==ot);return q}function d(Y,Z){return A(Y.prev,Y,Z.prev)<0&&A(Z.next,Y,Y.next)<0}function v(Y,Z,U,H){var J=Y;do J.z===0&&(J.z=S(J.x,J.y,Z,U,H)),J.prevZ=J.prev,J.nextZ=J.next,J=J.next;while(J!==Y);J.prevZ.nextZ=null,J.prevZ=null,m(J)}function m(Y){var Z,U,H,J,_,q,at,ot,rt=1;do{for(U=Y,Y=null,_=null,q=0;U;){for(q++,H=U,at=0,Z=0;Z0||ot>0&&H;)at!==0&&(ot===0||!H||U.z<=H.z)?(J=U,U=U.nextZ,at--):(J=H,H=H.nextZ,ot--),_?_.nextZ=J:Y=J,J.prevZ=_,_=J;U=H}_.nextZ=null,rt*=2}while(q>1);return Y}function S(Y,Z,U,H,J){return Y=(Y-U)*J|0,Z=(Z-H)*J|0,Y=(Y|Y<<8)&16711935,Y=(Y|Y<<4)&252645135,Y=(Y|Y<<2)&858993459,Y=(Y|Y<<1)&1431655765,Z=(Z|Z<<8)&16711935,Z=(Z|Z<<4)&252645135,Z=(Z|Z<<2)&858993459,Z=(Z|Z<<1)&1431655765,Y|Z<<1}function M(Y){var Z=Y,U=Y;do(Z.x=(Y-q)*(_-at)&&(Y-q)*(H-at)>=(U-q)*(Z-at)&&(U-q)*(_-at)>=(J-q)*(H-at)}function C(Y,Z){return Y.next.i!==Z.i&&Y.prev.i!==Z.i&&!D(Y,Z)&&(B(Y,Z)&&B(Z,Y)&&G(Y,Z)&&(A(Y.prev,Y,Z.prev)||A(Y,Z.prev,Z))||P(Y,Z)&&A(Y.prev,Y,Y.next)>0&&A(Z.prev,Z,Z.next)>0)}function A(Y,Z,U){return(Z.y-Y.y)*(U.x-Z.x)-(Z.x-Y.x)*(U.y-Z.y)}function P(Y,Z){return Y.x===Z.x&&Y.y===Z.y}function b(Y,Z,U,H){var J=I(A(Y,Z,U)),_=I(A(Y,Z,H)),q=I(A(U,H,Y)),at=I(A(U,H,Z));return!!(J!==_&&q!==at||J===0&&O(Y,U,Z)||_===0&&O(Y,H,Z)||q===0&&O(U,Y,H)||at===0&&O(U,Z,H))}function O(Y,Z,U){return Z.x<=Math.max(Y.x,U.x)&&Z.x>=Math.min(Y.x,U.x)&&Z.y<=Math.max(Y.y,U.y)&&Z.y>=Math.min(Y.y,U.y)}function I(Y){return Y>0?1:Y<0?-1:0}function D(Y,Z){var U=Y;do{if(U.i!==Y.i&&U.next.i!==Y.i&&U.i!==Z.i&&U.next.i!==Z.i&&b(U,U.next,Y,Z))return!0;U=U.next}while(U!==Y);return!1}function B(Y,Z){return A(Y.prev,Y,Y.next)<0?A(Y,Z,Y.next)>=0&&A(Y,Y.prev,Z)>=0:A(Y,Z,Y.prev)<0||A(Y,Y.next,Z)<0}function G(Y,Z){var U=Y,H=!1,J=(Y.x+Z.x)/2,_=(Y.y+Z.y)/2;do U.y>_!=U.next.y>_&&U.next.y!==U.y&&J<(U.next.x-U.x)*(_-U.y)/(U.next.y-U.y)+U.x&&(H=!H),U=U.next;while(U!==Y);return H}function z(Y,Z){var U=new Q(Y.i,Y.x,Y.y),H=new Q(Z.i,Z.x,Z.y),J=Y.next,_=Z.prev;return Y.next=Z,Z.prev=Y,U.next=J,J.prev=U,H.next=U,U.prev=H,_.next=H,H.prev=_,H}function X(Y,Z,U,H){var J=new Q(Y,Z,U);return H?(J.next=H.next,J.prev=H,H.next.prev=J,H.next=J):(J.prev=J,J.next=J),J}function j(Y){Y.next.prev=Y.prev,Y.prev.next=Y.next,Y.prevZ&&(Y.prevZ.nextZ=Y.nextZ),Y.nextZ&&(Y.nextZ.prevZ=Y.prevZ)}function Q(Y,Z,U){this.i=Y,this.x=Z,this.y=U,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}y.deviation=function(Y,Z,U,H){var J=Z&&Z.length,_=J?Z[0]*U:Y.length,q=Math.abs(tt(Y,0,_,U));if(J)for(var at=0,ot=Z.length;at0&&(H+=Y[J-1].length,U.holes.push(H))}return U},s.exports=y},13829:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -3042,11 +3042,11 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83419),p=e(93301),h=e(50792),a=e(8214),l=e(8443),n=e(78970),u=e(85098),f=e(42515),o=e(36210),c=e(61340),d=e(85955),v=new r({initialize:function(S,M){this.game=S,this.scaleManager,this.canvas,this.config=M,this.enabled=!0,this.events=new h,this.isOver=!0,this.defaultCursor="",this.keyboard=M.inputKeyboard?new n(this):null,this.mouse=M.inputMouse?new u(this):null,this.touch=M.inputTouch?new o(this):null,this.pointers=[],this.pointersTotal=M.inputActivePointers,M.inputTouch&&this.pointersTotal===1&&(this.pointersTotal=2);for(var w=0;w<=this.pointersTotal;w++){var C=new f(this,w);C.smoothFactor=M.inputSmoothFactor,this.pointers.push(C)}this.mousePointer=M.inputMouse?this.pointers[0]:null,this.activePointer=this.pointers[0],this.globalTopOnly=!0,this.time=0,this._tempPoint={x:0,y:0},this._tempHitTest=[],this._tempMatrix=new c,this._tempMatrix2=new c,this._tempSkip=!1,this.mousePointerContainer=[this.mousePointer],S.events.once(l.BOOT,this.boot,this)},boot:function(){var m=this.game,S=m.events;this.canvas=m.canvas,this.scaleManager=m.scale,this.events.emit(a.MANAGER_BOOT),S.on(l.PRE_RENDER,this.preRender,this),S.once(l.DESTROY,this.destroy,this)},setCanvasOver:function(m){this.isOver=!0,this.events.emit(a.GAME_OVER,m)},setCanvasOut:function(m){this.isOver=!1,this.events.emit(a.GAME_OUT,m)},preRender:function(){var m=this.game.loop.now,S=this.game.loop.delta,M=this.game.scene.getScenes(!0,!0);this.time=m,this.events.emit(a.MANAGER_UPDATE);for(var w=0;w10&&(m=10-this.pointersTotal);for(var M=0;M{/** + */var r=e(83419),p=e(93301),h=e(50792),a=e(8214),l=e(8443),n=e(78970),u=e(85098),f=e(42515),o=e(36210),c=e(61340),d=e(85955),v=new r({initialize:function(S,M){this.game=S,this.scaleManager,this.canvas,this.config=M,this.enabled=!0,this.events=new h,this.isOver=!0,this.defaultCursor="",this.keyboard=M.inputKeyboard?new n(this):null,this.mouse=M.inputMouse?new u(this):null,this.touch=M.inputTouch?new o(this):null,this.pointers=[],this.pointersTotal=M.inputActivePointers,M.inputTouch&&this.pointersTotal===1&&(this.pointersTotal=2);for(var w=0;w<=this.pointersTotal;w++){var C=new f(this,w);C.smoothFactor=M.inputSmoothFactor,this.pointers.push(C)}this.mousePointer=M.inputMouse?this.pointers[0]:null,this.activePointer=this.pointers[0],this.globalTopOnly=!0,this.time=0,this._tempPoint={x:0,y:0},this._tempHitTest=[],this._tempMatrix=new c,this._tempMatrix2=new c,this._tempSkip=!1,this.mousePointerContainer=[this.mousePointer],S.events.once(l.BOOT,this.boot,this)},boot:function(){var m=this.game,S=m.events;this.canvas=m.canvas,this.scaleManager=m.scale,this.events.emit(a.MANAGER_BOOT),S.on(l.PRE_RENDER,this.preRender,this),S.once(l.DESTROY,this.destroy,this)},setCanvasOver:function(m){this.isOver=!0,this.events.emit(a.GAME_OVER,m)},setCanvasOut:function(m){this.isOver=!1,this.events.emit(a.GAME_OUT,m)},preRender:function(){var m=this.game.loop.now,S=this.game.loop.delta,M=this.game.scene.getScenes(!0,!0);this.time=m,this.events.emit(a.MANAGER_UPDATE);for(var w=0;w10&&(m=10-this.pointersTotal);for(var M=0;M{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(96503),p=e(87902),h=e(83419),a=e(93301),l=e(74457),n=e(84409),u=e(20339),f=e(8497),o=e(81154),c=e(8214),d=e(50792),v=e(95540),m=e(23777),S=e(89639),M=e(41212),w=e(37277),C=e(87841),A=e(37303),P=e(44594),b=e(16483),O=e(10690),I=new h({Extends:d,initialize:function(B){d.call(this),this.scene=B,this.systems=B.sys,this.settings=B.sys.settings,this.manager=B.sys.game.input,this.pluginEvents=new d,this.enabled=!0,this.displayList,this.cameras,S.install(this),this.mouse=this.manager.mouse,this.topOnly=!0,this.pollRate=-1,this._pollTimer=0;var G={cancelled:!1};this._eventContainer={stopPropagation:function(){G.cancelled=!0}},this._eventData=G,this.dragDistanceThreshold=0,this.dragTimeThreshold=0,this._temp=[],this._tempZones=[],this._list=[],this._pendingInsertion=[],this._pendingRemoval=[],this._draggable=[],this._drag={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._dragState=[],this._over={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._validTypes=["onDown","onUp","onOver","onOut","onMove","onDragStart","onDrag","onDragEnd","onDragEnter","onDragLeave","onDragOver","onDrop"],this._updatedThisFrame=!1,B.sys.events.once(P.BOOT,this.boot,this),B.sys.events.on(P.START,this.start,this)},boot:function(){this.cameras=this.systems.cameras,this.displayList=this.systems.displayList,this.systems.events.once(P.DESTROY,this.destroy,this),this.pluginEvents.emit(c.BOOT)},start:function(){var D=this.systems.events;D.on(P.TRANSITION_START,this.transitionIn,this),D.on(P.TRANSITION_OUT,this.transitionOut,this),D.on(P.TRANSITION_COMPLETE,this.transitionComplete,this),D.on(P.PRE_UPDATE,this.preUpdate,this),D.once(P.SHUTDOWN,this.shutdown,this),this.manager.events.on(c.GAME_OUT,this.onGameOut,this),this.manager.events.on(c.GAME_OVER,this.onGameOver,this),this.enabled=!0,this._dragState=[0,0,0,0,0,0,0,0,0,0],this.pluginEvents.emit(c.START)},onGameOver:function(D){this.isActive()&&this.emit(c.GAME_OVER,D.timeStamp,D)},onGameOut:function(D){this.isActive()&&this.emit(c.GAME_OUT,D.timeStamp,D)},preUpdate:function(){this.pluginEvents.emit(c.PRE_UPDATE);var D=this._pendingRemoval,B=this._pendingInsertion,G=D.length,z=B.length;if(!(G===0&&z===0)){for(var X=this._list,K=0;K-1&&(X.splice(tt,1),this.clear(Q,!0))}this._pendingRemoval.length=0,this._list=X.concat(B.splice(0))}},isActive:function(){return this.enabled&&this.scene.sys.canInput()},updatePoll:function(D,B){if(!this.isActive())return!1;if(this.pluginEvents.emit(c.UPDATE,D,B),this._updatedThisFrame)return this._updatedThisFrame=!1,!1;var G,z=this.manager,X=z.pointers,K=z.pointersTotal;for(G=0;G0)if(this._pollTimer-=B,this._pollTimer<0)this._pollTimer=this.pollRate;else return!1;var tt=!1;for(G=0;G0&&(tt=!0)}return tt},update:function(D,B){if(!this.isActive())return!1;for(var G=B.length,z=!1,X=0;X0&&(z=!0)}return this._updatedThisFrame=!0,z},clear:function(D,B){B===void 0&&(B=!1),this.disable(D);var G=D.input;G&&(this.removeDebug(D),this.manager.resetCursor(G),G.gameObject=void 0,G.target=void 0,G.hitArea=void 0,G.hitAreaCallback=void 0,G.callbackContext=void 0,D.input=null),B||this.queueForRemoval(D);var z=this._draggable.indexOf(D);return z>-1&&this._draggable.splice(z,1),D},disable:function(D){var B=D.input;B&&(B.enabled=!1,B.dragState=0);for(var G=this._drag,z=this._over,X=this.manager,K=0,Q;K-1&&G[K].splice(Q,1),Q=z[K].indexOf(D),Q>-1&&z[K].splice(Q,1);return this},enable:function(D,B,G,z){return z===void 0&&(z=!1),D.input?D.input.enabled=!0:this.setHitArea(D,B,G),D.input&&z&&!D.input.dropZone&&(D.input.dropZone=z),this},hitTestPointer:function(D){for(var B=this.cameras.getCamerasBelowPointer(D),G=0;G0)return D.camera=z,X}return D.camera=B[0],[]},processDownEvents:function(D){var B=0,G=this._temp,z=this._eventData,X=this._eventContainer;z.cancelled=!1;for(var K=!1,Q=0;Q0&&u(D.x,D.y,D.downX,D.downY)>=X||z>0&&B>=D.downTime+z)&&(G=!0),G)return this.setDragState(D,3),this.processDragStartList(D)},processDragStartList:function(D){if(this.getDragState(D)!==3)return 0;for(var B=this._drag[D.id],G=0;G1&&(this.sortGameObjects(G,D),this.topOnly&&G.splice(1)),this._drag[D.id]=G,this.dragDistanceThreshold===0&&this.dragTimeThreshold===0?(this.setDragState(D,3),this.processDragStartList(D)):(this.setDragState(D,2),0))},processDragMoveEvent:function(D){if(this.getDragState(D)===2&&this.processDragThresholdEvent(D,this.manager.game.loop.now),this.getDragState(D)!==4)return 0;for(var B=this._tempZones,G=this._drag[D.id],z=0;z0?(X.emit(c.GAMEOBJECT_DRAG_LEAVE,D,Q),this.emit(c.DRAG_LEAVE,D,X,Q),K.target=B[0],Q=K.target,X.emit(c.GAMEOBJECT_DRAG_ENTER,D,Q),this.emit(c.DRAG_ENTER,D,X,Q)):(X.emit(c.GAMEOBJECT_DRAG_LEAVE,D,Q),this.emit(c.DRAG_LEAVE,D,X,Q),B[0]?(K.target=B[0],Q=K.target,X.emit(c.GAMEOBJECT_DRAG_ENTER,D,Q),this.emit(c.DRAG_ENTER,D,X,Q)):K.target=null)}else!Q&&B[0]&&(K.target=B[0],Q=K.target,X.emit(c.GAMEOBJECT_DRAG_ENTER,D,Q),this.emit(c.DRAG_ENTER,D,X,Q));var Y,Z;if(!X.parentContainer)Y=D.worldX-K.dragX,Z=D.worldY-K.dragY;else{var U=D.worldX-K.dragStartXGlobal,H=D.worldY-K.dragStartYGlobal,J=X.getParentRotation(),_=U*Math.cos(J)+H*Math.sin(J),q=H*Math.cos(J)-U*Math.sin(J);_*=1/X.parentContainer.scaleX,q*=1/X.parentContainer.scaleY,Y=_+K.dragStartX,Z=q+K.dragStartY}X.emit(c.GAMEOBJECT_DRAG,D,Y,Z),this.emit(c.DRAG,D,X,Y,Z)}return G.length},processDragUpEvent:function(D){for(var B=this._drag[D.id],G=0;G0){var K=this.manager,Q=this._eventData,tt=this._eventContainer;Q.cancelled=!1;for(var Y=!1,Z=0;Z0){var X=this.manager,K=this._eventData,Q=this._eventContainer;K.cancelled=!1;var tt=!1;this.sortGameObjects(B,D);for(var Y=0;Y0){for(this.sortGameObjects(X,D),G=0;G0){for(this.sortGameObjects(K,D),G=0;G-1&&this._draggable.splice(X,1)}return this},makePixelPerfect:function(D){D===void 0&&(D=1);var B=this.systems.textures;return n(B,D)},setHitArea:function(D,B,G){if(B===void 0)return this.setHitAreaFromTexture(D);Array.isArray(D)||(D=[D]);var z=!1,X=!1,K=!1,Q=!1,tt=!1,Y=!0;if(M(B)&&Object.keys(B).length){var Z=B,U=D.some(function(at){return at.hasOwnProperty("faces")});if(!U){B=v(Z,"hitArea",null),G=v(Z,"hitAreaCallback",null),tt=v(Z,"pixelPerfect",!1);var H=v(Z,"alphaTolerance",1);tt&&(B={},G=this.makePixelPerfect(H))}z=v(Z,"draggable",!1),X=v(Z,"dropZone",!1),K=v(Z,"cursor",!1),Q=v(Z,"useHandCursor",!1),(!B||!G)&&(this.setHitAreaFromTexture(D),Y=!1)}else typeof B=="function"&&!G&&(G=B,B={});for(var J=0;J{/** + */var r=e(96503),p=e(87902),h=e(83419),a=e(93301),l=e(74457),n=e(84409),u=e(20339),f=e(8497),o=e(81154),c=e(8214),d=e(50792),v=e(95540),m=e(23777),S=e(89639),M=e(41212),w=e(37277),C=e(87841),A=e(37303),P=e(44594),b=e(16483),O=e(10690),I=new h({Extends:d,initialize:function(B){d.call(this),this.scene=B,this.systems=B.sys,this.settings=B.sys.settings,this.manager=B.sys.game.input,this.pluginEvents=new d,this.enabled=!0,this.displayList,this.cameras,S.install(this),this.mouse=this.manager.mouse,this.topOnly=!0,this.pollRate=-1,this._pollTimer=0;var G={cancelled:!1};this._eventContainer={stopPropagation:function(){G.cancelled=!0}},this._eventData=G,this.dragDistanceThreshold=0,this.dragTimeThreshold=0,this._temp=[],this._tempZones=[],this._list=[],this._pendingInsertion=[],this._pendingRemoval=[],this._draggable=[],this._drag={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._dragState=[],this._over={0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[]},this._validTypes=["onDown","onUp","onOver","onOut","onMove","onDragStart","onDrag","onDragEnd","onDragEnter","onDragLeave","onDragOver","onDrop"],this._updatedThisFrame=!1,B.sys.events.once(P.BOOT,this.boot,this),B.sys.events.on(P.START,this.start,this)},boot:function(){this.cameras=this.systems.cameras,this.displayList=this.systems.displayList,this.systems.events.once(P.DESTROY,this.destroy,this),this.pluginEvents.emit(c.BOOT)},start:function(){var D=this.systems.events;D.on(P.TRANSITION_START,this.transitionIn,this),D.on(P.TRANSITION_OUT,this.transitionOut,this),D.on(P.TRANSITION_COMPLETE,this.transitionComplete,this),D.on(P.PRE_UPDATE,this.preUpdate,this),D.once(P.SHUTDOWN,this.shutdown,this),this.manager.events.on(c.GAME_OUT,this.onGameOut,this),this.manager.events.on(c.GAME_OVER,this.onGameOver,this),this.enabled=!0,this._dragState=[0,0,0,0,0,0,0,0,0,0],this.pluginEvents.emit(c.START)},onGameOver:function(D){this.isActive()&&this.emit(c.GAME_OVER,D.timeStamp,D)},onGameOut:function(D){this.isActive()&&this.emit(c.GAME_OUT,D.timeStamp,D)},preUpdate:function(){this.pluginEvents.emit(c.PRE_UPDATE);var D=this._pendingRemoval,B=this._pendingInsertion,G=D.length,z=B.length;if(!(G===0&&z===0)){for(var X=this._list,j=0;j-1&&(X.splice(tt,1),this.clear(Q,!0))}this._pendingRemoval.length=0,this._list=X.concat(B.splice(0))}},isActive:function(){return this.enabled&&this.scene.sys.canInput()},updatePoll:function(D,B){if(!this.isActive())return!1;if(this.pluginEvents.emit(c.UPDATE,D,B),this._updatedThisFrame)return this._updatedThisFrame=!1,!1;var G,z=this.manager,X=z.pointers,j=z.pointersTotal;for(G=0;G0)if(this._pollTimer-=B,this._pollTimer<0)this._pollTimer=this.pollRate;else return!1;var tt=!1;for(G=0;G0&&(tt=!0)}return tt},update:function(D,B){if(!this.isActive())return!1;for(var G=B.length,z=!1,X=0;X0&&(z=!0)}return this._updatedThisFrame=!0,z},clear:function(D,B){B===void 0&&(B=!1),this.disable(D);var G=D.input;G&&(this.removeDebug(D),this.manager.resetCursor(G),G.gameObject=void 0,G.target=void 0,G.hitArea=void 0,G.hitAreaCallback=void 0,G.callbackContext=void 0,D.input=null),B||this.queueForRemoval(D);var z=this._draggable.indexOf(D);return z>-1&&this._draggable.splice(z,1),D},disable:function(D){var B=D.input;B&&(B.enabled=!1,B.dragState=0);for(var G=this._drag,z=this._over,X=this.manager,j=0,Q;j-1&&G[j].splice(Q,1),Q=z[j].indexOf(D),Q>-1&&z[j].splice(Q,1);return this},enable:function(D,B,G,z){return z===void 0&&(z=!1),D.input?D.input.enabled=!0:this.setHitArea(D,B,G),D.input&&z&&!D.input.dropZone&&(D.input.dropZone=z),this},hitTestPointer:function(D){for(var B=this.cameras.getCamerasBelowPointer(D),G=0;G0)return D.camera=z,X}return D.camera=B[0],[]},processDownEvents:function(D){var B=0,G=this._temp,z=this._eventData,X=this._eventContainer;z.cancelled=!1;for(var j=!1,Q=0;Q0&&u(D.x,D.y,D.downX,D.downY)>=X||z>0&&B>=D.downTime+z)&&(G=!0),G)return this.setDragState(D,3),this.processDragStartList(D)},processDragStartList:function(D){if(this.getDragState(D)!==3)return 0;for(var B=this._drag[D.id],G=0;G1&&(this.sortGameObjects(G,D),this.topOnly&&G.splice(1)),this._drag[D.id]=G,this.dragDistanceThreshold===0&&this.dragTimeThreshold===0?(this.setDragState(D,3),this.processDragStartList(D)):(this.setDragState(D,2),0))},processDragMoveEvent:function(D){if(this.getDragState(D)===2&&this.processDragThresholdEvent(D,this.manager.game.loop.now),this.getDragState(D)!==4)return 0;for(var B=this._tempZones,G=this._drag[D.id],z=0;z0?(X.emit(c.GAMEOBJECT_DRAG_LEAVE,D,Q),this.emit(c.DRAG_LEAVE,D,X,Q),j.target=B[0],Q=j.target,X.emit(c.GAMEOBJECT_DRAG_ENTER,D,Q),this.emit(c.DRAG_ENTER,D,X,Q)):(X.emit(c.GAMEOBJECT_DRAG_LEAVE,D,Q),this.emit(c.DRAG_LEAVE,D,X,Q),B[0]?(j.target=B[0],Q=j.target,X.emit(c.GAMEOBJECT_DRAG_ENTER,D,Q),this.emit(c.DRAG_ENTER,D,X,Q)):j.target=null)}else!Q&&B[0]&&(j.target=B[0],Q=j.target,X.emit(c.GAMEOBJECT_DRAG_ENTER,D,Q),this.emit(c.DRAG_ENTER,D,X,Q));var Y,Z;if(!X.parentContainer)Y=D.worldX-j.dragX,Z=D.worldY-j.dragY;else{var U=D.worldX-j.dragStartXGlobal,H=D.worldY-j.dragStartYGlobal,J=X.getParentRotation(),_=U*Math.cos(J)+H*Math.sin(J),q=H*Math.cos(J)-U*Math.sin(J);_*=1/X.parentContainer.scaleX,q*=1/X.parentContainer.scaleY,Y=_+j.dragStartX,Z=q+j.dragStartY}X.emit(c.GAMEOBJECT_DRAG,D,Y,Z),this.emit(c.DRAG,D,X,Y,Z)}return G.length},processDragUpEvent:function(D){for(var B=this._drag[D.id],G=0;G0){var j=this.manager,Q=this._eventData,tt=this._eventContainer;Q.cancelled=!1;for(var Y=!1,Z=0;Z0){var X=this.manager,j=this._eventData,Q=this._eventContainer;j.cancelled=!1;var tt=!1;this.sortGameObjects(B,D);for(var Y=0;Y0){for(this.sortGameObjects(X,D),G=0;G0){for(this.sortGameObjects(j,D),G=0;G-1&&this._draggable.splice(X,1)}return this},makePixelPerfect:function(D){D===void 0&&(D=1);var B=this.systems.textures;return n(B,D)},setHitArea:function(D,B,G){if(B===void 0)return this.setHitAreaFromTexture(D);Array.isArray(D)||(D=[D]);var z=!1,X=!1,j=!1,Q=!1,tt=!1,Y=!0;if(M(B)&&Object.keys(B).length){var Z=B,U=D.some(function(at){return at.hasOwnProperty("faces")});if(!U){B=v(Z,"hitArea",null),G=v(Z,"hitAreaCallback",null),tt=v(Z,"pixelPerfect",!1);var H=v(Z,"alphaTolerance",1);tt&&(B={},G=this.makePixelPerfect(H))}z=v(Z,"draggable",!1),X=v(Z,"dropZone",!1),j=v(Z,"cursor",!1),Q=v(Z,"useHandCursor",!1),(!B||!G)&&(this.setHitAreaFromTexture(D),Y=!1)}else typeof B=="function"&&!G&&(G=B,B={});for(var J=0;J{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -3434,7 +3434,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83419),p=e(23906),h=e(35072),a=e(50792),l=e(54899),n=e(74099),u=e(95540),f=e(35154),o=e(37277),c=e(44594),d=e(92638),v=new r({Extends:a,initialize:function(S){a.call(this);var M=S.sys.game.config,w=S.sys.settings.loader;this.scene=S,this.systems=S.sys,this.cacheManager=S.sys.cache,this.textureManager=S.sys.textures,this.sceneManager=S.sys.game.scene,n.install(this),this.prefix="",this.path="",this.baseURL="",this.setBaseURL(u(w,"baseURL",M.loaderBaseURL)),this.setPath(u(w,"path",M.loaderPath)),this.setPrefix(u(w,"prefix",M.loaderPrefix)),this.maxParallelDownloads=u(w,"maxParallelDownloads",M.loaderMaxParallelDownloads),this.xhr=d(u(w,"responseType",M.loaderResponseType),u(w,"async",M.loaderAsync),u(w,"user",M.loaderUser),u(w,"password",M.loaderPassword),u(w,"timeout",M.loaderTimeout),u(w,"withCredentials",M.loaderWithCredentials)),this.crossOrigin=u(w,"crossOrigin",M.loaderCrossOrigin),this.imageLoadType=u(w,"imageLoadType",M.loaderImageLoadType),this.localSchemes=u(w,"localScheme",M.loaderLocalScheme),this.totalToLoad=0,this.progress=0,this.list=new h,this.inflight=new h,this.queue=new h,this._deleteQueue=new h,this.totalFailed=0,this.totalComplete=0,this.state=p.LOADER_IDLE,this.multiKeyIndex=0,S.sys.events.once(c.BOOT,this.boot,this),S.sys.events.on(c.START,this.pluginStart,this)},boot:function(){this.systems.events.once(c.DESTROY,this.destroy,this)},pluginStart:function(){this.systems.events.once(c.SHUTDOWN,this.shutdown,this)},setBaseURL:function(m){return m===void 0&&(m=""),m!==""&&m.substr(-1)!=="/"&&(m=m.concat("/")),this.baseURL=m,this},setPath:function(m){return m===void 0&&(m=""),m!==""&&m.substr(-1)!=="/"&&(m=m.concat("/")),this.path=m,this},setPrefix:function(m){return m===void 0&&(m=""),this.prefix=m,this},setCORS:function(m){return this.crossOrigin=m,this},addFile:function(m){Array.isArray(m)||(m=[m]);for(var S=0;S0},isLoading:function(){return this.state===p.LOADER_LOADING||this.state===p.LOADER_PROCESSING},isReady:function(){return this.state===p.LOADER_IDLE||this.state===p.LOADER_COMPLETE},start:function(){this.isReady()&&(this.progress=0,this.totalFailed=0,this.totalComplete=0,this.totalToLoad=this.list.size,this.emit(l.START,this),this.list.size===0?this.loadComplete():(this.state=p.LOADER_LOADING,this.inflight.clear(),this.queue.clear(),this.updateProgress(),this.checkLoadQueue(),this.systems.events.on(c.UPDATE,this.update,this)))},updateProgress:function(){this.progress=1-(this.list.size+this.inflight.size)/this.totalToLoad,this.emit(l.PROGRESS,this.progress)},update:function(){this.state===p.LOADER_LOADING&&this.list.size>0&&this.inflight.size{/** + */var r=e(83419),p=e(23906),h=e(35072),a=e(50792),l=e(54899),n=e(74099),u=e(95540),f=e(35154),o=e(37277),c=e(44594),d=e(92638),v=new r({Extends:a,initialize:function(S){a.call(this);var M=S.sys.game.config,w=S.sys.settings.loader;this.scene=S,this.systems=S.sys,this.cacheManager=S.sys.cache,this.textureManager=S.sys.textures,this.sceneManager=S.sys.game.scene,n.install(this),this.prefix="",this.path="",this.baseURL="",this.setBaseURL(u(w,"baseURL",M.loaderBaseURL)),this.setPath(u(w,"path",M.loaderPath)),this.setPrefix(u(w,"prefix",M.loaderPrefix)),this.maxParallelDownloads=u(w,"maxParallelDownloads",M.loaderMaxParallelDownloads),this.xhr=d(u(w,"responseType",M.loaderResponseType),u(w,"async",M.loaderAsync),u(w,"user",M.loaderUser),u(w,"password",M.loaderPassword),u(w,"timeout",M.loaderTimeout),u(w,"withCredentials",M.loaderWithCredentials)),this.crossOrigin=u(w,"crossOrigin",M.loaderCrossOrigin),this.imageLoadType=u(w,"imageLoadType",M.loaderImageLoadType),this.localSchemes=u(w,"localScheme",M.loaderLocalScheme),this.totalToLoad=0,this.progress=0,this.list=new h,this.inflight=new h,this.queue=new h,this._deleteQueue=new h,this.totalFailed=0,this.totalComplete=0,this.state=p.LOADER_IDLE,this.multiKeyIndex=0,S.sys.events.once(c.BOOT,this.boot,this),S.sys.events.on(c.START,this.pluginStart,this)},boot:function(){this.systems.events.once(c.DESTROY,this.destroy,this)},pluginStart:function(){this.systems.events.once(c.SHUTDOWN,this.shutdown,this)},setBaseURL:function(m){return m===void 0&&(m=""),m!==""&&m.substr(-1)!=="/"&&(m=m.concat("/")),this.baseURL=m,this},setPath:function(m){return m===void 0&&(m=""),m!==""&&m.substr(-1)!=="/"&&(m=m.concat("/")),this.path=m,this},setPrefix:function(m){return m===void 0&&(m=""),this.prefix=m,this},setCORS:function(m){return this.crossOrigin=m,this},addFile:function(m){Array.isArray(m)||(m=[m]);for(var S=0;S0},isLoading:function(){return this.state===p.LOADER_LOADING||this.state===p.LOADER_PROCESSING},isReady:function(){return this.state===p.LOADER_IDLE||this.state===p.LOADER_COMPLETE},start:function(){this.isReady()&&(this.progress=0,this.totalFailed=0,this.totalComplete=0,this.totalToLoad=this.list.size,this.emit(l.START,this),this.list.size===0?this.loadComplete():(this.state=p.LOADER_LOADING,this.inflight.clear(),this.queue.clear(),this.updateProgress(),this.checkLoadQueue(),this.systems.events.on(c.UPDATE,this.update,this)))},updateProgress:function(){this.progress=1-(this.list.size+this.inflight.size)/this.totalToLoad,this.emit(l.PROGRESS,this.progress)},update:function(){this.state===p.LOADER_LOADING&&this.list.size>0&&this.inflight.size{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -3538,7 +3538,7 @@ import{j as he}from"./jsx-runtime.BFYNFNPI.js";import{g as Wd,r as Pm,a as Pe,c * @author Richard Davey * @copyright 2021 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(38734),p=e(85722),h=e(83419),a=e(74099),l=e(95540),n=e(19550),u=e(41212),f=e(518),o=e(31403),c=e(46975),d=e(59327),v=e(26430),m=e(82038),S=e(55222),M=new h({Extends:v,initialize:function(C,A,P,b){if(P.multiAtlasURL){var O=new f(C,{key:A,url:P.multiAtlasURL,xhrSettings:b,config:P});v.call(this,C,"texture",A,[O])}else{var I=P.textureURL.substr(P.textureURL.length-3);P.type||(P.type=I.toLowerCase()==="ktx"?"KTX":"PVR");var D=new p(C,{key:A,url:P.textureURL,extension:I,xhrSettings:b,config:P});if(P.atlasURL){var B=new f(C,{key:A,url:P.atlasURL,xhrSettings:b,config:P});v.call(this,C,"texture",A,[D,B])}else v.call(this,C,"texture",A,[D])}this.config=P},onFileComplete:function(w){var C=this.files.indexOf(w);if(C!==-1){if(this.pending--,!this.config.multiAtlasURL)return;if(w.type==="json"&&w.data.hasOwnProperty("textures")){var A=w.data.textures,P=this.config,b=this.loader,O=b.baseURL,I=b.path,D=b.prefix,B=l(P,"multiBaseURL",this.baseURL),G=l(P,"multiPath",this.path),z=l(P,"prefix",this.prefix),X=l(P,"textureXhrSettings");B&&b.setBaseURL(B),G&&b.setPath(G),z&&b.setPrefix(z);for(var K=0;K{/** + */var r=e(38734),p=e(85722),h=e(83419),a=e(74099),l=e(95540),n=e(19550),u=e(41212),f=e(518),o=e(31403),c=e(46975),d=e(59327),v=e(26430),m=e(82038),S=e(55222),M=new h({Extends:v,initialize:function(C,A,P,b){if(P.multiAtlasURL){var O=new f(C,{key:A,url:P.multiAtlasURL,xhrSettings:b,config:P});v.call(this,C,"texture",A,[O])}else{var I=P.textureURL.substr(P.textureURL.length-3);P.type||(P.type=I.toLowerCase()==="ktx"?"KTX":"PVR");var D=new p(C,{key:A,url:P.textureURL,extension:I,xhrSettings:b,config:P});if(P.atlasURL){var B=new f(C,{key:A,url:P.atlasURL,xhrSettings:b,config:P});v.call(this,C,"texture",A,[D,B])}else v.call(this,C,"texture",A,[D])}this.config=P},onFileComplete:function(w){var C=this.files.indexOf(w);if(C!==-1){if(this.pending--,!this.config.multiAtlasURL)return;if(w.type==="json"&&w.data.hasOwnProperty("textures")){var A=w.data.textures,P=this.config,b=this.loader,O=b.baseURL,I=b.path,D=b.prefix,B=l(P,"multiBaseURL",this.baseURL),G=l(P,"multiPath",this.path),z=l(P,"prefix",this.prefix),X=l(P,"textureXhrSettings");B&&b.setBaseURL(B),G&&b.setPath(G),z&&b.setPrefix(z);for(var j=0;j{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -3719,11 +3719,11 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83419),p=new r({initialize:function(a){this.val=new Float32Array(9),a?this.copy(a):this.identity()},clone:function(){return new p(this)},set:function(h){return this.copy(h)},copy:function(h){var a=this.val,l=h.val;return a[0]=l[0],a[1]=l[1],a[2]=l[2],a[3]=l[3],a[4]=l[4],a[5]=l[5],a[6]=l[6],a[7]=l[7],a[8]=l[8],this},fromMat4:function(h){var a=h.val,l=this.val;return l[0]=a[0],l[1]=a[1],l[2]=a[2],l[3]=a[4],l[4]=a[5],l[5]=a[6],l[6]=a[8],l[7]=a[9],l[8]=a[10],this},fromArray:function(h){var a=this.val;return a[0]=h[0],a[1]=h[1],a[2]=h[2],a[3]=h[3],a[4]=h[4],a[5]=h[5],a[6]=h[6],a[7]=h[7],a[8]=h[8],this},identity:function(){var h=this.val;return h[0]=1,h[1]=0,h[2]=0,h[3]=0,h[4]=1,h[5]=0,h[6]=0,h[7]=0,h[8]=1,this},transpose:function(){var h=this.val,a=h[1],l=h[2],n=h[5];return h[1]=h[3],h[2]=h[6],h[3]=a,h[5]=h[7],h[6]=l,h[7]=n,this},invert:function(){var h=this.val,a=h[0],l=h[1],n=h[2],u=h[3],f=h[4],o=h[5],c=h[6],d=h[7],v=h[8],m=v*f-o*d,S=-v*u+o*c,M=d*u-f*c,w=a*m+l*S+n*M;return w?(w=1/w,h[0]=m*w,h[1]=(-v*l+n*d)*w,h[2]=(o*l-n*f)*w,h[3]=S*w,h[4]=(v*a-n*c)*w,h[5]=(-o*a+n*u)*w,h[6]=M*w,h[7]=(-d*a+l*c)*w,h[8]=(f*a-l*u)*w,this):null},adjoint:function(){var h=this.val,a=h[0],l=h[1],n=h[2],u=h[3],f=h[4],o=h[5],c=h[6],d=h[7],v=h[8];return h[0]=f*v-o*d,h[1]=n*d-l*v,h[2]=l*o-n*f,h[3]=o*c-u*v,h[4]=a*v-n*c,h[5]=n*u-a*o,h[6]=u*d-f*c,h[7]=l*c-a*d,h[8]=a*f-l*u,this},determinant:function(){var h=this.val,a=h[0],l=h[1],n=h[2],u=h[3],f=h[4],o=h[5],c=h[6],d=h[7],v=h[8];return a*(v*f-o*d)+l*(-v*u+o*c)+n*(d*u-f*c)},multiply:function(h){var a=this.val,l=a[0],n=a[1],u=a[2],f=a[3],o=a[4],c=a[5],d=a[6],v=a[7],m=a[8],S=h.val,M=S[0],w=S[1],C=S[2],A=S[3],P=S[4],b=S[5],O=S[6],I=S[7],D=S[8];return a[0]=M*l+w*f+C*d,a[1]=M*n+w*o+C*v,a[2]=M*u+w*c+C*m,a[3]=A*l+P*f+b*d,a[4]=A*n+P*o+b*v,a[5]=A*u+P*c+b*m,a[6]=O*l+I*f+D*d,a[7]=O*n+I*o+D*v,a[8]=O*u+I*c+D*m,this},translate:function(h){var a=this.val,l=h.x,n=h.y;return a[6]=l*a[0]+n*a[3]+a[6],a[7]=l*a[1]+n*a[4]+a[7],a[8]=l*a[2]+n*a[5]+a[8],this},rotate:function(h){var a=this.val,l=a[0],n=a[1],u=a[2],f=a[3],o=a[4],c=a[5],d=Math.sin(h),v=Math.cos(h);return a[0]=v*l+d*f,a[1]=v*n+d*o,a[2]=v*u+d*c,a[3]=v*f-d*l,a[4]=v*o-d*n,a[5]=v*c-d*u,this},scale:function(h){var a=this.val,l=h.x,n=h.y;return a[0]=l*a[0],a[1]=l*a[1],a[2]=l*a[2],a[3]=n*a[3],a[4]=n*a[4],a[5]=n*a[5],this},fromQuat:function(h){var a=h.x,l=h.y,n=h.z,u=h.w,f=a+a,o=l+l,c=n+n,d=a*f,v=a*o,m=a*c,S=l*o,M=l*c,w=n*c,C=u*f,A=u*o,P=u*c,b=this.val;return b[0]=1-(S+w),b[3]=v+P,b[6]=m-A,b[1]=v-P,b[4]=1-(d+w),b[7]=M+C,b[2]=m+A,b[5]=M-C,b[8]=1-(d+S),this},normalFromMat4:function(h){var a=h.val,l=this.val,n=a[0],u=a[1],f=a[2],o=a[3],c=a[4],d=a[5],v=a[6],m=a[7],S=a[8],M=a[9],w=a[10],C=a[11],A=a[12],P=a[13],b=a[14],O=a[15],I=n*d-u*c,D=n*v-f*c,B=n*m-o*c,G=u*v-f*d,z=u*m-o*d,X=f*m-o*v,K=S*P-M*A,Q=S*b-w*A,tt=S*O-C*A,Y=M*b-w*P,Z=M*O-C*P,U=w*O-C*b,H=I*U-D*Z+B*Y+G*tt-z*Q+X*K;return H?(H=1/H,l[0]=(d*U-v*Z+m*Y)*H,l[1]=(v*tt-c*U-m*Q)*H,l[2]=(c*Z-d*tt+m*K)*H,l[3]=(f*Z-u*U-o*Y)*H,l[4]=(n*U-f*tt+o*Q)*H,l[5]=(u*tt-n*Z-o*K)*H,l[6]=(P*X-b*z+O*G)*H,l[7]=(b*B-A*X-O*D)*H,l[8]=(A*z-P*B+O*I)*H,this):null}});s.exports=p},37867:(s,y,e)=>{/** + */var r=e(83419),p=new r({initialize:function(a){this.val=new Float32Array(9),a?this.copy(a):this.identity()},clone:function(){return new p(this)},set:function(h){return this.copy(h)},copy:function(h){var a=this.val,l=h.val;return a[0]=l[0],a[1]=l[1],a[2]=l[2],a[3]=l[3],a[4]=l[4],a[5]=l[5],a[6]=l[6],a[7]=l[7],a[8]=l[8],this},fromMat4:function(h){var a=h.val,l=this.val;return l[0]=a[0],l[1]=a[1],l[2]=a[2],l[3]=a[4],l[4]=a[5],l[5]=a[6],l[6]=a[8],l[7]=a[9],l[8]=a[10],this},fromArray:function(h){var a=this.val;return a[0]=h[0],a[1]=h[1],a[2]=h[2],a[3]=h[3],a[4]=h[4],a[5]=h[5],a[6]=h[6],a[7]=h[7],a[8]=h[8],this},identity:function(){var h=this.val;return h[0]=1,h[1]=0,h[2]=0,h[3]=0,h[4]=1,h[5]=0,h[6]=0,h[7]=0,h[8]=1,this},transpose:function(){var h=this.val,a=h[1],l=h[2],n=h[5];return h[1]=h[3],h[2]=h[6],h[3]=a,h[5]=h[7],h[6]=l,h[7]=n,this},invert:function(){var h=this.val,a=h[0],l=h[1],n=h[2],u=h[3],f=h[4],o=h[5],c=h[6],d=h[7],v=h[8],m=v*f-o*d,S=-v*u+o*c,M=d*u-f*c,w=a*m+l*S+n*M;return w?(w=1/w,h[0]=m*w,h[1]=(-v*l+n*d)*w,h[2]=(o*l-n*f)*w,h[3]=S*w,h[4]=(v*a-n*c)*w,h[5]=(-o*a+n*u)*w,h[6]=M*w,h[7]=(-d*a+l*c)*w,h[8]=(f*a-l*u)*w,this):null},adjoint:function(){var h=this.val,a=h[0],l=h[1],n=h[2],u=h[3],f=h[4],o=h[5],c=h[6],d=h[7],v=h[8];return h[0]=f*v-o*d,h[1]=n*d-l*v,h[2]=l*o-n*f,h[3]=o*c-u*v,h[4]=a*v-n*c,h[5]=n*u-a*o,h[6]=u*d-f*c,h[7]=l*c-a*d,h[8]=a*f-l*u,this},determinant:function(){var h=this.val,a=h[0],l=h[1],n=h[2],u=h[3],f=h[4],o=h[5],c=h[6],d=h[7],v=h[8];return a*(v*f-o*d)+l*(-v*u+o*c)+n*(d*u-f*c)},multiply:function(h){var a=this.val,l=a[0],n=a[1],u=a[2],f=a[3],o=a[4],c=a[5],d=a[6],v=a[7],m=a[8],S=h.val,M=S[0],w=S[1],C=S[2],A=S[3],P=S[4],b=S[5],O=S[6],I=S[7],D=S[8];return a[0]=M*l+w*f+C*d,a[1]=M*n+w*o+C*v,a[2]=M*u+w*c+C*m,a[3]=A*l+P*f+b*d,a[4]=A*n+P*o+b*v,a[5]=A*u+P*c+b*m,a[6]=O*l+I*f+D*d,a[7]=O*n+I*o+D*v,a[8]=O*u+I*c+D*m,this},translate:function(h){var a=this.val,l=h.x,n=h.y;return a[6]=l*a[0]+n*a[3]+a[6],a[7]=l*a[1]+n*a[4]+a[7],a[8]=l*a[2]+n*a[5]+a[8],this},rotate:function(h){var a=this.val,l=a[0],n=a[1],u=a[2],f=a[3],o=a[4],c=a[5],d=Math.sin(h),v=Math.cos(h);return a[0]=v*l+d*f,a[1]=v*n+d*o,a[2]=v*u+d*c,a[3]=v*f-d*l,a[4]=v*o-d*n,a[5]=v*c-d*u,this},scale:function(h){var a=this.val,l=h.x,n=h.y;return a[0]=l*a[0],a[1]=l*a[1],a[2]=l*a[2],a[3]=n*a[3],a[4]=n*a[4],a[5]=n*a[5],this},fromQuat:function(h){var a=h.x,l=h.y,n=h.z,u=h.w,f=a+a,o=l+l,c=n+n,d=a*f,v=a*o,m=a*c,S=l*o,M=l*c,w=n*c,C=u*f,A=u*o,P=u*c,b=this.val;return b[0]=1-(S+w),b[3]=v+P,b[6]=m-A,b[1]=v-P,b[4]=1-(d+w),b[7]=M+C,b[2]=m+A,b[5]=M-C,b[8]=1-(d+S),this},normalFromMat4:function(h){var a=h.val,l=this.val,n=a[0],u=a[1],f=a[2],o=a[3],c=a[4],d=a[5],v=a[6],m=a[7],S=a[8],M=a[9],w=a[10],C=a[11],A=a[12],P=a[13],b=a[14],O=a[15],I=n*d-u*c,D=n*v-f*c,B=n*m-o*c,G=u*v-f*d,z=u*m-o*d,X=f*m-o*v,j=S*P-M*A,Q=S*b-w*A,tt=S*O-C*A,Y=M*b-w*P,Z=M*O-C*P,U=w*O-C*b,H=I*U-D*Z+B*Y+G*tt-z*Q+X*j;return H?(H=1/H,l[0]=(d*U-v*Z+m*Y)*H,l[1]=(v*tt-c*U-m*Q)*H,l[2]=(c*Z-d*tt+m*j)*H,l[3]=(f*Z-u*U-o*Y)*H,l[4]=(n*U-f*tt+o*Q)*H,l[5]=(u*tt-n*Z-o*j)*H,l[6]=(P*X-b*z+O*G)*H,l[7]=(b*B-A*X-O*D)*H,l[8]=(A*z-P*B+O*I)*H,this):null}});s.exports=p},37867:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83419),p=e(25836),h=1e-6,a=new r({initialize:function(d){this.val=new Float32Array(16),d?this.copy(d):this.identity()},clone:function(){return new a(this)},set:function(c){return this.copy(c)},setValues:function(c,d,v,m,S,M,w,C,A,P,b,O,I,D,B,G){var z=this.val;return z[0]=c,z[1]=d,z[2]=v,z[3]=m,z[4]=S,z[5]=M,z[6]=w,z[7]=C,z[8]=A,z[9]=P,z[10]=b,z[11]=O,z[12]=I,z[13]=D,z[14]=B,z[15]=G,this},copy:function(c){var d=c.val;return this.setValues(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],d[9],d[10],d[11],d[12],d[13],d[14],d[15])},fromArray:function(c){return this.setValues(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])},zero:function(){return this.setValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)},transform:function(c,d,v){var m=l.fromQuat(v),S=m.val,M=d.x,w=d.y,C=d.z;return this.setValues(S[0]*M,S[1]*M,S[2]*M,0,S[4]*w,S[5]*w,S[6]*w,0,S[8]*C,S[9]*C,S[10]*C,0,c.x,c.y,c.z,1)},xyz:function(c,d,v){this.identity();var m=this.val;return m[12]=c,m[13]=d,m[14]=v,this},scaling:function(c,d,v){this.zero();var m=this.val;return m[0]=c,m[5]=d,m[10]=v,m[15]=1,this},identity:function(){return this.setValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},transpose:function(){var c=this.val,d=c[1],v=c[2],m=c[3],S=c[6],M=c[7],w=c[11];return c[1]=c[4],c[2]=c[8],c[3]=c[12],c[4]=d,c[6]=c[9],c[7]=c[13],c[8]=v,c[9]=S,c[11]=c[14],c[12]=m,c[13]=M,c[14]=w,this},getInverse:function(c){return this.copy(c),this.invert()},invert:function(){var c=this.val,d=c[0],v=c[1],m=c[2],S=c[3],M=c[4],w=c[5],C=c[6],A=c[7],P=c[8],b=c[9],O=c[10],I=c[11],D=c[12],B=c[13],G=c[14],z=c[15],X=d*w-v*M,K=d*C-m*M,Q=d*A-S*M,tt=v*C-m*w,Y=v*A-S*w,Z=m*A-S*C,U=P*B-b*D,H=P*G-O*D,J=P*z-I*D,_=b*G-O*B,q=b*z-I*B,at=O*z-I*G,ot=X*at-K*q+Q*_+tt*J-Y*H+Z*U;return ot?(ot=1/ot,this.setValues((w*at-C*q+A*_)*ot,(m*q-v*at-S*_)*ot,(B*Z-G*Y+z*tt)*ot,(O*Y-b*Z-I*tt)*ot,(C*J-M*at-A*H)*ot,(d*at-m*J+S*H)*ot,(G*Q-D*Z-z*K)*ot,(P*Z-O*Q+I*K)*ot,(M*q-w*J+A*U)*ot,(v*J-d*q-S*U)*ot,(D*Y-B*Q+z*X)*ot,(b*Q-P*Y-I*X)*ot,(w*H-M*_-C*U)*ot,(d*_-v*H+m*U)*ot,(B*K-D*tt-G*X)*ot,(P*tt-b*K+O*X)*ot)):this},adjoint:function(){var c=this.val,d=c[0],v=c[1],m=c[2],S=c[3],M=c[4],w=c[5],C=c[6],A=c[7],P=c[8],b=c[9],O=c[10],I=c[11],D=c[12],B=c[13],G=c[14],z=c[15];return this.setValues(w*(O*z-I*G)-b*(C*z-A*G)+B*(C*I-A*O),-(v*(O*z-I*G)-b*(m*z-S*G)+B*(m*I-S*O)),v*(C*z-A*G)-w*(m*z-S*G)+B*(m*A-S*C),-(v*(C*I-A*O)-w*(m*I-S*O)+b*(m*A-S*C)),-(M*(O*z-I*G)-P*(C*z-A*G)+D*(C*I-A*O)),d*(O*z-I*G)-P*(m*z-S*G)+D*(m*I-S*O),-(d*(C*z-A*G)-M*(m*z-S*G)+D*(m*A-S*C)),d*(C*I-A*O)-M*(m*I-S*O)+P*(m*A-S*C),M*(b*z-I*B)-P*(w*z-A*B)+D*(w*I-A*b),-(d*(b*z-I*B)-P*(v*z-S*B)+D*(v*I-S*b)),d*(w*z-A*B)-M*(v*z-S*B)+D*(v*A-S*w),-(d*(w*I-A*b)-M*(v*I-S*b)+P*(v*A-S*w)),-(M*(b*G-O*B)-P*(w*G-C*B)+D*(w*O-C*b)),d*(b*G-O*B)-P*(v*G-m*B)+D*(v*O-m*b),-(d*(w*G-C*B)-M*(v*G-m*B)+D*(v*C-m*w)),d*(w*O-C*b)-M*(v*O-m*b)+P*(v*C-m*w))},determinant:function(){var c=this.val,d=c[0],v=c[1],m=c[2],S=c[3],M=c[4],w=c[5],C=c[6],A=c[7],P=c[8],b=c[9],O=c[10],I=c[11],D=c[12],B=c[13],G=c[14],z=c[15],X=d*w-v*M,K=d*C-m*M,Q=d*A-S*M,tt=v*C-m*w,Y=v*A-S*w,Z=m*A-S*C,U=P*B-b*D,H=P*G-O*D,J=P*z-I*D,_=b*G-O*B,q=b*z-I*B,at=O*z-I*G;return X*at-K*q+Q*_+tt*J-Y*H+Z*U},multiply:function(c){var d=this.val,v=d[0],m=d[1],S=d[2],M=d[3],w=d[4],C=d[5],A=d[6],P=d[7],b=d[8],O=d[9],I=d[10],D=d[11],B=d[12],G=d[13],z=d[14],X=d[15],K=c.val,Q=K[0],tt=K[1],Y=K[2],Z=K[3];return d[0]=Q*v+tt*w+Y*b+Z*B,d[1]=Q*m+tt*C+Y*O+Z*G,d[2]=Q*S+tt*A+Y*I+Z*z,d[3]=Q*M+tt*P+Y*D+Z*X,Q=K[4],tt=K[5],Y=K[6],Z=K[7],d[4]=Q*v+tt*w+Y*b+Z*B,d[5]=Q*m+tt*C+Y*O+Z*G,d[6]=Q*S+tt*A+Y*I+Z*z,d[7]=Q*M+tt*P+Y*D+Z*X,Q=K[8],tt=K[9],Y=K[10],Z=K[11],d[8]=Q*v+tt*w+Y*b+Z*B,d[9]=Q*m+tt*C+Y*O+Z*G,d[10]=Q*S+tt*A+Y*I+Z*z,d[11]=Q*M+tt*P+Y*D+Z*X,Q=K[12],tt=K[13],Y=K[14],Z=K[15],d[12]=Q*v+tt*w+Y*b+Z*B,d[13]=Q*m+tt*C+Y*O+Z*G,d[14]=Q*S+tt*A+Y*I+Z*z,d[15]=Q*M+tt*P+Y*D+Z*X,this},multiplyLocal:function(c){var d=this.val,v=c.val;return this.setValues(d[0]*v[0]+d[1]*v[4]+d[2]*v[8]+d[3]*v[12],d[0]*v[1]+d[1]*v[5]+d[2]*v[9]+d[3]*v[13],d[0]*v[2]+d[1]*v[6]+d[2]*v[10]+d[3]*v[14],d[0]*v[3]+d[1]*v[7]+d[2]*v[11]+d[3]*v[15],d[4]*v[0]+d[5]*v[4]+d[6]*v[8]+d[7]*v[12],d[4]*v[1]+d[5]*v[5]+d[6]*v[9]+d[7]*v[13],d[4]*v[2]+d[5]*v[6]+d[6]*v[10]+d[7]*v[14],d[4]*v[3]+d[5]*v[7]+d[6]*v[11]+d[7]*v[15],d[8]*v[0]+d[9]*v[4]+d[10]*v[8]+d[11]*v[12],d[8]*v[1]+d[9]*v[5]+d[10]*v[9]+d[11]*v[13],d[8]*v[2]+d[9]*v[6]+d[10]*v[10]+d[11]*v[14],d[8]*v[3]+d[9]*v[7]+d[10]*v[11]+d[11]*v[15],d[12]*v[0]+d[13]*v[4]+d[14]*v[8]+d[15]*v[12],d[12]*v[1]+d[13]*v[5]+d[14]*v[9]+d[15]*v[13],d[12]*v[2]+d[13]*v[6]+d[14]*v[10]+d[15]*v[14],d[12]*v[3]+d[13]*v[7]+d[14]*v[11]+d[15]*v[15])},premultiply:function(c){return this.multiplyMatrices(c,this)},multiplyMatrices:function(c,d){var v=c.val,m=d.val,S=v[0],M=v[4],w=v[8],C=v[12],A=v[1],P=v[5],b=v[9],O=v[13],I=v[2],D=v[6],B=v[10],G=v[14],z=v[3],X=v[7],K=v[11],Q=v[15],tt=m[0],Y=m[4],Z=m[8],U=m[12],H=m[1],J=m[5],_=m[9],q=m[13],at=m[2],ot=m[6],rt=m[10],gt=m[14],yt=m[3],Et=m[7],At=m[11],Pt=m[15];return this.setValues(S*tt+M*H+w*at+C*yt,A*tt+P*H+b*at+O*yt,I*tt+D*H+B*at+G*yt,z*tt+X*H+K*at+Q*yt,S*Y+M*J+w*ot+C*Et,A*Y+P*J+b*ot+O*Et,I*Y+D*J+B*ot+G*Et,z*Y+X*J+K*ot+Q*Et,S*Z+M*_+w*rt+C*At,A*Z+P*_+b*rt+O*At,I*Z+D*_+B*rt+G*At,z*Z+X*_+K*rt+Q*At,S*U+M*q+w*gt+C*Pt,A*U+P*q+b*gt+O*Pt,I*U+D*q+B*gt+G*Pt,z*U+X*q+K*gt+Q*Pt)},translate:function(c){return this.translateXYZ(c.x,c.y,c.z)},translateXYZ:function(c,d,v){var m=this.val;return m[12]=m[0]*c+m[4]*d+m[8]*v+m[12],m[13]=m[1]*c+m[5]*d+m[9]*v+m[13],m[14]=m[2]*c+m[6]*d+m[10]*v+m[14],m[15]=m[3]*c+m[7]*d+m[11]*v+m[15],this},scale:function(c){return this.scaleXYZ(c.x,c.y,c.z)},scaleXYZ:function(c,d,v){var m=this.val;return m[0]=m[0]*c,m[1]=m[1]*c,m[2]=m[2]*c,m[3]=m[3]*c,m[4]=m[4]*d,m[5]=m[5]*d,m[6]=m[6]*d,m[7]=m[7]*d,m[8]=m[8]*v,m[9]=m[9]*v,m[10]=m[10]*v,m[11]=m[11]*v,this},makeRotationAxis:function(c,d){var v=Math.cos(d),m=Math.sin(d),S=1-v,M=c.x,w=c.y,C=c.z,A=S*M,P=S*w;return this.setValues(A*M+v,A*w-m*C,A*C+m*w,0,A*w+m*C,P*w+v,P*C-m*M,0,A*C-m*w,P*C+m*M,S*C*C+v,0,0,0,0,1)},rotate:function(c,d){var v=this.val,m=d.x,S=d.y,M=d.z,w=Math.sqrt(m*m+S*S+M*M);if(Math.abs(w){/** + */var r=e(83419),p=e(25836),h=1e-6,a=new r({initialize:function(d){this.val=new Float32Array(16),d?this.copy(d):this.identity()},clone:function(){return new a(this)},set:function(c){return this.copy(c)},setValues:function(c,d,v,m,S,M,w,C,A,P,b,O,I,D,B,G){var z=this.val;return z[0]=c,z[1]=d,z[2]=v,z[3]=m,z[4]=S,z[5]=M,z[6]=w,z[7]=C,z[8]=A,z[9]=P,z[10]=b,z[11]=O,z[12]=I,z[13]=D,z[14]=B,z[15]=G,this},copy:function(c){var d=c.val;return this.setValues(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],d[9],d[10],d[11],d[12],d[13],d[14],d[15])},fromArray:function(c){return this.setValues(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])},zero:function(){return this.setValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)},transform:function(c,d,v){var m=l.fromQuat(v),S=m.val,M=d.x,w=d.y,C=d.z;return this.setValues(S[0]*M,S[1]*M,S[2]*M,0,S[4]*w,S[5]*w,S[6]*w,0,S[8]*C,S[9]*C,S[10]*C,0,c.x,c.y,c.z,1)},xyz:function(c,d,v){this.identity();var m=this.val;return m[12]=c,m[13]=d,m[14]=v,this},scaling:function(c,d,v){this.zero();var m=this.val;return m[0]=c,m[5]=d,m[10]=v,m[15]=1,this},identity:function(){return this.setValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},transpose:function(){var c=this.val,d=c[1],v=c[2],m=c[3],S=c[6],M=c[7],w=c[11];return c[1]=c[4],c[2]=c[8],c[3]=c[12],c[4]=d,c[6]=c[9],c[7]=c[13],c[8]=v,c[9]=S,c[11]=c[14],c[12]=m,c[13]=M,c[14]=w,this},getInverse:function(c){return this.copy(c),this.invert()},invert:function(){var c=this.val,d=c[0],v=c[1],m=c[2],S=c[3],M=c[4],w=c[5],C=c[6],A=c[7],P=c[8],b=c[9],O=c[10],I=c[11],D=c[12],B=c[13],G=c[14],z=c[15],X=d*w-v*M,j=d*C-m*M,Q=d*A-S*M,tt=v*C-m*w,Y=v*A-S*w,Z=m*A-S*C,U=P*B-b*D,H=P*G-O*D,J=P*z-I*D,_=b*G-O*B,q=b*z-I*B,at=O*z-I*G,ot=X*at-j*q+Q*_+tt*J-Y*H+Z*U;return ot?(ot=1/ot,this.setValues((w*at-C*q+A*_)*ot,(m*q-v*at-S*_)*ot,(B*Z-G*Y+z*tt)*ot,(O*Y-b*Z-I*tt)*ot,(C*J-M*at-A*H)*ot,(d*at-m*J+S*H)*ot,(G*Q-D*Z-z*j)*ot,(P*Z-O*Q+I*j)*ot,(M*q-w*J+A*U)*ot,(v*J-d*q-S*U)*ot,(D*Y-B*Q+z*X)*ot,(b*Q-P*Y-I*X)*ot,(w*H-M*_-C*U)*ot,(d*_-v*H+m*U)*ot,(B*j-D*tt-G*X)*ot,(P*tt-b*j+O*X)*ot)):this},adjoint:function(){var c=this.val,d=c[0],v=c[1],m=c[2],S=c[3],M=c[4],w=c[5],C=c[6],A=c[7],P=c[8],b=c[9],O=c[10],I=c[11],D=c[12],B=c[13],G=c[14],z=c[15];return this.setValues(w*(O*z-I*G)-b*(C*z-A*G)+B*(C*I-A*O),-(v*(O*z-I*G)-b*(m*z-S*G)+B*(m*I-S*O)),v*(C*z-A*G)-w*(m*z-S*G)+B*(m*A-S*C),-(v*(C*I-A*O)-w*(m*I-S*O)+b*(m*A-S*C)),-(M*(O*z-I*G)-P*(C*z-A*G)+D*(C*I-A*O)),d*(O*z-I*G)-P*(m*z-S*G)+D*(m*I-S*O),-(d*(C*z-A*G)-M*(m*z-S*G)+D*(m*A-S*C)),d*(C*I-A*O)-M*(m*I-S*O)+P*(m*A-S*C),M*(b*z-I*B)-P*(w*z-A*B)+D*(w*I-A*b),-(d*(b*z-I*B)-P*(v*z-S*B)+D*(v*I-S*b)),d*(w*z-A*B)-M*(v*z-S*B)+D*(v*A-S*w),-(d*(w*I-A*b)-M*(v*I-S*b)+P*(v*A-S*w)),-(M*(b*G-O*B)-P*(w*G-C*B)+D*(w*O-C*b)),d*(b*G-O*B)-P*(v*G-m*B)+D*(v*O-m*b),-(d*(w*G-C*B)-M*(v*G-m*B)+D*(v*C-m*w)),d*(w*O-C*b)-M*(v*O-m*b)+P*(v*C-m*w))},determinant:function(){var c=this.val,d=c[0],v=c[1],m=c[2],S=c[3],M=c[4],w=c[5],C=c[6],A=c[7],P=c[8],b=c[9],O=c[10],I=c[11],D=c[12],B=c[13],G=c[14],z=c[15],X=d*w-v*M,j=d*C-m*M,Q=d*A-S*M,tt=v*C-m*w,Y=v*A-S*w,Z=m*A-S*C,U=P*B-b*D,H=P*G-O*D,J=P*z-I*D,_=b*G-O*B,q=b*z-I*B,at=O*z-I*G;return X*at-j*q+Q*_+tt*J-Y*H+Z*U},multiply:function(c){var d=this.val,v=d[0],m=d[1],S=d[2],M=d[3],w=d[4],C=d[5],A=d[6],P=d[7],b=d[8],O=d[9],I=d[10],D=d[11],B=d[12],G=d[13],z=d[14],X=d[15],j=c.val,Q=j[0],tt=j[1],Y=j[2],Z=j[3];return d[0]=Q*v+tt*w+Y*b+Z*B,d[1]=Q*m+tt*C+Y*O+Z*G,d[2]=Q*S+tt*A+Y*I+Z*z,d[3]=Q*M+tt*P+Y*D+Z*X,Q=j[4],tt=j[5],Y=j[6],Z=j[7],d[4]=Q*v+tt*w+Y*b+Z*B,d[5]=Q*m+tt*C+Y*O+Z*G,d[6]=Q*S+tt*A+Y*I+Z*z,d[7]=Q*M+tt*P+Y*D+Z*X,Q=j[8],tt=j[9],Y=j[10],Z=j[11],d[8]=Q*v+tt*w+Y*b+Z*B,d[9]=Q*m+tt*C+Y*O+Z*G,d[10]=Q*S+tt*A+Y*I+Z*z,d[11]=Q*M+tt*P+Y*D+Z*X,Q=j[12],tt=j[13],Y=j[14],Z=j[15],d[12]=Q*v+tt*w+Y*b+Z*B,d[13]=Q*m+tt*C+Y*O+Z*G,d[14]=Q*S+tt*A+Y*I+Z*z,d[15]=Q*M+tt*P+Y*D+Z*X,this},multiplyLocal:function(c){var d=this.val,v=c.val;return this.setValues(d[0]*v[0]+d[1]*v[4]+d[2]*v[8]+d[3]*v[12],d[0]*v[1]+d[1]*v[5]+d[2]*v[9]+d[3]*v[13],d[0]*v[2]+d[1]*v[6]+d[2]*v[10]+d[3]*v[14],d[0]*v[3]+d[1]*v[7]+d[2]*v[11]+d[3]*v[15],d[4]*v[0]+d[5]*v[4]+d[6]*v[8]+d[7]*v[12],d[4]*v[1]+d[5]*v[5]+d[6]*v[9]+d[7]*v[13],d[4]*v[2]+d[5]*v[6]+d[6]*v[10]+d[7]*v[14],d[4]*v[3]+d[5]*v[7]+d[6]*v[11]+d[7]*v[15],d[8]*v[0]+d[9]*v[4]+d[10]*v[8]+d[11]*v[12],d[8]*v[1]+d[9]*v[5]+d[10]*v[9]+d[11]*v[13],d[8]*v[2]+d[9]*v[6]+d[10]*v[10]+d[11]*v[14],d[8]*v[3]+d[9]*v[7]+d[10]*v[11]+d[11]*v[15],d[12]*v[0]+d[13]*v[4]+d[14]*v[8]+d[15]*v[12],d[12]*v[1]+d[13]*v[5]+d[14]*v[9]+d[15]*v[13],d[12]*v[2]+d[13]*v[6]+d[14]*v[10]+d[15]*v[14],d[12]*v[3]+d[13]*v[7]+d[14]*v[11]+d[15]*v[15])},premultiply:function(c){return this.multiplyMatrices(c,this)},multiplyMatrices:function(c,d){var v=c.val,m=d.val,S=v[0],M=v[4],w=v[8],C=v[12],A=v[1],P=v[5],b=v[9],O=v[13],I=v[2],D=v[6],B=v[10],G=v[14],z=v[3],X=v[7],j=v[11],Q=v[15],tt=m[0],Y=m[4],Z=m[8],U=m[12],H=m[1],J=m[5],_=m[9],q=m[13],at=m[2],ot=m[6],rt=m[10],gt=m[14],yt=m[3],Et=m[7],At=m[11],Pt=m[15];return this.setValues(S*tt+M*H+w*at+C*yt,A*tt+P*H+b*at+O*yt,I*tt+D*H+B*at+G*yt,z*tt+X*H+j*at+Q*yt,S*Y+M*J+w*ot+C*Et,A*Y+P*J+b*ot+O*Et,I*Y+D*J+B*ot+G*Et,z*Y+X*J+j*ot+Q*Et,S*Z+M*_+w*rt+C*At,A*Z+P*_+b*rt+O*At,I*Z+D*_+B*rt+G*At,z*Z+X*_+j*rt+Q*At,S*U+M*q+w*gt+C*Pt,A*U+P*q+b*gt+O*Pt,I*U+D*q+B*gt+G*Pt,z*U+X*q+j*gt+Q*Pt)},translate:function(c){return this.translateXYZ(c.x,c.y,c.z)},translateXYZ:function(c,d,v){var m=this.val;return m[12]=m[0]*c+m[4]*d+m[8]*v+m[12],m[13]=m[1]*c+m[5]*d+m[9]*v+m[13],m[14]=m[2]*c+m[6]*d+m[10]*v+m[14],m[15]=m[3]*c+m[7]*d+m[11]*v+m[15],this},scale:function(c){return this.scaleXYZ(c.x,c.y,c.z)},scaleXYZ:function(c,d,v){var m=this.val;return m[0]=m[0]*c,m[1]=m[1]*c,m[2]=m[2]*c,m[3]=m[3]*c,m[4]=m[4]*d,m[5]=m[5]*d,m[6]=m[6]*d,m[7]=m[7]*d,m[8]=m[8]*v,m[9]=m[9]*v,m[10]=m[10]*v,m[11]=m[11]*v,this},makeRotationAxis:function(c,d){var v=Math.cos(d),m=Math.sin(d),S=1-v,M=c.x,w=c.y,C=c.z,A=S*M,P=S*w;return this.setValues(A*M+v,A*w-m*C,A*C+m*w,0,A*w+m*C,P*w+v,P*C-m*M,0,A*C-m*w,P*C+m*M,S*C*C+v,0,0,0,0,1)},rotate:function(c,d){var v=this.val,m=d.x,S=d.y,M=d.z,w=Math.sqrt(m*m+S*S+M*M);if(Math.abs(w){/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -4277,7 +4277,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(55495),p=e(37742),h=e(45319),a=e(83419),l=e(79342),n=e(37747),u=e(20339),f=e(52816),o=e(50792),c=e(63012),d=e(43855),v=e(5470),m=e(94977),S=e(64897),M=e(45170),w=e(96523),C=e(35154),A=e(36383),P=e(25774),b=e(96602),O=e(87841),I=e(59542),D=e(40012),B=e(14087),G=e(89936),z=e(35072),X=e(72624),K=e(2483),Q=e(61340),tt=e(26099),Y=e(15994),Z=new a({Extends:o,initialize:function(H,J){o.call(this),this.scene=H,this.bodies=new z,this.staticBodies=new z,this.pendingDestroy=new z,this.colliders=new P,this.gravity=new tt(C(J,"gravity.x",0),C(J,"gravity.y",0)),this.bounds=new O(C(J,"x",0),C(J,"y",0),C(J,"width",H.sys.scale.width),C(J,"height",H.sys.scale.height)),this.checkCollision={up:C(J,"checkCollision.up",!0),down:C(J,"checkCollision.down",!0),left:C(J,"checkCollision.left",!0),right:C(J,"checkCollision.right",!0)},this.fps=C(J,"fps",60),this.fixedStep=C(J,"fixedStep",!0),this._elapsed=0,this._frameTime=1/this.fps,this._frameTimeMS=1e3*this._frameTime,this.stepsLastFrame=0,this.timeScale=C(J,"timeScale",1),this.OVERLAP_BIAS=C(J,"overlapBias",4),this.TILE_BIAS=C(J,"tileBias",16),this.forceX=C(J,"forceX",!1),this.isPaused=C(J,"isPaused",!1),this._total=0,this.drawDebug=C(J,"debug",!1),this.debugGraphic,this.defaults={debugShowBody:C(J,"debugShowBody",!0),debugShowStaticBody:C(J,"debugShowStaticBody",!0),debugShowVelocity:C(J,"debugShowVelocity",!0),bodyDebugColor:C(J,"debugBodyColor",16711935),staticBodyDebugColor:C(J,"debugStaticBodyColor",255),velocityDebugColor:C(J,"debugVelocityColor",65280)},this.maxEntries=C(J,"maxEntries",16),this.useTree=C(J,"useTree",!0),this.tree=new I(this.maxEntries),this.staticTree=new I(this.maxEntries),this.treeMinMax={minX:0,minY:0,maxX:0,maxY:0},this._tempMatrix=new Q,this._tempMatrix2=new Q,this.tileFilterOptions={isColliding:!0,isNotEmpty:!0,hasInterestingFace:!0},this.drawDebug&&this.createDebugGraphic()},enable:function(U,H){H===void 0&&(H=n.DYNAMIC_BODY),Array.isArray(U)||(U=[U]);for(var J=0;J=q;for(this.fixedStep||(_=H*.001,rt=!0,this._elapsed=0),J=0;J=q;)this._elapsed-=q,this.step(_)}},step:function(U){var H,J,_=this.bodies.entries,q=_.length;for(H=0;H0){var gt=this.tree,yt=this.staticTree;for(J=rt.entries,_=J.length,U=0;U<_;U++)H=J[U],H.physicsType===n.DYNAMIC_BODY?(gt.remove(H),q.delete(H)):H.physicsType===n.STATIC_BODY&&(yt.remove(H),at.delete(H)),H.world=void 0,H.gameObject=void 0;rt.clear()}},updateMotion:function(U,H){U.allowRotation&&this.computeAngularVelocity(U,H),this.computeVelocity(U,H)},computeAngularVelocity:function(U,H){var J=U.angularVelocity,_=U.angularAcceleration,q=U.angularDrag,at=U.maxAngular;_?J+=_*H:U.allowDrag&&q&&(q*=H,v(J-q,0,.1)?J-=q:m(J+q,0,.1)?J+=q:J=0),J=h(J,-at,at);var ot=J-U.angularVelocity;U.angularVelocity+=ot,U.rotation+=U.angularVelocity*H},computeVelocity:function(U,H){var J=U.velocity.x,_=U.acceleration.x,q=U.drag.x,at=U.maxVelocity.x,ot=U.velocity.y,rt=U.acceleration.y,gt=U.drag.y,yt=U.maxVelocity.y,Et=U.speed,At=U.maxSpeed,Pt=U.allowDrag,Vt=U.useDamping;U.allowGravity&&(J+=(this.gravity.x+U.gravity.x)*H,ot+=(this.gravity.y+U.gravity.y)*H),_?J+=_*H:Pt&&q&&(Vt?(q=Math.pow(q,H),J*=q,Et=Math.sqrt(J*J+ot*ot),d(Et,0,.001)&&(J=0)):(q*=H,v(J-q,0,.01)?J-=q:m(J+q,0,.01)?J+=q:J=0)),rt?ot+=rt*H:Pt&>&&(Vt?(gt=Math.pow(gt,H),ot*=gt,Et=Math.sqrt(J*J+ot*ot),d(Et,0,.001)&&(ot=0)):(gt*=H,v(ot-gt,0,.01)?ot-=gt:m(ot+gt,0,.01)?ot+=gt:ot=0)),J=h(J,-at,at),ot=h(ot,-yt,yt),U.velocity.set(J,ot),At>-1&&U.velocity.length()>At&&(U.velocity.normalize().scale(At),Et=At),U.speed=Et},separate:function(U,H,J,_,q){var at,ot,rt=!1,gt=!0;if(!U.enable||!H.enable||U.checkCollision.none||H.checkCollision.none||!this.intersects(U,H)||J&&J.call(_,U.gameObject,H.gameObject)===!1)return rt;if(U.isCircle||H.isCircle){var yt=this.separateCircle(U,H,q);yt.result?(rt=!0,gt=!1):(at=yt.x,ot=yt.y,gt=!0)}if(gt){var Et=!1,At=!1,Pt=this.OVERLAP_BIAS;q?(Et=B(U,H,q,Pt,at),At=G(U,H,q,Pt,ot)):this.forceX||Math.abs(this.gravity.y+U.gravity.y)Ht&&(At=u(Vt,dt,Ht,Dt)-ut):dt>Bt&&(VtHt&&(At=u(Vt,dt,Ht,Bt)-ut)),At*=-1}else At=U.halfWidth+H.halfWidth-f(at,ot);U.overlapR=At,H.overlapR=At;var ne=r(at,ot),oe=(At+A.EPSILON)*Math.cos(ne),ge=(At+A.EPSILON)*Math.sin(ne),xe={overlap:At,result:!1,x:oe,y:ge};if(J&&(!Pt||Pt&&At!==0))return xe.result=!0,xe;if(!Pt&&At===0||rt&>||U.customSeparateX||H.customSeparateX)return xe.x=void 0,xe.y=void 0,xe;var Ae=!U.pushable&&!H.pushable;if(Pt){var qt=at.x-ot.x,Ge=at.y-ot.y,Oe=Math.sqrt(Math.pow(qt,2)+Math.pow(Ge,2)),Be=(ot.x-at.x)/Oe||0,Le=(ot.y-at.y)/Oe||0,ie=2*(yt.x*Be+yt.y*Le-Et.x*Be-Et.y*Le)/(U.mass+H.mass);(rt||gt)&&(ie*=2),rt||(yt.x=yt.x-ie/U.mass*Be,yt.y=yt.y-ie/U.mass*Le,yt.multiply(U.bounce)),gt||(Et.x=Et.x+ie/H.mass*Be,Et.y=Et.y+ie/H.mass*Le,Et.multiply(H.bounce)),!rt&&!gt&&(oe*=.5,ge*=.5),rt||(U.x-=oe,U.y-=ge,U.updateCenter()),gt||(H.x+=oe,H.y+=ge,H.updateCenter()),xe.result=!0}else!rt||U.pushable||Ae?(U.x-=oe,U.y-=ge,U.updateCenter()):(!gt||H.pushable||Ae)&&(H.x+=oe,H.y+=ge,H.updateCenter()),xe.x=void 0,xe.y=void 0;return xe},intersects:function(U,H){return U===H?!1:!U.isCircle&&!H.isCircle?!(U.right<=H.left||U.bottom<=H.top||U.left>=H.right||U.top>=H.bottom):U.isCircle?H.isCircle?f(U.center,H.center)<=U.halfWidth+H.halfWidth:this.circleBodyIntersects(U,H):this.circleBodyIntersects(H,U)},circleBodyIntersects:function(U,H){var J=h(U.center.x,H.left,H.right),_=h(U.center.y,H.top,H.bottom),q=(U.center.x-J)*(U.center.x-J),at=(U.center.y-_)*(U.center.y-_);return q+at<=U.halfWidth*U.halfWidth},overlap:function(U,H,J,_,q){return J===void 0&&(J=null),_===void 0&&(_=null),q===void 0&&(q=J),this.collideObjects(U,H,J,_,q,!0)},collide:function(U,H,J,_,q){return J===void 0&&(J=null),_===void 0&&(_=null),q===void 0&&(q=J),this.collideObjects(U,H,J,_,q,!1)},collideObjects:function(U,H,J,_,q,at){var ot,rt;U.isParent&&(U.physicsType===void 0||H===void 0||U===H)&&(U=U.children.entries),H&&H.isParent&&H.physicsType===void 0&&(H=H.children.entries);var gt=Array.isArray(U),yt=Array.isArray(H);if(this._total=0,!gt&&!yt)this.collideHandler(U,H,J,_,q,at);else if(!gt&&yt)for(ot=0;ot0},collideHandler:function(U,H,J,_,q,at){if(H===void 0&&U.isParent)return this.collideGroupVsGroup(U,U,J,_,q,at);if(!U||!H)return!1;if(U.body||U.isBody){if(H.body||H.isBody)return this.collideSpriteVsSprite(U,H,J,_,q,at);if(H.isParent)return this.collideSpriteVsGroup(U,H,J,_,q,at);if(H.isTilemap)return this.collideSpriteVsTilemapLayer(U,H,J,_,q,at)}else if(U.isParent){if(H.body||H.isBody)return this.collideSpriteVsGroup(H,U,J,_,q,at);if(H.isParent)return this.collideGroupVsGroup(U,H,J,_,q,at);if(H.isTilemap)return this.collideGroupVsTilemapLayer(U,H,J,_,q,at)}else if(U.isTilemap){if(H.body||H.isBody)return this.collideSpriteVsTilemapLayer(H,U,J,_,q,at);if(H.isParent)return this.collideGroupVsTilemapLayer(H,U,J,_,q,at)}},canCollide:function(U,H){return U&&H&&(U.collisionMask&H.collisionCategory)!==0&&(H.collisionMask&U.collisionCategory)!==0},collideSpriteVsSprite:function(U,H,J,_,q,at){var ot=U.isBody?U:U.body,rt=H.isBody?H:H.body;return this.canCollide(ot,rt)?(this.separate(ot,rt,_,q,at)&&(J&&J.call(q,U,H),this._total++),!0):!1},collideSpriteVsGroup:function(U,H,J,_,q,at){var ot=U.isBody?U:U.body;if(!(H.length===0||!ot||!ot.enable||ot.checkCollision.none||!this.canCollide(ot,H))){var rt,gt,yt;if(this.useTree||H.physicsType===n.STATIC_BODY){var Et=this.treeMinMax;Et.minX=ot.left,Et.minY=ot.top,Et.maxX=ot.right,Et.maxY=ot.bottom;var At=H.physicsType===n.DYNAMIC_BODY?this.tree.search(Et):this.staticTree.search(Et);for(gt=At.length,rt=0;rt{/** + */var r=e(55495),p=e(37742),h=e(45319),a=e(83419),l=e(79342),n=e(37747),u=e(20339),f=e(52816),o=e(50792),c=e(63012),d=e(43855),v=e(5470),m=e(94977),S=e(64897),M=e(45170),w=e(96523),C=e(35154),A=e(36383),P=e(25774),b=e(96602),O=e(87841),I=e(59542),D=e(40012),B=e(14087),G=e(89936),z=e(35072),X=e(72624),j=e(2483),Q=e(61340),tt=e(26099),Y=e(15994),Z=new a({Extends:o,initialize:function(H,J){o.call(this),this.scene=H,this.bodies=new z,this.staticBodies=new z,this.pendingDestroy=new z,this.colliders=new P,this.gravity=new tt(C(J,"gravity.x",0),C(J,"gravity.y",0)),this.bounds=new O(C(J,"x",0),C(J,"y",0),C(J,"width",H.sys.scale.width),C(J,"height",H.sys.scale.height)),this.checkCollision={up:C(J,"checkCollision.up",!0),down:C(J,"checkCollision.down",!0),left:C(J,"checkCollision.left",!0),right:C(J,"checkCollision.right",!0)},this.fps=C(J,"fps",60),this.fixedStep=C(J,"fixedStep",!0),this._elapsed=0,this._frameTime=1/this.fps,this._frameTimeMS=1e3*this._frameTime,this.stepsLastFrame=0,this.timeScale=C(J,"timeScale",1),this.OVERLAP_BIAS=C(J,"overlapBias",4),this.TILE_BIAS=C(J,"tileBias",16),this.forceX=C(J,"forceX",!1),this.isPaused=C(J,"isPaused",!1),this._total=0,this.drawDebug=C(J,"debug",!1),this.debugGraphic,this.defaults={debugShowBody:C(J,"debugShowBody",!0),debugShowStaticBody:C(J,"debugShowStaticBody",!0),debugShowVelocity:C(J,"debugShowVelocity",!0),bodyDebugColor:C(J,"debugBodyColor",16711935),staticBodyDebugColor:C(J,"debugStaticBodyColor",255),velocityDebugColor:C(J,"debugVelocityColor",65280)},this.maxEntries=C(J,"maxEntries",16),this.useTree=C(J,"useTree",!0),this.tree=new I(this.maxEntries),this.staticTree=new I(this.maxEntries),this.treeMinMax={minX:0,minY:0,maxX:0,maxY:0},this._tempMatrix=new Q,this._tempMatrix2=new Q,this.tileFilterOptions={isColliding:!0,isNotEmpty:!0,hasInterestingFace:!0},this.drawDebug&&this.createDebugGraphic()},enable:function(U,H){H===void 0&&(H=n.DYNAMIC_BODY),Array.isArray(U)||(U=[U]);for(var J=0;J=q;for(this.fixedStep||(_=H*.001,rt=!0,this._elapsed=0),J=0;J=q;)this._elapsed-=q,this.step(_)}},step:function(U){var H,J,_=this.bodies.entries,q=_.length;for(H=0;H0){var gt=this.tree,yt=this.staticTree;for(J=rt.entries,_=J.length,U=0;U<_;U++)H=J[U],H.physicsType===n.DYNAMIC_BODY?(gt.remove(H),q.delete(H)):H.physicsType===n.STATIC_BODY&&(yt.remove(H),at.delete(H)),H.world=void 0,H.gameObject=void 0;rt.clear()}},updateMotion:function(U,H){U.allowRotation&&this.computeAngularVelocity(U,H),this.computeVelocity(U,H)},computeAngularVelocity:function(U,H){var J=U.angularVelocity,_=U.angularAcceleration,q=U.angularDrag,at=U.maxAngular;_?J+=_*H:U.allowDrag&&q&&(q*=H,v(J-q,0,.1)?J-=q:m(J+q,0,.1)?J+=q:J=0),J=h(J,-at,at);var ot=J-U.angularVelocity;U.angularVelocity+=ot,U.rotation+=U.angularVelocity*H},computeVelocity:function(U,H){var J=U.velocity.x,_=U.acceleration.x,q=U.drag.x,at=U.maxVelocity.x,ot=U.velocity.y,rt=U.acceleration.y,gt=U.drag.y,yt=U.maxVelocity.y,Et=U.speed,At=U.maxSpeed,Pt=U.allowDrag,Vt=U.useDamping;U.allowGravity&&(J+=(this.gravity.x+U.gravity.x)*H,ot+=(this.gravity.y+U.gravity.y)*H),_?J+=_*H:Pt&&q&&(Vt?(q=Math.pow(q,H),J*=q,Et=Math.sqrt(J*J+ot*ot),d(Et,0,.001)&&(J=0)):(q*=H,v(J-q,0,.01)?J-=q:m(J+q,0,.01)?J+=q:J=0)),rt?ot+=rt*H:Pt&>&&(Vt?(gt=Math.pow(gt,H),ot*=gt,Et=Math.sqrt(J*J+ot*ot),d(Et,0,.001)&&(ot=0)):(gt*=H,v(ot-gt,0,.01)?ot-=gt:m(ot+gt,0,.01)?ot+=gt:ot=0)),J=h(J,-at,at),ot=h(ot,-yt,yt),U.velocity.set(J,ot),At>-1&&U.velocity.length()>At&&(U.velocity.normalize().scale(At),Et=At),U.speed=Et},separate:function(U,H,J,_,q){var at,ot,rt=!1,gt=!0;if(!U.enable||!H.enable||U.checkCollision.none||H.checkCollision.none||!this.intersects(U,H)||J&&J.call(_,U.gameObject,H.gameObject)===!1)return rt;if(U.isCircle||H.isCircle){var yt=this.separateCircle(U,H,q);yt.result?(rt=!0,gt=!1):(at=yt.x,ot=yt.y,gt=!0)}if(gt){var Et=!1,At=!1,Pt=this.OVERLAP_BIAS;q?(Et=B(U,H,q,Pt,at),At=G(U,H,q,Pt,ot)):this.forceX||Math.abs(this.gravity.y+U.gravity.y)Ht&&(At=u(Vt,dt,Ht,Dt)-ut):dt>Bt&&(VtHt&&(At=u(Vt,dt,Ht,Bt)-ut)),At*=-1}else At=U.halfWidth+H.halfWidth-f(at,ot);U.overlapR=At,H.overlapR=At;var re=r(at,ot),le=(At+A.EPSILON)*Math.cos(re),ge=(At+A.EPSILON)*Math.sin(re),xe={overlap:At,result:!1,x:le,y:ge};if(J&&(!Pt||Pt&&At!==0))return xe.result=!0,xe;if(!Pt&&At===0||rt&>||U.customSeparateX||H.customSeparateX)return xe.x=void 0,xe.y=void 0,xe;var Pe=!U.pushable&&!H.pushable;if(Pt){var te=at.x-ot.x,Ge=at.y-ot.y,Oe=Math.sqrt(Math.pow(te,2)+Math.pow(Ge,2)),Be=(ot.x-at.x)/Oe||0,Le=(ot.y-at.y)/Oe||0,ne=2*(yt.x*Be+yt.y*Le-Et.x*Be-Et.y*Le)/(U.mass+H.mass);(rt||gt)&&(ne*=2),rt||(yt.x=yt.x-ne/U.mass*Be,yt.y=yt.y-ne/U.mass*Le,yt.multiply(U.bounce)),gt||(Et.x=Et.x+ne/H.mass*Be,Et.y=Et.y+ne/H.mass*Le,Et.multiply(H.bounce)),!rt&&!gt&&(le*=.5,ge*=.5),rt||(U.x-=le,U.y-=ge,U.updateCenter()),gt||(H.x+=le,H.y+=ge,H.updateCenter()),xe.result=!0}else!rt||U.pushable||Pe?(U.x-=le,U.y-=ge,U.updateCenter()):(!gt||H.pushable||Pe)&&(H.x+=le,H.y+=ge,H.updateCenter()),xe.x=void 0,xe.y=void 0;return xe},intersects:function(U,H){return U===H?!1:!U.isCircle&&!H.isCircle?!(U.right<=H.left||U.bottom<=H.top||U.left>=H.right||U.top>=H.bottom):U.isCircle?H.isCircle?f(U.center,H.center)<=U.halfWidth+H.halfWidth:this.circleBodyIntersects(U,H):this.circleBodyIntersects(H,U)},circleBodyIntersects:function(U,H){var J=h(U.center.x,H.left,H.right),_=h(U.center.y,H.top,H.bottom),q=(U.center.x-J)*(U.center.x-J),at=(U.center.y-_)*(U.center.y-_);return q+at<=U.halfWidth*U.halfWidth},overlap:function(U,H,J,_,q){return J===void 0&&(J=null),_===void 0&&(_=null),q===void 0&&(q=J),this.collideObjects(U,H,J,_,q,!0)},collide:function(U,H,J,_,q){return J===void 0&&(J=null),_===void 0&&(_=null),q===void 0&&(q=J),this.collideObjects(U,H,J,_,q,!1)},collideObjects:function(U,H,J,_,q,at){var ot,rt;U.isParent&&(U.physicsType===void 0||H===void 0||U===H)&&(U=U.children.entries),H&&H.isParent&&H.physicsType===void 0&&(H=H.children.entries);var gt=Array.isArray(U),yt=Array.isArray(H);if(this._total=0,!gt&&!yt)this.collideHandler(U,H,J,_,q,at);else if(!gt&&yt)for(ot=0;ot0},collideHandler:function(U,H,J,_,q,at){if(H===void 0&&U.isParent)return this.collideGroupVsGroup(U,U,J,_,q,at);if(!U||!H)return!1;if(U.body||U.isBody){if(H.body||H.isBody)return this.collideSpriteVsSprite(U,H,J,_,q,at);if(H.isParent)return this.collideSpriteVsGroup(U,H,J,_,q,at);if(H.isTilemap)return this.collideSpriteVsTilemapLayer(U,H,J,_,q,at)}else if(U.isParent){if(H.body||H.isBody)return this.collideSpriteVsGroup(H,U,J,_,q,at);if(H.isParent)return this.collideGroupVsGroup(U,H,J,_,q,at);if(H.isTilemap)return this.collideGroupVsTilemapLayer(U,H,J,_,q,at)}else if(U.isTilemap){if(H.body||H.isBody)return this.collideSpriteVsTilemapLayer(H,U,J,_,q,at);if(H.isParent)return this.collideGroupVsTilemapLayer(H,U,J,_,q,at)}},canCollide:function(U,H){return U&&H&&(U.collisionMask&H.collisionCategory)!==0&&(H.collisionMask&U.collisionCategory)!==0},collideSpriteVsSprite:function(U,H,J,_,q,at){var ot=U.isBody?U:U.body,rt=H.isBody?H:H.body;return this.canCollide(ot,rt)?(this.separate(ot,rt,_,q,at)&&(J&&J.call(q,U,H),this._total++),!0):!1},collideSpriteVsGroup:function(U,H,J,_,q,at){var ot=U.isBody?U:U.body;if(!(H.length===0||!ot||!ot.enable||ot.checkCollision.none||!this.canCollide(ot,H))){var rt,gt,yt;if(this.useTree||H.physicsType===n.STATIC_BODY){var Et=this.treeMinMax;Et.minX=ot.left,Et.minY=ot.top,Et.maxX=ot.right,Et.maxY=ot.bottom;var At=H.physicsType===n.DYNAMIC_BODY?this.tree.search(Et):this.staticTree.search(Et);for(gt=At.length,rt=0;rt{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -4429,7 +4429,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(66280),p=e(83419),h=e(74116),a=e(48140),l=e(74058),n=e(75803),u=e(23181),f=e(34803),o=e(73834),c=e(19496),d=e(85791),v=e(98713),m=e(41598),S=new p({initialize:function(w){this.world=w,this.scene=w.scene,this.sys=w.scene.sys},rectangle:function(M,w,C,A,P){var b=r.rectangle(M,w,C,A,P);return this.world.add(b),b},trapezoid:function(M,w,C,A,P,b){var O=r.trapezoid(M,w,C,A,P,b);return this.world.add(O),O},circle:function(M,w,C,A,P){var b=r.circle(M,w,C,A,P);return this.world.add(b),b},polygon:function(M,w,C,A,P){var b=r.polygon(M,w,C,A,P);return this.world.add(b),b},fromVertices:function(M,w,C,A,P,b,O){typeof C=="string"&&(C=m.fromPath(C));var I=r.fromVertices(M,w,C,A,P,b,O);return this.world.add(I),I},fromPhysicsEditor:function(M,w,C,A,P){P===void 0&&(P=!0);var b=c.parseBody(M,w,C,A);return P&&!this.world.has(b)&&this.world.add(b),b},fromSVG:function(M,w,C,A,P,b){A===void 0&&(A=1),P===void 0&&(P={}),b===void 0&&(b=!0);for(var O=C.getElementsByTagName("path"),I=[],D=0;D{/** + */var r=e(66280),p=e(83419),h=e(74116),a=e(48140),l=e(74058),n=e(75803),u=e(23181),f=e(34803),o=e(73834),c=e(19496),d=e(85791),v=e(98713),m=e(41598),S=new p({initialize:function(w){this.world=w,this.scene=w.scene,this.sys=w.scene.sys},rectangle:function(M,w,C,A,P){var b=r.rectangle(M,w,C,A,P);return this.world.add(b),b},trapezoid:function(M,w,C,A,P,b){var O=r.trapezoid(M,w,C,A,P,b);return this.world.add(O),O},circle:function(M,w,C,A,P){var b=r.circle(M,w,C,A,P);return this.world.add(b),b},polygon:function(M,w,C,A,P){var b=r.polygon(M,w,C,A,P);return this.world.add(b),b},fromVertices:function(M,w,C,A,P,b,O){typeof C=="string"&&(C=m.fromPath(C));var I=r.fromVertices(M,w,C,A,P,b,O);return this.world.add(I),I},fromPhysicsEditor:function(M,w,C,A,P){P===void 0&&(P=!0);var b=c.parseBody(M,w,C,A);return P&&!this.world.has(b)&&this.world.add(b),b},fromSVG:function(M,w,C,A,P,b){A===void 0&&(A=1),P===void 0&&(P={}),b===void 0&&(b=!0);for(var O=C.getElementsByTagName("path"),I=[],D=0;D{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -4441,7 +4441,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(60461),p=e(66615),h=e(66280),a=e(22562),l=e(68174),n=e(15647),u=e(83419),f=e(52284),o=e(53402),c=e(69351),d=e(74116),v=e(48140),m=e(81388),S=e(20339),M=e(28137),w=e(95540),C=e(35154),A=e(18210),P=e(40178),b=e(6790),O=e(74507),I=e(46975),D=e(4506),B=e(99561),G=e(73832),z=e(37277),X=e(73296),K=e(66272),Q=e(44594),tt=e(74058),Y=e(31725),Z=e(41598),U=e(68243);o.setDecomp(e(55973));var H=new u({initialize:function(_){this.scene=_,this.systems=_.sys,this.config=this.getConfig(),this.world,this.add,this.bodyBounds,this.body=a,this.composite=c,this.collision=f,this.detector=m,this.pair=D,this.pairs=B,this.query=X,this.resolver=K,this.constraint=v,this.bodies=h,this.composites=d,this.axes=p,this.bounds=n,this.svg=tt,this.vector=Y,this.vertices=Z,this.verts=Z,this._tempVec2=Y.create(),C(this.config,"plugins.collisionevents",!0)&&this.enableCollisionEventsPlugin(),C(this.config,"plugins.attractors",!1)&&this.enableAttractorPlugin(),C(this.config,"plugins.wrap",!1)&&this.enableWrapPlugin(),K._restingThresh=C(this.config,"restingThresh",4),K._restingThreshTangent=C(this.config,"restingThreshTangent",6),K._positionDampen=C(this.config,"positionDampen",.9),K._positionWarming=C(this.config,"positionWarming",.8),K._frictionNormalMultiplier=C(this.config,"frictionNormalMultiplier",5),_.sys.events.once(Q.BOOT,this.boot,this),_.sys.events.on(Q.START,this.start,this)},boot:function(){this.world=new U(this.scene,this.config),this.add=new M(this.world),this.bodyBounds=new l,this.systems.events.once(Q.DESTROY,this.destroy,this)},start:function(){this.world||(this.world=new U(this.scene,this.config),this.add=new M(this.world));var J=this.systems.events;J.on(Q.UPDATE,this.world.update,this.world),J.on(Q.POST_UPDATE,this.world.postUpdate,this.world),J.once(Q.SHUTDOWN,this.shutdown,this)},getConfig:function(){var J=this.systems.game.config.physics,_=this.systems.settings.physics,q=I(w(_,"matter",{}),w(J,"matter",{}));return q},enableAttractorPlugin:function(){return G.register(A),G.use(b,A),this},enableWrapPlugin:function(){return G.register(O),G.use(b,O),this},enableCollisionEventsPlugin:function(){return G.register(P),G.use(b,P),this},pause:function(){return this.world.pause()},resume:function(){return this.world.resume()},set60Hz:function(){return this.world.getDelta=this.world.update60Hz,this.world.autoUpdate=!0,this},set30Hz:function(){return this.world.getDelta=this.world.update30Hz,this.world.autoUpdate=!0,this},step:function(J,_){this.world.step(J,_)},containsPoint:function(J,_,q){J=this.getMatterBodies(J);var at=Y.create(_,q),ot=X.point(J,at);return ot.length>0},intersectPoint:function(J,_,q){q=this.getMatterBodies(q);var at=Y.create(J,_),ot=[],rt=X.point(q,at);return rt.forEach(function(gt){ot.indexOf(gt)===-1&&ot.push(gt)}),ot},intersectRect:function(J,_,q,at,ot,rt){ot===void 0&&(ot=!1),rt=this.getMatterBodies(rt);var gt={min:{x:J,y:_},max:{x:J+q,y:_+at}},yt=[],Et=X.region(rt,gt,ot);return Et.forEach(function(At){yt.indexOf(At)===-1&&yt.push(At)}),yt},intersectRay:function(J,_,q,at,ot,rt){ot===void 0&&(ot=1),rt=this.getMatterBodies(rt);for(var gt=[],yt=X.ray(rt,Y.create(J,_),Y.create(q,at),ot),Et=0;Et{/** + */var r=e(60461),p=e(66615),h=e(66280),a=e(22562),l=e(68174),n=e(15647),u=e(83419),f=e(52284),o=e(53402),c=e(69351),d=e(74116),v=e(48140),m=e(81388),S=e(20339),M=e(28137),w=e(95540),C=e(35154),A=e(18210),P=e(40178),b=e(6790),O=e(74507),I=e(46975),D=e(4506),B=e(99561),G=e(73832),z=e(37277),X=e(73296),j=e(66272),Q=e(44594),tt=e(74058),Y=e(31725),Z=e(41598),U=e(68243);o.setDecomp(e(55973));var H=new u({initialize:function(_){this.scene=_,this.systems=_.sys,this.config=this.getConfig(),this.world,this.add,this.bodyBounds,this.body=a,this.composite=c,this.collision=f,this.detector=m,this.pair=D,this.pairs=B,this.query=X,this.resolver=j,this.constraint=v,this.bodies=h,this.composites=d,this.axes=p,this.bounds=n,this.svg=tt,this.vector=Y,this.vertices=Z,this.verts=Z,this._tempVec2=Y.create(),C(this.config,"plugins.collisionevents",!0)&&this.enableCollisionEventsPlugin(),C(this.config,"plugins.attractors",!1)&&this.enableAttractorPlugin(),C(this.config,"plugins.wrap",!1)&&this.enableWrapPlugin(),j._restingThresh=C(this.config,"restingThresh",4),j._restingThreshTangent=C(this.config,"restingThreshTangent",6),j._positionDampen=C(this.config,"positionDampen",.9),j._positionWarming=C(this.config,"positionWarming",.8),j._frictionNormalMultiplier=C(this.config,"frictionNormalMultiplier",5),_.sys.events.once(Q.BOOT,this.boot,this),_.sys.events.on(Q.START,this.start,this)},boot:function(){this.world=new U(this.scene,this.config),this.add=new M(this.world),this.bodyBounds=new l,this.systems.events.once(Q.DESTROY,this.destroy,this)},start:function(){this.world||(this.world=new U(this.scene,this.config),this.add=new M(this.world));var J=this.systems.events;J.on(Q.UPDATE,this.world.update,this.world),J.on(Q.POST_UPDATE,this.world.postUpdate,this.world),J.once(Q.SHUTDOWN,this.shutdown,this)},getConfig:function(){var J=this.systems.game.config.physics,_=this.systems.settings.physics,q=I(w(_,"matter",{}),w(J,"matter",{}));return q},enableAttractorPlugin:function(){return G.register(A),G.use(b,A),this},enableWrapPlugin:function(){return G.register(O),G.use(b,O),this},enableCollisionEventsPlugin:function(){return G.register(P),G.use(b,P),this},pause:function(){return this.world.pause()},resume:function(){return this.world.resume()},set60Hz:function(){return this.world.getDelta=this.world.update60Hz,this.world.autoUpdate=!0,this},set30Hz:function(){return this.world.getDelta=this.world.update30Hz,this.world.autoUpdate=!0,this},step:function(J,_){this.world.step(J,_)},containsPoint:function(J,_,q){J=this.getMatterBodies(J);var at=Y.create(_,q),ot=X.point(J,at);return ot.length>0},intersectPoint:function(J,_,q){q=this.getMatterBodies(q);var at=Y.create(J,_),ot=[],rt=X.point(q,at);return rt.forEach(function(gt){ot.indexOf(gt)===-1&&ot.push(gt)}),ot},intersectRect:function(J,_,q,at,ot,rt){ot===void 0&&(ot=!1),rt=this.getMatterBodies(rt);var gt={min:{x:J,y:_},max:{x:J+q,y:_+at}},yt=[],Et=X.region(rt,gt,ot);return Et.forEach(function(At){yt.indexOf(At)===-1&&yt.push(At)}),yt},intersectRay:function(J,_,q,at,ot,rt){ot===void 0&&(ot=1),rt=this.getMatterBodies(rt);for(var gt=[],yt=X.ray(rt,Y.create(J,_),Y.create(q,at),ot),Et=0;Et{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -4449,7 +4449,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(66280),p=e(22562),h=e(83419),a=e(31884),l=e(62644),n=e(50792),u=e(95540),f=e(97022),o=e(41598),c=new h({Extends:n,Mixins:[a.Bounce,a.Collision,a.Friction,a.Gravity,a.Mass,a.Sensor,a.Sleep,a.Static],initialize:function(v,m,S){n.call(this),this.tile=m,this.world=v,m.physics.matterBody&&m.physics.matterBody.destroy(),m.physics.matterBody=this;var M=u(S,"body",null),w=u(S,"addToWorld",!0);if(M)this.setBody(M,w);else{var C=m.getCollisionGroup(),A=u(C,"objects",[]);A.length>0?this.setFromTileCollision(S):this.setFromTileRectangle(S)}if(m.flipX||m.flipY){var P={x:m.getCenterX(),y:m.getCenterY()},b=m.flipX?-1:1,O=m.flipY?-1:1;p.scale(M,b,O,P)}},setFromTileRectangle:function(d){d===void 0&&(d={}),f(d,"isStatic")||(d.isStatic=!0),f(d,"addToWorld")||(d.addToWorld=!0);var v=this.tile.getBounds(),m=v.x+v.width/2,S=v.y+v.height/2,M=r.rectangle(m,S,v.width,v.height,d);return this.setBody(M,d.addToWorld),this},setFromTileCollision:function(d){d===void 0&&(d={}),f(d,"isStatic")||(d.isStatic=!0),f(d,"addToWorld")||(d.addToWorld=!0);for(var v=this.tile.tilemapLayer.scaleX,m=this.tile.tilemapLayer.scaleY,S=this.tile.getLeft(),M=this.tile.getTop(),w=this.tile.getCollisionGroup(),C=u(w,"objects",[]),A=[],P=0;P1){var tt=l(d);tt.parts=A,this.setBody(p.create(tt),tt.addToWorld)}return this},setBody:function(d,v){return v===void 0&&(v=!0),this.body&&this.removeBody(),this.body=d,this.body.gameObject=this,v&&this.world.add(this.body),this},removeBody:function(){return this.body&&(this.world.remove(this.body),this.body.gameObject=void 0,this.body=void 0),this},destroy:function(){this.removeBody(),this.tile.physics.matterBody=void 0,this.removeAllListeners()}});s.exports=c},19496:(s,y,e)=>{/** + */var r=e(66280),p=e(22562),h=e(83419),a=e(31884),l=e(62644),n=e(50792),u=e(95540),f=e(97022),o=e(41598),c=new h({Extends:n,Mixins:[a.Bounce,a.Collision,a.Friction,a.Gravity,a.Mass,a.Sensor,a.Sleep,a.Static],initialize:function(v,m,S){n.call(this),this.tile=m,this.world=v,m.physics.matterBody&&m.physics.matterBody.destroy(),m.physics.matterBody=this;var M=u(S,"body",null),w=u(S,"addToWorld",!0);if(M)this.setBody(M,w);else{var C=m.getCollisionGroup(),A=u(C,"objects",[]);A.length>0?this.setFromTileCollision(S):this.setFromTileRectangle(S)}if(m.flipX||m.flipY){var P={x:m.getCenterX(),y:m.getCenterY()},b=m.flipX?-1:1,O=m.flipY?-1:1;p.scale(M,b,O,P)}},setFromTileRectangle:function(d){d===void 0&&(d={}),f(d,"isStatic")||(d.isStatic=!0),f(d,"addToWorld")||(d.addToWorld=!0);var v=this.tile.getBounds(),m=v.x+v.width/2,S=v.y+v.height/2,M=r.rectangle(m,S,v.width,v.height,d);return this.setBody(M,d.addToWorld),this},setFromTileCollision:function(d){d===void 0&&(d={}),f(d,"isStatic")||(d.isStatic=!0),f(d,"addToWorld")||(d.addToWorld=!0);for(var v=this.tile.tilemapLayer.scaleX,m=this.tile.tilemapLayer.scaleY,S=this.tile.getLeft(),M=this.tile.getTop(),w=this.tile.getCollisionGroup(),C=u(w,"objects",[]),A=[],P=0;P1){var tt=l(d);tt.parts=A,this.setBody(p.create(tt),tt.addToWorld)}return this},setBody:function(d,v){return v===void 0&&(v=!0),this.body&&this.removeBody(),this.body=d,this.body.gameObject=this,v&&this.world.add(this.body),this},removeBody:function(){return this.body&&(this.world.remove(this.body),this.body.gameObject=void 0,this.body=void 0),this},destroy:function(){this.removeBody(),this.tile.physics.matterBody=void 0,this.removeAllListeners()}});s.exports=c},19496:(s,y,e)=>{/** * @author Joachim Grill * @author Richard Davey * @copyright 2018 CodeAndWeb GmbH @@ -4467,7 +4467,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(66280),p=e(22562),h=e(83419),a=e(53402),l=e(69351),n=e(48413),u=e(50792),f=e(1121),o=e(95540),c=e(35154),d=e(22562),v=e(35810),m=e(73834),S=e(4372),M=e(31725),w=new h({Extends:u,initialize:function(A,P){u.call(this),this.scene=A,this.engine=n.create(P),this.localWorld=this.engine.world;var b=c(P,"gravity",null);b?this.setGravity(b.x,b.y,b.scale):b===!1&&this.setGravity(0,0,0),this.walls={left:null,right:null,top:null,bottom:null},this.enabled=c(P,"enabled",!0),this.getDelta=c(P,"getDelta",this.update60Hz);var O=o(P,"runner",{}),I=o(O,"fps",!1),D=o(O,"fps",60),B=o(O,"delta",1e3/D),G=o(O,"deltaMin",1e3/D),z=o(O,"deltaMax",1e3/(D*.5));I||(D=1e3/B),this.runner={fps:D,deltaSampleSize:o(O,"deltaSampleSize",60),counterTimestamp:0,frameCounter:0,deltaHistory:[],timePrev:null,timeScalePrev:1,frameRequestId:null,isFixed:o(O,"isFixed",!1),delta:B,deltaMin:G,deltaMax:z},this.autoUpdate=c(P,"autoUpdate",!0);var X=c(P,"debug",!1);if(this.drawDebug=typeof X=="object"?!0:X,this.debugGraphic,this.debugConfig={showAxes:o(X,"showAxes",!1),showAngleIndicator:o(X,"showAngleIndicator",!1),angleColor:o(X,"angleColor",15208787),showBroadphase:o(X,"showBroadphase",!1),broadphaseColor:o(X,"broadphaseColor",16757760),showBounds:o(X,"showBounds",!1),boundsColor:o(X,"boundsColor",16777215),showVelocity:o(X,"showVelocity",!1),velocityColor:o(X,"velocityColor",44783),showCollisions:o(X,"showCollisions",!1),collisionColor:o(X,"collisionColor",16094476),showSeparations:o(X,"showSeparations",!1),separationColor:o(X,"separationColor",16753920),showBody:o(X,"showBody",!0),showStaticBody:o(X,"showStaticBody",!0),showInternalEdges:o(X,"showInternalEdges",!1),renderFill:o(X,"renderFill",!1),renderLine:o(X,"renderLine",!0),fillColor:o(X,"fillColor",1075465),fillOpacity:o(X,"fillOpacity",1),lineColor:o(X,"lineColor",2678297),lineOpacity:o(X,"lineOpacity",1),lineThickness:o(X,"lineThickness",1),staticFillColor:o(X,"staticFillColor",857979),staticLineColor:o(X,"staticLineColor",1255396),showSleeping:o(X,"showSleeping",!1),staticBodySleepOpacity:o(X,"staticBodySleepOpacity",.7),sleepFillColor:o(X,"sleepFillColor",4605510),sleepLineColor:o(X,"sleepLineColor",10066585),showSensors:o(X,"showSensors",!0),sensorFillColor:o(X,"sensorFillColor",857979),sensorLineColor:o(X,"sensorLineColor",1255396),showPositions:o(X,"showPositions",!0),positionSize:o(X,"positionSize",4),positionColor:o(X,"positionColor",14697178),showJoint:o(X,"showJoint",!0),jointColor:o(X,"jointColor",14737474),jointLineOpacity:o(X,"jointLineOpacity",1),jointLineThickness:o(X,"jointLineThickness",2),pinSize:o(X,"pinSize",4),pinColor:o(X,"pinColor",4382944),springColor:o(X,"springColor",14697184),anchorColor:o(X,"anchorColor",15724527),anchorSize:o(X,"anchorSize",4),showConvexHulls:o(X,"showConvexHulls",!1),hullColor:o(X,"hullColor",14091216)},this.drawDebug&&this.createDebugGraphic(),this.setEventsProxy(),o(P,"setBounds",!1)){var K=P.setBounds;if(typeof K=="boolean")this.setBounds();else{var Q=o(K,"x",0),tt=o(K,"y",0),Y=o(K,"width",A.sys.scale.width),Z=o(K,"height",A.sys.scale.height),U=o(K,"thickness",64),H=o(K,"left",!0),J=o(K,"right",!0),_=o(K,"top",!0),q=o(K,"bottom",!0);this.setBounds(Q,tt,Y,Z,U,H,J,_,q)}}},setCompositeRenderStyle:function(C){var A=C.bodies,P=C.constraints,b=C.composites,O,I,D;for(O=0;O0&&(I=O[0].bodyA,D=O[0].bodyB),C.emit(f.COLLISION_START,b,I,D)}),v.on(A,"collisionActive",function(b){var O=b.pairs,I,D;O.length>0&&(I=O[0].bodyA,D=O[0].bodyB),C.emit(f.COLLISION_ACTIVE,b,I,D)}),v.on(A,"collisionEnd",function(b){var O=b.pairs,I,D;O.length>0&&(I=O[0].bodyA,D=O[0].bodyB),C.emit(f.COLLISION_END,b,I,D)})},setBounds:function(C,A,P,b,O,I,D,B,G){return C===void 0&&(C=0),A===void 0&&(A=0),P===void 0&&(P=this.scene.sys.scale.width),b===void 0&&(b=this.scene.sys.scale.height),O===void 0&&(O=64),I===void 0&&(I=!0),D===void 0&&(D=!0),B===void 0&&(B=!0),G===void 0&&(G=!0),this.updateWall(I,"left",C-O,A-O,O,b+O*2),this.updateWall(D,"right",C+P,A-O,O,b+O*2),this.updateWall(B,"top",C,A-O,P,O),this.updateWall(G,"bottom",C,A+b,P,O),this},updateWall:function(C,A,P,b,O,I){var D=this.walls[A];C?(D&&S.remove(this.localWorld,D),P+=O/2,b+=I/2,this.walls[A]=this.create(P,b,O,I,{isStatic:!0,friction:0,frictionStatic:0})):(D&&S.remove(this.localWorld,D),this.walls[A]=null)},createDebugGraphic:function(){var C=this.scene.sys.add.graphics({x:0,y:0});return C.setDepth(Number.MAX_VALUE),this.debugGraphic=C,this.drawDebug=!0,C},disableGravity:function(){return this.localWorld.gravity.x=0,this.localWorld.gravity.y=0,this.localWorld.gravity.scale=0,this},setGravity:function(C,A,P){return C===void 0&&(C=0),A===void 0&&(A=1),P===void 0&&(P=.001),this.localWorld.gravity.x=C,this.localWorld.gravity.y=A,this.localWorld.gravity.scale=P,this},create:function(C,A,P,b,O){var I=r.rectangle(C,A,P,b,O);return S.add(this.localWorld,I),I},add:function(C){return S.add(this.localWorld,C),this},remove:function(C,A){Array.isArray(C)||(C=[C]);for(var P=0;Pb.deltaMax?b.deltaMax:A,b.delta=A),b.timeScalePrev=O.timeScale,b.frameCounter+=1,C-b.counterTimestamp>=1e3&&(b.fps=b.frameCounter*((C-b.counterTimestamp)/1e3),b.counterTimestamp=C,b.frameCounter=0),n.update(P,A)}},step:function(C){n.update(this.engine,C)},update60Hz:function(){return 1e3/60},update30Hz:function(){return 1e3/30},has:function(C){var A=C.hasOwnProperty("body")?C.body:C;return l.get(this.localWorld,A.id,A.type)!==null},getAllBodies:function(){return l.allBodies(this.localWorld)},getAllConstraints:function(){return l.allConstraints(this.localWorld)},getAllComposites:function(){return l.allComposites(this.localWorld)},postUpdate:function(){if(this.drawDebug){var C=this.debugConfig,A=this.engine,P=this.debugGraphic,b=l.allBodies(this.localWorld);this.debugGraphic.clear(),C.showBroadphase&&A.broadphase.controller&&this.renderGrid(A.broadphase,P,C.broadphaseColor,.5),C.showBounds&&this.renderBodyBounds(b,P,C.boundsColor,.5),(C.showBody||C.showStaticBody)&&this.renderBodies(b),C.showJoint&&this.renderJoints(),(C.showAxes||C.showAngleIndicator)&&this.renderBodyAxes(b,P,C.showAxes,C.angleColor,.5),C.showVelocity&&this.renderBodyVelocity(b,P,C.velocityColor,1,2),C.showSeparations&&this.renderSeparations(A.pairs.list,P,C.separationColor),C.showCollisions&&this.renderCollisions(A.pairs.list,P,C.collisionColor)}},renderGrid:function(C,A,P,b){A.lineStyle(1,P,b);for(var O=a.keys(C.buckets),I=0;I0){var X=z[0].vertex.x,K=z[0].vertex.y;z.length===2&&(X=(z[0].vertex.x+z[1].vertex.x)/2,K=(z[0].vertex.y+z[1].vertex.y)/2),G.bodyB===G.supports[0].body||G.bodyA.isStatic?A.lineBetween(X-G.normal.x*8,K-G.normal.y*8,X,K):A.lineBetween(X+G.normal.x*8,K+G.normal.y*8,X,K)}}return this},renderBodyBounds:function(C,A,P,b){A.lineStyle(1,P,b);for(var O=0;O1?1:0;G1?1:0;z1?1:0;z1&&this.renderConvexHull(Z,A,tt,J)}}},renderBody:function(C,A,P,b,O,I,D,B){b===void 0&&(b=null),O===void 0&&(O=null),I===void 0&&(I=1),D===void 0&&(D=null),B===void 0&&(B=null);for(var G=this.debugConfig,z=G.sensorFillColor,X=G.sensorLineColor,K=C.parts,Q=K.length,tt=Q>1?1:0;tt1){var D=C.vertices;A.lineStyle(b,P),A.beginPath(),A.moveTo(D[0].x,D[0].y);for(var B=1;B0&&(A.fillStyle(D),A.fillCircle(K.x,K.y,B),A.fillCircle(Q.x,Q.y,B)),this},resetCollisionIDs:function(){return p._nextCollidingGroupId=1,p._nextNonCollidingGroupId=-1,p._nextCategory=1,this},shutdown:function(){v.off(this.engine),this.removeAllListeners(),S.clear(this.localWorld,!1),n.clear(this.engine),this.drawDebug&&this.debugGraphic.destroy()},destroy:function(){this.shutdown()}});s.exports=w},70410:s=>{/** + */var r=e(66280),p=e(22562),h=e(83419),a=e(53402),l=e(69351),n=e(48413),u=e(50792),f=e(1121),o=e(95540),c=e(35154),d=e(22562),v=e(35810),m=e(73834),S=e(4372),M=e(31725),w=new h({Extends:u,initialize:function(A,P){u.call(this),this.scene=A,this.engine=n.create(P),this.localWorld=this.engine.world;var b=c(P,"gravity",null);b?this.setGravity(b.x,b.y,b.scale):b===!1&&this.setGravity(0,0,0),this.walls={left:null,right:null,top:null,bottom:null},this.enabled=c(P,"enabled",!0),this.getDelta=c(P,"getDelta",this.update60Hz);var O=o(P,"runner",{}),I=o(O,"fps",!1),D=o(O,"fps",60),B=o(O,"delta",1e3/D),G=o(O,"deltaMin",1e3/D),z=o(O,"deltaMax",1e3/(D*.5));I||(D=1e3/B),this.runner={fps:D,deltaSampleSize:o(O,"deltaSampleSize",60),counterTimestamp:0,frameCounter:0,deltaHistory:[],timePrev:null,timeScalePrev:1,frameRequestId:null,isFixed:o(O,"isFixed",!1),delta:B,deltaMin:G,deltaMax:z},this.autoUpdate=c(P,"autoUpdate",!0);var X=c(P,"debug",!1);if(this.drawDebug=typeof X=="object"?!0:X,this.debugGraphic,this.debugConfig={showAxes:o(X,"showAxes",!1),showAngleIndicator:o(X,"showAngleIndicator",!1),angleColor:o(X,"angleColor",15208787),showBroadphase:o(X,"showBroadphase",!1),broadphaseColor:o(X,"broadphaseColor",16757760),showBounds:o(X,"showBounds",!1),boundsColor:o(X,"boundsColor",16777215),showVelocity:o(X,"showVelocity",!1),velocityColor:o(X,"velocityColor",44783),showCollisions:o(X,"showCollisions",!1),collisionColor:o(X,"collisionColor",16094476),showSeparations:o(X,"showSeparations",!1),separationColor:o(X,"separationColor",16753920),showBody:o(X,"showBody",!0),showStaticBody:o(X,"showStaticBody",!0),showInternalEdges:o(X,"showInternalEdges",!1),renderFill:o(X,"renderFill",!1),renderLine:o(X,"renderLine",!0),fillColor:o(X,"fillColor",1075465),fillOpacity:o(X,"fillOpacity",1),lineColor:o(X,"lineColor",2678297),lineOpacity:o(X,"lineOpacity",1),lineThickness:o(X,"lineThickness",1),staticFillColor:o(X,"staticFillColor",857979),staticLineColor:o(X,"staticLineColor",1255396),showSleeping:o(X,"showSleeping",!1),staticBodySleepOpacity:o(X,"staticBodySleepOpacity",.7),sleepFillColor:o(X,"sleepFillColor",4605510),sleepLineColor:o(X,"sleepLineColor",10066585),showSensors:o(X,"showSensors",!0),sensorFillColor:o(X,"sensorFillColor",857979),sensorLineColor:o(X,"sensorLineColor",1255396),showPositions:o(X,"showPositions",!0),positionSize:o(X,"positionSize",4),positionColor:o(X,"positionColor",14697178),showJoint:o(X,"showJoint",!0),jointColor:o(X,"jointColor",14737474),jointLineOpacity:o(X,"jointLineOpacity",1),jointLineThickness:o(X,"jointLineThickness",2),pinSize:o(X,"pinSize",4),pinColor:o(X,"pinColor",4382944),springColor:o(X,"springColor",14697184),anchorColor:o(X,"anchorColor",15724527),anchorSize:o(X,"anchorSize",4),showConvexHulls:o(X,"showConvexHulls",!1),hullColor:o(X,"hullColor",14091216)},this.drawDebug&&this.createDebugGraphic(),this.setEventsProxy(),o(P,"setBounds",!1)){var j=P.setBounds;if(typeof j=="boolean")this.setBounds();else{var Q=o(j,"x",0),tt=o(j,"y",0),Y=o(j,"width",A.sys.scale.width),Z=o(j,"height",A.sys.scale.height),U=o(j,"thickness",64),H=o(j,"left",!0),J=o(j,"right",!0),_=o(j,"top",!0),q=o(j,"bottom",!0);this.setBounds(Q,tt,Y,Z,U,H,J,_,q)}}},setCompositeRenderStyle:function(C){var A=C.bodies,P=C.constraints,b=C.composites,O,I,D;for(O=0;O0&&(I=O[0].bodyA,D=O[0].bodyB),C.emit(f.COLLISION_START,b,I,D)}),v.on(A,"collisionActive",function(b){var O=b.pairs,I,D;O.length>0&&(I=O[0].bodyA,D=O[0].bodyB),C.emit(f.COLLISION_ACTIVE,b,I,D)}),v.on(A,"collisionEnd",function(b){var O=b.pairs,I,D;O.length>0&&(I=O[0].bodyA,D=O[0].bodyB),C.emit(f.COLLISION_END,b,I,D)})},setBounds:function(C,A,P,b,O,I,D,B,G){return C===void 0&&(C=0),A===void 0&&(A=0),P===void 0&&(P=this.scene.sys.scale.width),b===void 0&&(b=this.scene.sys.scale.height),O===void 0&&(O=64),I===void 0&&(I=!0),D===void 0&&(D=!0),B===void 0&&(B=!0),G===void 0&&(G=!0),this.updateWall(I,"left",C-O,A-O,O,b+O*2),this.updateWall(D,"right",C+P,A-O,O,b+O*2),this.updateWall(B,"top",C,A-O,P,O),this.updateWall(G,"bottom",C,A+b,P,O),this},updateWall:function(C,A,P,b,O,I){var D=this.walls[A];C?(D&&S.remove(this.localWorld,D),P+=O/2,b+=I/2,this.walls[A]=this.create(P,b,O,I,{isStatic:!0,friction:0,frictionStatic:0})):(D&&S.remove(this.localWorld,D),this.walls[A]=null)},createDebugGraphic:function(){var C=this.scene.sys.add.graphics({x:0,y:0});return C.setDepth(Number.MAX_VALUE),this.debugGraphic=C,this.drawDebug=!0,C},disableGravity:function(){return this.localWorld.gravity.x=0,this.localWorld.gravity.y=0,this.localWorld.gravity.scale=0,this},setGravity:function(C,A,P){return C===void 0&&(C=0),A===void 0&&(A=1),P===void 0&&(P=.001),this.localWorld.gravity.x=C,this.localWorld.gravity.y=A,this.localWorld.gravity.scale=P,this},create:function(C,A,P,b,O){var I=r.rectangle(C,A,P,b,O);return S.add(this.localWorld,I),I},add:function(C){return S.add(this.localWorld,C),this},remove:function(C,A){Array.isArray(C)||(C=[C]);for(var P=0;Pb.deltaMax?b.deltaMax:A,b.delta=A),b.timeScalePrev=O.timeScale,b.frameCounter+=1,C-b.counterTimestamp>=1e3&&(b.fps=b.frameCounter*((C-b.counterTimestamp)/1e3),b.counterTimestamp=C,b.frameCounter=0),n.update(P,A)}},step:function(C){n.update(this.engine,C)},update60Hz:function(){return 1e3/60},update30Hz:function(){return 1e3/30},has:function(C){var A=C.hasOwnProperty("body")?C.body:C;return l.get(this.localWorld,A.id,A.type)!==null},getAllBodies:function(){return l.allBodies(this.localWorld)},getAllConstraints:function(){return l.allConstraints(this.localWorld)},getAllComposites:function(){return l.allComposites(this.localWorld)},postUpdate:function(){if(this.drawDebug){var C=this.debugConfig,A=this.engine,P=this.debugGraphic,b=l.allBodies(this.localWorld);this.debugGraphic.clear(),C.showBroadphase&&A.broadphase.controller&&this.renderGrid(A.broadphase,P,C.broadphaseColor,.5),C.showBounds&&this.renderBodyBounds(b,P,C.boundsColor,.5),(C.showBody||C.showStaticBody)&&this.renderBodies(b),C.showJoint&&this.renderJoints(),(C.showAxes||C.showAngleIndicator)&&this.renderBodyAxes(b,P,C.showAxes,C.angleColor,.5),C.showVelocity&&this.renderBodyVelocity(b,P,C.velocityColor,1,2),C.showSeparations&&this.renderSeparations(A.pairs.list,P,C.separationColor),C.showCollisions&&this.renderCollisions(A.pairs.list,P,C.collisionColor)}},renderGrid:function(C,A,P,b){A.lineStyle(1,P,b);for(var O=a.keys(C.buckets),I=0;I0){var X=z[0].vertex.x,j=z[0].vertex.y;z.length===2&&(X=(z[0].vertex.x+z[1].vertex.x)/2,j=(z[0].vertex.y+z[1].vertex.y)/2),G.bodyB===G.supports[0].body||G.bodyA.isStatic?A.lineBetween(X-G.normal.x*8,j-G.normal.y*8,X,j):A.lineBetween(X+G.normal.x*8,j+G.normal.y*8,X,j)}}return this},renderBodyBounds:function(C,A,P,b){A.lineStyle(1,P,b);for(var O=0;O1?1:0;G1?1:0;z1?1:0;z1&&this.renderConvexHull(Z,A,tt,J)}}},renderBody:function(C,A,P,b,O,I,D,B){b===void 0&&(b=null),O===void 0&&(O=null),I===void 0&&(I=1),D===void 0&&(D=null),B===void 0&&(B=null);for(var G=this.debugConfig,z=G.sensorFillColor,X=G.sensorLineColor,j=C.parts,Q=j.length,tt=Q>1?1:0;tt1){var D=C.vertices;A.lineStyle(b,P),A.beginPath(),A.moveTo(D[0].x,D[0].y);for(var B=1;B0&&(A.fillStyle(D),A.fillCircle(j.x,j.y,B),A.fillCircle(Q.x,Q.y,B)),this},resetCollisionIDs:function(){return p._nextCollidingGroupId=1,p._nextNonCollidingGroupId=-1,p._nextCategory=1,this},shutdown:function(){v.off(this.engine),this.removeAllListeners(),S.clear(this.localWorld,!1),n.clear(this.engine),this.drawDebug&&this.debugGraphic.destroy()},destroy:function(){this.shutdown()}});s.exports=w},70410:s=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -4591,14 +4591,14 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */s.exports={BodyBounds:e(68174),Components:e(31884),Events:e(1121),Factory:e(28137),MatterGameObject:e(75803),Image:e(23181),Matter:e(19933),MatterPhysics:e(42045),PolyDecomp:e(55973),Sprite:e(34803),TileBody:e(73834),PhysicsEditorParser:e(19496),PhysicsJSONParser:e(85791),PointerConstraint:e(98713),World:e(68243)}},22562:(s,y,e)=>{var r={};s.exports=r;var p=e(41598),h=e(31725),a=e(53614),l=e(53402),n=e(15647),u=e(66615);(function(){r._timeCorrection=!0,r._inertiaScale=4,r._nextCollidingGroupId=1,r._nextNonCollidingGroupId=-1,r._nextCategory=1,r._baseDelta=16.666666666666668,r.create=function(o){var c={id:l.nextId(),type:"body",label:"Body",parts:[],plugin:{},angle:0,vertices:null,position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inverseMass:0,inertia:0,deltaTime:16.666666666666668,inverseInertia:0,_original:null,render:{visible:!0,opacity:1,sprite:{xOffset:0,yOffset:0},fillColor:null,fillOpacity:null,lineColor:null,lineOpacity:null,lineThickness:null},gameObject:null,scale:{x:1,y:1},centerOfMass:{x:0,y:0},centerOffset:{x:0,y:0},gravityScale:{x:1,y:1},ignoreGravity:!1,ignorePointer:!1,onCollideCallback:null,onCollideEndCallback:null,onCollideActiveCallback:null,onCollideWith:{}};!o.hasOwnProperty("position")&&o.hasOwnProperty("vertices")?o.position=p.centre(o.vertices):o.hasOwnProperty("vertices")||(c.vertices=p.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"));var d=l.extend(c,o);return f(d,o),d.setOnCollideWith=function(v,m){return m?this.onCollideWith[v.id]=m:delete this.onCollideWith[v.id],this},d},r.nextGroup=function(o){return o?r._nextNonCollidingGroupId--:r._nextCollidingGroupId++},r.nextCategory=function(){return r._nextCategory=r._nextCategory<<1,r._nextCategory};var f=function(o,c){if(c=c||{},r.set(o,{bounds:o.bounds||n.create(o.vertices),positionPrev:o.positionPrev||h.clone(o.position),anglePrev:o.anglePrev||o.angle,vertices:o.vertices,parts:o.parts||[o],isStatic:o.isStatic,isSleeping:o.isSleeping,parent:o.parent||o}),p.rotate(o.vertices,o.angle,o.position),u.rotate(o.axes,o.angle),n.update(o.bounds,o.vertices,o.velocity),r.set(o,{axes:c.axes||o.axes,area:c.area||o.area,mass:c.mass||o.mass,inertia:c.inertia||o.inertia}),o.parts.length===1){var d=o.bounds,v=o.centerOfMass,m=o.centerOffset,S=d.max.x-d.min.x,M=d.max.y-d.min.y;v.x=-(d.min.x-o.position.x)/S,v.y=-(d.min.y-o.position.y)/M,m.x=S*v.x,m.y=M*v.y}};r.set=function(o,c,d){var v;typeof c=="string"&&(v=c,c={},c[v]=d);for(v in c)if(Object.prototype.hasOwnProperty.call(c,v))switch(d=c[v],v){case"isStatic":r.setStatic(o,d);break;case"isSleeping":a.set(o,d);break;case"mass":r.setMass(o,d);break;case"density":r.setDensity(o,d);break;case"inertia":r.setInertia(o,d);break;case"vertices":r.setVertices(o,d);break;case"position":r.setPosition(o,d);break;case"angle":r.setAngle(o,d);break;case"velocity":r.setVelocity(o,d);break;case"angularVelocity":r.setAngularVelocity(o,d);break;case"speed":r.setSpeed(o,d);break;case"angularSpeed":r.setAngularSpeed(o,d);break;case"parts":r.setParts(o,d);break;case"centre":r.setCentre(o,d);break;default:o[v]=d}},r.setStatic=function(o,c){for(var d=0;d0&&h.rotateAbout(S.position,v,o.position,S.position)}},r.setVelocity=function(o,c){var d=o.deltaTime/r._baseDelta;o.positionPrev.x=o.position.x-c.x*d,o.positionPrev.y=o.position.y-c.y*d,o.velocity.x=(o.position.x-o.positionPrev.x)/d,o.velocity.y=(o.position.y-o.positionPrev.y)/d,o.speed=h.magnitude(o.velocity)},r.getVelocity=function(o){var c=r._baseDelta/o.deltaTime;return{x:(o.position.x-o.positionPrev.x)*c,y:(o.position.y-o.positionPrev.y)*c}},r.getSpeed=function(o){return h.magnitude(r.getVelocity(o))},r.setSpeed=function(o,c){r.setVelocity(o,h.mult(h.normalise(r.getVelocity(o)),c))},r.setAngularVelocity=function(o,c){var d=o.deltaTime/r._baseDelta;o.anglePrev=o.angle-c*d,o.angularVelocity=(o.angle-o.anglePrev)/d,o.angularSpeed=Math.abs(o.angularVelocity)},r.getAngularVelocity=function(o){return(o.angle-o.anglePrev)*r._baseDelta/o.deltaTime},r.getAngularSpeed=function(o){return Math.abs(r.getAngularVelocity(o))},r.setAngularSpeed=function(o,c){r.setAngularVelocity(o,l.sign(r.getAngularVelocity(o))*c)},r.translate=function(o,c,d){r.setPosition(o,h.add(o.position,c),d)},r.rotate=function(o,c,d,v){if(!d)r.setAngle(o,o.angle+c,v);else{var m=Math.cos(c),S=Math.sin(c),M=o.position.x-d.x,w=o.position.y-d.y;r.setPosition(o,{x:d.x+(M*m-w*S),y:d.y+(M*S+w*m)},v),r.setAngle(o,o.angle+c,v)}},r.scale=function(o,c,d,v){var m=0,S=0;v=v||o.position;for(var M=o.inertia===1/0,w=0;w0&&(m+=C.area,S+=C.inertia),C.position.x=v.x+(C.position.x-v.x)*c,C.position.y=v.y+(C.position.y-v.y)*d,n.update(C.bounds,C.vertices,o.velocity)}o.parts.length>1&&(o.area=m,o.isStatic||(r.setMass(o,o.density*m),r.setInertia(o,S))),o.circleRadius&&(c===d?o.circleRadius*=c:o.circleRadius=null),M&&r.setInertia(o,1/0)},r.update=function(o,c){c=(typeof c<"u"?c:16.666666666666668)*o.timeScale;var d=c*c,v=r._timeCorrection?c/(o.deltaTime||c):1,m=1-o.frictionAir*(c/l._baseDelta),S=(o.position.x-o.positionPrev.x)*v,M=(o.position.y-o.positionPrev.y)*v;o.velocity.x=S*m+o.force.x/o.mass*d,o.velocity.y=M*m+o.force.y/o.mass*d,o.positionPrev.x=o.position.x,o.positionPrev.y=o.position.y,o.position.x+=o.velocity.x,o.position.y+=o.velocity.y,o.deltaTime=c,o.angularVelocity=(o.angle-o.anglePrev)*m*v+o.torque/o.inertia*d,o.anglePrev=o.angle,o.angle+=o.angularVelocity,o.speed=h.magnitude(o.velocity),o.angularSpeed=Math.abs(o.angularVelocity);for(var w=0;w0&&(C.position.x+=o.velocity.x,C.position.y+=o.velocity.y),o.angularVelocity!==0&&(p.rotate(C.vertices,o.angularVelocity,o.position),u.rotate(C.axes,o.angularVelocity),w>0&&h.rotateAbout(C.position,o.angularVelocity,o.position,C.position)),n.update(C.bounds,C.vertices,o.velocity)}},r.updateVelocities=function(o){var c=r._baseDelta/o.deltaTime,d=o.velocity;d.x=(o.position.x-o.positionPrev.x)*c,d.y=(o.position.y-o.positionPrev.y)*c,o.speed=Math.sqrt(d.x*d.x+d.y*d.y),o.angularVelocity=(o.angle-o.anglePrev)*c,o.angularSpeed=Math.abs(o.angularVelocity)},r.applyForce=function(o,c,d){var v={x:c.x-o.position.x,y:c.y-o.position.y};o.force.x+=d.x,o.force.y+=d.y,o.torque+=v.x*d.y-v.y*d.x},r._totalProperties=function(o){for(var c={mass:0,area:0,inertia:0,centre:{x:0,y:0}},d=o.parts.length===1?0:1;d{var r={};s.exports=r;var p=e(35810),h=e(53402),a=e(15647),l=e(22562);(function(){r.create=function(n){return h.extend({id:h.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{},cache:{allBodies:null,allConstraints:null,allComposites:null}},n)},r.setModified=function(n,u,f,o){if(p.trigger(n,"compositeModified",n),n.isModified=u,u&&n.cache&&(n.cache.allBodies=null,n.cache.allConstraints=null,n.cache.allComposites=null),f&&n.parent&&r.setModified(n.parent,u,f,o),o)for(var c=0;c{var r={};s.exports=r;var p=e(69351);(function(){r.create=p.create,r.add=p.add,r.remove=p.remove,r.clear=p.clear,r.addComposite=p.addComposite,r.addBody=p.addBody,r.addConstraint=p.addConstraint})()},52284:(s,y,e)=>{var r={};s.exports=r;var p=e(41598),h=e(4506);(function(){var a=[],l={overlap:0,axis:null},n={overlap:0,axis:null};r.create=function(u,f){return{pair:null,collided:!1,bodyA:u,bodyB:f,parentA:u.parent,parentB:f.parent,depth:0,normal:{x:0,y:0},tangent:{x:0,y:0},penetration:{x:0,y:0},supports:[]}},r.collides=function(u,f,o){if(r._overlapAxes(l,u.vertices,f.vertices,u.axes),l.overlap<=0||(r._overlapAxes(n,f.vertices,u.vertices,f.axes),n.overlap<=0))return null;var c=o&&o.table[h.id(u,f)],d;c?d=c.collision:(d=r.create(u,f),d.collided=!0,d.bodyA=u.idY?Y=D:DZ?Z=D:Dd?d=m:m{var y={};s.exports=y,function(){y.create=function(e){return{vertex:e,normalImpulse:0,tangentImpulse:0}}}()},81388:(s,y,e)=>{var r={};s.exports=r;var p=e(53402),h=e(52284);(function(){r.create=function(a){var l={bodies:[],pairs:null};return p.extend(l,a)},r.setBodies=function(a,l){a.bodies=l.slice(0)},r.clear=function(a){a.bodies=[]},r.collisions=function(a){var l=[],n=a.pairs,u=a.bodies,f=u.length,o=r.canCollide,c=h.collides,d,v;for(u.sort(r._compareBoundsX),d=0;dM)break;if(!(wI.max.y)&&!(A&&(O.isStatic||O.isSleeping))&&o(m.collisionFilter,O.collisionFilter)){var D=O.parts.length;if(b&&D===1){var B=c(m,O,n);B&&l.push(B)}else for(var G=P>1?1:0,z=D>1?1:0,X=G;XI.max.x||S.max.xI.max.y)){var B=c(K,tt,n);B&&l.push(B)}}}}}return l},r.canCollide=function(a,l){return a.group===l.group&&a.group!==0?a.group>0:(a.mask&l.category)!==0&&(l.mask&a.category)!==0},r._compareBoundsX=function(a,l){return a.bounds.min.x-l.bounds.min.x}})()},4506:(s,y,e)=>{var r={};s.exports=r;var p=e(43424);(function(){r.create=function(h,a){var l=h.bodyA,n=h.bodyB,u={id:r.id(l,n),bodyA:l,bodyB:n,collision:h,contacts:[],activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:l.isSensor||n.isSensor,timeCreated:a,timeUpdated:a,inverseMass:0,friction:0,frictionStatic:0,restitution:0,slop:0};return r.update(u,h,a),u},r.update=function(h,a,l){var n=h.contacts,u=a.supports,f=h.activeContacts,o=a.parentA,c=a.parentB,d=o.vertices.length;h.isActive=!0,h.timeUpdated=l,h.collision=a,h.separation=a.depth,h.inverseMass=o.inverseMass+c.inverseMass,h.friction=o.frictionc.frictionStatic?o.frictionStatic:c.frictionStatic,h.restitution=o.restitution>c.restitution?o.restitution:c.restitution,h.slop=o.slop>c.slop?o.slop:c.slop,a.pair=h,f.length=0;for(var v=0;v{var r={};s.exports=r;var p=e(4506),h=e(53402);(function(){r.create=function(a){return h.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},a)},r.update=function(a,l,n){var u=a.list,f=u.length,o=a.table,c=l.length,d=a.collisionStart,v=a.collisionEnd,m=a.collisionActive,S,M,w,C;for(d.length=0,v.length=0,m.length=0,C=0;C{var r={};s.exports=r;var p=e(31725),h=e(52284),a=e(15647),l=e(66280),n=e(41598);(function(){r.collides=function(u,f){for(var o=[],c=f.length,d=u.bounds,v=h.collides,m=a.overlaps,S=0;S{var r={};s.exports=r;var p=e(41598),h=e(53402),a=e(15647);(function(){r._restingThresh=2,r._restingThreshTangent=Math.sqrt(6),r._positionDampen=.9,r._positionWarming=.8,r._frictionNormalMultiplier=5,r._frictionMaxStatic=Number.MAX_VALUE,r.preSolvePosition=function(l){var n,u,f,o=l.length;for(n=0;nDt?(w=dt>0?dt:-dt,M=P.friction*(dt>0?1:-1)*o,M<-w?M=-w:M>w&&(M=w)):(M=dt,w=m);var Ht=_*z-q*G,Bt=at*z-ot*G,ne=Y/(Z+O.inverseInertia*Ht*Ht+I.inverseInertia*Bt*Bt),oe=(1+P.restitution)*Vt*ne;if(M*=ne,Vt0&&(H.normalImpulse=0),oe=H.normalImpulse-ge}if(dt<-d||dt>d)H.tangentImpulse=0;else{var xe=H.tangentImpulse;H.tangentImpulse+=M,H.tangentImpulse<-w&&(H.tangentImpulse=-w),H.tangentImpulse>w&&(H.tangentImpulse=w),M=H.tangentImpulse-xe}var Ae=G*oe+X*M,qt=z*oe+K*M;O.isStatic||O.isSleeping||(O.positionPrev.x+=Ae*O.inverseMass,O.positionPrev.y+=qt*O.inverseMass,O.anglePrev+=(_*qt-q*Ae)*O.inverseInertia),I.isStatic||I.isSleeping||(I.positionPrev.x-=Ae*I.inverseMass,I.positionPrev.y-=qt*I.inverseMass,I.anglePrev-=(at*qt-ot*Ae)*I.inverseInertia)}}}}})()},48140:(s,y,e)=>{var r={};s.exports=r;var p=e(41598),h=e(31725),a=e(53614),l=e(15647),n=e(66615),u=e(53402);(function(){r._warming=.4,r._torqueDampen=1,r._minLength=1e-6,r.create=function(f){var o=f;o.bodyA&&!o.pointA&&(o.pointA={x:0,y:0}),o.bodyB&&!o.pointB&&(o.pointB={x:0,y:0});var c=o.bodyA?h.add(o.bodyA.position,o.pointA):o.pointA,d=o.bodyB?h.add(o.bodyB.position,o.pointB):o.pointB,v=h.magnitude(h.sub(c,d));o.length=typeof o.length<"u"?o.length:v,o.id=o.id||u.nextId(),o.label=o.label||"Constraint",o.type="constraint",o.stiffness=o.stiffness||(o.length>0?1:.7),o.damping=o.damping||0,o.angularStiffness=o.angularStiffness||0,o.angleA=o.bodyA?o.bodyA.angle:o.angleA,o.angleB=o.bodyB?o.bodyB.angle:o.angleB,o.plugin={};var m={visible:!0,type:"line",anchors:!0,lineColor:null,lineOpacity:null,lineThickness:null,pinSize:null,anchorColor:null,anchorSize:null};return o.length===0&&o.stiffness>.1?(m.type="pin",m.anchors=!1):o.stiffness<.9&&(m.type="spring"),o.render=u.extend(m,o.render),o},r.preSolveAll=function(f){for(var o=0;o=1||f.length===0,b=P?f.stiffness*o:f.stiffness*o*o,O=f.damping*o,I=h.mult(w,A*b),D=(c?c.inverseMass:0)+(d?d.inverseMass:0),B=(c?c.inverseInertia:0)+(d?d.inverseInertia:0),G=D+B,z,X,K,Q,tt;if(O>0){var Y=h.create();K=h.div(w,C),tt=h.sub(d&&h.sub(d.position,d.positionPrev)||Y,c&&h.sub(c.position,c.positionPrev)||Y),Q=h.dot(K,tt)}c&&!c.isStatic&&(X=c.inverseMass/D,c.constraintImpulse.x-=I.x*X,c.constraintImpulse.y-=I.y*X,c.position.x-=I.x*X,c.position.y-=I.y*X,O>0&&(c.positionPrev.x-=O*K.x*Q*X,c.positionPrev.y-=O*K.y*Q*X),z=h.cross(v,I)/G*r._torqueDampen*c.inverseInertia*(1-f.angularStiffness),c.constraintImpulse.angle-=z,c.angle-=z),d&&!d.isStatic&&(X=d.inverseMass/D,d.constraintImpulse.x+=I.x*X,d.constraintImpulse.y+=I.y*X,d.position.x+=I.x*X,d.position.y+=I.y*X,O>0&&(d.positionPrev.x+=O*K.x*Q*X,d.positionPrev.y+=O*K.y*Q*X),z=h.cross(m,I)/G*r._torqueDampen*d.inverseInertia*(1-f.angularStiffness),d.constraintImpulse.angle+=z,d.angle+=z)}}},r.postSolveAll=function(f){for(var o=0;o0&&(m.position.x+=d.x,m.position.y+=d.y),d.angle!==0&&(p.rotate(m.vertices,d.angle,c.position),n.rotate(m.axes,d.angle),v>0&&h.rotateAbout(m.position,d.angle,c.position,m.position)),l.update(m.bounds,m.vertices,c.velocity)}d.angle*=r._warming,d.x*=r._warming,d.y*=r._warming}}},r.pointAWorld=function(f){return{x:(f.bodyA?f.bodyA.position.x:0)+(f.pointA?f.pointA.x:0),y:(f.bodyA?f.bodyA.position.y:0)+(f.pointA?f.pointA.y:0)}},r.pointBWorld=function(f){return{x:(f.bodyB?f.bodyB.position.x:0)+(f.pointB?f.pointB.x:0),y:(f.bodyB?f.bodyB.position.y:0)+(f.pointB?f.pointB.y:0)}},r.currentLength=function(f){var o=(f.bodyA?f.bodyA.position.x:0)+(f.pointA?f.pointA.x:0),c=(f.bodyA?f.bodyA.position.y:0)+(f.pointA?f.pointA.y:0),d=(f.bodyB?f.bodyB.position.x:0)+(f.pointB?f.pointB.x:0),v=(f.bodyB?f.bodyB.position.y:0)+(f.pointB?f.pointB.y:0),m=o-d,S=c-v;return Math.sqrt(m*m+S*S)}})()},53402:(s,y,e)=>{var r={};s.exports=r,function(){r._baseDelta=16.666666666666668,r._nextId=0,r._seed=0,r._nowStartTime=+new Date,r._warnedOnce={},r._decomp=null,r.extend=function(h,a){var l,n;typeof a=="boolean"?(l=2,n=a):(l=1,n=!0);for(var u=l;u0;a--){var l=Math.floor(r.random()*(a+1)),n=h[a];h[a]=h[l],h[l]=n}return h},r.choose=function(h){return h[Math.floor(r.random()*h.length)]},r.isElement=function(h){return typeof HTMLElement<"u"?h instanceof HTMLElement:!!(h&&h.nodeType&&h.nodeName)},r.isArray=function(h){return Object.prototype.toString.call(h)==="[object Array]"},r.isFunction=function(h){return typeof h=="function"},r.isPlainObject=function(h){return typeof h=="object"&&h.constructor===Object},r.isString=function(h){return toString.call(h)==="[object String]"},r.clamp=function(h,a,l){return hl?l:h},r.sign=function(h){return h<0?-1:1},r.now=function(){if(typeof window<"u"&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-r._nowStartTime},r.random=function(h,a){return h=typeof h<"u"?h:0,a=typeof a<"u"?a:1,h+p()*(a-h)};var p=function(){return r._seed=(r._seed*9301+49297)%233280,r._seed/233280};r.colorToNumber=function(h){return h=h.replace("#",""),h.length==3&&(h=h.charAt(0)+h.charAt(0)+h.charAt(1)+h.charAt(1)+h.charAt(2)+h.charAt(2)),parseInt(h,16)},r.logLevel=1,r.log=function(){console&&r.logLevel>0&&r.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},r.info=function(){console&&r.logLevel>0&&r.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},r.warn=function(){console&&r.logLevel>0&&r.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},r.warnOnce=function(){var h=Array.prototype.slice.call(arguments).join(" ");r._warnedOnce[h]||(r.warn(h),r._warnedOnce[h]=!0)},r.deprecated=function(h,a,l){h[a]=r.chain(function(){r.warnOnce("🔅 deprecated 🔅",l)},h[a])},r.nextId=function(){return r._nextId++},r.indexOf=function(h,a){if(h.indexOf)return h.indexOf(a);for(var l=0;l{var r={};s.exports=r;var p=e(53614),h=e(66272),a=e(81388),l=e(99561),n=e(35810),u=e(69351),f=e(48140),o=e(53402),c=e(22562);(function(){r.create=function(d){d=d||{};var v={positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},gravity:{x:0,y:1,scale:.001},timing:{timestamp:0,timeScale:1,lastDelta:0,lastElapsed:0}},m=o.extend(v,d);return m.world=d.world||u.create({label:"World"}),m.pairs=d.pairs||l.create(),m.detector=d.detector||a.create(),m.grid={buckets:[]},m.world.gravity=m.gravity,m.broadphase=m.grid,m.metrics={},m},r.update=function(d,v){var m=o.now(),S=d.world,M=d.detector,w=d.pairs,C=d.timing,A=C.timestamp,P;v=typeof v<"u"?v:o._baseDelta,v*=C.timeScale,C.timestamp+=v,C.lastDelta=v;var b={timestamp:C.timestamp,delta:v};n.trigger(d,"beforeUpdate",b);var O=u.allBodies(S),I=u.allConstraints(S);for(S.isModified&&(a.setBodies(M,O),u.setModified(S,!1,!1,!0)),d.enableSleeping&&p.update(O,v),r._bodiesApplyGravity(O,d.gravity),v>0&&r._bodiesUpdate(O,v),n.trigger(d,"beforeSolve",b),f.preSolveAll(O),P=0;P0&&n.trigger(d,"collisionStart",{pairs:w.collisionStart,timestamp:C.timestamp,delta:v});var B=o.clamp(20/d.positionIterations,0,1);for(h.preSolvePosition(w.list),P=0;P0&&n.trigger(d,"collisionActive",{pairs:w.collisionActive,timestamp:C.timestamp,delta:v}),w.collisionEnd.length>0&&n.trigger(d,"collisionEnd",{pairs:w.collisionEnd,timestamp:C.timestamp,delta:v}),r._bodiesClearForces(O),n.trigger(d,"afterUpdate",b),d.timing.lastElapsed=o.now()-m,d},r.merge=function(d,v){if(o.extend(d,v),v.world){d.world=v.world,r.clear(d);for(var m=u.allBodies(d.world),S=0;S{var r={};s.exports=r;var p=e(53402);(function(){r.on=function(h,a,l){for(var n=a.split(" "),u,f=0;f0){l||(l={}),n=a.split(" ");for(var d=0;d{var r={};s.exports=r;var p=e(73832),h=e(53402);(function(){r.name="matter-js",r.version="0.19.0",r.uses=[],r.used=[],r.use=function(){p.use(r,Array.prototype.slice.call(arguments))},r.before=function(a,l){return a=a.replace(/^Matter./,""),h.chainPathBefore(r,a,l)},r.after=function(a,l){return a=a.replace(/^Matter./,""),h.chainPathAfter(r,a,l)}})()},73832:(s,y,e)=>{var r={};s.exports=r;var p=e(53402);(function(){r._registry={},r.register=function(h){if(r.isPlugin(h)||p.warn("Plugin.register:",r.toString(h),"does not implement all required fields."),h.name in r._registry){var a=r._registry[h.name],l=r.versionParse(h.version).number,n=r.versionParse(a.version).number;l>n?(p.warn("Plugin.register:",r.toString(a),"was upgraded to",r.toString(h)),r._registry[h.name]=h):l-1},r.isFor=function(h,a){var l=h.for&&r.dependencyParse(h.for);return!h.for||a.name===l.name&&r.versionSatisfies(a.version,l.range)},r.use=function(h,a){if(h.uses=(h.uses||[]).concat(a||[]),h.uses.length===0){p.warn("Plugin.use:",r.toString(h),"does not specify any dependencies to install.");return}for(var l=r.dependencies(h),n=p.topologicalSort(l),u=[],f=0;f0&&!o.silent&&p.info(u.join(" "))},r.dependencies=function(h,a){var l=r.dependencyParse(h),n=l.name;if(a=a||{},!(n in a)){h=r.resolve(h)||h,a[n]=p.map(h.uses||[],function(f){r.isPlugin(f)&&r.register(f);var o=r.dependencyParse(f),c=r.resolve(f);return c&&!r.versionSatisfies(c.version,o.range)?(p.warn("Plugin.dependencies:",r.toString(c),"does not satisfy",r.toString(o),"used by",r.toString(l)+"."),c._warned=!0,h._warned=!0):c||(p.warn("Plugin.dependencies:",r.toString(f),"used by",r.toString(l),"could not be resolved."),h._warned=!0),o.name});for(var u=0;u=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-+]+)?$/;a.test(h)||p.warn("Plugin.versionParse:",h,"is not a valid version or range.");var l=a.exec(h),n=Number(l[4]),u=Number(l[5]),f=Number(l[6]);return{isRange:!!(l[1]||l[2]),version:l[3],range:h,operator:l[1]||l[2]||"",major:n,minor:u,patch:f,parts:[n,u,f],prerelease:l[7],number:n*1e8+u*1e4+f}},r.versionSatisfies=function(h,a){a=a||"*";var l=r.versionParse(a),n=r.versionParse(h);if(l.isRange){if(l.operator==="*"||h==="*")return!0;if(l.operator===">")return n.number>l.number;if(l.operator===">=")return n.number>=l.number;if(l.operator==="~")return n.major===l.major&&n.minor===l.minor&&n.patch>=l.patch;if(l.operator==="^")return l.major>0?n.major===l.major&&n.number>=l.number:l.minor>0?n.minor===l.minor&&n.patch>=l.patch:n.patch===l.patch}return h===a||h==="*"}})()},53614:(s,y,e)=>{var r={};s.exports=r;var p=e(22562),h=e(35810),a=e(53402);(function(){r._motionWakeThreshold=.18,r._motionSleepThreshold=.08,r._minBias=.9,r.update=function(l,n){for(var u=n/a._baseDelta,f=r._motionSleepThreshold,o=0;o0&&c.motion=c.sleepThreshold/u&&r.set(c,!0)):c.sleepCounter>0&&(c.sleepCounter-=1)}},r.afterCollisions=function(l){for(var n=r._motionSleepThreshold,u=0;un&&r.set(v,!1)}}}},r.set=function(l,n){var u=l.isSleeping;n?(l.isSleeping=!0,l.sleepCounter=l.sleepThreshold,l.positionImpulse.x=0,l.positionImpulse.y=0,l.positionPrev.x=l.position.x,l.positionPrev.y=l.position.y,l.anglePrev=l.angle,l.speed=0,l.angularSpeed=0,l.motion=0,u||h.trigger(l,"sleepStart")):(l.isSleeping=!1,l.sleepCounter=0,u&&h.trigger(l,"sleepEnd"))}})()},66280:(s,y,e)=>{var r={};s.exports=r;var p=e(41598),h=e(53402),a=e(22562),l=e(15647),n=e(31725);(function(){r.rectangle=function(u,f,o,c,d){d=d||{};var v={label:"Rectangle Body",position:{x:u,y:f},vertices:p.fromPath("L 0 0 L "+o+" 0 L "+o+" "+c+" L 0 "+c)};if(d.chamfer){var m=d.chamfer;v.vertices=p.chamfer(v.vertices,m.radius,m.quality,m.qualityMin,m.qualityMax),delete d.chamfer}return a.create(h.extend({},v,d))},r.trapezoid=function(u,f,o,c,d,v){v=v||{},d*=.5;var m=(1-d*2)*o,S=o*d,M=S+m,w=M+S,C;d<.5?C="L 0 0 L "+S+" "+-c+" L "+M+" "+-c+" L "+w+" 0":C="L 0 0 L "+M+" "+-c+" L "+w+" 0";var A={label:"Trapezoid Body",position:{x:u,y:f},vertices:p.fromPath(C)};if(v.chamfer){var P=v.chamfer;A.vertices=p.chamfer(A.vertices,P.radius,P.quality,P.qualityMin,P.qualityMax),delete v.chamfer}return a.create(h.extend({},A,v))},r.circle=function(u,f,o,c,d){c=c||{};var v={label:"Circle Body",circleRadius:o};d=d||25;var m=Math.ceil(Math.max(10,Math.min(d,o)));return m%2===1&&(m+=1),r.polygon(u,f,m,o,h.extend({},v,c))},r.polygon=function(u,f,o,c,d){if(d=d||{},o<3)return r.circle(u,f,c,d);for(var v=2*Math.PI/o,m="",S=v*.5,M=0;M0&&p.area(tt)1?(C=a.create(h.extend({parts:A.slice(0)},c)),a.setPosition(C,{x:u,y:f}),C):A[0]},r.flagCoincidentParts=function(u,f){f===void 0&&(f=5);for(var o=0;o{var r={};s.exports=r;var p=e(69351),h=e(48140),a=e(53402),l=e(22562),n=e(66280);(function(){r.stack=function(u,f,o,c,d,v,m){for(var S=p.create({label:"Stack"}),M=u,w=f,C,A=0,P=0;Pb&&(b=D),l.translate(I,{x:B*.5,y:D*.5}),M=I.bounds.max.x+d,p.addBody(S,I),C=I,A+=1}else M+=d}w+=b+v,M=u}return S},r.chain=function(u,f,o,c,d,v){for(var m=u.bodies,S=1;S0)for(S=0;S0&&(C=v[S-1+(m-1)*f],p.addConstraint(u,h.create(a.extend({bodyA:C,bodyB:w},d)))),c&&Sb)){C=b-C;var I=C,D=o-1-C;if(!(wD)){P===1&&l.translate(A,{x:(w+(o%2===1?1:-1))*O,y:0});var B=A?w*O:0;return m(u+B+w*d,M,w,C,A,P)}}})},r.newtonsCradle=function(u,f,o,c,d){for(var v=p.create({label:"Newtons Cradle"}),m=0;m{var r={};s.exports=r;var p=e(31725),h=e(53402);(function(){r.fromVertices=function(a){for(var l={},n=0;n{var y={};s.exports=y,function(){y.create=function(e){var r={min:{x:0,y:0},max:{x:0,y:0}};return e&&y.update(r,e),r},y.update=function(e,r,p){e.min.x=1/0,e.max.x=-1/0,e.min.y=1/0,e.max.y=-1/0;for(var h=0;he.max.x&&(e.max.x=a.x),a.xe.max.y&&(e.max.y=a.y),a.y0?e.max.x+=p.x:e.min.x+=p.x,p.y>0?e.max.y+=p.y:e.min.y+=p.y)},y.contains=function(e,r){return r.x>=e.min.x&&r.x<=e.max.x&&r.y>=e.min.y&&r.y<=e.max.y},y.overlaps=function(e,r){return e.min.x<=r.max.x&&e.max.x>=r.min.x&&e.max.y>=r.min.y&&e.min.y<=r.max.y},y.translate=function(e,r){e.min.x+=r.x,e.max.x+=r.x,e.min.y+=r.y,e.max.y+=r.y},y.shift=function(e,r){var p=e.max.x-e.min.x,h=e.max.y-e.min.y;e.min.x=r.x,e.max.x=r.x+p,e.min.y=r.y,e.max.y=r.y+h}}()},74058:(s,y,e)=>{var r={};s.exports=r,e(15647);var p=e(53402);(function(){r.pathToVertices=function(h,a){typeof window<"u"&&!("SVGPathSeg"in window)&&p.warn("Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.");var l,n,u,f,o,c,d,v,m,S,M=[],w,C,A=0,P=0,b=0;a=a||15;var O=function(D,B,G){var z=G%2===1&&G>1;if(!m||D!=m.x||B!=m.y){m&&z?(w=m.x,C=m.y):(w=0,C=0);var X={x:w+D,y:C+B};(z||!m)&&(m=X),M.push(X),P=w+D,b=C+B}},I=function(D){var B=D.pathSegTypeAsLetter.toUpperCase();if(B!=="Z"){switch(B){case"M":case"L":case"T":case"C":case"S":case"Q":P=D.x,b=D.y;break;case"H":P=D.x;break;case"V":b=D.y;break}O(P,b,D.pathSegType)}};for(r._svgPathToAbsolute(h),u=h.getTotalLength(),c=[],l=0;l{var y={};s.exports=y,function(){y.create=function(e,r){return{x:e||0,y:r||0}},y.clone=function(e){return{x:e.x,y:e.y}},y.magnitude=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},y.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},y.rotate=function(e,r,p){var h=Math.cos(r),a=Math.sin(r);p||(p={});var l=e.x*h-e.y*a;return p.y=e.x*a+e.y*h,p.x=l,p},y.rotateAbout=function(e,r,p,h){var a=Math.cos(r),l=Math.sin(r);h||(h={});var n=p.x+((e.x-p.x)*a-(e.y-p.y)*l);return h.y=p.y+((e.x-p.x)*l+(e.y-p.y)*a),h.x=n,h},y.normalise=function(e){var r=y.magnitude(e);return r===0?{x:0,y:0}:{x:e.x/r,y:e.y/r}},y.dot=function(e,r){return e.x*r.x+e.y*r.y},y.cross=function(e,r){return e.x*r.y-e.y*r.x},y.cross3=function(e,r,p){return(r.x-e.x)*(p.y-e.y)-(r.y-e.y)*(p.x-e.x)},y.add=function(e,r,p){return p||(p={}),p.x=e.x+r.x,p.y=e.y+r.y,p},y.sub=function(e,r,p){return p||(p={}),p.x=e.x-r.x,p.y=e.y-r.y,p},y.mult=function(e,r){return{x:e.x*r,y:e.y*r}},y.div=function(e,r){return{x:e.x/r,y:e.y/r}},y.perp=function(e,r){return r=r===!0?-1:1,{x:r*-e.y,y:r*e.x}},y.neg=function(e){return{x:-e.x,y:-e.y}},y.angle=function(e,r){return Math.atan2(r.y-e.y,r.x-e.x)},y._temp=[y.create(),y.create(),y.create(),y.create(),y.create(),y.create()]}()},41598:(s,y,e)=>{var r={};s.exports=r;var p=e(31725),h=e(53402);(function(){r.create=function(a,l){for(var n=[],u=0;u0)return!1;o=c}return!0},r.scale=function(a,l,n,u){if(l===1&&n===1)return a;u=u||r.centre(a);for(var f,o,c=0;c=0?c-1:a.length-1],v=a[c],m=a[(c+1)%a.length],S=l[c0&&(l|=2),l===3)return!1;return l!==0?!0:null},r.hull=function(a){var l=[],n=[],u,f;for(a=a.slice(0),a.sort(function(o,c){var d=o.x-c.x;return d!==0?d:o.y-c.y}),f=0;f=2&&p.cross3(n[n.length-2],n[n.length-1],u)<=0;)n.pop();n.push(u)}for(f=a.length-1;f>=0;f-=1){for(u=a[f];l.length>=2&&p.cross3(l[l.length-2],l[l.length-1],u)<=0;)l.pop();l.push(u)}return l.pop(),n.pop(),l.concat(n)}})()},18210:(s,y,e)=>{var r=e(19933),p={name:"matter-attractors",version:"0.1.7",for:"matter-js@^0.19.0",silent:!0,install:function(h){h.after("Body.create",function(){p.Body.init(this)}),h.before("Engine.update",function(a){p.Engine.update(a)})},Body:{init:function(h){h.plugin.attractors=h.plugin.attractors||[]}},Engine:{update:function(h){for(var a=r.Composite.allBodies(h.world),l=0;l0)for(var f=0;f{/** + */s.exports={BodyBounds:e(68174),Components:e(31884),Events:e(1121),Factory:e(28137),MatterGameObject:e(75803),Image:e(23181),Matter:e(19933),MatterPhysics:e(42045),PolyDecomp:e(55973),Sprite:e(34803),TileBody:e(73834),PhysicsEditorParser:e(19496),PhysicsJSONParser:e(85791),PointerConstraint:e(98713),World:e(68243)}},22562:(s,y,e)=>{var r={};s.exports=r;var p=e(41598),h=e(31725),a=e(53614),l=e(53402),n=e(15647),u=e(66615);(function(){r._timeCorrection=!0,r._inertiaScale=4,r._nextCollidingGroupId=1,r._nextNonCollidingGroupId=-1,r._nextCategory=1,r._baseDelta=16.666666666666668,r.create=function(o){var c={id:l.nextId(),type:"body",label:"Body",parts:[],plugin:{},angle:0,vertices:null,position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inverseMass:0,inertia:0,deltaTime:16.666666666666668,inverseInertia:0,_original:null,render:{visible:!0,opacity:1,sprite:{xOffset:0,yOffset:0},fillColor:null,fillOpacity:null,lineColor:null,lineOpacity:null,lineThickness:null},gameObject:null,scale:{x:1,y:1},centerOfMass:{x:0,y:0},centerOffset:{x:0,y:0},gravityScale:{x:1,y:1},ignoreGravity:!1,ignorePointer:!1,onCollideCallback:null,onCollideEndCallback:null,onCollideActiveCallback:null,onCollideWith:{}};!o.hasOwnProperty("position")&&o.hasOwnProperty("vertices")?o.position=p.centre(o.vertices):o.hasOwnProperty("vertices")||(c.vertices=p.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"));var d=l.extend(c,o);return f(d,o),d.setOnCollideWith=function(v,m){return m?this.onCollideWith[v.id]=m:delete this.onCollideWith[v.id],this},d},r.nextGroup=function(o){return o?r._nextNonCollidingGroupId--:r._nextCollidingGroupId++},r.nextCategory=function(){return r._nextCategory=r._nextCategory<<1,r._nextCategory};var f=function(o,c){if(c=c||{},r.set(o,{bounds:o.bounds||n.create(o.vertices),positionPrev:o.positionPrev||h.clone(o.position),anglePrev:o.anglePrev||o.angle,vertices:o.vertices,parts:o.parts||[o],isStatic:o.isStatic,isSleeping:o.isSleeping,parent:o.parent||o}),p.rotate(o.vertices,o.angle,o.position),u.rotate(o.axes,o.angle),n.update(o.bounds,o.vertices,o.velocity),r.set(o,{axes:c.axes||o.axes,area:c.area||o.area,mass:c.mass||o.mass,inertia:c.inertia||o.inertia}),o.parts.length===1){var d=o.bounds,v=o.centerOfMass,m=o.centerOffset,S=d.max.x-d.min.x,M=d.max.y-d.min.y;v.x=-(d.min.x-o.position.x)/S,v.y=-(d.min.y-o.position.y)/M,m.x=S*v.x,m.y=M*v.y}};r.set=function(o,c,d){var v;typeof c=="string"&&(v=c,c={},c[v]=d);for(v in c)if(Object.prototype.hasOwnProperty.call(c,v))switch(d=c[v],v){case"isStatic":r.setStatic(o,d);break;case"isSleeping":a.set(o,d);break;case"mass":r.setMass(o,d);break;case"density":r.setDensity(o,d);break;case"inertia":r.setInertia(o,d);break;case"vertices":r.setVertices(o,d);break;case"position":r.setPosition(o,d);break;case"angle":r.setAngle(o,d);break;case"velocity":r.setVelocity(o,d);break;case"angularVelocity":r.setAngularVelocity(o,d);break;case"speed":r.setSpeed(o,d);break;case"angularSpeed":r.setAngularSpeed(o,d);break;case"parts":r.setParts(o,d);break;case"centre":r.setCentre(o,d);break;default:o[v]=d}},r.setStatic=function(o,c){for(var d=0;d0&&h.rotateAbout(S.position,v,o.position,S.position)}},r.setVelocity=function(o,c){var d=o.deltaTime/r._baseDelta;o.positionPrev.x=o.position.x-c.x*d,o.positionPrev.y=o.position.y-c.y*d,o.velocity.x=(o.position.x-o.positionPrev.x)/d,o.velocity.y=(o.position.y-o.positionPrev.y)/d,o.speed=h.magnitude(o.velocity)},r.getVelocity=function(o){var c=r._baseDelta/o.deltaTime;return{x:(o.position.x-o.positionPrev.x)*c,y:(o.position.y-o.positionPrev.y)*c}},r.getSpeed=function(o){return h.magnitude(r.getVelocity(o))},r.setSpeed=function(o,c){r.setVelocity(o,h.mult(h.normalise(r.getVelocity(o)),c))},r.setAngularVelocity=function(o,c){var d=o.deltaTime/r._baseDelta;o.anglePrev=o.angle-c*d,o.angularVelocity=(o.angle-o.anglePrev)/d,o.angularSpeed=Math.abs(o.angularVelocity)},r.getAngularVelocity=function(o){return(o.angle-o.anglePrev)*r._baseDelta/o.deltaTime},r.getAngularSpeed=function(o){return Math.abs(r.getAngularVelocity(o))},r.setAngularSpeed=function(o,c){r.setAngularVelocity(o,l.sign(r.getAngularVelocity(o))*c)},r.translate=function(o,c,d){r.setPosition(o,h.add(o.position,c),d)},r.rotate=function(o,c,d,v){if(!d)r.setAngle(o,o.angle+c,v);else{var m=Math.cos(c),S=Math.sin(c),M=o.position.x-d.x,w=o.position.y-d.y;r.setPosition(o,{x:d.x+(M*m-w*S),y:d.y+(M*S+w*m)},v),r.setAngle(o,o.angle+c,v)}},r.scale=function(o,c,d,v){var m=0,S=0;v=v||o.position;for(var M=o.inertia===1/0,w=0;w0&&(m+=C.area,S+=C.inertia),C.position.x=v.x+(C.position.x-v.x)*c,C.position.y=v.y+(C.position.y-v.y)*d,n.update(C.bounds,C.vertices,o.velocity)}o.parts.length>1&&(o.area=m,o.isStatic||(r.setMass(o,o.density*m),r.setInertia(o,S))),o.circleRadius&&(c===d?o.circleRadius*=c:o.circleRadius=null),M&&r.setInertia(o,1/0)},r.update=function(o,c){c=(typeof c<"u"?c:16.666666666666668)*o.timeScale;var d=c*c,v=r._timeCorrection?c/(o.deltaTime||c):1,m=1-o.frictionAir*(c/l._baseDelta),S=(o.position.x-o.positionPrev.x)*v,M=(o.position.y-o.positionPrev.y)*v;o.velocity.x=S*m+o.force.x/o.mass*d,o.velocity.y=M*m+o.force.y/o.mass*d,o.positionPrev.x=o.position.x,o.positionPrev.y=o.position.y,o.position.x+=o.velocity.x,o.position.y+=o.velocity.y,o.deltaTime=c,o.angularVelocity=(o.angle-o.anglePrev)*m*v+o.torque/o.inertia*d,o.anglePrev=o.angle,o.angle+=o.angularVelocity,o.speed=h.magnitude(o.velocity),o.angularSpeed=Math.abs(o.angularVelocity);for(var w=0;w0&&(C.position.x+=o.velocity.x,C.position.y+=o.velocity.y),o.angularVelocity!==0&&(p.rotate(C.vertices,o.angularVelocity,o.position),u.rotate(C.axes,o.angularVelocity),w>0&&h.rotateAbout(C.position,o.angularVelocity,o.position,C.position)),n.update(C.bounds,C.vertices,o.velocity)}},r.updateVelocities=function(o){var c=r._baseDelta/o.deltaTime,d=o.velocity;d.x=(o.position.x-o.positionPrev.x)*c,d.y=(o.position.y-o.positionPrev.y)*c,o.speed=Math.sqrt(d.x*d.x+d.y*d.y),o.angularVelocity=(o.angle-o.anglePrev)*c,o.angularSpeed=Math.abs(o.angularVelocity)},r.applyForce=function(o,c,d){var v={x:c.x-o.position.x,y:c.y-o.position.y};o.force.x+=d.x,o.force.y+=d.y,o.torque+=v.x*d.y-v.y*d.x},r._totalProperties=function(o){for(var c={mass:0,area:0,inertia:0,centre:{x:0,y:0}},d=o.parts.length===1?0:1;d{var r={};s.exports=r;var p=e(35810),h=e(53402),a=e(15647),l=e(22562);(function(){r.create=function(n){return h.extend({id:h.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{},cache:{allBodies:null,allConstraints:null,allComposites:null}},n)},r.setModified=function(n,u,f,o){if(p.trigger(n,"compositeModified",n),n.isModified=u,u&&n.cache&&(n.cache.allBodies=null,n.cache.allConstraints=null,n.cache.allComposites=null),f&&n.parent&&r.setModified(n.parent,u,f,o),o)for(var c=0;c{var r={};s.exports=r;var p=e(69351);(function(){r.create=p.create,r.add=p.add,r.remove=p.remove,r.clear=p.clear,r.addComposite=p.addComposite,r.addBody=p.addBody,r.addConstraint=p.addConstraint})()},52284:(s,y,e)=>{var r={};s.exports=r;var p=e(41598),h=e(4506);(function(){var a=[],l={overlap:0,axis:null},n={overlap:0,axis:null};r.create=function(u,f){return{pair:null,collided:!1,bodyA:u,bodyB:f,parentA:u.parent,parentB:f.parent,depth:0,normal:{x:0,y:0},tangent:{x:0,y:0},penetration:{x:0,y:0},supports:[]}},r.collides=function(u,f,o){if(r._overlapAxes(l,u.vertices,f.vertices,u.axes),l.overlap<=0||(r._overlapAxes(n,f.vertices,u.vertices,f.axes),n.overlap<=0))return null;var c=o&&o.table[h.id(u,f)],d;c?d=c.collision:(d=r.create(u,f),d.collided=!0,d.bodyA=u.idY?Y=D:DZ?Z=D:Dd?d=m:m{var y={};s.exports=y,function(){y.create=function(e){return{vertex:e,normalImpulse:0,tangentImpulse:0}}}()},81388:(s,y,e)=>{var r={};s.exports=r;var p=e(53402),h=e(52284);(function(){r.create=function(a){var l={bodies:[],pairs:null};return p.extend(l,a)},r.setBodies=function(a,l){a.bodies=l.slice(0)},r.clear=function(a){a.bodies=[]},r.collisions=function(a){var l=[],n=a.pairs,u=a.bodies,f=u.length,o=r.canCollide,c=h.collides,d,v;for(u.sort(r._compareBoundsX),d=0;dM)break;if(!(wI.max.y)&&!(A&&(O.isStatic||O.isSleeping))&&o(m.collisionFilter,O.collisionFilter)){var D=O.parts.length;if(b&&D===1){var B=c(m,O,n);B&&l.push(B)}else for(var G=P>1?1:0,z=D>1?1:0,X=G;XI.max.x||S.max.xI.max.y)){var B=c(j,tt,n);B&&l.push(B)}}}}}return l},r.canCollide=function(a,l){return a.group===l.group&&a.group!==0?a.group>0:(a.mask&l.category)!==0&&(l.mask&a.category)!==0},r._compareBoundsX=function(a,l){return a.bounds.min.x-l.bounds.min.x}})()},4506:(s,y,e)=>{var r={};s.exports=r;var p=e(43424);(function(){r.create=function(h,a){var l=h.bodyA,n=h.bodyB,u={id:r.id(l,n),bodyA:l,bodyB:n,collision:h,contacts:[],activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:l.isSensor||n.isSensor,timeCreated:a,timeUpdated:a,inverseMass:0,friction:0,frictionStatic:0,restitution:0,slop:0};return r.update(u,h,a),u},r.update=function(h,a,l){var n=h.contacts,u=a.supports,f=h.activeContacts,o=a.parentA,c=a.parentB,d=o.vertices.length;h.isActive=!0,h.timeUpdated=l,h.collision=a,h.separation=a.depth,h.inverseMass=o.inverseMass+c.inverseMass,h.friction=o.frictionc.frictionStatic?o.frictionStatic:c.frictionStatic,h.restitution=o.restitution>c.restitution?o.restitution:c.restitution,h.slop=o.slop>c.slop?o.slop:c.slop,a.pair=h,f.length=0;for(var v=0;v{var r={};s.exports=r;var p=e(4506),h=e(53402);(function(){r.create=function(a){return h.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},a)},r.update=function(a,l,n){var u=a.list,f=u.length,o=a.table,c=l.length,d=a.collisionStart,v=a.collisionEnd,m=a.collisionActive,S,M,w,C;for(d.length=0,v.length=0,m.length=0,C=0;C{var r={};s.exports=r;var p=e(31725),h=e(52284),a=e(15647),l=e(66280),n=e(41598);(function(){r.collides=function(u,f){for(var o=[],c=f.length,d=u.bounds,v=h.collides,m=a.overlaps,S=0;S{var r={};s.exports=r;var p=e(41598),h=e(53402),a=e(15647);(function(){r._restingThresh=2,r._restingThreshTangent=Math.sqrt(6),r._positionDampen=.9,r._positionWarming=.8,r._frictionNormalMultiplier=5,r._frictionMaxStatic=Number.MAX_VALUE,r.preSolvePosition=function(l){var n,u,f,o=l.length;for(n=0;nDt?(w=dt>0?dt:-dt,M=P.friction*(dt>0?1:-1)*o,M<-w?M=-w:M>w&&(M=w)):(M=dt,w=m);var Ht=_*z-q*G,Bt=at*z-ot*G,re=Y/(Z+O.inverseInertia*Ht*Ht+I.inverseInertia*Bt*Bt),le=(1+P.restitution)*Vt*re;if(M*=re,Vt0&&(H.normalImpulse=0),le=H.normalImpulse-ge}if(dt<-d||dt>d)H.tangentImpulse=0;else{var xe=H.tangentImpulse;H.tangentImpulse+=M,H.tangentImpulse<-w&&(H.tangentImpulse=-w),H.tangentImpulse>w&&(H.tangentImpulse=w),M=H.tangentImpulse-xe}var Pe=G*le+X*M,te=z*le+j*M;O.isStatic||O.isSleeping||(O.positionPrev.x+=Pe*O.inverseMass,O.positionPrev.y+=te*O.inverseMass,O.anglePrev+=(_*te-q*Pe)*O.inverseInertia),I.isStatic||I.isSleeping||(I.positionPrev.x-=Pe*I.inverseMass,I.positionPrev.y-=te*I.inverseMass,I.anglePrev-=(at*te-ot*Pe)*I.inverseInertia)}}}}})()},48140:(s,y,e)=>{var r={};s.exports=r;var p=e(41598),h=e(31725),a=e(53614),l=e(15647),n=e(66615),u=e(53402);(function(){r._warming=.4,r._torqueDampen=1,r._minLength=1e-6,r.create=function(f){var o=f;o.bodyA&&!o.pointA&&(o.pointA={x:0,y:0}),o.bodyB&&!o.pointB&&(o.pointB={x:0,y:0});var c=o.bodyA?h.add(o.bodyA.position,o.pointA):o.pointA,d=o.bodyB?h.add(o.bodyB.position,o.pointB):o.pointB,v=h.magnitude(h.sub(c,d));o.length=typeof o.length<"u"?o.length:v,o.id=o.id||u.nextId(),o.label=o.label||"Constraint",o.type="constraint",o.stiffness=o.stiffness||(o.length>0?1:.7),o.damping=o.damping||0,o.angularStiffness=o.angularStiffness||0,o.angleA=o.bodyA?o.bodyA.angle:o.angleA,o.angleB=o.bodyB?o.bodyB.angle:o.angleB,o.plugin={};var m={visible:!0,type:"line",anchors:!0,lineColor:null,lineOpacity:null,lineThickness:null,pinSize:null,anchorColor:null,anchorSize:null};return o.length===0&&o.stiffness>.1?(m.type="pin",m.anchors=!1):o.stiffness<.9&&(m.type="spring"),o.render=u.extend(m,o.render),o},r.preSolveAll=function(f){for(var o=0;o=1||f.length===0,b=P?f.stiffness*o:f.stiffness*o*o,O=f.damping*o,I=h.mult(w,A*b),D=(c?c.inverseMass:0)+(d?d.inverseMass:0),B=(c?c.inverseInertia:0)+(d?d.inverseInertia:0),G=D+B,z,X,j,Q,tt;if(O>0){var Y=h.create();j=h.div(w,C),tt=h.sub(d&&h.sub(d.position,d.positionPrev)||Y,c&&h.sub(c.position,c.positionPrev)||Y),Q=h.dot(j,tt)}c&&!c.isStatic&&(X=c.inverseMass/D,c.constraintImpulse.x-=I.x*X,c.constraintImpulse.y-=I.y*X,c.position.x-=I.x*X,c.position.y-=I.y*X,O>0&&(c.positionPrev.x-=O*j.x*Q*X,c.positionPrev.y-=O*j.y*Q*X),z=h.cross(v,I)/G*r._torqueDampen*c.inverseInertia*(1-f.angularStiffness),c.constraintImpulse.angle-=z,c.angle-=z),d&&!d.isStatic&&(X=d.inverseMass/D,d.constraintImpulse.x+=I.x*X,d.constraintImpulse.y+=I.y*X,d.position.x+=I.x*X,d.position.y+=I.y*X,O>0&&(d.positionPrev.x+=O*j.x*Q*X,d.positionPrev.y+=O*j.y*Q*X),z=h.cross(m,I)/G*r._torqueDampen*d.inverseInertia*(1-f.angularStiffness),d.constraintImpulse.angle+=z,d.angle+=z)}}},r.postSolveAll=function(f){for(var o=0;o0&&(m.position.x+=d.x,m.position.y+=d.y),d.angle!==0&&(p.rotate(m.vertices,d.angle,c.position),n.rotate(m.axes,d.angle),v>0&&h.rotateAbout(m.position,d.angle,c.position,m.position)),l.update(m.bounds,m.vertices,c.velocity)}d.angle*=r._warming,d.x*=r._warming,d.y*=r._warming}}},r.pointAWorld=function(f){return{x:(f.bodyA?f.bodyA.position.x:0)+(f.pointA?f.pointA.x:0),y:(f.bodyA?f.bodyA.position.y:0)+(f.pointA?f.pointA.y:0)}},r.pointBWorld=function(f){return{x:(f.bodyB?f.bodyB.position.x:0)+(f.pointB?f.pointB.x:0),y:(f.bodyB?f.bodyB.position.y:0)+(f.pointB?f.pointB.y:0)}},r.currentLength=function(f){var o=(f.bodyA?f.bodyA.position.x:0)+(f.pointA?f.pointA.x:0),c=(f.bodyA?f.bodyA.position.y:0)+(f.pointA?f.pointA.y:0),d=(f.bodyB?f.bodyB.position.x:0)+(f.pointB?f.pointB.x:0),v=(f.bodyB?f.bodyB.position.y:0)+(f.pointB?f.pointB.y:0),m=o-d,S=c-v;return Math.sqrt(m*m+S*S)}})()},53402:(s,y,e)=>{var r={};s.exports=r,function(){r._baseDelta=16.666666666666668,r._nextId=0,r._seed=0,r._nowStartTime=+new Date,r._warnedOnce={},r._decomp=null,r.extend=function(h,a){var l,n;typeof a=="boolean"?(l=2,n=a):(l=1,n=!0);for(var u=l;u0;a--){var l=Math.floor(r.random()*(a+1)),n=h[a];h[a]=h[l],h[l]=n}return h},r.choose=function(h){return h[Math.floor(r.random()*h.length)]},r.isElement=function(h){return typeof HTMLElement<"u"?h instanceof HTMLElement:!!(h&&h.nodeType&&h.nodeName)},r.isArray=function(h){return Object.prototype.toString.call(h)==="[object Array]"},r.isFunction=function(h){return typeof h=="function"},r.isPlainObject=function(h){return typeof h=="object"&&h.constructor===Object},r.isString=function(h){return toString.call(h)==="[object String]"},r.clamp=function(h,a,l){return hl?l:h},r.sign=function(h){return h<0?-1:1},r.now=function(){if(typeof window<"u"&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-r._nowStartTime},r.random=function(h,a){return h=typeof h<"u"?h:0,a=typeof a<"u"?a:1,h+p()*(a-h)};var p=function(){return r._seed=(r._seed*9301+49297)%233280,r._seed/233280};r.colorToNumber=function(h){return h=h.replace("#",""),h.length==3&&(h=h.charAt(0)+h.charAt(0)+h.charAt(1)+h.charAt(1)+h.charAt(2)+h.charAt(2)),parseInt(h,16)},r.logLevel=1,r.log=function(){console&&r.logLevel>0&&r.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},r.info=function(){console&&r.logLevel>0&&r.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},r.warn=function(){console&&r.logLevel>0&&r.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},r.warnOnce=function(){var h=Array.prototype.slice.call(arguments).join(" ");r._warnedOnce[h]||(r.warn(h),r._warnedOnce[h]=!0)},r.deprecated=function(h,a,l){h[a]=r.chain(function(){r.warnOnce("🔅 deprecated 🔅",l)},h[a])},r.nextId=function(){return r._nextId++},r.indexOf=function(h,a){if(h.indexOf)return h.indexOf(a);for(var l=0;l{var r={};s.exports=r;var p=e(53614),h=e(66272),a=e(81388),l=e(99561),n=e(35810),u=e(69351),f=e(48140),o=e(53402),c=e(22562);(function(){r.create=function(d){d=d||{};var v={positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},gravity:{x:0,y:1,scale:.001},timing:{timestamp:0,timeScale:1,lastDelta:0,lastElapsed:0}},m=o.extend(v,d);return m.world=d.world||u.create({label:"World"}),m.pairs=d.pairs||l.create(),m.detector=d.detector||a.create(),m.grid={buckets:[]},m.world.gravity=m.gravity,m.broadphase=m.grid,m.metrics={},m},r.update=function(d,v){var m=o.now(),S=d.world,M=d.detector,w=d.pairs,C=d.timing,A=C.timestamp,P;v=typeof v<"u"?v:o._baseDelta,v*=C.timeScale,C.timestamp+=v,C.lastDelta=v;var b={timestamp:C.timestamp,delta:v};n.trigger(d,"beforeUpdate",b);var O=u.allBodies(S),I=u.allConstraints(S);for(S.isModified&&(a.setBodies(M,O),u.setModified(S,!1,!1,!0)),d.enableSleeping&&p.update(O,v),r._bodiesApplyGravity(O,d.gravity),v>0&&r._bodiesUpdate(O,v),n.trigger(d,"beforeSolve",b),f.preSolveAll(O),P=0;P0&&n.trigger(d,"collisionStart",{pairs:w.collisionStart,timestamp:C.timestamp,delta:v});var B=o.clamp(20/d.positionIterations,0,1);for(h.preSolvePosition(w.list),P=0;P0&&n.trigger(d,"collisionActive",{pairs:w.collisionActive,timestamp:C.timestamp,delta:v}),w.collisionEnd.length>0&&n.trigger(d,"collisionEnd",{pairs:w.collisionEnd,timestamp:C.timestamp,delta:v}),r._bodiesClearForces(O),n.trigger(d,"afterUpdate",b),d.timing.lastElapsed=o.now()-m,d},r.merge=function(d,v){if(o.extend(d,v),v.world){d.world=v.world,r.clear(d);for(var m=u.allBodies(d.world),S=0;S{var r={};s.exports=r;var p=e(53402);(function(){r.on=function(h,a,l){for(var n=a.split(" "),u,f=0;f0){l||(l={}),n=a.split(" ");for(var d=0;d{var r={};s.exports=r;var p=e(73832),h=e(53402);(function(){r.name="matter-js",r.version="0.19.0",r.uses=[],r.used=[],r.use=function(){p.use(r,Array.prototype.slice.call(arguments))},r.before=function(a,l){return a=a.replace(/^Matter./,""),h.chainPathBefore(r,a,l)},r.after=function(a,l){return a=a.replace(/^Matter./,""),h.chainPathAfter(r,a,l)}})()},73832:(s,y,e)=>{var r={};s.exports=r;var p=e(53402);(function(){r._registry={},r.register=function(h){if(r.isPlugin(h)||p.warn("Plugin.register:",r.toString(h),"does not implement all required fields."),h.name in r._registry){var a=r._registry[h.name],l=r.versionParse(h.version).number,n=r.versionParse(a.version).number;l>n?(p.warn("Plugin.register:",r.toString(a),"was upgraded to",r.toString(h)),r._registry[h.name]=h):l-1},r.isFor=function(h,a){var l=h.for&&r.dependencyParse(h.for);return!h.for||a.name===l.name&&r.versionSatisfies(a.version,l.range)},r.use=function(h,a){if(h.uses=(h.uses||[]).concat(a||[]),h.uses.length===0){p.warn("Plugin.use:",r.toString(h),"does not specify any dependencies to install.");return}for(var l=r.dependencies(h),n=p.topologicalSort(l),u=[],f=0;f0&&!o.silent&&p.info(u.join(" "))},r.dependencies=function(h,a){var l=r.dependencyParse(h),n=l.name;if(a=a||{},!(n in a)){h=r.resolve(h)||h,a[n]=p.map(h.uses||[],function(f){r.isPlugin(f)&&r.register(f);var o=r.dependencyParse(f),c=r.resolve(f);return c&&!r.versionSatisfies(c.version,o.range)?(p.warn("Plugin.dependencies:",r.toString(c),"does not satisfy",r.toString(o),"used by",r.toString(l)+"."),c._warned=!0,h._warned=!0):c||(p.warn("Plugin.dependencies:",r.toString(f),"used by",r.toString(l),"could not be resolved."),h._warned=!0),o.name});for(var u=0;u=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-+]+)?$/;a.test(h)||p.warn("Plugin.versionParse:",h,"is not a valid version or range.");var l=a.exec(h),n=Number(l[4]),u=Number(l[5]),f=Number(l[6]);return{isRange:!!(l[1]||l[2]),version:l[3],range:h,operator:l[1]||l[2]||"",major:n,minor:u,patch:f,parts:[n,u,f],prerelease:l[7],number:n*1e8+u*1e4+f}},r.versionSatisfies=function(h,a){a=a||"*";var l=r.versionParse(a),n=r.versionParse(h);if(l.isRange){if(l.operator==="*"||h==="*")return!0;if(l.operator===">")return n.number>l.number;if(l.operator===">=")return n.number>=l.number;if(l.operator==="~")return n.major===l.major&&n.minor===l.minor&&n.patch>=l.patch;if(l.operator==="^")return l.major>0?n.major===l.major&&n.number>=l.number:l.minor>0?n.minor===l.minor&&n.patch>=l.patch:n.patch===l.patch}return h===a||h==="*"}})()},53614:(s,y,e)=>{var r={};s.exports=r;var p=e(22562),h=e(35810),a=e(53402);(function(){r._motionWakeThreshold=.18,r._motionSleepThreshold=.08,r._minBias=.9,r.update=function(l,n){for(var u=n/a._baseDelta,f=r._motionSleepThreshold,o=0;o0&&c.motion=c.sleepThreshold/u&&r.set(c,!0)):c.sleepCounter>0&&(c.sleepCounter-=1)}},r.afterCollisions=function(l){for(var n=r._motionSleepThreshold,u=0;un&&r.set(v,!1)}}}},r.set=function(l,n){var u=l.isSleeping;n?(l.isSleeping=!0,l.sleepCounter=l.sleepThreshold,l.positionImpulse.x=0,l.positionImpulse.y=0,l.positionPrev.x=l.position.x,l.positionPrev.y=l.position.y,l.anglePrev=l.angle,l.speed=0,l.angularSpeed=0,l.motion=0,u||h.trigger(l,"sleepStart")):(l.isSleeping=!1,l.sleepCounter=0,u&&h.trigger(l,"sleepEnd"))}})()},66280:(s,y,e)=>{var r={};s.exports=r;var p=e(41598),h=e(53402),a=e(22562),l=e(15647),n=e(31725);(function(){r.rectangle=function(u,f,o,c,d){d=d||{};var v={label:"Rectangle Body",position:{x:u,y:f},vertices:p.fromPath("L 0 0 L "+o+" 0 L "+o+" "+c+" L 0 "+c)};if(d.chamfer){var m=d.chamfer;v.vertices=p.chamfer(v.vertices,m.radius,m.quality,m.qualityMin,m.qualityMax),delete d.chamfer}return a.create(h.extend({},v,d))},r.trapezoid=function(u,f,o,c,d,v){v=v||{},d*=.5;var m=(1-d*2)*o,S=o*d,M=S+m,w=M+S,C;d<.5?C="L 0 0 L "+S+" "+-c+" L "+M+" "+-c+" L "+w+" 0":C="L 0 0 L "+M+" "+-c+" L "+w+" 0";var A={label:"Trapezoid Body",position:{x:u,y:f},vertices:p.fromPath(C)};if(v.chamfer){var P=v.chamfer;A.vertices=p.chamfer(A.vertices,P.radius,P.quality,P.qualityMin,P.qualityMax),delete v.chamfer}return a.create(h.extend({},A,v))},r.circle=function(u,f,o,c,d){c=c||{};var v={label:"Circle Body",circleRadius:o};d=d||25;var m=Math.ceil(Math.max(10,Math.min(d,o)));return m%2===1&&(m+=1),r.polygon(u,f,m,o,h.extend({},v,c))},r.polygon=function(u,f,o,c,d){if(d=d||{},o<3)return r.circle(u,f,c,d);for(var v=2*Math.PI/o,m="",S=v*.5,M=0;M0&&p.area(tt)1?(C=a.create(h.extend({parts:A.slice(0)},c)),a.setPosition(C,{x:u,y:f}),C):A[0]},r.flagCoincidentParts=function(u,f){f===void 0&&(f=5);for(var o=0;o{var r={};s.exports=r;var p=e(69351),h=e(48140),a=e(53402),l=e(22562),n=e(66280);(function(){r.stack=function(u,f,o,c,d,v,m){for(var S=p.create({label:"Stack"}),M=u,w=f,C,A=0,P=0;Pb&&(b=D),l.translate(I,{x:B*.5,y:D*.5}),M=I.bounds.max.x+d,p.addBody(S,I),C=I,A+=1}else M+=d}w+=b+v,M=u}return S},r.chain=function(u,f,o,c,d,v){for(var m=u.bodies,S=1;S0)for(S=0;S0&&(C=v[S-1+(m-1)*f],p.addConstraint(u,h.create(a.extend({bodyA:C,bodyB:w},d)))),c&&Sb)){C=b-C;var I=C,D=o-1-C;if(!(wD)){P===1&&l.translate(A,{x:(w+(o%2===1?1:-1))*O,y:0});var B=A?w*O:0;return m(u+B+w*d,M,w,C,A,P)}}})},r.newtonsCradle=function(u,f,o,c,d){for(var v=p.create({label:"Newtons Cradle"}),m=0;m{var r={};s.exports=r;var p=e(31725),h=e(53402);(function(){r.fromVertices=function(a){for(var l={},n=0;n{var y={};s.exports=y,function(){y.create=function(e){var r={min:{x:0,y:0},max:{x:0,y:0}};return e&&y.update(r,e),r},y.update=function(e,r,p){e.min.x=1/0,e.max.x=-1/0,e.min.y=1/0,e.max.y=-1/0;for(var h=0;he.max.x&&(e.max.x=a.x),a.xe.max.y&&(e.max.y=a.y),a.y0?e.max.x+=p.x:e.min.x+=p.x,p.y>0?e.max.y+=p.y:e.min.y+=p.y)},y.contains=function(e,r){return r.x>=e.min.x&&r.x<=e.max.x&&r.y>=e.min.y&&r.y<=e.max.y},y.overlaps=function(e,r){return e.min.x<=r.max.x&&e.max.x>=r.min.x&&e.max.y>=r.min.y&&e.min.y<=r.max.y},y.translate=function(e,r){e.min.x+=r.x,e.max.x+=r.x,e.min.y+=r.y,e.max.y+=r.y},y.shift=function(e,r){var p=e.max.x-e.min.x,h=e.max.y-e.min.y;e.min.x=r.x,e.max.x=r.x+p,e.min.y=r.y,e.max.y=r.y+h}}()},74058:(s,y,e)=>{var r={};s.exports=r,e(15647);var p=e(53402);(function(){r.pathToVertices=function(h,a){typeof window<"u"&&!("SVGPathSeg"in window)&&p.warn("Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.");var l,n,u,f,o,c,d,v,m,S,M=[],w,C,A=0,P=0,b=0;a=a||15;var O=function(D,B,G){var z=G%2===1&&G>1;if(!m||D!=m.x||B!=m.y){m&&z?(w=m.x,C=m.y):(w=0,C=0);var X={x:w+D,y:C+B};(z||!m)&&(m=X),M.push(X),P=w+D,b=C+B}},I=function(D){var B=D.pathSegTypeAsLetter.toUpperCase();if(B!=="Z"){switch(B){case"M":case"L":case"T":case"C":case"S":case"Q":P=D.x,b=D.y;break;case"H":P=D.x;break;case"V":b=D.y;break}O(P,b,D.pathSegType)}};for(r._svgPathToAbsolute(h),u=h.getTotalLength(),c=[],l=0;l{var y={};s.exports=y,function(){y.create=function(e,r){return{x:e||0,y:r||0}},y.clone=function(e){return{x:e.x,y:e.y}},y.magnitude=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},y.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},y.rotate=function(e,r,p){var h=Math.cos(r),a=Math.sin(r);p||(p={});var l=e.x*h-e.y*a;return p.y=e.x*a+e.y*h,p.x=l,p},y.rotateAbout=function(e,r,p,h){var a=Math.cos(r),l=Math.sin(r);h||(h={});var n=p.x+((e.x-p.x)*a-(e.y-p.y)*l);return h.y=p.y+((e.x-p.x)*l+(e.y-p.y)*a),h.x=n,h},y.normalise=function(e){var r=y.magnitude(e);return r===0?{x:0,y:0}:{x:e.x/r,y:e.y/r}},y.dot=function(e,r){return e.x*r.x+e.y*r.y},y.cross=function(e,r){return e.x*r.y-e.y*r.x},y.cross3=function(e,r,p){return(r.x-e.x)*(p.y-e.y)-(r.y-e.y)*(p.x-e.x)},y.add=function(e,r,p){return p||(p={}),p.x=e.x+r.x,p.y=e.y+r.y,p},y.sub=function(e,r,p){return p||(p={}),p.x=e.x-r.x,p.y=e.y-r.y,p},y.mult=function(e,r){return{x:e.x*r,y:e.y*r}},y.div=function(e,r){return{x:e.x/r,y:e.y/r}},y.perp=function(e,r){return r=r===!0?-1:1,{x:r*-e.y,y:r*e.x}},y.neg=function(e){return{x:-e.x,y:-e.y}},y.angle=function(e,r){return Math.atan2(r.y-e.y,r.x-e.x)},y._temp=[y.create(),y.create(),y.create(),y.create(),y.create(),y.create()]}()},41598:(s,y,e)=>{var r={};s.exports=r;var p=e(31725),h=e(53402);(function(){r.create=function(a,l){for(var n=[],u=0;u0)return!1;o=c}return!0},r.scale=function(a,l,n,u){if(l===1&&n===1)return a;u=u||r.centre(a);for(var f,o,c=0;c=0?c-1:a.length-1],v=a[c],m=a[(c+1)%a.length],S=l[c0&&(l|=2),l===3)return!1;return l!==0?!0:null},r.hull=function(a){var l=[],n=[],u,f;for(a=a.slice(0),a.sort(function(o,c){var d=o.x-c.x;return d!==0?d:o.y-c.y}),f=0;f=2&&p.cross3(n[n.length-2],n[n.length-1],u)<=0;)n.pop();n.push(u)}for(f=a.length-1;f>=0;f-=1){for(u=a[f];l.length>=2&&p.cross3(l[l.length-2],l[l.length-1],u)<=0;)l.pop();l.push(u)}return l.pop(),n.pop(),l.concat(n)}})()},18210:(s,y,e)=>{var r=e(19933),p={name:"matter-attractors",version:"0.1.7",for:"matter-js@^0.19.0",silent:!0,install:function(h){h.after("Body.create",function(){p.Body.init(this)}),h.before("Engine.update",function(a){p.Engine.update(a)})},Body:{init:function(h){h.plugin.attractors=h.plugin.attractors||[]}},Engine:{update:function(h){for(var a=r.Composite.allBodies(h.world),l=0;l0)for(var f=0;f{/** * @author @dxu https://github.com/dxu/matter-collision-events * @author Richard Davey * @license {@link https://opensource.org/licenses/MIT|MIT License} */var y={name:"matter-collision-events",version:"0.1.6",for:"matter-js@^0.19.0",silent:!0,install:function(e){e.after("Engine.create",function(){e.Events.on(this,"collisionStart",function(r){r.pairs.map(function(p){var h=p.bodyA,a=p.bodyB;h.gameObject&&h.gameObject.emit("collide",h,a,p),a.gameObject&&a.gameObject.emit("collide",a,h,p),e.Events.trigger(h,"onCollide",{pair:p}),e.Events.trigger(a,"onCollide",{pair:p}),h.onCollideCallback&&h.onCollideCallback(p),a.onCollideCallback&&a.onCollideCallback(p),h.onCollideWith[a.id]&&h.onCollideWith[a.id](a,p),a.onCollideWith[h.id]&&a.onCollideWith[h.id](h,p)})}),e.Events.on(this,"collisionActive",function(r){r.pairs.map(function(p){var h=p.bodyA,a=p.bodyB;h.gameObject&&h.gameObject.emit("collideActive",h,a,p),a.gameObject&&a.gameObject.emit("collideActive",a,h,p),e.Events.trigger(h,"onCollideActive",{pair:p}),e.Events.trigger(a,"onCollideActive",{pair:p}),h.onCollideActiveCallback&&h.onCollideActiveCallback(p),a.onCollideActiveCallback&&a.onCollideActiveCallback(p)})}),e.Events.on(this,"collisionEnd",function(r){r.pairs.map(function(p){var h=p.bodyA,a=p.bodyB;h.gameObject&&h.gameObject.emit("collideEnd",h,a,p),a.gameObject&&a.gameObject.emit("collideEnd",a,h,p),e.Events.trigger(h,"onCollideEnd",{pair:p}),e.Events.trigger(a,"onCollideEnd",{pair:p}),h.onCollideEndCallback&&h.onCollideEndCallback(p),a.onCollideEndCallback&&a.onCollideEndCallback(p)})})})}};s.exports=y},74507:(s,y,e)=>{var r=e(19933),p={name:"matter-wrap",version:"0.1.4",for:"matter-js@^0.19.0",silent:!0,install:function(h){h.after("Engine.update",function(){p.Engine.update(this)})},Engine:{update:function(h){for(var a=h.world,l=r.Composite.allBodies(a),n=r.Composite.allComposites(a),u=0;ua.max.x?l=a.min.x-h.max.x:h.max.xa.max.y?n=a.min.y-h.max.y:h.max.y{/** * @author Stefan Hedman (http://steffe.se) * @license {@link https://opensource.org/licenses/MIT|MIT License} - */s.exports={decomp:I,quickDecomp:z,isSimple:B,removeCollinearPoints:X,removeDuplicatePoints:K,makeCCW:m};function y(Y,Z,U){U=U||0;var H=[0,0],J,_,q,at,ot,rt,gt;return J=Y[1][1]-Y[0][1],_=Y[0][0]-Y[1][0],q=J*Y[0][0]+_*Y[0][1],at=Z[1][1]-Z[0][1],ot=Z[0][0]-Z[1][0],rt=at*Z[0][0]+ot*Z[0][1],gt=J*ot-at*_,Q(gt,0,U)||(H[0]=(ot*q-_*rt)/gt,H[1]=(J*rt-at*q)/gt),H}function e(Y,Z,U,H){var J=Z[0]-Y[0],_=Z[1]-Y[1],q=H[0]-U[0],at=H[1]-U[1];if(q*_-at*J===0)return!1;var ot=(J*(U[1]-Y[1])+_*(Y[0]-U[0]))/(q*_-at*J),rt=(q*(Y[1]-U[1])+at*(U[0]-Y[0]))/(at*J-q*_);return ot>=0&&ot<=1&&rt>=0&&rt<=1}function r(Y,Z,U){return(Z[0]-Y[0])*(U[1]-Y[1])-(U[0]-Y[0])*(Z[1]-Y[1])}function p(Y,Z,U){return r(Y,Z,U)>0}function h(Y,Z,U){return r(Y,Z,U)>=0}function a(Y,Z,U){return r(Y,Z,U)<0}function l(Y,Z,U){return r(Y,Z,U)<=0}var n=[],u=[];function f(Y,Z,U,H){if(H){var J=n,_=u;J[0]=Z[0]-Y[0],J[1]=Z[1]-Y[1],_[0]=U[0]-Z[0],_[1]=U[1]-Z[1];var q=J[0]*_[0]+J[1]*_[1],at=Math.sqrt(J[0]*J[0]+J[1]*J[1]),ot=Math.sqrt(_[0]*_[0]+_[1]*_[1]),rt=Math.acos(q/(at*ot));return rtU[Z][0])&&(Z=H);return p(c(Y,Z-1),c(Y,Z),c(Y,Z+1))?!1:(S(Y),!0)}function S(Y){for(var Z=[],U=Y.length,H=0;H!==U;H++)Z.push(Y.pop());for(var H=0;H!==U;H++)Y[H]=Z[H]}function M(Y,Z){return a(c(Y,Z-1),c(Y,Z),c(Y,Z+1))}var w=[],C=[];function A(Y,Z,U){var H,J,_=w,q=C;if(h(c(Y,Z+1),c(Y,Z),c(Y,U))&&l(c(Y,Z-1),c(Y,Z),c(Y,U)))return!1;J=o(c(Y,Z),c(Y,U));for(var at=0;at!==Y.length;++at)if(!((at+1)%Y.length===Z||at===Z)&&h(c(Y,Z),c(Y,U),c(Y,at+1))&&l(c(Y,Z),c(Y,U),c(Y,at))&&(_[0]=c(Y,Z),_[1]=c(Y,U),q[0]=c(Y,at),q[1]=c(Y,at+1),H=y(_,q),o(c(Y,Z),H)0?D(Y,Z):[Y]}function D(Y,Z){if(Z.length===0)return[Y];if(Z instanceof Array&&Z.length&&Z[0]instanceof Array&&Z[0].length===2&&Z[0][0]instanceof Array){for(var U=[Y],H=0;H_)return console.warn("quickDecomp: max level ("+_+") reached."),Z;for(var Bt=0;BtPt&&(Pt+=Y.length),At=Number.MAX_VALUE,Pt3&&H>=0;--H)f(c(Y,H-1),c(Y,H),c(Y,H+1),Z)&&(Y.splice(H%Y.length,1),U++);return U}function K(Y,Z){for(var U=Y.length-1;U>=1;--U)for(var H=Y[U],J=U-1;J>=0;--J)if(tt(H,Y[J],Z)){Y.splice(U,1);continue}}function Q(Y,Z,U){return U=U||0,Math.abs(Y-Z)<=U}function tt(Y,Z,U){return Q(Y[0],Z[0],U)&&Q(Y[1],Z[1],U)}},52018:(s,y,e)=>{/** + */s.exports={decomp:I,quickDecomp:z,isSimple:B,removeCollinearPoints:X,removeDuplicatePoints:j,makeCCW:m};function y(Y,Z,U){U=U||0;var H=[0,0],J,_,q,at,ot,rt,gt;return J=Y[1][1]-Y[0][1],_=Y[0][0]-Y[1][0],q=J*Y[0][0]+_*Y[0][1],at=Z[1][1]-Z[0][1],ot=Z[0][0]-Z[1][0],rt=at*Z[0][0]+ot*Z[0][1],gt=J*ot-at*_,Q(gt,0,U)||(H[0]=(ot*q-_*rt)/gt,H[1]=(J*rt-at*q)/gt),H}function e(Y,Z,U,H){var J=Z[0]-Y[0],_=Z[1]-Y[1],q=H[0]-U[0],at=H[1]-U[1];if(q*_-at*J===0)return!1;var ot=(J*(U[1]-Y[1])+_*(Y[0]-U[0]))/(q*_-at*J),rt=(q*(Y[1]-U[1])+at*(U[0]-Y[0]))/(at*J-q*_);return ot>=0&&ot<=1&&rt>=0&&rt<=1}function r(Y,Z,U){return(Z[0]-Y[0])*(U[1]-Y[1])-(U[0]-Y[0])*(Z[1]-Y[1])}function p(Y,Z,U){return r(Y,Z,U)>0}function h(Y,Z,U){return r(Y,Z,U)>=0}function a(Y,Z,U){return r(Y,Z,U)<0}function l(Y,Z,U){return r(Y,Z,U)<=0}var n=[],u=[];function f(Y,Z,U,H){if(H){var J=n,_=u;J[0]=Z[0]-Y[0],J[1]=Z[1]-Y[1],_[0]=U[0]-Z[0],_[1]=U[1]-Z[1];var q=J[0]*_[0]+J[1]*_[1],at=Math.sqrt(J[0]*J[0]+J[1]*J[1]),ot=Math.sqrt(_[0]*_[0]+_[1]*_[1]),rt=Math.acos(q/(at*ot));return rtU[Z][0])&&(Z=H);return p(c(Y,Z-1),c(Y,Z),c(Y,Z+1))?!1:(S(Y),!0)}function S(Y){for(var Z=[],U=Y.length,H=0;H!==U;H++)Z.push(Y.pop());for(var H=0;H!==U;H++)Y[H]=Z[H]}function M(Y,Z){return a(c(Y,Z-1),c(Y,Z),c(Y,Z+1))}var w=[],C=[];function A(Y,Z,U){var H,J,_=w,q=C;if(h(c(Y,Z+1),c(Y,Z),c(Y,U))&&l(c(Y,Z-1),c(Y,Z),c(Y,U)))return!1;J=o(c(Y,Z),c(Y,U));for(var at=0;at!==Y.length;++at)if(!((at+1)%Y.length===Z||at===Z)&&h(c(Y,Z),c(Y,U),c(Y,at+1))&&l(c(Y,Z),c(Y,U),c(Y,at))&&(_[0]=c(Y,Z),_[1]=c(Y,U),q[0]=c(Y,at),q[1]=c(Y,at+1),H=y(_,q),o(c(Y,Z),H)0?D(Y,Z):[Y]}function D(Y,Z){if(Z.length===0)return[Y];if(Z instanceof Array&&Z.length&&Z[0]instanceof Array&&Z[0].length===2&&Z[0][0]instanceof Array){for(var U=[Y],H=0;H_)return console.warn("quickDecomp: max level ("+_+") reached."),Z;for(var Bt=0;BtPt&&(Pt+=Y.length),At=Number.MAX_VALUE,Pt3&&H>=0;--H)f(c(Y,H-1),c(Y,H),c(Y,H+1),Z)&&(Y.splice(H%Y.length,1),U++);return U}function j(Y,Z){for(var U=Y.length-1;U>=1;--U)for(var H=Y[U],J=U-1;J>=0;--J)if(tt(H,Y[J],Z)){Y.splice(U,1);continue}}function Q(Y,Z,U){return U=U||0,Math.abs(Y-Z)<=U}function tt(Y,Z,U){return Q(Y[0],Z[0],U)&&Q(Y[1],Z[1],U)}},52018:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} @@ -4635,7 +4635,7 @@ return new `+this.key+`(); * @author Felipe Alfonso <@bitnenfer> * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(19715),p=e(32880),h=e(83419),a=e(8054),l=e(50792),n=e(92503),u=e(56373),f=e(97480),o=e(69442),c=e(61340),d=new h({Extends:l,initialize:function(m){l.call(this);var S=m.config;this.config={clearBeforeRender:S.clearBeforeRender,backgroundColor:S.backgroundColor,antialias:S.antialias,roundPixels:S.roundPixels},this.game=m,this.type=a.CANVAS,this.drawCount=0,this.width=0,this.height=0,this.gameCanvas=m.canvas;var M={alpha:m.config.transparent,desynchronized:m.config.desynchronized,willReadFrequently:!1};this.gameContext=S.context?S.context:this.gameCanvas.getContext("2d",M),this.currentContext=this.gameContext,this.antialias=m.config.antialias,this.blendModes=u(),this.snapshotState={x:0,y:0,width:1,height:1,getPixel:!1,callback:null,type:"image/png",encoder:.92},this._tempMatrix1=new c,this._tempMatrix2=new c,this._tempMatrix3=new c,this.isBooted=!1,this.init()},init:function(){this.game.textures.once(o.READY,this.boot,this)},boot:function(){var v=this.game,m=v.scale.baseSize;this.width=m.width,this.height=m.height,this.isBooted=!0,v.scale.on(f.RESIZE,this.onResize,this),this.resize(m.width,m.height)},onResize:function(v,m){(m.width!==this.width||m.height!==this.height)&&this.resize(m.width,m.height)},resize:function(v,m){this.width=v,this.height=m,this.emit(n.RESIZE,v,m)},resetTransform:function(){this.currentContext.setTransform(1,0,0,1,0,0)},setBlendMode:function(v){return this.currentContext.globalCompositeOperation=v,this},setContext:function(v){return this.currentContext=v||this.gameContext,this},setAlpha:function(v){return this.currentContext.globalAlpha=v,this},preRender:function(){var v=this.gameContext,m=this.config,S=this.width,M=this.height;v.globalAlpha=1,v.globalCompositeOperation="source-over",v.setTransform(1,0,0,1,0,0),m.clearBeforeRender&&(v.clearRect(0,0,S,M),m.transparent||(v.fillStyle=m.backgroundColor.rgba,v.fillRect(0,0,S,M))),v.save(),this.drawCount=0,this.emit(n.PRE_RENDER)},render:function(v,m,S){var M=m.length;this.emit(n.RENDER,v,S);var w=S.x,C=S.y,A=S.width,P=S.height,b=S.renderToTexture?S.context:v.sys.context;b.save(),this.game.scene.customViewports&&(b.beginPath(),b.rect(w,C,A,P),b.clip()),S.emit(r.PRE_RENDER,S),this.currentContext=b;var O=S.mask;O&&O.preRenderCanvas(this,null,S._maskCamera),S.transparent||(b.fillStyle=S.backgroundColor.rgba,b.fillRect(w,C,A,P)),b.globalAlpha=S.alpha,b.globalCompositeOperation="source-over",this.drawCount+=M,S.renderToTexture&&S.emit(r.PRE_RENDER,S),S.matrix.copyToContext(b);for(var I=0;I=0?Q=-(Q+D):Q<0&&(Q=Math.abs(Q)-D)),v.flipY&&(tt>=0?tt=-(tt+B):tt<0&&(tt=Math.abs(tt)-B))}var Z=1,U=1;v.flipX&&(G||(Q+=-m.realWidth+X*2),Z=-1),v.flipY&&(G||(tt+=-m.realHeight+K*2),U=-1);var H=v.x,J=v.y;P.applyITRS(H,J,v.rotation,v.scaleX*Z,v.scaleY*U),A.copyFrom(S.matrix),M?(A.multiplyWithOffset(M,-S.scrollX*v.scrollFactorX,-S.scrollY*v.scrollFactorY),P.e=H,P.f=J):(P.e-=S.scrollX*v.scrollFactorX,P.f-=S.scrollY*v.scrollFactorY),A.multiply(P),S.roundPixels&&(A.e=Math.round(A.e),A.f=Math.round(A.f)),C.save(),A.setToContext(C),C.globalCompositeOperation=this.blendModes[v.blendMode],C.globalAlpha=w,C.imageSmoothingEnabled=!m.source.scaleMode,v.mask&&v.mask.preRenderCanvas(this,v,S),D>0&&B>0&&(S.roundPixels?C.drawImage(m.source.image,O,I,D,B,Math.round(Q),Math.round(tt),Math.round(D/z),Math.round(B/z)):C.drawImage(m.source.image,O,I,D,B,Q,tt,D/z,B/z)),v.mask&&v.mask.postRenderCanvas(this,v,S),C.restore()}},destroy:function(){this.removeAllListeners(),this.game=null,this.gameCanvas=null,this.gameContext=null}});s.exports=d},55830:(s,y,e)=>{/** + */var r=e(19715),p=e(32880),h=e(83419),a=e(8054),l=e(50792),n=e(92503),u=e(56373),f=e(97480),o=e(69442),c=e(61340),d=new h({Extends:l,initialize:function(m){l.call(this);var S=m.config;this.config={clearBeforeRender:S.clearBeforeRender,backgroundColor:S.backgroundColor,antialias:S.antialias,roundPixels:S.roundPixels},this.game=m,this.type=a.CANVAS,this.drawCount=0,this.width=0,this.height=0,this.gameCanvas=m.canvas;var M={alpha:m.config.transparent,desynchronized:m.config.desynchronized,willReadFrequently:!1};this.gameContext=S.context?S.context:this.gameCanvas.getContext("2d",M),this.currentContext=this.gameContext,this.antialias=m.config.antialias,this.blendModes=u(),this.snapshotState={x:0,y:0,width:1,height:1,getPixel:!1,callback:null,type:"image/png",encoder:.92},this._tempMatrix1=new c,this._tempMatrix2=new c,this._tempMatrix3=new c,this.isBooted=!1,this.init()},init:function(){this.game.textures.once(o.READY,this.boot,this)},boot:function(){var v=this.game,m=v.scale.baseSize;this.width=m.width,this.height=m.height,this.isBooted=!0,v.scale.on(f.RESIZE,this.onResize,this),this.resize(m.width,m.height)},onResize:function(v,m){(m.width!==this.width||m.height!==this.height)&&this.resize(m.width,m.height)},resize:function(v,m){this.width=v,this.height=m,this.emit(n.RESIZE,v,m)},resetTransform:function(){this.currentContext.setTransform(1,0,0,1,0,0)},setBlendMode:function(v){return this.currentContext.globalCompositeOperation=v,this},setContext:function(v){return this.currentContext=v||this.gameContext,this},setAlpha:function(v){return this.currentContext.globalAlpha=v,this},preRender:function(){var v=this.gameContext,m=this.config,S=this.width,M=this.height;v.globalAlpha=1,v.globalCompositeOperation="source-over",v.setTransform(1,0,0,1,0,0),m.clearBeforeRender&&(v.clearRect(0,0,S,M),m.transparent||(v.fillStyle=m.backgroundColor.rgba,v.fillRect(0,0,S,M))),v.save(),this.drawCount=0,this.emit(n.PRE_RENDER)},render:function(v,m,S){var M=m.length;this.emit(n.RENDER,v,S);var w=S.x,C=S.y,A=S.width,P=S.height,b=S.renderToTexture?S.context:v.sys.context;b.save(),this.game.scene.customViewports&&(b.beginPath(),b.rect(w,C,A,P),b.clip()),S.emit(r.PRE_RENDER,S),this.currentContext=b;var O=S.mask;O&&O.preRenderCanvas(this,null,S._maskCamera),S.transparent||(b.fillStyle=S.backgroundColor.rgba,b.fillRect(w,C,A,P)),b.globalAlpha=S.alpha,b.globalCompositeOperation="source-over",this.drawCount+=M,S.renderToTexture&&S.emit(r.PRE_RENDER,S),S.matrix.copyToContext(b);for(var I=0;I=0?Q=-(Q+D):Q<0&&(Q=Math.abs(Q)-D)),v.flipY&&(tt>=0?tt=-(tt+B):tt<0&&(tt=Math.abs(tt)-B))}var Z=1,U=1;v.flipX&&(G||(Q+=-m.realWidth+X*2),Z=-1),v.flipY&&(G||(tt+=-m.realHeight+j*2),U=-1);var H=v.x,J=v.y;P.applyITRS(H,J,v.rotation,v.scaleX*Z,v.scaleY*U),A.copyFrom(S.matrix),M?(A.multiplyWithOffset(M,-S.scrollX*v.scrollFactorX,-S.scrollY*v.scrollFactorY),P.e=H,P.f=J):(P.e-=S.scrollX*v.scrollFactorX,P.f-=S.scrollY*v.scrollFactorY),A.multiply(P),S.roundPixels&&(A.e=Math.round(A.e),A.f=Math.round(A.f)),C.save(),A.setToContext(C),C.globalCompositeOperation=this.blendModes[v.blendMode],C.globalAlpha=w,C.imageSmoothingEnabled=!m.source.scaleMode,v.mask&&v.mask.preRenderCanvas(this,v,S),D>0&&B>0&&(S.roundPixels?C.drawImage(m.source.image,O,I,D,B,Math.round(Q),Math.round(tt),Math.round(D/z),Math.round(B/z)):C.drawImage(m.source.image,O,I,D,B,Q,tt,D/z,B/z)),v.mask&&v.mask.postRenderCanvas(this,v,S),C.restore()}},destroy:function(){this.removeAllListeners(),this.game=null,this.gameCanvas=null,this.gameContext=null}});s.exports=d},55830:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -4687,7 +4687,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(27919),p=e(40987),h=e(95540),a=function(l,n){var u=l,f=h(n,"callback"),o=h(n,"type","image/png"),c=h(n,"encoder",.92),d=Math.abs(Math.round(h(n,"x",0))),v=Math.abs(Math.round(h(n,"y",0))),m=h(n,"getPixel",!1),S=h(n,"isFramebuffer",!1),M=S?h(n,"bufferWidth",1):u.drawingBufferWidth,w=S?h(n,"bufferHeight",1):u.drawingBufferHeight;if(m){var C=new Uint8Array(4),A=S?v:w-v;u.readPixels(d,A,1,1,u.RGBA,u.UNSIGNED_BYTE,C),f.call(null,new p(C[0],C[1],C[2],C[3]))}else{var P=Math.floor(h(n,"width",M)),b=Math.floor(h(n,"height",w)),O=P*b*4,I=new Uint8Array(O);u.readPixels(d,w-v-b,P,b,u.RGBA,u.UNSIGNED_BYTE,I);for(var D=r.createWebGL(this,P,b),B=D.getContext("2d",{willReadFrequently:!0}),G=B.getImageData(0,0,P,b),z=G.data,X=0;X{/** + */var r=e(27919),p=e(40987),h=e(95540),a=function(l,n){var u=l,f=h(n,"callback"),o=h(n,"type","image/png"),c=h(n,"encoder",.92),d=Math.abs(Math.round(h(n,"x",0))),v=Math.abs(Math.round(h(n,"y",0))),m=h(n,"getPixel",!1),S=h(n,"isFramebuffer",!1),M=S?h(n,"bufferWidth",1):u.drawingBufferWidth,w=S?h(n,"bufferHeight",1):u.drawingBufferHeight;if(m){var C=new Uint8Array(4),A=S?v:w-v;u.readPixels(d,A,1,1,u.RGBA,u.UNSIGNED_BYTE,C),f.call(null,new p(C[0],C[1],C[2],C[3]))}else{var P=Math.floor(h(n,"width",M)),b=Math.floor(h(n,"height",w)),O=P*b*4,I=new Uint8Array(O);u.readPixels(d,w-v-b,P,b,u.RGBA,u.UNSIGNED_BYTE,I);for(var D=r.createWebGL(this,P,b),B=D.getContext("2d",{willReadFrequently:!0}),G=B.getImageData(0,0,P,b),z=G.data,X=0;X{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -4695,7 +4695,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83419),p=e(36060),h=e(90330),a=e(82264),l=e(95540),n=e(32302),u=e(63448),f=e(31302),o=e(58918),c=e(14811),d=e(92651),v=e(96569),m=e(56527),S=e(57516),M=e(43439),w=e(81041),C=e(12385),A=e(7589),P=e(95428),b=e(72905),O=new r({initialize:function(D){this.game=D.game,this.renderer=D,this.classes=new h([[p.UTILITY_PIPELINE,A],[p.MULTI_PIPELINE,S],[p.BITMAPMASK_PIPELINE,f],[p.SINGLE_PIPELINE,C],[p.ROPE_PIPELINE,w],[p.LIGHT_PIPELINE,v],[p.POINTLIGHT_PIPELINE,M],[p.MOBILE_PIPELINE,m]]),this.postPipelineClasses=new h,this.pipelines=new h,this.postPipelineInstances=[],this.default=null,this.current=null,this.previous=null,this.MULTI_PIPELINE=null,this.BITMAPMASK_PIPELINE=null,this.UTILITY_PIPELINE=null,this.MOBILE_PIPELINE=null,this.FX_PIPELINE=null,this.fullFrame1,this.fullFrame2,this.halfFrame1,this.halfFrame2,this.renderTargets=[],this.maxDimension=0,this.frameInc=32,this.targetIndex=0},boot:function(I,D,B){var G=this.renderer,z=this.renderTargets;this.frameInc=Math.floor(l(I,"frameInc",32));var X=G.width,K=G.height,Q=this.game.config.disablePreFX,tt=this.game.config.disablePostFX;if(tt||this.postPipelineClasses.setAll([[String(c.BARREL),o.Barrel],[String(c.BLOOM),o.Bloom],[String(c.BLUR),o.Blur],[String(c.BOKEH),o.Bokeh],[String(c.CIRCLE),o.Circle],[String(c.COLOR_MATRIX),o.ColorMatrix],[String(c.DISPLACEMENT),o.Displacement],[String(c.GLOW),o.Glow],[String(c.GRADIENT),o.Gradient],[String(c.PIXELATE),o.Pixelate],[String(c.SHADOW),o.Shadow],[String(c.SHINE),o.Shine],[String(c.VIGNETTE),o.Vignette],[String(c.WIPE),o.Wipe]]),!Q){this.classes.set(p.FX_PIPELINE,d);for(var Y=Math.min(X,K),Z=Math.ceil(Y/this.frameInc),U=1;U=0;B--){var G=D[B];G.active&&G.preBatch(I)}}},postBatch:function(I){if(I.hasPostPipeline){this.flush();for(var D=I.postPipelines,B=0;B=0;B--){var G=D[B];G.active&&G.preBatch(I)}}},postBatchCamera:function(I){if(I.hasPostPipeline){this.flush();for(var D=I.postPipelines,B=0;Bthis.maxDimension)return this.targetIndex=D.length-B,D[this.targetIndex];var G=(u(I,this.frameInc,0,!0)-1)*B;return this.targetIndex=G,D[G]},getSwapRenderTarget:function(){return this.renderTargets[this.targetIndex+1]},getAltSwapRenderTarget:function(){return this.renderTargets[this.targetIndex+2]},destroy:function(){this.flush(),this.classes.clear(),this.postPipelineClasses.clear(),this.pipelines.clear(),this.renderer=null,this.game=null,this.classes=null,this.postPipelineClasses=null,this.pipelines=null,this.default=null,this.current=null,this.previous=null}});s.exports=O},32302:(s,y,e)=>{/** + */var r=e(83419),p=e(36060),h=e(90330),a=e(82264),l=e(95540),n=e(32302),u=e(63448),f=e(31302),o=e(58918),c=e(14811),d=e(92651),v=e(96569),m=e(56527),S=e(57516),M=e(43439),w=e(81041),C=e(12385),A=e(7589),P=e(95428),b=e(72905),O=new r({initialize:function(D){this.game=D.game,this.renderer=D,this.classes=new h([[p.UTILITY_PIPELINE,A],[p.MULTI_PIPELINE,S],[p.BITMAPMASK_PIPELINE,f],[p.SINGLE_PIPELINE,C],[p.ROPE_PIPELINE,w],[p.LIGHT_PIPELINE,v],[p.POINTLIGHT_PIPELINE,M],[p.MOBILE_PIPELINE,m]]),this.postPipelineClasses=new h,this.pipelines=new h,this.postPipelineInstances=[],this.default=null,this.current=null,this.previous=null,this.MULTI_PIPELINE=null,this.BITMAPMASK_PIPELINE=null,this.UTILITY_PIPELINE=null,this.MOBILE_PIPELINE=null,this.FX_PIPELINE=null,this.fullFrame1,this.fullFrame2,this.halfFrame1,this.halfFrame2,this.renderTargets=[],this.maxDimension=0,this.frameInc=32,this.targetIndex=0},boot:function(I,D,B){var G=this.renderer,z=this.renderTargets;this.frameInc=Math.floor(l(I,"frameInc",32));var X=G.width,j=G.height,Q=this.game.config.disablePreFX,tt=this.game.config.disablePostFX;if(tt||this.postPipelineClasses.setAll([[String(c.BARREL),o.Barrel],[String(c.BLOOM),o.Bloom],[String(c.BLUR),o.Blur],[String(c.BOKEH),o.Bokeh],[String(c.CIRCLE),o.Circle],[String(c.COLOR_MATRIX),o.ColorMatrix],[String(c.DISPLACEMENT),o.Displacement],[String(c.GLOW),o.Glow],[String(c.GRADIENT),o.Gradient],[String(c.PIXELATE),o.Pixelate],[String(c.SHADOW),o.Shadow],[String(c.SHINE),o.Shine],[String(c.VIGNETTE),o.Vignette],[String(c.WIPE),o.Wipe]]),!Q){this.classes.set(p.FX_PIPELINE,d);for(var Y=Math.min(X,j),Z=Math.ceil(Y/this.frameInc),U=1;U=0;B--){var G=D[B];G.active&&G.preBatch(I)}}},postBatch:function(I){if(I.hasPostPipeline){this.flush();for(var D=I.postPipelines,B=0;B=0;B--){var G=D[B];G.active&&G.preBatch(I)}}},postBatchCamera:function(I){if(I.hasPostPipeline){this.flush();for(var D=I.postPipelines,B=0;Bthis.maxDimension)return this.targetIndex=D.length-B,D[this.targetIndex];var G=(u(I,this.frameInc,0,!0)-1)*B;return this.targetIndex=G,D[G]},getSwapRenderTarget:function(){return this.renderTargets[this.targetIndex+1]},getAltSwapRenderTarget:function(){return this.renderTargets[this.targetIndex+2]},destroy:function(){this.flush(),this.classes.clear(),this.postPipelineClasses.clear(),this.pipelines.clear(),this.renderer=null,this.game=null,this.classes=null,this.postPipelineClasses=null,this.pipelines=null,this.default=null,this.current=null,this.previous=null}});s.exports=O},32302:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -4713,13 +4713,13 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83419),p=e(62644),h=e(50792),a=e(77085),l=e(95540),n=e(37867),u=e(92503),f=e(32302),o=e(70554),c=e(38683),d=new r({Extends:h,initialize:function(m){h.call(this);var S=m.game,M=S.renderer,w=M.gl;this.name=l(m,"name","WebGLPipeline"),this.game=S,this.renderer=M,this.manager,this.gl=w,this.view=S.canvas,this.width=0,this.height=0,this.vertexCount=0,this.vertexCapacity=0,this.vertexData,this.vertexBuffer,this.activeBuffer,this.topology=l(m,"topology",w.TRIANGLES),this.bytes,this.vertexViewF32,this.vertexViewU32,this.active=!0,this.forceZero=l(m,"forceZero",!1),this.hasBooted=!1,this.isPostFX=!1,this.isPreFX=!1,this.renderTargets=[],this.currentRenderTarget,this.shaders=[],this.currentShader,this.projectionMatrix,this.projectionWidth=0,this.projectionHeight=0,this.config=m,this.glReset=!1,this.batch=[],this.currentBatch=null,this.currentTexture=null,this.currentUnit=0,this.activeTextures=[],this.resizeUniform=l(m,"resizeUniform","")},boot:function(){var v,m=this.gl,S=this.config,M=this.renderer;this.isPostFX||(this.projectionMatrix=new n().identity());var w=this.renderTargets,C=l(S,"renderTarget",!1);typeof C=="boolean"&&C&&(C=1);var A=M.width,P=M.height;if(typeof C=="number")for(v=0;vX&&(X=z[v].vertexSize);var K=l(S,"batchSize",M.config.batchSize);this.vertexCapacity=K*6;var Q=new ArrayBuffer(this.vertexCapacity*X);this.vertexData=Q,this.bytes=new Uint8Array(Q),this.vertexViewF32=new Float32Array(Q),this.vertexViewU32=new Uint32Array(Q);var tt=l(S,"vertices",null);for(tt?(this.vertexViewF32.set(tt),this.vertexBuffer=M.createVertexBuffer(Q,m.STATIC_DRAW)):this.vertexBuffer=M.createVertexBuffer(Q.byteLength,m.DYNAMIC_DRAW),this.setVertexBuffer(),v=z.length-1;v>=0;v--)z[v].rebind();this.hasBooted=!0,M.on(u.RESIZE,this.resize,this),M.on(u.PRE_RENDER,this.onPreRender,this),M.on(u.RENDER,this.onRender,this),M.on(u.POST_RENDER,this.onPostRender,this),this.emit(a.BOOT,this),this.onBoot()},onBoot:function(){},onResize:function(){},setShader:function(v,m,S){var M=this.renderer;if(v!==this.currentShader||M.currentProgram!==this.currentShader.program){this.flush();var w=this.setVertexBuffer(S);w&&!m&&(m=!0),v.bind(m,!1),this.currentShader=v}return this},getShaderByName:function(v){for(var m=this.shaders,S=0;S-1&&(z=Y.substring(20))}X&&K&&B.push(new c(this,z,X,K,p(Q)))}this.shaders=B}return this.shaders.length===0?console.warn("Pipeline: "+this.name+" - Invalid shader config"):this.currentShader=this.shaders[0],this},createBatch:function(v){return this.currentBatch={start:this.vertexCount,count:0,texture:[v],unit:0,maxUnit:0},this.currentUnit=0,this.currentTexture=v,this.batch.push(this.currentBatch),0},addTextureToBatch:function(v){var m=this.currentBatch;m&&(m.texture.push(v),m.unit++,m.maxUnit++)},pushBatch:function(v){if(!this.currentBatch||this.forceZero&&v!==this.currentTexture)return this.createBatch(v);if(v===this.currentTexture)return this.currentUnit;var m=this.currentBatch,S=m.texture.indexOf(v);return S===-1?m.texture.length===this.renderer.maxTextures?this.createBatch(v):(m.unit++,m.maxUnit++,m.texture.push(v),this.currentUnit=m.unit,this.currentTexture=v,m.unit):(this.currentUnit=S,this.currentTexture=v,S)},setGameObject:function(v,m){return m===void 0&&(m=v.frame),this.pushBatch(m.source.glTexture)},shouldFlush:function(v){return v===void 0&&(v=0),this.vertexCount+v>this.vertexCapacity},vertexAvailable:function(){return this.vertexCapacity-this.vertexCount},resize:function(v,m){(v!==this.width||m!==this.height)&&this.flush(),this.width=v,this.height=m;for(var S=this.renderTargets,M=0;M=0;S--){var M=m[S].rebind();(!v||M===v)&&(this.currentShader=M)}return this.activeTextures.length=0,this.emit(a.REBIND,this.currentShader),this.onActive(this.currentShader),this.onRebind(),this.glReset=!1,this},restoreContext:function(){var v=this.shaders,m=!!this.vertexBuffer;this.activeBuffer=null,this.activeTextures.length=0,this.batch.length=0,this.currentBatch=null,this.currentTexture=null,this.currentUnit=0,m&&this.setVertexBuffer();for(var S=0;S0){this.emit(a.BEFORE_FLUSH,this,v),this.onBeforeFlush(v);var m=this.gl,S=this.vertexCount,M=this.currentShader.vertexSize,w=this.topology;if(this.active){this.setVertexBuffer(),S===this.vertexCapacity?m.bufferData(m.ARRAY_BUFFER,this.vertexData,m.DYNAMIC_DRAW):m.bufferSubData(m.ARRAY_BUFFER,0,this.bytes.subarray(0,S*M));var C,A,P,b=this.batch,O=this.activeTextures;if(this.forceZero)for(O[0]||m.activeTexture(m.TEXTURE0),C=0;C{/** + */var r=e(83419),p=e(62644),h=e(50792),a=e(77085),l=e(95540),n=e(37867),u=e(92503),f=e(32302),o=e(70554),c=e(38683),d=new r({Extends:h,initialize:function(m){h.call(this);var S=m.game,M=S.renderer,w=M.gl;this.name=l(m,"name","WebGLPipeline"),this.game=S,this.renderer=M,this.manager,this.gl=w,this.view=S.canvas,this.width=0,this.height=0,this.vertexCount=0,this.vertexCapacity=0,this.vertexData,this.vertexBuffer,this.activeBuffer,this.topology=l(m,"topology",w.TRIANGLES),this.bytes,this.vertexViewF32,this.vertexViewU32,this.active=!0,this.forceZero=l(m,"forceZero",!1),this.hasBooted=!1,this.isPostFX=!1,this.isPreFX=!1,this.renderTargets=[],this.currentRenderTarget,this.shaders=[],this.currentShader,this.projectionMatrix,this.projectionWidth=0,this.projectionHeight=0,this.config=m,this.glReset=!1,this.batch=[],this.currentBatch=null,this.currentTexture=null,this.currentUnit=0,this.activeTextures=[],this.resizeUniform=l(m,"resizeUniform","")},boot:function(){var v,m=this.gl,S=this.config,M=this.renderer;this.isPostFX||(this.projectionMatrix=new n().identity());var w=this.renderTargets,C=l(S,"renderTarget",!1);typeof C=="boolean"&&C&&(C=1);var A=M.width,P=M.height;if(typeof C=="number")for(v=0;vX&&(X=z[v].vertexSize);var j=l(S,"batchSize",M.config.batchSize);this.vertexCapacity=j*6;var Q=new ArrayBuffer(this.vertexCapacity*X);this.vertexData=Q,this.bytes=new Uint8Array(Q),this.vertexViewF32=new Float32Array(Q),this.vertexViewU32=new Uint32Array(Q);var tt=l(S,"vertices",null);for(tt?(this.vertexViewF32.set(tt),this.vertexBuffer=M.createVertexBuffer(Q,m.STATIC_DRAW)):this.vertexBuffer=M.createVertexBuffer(Q.byteLength,m.DYNAMIC_DRAW),this.setVertexBuffer(),v=z.length-1;v>=0;v--)z[v].rebind();this.hasBooted=!0,M.on(u.RESIZE,this.resize,this),M.on(u.PRE_RENDER,this.onPreRender,this),M.on(u.RENDER,this.onRender,this),M.on(u.POST_RENDER,this.onPostRender,this),this.emit(a.BOOT,this),this.onBoot()},onBoot:function(){},onResize:function(){},setShader:function(v,m,S){var M=this.renderer;if(v!==this.currentShader||M.currentProgram!==this.currentShader.program){this.flush();var w=this.setVertexBuffer(S);w&&!m&&(m=!0),v.bind(m,!1),this.currentShader=v}return this},getShaderByName:function(v){for(var m=this.shaders,S=0;S-1&&(z=Y.substring(20))}X&&j&&B.push(new c(this,z,X,j,p(Q)))}this.shaders=B}return this.shaders.length===0?console.warn("Pipeline: "+this.name+" - Invalid shader config"):this.currentShader=this.shaders[0],this},createBatch:function(v){return this.currentBatch={start:this.vertexCount,count:0,texture:[v],unit:0,maxUnit:0},this.currentUnit=0,this.currentTexture=v,this.batch.push(this.currentBatch),0},addTextureToBatch:function(v){var m=this.currentBatch;m&&(m.texture.push(v),m.unit++,m.maxUnit++)},pushBatch:function(v){if(!this.currentBatch||this.forceZero&&v!==this.currentTexture)return this.createBatch(v);if(v===this.currentTexture)return this.currentUnit;var m=this.currentBatch,S=m.texture.indexOf(v);return S===-1?m.texture.length===this.renderer.maxTextures?this.createBatch(v):(m.unit++,m.maxUnit++,m.texture.push(v),this.currentUnit=m.unit,this.currentTexture=v,m.unit):(this.currentUnit=S,this.currentTexture=v,S)},setGameObject:function(v,m){return m===void 0&&(m=v.frame),this.pushBatch(m.source.glTexture)},shouldFlush:function(v){return v===void 0&&(v=0),this.vertexCount+v>this.vertexCapacity},vertexAvailable:function(){return this.vertexCapacity-this.vertexCount},resize:function(v,m){(v!==this.width||m!==this.height)&&this.flush(),this.width=v,this.height=m;for(var S=this.renderTargets,M=0;M=0;S--){var M=m[S].rebind();(!v||M===v)&&(this.currentShader=M)}return this.activeTextures.length=0,this.emit(a.REBIND,this.currentShader),this.onActive(this.currentShader),this.onRebind(),this.glReset=!1,this},restoreContext:function(){var v=this.shaders,m=!!this.vertexBuffer;this.activeBuffer=null,this.activeTextures.length=0,this.batch.length=0,this.currentBatch=null,this.currentTexture=null,this.currentUnit=0,m&&this.setVertexBuffer();for(var S=0;S0){this.emit(a.BEFORE_FLUSH,this,v),this.onBeforeFlush(v);var m=this.gl,S=this.vertexCount,M=this.currentShader.vertexSize,w=this.topology;if(this.active){this.setVertexBuffer(),S===this.vertexCapacity?m.bufferData(m.ARRAY_BUFFER,this.vertexData,m.DYNAMIC_DRAW):m.bufferSubData(m.ARRAY_BUFFER,0,this.bytes.subarray(0,S*M));var C,A,P,b=this.batch,O=this.activeTextures;if(this.forceZero)for(O[0]||m.activeTexture(m.TEXTURE0),C=0;C{/** * @author Richard Davey * @author Felipe Alfonso <@bitnenfer> * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(95428),p=e(72905),h=e(19715),a=e(83419),l=e(8054),n=e(50792),u=e(92503),f=e(50030),o=e(37867),c=e(29747),d=e(7530),v=e(32302),m=e(97480),S=e(69442),M=e(70554),w=e(88815),C=e(26128),A=e(1482),P=e(82751),b=e(84387),O=e(93567),I=e(57183),D=new a({Extends:n,initialize:function(G){n.call(this);var z=G.config,X={alpha:z.transparent,desynchronized:z.desynchronized,depth:!0,antialias:z.antialiasGL,premultipliedAlpha:z.premultipliedAlpha,stencil:!0,failIfMajorPerformanceCaveat:z.failIfMajorPerformanceCaveat,powerPreference:z.powerPreference,preserveDrawingBuffer:z.preserveDrawingBuffer,willReadFrequently:!1};this.config={clearBeforeRender:z.clearBeforeRender,antialias:z.antialias,backgroundColor:z.backgroundColor,contextCreation:X,roundPixels:z.roundPixels,maxTextures:z.maxTextures,maxTextureSize:z.maxTextureSize,batchSize:z.batchSize,maxLights:z.maxLights,mipmapFilter:z.mipmapFilter},this.game=G,this.type=l.WEBGL,this.pipelines=null,this.width=0,this.height=0,this.canvas=G.canvas,this.blendModes=[],this.contextLost=!1,this.snapshotState={x:0,y:0,width:1,height:1,getPixel:!1,callback:null,type:"image/png",encoder:.92,isFramebuffer:!1,bufferWidth:0,bufferHeight:0},this.maxTextures=0,this.textureIndexes,this.glBufferWrappers=[],this.glProgramWrappers=[],this.glTextureWrappers=[],this.glFramebufferWrappers=[],this.glAttribLocationWrappers=[],this.glUniformLocationWrappers=[],this.currentFramebuffer=null,this.fboStack=[],this.currentProgram=null,this.currentBlendMode=1/0,this.currentScissorEnabled=!1,this.currentScissor=null,this.scissorStack=[],this.contextLostHandler=c,this.contextRestoredHandler=c,this.gl=null,this.supportedExtensions=null,this.instancedArraysExtension=null,this.vaoExtension=null,this.extensions={},this.glFormats,this.compression,this.drawingBufferHeight=0,this.blankTexture=null,this.normalTexture=null,this.whiteTexture=null,this.maskCount=0,this.maskStack=[],this.currentMask={mask:null,camera:null},this.currentCameraMask={mask:null,camera:null},this.glFuncMap=null,this.currentType="",this.newType=!1,this.nextTypeMatch=!1,this.finalType=!1,this.mipmapFilter=null,this.defaultScissor=[0,0,0,0],this.isBooted=!1,this.renderTarget=null,this.projectionMatrix,this.projectionWidth=0,this.projectionHeight=0,this.maskSource=null,this.maskTarget=null,this.spector=null,this._debugCapture=!1,this.init(this.config)},init:function(B){var G,z=this.game,X=this.canvas,K=B.backgroundColor;if(z.config.context?G=z.config.context:G=X.getContext("webgl",B.contextCreation)||X.getContext("experimental-webgl",B.contextCreation),!G||G.isContextLost())throw this.contextLost=!0,new Error("WebGL unsupported");this.gl=G;var Q=this,tt=function(){var U=G.getSupportedExtensions();Q.supportedExtensions=U;var H="ANGLE_instanced_arrays";Q.instancedArraysExtension=U.indexOf(H)>-1?G.getExtension(H):null;var J="OES_vertex_array_object";Q.vaoExtension=U.indexOf(J)>-1?G.getExtension(J):null};tt(),this.contextLostHandler=function(U){Q.contextLost=!0,console&&console.warn("WebGL Context lost. Renderer disabled"),Q.emit(u.LOSE_WEBGL,Q),U.preventDefault()},X.addEventListener("webglcontextlost",this.contextLostHandler,!1),this.contextRestoredHandler=function(U){if(G.isContextLost()){console&&console.log("WebGL Context restored, but context is still lost");return}Q.currentProgram=null,Q.currentFramebuffer=null,Q.setBlendMode(l.BlendModes.NORMAL),G.disable(G.BLEND),G.disable(G.DEPTH_TEST),G.enable(G.CULL_FACE),Q.compression=Q.getCompressedTextures();var H=function(J){J.createResource()};r(Q.glTextureWrappers,H),r(Q.glBufferWrappers,H),r(Q.glFramebufferWrappers,H),r(Q.glProgramWrappers,H),r(Q.glAttribLocationWrappers,H),r(Q.glUniformLocationWrappers,H),Q.createTemporaryTextures(),Q.pipelines.restoreContext(),Q.resize(Q.game.scale.baseSize.width,Q.game.scale.baseSize.height),tt(),Q.contextLost=!1,console&&console.warn("WebGL Context restored. Renderer running again."),Q.emit(u.RESTORE_WEBGL,Q),U.preventDefault()},X.addEventListener("webglcontextrestored",this.contextRestoredHandler,!1),z.context=G;for(var Y=0;Y<=27;Y++)this.blendModes.push({func:[G.ONE,G.ONE_MINUS_SRC_ALPHA],equation:G.FUNC_ADD});this.blendModes[1].func=[G.ONE,G.DST_ALPHA],this.blendModes[2].func=[G.DST_COLOR,G.ONE_MINUS_SRC_ALPHA],this.blendModes[3].func=[G.ONE,G.ONE_MINUS_SRC_COLOR],this.blendModes[17]={func:[G.ZERO,G.ONE_MINUS_SRC_ALPHA],equation:G.FUNC_REVERSE_SUBTRACT},this.glFormats=[G.BYTE,G.SHORT,G.UNSIGNED_BYTE,G.UNSIGNED_SHORT,G.FLOAT],this.glFuncMap={mat2:{func:G.uniformMatrix2fv,length:1,matrix:!0},mat3:{func:G.uniformMatrix3fv,length:1,matrix:!0},mat4:{func:G.uniformMatrix4fv,length:1,matrix:!0},"1f":{func:G.uniform1f,length:1},"1fv":{func:G.uniform1fv,length:1},"1i":{func:G.uniform1i,length:1},"1iv":{func:G.uniform1iv,length:1},"2f":{func:G.uniform2f,length:2},"2fv":{func:G.uniform2fv,length:1},"2i":{func:G.uniform2i,length:2},"2iv":{func:G.uniform2iv,length:1},"3f":{func:G.uniform3f,length:3},"3fv":{func:G.uniform3fv,length:1},"3i":{func:G.uniform3i,length:3},"3iv":{func:G.uniform3iv,length:1},"4f":{func:G.uniform4f,length:4},"4fv":{func:G.uniform4fv,length:1},"4i":{func:G.uniform4i,length:4},"4iv":{func:G.uniform4iv,length:1}},(!B.maxTextures||B.maxTextures===-1)&&(B.maxTextures=G.getParameter(G.MAX_TEXTURE_IMAGE_UNITS)),B.maxTextureSize||(B.maxTextureSize=G.getParameter(G.MAX_TEXTURE_SIZE)),this.compression=this.getCompressedTextures(),G.disable(G.DEPTH_TEST),G.disable(G.CULL_FACE),G.enable(G.BLEND),G.clearColor(K.redGL,K.greenGL,K.blueGL,K.alphaGL);var Z=["NEAREST","LINEAR","NEAREST_MIPMAP_NEAREST","LINEAR_MIPMAP_NEAREST","NEAREST_MIPMAP_LINEAR","LINEAR_MIPMAP_LINEAR"];return Z.indexOf(B.mipmapFilter)!==-1&&(this.mipmapFilter=G[B.mipmapFilter]),this.maxTextures=M.checkShaderMax(G,B.maxTextures),this.textureIndexes=[],this.createTemporaryTextures(),this.pipelines=new d(this),this.setBlendMode(l.BlendModes.NORMAL),this.projectionMatrix=new o().identity(),z.textures.once(S.READY,this.boot,this),this},boot:function(){var B=this.game,G=this.pipelines,z=B.scale.baseSize,X=z.width,K=z.height;this.width=X,this.height=K,this.isBooted=!0,this.renderTarget=new v(this,X,K,1,0,!0,!0),this.maskTarget=new v(this,X,K,1,0,!0,!0),this.maskSource=new v(this,X,K,1,0,!0,!0);var Q=B.config;G.boot(Q.pipeline,Q.defaultPipeline,Q.autoMobilePipeline),this.blankTexture=B.textures.getFrame("__DEFAULT").glTexture,this.normalTexture=B.textures.getFrame("__NORMAL").glTexture,this.whiteTexture=B.textures.getFrame("__WHITE").glTexture;var tt=this.gl;tt.bindFramebuffer(tt.FRAMEBUFFER,null),tt.enable(tt.SCISSOR_TEST),B.scale.on(m.RESIZE,this.onResize,this),this.resize(X,K)},createTemporaryTextures:function(){for(var B=this.gl,G=0;G0&&X>0;if(tt&&Y){var Z=tt[0],U=tt[1],H=tt[2],J=tt[3];Y=Z!==B||U!==G||H!==z||J!==X}Y&&(this.flush(),Q.scissor(B,K-G-X,z,X))},resetScissor:function(){var B=this.gl;B.enable(B.SCISSOR_TEST);var G=this.currentScissor;if(G){var z=G[0],X=G[1],K=G[2],Q=G[3];K>0&&Q>0&&B.scissor(z,this.drawingBufferHeight-X-Q,K,Q)}},popScissor:function(){var B=this.scissorStack;B.pop();var G=B[B.length-1];G&&this.setScissor(G[0],G[1],G[2],G[3]),this.currentScissor=G},hasActiveStencilMask:function(){var B=this.currentMask.mask,G=this.currentCameraMask.mask;return B&&B.isStencil||G&&G.isStencil},resetViewport:function(){var B=this.gl;B.viewport(0,0,this.width,this.height),this.drawingBufferHeight=B.drawingBufferHeight},setBlendMode:function(B,G){G===void 0&&(G=!1);var z=this.gl,X=this.blendModes[B];return G||B!==l.BlendModes.SKIP_CHECK&&this.currentBlendMode!==B?(this.flush(),z.enable(z.BLEND),z.blendEquation(X.equation),X.func.length>2?z.blendFuncSeparate(X.func[0],X.func[1],X.func[2],X.func[3]):z.blendFunc(X.func[0],X.func[1]),this.currentBlendMode=B,!0):!1},addBlendMode:function(B,G){var z=this.blendModes.push({func:B,equation:G});return z-1},updateBlendMode:function(B,G,z){return this.blendModes[B]&&(this.blendModes[B].func=G,z&&(this.blendModes[B].equation=z)),this},removeBlendMode:function(B){return B>17&&this.blendModes[B]&&this.blendModes.splice(B,1),this},pushFramebuffer:function(B,G,z,X,K){return B===this.currentFramebuffer?this:(this.fboStack.push(B),this.setFramebuffer(B,G,z,X,K))},setFramebuffer:function(B,G,z,X,K){if(G===void 0&&(G=!1),z===void 0&&(z=!0),X===void 0&&(X=null),K===void 0&&(K=!1),B===this.currentFramebuffer)return this;var Q=this.gl,tt=this.width,Y=this.height;return B&&B.renderTexture&&z?(tt=B.renderTexture.width,Y=B.renderTexture.height):this.flush(),B?Q.bindFramebuffer(Q.FRAMEBUFFER,B.webGLFramebuffer):Q.bindFramebuffer(Q.FRAMEBUFFER,null),z&&Q.viewport(0,0,tt,Y),X&&Q.framebufferTexture2D(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_2D,X.webGLTexture,0),K&&(Q.clearColor(0,0,0,0),Q.clear(Q.COLOR_BUFFER_BIT)),G&&(B?(this.drawingBufferHeight=Y,this.pushScissor(0,0,tt,Y)):(this.drawingBufferHeight=this.height,this.popScissor())),this.currentFramebuffer=B,this},popFramebuffer:function(B,G){B===void 0&&(B=!1),G===void 0&&(G=!0);var z=this.fboStack;z.pop();var X=z[z.length-1];return X||(X=null),this.setFramebuffer(X,B,G),X},restoreFramebuffer:function(B,G){B===void 0&&(B=!1),G===void 0&&(G=!0);var z=this.fboStack,X=z[z.length-1];X||(X=null),this.currentFramebuffer=null,this.setFramebuffer(X,B,G)},setProgram:function(B){return B!==this.currentProgram?(this.flush(),this.gl.useProgram(B.webGLProgram),this.currentProgram=B,!0):!1},resetProgram:function(){return this.gl.useProgram(this.currentProgram.webGLProgramWrapper),this},createTextureFromSource:function(B,G,z,X,K){K===void 0&&(K=!1);var Q=this.gl,tt=Q.NEAREST,Y=Q.NEAREST,Z=Q.CLAMP_TO_EDGE,U=null;G=B?B.width:G,z=B?B.height:z;var H=f(G,z);if(H&&!K&&(Z=Q.REPEAT),X===l.ScaleModes.LINEAR&&this.config.antialias){var J=B&&B.compressed,_=!J&&H||J&&B.mipmaps.length>1;tt=this.mipmapFilter&&_?this.mipmapFilter:Q.LINEAR,Y=Q.LINEAR}return!B&&typeof G=="number"&&typeof z=="number"?U=this.createTexture2D(0,tt,Y,Z,Z,Q.RGBA,null,G,z):U=this.createTexture2D(0,tt,Y,Z,Z,Q.RGBA,B),U},createTexture2D:function(B,G,z,X,K,Q,tt,Y,Z,U,H,J){typeof Y!="number"&&(Y=tt?tt.width:1),typeof Z!="number"&&(Z=tt?tt.height:1);var _=new P(this.gl,B,G,z,X,K,Q,tt,Y,Z,U,H,J);return this.glTextureWrappers.push(_),_},createFramebuffer:function(B,G,z,X){this.currentFramebuffer=null;var K=new b(this.gl,B,G,z,X);return this.glFramebufferWrappers.push(K),K},beginBitmapMask:function(B,G){var z=this.gl;z&&(this.flush(),this.maskTarget.bind(!0),this.currentCameraMask.mask!==B&&(this.currentMask.mask=B,this.currentMask.camera=G))},drawBitmapMask:function(B,G,z){this.flush(),this.maskSource.bind(),this.setBlendMode(0,!0),B.renderWebGL(this,B,G),this.maskSource.unbind(!0),this.maskTarget.unbind();var X=this.gl,K=this.getCurrentStencilMask();K?(X.enable(X.STENCIL_TEST),K.mask.applyStencil(this,K.camera,!0)):this.currentMask.mask=null,this.pipelines.set(z),X.activeTexture(X.TEXTURE0),X.bindTexture(X.TEXTURE_2D,this.maskTarget.texture.webGLTexture),X.activeTexture(X.TEXTURE1),X.bindTexture(X.TEXTURE_2D,this.maskSource.texture.webGLTexture)},createProgram:function(B,G){var z=new A(this.gl,B,G);return this.glProgramWrappers.push(z),z},createVertexBuffer:function(B,G){var z=this.gl,X=new C(z,B,z.ARRAY_BUFFER,G);return this.glBufferWrappers.push(X),X},createAttribLocation:function(B,G){var z=new O(this.gl,B,G);return this.glAttribLocationWrappers.push(z),z},createUniformLocation:function(B,G){var z=new I(this.gl,B,G);return this.glUniformLocationWrappers.push(z),z},createIndexBuffer:function(B,G){var z=this.gl,X=new C(z,B,z.ELEMENT_ARRAY_BUFFER,G);return this.glBufferWrappers.push(X),X},deleteTexture:function(B){if(B)return p(this.glTextureWrappers,B),B.destroy(),this},deleteFramebuffer:function(B){return B?(p(this.fboStack,B),p(this.glFramebufferWrappers,B),B.destroy(),this):this},deleteProgram:function(B){return B&&(p(this.glProgramWrappers,B),B.destroy()),this},deleteAttribLocation:function(B){return B&&(p(this.glAttribLocationWrappers,B),B.destroy()),this},deleteUniformLocation:function(B){return B&&(p(this.glUniformLocationWrappers,B),B.destroy()),this},deleteBuffer:function(B){return B?(p(this.glBufferWrappers,B),B.destroy(),this):this},preRenderCamera:function(B){var G=B.x,z=B.y,X=B.width,K=B.height,Q=B.backgroundColor;if(B.emit(h.PRE_RENDER,B),this.pipelines.preBatchCamera(B),this.pushScissor(G,z,X,K),B.mask&&(this.currentCameraMask.mask=B.mask,this.currentCameraMask.camera=B._maskCamera,B.mask.preRenderWebGL(this,B,B._maskCamera)),Q.alphaGL>0){var tt=this.pipelines.setMulti();tt.drawFillRect(G,z,X,K,M.getTintFromFloats(Q.blueGL,Q.greenGL,Q.redGL,1),Q.alphaGL)}},getCurrentStencilMask:function(){var B=null,G=this.maskStack,z=this.currentCameraMask;return G.length>0?B=G[G.length-1]:z.mask&&z.mask.isStencil&&(B=z),B},postRenderCamera:function(B){var G=B.flashEffect,z=B.fadeEffect;if(G.isRunning||z.isRunning||z.isComplete){var X=this.pipelines.setMulti();G.postRenderWebGL(X,M.getTintFromFloats),z.postRenderWebGL(X,M.getTintFromFloats)}B.dirty=!1,this.popScissor(),B.mask&&(this.currentCameraMask.mask=null,B.mask.postRenderWebGL(this,B._maskCamera)),this.pipelines.postBatchCamera(B),B.emit(h.POST_RENDER,B)},preRender:function(){if(!this.contextLost){var B=this.gl;if(B.bindFramebuffer(B.FRAMEBUFFER,null),this.config.clearBeforeRender){var G=this.config.backgroundColor;B.clearColor(G.redGL,G.greenGL,G.blueGL,G.alphaGL),B.clear(B.COLOR_BUFFER_BIT|B.DEPTH_BUFFER_BIT|B.STENCIL_BUFFER_BIT)}B.enable(B.SCISSOR_TEST),this.currentScissor=this.defaultScissor,this.scissorStack.length=0,this.scissorStack.push(this.currentScissor),this.game.scene.customViewports&&B.scissor(0,this.drawingBufferHeight-this.height,this.width,this.height),this.currentMask.mask=null,this.currentCameraMask.mask=null,this.maskStack.length=0,this.emit(u.PRE_RENDER)}},render:function(B,G,z){if(!this.contextLost){var X=G.length;if(this.emit(u.RENDER,B,z),this.preRenderCamera(z),X===0){this.setBlendMode(l.BlendModes.NORMAL),this.postRenderCamera(z);return}this.currentType="";for(var K=this.currentMask,Q=0;Q{/** + */var r=e(95428),p=e(72905),h=e(19715),a=e(83419),l=e(8054),n=e(50792),u=e(92503),f=e(50030),o=e(37867),c=e(29747),d=e(7530),v=e(32302),m=e(97480),S=e(69442),M=e(70554),w=e(88815),C=e(26128),A=e(1482),P=e(82751),b=e(84387),O=e(93567),I=e(57183),D=new a({Extends:n,initialize:function(G){n.call(this);var z=G.config,X={alpha:z.transparent,desynchronized:z.desynchronized,depth:!0,antialias:z.antialiasGL,premultipliedAlpha:z.premultipliedAlpha,stencil:!0,failIfMajorPerformanceCaveat:z.failIfMajorPerformanceCaveat,powerPreference:z.powerPreference,preserveDrawingBuffer:z.preserveDrawingBuffer,willReadFrequently:!1};this.config={clearBeforeRender:z.clearBeforeRender,antialias:z.antialias,backgroundColor:z.backgroundColor,contextCreation:X,roundPixels:z.roundPixels,maxTextures:z.maxTextures,maxTextureSize:z.maxTextureSize,batchSize:z.batchSize,maxLights:z.maxLights,mipmapFilter:z.mipmapFilter},this.game=G,this.type=l.WEBGL,this.pipelines=null,this.width=0,this.height=0,this.canvas=G.canvas,this.blendModes=[],this.contextLost=!1,this.snapshotState={x:0,y:0,width:1,height:1,getPixel:!1,callback:null,type:"image/png",encoder:.92,isFramebuffer:!1,bufferWidth:0,bufferHeight:0},this.maxTextures=0,this.textureIndexes,this.glBufferWrappers=[],this.glProgramWrappers=[],this.glTextureWrappers=[],this.glFramebufferWrappers=[],this.glAttribLocationWrappers=[],this.glUniformLocationWrappers=[],this.currentFramebuffer=null,this.fboStack=[],this.currentProgram=null,this.currentBlendMode=1/0,this.currentScissorEnabled=!1,this.currentScissor=null,this.scissorStack=[],this.contextLostHandler=c,this.contextRestoredHandler=c,this.gl=null,this.supportedExtensions=null,this.instancedArraysExtension=null,this.vaoExtension=null,this.extensions={},this.glFormats,this.compression,this.drawingBufferHeight=0,this.blankTexture=null,this.normalTexture=null,this.whiteTexture=null,this.maskCount=0,this.maskStack=[],this.currentMask={mask:null,camera:null},this.currentCameraMask={mask:null,camera:null},this.glFuncMap=null,this.currentType="",this.newType=!1,this.nextTypeMatch=!1,this.finalType=!1,this.mipmapFilter=null,this.defaultScissor=[0,0,0,0],this.isBooted=!1,this.renderTarget=null,this.projectionMatrix,this.projectionWidth=0,this.projectionHeight=0,this.maskSource=null,this.maskTarget=null,this.spector=null,this._debugCapture=!1,this.init(this.config)},init:function(B){var G,z=this.game,X=this.canvas,j=B.backgroundColor;if(z.config.context?G=z.config.context:G=X.getContext("webgl",B.contextCreation)||X.getContext("experimental-webgl",B.contextCreation),!G||G.isContextLost())throw this.contextLost=!0,new Error("WebGL unsupported");this.gl=G;var Q=this,tt=function(){var U=G.getSupportedExtensions();Q.supportedExtensions=U;var H="ANGLE_instanced_arrays";Q.instancedArraysExtension=U.indexOf(H)>-1?G.getExtension(H):null;var J="OES_vertex_array_object";Q.vaoExtension=U.indexOf(J)>-1?G.getExtension(J):null};tt(),this.contextLostHandler=function(U){Q.contextLost=!0,console&&console.warn("WebGL Context lost. Renderer disabled"),Q.emit(u.LOSE_WEBGL,Q),U.preventDefault()},X.addEventListener("webglcontextlost",this.contextLostHandler,!1),this.contextRestoredHandler=function(U){if(G.isContextLost()){console&&console.log("WebGL Context restored, but context is still lost");return}Q.currentProgram=null,Q.currentFramebuffer=null,Q.setBlendMode(l.BlendModes.NORMAL),G.disable(G.BLEND),G.disable(G.DEPTH_TEST),G.enable(G.CULL_FACE),Q.compression=Q.getCompressedTextures();var H=function(J){J.createResource()};r(Q.glTextureWrappers,H),r(Q.glBufferWrappers,H),r(Q.glFramebufferWrappers,H),r(Q.glProgramWrappers,H),r(Q.glAttribLocationWrappers,H),r(Q.glUniformLocationWrappers,H),Q.createTemporaryTextures(),Q.pipelines.restoreContext(),Q.resize(Q.game.scale.baseSize.width,Q.game.scale.baseSize.height),tt(),Q.contextLost=!1,console&&console.warn("WebGL Context restored. Renderer running again."),Q.emit(u.RESTORE_WEBGL,Q),U.preventDefault()},X.addEventListener("webglcontextrestored",this.contextRestoredHandler,!1),z.context=G;for(var Y=0;Y<=27;Y++)this.blendModes.push({func:[G.ONE,G.ONE_MINUS_SRC_ALPHA],equation:G.FUNC_ADD});this.blendModes[1].func=[G.ONE,G.DST_ALPHA],this.blendModes[2].func=[G.DST_COLOR,G.ONE_MINUS_SRC_ALPHA],this.blendModes[3].func=[G.ONE,G.ONE_MINUS_SRC_COLOR],this.blendModes[17]={func:[G.ZERO,G.ONE_MINUS_SRC_ALPHA],equation:G.FUNC_REVERSE_SUBTRACT},this.glFormats=[G.BYTE,G.SHORT,G.UNSIGNED_BYTE,G.UNSIGNED_SHORT,G.FLOAT],this.glFuncMap={mat2:{func:G.uniformMatrix2fv,length:1,matrix:!0},mat3:{func:G.uniformMatrix3fv,length:1,matrix:!0},mat4:{func:G.uniformMatrix4fv,length:1,matrix:!0},"1f":{func:G.uniform1f,length:1},"1fv":{func:G.uniform1fv,length:1},"1i":{func:G.uniform1i,length:1},"1iv":{func:G.uniform1iv,length:1},"2f":{func:G.uniform2f,length:2},"2fv":{func:G.uniform2fv,length:1},"2i":{func:G.uniform2i,length:2},"2iv":{func:G.uniform2iv,length:1},"3f":{func:G.uniform3f,length:3},"3fv":{func:G.uniform3fv,length:1},"3i":{func:G.uniform3i,length:3},"3iv":{func:G.uniform3iv,length:1},"4f":{func:G.uniform4f,length:4},"4fv":{func:G.uniform4fv,length:1},"4i":{func:G.uniform4i,length:4},"4iv":{func:G.uniform4iv,length:1}},(!B.maxTextures||B.maxTextures===-1)&&(B.maxTextures=G.getParameter(G.MAX_TEXTURE_IMAGE_UNITS)),B.maxTextureSize||(B.maxTextureSize=G.getParameter(G.MAX_TEXTURE_SIZE)),this.compression=this.getCompressedTextures(),G.disable(G.DEPTH_TEST),G.disable(G.CULL_FACE),G.enable(G.BLEND),G.clearColor(j.redGL,j.greenGL,j.blueGL,j.alphaGL);var Z=["NEAREST","LINEAR","NEAREST_MIPMAP_NEAREST","LINEAR_MIPMAP_NEAREST","NEAREST_MIPMAP_LINEAR","LINEAR_MIPMAP_LINEAR"];return Z.indexOf(B.mipmapFilter)!==-1&&(this.mipmapFilter=G[B.mipmapFilter]),this.maxTextures=M.checkShaderMax(G,B.maxTextures),this.textureIndexes=[],this.createTemporaryTextures(),this.pipelines=new d(this),this.setBlendMode(l.BlendModes.NORMAL),this.projectionMatrix=new o().identity(),z.textures.once(S.READY,this.boot,this),this},boot:function(){var B=this.game,G=this.pipelines,z=B.scale.baseSize,X=z.width,j=z.height;this.width=X,this.height=j,this.isBooted=!0,this.renderTarget=new v(this,X,j,1,0,!0,!0),this.maskTarget=new v(this,X,j,1,0,!0,!0),this.maskSource=new v(this,X,j,1,0,!0,!0);var Q=B.config;G.boot(Q.pipeline,Q.defaultPipeline,Q.autoMobilePipeline),this.blankTexture=B.textures.getFrame("__DEFAULT").glTexture,this.normalTexture=B.textures.getFrame("__NORMAL").glTexture,this.whiteTexture=B.textures.getFrame("__WHITE").glTexture;var tt=this.gl;tt.bindFramebuffer(tt.FRAMEBUFFER,null),tt.enable(tt.SCISSOR_TEST),B.scale.on(m.RESIZE,this.onResize,this),this.resize(X,j)},createTemporaryTextures:function(){for(var B=this.gl,G=0;G0&&X>0;if(tt&&Y){var Z=tt[0],U=tt[1],H=tt[2],J=tt[3];Y=Z!==B||U!==G||H!==z||J!==X}Y&&(this.flush(),Q.scissor(B,j-G-X,z,X))},resetScissor:function(){var B=this.gl;B.enable(B.SCISSOR_TEST);var G=this.currentScissor;if(G){var z=G[0],X=G[1],j=G[2],Q=G[3];j>0&&Q>0&&B.scissor(z,this.drawingBufferHeight-X-Q,j,Q)}},popScissor:function(){var B=this.scissorStack;B.pop();var G=B[B.length-1];G&&this.setScissor(G[0],G[1],G[2],G[3]),this.currentScissor=G},hasActiveStencilMask:function(){var B=this.currentMask.mask,G=this.currentCameraMask.mask;return B&&B.isStencil||G&&G.isStencil},resetViewport:function(){var B=this.gl;B.viewport(0,0,this.width,this.height),this.drawingBufferHeight=B.drawingBufferHeight},setBlendMode:function(B,G){G===void 0&&(G=!1);var z=this.gl,X=this.blendModes[B];return G||B!==l.BlendModes.SKIP_CHECK&&this.currentBlendMode!==B?(this.flush(),z.enable(z.BLEND),z.blendEquation(X.equation),X.func.length>2?z.blendFuncSeparate(X.func[0],X.func[1],X.func[2],X.func[3]):z.blendFunc(X.func[0],X.func[1]),this.currentBlendMode=B,!0):!1},addBlendMode:function(B,G){var z=this.blendModes.push({func:B,equation:G});return z-1},updateBlendMode:function(B,G,z){return this.blendModes[B]&&(this.blendModes[B].func=G,z&&(this.blendModes[B].equation=z)),this},removeBlendMode:function(B){return B>17&&this.blendModes[B]&&this.blendModes.splice(B,1),this},pushFramebuffer:function(B,G,z,X,j){return B===this.currentFramebuffer?this:(this.fboStack.push(B),this.setFramebuffer(B,G,z,X,j))},setFramebuffer:function(B,G,z,X,j){if(G===void 0&&(G=!1),z===void 0&&(z=!0),X===void 0&&(X=null),j===void 0&&(j=!1),B===this.currentFramebuffer)return this;var Q=this.gl,tt=this.width,Y=this.height;return B&&B.renderTexture&&z?(tt=B.renderTexture.width,Y=B.renderTexture.height):this.flush(),B?Q.bindFramebuffer(Q.FRAMEBUFFER,B.webGLFramebuffer):Q.bindFramebuffer(Q.FRAMEBUFFER,null),z&&Q.viewport(0,0,tt,Y),X&&Q.framebufferTexture2D(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_2D,X.webGLTexture,0),j&&(Q.clearColor(0,0,0,0),Q.clear(Q.COLOR_BUFFER_BIT)),G&&(B?(this.drawingBufferHeight=Y,this.pushScissor(0,0,tt,Y)):(this.drawingBufferHeight=this.height,this.popScissor())),this.currentFramebuffer=B,this},popFramebuffer:function(B,G){B===void 0&&(B=!1),G===void 0&&(G=!0);var z=this.fboStack;z.pop();var X=z[z.length-1];return X||(X=null),this.setFramebuffer(X,B,G),X},restoreFramebuffer:function(B,G){B===void 0&&(B=!1),G===void 0&&(G=!0);var z=this.fboStack,X=z[z.length-1];X||(X=null),this.currentFramebuffer=null,this.setFramebuffer(X,B,G)},setProgram:function(B){return B!==this.currentProgram?(this.flush(),this.gl.useProgram(B.webGLProgram),this.currentProgram=B,!0):!1},resetProgram:function(){return this.gl.useProgram(this.currentProgram.webGLProgramWrapper),this},createTextureFromSource:function(B,G,z,X,j){j===void 0&&(j=!1);var Q=this.gl,tt=Q.NEAREST,Y=Q.NEAREST,Z=Q.CLAMP_TO_EDGE,U=null;G=B?B.width:G,z=B?B.height:z;var H=f(G,z);if(H&&!j&&(Z=Q.REPEAT),X===l.ScaleModes.LINEAR&&this.config.antialias){var J=B&&B.compressed,_=!J&&H||J&&B.mipmaps.length>1;tt=this.mipmapFilter&&_?this.mipmapFilter:Q.LINEAR,Y=Q.LINEAR}return!B&&typeof G=="number"&&typeof z=="number"?U=this.createTexture2D(0,tt,Y,Z,Z,Q.RGBA,null,G,z):U=this.createTexture2D(0,tt,Y,Z,Z,Q.RGBA,B),U},createTexture2D:function(B,G,z,X,j,Q,tt,Y,Z,U,H,J){typeof Y!="number"&&(Y=tt?tt.width:1),typeof Z!="number"&&(Z=tt?tt.height:1);var _=new P(this.gl,B,G,z,X,j,Q,tt,Y,Z,U,H,J);return this.glTextureWrappers.push(_),_},createFramebuffer:function(B,G,z,X){this.currentFramebuffer=null;var j=new b(this.gl,B,G,z,X);return this.glFramebufferWrappers.push(j),j},beginBitmapMask:function(B,G){var z=this.gl;z&&(this.flush(),this.maskTarget.bind(!0),this.currentCameraMask.mask!==B&&(this.currentMask.mask=B,this.currentMask.camera=G))},drawBitmapMask:function(B,G,z){this.flush(),this.maskSource.bind(),this.setBlendMode(0,!0),B.renderWebGL(this,B,G),this.maskSource.unbind(!0),this.maskTarget.unbind();var X=this.gl,j=this.getCurrentStencilMask();j?(X.enable(X.STENCIL_TEST),j.mask.applyStencil(this,j.camera,!0)):this.currentMask.mask=null,this.pipelines.set(z),X.activeTexture(X.TEXTURE0),X.bindTexture(X.TEXTURE_2D,this.maskTarget.texture.webGLTexture),X.activeTexture(X.TEXTURE1),X.bindTexture(X.TEXTURE_2D,this.maskSource.texture.webGLTexture)},createProgram:function(B,G){var z=new A(this.gl,B,G);return this.glProgramWrappers.push(z),z},createVertexBuffer:function(B,G){var z=this.gl,X=new C(z,B,z.ARRAY_BUFFER,G);return this.glBufferWrappers.push(X),X},createAttribLocation:function(B,G){var z=new O(this.gl,B,G);return this.glAttribLocationWrappers.push(z),z},createUniformLocation:function(B,G){var z=new I(this.gl,B,G);return this.glUniformLocationWrappers.push(z),z},createIndexBuffer:function(B,G){var z=this.gl,X=new C(z,B,z.ELEMENT_ARRAY_BUFFER,G);return this.glBufferWrappers.push(X),X},deleteTexture:function(B){if(B)return p(this.glTextureWrappers,B),B.destroy(),this},deleteFramebuffer:function(B){return B?(p(this.fboStack,B),p(this.glFramebufferWrappers,B),B.destroy(),this):this},deleteProgram:function(B){return B&&(p(this.glProgramWrappers,B),B.destroy()),this},deleteAttribLocation:function(B){return B&&(p(this.glAttribLocationWrappers,B),B.destroy()),this},deleteUniformLocation:function(B){return B&&(p(this.glUniformLocationWrappers,B),B.destroy()),this},deleteBuffer:function(B){return B?(p(this.glBufferWrappers,B),B.destroy(),this):this},preRenderCamera:function(B){var G=B.x,z=B.y,X=B.width,j=B.height,Q=B.backgroundColor;if(B.emit(h.PRE_RENDER,B),this.pipelines.preBatchCamera(B),this.pushScissor(G,z,X,j),B.mask&&(this.currentCameraMask.mask=B.mask,this.currentCameraMask.camera=B._maskCamera,B.mask.preRenderWebGL(this,B,B._maskCamera)),Q.alphaGL>0){var tt=this.pipelines.setMulti();tt.drawFillRect(G,z,X,j,M.getTintFromFloats(Q.blueGL,Q.greenGL,Q.redGL,1),Q.alphaGL)}},getCurrentStencilMask:function(){var B=null,G=this.maskStack,z=this.currentCameraMask;return G.length>0?B=G[G.length-1]:z.mask&&z.mask.isStencil&&(B=z),B},postRenderCamera:function(B){var G=B.flashEffect,z=B.fadeEffect;if(G.isRunning||z.isRunning||z.isComplete){var X=this.pipelines.setMulti();G.postRenderWebGL(X,M.getTintFromFloats),z.postRenderWebGL(X,M.getTintFromFloats)}B.dirty=!1,this.popScissor(),B.mask&&(this.currentCameraMask.mask=null,B.mask.postRenderWebGL(this,B._maskCamera)),this.pipelines.postBatchCamera(B),B.emit(h.POST_RENDER,B)},preRender:function(){if(!this.contextLost){var B=this.gl;if(B.bindFramebuffer(B.FRAMEBUFFER,null),this.config.clearBeforeRender){var G=this.config.backgroundColor;B.clearColor(G.redGL,G.greenGL,G.blueGL,G.alphaGL),B.clear(B.COLOR_BUFFER_BIT|B.DEPTH_BUFFER_BIT|B.STENCIL_BUFFER_BIT)}B.enable(B.SCISSOR_TEST),this.currentScissor=this.defaultScissor,this.scissorStack.length=0,this.scissorStack.push(this.currentScissor),this.game.scene.customViewports&&B.scissor(0,this.drawingBufferHeight-this.height,this.width,this.height),this.currentMask.mask=null,this.currentCameraMask.mask=null,this.maskStack.length=0,this.emit(u.PRE_RENDER)}},render:function(B,G,z){if(!this.contextLost){var X=G.length;if(this.emit(u.RENDER,B,z),this.preRenderCamera(z),X===0){this.setBlendMode(l.BlendModes.NORMAL),this.postRenderCamera(z);return}this.currentType="";for(var j=this.currentMask,Q=0;Q{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -4745,7 +4745,7 @@ return new `+this.key+`(); * @author Felipe Alfonso <@bitnenfer> * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83419),p=e(95540),h=e(31063),a=e(57516),l=e(61340),n=e(26099),u=e(29100),f=new r({Extends:a,initialize:function(c){var d=p(c,"fragShader",h);c.fragShader=d.replace("%LIGHT_COUNT%",c.game.renderer.config.maxLights),a.call(this,c),this.inverseRotationMatrix=new Float32Array([1,0,0,0,1,0,0,0,1]),this.currentNormalMap,this.lightsActive=!0,this.tempVec2=new n,this._tempMatrix=new l,this._tempMatrix2=new l},boot:function(){u.prototype.boot.call(this)},onRender:function(o,c){var d=o.sys.lights;if(this.lightsActive=!1,!(!d||!d.active)){var v=d.getLights(c),m=v.length;this.lightsActive=!0;var S,M=this.renderer,w=M.height,C=c.matrix,A=this.tempVec2;for(this.set1i("uMainSampler",0),this.set1i("uNormSampler",1),this.set2f("uResolution",this.width/2,this.height/2),this.set4f("uCamera",c.x,c.y,c.rotation,c.zoom),this.set3f("uAmbientLightColor",d.ambientColor.r,d.ambientColor.g,d.ambientColor.b),this.set1i("uLightCount",m),S=0;S0&&this.flush();var c=this.inverseRotationMatrix;if(o){var d=-o,v=Math.cos(d),m=Math.sin(d);c[1]=m,c[3]=-m,c[0]=c[4]=v}else c[0]=c[4]=1,c[1]=c[3]=0;this.setMatrix3fv("uInverseRotationMatrix",!1,c),this.currentNormalMapRotation=o}},setTexture2D:function(o,c){var d=this.renderer;o===void 0&&(o=d.whiteTexture);var v=this.getNormalMap(c);this.isNewNormalMap(o,v)&&(this.flush(),this.createBatch(o),this.addTextureToBatch(v),this.currentNormalMap=v);var m=0;if(c&&c.parentContainer){var S=c.getWorldTransformMatrix(this._tempMatrix,this._tempMatrix2);m=S.rotationNormalized}else c&&(m=c.rotation);return this.setNormalMapRotation(m),0},setGameObject:function(o,c){c===void 0&&(c=o.frame);var d=c.glTexture,v=this.getNormalMap(o);if(this.isNewNormalMap(d,v)&&(this.flush(),this.createBatch(d),this.addTextureToBatch(v),this.currentNormalMap=v),o.parentContainer){var m=o.getWorldTransformMatrix(this._tempMatrix,this._tempMatrix2);this.setNormalMapRotation(m.rotationNormalized)}else this.setNormalMapRotation(o.rotation);return 0},isNewNormalMap:function(o,c){return this.currentTexture!==o||this.currentNormalMap!==c},getNormalMap:function(o){var c;if(o)o.displayTexture?c=o.displayTexture.dataSource[o.displayFrame.sourceIndex]:o.texture?c=o.texture.dataSource[o.frame.sourceIndex]:o.tileset&&(Array.isArray(o.tileset)?c=o.tileset[0].image.dataSource[0]:c=o.tileset.image.dataSource[0]);else return this.renderer.normalTexture;return c?c.glTexture:this.renderer.normalTexture},batchSprite:function(o,c,d){this.lightsActive&&a.prototype.batchSprite.call(this,o,c,d)},batchTexture:function(o,c,d,v,m,S,M,w,C,A,P,b,O,I,D,B,G,z,X,K,Q,tt,Y,Z,U,H,J,_,q,at,ot,rt){this.lightsActive&&a.prototype.batchTexture.call(this,o,c,d,v,m,S,M,w,C,A,P,b,O,I,D,B,G,z,X,K,Q,tt,Y,Z,U,H,J,_,q,at,ot,rt)},batchTextureFrame:function(o,c,d,v,m,S,M){this.lightsActive&&a.prototype.batchTextureFrame.call(this,o,c,d,v,m,S,M)}});s.exports=f},56527:(s,y,e)=>{/** + */var r=e(83419),p=e(95540),h=e(31063),a=e(57516),l=e(61340),n=e(26099),u=e(29100),f=new r({Extends:a,initialize:function(c){var d=p(c,"fragShader",h);c.fragShader=d.replace("%LIGHT_COUNT%",c.game.renderer.config.maxLights),a.call(this,c),this.inverseRotationMatrix=new Float32Array([1,0,0,0,1,0,0,0,1]),this.currentNormalMap,this.lightsActive=!0,this.tempVec2=new n,this._tempMatrix=new l,this._tempMatrix2=new l},boot:function(){u.prototype.boot.call(this)},onRender:function(o,c){var d=o.sys.lights;if(this.lightsActive=!1,!(!d||!d.active)){var v=d.getLights(c),m=v.length;this.lightsActive=!0;var S,M=this.renderer,w=M.height,C=c.matrix,A=this.tempVec2;for(this.set1i("uMainSampler",0),this.set1i("uNormSampler",1),this.set2f("uResolution",this.width/2,this.height/2),this.set4f("uCamera",c.x,c.y,c.rotation,c.zoom),this.set3f("uAmbientLightColor",d.ambientColor.r,d.ambientColor.g,d.ambientColor.b),this.set1i("uLightCount",m),S=0;S0&&this.flush();var c=this.inverseRotationMatrix;if(o){var d=-o,v=Math.cos(d),m=Math.sin(d);c[1]=m,c[3]=-m,c[0]=c[4]=v}else c[0]=c[4]=1,c[1]=c[3]=0;this.setMatrix3fv("uInverseRotationMatrix",!1,c),this.currentNormalMapRotation=o}},setTexture2D:function(o,c){var d=this.renderer;o===void 0&&(o=d.whiteTexture);var v=this.getNormalMap(c);this.isNewNormalMap(o,v)&&(this.flush(),this.createBatch(o),this.addTextureToBatch(v),this.currentNormalMap=v);var m=0;if(c&&c.parentContainer){var S=c.getWorldTransformMatrix(this._tempMatrix,this._tempMatrix2);m=S.rotationNormalized}else c&&(m=c.rotation);return this.setNormalMapRotation(m),0},setGameObject:function(o,c){c===void 0&&(c=o.frame);var d=c.glTexture,v=this.getNormalMap(o);if(this.isNewNormalMap(d,v)&&(this.flush(),this.createBatch(d),this.addTextureToBatch(v),this.currentNormalMap=v),o.parentContainer){var m=o.getWorldTransformMatrix(this._tempMatrix,this._tempMatrix2);this.setNormalMapRotation(m.rotationNormalized)}else this.setNormalMapRotation(o.rotation);return 0},isNewNormalMap:function(o,c){return this.currentTexture!==o||this.currentNormalMap!==c},getNormalMap:function(o){var c;if(o)o.displayTexture?c=o.displayTexture.dataSource[o.displayFrame.sourceIndex]:o.texture?c=o.texture.dataSource[o.frame.sourceIndex]:o.tileset&&(Array.isArray(o.tileset)?c=o.tileset[0].image.dataSource[0]:c=o.tileset.image.dataSource[0]);else return this.renderer.normalTexture;return c?c.glTexture:this.renderer.normalTexture},batchSprite:function(o,c,d){this.lightsActive&&a.prototype.batchSprite.call(this,o,c,d)},batchTexture:function(o,c,d,v,m,S,M,w,C,A,P,b,O,I,D,B,G,z,X,j,Q,tt,Y,Z,U,H,J,_,q,at,ot,rt){this.lightsActive&&a.prototype.batchTexture.call(this,o,c,d,v,m,S,M,w,C,A,P,b,O,I,D,B,G,z,X,j,Q,tt,Y,Z,U,H,J,_,q,at,ot,rt)},batchTextureFrame:function(o,c,d,v,m,S,M){this.lightsActive&&a.prototype.batchTextureFrame.call(this,o,c,d,v,m,S,M)}});s.exports=f},56527:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -4754,7 +4754,7 @@ return new `+this.key+`(); * @author Felipe Alfonso <@bitnenfer> * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83419),p=e(94811),h=e(95540),a=e(98840),l=e(44667),n=e(61340),u=e(70554),f=e(14500),o=e(29100),c=new r({Extends:o,initialize:function(v){var m=v.game.renderer,S=h(v,"fragShader",a);v.fragShader=u.parseFragmentShaderMaxTextures(S,m.maxTextures),v.vertShader=h(v,"vertShader",l),v.attributes=h(v,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2},{name:"inTexId"},{name:"inTintEffect"},{name:"inTint",size:4,type:f.UNSIGNED_BYTE,normalized:!0}]),v.resizeUniform="uResolution",o.call(this,v),this._tempMatrix1=new n,this._tempMatrix2=new n,this._tempMatrix3=new n,this.calcMatrix=new n,this.tempTriangle=[{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0}],this.strokeTint={TL:0,TR:0,BL:0,BR:0},this.fillTint={TL:0,TR:0,BL:0,BR:0},this.currentFrame={u0:0,v0:0,u1:1,v1:1},this.firstQuad=[0,0,0,0,0],this.prevQuad=[0,0,0,0,0],this.polygonCache=[]},boot:function(){o.prototype.boot.call(this);var d=this.renderer;this.set1iv("uMainSampler",d.textureIndexes),this.set2f("uResolution",d.width,d.height),this.set1i("uRoundPixels",d.config.roundPixels)},batchSprite:function(d,v,m){this.manager.set(this,d);var S=this._tempMatrix1,M=this._tempMatrix2,w=this._tempMatrix3,C=d.frame,A=C.glTexture,P=C.u0,b=C.v0,O=C.u1,I=C.v1,D=C.x,B=C.y,G=C.cutWidth,z=C.cutHeight,X=C.customPivot,K=d.displayOriginX,Q=d.displayOriginY,tt=-K+D,Y=-Q+B;if(d.isCropped){var Z=d._crop;(Z.flipX!==d.flipX||Z.flipY!==d.flipY)&&C.updateCropUVs(Z,d.flipX,d.flipY),P=Z.u0,b=Z.v0,O=Z.u1,I=Z.v1,G=Z.width,z=Z.height,D=Z.x,B=Z.y,tt=-K+D,Y=-Q+B}var U=1,H=1;d.flipX&&(X||(tt+=-C.realWidth+K*2),U=-1),d.flipY&&(X||(Y+=-C.realHeight+Q*2),H=-1);var J=d.x,_=d.y;M.applyITRS(J,_,d.rotation,d.scaleX*U,d.scaleY*H),S.copyFrom(v.matrix),m?(S.multiplyWithOffset(m,-v.scrollX*d.scrollFactorX,-v.scrollY*d.scrollFactorY),M.e=J,M.f=_):(M.e-=v.scrollX*d.scrollFactorX,M.f-=v.scrollY*d.scrollFactorY),S.multiply(M,w);var q=w.setQuad(tt,Y,tt+G,Y+z),at=u.getTintAppendFloatAlpha,ot=v.alpha,rt=at(d.tintTopLeft,ot*d._alphaTL),gt=at(d.tintTopRight,ot*d._alphaTR),yt=at(d.tintBottomLeft,ot*d._alphaBL),Et=at(d.tintBottomRight,ot*d._alphaBR);this.shouldFlush(6)&&this.flush();var At=this.setGameObject(d,C);this.manager.preBatch(d),this.currentShader.set1i("uRoundPixels",v.roundPixels),this.batchQuad(d,q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7],P,b,O,I,rt,gt,yt,Et,d.tintFill,A,At),this.manager.postBatch(d)},batchTexture:function(d,v,m,S,M,w,C,A,P,b,O,I,D,B,G,z,X,K,Q,tt,Y,Z,U,H,J,_,q,at,ot,rt,gt,yt,Et){Et===void 0&&(Et=!1),this.manager.set(this,d);var At=this._tempMatrix1,Pt=this._tempMatrix2,Vt=this._tempMatrix3,dt=K/m+q,ut=Q/S+at,Rt=(K+tt)/m+q,Dt=(Q+Y)/S+at,Ht=C,Bt=A,ne=-z,oe=-X;if(d.isCropped){var ge=d._crop,xe=ge.width,Ae=ge.height;Ht=xe,Bt=Ae,C=xe,A=Ae,K=ge.x,Q=ge.y;var qt=K,Ge=Q;I&&(qt=tt-ge.x-xe),D&&(Ge=Y-ge.y-Ae),dt=qt/m+q,ut=Ge/S+at,Rt=(qt+xe)/m+q,Dt=(Ge+Ae)/S+at,ne=-z+K,oe=-X+Q}D=D^(!gt&&v.isRenderTexture?1:0),I&&(Ht*=-1,ne+=C),D&&(Bt*=-1,oe+=A),Pt.applyITRS(M,w,O,P,b),At.copyFrom(ot.matrix),rt?(At.multiplyWithOffset(rt,-ot.scrollX*B,-ot.scrollY*G),Pt.e=M,Pt.f=w):(Pt.e-=ot.scrollX*B,Pt.f-=ot.scrollY*G),At.multiply(Pt,Vt);var Oe=Vt.setQuad(ne,oe,ne+Ht,oe+Bt);yt==null&&(yt=this.setTexture2D(v)),d&&!Et&&this.manager.preBatch(d),this.currentShader.set1i("uRoundPixels",ot.roundPixels),this.batchQuad(d,Oe[0],Oe[1],Oe[2],Oe[3],Oe[4],Oe[5],Oe[6],Oe[7],dt,ut,Rt,Dt,Z,U,H,J,_,v,yt),d&&!Et&&this.manager.postBatch(d)},batchTextureFrame:function(d,v,m,S,M,w,C){this.manager.set(this);var A=this._tempMatrix1.copyFrom(w),P=this._tempMatrix2;C?A.multiply(C,P):P=A;var b=P.setQuad(v,m,v+d.width,m+d.height),O=this.setTexture2D(d.source.glTexture);S=u.getTintAppendFloatAlpha(S,M),this.batchQuad(null,b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],d.u0,d.v0,d.u1,d.v1,S,S,S,S,0,d.glTexture,O)},batchFillRect:function(d,v,m,S,M,w){this.renderer.pipelines.set(this);var C=this.calcMatrix;w&&w.multiply(M,C);var A=C.setQuad(d,v,d+m,v+S),P=this.fillTint;this.batchQuad(null,A[0],A[1],A[2],A[3],A[4],A[5],A[6],A[7],0,0,1,1,P.TL,P.TR,P.BL,P.BR,2)},batchFillTriangle:function(d,v,m,S,M,w,C,A){this.renderer.pipelines.set(this);var P=this.calcMatrix;A&&A.multiply(C,P);var b=P.getX(d,v),O=P.getY(d,v),I=P.getX(m,S),D=P.getY(m,S),B=P.getX(M,w),G=P.getY(M,w),z=this.fillTint;this.currentShader.set1i("uRoundPixels",!1),this.batchTri(null,b,O,I,D,B,G,0,0,1,1,z.TL,z.TR,z.BL,2)},batchStrokeTriangle:function(d,v,m,S,M,w,C,A,P){var b=this.tempTriangle;b[0].x=d,b[0].y=v,b[0].width=C,b[1].x=m,b[1].y=S,b[1].width=C,b[2].x=M,b[2].y=w,b[2].width=C,b[3].x=d,b[3].y=v,b[3].width=C,this.batchStrokePath(b,C,!1,A,P)},batchFillPath:function(d,v,m){this.renderer.pipelines.set(this);var S=this.calcMatrix;m&&m.multiply(v,S);for(var M=d.length,w=this.polygonCache,C,A,P=this.fillTint.TL,b=this.fillTint.TR,O=this.fillTint.BL,I=0;I0&&Ht[4]?this.batchQuad(null,At,Pt,rt,gt,Ht[0],Ht[1],Ht[2],Ht[3],0,0,1,1,dt,ut,Rt,Dt,2):(Bt[0]=At,Bt[1]=Pt,Bt[2]=rt,Bt[3]=gt,Bt[4]=1),P&&Bt[4]?this.batchQuad(null,at,ot,yt,Et,Bt[0],Bt[1],Bt[2],Bt[3],0,0,1,1,dt,ut,Rt,Dt,2):(Ht[0]=at,Ht[1]=ot,Ht[2]=yt,Ht[3]=Et,Ht[4]=1)}}},destroy:function(){return this._tempMatrix1.destroy(),this._tempMatrix2.destroy(),this._tempMatrix3.destroy(),this._tempMatrix1=null,this._tempMatrix1=null,this._tempMatrix1=null,o.prototype.destroy.call(this),this}});s.exports=c},43439:(s,y,e)=>{/** + */var r=e(83419),p=e(94811),h=e(95540),a=e(98840),l=e(44667),n=e(61340),u=e(70554),f=e(14500),o=e(29100),c=new r({Extends:o,initialize:function(v){var m=v.game.renderer,S=h(v,"fragShader",a);v.fragShader=u.parseFragmentShaderMaxTextures(S,m.maxTextures),v.vertShader=h(v,"vertShader",l),v.attributes=h(v,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2},{name:"inTexId"},{name:"inTintEffect"},{name:"inTint",size:4,type:f.UNSIGNED_BYTE,normalized:!0}]),v.resizeUniform="uResolution",o.call(this,v),this._tempMatrix1=new n,this._tempMatrix2=new n,this._tempMatrix3=new n,this.calcMatrix=new n,this.tempTriangle=[{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0}],this.strokeTint={TL:0,TR:0,BL:0,BR:0},this.fillTint={TL:0,TR:0,BL:0,BR:0},this.currentFrame={u0:0,v0:0,u1:1,v1:1},this.firstQuad=[0,0,0,0,0],this.prevQuad=[0,0,0,0,0],this.polygonCache=[]},boot:function(){o.prototype.boot.call(this);var d=this.renderer;this.set1iv("uMainSampler",d.textureIndexes),this.set2f("uResolution",d.width,d.height),this.set1i("uRoundPixels",d.config.roundPixels)},batchSprite:function(d,v,m){this.manager.set(this,d);var S=this._tempMatrix1,M=this._tempMatrix2,w=this._tempMatrix3,C=d.frame,A=C.glTexture,P=C.u0,b=C.v0,O=C.u1,I=C.v1,D=C.x,B=C.y,G=C.cutWidth,z=C.cutHeight,X=C.customPivot,j=d.displayOriginX,Q=d.displayOriginY,tt=-j+D,Y=-Q+B;if(d.isCropped){var Z=d._crop;(Z.flipX!==d.flipX||Z.flipY!==d.flipY)&&C.updateCropUVs(Z,d.flipX,d.flipY),P=Z.u0,b=Z.v0,O=Z.u1,I=Z.v1,G=Z.width,z=Z.height,D=Z.x,B=Z.y,tt=-j+D,Y=-Q+B}var U=1,H=1;d.flipX&&(X||(tt+=-C.realWidth+j*2),U=-1),d.flipY&&(X||(Y+=-C.realHeight+Q*2),H=-1);var J=d.x,_=d.y;M.applyITRS(J,_,d.rotation,d.scaleX*U,d.scaleY*H),S.copyFrom(v.matrix),m?(S.multiplyWithOffset(m,-v.scrollX*d.scrollFactorX,-v.scrollY*d.scrollFactorY),M.e=J,M.f=_):(M.e-=v.scrollX*d.scrollFactorX,M.f-=v.scrollY*d.scrollFactorY),S.multiply(M,w);var q=w.setQuad(tt,Y,tt+G,Y+z),at=u.getTintAppendFloatAlpha,ot=v.alpha,rt=at(d.tintTopLeft,ot*d._alphaTL),gt=at(d.tintTopRight,ot*d._alphaTR),yt=at(d.tintBottomLeft,ot*d._alphaBL),Et=at(d.tintBottomRight,ot*d._alphaBR);this.shouldFlush(6)&&this.flush();var At=this.setGameObject(d,C);this.manager.preBatch(d),this.currentShader.set1i("uRoundPixels",v.roundPixels),this.batchQuad(d,q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7],P,b,O,I,rt,gt,yt,Et,d.tintFill,A,At),this.manager.postBatch(d)},batchTexture:function(d,v,m,S,M,w,C,A,P,b,O,I,D,B,G,z,X,j,Q,tt,Y,Z,U,H,J,_,q,at,ot,rt,gt,yt,Et){Et===void 0&&(Et=!1),this.manager.set(this,d);var At=this._tempMatrix1,Pt=this._tempMatrix2,Vt=this._tempMatrix3,dt=j/m+q,ut=Q/S+at,Rt=(j+tt)/m+q,Dt=(Q+Y)/S+at,Ht=C,Bt=A,re=-z,le=-X;if(d.isCropped){var ge=d._crop,xe=ge.width,Pe=ge.height;Ht=xe,Bt=Pe,C=xe,A=Pe,j=ge.x,Q=ge.y;var te=j,Ge=Q;I&&(te=tt-ge.x-xe),D&&(Ge=Y-ge.y-Pe),dt=te/m+q,ut=Ge/S+at,Rt=(te+xe)/m+q,Dt=(Ge+Pe)/S+at,re=-z+j,le=-X+Q}D=D^(!gt&&v.isRenderTexture?1:0),I&&(Ht*=-1,re+=C),D&&(Bt*=-1,le+=A),Pt.applyITRS(M,w,O,P,b),At.copyFrom(ot.matrix),rt?(At.multiplyWithOffset(rt,-ot.scrollX*B,-ot.scrollY*G),Pt.e=M,Pt.f=w):(Pt.e-=ot.scrollX*B,Pt.f-=ot.scrollY*G),At.multiply(Pt,Vt);var Oe=Vt.setQuad(re,le,re+Ht,le+Bt);yt==null&&(yt=this.setTexture2D(v)),d&&!Et&&this.manager.preBatch(d),this.currentShader.set1i("uRoundPixels",ot.roundPixels),this.batchQuad(d,Oe[0],Oe[1],Oe[2],Oe[3],Oe[4],Oe[5],Oe[6],Oe[7],dt,ut,Rt,Dt,Z,U,H,J,_,v,yt),d&&!Et&&this.manager.postBatch(d)},batchTextureFrame:function(d,v,m,S,M,w,C){this.manager.set(this);var A=this._tempMatrix1.copyFrom(w),P=this._tempMatrix2;C?A.multiply(C,P):P=A;var b=P.setQuad(v,m,v+d.width,m+d.height),O=this.setTexture2D(d.source.glTexture);S=u.getTintAppendFloatAlpha(S,M),this.batchQuad(null,b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],d.u0,d.v0,d.u1,d.v1,S,S,S,S,0,d.glTexture,O)},batchFillRect:function(d,v,m,S,M,w){this.renderer.pipelines.set(this);var C=this.calcMatrix;w&&w.multiply(M,C);var A=C.setQuad(d,v,d+m,v+S),P=this.fillTint;this.batchQuad(null,A[0],A[1],A[2],A[3],A[4],A[5],A[6],A[7],0,0,1,1,P.TL,P.TR,P.BL,P.BR,2)},batchFillTriangle:function(d,v,m,S,M,w,C,A){this.renderer.pipelines.set(this);var P=this.calcMatrix;A&&A.multiply(C,P);var b=P.getX(d,v),O=P.getY(d,v),I=P.getX(m,S),D=P.getY(m,S),B=P.getX(M,w),G=P.getY(M,w),z=this.fillTint;this.currentShader.set1i("uRoundPixels",!1),this.batchTri(null,b,O,I,D,B,G,0,0,1,1,z.TL,z.TR,z.BL,2)},batchStrokeTriangle:function(d,v,m,S,M,w,C,A,P){var b=this.tempTriangle;b[0].x=d,b[0].y=v,b[0].width=C,b[1].x=m,b[1].y=S,b[1].width=C,b[2].x=M,b[2].y=w,b[2].width=C,b[3].x=d,b[3].y=v,b[3].width=C,this.batchStrokePath(b,C,!1,A,P)},batchFillPath:function(d,v,m){this.renderer.pipelines.set(this);var S=this.calcMatrix;m&&m.multiply(v,S);for(var M=d.length,w=this.polygonCache,C,A,P=this.fillTint.TL,b=this.fillTint.TR,O=this.fillTint.BL,I=0;I0&&Ht[4]?this.batchQuad(null,At,Pt,rt,gt,Ht[0],Ht[1],Ht[2],Ht[3],0,0,1,1,dt,ut,Rt,Dt,2):(Bt[0]=At,Bt[1]=Pt,Bt[2]=rt,Bt[3]=gt,Bt[4]=1),P&&Bt[4]?this.batchQuad(null,at,ot,yt,Et,Bt[0],Bt[1],Bt[2],Bt[3],0,0,1,1,dt,ut,Rt,Dt,2):(Ht[0]=at,Ht[1]=ot,Ht[2]=yt,Ht[3]=Et,Ht[4]=1)}}},destroy:function(){return this._tempMatrix1.destroy(),this._tempMatrix2.destroy(),this._tempMatrix3.destroy(),this._tempMatrix1=null,this._tempMatrix1=null,this._tempMatrix1=null,o.prototype.destroy.call(this),this}});s.exports=c},43439:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -4766,7 +4766,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(10312),p=e(67502),h=e(83419),a=e(96293),l=e(95540),n=e(57516),u=e(27681),f=e(87841),o=e(32302),c=e(45561),d=e(60722),v=e(29100),m=new h({Extends:n,initialize:function(M){var w=l(M,"fragShader",u),C=l(M,"vertShader",d),A=l(M,"drawShader",u),P=[{name:"DrawSprite",fragShader:c,vertShader:d},{name:"CopySprite",fragShader:w,vertShader:C},{name:"DrawGame",fragShader:A,vertShader:d},{name:"ColorMatrix",fragShader:a}],b=l(M,"shaders",[]);M.shaders=P.concat(b),M.vertShader||(M.vertShader=C),M.batchSize=1,n.call(this,M),this.isPreFX=!0,this.customMainSampler=null,this.drawSpriteShader,this.copyShader,this.gameShader,this.colorMatrixShader,this.quadVertexData,this.quadVertexBuffer,this.quadVertexViewF32,this.spriteBounds=new f,this.targetBounds=new f,this.fsTarget,this.tempSprite,this.renderer.isBooted&&(this.manager=this.renderer.pipelines,this.boot())},boot:function(){v.prototype.boot.call(this);var S=this.shaders,M=this.renderer;this.drawSpriteShader=S[0],this.copyShader=S[1],this.gameShader=S[2],this.colorMatrixShader=S[3],this.fsTarget=new o(M,M.width,M.height,1,0,!0,!0),this.renderTargets=this.manager.renderTargets.concat(this.fsTarget);var w=new ArrayBuffer(168);this.quadVertexData=w,this.quadVertexViewF32=new Float32Array(w),this.quadVertexBuffer=M.createVertexBuffer(w,this.gl.STATIC_DRAW),this.onResize(M.width,M.height),this.currentShader=this.copyShader,this.set2f("uResolution",M.width,M.height),this.set1i("uRoundPixels",M.config.roundPixels)},onResize:function(S,M){var w=this.quadVertexViewF32;w[1]=M,w[22]=M,w[14]=S,w[28]=S,w[35]=S,w[36]=M},batchQuad:function(S,M,w,C,A,P,b,O,I,D,B,G,z,X,K,Q,tt,Y,Z){var U=Math.min(M,C,P,O),H=Math.min(w,A,b,I),J=Math.max(M,C,P,O),_=Math.max(w,A,b,I),q=J-U,at=_-H,ot=this.spriteBounds.setTo(U,H,q,at),rt=S?S.preFX.padding:0,gt=q+rt*2,yt=at+rt*2,Et=Math.abs(Math.max(gt,yt)),At=this.manager.getRenderTarget(Et),Pt=this.targetBounds.setTo(0,0,At.width,At.height);p(Pt,ot.centerX,ot.centerY),this.tempSprite=S;var Vt=this.gl,dt=this.renderer;dt.clearStencilMask(),this.setShader(this.drawSpriteShader),this.set1i("uMainSampler",0),this.set2f("uResolution",dt.width,dt.height),this.set1i("uRoundPixels",dt.config.roundPixels),this.flipProjectionMatrix(!0),S&&(this.onDrawSprite(S,At),S.preFX.onFX(this));var ut=this.fsTarget;return this.flush(),Vt.viewport(0,0,dt.width,dt.height),Vt.bindFramebuffer(Vt.FRAMEBUFFER,ut.framebuffer.webGLFramebuffer),Vt.framebufferTexture2D(Vt.FRAMEBUFFER,Vt.COLOR_ATTACHMENT0,Vt.TEXTURE_2D,ut.texture.webGLTexture,0),Vt.clearColor(0,0,0,0),Vt.clear(Vt.COLOR_BUFFER_BIT),this.setTexture2D(Z),this.batchVert(M,w,D,B,0,Y,X),this.batchVert(C,A,D,z,0,Y,Q),this.batchVert(P,b,G,z,0,Y,tt),this.batchVert(M,w,D,B,0,Y,X),this.batchVert(P,b,G,z,0,Y,tt),this.batchVert(O,I,G,B,0,Y,K),this.flush(),this.flipProjectionMatrix(!1),Vt.activeTexture(Vt.TEXTURE0),Vt.bindTexture(Vt.TEXTURE_2D,At.texture.webGLTexture),Vt.copyTexSubImage2D(Vt.TEXTURE_2D,0,0,0,Pt.x,Pt.y,Pt.width,Pt.height),Vt.bindFramebuffer(Vt.FRAMEBUFFER,null),Vt.bindTexture(Vt.TEXTURE_2D,null),this.onBatch(S),this.currentShader=this.copyShader,this.onDraw(At,this.manager.getSwapRenderTarget(),this.manager.getAltSwapRenderTarget()),!0},onDrawSprite:function(){},onCopySprite:function(){},copySprite:function(S,M,w,C,A,P,b){w===void 0&&(w=!0),C===void 0&&(C=!0),A===void 0&&(A=!1),b===void 0&&(b=this.copyShader);var O=this.gl,I=this.tempSprite;P&&(b=this.colorMatrixShader),this.currentShader=b;var D=this.setVertexBuffer(this.quadVertexBuffer);b.bind(D,!1);var B=this.renderer;if(this.set1i("uMainSampler",0),this.set2f("uResolution",B.width,B.height),this.set1i("uRoundPixels",B.config.roundPixels),I.preFX.onFXCopy(this),this.onCopySprite(S,M,I),P&&(this.set1fv("uColorMatrix",P.getData()),this.set1f("uAlpha",P.alpha)),O.activeTexture(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,S.texture.webGLTexture),S.height>M.height)O.viewport(0,0,S.width,S.height),this.setTargetUVs(S,M);else{var G=M.height-S.height;O.viewport(0,G,S.width,S.height),this.resetUVs()}if(O.bindFramebuffer(O.FRAMEBUFFER,M.framebuffer.webGLFramebuffer),O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_2D,M.texture.webGLTexture,0),w&&(O.clearColor(0,0,0,+!C),O.clear(O.COLOR_BUFFER_BIT)),A){var z=this.renderer.currentBlendMode;this.renderer.setBlendMode(r.ERASE)}O.bufferData(O.ARRAY_BUFFER,this.quadVertexData,O.STATIC_DRAW),O.drawArrays(O.TRIANGLES,0,6),A&&this.renderer.setBlendMode(z),O.bindFramebuffer(O.FRAMEBUFFER,null)},copy:function(S,M){var w=this.gl;this.set1i("uMainSampler",0),w.activeTexture(w.TEXTURE0),w.bindTexture(w.TEXTURE_2D,S.texture.webGLTexture),w.viewport(0,0,S.width,S.height),this.setUVs(0,0,0,1,1,1,1,0),w.bindFramebuffer(w.FRAMEBUFFER,M.framebuffer.webGLFramebuffer),w.framebufferTexture2D(w.FRAMEBUFFER,w.COLOR_ATTACHMENT0,w.TEXTURE_2D,M.texture.webGLTexture,0),w.clearColor(0,0,0,0),w.clear(w.COLOR_BUFFER_BIT),w.bufferData(w.ARRAY_BUFFER,this.quadVertexData,w.STATIC_DRAW),w.drawArrays(w.TRIANGLES,0,6),w.bindFramebuffer(w.FRAMEBUFFER,null)},blendFrames:function(S,M,w,C,A){this.manager.blendFrames(S,M,w,C,A)},blendFramesAdditive:function(S,M,w,C,A){this.manager.blendFramesAdditive(S,M,w,C,A)},drawToGame:function(S){this.currentShader=null,this.setShader(this.copyShader),this.bindAndDraw(S)},copyToGame:function(S){this.currentShader=null,this.setShader(this.gameShader),this.bindAndDraw(S)},bindAndDraw:function(S){var M=this.gl,w=this.renderer;this.set1i("uMainSampler",0),this.customMainSampler?this.setTexture2D(this.customMainSampler):this.setTexture2D(S.texture);var C=this._tempMatrix1.loadIdentity(),A=this.targetBounds.x,P=this.targetBounds.y,b=A+S.width,O=P+S.height,I=C.getX(A,P),D=C.getX(A,O),B=C.getX(b,O),G=C.getX(b,P),z=C.getY(A,P),X=C.getY(A,O),K=C.getY(b,O),Q=C.getY(b,P),tt=16777215;this.batchVert(I,z,0,0,0,0,tt),this.batchVert(D,X,0,1,0,0,tt),this.batchVert(B,K,1,1,0,0,tt),this.batchVert(I,z,0,0,0,0,tt),this.batchVert(B,K,1,1,0,0,tt),this.batchVert(G,Q,1,0,0,0,tt),w.restoreFramebuffer(!1,!0),w.currentFramebuffer||M.viewport(0,0,w.width,w.height),w.restoreStencilMask(),this.flush(),this.tempSprite=null},onDraw:function(S){this.drawToGame(S)},setUVs:function(S,M,w,C,A,P,b,O){var I=this.quadVertexViewF32;I[2]=S,I[3]=M,I[9]=w,I[10]=C,I[16]=A,I[17]=P,I[23]=S,I[24]=M,I[30]=A,I[31]=P,I[37]=b,I[38]=O},setTargetUVs:function(S,M){var w=M.height/S.height;w>.5?w=.5-(w-.5):w=.5+(.5-w),this.setUVs(0,w,0,1+w,1,1+w,1,w)},resetUVs:function(){this.setUVs(0,0,0,1,1,1,1,0)},destroy:function(){return this.renderer.deleteBuffer(this.quadVertexBuffer),this.drawSpriteShader=null,this.copyShader=null,this.gameShader=null,this.colorMatrixShader=null,this.quadVertexData=null,this.quadVertexBuffer=null,this.quadVertexViewF32=null,this.fsTarget=null,this.tempSprite=null,n.prototype.destroy.call(this),this}});s.exports=m},81041:(s,y,e)=>{/** + */var r=e(10312),p=e(67502),h=e(83419),a=e(96293),l=e(95540),n=e(57516),u=e(27681),f=e(87841),o=e(32302),c=e(45561),d=e(60722),v=e(29100),m=new h({Extends:n,initialize:function(M){var w=l(M,"fragShader",u),C=l(M,"vertShader",d),A=l(M,"drawShader",u),P=[{name:"DrawSprite",fragShader:c,vertShader:d},{name:"CopySprite",fragShader:w,vertShader:C},{name:"DrawGame",fragShader:A,vertShader:d},{name:"ColorMatrix",fragShader:a}],b=l(M,"shaders",[]);M.shaders=P.concat(b),M.vertShader||(M.vertShader=C),M.batchSize=1,n.call(this,M),this.isPreFX=!0,this.customMainSampler=null,this.drawSpriteShader,this.copyShader,this.gameShader,this.colorMatrixShader,this.quadVertexData,this.quadVertexBuffer,this.quadVertexViewF32,this.spriteBounds=new f,this.targetBounds=new f,this.fsTarget,this.tempSprite,this.renderer.isBooted&&(this.manager=this.renderer.pipelines,this.boot())},boot:function(){v.prototype.boot.call(this);var S=this.shaders,M=this.renderer;this.drawSpriteShader=S[0],this.copyShader=S[1],this.gameShader=S[2],this.colorMatrixShader=S[3],this.fsTarget=new o(M,M.width,M.height,1,0,!0,!0),this.renderTargets=this.manager.renderTargets.concat(this.fsTarget);var w=new ArrayBuffer(168);this.quadVertexData=w,this.quadVertexViewF32=new Float32Array(w),this.quadVertexBuffer=M.createVertexBuffer(w,this.gl.STATIC_DRAW),this.onResize(M.width,M.height),this.currentShader=this.copyShader,this.set2f("uResolution",M.width,M.height),this.set1i("uRoundPixels",M.config.roundPixels)},onResize:function(S,M){var w=this.quadVertexViewF32;w[1]=M,w[22]=M,w[14]=S,w[28]=S,w[35]=S,w[36]=M},batchQuad:function(S,M,w,C,A,P,b,O,I,D,B,G,z,X,j,Q,tt,Y,Z){var U=Math.min(M,C,P,O),H=Math.min(w,A,b,I),J=Math.max(M,C,P,O),_=Math.max(w,A,b,I),q=J-U,at=_-H,ot=this.spriteBounds.setTo(U,H,q,at),rt=S?S.preFX.padding:0,gt=q+rt*2,yt=at+rt*2,Et=Math.abs(Math.max(gt,yt)),At=this.manager.getRenderTarget(Et),Pt=this.targetBounds.setTo(0,0,At.width,At.height);p(Pt,ot.centerX,ot.centerY),this.tempSprite=S;var Vt=this.gl,dt=this.renderer;dt.clearStencilMask(),this.setShader(this.drawSpriteShader),this.set1i("uMainSampler",0),this.set2f("uResolution",dt.width,dt.height),this.set1i("uRoundPixels",dt.config.roundPixels),this.flipProjectionMatrix(!0),S&&(this.onDrawSprite(S,At),S.preFX.onFX(this));var ut=this.fsTarget;return this.flush(),Vt.viewport(0,0,dt.width,dt.height),Vt.bindFramebuffer(Vt.FRAMEBUFFER,ut.framebuffer.webGLFramebuffer),Vt.framebufferTexture2D(Vt.FRAMEBUFFER,Vt.COLOR_ATTACHMENT0,Vt.TEXTURE_2D,ut.texture.webGLTexture,0),Vt.clearColor(0,0,0,0),Vt.clear(Vt.COLOR_BUFFER_BIT),this.setTexture2D(Z),this.batchVert(M,w,D,B,0,Y,X),this.batchVert(C,A,D,z,0,Y,Q),this.batchVert(P,b,G,z,0,Y,tt),this.batchVert(M,w,D,B,0,Y,X),this.batchVert(P,b,G,z,0,Y,tt),this.batchVert(O,I,G,B,0,Y,j),this.flush(),this.flipProjectionMatrix(!1),Vt.activeTexture(Vt.TEXTURE0),Vt.bindTexture(Vt.TEXTURE_2D,At.texture.webGLTexture),Vt.copyTexSubImage2D(Vt.TEXTURE_2D,0,0,0,Pt.x,Pt.y,Pt.width,Pt.height),Vt.bindFramebuffer(Vt.FRAMEBUFFER,null),Vt.bindTexture(Vt.TEXTURE_2D,null),this.onBatch(S),this.currentShader=this.copyShader,this.onDraw(At,this.manager.getSwapRenderTarget(),this.manager.getAltSwapRenderTarget()),!0},onDrawSprite:function(){},onCopySprite:function(){},copySprite:function(S,M,w,C,A,P,b){w===void 0&&(w=!0),C===void 0&&(C=!0),A===void 0&&(A=!1),b===void 0&&(b=this.copyShader);var O=this.gl,I=this.tempSprite;P&&(b=this.colorMatrixShader),this.currentShader=b;var D=this.setVertexBuffer(this.quadVertexBuffer);b.bind(D,!1);var B=this.renderer;if(this.set1i("uMainSampler",0),this.set2f("uResolution",B.width,B.height),this.set1i("uRoundPixels",B.config.roundPixels),I.preFX.onFXCopy(this),this.onCopySprite(S,M,I),P&&(this.set1fv("uColorMatrix",P.getData()),this.set1f("uAlpha",P.alpha)),O.activeTexture(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,S.texture.webGLTexture),S.height>M.height)O.viewport(0,0,S.width,S.height),this.setTargetUVs(S,M);else{var G=M.height-S.height;O.viewport(0,G,S.width,S.height),this.resetUVs()}if(O.bindFramebuffer(O.FRAMEBUFFER,M.framebuffer.webGLFramebuffer),O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_2D,M.texture.webGLTexture,0),w&&(O.clearColor(0,0,0,+!C),O.clear(O.COLOR_BUFFER_BIT)),A){var z=this.renderer.currentBlendMode;this.renderer.setBlendMode(r.ERASE)}O.bufferData(O.ARRAY_BUFFER,this.quadVertexData,O.STATIC_DRAW),O.drawArrays(O.TRIANGLES,0,6),A&&this.renderer.setBlendMode(z),O.bindFramebuffer(O.FRAMEBUFFER,null)},copy:function(S,M){var w=this.gl;this.set1i("uMainSampler",0),w.activeTexture(w.TEXTURE0),w.bindTexture(w.TEXTURE_2D,S.texture.webGLTexture),w.viewport(0,0,S.width,S.height),this.setUVs(0,0,0,1,1,1,1,0),w.bindFramebuffer(w.FRAMEBUFFER,M.framebuffer.webGLFramebuffer),w.framebufferTexture2D(w.FRAMEBUFFER,w.COLOR_ATTACHMENT0,w.TEXTURE_2D,M.texture.webGLTexture,0),w.clearColor(0,0,0,0),w.clear(w.COLOR_BUFFER_BIT),w.bufferData(w.ARRAY_BUFFER,this.quadVertexData,w.STATIC_DRAW),w.drawArrays(w.TRIANGLES,0,6),w.bindFramebuffer(w.FRAMEBUFFER,null)},blendFrames:function(S,M,w,C,A){this.manager.blendFrames(S,M,w,C,A)},blendFramesAdditive:function(S,M,w,C,A){this.manager.blendFramesAdditive(S,M,w,C,A)},drawToGame:function(S){this.currentShader=null,this.setShader(this.copyShader),this.bindAndDraw(S)},copyToGame:function(S){this.currentShader=null,this.setShader(this.gameShader),this.bindAndDraw(S)},bindAndDraw:function(S){var M=this.gl,w=this.renderer;this.set1i("uMainSampler",0),this.customMainSampler?this.setTexture2D(this.customMainSampler):this.setTexture2D(S.texture);var C=this._tempMatrix1.loadIdentity(),A=this.targetBounds.x,P=this.targetBounds.y,b=A+S.width,O=P+S.height,I=C.getX(A,P),D=C.getX(A,O),B=C.getX(b,O),G=C.getX(b,P),z=C.getY(A,P),X=C.getY(A,O),j=C.getY(b,O),Q=C.getY(b,P),tt=16777215;this.batchVert(I,z,0,0,0,0,tt),this.batchVert(D,X,0,1,0,0,tt),this.batchVert(B,j,1,1,0,0,tt),this.batchVert(I,z,0,0,0,0,tt),this.batchVert(B,j,1,1,0,0,tt),this.batchVert(G,Q,1,0,0,0,tt),w.restoreFramebuffer(!1,!0),w.currentFramebuffer||M.viewport(0,0,w.width,w.height),w.restoreStencilMask(),this.flush(),this.tempSprite=null},onDraw:function(S){this.drawToGame(S)},setUVs:function(S,M,w,C,A,P,b,O){var I=this.quadVertexViewF32;I[2]=S,I[3]=M,I[9]=w,I[10]=C,I[16]=A,I[17]=P,I[23]=S,I[24]=M,I[30]=A,I[31]=P,I[37]=b,I[38]=O},setTargetUVs:function(S,M){var w=M.height/S.height;w>.5?w=.5-(w-.5):w=.5+(.5-w),this.setUVs(0,w,0,1+w,1,1+w,1,w)},resetUVs:function(){this.setUVs(0,0,0,1,1,1,1,0)},destroy:function(){return this.renderer.deleteBuffer(this.quadVertexBuffer),this.drawSpriteShader=null,this.copyShader=null,this.gameShader=null,this.colorMatrixShader=null,this.quadVertexData=null,this.quadVertexBuffer=null,this.quadVertexViewF32=null,this.fsTarget=null,this.tempSprite=null,n.prototype.destroy.call(this),this}});s.exports=m},81041:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -5301,7 +5301,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(43886);function p(C){if(!(this instanceof p))return new p(C);this._maxEntries=Math.max(4,C||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}p.prototype={all:function(){return this._all(this.data,[])},search:function(C){var A=this.data,P=[],b=this.toBBox;if(!S(C,A))return P;for(var O=[],I,D,B,G;A;){for(I=0,D=A.children.length;I=0&&I[A].children.length>this._maxEntries;)this._split(I,A),A--;this._adjustParentBBoxes(O,I,A)},_split:function(C,A){var P=C[A],b=P.children.length,O=this._minEntries;this._chooseSplitAxis(P,O,b);var I=this._chooseSplitIndex(P,O,b),D=M(P.children.splice(I,P.children.length-I));D.height=P.height,D.leaf=P.leaf,a(P,this.toBBox),a(D,this.toBBox),A?C[A-1].children.push(D):this._splitRoot(P,D)},_splitRoot:function(C,A){this.data=M([C,A]),this.data.height=C.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},_chooseSplitIndex:function(C,A,P){var b,O,I,D,B,G,z,X;for(G=z=1/0,b=A;b<=P-A;b++)O=l(C,0,b,this.toBBox),I=l(C,b,P,this.toBBox),D=v(O,I),B=o(O)+o(I),D=A;G--)z=C.children[G],n(D,C.leaf?O(z):z),B+=c(D);return B},_adjustParentBBoxes:function(C,A,P){for(var b=P;b>=0;b--)n(A[b],C)},_condense:function(C){for(var A=C.length-1,P;A>=0;A--)C[A].children.length===0?A>0?(P=C[A-1].children,P.splice(P.indexOf(C[A]),1)):this.clear():a(C[A],this.toBBox)},compareMinX:function(C,A){return C.left-A.left},compareMinY:function(C,A){return C.top-A.top},toBBox:function(C){return{minX:C.left,minY:C.top,maxX:C.right,maxY:C.bottom}}};function h(C,A,P){if(!P)return A.indexOf(C);for(var b=0;b=C.minX&&A.maxY>=C.minY}function M(C){return{children:C,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function w(C,A,P,b,O){for(var I=[A,P],D;I.length;)P=I.pop(),A=I.pop(),!(P-A<=b)&&(D=A+Math.ceil((P-A)/b/2)*b,r(C,D,A,P,O),I.push(A,D,D,P))}s.exports=p},35072:(s,y,e)=>{/** + */var r=e(43886);function p(C){if(!(this instanceof p))return new p(C);this._maxEntries=Math.max(4,C||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}p.prototype={all:function(){return this._all(this.data,[])},search:function(C){var A=this.data,P=[],b=this.toBBox;if(!S(C,A))return P;for(var O=[],I,D,B,G;A;){for(I=0,D=A.children.length;I=0&&I[A].children.length>this._maxEntries;)this._split(I,A),A--;this._adjustParentBBoxes(O,I,A)},_split:function(C,A){var P=C[A],b=P.children.length,O=this._minEntries;this._chooseSplitAxis(P,O,b);var I=this._chooseSplitIndex(P,O,b),D=M(P.children.splice(I,P.children.length-I));D.height=P.height,D.leaf=P.leaf,a(P,this.toBBox),a(D,this.toBBox),A?C[A-1].children.push(D):this._splitRoot(P,D)},_splitRoot:function(C,A){this.data=M([C,A]),this.data.height=C.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},_chooseSplitIndex:function(C,A,P){var b,O,I,D,B,G,z,X;for(G=z=1/0,b=A;b<=P-A;b++)O=l(C,0,b,this.toBBox),I=l(C,b,P,this.toBBox),D=v(O,I),B=o(O)+o(I),D=A;G--)z=C.children[G],n(D,C.leaf?O(z):z),B+=c(D);return B},_adjustParentBBoxes:function(C,A,P){for(var b=P;b>=0;b--)n(A[b],C)},_condense:function(C){for(var A=C.length-1,P;A>=0;A--)C[A].children.length===0?A>0?(P=C[A-1].children,P.splice(P.indexOf(C[A]),1)):this.clear():a(C[A],this.toBBox)},compareMinX:function(C,A){return C.left-A.left},compareMinY:function(C,A){return C.top-A.top},toBBox:function(C){return{minX:C.left,minY:C.top,maxX:C.right,maxY:C.bottom}}};function h(C,A,P){if(!P)return A.indexOf(C);for(var b=0;b=C.minX&&A.maxY>=C.minY}function M(C){return{children:C,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function w(C,A,P,b,O){for(var I=[A,P],D;I.length;)P=I.pop(),A=I.pop(),!(P-A<=b)&&(D=A+Math.ceil((P-A)/b/2)*b,r(C,D,A,P,O),I.push(A,D,D,P))}s.exports=p},35072:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -5333,11 +5333,11 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(10312),p=e(71911),h=e(27919),a=e(83419),l=e(8054),n=e(4327),u=e(95540),f=e(36060),o=e(32302),c=e(79237),d=e(70554),v=new a({Extends:c,initialize:function(S,M,w,C){w===void 0&&(w=256),C===void 0&&(C=256),this.type="DynamicTexture";var A=S.game.renderer,P=A&&A.type===l.CANVAS,b=P?h.create2D(this,w,C):[this];c.call(this,S,M,b,w,C),this.add("__BASE",0,0,0,w,C),this.renderer=A,this.width=-1,this.height=-1,this.isDrawing=!1,this.canvas=P?b:null,this.context=P?b.getContext("2d",{willReadFrequently:!0}):null,this.dirty=!1,this.isSpriteTexture=!0,this._eraseMode=!1,this.camera=new p(0,0,w,C).setScene(S.game.scene.systemScene,!1),this.renderTarget=P?null:new o(A,w,C,1,0,!1,!0,!0,!1),this.pipeline=P?null:A.pipelines.get(f.SINGLE_PIPELINE),this.setSize(w,C)},setSize:function(m,S){S===void 0&&(S=m);var M=this.get(),w=M.source;if(m!==this.width||S!==this.height){this.canvas&&(this.canvas.width=m,this.canvas.height=S);var C=this.renderTarget;C&&(C.willResize(m,S)&&C.resize(m,S),C.texture!==w.glTexture&&this.renderer.deleteTexture(w.glTexture),this.setFromRenderTarget()),this.camera.setSize(m,S),w.width=m,w.height=S,M.setSize(m,S),this.width=m,this.height=S}else{var A=this.getSourceImage();M.cutX+m>A.width&&(m=A.width-M.cutX),M.cutY+S>A.height&&(S=A.height-M.cutY),M.setSize(m,S,M.cutX,M.cutY)}return this},setFromRenderTarget:function(){var m=this.get(),S=m.source,M=this.renderTarget;return S.isRenderTexture=!0,S.isGLTexture=!0,S.glTexture=M.texture,this},setIsSpriteTexture:function(m){return this.isSpriteTexture=m,this},fill:function(m,S,M,w,C,A){var P=this.camera,b=this.renderer;S===void 0&&(S=1),M===void 0&&(M=0),w===void 0&&(w=0),C===void 0&&(C=this.width),A===void 0&&(A=this.height);var O=m>>16&255,I=m>>8&255,D=m&255,B=this.renderTarget;if(P.preRender(),B){B.bind(!0);var G=this.pipeline.manager.set(this.pipeline),z=b.width/B.width,X=b.height/B.height,K=B.height-(w+A);G.drawFillRect(M*z,K*X,C*z,A*X,d.getTintFromFloats(D/255,I/255,O/255,1),S),B.unbind(!0)}else{var Q=this.context;b.setContext(Q),Q.globalCompositeOperation="source-over",Q.fillStyle="rgba("+O+","+I+","+D+","+S+")",Q.fillRect(M,w,C,A),b.setContext()}return this.dirty=!0,this},clear:function(){if(this.dirty){var m=this.context,S=this.renderTarget;S?S.clear():m&&(m.save(),m.setTransform(1,0,0,1,0,0),m.clearRect(0,0,this.width,this.height),m.restore()),this.dirty=!1}return this},stamp:function(m,S,M,w,C){M===void 0&&(M=0),w===void 0&&(w=0);var A=u(C,"alpha",1),P=u(C,"tint",16777215),b=u(C,"angle",0),O=u(C,"rotation",0),I=u(C,"scale",1),D=u(C,"scaleX",I),B=u(C,"scaleY",I),G=u(C,"originX",.5),z=u(C,"originY",.5),X=u(C,"blendMode",0),K=u(C,"erase",!1),Q=u(C,"skipBatch",!1),tt=this.manager.resetStamp(A,P);return tt.setAngle(0),b!==0?tt.setAngle(b):O!==0&&tt.setRotation(O),tt.setScale(D,B),tt.setTexture(m,S),tt.setOrigin(G,z),tt.setBlendMode(X),K&&(this._eraseMode=!0),Q?this.batchGameObject(tt,M,w):this.draw(tt,M,w),K&&(this._eraseMode=!1),this},erase:function(m,S,M){return this._eraseMode=!0,this.draw(m,S,M),this._eraseMode=!1,this},draw:function(m,S,M,w,C){return this.beginDraw(),this.batchDraw(m,S,M,w,C),this.endDraw(),this},drawFrame:function(m,S,M,w,C,A){return this.beginDraw(),this.batchDrawFrame(m,S,M,w,C,A),this.endDraw(),this},repeat:function(m,S,M,w,C,A,P,b,O){if(M===void 0&&(M=0),w===void 0&&(w=0),C===void 0&&(C=this.width),A===void 0&&(A=this.height),P===void 0&&(P=1),b===void 0&&(b=16777215),O===void 0&&(O=!1),m instanceof n?S=m:S=this.manager.getFrame(m,S),!S)return this;var I=this.manager.resetStamp(P,b);I.setFrame(S),I.setOrigin(0);var D=S.width,B=S.height;C=Math.floor(C),A=Math.floor(A);var G=Math.ceil(C/D),z=Math.ceil(A/B),X=G*D-C,K=z*B-A;X>0&&(X=D-X),K>0&&(K=B-K),M<0&&(G+=Math.ceil(Math.abs(M)/D)),w<0&&(z+=Math.ceil(Math.abs(w)/B));var Q=M,tt=w,Y=!1,Z=this.manager.stampCrop.setTo(0,0,D,B);O||this.beginDraw();for(var U=0;U0&&H===G-1&&(Y=!0,Z.width=X),K>0&&U===z-1&&(Y=!0,Z.height=K),Y&&I.setCrop(Z),this.batchGameObject(I,Q,tt),I.isCropped=!1,Z.setTo(0,0,D,B),Q+=D}Q=M,tt+=B}return O||this.endDraw(),this},beginDraw:function(){if(!this.isDrawing){var m=this.camera,S=this.renderer,M=this.renderTarget;m.preRender(),M?S.beginCapture(M.width,M.height):S.setContext(this.context),this.isDrawing=!0}return this},batchDraw:function(m,S,M,w,C){return Array.isArray(m)||(m=[m]),this.batchList(m,S,M,w,C),this},batchDrawFrame:function(m,S,M,w,C,A){M===void 0&&(M=0),w===void 0&&(w=0),C===void 0&&(C=1),A===void 0&&(A=16777215);var P=this.manager.getFrame(m,S);return P&&(this.renderTarget?this.pipeline.batchTextureFrame(P,M,w,A,C,this.camera.matrix,null):this.batchTextureFrame(P,M,w,C,A)),this},endDraw:function(m){if(m===void 0&&(m=this._eraseMode),this.isDrawing){var S=this.renderer,M=this.renderTarget;if(M){var w=S.endCapture(),C=S.pipelines.setUtility();C.blitFrame(w,M,1,!1,!1,m,this.isSpriteTexture),S.resetScissor(),S.resetViewport()}else S.setContext();this.dirty=!0,this.isDrawing=!1}return this},batchList:function(m,S,M,w,C){var A=m.length;if(A!==0)for(var P=0;P0&&O.height>0&&b.drawImage(I,O.x,O.y,O.width,O.height,S,M,O.width,O.height),b.restore()}},snapshotArea:function(m,S,M,w,C,A,P){return this.renderTarget?this.renderer.snapshotFramebuffer(this.renderTarget.framebuffer,this.width,this.height,C,!1,m,S,M,w,A,P):this.renderer.snapshotCanvas(this.canvas,C,!1,m,S,M,w,A,P),this},snapshot:function(m,S,M){return this.snapshotArea(0,0,this.width,this.height,m,S,M)},snapshotPixel:function(m,S,M){return this.snapshotArea(m,S,1,1,M,"pixel")},getWebGLTexture:function(){if(this.renderTarget)return this.renderTarget.texture},renderWebGL:function(m,S,M,w){var C=this.manager.resetStamp();C.setTexture(this),C.setOrigin(0),C.renderWebGL(m,C,M,w)},renderCanvas:function(){},destroy:function(){var m=this.manager.stamp;m&&m.texture===this&&this.manager.resetStamp(),c.prototype.destroy.call(this),h.remove(this.canvas),this.renderTarget&&this.renderTarget.destroy(),this.camera.destroy(),this.canvas=null,this.context=null,this.renderer=null}});s.exports=v},4327:(s,y,e)=>{/** + */var r=e(10312),p=e(71911),h=e(27919),a=e(83419),l=e(8054),n=e(4327),u=e(95540),f=e(36060),o=e(32302),c=e(79237),d=e(70554),v=new a({Extends:c,initialize:function(S,M,w,C){w===void 0&&(w=256),C===void 0&&(C=256),this.type="DynamicTexture";var A=S.game.renderer,P=A&&A.type===l.CANVAS,b=P?h.create2D(this,w,C):[this];c.call(this,S,M,b,w,C),this.add("__BASE",0,0,0,w,C),this.renderer=A,this.width=-1,this.height=-1,this.isDrawing=!1,this.canvas=P?b:null,this.context=P?b.getContext("2d",{willReadFrequently:!0}):null,this.dirty=!1,this.isSpriteTexture=!0,this._eraseMode=!1,this.camera=new p(0,0,w,C).setScene(S.game.scene.systemScene,!1),this.renderTarget=P?null:new o(A,w,C,1,0,!1,!0,!0,!1),this.pipeline=P?null:A.pipelines.get(f.SINGLE_PIPELINE),this.setSize(w,C)},setSize:function(m,S){S===void 0&&(S=m);var M=this.get(),w=M.source;if(m!==this.width||S!==this.height){this.canvas&&(this.canvas.width=m,this.canvas.height=S);var C=this.renderTarget;C&&(C.willResize(m,S)&&C.resize(m,S),C.texture!==w.glTexture&&this.renderer.deleteTexture(w.glTexture),this.setFromRenderTarget()),this.camera.setSize(m,S),w.width=m,w.height=S,M.setSize(m,S),this.width=m,this.height=S}else{var A=this.getSourceImage();M.cutX+m>A.width&&(m=A.width-M.cutX),M.cutY+S>A.height&&(S=A.height-M.cutY),M.setSize(m,S,M.cutX,M.cutY)}return this},setFromRenderTarget:function(){var m=this.get(),S=m.source,M=this.renderTarget;return S.isRenderTexture=!0,S.isGLTexture=!0,S.glTexture=M.texture,this},setIsSpriteTexture:function(m){return this.isSpriteTexture=m,this},fill:function(m,S,M,w,C,A){var P=this.camera,b=this.renderer;S===void 0&&(S=1),M===void 0&&(M=0),w===void 0&&(w=0),C===void 0&&(C=this.width),A===void 0&&(A=this.height);var O=m>>16&255,I=m>>8&255,D=m&255,B=this.renderTarget;if(P.preRender(),B){B.bind(!0);var G=this.pipeline.manager.set(this.pipeline),z=b.width/B.width,X=b.height/B.height,j=B.height-(w+A);G.drawFillRect(M*z,j*X,C*z,A*X,d.getTintFromFloats(D/255,I/255,O/255,1),S),B.unbind(!0)}else{var Q=this.context;b.setContext(Q),Q.globalCompositeOperation="source-over",Q.fillStyle="rgba("+O+","+I+","+D+","+S+")",Q.fillRect(M,w,C,A),b.setContext()}return this.dirty=!0,this},clear:function(){if(this.dirty){var m=this.context,S=this.renderTarget;S?S.clear():m&&(m.save(),m.setTransform(1,0,0,1,0,0),m.clearRect(0,0,this.width,this.height),m.restore()),this.dirty=!1}return this},stamp:function(m,S,M,w,C){M===void 0&&(M=0),w===void 0&&(w=0);var A=u(C,"alpha",1),P=u(C,"tint",16777215),b=u(C,"angle",0),O=u(C,"rotation",0),I=u(C,"scale",1),D=u(C,"scaleX",I),B=u(C,"scaleY",I),G=u(C,"originX",.5),z=u(C,"originY",.5),X=u(C,"blendMode",0),j=u(C,"erase",!1),Q=u(C,"skipBatch",!1),tt=this.manager.resetStamp(A,P);return tt.setAngle(0),b!==0?tt.setAngle(b):O!==0&&tt.setRotation(O),tt.setScale(D,B),tt.setTexture(m,S),tt.setOrigin(G,z),tt.setBlendMode(X),j&&(this._eraseMode=!0),Q?this.batchGameObject(tt,M,w):this.draw(tt,M,w),j&&(this._eraseMode=!1),this},erase:function(m,S,M){return this._eraseMode=!0,this.draw(m,S,M),this._eraseMode=!1,this},draw:function(m,S,M,w,C){return this.beginDraw(),this.batchDraw(m,S,M,w,C),this.endDraw(),this},drawFrame:function(m,S,M,w,C,A){return this.beginDraw(),this.batchDrawFrame(m,S,M,w,C,A),this.endDraw(),this},repeat:function(m,S,M,w,C,A,P,b,O){if(M===void 0&&(M=0),w===void 0&&(w=0),C===void 0&&(C=this.width),A===void 0&&(A=this.height),P===void 0&&(P=1),b===void 0&&(b=16777215),O===void 0&&(O=!1),m instanceof n?S=m:S=this.manager.getFrame(m,S),!S)return this;var I=this.manager.resetStamp(P,b);I.setFrame(S),I.setOrigin(0);var D=S.width,B=S.height;C=Math.floor(C),A=Math.floor(A);var G=Math.ceil(C/D),z=Math.ceil(A/B),X=G*D-C,j=z*B-A;X>0&&(X=D-X),j>0&&(j=B-j),M<0&&(G+=Math.ceil(Math.abs(M)/D)),w<0&&(z+=Math.ceil(Math.abs(w)/B));var Q=M,tt=w,Y=!1,Z=this.manager.stampCrop.setTo(0,0,D,B);O||this.beginDraw();for(var U=0;U0&&H===G-1&&(Y=!0,Z.width=X),j>0&&U===z-1&&(Y=!0,Z.height=j),Y&&I.setCrop(Z),this.batchGameObject(I,Q,tt),I.isCropped=!1,Z.setTo(0,0,D,B),Q+=D}Q=M,tt+=B}return O||this.endDraw(),this},beginDraw:function(){if(!this.isDrawing){var m=this.camera,S=this.renderer,M=this.renderTarget;m.preRender(),M?S.beginCapture(M.width,M.height):S.setContext(this.context),this.isDrawing=!0}return this},batchDraw:function(m,S,M,w,C){return Array.isArray(m)||(m=[m]),this.batchList(m,S,M,w,C),this},batchDrawFrame:function(m,S,M,w,C,A){M===void 0&&(M=0),w===void 0&&(w=0),C===void 0&&(C=1),A===void 0&&(A=16777215);var P=this.manager.getFrame(m,S);return P&&(this.renderTarget?this.pipeline.batchTextureFrame(P,M,w,A,C,this.camera.matrix,null):this.batchTextureFrame(P,M,w,C,A)),this},endDraw:function(m){if(m===void 0&&(m=this._eraseMode),this.isDrawing){var S=this.renderer,M=this.renderTarget;if(M){var w=S.endCapture(),C=S.pipelines.setUtility();C.blitFrame(w,M,1,!1,!1,m,this.isSpriteTexture),S.resetScissor(),S.resetViewport()}else S.setContext();this.dirty=!0,this.isDrawing=!1}return this},batchList:function(m,S,M,w,C){var A=m.length;if(A!==0)for(var P=0;P0&&O.height>0&&b.drawImage(I,O.x,O.y,O.width,O.height,S,M,O.width,O.height),b.restore()}},snapshotArea:function(m,S,M,w,C,A,P){return this.renderTarget?this.renderer.snapshotFramebuffer(this.renderTarget.framebuffer,this.width,this.height,C,!1,m,S,M,w,A,P):this.renderer.snapshotCanvas(this.canvas,C,!1,m,S,M,w,A,P),this},snapshot:function(m,S,M){return this.snapshotArea(0,0,this.width,this.height,m,S,M)},snapshotPixel:function(m,S,M){return this.snapshotArea(m,S,1,1,M,"pixel")},getWebGLTexture:function(){if(this.renderTarget)return this.renderTarget.texture},renderWebGL:function(m,S,M,w){var C=this.manager.resetStamp();C.setTexture(this),C.setOrigin(0),C.renderWebGL(m,C,M,w)},renderCanvas:function(){},destroy:function(){var m=this.manager.stamp;m&&m.texture===this&&this.manager.resetStamp(),c.prototype.destroy.call(this),h.remove(this.canvas),this.renderTarget&&this.renderTarget.destroy(),this.camera.destroy(),this.canvas=null,this.context=null,this.renderer=null}});s.exports=v},4327:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(83419),p=e(45319),h=e(79291),a=new r({initialize:function(n,u,f,o,c,d,v){this.texture=n,this.name=u,this.source=n.source[f],this.sourceIndex=f,this.cutX,this.cutY,this.cutWidth,this.cutHeight,this.x=0,this.y=0,this.width,this.height,this.halfWidth,this.halfHeight,this.centerX,this.centerY,this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.u0=0,this.v0=0,this.u1=0,this.v1=0,this.data={cut:{x:0,y:0,w:0,h:0,r:0,b:0},trim:!1,sourceSize:{w:0,h:0},spriteSourceSize:{x:0,y:0,w:0,h:0,r:0,b:0},radius:0,drawImage:{x:0,y:0,width:0,height:0},is3Slice:!1,scale9:!1,scale9Borders:{x:0,y:0,w:0,h:0}},this.setSize(d,v,o,c)},setSize:function(l,n,u,f){u===void 0&&(u=0),f===void 0&&(f=0),this.cutX=u,this.cutY=f,this.cutWidth=l,this.cutHeight=n,this.width=l,this.height=n,this.halfWidth=Math.floor(l*.5),this.halfHeight=Math.floor(n*.5),this.centerX=Math.floor(l/2),this.centerY=Math.floor(n/2);var o=this.data,c=o.cut;c.x=u,c.y=f,c.w=l,c.h=n,c.r=u+l,c.b=f+n,o.sourceSize.w=l,o.sourceSize.h=n,o.spriteSourceSize.w=l,o.spriteSourceSize.h=n,o.radius=.5*Math.sqrt(l*l+n*n);var d=o.drawImage;return d.x=u,d.y=f,d.width=l,d.height=n,this.updateUVs()},setTrim:function(l,n,u,f,o,c){var d=this.data,v=d.spriteSourceSize;return d.trim=!0,d.sourceSize.w=l,d.sourceSize.h=n,v.x=u,v.y=f,v.w=o,v.h=c,v.r=u+o,v.b=f+c,this.x=u,this.y=f,this.width=o,this.height=c,this.halfWidth=o*.5,this.halfHeight=c*.5,this.centerX=Math.floor(o/2),this.centerY=Math.floor(c/2),this.updateUVs()},setScale9:function(l,n,u,f){var o=this.data;return o.scale9=!0,o.is3Slice=n===0&&f===this.height,o.scale9Borders.x=l,o.scale9Borders.y=n,o.scale9Borders.w=u,o.scale9Borders.h=f,this},setCropUVs:function(l,n,u,f,o,c,d){var v=this.cutX,m=this.cutY,S=this.cutWidth,M=this.cutHeight,w=this.realWidth,C=this.realHeight;n=p(n,0,w),u=p(u,0,C),f=p(f,0,w-n),o=p(o,0,C-u);var A=v+n,P=m+u,b=f,O=o,I=this.data;if(I.trim){var D=I.spriteSourceSize;f=p(f,0,S-n),o=p(o,0,M-u);var B=n+f,G=u+o,z=!(D.rB||D.y>G);if(z){var X=Math.max(D.x,n),K=Math.max(D.y,u),Q=Math.min(D.r,B)-X,tt=Math.min(D.b,G)-K;b=Q,O=tt,c?A=v+(S-(X-D.x)-Q):A=v+(X-D.x),d?P=m+(M-(K-D.y)-tt):P=m+(K-D.y),n=X,u=K,f=Q,o=tt}else A=0,P=0,b=0,O=0}else c&&(A=v+(S-n-f)),d&&(P=m+(M-u-o));var Y=this.source.width,Z=this.source.height;return l.u0=Math.max(0,A/Y),l.v0=Math.max(0,P/Z),l.u1=Math.min(1,(A+b)/Y),l.v1=Math.min(1,(P+O)/Z),l.x=n,l.y=u,l.cx=A,l.cy=P,l.cw=b,l.ch=O,l.width=f,l.height=o,l.flipX=c,l.flipY=d,l},updateCropUVs:function(l,n,u){return this.setCropUVs(l,l.x,l.y,l.width,l.height,n,u)},setUVs:function(l,n,u,f,o,c){var d=this.data.drawImage;return d.width=l,d.height=n,this.u0=u,this.v0=f,this.u1=o,this.v1=c,this},updateUVs:function(){var l=this.cutX,n=this.cutY,u=this.cutWidth,f=this.cutHeight,o=this.data.drawImage;o.width=u,o.height=f;var c=this.source.width,d=this.source.height;return this.u0=l/c,this.v0=n/d,this.u1=(l+u)/c,this.v1=(n+f)/d,this},updateUVsInverted:function(){var l=this.source.width,n=this.source.height;return this.u0=(this.cutX+this.cutHeight)/l,this.v0=this.cutY/n,this.u1=this.cutX/l,this.v1=(this.cutY+this.cutWidth)/n,this},clone:function(){var l=new a(this.texture,this.name,this.sourceIndex);return l.cutX=this.cutX,l.cutY=this.cutY,l.cutWidth=this.cutWidth,l.cutHeight=this.cutHeight,l.x=this.x,l.y=this.y,l.width=this.width,l.height=this.height,l.halfWidth=this.halfWidth,l.halfHeight=this.halfHeight,l.centerX=this.centerX,l.centerY=this.centerY,l.rotated=this.rotated,l.data=h(!0,l.data,this.data),l.updateUVs(),l},destroy:function(){this.texture=null,this.source=null,this.customData=null,this.data=null},glTexture:{get:function(){return this.source.glTexture}},realWidth:{get:function(){return this.data.sourceSize.w}},realHeight:{get:function(){return this.data.sourceSize.h}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},scale9:{get:function(){return this.data.scale9}},is3Slice:{get:function(){return this.data.is3Slice}},canvasData:{get:function(){return this.data.drawImage}}});s.exports=a},79237:(s,y,e)=>{/** + */var r=e(83419),p=e(45319),h=e(79291),a=new r({initialize:function(n,u,f,o,c,d,v){this.texture=n,this.name=u,this.source=n.source[f],this.sourceIndex=f,this.cutX,this.cutY,this.cutWidth,this.cutHeight,this.x=0,this.y=0,this.width,this.height,this.halfWidth,this.halfHeight,this.centerX,this.centerY,this.pivotX=0,this.pivotY=0,this.customPivot=!1,this.rotated=!1,this.autoRound=-1,this.customData={},this.u0=0,this.v0=0,this.u1=0,this.v1=0,this.data={cut:{x:0,y:0,w:0,h:0,r:0,b:0},trim:!1,sourceSize:{w:0,h:0},spriteSourceSize:{x:0,y:0,w:0,h:0,r:0,b:0},radius:0,drawImage:{x:0,y:0,width:0,height:0},is3Slice:!1,scale9:!1,scale9Borders:{x:0,y:0,w:0,h:0}},this.setSize(d,v,o,c)},setSize:function(l,n,u,f){u===void 0&&(u=0),f===void 0&&(f=0),this.cutX=u,this.cutY=f,this.cutWidth=l,this.cutHeight=n,this.width=l,this.height=n,this.halfWidth=Math.floor(l*.5),this.halfHeight=Math.floor(n*.5),this.centerX=Math.floor(l/2),this.centerY=Math.floor(n/2);var o=this.data,c=o.cut;c.x=u,c.y=f,c.w=l,c.h=n,c.r=u+l,c.b=f+n,o.sourceSize.w=l,o.sourceSize.h=n,o.spriteSourceSize.w=l,o.spriteSourceSize.h=n,o.radius=.5*Math.sqrt(l*l+n*n);var d=o.drawImage;return d.x=u,d.y=f,d.width=l,d.height=n,this.updateUVs()},setTrim:function(l,n,u,f,o,c){var d=this.data,v=d.spriteSourceSize;return d.trim=!0,d.sourceSize.w=l,d.sourceSize.h=n,v.x=u,v.y=f,v.w=o,v.h=c,v.r=u+o,v.b=f+c,this.x=u,this.y=f,this.width=o,this.height=c,this.halfWidth=o*.5,this.halfHeight=c*.5,this.centerX=Math.floor(o/2),this.centerY=Math.floor(c/2),this.updateUVs()},setScale9:function(l,n,u,f){var o=this.data;return o.scale9=!0,o.is3Slice=n===0&&f===this.height,o.scale9Borders.x=l,o.scale9Borders.y=n,o.scale9Borders.w=u,o.scale9Borders.h=f,this},setCropUVs:function(l,n,u,f,o,c,d){var v=this.cutX,m=this.cutY,S=this.cutWidth,M=this.cutHeight,w=this.realWidth,C=this.realHeight;n=p(n,0,w),u=p(u,0,C),f=p(f,0,w-n),o=p(o,0,C-u);var A=v+n,P=m+u,b=f,O=o,I=this.data;if(I.trim){var D=I.spriteSourceSize;f=p(f,0,S-n),o=p(o,0,M-u);var B=n+f,G=u+o,z=!(D.rB||D.y>G);if(z){var X=Math.max(D.x,n),j=Math.max(D.y,u),Q=Math.min(D.r,B)-X,tt=Math.min(D.b,G)-j;b=Q,O=tt,c?A=v+(S-(X-D.x)-Q):A=v+(X-D.x),d?P=m+(M-(j-D.y)-tt):P=m+(j-D.y),n=X,u=j,f=Q,o=tt}else A=0,P=0,b=0,O=0}else c&&(A=v+(S-n-f)),d&&(P=m+(M-u-o));var Y=this.source.width,Z=this.source.height;return l.u0=Math.max(0,A/Y),l.v0=Math.max(0,P/Z),l.u1=Math.min(1,(A+b)/Y),l.v1=Math.min(1,(P+O)/Z),l.x=n,l.y=u,l.cx=A,l.cy=P,l.cw=b,l.ch=O,l.width=f,l.height=o,l.flipX=c,l.flipY=d,l},updateCropUVs:function(l,n,u){return this.setCropUVs(l,l.x,l.y,l.width,l.height,n,u)},setUVs:function(l,n,u,f,o,c){var d=this.data.drawImage;return d.width=l,d.height=n,this.u0=u,this.v0=f,this.u1=o,this.v1=c,this},updateUVs:function(){var l=this.cutX,n=this.cutY,u=this.cutWidth,f=this.cutHeight,o=this.data.drawImage;o.width=u,o.height=f;var c=this.source.width,d=this.source.height;return this.u0=l/c,this.v0=n/d,this.u1=(l+u)/c,this.v1=(n+f)/d,this},updateUVsInverted:function(){var l=this.source.width,n=this.source.height;return this.u0=(this.cutX+this.cutHeight)/l,this.v0=this.cutY/n,this.u1=this.cutX/l,this.v1=(this.cutY+this.cutWidth)/n,this},clone:function(){var l=new a(this.texture,this.name,this.sourceIndex);return l.cutX=this.cutX,l.cutY=this.cutY,l.cutWidth=this.cutWidth,l.cutHeight=this.cutHeight,l.x=this.x,l.y=this.y,l.width=this.width,l.height=this.height,l.halfWidth=this.halfWidth,l.halfHeight=this.halfHeight,l.centerX=this.centerX,l.centerY=this.centerY,l.rotated=this.rotated,l.data=h(!0,l.data,this.data),l.updateUVs(),l},destroy:function(){this.texture=null,this.source=null,this.customData=null,this.data=null},glTexture:{get:function(){return this.source.glTexture}},realWidth:{get:function(){return this.data.sourceSize.w}},realHeight:{get:function(){return this.data.sourceSize.h}},radius:{get:function(){return this.data.radius}},trimmed:{get:function(){return this.data.trim}},scale9:{get:function(){return this.data.scale9}},is3Slice:{get:function(){return this.data.is3Slice}},canvasData:{get:function(){return this.data.drawImage}}});s.exports=a},79237:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -5417,7 +5417,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2021 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */function y(b,O,I,D,B,G,z){return z===void 0&&(z=16),Math.floor((b+I)/B)*Math.floor((O+D)/G)*z}function e(b,O){return b=Math.max(b,16),O=Math.max(O,8),b*O/4}function r(b,O){return b=Math.max(b,8),O=Math.max(O,8),b*O/2}function p(b,O){return Math.ceil(b/4)*Math.ceil(O/4)*16}function h(b,O){return y(b,O,3,3,4,4,8)}function a(b,O){return y(b,O,3,3,4,4)}function l(b,O){return y(b,O,4,3,5,4)}function n(b,O){return y(b,O,4,4,5,5)}function u(b,O){return y(b,O,5,4,6,5)}function f(b,O){return y(b,O,5,5,6,6)}function o(b,O){return y(b,O,7,4,8,5)}function c(b,O){return y(b,O,7,5,8,6)}function d(b,O){return y(b,O,7,7,8,8)}function v(b,O){return y(b,O,9,4,10,5)}function m(b,O){return y(b,O,9,5,10,6)}function S(b,O){return y(b,O,9,7,10,8)}function M(b,O){return y(b,O,9,9,10,10)}function w(b,O){return y(b,O,11,9,12,10)}function C(b,O){return y(b,O,11,11,12,12)}var A={0:{sizeFunc:e,glFormat:[35841]},1:{sizeFunc:e,glFormat:[35843]},2:{sizeFunc:r,glFormat:[35840]},3:{sizeFunc:r,glFormat:[35842]},6:{sizeFunc:h,glFormat:[36196]},7:{sizeFunc:h,glFormat:[33776,35916]},8:{sizeFunc:a,glFormat:[33777,35917]},9:{sizeFunc:a,glFormat:[33778,35918]},11:{sizeFunc:a,glFormat:[33779,35919]},14:{sizeFunc:p,glFormat:[36494,36495]},15:{sizeFunc:p,glFormat:[36492,36493]},22:{sizeFunc:h,glFormat:[37492,37493]},23:{sizeFunc:a,glFormat:[37496,37497]},24:{sizeFunc:h,glFormat:[37494,37495]},25:{sizeFunc:h,glFormat:[37488]},26:{sizeFunc:a,glFormat:[37490]},27:{sizeFunc:a,glFormat:[37808,37840]},28:{sizeFunc:l,glFormat:[37809,37841]},29:{sizeFunc:n,glFormat:[37810,37842]},30:{sizeFunc:u,glFormat:[37811,37843]},31:{sizeFunc:f,glFormat:[37812,37844]},32:{sizeFunc:o,glFormat:[37813,37845]},33:{sizeFunc:c,glFormat:[37814,37846]},34:{sizeFunc:d,glFormat:[37815,37847]},35:{sizeFunc:v,glFormat:[37816,37848]},36:{sizeFunc:m,glFormat:[37817,37849]},37:{sizeFunc:S,glFormat:[37818,37850]},38:{sizeFunc:M,glFormat:[37819,37851]},39:{sizeFunc:w,glFormat:[37820,37852]},40:{sizeFunc:C,glFormat:[37821,37853]}},P=function(b){for(var O=new Uint32Array(b,0,13),I=O[0],D=I===55727696,B=D?O[2]:O[3],G=O[4],z=A[B].glFormat[G],X=A[B].sizeFunc,K=O[11],Q=O[7],tt=O[6],Y=52+O[12],Z=new Uint8Array(b,Y),U=new Array(K),H=0,J=Q,_=tt,q=0;q>1),_=Math.max(1,_>>1),H+=at}return{mipmaps:U,width:Q,height:tt,internalFormat:z,compressed:!0,generateMipmap:!1}};s.exports=P},75549:(s,y,e)=>{/** + */function y(b,O,I,D,B,G,z){return z===void 0&&(z=16),Math.floor((b+I)/B)*Math.floor((O+D)/G)*z}function e(b,O){return b=Math.max(b,16),O=Math.max(O,8),b*O/4}function r(b,O){return b=Math.max(b,8),O=Math.max(O,8),b*O/2}function p(b,O){return Math.ceil(b/4)*Math.ceil(O/4)*16}function h(b,O){return y(b,O,3,3,4,4,8)}function a(b,O){return y(b,O,3,3,4,4)}function l(b,O){return y(b,O,4,3,5,4)}function n(b,O){return y(b,O,4,4,5,5)}function u(b,O){return y(b,O,5,4,6,5)}function f(b,O){return y(b,O,5,5,6,6)}function o(b,O){return y(b,O,7,4,8,5)}function c(b,O){return y(b,O,7,5,8,6)}function d(b,O){return y(b,O,7,7,8,8)}function v(b,O){return y(b,O,9,4,10,5)}function m(b,O){return y(b,O,9,5,10,6)}function S(b,O){return y(b,O,9,7,10,8)}function M(b,O){return y(b,O,9,9,10,10)}function w(b,O){return y(b,O,11,9,12,10)}function C(b,O){return y(b,O,11,11,12,12)}var A={0:{sizeFunc:e,glFormat:[35841]},1:{sizeFunc:e,glFormat:[35843]},2:{sizeFunc:r,glFormat:[35840]},3:{sizeFunc:r,glFormat:[35842]},6:{sizeFunc:h,glFormat:[36196]},7:{sizeFunc:h,glFormat:[33776,35916]},8:{sizeFunc:a,glFormat:[33777,35917]},9:{sizeFunc:a,glFormat:[33778,35918]},11:{sizeFunc:a,glFormat:[33779,35919]},14:{sizeFunc:p,glFormat:[36494,36495]},15:{sizeFunc:p,glFormat:[36492,36493]},22:{sizeFunc:h,glFormat:[37492,37493]},23:{sizeFunc:a,glFormat:[37496,37497]},24:{sizeFunc:h,glFormat:[37494,37495]},25:{sizeFunc:h,glFormat:[37488]},26:{sizeFunc:a,glFormat:[37490]},27:{sizeFunc:a,glFormat:[37808,37840]},28:{sizeFunc:l,glFormat:[37809,37841]},29:{sizeFunc:n,glFormat:[37810,37842]},30:{sizeFunc:u,glFormat:[37811,37843]},31:{sizeFunc:f,glFormat:[37812,37844]},32:{sizeFunc:o,glFormat:[37813,37845]},33:{sizeFunc:c,glFormat:[37814,37846]},34:{sizeFunc:d,glFormat:[37815,37847]},35:{sizeFunc:v,glFormat:[37816,37848]},36:{sizeFunc:m,glFormat:[37817,37849]},37:{sizeFunc:S,glFormat:[37818,37850]},38:{sizeFunc:M,glFormat:[37819,37851]},39:{sizeFunc:w,glFormat:[37820,37852]},40:{sizeFunc:C,glFormat:[37821,37853]}},P=function(b){for(var O=new Uint32Array(b,0,13),I=O[0],D=I===55727696,B=D?O[2]:O[3],G=O[4],z=A[B].glFormat[G],X=A[B].sizeFunc,j=O[11],Q=O[7],tt=O[6],Y=52+O[12],Z=new Uint8Array(b,Y),U=new Array(j),H=0,J=Q,_=tt,q=0;q>1),_=Math.max(1,_>>1),H+=at}return{mipmaps:U,width:Q,height:tt,internalFormat:z,compressed:!0,generateMipmap:!1}};s.exports=P},75549:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -5425,7 +5425,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(95540),p=function(h,a,l){var n=r(l,"frameWidth",null),u=r(l,"frameHeight",n);if(!n)throw new Error("TextureManager.SpriteSheetFromAtlas: Invalid frameWidth given.");var f=h.source[0];h.add("__BASE",0,0,0,f.width,f.height),r(l,"startFrame",0),r(l,"endFrame",-1);for(var o=r(l,"margin",0),c=r(l,"spacing",0),d=a.cutX,v=a.cutY,m=a.cutWidth,S=a.cutHeight,M=a.realWidth,w=a.realHeight,C=Math.floor((M-o+c)/(n+c)),A=Math.floor((w-o+c)/(u+c)),P=a.x,b=n-P,O=n-(M-m-P),I=a.y,D=u-I,B=u-(w-S-I),G,z=o,X=o,K=0,Q=0,tt=0;tt{/** + */var r=e(95540),p=function(h,a,l){var n=r(l,"frameWidth",null),u=r(l,"frameHeight",n);if(!n)throw new Error("TextureManager.SpriteSheetFromAtlas: Invalid frameWidth given.");var f=h.source[0];h.add("__BASE",0,0,0,f.width,f.height),r(l,"startFrame",0),r(l,"endFrame",-1);for(var o=r(l,"margin",0),c=r(l,"spacing",0),d=a.cutX,v=a.cutY,m=a.cutWidth,S=a.cutHeight,M=a.realWidth,w=a.realHeight,C=Math.floor((M-o+c)/(n+c)),A=Math.floor((w-o+c)/(u+c)),P=a.x,b=n-P,O=n-(M-m-P),I=a.y,D=u-I,B=u-(w-S-I),G,z=o,X=o,j=0,Q=0,tt=0;tt{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -5462,7 +5462,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(84101),p=e(83419),h=e(39506),a=e(80341),l=e(95540),n=e(14977),u=e(27462),f=e(91907),o=e(36305),c=e(19133),d=e(68287),v=e(23029),m=e(81086),S=e(20442),M=e(33629),w=new p({initialize:function(A,P){this.scene=A,this.tileWidth=P.tileWidth,this.tileHeight=P.tileHeight,this.width=P.width,this.height=P.height,this.orientation=P.orientation,this.renderOrder=P.renderOrder,this.format=P.format,this.version=P.version,this.properties=P.properties,this.widthInPixels=P.widthInPixels,this.heightInPixels=P.heightInPixels,this.imageCollections=P.imageCollections,this.images=P.images,this.layers=P.layers,this.tiles=P.tiles,this.tilesets=P.tilesets,this.objects=P.objects,this.currentLayerIndex=0,this.hexSideLength=P.hexSideLength;var b=this.orientation;this._convert={WorldToTileXY:m.GetWorldToTileXYFunction(b),WorldToTileX:m.GetWorldToTileXFunction(b),WorldToTileY:m.GetWorldToTileYFunction(b),TileToWorldXY:m.GetTileToWorldXYFunction(b),TileToWorldX:m.GetTileToWorldXFunction(b),TileToWorldY:m.GetTileToWorldYFunction(b),GetTileCorners:m.GetTileCornersFunction(b)}},setRenderOrder:function(C){var A=["right-down","left-down","right-up","left-up"];return typeof C=="number"&&(C=A[C]),A.indexOf(C)>-1&&(this.renderOrder=C),this},addTilesetImage:function(C,A,P,b,O,I,D,B){if(C===void 0)return null;A==null&&(A=C);var G=this.scene.sys.textures;if(!G.exists(A))return console.warn('Texture key "%s" not found',A),null;var z=G.get(A),X=this.getTilesetIndex(C);if(X===null&&this.format===a.TILED_JSON)return console.warn('Tilemap has no tileset "%s". Its tilesets are %o',C,this.tilesets),null;var K=this.tilesets[X];return K?(K.setTileSize(P,b),K.setSpacing(O,I),K.setImage(z),K):(P===void 0&&(P=this.tileWidth),b===void 0&&(b=this.tileHeight),O===void 0&&(O=0),I===void 0&&(I=0),D===void 0&&(D=0),B===void 0&&(B={x:0,y:0}),K=new M(C,D,P,b,O,I,void 0,void 0,B),K.setImage(z),this.tilesets.push(K),this.tiles=r(this),K)},copy:function(C,A,P,b,O,I,D,B){return B=this.getLayer(B),B!==null?(m.Copy(C,A,P,b,O,I,D,B),this):null},createBlankLayer:function(C,A,P,b,O,I,D,B){P===void 0&&(P=0),b===void 0&&(b=0),O===void 0&&(O=this.width),I===void 0&&(I=this.height),D===void 0&&(D=this.tileWidth),B===void 0&&(B=this.tileHeight);var G=this.getLayerIndex(C);if(G!==null)return console.warn("Invalid Tilemap Layer ID: "+C),null;for(var z=new n({name:C,tileWidth:D,tileHeight:B,width:O,height:I,orientation:this.orientation}),X,K=0;K-1&&this.putTileAt(A,I.x,I.y,P,I.tilemapLayer)}return b},removeTileAt:function(C,A,P,b,O){return P===void 0&&(P=!0),b===void 0&&(b=!0),O=this.getLayer(O),O===null?null:m.RemoveTileAt(C,A,P,b,O)},removeTileAtWorldXY:function(C,A,P,b,O,I){return P===void 0&&(P=!0),b===void 0&&(b=!0),I=this.getLayer(I),I===null?null:m.RemoveTileAtWorldXY(C,A,P,b,O,I)},renderDebug:function(C,A,P){return P=this.getLayer(P),P===null?null:(this.orientation===f.ORTHOGONAL&&m.RenderDebug(C,A,P),this)},renderDebugFull:function(C,A){for(var P=this.layers,b=0;b{/** + */var r=e(84101),p=e(83419),h=e(39506),a=e(80341),l=e(95540),n=e(14977),u=e(27462),f=e(91907),o=e(36305),c=e(19133),d=e(68287),v=e(23029),m=e(81086),S=e(20442),M=e(33629),w=new p({initialize:function(A,P){this.scene=A,this.tileWidth=P.tileWidth,this.tileHeight=P.tileHeight,this.width=P.width,this.height=P.height,this.orientation=P.orientation,this.renderOrder=P.renderOrder,this.format=P.format,this.version=P.version,this.properties=P.properties,this.widthInPixels=P.widthInPixels,this.heightInPixels=P.heightInPixels,this.imageCollections=P.imageCollections,this.images=P.images,this.layers=P.layers,this.tiles=P.tiles,this.tilesets=P.tilesets,this.objects=P.objects,this.currentLayerIndex=0,this.hexSideLength=P.hexSideLength;var b=this.orientation;this._convert={WorldToTileXY:m.GetWorldToTileXYFunction(b),WorldToTileX:m.GetWorldToTileXFunction(b),WorldToTileY:m.GetWorldToTileYFunction(b),TileToWorldXY:m.GetTileToWorldXYFunction(b),TileToWorldX:m.GetTileToWorldXFunction(b),TileToWorldY:m.GetTileToWorldYFunction(b),GetTileCorners:m.GetTileCornersFunction(b)}},setRenderOrder:function(C){var A=["right-down","left-down","right-up","left-up"];return typeof C=="number"&&(C=A[C]),A.indexOf(C)>-1&&(this.renderOrder=C),this},addTilesetImage:function(C,A,P,b,O,I,D,B){if(C===void 0)return null;A==null&&(A=C);var G=this.scene.sys.textures;if(!G.exists(A))return console.warn('Texture key "%s" not found',A),null;var z=G.get(A),X=this.getTilesetIndex(C);if(X===null&&this.format===a.TILED_JSON)return console.warn('Tilemap has no tileset "%s". Its tilesets are %o',C,this.tilesets),null;var j=this.tilesets[X];return j?(j.setTileSize(P,b),j.setSpacing(O,I),j.setImage(z),j):(P===void 0&&(P=this.tileWidth),b===void 0&&(b=this.tileHeight),O===void 0&&(O=0),I===void 0&&(I=0),D===void 0&&(D=0),B===void 0&&(B={x:0,y:0}),j=new M(C,D,P,b,O,I,void 0,void 0,B),j.setImage(z),this.tilesets.push(j),this.tiles=r(this),j)},copy:function(C,A,P,b,O,I,D,B){return B=this.getLayer(B),B!==null?(m.Copy(C,A,P,b,O,I,D,B),this):null},createBlankLayer:function(C,A,P,b,O,I,D,B){P===void 0&&(P=0),b===void 0&&(b=0),O===void 0&&(O=this.width),I===void 0&&(I=this.height),D===void 0&&(D=this.tileWidth),B===void 0&&(B=this.tileHeight);var G=this.getLayerIndex(C);if(G!==null)return console.warn("Invalid Tilemap Layer ID: "+C),null;for(var z=new n({name:C,tileWidth:D,tileHeight:B,width:O,height:I,orientation:this.orientation}),X,j=0;j-1&&this.putTileAt(A,I.x,I.y,P,I.tilemapLayer)}return b},removeTileAt:function(C,A,P,b,O){return P===void 0&&(P=!0),b===void 0&&(b=!0),O=this.getLayer(O),O===null?null:m.RemoveTileAt(C,A,P,b,O)},removeTileAtWorldXY:function(C,A,P,b,O,I){return P===void 0&&(P=!0),b===void 0&&(b=!0),I=this.getLayer(I),I===null?null:m.RemoveTileAtWorldXY(C,A,P,b,O,I)},renderDebug:function(C,A,P){return P=this.getLayer(P),P===null?null:(this.orientation===f.ORTHOGONAL&&m.RenderDebug(C,A,P),this)},renderDebugFull:function(C,A){for(var P=this.layers,b=0;b{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -5486,7 +5486,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(70554),p=function(h,a,l){var n=a.cull(l),u=n.length,f=l.alpha*a.alpha;if(!(u===0||f<=0)){var o=a.gidMap,c=h.pipelines.set(a.pipeline,a),d=r.getTintAppendFloatAlpha,v=a.scrollFactorX,m=a.scrollFactorY,S=a.x,M=a.y,w=a.scaleX,C=a.scaleY;h.pipelines.preBatch(a);for(var A=0;A{/** + */var r=e(70554),p=function(h,a,l){var n=a.cull(l),u=n.length,f=l.alpha*a.alpha;if(!(u===0||f<=0)){var o=a.gidMap,c=h.pipelines.set(a.pipeline,a),d=r.getTintAppendFloatAlpha,v=a.scrollFactorX,m=a.scrollFactorY,S=a.x,M=a.y,w=a.scaleX,C=a.scaleY;h.pipelines.preBatch(a);for(var A=0;A{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -5578,7 +5578,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(55738),p=e(7386),h=e(91865),a=e(29747),l=e(26099),n=function(d,v){return h.RectangleToTriangle(v,d)},u=new l,f=new l,o=new l,c=function(d,v,m,S){if(d===void 0)return[];var M=a;d instanceof r.Circle?M=h.CircleToRectangle:d instanceof r.Rectangle?M=h.RectangleToRectangle:d instanceof r.Triangle?M=n:d instanceof r.Line&&(M=h.LineToRectangle),S.tilemapLayer.worldToTileXY(d.left,d.top,!0,f,m);var w=f.x,C=f.y;S.tilemapLayer.worldToTileXY(d.right,d.bottom,!1,o,m);var A=Math.ceil(o.x),P=Math.ceil(o.y),b=Math.max(A-w,1),O=Math.max(P-C,1),I=p(w,C,b,O,v,S),D=S.tileWidth,B=S.tileHeight;S.tilemapLayer&&(D*=S.tilemapLayer.scaleX,B*=S.tilemapLayer.scaleY);for(var G=[],z=new r.Rectangle(0,0,D,B),X=0;X{/** + */var r=e(55738),p=e(7386),h=e(91865),a=e(29747),l=e(26099),n=function(d,v){return h.RectangleToTriangle(v,d)},u=new l,f=new l,o=new l,c=function(d,v,m,S){if(d===void 0)return[];var M=a;d instanceof r.Circle?M=h.CircleToRectangle:d instanceof r.Rectangle?M=h.RectangleToRectangle:d instanceof r.Triangle?M=n:d instanceof r.Line&&(M=h.LineToRectangle),S.tilemapLayer.worldToTileXY(d.left,d.top,!0,f,m);var w=f.x,C=f.y;S.tilemapLayer.worldToTileXY(d.right,d.bottom,!1,o,m);var A=Math.ceil(o.x),P=Math.ceil(o.y),b=Math.max(A-w,1),O=Math.max(P-C,1),I=p(w,C,b,O,v,S),D=S.tileWidth,B=S.tileHeight;S.tilemapLayer&&(D*=S.tilemapLayer.scaleX,B*=S.tilemapLayer.scaleY);for(var G=[],z=new r.Rectangle(0,0,D,B),X=0;X{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -5622,7 +5622,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(26099),p=function(h,a,l,n,u,f){n||(n=new r);var o=f.baseTileWidth,c=f.baseTileHeight,d=f.tilemapLayer;d&&(u||(u=d.scene.cameras.main),h=h-(d.x+u.scrollX*(1-d.scrollFactorX)),a=a-(d.y+u.scrollY*(1-d.scrollFactorY)),o*=d.scaleX,c*=d.scaleY);var v=.5773502691896257,m=-.3333333333333333,S=0,M=.6666666666666666,w=o/2,C=c/2,A,P,b,O,I;f.staggerAxis==="y"?(A=(h-w)/(v*o),P=(a-C)/C,b=v*A+m*P,O=S*A+M*P):(A=(h-w)/w,P=(a-C)/(v*c),b=m*A+v*P,O=M*A+S*P),I=-b-O;var D=Math.round(b),B=Math.round(O),G=Math.round(I),z=Math.abs(D-b),X=Math.abs(B-O),K=Math.abs(G-I);z>X&&z>K?D=-B-G:X>K&&(B=-D-G);var Q,tt=B;return f.staggerIndex==="odd"?Q=tt%2===0?B/2+D:B/2+D-.5:Q=tt%2===0?B/2+D:B/2+D+.5,n.set(Q,tt)};s.exports=p},62991:s=>{/** + */var r=e(26099),p=function(h,a,l,n,u,f){n||(n=new r);var o=f.baseTileWidth,c=f.baseTileHeight,d=f.tilemapLayer;d&&(u||(u=d.scene.cameras.main),h=h-(d.x+u.scrollX*(1-d.scrollFactorX)),a=a-(d.y+u.scrollY*(1-d.scrollFactorY)),o*=d.scaleX,c*=d.scaleY);var v=.5773502691896257,m=-.3333333333333333,S=0,M=.6666666666666666,w=o/2,C=c/2,A,P,b,O,I;f.staggerAxis==="y"?(A=(h-w)/(v*o),P=(a-C)/C,b=v*A+m*P,O=S*A+M*P):(A=(h-w)/w,P=(a-C)/(v*c),b=m*A+v*P,O=M*A+S*P),I=-b-O;var D=Math.round(b),B=Math.round(O),G=Math.round(I),z=Math.abs(D-b),X=Math.abs(B-O),j=Math.abs(G-I);z>X&&z>j?D=-B-G:X>j&&(B=-D-G);var Q,tt=B;return f.staggerIndex==="odd"?Q=tt%2===0?B/2+D:B/2+D-.5:Q=tt%2===0?B/2+D:B/2+D+.5,n.set(Q,tt)};s.exports=p},62991:s=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -5875,7 +5875,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(41868),p=e(91907),h=e(79677),a=e(6641),l=e(95540),n=e(14977),u=e(29920),f=e(23029),o=function(c,d){for(var v=l(c,"infinite",!1),m=[],S=[],M=h(c);M.i0;){if(M.i>=M.layers.length){if(S.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}M=S.pop();continue}var w=M.layers[M.i];if(M.i++,w.type!=="tilelayer"){if(w.type==="group"){var C=h(c,w,M);S.push(M),M=C}continue}if(w.compression){console.warn("TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer '"+w.name+"'");continue}else if(w.encoding&&w.encoding==="base64"){if(w.chunks)for(var A=0;A0?(O=new f(P,b.gid,J,_,c.tilewidth,c.tileheight),O.rotation=b.rotation,O.flipX=b.flipped,D[_][J]=O):(I=d?null:new f(P,-1,J,_,c.tilewidth,c.tileheight),D[_][J]=I),B++,B===Q.width&&(Z++,B=0)}}else{P=new n({name:M.name+w.name,id:w.id,x:M.x+l(w,"offsetx",0)+w.x,y:M.y+l(w,"offsety",0)+w.y,width:w.width,height:w.height,tileWidth:c.tilewidth,tileHeight:c.tileheight,alpha:M.opacity*w.opacity,visible:M.visible&&w.visible,properties:l(w,"properties",[]),orientation:a(c.orientation)}),P.orientation===p.HEXAGONAL&&(P.hexSideLength=c.hexsidelength,P.staggerAxis=c.staggeraxis,P.staggerIndex=c.staggerindex);for(var q=[],at=0,ot=w.data.length;at0?(O=new f(P,b.gid,B,D.length,c.tilewidth,c.tileheight),O.rotation=b.rotation,O.flipX=b.flipped,q.push(O)):(I=d?null:new f(P,-1,B,D.length,c.tilewidth,c.tileheight),q.push(I)),B++,B===w.width&&(D.push(q),B=0,q=[])}P.data=D,m.push(P)}return m};s.exports=o},24619:(s,y,e)=>{/** + */var r=e(41868),p=e(91907),h=e(79677),a=e(6641),l=e(95540),n=e(14977),u=e(29920),f=e(23029),o=function(c,d){for(var v=l(c,"infinite",!1),m=[],S=[],M=h(c);M.i0;){if(M.i>=M.layers.length){if(S.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}M=S.pop();continue}var w=M.layers[M.i];if(M.i++,w.type!=="tilelayer"){if(w.type==="group"){var C=h(c,w,M);S.push(M),M=C}continue}if(w.compression){console.warn("TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer '"+w.name+"'");continue}else if(w.encoding&&w.encoding==="base64"){if(w.chunks)for(var A=0;A0?(O=new f(P,b.gid,J,_,c.tilewidth,c.tileheight),O.rotation=b.rotation,O.flipX=b.flipped,D[_][J]=O):(I=d?null:new f(P,-1,J,_,c.tilewidth,c.tileheight),D[_][J]=I),B++,B===Q.width&&(Z++,B=0)}}else{P=new n({name:M.name+w.name,id:w.id,x:M.x+l(w,"offsetx",0)+w.x,y:M.y+l(w,"offsety",0)+w.y,width:w.width,height:w.height,tileWidth:c.tilewidth,tileHeight:c.tileheight,alpha:M.opacity*w.opacity,visible:M.visible&&w.visible,properties:l(w,"properties",[]),orientation:a(c.orientation)}),P.orientation===p.HEXAGONAL&&(P.hexSideLength=c.hexsidelength,P.staggerAxis=c.staggeraxis,P.staggerIndex=c.staggerindex);for(var q=[],at=0,ot=w.data.length;at0?(O=new f(P,b.gid,B,D.length,c.tilewidth,c.tileheight),O.rotation=b.rotation,O.flipX=b.flipped,q.push(O)):(I=d?null:new f(P,-1,B,D.length,c.tilewidth,c.tileheight),q.push(I)),B++,B===w.width&&(D.push(q),B=0,q=[])}P.data=D,m.push(P)}return m};s.exports=o},24619:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -5943,19 +5943,19 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(30976),p=e(99472);function h(f){return!!f.getActive&&typeof f.getActive=="function"}function a(f){return!!f.getStart&&typeof f.getStart=="function"}function l(f){return!!f.getEnd&&typeof f.getEnd=="function"}function n(f){return a(f)||l(f)||h(f)}var u=function(f,o){var c,d=function(Q,tt,Y){return Y},v=function(Q,tt,Y){return Y},m=null,S=typeof o;if(S==="number")d=function(){return o};else if(Array.isArray(o))v=function(){return o[0]},d=function(){return o[o.length-1]};else if(S==="string"){var M=o.toLowerCase(),w=M.substring(0,6)==="random",C=M.substring(0,3)==="int";if(w||C){var A=M.indexOf("("),P=M.indexOf(")"),b=M.indexOf(",");if(A&&P&&b){var O=parseFloat(M.substring(A+1,b)),I=parseFloat(M.substring(b+1,P));w?d=function(){return p(O,I)}:d=function(){return r(O,I)}}else throw new Error("invalid random() format")}else{M=M[0];var D=parseFloat(o.substr(2));switch(M){case"+":d=function(Q,tt,Y){return Y+D};break;case"-":d=function(Q,tt,Y){return Y-D};break;case"*":d=function(Q,tt,Y){return Y*D};break;case"/":d=function(Q,tt,Y){return Y/D};break;default:d=function(){return parseFloat(o)}}}}else if(S==="function")d=o;else if(S==="object")if(n(o))h(o)&&(m=o.getActive),l(o)&&(d=o.getEnd),a(o)&&(v=o.getStart);else if(o.hasOwnProperty("value"))c=u(f,o.value);else{var B=o.hasOwnProperty("to"),G=o.hasOwnProperty("from"),z=o.hasOwnProperty("start");if(B&&(G||z)){if(c=u(f,o.to),z){var X=u(f,o.start);c.getActive=X.getEnd}if(G){var K=u(f,o.from);c.getStart=K.getEnd}}}return c||(c={getActive:m,getEnd:d,getStart:v}),c};s.exports=u},88032:(s,y,e)=>{/** + */var r=e(30976),p=e(99472);function h(f){return!!f.getActive&&typeof f.getActive=="function"}function a(f){return!!f.getStart&&typeof f.getStart=="function"}function l(f){return!!f.getEnd&&typeof f.getEnd=="function"}function n(f){return a(f)||l(f)||h(f)}var u=function(f,o){var c,d=function(Q,tt,Y){return Y},v=function(Q,tt,Y){return Y},m=null,S=typeof o;if(S==="number")d=function(){return o};else if(Array.isArray(o))v=function(){return o[0]},d=function(){return o[o.length-1]};else if(S==="string"){var M=o.toLowerCase(),w=M.substring(0,6)==="random",C=M.substring(0,3)==="int";if(w||C){var A=M.indexOf("("),P=M.indexOf(")"),b=M.indexOf(",");if(A&&P&&b){var O=parseFloat(M.substring(A+1,b)),I=parseFloat(M.substring(b+1,P));w?d=function(){return p(O,I)}:d=function(){return r(O,I)}}else throw new Error("invalid random() format")}else{M=M[0];var D=parseFloat(o.substr(2));switch(M){case"+":d=function(Q,tt,Y){return Y+D};break;case"-":d=function(Q,tt,Y){return Y-D};break;case"*":d=function(Q,tt,Y){return Y*D};break;case"/":d=function(Q,tt,Y){return Y/D};break;default:d=function(){return parseFloat(o)}}}}else if(S==="function")d=o;else if(S==="object")if(n(o))h(o)&&(m=o.getActive),l(o)&&(d=o.getEnd),a(o)&&(v=o.getStart);else if(o.hasOwnProperty("value"))c=u(f,o.value);else{var B=o.hasOwnProperty("to"),G=o.hasOwnProperty("from"),z=o.hasOwnProperty("start");if(B&&(G||z)){if(c=u(f,o.to),z){var X=u(f,o.start);c.getActive=X.getEnd}if(G){var j=u(f,o.from);c.getStart=j.getEnd}}}return c||(c={getActive:m,getEnd:d,getStart:v}),c};s.exports=u},88032:(s,y,e)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(70402),p=e(69902),h=e(23568),a=e(57355),l=e(6113),n=e(55292),u=e(35154),f=e(17777),o=e(269),c=e(86081),d=function(v,m,S){if(m instanceof c)return m.parent=v,m;S===void 0?S=p:S=o(p,S);var M=u(m,"from",0),w=u(m,"to",1),C=[{value:M}],A=u(m,"delay",S.delay),P=u(m,"easeParams",S.easeParams),b=u(m,"ease",S.ease),O=f("value",w),I=new c(v,C),D=I.add(0,"value",O.getEnd,O.getStart,O.getActive,l(u(m,"ease",b),u(m,"easeParams",P)),n(m,"delay",A),u(m,"duration",S.duration),a(m,"yoyo",S.yoyo),u(m,"hold",S.hold),u(m,"repeat",S.repeat),u(m,"repeatDelay",S.repeatDelay),!1,!1);D.start=M,D.current=M,I.completeDelay=h(m,"completeDelay",0),I.loop=Math.round(h(m,"loop",0)),I.loopDelay=Math.round(h(m,"loopDelay",0)),I.paused=a(m,"paused",!1),I.persist=a(m,"persist",!1),I.callbackScope=u(m,"callbackScope",I);for(var B=r.TYPES,G=0;G{/** + */var r=e(70402),p=e(69902),h=e(23568),a=e(57355),l=e(6113),n=e(55292),u=e(35154),f=e(17777),o=e(269),c=e(86081),d=function(v,m,S){if(m instanceof c)return m.parent=v,m;S===void 0?S=p:S=o(p,S);var M=u(m,"from",0),w=u(m,"to",1),C=[{value:M}],A=u(m,"delay",S.delay),P=u(m,"easeParams",S.easeParams),b=u(m,"ease",S.ease),O=f("value",w),I=new c(v,C),D=I.add(0,"value",O.getEnd,O.getStart,O.getActive,l(u(m,"ease",b),u(m,"easeParams",P)),n(m,"delay",A),u(m,"duration",S.duration),a(m,"yoyo",S.yoyo),u(m,"hold",S.hold),u(m,"repeat",S.repeat),u(m,"repeatDelay",S.repeatDelay),!1,!1);D.start=M,D.current=M,I.completeDelay=h(m,"completeDelay",0),I.loop=Math.round(h(m,"loop",0)),I.loopDelay=Math.round(h(m,"loopDelay",0)),I.paused=a(m,"paused",!1),I.persist=a(m,"persist",!1),I.callbackScope=u(m,"callbackScope",I);for(var B=r.TYPES,G=0;G{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(6113),p=e(35154),h=e(36383),a=function(l,n){n===void 0&&(n={});var u,f=p(n,"start",0),o=p(n,"ease",null),c=p(n,"grid",null),d=p(n,"from",0),v=d==="first",m=d==="center",S=d==="last",M=typeof d=="number",w=Array.isArray(l),C=parseFloat(w?l[0]:l),A=w?parseFloat(l[1]):0,P=Math.max(C,A);if(w&&(f+=C),c){var b=c[0],O=c[1],I=0,D=0,B=0,G=0,z=[];S?(I=b-1,D=O-1):M?(I=d%b,D=Math.floor(d/b)):m&&(I=(b-1)/2,D=(O-1)/2);for(var X=h.MIN_SAFE_INTEGER,K=0;KX&&(X=tt),z[K][Q]=tt}}}var Y=o?r(o):null;return c?u=function(Z,U,H,J){var _=0,q=J%b,at=Math.floor(J/b);q>=0&&q=0&&at{/** + */var r=e(6113),p=e(35154),h=e(36383),a=function(l,n){n===void 0&&(n={});var u,f=p(n,"start",0),o=p(n,"ease",null),c=p(n,"grid",null),d=p(n,"from",0),v=d==="first",m=d==="center",S=d==="last",M=typeof d=="number",w=Array.isArray(l),C=parseFloat(w?l[0]:l),A=w?parseFloat(l[1]):0,P=Math.max(C,A);if(w&&(f+=C),c){var b=c[0],O=c[1],I=0,D=0,B=0,G=0,z=[];S?(I=b-1,D=O-1):M?(I=d%b,D=Math.floor(d/b)):m&&(I=(b-1)/2,D=(O-1)/2);for(var X=h.MIN_SAFE_INTEGER,j=0;jX&&(X=tt),z[j][Q]=tt}}}var Y=o?r(o):null;return c?u=function(Z,U,H,J){var _=0,q=J%b,at=Math.floor(J/b);q>=0&&q=0&&at{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var r=e(70402),p=e(69902),h=e(23568),a=e(57355),l=e(6113),n=e(91389),u=e(55292),f=e(82985),o=e(62329),c=e(35154),d=e(17777),v=e(269),m=e(86081),S=function(M,w,C){if(w instanceof m)return w.parent=M,w;C===void 0?C=p:C=v(p,C);var A=o(w);!A&&C.targets&&(A=C.targets);for(var P=f(w),b=c(w,"delay",C.delay),O=c(w,"duration",C.duration),I=c(w,"easeParams",C.easeParams),D=c(w,"ease",C.ease),B=c(w,"hold",C.hold),G=c(w,"repeat",C.repeat),z=c(w,"repeatDelay",C.repeatDelay),X=a(w,"yoyo",C.yoyo),K=a(w,"flipX",C.flipX),Q=a(w,"flipY",C.flipY),tt=c(w,"interpolation",C.interpolation),Y=function(yt,Et,At,Pt){if(At==="texture"){var Vt=Pt,dt=void 0;Array.isArray(Pt)?(Vt=Pt[0],dt=Pt[1]):Pt.hasOwnProperty("value")?(Vt=Pt.value,Array.isArray(Pt.value)?(Vt=Pt.value[0],dt=Pt.value[1]):typeof Pt.value=="string"&&(Vt=Pt.value)):typeof Pt=="string"&&(Vt=Pt),yt.addFrame(Et,Vt,dt,u(Pt,"delay",b),c(Pt,"duration",O),c(Pt,"hold",B),c(Pt,"repeat",G),c(Pt,"repeatDelay",z),a(Pt,"flipX",K),a(Pt,"flipY",Q))}else{var ut=d(At,Pt),Rt=n(c(Pt,"interpolation",tt));yt.add(Et,At,ut.getEnd,ut.getStart,ut.getActive,l(c(Pt,"ease",D),c(Pt,"easeParams",I)),u(Pt,"delay",b),c(Pt,"duration",O),a(Pt,"yoyo",X),c(Pt,"hold",B),c(Pt,"repeat",G),c(Pt,"repeatDelay",z),a(Pt,"flipX",K),a(Pt,"flipY",Q),Rt,Rt?Pt:null)}},Z=new m(M,A),U=0;U{/** + */var r=e(70402),p=e(69902),h=e(23568),a=e(57355),l=e(6113),n=e(91389),u=e(55292),f=e(82985),o=e(62329),c=e(35154),d=e(17777),v=e(269),m=e(86081),S=function(M,w,C){if(w instanceof m)return w.parent=M,w;C===void 0?C=p:C=v(p,C);var A=o(w);!A&&C.targets&&(A=C.targets);for(var P=f(w),b=c(w,"delay",C.delay),O=c(w,"duration",C.duration),I=c(w,"easeParams",C.easeParams),D=c(w,"ease",C.ease),B=c(w,"hold",C.hold),G=c(w,"repeat",C.repeat),z=c(w,"repeatDelay",C.repeatDelay),X=a(w,"yoyo",C.yoyo),j=a(w,"flipX",C.flipX),Q=a(w,"flipY",C.flipY),tt=c(w,"interpolation",C.interpolation),Y=function(yt,Et,At,Pt){if(At==="texture"){var Vt=Pt,dt=void 0;Array.isArray(Pt)?(Vt=Pt[0],dt=Pt[1]):Pt.hasOwnProperty("value")?(Vt=Pt.value,Array.isArray(Pt.value)?(Vt=Pt.value[0],dt=Pt.value[1]):typeof Pt.value=="string"&&(Vt=Pt.value)):typeof Pt=="string"&&(Vt=Pt),yt.addFrame(Et,Vt,dt,u(Pt,"delay",b),c(Pt,"duration",O),c(Pt,"hold",B),c(Pt,"repeat",G),c(Pt,"repeatDelay",z),a(Pt,"flipX",j),a(Pt,"flipY",Q))}else{var ut=d(At,Pt),Rt=n(c(Pt,"interpolation",tt));yt.add(Et,At,ut.getEnd,ut.getStart,ut.getActive,l(c(Pt,"ease",D),c(Pt,"easeParams",I)),u(Pt,"delay",b),c(Pt,"duration",O),a(Pt,"yoyo",X),c(Pt,"hold",B),c(Pt,"repeat",G),c(Pt,"repeatDelay",z),a(Pt,"flipX",j),a(Pt,"flipY",Q),Rt,Rt?Pt:null)}},Z=new m(M,A),U=0;U{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -6360,11 +6360,11 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */s.exports={Format:e(27902),Pad:e(41836),RemoveAt:e(33628),Reverse:e(27671),UppercaseFirst:e(35355),UUID:e(45650)}}},x={};function T(s){var y=x[s];if(y!==void 0)return y.exports;var e=x[s]={exports:{}};return i[s](e,e.exports,T),e.exports}T.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}();var E=T(85454);return E})())})(UM);var Zm=UM.exports;const sd=Wd(Zm);var PF=Object.create,Gx=Object.defineProperty,RF=Object.defineProperties,bF=Object.getOwnPropertyDescriptor,LF=Object.getOwnPropertyDescriptors,FF=Object.getOwnPropertyNames,JS=Object.getOwnPropertySymbols,OF=Object.getPrototypeOf,zM=Object.prototype.hasOwnProperty,DF=Object.prototype.propertyIsEnumerable,$S=(g,t,i)=>t in g?Gx(g,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):g[t]=i,An=(g,t)=>{for(var i in t||(t={}))zM.call(t,i)&&$S(g,i,t[i]);if(JS)for(var i of JS(t))DF.call(t,i)&&$S(g,i,t[i]);return g},dh=(g,t)=>RF(g,LF(t)),si=(g,t)=>()=>(t||g((t={exports:{}}).exports,t),t.exports),IF=(g,t,i,x)=>{if(t&&typeof t=="object"||typeof t=="function")for(let T of FF(t))!zM.call(g,T)&&T!==i&&Gx(g,T,{get:()=>t[T],enumerable:!(x=bF(t,T))||x.enumerable});return g},GM=(g,t,i)=>(i=g!=null?PF(OF(g)):{},IF(t||!g||!g.__esModule?Gx(i,"default",{value:g,enumerable:!0}):i,g)),Jm=si(g=>{var t=function(E,s){return Es?1:0},i=function(E,s){return Es?-1:0};function x(E){return function(s,y){return E(y,s)}}function T(E){return E===2?function(s,y){return s[0]y[0]?1:s[1]y[1]?1:0}:function(s,y){for(var e=0;ey[e])return 1;e++}return 0}}g.DEFAULT_COMPARATOR=t,g.DEFAULT_REVERSE_COMPARATOR=i,g.reverseComparator=x,g.createTupleComparator=T}),NF=si(g=>{g.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",g.SYMBOL_SUPPORT=typeof Symbol<"u"}),zn=si((g,t)=>{var i=NF(),x=i.ARRAY_BUFFER_SUPPORT,T=i.SYMBOL_SUPPORT;t.exports=function(E,s){var y,e,r,p,h;if(!E)throw new Error("obliterator/forEach: invalid iterable.");if(typeof s!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(E)||x&&ArrayBuffer.isView(E)||typeof E=="string"||E.toString()==="[object Arguments]"){for(r=0,p=E.length;r{var i=Jm(),x=zn(),T=i.DEFAULT_COMPARATOR,E=i.reverseComparator;function s(u){if(this.clear(),this.comparator=u||T,typeof this.comparator!="function")throw new Error("mnemonist/FibonacciHeap.constructor: given comparator should be a function.")}s.prototype.clear=function(){this.root=null,this.min=null,this.size=0};function y(u){return{item:u,degree:0}}function e(u,f){u.root?(f.right=u.root.right,f.left=u.root,u.root.right.left=f,u.root.right=f):u.root=f}s.prototype.push=function(u){var f=y(u);return f.left=f,f.right=f,e(this,f),(!this.min||this.comparator(f.item,this.min.item)<=0)&&(this.min=f),++this.size},s.prototype.peek=function(){return this.min?this.min.item:void 0};function r(u){for(var f=[],o=u,c=!1;!(o===u&&c);)o===u&&(c=!0),f.push(o),o=o.right;return f}function p(u,f){u.root===f&&(u.root=f.right),f.left.right=f.right,f.right.left=f.left}function h(u,f){u.child?(f.right=u.child.right,f.left=u.child,u.child.right.left=f,u.child.right=f):u.child=f}function a(u,f,o){p(u,f),f.left=f,f.right=f,h(o,f),o.degree++,f.parent=o}function l(u){var f=new Array(u.size),o=r(u.root),c,d,v,m,S,M;for(c=0,d=o.length;c0&&(M=v,v=m,m=M),a(u,m,v),f[S]=null,S++;f[S]=v}for(c=0;c{var t=Math.pow(2,8)-1,i=Math.pow(2,16)-1,x=Math.pow(2,32)-1,T=Math.pow(2,7)-1,E=Math.pow(2,15)-1,s=Math.pow(2,31)-1;g.getPointerArray=function(e){var r=e-1;if(r<=t)return Uint8Array;if(r<=i)return Uint16Array;if(r<=x)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},g.getSignedPointerArray=function(e){var r=e-1;return r<=T?Int8Array:r<=E?Int16Array:r<=s?Int32Array:Float64Array},g.getNumberType=function(e){return e===(e|0)?Math.sign(e)===-1?e<=127&&e>=-128?Int8Array:e<=32767&&e>=-32768?Int16Array:Int32Array:e<=255?Uint8Array:e<=65535?Uint16Array:Uint32Array:Float64Array};var y={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};g.getMinimalRepresentation=function(e,r){var p=null,h=0,a,l,n,u,f;for(u=0,f=e.length;uh&&(h=a,p=l);return p},g.isTypedArray=function(e){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(e)},g.concat=function(){var e=0,r,p,h;for(r=0,h=arguments.length;r{var t=zn(),i=Is();function x(y){return Array.isArray(y)||i.isTypedArray(y)}function T(y){if(typeof y.length=="number")return y.length;if(typeof y.size=="number")return y.size}function E(y){var e=T(y),r=typeof e=="number"?new Array(e):[],p=0;return t(y,function(h){r[p++]=h}),r}function s(y){var e=T(y),r=typeof e=="number"?i.getPointerArray(e):Array,p=typeof e=="number"?new Array(e):[],h=typeof e=="number"?new r(e):[],a=0;return t(y,function(l){p[a]=l,h[a]=a++}),[p,h]}g.isArrayLike=x,g.guessLength=T,g.toArray=E,g.toArrayWithIndices=s}),Hx=si((g,t)=>{var i=zn(),x=Jm(),T=sa(),E=x.DEFAULT_COMPARATOR,s=x.reverseComparator;function y(d,v,m,S){for(var M=v[S],w,C;S>m;){if(w=S-1>>1,C=v[w],d(M,C)<0){v[S]=C,S=w;continue}break}v[S]=M}function e(d,v,m){for(var S=v.length,M=m,w=v[m],C=2*m+1,A;C=0&&(C=A),v[m]=v[C],m=C,C=2*m+1;v[m]=w,y(d,v,M,m)}function r(d,v,m){v.push(m),y(d,v,0,v.length-1)}function p(d,v){var m=v.pop();if(v.length!==0){var S=v[0];return v[0]=m,e(d,v,0),S}return m}function h(d,v,m){if(v.length===0)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var S=v[0];return v[0]=m,e(d,v,0),S}function a(d,v,m){var S;return v.length!==0&&d(v[0],m)<0&&(S=v[0],v[0]=m,m=S,e(d,v,0)),m}function l(d,v){for(var m=v.length,S=m>>1,M=S;--M>=0;)e(d,v,M)}function n(d,v){for(var m=v.length,S=0,M=new Array(m);S=m.length)return m.slice().sort(d);for(P=m.slice(0,v),l(S,P),M=v,w=m.length;M0&&h(S,P,m[M]);return P.sort(d)}var b=T.guessLength(m);return b!==null&&b0&&h(S,P,O)),M++}),P.length>M&&(P.length=M),P.sort(d)}function f(d,v,m){arguments.length===2&&(m=v,v=d,d=E);var S=s(d),M,w,C,A=-1/0,P;if(v===1){if(T.isArrayLike(m)){for(M=0,w=m.length;M0)&&(A=C);return P=new m.constructor(1),P[0]=A,P}return i(m,function(O){(A===-1/0||d(O,A)>0)&&(A=O)}),[A]}if(T.isArrayLike(m)){if(v>=m.length)return m.slice().sort(S);for(P=m.slice(0,v),l(d,P),M=v,w=m.length;M0&&h(d,P,m[M]);return P.sort(S)}var b=T.guessLength(m);return b!==null&&b0&&h(d,P,O)),M++}),P.length>M&&(P.length=M),P.sort(S)}function o(d){if(this.clear(),this.comparator=d||E,typeof this.comparator!="function")throw new Error("mnemonist/Heap.constructor: given comparator should be a function.")}o.prototype.clear=function(){this.items=[],this.size=0},o.prototype.push=function(d){return r(this.comparator,this.items,d),++this.size},o.prototype.peek=function(){return this.items[0]},o.prototype.pop=function(){return this.size!==0&&this.size--,p(this.comparator,this.items)},o.prototype.replace=function(d){return h(this.comparator,this.items,d)},o.prototype.pushpop=function(d){return a(this.comparator,this.items,d)},o.prototype.consume=function(){return this.size=0,n(this.comparator,this.items)},o.prototype.toArray=function(){return n(this.comparator,this.items.slice())},o.prototype.inspect=function(){var d=this.toArray();return Object.defineProperty(d,"constructor",{value:o,enumerable:!1}),d},typeof Symbol<"u"&&(o.prototype[Symbol.for("nodejs.util.inspect.custom")]=o.prototype.inspect);function c(d){if(this.clear(),this.comparator=d||E,typeof this.comparator!="function")throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=s(this.comparator)}c.prototype=o.prototype,o.from=function(d,v){var m=new o(v),S;return T.isArrayLike(d)?S=d.slice():S=T.toArray(d),l(m.comparator,S),m.items=S,m.size=S.length,m},c.from=function(d,v){var m=new c(v),S;return T.isArrayLike(d)?S=d.slice():S=T.toArray(d),l(m.comparator,S),m.items=S,m.size=S.length,m},o.siftUp=e,o.siftDown=y,o.push=r,o.pop=p,o.replace=h,o.pushpop=a,o.heapify=l,o.consume=n,o.nsmallest=u,o.nlargest=f,o.MinHeap=o,o.MaxHeap=c,t.exports=o}),BF=si((g,t)=>{var i="";function x(r,p,h){for(var a=p.length,l=[],n=a,u=-1,f,o=0,c;n--;)u=Math.max(r[p[n]+h],u);for(c=u>>24&&32||u>>16&&24||u>>8&&16||8;o>o&15].push(p[n]);for(f=0;f<16;f++)for(u=l[f].length;u--;)p[++n]=l[f][u]}}function T(r,p,h,a){return r[h]-r[a]||(h%3===2?r[h+1]-r[a+1]||p[h+2]-p[a+2]:p[h+1]-p[a+1])}function E(r,p){var h=[],a=[],l=2*p/3|0,n=p-l,u=l+1>>1,f=l,o=0,c,d=[],v=[];if(p===1)return[0];for(;f--;)h[f]=(f*3>>1)+1;for(f=3;f--;)x(r,h,f);for(o=a[(h[0]/3|0)+(h[0]%3===1?0:u)]=1,f=1;fthis.firstLength&&n>this.firstLength)){for(p=Math.min(this.length-l,this.length-n),a=0;ar.length&&(r=this.text.slice(l,l+p))}return r},e.prototype.toString=function(){return this.array.join(",")},e.prototype.toJSON=function(){return this.array},e.prototype.inspect=function(){for(var r=new Array(this.length),p=0;p{var i=zn();function x(r){this.size=0,this.items=new Map,this.inverse=r}function T(){this.size=0,this.items=new Map,this.inverse=new x(this)}function E(){this.size=0,this.items.clear(),this.inverse.items.clear()}T.prototype.clear=E,x.prototype.clear=E;function s(r,p){if(this.items.has(r)){var h=this.items.get(r);if(h===p)return this;this.inverse.items.delete(h)}if(this.inverse.items.has(p)){var a=this.inverse.items.get(p);if(a===r)return this;this.items.delete(a)}return this.items.set(r,p),this.inverse.items.set(p,r),this.size=this.items.size,this.inverse.size=this.inverse.items.size,this}T.prototype.set=s,x.prototype.set=s;function y(r){if(this.items.has(r)){var p=this.items.get(r);return this.items.delete(r),this.inverse.items.delete(p),this.size=this.items.size,this.inverse.size=this.inverse.items.size,!0}return!1}T.prototype.delete=y,x.prototype.delete=y;var e=["has","get","forEach","keys","values","entries"];e.forEach(function(r){T.prototype[r]=x.prototype[r]=function(){return Map.prototype[r].apply(this.items,arguments)}}),typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.entries,x.prototype[Symbol.iterator]=x.prototype.entries),T.prototype.inspect=function(){var r={left:this.items,right:this.inverse.items};return Object.defineProperty(r,"constructor",{value:T,enumerable:!1}),r},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),x.prototype.inspect=function(){var r={left:this.inverse.items,right:this.items};return Object.defineProperty(r,"constructor",{value:x,enumerable:!1}),r},typeof Symbol<"u"&&(x.prototype[Symbol.for("nodejs.util.inspect.custom")]=x.prototype.inspect),T.from=function(r){var p=new T;return i(r,function(h,a){p.set(a,h)}),p},t.exports=T}),Vr=si((g,t)=>{function i(x){if(typeof x!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=x}typeof Symbol<"u"&&(i.prototype[Symbol.iterator]=function(){return this}),i.of=function(){var x=arguments,T=x.length,E=0;return new i(function(){return E>=T?{done:!0}:{done:!1,value:x[E++]}})},i.empty=function(){var x=new i(function(){return{done:!0}});return x},i.fromSequence=function(x){var T=0,E=x.length;return new i(function(){return T>=E?{done:!0}:{done:!1,value:x[T++]}})},i.is=function(x){return x instanceof i?!0:typeof x=="object"&&x!==null&&typeof x.next=="function"},t.exports=i}),VM=si(g=>{function t(s){return s|=s>>1,s|=s>>2,s|=s>>4,s|=s>>8,s|=s>>16,s&~(s>>1)}g.msb32=t;function i(s){return s|=s>>1,s|=s>>2,s|=s>>4,s&~(s>>1)}g.msb8=i,g.test=function(s,y){return s>>y&1},g.criticalBit8=function(s,y){return i(s^y)},g.criticalBit8Mask=function(s,y){return~i(s^y)>>>0&255},g.testCriticalBit8=function(s,y){return 1+(s|y)>>8},g.criticalBit32Mask=function(s,y){return~t(s^y)>>>0&4294967295},g.popcount=function(s){return s-=s>>1&1431655765,s=(s&858993459)+(s>>2&858993459),s=s+(s>>4)&252645135,s+=s>>8,s+=s>>16,s&127};var x=new Uint8Array(Math.pow(2,8));for(T=0,E=x.length;T>8&255]+x[s>>16&255]+x[s>>24&255]}}),zF=si((g,t)=>{var i=Vr(),x=VM();function T(E){this.length=E,this.clear()}T.prototype.clear=function(){this.size=0,this.array=new Uint32Array(Math.ceil(this.length/32))},T.prototype.set=function(E,s){var y=E>>5,e=E&31,r=this.array[y],p;return s===0||s===!1?p=this.array[y]&=~(1<>>0,p>r?this.size++:p>5,y=E&31,e=this.array[s],r;return r=this.array[s]&=~(1<>5,y=E&31,e=this.array[s],r=this.array[s]^=1<>>0,r>e?this.size++:r>5,y=E&31;return this.array[s]>>y&1},T.prototype.test=function(E){return!!this.get(E)},T.prototype.rank=function(E){if(this.size===0)return 0;for(var s=E>>5,y=E&31,e=0,r=0;r=this.length)return-1;for(var s,y=32,e=0,r=0,p=0,h=this.array.length;p>a&1,r===E)return e}},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;for(var y=this.length,e,r,p=32,h=0,a=this.array.length;h>l&1,E.call(s,r,h*32+l)}},T.prototype.values=function(){var E=this.length,s=!1,y,e,r=this.array,p=r.length,h=0,a=-1,l=32;return new i(function n(){if(!s){if(h>=p)return{done:!0};h===p-1&&(l=E%32||32),y=r[h++],s=!0,a=-1}return a++,a>=l?(s=!1,n()):(e=y>>a&1,{value:e})})},T.prototype.entries=function(){var E=this.length,s=!1,y,e,r=this.array,p,h=r.length,a=0,l=-1,n=32;return new i(function u(){if(!s){if(a>=h)return{done:!0};a===h-1&&(n=E%32||32),y=r[a++],s=!0,l=-1}return l++,p=~-a*32+l,l>=n?(s=!1,u()):(e=y>>l&1,{value:[p,e]})})},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.values),T.prototype.inspect=function(){var E=new Uint8Array(this.length);return this.forEach(function(s,y){E[y]=s}),Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),T.prototype.toJSON=function(){return Array.from(this.array)},t.exports=T}),GF=si((g,t)=>{var i=Vr(),x=VM(),T=function(y){return Math.max(1,Math.ceil(y*1.5))};function E(y){return new Uint32Array(Math.ceil(y/32))}function s(y){var e=y||0,r=T;typeof y=="object"&&(e=y.initialLength||y.initialCapacity||0,r=y.policy||r),this.size=0,this.length=e,this.capacity=Math.ceil(this.length/32)*32,this.policy=r,this.array=E(this.capacity)}s.prototype.set=function(y,e){if(this.length>5,p=y&31,h=this.array[r],a;return e===0||e===!1?a=this.array[r]&=~(1<>>0,a>h?this.size++:a>5,r=y&31,p=this.array[e],h;return h=this.array[e]&=~(1<>5,r=y&31,p=this.array[e],h=this.array[e]^=1<>>0,h>p?this.size++:hthis.array.length?(this.array=new Uint32Array(p),this.array.set(r,0)):this.array=r.slice(0,p),this.capacity=y,this)},s.prototype.grow=function(y){var e;if(typeof y=="number"){if(this.capacity>=y)return this;for(e=this.capacity;e>5,p=e&31;return this.array[r]|=1<>5,r=y&31;return this.array[e]>>r&1}},s.prototype.get=function(y){if(!(this.length>5,r=y&31;return this.array[e]>>r&1}},s.prototype.test=function(y){return this.length>5,r=y&31,p=0,h=0;h=this.length)return-1;for(var e,r=32,p=0,h=0,a=0,l=this.array.length;a>n&1,h===y)return p}},s.prototype.forEach=function(y,e){e=arguments.length>1?e:this;for(var r=this.length,p,h,a=32,l=0,n=this.array.length;l>u&1,y.call(e,h,l*32+u)}},s.prototype.values=function(){var y=this.length,e=!1,r,p,h=this.array,a=h.length,l=0,n=-1,u=32;return new i(function f(){if(!e){if(l>=a)return{done:!0};l===a-1&&(u=y%32||32),r=h[l++],e=!0,n=-1}return n++,n>=u?(e=!1,f()):(p=r>>n&1,{value:p})})},s.prototype.entries=function(){var y=this.length,e=!1,r,p,h=this.array,a,l=h.length,n=0,u=-1,f=32;return new i(function o(){if(!e){if(n>=l)return{done:!0};n===l-1&&(f=y%32||32),r=h[n++],e=!0,u=-1}return u++,a=~-n*32+u,u>=f?(e=!1,o()):(p=r>>u&1,{value:[a,p]})})},typeof Symbol<"u"&&(s.prototype[Symbol.iterator]=s.prototype.values),s.prototype.inspect=function(){var y=new Uint8Array(this.length);return this.forEach(function(e,r){y[r]=e}),Object.defineProperty(y,"constructor",{value:s,enumerable:!1}),y},typeof Symbol<"u"&&(s.prototype[Symbol.for("nodejs.util.inspect.custom")]=s.prototype.inspect),s.prototype.toJSON=function(){return Array.from(this.array.slice(0,(this.length>>5)+1))},t.exports=s}),VF=si((g,t)=>{function i(E,s){return(E&65535)*s+(((E>>>16)*s&65535)<<16)&4294967295}function x(E,s){return(E&65535)+(s>>>16)+(((E>>>16)+s&65535)<<16)&4294967295}function T(E,s){return E<>>32-s}t.exports=function(E,s){var y=3432918353,e=461845907,r=15,p=13,h=5,a=1801774676,l=E,n,u,f;for(u=0,f=s.length-4;u<=f;u+=4)n=s[u]|s[u+1]<<8|s[u+2]<<16|s[u+3]<<24,n=i(n,y),n=T(n,r),n=i(n,e),l^=n,l=T(l,p),l=i(l,h),l=x(l,a);switch(n=0,s.length&3){case 3:n^=s[u+2]<<16;case 2:n^=s[u+1]<<8;case 1:n^=s[u],n=i(n,y),n=T(n,r),n=i(n,e),l^=n}return l^=s.length,l^=l>>>16,l=i(l,2246822507),l^=l>>>13,l=i(l,3266489909),l^=l>>>16,l>>>0}}),HF=si((g,t)=>{var i=VF(),x=zn(),T=Math.LN2*Math.LN2,E={errorRate:.005};function s(r){var p=new Uint16Array(r.length),h,a;for(h=0,a=r.length;h>3]|=n}return this},e.prototype.test=function(r){for(var p=s(r),h=0,a=this.hashFunctions;h>3]&1<<(7&l)))return!1}return!0},e.prototype.toJSON=function(){return this.data},e.from=function(r,p){if(!p&&(p=r.length||r.size,typeof p!="number"))throw new Error("BloomFilter.from: could not infer the filter's capacity. Try passing it as second argument.");var h=new e(p);return x(r,function(a){h.add(a)}),h},t.exports=e}),WF=si((g,t)=>{var i=zn();function x(T){if(typeof T!="function")throw new Error("mnemonist/BKTree.constructor: given `distance` should be a function.");this.distance=T,this.clear()}x.prototype.add=function(T){if(!this.root)return this.root={item:T,children:{}},this.size++,this;for(var E=this.root,s;s=this.distance(T,E.item),!!E.children[s];)E=E.children[s];return E.children[s]={item:T,children:{}},this.size++,this},x.prototype.search=function(T,E){if(!this.root)return[];for(var s=[],y=[this.root],e,r,p,h,a;y.length;)for(e=y.pop(),p=this.distance(E,e.item),p<=T&&s.push({item:e.item,distance:p}),h=p-T,a=p+T+1;h{var i=sa(),x=Vr();function T(E,s){if(arguments.length<2)throw new Error("mnemonist/fixed-deque: expecting an Array class and a capacity.");if(typeof s!="number"||s<=0)throw new Error("mnemonist/fixed-deque: `capacity` should be a positive number.");this.ArrayClass=E,this.capacity=s,this.items=new E(this.capacity),this.clear()}T.prototype.clear=function(){this.start=0,this.size=0},T.prototype.push=function(E){if(this.size===this.capacity)throw new Error("mnemonist/fixed-deque.push: deque capacity ("+this.capacity+") exceeded!");var s=this.start+this.size;return s>=this.capacity&&(s-=this.capacity),this.items[s]=E,++this.size},T.prototype.unshift=function(E){if(this.size===this.capacity)throw new Error("mnemonist/fixed-deque.unshift: deque capacity ("+this.capacity+") exceeded!");var s=this.start-1;return this.start===0&&(s=this.capacity-1),this.items[s]=E,this.start=s,++this.size},T.prototype.pop=function(){if(this.size!==0){this.size--;var E=this.start+this.size;return E>=this.capacity&&(E-=this.capacity),this.items[E]}},T.prototype.shift=function(){if(this.size!==0){var E=this.start;return this.size--,this.start++,this.start===this.capacity&&(this.start=0),this.items[E]}},T.prototype.peekFirst=function(){if(this.size!==0)return this.items[this.start]},T.prototype.peekLast=function(){if(this.size!==0){var E=this.start+this.size-1;return E>=this.capacity&&(E-=this.capacity),this.items[E]}},T.prototype.get=function(E){if(!(this.size===0||E>=this.capacity))return E=this.start+E,E>=this.capacity&&(E-=this.capacity),this.items[E]},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;for(var y=this.capacity,e=this.size,r=this.start,p=0;p=y)return{done:!0};var p=E[e];return e++,r++,e===s&&(e=0),{value:p,done:!1}})},T.prototype.entries=function(){var E=this.items,s=this.capacity,y=this.size,e=this.start,r=0;return new x(function(){if(r>=y)return{done:!0};var p=E[e];return e++,e===s&&(e=0),{value:[r++,p],done:!1}})},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.values),T.prototype.inspect=function(){var E=this.toArray();return E.type=this.ArrayClass.name,E.capacity=this.capacity,Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),T.from=function(E,s,y){if(arguments.length<3&&(y=i.guessLength(E),typeof y!="number"))throw new Error("mnemonist/fixed-deque.from: could not guess iterable length. Please provide desired capacity as last argument.");var e=new T(s,y);if(i.isArrayLike(E)){var r,p;for(r=0,p=E.length;r{var i=sa(),x=HM();function T(s,y){if(arguments.length<2)throw new Error("mnemonist/circular-buffer: expecting an Array class and a capacity.");if(typeof y!="number"||y<=0)throw new Error("mnemonist/circular-buffer: `capacity` should be a positive number.");this.ArrayClass=s,this.capacity=y,this.items=new s(this.capacity),this.clear()}function E(s){T.prototype[s]=x.prototype[s]}Object.keys(x.prototype).forEach(E),typeof Symbol<"u"&&Object.getOwnPropertySymbols(x.prototype).forEach(E),T.prototype.push=function(s){var y=this.start+this.size;return y>=this.capacity&&(y-=this.capacity),this.items[y]=s,this.size===this.capacity?(y++,y>=this.capacity?this.start=0:this.start=y,this.size):++this.size},T.prototype.unshift=function(s){var y=this.start-1;return this.start===0&&(y=this.capacity-1),this.items[y]=s,this.size===this.capacity?(this.start=y,this.size):(this.start=y,++this.size)},T.from=function(s,y,e){if(arguments.length<3&&(e=i.guessLength(s),typeof e!="number"))throw new Error("mnemonist/circular-buffer.from: could not guess iterable length. Please provide desired capacity as last argument.");var r=new T(y,e);if(i.isArrayLike(s)){var p,h;for(p=0,h=s.length;p{function i(x){if(typeof x!="function")throw new Error("mnemonist/DefaultMap.constructor: expecting a function.");this.items=new Map,this.factory=x,this.size=0}i.prototype.clear=function(){this.items.clear(),this.size=0},i.prototype.get=function(x){var T=this.items.get(x);return typeof T>"u"&&(T=this.factory(x,this.size),this.items.set(x,T),this.size++),T},i.prototype.peek=function(x){return this.items.get(x)},i.prototype.set=function(x,T){return this.items.set(x,T),this.size=this.items.size,this},i.prototype.has=function(x){return this.items.has(x)},i.prototype.delete=function(x){var T=this.items.delete(x);return this.size=this.items.size,T},i.prototype.forEach=function(x,T){T=arguments.length>1?T:this,this.items.forEach(x,T)},i.prototype.entries=function(){return this.items.entries()},i.prototype.keys=function(){return this.items.keys()},i.prototype.values=function(){return this.items.values()},typeof Symbol<"u"&&(i.prototype[Symbol.iterator]=i.prototype.entries),i.prototype.inspect=function(){return this.items},typeof Symbol<"u"&&(i.prototype[Symbol.for("nodejs.util.inspect.custom")]=i.prototype.inspect),i.autoIncrement=function(){var x=0;return function(){return x++}},t.exports=i}),kF=si((g,t)=>{function i(x){if(typeof x!="function")throw new Error("mnemonist/DefaultWeakMap.constructor: expecting a function.");this.items=new WeakMap,this.factory=x}i.prototype.clear=function(){this.items=new WeakMap},i.prototype.get=function(x){var T=this.items.get(x);return typeof T>"u"&&(T=this.factory(x),this.items.set(x,T)),T},i.prototype.peek=function(x){return this.items.get(x)},i.prototype.set=function(x,T){return this.items.set(x,T),this},i.prototype.has=function(x){return this.items.has(x)},i.prototype.delete=function(x){return this.items.delete(x)},i.prototype.inspect=function(){return this.items},typeof Symbol<"u"&&(i.prototype[Symbol.for("nodejs.util.inspect.custom")]=i.prototype.inspect),t.exports=i}),KF=si((g,t)=>{var i=Is();function x(T){var E=i.getPointerArray(T),s=i.getPointerArray(Math.log2(T));this.size=T,this.dimension=T,this.parents=new E(T),this.ranks=new s(T);for(var y=0;yr?this.parents[y]=s:(this.parents[y]=s,this.ranks[s]++),this},x.prototype.connected=function(T,E){var s=this.find(T);return s===this.find(E)},x.prototype.mapping=function(){for(var T=i.getPointerArray(this.dimension),E={},s=new T(this.size),y=0,e,r=0,p=this.parents.length;r"u"?(s[r]=y,E[e]=y++):s[r]=E[e];return s},x.prototype.compile=function(){for(var T={},E=new Array(this.dimension),s=0,y,e=0,r=this.parents.length;e"u"?(E[s]=[e],T[y]=s++):E[T[y]].push(e);return E},x.prototype.inspect=function(){var T=this.compile();return Object.defineProperty(T,"constructor",{value:x,enumerable:!1}),T},typeof Symbol<"u"&&(x.prototype[Symbol.for("nodejs.util.inspect.custom")]=x.prototype.inspect),t.exports=x}),Wx=si((g,t)=>{var i=Jm(),x=Hx(),T=i.DEFAULT_COMPARATOR,E=i.reverseComparator;function s(r,p,h,a){for(var l=h,n=a,u=p[a],f=2*a+1,o;f=0&&(f=o),p[a]=p[f],a=f,f=2*a+1;p[a]=u,x.siftDown(r,p,n,a)}function y(r,p,h,a){for(var l=a,n=l,u=new r(a),f,o;n>0;)f=h[--n],n!==0&&(o=h[0],h[0]=f,s(p,h,--a,0),f=o),u[n]=f;return u}function e(r,p,h){if(arguments.length===2&&(h=p,p=null),this.ArrayClass=r,this.capacity=h,this.items=new r(h),this.clear(),this.comparator=p||T,typeof h!="number"&&h<=0)throw new Error("mnemonist/FixedReverseHeap.constructor: capacity should be a number > 0.");if(typeof this.comparator!="function")throw new Error("mnemonist/FixedReverseHeap.constructor: given comparator should be a function.");this.comparator=E(this.comparator)}e.prototype.clear=function(){this.size=0},e.prototype.push=function(r){return this.size0&&x.replace(this.comparator,this.items,r),this.size},e.prototype.peek=function(){return this.items[0]},e.prototype.consume=function(){var r=y(this.ArrayClass,this.comparator,this.items,this.size);return this.size=0,r},e.prototype.toArray=function(){return y(this.ArrayClass,this.comparator,this.items.slice(0,this.size),this.size)},e.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:e,enumerable:!1}),r},typeof Symbol<"u"&&(e.prototype[Symbol.for("nodejs.util.inspect.custom")]=e.prototype.inspect),t.exports=e}),jF=si((g,t)=>{var i=zn(),x=function(E){return E};function T(E){if(this.items=new Map,this.clear(),Array.isArray(E)?(this.writeHashFunction=E[0],this.readHashFunction=E[1]):(this.writeHashFunction=E,this.readHashFunction=E),this.writeHashFunction||(this.writeHashFunction=x),this.readHashFunction||(this.readHashFunction=x),typeof this.writeHashFunction!="function")throw new Error("mnemonist/FuzzyMap.constructor: invalid hash function given.");if(typeof this.readHashFunction!="function")throw new Error("mnemonist/FuzzyMap.constructor: invalid hash function given.")}T.prototype.clear=function(){this.items.clear(),this.size=0},T.prototype.add=function(E){var s=this.writeHashFunction(E);return this.items.set(s,E),this.size=this.items.size,this},T.prototype.set=function(E,s){return E=this.writeHashFunction(E),this.items.set(E,s),this.size=this.items.size,this},T.prototype.get=function(E){return E=this.readHashFunction(E),this.items.get(E)},T.prototype.has=function(E){return E=this.readHashFunction(E),this.items.has(E)},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this,this.items.forEach(function(y){E.call(s,y,y)})},T.prototype.values=function(){return this.items.values()},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.values),T.prototype.inspect=function(){var E=Array.from(this.items.values());return Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),T.from=function(E,s,y){var e=new T(s);return i(E,function(r,p){y?e.set(p,r):e.add(r)}),e},t.exports=T}),WM=si((g,t)=>{var i=Vr(),x=zn();function T(E){this.Container=E||Array,this.items=new Map,this.clear(),Object.defineProperty(this.items,"constructor",{value:T,enumerable:!1})}T.prototype.clear=function(){this.size=0,this.dimension=0,this.items.clear()},T.prototype.set=function(E,s){var y=this.items.get(E),e;return y||(this.dimension++,y=new this.Container,this.items.set(E,y)),this.Container===Set?(e=y.size,y.add(s),e"u"?0:this.Container===Set?s.size:s.length},T.prototype.count=T.prototype.multiplicity,T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;var y;function e(r){E.call(s,r,y)}this.items.forEach(function(r,p){y=p,r.forEach(e)})},T.prototype.forEachAssociation=function(E,s){s=arguments.length>1?s:this,this.items.forEach(E,s)},T.prototype.keys=function(){return this.items.keys()},T.prototype.values=function(){var E=this.items.values(),s=!1,y,e,r,p;return this.Container===Set?new i(function h(){if(!s){if(e=E.next(),e.done)return{done:!0};s=!0,y=e.value.values()}return e=y.next(),e.done?(s=!1,h()):{done:!1,value:e.value}}):new i(function h(){if(!s){if(e=E.next(),e.done)return{done:!0};s=!0,y=e.value,r=0,p=y.length}return r>=p?(s=!1,h()):{done:!1,value:y[r++]}})},T.prototype.entries=function(){var E=this.items.entries(),s=!1,y,e,r,p,h;return this.Container===Set?new i(function a(){if(!s){if(e=E.next(),e.done)return{done:!0};s=!0,r=e.value[0],y=e.value[1].values()}return e=y.next(),e.done?(s=!1,a()):{done:!1,value:[r,e.value]}}):new i(function a(){if(!s){if(e=E.next(),e.done)return{done:!0};s=!0,r=e.value[0],y=e.value[1],p=0,h=y.length}return p>=h?(s=!1,a()):{done:!1,value:[r,y[p++]]}})},T.prototype.containers=function(){return this.items.values()},T.prototype.associations=function(){return this.items.entries()},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.entries),T.prototype.inspect=function(){return this.items},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),T.prototype.toJSON=function(){return this.items},T.from=function(E,s){var y=new T(s);return x(E,function(e,r){y.set(r,e)}),y},t.exports=T}),ZF=si((g,t)=>{var i=WM(),x=zn(),T=function(s){return s};function E(s,y){if(this.items=new i(y),this.clear(),Array.isArray(s)?(this.writeHashFunction=s[0],this.readHashFunction=s[1]):(this.writeHashFunction=s,this.readHashFunction=s),this.writeHashFunction||(this.writeHashFunction=T),this.readHashFunction||(this.readHashFunction=T),typeof this.writeHashFunction!="function")throw new Error("mnemonist/FuzzyMultiMap.constructor: invalid hash function given.");if(typeof this.readHashFunction!="function")throw new Error("mnemonist/FuzzyMultiMap.constructor: invalid hash function given.")}E.prototype.clear=function(){this.items.clear(),this.size=0,this.dimension=0},E.prototype.add=function(s){var y=this.writeHashFunction(s);return this.items.set(y,s),this.size=this.items.size,this.dimension=this.items.dimension,this},E.prototype.set=function(s,y){return s=this.writeHashFunction(s),this.items.set(s,y),this.size=this.items.size,this.dimension=this.items.dimension,this},E.prototype.get=function(s){return s=this.readHashFunction(s),this.items.get(s)},E.prototype.has=function(s){return s=this.readHashFunction(s),this.items.has(s)},E.prototype.forEach=function(s,y){y=arguments.length>1?y:this,this.items.forEach(function(e){s.call(y,e,e)})},E.prototype.values=function(){return this.items.values()},typeof Symbol<"u"&&(E.prototype[Symbol.iterator]=E.prototype.values),E.prototype.inspect=function(){var s=Array.from(this);return Object.defineProperty(s,"constructor",{value:E,enumerable:!1}),s},typeof Symbol<"u"&&(E.prototype[Symbol.for("nodejs.util.inspect.custom")]=E.prototype.inspect),E.from=function(s,y,e,r){arguments.length===3&&typeof e=="boolean"&&(r=e,e=Array);var p=new E(y,e);return x(s,function(h,a){r?p.set(a,h):p.add(h)}),p},t.exports=E}),JF=si((g,t)=>{var i=1024;function x(E){return(E&E-1)===0}function T(E,s){if(arguments.length<1)throw new Error("mnemonist/hashed-array-tree: expecting at least a byte array constructor.");var y=s||0,e=i,r=0;if(typeof s=="object"&&(y=s.initialCapacity||0,r=s.initialLength||0,e=s.blockSize||i),!e||!x(e))throw new Error("mnemonist/hashed-array-tree: block size should be a power of two.");var p=Math.max(r,y),h=Math.ceil(p/e);this.ArrayClass=E,this.length=r,this.capacity=h*e,this.blockSize=e,this.offsetMask=e-1,this.blockMask=Math.log2(e),this.blocks=new Array(h);for(var a=0;a>this.blockMask,e=E&this.offsetMask;return this.blocks[y][e]=s,this},T.prototype.get=function(E){if(!(this.length>this.blockMask,y=E&this.offsetMask;return this.blocks[s][y]}},T.prototype.grow=function(E){if(typeof E!="number"&&(E=this.capacity+this.blockSize),this.capacity>=E)return this;for(;this.capacity>this.blockMask,e=s&this.offsetMask;return this.blocks[y][e]=E,++this.length},T.prototype.pop=function(){if(this.length!==0){var E=this.blocks[this.blocks.length-1],s=--this.length&this.offsetMask;return E[s]}},T.prototype.inspect=function(){for(var E=new this.ArrayClass(this.length),s,y=0,e=this.length;y>this.blockMask,E[y]=this.blocks[s][y&this.offsetMask];return E.type=this.ArrayClass.name,E.items=this.length,E.capacity=this.capacity,E.blockSize=this.blockSize,Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),t.exports=T}),XM=si((g,t)=>{var i=Vr(),x=sa();function T(E,s){if(arguments.length<2)throw new Error("mnemonist/fixed-stack: expecting an Array class and a capacity.");if(typeof s!="number"||s<=0)throw new Error("mnemonist/fixed-stack: `capacity` should be a positive number.");this.capacity=s,this.ArrayClass=E,this.items=new this.ArrayClass(this.capacity),this.clear()}T.prototype.clear=function(){this.size=0},T.prototype.push=function(E){if(this.size===this.capacity)throw new Error("mnemonist/fixed-stack.push: stack capacity ("+this.capacity+") exceeded!");return this.items[this.size++]=E,this.size},T.prototype.pop=function(){if(this.size!==0)return this.items[--this.size]},T.prototype.peek=function(){return this.items[this.size-1]},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;for(var y=0,e=this.items.length;y=s)return{done:!0};var e=E[s-y-1];return y++,{value:e,done:!1}})},T.prototype.entries=function(){var E=this.items,s=this.size,y=0;return new i(function(){if(y>=s)return{done:!0};var e=E[s-y-1];return{value:[y++,e],done:!1}})},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.values),T.prototype.toString=function(){return this.toArray().join(",")},T.prototype.toJSON=function(){return this.toArray()},T.prototype.inspect=function(){var E=this.toArray();return E.type=this.ArrayClass.name,E.capacity=this.capacity,Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),T.from=function(E,s,y){if(arguments.length<3&&(y=x.guessLength(E),typeof y!="number"))throw new Error("mnemonist/fixed-stack.from: could not guess iterable length. Please provide desired capacity as last argument.");var e=new T(s,y);if(x.isArrayLike(E)){var r,p;for(r=0,p=E.length;r{var i=sa(),x=Is(),T=XM();function E(y,e,r,p,h,a,l,n){var u=l+(n-l)/2|0,f=~-u,o=-~u,c=r[u];p[a]=c+1;var d=e?e(y[c]):y[c][1],v=a*2+1,m=a*2+2,S=-1/0,M=-1/0;l<=f&&(S=E(y,e,r,p,h,v,l,f)),o<=n&&(M=E(y,e,r,p,h,m,o,n));var w=Math.max(d,S,M),C=c;return w===S?C=h[p[v]-1]:w===M&&(C=h[p[m]-1]),h[c]=C,w}function s(y,e){this.size=y.length,this.intervals=y;var r=null,p=null;Array.isArray(e)&&(r=e[0],p=e[1]);var h=y.length,a=x.getPointerArray(h+1),l=new a(h),n;for(n=1;nv?1:0});var u=Math.ceil(Math.log2(h+1)),f=Math.pow(2,u)-1,o=new a(f),c=new a(h);E(y,p,l,o,c,0,0,h-1),l=null,this.height=u,this.tree=o,this.augmentations=c,this.startGetter=r,this.endGetter=p,this.stack=new T(a,this.height)}s.prototype.intervalsContainingPoint=function(y){var e=[],r=this.stack;r.clear(),r.push(0);for(var p=this.tree.length,h,a,l,n,u,f,o,c,d;r.size;)h=r.pop(),a=this.tree[h]-1,l=this.intervals[a],n=this.intervals[this.augmentations[a]],o=this.endGetter?this.endGetter(n):n[1],!(y>o)&&(c=h*2+1,c=u&&y<=f&&e.push(l),!(yd)&&(v=l*2+1,v=o&&e<=c&&p.push(u),!(r{g.search=function(t,i,x,T){var E=0;x=typeof x<"u"?x:0,T=typeof T<"u"?T:t.length,T--;for(var s;x<=T;)if(E=x+T>>>1,s=t[E],s>i)T=~-E;else if(s>>1,y=t(i[T],x),y>0)s=~-T;else if(y<0)E=-~T;else return T;return-1},g.lowerBound=function(t,i,x,T){var E=0;for(x=typeof x<"u"?x:0,T=typeof T<"u"?T:t.length;x>>1,i<=t[E]?T=E:x=-~E;return x},g.lowerBoundWithComparator=function(t,i,x){for(var T=0,E=0,s=i.length;E>>1,t(x,i[T])<=0?s=T:E=-~T;return E},g.lowerBoundIndices=function(t,i,x,T,E){var s=0;for(T=typeof T<"u"?T:0,E=typeof E<"u"?E:t.length;T>>1,x<=t[i[s]]?E=s:T=-~s;return T},g.upperBound=function(t,i,x,T){var E=0;for(x=typeof x<"u"?x:0,T=typeof T<"u"?T:t.length;x>>1,i>=t[E]?x=-~E:T=E;return x},g.upperBoundWithComparator=function(t,i,x){for(var T=0,E=0,s=i.length;E>>1,t(x,i[T])>=0?E=-~T:s=T;return E}}),QF=si(g=>{var t=Is(),i=sa().isArrayLike,x=YM(),T=Vx();function E(r,p){if(r.length===0)return p.slice();if(p.length===0)return r.slice();var h;r[0]>p[0]&&(h=r,r=p,p=h);var a=r[r.length-1],l=p[0];if(a<=l)return t.isTypedArray(r)?t.concat(r,p):r.concat(p);var n=new r.constructor(r.length+p.length),u,f,o;for(u=0,f=r.length;up[0]&&(h=r,r=p,p=h);var a=r[r.length-1],l=p[0];if(ap[0]&&(h=r,r=p,p=h);var a=r[r.length-1],l=p[0];if(av?o=x.lowerBound(p,d,o+1):(n.push(d),u++,o++);return n};function y(r){var p=0,h=-1/0,a,l,n,u=[];for(l=0,n=r.length;lh&&(h=a));if(u.length===0)return new r[0].constructor(0);if(u.length===1)return u[0].slice();if(u.length===2)return E(u[0],u[1]);r=u;var f=new r[0].constructor(p),o=t.getPointerArray(h),c=new o(r.length),d=new T(function(S,M){return S=r[S][c[S]],M=r[M][c[M]],SM?1:0});for(l=0;lp&&(p=h));if(n.length===0)return new r[0].constructor(0);if(n.length===1)return n[0].slice();if(n.length===2)return s(n[0],n[1]);r=n;var u=new r[0].constructor,f=t.getPointerArray(p),o=new f(r.length),c=new T(function(m,S){return m=r[m][o[m]],S=r[S][o[S]],mS?1:0});for(a=0;ap&&(p=a),lh)return[];if(p===h)return[p];var o,c,d=r[0],v,m,S,M,w,C,A=p;for(u=1;uC?m=x.lowerBound(c,w,m+1):(d.push(w),v++,m++);if(d.length===0)return d;A=d[0]}return d},g.merge=function(){if(arguments.length===2){if(i(arguments[0]))return E(arguments[0],arguments[1])}else if(i(arguments[0]))return y(arguments);return null},g.unionUnique=function(){if(arguments.length===2){if(i(arguments[0]))return s(arguments[0],arguments[1])}else if(i(arguments[0]))return e(arguments);return null},g.intersectionUnique=function(){if(arguments.length===2){if(i(arguments[0]))return g.intersectionUniqueArrays(arguments[0],arguments[1])}else if(i(arguments[0]))return g.kWayIntersectionUniqueArrays(arguments);return null}}),_F=si((g,t)=>{var i=Vr(),x=zn(),T=QF();function E(y){return y}function s(y){if(this.clear(),Array.isArray(y)?(this.documentTokenizer=y[0],this.queryTokenizer=y[1]):(this.documentTokenizer=y,this.queryTokenizer=y),this.documentTokenizer||(this.documentTokenizer=E),this.queryTokenizer||(this.queryTokenizer=E),typeof this.documentTokenizer!="function")throw new Error("mnemonist/InvertedIndex.constructor: document tokenizer is not a function.");if(typeof this.queryTokenizer!="function")throw new Error("mnemonist/InvertedIndex.constructor: query tokenizer is not a function.")}s.prototype.clear=function(){this.items=[],this.mapping=new Map,this.size=0,this.dimension=0},s.prototype.add=function(y){this.size++;var e=this.items.length;this.items.push(y);var r=this.documentTokenizer(y);if(!Array.isArray(r))throw new Error("mnemonist/InvertedIndex.add: tokenizer function should return an array of tokens.");for(var p=new Set,h,a,l=0,n=r.length;l"u"||r.length===0)return[];if(e.length>1)for(h=1,a=e.length;h"u"||p.length===0)return[];r=T.intersectionUniqueArrays(r,p)}var l=new Array(r.length);for(h=0,a=l.length;h1?e:this;for(var r=0,p=this.documents.length;r=e)return{done:!0};var p=y[r++];return{value:p,done:!1}})},s.prototype.tokens=function(){return this.mapping.keys()},typeof Symbol<"u"&&(s.prototype[Symbol.iterator]=s.prototype.documents),s.prototype.inspect=function(){var y=this.items.slice();return Object.defineProperty(y,"constructor",{value:s,enumerable:!1}),y},typeof Symbol<"u"&&(s.prototype[Symbol.for("nodejs.util.inspect.custom")]=s.prototype.inspect),s.from=function(y,e){var r=new s(e);return x(y,function(p){r.add(p)}),r},t.exports=s}),kM=si(g=>{var t=new Float64Array(64),i=new Float64Array(64);function x(E,s,y){var e,r,p,h,a;for(t[0]=s,i[0]=y,r=0;r>=0;)if(p=t[r],h=i[r]-1,p=e&&pi[r-1]-t[r-1]&&(a=t[r],t[r]=t[r-1],t[r-1]=a,a=i[r],i[r]=i[r-1],i[r-1]=a)}else r--;return E}g.inplaceQuickSort=x;function T(E,s,y,e){var r,p,h,a,l,n;for(t[0]=y,i[0]=e,p=0;p>=0;)if(h=t[p],a=i[p]-1,h=r&&hi[p-1]-t[p-1]&&(n=t[p],t[p]=t[p-1],t[p-1]=n,n=i[p],i[p]=i[p-1],i[p-1]=n)}else p--;return s}g.inplaceQuickSortIndices=T}),qF=si((g,t)=>{var i=sa(),x=Is(),T=Jm().createTupleComparator,E=Wx(),s=kM().inplaceQuickSortIndices;function y(l,n,u,f){var o,c=0,d;for(o=0;o>>1),P=u[A],d[D]=P,w>-1&&(C===0?v[w]=D+1:m[w]=D+1),I=(I+1)%l,A!==b&&A!==O-1&&S.push([I,A+1,O,D,1]),A!==b&&S.push([I,b,A,D,0]),D++;return{axes:n,labels:f,pivots:d,lefts:v,rights:m}}function p(l,n){this.dimensions=l,this.visited=0,this.axes=n.axes,this.labels=n.labels,this.pivots=n.pivots,this.lefts=n.lefts,this.rights=n.rights,this.size=this.labels.length}p.prototype.nearestNeighbor=function(l){var n=1/0,u=null,f=this.dimensions,o=this.axes,c=this.pivots,d=this.lefts,v=this.rights,m=0;function S(M,w){m++;var C=d[w],A=v[w],P=c[w],b=y(f,o,P,l);if(!(b0?C!==0&&S(M,C-1):A!==0&&S(M,A-1),O*O0?A!==0&&S(M,A-1):C!==0&&S(M,C-1))}}return S(0,0),this.visited=m,this.labels[u]};var h=T(3),a=T(2);p.prototype.kNearestNeighbors=function(l,n){if(l<=0)throw new Error("mnemonist/kd-tree.kNearestNeighbors: k should be a positive number.");if(l=Math.min(l,this.size),l===1)return[this.nearestNeighbor(n)];var u=new E(Array,h,l),f=this.dimensions,o=this.axes,c=this.pivots,d=this.lefts,v=this.rights,m=0;function S(C,A){var P=d[A],b=v[A],O=c[A],I=y(f,o,O,n);u.push([I,m++,O]);var D=n[C],B=o[C][O],G=D-B;C=(C+1)%f,D{var i=Vr(),x=zn();function T(){this.clear()}T.prototype.clear=function(){this.head=null,this.tail=null,this.size=0},T.prototype.first=function(){return this.head?this.head.item:void 0},T.prototype.peek=T.prototype.first,T.prototype.last=function(){return this.tail?this.tail.item:void 0},T.prototype.push=function(E){var s={item:E,next:null};return this.head?(this.tail.next=s,this.tail=s):(this.head=s,this.tail=s),this.size++,this.size},T.prototype.unshift=function(E){var s={item:E,next:null};return this.head?(this.head.next||(this.tail=this.head),s.next=this.head,this.head=s):(this.head=s,this.tail=s),this.size++,this.size},T.prototype.shift=function(){if(this.size){var E=this.head;return this.head=E.next,this.size--,E.item}},T.prototype.forEach=function(E,s){if(this.size){s=arguments.length>1?s:this;for(var y=this.head,e=0;y;)E.call(s,y.item,e,this),y=y.next,e++}},T.prototype.toArray=function(){if(!this.size)return[];for(var E=new Array(this.size),s=0,y=this.size,e=this.head;s{var i=Vr(),x=zn(),T=Is(),E=sa();function s(y,e,r){if(arguments.length<2&&(r=y,y=null,e=null),this.capacity=r,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-cache: capacity should be a finite positive integer.");var p=T.getPointerArray(r);this.forward=new p(r),this.backward=new p(r),this.K=typeof y=="function"?new y(r):new Array(r),this.V=typeof e=="function"?new e(r):new Array(r),this.size=0,this.head=0,this.tail=0,this.items={}}s.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},s.prototype.splayOnTop=function(y){var e=this.head;if(this.head===y)return this;var r=this.backward[y],p=this.forward[y];return this.tail===y?this.tail=r:this.backward[p]=r,this.forward[r]=p,this.backward[e]=y,this.head=y,this.forward[y]=e,this},s.prototype.set=function(y,e){var r=this.items[y];if(typeof r<"u"){this.splayOnTop(r),this.V[r]=e;return}this.size1?e:this;for(var r=0,p=this.size,h=this.head,a=this.K,l=this.V,n=this.forward;r=e)return{done:!0};var a=p[r];return y++,y=e)return{done:!0};var a=p[r];return y++,y=e)return{done:!0};var l=p[r],n=h[r];return y++,y{var i=Xx(),x=zn(),T=Is(),E=sa();function s(e,r,p){arguments.length<2?i.call(this,e):i.call(this,e,r,p);var h=T.getPointerArray(this.capacity);this.deleted=new h(this.capacity),this.deletedSize=0}for(y in i.prototype)s.prototype[y]=i.prototype[y];var y;typeof Symbol<"u"&&(s.prototype[Symbol.iterator]=i.prototype[Symbol.iterator]),s.prototype.clear=function(){i.prototype.clear.call(this),this.deletedSize=0},s.prototype.set=function(e,r){var p=this.items[e];if(typeof p<"u"){this.splayOnTop(p),this.V[p]=r;return}this.size0?p=this.deleted[--this.deletedSize]:p=this.size,this.size++):(p=this.tail,this.tail=this.backward[p],delete this.items[this.K[p]]),this.items[e]=p,this.K[p]=e,this.V[p]=r,this.forward[p]=this.head,this.backward[this.head]=p,this.head=p},s.prototype.setpop=function(e,r){var p=null,h=null,a=this.items[e];return typeof a<"u"?(this.splayOnTop(a),p=this.V[a],this.V[a]=r,{evicted:!1,key:e,value:p}):(this.size0?a=this.deleted[--this.deletedSize]:a=this.size,this.size++):(a=this.tail,this.tail=this.backward[a],p=this.V[a],h=this.K[a],delete this.items[h]),this.items[e]=a,this.K[a]=e,this.V[a]=r,this.forward[a]=this.head,this.backward[this.head]=a,this.head=a,h?{evicted:!0,key:h,value:p}:null)},s.prototype.delete=function(e){var r=this.items[e];if(typeof r>"u")return!1;if(delete this.items[e],this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,!0;var p=this.backward[r],h=this.forward[r];return this.head===r&&(this.head=h),this.tail===r&&(this.tail=p),this.forward[p]=h,this.backward[h]=p,this.size--,this.deleted[this.deletedSize++]=r,!0},s.prototype.remove=function(e,r=void 0){var p=this.items[e];if(typeof p>"u")return r;var h=this.V[p];if(delete this.items[e],this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,h;var a=this.backward[p],l=this.forward[p];return this.head===p&&(this.head=l),this.tail===p&&(this.tail=a),this.forward[a]=l,this.backward[l]=a,this.size--,this.deleted[this.deletedSize++]=p,h},s.from=function(e,r,p,h){if(arguments.length<2){if(h=E.guessLength(e),typeof h!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(h=r,r=null,p=null);var a=new s(r,p,h);return x(e,function(l,n){a.set(n,l)}),a},t.exports=s}),KM=si((g,t)=>{var i=Xx(),x=zn(),T=Is(),E=sa();function s(y,e,r){if(arguments.length<2&&(r=y,y=null,e=null),this.capacity=r,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-map: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-map: capacity should be a finite positive integer.");var p=T.getPointerArray(r);this.forward=new p(r),this.backward=new p(r),this.K=typeof y=="function"?new y(r):new Array(r),this.V=typeof e=="function"?new e(r):new Array(r),this.size=0,this.head=0,this.tail=0,this.items=new Map}s.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()},s.prototype.set=function(y,e){var r=this.items.get(y);if(typeof r<"u"){this.splayOnTop(r),this.V[r]=e;return}this.size{var i=KM(),x=zn(),T=Is(),E=sa();function s(e,r,p){arguments.length<2?i.call(this,e):i.call(this,e,r,p);var h=T.getPointerArray(this.capacity);this.deleted=new h(this.capacity),this.deletedSize=0}for(y in i.prototype)s.prototype[y]=i.prototype[y];var y;typeof Symbol<"u"&&(s.prototype[Symbol.iterator]=i.prototype[Symbol.iterator]),s.prototype.clear=function(){i.prototype.clear.call(this),this.deletedSize=0},s.prototype.set=function(e,r){var p=this.items.get(e);if(typeof p<"u"){this.splayOnTop(p),this.V[p]=r;return}this.size0?p=this.deleted[--this.deletedSize]:p=this.size,this.size++):(p=this.tail,this.tail=this.backward[p],this.items.delete(this.K[p])),this.items.set(e,p),this.K[p]=e,this.V[p]=r,this.forward[p]=this.head,this.backward[this.head]=p,this.head=p},s.prototype.setpop=function(e,r){var p=null,h=null,a=this.items.get(e);return typeof a<"u"?(this.splayOnTop(a),p=this.V[a],this.V[a]=r,{evicted:!1,key:e,value:p}):(this.size0?a=this.deleted[--this.deletedSize]:a=this.size,this.size++):(a=this.tail,this.tail=this.backward[a],p=this.V[a],h=this.K[a],this.items.delete(h)),this.items.set(e,a),this.K[a]=e,this.V[a]=r,this.forward[a]=this.head,this.backward[this.head]=a,this.head=a,h?{evicted:!0,key:h,value:p}:null)},s.prototype.delete=function(e){var r=this.items.get(e);if(typeof r>"u")return!1;if(this.items.delete(e),this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,!0;var p=this.backward[r],h=this.forward[r];return this.head===r&&(this.head=h),this.tail===r&&(this.tail=p),this.forward[p]=h,this.backward[h]=p,this.size--,this.deleted[this.deletedSize++]=r,!0},s.prototype.remove=function(e,r=void 0){var p=this.items.get(e);if(typeof p>"u")return r;var h=this.V[p];if(this.items.delete(e),this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,h;var a=this.backward[p],l=this.forward[p];return this.head===p&&(this.head=l),this.tail===p&&(this.tail=a),this.forward[a]=l,this.backward[l]=a,this.size--,this.deleted[this.deletedSize++]=p,h},s.from=function(e,r,p,h){if(arguments.length<2){if(h=E.guessLength(e),typeof h!="number")throw new Error("mnemonist/lru-map.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(h=r,r=null,p=null);var a=new s(r,p,h);return x(e,function(l,n){a.set(n,l)}),a},t.exports=s}),nO=si((g,t)=>{var i=Vr(),x=zn(),T=Wx(),E=function(y,e){return y[1]>e[1]?-1:y[1]"u"?0:e},s.prototype.get=s.prototype.multiplicity,s.prototype.count=s.prototype.multiplicity,s.prototype.frequency=function(y){if(this.size===0)return 0;var e=this.multiplicity(y);return e/this.size},s.prototype.top=function(y){if(typeof y!="number"||y<=0)throw new Error("mnemonist/multi-set.top: n must be a number > 0.");for(var e=new T(Array,E,y),r=this.items.entries(),p;p=r.next(),!p.done;)e.push(p.value);return e.consume()},s.prototype.forEach=function(y,e){e=arguments.length>1?e:this;var r;this.items.forEach(function(p,h){for(r=0;r1?e:this,this.items.forEach(y,e)},s.prototype.keys=function(){return this.items.keys()},s.prototype.values=function(){var y=this.items.entries(),e=!1,r,p,h,a;return new i(function l(){if(!e){if(r=y.next(),r.done)return{done:!0};e=!0,p=r.value[0],h=r.value[1],a=0}return a>=h?(e=!1,l()):(a++,{done:!1,value:p})})},s.prototype.multiplicities=function(){return this.items.entries()},typeof Symbol<"u"&&(s.prototype[Symbol.iterator]=s.prototype.values),s.prototype.inspect=function(){return this.items},typeof Symbol<"u"&&(s.prototype[Symbol.for("nodejs.util.inspect.custom")]=s.prototype.inspect),s.prototype.toJSON=function(){return this.items},s.from=function(y){var e=new s;return x(y,function(r){e.add(r)}),e},s.isSubset=function(y,e){var r=y.multiplicities(),p,h,a;if(y===e)return!0;if(y.dimension>e.dimension)return!1;for(;p=r.next(),!p.done;)if(h=p.value[0],a=p.value[1],e.multiplicity(h){var i=Vr(),x=zn();function T(l,n,u){return((Math.pow(l,2)-Math.pow(Math.abs(n-u),2))/2|0)+l+1}function E(l,n){for(var u=0,f=0,o=n+1;fn.length?-1:l.lengthn?1:0}function y(l,n){var u=l+1,f=n/u|0,o=f+1,c,d,v=n-f*u,m=u-v,S=new Array(l+1);for(c=0;c 0");this.levenshtein=l,this.k=n,this.clear()}a.prototype.clear=function(){this.size=0,this.strings=[],this.invertedIndices={}},a.prototype.add=function(l){var n=l.length,u=this.size;this.strings.push(l),this.size++;var f=e(this.k,l),o=this.invertedIndices[n];typeof o>"u"&&(o={},this.invertedIndices[n]=o);var c,d,v,m,S;for(m=0,S=f.length;m"u"?(d=[u],o[v]=d):d.push(u);return this},a.prototype.search=function(l){var n=l.length,u=this.k,f=new Set,o,c,d,v,m,S,M,w,C,A,P,b,O,I,D;for(w=Math.max(0,n-u),C=n+u+1;w1?n:this;for(var u=0,f=this.strings.length;u=n)return{done:!0};var f=l[u];return u++,{value:f,done:!1}})},typeof Symbol<"u"&&(a.prototype[Symbol.iterator]=a.prototype.values),a.prototype.inspect=function(){var l=this.strings.slice();return Object.defineProperty(l,"constructor",{value:a,enumerable:!1}),l},typeof Symbol<"u"&&(a.prototype[Symbol.for("nodejs.util.inspect.custom")]=a.prototype.inspect),a.from=function(l,n,u){var f=new a(n,u);return x(l,function(o){f.add(o)}),f},a.countKeys=E,a.comparator=s,a.partition=y,a.segments=e,a.segmentPos=r,a.multiMatchAwareInterval=p,a.multiMatchAwareSubstrings=h,t.exports=a}),sO=si((g,t)=>{var i=Vr(),x=zn();function T(){this.clear()}T.prototype.clear=function(){this.items=[],this.offset=0,this.size=0},T.prototype.enqueue=function(E){return this.items.push(E),++this.size},T.prototype.dequeue=function(){if(this.size){var E=this.items[this.offset];return++this.offset*2>=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,E}},T.prototype.peek=function(){if(this.size)return this.items[this.offset]},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;for(var y=this.offset,e=0,r=this.items.length;y=E.length)return{done:!0};var y=E[s];return s++,{value:y,done:!1}})},T.prototype.entries=function(){var E=this.items,s=this.offset,y=0;return new i(function(){if(s>=E.length)return{done:!0};var e=E[s];return s++,{value:[y++,e],done:!1}})},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.values),T.prototype.toString=function(){return this.toArray().join(",")},T.prototype.toJSON=function(){return this.toArray()},T.prototype.inspect=function(){var E=this.toArray();return Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),T.from=function(E){var s=new T;return x(E,function(y){s.enqueue(y)}),s},T.of=function(){return T.from(arguments)},t.exports=T}),aO=si((g,t)=>{var i=Vr(),x=zn();function T(){this.clear()}T.prototype.clear=function(){this.items=[],this.size=0},T.prototype.push=function(E){return this.items.push(E),++this.size},T.prototype.pop=function(){if(this.size!==0)return this.size--,this.items.pop()},T.prototype.peek=function(){return this.items[this.size-1]},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;for(var y=0,e=this.items.length;y=s)return{done:!0};var e=E[s-y-1];return y++,{value:e,done:!1}})},T.prototype.entries=function(){var E=this.items,s=E.length,y=0;return new i(function(){if(y>=s)return{done:!0};var e=E[s-y-1];return{value:[y++,e],done:!1}})},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.values),T.prototype.toString=function(){return this.toArray().join(",")},T.prototype.toJSON=function(){return this.toArray()},T.prototype.inspect=function(){var E=this.toArray();return Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),T.from=function(E){var s=new T;return x(E,function(y){s.push(y)}),s},T.of=function(){return T.from(arguments)},t.exports=T}),oO=si(g=>{g.intersection=function(){if(arguments.length<2)throw new Error("mnemonist/Set.intersection: needs at least two arguments.");var t=new Set,i=1/0,x=null,T,E,s=arguments.length;for(E=0;Ei.size)return!1;for(;T=x.next(),!T.done;)if(!i.has(T.value))return!1;return!0},g.isSuperset=function(t,i){return g.isSubset(i,t)},g.add=function(t,i){for(var x=i.values(),T;T=x.next(),!T.done;)t.add(T.value)},g.subtract=function(t,i){for(var x=i.values(),T;T=x.next(),!T.done;)t.delete(T.value)},g.intersect=function(t,i){for(var x=t.values(),T;T=x.next(),!T.done;)i.has(T.value)||t.delete(T.value)},g.disjunct=function(t,i){for(var x=t.values(),T,E=[];T=x.next(),!T.done;)i.has(T.value)&&E.push(T.value);for(x=i.values();T=x.next(),!T.done;)t.has(T.value)||t.add(T.value);for(var s=0,y=E.length;si.size&&(x=t,t=i,i=x),t.size===0)return 0;if(t===i)return t.size;for(var T=t.values(),E,s=0;E=T.next(),!E.done;)i.has(E.value)&&s++;return s},g.unionSize=function(t,i){var x=g.intersectionSize(t,i);return t.size+i.size-x},g.jaccard=function(t,i){var x=g.intersectionSize(t,i);if(x===0)return 0;var T=t.size+i.size-x;return x/T},g.overlap=function(t,i){var x=g.intersectionSize(t,i);return x===0?0:x/Math.min(t.size,i.size)}}),lO=si((g,t)=>{var i=Vr(),x=Is().getPointerArray;function T(E){var s=x(E);this.start=0,this.size=0,this.capacity=E,this.dense=new s(E),this.sparse=new s(E)}T.prototype.clear=function(){this.start=0,this.size=0},T.prototype.has=function(E){if(this.size===0)return!1;var s=this.sparse[E],y=s=this.start&&s=this.start&&s1?s:this;for(var y=this.capacity,e=this.size,r=this.start,p=0;p=y)return{done:!0};var p=E[e];return e++,r++,e===s&&(e=0),{value:p,done:!1}})},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.values),T.prototype.inspect=function(){var E=[];return this.forEach(function(s){E.push(s)}),Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E.capacity=this.capacity,E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),t.exports=T}),hO=si((g,t)=>{var i=Vr(),x=Is().getPointerArray;function T(E,s){arguments.length<2&&(s=E,E=Array);var y=x(s);this.size=0,this.length=s,this.dense=new y(s),this.sparse=new y(s),this.vals=new E(s)}T.prototype.clear=function(){this.size=0},T.prototype.has=function(E){var s=this.sparse[E];return s=this.size||this.dense[s]!==E?!1:(s=this.dense[this.size-1],this.dense[this.sparse[E]]=s,this.sparse[s]=this.sparse[E],this.size--,!0)},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;for(var y=0;y{var i=Vr(),x=Is().getPointerArray;function T(E){var s=x(E);this.size=0,this.length=E,this.dense=new s(E),this.sparse=new s(E)}T.prototype.clear=function(){this.size=0},T.prototype.has=function(E){var s=this.sparse[E];return s=this.size||this.dense[s]!==E?!1:(s=this.dense[this.size-1],this.dense[this.sparse[E]]=s,this.sparse[s]=this.sparse[E],this.size--,!0)},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;for(var y,e=0;e{var i=zn(),x=2,T=2,E=new Set([0,1,2]),s={0:"Returns only the top suggestion",1:"Returns suggestions with the smallest edit distance",2:"Returns every suggestion (no early termination)"};function y(n){var u=new Set;return typeof n=="number"&&u.add(n),{suggestions:u,count:0}}function e(n,u,f){return{term:n||"",distance:u||0,count:f||0}}function r(n,u,f,o){o=o||new Set,u++;var c,d=n.length,v;if(d>1)for(v=0;v0&&n[v].length-d.length>o.length-d.length&&(f.suggestions=new Set,f.count=0),(u===2||!f.suggestions.size||n[v].length-d.length>=o.length-d.length)&&f.suggestions.add(c)}function h(n,u){var f=n.length,o=u.length,c=[[]],d=f+o,v=new Map,m,S,M;for(c[0][0]=d,m=0;m<=f;m++)c[m+1]||(c[m+1]=[]),c[m+1][1]=m,c[m+1][0]=d;for(M=0;M<=o;M++)c[1][M+1]=M,c[0][M+1]=d;var w=n+u,C;for(m=0,S=w.length;mc)return[];for(var m=[d],S=new Set,M=new Set,w=[],C,A;m.length>0&&(C=m.shift(),!(f<2&&w.length>0&&v-C.length>w[0].distance));){if(A=n[C],A!==void 0){if(typeof A=="number"&&(A=y(A)),A.count>0&&!M.has(C)){M.add(C);var P=e(C,v-C.length,A.count);if(w.push(P),f<2&&v-C.length===0)break}A.suggestions.forEach(D=>{var B=u[D];if(!M.has(B)){M.add(B);var G=0;if(d!==B)if(B.length===C.length)G=v-C.length;else if(v===C.length)G=B.length-C.length;else{for(var z=0,X=0,K=B.length;z0||X>0?G=h(B.substr(z,K-z-X),d.substr(z,v-z-X)):G=h(B,d)}if(f<2&&w.length>0&&w[0].distance>G&&(w=[]),!(f<2&&w.length>0&&G>w[0].distance)&&G<=o){var Q=n[B];Q!==void 0&&w.push(e(B,G,Q.count))}}})}if(v-C.length0&&v-C.length>=w[0].distance)continue;for(var b=0,O=C.length;bthis.maxLength&&(this.maxLength=n.length)),u.count===1){var f=this.words.length;this.words.push(n);var o=r(n,0,this.maxDistance);o.forEach(c=>{var d=this.dictionary[c];d!==void 0?(typeof d=="number"&&(d=y(d),this.dictionary[c]=d),d.suggestions.has(f)||p(this.words,this.verbosity,d,n,f,c)):this.dictionary[c]=f})}return this.size++,this},l.prototype.search=function(n){return a(this.dictionary,this.words,this.verbosity,this.maxDistance,this.maxLength,n)},l.prototype.inspect=function(){var n=[];n.size=this.size,n.maxDistance=this.maxDistance,n.verbosity=this.verbosity,n.behavior=s[this.verbosity];for(var u in this.dictionary)typeof this.dictionary[u]=="object"&&this.dictionary[u].count&&n.push([u,this.dictionary[u].count]);return Object.defineProperty(n,"constructor",{value:l,enumerable:!1}),n},typeof Symbol<"u"&&(l.prototype[Symbol.for("nodejs.util.inspect.custom")]=l.prototype.inspect),l.from=function(n,u){var f=new l(u);return i(n,function(o){f.add(o)}),f},t.exports=l}),jM=si((g,t)=>{var i=zn(),x=Vr(),T="\0";function E(s){this.mode=s===Array?"array":"string",this.clear()}E.prototype.clear=function(){this.root={},this.size=0},E.prototype.set=function(s,y){for(var e=this.root,r,p=0,h=s.length;p"u")return;if(T in y)return y[T]},E.prototype.delete=function(s){var y=this.root,e=null,r=null,p,h,a,l;for(a=0,l=s.length;a"u")return!1;e!==null?Object.keys(y).length>1&&(e=null,r=null):Object.keys(y).length<2&&(e=p,r=h)}return T in y?(this.size--,e?delete e[r]:delete y[T],!0):!1},E.prototype.has=function(s){for(var y=this.root,e,r=0,p=s.length;r"u")return!1;return T in y},E.prototype.find=function(s){var y=typeof s=="string",e=this.root,r=[],p,h,a;for(h=0,a=s.length;h"u")return r;for(var l=[e],n=[s],u;l.length;){s=n.pop(),e=l.pop();for(u in e){if(u===T){r.push([s,e[T]]);continue}l.push(e[u]),n.push(y?s+u:s.concat(u))}}return r},E.prototype.values=function(s){var y=this.root,e=[],r,p,h;if(s){for(p=0,h=s.length;p"u")return x.empty()}return e.push(y),new x(function(){for(var a,l=!1,n;e.length;){a=e.pop();for(n in a){if(n===T){l=!0;continue}e.push(a[n])}if(l)return{done:!1,value:a[T]}}return{done:!0}})},E.prototype.prefixes=function(s){var y=this.root,e=[],r=[],p,h,a,l=this.mode==="string";if(s){for(h=0,a=s.length;h"u")return x.empty()}else s=l?"":[];return e.push(y),r.push(s),new x(function(){for(var n,u,f=!1,o;e.length;){n=e.pop(),u=r.pop();for(o in n){if(o===T){f=!0;continue}e.push(n[o]),r.push(l?u+o:u.concat(o))}if(f)return{done:!1,value:u}}return{done:!0}})},E.prototype.keys=E.prototype.prefixes,E.prototype.entries=function(s){var y=this.root,e=[],r=[],p,h,a,l=this.mode==="string";if(s){for(h=0,a=s.length;h"u")return x.empty()}else s=l?"":[];return e.push(y),r.push(s),new x(function(){for(var n,u,f=!1,o;e.length;){n=e.pop(),u=r.pop();for(o in n){if(o===T){f=!0;continue}e.push(n[o]),r.push(l?u+o:u.concat(o))}if(f)return{done:!1,value:[u,n[T]]}}return{done:!0}})},typeof Symbol<"u"&&(E.prototype[Symbol.iterator]=E.prototype.entries),E.prototype.inspect=function(){for(var s=new Array(this.size),y=this.entries(),e,r=0;e=y.next(),!e.done;)s[r++]=e.value;return Object.defineProperty(s,"constructor",{value:E,enumerable:!1}),s},typeof Symbol<"u"&&(E.prototype[Symbol.for("nodejs.util.inspect.custom")]=E.prototype.inspect),E.prototype.toJSON=function(){return this.root},E.from=function(s){var y=new E;return i(s,function(e,r){y.set(r,e)}),y},E.SENTINEL=T,t.exports=E}),cO=si((g,t)=>{var i=zn(),x=jM(),T="\0";function E(y){this.mode=y===Array?"array":"string",this.clear()}for(s in x.prototype)E.prototype[s]=x.prototype[s];var s;delete E.prototype.set,delete E.prototype.get,delete E.prototype.values,delete E.prototype.entries,E.prototype.add=function(y){for(var e=this.root,r,p=0,h=y.length;p"u")return p;for(var n=[r],u=[y],f;n.length;){y=u.pop(),r=n.pop();for(f in r){if(f===T){p.push(y);continue}n.push(r[f]),u.push(e?y+f:y.concat(f))}}return p},typeof Symbol<"u"&&(E.prototype[Symbol.iterator]=E.prototype.keys),E.prototype.inspect=function(){for(var y=new Set,e=this.keys(),r;r=e.next(),!r.done;)y.add(r.value);return Object.defineProperty(y,"constructor",{value:E,enumerable:!1}),y},typeof Symbol<"u"&&(E.prototype[Symbol.for("nodejs.util.inspect.custom")]=E.prototype.inspect),E.prototype.toJSON=function(){return this.root},E.from=function(y){var e=new E;return i(y,function(r){e.add(r)}),e},E.SENTINEL=T,t.exports=E}),dO=si((g,t)=>{var i=Vr(),x=zn(),T=sa(),E=Is(),s=function(p){return Math.max(1,Math.ceil(p*1.5))},y=function(p){var h=E.getPointerArray(p);return new h(p)};function e(p,h){if(arguments.length<1)throw new Error("mnemonist/vector: expecting at least a byte array constructor.");var a=h||0,l=s,n=0,u=!1;typeof h=="object"&&(a=h.initialCapacity||0,n=h.initialLength||0,l=h.policy||l,u=h.factory===!0),this.factory=u?p:null,this.ArrayClass=p,this.length=n,this.capacity=Math.max(n,a),this.policy=l,this.array=new p(this.capacity)}e.prototype.set=function(p,h){if(this.lengththis.capacity)if(this.factory===null?this.array=new this.ArrayClass(p):this.array=this.factory(p),E.isTypedArray(this.array))this.array.set(h,0);else for(var a=0,l=this.length;a=p)return this;for(h=this.capacity;h=h)return{done:!0};var l=p[a];return a++,{value:l,done:!1}})},e.prototype.entries=function(){var p=this.array,h=this.length,a=0;return new i(function(){if(a>=h)return{done:!0};var l=p[a];return{value:[a++,l],done:!1}})},typeof Symbol<"u"&&(e.prototype[Symbol.iterator]=e.prototype.values),e.prototype.inspect=function(){var p=this.array.slice(0,this.length);return p.type=this.array.constructor.name,p.items=this.length,p.capacity=this.capacity,Object.defineProperty(p,"constructor",{value:e,enumerable:!1}),p},typeof Symbol<"u"&&(e.prototype[Symbol.for("nodejs.util.inspect.custom")]=e.prototype.inspect),e.from=function(p,h,a){if(arguments.length<3&&(a=T.guessLength(p),typeof a!="number"))throw new Error("mnemonist/vector.from: could not guess iterable length. Please provide desired capacity as last argument.");var l=new e(h,a);return x(p,function(n){l.push(n)}),l};function r(p){var h=function(l){e.call(this,p,l)};for(var a in e.prototype)e.prototype.hasOwnProperty(a)&&(h.prototype[a]=e.prototype[a]);return h.from=function(l,n){return e.from(l,p,n)},typeof Symbol<"u"&&(h.prototype[Symbol.iterator]=h.prototype.values),h}e.Int8Vector=r(Int8Array),e.Uint8Vector=r(Uint8Array),e.Uint8ClampedVector=r(Uint8ClampedArray),e.Int16Vector=r(Int16Array),e.Uint16Vector=r(Uint16Array),e.Int32Vector=r(Int32Array),e.Uint32Vector=r(Uint32Array),e.Float32Vector=r(Float32Array),e.Float64Vector=r(Float64Array),e.PointerVector=r(y),t.exports=e}),pO=si((g,t)=>{var i=sa(),x=Is(),T=kM().inplaceQuickSortIndices,E=YM().lowerBoundIndices,s=Hx(),y=x.getPointerArray;function e(h,a){return h.distancea.distance?-1:0}function r(h,a,l){for(var n=l.length,u=y(n),f=0,o=new u(n),c=new u(n),d=new u(n),v=new Float64Array(n),m=[0,0,n],S=new Float64Array(n),M,w,C,A,P,b,O,I,D;m.length;)if(P=m.pop(),A=m.pop(),M=m.pop(),w=l[P-1],P--,D=P-A,o[M]=w,D!==0){if(D===1){O=h(a[w],a[l[A]]),v[M]=O,f++,d[M]=f,o[f]=l[A];continue}for(I=A;I0&&(f++,d[M]=f,m.push(f,b,P)),b-A>0&&(f++,c[M]=f,m.push(f,A,b))}return{nodes:o,lefts:c,rights:d,mus:v}}function p(h,a){if(typeof h!="function")throw new Error("mnemonist/VPTree.constructor: given `distance` must be a function.");if(!a)throw new Error("mnemonist/VPTree.constructor: you must provide items to the tree. A VPTree cannot be updated after its creation.");this.distance=h,this.heap=new s(e),this.D=0;var l=i.toArrayWithIndices(a);this.items=l[0];var n=l[1];this.size=n.length;var u=r(h,this.items,n);this.nodes=u.nodes,this.lefts=u.lefts,this.rights=u.rights,this.mus=u.mus}p.prototype.nearestNeighbors=function(h,a){var l=this.heap,n=[0],u=1/0,f,o,c,d,v,m,S;for(this.D=0;n.length;)f=n.pop(),o=this.nodes[f],c=this.items[o],S=this.distance(c,a),this.D++,Sh&&l.pop(),l.size>=h&&(u=l.peek().distance)),d=this.lefts[f],v=this.rights[f],!(!d&&!v)&&(m=this.mus[f],S=m-u&&n.push(v)):(v&&S>=m-u&&n.push(v),d&&S=0;w--)M[w]=l.pop();return M},p.prototype.neighbors=function(h,a){var l=[],n=[0],u,f,o,c,d,v,m;for(this.D=0;n.length;)u=n.pop(),f=this.nodes[u],o=this.items[f],m=this.distance(o,a),this.D++,m<=h&&l.push({distance:m,item:o}),c=this.lefts[u],d=this.rights[u],!(!c&&!d)&&(v=this.mus[u],m=v-h&&n.push(d)):(d&&m>=v-h&&n.push(d),c&&m{var i=Hx(),x=Vx(),T=BF();t.exports={BiMap:UF(),BitSet:zF(),BitVector:GF(),BloomFilter:HF(),BKTree:WF(),CircularBuffer:XF(),DefaultMap:YF(),DefaultWeakMap:kF(),FixedDeque:HM(),StaticDisjointSet:KF(),FibonacciHeap:x,MinFibonacciHeap:x.MinFibonacciHeap,MaxFibonacciHeap:x.MaxFibonacciHeap,FixedReverseHeap:Wx(),FuzzyMap:jF(),FuzzyMultiMap:ZF(),HashedArrayTree:JF(),Heap:i,MinHeap:i.MinHeap,MaxHeap:i.MaxHeap,StaticIntervalTree:$F(),InvertedIndex:_F(),KDTree:qF(),LinkedList:tO(),LRUCache:Xx(),LRUCacheWithDelete:eO(),LRUMap:KM(),LRUMapWithDelete:iO(),MultiMap:WM(),MultiSet:nO(),PassjoinIndex:rO(),Queue:sO(),FixedStack:XM(),Stack:aO(),SuffixArray:T,GeneralizedSuffixArray:T.GeneralizedSuffixArray,Set:oO(),SparseQueueSet:lO(),SparseMap:hO(),SparseSet:uO(),SymSpell:fO(),Trie:cO(),TrieMap:jM(),Vector:dO(),VPTree:pO()}}),Qt=class fr{static get ZERO(){return new fr(0,0)}static get ONE(){return new fr(1,1)}static get UP(){return new fr(0,-1)}static get DOWN(){return new fr(0,1)}static get LEFT(){return new fr(-1,0)}static get RIGHT(){return new fr(1,0)}static get UP_LEFT(){return new fr(-1,-1)}static get UP_RIGHT(){return new fr(1,-1)}static get DOWN_RIGHT(){return new fr(1,1)}static get DOWN_LEFT(){return new fr(-1,1)}constructor(t,i){typeof t=="number"?(this.x=t,this.y=i||0):(this.x=t.x,this.y=t.y)}clone(){return new fr(this.x,this.y)}add(t){return new fr(this.x+t.x,this.y+t.y)}multiply(t){return new fr(this.x*t.x,this.y*t.y)}divide(t){return new fr(this.x/t.x,this.y/t.y)}subtract(t){return new fr(this.x-t.x,this.y-t.y)}equals(t){return this.x===t.x&&this.y===t.y}abs(){return new fr(Math.abs(this.x),Math.abs(this.y))}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}modulo(t){return new fr(this.x%t.x,this.y%t.y)}scalarModulo(t){return new fr(this.x%t,this.y%t)}scalarMult(t){return new fr(this.x*t,this.y*t)}toPosition(){return{x:this.x,y:this.y}}toString(){return`${this.x}#${this.y}`}},Ai=class{static equal(g,t){return g.position.x===t.position.x&&g.position.y===t.position.y&&g.layer===t.layer}static copyOver(g,t){t.position.x=g.position.x,t.position.y=g.position.y,t.layer=g.layer}static clone(g){return{position:g.position.clone(),layer:g.layer}}static toString(g){return`${g.position.toString()}#${g.layer}`}static toInternal(g){return{position:new Qt(g.position.x,g.position.y),layer:g.charLayer}}static fromInternal(g){return{position:g.position.toPosition(),charLayer:g.layer}}},mO=(g=>(g.NONE="none",g.LEFT="left",g.UP_LEFT="up-left",g.UP="up",g.UP_RIGHT="up-right",g.RIGHT="right",g.DOWN_RIGHT="down-right",g.DOWN="down",g.DOWN_LEFT="down-left",g))(mO||{}),gO={up:"down",down:"up",left:"right",right:"left",none:"none","up-left":"down-right","up-right":"down-left","down-right":"up-left","down-left":"up-right"},yO={up:Qt.UP,down:Qt.DOWN,left:Qt.LEFT,right:Qt.RIGHT,none:Qt.ZERO,"up-left":Qt.UP_LEFT,"up-right":Qt.UP_RIGHT,"down-right":Qt.DOWN_RIGHT,"down-left":Qt.DOWN_LEFT},pm={up:0,"up-right":1,right:2,"down-right":3,down:4,"down-left":5,left:6,"up-left":7,none:NaN},ZM=["up","up-right","right","down-right","down","down-left","left","up-left"],xO=["down-left","down-right","up-right","up-left"];function Yx(){return["up","down","left","right","none","up-left","up-right","down-right","down-left"]}function ad(g){return xO.includes(g)}function SO(g,t=1){return g==="none"?"none":ZM[(pm[g]+8-Math.abs(t)%8)%8]}function JM(g,t=1){return g==="none"?"none":ZM[(pm[g]+t)%8]}function Cu(g){return yO[g]}function TO(g){return gO[g]}function Ma(g,t){if(g.x===t.x){if(g.y>t.y)return"up";if(g.yt.x)return"left";if(g.xt.x){if(g.yt.y)return"up-left"}else if(g.xt.y)return"up-right"}return"none"}var EO=(g=>(g[g.FOUR=4]="FOUR",g[g.EIGHT=8]="EIGHT",g))(EO||{});function If(g){return typeof g=="string"&&Yx().includes(g)}var Sy=function(g,t){return Sy=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,x){i.__proto__=x}||function(i,x){for(var T in x)Object.prototype.hasOwnProperty.call(x,T)&&(i[T]=x[T])},Sy(g,t)};function Yd(g,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Sy(g,t);function i(){this.constructor=g}g.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}function MO(g,t,i,x){function T(E){return E instanceof i?E:new i(function(s){s(E)})}return new(i||(i=Promise))(function(E,s){function y(p){try{r(x.next(p))}catch(h){s(h)}}function e(p){try{r(x.throw(p))}catch(h){s(h)}}function r(p){p.done?E(p.value):T(p.value).then(y,e)}r((x=x.apply(g,t||[])).next())})}function $M(g,t){var i={label:0,sent:function(){if(E[0]&1)throw E[1];return E[1]},trys:[],ops:[]},x,T,E,s;return s={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function y(r){return function(p){return e([r,p])}}function e(r){if(x)throw new TypeError("Generator is already executing.");for(;s&&(s=0,r[0]&&(i=0)),i;)try{if(x=1,T&&(E=r[0]&2?T.return:r[0]?T.throw||((E=T.return)&&E.call(T),0):T.next)&&!(E=E.call(T,r[1])).done)return E;switch(T=0,E&&(r=[r[0]&2,E.value]),r[0]){case 0:case 1:E=r;break;case 4:return i.label++,{value:r[1],done:!1};case 5:i.label++,T=r[1],r=[0];continue;case 7:r=i.ops.pop(),i.trys.pop();continue;default:if(E=i.trys,!(E=E.length>0&&E[E.length-1])&&(r[0]===6||r[0]===2)){i=0;continue}if(r[0]===3&&(!E||r[1]>E[0]&&r[1]=g.length&&(g=void 0),{value:g&&g[x++],done:!g}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vd(g,t){var i=typeof Symbol=="function"&&g[Symbol.iterator];if(!i)return g;var x=i.call(g),T,E=[],s;try{for(;(t===void 0||t-- >0)&&!(T=x.next()).done;)E.push(T.value)}catch(y){s={error:y}}finally{try{T&&!T.done&&(i=x.return)&&i.call(x)}finally{if(s)throw s.error}}return E}function md(g,t,i){if(i||arguments.length===2)for(var x=0,T=t.length,E;x1||y(a,l)})})}function y(a,l){try{e(x[a](l))}catch(n){h(E[0][3],n)}}function e(a){a.value instanceof Wf?Promise.resolve(a.value.v).then(r,p):h(E[0][2],a)}function r(a){y("next",a)}function p(a){y("throw",a)}function h(a,l){a(l),E.shift(),E.length&&y(E[0][0],E[0][1])}}function wO(g){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=g[Symbol.asyncIterator],i;return t?t.call(g):(g=typeof Kf=="function"?Kf(g):g[Symbol.iterator](),i={},x("next"),x("throw"),x("return"),i[Symbol.asyncIterator]=function(){return this},i);function x(E){i[E]=g[E]&&function(s){return new Promise(function(y,e){s=g[E](s),T(y,e,s.done,s.value)})}}function T(E,s,y,e){Promise.resolve(e).then(function(r){E({value:r,done:y})},s)}}function mr(g){return typeof g=="function"}function QM(g){var t=function(x){Error.call(x),x.stack=new Error().stack},i=g(t);return i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i}var f0=QM(function(g){return function(t){g(this),this.message=t?t.length+` errors occurred during unsubscription: + */s.exports={Format:e(27902),Pad:e(41836),RemoveAt:e(33628),Reverse:e(27671),UppercaseFirst:e(35355),UUID:e(45650)}}},x={};function T(s){var y=x[s];if(y!==void 0)return y.exports;var e=x[s]={exports:{}};return i[s](e,e.exports,T),e.exports}T.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}();var E=T(85454);return E})())})(zM);var Jm=zM.exports;const sd=Xd(Jm);var bF=Object.create,Gx=Object.defineProperty,LF=Object.defineProperties,FF=Object.getOwnPropertyDescriptor,OF=Object.getOwnPropertyDescriptors,DF=Object.getOwnPropertyNames,ZS=Object.getOwnPropertySymbols,IF=Object.getPrototypeOf,GM=Object.prototype.hasOwnProperty,NF=Object.prototype.propertyIsEnumerable,JS=(g,t,i)=>t in g?Gx(g,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):g[t]=i,An=(g,t)=>{for(var i in t||(t={}))GM.call(t,i)&&JS(g,i,t[i]);if(ZS)for(var i of ZS(t))NF.call(t,i)&&JS(g,i,t[i]);return g},dh=(g,t)=>LF(g,OF(t)),si=(g,t)=>()=>(t||g((t={exports:{}}).exports,t),t.exports),BF=(g,t,i,x)=>{if(t&&typeof t=="object"||typeof t=="function")for(let T of DF(t))!GM.call(g,T)&&T!==i&&Gx(g,T,{get:()=>t[T],enumerable:!(x=FF(t,T))||x.enumerable});return g},VM=(g,t,i)=>(i=g!=null?bF(IF(g)):{},BF(t||!g||!g.__esModule?Gx(i,"default",{value:g,enumerable:!0}):i,g)),$m=si(g=>{var t=function(E,s){return Es?1:0},i=function(E,s){return Es?-1:0};function x(E){return function(s,y){return E(y,s)}}function T(E){return E===2?function(s,y){return s[0]y[0]?1:s[1]y[1]?1:0}:function(s,y){for(var e=0;ey[e])return 1;e++}return 0}}g.DEFAULT_COMPARATOR=t,g.DEFAULT_REVERSE_COMPARATOR=i,g.reverseComparator=x,g.createTupleComparator=T}),UF=si(g=>{g.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",g.SYMBOL_SUPPORT=typeof Symbol<"u"}),zn=si((g,t)=>{var i=UF(),x=i.ARRAY_BUFFER_SUPPORT,T=i.SYMBOL_SUPPORT;t.exports=function(E,s){var y,e,r,p,h;if(!E)throw new Error("obliterator/forEach: invalid iterable.");if(typeof s!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(E)||x&&ArrayBuffer.isView(E)||typeof E=="string"||E.toString()==="[object Arguments]"){for(r=0,p=E.length;r{var i=$m(),x=zn(),T=i.DEFAULT_COMPARATOR,E=i.reverseComparator;function s(u){if(this.clear(),this.comparator=u||T,typeof this.comparator!="function")throw new Error("mnemonist/FibonacciHeap.constructor: given comparator should be a function.")}s.prototype.clear=function(){this.root=null,this.min=null,this.size=0};function y(u){return{item:u,degree:0}}function e(u,f){u.root?(f.right=u.root.right,f.left=u.root,u.root.right.left=f,u.root.right=f):u.root=f}s.prototype.push=function(u){var f=y(u);return f.left=f,f.right=f,e(this,f),(!this.min||this.comparator(f.item,this.min.item)<=0)&&(this.min=f),++this.size},s.prototype.peek=function(){return this.min?this.min.item:void 0};function r(u){for(var f=[],o=u,c=!1;!(o===u&&c);)o===u&&(c=!0),f.push(o),o=o.right;return f}function p(u,f){u.root===f&&(u.root=f.right),f.left.right=f.right,f.right.left=f.left}function h(u,f){u.child?(f.right=u.child.right,f.left=u.child,u.child.right.left=f,u.child.right=f):u.child=f}function a(u,f,o){p(u,f),f.left=f,f.right=f,h(o,f),o.degree++,f.parent=o}function l(u){var f=new Array(u.size),o=r(u.root),c,d,v,m,S,M;for(c=0,d=o.length;c0&&(M=v,v=m,m=M),a(u,m,v),f[S]=null,S++;f[S]=v}for(c=0;c{var t=Math.pow(2,8)-1,i=Math.pow(2,16)-1,x=Math.pow(2,32)-1,T=Math.pow(2,7)-1,E=Math.pow(2,15)-1,s=Math.pow(2,31)-1;g.getPointerArray=function(e){var r=e-1;if(r<=t)return Uint8Array;if(r<=i)return Uint16Array;if(r<=x)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},g.getSignedPointerArray=function(e){var r=e-1;return r<=T?Int8Array:r<=E?Int16Array:r<=s?Int32Array:Float64Array},g.getNumberType=function(e){return e===(e|0)?Math.sign(e)===-1?e<=127&&e>=-128?Int8Array:e<=32767&&e>=-32768?Int16Array:Int32Array:e<=255?Uint8Array:e<=65535?Uint16Array:Uint32Array:Float64Array};var y={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};g.getMinimalRepresentation=function(e,r){var p=null,h=0,a,l,n,u,f;for(u=0,f=e.length;uh&&(h=a,p=l);return p},g.isTypedArray=function(e){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(e)},g.concat=function(){var e=0,r,p,h;for(r=0,h=arguments.length;r{var t=zn(),i=Is();function x(y){return Array.isArray(y)||i.isTypedArray(y)}function T(y){if(typeof y.length=="number")return y.length;if(typeof y.size=="number")return y.size}function E(y){var e=T(y),r=typeof e=="number"?new Array(e):[],p=0;return t(y,function(h){r[p++]=h}),r}function s(y){var e=T(y),r=typeof e=="number"?i.getPointerArray(e):Array,p=typeof e=="number"?new Array(e):[],h=typeof e=="number"?new r(e):[],a=0;return t(y,function(l){p[a]=l,h[a]=a++}),[p,h]}g.isArrayLike=x,g.guessLength=T,g.toArray=E,g.toArrayWithIndices=s}),Hx=si((g,t)=>{var i=zn(),x=$m(),T=sa(),E=x.DEFAULT_COMPARATOR,s=x.reverseComparator;function y(d,v,m,S){for(var M=v[S],w,C;S>m;){if(w=S-1>>1,C=v[w],d(M,C)<0){v[S]=C,S=w;continue}break}v[S]=M}function e(d,v,m){for(var S=v.length,M=m,w=v[m],C=2*m+1,A;C=0&&(C=A),v[m]=v[C],m=C,C=2*m+1;v[m]=w,y(d,v,M,m)}function r(d,v,m){v.push(m),y(d,v,0,v.length-1)}function p(d,v){var m=v.pop();if(v.length!==0){var S=v[0];return v[0]=m,e(d,v,0),S}return m}function h(d,v,m){if(v.length===0)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var S=v[0];return v[0]=m,e(d,v,0),S}function a(d,v,m){var S;return v.length!==0&&d(v[0],m)<0&&(S=v[0],v[0]=m,m=S,e(d,v,0)),m}function l(d,v){for(var m=v.length,S=m>>1,M=S;--M>=0;)e(d,v,M)}function n(d,v){for(var m=v.length,S=0,M=new Array(m);S=m.length)return m.slice().sort(d);for(P=m.slice(0,v),l(S,P),M=v,w=m.length;M0&&h(S,P,m[M]);return P.sort(d)}var b=T.guessLength(m);return b!==null&&b0&&h(S,P,O)),M++}),P.length>M&&(P.length=M),P.sort(d)}function f(d,v,m){arguments.length===2&&(m=v,v=d,d=E);var S=s(d),M,w,C,A=-1/0,P;if(v===1){if(T.isArrayLike(m)){for(M=0,w=m.length;M0)&&(A=C);return P=new m.constructor(1),P[0]=A,P}return i(m,function(O){(A===-1/0||d(O,A)>0)&&(A=O)}),[A]}if(T.isArrayLike(m)){if(v>=m.length)return m.slice().sort(S);for(P=m.slice(0,v),l(d,P),M=v,w=m.length;M0&&h(d,P,m[M]);return P.sort(S)}var b=T.guessLength(m);return b!==null&&b0&&h(d,P,O)),M++}),P.length>M&&(P.length=M),P.sort(S)}function o(d){if(this.clear(),this.comparator=d||E,typeof this.comparator!="function")throw new Error("mnemonist/Heap.constructor: given comparator should be a function.")}o.prototype.clear=function(){this.items=[],this.size=0},o.prototype.push=function(d){return r(this.comparator,this.items,d),++this.size},o.prototype.peek=function(){return this.items[0]},o.prototype.pop=function(){return this.size!==0&&this.size--,p(this.comparator,this.items)},o.prototype.replace=function(d){return h(this.comparator,this.items,d)},o.prototype.pushpop=function(d){return a(this.comparator,this.items,d)},o.prototype.consume=function(){return this.size=0,n(this.comparator,this.items)},o.prototype.toArray=function(){return n(this.comparator,this.items.slice())},o.prototype.inspect=function(){var d=this.toArray();return Object.defineProperty(d,"constructor",{value:o,enumerable:!1}),d},typeof Symbol<"u"&&(o.prototype[Symbol.for("nodejs.util.inspect.custom")]=o.prototype.inspect);function c(d){if(this.clear(),this.comparator=d||E,typeof this.comparator!="function")throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=s(this.comparator)}c.prototype=o.prototype,o.from=function(d,v){var m=new o(v),S;return T.isArrayLike(d)?S=d.slice():S=T.toArray(d),l(m.comparator,S),m.items=S,m.size=S.length,m},c.from=function(d,v){var m=new c(v),S;return T.isArrayLike(d)?S=d.slice():S=T.toArray(d),l(m.comparator,S),m.items=S,m.size=S.length,m},o.siftUp=e,o.siftDown=y,o.push=r,o.pop=p,o.replace=h,o.pushpop=a,o.heapify=l,o.consume=n,o.nsmallest=u,o.nlargest=f,o.MinHeap=o,o.MaxHeap=c,t.exports=o}),zF=si((g,t)=>{var i="";function x(r,p,h){for(var a=p.length,l=[],n=a,u=-1,f,o=0,c;n--;)u=Math.max(r[p[n]+h],u);for(c=u>>24&&32||u>>16&&24||u>>8&&16||8;o>o&15].push(p[n]);for(f=0;f<16;f++)for(u=l[f].length;u--;)p[++n]=l[f][u]}}function T(r,p,h,a){return r[h]-r[a]||(h%3===2?r[h+1]-r[a+1]||p[h+2]-p[a+2]:p[h+1]-p[a+1])}function E(r,p){var h=[],a=[],l=2*p/3|0,n=p-l,u=l+1>>1,f=l,o=0,c,d=[],v=[];if(p===1)return[0];for(;f--;)h[f]=(f*3>>1)+1;for(f=3;f--;)x(r,h,f);for(o=a[(h[0]/3|0)+(h[0]%3===1?0:u)]=1,f=1;fthis.firstLength&&n>this.firstLength)){for(p=Math.min(this.length-l,this.length-n),a=0;ar.length&&(r=this.text.slice(l,l+p))}return r},e.prototype.toString=function(){return this.array.join(",")},e.prototype.toJSON=function(){return this.array},e.prototype.inspect=function(){for(var r=new Array(this.length),p=0;p{var i=zn();function x(r){this.size=0,this.items=new Map,this.inverse=r}function T(){this.size=0,this.items=new Map,this.inverse=new x(this)}function E(){this.size=0,this.items.clear(),this.inverse.items.clear()}T.prototype.clear=E,x.prototype.clear=E;function s(r,p){if(this.items.has(r)){var h=this.items.get(r);if(h===p)return this;this.inverse.items.delete(h)}if(this.inverse.items.has(p)){var a=this.inverse.items.get(p);if(a===r)return this;this.items.delete(a)}return this.items.set(r,p),this.inverse.items.set(p,r),this.size=this.items.size,this.inverse.size=this.inverse.items.size,this}T.prototype.set=s,x.prototype.set=s;function y(r){if(this.items.has(r)){var p=this.items.get(r);return this.items.delete(r),this.inverse.items.delete(p),this.size=this.items.size,this.inverse.size=this.inverse.items.size,!0}return!1}T.prototype.delete=y,x.prototype.delete=y;var e=["has","get","forEach","keys","values","entries"];e.forEach(function(r){T.prototype[r]=x.prototype[r]=function(){return Map.prototype[r].apply(this.items,arguments)}}),typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.entries,x.prototype[Symbol.iterator]=x.prototype.entries),T.prototype.inspect=function(){var r={left:this.items,right:this.inverse.items};return Object.defineProperty(r,"constructor",{value:T,enumerable:!1}),r},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),x.prototype.inspect=function(){var r={left:this.inverse.items,right:this.items};return Object.defineProperty(r,"constructor",{value:x,enumerable:!1}),r},typeof Symbol<"u"&&(x.prototype[Symbol.for("nodejs.util.inspect.custom")]=x.prototype.inspect),T.from=function(r){var p=new T;return i(r,function(h,a){p.set(a,h)}),p},t.exports=T}),Vr=si((g,t)=>{function i(x){if(typeof x!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=x}typeof Symbol<"u"&&(i.prototype[Symbol.iterator]=function(){return this}),i.of=function(){var x=arguments,T=x.length,E=0;return new i(function(){return E>=T?{done:!0}:{done:!1,value:x[E++]}})},i.empty=function(){var x=new i(function(){return{done:!0}});return x},i.fromSequence=function(x){var T=0,E=x.length;return new i(function(){return T>=E?{done:!0}:{done:!1,value:x[T++]}})},i.is=function(x){return x instanceof i?!0:typeof x=="object"&&x!==null&&typeof x.next=="function"},t.exports=i}),HM=si(g=>{function t(s){return s|=s>>1,s|=s>>2,s|=s>>4,s|=s>>8,s|=s>>16,s&~(s>>1)}g.msb32=t;function i(s){return s|=s>>1,s|=s>>2,s|=s>>4,s&~(s>>1)}g.msb8=i,g.test=function(s,y){return s>>y&1},g.criticalBit8=function(s,y){return i(s^y)},g.criticalBit8Mask=function(s,y){return~i(s^y)>>>0&255},g.testCriticalBit8=function(s,y){return 1+(s|y)>>8},g.criticalBit32Mask=function(s,y){return~t(s^y)>>>0&4294967295},g.popcount=function(s){return s-=s>>1&1431655765,s=(s&858993459)+(s>>2&858993459),s=s+(s>>4)&252645135,s+=s>>8,s+=s>>16,s&127};var x=new Uint8Array(Math.pow(2,8));for(T=0,E=x.length;T>8&255]+x[s>>16&255]+x[s>>24&255]}}),VF=si((g,t)=>{var i=Vr(),x=HM();function T(E){this.length=E,this.clear()}T.prototype.clear=function(){this.size=0,this.array=new Uint32Array(Math.ceil(this.length/32))},T.prototype.set=function(E,s){var y=E>>5,e=E&31,r=this.array[y],p;return s===0||s===!1?p=this.array[y]&=~(1<>>0,p>r?this.size++:p>5,y=E&31,e=this.array[s],r;return r=this.array[s]&=~(1<>5,y=E&31,e=this.array[s],r=this.array[s]^=1<>>0,r>e?this.size++:r>5,y=E&31;return this.array[s]>>y&1},T.prototype.test=function(E){return!!this.get(E)},T.prototype.rank=function(E){if(this.size===0)return 0;for(var s=E>>5,y=E&31,e=0,r=0;r=this.length)return-1;for(var s,y=32,e=0,r=0,p=0,h=this.array.length;p>a&1,r===E)return e}},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;for(var y=this.length,e,r,p=32,h=0,a=this.array.length;h>l&1,E.call(s,r,h*32+l)}},T.prototype.values=function(){var E=this.length,s=!1,y,e,r=this.array,p=r.length,h=0,a=-1,l=32;return new i(function n(){if(!s){if(h>=p)return{done:!0};h===p-1&&(l=E%32||32),y=r[h++],s=!0,a=-1}return a++,a>=l?(s=!1,n()):(e=y>>a&1,{value:e})})},T.prototype.entries=function(){var E=this.length,s=!1,y,e,r=this.array,p,h=r.length,a=0,l=-1,n=32;return new i(function u(){if(!s){if(a>=h)return{done:!0};a===h-1&&(n=E%32||32),y=r[a++],s=!0,l=-1}return l++,p=~-a*32+l,l>=n?(s=!1,u()):(e=y>>l&1,{value:[p,e]})})},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.values),T.prototype.inspect=function(){var E=new Uint8Array(this.length);return this.forEach(function(s,y){E[y]=s}),Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),T.prototype.toJSON=function(){return Array.from(this.array)},t.exports=T}),HF=si((g,t)=>{var i=Vr(),x=HM(),T=function(y){return Math.max(1,Math.ceil(y*1.5))};function E(y){return new Uint32Array(Math.ceil(y/32))}function s(y){var e=y||0,r=T;typeof y=="object"&&(e=y.initialLength||y.initialCapacity||0,r=y.policy||r),this.size=0,this.length=e,this.capacity=Math.ceil(this.length/32)*32,this.policy=r,this.array=E(this.capacity)}s.prototype.set=function(y,e){if(this.length>5,p=y&31,h=this.array[r],a;return e===0||e===!1?a=this.array[r]&=~(1<>>0,a>h?this.size++:a>5,r=y&31,p=this.array[e],h;return h=this.array[e]&=~(1<>5,r=y&31,p=this.array[e],h=this.array[e]^=1<>>0,h>p?this.size++:hthis.array.length?(this.array=new Uint32Array(p),this.array.set(r,0)):this.array=r.slice(0,p),this.capacity=y,this)},s.prototype.grow=function(y){var e;if(typeof y=="number"){if(this.capacity>=y)return this;for(e=this.capacity;e>5,p=e&31;return this.array[r]|=1<>5,r=y&31;return this.array[e]>>r&1}},s.prototype.get=function(y){if(!(this.length>5,r=y&31;return this.array[e]>>r&1}},s.prototype.test=function(y){return this.length>5,r=y&31,p=0,h=0;h=this.length)return-1;for(var e,r=32,p=0,h=0,a=0,l=this.array.length;a>n&1,h===y)return p}},s.prototype.forEach=function(y,e){e=arguments.length>1?e:this;for(var r=this.length,p,h,a=32,l=0,n=this.array.length;l>u&1,y.call(e,h,l*32+u)}},s.prototype.values=function(){var y=this.length,e=!1,r,p,h=this.array,a=h.length,l=0,n=-1,u=32;return new i(function f(){if(!e){if(l>=a)return{done:!0};l===a-1&&(u=y%32||32),r=h[l++],e=!0,n=-1}return n++,n>=u?(e=!1,f()):(p=r>>n&1,{value:p})})},s.prototype.entries=function(){var y=this.length,e=!1,r,p,h=this.array,a,l=h.length,n=0,u=-1,f=32;return new i(function o(){if(!e){if(n>=l)return{done:!0};n===l-1&&(f=y%32||32),r=h[n++],e=!0,u=-1}return u++,a=~-n*32+u,u>=f?(e=!1,o()):(p=r>>u&1,{value:[a,p]})})},typeof Symbol<"u"&&(s.prototype[Symbol.iterator]=s.prototype.values),s.prototype.inspect=function(){var y=new Uint8Array(this.length);return this.forEach(function(e,r){y[r]=e}),Object.defineProperty(y,"constructor",{value:s,enumerable:!1}),y},typeof Symbol<"u"&&(s.prototype[Symbol.for("nodejs.util.inspect.custom")]=s.prototype.inspect),s.prototype.toJSON=function(){return Array.from(this.array.slice(0,(this.length>>5)+1))},t.exports=s}),WF=si((g,t)=>{function i(E,s){return(E&65535)*s+(((E>>>16)*s&65535)<<16)&4294967295}function x(E,s){return(E&65535)+(s>>>16)+(((E>>>16)+s&65535)<<16)&4294967295}function T(E,s){return E<>>32-s}t.exports=function(E,s){var y=3432918353,e=461845907,r=15,p=13,h=5,a=1801774676,l=E,n,u,f;for(u=0,f=s.length-4;u<=f;u+=4)n=s[u]|s[u+1]<<8|s[u+2]<<16|s[u+3]<<24,n=i(n,y),n=T(n,r),n=i(n,e),l^=n,l=T(l,p),l=i(l,h),l=x(l,a);switch(n=0,s.length&3){case 3:n^=s[u+2]<<16;case 2:n^=s[u+1]<<8;case 1:n^=s[u],n=i(n,y),n=T(n,r),n=i(n,e),l^=n}return l^=s.length,l^=l>>>16,l=i(l,2246822507),l^=l>>>13,l=i(l,3266489909),l^=l>>>16,l>>>0}}),XF=si((g,t)=>{var i=WF(),x=zn(),T=Math.LN2*Math.LN2,E={errorRate:.005};function s(r){var p=new Uint16Array(r.length),h,a;for(h=0,a=r.length;h>3]|=n}return this},e.prototype.test=function(r){for(var p=s(r),h=0,a=this.hashFunctions;h>3]&1<<(7&l)))return!1}return!0},e.prototype.toJSON=function(){return this.data},e.from=function(r,p){if(!p&&(p=r.length||r.size,typeof p!="number"))throw new Error("BloomFilter.from: could not infer the filter's capacity. Try passing it as second argument.");var h=new e(p);return x(r,function(a){h.add(a)}),h},t.exports=e}),YF=si((g,t)=>{var i=zn();function x(T){if(typeof T!="function")throw new Error("mnemonist/BKTree.constructor: given `distance` should be a function.");this.distance=T,this.clear()}x.prototype.add=function(T){if(!this.root)return this.root={item:T,children:{}},this.size++,this;for(var E=this.root,s;s=this.distance(T,E.item),!!E.children[s];)E=E.children[s];return E.children[s]={item:T,children:{}},this.size++,this},x.prototype.search=function(T,E){if(!this.root)return[];for(var s=[],y=[this.root],e,r,p,h,a;y.length;)for(e=y.pop(),p=this.distance(E,e.item),p<=T&&s.push({item:e.item,distance:p}),h=p-T,a=p+T+1;h{var i=sa(),x=Vr();function T(E,s){if(arguments.length<2)throw new Error("mnemonist/fixed-deque: expecting an Array class and a capacity.");if(typeof s!="number"||s<=0)throw new Error("mnemonist/fixed-deque: `capacity` should be a positive number.");this.ArrayClass=E,this.capacity=s,this.items=new E(this.capacity),this.clear()}T.prototype.clear=function(){this.start=0,this.size=0},T.prototype.push=function(E){if(this.size===this.capacity)throw new Error("mnemonist/fixed-deque.push: deque capacity ("+this.capacity+") exceeded!");var s=this.start+this.size;return s>=this.capacity&&(s-=this.capacity),this.items[s]=E,++this.size},T.prototype.unshift=function(E){if(this.size===this.capacity)throw new Error("mnemonist/fixed-deque.unshift: deque capacity ("+this.capacity+") exceeded!");var s=this.start-1;return this.start===0&&(s=this.capacity-1),this.items[s]=E,this.start=s,++this.size},T.prototype.pop=function(){if(this.size!==0){this.size--;var E=this.start+this.size;return E>=this.capacity&&(E-=this.capacity),this.items[E]}},T.prototype.shift=function(){if(this.size!==0){var E=this.start;return this.size--,this.start++,this.start===this.capacity&&(this.start=0),this.items[E]}},T.prototype.peekFirst=function(){if(this.size!==0)return this.items[this.start]},T.prototype.peekLast=function(){if(this.size!==0){var E=this.start+this.size-1;return E>=this.capacity&&(E-=this.capacity),this.items[E]}},T.prototype.get=function(E){if(!(this.size===0||E>=this.capacity))return E=this.start+E,E>=this.capacity&&(E-=this.capacity),this.items[E]},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;for(var y=this.capacity,e=this.size,r=this.start,p=0;p=y)return{done:!0};var p=E[e];return e++,r++,e===s&&(e=0),{value:p,done:!1}})},T.prototype.entries=function(){var E=this.items,s=this.capacity,y=this.size,e=this.start,r=0;return new x(function(){if(r>=y)return{done:!0};var p=E[e];return e++,e===s&&(e=0),{value:[r++,p],done:!1}})},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.values),T.prototype.inspect=function(){var E=this.toArray();return E.type=this.ArrayClass.name,E.capacity=this.capacity,Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),T.from=function(E,s,y){if(arguments.length<3&&(y=i.guessLength(E),typeof y!="number"))throw new Error("mnemonist/fixed-deque.from: could not guess iterable length. Please provide desired capacity as last argument.");var e=new T(s,y);if(i.isArrayLike(E)){var r,p;for(r=0,p=E.length;r{var i=sa(),x=WM();function T(s,y){if(arguments.length<2)throw new Error("mnemonist/circular-buffer: expecting an Array class and a capacity.");if(typeof y!="number"||y<=0)throw new Error("mnemonist/circular-buffer: `capacity` should be a positive number.");this.ArrayClass=s,this.capacity=y,this.items=new s(this.capacity),this.clear()}function E(s){T.prototype[s]=x.prototype[s]}Object.keys(x.prototype).forEach(E),typeof Symbol<"u"&&Object.getOwnPropertySymbols(x.prototype).forEach(E),T.prototype.push=function(s){var y=this.start+this.size;return y>=this.capacity&&(y-=this.capacity),this.items[y]=s,this.size===this.capacity?(y++,y>=this.capacity?this.start=0:this.start=y,this.size):++this.size},T.prototype.unshift=function(s){var y=this.start-1;return this.start===0&&(y=this.capacity-1),this.items[y]=s,this.size===this.capacity?(this.start=y,this.size):(this.start=y,++this.size)},T.from=function(s,y,e){if(arguments.length<3&&(e=i.guessLength(s),typeof e!="number"))throw new Error("mnemonist/circular-buffer.from: could not guess iterable length. Please provide desired capacity as last argument.");var r=new T(y,e);if(i.isArrayLike(s)){var p,h;for(p=0,h=s.length;p{function i(x){if(typeof x!="function")throw new Error("mnemonist/DefaultMap.constructor: expecting a function.");this.items=new Map,this.factory=x,this.size=0}i.prototype.clear=function(){this.items.clear(),this.size=0},i.prototype.get=function(x){var T=this.items.get(x);return typeof T>"u"&&(T=this.factory(x,this.size),this.items.set(x,T),this.size++),T},i.prototype.peek=function(x){return this.items.get(x)},i.prototype.set=function(x,T){return this.items.set(x,T),this.size=this.items.size,this},i.prototype.has=function(x){return this.items.has(x)},i.prototype.delete=function(x){var T=this.items.delete(x);return this.size=this.items.size,T},i.prototype.forEach=function(x,T){T=arguments.length>1?T:this,this.items.forEach(x,T)},i.prototype.entries=function(){return this.items.entries()},i.prototype.keys=function(){return this.items.keys()},i.prototype.values=function(){return this.items.values()},typeof Symbol<"u"&&(i.prototype[Symbol.iterator]=i.prototype.entries),i.prototype.inspect=function(){return this.items},typeof Symbol<"u"&&(i.prototype[Symbol.for("nodejs.util.inspect.custom")]=i.prototype.inspect),i.autoIncrement=function(){var x=0;return function(){return x++}},t.exports=i}),KF=si((g,t)=>{function i(x){if(typeof x!="function")throw new Error("mnemonist/DefaultWeakMap.constructor: expecting a function.");this.items=new WeakMap,this.factory=x}i.prototype.clear=function(){this.items=new WeakMap},i.prototype.get=function(x){var T=this.items.get(x);return typeof T>"u"&&(T=this.factory(x),this.items.set(x,T)),T},i.prototype.peek=function(x){return this.items.get(x)},i.prototype.set=function(x,T){return this.items.set(x,T),this},i.prototype.has=function(x){return this.items.has(x)},i.prototype.delete=function(x){return this.items.delete(x)},i.prototype.inspect=function(){return this.items},typeof Symbol<"u"&&(i.prototype[Symbol.for("nodejs.util.inspect.custom")]=i.prototype.inspect),t.exports=i}),ZF=si((g,t)=>{var i=Is();function x(T){var E=i.getPointerArray(T),s=i.getPointerArray(Math.log2(T));this.size=T,this.dimension=T,this.parents=new E(T),this.ranks=new s(T);for(var y=0;yr?this.parents[y]=s:(this.parents[y]=s,this.ranks[s]++),this},x.prototype.connected=function(T,E){var s=this.find(T);return s===this.find(E)},x.prototype.mapping=function(){for(var T=i.getPointerArray(this.dimension),E={},s=new T(this.size),y=0,e,r=0,p=this.parents.length;r"u"?(s[r]=y,E[e]=y++):s[r]=E[e];return s},x.prototype.compile=function(){for(var T={},E=new Array(this.dimension),s=0,y,e=0,r=this.parents.length;e"u"?(E[s]=[e],T[y]=s++):E[T[y]].push(e);return E},x.prototype.inspect=function(){var T=this.compile();return Object.defineProperty(T,"constructor",{value:x,enumerable:!1}),T},typeof Symbol<"u"&&(x.prototype[Symbol.for("nodejs.util.inspect.custom")]=x.prototype.inspect),t.exports=x}),Wx=si((g,t)=>{var i=$m(),x=Hx(),T=i.DEFAULT_COMPARATOR,E=i.reverseComparator;function s(r,p,h,a){for(var l=h,n=a,u=p[a],f=2*a+1,o;f=0&&(f=o),p[a]=p[f],a=f,f=2*a+1;p[a]=u,x.siftDown(r,p,n,a)}function y(r,p,h,a){for(var l=a,n=l,u=new r(a),f,o;n>0;)f=h[--n],n!==0&&(o=h[0],h[0]=f,s(p,h,--a,0),f=o),u[n]=f;return u}function e(r,p,h){if(arguments.length===2&&(h=p,p=null),this.ArrayClass=r,this.capacity=h,this.items=new r(h),this.clear(),this.comparator=p||T,typeof h!="number"&&h<=0)throw new Error("mnemonist/FixedReverseHeap.constructor: capacity should be a number > 0.");if(typeof this.comparator!="function")throw new Error("mnemonist/FixedReverseHeap.constructor: given comparator should be a function.");this.comparator=E(this.comparator)}e.prototype.clear=function(){this.size=0},e.prototype.push=function(r){return this.size0&&x.replace(this.comparator,this.items,r),this.size},e.prototype.peek=function(){return this.items[0]},e.prototype.consume=function(){var r=y(this.ArrayClass,this.comparator,this.items,this.size);return this.size=0,r},e.prototype.toArray=function(){return y(this.ArrayClass,this.comparator,this.items.slice(0,this.size),this.size)},e.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:e,enumerable:!1}),r},typeof Symbol<"u"&&(e.prototype[Symbol.for("nodejs.util.inspect.custom")]=e.prototype.inspect),t.exports=e}),JF=si((g,t)=>{var i=zn(),x=function(E){return E};function T(E){if(this.items=new Map,this.clear(),Array.isArray(E)?(this.writeHashFunction=E[0],this.readHashFunction=E[1]):(this.writeHashFunction=E,this.readHashFunction=E),this.writeHashFunction||(this.writeHashFunction=x),this.readHashFunction||(this.readHashFunction=x),typeof this.writeHashFunction!="function")throw new Error("mnemonist/FuzzyMap.constructor: invalid hash function given.");if(typeof this.readHashFunction!="function")throw new Error("mnemonist/FuzzyMap.constructor: invalid hash function given.")}T.prototype.clear=function(){this.items.clear(),this.size=0},T.prototype.add=function(E){var s=this.writeHashFunction(E);return this.items.set(s,E),this.size=this.items.size,this},T.prototype.set=function(E,s){return E=this.writeHashFunction(E),this.items.set(E,s),this.size=this.items.size,this},T.prototype.get=function(E){return E=this.readHashFunction(E),this.items.get(E)},T.prototype.has=function(E){return E=this.readHashFunction(E),this.items.has(E)},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this,this.items.forEach(function(y){E.call(s,y,y)})},T.prototype.values=function(){return this.items.values()},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.values),T.prototype.inspect=function(){var E=Array.from(this.items.values());return Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),T.from=function(E,s,y){var e=new T(s);return i(E,function(r,p){y?e.set(p,r):e.add(r)}),e},t.exports=T}),XM=si((g,t)=>{var i=Vr(),x=zn();function T(E){this.Container=E||Array,this.items=new Map,this.clear(),Object.defineProperty(this.items,"constructor",{value:T,enumerable:!1})}T.prototype.clear=function(){this.size=0,this.dimension=0,this.items.clear()},T.prototype.set=function(E,s){var y=this.items.get(E),e;return y||(this.dimension++,y=new this.Container,this.items.set(E,y)),this.Container===Set?(e=y.size,y.add(s),e"u"?0:this.Container===Set?s.size:s.length},T.prototype.count=T.prototype.multiplicity,T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;var y;function e(r){E.call(s,r,y)}this.items.forEach(function(r,p){y=p,r.forEach(e)})},T.prototype.forEachAssociation=function(E,s){s=arguments.length>1?s:this,this.items.forEach(E,s)},T.prototype.keys=function(){return this.items.keys()},T.prototype.values=function(){var E=this.items.values(),s=!1,y,e,r,p;return this.Container===Set?new i(function h(){if(!s){if(e=E.next(),e.done)return{done:!0};s=!0,y=e.value.values()}return e=y.next(),e.done?(s=!1,h()):{done:!1,value:e.value}}):new i(function h(){if(!s){if(e=E.next(),e.done)return{done:!0};s=!0,y=e.value,r=0,p=y.length}return r>=p?(s=!1,h()):{done:!1,value:y[r++]}})},T.prototype.entries=function(){var E=this.items.entries(),s=!1,y,e,r,p,h;return this.Container===Set?new i(function a(){if(!s){if(e=E.next(),e.done)return{done:!0};s=!0,r=e.value[0],y=e.value[1].values()}return e=y.next(),e.done?(s=!1,a()):{done:!1,value:[r,e.value]}}):new i(function a(){if(!s){if(e=E.next(),e.done)return{done:!0};s=!0,r=e.value[0],y=e.value[1],p=0,h=y.length}return p>=h?(s=!1,a()):{done:!1,value:[r,y[p++]]}})},T.prototype.containers=function(){return this.items.values()},T.prototype.associations=function(){return this.items.entries()},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.entries),T.prototype.inspect=function(){return this.items},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),T.prototype.toJSON=function(){return this.items},T.from=function(E,s){var y=new T(s);return x(E,function(e,r){y.set(r,e)}),y},t.exports=T}),$F=si((g,t)=>{var i=XM(),x=zn(),T=function(s){return s};function E(s,y){if(this.items=new i(y),this.clear(),Array.isArray(s)?(this.writeHashFunction=s[0],this.readHashFunction=s[1]):(this.writeHashFunction=s,this.readHashFunction=s),this.writeHashFunction||(this.writeHashFunction=T),this.readHashFunction||(this.readHashFunction=T),typeof this.writeHashFunction!="function")throw new Error("mnemonist/FuzzyMultiMap.constructor: invalid hash function given.");if(typeof this.readHashFunction!="function")throw new Error("mnemonist/FuzzyMultiMap.constructor: invalid hash function given.")}E.prototype.clear=function(){this.items.clear(),this.size=0,this.dimension=0},E.prototype.add=function(s){var y=this.writeHashFunction(s);return this.items.set(y,s),this.size=this.items.size,this.dimension=this.items.dimension,this},E.prototype.set=function(s,y){return s=this.writeHashFunction(s),this.items.set(s,y),this.size=this.items.size,this.dimension=this.items.dimension,this},E.prototype.get=function(s){return s=this.readHashFunction(s),this.items.get(s)},E.prototype.has=function(s){return s=this.readHashFunction(s),this.items.has(s)},E.prototype.forEach=function(s,y){y=arguments.length>1?y:this,this.items.forEach(function(e){s.call(y,e,e)})},E.prototype.values=function(){return this.items.values()},typeof Symbol<"u"&&(E.prototype[Symbol.iterator]=E.prototype.values),E.prototype.inspect=function(){var s=Array.from(this);return Object.defineProperty(s,"constructor",{value:E,enumerable:!1}),s},typeof Symbol<"u"&&(E.prototype[Symbol.for("nodejs.util.inspect.custom")]=E.prototype.inspect),E.from=function(s,y,e,r){arguments.length===3&&typeof e=="boolean"&&(r=e,e=Array);var p=new E(y,e);return x(s,function(h,a){r?p.set(a,h):p.add(h)}),p},t.exports=E}),QF=si((g,t)=>{var i=1024;function x(E){return(E&E-1)===0}function T(E,s){if(arguments.length<1)throw new Error("mnemonist/hashed-array-tree: expecting at least a byte array constructor.");var y=s||0,e=i,r=0;if(typeof s=="object"&&(y=s.initialCapacity||0,r=s.initialLength||0,e=s.blockSize||i),!e||!x(e))throw new Error("mnemonist/hashed-array-tree: block size should be a power of two.");var p=Math.max(r,y),h=Math.ceil(p/e);this.ArrayClass=E,this.length=r,this.capacity=h*e,this.blockSize=e,this.offsetMask=e-1,this.blockMask=Math.log2(e),this.blocks=new Array(h);for(var a=0;a>this.blockMask,e=E&this.offsetMask;return this.blocks[y][e]=s,this},T.prototype.get=function(E){if(!(this.length>this.blockMask,y=E&this.offsetMask;return this.blocks[s][y]}},T.prototype.grow=function(E){if(typeof E!="number"&&(E=this.capacity+this.blockSize),this.capacity>=E)return this;for(;this.capacity>this.blockMask,e=s&this.offsetMask;return this.blocks[y][e]=E,++this.length},T.prototype.pop=function(){if(this.length!==0){var E=this.blocks[this.blocks.length-1],s=--this.length&this.offsetMask;return E[s]}},T.prototype.inspect=function(){for(var E=new this.ArrayClass(this.length),s,y=0,e=this.length;y>this.blockMask,E[y]=this.blocks[s][y&this.offsetMask];return E.type=this.ArrayClass.name,E.items=this.length,E.capacity=this.capacity,E.blockSize=this.blockSize,Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),t.exports=T}),YM=si((g,t)=>{var i=Vr(),x=sa();function T(E,s){if(arguments.length<2)throw new Error("mnemonist/fixed-stack: expecting an Array class and a capacity.");if(typeof s!="number"||s<=0)throw new Error("mnemonist/fixed-stack: `capacity` should be a positive number.");this.capacity=s,this.ArrayClass=E,this.items=new this.ArrayClass(this.capacity),this.clear()}T.prototype.clear=function(){this.size=0},T.prototype.push=function(E){if(this.size===this.capacity)throw new Error("mnemonist/fixed-stack.push: stack capacity ("+this.capacity+") exceeded!");return this.items[this.size++]=E,this.size},T.prototype.pop=function(){if(this.size!==0)return this.items[--this.size]},T.prototype.peek=function(){return this.items[this.size-1]},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;for(var y=0,e=this.items.length;y=s)return{done:!0};var e=E[s-y-1];return y++,{value:e,done:!1}})},T.prototype.entries=function(){var E=this.items,s=this.size,y=0;return new i(function(){if(y>=s)return{done:!0};var e=E[s-y-1];return{value:[y++,e],done:!1}})},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.values),T.prototype.toString=function(){return this.toArray().join(",")},T.prototype.toJSON=function(){return this.toArray()},T.prototype.inspect=function(){var E=this.toArray();return E.type=this.ArrayClass.name,E.capacity=this.capacity,Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),T.from=function(E,s,y){if(arguments.length<3&&(y=x.guessLength(E),typeof y!="number"))throw new Error("mnemonist/fixed-stack.from: could not guess iterable length. Please provide desired capacity as last argument.");var e=new T(s,y);if(x.isArrayLike(E)){var r,p;for(r=0,p=E.length;r{var i=sa(),x=Is(),T=YM();function E(y,e,r,p,h,a,l,n){var u=l+(n-l)/2|0,f=~-u,o=-~u,c=r[u];p[a]=c+1;var d=e?e(y[c]):y[c][1],v=a*2+1,m=a*2+2,S=-1/0,M=-1/0;l<=f&&(S=E(y,e,r,p,h,v,l,f)),o<=n&&(M=E(y,e,r,p,h,m,o,n));var w=Math.max(d,S,M),C=c;return w===S?C=h[p[v]-1]:w===M&&(C=h[p[m]-1]),h[c]=C,w}function s(y,e){this.size=y.length,this.intervals=y;var r=null,p=null;Array.isArray(e)&&(r=e[0],p=e[1]);var h=y.length,a=x.getPointerArray(h+1),l=new a(h),n;for(n=1;nv?1:0});var u=Math.ceil(Math.log2(h+1)),f=Math.pow(2,u)-1,o=new a(f),c=new a(h);E(y,p,l,o,c,0,0,h-1),l=null,this.height=u,this.tree=o,this.augmentations=c,this.startGetter=r,this.endGetter=p,this.stack=new T(a,this.height)}s.prototype.intervalsContainingPoint=function(y){var e=[],r=this.stack;r.clear(),r.push(0);for(var p=this.tree.length,h,a,l,n,u,f,o,c,d;r.size;)h=r.pop(),a=this.tree[h]-1,l=this.intervals[a],n=this.intervals[this.augmentations[a]],o=this.endGetter?this.endGetter(n):n[1],!(y>o)&&(c=h*2+1,c=u&&y<=f&&e.push(l),!(yd)&&(v=l*2+1,v=o&&e<=c&&p.push(u),!(r{g.search=function(t,i,x,T){var E=0;x=typeof x<"u"?x:0,T=typeof T<"u"?T:t.length,T--;for(var s;x<=T;)if(E=x+T>>>1,s=t[E],s>i)T=~-E;else if(s>>1,y=t(i[T],x),y>0)s=~-T;else if(y<0)E=-~T;else return T;return-1},g.lowerBound=function(t,i,x,T){var E=0;for(x=typeof x<"u"?x:0,T=typeof T<"u"?T:t.length;x>>1,i<=t[E]?T=E:x=-~E;return x},g.lowerBoundWithComparator=function(t,i,x){for(var T=0,E=0,s=i.length;E>>1,t(x,i[T])<=0?s=T:E=-~T;return E},g.lowerBoundIndices=function(t,i,x,T,E){var s=0;for(T=typeof T<"u"?T:0,E=typeof E<"u"?E:t.length;T>>1,x<=t[i[s]]?E=s:T=-~s;return T},g.upperBound=function(t,i,x,T){var E=0;for(x=typeof x<"u"?x:0,T=typeof T<"u"?T:t.length;x>>1,i>=t[E]?x=-~E:T=E;return x},g.upperBoundWithComparator=function(t,i,x){for(var T=0,E=0,s=i.length;E>>1,t(x,i[T])>=0?E=-~T:s=T;return E}}),qF=si(g=>{var t=Is(),i=sa().isArrayLike,x=kM(),T=Vx();function E(r,p){if(r.length===0)return p.slice();if(p.length===0)return r.slice();var h;r[0]>p[0]&&(h=r,r=p,p=h);var a=r[r.length-1],l=p[0];if(a<=l)return t.isTypedArray(r)?t.concat(r,p):r.concat(p);var n=new r.constructor(r.length+p.length),u,f,o;for(u=0,f=r.length;up[0]&&(h=r,r=p,p=h);var a=r[r.length-1],l=p[0];if(ap[0]&&(h=r,r=p,p=h);var a=r[r.length-1],l=p[0];if(av?o=x.lowerBound(p,d,o+1):(n.push(d),u++,o++);return n};function y(r){var p=0,h=-1/0,a,l,n,u=[];for(l=0,n=r.length;lh&&(h=a));if(u.length===0)return new r[0].constructor(0);if(u.length===1)return u[0].slice();if(u.length===2)return E(u[0],u[1]);r=u;var f=new r[0].constructor(p),o=t.getPointerArray(h),c=new o(r.length),d=new T(function(S,M){return S=r[S][c[S]],M=r[M][c[M]],SM?1:0});for(l=0;lp&&(p=h));if(n.length===0)return new r[0].constructor(0);if(n.length===1)return n[0].slice();if(n.length===2)return s(n[0],n[1]);r=n;var u=new r[0].constructor,f=t.getPointerArray(p),o=new f(r.length),c=new T(function(m,S){return m=r[m][o[m]],S=r[S][o[S]],mS?1:0});for(a=0;ap&&(p=a),lh)return[];if(p===h)return[p];var o,c,d=r[0],v,m,S,M,w,C,A=p;for(u=1;uC?m=x.lowerBound(c,w,m+1):(d.push(w),v++,m++);if(d.length===0)return d;A=d[0]}return d},g.merge=function(){if(arguments.length===2){if(i(arguments[0]))return E(arguments[0],arguments[1])}else if(i(arguments[0]))return y(arguments);return null},g.unionUnique=function(){if(arguments.length===2){if(i(arguments[0]))return s(arguments[0],arguments[1])}else if(i(arguments[0]))return e(arguments);return null},g.intersectionUnique=function(){if(arguments.length===2){if(i(arguments[0]))return g.intersectionUniqueArrays(arguments[0],arguments[1])}else if(i(arguments[0]))return g.kWayIntersectionUniqueArrays(arguments);return null}}),tO=si((g,t)=>{var i=Vr(),x=zn(),T=qF();function E(y){return y}function s(y){if(this.clear(),Array.isArray(y)?(this.documentTokenizer=y[0],this.queryTokenizer=y[1]):(this.documentTokenizer=y,this.queryTokenizer=y),this.documentTokenizer||(this.documentTokenizer=E),this.queryTokenizer||(this.queryTokenizer=E),typeof this.documentTokenizer!="function")throw new Error("mnemonist/InvertedIndex.constructor: document tokenizer is not a function.");if(typeof this.queryTokenizer!="function")throw new Error("mnemonist/InvertedIndex.constructor: query tokenizer is not a function.")}s.prototype.clear=function(){this.items=[],this.mapping=new Map,this.size=0,this.dimension=0},s.prototype.add=function(y){this.size++;var e=this.items.length;this.items.push(y);var r=this.documentTokenizer(y);if(!Array.isArray(r))throw new Error("mnemonist/InvertedIndex.add: tokenizer function should return an array of tokens.");for(var p=new Set,h,a,l=0,n=r.length;l"u"||r.length===0)return[];if(e.length>1)for(h=1,a=e.length;h"u"||p.length===0)return[];r=T.intersectionUniqueArrays(r,p)}var l=new Array(r.length);for(h=0,a=l.length;h1?e:this;for(var r=0,p=this.documents.length;r=e)return{done:!0};var p=y[r++];return{value:p,done:!1}})},s.prototype.tokens=function(){return this.mapping.keys()},typeof Symbol<"u"&&(s.prototype[Symbol.iterator]=s.prototype.documents),s.prototype.inspect=function(){var y=this.items.slice();return Object.defineProperty(y,"constructor",{value:s,enumerable:!1}),y},typeof Symbol<"u"&&(s.prototype[Symbol.for("nodejs.util.inspect.custom")]=s.prototype.inspect),s.from=function(y,e){var r=new s(e);return x(y,function(p){r.add(p)}),r},t.exports=s}),jM=si(g=>{var t=new Float64Array(64),i=new Float64Array(64);function x(E,s,y){var e,r,p,h,a;for(t[0]=s,i[0]=y,r=0;r>=0;)if(p=t[r],h=i[r]-1,p=e&&pi[r-1]-t[r-1]&&(a=t[r],t[r]=t[r-1],t[r-1]=a,a=i[r],i[r]=i[r-1],i[r-1]=a)}else r--;return E}g.inplaceQuickSort=x;function T(E,s,y,e){var r,p,h,a,l,n;for(t[0]=y,i[0]=e,p=0;p>=0;)if(h=t[p],a=i[p]-1,h=r&&hi[p-1]-t[p-1]&&(n=t[p],t[p]=t[p-1],t[p-1]=n,n=i[p],i[p]=i[p-1],i[p-1]=n)}else p--;return s}g.inplaceQuickSortIndices=T}),eO=si((g,t)=>{var i=sa(),x=Is(),T=$m().createTupleComparator,E=Wx(),s=jM().inplaceQuickSortIndices;function y(l,n,u,f){var o,c=0,d;for(o=0;o>>1),P=u[A],d[D]=P,w>-1&&(C===0?v[w]=D+1:m[w]=D+1),I=(I+1)%l,A!==b&&A!==O-1&&S.push([I,A+1,O,D,1]),A!==b&&S.push([I,b,A,D,0]),D++;return{axes:n,labels:f,pivots:d,lefts:v,rights:m}}function p(l,n){this.dimensions=l,this.visited=0,this.axes=n.axes,this.labels=n.labels,this.pivots=n.pivots,this.lefts=n.lefts,this.rights=n.rights,this.size=this.labels.length}p.prototype.nearestNeighbor=function(l){var n=1/0,u=null,f=this.dimensions,o=this.axes,c=this.pivots,d=this.lefts,v=this.rights,m=0;function S(M,w){m++;var C=d[w],A=v[w],P=c[w],b=y(f,o,P,l);if(!(b0?C!==0&&S(M,C-1):A!==0&&S(M,A-1),O*O0?A!==0&&S(M,A-1):C!==0&&S(M,C-1))}}return S(0,0),this.visited=m,this.labels[u]};var h=T(3),a=T(2);p.prototype.kNearestNeighbors=function(l,n){if(l<=0)throw new Error("mnemonist/kd-tree.kNearestNeighbors: k should be a positive number.");if(l=Math.min(l,this.size),l===1)return[this.nearestNeighbor(n)];var u=new E(Array,h,l),f=this.dimensions,o=this.axes,c=this.pivots,d=this.lefts,v=this.rights,m=0;function S(C,A){var P=d[A],b=v[A],O=c[A],I=y(f,o,O,n);u.push([I,m++,O]);var D=n[C],B=o[C][O],G=D-B;C=(C+1)%f,D{var i=Vr(),x=zn();function T(){this.clear()}T.prototype.clear=function(){this.head=null,this.tail=null,this.size=0},T.prototype.first=function(){return this.head?this.head.item:void 0},T.prototype.peek=T.prototype.first,T.prototype.last=function(){return this.tail?this.tail.item:void 0},T.prototype.push=function(E){var s={item:E,next:null};return this.head?(this.tail.next=s,this.tail=s):(this.head=s,this.tail=s),this.size++,this.size},T.prototype.unshift=function(E){var s={item:E,next:null};return this.head?(this.head.next||(this.tail=this.head),s.next=this.head,this.head=s):(this.head=s,this.tail=s),this.size++,this.size},T.prototype.shift=function(){if(this.size){var E=this.head;return this.head=E.next,this.size--,E.item}},T.prototype.forEach=function(E,s){if(this.size){s=arguments.length>1?s:this;for(var y=this.head,e=0;y;)E.call(s,y.item,e,this),y=y.next,e++}},T.prototype.toArray=function(){if(!this.size)return[];for(var E=new Array(this.size),s=0,y=this.size,e=this.head;s{var i=Vr(),x=zn(),T=Is(),E=sa();function s(y,e,r){if(arguments.length<2&&(r=y,y=null,e=null),this.capacity=r,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-cache: capacity should be a finite positive integer.");var p=T.getPointerArray(r);this.forward=new p(r),this.backward=new p(r),this.K=typeof y=="function"?new y(r):new Array(r),this.V=typeof e=="function"?new e(r):new Array(r),this.size=0,this.head=0,this.tail=0,this.items={}}s.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},s.prototype.splayOnTop=function(y){var e=this.head;if(this.head===y)return this;var r=this.backward[y],p=this.forward[y];return this.tail===y?this.tail=r:this.backward[p]=r,this.forward[r]=p,this.backward[e]=y,this.head=y,this.forward[y]=e,this},s.prototype.set=function(y,e){var r=this.items[y];if(typeof r<"u"){this.splayOnTop(r),this.V[r]=e;return}this.size1?e:this;for(var r=0,p=this.size,h=this.head,a=this.K,l=this.V,n=this.forward;r=e)return{done:!0};var a=p[r];return y++,y=e)return{done:!0};var a=p[r];return y++,y=e)return{done:!0};var l=p[r],n=h[r];return y++,y{var i=Xx(),x=zn(),T=Is(),E=sa();function s(e,r,p){arguments.length<2?i.call(this,e):i.call(this,e,r,p);var h=T.getPointerArray(this.capacity);this.deleted=new h(this.capacity),this.deletedSize=0}for(y in i.prototype)s.prototype[y]=i.prototype[y];var y;typeof Symbol<"u"&&(s.prototype[Symbol.iterator]=i.prototype[Symbol.iterator]),s.prototype.clear=function(){i.prototype.clear.call(this),this.deletedSize=0},s.prototype.set=function(e,r){var p=this.items[e];if(typeof p<"u"){this.splayOnTop(p),this.V[p]=r;return}this.size0?p=this.deleted[--this.deletedSize]:p=this.size,this.size++):(p=this.tail,this.tail=this.backward[p],delete this.items[this.K[p]]),this.items[e]=p,this.K[p]=e,this.V[p]=r,this.forward[p]=this.head,this.backward[this.head]=p,this.head=p},s.prototype.setpop=function(e,r){var p=null,h=null,a=this.items[e];return typeof a<"u"?(this.splayOnTop(a),p=this.V[a],this.V[a]=r,{evicted:!1,key:e,value:p}):(this.size0?a=this.deleted[--this.deletedSize]:a=this.size,this.size++):(a=this.tail,this.tail=this.backward[a],p=this.V[a],h=this.K[a],delete this.items[h]),this.items[e]=a,this.K[a]=e,this.V[a]=r,this.forward[a]=this.head,this.backward[this.head]=a,this.head=a,h?{evicted:!0,key:h,value:p}:null)},s.prototype.delete=function(e){var r=this.items[e];if(typeof r>"u")return!1;if(delete this.items[e],this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,!0;var p=this.backward[r],h=this.forward[r];return this.head===r&&(this.head=h),this.tail===r&&(this.tail=p),this.forward[p]=h,this.backward[h]=p,this.size--,this.deleted[this.deletedSize++]=r,!0},s.prototype.remove=function(e,r=void 0){var p=this.items[e];if(typeof p>"u")return r;var h=this.V[p];if(delete this.items[e],this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,h;var a=this.backward[p],l=this.forward[p];return this.head===p&&(this.head=l),this.tail===p&&(this.tail=a),this.forward[a]=l,this.backward[l]=a,this.size--,this.deleted[this.deletedSize++]=p,h},s.from=function(e,r,p,h){if(arguments.length<2){if(h=E.guessLength(e),typeof h!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(h=r,r=null,p=null);var a=new s(r,p,h);return x(e,function(l,n){a.set(n,l)}),a},t.exports=s}),KM=si((g,t)=>{var i=Xx(),x=zn(),T=Is(),E=sa();function s(y,e,r){if(arguments.length<2&&(r=y,y=null,e=null),this.capacity=r,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-map: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-map: capacity should be a finite positive integer.");var p=T.getPointerArray(r);this.forward=new p(r),this.backward=new p(r),this.K=typeof y=="function"?new y(r):new Array(r),this.V=typeof e=="function"?new e(r):new Array(r),this.size=0,this.head=0,this.tail=0,this.items=new Map}s.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()},s.prototype.set=function(y,e){var r=this.items.get(y);if(typeof r<"u"){this.splayOnTop(r),this.V[r]=e;return}this.size{var i=KM(),x=zn(),T=Is(),E=sa();function s(e,r,p){arguments.length<2?i.call(this,e):i.call(this,e,r,p);var h=T.getPointerArray(this.capacity);this.deleted=new h(this.capacity),this.deletedSize=0}for(y in i.prototype)s.prototype[y]=i.prototype[y];var y;typeof Symbol<"u"&&(s.prototype[Symbol.iterator]=i.prototype[Symbol.iterator]),s.prototype.clear=function(){i.prototype.clear.call(this),this.deletedSize=0},s.prototype.set=function(e,r){var p=this.items.get(e);if(typeof p<"u"){this.splayOnTop(p),this.V[p]=r;return}this.size0?p=this.deleted[--this.deletedSize]:p=this.size,this.size++):(p=this.tail,this.tail=this.backward[p],this.items.delete(this.K[p])),this.items.set(e,p),this.K[p]=e,this.V[p]=r,this.forward[p]=this.head,this.backward[this.head]=p,this.head=p},s.prototype.setpop=function(e,r){var p=null,h=null,a=this.items.get(e);return typeof a<"u"?(this.splayOnTop(a),p=this.V[a],this.V[a]=r,{evicted:!1,key:e,value:p}):(this.size0?a=this.deleted[--this.deletedSize]:a=this.size,this.size++):(a=this.tail,this.tail=this.backward[a],p=this.V[a],h=this.K[a],this.items.delete(h)),this.items.set(e,a),this.K[a]=e,this.V[a]=r,this.forward[a]=this.head,this.backward[this.head]=a,this.head=a,h?{evicted:!0,key:h,value:p}:null)},s.prototype.delete=function(e){var r=this.items.get(e);if(typeof r>"u")return!1;if(this.items.delete(e),this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,!0;var p=this.backward[r],h=this.forward[r];return this.head===r&&(this.head=h),this.tail===r&&(this.tail=p),this.forward[p]=h,this.backward[h]=p,this.size--,this.deleted[this.deletedSize++]=r,!0},s.prototype.remove=function(e,r=void 0){var p=this.items.get(e);if(typeof p>"u")return r;var h=this.V[p];if(this.items.delete(e),this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,h;var a=this.backward[p],l=this.forward[p];return this.head===p&&(this.head=l),this.tail===p&&(this.tail=a),this.forward[a]=l,this.backward[l]=a,this.size--,this.deleted[this.deletedSize++]=p,h},s.from=function(e,r,p,h){if(arguments.length<2){if(h=E.guessLength(e),typeof h!="number")throw new Error("mnemonist/lru-map.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(h=r,r=null,p=null);var a=new s(r,p,h);return x(e,function(l,n){a.set(n,l)}),a},t.exports=s}),sO=si((g,t)=>{var i=Vr(),x=zn(),T=Wx(),E=function(y,e){return y[1]>e[1]?-1:y[1]"u"?0:e},s.prototype.get=s.prototype.multiplicity,s.prototype.count=s.prototype.multiplicity,s.prototype.frequency=function(y){if(this.size===0)return 0;var e=this.multiplicity(y);return e/this.size},s.prototype.top=function(y){if(typeof y!="number"||y<=0)throw new Error("mnemonist/multi-set.top: n must be a number > 0.");for(var e=new T(Array,E,y),r=this.items.entries(),p;p=r.next(),!p.done;)e.push(p.value);return e.consume()},s.prototype.forEach=function(y,e){e=arguments.length>1?e:this;var r;this.items.forEach(function(p,h){for(r=0;r1?e:this,this.items.forEach(y,e)},s.prototype.keys=function(){return this.items.keys()},s.prototype.values=function(){var y=this.items.entries(),e=!1,r,p,h,a;return new i(function l(){if(!e){if(r=y.next(),r.done)return{done:!0};e=!0,p=r.value[0],h=r.value[1],a=0}return a>=h?(e=!1,l()):(a++,{done:!1,value:p})})},s.prototype.multiplicities=function(){return this.items.entries()},typeof Symbol<"u"&&(s.prototype[Symbol.iterator]=s.prototype.values),s.prototype.inspect=function(){return this.items},typeof Symbol<"u"&&(s.prototype[Symbol.for("nodejs.util.inspect.custom")]=s.prototype.inspect),s.prototype.toJSON=function(){return this.items},s.from=function(y){var e=new s;return x(y,function(r){e.add(r)}),e},s.isSubset=function(y,e){var r=y.multiplicities(),p,h,a;if(y===e)return!0;if(y.dimension>e.dimension)return!1;for(;p=r.next(),!p.done;)if(h=p.value[0],a=p.value[1],e.multiplicity(h){var i=Vr(),x=zn();function T(l,n,u){return((Math.pow(l,2)-Math.pow(Math.abs(n-u),2))/2|0)+l+1}function E(l,n){for(var u=0,f=0,o=n+1;fn.length?-1:l.lengthn?1:0}function y(l,n){var u=l+1,f=n/u|0,o=f+1,c,d,v=n-f*u,m=u-v,S=new Array(l+1);for(c=0;c 0");this.levenshtein=l,this.k=n,this.clear()}a.prototype.clear=function(){this.size=0,this.strings=[],this.invertedIndices={}},a.prototype.add=function(l){var n=l.length,u=this.size;this.strings.push(l),this.size++;var f=e(this.k,l),o=this.invertedIndices[n];typeof o>"u"&&(o={},this.invertedIndices[n]=o);var c,d,v,m,S;for(m=0,S=f.length;m"u"?(d=[u],o[v]=d):d.push(u);return this},a.prototype.search=function(l){var n=l.length,u=this.k,f=new Set,o,c,d,v,m,S,M,w,C,A,P,b,O,I,D;for(w=Math.max(0,n-u),C=n+u+1;w1?n:this;for(var u=0,f=this.strings.length;u=n)return{done:!0};var f=l[u];return u++,{value:f,done:!1}})},typeof Symbol<"u"&&(a.prototype[Symbol.iterator]=a.prototype.values),a.prototype.inspect=function(){var l=this.strings.slice();return Object.defineProperty(l,"constructor",{value:a,enumerable:!1}),l},typeof Symbol<"u"&&(a.prototype[Symbol.for("nodejs.util.inspect.custom")]=a.prototype.inspect),a.from=function(l,n,u){var f=new a(n,u);return x(l,function(o){f.add(o)}),f},a.countKeys=E,a.comparator=s,a.partition=y,a.segments=e,a.segmentPos=r,a.multiMatchAwareInterval=p,a.multiMatchAwareSubstrings=h,t.exports=a}),oO=si((g,t)=>{var i=Vr(),x=zn();function T(){this.clear()}T.prototype.clear=function(){this.items=[],this.offset=0,this.size=0},T.prototype.enqueue=function(E){return this.items.push(E),++this.size},T.prototype.dequeue=function(){if(this.size){var E=this.items[this.offset];return++this.offset*2>=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,E}},T.prototype.peek=function(){if(this.size)return this.items[this.offset]},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;for(var y=this.offset,e=0,r=this.items.length;y=E.length)return{done:!0};var y=E[s];return s++,{value:y,done:!1}})},T.prototype.entries=function(){var E=this.items,s=this.offset,y=0;return new i(function(){if(s>=E.length)return{done:!0};var e=E[s];return s++,{value:[y++,e],done:!1}})},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.values),T.prototype.toString=function(){return this.toArray().join(",")},T.prototype.toJSON=function(){return this.toArray()},T.prototype.inspect=function(){var E=this.toArray();return Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),T.from=function(E){var s=new T;return x(E,function(y){s.enqueue(y)}),s},T.of=function(){return T.from(arguments)},t.exports=T}),lO=si((g,t)=>{var i=Vr(),x=zn();function T(){this.clear()}T.prototype.clear=function(){this.items=[],this.size=0},T.prototype.push=function(E){return this.items.push(E),++this.size},T.prototype.pop=function(){if(this.size!==0)return this.size--,this.items.pop()},T.prototype.peek=function(){return this.items[this.size-1]},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;for(var y=0,e=this.items.length;y=s)return{done:!0};var e=E[s-y-1];return y++,{value:e,done:!1}})},T.prototype.entries=function(){var E=this.items,s=E.length,y=0;return new i(function(){if(y>=s)return{done:!0};var e=E[s-y-1];return{value:[y++,e],done:!1}})},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.values),T.prototype.toString=function(){return this.toArray().join(",")},T.prototype.toJSON=function(){return this.toArray()},T.prototype.inspect=function(){var E=this.toArray();return Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),T.from=function(E){var s=new T;return x(E,function(y){s.push(y)}),s},T.of=function(){return T.from(arguments)},t.exports=T}),hO=si(g=>{g.intersection=function(){if(arguments.length<2)throw new Error("mnemonist/Set.intersection: needs at least two arguments.");var t=new Set,i=1/0,x=null,T,E,s=arguments.length;for(E=0;Ei.size)return!1;for(;T=x.next(),!T.done;)if(!i.has(T.value))return!1;return!0},g.isSuperset=function(t,i){return g.isSubset(i,t)},g.add=function(t,i){for(var x=i.values(),T;T=x.next(),!T.done;)t.add(T.value)},g.subtract=function(t,i){for(var x=i.values(),T;T=x.next(),!T.done;)t.delete(T.value)},g.intersect=function(t,i){for(var x=t.values(),T;T=x.next(),!T.done;)i.has(T.value)||t.delete(T.value)},g.disjunct=function(t,i){for(var x=t.values(),T,E=[];T=x.next(),!T.done;)i.has(T.value)&&E.push(T.value);for(x=i.values();T=x.next(),!T.done;)t.has(T.value)||t.add(T.value);for(var s=0,y=E.length;si.size&&(x=t,t=i,i=x),t.size===0)return 0;if(t===i)return t.size;for(var T=t.values(),E,s=0;E=T.next(),!E.done;)i.has(E.value)&&s++;return s},g.unionSize=function(t,i){var x=g.intersectionSize(t,i);return t.size+i.size-x},g.jaccard=function(t,i){var x=g.intersectionSize(t,i);if(x===0)return 0;var T=t.size+i.size-x;return x/T},g.overlap=function(t,i){var x=g.intersectionSize(t,i);return x===0?0:x/Math.min(t.size,i.size)}}),uO=si((g,t)=>{var i=Vr(),x=Is().getPointerArray;function T(E){var s=x(E);this.start=0,this.size=0,this.capacity=E,this.dense=new s(E),this.sparse=new s(E)}T.prototype.clear=function(){this.start=0,this.size=0},T.prototype.has=function(E){if(this.size===0)return!1;var s=this.sparse[E],y=s=this.start&&s=this.start&&s1?s:this;for(var y=this.capacity,e=this.size,r=this.start,p=0;p=y)return{done:!0};var p=E[e];return e++,r++,e===s&&(e=0),{value:p,done:!1}})},typeof Symbol<"u"&&(T.prototype[Symbol.iterator]=T.prototype.values),T.prototype.inspect=function(){var E=[];return this.forEach(function(s){E.push(s)}),Object.defineProperty(E,"constructor",{value:T,enumerable:!1}),E.capacity=this.capacity,E},typeof Symbol<"u"&&(T.prototype[Symbol.for("nodejs.util.inspect.custom")]=T.prototype.inspect),t.exports=T}),fO=si((g,t)=>{var i=Vr(),x=Is().getPointerArray;function T(E,s){arguments.length<2&&(s=E,E=Array);var y=x(s);this.size=0,this.length=s,this.dense=new y(s),this.sparse=new y(s),this.vals=new E(s)}T.prototype.clear=function(){this.size=0},T.prototype.has=function(E){var s=this.sparse[E];return s=this.size||this.dense[s]!==E?!1:(s=this.dense[this.size-1],this.dense[this.sparse[E]]=s,this.sparse[s]=this.sparse[E],this.size--,!0)},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;for(var y=0;y{var i=Vr(),x=Is().getPointerArray;function T(E){var s=x(E);this.size=0,this.length=E,this.dense=new s(E),this.sparse=new s(E)}T.prototype.clear=function(){this.size=0},T.prototype.has=function(E){var s=this.sparse[E];return s=this.size||this.dense[s]!==E?!1:(s=this.dense[this.size-1],this.dense[this.sparse[E]]=s,this.sparse[s]=this.sparse[E],this.size--,!0)},T.prototype.forEach=function(E,s){s=arguments.length>1?s:this;for(var y,e=0;e{var i=zn(),x=2,T=2,E=new Set([0,1,2]),s={0:"Returns only the top suggestion",1:"Returns suggestions with the smallest edit distance",2:"Returns every suggestion (no early termination)"};function y(n){var u=new Set;return typeof n=="number"&&u.add(n),{suggestions:u,count:0}}function e(n,u,f){return{term:n||"",distance:u||0,count:f||0}}function r(n,u,f,o){o=o||new Set,u++;var c,d=n.length,v;if(d>1)for(v=0;v0&&n[v].length-d.length>o.length-d.length&&(f.suggestions=new Set,f.count=0),(u===2||!f.suggestions.size||n[v].length-d.length>=o.length-d.length)&&f.suggestions.add(c)}function h(n,u){var f=n.length,o=u.length,c=[[]],d=f+o,v=new Map,m,S,M;for(c[0][0]=d,m=0;m<=f;m++)c[m+1]||(c[m+1]=[]),c[m+1][1]=m,c[m+1][0]=d;for(M=0;M<=o;M++)c[1][M+1]=M,c[0][M+1]=d;var w=n+u,C;for(m=0,S=w.length;mc)return[];for(var m=[d],S=new Set,M=new Set,w=[],C,A;m.length>0&&(C=m.shift(),!(f<2&&w.length>0&&v-C.length>w[0].distance));){if(A=n[C],A!==void 0){if(typeof A=="number"&&(A=y(A)),A.count>0&&!M.has(C)){M.add(C);var P=e(C,v-C.length,A.count);if(w.push(P),f<2&&v-C.length===0)break}A.suggestions.forEach(D=>{var B=u[D];if(!M.has(B)){M.add(B);var G=0;if(d!==B)if(B.length===C.length)G=v-C.length;else if(v===C.length)G=B.length-C.length;else{for(var z=0,X=0,j=B.length;z0||X>0?G=h(B.substr(z,j-z-X),d.substr(z,v-z-X)):G=h(B,d)}if(f<2&&w.length>0&&w[0].distance>G&&(w=[]),!(f<2&&w.length>0&&G>w[0].distance)&&G<=o){var Q=n[B];Q!==void 0&&w.push(e(B,G,Q.count))}}})}if(v-C.length0&&v-C.length>=w[0].distance)continue;for(var b=0,O=C.length;bthis.maxLength&&(this.maxLength=n.length)),u.count===1){var f=this.words.length;this.words.push(n);var o=r(n,0,this.maxDistance);o.forEach(c=>{var d=this.dictionary[c];d!==void 0?(typeof d=="number"&&(d=y(d),this.dictionary[c]=d),d.suggestions.has(f)||p(this.words,this.verbosity,d,n,f,c)):this.dictionary[c]=f})}return this.size++,this},l.prototype.search=function(n){return a(this.dictionary,this.words,this.verbosity,this.maxDistance,this.maxLength,n)},l.prototype.inspect=function(){var n=[];n.size=this.size,n.maxDistance=this.maxDistance,n.verbosity=this.verbosity,n.behavior=s[this.verbosity];for(var u in this.dictionary)typeof this.dictionary[u]=="object"&&this.dictionary[u].count&&n.push([u,this.dictionary[u].count]);return Object.defineProperty(n,"constructor",{value:l,enumerable:!1}),n},typeof Symbol<"u"&&(l.prototype[Symbol.for("nodejs.util.inspect.custom")]=l.prototype.inspect),l.from=function(n,u){var f=new l(u);return i(n,function(o){f.add(o)}),f},t.exports=l}),ZM=si((g,t)=>{var i=zn(),x=Vr(),T="\0";function E(s){this.mode=s===Array?"array":"string",this.clear()}E.prototype.clear=function(){this.root={},this.size=0},E.prototype.set=function(s,y){for(var e=this.root,r,p=0,h=s.length;p"u")return;if(T in y)return y[T]},E.prototype.delete=function(s){var y=this.root,e=null,r=null,p,h,a,l;for(a=0,l=s.length;a"u")return!1;e!==null?Object.keys(y).length>1&&(e=null,r=null):Object.keys(y).length<2&&(e=p,r=h)}return T in y?(this.size--,e?delete e[r]:delete y[T],!0):!1},E.prototype.has=function(s){for(var y=this.root,e,r=0,p=s.length;r"u")return!1;return T in y},E.prototype.find=function(s){var y=typeof s=="string",e=this.root,r=[],p,h,a;for(h=0,a=s.length;h"u")return r;for(var l=[e],n=[s],u;l.length;){s=n.pop(),e=l.pop();for(u in e){if(u===T){r.push([s,e[T]]);continue}l.push(e[u]),n.push(y?s+u:s.concat(u))}}return r},E.prototype.values=function(s){var y=this.root,e=[],r,p,h;if(s){for(p=0,h=s.length;p"u")return x.empty()}return e.push(y),new x(function(){for(var a,l=!1,n;e.length;){a=e.pop();for(n in a){if(n===T){l=!0;continue}e.push(a[n])}if(l)return{done:!1,value:a[T]}}return{done:!0}})},E.prototype.prefixes=function(s){var y=this.root,e=[],r=[],p,h,a,l=this.mode==="string";if(s){for(h=0,a=s.length;h"u")return x.empty()}else s=l?"":[];return e.push(y),r.push(s),new x(function(){for(var n,u,f=!1,o;e.length;){n=e.pop(),u=r.pop();for(o in n){if(o===T){f=!0;continue}e.push(n[o]),r.push(l?u+o:u.concat(o))}if(f)return{done:!1,value:u}}return{done:!0}})},E.prototype.keys=E.prototype.prefixes,E.prototype.entries=function(s){var y=this.root,e=[],r=[],p,h,a,l=this.mode==="string";if(s){for(h=0,a=s.length;h"u")return x.empty()}else s=l?"":[];return e.push(y),r.push(s),new x(function(){for(var n,u,f=!1,o;e.length;){n=e.pop(),u=r.pop();for(o in n){if(o===T){f=!0;continue}e.push(n[o]),r.push(l?u+o:u.concat(o))}if(f)return{done:!1,value:[u,n[T]]}}return{done:!0}})},typeof Symbol<"u"&&(E.prototype[Symbol.iterator]=E.prototype.entries),E.prototype.inspect=function(){for(var s=new Array(this.size),y=this.entries(),e,r=0;e=y.next(),!e.done;)s[r++]=e.value;return Object.defineProperty(s,"constructor",{value:E,enumerable:!1}),s},typeof Symbol<"u"&&(E.prototype[Symbol.for("nodejs.util.inspect.custom")]=E.prototype.inspect),E.prototype.toJSON=function(){return this.root},E.from=function(s){var y=new E;return i(s,function(e,r){y.set(r,e)}),y},E.SENTINEL=T,t.exports=E}),pO=si((g,t)=>{var i=zn(),x=ZM(),T="\0";function E(y){this.mode=y===Array?"array":"string",this.clear()}for(s in x.prototype)E.prototype[s]=x.prototype[s];var s;delete E.prototype.set,delete E.prototype.get,delete E.prototype.values,delete E.prototype.entries,E.prototype.add=function(y){for(var e=this.root,r,p=0,h=y.length;p"u")return p;for(var n=[r],u=[y],f;n.length;){y=u.pop(),r=n.pop();for(f in r){if(f===T){p.push(y);continue}n.push(r[f]),u.push(e?y+f:y.concat(f))}}return p},typeof Symbol<"u"&&(E.prototype[Symbol.iterator]=E.prototype.keys),E.prototype.inspect=function(){for(var y=new Set,e=this.keys(),r;r=e.next(),!r.done;)y.add(r.value);return Object.defineProperty(y,"constructor",{value:E,enumerable:!1}),y},typeof Symbol<"u"&&(E.prototype[Symbol.for("nodejs.util.inspect.custom")]=E.prototype.inspect),E.prototype.toJSON=function(){return this.root},E.from=function(y){var e=new E;return i(y,function(r){e.add(r)}),e},E.SENTINEL=T,t.exports=E}),vO=si((g,t)=>{var i=Vr(),x=zn(),T=sa(),E=Is(),s=function(p){return Math.max(1,Math.ceil(p*1.5))},y=function(p){var h=E.getPointerArray(p);return new h(p)};function e(p,h){if(arguments.length<1)throw new Error("mnemonist/vector: expecting at least a byte array constructor.");var a=h||0,l=s,n=0,u=!1;typeof h=="object"&&(a=h.initialCapacity||0,n=h.initialLength||0,l=h.policy||l,u=h.factory===!0),this.factory=u?p:null,this.ArrayClass=p,this.length=n,this.capacity=Math.max(n,a),this.policy=l,this.array=new p(this.capacity)}e.prototype.set=function(p,h){if(this.lengththis.capacity)if(this.factory===null?this.array=new this.ArrayClass(p):this.array=this.factory(p),E.isTypedArray(this.array))this.array.set(h,0);else for(var a=0,l=this.length;a=p)return this;for(h=this.capacity;h=h)return{done:!0};var l=p[a];return a++,{value:l,done:!1}})},e.prototype.entries=function(){var p=this.array,h=this.length,a=0;return new i(function(){if(a>=h)return{done:!0};var l=p[a];return{value:[a++,l],done:!1}})},typeof Symbol<"u"&&(e.prototype[Symbol.iterator]=e.prototype.values),e.prototype.inspect=function(){var p=this.array.slice(0,this.length);return p.type=this.array.constructor.name,p.items=this.length,p.capacity=this.capacity,Object.defineProperty(p,"constructor",{value:e,enumerable:!1}),p},typeof Symbol<"u"&&(e.prototype[Symbol.for("nodejs.util.inspect.custom")]=e.prototype.inspect),e.from=function(p,h,a){if(arguments.length<3&&(a=T.guessLength(p),typeof a!="number"))throw new Error("mnemonist/vector.from: could not guess iterable length. Please provide desired capacity as last argument.");var l=new e(h,a);return x(p,function(n){l.push(n)}),l};function r(p){var h=function(l){e.call(this,p,l)};for(var a in e.prototype)e.prototype.hasOwnProperty(a)&&(h.prototype[a]=e.prototype[a]);return h.from=function(l,n){return e.from(l,p,n)},typeof Symbol<"u"&&(h.prototype[Symbol.iterator]=h.prototype.values),h}e.Int8Vector=r(Int8Array),e.Uint8Vector=r(Uint8Array),e.Uint8ClampedVector=r(Uint8ClampedArray),e.Int16Vector=r(Int16Array),e.Uint16Vector=r(Uint16Array),e.Int32Vector=r(Int32Array),e.Uint32Vector=r(Uint32Array),e.Float32Vector=r(Float32Array),e.Float64Vector=r(Float64Array),e.PointerVector=r(y),t.exports=e}),mO=si((g,t)=>{var i=sa(),x=Is(),T=jM().inplaceQuickSortIndices,E=kM().lowerBoundIndices,s=Hx(),y=x.getPointerArray;function e(h,a){return h.distancea.distance?-1:0}function r(h,a,l){for(var n=l.length,u=y(n),f=0,o=new u(n),c=new u(n),d=new u(n),v=new Float64Array(n),m=[0,0,n],S=new Float64Array(n),M,w,C,A,P,b,O,I,D;m.length;)if(P=m.pop(),A=m.pop(),M=m.pop(),w=l[P-1],P--,D=P-A,o[M]=w,D!==0){if(D===1){O=h(a[w],a[l[A]]),v[M]=O,f++,d[M]=f,o[f]=l[A];continue}for(I=A;I0&&(f++,d[M]=f,m.push(f,b,P)),b-A>0&&(f++,c[M]=f,m.push(f,A,b))}return{nodes:o,lefts:c,rights:d,mus:v}}function p(h,a){if(typeof h!="function")throw new Error("mnemonist/VPTree.constructor: given `distance` must be a function.");if(!a)throw new Error("mnemonist/VPTree.constructor: you must provide items to the tree. A VPTree cannot be updated after its creation.");this.distance=h,this.heap=new s(e),this.D=0;var l=i.toArrayWithIndices(a);this.items=l[0];var n=l[1];this.size=n.length;var u=r(h,this.items,n);this.nodes=u.nodes,this.lefts=u.lefts,this.rights=u.rights,this.mus=u.mus}p.prototype.nearestNeighbors=function(h,a){var l=this.heap,n=[0],u=1/0,f,o,c,d,v,m,S;for(this.D=0;n.length;)f=n.pop(),o=this.nodes[f],c=this.items[o],S=this.distance(c,a),this.D++,Sh&&l.pop(),l.size>=h&&(u=l.peek().distance)),d=this.lefts[f],v=this.rights[f],!(!d&&!v)&&(m=this.mus[f],S=m-u&&n.push(v)):(v&&S>=m-u&&n.push(v),d&&S=0;w--)M[w]=l.pop();return M},p.prototype.neighbors=function(h,a){var l=[],n=[0],u,f,o,c,d,v,m;for(this.D=0;n.length;)u=n.pop(),f=this.nodes[u],o=this.items[f],m=this.distance(o,a),this.D++,m<=h&&l.push({distance:m,item:o}),c=this.lefts[u],d=this.rights[u],!(!c&&!d)&&(v=this.mus[u],m=v-h&&n.push(d)):(d&&m>=v-h&&n.push(d),c&&m{var i=Hx(),x=Vx(),T=zF();t.exports={BiMap:GF(),BitSet:VF(),BitVector:HF(),BloomFilter:XF(),BKTree:YF(),CircularBuffer:kF(),DefaultMap:jF(),DefaultWeakMap:KF(),FixedDeque:WM(),StaticDisjointSet:ZF(),FibonacciHeap:x,MinFibonacciHeap:x.MinFibonacciHeap,MaxFibonacciHeap:x.MaxFibonacciHeap,FixedReverseHeap:Wx(),FuzzyMap:JF(),FuzzyMultiMap:$F(),HashedArrayTree:QF(),Heap:i,MinHeap:i.MinHeap,MaxHeap:i.MaxHeap,StaticIntervalTree:_F(),InvertedIndex:tO(),KDTree:eO(),LinkedList:iO(),LRUCache:Xx(),LRUCacheWithDelete:nO(),LRUMap:KM(),LRUMapWithDelete:rO(),MultiMap:XM(),MultiSet:sO(),PassjoinIndex:aO(),Queue:oO(),FixedStack:YM(),Stack:lO(),SuffixArray:T,GeneralizedSuffixArray:T.GeneralizedSuffixArray,Set:hO(),SparseQueueSet:uO(),SparseMap:fO(),SparseSet:cO(),SymSpell:dO(),Trie:pO(),TrieMap:ZM(),Vector:vO(),VPTree:mO()}}),_t=class fr{static get ZERO(){return new fr(0,0)}static get ONE(){return new fr(1,1)}static get UP(){return new fr(0,-1)}static get DOWN(){return new fr(0,1)}static get LEFT(){return new fr(-1,0)}static get RIGHT(){return new fr(1,0)}static get UP_LEFT(){return new fr(-1,-1)}static get UP_RIGHT(){return new fr(1,-1)}static get DOWN_RIGHT(){return new fr(1,1)}static get DOWN_LEFT(){return new fr(-1,1)}constructor(t,i){typeof t=="number"?(this.x=t,this.y=i||0):(this.x=t.x,this.y=t.y)}clone(){return new fr(this.x,this.y)}add(t){return new fr(this.x+t.x,this.y+t.y)}multiply(t){return new fr(this.x*t.x,this.y*t.y)}divide(t){return new fr(this.x/t.x,this.y/t.y)}subtract(t){return new fr(this.x-t.x,this.y-t.y)}equals(t){return this.x===t.x&&this.y===t.y}abs(){return new fr(Math.abs(this.x),Math.abs(this.y))}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}modulo(t){return new fr(this.x%t.x,this.y%t.y)}scalarModulo(t){return new fr(this.x%t,this.y%t)}scalarMult(t){return new fr(this.x*t,this.y*t)}toPosition(){return{x:this.x,y:this.y}}toString(){return`${this.x}#${this.y}`}},Pi=class{static equal(g,t){return g.position.x===t.position.x&&g.position.y===t.position.y&&g.layer===t.layer}static copyOver(g,t){t.position.x=g.position.x,t.position.y=g.position.y,t.layer=g.layer}static clone(g){return{position:g.position.clone(),layer:g.layer}}static toString(g){return`${g.position.toString()}#${g.layer}`}static toInternal(g){return{position:new _t(g.position.x,g.position.y),layer:g.charLayer}}static fromInternal(g){return{position:g.position.toPosition(),charLayer:g.layer}}},yO=(g=>(g.NONE="none",g.LEFT="left",g.UP_LEFT="up-left",g.UP="up",g.UP_RIGHT="up-right",g.RIGHT="right",g.DOWN_RIGHT="down-right",g.DOWN="down",g.DOWN_LEFT="down-left",g))(yO||{}),xO={up:"down",down:"up",left:"right",right:"left",none:"none","up-left":"down-right","up-right":"down-left","down-right":"up-left","down-left":"up-right"},SO={up:_t.UP,down:_t.DOWN,left:_t.LEFT,right:_t.RIGHT,none:_t.ZERO,"up-left":_t.UP_LEFT,"up-right":_t.UP_RIGHT,"down-right":_t.DOWN_RIGHT,"down-left":_t.DOWN_LEFT},pm={up:0,"up-right":1,right:2,"down-right":3,down:4,"down-left":5,left:6,"up-left":7,none:NaN},JM=["up","up-right","right","down-right","down","down-left","left","up-left"],TO=["down-left","down-right","up-right","up-left"];function Yx(){return["up","down","left","right","none","up-left","up-right","down-right","down-left"]}function ad(g){return TO.includes(g)}function EO(g,t=1){return g==="none"?"none":JM[(pm[g]+8-Math.abs(t)%8)%8]}function $M(g,t=1){return g==="none"?"none":JM[(pm[g]+t)%8]}function Mu(g){return SO[g]}function MO(g){return xO[g]}function Ma(g,t){if(g.x===t.x){if(g.y>t.y)return"up";if(g.yt.x)return"left";if(g.xt.x){if(g.yt.y)return"up-left"}else if(g.xt.y)return"up-right"}return"none"}var CO=(g=>(g[g.FOUR=4]="FOUR",g[g.EIGHT=8]="EIGHT",g))(CO||{});function If(g){return typeof g=="string"&&Yx().includes(g)}var Ty=function(g,t){return Ty=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,x){i.__proto__=x}||function(i,x){for(var T in x)Object.prototype.hasOwnProperty.call(x,T)&&(i[T]=x[T])},Ty(g,t)};function kd(g,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ty(g,t);function i(){this.constructor=g}g.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}function wO(g,t,i,x){function T(E){return E instanceof i?E:new i(function(s){s(E)})}return new(i||(i=Promise))(function(E,s){function y(p){try{r(x.next(p))}catch(h){s(h)}}function e(p){try{r(x.throw(p))}catch(h){s(h)}}function r(p){p.done?E(p.value):T(p.value).then(y,e)}r((x=x.apply(g,t||[])).next())})}function QM(g,t){var i={label:0,sent:function(){if(E[0]&1)throw E[1];return E[1]},trys:[],ops:[]},x,T,E,s;return s={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function y(r){return function(p){return e([r,p])}}function e(r){if(x)throw new TypeError("Generator is already executing.");for(;s&&(s=0,r[0]&&(i=0)),i;)try{if(x=1,T&&(E=r[0]&2?T.return:r[0]?T.throw||((E=T.return)&&E.call(T),0):T.next)&&!(E=E.call(T,r[1])).done)return E;switch(T=0,E&&(r=[r[0]&2,E.value]),r[0]){case 0:case 1:E=r;break;case 4:return i.label++,{value:r[1],done:!1};case 5:i.label++,T=r[1],r=[0];continue;case 7:r=i.ops.pop(),i.trys.pop();continue;default:if(E=i.trys,!(E=E.length>0&&E[E.length-1])&&(r[0]===6||r[0]===2)){i=0;continue}if(r[0]===3&&(!E||r[1]>E[0]&&r[1]=g.length&&(g=void 0),{value:g&&g[x++],done:!g}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function md(g,t){var i=typeof Symbol=="function"&&g[Symbol.iterator];if(!i)return g;var x=i.call(g),T,E=[],s;try{for(;(t===void 0||t-- >0)&&!(T=x.next()).done;)E.push(T.value)}catch(y){s={error:y}}finally{try{T&&!T.done&&(i=x.return)&&i.call(x)}finally{if(s)throw s.error}}return E}function gd(g,t,i){if(i||arguments.length===2)for(var x=0,T=t.length,E;x1||y(a,l)})})}function y(a,l){try{e(x[a](l))}catch(n){h(E[0][3],n)}}function e(a){a.value instanceof Wf?Promise.resolve(a.value.v).then(r,p):h(E[0][2],a)}function r(a){y("next",a)}function p(a){y("throw",a)}function h(a,l){a(l),E.shift(),E.length&&y(E[0][0],E[0][1])}}function PO(g){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=g[Symbol.asyncIterator],i;return t?t.call(g):(g=typeof jf=="function"?jf(g):g[Symbol.iterator](),i={},x("next"),x("throw"),x("return"),i[Symbol.asyncIterator]=function(){return this},i);function x(E){i[E]=g[E]&&function(s){return new Promise(function(y,e){s=g[E](s),T(y,e,s.done,s.value)})}}function T(E,s,y,e){Promise.resolve(e).then(function(r){E({value:r,done:y})},s)}}function mr(g){return typeof g=="function"}function _M(g){var t=function(x){Error.call(x),x.stack=new Error().stack},i=g(t);return i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i}var c0=_M(function(g){return function(t){g(this),this.message=t?t.length+` errors occurred during unsubscription: `+t.map(function(i,x){return x+1+") "+i.toString()}).join(` - `):"",this.name="UnsubscriptionError",this.errors=t}});function Ty(g,t){if(g){var i=g.indexOf(t);0<=i&&g.splice(i,1)}}var $m=function(){function g(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return g.prototype.unsubscribe=function(){var t,i,x,T,E;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var y=Kf(s),e=y.next();!e.done;e=y.next()){var r=e.value;r.remove(this)}}catch(u){t={error:u}}finally{try{e&&!e.done&&(i=y.return)&&i.call(y)}finally{if(t)throw t.error}}else s.remove(this);var p=this.initialTeardown;if(mr(p))try{p()}catch(u){E=u instanceof f0?u.errors:[u]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var a=Kf(h),l=a.next();!l.done;l=a.next()){var n=l.value;try{QS(n)}catch(u){E=E??[],u instanceof f0?E=md(md([],vd(E)),vd(u.errors)):E.push(u)}}}catch(u){x={error:u}}finally{try{l&&!l.done&&(T=a.return)&&T.call(a)}finally{if(x)throw x.error}}}if(E)throw new f0(E)}},g.prototype.add=function(t){var i;if(t&&t!==this)if(this.closed)QS(t);else{if(t instanceof g){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(i=this._finalizers)!==null&&i!==void 0?i:[]).push(t)}},g.prototype._hasParent=function(t){var i=this._parentage;return i===t||Array.isArray(i)&&i.includes(t)},g.prototype._addParent=function(t){var i=this._parentage;this._parentage=Array.isArray(i)?(i.push(t),i):i?[i,t]:t},g.prototype._removeParent=function(t){var i=this._parentage;i===t?this._parentage=null:Array.isArray(i)&&Ty(i,t)},g.prototype.remove=function(t){var i=this._finalizers;i&&Ty(i,t),t instanceof g&&t._removeParent(this)},g.EMPTY=function(){var t=new g;return t.closed=!0,t}(),g}(),_M=$m.EMPTY;function qM(g){return g instanceof $m||g&&"closed"in g&&mr(g.remove)&&mr(g.add)&&mr(g.unsubscribe)}function QS(g){mr(g)?g():g.unsubscribe()}var tC={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},AO={setTimeout:function(g,t){for(var i=[],x=2;x0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(i){return this._throwIfClosed(),g.prototype._trySubscribe.call(this,i)},t.prototype._subscribe=function(i){return this._throwIfClosed(),this._checkFinalizedStatuses(i),this._innerSubscribe(i)},t.prototype._innerSubscribe=function(i){var x=this,T=this,E=T.hasError,s=T.isStopped,y=T.observers;return E||s?_M:(this.currentObservers=null,y.push(i),new $m(function(){x.currentObservers=null,Ty(y,i)}))},t.prototype._checkFinalizedStatuses=function(i){var x=this,T=x.hasError,E=x.thrownError,s=x.isStopped;T?i.error(E):s&&i.complete()},t.prototype.asObservable=function(){var i=new wa;return i.source=this,i},t.create=function(i,x){return new qS(i,x)},t}(wa),qS=function(g){Yd(t,g);function t(i,x){var T=g.call(this)||this;return T.destination=i,T.source=x,T}return t.prototype.next=function(i){var x,T;(T=(x=this.destination)===null||x===void 0?void 0:x.next)===null||T===void 0||T.call(x,i)},t.prototype.error=function(i){var x,T;(T=(x=this.destination)===null||x===void 0?void 0:x.error)===null||T===void 0||T.call(x,i)},t.prototype.complete=function(){var i,x;(x=(i=this.destination)===null||i===void 0?void 0:i.complete)===null||x===void 0||x.call(i)},t.prototype._subscribe=function(i){var x,T;return(T=(x=this.source)===null||x===void 0?void 0:x.subscribe(i))!==null&&T!==void 0?T:_M},t}(In),rC=new wa(function(g){return g.complete()});function UO(g){return g&&mr(g.schedule)}function sC(g){return g[g.length-1]}function aC(g){return UO(sC(g))?g.pop():void 0}function oC(g,t){return typeof sC(g)=="number"?g.pop():t}var lC=function(g){return g&&typeof g.length=="number"&&typeof g!="function"};function hC(g){return mr(g?.then)}function uC(g){return mr(g[Kx])}function fC(g){return Symbol.asyncIterator&&mr(g?.[Symbol.asyncIterator])}function cC(g){return new TypeError("You provided "+(g!==null&&typeof g=="object"?"an invalid object":"'"+g+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function zO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var dC=zO();function pC(g){return mr(g?.[dC])}function vC(g){return CO(this,arguments,function(){var t,i,x,T;return $M(this,function(E){switch(E.label){case 0:t=g.getReader(),E.label=1;case 1:E.trys.push([1,,9,10]),E.label=2;case 2:return[4,Wf(t.read())];case 3:return i=E.sent(),x=i.value,T=i.done,T?[4,Wf(void 0)]:[3,5];case 4:return[2,E.sent()];case 5:return[4,Wf(x)];case 6:return[4,E.sent()];case 7:return E.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function mC(g){return mr(g?.getReader)}function Lu(g){if(g instanceof wa)return g;if(g!=null){if(uC(g))return GO(g);if(lC(g))return VO(g);if(hC(g))return HO(g);if(fC(g))return gC(g);if(pC(g))return WO(g);if(mC(g))return XO(g)}throw cC(g)}function GO(g){return new wa(function(t){var i=g[Kx]();if(mr(i.subscribe))return i.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function VO(g){return new wa(function(t){for(var i=0;i{let T=this.tilePosInDirection(new Qt(i,x),g);return this.tilemap.hasBlockingTile(T,t,TO(g),this.ignoreMissingTiles)})}isCharBlocking(g,t){return this.someCharTile((i,x)=>{let T=this.tilePosInDirection(new Qt(i,x),g);return this.tilemap.hasBlockingChar(T,t,this.getCollisionGroups(),new Set([this.getId()]),this.ignoreCollisionGroups)})}isMoving(){return this.movementDirection!="none"}turnTowards(g){this.isMoving()||g!="none"&&this.changeFacingDirection(g)}changeFacingDirection(g){this.facingDirection!==g&&(this.facingDirection=g,this.directionChanged$.next(g))}getFacingDirection(){return this.facingDirection}getFacingPosition(){return this._tilePos.position.add(Cu(this.facingDirection))}addCollisionGroup(g){this.collisionGroups.add(g)}setCollisionGroups(g){this.collisionGroups=new Set(g)}setIgnoreCollisionGroups(g){this.ignoreCollisionGroups=new Set(g)}getCollisionGroups(){return Array.from(this.collisionGroups)}getIgnoreCollisionGroups(){return Array.from(this.ignoreCollisionGroups)}hasCollisionGroup(g){return this.collisionGroups.has(g)}removeCollisionGroup(g){this.collisionGroups.delete(g)}removeAllCollisionGroups(){this.collisionGroups.clear()}addLabels(g){for(let t of g)this.labels.add(t)}getLabels(){return[...this.labels.values()]}hasLabel(g){return this.labels.has(g)}clearLabels(){this.labels.clear()}removeLabels(g){for(let t of g)this.labels.delete(t)}getNumberOfDirections(){return this.numberOfDirections}movementStarted(){return this.movementStarted$}movementStopped(){return this.movementStopped$}directionChanged(){return this.directionChanged$}tilePositionSet(){return this.tilePositionSet$}positionChangeStarted(){return this.positionChangeStarted$}positionChangeFinished(){return this.positionChangeFinished$}autoMovementSet(){return this.autoMovementSet$}depthChanged(){return this.depthChanged$}getMovementProgress(){return this.movementProgress}setMovementProgress(g){let t=Math.max(0,Math.min(au,g));this.movementProgress=t}hasWalkedHalfATile(){return this.movementProgress>au/2}willCrossTileBorderThisUpdate(g){return this.movementProgress+this.maxProgressForDelta(g)>=au}updateCharacterPosition(g){let t=this.willCrossTileBorderThisUpdate(g),i=1-(t?au-this.movementProgress:this.maxProgressForDelta(g))/this.maxProgressForDelta(g);this.movementProgress=Math.min(this.movementProgress+this.maxProgressForDelta(g),au),t&&(this.movementProgress=0,this.shouldContinueMoving()?(this.fire(this.positionChangeFinished$,this.tilePos,this.getNextTilePos()),this.tilePos=this.getNextTilePos(),this.startMoving(this.lastMovementImpulse),i>0&&this.updateCharacterPosition(g*i)):this.stopMoving())}maxProgressForDelta(g){let t=g/1e3;return Math.floor(t*this.speed*au)}get tilePos(){return Ai.clone(this._tilePos)}set tilePos(g){Ai.copyOver(g,this._tilePos)}startMoving(g){g!=="none"&&(g!=this.movementDirection&&this.movementStarted$.next(g),this.movementDirection=g,this.facingDirection=g,this.fire(this.positionChangeStarted$,this.tilePos,this.getNextTilePos()))}tilePosInDirection(g,t){return g.add(Cu(this.tilemap.toMapDirection(t)))}shouldContinueMoving(){return this.lastMovementImpulse!=="none"&&!this.isBlockingDirection(this.lastMovementImpulse)}stopMoving(){if(this.movementDirection==="none")return;let g=this.tilePos,t=this.getNextTilePos(),i=this.movementDirection;this.tilePos=this.getNextTilePos(),this.movementDirection="none",this.movementStopped$.next(i),this.fire(this.positionChangeFinished$,g,t)}fire(g,{position:t,layer:i},{position:x,layer:T}){g.next({exitTile:t,enterTile:x,exitLayer:i,enterLayer:T})}someCharTile(g){let t=this.getNextTilePos().position;for(let i=t.x;ithis.isLayerAlwaysOnTop(T));this.tilemap.layers.filter(T=>!this.isLayerAlwaysOnTop(T)).forEach(T=>{this.hasLayerProp(T,ou.HEIGHT_SHIFT_PROP_NAME)?(this.createHeightShiftLayers(T,i),t.push(T.tilemapLayer)):this.setDepth(T,++i)}),this.charLayerDepths.set(void 0,i),x.forEach((T,E)=>{T.tilemapLayer.setDepth(E+1+i)}),t.forEach(T=>T.destroy())}setDepth(t,i){t.tilemapLayer.setDepth(i),this.isCharLayer(t)&&this.charLayerDepths.set(this.getLayerProp(t,ou.CHAR_LAYER_PROP_NAME),i)}createHeightShiftLayers(t,i){let x=this.getLayerProp(t,ou.HEIGHT_SHIFT_PROP_NAME);isNaN(x)&&(x=0);let T=1;for(let E=0;ET.name==i);return x?.value}hasLayerProp(t,i){return this.getLayerProp(t,i)!=null}copyLayer(t,i){let x=`${t.name}#${i}`,T=this.tilemap.createBlankLayer(x,t.tilemapLayer.tileset);if(T){if(T.name=x,this.isIsometric())for(let E=i;E>=0;E--){let s=i-E;T.putTileAt(t.data[E][s],s,E)}else for(let E=0;Ey===this.charData.id)).subscribe(({direction:y})=>{var e;(e=this.animation)==null||e.setStandingFrame(y)}),this.sprite&&(this.sprite.setOrigin(0,0),this.resetAnimation(this.sprite),this.updateOverlaySprite(),this.updateGridChar())}destroy(){this.destroy$.next(),this.destroy$.complete(),this.newSpriteSet$.complete()}setSprite(g){g?(this.sprite&&(g.x=this.sprite.x,g.y=this.sprite.y),this.sprite=g,this.newSpriteSet$.next(),this.layerOverlaySprite=this.layerOverlaySprite?this.scene.add.sprite(0,0,this.sprite.texture):void 0,this.updateOverlaySprite(),this.resetAnimation(this.sprite),this.updateDepth()):(this.layerOverlaySprite=void 0,this.sprite=void 0)}getSprite(){return this.sprite}getLayerOverlaySprite(){return this.layerOverlaySprite}setContainer(g){var t;this.container=g,this.cachedContainerHeight=(t=g?.getBounds().height)!=null?t:0}getContainer(){return this.container}getOffsetX(){return this.customOffset.x}setOffsetX(g){this.customOffset.x=g}getOffsetY(){return this.customOffset.y}setOffsetY(g){this.customOffset.y=g}getWalkingAnimationMapping(){return this.walkingAnimationMapping}turnTowards(g){var t;this.geHeadless.isMoving(this.charData.id)||g!="none"&&(this.geHeadless.turnTowards(this.charData.id,g),(t=this.animation)==null||t.setStandingFrame(g))}getAnimation(){return this.animation}setAnimation(g){this.animation=g}update(g){this.updateGridChar()}getEngineOffset(){var g,t,i,x;if(!this.sprite)return Qt.ZERO;let T=this.tilemap.getTileWidth()/2-Math.floor(((t=(g=this.sprite)==null?void 0:g.displayWidth)!=null?t:0)/2),E=-((x=(i=this.sprite)==null?void 0:i.displayHeight)!=null?x:0)+this.tilemap.getTileHeight();return new Qt(T,E)}updatePixelPos(){let g=new Qt(this.geHeadless.getPosition(this.charData.id)),t=this.geHeadless.getMovementProgress(this.charData.id)/1e3,i=this.tilemap.tilePosToPixelPos(g).add(this.getEngineOffset()).add(this.customOffset).add(Cu(this.geHeadless.getFacingDirection(this.charData.id)).multiply(this.tilemap.getTileDistance(this.geHeadless.getFacingDirection(this.charData.id)).scalarMult(t))),x=this.getGameObj();x&&(x.x=Math.floor(i.x),x.y=Math.floor(i.y))}getGameObj(){return this.container||this.sprite}updateGridChar(){var g;if(this.updatePixelPos(),this.sprite&&this.geHeadless.isMoving(this.charData.id)){let t=this.geHeadless.getMovementProgress(this.charData.id)>au/2;(g=this.getAnimation())==null||g.updateCharacterFrame(this.geHeadless.getFacingDirection(this.charData.id),t,Number(this.sprite.frame.name))}this.updateDepth()}resetAnimation(g){let t=new tT(this.walkingAnimationMapping,g.texture.source[0].width/g.width/tT.FRAMES_CHAR_ROW);this.setAnimation(t),t.frameChange().pipe(Ta(this.newSpriteSet$)).subscribe(i=>{g?.setFrame(i)}),t.setIsEnabled(this.walkingAnimationMapping!==void 0),t.setStandingFrame(this.geHeadless.getFacingDirection(this.charData.id))}updateOverlaySprite(){if(!this.layerOverlaySprite||!this.sprite)return;this.layerOverlaySprite.scale=this.sprite.scale;let g=this.tilemap.getTileHeight()/this.layerOverlaySprite.scale;this.layerOverlaySprite.setCrop(0,0,this.layerOverlaySprite.displayWidth,this.sprite.height-g),this.layerOverlaySprite.setOrigin(0,0)}updateDepth(){if(!this.getGameObj())return;let g=new Qt(this.geHeadless.getPosition(this.charData.id)),t=this.geHeadless.getCharLayer(this.charData.id);this.container?this.setContainerDepth(this.container,{position:g,layer:t}):this.sprite&&this.setSpriteDepth(this.sprite,{position:g,layer:t});let i=this.getLayerOverlaySprite();if(i){let x=new Qt(dh(An({},g),{y:g.y-1}));this.setSpriteDepth(i,{position:x,layer:t})}}setSpriteDepth(g,t){g.setDepth(this.tilemap.getDepthOfCharLayer(this.getTransitionLayer(t))+this.getPaddedPixelDepthSprite(g))}setContainerDepth(g,t){g.setDepth(this.tilemap.getDepthOfCharLayer(this.getTransitionLayer(t))+this.getPaddedPixelDepthContainer(g))}getPaddedPixelDepthContainer(g){return wy.shiftPad(g.y+this.cachedContainerHeight,Py.Z_INDEX_PADDING)}getPaddedPixelDepthSprite(g){return wy.shiftPad(g.y+g.displayHeight,Py.Z_INDEX_PADDING)}getTransitionLayer(g){if(g.layer)return this.geHeadless.getTransition(g.position,g.layer)||g.layer}},s4=(g=>(g.DONT_BLOCK="DONT_BLOCK",g.BLOCK_TWO_TILES="BLOCK_TWO_TILES",g.BLOCK_ONE_TILE_AHEAD="BLOCK_ONE_TILE_AHEAD",g.BLOCK_ONE_TILE_BEHIND="BLOCK_ONE_TILE_BEHIND",g))(s4||{}),CC=(g=>(g.STOP="STOP",g.CLOSEST_REACHABLE="CLOSEST_REACHABLE",g.RETRY="RETRY",g.ALTERNATIVE_TARGETS="ALTERNATIVE_TARGETS",g))(CC||{}),a4=class{distance(g,t){return eo.manhattanDistance(g,t)}direction(g,t){if(eo.equal(g,t))return"none";let i=g.clone().subtract(t);return Math.abs(i.x)>Math.abs(i.y)?i.x>0?"left":"right":i.y>0?"up":"down"}neighbors(g){return[new Qt(g.x,g.y+1),new Qt(g.x+1,g.y),new Qt(g.x-1,g.y),new Qt(g.x,g.y-1)]}getDirections(){return["up","right","down","left"]}},o4=class{distance(g,t){return eo.chebyshevDistance(g,t)}neighbors(g){let t=[new Qt(g.x,g.y+1),new Qt(g.x+1,g.y),new Qt(g.x-1,g.y),new Qt(g.x,g.y-1)],i=[new Qt(g.x+1,g.y+1),new Qt(g.x+1,g.y-1),new Qt(g.x-1,g.y+1),new Qt(g.x-1,g.y-1)];return[...t,...i]}direction(g,t){return t.x>g.x?t.y>g.y?"down-right":t.yg.y?"down-left":t.yg.y?"down":"none"}getDirections(){return["up","right","down","left","down-left","down-right","up-right","up-left"]}},gd=class{static create(g){switch(g){case 4:return new a4;case 8:return new o4}}},eT=class{constructor(g,t,i){this.backoffMs=g,this.maxRetries=t,this.onFinished=i,this.retries=0,this.elapsed=0}retry(g,t){this.shouldRetry()?(this.elapsed+=g,this.elapsed>=this.backoffMs&&(this.elapsed=0,this.retries++,t())):this.onFinished()}reset(){this.retries=0,this.elapsed=0}getMaxRetries(){return this.maxRetries}getBackoffMs(){return this.backoffMs}shouldRetry(){return this.maxRetries===-1||this.retries(g.WAIT="WAIT",g.RETRY="RETRY",g.STOP="STOP",g))(wC||{}),Qm=class{constructor(g,{shortestPathAlgorithm:t="BFS",pathWidth:i=1,pathHeight:x=1,numberOfDirections:T=4,isPositionAllowed:E=(u,f)=>!0,collisionGroups:s=[],ignoredChars:y=[],ignoreTiles:e=!1,ignoreMapBounds:r=!1,ignoreBlockedTarget:p=!1,maxPathLength:h=1/0,ignoreLayers:a=!1,considerCosts:l=!1,calculateClosestToTarget:n=!0}={}){this.gridTilemap=g,this.options={shortestPathAlgorithm:t,pathWidth:i,pathHeight:x,numberOfDirections:T,isPositionAllowed:E,collisionGroups:s,ignoredChars:y,ignoreTiles:e,ignoreMapBounds:r,ignoreBlockedTarget:p,maxPathLength:h,ignoreLayers:a,considerCosts:l,calculateClosestToTarget:n},this.ignoredCharsSet=new Set(y)}findShortestPath(g,t){this.options.ignoreLayers&&(this.gridTilemap.fixCacheLayer(g.layer),t.layer=g.layer);let i=this.findShortestPathImpl(g,t);return this.gridTilemap.unfixCacheLayers(),i}getNeighbors(g,t){var i;return gd.create((i=this.options.numberOfDirections)!=null?i:4).neighbors(g.position).map(x=>{let T=g.layer;return this.options.ignoreLayers||(T=this.gridTilemap.getTransition(x,g.layer)),{position:x,layer:T||g.layer}}).filter(x=>!this.isBlocking(g,x)||this.options.ignoreBlockedTarget&&Ai.equal(x,t))}getTransition(g,t){if(!this.options.ignoreLayers)return this.gridTilemap.getTransition(g,t)}getCosts(g,t){if(!this.options.considerCosts)return 1;let i=Ma(t.position,g);return this.gridTilemap.getTileCosts(t,i)}isBlocking(g,t){return!(this.options.ignoreMapBounds||this.gridTilemap.isInRange(t.position))||!this.options.isPositionAllowed(t.position,t.layer)||!this.options.ignoreTiles&&this.hasBlockingTileFrom(g,t,this.options.pathWidth,this.options.pathHeight,this.options.ignoreMapBounds,this.gridTilemap)?!0:this.hasBlockingCharFrom(g,t,this.options.pathWidth,this.options.pathHeight,this.options.collisionGroups,this.ignoredCharsSet,this.gridTilemap)}distance(g,t){return(this.options.numberOfDirections===4?eo.manhattanDistance:eo.chebyshevDistance)(g,t)}getTilePosInDir(g,t){return this.options.ignoreLayers?{position:g.position.add(Cu(this.gridTilemap.toMapDirection(t))),layer:g.layer}:this.gridTilemap.getTilePosInDirection(g,t)}getReverseNeighbors(g,t){var i;let x=gd.create((i=this.options.numberOfDirections)!=null?i:4).neighbors(g.position),T;if(!this.options.ignoreLayers){let E=this.gridTilemap.getReverseTransitions(g.position,g.layer);T=E?[...E]:void 0}return x.map(E=>T?T.map(s=>({position:E,layer:s||g.layer})):[{position:E,layer:g.layer}]).flat().filter(E=>!this.isBlocking(E,g)||this.options.ignoreBlockedTarget&&Ai.equal(g,t))}hasBlockingCharFrom(g,t,i,x,T,E,s){if(i===1&&x===1)return s.hasBlockingChar(t.position,t.layer,T,E);let y=r=>s.hasBlockingChar(r,t.layer,T,E),e=Ma(g.position,t.position);return this.isBlockingMultiTile(g,e,i,x,y)}hasBlockingTileFrom(g,t,i,x,T,E){if(i===1&&x===1)return E.hasBlockingTile(t.position,t.layer,Ma(t.position,g.position),T);let s=Ma(g.position,t.position),y=e=>E.hasBlockingTile(e,t.layer,s,T);return this.isBlockingMultiTile(g,s,i,x,y)}isBlockingMultiTile(g,t,i,x,T){let E={src:new Qt(g.position.x+i,g.position.y),dest:new Qt(g.position.x+i,g.position.y+x-1)},s={src:new Qt(g.position.x-1,g.position.y),dest:new Qt(g.position.x-1,g.position.y+x-1)},y={src:new Qt(g.position.x,g.position.y-1),dest:new Qt(g.position.x+i-1,g.position.y-1)},e={src:new Qt(g.position.x,g.position.y+x),dest:new Qt(g.position.x+i-1,g.position.y+x)};switch(t){case"right":return this.checkLine(E,T);case"left":return this.checkLine(s,T);case"up":return this.checkLine(y,T);case"down":return this.checkLine(e,T);case"up-left":return this.checkLine({src:y.src,dest:new Qt(y.dest.x-1,y.dest.y)},T)||this.checkLine({src:new Qt(s.src.x,s.src.y-1),dest:new Qt(s.dest.x,s.dest.y-1)},T);case"up-right":return this.checkLine({src:new Qt(y.src.x+1,y.src.y),dest:y.dest},T)||this.checkLine({src:new Qt(E.src.x,E.src.y-1),dest:new Qt(E.dest.x,E.dest.y-1)},T);case"down-left":return this.checkLine({src:new Qt(s.src.x,s.src.y+1),dest:new Qt(s.dest.x,s.dest.y+1)},T)||this.checkLine({src:e.src,dest:new Qt(e.dest.x-1,e.dest.y)},T);case"down-right":return this.checkLine({src:new Qt(e.src.x+1,e.src.y),dest:e.dest},T)||this.checkLine({src:new Qt(E.src.x,E.src.y+1),dest:new Qt(E.dest.x,E.dest.y+1)},T)}return!1}checkLine(g,t){for(let i=g.src.x;i<=g.dest.x;i++)for(let x=g.src.y;x<=g.dest.y;x++)if(t(new Qt(i,x)))return!0;return!1}},l4=GM(Vx(),1),h4=class extends Qm{findShortestPathImpl(g,t){let i=this.shortestPathBfs(g,t);return{path:this.returnPath(i.previous,g,t),closestToTarget:i.closestToTarget,steps:i.steps,maxPathLengthReached:i.maxPathLengthReached,algorithmUsed:"A_STAR"}}shortestPathBfs(g,t){let i=new Map,x=new Map,T=new Map,E=new l4.MinFibonacciHeap((r,p)=>Gc(T,r)-Gc(T,p)),s=g,y=this.distance(g.position,t.position),e=0;for(E.push(g),x.set(Ai.toString(g),0),T.set(Ai.toString(g),this.distance(g.position,t.position));E.size>0;){let r=E.pop();if(!r)break;e++;let p=this.distance(r.position,t.position);if(pthis.options.maxPathLength)return{previous:new Map,closestToTarget:s,steps:e,maxPathLengthReached:!0};for(let h of this.getNeighbors(r,t)){let a=Gc(x,r)+this.getCosts(r.position,h),l=Ai.toString(h);(!x.has(l)||a0;){let e=T.dequeue();if(y++,!e)break;let{node:r,dist:p}=e;if(p>this.options.maxPathLength)return{previous:new Map,closestToTarget:E,steps:y,maxPathLengthReached:!0};let h=this.distance(r.position,t.position);if(hthis.lastDist)}step(g,t,i){var x;this.lastDist=i;for(let T of g){let E=Ai.toString(T);if(!this.visited.has(E)){this.previous.set(E,t),this.queue.enqueue({node:T,dist:i+1}),this.visited.set(E,i+1);let s=(x=this.otherBfs)==null?void 0:x.visited.get(E);s!==void 0&&s0,T.queue.size()>0);){let e=x.queue.dequeue();if(!e)break;let{node:r,dist:p}=e;if(p+1+(((i=T.queue.peek())==null?void 0:i.dist)||0)>this.options.maxPathLength)return{previous:x.previous,previous2:T.previous,closestToTarget:this.maybeClosestToTarget(s),steps:E,maxPathLengthReached:!0};let h=this.distance(r.position,t.position);if(hVc(this.f,T)-Vc(this.f,E)),this.openSet.push(g);let x=Ai.toString(g);for(this.g.set(x,0),this.f.set(x,this.distance(g.position,t.position)),this.maxFrontierSize=Math.max(this.maxFrontierSize,this.openSet.size);this.openSet.size>0;){let T=this.openSet.pop();if(!T)break;if(this.steps++,Ai.equal(T,t))return{previous:i,closestToTarget:t,steps:this.steps,maxPathLengthReached:!1};if(Vc(this.g,T)+1>this.options.maxPathLength)return{previous:new Map,closestToTarget:this.closestToTarget,steps:this.steps,maxPathLengthReached:!0};this.updateClosestToTarget(T,t);for(let E of this.getNeighborsInternal(T,i.get(Ai.toString(T)),t)){let s=Ai.toString(E.p),y=Vc(this.g,T)+E.dist;(!this.g.has(s)||y({p:E,dist:1}));let x=this.prune(t,g).filter(E=>!this.isBlockingIgnoreTarget(g,E,i)).map(E=>{let s=this.getTransition(E.position,g.layer);return{position:E.position,layer:s||g.layer}}),T=[];for(let E of x)if(this.isHorizontal(g.position,E.position))T.push({p:E,dist:1});else{let s=this.jump(g,E,i,1,Ma(g.position,E.position));s&&T.push(s)}return T}isBlockingIgnoreTarget(g,t,i){return this.isBlocking(g,t)&&!(this.options.ignoreBlockedTarget&&Ai.equal(t,i))}jump(g,t,i,x,T){if(!this.isBlockingIgnoreTarget(g,t,i))return Ai.equal(t,i)?{p:t,dist:x}:x>=this.maxJumpSize?{p:t,dist:x}:this.getTransition(t.position,g.layer)!==void 0?{p:t,dist:x}:this.hasForced(g,t)?{p:t,dist:x}:(this.updateClosestToTarget(t,i),this.jump(t,this.getTilePosInDir(t,T),i,x+1,T))}isHorizontal(g,t){return g.y===t.y}getForced(g,t,i,x,T,E){let s=[],y=g;return(this.blockOrTrans(y,i)||this.blockOrTrans(i,x))&&this.addIfNotBlocked(s,t,x),(this.blockOrTrans(y,T)||this.blockOrTrans(T,E))&&this.addIfNotBlocked(s,t,E),s}hasForced(g,t){let{topLeft:i,downLeft:x,top:T,bottom:E}=this.normalizedPositions(g,t);return!!((this.blockOrTrans(g,x)||this.blockOrTrans(x,E))&&!this.blockOrTrans(t,E)||(this.blockOrTrans(g,i)||this.blockOrTrans(i,T))&&!this.blockOrTrans(t,T))}prune(g,t){let{right:i,top:x,bottom:T,downLeft:E,topLeft:s}=this.normalizedPositions(g,t);return this.isHorizontal(g.position,t.position)?[i,x,T]:[i,...this.getForced(g,t,E,T,s,x)]}normalizedPositions(g,t){return g.position.xt.position.x?{topLeft:{position:new Qt(t.position.x+1,t.position.y+1),layer:t.layer},downLeft:{position:new Qt(t.position.x+1,t.position.y-1),layer:t.layer},top:{position:new Qt(t.position.x,t.position.y+1),layer:t.layer},bottom:{position:new Qt(t.position.x,t.position.y-1),layer:t.layer},right:{position:new Qt(t.position.x-1,t.position.y),layer:t.layer}}:g.position.y1?this.fillPath(T,E,x):x.push(E),T=E}return x.reverse()}fillPath(g,t,i){let x=g;do{let T=Ma(x.position,t.position);x=this.getTilePosInDir(x,T),i.push(x)}while(!eo.equal(x.position,t.position))}};function Vc(g,t){var i;return(i=g.get(Ai.toString(t)))!=null?i:Number.MAX_VALUE}var f4=class{constructor(g,t,i,x={}){this.character=g,this.gridTilemap=t,this.charToFollow=i;let T={distance:0,noPathFoundStrategy:"STOP",maxPathLength:1/0,shortestPathAlgorithm:"BIDIRECTIONAL_SEARCH",ignoreLayers:!1,considerCosts:x.considerCosts||!1,facingDirection:"none"};this.options=An(An({},T),x),this.options.considerCosts&&this.options.shortestPathAlgorithm!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${this.options.shortestPathAlgorithm}'. It can only be used with A* algorithm.`),this.options.shortestPathAlgorithm==="JPS"&&(this.character.getTileWidth()>1||this.character.getTileHeight()>1)&&console.warn("GridEngine: Pathfinding algorithm 'JPS' can only be used for characters with 'tileWidth' and 'tileHeight' of 1"),this.character=g,this.updateTarget(this.charToFollow.getTilePos().position,this.charToFollow.getTilePos().layer),this.charToFollow.positionChangeStarted().pipe(Ta(this.character.autoMovementSet().pipe(ph(E=>E!==this),qf(1)))).subscribe(({enterTile:E,enterLayer:s})=>{this.updateTarget(E,s)})}update(g){var t;(t=this.targetMovement)==null||t.update(g)}getInfo(){return{type:"Follow",config:{charToFollow:this.charToFollow.getId(),distance:this.options.distance,noPathFoundStrategy:this.options.noPathFoundStrategy,maxPathLength:this.options.maxPathLength,ignoreLayers:this.options.ignoreLayers,facingDirection:this.options.facingDirection,shortestPathAlgorithm:this.options.shortestPathAlgorithm}}}getFacingPos(){let g=pm[this.options.facingDirection]+pm[this.charToFollow.getFacingDirection()],t=JM("up",g),i={x:this.charToFollow.getTilePos().position.x,y:this.charToFollow.getTilePos().position.y};return t==="right"?i.x+=this.charToFollow.getTileWidth()-1:t==="down"?i.y+=this.charToFollow.getTileWidth()-1:t==="down-left"?i.y+=this.charToFollow.getTileWidth()-1:t==="down-right"?(i.y+=this.charToFollow.getTileWidth()-1,i.x+=this.charToFollow.getTileWidth()-1):t==="up-right"&&(i.x+=this.charToFollow.getTileWidth()-1),this.gridTilemap.getTilePosInDirection({position:new Qt(i),layer:this.charToFollow.getTilePos().layer},t).position}updateTarget(g,t){let i=this.options.facingDirection!=="none"&&this.options.distance===0;i&&(g=this.getFacingPos()),this.targetMovement=new OC(this.character,this.gridTilemap,{position:new Qt(g),layer:t},{distance:i?0:this.options.distance+1,config:{algorithm:this.options.shortestPathAlgorithm,noPathFoundStrategy:this.options.noPathFoundStrategy,maxPathLength:this.options.maxPathLength,ignoreLayers:this.options.ignoreLayers,considerCosts:this.options.considerCosts,ignoredChars:[this.charToFollow.getId()]}})}},aT=class{static getRandomInt(g){return Math.floor(Math.random()*Math.floor(g))}},c4=class{constructor(g,t=0,i=-1){this.character=g,this.delay=t,this.radius=i,this.stepSize=0,this.delayLeft=this.delay,this.initialRow=g.getNextTilePos().position.y,this.initialCol=g.getNextTilePos().position.x,this.randomizeStepSize(),this.stepsWalked=0,this.currentMovementDirection="none",this.character.positionChangeStarted().pipe(Ta(this.character.autoMovementSet().pipe(ph(x=>x!==this),qf(1)))).subscribe(()=>{this.stepsWalked++}),this.distanceUtils=gd.create(g.getNumberOfDirections())}update(g){if(this.shouldContinueWalkingCurrentDirection())this.character.move(this.currentMovementDirection);else if(this.delayLeft-=g,this.delayLeft<=0){this.delayLeft=this.delay;let t=this.getFreeRandomDirection();this.stepsWalked=0,this.character.move(t),this.currentMovementDirection=t,this.randomizeStepSize()}}getInfo(){return{type:"Random",config:{delay:this.delay,radius:this.radius}}}shouldContinueWalkingCurrentDirection(){return this.stepsWalked!this.character.isBlockingDirection(g)).filter(g=>this.isWithinRadius(g))}isWithinRadius(g){return this.radius==-1?!0:this.getDist(g)<=this.radius}getDist(g){return this.distanceUtils.distance(this.character.getNextTilePos().position.add(Cu(g)),new Qt(this.initialCol,this.initialRow))}getFreeRandomDirection(){let g=this.getFreeDirections();return g.length==0?"none":g[aT.getRandomInt(g.length)]}randomizeStepSize(){this.stepSize=aT.getRandomInt(this.radius)+1}};function d4(g,t){return g.filter(i=>{var x,T,E,s,y,e;return(x=t.labels)!=null&&x.withAllLabels?(T=t.labels)==null?void 0:T.withAllLabels.every(r=>i.hasLabel(r)):(E=t.labels)!=null&&E.withOneOfLabels?(s=t.labels)==null?void 0:s.withOneOfLabels.some(r=>i.hasLabel(r)):(y=t.labels)!=null&&y.withNoneLabels?!((e=t.labels)!=null&&e.withNoneLabels.some(r=>i.hasLabel(r))):!0})}var RC="2.44.6",p4=class{constructor(g,t){this.collistionStrategy=g,this.collisionGroupRelation=t,this.tilePosToCharacters=new v4,this.charRemoved$=new In}isCharBlockingAt(g,t,i,x=new Set,T=new Set){if(i.length===0)return!1;let E=this.tilePosToCharacters.get(g,t);return!!(E&&E.size>0&&[...E].filter(s=>!x.has(s.getId())).filter(s=>!this.doIntersect(s.getCollisionGroups(),T)).some(s=>i.some(y=>s.getCollisionGroups().some(e=>this.collidesWith(y,e)))))}doIntersect(g,t){for(let i of g)if(t.has(i))return!0;return!1}collidesWith(g,t){return this.collisionGroupRelation?(this.collisionGroupRelation.get(g)||new Set).has(t):g===t}getCharactersAt(g,t){return this.tilePosToCharacters.get(g,t)||new Set}addCharacter(g){this.addTilePositions(g.getTilePos(),g),this.addTilePositions(g.getNextTilePos(),g),this.addPositionChangeSub(g),this.addPositionChangeFinishedSub(g),this.addTilePosSetSub(g)}removeCharacter(g){let t=g.getId();this.charRemoved$.next(t),this.deleteTilePositions(g.getTilePos(),g),this.deleteTilePositions(g.getNextTilePos(),g)}add(g,t,i){let x=this.tilePosToCharacters.get(g,t);x||this.tilePosToCharacters.set(g,t,new Set([i])),x?.add(i)}addTilePosSetSub(g){g.tilePositionSet().pipe(Ta(this.charRemoved(g.getId()))).subscribe(t=>{this.deleteTilePositions(g.getNextTilePos(),g),this.addTilePositions(t,g)})}charRemoved(g){var t;return(t=this.charRemoved$)==null?void 0:t.pipe(qf(1),ph(i=>i==g))}addPositionChangeSub(g){g.positionChangeStarted().pipe(Ta(this.charRemoved(g.getId())),this.posChangeToLayerPos()).subscribe(t=>{this.collistionStrategy==="BLOCK_ONE_TILE_AHEAD"&&this.deleteTilePositions(t.exit,g),this.addTilePositions(t.enter,g)})}addPositionChangeFinishedSub(g){g.positionChangeFinished().pipe(Ta(this.charRemoved(g.getId())),this.posChangeToLayerPos()).subscribe(t=>{this.deleteTilePositions(t.exit,g),this.addTilePositions(t.enter,g)})}addTilePositions(g,t){this.forEachCharTile(g,t,(i,x)=>{this.add(new Qt(i,x),g.layer,t)})}deleteTilePositions(g,t){this.forEachCharTile(g,t,(i,x)=>{var T;(T=this.tilePosToCharacters.get(new Qt(i,x),g.layer))==null||T.delete(t)})}forEachCharTile(g,t,i){let x=g.position;for(let T=x.x;T({enter:{position:new Qt(g.enterTile),layer:g.enterLayer},exit:{position:new Qt(g.exitTile),layer:g.exitLayer}})))}posToString(g,t){return`${g.x}#${g.y}#${t}`}},v4=class{constructor(){this.memo=new Map}set(g,t,i){let x=this.memo.get(g.x);x||(x=new Map,this.memo.set(g.x,x));let T=x.get(g.y);T||(T=new Map,x.set(g.y,T)),T.set(t,i)}get(g,t){let i=this.memo.get(g.x);if(!i)return;let x=i.get(g.y);if(x)return x.get(t)}},jx=class{constructor(g,t,i,x){this.x=g,this.y=t,this.width=i,this.height=x}getX(){return this.x}getY(){return this.y}getWidth(){return this.width}getHeight(){return this.height}isInRange(g){return g.x>=this.x&&g.x=this.y&&g.yi.isCharLayer());for(let i of[...t,void 0]){let x=this.tileCollisionCache.get(i?.getName());if(x===void 0){x=new Array(this.tilemap.getWidth());for(let T=0;T>t&1)==1}var lT="ge_cost",bC=class LC{constructor(t,i,x,T=void 0,E=!1){this.tilemap=t,this.collisionTilePropertyName=i,this.useTileCollisionCache=E,this.characters=new Map,this.transitions=new Map,this.reverseTransitions=new Map,this.collidesPropNames=new Map,this.tileCostPropNames=new Map,this.collisionRelevantLayersFrameCache=new Map,this.charBlockCache=new p4(x,T);for(let s of Yx())this.collidesPropNames.set(s,LC.ONE_WAY_COLLIDE_PROP_PREFIX+s),this.tileCostPropNames.set(s,`${lT}_${s}`);this.useTileCollisionCache&&(this.tileCollisionCache=new g4(t,this),this.tileCollisionCache.rebuild())}fixCacheLayer(t){var i;(i=this.tileCollisionCache)==null||i.fixLayer(t)}unfixCacheLayers(){var t;(t=this.tileCollisionCache)==null||t.unfixLayers()}addCharacter(t){this.characters.set(t.getId(),t);let i=t.getNextTilePos().layer;i===void 0?t.setTilePosition(dh(An({},t.getNextTilePos()),{layer:this.getLowestCharLayer()})):this.getCharLayerNames().includes(i)||console.warn(`Char layer '${i}' of character '${t.getId()}' is unknown.`),this.charBlockCache.addCharacter(t)}removeCharacter(t){let i=this.characters.get(t);i&&(this.charBlockCache.removeCharacter(i),this.characters.delete(t))}getCharacters(){return[...this.characters.values()]}getCharactersAt(t,i){return this.charBlockCache.getCharactersAt(t,i)}rebuildTileCollisionCache(t){var i;(i=this.tileCollisionCache)==null||i.rebuild(t)}hasBlockingTileUncached(t,i,x,T){if(!T&&this.hasNoTileUncached(t,i))return!0;let E=this.getCollisionRelevantLayers(i);for(let s of E)if(this.isLayerBlockingAt(s.getName(),t,x))return!0;return!1}hasBlockingTile(t,i,x,T){var E;let s=(E=this.tileCollisionCache)==null?void 0:E.isBlockingFrom(t.x,t.y,i,x,T);return s!==void 0?s:this.hasBlockingTileUncached(t,i,x,T)}getTransition(t,i){let x=this.transitions.get(t.toString());if(x)return x.get(i)}getReverseTransitions(t,i){let x=this.reverseTransitions.get(t.toString());if(x)return x.get(i)}setTransition(t,i,x){var T,E,s,y,e;this.transitions.has(t.toString())||this.transitions.set(t.toString(),new Map),this.reverseTransitions.has(t.toString())||this.reverseTransitions.set(t.toString(),new Map),(T=this.transitions.get(t.toString()))==null||T.set(i,x),(E=this.reverseTransitions.get(t.toString()))!=null&&E.has(x)||(s=this.reverseTransitions.get(t.toString()))==null||s.set(x,new Set),(e=(y=this.reverseTransitions.get(t.toString()))==null?void 0:y.get(x))==null||e.add(i)}getTransitions(){return new Map([...this.transitions].map(([t,i])=>[t,new Map(i)]))}getTileCosts(t,i){let x=this.getCollisionRelevantLayers(t.layer),T=1;for(let E of x)T=Math.max(T,this.getTileCostsForLayer(dh(An({},t),{layer:E.getName()}),i));return T}getTileCostsForLayer(t,i){let x=this.tilemap.getTileAt(t.position.x,t.position.y,t.layer);return i&&x?.getProperty(this.tileCostPropNames.get(i)||"")||x?.getProperty(lT)||1}hasNoTileUncached(t,i){return!this.getCollisionRelevantLayers(i).some(x=>this.tilemap.hasTileAt(t.x,t.y,x.getName()))}hasNoTile(t,i){var x;let T=(x=this.tileCollisionCache)==null?void 0:x.hasTileAt(t.x,t.y,i);return T!==void 0?T:this.hasNoTileUncached(t,i)}hasBlockingChar(t,i,x,T=new Set,E=new Set){return this.charBlockCache.isCharBlockingAt(t,i,x,T,E)}isInRange(t){return new jx(0,0,this.tilemap.getWidth(),this.tilemap.getHeight()).isInRange(t)}toMapDirection(t){return this.isIsometric()?SO(t):t}fromMapDirection(t){return this.isIsometric()?JM(t):t}isIsometric(){return this.tilemap.getOrientation()==="isometric"}getTilePosInDirection(t,i){let x=t.position.add(Cu(this.toMapDirection(i))),T=this.getTransition(x,t.layer)||t.layer;return{position:x,layer:T}}invalidateFrameCache(){this.collisionRelevantLayersFrameCache.clear()}isLayerBlockingAt(t,i,x){let T=this.tilemap.getTileAt(i.x,i.y,t);return T?!!(T.getProperty(this.collisionTilePropertyName)||x&&T.getProperty(this.collidesPropNames.get(x)||"")):!1}getCharLayerIndexes(){return this.tilemap.getLayers().map((t,i)=>({layer:t,index:i})).filter(({layer:t})=>t.isCharLayer()).map(({index:t})=>t)}findPrevAndCharLayer(t){let i=this.getCharLayerIndexes(),x=this.tilemap.getLayers(),T=i.findIndex(E=>x[E].getProperty(Qv)==t);return T==0?{prevIndex:-1,charLayerIndex:i[T]}:{prevIndex:i[T-1],charLayerIndex:i[T]}}getCollisionRelevantLayers(t){if(!t)return this.tilemap.getLayers();let i=this.collisionRelevantLayersFrameCache.get(t);if(i)return i;let{prevIndex:x,charLayerIndex:T}=this.findPrevAndCharLayer(t),E=this.tilemap.getLayers().slice(x+1,T+1);return this.collisionRelevantLayersFrameCache.set(t,E),E}getLowestCharLayer(){for(let t of this.tilemap.getLayers())if(t.isCharLayer())return t.getProperty(Qv)}getCharLayerNames(){return this.tilemap.getLayers().filter(t=>t.isCharLayer()).map(t=>t.getProperty(Qv)).filter(x4)}};bC.ONE_WAY_COLLIDE_PROP_PREFIX="ge_collide_";var y4=bC;function x4(g){return g!=null}var S4=(g=>(g.REMOVED="REMOVED",g.ADDED="ADDED",g))(S4||{}),T4=(g=>(g.WAIT="WAIT",g.SKIP="SKIP",g.STOP="STOP",g))(T4||{}),E4=class{constructor(g,t){this.character=g,this.tilemap=t,this.queue=new vm,this.finished$=new In,this.pathBlockedWaitElapsed=0,this.distanceUtils=gd.create(g.getNumberOfDirections()),this.character.autoMovementSet().pipe(ph(i=>i!==this),qf(1)).subscribe(()=>{this.queue.size()>0&&this.finishMovementTerminated(),this.finished$.complete()})}update(g){(!this.character.isMoving()||this.character.willCrossTileBorderThisUpdate(g))&&this.queue.size()>0&&this.moveCharOnPath(g)}getInfo(){return{type:"Queue"}}enqueue(g,t={}){var i,x,T;let E={pathBlockedStrategy:(i=t.pathBlockedStrategy)!=null?i:"STOP",pathBlockedWaitTimeoutMs:t?.pathBlockedWaitTimeoutMs||-1,ignoreInvalidPositions:(x=t.ignoreInvalidPositions)!=null?x:!1,skipInvalidPositions:(T=t.skipInvalidPositions)!=null?T:!1};for(let s of g){let y={command:s,config:E};if(If(s)){this.queue.enqueue(y);continue}let e=this.queue.peekEnd(),r=e?.command;if(r||(r=this.character.getNextTilePos()),If(r)){this.queue.enqueue(y);continue}let p=this.distanceUtils.distance(r.position,s.position)===1;(!t.ignoreInvalidPositions||p)&&this.queue.enqueue(y)}}peekAll(){return this.queue.peekAll()}size(){return this.queue.size()}finished(){return this.finished$}clear(){this.queue.clear()}moveCharOnPath(g){let t=this.queue.peek();if(!t)return;let i=t.command,x=t.config;if(If(i)&&(i=this.tilemap.getTilePosInDirection(this.character.getNextTilePos(),i)),x.skipInvalidPositions){if(i=this.getNextValidPosition(),!i){this.finishInvalidNextPos(i);return}}else if(!this.isNeighborPos(i)){this.finishInvalidNextPos(i);return}if(this.character.isBlockingDirection(Ma(this.character.getNextTilePos().position,i.position))){if(x.pathBlockedStrategy==="STOP")this.finishPathBlocked(i);else if(x.pathBlockedStrategy==="SKIP"){this.queue.dequeue(),this.moveCharOnPath(g);return}else x.pathBlockedStrategy==="WAIT"&&x.pathBlockedWaitTimeoutMs>-1&&(this.pathBlockedWaitElapsed+=g,this.pathBlockedWaitElapsed>=x.pathBlockedWaitTimeoutMs&&this.finishBlockedWaitTimeout(i,x.pathBlockedWaitTimeoutMs));return}this.pathBlockedWaitElapsed=0,this.queue.dequeue(),this.character.move(this.getDir(this.character.getNextTilePos().position,i.position)),this.isLastMovement()&&this.finish("SUCCESS","",i)}getNextValidPosition(){for(var g;this.queue.size()>0;){let t=(g=this.queue.peek())==null?void 0:g.command;if(If(t)&&(t=this.tilemap.getTilePosInDirection(this.character.getNextTilePos(),t)),t&&this.isNeighborPos(t))return t;this.queue.dequeue()}}isLastMovement(){return this.queue.size()===0}isNeighborPos(g){let t=this.distanceUtils.distance(this.character.getNextTilePos().position,g.position)===1,i=this.tilemap.getTransition(g.position,this.character.getNextTilePos().layer);if(this.character.getNextTilePos().layer!==g.layer)return t&&i===g.layer;let x=i!==void 0&&i!==g.layer;return t&&!x}finishMovementTerminated(){this.finish("MOVEMENT_TERMINATED","New automatic movement has been set to character.")}finishInvalidNextPos(g){g?this.finish("INVALID_NEXT_POS",`Position ${this.posToStr(g)} is not reachable from ${this.posToStr(this.character.getNextTilePos())}.`):this.finish("INVALID_NEXT_POS",`No enqueued position is reachable from ${this.posToStr(this.character.getNextTilePos())}.`)}finishPathBlocked(g){this.finish("PATH_BLOCKED",`Position ${this.posToStr(g)} is blocked.`)}finishBlockedWaitTimeout(g,t){this.finish("PATH_BLOCKED_WAIT_TIMEOUT",`Position ${this.posToStr(g)} is blocked and the wait timeout of ${t} ms has been exceeded.`)}finish(g,t="",i=this.character.getNextTilePos()){this.queue=new vm,this.finished$.next({position:i.position,result:g,description:t,layer:i.layer})}getDir(g,t){return this.tilemap.fromMapDirection(Ma(g,t))}posToStr(g){return`(${g.position.x}, ${g.position.y}, ${g.layer})`}},M4=class{constructor(g=!0){this.isCreatedInternal=!1,g&&console.log(`Using GridEngine v${RC}`)}getCharLayer(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getTilePos().layer}getTransition(g,t){var i;return this.initGuard(),(i=this.gridTilemap)==null?void 0:i.getTransition(new Qt(g),t)}setTransition(g,t,i){var x;return this.initGuard(),(x=this.gridTilemap)==null?void 0:x.setTransition(new Qt(g),t,i)}create(g,t){this.isCreatedInternal=!0,this.gridCharacters=new Map;let i=this.setConfigDefaults(t);this.config=i,this.movementStopped$=new In,this.movementStarted$=new In,this.directionChanged$=new In,this.positionChangeStarted$=new In,this.positionChangeFinished$=new In,this.queueMovementFinished$=new In,this.charRemoved$=new In,this.charAdded$=new In,this.gridTilemap=new y4(g,this.config.collisionTilePropertyName,this.config.characterCollisionStrategy,this.recordToMap(this.config.collisionGroupRelation),this.config.cacheTileCollisions),this.addCharacters()}recordToMap(g){return g?new Map(Object.entries(g).map(([t,i])=>[t,new Set(i)])):void 0}getPosition(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getTilePos().position}move(g,t){this.moveChar(g,t)}moveRandomly(g,t=0,i=-1){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(g);if(!T)throw this.createCharUnknownErr(g);let E=new c4(T,t,i);T.setMovement(E)}getMovement(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);let x=i.getMovement();return x?x.getInfo():{type:"None"}}moveTo(g,t,i){var x;let T=this.assembleMoveToConfig(i);this.initGuard();let E=(x=this.gridCharacters)==null?void 0:x.get(g);if(!E)throw this.createCharUnknownErr(g);if(!this.gridTilemap)throw this.createUninitializedErr();let s=new OC(E,this.gridTilemap,{position:new Qt(t),layer:i?.targetLayer||E.getNextTilePos().layer},{distance:0,config:T});return E.setMovement(s),s.finishedObs().pipe(od(y=>({charId:g,position:y.position,result:y.result,description:y.description,layer:y.layer})))}stopMovement(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);i.setMovement(void 0)}setSpeed(g,t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(g);if(!x)throw this.createCharUnknownErr(g);x.setSpeed(t)}getSpeed(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getSpeed()}collidesWithTiles(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.collidesWithTiles()}update(g,t){var i;if(this.isCreatedInternal&&this.gridCharacters)for(let[x,T]of this.gridCharacters)T.update(t);(i=this.gridTilemap)==null||i.invalidateFrameCache()}addCharacter(g){var t,i,x,T,E;if(!this.gridTilemap)throw this.createUninitializedErr();if(!this.config)throw this.createUninitializedErr();let s={speed:g.speed||4,tilemap:this.gridTilemap,collidesWithTiles:!0,collisionGroups:["geDefault"],ignoreCollisionGroups:[],charLayer:g.charLayer,facingDirection:g.facingDirection,labels:g.labels,numberOfDirections:(t=g.numberOfDirections)!=null?t:this.config.numberOfDirections,tileWidth:g.tileWidth,tileHeight:g.tileHeight};typeof g.collides=="boolean"?g.collides===!1&&(s.collidesWithTiles=!1,s.collisionGroups=[]):g.collides!==void 0&&(g.collides.collidesWithTiles===!1&&(s.collidesWithTiles=!1),g.collides.collisionGroups&&(s.collisionGroups=g.collides.collisionGroups),g.collides.ignoreCollisionGroups&&(s.ignoreCollisionGroups=g.collides.ignoreCollisionGroups),s.ignoreMissingTiles=(x=(i=g.collides)==null?void 0:i.ignoreMissingTiles)!=null?x:!1);let y=new n4(g.id,s);g.startPosition&&y.setTilePosition({position:new Qt(g.startPosition),layer:y.getTilePos().layer}),(T=this.gridCharacters)==null||T.set(g.id,y),this.gridTilemap.addCharacter(y);let e=y.getId();y.movementStopped().pipe(Ta(this.charRemoved(e))).subscribe(r=>{var p;(p=this.movementStopped$)==null||p.next({charId:e,direction:r})}),y.movementStarted().pipe(Ta(this.charRemoved(e))).subscribe(r=>{var p;(p=this.movementStarted$)==null||p.next({charId:e,direction:r})}),y.directionChanged().pipe(Ta(this.charRemoved(e))).subscribe(r=>{var p;(p=this.directionChanged$)==null||p.next({charId:e,direction:r})}),y.positionChangeStarted().pipe(Ta(this.charRemoved(e))).subscribe(r=>{var p;(p=this.positionChangeStarted$)==null||p.next(An({charId:e},r))}),y.positionChangeFinished().pipe(Ta(this.charRemoved(e))).subscribe(r=>{var p;(p=this.positionChangeFinished$)==null||p.next(An({charId:e},r))}),(E=this.charAdded$)==null||E.next(e)}hasCharacter(g){var t;return this.initGuard(),!!((t=this.gridCharacters)!=null&&t.has(g))}removeCharacter(g){var t,i,x,T;if(this.initGuard(),!((t=this.gridCharacters)!=null&&t.get(g)))throw this.createCharUnknownErr(g);(i=this.gridTilemap)==null||i.removeCharacter(g),(x=this.gridCharacters)==null||x.delete(g),(T=this.charRemoved$)==null||T.next(g)}removeAllCharacters(){if(this.initGuard(),!!this.gridCharacters)for(let g of this.gridCharacters.keys())this.removeCharacter(g)}getAllCharacters(g){if(this.initGuard(),!this.gridCharacters)return[];let t=[...this.gridCharacters.values()];return(g?d4(t,g):t).map(i=>i.getId())}getLabels(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getLabels()}addLabels(g,t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(g);if(!x)throw this.createCharUnknownErr(g);x.addLabels(t)}removeLabels(g,t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(g);if(!x)throw this.createCharUnknownErr(g);x.removeLabels(t)}clearLabels(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);i.clearLabels()}follow(g,t,i,x){var T,E,s,y,e,r;let p;i===void 0?p={distance:0,closestPointIfBlocked:!1}:typeof i=="number"?(p={distance:i,closestPointIfBlocked:!1},x&&(p.closestPointIfBlocked=!0)):p=i,this.initGuard();let h=(T=this.gridCharacters)==null?void 0:T.get(g),a=(E=this.gridCharacters)==null?void 0:E.get(t);if(!h)throw this.createCharUnknownErr(g);if(!a)throw this.createCharUnknownErr(t);if(!this.gridTilemap)throw this.createUninitializedErr();let l=new f4(h,this.gridTilemap,a,{distance:(s=p.distance)!=null?s:0,noPathFoundStrategy:p.closestPointIfBlocked?"CLOSEST_REACHABLE":"STOP",maxPathLength:(y=p.maxPathLength)!=null?y:1/0,shortestPathAlgorithm:(e=p.algorithm)!=null?e:"BIDIRECTIONAL_SEARCH",ignoreLayers:!!p.ignoreLayers,facingDirection:(r=p.facingDirection)!=null?r:"none"});h.setMovement(l)}isMoving(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.isMoving()}getFacingDirection(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getFacingDirection()}getFacingPosition(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);let x=i.getFacingPosition();return{x:x.x,y:x.y}}turnTowards(g,t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(g);if(!x)throw this.createCharUnknownErr(g);return x.turnTowards(t)}getCharactersAt(g,t){if(this.initGuard(),!this.gridTilemap)return[];let i=this.gridTilemap.getCharactersAt(new Qt(g),t);return Array.from(i).map(x=>x.getId())}setPosition(g,t,i){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(g);if(!T)throw this.createCharUnknownErr(g);i||T.setTilePosition({position:new Qt(t),layer:T.getTilePos().layer}),T.setTilePosition({position:new Qt(t),layer:i})}isBlocked(g,t,i=["geDefault"]){var x,T;this.initGuard();let E=new Qt(g);return!!((x=this.gridTilemap)!=null&&x.hasBlockingTile(E,t)||(T=this.gridTilemap)!=null&&T.hasBlockingChar(E,t,i))}isTileBlocked(g,t){var i;return this.initGuard(),!!((i=this.gridTilemap)!=null&&i.hasBlockingTile(new Qt(g),t))}getCollisionGroups(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getCollisionGroups()||[]}setCollisionGroups(g,t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(g);if(!x)throw this.createCharUnknownErr(g);x.setCollisionGroups(t)}getIgnoreCollisionGroups(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getIgnoreCollisionGroups()||[]}setIgnoreCollisionGroups(g,t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(g);if(!x)throw this.createCharUnknownErr(g);x.setIgnoreCollisionGroups(t)}getTilePosInDirection(g,t,i){if(!this.gridTilemap)throw this.createUninitializedErr();let x=this.gridTilemap.getTilePosInDirection({position:new Qt(g),layer:t},i);return{position:x.position.toPosition(),charLayer:x.layer}}findShortestPath(g,t,i={}){if(!this.gridTilemap)throw this.createUninitializedErr();let x=i.shortestPathAlgorithm||"BFS";i.considerCosts&&x!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${x}'. It can only be used with A* algorithm.`);let T=i.pathWidth!==void 0&&i.pathWidth!==1,E=i.pathHeight!==void 0&&i.pathHeight!==1;(T||E)&&x==="JPS"&&console.warn("GridEngine: Pathfinding options 'pathWidth' and 'pathHeight' > 1 cannot be used with algorithm 'JPS'.");let s=new FC(this.gridTilemap).findShortestPath(Ai.toInternal(g),Ai.toInternal(t),dh(An({},i),{shortestPathAlgorithm:x}));return{path:s.path.map(Ai.fromInternal),closestToTarget:s.closestToTarget?Ai.fromInternal(s.closestToTarget):void 0,reachedMaxPathLength:!1,steps:s.steps}}steppedOn(g,t,i){return this.positionChangeFinished().pipe(ph(x=>g.includes(x.charId)&&t.some(T=>T.x===x.enterTile.x&&T.y===x.enterTile.y)&&(i===void 0||i.includes(x.enterLayer))))}characterShifted(){if(!this.charAdded$||!this.charRemoved$)throw this.createUninitializedErr();return this.charAdded$.pipe(od(g=>({charId:g,action:"ADDED"})),i4(this.charRemoved$.pipe(od(g=>({charId:g,action:"REMOVED"})))))}movementStarted(){if(!this.movementStarted$)throw this.createUninitializedErr();return this.movementStarted$}movementStopped(){if(!this.movementStopped$)throw this.createUninitializedErr();return this.movementStopped$}directionChanged(){if(!this.directionChanged$)throw this.createUninitializedErr();return this.directionChanged$}positionChangeStarted(){if(!this.positionChangeStarted$)throw this.createUninitializedErr();return this.positionChangeStarted$}positionChangeFinished(){if(!this.positionChangeFinished$)throw this.createUninitializedErr();return this.positionChangeFinished$}getMovementProgress(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getMovementProgress()}rebuildTileCollisionCache(g,t,i,x){var T;(T=this.gridTilemap)==null||T.rebuildTileCollisionCache(new jx(g,t,i,x))}addQueueMovements(g,t,i){var x,T;this.initGuard();let E=(x=this.gridCharacters)==null?void 0:x.get(g);if(!E)throw this.createCharUnknownErr(g);if(!this.gridTilemap)throw this.createUninitializedErr();let s;((T=E?.getMovement())==null?void 0:T.getInfo().type)==="Queue"?s=E.getMovement():(s=new E4(E,this.gridTilemap),E.setMovement(s),s.finished().pipe(Ta(_O(this.charRemoved(g),E.autoMovementSet()))).subscribe(y=>{var e;(e=this.queueMovementFinished$)==null||e.next(An({charId:g},y))})),s.enqueue(t.map(y=>If(y)?y:{position:new Qt(y.position),layer:y.charLayer}),i)}queueMovementFinished(){if(!this.queueMovementFinished$)throw this.createUninitializedErr();return this.queueMovementFinished$}getEnqueuedMovements(g){var t,i;this.initGuard();let x=(t=this.gridCharacters)==null?void 0:t.get(g);if(!x)throw this.createCharUnknownErr(g);return((i=x.getMovement())==null?void 0:i.getInfo().type)==="Queue"?x.getMovement().peekAll().map(T=>({command:If(T.command)?T.command:Ai.fromInternal(T.command),config:T.config})):[]}clearEnqueuedMovements(g){var t,i;this.initGuard();let x=(t=this.gridCharacters)==null?void 0:t.get(g);if(!x)throw this.createCharUnknownErr(g);((i=x.getMovement())==null?void 0:i.getInfo().type)==="Queue"&&x.getMovement().clear()}getTileCost(g,t,i){var x,T;return this.initGuard(),(T=(x=this.gridTilemap)==null?void 0:x.getTileCosts({position:new Qt(g),layer:t},i))!=null?T:1}getState(){let g=[];if(this.gridCharacters)for(let[t,i]of this.gridCharacters.entries())g.push({id:t,position:Ai.fromInternal(i.getTilePos()),facingDirection:i.getFacingDirection(),speed:i.getSpeed(),labels:i.getLabels(),movementProgress:i.getMovementProgress(),collisionConfig:{collisionGroups:i.getCollisionGroups(),ignoreCollisionGroups:i.getIgnoreCollisionGroups(),collidesWithTiles:i.collidesWithTiles(),ignoreMissingTiles:i.getIgnoreMissingTiles()}});return{characters:g}}setState(g){if(this.gridCharacters)for(let t of g.characters){let i=this.gridCharacters.get(t.id);if(i){let x=i.getTilePos();Ai.equal(x,Ai.toInternal(t.position))||i.setTilePosition(Ai.toInternal(t.position)),i.setSpeed(t.speed),i.turnTowards(t.facingDirection),t.collisionConfig.collisionGroups&&i.setCollisionGroups(t.collisionConfig.collisionGroups),t.collisionConfig.collidesWithTiles!==void 0&&i.setCollidesWithTiles(t.collisionConfig.collidesWithTiles),t.collisionConfig.ignoreMissingTiles!==void 0&&i.setIgnoreMissingTiles(t.collisionConfig.ignoreMissingTiles),i.setMovementProgress(t.movementProgress),i.clearLabels(),i.addLabels(t.labels)}}}charRemoved(g){var t;if(!this.charRemoved$)throw this.createUninitializedErr();return(t=this.charRemoved$)==null?void 0:t.pipe(qf(1),ph(i=>i==g))}initGuard(){if(!this.isCreatedInternal)throw this.createUninitializedErr()}createUninitializedErr(){throw new Error("GridEngine not initialized. You need to call create() first.")}addCharacters(){var g;(g=this.config)==null||g.characters.forEach(t=>this.addCharacter(t))}moveChar(g,t){var i,x,T;this.initGuard();let E=(i=this.gridCharacters)==null?void 0:i.get(g);if(!E)throw this.createCharUnknownErr(g);if(E.getNumberOfDirections()===4){if(!((x=this.gridTilemap)!=null&&x.isIsometric())&&ad(t)){console.warn(`GridEngine: Character '${g}' can't be moved '${t}' in 4 direction mode.`);return}else if((T=this.gridTilemap)!=null&&T.isIsometric()&&!ad(t)){console.warn(`GridEngine: Character '${g}' can't be moved '${t}' in 4 direction isometric mode.`);return}}E.move(t)}createCharUnknownErr(g){return new Error(`Character unknown: ${g}`)}assembleMoveToConfig(g={}){let t=dh(An({},g),{noPathFoundStrategy:"STOP",pathBlockedStrategy:"WAIT"});return g!=null&&g.noPathFoundStrategy&&(Object.values(CC).includes(g.noPathFoundStrategy)?t.noPathFoundStrategy=g.noPathFoundStrategy:console.warn(`GridEngine: Unknown NoPathFoundStrategy '${g.noPathFoundStrategy}'. Falling back to 'STOP'`)),g!=null&&g.pathBlockedStrategy&&(Object.values(wC).includes(g.pathBlockedStrategy)?t.pathBlockedStrategy=g.pathBlockedStrategy:console.warn(`GridEngine: Unknown PathBlockedStrategy '${g.pathBlockedStrategy}'. Falling back to 'WAIT'`)),t}setConfigDefaults(g){return An({collisionTilePropertyName:"ge_collide",numberOfDirections:4,characterCollisionStrategy:"BLOCK_TWO_TILES",cacheTileCollisions:!1},g)}},C4=class extends PC{constructor(g,t={}){super(g,t),this.jumpCache=new hT}findShortestPathImpl(g,t){return this.jumpCache=new hT,super.findShortestPathImpl(g,t)}getNeighborsInternal(g,t,i){if(!t||g.layer!==t.layer)return this.getNeighbors(g,i).map(E=>({p:E,dist:1}));let x=this.prune(t,g).map(E=>{let s=this.getTransition(E.position,g.layer);return{position:E.position,layer:s||g.layer}}),T=[];for(let E of x){let s=this.jump(g,E,i,1,Ma(g.position,E.position));s&&(s.dist=this.distance(g.position,s.p.position),T.push(s))}return T}getForced(g,t){let i=[],{topLeft:x,downLeft:T,top:E,bottom:s,topRight:y,downRight:e}=this.normalizedPositions(g,t),r=Ma(g.position,t.position);return ad(r)?(this.blockOrTrans(g,x)&&(this.addIfNotBlocked(i,t,E),this.addIfNotBlocked(i,t,y),this.blockOrTrans(T,x)&&this.addIfNotBlocked(i,t,x)),this.blockOrTrans(g,T)&&(this.addIfNotBlocked(i,t,s),this.addIfNotBlocked(i,t,e),this.blockOrTrans(x,T)&&this.addIfNotBlocked(i,t,T)),this.blockOrTrans(x,E)&&this.addIfNotBlocked(i,t,E),this.blockOrTrans(T,s)&&this.addIfNotBlocked(i,t,s),this.blockOrTrans(x,y)&&this.addIfNotBlocked(i,t,y),this.blockOrTrans(T,e)&&this.addIfNotBlocked(i,t,e)):((this.blockOrTrans(g,E)||this.blockOrTrans(E,y))&&this.addIfNotBlocked(i,t,y),(this.blockOrTrans(g,s)||this.blockOrTrans(s,e))&&this.addIfNotBlocked(i,t,e),this.blockOrTrans(g,x)&&this.blockOrTrans(g,E)&&(this.addIfNotBlocked(i,t,E),this.addIfNotBlocked(i,t,x)),this.blockOrTrans(g,T)&&this.blockOrTrans(g,s)&&(this.addIfNotBlocked(i,t,s),this.addIfNotBlocked(i,t,T)),this.blockOrTrans(x,E)&&this.blockOrTrans(g,E)&&this.addIfNotBlocked(i,t,E),this.blockOrTrans(T,s)&&this.blockOrTrans(g,s)&&this.addIfNotBlocked(i,t,s)),i}hasForced(g,t){let{topLeft:i,downLeft:x,top:T,bottom:E,topRight:s,downRight:y}=this.normalizedPositions(g,t),e=Ma(g.position,t.position);if(ad(e)){if(this.blockOrTrans(g,i)&&(!this.blockOrTrans(t,T)||!this.blockOrTrans(t,s)||this.blockOrTrans(x,i)&&!this.blockOrTrans(t,i))||this.blockOrTrans(g,x)&&(!this.blockOrTrans(t,E)||!this.blockOrTrans(t,y)||this.blockOrTrans(i,x)&&!this.blockOrTrans(t,x))||this.blockOrTrans(i,T)&&!this.blockOrTrans(t,T)||this.blockOrTrans(x,E)&&!this.blockOrTrans(t,E)||this.blockOrTrans(i,s)&&!this.blockOrTrans(t,s)||this.blockOrTrans(x,y)&&!this.blockOrTrans(t,y))return!0}else if((this.blockOrTrans(g,T)||this.blockOrTrans(T,s))&&!this.blockOrTrans(t,s)||(this.blockOrTrans(g,E)||this.blockOrTrans(E,y))&&!this.blockOrTrans(t,y)||this.blockOrTrans(g,i)&&this.blockOrTrans(g,T)&&(!this.blockOrTrans(t,T)||!this.blockOrTrans(t,i))||this.blockOrTrans(g,x)&&this.blockOrTrans(g,E)&&(!this.blockOrTrans(t,E)||!this.blockOrTrans(t,x))||this.blockOrTrans(i,T)&&this.blockOrTrans(g,T)&&!this.blockOrTrans(t,T)||this.blockOrTrans(x,E)&&this.blockOrTrans(g,E)&&!this.blockOrTrans(t,E))return!0;return!1}prune(g,t){let{top:i,right:x,topRight:T,downRight:E,bottom:s}=this.normalizedPositions(g,t),y=this.getForced(g,t),e=Ma(g.position,t.position);return ad(e)?[i,x,T,E,s,...y]:[x,...y]}jump(g,t,i,x,T){let E=this.jumpCache.get(g,t);if(E!==null)return E;if(this.isBlocking(g,t)&&!(Ai.equal(t,i)&&this.options.ignoreBlockedTarget)){this.jumpCache.set(g,t,void 0);return}if(Ai.equal(t,i))return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(x>=this.maxJumpSize)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(this.getTransition(t.position,g.layer)!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(this.hasForced(g,t))return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(this.updateClosestToTarget(t,i),T==="up-left"){if(this.jump(t,this.getTilePosInDir(t,"up"),i,x+1,"up")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(this.jump(t,this.getTilePosInDir(t,"left"),i,x+1,"left")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0}}else if(T==="down-left"){if(this.jump(t,this.getTilePosInDir(t,"down"),i,x+1,"down")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(this.jump(t,this.getTilePosInDir(t,"left"),i,x+1,"left")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0}}else if(T==="up-right"){if(this.jump(t,this.getTilePosInDir(t,"up"),i,x+1,"up")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(this.jump(t,this.getTilePosInDir(t,"right"),i,x+1,"right")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0}}else if(T==="down-right"){if(this.jump(t,this.getTilePosInDir(t,"down"),i,x+1,"down")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(this.jump(t,this.getTilePosInDir(t,"right"),i,x+1,"right")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0}}let s=this.jump(t,this.getTilePosInDir(t,T),i,x+1,T);return this.jumpCache.set(g,t,s),s}normalizedPositions(g,t){return g.position.xt.position.x&&g.position.y===t.position.y?{topLeft:{position:new Qt(t.position.x+1,t.position.y+1),layer:t.layer},downLeft:{position:new Qt(t.position.x+1,t.position.y-1),layer:t.layer},top:{position:new Qt(t.position.x,t.position.y+1),layer:t.layer},bottom:{position:new Qt(t.position.x,t.position.y-1),layer:t.layer},right:{position:new Qt(t.position.x-1,t.position.y),layer:t.layer},topRight:{position:new Qt(t.position.x-1,t.position.y+1),layer:t.layer},downRight:{position:new Qt(t.position.x-1,t.position.y-1),layer:t.layer}}:g.position.yt.position.y&&g.position.x===t.position.x?{topLeft:{position:new Qt(t.position.x-1,t.position.y+1),layer:t.layer},downLeft:{position:new Qt(t.position.x+1,t.position.y+1),layer:t.layer},top:{position:new Qt(t.position.x-1,t.position.y),layer:t.layer},bottom:{position:new Qt(t.position.x+1,t.position.y),layer:t.layer},right:{position:new Qt(t.position.x,t.position.y-1),layer:t.layer},topRight:{position:new Qt(t.position.x-1,t.position.y-1),layer:t.layer},downRight:{position:new Qt(t.position.x+1,t.position.y-1),layer:t.layer}}:g.position.yt.position.x?{topLeft:{position:new Qt(t.position.x+1,t.position.y),layer:t.layer},downLeft:{position:new Qt(t.position.x,t.position.y-1),layer:t.layer},top:{position:new Qt(t.position.x+1,t.position.y+1),layer:t.layer},bottom:{position:new Qt(t.position.x-1,t.position.y-1),layer:t.layer},right:{position:new Qt(t.position.x-1,t.position.y+1),layer:t.layer},topRight:{position:new Qt(t.position.x,t.position.y+1),layer:t.layer},downRight:{position:new Qt(t.position.x-1,t.position.y),layer:t.layer}}:g.position.y>t.position.y&&g.position.x(g.SUCCESS="SUCCESS",g.NO_PATH_FOUND_MAX_RETRIES_EXCEEDED="NO_PATH_FOUND_MAX_RETRIES_EXCEEDED",g.PATH_BLOCKED_MAX_RETRIES_EXCEEDED="PATH_BLOCKED_MAX_RETRIES_EXCEEDED",g.PATH_BLOCKED="PATH_BLOCKED",g.NO_PATH_FOUND="NO_PATH_FOUND",g.PATH_BLOCKED_WAIT_TIMEOUT="PATH_BLOCKED_WAIT_TIMEOUT",g.MOVEMENT_TERMINATED="MOVEMENT_TERMINATED",g.MAX_PATH_LENGTH_REACHED="MAX_PATH_LENGTH_REACHED",g))(A4||{}),OC=class{constructor(g,t,i,{config:x,ignoreBlockedTarget:T=!1,distance:E=0}={}){this.character=g,this.tilemap=t,this.targetPos=i,this.shortestPath=[],this.distOffset=0,this.posOnPath=0,this.stopped=!1,this.pathBlockedWaitElapsed=0,this.isPositionAllowed=()=>!0,this.shortestPathAlgorithm="BIDIRECTIONAL_SEARCH",this.maxPathLength=1/0,this.considerCosts=!1,this.ignoredChars=[],this.isBlocking=(e,r)=>e?new AC(this.tilemap,this.getPathfindingOptions()).isBlocking(this.character.getTilePos(),{position:e,layer:r}):!0;var s,y;this.shortestPathAlgorithm=(s=x?.algorithm)!=null?s:this.shortestPathAlgorithm,this.ignoreBlockedTarget=T,this.distance=E,this.noPathFoundStrategy=x?.noPathFoundStrategy||"STOP",this.pathBlockedStrategy=x?.pathBlockedStrategy||"WAIT",this.noPathFoundRetryable=new eT(x?.noPathFoundRetryBackoffMs||200,x?.noPathFoundMaxRetries||-1,()=>{this.stop("NO_PATH_FOUND_MAX_RETRIES_EXCEEDED")}),this.pathBlockedRetryable=new eT(x?.pathBlockedRetryBackoffMs||200,x?.pathBlockedMaxRetries||-1,()=>{this.stop("PATH_BLOCKED_MAX_RETRIES_EXCEEDED")}),x!=null&&x.isPositionAllowedFn&&(this.isPositionAllowed=x.isPositionAllowedFn),x!=null&&x.maxPathLength&&(this.maxPathLength=x.maxPathLength),this.alternativeTargets=x?.alternativeTargets,this.noPathFoundAlternativeTargetsFallbackStrategy=x?.noPathFoundAlternativeTargetsFallbackStrategy,x!=null&&x.considerCosts&&this.shortestPathAlgorithm!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${this.shortestPathAlgorithm}'. It can only be used with A* algorithm.`),this.shortestPathAlgorithm==="JPS"&&(this.character.getTileWidth()>1||this.character.getTileHeight()>1)&&console.warn("GridEngine: Pathfinding algorithm 'JPS' can only be used for characters with 'tileWidth' and 'tileHeight' of 1"),this.considerCosts=x?.considerCosts||!1,this.ignoreLayers=!!(x!=null&&x.ignoreLayers),this.distanceUtils=gd.create(g.getNumberOfDirections()),this.pathBlockedWaitTimeoutMs=x?.pathBlockedWaitTimeoutMs||-1,this.ignoredChars=(y=x?.ignoredChars)!=null?y:[],this.finished$=new In,this.setCharacter(g)}setPathBlockedStrategy(g){this.pathBlockedStrategy=g}getPathBlockedStrategy(){return this.pathBlockedStrategy}setCharacter(g){this.character=g,this.noPathFoundRetryable.reset(),this.pathBlockedRetryable.reset(),this.pathBlockedWaitElapsed=0,this.calcShortestPath(),this.character.autoMovementSet().pipe(ph(t=>t!==this),qf(1)).subscribe(()=>{this.stop("MOVEMENT_TERMINATED")})}getPathfindingOptions(){return{shortestPathAlgorithm:this.shortestPathAlgorithm,pathWidth:this.character.getTileWidth(),pathHeight:this.character.getTileHeight(),numberOfDirections:this.character.getNumberOfDirections(),isPositionAllowed:this.isPositionAllowed,collisionGroups:this.character.getCollisionGroups(),ignoredChars:[this.character.getId(),...this.ignoredChars],ignoreTiles:!this.character.collidesWithTiles(),ignoreMapBounds:this.character.getIgnoreMissingTiles(),ignoreBlockedTarget:this.ignoreBlockedTarget,maxPathLength:this.maxPathLength,ignoreLayers:this.ignoreLayers,considerCosts:this.considerCosts,calculateClosestToTarget:!0}}update(g){var t,i,x,T;this.stopped||(this.noPathFound()&&(this.noPathFoundStrategy==="RETRY"?this.noPathFoundRetryable.retry(g,()=>this.calcShortestPath()):this.noPathFoundStrategy==="STOP"&&this.stop("NO_PATH_FOUND")),this.updatePosOnPath(),this.isBlocking((t=this.nextTileOnPath())==null?void 0:t.position,(i=this.character)==null?void 0:i.getNextTilePos().layer)?this.applyPathBlockedStrategy(g):this.pathBlockedWaitElapsed=0,this.hasArrived()?(this.stop("SUCCESS"),this.existsDistToTarget()&&this.turnTowardsTarget()):this.isBlocking((x=this.nextTileOnPath())==null?void 0:x.position,(T=this.character)==null?void 0:T.getNextTilePos().layer)||this.moveCharOnPath())}finishedObs(){return this.finished$}getInfo(){return{type:"Target",state:{pathAhead:this.shortestPath.slice(this.posOnPath).map(g=>Ai.fromInternal(g))},config:{algorithm:this.shortestPathAlgorithm,ignoreBlockedTarget:this.ignoreBlockedTarget,distance:this.distance,targetPos:Ai.fromInternal(this.targetPos),noPathFoundStrategy:this.noPathFoundStrategy,pathBlockedStrategy:this.pathBlockedStrategy,noPathFoundRetryBackoffMs:this.noPathFoundRetryable.getBackoffMs(),noPathFoundMaxRetries:this.noPathFoundRetryable.getMaxRetries()}}}resultToReason(g){switch(g){case"SUCCESS":return"Successfully arrived.";case"MOVEMENT_TERMINATED":return"Movement of character has been replaced before destination was reached.";case"PATH_BLOCKED":return"PathBlockedStrategy STOP: Path blocked.";case"NO_PATH_FOUND_MAX_RETRIES_EXCEEDED":return`NoPathFoundStrategy RETRY: Maximum retries of ${this.noPathFoundRetryable.getMaxRetries()} exceeded.`;case"NO_PATH_FOUND":return"NoPathFoundStrategy STOP: No path found.";case"PATH_BLOCKED_MAX_RETRIES_EXCEEDED":return`PathBlockedStrategy RETRY: Maximum retries of ${this.pathBlockedRetryable.getMaxRetries()} exceeded.`;case"PATH_BLOCKED_WAIT_TIMEOUT":return`PathBlockedStrategy WAIT: Wait timeout of ${this.pathBlockedWaitTimeoutMs}ms exceeded.`}}applyPathBlockedStrategy(g){this.pathBlockedStrategy==="RETRY"?this.pathBlockedRetryable.retry(g,()=>{let t=this.getShortestPath();t.path.length>0&&this.calcShortestPath(t)}):this.pathBlockedStrategy==="STOP"?this.stop("PATH_BLOCKED"):this.pathBlockedStrategy==="WAIT"&&this.pathBlockedWaitTimeoutMs>-1&&(this.pathBlockedWaitElapsed+=g,this.pathBlockedWaitElapsed>=this.pathBlockedWaitTimeoutMs&&this.stop("PATH_BLOCKED_WAIT_TIMEOUT"))}moveCharOnPath(){let g=this.nextTileOnPath();if(!g)return;let t=this.getDir(this.character.getNextTilePos().position,g.position);this.character.move(t)}nextTileOnPath(){return this.shortestPath[this.posOnPath+1]}stop(g){this.finished$.next({position:this.character.getTilePos().position,result:g,description:this.resultToReason(g),layer:this.character.getTilePos().layer}),this.finished$.complete(),this.stopped=!0}turnTowardsTarget(){let g=this.shortestPath[this.posOnPath+1],t=this.getDir(this.character.getNextTilePos().position,g.position);this.character.turnTowards(t)}existsDistToTarget(){return this.posOnPath=this.shortestPath.length-1}updatePosOnPath(){let g=this.shortestPath[this.posOnPath];for(;this.posOnPath0)return{path:E,distOffset:s}}return this.noPathFoundStrategy=this.noPathFoundAlternativeTargetsFallbackStrategy||"STOP",this.getShortestPath()}}return{path:i,distOffset:0}}pathToAlternativeTarget(g,t){let i=t.findShortestPath(this.character.getNextTilePos(),g,this.getPathfindingOptions()).path,x=this.distanceUtils.distance(g.position,this.targetPos.position);return{path:i,distOffset:x}}getDir(g,t){return this.tilemap.fromMapDirection(this.distanceUtils.direction(g,t))}},P4=Object.create,DC=Object.defineProperty,R4=Object.getOwnPropertyDescriptor,b4=Object.getOwnPropertyNames,L4=Object.getPrototypeOf,F4=Object.prototype.hasOwnProperty,O4=(g,t)=>()=>(t||g((t={exports:{}}).exports,t),t.exports),D4=(g,t,i,x)=>{if(t&&typeof t=="object"||typeof t=="function")for(let T of b4(t))!F4.call(g,T)&&T!==i&&DC(g,T,{get:()=>t[T],enumerable:!(x=R4(t,T))||x.enumerable});return g},Zx=(g,t,i)=>(i=g!=null?P4(L4(g)):{},D4(t||!g||!g.__esModule?DC(i,"default",{value:g,enumerable:!0}):i,g)),Jx=O4((g,t)=>{(function(){var i,x="4.17.21",T=200,E="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",y="Invalid `variable` option passed into `_.template`",e="__lodash_hash_undefined__",r=500,p="__lodash_placeholder__",h=1,a=2,l=4,n=1,u=2,f=1,o=2,c=4,d=8,v=16,m=32,S=64,M=128,w=256,C=512,A=30,P="...",b=800,O=16,I=1,D=2,B=3,G=1/0,z=9007199254740991,X=17976931348623157e292,K=NaN,Q=4294967295,tt=Q-1,Y=Q>>>1,Z=[["ary",M],["bind",f],["bindKey",o],["curry",d],["curryRight",v],["flip",C],["partial",m],["partialRight",S],["rearg",w]],U="[object Arguments]",H="[object Array]",J="[object AsyncFunction]",_="[object Boolean]",q="[object Date]",at="[object DOMException]",ot="[object Error]",rt="[object Function]",gt="[object GeneratorFunction]",yt="[object Map]",Et="[object Number]",At="[object Null]",Pt="[object Object]",Vt="[object Promise]",dt="[object Proxy]",ut="[object RegExp]",Rt="[object Set]",Dt="[object String]",Ht="[object Symbol]",Bt="[object Undefined]",ne="[object WeakMap]",oe="[object WeakSet]",ge="[object ArrayBuffer]",xe="[object DataView]",Ae="[object Float32Array]",qt="[object Float64Array]",Ge="[object Int8Array]",Oe="[object Int16Array]",Be="[object Int32Array]",Le="[object Uint8Array]",ie="[object Uint8ClampedArray]",Ke="[object Uint16Array]",ri="[object Uint32Array]",Ti=/\b__p \+= '';/g,le=/\b(__p \+=) '' \+/g,xi=/(__e\(.*?\)|\b__t\)) \+\n'';/g,bt=/&(?:amp|lt|gt|quot|#39);/g,Me=/[&<>"']/g,Ce=RegExp(bt.source),Ve=RegExp(Me.source),Je=/<%-([\s\S]+?)%>/g,zi=/<%([\s\S]+?)%>/g,Di=/<%=([\s\S]+?)%>/g,en=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Zn=/^\w*$/,Gi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,di=/[\\^$.*+?()[\]{}|]/g,Wi=RegExp(di.source),Pa=/^\s+/,aa=/\s/,Bs=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Qr=/\{\n\/\* \[wrapped with (.+)\] \*/,ao=/,? & /,_r=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Us=/[()=,{}\[\]\/\s]/,xs=/\\(\\)?/g,oo=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Rl=/\w*$/,Tt=/^[-+]0x[0-9a-f]+$/i,jt=/^0b[01]+$/i,_t=/^\[object .+?Constructor\]$/,ee=/^0o[0-7]+$/i,te=/^(?:0|[1-9]\d*)$/,Te=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ue=/($^)/,We=/['\n\r\u2028\u2029\\]/g,$e="\\ud800-\\udfff",qe="\\u0300-\\u036f",ii="\\ufe20-\\ufe2f",ai="\\u20d0-\\u20ff",Ji=qe+ii+ai,hn="\\u2700-\\u27bf",ki="a-z\\xdf-\\xf6\\xf8-\\xff",gn="\\xac\\xb1\\xd7\\xf7",ti="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Se="\\u2000-\\u206f",Nr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",mi="A-Z\\xc0-\\xd6\\xd8-\\xde",un="\\ufe0e\\ufe0f",Ii=gn+ti+Se+Nr,Gn="['’]",pn="["+$e+"]",Ki="["+Ii+"]",dr="["+Ji+"]",zs="\\d+",Tn="["+hn+"]",oa="["+ki+"]",Jn="[^"+$e+Ii+zs+hn+ki+mi+"]",Ra="\\ud83c[\\udffb-\\udfff]",Gs="(?:"+dr+"|"+Ra+")",lo="[^"+$e+"]",ba="(?:\\ud83c[\\udde6-\\uddff]){2}",ho="[\\ud800-\\udbff][\\udc00-\\udfff]",gi="["+mi+"]",La="\\u200d",Bu="(?:"+oa+"|"+Jn+")",oc="(?:"+gi+"|"+Jn+")",rr="(?:"+Gn+"(?:d|ll|m|re|s|t|ve))?",Vs="(?:"+Gn+"(?:D|LL|M|RE|S|T|VE))?",Hs=Gs+"?",Ws="["+un+"]?",bl="(?:"+La+"(?:"+[lo,ba,ho].join("|")+")"+Ws+Hs+")*",Ni="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Pn="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Br=Ws+Hs+bl,uo="(?:"+[Tn,ba,ho].join("|")+")"+Br,Wo="(?:"+[lo+dr+"?",dr,ba,ho,pn].join("|")+")",Eh=RegExp(Gn,"g"),nn=RegExp(dr,"g"),Xo=RegExp(Ra+"(?="+Ra+")|"+Wo+Br,"g"),Ss=RegExp([gi+"?"+oa+"+"+rr+"(?="+[Ki,gi,"$"].join("|")+")",oc+"+"+Vs+"(?="+[Ki,gi+Bu,"$"].join("|")+")",gi+"?"+Bu+"+"+rr,gi+"+"+Vs,Pn,Ni,zs,uo].join("|"),"g"),Yo=RegExp("["+La+$e+Ji+un+"]"),Uu=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fo=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],xr=-1,ji={};ji[Ae]=ji[qt]=ji[Ge]=ji[Oe]=ji[Be]=ji[Le]=ji[ie]=ji[Ke]=ji[ri]=!0,ji[U]=ji[H]=ji[ge]=ji[_]=ji[xe]=ji[q]=ji[ot]=ji[rt]=ji[yt]=ji[Et]=ji[Pt]=ji[ut]=ji[Rt]=ji[Dt]=ji[ne]=!1;var Zi={};Zi[U]=Zi[H]=Zi[ge]=Zi[xe]=Zi[_]=Zi[q]=Zi[Ae]=Zi[qt]=Zi[Ge]=Zi[Oe]=Zi[Be]=Zi[yt]=Zi[Et]=Zi[Pt]=Zi[ut]=Zi[Rt]=Zi[Dt]=Zi[Ht]=Zi[Le]=Zi[ie]=Zi[Ke]=Zi[ri]=!0,Zi[ot]=Zi[rt]=Zi[ne]=!1;var Ts={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Ur={"&":"&","<":"<",">":">",'"':""","'":"'"},Ll={"&":"&","<":"<",">":">",""":'"',"'":"'"},Mh={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ko=parseFloat,Fl=parseInt,zr=typeof global=="object"&&global&&global.Object===Object&&global,lc=typeof self=="object"&&self&&self.Object===Object&&self,yn=zr||lc||Function("return this")(),Ch=typeof g=="object"&&g&&!g.nodeType&&g,Rn=Ch&&typeof t=="object"&&t&&!t.nodeType&&t,Fa=Rn&&Rn.exports===Ch,Oa=Fa&&zr.process,En=function(){try{var ct=Rn&&Rn.require&&Rn.require("util").types;return ct||Oa&&Oa.binding&&Oa.binding("util")}catch{}}(),Da=En&&En.isArrayBuffer,Ia=En&&En.isDate,Ol=En&&En.isMap,Dl=En&&En.isRegExp,Na=En&&En.isSet,Xs=En&&En.isTypedArray;function $i(ct,St,vt){switch(vt.length){case 0:return ct.call(St);case 1:return ct.call(St,vt[0]);case 2:return ct.call(St,vt[0],vt[1]);case 3:return ct.call(St,vt[0],vt[1],vt[2])}return ct.apply(St,vt)}function Wr(ct,St,vt,Ft){for(var Lt=-1,Ut=ct==null?0:ct.length;++Lt-1}function la(ct,St,vt){for(var Ft=-1,Lt=ct==null?0:ct.length;++Ft-1;);return vt}function po(ct,St){for(var vt=ct.length;vt--&&ts(St,ct[vt],0)>-1;);return vt}function is(ct,St){for(var vt=ct.length,Ft=0;vt--;)ct[vt]===St&&++Ft;return Ft}var zu=ar(Ts),Jo=ar(Ur);function ns(ct){return"\\"+Mh[ct]}function cn(ct,St){return ct==null?i:ct[St]}function Cs(ct){return Yo.test(ct)}function lr(ct){return Uu.test(ct)}function vo(ct){for(var St,vt=[];!(St=ct.next()).done;)vt.push(St.value);return vt}function Ga(ct){var St=-1,vt=Array(ct.size);return ct.forEach(function(Ft,Lt){vt[++St]=[Lt,Ft]}),vt}function Va(ct,St){return function(vt){return ct(St(vt))}}function Qn(ct,St){for(var vt=-1,Ft=ct.length,Lt=0,Ut=[];++vt-1}function Vu(R,N){var k=this.__data__,nt=To(k,R);return nt<0?(++this.size,k.push([R,N])):k[nt][1]=N,this}ks.prototype.clear=Tp,ks.prototype.delete=dc,ks.prototype.get=Ep,ks.prototype.has=Mp,ks.prototype.set=Vu;function ws(R){var N=-1,k=R==null?0:R.length;for(this.clear();++N=N?R:N)),R}function ss(R,N,k,nt,ft,xt){var Ot,Gt=N&h,kt=N&a,fe=N&l;if(k&&(Ot=ft?k(R,nt,ft,xt):k(R)),Ot!==i)return Ot;if(!Dn(R))return R;var ce=Si(R);if(ce){if(Ot=qA(R),!Gt)return Rr(R,Ot)}else{var ye=Yr(R),Ie=ye==rt||ye==gt;if($l(R))return Dc(R,Gt);if(ye==Pt||ye==U||Ie&&!ft){if(Ot=kt||Ie?{}:Z1(R),!Gt)return kt?Gp(R,bp(Ot,R)):Vg(R,xc(Ot,R))}else{if(!Zi[ye])return ft?R:{};Ot=tP(R,ye,Gt)}}xt||(xt=new qn);var je=xt.get(R);if(je)return je;xt.set(R,Ot),MS(R)?R.forEach(function(hi){Ot.add(ss(hi,N,k,hi,R,xt))}):TS(R)&&R.forEach(function(hi,Bi){Ot.set(Bi,ss(hi,N,k,Bi,R,xt))});var li=fe?kt?Ui:Yn:kt?Ls:Lr,Fi=ce?i:li(R);return xn(Fi||R,function(hi,Bi){Fi&&(Bi=hi,hi=R[Bi]),Ks(Ot,Bi,ss(hi,N,k,Bi,R,xt))}),Ot}function Sc(R){var N=Lr(R);return function(k){return Yu(k,R,N)}}function Yu(R,N,k){var nt=k.length;if(R==null)return!nt;for(R=It(R);nt--;){var ft=k[nt],xt=N[ft],Ot=R[ft];if(Ot===i&&!(ft in R)||!xt(Ot))return!1}return!0}function Tc(R,N,k){if(typeof R!="function")throw new $t(s);return Uc(function(){R.apply(i,k)},N)}function tl(R,N,k,nt){var ft=-1,xt=Sr,Ot=!0,Gt=R.length,kt=[],fe=N.length;if(!Gt)return kt;k&&(N=Qi(N,or(k))),nt?(xt=la,Ot=!1):N.length>=T&&(xt=Hn,Ot=!1,N=new So(N));t:for(;++ftft?0:ft+k),nt=nt===i||nt>ft?ft:Ri(nt),nt<0&&(nt+=ft),nt=k>nt?0:wS(nt);k0&&k(Gt)?N>1?hr(Gt,N-1,k,nt,ft):Xr(ft,Gt):nt||(ft[ft.length]=Gt)}return ft}var Hl=nf(),Bh=nf(!0);function as(R,N){return R&&Hl(R,N,Lr)}function Wl(R,N){return R&&Bh(R,N,Lr)}function el(R,N){return Mn(N,function(k){return al(R[k])})}function Zs(R,N){N=Po(N,R);for(var k=0,nt=N.length;R!=null&&kN}function Op(R,N){return R!=null&&me.call(R,N)}function Mc(R,N){return R!=null&&N in It(R)}function zg(R,N,k){return R>=Er(N,k)&&R<_n(N,k)}function Xl(R,N,k){for(var nt=k?la:Sr,ft=R[0].length,xt=R.length,Ot=xt,Gt=vt(xt),kt=1/0,fe=[];Ot--;){var ce=R[Ot];Ot&&N&&(ce=Qi(ce,or(N))),kt=Er(ce.length,kt),Gt[Ot]=!k&&(N||ft>=120&&ce.length>=120)?new So(Ot&&ce):i}ce=R[0];var ye=-1,Ie=Gt[0];t:for(;++ye-1;)Gt!==R&&yo.call(Gt,kt,1),yo.call(R,kt,1);return R}function wr(R,N){for(var k=R?N.length:0,nt=k-1;k--;){var ft=N[k];if(k==nt||ft!==xt){var xt=ft;sl(ft)?yo.call(R,ft,1):Lc(R,ft)}}return R}function va(R,N){return R+bh(fc()*(N-R+1))}function As(R,N,k,nt){for(var ft=-1,xt=_n(Rh((N-R)/(k||1)),0),Ot=vt(xt);xt--;)Ot[nt?xt:++ft]=R,R+=k;return Ot}function Jl(R,N){var k="";if(!R||N<1||N>z)return k;do N%2&&(k+=R),N=bh(N/2),N&&(R+=R);while(N);return k}function ei(R,N){return jg(Q1(R,N,Fs),R+"")}function Dp(R){return Ih(of(R))}function Pc(R,N){var k=of(R);return Wp(k,Eo(N,0,k.length))}function nl(R,N,k,nt){if(!Dn(R))return R;N=Po(N,R);for(var ft=-1,xt=N.length,Ot=xt-1,Gt=R;Gt!=null&&++ftft?0:ft+N),k=k>ft?ft:k,k<0&&(k+=ft),ft=N>k?0:k-N>>>0,N>>>=0;for(var xt=vt(ft);++nt>>1,Ot=R[xt];Ot!==null&&!$s(Ot)&&(k?Ot<=N:Ot=T){var fe=N?null:br(R);if(fe)return Ha(fe);Ot=!1,ft=Hn,kt=new So}else kt=N?[]:Gt;t:for(;++nt=nt?R:ls(R,N,k)}var Up=Ph||function(R){return yn.clearTimeout(R)};function Dc(R,N){if(N)return R.slice();var k=R.length,nt=mo?mo(k):new R.constructor(k);return R.copy(nt),nt}function tf(R){var N=new R.constructor(R.byteLength);return new Cn(N).set(new Cn(R)),N}function Gg(R,N){var k=N?tf(R.buffer):R.buffer;return new R.constructor(k,R.byteOffset,R.byteLength)}function Ps(R){var N=new R.constructor(R.source,Rl.exec(R));return N.lastIndex=R.lastIndex,N}function Ic(R){return Xa?It(Xa.call(R)):{}}function zp(R,N){var k=N?tf(R.buffer):R.buffer;return new R.constructor(k,R.byteOffset,R.length)}function Ka(R,N){if(R!==N){var k=R!==i,nt=R===null,ft=R===R,xt=$s(R),Ot=N!==i,Gt=N===null,kt=N===N,fe=$s(N);if(!Gt&&!fe&&!xt&&R>N||xt&&Ot&&kt&&!Gt&&!fe||nt&&Ot&&kt||!k&&kt||!ft)return 1;if(!nt&&!xt&&!fe&&R=Gt)return kt;var fe=k[nt];return kt*(fe=="desc"?-1:1)}}return R.index-N.index}function bo(R,N,k,nt){for(var ft=-1,xt=R.length,Ot=k.length,Gt=-1,kt=N.length,fe=_n(xt-Ot,0),ce=vt(kt+fe),ye=!nt;++Gt1?k[ft-1]:i,Ot=ft>2?k[2]:i;for(xt=R.length>3&&typeof xt=="function"?(ft--,xt):i,Ot&&us(k[0],k[1],Ot)&&(xt=ft<3?i:xt,ft=1),N=It(N);++nt-1?ft[xt?N[Ot]:Ot]:i}}function it(R){return Ci(function(N){var k=N.length,nt=k,ft=Mr.prototype.thru;for(R&&N.reverse();nt--;){var xt=N[nt];if(typeof xt!="function")throw new $t(s);if(ft&&!Ot&&rf(xt)=="wrapper")var Ot=new Mr([],!0)}for(nt=Ot?nt:k;++nt1&&Vi.reverse(),ce&&ktGt))return!1;var fe=xt.get(R),ce=xt.get(N);if(fe&&ce)return fe==N&&ce==R;var ye=-1,Ie=!0,je=k&u?new So:i;for(xt.set(R,N),xt.set(N,R);++ye1?"& ":"")+N[nt],N=N.join(k>2?", ":" "),R.replace(Bs,`{ + `):"",this.name="UnsubscriptionError",this.errors=t}});function Ey(g,t){if(g){var i=g.indexOf(t);0<=i&&g.splice(i,1)}}var Qm=function(){function g(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return g.prototype.unsubscribe=function(){var t,i,x,T,E;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var y=jf(s),e=y.next();!e.done;e=y.next()){var r=e.value;r.remove(this)}}catch(u){t={error:u}}finally{try{e&&!e.done&&(i=y.return)&&i.call(y)}finally{if(t)throw t.error}}else s.remove(this);var p=this.initialTeardown;if(mr(p))try{p()}catch(u){E=u instanceof c0?u.errors:[u]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var a=jf(h),l=a.next();!l.done;l=a.next()){var n=l.value;try{$S(n)}catch(u){E=E??[],u instanceof c0?E=gd(gd([],md(E)),md(u.errors)):E.push(u)}}}catch(u){x={error:u}}finally{try{l&&!l.done&&(T=a.return)&&T.call(a)}finally{if(x)throw x.error}}}if(E)throw new c0(E)}},g.prototype.add=function(t){var i;if(t&&t!==this)if(this.closed)$S(t);else{if(t instanceof g){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(i=this._finalizers)!==null&&i!==void 0?i:[]).push(t)}},g.prototype._hasParent=function(t){var i=this._parentage;return i===t||Array.isArray(i)&&i.includes(t)},g.prototype._addParent=function(t){var i=this._parentage;this._parentage=Array.isArray(i)?(i.push(t),i):i?[i,t]:t},g.prototype._removeParent=function(t){var i=this._parentage;i===t?this._parentage=null:Array.isArray(i)&&Ey(i,t)},g.prototype.remove=function(t){var i=this._finalizers;i&&Ey(i,t),t instanceof g&&t._removeParent(this)},g.EMPTY=function(){var t=new g;return t.closed=!0,t}(),g}(),qM=Qm.EMPTY;function tC(g){return g instanceof Qm||g&&"closed"in g&&mr(g.remove)&&mr(g.add)&&mr(g.unsubscribe)}function $S(g){mr(g)?g():g.unsubscribe()}var eC={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},RO={setTimeout:function(g,t){for(var i=[],x=2;x0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(i){return this._throwIfClosed(),g.prototype._trySubscribe.call(this,i)},t.prototype._subscribe=function(i){return this._throwIfClosed(),this._checkFinalizedStatuses(i),this._innerSubscribe(i)},t.prototype._innerSubscribe=function(i){var x=this,T=this,E=T.hasError,s=T.isStopped,y=T.observers;return E||s?qM:(this.currentObservers=null,y.push(i),new Qm(function(){x.currentObservers=null,Ey(y,i)}))},t.prototype._checkFinalizedStatuses=function(i){var x=this,T=x.hasError,E=x.thrownError,s=x.isStopped;T?i.error(E):s&&i.complete()},t.prototype.asObservable=function(){var i=new wa;return i.source=this,i},t.create=function(i,x){return new _S(i,x)},t}(wa),_S=function(g){kd(t,g);function t(i,x){var T=g.call(this)||this;return T.destination=i,T.source=x,T}return t.prototype.next=function(i){var x,T;(T=(x=this.destination)===null||x===void 0?void 0:x.next)===null||T===void 0||T.call(x,i)},t.prototype.error=function(i){var x,T;(T=(x=this.destination)===null||x===void 0?void 0:x.error)===null||T===void 0||T.call(x,i)},t.prototype.complete=function(){var i,x;(x=(i=this.destination)===null||i===void 0?void 0:i.complete)===null||x===void 0||x.call(i)},t.prototype._subscribe=function(i){var x,T;return(T=(x=this.source)===null||x===void 0?void 0:x.subscribe(i))!==null&&T!==void 0?T:qM},t}(In),sC=new wa(function(g){return g.complete()});function GO(g){return g&&mr(g.schedule)}function aC(g){return g[g.length-1]}function oC(g){return GO(aC(g))?g.pop():void 0}function lC(g,t){return typeof aC(g)=="number"?g.pop():t}var hC=function(g){return g&&typeof g.length=="number"&&typeof g!="function"};function uC(g){return mr(g?.then)}function fC(g){return mr(g[jx])}function cC(g){return Symbol.asyncIterator&&mr(g?.[Symbol.asyncIterator])}function dC(g){return new TypeError("You provided "+(g!==null&&typeof g=="object"?"an invalid object":"'"+g+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function VO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var pC=VO();function vC(g){return mr(g?.[pC])}function mC(g){return AO(this,arguments,function(){var t,i,x,T;return QM(this,function(E){switch(E.label){case 0:t=g.getReader(),E.label=1;case 1:E.trys.push([1,,9,10]),E.label=2;case 2:return[4,Wf(t.read())];case 3:return i=E.sent(),x=i.value,T=i.done,T?[4,Wf(void 0)]:[3,5];case 4:return[2,E.sent()];case 5:return[4,Wf(x)];case 6:return[4,E.sent()];case 7:return E.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function gC(g){return mr(g?.getReader)}function bu(g){if(g instanceof wa)return g;if(g!=null){if(fC(g))return HO(g);if(hC(g))return WO(g);if(uC(g))return XO(g);if(cC(g))return yC(g);if(vC(g))return YO(g);if(gC(g))return kO(g)}throw dC(g)}function HO(g){return new wa(function(t){var i=g[jx]();if(mr(i.subscribe))return i.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function WO(g){return new wa(function(t){for(var i=0;i{let T=this.tilePosInDirection(new _t(i,x),g);return this.tilemap.hasBlockingTile(T,t,MO(g),this.ignoreMissingTiles)})}isCharBlocking(g,t){return this.someCharTile((i,x)=>{let T=this.tilePosInDirection(new _t(i,x),g);return this.tilemap.hasBlockingChar(T,t,this.getCollisionGroups(),new Set([this.getId()]),this.ignoreCollisionGroups)})}isMoving(){return this.movementDirection!="none"}turnTowards(g){this.isMoving()||g!="none"&&this.changeFacingDirection(g)}changeFacingDirection(g){this.facingDirection!==g&&(this.facingDirection=g,this.directionChanged$.next(g))}getFacingDirection(){return this.facingDirection}getFacingPosition(){return this._tilePos.position.add(Mu(this.facingDirection))}addCollisionGroup(g){this.collisionGroups.add(g)}setCollisionGroups(g){this.collisionGroups=new Set(g)}setIgnoreCollisionGroups(g){this.ignoreCollisionGroups=new Set(g)}getCollisionGroups(){return Array.from(this.collisionGroups)}getIgnoreCollisionGroups(){return Array.from(this.ignoreCollisionGroups)}hasCollisionGroup(g){return this.collisionGroups.has(g)}removeCollisionGroup(g){this.collisionGroups.delete(g)}removeAllCollisionGroups(){this.collisionGroups.clear()}addLabels(g){for(let t of g)this.labels.add(t)}getLabels(){return[...this.labels.values()]}hasLabel(g){return this.labels.has(g)}clearLabels(){this.labels.clear()}removeLabels(g){for(let t of g)this.labels.delete(t)}getNumberOfDirections(){return this.numberOfDirections}movementStarted(){return this.movementStarted$}movementStopped(){return this.movementStopped$}directionChanged(){return this.directionChanged$}tilePositionSet(){return this.tilePositionSet$}positionChangeStarted(){return this.positionChangeStarted$}positionChangeFinished(){return this.positionChangeFinished$}autoMovementSet(){return this.autoMovementSet$}depthChanged(){return this.depthChanged$}getMovementProgress(){return this.movementProgress}setMovementProgress(g){let t=Math.max(0,Math.min(su,g));this.movementProgress=t}hasWalkedHalfATile(){return this.movementProgress>su/2}willCrossTileBorderThisUpdate(g){return this.movementProgress+this.maxProgressForDelta(g)>=su}updateCharacterPosition(g){let t=this.willCrossTileBorderThisUpdate(g),i=1-(t?su-this.movementProgress:this.maxProgressForDelta(g))/this.maxProgressForDelta(g);this.movementProgress=Math.min(this.movementProgress+this.maxProgressForDelta(g),su),t&&(this.movementProgress=0,this.shouldContinueMoving()?(this.fire(this.positionChangeFinished$,this.tilePos,this.getNextTilePos()),this.tilePos=this.getNextTilePos(),this.startMoving(this.lastMovementImpulse),i>0&&this.updateCharacterPosition(g*i)):this.stopMoving())}maxProgressForDelta(g){let t=g/1e3;return Math.floor(t*this.speed*su)}get tilePos(){return Pi.clone(this._tilePos)}set tilePos(g){Pi.copyOver(g,this._tilePos)}startMoving(g){g!=="none"&&(g!=this.movementDirection&&this.movementStarted$.next(g),this.movementDirection=g,this.facingDirection=g,this.fire(this.positionChangeStarted$,this.tilePos,this.getNextTilePos()))}tilePosInDirection(g,t){return g.add(Mu(this.tilemap.toMapDirection(t)))}shouldContinueMoving(){return this.lastMovementImpulse!=="none"&&!this.isBlockingDirection(this.lastMovementImpulse)}stopMoving(){if(this.movementDirection==="none")return;let g=this.tilePos,t=this.getNextTilePos(),i=this.movementDirection;this.tilePos=this.getNextTilePos(),this.movementDirection="none",this.movementStopped$.next(i),this.fire(this.positionChangeFinished$,g,t)}fire(g,{position:t,layer:i},{position:x,layer:T}){g.next({exitTile:t,enterTile:x,exitLayer:i,enterLayer:T})}someCharTile(g){let t=this.getNextTilePos().position;for(let i=t.x;ithis.isLayerAlwaysOnTop(T));this.tilemap.layers.filter(T=>!this.isLayerAlwaysOnTop(T)).forEach(T=>{this.hasLayerProp(T,au.HEIGHT_SHIFT_PROP_NAME)?(this.createHeightShiftLayers(T,i),t.push(T.tilemapLayer)):this.setDepth(T,++i)}),this.charLayerDepths.set(void 0,i),x.forEach((T,E)=>{T.tilemapLayer.setDepth(E+1+i)}),t.forEach(T=>T.destroy())}setDepth(t,i){t.tilemapLayer.setDepth(i),this.isCharLayer(t)&&this.charLayerDepths.set(this.getLayerProp(t,au.CHAR_LAYER_PROP_NAME),i)}createHeightShiftLayers(t,i){let x=this.getLayerProp(t,au.HEIGHT_SHIFT_PROP_NAME);isNaN(x)&&(x=0);let T=1;for(let E=0;ET.name==i);return x?.value}hasLayerProp(t,i){return this.getLayerProp(t,i)!=null}copyLayer(t,i){let x=`${t.name}#${i}`,T=this.tilemap.createBlankLayer(x,t.tilemapLayer.tileset);if(T){if(T.name=x,this.isIsometric())for(let E=i;E>=0;E--){let s=i-E;T.putTileAt(t.data[E][s],s,E)}else for(let E=0;Ey===this.charData.id)).subscribe(({direction:y})=>{var e;(e=this.animation)==null||e.setStandingFrame(y)}),this.sprite&&(this.sprite.setOrigin(0,0),this.resetAnimation(this.sprite),this.updateOverlaySprite(),this.updateGridChar())}destroy(){this.destroy$.next(),this.destroy$.complete(),this.newSpriteSet$.complete()}setSprite(g){g?(this.sprite&&(g.x=this.sprite.x,g.y=this.sprite.y),this.sprite=g,this.newSpriteSet$.next(),this.layerOverlaySprite=this.layerOverlaySprite?this.scene.add.sprite(0,0,this.sprite.texture):void 0,this.updateOverlaySprite(),this.resetAnimation(this.sprite),this.updateDepth()):(this.layerOverlaySprite=void 0,this.sprite=void 0)}getSprite(){return this.sprite}getLayerOverlaySprite(){return this.layerOverlaySprite}setContainer(g){var t;this.container=g,this.cachedContainerHeight=(t=g?.getBounds().height)!=null?t:0}getContainer(){return this.container}getOffsetX(){return this.customOffset.x}setOffsetX(g){this.customOffset.x=g}getOffsetY(){return this.customOffset.y}setOffsetY(g){this.customOffset.y=g}getWalkingAnimationMapping(){return this.walkingAnimationMapping}turnTowards(g){var t;this.geHeadless.isMoving(this.charData.id)||g!="none"&&(this.geHeadless.turnTowards(this.charData.id,g),(t=this.animation)==null||t.setStandingFrame(g))}getAnimation(){return this.animation}setAnimation(g){this.animation=g}update(g){this.updateGridChar()}getEngineOffset(){var g,t,i,x;if(!this.sprite)return _t.ZERO;let T=this.tilemap.getTileWidth()/2-Math.floor(((t=(g=this.sprite)==null?void 0:g.displayWidth)!=null?t:0)/2),E=-((x=(i=this.sprite)==null?void 0:i.displayHeight)!=null?x:0)+this.tilemap.getTileHeight();return new _t(T,E)}updatePixelPos(){let g=new _t(this.geHeadless.getPosition(this.charData.id)),t=this.geHeadless.getMovementProgress(this.charData.id)/1e3,i=this.tilemap.tilePosToPixelPos(g).add(this.getEngineOffset()).add(this.customOffset).add(Mu(this.geHeadless.getFacingDirection(this.charData.id)).multiply(this.tilemap.getTileDistance(this.geHeadless.getFacingDirection(this.charData.id)).scalarMult(t))),x=this.getGameObj();x&&(x.x=Math.floor(i.x),x.y=Math.floor(i.y))}getGameObj(){return this.container||this.sprite}updateGridChar(){var g;if(this.updatePixelPos(),this.sprite&&this.geHeadless.isMoving(this.charData.id)){let t=this.geHeadless.getMovementProgress(this.charData.id)>su/2;(g=this.getAnimation())==null||g.updateCharacterFrame(this.geHeadless.getFacingDirection(this.charData.id),t,Number(this.sprite.frame.name))}this.updateDepth()}resetAnimation(g){let t=new qS(this.walkingAnimationMapping,g.texture.source[0].width/g.width/qS.FRAMES_CHAR_ROW);this.setAnimation(t),t.frameChange().pipe(Ta(this.newSpriteSet$)).subscribe(i=>{g?.setFrame(i)}),t.setIsEnabled(this.walkingAnimationMapping!==void 0),t.setStandingFrame(this.geHeadless.getFacingDirection(this.charData.id))}updateOverlaySprite(){if(!this.layerOverlaySprite||!this.sprite)return;this.layerOverlaySprite.scale=this.sprite.scale;let g=this.tilemap.getTileHeight()/this.layerOverlaySprite.scale;this.layerOverlaySprite.setCrop(0,0,this.layerOverlaySprite.displayWidth,this.sprite.height-g),this.layerOverlaySprite.setOrigin(0,0)}updateDepth(){if(!this.getGameObj())return;let g=new _t(this.geHeadless.getPosition(this.charData.id)),t=this.geHeadless.getCharLayer(this.charData.id);this.container?this.setContainerDepth(this.container,{position:g,layer:t}):this.sprite&&this.setSpriteDepth(this.sprite,{position:g,layer:t});let i=this.getLayerOverlaySprite();if(i){let x=new _t(dh(An({},g),{y:g.y-1}));this.setSpriteDepth(i,{position:x,layer:t})}}setSpriteDepth(g,t){g.setDepth(this.tilemap.getDepthOfCharLayer(this.getTransitionLayer(t))+this.getPaddedPixelDepthSprite(g))}setContainerDepth(g,t){g.setDepth(this.tilemap.getDepthOfCharLayer(this.getTransitionLayer(t))+this.getPaddedPixelDepthContainer(g))}getPaddedPixelDepthContainer(g){return Ay.shiftPad(g.y+this.cachedContainerHeight,Ry.Z_INDEX_PADDING)}getPaddedPixelDepthSprite(g){return Ay.shiftPad(g.y+g.displayHeight,Ry.Z_INDEX_PADDING)}getTransitionLayer(g){if(g.layer)return this.geHeadless.getTransition(g.position,g.layer)||g.layer}},o4=(g=>(g.DONT_BLOCK="DONT_BLOCK",g.BLOCK_TWO_TILES="BLOCK_TWO_TILES",g.BLOCK_ONE_TILE_AHEAD="BLOCK_ONE_TILE_AHEAD",g.BLOCK_ONE_TILE_BEHIND="BLOCK_ONE_TILE_BEHIND",g))(o4||{}),wC=(g=>(g.STOP="STOP",g.CLOSEST_REACHABLE="CLOSEST_REACHABLE",g.RETRY="RETRY",g.ALTERNATIVE_TARGETS="ALTERNATIVE_TARGETS",g))(wC||{}),l4=class{distance(g,t){return eo.manhattanDistance(g,t)}direction(g,t){if(eo.equal(g,t))return"none";let i=g.clone().subtract(t);return Math.abs(i.x)>Math.abs(i.y)?i.x>0?"left":"right":i.y>0?"up":"down"}neighbors(g){return[new _t(g.x,g.y+1),new _t(g.x+1,g.y),new _t(g.x-1,g.y),new _t(g.x,g.y-1)]}getDirections(){return["up","right","down","left"]}},h4=class{distance(g,t){return eo.chebyshevDistance(g,t)}neighbors(g){let t=[new _t(g.x,g.y+1),new _t(g.x+1,g.y),new _t(g.x-1,g.y),new _t(g.x,g.y-1)],i=[new _t(g.x+1,g.y+1),new _t(g.x+1,g.y-1),new _t(g.x-1,g.y+1),new _t(g.x-1,g.y-1)];return[...t,...i]}direction(g,t){return t.x>g.x?t.y>g.y?"down-right":t.yg.y?"down-left":t.yg.y?"down":"none"}getDirections(){return["up","right","down","left","down-left","down-right","up-right","up-left"]}},yd=class{static create(g){switch(g){case 4:return new l4;case 8:return new h4}}},tT=class{constructor(g,t,i){this.backoffMs=g,this.maxRetries=t,this.onFinished=i,this.retries=0,this.elapsed=0}retry(g,t){this.shouldRetry()?(this.elapsed+=g,this.elapsed>=this.backoffMs&&(this.elapsed=0,this.retries++,t())):this.onFinished()}reset(){this.retries=0,this.elapsed=0}getMaxRetries(){return this.maxRetries}getBackoffMs(){return this.backoffMs}shouldRetry(){return this.maxRetries===-1||this.retries(g.WAIT="WAIT",g.RETRY="RETRY",g.STOP="STOP",g))(AC||{}),_m=class{constructor(g,{shortestPathAlgorithm:t="BFS",pathWidth:i=1,pathHeight:x=1,numberOfDirections:T=4,isPositionAllowed:E=(u,f)=>!0,collisionGroups:s=[],ignoredChars:y=[],ignoreTiles:e=!1,ignoreMapBounds:r=!1,ignoreBlockedTarget:p=!1,maxPathLength:h=1/0,ignoreLayers:a=!1,considerCosts:l=!1,calculateClosestToTarget:n=!0}={}){this.gridTilemap=g,this.options={shortestPathAlgorithm:t,pathWidth:i,pathHeight:x,numberOfDirections:T,isPositionAllowed:E,collisionGroups:s,ignoredChars:y,ignoreTiles:e,ignoreMapBounds:r,ignoreBlockedTarget:p,maxPathLength:h,ignoreLayers:a,considerCosts:l,calculateClosestToTarget:n},this.ignoredCharsSet=new Set(y)}findShortestPath(g,t){this.options.ignoreLayers&&(this.gridTilemap.fixCacheLayer(g.layer),t.layer=g.layer);let i=this.findShortestPathImpl(g,t);return this.gridTilemap.unfixCacheLayers(),i}getNeighbors(g,t){var i;return yd.create((i=this.options.numberOfDirections)!=null?i:4).neighbors(g.position).map(x=>{let T=g.layer;return this.options.ignoreLayers||(T=this.gridTilemap.getTransition(x,g.layer)),{position:x,layer:T||g.layer}}).filter(x=>!this.isBlocking(g,x)||this.options.ignoreBlockedTarget&&Pi.equal(x,t))}getTransition(g,t){if(!this.options.ignoreLayers)return this.gridTilemap.getTransition(g,t)}getCosts(g,t){if(!this.options.considerCosts)return 1;let i=Ma(t.position,g);return this.gridTilemap.getTileCosts(t,i)}isBlocking(g,t){return!(this.options.ignoreMapBounds||this.gridTilemap.isInRange(t.position))||!this.options.isPositionAllowed(t.position,t.layer)||!this.options.ignoreTiles&&this.hasBlockingTileFrom(g,t,this.options.pathWidth,this.options.pathHeight,this.options.ignoreMapBounds,this.gridTilemap)?!0:this.hasBlockingCharFrom(g,t,this.options.pathWidth,this.options.pathHeight,this.options.collisionGroups,this.ignoredCharsSet,this.gridTilemap)}distance(g,t){return(this.options.numberOfDirections===4?eo.manhattanDistance:eo.chebyshevDistance)(g,t)}getTilePosInDir(g,t){return this.options.ignoreLayers?{position:g.position.add(Mu(this.gridTilemap.toMapDirection(t))),layer:g.layer}:this.gridTilemap.getTilePosInDirection(g,t)}getReverseNeighbors(g,t){var i;let x=yd.create((i=this.options.numberOfDirections)!=null?i:4).neighbors(g.position),T;if(!this.options.ignoreLayers){let E=this.gridTilemap.getReverseTransitions(g.position,g.layer);T=E?[...E]:void 0}return x.map(E=>T?T.map(s=>({position:E,layer:s||g.layer})):[{position:E,layer:g.layer}]).flat().filter(E=>!this.isBlocking(E,g)||this.options.ignoreBlockedTarget&&Pi.equal(g,t))}hasBlockingCharFrom(g,t,i,x,T,E,s){if(i===1&&x===1)return s.hasBlockingChar(t.position,t.layer,T,E);let y=r=>s.hasBlockingChar(r,t.layer,T,E),e=Ma(g.position,t.position);return this.isBlockingMultiTile(g,e,i,x,y)}hasBlockingTileFrom(g,t,i,x,T,E){if(i===1&&x===1)return E.hasBlockingTile(t.position,t.layer,Ma(t.position,g.position),T);let s=Ma(g.position,t.position),y=e=>E.hasBlockingTile(e,t.layer,s,T);return this.isBlockingMultiTile(g,s,i,x,y)}isBlockingMultiTile(g,t,i,x,T){let E={src:new _t(g.position.x+i,g.position.y),dest:new _t(g.position.x+i,g.position.y+x-1)},s={src:new _t(g.position.x-1,g.position.y),dest:new _t(g.position.x-1,g.position.y+x-1)},y={src:new _t(g.position.x,g.position.y-1),dest:new _t(g.position.x+i-1,g.position.y-1)},e={src:new _t(g.position.x,g.position.y+x),dest:new _t(g.position.x+i-1,g.position.y+x)};switch(t){case"right":return this.checkLine(E,T);case"left":return this.checkLine(s,T);case"up":return this.checkLine(y,T);case"down":return this.checkLine(e,T);case"up-left":return this.checkLine({src:y.src,dest:new _t(y.dest.x-1,y.dest.y)},T)||this.checkLine({src:new _t(s.src.x,s.src.y-1),dest:new _t(s.dest.x,s.dest.y-1)},T);case"up-right":return this.checkLine({src:new _t(y.src.x+1,y.src.y),dest:y.dest},T)||this.checkLine({src:new _t(E.src.x,E.src.y-1),dest:new _t(E.dest.x,E.dest.y-1)},T);case"down-left":return this.checkLine({src:new _t(s.src.x,s.src.y+1),dest:new _t(s.dest.x,s.dest.y+1)},T)||this.checkLine({src:e.src,dest:new _t(e.dest.x-1,e.dest.y)},T);case"down-right":return this.checkLine({src:new _t(e.src.x+1,e.src.y),dest:e.dest},T)||this.checkLine({src:new _t(E.src.x,E.src.y+1),dest:new _t(E.dest.x,E.dest.y+1)},T)}return!1}checkLine(g,t){for(let i=g.src.x;i<=g.dest.x;i++)for(let x=g.src.y;x<=g.dest.y;x++)if(t(new _t(i,x)))return!0;return!1}},u4=VM(Vx(),1),f4=class extends _m{findShortestPathImpl(g,t){let i=this.shortestPathBfs(g,t);return{path:this.returnPath(i.previous,g,t),closestToTarget:i.closestToTarget,steps:i.steps,maxPathLengthReached:i.maxPathLengthReached,algorithmUsed:"A_STAR"}}shortestPathBfs(g,t){let i=new Map,x=new Map,T=new Map,E=new u4.MinFibonacciHeap((r,p)=>Gc(T,r)-Gc(T,p)),s=g,y=this.distance(g.position,t.position),e=0;for(E.push(g),x.set(Pi.toString(g),0),T.set(Pi.toString(g),this.distance(g.position,t.position));E.size>0;){let r=E.pop();if(!r)break;e++;let p=this.distance(r.position,t.position);if(pthis.options.maxPathLength)return{previous:new Map,closestToTarget:s,steps:e,maxPathLengthReached:!0};for(let h of this.getNeighbors(r,t)){let a=Gc(x,r)+this.getCosts(r.position,h),l=Pi.toString(h);(!x.has(l)||a0;){let e=T.dequeue();if(y++,!e)break;let{node:r,dist:p}=e;if(p>this.options.maxPathLength)return{previous:new Map,closestToTarget:E,steps:y,maxPathLengthReached:!0};let h=this.distance(r.position,t.position);if(hthis.lastDist)}step(g,t,i){var x;this.lastDist=i;for(let T of g){let E=Pi.toString(T);if(!this.visited.has(E)){this.previous.set(E,t),this.queue.enqueue({node:T,dist:i+1}),this.visited.set(E,i+1);let s=(x=this.otherBfs)==null?void 0:x.visited.get(E);s!==void 0&&s0,T.queue.size()>0);){let e=x.queue.dequeue();if(!e)break;let{node:r,dist:p}=e;if(p+1+(((i=T.queue.peek())==null?void 0:i.dist)||0)>this.options.maxPathLength)return{previous:x.previous,previous2:T.previous,closestToTarget:this.maybeClosestToTarget(s),steps:E,maxPathLengthReached:!0};let h=this.distance(r.position,t.position);if(hVc(this.f,T)-Vc(this.f,E)),this.openSet.push(g);let x=Pi.toString(g);for(this.g.set(x,0),this.f.set(x,this.distance(g.position,t.position)),this.maxFrontierSize=Math.max(this.maxFrontierSize,this.openSet.size);this.openSet.size>0;){let T=this.openSet.pop();if(!T)break;if(this.steps++,Pi.equal(T,t))return{previous:i,closestToTarget:t,steps:this.steps,maxPathLengthReached:!1};if(Vc(this.g,T)+1>this.options.maxPathLength)return{previous:new Map,closestToTarget:this.closestToTarget,steps:this.steps,maxPathLengthReached:!0};this.updateClosestToTarget(T,t);for(let E of this.getNeighborsInternal(T,i.get(Pi.toString(T)),t)){let s=Pi.toString(E.p),y=Vc(this.g,T)+E.dist;(!this.g.has(s)||y({p:E,dist:1}));let x=this.prune(t,g).filter(E=>!this.isBlockingIgnoreTarget(g,E,i)).map(E=>{let s=this.getTransition(E.position,g.layer);return{position:E.position,layer:s||g.layer}}),T=[];for(let E of x)if(this.isHorizontal(g.position,E.position))T.push({p:E,dist:1});else{let s=this.jump(g,E,i,1,Ma(g.position,E.position));s&&T.push(s)}return T}isBlockingIgnoreTarget(g,t,i){return this.isBlocking(g,t)&&!(this.options.ignoreBlockedTarget&&Pi.equal(t,i))}jump(g,t,i,x,T){if(!this.isBlockingIgnoreTarget(g,t,i))return Pi.equal(t,i)?{p:t,dist:x}:x>=this.maxJumpSize?{p:t,dist:x}:this.getTransition(t.position,g.layer)!==void 0?{p:t,dist:x}:this.hasForced(g,t)?{p:t,dist:x}:(this.updateClosestToTarget(t,i),this.jump(t,this.getTilePosInDir(t,T),i,x+1,T))}isHorizontal(g,t){return g.y===t.y}getForced(g,t,i,x,T,E){let s=[],y=g;return(this.blockOrTrans(y,i)||this.blockOrTrans(i,x))&&this.addIfNotBlocked(s,t,x),(this.blockOrTrans(y,T)||this.blockOrTrans(T,E))&&this.addIfNotBlocked(s,t,E),s}hasForced(g,t){let{topLeft:i,downLeft:x,top:T,bottom:E}=this.normalizedPositions(g,t);return!!((this.blockOrTrans(g,x)||this.blockOrTrans(x,E))&&!this.blockOrTrans(t,E)||(this.blockOrTrans(g,i)||this.blockOrTrans(i,T))&&!this.blockOrTrans(t,T))}prune(g,t){let{right:i,top:x,bottom:T,downLeft:E,topLeft:s}=this.normalizedPositions(g,t);return this.isHorizontal(g.position,t.position)?[i,x,T]:[i,...this.getForced(g,t,E,T,s,x)]}normalizedPositions(g,t){return g.position.xt.position.x?{topLeft:{position:new _t(t.position.x+1,t.position.y+1),layer:t.layer},downLeft:{position:new _t(t.position.x+1,t.position.y-1),layer:t.layer},top:{position:new _t(t.position.x,t.position.y+1),layer:t.layer},bottom:{position:new _t(t.position.x,t.position.y-1),layer:t.layer},right:{position:new _t(t.position.x-1,t.position.y),layer:t.layer}}:g.position.y1?this.fillPath(T,E,x):x.push(E),T=E}return x.reverse()}fillPath(g,t,i){let x=g;do{let T=Ma(x.position,t.position);x=this.getTilePosInDir(x,T),i.push(x)}while(!eo.equal(x.position,t.position))}};function Vc(g,t){var i;return(i=g.get(Pi.toString(t)))!=null?i:Number.MAX_VALUE}var d4=class{constructor(g,t,i,x={}){this.character=g,this.gridTilemap=t,this.charToFollow=i;let T={distance:0,noPathFoundStrategy:"STOP",maxPathLength:1/0,shortestPathAlgorithm:"BIDIRECTIONAL_SEARCH",ignoreLayers:!1,considerCosts:x.considerCosts||!1,facingDirection:"none"};this.options=An(An({},T),x),this.options.considerCosts&&this.options.shortestPathAlgorithm!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${this.options.shortestPathAlgorithm}'. It can only be used with A* algorithm.`),this.options.shortestPathAlgorithm==="JPS"&&(this.character.getTileWidth()>1||this.character.getTileHeight()>1)&&console.warn("GridEngine: Pathfinding algorithm 'JPS' can only be used for characters with 'tileWidth' and 'tileHeight' of 1"),this.character=g,this.updateTarget(this.charToFollow.getTilePos().position,this.charToFollow.getTilePos().layer),this.charToFollow.positionChangeStarted().pipe(Ta(this.character.autoMovementSet().pipe(ph(E=>E!==this),qf(1)))).subscribe(({enterTile:E,enterLayer:s})=>{this.updateTarget(E,s)})}update(g){var t;(t=this.targetMovement)==null||t.update(g)}getInfo(){return{type:"Follow",config:{charToFollow:this.charToFollow.getId(),distance:this.options.distance,noPathFoundStrategy:this.options.noPathFoundStrategy,maxPathLength:this.options.maxPathLength,ignoreLayers:this.options.ignoreLayers,facingDirection:this.options.facingDirection,shortestPathAlgorithm:this.options.shortestPathAlgorithm}}}getFacingPos(){let g=pm[this.options.facingDirection]+pm[this.charToFollow.getFacingDirection()],t=$M("up",g),i={x:this.charToFollow.getTilePos().position.x,y:this.charToFollow.getTilePos().position.y};return t==="right"?i.x+=this.charToFollow.getTileWidth()-1:t==="down"?i.y+=this.charToFollow.getTileWidth()-1:t==="down-left"?i.y+=this.charToFollow.getTileWidth()-1:t==="down-right"?(i.y+=this.charToFollow.getTileWidth()-1,i.x+=this.charToFollow.getTileWidth()-1):t==="up-right"&&(i.x+=this.charToFollow.getTileWidth()-1),this.gridTilemap.getTilePosInDirection({position:new _t(i),layer:this.charToFollow.getTilePos().layer},t).position}updateTarget(g,t){let i=this.options.facingDirection!=="none"&&this.options.distance===0;i&&(g=this.getFacingPos()),this.targetMovement=new DC(this.character,this.gridTilemap,{position:new _t(g),layer:t},{distance:i?0:this.options.distance+1,config:{algorithm:this.options.shortestPathAlgorithm,noPathFoundStrategy:this.options.noPathFoundStrategy,maxPathLength:this.options.maxPathLength,ignoreLayers:this.options.ignoreLayers,considerCosts:this.options.considerCosts,ignoredChars:[this.charToFollow.getId()]}})}},sT=class{static getRandomInt(g){return Math.floor(Math.random()*Math.floor(g))}},p4=class{constructor(g,t=0,i=-1){this.character=g,this.delay=t,this.radius=i,this.stepSize=0,this.delayLeft=this.delay,this.initialRow=g.getNextTilePos().position.y,this.initialCol=g.getNextTilePos().position.x,this.randomizeStepSize(),this.stepsWalked=0,this.currentMovementDirection="none",this.character.positionChangeStarted().pipe(Ta(this.character.autoMovementSet().pipe(ph(x=>x!==this),qf(1)))).subscribe(()=>{this.stepsWalked++}),this.distanceUtils=yd.create(g.getNumberOfDirections())}update(g){if(this.shouldContinueWalkingCurrentDirection())this.character.move(this.currentMovementDirection);else if(this.delayLeft-=g,this.delayLeft<=0){this.delayLeft=this.delay;let t=this.getFreeRandomDirection();this.stepsWalked=0,this.character.move(t),this.currentMovementDirection=t,this.randomizeStepSize()}}getInfo(){return{type:"Random",config:{delay:this.delay,radius:this.radius}}}shouldContinueWalkingCurrentDirection(){return this.stepsWalked!this.character.isBlockingDirection(g)).filter(g=>this.isWithinRadius(g))}isWithinRadius(g){return this.radius==-1?!0:this.getDist(g)<=this.radius}getDist(g){return this.distanceUtils.distance(this.character.getNextTilePos().position.add(Mu(g)),new _t(this.initialCol,this.initialRow))}getFreeRandomDirection(){let g=this.getFreeDirections();return g.length==0?"none":g[sT.getRandomInt(g.length)]}randomizeStepSize(){this.stepSize=sT.getRandomInt(this.radius)+1}};function v4(g,t){return g.filter(i=>{var x,T,E,s,y,e;return(x=t.labels)!=null&&x.withAllLabels?(T=t.labels)==null?void 0:T.withAllLabels.every(r=>i.hasLabel(r)):(E=t.labels)!=null&&E.withOneOfLabels?(s=t.labels)==null?void 0:s.withOneOfLabels.some(r=>i.hasLabel(r)):(y=t.labels)!=null&&y.withNoneLabels?!((e=t.labels)!=null&&e.withNoneLabels.some(r=>i.hasLabel(r))):!0})}var bC="2.44.6",m4=class{constructor(g,t){this.collistionStrategy=g,this.collisionGroupRelation=t,this.tilePosToCharacters=new g4,this.charRemoved$=new In}isCharBlockingAt(g,t,i,x=new Set,T=new Set){if(i.length===0)return!1;let E=this.tilePosToCharacters.get(g,t);return!!(E&&E.size>0&&[...E].filter(s=>!x.has(s.getId())).filter(s=>!this.doIntersect(s.getCollisionGroups(),T)).some(s=>i.some(y=>s.getCollisionGroups().some(e=>this.collidesWith(y,e)))))}doIntersect(g,t){for(let i of g)if(t.has(i))return!0;return!1}collidesWith(g,t){return this.collisionGroupRelation?(this.collisionGroupRelation.get(g)||new Set).has(t):g===t}getCharactersAt(g,t){return this.tilePosToCharacters.get(g,t)||new Set}addCharacter(g){this.addTilePositions(g.getTilePos(),g),this.addTilePositions(g.getNextTilePos(),g),this.addPositionChangeSub(g),this.addPositionChangeFinishedSub(g),this.addTilePosSetSub(g)}removeCharacter(g){let t=g.getId();this.charRemoved$.next(t),this.deleteTilePositions(g.getTilePos(),g),this.deleteTilePositions(g.getNextTilePos(),g)}add(g,t,i){let x=this.tilePosToCharacters.get(g,t);x||this.tilePosToCharacters.set(g,t,new Set([i])),x?.add(i)}addTilePosSetSub(g){g.tilePositionSet().pipe(Ta(this.charRemoved(g.getId()))).subscribe(t=>{this.deleteTilePositions(g.getNextTilePos(),g),this.addTilePositions(t,g)})}charRemoved(g){var t;return(t=this.charRemoved$)==null?void 0:t.pipe(qf(1),ph(i=>i==g))}addPositionChangeSub(g){g.positionChangeStarted().pipe(Ta(this.charRemoved(g.getId())),this.posChangeToLayerPos()).subscribe(t=>{this.collistionStrategy==="BLOCK_ONE_TILE_AHEAD"&&this.deleteTilePositions(t.exit,g),this.addTilePositions(t.enter,g)})}addPositionChangeFinishedSub(g){g.positionChangeFinished().pipe(Ta(this.charRemoved(g.getId())),this.posChangeToLayerPos()).subscribe(t=>{this.deleteTilePositions(t.exit,g),this.addTilePositions(t.enter,g)})}addTilePositions(g,t){this.forEachCharTile(g,t,(i,x)=>{this.add(new _t(i,x),g.layer,t)})}deleteTilePositions(g,t){this.forEachCharTile(g,t,(i,x)=>{var T;(T=this.tilePosToCharacters.get(new _t(i,x),g.layer))==null||T.delete(t)})}forEachCharTile(g,t,i){let x=g.position;for(let T=x.x;T({enter:{position:new _t(g.enterTile),layer:g.enterLayer},exit:{position:new _t(g.exitTile),layer:g.exitLayer}})))}posToString(g,t){return`${g.x}#${g.y}#${t}`}},g4=class{constructor(){this.memo=new Map}set(g,t,i){let x=this.memo.get(g.x);x||(x=new Map,this.memo.set(g.x,x));let T=x.get(g.y);T||(T=new Map,x.set(g.y,T)),T.set(t,i)}get(g,t){let i=this.memo.get(g.x);if(!i)return;let x=i.get(g.y);if(x)return x.get(t)}},Kx=class{constructor(g,t,i,x){this.x=g,this.y=t,this.width=i,this.height=x}getX(){return this.x}getY(){return this.y}getWidth(){return this.width}getHeight(){return this.height}isInRange(g){return g.x>=this.x&&g.x=this.y&&g.yi.isCharLayer());for(let i of[...t,void 0]){let x=this.tileCollisionCache.get(i?.getName());if(x===void 0){x=new Array(this.tilemap.getWidth());for(let T=0;T>t&1)==1}var oT="ge_cost",LC=class FC{constructor(t,i,x,T=void 0,E=!1){this.tilemap=t,this.collisionTilePropertyName=i,this.useTileCollisionCache=E,this.characters=new Map,this.transitions=new Map,this.reverseTransitions=new Map,this.collidesPropNames=new Map,this.tileCostPropNames=new Map,this.collisionRelevantLayersFrameCache=new Map,this.charBlockCache=new m4(x,T);for(let s of Yx())this.collidesPropNames.set(s,FC.ONE_WAY_COLLIDE_PROP_PREFIX+s),this.tileCostPropNames.set(s,`${oT}_${s}`);this.useTileCollisionCache&&(this.tileCollisionCache=new x4(t,this),this.tileCollisionCache.rebuild())}fixCacheLayer(t){var i;(i=this.tileCollisionCache)==null||i.fixLayer(t)}unfixCacheLayers(){var t;(t=this.tileCollisionCache)==null||t.unfixLayers()}addCharacter(t){this.characters.set(t.getId(),t);let i=t.getNextTilePos().layer;i===void 0?t.setTilePosition(dh(An({},t.getNextTilePos()),{layer:this.getLowestCharLayer()})):this.getCharLayerNames().includes(i)||console.warn(`Char layer '${i}' of character '${t.getId()}' is unknown.`),this.charBlockCache.addCharacter(t)}removeCharacter(t){let i=this.characters.get(t);i&&(this.charBlockCache.removeCharacter(i),this.characters.delete(t))}getCharacters(){return[...this.characters.values()]}getCharactersAt(t,i){return this.charBlockCache.getCharactersAt(t,i)}rebuildTileCollisionCache(t){var i;(i=this.tileCollisionCache)==null||i.rebuild(t)}hasBlockingTileUncached(t,i,x,T){if(!T&&this.hasNoTileUncached(t,i))return!0;let E=this.getCollisionRelevantLayers(i);for(let s of E)if(this.isLayerBlockingAt(s.getName(),t,x))return!0;return!1}hasBlockingTile(t,i,x,T){var E;let s=(E=this.tileCollisionCache)==null?void 0:E.isBlockingFrom(t.x,t.y,i,x,T);return s!==void 0?s:this.hasBlockingTileUncached(t,i,x,T)}getTransition(t,i){let x=this.transitions.get(t.toString());if(x)return x.get(i)}getReverseTransitions(t,i){let x=this.reverseTransitions.get(t.toString());if(x)return x.get(i)}setTransition(t,i,x){var T,E,s,y,e;this.transitions.has(t.toString())||this.transitions.set(t.toString(),new Map),this.reverseTransitions.has(t.toString())||this.reverseTransitions.set(t.toString(),new Map),(T=this.transitions.get(t.toString()))==null||T.set(i,x),(E=this.reverseTransitions.get(t.toString()))!=null&&E.has(x)||(s=this.reverseTransitions.get(t.toString()))==null||s.set(x,new Set),(e=(y=this.reverseTransitions.get(t.toString()))==null?void 0:y.get(x))==null||e.add(i)}getTransitions(){return new Map([...this.transitions].map(([t,i])=>[t,new Map(i)]))}getTileCosts(t,i){let x=this.getCollisionRelevantLayers(t.layer),T=1;for(let E of x)T=Math.max(T,this.getTileCostsForLayer(dh(An({},t),{layer:E.getName()}),i));return T}getTileCostsForLayer(t,i){let x=this.tilemap.getTileAt(t.position.x,t.position.y,t.layer);return i&&x?.getProperty(this.tileCostPropNames.get(i)||"")||x?.getProperty(oT)||1}hasNoTileUncached(t,i){return!this.getCollisionRelevantLayers(i).some(x=>this.tilemap.hasTileAt(t.x,t.y,x.getName()))}hasNoTile(t,i){var x;let T=(x=this.tileCollisionCache)==null?void 0:x.hasTileAt(t.x,t.y,i);return T!==void 0?T:this.hasNoTileUncached(t,i)}hasBlockingChar(t,i,x,T=new Set,E=new Set){return this.charBlockCache.isCharBlockingAt(t,i,x,T,E)}isInRange(t){return new Kx(0,0,this.tilemap.getWidth(),this.tilemap.getHeight()).isInRange(t)}toMapDirection(t){return this.isIsometric()?EO(t):t}fromMapDirection(t){return this.isIsometric()?$M(t):t}isIsometric(){return this.tilemap.getOrientation()==="isometric"}getTilePosInDirection(t,i){let x=t.position.add(Mu(this.toMapDirection(i))),T=this.getTransition(x,t.layer)||t.layer;return{position:x,layer:T}}invalidateFrameCache(){this.collisionRelevantLayersFrameCache.clear()}isLayerBlockingAt(t,i,x){let T=this.tilemap.getTileAt(i.x,i.y,t);return T?!!(T.getProperty(this.collisionTilePropertyName)||x&&T.getProperty(this.collidesPropNames.get(x)||"")):!1}getCharLayerIndexes(){return this.tilemap.getLayers().map((t,i)=>({layer:t,index:i})).filter(({layer:t})=>t.isCharLayer()).map(({index:t})=>t)}findPrevAndCharLayer(t){let i=this.getCharLayerIndexes(),x=this.tilemap.getLayers(),T=i.findIndex(E=>x[E].getProperty(_v)==t);return T==0?{prevIndex:-1,charLayerIndex:i[T]}:{prevIndex:i[T-1],charLayerIndex:i[T]}}getCollisionRelevantLayers(t){if(!t)return this.tilemap.getLayers();let i=this.collisionRelevantLayersFrameCache.get(t);if(i)return i;let{prevIndex:x,charLayerIndex:T}=this.findPrevAndCharLayer(t),E=this.tilemap.getLayers().slice(x+1,T+1);return this.collisionRelevantLayersFrameCache.set(t,E),E}getLowestCharLayer(){for(let t of this.tilemap.getLayers())if(t.isCharLayer())return t.getProperty(_v)}getCharLayerNames(){return this.tilemap.getLayers().filter(t=>t.isCharLayer()).map(t=>t.getProperty(_v)).filter(T4)}};LC.ONE_WAY_COLLIDE_PROP_PREFIX="ge_collide_";var S4=LC;function T4(g){return g!=null}var E4=(g=>(g.REMOVED="REMOVED",g.ADDED="ADDED",g))(E4||{}),M4=(g=>(g.WAIT="WAIT",g.SKIP="SKIP",g.STOP="STOP",g))(M4||{}),C4=class{constructor(g,t){this.character=g,this.tilemap=t,this.queue=new vm,this.finished$=new In,this.pathBlockedWaitElapsed=0,this.distanceUtils=yd.create(g.getNumberOfDirections()),this.character.autoMovementSet().pipe(ph(i=>i!==this),qf(1)).subscribe(()=>{this.queue.size()>0&&this.finishMovementTerminated(),this.finished$.complete()})}update(g){(!this.character.isMoving()||this.character.willCrossTileBorderThisUpdate(g))&&this.queue.size()>0&&this.moveCharOnPath(g)}getInfo(){return{type:"Queue"}}enqueue(g,t={}){var i,x,T;let E={pathBlockedStrategy:(i=t.pathBlockedStrategy)!=null?i:"STOP",pathBlockedWaitTimeoutMs:t?.pathBlockedWaitTimeoutMs||-1,ignoreInvalidPositions:(x=t.ignoreInvalidPositions)!=null?x:!1,skipInvalidPositions:(T=t.skipInvalidPositions)!=null?T:!1};for(let s of g){let y={command:s,config:E};if(If(s)){this.queue.enqueue(y);continue}let e=this.queue.peekEnd(),r=e?.command;if(r||(r=this.character.getNextTilePos()),If(r)){this.queue.enqueue(y);continue}let p=this.distanceUtils.distance(r.position,s.position)===1;(!t.ignoreInvalidPositions||p)&&this.queue.enqueue(y)}}peekAll(){return this.queue.peekAll()}size(){return this.queue.size()}finished(){return this.finished$}clear(){this.queue.clear()}moveCharOnPath(g){let t=this.queue.peek();if(!t)return;let i=t.command,x=t.config;if(If(i)&&(i=this.tilemap.getTilePosInDirection(this.character.getNextTilePos(),i)),x.skipInvalidPositions){if(i=this.getNextValidPosition(),!i){this.finishInvalidNextPos(i);return}}else if(!this.isNeighborPos(i)){this.finishInvalidNextPos(i);return}if(this.character.isBlockingDirection(Ma(this.character.getNextTilePos().position,i.position))){if(x.pathBlockedStrategy==="STOP")this.finishPathBlocked(i);else if(x.pathBlockedStrategy==="SKIP"){this.queue.dequeue(),this.moveCharOnPath(g);return}else x.pathBlockedStrategy==="WAIT"&&x.pathBlockedWaitTimeoutMs>-1&&(this.pathBlockedWaitElapsed+=g,this.pathBlockedWaitElapsed>=x.pathBlockedWaitTimeoutMs&&this.finishBlockedWaitTimeout(i,x.pathBlockedWaitTimeoutMs));return}this.pathBlockedWaitElapsed=0,this.queue.dequeue(),this.character.move(this.getDir(this.character.getNextTilePos().position,i.position)),this.isLastMovement()&&this.finish("SUCCESS","",i)}getNextValidPosition(){for(var g;this.queue.size()>0;){let t=(g=this.queue.peek())==null?void 0:g.command;if(If(t)&&(t=this.tilemap.getTilePosInDirection(this.character.getNextTilePos(),t)),t&&this.isNeighborPos(t))return t;this.queue.dequeue()}}isLastMovement(){return this.queue.size()===0}isNeighborPos(g){let t=this.distanceUtils.distance(this.character.getNextTilePos().position,g.position)===1,i=this.tilemap.getTransition(g.position,this.character.getNextTilePos().layer);if(this.character.getNextTilePos().layer!==g.layer)return t&&i===g.layer;let x=i!==void 0&&i!==g.layer;return t&&!x}finishMovementTerminated(){this.finish("MOVEMENT_TERMINATED","New automatic movement has been set to character.")}finishInvalidNextPos(g){g?this.finish("INVALID_NEXT_POS",`Position ${this.posToStr(g)} is not reachable from ${this.posToStr(this.character.getNextTilePos())}.`):this.finish("INVALID_NEXT_POS",`No enqueued position is reachable from ${this.posToStr(this.character.getNextTilePos())}.`)}finishPathBlocked(g){this.finish("PATH_BLOCKED",`Position ${this.posToStr(g)} is blocked.`)}finishBlockedWaitTimeout(g,t){this.finish("PATH_BLOCKED_WAIT_TIMEOUT",`Position ${this.posToStr(g)} is blocked and the wait timeout of ${t} ms has been exceeded.`)}finish(g,t="",i=this.character.getNextTilePos()){this.queue=new vm,this.finished$.next({position:i.position,result:g,description:t,layer:i.layer})}getDir(g,t){return this.tilemap.fromMapDirection(Ma(g,t))}posToStr(g){return`(${g.position.x}, ${g.position.y}, ${g.layer})`}},w4=class{constructor(g=!0){this.isCreatedInternal=!1,g&&console.log(`Using GridEngine v${bC}`)}getCharLayer(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getTilePos().layer}getTransition(g,t){var i;return this.initGuard(),(i=this.gridTilemap)==null?void 0:i.getTransition(new _t(g),t)}setTransition(g,t,i){var x;return this.initGuard(),(x=this.gridTilemap)==null?void 0:x.setTransition(new _t(g),t,i)}create(g,t){this.isCreatedInternal=!0,this.gridCharacters=new Map;let i=this.setConfigDefaults(t);this.config=i,this.movementStopped$=new In,this.movementStarted$=new In,this.directionChanged$=new In,this.positionChangeStarted$=new In,this.positionChangeFinished$=new In,this.queueMovementFinished$=new In,this.charRemoved$=new In,this.charAdded$=new In,this.gridTilemap=new S4(g,this.config.collisionTilePropertyName,this.config.characterCollisionStrategy,this.recordToMap(this.config.collisionGroupRelation),this.config.cacheTileCollisions),this.addCharacters()}recordToMap(g){return g?new Map(Object.entries(g).map(([t,i])=>[t,new Set(i)])):void 0}getPosition(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getTilePos().position}move(g,t){this.moveChar(g,t)}moveRandomly(g,t=0,i=-1){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(g);if(!T)throw this.createCharUnknownErr(g);let E=new p4(T,t,i);T.setMovement(E)}getMovement(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);let x=i.getMovement();return x?x.getInfo():{type:"None"}}moveTo(g,t,i){var x;let T=this.assembleMoveToConfig(i);this.initGuard();let E=(x=this.gridCharacters)==null?void 0:x.get(g);if(!E)throw this.createCharUnknownErr(g);if(!this.gridTilemap)throw this.createUninitializedErr();let s=new DC(E,this.gridTilemap,{position:new _t(t),layer:i?.targetLayer||E.getNextTilePos().layer},{distance:0,config:T});return E.setMovement(s),s.finishedObs().pipe(od(y=>({charId:g,position:y.position,result:y.result,description:y.description,layer:y.layer})))}stopMovement(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);i.setMovement(void 0)}setSpeed(g,t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(g);if(!x)throw this.createCharUnknownErr(g);x.setSpeed(t)}getSpeed(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getSpeed()}collidesWithTiles(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.collidesWithTiles()}update(g,t){var i;if(this.isCreatedInternal&&this.gridCharacters)for(let[x,T]of this.gridCharacters)T.update(t);(i=this.gridTilemap)==null||i.invalidateFrameCache()}addCharacter(g){var t,i,x,T,E;if(!this.gridTilemap)throw this.createUninitializedErr();if(!this.config)throw this.createUninitializedErr();let s={speed:g.speed||4,tilemap:this.gridTilemap,collidesWithTiles:!0,collisionGroups:["geDefault"],ignoreCollisionGroups:[],charLayer:g.charLayer,facingDirection:g.facingDirection,labels:g.labels,numberOfDirections:(t=g.numberOfDirections)!=null?t:this.config.numberOfDirections,tileWidth:g.tileWidth,tileHeight:g.tileHeight};typeof g.collides=="boolean"?g.collides===!1&&(s.collidesWithTiles=!1,s.collisionGroups=[]):g.collides!==void 0&&(g.collides.collidesWithTiles===!1&&(s.collidesWithTiles=!1),g.collides.collisionGroups&&(s.collisionGroups=g.collides.collisionGroups),g.collides.ignoreCollisionGroups&&(s.ignoreCollisionGroups=g.collides.ignoreCollisionGroups),s.ignoreMissingTiles=(x=(i=g.collides)==null?void 0:i.ignoreMissingTiles)!=null?x:!1);let y=new s4(g.id,s);g.startPosition&&y.setTilePosition({position:new _t(g.startPosition),layer:y.getTilePos().layer}),(T=this.gridCharacters)==null||T.set(g.id,y),this.gridTilemap.addCharacter(y);let e=y.getId();y.movementStopped().pipe(Ta(this.charRemoved(e))).subscribe(r=>{var p;(p=this.movementStopped$)==null||p.next({charId:e,direction:r})}),y.movementStarted().pipe(Ta(this.charRemoved(e))).subscribe(r=>{var p;(p=this.movementStarted$)==null||p.next({charId:e,direction:r})}),y.directionChanged().pipe(Ta(this.charRemoved(e))).subscribe(r=>{var p;(p=this.directionChanged$)==null||p.next({charId:e,direction:r})}),y.positionChangeStarted().pipe(Ta(this.charRemoved(e))).subscribe(r=>{var p;(p=this.positionChangeStarted$)==null||p.next(An({charId:e},r))}),y.positionChangeFinished().pipe(Ta(this.charRemoved(e))).subscribe(r=>{var p;(p=this.positionChangeFinished$)==null||p.next(An({charId:e},r))}),(E=this.charAdded$)==null||E.next(e)}hasCharacter(g){var t;return this.initGuard(),!!((t=this.gridCharacters)!=null&&t.has(g))}removeCharacter(g){var t,i,x,T;if(this.initGuard(),!((t=this.gridCharacters)!=null&&t.get(g)))throw this.createCharUnknownErr(g);(i=this.gridTilemap)==null||i.removeCharacter(g),(x=this.gridCharacters)==null||x.delete(g),(T=this.charRemoved$)==null||T.next(g)}removeAllCharacters(){if(this.initGuard(),!!this.gridCharacters)for(let g of this.gridCharacters.keys())this.removeCharacter(g)}getAllCharacters(g){if(this.initGuard(),!this.gridCharacters)return[];let t=[...this.gridCharacters.values()];return(g?v4(t,g):t).map(i=>i.getId())}getLabels(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getLabels()}addLabels(g,t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(g);if(!x)throw this.createCharUnknownErr(g);x.addLabels(t)}removeLabels(g,t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(g);if(!x)throw this.createCharUnknownErr(g);x.removeLabels(t)}clearLabels(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);i.clearLabels()}follow(g,t,i,x){var T,E,s,y,e,r;let p;i===void 0?p={distance:0,closestPointIfBlocked:!1}:typeof i=="number"?(p={distance:i,closestPointIfBlocked:!1},x&&(p.closestPointIfBlocked=!0)):p=i,this.initGuard();let h=(T=this.gridCharacters)==null?void 0:T.get(g),a=(E=this.gridCharacters)==null?void 0:E.get(t);if(!h)throw this.createCharUnknownErr(g);if(!a)throw this.createCharUnknownErr(t);if(!this.gridTilemap)throw this.createUninitializedErr();let l=new d4(h,this.gridTilemap,a,{distance:(s=p.distance)!=null?s:0,noPathFoundStrategy:p.closestPointIfBlocked?"CLOSEST_REACHABLE":"STOP",maxPathLength:(y=p.maxPathLength)!=null?y:1/0,shortestPathAlgorithm:(e=p.algorithm)!=null?e:"BIDIRECTIONAL_SEARCH",ignoreLayers:!!p.ignoreLayers,facingDirection:(r=p.facingDirection)!=null?r:"none"});h.setMovement(l)}isMoving(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.isMoving()}getFacingDirection(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getFacingDirection()}getFacingPosition(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);let x=i.getFacingPosition();return{x:x.x,y:x.y}}turnTowards(g,t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(g);if(!x)throw this.createCharUnknownErr(g);return x.turnTowards(t)}getCharactersAt(g,t){if(this.initGuard(),!this.gridTilemap)return[];let i=this.gridTilemap.getCharactersAt(new _t(g),t);return Array.from(i).map(x=>x.getId())}setPosition(g,t,i){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(g);if(!T)throw this.createCharUnknownErr(g);i||T.setTilePosition({position:new _t(t),layer:T.getTilePos().layer}),T.setTilePosition({position:new _t(t),layer:i})}isBlocked(g,t,i=["geDefault"]){var x,T;this.initGuard();let E=new _t(g);return!!((x=this.gridTilemap)!=null&&x.hasBlockingTile(E,t)||(T=this.gridTilemap)!=null&&T.hasBlockingChar(E,t,i))}isTileBlocked(g,t){var i;return this.initGuard(),!!((i=this.gridTilemap)!=null&&i.hasBlockingTile(new _t(g),t))}getCollisionGroups(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getCollisionGroups()||[]}setCollisionGroups(g,t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(g);if(!x)throw this.createCharUnknownErr(g);x.setCollisionGroups(t)}getIgnoreCollisionGroups(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getIgnoreCollisionGroups()||[]}setIgnoreCollisionGroups(g,t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(g);if(!x)throw this.createCharUnknownErr(g);x.setIgnoreCollisionGroups(t)}getTilePosInDirection(g,t,i){if(!this.gridTilemap)throw this.createUninitializedErr();let x=this.gridTilemap.getTilePosInDirection({position:new _t(g),layer:t},i);return{position:x.position.toPosition(),charLayer:x.layer}}findShortestPath(g,t,i={}){if(!this.gridTilemap)throw this.createUninitializedErr();let x=i.shortestPathAlgorithm||"BFS";i.considerCosts&&x!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${x}'. It can only be used with A* algorithm.`);let T=i.pathWidth!==void 0&&i.pathWidth!==1,E=i.pathHeight!==void 0&&i.pathHeight!==1;(T||E)&&x==="JPS"&&console.warn("GridEngine: Pathfinding options 'pathWidth' and 'pathHeight' > 1 cannot be used with algorithm 'JPS'.");let s=new OC(this.gridTilemap).findShortestPath(Pi.toInternal(g),Pi.toInternal(t),dh(An({},i),{shortestPathAlgorithm:x}));return{path:s.path.map(Pi.fromInternal),closestToTarget:s.closestToTarget?Pi.fromInternal(s.closestToTarget):void 0,reachedMaxPathLength:!1,steps:s.steps}}steppedOn(g,t,i){return this.positionChangeFinished().pipe(ph(x=>g.includes(x.charId)&&t.some(T=>T.x===x.enterTile.x&&T.y===x.enterTile.y)&&(i===void 0||i.includes(x.enterLayer))))}characterShifted(){if(!this.charAdded$||!this.charRemoved$)throw this.createUninitializedErr();return this.charAdded$.pipe(od(g=>({charId:g,action:"ADDED"})),r4(this.charRemoved$.pipe(od(g=>({charId:g,action:"REMOVED"})))))}movementStarted(){if(!this.movementStarted$)throw this.createUninitializedErr();return this.movementStarted$}movementStopped(){if(!this.movementStopped$)throw this.createUninitializedErr();return this.movementStopped$}directionChanged(){if(!this.directionChanged$)throw this.createUninitializedErr();return this.directionChanged$}positionChangeStarted(){if(!this.positionChangeStarted$)throw this.createUninitializedErr();return this.positionChangeStarted$}positionChangeFinished(){if(!this.positionChangeFinished$)throw this.createUninitializedErr();return this.positionChangeFinished$}getMovementProgress(g){var t;this.initGuard();let i=(t=this.gridCharacters)==null?void 0:t.get(g);if(!i)throw this.createCharUnknownErr(g);return i.getMovementProgress()}rebuildTileCollisionCache(g,t,i,x){var T;(T=this.gridTilemap)==null||T.rebuildTileCollisionCache(new Kx(g,t,i,x))}addQueueMovements(g,t,i){var x,T;this.initGuard();let E=(x=this.gridCharacters)==null?void 0:x.get(g);if(!E)throw this.createCharUnknownErr(g);if(!this.gridTilemap)throw this.createUninitializedErr();let s;((T=E?.getMovement())==null?void 0:T.getInfo().type)==="Queue"?s=E.getMovement():(s=new C4(E,this.gridTilemap),E.setMovement(s),s.finished().pipe(Ta(t4(this.charRemoved(g),E.autoMovementSet()))).subscribe(y=>{var e;(e=this.queueMovementFinished$)==null||e.next(An({charId:g},y))})),s.enqueue(t.map(y=>If(y)?y:{position:new _t(y.position),layer:y.charLayer}),i)}queueMovementFinished(){if(!this.queueMovementFinished$)throw this.createUninitializedErr();return this.queueMovementFinished$}getEnqueuedMovements(g){var t,i;this.initGuard();let x=(t=this.gridCharacters)==null?void 0:t.get(g);if(!x)throw this.createCharUnknownErr(g);return((i=x.getMovement())==null?void 0:i.getInfo().type)==="Queue"?x.getMovement().peekAll().map(T=>({command:If(T.command)?T.command:Pi.fromInternal(T.command),config:T.config})):[]}clearEnqueuedMovements(g){var t,i;this.initGuard();let x=(t=this.gridCharacters)==null?void 0:t.get(g);if(!x)throw this.createCharUnknownErr(g);((i=x.getMovement())==null?void 0:i.getInfo().type)==="Queue"&&x.getMovement().clear()}getTileCost(g,t,i){var x,T;return this.initGuard(),(T=(x=this.gridTilemap)==null?void 0:x.getTileCosts({position:new _t(g),layer:t},i))!=null?T:1}getState(){let g=[];if(this.gridCharacters)for(let[t,i]of this.gridCharacters.entries())g.push({id:t,position:Pi.fromInternal(i.getTilePos()),facingDirection:i.getFacingDirection(),speed:i.getSpeed(),labels:i.getLabels(),movementProgress:i.getMovementProgress(),collisionConfig:{collisionGroups:i.getCollisionGroups(),ignoreCollisionGroups:i.getIgnoreCollisionGroups(),collidesWithTiles:i.collidesWithTiles(),ignoreMissingTiles:i.getIgnoreMissingTiles()}});return{characters:g}}setState(g){if(this.gridCharacters)for(let t of g.characters){let i=this.gridCharacters.get(t.id);if(i){let x=i.getTilePos();Pi.equal(x,Pi.toInternal(t.position))||i.setTilePosition(Pi.toInternal(t.position)),i.setSpeed(t.speed),i.turnTowards(t.facingDirection),t.collisionConfig.collisionGroups&&i.setCollisionGroups(t.collisionConfig.collisionGroups),t.collisionConfig.collidesWithTiles!==void 0&&i.setCollidesWithTiles(t.collisionConfig.collidesWithTiles),t.collisionConfig.ignoreMissingTiles!==void 0&&i.setIgnoreMissingTiles(t.collisionConfig.ignoreMissingTiles),i.setMovementProgress(t.movementProgress),i.clearLabels(),i.addLabels(t.labels)}}}charRemoved(g){var t;if(!this.charRemoved$)throw this.createUninitializedErr();return(t=this.charRemoved$)==null?void 0:t.pipe(qf(1),ph(i=>i==g))}initGuard(){if(!this.isCreatedInternal)throw this.createUninitializedErr()}createUninitializedErr(){throw new Error("GridEngine not initialized. You need to call create() first.")}addCharacters(){var g;(g=this.config)==null||g.characters.forEach(t=>this.addCharacter(t))}moveChar(g,t){var i,x,T;this.initGuard();let E=(i=this.gridCharacters)==null?void 0:i.get(g);if(!E)throw this.createCharUnknownErr(g);if(E.getNumberOfDirections()===4){if(!((x=this.gridTilemap)!=null&&x.isIsometric())&&ad(t)){console.warn(`GridEngine: Character '${g}' can't be moved '${t}' in 4 direction mode.`);return}else if((T=this.gridTilemap)!=null&&T.isIsometric()&&!ad(t)){console.warn(`GridEngine: Character '${g}' can't be moved '${t}' in 4 direction isometric mode.`);return}}E.move(t)}createCharUnknownErr(g){return new Error(`Character unknown: ${g}`)}assembleMoveToConfig(g={}){let t=dh(An({},g),{noPathFoundStrategy:"STOP",pathBlockedStrategy:"WAIT"});return g!=null&&g.noPathFoundStrategy&&(Object.values(wC).includes(g.noPathFoundStrategy)?t.noPathFoundStrategy=g.noPathFoundStrategy:console.warn(`GridEngine: Unknown NoPathFoundStrategy '${g.noPathFoundStrategy}'. Falling back to 'STOP'`)),g!=null&&g.pathBlockedStrategy&&(Object.values(AC).includes(g.pathBlockedStrategy)?t.pathBlockedStrategy=g.pathBlockedStrategy:console.warn(`GridEngine: Unknown PathBlockedStrategy '${g.pathBlockedStrategy}'. Falling back to 'WAIT'`)),t}setConfigDefaults(g){return An({collisionTilePropertyName:"ge_collide",numberOfDirections:4,characterCollisionStrategy:"BLOCK_TWO_TILES",cacheTileCollisions:!1},g)}},A4=class extends RC{constructor(g,t={}){super(g,t),this.jumpCache=new lT}findShortestPathImpl(g,t){return this.jumpCache=new lT,super.findShortestPathImpl(g,t)}getNeighborsInternal(g,t,i){if(!t||g.layer!==t.layer)return this.getNeighbors(g,i).map(E=>({p:E,dist:1}));let x=this.prune(t,g).map(E=>{let s=this.getTransition(E.position,g.layer);return{position:E.position,layer:s||g.layer}}),T=[];for(let E of x){let s=this.jump(g,E,i,1,Ma(g.position,E.position));s&&(s.dist=this.distance(g.position,s.p.position),T.push(s))}return T}getForced(g,t){let i=[],{topLeft:x,downLeft:T,top:E,bottom:s,topRight:y,downRight:e}=this.normalizedPositions(g,t),r=Ma(g.position,t.position);return ad(r)?(this.blockOrTrans(g,x)&&(this.addIfNotBlocked(i,t,E),this.addIfNotBlocked(i,t,y),this.blockOrTrans(T,x)&&this.addIfNotBlocked(i,t,x)),this.blockOrTrans(g,T)&&(this.addIfNotBlocked(i,t,s),this.addIfNotBlocked(i,t,e),this.blockOrTrans(x,T)&&this.addIfNotBlocked(i,t,T)),this.blockOrTrans(x,E)&&this.addIfNotBlocked(i,t,E),this.blockOrTrans(T,s)&&this.addIfNotBlocked(i,t,s),this.blockOrTrans(x,y)&&this.addIfNotBlocked(i,t,y),this.blockOrTrans(T,e)&&this.addIfNotBlocked(i,t,e)):((this.blockOrTrans(g,E)||this.blockOrTrans(E,y))&&this.addIfNotBlocked(i,t,y),(this.blockOrTrans(g,s)||this.blockOrTrans(s,e))&&this.addIfNotBlocked(i,t,e),this.blockOrTrans(g,x)&&this.blockOrTrans(g,E)&&(this.addIfNotBlocked(i,t,E),this.addIfNotBlocked(i,t,x)),this.blockOrTrans(g,T)&&this.blockOrTrans(g,s)&&(this.addIfNotBlocked(i,t,s),this.addIfNotBlocked(i,t,T)),this.blockOrTrans(x,E)&&this.blockOrTrans(g,E)&&this.addIfNotBlocked(i,t,E),this.blockOrTrans(T,s)&&this.blockOrTrans(g,s)&&this.addIfNotBlocked(i,t,s)),i}hasForced(g,t){let{topLeft:i,downLeft:x,top:T,bottom:E,topRight:s,downRight:y}=this.normalizedPositions(g,t),e=Ma(g.position,t.position);if(ad(e)){if(this.blockOrTrans(g,i)&&(!this.blockOrTrans(t,T)||!this.blockOrTrans(t,s)||this.blockOrTrans(x,i)&&!this.blockOrTrans(t,i))||this.blockOrTrans(g,x)&&(!this.blockOrTrans(t,E)||!this.blockOrTrans(t,y)||this.blockOrTrans(i,x)&&!this.blockOrTrans(t,x))||this.blockOrTrans(i,T)&&!this.blockOrTrans(t,T)||this.blockOrTrans(x,E)&&!this.blockOrTrans(t,E)||this.blockOrTrans(i,s)&&!this.blockOrTrans(t,s)||this.blockOrTrans(x,y)&&!this.blockOrTrans(t,y))return!0}else if((this.blockOrTrans(g,T)||this.blockOrTrans(T,s))&&!this.blockOrTrans(t,s)||(this.blockOrTrans(g,E)||this.blockOrTrans(E,y))&&!this.blockOrTrans(t,y)||this.blockOrTrans(g,i)&&this.blockOrTrans(g,T)&&(!this.blockOrTrans(t,T)||!this.blockOrTrans(t,i))||this.blockOrTrans(g,x)&&this.blockOrTrans(g,E)&&(!this.blockOrTrans(t,E)||!this.blockOrTrans(t,x))||this.blockOrTrans(i,T)&&this.blockOrTrans(g,T)&&!this.blockOrTrans(t,T)||this.blockOrTrans(x,E)&&this.blockOrTrans(g,E)&&!this.blockOrTrans(t,E))return!0;return!1}prune(g,t){let{top:i,right:x,topRight:T,downRight:E,bottom:s}=this.normalizedPositions(g,t),y=this.getForced(g,t),e=Ma(g.position,t.position);return ad(e)?[i,x,T,E,s,...y]:[x,...y]}jump(g,t,i,x,T){let E=this.jumpCache.get(g,t);if(E!==null)return E;if(this.isBlocking(g,t)&&!(Pi.equal(t,i)&&this.options.ignoreBlockedTarget)){this.jumpCache.set(g,t,void 0);return}if(Pi.equal(t,i))return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(x>=this.maxJumpSize)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(this.getTransition(t.position,g.layer)!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(this.hasForced(g,t))return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(this.updateClosestToTarget(t,i),T==="up-left"){if(this.jump(t,this.getTilePosInDir(t,"up"),i,x+1,"up")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(this.jump(t,this.getTilePosInDir(t,"left"),i,x+1,"left")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0}}else if(T==="down-left"){if(this.jump(t,this.getTilePosInDir(t,"down"),i,x+1,"down")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(this.jump(t,this.getTilePosInDir(t,"left"),i,x+1,"left")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0}}else if(T==="up-right"){if(this.jump(t,this.getTilePosInDir(t,"up"),i,x+1,"up")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(this.jump(t,this.getTilePosInDir(t,"right"),i,x+1,"right")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0}}else if(T==="down-right"){if(this.jump(t,this.getTilePosInDir(t,"down"),i,x+1,"down")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0};if(this.jump(t,this.getTilePosInDir(t,"right"),i,x+1,"right")!==void 0)return this.jumpCache.set(g,t,{p:t,dist:0}),{p:t,dist:0}}let s=this.jump(t,this.getTilePosInDir(t,T),i,x+1,T);return this.jumpCache.set(g,t,s),s}normalizedPositions(g,t){return g.position.xt.position.x&&g.position.y===t.position.y?{topLeft:{position:new _t(t.position.x+1,t.position.y+1),layer:t.layer},downLeft:{position:new _t(t.position.x+1,t.position.y-1),layer:t.layer},top:{position:new _t(t.position.x,t.position.y+1),layer:t.layer},bottom:{position:new _t(t.position.x,t.position.y-1),layer:t.layer},right:{position:new _t(t.position.x-1,t.position.y),layer:t.layer},topRight:{position:new _t(t.position.x-1,t.position.y+1),layer:t.layer},downRight:{position:new _t(t.position.x-1,t.position.y-1),layer:t.layer}}:g.position.yt.position.y&&g.position.x===t.position.x?{topLeft:{position:new _t(t.position.x-1,t.position.y+1),layer:t.layer},downLeft:{position:new _t(t.position.x+1,t.position.y+1),layer:t.layer},top:{position:new _t(t.position.x-1,t.position.y),layer:t.layer},bottom:{position:new _t(t.position.x+1,t.position.y),layer:t.layer},right:{position:new _t(t.position.x,t.position.y-1),layer:t.layer},topRight:{position:new _t(t.position.x-1,t.position.y-1),layer:t.layer},downRight:{position:new _t(t.position.x+1,t.position.y-1),layer:t.layer}}:g.position.yt.position.x?{topLeft:{position:new _t(t.position.x+1,t.position.y),layer:t.layer},downLeft:{position:new _t(t.position.x,t.position.y-1),layer:t.layer},top:{position:new _t(t.position.x+1,t.position.y+1),layer:t.layer},bottom:{position:new _t(t.position.x-1,t.position.y-1),layer:t.layer},right:{position:new _t(t.position.x-1,t.position.y+1),layer:t.layer},topRight:{position:new _t(t.position.x,t.position.y+1),layer:t.layer},downRight:{position:new _t(t.position.x-1,t.position.y),layer:t.layer}}:g.position.y>t.position.y&&g.position.x(g.SUCCESS="SUCCESS",g.NO_PATH_FOUND_MAX_RETRIES_EXCEEDED="NO_PATH_FOUND_MAX_RETRIES_EXCEEDED",g.PATH_BLOCKED_MAX_RETRIES_EXCEEDED="PATH_BLOCKED_MAX_RETRIES_EXCEEDED",g.PATH_BLOCKED="PATH_BLOCKED",g.NO_PATH_FOUND="NO_PATH_FOUND",g.PATH_BLOCKED_WAIT_TIMEOUT="PATH_BLOCKED_WAIT_TIMEOUT",g.MOVEMENT_TERMINATED="MOVEMENT_TERMINATED",g.MAX_PATH_LENGTH_REACHED="MAX_PATH_LENGTH_REACHED",g))(R4||{}),DC=class{constructor(g,t,i,{config:x,ignoreBlockedTarget:T=!1,distance:E=0}={}){this.character=g,this.tilemap=t,this.targetPos=i,this.shortestPath=[],this.distOffset=0,this.posOnPath=0,this.stopped=!1,this.pathBlockedWaitElapsed=0,this.isPositionAllowed=()=>!0,this.shortestPathAlgorithm="BIDIRECTIONAL_SEARCH",this.maxPathLength=1/0,this.considerCosts=!1,this.ignoredChars=[],this.isBlocking=(e,r)=>e?new PC(this.tilemap,this.getPathfindingOptions()).isBlocking(this.character.getTilePos(),{position:e,layer:r}):!0;var s,y;this.shortestPathAlgorithm=(s=x?.algorithm)!=null?s:this.shortestPathAlgorithm,this.ignoreBlockedTarget=T,this.distance=E,this.noPathFoundStrategy=x?.noPathFoundStrategy||"STOP",this.pathBlockedStrategy=x?.pathBlockedStrategy||"WAIT",this.noPathFoundRetryable=new tT(x?.noPathFoundRetryBackoffMs||200,x?.noPathFoundMaxRetries||-1,()=>{this.stop("NO_PATH_FOUND_MAX_RETRIES_EXCEEDED")}),this.pathBlockedRetryable=new tT(x?.pathBlockedRetryBackoffMs||200,x?.pathBlockedMaxRetries||-1,()=>{this.stop("PATH_BLOCKED_MAX_RETRIES_EXCEEDED")}),x!=null&&x.isPositionAllowedFn&&(this.isPositionAllowed=x.isPositionAllowedFn),x!=null&&x.maxPathLength&&(this.maxPathLength=x.maxPathLength),this.alternativeTargets=x?.alternativeTargets,this.noPathFoundAlternativeTargetsFallbackStrategy=x?.noPathFoundAlternativeTargetsFallbackStrategy,x!=null&&x.considerCosts&&this.shortestPathAlgorithm!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${this.shortestPathAlgorithm}'. It can only be used with A* algorithm.`),this.shortestPathAlgorithm==="JPS"&&(this.character.getTileWidth()>1||this.character.getTileHeight()>1)&&console.warn("GridEngine: Pathfinding algorithm 'JPS' can only be used for characters with 'tileWidth' and 'tileHeight' of 1"),this.considerCosts=x?.considerCosts||!1,this.ignoreLayers=!!(x!=null&&x.ignoreLayers),this.distanceUtils=yd.create(g.getNumberOfDirections()),this.pathBlockedWaitTimeoutMs=x?.pathBlockedWaitTimeoutMs||-1,this.ignoredChars=(y=x?.ignoredChars)!=null?y:[],this.finished$=new In,this.setCharacter(g)}setPathBlockedStrategy(g){this.pathBlockedStrategy=g}getPathBlockedStrategy(){return this.pathBlockedStrategy}setCharacter(g){this.character=g,this.noPathFoundRetryable.reset(),this.pathBlockedRetryable.reset(),this.pathBlockedWaitElapsed=0,this.calcShortestPath(),this.character.autoMovementSet().pipe(ph(t=>t!==this),qf(1)).subscribe(()=>{this.stop("MOVEMENT_TERMINATED")})}getPathfindingOptions(){return{shortestPathAlgorithm:this.shortestPathAlgorithm,pathWidth:this.character.getTileWidth(),pathHeight:this.character.getTileHeight(),numberOfDirections:this.character.getNumberOfDirections(),isPositionAllowed:this.isPositionAllowed,collisionGroups:this.character.getCollisionGroups(),ignoredChars:[this.character.getId(),...this.ignoredChars],ignoreTiles:!this.character.collidesWithTiles(),ignoreMapBounds:this.character.getIgnoreMissingTiles(),ignoreBlockedTarget:this.ignoreBlockedTarget,maxPathLength:this.maxPathLength,ignoreLayers:this.ignoreLayers,considerCosts:this.considerCosts,calculateClosestToTarget:!0}}update(g){var t,i,x,T;this.stopped||(this.noPathFound()&&(this.noPathFoundStrategy==="RETRY"?this.noPathFoundRetryable.retry(g,()=>this.calcShortestPath()):this.noPathFoundStrategy==="STOP"&&this.stop("NO_PATH_FOUND")),this.updatePosOnPath(),this.isBlocking((t=this.nextTileOnPath())==null?void 0:t.position,(i=this.character)==null?void 0:i.getNextTilePos().layer)?this.applyPathBlockedStrategy(g):this.pathBlockedWaitElapsed=0,this.hasArrived()?(this.stop("SUCCESS"),this.existsDistToTarget()&&this.turnTowardsTarget()):this.isBlocking((x=this.nextTileOnPath())==null?void 0:x.position,(T=this.character)==null?void 0:T.getNextTilePos().layer)||this.moveCharOnPath())}finishedObs(){return this.finished$}getInfo(){return{type:"Target",state:{pathAhead:this.shortestPath.slice(this.posOnPath).map(g=>Pi.fromInternal(g))},config:{algorithm:this.shortestPathAlgorithm,ignoreBlockedTarget:this.ignoreBlockedTarget,distance:this.distance,targetPos:Pi.fromInternal(this.targetPos),noPathFoundStrategy:this.noPathFoundStrategy,pathBlockedStrategy:this.pathBlockedStrategy,noPathFoundRetryBackoffMs:this.noPathFoundRetryable.getBackoffMs(),noPathFoundMaxRetries:this.noPathFoundRetryable.getMaxRetries()}}}resultToReason(g){switch(g){case"SUCCESS":return"Successfully arrived.";case"MOVEMENT_TERMINATED":return"Movement of character has been replaced before destination was reached.";case"PATH_BLOCKED":return"PathBlockedStrategy STOP: Path blocked.";case"NO_PATH_FOUND_MAX_RETRIES_EXCEEDED":return`NoPathFoundStrategy RETRY: Maximum retries of ${this.noPathFoundRetryable.getMaxRetries()} exceeded.`;case"NO_PATH_FOUND":return"NoPathFoundStrategy STOP: No path found.";case"PATH_BLOCKED_MAX_RETRIES_EXCEEDED":return`PathBlockedStrategy RETRY: Maximum retries of ${this.pathBlockedRetryable.getMaxRetries()} exceeded.`;case"PATH_BLOCKED_WAIT_TIMEOUT":return`PathBlockedStrategy WAIT: Wait timeout of ${this.pathBlockedWaitTimeoutMs}ms exceeded.`}}applyPathBlockedStrategy(g){this.pathBlockedStrategy==="RETRY"?this.pathBlockedRetryable.retry(g,()=>{let t=this.getShortestPath();t.path.length>0&&this.calcShortestPath(t)}):this.pathBlockedStrategy==="STOP"?this.stop("PATH_BLOCKED"):this.pathBlockedStrategy==="WAIT"&&this.pathBlockedWaitTimeoutMs>-1&&(this.pathBlockedWaitElapsed+=g,this.pathBlockedWaitElapsed>=this.pathBlockedWaitTimeoutMs&&this.stop("PATH_BLOCKED_WAIT_TIMEOUT"))}moveCharOnPath(){let g=this.nextTileOnPath();if(!g)return;let t=this.getDir(this.character.getNextTilePos().position,g.position);this.character.move(t)}nextTileOnPath(){return this.shortestPath[this.posOnPath+1]}stop(g){this.finished$.next({position:this.character.getTilePos().position,result:g,description:this.resultToReason(g),layer:this.character.getTilePos().layer}),this.finished$.complete(),this.stopped=!0}turnTowardsTarget(){let g=this.shortestPath[this.posOnPath+1],t=this.getDir(this.character.getNextTilePos().position,g.position);this.character.turnTowards(t)}existsDistToTarget(){return this.posOnPath=this.shortestPath.length-1}updatePosOnPath(){let g=this.shortestPath[this.posOnPath];for(;this.posOnPath0)return{path:E,distOffset:s}}return this.noPathFoundStrategy=this.noPathFoundAlternativeTargetsFallbackStrategy||"STOP",this.getShortestPath()}}return{path:i,distOffset:0}}pathToAlternativeTarget(g,t){let i=t.findShortestPath(this.character.getNextTilePos(),g,this.getPathfindingOptions()).path,x=this.distanceUtils.distance(g.position,this.targetPos.position);return{path:i,distOffset:x}}getDir(g,t){return this.tilemap.fromMapDirection(this.distanceUtils.direction(g,t))}},b4=Object.create,IC=Object.defineProperty,L4=Object.getOwnPropertyDescriptor,F4=Object.getOwnPropertyNames,O4=Object.getPrototypeOf,D4=Object.prototype.hasOwnProperty,I4=(g,t)=>()=>(t||g((t={exports:{}}).exports,t),t.exports),N4=(g,t,i,x)=>{if(t&&typeof t=="object"||typeof t=="function")for(let T of F4(t))!D4.call(g,T)&&T!==i&&IC(g,T,{get:()=>t[T],enumerable:!(x=L4(t,T))||x.enumerable});return g},Zx=(g,t,i)=>(i=g!=null?b4(O4(g)):{},N4(t||!g||!g.__esModule?IC(i,"default",{value:g,enumerable:!0}):i,g)),Jx=I4((g,t)=>{(function(){var i,x="4.17.21",T=200,E="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",y="Invalid `variable` option passed into `_.template`",e="__lodash_hash_undefined__",r=500,p="__lodash_placeholder__",h=1,a=2,l=4,n=1,u=2,f=1,o=2,c=4,d=8,v=16,m=32,S=64,M=128,w=256,C=512,A=30,P="...",b=800,O=16,I=1,D=2,B=3,G=1/0,z=9007199254740991,X=17976931348623157e292,j=NaN,Q=4294967295,tt=Q-1,Y=Q>>>1,Z=[["ary",M],["bind",f],["bindKey",o],["curry",d],["curryRight",v],["flip",C],["partial",m],["partialRight",S],["rearg",w]],U="[object Arguments]",H="[object Array]",J="[object AsyncFunction]",_="[object Boolean]",q="[object Date]",at="[object DOMException]",ot="[object Error]",rt="[object Function]",gt="[object GeneratorFunction]",yt="[object Map]",Et="[object Number]",At="[object Null]",Pt="[object Object]",Vt="[object Promise]",dt="[object Proxy]",ut="[object RegExp]",Rt="[object Set]",Dt="[object String]",Ht="[object Symbol]",Bt="[object Undefined]",re="[object WeakMap]",le="[object WeakSet]",ge="[object ArrayBuffer]",xe="[object DataView]",Pe="[object Float32Array]",te="[object Float64Array]",Ge="[object Int8Array]",Oe="[object Int16Array]",Be="[object Int32Array]",Le="[object Uint8Array]",ne="[object Uint8ClampedArray]",je="[object Uint16Array]",ri="[object Uint32Array]",Ei=/\b__p \+= '';/g,he=/\b(__p \+=) '' \+/g,Si=/(__e\(.*?\)|\b__t\)) \+\n'';/g,bt=/&(?:amp|lt|gt|quot|#39);/g,Me=/[&<>"']/g,Ce=RegExp(bt.source),Ve=RegExp(Me.source),Je=/<%-([\s\S]+?)%>/g,zi=/<%([\s\S]+?)%>/g,Di=/<%=([\s\S]+?)%>/g,en=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Zn=/^\w*$/,Gi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,di=/[\\^$.*+?()[\]{}|]/g,Wi=RegExp(di.source),Pa=/^\s+/,aa=/\s/,Bs=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Qr=/\{\n\/\* \[wrapped with (.+)\] \*/,ao=/,? & /,_r=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Us=/[()=,{}\[\]\/\s]/,xs=/\\(\\)?/g,oo=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Rl=/\w*$/,Tt=/^[-+]0x[0-9a-f]+$/i,Kt=/^0b[01]+$/i,qt=/^\[object .+?Constructor\]$/,ie=/^0o[0-7]+$/i,ee=/^(?:0|[1-9]\d*)$/,Te=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ue=/($^)/,We=/['\n\r\u2028\u2029\\]/g,$e="\\ud800-\\udfff",qe="\\u0300-\\u036f",ii="\\ufe20-\\ufe2f",ai="\\u20d0-\\u20ff",Ji=qe+ii+ai,hn="\\u2700-\\u27bf",ki="a-z\\xdf-\\xf6\\xf8-\\xff",gn="\\xac\\xb1\\xd7\\xf7",ti="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Se="\\u2000-\\u206f",Nr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",mi="A-Z\\xc0-\\xd6\\xd8-\\xde",un="\\ufe0e\\ufe0f",Ii=gn+ti+Se+Nr,Gn="['’]",pn="["+$e+"]",ji="["+Ii+"]",dr="["+Ji+"]",zs="\\d+",Tn="["+hn+"]",oa="["+ki+"]",Jn="[^"+$e+Ii+zs+hn+ki+mi+"]",Ra="\\ud83c[\\udffb-\\udfff]",Gs="(?:"+dr+"|"+Ra+")",lo="[^"+$e+"]",ba="(?:\\ud83c[\\udde6-\\uddff]){2}",ho="[\\ud800-\\udbff][\\udc00-\\udfff]",gi="["+mi+"]",La="\\u200d",Nu="(?:"+oa+"|"+Jn+")",oc="(?:"+gi+"|"+Jn+")",rr="(?:"+Gn+"(?:d|ll|m|re|s|t|ve))?",Vs="(?:"+Gn+"(?:D|LL|M|RE|S|T|VE))?",Hs=Gs+"?",Ws="["+un+"]?",bl="(?:"+La+"(?:"+[lo,ba,ho].join("|")+")"+Ws+Hs+")*",Ni="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Pn="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Br=Ws+Hs+bl,uo="(?:"+[Tn,ba,ho].join("|")+")"+Br,Xo="(?:"+[lo+dr+"?",dr,ba,ho,pn].join("|")+")",Eh=RegExp(Gn,"g"),nn=RegExp(dr,"g"),Yo=RegExp(Ra+"(?="+Ra+")|"+Xo+Br,"g"),Ss=RegExp([gi+"?"+oa+"+"+rr+"(?="+[ji,gi,"$"].join("|")+")",oc+"+"+Vs+"(?="+[ji,gi+Nu,"$"].join("|")+")",gi+"?"+Nu+"+"+rr,gi+"+"+Vs,Pn,Ni,zs,uo].join("|"),"g"),ko=RegExp("["+La+$e+Ji+un+"]"),Bu=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fo=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],xr=-1,Ki={};Ki[Pe]=Ki[te]=Ki[Ge]=Ki[Oe]=Ki[Be]=Ki[Le]=Ki[ne]=Ki[je]=Ki[ri]=!0,Ki[U]=Ki[H]=Ki[ge]=Ki[_]=Ki[xe]=Ki[q]=Ki[ot]=Ki[rt]=Ki[yt]=Ki[Et]=Ki[Pt]=Ki[ut]=Ki[Rt]=Ki[Dt]=Ki[re]=!1;var Zi={};Zi[U]=Zi[H]=Zi[ge]=Zi[xe]=Zi[_]=Zi[q]=Zi[Pe]=Zi[te]=Zi[Ge]=Zi[Oe]=Zi[Be]=Zi[yt]=Zi[Et]=Zi[Pt]=Zi[ut]=Zi[Rt]=Zi[Dt]=Zi[Ht]=Zi[Le]=Zi[ne]=Zi[je]=Zi[ri]=!0,Zi[ot]=Zi[rt]=Zi[re]=!1;var Ts={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Ur={"&":"&","<":"<",">":">",'"':""","'":"'"},Ll={"&":"&","<":"<",">":">",""":'"',"'":"'"},Mh={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jo=parseFloat,Fl=parseInt,zr=typeof global=="object"&&global&&global.Object===Object&&global,lc=typeof self=="object"&&self&&self.Object===Object&&self,yn=zr||lc||Function("return this")(),Ch=typeof g=="object"&&g&&!g.nodeType&&g,Rn=Ch&&typeof t=="object"&&t&&!t.nodeType&&t,Fa=Rn&&Rn.exports===Ch,Oa=Fa&&zr.process,En=function(){try{var ct=Rn&&Rn.require&&Rn.require("util").types;return ct||Oa&&Oa.binding&&Oa.binding("util")}catch{}}(),Da=En&&En.isArrayBuffer,Ia=En&&En.isDate,Ol=En&&En.isMap,Dl=En&&En.isRegExp,Na=En&&En.isSet,Xs=En&&En.isTypedArray;function $i(ct,St,vt){switch(vt.length){case 0:return ct.call(St);case 1:return ct.call(St,vt[0]);case 2:return ct.call(St,vt[0],vt[1]);case 3:return ct.call(St,vt[0],vt[1],vt[2])}return ct.apply(St,vt)}function Wr(ct,St,vt,Ft){for(var Lt=-1,Ut=ct==null?0:ct.length;++Lt-1}function la(ct,St,vt){for(var Ft=-1,Lt=ct==null?0:ct.length;++Ft-1;);return vt}function po(ct,St){for(var vt=ct.length;vt--&&ts(St,ct[vt],0)>-1;);return vt}function is(ct,St){for(var vt=ct.length,Ft=0;vt--;)ct[vt]===St&&++Ft;return Ft}var Uu=ar(Ts),$o=ar(Ur);function ns(ct){return"\\"+Mh[ct]}function cn(ct,St){return ct==null?i:ct[St]}function Cs(ct){return ko.test(ct)}function lr(ct){return Bu.test(ct)}function vo(ct){for(var St,vt=[];!(St=ct.next()).done;)vt.push(St.value);return vt}function Ga(ct){var St=-1,vt=Array(ct.size);return ct.forEach(function(Ft,Lt){vt[++St]=[Lt,Ft]}),vt}function Va(ct,St){return function(vt){return ct(St(vt))}}function Qn(ct,St){for(var vt=-1,Ft=ct.length,Lt=0,Ut=[];++vt-1}function Gu(R,N){var k=this.__data__,nt=To(k,R);return nt<0?(++this.size,k.push([R,N])):k[nt][1]=N,this}ks.prototype.clear=Ep,ks.prototype.delete=dc,ks.prototype.get=Mp,ks.prototype.has=Cp,ks.prototype.set=Gu;function ws(R){var N=-1,k=R==null?0:R.length;for(this.clear();++N=N?R:N)),R}function ss(R,N,k,nt,ft,xt){var Ot,Gt=N&h,kt=N&a,fe=N&l;if(k&&(Ot=ft?k(R,nt,ft,xt):k(R)),Ot!==i)return Ot;if(!Dn(R))return R;var ce=Ti(R);if(ce){if(Ot=eP(R),!Gt)return Rr(R,Ot)}else{var ye=Yr(R),Ie=ye==rt||ye==gt;if($l(R))return Dc(R,Gt);if(ye==Pt||ye==U||Ie&&!ft){if(Ot=kt||Ie?{}:K1(R),!Gt)return kt?Vp(R,Lp(Ot,R)):Hg(R,xc(Ot,R))}else{if(!Zi[ye])return ft?R:{};Ot=iP(R,ye,Gt)}}xt||(xt=new qn);var Ke=xt.get(R);if(Ke)return Ke;xt.set(R,Ot),ES(R)?R.forEach(function(hi){Ot.add(ss(hi,N,k,hi,R,xt))}):SS(R)&&R.forEach(function(hi,Bi){Ot.set(Bi,ss(hi,N,k,Bi,R,xt))});var li=fe?kt?Ui:Yn:kt?Ls:Lr,Fi=ce?i:li(R);return xn(Fi||R,function(hi,Bi){Fi&&(Bi=hi,hi=R[Bi]),js(Ot,Bi,ss(hi,N,k,Bi,R,xt))}),Ot}function Sc(R){var N=Lr(R);return function(k){return Xu(k,R,N)}}function Xu(R,N,k){var nt=k.length;if(R==null)return!nt;for(R=It(R);nt--;){var ft=k[nt],xt=N[ft],Ot=R[ft];if(Ot===i&&!(ft in R)||!xt(Ot))return!1}return!0}function Tc(R,N,k){if(typeof R!="function")throw new $t(s);return Uc(function(){R.apply(i,k)},N)}function el(R,N,k,nt){var ft=-1,xt=Sr,Ot=!0,Gt=R.length,kt=[],fe=N.length;if(!Gt)return kt;k&&(N=Qi(N,or(k))),nt?(xt=la,Ot=!1):N.length>=T&&(xt=Hn,Ot=!1,N=new So(N));t:for(;++ftft?0:ft+k),nt=nt===i||nt>ft?ft:Ri(nt),nt<0&&(nt+=ft),nt=k>nt?0:CS(nt);k0&&k(Gt)?N>1?hr(Gt,N-1,k,nt,ft):Xr(ft,Gt):nt||(ft[ft.length]=Gt)}return ft}var Hl=ef(),Bh=ef(!0);function as(R,N){return R&&Hl(R,N,Lr)}function Wl(R,N){return R&&Bh(R,N,Lr)}function il(R,N){return Mn(N,function(k){return ol(R[k])})}function Zs(R,N){N=Po(N,R);for(var k=0,nt=N.length;R!=null&&kN}function Dp(R,N){return R!=null&&me.call(R,N)}function Mc(R,N){return R!=null&&N in It(R)}function Gg(R,N,k){return R>=Er(N,k)&&R<_n(N,k)}function Xl(R,N,k){for(var nt=k?la:Sr,ft=R[0].length,xt=R.length,Ot=xt,Gt=vt(xt),kt=1/0,fe=[];Ot--;){var ce=R[Ot];Ot&&N&&(ce=Qi(ce,or(N))),kt=Er(ce.length,kt),Gt[Ot]=!k&&(N||ft>=120&&ce.length>=120)?new So(Ot&&ce):i}ce=R[0];var ye=-1,Ie=Gt[0];t:for(;++ye-1;)Gt!==R&&yo.call(Gt,kt,1),yo.call(R,kt,1);return R}function wr(R,N){for(var k=R?N.length:0,nt=k-1;k--;){var ft=N[k];if(k==nt||ft!==xt){var xt=ft;al(ft)?yo.call(R,ft,1):Lc(R,ft)}}return R}function va(R,N){return R+bh(fc()*(N-R+1))}function As(R,N,k,nt){for(var ft=-1,xt=_n(Rh((N-R)/(k||1)),0),Ot=vt(xt);xt--;)Ot[nt?xt:++ft]=R,R+=k;return Ot}function Jl(R,N){var k="";if(!R||N<1||N>z)return k;do N%2&&(k+=R),N=bh(N/2),N&&(R+=R);while(N);return k}function ei(R,N){return Zg($1(R,N,Fs),R+"")}function Ip(R){return Ih(af(R))}function Pc(R,N){var k=af(R);return Xp(k,Eo(N,0,k.length))}function rl(R,N,k,nt){if(!Dn(R))return R;N=Po(N,R);for(var ft=-1,xt=N.length,Ot=xt-1,Gt=R;Gt!=null&&++ftft?0:ft+N),k=k>ft?ft:k,k<0&&(k+=ft),ft=N>k?0:k-N>>>0,N>>>=0;for(var xt=vt(ft);++nt>>1,Ot=R[xt];Ot!==null&&!$s(Ot)&&(k?Ot<=N:Ot=T){var fe=N?null:br(R);if(fe)return Ha(fe);Ot=!1,ft=Hn,kt=new So}else kt=N?[]:Gt;t:for(;++nt=nt?R:ls(R,N,k)}var zp=Ph||function(R){return yn.clearTimeout(R)};function Dc(R,N){if(N)return R.slice();var k=R.length,nt=mo?mo(k):new R.constructor(k);return R.copy(nt),nt}function qu(R){var N=new R.constructor(R.byteLength);return new Cn(N).set(new Cn(R)),N}function Vg(R,N){var k=N?qu(R.buffer):R.buffer;return new R.constructor(k,R.byteOffset,R.byteLength)}function Ps(R){var N=new R.constructor(R.source,Rl.exec(R));return N.lastIndex=R.lastIndex,N}function Ic(R){return Xa?It(Xa.call(R)):{}}function Gp(R,N){var k=N?qu(R.buffer):R.buffer;return new R.constructor(k,R.byteOffset,R.length)}function ja(R,N){if(R!==N){var k=R!==i,nt=R===null,ft=R===R,xt=$s(R),Ot=N!==i,Gt=N===null,kt=N===N,fe=$s(N);if(!Gt&&!fe&&!xt&&R>N||xt&&Ot&&kt&&!Gt&&!fe||nt&&Ot&&kt||!k&&kt||!ft)return 1;if(!nt&&!xt&&!fe&&R=Gt)return kt;var fe=k[nt];return kt*(fe=="desc"?-1:1)}}return R.index-N.index}function bo(R,N,k,nt){for(var ft=-1,xt=R.length,Ot=k.length,Gt=-1,kt=N.length,fe=_n(xt-Ot,0),ce=vt(kt+fe),ye=!nt;++Gt1?k[ft-1]:i,Ot=ft>2?k[2]:i;for(xt=R.length>3&&typeof xt=="function"?(ft--,xt):i,Ot&&us(k[0],k[1],Ot)&&(xt=ft<3?i:xt,ft=1),N=It(N);++nt-1?ft[xt?N[Ot]:Ot]:i}}function it(R){return wi(function(N){var k=N.length,nt=k,ft=Mr.prototype.thru;for(R&&N.reverse();nt--;){var xt=N[nt];if(typeof xt!="function")throw new $t(s);if(ft&&!Ot&&nf(xt)=="wrapper")var Ot=new Mr([],!0)}for(nt=Ot?nt:k;++nt1&&Vi.reverse(),ce&&ktGt))return!1;var fe=xt.get(R),ce=xt.get(N);if(fe&&ce)return fe==N&&ce==R;var ye=-1,Ie=!0,Ke=k&u?new So:i;for(xt.set(R,N),xt.set(N,R);++ye1?"& ":"")+N[nt],N=N.join(k>2?", ":" "),R.replace(Bs,`{ /* [wrapped with `+N+`] */ -`)}function iP(R){return Si(R)||jh(R)||!!(hc&&R&&R[hc])}function sl(R,N){var k=typeof R;return N=N??z,!!N&&(k=="number"||k!="symbol"&&te.test(R))&&R>-1&&R%1==0&&R0){if(++N>=b)return arguments[0]}else N=0;return R.apply(i,arguments)}}function Wp(R,N){var k=-1,nt=R.length,ft=nt-1;for(N=N===i?nt:N;++k1?R[N-1]:i;return k=typeof k=="function"?(R.pop(),k):i,hS(R,k)});function uS(R){var N=mt(R);return N.__chain__=!0,N}function dR(R,N){return N(R),R}function Xp(R,N){return N(R)}var pR=Ci(function(R){var N=R.length,k=N?R[0]:0,nt=this.__wrapped__,ft=function(xt){return Xu(xt,R)};return N>1||this.__actions__.length||!(nt instanceof ni)||!sl(k)?this.thru(ft):(nt=nt.slice(k,+k+(N?1:0)),nt.__actions__.push({func:Xp,args:[ft],thisArg:i}),new Mr(nt,this.__chain__).thru(function(xt){return N&&!xt.length&&xt.push(i),xt}))});function vR(){return uS(this)}function mR(){return new Mr(this.value(),this.__chain__)}function gR(){this.__values__===i&&(this.__values__=CS(this.value()));var R=this.__index__>=this.__values__.length,N=R?i:this.__values__[this.__index__++];return{done:R,value:N}}function yR(){return this}function xR(R){for(var N,k=this;k instanceof Dh;){var nt=nS(k);nt.__index__=0,nt.__values__=i,N?ft.__wrapped__=nt:N=nt;var ft=nt;k=k.__wrapped__}return ft.__wrapped__=R,N}function SR(){var R=this.__wrapped__;if(R instanceof ni){var N=R;return this.__actions__.length&&(N=new ni(this)),N=N.reverse(),N.__actions__.push({func:Xp,args:[Zg],thisArg:i}),new Mr(N,this.__chain__)}return this.thru(Zg)}function TR(){return wo(this.__wrapped__,this.__actions__)}var ER=Yh(function(R,N,k){me.call(R,k)?++R[k]:pa(R,k,1)});function MR(R,N,k){var nt=Si(R)?Ba:Ug;return k&&us(R,N,k)&&(N=i),nt(R,oi(N,3))}function CR(R,N){var k=Si(R)?Mn:Ec;return k(R,oi(N,3))}var wR=$(rS),AR=$(sS);function PR(R,N){return hr(Yp(R,N),1)}function RR(R,N){return hr(Yp(R,N),G)}function bR(R,N,k){return k=k===i?1:Ri(k),hr(Yp(R,N),k)}function fS(R,N){var k=Si(R)?xn:js;return k(R,oi(N,3))}function cS(R,N){var k=Si(R)?Vn:Lp;return k(R,oi(N,3))}var LR=Yh(function(R,N,k){me.call(R,k)?R[k].push(N):pa(R,k,[N])});function FR(R,N,k,nt){R=bs(R)?R:of(R),k=k&&!nt?Ri(k):0;var ft=R.length;return k<0&&(k=_n(ft+k,0)),Jp(R)?k<=ft&&R.indexOf(N,k)>-1:!!ft&&ts(R,N,k)>-1}var OR=ei(function(R,N,k){var nt=-1,ft=typeof N=="function",xt=bs(R)?vt(R.length):[];return js(R,function(Ot){xt[++nt]=ft?$i(N,Ot,k):dn(Ot,N,k)}),xt}),DR=Yh(function(R,N,k){pa(R,k,N)});function Yp(R,N){var k=Si(R)?Qi:il;return k(R,oi(N,3))}function IR(R,N,k,nt){return R==null?[]:(Si(N)||(N=N==null?[]:[N]),k=nt?i:k,Si(k)||(k=k==null?[]:[k]),Vh(R,N,k))}var NR=Yh(function(R,N,k){R[k?0:1].push(N)},function(){return[[],[]]});function BR(R,N,k){var nt=Si(R)?Ua:fa,ft=arguments.length<3;return nt(R,oi(N,4),k,ft,js)}function UR(R,N,k){var nt=Si(R)?Il:fa,ft=arguments.length<3;return nt(R,oi(N,4),k,ft,Lp)}function zR(R,N){var k=Si(R)?Mn:Ec;return k(R,jp(oi(N,3)))}function GR(R){var N=Si(R)?Ih:Dp;return N(R)}function VR(R,N,k){(k?us(R,N,k):N===i)?N=1:N=Ri(N);var nt=Si(R)?mc:Pc;return nt(R,N)}function HR(R){var N=Si(R)?Rp:Np;return N(R)}function WR(R){if(R==null)return 0;if(bs(R))return Jp(R)?V(R):R.length;var N=Yr(R);return N==yt||N==Rt?R.size:Cr(R).length}function XR(R,N,k){var nt=Si(R)?qr:Rc;return k&&us(R,N,k)&&(N=i),nt(R,oi(N,3))}var YR=ei(function(R,N){if(R==null)return[];var k=N.length;return k>1&&us(R,N[0],N[1])?N=[]:k>2&&us(N[0],N[1],N[2])&&(N=[N[0]]),Vh(R,hr(N,1),[])}),kp=sp||function(){return yn.Date.now()};function kR(R,N){if(typeof N!="function")throw new $t(s);return R=Ri(R),function(){if(--R<1)return N.apply(this,arguments)}}function dS(R,N,k){return N=k?i:N,N=R&&N==null?R.length:N,Jt(R,M,i,i,i,i,N)}function pS(R,N){var k;if(typeof N!="function")throw new $t(s);return R=Ri(R),function(){return--R>0&&(k=N.apply(this,arguments)),R<=1&&(N=i),k}}var $g=ei(function(R,N,k){var nt=f;if(k.length){var ft=Qn(k,sf($g));nt|=m}return Jt(R,nt,N,k,ft)}),vS=ei(function(R,N,k){var nt=f|o;if(k.length){var ft=Qn(k,sf(vS));nt|=m}return Jt(N,nt,R,k,ft)});function mS(R,N,k){N=k?i:N;var nt=Jt(R,d,i,i,i,i,i,N);return nt.placeholder=mS.placeholder,nt}function gS(R,N,k){N=k?i:N;var nt=Jt(R,v,i,i,i,i,i,N);return nt.placeholder=gS.placeholder,nt}function yS(R,N,k){var nt,ft,xt,Ot,Gt,kt,fe=0,ce=!1,ye=!1,Ie=!0;if(typeof R!="function")throw new $t(s);N=xa(N)||0,Dn(k)&&(ce=!!k.leading,ye="maxWait"in k,xt=ye?_n(xa(k.maxWait)||0,N):xt,Ie="trailing"in k?!!k.trailing:Ie);function je(er){var Za=nt,ll=ft;return nt=ft=i,fe=er,Ot=R.apply(ll,Za),Ot}function li(er){return fe=er,Gt=Uc(Bi,N),ce?je(er):Ot}function Fi(er){var Za=er-kt,ll=er-fe,US=N-Za;return ye?Er(US,xt-ll):US}function hi(er){var Za=er-kt,ll=er-fe;return kt===i||Za>=N||Za<0||ye&&ll>=xt}function Bi(){var er=kp();if(hi(er))return Vi(er);Gt=Uc(Bi,Fi(er))}function Vi(er){return Gt=i,Ie&&nt?je(er):(nt=ft=i,Ot)}function Qs(){Gt!==i&&Up(Gt),fe=0,nt=kt=ft=Gt=i}function fs(){return Gt===i?Ot:Vi(kp())}function _s(){var er=kp(),Za=hi(er);if(nt=arguments,ft=this,kt=er,Za){if(Gt===i)return li(kt);if(ye)return Up(Gt),Gt=Uc(Bi,N),je(kt)}return Gt===i&&(Gt=Uc(Bi,N)),Ot}return _s.cancel=Qs,_s.flush=fs,_s}var KR=ei(function(R,N){return Tc(R,1,N)}),jR=ei(function(R,N,k){return Tc(R,xa(N)||0,k)});function ZR(R){return Jt(R,C)}function Kp(R,N){if(typeof R!="function"||N!=null&&typeof N!="function")throw new $t(s);var k=function(){var nt=arguments,ft=N?N.apply(this,nt):nt[0],xt=k.cache;if(xt.has(ft))return xt.get(ft);var Ot=R.apply(this,nt);return k.cache=xt.set(ft,Ot)||xt,Ot};return k.cache=new(Kp.Cache||ws),k}Kp.Cache=ws;function jp(R){if(typeof R!="function")throw new $t(s);return function(){var N=arguments;switch(N.length){case 0:return!R.call(this);case 1:return!R.call(this,N[0]);case 2:return!R.call(this,N[0],N[1]);case 3:return!R.call(this,N[0],N[1],N[2])}return!R.apply(this,N)}}function JR(R){return pS(2,R)}var $R=Bp(function(R,N){N=N.length==1&&Si(N[0])?Qi(N[0],or(oi())):Qi(hr(N,1),or(oi()));var k=N.length;return ei(function(nt){for(var ft=-1,xt=Er(nt.length,k);++ft=N}),jh=Ei(function(){return arguments}())?Ei:function(R){return kn(R)&&me.call(R,"callee")&&!go.call(R,"callee")},Si=vt.isArray,f3=Da?or(Da):Wn;function bs(R){return R!=null&&Zp(R.length)&&!al(R)}function tr(R){return kn(R)&&bs(R)}function c3(R){return R===!0||R===!1||kn(R)&&pr(R)==_}var $l=op||l0,d3=Ia?or(Ia):Xn;function p3(R){return kn(R)&&R.nodeType===1&&!zc(R)}function v3(R){if(R==null)return!0;if(bs(R)&&(Si(R)||typeof R=="string"||typeof R.splice=="function"||$l(R)||af(R)||jh(R)))return!R.length;var N=Yr(R);if(N==yt||N==Rt)return!R.size;if(Bc(R))return!Cr(R).length;for(var k in R)if(me.call(R,k))return!1;return!0}function m3(R,N){return Fn(R,N)}function g3(R,N,k){k=typeof k=="function"?k:i;var nt=k?k(R,N):i;return nt===i?Fn(R,N,i,k):!!nt}function _g(R){if(!kn(R))return!1;var N=pr(R);return N==ot||N==at||typeof R.message=="string"&&typeof R.name=="string"&&!zc(R)}function y3(R){return typeof R=="number"&&uc(R)}function al(R){if(!Dn(R))return!1;var N=pr(R);return N==rt||N==gt||N==J||N==dt}function SS(R){return typeof R=="number"&&R==Ri(R)}function Zp(R){return typeof R=="number"&&R>-1&&R%1==0&&R<=z}function Dn(R){var N=typeof R;return R!=null&&(N=="object"||N=="function")}function kn(R){return R!=null&&typeof R=="object"}var TS=Ol?or(Ol):Yl;function x3(R,N){return R===N||On(R,N,Wg(N))}function S3(R,N,k){return k=typeof k=="function"?k:i,On(R,N,Wg(N),k)}function T3(R){return ES(R)&&R!=+R}function E3(R){if(sP(R))throw new Lt(E);return kl(R)}function M3(R){return R===null}function C3(R){return R==null}function ES(R){return typeof R=="number"||kn(R)&&pr(R)==Et}function zc(R){if(!kn(R)||pr(R)!=Pt)return!1;var N=bn(R);if(N===null)return!0;var k=me.call(N,"constructor")&&N.constructor;return typeof k=="function"&&k instanceof k&&we.call(k)==ui}var qg=Dl?or(Dl):Kl;function w3(R){return SS(R)&&R>=-z&&R<=z}var MS=Na?or(Na):Ku;function Jp(R){return typeof R=="string"||!Si(R)&&kn(R)&&pr(R)==Dt}function $s(R){return typeof R=="symbol"||kn(R)&&pr(R)==Ht}var af=Xs?or(Xs):wc;function A3(R){return R===i}function P3(R){return kn(R)&&Yr(R)==ne}function R3(R){return kn(R)&&pr(R)==oe}var b3=Qe(zh),L3=Qe(function(R,N){return R<=N});function CS(R){if(!R)return[];if(bs(R))return Jp(R)?j(R):Rr(R);if(xo&&R[xo])return vo(R[xo]());var N=Yr(R),k=N==yt?Ga:N==Rt?Ha:of;return k(R)}function ol(R){if(!R)return R===0?R:0;if(R=xa(R),R===G||R===-G){var N=R<0?-1:1;return N*X}return R===R?R:0}function Ri(R){var N=ol(R),k=N%1;return N===N?k?N-k:N:0}function wS(R){return R?Eo(Ri(R),0,Q):0}function xa(R){if(typeof R=="number")return R;if($s(R))return K;if(Dn(R)){var N=typeof R.valueOf=="function"?R.valueOf():R;R=Dn(N)?N+"":N}if(typeof R!="string")return R===0?R:+R;R=Bl(R);var k=jt.test(R);return k||ee.test(R)?Fl(R.slice(2),k?2:8):Tt.test(R)?K:+R}function AS(R){return Rs(R,Ls(R))}function F3(R){return R?Eo(Ri(R),-z,z):R===0?R:0}function tn(R){return R==null?"":Ar(R)}var O3=rl(function(R,N){if(Bc(N)||bs(N)){Rs(N,Lr(N),R);return}for(var k in N)me.call(N,k)&&Ks(R,k,N[k])}),PS=rl(function(R,N){Rs(N,Ls(N),R)}),$p=rl(function(R,N,k,nt){Rs(N,Ls(N),R,nt)}),D3=rl(function(R,N,k,nt){Rs(N,Lr(N),R,nt)}),I3=Ci(Xu);function N3(R,N){var k=Ya(R);return N==null?k:xc(k,N)}var B3=ei(function(R,N){R=It(R);var k=-1,nt=N.length,ft=nt>2?N[2]:i;for(ft&&us(N[0],N[1],ft)&&(nt=1);++k1),xt}),Rs(R,Ui(R),k),nt&&(k=ss(k,h|a|l,Ne));for(var ft=N.length;ft--;)Lc(k,N[ft]);return k});function tb(R,N){return bS(R,jp(oi(N)))}var eb=Ci(function(R,N){return R==null?{}:Hh(R,N)});function bS(R,N){if(R==null)return{};var k=Qi(Ui(R),function(nt){return[nt]});return N=oi(N),Ju(R,k,function(nt,ft){return N(nt,ft[0])})}function ib(R,N,k){N=Po(N,R);var nt=-1,ft=N.length;for(ft||(ft=1,R=i);++ntN){var nt=R;R=N,N=nt}if(k||R%1||N%1){var ft=fc();return Er(R+ft*(N-R+ko("1e-"+((ft+"").length-1))),N)}return va(R,N)}var db=L(function(R,N,k){return N=N.toLowerCase(),R+(k?OS(N):N)});function OS(R){return i0(tn(R).toLowerCase())}function DS(R){return R=tn(R),R&&R.replace(Te,zu).replace(nn,"")}function pb(R,N,k){R=tn(R),N=Ar(N);var nt=R.length;k=k===i?nt:Eo(Ri(k),0,nt);var ft=k;return k-=N.length,k>=0&&R.slice(k,ft)==N}function vb(R){return R=tn(R),R&&Ve.test(R)?R.replace(Me,Jo):R}function mb(R){return R=tn(R),R&&Wi.test(R)?R.replace(di,"\\$&"):R}var gb=L(function(R,N,k){return R+(k?"-":"")+N.toLowerCase()}),yb=L(function(R,N,k){return R+(k?" ":"")+N.toLowerCase()}),xb=Vp("toLowerCase");function Sb(R,N,k){R=tn(R),N=Ri(N);var nt=N?V(R):0;if(!N||nt>=N)return R;var ft=(N-nt)/2;return Ee(bh(ft),k)+R+Ee(Rh(ft),k)}function Tb(R,N,k){R=tn(R),N=Ri(N);var nt=N?V(R):0;return N&&nt>>0,k?(R=tn(R),R&&(typeof N=="string"||N!=null&&!qg(N))&&(N=Ar(N),!N&&Cs(R))?Ro(j(R),0,k):R.split(N,k)):[]}var Rb=L(function(R,N,k){return R+(k?" ":"")+i0(N)});function bb(R,N,k){return R=tn(R),k=k==null?0:Eo(Ri(k),0,R.length),N=Ar(N),R.slice(k,k+N.length)==N}function Lb(R,N,k){var nt=mt.templateSettings;k&&us(R,N,k)&&(N=i),R=tn(R),N=$p({},N,nt,Yt);var ft=$p({},N.imports,nt.imports,Yt),xt=Lr(ft),Ot=$n(ft,xt),Gt,kt,fe=0,ce=N.interpolate||Ue,ye="__p += '",Ie=Kt((N.escape||Ue).source+"|"+ce.source+"|"+(ce===Di?oo:Ue).source+"|"+(N.evaluate||Ue).source+"|$","g"),je="//# sourceURL="+(me.call(N,"sourceURL")?(N.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++xr+"]")+` +`)}function rP(R){return Ti(R)||Kh(R)||!!(hc&&R&&R[hc])}function al(R,N){var k=typeof R;return N=N??z,!!N&&(k=="number"||k!="symbol"&&ee.test(R))&&R>-1&&R%1==0&&R0){if(++N>=b)return arguments[0]}else N=0;return R.apply(i,arguments)}}function Xp(R,N){var k=-1,nt=R.length,ft=nt-1;for(N=N===i?nt:N;++k1?R[N-1]:i;return k=typeof k=="function"?(R.pop(),k):i,lS(R,k)});function hS(R){var N=mt(R);return N.__chain__=!0,N}function vR(R,N){return N(R),R}function Yp(R,N){return N(R)}var mR=wi(function(R){var N=R.length,k=N?R[0]:0,nt=this.__wrapped__,ft=function(xt){return Wu(xt,R)};return N>1||this.__actions__.length||!(nt instanceof ni)||!al(k)?this.thru(ft):(nt=nt.slice(k,+k+(N?1:0)),nt.__actions__.push({func:Yp,args:[ft],thisArg:i}),new Mr(nt,this.__chain__).thru(function(xt){return N&&!xt.length&&xt.push(i),xt}))});function gR(){return hS(this)}function yR(){return new Mr(this.value(),this.__chain__)}function xR(){this.__values__===i&&(this.__values__=MS(this.value()));var R=this.__index__>=this.__values__.length,N=R?i:this.__values__[this.__index__++];return{done:R,value:N}}function SR(){return this}function TR(R){for(var N,k=this;k instanceof Dh;){var nt=iS(k);nt.__index__=0,nt.__values__=i,N?ft.__wrapped__=nt:N=nt;var ft=nt;k=k.__wrapped__}return ft.__wrapped__=R,N}function ER(){var R=this.__wrapped__;if(R instanceof ni){var N=R;return this.__actions__.length&&(N=new ni(this)),N=N.reverse(),N.__actions__.push({func:Yp,args:[Jg],thisArg:i}),new Mr(N,this.__chain__)}return this.thru(Jg)}function MR(){return wo(this.__wrapped__,this.__actions__)}var CR=Yh(function(R,N,k){me.call(R,k)?++R[k]:pa(R,k,1)});function wR(R,N,k){var nt=Ti(R)?Ba:zg;return k&&us(R,N,k)&&(N=i),nt(R,oi(N,3))}function AR(R,N){var k=Ti(R)?Mn:Ec;return k(R,oi(N,3))}var PR=$(nS),RR=$(rS);function bR(R,N){return hr(kp(R,N),1)}function LR(R,N){return hr(kp(R,N),G)}function FR(R,N,k){return k=k===i?1:Ri(k),hr(kp(R,N),k)}function uS(R,N){var k=Ti(R)?xn:Ks;return k(R,oi(N,3))}function fS(R,N){var k=Ti(R)?Vn:Fp;return k(R,oi(N,3))}var OR=Yh(function(R,N,k){me.call(R,k)?R[k].push(N):pa(R,k,[N])});function DR(R,N,k,nt){R=bs(R)?R:af(R),k=k&&!nt?Ri(k):0;var ft=R.length;return k<0&&(k=_n(ft+k,0)),$p(R)?k<=ft&&R.indexOf(N,k)>-1:!!ft&&ts(R,N,k)>-1}var IR=ei(function(R,N,k){var nt=-1,ft=typeof N=="function",xt=bs(R)?vt(R.length):[];return Ks(R,function(Ot){xt[++nt]=ft?$i(N,Ot,k):dn(Ot,N,k)}),xt}),NR=Yh(function(R,N,k){pa(R,k,N)});function kp(R,N){var k=Ti(R)?Qi:nl;return k(R,oi(N,3))}function BR(R,N,k,nt){return R==null?[]:(Ti(N)||(N=N==null?[]:[N]),k=nt?i:k,Ti(k)||(k=k==null?[]:[k]),Vh(R,N,k))}var UR=Yh(function(R,N,k){R[k?0:1].push(N)},function(){return[[],[]]});function zR(R,N,k){var nt=Ti(R)?Ua:fa,ft=arguments.length<3;return nt(R,oi(N,4),k,ft,Ks)}function GR(R,N,k){var nt=Ti(R)?Il:fa,ft=arguments.length<3;return nt(R,oi(N,4),k,ft,Fp)}function VR(R,N){var k=Ti(R)?Mn:Ec;return k(R,Zp(oi(N,3)))}function HR(R){var N=Ti(R)?Ih:Ip;return N(R)}function WR(R,N,k){(k?us(R,N,k):N===i)?N=1:N=Ri(N);var nt=Ti(R)?mc:Pc;return nt(R,N)}function XR(R){var N=Ti(R)?bp:Bp;return N(R)}function YR(R){if(R==null)return 0;if(bs(R))return $p(R)?V(R):R.length;var N=Yr(R);return N==yt||N==Rt?R.size:Cr(R).length}function kR(R,N,k){var nt=Ti(R)?qr:Rc;return k&&us(R,N,k)&&(N=i),nt(R,oi(N,3))}var jR=ei(function(R,N){if(R==null)return[];var k=N.length;return k>1&&us(R,N[0],N[1])?N=[]:k>2&&us(N[0],N[1],N[2])&&(N=[N[0]]),Vh(R,hr(N,1),[])}),jp=ap||function(){return yn.Date.now()};function KR(R,N){if(typeof N!="function")throw new $t(s);return R=Ri(R),function(){if(--R<1)return N.apply(this,arguments)}}function cS(R,N,k){return N=k?i:N,N=R&&N==null?R.length:N,Jt(R,M,i,i,i,i,N)}function dS(R,N){var k;if(typeof N!="function")throw new $t(s);return R=Ri(R),function(){return--R>0&&(k=N.apply(this,arguments)),R<=1&&(N=i),k}}var Qg=ei(function(R,N,k){var nt=f;if(k.length){var ft=Qn(k,rf(Qg));nt|=m}return Jt(R,nt,N,k,ft)}),pS=ei(function(R,N,k){var nt=f|o;if(k.length){var ft=Qn(k,rf(pS));nt|=m}return Jt(N,nt,R,k,ft)});function vS(R,N,k){N=k?i:N;var nt=Jt(R,d,i,i,i,i,i,N);return nt.placeholder=vS.placeholder,nt}function mS(R,N,k){N=k?i:N;var nt=Jt(R,v,i,i,i,i,i,N);return nt.placeholder=mS.placeholder,nt}function gS(R,N,k){var nt,ft,xt,Ot,Gt,kt,fe=0,ce=!1,ye=!1,Ie=!0;if(typeof R!="function")throw new $t(s);N=xa(N)||0,Dn(k)&&(ce=!!k.leading,ye="maxWait"in k,xt=ye?_n(xa(k.maxWait)||0,N):xt,Ie="trailing"in k?!!k.trailing:Ie);function Ke(er){var Za=nt,hl=ft;return nt=ft=i,fe=er,Ot=R.apply(hl,Za),Ot}function li(er){return fe=er,Gt=Uc(Bi,N),ce?Ke(er):Ot}function Fi(er){var Za=er-kt,hl=er-fe,BS=N-Za;return ye?Er(BS,xt-hl):BS}function hi(er){var Za=er-kt,hl=er-fe;return kt===i||Za>=N||Za<0||ye&&hl>=xt}function Bi(){var er=jp();if(hi(er))return Vi(er);Gt=Uc(Bi,Fi(er))}function Vi(er){return Gt=i,Ie&&nt?Ke(er):(nt=ft=i,Ot)}function Qs(){Gt!==i&&zp(Gt),fe=0,nt=kt=ft=Gt=i}function fs(){return Gt===i?Ot:Vi(jp())}function _s(){var er=jp(),Za=hi(er);if(nt=arguments,ft=this,kt=er,Za){if(Gt===i)return li(kt);if(ye)return zp(Gt),Gt=Uc(Bi,N),Ke(kt)}return Gt===i&&(Gt=Uc(Bi,N)),Ot}return _s.cancel=Qs,_s.flush=fs,_s}var ZR=ei(function(R,N){return Tc(R,1,N)}),JR=ei(function(R,N,k){return Tc(R,xa(N)||0,k)});function $R(R){return Jt(R,C)}function Kp(R,N){if(typeof R!="function"||N!=null&&typeof N!="function")throw new $t(s);var k=function(){var nt=arguments,ft=N?N.apply(this,nt):nt[0],xt=k.cache;if(xt.has(ft))return xt.get(ft);var Ot=R.apply(this,nt);return k.cache=xt.set(ft,Ot)||xt,Ot};return k.cache=new(Kp.Cache||ws),k}Kp.Cache=ws;function Zp(R){if(typeof R!="function")throw new $t(s);return function(){var N=arguments;switch(N.length){case 0:return!R.call(this);case 1:return!R.call(this,N[0]);case 2:return!R.call(this,N[0],N[1]);case 3:return!R.call(this,N[0],N[1],N[2])}return!R.apply(this,N)}}function QR(R){return dS(2,R)}var _R=Up(function(R,N){N=N.length==1&&Ti(N[0])?Qi(N[0],or(oi())):Qi(hr(N,1),or(oi()));var k=N.length;return ei(function(nt){for(var ft=-1,xt=Er(nt.length,k);++ft=N}),Kh=Mi(function(){return arguments}())?Mi:function(R){return kn(R)&&me.call(R,"callee")&&!go.call(R,"callee")},Ti=vt.isArray,d3=Da?or(Da):Wn;function bs(R){return R!=null&&Jp(R.length)&&!ol(R)}function tr(R){return kn(R)&&bs(R)}function p3(R){return R===!0||R===!1||kn(R)&&pr(R)==_}var $l=lp||h0,v3=Ia?or(Ia):Xn;function m3(R){return kn(R)&&R.nodeType===1&&!zc(R)}function g3(R){if(R==null)return!0;if(bs(R)&&(Ti(R)||typeof R=="string"||typeof R.splice=="function"||$l(R)||sf(R)||Kh(R)))return!R.length;var N=Yr(R);if(N==yt||N==Rt)return!R.size;if(Bc(R))return!Cr(R).length;for(var k in R)if(me.call(R,k))return!1;return!0}function y3(R,N){return Fn(R,N)}function x3(R,N,k){k=typeof k=="function"?k:i;var nt=k?k(R,N):i;return nt===i?Fn(R,N,i,k):!!nt}function qg(R){if(!kn(R))return!1;var N=pr(R);return N==ot||N==at||typeof R.message=="string"&&typeof R.name=="string"&&!zc(R)}function S3(R){return typeof R=="number"&&uc(R)}function ol(R){if(!Dn(R))return!1;var N=pr(R);return N==rt||N==gt||N==J||N==dt}function xS(R){return typeof R=="number"&&R==Ri(R)}function Jp(R){return typeof R=="number"&&R>-1&&R%1==0&&R<=z}function Dn(R){var N=typeof R;return R!=null&&(N=="object"||N=="function")}function kn(R){return R!=null&&typeof R=="object"}var SS=Ol?or(Ol):Yl;function T3(R,N){return R===N||On(R,N,Xg(N))}function E3(R,N,k){return k=typeof k=="function"?k:i,On(R,N,Xg(N),k)}function M3(R){return TS(R)&&R!=+R}function C3(R){if(oP(R))throw new Lt(E);return kl(R)}function w3(R){return R===null}function A3(R){return R==null}function TS(R){return typeof R=="number"||kn(R)&&pr(R)==Et}function zc(R){if(!kn(R)||pr(R)!=Pt)return!1;var N=bn(R);if(N===null)return!0;var k=me.call(N,"constructor")&&N.constructor;return typeof k=="function"&&k instanceof k&&we.call(k)==ui}var t0=Dl?or(Dl):jl;function P3(R){return xS(R)&&R>=-z&&R<=z}var ES=Na?or(Na):ku;function $p(R){return typeof R=="string"||!Ti(R)&&kn(R)&&pr(R)==Dt}function $s(R){return typeof R=="symbol"||kn(R)&&pr(R)==Ht}var sf=Xs?or(Xs):wc;function R3(R){return R===i}function b3(R){return kn(R)&&Yr(R)==re}function L3(R){return kn(R)&&pr(R)==le}var F3=Qe(zh),O3=Qe(function(R,N){return R<=N});function MS(R){if(!R)return[];if(bs(R))return $p(R)?K(R):Rr(R);if(xo&&R[xo])return vo(R[xo]());var N=Yr(R),k=N==yt?Ga:N==Rt?Ha:af;return k(R)}function ll(R){if(!R)return R===0?R:0;if(R=xa(R),R===G||R===-G){var N=R<0?-1:1;return N*X}return R===R?R:0}function Ri(R){var N=ll(R),k=N%1;return N===N?k?N-k:N:0}function CS(R){return R?Eo(Ri(R),0,Q):0}function xa(R){if(typeof R=="number")return R;if($s(R))return j;if(Dn(R)){var N=typeof R.valueOf=="function"?R.valueOf():R;R=Dn(N)?N+"":N}if(typeof R!="string")return R===0?R:+R;R=Bl(R);var k=Kt.test(R);return k||ie.test(R)?Fl(R.slice(2),k?2:8):Tt.test(R)?j:+R}function wS(R){return Rs(R,Ls(R))}function D3(R){return R?Eo(Ri(R),-z,z):R===0?R:0}function tn(R){return R==null?"":Ar(R)}var I3=sl(function(R,N){if(Bc(N)||bs(N)){Rs(N,Lr(N),R);return}for(var k in N)me.call(N,k)&&js(R,k,N[k])}),AS=sl(function(R,N){Rs(N,Ls(N),R)}),Qp=sl(function(R,N,k,nt){Rs(N,Ls(N),R,nt)}),N3=sl(function(R,N,k,nt){Rs(N,Lr(N),R,nt)}),B3=wi(Wu);function U3(R,N){var k=Ya(R);return N==null?k:xc(k,N)}var z3=ei(function(R,N){R=It(R);var k=-1,nt=N.length,ft=nt>2?N[2]:i;for(ft&&us(N[0],N[1],ft)&&(nt=1);++k1),xt}),Rs(R,Ui(R),k),nt&&(k=ss(k,h|a|l,Ne));for(var ft=N.length;ft--;)Lc(k,N[ft]);return k});function ib(R,N){return RS(R,Zp(oi(N)))}var nb=wi(function(R,N){return R==null?{}:Hh(R,N)});function RS(R,N){if(R==null)return{};var k=Qi(Ui(R),function(nt){return[nt]});return N=oi(N),Zu(R,k,function(nt,ft){return N(nt,ft[0])})}function rb(R,N,k){N=Po(N,R);var nt=-1,ft=N.length;for(ft||(ft=1,R=i);++ntN){var nt=R;R=N,N=nt}if(k||R%1||N%1){var ft=fc();return Er(R+ft*(N-R+jo("1e-"+((ft+"").length-1))),N)}return va(R,N)}var vb=L(function(R,N,k){return N=N.toLowerCase(),R+(k?FS(N):N)});function FS(R){return n0(tn(R).toLowerCase())}function OS(R){return R=tn(R),R&&R.replace(Te,Uu).replace(nn,"")}function mb(R,N,k){R=tn(R),N=Ar(N);var nt=R.length;k=k===i?nt:Eo(Ri(k),0,nt);var ft=k;return k-=N.length,k>=0&&R.slice(k,ft)==N}function gb(R){return R=tn(R),R&&Ve.test(R)?R.replace(Me,$o):R}function yb(R){return R=tn(R),R&&Wi.test(R)?R.replace(di,"\\$&"):R}var xb=L(function(R,N,k){return R+(k?"-":"")+N.toLowerCase()}),Sb=L(function(R,N,k){return R+(k?" ":"")+N.toLowerCase()}),Tb=Hp("toLowerCase");function Eb(R,N,k){R=tn(R),N=Ri(N);var nt=N?V(R):0;if(!N||nt>=N)return R;var ft=(N-nt)/2;return Ee(bh(ft),k)+R+Ee(Rh(ft),k)}function Mb(R,N,k){R=tn(R),N=Ri(N);var nt=N?V(R):0;return N&&nt>>0,k?(R=tn(R),R&&(typeof N=="string"||N!=null&&!t0(N))&&(N=Ar(N),!N&&Cs(R))?Ro(K(R),0,k):R.split(N,k)):[]}var Lb=L(function(R,N,k){return R+(k?" ":"")+n0(N)});function Fb(R,N,k){return R=tn(R),k=k==null?0:Eo(Ri(k),0,R.length),N=Ar(N),R.slice(k,k+N.length)==N}function Ob(R,N,k){var nt=mt.templateSettings;k&&us(R,N,k)&&(N=i),R=tn(R),N=Qp({},N,nt,Yt);var ft=Qp({},N.imports,nt.imports,Yt),xt=Lr(ft),Ot=$n(ft,xt),Gt,kt,fe=0,ce=N.interpolate||Ue,ye="__p += '",Ie=jt((N.escape||Ue).source+"|"+ce.source+"|"+(ce===Di?oo:Ue).source+"|"+(N.evaluate||Ue).source+"|$","g"),Ke="//# sourceURL="+(me.call(N,"sourceURL")?(N.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++xr+"]")+` `;R.replace(Ie,function(hi,Bi,Vi,Qs,fs,_s){return Vi||(Vi=Qs),ye+=R.slice(fe,_s).replace(We,ns),Bi&&(Gt=!0,ye+=`' + __e(`+Bi+`) + '`),fs&&(kt=!0,ye+=`'; @@ -6375,13 +6375,13 @@ __p += '`),Vi&&(ye+=`' + `;var li=me.call(N,"variable")&&N.variable;if(!li)ye=`with (obj) { `+ye+` } -`;else if(Us.test(li))throw new Lt(y);ye=(kt?ye.replace(Ti,""):ye).replace(le,"$1").replace(xi,"$1;"),ye="function("+(li||"obj")+`) { +`;else if(Us.test(li))throw new Lt(y);ye=(kt?ye.replace(Ei,""):ye).replace(he,"$1").replace(Si,"$1;"),ye="function("+(li||"obj")+`) { `+(li?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(Gt?", __e = _.escape":"")+(kt?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+ye+`return __p -}`;var Fi=NS(function(){return Ut(xt,je+"return "+ye).apply(i,Ot)});if(Fi.source=ye,_g(Fi))throw Fi;return Fi}function Fb(R){return tn(R).toLowerCase()}function Ob(R){return tn(R).toUpperCase()}function Db(R,N,k){if(R=tn(R),R&&(k||N===i))return Bl(R);if(!R||!(N=Ar(N)))return R;var nt=j(R),ft=j(N),xt=_i(nt,ft),Ot=po(nt,ft)+1;return Ro(nt,xt,Ot).join("")}function Ib(R,N,k){if(R=tn(R),R&&(k||N===i))return R.slice(0,et(R)+1);if(!R||!(N=Ar(N)))return R;var nt=j(R),ft=po(nt,j(N))+1;return Ro(nt,0,ft).join("")}function Nb(R,N,k){if(R=tn(R),R&&(k||N===i))return R.replace(Pa,"");if(!R||!(N=Ar(N)))return R;var nt=j(R),ft=_i(nt,j(N));return Ro(nt,ft).join("")}function Bb(R,N){var k=A,nt=P;if(Dn(N)){var ft="separator"in N?N.separator:ft;k="length"in N?Ri(N.length):k,nt="omission"in N?Ar(N.omission):nt}R=tn(R);var xt=R.length;if(Cs(R)){var Ot=j(R);xt=Ot.length}if(k>=xt)return R;var Gt=k-V(nt);if(Gt<1)return nt;var kt=Ot?Ro(Ot,0,Gt).join(""):R.slice(0,Gt);if(ft===i)return kt+nt;if(Ot&&(Gt+=kt.length-Gt),qg(ft)){if(R.slice(Gt).search(ft)){var fe,ce=kt;for(ft.global||(ft=Kt(ft.source,tn(Rl.exec(ft))+"g")),ft.lastIndex=0;fe=ft.exec(ce);)var ye=fe.index;kt=kt.slice(0,ye===i?Gt:ye)}}else if(R.indexOf(Ar(ft),Gt)!=Gt){var Ie=kt.lastIndexOf(ft);Ie>-1&&(kt=kt.slice(0,Ie))}return kt+nt}function Ub(R){return R=tn(R),R&&Ce.test(R)?R.replace(bt,st):R}var zb=L(function(R,N,k){return R+(k?" ":"")+N.toUpperCase()}),i0=Vp("toUpperCase");function IS(R,N,k){return R=tn(R),N=k?i:N,N===i?lr(R)?Mt(R):Ko(R):R.match(N)||[]}var NS=ei(function(R,N){try{return $i(R,i,N)}catch(k){return _g(k)?k:new Lt(k)}}),Gb=Ci(function(R,N){return xn(N,function(k){k=Lo(k),pa(R,k,$g(R[k],R))}),R});function Vb(R){var N=R==null?0:R.length,k=oi();return R=N?Qi(R,function(nt){if(typeof nt[1]!="function")throw new $t(s);return[k(nt[0]),nt[1]]}):[],ei(function(nt){for(var ft=-1;++ftz)return[];var k=Q,nt=Er(R,Q);N=oi(N),R-=Q;for(var ft=Ms(nt,N);++k0||N<0)?new ni(k):(R<0?k=k.takeRight(-R):R&&(k=k.drop(R)),N!==i&&(N=Ri(N),k=N<0?k.dropRight(-N):k.take(N-R)),k)},ni.prototype.takeRightWhile=function(R){return this.reverse().takeWhile(R).reverse()},ni.prototype.toArray=function(){return this.take(Q)},as(ni.prototype,function(R,N){var k=/^(?:filter|find|map|reject)|While$/.test(N),nt=/^(?:head|last)$/.test(N),ft=mt[nt?"take"+(N=="last"?"Right":""):N],xt=nt||/^find/.test(N);ft&&(mt.prototype[N]=function(){var Ot=this.__wrapped__,Gt=nt?[1]:arguments,kt=Ot instanceof ni,fe=Gt[0],ce=kt||Si(Ot),ye=function(Bi){var Vi=ft.apply(mt,Xr([Bi],Gt));return nt&&Ie?Vi[0]:Vi};ce&&k&&typeof fe=="function"&&fe.length!=1&&(kt=ce=!1);var Ie=this.__chain__,je=!!this.__actions__.length,li=xt&&!Ie,Fi=kt&&!je;if(!xt&&ce){Ot=Fi?Ot:new ni(this);var hi=R.apply(Ot,Gt);return hi.__actions__.push({func:Xp,args:[ye],thisArg:i}),new Mr(hi,Ie)}return li&&Fi?R.apply(this,Gt):(hi=this.thru(ye),li?nt?hi.value()[0]:hi.value():hi)})}),xn(["pop","push","shift","sort","splice","unshift"],function(R){var N=se[R],k=/^(?:push|sort|unshift)$/.test(R)?"tap":"thru",nt=/^(?:pop|shift)$/.test(R);mt.prototype[R]=function(){var ft=arguments;if(nt&&!this.__chain__){var xt=this.value();return N.apply(Si(xt)?xt:[],ft)}return this[k](function(Ot){return N.apply(Si(Ot)?Ot:[],ft)})}}),as(ni.prototype,function(R,N){var k=mt[N];if(k){var nt=k.name+"";me.call(_o,nt)||(_o[nt]=[]),_o[nt].push({name:N,func:k})}}),_o[lt(i,o).name]=[{name:"wrapper",func:i}],ni.prototype.clone=Og,ni.prototype.reverse=Dg,ni.prototype.value=rs,mt.prototype.at=pR,mt.prototype.chain=vR,mt.prototype.commit=mR,mt.prototype.next=gR,mt.prototype.plant=xR,mt.prototype.reverse=SR,mt.prototype.toJSON=mt.prototype.valueOf=mt.prototype.value=TR,mt.prototype.first=mt.prototype.head,xo&&(mt.prototype[xo]=yR),mt},zt=Nt();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(yn._=zt,define(function(){return zt})):Rn?((Rn.exports=zt)._=zt,Ch._=zt):yn._=zt}).call(g)}),IC=class extends Set{constructor(g,t=!1){super(g),this.valuesAsFlags=t}};function ld(g){if(g instanceof Map)return Object.fromEntries([...g.entries()].map(([t,i])=>[t,ld(i)]));if(g instanceof Set)return Array.from(g.values()).map(ld);if(g instanceof IC)return{values:[...g.values()],valuesAsFlags:g.valuesAsFlags};if(typeof g=="object"){let t={};return Object.entries(g).forEach(([i,x])=>{t[i]=ld(x)}),t}else return g}Zx(Jx(),1);var I4=Zx(Jx(),1);function lu(g,t){if(typeof g!="object")throw new Error(`Cannot merge into non-object objectToMergeWith. Received: ${JSON.stringify(g)}`);if(typeof t!="object")throw new Error(`Cannot merge using non-object objectToMergeWith. Received: ${JSON.stringify(t)}`);let i=(0,I4.cloneDeep)(g);for(let[x,T]of Object.entries(t))typeof T!="object"||T instanceof Set||i[x]===void 0?i[x]=T:i[x]=lu(i[x],T);return i}function NC(g,t){if(!(g===void 0||typeof g!="object"))for(let i of Object.keys(g)){if(i===t)return g[i];let x=g[i];if(typeof x=="object"){let T=NC(x,t);if(T!==void 0)return T}}}var v0="@composite:",N4="@inherit:",B4=class{constructor(g,t,i){this.tiledClassToMembersMap=g,this.enumNameToValuesMap=t,this.parserOptions=i,this.memoiser=new Map}flattenMembers(g,t){return this.memoiser.has(g)?{[g]:this.memoiser.get(g)}:(this.memoiser.set(g,t.reduce((i,x)=>An(An({},i),this.flattenMemberProperty(x)),{})),{[g]:this.memoiser.get(g)})}flattenMemberProperty(g){var t;let i=(t=g.propertyType)!=null?t:g.propertytype;if(g.type==="class"){if(!this.memoiser.has(i)){let E=this.tiledClassToMembersMap.get(i).reduce((s,y)=>lu(this.flattenMemberProperty(y),s),{});this.memoiser.set(i,E)}let x=this.memoiser.get(i),T=lu(x,this.flattenValue(g.value,x));return this.checkIfShouldFlatten(g.name)?T:{[g.name.replace(v0,"")]:T}}else return this.enumNameToValuesMap.has(i)?this.enumNameToValuesMap.get(i).valuesAsFlags?{[g.name]:new Set(g.value.split(",").filter(x=>x!==""))}:{[g.name]:g.value}:{[g.name]:g.value}}get memoisedFlattenedProperties(){return this.memoiser}flattenValue(g,t){return Object.entries(g).reduce((i,[x,T])=>{if(typeof T!="object")return NC(t,x)instanceof Set?lu({[x]:new Set(T.split(",").filter(E=>E!==""))},i):lu({[x]:T},i);if(this.checkIfShouldFlatten(x))return lu(this.flattenValue(T,t),i);{let E=x.replace(v0,"");return lu({[E]:this.flattenValue(T,t)},i)}},{})}checkIfShouldFlatten(g){var t;return((t=this.parserOptions)==null?void 0:t.defaultComposite)===!0?g.startsWith(N4):!g.startsWith(v0)}},uT=Zx(Jx(),1),U4=class{constructor(g){this.flattener=g}flattenPropertiesOnObject(g){var t,i,x,T;return dh(An(An({},this.flattener.memoisedFlattenedProperties.get((t=g.class)!=null?t:g.type)),(i=g.properties)==null?void 0:i.reduce((E,s)=>An(An({},E),this.flattener.flattenMemberProperty(s)),{})),{name:g.name,id:g.id,class:(T=(x=g.class)!=null?x:g.type)!=null?T:null,x:g.x,y:g.y})}flattenPropertiesOnTile(g){var t,i,x,T;return dh(An(An({},this.flattener.memoisedFlattenedProperties.get((t=g.class)!=null?t:g.type)),(i=g.properties)==null?void 0:i.reduce((E,s)=>An(An({},E),this.flattener.flattenMemberProperty(s)),{})),{id:g.id,class:(T=(x=g.class)!=null?x:g.type)!=null?T:null})}getCustomTypesMap(){return new Map([...this.flattener.memoisedFlattenedProperties.entries()].map(([g,t])=>[g,(0,uT.cloneDeep)(t)]))}getEnumsMap(){return new Map([...this.flattener.enumNameToValuesMap.entries()].map(([g,t])=>[g,(0,uT.cloneDeep)(t)]))}toJSON(){return JSON.stringify({customTypes:ld(this.getCustomTypesMap()),enums:ld(this.getEnumsMap())},null,4)}};function z4(g,t){let i=new Map(g.propertyTypes.filter(E=>E.type==="enum").map(E=>[E.name,new IC(E.values,E.valuesAsFlags)])),x=new Map(g.propertyTypes.filter(E=>E.type==="class").map(E=>[E.name,E.members])),T=new B4(x,i,t);return x.forEach((E,s)=>{T.flattenMembers(s,E)}),new U4(T)}var G4={parse:z4},BC=class{constructor(g,t){this.phaserTile=g,this.tiledProject=t}getProperty(g){var t,i;let x={};if(this.tiledProject){let T=G4.parse(this.tiledProject),E=this.getType();if(E){let s=(t=T.getCustomTypesMap())==null?void 0:t.get(E);if(s)for(let[y,e]of Object.entries(s))x[y]=e}}return(i=this.phaserTile.properties[g])!=null?i:x[g]}hasProperty(g){return this.getProperty(g)!=null}getType(){var g,t;return(t=(g=this.phaserTile.tileset)==null?void 0:g.tileData[this.phaserTile.index-1])==null?void 0:t.type}},V4=class{constructor(g,t){this.phaserTilemapLayer=g,this.tiledProject=t}getName(){return this.phaserTilemapLayer.layer.name}getProperty(g){let t=this.phaserTilemapLayer.layer.properties,i=t?.find(x=>x.name==g);return i?.value}hasProperty(g){return this.getProperty(g)!=null}isCharLayer(){return this.hasProperty(Qv)}getData(){return this.phaserTilemapLayer.layer.data.map(g=>g.map(t=>new BC(t,this.tiledProject)))}},H4=class{constructor(g,t){this.phaserTilemap=g,this.tiledProject=t;for(let i of this.phaserTilemap.layers)if(i.tilemapLayer==null)throw new Error(`Error initializing tilemap. Layer '${i.name}' has no 'tilemapLayer'. This can happen if you call 'createLayer' with the wrong layer ID.`)}getTileWidth(){return this.phaserTilemap.tileWidth}getTileHeight(){return this.phaserTilemap.tileHeight}getWidth(){return this.phaserTilemap.width}getHeight(){return this.phaserTilemap.height}getOrientation(){return this.phaserTilemap.orientation==Phaser.Tilemaps.Orientation.ISOMETRIC.toString()?"isometric":"orthogonal"}getLayers(){return this.phaserTilemap.layers.map(g=>new V4(g.tilemapLayer,this.tiledProject))}hasTileAt(g,t,i){return!!this.phaserTilemap.hasTileAt(g,t,i)}getTileAt(g,t,i){let x=this.phaserTilemap.getTileAt(g,t,!1,i);if(x)return new BC(x,this.tiledProject)}},UC=class Ry{constructor(t){this.scene=t,this.geHeadless=new M4(!1),this.isCreatedInternal=!1,Ry.welcomeMessagePrinted||(console.log(`Using GridEngine Phaser Plugin v${RC}`),Ry.welcomeMessagePrinted=!0),this.scene.sys.events.once("boot",this.boot,this)}boot(){this.scene.sys.events.on("update",this.update,this)}getCharLayer(t){return this.geHeadless.getCharLayer(t)}getTransition(t,i){return this.geHeadless.getTransition(t,i)}setTransition(t,i,x){this.geHeadless.setTransition(t,i,x)}create(t,i){this.geHeadless.create(new H4(t,i.tiledProject),i),this.isCreatedInternal=!0,this.gridCharacters=new Map;let x=this.setConfigDefaults(i);this.config=x,this.gridTilemap=new Py(t),this.addCharacters()}getPosition(t){return this.geHeadless.getPosition(t)}move(t,i){this.geHeadless.move(t,i)}moveRandomly(t,i=0,x=-1){this.geHeadless.moveRandomly(t,i,x)}getMovement(t){return this.geHeadless.getMovement(t)}moveTo(t,i,x){return this.geHeadless.moveTo(t,i,x)}stopMovement(t){this.geHeadless.stopMovement(t)}setSpeed(t,i){this.geHeadless.setSpeed(t,i)}getSpeed(t){return this.geHeadless.getSpeed(t)}setContainer(t,i){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(t);if(!T)throw this.createCharUnknownErr(t);T.setContainer(i)}getContainer(t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(t);if(!x)throw this.createCharUnknownErr(t);return x.getContainer()}getOffsetX(t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(t);if(!x)throw this.createCharUnknownErr(t);return x.getOffsetX()}setOffsetX(t,i){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(t);if(!T)throw this.createCharUnknownErr(t);T.setOffsetX(i)}getOffsetY(t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(t);if(!x)throw this.createCharUnknownErr(t);return x.getOffsetY()}setOffsetY(t,i){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(t);if(!T)throw this.createCharUnknownErr(t);T.setOffsetY(i)}collidesWithTiles(t){return this.geHeadless.collidesWithTiles(t)}getWalkingAnimationMapping(t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(t);if(!x)throw this.createCharUnknownErr(t);let T=x.getAnimation();return T?.getWalkingAnimationMapping()}hasLayerOverlay(){var t;return this.initGuard(),!!((t=this.config)!=null&&t.layerOverlay)}setWalkingAnimationMapping(t,i){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(t);if(!T)throw this.createCharUnknownErr(t);let E=T.getAnimation();E?.setWalkingAnimationMapping(i)}update(t,i){if(this.isCreatedInternal&&this.gridCharacters)for(let[x,T]of this.gridCharacters)T.update(i);this.geHeadless.update(t,i)}addCharacter(t){this.geHeadless.addCharacter(t),this.addCharacterInternal(t)}hasCharacter(t){return this.geHeadless.hasCharacter(t)}removeCharacter(t){var i,x;this.initGuard();let T=(i=this.gridCharacters)==null?void 0:i.get(t);if(!T)throw this.createCharUnknownErr(t);T.destroy(),(x=this.gridCharacters)==null||x.delete(t),this.geHeadless.removeCharacter(t)}removeAllCharacters(){if(this.initGuard(),!!this.gridCharacters){for(let t of this.gridCharacters.keys())this.removeCharacter(t);this.geHeadless.removeAllCharacters()}}getAllCharacters(t){return this.geHeadless.getAllCharacters(t)}getLabels(t){return this.geHeadless.getLabels(t)}addLabels(t,i){this.geHeadless.addLabels(t,i)}removeLabels(t,i){this.geHeadless.removeLabels(t,i)}clearLabels(t){this.geHeadless.clearLabels(t)}follow(t,i,x,T){let E;x===void 0?E={distance:0,closestPointIfBlocked:!1}:typeof x=="number"?(E={distance:x,closestPointIfBlocked:!1},T&&(E.closestPointIfBlocked=!0)):E=x,this.geHeadless.follow(t,i,E)}isMoving(t){return this.geHeadless.isMoving(t)}getFacingDirection(t){return this.geHeadless.getFacingDirection(t)}getFacingPosition(t){return this.geHeadless.getFacingPosition(t)}turnTowards(t,i){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(t);if(!T)throw this.createCharUnknownErr(t);T.turnTowards(i),this.geHeadless.turnTowards(t,i)}getCharactersAt(t,i){return this.geHeadless.getCharactersAt(t,i)}setPosition(t,i,x){this.geHeadless.setPosition(t,i,x)}getSprite(t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(t);if(!x)throw this.createCharUnknownErr(t);return x.getSprite()}setSprite(t,i){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(t);if(!T)throw this.createCharUnknownErr(t);i.setOrigin(0,0),T.setSprite(i)}isBlocked(t,i,x=["geDefault"]){return this.geHeadless.isBlocked(t,i,x)}isTileBlocked(t,i){return this.geHeadless.isTileBlocked(t,i)}getCollisionGroups(t){return this.geHeadless.getCollisionGroups(t)}setCollisionGroups(t,i){this.geHeadless.setCollisionGroups(t,i)}getIgnoreCollisionGroups(t){return this.geHeadless.getIgnoreCollisionGroups(t)}setIgnoreCollisionGroups(t,i){this.geHeadless.setIgnoreCollisionGroups(t,i)}getTilePosInDirection(t,i,x){return this.geHeadless.getTilePosInDirection(t,i,x)}findShortestPath(t,i,x={}){return this.geHeadless.findShortestPath(t,i,x)}steppedOn(t,i,x){return this.geHeadless.steppedOn(t,i,x)}characterShifted(){return this.geHeadless.characterShifted()}movementStarted(){return this.geHeadless.movementStarted()}movementStopped(){return this.geHeadless.movementStopped()}directionChanged(){return this.geHeadless.directionChanged()}positionChangeStarted(){return this.geHeadless.positionChangeStarted()}positionChangeFinished(){return this.geHeadless.positionChangeFinished()}getMovementProgress(t){return this.geHeadless.getMovementProgress(t)}rebuildTileCollisionCache(t,i,x,T){this.geHeadless.rebuildTileCollisionCache(t,i,x,T)}addQueueMovements(t,i,x){this.geHeadless.addQueueMovements(t,i,x)}getEnqueuedMovements(t){return this.geHeadless.getEnqueuedMovements(t)}queueMovementFinished(){return this.geHeadless.queueMovementFinished()}clearEnqueuedMovements(t){return this.geHeadless.clearEnqueuedMovements(t)}getState(){return{characters:this.geHeadless.getState().characters.map(t=>dh(An({},t),{offsetX:this.getOffsetX(t.id),offsetY:this.getOffsetY(t.id)}))}}setState(t){if(this.geHeadless.setState(t),this.gridCharacters)for(let i of t.characters){let x=this.gridCharacters.get(i.id);x&&(x.setOffsetX(i.offsetX),x.setOffsetY(i.offsetY))}}getTileCost(t,i,x){return this.initGuard(),this.geHeadless.getTileCost(t,i,x)}setConfigDefaults(t){return An({collisionTilePropertyName:"ge_collide",numberOfDirections:4,characterCollisionStrategy:"BLOCK_TWO_TILES",layerOverlay:!1,cacheTileCollisions:!1},t)}initGuard(){if(!this.isCreatedInternal)throw this.createUninitializedErr()}createUninitializedErr(){throw new Error("GridEngine not initialized. You need to call create() first.")}addCharacters(){var t;(t=this.config)==null||t.characters.forEach(i=>this.addCharacterInternal(i))}createCharUnknownErr(t){return new Error(`Character unknown: ${t}`)}addCharacterInternal(t){var i;if(this.initGuard(),!this.gridTilemap)throw this.createUninitializedErr();if(!this.config)throw this.createUninitializedErr();let x=new r4(t,this.scene,this.gridTilemap,this.config.layerOverlay,this.geHeadless);(i=this.gridCharacters)==null||i.set(t.id,x)}};UC.welcomeMessagePrinted=!1;var W4=UC,X4=W4;/*! Bundled license information: +}`;var Fi=IS(function(){return Ut(xt,Ke+"return "+ye).apply(i,Ot)});if(Fi.source=ye,qg(Fi))throw Fi;return Fi}function Db(R){return tn(R).toLowerCase()}function Ib(R){return tn(R).toUpperCase()}function Nb(R,N,k){if(R=tn(R),R&&(k||N===i))return Bl(R);if(!R||!(N=Ar(N)))return R;var nt=K(R),ft=K(N),xt=_i(nt,ft),Ot=po(nt,ft)+1;return Ro(nt,xt,Ot).join("")}function Bb(R,N,k){if(R=tn(R),R&&(k||N===i))return R.slice(0,et(R)+1);if(!R||!(N=Ar(N)))return R;var nt=K(R),ft=po(nt,K(N))+1;return Ro(nt,0,ft).join("")}function Ub(R,N,k){if(R=tn(R),R&&(k||N===i))return R.replace(Pa,"");if(!R||!(N=Ar(N)))return R;var nt=K(R),ft=_i(nt,K(N));return Ro(nt,ft).join("")}function zb(R,N){var k=A,nt=P;if(Dn(N)){var ft="separator"in N?N.separator:ft;k="length"in N?Ri(N.length):k,nt="omission"in N?Ar(N.omission):nt}R=tn(R);var xt=R.length;if(Cs(R)){var Ot=K(R);xt=Ot.length}if(k>=xt)return R;var Gt=k-V(nt);if(Gt<1)return nt;var kt=Ot?Ro(Ot,0,Gt).join(""):R.slice(0,Gt);if(ft===i)return kt+nt;if(Ot&&(Gt+=kt.length-Gt),t0(ft)){if(R.slice(Gt).search(ft)){var fe,ce=kt;for(ft.global||(ft=jt(ft.source,tn(Rl.exec(ft))+"g")),ft.lastIndex=0;fe=ft.exec(ce);)var ye=fe.index;kt=kt.slice(0,ye===i?Gt:ye)}}else if(R.indexOf(Ar(ft),Gt)!=Gt){var Ie=kt.lastIndexOf(ft);Ie>-1&&(kt=kt.slice(0,Ie))}return kt+nt}function Gb(R){return R=tn(R),R&&Ce.test(R)?R.replace(bt,st):R}var Vb=L(function(R,N,k){return R+(k?" ":"")+N.toUpperCase()}),n0=Hp("toUpperCase");function DS(R,N,k){return R=tn(R),N=k?i:N,N===i?lr(R)?Mt(R):Ko(R):R.match(N)||[]}var IS=ei(function(R,N){try{return $i(R,i,N)}catch(k){return qg(k)?k:new Lt(k)}}),Hb=wi(function(R,N){return xn(N,function(k){k=Lo(k),pa(R,k,Qg(R[k],R))}),R});function Wb(R){var N=R==null?0:R.length,k=oi();return R=N?Qi(R,function(nt){if(typeof nt[1]!="function")throw new $t(s);return[k(nt[0]),nt[1]]}):[],ei(function(nt){for(var ft=-1;++ftz)return[];var k=Q,nt=Er(R,Q);N=oi(N),R-=Q;for(var ft=Ms(nt,N);++k0||N<0)?new ni(k):(R<0?k=k.takeRight(-R):R&&(k=k.drop(R)),N!==i&&(N=Ri(N),k=N<0?k.dropRight(-N):k.take(N-R)),k)},ni.prototype.takeRightWhile=function(R){return this.reverse().takeWhile(R).reverse()},ni.prototype.toArray=function(){return this.take(Q)},as(ni.prototype,function(R,N){var k=/^(?:filter|find|map|reject)|While$/.test(N),nt=/^(?:head|last)$/.test(N),ft=mt[nt?"take"+(N=="last"?"Right":""):N],xt=nt||/^find/.test(N);ft&&(mt.prototype[N]=function(){var Ot=this.__wrapped__,Gt=nt?[1]:arguments,kt=Ot instanceof ni,fe=Gt[0],ce=kt||Ti(Ot),ye=function(Bi){var Vi=ft.apply(mt,Xr([Bi],Gt));return nt&&Ie?Vi[0]:Vi};ce&&k&&typeof fe=="function"&&fe.length!=1&&(kt=ce=!1);var Ie=this.__chain__,Ke=!!this.__actions__.length,li=xt&&!Ie,Fi=kt&&!Ke;if(!xt&&ce){Ot=Fi?Ot:new ni(this);var hi=R.apply(Ot,Gt);return hi.__actions__.push({func:Yp,args:[ye],thisArg:i}),new Mr(hi,Ie)}return li&&Fi?R.apply(this,Gt):(hi=this.thru(ye),li?nt?hi.value()[0]:hi.value():hi)})}),xn(["pop","push","shift","sort","splice","unshift"],function(R){var N=ae[R],k=/^(?:push|sort|unshift)$/.test(R)?"tap":"thru",nt=/^(?:pop|shift)$/.test(R);mt.prototype[R]=function(){var ft=arguments;if(nt&&!this.__chain__){var xt=this.value();return N.apply(Ti(xt)?xt:[],ft)}return this[k](function(Ot){return N.apply(Ti(Ot)?Ot:[],ft)})}}),as(ni.prototype,function(R,N){var k=mt[N];if(k){var nt=k.name+"";me.call(qo,nt)||(qo[nt]=[]),qo[nt].push({name:N,func:k})}}),qo[lt(i,o).name]=[{name:"wrapper",func:i}],ni.prototype.clone=Dg,ni.prototype.reverse=Ig,ni.prototype.value=rs,mt.prototype.at=mR,mt.prototype.chain=gR,mt.prototype.commit=yR,mt.prototype.next=xR,mt.prototype.plant=TR,mt.prototype.reverse=ER,mt.prototype.toJSON=mt.prototype.valueOf=mt.prototype.value=MR,mt.prototype.first=mt.prototype.head,xo&&(mt.prototype[xo]=SR),mt},zt=Nt();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(yn._=zt,define(function(){return zt})):Rn?((Rn.exports=zt)._=zt,Ch._=zt):yn._=zt}).call(g)}),NC=class extends Set{constructor(g,t=!1){super(g),this.valuesAsFlags=t}};function ld(g){if(g instanceof Map)return Object.fromEntries([...g.entries()].map(([t,i])=>[t,ld(i)]));if(g instanceof Set)return Array.from(g.values()).map(ld);if(g instanceof NC)return{values:[...g.values()],valuesAsFlags:g.valuesAsFlags};if(typeof g=="object"){let t={};return Object.entries(g).forEach(([i,x])=>{t[i]=ld(x)}),t}else return g}Zx(Jx(),1);var B4=Zx(Jx(),1);function ou(g,t){if(typeof g!="object")throw new Error(`Cannot merge into non-object objectToMergeWith. Received: ${JSON.stringify(g)}`);if(typeof t!="object")throw new Error(`Cannot merge using non-object objectToMergeWith. Received: ${JSON.stringify(t)}`);let i=(0,B4.cloneDeep)(g);for(let[x,T]of Object.entries(t))typeof T!="object"||T instanceof Set||i[x]===void 0?i[x]=T:i[x]=ou(i[x],T);return i}function BC(g,t){if(!(g===void 0||typeof g!="object"))for(let i of Object.keys(g)){if(i===t)return g[i];let x=g[i];if(typeof x=="object"){let T=BC(x,t);if(T!==void 0)return T}}}var m0="@composite:",U4="@inherit:",z4=class{constructor(g,t,i){this.tiledClassToMembersMap=g,this.enumNameToValuesMap=t,this.parserOptions=i,this.memoiser=new Map}flattenMembers(g,t){return this.memoiser.has(g)?{[g]:this.memoiser.get(g)}:(this.memoiser.set(g,t.reduce((i,x)=>An(An({},i),this.flattenMemberProperty(x)),{})),{[g]:this.memoiser.get(g)})}flattenMemberProperty(g){var t;let i=(t=g.propertyType)!=null?t:g.propertytype;if(g.type==="class"){if(!this.memoiser.has(i)){let E=this.tiledClassToMembersMap.get(i).reduce((s,y)=>ou(this.flattenMemberProperty(y),s),{});this.memoiser.set(i,E)}let x=this.memoiser.get(i),T=ou(x,this.flattenValue(g.value,x));return this.checkIfShouldFlatten(g.name)?T:{[g.name.replace(m0,"")]:T}}else return this.enumNameToValuesMap.has(i)?this.enumNameToValuesMap.get(i).valuesAsFlags?{[g.name]:new Set(g.value.split(",").filter(x=>x!==""))}:{[g.name]:g.value}:{[g.name]:g.value}}get memoisedFlattenedProperties(){return this.memoiser}flattenValue(g,t){return Object.entries(g).reduce((i,[x,T])=>{if(typeof T!="object")return BC(t,x)instanceof Set?ou({[x]:new Set(T.split(",").filter(E=>E!==""))},i):ou({[x]:T},i);if(this.checkIfShouldFlatten(x))return ou(this.flattenValue(T,t),i);{let E=x.replace(m0,"");return ou({[E]:this.flattenValue(T,t)},i)}},{})}checkIfShouldFlatten(g){var t;return((t=this.parserOptions)==null?void 0:t.defaultComposite)===!0?g.startsWith(U4):!g.startsWith(m0)}},hT=Zx(Jx(),1),G4=class{constructor(g){this.flattener=g}flattenPropertiesOnObject(g){var t,i,x,T;return dh(An(An({},this.flattener.memoisedFlattenedProperties.get((t=g.class)!=null?t:g.type)),(i=g.properties)==null?void 0:i.reduce((E,s)=>An(An({},E),this.flattener.flattenMemberProperty(s)),{})),{name:g.name,id:g.id,class:(T=(x=g.class)!=null?x:g.type)!=null?T:null,x:g.x,y:g.y})}flattenPropertiesOnTile(g){var t,i,x,T;return dh(An(An({},this.flattener.memoisedFlattenedProperties.get((t=g.class)!=null?t:g.type)),(i=g.properties)==null?void 0:i.reduce((E,s)=>An(An({},E),this.flattener.flattenMemberProperty(s)),{})),{id:g.id,class:(T=(x=g.class)!=null?x:g.type)!=null?T:null})}getCustomTypesMap(){return new Map([...this.flattener.memoisedFlattenedProperties.entries()].map(([g,t])=>[g,(0,hT.cloneDeep)(t)]))}getEnumsMap(){return new Map([...this.flattener.enumNameToValuesMap.entries()].map(([g,t])=>[g,(0,hT.cloneDeep)(t)]))}toJSON(){return JSON.stringify({customTypes:ld(this.getCustomTypesMap()),enums:ld(this.getEnumsMap())},null,4)}};function V4(g,t){let i=new Map(g.propertyTypes.filter(E=>E.type==="enum").map(E=>[E.name,new NC(E.values,E.valuesAsFlags)])),x=new Map(g.propertyTypes.filter(E=>E.type==="class").map(E=>[E.name,E.members])),T=new z4(x,i,t);return x.forEach((E,s)=>{T.flattenMembers(s,E)}),new G4(T)}var H4={parse:V4},UC=class{constructor(g,t){this.phaserTile=g,this.tiledProject=t}getProperty(g){var t,i;let x={};if(this.tiledProject){let T=H4.parse(this.tiledProject),E=this.getType();if(E){let s=(t=T.getCustomTypesMap())==null?void 0:t.get(E);if(s)for(let[y,e]of Object.entries(s))x[y]=e}}return(i=this.phaserTile.properties[g])!=null?i:x[g]}hasProperty(g){return this.getProperty(g)!=null}getType(){var g,t;return(t=(g=this.phaserTile.tileset)==null?void 0:g.tileData[this.phaserTile.index-1])==null?void 0:t.type}},W4=class{constructor(g,t){this.phaserTilemapLayer=g,this.tiledProject=t}getName(){return this.phaserTilemapLayer.layer.name}getProperty(g){let t=this.phaserTilemapLayer.layer.properties,i=t?.find(x=>x.name==g);return i?.value}hasProperty(g){return this.getProperty(g)!=null}isCharLayer(){return this.hasProperty(_v)}getData(){return this.phaserTilemapLayer.layer.data.map(g=>g.map(t=>new UC(t,this.tiledProject)))}},X4=class{constructor(g,t){this.phaserTilemap=g,this.tiledProject=t;for(let i of this.phaserTilemap.layers)if(i.tilemapLayer==null)throw new Error(`Error initializing tilemap. Layer '${i.name}' has no 'tilemapLayer'. This can happen if you call 'createLayer' with the wrong layer ID.`)}getTileWidth(){return this.phaserTilemap.tileWidth}getTileHeight(){return this.phaserTilemap.tileHeight}getWidth(){return this.phaserTilemap.width}getHeight(){return this.phaserTilemap.height}getOrientation(){return this.phaserTilemap.orientation==Phaser.Tilemaps.Orientation.ISOMETRIC.toString()?"isometric":"orthogonal"}getLayers(){return this.phaserTilemap.layers.map(g=>new W4(g.tilemapLayer,this.tiledProject))}hasTileAt(g,t,i){return!!this.phaserTilemap.hasTileAt(g,t,i)}getTileAt(g,t,i){let x=this.phaserTilemap.getTileAt(g,t,!1,i);if(x)return new UC(x,this.tiledProject)}},zC=class by{constructor(t){this.scene=t,this.geHeadless=new w4(!1),this.isCreatedInternal=!1,by.welcomeMessagePrinted||(console.log(`Using GridEngine Phaser Plugin v${bC}`),by.welcomeMessagePrinted=!0),this.scene.sys.events.once("boot",this.boot,this)}boot(){this.scene.sys.events.on("update",this.update,this)}getCharLayer(t){return this.geHeadless.getCharLayer(t)}getTransition(t,i){return this.geHeadless.getTransition(t,i)}setTransition(t,i,x){this.geHeadless.setTransition(t,i,x)}create(t,i){this.geHeadless.create(new X4(t,i.tiledProject),i),this.isCreatedInternal=!0,this.gridCharacters=new Map;let x=this.setConfigDefaults(i);this.config=x,this.gridTilemap=new Ry(t),this.addCharacters()}getPosition(t){return this.geHeadless.getPosition(t)}move(t,i){this.geHeadless.move(t,i)}moveRandomly(t,i=0,x=-1){this.geHeadless.moveRandomly(t,i,x)}getMovement(t){return this.geHeadless.getMovement(t)}moveTo(t,i,x){return this.geHeadless.moveTo(t,i,x)}stopMovement(t){this.geHeadless.stopMovement(t)}setSpeed(t,i){this.geHeadless.setSpeed(t,i)}getSpeed(t){return this.geHeadless.getSpeed(t)}setContainer(t,i){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(t);if(!T)throw this.createCharUnknownErr(t);T.setContainer(i)}getContainer(t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(t);if(!x)throw this.createCharUnknownErr(t);return x.getContainer()}getOffsetX(t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(t);if(!x)throw this.createCharUnknownErr(t);return x.getOffsetX()}setOffsetX(t,i){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(t);if(!T)throw this.createCharUnknownErr(t);T.setOffsetX(i)}getOffsetY(t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(t);if(!x)throw this.createCharUnknownErr(t);return x.getOffsetY()}setOffsetY(t,i){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(t);if(!T)throw this.createCharUnknownErr(t);T.setOffsetY(i)}collidesWithTiles(t){return this.geHeadless.collidesWithTiles(t)}getWalkingAnimationMapping(t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(t);if(!x)throw this.createCharUnknownErr(t);let T=x.getAnimation();return T?.getWalkingAnimationMapping()}hasLayerOverlay(){var t;return this.initGuard(),!!((t=this.config)!=null&&t.layerOverlay)}setWalkingAnimationMapping(t,i){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(t);if(!T)throw this.createCharUnknownErr(t);let E=T.getAnimation();E?.setWalkingAnimationMapping(i)}update(t,i){if(this.isCreatedInternal&&this.gridCharacters)for(let[x,T]of this.gridCharacters)T.update(i);this.geHeadless.update(t,i)}addCharacter(t){this.geHeadless.addCharacter(t),this.addCharacterInternal(t)}hasCharacter(t){return this.geHeadless.hasCharacter(t)}removeCharacter(t){var i,x;this.initGuard();let T=(i=this.gridCharacters)==null?void 0:i.get(t);if(!T)throw this.createCharUnknownErr(t);T.destroy(),(x=this.gridCharacters)==null||x.delete(t),this.geHeadless.removeCharacter(t)}removeAllCharacters(){if(this.initGuard(),!!this.gridCharacters){for(let t of this.gridCharacters.keys())this.removeCharacter(t);this.geHeadless.removeAllCharacters()}}getAllCharacters(t){return this.geHeadless.getAllCharacters(t)}getLabels(t){return this.geHeadless.getLabels(t)}addLabels(t,i){this.geHeadless.addLabels(t,i)}removeLabels(t,i){this.geHeadless.removeLabels(t,i)}clearLabels(t){this.geHeadless.clearLabels(t)}follow(t,i,x,T){let E;x===void 0?E={distance:0,closestPointIfBlocked:!1}:typeof x=="number"?(E={distance:x,closestPointIfBlocked:!1},T&&(E.closestPointIfBlocked=!0)):E=x,this.geHeadless.follow(t,i,E)}isMoving(t){return this.geHeadless.isMoving(t)}getFacingDirection(t){return this.geHeadless.getFacingDirection(t)}getFacingPosition(t){return this.geHeadless.getFacingPosition(t)}turnTowards(t,i){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(t);if(!T)throw this.createCharUnknownErr(t);T.turnTowards(i),this.geHeadless.turnTowards(t,i)}getCharactersAt(t,i){return this.geHeadless.getCharactersAt(t,i)}setPosition(t,i,x){this.geHeadless.setPosition(t,i,x)}getSprite(t){var i;this.initGuard();let x=(i=this.gridCharacters)==null?void 0:i.get(t);if(!x)throw this.createCharUnknownErr(t);return x.getSprite()}setSprite(t,i){var x;this.initGuard();let T=(x=this.gridCharacters)==null?void 0:x.get(t);if(!T)throw this.createCharUnknownErr(t);i.setOrigin(0,0),T.setSprite(i)}isBlocked(t,i,x=["geDefault"]){return this.geHeadless.isBlocked(t,i,x)}isTileBlocked(t,i){return this.geHeadless.isTileBlocked(t,i)}getCollisionGroups(t){return this.geHeadless.getCollisionGroups(t)}setCollisionGroups(t,i){this.geHeadless.setCollisionGroups(t,i)}getIgnoreCollisionGroups(t){return this.geHeadless.getIgnoreCollisionGroups(t)}setIgnoreCollisionGroups(t,i){this.geHeadless.setIgnoreCollisionGroups(t,i)}getTilePosInDirection(t,i,x){return this.geHeadless.getTilePosInDirection(t,i,x)}findShortestPath(t,i,x={}){return this.geHeadless.findShortestPath(t,i,x)}steppedOn(t,i,x){return this.geHeadless.steppedOn(t,i,x)}characterShifted(){return this.geHeadless.characterShifted()}movementStarted(){return this.geHeadless.movementStarted()}movementStopped(){return this.geHeadless.movementStopped()}directionChanged(){return this.geHeadless.directionChanged()}positionChangeStarted(){return this.geHeadless.positionChangeStarted()}positionChangeFinished(){return this.geHeadless.positionChangeFinished()}getMovementProgress(t){return this.geHeadless.getMovementProgress(t)}rebuildTileCollisionCache(t,i,x,T){this.geHeadless.rebuildTileCollisionCache(t,i,x,T)}addQueueMovements(t,i,x){this.geHeadless.addQueueMovements(t,i,x)}getEnqueuedMovements(t){return this.geHeadless.getEnqueuedMovements(t)}queueMovementFinished(){return this.geHeadless.queueMovementFinished()}clearEnqueuedMovements(t){return this.geHeadless.clearEnqueuedMovements(t)}getState(){return{characters:this.geHeadless.getState().characters.map(t=>dh(An({},t),{offsetX:this.getOffsetX(t.id),offsetY:this.getOffsetY(t.id)}))}}setState(t){if(this.geHeadless.setState(t),this.gridCharacters)for(let i of t.characters){let x=this.gridCharacters.get(i.id);x&&(x.setOffsetX(i.offsetX),x.setOffsetY(i.offsetY))}}getTileCost(t,i,x){return this.initGuard(),this.geHeadless.getTileCost(t,i,x)}setConfigDefaults(t){return An({collisionTilePropertyName:"ge_collide",numberOfDirections:4,characterCollisionStrategy:"BLOCK_TWO_TILES",layerOverlay:!1,cacheTileCollisions:!1},t)}initGuard(){if(!this.isCreatedInternal)throw this.createUninitializedErr()}createUninitializedErr(){throw new Error("GridEngine not initialized. You need to call create() first.")}addCharacters(){var t;(t=this.config)==null||t.characters.forEach(i=>this.addCharacterInternal(i))}createCharUnknownErr(t){return new Error(`Character unknown: ${t}`)}addCharacterInternal(t){var i;if(this.initGuard(),!this.gridTilemap)throw this.createUninitializedErr();if(!this.config)throw this.createUninitializedErr();let x=new a4(t,this.scene,this.gridTilemap,this.config.layerOverlay,this.geHeadless);(i=this.gridCharacters)==null||i.set(t.id,x)}};zC.welcomeMessagePrinted=!1;var Y4=zC,k4=Y4;/*! Bundled license information: tiled-property-flattener/dist/tiled_property_flattener.min.js: (*! Bundled license information: @@ -6396,20 +6396,20 @@ tiled-property-flattener/dist/tiled_property_flattener.min.js: * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors *) *) -*/function fT(g){return g.type==="ROLL_DICE"}class du{constructor(t,i=4){this.bounds=t,this.capacity=i,this.points=[],this.divided=!1,this.cache=new Map}subdivide(){const{xMin:t,yMin:i,xMax:x,yMax:T}=this.bounds,E=(x-t)/2,s=(T-i)/2,y=t,e=i;this.northeast=new du({xMin:y+E,xMax:y+2*E,yMin:i,yMax:e+s},this.capacity),this.northwest=new du({xMin:t,xMax:y+E,yMin:i,yMax:e+s},this.capacity),this.southeast=new du({xMin:y+E,xMax:y+2*E,yMin:e+s,yMax:e+2*s},this.capacity),this.southwest=new du({xMin:t,xMax:y+E,yMin:e+s,yMax:e+2*s},this.capacity),this.divided=!0}insert(t){return this.contains(t.bounds)?this.points.length=i&&t.xMax<=T&&t.yMin>=x&&t.yMax<=E}generateCacheKey(t){const{xMin:i,xMax:x,yMin:T,yMax:E}=t;return`${i},${x},${T},${E}`}queryRange(t,i=[]){if(!this.intersects(t))return i;for(const x of this.points)this.isWithinBounds(x.bounds,t)&&i.push(x);return this.divided&&(this.northwest?.queryRange(t,i),this.northeast?.queryRange(t,i),this.southwest?.queryRange(t,i),this.southeast?.queryRange(t,i)),i}query(t,i=[]){const x=`${t.x},${t.y}`,T=this.cache.get(x);if(T)return T;if(!this.intersects({xMin:t.x,xMax:t.x,yMin:t.y,yMax:t.y}))return i;for(const E of this.points)this.isWithinRange(t,E.bounds)&&i.push(E);return this.divided&&(this.northwest?.query(t,i),this.northeast?.query(t,i),this.southwest?.query(t,i),this.southeast?.query(t,i)),this.cache.set(x,i),i}intersects(t){const{xMin:i,yMin:x,xMax:T,yMax:E}=this.bounds;return!(t.xMin>T||t.xMaxE||t.yMax=i.xMin&&t.xMin<=i.xMax&&t.yMax>=i.yMin&&t.yMin<=i.yMax}isWithinRange(t,i){return t.x>=i.xMin&&t.x<=i.xMax&&t.y>=i.yMin&&t.y<=i.yMax}}class Y4{constructor(){this.events={},this.lastEmitted=new Map}on(t,i){this.events[t]||(this.events[t]=[]),this.events[t]?.push(i)}off(t,i){this.events[t]&&(this.events[t]=this.events[t]?.filter(x=>x!==i))}emit(t,i,x=0){const T=Date.now(),E=this.lastEmitted.get(t)||0;if(T-E>=x){if(!this.events[t])return;this.events[t]?.forEach(s=>s(i)),this.lastEmitted.set(t,T)}}}const Pi=new Y4;function k4(g,t,i){let x=new Set([...t,void 0]);return g.listen((T,E)=>{x.has(E)&&i(T,E)})}function zC(g,t){return function(){return g.apply(t,arguments)}}const{toString:K4}=Object.prototype,{getPrototypeOf:$x}=Object,_m=(g=>t=>{const i=K4.call(t);return g[i]||(g[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),Vo=g=>(g=g.toLowerCase(),t=>_m(t)===g),qm=g=>t=>typeof t===g,{isArray:tc}=Array,yd=qm("undefined");function j4(g){return g!==null&&!yd(g)&&g.constructor!==null&&!yd(g.constructor)&&Ca(g.constructor.isBuffer)&&g.constructor.isBuffer(g)}const GC=Vo("ArrayBuffer");function Z4(g){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(g):t=g&&g.buffer&&GC(g.buffer),t}const J4=qm("string"),Ca=qm("function"),VC=qm("number"),tg=g=>g!==null&&typeof g=="object",$4=g=>g===!0||g===!1,_v=g=>{if(_m(g)!=="object")return!1;const t=$x(g);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in g)&&!(Symbol.iterator in g)},Q4=Vo("Date"),_4=Vo("File"),q4=Vo("Blob"),tD=Vo("FileList"),eD=g=>tg(g)&&Ca(g.pipe),iD=g=>{let t;return g&&(typeof FormData=="function"&&g instanceof FormData||Ca(g.append)&&((t=_m(g))==="formdata"||t==="object"&&Ca(g.toString)&&g.toString()==="[object FormData]"))},nD=Vo("URLSearchParams"),rD=g=>g.trim?g.trim():g.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function kd(g,t,{allOwnKeys:i=!1}={}){if(g===null||typeof g>"u")return;let x,T;if(typeof g!="object"&&(g=[g]),tc(g))for(x=0,T=g.length;x0;)if(T=i[x],t===T.toLowerCase())return T;return null}const WC=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,XC=g=>!yd(g)&&g!==WC;function by(){const{caseless:g}=XC(this)&&this||{},t={},i=(x,T)=>{const E=g&&HC(t,T)||T;_v(t[E])&&_v(x)?t[E]=by(t[E],x):_v(x)?t[E]=by({},x):tc(x)?t[E]=x.slice():t[E]=x};for(let x=0,T=arguments.length;x(kd(t,(T,E)=>{i&&Ca(T)?g[E]=zC(T,i):g[E]=T},{allOwnKeys:x}),g),aD=g=>(g.charCodeAt(0)===65279&&(g=g.slice(1)),g),oD=(g,t,i,x)=>{g.prototype=Object.create(t.prototype,x),g.prototype.constructor=g,Object.defineProperty(g,"super",{value:t.prototype}),i&&Object.assign(g.prototype,i)},lD=(g,t,i,x)=>{let T,E,s;const y={};if(t=t||{},g==null)return t;do{for(T=Object.getOwnPropertyNames(g),E=T.length;E-- >0;)s=T[E],(!x||x(s,g,t))&&!y[s]&&(t[s]=g[s],y[s]=!0);g=i!==!1&&$x(g)}while(g&&(!i||i(g,t))&&g!==Object.prototype);return t},hD=(g,t,i)=>{g=String(g),(i===void 0||i>g.length)&&(i=g.length),i-=t.length;const x=g.indexOf(t,i);return x!==-1&&x===i},uD=g=>{if(!g)return null;if(tc(g))return g;let t=g.length;if(!VC(t))return null;const i=new Array(t);for(;t-- >0;)i[t]=g[t];return i},fD=(g=>t=>g&&t instanceof g)(typeof Uint8Array<"u"&&$x(Uint8Array)),cD=(g,t)=>{const x=(g&&g[Symbol.iterator]).call(g);let T;for(;(T=x.next())&&!T.done;){const E=T.value;t.call(g,E[0],E[1])}},dD=(g,t)=>{let i;const x=[];for(;(i=g.exec(t))!==null;)x.push(i);return x},pD=Vo("HTMLFormElement"),vD=g=>g.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,x,T){return x.toUpperCase()+T}),cT=(({hasOwnProperty:g})=>(t,i)=>g.call(t,i))(Object.prototype),mD=Vo("RegExp"),YC=(g,t)=>{const i=Object.getOwnPropertyDescriptors(g),x={};kd(i,(T,E)=>{let s;(s=t(T,E,g))!==!1&&(x[E]=s||T)}),Object.defineProperties(g,x)},gD=g=>{YC(g,(t,i)=>{if(Ca(g)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const x=g[i];if(Ca(x)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},yD=(g,t)=>{const i={},x=T=>{T.forEach(E=>{i[E]=!0})};return tc(g)?x(g):x(String(g).split(t)),i},xD=()=>{},SD=(g,t)=>(g=+g,Number.isFinite(g)?g:t),m0="abcdefghijklmnopqrstuvwxyz",dT="0123456789",kC={DIGIT:dT,ALPHA:m0,ALPHA_DIGIT:m0+m0.toUpperCase()+dT},TD=(g=16,t=kC.ALPHA_DIGIT)=>{let i="";const{length:x}=t;for(;g--;)i+=t[Math.random()*x|0];return i};function ED(g){return!!(g&&Ca(g.append)&&g[Symbol.toStringTag]==="FormData"&&g[Symbol.iterator])}const MD=g=>{const t=new Array(10),i=(x,T)=>{if(tg(x)){if(t.indexOf(x)>=0)return;if(!("toJSON"in x)){t[T]=x;const E=tc(x)?[]:{};return kd(x,(s,y)=>{const e=i(s,T+1);!yd(e)&&(E[y]=e)}),t[T]=void 0,E}}return x};return i(g,0)},CD=Vo("AsyncFunction"),wD=g=>g&&(tg(g)||Ca(g))&&Ca(g.then)&&Ca(g.catch),de={isArray:tc,isArrayBuffer:GC,isBuffer:j4,isFormData:iD,isArrayBufferView:Z4,isString:J4,isNumber:VC,isBoolean:$4,isObject:tg,isPlainObject:_v,isUndefined:yd,isDate:Q4,isFile:_4,isBlob:q4,isRegExp:mD,isFunction:Ca,isStream:eD,isURLSearchParams:nD,isTypedArray:fD,isFileList:tD,forEach:kd,merge:by,extend:sD,trim:rD,stripBOM:aD,inherits:oD,toFlatObject:lD,kindOf:_m,kindOfTest:Vo,endsWith:hD,toArray:uD,forEachEntry:cD,matchAll:dD,isHTMLForm:pD,hasOwnProperty:cT,hasOwnProp:cT,reduceDescriptors:YC,freezeMethods:gD,toObjectSet:yD,toCamelCase:vD,noop:xD,toFiniteNumber:SD,findKey:HC,global:WC,isContextDefined:XC,ALPHABET:kC,generateString:TD,isSpecCompliantForm:ED,toJSONObject:MD,isAsyncFn:CD,isThenable:wD};function Hi(g,t,i,x,T){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=g,this.name="AxiosError",t&&(this.code=t),i&&(this.config=i),x&&(this.request=x),T&&(this.response=T)}de.inherits(Hi,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:de.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const KC=Hi.prototype,jC={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(g=>{jC[g]={value:g}});Object.defineProperties(Hi,jC);Object.defineProperty(KC,"isAxiosError",{value:!0});Hi.from=(g,t,i,x,T,E)=>{const s=Object.create(KC);return de.toFlatObject(g,s,function(e){return e!==Error.prototype},y=>y!=="isAxiosError"),Hi.call(s,g.message,t,i,x,T),s.cause=g,s.name=g.name,E&&Object.assign(s,E),s};const AD=null;function Ly(g){return de.isPlainObject(g)||de.isArray(g)}function ZC(g){return de.endsWith(g,"[]")?g.slice(0,-2):g}function pT(g,t,i){return g?g.concat(t).map(function(T,E){return T=ZC(T),!i&&E?"["+T+"]":T}).join(i?".":""):t}function PD(g){return de.isArray(g)&&!g.some(Ly)}const RD=de.toFlatObject(de,{},null,function(t){return/^is[A-Z]/.test(t)});function eg(g,t,i){if(!de.isObject(g))throw new TypeError("target must be an object");t=t||new FormData,i=de.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(u,f){return!de.isUndefined(f[u])});const x=i.metaTokens,T=i.visitor||p,E=i.dots,s=i.indexes,e=(i.Blob||typeof Blob<"u"&&Blob)&&de.isSpecCompliantForm(t);if(!de.isFunction(T))throw new TypeError("visitor must be a function");function r(n){if(n===null)return"";if(de.isDate(n))return n.toISOString();if(!e&&de.isBlob(n))throw new Hi("Blob is not supported. Use a Buffer instead.");return de.isArrayBuffer(n)||de.isTypedArray(n)?e&&typeof Blob=="function"?new Blob([n]):Buffer.from(n):n}function p(n,u,f){let o=n;if(n&&!f&&typeof n=="object"){if(de.endsWith(u,"{}"))u=x?u:u.slice(0,-2),n=JSON.stringify(n);else if(de.isArray(n)&&PD(n)||(de.isFileList(n)||de.endsWith(u,"[]"))&&(o=de.toArray(n)))return u=ZC(u),o.forEach(function(d,v){!(de.isUndefined(d)||d===null)&&t.append(s===!0?pT([u],v,E):s===null?u:u+"[]",r(d))}),!1}return Ly(n)?!0:(t.append(pT(f,u,E),r(n)),!1)}const h=[],a=Object.assign(RD,{defaultVisitor:p,convertValue:r,isVisitable:Ly});function l(n,u){if(!de.isUndefined(n)){if(h.indexOf(n)!==-1)throw Error("Circular reference detected in "+u.join("."));h.push(n),de.forEach(n,function(o,c){(!(de.isUndefined(o)||o===null)&&T.call(t,o,de.isString(c)?c.trim():c,u,a))===!0&&l(o,u?u.concat(c):[c])}),h.pop()}}if(!de.isObject(g))throw new TypeError("data must be an object");return l(g),t}function vT(g){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(g).replace(/[!'()~]|%20|%00/g,function(x){return t[x]})}function Qx(g,t){this._pairs=[],g&&eg(g,this,t)}const JC=Qx.prototype;JC.append=function(t,i){this._pairs.push([t,i])};JC.toString=function(t){const i=t?function(x){return t.call(this,x,vT)}:vT;return this._pairs.map(function(T){return i(T[0])+"="+i(T[1])},"").join("&")};function bD(g){return encodeURIComponent(g).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $C(g,t,i){if(!t)return g;const x=i&&i.encode||bD,T=i&&i.serialize;let E;if(T?E=T(t,i):E=de.isURLSearchParams(t)?t.toString():new Qx(t,i).toString(x),E){const s=g.indexOf("#");s!==-1&&(g=g.slice(0,s)),g+=(g.indexOf("?")===-1?"?":"&")+E}return g}class mT{constructor(){this.handlers=[]}use(t,i,x){return this.handlers.push({fulfilled:t,rejected:i,synchronous:x?x.synchronous:!1,runWhen:x?x.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){de.forEach(this.handlers,function(x){x!==null&&t(x)})}}const QC={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},LD=typeof URLSearchParams<"u"?URLSearchParams:Qx,FD=typeof FormData<"u"?FormData:null,OD=typeof Blob<"u"?Blob:null,DD={isBrowser:!0,classes:{URLSearchParams:LD,FormData:FD,Blob:OD},protocols:["http","https","file","blob","url","data"]},_C=typeof window<"u"&&typeof document<"u",ID=(g=>_C&&["ReactNative","NativeScript","NS"].indexOf(g)<0)(typeof navigator<"u"&&navigator.product),ND=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",BD=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:_C,hasStandardBrowserEnv:ID,hasStandardBrowserWebWorkerEnv:ND},Symbol.toStringTag,{value:"Module"})),Do={...BD,...DD};function UD(g,t){return eg(g,new Do.classes.URLSearchParams,Object.assign({visitor:function(i,x,T,E){return Do.isNode&&de.isBuffer(i)?(this.append(x,i.toString("base64")),!1):E.defaultVisitor.apply(this,arguments)}},t))}function zD(g){return de.matchAll(/\w+|\[(\w*)]/g,g).map(t=>t[0]==="[]"?"":t[1]||t[0])}function GD(g){const t={},i=Object.keys(g);let x;const T=i.length;let E;for(x=0;x=i.length;return s=!s&&de.isArray(T)?T.length:s,e?(de.hasOwnProp(T,s)?T[s]=[T[s],x]:T[s]=x,!y):((!T[s]||!de.isObject(T[s]))&&(T[s]=[]),t(i,x,T[s],E)&&de.isArray(T[s])&&(T[s]=GD(T[s])),!y)}if(de.isFormData(g)&&de.isFunction(g.entries)){const i={};return de.forEachEntry(g,(x,T)=>{t(zD(x),T,i,0)}),i}return null}function VD(g,t,i){if(de.isString(g))try{return(t||JSON.parse)(g),de.trim(g)}catch(x){if(x.name!=="SyntaxError")throw x}return(i||JSON.stringify)(g)}const _x={transitional:QC,adapter:["xhr","http"],transformRequest:[function(t,i){const x=i.getContentType()||"",T=x.indexOf("application/json")>-1,E=de.isObject(t);if(E&&de.isHTMLForm(t)&&(t=new FormData(t)),de.isFormData(t))return T?JSON.stringify(qC(t)):t;if(de.isArrayBuffer(t)||de.isBuffer(t)||de.isStream(t)||de.isFile(t)||de.isBlob(t))return t;if(de.isArrayBufferView(t))return t.buffer;if(de.isURLSearchParams(t))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let y;if(E){if(x.indexOf("application/x-www-form-urlencoded")>-1)return UD(t,this.formSerializer).toString();if((y=de.isFileList(t))||x.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return eg(y?{"files[]":t}:t,e&&new e,this.formSerializer)}}return E||T?(i.setContentType("application/json",!1),VD(t)):t}],transformResponse:[function(t){const i=this.transitional||_x.transitional,x=i&&i.forcedJSONParsing,T=this.responseType==="json";if(t&&de.isString(t)&&(x&&!this.responseType||T)){const s=!(i&&i.silentJSONParsing)&&T;try{return JSON.parse(t)}catch(y){if(s)throw y.name==="SyntaxError"?Hi.from(y,Hi.ERR_BAD_RESPONSE,this,null,this.response):y}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Do.classes.FormData,Blob:Do.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};de.forEach(["delete","get","head","post","put","patch"],g=>{_x.headers[g]={}});const qx=_x,HD=de.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),WD=g=>{const t={};let i,x,T;return g&&g.split(` -`).forEach(function(s){T=s.indexOf(":"),i=s.substring(0,T).trim().toLowerCase(),x=s.substring(T+1).trim(),!(!i||t[i]&&HD[i])&&(i==="set-cookie"?t[i]?t[i].push(x):t[i]=[x]:t[i]=t[i]?t[i]+", "+x:x)}),t},gT=Symbol("internals");function Hc(g){return g&&String(g).trim().toLowerCase()}function qv(g){return g===!1||g==null?g:de.isArray(g)?g.map(qv):String(g)}function XD(g){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let x;for(;x=i.exec(g);)t[x[1]]=x[2];return t}const YD=g=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(g.trim());function g0(g,t,i,x,T){if(de.isFunction(x))return x.call(this,t,i);if(T&&(t=i),!!de.isString(t)){if(de.isString(x))return t.indexOf(x)!==-1;if(de.isRegExp(x))return x.test(t)}}function kD(g){return g.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,i,x)=>i.toUpperCase()+x)}function KD(g,t){const i=de.toCamelCase(" "+t);["get","set","has"].forEach(x=>{Object.defineProperty(g,x+i,{value:function(T,E,s){return this[x].call(this,t,T,E,s)},configurable:!0})})}class ig{constructor(t){t&&this.set(t)}set(t,i,x){const T=this;function E(y,e,r){const p=Hc(e);if(!p)throw new Error("header name must be a non-empty string");const h=de.findKey(T,p);(!h||T[h]===void 0||r===!0||r===void 0&&T[h]!==!1)&&(T[h||e]=qv(y))}const s=(y,e)=>de.forEach(y,(r,p)=>E(r,p,e));return de.isPlainObject(t)||t instanceof this.constructor?s(t,i):de.isString(t)&&(t=t.trim())&&!YD(t)?s(WD(t),i):t!=null&&E(i,t,x),this}get(t,i){if(t=Hc(t),t){const x=de.findKey(this,t);if(x){const T=this[x];if(!i)return T;if(i===!0)return XD(T);if(de.isFunction(i))return i.call(this,T,x);if(de.isRegExp(i))return i.exec(T);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,i){if(t=Hc(t),t){const x=de.findKey(this,t);return!!(x&&this[x]!==void 0&&(!i||g0(this,this[x],x,i)))}return!1}delete(t,i){const x=this;let T=!1;function E(s){if(s=Hc(s),s){const y=de.findKey(x,s);y&&(!i||g0(x,x[y],y,i))&&(delete x[y],T=!0)}}return de.isArray(t)?t.forEach(E):E(t),T}clear(t){const i=Object.keys(this);let x=i.length,T=!1;for(;x--;){const E=i[x];(!t||g0(this,this[E],E,t,!0))&&(delete this[E],T=!0)}return T}normalize(t){const i=this,x={};return de.forEach(this,(T,E)=>{const s=de.findKey(x,E);if(s){i[s]=qv(T),delete i[E];return}const y=t?kD(E):String(E).trim();y!==E&&delete i[E],i[y]=qv(T),x[y]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const i=Object.create(null);return de.forEach(this,(x,T)=>{x!=null&&x!==!1&&(i[T]=t&&de.isArray(x)?x.join(", "):x)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,i])=>t+": "+i).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...i){const x=new this(t);return i.forEach(T=>x.set(T)),x}static accessor(t){const x=(this[gT]=this[gT]={accessors:{}}).accessors,T=this.prototype;function E(s){const y=Hc(s);x[y]||(KD(T,s),x[y]=!0)}return de.isArray(t)?t.forEach(E):E(t),this}}ig.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);de.reduceDescriptors(ig.prototype,({value:g},t)=>{let i=t[0].toUpperCase()+t.slice(1);return{get:()=>g,set(x){this[i]=x}}});de.freezeMethods(ig);const El=ig;function y0(g,t){const i=this||qx,x=t||i,T=El.from(x.headers);let E=x.data;return de.forEach(g,function(y){E=y.call(i,E,T.normalize(),t?t.status:void 0)}),T.normalize(),E}function t2(g){return!!(g&&g.__CANCEL__)}function Kd(g,t,i){Hi.call(this,g??"canceled",Hi.ERR_CANCELED,t,i),this.name="CanceledError"}de.inherits(Kd,Hi,{__CANCEL__:!0});function jD(g,t,i){const x=i.config.validateStatus;!i.status||!x||x(i.status)?g(i):t(new Hi("Request failed with status code "+i.status,[Hi.ERR_BAD_REQUEST,Hi.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}const ZD=Do.hasStandardBrowserEnv?{write(g,t,i,x,T,E){const s=[g+"="+encodeURIComponent(t)];de.isNumber(i)&&s.push("expires="+new Date(i).toGMTString()),de.isString(x)&&s.push("path="+x),de.isString(T)&&s.push("domain="+T),E===!0&&s.push("secure"),document.cookie=s.join("; ")},read(g){const t=document.cookie.match(new RegExp("(^|;\\s*)("+g+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(g){this.write(g,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function JD(g){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(g)}function $D(g,t){return t?g.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):g}function e2(g,t){return g&&!JD(t)?$D(g,t):t}const QD=Do.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");let x;function T(E){let s=E;return t&&(i.setAttribute("href",s),s=i.href),i.setAttribute("href",s),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}return x=T(window.location.href),function(s){const y=de.isString(s)?T(s):s;return y.protocol===x.protocol&&y.host===x.host}}():function(){return function(){return!0}}();function _D(g){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(g);return t&&t[1]||""}function qD(g,t){g=g||10;const i=new Array(g),x=new Array(g);let T=0,E=0,s;return t=t!==void 0?t:1e3,function(e){const r=Date.now(),p=x[E];s||(s=r),i[T]=e,x[T]=r;let h=E,a=0;for(;h!==T;)a+=i[h++],h=h%g;if(T=(T+1)%g,T===E&&(E=(E+1)%g),r-s{const E=T.loaded,s=T.lengthComputable?T.total:void 0,y=E-i,e=x(y),r=E<=s;i=E;const p={loaded:E,total:s,progress:s?E/s:void 0,bytes:y,rate:e||void 0,estimated:e&&s&&r?(s-E)/e:void 0,event:T};p[t?"download":"upload"]=!0,g(p)}}const tI=typeof XMLHttpRequest<"u",eI=tI&&function(g){return new Promise(function(i,x){let T=g.data;const E=El.from(g.headers).normalize();let{responseType:s,withXSRFToken:y}=g,e;function r(){g.cancelToken&&g.cancelToken.unsubscribe(e),g.signal&&g.signal.removeEventListener("abort",e)}let p;if(de.isFormData(T)){if(Do.hasStandardBrowserEnv||Do.hasStandardBrowserWebWorkerEnv)E.setContentType(!1);else if((p=E.getContentType())!==!1){const[u,...f]=p?p.split(";").map(o=>o.trim()).filter(Boolean):[];E.setContentType([u||"multipart/form-data",...f].join("; "))}}let h=new XMLHttpRequest;if(g.auth){const u=g.auth.username||"",f=g.auth.password?unescape(encodeURIComponent(g.auth.password)):"";E.set("Authorization","Basic "+btoa(u+":"+f))}const a=e2(g.baseURL,g.url);h.open(g.method.toUpperCase(),$C(a,g.params,g.paramsSerializer),!0),h.timeout=g.timeout;function l(){if(!h)return;const u=El.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),o={data:!s||s==="text"||s==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:u,config:g,request:h};jD(function(d){i(d),r()},function(d){x(d),r()},o),h=null}if("onloadend"in h?h.onloadend=l:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(l)},h.onabort=function(){h&&(x(new Hi("Request aborted",Hi.ECONNABORTED,g,h)),h=null)},h.onerror=function(){x(new Hi("Network Error",Hi.ERR_NETWORK,g,h)),h=null},h.ontimeout=function(){let f=g.timeout?"timeout of "+g.timeout+"ms exceeded":"timeout exceeded";const o=g.transitional||QC;g.timeoutErrorMessage&&(f=g.timeoutErrorMessage),x(new Hi(f,o.clarifyTimeoutError?Hi.ETIMEDOUT:Hi.ECONNABORTED,g,h)),h=null},Do.hasStandardBrowserEnv&&(y&&de.isFunction(y)&&(y=y(g)),y||y!==!1&&QD(a))){const u=g.xsrfHeaderName&&g.xsrfCookieName&&ZD.read(g.xsrfCookieName);u&&E.set(g.xsrfHeaderName,u)}T===void 0&&E.setContentType(null),"setRequestHeader"in h&&de.forEach(E.toJSON(),function(f,o){h.setRequestHeader(o,f)}),de.isUndefined(g.withCredentials)||(h.withCredentials=!!g.withCredentials),s&&s!=="json"&&(h.responseType=g.responseType),typeof g.onDownloadProgress=="function"&&h.addEventListener("progress",yT(g.onDownloadProgress,!0)),typeof g.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",yT(g.onUploadProgress)),(g.cancelToken||g.signal)&&(e=u=>{h&&(x(!u||u.type?new Kd(null,g,h):u),h.abort(),h=null)},g.cancelToken&&g.cancelToken.subscribe(e),g.signal&&(g.signal.aborted?e():g.signal.addEventListener("abort",e)));const n=_D(a);if(n&&Do.protocols.indexOf(n)===-1){x(new Hi("Unsupported protocol "+n+":",Hi.ERR_BAD_REQUEST,g));return}h.send(T||null)})},Fy={http:AD,xhr:eI};de.forEach(Fy,(g,t)=>{if(g){try{Object.defineProperty(g,"name",{value:t})}catch{}Object.defineProperty(g,"adapterName",{value:t})}});const xT=g=>`- ${g}`,iI=g=>de.isFunction(g)||g===null||g===!1,i2={getAdapter:g=>{g=de.isArray(g)?g:[g];const{length:t}=g;let i,x;const T={};for(let E=0;E`adapter ${y} `+(e===!1?"is not supported by the environment":"is not available in the build"));let s=t?E.length>1?`since : -`+E.map(xT).join(` -`):" "+xT(E[0]):"as no adapter specified";throw new Hi("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return x},adapters:Fy};function x0(g){if(g.cancelToken&&g.cancelToken.throwIfRequested(),g.signal&&g.signal.aborted)throw new Kd(null,g)}function ST(g){return x0(g),g.headers=El.from(g.headers),g.data=y0.call(g,g.transformRequest),["post","put","patch"].indexOf(g.method)!==-1&&g.headers.setContentType("application/x-www-form-urlencoded",!1),i2.getAdapter(g.adapter||qx.adapter)(g).then(function(x){return x0(g),x.data=y0.call(g,g.transformResponse,x),x.headers=El.from(x.headers),x},function(x){return t2(x)||(x0(g),x&&x.response&&(x.response.data=y0.call(g,g.transformResponse,x.response),x.response.headers=El.from(x.response.headers))),Promise.reject(x)})}const TT=g=>g instanceof El?g.toJSON():g;function jf(g,t){t=t||{};const i={};function x(r,p,h){return de.isPlainObject(r)&&de.isPlainObject(p)?de.merge.call({caseless:h},r,p):de.isPlainObject(p)?de.merge({},p):de.isArray(p)?p.slice():p}function T(r,p,h){if(de.isUndefined(p)){if(!de.isUndefined(r))return x(void 0,r,h)}else return x(r,p,h)}function E(r,p){if(!de.isUndefined(p))return x(void 0,p)}function s(r,p){if(de.isUndefined(p)){if(!de.isUndefined(r))return x(void 0,r)}else return x(void 0,p)}function y(r,p,h){if(h in t)return x(r,p);if(h in g)return x(void 0,r)}const e={url:E,method:E,data:E,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:y,headers:(r,p)=>T(TT(r),TT(p),!0)};return de.forEach(Object.keys(Object.assign({},g,t)),function(p){const h=e[p]||T,a=h(g[p],t[p],p);de.isUndefined(a)&&h!==y||(i[p]=a)}),i}const n2="1.6.7",t1={};["object","boolean","number","function","string","symbol"].forEach((g,t)=>{t1[g]=function(x){return typeof x===g||"a"+(t<1?"n ":" ")+g}});const ET={};t1.transitional=function(t,i,x){function T(E,s){return"[Axios v"+n2+"] Transitional option '"+E+"'"+s+(x?". "+x:"")}return(E,s,y)=>{if(t===!1)throw new Hi(T(s," has been removed"+(i?" in "+i:"")),Hi.ERR_DEPRECATED);return i&&!ET[s]&&(ET[s]=!0,console.warn(T(s," has been deprecated since v"+i+" and will be removed in the near future"))),t?t(E,s,y):!0}};function nI(g,t,i){if(typeof g!="object")throw new Hi("options must be an object",Hi.ERR_BAD_OPTION_VALUE);const x=Object.keys(g);let T=x.length;for(;T-- >0;){const E=x[T],s=t[E];if(s){const y=g[E],e=y===void 0||s(y,E,g);if(e!==!0)throw new Hi("option "+E+" must be "+e,Hi.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new Hi("Unknown option "+E,Hi.ERR_BAD_OPTION)}}const Oy={assertOptions:nI,validators:t1},Ql=Oy.validators;class mm{constructor(t){this.defaults=t,this.interceptors={request:new mT,response:new mT}}async request(t,i){try{return await this._request(t,i)}catch(x){if(x instanceof Error){let T;Error.captureStackTrace?Error.captureStackTrace(T={}):T=new Error;const E=T.stack?T.stack.replace(/^.+\n/,""):"";x.stack?E&&!String(x.stack).endsWith(E.replace(/^.+\n.+\n/,""))&&(x.stack+=` -`+E):x.stack=E}throw x}}_request(t,i){typeof t=="string"?(i=i||{},i.url=t):i=t||{},i=jf(this.defaults,i);const{transitional:x,paramsSerializer:T,headers:E}=i;x!==void 0&&Oy.assertOptions(x,{silentJSONParsing:Ql.transitional(Ql.boolean),forcedJSONParsing:Ql.transitional(Ql.boolean),clarifyTimeoutError:Ql.transitional(Ql.boolean)},!1),T!=null&&(de.isFunction(T)?i.paramsSerializer={serialize:T}:Oy.assertOptions(T,{encode:Ql.function,serialize:Ql.function},!0)),i.method=(i.method||this.defaults.method||"get").toLowerCase();let s=E&&de.merge(E.common,E[i.method]);E&&de.forEach(["delete","get","head","post","put","patch","common"],n=>{delete E[n]}),i.headers=El.concat(s,E);const y=[];let e=!0;this.interceptors.request.forEach(function(u){typeof u.runWhen=="function"&&u.runWhen(i)===!1||(e=e&&u.synchronous,y.unshift(u.fulfilled,u.rejected))});const r=[];this.interceptors.response.forEach(function(u){r.push(u.fulfilled,u.rejected)});let p,h=0,a;if(!e){const n=[ST.bind(this),void 0];for(n.unshift.apply(n,y),n.push.apply(n,r),a=n.length,p=Promise.resolve(i);h{if(!x._listeners)return;let E=x._listeners.length;for(;E-- >0;)x._listeners[E](T);x._listeners=null}),this.promise.then=T=>{let E;const s=new Promise(y=>{x.subscribe(y),E=y}).then(T);return s.cancel=function(){x.unsubscribe(E)},s},t(function(E,s,y){x.reason||(x.reason=new Kd(E,s,y),i(x.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const i=this._listeners.indexOf(t);i!==-1&&this._listeners.splice(i,1)}static source(){let t;return{token:new e1(function(T){t=T}),cancel:t}}}const rI=e1;function sI(g){return function(i){return g.apply(null,i)}}function aI(g){return de.isObject(g)&&g.isAxiosError===!0}const Dy={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Dy).forEach(([g,t])=>{Dy[t]=g});const oI=Dy;function r2(g){const t=new tm(g),i=zC(tm.prototype.request,t);return de.extend(i,tm.prototype,t,{allOwnKeys:!0}),de.extend(i,t,null,{allOwnKeys:!0}),i.create=function(T){return r2(jf(g,T))},i}const mn=r2(qx);mn.Axios=tm;mn.CanceledError=Kd;mn.CancelToken=rI;mn.isCancel=t2;mn.VERSION=n2;mn.toFormData=eg;mn.AxiosError=Hi;mn.Cancel=mn.CanceledError;mn.all=function(t){return Promise.all(t)};mn.spread=sI;mn.isAxiosError=aI;mn.mergeConfig=jf;mn.AxiosHeaders=El;mn.formToJSON=g=>qC(de.isHTMLForm(g)?new FormData(g):g);mn.getAdapter=i2.getAdapter;mn.HttpStatusCode=oI;mn.default=mn;const Nf="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function lI(g,t,i){for(;g.length=0;x--){const T=g%Nf.length;i=Nf.charAt(T)+i,g=Math.floor(g/Nf.length)}return lI(i,t,Nf[0])}function i1(){const g=Date.now(),t=fI(g,10),i=uI(16);return t+i}const cI={id:"",title:"",description:"",journals:[],isComplete:!1,reward:""},dI={backpack:[],equipment:{head:null,body:null,legs:null,feet:null,hands:null,weapon:null,shield:null,accessory:null}},s2={},pI={inCombat:!1,isDead:!1,isResting:!1,activeBoosts:{}},vI={username:"Guest",health:"100",mana:"100",energy:"100",maxHealth:"100",maxMana:"100",maxEnergy:"100",armour:"0",agility:"0",strength:"0",intelligence:"0",experience:"0",reputation:"0",faith:"0"},mI={stats:vI,inventory:dI,state:pI},gI={tooltipItem:{id:null,position:{x:0,y:0}},submenuItem:{id:null,position:{x:0,y:0}},tooltipNPC:{id:null,position:{x:0,y:0}},isStatsMenuCollapsed:!1},yI={gamemode:"Idle",action:{type:"ROLL_DICE",diceValues:[],isRolling:!1},textures:{side1:"",side2:"",side3:"",side4:"",side5:"",side6:""}},xI=g=>{Dr(async()=>{Zr.set({...Zr.get(),[g.id]:g})})},SI=g=>{Dr(async()=>{const t=Zr.get(),{[g]:i,...x}=t;Zr.set(x)})};function Fu(g,t){return CL(g,t,{encode(i){return JSON.stringify(i)},decode(i){try{return JSON.parse(i)}catch{return t}}})}const Sn=Fu("playerData",mI),TI=Fu("quest",cI),Zr=Fu("items",s2),Zh=Fu("notifications",[]),a2=Fu("itemDB",s2),gm=Fu("settings",gI),xd=Fu("minigameState",yI),Jh=g=>gm.get()[g],Wc=(g,t)=>{Dr(async()=>{const i=gm.get();gm.set({...i,[g]:t})})},EI=()=>{Dr(async()=>{try{const t=(await mn.get("https://kbve.com/api/itemdb.json")).data,i={};Object.keys(t.key).forEach(x=>{const T=t.key[x];i[T.id]=T,i[T.name]=T}),a2.set(i)}catch(g){console.error("Failed to reload item database:",g)}})},MI=g=>a2.get()[g],CI=g=>{Dr(async()=>{const t=Sn.get();t.inventory.backpack.push(g),Sn.set({...t})})},yl=g=>{const i=Zr.get()[g];if(i)return i;console.warn(`Item with ID ${g} not found.`)},wI=g=>{Dr(async()=>{const t=i1(),i={...g,id:t};xI(i),CI(i.id),Pi.emit("notification",{title:"Success",message:`You got a ${i.name}, verified by E Corp ID ${i.id}`,notificationType:Au.success})})},AI=(g,t)=>{Dr(async()=>{const i=Sn.get(),x=Zr.get()[t];if(x){const T=i.inventory.equipment[g];if(T){const E=Zr.get()[T];E.equipped=!1,Zr.set({...Zr.get(),[E.id]:E})}x.equipped=!0,Zr.set({...Zr.get(),[x.id]:x}),i.inventory.equipment[g]=t,Sn.set({...i})}})},PI=g=>{Dr(async()=>{const t=Sn.get(),i=t.inventory.equipment[g];if(i){const x=Zr.get()[i];x&&(x.equipped=!1,Zr.set({...Zr.get(),[x.id]:x}),t.inventory.equipment[g]=null,Sn.set({...t}))}})},MT=g=>{Dr(async()=>{const t=Sn.get(),i=Zr.get()[g];i&&!i.equipped?(t.inventory.backpack=t.inventory.backpack.filter(x=>x!==g),Sn.set({...t}),SI(g)):Pi.emit("notification",{title:"Warning",message:"Cannot remove item that is currently equipped.",notificationType:Au.warning})})},o2=g=>{Dr(async()=>{const t=Sn.get(),i=parseInt(t.stats.health,10),x=Math.max(i-g,0);t.stats={...t.stats,health:x.toString()},Sn.set({...t})})},RI=g=>{Dr(async()=>{const t=Sn.get(),i=parseInt(t.stats.health,10),x=parseInt(t.stats.maxHealth,10),T=Math.min(i+g,x);t.stats={...t.stats,health:T.toString()},Sn.set({...t})})},bI=g=>{Dr(async()=>{const t=Sn.get(),i=parseInt(t.stats.mana,10),x=Math.max(i-g,0);t.stats={...t.stats,mana:x.toString()},Sn.set({...t})})},LI=g=>{Dr(async()=>{const t=Sn.get(),i=parseInt(t.stats.mana,10),x=parseInt(t.stats.maxMana,10),T=Math.min(i+g,x);t.stats={...t.stats,mana:T.toString()},Sn.set({...t})})},FI=g=>{Dr(async()=>{const t=Sn.get(),i=parseInt(t.stats.energy,10),x=Math.max(i-g,0);t.stats={...t.stats,energy:x.toString()},Sn.set({...t})})},OI=g=>{Dr(async()=>{const t=Sn.get(),i=parseInt(t.stats.energy,10),x=parseInt(t.stats.maxEnergy,10),T=Math.min(i+g,x);t.stats={...t.stats,energy:T.toString()},Sn.set({...t})})},DI=g=>{if(g.health!==void 0){const t=parseInt(g.health,10);t>0?RI(t):o2(Math.abs(t))}if(g.mana!==void 0){const t=parseInt(g.mana,10);t>0?LI(t):bI(Math.abs(t))}if(g.energy!==void 0){const t=parseInt(g.energy,10);t>0?OI(t):FI(Math.abs(t))}},II=async g=>{const t=i1();Dr(async()=>{const i=Sn.get();i.state.activeBoosts[t]={...g,expiry:Date.now()+g.duration*1e3},Sn.set({...i})})},NI=g=>{Dr(async()=>{const t=Sn.get(),i=g.bonuses,x={health:i?.health!==void 0?i.health.toString():void 0,mana:i?.mana!==void 0?i.mana.toString():void 0,energy:i?.energy!==void 0?i.energy.toString():void 0};DI(x),g.boost&&II(g.boost),g.action&&console.log(`Action: ${g.action}`),Sn.set({...t})})},BI=g=>{const t=yl(g);if(!t)return[];const i=["view","discard"];return t.consumable&&i.push("consume"),t.equipped?i.push("unequip"):t.consumable||i.push("equip"),i},Au={caution:{type:"caution",color:"bg-yellow-200 border-yellow-300 text-yellow-700",imgUrl:"/assets/icons/notification.svg"},warning:{type:"warning",color:"bg-orange-200 border-orange-300 text-orange-700",imgUrl:"/assets/icons/notification.svg"},danger:{type:"danger",color:"bg-red-200 border-red-300 text-red-700",imgUrl:"/assets/icons/notification.svg"},success:{type:"success",color:"bg-green-200 border-green-300 text-green-700",imgUrl:"/assets/icons/notification.svg"},info:{type:"info",color:"bg-blue-200 border-blue-300 text-blue-700",imgUrl:"/assets/icons/notification.svg"}};function jd(g){try{Dr(async()=>{const t=xd.get();xd.set({...t,...g})})}catch(t){console.error("Error updating minigame state:",t)}}function UI(g){jd({gamemode:g})}function zI(g){jd({action:g})}function GI(g){jd({textures:g})}function l2(g){const t=xd.get();t.gamemode==="Dice"&&t.action.type==="ROLL_DICE"&&jd({action:{...t.action,diceValues:g}})}function CT(g){const t=xd.get();t.gamemode==="Dice"&&t.action.type==="ROLL_DICE"&&jd({action:{...t.action,isRolling:g}})}const VI=({styleClass:g,size:t=32,color:i="#000",onClick:x,...T})=>he.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",width:t,height:t,className:g,onClick:x,...T,children:he.jsx("path",{stroke:i,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11.493 8.757L8.039 5.304 5.374 7.969l3.454 3.453-2.59 2.59 7.797.004-.017-7.784-2.525 2.525zm11.679 2.665l3.454-3.453-2.665-2.665-3.454 3.453-2.525-2.525-.017 7.784 7.797-.004-2.59-2.59zM8.828 20.578l-3.454 3.453 2.665 2.665 3.454-3.453 2.526 2.525.017-7.784-7.797.004 2.589 2.59zm16.934-2.59l-7.797-.004.017 7.784 2.525-2.525 3.454 3.453 2.665-2.665-3.454-3.453 2.59-2.59z"})}),HI=({styleClass:g,size:t=24,color:i="#000",onClick:x,...T})=>he.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",width:t,height:t,className:g,onClick:x,...T,children:he.jsx("path",{stroke:i,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M4 8.5V4m0 0h4.5M4 4l5.5 5.5m10.5-1V4m0 0h-4.5M20 4l-5.5 5.5M4 15.5V20m0 0h4.5M4 20l5.5-5.5m10.5 1V20m0 0h-4.5m4.5 0l-5.5-5.5"})});/** +*/function uT(g){return g.type==="ROLL_DICE"}class cu{constructor(t,i=4){this.bounds=t,this.capacity=i,this.points=[],this.divided=!1,this.cache=new Map}subdivide(){const{xMin:t,yMin:i,xMax:x,yMax:T}=this.bounds,E=(x-t)/2,s=(T-i)/2,y=t,e=i;this.northeast=new cu({xMin:y+E,xMax:y+2*E,yMin:i,yMax:e+s},this.capacity),this.northwest=new cu({xMin:t,xMax:y+E,yMin:i,yMax:e+s},this.capacity),this.southeast=new cu({xMin:y+E,xMax:y+2*E,yMin:e+s,yMax:e+2*s},this.capacity),this.southwest=new cu({xMin:t,xMax:y+E,yMin:e+s,yMax:e+2*s},this.capacity),this.divided=!0}insert(t){return this.contains(t.bounds)?this.points.length=i&&t.xMax<=T&&t.yMin>=x&&t.yMax<=E}generateCacheKey(t){const{xMin:i,xMax:x,yMin:T,yMax:E}=t;return`${i},${x},${T},${E}`}queryRange(t,i=[]){if(!this.intersects(t))return i;for(const x of this.points)this.isWithinBounds(x.bounds,t)&&i.push(x);return this.divided&&(this.northwest?.queryRange(t,i),this.northeast?.queryRange(t,i),this.southwest?.queryRange(t,i),this.southeast?.queryRange(t,i)),i}query(t,i=[]){const x=`${t.x},${t.y}`,T=this.cache.get(x);if(T)return T;if(!this.intersects({xMin:t.x,xMax:t.x,yMin:t.y,yMax:t.y}))return i;for(const E of this.points)this.isWithinRange(t,E.bounds)&&i.push(E);return this.divided&&(this.northwest?.query(t,i),this.northeast?.query(t,i),this.southwest?.query(t,i),this.southeast?.query(t,i)),this.cache.set(x,i),i}intersects(t){const{xMin:i,yMin:x,xMax:T,yMax:E}=this.bounds;return!(t.xMin>T||t.xMaxE||t.yMax=i.xMin&&t.xMin<=i.xMax&&t.yMax>=i.yMin&&t.yMin<=i.yMax}isWithinRange(t,i){return t.x>=i.xMin&&t.x<=i.xMax&&t.y>=i.yMin&&t.y<=i.yMax}}class j4{constructor(){this.events={},this.lastEmitted=new Map}on(t,i){this.events[t]||(this.events[t]=[]),this.events[t]?.push(i)}off(t,i){this.events[t]&&(this.events[t]=this.events[t]?.filter(x=>x!==i))}emit(t,i,x=0){const T=Date.now(),E=this.lastEmitted.get(t)||0;if(T-E>=x){if(!this.events[t])return;this.events[t]?.forEach(s=>s(i)),this.lastEmitted.set(t,T)}}}const xi=new j4;function K4(g,t,i){let x=new Set([...t,void 0]);return g.listen((T,E)=>{x.has(E)&&i(T,E)})}function GC(g,t){return function(){return g.apply(t,arguments)}}const{toString:Z4}=Object.prototype,{getPrototypeOf:$x}=Object,qm=(g=>t=>{const i=Z4.call(t);return g[i]||(g[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),Ho=g=>(g=g.toLowerCase(),t=>qm(t)===g),tg=g=>t=>typeof t===g,{isArray:tc}=Array,xd=tg("undefined");function J4(g){return g!==null&&!xd(g)&&g.constructor!==null&&!xd(g.constructor)&&Ca(g.constructor.isBuffer)&&g.constructor.isBuffer(g)}const VC=Ho("ArrayBuffer");function $4(g){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(g):t=g&&g.buffer&&VC(g.buffer),t}const Q4=tg("string"),Ca=tg("function"),HC=tg("number"),eg=g=>g!==null&&typeof g=="object",_4=g=>g===!0||g===!1,qv=g=>{if(qm(g)!=="object")return!1;const t=$x(g);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in g)&&!(Symbol.iterator in g)},q4=Ho("Date"),tD=Ho("File"),eD=Ho("Blob"),iD=Ho("FileList"),nD=g=>eg(g)&&Ca(g.pipe),rD=g=>{let t;return g&&(typeof FormData=="function"&&g instanceof FormData||Ca(g.append)&&((t=qm(g))==="formdata"||t==="object"&&Ca(g.toString)&&g.toString()==="[object FormData]"))},sD=Ho("URLSearchParams"),aD=g=>g.trim?g.trim():g.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function jd(g,t,{allOwnKeys:i=!1}={}){if(g===null||typeof g>"u")return;let x,T;if(typeof g!="object"&&(g=[g]),tc(g))for(x=0,T=g.length;x0;)if(T=i[x],t===T.toLowerCase())return T;return null}const XC=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,YC=g=>!xd(g)&&g!==XC;function Ly(){const{caseless:g}=YC(this)&&this||{},t={},i=(x,T)=>{const E=g&&WC(t,T)||T;qv(t[E])&&qv(x)?t[E]=Ly(t[E],x):qv(x)?t[E]=Ly({},x):tc(x)?t[E]=x.slice():t[E]=x};for(let x=0,T=arguments.length;x(jd(t,(T,E)=>{i&&Ca(T)?g[E]=GC(T,i):g[E]=T},{allOwnKeys:x}),g),lD=g=>(g.charCodeAt(0)===65279&&(g=g.slice(1)),g),hD=(g,t,i,x)=>{g.prototype=Object.create(t.prototype,x),g.prototype.constructor=g,Object.defineProperty(g,"super",{value:t.prototype}),i&&Object.assign(g.prototype,i)},uD=(g,t,i,x)=>{let T,E,s;const y={};if(t=t||{},g==null)return t;do{for(T=Object.getOwnPropertyNames(g),E=T.length;E-- >0;)s=T[E],(!x||x(s,g,t))&&!y[s]&&(t[s]=g[s],y[s]=!0);g=i!==!1&&$x(g)}while(g&&(!i||i(g,t))&&g!==Object.prototype);return t},fD=(g,t,i)=>{g=String(g),(i===void 0||i>g.length)&&(i=g.length),i-=t.length;const x=g.indexOf(t,i);return x!==-1&&x===i},cD=g=>{if(!g)return null;if(tc(g))return g;let t=g.length;if(!HC(t))return null;const i=new Array(t);for(;t-- >0;)i[t]=g[t];return i},dD=(g=>t=>g&&t instanceof g)(typeof Uint8Array<"u"&&$x(Uint8Array)),pD=(g,t)=>{const x=(g&&g[Symbol.iterator]).call(g);let T;for(;(T=x.next())&&!T.done;){const E=T.value;t.call(g,E[0],E[1])}},vD=(g,t)=>{let i;const x=[];for(;(i=g.exec(t))!==null;)x.push(i);return x},mD=Ho("HTMLFormElement"),gD=g=>g.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,x,T){return x.toUpperCase()+T}),fT=(({hasOwnProperty:g})=>(t,i)=>g.call(t,i))(Object.prototype),yD=Ho("RegExp"),kC=(g,t)=>{const i=Object.getOwnPropertyDescriptors(g),x={};jd(i,(T,E)=>{let s;(s=t(T,E,g))!==!1&&(x[E]=s||T)}),Object.defineProperties(g,x)},xD=g=>{kC(g,(t,i)=>{if(Ca(g)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const x=g[i];if(Ca(x)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},SD=(g,t)=>{const i={},x=T=>{T.forEach(E=>{i[E]=!0})};return tc(g)?x(g):x(String(g).split(t)),i},TD=()=>{},ED=(g,t)=>(g=+g,Number.isFinite(g)?g:t),g0="abcdefghijklmnopqrstuvwxyz",cT="0123456789",jC={DIGIT:cT,ALPHA:g0,ALPHA_DIGIT:g0+g0.toUpperCase()+cT},MD=(g=16,t=jC.ALPHA_DIGIT)=>{let i="";const{length:x}=t;for(;g--;)i+=t[Math.random()*x|0];return i};function CD(g){return!!(g&&Ca(g.append)&&g[Symbol.toStringTag]==="FormData"&&g[Symbol.iterator])}const wD=g=>{const t=new Array(10),i=(x,T)=>{if(eg(x)){if(t.indexOf(x)>=0)return;if(!("toJSON"in x)){t[T]=x;const E=tc(x)?[]:{};return jd(x,(s,y)=>{const e=i(s,T+1);!xd(e)&&(E[y]=e)}),t[T]=void 0,E}}return x};return i(g,0)},AD=Ho("AsyncFunction"),PD=g=>g&&(eg(g)||Ca(g))&&Ca(g.then)&&Ca(g.catch),de={isArray:tc,isArrayBuffer:VC,isBuffer:J4,isFormData:rD,isArrayBufferView:$4,isString:Q4,isNumber:HC,isBoolean:_4,isObject:eg,isPlainObject:qv,isUndefined:xd,isDate:q4,isFile:tD,isBlob:eD,isRegExp:yD,isFunction:Ca,isStream:nD,isURLSearchParams:sD,isTypedArray:dD,isFileList:iD,forEach:jd,merge:Ly,extend:oD,trim:aD,stripBOM:lD,inherits:hD,toFlatObject:uD,kindOf:qm,kindOfTest:Ho,endsWith:fD,toArray:cD,forEachEntry:pD,matchAll:vD,isHTMLForm:mD,hasOwnProperty:fT,hasOwnProp:fT,reduceDescriptors:kC,freezeMethods:xD,toObjectSet:SD,toCamelCase:gD,noop:TD,toFiniteNumber:ED,findKey:WC,global:XC,isContextDefined:YC,ALPHABET:jC,generateString:MD,isSpecCompliantForm:CD,toJSONObject:wD,isAsyncFn:AD,isThenable:PD};function Hi(g,t,i,x,T){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=g,this.name="AxiosError",t&&(this.code=t),i&&(this.config=i),x&&(this.request=x),T&&(this.response=T)}de.inherits(Hi,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:de.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const KC=Hi.prototype,ZC={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(g=>{ZC[g]={value:g}});Object.defineProperties(Hi,ZC);Object.defineProperty(KC,"isAxiosError",{value:!0});Hi.from=(g,t,i,x,T,E)=>{const s=Object.create(KC);return de.toFlatObject(g,s,function(e){return e!==Error.prototype},y=>y!=="isAxiosError"),Hi.call(s,g.message,t,i,x,T),s.cause=g,s.name=g.name,E&&Object.assign(s,E),s};const RD=null;function Fy(g){return de.isPlainObject(g)||de.isArray(g)}function JC(g){return de.endsWith(g,"[]")?g.slice(0,-2):g}function dT(g,t,i){return g?g.concat(t).map(function(T,E){return T=JC(T),!i&&E?"["+T+"]":T}).join(i?".":""):t}function bD(g){return de.isArray(g)&&!g.some(Fy)}const LD=de.toFlatObject(de,{},null,function(t){return/^is[A-Z]/.test(t)});function ig(g,t,i){if(!de.isObject(g))throw new TypeError("target must be an object");t=t||new FormData,i=de.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(u,f){return!de.isUndefined(f[u])});const x=i.metaTokens,T=i.visitor||p,E=i.dots,s=i.indexes,e=(i.Blob||typeof Blob<"u"&&Blob)&&de.isSpecCompliantForm(t);if(!de.isFunction(T))throw new TypeError("visitor must be a function");function r(n){if(n===null)return"";if(de.isDate(n))return n.toISOString();if(!e&&de.isBlob(n))throw new Hi("Blob is not supported. Use a Buffer instead.");return de.isArrayBuffer(n)||de.isTypedArray(n)?e&&typeof Blob=="function"?new Blob([n]):Buffer.from(n):n}function p(n,u,f){let o=n;if(n&&!f&&typeof n=="object"){if(de.endsWith(u,"{}"))u=x?u:u.slice(0,-2),n=JSON.stringify(n);else if(de.isArray(n)&&bD(n)||(de.isFileList(n)||de.endsWith(u,"[]"))&&(o=de.toArray(n)))return u=JC(u),o.forEach(function(d,v){!(de.isUndefined(d)||d===null)&&t.append(s===!0?dT([u],v,E):s===null?u:u+"[]",r(d))}),!1}return Fy(n)?!0:(t.append(dT(f,u,E),r(n)),!1)}const h=[],a=Object.assign(LD,{defaultVisitor:p,convertValue:r,isVisitable:Fy});function l(n,u){if(!de.isUndefined(n)){if(h.indexOf(n)!==-1)throw Error("Circular reference detected in "+u.join("."));h.push(n),de.forEach(n,function(o,c){(!(de.isUndefined(o)||o===null)&&T.call(t,o,de.isString(c)?c.trim():c,u,a))===!0&&l(o,u?u.concat(c):[c])}),h.pop()}}if(!de.isObject(g))throw new TypeError("data must be an object");return l(g),t}function pT(g){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(g).replace(/[!'()~]|%20|%00/g,function(x){return t[x]})}function Qx(g,t){this._pairs=[],g&&ig(g,this,t)}const $C=Qx.prototype;$C.append=function(t,i){this._pairs.push([t,i])};$C.toString=function(t){const i=t?function(x){return t.call(this,x,pT)}:pT;return this._pairs.map(function(T){return i(T[0])+"="+i(T[1])},"").join("&")};function FD(g){return encodeURIComponent(g).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function QC(g,t,i){if(!t)return g;const x=i&&i.encode||FD,T=i&&i.serialize;let E;if(T?E=T(t,i):E=de.isURLSearchParams(t)?t.toString():new Qx(t,i).toString(x),E){const s=g.indexOf("#");s!==-1&&(g=g.slice(0,s)),g+=(g.indexOf("?")===-1?"?":"&")+E}return g}class vT{constructor(){this.handlers=[]}use(t,i,x){return this.handlers.push({fulfilled:t,rejected:i,synchronous:x?x.synchronous:!1,runWhen:x?x.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){de.forEach(this.handlers,function(x){x!==null&&t(x)})}}const _C={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},OD=typeof URLSearchParams<"u"?URLSearchParams:Qx,DD=typeof FormData<"u"?FormData:null,ID=typeof Blob<"u"?Blob:null,ND={isBrowser:!0,classes:{URLSearchParams:OD,FormData:DD,Blob:ID},protocols:["http","https","file","blob","url","data"]},qC=typeof window<"u"&&typeof document<"u",BD=(g=>qC&&["ReactNative","NativeScript","NS"].indexOf(g)<0)(typeof navigator<"u"&&navigator.product),UD=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",zD=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:qC,hasStandardBrowserEnv:BD,hasStandardBrowserWebWorkerEnv:UD},Symbol.toStringTag,{value:"Module"})),Do={...zD,...ND};function GD(g,t){return ig(g,new Do.classes.URLSearchParams,Object.assign({visitor:function(i,x,T,E){return Do.isNode&&de.isBuffer(i)?(this.append(x,i.toString("base64")),!1):E.defaultVisitor.apply(this,arguments)}},t))}function VD(g){return de.matchAll(/\w+|\[(\w*)]/g,g).map(t=>t[0]==="[]"?"":t[1]||t[0])}function HD(g){const t={},i=Object.keys(g);let x;const T=i.length;let E;for(x=0;x=i.length;return s=!s&&de.isArray(T)?T.length:s,e?(de.hasOwnProp(T,s)?T[s]=[T[s],x]:T[s]=x,!y):((!T[s]||!de.isObject(T[s]))&&(T[s]=[]),t(i,x,T[s],E)&&de.isArray(T[s])&&(T[s]=HD(T[s])),!y)}if(de.isFormData(g)&&de.isFunction(g.entries)){const i={};return de.forEachEntry(g,(x,T)=>{t(VD(x),T,i,0)}),i}return null}function WD(g,t,i){if(de.isString(g))try{return(t||JSON.parse)(g),de.trim(g)}catch(x){if(x.name!=="SyntaxError")throw x}return(i||JSON.stringify)(g)}const _x={transitional:_C,adapter:["xhr","http"],transformRequest:[function(t,i){const x=i.getContentType()||"",T=x.indexOf("application/json")>-1,E=de.isObject(t);if(E&&de.isHTMLForm(t)&&(t=new FormData(t)),de.isFormData(t))return T?JSON.stringify(t2(t)):t;if(de.isArrayBuffer(t)||de.isBuffer(t)||de.isStream(t)||de.isFile(t)||de.isBlob(t))return t;if(de.isArrayBufferView(t))return t.buffer;if(de.isURLSearchParams(t))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let y;if(E){if(x.indexOf("application/x-www-form-urlencoded")>-1)return GD(t,this.formSerializer).toString();if((y=de.isFileList(t))||x.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return ig(y?{"files[]":t}:t,e&&new e,this.formSerializer)}}return E||T?(i.setContentType("application/json",!1),WD(t)):t}],transformResponse:[function(t){const i=this.transitional||_x.transitional,x=i&&i.forcedJSONParsing,T=this.responseType==="json";if(t&&de.isString(t)&&(x&&!this.responseType||T)){const s=!(i&&i.silentJSONParsing)&&T;try{return JSON.parse(t)}catch(y){if(s)throw y.name==="SyntaxError"?Hi.from(y,Hi.ERR_BAD_RESPONSE,this,null,this.response):y}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Do.classes.FormData,Blob:Do.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};de.forEach(["delete","get","head","post","put","patch"],g=>{_x.headers[g]={}});const qx=_x,XD=de.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),YD=g=>{const t={};let i,x,T;return g&&g.split(` +`).forEach(function(s){T=s.indexOf(":"),i=s.substring(0,T).trim().toLowerCase(),x=s.substring(T+1).trim(),!(!i||t[i]&&XD[i])&&(i==="set-cookie"?t[i]?t[i].push(x):t[i]=[x]:t[i]=t[i]?t[i]+", "+x:x)}),t},mT=Symbol("internals");function Hc(g){return g&&String(g).trim().toLowerCase()}function tm(g){return g===!1||g==null?g:de.isArray(g)?g.map(tm):String(g)}function kD(g){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let x;for(;x=i.exec(g);)t[x[1]]=x[2];return t}const jD=g=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(g.trim());function y0(g,t,i,x,T){if(de.isFunction(x))return x.call(this,t,i);if(T&&(t=i),!!de.isString(t)){if(de.isString(x))return t.indexOf(x)!==-1;if(de.isRegExp(x))return x.test(t)}}function KD(g){return g.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,i,x)=>i.toUpperCase()+x)}function ZD(g,t){const i=de.toCamelCase(" "+t);["get","set","has"].forEach(x=>{Object.defineProperty(g,x+i,{value:function(T,E,s){return this[x].call(this,t,T,E,s)},configurable:!0})})}class ng{constructor(t){t&&this.set(t)}set(t,i,x){const T=this;function E(y,e,r){const p=Hc(e);if(!p)throw new Error("header name must be a non-empty string");const h=de.findKey(T,p);(!h||T[h]===void 0||r===!0||r===void 0&&T[h]!==!1)&&(T[h||e]=tm(y))}const s=(y,e)=>de.forEach(y,(r,p)=>E(r,p,e));return de.isPlainObject(t)||t instanceof this.constructor?s(t,i):de.isString(t)&&(t=t.trim())&&!jD(t)?s(YD(t),i):t!=null&&E(i,t,x),this}get(t,i){if(t=Hc(t),t){const x=de.findKey(this,t);if(x){const T=this[x];if(!i)return T;if(i===!0)return kD(T);if(de.isFunction(i))return i.call(this,T,x);if(de.isRegExp(i))return i.exec(T);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,i){if(t=Hc(t),t){const x=de.findKey(this,t);return!!(x&&this[x]!==void 0&&(!i||y0(this,this[x],x,i)))}return!1}delete(t,i){const x=this;let T=!1;function E(s){if(s=Hc(s),s){const y=de.findKey(x,s);y&&(!i||y0(x,x[y],y,i))&&(delete x[y],T=!0)}}return de.isArray(t)?t.forEach(E):E(t),T}clear(t){const i=Object.keys(this);let x=i.length,T=!1;for(;x--;){const E=i[x];(!t||y0(this,this[E],E,t,!0))&&(delete this[E],T=!0)}return T}normalize(t){const i=this,x={};return de.forEach(this,(T,E)=>{const s=de.findKey(x,E);if(s){i[s]=tm(T),delete i[E];return}const y=t?KD(E):String(E).trim();y!==E&&delete i[E],i[y]=tm(T),x[y]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const i=Object.create(null);return de.forEach(this,(x,T)=>{x!=null&&x!==!1&&(i[T]=t&&de.isArray(x)?x.join(", "):x)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,i])=>t+": "+i).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...i){const x=new this(t);return i.forEach(T=>x.set(T)),x}static accessor(t){const x=(this[mT]=this[mT]={accessors:{}}).accessors,T=this.prototype;function E(s){const y=Hc(s);x[y]||(ZD(T,s),x[y]=!0)}return de.isArray(t)?t.forEach(E):E(t),this}}ng.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);de.reduceDescriptors(ng.prototype,({value:g},t)=>{let i=t[0].toUpperCase()+t.slice(1);return{get:()=>g,set(x){this[i]=x}}});de.freezeMethods(ng);const El=ng;function x0(g,t){const i=this||qx,x=t||i,T=El.from(x.headers);let E=x.data;return de.forEach(g,function(y){E=y.call(i,E,T.normalize(),t?t.status:void 0)}),T.normalize(),E}function e2(g){return!!(g&&g.__CANCEL__)}function Kd(g,t,i){Hi.call(this,g??"canceled",Hi.ERR_CANCELED,t,i),this.name="CanceledError"}de.inherits(Kd,Hi,{__CANCEL__:!0});function JD(g,t,i){const x=i.config.validateStatus;!i.status||!x||x(i.status)?g(i):t(new Hi("Request failed with status code "+i.status,[Hi.ERR_BAD_REQUEST,Hi.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}const $D=Do.hasStandardBrowserEnv?{write(g,t,i,x,T,E){const s=[g+"="+encodeURIComponent(t)];de.isNumber(i)&&s.push("expires="+new Date(i).toGMTString()),de.isString(x)&&s.push("path="+x),de.isString(T)&&s.push("domain="+T),E===!0&&s.push("secure"),document.cookie=s.join("; ")},read(g){const t=document.cookie.match(new RegExp("(^|;\\s*)("+g+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(g){this.write(g,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function QD(g){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(g)}function _D(g,t){return t?g.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):g}function i2(g,t){return g&&!QD(t)?_D(g,t):t}const qD=Do.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");let x;function T(E){let s=E;return t&&(i.setAttribute("href",s),s=i.href),i.setAttribute("href",s),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}return x=T(window.location.href),function(s){const y=de.isString(s)?T(s):s;return y.protocol===x.protocol&&y.host===x.host}}():function(){return function(){return!0}}();function tI(g){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(g);return t&&t[1]||""}function eI(g,t){g=g||10;const i=new Array(g),x=new Array(g);let T=0,E=0,s;return t=t!==void 0?t:1e3,function(e){const r=Date.now(),p=x[E];s||(s=r),i[T]=e,x[T]=r;let h=E,a=0;for(;h!==T;)a+=i[h++],h=h%g;if(T=(T+1)%g,T===E&&(E=(E+1)%g),r-s{const E=T.loaded,s=T.lengthComputable?T.total:void 0,y=E-i,e=x(y),r=E<=s;i=E;const p={loaded:E,total:s,progress:s?E/s:void 0,bytes:y,rate:e||void 0,estimated:e&&s&&r?(s-E)/e:void 0,event:T};p[t?"download":"upload"]=!0,g(p)}}const iI=typeof XMLHttpRequest<"u",nI=iI&&function(g){return new Promise(function(i,x){let T=g.data;const E=El.from(g.headers).normalize();let{responseType:s,withXSRFToken:y}=g,e;function r(){g.cancelToken&&g.cancelToken.unsubscribe(e),g.signal&&g.signal.removeEventListener("abort",e)}let p;if(de.isFormData(T)){if(Do.hasStandardBrowserEnv||Do.hasStandardBrowserWebWorkerEnv)E.setContentType(!1);else if((p=E.getContentType())!==!1){const[u,...f]=p?p.split(";").map(o=>o.trim()).filter(Boolean):[];E.setContentType([u||"multipart/form-data",...f].join("; "))}}let h=new XMLHttpRequest;if(g.auth){const u=g.auth.username||"",f=g.auth.password?unescape(encodeURIComponent(g.auth.password)):"";E.set("Authorization","Basic "+btoa(u+":"+f))}const a=i2(g.baseURL,g.url);h.open(g.method.toUpperCase(),QC(a,g.params,g.paramsSerializer),!0),h.timeout=g.timeout;function l(){if(!h)return;const u=El.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),o={data:!s||s==="text"||s==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:u,config:g,request:h};JD(function(d){i(d),r()},function(d){x(d),r()},o),h=null}if("onloadend"in h?h.onloadend=l:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(l)},h.onabort=function(){h&&(x(new Hi("Request aborted",Hi.ECONNABORTED,g,h)),h=null)},h.onerror=function(){x(new Hi("Network Error",Hi.ERR_NETWORK,g,h)),h=null},h.ontimeout=function(){let f=g.timeout?"timeout of "+g.timeout+"ms exceeded":"timeout exceeded";const o=g.transitional||_C;g.timeoutErrorMessage&&(f=g.timeoutErrorMessage),x(new Hi(f,o.clarifyTimeoutError?Hi.ETIMEDOUT:Hi.ECONNABORTED,g,h)),h=null},Do.hasStandardBrowserEnv&&(y&&de.isFunction(y)&&(y=y(g)),y||y!==!1&&qD(a))){const u=g.xsrfHeaderName&&g.xsrfCookieName&&$D.read(g.xsrfCookieName);u&&E.set(g.xsrfHeaderName,u)}T===void 0&&E.setContentType(null),"setRequestHeader"in h&&de.forEach(E.toJSON(),function(f,o){h.setRequestHeader(o,f)}),de.isUndefined(g.withCredentials)||(h.withCredentials=!!g.withCredentials),s&&s!=="json"&&(h.responseType=g.responseType),typeof g.onDownloadProgress=="function"&&h.addEventListener("progress",gT(g.onDownloadProgress,!0)),typeof g.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",gT(g.onUploadProgress)),(g.cancelToken||g.signal)&&(e=u=>{h&&(x(!u||u.type?new Kd(null,g,h):u),h.abort(),h=null)},g.cancelToken&&g.cancelToken.subscribe(e),g.signal&&(g.signal.aborted?e():g.signal.addEventListener("abort",e)));const n=tI(a);if(n&&Do.protocols.indexOf(n)===-1){x(new Hi("Unsupported protocol "+n+":",Hi.ERR_BAD_REQUEST,g));return}h.send(T||null)})},Oy={http:RD,xhr:nI};de.forEach(Oy,(g,t)=>{if(g){try{Object.defineProperty(g,"name",{value:t})}catch{}Object.defineProperty(g,"adapterName",{value:t})}});const yT=g=>`- ${g}`,rI=g=>de.isFunction(g)||g===null||g===!1,n2={getAdapter:g=>{g=de.isArray(g)?g:[g];const{length:t}=g;let i,x;const T={};for(let E=0;E`adapter ${y} `+(e===!1?"is not supported by the environment":"is not available in the build"));let s=t?E.length>1?`since : +`+E.map(yT).join(` +`):" "+yT(E[0]):"as no adapter specified";throw new Hi("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return x},adapters:Oy};function S0(g){if(g.cancelToken&&g.cancelToken.throwIfRequested(),g.signal&&g.signal.aborted)throw new Kd(null,g)}function xT(g){return S0(g),g.headers=El.from(g.headers),g.data=x0.call(g,g.transformRequest),["post","put","patch"].indexOf(g.method)!==-1&&g.headers.setContentType("application/x-www-form-urlencoded",!1),n2.getAdapter(g.adapter||qx.adapter)(g).then(function(x){return S0(g),x.data=x0.call(g,g.transformResponse,x),x.headers=El.from(x.headers),x},function(x){return e2(x)||(S0(g),x&&x.response&&(x.response.data=x0.call(g,g.transformResponse,x.response),x.response.headers=El.from(x.response.headers))),Promise.reject(x)})}const ST=g=>g instanceof El?g.toJSON():g;function Kf(g,t){t=t||{};const i={};function x(r,p,h){return de.isPlainObject(r)&&de.isPlainObject(p)?de.merge.call({caseless:h},r,p):de.isPlainObject(p)?de.merge({},p):de.isArray(p)?p.slice():p}function T(r,p,h){if(de.isUndefined(p)){if(!de.isUndefined(r))return x(void 0,r,h)}else return x(r,p,h)}function E(r,p){if(!de.isUndefined(p))return x(void 0,p)}function s(r,p){if(de.isUndefined(p)){if(!de.isUndefined(r))return x(void 0,r)}else return x(void 0,p)}function y(r,p,h){if(h in t)return x(r,p);if(h in g)return x(void 0,r)}const e={url:E,method:E,data:E,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:y,headers:(r,p)=>T(ST(r),ST(p),!0)};return de.forEach(Object.keys(Object.assign({},g,t)),function(p){const h=e[p]||T,a=h(g[p],t[p],p);de.isUndefined(a)&&h!==y||(i[p]=a)}),i}const r2="1.6.7",t1={};["object","boolean","number","function","string","symbol"].forEach((g,t)=>{t1[g]=function(x){return typeof x===g||"a"+(t<1?"n ":" ")+g}});const TT={};t1.transitional=function(t,i,x){function T(E,s){return"[Axios v"+r2+"] Transitional option '"+E+"'"+s+(x?". "+x:"")}return(E,s,y)=>{if(t===!1)throw new Hi(T(s," has been removed"+(i?" in "+i:"")),Hi.ERR_DEPRECATED);return i&&!TT[s]&&(TT[s]=!0,console.warn(T(s," has been deprecated since v"+i+" and will be removed in the near future"))),t?t(E,s,y):!0}};function sI(g,t,i){if(typeof g!="object")throw new Hi("options must be an object",Hi.ERR_BAD_OPTION_VALUE);const x=Object.keys(g);let T=x.length;for(;T-- >0;){const E=x[T],s=t[E];if(s){const y=g[E],e=y===void 0||s(y,E,g);if(e!==!0)throw new Hi("option "+E+" must be "+e,Hi.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new Hi("Unknown option "+E,Hi.ERR_BAD_OPTION)}}const Dy={assertOptions:sI,validators:t1},Ql=Dy.validators;class mm{constructor(t){this.defaults=t,this.interceptors={request:new vT,response:new vT}}async request(t,i){try{return await this._request(t,i)}catch(x){if(x instanceof Error){let T;Error.captureStackTrace?Error.captureStackTrace(T={}):T=new Error;const E=T.stack?T.stack.replace(/^.+\n/,""):"";x.stack?E&&!String(x.stack).endsWith(E.replace(/^.+\n.+\n/,""))&&(x.stack+=` +`+E):x.stack=E}throw x}}_request(t,i){typeof t=="string"?(i=i||{},i.url=t):i=t||{},i=Kf(this.defaults,i);const{transitional:x,paramsSerializer:T,headers:E}=i;x!==void 0&&Dy.assertOptions(x,{silentJSONParsing:Ql.transitional(Ql.boolean),forcedJSONParsing:Ql.transitional(Ql.boolean),clarifyTimeoutError:Ql.transitional(Ql.boolean)},!1),T!=null&&(de.isFunction(T)?i.paramsSerializer={serialize:T}:Dy.assertOptions(T,{encode:Ql.function,serialize:Ql.function},!0)),i.method=(i.method||this.defaults.method||"get").toLowerCase();let s=E&&de.merge(E.common,E[i.method]);E&&de.forEach(["delete","get","head","post","put","patch","common"],n=>{delete E[n]}),i.headers=El.concat(s,E);const y=[];let e=!0;this.interceptors.request.forEach(function(u){typeof u.runWhen=="function"&&u.runWhen(i)===!1||(e=e&&u.synchronous,y.unshift(u.fulfilled,u.rejected))});const r=[];this.interceptors.response.forEach(function(u){r.push(u.fulfilled,u.rejected)});let p,h=0,a;if(!e){const n=[xT.bind(this),void 0];for(n.unshift.apply(n,y),n.push.apply(n,r),a=n.length,p=Promise.resolve(i);h{if(!x._listeners)return;let E=x._listeners.length;for(;E-- >0;)x._listeners[E](T);x._listeners=null}),this.promise.then=T=>{let E;const s=new Promise(y=>{x.subscribe(y),E=y}).then(T);return s.cancel=function(){x.unsubscribe(E)},s},t(function(E,s,y){x.reason||(x.reason=new Kd(E,s,y),i(x.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const i=this._listeners.indexOf(t);i!==-1&&this._listeners.splice(i,1)}static source(){let t;return{token:new e1(function(T){t=T}),cancel:t}}}const aI=e1;function oI(g){return function(i){return g.apply(null,i)}}function lI(g){return de.isObject(g)&&g.isAxiosError===!0}const Iy={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Iy).forEach(([g,t])=>{Iy[t]=g});const hI=Iy;function s2(g){const t=new em(g),i=GC(em.prototype.request,t);return de.extend(i,em.prototype,t,{allOwnKeys:!0}),de.extend(i,t,null,{allOwnKeys:!0}),i.create=function(T){return s2(Kf(g,T))},i}const mn=s2(qx);mn.Axios=em;mn.CanceledError=Kd;mn.CancelToken=aI;mn.isCancel=e2;mn.VERSION=r2;mn.toFormData=ig;mn.AxiosError=Hi;mn.Cancel=mn.CanceledError;mn.all=function(t){return Promise.all(t)};mn.spread=oI;mn.isAxiosError=lI;mn.mergeConfig=Kf;mn.AxiosHeaders=El;mn.formToJSON=g=>t2(de.isHTMLForm(g)?new FormData(g):g);mn.getAdapter=n2.getAdapter;mn.HttpStatusCode=hI;mn.default=mn;const Nf="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function uI(g,t,i){for(;g.length=0;x--){const T=g%Nf.length;i=Nf.charAt(T)+i,g=Math.floor(g/Nf.length)}return uI(i,t,Nf[0])}function i1(){const g=Date.now(),t=dI(g,10),i=cI(16);return t+i}const pI={id:"",title:"",description:"",journals:[],isComplete:!1,reward:""},vI={backpack:[],equipment:{head:null,body:null,legs:null,feet:null,hands:null,weapon:null,shield:null,accessory:null}},a2={},mI={inCombat:!1,isDead:!1,isResting:!1,activeBoosts:{}},gI={username:"Guest",health:"100",mana:"100",energy:"100",maxHealth:"100",maxMana:"100",maxEnergy:"100",armour:"0",agility:"0",strength:"0",intelligence:"0",experience:"0",reputation:"0",faith:"0"},yI={stats:gI,inventory:vI,state:mI},xI={tooltipItem:{id:null,position:{x:0,y:0}},submenuItem:{id:null,position:{x:0,y:0}},tooltipNPC:{id:null,position:{x:0,y:0}},isStatsMenuCollapsed:!1,isSettingsMenuCollapsed:!1,debugMode:!1},SI={gamemode:"Idle",action:{type:"ROLL_DICE",diceValues:[],isRolling:!1},textures:{side1:"",side2:"",side3:"",side4:"",side5:"",side6:""}},TI=g=>{Dr(async()=>{Zr.set({...Zr.get(),[g.id]:g})})},EI=g=>{Dr(async()=>{const t=Zr.get(),{[g]:i,...x}=t;Zr.set(x)})};function Lu(g,t){return AL(g,t,{encode(i){return JSON.stringify(i)},decode(i){try{return JSON.parse(i)}catch{return t}}})}const Sn=Lu("playerData",yI),MI=Lu("quest",pI),Zr=Lu("items",a2),Zh=Lu("notifications",[]),o2=Lu("itemDB",a2),gm=Lu("settings",xI),Sd=Lu("minigameState",SI),Lf=g=>gm.get()[g],id=(g,t)=>{Dr(async()=>{const i=gm.get();gm.set({...i,[g]:t})})},CI=()=>{Dr(async()=>{try{const t=(await mn.get("https://kbve.com/api/itemdb.json")).data,i={};Object.keys(t.key).forEach(x=>{const T=t.key[x];i[T.id]=T,i[T.name]=T}),o2.set(i)}catch(g){console.error("Failed to reload item database:",g)}})},wI=g=>o2.get()[g],AI=g=>{Dr(async()=>{const t=Sn.get();t.inventory.backpack.push(g),Sn.set({...t})})},xl=g=>{const i=Zr.get()[g];if(i)return i;console.warn(`Item with ID ${g} not found.`)},PI=g=>{Dr(async()=>{const t=i1(),i={...g,id:t};TI(i),AI(i.id),xi.emit("notification",{title:"Success",message:`You got a ${i.name}, verified by E Corp ID ${i.id}`,notificationType:wu.success})})},RI=(g,t)=>{Dr(async()=>{const i=Sn.get(),x=Zr.get()[t];if(x){const T=i.inventory.equipment[g];if(T){const E=Zr.get()[T];E.equipped=!1,Zr.set({...Zr.get(),[E.id]:E})}x.equipped=!0,Zr.set({...Zr.get(),[x.id]:x}),i.inventory.equipment[g]=t,Sn.set({...i})}})},bI=g=>{Dr(async()=>{const t=Sn.get(),i=t.inventory.equipment[g];if(i){const x=Zr.get()[i];x&&(x.equipped=!1,Zr.set({...Zr.get(),[x.id]:x}),t.inventory.equipment[g]=null,Sn.set({...t}))}})},ET=g=>{Dr(async()=>{const t=Sn.get(),i=Zr.get()[g];i&&!i.equipped?(t.inventory.backpack=t.inventory.backpack.filter(x=>x!==g),Sn.set({...t}),EI(g)):xi.emit("notification",{title:"Warning",message:"Cannot remove item that is currently equipped.",notificationType:wu.warning})})},l2=g=>{Dr(async()=>{const t=Sn.get(),i=parseInt(t.stats.health,10),x=Math.max(i-g,0);t.stats={...t.stats,health:x.toString()},Sn.set({...t})})},LI=g=>{Dr(async()=>{const t=Sn.get(),i=parseInt(t.stats.health,10),x=parseInt(t.stats.maxHealth,10),T=Math.min(i+g,x);t.stats={...t.stats,health:T.toString()},Sn.set({...t})})},FI=g=>{Dr(async()=>{const t=Sn.get(),i=parseInt(t.stats.mana,10),x=Math.max(i-g,0);t.stats={...t.stats,mana:x.toString()},Sn.set({...t})})},OI=g=>{Dr(async()=>{const t=Sn.get(),i=parseInt(t.stats.mana,10),x=parseInt(t.stats.maxMana,10),T=Math.min(i+g,x);t.stats={...t.stats,mana:T.toString()},Sn.set({...t})})},DI=g=>{Dr(async()=>{const t=Sn.get(),i=parseInt(t.stats.energy,10),x=Math.max(i-g,0);t.stats={...t.stats,energy:x.toString()},Sn.set({...t})})},II=g=>{Dr(async()=>{const t=Sn.get(),i=parseInt(t.stats.energy,10),x=parseInt(t.stats.maxEnergy,10),T=Math.min(i+g,x);t.stats={...t.stats,energy:T.toString()},Sn.set({...t})})},NI=g=>{if(g.health!==void 0){const t=parseInt(g.health,10);t>0?LI(t):l2(Math.abs(t))}if(g.mana!==void 0){const t=parseInt(g.mana,10);t>0?OI(t):FI(Math.abs(t))}if(g.energy!==void 0){const t=parseInt(g.energy,10);t>0?II(t):DI(Math.abs(t))}},BI=async g=>{const t=i1();Dr(async()=>{const i=Sn.get();i.state.activeBoosts[t]={...g,expiry:Date.now()+g.duration*1e3},Sn.set({...i})})},UI=g=>{Dr(async()=>{const t=Sn.get(),i=g.bonuses,x={health:i?.health!==void 0?i.health.toString():void 0,mana:i?.mana!==void 0?i.mana.toString():void 0,energy:i?.energy!==void 0?i.energy.toString():void 0};NI(x),g.boost&&BI(g.boost),g.action&&console.log(`Action: ${g.action}`),Sn.set({...t})})},zI=g=>{const t=xl(g);if(!t)return[];const i=["view","discard"];return t.consumable&&i.push("consume"),t.equipped?i.push("unequip"):t.consumable||i.push("equip"),i},wu={caution:{type:"caution",color:"bg-yellow-200 border-yellow-300 text-yellow-700",imgUrl:"/assets/icons/notification.svg"},warning:{type:"warning",color:"bg-orange-200 border-orange-300 text-orange-700",imgUrl:"/assets/icons/notification.svg"},danger:{type:"danger",color:"bg-red-200 border-red-300 text-red-700",imgUrl:"/assets/icons/notification.svg"},success:{type:"success",color:"bg-green-200 border-green-300 text-green-700",imgUrl:"/assets/icons/notification.svg"},info:{type:"info",color:"bg-blue-200 border-blue-300 text-blue-700",imgUrl:"/assets/icons/notification.svg"}};function Zd(g){try{Dr(async()=>{const t=Sd.get();Sd.set({...t,...g})})}catch(t){console.error("Error updating minigame state:",t)}}function GI(g){Zd({gamemode:g})}function VI(g){Zd({action:g})}function HI(g){Zd({textures:g})}function h2(g){const t=Sd.get();t.gamemode==="Dice"&&t.action.type==="ROLL_DICE"&&Zd({action:{...t.action,diceValues:g}})}function MT(g){const t=Sd.get();t.gamemode==="Dice"&&t.action.type==="ROLL_DICE"&&Zd({action:{...t.action,isRolling:g}})}const WI=({styleClass:g,size:t=32,color:i="#000",onClick:x,...T})=>Qt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",width:t,height:t,className:g,onClick:x,...T,children:Qt.jsx("path",{stroke:i,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11.493 8.757L8.039 5.304 5.374 7.969l3.454 3.453-2.59 2.59 7.797.004-.017-7.784-2.525 2.525zm11.679 2.665l3.454-3.453-2.665-2.665-3.454 3.453-2.525-2.525-.017 7.784 7.797-.004-2.59-2.59zM8.828 20.578l-3.454 3.453 2.665 2.665 3.454-3.453 2.526 2.525.017-7.784-7.797.004 2.589 2.59zm16.934-2.59l-7.797-.004.017 7.784 2.525-2.525 3.454 3.453 2.665-2.665-3.454-3.453 2.59-2.59z"})}),XI=({styleClass:g,size:t=24,color:i="#000",onClick:x,...T})=>Qt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",width:t,height:t,className:g,onClick:x,...T,children:Qt.jsx("path",{stroke:i,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M4 8.5V4m0 0h4.5M4 4l5.5 5.5m10.5-1V4m0 0h-4.5M20 4l-5.5 5.5M4 15.5V20m0 0h4.5M4 20l5.5-5.5m10.5 1V20m0 0h-4.5m4.5 0l-5.5-5.5"})});/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT - */const ng="161",WI={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},XI={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},h2=0,Iy=1,u2=2,YI=3,f2=0,rg=1,hd=2,_a=3,Cl=0,ms=1,Oo=2,Ml=0,yu=1,Ny=2,By=3,Uy=4,c2=5,oh=100,d2=101,p2=102,zy=103,Gy=104,v2=200,m2=201,g2=202,y2=203,ym=204,xm=205,x2=206,S2=207,T2=208,E2=209,M2=210,C2=211,w2=212,A2=213,P2=214,R2=0,b2=1,L2=2,Sd=3,F2=4,O2=5,D2=6,I2=7,Zd=0,N2=1,B2=2,Bo=0,U2=1,z2=2,G2=3,n1=4,V2=5,H2=6,Vy="attached",W2="detached",sg=300,wl=301,vh=302,Td=303,Ed=304,ec=306,Md=1e3,Jr=1001,Cd=1002,nr=1003,Sm=1004,kI=1004,fu=1005,KI=1005,Nn=1006,ud=1007,jI=1007,Io=1008,ZI=1008,Uo=1009,X2=1010,Y2=1011,ag=1012,r1=1013,xl=1014,Ea=1015,Zf=1016,s1=1017,a1=1018,uh=1020,k2=1021,ps=1023,K2=1024,j2=1025,fh=1026,Pu=1027,Z2=1028,o1=1029,J2=1030,l1=1031,h1=1033,em=33776,im=33777,nm=33778,rm=33779,Hy=35840,Wy=35841,Xy=35842,Yy=35843,u1=36196,ky=37492,Ky=37496,jy=37808,Zy=37809,Jy=37810,$y=37811,Qy=37812,_y=37813,qy=37814,tx=37815,ex=37816,ix=37817,nx=37818,rx=37819,sx=37820,ax=37821,sm=36492,ox=36494,lx=36495,$2=36283,hx=36284,ux=36285,fx=36286,Q2=2200,_2=2201,q2=2202,wd=2300,Ad=2301,am=2302,pu=2400,vu=2401,Pd=2402,og=2500,f1=2501,JI=0,$I=1,QI=2,c1=3e3,ch=3001,tw=3200,ew=3201,yh=0,iw=1,ea="",vr="srgb",Go="srgb-linear",lg="display-p3",Jd="display-p3-linear",Rd="linear",vn="srgb",bd="rec709",Ld="p3",_I=0,hu=7680,qI=7681,t5=7682,e5=7683,i5=34055,n5=34056,r5=5386,s5=512,a5=513,o5=514,l5=515,h5=516,u5=517,f5=518,cx=519,nw=512,rw=513,sw=514,d1=515,aw=516,ow=517,lw=518,hw=519,Fd=35044,c5=35048,d5=35040,p5=35045,v5=35049,m5=35041,g5=35046,y5=35050,x5=35042,S5="100",dx="300 es",Tm=1035,No=2e3,Od=2001;class Pl{addEventListener(t,i){this._listeners===void 0&&(this._listeners={});const x=this._listeners;x[t]===void 0&&(x[t]=[]),x[t].indexOf(i)===-1&&x[t].push(i)}hasEventListener(t,i){if(this._listeners===void 0)return!1;const x=this._listeners;return x[t]!==void 0&&x[t].indexOf(i)!==-1}removeEventListener(t,i){if(this._listeners===void 0)return;const T=this._listeners[t];if(T!==void 0){const E=T.indexOf(i);E!==-1&&T.splice(E,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const x=this._listeners[t.type];if(x!==void 0){t.target=this;const T=x.slice(0);for(let E=0,s=T.length;E>8&255]+kr[g>>16&255]+kr[g>>24&255]+"-"+kr[t&255]+kr[t>>8&255]+"-"+kr[t>>16&15|64]+kr[t>>24&255]+"-"+kr[i&63|128]+kr[i>>8&255]+"-"+kr[i>>16&255]+kr[i>>24&255]+kr[x&255]+kr[x>>8&255]+kr[x>>16&255]+kr[x>>24&255]).toLowerCase()}function jn(g,t,i){return Math.max(t,Math.min(i,g))}function p1(g,t){return(g%t+t)%t}function T5(g,t,i,x,T){return x+(g-t)*(T-x)/(i-t)}function E5(g,t,i){return g!==t?(i-g)/(t-g):0}function fd(g,t,i){return(1-i)*g+i*t}function M5(g,t,i,x){return fd(g,t,1-Math.exp(-i*x))}function C5(g,t=1){return t-Math.abs(p1(g,t*2)-t)}function w5(g,t,i){return g<=t?0:g>=i?1:(g=(g-t)/(i-t),g*g*(3-2*g))}function A5(g,t,i){return g<=t?0:g>=i?1:(g=(g-t)/(i-t),g*g*g*(g*(g*6-15)+10))}function P5(g,t){return g+Math.floor(Math.random()*(t-g+1))}function R5(g,t){return g+Math.random()*(t-g)}function b5(g){return g*(.5-Math.random())}function L5(g){g!==void 0&&(wT=g);let t=wT+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function F5(g){return g*xu}function O5(g){return g*Jf}function px(g){return(g&g-1)===0&&g!==0}function D5(g){return Math.pow(2,Math.ceil(Math.log(g)/Math.LN2))}function Em(g){return Math.pow(2,Math.floor(Math.log(g)/Math.LN2))}function I5(g,t,i,x,T){const E=Math.cos,s=Math.sin,y=E(i/2),e=s(i/2),r=E((t+x)/2),p=s((t+x)/2),h=E((t-x)/2),a=s((t-x)/2),l=E((x-t)/2),n=s((x-t)/2);switch(T){case"XYX":g.set(y*p,e*h,e*a,y*r);break;case"YZY":g.set(e*a,y*p,e*h,y*r);break;case"ZXZ":g.set(e*h,e*a,y*p,y*r);break;case"XZX":g.set(y*p,e*n,e*l,y*r);break;case"YXY":g.set(e*l,y*p,e*n,y*r);break;case"ZYZ":g.set(e*n,e*l,y*p,y*r);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+T)}}function vs(g,t){switch(t.constructor){case Float32Array:return g;case Uint32Array:return g/4294967295;case Uint16Array:return g/65535;case Uint8Array:return g/255;case Int32Array:return Math.max(g/2147483647,-1);case Int16Array:return Math.max(g/32767,-1);case Int8Array:return Math.max(g/127,-1);default:throw new Error("Invalid component type.")}}function wi(g,t){switch(t.constructor){case Float32Array:return g;case Uint32Array:return Math.round(g*4294967295);case Uint16Array:return Math.round(g*65535);case Uint8Array:return Math.round(g*255);case Int32Array:return Math.round(g*2147483647);case Int16Array:return Math.round(g*32767);case Int8Array:return Math.round(g*127);default:throw new Error("Invalid component type.")}}const om={DEG2RAD:xu,RAD2DEG:Jf,generateUUID:na,clamp:jn,euclideanModulo:p1,mapLinear:T5,inverseLerp:E5,lerp:fd,damp:M5,pingpong:C5,smoothstep:w5,smootherstep:A5,randInt:P5,randFloat:R5,randFloatSpread:b5,seededRandom:L5,degToRad:F5,radToDeg:O5,isPowerOfTwo:px,ceilPowerOfTwo:D5,floorPowerOfTwo:Em,setQuaternionFromProperEuler:I5,normalize:wi,denormalize:vs};class ve{constructor(t=0,i=0){ve.prototype.isVector2=!0,this.x=t,this.y=i}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,i){return this.x=t,this.y=i,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,i){switch(t){case 0:this.x=i;break;case 1:this.y=i;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,i){return this.x=t.x+i.x,this.y=t.y+i.y,this}addScaledVector(t,i){return this.x+=t.x*i,this.y+=t.y*i,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,i){return this.x=t.x-i.x,this.y=t.y-i.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const i=this.x,x=this.y,T=t.elements;return this.x=T[0]*i+T[3]*x+T[6],this.y=T[1]*i+T[4]*x+T[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this}clampScalar(t,i){return this.x=Math.max(t,Math.min(i,this.x)),this.y=Math.max(t,Math.min(i,this.y)),this}clampLength(t,i){const x=this.length();return this.divideScalar(x||1).multiplyScalar(Math.max(t,Math.min(i,x)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const i=Math.sqrt(this.lengthSq()*t.lengthSq());if(i===0)return Math.PI/2;const x=this.dot(t)/i;return Math.acos(jn(x,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const i=this.x-t.x,x=this.y-t.y;return i*i+x*x}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this}lerpVectors(t,i,x){return this.x=t.x+(i.x-t.x)*x,this.y=t.y+(i.y-t.y)*x,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,i=0){return this.x=t[i],this.y=t[i+1],this}toArray(t=[],i=0){return t[i]=this.x,t[i+1]=this.y,t}fromBufferAttribute(t,i){return this.x=t.getX(i),this.y=t.getY(i),this}rotateAround(t,i){const x=Math.cos(i),T=Math.sin(i),E=this.x-t.x,s=this.y-t.y;return this.x=E*x-s*T+t.x,this.y=E*T+s*x+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Oi{constructor(t,i,x,T,E,s,y,e,r){Oi.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,i,x,T,E,s,y,e,r)}set(t,i,x,T,E,s,y,e,r){const p=this.elements;return p[0]=t,p[1]=T,p[2]=y,p[3]=i,p[4]=E,p[5]=e,p[6]=x,p[7]=s,p[8]=r,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const i=this.elements,x=t.elements;return i[0]=x[0],i[1]=x[1],i[2]=x[2],i[3]=x[3],i[4]=x[4],i[5]=x[5],i[6]=x[6],i[7]=x[7],i[8]=x[8],this}extractBasis(t,i,x){return t.setFromMatrix3Column(this,0),i.setFromMatrix3Column(this,1),x.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const i=t.elements;return this.set(i[0],i[4],i[8],i[1],i[5],i[9],i[2],i[6],i[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,i){const x=t.elements,T=i.elements,E=this.elements,s=x[0],y=x[3],e=x[6],r=x[1],p=x[4],h=x[7],a=x[2],l=x[5],n=x[8],u=T[0],f=T[3],o=T[6],c=T[1],d=T[4],v=T[7],m=T[2],S=T[5],M=T[8];return E[0]=s*u+y*c+e*m,E[3]=s*f+y*d+e*S,E[6]=s*o+y*v+e*M,E[1]=r*u+p*c+h*m,E[4]=r*f+p*d+h*S,E[7]=r*o+p*v+h*M,E[2]=a*u+l*c+n*m,E[5]=a*f+l*d+n*S,E[8]=a*o+l*v+n*M,this}multiplyScalar(t){const i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=t,i[4]*=t,i[7]*=t,i[2]*=t,i[5]*=t,i[8]*=t,this}determinant(){const t=this.elements,i=t[0],x=t[1],T=t[2],E=t[3],s=t[4],y=t[5],e=t[6],r=t[7],p=t[8];return i*s*p-i*y*r-x*E*p+x*y*e+T*E*r-T*s*e}invert(){const t=this.elements,i=t[0],x=t[1],T=t[2],E=t[3],s=t[4],y=t[5],e=t[6],r=t[7],p=t[8],h=p*s-y*r,a=y*e-p*E,l=r*E-s*e,n=i*h+x*a+T*l;if(n===0)return this.set(0,0,0,0,0,0,0,0,0);const u=1/n;return t[0]=h*u,t[1]=(T*r-p*x)*u,t[2]=(y*x-T*s)*u,t[3]=a*u,t[4]=(p*i-T*e)*u,t[5]=(T*E-y*i)*u,t[6]=l*u,t[7]=(x*e-r*i)*u,t[8]=(s*i-x*E)*u,this}transpose(){let t;const i=this.elements;return t=i[1],i[1]=i[3],i[3]=t,t=i[2],i[2]=i[6],i[6]=t,t=i[5],i[5]=i[7],i[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const i=this.elements;return t[0]=i[0],t[1]=i[3],t[2]=i[6],t[3]=i[1],t[4]=i[4],t[5]=i[7],t[6]=i[2],t[7]=i[5],t[8]=i[8],this}setUvTransform(t,i,x,T,E,s,y){const e=Math.cos(E),r=Math.sin(E);return this.set(x*e,x*r,-x*(e*s+r*y)+s+t,-T*r,T*e,-T*(-r*s+e*y)+y+i,0,0,1),this}scale(t,i){return this.premultiply(S0.makeScale(t,i)),this}rotate(t){return this.premultiply(S0.makeRotation(-t)),this}translate(t,i){return this.premultiply(S0.makeTranslation(t,i)),this}makeTranslation(t,i){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,i,0,0,1),this}makeRotation(t){const i=Math.cos(t),x=Math.sin(t);return this.set(i,-x,0,x,i,0,0,0,1),this}makeScale(t,i){return this.set(t,0,0,0,i,0,0,0,1),this}equals(t){const i=this.elements,x=t.elements;for(let T=0;T<9;T++)if(i[T]!==x[T])return!1;return!0}fromArray(t,i=0){for(let x=0;x<9;x++)this.elements[x]=t[x+i];return this}toArray(t=[],i=0){const x=this.elements;return t[i]=x[0],t[i+1]=x[1],t[i+2]=x[2],t[i+3]=x[3],t[i+4]=x[4],t[i+5]=x[5],t[i+6]=x[6],t[i+7]=x[7],t[i+8]=x[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const S0=new Oi;function uw(g){for(let t=g.length-1;t>=0;--t)if(g[t]>=65535)return!0;return!1}const N5={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Bf(g,t){return new N5[g](t)}function Dd(g){return document.createElementNS("http://www.w3.org/1999/xhtml",g)}function fw(){const g=Dd("canvas");return g.style.display="block",g}const AT={};function Su(g){g in AT||(AT[g]=!0,console.warn(g))}const PT=new Oi().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),RT=new Oi().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),ev={[Go]:{transfer:Rd,primaries:bd,toReference:g=>g,fromReference:g=>g},[vr]:{transfer:vn,primaries:bd,toReference:g=>g.convertSRGBToLinear(),fromReference:g=>g.convertLinearToSRGB()},[Jd]:{transfer:Rd,primaries:Ld,toReference:g=>g.applyMatrix3(RT),fromReference:g=>g.applyMatrix3(PT)},[lg]:{transfer:vn,primaries:Ld,toReference:g=>g.convertSRGBToLinear().applyMatrix3(RT),fromReference:g=>g.applyMatrix3(PT).convertLinearToSRGB()}},B5=new Set([Go,Jd]),rn={enabled:!0,_workingColorSpace:Go,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(g){if(!B5.has(g))throw new Error(`Unsupported working color space, "${g}".`);this._workingColorSpace=g},convert:function(g,t,i){if(this.enabled===!1||t===i||!t||!i)return g;const x=ev[t].toReference,T=ev[i].fromReference;return T(x(g))},fromWorkingColorSpace:function(g,t){return this.convert(g,this._workingColorSpace,t)},toWorkingColorSpace:function(g,t){return this.convert(g,t,this._workingColorSpace)},getPrimaries:function(g){return ev[g].primaries},getTransfer:function(g){return g===ea?Rd:ev[g].transfer}};function Xf(g){return g<.04045?g*.0773993808:Math.pow(g*.9478672986+.0521327014,2.4)}function T0(g){return g<.0031308?g*12.92:1.055*Math.pow(g,.41666)-.055}let lf;class v1{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{lf===void 0&&(lf=Dd("canvas")),lf.width=t.width,lf.height=t.height;const x=lf.getContext("2d");t instanceof ImageData?x.putImageData(t,0,0):x.drawImage(t,0,0,t.width,t.height),i=lf}return i.width>2048||i.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),i.toDataURL("image/jpeg",.6)):i.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const i=Dd("canvas");i.width=t.width,i.height=t.height;const x=i.getContext("2d");x.drawImage(t,0,0,t.width,t.height);const T=x.getImageData(0,0,t.width,t.height),E=T.data;for(let s=0;s0&&(x.userData=this.userData),i||(t.textures[this.uuid]=x),x}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==sg)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Md:t.x=t.x-Math.floor(t.x);break;case Jr:t.x=t.x<0?0:1;break;case Cd:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Md:t.y=t.y-Math.floor(t.y);break;case Jr:t.y=t.y<0?0:1;break;case Cd:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return Su("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===vr?ch:c1}set encoding(t){Su("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===ch?vr:ea}}Un.DEFAULT_IMAGE=null;Un.DEFAULT_MAPPING=sg;Un.DEFAULT_ANISOTROPY=1;class sn{constructor(t=0,i=0,x=0,T=1){sn.prototype.isVector4=!0,this.x=t,this.y=i,this.z=x,this.w=T}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,i,x,T){return this.x=t,this.y=i,this.z=x,this.w=T,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,i){switch(t){case 0:this.x=i;break;case 1:this.y=i;break;case 2:this.z=i;break;case 3:this.w=i;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,i){return this.x=t.x+i.x,this.y=t.y+i.y,this.z=t.z+i.z,this.w=t.w+i.w,this}addScaledVector(t,i){return this.x+=t.x*i,this.y+=t.y*i,this.z+=t.z*i,this.w+=t.w*i,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,i){return this.x=t.x-i.x,this.y=t.y-i.y,this.z=t.z-i.z,this.w=t.w-i.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const i=this.x,x=this.y,T=this.z,E=this.w,s=t.elements;return this.x=s[0]*i+s[4]*x+s[8]*T+s[12]*E,this.y=s[1]*i+s[5]*x+s[9]*T+s[13]*E,this.z=s[2]*i+s[6]*x+s[10]*T+s[14]*E,this.w=s[3]*i+s[7]*x+s[11]*T+s[15]*E,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const i=Math.sqrt(1-t.w*t.w);return i<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/i,this.y=t.y/i,this.z=t.z/i),this}setAxisAngleFromRotationMatrix(t){let i,x,T,E;const e=t.elements,r=e[0],p=e[4],h=e[8],a=e[1],l=e[5],n=e[9],u=e[2],f=e[6],o=e[10];if(Math.abs(p-a)<.01&&Math.abs(h-u)<.01&&Math.abs(n-f)<.01){if(Math.abs(p+a)<.1&&Math.abs(h+u)<.1&&Math.abs(n+f)<.1&&Math.abs(r+l+o-3)<.1)return this.set(1,0,0,0),this;i=Math.PI;const d=(r+1)/2,v=(l+1)/2,m=(o+1)/2,S=(p+a)/4,M=(h+u)/4,w=(n+f)/4;return d>v&&d>m?d<.01?(x=0,T=.707106781,E=.707106781):(x=Math.sqrt(d),T=S/x,E=M/x):v>m?v<.01?(x=.707106781,T=0,E=.707106781):(T=Math.sqrt(v),x=S/T,E=w/T):m<.01?(x=.707106781,T=.707106781,E=0):(E=Math.sqrt(m),x=M/E,T=w/E),this.set(x,T,E,i),this}let c=Math.sqrt((f-n)*(f-n)+(h-u)*(h-u)+(a-p)*(a-p));return Math.abs(c)<.001&&(c=1),this.x=(f-n)/c,this.y=(h-u)/c,this.z=(a-p)/c,this.w=Math.acos((r+l+o-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this.z=Math.max(t.z,Math.min(i.z,this.z)),this.w=Math.max(t.w,Math.min(i.w,this.w)),this}clampScalar(t,i){return this.x=Math.max(t,Math.min(i,this.x)),this.y=Math.max(t,Math.min(i,this.y)),this.z=Math.max(t,Math.min(i,this.z)),this.w=Math.max(t,Math.min(i,this.w)),this}clampLength(t,i){const x=this.length();return this.divideScalar(x||1).multiplyScalar(Math.max(t,Math.min(i,x)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this.z+=(t.z-this.z)*i,this.w+=(t.w-this.w)*i,this}lerpVectors(t,i,x){return this.x=t.x+(i.x-t.x)*x,this.y=t.y+(i.y-t.y)*x,this.z=t.z+(i.z-t.z)*x,this.w=t.w+(i.w-t.w)*x,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,i=0){return this.x=t[i],this.y=t[i+1],this.z=t[i+2],this.w=t[i+3],this}toArray(t=[],i=0){return t[i]=this.x,t[i+1]=this.y,t[i+2]=this.z,t[i+3]=this.w,t}fromBufferAttribute(t,i){return this.x=t.getX(i),this.y=t.getY(i),this.z=t.getZ(i),this.w=t.getW(i),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class cw extends Pl{constructor(t=1,i=1,x={}){super(),this.isRenderTarget=!0,this.width=t,this.height=i,this.depth=1,this.scissor=new sn(0,0,t,i),this.scissorTest=!1,this.viewport=new sn(0,0,t,i);const T={width:t,height:i,depth:1};x.encoding!==void 0&&(Su("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),x.colorSpace=x.encoding===ch?vr:ea),x=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Nn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},x),this.texture=new Un(T,x.mapping,x.wrapS,x.wrapT,x.magFilter,x.minFilter,x.format,x.type,x.anisotropy,x.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=x.generateMipmaps,this.texture.internalFormat=x.internalFormat,this.depthBuffer=x.depthBuffer,this.stencilBuffer=x.stencilBuffer,this.depthTexture=x.depthTexture,this.samples=x.samples}setSize(t,i,x=1){(this.width!==t||this.height!==i||this.depth!==x)&&(this.width=t,this.height=i,this.depth=x,this.texture.image.width=t,this.texture.image.height=i,this.texture.image.depth=x,this.dispose()),this.viewport.set(0,0,t,i),this.scissor.set(0,0,t,i)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;const i=Object.assign({},t.texture.image);return this.texture.source=new mu(i),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class io extends cw{constructor(t=1,i=1,x={}){super(t,i,x),this.isWebGLRenderTarget=!0}}class hg extends Un{constructor(t=null,i=1,x=1,T=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:i,height:x,depth:T},this.magFilter=nr,this.minFilter=nr,this.wrapR=Jr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class G5 extends io{constructor(t=1,i=1,x=1,T={}){super(t,i,T),this.isWebGLArrayRenderTarget=!0,this.depth=x,this.texture=new hg(null,t,i,x),this.texture.isRenderTargetTexture=!0}}class m1 extends Un{constructor(t=null,i=1,x=1,T=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:i,height:x,depth:T},this.magFilter=nr,this.minFilter=nr,this.wrapR=Jr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class V5 extends io{constructor(t=1,i=1,x=1,T={}){super(t,i,T),this.isWebGL3DRenderTarget=!0,this.depth=x,this.texture=new m1(null,t,i,x),this.texture.isRenderTargetTexture=!0}}class H5 extends io{constructor(t=1,i=1,x=1,T={}){super(t,i,T),this.isWebGLMultipleRenderTargets=!0;const E=this.texture;this.texture=[];for(let s=0;s=0?1:-1,d=1-o*o;if(d>Number.EPSILON){const m=Math.sqrt(d),S=Math.atan2(m,o*c);f=Math.sin(f*S)/m,y=Math.sin(y*S)/m}const v=y*c;if(e=e*f+a*v,r=r*f+l*v,p=p*f+n*v,h=h*f+u*v,f===1-y){const m=1/Math.sqrt(e*e+r*r+p*p+h*h);e*=m,r*=m,p*=m,h*=m}}t[i]=e,t[i+1]=r,t[i+2]=p,t[i+3]=h}static multiplyQuaternionsFlat(t,i,x,T,E,s){const y=x[T],e=x[T+1],r=x[T+2],p=x[T+3],h=E[s],a=E[s+1],l=E[s+2],n=E[s+3];return t[i]=y*n+p*h+e*l-r*a,t[i+1]=e*n+p*a+r*h-y*l,t[i+2]=r*n+p*l+y*a-e*h,t[i+3]=p*n-y*h-e*a-r*l,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,i,x,T){return this._x=t,this._y=i,this._z=x,this._w=T,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,i=!0){const x=t._x,T=t._y,E=t._z,s=t._order,y=Math.cos,e=Math.sin,r=y(x/2),p=y(T/2),h=y(E/2),a=e(x/2),l=e(T/2),n=e(E/2);switch(s){case"XYZ":this._x=a*p*h+r*l*n,this._y=r*l*h-a*p*n,this._z=r*p*n+a*l*h,this._w=r*p*h-a*l*n;break;case"YXZ":this._x=a*p*h+r*l*n,this._y=r*l*h-a*p*n,this._z=r*p*n-a*l*h,this._w=r*p*h+a*l*n;break;case"ZXY":this._x=a*p*h-r*l*n,this._y=r*l*h+a*p*n,this._z=r*p*n+a*l*h,this._w=r*p*h-a*l*n;break;case"ZYX":this._x=a*p*h-r*l*n,this._y=r*l*h+a*p*n,this._z=r*p*n-a*l*h,this._w=r*p*h+a*l*n;break;case"YZX":this._x=a*p*h+r*l*n,this._y=r*l*h+a*p*n,this._z=r*p*n-a*l*h,this._w=r*p*h-a*l*n;break;case"XZY":this._x=a*p*h-r*l*n,this._y=r*l*h-a*p*n,this._z=r*p*n+a*l*h,this._w=r*p*h+a*l*n;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return i===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,i){const x=i/2,T=Math.sin(x);return this._x=t.x*T,this._y=t.y*T,this._z=t.z*T,this._w=Math.cos(x),this._onChangeCallback(),this}setFromRotationMatrix(t){const i=t.elements,x=i[0],T=i[4],E=i[8],s=i[1],y=i[5],e=i[9],r=i[2],p=i[6],h=i[10],a=x+y+h;if(a>0){const l=.5/Math.sqrt(a+1);this._w=.25/l,this._x=(p-e)*l,this._y=(E-r)*l,this._z=(s-T)*l}else if(x>y&&x>h){const l=2*Math.sqrt(1+x-y-h);this._w=(p-e)/l,this._x=.25*l,this._y=(T+s)/l,this._z=(E+r)/l}else if(y>h){const l=2*Math.sqrt(1+y-x-h);this._w=(E-r)/l,this._x=(T+s)/l,this._y=.25*l,this._z=(e+p)/l}else{const l=2*Math.sqrt(1+h-x-y);this._w=(s-T)/l,this._x=(E+r)/l,this._y=(e+p)/l,this._z=.25*l}return this._onChangeCallback(),this}setFromUnitVectors(t,i){let x=t.dot(i)+1;return xMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=x):(this._x=0,this._y=-t.z,this._z=t.y,this._w=x)):(this._x=t.y*i.z-t.z*i.y,this._y=t.z*i.x-t.x*i.z,this._z=t.x*i.y-t.y*i.x,this._w=x),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(jn(this.dot(t),-1,1)))}rotateTowards(t,i){const x=this.angleTo(t);if(x===0)return this;const T=Math.min(1,i/x);return this.slerp(t,T),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,i){const x=t._x,T=t._y,E=t._z,s=t._w,y=i._x,e=i._y,r=i._z,p=i._w;return this._x=x*p+s*y+T*r-E*e,this._y=T*p+s*e+E*y-x*r,this._z=E*p+s*r+x*e-T*y,this._w=s*p-x*y-T*e-E*r,this._onChangeCallback(),this}slerp(t,i){if(i===0)return this;if(i===1)return this.copy(t);const x=this._x,T=this._y,E=this._z,s=this._w;let y=s*t._w+x*t._x+T*t._y+E*t._z;if(y<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,y=-y):this.copy(t),y>=1)return this._w=s,this._x=x,this._y=T,this._z=E,this;const e=1-y*y;if(e<=Number.EPSILON){const l=1-i;return this._w=l*s+i*this._w,this._x=l*x+i*this._x,this._y=l*T+i*this._y,this._z=l*E+i*this._z,this.normalize(),this}const r=Math.sqrt(e),p=Math.atan2(r,y),h=Math.sin((1-i)*p)/r,a=Math.sin(i*p)/r;return this._w=s*h+this._w*a,this._x=x*h+this._x*a,this._y=T*h+this._y*a,this._z=E*h+this._z*a,this._onChangeCallback(),this}slerpQuaternions(t,i,x){return this.copy(t).slerp(i,x)}random(){const t=Math.random(),i=Math.sqrt(1-t),x=Math.sqrt(t),T=2*Math.PI*Math.random(),E=2*Math.PI*Math.random();return this.set(i*Math.cos(T),x*Math.sin(E),x*Math.cos(E),i*Math.sin(T))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,i=0){return this._x=t[i],this._y=t[i+1],this._z=t[i+2],this._w=t[i+3],this._onChangeCallback(),this}toArray(t=[],i=0){return t[i]=this._x,t[i+1]=this._y,t[i+2]=this._z,t[i+3]=this._w,t}fromBufferAttribute(t,i){return this._x=t.getX(i),this._y=t.getY(i),this._z=t.getZ(i),this._w=t.getW(i),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Ct{constructor(t=0,i=0,x=0){Ct.prototype.isVector3=!0,this.x=t,this.y=i,this.z=x}set(t,i,x){return x===void 0&&(x=this.z),this.x=t,this.y=i,this.z=x,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,i){switch(t){case 0:this.x=i;break;case 1:this.y=i;break;case 2:this.z=i;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,i){return this.x=t.x+i.x,this.y=t.y+i.y,this.z=t.z+i.z,this}addScaledVector(t,i){return this.x+=t.x*i,this.y+=t.y*i,this.z+=t.z*i,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,i){return this.x=t.x-i.x,this.y=t.y-i.y,this.z=t.z-i.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,i){return this.x=t.x*i.x,this.y=t.y*i.y,this.z=t.z*i.z,this}applyEuler(t){return this.applyQuaternion(bT.setFromEuler(t))}applyAxisAngle(t,i){return this.applyQuaternion(bT.setFromAxisAngle(t,i))}applyMatrix3(t){const i=this.x,x=this.y,T=this.z,E=t.elements;return this.x=E[0]*i+E[3]*x+E[6]*T,this.y=E[1]*i+E[4]*x+E[7]*T,this.z=E[2]*i+E[5]*x+E[8]*T,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const i=this.x,x=this.y,T=this.z,E=t.elements,s=1/(E[3]*i+E[7]*x+E[11]*T+E[15]);return this.x=(E[0]*i+E[4]*x+E[8]*T+E[12])*s,this.y=(E[1]*i+E[5]*x+E[9]*T+E[13])*s,this.z=(E[2]*i+E[6]*x+E[10]*T+E[14])*s,this}applyQuaternion(t){const i=this.x,x=this.y,T=this.z,E=t.x,s=t.y,y=t.z,e=t.w,r=2*(s*T-y*x),p=2*(y*i-E*T),h=2*(E*x-s*i);return this.x=i+e*r+s*h-y*p,this.y=x+e*p+y*r-E*h,this.z=T+e*h+E*p-s*r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const i=this.x,x=this.y,T=this.z,E=t.elements;return this.x=E[0]*i+E[4]*x+E[8]*T,this.y=E[1]*i+E[5]*x+E[9]*T,this.z=E[2]*i+E[6]*x+E[10]*T,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this.z=Math.max(t.z,Math.min(i.z,this.z)),this}clampScalar(t,i){return this.x=Math.max(t,Math.min(i,this.x)),this.y=Math.max(t,Math.min(i,this.y)),this.z=Math.max(t,Math.min(i,this.z)),this}clampLength(t,i){const x=this.length();return this.divideScalar(x||1).multiplyScalar(Math.max(t,Math.min(i,x)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this.z+=(t.z-this.z)*i,this}lerpVectors(t,i,x){return this.x=t.x+(i.x-t.x)*x,this.y=t.y+(i.y-t.y)*x,this.z=t.z+(i.z-t.z)*x,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,i){const x=t.x,T=t.y,E=t.z,s=i.x,y=i.y,e=i.z;return this.x=T*e-E*y,this.y=E*s-x*e,this.z=x*y-T*s,this}projectOnVector(t){const i=t.lengthSq();if(i===0)return this.set(0,0,0);const x=t.dot(this)/i;return this.copy(t).multiplyScalar(x)}projectOnPlane(t){return M0.copy(this).projectOnVector(t),this.sub(M0)}reflect(t){return this.sub(M0.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const i=Math.sqrt(this.lengthSq()*t.lengthSq());if(i===0)return Math.PI/2;const x=this.dot(t)/i;return Math.acos(jn(x,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const i=this.x-t.x,x=this.y-t.y,T=this.z-t.z;return i*i+x*x+T*T}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,i,x){const T=Math.sin(i)*t;return this.x=T*Math.sin(x),this.y=Math.cos(i)*t,this.z=T*Math.cos(x),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,i,x){return this.x=t*Math.sin(i),this.y=x,this.z=t*Math.cos(i),this}setFromMatrixPosition(t){const i=t.elements;return this.x=i[12],this.y=i[13],this.z=i[14],this}setFromMatrixScale(t){const i=this.setFromMatrixColumn(t,0).length(),x=this.setFromMatrixColumn(t,1).length(),T=this.setFromMatrixColumn(t,2).length();return this.x=i,this.y=x,this.z=T,this}setFromMatrixColumn(t,i){return this.fromArray(t.elements,i*4)}setFromMatrix3Column(t,i){return this.fromArray(t.elements,i*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,i=0){return this.x=t[i],this.y=t[i+1],this.z=t[i+2],this}toArray(t=[],i=0){return t[i]=this.x,t[i+1]=this.y,t[i+2]=this.z,t}fromBufferAttribute(t,i){return this.x=t.getX(i),this.y=t.getY(i),this.z=t.getZ(i),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=(Math.random()-.5)*2,i=Math.random()*Math.PI*2,x=Math.sqrt(1-t**2);return this.x=x*Math.cos(i),this.y=x*Math.sin(i),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const M0=new Ct,bT=new Ds;class gs{constructor(t=new Ct(1/0,1/0,1/0),i=new Ct(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=i}set(t,i){return this.min.copy(t),this.max.copy(i),this}setFromArray(t){this.makeEmpty();for(let i=0,x=t.length;ithis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,i){return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Ja),Ja.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let i,x;return t.normal.x>0?(i=t.normal.x*this.min.x,x=t.normal.x*this.max.x):(i=t.normal.x*this.max.x,x=t.normal.x*this.min.x),t.normal.y>0?(i+=t.normal.y*this.min.y,x+=t.normal.y*this.max.y):(i+=t.normal.y*this.max.y,x+=t.normal.y*this.min.y),t.normal.z>0?(i+=t.normal.z*this.min.z,x+=t.normal.z*this.max.z):(i+=t.normal.z*this.max.z,x+=t.normal.z*this.min.z),i<=-t.constant&&x>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Xc),nv.subVectors(this.max,Xc),hf.subVectors(t.a,Xc),uf.subVectors(t.b,Xc),ff.subVectors(t.c,Xc),_l.subVectors(uf,hf),ql.subVectors(ff,uf),$h.subVectors(hf,ff);let i=[0,-_l.z,_l.y,0,-ql.z,ql.y,0,-$h.z,$h.y,_l.z,0,-_l.x,ql.z,0,-ql.x,$h.z,0,-$h.x,-_l.y,_l.x,0,-ql.y,ql.x,0,-$h.y,$h.x,0];return!C0(i,hf,uf,ff,nv)||(i=[1,0,0,0,1,0,0,0,1],!C0(i,hf,uf,ff,nv))?!1:(rv.crossVectors(_l,ql),i=[rv.x,rv.y,rv.z],C0(i,hf,uf,ff,nv))}clampPoint(t,i){return i.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Ja).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Ja).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(hl[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),hl[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),hl[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),hl[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),hl[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),hl[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),hl[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),hl[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(hl),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const hl=[new Ct,new Ct,new Ct,new Ct,new Ct,new Ct,new Ct,new Ct],Ja=new Ct,iv=new gs,hf=new Ct,uf=new Ct,ff=new Ct,_l=new Ct,ql=new Ct,$h=new Ct,Xc=new Ct,nv=new Ct,rv=new Ct,Qh=new Ct;function C0(g,t,i,x,T){for(let E=0,s=g.length-3;E<=s;E+=3){Qh.fromArray(g,E);const y=T.x*Math.abs(Qh.x)+T.y*Math.abs(Qh.y)+T.z*Math.abs(Qh.z),e=t.dot(Qh),r=i.dot(Qh),p=x.dot(Qh);if(Math.max(-Math.max(e,r,p),Math.min(e,r,p))>y)return!1}return!0}const W5=new gs,Yc=new Ct,w0=new Ct;class $r{constructor(t=new Ct,i=-1){this.isSphere=!0,this.center=t,this.radius=i}set(t,i){return this.center.copy(t),this.radius=i,this}setFromPoints(t,i){const x=this.center;i!==void 0?x.copy(i):W5.setFromPoints(t).getCenter(x);let T=0;for(let E=0,s=t.length;Ethis.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Yc.subVectors(t,this.center);const i=Yc.lengthSq();if(i>this.radius*this.radius){const x=Math.sqrt(i),T=(x-this.radius)*.5;this.center.addScaledVector(Yc,T/x),this.radius+=T}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(w0.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Yc.copy(t.center).add(w0)),this.expandByPoint(Yc.copy(t.center).sub(w0))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}}const ul=new Ct,A0=new Ct,sv=new Ct,th=new Ct,P0=new Ct,av=new Ct,R0=new Ct;class ic{constructor(t=new Ct,i=new Ct(0,0,-1)){this.origin=t,this.direction=i}set(t,i){return this.origin.copy(t),this.direction.copy(i),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,i){return i.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,ul)),this}closestPointToPoint(t,i){i.subVectors(t,this.origin);const x=i.dot(this.direction);return x<0?i.copy(this.origin):i.copy(this.origin).addScaledVector(this.direction,x)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const i=ul.subVectors(t,this.origin).dot(this.direction);return i<0?this.origin.distanceToSquared(t):(ul.copy(this.origin).addScaledVector(this.direction,i),ul.distanceToSquared(t))}distanceSqToSegment(t,i,x,T){A0.copy(t).add(i).multiplyScalar(.5),sv.copy(i).sub(t).normalize(),th.copy(this.origin).sub(A0);const E=t.distanceTo(i)*.5,s=-this.direction.dot(sv),y=th.dot(this.direction),e=-th.dot(sv),r=th.lengthSq(),p=Math.abs(1-s*s);let h,a,l,n;if(p>0)if(h=s*e-y,a=s*y-e,n=E*p,h>=0)if(a>=-n)if(a<=n){const u=1/p;h*=u,a*=u,l=h*(h+s*a+2*y)+a*(s*h+a+2*e)+r}else a=E,h=Math.max(0,-(s*a+y)),l=-h*h+a*(a+2*e)+r;else a=-E,h=Math.max(0,-(s*a+y)),l=-h*h+a*(a+2*e)+r;else a<=-n?(h=Math.max(0,-(-s*E+y)),a=h>0?-E:Math.min(Math.max(-E,-e),E),l=-h*h+a*(a+2*e)+r):a<=n?(h=0,a=Math.min(Math.max(-E,-e),E),l=a*(a+2*e)+r):(h=Math.max(0,-(s*E+y)),a=h>0?E:Math.min(Math.max(-E,-e),E),l=-h*h+a*(a+2*e)+r);else a=s>0?-E:E,h=Math.max(0,-(s*a+y)),l=-h*h+a*(a+2*e)+r;return x&&x.copy(this.origin).addScaledVector(this.direction,h),T&&T.copy(A0).addScaledVector(sv,a),l}intersectSphere(t,i){ul.subVectors(t.center,this.origin);const x=ul.dot(this.direction),T=ul.dot(ul)-x*x,E=t.radius*t.radius;if(T>E)return null;const s=Math.sqrt(E-T),y=x-s,e=x+s;return e<0?null:y<0?this.at(e,i):this.at(y,i)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const i=t.normal.dot(this.direction);if(i===0)return t.distanceToPoint(this.origin)===0?0:null;const x=-(this.origin.dot(t.normal)+t.constant)/i;return x>=0?x:null}intersectPlane(t,i){const x=this.distanceToPlane(t);return x===null?null:this.at(x,i)}intersectsPlane(t){const i=t.distanceToPoint(this.origin);return i===0||t.normal.dot(this.direction)*i<0}intersectBox(t,i){let x,T,E,s,y,e;const r=1/this.direction.x,p=1/this.direction.y,h=1/this.direction.z,a=this.origin;return r>=0?(x=(t.min.x-a.x)*r,T=(t.max.x-a.x)*r):(x=(t.max.x-a.x)*r,T=(t.min.x-a.x)*r),p>=0?(E=(t.min.y-a.y)*p,s=(t.max.y-a.y)*p):(E=(t.max.y-a.y)*p,s=(t.min.y-a.y)*p),x>s||E>T||((E>x||isNaN(x))&&(x=E),(s=0?(y=(t.min.z-a.z)*h,e=(t.max.z-a.z)*h):(y=(t.max.z-a.z)*h,e=(t.min.z-a.z)*h),x>e||y>T)||((y>x||x!==x)&&(x=y),(e=0?x:T,i)}intersectsBox(t){return this.intersectBox(t,ul)!==null}intersectTriangle(t,i,x,T,E){P0.subVectors(i,t),av.subVectors(x,t),R0.crossVectors(P0,av);let s=this.direction.dot(R0),y;if(s>0){if(T)return null;y=1}else if(s<0)y=-1,s=-s;else return null;th.subVectors(this.origin,t);const e=y*this.direction.dot(av.crossVectors(th,av));if(e<0)return null;const r=y*this.direction.dot(P0.cross(th));if(r<0||e+r>s)return null;const p=-y*th.dot(R0);return p<0?null:this.at(p/s,E)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ci{constructor(t,i,x,T,E,s,y,e,r,p,h,a,l,n,u,f){ci.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,i,x,T,E,s,y,e,r,p,h,a,l,n,u,f)}set(t,i,x,T,E,s,y,e,r,p,h,a,l,n,u,f){const o=this.elements;return o[0]=t,o[4]=i,o[8]=x,o[12]=T,o[1]=E,o[5]=s,o[9]=y,o[13]=e,o[2]=r,o[6]=p,o[10]=h,o[14]=a,o[3]=l,o[7]=n,o[11]=u,o[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ci().fromArray(this.elements)}copy(t){const i=this.elements,x=t.elements;return i[0]=x[0],i[1]=x[1],i[2]=x[2],i[3]=x[3],i[4]=x[4],i[5]=x[5],i[6]=x[6],i[7]=x[7],i[8]=x[8],i[9]=x[9],i[10]=x[10],i[11]=x[11],i[12]=x[12],i[13]=x[13],i[14]=x[14],i[15]=x[15],this}copyPosition(t){const i=this.elements,x=t.elements;return i[12]=x[12],i[13]=x[13],i[14]=x[14],this}setFromMatrix3(t){const i=t.elements;return this.set(i[0],i[3],i[6],0,i[1],i[4],i[7],0,i[2],i[5],i[8],0,0,0,0,1),this}extractBasis(t,i,x){return t.setFromMatrixColumn(this,0),i.setFromMatrixColumn(this,1),x.setFromMatrixColumn(this,2),this}makeBasis(t,i,x){return this.set(t.x,i.x,x.x,0,t.y,i.y,x.y,0,t.z,i.z,x.z,0,0,0,0,1),this}extractRotation(t){const i=this.elements,x=t.elements,T=1/cf.setFromMatrixColumn(t,0).length(),E=1/cf.setFromMatrixColumn(t,1).length(),s=1/cf.setFromMatrixColumn(t,2).length();return i[0]=x[0]*T,i[1]=x[1]*T,i[2]=x[2]*T,i[3]=0,i[4]=x[4]*E,i[5]=x[5]*E,i[6]=x[6]*E,i[7]=0,i[8]=x[8]*s,i[9]=x[9]*s,i[10]=x[10]*s,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this}makeRotationFromEuler(t){const i=this.elements,x=t.x,T=t.y,E=t.z,s=Math.cos(x),y=Math.sin(x),e=Math.cos(T),r=Math.sin(T),p=Math.cos(E),h=Math.sin(E);if(t.order==="XYZ"){const a=s*p,l=s*h,n=y*p,u=y*h;i[0]=e*p,i[4]=-e*h,i[8]=r,i[1]=l+n*r,i[5]=a-u*r,i[9]=-y*e,i[2]=u-a*r,i[6]=n+l*r,i[10]=s*e}else if(t.order==="YXZ"){const a=e*p,l=e*h,n=r*p,u=r*h;i[0]=a+u*y,i[4]=n*y-l,i[8]=s*r,i[1]=s*h,i[5]=s*p,i[9]=-y,i[2]=l*y-n,i[6]=u+a*y,i[10]=s*e}else if(t.order==="ZXY"){const a=e*p,l=e*h,n=r*p,u=r*h;i[0]=a-u*y,i[4]=-s*h,i[8]=n+l*y,i[1]=l+n*y,i[5]=s*p,i[9]=u-a*y,i[2]=-s*r,i[6]=y,i[10]=s*e}else if(t.order==="ZYX"){const a=s*p,l=s*h,n=y*p,u=y*h;i[0]=e*p,i[4]=n*r-l,i[8]=a*r+u,i[1]=e*h,i[5]=u*r+a,i[9]=l*r-n,i[2]=-r,i[6]=y*e,i[10]=s*e}else if(t.order==="YZX"){const a=s*e,l=s*r,n=y*e,u=y*r;i[0]=e*p,i[4]=u-a*h,i[8]=n*h+l,i[1]=h,i[5]=s*p,i[9]=-y*p,i[2]=-r*p,i[6]=l*h+n,i[10]=a-u*h}else if(t.order==="XZY"){const a=s*e,l=s*r,n=y*e,u=y*r;i[0]=e*p,i[4]=-h,i[8]=r*p,i[1]=a*h+u,i[5]=s*p,i[9]=l*h-n,i[2]=n*h-l,i[6]=y*p,i[10]=u*h+a}return i[3]=0,i[7]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this}makeRotationFromQuaternion(t){return this.compose(X5,t,Y5)}lookAt(t,i,x){const T=this.elements;return qs.subVectors(t,i),qs.lengthSq()===0&&(qs.z=1),qs.normalize(),eh.crossVectors(x,qs),eh.lengthSq()===0&&(Math.abs(x.z)===1?qs.x+=1e-4:qs.z+=1e-4,qs.normalize(),eh.crossVectors(x,qs)),eh.normalize(),ov.crossVectors(qs,eh),T[0]=eh.x,T[4]=ov.x,T[8]=qs.x,T[1]=eh.y,T[5]=ov.y,T[9]=qs.y,T[2]=eh.z,T[6]=ov.z,T[10]=qs.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,i){const x=t.elements,T=i.elements,E=this.elements,s=x[0],y=x[4],e=x[8],r=x[12],p=x[1],h=x[5],a=x[9],l=x[13],n=x[2],u=x[6],f=x[10],o=x[14],c=x[3],d=x[7],v=x[11],m=x[15],S=T[0],M=T[4],w=T[8],C=T[12],A=T[1],P=T[5],b=T[9],O=T[13],I=T[2],D=T[6],B=T[10],G=T[14],z=T[3],X=T[7],K=T[11],Q=T[15];return E[0]=s*S+y*A+e*I+r*z,E[4]=s*M+y*P+e*D+r*X,E[8]=s*w+y*b+e*B+r*K,E[12]=s*C+y*O+e*G+r*Q,E[1]=p*S+h*A+a*I+l*z,E[5]=p*M+h*P+a*D+l*X,E[9]=p*w+h*b+a*B+l*K,E[13]=p*C+h*O+a*G+l*Q,E[2]=n*S+u*A+f*I+o*z,E[6]=n*M+u*P+f*D+o*X,E[10]=n*w+u*b+f*B+o*K,E[14]=n*C+u*O+f*G+o*Q,E[3]=c*S+d*A+v*I+m*z,E[7]=c*M+d*P+v*D+m*X,E[11]=c*w+d*b+v*B+m*K,E[15]=c*C+d*O+v*G+m*Q,this}multiplyScalar(t){const i=this.elements;return i[0]*=t,i[4]*=t,i[8]*=t,i[12]*=t,i[1]*=t,i[5]*=t,i[9]*=t,i[13]*=t,i[2]*=t,i[6]*=t,i[10]*=t,i[14]*=t,i[3]*=t,i[7]*=t,i[11]*=t,i[15]*=t,this}determinant(){const t=this.elements,i=t[0],x=t[4],T=t[8],E=t[12],s=t[1],y=t[5],e=t[9],r=t[13],p=t[2],h=t[6],a=t[10],l=t[14],n=t[3],u=t[7],f=t[11],o=t[15];return n*(+E*e*h-T*r*h-E*y*a+x*r*a+T*y*l-x*e*l)+u*(+i*e*l-i*r*a+E*s*a-T*s*l+T*r*p-E*e*p)+f*(+i*r*h-i*y*l-E*s*h+x*s*l+E*y*p-x*r*p)+o*(-T*y*p-i*e*h+i*y*a+T*s*h-x*s*a+x*e*p)}transpose(){const t=this.elements;let i;return i=t[1],t[1]=t[4],t[4]=i,i=t[2],t[2]=t[8],t[8]=i,i=t[6],t[6]=t[9],t[9]=i,i=t[3],t[3]=t[12],t[12]=i,i=t[7],t[7]=t[13],t[13]=i,i=t[11],t[11]=t[14],t[14]=i,this}setPosition(t,i,x){const T=this.elements;return t.isVector3?(T[12]=t.x,T[13]=t.y,T[14]=t.z):(T[12]=t,T[13]=i,T[14]=x),this}invert(){const t=this.elements,i=t[0],x=t[1],T=t[2],E=t[3],s=t[4],y=t[5],e=t[6],r=t[7],p=t[8],h=t[9],a=t[10],l=t[11],n=t[12],u=t[13],f=t[14],o=t[15],c=h*f*r-u*a*r+u*e*l-y*f*l-h*e*o+y*a*o,d=n*a*r-p*f*r-n*e*l+s*f*l+p*e*o-s*a*o,v=p*u*r-n*h*r+n*y*l-s*u*l-p*y*o+s*h*o,m=n*h*e-p*u*e-n*y*a+s*u*a+p*y*f-s*h*f,S=i*c+x*d+T*v+E*m;if(S===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/S;return t[0]=c*M,t[1]=(u*a*E-h*f*E-u*T*l+x*f*l+h*T*o-x*a*o)*M,t[2]=(y*f*E-u*e*E+u*T*r-x*f*r-y*T*o+x*e*o)*M,t[3]=(h*e*E-y*a*E-h*T*r+x*a*r+y*T*l-x*e*l)*M,t[4]=d*M,t[5]=(p*f*E-n*a*E+n*T*l-i*f*l-p*T*o+i*a*o)*M,t[6]=(n*e*E-s*f*E-n*T*r+i*f*r+s*T*o-i*e*o)*M,t[7]=(s*a*E-p*e*E+p*T*r-i*a*r-s*T*l+i*e*l)*M,t[8]=v*M,t[9]=(n*h*E-p*u*E-n*x*l+i*u*l+p*x*o-i*h*o)*M,t[10]=(s*u*E-n*y*E+n*x*r-i*u*r-s*x*o+i*y*o)*M,t[11]=(p*y*E-s*h*E-p*x*r+i*h*r+s*x*l-i*y*l)*M,t[12]=m*M,t[13]=(p*u*T-n*h*T+n*x*a-i*u*a-p*x*f+i*h*f)*M,t[14]=(n*y*T-s*u*T-n*x*e+i*u*e+s*x*f-i*y*f)*M,t[15]=(s*h*T-p*y*T+p*x*e-i*h*e-s*x*a+i*y*a)*M,this}scale(t){const i=this.elements,x=t.x,T=t.y,E=t.z;return i[0]*=x,i[4]*=T,i[8]*=E,i[1]*=x,i[5]*=T,i[9]*=E,i[2]*=x,i[6]*=T,i[10]*=E,i[3]*=x,i[7]*=T,i[11]*=E,this}getMaxScaleOnAxis(){const t=this.elements,i=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],x=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],T=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(i,x,T))}makeTranslation(t,i,x){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,i,0,0,1,x,0,0,0,1),this}makeRotationX(t){const i=Math.cos(t),x=Math.sin(t);return this.set(1,0,0,0,0,i,-x,0,0,x,i,0,0,0,0,1),this}makeRotationY(t){const i=Math.cos(t),x=Math.sin(t);return this.set(i,0,x,0,0,1,0,0,-x,0,i,0,0,0,0,1),this}makeRotationZ(t){const i=Math.cos(t),x=Math.sin(t);return this.set(i,-x,0,0,x,i,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,i){const x=Math.cos(i),T=Math.sin(i),E=1-x,s=t.x,y=t.y,e=t.z,r=E*s,p=E*y;return this.set(r*s+x,r*y-T*e,r*e+T*y,0,r*y+T*e,p*y+x,p*e-T*s,0,r*e-T*y,p*e+T*s,E*e*e+x,0,0,0,0,1),this}makeScale(t,i,x){return this.set(t,0,0,0,0,i,0,0,0,0,x,0,0,0,0,1),this}makeShear(t,i,x,T,E,s){return this.set(1,x,E,0,t,1,s,0,i,T,1,0,0,0,0,1),this}compose(t,i,x){const T=this.elements,E=i._x,s=i._y,y=i._z,e=i._w,r=E+E,p=s+s,h=y+y,a=E*r,l=E*p,n=E*h,u=s*p,f=s*h,o=y*h,c=e*r,d=e*p,v=e*h,m=x.x,S=x.y,M=x.z;return T[0]=(1-(u+o))*m,T[1]=(l+v)*m,T[2]=(n-d)*m,T[3]=0,T[4]=(l-v)*S,T[5]=(1-(a+o))*S,T[6]=(f+c)*S,T[7]=0,T[8]=(n+d)*M,T[9]=(f-c)*M,T[10]=(1-(a+u))*M,T[11]=0,T[12]=t.x,T[13]=t.y,T[14]=t.z,T[15]=1,this}decompose(t,i,x){const T=this.elements;let E=cf.set(T[0],T[1],T[2]).length();const s=cf.set(T[4],T[5],T[6]).length(),y=cf.set(T[8],T[9],T[10]).length();this.determinant()<0&&(E=-E),t.x=T[12],t.y=T[13],t.z=T[14],$a.copy(this);const r=1/E,p=1/s,h=1/y;return $a.elements[0]*=r,$a.elements[1]*=r,$a.elements[2]*=r,$a.elements[4]*=p,$a.elements[5]*=p,$a.elements[6]*=p,$a.elements[8]*=h,$a.elements[9]*=h,$a.elements[10]*=h,i.setFromRotationMatrix($a),x.x=E,x.y=s,x.z=y,this}makePerspective(t,i,x,T,E,s,y=No){const e=this.elements,r=2*E/(i-t),p=2*E/(x-T),h=(i+t)/(i-t),a=(x+T)/(x-T);let l,n;if(y===No)l=-(s+E)/(s-E),n=-2*s*E/(s-E);else if(y===Od)l=-s/(s-E),n=-s*E/(s-E);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+y);return e[0]=r,e[4]=0,e[8]=h,e[12]=0,e[1]=0,e[5]=p,e[9]=a,e[13]=0,e[2]=0,e[6]=0,e[10]=l,e[14]=n,e[3]=0,e[7]=0,e[11]=-1,e[15]=0,this}makeOrthographic(t,i,x,T,E,s,y=No){const e=this.elements,r=1/(i-t),p=1/(x-T),h=1/(s-E),a=(i+t)*r,l=(x+T)*p;let n,u;if(y===No)n=(s+E)*h,u=-2*h;else if(y===Od)n=E*h,u=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+y);return e[0]=2*r,e[4]=0,e[8]=0,e[12]=-a,e[1]=0,e[5]=2*p,e[9]=0,e[13]=-l,e[2]=0,e[6]=0,e[10]=u,e[14]=-n,e[3]=0,e[7]=0,e[11]=0,e[15]=1,this}equals(t){const i=this.elements,x=t.elements;for(let T=0;T<16;T++)if(i[T]!==x[T])return!1;return!0}fromArray(t,i=0){for(let x=0;x<16;x++)this.elements[x]=t[x+i];return this}toArray(t=[],i=0){const x=this.elements;return t[i]=x[0],t[i+1]=x[1],t[i+2]=x[2],t[i+3]=x[3],t[i+4]=x[4],t[i+5]=x[5],t[i+6]=x[6],t[i+7]=x[7],t[i+8]=x[8],t[i+9]=x[9],t[i+10]=x[10],t[i+11]=x[11],t[i+12]=x[12],t[i+13]=x[13],t[i+14]=x[14],t[i+15]=x[15],t}}const cf=new Ct,$a=new ci,X5=new Ct(0,0,0),Y5=new Ct(1,1,1),eh=new Ct,ov=new Ct,qs=new Ct,LT=new ci,FT=new Ds;class qa{constructor(t=0,i=0,x=0,T=qa.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=i,this._z=x,this._order=T}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,i,x,T=this._order){return this._x=t,this._y=i,this._z=x,this._order=T,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,i=this._order,x=!0){const T=t.elements,E=T[0],s=T[4],y=T[8],e=T[1],r=T[5],p=T[9],h=T[2],a=T[6],l=T[10];switch(i){case"XYZ":this._y=Math.asin(jn(y,-1,1)),Math.abs(y)<.9999999?(this._x=Math.atan2(-p,l),this._z=Math.atan2(-s,E)):(this._x=Math.atan2(a,r),this._z=0);break;case"YXZ":this._x=Math.asin(-jn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(y,l),this._z=Math.atan2(e,r)):(this._y=Math.atan2(-h,E),this._z=0);break;case"ZXY":this._x=Math.asin(jn(a,-1,1)),Math.abs(a)<.9999999?(this._y=Math.atan2(-h,l),this._z=Math.atan2(-s,r)):(this._y=0,this._z=Math.atan2(e,E));break;case"ZYX":this._y=Math.asin(-jn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(a,l),this._z=Math.atan2(e,E)):(this._x=0,this._z=Math.atan2(-s,r));break;case"YZX":this._z=Math.asin(jn(e,-1,1)),Math.abs(e)<.9999999?(this._x=Math.atan2(-p,r),this._y=Math.atan2(-h,E)):(this._x=0,this._y=Math.atan2(y,l));break;case"XZY":this._z=Math.asin(-jn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(a,r),this._y=Math.atan2(y,E)):(this._x=Math.atan2(-p,l),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+i)}return this._order=i,x===!0&&this._onChangeCallback(),this}setFromQuaternion(t,i,x){return LT.makeRotationFromQuaternion(t),this.setFromRotationMatrix(LT,i,x)}setFromVector3(t,i=this._order){return this.set(t.x,t.y,t.z,i)}reorder(t){return FT.setFromEuler(this),this.setFromQuaternion(FT,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],i=0){return t[i]=this._x,t[i+1]=this._y,t[i+2]=this._z,t[i+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}qa.DEFAULT_ORDER="XYZ";class Tu{constructor(){this.mask=1}set(t){this.mask=(1<>>0}enable(t){this.mask|=1<1){for(let i=0;i1){for(let x=0;x0&&(T.userData=this.userData),T.layers=this.layers.mask,T.matrix=this.matrix.toArray(),T.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(T.matrixAutoUpdate=!1),this.isInstancedMesh&&(T.type="InstancedMesh",T.count=this.count,T.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(T.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(T.type="BatchedMesh",T.perObjectFrustumCulled=this.perObjectFrustumCulled,T.sortObjects=this.sortObjects,T.drawRanges=this._drawRanges,T.reservedRanges=this._reservedRanges,T.visibility=this._visibility,T.active=this._active,T.bounds=this._bounds.map(y=>({boxInitialized:y.boxInitialized,boxMin:y.box.min.toArray(),boxMax:y.box.max.toArray(),sphereInitialized:y.sphereInitialized,sphereRadius:y.sphere.radius,sphereCenter:y.sphere.center.toArray()})),T.maxGeometryCount=this._maxGeometryCount,T.maxVertexCount=this._maxVertexCount,T.maxIndexCount=this._maxIndexCount,T.geometryInitialized=this._geometryInitialized,T.geometryCount=this._geometryCount,T.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(T.boundingSphere={center:T.boundingSphere.center.toArray(),radius:T.boundingSphere.radius}),this.boundingBox!==null&&(T.boundingBox={min:T.boundingBox.min.toArray(),max:T.boundingBox.max.toArray()}));function E(y,e){return y[e.uuid]===void 0&&(y[e.uuid]=e.toJSON(t)),e.uuid}if(this.isScene)this.background&&(this.background.isColor?T.background=this.background.toJSON():this.background.isTexture&&(T.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(T.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){T.geometry=E(t.geometries,this.geometry);const y=this.geometry.parameters;if(y!==void 0&&y.shapes!==void 0){const e=y.shapes;if(Array.isArray(e))for(let r=0,p=e.length;r0){T.children=[];for(let y=0;y0){T.animations=[];for(let y=0;y0&&(x.geometries=y),e.length>0&&(x.materials=e),r.length>0&&(x.textures=r),p.length>0&&(x.images=p),h.length>0&&(x.shapes=h),a.length>0&&(x.skeletons=a),l.length>0&&(x.animations=l),n.length>0&&(x.nodes=n)}return x.object=T,x;function s(y){const e=[];for(const r in y){const p=y[r];delete p.metadata,e.push(p)}return e}}clone(t){return new this.constructor().copy(this,t)}copy(t,i=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),i===!0)for(let x=0;x0?T.multiplyScalar(1/Math.sqrt(E)):T.set(0,0,0)}static getBarycoord(t,i,x,T,E){Qa.subVectors(T,i),cl.subVectors(x,i),b0.subVectors(t,i);const s=Qa.dot(Qa),y=Qa.dot(cl),e=Qa.dot(b0),r=cl.dot(cl),p=cl.dot(b0),h=s*r-y*y;if(h===0)return E.set(0,0,0),null;const a=1/h,l=(r*e-y*p)*a,n=(s*p-y*e)*a;return E.set(1-l-n,n,l)}static containsPoint(t,i,x,T){return this.getBarycoord(t,i,x,T,dl)===null?!1:dl.x>=0&&dl.y>=0&&dl.x+dl.y<=1}static getInterpolation(t,i,x,T,E,s,y,e){return this.getBarycoord(t,i,x,T,dl)===null?(e.x=0,e.y=0,"z"in e&&(e.z=0),"w"in e&&(e.w=0),null):(e.setScalar(0),e.addScaledVector(E,dl.x),e.addScaledVector(s,dl.y),e.addScaledVector(y,dl.z),e)}static isFrontFacing(t,i,x,T){return Qa.subVectors(x,i),cl.subVectors(t,i),Qa.cross(cl).dot(T)<0}set(t,i,x){return this.a.copy(t),this.b.copy(i),this.c.copy(x),this}setFromPointsAndIndices(t,i,x,T){return this.a.copy(t[i]),this.b.copy(t[x]),this.c.copy(t[T]),this}setFromAttributeAndIndices(t,i,x,T){return this.a.fromBufferAttribute(t,i),this.b.fromBufferAttribute(t,x),this.c.fromBufferAttribute(t,T),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Qa.subVectors(this.c,this.b),cl.subVectors(this.a,this.b),Qa.cross(cl).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return ia.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,i){return ia.getBarycoord(t,this.a,this.b,this.c,i)}getInterpolation(t,i,x,T,E){return ia.getInterpolation(t,this.a,this.b,this.c,i,x,T,E)}containsPoint(t){return ia.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return ia.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,i){const x=this.a,T=this.b,E=this.c;let s,y;pf.subVectors(T,x),vf.subVectors(E,x),L0.subVectors(t,x);const e=pf.dot(L0),r=vf.dot(L0);if(e<=0&&r<=0)return i.copy(x);F0.subVectors(t,T);const p=pf.dot(F0),h=vf.dot(F0);if(p>=0&&h<=p)return i.copy(T);const a=e*h-p*r;if(a<=0&&e>=0&&p<=0)return s=e/(e-p),i.copy(x).addScaledVector(pf,s);O0.subVectors(t,E);const l=pf.dot(O0),n=vf.dot(O0);if(n>=0&&l<=n)return i.copy(E);const u=l*r-e*n;if(u<=0&&r>=0&&n<=0)return y=r/(r-n),i.copy(x).addScaledVector(vf,y);const f=p*n-l*h;if(f<=0&&h-p>=0&&l-n>=0)return BT.subVectors(E,T),y=(h-p)/(h-p+(l-n)),i.copy(T).addScaledVector(BT,y);const o=1/(f+u+a);return s=u*o,y=a*o,i.copy(x).addScaledVector(pf,s).addScaledVector(vf,y)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const dw={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ih={h:0,s:0,l:0},hv={h:0,s:0,l:0};function D0(g,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?g+(t-g)*6*i:i<1/2?t:i<2/3?g+(t-g)*6*(2/3-i):g}class ze{constructor(t,i,x){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,i,x)}set(t,i,x){if(i===void 0&&x===void 0){const T=t;T&&T.isColor?this.copy(T):typeof T=="number"?this.setHex(T):typeof T=="string"&&this.setStyle(T)}else this.setRGB(t,i,x);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,i=vr){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,rn.toWorkingColorSpace(this,i),this}setRGB(t,i,x,T=rn.workingColorSpace){return this.r=t,this.g=i,this.b=x,rn.toWorkingColorSpace(this,T),this}setHSL(t,i,x,T=rn.workingColorSpace){if(t=p1(t,1),i=jn(i,0,1),x=jn(x,0,1),i===0)this.r=this.g=this.b=x;else{const E=x<=.5?x*(1+i):x+i-x*i,s=2*x-E;this.r=D0(s,E,t+1/3),this.g=D0(s,E,t),this.b=D0(s,E,t-1/3)}return rn.toWorkingColorSpace(this,T),this}setStyle(t,i=vr){function x(E){E!==void 0&&parseFloat(E)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let T;if(T=/^(\w+)\(([^\)]*)\)/.exec(t)){let E;const s=T[1],y=T[2];switch(s){case"rgb":case"rgba":if(E=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(y))return x(E[4]),this.setRGB(Math.min(255,parseInt(E[1],10))/255,Math.min(255,parseInt(E[2],10))/255,Math.min(255,parseInt(E[3],10))/255,i);if(E=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(y))return x(E[4]),this.setRGB(Math.min(100,parseInt(E[1],10))/100,Math.min(100,parseInt(E[2],10))/100,Math.min(100,parseInt(E[3],10))/100,i);break;case"hsl":case"hsla":if(E=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(y))return x(E[4]),this.setHSL(parseFloat(E[1])/360,parseFloat(E[2])/100,parseFloat(E[3])/100,i);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(T=/^\#([A-Fa-f\d]+)$/.exec(t)){const E=T[1],s=E.length;if(s===3)return this.setRGB(parseInt(E.charAt(0),16)/15,parseInt(E.charAt(1),16)/15,parseInt(E.charAt(2),16)/15,i);if(s===6)return this.setHex(parseInt(E,16),i);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,i);return this}setColorName(t,i=vr){const x=dw[t.toLowerCase()];return x!==void 0?this.setHex(x,i):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Xf(t.r),this.g=Xf(t.g),this.b=Xf(t.b),this}copyLinearToSRGB(t){return this.r=T0(t.r),this.g=T0(t.g),this.b=T0(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=vr){return rn.fromWorkingColorSpace(Kr.copy(this),t),Math.round(jn(Kr.r*255,0,255))*65536+Math.round(jn(Kr.g*255,0,255))*256+Math.round(jn(Kr.b*255,0,255))}getHexString(t=vr){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,i=rn.workingColorSpace){rn.fromWorkingColorSpace(Kr.copy(this),i);const x=Kr.r,T=Kr.g,E=Kr.b,s=Math.max(x,T,E),y=Math.min(x,T,E);let e,r;const p=(y+s)/2;if(y===s)e=0,r=0;else{const h=s-y;switch(r=p<=.5?h/(s+y):h/(2-s-y),s){case x:e=(T-E)/h+(T0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const i in t){const x=t[i];if(x===void 0){console.warn(`THREE.Material: parameter '${i}' has value of undefined.`);continue}const T=this[i];if(T===void 0){console.warn(`THREE.Material: '${i}' is not a property of THREE.${this.type}.`);continue}T&&T.isColor?T.set(x):T&&T.isVector3&&x&&x.isVector3?T.copy(x):this[i]=x}}toJSON(t){const i=t===void 0||typeof t=="string";i&&(t={textures:{},images:{}});const x={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};x.uuid=this.uuid,x.type=this.type,this.name!==""&&(x.name=this.name),this.color&&this.color.isColor&&(x.color=this.color.getHex()),this.roughness!==void 0&&(x.roughness=this.roughness),this.metalness!==void 0&&(x.metalness=this.metalness),this.sheen!==void 0&&(x.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(x.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(x.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(x.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(x.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(x.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(x.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(x.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(x.shininess=this.shininess),this.clearcoat!==void 0&&(x.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(x.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(x.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(x.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(x.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,x.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(x.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(x.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(x.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(x.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(x.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(x.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(x.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(x.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(x.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(x.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(x.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(x.lightMap=this.lightMap.toJSON(t).uuid,x.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(x.aoMap=this.aoMap.toJSON(t).uuid,x.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(x.bumpMap=this.bumpMap.toJSON(t).uuid,x.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(x.normalMap=this.normalMap.toJSON(t).uuid,x.normalMapType=this.normalMapType,x.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(x.displacementMap=this.displacementMap.toJSON(t).uuid,x.displacementScale=this.displacementScale,x.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(x.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(x.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(x.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(x.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(x.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(x.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(x.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(x.combine=this.combine)),this.envMapIntensity!==void 0&&(x.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(x.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(x.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(x.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(x.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(x.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(x.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(x.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(x.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(x.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(x.size=this.size),this.shadowSide!==null&&(x.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(x.sizeAttenuation=this.sizeAttenuation),this.blending!==yu&&(x.blending=this.blending),this.side!==Cl&&(x.side=this.side),this.vertexColors===!0&&(x.vertexColors=!0),this.opacity<1&&(x.opacity=this.opacity),this.transparent===!0&&(x.transparent=!0),this.blendSrc!==ym&&(x.blendSrc=this.blendSrc),this.blendDst!==xm&&(x.blendDst=this.blendDst),this.blendEquation!==oh&&(x.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(x.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(x.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(x.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(x.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(x.blendAlpha=this.blendAlpha),this.depthFunc!==Sd&&(x.depthFunc=this.depthFunc),this.depthTest===!1&&(x.depthTest=this.depthTest),this.depthWrite===!1&&(x.depthWrite=this.depthWrite),this.colorWrite===!1&&(x.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(x.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==cx&&(x.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(x.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(x.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==hu&&(x.stencilFail=this.stencilFail),this.stencilZFail!==hu&&(x.stencilZFail=this.stencilZFail),this.stencilZPass!==hu&&(x.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(x.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(x.rotation=this.rotation),this.polygonOffset===!0&&(x.polygonOffset=!0),this.polygonOffsetFactor!==0&&(x.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(x.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(x.linewidth=this.linewidth),this.dashSize!==void 0&&(x.dashSize=this.dashSize),this.gapSize!==void 0&&(x.gapSize=this.gapSize),this.scale!==void 0&&(x.scale=this.scale),this.dithering===!0&&(x.dithering=!0),this.alphaTest>0&&(x.alphaTest=this.alphaTest),this.alphaHash===!0&&(x.alphaHash=!0),this.alphaToCoverage===!0&&(x.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(x.premultipliedAlpha=!0),this.forceSinglePass===!0&&(x.forceSinglePass=!0),this.wireframe===!0&&(x.wireframe=!0),this.wireframeLinewidth>1&&(x.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(x.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(x.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(x.flatShading=!0),this.visible===!1&&(x.visible=!1),this.toneMapped===!1&&(x.toneMapped=!1),this.fog===!1&&(x.fog=!1),Object.keys(this.userData).length>0&&(x.userData=this.userData);function T(E){const s=[];for(const y in E){const e=E[y];delete e.metadata,s.push(e)}return s}if(i){const E=T(t.textures),s=T(t.images);E.length>0&&(x.textures=E),s.length>0&&(x.images=s)}return x}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const i=t.clippingPlanes;let x=null;if(i!==null){const T=i.length;x=new Array(T);for(let E=0;E!==T;++E)x[E]=i[E].clone()}return this.clippingPlanes=x,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}}class xh extends Hr{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ze(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Zd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const ml=Q5();function Q5(){const g=new ArrayBuffer(4),t=new Float32Array(g),i=new Uint32Array(g),x=new Uint32Array(512),T=new Uint32Array(512);for(let e=0;e<256;++e){const r=e-127;r<-27?(x[e]=0,x[e|256]=32768,T[e]=24,T[e|256]=24):r<-14?(x[e]=1024>>-r-14,x[e|256]=1024>>-r-14|32768,T[e]=-r-1,T[e|256]=-r-1):r<=15?(x[e]=r+15<<10,x[e|256]=r+15<<10|32768,T[e]=13,T[e|256]=13):r<128?(x[e]=31744,x[e|256]=64512,T[e]=24,T[e|256]=24):(x[e]=31744,x[e|256]=64512,T[e]=13,T[e|256]=13)}const E=new Uint32Array(2048),s=new Uint32Array(64),y=new Uint32Array(64);for(let e=1;e<1024;++e){let r=e<<13,p=0;for(;!(r&8388608);)r<<=1,p-=8388608;r&=-8388609,p+=947912704,E[e]=r|p}for(let e=1024;e<2048;++e)E[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=1199570944,s[32]=2147483648;for(let e=33;e<63;++e)s[e]=2147483648+(e-32<<23);s[63]=3347054592;for(let e=1;e<64;++e)e!==32&&(y[e]=1024);return{floatView:t,uint32View:i,baseTable:x,shiftTable:T,mantissaTable:E,exponentTable:s,offsetTable:y}}function Os(g){Math.abs(g)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),g=jn(g,-65504,65504),ml.floatView[0]=g;const t=ml.uint32View[0],i=t>>23&511;return ml.baseTable[i]+((t&8388607)>>ml.shiftTable[i])}function nd(g){const t=g>>10;return ml.uint32View[0]=ml.mantissaTable[ml.offsetTable[t]+(g&1023)]+ml.exponentTable[t],ml.floatView[0]}const _5={toHalfFloat:Os,fromHalfFloat:nd},ur=new Ct,uv=new ve;class an{constructor(t,i,x=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=i,this.count=t!==void 0?t.length/i:0,this.normalized=x,this.usage=Fd,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Ea,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return Su("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,i){this.updateRanges.push({start:t,count:i})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,i,x){t*=this.itemSize,x*=i.itemSize;for(let T=0,E=this.itemSize;T0&&(t.userData=this.userData),this.parameters!==void 0){const e=this.parameters;for(const r in e)e[r]!==void 0&&(t[r]=e[r]);return t}t.data={attributes:{}};const i=this.index;i!==null&&(t.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});const x=this.attributes;for(const e in x){const r=x[e];t.data.attributes[e]=r.toJSON(t.data)}const T={};let E=!1;for(const e in this.morphAttributes){const r=this.morphAttributes[e],p=[];for(let h=0,a=r.length;h0&&(T[e]=p,E=!0)}E&&(t.data.morphAttributes=T,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const y=this.boundingSphere;return y!==null&&(t.data.boundingSphere={center:y.center.toArray(),radius:y.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const i={};this.name=t.name;const x=t.index;x!==null&&this.setIndex(x.clone(i));const T=t.attributes;for(const r in T){const p=T[r];this.setAttribute(r,p.clone(i))}const E=t.morphAttributes;for(const r in E){const p=[],h=E[r];for(let a=0,l=h.length;a0){const T=i[x[0]];if(T!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let E=0,s=T.length;E(t.far-t.near)**2))&&(UT.copy(E).invert(),_h.copy(t.ray).applyMatrix4(UT),!(x.boundingBox!==null&&_h.intersectsBox(x.boundingBox)===!1)&&this._computeIntersections(t,i,_h)))}_computeIntersections(t,i,x){let T;const E=this.geometry,s=this.material,y=E.index,e=E.attributes.position,r=E.attributes.uv,p=E.attributes.uv1,h=E.attributes.normal,a=E.groups,l=E.drawRange;if(y!==null)if(Array.isArray(s))for(let n=0,u=a.length;ni.far?null:{distance:r,point:gv.clone(),object:g}}function yv(g,t,i,x,T,E,s,y,e,r){g.getVertexPosition(y,gf),g.getVertexPosition(e,yf),g.getVertexPosition(r,xf);const p=oN(g,t,i,x,gf,yf,xf,mv);if(p){T&&(dv.fromBufferAttribute(T,y),pv.fromBufferAttribute(T,e),vv.fromBufferAttribute(T,r),p.uv=ia.getInterpolation(mv,gf,yf,xf,dv,pv,vv,new ve)),E&&(dv.fromBufferAttribute(E,y),pv.fromBufferAttribute(E,e),vv.fromBufferAttribute(E,r),p.uv1=ia.getInterpolation(mv,gf,yf,xf,dv,pv,vv,new ve),p.uv2=p.uv1),s&&(GT.fromBufferAttribute(s,y),VT.fromBufferAttribute(s,e),HT.fromBufferAttribute(s,r),p.normal=ia.getInterpolation(mv,gf,yf,xf,GT,VT,HT,new Ct),p.normal.dot(x.direction)>0&&p.normal.multiplyScalar(-1));const h={a:y,b:e,c:r,normal:new Ct,materialIndex:0};ia.getNormal(gf,yf,xf,h.normal),p.face=h}return p}class Ou extends Li{constructor(t=1,i=1,x=1,T=1,E=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:i,depth:x,widthSegments:T,heightSegments:E,depthSegments:s};const y=this;T=Math.floor(T),E=Math.floor(E),s=Math.floor(s);const e=[],r=[],p=[],h=[];let a=0,l=0;n("z","y","x",-1,-1,x,i,t,s,E,0),n("z","y","x",1,-1,x,i,-t,s,E,1),n("x","z","y",1,1,t,x,i,T,s,2),n("x","z","y",1,-1,t,x,-i,T,s,3),n("x","y","z",1,-1,t,i,x,T,E,4),n("x","y","z",-1,-1,t,i,-x,T,E,5),this.setIndex(e),this.setAttribute("position",new ke(r,3)),this.setAttribute("normal",new ke(p,3)),this.setAttribute("uv",new ke(h,2));function n(u,f,o,c,d,v,m,S,M,w,C){const A=v/M,P=m/w,b=v/2,O=m/2,I=S/2,D=M+1,B=w+1;let G=0,z=0;const X=new Ct;for(let K=0;K0?1:-1,p.push(X.x,X.y,X.z),h.push(tt/M),h.push(1-K/w),G+=1}}for(let K=0;K>8&255]+kr[g>>16&255]+kr[g>>24&255]+"-"+kr[t&255]+kr[t>>8&255]+"-"+kr[t>>16&15|64]+kr[t>>24&255]+"-"+kr[i&63|128]+kr[i>>8&255]+"-"+kr[i>>16&255]+kr[i>>24&255]+kr[x&255]+kr[x>>8&255]+kr[x>>16&255]+kr[x>>24&255]).toLowerCase()}function Kn(g,t,i){return Math.max(t,Math.min(i,g))}function p1(g,t){return(g%t+t)%t}function M5(g,t,i,x,T){return x+(g-t)*(T-x)/(i-t)}function C5(g,t,i){return g!==t?(i-g)/(t-g):0}function fd(g,t,i){return(1-i)*g+i*t}function w5(g,t,i,x){return fd(g,t,1-Math.exp(-i*x))}function A5(g,t=1){return t-Math.abs(p1(g,t*2)-t)}function P5(g,t,i){return g<=t?0:g>=i?1:(g=(g-t)/(i-t),g*g*(3-2*g))}function R5(g,t,i){return g<=t?0:g>=i?1:(g=(g-t)/(i-t),g*g*g*(g*(g*6-15)+10))}function b5(g,t){return g+Math.floor(Math.random()*(t-g+1))}function L5(g,t){return g+Math.random()*(t-g)}function F5(g){return g*(.5-Math.random())}function O5(g){g!==void 0&&(CT=g);let t=CT+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function D5(g){return g*yu}function I5(g){return g*Jf}function vx(g){return(g&g-1)===0&&g!==0}function N5(g){return Math.pow(2,Math.ceil(Math.log(g)/Math.LN2))}function Em(g){return Math.pow(2,Math.floor(Math.log(g)/Math.LN2))}function B5(g,t,i,x,T){const E=Math.cos,s=Math.sin,y=E(i/2),e=s(i/2),r=E((t+x)/2),p=s((t+x)/2),h=E((t-x)/2),a=s((t-x)/2),l=E((x-t)/2),n=s((x-t)/2);switch(T){case"XYX":g.set(y*p,e*h,e*a,y*r);break;case"YZY":g.set(e*a,y*p,e*h,y*r);break;case"ZXZ":g.set(e*h,e*a,y*p,y*r);break;case"XZX":g.set(y*p,e*n,e*l,y*r);break;case"YXY":g.set(e*l,y*p,e*n,y*r);break;case"ZYZ":g.set(e*n,e*l,y*p,y*r);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+T)}}function vs(g,t){switch(t.constructor){case Float32Array:return g;case Uint32Array:return g/4294967295;case Uint16Array:return g/65535;case Uint8Array:return g/255;case Int32Array:return Math.max(g/2147483647,-1);case Int16Array:return Math.max(g/32767,-1);case Int8Array:return Math.max(g/127,-1);default:throw new Error("Invalid component type.")}}function Ai(g,t){switch(t.constructor){case Float32Array:return g;case Uint32Array:return Math.round(g*4294967295);case Uint16Array:return Math.round(g*65535);case Uint8Array:return Math.round(g*255);case Int32Array:return Math.round(g*2147483647);case Int16Array:return Math.round(g*32767);case Int8Array:return Math.round(g*127);default:throw new Error("Invalid component type.")}}const lm={DEG2RAD:yu,RAD2DEG:Jf,generateUUID:na,clamp:Kn,euclideanModulo:p1,mapLinear:M5,inverseLerp:C5,lerp:fd,damp:w5,pingpong:A5,smoothstep:P5,smootherstep:R5,randInt:b5,randFloat:L5,randFloatSpread:F5,seededRandom:O5,degToRad:D5,radToDeg:I5,isPowerOfTwo:vx,ceilPowerOfTwo:N5,floorPowerOfTwo:Em,setQuaternionFromProperEuler:B5,normalize:Ai,denormalize:vs};class ve{constructor(t=0,i=0){ve.prototype.isVector2=!0,this.x=t,this.y=i}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,i){return this.x=t,this.y=i,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,i){switch(t){case 0:this.x=i;break;case 1:this.y=i;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,i){return this.x=t.x+i.x,this.y=t.y+i.y,this}addScaledVector(t,i){return this.x+=t.x*i,this.y+=t.y*i,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,i){return this.x=t.x-i.x,this.y=t.y-i.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const i=this.x,x=this.y,T=t.elements;return this.x=T[0]*i+T[3]*x+T[6],this.y=T[1]*i+T[4]*x+T[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this}clampScalar(t,i){return this.x=Math.max(t,Math.min(i,this.x)),this.y=Math.max(t,Math.min(i,this.y)),this}clampLength(t,i){const x=this.length();return this.divideScalar(x||1).multiplyScalar(Math.max(t,Math.min(i,x)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const i=Math.sqrt(this.lengthSq()*t.lengthSq());if(i===0)return Math.PI/2;const x=this.dot(t)/i;return Math.acos(Kn(x,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const i=this.x-t.x,x=this.y-t.y;return i*i+x*x}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this}lerpVectors(t,i,x){return this.x=t.x+(i.x-t.x)*x,this.y=t.y+(i.y-t.y)*x,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,i=0){return this.x=t[i],this.y=t[i+1],this}toArray(t=[],i=0){return t[i]=this.x,t[i+1]=this.y,t}fromBufferAttribute(t,i){return this.x=t.getX(i),this.y=t.getY(i),this}rotateAround(t,i){const x=Math.cos(i),T=Math.sin(i),E=this.x-t.x,s=this.y-t.y;return this.x=E*x-s*T+t.x,this.y=E*T+s*x+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Oi{constructor(t,i,x,T,E,s,y,e,r){Oi.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,i,x,T,E,s,y,e,r)}set(t,i,x,T,E,s,y,e,r){const p=this.elements;return p[0]=t,p[1]=T,p[2]=y,p[3]=i,p[4]=E,p[5]=e,p[6]=x,p[7]=s,p[8]=r,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const i=this.elements,x=t.elements;return i[0]=x[0],i[1]=x[1],i[2]=x[2],i[3]=x[3],i[4]=x[4],i[5]=x[5],i[6]=x[6],i[7]=x[7],i[8]=x[8],this}extractBasis(t,i,x){return t.setFromMatrix3Column(this,0),i.setFromMatrix3Column(this,1),x.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const i=t.elements;return this.set(i[0],i[4],i[8],i[1],i[5],i[9],i[2],i[6],i[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,i){const x=t.elements,T=i.elements,E=this.elements,s=x[0],y=x[3],e=x[6],r=x[1],p=x[4],h=x[7],a=x[2],l=x[5],n=x[8],u=T[0],f=T[3],o=T[6],c=T[1],d=T[4],v=T[7],m=T[2],S=T[5],M=T[8];return E[0]=s*u+y*c+e*m,E[3]=s*f+y*d+e*S,E[6]=s*o+y*v+e*M,E[1]=r*u+p*c+h*m,E[4]=r*f+p*d+h*S,E[7]=r*o+p*v+h*M,E[2]=a*u+l*c+n*m,E[5]=a*f+l*d+n*S,E[8]=a*o+l*v+n*M,this}multiplyScalar(t){const i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=t,i[4]*=t,i[7]*=t,i[2]*=t,i[5]*=t,i[8]*=t,this}determinant(){const t=this.elements,i=t[0],x=t[1],T=t[2],E=t[3],s=t[4],y=t[5],e=t[6],r=t[7],p=t[8];return i*s*p-i*y*r-x*E*p+x*y*e+T*E*r-T*s*e}invert(){const t=this.elements,i=t[0],x=t[1],T=t[2],E=t[3],s=t[4],y=t[5],e=t[6],r=t[7],p=t[8],h=p*s-y*r,a=y*e-p*E,l=r*E-s*e,n=i*h+x*a+T*l;if(n===0)return this.set(0,0,0,0,0,0,0,0,0);const u=1/n;return t[0]=h*u,t[1]=(T*r-p*x)*u,t[2]=(y*x-T*s)*u,t[3]=a*u,t[4]=(p*i-T*e)*u,t[5]=(T*E-y*i)*u,t[6]=l*u,t[7]=(x*e-r*i)*u,t[8]=(s*i-x*E)*u,this}transpose(){let t;const i=this.elements;return t=i[1],i[1]=i[3],i[3]=t,t=i[2],i[2]=i[6],i[6]=t,t=i[5],i[5]=i[7],i[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const i=this.elements;return t[0]=i[0],t[1]=i[3],t[2]=i[6],t[3]=i[1],t[4]=i[4],t[5]=i[7],t[6]=i[2],t[7]=i[5],t[8]=i[8],this}setUvTransform(t,i,x,T,E,s,y){const e=Math.cos(E),r=Math.sin(E);return this.set(x*e,x*r,-x*(e*s+r*y)+s+t,-T*r,T*e,-T*(-r*s+e*y)+y+i,0,0,1),this}scale(t,i){return this.premultiply(T0.makeScale(t,i)),this}rotate(t){return this.premultiply(T0.makeRotation(-t)),this}translate(t,i){return this.premultiply(T0.makeTranslation(t,i)),this}makeTranslation(t,i){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,i,0,0,1),this}makeRotation(t){const i=Math.cos(t),x=Math.sin(t);return this.set(i,-x,0,x,i,0,0,0,1),this}makeScale(t,i){return this.set(t,0,0,0,i,0,0,0,1),this}equals(t){const i=this.elements,x=t.elements;for(let T=0;T<9;T++)if(i[T]!==x[T])return!1;return!0}fromArray(t,i=0){for(let x=0;x<9;x++)this.elements[x]=t[x+i];return this}toArray(t=[],i=0){const x=this.elements;return t[i]=x[0],t[i+1]=x[1],t[i+2]=x[2],t[i+3]=x[3],t[i+4]=x[4],t[i+5]=x[5],t[i+6]=x[6],t[i+7]=x[7],t[i+8]=x[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const T0=new Oi;function fw(g){for(let t=g.length-1;t>=0;--t)if(g[t]>=65535)return!0;return!1}const U5={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Bf(g,t){return new U5[g](t)}function Id(g){return document.createElementNS("http://www.w3.org/1999/xhtml",g)}function cw(){const g=Id("canvas");return g.style.display="block",g}const wT={};function xu(g){g in wT||(wT[g]=!0,console.warn(g))}const AT=new Oi().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),PT=new Oi().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),iv={[Vo]:{transfer:bd,primaries:Ld,toReference:g=>g,fromReference:g=>g},[vr]:{transfer:vn,primaries:Ld,toReference:g=>g.convertSRGBToLinear(),fromReference:g=>g.convertLinearToSRGB()},[$d]:{transfer:bd,primaries:Fd,toReference:g=>g.applyMatrix3(PT),fromReference:g=>g.applyMatrix3(AT)},[hg]:{transfer:vn,primaries:Fd,toReference:g=>g.convertSRGBToLinear().applyMatrix3(PT),fromReference:g=>g.applyMatrix3(AT).convertLinearToSRGB()}},z5=new Set([Vo,$d]),rn={enabled:!0,_workingColorSpace:Vo,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(g){if(!z5.has(g))throw new Error(`Unsupported working color space, "${g}".`);this._workingColorSpace=g},convert:function(g,t,i){if(this.enabled===!1||t===i||!t||!i)return g;const x=iv[t].toReference,T=iv[i].fromReference;return T(x(g))},fromWorkingColorSpace:function(g,t){return this.convert(g,this._workingColorSpace,t)},toWorkingColorSpace:function(g,t){return this.convert(g,t,this._workingColorSpace)},getPrimaries:function(g){return iv[g].primaries},getTransfer:function(g){return g===ea?bd:iv[g].transfer}};function Xf(g){return g<.04045?g*.0773993808:Math.pow(g*.9478672986+.0521327014,2.4)}function E0(g){return g<.0031308?g*12.92:1.055*Math.pow(g,.41666)-.055}let of;class v1{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{of===void 0&&(of=Id("canvas")),of.width=t.width,of.height=t.height;const x=of.getContext("2d");t instanceof ImageData?x.putImageData(t,0,0):x.drawImage(t,0,0,t.width,t.height),i=of}return i.width>2048||i.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),i.toDataURL("image/jpeg",.6)):i.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const i=Id("canvas");i.width=t.width,i.height=t.height;const x=i.getContext("2d");x.drawImage(t,0,0,t.width,t.height);const T=x.getImageData(0,0,t.width,t.height),E=T.data;for(let s=0;s0&&(x.userData=this.userData),i||(t.textures[this.uuid]=x),x}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==ag)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Cd:t.x=t.x-Math.floor(t.x);break;case Jr:t.x=t.x<0?0:1;break;case wd:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Cd:t.y=t.y-Math.floor(t.y);break;case Jr:t.y=t.y<0?0:1;break;case wd:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return xu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===vr?ch:c1}set encoding(t){xu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===ch?vr:ea}}Un.DEFAULT_IMAGE=null;Un.DEFAULT_MAPPING=ag;Un.DEFAULT_ANISOTROPY=1;class sn{constructor(t=0,i=0,x=0,T=1){sn.prototype.isVector4=!0,this.x=t,this.y=i,this.z=x,this.w=T}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,i,x,T){return this.x=t,this.y=i,this.z=x,this.w=T,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,i){switch(t){case 0:this.x=i;break;case 1:this.y=i;break;case 2:this.z=i;break;case 3:this.w=i;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,i){return this.x=t.x+i.x,this.y=t.y+i.y,this.z=t.z+i.z,this.w=t.w+i.w,this}addScaledVector(t,i){return this.x+=t.x*i,this.y+=t.y*i,this.z+=t.z*i,this.w+=t.w*i,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,i){return this.x=t.x-i.x,this.y=t.y-i.y,this.z=t.z-i.z,this.w=t.w-i.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const i=this.x,x=this.y,T=this.z,E=this.w,s=t.elements;return this.x=s[0]*i+s[4]*x+s[8]*T+s[12]*E,this.y=s[1]*i+s[5]*x+s[9]*T+s[13]*E,this.z=s[2]*i+s[6]*x+s[10]*T+s[14]*E,this.w=s[3]*i+s[7]*x+s[11]*T+s[15]*E,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const i=Math.sqrt(1-t.w*t.w);return i<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/i,this.y=t.y/i,this.z=t.z/i),this}setAxisAngleFromRotationMatrix(t){let i,x,T,E;const e=t.elements,r=e[0],p=e[4],h=e[8],a=e[1],l=e[5],n=e[9],u=e[2],f=e[6],o=e[10];if(Math.abs(p-a)<.01&&Math.abs(h-u)<.01&&Math.abs(n-f)<.01){if(Math.abs(p+a)<.1&&Math.abs(h+u)<.1&&Math.abs(n+f)<.1&&Math.abs(r+l+o-3)<.1)return this.set(1,0,0,0),this;i=Math.PI;const d=(r+1)/2,v=(l+1)/2,m=(o+1)/2,S=(p+a)/4,M=(h+u)/4,w=(n+f)/4;return d>v&&d>m?d<.01?(x=0,T=.707106781,E=.707106781):(x=Math.sqrt(d),T=S/x,E=M/x):v>m?v<.01?(x=.707106781,T=0,E=.707106781):(T=Math.sqrt(v),x=S/T,E=w/T):m<.01?(x=.707106781,T=.707106781,E=0):(E=Math.sqrt(m),x=M/E,T=w/E),this.set(x,T,E,i),this}let c=Math.sqrt((f-n)*(f-n)+(h-u)*(h-u)+(a-p)*(a-p));return Math.abs(c)<.001&&(c=1),this.x=(f-n)/c,this.y=(h-u)/c,this.z=(a-p)/c,this.w=Math.acos((r+l+o-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this.z=Math.max(t.z,Math.min(i.z,this.z)),this.w=Math.max(t.w,Math.min(i.w,this.w)),this}clampScalar(t,i){return this.x=Math.max(t,Math.min(i,this.x)),this.y=Math.max(t,Math.min(i,this.y)),this.z=Math.max(t,Math.min(i,this.z)),this.w=Math.max(t,Math.min(i,this.w)),this}clampLength(t,i){const x=this.length();return this.divideScalar(x||1).multiplyScalar(Math.max(t,Math.min(i,x)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this.z+=(t.z-this.z)*i,this.w+=(t.w-this.w)*i,this}lerpVectors(t,i,x){return this.x=t.x+(i.x-t.x)*x,this.y=t.y+(i.y-t.y)*x,this.z=t.z+(i.z-t.z)*x,this.w=t.w+(i.w-t.w)*x,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,i=0){return this.x=t[i],this.y=t[i+1],this.z=t[i+2],this.w=t[i+3],this}toArray(t=[],i=0){return t[i]=this.x,t[i+1]=this.y,t[i+2]=this.z,t[i+3]=this.w,t}fromBufferAttribute(t,i){return this.x=t.getX(i),this.y=t.getY(i),this.z=t.getZ(i),this.w=t.getW(i),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class dw extends Pl{constructor(t=1,i=1,x={}){super(),this.isRenderTarget=!0,this.width=t,this.height=i,this.depth=1,this.scissor=new sn(0,0,t,i),this.scissorTest=!1,this.viewport=new sn(0,0,t,i);const T={width:t,height:i,depth:1};x.encoding!==void 0&&(xu("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),x.colorSpace=x.encoding===ch?vr:ea),x=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Nn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},x),this.texture=new Un(T,x.mapping,x.wrapS,x.wrapT,x.magFilter,x.minFilter,x.format,x.type,x.anisotropy,x.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=x.generateMipmaps,this.texture.internalFormat=x.internalFormat,this.depthBuffer=x.depthBuffer,this.stencilBuffer=x.stencilBuffer,this.depthTexture=x.depthTexture,this.samples=x.samples}setSize(t,i,x=1){(this.width!==t||this.height!==i||this.depth!==x)&&(this.width=t,this.height=i,this.depth=x,this.texture.image.width=t,this.texture.image.height=i,this.texture.image.depth=x,this.dispose()),this.viewport.set(0,0,t,i),this.scissor.set(0,0,t,i)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;const i=Object.assign({},t.texture.image);return this.texture.source=new vu(i),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class io extends dw{constructor(t=1,i=1,x={}){super(t,i,x),this.isWebGLRenderTarget=!0}}class ug extends Un{constructor(t=null,i=1,x=1,T=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:i,height:x,depth:T},this.magFilter=nr,this.minFilter=nr,this.wrapR=Jr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class H5 extends io{constructor(t=1,i=1,x=1,T={}){super(t,i,T),this.isWebGLArrayRenderTarget=!0,this.depth=x,this.texture=new ug(null,t,i,x),this.texture.isRenderTargetTexture=!0}}class m1 extends Un{constructor(t=null,i=1,x=1,T=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:i,height:x,depth:T},this.magFilter=nr,this.minFilter=nr,this.wrapR=Jr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class W5 extends io{constructor(t=1,i=1,x=1,T={}){super(t,i,T),this.isWebGL3DRenderTarget=!0,this.depth=x,this.texture=new m1(null,t,i,x),this.texture.isRenderTargetTexture=!0}}class X5 extends io{constructor(t=1,i=1,x=1,T={}){super(t,i,T),this.isWebGLMultipleRenderTargets=!0;const E=this.texture;this.texture=[];for(let s=0;s=0?1:-1,d=1-o*o;if(d>Number.EPSILON){const m=Math.sqrt(d),S=Math.atan2(m,o*c);f=Math.sin(f*S)/m,y=Math.sin(y*S)/m}const v=y*c;if(e=e*f+a*v,r=r*f+l*v,p=p*f+n*v,h=h*f+u*v,f===1-y){const m=1/Math.sqrt(e*e+r*r+p*p+h*h);e*=m,r*=m,p*=m,h*=m}}t[i]=e,t[i+1]=r,t[i+2]=p,t[i+3]=h}static multiplyQuaternionsFlat(t,i,x,T,E,s){const y=x[T],e=x[T+1],r=x[T+2],p=x[T+3],h=E[s],a=E[s+1],l=E[s+2],n=E[s+3];return t[i]=y*n+p*h+e*l-r*a,t[i+1]=e*n+p*a+r*h-y*l,t[i+2]=r*n+p*l+y*a-e*h,t[i+3]=p*n-y*h-e*a-r*l,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,i,x,T){return this._x=t,this._y=i,this._z=x,this._w=T,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,i=!0){const x=t._x,T=t._y,E=t._z,s=t._order,y=Math.cos,e=Math.sin,r=y(x/2),p=y(T/2),h=y(E/2),a=e(x/2),l=e(T/2),n=e(E/2);switch(s){case"XYZ":this._x=a*p*h+r*l*n,this._y=r*l*h-a*p*n,this._z=r*p*n+a*l*h,this._w=r*p*h-a*l*n;break;case"YXZ":this._x=a*p*h+r*l*n,this._y=r*l*h-a*p*n,this._z=r*p*n-a*l*h,this._w=r*p*h+a*l*n;break;case"ZXY":this._x=a*p*h-r*l*n,this._y=r*l*h+a*p*n,this._z=r*p*n+a*l*h,this._w=r*p*h-a*l*n;break;case"ZYX":this._x=a*p*h-r*l*n,this._y=r*l*h+a*p*n,this._z=r*p*n-a*l*h,this._w=r*p*h+a*l*n;break;case"YZX":this._x=a*p*h+r*l*n,this._y=r*l*h+a*p*n,this._z=r*p*n-a*l*h,this._w=r*p*h-a*l*n;break;case"XZY":this._x=a*p*h-r*l*n,this._y=r*l*h-a*p*n,this._z=r*p*n+a*l*h,this._w=r*p*h+a*l*n;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return i===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,i){const x=i/2,T=Math.sin(x);return this._x=t.x*T,this._y=t.y*T,this._z=t.z*T,this._w=Math.cos(x),this._onChangeCallback(),this}setFromRotationMatrix(t){const i=t.elements,x=i[0],T=i[4],E=i[8],s=i[1],y=i[5],e=i[9],r=i[2],p=i[6],h=i[10],a=x+y+h;if(a>0){const l=.5/Math.sqrt(a+1);this._w=.25/l,this._x=(p-e)*l,this._y=(E-r)*l,this._z=(s-T)*l}else if(x>y&&x>h){const l=2*Math.sqrt(1+x-y-h);this._w=(p-e)/l,this._x=.25*l,this._y=(T+s)/l,this._z=(E+r)/l}else if(y>h){const l=2*Math.sqrt(1+y-x-h);this._w=(E-r)/l,this._x=(T+s)/l,this._y=.25*l,this._z=(e+p)/l}else{const l=2*Math.sqrt(1+h-x-y);this._w=(s-T)/l,this._x=(E+r)/l,this._y=(e+p)/l,this._z=.25*l}return this._onChangeCallback(),this}setFromUnitVectors(t,i){let x=t.dot(i)+1;return xMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=x):(this._x=0,this._y=-t.z,this._z=t.y,this._w=x)):(this._x=t.y*i.z-t.z*i.y,this._y=t.z*i.x-t.x*i.z,this._z=t.x*i.y-t.y*i.x,this._w=x),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Kn(this.dot(t),-1,1)))}rotateTowards(t,i){const x=this.angleTo(t);if(x===0)return this;const T=Math.min(1,i/x);return this.slerp(t,T),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,i){const x=t._x,T=t._y,E=t._z,s=t._w,y=i._x,e=i._y,r=i._z,p=i._w;return this._x=x*p+s*y+T*r-E*e,this._y=T*p+s*e+E*y-x*r,this._z=E*p+s*r+x*e-T*y,this._w=s*p-x*y-T*e-E*r,this._onChangeCallback(),this}slerp(t,i){if(i===0)return this;if(i===1)return this.copy(t);const x=this._x,T=this._y,E=this._z,s=this._w;let y=s*t._w+x*t._x+T*t._y+E*t._z;if(y<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,y=-y):this.copy(t),y>=1)return this._w=s,this._x=x,this._y=T,this._z=E,this;const e=1-y*y;if(e<=Number.EPSILON){const l=1-i;return this._w=l*s+i*this._w,this._x=l*x+i*this._x,this._y=l*T+i*this._y,this._z=l*E+i*this._z,this.normalize(),this}const r=Math.sqrt(e),p=Math.atan2(r,y),h=Math.sin((1-i)*p)/r,a=Math.sin(i*p)/r;return this._w=s*h+this._w*a,this._x=x*h+this._x*a,this._y=T*h+this._y*a,this._z=E*h+this._z*a,this._onChangeCallback(),this}slerpQuaternions(t,i,x){return this.copy(t).slerp(i,x)}random(){const t=Math.random(),i=Math.sqrt(1-t),x=Math.sqrt(t),T=2*Math.PI*Math.random(),E=2*Math.PI*Math.random();return this.set(i*Math.cos(T),x*Math.sin(E),x*Math.cos(E),i*Math.sin(T))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,i=0){return this._x=t[i],this._y=t[i+1],this._z=t[i+2],this._w=t[i+3],this._onChangeCallback(),this}toArray(t=[],i=0){return t[i]=this._x,t[i+1]=this._y,t[i+2]=this._z,t[i+3]=this._w,t}fromBufferAttribute(t,i){return this._x=t.getX(i),this._y=t.getY(i),this._z=t.getZ(i),this._w=t.getW(i),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Ct{constructor(t=0,i=0,x=0){Ct.prototype.isVector3=!0,this.x=t,this.y=i,this.z=x}set(t,i,x){return x===void 0&&(x=this.z),this.x=t,this.y=i,this.z=x,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,i){switch(t){case 0:this.x=i;break;case 1:this.y=i;break;case 2:this.z=i;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,i){return this.x=t.x+i.x,this.y=t.y+i.y,this.z=t.z+i.z,this}addScaledVector(t,i){return this.x+=t.x*i,this.y+=t.y*i,this.z+=t.z*i,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,i){return this.x=t.x-i.x,this.y=t.y-i.y,this.z=t.z-i.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,i){return this.x=t.x*i.x,this.y=t.y*i.y,this.z=t.z*i.z,this}applyEuler(t){return this.applyQuaternion(RT.setFromEuler(t))}applyAxisAngle(t,i){return this.applyQuaternion(RT.setFromAxisAngle(t,i))}applyMatrix3(t){const i=this.x,x=this.y,T=this.z,E=t.elements;return this.x=E[0]*i+E[3]*x+E[6]*T,this.y=E[1]*i+E[4]*x+E[7]*T,this.z=E[2]*i+E[5]*x+E[8]*T,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const i=this.x,x=this.y,T=this.z,E=t.elements,s=1/(E[3]*i+E[7]*x+E[11]*T+E[15]);return this.x=(E[0]*i+E[4]*x+E[8]*T+E[12])*s,this.y=(E[1]*i+E[5]*x+E[9]*T+E[13])*s,this.z=(E[2]*i+E[6]*x+E[10]*T+E[14])*s,this}applyQuaternion(t){const i=this.x,x=this.y,T=this.z,E=t.x,s=t.y,y=t.z,e=t.w,r=2*(s*T-y*x),p=2*(y*i-E*T),h=2*(E*x-s*i);return this.x=i+e*r+s*h-y*p,this.y=x+e*p+y*r-E*h,this.z=T+e*h+E*p-s*r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const i=this.x,x=this.y,T=this.z,E=t.elements;return this.x=E[0]*i+E[4]*x+E[8]*T,this.y=E[1]*i+E[5]*x+E[9]*T,this.z=E[2]*i+E[6]*x+E[10]*T,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this.z=Math.max(t.z,Math.min(i.z,this.z)),this}clampScalar(t,i){return this.x=Math.max(t,Math.min(i,this.x)),this.y=Math.max(t,Math.min(i,this.y)),this.z=Math.max(t,Math.min(i,this.z)),this}clampLength(t,i){const x=this.length();return this.divideScalar(x||1).multiplyScalar(Math.max(t,Math.min(i,x)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this.z+=(t.z-this.z)*i,this}lerpVectors(t,i,x){return this.x=t.x+(i.x-t.x)*x,this.y=t.y+(i.y-t.y)*x,this.z=t.z+(i.z-t.z)*x,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,i){const x=t.x,T=t.y,E=t.z,s=i.x,y=i.y,e=i.z;return this.x=T*e-E*y,this.y=E*s-x*e,this.z=x*y-T*s,this}projectOnVector(t){const i=t.lengthSq();if(i===0)return this.set(0,0,0);const x=t.dot(this)/i;return this.copy(t).multiplyScalar(x)}projectOnPlane(t){return C0.copy(this).projectOnVector(t),this.sub(C0)}reflect(t){return this.sub(C0.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const i=Math.sqrt(this.lengthSq()*t.lengthSq());if(i===0)return Math.PI/2;const x=this.dot(t)/i;return Math.acos(Kn(x,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const i=this.x-t.x,x=this.y-t.y,T=this.z-t.z;return i*i+x*x+T*T}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,i,x){const T=Math.sin(i)*t;return this.x=T*Math.sin(x),this.y=Math.cos(i)*t,this.z=T*Math.cos(x),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,i,x){return this.x=t*Math.sin(i),this.y=x,this.z=t*Math.cos(i),this}setFromMatrixPosition(t){const i=t.elements;return this.x=i[12],this.y=i[13],this.z=i[14],this}setFromMatrixScale(t){const i=this.setFromMatrixColumn(t,0).length(),x=this.setFromMatrixColumn(t,1).length(),T=this.setFromMatrixColumn(t,2).length();return this.x=i,this.y=x,this.z=T,this}setFromMatrixColumn(t,i){return this.fromArray(t.elements,i*4)}setFromMatrix3Column(t,i){return this.fromArray(t.elements,i*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,i=0){return this.x=t[i],this.y=t[i+1],this.z=t[i+2],this}toArray(t=[],i=0){return t[i]=this.x,t[i+1]=this.y,t[i+2]=this.z,t}fromBufferAttribute(t,i){return this.x=t.getX(i),this.y=t.getY(i),this.z=t.getZ(i),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=(Math.random()-.5)*2,i=Math.random()*Math.PI*2,x=Math.sqrt(1-t**2);return this.x=x*Math.cos(i),this.y=x*Math.sin(i),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const C0=new Ct,RT=new Ds;class gs{constructor(t=new Ct(1/0,1/0,1/0),i=new Ct(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=i}set(t,i){return this.min.copy(t),this.max.copy(i),this}setFromArray(t){this.makeEmpty();for(let i=0,x=t.length;ithis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,i){return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Ja),Ja.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let i,x;return t.normal.x>0?(i=t.normal.x*this.min.x,x=t.normal.x*this.max.x):(i=t.normal.x*this.max.x,x=t.normal.x*this.min.x),t.normal.y>0?(i+=t.normal.y*this.min.y,x+=t.normal.y*this.max.y):(i+=t.normal.y*this.max.y,x+=t.normal.y*this.min.y),t.normal.z>0?(i+=t.normal.z*this.min.z,x+=t.normal.z*this.max.z):(i+=t.normal.z*this.max.z,x+=t.normal.z*this.min.z),i<=-t.constant&&x>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Wc),rv.subVectors(this.max,Wc),lf.subVectors(t.a,Wc),hf.subVectors(t.b,Wc),uf.subVectors(t.c,Wc),_l.subVectors(hf,lf),ql.subVectors(uf,hf),Jh.subVectors(lf,uf);let i=[0,-_l.z,_l.y,0,-ql.z,ql.y,0,-Jh.z,Jh.y,_l.z,0,-_l.x,ql.z,0,-ql.x,Jh.z,0,-Jh.x,-_l.y,_l.x,0,-ql.y,ql.x,0,-Jh.y,Jh.x,0];return!w0(i,lf,hf,uf,rv)||(i=[1,0,0,0,1,0,0,0,1],!w0(i,lf,hf,uf,rv))?!1:(sv.crossVectors(_l,ql),i=[sv.x,sv.y,sv.z],w0(i,lf,hf,uf,rv))}clampPoint(t,i){return i.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Ja).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Ja).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(ul[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ul[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ul[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ul[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ul[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ul[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ul[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ul[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ul),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const ul=[new Ct,new Ct,new Ct,new Ct,new Ct,new Ct,new Ct,new Ct],Ja=new Ct,nv=new gs,lf=new Ct,hf=new Ct,uf=new Ct,_l=new Ct,ql=new Ct,Jh=new Ct,Wc=new Ct,rv=new Ct,sv=new Ct,$h=new Ct;function w0(g,t,i,x,T){for(let E=0,s=g.length-3;E<=s;E+=3){$h.fromArray(g,E);const y=T.x*Math.abs($h.x)+T.y*Math.abs($h.y)+T.z*Math.abs($h.z),e=t.dot($h),r=i.dot($h),p=x.dot($h);if(Math.max(-Math.max(e,r,p),Math.min(e,r,p))>y)return!1}return!0}const Y5=new gs,Xc=new Ct,A0=new Ct;class $r{constructor(t=new Ct,i=-1){this.isSphere=!0,this.center=t,this.radius=i}set(t,i){return this.center.copy(t),this.radius=i,this}setFromPoints(t,i){const x=this.center;i!==void 0?x.copy(i):Y5.setFromPoints(t).getCenter(x);let T=0;for(let E=0,s=t.length;Ethis.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Xc.subVectors(t,this.center);const i=Xc.lengthSq();if(i>this.radius*this.radius){const x=Math.sqrt(i),T=(x-this.radius)*.5;this.center.addScaledVector(Xc,T/x),this.radius+=T}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(A0.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Xc.copy(t.center).add(A0)),this.expandByPoint(Xc.copy(t.center).sub(A0))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}}const fl=new Ct,P0=new Ct,av=new Ct,th=new Ct,R0=new Ct,ov=new Ct,b0=new Ct;class ic{constructor(t=new Ct,i=new Ct(0,0,-1)){this.origin=t,this.direction=i}set(t,i){return this.origin.copy(t),this.direction.copy(i),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,i){return i.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,fl)),this}closestPointToPoint(t,i){i.subVectors(t,this.origin);const x=i.dot(this.direction);return x<0?i.copy(this.origin):i.copy(this.origin).addScaledVector(this.direction,x)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const i=fl.subVectors(t,this.origin).dot(this.direction);return i<0?this.origin.distanceToSquared(t):(fl.copy(this.origin).addScaledVector(this.direction,i),fl.distanceToSquared(t))}distanceSqToSegment(t,i,x,T){P0.copy(t).add(i).multiplyScalar(.5),av.copy(i).sub(t).normalize(),th.copy(this.origin).sub(P0);const E=t.distanceTo(i)*.5,s=-this.direction.dot(av),y=th.dot(this.direction),e=-th.dot(av),r=th.lengthSq(),p=Math.abs(1-s*s);let h,a,l,n;if(p>0)if(h=s*e-y,a=s*y-e,n=E*p,h>=0)if(a>=-n)if(a<=n){const u=1/p;h*=u,a*=u,l=h*(h+s*a+2*y)+a*(s*h+a+2*e)+r}else a=E,h=Math.max(0,-(s*a+y)),l=-h*h+a*(a+2*e)+r;else a=-E,h=Math.max(0,-(s*a+y)),l=-h*h+a*(a+2*e)+r;else a<=-n?(h=Math.max(0,-(-s*E+y)),a=h>0?-E:Math.min(Math.max(-E,-e),E),l=-h*h+a*(a+2*e)+r):a<=n?(h=0,a=Math.min(Math.max(-E,-e),E),l=a*(a+2*e)+r):(h=Math.max(0,-(s*E+y)),a=h>0?E:Math.min(Math.max(-E,-e),E),l=-h*h+a*(a+2*e)+r);else a=s>0?-E:E,h=Math.max(0,-(s*a+y)),l=-h*h+a*(a+2*e)+r;return x&&x.copy(this.origin).addScaledVector(this.direction,h),T&&T.copy(P0).addScaledVector(av,a),l}intersectSphere(t,i){fl.subVectors(t.center,this.origin);const x=fl.dot(this.direction),T=fl.dot(fl)-x*x,E=t.radius*t.radius;if(T>E)return null;const s=Math.sqrt(E-T),y=x-s,e=x+s;return e<0?null:y<0?this.at(e,i):this.at(y,i)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const i=t.normal.dot(this.direction);if(i===0)return t.distanceToPoint(this.origin)===0?0:null;const x=-(this.origin.dot(t.normal)+t.constant)/i;return x>=0?x:null}intersectPlane(t,i){const x=this.distanceToPlane(t);return x===null?null:this.at(x,i)}intersectsPlane(t){const i=t.distanceToPoint(this.origin);return i===0||t.normal.dot(this.direction)*i<0}intersectBox(t,i){let x,T,E,s,y,e;const r=1/this.direction.x,p=1/this.direction.y,h=1/this.direction.z,a=this.origin;return r>=0?(x=(t.min.x-a.x)*r,T=(t.max.x-a.x)*r):(x=(t.max.x-a.x)*r,T=(t.min.x-a.x)*r),p>=0?(E=(t.min.y-a.y)*p,s=(t.max.y-a.y)*p):(E=(t.max.y-a.y)*p,s=(t.min.y-a.y)*p),x>s||E>T||((E>x||isNaN(x))&&(x=E),(s=0?(y=(t.min.z-a.z)*h,e=(t.max.z-a.z)*h):(y=(t.max.z-a.z)*h,e=(t.min.z-a.z)*h),x>e||y>T)||((y>x||x!==x)&&(x=y),(e=0?x:T,i)}intersectsBox(t){return this.intersectBox(t,fl)!==null}intersectTriangle(t,i,x,T,E){R0.subVectors(i,t),ov.subVectors(x,t),b0.crossVectors(R0,ov);let s=this.direction.dot(b0),y;if(s>0){if(T)return null;y=1}else if(s<0)y=-1,s=-s;else return null;th.subVectors(this.origin,t);const e=y*this.direction.dot(ov.crossVectors(th,ov));if(e<0)return null;const r=y*this.direction.dot(R0.cross(th));if(r<0||e+r>s)return null;const p=-y*th.dot(b0);return p<0?null:this.at(p/s,E)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ci{constructor(t,i,x,T,E,s,y,e,r,p,h,a,l,n,u,f){ci.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,i,x,T,E,s,y,e,r,p,h,a,l,n,u,f)}set(t,i,x,T,E,s,y,e,r,p,h,a,l,n,u,f){const o=this.elements;return o[0]=t,o[4]=i,o[8]=x,o[12]=T,o[1]=E,o[5]=s,o[9]=y,o[13]=e,o[2]=r,o[6]=p,o[10]=h,o[14]=a,o[3]=l,o[7]=n,o[11]=u,o[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ci().fromArray(this.elements)}copy(t){const i=this.elements,x=t.elements;return i[0]=x[0],i[1]=x[1],i[2]=x[2],i[3]=x[3],i[4]=x[4],i[5]=x[5],i[6]=x[6],i[7]=x[7],i[8]=x[8],i[9]=x[9],i[10]=x[10],i[11]=x[11],i[12]=x[12],i[13]=x[13],i[14]=x[14],i[15]=x[15],this}copyPosition(t){const i=this.elements,x=t.elements;return i[12]=x[12],i[13]=x[13],i[14]=x[14],this}setFromMatrix3(t){const i=t.elements;return this.set(i[0],i[3],i[6],0,i[1],i[4],i[7],0,i[2],i[5],i[8],0,0,0,0,1),this}extractBasis(t,i,x){return t.setFromMatrixColumn(this,0),i.setFromMatrixColumn(this,1),x.setFromMatrixColumn(this,2),this}makeBasis(t,i,x){return this.set(t.x,i.x,x.x,0,t.y,i.y,x.y,0,t.z,i.z,x.z,0,0,0,0,1),this}extractRotation(t){const i=this.elements,x=t.elements,T=1/ff.setFromMatrixColumn(t,0).length(),E=1/ff.setFromMatrixColumn(t,1).length(),s=1/ff.setFromMatrixColumn(t,2).length();return i[0]=x[0]*T,i[1]=x[1]*T,i[2]=x[2]*T,i[3]=0,i[4]=x[4]*E,i[5]=x[5]*E,i[6]=x[6]*E,i[7]=0,i[8]=x[8]*s,i[9]=x[9]*s,i[10]=x[10]*s,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this}makeRotationFromEuler(t){const i=this.elements,x=t.x,T=t.y,E=t.z,s=Math.cos(x),y=Math.sin(x),e=Math.cos(T),r=Math.sin(T),p=Math.cos(E),h=Math.sin(E);if(t.order==="XYZ"){const a=s*p,l=s*h,n=y*p,u=y*h;i[0]=e*p,i[4]=-e*h,i[8]=r,i[1]=l+n*r,i[5]=a-u*r,i[9]=-y*e,i[2]=u-a*r,i[6]=n+l*r,i[10]=s*e}else if(t.order==="YXZ"){const a=e*p,l=e*h,n=r*p,u=r*h;i[0]=a+u*y,i[4]=n*y-l,i[8]=s*r,i[1]=s*h,i[5]=s*p,i[9]=-y,i[2]=l*y-n,i[6]=u+a*y,i[10]=s*e}else if(t.order==="ZXY"){const a=e*p,l=e*h,n=r*p,u=r*h;i[0]=a-u*y,i[4]=-s*h,i[8]=n+l*y,i[1]=l+n*y,i[5]=s*p,i[9]=u-a*y,i[2]=-s*r,i[6]=y,i[10]=s*e}else if(t.order==="ZYX"){const a=s*p,l=s*h,n=y*p,u=y*h;i[0]=e*p,i[4]=n*r-l,i[8]=a*r+u,i[1]=e*h,i[5]=u*r+a,i[9]=l*r-n,i[2]=-r,i[6]=y*e,i[10]=s*e}else if(t.order==="YZX"){const a=s*e,l=s*r,n=y*e,u=y*r;i[0]=e*p,i[4]=u-a*h,i[8]=n*h+l,i[1]=h,i[5]=s*p,i[9]=-y*p,i[2]=-r*p,i[6]=l*h+n,i[10]=a-u*h}else if(t.order==="XZY"){const a=s*e,l=s*r,n=y*e,u=y*r;i[0]=e*p,i[4]=-h,i[8]=r*p,i[1]=a*h+u,i[5]=s*p,i[9]=l*h-n,i[2]=n*h-l,i[6]=y*p,i[10]=u*h+a}return i[3]=0,i[7]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this}makeRotationFromQuaternion(t){return this.compose(k5,t,j5)}lookAt(t,i,x){const T=this.elements;return qs.subVectors(t,i),qs.lengthSq()===0&&(qs.z=1),qs.normalize(),eh.crossVectors(x,qs),eh.lengthSq()===0&&(Math.abs(x.z)===1?qs.x+=1e-4:qs.z+=1e-4,qs.normalize(),eh.crossVectors(x,qs)),eh.normalize(),lv.crossVectors(qs,eh),T[0]=eh.x,T[4]=lv.x,T[8]=qs.x,T[1]=eh.y,T[5]=lv.y,T[9]=qs.y,T[2]=eh.z,T[6]=lv.z,T[10]=qs.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,i){const x=t.elements,T=i.elements,E=this.elements,s=x[0],y=x[4],e=x[8],r=x[12],p=x[1],h=x[5],a=x[9],l=x[13],n=x[2],u=x[6],f=x[10],o=x[14],c=x[3],d=x[7],v=x[11],m=x[15],S=T[0],M=T[4],w=T[8],C=T[12],A=T[1],P=T[5],b=T[9],O=T[13],I=T[2],D=T[6],B=T[10],G=T[14],z=T[3],X=T[7],j=T[11],Q=T[15];return E[0]=s*S+y*A+e*I+r*z,E[4]=s*M+y*P+e*D+r*X,E[8]=s*w+y*b+e*B+r*j,E[12]=s*C+y*O+e*G+r*Q,E[1]=p*S+h*A+a*I+l*z,E[5]=p*M+h*P+a*D+l*X,E[9]=p*w+h*b+a*B+l*j,E[13]=p*C+h*O+a*G+l*Q,E[2]=n*S+u*A+f*I+o*z,E[6]=n*M+u*P+f*D+o*X,E[10]=n*w+u*b+f*B+o*j,E[14]=n*C+u*O+f*G+o*Q,E[3]=c*S+d*A+v*I+m*z,E[7]=c*M+d*P+v*D+m*X,E[11]=c*w+d*b+v*B+m*j,E[15]=c*C+d*O+v*G+m*Q,this}multiplyScalar(t){const i=this.elements;return i[0]*=t,i[4]*=t,i[8]*=t,i[12]*=t,i[1]*=t,i[5]*=t,i[9]*=t,i[13]*=t,i[2]*=t,i[6]*=t,i[10]*=t,i[14]*=t,i[3]*=t,i[7]*=t,i[11]*=t,i[15]*=t,this}determinant(){const t=this.elements,i=t[0],x=t[4],T=t[8],E=t[12],s=t[1],y=t[5],e=t[9],r=t[13],p=t[2],h=t[6],a=t[10],l=t[14],n=t[3],u=t[7],f=t[11],o=t[15];return n*(+E*e*h-T*r*h-E*y*a+x*r*a+T*y*l-x*e*l)+u*(+i*e*l-i*r*a+E*s*a-T*s*l+T*r*p-E*e*p)+f*(+i*r*h-i*y*l-E*s*h+x*s*l+E*y*p-x*r*p)+o*(-T*y*p-i*e*h+i*y*a+T*s*h-x*s*a+x*e*p)}transpose(){const t=this.elements;let i;return i=t[1],t[1]=t[4],t[4]=i,i=t[2],t[2]=t[8],t[8]=i,i=t[6],t[6]=t[9],t[9]=i,i=t[3],t[3]=t[12],t[12]=i,i=t[7],t[7]=t[13],t[13]=i,i=t[11],t[11]=t[14],t[14]=i,this}setPosition(t,i,x){const T=this.elements;return t.isVector3?(T[12]=t.x,T[13]=t.y,T[14]=t.z):(T[12]=t,T[13]=i,T[14]=x),this}invert(){const t=this.elements,i=t[0],x=t[1],T=t[2],E=t[3],s=t[4],y=t[5],e=t[6],r=t[7],p=t[8],h=t[9],a=t[10],l=t[11],n=t[12],u=t[13],f=t[14],o=t[15],c=h*f*r-u*a*r+u*e*l-y*f*l-h*e*o+y*a*o,d=n*a*r-p*f*r-n*e*l+s*f*l+p*e*o-s*a*o,v=p*u*r-n*h*r+n*y*l-s*u*l-p*y*o+s*h*o,m=n*h*e-p*u*e-n*y*a+s*u*a+p*y*f-s*h*f,S=i*c+x*d+T*v+E*m;if(S===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/S;return t[0]=c*M,t[1]=(u*a*E-h*f*E-u*T*l+x*f*l+h*T*o-x*a*o)*M,t[2]=(y*f*E-u*e*E+u*T*r-x*f*r-y*T*o+x*e*o)*M,t[3]=(h*e*E-y*a*E-h*T*r+x*a*r+y*T*l-x*e*l)*M,t[4]=d*M,t[5]=(p*f*E-n*a*E+n*T*l-i*f*l-p*T*o+i*a*o)*M,t[6]=(n*e*E-s*f*E-n*T*r+i*f*r+s*T*o-i*e*o)*M,t[7]=(s*a*E-p*e*E+p*T*r-i*a*r-s*T*l+i*e*l)*M,t[8]=v*M,t[9]=(n*h*E-p*u*E-n*x*l+i*u*l+p*x*o-i*h*o)*M,t[10]=(s*u*E-n*y*E+n*x*r-i*u*r-s*x*o+i*y*o)*M,t[11]=(p*y*E-s*h*E-p*x*r+i*h*r+s*x*l-i*y*l)*M,t[12]=m*M,t[13]=(p*u*T-n*h*T+n*x*a-i*u*a-p*x*f+i*h*f)*M,t[14]=(n*y*T-s*u*T-n*x*e+i*u*e+s*x*f-i*y*f)*M,t[15]=(s*h*T-p*y*T+p*x*e-i*h*e-s*x*a+i*y*a)*M,this}scale(t){const i=this.elements,x=t.x,T=t.y,E=t.z;return i[0]*=x,i[4]*=T,i[8]*=E,i[1]*=x,i[5]*=T,i[9]*=E,i[2]*=x,i[6]*=T,i[10]*=E,i[3]*=x,i[7]*=T,i[11]*=E,this}getMaxScaleOnAxis(){const t=this.elements,i=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],x=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],T=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(i,x,T))}makeTranslation(t,i,x){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,i,0,0,1,x,0,0,0,1),this}makeRotationX(t){const i=Math.cos(t),x=Math.sin(t);return this.set(1,0,0,0,0,i,-x,0,0,x,i,0,0,0,0,1),this}makeRotationY(t){const i=Math.cos(t),x=Math.sin(t);return this.set(i,0,x,0,0,1,0,0,-x,0,i,0,0,0,0,1),this}makeRotationZ(t){const i=Math.cos(t),x=Math.sin(t);return this.set(i,-x,0,0,x,i,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,i){const x=Math.cos(i),T=Math.sin(i),E=1-x,s=t.x,y=t.y,e=t.z,r=E*s,p=E*y;return this.set(r*s+x,r*y-T*e,r*e+T*y,0,r*y+T*e,p*y+x,p*e-T*s,0,r*e-T*y,p*e+T*s,E*e*e+x,0,0,0,0,1),this}makeScale(t,i,x){return this.set(t,0,0,0,0,i,0,0,0,0,x,0,0,0,0,1),this}makeShear(t,i,x,T,E,s){return this.set(1,x,E,0,t,1,s,0,i,T,1,0,0,0,0,1),this}compose(t,i,x){const T=this.elements,E=i._x,s=i._y,y=i._z,e=i._w,r=E+E,p=s+s,h=y+y,a=E*r,l=E*p,n=E*h,u=s*p,f=s*h,o=y*h,c=e*r,d=e*p,v=e*h,m=x.x,S=x.y,M=x.z;return T[0]=(1-(u+o))*m,T[1]=(l+v)*m,T[2]=(n-d)*m,T[3]=0,T[4]=(l-v)*S,T[5]=(1-(a+o))*S,T[6]=(f+c)*S,T[7]=0,T[8]=(n+d)*M,T[9]=(f-c)*M,T[10]=(1-(a+u))*M,T[11]=0,T[12]=t.x,T[13]=t.y,T[14]=t.z,T[15]=1,this}decompose(t,i,x){const T=this.elements;let E=ff.set(T[0],T[1],T[2]).length();const s=ff.set(T[4],T[5],T[6]).length(),y=ff.set(T[8],T[9],T[10]).length();this.determinant()<0&&(E=-E),t.x=T[12],t.y=T[13],t.z=T[14],$a.copy(this);const r=1/E,p=1/s,h=1/y;return $a.elements[0]*=r,$a.elements[1]*=r,$a.elements[2]*=r,$a.elements[4]*=p,$a.elements[5]*=p,$a.elements[6]*=p,$a.elements[8]*=h,$a.elements[9]*=h,$a.elements[10]*=h,i.setFromRotationMatrix($a),x.x=E,x.y=s,x.z=y,this}makePerspective(t,i,x,T,E,s,y=No){const e=this.elements,r=2*E/(i-t),p=2*E/(x-T),h=(i+t)/(i-t),a=(x+T)/(x-T);let l,n;if(y===No)l=-(s+E)/(s-E),n=-2*s*E/(s-E);else if(y===Dd)l=-s/(s-E),n=-s*E/(s-E);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+y);return e[0]=r,e[4]=0,e[8]=h,e[12]=0,e[1]=0,e[5]=p,e[9]=a,e[13]=0,e[2]=0,e[6]=0,e[10]=l,e[14]=n,e[3]=0,e[7]=0,e[11]=-1,e[15]=0,this}makeOrthographic(t,i,x,T,E,s,y=No){const e=this.elements,r=1/(i-t),p=1/(x-T),h=1/(s-E),a=(i+t)*r,l=(x+T)*p;let n,u;if(y===No)n=(s+E)*h,u=-2*h;else if(y===Dd)n=E*h,u=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+y);return e[0]=2*r,e[4]=0,e[8]=0,e[12]=-a,e[1]=0,e[5]=2*p,e[9]=0,e[13]=-l,e[2]=0,e[6]=0,e[10]=u,e[14]=-n,e[3]=0,e[7]=0,e[11]=0,e[15]=1,this}equals(t){const i=this.elements,x=t.elements;for(let T=0;T<16;T++)if(i[T]!==x[T])return!1;return!0}fromArray(t,i=0){for(let x=0;x<16;x++)this.elements[x]=t[x+i];return this}toArray(t=[],i=0){const x=this.elements;return t[i]=x[0],t[i+1]=x[1],t[i+2]=x[2],t[i+3]=x[3],t[i+4]=x[4],t[i+5]=x[5],t[i+6]=x[6],t[i+7]=x[7],t[i+8]=x[8],t[i+9]=x[9],t[i+10]=x[10],t[i+11]=x[11],t[i+12]=x[12],t[i+13]=x[13],t[i+14]=x[14],t[i+15]=x[15],t}}const ff=new Ct,$a=new ci,k5=new Ct(0,0,0),j5=new Ct(1,1,1),eh=new Ct,lv=new Ct,qs=new Ct,bT=new ci,LT=new Ds;class qa{constructor(t=0,i=0,x=0,T=qa.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=i,this._z=x,this._order=T}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,i,x,T=this._order){return this._x=t,this._y=i,this._z=x,this._order=T,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,i=this._order,x=!0){const T=t.elements,E=T[0],s=T[4],y=T[8],e=T[1],r=T[5],p=T[9],h=T[2],a=T[6],l=T[10];switch(i){case"XYZ":this._y=Math.asin(Kn(y,-1,1)),Math.abs(y)<.9999999?(this._x=Math.atan2(-p,l),this._z=Math.atan2(-s,E)):(this._x=Math.atan2(a,r),this._z=0);break;case"YXZ":this._x=Math.asin(-Kn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(y,l),this._z=Math.atan2(e,r)):(this._y=Math.atan2(-h,E),this._z=0);break;case"ZXY":this._x=Math.asin(Kn(a,-1,1)),Math.abs(a)<.9999999?(this._y=Math.atan2(-h,l),this._z=Math.atan2(-s,r)):(this._y=0,this._z=Math.atan2(e,E));break;case"ZYX":this._y=Math.asin(-Kn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(a,l),this._z=Math.atan2(e,E)):(this._x=0,this._z=Math.atan2(-s,r));break;case"YZX":this._z=Math.asin(Kn(e,-1,1)),Math.abs(e)<.9999999?(this._x=Math.atan2(-p,r),this._y=Math.atan2(-h,E)):(this._x=0,this._y=Math.atan2(y,l));break;case"XZY":this._z=Math.asin(-Kn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(a,r),this._y=Math.atan2(y,E)):(this._x=Math.atan2(-p,l),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+i)}return this._order=i,x===!0&&this._onChangeCallback(),this}setFromQuaternion(t,i,x){return bT.makeRotationFromQuaternion(t),this.setFromRotationMatrix(bT,i,x)}setFromVector3(t,i=this._order){return this.set(t.x,t.y,t.z,i)}reorder(t){return LT.setFromEuler(this),this.setFromQuaternion(LT,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],i=0){return t[i]=this._x,t[i+1]=this._y,t[i+2]=this._z,t[i+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}qa.DEFAULT_ORDER="XYZ";class Su{constructor(){this.mask=1}set(t){this.mask=(1<>>0}enable(t){this.mask|=1<1){for(let i=0;i1){for(let x=0;x0&&(T.userData=this.userData),T.layers=this.layers.mask,T.matrix=this.matrix.toArray(),T.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(T.matrixAutoUpdate=!1),this.isInstancedMesh&&(T.type="InstancedMesh",T.count=this.count,T.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(T.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(T.type="BatchedMesh",T.perObjectFrustumCulled=this.perObjectFrustumCulled,T.sortObjects=this.sortObjects,T.drawRanges=this._drawRanges,T.reservedRanges=this._reservedRanges,T.visibility=this._visibility,T.active=this._active,T.bounds=this._bounds.map(y=>({boxInitialized:y.boxInitialized,boxMin:y.box.min.toArray(),boxMax:y.box.max.toArray(),sphereInitialized:y.sphereInitialized,sphereRadius:y.sphere.radius,sphereCenter:y.sphere.center.toArray()})),T.maxGeometryCount=this._maxGeometryCount,T.maxVertexCount=this._maxVertexCount,T.maxIndexCount=this._maxIndexCount,T.geometryInitialized=this._geometryInitialized,T.geometryCount=this._geometryCount,T.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(T.boundingSphere={center:T.boundingSphere.center.toArray(),radius:T.boundingSphere.radius}),this.boundingBox!==null&&(T.boundingBox={min:T.boundingBox.min.toArray(),max:T.boundingBox.max.toArray()}));function E(y,e){return y[e.uuid]===void 0&&(y[e.uuid]=e.toJSON(t)),e.uuid}if(this.isScene)this.background&&(this.background.isColor?T.background=this.background.toJSON():this.background.isTexture&&(T.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(T.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){T.geometry=E(t.geometries,this.geometry);const y=this.geometry.parameters;if(y!==void 0&&y.shapes!==void 0){const e=y.shapes;if(Array.isArray(e))for(let r=0,p=e.length;r0){T.children=[];for(let y=0;y0){T.animations=[];for(let y=0;y0&&(x.geometries=y),e.length>0&&(x.materials=e),r.length>0&&(x.textures=r),p.length>0&&(x.images=p),h.length>0&&(x.shapes=h),a.length>0&&(x.skeletons=a),l.length>0&&(x.animations=l),n.length>0&&(x.nodes=n)}return x.object=T,x;function s(y){const e=[];for(const r in y){const p=y[r];delete p.metadata,e.push(p)}return e}}clone(t){return new this.constructor().copy(this,t)}copy(t,i=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),i===!0)for(let x=0;x0?T.multiplyScalar(1/Math.sqrt(E)):T.set(0,0,0)}static getBarycoord(t,i,x,T,E){Qa.subVectors(T,i),dl.subVectors(x,i),L0.subVectors(t,i);const s=Qa.dot(Qa),y=Qa.dot(dl),e=Qa.dot(L0),r=dl.dot(dl),p=dl.dot(L0),h=s*r-y*y;if(h===0)return E.set(0,0,0),null;const a=1/h,l=(r*e-y*p)*a,n=(s*p-y*e)*a;return E.set(1-l-n,n,l)}static containsPoint(t,i,x,T){return this.getBarycoord(t,i,x,T,pl)===null?!1:pl.x>=0&&pl.y>=0&&pl.x+pl.y<=1}static getInterpolation(t,i,x,T,E,s,y,e){return this.getBarycoord(t,i,x,T,pl)===null?(e.x=0,e.y=0,"z"in e&&(e.z=0),"w"in e&&(e.w=0),null):(e.setScalar(0),e.addScaledVector(E,pl.x),e.addScaledVector(s,pl.y),e.addScaledVector(y,pl.z),e)}static isFrontFacing(t,i,x,T){return Qa.subVectors(x,i),dl.subVectors(t,i),Qa.cross(dl).dot(T)<0}set(t,i,x){return this.a.copy(t),this.b.copy(i),this.c.copy(x),this}setFromPointsAndIndices(t,i,x,T){return this.a.copy(t[i]),this.b.copy(t[x]),this.c.copy(t[T]),this}setFromAttributeAndIndices(t,i,x,T){return this.a.fromBufferAttribute(t,i),this.b.fromBufferAttribute(t,x),this.c.fromBufferAttribute(t,T),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Qa.subVectors(this.c,this.b),dl.subVectors(this.a,this.b),Qa.cross(dl).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return ia.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,i){return ia.getBarycoord(t,this.a,this.b,this.c,i)}getInterpolation(t,i,x,T,E){return ia.getInterpolation(t,this.a,this.b,this.c,i,x,T,E)}containsPoint(t){return ia.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return ia.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,i){const x=this.a,T=this.b,E=this.c;let s,y;df.subVectors(T,x),pf.subVectors(E,x),F0.subVectors(t,x);const e=df.dot(F0),r=pf.dot(F0);if(e<=0&&r<=0)return i.copy(x);O0.subVectors(t,T);const p=df.dot(O0),h=pf.dot(O0);if(p>=0&&h<=p)return i.copy(T);const a=e*h-p*r;if(a<=0&&e>=0&&p<=0)return s=e/(e-p),i.copy(x).addScaledVector(df,s);D0.subVectors(t,E);const l=df.dot(D0),n=pf.dot(D0);if(n>=0&&l<=n)return i.copy(E);const u=l*r-e*n;if(u<=0&&r>=0&&n<=0)return y=r/(r-n),i.copy(x).addScaledVector(pf,y);const f=p*n-l*h;if(f<=0&&h-p>=0&&l-n>=0)return NT.subVectors(E,T),y=(h-p)/(h-p+(l-n)),i.copy(T).addScaledVector(NT,y);const o=1/(f+u+a);return s=u*o,y=a*o,i.copy(x).addScaledVector(df,s).addScaledVector(pf,y)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const pw={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ih={h:0,s:0,l:0},uv={h:0,s:0,l:0};function I0(g,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?g+(t-g)*6*i:i<1/2?t:i<2/3?g+(t-g)*6*(2/3-i):g}class ze{constructor(t,i,x){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,i,x)}set(t,i,x){if(i===void 0&&x===void 0){const T=t;T&&T.isColor?this.copy(T):typeof T=="number"?this.setHex(T):typeof T=="string"&&this.setStyle(T)}else this.setRGB(t,i,x);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,i=vr){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,rn.toWorkingColorSpace(this,i),this}setRGB(t,i,x,T=rn.workingColorSpace){return this.r=t,this.g=i,this.b=x,rn.toWorkingColorSpace(this,T),this}setHSL(t,i,x,T=rn.workingColorSpace){if(t=p1(t,1),i=Kn(i,0,1),x=Kn(x,0,1),i===0)this.r=this.g=this.b=x;else{const E=x<=.5?x*(1+i):x+i-x*i,s=2*x-E;this.r=I0(s,E,t+1/3),this.g=I0(s,E,t),this.b=I0(s,E,t-1/3)}return rn.toWorkingColorSpace(this,T),this}setStyle(t,i=vr){function x(E){E!==void 0&&parseFloat(E)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let T;if(T=/^(\w+)\(([^\)]*)\)/.exec(t)){let E;const s=T[1],y=T[2];switch(s){case"rgb":case"rgba":if(E=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(y))return x(E[4]),this.setRGB(Math.min(255,parseInt(E[1],10))/255,Math.min(255,parseInt(E[2],10))/255,Math.min(255,parseInt(E[3],10))/255,i);if(E=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(y))return x(E[4]),this.setRGB(Math.min(100,parseInt(E[1],10))/100,Math.min(100,parseInt(E[2],10))/100,Math.min(100,parseInt(E[3],10))/100,i);break;case"hsl":case"hsla":if(E=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(y))return x(E[4]),this.setHSL(parseFloat(E[1])/360,parseFloat(E[2])/100,parseFloat(E[3])/100,i);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(T=/^\#([A-Fa-f\d]+)$/.exec(t)){const E=T[1],s=E.length;if(s===3)return this.setRGB(parseInt(E.charAt(0),16)/15,parseInt(E.charAt(1),16)/15,parseInt(E.charAt(2),16)/15,i);if(s===6)return this.setHex(parseInt(E,16),i);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,i);return this}setColorName(t,i=vr){const x=pw[t.toLowerCase()];return x!==void 0?this.setHex(x,i):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Xf(t.r),this.g=Xf(t.g),this.b=Xf(t.b),this}copyLinearToSRGB(t){return this.r=E0(t.r),this.g=E0(t.g),this.b=E0(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=vr){return rn.fromWorkingColorSpace(jr.copy(this),t),Math.round(Kn(jr.r*255,0,255))*65536+Math.round(Kn(jr.g*255,0,255))*256+Math.round(Kn(jr.b*255,0,255))}getHexString(t=vr){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,i=rn.workingColorSpace){rn.fromWorkingColorSpace(jr.copy(this),i);const x=jr.r,T=jr.g,E=jr.b,s=Math.max(x,T,E),y=Math.min(x,T,E);let e,r;const p=(y+s)/2;if(y===s)e=0,r=0;else{const h=s-y;switch(r=p<=.5?h/(s+y):h/(2-s-y),s){case x:e=(T-E)/h+(T0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const i in t){const x=t[i];if(x===void 0){console.warn(`THREE.Material: parameter '${i}' has value of undefined.`);continue}const T=this[i];if(T===void 0){console.warn(`THREE.Material: '${i}' is not a property of THREE.${this.type}.`);continue}T&&T.isColor?T.set(x):T&&T.isVector3&&x&&x.isVector3?T.copy(x):this[i]=x}}toJSON(t){const i=t===void 0||typeof t=="string";i&&(t={textures:{},images:{}});const x={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};x.uuid=this.uuid,x.type=this.type,this.name!==""&&(x.name=this.name),this.color&&this.color.isColor&&(x.color=this.color.getHex()),this.roughness!==void 0&&(x.roughness=this.roughness),this.metalness!==void 0&&(x.metalness=this.metalness),this.sheen!==void 0&&(x.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(x.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(x.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(x.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(x.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(x.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(x.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(x.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(x.shininess=this.shininess),this.clearcoat!==void 0&&(x.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(x.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(x.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(x.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(x.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,x.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(x.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(x.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(x.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(x.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(x.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(x.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(x.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(x.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(x.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(x.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(x.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(x.lightMap=this.lightMap.toJSON(t).uuid,x.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(x.aoMap=this.aoMap.toJSON(t).uuid,x.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(x.bumpMap=this.bumpMap.toJSON(t).uuid,x.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(x.normalMap=this.normalMap.toJSON(t).uuid,x.normalMapType=this.normalMapType,x.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(x.displacementMap=this.displacementMap.toJSON(t).uuid,x.displacementScale=this.displacementScale,x.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(x.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(x.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(x.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(x.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(x.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(x.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(x.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(x.combine=this.combine)),this.envMapIntensity!==void 0&&(x.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(x.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(x.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(x.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(x.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(x.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(x.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(x.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(x.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(x.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(x.size=this.size),this.shadowSide!==null&&(x.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(x.sizeAttenuation=this.sizeAttenuation),this.blending!==gu&&(x.blending=this.blending),this.side!==Cl&&(x.side=this.side),this.vertexColors===!0&&(x.vertexColors=!0),this.opacity<1&&(x.opacity=this.opacity),this.transparent===!0&&(x.transparent=!0),this.blendSrc!==ym&&(x.blendSrc=this.blendSrc),this.blendDst!==xm&&(x.blendDst=this.blendDst),this.blendEquation!==oh&&(x.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(x.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(x.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(x.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(x.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(x.blendAlpha=this.blendAlpha),this.depthFunc!==Td&&(x.depthFunc=this.depthFunc),this.depthTest===!1&&(x.depthTest=this.depthTest),this.depthWrite===!1&&(x.depthWrite=this.depthWrite),this.colorWrite===!1&&(x.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(x.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==dx&&(x.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(x.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(x.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==lu&&(x.stencilFail=this.stencilFail),this.stencilZFail!==lu&&(x.stencilZFail=this.stencilZFail),this.stencilZPass!==lu&&(x.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(x.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(x.rotation=this.rotation),this.polygonOffset===!0&&(x.polygonOffset=!0),this.polygonOffsetFactor!==0&&(x.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(x.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(x.linewidth=this.linewidth),this.dashSize!==void 0&&(x.dashSize=this.dashSize),this.gapSize!==void 0&&(x.gapSize=this.gapSize),this.scale!==void 0&&(x.scale=this.scale),this.dithering===!0&&(x.dithering=!0),this.alphaTest>0&&(x.alphaTest=this.alphaTest),this.alphaHash===!0&&(x.alphaHash=!0),this.alphaToCoverage===!0&&(x.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(x.premultipliedAlpha=!0),this.forceSinglePass===!0&&(x.forceSinglePass=!0),this.wireframe===!0&&(x.wireframe=!0),this.wireframeLinewidth>1&&(x.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(x.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(x.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(x.flatShading=!0),this.visible===!1&&(x.visible=!1),this.toneMapped===!1&&(x.toneMapped=!1),this.fog===!1&&(x.fog=!1),Object.keys(this.userData).length>0&&(x.userData=this.userData);function T(E){const s=[];for(const y in E){const e=E[y];delete e.metadata,s.push(e)}return s}if(i){const E=T(t.textures),s=T(t.images);E.length>0&&(x.textures=E),s.length>0&&(x.images=s)}return x}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const i=t.clippingPlanes;let x=null;if(i!==null){const T=i.length;x=new Array(T);for(let E=0;E!==T;++E)x[E]=i[E].clone()}return this.clippingPlanes=x,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}}class xh extends Hr{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ze(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Jd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const gl=q5();function q5(){const g=new ArrayBuffer(4),t=new Float32Array(g),i=new Uint32Array(g),x=new Uint32Array(512),T=new Uint32Array(512);for(let e=0;e<256;++e){const r=e-127;r<-27?(x[e]=0,x[e|256]=32768,T[e]=24,T[e|256]=24):r<-14?(x[e]=1024>>-r-14,x[e|256]=1024>>-r-14|32768,T[e]=-r-1,T[e|256]=-r-1):r<=15?(x[e]=r+15<<10,x[e|256]=r+15<<10|32768,T[e]=13,T[e|256]=13):r<128?(x[e]=31744,x[e|256]=64512,T[e]=24,T[e|256]=24):(x[e]=31744,x[e|256]=64512,T[e]=13,T[e|256]=13)}const E=new Uint32Array(2048),s=new Uint32Array(64),y=new Uint32Array(64);for(let e=1;e<1024;++e){let r=e<<13,p=0;for(;!(r&8388608);)r<<=1,p-=8388608;r&=-8388609,p+=947912704,E[e]=r|p}for(let e=1024;e<2048;++e)E[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=1199570944,s[32]=2147483648;for(let e=33;e<63;++e)s[e]=2147483648+(e-32<<23);s[63]=3347054592;for(let e=1;e<64;++e)e!==32&&(y[e]=1024);return{floatView:t,uint32View:i,baseTable:x,shiftTable:T,mantissaTable:E,exponentTable:s,offsetTable:y}}function Os(g){Math.abs(g)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),g=Kn(g,-65504,65504),gl.floatView[0]=g;const t=gl.uint32View[0],i=t>>23&511;return gl.baseTable[i]+((t&8388607)>>gl.shiftTable[i])}function nd(g){const t=g>>10;return gl.uint32View[0]=gl.mantissaTable[gl.offsetTable[t]+(g&1023)]+gl.exponentTable[t],gl.floatView[0]}const tN={toHalfFloat:Os,fromHalfFloat:nd},ur=new Ct,fv=new ve;class an{constructor(t,i,x=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=i,this.count=t!==void 0?t.length/i:0,this.normalized=x,this.usage=Od,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Ea,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return xu("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,i){this.updateRanges.push({start:t,count:i})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,i,x){t*=this.itemSize,x*=i.itemSize;for(let T=0,E=this.itemSize;T0&&(t.userData=this.userData),this.parameters!==void 0){const e=this.parameters;for(const r in e)e[r]!==void 0&&(t[r]=e[r]);return t}t.data={attributes:{}};const i=this.index;i!==null&&(t.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});const x=this.attributes;for(const e in x){const r=x[e];t.data.attributes[e]=r.toJSON(t.data)}const T={};let E=!1;for(const e in this.morphAttributes){const r=this.morphAttributes[e],p=[];for(let h=0,a=r.length;h0&&(T[e]=p,E=!0)}E&&(t.data.morphAttributes=T,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const y=this.boundingSphere;return y!==null&&(t.data.boundingSphere={center:y.center.toArray(),radius:y.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const i={};this.name=t.name;const x=t.index;x!==null&&this.setIndex(x.clone(i));const T=t.attributes;for(const r in T){const p=T[r];this.setAttribute(r,p.clone(i))}const E=t.morphAttributes;for(const r in E){const p=[],h=E[r];for(let a=0,l=h.length;a0){const T=i[x[0]];if(T!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let E=0,s=T.length;E(t.far-t.near)**2))&&(BT.copy(E).invert(),Qh.copy(t.ray).applyMatrix4(BT),!(x.boundingBox!==null&&Qh.intersectsBox(x.boundingBox)===!1)&&this._computeIntersections(t,i,Qh)))}_computeIntersections(t,i,x){let T;const E=this.geometry,s=this.material,y=E.index,e=E.attributes.position,r=E.attributes.uv,p=E.attributes.uv1,h=E.attributes.normal,a=E.groups,l=E.drawRange;if(y!==null)if(Array.isArray(s))for(let n=0,u=a.length;ni.far?null:{distance:r,point:yv.clone(),object:g}}function xv(g,t,i,x,T,E,s,y,e,r){g.getVertexPosition(y,mf),g.getVertexPosition(e,gf),g.getVertexPosition(r,yf);const p=hN(g,t,i,x,mf,gf,yf,gv);if(p){T&&(pv.fromBufferAttribute(T,y),vv.fromBufferAttribute(T,e),mv.fromBufferAttribute(T,r),p.uv=ia.getInterpolation(gv,mf,gf,yf,pv,vv,mv,new ve)),E&&(pv.fromBufferAttribute(E,y),vv.fromBufferAttribute(E,e),mv.fromBufferAttribute(E,r),p.uv1=ia.getInterpolation(gv,mf,gf,yf,pv,vv,mv,new ve),p.uv2=p.uv1),s&&(zT.fromBufferAttribute(s,y),GT.fromBufferAttribute(s,e),VT.fromBufferAttribute(s,r),p.normal=ia.getInterpolation(gv,mf,gf,yf,zT,GT,VT,new Ct),p.normal.dot(x.direction)>0&&p.normal.multiplyScalar(-1));const h={a:y,b:e,c:r,normal:new Ct,materialIndex:0};ia.getNormal(mf,gf,yf,h.normal),p.face=h}return p}class Fu extends Li{constructor(t=1,i=1,x=1,T=1,E=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:i,depth:x,widthSegments:T,heightSegments:E,depthSegments:s};const y=this;T=Math.floor(T),E=Math.floor(E),s=Math.floor(s);const e=[],r=[],p=[],h=[];let a=0,l=0;n("z","y","x",-1,-1,x,i,t,s,E,0),n("z","y","x",1,-1,x,i,-t,s,E,1),n("x","z","y",1,1,t,x,i,T,s,2),n("x","z","y",1,-1,t,x,-i,T,s,3),n("x","y","z",1,-1,t,i,x,T,E,4),n("x","y","z",-1,-1,t,i,-x,T,E,5),this.setIndex(e),this.setAttribute("position",new ke(r,3)),this.setAttribute("normal",new ke(p,3)),this.setAttribute("uv",new ke(h,2));function n(u,f,o,c,d,v,m,S,M,w,C){const A=v/M,P=m/w,b=v/2,O=m/2,I=S/2,D=M+1,B=w+1;let G=0,z=0;const X=new Ct;for(let j=0;j0?1:-1,p.push(X.x,X.y,X.z),h.push(tt/M),h.push(1-j/w),G+=1}}for(let j=0;j0&&(i.defines=this.defines),i.vertexShader=this.vertexShader,i.fragmentShader=this.fragmentShader,i.lights=this.lights,i.clipping=this.clipping;const x={};for(const T in this.extensions)this.extensions[T]===!0&&(x[T]=!0);return Object.keys(x).length>0&&(i.extensions=x),i}}class $d extends Yi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ci,this.projectionMatrix=new ci,this.projectionMatrixInverse=new ci,this.coordinateSystem=No}copy(t,i){return super.copy(t,i),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,i){super.updateWorldMatrix(t,i),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const nh=new Ct,WT=new ve,XT=new ve;class Or extends $d{constructor(t=50,i=1,x=.1,T=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=x,this.far=T,this.focus=10,this.aspect=i,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,i){return super.copy(t,i),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const i=.5*this.getFilmHeight()/t;this.fov=Jf*2*Math.atan(i),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(xu*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return Jf*2*Math.atan(Math.tan(xu*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,i,x){nh.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(nh.x,nh.y).multiplyScalar(-t/nh.z),nh.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),x.set(nh.x,nh.y).multiplyScalar(-t/nh.z)}getViewSize(t,i){return this.getViewBounds(t,WT,XT),i.subVectors(XT,WT)}setViewOffset(t,i,x,T,E,s){this.aspect=t/i,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=i,this.view.offsetX=x,this.view.offsetY=T,this.view.width=E,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let i=t*Math.tan(xu*.5*this.fov)/this.zoom,x=2*i,T=this.aspect*x,E=-.5*T;const s=this.view;if(this.view!==null&&this.view.enabled){const e=s.fullWidth,r=s.fullHeight;E+=s.offsetX*T/e,i-=s.offsetY*x/r,T*=s.width/e,x*=s.height/r}const y=this.filmOffset;y!==0&&(E+=t*y/this.getFilmWidth()),this.projectionMatrix.makePerspective(E,E+T,i,i-x,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const i=super.toJSON(t);return i.object.fov=this.fov,i.object.zoom=this.zoom,i.object.near=this.near,i.object.far=this.far,i.object.focus=this.focus,i.object.aspect=this.aspect,this.view!==null&&(i.object.view=Object.assign({},this.view)),i.object.filmGauge=this.filmGauge,i.object.filmOffset=this.filmOffset,i}}const Sf=-90,Tf=1;class mw extends Yi{constructor(t,i,x){super(),this.type="CubeCamera",this.renderTarget=x,this.coordinateSystem=null,this.activeMipmapLevel=0;const T=new Or(Sf,Tf,t,i);T.layers=this.layers,this.add(T);const E=new Or(Sf,Tf,t,i);E.layers=this.layers,this.add(E);const s=new Or(Sf,Tf,t,i);s.layers=this.layers,this.add(s);const y=new Or(Sf,Tf,t,i);y.layers=this.layers,this.add(y);const e=new Or(Sf,Tf,t,i);e.layers=this.layers,this.add(e);const r=new Or(Sf,Tf,t,i);r.layers=this.layers,this.add(r)}updateCoordinateSystem(){const t=this.coordinateSystem,i=this.children.concat(),[x,T,E,s,y,e]=i;for(const r of i)this.remove(r);if(t===No)x.up.set(0,1,0),x.lookAt(1,0,0),T.up.set(0,1,0),T.lookAt(-1,0,0),E.up.set(0,0,-1),E.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),y.up.set(0,1,0),y.lookAt(0,0,1),e.up.set(0,1,0),e.lookAt(0,0,-1);else if(t===Od)x.up.set(0,-1,0),x.lookAt(-1,0,0),T.up.set(0,-1,0),T.lookAt(1,0,0),E.up.set(0,0,1),E.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),y.up.set(0,-1,0),y.lookAt(0,0,1),e.up.set(0,-1,0),e.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(const r of i)this.add(r),r.updateMatrixWorld()}update(t,i){this.parent===null&&this.updateMatrixWorld();const{renderTarget:x,activeMipmapLevel:T}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[E,s,y,e,r,p]=this.children,h=t.getRenderTarget(),a=t.getActiveCubeFace(),l=t.getActiveMipmapLevel(),n=t.xr.enabled;t.xr.enabled=!1;const u=x.texture.generateMipmaps;x.texture.generateMipmaps=!1,t.setRenderTarget(x,0,T),t.render(i,E),t.setRenderTarget(x,1,T),t.render(i,s),t.setRenderTarget(x,2,T),t.render(i,y),t.setRenderTarget(x,3,T),t.render(i,e),t.setRenderTarget(x,4,T),t.render(i,r),x.texture.generateMipmaps=u,t.setRenderTarget(x,5,T),t.render(i,p),t.setRenderTarget(h,a,l),t.xr.enabled=n,x.texture.needsPMREMUpdate=!0}}class Qd extends Un{constructor(t,i,x,T,E,s,y,e,r,p){t=t!==void 0?t:[],i=i!==void 0?i:wl,super(t,i,x,T,E,s,y,e,r,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class gw extends io{constructor(t=1,i={}){super(t,t,i),this.isWebGLCubeRenderTarget=!0;const x={width:t,height:t,depth:1},T=[x,x,x,x,x,x];i.encoding!==void 0&&(Su("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===ch?vr:ea),this.texture=new Qd(T,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:Nn}fromEquirectangularTexture(t,i){this.texture.type=i.type,this.texture.colorSpace=i.colorSpace,this.texture.generateMipmaps=i.generateMipmaps,this.texture.minFilter=i.minFilter,this.texture.magFilter=i.magFilter;const x={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class no extends Hr{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=fN,this.fragmentShader=cN,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1,clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=$f(t.uniforms),this.uniformsGroups=uN(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const i=super.toJSON(t);i.glslVersion=this.glslVersion,i.uniforms={};for(const T in this.uniforms){const s=this.uniforms[T].value;s&&s.isTexture?i.uniforms[T]={type:"t",value:s.toJSON(t).uuid}:s&&s.isColor?i.uniforms[T]={type:"c",value:s.getHex()}:s&&s.isVector2?i.uniforms[T]={type:"v2",value:s.toArray()}:s&&s.isVector3?i.uniforms[T]={type:"v3",value:s.toArray()}:s&&s.isVector4?i.uniforms[T]={type:"v4",value:s.toArray()}:s&&s.isMatrix3?i.uniforms[T]={type:"m3",value:s.toArray()}:s&&s.isMatrix4?i.uniforms[T]={type:"m4",value:s.toArray()}:i.uniforms[T]={value:s}}Object.keys(this.defines).length>0&&(i.defines=this.defines),i.vertexShader=this.vertexShader,i.fragmentShader=this.fragmentShader,i.lights=this.lights,i.clipping=this.clipping;const x={};for(const T in this.extensions)this.extensions[T]===!0&&(x[T]=!0);return Object.keys(x).length>0&&(i.extensions=x),i}}class Qd extends Yi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ci,this.projectionMatrix=new ci,this.projectionMatrixInverse=new ci,this.coordinateSystem=No}copy(t,i){return super.copy(t,i),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,i){super.updateWorldMatrix(t,i),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const nh=new Ct,HT=new ve,WT=new ve;class Or extends Qd{constructor(t=50,i=1,x=.1,T=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=x,this.far=T,this.focus=10,this.aspect=i,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,i){return super.copy(t,i),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const i=.5*this.getFilmHeight()/t;this.fov=Jf*2*Math.atan(i),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(yu*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return Jf*2*Math.atan(Math.tan(yu*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,i,x){nh.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(nh.x,nh.y).multiplyScalar(-t/nh.z),nh.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),x.set(nh.x,nh.y).multiplyScalar(-t/nh.z)}getViewSize(t,i){return this.getViewBounds(t,HT,WT),i.subVectors(WT,HT)}setViewOffset(t,i,x,T,E,s){this.aspect=t/i,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=i,this.view.offsetX=x,this.view.offsetY=T,this.view.width=E,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let i=t*Math.tan(yu*.5*this.fov)/this.zoom,x=2*i,T=this.aspect*x,E=-.5*T;const s=this.view;if(this.view!==null&&this.view.enabled){const e=s.fullWidth,r=s.fullHeight;E+=s.offsetX*T/e,i-=s.offsetY*x/r,T*=s.width/e,x*=s.height/r}const y=this.filmOffset;y!==0&&(E+=t*y/this.getFilmWidth()),this.projectionMatrix.makePerspective(E,E+T,i,i-x,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const i=super.toJSON(t);return i.object.fov=this.fov,i.object.zoom=this.zoom,i.object.near=this.near,i.object.far=this.far,i.object.focus=this.focus,i.object.aspect=this.aspect,this.view!==null&&(i.object.view=Object.assign({},this.view)),i.object.filmGauge=this.filmGauge,i.object.filmOffset=this.filmOffset,i}}const xf=-90,Sf=1;class gw extends Yi{constructor(t,i,x){super(),this.type="CubeCamera",this.renderTarget=x,this.coordinateSystem=null,this.activeMipmapLevel=0;const T=new Or(xf,Sf,t,i);T.layers=this.layers,this.add(T);const E=new Or(xf,Sf,t,i);E.layers=this.layers,this.add(E);const s=new Or(xf,Sf,t,i);s.layers=this.layers,this.add(s);const y=new Or(xf,Sf,t,i);y.layers=this.layers,this.add(y);const e=new Or(xf,Sf,t,i);e.layers=this.layers,this.add(e);const r=new Or(xf,Sf,t,i);r.layers=this.layers,this.add(r)}updateCoordinateSystem(){const t=this.coordinateSystem,i=this.children.concat(),[x,T,E,s,y,e]=i;for(const r of i)this.remove(r);if(t===No)x.up.set(0,1,0),x.lookAt(1,0,0),T.up.set(0,1,0),T.lookAt(-1,0,0),E.up.set(0,0,-1),E.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),y.up.set(0,1,0),y.lookAt(0,0,1),e.up.set(0,1,0),e.lookAt(0,0,-1);else if(t===Dd)x.up.set(0,-1,0),x.lookAt(-1,0,0),T.up.set(0,-1,0),T.lookAt(1,0,0),E.up.set(0,0,1),E.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),y.up.set(0,-1,0),y.lookAt(0,0,1),e.up.set(0,-1,0),e.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(const r of i)this.add(r),r.updateMatrixWorld()}update(t,i){this.parent===null&&this.updateMatrixWorld();const{renderTarget:x,activeMipmapLevel:T}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[E,s,y,e,r,p]=this.children,h=t.getRenderTarget(),a=t.getActiveCubeFace(),l=t.getActiveMipmapLevel(),n=t.xr.enabled;t.xr.enabled=!1;const u=x.texture.generateMipmaps;x.texture.generateMipmaps=!1,t.setRenderTarget(x,0,T),t.render(i,E),t.setRenderTarget(x,1,T),t.render(i,s),t.setRenderTarget(x,2,T),t.render(i,y),t.setRenderTarget(x,3,T),t.render(i,e),t.setRenderTarget(x,4,T),t.render(i,r),x.texture.generateMipmaps=u,t.setRenderTarget(x,5,T),t.render(i,p),t.setRenderTarget(h,a,l),t.xr.enabled=n,x.texture.needsPMREMUpdate=!0}}class _d extends Un{constructor(t,i,x,T,E,s,y,e,r,p){t=t!==void 0?t:[],i=i!==void 0?i:wl,super(t,i,x,T,E,s,y,e,r,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class yw extends io{constructor(t=1,i={}){super(t,t,i),this.isWebGLCubeRenderTarget=!0;const x={width:t,height:t,depth:1},T=[x,x,x,x,x,x];i.encoding!==void 0&&(xu("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===ch?vr:ea),this.texture=new _d(T,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:Nn}fromEquirectangularTexture(t,i){this.texture.type=i.type,this.texture.colorSpace=i.colorSpace,this.texture.generateMipmaps=i.generateMipmaps,this.texture.minFilter=i.minFilter,this.texture.magFilter=i.magFilter;const x={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -6444,9 +6444,9 @@ tiled-property-flattener/dist/tiled_property_flattener.min.js: gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},T=new Ou(5,5,5),E=new no({name:"CubemapFromEquirect",uniforms:$f(x.uniforms),vertexShader:x.vertexShader,fragmentShader:x.fragmentShader,side:ms,blending:Ml});E.uniforms.tEquirect.value=i;const s=new cr(T,E),y=i.minFilter;return i.minFilter===Io&&(i.minFilter=Nn),new mw(1,10,this).update(t,s),i.minFilter=y,s.geometry.dispose(),s.material.dispose(),this}clear(t,i,x,T){const E=t.getRenderTarget();for(let s=0;s<6;s++)t.setRenderTarget(this,s),t.clear(i,x,T);t.setRenderTarget(E)}}const B0=new Ct,fN=new Ct,cN=new Oi;class ah{constructor(t=new Ct(1,0,0),i=0){this.isPlane=!0,this.normal=t,this.constant=i}set(t,i){return this.normal.copy(t),this.constant=i,this}setComponents(t,i,x,T){return this.normal.set(t,i,x),this.constant=T,this}setFromNormalAndCoplanarPoint(t,i){return this.normal.copy(t),this.constant=-i.dot(this.normal),this}setFromCoplanarPoints(t,i,x){const T=B0.subVectors(x,i).cross(fN.subVectors(t,i)).normalize();return this.setFromNormalAndCoplanarPoint(T,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,i){return i.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,i){const x=t.delta(B0),T=this.normal.dot(x);if(T===0)return this.distanceToPoint(t.start)===0?i.copy(t.start):null;const E=-(t.start.dot(this.normal)+this.constant)/T;return E<0||E>1?null:i.copy(t.start).addScaledVector(x,E)}intersectsLine(t){const i=this.distanceToPoint(t.start),x=this.distanceToPoint(t.end);return i<0&&x>0||x<0&&i>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,i){const x=i||cN.getNormalMatrix(t),T=this.coplanarPoint(B0).applyMatrix4(t),E=this.normal.applyMatrix3(x).normalize();return this.constant=-T.dot(E),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const qh=new $r,xv=new Ct;class _d{constructor(t=new ah,i=new ah,x=new ah,T=new ah,E=new ah,s=new ah){this.planes=[t,i,x,T,E,s]}set(t,i,x,T,E,s){const y=this.planes;return y[0].copy(t),y[1].copy(i),y[2].copy(x),y[3].copy(T),y[4].copy(E),y[5].copy(s),this}copy(t){const i=this.planes;for(let x=0;x<6;x++)i[x].copy(t.planes[x]);return this}setFromProjectionMatrix(t,i=No){const x=this.planes,T=t.elements,E=T[0],s=T[1],y=T[2],e=T[3],r=T[4],p=T[5],h=T[6],a=T[7],l=T[8],n=T[9],u=T[10],f=T[11],o=T[12],c=T[13],d=T[14],v=T[15];if(x[0].setComponents(e-E,a-r,f-l,v-o).normalize(),x[1].setComponents(e+E,a+r,f+l,v+o).normalize(),x[2].setComponents(e+s,a+p,f+n,v+c).normalize(),x[3].setComponents(e-s,a-p,f-n,v-c).normalize(),x[4].setComponents(e-y,a-h,f-u,v-d).normalize(),i===No)x[5].setComponents(e+y,a+h,f+u,v+d).normalize();else if(i===Od)x[5].setComponents(y,h,u,d).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+i);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),qh.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const i=t.geometry;i.boundingSphere===null&&i.computeBoundingSphere(),qh.copy(i.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(qh)}intersectsSprite(t){return qh.center.set(0,0,0),qh.radius=.7071067811865476,qh.applyMatrix4(t.matrixWorld),this.intersectsSphere(qh)}intersectsSphere(t){const i=this.planes,x=t.center,T=-t.radius;for(let E=0;E<6;E++)if(i[E].distanceToPoint(x)0?t.max.x:t.min.x,xv.y=T.normal.y>0?t.max.y:t.min.y,xv.z=T.normal.z>0?t.max.z:t.min.z,T.distanceToPoint(xv)<0)return!1}return!0}containsPoint(t){const i=this.planes;for(let x=0;x<6;x++)if(i[x].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function yw(){let g=null,t=!1,i=null,x=null;function T(E,s){i(E,s),x=g.requestAnimationFrame(T)}return{start:function(){t!==!0&&i!==null&&(x=g.requestAnimationFrame(T),t=!0)},stop:function(){g.cancelAnimationFrame(x),t=!1},setAnimationLoop:function(E){i=E},setContext:function(E){g=E}}}function dN(g,t){const i=t.isWebGL2,x=new WeakMap;function T(r,p){const h=r.array,a=r.usage,l=h.byteLength,n=g.createBuffer();g.bindBuffer(p,n),g.bufferData(p,h,a),r.onUploadCallback();let u;if(h instanceof Float32Array)u=g.FLOAT;else if(h instanceof Uint16Array)if(r.isFloat16BufferAttribute)if(i)u=g.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else u=g.UNSIGNED_SHORT;else if(h instanceof Int16Array)u=g.SHORT;else if(h instanceof Uint32Array)u=g.UNSIGNED_INT;else if(h instanceof Int32Array)u=g.INT;else if(h instanceof Int8Array)u=g.BYTE;else if(h instanceof Uint8Array)u=g.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)u=g.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:n,type:u,bytesPerElement:h.BYTES_PER_ELEMENT,version:r.version,size:l}}function E(r,p,h){const a=p.array,l=p._updateRange,n=p.updateRanges;if(g.bindBuffer(h,r),l.count===-1&&n.length===0&&g.bufferSubData(h,0,a),n.length!==0){for(let u=0,f=n.length;u1?null:i.copy(t.start).addScaledVector(x,E)}intersectsLine(t){const i=this.distanceToPoint(t.start),x=this.distanceToPoint(t.end);return i<0&&x>0||x<0&&i>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,i){const x=i||pN.getNormalMatrix(t),T=this.coplanarPoint(U0).applyMatrix4(t),E=this.normal.applyMatrix3(x).normalize();return this.constant=-T.dot(E),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const _h=new $r,Sv=new Ct;class qd{constructor(t=new ah,i=new ah,x=new ah,T=new ah,E=new ah,s=new ah){this.planes=[t,i,x,T,E,s]}set(t,i,x,T,E,s){const y=this.planes;return y[0].copy(t),y[1].copy(i),y[2].copy(x),y[3].copy(T),y[4].copy(E),y[5].copy(s),this}copy(t){const i=this.planes;for(let x=0;x<6;x++)i[x].copy(t.planes[x]);return this}setFromProjectionMatrix(t,i=No){const x=this.planes,T=t.elements,E=T[0],s=T[1],y=T[2],e=T[3],r=T[4],p=T[5],h=T[6],a=T[7],l=T[8],n=T[9],u=T[10],f=T[11],o=T[12],c=T[13],d=T[14],v=T[15];if(x[0].setComponents(e-E,a-r,f-l,v-o).normalize(),x[1].setComponents(e+E,a+r,f+l,v+o).normalize(),x[2].setComponents(e+s,a+p,f+n,v+c).normalize(),x[3].setComponents(e-s,a-p,f-n,v-c).normalize(),x[4].setComponents(e-y,a-h,f-u,v-d).normalize(),i===No)x[5].setComponents(e+y,a+h,f+u,v+d).normalize();else if(i===Dd)x[5].setComponents(y,h,u,d).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+i);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),_h.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const i=t.geometry;i.boundingSphere===null&&i.computeBoundingSphere(),_h.copy(i.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(_h)}intersectsSprite(t){return _h.center.set(0,0,0),_h.radius=.7071067811865476,_h.applyMatrix4(t.matrixWorld),this.intersectsSphere(_h)}intersectsSphere(t){const i=this.planes,x=t.center,T=-t.radius;for(let E=0;E<6;E++)if(i[E].distanceToPoint(x)0?t.max.x:t.min.x,Sv.y=T.normal.y>0?t.max.y:t.min.y,Sv.z=T.normal.z>0?t.max.z:t.min.z,T.distanceToPoint(Sv)<0)return!1}return!0}containsPoint(t){const i=this.planes;for(let x=0;x<6;x++)if(i[x].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function xw(){let g=null,t=!1,i=null,x=null;function T(E,s){i(E,s),x=g.requestAnimationFrame(T)}return{start:function(){t!==!0&&i!==null&&(x=g.requestAnimationFrame(T),t=!0)},stop:function(){g.cancelAnimationFrame(x),t=!1},setAnimationLoop:function(E){i=E},setContext:function(E){g=E}}}function vN(g,t){const i=t.isWebGL2,x=new WeakMap;function T(r,p){const h=r.array,a=r.usage,l=h.byteLength,n=g.createBuffer();g.bindBuffer(p,n),g.bufferData(p,h,a),r.onUploadCallback();let u;if(h instanceof Float32Array)u=g.FLOAT;else if(h instanceof Uint16Array)if(r.isFloat16BufferAttribute)if(i)u=g.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else u=g.UNSIGNED_SHORT;else if(h instanceof Int16Array)u=g.SHORT;else if(h instanceof Uint32Array)u=g.UNSIGNED_INT;else if(h instanceof Int32Array)u=g.INT;else if(h instanceof Int8Array)u=g.BYTE;else if(h instanceof Uint8Array)u=g.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)u=g.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:n,type:u,bytesPerElement:h.BYTES_PER_ELEMENT,version:r.version,size:l}}function E(r,p,h){const a=p.array,l=p._updateRange,n=p.updateRanges;if(g.bindBuffer(h,r),l.count===-1&&n.length===0&&g.bufferSubData(h,0,a),n.length!==0){for(let u=0,f=n.length;u 0 +#endif`,FN=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; @@ -6676,26 +6676,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve if ( clipped ) discard; #endif #endif -#endif`,LN=`#if NUM_CLIPPING_PLANES > 0 +#endif`,ON=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,FN=`#if NUM_CLIPPING_PLANES > 0 +#endif`,DN=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,ON=`#if NUM_CLIPPING_PLANES > 0 +#endif`,IN=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,DN=`#if defined( USE_COLOR_ALPHA ) +#endif`,NN=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,IN=`#if defined( USE_COLOR_ALPHA ) +#endif`,BN=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,NN=`#if defined( USE_COLOR_ALPHA ) +#endif`,UN=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; -#endif`,BN=`#if defined( USE_COLOR_ALPHA ) +#endif`,zN=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); @@ -6705,7 +6705,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; -#endif`,UN=`#define PI 3.141592653589793 +#endif`,GN=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -6783,7 +6783,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,zN=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,VN=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -6876,7 +6876,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { return vec4( mix( color0, color1, mipF ), 1.0 ); } } -#endif`,GN=`vec3 transformedNormal = objectNormal; +#endif`,HN=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif @@ -6905,18 +6905,18 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,VN=`#ifdef USE_DISPLACEMENTMAP +#endif`,WN=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,HN=`#ifdef USE_DISPLACEMENTMAP +#endif`,XN=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,WN=`#ifdef USE_EMISSIVEMAP +#endif`,YN=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,XN=`#ifdef USE_EMISSIVEMAP +#endif`,kN=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,YN="gl_FragColor = linearToOutputTexel( gl_FragColor );",kN=` +#endif`,jN="gl_FragColor = linearToOutputTexel( gl_FragColor );",KN=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), @@ -6944,7 +6944,7 @@ vec4 LinearToLinear( in vec4 value ) { } vec4 LinearTosRGB( in vec4 value ) { return sRGBTransferOETF( value ); -}`,KN=`#ifdef USE_ENVMAP +}`,ZN=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -6973,7 +6973,7 @@ vec4 LinearTosRGB( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,jN=`#ifdef USE_ENVMAP +#endif`,JN=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE @@ -6982,7 +6982,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,ZN=`#ifdef USE_ENVMAP +#endif`,$N=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -6993,7 +6993,7 @@ vec4 LinearTosRGB( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,JN=`#ifdef USE_ENVMAP +#endif`,QN=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -7004,7 +7004,7 @@ vec4 LinearTosRGB( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,$N=`#ifdef USE_ENVMAP +#endif`,_N=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -7021,18 +7021,18 @@ vec4 LinearTosRGB( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,QN=`#ifdef USE_FOG +#endif`,qN=`#ifdef USE_FOG vFogDepth = - mvPosition.z; -#endif`,_N=`#ifdef USE_FOG +#endif`,t9=`#ifdef USE_FOG varying float vFogDepth; -#endif`,qN=`#ifdef USE_FOG +#endif`,e9=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,t9=`#ifdef USE_FOG +#endif`,i9=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -7041,7 +7041,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,e9=`#ifdef USE_GRADIENTMAP +#endif`,n9=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -7053,16 +7053,16 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif -}`,i9=`#ifdef USE_LIGHTMAP +}`,r9=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,n9=`#ifdef USE_LIGHTMAP +#endif`,s9=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,r9=`LambertMaterial material; +#endif`,a9=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,s9=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,o9=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -7076,7 +7076,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,a9=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,l9=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; @@ -7199,7 +7199,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,o9=`#ifdef USE_ENVMAP +#endif`,h9=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -7232,8 +7232,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi #endif } #endif -#endif`,l9=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,h9=`varying vec3 vViewPosition; +#endif`,u9=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,f9=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -7245,11 +7245,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,u9=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,c9=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,f9=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,d9=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -7266,7 +7266,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,c9=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,p9=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); @@ -7349,7 +7349,7 @@ material.roughness = min( material.roughness, 1.0 ); material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,d9=`struct PhysicalMaterial { +#endif`,v9=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -7649,7 +7649,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,p9=` +}`,m9=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); @@ -7764,7 +7764,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,v9=`#if defined( RE_IndirectDiffuse ) +#endif`,g9=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -7783,25 +7783,25 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,m9=`#if defined( RE_IndirectDiffuse ) +#endif`,y9=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,g9=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,x9=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,y9=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,S9=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,x9=`#ifdef USE_LOGDEPTHBUF +#endif`,T9=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif -#endif`,S9=`#ifdef USE_LOGDEPTHBUF +#endif`,E9=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); @@ -7811,16 +7811,16 @@ IncidentLight directLight; gl_Position.z *= gl_Position.w; } #endif -#endif`,T9=`#ifdef USE_MAP +#endif`,M9=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; -#endif`,E9=`#ifdef USE_MAP +#endif`,C9=`#ifdef USE_MAP uniform sampler2D map; -#endif`,M9=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,w9=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -7832,7 +7832,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,C9=`#if defined( USE_POINTS_UV ) +#endif`,A9=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -7844,13 +7844,13 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,w9=`float metalnessFactor = metalness; +#endif`,P9=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,A9=`#ifdef USE_METALNESSMAP +#endif`,R9=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,P9=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) +#endif`,b9=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -7859,7 +7859,7 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,R9=`#ifdef USE_MORPHNORMALS +#endif`,L9=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -7871,7 +7871,7 @@ IncidentLight directLight; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif -#endif`,b9=`#ifdef USE_MORPHTARGETS +#endif`,F9=`#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -7891,7 +7891,7 @@ IncidentLight directLight; uniform float morphTargetInfluences[ 4 ]; #endif #endif -#endif`,L9=`#ifdef USE_MORPHTARGETS +#endif`,O9=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -7909,7 +7909,7 @@ IncidentLight directLight; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif -#endif`,F9=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,D9=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -7950,7 +7950,7 @@ IncidentLight directLight; tbn2[1] *= faceDirection; #endif #endif -vec3 nonPerturbedNormal = normal;`,O9=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,I9=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -7965,25 +7965,25 @@ vec3 nonPerturbedNormal = normal;`,O9=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,D9=`#ifndef FLAT_SHADED +#endif`,N9=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,I9=`#ifndef FLAT_SHADED +#endif`,B9=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,N9=`#ifndef FLAT_SHADED +#endif`,U9=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,B9=`#ifdef USE_NORMALMAP +#endif`,z9=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -8005,13 +8005,13 @@ vec3 nonPerturbedNormal = normal;`,O9=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,U9=`#ifdef USE_CLEARCOAT +#endif`,G9=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,z9=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,V9=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,G9=`#ifdef USE_CLEARCOATMAP +#endif`,H9=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -8020,18 +8020,18 @@ vec3 nonPerturbedNormal = normal;`,O9=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,V9=`#ifdef USE_IRIDESCENCEMAP +#endif`,W9=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,H9=`#ifdef OPAQUE +#endif`,X9=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,W9=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Y9=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -8072,9 +8072,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); -}`,X9=`#ifdef PREMULTIPLIED_ALPHA +}`,k9=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,Y9=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,j9=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif @@ -8082,22 +8082,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,k9=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,K9=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,K9=`#ifdef DITHERING +#endif`,Z9=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } -#endif`,j9=`float roughnessFactor = roughness; +#endif`,J9=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,Z9=`#ifdef USE_ROUGHNESSMAP +#endif`,$9=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,J9=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,Q9=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -8274,7 +8274,7 @@ gl_Position = projectionMatrix * mvPosition;`,k9=`#ifdef DITHERING return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } -#endif`,$9=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,_9=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -8312,7 +8312,7 @@ gl_Position = projectionMatrix * mvPosition;`,k9=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,Q9=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,q9=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif @@ -8344,7 +8344,7 @@ gl_Position = projectionMatrix * mvPosition;`,k9=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,_9=`float getShadowMask() { +#endif`,tB=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -8376,12 +8376,12 @@ gl_Position = projectionMatrix * mvPosition;`,k9=`#ifdef DITHERING #endif #endif return shadow; -}`,q9=`#ifdef USE_SKINNING +}`,eB=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,tB=`#ifdef USE_SKINNING +#endif`,iB=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -8396,7 +8396,7 @@ gl_Position = projectionMatrix * mvPosition;`,k9=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,eB=`#ifdef USE_SKINNING +#endif`,nB=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -8404,7 +8404,7 @@ gl_Position = projectionMatrix * mvPosition;`,k9=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,iB=`#ifdef USE_SKINNING +#endif`,rB=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -8415,17 +8415,17 @@ gl_Position = projectionMatrix * mvPosition;`,k9=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,nB=`float specularStrength; +#endif`,sB=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,rB=`#ifdef USE_SPECULARMAP +#endif`,aB=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,sB=`#if defined( TONE_MAPPING ) +#endif`,oB=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,aB=`#ifndef saturate +#endif`,lB=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -8507,7 +8507,7 @@ vec3 AgXToneMapping( vec3 color ) { color = clamp( color, 0.0, 1.0 ); return color; } -vec3 CustomToneMapping( vec3 color ) { return color; }`,oB=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,hB=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -8528,7 +8528,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,oB=`#ifdef USE_TRANSMISS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,lB=`#ifdef USE_TRANSMISSION +#endif`,uB=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -8634,7 +8634,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,oB=`#ifdef USE_TRANSMISS float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } -#endif`,hB=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,fB=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -8704,7 +8704,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,oB=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,uB=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,cB=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -8798,7 +8798,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,oB=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,fB=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,dB=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -8869,7 +8869,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,oB=`#ifdef USE_TRANSMISS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,cB=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,pB=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; @@ -8878,12 +8878,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,oB=`#ifdef USE_TRANSMISS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const dB=`varying vec2 vUv; +#endif`;const vB=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,pB=`uniform sampler2D t2D; +}`,mB=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -8895,14 +8895,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,vB=`varying vec3 vWorldDirection; +}`,gB=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,mB=`#ifdef ENVMAP_TYPE_CUBE +}`,yB=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -8924,14 +8924,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,gB=`varying vec3 vWorldDirection; +}`,xB=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,yB=`uniform samplerCube tCube; +}`,SB=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -8941,7 +8941,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,xB=`#include +}`,TB=`#include #include #include #include @@ -8967,7 +8967,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,SB=`#if DEPTH_PACKING == 3200 +}`,EB=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -8997,7 +8997,7 @@ void main() { #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif -}`,TB=`#define DISTANCE +}`,MB=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -9023,7 +9023,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,EB=`#define DISTANCE +}`,CB=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -9047,13 +9047,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,MB=`varying vec3 vWorldDirection; +}`,wB=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,CB=`uniform sampler2D tEquirect; +}`,AB=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -9062,7 +9062,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,wB=`uniform float scale; +}`,PB=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -9083,7 +9083,7 @@ void main() { #include #include #include -}`,AB=`uniform vec3 diffuse; +}`,RB=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -9111,7 +9111,7 @@ void main() { #include #include #include -}`,PB=`#include +}`,bB=`#include #include #include #include @@ -9142,7 +9142,7 @@ void main() { #include #include #include -}`,RB=`uniform vec3 diffuse; +}`,LB=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -9190,7 +9190,7 @@ void main() { #include #include #include -}`,bB=`#define LAMBERT +}`,FB=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -9228,7 +9228,7 @@ void main() { #include #include #include -}`,LB=`#define LAMBERT +}`,OB=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -9285,7 +9285,7 @@ void main() { #include #include #include -}`,FB=`#define MATCAP +}`,DB=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -9318,7 +9318,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,OB=`#define MATCAP +}`,IB=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -9364,7 +9364,7 @@ void main() { #include #include #include -}`,DB=`#define NORMAL +}`,NB=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -9396,7 +9396,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,IB=`#define NORMAL +}`,BB=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -9418,7 +9418,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,NB=`#define PHONG +}`,UB=`#define PHONG varying vec3 vViewPosition; #include #include @@ -9456,7 +9456,7 @@ void main() { #include #include #include -}`,BB=`#define PHONG +}`,zB=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -9515,7 +9515,7 @@ void main() { #include #include #include -}`,UB=`#define STANDARD +}`,GB=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -9557,7 +9557,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,zB=`#define STANDARD +}`,VB=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -9679,7 +9679,7 @@ void main() { #include #include #include -}`,GB=`#define TOON +}`,HB=`#define TOON varying vec3 vViewPosition; #include #include @@ -9715,7 +9715,7 @@ void main() { #include #include #include -}`,VB=`#define TOON +}`,WB=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -9768,7 +9768,7 @@ void main() { #include #include #include -}`,HB=`uniform float size; +}`,XB=`uniform float size; uniform float scale; #include #include @@ -9798,7 +9798,7 @@ void main() { #include #include #include -}`,WB=`uniform vec3 diffuse; +}`,YB=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -9823,7 +9823,7 @@ void main() { #include #include #include -}`,XB=`#include +}`,kB=`#include #include #include #include @@ -9845,7 +9845,7 @@ void main() { #include #include #include -}`,YB=`uniform vec3 color; +}`,jB=`uniform vec3 color; uniform float opacity; #include #include @@ -9861,7 +9861,7 @@ void main() { #include #include #include -}`,kB=`uniform float rotation; +}`,KB=`uniform float rotation; uniform vec2 center; #include #include @@ -9887,7 +9887,7 @@ void main() { #include #include #include -}`,KB=`uniform vec3 diffuse; +}`,ZB=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -9912,7 +9912,7 @@ void main() { #include #include #include -}`,bi={alphahash_fragment:pN,alphahash_pars_fragment:vN,alphamap_fragment:mN,alphamap_pars_fragment:gN,alphatest_fragment:yN,alphatest_pars_fragment:xN,aomap_fragment:SN,aomap_pars_fragment:TN,batching_pars_vertex:EN,batching_vertex:MN,begin_vertex:CN,beginnormal_vertex:wN,bsdfs:AN,iridescence_fragment:PN,bumpmap_pars_fragment:RN,clipping_planes_fragment:bN,clipping_planes_pars_fragment:LN,clipping_planes_pars_vertex:FN,clipping_planes_vertex:ON,color_fragment:DN,color_pars_fragment:IN,color_pars_vertex:NN,color_vertex:BN,common:UN,cube_uv_reflection_fragment:zN,defaultnormal_vertex:GN,displacementmap_pars_vertex:VN,displacementmap_vertex:HN,emissivemap_fragment:WN,emissivemap_pars_fragment:XN,colorspace_fragment:YN,colorspace_pars_fragment:kN,envmap_fragment:KN,envmap_common_pars_fragment:jN,envmap_pars_fragment:ZN,envmap_pars_vertex:JN,envmap_physical_pars_fragment:o9,envmap_vertex:$N,fog_vertex:QN,fog_pars_vertex:_N,fog_fragment:qN,fog_pars_fragment:t9,gradientmap_pars_fragment:e9,lightmap_fragment:i9,lightmap_pars_fragment:n9,lights_lambert_fragment:r9,lights_lambert_pars_fragment:s9,lights_pars_begin:a9,lights_toon_fragment:l9,lights_toon_pars_fragment:h9,lights_phong_fragment:u9,lights_phong_pars_fragment:f9,lights_physical_fragment:c9,lights_physical_pars_fragment:d9,lights_fragment_begin:p9,lights_fragment_maps:v9,lights_fragment_end:m9,logdepthbuf_fragment:g9,logdepthbuf_pars_fragment:y9,logdepthbuf_pars_vertex:x9,logdepthbuf_vertex:S9,map_fragment:T9,map_pars_fragment:E9,map_particle_fragment:M9,map_particle_pars_fragment:C9,metalnessmap_fragment:w9,metalnessmap_pars_fragment:A9,morphcolor_vertex:P9,morphnormal_vertex:R9,morphtarget_pars_vertex:b9,morphtarget_vertex:L9,normal_fragment_begin:F9,normal_fragment_maps:O9,normal_pars_fragment:D9,normal_pars_vertex:I9,normal_vertex:N9,normalmap_pars_fragment:B9,clearcoat_normal_fragment_begin:U9,clearcoat_normal_fragment_maps:z9,clearcoat_pars_fragment:G9,iridescence_pars_fragment:V9,opaque_fragment:H9,packing:W9,premultiplied_alpha_fragment:X9,project_vertex:Y9,dithering_fragment:k9,dithering_pars_fragment:K9,roughnessmap_fragment:j9,roughnessmap_pars_fragment:Z9,shadowmap_pars_fragment:J9,shadowmap_pars_vertex:$9,shadowmap_vertex:Q9,shadowmask_pars_fragment:_9,skinbase_vertex:q9,skinning_pars_vertex:tB,skinning_vertex:eB,skinnormal_vertex:iB,specularmap_fragment:nB,specularmap_pars_fragment:rB,tonemapping_fragment:sB,tonemapping_pars_fragment:aB,transmission_fragment:oB,transmission_pars_fragment:lB,uv_pars_fragment:hB,uv_pars_vertex:uB,uv_vertex:fB,worldpos_vertex:cB,background_vert:dB,background_frag:pB,backgroundCube_vert:vB,backgroundCube_frag:mB,cube_vert:gB,cube_frag:yB,depth_vert:xB,depth_frag:SB,distanceRGBA_vert:TB,distanceRGBA_frag:EB,equirect_vert:MB,equirect_frag:CB,linedashed_vert:wB,linedashed_frag:AB,meshbasic_vert:PB,meshbasic_frag:RB,meshlambert_vert:bB,meshlambert_frag:LB,meshmatcap_vert:FB,meshmatcap_frag:OB,meshnormal_vert:DB,meshnormal_frag:IB,meshphong_vert:NB,meshphong_frag:BB,meshphysical_vert:UB,meshphysical_frag:zB,meshtoon_vert:GB,meshtoon_frag:VB,points_vert:HB,points_frag:WB,shadow_vert:XB,shadow_frag:YB,sprite_vert:kB,sprite_frag:KB},Fe={common:{diffuse:{value:new ze(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Oi},alphaMap:{value:null},alphaMapTransform:{value:new Oi},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Oi}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Oi}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Oi}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Oi},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Oi},normalScale:{value:new ve(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Oi},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Oi}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Oi}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Oi}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ze(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ze(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Oi},alphaTest:{value:0},uvTransform:{value:new Oi}},sprite:{diffuse:{value:new ze(16777215)},opacity:{value:1},center:{value:new ve(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Oi},alphaMap:{value:null},alphaMapTransform:{value:new Oi},alphaTest:{value:0}}},to={basic:{uniforms:ds([Fe.common,Fe.specularmap,Fe.envmap,Fe.aomap,Fe.lightmap,Fe.fog]),vertexShader:bi.meshbasic_vert,fragmentShader:bi.meshbasic_frag},lambert:{uniforms:ds([Fe.common,Fe.specularmap,Fe.envmap,Fe.aomap,Fe.lightmap,Fe.emissivemap,Fe.bumpmap,Fe.normalmap,Fe.displacementmap,Fe.fog,Fe.lights,{emissive:{value:new ze(0)}}]),vertexShader:bi.meshlambert_vert,fragmentShader:bi.meshlambert_frag},phong:{uniforms:ds([Fe.common,Fe.specularmap,Fe.envmap,Fe.aomap,Fe.lightmap,Fe.emissivemap,Fe.bumpmap,Fe.normalmap,Fe.displacementmap,Fe.fog,Fe.lights,{emissive:{value:new ze(0)},specular:{value:new ze(1118481)},shininess:{value:30}}]),vertexShader:bi.meshphong_vert,fragmentShader:bi.meshphong_frag},standard:{uniforms:ds([Fe.common,Fe.envmap,Fe.aomap,Fe.lightmap,Fe.emissivemap,Fe.bumpmap,Fe.normalmap,Fe.displacementmap,Fe.roughnessmap,Fe.metalnessmap,Fe.fog,Fe.lights,{emissive:{value:new ze(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:bi.meshphysical_vert,fragmentShader:bi.meshphysical_frag},toon:{uniforms:ds([Fe.common,Fe.aomap,Fe.lightmap,Fe.emissivemap,Fe.bumpmap,Fe.normalmap,Fe.displacementmap,Fe.gradientmap,Fe.fog,Fe.lights,{emissive:{value:new ze(0)}}]),vertexShader:bi.meshtoon_vert,fragmentShader:bi.meshtoon_frag},matcap:{uniforms:ds([Fe.common,Fe.bumpmap,Fe.normalmap,Fe.displacementmap,Fe.fog,{matcap:{value:null}}]),vertexShader:bi.meshmatcap_vert,fragmentShader:bi.meshmatcap_frag},points:{uniforms:ds([Fe.points,Fe.fog]),vertexShader:bi.points_vert,fragmentShader:bi.points_frag},dashed:{uniforms:ds([Fe.common,Fe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:bi.linedashed_vert,fragmentShader:bi.linedashed_frag},depth:{uniforms:ds([Fe.common,Fe.displacementmap]),vertexShader:bi.depth_vert,fragmentShader:bi.depth_frag},normal:{uniforms:ds([Fe.common,Fe.bumpmap,Fe.normalmap,Fe.displacementmap,{opacity:{value:1}}]),vertexShader:bi.meshnormal_vert,fragmentShader:bi.meshnormal_frag},sprite:{uniforms:ds([Fe.sprite,Fe.fog]),vertexShader:bi.sprite_vert,fragmentShader:bi.sprite_frag},background:{uniforms:{uvTransform:{value:new Oi},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:bi.background_vert,fragmentShader:bi.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:bi.backgroundCube_vert,fragmentShader:bi.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:bi.cube_vert,fragmentShader:bi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:bi.equirect_vert,fragmentShader:bi.equirect_frag},distanceRGBA:{uniforms:ds([Fe.common,Fe.displacementmap,{referencePosition:{value:new Ct},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:bi.distanceRGBA_vert,fragmentShader:bi.distanceRGBA_frag},shadow:{uniforms:ds([Fe.lights,Fe.fog,{color:{value:new ze(0)},opacity:{value:1}}]),vertexShader:bi.shadow_vert,fragmentShader:bi.shadow_frag}};to.physical={uniforms:ds([to.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Oi},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Oi},clearcoatNormalScale:{value:new ve(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Oi},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Oi},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Oi},sheen:{value:0},sheenColor:{value:new ze(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Oi},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Oi},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Oi},transmissionSamplerSize:{value:new ve},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Oi},attenuationDistance:{value:0},attenuationColor:{value:new ze(0)},specularColor:{value:new ze(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Oi},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Oi},anisotropyVector:{value:new ve},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Oi}}]),vertexShader:bi.meshphysical_vert,fragmentShader:bi.meshphysical_frag};const Sv={r:0,b:0,g:0};function jB(g,t,i,x,T,E,s){const y=new ze(0);let e=E===!0?0:1,r,p,h=null,a=0,l=null;function n(f,o){let c=!1,d=o.isScene===!0?o.background:null;d&&d.isTexture&&(d=(o.backgroundBlurriness>0?i:t).get(d)),d===null?u(y,e):d&&d.isColor&&(u(d,1),c=!0);const v=g.xr.getEnvironmentBlendMode();v==="additive"?x.buffers.color.setClear(0,0,0,1,s):v==="alpha-blend"&&x.buffers.color.setClear(0,0,0,0,s),(g.autoClear||c)&&g.clear(g.autoClearColor,g.autoClearDepth,g.autoClearStencil),d&&(d.isCubeTexture||d.mapping===ec)?(p===void 0&&(p=new cr(new Ou(1,1,1),new no({name:"BackgroundCubeMaterial",uniforms:$f(to.backgroundCube.uniforms),vertexShader:to.backgroundCube.vertexShader,fragmentShader:to.backgroundCube.fragmentShader,side:ms,depthTest:!1,depthWrite:!1,fog:!1})),p.geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(m,S,M){this.matrixWorld.copyPosition(M.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),T.update(p)),p.material.uniforms.envMap.value=d,p.material.uniforms.flipEnvMap.value=d.isCubeTexture&&d.isRenderTargetTexture===!1?-1:1,p.material.uniforms.backgroundBlurriness.value=o.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=o.backgroundIntensity,p.material.toneMapped=rn.getTransfer(d.colorSpace)!==vn,(h!==d||a!==d.version||l!==g.toneMapping)&&(p.material.needsUpdate=!0,h=d,a=d.version,l=g.toneMapping),p.layers.enableAll(),f.unshift(p,p.geometry,p.material,0,0,null)):d&&d.isTexture&&(r===void 0&&(r=new cr(new nc(2,2),new no({name:"BackgroundMaterial",uniforms:$f(to.background.uniforms),vertexShader:to.background.vertexShader,fragmentShader:to.background.fragmentShader,side:Cl,depthTest:!1,depthWrite:!1,fog:!1})),r.geometry.deleteAttribute("normal"),Object.defineProperty(r.material,"map",{get:function(){return this.uniforms.t2D.value}}),T.update(r)),r.material.uniforms.t2D.value=d,r.material.uniforms.backgroundIntensity.value=o.backgroundIntensity,r.material.toneMapped=rn.getTransfer(d.colorSpace)!==vn,d.matrixAutoUpdate===!0&&d.updateMatrix(),r.material.uniforms.uvTransform.value.copy(d.matrix),(h!==d||a!==d.version||l!==g.toneMapping)&&(r.material.needsUpdate=!0,h=d,a=d.version,l=g.toneMapping),r.layers.enableAll(),f.unshift(r,r.geometry,r.material,0,0,null))}function u(f,o){f.getRGB(Sv,pw(g)),x.buffers.color.setClear(Sv.r,Sv.g,Sv.b,o,s)}return{getClearColor:function(){return y},setClearColor:function(f,o=1){y.set(f),e=o,u(y,e)},getClearAlpha:function(){return e},setClearAlpha:function(f){e=f,u(y,e)},render:n}}function ZB(g,t,i,x){const T=g.getParameter(g.MAX_VERTEX_ATTRIBS),E=x.isWebGL2?null:t.get("OES_vertex_array_object"),s=x.isWebGL2||E!==null,y={},e=f(null);let r=e,p=!1;function h(I,D,B,G,z){let X=!1;if(s){const K=u(G,B,D);r!==K&&(r=K,l(r.object)),X=o(I,G,B,z),X&&c(I,G,B,z)}else{const K=D.wireframe===!0;(r.geometry!==G.id||r.program!==B.id||r.wireframe!==K)&&(r.geometry=G.id,r.program=B.id,r.wireframe=K,X=!0)}z!==null&&i.update(z,g.ELEMENT_ARRAY_BUFFER),(X||p)&&(p=!1,w(I,D,B,G),z!==null&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,i.get(z).buffer))}function a(){return x.isWebGL2?g.createVertexArray():E.createVertexArrayOES()}function l(I){return x.isWebGL2?g.bindVertexArray(I):E.bindVertexArrayOES(I)}function n(I){return x.isWebGL2?g.deleteVertexArray(I):E.deleteVertexArrayOES(I)}function u(I,D,B){const G=B.wireframe===!0;let z=y[I.id];z===void 0&&(z={},y[I.id]=z);let X=z[D.id];X===void 0&&(X={},z[D.id]=X);let K=X[G];return K===void 0&&(K=f(a()),X[G]=K),K}function f(I){const D=[],B=[],G=[];for(let z=0;z=0){const Z=z[tt];let U=X[tt];if(U===void 0&&(tt==="instanceMatrix"&&I.instanceMatrix&&(U=I.instanceMatrix),tt==="instanceColor"&&I.instanceColor&&(U=I.instanceColor)),Z===void 0||Z.attribute!==U||U&&Z.data!==U.data)return!0;K++}return r.attributesNum!==K||r.index!==G}function c(I,D,B,G){const z={},X=D.attributes;let K=0;const Q=B.getAttributes();for(const tt in Q)if(Q[tt].location>=0){let Z=X[tt];Z===void 0&&(tt==="instanceMatrix"&&I.instanceMatrix&&(Z=I.instanceMatrix),tt==="instanceColor"&&I.instanceColor&&(Z=I.instanceColor));const U={};U.attribute=Z,Z&&Z.data&&(U.data=Z.data),z[tt]=U,K++}r.attributes=z,r.attributesNum=K,r.index=G}function d(){const I=r.newAttributes;for(let D=0,B=I.length;D=0){let Y=z[Q];if(Y===void 0&&(Q==="instanceMatrix"&&I.instanceMatrix&&(Y=I.instanceMatrix),Q==="instanceColor"&&I.instanceColor&&(Y=I.instanceColor)),Y!==void 0){const Z=Y.normalized,U=Y.itemSize,H=i.get(Y);if(H===void 0)continue;const J=H.buffer,_=H.type,q=H.bytesPerElement,at=x.isWebGL2===!0&&(_===g.INT||_===g.UNSIGNED_INT||Y.gpuType===r1);if(Y.isInterleavedBufferAttribute){const ot=Y.data,rt=ot.stride,gt=Y.offset;if(ot.isInstancedInterleavedBuffer){for(let yt=0;yt0&&g.getShaderPrecisionFormat(g.FRAGMENT_SHADER,g.HIGH_FLOAT).precision>0)return"highp";M="mediump"}return M==="mediump"&&g.getShaderPrecisionFormat(g.VERTEX_SHADER,g.MEDIUM_FLOAT).precision>0&&g.getShaderPrecisionFormat(g.FRAGMENT_SHADER,g.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const s=typeof WebGL2RenderingContext<"u"&&g.constructor.name==="WebGL2RenderingContext";let y=i.precision!==void 0?i.precision:"highp";const e=E(y);e!==y&&(console.warn("THREE.WebGLRenderer:",y,"not supported, using",e,"instead."),y=e);const r=s||t.has("WEBGL_draw_buffers"),p=i.logarithmicDepthBuffer===!0,h=g.getParameter(g.MAX_TEXTURE_IMAGE_UNITS),a=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l=g.getParameter(g.MAX_TEXTURE_SIZE),n=g.getParameter(g.MAX_CUBE_MAP_TEXTURE_SIZE),u=g.getParameter(g.MAX_VERTEX_ATTRIBS),f=g.getParameter(g.MAX_VERTEX_UNIFORM_VECTORS),o=g.getParameter(g.MAX_VARYING_VECTORS),c=g.getParameter(g.MAX_FRAGMENT_UNIFORM_VECTORS),d=a>0,v=s||t.has("OES_texture_float"),m=d&&v,S=s?g.getParameter(g.MAX_SAMPLES):0;return{isWebGL2:s,drawBuffers:r,getMaxAnisotropy:T,getMaxPrecision:E,precision:y,logarithmicDepthBuffer:p,maxTextures:h,maxVertexTextures:a,maxTextureSize:l,maxCubemapSize:n,maxAttributes:u,maxVertexUniforms:f,maxVaryings:o,maxFragmentUniforms:c,vertexTextures:d,floatFragmentTextures:v,floatVertexTextures:m,maxSamples:S}}function QB(g){const t=this;let i=null,x=0,T=!1,E=!1;const s=new ah,y=new Oi,e={value:null,needsUpdate:!1};this.uniform=e,this.numPlanes=0,this.numIntersection=0,this.init=function(h,a){const l=h.length!==0||a||x!==0||T;return T=a,x=h.length,l},this.beginShadows=function(){E=!0,p(null)},this.endShadows=function(){E=!1},this.setGlobalState=function(h,a){i=p(h,a,0)},this.setState=function(h,a,l){const n=h.clippingPlanes,u=h.clipIntersection,f=h.clipShadows,o=g.get(h);if(!T||n===null||n.length===0||E&&!f)E?p(null):r();else{const c=E?0:x,d=c*4;let v=o.clippingState||null;e.value=v,v=p(n,a,d,l);for(let m=0;m!==d;++m)v[m]=i[m];o.clippingState=v,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=c}};function r(){e.value!==i&&(e.value=i,e.needsUpdate=x>0),t.numPlanes=x,t.numIntersection=0}function p(h,a,l,n){const u=h!==null?h.length:0;let f=null;if(u!==0){if(f=e.value,n!==!0||f===null){const o=l+u*4,c=a.matrixWorldInverse;y.getNormalMatrix(c),(f===null||f.length0){const r=new gw(e.height);return r.fromEquirectangularTexture(g,s),t.set(s,r),s.addEventListener("dispose",T),i(r.texture,s.mapping)}else return null}}return s}function T(s){const y=s.target;y.removeEventListener("dispose",T);const e=t.get(y);e!==void 0&&(t.delete(y),e.dispose())}function E(){t=new WeakMap}return{get:x,dispose:E}}class qd extends $d{constructor(t=-1,i=1,x=1,T=-1,E=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=i,this.top=x,this.bottom=T,this.near=E,this.far=s,this.updateProjectionMatrix()}copy(t,i){return super.copy(t,i),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,i,x,T,E,s){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=i,this.view.offsetX=x,this.view.offsetY=T,this.view.width=E,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),i=(this.top-this.bottom)/(2*this.zoom),x=(this.right+this.left)/2,T=(this.top+this.bottom)/2;let E=x-t,s=x+t,y=T+i,e=T-i;if(this.view!==null&&this.view.enabled){const r=(this.right-this.left)/this.view.fullWidth/this.zoom,p=(this.top-this.bottom)/this.view.fullHeight/this.zoom;E+=r*this.view.offsetX,s=E+r*this.view.width,y-=p*this.view.offsetY,e=y-p*this.view.height}this.projectionMatrix.makeOrthographic(E,s,y,e,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const i=super.toJSON(t);return i.object.zoom=this.zoom,i.object.left=this.left,i.object.right=this.right,i.object.top=this.top,i.object.bottom=this.bottom,i.object.near=this.near,i.object.far=this.far,this.view!==null&&(i.object.view=Object.assign({},this.view)),i}}const Uf=4,YT=[.125,.215,.35,.446,.526,.582],cu=20,U0=new qd,kT=new ze;let z0=null,G0=0,V0=0;const uu=(1+Math.sqrt(5))/2,Ef=1/uu,KT=[new Ct(1,1,1),new Ct(-1,1,1),new Ct(1,1,-1),new Ct(-1,1,-1),new Ct(0,uu,Ef),new Ct(0,uu,-Ef),new Ct(Ef,0,uu),new Ct(-Ef,0,uu),new Ct(uu,Ef,0),new Ct(-uu,Ef,0)];class vx{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,i=0,x=.1,T=100){z0=this._renderer.getRenderTarget(),G0=this._renderer.getActiveCubeFace(),V0=this._renderer.getActiveMipmapLevel(),this._setSize(256);const E=this._allocateTargets();return E.depthBuffer=!0,this._sceneToCubeUV(t,x,T,E),i>0&&this._blur(E,0,0,i),this._applyPMREM(E),this._cleanup(E),E}fromEquirectangular(t,i=null){return this._fromTexture(t,i)}fromCubemap(t,i=null){return this._fromTexture(t,i)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=JT(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ZT(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t2?d:0,d,d),p.setRenderTarget(T),u&&p.render(n,y),p.render(t,y)}n.geometry.dispose(),n.material.dispose(),p.toneMapping=a,p.autoClear=h,t.background=f}_textureToCubeUV(t,i){const x=this._renderer,T=t.mapping===wl||t.mapping===vh;T?(this._cubemapMaterial===null&&(this._cubemapMaterial=JT()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ZT());const E=T?this._cubemapMaterial:this._equirectMaterial,s=new cr(this._lodPlanes[0],E),y=E.uniforms;y.envMap.value=t;const e=this._cubeSize;Tv(i,0,0,3*e,2*e),x.setRenderTarget(i),x.render(s,U0)}_applyPMREM(t){const i=this._renderer,x=i.autoClear;i.autoClear=!1;for(let T=1;Tcu&&console.warn(`sigmaRadians, ${E}, is too large and will clip, as it requested ${f} samples when the maximum is set to ${cu}`);const o=[];let c=0;for(let M=0;Md-Uf?T-d+Uf:0),S=4*(this._cubeSize-v);Tv(i,m,S,3*v,2*v),e.setRenderTarget(i),e.render(h,U0)}}function qB(g){const t=[],i=[],x=[];let T=g;const E=g-Uf+1+YT.length;for(let s=0;sg-Uf?e=YT[s-g+Uf-1]:s===0&&(e=0),x.push(e);const r=1/(y-2),p=-r,h=1+r,a=[p,p,h,p,h,h,p,p,h,h,p,h],l=6,n=6,u=3,f=2,o=1,c=new Float32Array(u*n*l),d=new Float32Array(f*n*l),v=new Float32Array(o*n*l);for(let S=0;S2?0:-1,C=[M,w,0,M+2/3,w,0,M+2/3,w+1,0,M,w,0,M+2/3,w+1,0,M,w+1,0];c.set(C,u*n*S),d.set(a,f*n*S);const A=[S,S,S,S,S,S];v.set(A,o*n*S)}const m=new Li;m.setAttribute("position",new an(c,u)),m.setAttribute("uv",new an(d,f)),m.setAttribute("faceIndex",new an(v,o)),t.push(m),T>Uf&&T--}return{lodPlanes:t,sizeLods:i,sigmas:x}}function jT(g,t,i){const x=new io(g,t,i);return x.texture.mapping=ec,x.texture.name="PMREM.cubeUv",x.scissorTest=!0,x}function Tv(g,t,i,x,T){g.viewport.set(t,i,x,T),g.scissor.set(t,i,x,T)}function t8(g,t,i){const x=new Float32Array(cu),T=new Ct(0,1,0);return new no({name:"SphericalGaussianBlur",defines:{n:cu,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${g}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:x},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:T}},vertexShader:x1(),fragmentShader:` +}`,bi={alphahash_fragment:mN,alphahash_pars_fragment:gN,alphamap_fragment:yN,alphamap_pars_fragment:xN,alphatest_fragment:SN,alphatest_pars_fragment:TN,aomap_fragment:EN,aomap_pars_fragment:MN,batching_pars_vertex:CN,batching_vertex:wN,begin_vertex:AN,beginnormal_vertex:PN,bsdfs:RN,iridescence_fragment:bN,bumpmap_pars_fragment:LN,clipping_planes_fragment:FN,clipping_planes_pars_fragment:ON,clipping_planes_pars_vertex:DN,clipping_planes_vertex:IN,color_fragment:NN,color_pars_fragment:BN,color_pars_vertex:UN,color_vertex:zN,common:GN,cube_uv_reflection_fragment:VN,defaultnormal_vertex:HN,displacementmap_pars_vertex:WN,displacementmap_vertex:XN,emissivemap_fragment:YN,emissivemap_pars_fragment:kN,colorspace_fragment:jN,colorspace_pars_fragment:KN,envmap_fragment:ZN,envmap_common_pars_fragment:JN,envmap_pars_fragment:$N,envmap_pars_vertex:QN,envmap_physical_pars_fragment:h9,envmap_vertex:_N,fog_vertex:qN,fog_pars_vertex:t9,fog_fragment:e9,fog_pars_fragment:i9,gradientmap_pars_fragment:n9,lightmap_fragment:r9,lightmap_pars_fragment:s9,lights_lambert_fragment:a9,lights_lambert_pars_fragment:o9,lights_pars_begin:l9,lights_toon_fragment:u9,lights_toon_pars_fragment:f9,lights_phong_fragment:c9,lights_phong_pars_fragment:d9,lights_physical_fragment:p9,lights_physical_pars_fragment:v9,lights_fragment_begin:m9,lights_fragment_maps:g9,lights_fragment_end:y9,logdepthbuf_fragment:x9,logdepthbuf_pars_fragment:S9,logdepthbuf_pars_vertex:T9,logdepthbuf_vertex:E9,map_fragment:M9,map_pars_fragment:C9,map_particle_fragment:w9,map_particle_pars_fragment:A9,metalnessmap_fragment:P9,metalnessmap_pars_fragment:R9,morphcolor_vertex:b9,morphnormal_vertex:L9,morphtarget_pars_vertex:F9,morphtarget_vertex:O9,normal_fragment_begin:D9,normal_fragment_maps:I9,normal_pars_fragment:N9,normal_pars_vertex:B9,normal_vertex:U9,normalmap_pars_fragment:z9,clearcoat_normal_fragment_begin:G9,clearcoat_normal_fragment_maps:V9,clearcoat_pars_fragment:H9,iridescence_pars_fragment:W9,opaque_fragment:X9,packing:Y9,premultiplied_alpha_fragment:k9,project_vertex:j9,dithering_fragment:K9,dithering_pars_fragment:Z9,roughnessmap_fragment:J9,roughnessmap_pars_fragment:$9,shadowmap_pars_fragment:Q9,shadowmap_pars_vertex:_9,shadowmap_vertex:q9,shadowmask_pars_fragment:tB,skinbase_vertex:eB,skinning_pars_vertex:iB,skinning_vertex:nB,skinnormal_vertex:rB,specularmap_fragment:sB,specularmap_pars_fragment:aB,tonemapping_fragment:oB,tonemapping_pars_fragment:lB,transmission_fragment:hB,transmission_pars_fragment:uB,uv_pars_fragment:fB,uv_pars_vertex:cB,uv_vertex:dB,worldpos_vertex:pB,background_vert:vB,background_frag:mB,backgroundCube_vert:gB,backgroundCube_frag:yB,cube_vert:xB,cube_frag:SB,depth_vert:TB,depth_frag:EB,distanceRGBA_vert:MB,distanceRGBA_frag:CB,equirect_vert:wB,equirect_frag:AB,linedashed_vert:PB,linedashed_frag:RB,meshbasic_vert:bB,meshbasic_frag:LB,meshlambert_vert:FB,meshlambert_frag:OB,meshmatcap_vert:DB,meshmatcap_frag:IB,meshnormal_vert:NB,meshnormal_frag:BB,meshphong_vert:UB,meshphong_frag:zB,meshphysical_vert:GB,meshphysical_frag:VB,meshtoon_vert:HB,meshtoon_frag:WB,points_vert:XB,points_frag:YB,shadow_vert:kB,shadow_frag:jB,sprite_vert:KB,sprite_frag:ZB},Fe={common:{diffuse:{value:new ze(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Oi},alphaMap:{value:null},alphaMapTransform:{value:new Oi},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Oi}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Oi}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Oi}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Oi},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Oi},normalScale:{value:new ve(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Oi},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Oi}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Oi}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Oi}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ze(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ze(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Oi},alphaTest:{value:0},uvTransform:{value:new Oi}},sprite:{diffuse:{value:new ze(16777215)},opacity:{value:1},center:{value:new ve(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Oi},alphaMap:{value:null},alphaMapTransform:{value:new Oi},alphaTest:{value:0}}},to={basic:{uniforms:ds([Fe.common,Fe.specularmap,Fe.envmap,Fe.aomap,Fe.lightmap,Fe.fog]),vertexShader:bi.meshbasic_vert,fragmentShader:bi.meshbasic_frag},lambert:{uniforms:ds([Fe.common,Fe.specularmap,Fe.envmap,Fe.aomap,Fe.lightmap,Fe.emissivemap,Fe.bumpmap,Fe.normalmap,Fe.displacementmap,Fe.fog,Fe.lights,{emissive:{value:new ze(0)}}]),vertexShader:bi.meshlambert_vert,fragmentShader:bi.meshlambert_frag},phong:{uniforms:ds([Fe.common,Fe.specularmap,Fe.envmap,Fe.aomap,Fe.lightmap,Fe.emissivemap,Fe.bumpmap,Fe.normalmap,Fe.displacementmap,Fe.fog,Fe.lights,{emissive:{value:new ze(0)},specular:{value:new ze(1118481)},shininess:{value:30}}]),vertexShader:bi.meshphong_vert,fragmentShader:bi.meshphong_frag},standard:{uniforms:ds([Fe.common,Fe.envmap,Fe.aomap,Fe.lightmap,Fe.emissivemap,Fe.bumpmap,Fe.normalmap,Fe.displacementmap,Fe.roughnessmap,Fe.metalnessmap,Fe.fog,Fe.lights,{emissive:{value:new ze(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:bi.meshphysical_vert,fragmentShader:bi.meshphysical_frag},toon:{uniforms:ds([Fe.common,Fe.aomap,Fe.lightmap,Fe.emissivemap,Fe.bumpmap,Fe.normalmap,Fe.displacementmap,Fe.gradientmap,Fe.fog,Fe.lights,{emissive:{value:new ze(0)}}]),vertexShader:bi.meshtoon_vert,fragmentShader:bi.meshtoon_frag},matcap:{uniforms:ds([Fe.common,Fe.bumpmap,Fe.normalmap,Fe.displacementmap,Fe.fog,{matcap:{value:null}}]),vertexShader:bi.meshmatcap_vert,fragmentShader:bi.meshmatcap_frag},points:{uniforms:ds([Fe.points,Fe.fog]),vertexShader:bi.points_vert,fragmentShader:bi.points_frag},dashed:{uniforms:ds([Fe.common,Fe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:bi.linedashed_vert,fragmentShader:bi.linedashed_frag},depth:{uniforms:ds([Fe.common,Fe.displacementmap]),vertexShader:bi.depth_vert,fragmentShader:bi.depth_frag},normal:{uniforms:ds([Fe.common,Fe.bumpmap,Fe.normalmap,Fe.displacementmap,{opacity:{value:1}}]),vertexShader:bi.meshnormal_vert,fragmentShader:bi.meshnormal_frag},sprite:{uniforms:ds([Fe.sprite,Fe.fog]),vertexShader:bi.sprite_vert,fragmentShader:bi.sprite_frag},background:{uniforms:{uvTransform:{value:new Oi},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:bi.background_vert,fragmentShader:bi.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:bi.backgroundCube_vert,fragmentShader:bi.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:bi.cube_vert,fragmentShader:bi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:bi.equirect_vert,fragmentShader:bi.equirect_frag},distanceRGBA:{uniforms:ds([Fe.common,Fe.displacementmap,{referencePosition:{value:new Ct},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:bi.distanceRGBA_vert,fragmentShader:bi.distanceRGBA_frag},shadow:{uniforms:ds([Fe.lights,Fe.fog,{color:{value:new ze(0)},opacity:{value:1}}]),vertexShader:bi.shadow_vert,fragmentShader:bi.shadow_frag}};to.physical={uniforms:ds([to.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Oi},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Oi},clearcoatNormalScale:{value:new ve(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Oi},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Oi},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Oi},sheen:{value:0},sheenColor:{value:new ze(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Oi},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Oi},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Oi},transmissionSamplerSize:{value:new ve},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Oi},attenuationDistance:{value:0},attenuationColor:{value:new ze(0)},specularColor:{value:new ze(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Oi},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Oi},anisotropyVector:{value:new ve},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Oi}}]),vertexShader:bi.meshphysical_vert,fragmentShader:bi.meshphysical_frag};const Tv={r:0,b:0,g:0};function JB(g,t,i,x,T,E,s){const y=new ze(0);let e=E===!0?0:1,r,p,h=null,a=0,l=null;function n(f,o){let c=!1,d=o.isScene===!0?o.background:null;d&&d.isTexture&&(d=(o.backgroundBlurriness>0?i:t).get(d)),d===null?u(y,e):d&&d.isColor&&(u(d,1),c=!0);const v=g.xr.getEnvironmentBlendMode();v==="additive"?x.buffers.color.setClear(0,0,0,1,s):v==="alpha-blend"&&x.buffers.color.setClear(0,0,0,0,s),(g.autoClear||c)&&g.clear(g.autoClearColor,g.autoClearDepth,g.autoClearStencil),d&&(d.isCubeTexture||d.mapping===ec)?(p===void 0&&(p=new cr(new Fu(1,1,1),new no({name:"BackgroundCubeMaterial",uniforms:$f(to.backgroundCube.uniforms),vertexShader:to.backgroundCube.vertexShader,fragmentShader:to.backgroundCube.fragmentShader,side:ms,depthTest:!1,depthWrite:!1,fog:!1})),p.geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(m,S,M){this.matrixWorld.copyPosition(M.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),T.update(p)),p.material.uniforms.envMap.value=d,p.material.uniforms.flipEnvMap.value=d.isCubeTexture&&d.isRenderTargetTexture===!1?-1:1,p.material.uniforms.backgroundBlurriness.value=o.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=o.backgroundIntensity,p.material.toneMapped=rn.getTransfer(d.colorSpace)!==vn,(h!==d||a!==d.version||l!==g.toneMapping)&&(p.material.needsUpdate=!0,h=d,a=d.version,l=g.toneMapping),p.layers.enableAll(),f.unshift(p,p.geometry,p.material,0,0,null)):d&&d.isTexture&&(r===void 0&&(r=new cr(new nc(2,2),new no({name:"BackgroundMaterial",uniforms:$f(to.background.uniforms),vertexShader:to.background.vertexShader,fragmentShader:to.background.fragmentShader,side:Cl,depthTest:!1,depthWrite:!1,fog:!1})),r.geometry.deleteAttribute("normal"),Object.defineProperty(r.material,"map",{get:function(){return this.uniforms.t2D.value}}),T.update(r)),r.material.uniforms.t2D.value=d,r.material.uniforms.backgroundIntensity.value=o.backgroundIntensity,r.material.toneMapped=rn.getTransfer(d.colorSpace)!==vn,d.matrixAutoUpdate===!0&&d.updateMatrix(),r.material.uniforms.uvTransform.value.copy(d.matrix),(h!==d||a!==d.version||l!==g.toneMapping)&&(r.material.needsUpdate=!0,h=d,a=d.version,l=g.toneMapping),r.layers.enableAll(),f.unshift(r,r.geometry,r.material,0,0,null))}function u(f,o){f.getRGB(Tv,vw(g)),x.buffers.color.setClear(Tv.r,Tv.g,Tv.b,o,s)}return{getClearColor:function(){return y},setClearColor:function(f,o=1){y.set(f),e=o,u(y,e)},getClearAlpha:function(){return e},setClearAlpha:function(f){e=f,u(y,e)},render:n}}function $B(g,t,i,x){const T=g.getParameter(g.MAX_VERTEX_ATTRIBS),E=x.isWebGL2?null:t.get("OES_vertex_array_object"),s=x.isWebGL2||E!==null,y={},e=f(null);let r=e,p=!1;function h(I,D,B,G,z){let X=!1;if(s){const j=u(G,B,D);r!==j&&(r=j,l(r.object)),X=o(I,G,B,z),X&&c(I,G,B,z)}else{const j=D.wireframe===!0;(r.geometry!==G.id||r.program!==B.id||r.wireframe!==j)&&(r.geometry=G.id,r.program=B.id,r.wireframe=j,X=!0)}z!==null&&i.update(z,g.ELEMENT_ARRAY_BUFFER),(X||p)&&(p=!1,w(I,D,B,G),z!==null&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,i.get(z).buffer))}function a(){return x.isWebGL2?g.createVertexArray():E.createVertexArrayOES()}function l(I){return x.isWebGL2?g.bindVertexArray(I):E.bindVertexArrayOES(I)}function n(I){return x.isWebGL2?g.deleteVertexArray(I):E.deleteVertexArrayOES(I)}function u(I,D,B){const G=B.wireframe===!0;let z=y[I.id];z===void 0&&(z={},y[I.id]=z);let X=z[D.id];X===void 0&&(X={},z[D.id]=X);let j=X[G];return j===void 0&&(j=f(a()),X[G]=j),j}function f(I){const D=[],B=[],G=[];for(let z=0;z=0){const Z=z[tt];let U=X[tt];if(U===void 0&&(tt==="instanceMatrix"&&I.instanceMatrix&&(U=I.instanceMatrix),tt==="instanceColor"&&I.instanceColor&&(U=I.instanceColor)),Z===void 0||Z.attribute!==U||U&&Z.data!==U.data)return!0;j++}return r.attributesNum!==j||r.index!==G}function c(I,D,B,G){const z={},X=D.attributes;let j=0;const Q=B.getAttributes();for(const tt in Q)if(Q[tt].location>=0){let Z=X[tt];Z===void 0&&(tt==="instanceMatrix"&&I.instanceMatrix&&(Z=I.instanceMatrix),tt==="instanceColor"&&I.instanceColor&&(Z=I.instanceColor));const U={};U.attribute=Z,Z&&Z.data&&(U.data=Z.data),z[tt]=U,j++}r.attributes=z,r.attributesNum=j,r.index=G}function d(){const I=r.newAttributes;for(let D=0,B=I.length;D=0){let Y=z[Q];if(Y===void 0&&(Q==="instanceMatrix"&&I.instanceMatrix&&(Y=I.instanceMatrix),Q==="instanceColor"&&I.instanceColor&&(Y=I.instanceColor)),Y!==void 0){const Z=Y.normalized,U=Y.itemSize,H=i.get(Y);if(H===void 0)continue;const J=H.buffer,_=H.type,q=H.bytesPerElement,at=x.isWebGL2===!0&&(_===g.INT||_===g.UNSIGNED_INT||Y.gpuType===r1);if(Y.isInterleavedBufferAttribute){const ot=Y.data,rt=ot.stride,gt=Y.offset;if(ot.isInstancedInterleavedBuffer){for(let yt=0;yt0&&g.getShaderPrecisionFormat(g.FRAGMENT_SHADER,g.HIGH_FLOAT).precision>0)return"highp";M="mediump"}return M==="mediump"&&g.getShaderPrecisionFormat(g.VERTEX_SHADER,g.MEDIUM_FLOAT).precision>0&&g.getShaderPrecisionFormat(g.FRAGMENT_SHADER,g.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const s=typeof WebGL2RenderingContext<"u"&&g.constructor.name==="WebGL2RenderingContext";let y=i.precision!==void 0?i.precision:"highp";const e=E(y);e!==y&&(console.warn("THREE.WebGLRenderer:",y,"not supported, using",e,"instead."),y=e);const r=s||t.has("WEBGL_draw_buffers"),p=i.logarithmicDepthBuffer===!0,h=g.getParameter(g.MAX_TEXTURE_IMAGE_UNITS),a=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l=g.getParameter(g.MAX_TEXTURE_SIZE),n=g.getParameter(g.MAX_CUBE_MAP_TEXTURE_SIZE),u=g.getParameter(g.MAX_VERTEX_ATTRIBS),f=g.getParameter(g.MAX_VERTEX_UNIFORM_VECTORS),o=g.getParameter(g.MAX_VARYING_VECTORS),c=g.getParameter(g.MAX_FRAGMENT_UNIFORM_VECTORS),d=a>0,v=s||t.has("OES_texture_float"),m=d&&v,S=s?g.getParameter(g.MAX_SAMPLES):0;return{isWebGL2:s,drawBuffers:r,getMaxAnisotropy:T,getMaxPrecision:E,precision:y,logarithmicDepthBuffer:p,maxTextures:h,maxVertexTextures:a,maxTextureSize:l,maxCubemapSize:n,maxAttributes:u,maxVertexUniforms:f,maxVaryings:o,maxFragmentUniforms:c,vertexTextures:d,floatFragmentTextures:v,floatVertexTextures:m,maxSamples:S}}function qB(g){const t=this;let i=null,x=0,T=!1,E=!1;const s=new ah,y=new Oi,e={value:null,needsUpdate:!1};this.uniform=e,this.numPlanes=0,this.numIntersection=0,this.init=function(h,a){const l=h.length!==0||a||x!==0||T;return T=a,x=h.length,l},this.beginShadows=function(){E=!0,p(null)},this.endShadows=function(){E=!1},this.setGlobalState=function(h,a){i=p(h,a,0)},this.setState=function(h,a,l){const n=h.clippingPlanes,u=h.clipIntersection,f=h.clipShadows,o=g.get(h);if(!T||n===null||n.length===0||E&&!f)E?p(null):r();else{const c=E?0:x,d=c*4;let v=o.clippingState||null;e.value=v,v=p(n,a,d,l);for(let m=0;m!==d;++m)v[m]=i[m];o.clippingState=v,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=c}};function r(){e.value!==i&&(e.value=i,e.needsUpdate=x>0),t.numPlanes=x,t.numIntersection=0}function p(h,a,l,n){const u=h!==null?h.length:0;let f=null;if(u!==0){if(f=e.value,n!==!0||f===null){const o=l+u*4,c=a.matrixWorldInverse;y.getNormalMatrix(c),(f===null||f.length0){const r=new yw(e.height);return r.fromEquirectangularTexture(g,s),t.set(s,r),s.addEventListener("dispose",T),i(r.texture,s.mapping)}else return null}}return s}function T(s){const y=s.target;y.removeEventListener("dispose",T);const e=t.get(y);e!==void 0&&(t.delete(y),e.dispose())}function E(){t=new WeakMap}return{get:x,dispose:E}}class tp extends Qd{constructor(t=-1,i=1,x=1,T=-1,E=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=i,this.top=x,this.bottom=T,this.near=E,this.far=s,this.updateProjectionMatrix()}copy(t,i){return super.copy(t,i),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,i,x,T,E,s){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=i,this.view.offsetX=x,this.view.offsetY=T,this.view.width=E,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),i=(this.top-this.bottom)/(2*this.zoom),x=(this.right+this.left)/2,T=(this.top+this.bottom)/2;let E=x-t,s=x+t,y=T+i,e=T-i;if(this.view!==null&&this.view.enabled){const r=(this.right-this.left)/this.view.fullWidth/this.zoom,p=(this.top-this.bottom)/this.view.fullHeight/this.zoom;E+=r*this.view.offsetX,s=E+r*this.view.width,y-=p*this.view.offsetY,e=y-p*this.view.height}this.projectionMatrix.makeOrthographic(E,s,y,e,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const i=super.toJSON(t);return i.object.zoom=this.zoom,i.object.left=this.left,i.object.right=this.right,i.object.top=this.top,i.object.bottom=this.bottom,i.object.near=this.near,i.object.far=this.far,this.view!==null&&(i.object.view=Object.assign({},this.view)),i}}const Uf=4,XT=[.125,.215,.35,.446,.526,.582],fu=20,z0=new tp,YT=new ze;let G0=null,V0=0,H0=0;const hu=(1+Math.sqrt(5))/2,Tf=1/hu,kT=[new Ct(1,1,1),new Ct(-1,1,1),new Ct(1,1,-1),new Ct(-1,1,-1),new Ct(0,hu,Tf),new Ct(0,hu,-Tf),new Ct(Tf,0,hu),new Ct(-Tf,0,hu),new Ct(hu,Tf,0),new Ct(-hu,Tf,0)];class mx{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,i=0,x=.1,T=100){G0=this._renderer.getRenderTarget(),V0=this._renderer.getActiveCubeFace(),H0=this._renderer.getActiveMipmapLevel(),this._setSize(256);const E=this._allocateTargets();return E.depthBuffer=!0,this._sceneToCubeUV(t,x,T,E),i>0&&this._blur(E,0,0,i),this._applyPMREM(E),this._cleanup(E),E}fromEquirectangular(t,i=null){return this._fromTexture(t,i)}fromCubemap(t,i=null){return this._fromTexture(t,i)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=ZT(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=KT(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t2?d:0,d,d),p.setRenderTarget(T),u&&p.render(n,y),p.render(t,y)}n.geometry.dispose(),n.material.dispose(),p.toneMapping=a,p.autoClear=h,t.background=f}_textureToCubeUV(t,i){const x=this._renderer,T=t.mapping===wl||t.mapping===vh;T?(this._cubemapMaterial===null&&(this._cubemapMaterial=ZT()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=KT());const E=T?this._cubemapMaterial:this._equirectMaterial,s=new cr(this._lodPlanes[0],E),y=E.uniforms;y.envMap.value=t;const e=this._cubeSize;Ev(i,0,0,3*e,2*e),x.setRenderTarget(i),x.render(s,z0)}_applyPMREM(t){const i=this._renderer,x=i.autoClear;i.autoClear=!1;for(let T=1;Tfu&&console.warn(`sigmaRadians, ${E}, is too large and will clip, as it requested ${f} samples when the maximum is set to ${fu}`);const o=[];let c=0;for(let M=0;Md-Uf?T-d+Uf:0),S=4*(this._cubeSize-v);Ev(i,m,S,3*v,2*v),e.setRenderTarget(i),e.render(h,z0)}}function e8(g){const t=[],i=[],x=[];let T=g;const E=g-Uf+1+XT.length;for(let s=0;sg-Uf?e=XT[s-g+Uf-1]:s===0&&(e=0),x.push(e);const r=1/(y-2),p=-r,h=1+r,a=[p,p,h,p,h,h,p,p,h,h,p,h],l=6,n=6,u=3,f=2,o=1,c=new Float32Array(u*n*l),d=new Float32Array(f*n*l),v=new Float32Array(o*n*l);for(let S=0;S2?0:-1,C=[M,w,0,M+2/3,w,0,M+2/3,w+1,0,M,w,0,M+2/3,w+1,0,M,w+1,0];c.set(C,u*n*S),d.set(a,f*n*S);const A=[S,S,S,S,S,S];v.set(A,o*n*S)}const m=new Li;m.setAttribute("position",new an(c,u)),m.setAttribute("uv",new an(d,f)),m.setAttribute("faceIndex",new an(v,o)),t.push(m),T>Uf&&T--}return{lodPlanes:t,sizeLods:i,sigmas:x}}function jT(g,t,i){const x=new io(g,t,i);return x.texture.mapping=ec,x.texture.name="PMREM.cubeUv",x.scissorTest=!0,x}function Ev(g,t,i,x,T){g.viewport.set(t,i,x,T),g.scissor.set(t,i,x,T)}function i8(g,t,i){const x=new Float32Array(fu),T=new Ct(0,1,0);return new no({name:"SphericalGaussianBlur",defines:{n:fu,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${g}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:x},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:T}},vertexShader:x1(),fragmentShader:` precision mediump float; precision mediump int; @@ -9972,7 +9972,7 @@ void main() { } } - `,blending:Ml,depthTest:!1,depthWrite:!1})}function ZT(){return new no({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:x1(),fragmentShader:` + `,blending:Ml,depthTest:!1,depthWrite:!1})}function KT(){return new no({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:x1(),fragmentShader:` precision mediump float; precision mediump int; @@ -9991,7 +9991,7 @@ void main() { gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } - `,blending:Ml,depthTest:!1,depthWrite:!1})}function JT(){return new no({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:x1(),fragmentShader:` + `,blending:Ml,depthTest:!1,depthWrite:!1})}function ZT(){return new no({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:x1(),fragmentShader:` precision mediump float; precision mediump int; @@ -10062,16 +10062,16 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function e8(g){let t=new WeakMap,i=null;function x(y){if(y&&y.isTexture){const e=y.mapping,r=e===Td||e===Ed,p=e===wl||e===vh;if(r||p)if(y.isRenderTargetTexture&&y.needsPMREMUpdate===!0){y.needsPMREMUpdate=!1;let h=t.get(y);return i===null&&(i=new vx(g)),h=r?i.fromEquirectangular(y,h):i.fromCubemap(y,h),t.set(y,h),h.texture}else{if(t.has(y))return t.get(y).texture;{const h=y.image;if(r&&h&&h.height>0||p&&h&&T(h)){i===null&&(i=new vx(g));const a=r?i.fromEquirectangular(y):i.fromCubemap(y);return t.set(y,a),y.addEventListener("dispose",E),a.texture}else return null}}}return y}function T(y){let e=0;const r=6;for(let p=0;pt.maxTextureSize&&(A=Math.ceil(C/t.maxTextureSize),C=t.maxTextureSize);const P=new Float32Array(C*A*4*n),b=new hg(P,C,A,n);b.type=Ea,b.needsUpdate=!0;const O=w*4;for(let D=0;D0)return g;const T=t*i;let E=$T[T];if(E===void 0&&(E=new Float32Array(T),$T[T]=E),t!==0){x.toArray(E,0);for(let s=1,y=0;s!==t;++s)y+=i,g[s].toArray(E,y)}return E}function gr(g,t){if(g.length!==t.length)return!1;for(let i=0,x=g.length;i0||p&&h&&T(h)){i===null&&(i=new mx(g));const a=r?i.fromEquirectangular(y):i.fromCubemap(y);return t.set(y,a),y.addEventListener("dispose",E),a.texture}else return null}}}return y}function T(y){let e=0;const r=6;for(let p=0;pt.maxTextureSize&&(A=Math.ceil(C/t.maxTextureSize),C=t.maxTextureSize);const P=new Float32Array(C*A*4*n),b=new ug(P,C,A,n);b.type=Ea,b.needsUpdate=!0;const O=w*4;for(let D=0;D0)return g;const T=t*i;let E=JT[T];if(E===void 0&&(E=new Float32Array(T),JT[T]=E),t!==0){x.toArray(E,0);for(let s=1,y=0;s!==t;++s)y+=i,g[s].toArray(E,y)}return E}function gr(g,t){if(g.length!==t.length)return!1;for(let i=0,x=g.length;i":" "} ${y}: ${i[s]}`)}return x.join(` -`)}function n6(g){const t=rn.getPrimaries(rn.workingColorSpace),i=rn.getPrimaries(g);let x;switch(t===i?x="":t===Ld&&i===bd?x="LinearDisplayP3ToLinearSRGB":t===bd&&i===Ld&&(x="LinearSRGBToLinearDisplayP3"),g){case Go:case Jd:return[x,"LinearTransferOETF"];case vr:case lg:return[x,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",g),[x,"LinearTransferOETF"]}}function nE(g,t,i){const x=g.getShaderParameter(t,g.COMPILE_STATUS),T=g.getShaderInfoLog(t).trim();if(x&&T==="")return"";const E=/ERROR: 0:(\d+)/.exec(T);if(E){const s=parseInt(E[1]);return i.toUpperCase()+` +`)}function s6(g){const t=rn.getPrimaries(rn.workingColorSpace),i=rn.getPrimaries(g);let x;switch(t===i?x="":t===Fd&&i===Ld?x="LinearDisplayP3ToLinearSRGB":t===Ld&&i===Fd&&(x="LinearSRGBToLinearDisplayP3"),g){case Vo:case $d:return[x,"LinearTransferOETF"];case vr:case hg:return[x,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",g),[x,"LinearTransferOETF"]}}function iE(g,t,i){const x=g.getShaderParameter(t,g.COMPILE_STATUS),T=g.getShaderInfoLog(t).trim();if(x&&T==="")return"";const E=/ERROR: 0:(\d+)/.exec(T);if(E){const s=parseInt(E[1]);return i.toUpperCase()+` `+T+` -`+i6(g.getShaderSource(t),s)}else return T}function r6(g,t){const i=n6(t);return`vec4 ${g}( vec4 value ) { return ${i[0]}( ${i[1]}( value ) ); }`}function s6(g,t){let i;switch(t){case U2:i="Linear";break;case z2:i="Reinhard";break;case G2:i="OptimizedCineon";break;case n1:i="ACESFilmic";break;case H2:i="AgX";break;case V2:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),i="Linear"}return"vec3 "+g+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function a6(g){return[g.extensionDerivatives||g.envMapCubeUVHeight||g.bumpMap||g.normalMapTangentSpace||g.clearcoatNormalMap||g.flatShading||g.alphaToCoverage||g.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(g.extensionFragDepth||g.logarithmicDepthBuffer)&&g.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",g.extensionDrawBuffers&&g.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(g.extensionShaderTextureLOD||g.envMap||g.transmission)&&g.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(zf).join(` -`)}function o6(g){return[g.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",g.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(zf).join(` -`)}function l6(g){const t=[];for(const i in g){const x=g[i];x!==!1&&t.push("#define "+i+" "+x)}return t.join(` -`)}function h6(g,t){const i={},x=g.getProgramParameter(t,g.ACTIVE_ATTRIBUTES);for(let T=0;T/gm;function mx(g){return g.replace(u6,c6)}const f6=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function c6(g,t){let i=bi[t];if(i===void 0){const x=f6.get(t);if(x!==void 0)i=bi[x],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,x);else throw new Error("Can not resolve #include <"+t+">")}return mx(i)}const d6=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function aE(g){return g.replace(d6,p6)}function p6(g,t,i,x){let T="";for(let E=parseInt(t);E/gm;function gx(g){return g.replace(c6,p6)}const d6=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function p6(g,t){let i=bi[t];if(i===void 0){const x=d6.get(t);if(x!==void 0)i=bi[x],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,x);else throw new Error("Can not resolve #include <"+t+">")}return gx(i)}const v6=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function sE(g){return g.replace(v6,m6)}function m6(g,t,i,x){let T="";for(let E=parseInt(t);E0&&(o+=` `),c=[l,"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,u].filter(zf).join(` `),c.length>0&&(c+=` -`)):(o=[oE(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,u,i.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",i.batching?"#define USE_BATCHING":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+p:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&i.flatShading===!1?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&i.flatShading===!1?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+e:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`)):(o=[aE(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,u,i.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",i.batching?"#define USE_BATCHING":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+p:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&i.flatShading===!1?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&i.flatShading===!1?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+e:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` `].filter(zf).join(` -`),c=[l,oE(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,u,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+r:"",i.envMap?"#define "+p:"",i.envMap?"#define "+h:"",a?"#define CUBEUV_TEXEL_WIDTH "+a.texelWidth:"",a?"#define CUBEUV_TEXEL_HEIGHT "+a.texelHeight:"",a?"#define CUBEUV_MAX_MIP "+a.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&i.flatShading===!1?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+e:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",i.toneMapping!==Bo?"#define TONE_MAPPING":"",i.toneMapping!==Bo?bi.tonemapping_pars_fragment:"",i.toneMapping!==Bo?s6("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",bi.colorspace_pars_fragment,r6("linearToOutputTexel",i.outputColorSpace),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"",` +`),c=[l,aE(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,u,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+r:"",i.envMap?"#define "+p:"",i.envMap?"#define "+h:"",a?"#define CUBEUV_TEXEL_WIDTH "+a.texelWidth:"",a?"#define CUBEUV_TEXEL_HEIGHT "+a.texelHeight:"",a?"#define CUBEUV_MAX_MIP "+a.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&i.flatShading===!1?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+e:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",i.toneMapping!==Uo?"#define TONE_MAPPING":"",i.toneMapping!==Uo?bi.tonemapping_pars_fragment:"",i.toneMapping!==Uo?o6("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",bi.colorspace_pars_fragment,a6("linearToOutputTexel",i.outputColorSpace),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"",` `].filter(zf).join(` -`)),s=mx(s),s=rE(s,i),s=sE(s,i),y=mx(y),y=rE(y,i),y=sE(y,i),s=aE(s),y=aE(y),i.isWebGL2&&i.isRawShaderMaterial!==!0&&(d=`#version 300 es +`)),s=gx(s),s=nE(s,i),s=rE(s,i),y=gx(y),y=nE(y,i),y=rE(y,i),s=sE(s),y=sE(y),i.isWebGL2&&i.isRawShaderMaterial!==!0&&(d=`#version 300 es `,o=[n,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` -`+o,c=["precision mediump sampler2DArray;","#define varying in",i.glslVersion===dx?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===dx?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`+o,c=["precision mediump sampler2DArray;","#define varying in",i.glslVersion===px?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===px?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` -`+c);const v=d+o+s,m=d+c+y,S=iE(T,T.VERTEX_SHADER,v),M=iE(T,T.FRAGMENT_SHADER,m);T.attachShader(f,S),T.attachShader(f,M),i.index0AttributeName!==void 0?T.bindAttribLocation(f,0,i.index0AttributeName):i.morphTargets===!0&&T.bindAttribLocation(f,0,"position"),T.linkProgram(f);function w(b){if(g.debug.checkShaderErrors){const O=T.getProgramInfoLog(f).trim(),I=T.getShaderInfoLog(S).trim(),D=T.getShaderInfoLog(M).trim();let B=!0,G=!0;if(T.getProgramParameter(f,T.LINK_STATUS)===!1)if(B=!1,typeof g.debug.onShaderError=="function")g.debug.onShaderError(T,f,S,M);else{const z=nE(T,S,"vertex"),X=nE(T,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+T.getError()+" - VALIDATE_STATUS "+T.getProgramParameter(f,T.VALIDATE_STATUS)+` +`+c);const v=d+o+s,m=d+c+y,S=eE(T,T.VERTEX_SHADER,v),M=eE(T,T.FRAGMENT_SHADER,m);T.attachShader(f,S),T.attachShader(f,M),i.index0AttributeName!==void 0?T.bindAttribLocation(f,0,i.index0AttributeName):i.morphTargets===!0&&T.bindAttribLocation(f,0,"position"),T.linkProgram(f);function w(b){if(g.debug.checkShaderErrors){const O=T.getProgramInfoLog(f).trim(),I=T.getShaderInfoLog(S).trim(),D=T.getShaderInfoLog(M).trim();let B=!0,G=!0;if(T.getProgramParameter(f,T.LINK_STATUS)===!1)if(B=!1,typeof g.debug.onShaderError=="function")g.debug.onShaderError(T,f,S,M);else{const z=iE(T,S,"vertex"),X=iE(T,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+T.getError()+" - VALIDATE_STATUS "+T.getProgramParameter(f,T.VALIDATE_STATUS)+` Material Name: `+b.name+` Material Type: `+b.type+` Program Info Log: `+O+` `+z+` -`+X)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(I===""||D==="")&&(G=!1);G&&(b.diagnostics={runnable:B,programLog:O,vertexShader:{log:I,prefix:o},fragmentShader:{log:D,prefix:c}})}T.deleteShader(S),T.deleteShader(M),C=new lm(T,f),A=h6(T,f)}let C;this.getUniforms=function(){return C===void 0&&w(this),C};let A;this.getAttributes=function(){return A===void 0&&w(this),A};let P=i.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return P===!1&&(P=T.getProgramParameter(f,t6)),P},this.destroy=function(){x.releaseStatesOfProgram(this),T.deleteProgram(f),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=e6++,this.cacheKey=t,this.usedTimes=1,this.program=f,this.vertexShader=S,this.fragmentShader=M,this}let T6=0;class E6{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const i=t.vertexShader,x=t.fragmentShader,T=this._getShaderStage(i),E=this._getShaderStage(x),s=this._getShaderCacheForMaterial(t);return s.has(T)===!1&&(s.add(T),T.usedTimes++),s.has(E)===!1&&(s.add(E),E.usedTimes++),this}remove(t){const i=this.materialCache.get(t);for(const x of i)x.usedTimes--,x.usedTimes===0&&this.shaderCache.delete(x.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const i=this.materialCache;let x=i.get(t);return x===void 0&&(x=new Set,i.set(t,x)),x}_getShaderStage(t){const i=this.shaderCache;let x=i.get(t);return x===void 0&&(x=new M6(t),i.set(t,x)),x}}class M6{constructor(t){this.id=T6++,this.code=t,this.usedTimes=0}}function C6(g,t,i,x,T,E,s){const y=new Tu,e=new E6,r=new Set,p=[],h=T.isWebGL2,a=T.logarithmicDepthBuffer,l=T.vertexTextures;let n=T.precision;const u={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(A){return r.add(A),A===0?"uv":`uv${A}`}function o(A,P,b,O,I){const D=O.fog,B=I.geometry,G=A.isMeshStandardMaterial?O.environment:null,z=(A.isMeshStandardMaterial?i:t).get(A.envMap||G),X=z&&z.mapping===ec?z.image.height:null,K=u[A.type];A.precision!==null&&(n=T.getMaxPrecision(A.precision),n!==A.precision&&console.warn("THREE.WebGLProgram.getParameters:",A.precision,"not supported, using",n,"instead."));const Q=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,tt=Q!==void 0?Q.length:0;let Y=0;B.morphAttributes.position!==void 0&&(Y=1),B.morphAttributes.normal!==void 0&&(Y=2),B.morphAttributes.color!==void 0&&(Y=3);let Z,U,H,J;if(K){const Di=to[K];Z=Di.vertexShader,U=Di.fragmentShader}else Z=A.vertexShader,U=A.fragmentShader,e.update(A),H=e.getVertexShaderID(A),J=e.getFragmentShaderID(A);const _=g.getRenderTarget(),q=I.isInstancedMesh===!0,at=I.isBatchedMesh===!0,ot=!!A.map,rt=!!A.matcap,gt=!!z,yt=!!A.aoMap,Et=!!A.lightMap,At=!!A.bumpMap,Pt=!!A.normalMap,Vt=!!A.displacementMap,dt=!!A.emissiveMap,ut=!!A.metalnessMap,Rt=!!A.roughnessMap,Dt=A.anisotropy>0,Ht=A.clearcoat>0,Bt=A.iridescence>0,ne=A.sheen>0,oe=A.transmission>0,ge=Dt&&!!A.anisotropyMap,xe=Ht&&!!A.clearcoatMap,Ae=Ht&&!!A.clearcoatNormalMap,qt=Ht&&!!A.clearcoatRoughnessMap,Ge=Bt&&!!A.iridescenceMap,Oe=Bt&&!!A.iridescenceThicknessMap,Be=ne&&!!A.sheenColorMap,Le=ne&&!!A.sheenRoughnessMap,ie=!!A.specularMap,Ke=!!A.specularColorMap,ri=!!A.specularIntensityMap,Ti=oe&&!!A.transmissionMap,le=oe&&!!A.thicknessMap,xi=!!A.gradientMap,bt=!!A.alphaMap,Me=A.alphaTest>0,Ce=!!A.alphaHash,Ve=!!A.extensions;let Je=Bo;A.toneMapped&&(_===null||_.isXRRenderTarget===!0)&&(Je=g.toneMapping);const zi={isWebGL2:h,shaderID:K,shaderType:A.type,shaderName:A.name,vertexShader:Z,fragmentShader:U,defines:A.defines,customVertexShaderID:H,customFragmentShaderID:J,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:n,batching:at,instancing:q,instancingColor:q&&I.instanceColor!==null,supportsVertexTextures:l,outputColorSpace:_===null?g.outputColorSpace:_.isXRRenderTarget===!0?_.texture.colorSpace:Go,alphaToCoverage:!!A.alphaToCoverage,map:ot,matcap:rt,envMap:gt,envMapMode:gt&&z.mapping,envMapCubeUVHeight:X,aoMap:yt,lightMap:Et,bumpMap:At,normalMap:Pt,displacementMap:l&&Vt,emissiveMap:dt,normalMapObjectSpace:Pt&&A.normalMapType===iw,normalMapTangentSpace:Pt&&A.normalMapType===yh,metalnessMap:ut,roughnessMap:Rt,anisotropy:Dt,anisotropyMap:ge,clearcoat:Ht,clearcoatMap:xe,clearcoatNormalMap:Ae,clearcoatRoughnessMap:qt,iridescence:Bt,iridescenceMap:Ge,iridescenceThicknessMap:Oe,sheen:ne,sheenColorMap:Be,sheenRoughnessMap:Le,specularMap:ie,specularColorMap:Ke,specularIntensityMap:ri,transmission:oe,transmissionMap:Ti,thicknessMap:le,gradientMap:xi,opaque:A.transparent===!1&&A.blending===yu&&A.alphaToCoverage===!1,alphaMap:bt,alphaTest:Me,alphaHash:Ce,combine:A.combine,mapUv:ot&&f(A.map.channel),aoMapUv:yt&&f(A.aoMap.channel),lightMapUv:Et&&f(A.lightMap.channel),bumpMapUv:At&&f(A.bumpMap.channel),normalMapUv:Pt&&f(A.normalMap.channel),displacementMapUv:Vt&&f(A.displacementMap.channel),emissiveMapUv:dt&&f(A.emissiveMap.channel),metalnessMapUv:ut&&f(A.metalnessMap.channel),roughnessMapUv:Rt&&f(A.roughnessMap.channel),anisotropyMapUv:ge&&f(A.anisotropyMap.channel),clearcoatMapUv:xe&&f(A.clearcoatMap.channel),clearcoatNormalMapUv:Ae&&f(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:qt&&f(A.clearcoatRoughnessMap.channel),iridescenceMapUv:Ge&&f(A.iridescenceMap.channel),iridescenceThicknessMapUv:Oe&&f(A.iridescenceThicknessMap.channel),sheenColorMapUv:Be&&f(A.sheenColorMap.channel),sheenRoughnessMapUv:Le&&f(A.sheenRoughnessMap.channel),specularMapUv:ie&&f(A.specularMap.channel),specularColorMapUv:Ke&&f(A.specularColorMap.channel),specularIntensityMapUv:ri&&f(A.specularIntensityMap.channel),transmissionMapUv:Ti&&f(A.transmissionMap.channel),thicknessMapUv:le&&f(A.thicknessMap.channel),alphaMapUv:bt&&f(A.alphaMap.channel),vertexTangents:!!B.attributes.tangent&&(Pt||Dt),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,pointsUvs:I.isPoints===!0&&!!B.attributes.uv&&(ot||bt),fog:!!D,useFog:A.fog===!0,fogExp2:!!D&&D.isFogExp2,flatShading:A.flatShading===!0,sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:a,skinning:I.isSkinnedMesh===!0,morphTargets:B.morphAttributes.position!==void 0,morphNormals:B.morphAttributes.normal!==void 0,morphColors:B.morphAttributes.color!==void 0,morphTargetsCount:tt,morphTextureStride:Y,numDirLights:P.directional.length,numPointLights:P.point.length,numSpotLights:P.spot.length,numSpotLightMaps:P.spotLightMap.length,numRectAreaLights:P.rectArea.length,numHemiLights:P.hemi.length,numDirLightShadows:P.directionalShadowMap.length,numPointLightShadows:P.pointShadowMap.length,numSpotLightShadows:P.spotShadowMap.length,numSpotLightShadowsWithMaps:P.numSpotLightShadowsWithMaps,numLightProbes:P.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:A.dithering,shadowMapEnabled:g.shadowMap.enabled&&b.length>0,shadowMapType:g.shadowMap.type,toneMapping:Je,useLegacyLights:g._useLegacyLights,decodeVideoTexture:ot&&A.map.isVideoTexture===!0&&rn.getTransfer(A.map.colorSpace)===vn,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===Oo,flipSided:A.side===ms,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionDerivatives:Ve&&A.extensions.derivatives===!0,extensionFragDepth:Ve&&A.extensions.fragDepth===!0,extensionDrawBuffers:Ve&&A.extensions.drawBuffers===!0,extensionShaderTextureLOD:Ve&&A.extensions.shaderTextureLOD===!0,extensionClipCullDistance:Ve&&A.extensions.clipCullDistance===!0&&x.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Ve&&A.extensions.multiDraw===!0&&x.has("WEBGL_multi_draw"),rendererExtensionFragDepth:h||x.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||x.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||x.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:x.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return zi.vertexUv1s=r.has(1),zi.vertexUv2s=r.has(2),zi.vertexUv3s=r.has(3),r.clear(),zi}function c(A){const P=[];if(A.shaderID?P.push(A.shaderID):(P.push(A.customVertexShaderID),P.push(A.customFragmentShaderID)),A.defines!==void 0)for(const b in A.defines)P.push(b),P.push(A.defines[b]);return A.isRawShaderMaterial===!1&&(d(P,A),v(P,A),P.push(g.outputColorSpace)),P.push(A.customProgramCacheKey),P.join()}function d(A,P){A.push(P.precision),A.push(P.outputColorSpace),A.push(P.envMapMode),A.push(P.envMapCubeUVHeight),A.push(P.mapUv),A.push(P.alphaMapUv),A.push(P.lightMapUv),A.push(P.aoMapUv),A.push(P.bumpMapUv),A.push(P.normalMapUv),A.push(P.displacementMapUv),A.push(P.emissiveMapUv),A.push(P.metalnessMapUv),A.push(P.roughnessMapUv),A.push(P.anisotropyMapUv),A.push(P.clearcoatMapUv),A.push(P.clearcoatNormalMapUv),A.push(P.clearcoatRoughnessMapUv),A.push(P.iridescenceMapUv),A.push(P.iridescenceThicknessMapUv),A.push(P.sheenColorMapUv),A.push(P.sheenRoughnessMapUv),A.push(P.specularMapUv),A.push(P.specularColorMapUv),A.push(P.specularIntensityMapUv),A.push(P.transmissionMapUv),A.push(P.thicknessMapUv),A.push(P.combine),A.push(P.fogExp2),A.push(P.sizeAttenuation),A.push(P.morphTargetsCount),A.push(P.morphAttributeCount),A.push(P.numDirLights),A.push(P.numPointLights),A.push(P.numSpotLights),A.push(P.numSpotLightMaps),A.push(P.numHemiLights),A.push(P.numRectAreaLights),A.push(P.numDirLightShadows),A.push(P.numPointLightShadows),A.push(P.numSpotLightShadows),A.push(P.numSpotLightShadowsWithMaps),A.push(P.numLightProbes),A.push(P.shadowMapType),A.push(P.toneMapping),A.push(P.numClippingPlanes),A.push(P.numClipIntersection),A.push(P.depthPacking)}function v(A,P){y.disableAll(),P.isWebGL2&&y.enable(0),P.supportsVertexTextures&&y.enable(1),P.instancing&&y.enable(2),P.instancingColor&&y.enable(3),P.matcap&&y.enable(4),P.envMap&&y.enable(5),P.normalMapObjectSpace&&y.enable(6),P.normalMapTangentSpace&&y.enable(7),P.clearcoat&&y.enable(8),P.iridescence&&y.enable(9),P.alphaTest&&y.enable(10),P.vertexColors&&y.enable(11),P.vertexAlphas&&y.enable(12),P.vertexUv1s&&y.enable(13),P.vertexUv2s&&y.enable(14),P.vertexUv3s&&y.enable(15),P.vertexTangents&&y.enable(16),P.anisotropy&&y.enable(17),P.alphaHash&&y.enable(18),P.batching&&y.enable(19),A.push(y.mask),y.disableAll(),P.fog&&y.enable(0),P.useFog&&y.enable(1),P.flatShading&&y.enable(2),P.logarithmicDepthBuffer&&y.enable(3),P.skinning&&y.enable(4),P.morphTargets&&y.enable(5),P.morphNormals&&y.enable(6),P.morphColors&&y.enable(7),P.premultipliedAlpha&&y.enable(8),P.shadowMapEnabled&&y.enable(9),P.useLegacyLights&&y.enable(10),P.doubleSided&&y.enable(11),P.flipSided&&y.enable(12),P.useDepthPacking&&y.enable(13),P.dithering&&y.enable(14),P.transmission&&y.enable(15),P.sheen&&y.enable(16),P.opaque&&y.enable(17),P.pointsUvs&&y.enable(18),P.decodeVideoTexture&&y.enable(19),P.alphaToCoverage&&y.enable(20),A.push(y.mask)}function m(A){const P=u[A.type];let b;if(P){const O=to[P];b=vw.clone(O.uniforms)}else b=A.uniforms;return b}function S(A,P){let b;for(let O=0,I=p.length;O0?x.push(o):l.transparent===!0?T.push(o):i.push(o)}function e(h,a,l,n,u,f){const o=s(h,a,l,n,u,f);l.transmission>0?x.unshift(o):l.transparent===!0?T.unshift(o):i.unshift(o)}function r(h,a){i.length>1&&i.sort(h||A6),x.length>1&&x.sort(a||lE),T.length>1&&T.sort(a||lE)}function p(){for(let h=t,a=g.length;h=E.length?(s=new hE,E.push(s)):s=E[T],s}function i(){g=new WeakMap}return{get:t,dispose:i}}function R6(){const g={};return{get:function(t){if(g[t.id]!==void 0)return g[t.id];let i;switch(t.type){case"DirectionalLight":i={direction:new Ct,color:new ze};break;case"SpotLight":i={position:new Ct,direction:new Ct,color:new ze,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new Ct,color:new ze,distance:0,decay:0};break;case"HemisphereLight":i={direction:new Ct,skyColor:new ze,groundColor:new ze};break;case"RectAreaLight":i={color:new ze,position:new Ct,halfWidth:new Ct,halfHeight:new Ct};break}return g[t.id]=i,i}}}function b6(){const g={};return{get:function(t){if(g[t.id]!==void 0)return g[t.id];let i;switch(t.type){case"DirectionalLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ve};break;case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ve};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ve,shadowCameraNear:1,shadowCameraFar:1e3};break}return g[t.id]=i,i}}}let L6=0;function F6(g,t){return(t.castShadow?2:0)-(g.castShadow?2:0)+(t.map?1:0)-(g.map?1:0)}function O6(g,t){const i=new R6,x=b6(),T={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let p=0;p<9;p++)T.probe.push(new Ct);const E=new Ct,s=new ci,y=new ci;function e(p,h){let a=0,l=0,n=0;for(let b=0;b<9;b++)T.probe[b].set(0,0,0);let u=0,f=0,o=0,c=0,d=0,v=0,m=0,S=0,M=0,w=0,C=0;p.sort(F6);const A=h===!0?Math.PI:1;for(let b=0,O=p.length;b0&&(t.isWebGL2?g.has("OES_texture_float_linear")===!0?(T.rectAreaLTC1=Fe.LTC_FLOAT_1,T.rectAreaLTC2=Fe.LTC_FLOAT_2):(T.rectAreaLTC1=Fe.LTC_HALF_1,T.rectAreaLTC2=Fe.LTC_HALF_2):g.has("OES_texture_float_linear")===!0?(T.rectAreaLTC1=Fe.LTC_FLOAT_1,T.rectAreaLTC2=Fe.LTC_FLOAT_2):g.has("OES_texture_half_float_linear")===!0?(T.rectAreaLTC1=Fe.LTC_HALF_1,T.rectAreaLTC2=Fe.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),T.ambient[0]=a,T.ambient[1]=l,T.ambient[2]=n;const P=T.hash;(P.directionalLength!==u||P.pointLength!==f||P.spotLength!==o||P.rectAreaLength!==c||P.hemiLength!==d||P.numDirectionalShadows!==v||P.numPointShadows!==m||P.numSpotShadows!==S||P.numSpotMaps!==M||P.numLightProbes!==C)&&(T.directional.length=u,T.spot.length=o,T.rectArea.length=c,T.point.length=f,T.hemi.length=d,T.directionalShadow.length=v,T.directionalShadowMap.length=v,T.pointShadow.length=m,T.pointShadowMap.length=m,T.spotShadow.length=S,T.spotShadowMap.length=S,T.directionalShadowMatrix.length=v,T.pointShadowMatrix.length=m,T.spotLightMatrix.length=S+M-w,T.spotLightMap.length=M,T.numSpotLightShadowsWithMaps=w,T.numLightProbes=C,P.directionalLength=u,P.pointLength=f,P.spotLength=o,P.rectAreaLength=c,P.hemiLength=d,P.numDirectionalShadows=v,P.numPointShadows=m,P.numSpotShadows=S,P.numSpotMaps=M,P.numLightProbes=C,T.version=L6++)}function r(p,h){let a=0,l=0,n=0,u=0,f=0;const o=h.matrixWorldInverse;for(let c=0,d=p.length;c=y.length?(e=new uE(g,t),y.push(e)):e=y[s],e}function T(){i=new WeakMap}return{get:x,dispose:T}}class T1 extends Hr{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=tw,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class E1 extends Hr{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}const I6=`void main() { +`+X)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(I===""||D==="")&&(G=!1);G&&(b.diagnostics={runnable:B,programLog:O,vertexShader:{log:I,prefix:o},fragmentShader:{log:D,prefix:c}})}T.deleteShader(S),T.deleteShader(M),C=new hm(T,f),A=f6(T,f)}let C;this.getUniforms=function(){return C===void 0&&w(this),C};let A;this.getAttributes=function(){return A===void 0&&w(this),A};let P=i.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return P===!1&&(P=T.getProgramParameter(f,i6)),P},this.destroy=function(){x.releaseStatesOfProgram(this),T.deleteProgram(f),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=n6++,this.cacheKey=t,this.usedTimes=1,this.program=f,this.vertexShader=S,this.fragmentShader=M,this}let M6=0;class C6{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const i=t.vertexShader,x=t.fragmentShader,T=this._getShaderStage(i),E=this._getShaderStage(x),s=this._getShaderCacheForMaterial(t);return s.has(T)===!1&&(s.add(T),T.usedTimes++),s.has(E)===!1&&(s.add(E),E.usedTimes++),this}remove(t){const i=this.materialCache.get(t);for(const x of i)x.usedTimes--,x.usedTimes===0&&this.shaderCache.delete(x.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const i=this.materialCache;let x=i.get(t);return x===void 0&&(x=new Set,i.set(t,x)),x}_getShaderStage(t){const i=this.shaderCache;let x=i.get(t);return x===void 0&&(x=new w6(t),i.set(t,x)),x}}class w6{constructor(t){this.id=M6++,this.code=t,this.usedTimes=0}}function A6(g,t,i,x,T,E,s){const y=new Su,e=new C6,r=new Set,p=[],h=T.isWebGL2,a=T.logarithmicDepthBuffer,l=T.vertexTextures;let n=T.precision;const u={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(A){return r.add(A),A===0?"uv":`uv${A}`}function o(A,P,b,O,I){const D=O.fog,B=I.geometry,G=A.isMeshStandardMaterial?O.environment:null,z=(A.isMeshStandardMaterial?i:t).get(A.envMap||G),X=z&&z.mapping===ec?z.image.height:null,j=u[A.type];A.precision!==null&&(n=T.getMaxPrecision(A.precision),n!==A.precision&&console.warn("THREE.WebGLProgram.getParameters:",A.precision,"not supported, using",n,"instead."));const Q=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,tt=Q!==void 0?Q.length:0;let Y=0;B.morphAttributes.position!==void 0&&(Y=1),B.morphAttributes.normal!==void 0&&(Y=2),B.morphAttributes.color!==void 0&&(Y=3);let Z,U,H,J;if(j){const Di=to[j];Z=Di.vertexShader,U=Di.fragmentShader}else Z=A.vertexShader,U=A.fragmentShader,e.update(A),H=e.getVertexShaderID(A),J=e.getFragmentShaderID(A);const _=g.getRenderTarget(),q=I.isInstancedMesh===!0,at=I.isBatchedMesh===!0,ot=!!A.map,rt=!!A.matcap,gt=!!z,yt=!!A.aoMap,Et=!!A.lightMap,At=!!A.bumpMap,Pt=!!A.normalMap,Vt=!!A.displacementMap,dt=!!A.emissiveMap,ut=!!A.metalnessMap,Rt=!!A.roughnessMap,Dt=A.anisotropy>0,Ht=A.clearcoat>0,Bt=A.iridescence>0,re=A.sheen>0,le=A.transmission>0,ge=Dt&&!!A.anisotropyMap,xe=Ht&&!!A.clearcoatMap,Pe=Ht&&!!A.clearcoatNormalMap,te=Ht&&!!A.clearcoatRoughnessMap,Ge=Bt&&!!A.iridescenceMap,Oe=Bt&&!!A.iridescenceThicknessMap,Be=re&&!!A.sheenColorMap,Le=re&&!!A.sheenRoughnessMap,ne=!!A.specularMap,je=!!A.specularColorMap,ri=!!A.specularIntensityMap,Ei=le&&!!A.transmissionMap,he=le&&!!A.thicknessMap,Si=!!A.gradientMap,bt=!!A.alphaMap,Me=A.alphaTest>0,Ce=!!A.alphaHash,Ve=!!A.extensions;let Je=Uo;A.toneMapped&&(_===null||_.isXRRenderTarget===!0)&&(Je=g.toneMapping);const zi={isWebGL2:h,shaderID:j,shaderType:A.type,shaderName:A.name,vertexShader:Z,fragmentShader:U,defines:A.defines,customVertexShaderID:H,customFragmentShaderID:J,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:n,batching:at,instancing:q,instancingColor:q&&I.instanceColor!==null,supportsVertexTextures:l,outputColorSpace:_===null?g.outputColorSpace:_.isXRRenderTarget===!0?_.texture.colorSpace:Vo,alphaToCoverage:!!A.alphaToCoverage,map:ot,matcap:rt,envMap:gt,envMapMode:gt&&z.mapping,envMapCubeUVHeight:X,aoMap:yt,lightMap:Et,bumpMap:At,normalMap:Pt,displacementMap:l&&Vt,emissiveMap:dt,normalMapObjectSpace:Pt&&A.normalMapType===nw,normalMapTangentSpace:Pt&&A.normalMapType===yh,metalnessMap:ut,roughnessMap:Rt,anisotropy:Dt,anisotropyMap:ge,clearcoat:Ht,clearcoatMap:xe,clearcoatNormalMap:Pe,clearcoatRoughnessMap:te,iridescence:Bt,iridescenceMap:Ge,iridescenceThicknessMap:Oe,sheen:re,sheenColorMap:Be,sheenRoughnessMap:Le,specularMap:ne,specularColorMap:je,specularIntensityMap:ri,transmission:le,transmissionMap:Ei,thicknessMap:he,gradientMap:Si,opaque:A.transparent===!1&&A.blending===gu&&A.alphaToCoverage===!1,alphaMap:bt,alphaTest:Me,alphaHash:Ce,combine:A.combine,mapUv:ot&&f(A.map.channel),aoMapUv:yt&&f(A.aoMap.channel),lightMapUv:Et&&f(A.lightMap.channel),bumpMapUv:At&&f(A.bumpMap.channel),normalMapUv:Pt&&f(A.normalMap.channel),displacementMapUv:Vt&&f(A.displacementMap.channel),emissiveMapUv:dt&&f(A.emissiveMap.channel),metalnessMapUv:ut&&f(A.metalnessMap.channel),roughnessMapUv:Rt&&f(A.roughnessMap.channel),anisotropyMapUv:ge&&f(A.anisotropyMap.channel),clearcoatMapUv:xe&&f(A.clearcoatMap.channel),clearcoatNormalMapUv:Pe&&f(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:te&&f(A.clearcoatRoughnessMap.channel),iridescenceMapUv:Ge&&f(A.iridescenceMap.channel),iridescenceThicknessMapUv:Oe&&f(A.iridescenceThicknessMap.channel),sheenColorMapUv:Be&&f(A.sheenColorMap.channel),sheenRoughnessMapUv:Le&&f(A.sheenRoughnessMap.channel),specularMapUv:ne&&f(A.specularMap.channel),specularColorMapUv:je&&f(A.specularColorMap.channel),specularIntensityMapUv:ri&&f(A.specularIntensityMap.channel),transmissionMapUv:Ei&&f(A.transmissionMap.channel),thicknessMapUv:he&&f(A.thicknessMap.channel),alphaMapUv:bt&&f(A.alphaMap.channel),vertexTangents:!!B.attributes.tangent&&(Pt||Dt),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,pointsUvs:I.isPoints===!0&&!!B.attributes.uv&&(ot||bt),fog:!!D,useFog:A.fog===!0,fogExp2:!!D&&D.isFogExp2,flatShading:A.flatShading===!0,sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:a,skinning:I.isSkinnedMesh===!0,morphTargets:B.morphAttributes.position!==void 0,morphNormals:B.morphAttributes.normal!==void 0,morphColors:B.morphAttributes.color!==void 0,morphTargetsCount:tt,morphTextureStride:Y,numDirLights:P.directional.length,numPointLights:P.point.length,numSpotLights:P.spot.length,numSpotLightMaps:P.spotLightMap.length,numRectAreaLights:P.rectArea.length,numHemiLights:P.hemi.length,numDirLightShadows:P.directionalShadowMap.length,numPointLightShadows:P.pointShadowMap.length,numSpotLightShadows:P.spotShadowMap.length,numSpotLightShadowsWithMaps:P.numSpotLightShadowsWithMaps,numLightProbes:P.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:A.dithering,shadowMapEnabled:g.shadowMap.enabled&&b.length>0,shadowMapType:g.shadowMap.type,toneMapping:Je,useLegacyLights:g._useLegacyLights,decodeVideoTexture:ot&&A.map.isVideoTexture===!0&&rn.getTransfer(A.map.colorSpace)===vn,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===Oo,flipSided:A.side===ms,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionDerivatives:Ve&&A.extensions.derivatives===!0,extensionFragDepth:Ve&&A.extensions.fragDepth===!0,extensionDrawBuffers:Ve&&A.extensions.drawBuffers===!0,extensionShaderTextureLOD:Ve&&A.extensions.shaderTextureLOD===!0,extensionClipCullDistance:Ve&&A.extensions.clipCullDistance===!0&&x.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Ve&&A.extensions.multiDraw===!0&&x.has("WEBGL_multi_draw"),rendererExtensionFragDepth:h||x.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||x.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||x.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:x.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return zi.vertexUv1s=r.has(1),zi.vertexUv2s=r.has(2),zi.vertexUv3s=r.has(3),r.clear(),zi}function c(A){const P=[];if(A.shaderID?P.push(A.shaderID):(P.push(A.customVertexShaderID),P.push(A.customFragmentShaderID)),A.defines!==void 0)for(const b in A.defines)P.push(b),P.push(A.defines[b]);return A.isRawShaderMaterial===!1&&(d(P,A),v(P,A),P.push(g.outputColorSpace)),P.push(A.customProgramCacheKey),P.join()}function d(A,P){A.push(P.precision),A.push(P.outputColorSpace),A.push(P.envMapMode),A.push(P.envMapCubeUVHeight),A.push(P.mapUv),A.push(P.alphaMapUv),A.push(P.lightMapUv),A.push(P.aoMapUv),A.push(P.bumpMapUv),A.push(P.normalMapUv),A.push(P.displacementMapUv),A.push(P.emissiveMapUv),A.push(P.metalnessMapUv),A.push(P.roughnessMapUv),A.push(P.anisotropyMapUv),A.push(P.clearcoatMapUv),A.push(P.clearcoatNormalMapUv),A.push(P.clearcoatRoughnessMapUv),A.push(P.iridescenceMapUv),A.push(P.iridescenceThicknessMapUv),A.push(P.sheenColorMapUv),A.push(P.sheenRoughnessMapUv),A.push(P.specularMapUv),A.push(P.specularColorMapUv),A.push(P.specularIntensityMapUv),A.push(P.transmissionMapUv),A.push(P.thicknessMapUv),A.push(P.combine),A.push(P.fogExp2),A.push(P.sizeAttenuation),A.push(P.morphTargetsCount),A.push(P.morphAttributeCount),A.push(P.numDirLights),A.push(P.numPointLights),A.push(P.numSpotLights),A.push(P.numSpotLightMaps),A.push(P.numHemiLights),A.push(P.numRectAreaLights),A.push(P.numDirLightShadows),A.push(P.numPointLightShadows),A.push(P.numSpotLightShadows),A.push(P.numSpotLightShadowsWithMaps),A.push(P.numLightProbes),A.push(P.shadowMapType),A.push(P.toneMapping),A.push(P.numClippingPlanes),A.push(P.numClipIntersection),A.push(P.depthPacking)}function v(A,P){y.disableAll(),P.isWebGL2&&y.enable(0),P.supportsVertexTextures&&y.enable(1),P.instancing&&y.enable(2),P.instancingColor&&y.enable(3),P.matcap&&y.enable(4),P.envMap&&y.enable(5),P.normalMapObjectSpace&&y.enable(6),P.normalMapTangentSpace&&y.enable(7),P.clearcoat&&y.enable(8),P.iridescence&&y.enable(9),P.alphaTest&&y.enable(10),P.vertexColors&&y.enable(11),P.vertexAlphas&&y.enable(12),P.vertexUv1s&&y.enable(13),P.vertexUv2s&&y.enable(14),P.vertexUv3s&&y.enable(15),P.vertexTangents&&y.enable(16),P.anisotropy&&y.enable(17),P.alphaHash&&y.enable(18),P.batching&&y.enable(19),A.push(y.mask),y.disableAll(),P.fog&&y.enable(0),P.useFog&&y.enable(1),P.flatShading&&y.enable(2),P.logarithmicDepthBuffer&&y.enable(3),P.skinning&&y.enable(4),P.morphTargets&&y.enable(5),P.morphNormals&&y.enable(6),P.morphColors&&y.enable(7),P.premultipliedAlpha&&y.enable(8),P.shadowMapEnabled&&y.enable(9),P.useLegacyLights&&y.enable(10),P.doubleSided&&y.enable(11),P.flipSided&&y.enable(12),P.useDepthPacking&&y.enable(13),P.dithering&&y.enable(14),P.transmission&&y.enable(15),P.sheen&&y.enable(16),P.opaque&&y.enable(17),P.pointsUvs&&y.enable(18),P.decodeVideoTexture&&y.enable(19),P.alphaToCoverage&&y.enable(20),A.push(y.mask)}function m(A){const P=u[A.type];let b;if(P){const O=to[P];b=mw.clone(O.uniforms)}else b=A.uniforms;return b}function S(A,P){let b;for(let O=0,I=p.length;O0?x.push(o):l.transparent===!0?T.push(o):i.push(o)}function e(h,a,l,n,u,f){const o=s(h,a,l,n,u,f);l.transmission>0?x.unshift(o):l.transparent===!0?T.unshift(o):i.unshift(o)}function r(h,a){i.length>1&&i.sort(h||R6),x.length>1&&x.sort(a||oE),T.length>1&&T.sort(a||oE)}function p(){for(let h=t,a=g.length;h=E.length?(s=new lE,E.push(s)):s=E[T],s}function i(){g=new WeakMap}return{get:t,dispose:i}}function L6(){const g={};return{get:function(t){if(g[t.id]!==void 0)return g[t.id];let i;switch(t.type){case"DirectionalLight":i={direction:new Ct,color:new ze};break;case"SpotLight":i={position:new Ct,direction:new Ct,color:new ze,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new Ct,color:new ze,distance:0,decay:0};break;case"HemisphereLight":i={direction:new Ct,skyColor:new ze,groundColor:new ze};break;case"RectAreaLight":i={color:new ze,position:new Ct,halfWidth:new Ct,halfHeight:new Ct};break}return g[t.id]=i,i}}}function F6(){const g={};return{get:function(t){if(g[t.id]!==void 0)return g[t.id];let i;switch(t.type){case"DirectionalLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ve};break;case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ve};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ve,shadowCameraNear:1,shadowCameraFar:1e3};break}return g[t.id]=i,i}}}let O6=0;function D6(g,t){return(t.castShadow?2:0)-(g.castShadow?2:0)+(t.map?1:0)-(g.map?1:0)}function I6(g,t){const i=new L6,x=F6(),T={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let p=0;p<9;p++)T.probe.push(new Ct);const E=new Ct,s=new ci,y=new ci;function e(p,h){let a=0,l=0,n=0;for(let b=0;b<9;b++)T.probe[b].set(0,0,0);let u=0,f=0,o=0,c=0,d=0,v=0,m=0,S=0,M=0,w=0,C=0;p.sort(D6);const A=h===!0?Math.PI:1;for(let b=0,O=p.length;b0&&(t.isWebGL2?g.has("OES_texture_float_linear")===!0?(T.rectAreaLTC1=Fe.LTC_FLOAT_1,T.rectAreaLTC2=Fe.LTC_FLOAT_2):(T.rectAreaLTC1=Fe.LTC_HALF_1,T.rectAreaLTC2=Fe.LTC_HALF_2):g.has("OES_texture_float_linear")===!0?(T.rectAreaLTC1=Fe.LTC_FLOAT_1,T.rectAreaLTC2=Fe.LTC_FLOAT_2):g.has("OES_texture_half_float_linear")===!0?(T.rectAreaLTC1=Fe.LTC_HALF_1,T.rectAreaLTC2=Fe.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),T.ambient[0]=a,T.ambient[1]=l,T.ambient[2]=n;const P=T.hash;(P.directionalLength!==u||P.pointLength!==f||P.spotLength!==o||P.rectAreaLength!==c||P.hemiLength!==d||P.numDirectionalShadows!==v||P.numPointShadows!==m||P.numSpotShadows!==S||P.numSpotMaps!==M||P.numLightProbes!==C)&&(T.directional.length=u,T.spot.length=o,T.rectArea.length=c,T.point.length=f,T.hemi.length=d,T.directionalShadow.length=v,T.directionalShadowMap.length=v,T.pointShadow.length=m,T.pointShadowMap.length=m,T.spotShadow.length=S,T.spotShadowMap.length=S,T.directionalShadowMatrix.length=v,T.pointShadowMatrix.length=m,T.spotLightMatrix.length=S+M-w,T.spotLightMap.length=M,T.numSpotLightShadowsWithMaps=w,T.numLightProbes=C,P.directionalLength=u,P.pointLength=f,P.spotLength=o,P.rectAreaLength=c,P.hemiLength=d,P.numDirectionalShadows=v,P.numPointShadows=m,P.numSpotShadows=S,P.numSpotMaps=M,P.numLightProbes=C,T.version=O6++)}function r(p,h){let a=0,l=0,n=0,u=0,f=0;const o=h.matrixWorldInverse;for(let c=0,d=p.length;c=y.length?(e=new hE(g,t),y.push(e)):e=y[s],e}function T(){i=new WeakMap}return{get:x,dispose:T}}class T1 extends Hr{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ew,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class E1 extends Hr{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}const B6=`void main() { gl_Position = vec4( position, 1.0 ); -}`,N6=`uniform sampler2D shadow_pass; +}`,U6=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -10140,12 +10140,12 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function B6(g,t,i){let x=new _d;const T=new ve,E=new ve,s=new sn,y=new T1({depthPacking:ew}),e=new E1,r={},p=i.maxTextureSize,h={[Cl]:ms,[ms]:Cl,[Oo]:Oo},a=new no({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ve},radius:{value:4}},vertexShader:I6,fragmentShader:N6}),l=a.clone();l.defines.HORIZONTAL_PASS=1;const n=new Li;n.setAttribute("position",new an(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const u=new cr(n,a),f=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=rg;let o=this.type;this.render=function(S,M,w){if(f.enabled===!1||f.autoUpdate===!1&&f.needsUpdate===!1||S.length===0)return;const C=g.getRenderTarget(),A=g.getActiveCubeFace(),P=g.getActiveMipmapLevel(),b=g.state;b.setBlending(Ml),b.buffers.color.setClear(1,1,1,1),b.buffers.depth.setTest(!0),b.setScissorTest(!1);const O=o!==_a&&this.type===_a,I=o===_a&&this.type!==_a;for(let D=0,B=S.length;Dp||T.y>p)&&(T.x>p&&(E.x=Math.floor(p/X.x),T.x=E.x*X.x,z.mapSize.x=E.x),T.y>p&&(E.y=Math.floor(p/X.y),T.y=E.y*X.y,z.mapSize.y=E.y)),z.map===null||O===!0||I===!0){const Q=this.type!==_a?{minFilter:nr,magFilter:nr}:{};z.map!==null&&z.map.dispose(),z.map=new io(T.x,T.y,Q),z.map.texture.name=G.name+".shadowMap",z.camera.updateProjectionMatrix()}g.setRenderTarget(z.map),g.clear();const K=z.getViewportCount();for(let Q=0;Q0||M.map&&M.alphaTest>0){const b=A.uuid,O=M.uuid;let I=r[b];I===void 0&&(I={},r[b]=I);let D=I[O];D===void 0&&(D=A.clone(),I[O]=D,M.addEventListener("dispose",m)),A=D}if(A.visible=M.visible,A.wireframe=M.wireframe,C===_a?A.side=M.shadowSide!==null?M.shadowSide:M.side:A.side=M.shadowSide!==null?M.shadowSide:h[M.side],A.alphaMap=M.alphaMap,A.alphaTest=M.alphaTest,A.map=M.map,A.clipShadows=M.clipShadows,A.clippingPlanes=M.clippingPlanes,A.clipIntersection=M.clipIntersection,A.displacementMap=M.displacementMap,A.displacementScale=M.displacementScale,A.displacementBias=M.displacementBias,A.wireframeLinewidth=M.wireframeLinewidth,A.linewidth=M.linewidth,w.isPointLight===!0&&A.isMeshDistanceMaterial===!0){const b=g.properties.get(A);b.light=w}return A}function v(S,M,w,C,A){if(S.visible===!1)return;if(S.layers.test(M.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&A===_a)&&(!S.frustumCulled||x.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,S.matrixWorld);const O=t.update(S),I=S.material;if(Array.isArray(I)){const D=O.groups;for(let B=0,G=D.length;B=1):K.indexOf("OpenGL ES")!==-1&&(X=parseFloat(/^OpenGL ES (\d)/.exec(K)[1]),z=X>=2);let Q=null,tt={};const Y=g.getParameter(g.SCISSOR_BOX),Z=g.getParameter(g.VIEWPORT),U=new sn().fromArray(Y),H=new sn().fromArray(Z);function J(bt,Me,Ce,Ve){const Je=new Uint8Array(4),zi=g.createTexture();g.bindTexture(bt,zi),g.texParameteri(bt,g.TEXTURE_MIN_FILTER,g.NEAREST),g.texParameteri(bt,g.TEXTURE_MAG_FILTER,g.NEAREST);for(let Di=0;Di"u"?!1:/OculusBrowser/g.test(navigator.userAgent),p=new WeakMap;let h;const a=new WeakMap;let l=!1;try{l=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function n(dt,ut){return l?new OffscreenCanvas(dt,ut):Dd("canvas")}function u(dt,ut,Rt,Dt){let Ht=1;if((dt.width>Dt||dt.height>Dt)&&(Ht=Dt/Math.max(dt.width,dt.height)),Ht<1||ut===!0)if(typeof HTMLImageElement<"u"&&dt instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&dt instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&dt instanceof ImageBitmap){const Bt=ut?Em:Math.floor,ne=Bt(Ht*dt.width),oe=Bt(Ht*dt.height);h===void 0&&(h=n(ne,oe));const ge=Rt?n(ne,oe):h;return ge.width=ne,ge.height=oe,ge.getContext("2d").drawImage(dt,0,0,ne,oe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+dt.width+"x"+dt.height+") to ("+ne+"x"+oe+")."),ge}else return"data"in dt&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+dt.width+"x"+dt.height+")."),dt;return dt}function f(dt){return px(dt.width)&&px(dt.height)}function o(dt){return y?!1:dt.wrapS!==Jr||dt.wrapT!==Jr||dt.minFilter!==nr&&dt.minFilter!==Nn}function c(dt,ut){return dt.generateMipmaps&&ut&&dt.minFilter!==nr&&dt.minFilter!==Nn}function d(dt){g.generateMipmap(dt)}function v(dt,ut,Rt,Dt,Ht=!1){if(y===!1)return ut;if(dt!==null){if(g[dt]!==void 0)return g[dt];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+dt+"'")}let Bt=ut;if(ut===g.RED&&(Rt===g.FLOAT&&(Bt=g.R32F),Rt===g.HALF_FLOAT&&(Bt=g.R16F),Rt===g.UNSIGNED_BYTE&&(Bt=g.R8)),ut===g.RED_INTEGER&&(Rt===g.UNSIGNED_BYTE&&(Bt=g.R8UI),Rt===g.UNSIGNED_SHORT&&(Bt=g.R16UI),Rt===g.UNSIGNED_INT&&(Bt=g.R32UI),Rt===g.BYTE&&(Bt=g.R8I),Rt===g.SHORT&&(Bt=g.R16I),Rt===g.INT&&(Bt=g.R32I)),ut===g.RG&&(Rt===g.FLOAT&&(Bt=g.RG32F),Rt===g.HALF_FLOAT&&(Bt=g.RG16F),Rt===g.UNSIGNED_BYTE&&(Bt=g.RG8)),ut===g.RGBA){const ne=Ht?Rd:rn.getTransfer(Dt);Rt===g.FLOAT&&(Bt=g.RGBA32F),Rt===g.HALF_FLOAT&&(Bt=g.RGBA16F),Rt===g.UNSIGNED_BYTE&&(Bt=ne===vn?g.SRGB8_ALPHA8:g.RGBA8),Rt===g.UNSIGNED_SHORT_4_4_4_4&&(Bt=g.RGBA4),Rt===g.UNSIGNED_SHORT_5_5_5_1&&(Bt=g.RGB5_A1)}return(Bt===g.R16F||Bt===g.R32F||Bt===g.RG16F||Bt===g.RG32F||Bt===g.RGBA16F||Bt===g.RGBA32F)&&t.get("EXT_color_buffer_float"),Bt}function m(dt,ut,Rt){return c(dt,Rt)===!0||dt.isFramebufferTexture&&dt.minFilter!==nr&&dt.minFilter!==Nn?Math.log2(Math.max(ut.width,ut.height))+1:dt.mipmaps!==void 0&&dt.mipmaps.length>0?dt.mipmaps.length:dt.isCompressedTexture&&Array.isArray(dt.image)?ut.mipmaps.length:1}function S(dt){return dt===nr||dt===Sm||dt===fu?g.NEAREST:g.LINEAR}function M(dt){const ut=dt.target;ut.removeEventListener("dispose",M),C(ut),ut.isVideoTexture&&p.delete(ut)}function w(dt){const ut=dt.target;ut.removeEventListener("dispose",w),P(ut)}function C(dt){const ut=x.get(dt);if(ut.__webglInit===void 0)return;const Rt=dt.source,Dt=a.get(Rt);if(Dt){const Ht=Dt[ut.__cacheKey];Ht.usedTimes--,Ht.usedTimes===0&&A(dt),Object.keys(Dt).length===0&&a.delete(Rt)}x.remove(dt)}function A(dt){const ut=x.get(dt);g.deleteTexture(ut.__webglTexture);const Rt=dt.source,Dt=a.get(Rt);delete Dt[ut.__cacheKey],s.memory.textures--}function P(dt){const ut=dt.texture,Rt=x.get(dt),Dt=x.get(ut);if(Dt.__webglTexture!==void 0&&(g.deleteTexture(Dt.__webglTexture),s.memory.textures--),dt.depthTexture&&dt.depthTexture.dispose(),dt.isWebGLCubeRenderTarget)for(let Ht=0;Ht<6;Ht++){if(Array.isArray(Rt.__webglFramebuffer[Ht]))for(let Bt=0;Bt=T.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+dt+" texture units while this GPU supports only "+T.maxTextures),b+=1,dt}function D(dt){const ut=[];return ut.push(dt.wrapS),ut.push(dt.wrapT),ut.push(dt.wrapR||0),ut.push(dt.magFilter),ut.push(dt.minFilter),ut.push(dt.anisotropy),ut.push(dt.internalFormat),ut.push(dt.format),ut.push(dt.type),ut.push(dt.generateMipmaps),ut.push(dt.premultiplyAlpha),ut.push(dt.flipY),ut.push(dt.unpackAlignment),ut.push(dt.colorSpace),ut.join()}function B(dt,ut){const Rt=x.get(dt);if(dt.isVideoTexture&&Pt(dt),dt.isRenderTargetTexture===!1&&dt.version>0&&Rt.__version!==dt.version){const Dt=dt.image;if(Dt===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Dt.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{U(Rt,dt,ut);return}}i.bindTexture(g.TEXTURE_2D,Rt.__webglTexture,g.TEXTURE0+ut)}function G(dt,ut){const Rt=x.get(dt);if(dt.version>0&&Rt.__version!==dt.version){U(Rt,dt,ut);return}i.bindTexture(g.TEXTURE_2D_ARRAY,Rt.__webglTexture,g.TEXTURE0+ut)}function z(dt,ut){const Rt=x.get(dt);if(dt.version>0&&Rt.__version!==dt.version){U(Rt,dt,ut);return}i.bindTexture(g.TEXTURE_3D,Rt.__webglTexture,g.TEXTURE0+ut)}function X(dt,ut){const Rt=x.get(dt);if(dt.version>0&&Rt.__version!==dt.version){H(Rt,dt,ut);return}i.bindTexture(g.TEXTURE_CUBE_MAP,Rt.__webglTexture,g.TEXTURE0+ut)}const K={[Md]:g.REPEAT,[Jr]:g.CLAMP_TO_EDGE,[Cd]:g.MIRRORED_REPEAT},Q={[nr]:g.NEAREST,[Sm]:g.NEAREST_MIPMAP_NEAREST,[fu]:g.NEAREST_MIPMAP_LINEAR,[Nn]:g.LINEAR,[ud]:g.LINEAR_MIPMAP_NEAREST,[Io]:g.LINEAR_MIPMAP_LINEAR},tt={[nw]:g.NEVER,[hw]:g.ALWAYS,[rw]:g.LESS,[d1]:g.LEQUAL,[sw]:g.EQUAL,[lw]:g.GEQUAL,[aw]:g.GREATER,[ow]:g.NOTEQUAL};function Y(dt,ut,Rt){if(ut.type===Ea&&t.has("OES_texture_float_linear")===!1&&(ut.magFilter===Nn||ut.magFilter===ud||ut.magFilter===fu||ut.magFilter===Io||ut.minFilter===Nn||ut.minFilter===ud||ut.minFilter===fu||ut.minFilter===Io)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),Rt?(g.texParameteri(dt,g.TEXTURE_WRAP_S,K[ut.wrapS]),g.texParameteri(dt,g.TEXTURE_WRAP_T,K[ut.wrapT]),(dt===g.TEXTURE_3D||dt===g.TEXTURE_2D_ARRAY)&&g.texParameteri(dt,g.TEXTURE_WRAP_R,K[ut.wrapR]),g.texParameteri(dt,g.TEXTURE_MAG_FILTER,Q[ut.magFilter]),g.texParameteri(dt,g.TEXTURE_MIN_FILTER,Q[ut.minFilter])):(g.texParameteri(dt,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(dt,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),(dt===g.TEXTURE_3D||dt===g.TEXTURE_2D_ARRAY)&&g.texParameteri(dt,g.TEXTURE_WRAP_R,g.CLAMP_TO_EDGE),(ut.wrapS!==Jr||ut.wrapT!==Jr)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),g.texParameteri(dt,g.TEXTURE_MAG_FILTER,S(ut.magFilter)),g.texParameteri(dt,g.TEXTURE_MIN_FILTER,S(ut.minFilter)),ut.minFilter!==nr&&ut.minFilter!==Nn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),ut.compareFunction&&(g.texParameteri(dt,g.TEXTURE_COMPARE_MODE,g.COMPARE_REF_TO_TEXTURE),g.texParameteri(dt,g.TEXTURE_COMPARE_FUNC,tt[ut.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){const Dt=t.get("EXT_texture_filter_anisotropic");if(ut.magFilter===nr||ut.minFilter!==fu&&ut.minFilter!==Io||ut.type===Ea&&t.has("OES_texture_float_linear")===!1||y===!1&&ut.type===Zf&&t.has("OES_texture_half_float_linear")===!1)return;(ut.anisotropy>1||x.get(ut).__currentAnisotropy)&&(g.texParameterf(dt,Dt.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(ut.anisotropy,T.getMaxAnisotropy())),x.get(ut).__currentAnisotropy=ut.anisotropy)}}function Z(dt,ut){let Rt=!1;dt.__webglInit===void 0&&(dt.__webglInit=!0,ut.addEventListener("dispose",M));const Dt=ut.source;let Ht=a.get(Dt);Ht===void 0&&(Ht={},a.set(Dt,Ht));const Bt=D(ut);if(Bt!==dt.__cacheKey){Ht[Bt]===void 0&&(Ht[Bt]={texture:g.createTexture(),usedTimes:0},s.memory.textures++,Rt=!0),Ht[Bt].usedTimes++;const ne=Ht[dt.__cacheKey];ne!==void 0&&(Ht[dt.__cacheKey].usedTimes--,ne.usedTimes===0&&A(ut)),dt.__cacheKey=Bt,dt.__webglTexture=Ht[Bt].texture}return Rt}function U(dt,ut,Rt){let Dt=g.TEXTURE_2D;(ut.isDataArrayTexture||ut.isCompressedArrayTexture)&&(Dt=g.TEXTURE_2D_ARRAY),ut.isData3DTexture&&(Dt=g.TEXTURE_3D);const Ht=Z(dt,ut),Bt=ut.source;i.bindTexture(Dt,dt.__webglTexture,g.TEXTURE0+Rt);const ne=x.get(Bt);if(Bt.version!==ne.__version||Ht===!0){i.activeTexture(g.TEXTURE0+Rt);const oe=rn.getPrimaries(rn.workingColorSpace),ge=ut.colorSpace===ea?null:rn.getPrimaries(ut.colorSpace),xe=ut.colorSpace===ea||oe===ge?g.NONE:g.BROWSER_DEFAULT_WEBGL;g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,ut.flipY),g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ut.premultiplyAlpha),g.pixelStorei(g.UNPACK_ALIGNMENT,ut.unpackAlignment),g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,xe);const Ae=o(ut)&&f(ut.image)===!1;let qt=u(ut.image,Ae,!1,T.maxTextureSize);qt=Vt(ut,qt);const Ge=f(qt)||y,Oe=E.convert(ut.format,ut.colorSpace);let Be=E.convert(ut.type),Le=v(ut.internalFormat,Oe,Be,ut.colorSpace,ut.isVideoTexture);Y(Dt,ut,Ge);let ie;const Ke=ut.mipmaps,ri=y&&ut.isVideoTexture!==!0&&Le!==u1,Ti=ne.__version===void 0||Ht===!0,le=Bt.dataReady,xi=m(ut,qt,Ge);if(ut.isDepthTexture)Le=g.DEPTH_COMPONENT,y?ut.type===Ea?Le=g.DEPTH_COMPONENT32F:ut.type===xl?Le=g.DEPTH_COMPONENT24:ut.type===uh?Le=g.DEPTH24_STENCIL8:Le=g.DEPTH_COMPONENT16:ut.type===Ea&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),ut.format===fh&&Le===g.DEPTH_COMPONENT&&ut.type!==ag&&ut.type!==xl&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),ut.type=xl,Be=E.convert(ut.type)),ut.format===Pu&&Le===g.DEPTH_COMPONENT&&(Le=g.DEPTH_STENCIL,ut.type!==uh&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),ut.type=uh,Be=E.convert(ut.type))),Ti&&(ri?i.texStorage2D(g.TEXTURE_2D,1,Le,qt.width,qt.height):i.texImage2D(g.TEXTURE_2D,0,Le,qt.width,qt.height,0,Oe,Be,null));else if(ut.isDataTexture)if(Ke.length>0&&Ge){ri&&Ti&&i.texStorage2D(g.TEXTURE_2D,xi,Le,Ke[0].width,Ke[0].height);for(let bt=0,Me=Ke.length;bt>=1,Me>>=1}}else if(Ke.length>0&&Ge){ri&&Ti&&i.texStorage2D(g.TEXTURE_2D,xi,Le,Ke[0].width,Ke[0].height);for(let bt=0,Me=Ke.length;bt0&&le++,i.texStorage2D(g.TEXTURE_CUBE_MAP,le,ie,qt[0].width,qt[0].height));for(let bt=0;bt<6;bt++)if(Ae){Ke?Ti&&i.texSubImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+bt,0,0,0,qt[bt].width,qt[bt].height,Be,Le,qt[bt].data):i.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+bt,0,ie,qt[bt].width,qt[bt].height,0,Be,Le,qt[bt].data);for(let Me=0;Me>Bt),qt=Math.max(1,ut.height>>Bt);Ht===g.TEXTURE_3D||Ht===g.TEXTURE_2D_ARRAY?i.texImage3D(Ht,Bt,ge,Ae,qt,ut.depth,0,ne,oe,null):i.texImage2D(Ht,Bt,ge,Ae,qt,0,ne,oe,null)}i.bindFramebuffer(g.FRAMEBUFFER,dt),At(ut)?e.framebufferTexture2DMultisampleEXT(g.FRAMEBUFFER,Dt,Ht,x.get(Rt).__webglTexture,0,Et(ut)):(Ht===g.TEXTURE_2D||Ht>=g.TEXTURE_CUBE_MAP_POSITIVE_X&&Ht<=g.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&g.framebufferTexture2D(g.FRAMEBUFFER,Dt,Ht,x.get(Rt).__webglTexture,Bt),i.bindFramebuffer(g.FRAMEBUFFER,null)}function _(dt,ut,Rt){if(g.bindRenderbuffer(g.RENDERBUFFER,dt),ut.depthBuffer&&!ut.stencilBuffer){let Dt=y===!0?g.DEPTH_COMPONENT24:g.DEPTH_COMPONENT16;if(Rt||At(ut)){const Ht=ut.depthTexture;Ht&&Ht.isDepthTexture&&(Ht.type===Ea?Dt=g.DEPTH_COMPONENT32F:Ht.type===xl&&(Dt=g.DEPTH_COMPONENT24));const Bt=Et(ut);At(ut)?e.renderbufferStorageMultisampleEXT(g.RENDERBUFFER,Bt,Dt,ut.width,ut.height):g.renderbufferStorageMultisample(g.RENDERBUFFER,Bt,Dt,ut.width,ut.height)}else g.renderbufferStorage(g.RENDERBUFFER,Dt,ut.width,ut.height);g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,dt)}else if(ut.depthBuffer&&ut.stencilBuffer){const Dt=Et(ut);Rt&&At(ut)===!1?g.renderbufferStorageMultisample(g.RENDERBUFFER,Dt,g.DEPTH24_STENCIL8,ut.width,ut.height):At(ut)?e.renderbufferStorageMultisampleEXT(g.RENDERBUFFER,Dt,g.DEPTH24_STENCIL8,ut.width,ut.height):g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_STENCIL,ut.width,ut.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,dt)}else{const Dt=ut.isWebGLMultipleRenderTargets===!0?ut.texture:[ut.texture];for(let Ht=0;Ht0){Rt.__webglFramebuffer[oe]=[];for(let ge=0;ge0){Rt.__webglFramebuffer=[];for(let oe=0;oe0&&At(dt)===!1){const oe=Bt?ut:[ut];Rt.__webglMultisampledFramebuffer=g.createFramebuffer(),Rt.__webglColorRenderbuffer=[],i.bindFramebuffer(g.FRAMEBUFFER,Rt.__webglMultisampledFramebuffer);for(let ge=0;ge0)for(let ge=0;ge0)for(let ge=0;ge0&&At(dt)===!1){const ut=dt.isWebGLMultipleRenderTargets?dt.texture:[dt.texture],Rt=dt.width,Dt=dt.height;let Ht=g.COLOR_BUFFER_BIT;const Bt=[],ne=dt.stencilBuffer?g.DEPTH_STENCIL_ATTACHMENT:g.DEPTH_ATTACHMENT,oe=x.get(dt),ge=dt.isWebGLMultipleRenderTargets===!0;if(ge)for(let xe=0;xe0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&ut.__useRenderToTexture!==!1}function Pt(dt){const ut=s.render.frame;p.get(dt)!==ut&&(p.set(dt,ut),dt.update())}function Vt(dt,ut){const Rt=dt.colorSpace,Dt=dt.format,Ht=dt.type;return dt.isCompressedTexture===!0||dt.isVideoTexture===!0||dt.format===Tm||Rt!==Go&&Rt!==ea&&(rn.getTransfer(Rt)===vn?y===!1?t.has("EXT_sRGB")===!0&&Dt===ps?(dt.format=Tm,dt.minFilter=Nn,dt.generateMipmaps=!1):ut=v1.sRGBToLinear(ut):(Dt!==ps||Ht!==Uo)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Rt)),ut}this.allocateTextureUnit=I,this.resetTextureUnits=O,this.setTexture2D=B,this.setTexture2DArray=G,this.setTexture3D=z,this.setTextureCube=X,this.rebindTextures=ot,this.setupRenderTarget=rt,this.updateRenderTargetMipmap=gt,this.updateMultisampleRenderTarget=yt,this.setupDepthRenderbuffer=at,this.setupFrameBufferTexture=J,this.useMultisampledRTT=At}function Cw(g,t,i){const x=i.isWebGL2;function T(E,s=ea){let y;const e=rn.getTransfer(s);if(E===Uo)return g.UNSIGNED_BYTE;if(E===s1)return g.UNSIGNED_SHORT_4_4_4_4;if(E===a1)return g.UNSIGNED_SHORT_5_5_5_1;if(E===X2)return g.BYTE;if(E===Y2)return g.SHORT;if(E===ag)return g.UNSIGNED_SHORT;if(E===r1)return g.INT;if(E===xl)return g.UNSIGNED_INT;if(E===Ea)return g.FLOAT;if(E===Zf)return x?g.HALF_FLOAT:(y=t.get("OES_texture_half_float"),y!==null?y.HALF_FLOAT_OES:null);if(E===k2)return g.ALPHA;if(E===ps)return g.RGBA;if(E===K2)return g.LUMINANCE;if(E===j2)return g.LUMINANCE_ALPHA;if(E===fh)return g.DEPTH_COMPONENT;if(E===Pu)return g.DEPTH_STENCIL;if(E===Tm)return y=t.get("EXT_sRGB"),y!==null?y.SRGB_ALPHA_EXT:null;if(E===Z2)return g.RED;if(E===o1)return g.RED_INTEGER;if(E===J2)return g.RG;if(E===l1)return g.RG_INTEGER;if(E===h1)return g.RGBA_INTEGER;if(E===em||E===im||E===nm||E===rm)if(e===vn)if(y=t.get("WEBGL_compressed_texture_s3tc_srgb"),y!==null){if(E===em)return y.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(E===im)return y.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(E===nm)return y.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(E===rm)return y.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(y=t.get("WEBGL_compressed_texture_s3tc"),y!==null){if(E===em)return y.COMPRESSED_RGB_S3TC_DXT1_EXT;if(E===im)return y.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(E===nm)return y.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(E===rm)return y.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(E===Hy||E===Wy||E===Xy||E===Yy)if(y=t.get("WEBGL_compressed_texture_pvrtc"),y!==null){if(E===Hy)return y.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(E===Wy)return y.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(E===Xy)return y.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(E===Yy)return y.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(E===u1)return y=t.get("WEBGL_compressed_texture_etc1"),y!==null?y.COMPRESSED_RGB_ETC1_WEBGL:null;if(E===ky||E===Ky)if(y=t.get("WEBGL_compressed_texture_etc"),y!==null){if(E===ky)return e===vn?y.COMPRESSED_SRGB8_ETC2:y.COMPRESSED_RGB8_ETC2;if(E===Ky)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:y.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(E===jy||E===Zy||E===Jy||E===$y||E===Qy||E===_y||E===qy||E===tx||E===ex||E===ix||E===nx||E===rx||E===sx||E===ax)if(y=t.get("WEBGL_compressed_texture_astc"),y!==null){if(E===jy)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:y.COMPRESSED_RGBA_ASTC_4x4_KHR;if(E===Zy)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:y.COMPRESSED_RGBA_ASTC_5x4_KHR;if(E===Jy)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:y.COMPRESSED_RGBA_ASTC_5x5_KHR;if(E===$y)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:y.COMPRESSED_RGBA_ASTC_6x5_KHR;if(E===Qy)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:y.COMPRESSED_RGBA_ASTC_6x6_KHR;if(E===_y)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:y.COMPRESSED_RGBA_ASTC_8x5_KHR;if(E===qy)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:y.COMPRESSED_RGBA_ASTC_8x6_KHR;if(E===tx)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:y.COMPRESSED_RGBA_ASTC_8x8_KHR;if(E===ex)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:y.COMPRESSED_RGBA_ASTC_10x5_KHR;if(E===ix)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:y.COMPRESSED_RGBA_ASTC_10x6_KHR;if(E===nx)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:y.COMPRESSED_RGBA_ASTC_10x8_KHR;if(E===rx)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:y.COMPRESSED_RGBA_ASTC_10x10_KHR;if(E===sx)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:y.COMPRESSED_RGBA_ASTC_12x10_KHR;if(E===ax)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:y.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(E===sm||E===ox||E===lx)if(y=t.get("EXT_texture_compression_bptc"),y!==null){if(E===sm)return e===vn?y.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:y.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(E===ox)return y.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(E===lx)return y.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(E===$2||E===hx||E===ux||E===fx)if(y=t.get("EXT_texture_compression_rgtc"),y!==null){if(E===sm)return y.COMPRESSED_RED_RGTC1_EXT;if(E===hx)return y.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(E===ux)return y.COMPRESSED_RED_GREEN_RGTC2_EXT;if(E===fx)return y.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return E===uh?x?g.UNSIGNED_INT_24_8:(y=t.get("WEBGL_depth_texture"),y!==null?y.UNSIGNED_INT_24_8_WEBGL:null):g[E]!==void 0?g[E]:null}return{convert:T}}class ww extends Or{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class Gf extends Yi{constructor(){super(),this.isGroup=!0,this.type="Group"}}const G6={type:"move"};class W0{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Gf,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Gf,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ct,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ct),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Gf,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ct,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ct),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const i=this._hand;if(i)for(const x of t.hand.values())this._getHandJoint(i,x)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,i,x){let T=null,E=null,s=null;const y=this._targetRay,e=this._grip,r=this._hand;if(t&&i.session.visibilityState!=="visible-blurred"){if(r&&t.hand){s=!0;for(const u of t.hand.values()){const f=i.getJointPose(u,x),o=this._getHandJoint(r,u);f!==null&&(o.matrix.fromArray(f.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,o.jointRadius=f.radius),o.visible=f!==null}const p=r.joints["index-finger-tip"],h=r.joints["thumb-tip"],a=p.position.distanceTo(h.position),l=.02,n=.005;r.inputState.pinching&&a>l+n?(r.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!r.inputState.pinching&&a<=l-n&&(r.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else e!==null&&t.gripSpace&&(E=i.getPose(t.gripSpace,x),E!==null&&(e.matrix.fromArray(E.transform.matrix),e.matrix.decompose(e.position,e.rotation,e.scale),e.matrixWorldNeedsUpdate=!0,E.linearVelocity?(e.hasLinearVelocity=!0,e.linearVelocity.copy(E.linearVelocity)):e.hasLinearVelocity=!1,E.angularVelocity?(e.hasAngularVelocity=!0,e.angularVelocity.copy(E.angularVelocity)):e.hasAngularVelocity=!1));y!==null&&(T=i.getPose(t.targetRaySpace,x),T===null&&E!==null&&(T=E),T!==null&&(y.matrix.fromArray(T.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.matrixWorldNeedsUpdate=!0,T.linearVelocity?(y.hasLinearVelocity=!0,y.linearVelocity.copy(T.linearVelocity)):y.hasLinearVelocity=!1,T.angularVelocity?(y.hasAngularVelocity=!0,y.angularVelocity.copy(T.angularVelocity)):y.hasAngularVelocity=!1,this.dispatchEvent(G6)))}return y!==null&&(y.visible=T!==null),e!==null&&(e.visible=E!==null),r!==null&&(r.visible=s!==null),this}_getHandJoint(t,i){if(t.joints[i.jointName]===void 0){const x=new Gf;x.matrixAutoUpdate=!1,x.visible=!1,t.joints[i.jointName]=x,t.add(x)}return t.joints[i.jointName]}}const V6=` +}`;function z6(g,t,i){let x=new qd;const T=new ve,E=new ve,s=new sn,y=new T1({depthPacking:iw}),e=new E1,r={},p=i.maxTextureSize,h={[Cl]:ms,[ms]:Cl,[Oo]:Oo},a=new no({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ve},radius:{value:4}},vertexShader:B6,fragmentShader:U6}),l=a.clone();l.defines.HORIZONTAL_PASS=1;const n=new Li;n.setAttribute("position",new an(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const u=new cr(n,a),f=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=sg;let o=this.type;this.render=function(S,M,w){if(f.enabled===!1||f.autoUpdate===!1&&f.needsUpdate===!1||S.length===0)return;const C=g.getRenderTarget(),A=g.getActiveCubeFace(),P=g.getActiveMipmapLevel(),b=g.state;b.setBlending(Ml),b.buffers.color.setClear(1,1,1,1),b.buffers.depth.setTest(!0),b.setScissorTest(!1);const O=o!==_a&&this.type===_a,I=o===_a&&this.type!==_a;for(let D=0,B=S.length;Dp||T.y>p)&&(T.x>p&&(E.x=Math.floor(p/X.x),T.x=E.x*X.x,z.mapSize.x=E.x),T.y>p&&(E.y=Math.floor(p/X.y),T.y=E.y*X.y,z.mapSize.y=E.y)),z.map===null||O===!0||I===!0){const Q=this.type!==_a?{minFilter:nr,magFilter:nr}:{};z.map!==null&&z.map.dispose(),z.map=new io(T.x,T.y,Q),z.map.texture.name=G.name+".shadowMap",z.camera.updateProjectionMatrix()}g.setRenderTarget(z.map),g.clear();const j=z.getViewportCount();for(let Q=0;Q0||M.map&&M.alphaTest>0){const b=A.uuid,O=M.uuid;let I=r[b];I===void 0&&(I={},r[b]=I);let D=I[O];D===void 0&&(D=A.clone(),I[O]=D,M.addEventListener("dispose",m)),A=D}if(A.visible=M.visible,A.wireframe=M.wireframe,C===_a?A.side=M.shadowSide!==null?M.shadowSide:M.side:A.side=M.shadowSide!==null?M.shadowSide:h[M.side],A.alphaMap=M.alphaMap,A.alphaTest=M.alphaTest,A.map=M.map,A.clipShadows=M.clipShadows,A.clippingPlanes=M.clippingPlanes,A.clipIntersection=M.clipIntersection,A.displacementMap=M.displacementMap,A.displacementScale=M.displacementScale,A.displacementBias=M.displacementBias,A.wireframeLinewidth=M.wireframeLinewidth,A.linewidth=M.linewidth,w.isPointLight===!0&&A.isMeshDistanceMaterial===!0){const b=g.properties.get(A);b.light=w}return A}function v(S,M,w,C,A){if(S.visible===!1)return;if(S.layers.test(M.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&A===_a)&&(!S.frustumCulled||x.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,S.matrixWorld);const O=t.update(S),I=S.material;if(Array.isArray(I)){const D=O.groups;for(let B=0,G=D.length;B=1):j.indexOf("OpenGL ES")!==-1&&(X=parseFloat(/^OpenGL ES (\d)/.exec(j)[1]),z=X>=2);let Q=null,tt={};const Y=g.getParameter(g.SCISSOR_BOX),Z=g.getParameter(g.VIEWPORT),U=new sn().fromArray(Y),H=new sn().fromArray(Z);function J(bt,Me,Ce,Ve){const Je=new Uint8Array(4),zi=g.createTexture();g.bindTexture(bt,zi),g.texParameteri(bt,g.TEXTURE_MIN_FILTER,g.NEAREST),g.texParameteri(bt,g.TEXTURE_MAG_FILTER,g.NEAREST);for(let Di=0;Di"u"?!1:/OculusBrowser/g.test(navigator.userAgent),p=new WeakMap;let h;const a=new WeakMap;let l=!1;try{l=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function n(dt,ut){return l?new OffscreenCanvas(dt,ut):Id("canvas")}function u(dt,ut,Rt,Dt){let Ht=1;if((dt.width>Dt||dt.height>Dt)&&(Ht=Dt/Math.max(dt.width,dt.height)),Ht<1||ut===!0)if(typeof HTMLImageElement<"u"&&dt instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&dt instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&dt instanceof ImageBitmap){const Bt=ut?Em:Math.floor,re=Bt(Ht*dt.width),le=Bt(Ht*dt.height);h===void 0&&(h=n(re,le));const ge=Rt?n(re,le):h;return ge.width=re,ge.height=le,ge.getContext("2d").drawImage(dt,0,0,re,le),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+dt.width+"x"+dt.height+") to ("+re+"x"+le+")."),ge}else return"data"in dt&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+dt.width+"x"+dt.height+")."),dt;return dt}function f(dt){return vx(dt.width)&&vx(dt.height)}function o(dt){return y?!1:dt.wrapS!==Jr||dt.wrapT!==Jr||dt.minFilter!==nr&&dt.minFilter!==Nn}function c(dt,ut){return dt.generateMipmaps&&ut&&dt.minFilter!==nr&&dt.minFilter!==Nn}function d(dt){g.generateMipmap(dt)}function v(dt,ut,Rt,Dt,Ht=!1){if(y===!1)return ut;if(dt!==null){if(g[dt]!==void 0)return g[dt];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+dt+"'")}let Bt=ut;if(ut===g.RED&&(Rt===g.FLOAT&&(Bt=g.R32F),Rt===g.HALF_FLOAT&&(Bt=g.R16F),Rt===g.UNSIGNED_BYTE&&(Bt=g.R8)),ut===g.RED_INTEGER&&(Rt===g.UNSIGNED_BYTE&&(Bt=g.R8UI),Rt===g.UNSIGNED_SHORT&&(Bt=g.R16UI),Rt===g.UNSIGNED_INT&&(Bt=g.R32UI),Rt===g.BYTE&&(Bt=g.R8I),Rt===g.SHORT&&(Bt=g.R16I),Rt===g.INT&&(Bt=g.R32I)),ut===g.RG&&(Rt===g.FLOAT&&(Bt=g.RG32F),Rt===g.HALF_FLOAT&&(Bt=g.RG16F),Rt===g.UNSIGNED_BYTE&&(Bt=g.RG8)),ut===g.RGBA){const re=Ht?bd:rn.getTransfer(Dt);Rt===g.FLOAT&&(Bt=g.RGBA32F),Rt===g.HALF_FLOAT&&(Bt=g.RGBA16F),Rt===g.UNSIGNED_BYTE&&(Bt=re===vn?g.SRGB8_ALPHA8:g.RGBA8),Rt===g.UNSIGNED_SHORT_4_4_4_4&&(Bt=g.RGBA4),Rt===g.UNSIGNED_SHORT_5_5_5_1&&(Bt=g.RGB5_A1)}return(Bt===g.R16F||Bt===g.R32F||Bt===g.RG16F||Bt===g.RG32F||Bt===g.RGBA16F||Bt===g.RGBA32F)&&t.get("EXT_color_buffer_float"),Bt}function m(dt,ut,Rt){return c(dt,Rt)===!0||dt.isFramebufferTexture&&dt.minFilter!==nr&&dt.minFilter!==Nn?Math.log2(Math.max(ut.width,ut.height))+1:dt.mipmaps!==void 0&&dt.mipmaps.length>0?dt.mipmaps.length:dt.isCompressedTexture&&Array.isArray(dt.image)?ut.mipmaps.length:1}function S(dt){return dt===nr||dt===Sm||dt===uu?g.NEAREST:g.LINEAR}function M(dt){const ut=dt.target;ut.removeEventListener("dispose",M),C(ut),ut.isVideoTexture&&p.delete(ut)}function w(dt){const ut=dt.target;ut.removeEventListener("dispose",w),P(ut)}function C(dt){const ut=x.get(dt);if(ut.__webglInit===void 0)return;const Rt=dt.source,Dt=a.get(Rt);if(Dt){const Ht=Dt[ut.__cacheKey];Ht.usedTimes--,Ht.usedTimes===0&&A(dt),Object.keys(Dt).length===0&&a.delete(Rt)}x.remove(dt)}function A(dt){const ut=x.get(dt);g.deleteTexture(ut.__webglTexture);const Rt=dt.source,Dt=a.get(Rt);delete Dt[ut.__cacheKey],s.memory.textures--}function P(dt){const ut=dt.texture,Rt=x.get(dt),Dt=x.get(ut);if(Dt.__webglTexture!==void 0&&(g.deleteTexture(Dt.__webglTexture),s.memory.textures--),dt.depthTexture&&dt.depthTexture.dispose(),dt.isWebGLCubeRenderTarget)for(let Ht=0;Ht<6;Ht++){if(Array.isArray(Rt.__webglFramebuffer[Ht]))for(let Bt=0;Bt=T.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+dt+" texture units while this GPU supports only "+T.maxTextures),b+=1,dt}function D(dt){const ut=[];return ut.push(dt.wrapS),ut.push(dt.wrapT),ut.push(dt.wrapR||0),ut.push(dt.magFilter),ut.push(dt.minFilter),ut.push(dt.anisotropy),ut.push(dt.internalFormat),ut.push(dt.format),ut.push(dt.type),ut.push(dt.generateMipmaps),ut.push(dt.premultiplyAlpha),ut.push(dt.flipY),ut.push(dt.unpackAlignment),ut.push(dt.colorSpace),ut.join()}function B(dt,ut){const Rt=x.get(dt);if(dt.isVideoTexture&&Pt(dt),dt.isRenderTargetTexture===!1&&dt.version>0&&Rt.__version!==dt.version){const Dt=dt.image;if(Dt===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Dt.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{U(Rt,dt,ut);return}}i.bindTexture(g.TEXTURE_2D,Rt.__webglTexture,g.TEXTURE0+ut)}function G(dt,ut){const Rt=x.get(dt);if(dt.version>0&&Rt.__version!==dt.version){U(Rt,dt,ut);return}i.bindTexture(g.TEXTURE_2D_ARRAY,Rt.__webglTexture,g.TEXTURE0+ut)}function z(dt,ut){const Rt=x.get(dt);if(dt.version>0&&Rt.__version!==dt.version){U(Rt,dt,ut);return}i.bindTexture(g.TEXTURE_3D,Rt.__webglTexture,g.TEXTURE0+ut)}function X(dt,ut){const Rt=x.get(dt);if(dt.version>0&&Rt.__version!==dt.version){H(Rt,dt,ut);return}i.bindTexture(g.TEXTURE_CUBE_MAP,Rt.__webglTexture,g.TEXTURE0+ut)}const j={[Cd]:g.REPEAT,[Jr]:g.CLAMP_TO_EDGE,[wd]:g.MIRRORED_REPEAT},Q={[nr]:g.NEAREST,[Sm]:g.NEAREST_MIPMAP_NEAREST,[uu]:g.NEAREST_MIPMAP_LINEAR,[Nn]:g.LINEAR,[ud]:g.LINEAR_MIPMAP_NEAREST,[Io]:g.LINEAR_MIPMAP_LINEAR},tt={[rw]:g.NEVER,[uw]:g.ALWAYS,[sw]:g.LESS,[d1]:g.LEQUAL,[aw]:g.EQUAL,[hw]:g.GEQUAL,[ow]:g.GREATER,[lw]:g.NOTEQUAL};function Y(dt,ut,Rt){if(ut.type===Ea&&t.has("OES_texture_float_linear")===!1&&(ut.magFilter===Nn||ut.magFilter===ud||ut.magFilter===uu||ut.magFilter===Io||ut.minFilter===Nn||ut.minFilter===ud||ut.minFilter===uu||ut.minFilter===Io)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),Rt?(g.texParameteri(dt,g.TEXTURE_WRAP_S,j[ut.wrapS]),g.texParameteri(dt,g.TEXTURE_WRAP_T,j[ut.wrapT]),(dt===g.TEXTURE_3D||dt===g.TEXTURE_2D_ARRAY)&&g.texParameteri(dt,g.TEXTURE_WRAP_R,j[ut.wrapR]),g.texParameteri(dt,g.TEXTURE_MAG_FILTER,Q[ut.magFilter]),g.texParameteri(dt,g.TEXTURE_MIN_FILTER,Q[ut.minFilter])):(g.texParameteri(dt,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(dt,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),(dt===g.TEXTURE_3D||dt===g.TEXTURE_2D_ARRAY)&&g.texParameteri(dt,g.TEXTURE_WRAP_R,g.CLAMP_TO_EDGE),(ut.wrapS!==Jr||ut.wrapT!==Jr)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),g.texParameteri(dt,g.TEXTURE_MAG_FILTER,S(ut.magFilter)),g.texParameteri(dt,g.TEXTURE_MIN_FILTER,S(ut.minFilter)),ut.minFilter!==nr&&ut.minFilter!==Nn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),ut.compareFunction&&(g.texParameteri(dt,g.TEXTURE_COMPARE_MODE,g.COMPARE_REF_TO_TEXTURE),g.texParameteri(dt,g.TEXTURE_COMPARE_FUNC,tt[ut.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){const Dt=t.get("EXT_texture_filter_anisotropic");if(ut.magFilter===nr||ut.minFilter!==uu&&ut.minFilter!==Io||ut.type===Ea&&t.has("OES_texture_float_linear")===!1||y===!1&&ut.type===Zf&&t.has("OES_texture_half_float_linear")===!1)return;(ut.anisotropy>1||x.get(ut).__currentAnisotropy)&&(g.texParameterf(dt,Dt.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(ut.anisotropy,T.getMaxAnisotropy())),x.get(ut).__currentAnisotropy=ut.anisotropy)}}function Z(dt,ut){let Rt=!1;dt.__webglInit===void 0&&(dt.__webglInit=!0,ut.addEventListener("dispose",M));const Dt=ut.source;let Ht=a.get(Dt);Ht===void 0&&(Ht={},a.set(Dt,Ht));const Bt=D(ut);if(Bt!==dt.__cacheKey){Ht[Bt]===void 0&&(Ht[Bt]={texture:g.createTexture(),usedTimes:0},s.memory.textures++,Rt=!0),Ht[Bt].usedTimes++;const re=Ht[dt.__cacheKey];re!==void 0&&(Ht[dt.__cacheKey].usedTimes--,re.usedTimes===0&&A(ut)),dt.__cacheKey=Bt,dt.__webglTexture=Ht[Bt].texture}return Rt}function U(dt,ut,Rt){let Dt=g.TEXTURE_2D;(ut.isDataArrayTexture||ut.isCompressedArrayTexture)&&(Dt=g.TEXTURE_2D_ARRAY),ut.isData3DTexture&&(Dt=g.TEXTURE_3D);const Ht=Z(dt,ut),Bt=ut.source;i.bindTexture(Dt,dt.__webglTexture,g.TEXTURE0+Rt);const re=x.get(Bt);if(Bt.version!==re.__version||Ht===!0){i.activeTexture(g.TEXTURE0+Rt);const le=rn.getPrimaries(rn.workingColorSpace),ge=ut.colorSpace===ea?null:rn.getPrimaries(ut.colorSpace),xe=ut.colorSpace===ea||le===ge?g.NONE:g.BROWSER_DEFAULT_WEBGL;g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,ut.flipY),g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ut.premultiplyAlpha),g.pixelStorei(g.UNPACK_ALIGNMENT,ut.unpackAlignment),g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,xe);const Pe=o(ut)&&f(ut.image)===!1;let te=u(ut.image,Pe,!1,T.maxTextureSize);te=Vt(ut,te);const Ge=f(te)||y,Oe=E.convert(ut.format,ut.colorSpace);let Be=E.convert(ut.type),Le=v(ut.internalFormat,Oe,Be,ut.colorSpace,ut.isVideoTexture);Y(Dt,ut,Ge);let ne;const je=ut.mipmaps,ri=y&&ut.isVideoTexture!==!0&&Le!==u1,Ei=re.__version===void 0||Ht===!0,he=Bt.dataReady,Si=m(ut,te,Ge);if(ut.isDepthTexture)Le=g.DEPTH_COMPONENT,y?ut.type===Ea?Le=g.DEPTH_COMPONENT32F:ut.type===Sl?Le=g.DEPTH_COMPONENT24:ut.type===uh?Le=g.DEPTH24_STENCIL8:Le=g.DEPTH_COMPONENT16:ut.type===Ea&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),ut.format===fh&&Le===g.DEPTH_COMPONENT&&ut.type!==og&&ut.type!==Sl&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),ut.type=Sl,Be=E.convert(ut.type)),ut.format===Au&&Le===g.DEPTH_COMPONENT&&(Le=g.DEPTH_STENCIL,ut.type!==uh&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),ut.type=uh,Be=E.convert(ut.type))),Ei&&(ri?i.texStorage2D(g.TEXTURE_2D,1,Le,te.width,te.height):i.texImage2D(g.TEXTURE_2D,0,Le,te.width,te.height,0,Oe,Be,null));else if(ut.isDataTexture)if(je.length>0&&Ge){ri&&Ei&&i.texStorage2D(g.TEXTURE_2D,Si,Le,je[0].width,je[0].height);for(let bt=0,Me=je.length;bt>=1,Me>>=1}}else if(je.length>0&&Ge){ri&&Ei&&i.texStorage2D(g.TEXTURE_2D,Si,Le,je[0].width,je[0].height);for(let bt=0,Me=je.length;bt0&&he++,i.texStorage2D(g.TEXTURE_CUBE_MAP,he,ne,te[0].width,te[0].height));for(let bt=0;bt<6;bt++)if(Pe){je?Ei&&i.texSubImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+bt,0,0,0,te[bt].width,te[bt].height,Be,Le,te[bt].data):i.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+bt,0,ne,te[bt].width,te[bt].height,0,Be,Le,te[bt].data);for(let Me=0;Me>Bt),te=Math.max(1,ut.height>>Bt);Ht===g.TEXTURE_3D||Ht===g.TEXTURE_2D_ARRAY?i.texImage3D(Ht,Bt,ge,Pe,te,ut.depth,0,re,le,null):i.texImage2D(Ht,Bt,ge,Pe,te,0,re,le,null)}i.bindFramebuffer(g.FRAMEBUFFER,dt),At(ut)?e.framebufferTexture2DMultisampleEXT(g.FRAMEBUFFER,Dt,Ht,x.get(Rt).__webglTexture,0,Et(ut)):(Ht===g.TEXTURE_2D||Ht>=g.TEXTURE_CUBE_MAP_POSITIVE_X&&Ht<=g.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&g.framebufferTexture2D(g.FRAMEBUFFER,Dt,Ht,x.get(Rt).__webglTexture,Bt),i.bindFramebuffer(g.FRAMEBUFFER,null)}function _(dt,ut,Rt){if(g.bindRenderbuffer(g.RENDERBUFFER,dt),ut.depthBuffer&&!ut.stencilBuffer){let Dt=y===!0?g.DEPTH_COMPONENT24:g.DEPTH_COMPONENT16;if(Rt||At(ut)){const Ht=ut.depthTexture;Ht&&Ht.isDepthTexture&&(Ht.type===Ea?Dt=g.DEPTH_COMPONENT32F:Ht.type===Sl&&(Dt=g.DEPTH_COMPONENT24));const Bt=Et(ut);At(ut)?e.renderbufferStorageMultisampleEXT(g.RENDERBUFFER,Bt,Dt,ut.width,ut.height):g.renderbufferStorageMultisample(g.RENDERBUFFER,Bt,Dt,ut.width,ut.height)}else g.renderbufferStorage(g.RENDERBUFFER,Dt,ut.width,ut.height);g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,dt)}else if(ut.depthBuffer&&ut.stencilBuffer){const Dt=Et(ut);Rt&&At(ut)===!1?g.renderbufferStorageMultisample(g.RENDERBUFFER,Dt,g.DEPTH24_STENCIL8,ut.width,ut.height):At(ut)?e.renderbufferStorageMultisampleEXT(g.RENDERBUFFER,Dt,g.DEPTH24_STENCIL8,ut.width,ut.height):g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_STENCIL,ut.width,ut.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,dt)}else{const Dt=ut.isWebGLMultipleRenderTargets===!0?ut.texture:[ut.texture];for(let Ht=0;Ht0){Rt.__webglFramebuffer[le]=[];for(let ge=0;ge0){Rt.__webglFramebuffer=[];for(let le=0;le0&&At(dt)===!1){const le=Bt?ut:[ut];Rt.__webglMultisampledFramebuffer=g.createFramebuffer(),Rt.__webglColorRenderbuffer=[],i.bindFramebuffer(g.FRAMEBUFFER,Rt.__webglMultisampledFramebuffer);for(let ge=0;ge0)for(let ge=0;ge0)for(let ge=0;ge0&&At(dt)===!1){const ut=dt.isWebGLMultipleRenderTargets?dt.texture:[dt.texture],Rt=dt.width,Dt=dt.height;let Ht=g.COLOR_BUFFER_BIT;const Bt=[],re=dt.stencilBuffer?g.DEPTH_STENCIL_ATTACHMENT:g.DEPTH_ATTACHMENT,le=x.get(dt),ge=dt.isWebGLMultipleRenderTargets===!0;if(ge)for(let xe=0;xe0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&ut.__useRenderToTexture!==!1}function Pt(dt){const ut=s.render.frame;p.get(dt)!==ut&&(p.set(dt,ut),dt.update())}function Vt(dt,ut){const Rt=dt.colorSpace,Dt=dt.format,Ht=dt.type;return dt.isCompressedTexture===!0||dt.isVideoTexture===!0||dt.format===Tm||Rt!==Vo&&Rt!==ea&&(rn.getTransfer(Rt)===vn?y===!1?t.has("EXT_sRGB")===!0&&Dt===ps?(dt.format=Tm,dt.minFilter=Nn,dt.generateMipmaps=!1):ut=v1.sRGBToLinear(ut):(Dt!==ps||Ht!==zo)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Rt)),ut}this.allocateTextureUnit=I,this.resetTextureUnits=O,this.setTexture2D=B,this.setTexture2DArray=G,this.setTexture3D=z,this.setTextureCube=X,this.rebindTextures=ot,this.setupRenderTarget=rt,this.updateRenderTargetMipmap=gt,this.updateMultisampleRenderTarget=yt,this.setupDepthRenderbuffer=at,this.setupFrameBufferTexture=J,this.useMultisampledRTT=At}function ww(g,t,i){const x=i.isWebGL2;function T(E,s=ea){let y;const e=rn.getTransfer(s);if(E===zo)return g.UNSIGNED_BYTE;if(E===s1)return g.UNSIGNED_SHORT_4_4_4_4;if(E===a1)return g.UNSIGNED_SHORT_5_5_5_1;if(E===Y2)return g.BYTE;if(E===k2)return g.SHORT;if(E===og)return g.UNSIGNED_SHORT;if(E===r1)return g.INT;if(E===Sl)return g.UNSIGNED_INT;if(E===Ea)return g.FLOAT;if(E===Zf)return x?g.HALF_FLOAT:(y=t.get("OES_texture_half_float"),y!==null?y.HALF_FLOAT_OES:null);if(E===j2)return g.ALPHA;if(E===ps)return g.RGBA;if(E===K2)return g.LUMINANCE;if(E===Z2)return g.LUMINANCE_ALPHA;if(E===fh)return g.DEPTH_COMPONENT;if(E===Au)return g.DEPTH_STENCIL;if(E===Tm)return y=t.get("EXT_sRGB"),y!==null?y.SRGB_ALPHA_EXT:null;if(E===J2)return g.RED;if(E===o1)return g.RED_INTEGER;if(E===$2)return g.RG;if(E===l1)return g.RG_INTEGER;if(E===h1)return g.RGBA_INTEGER;if(E===im||E===nm||E===rm||E===sm)if(e===vn)if(y=t.get("WEBGL_compressed_texture_s3tc_srgb"),y!==null){if(E===im)return y.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(E===nm)return y.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(E===rm)return y.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(E===sm)return y.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(y=t.get("WEBGL_compressed_texture_s3tc"),y!==null){if(E===im)return y.COMPRESSED_RGB_S3TC_DXT1_EXT;if(E===nm)return y.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(E===rm)return y.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(E===sm)return y.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(E===Wy||E===Xy||E===Yy||E===ky)if(y=t.get("WEBGL_compressed_texture_pvrtc"),y!==null){if(E===Wy)return y.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(E===Xy)return y.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(E===Yy)return y.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(E===ky)return y.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(E===u1)return y=t.get("WEBGL_compressed_texture_etc1"),y!==null?y.COMPRESSED_RGB_ETC1_WEBGL:null;if(E===jy||E===Ky)if(y=t.get("WEBGL_compressed_texture_etc"),y!==null){if(E===jy)return e===vn?y.COMPRESSED_SRGB8_ETC2:y.COMPRESSED_RGB8_ETC2;if(E===Ky)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:y.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(E===Zy||E===Jy||E===$y||E===Qy||E===_y||E===qy||E===tx||E===ex||E===ix||E===nx||E===rx||E===sx||E===ax||E===ox)if(y=t.get("WEBGL_compressed_texture_astc"),y!==null){if(E===Zy)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:y.COMPRESSED_RGBA_ASTC_4x4_KHR;if(E===Jy)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:y.COMPRESSED_RGBA_ASTC_5x4_KHR;if(E===$y)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:y.COMPRESSED_RGBA_ASTC_5x5_KHR;if(E===Qy)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:y.COMPRESSED_RGBA_ASTC_6x5_KHR;if(E===_y)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:y.COMPRESSED_RGBA_ASTC_6x6_KHR;if(E===qy)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:y.COMPRESSED_RGBA_ASTC_8x5_KHR;if(E===tx)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:y.COMPRESSED_RGBA_ASTC_8x6_KHR;if(E===ex)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:y.COMPRESSED_RGBA_ASTC_8x8_KHR;if(E===ix)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:y.COMPRESSED_RGBA_ASTC_10x5_KHR;if(E===nx)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:y.COMPRESSED_RGBA_ASTC_10x6_KHR;if(E===rx)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:y.COMPRESSED_RGBA_ASTC_10x8_KHR;if(E===sx)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:y.COMPRESSED_RGBA_ASTC_10x10_KHR;if(E===ax)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:y.COMPRESSED_RGBA_ASTC_12x10_KHR;if(E===ox)return e===vn?y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:y.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(E===am||E===lx||E===hx)if(y=t.get("EXT_texture_compression_bptc"),y!==null){if(E===am)return e===vn?y.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:y.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(E===lx)return y.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(E===hx)return y.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(E===Q2||E===ux||E===fx||E===cx)if(y=t.get("EXT_texture_compression_rgtc"),y!==null){if(E===am)return y.COMPRESSED_RED_RGTC1_EXT;if(E===ux)return y.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(E===fx)return y.COMPRESSED_RED_GREEN_RGTC2_EXT;if(E===cx)return y.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return E===uh?x?g.UNSIGNED_INT_24_8:(y=t.get("WEBGL_depth_texture"),y!==null?y.UNSIGNED_INT_24_8_WEBGL:null):g[E]!==void 0?g[E]:null}return{convert:T}}class Aw extends Or{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class Gf extends Yi{constructor(){super(),this.isGroup=!0,this.type="Group"}}const H6={type:"move"};class X0{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Gf,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Gf,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ct,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ct),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Gf,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ct,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ct),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const i=this._hand;if(i)for(const x of t.hand.values())this._getHandJoint(i,x)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,i,x){let T=null,E=null,s=null;const y=this._targetRay,e=this._grip,r=this._hand;if(t&&i.session.visibilityState!=="visible-blurred"){if(r&&t.hand){s=!0;for(const u of t.hand.values()){const f=i.getJointPose(u,x),o=this._getHandJoint(r,u);f!==null&&(o.matrix.fromArray(f.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,o.jointRadius=f.radius),o.visible=f!==null}const p=r.joints["index-finger-tip"],h=r.joints["thumb-tip"],a=p.position.distanceTo(h.position),l=.02,n=.005;r.inputState.pinching&&a>l+n?(r.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!r.inputState.pinching&&a<=l-n&&(r.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else e!==null&&t.gripSpace&&(E=i.getPose(t.gripSpace,x),E!==null&&(e.matrix.fromArray(E.transform.matrix),e.matrix.decompose(e.position,e.rotation,e.scale),e.matrixWorldNeedsUpdate=!0,E.linearVelocity?(e.hasLinearVelocity=!0,e.linearVelocity.copy(E.linearVelocity)):e.hasLinearVelocity=!1,E.angularVelocity?(e.hasAngularVelocity=!0,e.angularVelocity.copy(E.angularVelocity)):e.hasAngularVelocity=!1));y!==null&&(T=i.getPose(t.targetRaySpace,x),T===null&&E!==null&&(T=E),T!==null&&(y.matrix.fromArray(T.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.matrixWorldNeedsUpdate=!0,T.linearVelocity?(y.hasLinearVelocity=!0,y.linearVelocity.copy(T.linearVelocity)):y.hasLinearVelocity=!1,T.angularVelocity?(y.hasAngularVelocity=!0,y.angularVelocity.copy(T.angularVelocity)):y.hasAngularVelocity=!1,this.dispatchEvent(H6)))}return y!==null&&(y.visible=T!==null),e!==null&&(e.visible=E!==null),r!==null&&(r.visible=s!==null),this}_getHandJoint(t,i){if(t.joints[i.jointName]===void 0){const x=new Gf;x.matrixAutoUpdate=!1,x.visible=!1,t.joints[i.jointName]=x,t.add(x)}return t.joints[i.jointName]}}const W6=` void main() { gl_Position = vec4( position, 1.0 ); -}`,H6=` +}`,X6=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; @@ -10164,7 +10164,7 @@ void main() { } -}`;class W6{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,i,x){if(this.texture===null){const T=new Un,E=t.properties.get(T);E.__webglTexture=i.texture,(i.depthNear!=x.depthNear||i.depthFar!=x.depthFar)&&(this.depthNear=i.depthNear,this.depthFar=i.depthFar),this.texture=T}}render(t,i){if(this.texture!==null){if(this.mesh===null){const x=i.cameras[0].viewport,T=new no({extensions:{fragDepth:!0},vertexShader:V6,fragmentShader:H6,uniforms:{depthColor:{value:this.texture},depthWidth:{value:x.z},depthHeight:{value:x.w}}});this.mesh=new cr(new nc(20,20),T)}t.render(this.mesh,i)}}reset(){this.texture=null,this.mesh=null}}class X6 extends Pl{constructor(t,i){super();const x=this;let T=null,E=1,s=null,y="local-floor",e=1,r=null,p=null,h=null,a=null,l=null,n=null;const u=new W6,f=i.getContextAttributes();let o=null,c=null;const d=[],v=[],m=new ve;let S=null;const M=new Or;M.layers.enable(1),M.viewport=new sn;const w=new Or;w.layers.enable(2),w.viewport=new sn;const C=[M,w],A=new ww;A.layers.enable(1),A.layers.enable(2);let P=null,b=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let U=d[Z];return U===void 0&&(U=new W0,d[Z]=U),U.getTargetRaySpace()},this.getControllerGrip=function(Z){let U=d[Z];return U===void 0&&(U=new W0,d[Z]=U),U.getGripSpace()},this.getHand=function(Z){let U=d[Z];return U===void 0&&(U=new W0,d[Z]=U),U.getHandSpace()};function O(Z){const U=v.indexOf(Z.inputSource);if(U===-1)return;const H=d[U];H!==void 0&&(H.update(Z.inputSource,Z.frame,r||s),H.dispatchEvent({type:Z.type,data:Z.inputSource}))}function I(){T.removeEventListener("select",O),T.removeEventListener("selectstart",O),T.removeEventListener("selectend",O),T.removeEventListener("squeeze",O),T.removeEventListener("squeezestart",O),T.removeEventListener("squeezeend",O),T.removeEventListener("end",I),T.removeEventListener("inputsourceschange",D);for(let Z=0;Z=0&&(v[J]=null,d[J].disconnect(H))}for(let U=0;U=v.length){v.push(H),J=q;break}else if(v[q]===null){v[q]=H,J=q;break}if(J===-1)break}const _=d[J];_&&_.connect(H)}}const B=new Ct,G=new Ct;function z(Z,U,H){B.setFromMatrixPosition(U.matrixWorld),G.setFromMatrixPosition(H.matrixWorld);const J=B.distanceTo(G),_=U.projectionMatrix.elements,q=H.projectionMatrix.elements,at=_[14]/(_[10]-1),ot=_[14]/(_[10]+1),rt=(_[9]+1)/_[5],gt=(_[9]-1)/_[5],yt=(_[8]-1)/_[0],Et=(q[8]+1)/q[0],At=at*yt,Pt=at*Et,Vt=J/(-yt+Et),dt=Vt*-yt;U.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(dt),Z.translateZ(Vt),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert();const ut=at+Vt,Rt=ot+Vt,Dt=At-dt,Ht=Pt+(J-dt),Bt=rt*ot/Rt*ut,ne=gt*ot/Rt*ut;Z.projectionMatrix.makePerspective(Dt,Ht,Bt,ne,ut,Rt),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}function X(Z,U){U===null?Z.matrixWorld.copy(Z.matrix):Z.matrixWorld.multiplyMatrices(U.matrixWorld,Z.matrix),Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(T===null)return;u.texture!==null&&(Z.near=u.depthNear,Z.far=u.depthFar),A.near=w.near=M.near=Z.near,A.far=w.far=M.far=Z.far,(P!==A.near||b!==A.far)&&(T.updateRenderState({depthNear:A.near,depthFar:A.far}),P=A.near,b=A.far,M.near=P,M.far=b,w.near=P,w.far=b,M.updateProjectionMatrix(),w.updateProjectionMatrix(),Z.updateProjectionMatrix());const U=Z.parent,H=A.cameras;X(A,U);for(let J=0;J0&&(f.alphaTest.value=o.alphaTest);const c=t.get(o).envMap;if(c&&(f.envMap.value=c,f.flipEnvMap.value=c.isCubeTexture&&c.isRenderTargetTexture===!1?-1:1,f.reflectivity.value=o.reflectivity,f.ior.value=o.ior,f.refractionRatio.value=o.refractionRatio),o.lightMap){f.lightMap.value=o.lightMap;const d=g._useLegacyLights===!0?Math.PI:1;f.lightMapIntensity.value=o.lightMapIntensity*d,i(o.lightMap,f.lightMapTransform)}o.aoMap&&(f.aoMap.value=o.aoMap,f.aoMapIntensity.value=o.aoMapIntensity,i(o.aoMap,f.aoMapTransform))}function s(f,o){f.diffuse.value.copy(o.color),f.opacity.value=o.opacity,o.map&&(f.map.value=o.map,i(o.map,f.mapTransform))}function y(f,o){f.dashSize.value=o.dashSize,f.totalSize.value=o.dashSize+o.gapSize,f.scale.value=o.scale}function e(f,o,c,d){f.diffuse.value.copy(o.color),f.opacity.value=o.opacity,f.size.value=o.size*c,f.scale.value=d*.5,o.map&&(f.map.value=o.map,i(o.map,f.uvTransform)),o.alphaMap&&(f.alphaMap.value=o.alphaMap,i(o.alphaMap,f.alphaMapTransform)),o.alphaTest>0&&(f.alphaTest.value=o.alphaTest)}function r(f,o){f.diffuse.value.copy(o.color),f.opacity.value=o.opacity,f.rotation.value=o.rotation,o.map&&(f.map.value=o.map,i(o.map,f.mapTransform)),o.alphaMap&&(f.alphaMap.value=o.alphaMap,i(o.alphaMap,f.alphaMapTransform)),o.alphaTest>0&&(f.alphaTest.value=o.alphaTest)}function p(f,o){f.specular.value.copy(o.specular),f.shininess.value=Math.max(o.shininess,1e-4)}function h(f,o){o.gradientMap&&(f.gradientMap.value=o.gradientMap)}function a(f,o){f.metalness.value=o.metalness,o.metalnessMap&&(f.metalnessMap.value=o.metalnessMap,i(o.metalnessMap,f.metalnessMapTransform)),f.roughness.value=o.roughness,o.roughnessMap&&(f.roughnessMap.value=o.roughnessMap,i(o.roughnessMap,f.roughnessMapTransform)),t.get(o).envMap&&(f.envMapIntensity.value=o.envMapIntensity)}function l(f,o,c){f.ior.value=o.ior,o.sheen>0&&(f.sheenColor.value.copy(o.sheenColor).multiplyScalar(o.sheen),f.sheenRoughness.value=o.sheenRoughness,o.sheenColorMap&&(f.sheenColorMap.value=o.sheenColorMap,i(o.sheenColorMap,f.sheenColorMapTransform)),o.sheenRoughnessMap&&(f.sheenRoughnessMap.value=o.sheenRoughnessMap,i(o.sheenRoughnessMap,f.sheenRoughnessMapTransform))),o.clearcoat>0&&(f.clearcoat.value=o.clearcoat,f.clearcoatRoughness.value=o.clearcoatRoughness,o.clearcoatMap&&(f.clearcoatMap.value=o.clearcoatMap,i(o.clearcoatMap,f.clearcoatMapTransform)),o.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=o.clearcoatRoughnessMap,i(o.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),o.clearcoatNormalMap&&(f.clearcoatNormalMap.value=o.clearcoatNormalMap,i(o.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(o.clearcoatNormalScale),o.side===ms&&f.clearcoatNormalScale.value.negate())),o.iridescence>0&&(f.iridescence.value=o.iridescence,f.iridescenceIOR.value=o.iridescenceIOR,f.iridescenceThicknessMinimum.value=o.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=o.iridescenceThicknessRange[1],o.iridescenceMap&&(f.iridescenceMap.value=o.iridescenceMap,i(o.iridescenceMap,f.iridescenceMapTransform)),o.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=o.iridescenceThicknessMap,i(o.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),o.transmission>0&&(f.transmission.value=o.transmission,f.transmissionSamplerMap.value=c.texture,f.transmissionSamplerSize.value.set(c.width,c.height),o.transmissionMap&&(f.transmissionMap.value=o.transmissionMap,i(o.transmissionMap,f.transmissionMapTransform)),f.thickness.value=o.thickness,o.thicknessMap&&(f.thicknessMap.value=o.thicknessMap,i(o.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=o.attenuationDistance,f.attenuationColor.value.copy(o.attenuationColor)),o.anisotropy>0&&(f.anisotropyVector.value.set(o.anisotropy*Math.cos(o.anisotropyRotation),o.anisotropy*Math.sin(o.anisotropyRotation)),o.anisotropyMap&&(f.anisotropyMap.value=o.anisotropyMap,i(o.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=o.specularIntensity,f.specularColor.value.copy(o.specularColor),o.specularColorMap&&(f.specularColorMap.value=o.specularColorMap,i(o.specularColorMap,f.specularColorMapTransform)),o.specularIntensityMap&&(f.specularIntensityMap.value=o.specularIntensityMap,i(o.specularIntensityMap,f.specularIntensityMapTransform))}function n(f,o){o.matcap&&(f.matcap.value=o.matcap)}function u(f,o){const c=t.get(o).light;f.referencePosition.value.setFromMatrixPosition(c.matrixWorld),f.nearDistance.value=c.shadow.camera.near,f.farDistance.value=c.shadow.camera.far}return{refreshFogUniforms:x,refreshMaterialUniforms:T}}function k6(g,t,i,x){let T={},E={},s=[];const y=i.isWebGL2?g.getParameter(g.MAX_UNIFORM_BUFFER_BINDINGS):0;function e(c,d){const v=d.program;x.uniformBlockBinding(c,v)}function r(c,d){let v=T[c.id];v===void 0&&(n(c),v=p(c),T[c.id]=v,c.addEventListener("dispose",f));const m=d.program;x.updateUBOMapping(c,m);const S=t.render.frame;E[c.id]!==S&&(a(c),E[c.id]=S)}function p(c){const d=h();c.__bindingPointIndex=d;const v=g.createBuffer(),m=c.__size,S=c.usage;return g.bindBuffer(g.UNIFORM_BUFFER,v),g.bufferData(g.UNIFORM_BUFFER,m,S),g.bindBuffer(g.UNIFORM_BUFFER,null),g.bindBufferBase(g.UNIFORM_BUFFER,d,v),v}function h(){for(let c=0;c0&&(v+=m-S),c.__size=v,c.__cache={},this}function u(c){const d={boundary:0,storage:0};return typeof c=="number"||typeof c=="boolean"?(d.boundary=4,d.storage=4):c.isVector2?(d.boundary=8,d.storage=8):c.isVector3||c.isColor?(d.boundary=16,d.storage=12):c.isVector4?(d.boundary=16,d.storage=16):c.isMatrix3?(d.boundary=48,d.storage=48):c.isMatrix4?(d.boundary=64,d.storage=64):c.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",c),d}function f(c){const d=c.target;d.removeEventListener("dispose",f);const v=s.indexOf(d.__bindingPointIndex);s.splice(v,1),g.deleteBuffer(T[d.id]),delete T[d.id],delete E[d.id]}function o(){for(const c in T)g.deleteBuffer(T[c]);s=[],T={},E={}}return{bind:e,update:r,dispose:o}}class M1{constructor(t={}){const{canvas:i=fw(),context:x=null,depth:T=!0,stencil:E=!0,alpha:s=!1,antialias:y=!1,premultipliedAlpha:e=!0,preserveDrawingBuffer:r=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:h=!1}=t;this.isWebGLRenderer=!0;let a;x!==null?a=x.getContextAttributes().alpha:a=s;const l=new Uint32Array(4),n=new Int32Array(4);let u=null,f=null;const o=[],c=[];this.domElement=i,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=vr,this._useLegacyLights=!1,this.toneMapping=Bo,this.toneMappingExposure=1;const d=this;let v=!1,m=0,S=0,M=null,w=-1,C=null;const A=new sn,P=new sn;let b=null;const O=new ze(0);let I=0,D=i.width,B=i.height,G=1,z=null,X=null;const K=new sn(0,0,D,B),Q=new sn(0,0,D,B);let tt=!1;const Y=new _d;let Z=!1,U=!1,H=null;const J=new ci,_=new ve,q=new Ct,at={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ot(){return M===null?G:1}let rt=x;function gt(Tt,jt){for(let _t=0;_t{function Te(){if(ee.forEach(function(Ue){Vt.get(Ue).currentProgram.isReady()&&ee.delete(Ue)}),ee.size===0){te(Tt);return}setTimeout(Te,10)}yt.get("KHR_parallel_shader_compile")!==null?Te():setTimeout(Te,10)})};let Di=null;function en(Tt){Di&&Di(Tt)}function Zn(){di.stop()}function Gi(){di.start()}const di=new yw;di.setAnimationLoop(en),typeof self<"u"&&di.setContext(self),this.setAnimationLoop=function(Tt){Di=Tt,le.setAnimationLoop(Tt),Tt===null?di.stop():di.start()},le.addEventListener("sessionstart",Zn),le.addEventListener("sessionend",Gi),this.render=function(Tt,jt){if(jt!==void 0&&jt.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;Tt.matrixWorldAutoUpdate===!0&&Tt.updateMatrixWorld(),jt.parent===null&&jt.matrixWorldAutoUpdate===!0&&jt.updateMatrixWorld(),le.enabled===!0&&le.isPresenting===!0&&(le.cameraAutoUpdate===!0&&le.updateCamera(jt),jt=le.getCamera()),Tt.isScene===!0&&Tt.onBeforeRender(d,Tt,jt,M),f=xe.get(Tt,c.length),f.init(),c.push(f),J.multiplyMatrices(jt.projectionMatrix,jt.matrixWorldInverse),Y.setFromProjectionMatrix(J),U=this.localClippingEnabled,Z=Ae.init(this.clippingPlanes,U),u=ge.get(Tt,o.length),u.init(),o.push(u),Wi(Tt,jt,0,d.sortObjects),u.finish(),d.sortObjects===!0&&u.sort(z,X),this.info.render.frame++,Z===!0&&Ae.beginShadows();const _t=f.state.shadowsArray;if(qt.render(_t,Tt,jt),Z===!0&&Ae.endShadows(),this.info.autoReset===!0&&this.info.reset(),(le.enabled===!1||le.isPresenting===!1||le.hasDepthSensing()===!1)&&Ge.render(u,Tt),f.setupLights(d._useLegacyLights),jt.isArrayCamera){const ee=jt.cameras;for(let te=0,Te=ee.length;te0?f=c[c.length-1]:f=null,o.pop(),o.length>0?u=o[o.length-1]:u=null};function Wi(Tt,jt,_t,ee){if(Tt.visible===!1)return;if(Tt.layers.test(jt.layers)){if(Tt.isGroup)_t=Tt.renderOrder;else if(Tt.isLOD)Tt.autoUpdate===!0&&Tt.update(jt);else if(Tt.isLight)f.pushLight(Tt),Tt.castShadow&&f.pushShadow(Tt);else if(Tt.isSprite){if(!Tt.frustumCulled||Y.intersectsSprite(Tt)){ee&&q.setFromMatrixPosition(Tt.matrixWorld).applyMatrix4(J);const Ue=Bt.update(Tt),We=Tt.material;We.visible&&u.push(Tt,Ue,We,_t,q.z,null)}}else if((Tt.isMesh||Tt.isLine||Tt.isPoints)&&(!Tt.frustumCulled||Y.intersectsObject(Tt))){const Ue=Bt.update(Tt),We=Tt.material;if(ee&&(Tt.boundingSphere!==void 0?(Tt.boundingSphere===null&&Tt.computeBoundingSphere(),q.copy(Tt.boundingSphere.center)):(Ue.boundingSphere===null&&Ue.computeBoundingSphere(),q.copy(Ue.boundingSphere.center)),q.applyMatrix4(Tt.matrixWorld).applyMatrix4(J)),Array.isArray(We)){const $e=Ue.groups;for(let qe=0,ii=$e.length;qe0&&aa(te,Te,jt,_t),ee&&At.viewport(A.copy(ee)),te.length>0&&Bs(te,jt,_t),Te.length>0&&Bs(Te,jt,_t),Ue.length>0&&Bs(Ue,jt,_t),At.buffers.depth.setTest(!0),At.buffers.depth.setMask(!0),At.buffers.color.setMask(!0),At.setPolygonOffset(!1)}function aa(Tt,jt,_t,ee){if((_t.isScene===!0?_t.overrideMaterial:null)!==null)return;const Te=Et.isWebGL2;H===null&&(H=new io(1,1,{generateMipmaps:!0,type:yt.has("EXT_color_buffer_half_float")?Zf:Uo,minFilter:Io,samples:Te?4:0})),d.getDrawingBufferSize(_),Te?H.setSize(_.x,_.y):H.setSize(Em(_.x),Em(_.y));const Ue=d.getRenderTarget();d.setRenderTarget(H),d.getClearColor(O),I=d.getClearAlpha(),I<1&&d.setClearColor(16777215,.5),d.clear();const We=d.toneMapping;d.toneMapping=Bo,Bs(Tt,_t,ee),dt.updateMultisampleRenderTarget(H),dt.updateRenderTargetMipmap(H);let $e=!1;for(let qe=0,ii=jt.length;qe0),ai=!!_t.morphAttributes.position,Ji=!!_t.morphAttributes.normal,hn=!!_t.morphAttributes.color;let ki=Bo;ee.toneMapped&&(M===null||M.isXRRenderTarget===!0)&&(ki=d.toneMapping);const gn=_t.morphAttributes.position||_t.morphAttributes.normal||_t.morphAttributes.color,ti=gn!==void 0?gn.length:0,Se=Vt.get(ee),Nr=f.state.lights;if(Z===!0&&(U===!0||Tt!==C)){const Tn=Tt===C&&ee.id===w;Ae.setState(ee,Tt,Tn)}let mi=!1;ee.version===Se.__version?(Se.needsLights&&Se.lightsStateVersion!==Nr.state.version||Se.outputColorSpace!==We||te.isBatchedMesh&&Se.batching===!1||!te.isBatchedMesh&&Se.batching===!0||te.isInstancedMesh&&Se.instancing===!1||!te.isInstancedMesh&&Se.instancing===!0||te.isSkinnedMesh&&Se.skinning===!1||!te.isSkinnedMesh&&Se.skinning===!0||te.isInstancedMesh&&Se.instancingColor===!0&&te.instanceColor===null||te.isInstancedMesh&&Se.instancingColor===!1&&te.instanceColor!==null||Se.envMap!==$e||ee.fog===!0&&Se.fog!==Te||Se.numClippingPlanes!==void 0&&(Se.numClippingPlanes!==Ae.numPlanes||Se.numIntersection!==Ae.numIntersection)||Se.vertexAlphas!==qe||Se.vertexTangents!==ii||Se.morphTargets!==ai||Se.morphNormals!==Ji||Se.morphColors!==hn||Se.toneMapping!==ki||Et.isWebGL2===!0&&Se.morphTargetsCount!==ti)&&(mi=!0):(mi=!0,Se.__version=ee.version);let un=Se.currentProgram;mi===!0&&(un=ao(ee,jt,te));let Ii=!1,Gn=!1,pn=!1;const Ki=un.getUniforms(),dr=Se.uniforms;if(At.useProgram(un.program)&&(Ii=!0,Gn=!0,pn=!0),ee.id!==w&&(w=ee.id,Gn=!0),Ii||C!==Tt){Ki.setValue(rt,"projectionMatrix",Tt.projectionMatrix),Ki.setValue(rt,"viewMatrix",Tt.matrixWorldInverse);const Tn=Ki.map.cameraPosition;Tn!==void 0&&Tn.setValue(rt,q.setFromMatrixPosition(Tt.matrixWorld)),Et.logarithmicDepthBuffer&&Ki.setValue(rt,"logDepthBufFC",2/(Math.log(Tt.far+1)/Math.LN2)),(ee.isMeshPhongMaterial||ee.isMeshToonMaterial||ee.isMeshLambertMaterial||ee.isMeshBasicMaterial||ee.isMeshStandardMaterial||ee.isShaderMaterial)&&Ki.setValue(rt,"isOrthographic",Tt.isOrthographicCamera===!0),C!==Tt&&(C=Tt,Gn=!0,pn=!0)}if(te.isSkinnedMesh){Ki.setOptional(rt,te,"bindMatrix"),Ki.setOptional(rt,te,"bindMatrixInverse");const Tn=te.skeleton;Tn&&(Et.floatVertexTextures?(Tn.boneTexture===null&&Tn.computeBoneTexture(),Ki.setValue(rt,"boneTexture",Tn.boneTexture,dt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}te.isBatchedMesh&&(Ki.setOptional(rt,te,"batchingTexture"),Ki.setValue(rt,"batchingTexture",te._matricesTexture,dt));const zs=_t.morphAttributes;if((zs.position!==void 0||zs.normal!==void 0||zs.color!==void 0&&Et.isWebGL2===!0)&&Oe.update(te,_t,un),(Gn||Se.receiveShadow!==te.receiveShadow)&&(Se.receiveShadow=te.receiveShadow,Ki.setValue(rt,"receiveShadow",te.receiveShadow)),ee.isMeshGouraudMaterial&&ee.envMap!==null&&(dr.envMap.value=$e,dr.flipEnvMap.value=$e.isCubeTexture&&$e.isRenderTargetTexture===!1?-1:1),Gn&&(Ki.setValue(rt,"toneMappingExposure",d.toneMappingExposure),Se.needsLights&&oo(dr,pn),Te&&ee.fog===!0&&oe.refreshFogUniforms(dr,Te),oe.refreshMaterialUniforms(dr,ee,G,B,H),lm.upload(rt,_r(Se),dr,dt)),ee.isShaderMaterial&&ee.uniformsNeedUpdate===!0&&(lm.upload(rt,_r(Se),dr,dt),ee.uniformsNeedUpdate=!1),ee.isSpriteMaterial&&Ki.setValue(rt,"center",te.center),Ki.setValue(rt,"modelViewMatrix",te.modelViewMatrix),Ki.setValue(rt,"normalMatrix",te.normalMatrix),Ki.setValue(rt,"modelMatrix",te.matrixWorld),ee.isShaderMaterial||ee.isRawShaderMaterial){const Tn=ee.uniformsGroups;for(let oa=0,Jn=Tn.length;oa0&&dt.useMultisampledRTT(Tt)===!1?te=Vt.get(Tt).__webglMultisampledFramebuffer:Array.isArray(ii)?te=ii[_t]:te=ii,A.copy(Tt.viewport),P.copy(Tt.scissor),b=Tt.scissorTest}else A.copy(K).multiplyScalar(G).floor(),P.copy(Q).multiplyScalar(G).floor(),b=tt;if(At.bindFramebuffer(rt.FRAMEBUFFER,te)&&Et.drawBuffers&&ee&&At.drawBuffers(Tt,te),At.viewport(A),At.scissor(P),At.setScissorTest(b),Te){const $e=Vt.get(Tt.texture);rt.framebufferTexture2D(rt.FRAMEBUFFER,rt.COLOR_ATTACHMENT0,rt.TEXTURE_CUBE_MAP_POSITIVE_X+jt,$e.__webglTexture,_t)}else if(Ue){const $e=Vt.get(Tt.texture),qe=jt||0;rt.framebufferTextureLayer(rt.FRAMEBUFFER,rt.COLOR_ATTACHMENT0,$e.__webglTexture,_t||0,qe)}w=-1},this.readRenderTargetPixels=function(Tt,jt,_t,ee,te,Te,Ue){if(!(Tt&&Tt.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let We=Vt.get(Tt).__webglFramebuffer;if(Tt.isWebGLCubeRenderTarget&&Ue!==void 0&&(We=We[Ue]),We){At.bindFramebuffer(rt.FRAMEBUFFER,We);try{const $e=Tt.texture,qe=$e.format,ii=$e.type;if(qe!==ps&&ie.convert(qe)!==rt.getParameter(rt.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ai=ii===Zf&&(yt.has("EXT_color_buffer_half_float")||Et.isWebGL2&&yt.has("EXT_color_buffer_float"));if(ii!==Uo&&ie.convert(ii)!==rt.getParameter(rt.IMPLEMENTATION_COLOR_READ_TYPE)&&!(ii===Ea&&(Et.isWebGL2||yt.has("OES_texture_float")||yt.has("WEBGL_color_buffer_float")))&&!ai){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}jt>=0&&jt<=Tt.width-ee&&_t>=0&&_t<=Tt.height-te&&rt.readPixels(jt,_t,ee,te,ie.convert(qe),ie.convert(ii),Te)}finally{const $e=M!==null?Vt.get(M).__webglFramebuffer:null;At.bindFramebuffer(rt.FRAMEBUFFER,$e)}}},this.copyFramebufferToTexture=function(Tt,jt,_t=0){const ee=Math.pow(2,-_t),te=Math.floor(jt.image.width*ee),Te=Math.floor(jt.image.height*ee);dt.setTexture2D(jt,0),rt.copyTexSubImage2D(rt.TEXTURE_2D,_t,0,0,Tt.x,Tt.y,te,Te),At.unbindTexture()},this.copyTextureToTexture=function(Tt,jt,_t,ee=0){const te=jt.image.width,Te=jt.image.height,Ue=ie.convert(_t.format),We=ie.convert(_t.type);dt.setTexture2D(_t,0),rt.pixelStorei(rt.UNPACK_FLIP_Y_WEBGL,_t.flipY),rt.pixelStorei(rt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_t.premultiplyAlpha),rt.pixelStorei(rt.UNPACK_ALIGNMENT,_t.unpackAlignment),jt.isDataTexture?rt.texSubImage2D(rt.TEXTURE_2D,ee,Tt.x,Tt.y,te,Te,Ue,We,jt.image.data):jt.isCompressedTexture?rt.compressedTexSubImage2D(rt.TEXTURE_2D,ee,Tt.x,Tt.y,jt.mipmaps[0].width,jt.mipmaps[0].height,Ue,jt.mipmaps[0].data):rt.texSubImage2D(rt.TEXTURE_2D,ee,Tt.x,Tt.y,Ue,We,jt.image),ee===0&&_t.generateMipmaps&&rt.generateMipmap(rt.TEXTURE_2D),At.unbindTexture()},this.copyTextureToTexture3D=function(Tt,jt,_t,ee,te=0){if(d.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Te=Tt.max.x-Tt.min.x+1,Ue=Tt.max.y-Tt.min.y+1,We=Tt.max.z-Tt.min.z+1,$e=ie.convert(ee.format),qe=ie.convert(ee.type);let ii;if(ee.isData3DTexture)dt.setTexture3D(ee,0),ii=rt.TEXTURE_3D;else if(ee.isDataArrayTexture||ee.isCompressedArrayTexture)dt.setTexture2DArray(ee,0),ii=rt.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}rt.pixelStorei(rt.UNPACK_FLIP_Y_WEBGL,ee.flipY),rt.pixelStorei(rt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ee.premultiplyAlpha),rt.pixelStorei(rt.UNPACK_ALIGNMENT,ee.unpackAlignment);const ai=rt.getParameter(rt.UNPACK_ROW_LENGTH),Ji=rt.getParameter(rt.UNPACK_IMAGE_HEIGHT),hn=rt.getParameter(rt.UNPACK_SKIP_PIXELS),ki=rt.getParameter(rt.UNPACK_SKIP_ROWS),gn=rt.getParameter(rt.UNPACK_SKIP_IMAGES),ti=_t.isCompressedTexture?_t.mipmaps[te]:_t.image;rt.pixelStorei(rt.UNPACK_ROW_LENGTH,ti.width),rt.pixelStorei(rt.UNPACK_IMAGE_HEIGHT,ti.height),rt.pixelStorei(rt.UNPACK_SKIP_PIXELS,Tt.min.x),rt.pixelStorei(rt.UNPACK_SKIP_ROWS,Tt.min.y),rt.pixelStorei(rt.UNPACK_SKIP_IMAGES,Tt.min.z),_t.isDataTexture||_t.isData3DTexture?rt.texSubImage3D(ii,te,jt.x,jt.y,jt.z,Te,Ue,We,$e,qe,ti.data):_t.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),rt.compressedTexSubImage3D(ii,te,jt.x,jt.y,jt.z,Te,Ue,We,$e,ti.data)):rt.texSubImage3D(ii,te,jt.x,jt.y,jt.z,Te,Ue,We,$e,qe,ti),rt.pixelStorei(rt.UNPACK_ROW_LENGTH,ai),rt.pixelStorei(rt.UNPACK_IMAGE_HEIGHT,Ji),rt.pixelStorei(rt.UNPACK_SKIP_PIXELS,hn),rt.pixelStorei(rt.UNPACK_SKIP_ROWS,ki),rt.pixelStorei(rt.UNPACK_SKIP_IMAGES,gn),te===0&&ee.generateMipmaps&&rt.generateMipmap(ii),At.unbindTexture()},this.initTexture=function(Tt){Tt.isCubeTexture?dt.setTextureCube(Tt,0):Tt.isData3DTexture?dt.setTexture3D(Tt,0):Tt.isDataArrayTexture||Tt.isCompressedArrayTexture?dt.setTexture2DArray(Tt,0):dt.setTexture2D(Tt,0),At.unbindTexture()},this.resetState=function(){m=0,S=0,M=null,At.reset(),Ke.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return No}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const i=this.getContext();i.drawingBufferColorSpace=t===lg?"display-p3":"srgb",i.unpackColorSpace=rn.workingColorSpace===Jd?"display-p3":"srgb"}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===vr?ch:c1}set outputEncoding(t){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=t===ch?vr:Go}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}}class Aw extends M1{}Aw.prototype.isWebGL1Renderer=!0;class fg{constructor(t,i=25e-5){this.isFogExp2=!0,this.name="",this.color=new ze(t),this.density=i}clone(){return new fg(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class cg{constructor(t,i=1,x=1e3){this.isFog=!0,this.name="",this.color=new ze(t),this.near=i,this.far=x}clone(){return new cg(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Mm extends Yi{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,i){return super.copy(t,i),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const i=super.toJSON(t);return this.fog!==null&&(i.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(i.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(i.object.backgroundIntensity=this.backgroundIntensity),i}}class dg{constructor(t,i){this.isInterleavedBuffer=!0,this.array=t,this.stride=i,this.count=t!==void 0?t.length/i:0,this.usage=Fd,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=na()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return Su("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,i){this.updateRanges.push({start:t,count:i})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,i,x){t*=this.stride,x*=i.stride;for(let T=0,E=this.stride;Tt.far||i.push({distance:e,point:jc.clone(),uv:ia.getInterpolation(jc,Ev,Jc,Mv,fE,X0,cE,new ve),face:null,object:this})}copy(t,i){return super.copy(t,i),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}}function Cv(g,t,i,x,T,E){Af.subVectors(g,i).addScalar(.5).multiply(x),T!==void 0?(Zc.x=E*Af.x-T*Af.y,Zc.y=T*Af.x+E*Af.y):Zc.copy(Af),g.copy(t),g.x+=Zc.x,g.y+=Zc.y,g.applyMatrix4(Pw)}const wv=new Ct,dE=new Ct;class bw extends Yi{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const i=t.levels;for(let x=0,T=i.length;x0){let x,T;for(x=1,T=i.length;x0){wv.setFromMatrixPosition(this.matrixWorld);const T=t.ray.origin.distanceTo(wv);this.getObjectForDistance(T).raycast(t,i)}}update(t){const i=this.levels;if(i.length>1){wv.setFromMatrixPosition(t.matrixWorld),dE.setFromMatrixPosition(this.matrixWorld);const x=wv.distanceTo(dE)/t.zoom;i[0].object.visible=!0;let T,E;for(T=1,E=i.length;T=s)i[T-1].object.visible=!1,i[T].object.visible=!0;else break}for(this._currentLevel=T-1;T=x.length&&x.push({start:-1,count:-1,z:-1});const E=x[this.index];T.push(E),this.index++,E.start=t.start,E.count=t.count,E.z=i}reset(){this.list.length=0,this.index=0}}const Rf="batchId",rh=new ci,EE=new ci,_6=new ci,ME=new ci,K0=new _d,Rv=new gs,tu=new $r,_c=new Ct,j0=new Q6,jr=new cr,bv=[];function q6(g,t,i=0){const x=t.itemSize;if(g.isInterleavedBufferAttribute||g.array.constructor!==t.array.constructor){const T=g.count;for(let E=0;E65536?new Uint32Array(E):new Uint16Array(E);i.setIndex(new an(y,1))}const s=T>65536?new Uint32Array(x):new Uint16Array(x);i.setAttribute(Rf,new an(s,1)),this._geometryInitialized=!0}}_validateGeometry(t){if(t.getAttribute(Rf))throw new Error(`BatchedMesh: Geometry cannot use attribute "${Rf}"`);const i=this.geometry;if(!!t.getIndex()!=!!i.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const x in i.attributes){if(x===Rf)continue;if(!t.hasAttribute(x))throw new Error(`BatchedMesh: Added geometry missing "${x}". All geometries must have consistent attributes.`);const T=t.getAttribute(x),E=i.getAttribute(x);if(T.itemSize!==E.itemSize||T.normalized!==E.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new gs);const t=this._geometryCount,i=this.boundingBox,x=this._active;i.makeEmpty();for(let T=0;T=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const T={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let E=null;const s=this._reservedRanges,y=this._drawRanges,e=this._bounds;this._geometryCount!==0&&(E=s[s.length-1]),i===-1?T.vertexCount=t.getAttribute("position").count:T.vertexCount=i,E===null?T.vertexStart=0:T.vertexStart=E.vertexStart+E.vertexCount;const r=t.getIndex(),p=r!==null;if(p&&(x===-1?T.indexCount=r.count:T.indexCount=x,E===null?T.indexStart=0:T.indexStart=E.indexStart+E.indexCount),T.indexStart!==-1&&T.indexStart+T.indexCount>this._maxIndexCount||T.vertexStart+T.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._visibility,a=this._active,l=this._matricesTexture,n=this._matricesTexture.image.data;h.push(!0),a.push(!0);const u=this._geometryCount;this._geometryCount++,_6.toArray(n,u*16),l.needsUpdate=!0,s.push(T),y.push({start:p?T.indexStart:T.vertexStart,count:-1}),e.push({boxInitialized:!1,box:new gs,sphereInitialized:!1,sphere:new $r});const f=this.geometry.getAttribute(Rf);for(let o=0;o=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(i);const x=this.geometry,T=x.getIndex()!==null,E=x.getIndex(),s=i.getIndex(),y=this._reservedRanges[t];if(T&&s.count>y.indexCount||i.attributes.position.count>y.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const e=y.vertexStart,r=y.vertexCount;for(const l in x.attributes){if(l===Rf)continue;const n=i.getAttribute(l),u=x.getAttribute(l);q6(n,u,e);const f=n.itemSize;for(let o=n.count,c=r;o=i.length||i[t]===!1?this:(i[t]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(t,i){if(this._active[t]===!1)return null;const T=this._bounds[t],E=T.box,s=this.geometry;if(T.boxInitialized===!1){E.makeEmpty();const y=s.index,e=s.attributes.position,r=this._drawRanges[t];for(let p=r.start,h=r.start+r.count;p=s||x[t]===!1?this:(i.toArray(E,t*16),T.needsUpdate=!0,this)}getMatrixAt(t,i){const x=this._active,T=this._matricesTexture.image.data,E=this._geometryCount;return t>=E||x[t]===!1?null:i.fromArray(T,t*16)}setVisibleAt(t,i){const x=this._visibility,T=this._active,E=this._geometryCount;return t>=E||T[t]===!1||x[t]===i?this:(x[t]=i,this._visibilityChanged=!0,this)}getVisibleAt(t){const i=this._visibility,x=this._active,T=this._geometryCount;return t>=T||x[t]===!1?!1:i[t]}raycast(t,i){const x=this._visibility,T=this._active,E=this._drawRanges,s=this._geometryCount,y=this.matrixWorld,e=this.geometry;jr.material=this.material,jr.geometry.index=e.index,jr.geometry.attributes=e.attributes,jr.geometry.boundingBox===null&&(jr.geometry.boundingBox=new gs),jr.geometry.boundingSphere===null&&(jr.geometry.boundingSphere=new $r);for(let r=0;r({...i})),this._reservedRanges=t._reservedRanges.map(i=>({...i})),this._visibility=t._visibility.slice(),this._active=t._active.slice(),this._bounds=t._bounds.map(i=>({boxInitialized:i.boxInitialized,box:i.box.clone(),sphereInitialized:i.sphereInitialized,sphere:i.sphere.clone()})),this._maxGeometryCount=t._maxGeometryCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._geometryCount=t._geometryCount,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(t,i,x,T,E){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const s=T.getIndex(),y=s===null?1:s.array.BYTES_PER_ELEMENT,e=this._active,r=this._visibility,p=this._multiDrawStarts,h=this._multiDrawCounts,a=this._drawRanges,l=this.perObjectFrustumCulled;l&&(ME.multiplyMatrices(x.projectionMatrix,x.matrixWorldInverse).multiply(this.matrixWorld),K0.setFromProjectionMatrix(ME,t.coordinateSystem));let n=0;if(this.sortObjects){EE.copy(this.matrixWorld).invert(),_c.setFromMatrixPosition(x.matrixWorld).applyMatrix4(EE);for(let o=0,c=r.length;oe)continue;a.applyMatrix4(this.matrixWorld);const w=t.ray.origin.distanceTo(a);wt.far||i.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this})}}else{const o=Math.max(0,s.start),c=Math.min(f.count,s.start+s.count);for(let d=o,v=c-1;de)continue;a.applyMatrix4(this.matrixWorld);const S=t.ray.origin.distanceTo(a);St.far||i.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const i=this.geometry.morphAttributes,x=Object.keys(i);if(x.length>0){const T=i[x[0]];if(T!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let E=0,s=T.length;E0){const T=i[x[0]];if(T!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let E=0,s=T.length;ET.far)return;E.push({distance:r,distanceToRay:Math.sqrt(y),point:e,index:t,face:null,object:s})}}class tU extends Un{constructor(t,i,x,T,E,s,y,e,r){super(t,i,x,T,E,s,y,e,r),this.isVideoTexture=!0,this.minFilter=s!==void 0?s:Nn,this.magFilter=E!==void 0?E:Nn,this.generateMipmaps=!1;const p=this;function h(){p.needsUpdate=!0,t.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;"requestVideoFrameCallback"in t===!1&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class eU extends Un{constructor(t,i){super({width:t,height:i}),this.isFramebufferTexture=!0,this.magFilter=nr,this.minFilter=nr,this.generateMipmaps=!1,this.needsUpdate=!0}}class vg extends Un{constructor(t,i,x,T,E,s,y,e,r,p,h,a){super(null,s,y,e,r,p,T,E,h,a),this.isCompressedTexture=!0,this.image={width:i,height:x},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class iU extends vg{constructor(t,i,x,T,E,s){super(t,i,x,E,s),this.isCompressedArrayTexture=!0,this.image.depth=T,this.wrapR=Jr}}class nU extends vg{constructor(t,i,x){super(void 0,t[0].width,t[0].height,i,x,wl),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class rU extends Un{constructor(t,i,x,T,E,s,y,e,r){super(t,i,x,T,E,s,y,e,r),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ro{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,i){const x=this.getUtoTmapping(t);return this.getPoint(x,i)}getPoints(t=5){const i=[];for(let x=0;x<=t;x++)i.push(this.getPoint(x/t));return i}getSpacedPoints(t=5){const i=[];for(let x=0;x<=t;x++)i.push(this.getPointAt(x/t));return i}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const i=[];let x,T=this.getPoint(0),E=0;i.push(0);for(let s=1;s<=t;s++)x=this.getPoint(s/t),E+=x.distanceTo(T),i.push(E),T=x;return this.cacheArcLengths=i,i}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,i){const x=this.getLengths();let T=0;const E=x.length;let s;i?s=i:s=t*x[E-1];let y=0,e=E-1,r;for(;y<=e;)if(T=Math.floor(y+(e-y)/2),r=x[T]-s,r<0)y=T+1;else if(r>0)e=T-1;else{e=T;break}if(T=e,x[T]===s)return T/(E-1);const p=x[T],a=x[T+1]-p,l=(s-p)/a;return(T+l)/(E-1)}getTangent(t,i){let T=t-1e-4,E=t+1e-4;T<0&&(T=0),E>1&&(E=1);const s=this.getPoint(T),y=this.getPoint(E),e=i||(s.isVector2?new ve:new Ct);return e.copy(y).sub(s).normalize(),e}getTangentAt(t,i){const x=this.getUtoTmapping(t);return this.getTangent(x,i)}computeFrenetFrames(t,i){const x=new Ct,T=[],E=[],s=[],y=new Ct,e=new ci;for(let l=0;l<=t;l++){const n=l/t;T[l]=this.getTangentAt(n,new Ct)}E[0]=new Ct,s[0]=new Ct;let r=Number.MAX_VALUE;const p=Math.abs(T[0].x),h=Math.abs(T[0].y),a=Math.abs(T[0].z);p<=r&&(r=p,x.set(1,0,0)),h<=r&&(r=h,x.set(0,1,0)),a<=r&&x.set(0,0,1),y.crossVectors(T[0],x).normalize(),E[0].crossVectors(T[0],y),s[0].crossVectors(T[0],E[0]);for(let l=1;l<=t;l++){if(E[l]=E[l-1].clone(),s[l]=s[l-1].clone(),y.crossVectors(T[l-1],T[l]),y.length()>Number.EPSILON){y.normalize();const n=Math.acos(jn(T[l-1].dot(T[l]),-1,1));E[l].applyMatrix4(e.makeRotationAxis(y,n))}s[l].crossVectors(T[l],E[l])}if(i===!0){let l=Math.acos(jn(E[0].dot(E[t]),-1,1));l/=t,T[0].dot(y.crossVectors(E[0],E[t]))>0&&(l=-l);for(let n=1;n<=t;n++)E[n].applyMatrix4(e.makeRotationAxis(T[n],l*n)),s[n].crossVectors(T[n],E[n])}return{tangents:T,normals:E,binormals:s}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class mg extends ro{constructor(t=0,i=0,x=1,T=1,E=0,s=Math.PI*2,y=!1,e=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=i,this.xRadius=x,this.yRadius=T,this.aStartAngle=E,this.aEndAngle=s,this.aClockwise=y,this.aRotation=e}getPoint(t,i){const x=i||new ve,T=Math.PI*2;let E=this.aEndAngle-this.aStartAngle;const s=Math.abs(E)T;)E-=T;E0?0:(Math.floor(Math.abs(y)/E)+1)*E:e===0&&y===E-1&&(y=E-2,e=1);let r,p;this.closed||y>0?r=T[(y-1)%E]:(Dv.subVectors(T[0],T[1]).add(T[0]),r=Dv);const h=T[y%E],a=T[(y+1)%E];if(this.closed||y+2T.length-2?T.length-1:s+1],h=T[s>T.length-3?T.length-1:s+2];return x.set(FE(y,e.x,r.x,p.x,h.x),FE(y,e.y,r.y,p.y,h.y)),x}copy(t){super.copy(t),this.points=[];for(let i=0,x=t.points.length;i=x){const s=T[E]-x,y=this.curves[E],e=y.getLength(),r=e===0?0:1-s/e;return y.getPointAt(r,i)}E++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let i=0;for(let x=0,T=this.curves.length;x1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let i=0,x=t.curves.length;i0){const h=r.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(r);const p=r.getPoint(1);return this.currentPoint.copy(p),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class tp extends Li{constructor(t=[new ve(0,-.5),new ve(.5,0),new ve(0,.5)],i=12,x=0,T=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:t,segments:i,phiStart:x,phiLength:T},i=Math.floor(i),T=jn(T,0,Math.PI*2);const E=[],s=[],y=[],e=[],r=[],p=1/i,h=new Ct,a=new ve,l=new Ct,n=new Ct,u=new Ct;let f=0,o=0;for(let c=0;c<=t.length-1;c++)switch(c){case 0:f=t[c+1].x-t[c].x,o=t[c+1].y-t[c].y,l.x=o*1,l.y=-f,l.z=o*0,u.copy(l),l.normalize(),e.push(l.x,l.y,l.z);break;case t.length-1:e.push(u.x,u.y,u.z);break;default:f=t[c+1].x-t[c].x,o=t[c+1].y-t[c].y,l.x=o*1,l.y=-f,l.z=o*0,n.copy(l),l.x+=u.x,l.y+=u.y,l.z+=u.z,l.normalize(),e.push(l.x,l.y,l.z),u.copy(n)}for(let c=0;c<=i;c++){const d=x+c*p*T,v=Math.sin(d),m=Math.cos(d);for(let S=0;S<=t.length-1;S++){h.x=t[S].x*v,h.y=t[S].y,h.z=t[S].x*m,s.push(h.x,h.y,h.z),a.x=c/i,a.y=S/(t.length-1),y.push(a.x,a.y);const M=e[3*S+0]*v,w=e[3*S+1],C=e[3*S+0]*m;r.push(M,w,C)}}for(let c=0;c0&&d(!0),i>0&&d(!1)),this.setIndex(p),this.setAttribute("position",new ke(h,3)),this.setAttribute("normal",new ke(a,3)),this.setAttribute("uv",new ke(l,2));function c(){const v=new Ct,m=new Ct;let S=0;const M=(i-t)/x;for(let w=0;w<=E;w++){const C=[],A=w/E,P=A*(i-t)+t;for(let b=0;b<=T;b++){const O=b/T,I=O*e+y,D=Math.sin(I),B=Math.cos(I);m.x=P*D,m.y=-A*x+f,m.z=P*B,h.push(m.x,m.y,m.z),v.set(D,M,B).normalize(),a.push(v.x,v.y,v.z),l.push(O,1-A),C.push(n++)}u.push(C)}for(let w=0;w.9&&M<.1&&(d<.2&&(s[c+0]+=1),v<.2&&(s[c+2]+=1),m<.2&&(s[c+4]+=1))}}function a(c){E.push(c.x,c.y,c.z)}function l(c,d){const v=c*3;d.x=t[v+0],d.y=t[v+1],d.z=t[v+2]}function n(){const c=new Ct,d=new Ct,v=new Ct,m=new Ct,S=new ve,M=new ve,w=new ve;for(let C=0,A=0;C80*i){y=r=g[0],e=p=g[1];for(let n=i;nr&&(r=h),a>p&&(p=a);l=Math.max(r-y,p-e),l=l!==0?32767/l:0}return Nd(E,s,i,y,e,l,0),s}};function Hw(g,t,i,x,T){let E,s;if(T===RU(g,t,i,x)>0)for(E=t;E=t;E-=x)s=OE(E,g[E],g[E+1],s);return s&&Tg(s,s.next)&&(Ud(s),s=s.next),s}function bu(g,t){if(!g)return g;t||(t=g);let i=g,x;do if(x=!1,!i.steiner&&(Tg(i,i.next)||Bn(i.prev,i,i.next)===0)){if(Ud(i),i=t=i.prev,i===i.next)break;x=!0}else i=i.next;while(x||i!==t);return t}function Nd(g,t,i,x,T,E,s){if(!g)return;!s&&E&&EU(g,x,T,E);let y=g,e,r;for(;g.prev!==g.next;){if(e=g.prev,r=g.next,E?pU(g,x,T,E):dU(g)){t.push(e.i/i|0),t.push(g.i/i|0),t.push(r.i/i|0),Ud(g),g=r.next,y=r.next;continue}if(g=r,g===y){s?s===1?(g=vU(bu(g),t,i),Nd(g,t,i,x,T,E,2)):s===2&&mU(g,t,i,x,T,E):Nd(bu(g),t,i,x,T,E,1);break}}}function dU(g){const t=g.prev,i=g,x=g.next;if(Bn(t,i,x)>=0)return!1;const T=t.x,E=i.x,s=x.x,y=t.y,e=i.y,r=x.y,p=TE?T>s?T:s:E>s?E:s,l=y>e?y>r?y:r:e>r?e:r;let n=x.next;for(;n!==t;){if(n.x>=p&&n.x<=a&&n.y>=h&&n.y<=l&&Vf(T,y,E,e,s,r,n.x,n.y)&&Bn(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function pU(g,t,i,x){const T=g.prev,E=g,s=g.next;if(Bn(T,E,s)>=0)return!1;const y=T.x,e=E.x,r=s.x,p=T.y,h=E.y,a=s.y,l=ye?y>r?y:r:e>r?e:r,f=p>h?p>a?p:a:h>a?h:a,o=yx(l,n,t,i,x),c=yx(u,f,t,i,x);let d=g.prevZ,v=g.nextZ;for(;d&&d.z>=o&&v&&v.z<=c;){if(d.x>=l&&d.x<=u&&d.y>=n&&d.y<=f&&d!==T&&d!==s&&Vf(y,p,e,h,r,a,d.x,d.y)&&Bn(d.prev,d,d.next)>=0||(d=d.prevZ,v.x>=l&&v.x<=u&&v.y>=n&&v.y<=f&&v!==T&&v!==s&&Vf(y,p,e,h,r,a,v.x,v.y)&&Bn(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;d&&d.z>=o;){if(d.x>=l&&d.x<=u&&d.y>=n&&d.y<=f&&d!==T&&d!==s&&Vf(y,p,e,h,r,a,d.x,d.y)&&Bn(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;v&&v.z<=c;){if(v.x>=l&&v.x<=u&&v.y>=n&&v.y<=f&&v!==T&&v!==s&&Vf(y,p,e,h,r,a,v.x,v.y)&&Bn(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function vU(g,t,i){let x=g;do{const T=x.prev,E=x.next.next;!Tg(T,E)&&Ww(T,x,x.next,E)&&Bd(T,E)&&Bd(E,T)&&(t.push(T.i/i|0),t.push(x.i/i|0),t.push(E.i/i|0),Ud(x),Ud(x.next),x=g=E),x=x.next}while(x!==g);return bu(x)}function mU(g,t,i,x,T,E){let s=g;do{let y=s.next.next;for(;y!==s.prev;){if(s.i!==y.i&&wU(s,y)){let e=Xw(s,y);s=bu(s,s.next),e=bu(e,e.next),Nd(s,t,i,x,T,E,0),Nd(e,t,i,x,T,E,0);return}y=y.next}s=s.next}while(s!==g)}function gU(g,t,i,x){const T=[];let E,s,y,e,r;for(E=0,s=t.length;E=i.next.y&&i.next.y!==i.y){const a=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=E&&a>x&&(x=a,T=i.x=i.x&&i.x>=e&&E!==i.x&&Vf(sT.x||i.x===T.x&&TU(T,i)))&&(T=i,p=h)),i=i.next;while(i!==y);return T}function TU(g,t){return Bn(g.prev,g,t.prev)<0&&Bn(t.next,g,g.next)<0}function EU(g,t,i,x){let T=g;do T.z===0&&(T.z=yx(T.x,T.y,t,i,x)),T.prevZ=T.prev,T.nextZ=T.next,T=T.next;while(T!==g);T.prevZ.nextZ=null,T.prevZ=null,MU(T)}function MU(g){let t,i,x,T,E,s,y,e,r=1;do{for(i=g,g=null,E=null,s=0;i;){for(s++,x=i,y=0,t=0;t0||e>0&&x;)y!==0&&(e===0||!x||i.z<=x.z)?(T=i,i=i.nextZ,y--):(T=x,x=x.nextZ,e--),E?E.nextZ=T:g=T,T.prevZ=E,E=T;i=x}E.nextZ=null,r*=2}while(s>1);return g}function yx(g,t,i,x,T){return g=(g-i)*T|0,t=(t-x)*T|0,g=(g|g<<8)&16711935,g=(g|g<<4)&252645135,g=(g|g<<2)&858993459,g=(g|g<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,g|t<<1}function CU(g){let t=g,i=g;do(t.x=(g-s)*(E-y)&&(g-s)*(x-y)>=(i-s)*(t-y)&&(i-s)*(E-y)>=(T-s)*(x-y)}function wU(g,t){return g.next.i!==t.i&&g.prev.i!==t.i&&!AU(g,t)&&(Bd(g,t)&&Bd(t,g)&&PU(g,t)&&(Bn(g.prev,g,t.prev)||Bn(g,t.prev,t))||Tg(g,t)&&Bn(g.prev,g,g.next)>0&&Bn(t.prev,t,t.next)>0)}function Bn(g,t,i){return(t.y-g.y)*(i.x-t.x)-(t.x-g.x)*(i.y-t.y)}function Tg(g,t){return g.x===t.x&&g.y===t.y}function Ww(g,t,i,x){const T=zv(Bn(g,t,i)),E=zv(Bn(g,t,x)),s=zv(Bn(i,x,g)),y=zv(Bn(i,x,t));return!!(T!==E&&s!==y||T===0&&Uv(g,i,t)||E===0&&Uv(g,x,t)||s===0&&Uv(i,g,x)||y===0&&Uv(i,t,x))}function Uv(g,t,i){return t.x<=Math.max(g.x,i.x)&&t.x>=Math.min(g.x,i.x)&&t.y<=Math.max(g.y,i.y)&&t.y>=Math.min(g.y,i.y)}function zv(g){return g>0?1:g<0?-1:0}function AU(g,t){let i=g;do{if(i.i!==g.i&&i.next.i!==g.i&&i.i!==t.i&&i.next.i!==t.i&&Ww(i,i.next,g,t))return!0;i=i.next}while(i!==g);return!1}function Bd(g,t){return Bn(g.prev,g,g.next)<0?Bn(g,t,g.next)>=0&&Bn(g,g.prev,t)>=0:Bn(g,t,g.prev)<0||Bn(g,g.next,t)<0}function PU(g,t){let i=g,x=!1;const T=(g.x+t.x)/2,E=(g.y+t.y)/2;do i.y>E!=i.next.y>E&&i.next.y!==i.y&&T<(i.next.x-i.x)*(E-i.y)/(i.next.y-i.y)+i.x&&(x=!x),i=i.next;while(i!==g);return x}function Xw(g,t){const i=new xx(g.i,g.x,g.y),x=new xx(t.i,t.x,t.y),T=g.next,E=t.prev;return g.next=t,t.prev=g,i.next=T,T.prev=i,x.next=i,i.prev=x,E.next=x,x.prev=E,x}function OE(g,t,i,x){const T=new xx(g,t,i);return x?(T.next=x.next,T.prev=x,x.next.prev=T,x.next=T):(T.prev=T,T.next=T),T}function Ud(g){g.next.prev=g.prev,g.prev.next=g.next,g.prevZ&&(g.prevZ.nextZ=g.nextZ),g.nextZ&&(g.nextZ.prevZ=g.prevZ)}function xx(g,t,i){this.i=g,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function RU(g,t,i,x){let T=0;for(let E=t,s=i-x;E2&&g[t-1].equals(g[0])&&g.pop()}function IE(g,t){for(let i=0;iNumber.EPSILON){const Bt=Math.sqrt(Dt),ne=Math.sqrt(ut*ut+Rt*Rt),oe=gt.x-dt/Bt,ge=gt.y+Vt/Bt,xe=yt.x-Rt/ne,Ae=yt.y+ut/ne,qt=((xe-oe)*Rt-(Ae-ge)*ut)/(Vt*Rt-dt*ut);Et=oe+Vt*qt-rt.x,At=ge+dt*qt-rt.y;const Ge=Et*Et+At*At;if(Ge<=2)return new ve(Et,At);Pt=Math.sqrt(Ge/2)}else{let Bt=!1;Vt>Number.EPSILON?ut>Number.EPSILON&&(Bt=!0):Vt<-Number.EPSILON?ut<-Number.EPSILON&&(Bt=!0):Math.sign(dt)===Math.sign(Rt)&&(Bt=!0),Bt?(Et=-dt,At=Vt,Pt=Math.sqrt(Dt)):(Et=Vt,At=dt,Pt=Math.sqrt(Dt/2))}return new ve(Et/Pt,At/Pt)}const X=[];for(let rt=0,gt=I.length,yt=gt-1,Et=rt+1;rt=0;rt--){const gt=rt/f,yt=l*Math.cos(gt*Math.PI/2),Et=n*Math.sin(gt*Math.PI/2)+u;for(let At=0,Pt=I.length;At=0;){const Et=yt;let At=yt-1;At<0&&(At=rt.length-1);for(let Pt=0,Vt=p+f*2;Pt0)&&l.push(d,v,S),(o!==x-1||e0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class Zw extends Hr{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ze(16777215),this.specular=new ze(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yh,this.normalScale=new ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Zd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Jw extends Hr{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ze(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yh,this.normalScale=new ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class $w extends Hr{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yh,this.normalScale=new ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class Qw extends Hr{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ze(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yh,this.normalScale=new ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Zd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class _w extends Hr{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ze(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yh,this.normalScale=new ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class qw extends ys{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function gu(g,t,i){return!g||!i&&g.constructor===t?g:typeof t.BYTES_PER_ELEMENT=="number"?new t(g):Array.prototype.slice.call(g)}function tA(g){return ArrayBuffer.isView(g)&&!(g instanceof DataView)}function eA(g){function t(T,E){return g[T]-g[E]}const i=g.length,x=new Array(i);for(let T=0;T!==i;++T)x[T]=T;return x.sort(t),x}function Sx(g,t,i){const x=g.length,T=new g.constructor(x);for(let E=0,s=0;s!==x;++E){const y=i[E]*t;for(let e=0;e!==t;++e)T[s++]=g[y+e]}return T}function D1(g,t,i,x){let T=1,E=g[0];for(;E!==void 0&&E[x]===void 0;)E=g[T++];if(E===void 0)return;let s=E[x];if(s!==void 0)if(Array.isArray(s))do s=E[x],s!==void 0&&(t.push(E.time),i.push.apply(i,s)),E=g[T++];while(E!==void 0);else if(s.toArray!==void 0)do s=E[x],s!==void 0&&(t.push(E.time),s.toArray(i,i.length)),E=g[T++];while(E!==void 0);else do s=E[x],s!==void 0&&(t.push(E.time),i.push(s)),E=g[T++];while(E!==void 0)}function OU(g,t,i,x,T=30){const E=g.clone();E.name=t;const s=[];for(let e=0;e=x)){h.push(r.times[l]);for(let u=0;uE.tracks[e].times[0]&&(y=E.tracks[e].times[0]);for(let e=0;e=y.times[n]){const o=n*h+p,c=o+h-p;u=y.values.slice(o,c)}else{const o=y.createInterpolant(),c=p,d=h-p;o.evaluate(E),u=o.resultBuffer.slice(c,d)}e==="quaternion"&&new Ds().fromArray(u).normalize().conjugate().toArray(u);const f=r.times.length;for(let o=0;o=E)){const y=i[1];t=E)break e}s=x,x=0;break i}break t}for(;x>>1;ti;)--s;if(++s,E!==0||s!==T){E>=s&&(s=Math.max(s,1),E=s-1);const y=this.getValueSize();this.times=x.slice(E,s),this.values=this.values.slice(E*y,s*y)}return this}validate(){let t=!0;const i=this.getValueSize();i-Math.floor(i)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const x=this.times,T=this.values,E=x.length;E===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let y=0;y!==E;y++){const e=x[y];if(typeof e=="number"&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,y,e),t=!1;break}if(s!==null&&s>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,y,e,s),t=!1;break}s=e}if(T!==void 0&&tA(T))for(let y=0,e=T.length;y!==e;++y){const r=T[y];if(isNaN(r)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,y,r),t=!1;break}}return t}optimize(){const t=this.times.slice(),i=this.values.slice(),x=this.getValueSize(),T=this.getInterpolation()===am,E=t.length-1;let s=1;for(let y=1;y0){t[s]=t[E];for(let y=E*x,e=s*x,r=0;r!==x;++r)i[e+r]=i[y+r];++s}return s!==t.length?(this.times=t.slice(0,s),this.values=i.slice(0,s*x)):(this.times=t,this.values=i),this}clone(){const t=this.times.slice(),i=this.values.slice(),x=this.constructor,T=new x(this.name,t,i);return T.createInterpolant=this.createInterpolant,T}}so.prototype.TimeBufferType=Float32Array;so.prototype.ValueBufferType=Float32Array;so.prototype.DefaultInterpolation=Ad;class Du extends so{}Du.prototype.ValueTypeName="bool";Du.prototype.ValueBufferType=Array;Du.prototype.DefaultInterpolation=wd;Du.prototype.InterpolantFactoryMethodLinear=void 0;Du.prototype.InterpolantFactoryMethodSmooth=void 0;class N1 extends so{}N1.prototype.ValueTypeName="color";class zd extends so{}zd.prototype.ValueTypeName="number";class rA extends np{constructor(t,i,x,T){super(t,i,x,T)}interpolate_(t,i,x,T){const E=this.resultBuffer,s=this.sampleValues,y=this.valueSize,e=(x-i)/(T-i);let r=t*y;for(let p=r+y;r!==p;r+=4)Ds.slerpFlat(E,0,s,r-y,s,r,e);return E}}class ac extends so{InterpolantFactoryMethodLinear(t){return new rA(this.times,this.values,this.getValueSize(),t)}}ac.prototype.ValueTypeName="quaternion";ac.prototype.DefaultInterpolation=Ad;ac.prototype.InterpolantFactoryMethodSmooth=void 0;class Iu extends so{}Iu.prototype.ValueTypeName="string";Iu.prototype.ValueBufferType=Array;Iu.prototype.DefaultInterpolation=wd;Iu.prototype.InterpolantFactoryMethodLinear=void 0;Iu.prototype.InterpolantFactoryMethodSmooth=void 0;class Gd extends so{}Gd.prototype.ValueTypeName="vector";class Vd{constructor(t,i=-1,x,T=og){this.name=t,this.tracks=x,this.duration=i,this.blendMode=T,this.uuid=na(),this.duration<0&&this.resetDuration()}static parse(t){const i=[],x=t.tracks,T=1/(t.fps||1);for(let s=0,y=x.length;s!==y;++s)i.push(BU(x[s]).scale(T));const E=new this(t.name,t.duration,i,t.blendMode);return E.uuid=t.uuid,E}static toJSON(t){const i=[],x=t.tracks,T={name:t.name,duration:t.duration,tracks:i,uuid:t.uuid,blendMode:t.blendMode};for(let E=0,s=x.length;E!==s;++E)i.push(so.toJSON(x[E]));return T}static CreateFromMorphTargetSequence(t,i,x,T){const E=i.length,s=[];for(let y=0;y1){const h=p[1];let a=T[h];a||(T[h]=a=[]),a.push(r)}}const s=[];for(const y in T)s.push(this.CreateFromMorphTargetSequence(y,T[y],i,x));return s}static parseAnimation(t,i){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const x=function(h,a,l,n,u){if(l.length!==0){const f=[],o=[];D1(l,f,o,n),f.length!==0&&u.push(new h(a,f,o))}},T=[],E=t.name||"default",s=t.fps||30,y=t.blendMode;let e=t.length||-1;const r=t.hierarchy||[];for(let h=0;h{i&&i(E),this.manager.itemEnd(t)},0),E;if(pl[t]!==void 0){pl[t].push({onLoad:i,onProgress:x,onError:T});return}pl[t]=[],pl[t].push({onLoad:i,onProgress:x,onError:T});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),y=this.mimeType,e=this.responseType;fetch(s).then(r=>{if(r.status===200||r.status===0){if(r.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||r.body===void 0||r.body.getReader===void 0)return r;const p=pl[t],h=r.body.getReader(),a=r.headers.get("Content-Length")||r.headers.get("X-File-Size"),l=a?parseInt(a):0,n=l!==0;let u=0;const f=new ReadableStream({start(o){c();function c(){h.read().then(({done:d,value:v})=>{if(d)o.close();else{u+=v.byteLength;const m=new ProgressEvent("progress",{lengthComputable:n,loaded:u,total:l});for(let S=0,M=p.length;S{switch(e){case"arraybuffer":return r.arrayBuffer();case"blob":return r.blob();case"document":return r.text().then(p=>new DOMParser().parseFromString(p,y));case"json":return r.json();default:if(y===void 0)return r.text();{const h=/charset="?([^;"\s]*)"?/i.exec(y),a=h&&h[1]?h[1].toLowerCase():void 0,l=new TextDecoder(a);return r.arrayBuffer().then(n=>l.decode(n))}}}).then(r=>{Sl.add(t,r);const p=pl[t];delete pl[t];for(let h=0,a=p.length;h{const p=pl[t];if(p===void 0)throw this.manager.itemError(t),r;delete pl[t];for(let h=0,a=p.length;h{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class zU extends Ns{constructor(t){super(t)}load(t,i,x,T){const E=this,s=new Al(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,function(y){try{i(E.parse(JSON.parse(y)))}catch(e){T?T(e):console.error(e),E.manager.itemError(t)}},x,T)}parse(t){const i=[];for(let x=0;x0:T.vertexColors=t.vertexColors),t.uniforms!==void 0)for(const E in t.uniforms){const s=t.uniforms[E];switch(T.uniforms[E]={},s.type){case"t":T.uniforms[E].value=x(s.value);break;case"c":T.uniforms[E].value=new ze().setHex(s.value);break;case"v2":T.uniforms[E].value=new ve().fromArray(s.value);break;case"v3":T.uniforms[E].value=new Ct().fromArray(s.value);break;case"v4":T.uniforms[E].value=new sn().fromArray(s.value);break;case"m3":T.uniforms[E].value=new Oi().fromArray(s.value);break;case"m4":T.uniforms[E].value=new ci().fromArray(s.value);break;default:T.uniforms[E].value=s.value}}if(t.defines!==void 0&&(T.defines=t.defines),t.vertexShader!==void 0&&(T.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(T.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(T.glslVersion=t.glslVersion),t.extensions!==void 0)for(const E in t.extensions)T.extensions[E]=t.extensions[E];if(t.lights!==void 0&&(T.lights=t.lights),t.clipping!==void 0&&(T.clipping=t.clipping),t.size!==void 0&&(T.size=t.size),t.sizeAttenuation!==void 0&&(T.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(T.map=x(t.map)),t.matcap!==void 0&&(T.matcap=x(t.matcap)),t.alphaMap!==void 0&&(T.alphaMap=x(t.alphaMap)),t.bumpMap!==void 0&&(T.bumpMap=x(t.bumpMap)),t.bumpScale!==void 0&&(T.bumpScale=t.bumpScale),t.normalMap!==void 0&&(T.normalMap=x(t.normalMap)),t.normalMapType!==void 0&&(T.normalMapType=t.normalMapType),t.normalScale!==void 0){let E=t.normalScale;Array.isArray(E)===!1&&(E=[E,E]),T.normalScale=new ve().fromArray(E)}return t.displacementMap!==void 0&&(T.displacementMap=x(t.displacementMap)),t.displacementScale!==void 0&&(T.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(T.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(T.roughnessMap=x(t.roughnessMap)),t.metalnessMap!==void 0&&(T.metalnessMap=x(t.metalnessMap)),t.emissiveMap!==void 0&&(T.emissiveMap=x(t.emissiveMap)),t.emissiveIntensity!==void 0&&(T.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(T.specularMap=x(t.specularMap)),t.specularIntensityMap!==void 0&&(T.specularIntensityMap=x(t.specularIntensityMap)),t.specularColorMap!==void 0&&(T.specularColorMap=x(t.specularColorMap)),t.envMap!==void 0&&(T.envMap=x(t.envMap)),t.envMapIntensity!==void 0&&(T.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(T.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(T.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(T.lightMap=x(t.lightMap)),t.lightMapIntensity!==void 0&&(T.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(T.aoMap=x(t.aoMap)),t.aoMapIntensity!==void 0&&(T.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(T.gradientMap=x(t.gradientMap)),t.clearcoatMap!==void 0&&(T.clearcoatMap=x(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(T.clearcoatRoughnessMap=x(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(T.clearcoatNormalMap=x(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(T.clearcoatNormalScale=new ve().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(T.iridescenceMap=x(t.iridescenceMap)),t.iridescenceThicknessMap!==void 0&&(T.iridescenceThicknessMap=x(t.iridescenceThicknessMap)),t.transmissionMap!==void 0&&(T.transmissionMap=x(t.transmissionMap)),t.thicknessMap!==void 0&&(T.thicknessMap=x(t.thicknessMap)),t.anisotropyMap!==void 0&&(T.anisotropyMap=x(t.anisotropyMap)),t.sheenColorMap!==void 0&&(T.sheenColorMap=x(t.sheenColorMap)),t.sheenRoughnessMap!==void 0&&(T.sheenRoughnessMap=x(t.sheenRoughnessMap)),T}setTextures(t){return this.textures=t,this}static createMaterialFromType(t){const i={ShadowMaterial:kw,SpriteMaterial:C1,RawShaderMaterial:Kw,ShaderMaterial:no,PointsMaterial:A1,MeshPhysicalMaterial:jw,MeshStandardMaterial:vl,MeshPhongMaterial:Zw,MeshToonMaterial:Jw,MeshNormalMaterial:$w,MeshLambertMaterial:Qw,MeshDepthMaterial:T1,MeshDistanceMaterial:E1,MeshBasicMaterial:xh,MeshMatcapMaterial:_w,LineDashedMaterial:qw,LineBasicMaterial:ys,Material:Hr};return new i[t]}}class Tx{static decodeText(t){if(typeof TextDecoder<"u")return new TextDecoder().decode(t);let i="";for(let x=0,T=t.length;x0){const e=new B1(i);E=new Hd(e),E.setCrossOrigin(this.crossOrigin);for(let r=0,p=t.length;r0){T=new Hd(this.manager),T.setCrossOrigin(this.crossOrigin);for(let s=0,y=t.length;s{const f=new gs;f.min.fromArray(u.boxMin),f.max.fromArray(u.boxMax);const o=new $r;return o.radius=u.sphereRadius,o.center.fromArray(u.sphereCenter),{boxInitialized:u.boxInitialized,box:f,sphereInitialized:u.sphereInitialized,sphere:o}}),s._maxGeometryCount=t.maxGeometryCount,s._maxVertexCount=t.maxVertexCount,s._maxIndexCount=t.maxIndexCount,s._geometryInitialized=t.geometryInitialized,s._geometryCount=t.geometryCount,s._matricesTexture=r(t.matricesTexture.uuid);break;case"LOD":s=new bw;break;case"Line":s=new mh(y(t.geometry),e(t.material));break;case"LineLoop":s=new Dw(y(t.geometry),e(t.material));break;case"LineSegments":s=new Ho(y(t.geometry),e(t.material));break;case"PointCloud":case"Points":s=new Iw(y(t.geometry),e(t.material));break;case"Sprite":s=new Rw(e(t.material));break;case"Group":s=new Gf;break;case"Bone":s=new w1;break;default:s=new Yi}if(s.uuid=t.uuid,t.name!==void 0&&(s.name=t.name),t.matrix!==void 0?(s.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(s.matrixAutoUpdate=t.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(t.position!==void 0&&s.position.fromArray(t.position),t.rotation!==void 0&&s.rotation.fromArray(t.rotation),t.quaternion!==void 0&&s.quaternion.fromArray(t.quaternion),t.scale!==void 0&&s.scale.fromArray(t.scale)),t.up!==void 0&&s.up.fromArray(t.up),t.castShadow!==void 0&&(s.castShadow=t.castShadow),t.receiveShadow!==void 0&&(s.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.bias!==void 0&&(s.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(s.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(s.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&s.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(s.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(s.visible=t.visible),t.frustumCulled!==void 0&&(s.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(s.renderOrder=t.renderOrder),t.userData!==void 0&&(s.userData=t.userData),t.layers!==void 0&&(s.layers.mask=t.layers),t.children!==void 0){const a=t.children;for(let l=0;l"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,i,x,T){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const E=this,s=Sl.get(t);if(s!==void 0){if(E.manager.itemStart(t),s.then){s.then(r=>{i&&i(r),E.manager.itemEnd(t)}).catch(r=>{T&&T(r)});return}return setTimeout(function(){i&&i(s),E.manager.itemEnd(t)},0),s}const y={};y.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",y.headers=this.requestHeader;const e=fetch(t,y).then(function(r){return r.blob()}).then(function(r){return createImageBitmap(r,Object.assign(E.options,{colorSpaceConversion:"none"}))}).then(function(r){return Sl.add(t,r),i&&i(r),E.manager.itemEnd(t),r}).catch(function(r){T&&T(r),Sl.remove(t),E.manager.itemError(t),E.manager.itemEnd(t)});Sl.add(t,e),E.manager.itemStart(t)}}let Gv,z1=class{static getContext(){return Gv===void 0&&(Gv=new(window.AudioContext||window.webkitAudioContext)),Gv}static setContext(t){Gv=t}};class ZU extends Ns{constructor(t){super(t)}load(t,i,x,T){const E=this,s=new Al(this.manager);s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,function(e){try{const r=e.slice(0);z1.getContext().decodeAudioData(r,function(h){i(h)}).catch(y)}catch(r){y(r)}},x,T);function y(e){T?T(e):console.error(e),E.manager.itemError(t)}}}const WE=new ci,XE=new ci,eu=new ci;class JU{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Or,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Or,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const i=this._cache;if(i.focus!==t.focus||i.fov!==t.fov||i.aspect!==t.aspect*this.aspect||i.near!==t.near||i.far!==t.far||i.zoom!==t.zoom||i.eyeSep!==this.eyeSep){i.focus=t.focus,i.fov=t.fov,i.aspect=t.aspect*this.aspect,i.near=t.near,i.far=t.far,i.zoom=t.zoom,i.eyeSep=this.eyeSep,eu.copy(t.projectionMatrix);const T=i.eyeSep/2,E=T*i.near/i.focus,s=i.near*Math.tan(xu*i.fov*.5)/i.zoom;let y,e;XE.elements[12]=-T,WE.elements[12]=T,y=-s*i.aspect+E,e=s*i.aspect+E,eu.elements[0]=2*i.near/(e-y),eu.elements[8]=(e+y)/(e-y),this.cameraL.projectionMatrix.copy(eu),y=-s*i.aspect-E,e=s*i.aspect-E,eu.elements[0]=2*i.near/(e-y),eu.elements[8]=(e+y)/(e-y),this.cameraR.projectionMatrix.copy(eu)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(XE),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(WE)}}class G1{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=YE(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const i=YE();t=(i-this.oldTime)/1e3,this.oldTime=i,this.elapsedTime+=t}return t}}function YE(){return(typeof performance>"u"?Date:performance).now()}const iu=new Ct,kE=new Ds,$U=new Ct,nu=new Ct;class QU extends Yi{constructor(){super(),this.type="AudioListener",this.context=z1.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new G1}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const i=this.context.listener,x=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(iu,kE,$U),nu.set(0,0,-1).applyQuaternion(kE),i.positionX){const T=this.context.currentTime+this.timeDelta;i.positionX.linearRampToValueAtTime(iu.x,T),i.positionY.linearRampToValueAtTime(iu.y,T),i.positionZ.linearRampToValueAtTime(iu.z,T),i.forwardX.linearRampToValueAtTime(nu.x,T),i.forwardY.linearRampToValueAtTime(nu.y,T),i.forwardZ.linearRampToValueAtTime(nu.z,T),i.upX.linearRampToValueAtTime(x.x,T),i.upY.linearRampToValueAtTime(x.y,T),i.upZ.linearRampToValueAtTime(x.z,T)}else i.setPosition(iu.x,iu.y,iu.z),i.setOrientation(nu.x,nu.y,nu.z,x.x,x.y,x.z)}}let gA=class extends Yi{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+t;const i=this.context.createBufferSource();return i.buffer=this.buffer,i.loop=this.loop,i.loopStart=this.loopStart,i.loopEnd=this.loopEnd,i.onended=this.onEnded.bind(this),i.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=i,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,i=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,i=this.filters.length;t0&&this._mixBufferRegionAdditive(x,T,this._addIndex*i,1,i);for(let e=i,r=i+i;e!==r;++e)if(x[e]!==x[e+i]){y.setValue(x,T);break}}saveOriginalState(){const t=this.binding,i=this.buffer,x=this.valueSize,T=x*this._origIndex;t.getValue(i,T);for(let E=x,s=T;E!==s;++E)i[E]=i[T+E%x];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=this.valueSize*3;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,i=t+this.valueSize;for(let x=t;x=.5)for(let s=0;s!==E;++s)t[i+s]=t[x+s]}_slerp(t,i,x,T){Ds.slerpFlat(t,i,t,i,t,x,T)}_slerpAdditive(t,i,x,T,E){const s=this._workIndex*E;Ds.multiplyQuaternionsFlat(t,s,t,i,t,x),Ds.slerpFlat(t,i,t,i,t,s,T)}_lerp(t,i,x,T,E){const s=1-T;for(let y=0;y!==E;++y){const e=i+y;t[e]=t[e]*s+t[x+y]*T}}_lerpAdditive(t,i,x,T,E){for(let s=0;s!==E;++s){const y=i+s;t[y]=t[y]+t[x+s]*T}}}const V1="\\[\\]\\.:\\/",e7=new RegExp("["+V1+"]","g"),H1="[^"+V1+"]",i7="[^"+V1.replace("\\.","")+"]",n7=/((?:WC+[\/:])*)/.source.replace("WC",H1),r7=/(WCOD+)?/.source.replace("WCOD",i7),s7=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",H1),a7=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",H1),o7=new RegExp("^"+n7+r7+s7+a7+"$"),l7=["material","materials","bones","map"];class h7{constructor(t,i,x){const T=x||Xi.parseTrackName(i);this._targetGroup=t,this._bindings=t.subscribe_(i,T)}getValue(t,i){this.bind();const x=this._targetGroup.nCachedObjects_,T=this._bindings[x];T!==void 0&&T.getValue(t,i)}setValue(t,i){const x=this._bindings;for(let T=this._targetGroup.nCachedObjects_,E=x.length;T!==E;++T)x[T].setValue(t,i)}bind(){const t=this._bindings;for(let i=this._targetGroup.nCachedObjects_,x=t.length;i!==x;++i)t[i].bind()}unbind(){const t=this._bindings;for(let i=this._targetGroup.nCachedObjects_,x=t.length;i!==x;++i)t[i].unbind()}}class Xi{constructor(t,i,x){this.path=i,this.parsedPath=x||Xi.parseTrackName(i),this.node=Xi.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,i,x){return t&&t.isAnimationObjectGroup?new Xi.Composite(t,i,x):new Xi(t,i,x)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(e7,"")}static parseTrackName(t){const i=o7.exec(t);if(i===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const x={nodeName:i[2],objectName:i[3],objectIndex:i[4],propertyName:i[5],propertyIndex:i[6]},T=x.nodeName&&x.nodeName.lastIndexOf(".");if(T!==void 0&&T!==-1){const E=x.nodeName.substring(T+1);l7.indexOf(E)!==-1&&(x.nodeName=x.nodeName.substring(0,T),x.objectName=E)}if(x.propertyName===null||x.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return x}static findNode(t,i){if(i===void 0||i===""||i==="."||i===-1||i===t.name||i===t.uuid)return t;if(t.skeleton){const x=t.skeleton.getBoneByName(i);if(x!==void 0)return x}if(t.children){const x=function(E){for(let s=0;s=E){const h=E++,a=t[h];i[a.uuid]=p,t[p]=a,i[r]=h,t[h]=e;for(let l=0,n=T;l!==n;++l){const u=x[l],f=u[h],o=u[p];u[p]=f,u[h]=o}}}this.nCachedObjects_=E}uncache(){const t=this._objects,i=this._indicesByUUID,x=this._bindings,T=x.length;let E=this.nCachedObjects_,s=t.length;for(let y=0,e=arguments.length;y!==e;++y){const r=arguments[y],p=r.uuid,h=i[p];if(h!==void 0)if(delete i[p],h0&&(i[l.uuid]=h),t[h]=l,t.pop();for(let n=0,u=T;n!==u;++n){const f=x[n];f[h]=f[a],f.pop()}}}this.nCachedObjects_=E}subscribe_(t,i){const x=this._bindingsIndicesByPath;let T=x[t];const E=this._bindings;if(T!==void 0)return E[T];const s=this._paths,y=this._parsedPaths,e=this._objects,r=e.length,p=this.nCachedObjects_,h=new Array(r);T=E.length,x[t]=T,s.push(t),y.push(i),E.push(h);for(let a=p,l=e.length;a!==l;++a){const n=e[a];h[a]=new Xi(n,t,i)}return h}unsubscribe_(t){const i=this._bindingsIndicesByPath,x=i[t];if(x!==void 0){const T=this._paths,E=this._parsedPaths,s=this._bindings,y=s.length-1,e=s[y],r=t[y];i[r]=x,s[x]=e,s.pop(),E[x]=E[y],E.pop(),T[x]=T[y],T.pop()}}}class xA{constructor(t,i,x=null,T=i.blendMode){this._mixer=t,this._clip=i,this._localRoot=x,this.blendMode=T;const E=i.tracks,s=E.length,y=new Array(s),e={endingStart:pu,endingEnd:pu};for(let r=0;r!==s;++r){const p=E[r].createInterpolant(null);y[r]=p,p.settings=e}this._interpolantSettings=e,this._interpolants=y,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=_2,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,i){return this.loop=t,this.repetitions=i,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,i,x){if(t.fadeOut(i),this.fadeIn(i),x){const T=this._clip.duration,E=t._clip.duration,s=E/T,y=T/E;t.warp(1,s,i),this.warp(y,1,i)}return this}crossFadeTo(t,i,x){return t.crossFadeFrom(this,i,x)}stopFading(){const t=this._weightInterpolant;return t!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,i,x){const T=this._mixer,E=T.time,s=this.timeScale;let y=this._timeScaleInterpolant;y===null&&(y=T._lendControlInterpolant(),this._timeScaleInterpolant=y);const e=y.parameterPositions,r=y.sampleValues;return e[0]=E,e[1]=E+x,r[0]=t/s,r[1]=i/s,this}stopWarping(){const t=this._timeScaleInterpolant;return t!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,i,x,T){if(!this.enabled){this._updateWeight(t);return}const E=this._startTime;if(E!==null){const e=(t-E)*x;e<0||x===0?i=0:(this._startTime=null,i=x*e)}i*=this._updateTimeScale(t);const s=this._updateTime(i),y=this._updateWeight(t);if(y>0){const e=this._interpolants,r=this._propertyBindings;switch(this.blendMode){case f1:for(let p=0,h=e.length;p!==h;++p)e[p].evaluate(s),r[p].accumulateAdditive(y);break;case og:default:for(let p=0,h=e.length;p!==h;++p)e[p].evaluate(s),r[p].accumulate(T,y)}}}_updateWeight(t){let i=0;if(this.enabled){i=this.weight;const x=this._weightInterpolant;if(x!==null){const T=x.evaluate(t)[0];i*=T,t>x.parameterPositions[1]&&(this.stopFading(),T===0&&(this.enabled=!1))}}return this._effectiveWeight=i,i}_updateTimeScale(t){let i=0;if(!this.paused){i=this.timeScale;const x=this._timeScaleInterpolant;if(x!==null){const T=x.evaluate(t)[0];i*=T,t>x.parameterPositions[1]&&(this.stopWarping(),i===0?this.paused=!0:this.timeScale=i)}}return this._effectiveTimeScale=i,i}_updateTime(t){const i=this._clip.duration,x=this.loop;let T=this.time+t,E=this._loopCount;const s=x===q2;if(t===0)return E===-1?T:s&&(E&1)===1?i-T:T;if(x===Q2){E===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(T>=i)T=i;else if(T<0)T=0;else{this.time=T;break t}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=T,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(E===-1&&(t>=0?(E=0,this._setEndings(!0,this.repetitions===0,s)):this._setEndings(this.repetitions===0,!0,s)),T>=i||T<0){const y=Math.floor(T/i);T-=i*y,E+=Math.abs(y);const e=this.repetitions-E;if(e<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,T=t>0?i:0,this.time=T,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(e===1){const r=t<0;this._setEndings(r,!r,s)}else this._setEndings(!1,!1,s);this._loopCount=E,this.time=T,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:y})}}else this.time=T;if(s&&(E&1)===1)return i-T}return T}_setEndings(t,i,x){const T=this._interpolantSettings;x?(T.endingStart=vu,T.endingEnd=vu):(t?T.endingStart=this.zeroSlopeAtStart?vu:pu:T.endingStart=Pd,i?T.endingEnd=this.zeroSlopeAtEnd?vu:pu:T.endingEnd=Pd)}_scheduleFading(t,i,x){const T=this._mixer,E=T.time;let s=this._weightInterpolant;s===null&&(s=T._lendControlInterpolant(),this._weightInterpolant=s);const y=s.parameterPositions,e=s.sampleValues;return y[0]=E,e[0]=i,y[1]=E+t,e[1]=x,this}}const f7=new Float32Array(1);class c7 extends Pl{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,i){const x=t._localRoot||this._root,T=t._clip.tracks,E=T.length,s=t._propertyBindings,y=t._interpolants,e=x.uuid,r=this._bindingsByRootAndName;let p=r[e];p===void 0&&(p={},r[e]=p);for(let h=0;h!==E;++h){const a=T[h],l=a.name;let n=p[l];if(n!==void 0)++n.referenceCount,s[h]=n;else{if(n=s[h],n!==void 0){n._cacheIndex===null&&(++n.referenceCount,this._addInactiveBinding(n,e,l));continue}const u=i&&i._propertyBindings[h].binding.parsedPath;n=new yA(Xi.create(x,l,u),a.ValueTypeName,a.getValueSize()),++n.referenceCount,this._addInactiveBinding(n,e,l),s[h]=n}y[h].resultBuffer=n.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){const x=(t._localRoot||this._root).uuid,T=t._clip.uuid,E=this._actionsByClip[T];this._bindAction(t,E&&E.knownActions[0]),this._addInactiveAction(t,T,x)}const i=t._propertyBindings;for(let x=0,T=i.length;x!==T;++x){const E=i[x];E.useCount++===0&&(this._lendBinding(E),E.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const i=t._propertyBindings;for(let x=0,T=i.length;x!==T;++x){const E=i[x];--E.useCount===0&&(E.restoreOriginalState(),this._takeBackBinding(E))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const i=t._cacheIndex;return i!==null&&i=0;--x)t[x].stop();return this}update(t){t*=this.timeScale;const i=this._actions,x=this._nActiveActions,T=this.time+=t,E=Math.sign(t),s=this._accuIndex^=1;for(let r=0;r!==x;++r)i[r]._update(T,t,E,s);const y=this._bindings,e=this._nActiveBindings;for(let r=0;r!==e;++r)y[r].apply(s);return this}setTime(t){this.time=0;for(let i=0;ithis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,i){return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,i){return i.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ZE).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const JE=new Ct,Vv=new Ct;class S7{constructor(t=new Ct,i=new Ct){this.start=t,this.end=i}set(t,i){return this.start.copy(t),this.end.copy(i),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,i){return this.delta(i).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,i){JE.subVectors(t,this.start),Vv.subVectors(this.end,this.start);const x=Vv.dot(Vv);let E=Vv.dot(JE)/x;return i&&(E=jn(E,0,1)),E}closestPointToPoint(t,i,x){const T=this.closestPointToPointParameter(t,i);return this.delta(x).multiplyScalar(T).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const $E=new Ct;class T7 extends Yi{constructor(t,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="SpotLightHelper";const x=new Li,T=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let s=0,y=1,e=32;s1)for(let h=0;h.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{eM.set(t.z,0,-t.x).normalize();const i=Math.acos(t.y);this.quaternion.setFromAxisAngle(eM,i)}}setLength(t,i=t*.2,x=i*.2){this.line.scale.set(1,Math.max(1e-4,t-i),1),this.line.updateMatrix(),this.cone.scale.set(x,i,x),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class I7 extends Ho{constructor(t=1){const i=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],x=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],T=new Li;T.setAttribute("position",new ke(i,3)),T.setAttribute("color",new ke(x,3));const E=new ys({vertexColors:!0,toneMapped:!1});super(T,E),this.type="AxesHelper"}setColors(t,i,x){const T=new ze,E=this.geometry.attributes.color.array;return T.set(t),T.toArray(E,0),T.toArray(E,3),T.set(i),T.toArray(E,6),T.toArray(E,9),T.set(x),T.toArray(E,12),T.toArray(E,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class N7{constructor(){this.type="ShapePath",this.color=new ze,this.subPaths=[],this.currentPath=null}moveTo(t,i){return this.currentPath=new Id,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,i),this}lineTo(t,i){return this.currentPath.lineTo(t,i),this}quadraticCurveTo(t,i,x,T){return this.currentPath.quadraticCurveTo(t,i,x,T),this}bezierCurveTo(t,i,x,T,E,s){return this.currentPath.bezierCurveTo(t,i,x,T,E,s),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function i(o){const c=[];for(let d=0,v=o.length;dNumber.EPSILON){if(A<0&&(M=c[S],C=-C,w=c[m],A=-A),o.yw.y)continue;if(o.y===M.y){if(o.x===M.x)return!0}else{const P=A*(o.x-M.x)-C*(o.y-M.y);if(P===0)return!0;if(P<0)continue;v=!v}}else{if(o.y!==M.y)continue;if(w.x<=o.x&&o.x<=M.x||M.x<=o.x&&o.x<=w.x)return!0}}return v}const T=zo.isClockWise,E=this.subPaths;if(E.length===0)return[];let s,y,e;const r=[];if(E.length===1)return y=E[0],e=new Mu,e.curves=y.curves,r.push(e),r;let p=!T(E[0].getPoints());p=t?!p:p;const h=[],a=[];let l=[],n=0,u;a[n]=void 0,l[n]=[];for(let o=0,c=E.length;o1){let o=!1,c=0;for(let d=0,v=a.length;d0&&o===!1&&(l=h)}let f;for(let o=0,c=a.length;o=0&&(v[J]=null,d[J].disconnect(H))}for(let U=0;U=v.length){v.push(H),J=q;break}else if(v[q]===null){v[q]=H,J=q;break}if(J===-1)break}const _=d[J];_&&_.connect(H)}}const B=new Ct,G=new Ct;function z(Z,U,H){B.setFromMatrixPosition(U.matrixWorld),G.setFromMatrixPosition(H.matrixWorld);const J=B.distanceTo(G),_=U.projectionMatrix.elements,q=H.projectionMatrix.elements,at=_[14]/(_[10]-1),ot=_[14]/(_[10]+1),rt=(_[9]+1)/_[5],gt=(_[9]-1)/_[5],yt=(_[8]-1)/_[0],Et=(q[8]+1)/q[0],At=at*yt,Pt=at*Et,Vt=J/(-yt+Et),dt=Vt*-yt;U.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(dt),Z.translateZ(Vt),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert();const ut=at+Vt,Rt=ot+Vt,Dt=At-dt,Ht=Pt+(J-dt),Bt=rt*ot/Rt*ut,re=gt*ot/Rt*ut;Z.projectionMatrix.makePerspective(Dt,Ht,Bt,re,ut,Rt),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}function X(Z,U){U===null?Z.matrixWorld.copy(Z.matrix):Z.matrixWorld.multiplyMatrices(U.matrixWorld,Z.matrix),Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(T===null)return;u.texture!==null&&(Z.near=u.depthNear,Z.far=u.depthFar),A.near=w.near=M.near=Z.near,A.far=w.far=M.far=Z.far,(P!==A.near||b!==A.far)&&(T.updateRenderState({depthNear:A.near,depthFar:A.far}),P=A.near,b=A.far,M.near=P,M.far=b,w.near=P,w.far=b,M.updateProjectionMatrix(),w.updateProjectionMatrix(),Z.updateProjectionMatrix());const U=Z.parent,H=A.cameras;X(A,U);for(let J=0;J0&&(f.alphaTest.value=o.alphaTest);const c=t.get(o).envMap;if(c&&(f.envMap.value=c,f.flipEnvMap.value=c.isCubeTexture&&c.isRenderTargetTexture===!1?-1:1,f.reflectivity.value=o.reflectivity,f.ior.value=o.ior,f.refractionRatio.value=o.refractionRatio),o.lightMap){f.lightMap.value=o.lightMap;const d=g._useLegacyLights===!0?Math.PI:1;f.lightMapIntensity.value=o.lightMapIntensity*d,i(o.lightMap,f.lightMapTransform)}o.aoMap&&(f.aoMap.value=o.aoMap,f.aoMapIntensity.value=o.aoMapIntensity,i(o.aoMap,f.aoMapTransform))}function s(f,o){f.diffuse.value.copy(o.color),f.opacity.value=o.opacity,o.map&&(f.map.value=o.map,i(o.map,f.mapTransform))}function y(f,o){f.dashSize.value=o.dashSize,f.totalSize.value=o.dashSize+o.gapSize,f.scale.value=o.scale}function e(f,o,c,d){f.diffuse.value.copy(o.color),f.opacity.value=o.opacity,f.size.value=o.size*c,f.scale.value=d*.5,o.map&&(f.map.value=o.map,i(o.map,f.uvTransform)),o.alphaMap&&(f.alphaMap.value=o.alphaMap,i(o.alphaMap,f.alphaMapTransform)),o.alphaTest>0&&(f.alphaTest.value=o.alphaTest)}function r(f,o){f.diffuse.value.copy(o.color),f.opacity.value=o.opacity,f.rotation.value=o.rotation,o.map&&(f.map.value=o.map,i(o.map,f.mapTransform)),o.alphaMap&&(f.alphaMap.value=o.alphaMap,i(o.alphaMap,f.alphaMapTransform)),o.alphaTest>0&&(f.alphaTest.value=o.alphaTest)}function p(f,o){f.specular.value.copy(o.specular),f.shininess.value=Math.max(o.shininess,1e-4)}function h(f,o){o.gradientMap&&(f.gradientMap.value=o.gradientMap)}function a(f,o){f.metalness.value=o.metalness,o.metalnessMap&&(f.metalnessMap.value=o.metalnessMap,i(o.metalnessMap,f.metalnessMapTransform)),f.roughness.value=o.roughness,o.roughnessMap&&(f.roughnessMap.value=o.roughnessMap,i(o.roughnessMap,f.roughnessMapTransform)),t.get(o).envMap&&(f.envMapIntensity.value=o.envMapIntensity)}function l(f,o,c){f.ior.value=o.ior,o.sheen>0&&(f.sheenColor.value.copy(o.sheenColor).multiplyScalar(o.sheen),f.sheenRoughness.value=o.sheenRoughness,o.sheenColorMap&&(f.sheenColorMap.value=o.sheenColorMap,i(o.sheenColorMap,f.sheenColorMapTransform)),o.sheenRoughnessMap&&(f.sheenRoughnessMap.value=o.sheenRoughnessMap,i(o.sheenRoughnessMap,f.sheenRoughnessMapTransform))),o.clearcoat>0&&(f.clearcoat.value=o.clearcoat,f.clearcoatRoughness.value=o.clearcoatRoughness,o.clearcoatMap&&(f.clearcoatMap.value=o.clearcoatMap,i(o.clearcoatMap,f.clearcoatMapTransform)),o.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=o.clearcoatRoughnessMap,i(o.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),o.clearcoatNormalMap&&(f.clearcoatNormalMap.value=o.clearcoatNormalMap,i(o.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(o.clearcoatNormalScale),o.side===ms&&f.clearcoatNormalScale.value.negate())),o.iridescence>0&&(f.iridescence.value=o.iridescence,f.iridescenceIOR.value=o.iridescenceIOR,f.iridescenceThicknessMinimum.value=o.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=o.iridescenceThicknessRange[1],o.iridescenceMap&&(f.iridescenceMap.value=o.iridescenceMap,i(o.iridescenceMap,f.iridescenceMapTransform)),o.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=o.iridescenceThicknessMap,i(o.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),o.transmission>0&&(f.transmission.value=o.transmission,f.transmissionSamplerMap.value=c.texture,f.transmissionSamplerSize.value.set(c.width,c.height),o.transmissionMap&&(f.transmissionMap.value=o.transmissionMap,i(o.transmissionMap,f.transmissionMapTransform)),f.thickness.value=o.thickness,o.thicknessMap&&(f.thicknessMap.value=o.thicknessMap,i(o.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=o.attenuationDistance,f.attenuationColor.value.copy(o.attenuationColor)),o.anisotropy>0&&(f.anisotropyVector.value.set(o.anisotropy*Math.cos(o.anisotropyRotation),o.anisotropy*Math.sin(o.anisotropyRotation)),o.anisotropyMap&&(f.anisotropyMap.value=o.anisotropyMap,i(o.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=o.specularIntensity,f.specularColor.value.copy(o.specularColor),o.specularColorMap&&(f.specularColorMap.value=o.specularColorMap,i(o.specularColorMap,f.specularColorMapTransform)),o.specularIntensityMap&&(f.specularIntensityMap.value=o.specularIntensityMap,i(o.specularIntensityMap,f.specularIntensityMapTransform))}function n(f,o){o.matcap&&(f.matcap.value=o.matcap)}function u(f,o){const c=t.get(o).light;f.referencePosition.value.setFromMatrixPosition(c.matrixWorld),f.nearDistance.value=c.shadow.camera.near,f.farDistance.value=c.shadow.camera.far}return{refreshFogUniforms:x,refreshMaterialUniforms:T}}function K6(g,t,i,x){let T={},E={},s=[];const y=i.isWebGL2?g.getParameter(g.MAX_UNIFORM_BUFFER_BINDINGS):0;function e(c,d){const v=d.program;x.uniformBlockBinding(c,v)}function r(c,d){let v=T[c.id];v===void 0&&(n(c),v=p(c),T[c.id]=v,c.addEventListener("dispose",f));const m=d.program;x.updateUBOMapping(c,m);const S=t.render.frame;E[c.id]!==S&&(a(c),E[c.id]=S)}function p(c){const d=h();c.__bindingPointIndex=d;const v=g.createBuffer(),m=c.__size,S=c.usage;return g.bindBuffer(g.UNIFORM_BUFFER,v),g.bufferData(g.UNIFORM_BUFFER,m,S),g.bindBuffer(g.UNIFORM_BUFFER,null),g.bindBufferBase(g.UNIFORM_BUFFER,d,v),v}function h(){for(let c=0;c0&&(v+=m-S),c.__size=v,c.__cache={},this}function u(c){const d={boundary:0,storage:0};return typeof c=="number"||typeof c=="boolean"?(d.boundary=4,d.storage=4):c.isVector2?(d.boundary=8,d.storage=8):c.isVector3||c.isColor?(d.boundary=16,d.storage=12):c.isVector4?(d.boundary=16,d.storage=16):c.isMatrix3?(d.boundary=48,d.storage=48):c.isMatrix4?(d.boundary=64,d.storage=64):c.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",c),d}function f(c){const d=c.target;d.removeEventListener("dispose",f);const v=s.indexOf(d.__bindingPointIndex);s.splice(v,1),g.deleteBuffer(T[d.id]),delete T[d.id],delete E[d.id]}function o(){for(const c in T)g.deleteBuffer(T[c]);s=[],T={},E={}}return{bind:e,update:r,dispose:o}}class M1{constructor(t={}){const{canvas:i=cw(),context:x=null,depth:T=!0,stencil:E=!0,alpha:s=!1,antialias:y=!1,premultipliedAlpha:e=!0,preserveDrawingBuffer:r=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:h=!1}=t;this.isWebGLRenderer=!0;let a;x!==null?a=x.getContextAttributes().alpha:a=s;const l=new Uint32Array(4),n=new Int32Array(4);let u=null,f=null;const o=[],c=[];this.domElement=i,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=vr,this._useLegacyLights=!1,this.toneMapping=Uo,this.toneMappingExposure=1;const d=this;let v=!1,m=0,S=0,M=null,w=-1,C=null;const A=new sn,P=new sn;let b=null;const O=new ze(0);let I=0,D=i.width,B=i.height,G=1,z=null,X=null;const j=new sn(0,0,D,B),Q=new sn(0,0,D,B);let tt=!1;const Y=new qd;let Z=!1,U=!1,H=null;const J=new ci,_=new ve,q=new Ct,at={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ot(){return M===null?G:1}let rt=x;function gt(Tt,Kt){for(let qt=0;qt{function Te(){if(ie.forEach(function(Ue){Vt.get(Ue).currentProgram.isReady()&&ie.delete(Ue)}),ie.size===0){ee(Tt);return}setTimeout(Te,10)}yt.get("KHR_parallel_shader_compile")!==null?Te():setTimeout(Te,10)})};let Di=null;function en(Tt){Di&&Di(Tt)}function Zn(){di.stop()}function Gi(){di.start()}const di=new xw;di.setAnimationLoop(en),typeof self<"u"&&di.setContext(self),this.setAnimationLoop=function(Tt){Di=Tt,he.setAnimationLoop(Tt),Tt===null?di.stop():di.start()},he.addEventListener("sessionstart",Zn),he.addEventListener("sessionend",Gi),this.render=function(Tt,Kt){if(Kt!==void 0&&Kt.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;Tt.matrixWorldAutoUpdate===!0&&Tt.updateMatrixWorld(),Kt.parent===null&&Kt.matrixWorldAutoUpdate===!0&&Kt.updateMatrixWorld(),he.enabled===!0&&he.isPresenting===!0&&(he.cameraAutoUpdate===!0&&he.updateCamera(Kt),Kt=he.getCamera()),Tt.isScene===!0&&Tt.onBeforeRender(d,Tt,Kt,M),f=xe.get(Tt,c.length),f.init(),c.push(f),J.multiplyMatrices(Kt.projectionMatrix,Kt.matrixWorldInverse),Y.setFromProjectionMatrix(J),U=this.localClippingEnabled,Z=Pe.init(this.clippingPlanes,U),u=ge.get(Tt,o.length),u.init(),o.push(u),Wi(Tt,Kt,0,d.sortObjects),u.finish(),d.sortObjects===!0&&u.sort(z,X),this.info.render.frame++,Z===!0&&Pe.beginShadows();const qt=f.state.shadowsArray;if(te.render(qt,Tt,Kt),Z===!0&&Pe.endShadows(),this.info.autoReset===!0&&this.info.reset(),(he.enabled===!1||he.isPresenting===!1||he.hasDepthSensing()===!1)&&Ge.render(u,Tt),f.setupLights(d._useLegacyLights),Kt.isArrayCamera){const ie=Kt.cameras;for(let ee=0,Te=ie.length;ee0?f=c[c.length-1]:f=null,o.pop(),o.length>0?u=o[o.length-1]:u=null};function Wi(Tt,Kt,qt,ie){if(Tt.visible===!1)return;if(Tt.layers.test(Kt.layers)){if(Tt.isGroup)qt=Tt.renderOrder;else if(Tt.isLOD)Tt.autoUpdate===!0&&Tt.update(Kt);else if(Tt.isLight)f.pushLight(Tt),Tt.castShadow&&f.pushShadow(Tt);else if(Tt.isSprite){if(!Tt.frustumCulled||Y.intersectsSprite(Tt)){ie&&q.setFromMatrixPosition(Tt.matrixWorld).applyMatrix4(J);const Ue=Bt.update(Tt),We=Tt.material;We.visible&&u.push(Tt,Ue,We,qt,q.z,null)}}else if((Tt.isMesh||Tt.isLine||Tt.isPoints)&&(!Tt.frustumCulled||Y.intersectsObject(Tt))){const Ue=Bt.update(Tt),We=Tt.material;if(ie&&(Tt.boundingSphere!==void 0?(Tt.boundingSphere===null&&Tt.computeBoundingSphere(),q.copy(Tt.boundingSphere.center)):(Ue.boundingSphere===null&&Ue.computeBoundingSphere(),q.copy(Ue.boundingSphere.center)),q.applyMatrix4(Tt.matrixWorld).applyMatrix4(J)),Array.isArray(We)){const $e=Ue.groups;for(let qe=0,ii=$e.length;qe0&&aa(ee,Te,Kt,qt),ie&&At.viewport(A.copy(ie)),ee.length>0&&Bs(ee,Kt,qt),Te.length>0&&Bs(Te,Kt,qt),Ue.length>0&&Bs(Ue,Kt,qt),At.buffers.depth.setTest(!0),At.buffers.depth.setMask(!0),At.buffers.color.setMask(!0),At.setPolygonOffset(!1)}function aa(Tt,Kt,qt,ie){if((qt.isScene===!0?qt.overrideMaterial:null)!==null)return;const Te=Et.isWebGL2;H===null&&(H=new io(1,1,{generateMipmaps:!0,type:yt.has("EXT_color_buffer_half_float")?Zf:zo,minFilter:Io,samples:Te?4:0})),d.getDrawingBufferSize(_),Te?H.setSize(_.x,_.y):H.setSize(Em(_.x),Em(_.y));const Ue=d.getRenderTarget();d.setRenderTarget(H),d.getClearColor(O),I=d.getClearAlpha(),I<1&&d.setClearColor(16777215,.5),d.clear();const We=d.toneMapping;d.toneMapping=Uo,Bs(Tt,qt,ie),dt.updateMultisampleRenderTarget(H),dt.updateRenderTargetMipmap(H);let $e=!1;for(let qe=0,ii=Kt.length;qe0),ai=!!qt.morphAttributes.position,Ji=!!qt.morphAttributes.normal,hn=!!qt.morphAttributes.color;let ki=Uo;ie.toneMapped&&(M===null||M.isXRRenderTarget===!0)&&(ki=d.toneMapping);const gn=qt.morphAttributes.position||qt.morphAttributes.normal||qt.morphAttributes.color,ti=gn!==void 0?gn.length:0,Se=Vt.get(ie),Nr=f.state.lights;if(Z===!0&&(U===!0||Tt!==C)){const Tn=Tt===C&&ie.id===w;Pe.setState(ie,Tt,Tn)}let mi=!1;ie.version===Se.__version?(Se.needsLights&&Se.lightsStateVersion!==Nr.state.version||Se.outputColorSpace!==We||ee.isBatchedMesh&&Se.batching===!1||!ee.isBatchedMesh&&Se.batching===!0||ee.isInstancedMesh&&Se.instancing===!1||!ee.isInstancedMesh&&Se.instancing===!0||ee.isSkinnedMesh&&Se.skinning===!1||!ee.isSkinnedMesh&&Se.skinning===!0||ee.isInstancedMesh&&Se.instancingColor===!0&&ee.instanceColor===null||ee.isInstancedMesh&&Se.instancingColor===!1&&ee.instanceColor!==null||Se.envMap!==$e||ie.fog===!0&&Se.fog!==Te||Se.numClippingPlanes!==void 0&&(Se.numClippingPlanes!==Pe.numPlanes||Se.numIntersection!==Pe.numIntersection)||Se.vertexAlphas!==qe||Se.vertexTangents!==ii||Se.morphTargets!==ai||Se.morphNormals!==Ji||Se.morphColors!==hn||Se.toneMapping!==ki||Et.isWebGL2===!0&&Se.morphTargetsCount!==ti)&&(mi=!0):(mi=!0,Se.__version=ie.version);let un=Se.currentProgram;mi===!0&&(un=ao(ie,Kt,ee));let Ii=!1,Gn=!1,pn=!1;const ji=un.getUniforms(),dr=Se.uniforms;if(At.useProgram(un.program)&&(Ii=!0,Gn=!0,pn=!0),ie.id!==w&&(w=ie.id,Gn=!0),Ii||C!==Tt){ji.setValue(rt,"projectionMatrix",Tt.projectionMatrix),ji.setValue(rt,"viewMatrix",Tt.matrixWorldInverse);const Tn=ji.map.cameraPosition;Tn!==void 0&&Tn.setValue(rt,q.setFromMatrixPosition(Tt.matrixWorld)),Et.logarithmicDepthBuffer&&ji.setValue(rt,"logDepthBufFC",2/(Math.log(Tt.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&ji.setValue(rt,"isOrthographic",Tt.isOrthographicCamera===!0),C!==Tt&&(C=Tt,Gn=!0,pn=!0)}if(ee.isSkinnedMesh){ji.setOptional(rt,ee,"bindMatrix"),ji.setOptional(rt,ee,"bindMatrixInverse");const Tn=ee.skeleton;Tn&&(Et.floatVertexTextures?(Tn.boneTexture===null&&Tn.computeBoneTexture(),ji.setValue(rt,"boneTexture",Tn.boneTexture,dt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}ee.isBatchedMesh&&(ji.setOptional(rt,ee,"batchingTexture"),ji.setValue(rt,"batchingTexture",ee._matricesTexture,dt));const zs=qt.morphAttributes;if((zs.position!==void 0||zs.normal!==void 0||zs.color!==void 0&&Et.isWebGL2===!0)&&Oe.update(ee,qt,un),(Gn||Se.receiveShadow!==ee.receiveShadow)&&(Se.receiveShadow=ee.receiveShadow,ji.setValue(rt,"receiveShadow",ee.receiveShadow)),ie.isMeshGouraudMaterial&&ie.envMap!==null&&(dr.envMap.value=$e,dr.flipEnvMap.value=$e.isCubeTexture&&$e.isRenderTargetTexture===!1?-1:1),Gn&&(ji.setValue(rt,"toneMappingExposure",d.toneMappingExposure),Se.needsLights&&oo(dr,pn),Te&&ie.fog===!0&&le.refreshFogUniforms(dr,Te),le.refreshMaterialUniforms(dr,ie,G,B,H),hm.upload(rt,_r(Se),dr,dt)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(hm.upload(rt,_r(Se),dr,dt),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&ji.setValue(rt,"center",ee.center),ji.setValue(rt,"modelViewMatrix",ee.modelViewMatrix),ji.setValue(rt,"normalMatrix",ee.normalMatrix),ji.setValue(rt,"modelMatrix",ee.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){const Tn=ie.uniformsGroups;for(let oa=0,Jn=Tn.length;oa0&&dt.useMultisampledRTT(Tt)===!1?ee=Vt.get(Tt).__webglMultisampledFramebuffer:Array.isArray(ii)?ee=ii[qt]:ee=ii,A.copy(Tt.viewport),P.copy(Tt.scissor),b=Tt.scissorTest}else A.copy(j).multiplyScalar(G).floor(),P.copy(Q).multiplyScalar(G).floor(),b=tt;if(At.bindFramebuffer(rt.FRAMEBUFFER,ee)&&Et.drawBuffers&&ie&&At.drawBuffers(Tt,ee),At.viewport(A),At.scissor(P),At.setScissorTest(b),Te){const $e=Vt.get(Tt.texture);rt.framebufferTexture2D(rt.FRAMEBUFFER,rt.COLOR_ATTACHMENT0,rt.TEXTURE_CUBE_MAP_POSITIVE_X+Kt,$e.__webglTexture,qt)}else if(Ue){const $e=Vt.get(Tt.texture),qe=Kt||0;rt.framebufferTextureLayer(rt.FRAMEBUFFER,rt.COLOR_ATTACHMENT0,$e.__webglTexture,qt||0,qe)}w=-1},this.readRenderTargetPixels=function(Tt,Kt,qt,ie,ee,Te,Ue){if(!(Tt&&Tt.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let We=Vt.get(Tt).__webglFramebuffer;if(Tt.isWebGLCubeRenderTarget&&Ue!==void 0&&(We=We[Ue]),We){At.bindFramebuffer(rt.FRAMEBUFFER,We);try{const $e=Tt.texture,qe=$e.format,ii=$e.type;if(qe!==ps&&ne.convert(qe)!==rt.getParameter(rt.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ai=ii===Zf&&(yt.has("EXT_color_buffer_half_float")||Et.isWebGL2&&yt.has("EXT_color_buffer_float"));if(ii!==zo&&ne.convert(ii)!==rt.getParameter(rt.IMPLEMENTATION_COLOR_READ_TYPE)&&!(ii===Ea&&(Et.isWebGL2||yt.has("OES_texture_float")||yt.has("WEBGL_color_buffer_float")))&&!ai){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Kt>=0&&Kt<=Tt.width-ie&&qt>=0&&qt<=Tt.height-ee&&rt.readPixels(Kt,qt,ie,ee,ne.convert(qe),ne.convert(ii),Te)}finally{const $e=M!==null?Vt.get(M).__webglFramebuffer:null;At.bindFramebuffer(rt.FRAMEBUFFER,$e)}}},this.copyFramebufferToTexture=function(Tt,Kt,qt=0){const ie=Math.pow(2,-qt),ee=Math.floor(Kt.image.width*ie),Te=Math.floor(Kt.image.height*ie);dt.setTexture2D(Kt,0),rt.copyTexSubImage2D(rt.TEXTURE_2D,qt,0,0,Tt.x,Tt.y,ee,Te),At.unbindTexture()},this.copyTextureToTexture=function(Tt,Kt,qt,ie=0){const ee=Kt.image.width,Te=Kt.image.height,Ue=ne.convert(qt.format),We=ne.convert(qt.type);dt.setTexture2D(qt,0),rt.pixelStorei(rt.UNPACK_FLIP_Y_WEBGL,qt.flipY),rt.pixelStorei(rt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,qt.premultiplyAlpha),rt.pixelStorei(rt.UNPACK_ALIGNMENT,qt.unpackAlignment),Kt.isDataTexture?rt.texSubImage2D(rt.TEXTURE_2D,ie,Tt.x,Tt.y,ee,Te,Ue,We,Kt.image.data):Kt.isCompressedTexture?rt.compressedTexSubImage2D(rt.TEXTURE_2D,ie,Tt.x,Tt.y,Kt.mipmaps[0].width,Kt.mipmaps[0].height,Ue,Kt.mipmaps[0].data):rt.texSubImage2D(rt.TEXTURE_2D,ie,Tt.x,Tt.y,Ue,We,Kt.image),ie===0&&qt.generateMipmaps&&rt.generateMipmap(rt.TEXTURE_2D),At.unbindTexture()},this.copyTextureToTexture3D=function(Tt,Kt,qt,ie,ee=0){if(d.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Te=Tt.max.x-Tt.min.x+1,Ue=Tt.max.y-Tt.min.y+1,We=Tt.max.z-Tt.min.z+1,$e=ne.convert(ie.format),qe=ne.convert(ie.type);let ii;if(ie.isData3DTexture)dt.setTexture3D(ie,0),ii=rt.TEXTURE_3D;else if(ie.isDataArrayTexture||ie.isCompressedArrayTexture)dt.setTexture2DArray(ie,0),ii=rt.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}rt.pixelStorei(rt.UNPACK_FLIP_Y_WEBGL,ie.flipY),rt.pixelStorei(rt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ie.premultiplyAlpha),rt.pixelStorei(rt.UNPACK_ALIGNMENT,ie.unpackAlignment);const ai=rt.getParameter(rt.UNPACK_ROW_LENGTH),Ji=rt.getParameter(rt.UNPACK_IMAGE_HEIGHT),hn=rt.getParameter(rt.UNPACK_SKIP_PIXELS),ki=rt.getParameter(rt.UNPACK_SKIP_ROWS),gn=rt.getParameter(rt.UNPACK_SKIP_IMAGES),ti=qt.isCompressedTexture?qt.mipmaps[ee]:qt.image;rt.pixelStorei(rt.UNPACK_ROW_LENGTH,ti.width),rt.pixelStorei(rt.UNPACK_IMAGE_HEIGHT,ti.height),rt.pixelStorei(rt.UNPACK_SKIP_PIXELS,Tt.min.x),rt.pixelStorei(rt.UNPACK_SKIP_ROWS,Tt.min.y),rt.pixelStorei(rt.UNPACK_SKIP_IMAGES,Tt.min.z),qt.isDataTexture||qt.isData3DTexture?rt.texSubImage3D(ii,ee,Kt.x,Kt.y,Kt.z,Te,Ue,We,$e,qe,ti.data):qt.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),rt.compressedTexSubImage3D(ii,ee,Kt.x,Kt.y,Kt.z,Te,Ue,We,$e,ti.data)):rt.texSubImage3D(ii,ee,Kt.x,Kt.y,Kt.z,Te,Ue,We,$e,qe,ti),rt.pixelStorei(rt.UNPACK_ROW_LENGTH,ai),rt.pixelStorei(rt.UNPACK_IMAGE_HEIGHT,Ji),rt.pixelStorei(rt.UNPACK_SKIP_PIXELS,hn),rt.pixelStorei(rt.UNPACK_SKIP_ROWS,ki),rt.pixelStorei(rt.UNPACK_SKIP_IMAGES,gn),ee===0&&ie.generateMipmaps&&rt.generateMipmap(ii),At.unbindTexture()},this.initTexture=function(Tt){Tt.isCubeTexture?dt.setTextureCube(Tt,0):Tt.isData3DTexture?dt.setTexture3D(Tt,0):Tt.isDataArrayTexture||Tt.isCompressedArrayTexture?dt.setTexture2DArray(Tt,0):dt.setTexture2D(Tt,0),At.unbindTexture()},this.resetState=function(){m=0,S=0,M=null,At.reset(),je.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return No}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const i=this.getContext();i.drawingBufferColorSpace=t===hg?"display-p3":"srgb",i.unpackColorSpace=rn.workingColorSpace===$d?"display-p3":"srgb"}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===vr?ch:c1}set outputEncoding(t){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=t===ch?vr:Vo}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}}class Pw extends M1{}Pw.prototype.isWebGL1Renderer=!0;class cg{constructor(t,i=25e-5){this.isFogExp2=!0,this.name="",this.color=new ze(t),this.density=i}clone(){return new cg(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class dg{constructor(t,i=1,x=1e3){this.isFog=!0,this.name="",this.color=new ze(t),this.near=i,this.far=x}clone(){return new dg(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Mm extends Yi{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,i){return super.copy(t,i),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const i=super.toJSON(t);return this.fog!==null&&(i.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(i.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(i.object.backgroundIntensity=this.backgroundIntensity),i}}class pg{constructor(t,i){this.isInterleavedBuffer=!0,this.array=t,this.stride=i,this.count=t!==void 0?t.length/i:0,this.usage=Od,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=na()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return xu("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,i){this.updateRanges.push({start:t,count:i})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,i,x){t*=this.stride,x*=i.stride;for(let T=0,E=this.stride;Tt.far||i.push({distance:e,point:jc.clone(),uv:ia.getInterpolation(jc,Mv,Zc,Cv,uE,Y0,fE,new ve),face:null,object:this})}copy(t,i){return super.copy(t,i),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}}function wv(g,t,i,x,T,E){wf.subVectors(g,i).addScalar(.5).multiply(x),T!==void 0?(Kc.x=E*wf.x-T*wf.y,Kc.y=T*wf.x+E*wf.y):Kc.copy(wf),g.copy(t),g.x+=Kc.x,g.y+=Kc.y,g.applyMatrix4(Rw)}const Av=new Ct,cE=new Ct;class Lw extends Yi{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const i=t.levels;for(let x=0,T=i.length;x0){let x,T;for(x=1,T=i.length;x0){Av.setFromMatrixPosition(this.matrixWorld);const T=t.ray.origin.distanceTo(Av);this.getObjectForDistance(T).raycast(t,i)}}update(t){const i=this.levels;if(i.length>1){Av.setFromMatrixPosition(t.matrixWorld),cE.setFromMatrixPosition(this.matrixWorld);const x=Av.distanceTo(cE)/t.zoom;i[0].object.visible=!0;let T,E;for(T=1,E=i.length;T=s)i[T-1].object.visible=!1,i[T].object.visible=!0;else break}for(this._currentLevel=T-1;T=x.length&&x.push({start:-1,count:-1,z:-1});const E=x[this.index];T.push(E),this.index++,E.start=t.start,E.count=t.count,E.z=i}reset(){this.list.length=0,this.index=0}}const Pf="batchId",rh=new ci,TE=new ci,tU=new ci,EE=new ci,K0=new qd,bv=new gs,qh=new $r,Qc=new Ct,Z0=new q6,Kr=new cr,Lv=[];function eU(g,t,i=0){const x=t.itemSize;if(g.isInterleavedBufferAttribute||g.array.constructor!==t.array.constructor){const T=g.count;for(let E=0;E65536?new Uint32Array(E):new Uint16Array(E);i.setIndex(new an(y,1))}const s=T>65536?new Uint32Array(x):new Uint16Array(x);i.setAttribute(Pf,new an(s,1)),this._geometryInitialized=!0}}_validateGeometry(t){if(t.getAttribute(Pf))throw new Error(`BatchedMesh: Geometry cannot use attribute "${Pf}"`);const i=this.geometry;if(!!t.getIndex()!=!!i.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const x in i.attributes){if(x===Pf)continue;if(!t.hasAttribute(x))throw new Error(`BatchedMesh: Added geometry missing "${x}". All geometries must have consistent attributes.`);const T=t.getAttribute(x),E=i.getAttribute(x);if(T.itemSize!==E.itemSize||T.normalized!==E.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new gs);const t=this._geometryCount,i=this.boundingBox,x=this._active;i.makeEmpty();for(let T=0;T=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const T={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let E=null;const s=this._reservedRanges,y=this._drawRanges,e=this._bounds;this._geometryCount!==0&&(E=s[s.length-1]),i===-1?T.vertexCount=t.getAttribute("position").count:T.vertexCount=i,E===null?T.vertexStart=0:T.vertexStart=E.vertexStart+E.vertexCount;const r=t.getIndex(),p=r!==null;if(p&&(x===-1?T.indexCount=r.count:T.indexCount=x,E===null?T.indexStart=0:T.indexStart=E.indexStart+E.indexCount),T.indexStart!==-1&&T.indexStart+T.indexCount>this._maxIndexCount||T.vertexStart+T.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._visibility,a=this._active,l=this._matricesTexture,n=this._matricesTexture.image.data;h.push(!0),a.push(!0);const u=this._geometryCount;this._geometryCount++,tU.toArray(n,u*16),l.needsUpdate=!0,s.push(T),y.push({start:p?T.indexStart:T.vertexStart,count:-1}),e.push({boxInitialized:!1,box:new gs,sphereInitialized:!1,sphere:new $r});const f=this.geometry.getAttribute(Pf);for(let o=0;o=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(i);const x=this.geometry,T=x.getIndex()!==null,E=x.getIndex(),s=i.getIndex(),y=this._reservedRanges[t];if(T&&s.count>y.indexCount||i.attributes.position.count>y.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const e=y.vertexStart,r=y.vertexCount;for(const l in x.attributes){if(l===Pf)continue;const n=i.getAttribute(l),u=x.getAttribute(l);eU(n,u,e);const f=n.itemSize;for(let o=n.count,c=r;o=i.length||i[t]===!1?this:(i[t]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(t,i){if(this._active[t]===!1)return null;const T=this._bounds[t],E=T.box,s=this.geometry;if(T.boxInitialized===!1){E.makeEmpty();const y=s.index,e=s.attributes.position,r=this._drawRanges[t];for(let p=r.start,h=r.start+r.count;p=s||x[t]===!1?this:(i.toArray(E,t*16),T.needsUpdate=!0,this)}getMatrixAt(t,i){const x=this._active,T=this._matricesTexture.image.data,E=this._geometryCount;return t>=E||x[t]===!1?null:i.fromArray(T,t*16)}setVisibleAt(t,i){const x=this._visibility,T=this._active,E=this._geometryCount;return t>=E||T[t]===!1||x[t]===i?this:(x[t]=i,this._visibilityChanged=!0,this)}getVisibleAt(t){const i=this._visibility,x=this._active,T=this._geometryCount;return t>=T||x[t]===!1?!1:i[t]}raycast(t,i){const x=this._visibility,T=this._active,E=this._drawRanges,s=this._geometryCount,y=this.matrixWorld,e=this.geometry;Kr.material=this.material,Kr.geometry.index=e.index,Kr.geometry.attributes=e.attributes,Kr.geometry.boundingBox===null&&(Kr.geometry.boundingBox=new gs),Kr.geometry.boundingSphere===null&&(Kr.geometry.boundingSphere=new $r);for(let r=0;r({...i})),this._reservedRanges=t._reservedRanges.map(i=>({...i})),this._visibility=t._visibility.slice(),this._active=t._active.slice(),this._bounds=t._bounds.map(i=>({boxInitialized:i.boxInitialized,box:i.box.clone(),sphereInitialized:i.sphereInitialized,sphere:i.sphere.clone()})),this._maxGeometryCount=t._maxGeometryCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._geometryCount=t._geometryCount,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(t,i,x,T,E){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const s=T.getIndex(),y=s===null?1:s.array.BYTES_PER_ELEMENT,e=this._active,r=this._visibility,p=this._multiDrawStarts,h=this._multiDrawCounts,a=this._drawRanges,l=this.perObjectFrustumCulled;l&&(EE.multiplyMatrices(x.projectionMatrix,x.matrixWorldInverse).multiply(this.matrixWorld),K0.setFromProjectionMatrix(EE,t.coordinateSystem));let n=0;if(this.sortObjects){TE.copy(this.matrixWorld).invert(),Qc.setFromMatrixPosition(x.matrixWorld).applyMatrix4(TE);for(let o=0,c=r.length;oe)continue;a.applyMatrix4(this.matrixWorld);const w=t.ray.origin.distanceTo(a);wt.far||i.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this})}}else{const o=Math.max(0,s.start),c=Math.min(f.count,s.start+s.count);for(let d=o,v=c-1;de)continue;a.applyMatrix4(this.matrixWorld);const S=t.ray.origin.distanceTo(a);St.far||i.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:d,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const i=this.geometry.morphAttributes,x=Object.keys(i);if(x.length>0){const T=i[x[0]];if(T!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let E=0,s=T.length;E0){const T=i[x[0]];if(T!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let E=0,s=T.length;ET.far)return;E.push({distance:r,distanceToRay:Math.sqrt(y),point:e,index:t,face:null,object:s})}}class iU extends Un{constructor(t,i,x,T,E,s,y,e,r){super(t,i,x,T,E,s,y,e,r),this.isVideoTexture=!0,this.minFilter=s!==void 0?s:Nn,this.magFilter=E!==void 0?E:Nn,this.generateMipmaps=!1;const p=this;function h(){p.needsUpdate=!0,t.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;"requestVideoFrameCallback"in t===!1&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class nU extends Un{constructor(t,i){super({width:t,height:i}),this.isFramebufferTexture=!0,this.magFilter=nr,this.minFilter=nr,this.generateMipmaps=!1,this.needsUpdate=!0}}class mg extends Un{constructor(t,i,x,T,E,s,y,e,r,p,h,a){super(null,s,y,e,r,p,T,E,h,a),this.isCompressedTexture=!0,this.image={width:i,height:x},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class rU extends mg{constructor(t,i,x,T,E,s){super(t,i,x,E,s),this.isCompressedArrayTexture=!0,this.image.depth=T,this.wrapR=Jr}}class sU extends mg{constructor(t,i,x){super(void 0,t[0].width,t[0].height,i,x,wl),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class aU extends Un{constructor(t,i,x,T,E,s,y,e,r){super(t,i,x,T,E,s,y,e,r),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ro{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,i){const x=this.getUtoTmapping(t);return this.getPoint(x,i)}getPoints(t=5){const i=[];for(let x=0;x<=t;x++)i.push(this.getPoint(x/t));return i}getSpacedPoints(t=5){const i=[];for(let x=0;x<=t;x++)i.push(this.getPointAt(x/t));return i}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const i=[];let x,T=this.getPoint(0),E=0;i.push(0);for(let s=1;s<=t;s++)x=this.getPoint(s/t),E+=x.distanceTo(T),i.push(E),T=x;return this.cacheArcLengths=i,i}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,i){const x=this.getLengths();let T=0;const E=x.length;let s;i?s=i:s=t*x[E-1];let y=0,e=E-1,r;for(;y<=e;)if(T=Math.floor(y+(e-y)/2),r=x[T]-s,r<0)y=T+1;else if(r>0)e=T-1;else{e=T;break}if(T=e,x[T]===s)return T/(E-1);const p=x[T],a=x[T+1]-p,l=(s-p)/a;return(T+l)/(E-1)}getTangent(t,i){let T=t-1e-4,E=t+1e-4;T<0&&(T=0),E>1&&(E=1);const s=this.getPoint(T),y=this.getPoint(E),e=i||(s.isVector2?new ve:new Ct);return e.copy(y).sub(s).normalize(),e}getTangentAt(t,i){const x=this.getUtoTmapping(t);return this.getTangent(x,i)}computeFrenetFrames(t,i){const x=new Ct,T=[],E=[],s=[],y=new Ct,e=new ci;for(let l=0;l<=t;l++){const n=l/t;T[l]=this.getTangentAt(n,new Ct)}E[0]=new Ct,s[0]=new Ct;let r=Number.MAX_VALUE;const p=Math.abs(T[0].x),h=Math.abs(T[0].y),a=Math.abs(T[0].z);p<=r&&(r=p,x.set(1,0,0)),h<=r&&(r=h,x.set(0,1,0)),a<=r&&x.set(0,0,1),y.crossVectors(T[0],x).normalize(),E[0].crossVectors(T[0],y),s[0].crossVectors(T[0],E[0]);for(let l=1;l<=t;l++){if(E[l]=E[l-1].clone(),s[l]=s[l-1].clone(),y.crossVectors(T[l-1],T[l]),y.length()>Number.EPSILON){y.normalize();const n=Math.acos(Kn(T[l-1].dot(T[l]),-1,1));E[l].applyMatrix4(e.makeRotationAxis(y,n))}s[l].crossVectors(T[l],E[l])}if(i===!0){let l=Math.acos(Kn(E[0].dot(E[t]),-1,1));l/=t,T[0].dot(y.crossVectors(E[0],E[t]))>0&&(l=-l);for(let n=1;n<=t;n++)E[n].applyMatrix4(e.makeRotationAxis(T[n],l*n)),s[n].crossVectors(T[n],E[n])}return{tangents:T,normals:E,binormals:s}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class gg extends ro{constructor(t=0,i=0,x=1,T=1,E=0,s=Math.PI*2,y=!1,e=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=i,this.xRadius=x,this.yRadius=T,this.aStartAngle=E,this.aEndAngle=s,this.aClockwise=y,this.aRotation=e}getPoint(t,i){const x=i||new ve,T=Math.PI*2;let E=this.aEndAngle-this.aStartAngle;const s=Math.abs(E)T;)E-=T;E0?0:(Math.floor(Math.abs(y)/E)+1)*E:e===0&&y===E-1&&(y=E-2,e=1);let r,p;this.closed||y>0?r=T[(y-1)%E]:(Iv.subVectors(T[0],T[1]).add(T[0]),r=Iv);const h=T[y%E],a=T[(y+1)%E];if(this.closed||y+2T.length-2?T.length-1:s+1],h=T[s>T.length-3?T.length-1:s+2];return x.set(LE(y,e.x,r.x,p.x,h.x),LE(y,e.y,r.y,p.y,h.y)),x}copy(t){super.copy(t),this.points=[];for(let i=0,x=t.points.length;i=x){const s=T[E]-x,y=this.curves[E],e=y.getLength(),r=e===0?0:1-s/e;return y.getPointAt(r,i)}E++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let i=0;for(let x=0,T=this.curves.length;x1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let i=0,x=t.curves.length;i0){const h=r.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(r);const p=r.getPoint(1);return this.currentPoint.copy(p),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class ep extends Li{constructor(t=[new ve(0,-.5),new ve(.5,0),new ve(0,.5)],i=12,x=0,T=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:t,segments:i,phiStart:x,phiLength:T},i=Math.floor(i),T=Kn(T,0,Math.PI*2);const E=[],s=[],y=[],e=[],r=[],p=1/i,h=new Ct,a=new ve,l=new Ct,n=new Ct,u=new Ct;let f=0,o=0;for(let c=0;c<=t.length-1;c++)switch(c){case 0:f=t[c+1].x-t[c].x,o=t[c+1].y-t[c].y,l.x=o*1,l.y=-f,l.z=o*0,u.copy(l),l.normalize(),e.push(l.x,l.y,l.z);break;case t.length-1:e.push(u.x,u.y,u.z);break;default:f=t[c+1].x-t[c].x,o=t[c+1].y-t[c].y,l.x=o*1,l.y=-f,l.z=o*0,n.copy(l),l.x+=u.x,l.y+=u.y,l.z+=u.z,l.normalize(),e.push(l.x,l.y,l.z),u.copy(n)}for(let c=0;c<=i;c++){const d=x+c*p*T,v=Math.sin(d),m=Math.cos(d);for(let S=0;S<=t.length-1;S++){h.x=t[S].x*v,h.y=t[S].y,h.z=t[S].x*m,s.push(h.x,h.y,h.z),a.x=c/i,a.y=S/(t.length-1),y.push(a.x,a.y);const M=e[3*S+0]*v,w=e[3*S+1],C=e[3*S+0]*m;r.push(M,w,C)}}for(let c=0;c0&&d(!0),i>0&&d(!1)),this.setIndex(p),this.setAttribute("position",new ke(h,3)),this.setAttribute("normal",new ke(a,3)),this.setAttribute("uv",new ke(l,2));function c(){const v=new Ct,m=new Ct;let S=0;const M=(i-t)/x;for(let w=0;w<=E;w++){const C=[],A=w/E,P=A*(i-t)+t;for(let b=0;b<=T;b++){const O=b/T,I=O*e+y,D=Math.sin(I),B=Math.cos(I);m.x=P*D,m.y=-A*x+f,m.z=P*B,h.push(m.x,m.y,m.z),v.set(D,M,B).normalize(),a.push(v.x,v.y,v.z),l.push(O,1-A),C.push(n++)}u.push(C)}for(let w=0;w.9&&M<.1&&(d<.2&&(s[c+0]+=1),v<.2&&(s[c+2]+=1),m<.2&&(s[c+4]+=1))}}function a(c){E.push(c.x,c.y,c.z)}function l(c,d){const v=c*3;d.x=t[v+0],d.y=t[v+1],d.z=t[v+2]}function n(){const c=new Ct,d=new Ct,v=new Ct,m=new Ct,S=new ve,M=new ve,w=new ve;for(let C=0,A=0;C80*i){y=r=g[0],e=p=g[1];for(let n=i;nr&&(r=h),a>p&&(p=a);l=Math.max(r-y,p-e),l=l!==0?32767/l:0}return Bd(E,s,i,y,e,l,0),s}};function Ww(g,t,i,x,T){let E,s;if(T===LU(g,t,i,x)>0)for(E=t;E=t;E-=x)s=FE(E,g[E],g[E+1],s);return s&&Eg(s,s.next)&&(zd(s),s=s.next),s}function Ru(g,t){if(!g)return g;t||(t=g);let i=g,x;do if(x=!1,!i.steiner&&(Eg(i,i.next)||Bn(i.prev,i,i.next)===0)){if(zd(i),i=t=i.prev,i===i.next)break;x=!0}else i=i.next;while(x||i!==t);return t}function Bd(g,t,i,x,T,E,s){if(!g)return;!s&&E&&CU(g,x,T,E);let y=g,e,r;for(;g.prev!==g.next;){if(e=g.prev,r=g.next,E?mU(g,x,T,E):vU(g)){t.push(e.i/i|0),t.push(g.i/i|0),t.push(r.i/i|0),zd(g),g=r.next,y=r.next;continue}if(g=r,g===y){s?s===1?(g=gU(Ru(g),t,i),Bd(g,t,i,x,T,E,2)):s===2&&yU(g,t,i,x,T,E):Bd(Ru(g),t,i,x,T,E,1);break}}}function vU(g){const t=g.prev,i=g,x=g.next;if(Bn(t,i,x)>=0)return!1;const T=t.x,E=i.x,s=x.x,y=t.y,e=i.y,r=x.y,p=TE?T>s?T:s:E>s?E:s,l=y>e?y>r?y:r:e>r?e:r;let n=x.next;for(;n!==t;){if(n.x>=p&&n.x<=a&&n.y>=h&&n.y<=l&&Vf(T,y,E,e,s,r,n.x,n.y)&&Bn(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function mU(g,t,i,x){const T=g.prev,E=g,s=g.next;if(Bn(T,E,s)>=0)return!1;const y=T.x,e=E.x,r=s.x,p=T.y,h=E.y,a=s.y,l=ye?y>r?y:r:e>r?e:r,f=p>h?p>a?p:a:h>a?h:a,o=xx(l,n,t,i,x),c=xx(u,f,t,i,x);let d=g.prevZ,v=g.nextZ;for(;d&&d.z>=o&&v&&v.z<=c;){if(d.x>=l&&d.x<=u&&d.y>=n&&d.y<=f&&d!==T&&d!==s&&Vf(y,p,e,h,r,a,d.x,d.y)&&Bn(d.prev,d,d.next)>=0||(d=d.prevZ,v.x>=l&&v.x<=u&&v.y>=n&&v.y<=f&&v!==T&&v!==s&&Vf(y,p,e,h,r,a,v.x,v.y)&&Bn(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;d&&d.z>=o;){if(d.x>=l&&d.x<=u&&d.y>=n&&d.y<=f&&d!==T&&d!==s&&Vf(y,p,e,h,r,a,d.x,d.y)&&Bn(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;v&&v.z<=c;){if(v.x>=l&&v.x<=u&&v.y>=n&&v.y<=f&&v!==T&&v!==s&&Vf(y,p,e,h,r,a,v.x,v.y)&&Bn(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function gU(g,t,i){let x=g;do{const T=x.prev,E=x.next.next;!Eg(T,E)&&Xw(T,x,x.next,E)&&Ud(T,E)&&Ud(E,T)&&(t.push(T.i/i|0),t.push(x.i/i|0),t.push(E.i/i|0),zd(x),zd(x.next),x=g=E),x=x.next}while(x!==g);return Ru(x)}function yU(g,t,i,x,T,E){let s=g;do{let y=s.next.next;for(;y!==s.prev;){if(s.i!==y.i&&PU(s,y)){let e=Yw(s,y);s=Ru(s,s.next),e=Ru(e,e.next),Bd(s,t,i,x,T,E,0),Bd(e,t,i,x,T,E,0);return}y=y.next}s=s.next}while(s!==g)}function xU(g,t,i,x){const T=[];let E,s,y,e,r;for(E=0,s=t.length;E=i.next.y&&i.next.y!==i.y){const a=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=E&&a>x&&(x=a,T=i.x=i.x&&i.x>=e&&E!==i.x&&Vf(sT.x||i.x===T.x&&MU(T,i)))&&(T=i,p=h)),i=i.next;while(i!==y);return T}function MU(g,t){return Bn(g.prev,g,t.prev)<0&&Bn(t.next,g,g.next)<0}function CU(g,t,i,x){let T=g;do T.z===0&&(T.z=xx(T.x,T.y,t,i,x)),T.prevZ=T.prev,T.nextZ=T.next,T=T.next;while(T!==g);T.prevZ.nextZ=null,T.prevZ=null,wU(T)}function wU(g){let t,i,x,T,E,s,y,e,r=1;do{for(i=g,g=null,E=null,s=0;i;){for(s++,x=i,y=0,t=0;t0||e>0&&x;)y!==0&&(e===0||!x||i.z<=x.z)?(T=i,i=i.nextZ,y--):(T=x,x=x.nextZ,e--),E?E.nextZ=T:g=T,T.prevZ=E,E=T;i=x}E.nextZ=null,r*=2}while(s>1);return g}function xx(g,t,i,x,T){return g=(g-i)*T|0,t=(t-x)*T|0,g=(g|g<<8)&16711935,g=(g|g<<4)&252645135,g=(g|g<<2)&858993459,g=(g|g<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,g|t<<1}function AU(g){let t=g,i=g;do(t.x=(g-s)*(E-y)&&(g-s)*(x-y)>=(i-s)*(t-y)&&(i-s)*(E-y)>=(T-s)*(x-y)}function PU(g,t){return g.next.i!==t.i&&g.prev.i!==t.i&&!RU(g,t)&&(Ud(g,t)&&Ud(t,g)&&bU(g,t)&&(Bn(g.prev,g,t.prev)||Bn(g,t.prev,t))||Eg(g,t)&&Bn(g.prev,g,g.next)>0&&Bn(t.prev,t,t.next)>0)}function Bn(g,t,i){return(t.y-g.y)*(i.x-t.x)-(t.x-g.x)*(i.y-t.y)}function Eg(g,t){return g.x===t.x&&g.y===t.y}function Xw(g,t,i,x){const T=Gv(Bn(g,t,i)),E=Gv(Bn(g,t,x)),s=Gv(Bn(i,x,g)),y=Gv(Bn(i,x,t));return!!(T!==E&&s!==y||T===0&&zv(g,i,t)||E===0&&zv(g,x,t)||s===0&&zv(i,g,x)||y===0&&zv(i,t,x))}function zv(g,t,i){return t.x<=Math.max(g.x,i.x)&&t.x>=Math.min(g.x,i.x)&&t.y<=Math.max(g.y,i.y)&&t.y>=Math.min(g.y,i.y)}function Gv(g){return g>0?1:g<0?-1:0}function RU(g,t){let i=g;do{if(i.i!==g.i&&i.next.i!==g.i&&i.i!==t.i&&i.next.i!==t.i&&Xw(i,i.next,g,t))return!0;i=i.next}while(i!==g);return!1}function Ud(g,t){return Bn(g.prev,g,g.next)<0?Bn(g,t,g.next)>=0&&Bn(g,g.prev,t)>=0:Bn(g,t,g.prev)<0||Bn(g,g.next,t)<0}function bU(g,t){let i=g,x=!1;const T=(g.x+t.x)/2,E=(g.y+t.y)/2;do i.y>E!=i.next.y>E&&i.next.y!==i.y&&T<(i.next.x-i.x)*(E-i.y)/(i.next.y-i.y)+i.x&&(x=!x),i=i.next;while(i!==g);return x}function Yw(g,t){const i=new Sx(g.i,g.x,g.y),x=new Sx(t.i,t.x,t.y),T=g.next,E=t.prev;return g.next=t,t.prev=g,i.next=T,T.prev=i,x.next=i,i.prev=x,E.next=x,x.prev=E,x}function FE(g,t,i,x){const T=new Sx(g,t,i);return x?(T.next=x.next,T.prev=x,x.next.prev=T,x.next=T):(T.prev=T,T.next=T),T}function zd(g){g.next.prev=g.prev,g.prev.next=g.next,g.prevZ&&(g.prevZ.nextZ=g.nextZ),g.nextZ&&(g.nextZ.prevZ=g.prevZ)}function Sx(g,t,i){this.i=g,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function LU(g,t,i,x){let T=0;for(let E=t,s=i-x;E2&&g[t-1].equals(g[0])&&g.pop()}function DE(g,t){for(let i=0;iNumber.EPSILON){const Bt=Math.sqrt(Dt),re=Math.sqrt(ut*ut+Rt*Rt),le=gt.x-dt/Bt,ge=gt.y+Vt/Bt,xe=yt.x-Rt/re,Pe=yt.y+ut/re,te=((xe-le)*Rt-(Pe-ge)*ut)/(Vt*Rt-dt*ut);Et=le+Vt*te-rt.x,At=ge+dt*te-rt.y;const Ge=Et*Et+At*At;if(Ge<=2)return new ve(Et,At);Pt=Math.sqrt(Ge/2)}else{let Bt=!1;Vt>Number.EPSILON?ut>Number.EPSILON&&(Bt=!0):Vt<-Number.EPSILON?ut<-Number.EPSILON&&(Bt=!0):Math.sign(dt)===Math.sign(Rt)&&(Bt=!0),Bt?(Et=-dt,At=Vt,Pt=Math.sqrt(Dt)):(Et=Vt,At=dt,Pt=Math.sqrt(Dt/2))}return new ve(Et/Pt,At/Pt)}const X=[];for(let rt=0,gt=I.length,yt=gt-1,Et=rt+1;rt=0;rt--){const gt=rt/f,yt=l*Math.cos(gt*Math.PI/2),Et=n*Math.sin(gt*Math.PI/2)+u;for(let At=0,Pt=I.length;At=0;){const Et=yt;let At=yt-1;At<0&&(At=rt.length-1);for(let Pt=0,Vt=p+f*2;Pt0)&&l.push(d,v,S),(o!==x-1||e0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class Jw extends Hr{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ze(16777215),this.specular=new ze(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yh,this.normalScale=new ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Jd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class $w extends Hr{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ze(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yh,this.normalScale=new ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class Qw extends Hr{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yh,this.normalScale=new ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class _w extends Hr{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ze(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yh,this.normalScale=new ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Jd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class qw extends Hr{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ze(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=yh,this.normalScale=new ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class tA extends ys{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function mu(g,t,i){return!g||!i&&g.constructor===t?g:typeof t.BYTES_PER_ELEMENT=="number"?new t(g):Array.prototype.slice.call(g)}function eA(g){return ArrayBuffer.isView(g)&&!(g instanceof DataView)}function iA(g){function t(T,E){return g[T]-g[E]}const i=g.length,x=new Array(i);for(let T=0;T!==i;++T)x[T]=T;return x.sort(t),x}function Tx(g,t,i){const x=g.length,T=new g.constructor(x);for(let E=0,s=0;s!==x;++E){const y=i[E]*t;for(let e=0;e!==t;++e)T[s++]=g[y+e]}return T}function D1(g,t,i,x){let T=1,E=g[0];for(;E!==void 0&&E[x]===void 0;)E=g[T++];if(E===void 0)return;let s=E[x];if(s!==void 0)if(Array.isArray(s))do s=E[x],s!==void 0&&(t.push(E.time),i.push.apply(i,s)),E=g[T++];while(E!==void 0);else if(s.toArray!==void 0)do s=E[x],s!==void 0&&(t.push(E.time),s.toArray(i,i.length)),E=g[T++];while(E!==void 0);else do s=E[x],s!==void 0&&(t.push(E.time),i.push(s)),E=g[T++];while(E!==void 0)}function IU(g,t,i,x,T=30){const E=g.clone();E.name=t;const s=[];for(let e=0;e=x)){h.push(r.times[l]);for(let u=0;uE.tracks[e].times[0]&&(y=E.tracks[e].times[0]);for(let e=0;e=y.times[n]){const o=n*h+p,c=o+h-p;u=y.values.slice(o,c)}else{const o=y.createInterpolant(),c=p,d=h-p;o.evaluate(E),u=o.resultBuffer.slice(c,d)}e==="quaternion"&&new Ds().fromArray(u).normalize().conjugate().toArray(u);const f=r.times.length;for(let o=0;o=E)){const y=i[1];t=E)break e}s=x,x=0;break i}break t}for(;x>>1;ti;)--s;if(++s,E!==0||s!==T){E>=s&&(s=Math.max(s,1),E=s-1);const y=this.getValueSize();this.times=x.slice(E,s),this.values=this.values.slice(E*y,s*y)}return this}validate(){let t=!0;const i=this.getValueSize();i-Math.floor(i)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const x=this.times,T=this.values,E=x.length;E===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let y=0;y!==E;y++){const e=x[y];if(typeof e=="number"&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,y,e),t=!1;break}if(s!==null&&s>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,y,e,s),t=!1;break}s=e}if(T!==void 0&&eA(T))for(let y=0,e=T.length;y!==e;++y){const r=T[y];if(isNaN(r)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,y,r),t=!1;break}}return t}optimize(){const t=this.times.slice(),i=this.values.slice(),x=this.getValueSize(),T=this.getInterpolation()===om,E=t.length-1;let s=1;for(let y=1;y0){t[s]=t[E];for(let y=E*x,e=s*x,r=0;r!==x;++r)i[e+r]=i[y+r];++s}return s!==t.length?(this.times=t.slice(0,s),this.values=i.slice(0,s*x)):(this.times=t,this.values=i),this}clone(){const t=this.times.slice(),i=this.values.slice(),x=this.constructor,T=new x(this.name,t,i);return T.createInterpolant=this.createInterpolant,T}}so.prototype.TimeBufferType=Float32Array;so.prototype.ValueBufferType=Float32Array;so.prototype.DefaultInterpolation=Pd;class Ou extends so{}Ou.prototype.ValueTypeName="bool";Ou.prototype.ValueBufferType=Array;Ou.prototype.DefaultInterpolation=Ad;Ou.prototype.InterpolantFactoryMethodLinear=void 0;Ou.prototype.InterpolantFactoryMethodSmooth=void 0;class N1 extends so{}N1.prototype.ValueTypeName="color";class Gd extends so{}Gd.prototype.ValueTypeName="number";class sA extends rp{constructor(t,i,x,T){super(t,i,x,T)}interpolate_(t,i,x,T){const E=this.resultBuffer,s=this.sampleValues,y=this.valueSize,e=(x-i)/(T-i);let r=t*y;for(let p=r+y;r!==p;r+=4)Ds.slerpFlat(E,0,s,r-y,s,r,e);return E}}class ac extends so{InterpolantFactoryMethodLinear(t){return new sA(this.times,this.values,this.getValueSize(),t)}}ac.prototype.ValueTypeName="quaternion";ac.prototype.DefaultInterpolation=Pd;ac.prototype.InterpolantFactoryMethodSmooth=void 0;class Du extends so{}Du.prototype.ValueTypeName="string";Du.prototype.ValueBufferType=Array;Du.prototype.DefaultInterpolation=Ad;Du.prototype.InterpolantFactoryMethodLinear=void 0;Du.prototype.InterpolantFactoryMethodSmooth=void 0;class Vd extends so{}Vd.prototype.ValueTypeName="vector";class Hd{constructor(t,i=-1,x,T=lg){this.name=t,this.tracks=x,this.duration=i,this.blendMode=T,this.uuid=na(),this.duration<0&&this.resetDuration()}static parse(t){const i=[],x=t.tracks,T=1/(t.fps||1);for(let s=0,y=x.length;s!==y;++s)i.push(zU(x[s]).scale(T));const E=new this(t.name,t.duration,i,t.blendMode);return E.uuid=t.uuid,E}static toJSON(t){const i=[],x=t.tracks,T={name:t.name,duration:t.duration,tracks:i,uuid:t.uuid,blendMode:t.blendMode};for(let E=0,s=x.length;E!==s;++E)i.push(so.toJSON(x[E]));return T}static CreateFromMorphTargetSequence(t,i,x,T){const E=i.length,s=[];for(let y=0;y1){const h=p[1];let a=T[h];a||(T[h]=a=[]),a.push(r)}}const s=[];for(const y in T)s.push(this.CreateFromMorphTargetSequence(y,T[y],i,x));return s}static parseAnimation(t,i){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const x=function(h,a,l,n,u){if(l.length!==0){const f=[],o=[];D1(l,f,o,n),f.length!==0&&u.push(new h(a,f,o))}},T=[],E=t.name||"default",s=t.fps||30,y=t.blendMode;let e=t.length||-1;const r=t.hierarchy||[];for(let h=0;h{i&&i(E),this.manager.itemEnd(t)},0),E;if(vl[t]!==void 0){vl[t].push({onLoad:i,onProgress:x,onError:T});return}vl[t]=[],vl[t].push({onLoad:i,onProgress:x,onError:T});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),y=this.mimeType,e=this.responseType;fetch(s).then(r=>{if(r.status===200||r.status===0){if(r.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||r.body===void 0||r.body.getReader===void 0)return r;const p=vl[t],h=r.body.getReader(),a=r.headers.get("Content-Length")||r.headers.get("X-File-Size"),l=a?parseInt(a):0,n=l!==0;let u=0;const f=new ReadableStream({start(o){c();function c(){h.read().then(({done:d,value:v})=>{if(d)o.close();else{u+=v.byteLength;const m=new ProgressEvent("progress",{lengthComputable:n,loaded:u,total:l});for(let S=0,M=p.length;S{switch(e){case"arraybuffer":return r.arrayBuffer();case"blob":return r.blob();case"document":return r.text().then(p=>new DOMParser().parseFromString(p,y));case"json":return r.json();default:if(y===void 0)return r.text();{const h=/charset="?([^;"\s]*)"?/i.exec(y),a=h&&h[1]?h[1].toLowerCase():void 0,l=new TextDecoder(a);return r.arrayBuffer().then(n=>l.decode(n))}}}).then(r=>{Tl.add(t,r);const p=vl[t];delete vl[t];for(let h=0,a=p.length;h{const p=vl[t];if(p===void 0)throw this.manager.itemError(t),r;delete vl[t];for(let h=0,a=p.length;h{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class VU extends Ns{constructor(t){super(t)}load(t,i,x,T){const E=this,s=new Al(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,function(y){try{i(E.parse(JSON.parse(y)))}catch(e){T?T(e):console.error(e),E.manager.itemError(t)}},x,T)}parse(t){const i=[];for(let x=0;x0:T.vertexColors=t.vertexColors),t.uniforms!==void 0)for(const E in t.uniforms){const s=t.uniforms[E];switch(T.uniforms[E]={},s.type){case"t":T.uniforms[E].value=x(s.value);break;case"c":T.uniforms[E].value=new ze().setHex(s.value);break;case"v2":T.uniforms[E].value=new ve().fromArray(s.value);break;case"v3":T.uniforms[E].value=new Ct().fromArray(s.value);break;case"v4":T.uniforms[E].value=new sn().fromArray(s.value);break;case"m3":T.uniforms[E].value=new Oi().fromArray(s.value);break;case"m4":T.uniforms[E].value=new ci().fromArray(s.value);break;default:T.uniforms[E].value=s.value}}if(t.defines!==void 0&&(T.defines=t.defines),t.vertexShader!==void 0&&(T.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(T.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(T.glslVersion=t.glslVersion),t.extensions!==void 0)for(const E in t.extensions)T.extensions[E]=t.extensions[E];if(t.lights!==void 0&&(T.lights=t.lights),t.clipping!==void 0&&(T.clipping=t.clipping),t.size!==void 0&&(T.size=t.size),t.sizeAttenuation!==void 0&&(T.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(T.map=x(t.map)),t.matcap!==void 0&&(T.matcap=x(t.matcap)),t.alphaMap!==void 0&&(T.alphaMap=x(t.alphaMap)),t.bumpMap!==void 0&&(T.bumpMap=x(t.bumpMap)),t.bumpScale!==void 0&&(T.bumpScale=t.bumpScale),t.normalMap!==void 0&&(T.normalMap=x(t.normalMap)),t.normalMapType!==void 0&&(T.normalMapType=t.normalMapType),t.normalScale!==void 0){let E=t.normalScale;Array.isArray(E)===!1&&(E=[E,E]),T.normalScale=new ve().fromArray(E)}return t.displacementMap!==void 0&&(T.displacementMap=x(t.displacementMap)),t.displacementScale!==void 0&&(T.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(T.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(T.roughnessMap=x(t.roughnessMap)),t.metalnessMap!==void 0&&(T.metalnessMap=x(t.metalnessMap)),t.emissiveMap!==void 0&&(T.emissiveMap=x(t.emissiveMap)),t.emissiveIntensity!==void 0&&(T.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(T.specularMap=x(t.specularMap)),t.specularIntensityMap!==void 0&&(T.specularIntensityMap=x(t.specularIntensityMap)),t.specularColorMap!==void 0&&(T.specularColorMap=x(t.specularColorMap)),t.envMap!==void 0&&(T.envMap=x(t.envMap)),t.envMapIntensity!==void 0&&(T.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(T.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(T.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(T.lightMap=x(t.lightMap)),t.lightMapIntensity!==void 0&&(T.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(T.aoMap=x(t.aoMap)),t.aoMapIntensity!==void 0&&(T.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(T.gradientMap=x(t.gradientMap)),t.clearcoatMap!==void 0&&(T.clearcoatMap=x(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(T.clearcoatRoughnessMap=x(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(T.clearcoatNormalMap=x(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(T.clearcoatNormalScale=new ve().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(T.iridescenceMap=x(t.iridescenceMap)),t.iridescenceThicknessMap!==void 0&&(T.iridescenceThicknessMap=x(t.iridescenceThicknessMap)),t.transmissionMap!==void 0&&(T.transmissionMap=x(t.transmissionMap)),t.thicknessMap!==void 0&&(T.thicknessMap=x(t.thicknessMap)),t.anisotropyMap!==void 0&&(T.anisotropyMap=x(t.anisotropyMap)),t.sheenColorMap!==void 0&&(T.sheenColorMap=x(t.sheenColorMap)),t.sheenRoughnessMap!==void 0&&(T.sheenRoughnessMap=x(t.sheenRoughnessMap)),T}setTextures(t){return this.textures=t,this}static createMaterialFromType(t){const i={ShadowMaterial:jw,SpriteMaterial:C1,RawShaderMaterial:Kw,ShaderMaterial:no,PointsMaterial:A1,MeshPhysicalMaterial:Zw,MeshStandardMaterial:ml,MeshPhongMaterial:Jw,MeshToonMaterial:$w,MeshNormalMaterial:Qw,MeshLambertMaterial:_w,MeshDepthMaterial:T1,MeshDistanceMaterial:E1,MeshBasicMaterial:xh,MeshMatcapMaterial:qw,LineDashedMaterial:tA,LineBasicMaterial:ys,Material:Hr};return new i[t]}}class Ex{static decodeText(t){if(typeof TextDecoder<"u")return new TextDecoder().decode(t);let i="";for(let x=0,T=t.length;x0){const e=new B1(i);E=new Wd(e),E.setCrossOrigin(this.crossOrigin);for(let r=0,p=t.length;r0){T=new Wd(this.manager),T.setCrossOrigin(this.crossOrigin);for(let s=0,y=t.length;s{const f=new gs;f.min.fromArray(u.boxMin),f.max.fromArray(u.boxMax);const o=new $r;return o.radius=u.sphereRadius,o.center.fromArray(u.sphereCenter),{boxInitialized:u.boxInitialized,box:f,sphereInitialized:u.sphereInitialized,sphere:o}}),s._maxGeometryCount=t.maxGeometryCount,s._maxVertexCount=t.maxVertexCount,s._maxIndexCount=t.maxIndexCount,s._geometryInitialized=t.geometryInitialized,s._geometryCount=t.geometryCount,s._matricesTexture=r(t.matricesTexture.uuid);break;case"LOD":s=new Lw;break;case"Line":s=new mh(y(t.geometry),e(t.material));break;case"LineLoop":s=new Iw(y(t.geometry),e(t.material));break;case"LineSegments":s=new Wo(y(t.geometry),e(t.material));break;case"PointCloud":case"Points":s=new Nw(y(t.geometry),e(t.material));break;case"Sprite":s=new bw(e(t.material));break;case"Group":s=new Gf;break;case"Bone":s=new w1;break;default:s=new Yi}if(s.uuid=t.uuid,t.name!==void 0&&(s.name=t.name),t.matrix!==void 0?(s.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(s.matrixAutoUpdate=t.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(t.position!==void 0&&s.position.fromArray(t.position),t.rotation!==void 0&&s.rotation.fromArray(t.rotation),t.quaternion!==void 0&&s.quaternion.fromArray(t.quaternion),t.scale!==void 0&&s.scale.fromArray(t.scale)),t.up!==void 0&&s.up.fromArray(t.up),t.castShadow!==void 0&&(s.castShadow=t.castShadow),t.receiveShadow!==void 0&&(s.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.bias!==void 0&&(s.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(s.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(s.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&s.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(s.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(s.visible=t.visible),t.frustumCulled!==void 0&&(s.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(s.renderOrder=t.renderOrder),t.userData!==void 0&&(s.userData=t.userData),t.layers!==void 0&&(s.layers.mask=t.layers),t.children!==void 0){const a=t.children;for(let l=0;l"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,i,x,T){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const E=this,s=Tl.get(t);if(s!==void 0){if(E.manager.itemStart(t),s.then){s.then(r=>{i&&i(r),E.manager.itemEnd(t)}).catch(r=>{T&&T(r)});return}return setTimeout(function(){i&&i(s),E.manager.itemEnd(t)},0),s}const y={};y.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",y.headers=this.requestHeader;const e=fetch(t,y).then(function(r){return r.blob()}).then(function(r){return createImageBitmap(r,Object.assign(E.options,{colorSpaceConversion:"none"}))}).then(function(r){return Tl.add(t,r),i&&i(r),E.manager.itemEnd(t),r}).catch(function(r){T&&T(r),Tl.remove(t),E.manager.itemError(t),E.manager.itemEnd(t)});Tl.add(t,e),E.manager.itemStart(t)}}let Vv,z1=class{static getContext(){return Vv===void 0&&(Vv=new(window.AudioContext||window.webkitAudioContext)),Vv}static setContext(t){Vv=t}};class $U extends Ns{constructor(t){super(t)}load(t,i,x,T){const E=this,s=new Al(this.manager);s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,function(e){try{const r=e.slice(0);z1.getContext().decodeAudioData(r,function(h){i(h)}).catch(y)}catch(r){y(r)}},x,T);function y(e){T?T(e):console.error(e),E.manager.itemError(t)}}}const HE=new ci,WE=new ci,tu=new ci;class QU{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Or,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Or,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const i=this._cache;if(i.focus!==t.focus||i.fov!==t.fov||i.aspect!==t.aspect*this.aspect||i.near!==t.near||i.far!==t.far||i.zoom!==t.zoom||i.eyeSep!==this.eyeSep){i.focus=t.focus,i.fov=t.fov,i.aspect=t.aspect*this.aspect,i.near=t.near,i.far=t.far,i.zoom=t.zoom,i.eyeSep=this.eyeSep,tu.copy(t.projectionMatrix);const T=i.eyeSep/2,E=T*i.near/i.focus,s=i.near*Math.tan(yu*i.fov*.5)/i.zoom;let y,e;WE.elements[12]=-T,HE.elements[12]=T,y=-s*i.aspect+E,e=s*i.aspect+E,tu.elements[0]=2*i.near/(e-y),tu.elements[8]=(e+y)/(e-y),this.cameraL.projectionMatrix.copy(tu),y=-s*i.aspect-E,e=s*i.aspect-E,tu.elements[0]=2*i.near/(e-y),tu.elements[8]=(e+y)/(e-y),this.cameraR.projectionMatrix.copy(tu)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(WE),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(HE)}}class G1{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=XE(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const i=XE();t=(i-this.oldTime)/1e3,this.oldTime=i,this.elapsedTime+=t}return t}}function XE(){return(typeof performance>"u"?Date:performance).now()}const eu=new Ct,YE=new Ds,_U=new Ct,iu=new Ct;class qU extends Yi{constructor(){super(),this.type="AudioListener",this.context=z1.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new G1}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const i=this.context.listener,x=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(eu,YE,_U),iu.set(0,0,-1).applyQuaternion(YE),i.positionX){const T=this.context.currentTime+this.timeDelta;i.positionX.linearRampToValueAtTime(eu.x,T),i.positionY.linearRampToValueAtTime(eu.y,T),i.positionZ.linearRampToValueAtTime(eu.z,T),i.forwardX.linearRampToValueAtTime(iu.x,T),i.forwardY.linearRampToValueAtTime(iu.y,T),i.forwardZ.linearRampToValueAtTime(iu.z,T),i.upX.linearRampToValueAtTime(x.x,T),i.upY.linearRampToValueAtTime(x.y,T),i.upZ.linearRampToValueAtTime(x.z,T)}else i.setPosition(eu.x,eu.y,eu.z),i.setOrientation(iu.x,iu.y,iu.z,x.x,x.y,x.z)}}let yA=class extends Yi{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+t;const i=this.context.createBufferSource();return i.buffer=this.buffer,i.loop=this.loop,i.loopStart=this.loopStart,i.loopEnd=this.loopEnd,i.onended=this.onEnded.bind(this),i.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=i,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,i=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,i=this.filters.length;t0&&this._mixBufferRegionAdditive(x,T,this._addIndex*i,1,i);for(let e=i,r=i+i;e!==r;++e)if(x[e]!==x[e+i]){y.setValue(x,T);break}}saveOriginalState(){const t=this.binding,i=this.buffer,x=this.valueSize,T=x*this._origIndex;t.getValue(i,T);for(let E=x,s=T;E!==s;++E)i[E]=i[T+E%x];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=this.valueSize*3;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,i=t+this.valueSize;for(let x=t;x=.5)for(let s=0;s!==E;++s)t[i+s]=t[x+s]}_slerp(t,i,x,T){Ds.slerpFlat(t,i,t,i,t,x,T)}_slerpAdditive(t,i,x,T,E){const s=this._workIndex*E;Ds.multiplyQuaternionsFlat(t,s,t,i,t,x),Ds.slerpFlat(t,i,t,i,t,s,T)}_lerp(t,i,x,T,E){const s=1-T;for(let y=0;y!==E;++y){const e=i+y;t[e]=t[e]*s+t[x+y]*T}}_lerpAdditive(t,i,x,T,E){for(let s=0;s!==E;++s){const y=i+s;t[y]=t[y]+t[x+s]*T}}}const V1="\\[\\]\\.:\\/",nz=new RegExp("["+V1+"]","g"),H1="[^"+V1+"]",rz="[^"+V1.replace("\\.","")+"]",sz=/((?:WC+[\/:])*)/.source.replace("WC",H1),az=/(WCOD+)?/.source.replace("WCOD",rz),oz=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",H1),lz=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",H1),hz=new RegExp("^"+sz+az+oz+lz+"$"),uz=["material","materials","bones","map"];class fz{constructor(t,i,x){const T=x||Xi.parseTrackName(i);this._targetGroup=t,this._bindings=t.subscribe_(i,T)}getValue(t,i){this.bind();const x=this._targetGroup.nCachedObjects_,T=this._bindings[x];T!==void 0&&T.getValue(t,i)}setValue(t,i){const x=this._bindings;for(let T=this._targetGroup.nCachedObjects_,E=x.length;T!==E;++T)x[T].setValue(t,i)}bind(){const t=this._bindings;for(let i=this._targetGroup.nCachedObjects_,x=t.length;i!==x;++i)t[i].bind()}unbind(){const t=this._bindings;for(let i=this._targetGroup.nCachedObjects_,x=t.length;i!==x;++i)t[i].unbind()}}class Xi{constructor(t,i,x){this.path=i,this.parsedPath=x||Xi.parseTrackName(i),this.node=Xi.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,i,x){return t&&t.isAnimationObjectGroup?new Xi.Composite(t,i,x):new Xi(t,i,x)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(nz,"")}static parseTrackName(t){const i=hz.exec(t);if(i===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const x={nodeName:i[2],objectName:i[3],objectIndex:i[4],propertyName:i[5],propertyIndex:i[6]},T=x.nodeName&&x.nodeName.lastIndexOf(".");if(T!==void 0&&T!==-1){const E=x.nodeName.substring(T+1);uz.indexOf(E)!==-1&&(x.nodeName=x.nodeName.substring(0,T),x.objectName=E)}if(x.propertyName===null||x.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return x}static findNode(t,i){if(i===void 0||i===""||i==="."||i===-1||i===t.name||i===t.uuid)return t;if(t.skeleton){const x=t.skeleton.getBoneByName(i);if(x!==void 0)return x}if(t.children){const x=function(E){for(let s=0;s=E){const h=E++,a=t[h];i[a.uuid]=p,t[p]=a,i[r]=h,t[h]=e;for(let l=0,n=T;l!==n;++l){const u=x[l],f=u[h],o=u[p];u[p]=f,u[h]=o}}}this.nCachedObjects_=E}uncache(){const t=this._objects,i=this._indicesByUUID,x=this._bindings,T=x.length;let E=this.nCachedObjects_,s=t.length;for(let y=0,e=arguments.length;y!==e;++y){const r=arguments[y],p=r.uuid,h=i[p];if(h!==void 0)if(delete i[p],h0&&(i[l.uuid]=h),t[h]=l,t.pop();for(let n=0,u=T;n!==u;++n){const f=x[n];f[h]=f[a],f.pop()}}}this.nCachedObjects_=E}subscribe_(t,i){const x=this._bindingsIndicesByPath;let T=x[t];const E=this._bindings;if(T!==void 0)return E[T];const s=this._paths,y=this._parsedPaths,e=this._objects,r=e.length,p=this.nCachedObjects_,h=new Array(r);T=E.length,x[t]=T,s.push(t),y.push(i),E.push(h);for(let a=p,l=e.length;a!==l;++a){const n=e[a];h[a]=new Xi(n,t,i)}return h}unsubscribe_(t){const i=this._bindingsIndicesByPath,x=i[t];if(x!==void 0){const T=this._paths,E=this._parsedPaths,s=this._bindings,y=s.length-1,e=s[y],r=t[y];i[r]=x,s[x]=e,s.pop(),E[x]=E[y],E.pop(),T[x]=T[y],T.pop()}}}class SA{constructor(t,i,x=null,T=i.blendMode){this._mixer=t,this._clip=i,this._localRoot=x,this.blendMode=T;const E=i.tracks,s=E.length,y=new Array(s),e={endingStart:du,endingEnd:du};for(let r=0;r!==s;++r){const p=E[r].createInterpolant(null);y[r]=p,p.settings=e}this._interpolantSettings=e,this._interpolants=y,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=q2,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,i){return this.loop=t,this.repetitions=i,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,i,x){if(t.fadeOut(i),this.fadeIn(i),x){const T=this._clip.duration,E=t._clip.duration,s=E/T,y=T/E;t.warp(1,s,i),this.warp(y,1,i)}return this}crossFadeTo(t,i,x){return t.crossFadeFrom(this,i,x)}stopFading(){const t=this._weightInterpolant;return t!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,i,x){const T=this._mixer,E=T.time,s=this.timeScale;let y=this._timeScaleInterpolant;y===null&&(y=T._lendControlInterpolant(),this._timeScaleInterpolant=y);const e=y.parameterPositions,r=y.sampleValues;return e[0]=E,e[1]=E+x,r[0]=t/s,r[1]=i/s,this}stopWarping(){const t=this._timeScaleInterpolant;return t!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,i,x,T){if(!this.enabled){this._updateWeight(t);return}const E=this._startTime;if(E!==null){const e=(t-E)*x;e<0||x===0?i=0:(this._startTime=null,i=x*e)}i*=this._updateTimeScale(t);const s=this._updateTime(i),y=this._updateWeight(t);if(y>0){const e=this._interpolants,r=this._propertyBindings;switch(this.blendMode){case f1:for(let p=0,h=e.length;p!==h;++p)e[p].evaluate(s),r[p].accumulateAdditive(y);break;case lg:default:for(let p=0,h=e.length;p!==h;++p)e[p].evaluate(s),r[p].accumulate(T,y)}}}_updateWeight(t){let i=0;if(this.enabled){i=this.weight;const x=this._weightInterpolant;if(x!==null){const T=x.evaluate(t)[0];i*=T,t>x.parameterPositions[1]&&(this.stopFading(),T===0&&(this.enabled=!1))}}return this._effectiveWeight=i,i}_updateTimeScale(t){let i=0;if(!this.paused){i=this.timeScale;const x=this._timeScaleInterpolant;if(x!==null){const T=x.evaluate(t)[0];i*=T,t>x.parameterPositions[1]&&(this.stopWarping(),i===0?this.paused=!0:this.timeScale=i)}}return this._effectiveTimeScale=i,i}_updateTime(t){const i=this._clip.duration,x=this.loop;let T=this.time+t,E=this._loopCount;const s=x===tw;if(t===0)return E===-1?T:s&&(E&1)===1?i-T:T;if(x===_2){E===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(T>=i)T=i;else if(T<0)T=0;else{this.time=T;break t}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=T,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(E===-1&&(t>=0?(E=0,this._setEndings(!0,this.repetitions===0,s)):this._setEndings(this.repetitions===0,!0,s)),T>=i||T<0){const y=Math.floor(T/i);T-=i*y,E+=Math.abs(y);const e=this.repetitions-E;if(e<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,T=t>0?i:0,this.time=T,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(e===1){const r=t<0;this._setEndings(r,!r,s)}else this._setEndings(!1,!1,s);this._loopCount=E,this.time=T,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:y})}}else this.time=T;if(s&&(E&1)===1)return i-T}return T}_setEndings(t,i,x){const T=this._interpolantSettings;x?(T.endingStart=pu,T.endingEnd=pu):(t?T.endingStart=this.zeroSlopeAtStart?pu:du:T.endingStart=Rd,i?T.endingEnd=this.zeroSlopeAtEnd?pu:du:T.endingEnd=Rd)}_scheduleFading(t,i,x){const T=this._mixer,E=T.time;let s=this._weightInterpolant;s===null&&(s=T._lendControlInterpolant(),this._weightInterpolant=s);const y=s.parameterPositions,e=s.sampleValues;return y[0]=E,e[0]=i,y[1]=E+t,e[1]=x,this}}const dz=new Float32Array(1);class pz extends Pl{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,i){const x=t._localRoot||this._root,T=t._clip.tracks,E=T.length,s=t._propertyBindings,y=t._interpolants,e=x.uuid,r=this._bindingsByRootAndName;let p=r[e];p===void 0&&(p={},r[e]=p);for(let h=0;h!==E;++h){const a=T[h],l=a.name;let n=p[l];if(n!==void 0)++n.referenceCount,s[h]=n;else{if(n=s[h],n!==void 0){n._cacheIndex===null&&(++n.referenceCount,this._addInactiveBinding(n,e,l));continue}const u=i&&i._propertyBindings[h].binding.parsedPath;n=new xA(Xi.create(x,l,u),a.ValueTypeName,a.getValueSize()),++n.referenceCount,this._addInactiveBinding(n,e,l),s[h]=n}y[h].resultBuffer=n.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){const x=(t._localRoot||this._root).uuid,T=t._clip.uuid,E=this._actionsByClip[T];this._bindAction(t,E&&E.knownActions[0]),this._addInactiveAction(t,T,x)}const i=t._propertyBindings;for(let x=0,T=i.length;x!==T;++x){const E=i[x];E.useCount++===0&&(this._lendBinding(E),E.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const i=t._propertyBindings;for(let x=0,T=i.length;x!==T;++x){const E=i[x];--E.useCount===0&&(E.restoreOriginalState(),this._takeBackBinding(E))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const i=t._cacheIndex;return i!==null&&i=0;--x)t[x].stop();return this}update(t){t*=this.timeScale;const i=this._actions,x=this._nActiveActions,T=this.time+=t,E=Math.sign(t),s=this._accuIndex^=1;for(let r=0;r!==x;++r)i[r]._update(T,t,E,s);const y=this._bindings,e=this._nActiveBindings;for(let r=0;r!==e;++r)y[r].apply(s);return this}setTime(t){this.time=0;for(let i=0;ithis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,i){return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,i){return i.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,KE).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const ZE=new Ct,Hv=new Ct;class Ez{constructor(t=new Ct,i=new Ct){this.start=t,this.end=i}set(t,i){return this.start.copy(t),this.end.copy(i),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,i){return this.delta(i).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,i){ZE.subVectors(t,this.start),Hv.subVectors(this.end,this.start);const x=Hv.dot(Hv);let E=Hv.dot(ZE)/x;return i&&(E=Kn(E,0,1)),E}closestPointToPoint(t,i,x){const T=this.closestPointToPointParameter(t,i);return this.delta(x).multiplyScalar(T).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const JE=new Ct;class Mz extends Yi{constructor(t,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="SpotLightHelper";const x=new Li,T=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let s=0,y=1,e=32;s1)for(let h=0;h.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{tM.set(t.z,0,-t.x).normalize();const i=Math.acos(t.y);this.quaternion.setFromAxisAngle(tM,i)}}setLength(t,i=t*.2,x=i*.2){this.line.scale.set(1,Math.max(1e-4,t-i),1),this.line.updateMatrix(),this.cone.scale.set(x,i,x),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class Bz extends Wo{constructor(t=1){const i=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],x=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],T=new Li;T.setAttribute("position",new ke(i,3)),T.setAttribute("color",new ke(x,3));const E=new ys({vertexColors:!0,toneMapped:!1});super(T,E),this.type="AxesHelper"}setColors(t,i,x){const T=new ze,E=this.geometry.attributes.color.array;return T.set(t),T.toArray(E,0),T.toArray(E,3),T.set(i),T.toArray(E,6),T.toArray(E,9),T.set(x),T.toArray(E,12),T.toArray(E,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Uz{constructor(){this.type="ShapePath",this.color=new ze,this.subPaths=[],this.currentPath=null}moveTo(t,i){return this.currentPath=new Nd,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,i),this}lineTo(t,i){return this.currentPath.lineTo(t,i),this}quadraticCurveTo(t,i,x,T){return this.currentPath.quadraticCurveTo(t,i,x,T),this}bezierCurveTo(t,i,x,T,E,s){return this.currentPath.bezierCurveTo(t,i,x,T,E,s),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function i(o){const c=[];for(let d=0,v=o.length;dNumber.EPSILON){if(A<0&&(M=c[S],C=-C,w=c[m],A=-A),o.yw.y)continue;if(o.y===M.y){if(o.x===M.x)return!0}else{const P=A*(o.x-M.x)-C*(o.y-M.y);if(P===0)return!0;if(P<0)continue;v=!v}}else{if(o.y!==M.y)continue;if(w.x<=o.x&&o.x<=M.x||M.x<=o.x&&o.x<=w.x)return!0}}return v}const T=Go.isClockWise,E=this.subPaths;if(E.length===0)return[];let s,y,e;const r=[];if(E.length===1)return y=E[0],e=new Eu,e.curves=y.curves,r.push(e),r;let p=!T(E[0].getPoints());p=t?!p:p;const h=[],a=[];let l=[],n=0,u;a[n]=void 0,l[n]=[];for(let o=0,c=E.length;o1){let o=!1,c=0;for(let d=0,v=a.length;d0&&o===!1&&(l=h)}let f;for(let o=0,c=a.length;o{const h=typeof r=="function"?r(t):r;if(h!==t){const a=t;t=p?h:Object.assign({},t,h),i.forEach(l=>l(t,a))}},T=()=>t,E=(r,p=T,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let a=p(t);function l(){const n=p(t);if(!h(a,n)){const u=a;r(a=n,u)}}return i.add(l),()=>i.delete(l)},e={setState:x,getState:T,subscribe:(r,p,h)=>p||h?E(r,p,h):(i.add(r),()=>i.delete(r)),destroy:()=>i.clear()};return t=g(x,T,e),e}const z7=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),iM=z7?Pe.useEffect:Pe.useLayoutEffect;function G7(g){const t=typeof g=="function"?U7(g):g,i=(x=t.getState,T=Object.is)=>{const[,E]=Pe.useReducer(f=>f+1,0),s=t.getState(),y=Pe.useRef(s),e=Pe.useRef(x),r=Pe.useRef(T),p=Pe.useRef(!1),h=Pe.useRef();h.current===void 0&&(h.current=x(s));let a,l=!1;(y.current!==s||e.current!==x||r.current!==T||p.current)&&(a=x(s),l=!T(h.current,a)),iM(()=>{l&&(h.current=a),y.current=s,e.current=x,r.current=T,p.current=!1});const n=Pe.useRef(s);iM(()=>{const f=()=>{try{const c=t.getState(),d=e.current(c);r.current(h.current,d)||(y.current=c,h.current=d,E())}catch{p.current=!0,E()}},o=t.subscribe(f);return t.getState()!==n.current&&f(),o},[]);const u=l?a:h.current;return Pe.useDebugValue(u),u};return Object.assign(i,t),i[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const x=[i,t];return{next(){const T=x.length<=0;return{value:x.shift(),done:T}}}},i}var MA={exports:{}},ny={exports:{}},ry={};/** + */Iu.ConcurrentRoot=1;Iu.ContinuousEventPriority=4;Iu.DefaultEventPriority=16;Iu.DiscreteEventPriority=1;Iu.IdleEventPriority=536870912;Iu.LegacyRoot=0;MA.exports=Iu;var Hf=MA.exports;function Gz(g){let t;const i=new Set,x=(r,p)=>{const h=typeof r=="function"?r(t):r;if(h!==t){const a=t;t=p?h:Object.assign({},t,h),i.forEach(l=>l(t,a))}},T=()=>t,E=(r,p=T,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let a=p(t);function l(){const n=p(t);if(!h(a,n)){const u=a;r(a=n,u)}}return i.add(l),()=>i.delete(l)},e={setState:x,getState:T,subscribe:(r,p,h)=>p||h?E(r,p,h):(i.add(r),()=>i.delete(r)),destroy:()=>i.clear()};return t=g(x,T,e),e}const Vz=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),eM=Vz?Ae.useEffect:Ae.useLayoutEffect;function Hz(g){const t=typeof g=="function"?Gz(g):g,i=(x=t.getState,T=Object.is)=>{const[,E]=Ae.useReducer(f=>f+1,0),s=t.getState(),y=Ae.useRef(s),e=Ae.useRef(x),r=Ae.useRef(T),p=Ae.useRef(!1),h=Ae.useRef();h.current===void 0&&(h.current=x(s));let a,l=!1;(y.current!==s||e.current!==x||r.current!==T||p.current)&&(a=x(s),l=!T(h.current,a)),eM(()=>{l&&(h.current=a),y.current=s,e.current=x,r.current=T,p.current=!1});const n=Ae.useRef(s);eM(()=>{const f=()=>{try{const c=t.getState(),d=e.current(c);r.current(h.current,d)||(y.current=c,h.current=d,E())}catch{p.current=!0,E()}},o=t.subscribe(f);return t.getState()!==n.current&&f(),o},[]);const u=l?a:h.current;return Ae.useDebugValue(u),u};return Object.assign(i,t),i[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const x=[i,t];return{next(){const T=x.length<=0;return{value:x.shift(),done:T}}}},i}var CA={exports:{}},ry={exports:{}},sy={};/** * @license React * scheduler.production.min.js * @@ -10180,7 +10180,7 @@ void main() { * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var nM;function V7(){return nM||(nM=1,function(g){function t(z,X){var K=z.length;z.push(X);t:for(;0>>1,tt=z[Q];if(0>>1;QT(U,K))HT(J,U)?(z[Q]=J,z[H]=K,Q=H):(z[Q]=U,z[Z]=K,Q=Z);else if(HT(J,K))z[Q]=J,z[H]=K,Q=H;else break t}}return X}function T(z,X){var K=z.sortIndex-X.sortIndex;return K!==0?K:z.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var E=performance;g.unstable_now=function(){return E.now()}}else{var s=Date,y=s.now();g.unstable_now=function(){return s.now()-y}}var e=[],r=[],p=1,h=null,a=3,l=!1,n=!1,u=!1,f=typeof setTimeout=="function"?setTimeout:null,o=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d(z){for(var X=i(r);X!==null;){if(X.callback===null)x(r);else if(X.startTime<=z)x(r),X.sortIndex=X.expirationTime,t(e,X);else break;X=i(r)}}function v(z){if(u=!1,d(z),!n)if(i(e)!==null)n=!0,B(m);else{var X=i(r);X!==null&&G(v,X.startTime-z)}}function m(z,X){n=!1,u&&(u=!1,o(w),w=-1),l=!0;var K=a;try{for(d(X),h=i(e);h!==null&&(!(h.expirationTime>X)||z&&!P());){var Q=h.callback;if(typeof Q=="function"){h.callback=null,a=h.priorityLevel;var tt=Q(h.expirationTime<=X);X=g.unstable_now(),typeof tt=="function"?h.callback=tt:h===i(e)&&x(e),d(X)}else x(e);h=i(e)}if(h!==null)var Y=!0;else{var Z=i(r);Z!==null&&G(v,Z.startTime-X),Y=!1}return Y}finally{h=null,a=K,l=!1}}var S=!1,M=null,w=-1,C=5,A=-1;function P(){return!(g.unstable_now()-Az||125Q?(z.sortIndex=K,t(r,z),i(e)===null&&z===i(r)&&(u?(o(w),w=-1):u=!0,G(v,K-Q))):(z.sortIndex=tt,t(e,z),n||l||(n=!0,B(m))),z},g.unstable_shouldYield=P,g.unstable_wrapCallback=function(z){var X=a;return function(){var K=a;a=X;try{return z.apply(this,arguments)}finally{a=K}}}}(ry)),ry}var rM;function H7(){return rM||(rM=1,ny.exports=V7()),ny.exports}/** + */var iM;function Wz(){return iM||(iM=1,function(g){function t(z,X){var j=z.length;z.push(X);t:for(;0>>1,tt=z[Q];if(0>>1;QT(U,j))HT(J,U)?(z[Q]=J,z[H]=j,Q=H):(z[Q]=U,z[Z]=j,Q=Z);else if(HT(J,j))z[Q]=J,z[H]=j,Q=H;else break t}}return X}function T(z,X){var j=z.sortIndex-X.sortIndex;return j!==0?j:z.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var E=performance;g.unstable_now=function(){return E.now()}}else{var s=Date,y=s.now();g.unstable_now=function(){return s.now()-y}}var e=[],r=[],p=1,h=null,a=3,l=!1,n=!1,u=!1,f=typeof setTimeout=="function"?setTimeout:null,o=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d(z){for(var X=i(r);X!==null;){if(X.callback===null)x(r);else if(X.startTime<=z)x(r),X.sortIndex=X.expirationTime,t(e,X);else break;X=i(r)}}function v(z){if(u=!1,d(z),!n)if(i(e)!==null)n=!0,B(m);else{var X=i(r);X!==null&&G(v,X.startTime-z)}}function m(z,X){n=!1,u&&(u=!1,o(w),w=-1),l=!0;var j=a;try{for(d(X),h=i(e);h!==null&&(!(h.expirationTime>X)||z&&!P());){var Q=h.callback;if(typeof Q=="function"){h.callback=null,a=h.priorityLevel;var tt=Q(h.expirationTime<=X);X=g.unstable_now(),typeof tt=="function"?h.callback=tt:h===i(e)&&x(e),d(X)}else x(e);h=i(e)}if(h!==null)var Y=!0;else{var Z=i(r);Z!==null&&G(v,Z.startTime-X),Y=!1}return Y}finally{h=null,a=j,l=!1}}var S=!1,M=null,w=-1,C=5,A=-1;function P(){return!(g.unstable_now()-Az||125Q?(z.sortIndex=j,t(r,z),i(e)===null&&z===i(r)&&(u?(o(w),w=-1):u=!0,G(v,j-Q))):(z.sortIndex=tt,t(e,z),n||l||(n=!0,B(m))),z},g.unstable_shouldYield=P,g.unstable_wrapCallback=function(z){var X=a;return function(){var j=a;a=X;try{return z.apply(this,arguments)}finally{a=j}}}}(sy)),sy}var nM;function Xz(){return nM||(nM=1,ry.exports=Wz()),ry.exports}/** * @license React * react-reconciler.production.min.js * @@ -10188,17 +10188,17 @@ void main() { * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var W7=function(t){var i={},x=Pe,T=H7(),E=Object.assign;function s(L){for(var F="https://reactjs.org/docs/error-decoder.html?invariant="+L,W=1;WXt||it[wt]!==lt[Xt]){var ae=` -`+it[wt].replace(" at new "," at ");return L.displayName&&ae.includes("")&&(ae=ae.replace("",L.displayName)),ae}while(1<=wt&&0<=Xt);break}}}finally{ii=!1,Error.prepareStackTrace=W}return(L=L?L.displayName||L.name:"")?qe(L):""}var Ji=Object.prototype.hasOwnProperty,hn=[],ki=-1;function gn(L){return{current:L}}function ti(L){0>ki||(L.current=hn[ki],hn[ki]=null,ki--)}function Se(L,F){ki++,hn[ki]=L.current,L.current=F}var Nr={},mi=gn(Nr),un=gn(!1),Ii=Nr;function Gn(L,F){var W=L.type.contextTypes;if(!W)return Nr;var $=L.stateNode;if($&&$.__reactInternalMemoizedUnmaskedChildContext===F)return $.__reactInternalMemoizedMaskedChildContext;var it={},lt;for(lt in W)it[lt]=F[lt];return $&&(L=L.stateNode,L.__reactInternalMemoizedUnmaskedChildContext=F,L.__reactInternalMemoizedMaskedChildContext=it),it}function pn(L){return L=L.childContextTypes,L!=null}function Ki(){ti(un),ti(mi)}function dr(L,F,W){if(mi.current!==Nr)throw Error(s(168));Se(mi,F),Se(un,W)}function zs(L,F,W){var $=L.stateNode;if(F=F.childContextTypes,typeof $.getChildContext!="function")return W;$=$.getChildContext();for(var it in $)if(!(it in F))throw Error(s(108,w(L)||"Unknown",it));return E({},W,$)}function Tn(L){return L=(L=L.stateNode)&&L.__reactInternalMemoizedMergedChildContext||Nr,Ii=mi.current,Se(mi,L),Se(un,un.current),!0}function oa(L,F,W){var $=L.stateNode;if(!$)throw Error(s(169));W?(L=zs(L,F,Ii),$.__reactInternalMemoizedMergedChildContext=L,ti(un),ti(mi),Se(mi,L)):ti(un),Se(un,W)}var Jn=Math.clz32?Math.clz32:lo,Ra=Math.log,Gs=Math.LN2;function lo(L){return L>>>=0,L===0?32:31-(Ra(L)/Gs|0)|0}var ba=64,ho=4194304;function gi(L){switch(L&-L){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return L&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return L&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return L}}function La(L,F){var W=L.pendingLanes;if(W===0)return 0;var $=0,it=L.suspendedLanes,lt=L.pingedLanes,wt=W&268435455;if(wt!==0){var Xt=wt&~it;Xt!==0?$=gi(Xt):(lt&=wt,lt!==0&&($=gi(lt)))}else wt=W&~it,wt!==0?$=gi(wt):lt!==0&&($=gi(lt));if($===0)return 0;if(F!==0&&F!==$&&!(F&it)&&(it=$&-$,lt=F&-F,it>=lt||it===16&&(lt&4194240)!==0))return F;if($&4&&($|=W&16),F=L.entangledLanes,F!==0)for(L=L.entanglements,F&=$;0W;W++)F.push(L);return F}function Hs(L,F,W){L.pendingLanes|=F,F!==536870912&&(L.suspendedLanes=0,L.pingedLanes=0),L=L.eventTimes,F=31-Jn(F),L[F]=W}function Ws(L,F){var W=L.pendingLanes&~F;L.pendingLanes=F,L.suspendedLanes=0,L.pingedLanes=0,L.expiredLanes&=F,L.mutableReadLanes&=F,L.entangledLanes&=F,F=L.entanglements;var $=L.eventTimes;for(L=L.expirationTimes;0>=wt,it-=wt,Es=1<<32-Jn(F)+it|W<Ci?(Yn=yi,yi=null):Yn=yi.sibling;var Ui=Qe(Jt,yi,re[Ci],Ne);if(Ui===null){yi===null&&(yi=Yn);break}L&&yi&&Ui.alternate===null&&F(Jt,yi),Yt=lt(Ui,Yt,Ci),Mi===null?Ye=Ui:Mi.sibling=Ui,Mi=Ui,yi=Yn}if(Ci===re.length)return W(Jt,yi),_i&&Ms(Jt,Ci),Ye;if(yi===null){for(;CiCi?(Yn=yi,yi=null):Yn=yi.sibling;var ga=Qe(Jt,yi,Ui.value,Ne);if(ga===null){yi===null&&(yi=Yn);break}L&&yi&&ga.alternate===null&&F(Jt,yi),Yt=lt(ga,Yt,Ci),Mi===null?Ye=ga:Mi.sibling=ga,Mi=ga,yi=Yn}if(Ui.done)return W(Jt,yi),_i&&Ms(Jt,Ci),Ye;if(yi===null){for(;!Ui.done;Ci++,Ui=re.next())Ui=vi(Jt,Ui.value,Ne),Ui!==null&&(Yt=lt(Ui,Yt,Ci),Mi===null?Ye=Ui:Mi.sibling=Ui,Mi=Ui);return _i&&Ms(Jt,Ci),Ye}for(yi=$(Jt,yi);!Ui.done;Ci++,Ui=re.next())Ui=qi(yi,Jt,Ci,Ui.value,Ne),Ui!==null&&(L&&Ui.alternate!==null&&yi.delete(Ui.key===null?Ci:Ui.key),Yt=lt(Ui,Yt,Ci),Mi===null?Ye=Ui:Mi.sibling=Ui,Mi=Ui);return L&&yi.forEach(function(rf){return F(Jt,rf)}),_i&&Ms(Jt,Ci),Ye}function hs(Jt,Yt,re,Ne){if(typeof re=="object"&&re!==null&&re.type===p&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case e:t:{for(var Ye=re.key,Mi=Yt;Mi!==null;){if(Mi.key===Ye){if(Ye=re.type,Ye===p){if(Mi.tag===7){W(Jt,Mi.sibling),Yt=it(Mi,re.props.children),Yt.return=Jt,Jt=Yt;break t}}else if(Mi.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===d&&Ha(Ye)===Mi.type){W(Jt,Mi.sibling),Yt=it(Mi,re.props),Yt.ref=Va(Jt,Mi,re),Yt.return=Jt,Jt=Yt;break t}W(Jt,Mi);break}else F(Jt,Mi);Mi=Mi.sibling}re.type===p?(Yt=bo(re.props.children,Jt.mode,Ne,re.key),Yt.return=Jt,Jt=Yt):(Ne=ef(re.type,re.key,re.props,null,Jt.mode,Ne),Ne.ref=Va(Jt,Yt,re),Ne.return=Jt,Jt=Ne)}return wt(Jt);case r:t:{for(Mi=re.key;Yt!==null;){if(Yt.key===Mi)if(Yt.tag===4&&Yt.stateNode.containerInfo===re.containerInfo&&Yt.stateNode.implementation===re.implementation){W(Jt,Yt.sibling),Yt=it(Yt,re.children||[]),Yt.return=Jt,Jt=Yt;break t}else{W(Jt,Yt);break}else F(Jt,Yt);Yt=Yt.sibling}Yt=Rs(re,Jt.mode,Ne),Yt.return=Jt,Jt=Yt}return wt(Jt);case d:return Mi=re._init,hs(Jt,Yt,Mi(re._payload),Ne)}if(D(re))return Xe(Jt,Yt,re,Ne);if(S(re))return br(Jt,Yt,re,Ne);Qn(Jt,re)}return typeof re=="string"&&re!==""||typeof re=="number"?(re=""+re,Yt!==null&&Yt.tag===6?(W(Jt,Yt.sibling),Yt=it(Yt,re),Yt.return=Jt,Jt=Yt):(W(Jt,Yt),Yt=Rr(re,Jt.mode,Ne),Yt.return=Jt,Jt=Yt),wt(Jt)):W(Jt,Yt)}return hs}var Gr=Wa(!0),Ah=Wa(!1),V={},j=gn(V),et=gn(V),st=gn(V);function ht(L){if(L===V)throw Error(s(174));return L}function pt(L,F){Se(st,F),Se(et,L),Se(j,V),L=G(F),ti(j),Se(j,L)}function Mt(){ti(j),ti(et),ti(st)}function Nt(L){var F=ht(st.current),W=ht(j.current);F=z(W,L.type,F),W!==F&&(Se(et,L),Se(j,F))}function zt(L){et.current===L&&(ti(j),ti(et))}var ct=gn(0);function St(L){for(var F=L;F!==null;){if(F.tag===13){var W=F.memoizedState;if(W!==null&&(W=W.dehydrated,W===null||Pa(W)||aa(W)))return F}else if(F.tag===19&&F.memoizedProps.revealOrder!==void 0){if(F.flags&128)return F}else if(F.child!==null){F.child.return=F,F=F.child;continue}if(F===L)break;for(;F.sibling===null;){if(F.return===null||F.return===L)return null;F=F.return}F.sibling.return=F.return,F=F.sibling}return null}var vt=[];function Ft(){for(var L=0;LW?W:4,L(!0);var $=Ut.transition;Ut.transition={};try{L(!1),F()}finally{Ni=W,Ut.transition=$}}function lp(){return Ze().memoizedState}function _n(L,F,W){var $=va(L);W={lane:$,action:W,hasEagerState:!1,eagerState:null,next:null},hp(L)?up(F,W):(fc(L,F,W),W=wr(),L=As(L,$,W),L!==null&&fp(L,F,$))}function Er(L,F,W){var $=va(L),it={lane:$,action:W,hasEagerState:!1,eagerState:null,next:null};if(hp(L))up(F,it);else{fc(L,F,it);var lt=L.alternate;if(L.lanes===0&&(lt===null||lt.lanes===0)&&(lt=F.lastRenderedReducer,lt!==null))try{var wt=F.lastRenderedState,Xt=lt(wt,W);if(it.hasEagerState=!0,it.eagerState=Xt,Ts(Xt,wt))return}catch{}finally{}W=wr(),L=As(L,$,W),L!==null&&fp(L,F,$)}}function hp(L){var F=L.alternate;return L===It||F!==null&&F===It}function up(L,F){se=$t=!0;var W=L.pending;W===null?F.next=F:(F.next=W.next,W.next=F),L.pending=F}function fc(L,F,W){Wn!==null&&L.mode&1&&!(Ei&2)?(L=F.interleaved,L===null?(W.next=W,Wr===null?Wr=[F]:Wr.push(F)):(W.next=L.next,L.next=W),F.interleaved=W):(L=F.pending,L===null?W.next=W:(W.next=L.next,L.next=W),F.pending=W)}function fp(L,F,W){if(W&4194240){var $=F.lanes;$&=L.pendingLanes,W|=$,F.lanes=W,bl(L,W)}}var zl={readContext:$i,useCallback:pe,useContext:pe,useEffect:pe,useImperativeHandle:pe,useInsertionEffect:pe,useLayoutEffect:pe,useMemo:pe,useReducer:pe,useRef:pe,useState:pe,useDebugValue:pe,useDeferredValue:pe,useTransition:pe,useMutableSource:pe,useSyncExternalStore:pe,useId:pe,unstable_isNewReconciler:!1},Fh={readContext:$i,useCallback:function(L,F){return _e().memoizedState=[L,F===void 0?null:F],L},useContext:$i,useEffect:Ul,useImperativeHandle:function(L,F,W){return W=W!=null?W.concat([L]):null,xo(4194308,4,Rh.bind(null,F,L),W)},useLayoutEffect:function(L,F){return xo(4194308,4,L,F)},useInsertionEffect:function(L,F){return xo(4,2,L,F)},useMemo:function(L,F){var W=_e();return F=F===void 0?null:F,L=L(),W.memoizedState=[L,F],L},useReducer:function(L,F,W){var $=_e();return F=W!==void 0?W(F):F,$.memoizedState=$.baseState=F,L={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:L,lastRenderedState:F},$.queue=L,L=L.dispatch=_n.bind(null,It,L),[$.memoizedState,L]},useRef:function(L){var F=_e();return L={current:L},F.memoizedState=L},useState:go,useDebugValue:Lh,useDeferredValue:function(L){var F=go(L),W=F[0],$=F[1];return Ul(function(){var it=Ut.transition;Ut.transition={};try{$(L)}finally{Ut.transition=it}},[L]),W},useTransition:function(){var L=go(!1),F=L[0];return L=Fg.bind(null,L[1]),_e().memoizedState=L,[F,L]},useMutableSource:function(){},useSyncExternalStore:function(L,F,W){var $=It,it=_e();if(_i){if(W===void 0)throw Error(s(407));W=W()}else{if(W=F(),Wn===null)throw Error(s(349));Wt&30||Cn($,F,W)}it.memoizedState=W;var lt={value:W,getSnapshot:F};return it.queue=lt,Ul(bn.bind(null,$,lt,L),[L]),$.flags|=2048,yo(9,mo.bind(null,$,lt,W,F),void 0,null),W},useId:function(){var L=_e(),F=Wn.identifierPrefix;if(_i){var W=es,$=Es;W=($&~(1<<32-Jn($)-1)).toString(32)+W,F=":"+F+"R"+W,W=ue++,0Xt||it[wt]!==lt[Xt]){var oe=` +`+it[wt].replace(" at new "," at ");return L.displayName&&oe.includes("")&&(oe=oe.replace("",L.displayName)),oe}while(1<=wt&&0<=Xt);break}}}finally{ii=!1,Error.prepareStackTrace=W}return(L=L?L.displayName||L.name:"")?qe(L):""}var Ji=Object.prototype.hasOwnProperty,hn=[],ki=-1;function gn(L){return{current:L}}function ti(L){0>ki||(L.current=hn[ki],hn[ki]=null,ki--)}function Se(L,F){ki++,hn[ki]=L.current,L.current=F}var Nr={},mi=gn(Nr),un=gn(!1),Ii=Nr;function Gn(L,F){var W=L.type.contextTypes;if(!W)return Nr;var $=L.stateNode;if($&&$.__reactInternalMemoizedUnmaskedChildContext===F)return $.__reactInternalMemoizedMaskedChildContext;var it={},lt;for(lt in W)it[lt]=F[lt];return $&&(L=L.stateNode,L.__reactInternalMemoizedUnmaskedChildContext=F,L.__reactInternalMemoizedMaskedChildContext=it),it}function pn(L){return L=L.childContextTypes,L!=null}function ji(){ti(un),ti(mi)}function dr(L,F,W){if(mi.current!==Nr)throw Error(s(168));Se(mi,F),Se(un,W)}function zs(L,F,W){var $=L.stateNode;if(F=F.childContextTypes,typeof $.getChildContext!="function")return W;$=$.getChildContext();for(var it in $)if(!(it in F))throw Error(s(108,w(L)||"Unknown",it));return E({},W,$)}function Tn(L){return L=(L=L.stateNode)&&L.__reactInternalMemoizedMergedChildContext||Nr,Ii=mi.current,Se(mi,L),Se(un,un.current),!0}function oa(L,F,W){var $=L.stateNode;if(!$)throw Error(s(169));W?(L=zs(L,F,Ii),$.__reactInternalMemoizedMergedChildContext=L,ti(un),ti(mi),Se(mi,L)):ti(un),Se(un,W)}var Jn=Math.clz32?Math.clz32:lo,Ra=Math.log,Gs=Math.LN2;function lo(L){return L>>>=0,L===0?32:31-(Ra(L)/Gs|0)|0}var ba=64,ho=4194304;function gi(L){switch(L&-L){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return L&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return L&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return L}}function La(L,F){var W=L.pendingLanes;if(W===0)return 0;var $=0,it=L.suspendedLanes,lt=L.pingedLanes,wt=W&268435455;if(wt!==0){var Xt=wt&~it;Xt!==0?$=gi(Xt):(lt&=wt,lt!==0&&($=gi(lt)))}else wt=W&~it,wt!==0?$=gi(wt):lt!==0&&($=gi(lt));if($===0)return 0;if(F!==0&&F!==$&&!(F&it)&&(it=$&-$,lt=F&-F,it>=lt||it===16&&(lt&4194240)!==0))return F;if($&4&&($|=W&16),F=L.entangledLanes,F!==0)for(L=L.entanglements,F&=$;0W;W++)F.push(L);return F}function Hs(L,F,W){L.pendingLanes|=F,F!==536870912&&(L.suspendedLanes=0,L.pingedLanes=0),L=L.eventTimes,F=31-Jn(F),L[F]=W}function Ws(L,F){var W=L.pendingLanes&~F;L.pendingLanes=F,L.suspendedLanes=0,L.pingedLanes=0,L.expiredLanes&=F,L.mutableReadLanes&=F,L.entangledLanes&=F,F=L.entanglements;var $=L.eventTimes;for(L=L.expirationTimes;0>=wt,it-=wt,Es=1<<32-Jn(F)+it|W<wi?(Yn=yi,yi=null):Yn=yi.sibling;var Ui=Qe(Jt,yi,se[wi],Ne);if(Ui===null){yi===null&&(yi=Yn);break}L&&yi&&Ui.alternate===null&&F(Jt,yi),Yt=lt(Ui,Yt,wi),Ci===null?Ye=Ui:Ci.sibling=Ui,Ci=Ui,yi=Yn}if(wi===se.length)return W(Jt,yi),_i&&Ms(Jt,wi),Ye;if(yi===null){for(;wiwi?(Yn=yi,yi=null):Yn=yi.sibling;var ga=Qe(Jt,yi,Ui.value,Ne);if(ga===null){yi===null&&(yi=Yn);break}L&&yi&&ga.alternate===null&&F(Jt,yi),Yt=lt(ga,Yt,wi),Ci===null?Ye=ga:Ci.sibling=ga,Ci=ga,yi=Yn}if(Ui.done)return W(Jt,yi),_i&&Ms(Jt,wi),Ye;if(yi===null){for(;!Ui.done;wi++,Ui=se.next())Ui=vi(Jt,Ui.value,Ne),Ui!==null&&(Yt=lt(Ui,Yt,wi),Ci===null?Ye=Ui:Ci.sibling=Ui,Ci=Ui);return _i&&Ms(Jt,wi),Ye}for(yi=$(Jt,yi);!Ui.done;wi++,Ui=se.next())Ui=qi(yi,Jt,wi,Ui.value,Ne),Ui!==null&&(L&&Ui.alternate!==null&&yi.delete(Ui.key===null?wi:Ui.key),Yt=lt(Ui,Yt,wi),Ci===null?Ye=Ui:Ci.sibling=Ui,Ci=Ui);return L&&yi.forEach(function(nf){return F(Jt,nf)}),_i&&Ms(Jt,wi),Ye}function hs(Jt,Yt,se,Ne){if(typeof se=="object"&&se!==null&&se.type===p&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case e:t:{for(var Ye=se.key,Ci=Yt;Ci!==null;){if(Ci.key===Ye){if(Ye=se.type,Ye===p){if(Ci.tag===7){W(Jt,Ci.sibling),Yt=it(Ci,se.props.children),Yt.return=Jt,Jt=Yt;break t}}else if(Ci.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===d&&Ha(Ye)===Ci.type){W(Jt,Ci.sibling),Yt=it(Ci,se.props),Yt.ref=Va(Jt,Ci,se),Yt.return=Jt,Jt=Yt;break t}W(Jt,Ci);break}else F(Jt,Ci);Ci=Ci.sibling}se.type===p?(Yt=bo(se.props.children,Jt.mode,Ne,se.key),Yt.return=Jt,Jt=Yt):(Ne=tf(se.type,se.key,se.props,null,Jt.mode,Ne),Ne.ref=Va(Jt,Yt,se),Ne.return=Jt,Jt=Ne)}return wt(Jt);case r:t:{for(Ci=se.key;Yt!==null;){if(Yt.key===Ci)if(Yt.tag===4&&Yt.stateNode.containerInfo===se.containerInfo&&Yt.stateNode.implementation===se.implementation){W(Jt,Yt.sibling),Yt=it(Yt,se.children||[]),Yt.return=Jt,Jt=Yt;break t}else{W(Jt,Yt);break}else F(Jt,Yt);Yt=Yt.sibling}Yt=Rs(se,Jt.mode,Ne),Yt.return=Jt,Jt=Yt}return wt(Jt);case d:return Ci=se._init,hs(Jt,Yt,Ci(se._payload),Ne)}if(D(se))return Xe(Jt,Yt,se,Ne);if(S(se))return br(Jt,Yt,se,Ne);Qn(Jt,se)}return typeof se=="string"&&se!==""||typeof se=="number"?(se=""+se,Yt!==null&&Yt.tag===6?(W(Jt,Yt.sibling),Yt=it(Yt,se),Yt.return=Jt,Jt=Yt):(W(Jt,Yt),Yt=Rr(se,Jt.mode,Ne),Yt.return=Jt,Jt=Yt),wt(Jt)):W(Jt,Yt)}return hs}var Gr=Wa(!0),Ah=Wa(!1),V={},K=gn(V),et=gn(V),st=gn(V);function ht(L){if(L===V)throw Error(s(174));return L}function pt(L,F){Se(st,F),Se(et,L),Se(K,V),L=G(F),ti(K),Se(K,L)}function Mt(){ti(K),ti(et),ti(st)}function Nt(L){var F=ht(st.current),W=ht(K.current);F=z(W,L.type,F),W!==F&&(Se(et,L),Se(K,F))}function zt(L){et.current===L&&(ti(K),ti(et))}var ct=gn(0);function St(L){for(var F=L;F!==null;){if(F.tag===13){var W=F.memoizedState;if(W!==null&&(W=W.dehydrated,W===null||Pa(W)||aa(W)))return F}else if(F.tag===19&&F.memoizedProps.revealOrder!==void 0){if(F.flags&128)return F}else if(F.child!==null){F.child.return=F,F=F.child;continue}if(F===L)break;for(;F.sibling===null;){if(F.return===null||F.return===L)return null;F=F.return}F.sibling.return=F.return,F=F.sibling}return null}var vt=[];function Ft(){for(var L=0;LW?W:4,L(!0);var $=Ut.transition;Ut.transition={};try{L(!1),F()}finally{Ni=W,Ut.transition=$}}function hp(){return Ze().memoizedState}function _n(L,F,W){var $=va(L);W={lane:$,action:W,hasEagerState:!1,eagerState:null,next:null},up(L)?fp(F,W):(fc(L,F,W),W=wr(),L=As(L,$,W),L!==null&&cp(L,F,$))}function Er(L,F,W){var $=va(L),it={lane:$,action:W,hasEagerState:!1,eagerState:null,next:null};if(up(L))fp(F,it);else{fc(L,F,it);var lt=L.alternate;if(L.lanes===0&&(lt===null||lt.lanes===0)&&(lt=F.lastRenderedReducer,lt!==null))try{var wt=F.lastRenderedState,Xt=lt(wt,W);if(it.hasEagerState=!0,it.eagerState=Xt,Ts(Xt,wt))return}catch{}finally{}W=wr(),L=As(L,$,W),L!==null&&cp(L,F,$)}}function up(L){var F=L.alternate;return L===It||F!==null&&F===It}function fp(L,F){ae=$t=!0;var W=L.pending;W===null?F.next=F:(F.next=W.next,W.next=F),L.pending=F}function fc(L,F,W){Wn!==null&&L.mode&1&&!(Mi&2)?(L=F.interleaved,L===null?(W.next=W,Wr===null?Wr=[F]:Wr.push(F)):(W.next=L.next,L.next=W),F.interleaved=W):(L=F.pending,L===null?W.next=W:(W.next=L.next,L.next=W),F.pending=W)}function cp(L,F,W){if(W&4194240){var $=F.lanes;$&=L.pendingLanes,W|=$,F.lanes=W,bl(L,W)}}var zl={readContext:$i,useCallback:pe,useContext:pe,useEffect:pe,useImperativeHandle:pe,useInsertionEffect:pe,useLayoutEffect:pe,useMemo:pe,useReducer:pe,useRef:pe,useState:pe,useDebugValue:pe,useDeferredValue:pe,useTransition:pe,useMutableSource:pe,useSyncExternalStore:pe,useId:pe,unstable_isNewReconciler:!1},Fh={readContext:$i,useCallback:function(L,F){return _e().memoizedState=[L,F===void 0?null:F],L},useContext:$i,useEffect:Ul,useImperativeHandle:function(L,F,W){return W=W!=null?W.concat([L]):null,xo(4194308,4,Rh.bind(null,F,L),W)},useLayoutEffect:function(L,F){return xo(4194308,4,L,F)},useInsertionEffect:function(L,F){return xo(4,2,L,F)},useMemo:function(L,F){var W=_e();return F=F===void 0?null:F,L=L(),W.memoizedState=[L,F],L},useReducer:function(L,F,W){var $=_e();return F=W!==void 0?W(F):F,$.memoizedState=$.baseState=F,L={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:L,lastRenderedState:F},$.queue=L,L=L.dispatch=_n.bind(null,It,L),[$.memoizedState,L]},useRef:function(L){var F=_e();return L={current:L},F.memoizedState=L},useState:go,useDebugValue:Lh,useDeferredValue:function(L){var F=go(L),W=F[0],$=F[1];return Ul(function(){var it=Ut.transition;Ut.transition={};try{$(L)}finally{Ut.transition=it}},[L]),W},useTransition:function(){var L=go(!1),F=L[0];return L=Og.bind(null,L[1]),_e().memoizedState=L,[F,L]},useMutableSource:function(){},useSyncExternalStore:function(L,F,W){var $=It,it=_e();if(_i){if(W===void 0)throw Error(s(407));W=W()}else{if(W=F(),Wn===null)throw Error(s(349));Wt&30||Cn($,F,W)}it.memoizedState=W;var lt={value:W,getSnapshot:F};return it.queue=lt,Ul(bn.bind(null,$,lt,L),[L]),$.flags|=2048,yo(9,mo.bind(null,$,lt,W,F),void 0,null),W},useId:function(){var L=_e(),F=Wn.identifierPrefix;if(_i){var W=es,$=Es;W=($&~(1<<32-Jn($)-1)).toString(32)+W,F=":"+F+"R"+W,W=ue++,0zh&&(F.flags|=128,$=!0,Mr(it,!1),F.lanes=4194304)}else{if(!$)if(L=St(lt),L!==null){if(F.flags|=128,$=!0,L=L.updateQueue,L!==null&&(F.updateQueue=L,F.flags|=4),Mr(it,!0),it.tail===null&&it.tailMode==="hidden"&&!lt.alternate&&!_i)return ni(F),null}else 2*nn()-it.renderingStartTime>zh&&W!==1073741824&&(F.flags|=128,$=!0,Mr(it,!1),F.lanes=4194304);it.isBackwards?(lt.sibling=F.child,F.child=lt):(L=it.last,L!==null?L.sibling=lt:F.child=lt,it.last=lt)}return it.tail!==null?(F=it.tail,it.rendering=F,it.tail=F.sibling,it.renderingStartTime=nn(),F.sibling=null,L=ct.current,Se(ct,$?L&1|2:L&1),F):(ni(F),null);case 22:case 23:return Rc(),$=F.memoizedState!==null,L!==null&&L.memoizedState!==null!==$&&(F.flags|=8192),$&&F.mode&1?os&1073741824&&(ni(F),ot&&F.subtreeFlags&6&&(F.flags|=8192)):ni(F),null;case 24:return null;case 25:return null}throw Error(s(156,F.tag))}var Dg=y.ReactCurrentOwner,rs=!1;function Ln(L,F,W,$){F.child=L===null?Ah(F,null,W,$):Gr(F,L.child,W,$)}function mp(L,F,W,$,it){W=W.render;var lt=F.ref;return Xs(F,it),$=me(L,F,W,$,lt,it),W=be(),L!==null&&!rs?(F.updateQueue=L.updateQueue,F.flags&=-2053,L.lanes&=~it,qn(L,F,it)):(_i&&W&&Bl(F),F.flags|=1,Ln(L,F,$,it),F.child)}function gp(L,F,W,$,it){if(L===null){var lt=W.type;return typeof lt=="function"&&!Ic(lt)&<.defaultProps===void 0&&W.compare===null&&W.defaultProps===void 0?(F.tag=15,F.type=lt,yp(L,F,lt,$,it)):(L=ef(W.type,null,$,F,F.mode,it),L.ref=F.ref,L.return=F,F.child=L)}if(lt=L.child,!(L.lanes&it)){var wt=lt.memoizedProps;if(W=W.compare,W=W!==null?W:yn,W(wt,$)&&L.ref===F.ref)return qn(L,F,it)}return F.flags|=1,L=Ka(lt,$),L.ref=F.ref,L.return=F,F.child=L}function yp(L,F,W,$,it){if(L!==null&&yn(L.memoizedProps,$)&&L.ref===F.ref)if(rs=!1,(L.lanes&it)!==0)L.flags&131072&&(rs=!0);else return F.lanes=L.lanes,qn(L,F,it);return ks(L,F,W,$,it)}function xp(L,F,W){var $=F.pendingProps,it=$.children,lt=L!==null?L.memoizedState:null;if($.mode==="hidden")if(!(F.mode&1))F.memoizedState={baseLanes:0,cachePool:null},Se(Yl,os),os|=W;else if(W&1073741824)F.memoizedState={baseLanes:0,cachePool:null},$=lt!==null?lt.baseLanes:W,Se(Yl,os),os|=$;else return L=lt!==null?lt.baseLanes|W:W,F.lanes=F.childLanes=1073741824,F.memoizedState={baseLanes:L,cachePool:null},F.updateQueue=null,Se(Yl,os),os|=L,null;else lt!==null?($=lt.baseLanes|W,F.memoizedState=null):$=W,Se(Yl,os),os|=$;return Ln(L,F,it,W),F.child}function Sp(L,F){var W=F.ref;(L===null&&W!==null||L!==null&&L.ref!==W)&&(F.flags|=512,F.flags|=2097152)}function ks(L,F,W,$,it){var lt=pn(W)?Ii:mi.current;return lt=Gn(F,lt),Xs(F,it),W=me(L,F,W,$,lt,it),$=be(),L!==null&&!rs?(F.updateQueue=L.updateQueue,F.flags&=-2053,L.lanes&=~it,qn(L,F,it)):(_i&&$&&Bl(F),F.flags|=1,Ln(L,F,W,it),F.child)}function Tp(L,F,W,$,it){if(pn(W)){var lt=!0;Tn(F)}else lt=!1;if(Xs(F,it),F.stateNode===null)L!==null&&(L.alternate=null,F.alternate=null,F.flags|=2),Ko(F,W,$),za(F,W,$,it),$=!0;else if(L===null){var wt=F.stateNode,Xt=F.memoizedProps;wt.props=Xt;var ae=wt.context,Ee=W.contextType;typeof Ee=="object"&&Ee!==null?Ee=$i(Ee):(Ee=pn(W)?Ii:mi.current,Ee=Gn(F,Ee));var He=W.getDerivedStateFromProps,vi=typeof He=="function"||typeof wt.getSnapshotBeforeUpdate=="function";vi||typeof wt.UNSAFE_componentWillReceiveProps!="function"&&typeof wt.componentWillReceiveProps!="function"||(Xt!==$||ae!==Ee)&&jo(F,wt,$,Ee),xn=!1;var Qe=F.memoizedState;wt.state=Qe,Xr(F,$,wt,it),ae=F.memoizedState,Xt!==$||Qe!==ae||un.current||xn?(typeof He=="function"&&(qr(F,W,He,$),ae=F.memoizedState),(Xt=xn||Nl(F,W,Xt,$,Qe,ae,Ee))?(vi||typeof wt.UNSAFE_componentWillMount!="function"&&typeof wt.componentWillMount!="function"||(typeof wt.componentWillMount=="function"&&wt.componentWillMount(),typeof wt.UNSAFE_componentWillMount=="function"&&wt.UNSAFE_componentWillMount()),typeof wt.componentDidMount=="function"&&(F.flags|=4194308)):(typeof wt.componentDidMount=="function"&&(F.flags|=4194308),F.memoizedProps=$,F.memoizedState=ae),wt.props=$,wt.state=ae,wt.context=Ee,$=Xt):(typeof wt.componentDidMount=="function"&&(F.flags|=4194308),$=!1)}else{wt=F.stateNode,Ba(L,F),Xt=F.memoizedProps,Ee=F.type===F.elementType?Xt:Rn(F.type,Xt),wt.props=Ee,vi=F.pendingProps,Qe=wt.context,ae=W.contextType,typeof ae=="object"&&ae!==null?ae=$i(ae):(ae=pn(W)?Ii:mi.current,ae=Gn(F,ae));var qi=W.getDerivedStateFromProps;(He=typeof qi=="function"||typeof wt.getSnapshotBeforeUpdate=="function")||typeof wt.UNSAFE_componentWillReceiveProps!="function"&&typeof wt.componentWillReceiveProps!="function"||(Xt!==vi||Qe!==ae)&&jo(F,wt,$,ae),xn=!1,Qe=F.memoizedState,wt.state=Qe,Xr(F,$,wt,it);var Xe=F.memoizedState;Xt!==vi||Qe!==Xe||un.current||xn?(typeof qi=="function"&&(qr(F,W,qi,$),Xe=F.memoizedState),(Ee=xn||Nl(F,W,Ee,$,Qe,Xe,ae)||!1)?(He||typeof wt.UNSAFE_componentWillUpdate!="function"&&typeof wt.componentWillUpdate!="function"||(typeof wt.componentWillUpdate=="function"&&wt.componentWillUpdate($,Xe,ae),typeof wt.UNSAFE_componentWillUpdate=="function"&&wt.UNSAFE_componentWillUpdate($,Xe,ae)),typeof wt.componentDidUpdate=="function"&&(F.flags|=4),typeof wt.getSnapshotBeforeUpdate=="function"&&(F.flags|=1024)):(typeof wt.componentDidUpdate!="function"||Xt===L.memoizedProps&&Qe===L.memoizedState||(F.flags|=4),typeof wt.getSnapshotBeforeUpdate!="function"||Xt===L.memoizedProps&&Qe===L.memoizedState||(F.flags|=1024),F.memoizedProps=$,F.memoizedState=Xe),wt.props=$,wt.state=Xe,wt.context=ae,$=Ee):(typeof wt.componentDidUpdate!="function"||Xt===L.memoizedProps&&Qe===L.memoizedState||(F.flags|=4),typeof wt.getSnapshotBeforeUpdate!="function"||Xt===L.memoizedProps&&Qe===L.memoizedState||(F.flags|=1024),$=!1)}return dc(L,F,W,$,lt,it)}function dc(L,F,W,$,it,lt){Sp(L,F);var wt=(F.flags&128)!==0;if(!$&&!wt)return it&&oa(F,W,!1),qn(L,F,lt);$=F.stateNode,Dg.current=F;var Xt=wt&&typeof W.getDerivedStateFromError!="function"?null:$.render();return F.flags|=1,L!==null&&wt?(F.child=Gr(F,L.child,null,lt),F.child=Gr(F,null,Xt,lt)):Ln(L,F,Xt,lt),F.memoizedState=$.state,it&&oa(F,W,!0),F.child}function Ep(L){var F=L.stateNode;F.pendingContext?dr(L,F.pendingContext,F.pendingContext!==F.context):F.context&&dr(L,F.context,!1),pt(L,F.containerInfo)}function Mp(L,F,W,$,it){return vo(),Ga(it),F.flags|=256,Ln(L,F,W,$),F.child}var Vu={dehydrated:null,treeContext:null,retryLane:0};function ws(L){return{baseLanes:L,cachePool:null}}function Cp(L,F,W){var $=F.pendingProps,it=ct.current,lt=!1,wt=(F.flags&128)!==0,Xt;if((Xt=wt)||(Xt=L!==null&&L.memoizedState===null?!1:(it&2)!==0),Xt?(lt=!0,F.flags&=-129):(L===null||L.memoizedState!==null)&&(it|=1),Se(ct,it&1),L===null)return cn(F),L=F.memoizedState,L!==null&&(L=L.dehydrated,L!==null)?(F.mode&1?aa(L)?F.lanes=8:F.lanes=1073741824:F.lanes=1,null):(it=$.children,L=$.fallback,lt?($=F.mode,lt=F.child,it={mode:"hidden",children:it},!($&1)&<!==null?(lt.childLanes=0,lt.pendingProps=it):lt=Xh(it,$,0,null),L=bo(L,$,W,null),lt.return=F,L.return=F,lt.sibling=L,F.child=lt,F.child.memoizedState=ws(W),F.memoizedState=Vu,L):pc(F,it));if(it=L.memoizedState,it!==null){if(Xt=it.dehydrated,Xt!==null){if(wt)return F.flags&256?(F.flags&=-257,Hu(L,F,W,Error(s(422)))):F.memoizedState!==null?(F.child=L.child,F.flags|=128,null):(lt=$.fallback,it=F.mode,$=Xh({mode:"visible",children:$.children},it,0,null),lt=bo(lt,it,W,null),lt.flags|=2,$.return=F,lt.return=F,$.sibling=lt,F.child=$,F.mode&1&&Gr(F,L.child,null,W),F.child.memoizedState=ws(W),F.memoizedState=Vu,lt);if(!(F.mode&1))F=Hu(L,F,W,null);else if(aa(Xt))F=Hu(L,F,W,Error(s(419)));else if($=(W&L.childLanes)!==0,rs||$){if($=Wn,$!==null){switch(W&-W){case 4:lt=2;break;case 16:lt=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:lt=32;break;case 536870912:lt=268435456;break;default:lt=0}$=lt&($.suspendedLanes|W)?0:lt,$!==0&&$!==it.retryLane&&(it.retryLane=$,As(L,$,-1))}_u(),F=Hu(L,F,W,Error(s(421)))}else Pa(Xt)?(F.flags|=128,F.child=L.child,F=Ro.bind(null,L),Bs(Xt,F),F=null):(W=it.treeContext,gt&&(Hn=Us(Xt),$n=F,_i=!0,is=null,po=!1,W!==null&&(sr[ar++]=Es,sr[ar++]=es,sr[ar++]=fa,Es=W.id,es=W.overflow,fa=F)),F=pc(F,F.pendingProps.children),F.flags|=4096);return F}return lt?($=Ap(L,F,$.children,$.fallback,W),lt=F.child,it=L.child.memoizedState,lt.memoizedState=it===null?ws(W):{baseLanes:it.baseLanes|W,cachePool:null},lt.childLanes=L.childLanes&~W,F.memoizedState=Vu,$):(W=wp(L,F,$.children,W),F.memoizedState=null,W)}return lt?($=Ap(L,F,$.children,$.fallback,W),lt=F.child,it=L.child.memoizedState,lt.memoizedState=it===null?ws(W):{baseLanes:it.baseLanes|W,cachePool:null},lt.childLanes=L.childLanes&~W,F.memoizedState=Vu,$):(W=wp(L,F,$.children,W),F.memoizedState=null,W)}function pc(L,F){return F=Xh({mode:"visible",children:F},L.mode,0,null),F.return=L,L.child=F}function wp(L,F,W,$){var it=L.child;return L=it.sibling,W=Ka(it,{mode:"visible",children:W}),!(F.mode&1)&&(W.lanes=$),W.return=F,W.sibling=null,L!==null&&($=F.deletions,$===null?(F.deletions=[L],F.flags|=16):$.push(L)),F.child=W}function Ap(L,F,W,$,it){var lt=F.mode;L=L.child;var wt=L.sibling,Xt={mode:"hidden",children:W};return!(lt&1)&&F.child!==L?(W=F.child,W.childLanes=0,W.pendingProps=Xt,F.deletions=null):(W=Ka(L,Xt),W.subtreeFlags=L.subtreeFlags&14680064),wt!==null?$=Ka(wt,$):($=bo($,lt,it,null),$.flags|=2),$.return=F,W.return=F,W.sibling=$,F.child=W,$}function Hu(L,F,W,$){return $!==null&&Ga($),Gr(F,L.child,null,W),L=pc(F,F.pendingProps.children),L.flags|=2,F.memoizedState=null,L}function So(L,F,W){L.lanes|=F;var $=L.alternate;$!==null&&($.lanes|=F),Na(L.return,F,W)}function vc(L,F,W,$,it){var lt=L.memoizedState;lt===null?L.memoizedState={isBackwards:F,rendering:null,renderingStartTime:0,last:$,tail:W,tailMode:it}:(lt.isBackwards=F,lt.rendering=null,lt.renderingStartTime=0,lt.last=$,lt.tail=W,lt.tailMode=it)}function Pp(L,F,W){var $=F.pendingProps,it=$.revealOrder,lt=$.tail;if(Ln(L,F,$.children,W),$=ct.current,$&2)$=$&1|2,F.flags|=128;else{if(L!==null&&L.flags&128)t:for(L=F.child;L!==null;){if(L.tag===13)L.memoizedState!==null&&So(L,W,F);else if(L.tag===19)So(L,W,F);else if(L.child!==null){L.child.return=L,L=L.child;continue}if(L===F)break t;for(;L.sibling===null;){if(L.return===null||L.return===F)break t;L=L.return}L.sibling.return=L.return,L=L.sibling}$&=1}if(Se(ct,$),!(F.mode&1))F.memoizedState=null;else switch(it){case"forwards":for(W=F.child,it=null;W!==null;)L=W.alternate,L!==null&&St(L)===null&&(it=W),W=W.sibling;W=it,W===null?(it=F.child,F.child=null):(it=W.sibling,W.sibling=null),vc(F,!1,it,W,lt);break;case"backwards":for(W=null,it=F.child,F.child=null;it!==null;){if(L=it.alternate,L!==null&&St(L)===null){F.child=it;break}L=it.sibling,it.sibling=W,W=it,it=L}vc(F,!0,W,null,lt);break;case"together":vc(F,!1,null,null,void 0);break;default:F.memoizedState=null}return F.child}function qn(L,F,W){if(L!==null&&(F.dependencies=L.dependencies),Kl|=F.lanes,!(W&F.childLanes))return null;if(L!==null&&F.child!==L.child)throw Error(s(153));if(F.child!==null){for(L=F.child,W=Ka(L,L.pendingProps),F.child=W,W.return=F;L.sibling!==null;)L=L.sibling,W=W.sibling=Ka(L,L.pendingProps),W.return=F;W.sibling=null}return F.child}function Ig(L,F,W){switch(F.tag){case 3:Ep(F),vo();break;case 5:Nt(F);break;case 1:pn(F.type)&&Tn(F);break;case 4:pt(F,F.stateNode.containerInfo);break;case 10:Ol(F,F.type._context,F.memoizedProps.value);break;case 13:var $=F.memoizedState;if($!==null)return $.dehydrated!==null?(Se(ct,ct.current&1),F.flags|=128,null):W&F.child.childLanes?Cp(L,F,W):(Se(ct,ct.current&1),L=qn(L,F,W),L!==null?L.sibling:null);Se(ct,ct.current&1);break;case 19:if($=(W&F.childLanes)!==0,L.flags&128){if($)return Pp(L,F,W);F.flags|=128}var it=F.memoizedState;if(it!==null&&(it.rendering=null,it.tail=null,it.lastEffect=null),Se(ct,ct.current),$)break;return null;case 22:case 23:return F.lanes=0,xp(L,F,W)}return qn(L,F,W)}function Ng(L,F){switch(or(F),F.tag){case 1:return pn(F.type)&&Ki(),L=F.flags,L&65536?(F.flags=L&-65537|128,F):null;case 3:return Mt(),ti(un),ti(mi),Ft(),L=F.flags,L&65536&&!(L&128)?(F.flags=L&-65537|128,F):null;case 5:return zt(F),null;case 13:if(ti(ct),L=F.memoizedState,L!==null&&L.dehydrated!==null){if(F.alternate===null)throw Error(s(340));vo()}return L=F.flags,L&65536?(F.flags=L&-65537|128,F):null;case 19:return ti(ct),null;case 4:return Mt(),null;case 10:return Dl(F.type._context),null;case 22:case 23:return Rc(),null;case 24:return null;default:return null}}var Wu=!1,qo=!1,Bg=typeof WeakSet=="function"?WeakSet:Set,De=null;function Ih(L,F){var W=L.ref;if(W!==null)if(typeof W=="function")try{W(null)}catch($){Pr(L,F,$)}else W.current=null}function mc(L,F,W){try{W()}catch($){Pr(L,F,$)}}var Rp=!1;function gc(L,F){for(X(L.containerInfo),De=F;De!==null;)if(L=De,F=L.child,(L.subtreeFlags&1028)!==0&&F!==null)F.return=L,De=F;else for(;De!==null;){L=De;try{var W=L.alternate;if(L.flags&1024)switch(L.tag){case 0:case 11:case 15:break;case 1:if(W!==null){var $=W.memoizedProps,it=W.memoizedState,lt=L.stateNode,wt=lt.getSnapshotBeforeUpdate(L.elementType===L.type?$:Rn(L.type,$),it);lt.__reactInternalSnapshotBeforeUpdate=wt}break;case 3:ot&&Me(L.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(Xt){Pr(L,L.return,Xt)}if(F=L.sibling,F!==null){F.return=L.return,De=F;break}De=L.return}return W=Rp,Rp=!1,W}function Ks(L,F,W){var $=F.updateQueue;if($=$!==null?$.lastEffect:null,$!==null){var it=$=$.next;do{if((it.tag&L)===L){var lt=it.destroy;it.destroy=void 0,lt!==void 0&&mc(F,W,lt)}it=it.next}while(it!==$)}}function To(L,F){if(F=F.updateQueue,F=F!==null?F.lastEffect:null,F!==null){var W=F=F.next;do{if((W.tag&L)===L){var $=W.create;W.destroy=$()}W=W.next}while(W!==F)}}function yc(L){var F=L.ref;if(F!==null){var W=L.stateNode;switch(L.tag){case 5:L=B(W);break;default:L=W}typeof F=="function"?F(L):F.current=L}}function xc(L,F,W){if(xr&&typeof xr.onCommitFiberUnmount=="function")try{xr.onCommitFiberUnmount(fo,F)}catch{}switch(F.tag){case 0:case 11:case 14:case 15:if(L=F.updateQueue,L!==null&&(L=L.lastEffect,L!==null)){var $=L=L.next;do{var it=$,lt=it.destroy;it=it.tag,lt!==void 0&&(it&2||it&4)&&mc(F,W,lt),$=$.next}while($!==L)}break;case 1:if(Ih(F,W),L=F.stateNode,typeof L.componentWillUnmount=="function")try{L.props=F.memoizedProps,L.state=F.memoizedState,L.componentWillUnmount()}catch(wt){Pr(F,W,wt)}break;case 5:Ih(F,W);break;case 4:ot?Tc(L,F,W):rt&&rt&&(F=F.stateNode.containerInfo,W=Ve(F),Di(F,W))}}function bp(L,F,W){for(var $=F;;)if(xc(L,$,W),$.child===null||ot&&$.tag===4){if($===F)break;for(;$.sibling===null;){if($.return===null||$.return===F)return;$=$.return}$.sibling.return=$.return,$=$.sibling}else $.child.return=$,$=$.child}function pa(L){var F=L.alternate;F!==null&&(L.alternate=null,pa(F)),L.child=null,L.deletions=null,L.sibling=null,L.tag===5&&(F=L.stateNode,F!==null&&Pt(F)),L.stateNode=null,L.return=null,L.dependencies=null,L.memoizedProps=null,L.memoizedState=null,L.pendingProps=null,L.stateNode=null,L.updateQueue=null}function Xu(L){return L.tag===5||L.tag===3||L.tag===4}function Eo(L){t:for(;;){for(;L.sibling===null;){if(L.return===null||Xu(L.return))return null;L=L.return}for(L.sibling.return=L.return,L=L.sibling;L.tag!==5&&L.tag!==6&&L.tag!==18;){if(L.flags&2||L.child===null||L.tag===4)continue t;L.child.return=L,L=L.child}if(!(L.flags&2))return L.stateNode}}function ss(L){if(ot){t:{for(var F=L.return;F!==null;){if(Xu(F))break t;F=F.return}throw Error(s(160))}var W=F;switch(W.tag){case 5:F=W.stateNode,W.flags&32&&(ri(F),W.flags&=-33),W=Eo(L),Yu(L,W,F);break;case 3:case 4:F=W.stateNode.containerInfo,W=Eo(L),Sc(L,W,F);break;default:throw Error(s(161))}}}function Sc(L,F,W){var $=L.tag;if($===5||$===6)L=L.stateNode,F?Le(W,L,F):Ae(W,L);else if($!==4&&(L=L.child,L!==null))for(Sc(L,F,W),L=L.sibling;L!==null;)Sc(L,F,W),L=L.sibling}function Yu(L,F,W){var $=L.tag;if($===5||$===6)L=L.stateNode,F?Be(W,L,F):xe(W,L);else if($!==4&&(L=L.child,L!==null))for(Yu(L,F,W),L=L.sibling;L!==null;)Yu(L,F,W),L=L.sibling}function Tc(L,F,W){for(var $=F,it=!1,lt,wt;;){if(!it){it=$.return;t:for(;;){if(it===null)throw Error(s(160));switch(lt=it.stateNode,it.tag){case 5:wt=!1;break t;case 3:lt=lt.containerInfo,wt=!0;break t;case 4:lt=lt.containerInfo,wt=!0;break t}it=it.return}it=!0}if($.tag===5||$.tag===6)bp(L,$,W),wt?Ke(lt,$.stateNode):ie(lt,$.stateNode);else if($.tag===18)wt?te(lt,$.stateNode):ee(lt,$.stateNode);else if($.tag===4){if($.child!==null){lt=$.stateNode.containerInfo,wt=!0,$.child.return=$,$=$.child;continue}}else if(xc(L,$,W),$.child!==null){$.child.return=$,$=$.child;continue}if($===F)break;for(;$.sibling===null;){if($.return===null||$.return===F)return;$=$.return,$.tag===4&&(it=!1)}$.sibling.return=$.return,$=$.sibling}}function tl(L,F){if(ot){switch(F.tag){case 0:case 11:case 14:case 15:Ks(3,F,F.return),To(3,F),Ks(5,F,F.return);return;case 1:return;case 5:var W=F.stateNode;if(W!=null){var $=F.memoizedProps;L=L!==null?L.memoizedProps:$;var it=F.type,lt=F.updateQueue;F.updateQueue=null,lt!==null&&Oe(W,lt,it,L,$,F)}return;case 6:if(F.stateNode===null)throw Error(s(162));W=F.memoizedProps,qt(F.stateNode,L!==null?L.memoizedProps:W,W);return;case 3:gt&&L!==null&&L.memoizedState.isDehydrated&&jt(F.stateNode.containerInfo);return;case 12:return;case 13:js(F);return;case 19:js(F);return;case 17:return}throw Error(s(163))}switch(F.tag){case 0:case 11:case 14:case 15:Ks(3,F,F.return),To(3,F),Ks(5,F,F.return);return;case 12:return;case 13:js(F);return;case 19:js(F);return;case 3:gt&&L!==null&&L.memoizedState.isDehydrated&&jt(F.stateNode.containerInfo);break;case 22:case 23:return}t:if(rt){switch(F.tag){case 1:case 5:case 6:break t;case 3:case 4:F=F.stateNode,Di(F.containerInfo,F.pendingChildren);break t}throw Error(s(163))}}function js(L){var F=L.updateQueue;if(F!==null){L.updateQueue=null;var W=L.stateNode;W===null&&(W=L.stateNode=new Bg),F.forEach(function($){var it=Up.bind(null,L,$);W.has($)||(W.add($),$.then(it,it))})}}function Lp(L,F){for(De=F;De!==null;){F=De;var W=F.deletions;if(W!==null)for(var $=0;$";case Bh:return":has("+(Uh(L)||"")+")";case as:return'[role="'+L.value+'"]';case el:return'"'+L.value+'"';case Wl:return'[data-testname="'+L.value+'"]';default:throw Error(s(365))}}function Op(L,F){var W=[];L=[L,0];for(var $=0;$it&&(it=wt),$&=~lt}if($=it,$=nn()-$,$=(120>$?120:480>$?480:1080>$?1080:1920>$?1920:3e3>$?3e3:4320>$?4320:1960*zg($/1960))-$,10<$){L.timeoutHandle=J(wo.bind(null,L,Cr),$);break}wo(L,Cr);break;case 5:wo(L,Cr);break;default:throw Error(s(329))}}}return ei(L,nn()),L.callbackNode===W?Dp.bind(null,L):null}function Pc(L,F){var W=jl;return L.current.memoizedState.isDehydrated&&(ma(L,F).flags|=256),L=Ar(L,F),L!==2&&(F=Cr,Cr=W,F!==null&&nl(F)),L}function nl(L){Cr===null?Cr=L:Cr.push.apply(Cr,L)}function Ip(L){for(var F=L;;){if(F.flags&16384){var W=F.updateQueue;if(W!==null&&(W=W.stores,W!==null))for(var $=0;$L?16:L,ka===null)var $=!1;else{if(L=ka,ka=null,Vh=0,Ei&6)throw Error(s(331));var it=Ei;for(Ei|=4,De=L.current;De!==null;){var lt=De,wt=lt.child;if(De.flags&16){var Xt=lt.deletions;if(Xt!==null){for(var ae=0;aenn()-Ac?ma(L,0):wc|=W),ei(L,F)}function Bp(L,F){F===0&&(L.mode&1?(F=ho,ho<<=1,!(ho&130023424)&&(ho=4194304)):F=1);var W=wr();L=Jl(L,F),L!==null&&(Hs(L,F,W),ei(L,W))}function Ro(L){var F=L.memoizedState,W=0;F!==null&&(W=F.retryLane),Bp(L,W)}function Up(L,F){var W=0;switch(L.tag){case 13:var $=L.stateNode,it=L.memoizedState;it!==null&&(W=it.retryLane);break;case 19:$=L.stateNode;break;default:throw Error(s(314))}$!==null&&$.delete(F),Bp(L,W)}var Dc;Dc=function(L,F,W){if(L!==null)if(L.memoizedProps!==F.pendingProps||un.current)rs=!0;else{if(!(L.lanes&W)&&!(F.flags&128))return rs=!1,Ig(L,F,W);rs=!!(L.flags&131072)}else rs=!1,_i&&F.flags&1048576&&wh(F,Zo,F.index);switch(F.lanes=0,F.tag){case 2:var $=F.type;L!==null&&(L.alternate=null,F.alternate=null,F.flags|=2),L=F.pendingProps;var it=Gn(F,mi.current);Xs(F,W),it=me(null,F,$,L,it,W);var lt=be();return F.flags|=1,typeof it=="object"&&it!==null&&typeof it.render=="function"&&it.$$typeof===void 0?(F.tag=1,F.memoizedState=null,F.updateQueue=null,pn($)?(lt=!0,Tn(F)):lt=!1,F.memoizedState=it.state!==null&&it.state!==void 0?it.state:null,Vn(F),it.updater=co,F.stateNode=it,it._reactInternals=F,za(F,$,L,W),F=dc(null,F,$,!0,lt,W)):(F.tag=0,_i&<&&Bl(F),Ln(null,F,it,W),F=F.child),F;case 16:$=F.elementType;t:{switch(L!==null&&(L.alternate=null,F.alternate=null,F.flags|=2),L=F.pendingProps,it=$._init,$=it($._payload),F.type=$,it=F.tag=zp($),L=Rn($,L),it){case 0:F=ks(null,F,$,L,W);break t;case 1:F=Tp(null,F,$,L,W);break t;case 11:F=mp(null,F,$,L,W);break t;case 14:F=gp(null,F,$,Rn($.type,L),W);break t}throw Error(s(306,$,""))}return F;case 0:return $=F.type,it=F.pendingProps,it=F.elementType===$?it:Rn($,it),ks(L,F,$,it,W);case 1:return $=F.type,it=F.pendingProps,it=F.elementType===$?it:Rn($,it),Tp(L,F,$,it,W);case 3:t:{if(Ep(F),L===null)throw Error(s(387));$=F.pendingProps,lt=F.memoizedState,it=lt.element,Ba(L,F),Xr(F,$,null,W);var wt=F.memoizedState;if($=wt.element,gt&<.isDehydrated)if(lt={element:$,isDehydrated:!1,cache:wt.cache,transitions:wt.transitions},F.updateQueue.baseState=lt,F.memoizedState=lt,F.flags&256){it=Error(s(423)),F=Mp(L,F,$,W,it);break t}else if($!==it){it=Error(s(424)),F=Mp(L,F,$,W,it);break t}else for(gt&&(Hn=_r(F.stateNode.containerInfo),$n=F,_i=!0,is=null,po=!1),W=Ah(F,null,$,W),F.child=W;W;)W.flags=W.flags&-3|4096,W=W.sibling;else{if(vo(),$===it){F=qn(L,F,W);break t}Ln(L,F,$,W)}F=F.child}return F;case 5:return Nt(F),L===null&&cn(F),$=F.type,it=F.pendingProps,lt=L!==null?L.memoizedProps:null,wt=it.children,U($,it)?wt=null:lt!==null&&U($,lt)&&(F.flags|=32),Sp(L,F),Ln(L,F,wt,W),F.child;case 6:return L===null&&cn(F),null;case 13:return Cp(L,F,W);case 4:return pt(F,F.stateNode.containerInfo),$=F.pendingProps,L===null?F.child=Gr(F,null,$,W):Ln(L,F,$,W),F.child;case 11:return $=F.type,it=F.pendingProps,it=F.elementType===$?it:Rn($,it),mp(L,F,$,it,W);case 7:return Ln(L,F,F.pendingProps,W),F.child;case 8:return Ln(L,F,F.pendingProps.children,W),F.child;case 12:return Ln(L,F,F.pendingProps.children,W),F.child;case 10:t:{if($=F.type._context,it=F.pendingProps,lt=F.memoizedProps,wt=it.value,Ol(F,$,wt),lt!==null)if(Ts(lt.value,wt)){if(lt.children===it.children&&!un.current){F=qn(L,F,W);break t}}else for(lt=F.child,lt!==null&&(lt.return=F);lt!==null;){var Xt=lt.dependencies;if(Xt!==null){wt=lt.child;for(var ae=Xt.firstContext;ae!==null;){if(ae.context===$){if(lt.tag===1){ae=Mn(-1,W&-W),ae.tag=2;var Ee=lt.updateQueue;if(Ee!==null){Ee=Ee.shared;var He=Ee.pending;He===null?ae.next=ae:(ae.next=He.next,He.next=ae),Ee.pending=ae}}lt.lanes|=W,ae=lt.alternate,ae!==null&&(ae.lanes|=W),Na(lt.return,W,F),Xt.lanes|=W;break}ae=ae.next}}else if(lt.tag===10)wt=lt.type===F.type?null:lt.child;else if(lt.tag===18){if(wt=lt.return,wt===null)throw Error(s(341));wt.lanes|=W,Xt=wt.alternate,Xt!==null&&(Xt.lanes|=W),Na(wt,W,F),wt=lt.sibling}else wt=lt.child;if(wt!==null)wt.return=lt;else for(wt=lt;wt!==null;){if(wt===F){wt=null;break}if(lt=wt.sibling,lt!==null){lt.return=wt.return,wt=lt;break}wt=wt.return}lt=wt}Ln(L,F,it.children,W),F=F.child}return F;case 9:return it=F.type,$=F.pendingProps.children,Xs(F,W),it=$i(it),$=$(it),F.flags|=1,Ln(L,F,$,W),F.child;case 14:return $=F.type,it=Rn($,F.pendingProps),it=Rn($.type,it),gp(L,F,$,it,W);case 15:return yp(L,F,F.type,F.pendingProps,W);case 17:return $=F.type,it=F.pendingProps,it=F.elementType===$?it:Rn($,it),L!==null&&(L.alternate=null,F.alternate=null,F.flags|=2),F.tag=1,pn($)?(L=!0,Tn(F)):L=!1,Xs(F,W),Ko(F,$,it),za(F,$,it,W),dc(null,F,$,!0,L,W);case 19:return Pp(L,F,W);case 22:return xp(L,F,W)}throw Error(s(156,F.tag))};function tf(L,F){return Br(L,F)}function Gg(L,F,W,$){this.tag=L,this.key=W,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=F,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=$,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ps(L,F,W,$){return new Gg(L,F,W,$)}function Ic(L){return L=L.prototype,!(!L||!L.isReactComponent)}function zp(L){if(typeof L=="function")return Ic(L)?1:0;if(L!=null){if(L=L.$$typeof,L===u)return 11;if(L===c)return 14}return 2}function Ka(L,F){var W=L.alternate;return W===null?(W=Ps(L.tag,F,L.key,L.mode),W.elementType=L.elementType,W.type=L.type,W.stateNode=L.stateNode,W.alternate=L,L.alternate=W):(W.pendingProps=F,W.type=L.type,W.flags=0,W.subtreeFlags=0,W.deletions=null),W.flags=L.flags&14680064,W.childLanes=L.childLanes,W.lanes=L.lanes,W.child=L.child,W.memoizedProps=L.memoizedProps,W.memoizedState=L.memoizedState,W.updateQueue=L.updateQueue,F=L.dependencies,W.dependencies=F===null?null:{lanes:F.lanes,firstContext:F.firstContext},W.sibling=L.sibling,W.index=L.index,W.ref=L.ref,W}function ef(L,F,W,$,it,lt){var wt=2;if($=L,typeof L=="function")Ic(L)&&(wt=1);else if(typeof L=="string")wt=5;else t:switch(L){case p:return bo(W.children,it,lt,F);case h:wt=8,it|=8;break;case a:return L=Ps(12,W,F,it|2),L.elementType=a,L.lanes=lt,L;case f:return L=Ps(13,W,F,it),L.elementType=f,L.lanes=lt,L;case o:return L=Ps(19,W,F,it),L.elementType=o,L.lanes=lt,L;case v:return Xh(W,it,lt,F);default:if(typeof L=="object"&&L!==null)switch(L.$$typeof){case l:wt=10;break t;case n:wt=9;break t;case u:wt=11;break t;case c:wt=14;break t;case d:wt=16,$=null;break t}throw Error(s(130,L==null?L:typeof L,""))}return F=Ps(wt,W,F,it),F.elementType=L,F.type=$,F.lanes=lt,F}function bo(L,F,W,$){return L=Ps(7,L,$,F),L.lanes=W,L}function Xh(L,F,W,$){return L=Ps(22,L,$,F),L.elementType=v,L.lanes=W,L.stateNode={},L}function Rr(L,F,W){return L=Ps(6,L,null,F),L.lanes=W,L}function Rs(L,F,W){return F=Ps(4,L.children!==null?L.children:[],L.key,F),F.lanes=W,F.stateNode={containerInfo:L.containerInfo,pendingChildren:null,implementation:L.implementation},F}function Vg(L,F,W,$,it){this.tag=F,this.containerInfo=L,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=q,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vs(0),this.expirationTimes=Vs(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vs(0),this.identifierPrefix=$,this.onRecoverableError=it,gt&&(this.mutableSourceEagerHydrationData=null)}function Gp(L,F,W,$,it,lt,wt,Xt,ae){return L=new Vg(L,F,W,Xt,ae),F===1?(F=1,lt===!0&&(F|=8)):F=0,lt=Ps(3,null,null,F),L.current=lt,lt.stateNode=L,lt.memoizedState={element:$,isDehydrated:W,cache:null,transitions:null},Vn(lt),L}function Yh(L){if(!L)return Nr;L=L._reactInternals;t:{if(C(L)!==L||L.tag!==1)throw Error(s(170));var F=L;do{switch(F.tag){case 3:F=F.stateNode.context;break t;case 1:if(pn(F.type)){F=F.stateNode.__reactInternalMemoizedMergedChildContext;break t}}F=F.return}while(F!==null);throw Error(s(171))}if(L.tag===1){var W=L.type;if(pn(W))return zs(L,W,F)}return F}function rl(L){var F=L._reactInternals;if(F===void 0)throw typeof L.render=="function"?Error(s(188)):(L=Object.keys(L).join(","),Error(s(268,L)));return L=b(F),L===null?null:L.stateNode}function Nc(L,F){if(L=L.memoizedState,L!==null&&L.dehydrated!==null){var W=L.retryLane;L.retryLane=W!==0&&W=Ee&<>=vi&&it<=He&&wt<=Qe){L.splice(F,1);break}else if($!==Ee||W.width!==ae.width||Qewt){if(!(lt!==vi||W.height!==ae.height||He<$||Ee>it)){Ee>$&&(ae.width+=Ee-$,ae.x=$),Helt&&(ae.height+=vi-lt,ae.y=lt),QeW&&(W=wt)),wtzh&&(F.flags|=128,$=!0,Mr(it,!1),F.lanes=4194304)}else{if(!$)if(L=St(lt),L!==null){if(F.flags|=128,$=!0,L=L.updateQueue,L!==null&&(F.updateQueue=L,F.flags|=4),Mr(it,!0),it.tail===null&&it.tailMode==="hidden"&&!lt.alternate&&!_i)return ni(F),null}else 2*nn()-it.renderingStartTime>zh&&W!==1073741824&&(F.flags|=128,$=!0,Mr(it,!1),F.lanes=4194304);it.isBackwards?(lt.sibling=F.child,F.child=lt):(L=it.last,L!==null?L.sibling=lt:F.child=lt,it.last=lt)}return it.tail!==null?(F=it.tail,it.rendering=F,it.tail=F.sibling,it.renderingStartTime=nn(),F.sibling=null,L=ct.current,Se(ct,$?L&1|2:L&1),F):(ni(F),null);case 22:case 23:return Rc(),$=F.memoizedState!==null,L!==null&&L.memoizedState!==null!==$&&(F.flags|=8192),$&&F.mode&1?os&1073741824&&(ni(F),ot&&F.subtreeFlags&6&&(F.flags|=8192)):ni(F),null;case 24:return null;case 25:return null}throw Error(s(156,F.tag))}var Ig=y.ReactCurrentOwner,rs=!1;function Ln(L,F,W,$){F.child=L===null?Ah(F,null,W,$):Gr(F,L.child,W,$)}function gp(L,F,W,$,it){W=W.render;var lt=F.ref;return Xs(F,it),$=me(L,F,W,$,lt,it),W=be(),L!==null&&!rs?(F.updateQueue=L.updateQueue,F.flags&=-2053,L.lanes&=~it,qn(L,F,it)):(_i&&W&&Bl(F),F.flags|=1,Ln(L,F,$,it),F.child)}function yp(L,F,W,$,it){if(L===null){var lt=W.type;return typeof lt=="function"&&!Ic(lt)&<.defaultProps===void 0&&W.compare===null&&W.defaultProps===void 0?(F.tag=15,F.type=lt,xp(L,F,lt,$,it)):(L=tf(W.type,null,$,F,F.mode,it),L.ref=F.ref,L.return=F,F.child=L)}if(lt=L.child,!(L.lanes&it)){var wt=lt.memoizedProps;if(W=W.compare,W=W!==null?W:yn,W(wt,$)&&L.ref===F.ref)return qn(L,F,it)}return F.flags|=1,L=ja(lt,$),L.ref=F.ref,L.return=F,F.child=L}function xp(L,F,W,$,it){if(L!==null&&yn(L.memoizedProps,$)&&L.ref===F.ref)if(rs=!1,(L.lanes&it)!==0)L.flags&131072&&(rs=!0);else return F.lanes=L.lanes,qn(L,F,it);return ks(L,F,W,$,it)}function Sp(L,F,W){var $=F.pendingProps,it=$.children,lt=L!==null?L.memoizedState:null;if($.mode==="hidden")if(!(F.mode&1))F.memoizedState={baseLanes:0,cachePool:null},Se(Yl,os),os|=W;else if(W&1073741824)F.memoizedState={baseLanes:0,cachePool:null},$=lt!==null?lt.baseLanes:W,Se(Yl,os),os|=$;else return L=lt!==null?lt.baseLanes|W:W,F.lanes=F.childLanes=1073741824,F.memoizedState={baseLanes:L,cachePool:null},F.updateQueue=null,Se(Yl,os),os|=L,null;else lt!==null?($=lt.baseLanes|W,F.memoizedState=null):$=W,Se(Yl,os),os|=$;return Ln(L,F,it,W),F.child}function Tp(L,F){var W=F.ref;(L===null&&W!==null||L!==null&&L.ref!==W)&&(F.flags|=512,F.flags|=2097152)}function ks(L,F,W,$,it){var lt=pn(W)?Ii:mi.current;return lt=Gn(F,lt),Xs(F,it),W=me(L,F,W,$,lt,it),$=be(),L!==null&&!rs?(F.updateQueue=L.updateQueue,F.flags&=-2053,L.lanes&=~it,qn(L,F,it)):(_i&&$&&Bl(F),F.flags|=1,Ln(L,F,W,it),F.child)}function Ep(L,F,W,$,it){if(pn(W)){var lt=!0;Tn(F)}else lt=!1;if(Xs(F,it),F.stateNode===null)L!==null&&(L.alternate=null,F.alternate=null,F.flags|=2),Ko(F,W,$),za(F,W,$,it),$=!0;else if(L===null){var wt=F.stateNode,Xt=F.memoizedProps;wt.props=Xt;var oe=wt.context,Ee=W.contextType;typeof Ee=="object"&&Ee!==null?Ee=$i(Ee):(Ee=pn(W)?Ii:mi.current,Ee=Gn(F,Ee));var He=W.getDerivedStateFromProps,vi=typeof He=="function"||typeof wt.getSnapshotBeforeUpdate=="function";vi||typeof wt.UNSAFE_componentWillReceiveProps!="function"&&typeof wt.componentWillReceiveProps!="function"||(Xt!==$||oe!==Ee)&&Zo(F,wt,$,Ee),xn=!1;var Qe=F.memoizedState;wt.state=Qe,Xr(F,$,wt,it),oe=F.memoizedState,Xt!==$||Qe!==oe||un.current||xn?(typeof He=="function"&&(qr(F,W,He,$),oe=F.memoizedState),(Xt=xn||Nl(F,W,Xt,$,Qe,oe,Ee))?(vi||typeof wt.UNSAFE_componentWillMount!="function"&&typeof wt.componentWillMount!="function"||(typeof wt.componentWillMount=="function"&&wt.componentWillMount(),typeof wt.UNSAFE_componentWillMount=="function"&&wt.UNSAFE_componentWillMount()),typeof wt.componentDidMount=="function"&&(F.flags|=4194308)):(typeof wt.componentDidMount=="function"&&(F.flags|=4194308),F.memoizedProps=$,F.memoizedState=oe),wt.props=$,wt.state=oe,wt.context=Ee,$=Xt):(typeof wt.componentDidMount=="function"&&(F.flags|=4194308),$=!1)}else{wt=F.stateNode,Ba(L,F),Xt=F.memoizedProps,Ee=F.type===F.elementType?Xt:Rn(F.type,Xt),wt.props=Ee,vi=F.pendingProps,Qe=wt.context,oe=W.contextType,typeof oe=="object"&&oe!==null?oe=$i(oe):(oe=pn(W)?Ii:mi.current,oe=Gn(F,oe));var qi=W.getDerivedStateFromProps;(He=typeof qi=="function"||typeof wt.getSnapshotBeforeUpdate=="function")||typeof wt.UNSAFE_componentWillReceiveProps!="function"&&typeof wt.componentWillReceiveProps!="function"||(Xt!==vi||Qe!==oe)&&Zo(F,wt,$,oe),xn=!1,Qe=F.memoizedState,wt.state=Qe,Xr(F,$,wt,it);var Xe=F.memoizedState;Xt!==vi||Qe!==Xe||un.current||xn?(typeof qi=="function"&&(qr(F,W,qi,$),Xe=F.memoizedState),(Ee=xn||Nl(F,W,Ee,$,Qe,Xe,oe)||!1)?(He||typeof wt.UNSAFE_componentWillUpdate!="function"&&typeof wt.componentWillUpdate!="function"||(typeof wt.componentWillUpdate=="function"&&wt.componentWillUpdate($,Xe,oe),typeof wt.UNSAFE_componentWillUpdate=="function"&&wt.UNSAFE_componentWillUpdate($,Xe,oe)),typeof wt.componentDidUpdate=="function"&&(F.flags|=4),typeof wt.getSnapshotBeforeUpdate=="function"&&(F.flags|=1024)):(typeof wt.componentDidUpdate!="function"||Xt===L.memoizedProps&&Qe===L.memoizedState||(F.flags|=4),typeof wt.getSnapshotBeforeUpdate!="function"||Xt===L.memoizedProps&&Qe===L.memoizedState||(F.flags|=1024),F.memoizedProps=$,F.memoizedState=Xe),wt.props=$,wt.state=Xe,wt.context=oe,$=Ee):(typeof wt.componentDidUpdate!="function"||Xt===L.memoizedProps&&Qe===L.memoizedState||(F.flags|=4),typeof wt.getSnapshotBeforeUpdate!="function"||Xt===L.memoizedProps&&Qe===L.memoizedState||(F.flags|=1024),$=!1)}return dc(L,F,W,$,lt,it)}function dc(L,F,W,$,it,lt){Tp(L,F);var wt=(F.flags&128)!==0;if(!$&&!wt)return it&&oa(F,W,!1),qn(L,F,lt);$=F.stateNode,Ig.current=F;var Xt=wt&&typeof W.getDerivedStateFromError!="function"?null:$.render();return F.flags|=1,L!==null&&wt?(F.child=Gr(F,L.child,null,lt),F.child=Gr(F,null,Xt,lt)):Ln(L,F,Xt,lt),F.memoizedState=$.state,it&&oa(F,W,!0),F.child}function Mp(L){var F=L.stateNode;F.pendingContext?dr(L,F.pendingContext,F.pendingContext!==F.context):F.context&&dr(L,F.context,!1),pt(L,F.containerInfo)}function Cp(L,F,W,$,it){return vo(),Ga(it),F.flags|=256,Ln(L,F,W,$),F.child}var Gu={dehydrated:null,treeContext:null,retryLane:0};function ws(L){return{baseLanes:L,cachePool:null}}function wp(L,F,W){var $=F.pendingProps,it=ct.current,lt=!1,wt=(F.flags&128)!==0,Xt;if((Xt=wt)||(Xt=L!==null&&L.memoizedState===null?!1:(it&2)!==0),Xt?(lt=!0,F.flags&=-129):(L===null||L.memoizedState!==null)&&(it|=1),Se(ct,it&1),L===null)return cn(F),L=F.memoizedState,L!==null&&(L=L.dehydrated,L!==null)?(F.mode&1?aa(L)?F.lanes=8:F.lanes=1073741824:F.lanes=1,null):(it=$.children,L=$.fallback,lt?($=F.mode,lt=F.child,it={mode:"hidden",children:it},!($&1)&<!==null?(lt.childLanes=0,lt.pendingProps=it):lt=Xh(it,$,0,null),L=bo(L,$,W,null),lt.return=F,L.return=F,lt.sibling=L,F.child=lt,F.child.memoizedState=ws(W),F.memoizedState=Gu,L):pc(F,it));if(it=L.memoizedState,it!==null){if(Xt=it.dehydrated,Xt!==null){if(wt)return F.flags&256?(F.flags&=-257,Vu(L,F,W,Error(s(422)))):F.memoizedState!==null?(F.child=L.child,F.flags|=128,null):(lt=$.fallback,it=F.mode,$=Xh({mode:"visible",children:$.children},it,0,null),lt=bo(lt,it,W,null),lt.flags|=2,$.return=F,lt.return=F,$.sibling=lt,F.child=$,F.mode&1&&Gr(F,L.child,null,W),F.child.memoizedState=ws(W),F.memoizedState=Gu,lt);if(!(F.mode&1))F=Vu(L,F,W,null);else if(aa(Xt))F=Vu(L,F,W,Error(s(419)));else if($=(W&L.childLanes)!==0,rs||$){if($=Wn,$!==null){switch(W&-W){case 4:lt=2;break;case 16:lt=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:lt=32;break;case 536870912:lt=268435456;break;default:lt=0}$=lt&($.suspendedLanes|W)?0:lt,$!==0&&$!==it.retryLane&&(it.retryLane=$,As(L,$,-1))}Qu(),F=Vu(L,F,W,Error(s(421)))}else Pa(Xt)?(F.flags|=128,F.child=L.child,F=Ro.bind(null,L),Bs(Xt,F),F=null):(W=it.treeContext,gt&&(Hn=Us(Xt),$n=F,_i=!0,is=null,po=!1,W!==null&&(sr[ar++]=Es,sr[ar++]=es,sr[ar++]=fa,Es=W.id,es=W.overflow,fa=F)),F=pc(F,F.pendingProps.children),F.flags|=4096);return F}return lt?($=Pp(L,F,$.children,$.fallback,W),lt=F.child,it=L.child.memoizedState,lt.memoizedState=it===null?ws(W):{baseLanes:it.baseLanes|W,cachePool:null},lt.childLanes=L.childLanes&~W,F.memoizedState=Gu,$):(W=Ap(L,F,$.children,W),F.memoizedState=null,W)}return lt?($=Pp(L,F,$.children,$.fallback,W),lt=F.child,it=L.child.memoizedState,lt.memoizedState=it===null?ws(W):{baseLanes:it.baseLanes|W,cachePool:null},lt.childLanes=L.childLanes&~W,F.memoizedState=Gu,$):(W=Ap(L,F,$.children,W),F.memoizedState=null,W)}function pc(L,F){return F=Xh({mode:"visible",children:F},L.mode,0,null),F.return=L,L.child=F}function Ap(L,F,W,$){var it=L.child;return L=it.sibling,W=ja(it,{mode:"visible",children:W}),!(F.mode&1)&&(W.lanes=$),W.return=F,W.sibling=null,L!==null&&($=F.deletions,$===null?(F.deletions=[L],F.flags|=16):$.push(L)),F.child=W}function Pp(L,F,W,$,it){var lt=F.mode;L=L.child;var wt=L.sibling,Xt={mode:"hidden",children:W};return!(lt&1)&&F.child!==L?(W=F.child,W.childLanes=0,W.pendingProps=Xt,F.deletions=null):(W=ja(L,Xt),W.subtreeFlags=L.subtreeFlags&14680064),wt!==null?$=ja(wt,$):($=bo($,lt,it,null),$.flags|=2),$.return=F,W.return=F,W.sibling=$,F.child=W,$}function Vu(L,F,W,$){return $!==null&&Ga($),Gr(F,L.child,null,W),L=pc(F,F.pendingProps.children),L.flags|=2,F.memoizedState=null,L}function So(L,F,W){L.lanes|=F;var $=L.alternate;$!==null&&($.lanes|=F),Na(L.return,F,W)}function vc(L,F,W,$,it){var lt=L.memoizedState;lt===null?L.memoizedState={isBackwards:F,rendering:null,renderingStartTime:0,last:$,tail:W,tailMode:it}:(lt.isBackwards=F,lt.rendering=null,lt.renderingStartTime=0,lt.last=$,lt.tail=W,lt.tailMode=it)}function Rp(L,F,W){var $=F.pendingProps,it=$.revealOrder,lt=$.tail;if(Ln(L,F,$.children,W),$=ct.current,$&2)$=$&1|2,F.flags|=128;else{if(L!==null&&L.flags&128)t:for(L=F.child;L!==null;){if(L.tag===13)L.memoizedState!==null&&So(L,W,F);else if(L.tag===19)So(L,W,F);else if(L.child!==null){L.child.return=L,L=L.child;continue}if(L===F)break t;for(;L.sibling===null;){if(L.return===null||L.return===F)break t;L=L.return}L.sibling.return=L.return,L=L.sibling}$&=1}if(Se(ct,$),!(F.mode&1))F.memoizedState=null;else switch(it){case"forwards":for(W=F.child,it=null;W!==null;)L=W.alternate,L!==null&&St(L)===null&&(it=W),W=W.sibling;W=it,W===null?(it=F.child,F.child=null):(it=W.sibling,W.sibling=null),vc(F,!1,it,W,lt);break;case"backwards":for(W=null,it=F.child,F.child=null;it!==null;){if(L=it.alternate,L!==null&&St(L)===null){F.child=it;break}L=it.sibling,it.sibling=W,W=it,it=L}vc(F,!0,W,null,lt);break;case"together":vc(F,!1,null,null,void 0);break;default:F.memoizedState=null}return F.child}function qn(L,F,W){if(L!==null&&(F.dependencies=L.dependencies),jl|=F.lanes,!(W&F.childLanes))return null;if(L!==null&&F.child!==L.child)throw Error(s(153));if(F.child!==null){for(L=F.child,W=ja(L,L.pendingProps),F.child=W,W.return=F;L.sibling!==null;)L=L.sibling,W=W.sibling=ja(L,L.pendingProps),W.return=F;W.sibling=null}return F.child}function Ng(L,F,W){switch(F.tag){case 3:Mp(F),vo();break;case 5:Nt(F);break;case 1:pn(F.type)&&Tn(F);break;case 4:pt(F,F.stateNode.containerInfo);break;case 10:Ol(F,F.type._context,F.memoizedProps.value);break;case 13:var $=F.memoizedState;if($!==null)return $.dehydrated!==null?(Se(ct,ct.current&1),F.flags|=128,null):W&F.child.childLanes?wp(L,F,W):(Se(ct,ct.current&1),L=qn(L,F,W),L!==null?L.sibling:null);Se(ct,ct.current&1);break;case 19:if($=(W&F.childLanes)!==0,L.flags&128){if($)return Rp(L,F,W);F.flags|=128}var it=F.memoizedState;if(it!==null&&(it.rendering=null,it.tail=null,it.lastEffect=null),Se(ct,ct.current),$)break;return null;case 22:case 23:return F.lanes=0,Sp(L,F,W)}return qn(L,F,W)}function Bg(L,F){switch(or(F),F.tag){case 1:return pn(F.type)&&ji(),L=F.flags,L&65536?(F.flags=L&-65537|128,F):null;case 3:return Mt(),ti(un),ti(mi),Ft(),L=F.flags,L&65536&&!(L&128)?(F.flags=L&-65537|128,F):null;case 5:return zt(F),null;case 13:if(ti(ct),L=F.memoizedState,L!==null&&L.dehydrated!==null){if(F.alternate===null)throw Error(s(340));vo()}return L=F.flags,L&65536?(F.flags=L&-65537|128,F):null;case 19:return ti(ct),null;case 4:return Mt(),null;case 10:return Dl(F.type._context),null;case 22:case 23:return Rc(),null;case 24:return null;default:return null}}var Hu=!1,tl=!1,Ug=typeof WeakSet=="function"?WeakSet:Set,De=null;function Ih(L,F){var W=L.ref;if(W!==null)if(typeof W=="function")try{W(null)}catch($){Pr(L,F,$)}else W.current=null}function mc(L,F,W){try{W()}catch($){Pr(L,F,$)}}var bp=!1;function gc(L,F){for(X(L.containerInfo),De=F;De!==null;)if(L=De,F=L.child,(L.subtreeFlags&1028)!==0&&F!==null)F.return=L,De=F;else for(;De!==null;){L=De;try{var W=L.alternate;if(L.flags&1024)switch(L.tag){case 0:case 11:case 15:break;case 1:if(W!==null){var $=W.memoizedProps,it=W.memoizedState,lt=L.stateNode,wt=lt.getSnapshotBeforeUpdate(L.elementType===L.type?$:Rn(L.type,$),it);lt.__reactInternalSnapshotBeforeUpdate=wt}break;case 3:ot&&Me(L.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(Xt){Pr(L,L.return,Xt)}if(F=L.sibling,F!==null){F.return=L.return,De=F;break}De=L.return}return W=bp,bp=!1,W}function js(L,F,W){var $=F.updateQueue;if($=$!==null?$.lastEffect:null,$!==null){var it=$=$.next;do{if((it.tag&L)===L){var lt=it.destroy;it.destroy=void 0,lt!==void 0&&mc(F,W,lt)}it=it.next}while(it!==$)}}function To(L,F){if(F=F.updateQueue,F=F!==null?F.lastEffect:null,F!==null){var W=F=F.next;do{if((W.tag&L)===L){var $=W.create;W.destroy=$()}W=W.next}while(W!==F)}}function yc(L){var F=L.ref;if(F!==null){var W=L.stateNode;switch(L.tag){case 5:L=B(W);break;default:L=W}typeof F=="function"?F(L):F.current=L}}function xc(L,F,W){if(xr&&typeof xr.onCommitFiberUnmount=="function")try{xr.onCommitFiberUnmount(fo,F)}catch{}switch(F.tag){case 0:case 11:case 14:case 15:if(L=F.updateQueue,L!==null&&(L=L.lastEffect,L!==null)){var $=L=L.next;do{var it=$,lt=it.destroy;it=it.tag,lt!==void 0&&(it&2||it&4)&&mc(F,W,lt),$=$.next}while($!==L)}break;case 1:if(Ih(F,W),L=F.stateNode,typeof L.componentWillUnmount=="function")try{L.props=F.memoizedProps,L.state=F.memoizedState,L.componentWillUnmount()}catch(wt){Pr(F,W,wt)}break;case 5:Ih(F,W);break;case 4:ot?Tc(L,F,W):rt&&rt&&(F=F.stateNode.containerInfo,W=Ve(F),Di(F,W))}}function Lp(L,F,W){for(var $=F;;)if(xc(L,$,W),$.child===null||ot&&$.tag===4){if($===F)break;for(;$.sibling===null;){if($.return===null||$.return===F)return;$=$.return}$.sibling.return=$.return,$=$.sibling}else $.child.return=$,$=$.child}function pa(L){var F=L.alternate;F!==null&&(L.alternate=null,pa(F)),L.child=null,L.deletions=null,L.sibling=null,L.tag===5&&(F=L.stateNode,F!==null&&Pt(F)),L.stateNode=null,L.return=null,L.dependencies=null,L.memoizedProps=null,L.memoizedState=null,L.pendingProps=null,L.stateNode=null,L.updateQueue=null}function Wu(L){return L.tag===5||L.tag===3||L.tag===4}function Eo(L){t:for(;;){for(;L.sibling===null;){if(L.return===null||Wu(L.return))return null;L=L.return}for(L.sibling.return=L.return,L=L.sibling;L.tag!==5&&L.tag!==6&&L.tag!==18;){if(L.flags&2||L.child===null||L.tag===4)continue t;L.child.return=L,L=L.child}if(!(L.flags&2))return L.stateNode}}function ss(L){if(ot){t:{for(var F=L.return;F!==null;){if(Wu(F))break t;F=F.return}throw Error(s(160))}var W=F;switch(W.tag){case 5:F=W.stateNode,W.flags&32&&(ri(F),W.flags&=-33),W=Eo(L),Xu(L,W,F);break;case 3:case 4:F=W.stateNode.containerInfo,W=Eo(L),Sc(L,W,F);break;default:throw Error(s(161))}}}function Sc(L,F,W){var $=L.tag;if($===5||$===6)L=L.stateNode,F?Le(W,L,F):Pe(W,L);else if($!==4&&(L=L.child,L!==null))for(Sc(L,F,W),L=L.sibling;L!==null;)Sc(L,F,W),L=L.sibling}function Xu(L,F,W){var $=L.tag;if($===5||$===6)L=L.stateNode,F?Be(W,L,F):xe(W,L);else if($!==4&&(L=L.child,L!==null))for(Xu(L,F,W),L=L.sibling;L!==null;)Xu(L,F,W),L=L.sibling}function Tc(L,F,W){for(var $=F,it=!1,lt,wt;;){if(!it){it=$.return;t:for(;;){if(it===null)throw Error(s(160));switch(lt=it.stateNode,it.tag){case 5:wt=!1;break t;case 3:lt=lt.containerInfo,wt=!0;break t;case 4:lt=lt.containerInfo,wt=!0;break t}it=it.return}it=!0}if($.tag===5||$.tag===6)Lp(L,$,W),wt?je(lt,$.stateNode):ne(lt,$.stateNode);else if($.tag===18)wt?ee(lt,$.stateNode):ie(lt,$.stateNode);else if($.tag===4){if($.child!==null){lt=$.stateNode.containerInfo,wt=!0,$.child.return=$,$=$.child;continue}}else if(xc(L,$,W),$.child!==null){$.child.return=$,$=$.child;continue}if($===F)break;for(;$.sibling===null;){if($.return===null||$.return===F)return;$=$.return,$.tag===4&&(it=!1)}$.sibling.return=$.return,$=$.sibling}}function el(L,F){if(ot){switch(F.tag){case 0:case 11:case 14:case 15:js(3,F,F.return),To(3,F),js(5,F,F.return);return;case 1:return;case 5:var W=F.stateNode;if(W!=null){var $=F.memoizedProps;L=L!==null?L.memoizedProps:$;var it=F.type,lt=F.updateQueue;F.updateQueue=null,lt!==null&&Oe(W,lt,it,L,$,F)}return;case 6:if(F.stateNode===null)throw Error(s(162));W=F.memoizedProps,te(F.stateNode,L!==null?L.memoizedProps:W,W);return;case 3:gt&&L!==null&&L.memoizedState.isDehydrated&&Kt(F.stateNode.containerInfo);return;case 12:return;case 13:Ks(F);return;case 19:Ks(F);return;case 17:return}throw Error(s(163))}switch(F.tag){case 0:case 11:case 14:case 15:js(3,F,F.return),To(3,F),js(5,F,F.return);return;case 12:return;case 13:Ks(F);return;case 19:Ks(F);return;case 3:gt&&L!==null&&L.memoizedState.isDehydrated&&Kt(F.stateNode.containerInfo);break;case 22:case 23:return}t:if(rt){switch(F.tag){case 1:case 5:case 6:break t;case 3:case 4:F=F.stateNode,Di(F.containerInfo,F.pendingChildren);break t}throw Error(s(163))}}function Ks(L){var F=L.updateQueue;if(F!==null){L.updateQueue=null;var W=L.stateNode;W===null&&(W=L.stateNode=new Ug),F.forEach(function($){var it=zp.bind(null,L,$);W.has($)||(W.add($),$.then(it,it))})}}function Fp(L,F){for(De=F;De!==null;){F=De;var W=F.deletions;if(W!==null)for(var $=0;$";case Bh:return":has("+(Uh(L)||"")+")";case as:return'[role="'+L.value+'"]';case il:return'"'+L.value+'"';case Wl:return'[data-testname="'+L.value+'"]';default:throw Error(s(365))}}function Dp(L,F){var W=[];L=[L,0];for(var $=0;$it&&(it=wt),$&=~lt}if($=it,$=nn()-$,$=(120>$?120:480>$?480:1080>$?1080:1920>$?1920:3e3>$?3e3:4320>$?4320:1960*Gg($/1960))-$,10<$){L.timeoutHandle=J(wo.bind(null,L,Cr),$);break}wo(L,Cr);break;case 5:wo(L,Cr);break;default:throw Error(s(329))}}}return ei(L,nn()),L.callbackNode===W?Ip.bind(null,L):null}function Pc(L,F){var W=Kl;return L.current.memoizedState.isDehydrated&&(ma(L,F).flags|=256),L=Ar(L,F),L!==2&&(F=Cr,Cr=W,F!==null&&rl(F)),L}function rl(L){Cr===null?Cr=L:Cr.push.apply(Cr,L)}function Np(L){for(var F=L;;){if(F.flags&16384){var W=F.updateQueue;if(W!==null&&(W=W.stores,W!==null))for(var $=0;$L?16:L,ka===null)var $=!1;else{if(L=ka,ka=null,Vh=0,Mi&6)throw Error(s(331));var it=Mi;for(Mi|=4,De=L.current;De!==null;){var lt=De,wt=lt.child;if(De.flags&16){var Xt=lt.deletions;if(Xt!==null){for(var oe=0;oenn()-Ac?ma(L,0):wc|=W),ei(L,F)}function Up(L,F){F===0&&(L.mode&1?(F=ho,ho<<=1,!(ho&130023424)&&(ho=4194304)):F=1);var W=wr();L=Jl(L,F),L!==null&&(Hs(L,F,W),ei(L,W))}function Ro(L){var F=L.memoizedState,W=0;F!==null&&(W=F.retryLane),Up(L,W)}function zp(L,F){var W=0;switch(L.tag){case 13:var $=L.stateNode,it=L.memoizedState;it!==null&&(W=it.retryLane);break;case 19:$=L.stateNode;break;default:throw Error(s(314))}$!==null&&$.delete(F),Up(L,W)}var Dc;Dc=function(L,F,W){if(L!==null)if(L.memoizedProps!==F.pendingProps||un.current)rs=!0;else{if(!(L.lanes&W)&&!(F.flags&128))return rs=!1,Ng(L,F,W);rs=!!(L.flags&131072)}else rs=!1,_i&&F.flags&1048576&&wh(F,Jo,F.index);switch(F.lanes=0,F.tag){case 2:var $=F.type;L!==null&&(L.alternate=null,F.alternate=null,F.flags|=2),L=F.pendingProps;var it=Gn(F,mi.current);Xs(F,W),it=me(null,F,$,L,it,W);var lt=be();return F.flags|=1,typeof it=="object"&&it!==null&&typeof it.render=="function"&&it.$$typeof===void 0?(F.tag=1,F.memoizedState=null,F.updateQueue=null,pn($)?(lt=!0,Tn(F)):lt=!1,F.memoizedState=it.state!==null&&it.state!==void 0?it.state:null,Vn(F),it.updater=co,F.stateNode=it,it._reactInternals=F,za(F,$,L,W),F=dc(null,F,$,!0,lt,W)):(F.tag=0,_i&<&&Bl(F),Ln(null,F,it,W),F=F.child),F;case 16:$=F.elementType;t:{switch(L!==null&&(L.alternate=null,F.alternate=null,F.flags|=2),L=F.pendingProps,it=$._init,$=it($._payload),F.type=$,it=F.tag=Gp($),L=Rn($,L),it){case 0:F=ks(null,F,$,L,W);break t;case 1:F=Ep(null,F,$,L,W);break t;case 11:F=gp(null,F,$,L,W);break t;case 14:F=yp(null,F,$,Rn($.type,L),W);break t}throw Error(s(306,$,""))}return F;case 0:return $=F.type,it=F.pendingProps,it=F.elementType===$?it:Rn($,it),ks(L,F,$,it,W);case 1:return $=F.type,it=F.pendingProps,it=F.elementType===$?it:Rn($,it),Ep(L,F,$,it,W);case 3:t:{if(Mp(F),L===null)throw Error(s(387));$=F.pendingProps,lt=F.memoizedState,it=lt.element,Ba(L,F),Xr(F,$,null,W);var wt=F.memoizedState;if($=wt.element,gt&<.isDehydrated)if(lt={element:$,isDehydrated:!1,cache:wt.cache,transitions:wt.transitions},F.updateQueue.baseState=lt,F.memoizedState=lt,F.flags&256){it=Error(s(423)),F=Cp(L,F,$,W,it);break t}else if($!==it){it=Error(s(424)),F=Cp(L,F,$,W,it);break t}else for(gt&&(Hn=_r(F.stateNode.containerInfo),$n=F,_i=!0,is=null,po=!1),W=Ah(F,null,$,W),F.child=W;W;)W.flags=W.flags&-3|4096,W=W.sibling;else{if(vo(),$===it){F=qn(L,F,W);break t}Ln(L,F,$,W)}F=F.child}return F;case 5:return Nt(F),L===null&&cn(F),$=F.type,it=F.pendingProps,lt=L!==null?L.memoizedProps:null,wt=it.children,U($,it)?wt=null:lt!==null&&U($,lt)&&(F.flags|=32),Tp(L,F),Ln(L,F,wt,W),F.child;case 6:return L===null&&cn(F),null;case 13:return wp(L,F,W);case 4:return pt(F,F.stateNode.containerInfo),$=F.pendingProps,L===null?F.child=Gr(F,null,$,W):Ln(L,F,$,W),F.child;case 11:return $=F.type,it=F.pendingProps,it=F.elementType===$?it:Rn($,it),gp(L,F,$,it,W);case 7:return Ln(L,F,F.pendingProps,W),F.child;case 8:return Ln(L,F,F.pendingProps.children,W),F.child;case 12:return Ln(L,F,F.pendingProps.children,W),F.child;case 10:t:{if($=F.type._context,it=F.pendingProps,lt=F.memoizedProps,wt=it.value,Ol(F,$,wt),lt!==null)if(Ts(lt.value,wt)){if(lt.children===it.children&&!un.current){F=qn(L,F,W);break t}}else for(lt=F.child,lt!==null&&(lt.return=F);lt!==null;){var Xt=lt.dependencies;if(Xt!==null){wt=lt.child;for(var oe=Xt.firstContext;oe!==null;){if(oe.context===$){if(lt.tag===1){oe=Mn(-1,W&-W),oe.tag=2;var Ee=lt.updateQueue;if(Ee!==null){Ee=Ee.shared;var He=Ee.pending;He===null?oe.next=oe:(oe.next=He.next,He.next=oe),Ee.pending=oe}}lt.lanes|=W,oe=lt.alternate,oe!==null&&(oe.lanes|=W),Na(lt.return,W,F),Xt.lanes|=W;break}oe=oe.next}}else if(lt.tag===10)wt=lt.type===F.type?null:lt.child;else if(lt.tag===18){if(wt=lt.return,wt===null)throw Error(s(341));wt.lanes|=W,Xt=wt.alternate,Xt!==null&&(Xt.lanes|=W),Na(wt,W,F),wt=lt.sibling}else wt=lt.child;if(wt!==null)wt.return=lt;else for(wt=lt;wt!==null;){if(wt===F){wt=null;break}if(lt=wt.sibling,lt!==null){lt.return=wt.return,wt=lt;break}wt=wt.return}lt=wt}Ln(L,F,it.children,W),F=F.child}return F;case 9:return it=F.type,$=F.pendingProps.children,Xs(F,W),it=$i(it),$=$(it),F.flags|=1,Ln(L,F,$,W),F.child;case 14:return $=F.type,it=Rn($,F.pendingProps),it=Rn($.type,it),yp(L,F,$,it,W);case 15:return xp(L,F,F.type,F.pendingProps,W);case 17:return $=F.type,it=F.pendingProps,it=F.elementType===$?it:Rn($,it),L!==null&&(L.alternate=null,F.alternate=null,F.flags|=2),F.tag=1,pn($)?(L=!0,Tn(F)):L=!1,Xs(F,W),Ko(F,$,it),za(F,$,it,W),dc(null,F,$,!0,L,W);case 19:return Rp(L,F,W);case 22:return Sp(L,F,W)}throw Error(s(156,F.tag))};function qu(L,F){return Br(L,F)}function Vg(L,F,W,$){this.tag=L,this.key=W,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=F,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=$,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ps(L,F,W,$){return new Vg(L,F,W,$)}function Ic(L){return L=L.prototype,!(!L||!L.isReactComponent)}function Gp(L){if(typeof L=="function")return Ic(L)?1:0;if(L!=null){if(L=L.$$typeof,L===u)return 11;if(L===c)return 14}return 2}function ja(L,F){var W=L.alternate;return W===null?(W=Ps(L.tag,F,L.key,L.mode),W.elementType=L.elementType,W.type=L.type,W.stateNode=L.stateNode,W.alternate=L,L.alternate=W):(W.pendingProps=F,W.type=L.type,W.flags=0,W.subtreeFlags=0,W.deletions=null),W.flags=L.flags&14680064,W.childLanes=L.childLanes,W.lanes=L.lanes,W.child=L.child,W.memoizedProps=L.memoizedProps,W.memoizedState=L.memoizedState,W.updateQueue=L.updateQueue,F=L.dependencies,W.dependencies=F===null?null:{lanes:F.lanes,firstContext:F.firstContext},W.sibling=L.sibling,W.index=L.index,W.ref=L.ref,W}function tf(L,F,W,$,it,lt){var wt=2;if($=L,typeof L=="function")Ic(L)&&(wt=1);else if(typeof L=="string")wt=5;else t:switch(L){case p:return bo(W.children,it,lt,F);case h:wt=8,it|=8;break;case a:return L=Ps(12,W,F,it|2),L.elementType=a,L.lanes=lt,L;case f:return L=Ps(13,W,F,it),L.elementType=f,L.lanes=lt,L;case o:return L=Ps(19,W,F,it),L.elementType=o,L.lanes=lt,L;case v:return Xh(W,it,lt,F);default:if(typeof L=="object"&&L!==null)switch(L.$$typeof){case l:wt=10;break t;case n:wt=9;break t;case u:wt=11;break t;case c:wt=14;break t;case d:wt=16,$=null;break t}throw Error(s(130,L==null?L:typeof L,""))}return F=Ps(wt,W,F,it),F.elementType=L,F.type=$,F.lanes=lt,F}function bo(L,F,W,$){return L=Ps(7,L,$,F),L.lanes=W,L}function Xh(L,F,W,$){return L=Ps(22,L,$,F),L.elementType=v,L.lanes=W,L.stateNode={},L}function Rr(L,F,W){return L=Ps(6,L,null,F),L.lanes=W,L}function Rs(L,F,W){return F=Ps(4,L.children!==null?L.children:[],L.key,F),F.lanes=W,F.stateNode={containerInfo:L.containerInfo,pendingChildren:null,implementation:L.implementation},F}function Hg(L,F,W,$,it){this.tag=F,this.containerInfo=L,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=q,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vs(0),this.expirationTimes=Vs(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vs(0),this.identifierPrefix=$,this.onRecoverableError=it,gt&&(this.mutableSourceEagerHydrationData=null)}function Vp(L,F,W,$,it,lt,wt,Xt,oe){return L=new Hg(L,F,W,Xt,oe),F===1?(F=1,lt===!0&&(F|=8)):F=0,lt=Ps(3,null,null,F),L.current=lt,lt.stateNode=L,lt.memoizedState={element:$,isDehydrated:W,cache:null,transitions:null},Vn(lt),L}function Yh(L){if(!L)return Nr;L=L._reactInternals;t:{if(C(L)!==L||L.tag!==1)throw Error(s(170));var F=L;do{switch(F.tag){case 3:F=F.stateNode.context;break t;case 1:if(pn(F.type)){F=F.stateNode.__reactInternalMemoizedMergedChildContext;break t}}F=F.return}while(F!==null);throw Error(s(171))}if(L.tag===1){var W=L.type;if(pn(W))return zs(L,W,F)}return F}function sl(L){var F=L._reactInternals;if(F===void 0)throw typeof L.render=="function"?Error(s(188)):(L=Object.keys(L).join(","),Error(s(268,L)));return L=b(F),L===null?null:L.stateNode}function Nc(L,F){if(L=L.memoizedState,L!==null&&L.dehydrated!==null){var W=L.retryLane;L.retryLane=W!==0&&W=Ee&<>=vi&&it<=He&&wt<=Qe){L.splice(F,1);break}else if($!==Ee||W.width!==oe.width||Qewt){if(!(lt!==vi||W.height!==oe.height||He<$||Ee>it)){Ee>$&&(oe.width+=Ee-$,oe.x=$),Helt&&(oe.height+=vi-lt,oe.y=lt),QeW&&(W=wt)),wt ")+` No matching component was found for: - `)+L.join(" > ")}return null},i.getPublicRootInstance=function(L){if(L=L.current,!L.child)return null;switch(L.child.tag){case 5:return B(L.child.stateNode);default:return L.child.stateNode}},i.injectIntoDevTools=function(L){if(L={bundleType:L.bundleType,version:L.version,rendererPackageName:L.rendererPackageName,rendererConfig:L.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:y.ReactCurrentDispatcher,findHostInstanceByFiber:Hg,findFiberByHostInstance:L.findFiberByHostInstance||Vp,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")L=!1;else{var F=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(F.isDisabled||!F.supportsFiber)L=!0;else{try{fo=F.inject(L),xr=F}catch{}L=!!F.checkDCE}}return L},i.isAlreadyRendering=function(){return!1},i.observeVisibleRects=function(L,F,W,$){if(!ut)throw Error(s(363));L=Mc(L,F);var it=ge(L,W,$).disconnect;return{disconnect:function(){it()}}},i.registerMutableSourceForHydration=function(L,F){var W=F._getVersion;W=W(F._source),L.mutableSourceEagerHydrationData==null?L.mutableSourceEagerHydrationData=[F,W]:L.mutableSourceEagerHydrationData.push(F,W)},i.runWithPriority=function(L,F){var W=Ni;try{return Ni=L,F()}finally{Ni=W}},i.shouldError=function(){return null},i.shouldSuspend=function(){return!1},i.updateContainer=function(L,F,W,$){var it=F.current,lt=wr(),wt=va(it);return W=Yh(W),F.context===null?F.context=W:F.pendingContext=W,F=Mn(lt,wt),F.payload={element:L},$=$===void 0?null:$,$!==null&&(F.callback=$),Sr(it,F),L=As(it,wt,lt),L!==null&&la(L,it,wt),wt},i};MA.exports=W7;var X7=MA.exports;const Y7=Wd(X7);var CA={exports:{}},wA={};/** + `)+L.join(" > ")}return null},i.getPublicRootInstance=function(L){if(L=L.current,!L.child)return null;switch(L.child.tag){case 5:return B(L.child.stateNode);default:return L.child.stateNode}},i.injectIntoDevTools=function(L){if(L={bundleType:L.bundleType,version:L.version,rendererPackageName:L.rendererPackageName,rendererConfig:L.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:y.ReactCurrentDispatcher,findHostInstanceByFiber:Wg,findFiberByHostInstance:L.findFiberByHostInstance||Hp,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")L=!1;else{var F=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(F.isDisabled||!F.supportsFiber)L=!0;else{try{fo=F.inject(L),xr=F}catch{}L=!!F.checkDCE}}return L},i.isAlreadyRendering=function(){return!1},i.observeVisibleRects=function(L,F,W,$){if(!ut)throw Error(s(363));L=Mc(L,F);var it=ge(L,W,$).disconnect;return{disconnect:function(){it()}}},i.registerMutableSourceForHydration=function(L,F){var W=F._getVersion;W=W(F._source),L.mutableSourceEagerHydrationData==null?L.mutableSourceEagerHydrationData=[F,W]:L.mutableSourceEagerHydrationData.push(F,W)},i.runWithPriority=function(L,F){var W=Ni;try{return Ni=L,F()}finally{Ni=W}},i.shouldError=function(){return null},i.shouldSuspend=function(){return!1},i.updateContainer=function(L,F,W,$){var it=F.current,lt=wr(),wt=va(it);return W=Yh(W),F.context===null?F.context=W:F.pendingContext=W,F=Mn(lt,wt),F.payload={element:L},$=$===void 0?null:$,$!==null&&(F.callback=$),Sr(it,F),L=As(it,wt,lt),L!==null&&la(L,it,wt),wt},i};CA.exports=Yz;var kz=CA.exports;const jz=Xd(kz);var wA={exports:{}},AA={};/** * @license React * scheduler.production.min.js * @@ -10206,11 +10206,11 @@ No matching component was found for: * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(g){function t(z,X){var K=z.length;z.push(X);t:for(;0>>1,tt=z[Q];if(0>>1;QT(U,K))HT(J,U)?(z[Q]=J,z[H]=K,Q=H):(z[Q]=U,z[Z]=K,Q=Z);else if(HT(J,K))z[Q]=J,z[H]=K,Q=H;else break t}}return X}function T(z,X){var K=z.sortIndex-X.sortIndex;return K!==0?K:z.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var E=performance;g.unstable_now=function(){return E.now()}}else{var s=Date,y=s.now();g.unstable_now=function(){return s.now()-y}}var e=[],r=[],p=1,h=null,a=3,l=!1,n=!1,u=!1,f=typeof setTimeout=="function"?setTimeout:null,o=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d(z){for(var X=i(r);X!==null;){if(X.callback===null)x(r);else if(X.startTime<=z)x(r),X.sortIndex=X.expirationTime,t(e,X);else break;X=i(r)}}function v(z){if(u=!1,d(z),!n)if(i(e)!==null)n=!0,B(m);else{var X=i(r);X!==null&&G(v,X.startTime-z)}}function m(z,X){n=!1,u&&(u=!1,o(w),w=-1),l=!0;var K=a;try{for(d(X),h=i(e);h!==null&&(!(h.expirationTime>X)||z&&!P());){var Q=h.callback;if(typeof Q=="function"){h.callback=null,a=h.priorityLevel;var tt=Q(h.expirationTime<=X);X=g.unstable_now(),typeof tt=="function"?h.callback=tt:h===i(e)&&x(e),d(X)}else x(e);h=i(e)}if(h!==null)var Y=!0;else{var Z=i(r);Z!==null&&G(v,Z.startTime-X),Y=!1}return Y}finally{h=null,a=K,l=!1}}var S=!1,M=null,w=-1,C=5,A=-1;function P(){return!(g.unstable_now()-Az||125Q?(z.sortIndex=K,t(r,z),i(e)===null&&z===i(r)&&(u?(o(w),w=-1):u=!0,G(v,K-Q))):(z.sortIndex=tt,t(e,z),n||l||(n=!0,B(m))),z},g.unstable_shouldYield=P,g.unstable_wrapCallback=function(z){var X=a;return function(){var K=a;a=X;try{return z.apply(this,arguments)}finally{a=K}}}})(wA);CA.exports=wA;var sM=CA.exports;const X1={},k7=g=>void Object.assign(X1,g);function K7(g,t){function i(p,{args:h=[],attach:a,...l},n){let u=`${p[0].toUpperCase()}${p.slice(1)}`,f;if(p==="primitive"){if(l.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const o=l.object;f=Ff(o,{type:p,root:n,attach:a,primitive:!0})}else{const o=X1[u];if(!o)throw new Error(`R3F: ${u} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(h))throw new Error("R3F: The args prop must be an array!");f=Ff(new o(...h),{type:p,root:n,attach:a,memoizedProps:{args:h}})}return f.__r3f.attach===void 0&&(f instanceof Li?f.__r3f.attach="geometry":f instanceof Hr&&(f.__r3f.attach="material")),u!=="inject"&&oy(f,l),f}function x(p,h){let a=!1;if(h){var l,n;(l=h.__r3f)!=null&&l.attach?ay(p,h,h.__r3f.attach):h.isObject3D&&p.isObject3D&&(p.add(h),a=!0),a||(n=p.__r3f)==null||n.objects.push(h),h.__r3f||Ff(h,{}),h.__r3f.parent=p,Cx(h),Of(h)}}function T(p,h,a){let l=!1;if(h){var n,u;if((n=h.__r3f)!=null&&n.attach)ay(p,h,h.__r3f.attach);else if(h.isObject3D&&p.isObject3D){h.parent=p,h.dispatchEvent({type:"added"}),p.dispatchEvent({type:"childadded",child:h});const f=p.children.filter(c=>c!==h),o=f.indexOf(a);p.children=[...f.slice(0,o),h,...f.slice(o)],l=!0}l||(u=p.__r3f)==null||u.objects.push(h),h.__r3f||Ff(h,{}),h.__r3f.parent=p,Cx(h),Of(h)}}function E(p,h,a=!1){p&&[...p].forEach(l=>s(h,l,a))}function s(p,h,a){if(h){var l,n,u;if(h.__r3f&&(h.__r3f.parent=null),(l=p.__r3f)!=null&&l.objects&&(p.__r3f.objects=p.__r3f.objects.filter(v=>v!==h)),(n=h.__r3f)!=null&&n.attach)uM(p,h,h.__r3f.attach);else if(h.isObject3D&&p.isObject3D){var f;p.remove(h),(f=h.__r3f)!=null&&f.root&&tz(hm(h),h)}const c=(u=h.__r3f)==null?void 0:u.primitive,d=!c&&(a===void 0?h.dispose!==null:a);if(!c){var o;E((o=h.__r3f)==null?void 0:o.objects,h,d),E(h.children,h,d)}if(delete h.__r3f,d&&h.dispose&&h.type!=="Scene"){const v=()=>{try{h.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?sM.unstable_scheduleCallback(sM.unstable_IdlePriority,v):v()}Of(p)}}function y(p,h,a,l){var n;const u=(n=p.__r3f)==null?void 0:n.parent;if(!u)return;const f=i(h,a,p.__r3f.root);if(p.children){for(const o of p.children)o.__r3f&&x(f,o);p.children=p.children.filter(o=>!o.__r3f)}p.__r3f.objects.forEach(o=>x(f,o)),p.__r3f.objects=[],p.__r3f.autoRemovedBeforeAppend||s(u,p),f.parent&&(f.__r3f.autoRemovedBeforeAppend=!0),x(u,f),f.raycast&&f.__r3f.eventCount&&hm(f).getState().internal.interaction.push(f),[l,l.alternate].forEach(o=>{o!==null&&(o.stateNode=f,o.ref&&(typeof o.ref=="function"?o.ref(f):o.ref.current=f))})}const e=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:Y7({createInstance:i,removeChild:s,appendChild:x,appendInitialChild:x,insertBefore:T,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(p,h)=>{if(!h)return;const a=p.getState().scene;a.__r3f&&(a.__r3f.root=p,x(a,h))},removeChildFromContainer:(p,h)=>{h&&s(p.getState().scene,h)},insertInContainerBefore:(p,h,a)=>{if(!h||!a)return;const l=p.getState().scene;l.__r3f&&T(l,h,a)},getRootHostContext:()=>null,getChildHostContext:p=>p,finalizeInitialChildren(p){var h;return!!((h=p?.__r3f)!=null?h:{}).handlers},prepareUpdate(p,h,a,l){var n;if(((n=p?.__r3f)!=null?n:{}).primitive&&l.object&&l.object!==p)return[!0];{const{args:f=[],children:o,...c}=l,{args:d=[],children:v,...m}=a;if(!Array.isArray(f))throw new Error("R3F: the args prop must be an array!");if(f.some((M,w)=>M!==d[w]))return[!0];const S=OA(p,c,m,!0);return S.changes.length?[!1,S]:null}},commitUpdate(p,[h,a],l,n,u,f){h?y(p,l,u,f):oy(p,a)},commitMount(p,h,a,l){var n;const u=(n=p.__r3f)!=null?n:{};p.raycast&&u.handlers&&u.eventCount&&hm(p).getState().internal.interaction.push(p)},getPublicInstance:p=>p,prepareForCommit:()=>null,preparePortalMount:p=>Ff(p.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(p){var h;const{attach:a,parent:l}=(h=p.__r3f)!=null?h:{};a&&l&&uM(l,p,a),p.isObject3D&&(p.visible=!1),Of(p)},unhideInstance(p,h){var a;const{attach:l,parent:n}=(a=p.__r3f)!=null?a:{};l&&n&&ay(n,p,l),(p.isObject3D&&h.visible==null||h.visible)&&(p.visible=!0),Of(p)},createTextInstance:e,hideTextInstance:e,unhideTextInstance:e,getCurrentEventPriority:()=>t?t():Hf.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&wn.fun(performance.now)?performance.now:wn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:wn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:wn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:oy}}var aM,oM;const sy=g=>"colorSpace"in g||"outputColorSpace"in g,AA=()=>{var g;return(g=X1.ColorManagement)!=null?g:null},PA=g=>g&&g.isOrthographicCamera,j7=g=>g&&g.hasOwnProperty("current"),rp=typeof window<"u"&&((aM=window.document)!=null&&aM.createElement||((oM=window.navigator)==null?void 0:oM.product)==="ReactNative")?Pe.useLayoutEffect:Pe.useEffect;function RA(g){const t=Pe.useRef(g);return rp(()=>void(t.current=g),[g]),t}function Z7({set:g}){return rp(()=>(g(new Promise(()=>null)),()=>g(!1)),[g]),null}class bA extends Pe.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}}bA.getDerivedStateFromError=()=>({error:!0});const LA="__default",lM=new Map,J7=g=>g&&!!g.memoized&&!!g.changes;function FA(g){var t;const i=typeof window<"u"?(t=window.devicePixelRatio)!=null?t:2:1;return Array.isArray(g)?Math.min(Math.max(g[0],i),g[1]):g}const td=g=>{var t;return(t=g.__r3f)==null?void 0:t.root.getState()};function hm(g){let t=g.__r3f.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}const wn={obj:g=>g===Object(g)&&!wn.arr(g)&&typeof g!="function",fun:g=>typeof g=="function",str:g=>typeof g=="string",num:g=>typeof g=="number",boo:g=>typeof g=="boolean",und:g=>g===void 0,arr:g=>Array.isArray(g),equ(g,t,{arrays:i="shallow",objects:x="reference",strict:T=!0}={}){if(typeof g!=typeof t||!!g!=!!t)return!1;if(wn.str(g)||wn.num(g))return g===t;const E=wn.obj(g);if(E&&x==="reference")return g===t;const s=wn.arr(g);if(s&&i==="reference")return g===t;if((s||E)&&g===t)return!0;let y;for(y in g)if(!(y in t))return!1;if(E&&i==="shallow"&&x==="shallow"){for(y in T?t:g)if(!wn.equ(g[y],t[y],{strict:T,objects:"reference"}))return!1}else for(y in T?t:g)if(g[y]!==t[y])return!1;if(wn.und(y)){if(s&&g.length===0&&t.length===0||E&&Object.keys(g).length===0&&Object.keys(t).length===0)return!0;if(g!==t)return!1}return!0}};function $7(g){g.dispose&&g.type!=="Scene"&&g.dispose();for(const t in g)t.dispose==null||t.dispose(),delete g[t]}function Ff(g,t){const i=g;return i.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...t},g}function Mx(g,t){let i=g;if(t.includes("-")){const x=t.split("-"),T=x.pop();return i=x.reduce((E,s)=>E[s],g),{target:i,key:T}}else return{target:i,key:t}}const hM=/-\d+$/;function ay(g,t,i){if(wn.str(i)){if(hM.test(i)){const E=i.replace(hM,""),{target:s,key:y}=Mx(g,E);Array.isArray(s[y])||(s[y]=[])}const{target:x,key:T}=Mx(g,i);t.__r3f.previousAttach=x[T],x[T]=t}else t.__r3f.previousAttach=i(g,t)}function uM(g,t,i){var x,T;if(wn.str(i)){const{target:E,key:s}=Mx(g,i),y=t.__r3f.previousAttach;y===void 0?delete E[s]:E[s]=y}else(x=t.__r3f)==null||x.previousAttach==null||x.previousAttach(g,t);(T=t.__r3f)==null||delete T.previousAttach}function OA(g,{children:t,key:i,ref:x,...T},{children:E,key:s,ref:y,...e}={},r=!1){var p;const h=(p=g?.__r3f)!=null?p:{},a=Object.entries(T),l=[];if(r){const u=Object.keys(e);for(let f=0;f{var o;if((o=g.__r3f)!=null&&o.primitive&&u==="object"||wn.equ(f,e[u]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(u))return l.push([u,f,!0,[]]);let c=[];u.includes("-")&&(c=u.split("-")),l.push([u,f,!1,c]);for(const d in T){const v=T[d];d.startsWith(`${u}-`)&&l.push([d,v,!1,d.split("-")])}});const n={...T};return h.memoizedProps&&h.memoizedProps.args&&(n.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(n.attach=h.memoizedProps.attach),{memoized:n,changes:l}}const Q7=typeof process<"u"&&!1;function oy(g,t){var i,x,T;const E=(i=g.__r3f)!=null?i:{},s=E.root,y=(x=s==null||s.getState==null?void 0:s.getState())!=null?x:{},{memoized:e,changes:r}=J7(t)?t:OA(g,t),p=E.eventCount;g.__r3f&&(g.__r3f.memoizedProps=e);for(let a=0;ad[v],g),!(c&&c.set))){const[d,...v]=f.reverse();o=v.reverse().reduce((m,S)=>m[S],g),l=d}if(n===LA+"remove")if(o.constructor){let d=lM.get(o.constructor);d||(d=new o.constructor,lM.set(o.constructor,d)),n=d[l]}else n=0;if(u)n?E.handlers[l]=n:delete E.handlers[l],E.eventCount=Object.keys(E.handlers).length;else if(c&&c.set&&(c.copy||c instanceof Tu)){if(Array.isArray(n))c.fromArray?c.fromArray(n):c.set(...n);else if(c.copy&&n&&n.constructor&&(Q7?c.constructor.name===n.constructor.name:c.constructor===n.constructor))c.copy(n);else if(n!==void 0){const d=c instanceof ze;!d&&c.setScalar?c.setScalar(n):c instanceof Tu&&n instanceof Tu?c.mask=n.mask:c.set(n),!AA()&&!y.linear&&d&&c.convertSRGBToLinear()}}else if(o[l]=n,o[l]instanceof Un&&o[l].format===ps&&o[l].type===Uo){const d=o[l];sy(d)&&sy(y.gl)?d.colorSpace=y.gl.outputColorSpace:d.encoding=y.gl.outputEncoding}Of(g)}if(E.parent&&g.raycast&&p!==E.eventCount){const a=hm(g).getState().internal,l=a.interaction.indexOf(g);l>-1&&a.interaction.splice(l,1),E.eventCount&&a.interaction.push(g)}return!(r.length===1&&r[0][0]==="onUpdate")&&r.length&&(T=g.__r3f)!=null&&T.parent&&Cx(g),g}function Of(g){var t,i;const x=(t=g.__r3f)==null||(i=t.root)==null||i.getState==null?void 0:i.getState();x&&x.internal.frames===0&&x.invalidate()}function Cx(g){g.onUpdate==null||g.onUpdate(g)}function _7(g,t){g.manual||(PA(g)?(g.left=t.width/-2,g.right=t.width/2,g.top=t.height/2,g.bottom=t.height/-2):g.aspect=t.width/t.height,g.updateProjectionMatrix(),g.updateMatrixWorld())}function Kv(g){return(g.eventObject||g.object).uuid+"/"+g.index+g.instanceId}function q7(){var g;const t=typeof self<"u"&&self||typeof window<"u"&&window;if(!t)return Hf.DefaultEventPriority;switch((g=t.event)==null?void 0:g.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Hf.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Hf.ContinuousEventPriority;default:return Hf.DefaultEventPriority}}function DA(g,t,i,x){const T=i.get(t);T&&(i.delete(t),i.size===0&&(g.delete(x),T.target.releasePointerCapture(x)))}function tz(g,t){const{internal:i}=g.getState();i.interaction=i.interaction.filter(x=>x!==t),i.initialHits=i.initialHits.filter(x=>x!==t),i.hovered.forEach((x,T)=>{(x.eventObject===t||x.object===t)&&i.hovered.delete(T)}),i.capturedMap.forEach((x,T)=>{DA(i.capturedMap,t,x,T)})}function ez(g){function t(e){const{internal:r}=g.getState(),p=e.offsetX-r.initialClick[0],h=e.offsetY-r.initialClick[1];return Math.round(Math.sqrt(p*p+h*h))}function i(e){return e.filter(r=>["Move","Over","Enter","Out","Leave"].some(p=>{var h;return(h=r.__r3f)==null?void 0:h.handlers["onPointer"+p]}))}function x(e,r){const p=g.getState(),h=new Set,a=[],l=r?r(p.internal.interaction):p.internal.interaction;for(let o=0;o{const d=td(o.object),v=td(c.object);return!d||!v?o.distance-c.distance:v.events.priority-d.events.priority||o.distance-c.distance}).filter(o=>{const c=Kv(o);return h.has(c)?!1:(h.add(c),!0)});p.events.filter&&(u=p.events.filter(u,p));for(const o of u){let c=o.object;for(;c;){var f;(f=c.__r3f)!=null&&f.eventCount&&a.push({...o,eventObject:c}),c=c.parent}}if("pointerId"in e&&p.internal.capturedMap.has(e.pointerId))for(let o of p.internal.capturedMap.get(e.pointerId).values())h.has(Kv(o.intersection))||a.push(o.intersection);return a}function T(e,r,p,h){const a=g.getState();if(e.length){const l={stopped:!1};for(const n of e){const u=td(n.object)||a,{raycaster:f,pointer:o,camera:c,internal:d}=u,v=new Ct(o.x,o.y,0).unproject(c),m=A=>{var P,b;return(P=(b=d.capturedMap.get(A))==null?void 0:b.has(n.eventObject))!=null?P:!1},S=A=>{const P={intersection:n,target:r.target};d.capturedMap.has(A)?d.capturedMap.get(A).set(n.eventObject,P):d.capturedMap.set(A,new Map([[n.eventObject,P]])),r.target.setPointerCapture(A)},M=A=>{const P=d.capturedMap.get(A);P&&DA(d.capturedMap,n.eventObject,P,A)};let w={};for(let A in r){let P=r[A];typeof P!="function"&&(w[A]=P)}let C={...n,...w,pointer:o,intersections:e,stopped:l.stopped,delta:p,unprojectedPoint:v,ray:f.ray,camera:c,stopPropagation(){const A="pointerId"in r&&d.capturedMap.get(r.pointerId);if((!A||A.has(n.eventObject))&&(C.stopped=l.stopped=!0,d.hovered.size&&Array.from(d.hovered.values()).find(P=>P.eventObject===n.eventObject))){const P=e.slice(0,e.indexOf(n));E([...P,n])}},target:{hasPointerCapture:m,setPointerCapture:S,releasePointerCapture:M},currentTarget:{hasPointerCapture:m,setPointerCapture:S,releasePointerCapture:M},nativeEvent:r};if(h(C),l.stopped===!0)break}}return e}function E(e){const{internal:r}=g.getState();for(const p of r.hovered.values())if(!e.length||!e.find(h=>h.object===p.object&&h.index===p.index&&h.instanceId===p.instanceId)){const a=p.eventObject.__r3f,l=a?.handlers;if(r.hovered.delete(Kv(p)),a!=null&&a.eventCount){const n={...p,intersections:e};l.onPointerOut==null||l.onPointerOut(n),l.onPointerLeave==null||l.onPointerLeave(n)}}}function s(e,r){for(let p=0;pE([]);case"onLostPointerCapture":return r=>{const{internal:p}=g.getState();"pointerId"in r&&p.capturedMap.has(r.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(r.pointerId)&&(p.capturedMap.delete(r.pointerId),E([]))})}}return function(p){const{onPointerMissed:h,internal:a}=g.getState();a.lastEvent.current=p;const l=e==="onPointerMove",n=e==="onClick"||e==="onContextMenu"||e==="onDoubleClick",f=x(p,l?i:void 0),o=n?t(p):0;e==="onPointerDown"&&(a.initialClick=[p.offsetX,p.offsetY],a.initialHits=f.map(d=>d.eventObject)),n&&!f.length&&o<=2&&(s(p,a.interaction),h&&h(p)),l&&E(f);function c(d){const v=d.eventObject,m=v.__r3f,S=m?.handlers;if(m!=null&&m.eventCount)if(l){if(S.onPointerOver||S.onPointerEnter||S.onPointerOut||S.onPointerLeave){const M=Kv(d),w=a.hovered.get(M);w?w.stopped&&d.stopPropagation():(a.hovered.set(M,d),S.onPointerOver==null||S.onPointerOver(d),S.onPointerEnter==null||S.onPointerEnter(d))}S.onPointerMove==null||S.onPointerMove(d)}else{const M=S[e];M?(!n||a.initialHits.includes(v))&&(s(p,a.interaction.filter(w=>!a.initialHits.includes(w))),M(d)):n&&a.initialHits.includes(v)&&s(p,a.interaction.filter(w=>!a.initialHits.includes(w)))}}T(f,p,o,c)}}return{handlePointer:y}}const IA=g=>!!(g!=null&&g.render),NA=Pe.createContext(null),iz=(g,t)=>{const i=G7((y,e)=>{const r=new Ct,p=new Ct,h=new Ct;function a(o=e().camera,c=p,d=e().size){const{width:v,height:m,top:S,left:M}=d,w=v/m;c instanceof Ct?h.copy(c):h.set(...c);const C=o.getWorldPosition(r).distanceTo(h);if(PA(o))return{width:v/o.zoom,height:m/o.zoom,top:S,left:M,factor:1,distance:C,aspect:w};{const A=o.fov*Math.PI/180,P=2*Math.tan(A/2)*C,b=P*(v/m);return{width:b,height:P,top:S,left:M,factor:v/b,distance:C,aspect:w}}}let l;const n=o=>y(c=>({performance:{...c.performance,current:o}})),u=new ve;return{set:y,get:e,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(o=1)=>g(e(),o),advance:(o,c)=>t(o,c,e()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new G1,pointer:u,mouse:u,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const o=e();l&&clearTimeout(l),o.performance.current!==o.performance.min&&n(o.performance.min),l=setTimeout(()=>n(e().performance.max),o.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:a},setEvents:o=>y(c=>({...c,events:{...c.events,...o}})),setSize:(o,c,d,v,m)=>{const S=e().camera,M={width:o,height:c,top:v||0,left:m||0,updateStyle:d};y(w=>({size:M,viewport:{...w.viewport,...a(S,p,M)}}))},setDpr:o=>y(c=>{const d=FA(o);return{viewport:{...c.viewport,dpr:d,initialDpr:c.viewport.initialDpr||d}}}),setFrameloop:(o="always")=>{const c=e().clock;c.stop(),c.elapsedTime=0,o!=="never"&&(c.start(),c.elapsedTime=0),y(()=>({frameloop:o}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:Pe.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(o,c,d)=>{const v=e().internal;return v.priority=v.priority+(c>0?1:0),v.subscribers.push({ref:o,priority:c,store:d}),v.subscribers=v.subscribers.sort((m,S)=>m.priority-S.priority),()=>{const m=e().internal;m!=null&&m.subscribers&&(m.priority=m.priority-(c>0?1:0),m.subscribers=m.subscribers.filter(S=>S.ref!==o))}}}}}),x=i.getState();let T=x.size,E=x.viewport.dpr,s=x.camera;return i.subscribe(()=>{const{camera:y,size:e,viewport:r,gl:p,set:h}=i.getState();if(e.width!==T.width||e.height!==T.height||r.dpr!==E){var a;T=e,E=r.dpr,_7(y,e),p.setPixelRatio(r.dpr);const l=(a=e.updateStyle)!=null?a:typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(e.width,e.height,l)}y!==s&&(s=y,h(l=>({viewport:{...l.viewport,...l.viewport.getCurrentViewport(y)}})))}),i.subscribe(y=>g(y)),i};let jv,nz=new Set,rz=new Set,sz=new Set;function ly(g,t){if(g.size)for(const{callback:i}of g.values())i(t)}function ed(g,t){switch(g){case"before":return ly(nz,t);case"after":return ly(rz,t);case"tail":return ly(sz,t)}}let hy,uy;function fy(g,t,i){let x=t.clock.getDelta();for(t.frameloop==="never"&&typeof g=="number"&&(x=g-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=g),hy=t.internal.subscribers,jv=0;jv0)&&!((p=E.gl.xr)!=null&&p.isPresenting)&&(x+=fy(r,E))}if(i=!1,ed("after",r),x===0)return ed("tail",r),t=!1,cancelAnimationFrame(T)}function y(r,p=1){var h;if(!r)return g.forEach(a=>y(a.store.getState(),p));(h=r.gl.xr)!=null&&h.isPresenting||!r.internal.active||r.frameloop==="never"||(p>1?r.internal.frames=Math.min(60,r.internal.frames+p):i?r.internal.frames=2:r.internal.frames=1,t||(t=!0,requestAnimationFrame(s)))}function e(r,p=!0,h,a){if(p&&ed("before",r),h)fy(r,h,a);else for(const l of g.values())fy(r,l.store.getState());p&&ed("after",r)}return{loop:s,invalidate:y,advance:e}}function oz(){const g=Pe.useContext(NA);if(!g)throw new Error("R3F: Hooks can only be used within the Canvas component!");return g}function lz(g,t=0){const i=oz(),x=i.getState().internal.subscribe,T=RA(g);return rp(()=>x(T,t,i),[t,x,i]),null}const _f=new Map,{invalidate:fM,advance:cM}=az(_f),{reconciler:wm,applyProps:bf}=K7(_f,q7),Lf={objects:"shallow",strict:!1},hz=(g,t)=>{const i=typeof g=="function"?g(t):g;return IA(i)?i:new M1({powerPreference:"high-performance",canvas:t,antialias:!0,alpha:!0,...g})};function uz(g,t){const i=typeof HTMLCanvasElement<"u"&&g instanceof HTMLCanvasElement;if(t){const{width:x,height:T,top:E,left:s,updateStyle:y=i}=t;return{width:x,height:T,top:E,left:s,updateStyle:y}}else if(typeof HTMLCanvasElement<"u"&&g instanceof HTMLCanvasElement&&g.parentElement){const{width:x,height:T,top:E,left:s}=g.parentElement.getBoundingClientRect();return{width:x,height:T,top:E,left:s,updateStyle:i}}else if(typeof OffscreenCanvas<"u"&&g instanceof OffscreenCanvas)return{width:g.width,height:g.height,top:0,left:0,updateStyle:i};return{width:0,height:0,top:0,left:0}}function fz(g){const t=_f.get(g),i=t?.fiber,x=t?.store;t&&console.warn("R3F.createRoot should only be called once!");const T=typeof reportError=="function"?reportError:console.error,E=x||iz(fM,cM),s=i||wm.createContainer(E,Hf.ConcurrentRoot,null,!1,null,"",T,null);t||_f.set(g,{fiber:s,store:E});let y,e=!1,r;return{configure(p={}){let{gl:h,size:a,scene:l,events:n,onCreated:u,shadows:f=!1,linear:o=!1,flat:c=!1,legacy:d=!1,orthographic:v=!1,frameloop:m="always",dpr:S=[1,2],performance:M,raycaster:w,camera:C,onPointerMissed:A}=p,P=E.getState(),b=P.gl;P.gl||P.set({gl:b=hz(h,g)});let O=P.raycaster;O||P.set({raycaster:O=new SA});const{params:I,...D}=w||{};if(wn.equ(D,O,Lf)||bf(O,{...D}),wn.equ(I,O.params,Lf)||bf(O,{params:{...O.params,...I}}),!P.camera||P.camera===r&&!wn.equ(r,C,Lf)){r=C;const K=C instanceof $d,Q=K?C:v?new qd(0,0,0,0,.1,1e3):new Or(75,0,.1,1e3);K||(Q.position.z=5,C&&bf(Q,C),!P.camera&&!(C!=null&&C.rotation)&&Q.lookAt(0,0,0)),P.set({camera:Q}),O.camera=Q}if(!P.scene){let K;l instanceof Mm?K=l:(K=new Mm,l&&bf(K,l)),P.set({scene:Ff(K)})}if(!P.xr){var B;const K=(Y,Z)=>{const U=E.getState();U.frameloop!=="never"&&cM(Y,!0,U,Z)},Q=()=>{const Y=E.getState();Y.gl.xr.enabled=Y.gl.xr.isPresenting,Y.gl.xr.setAnimationLoop(Y.gl.xr.isPresenting?K:null),Y.gl.xr.isPresenting||fM(Y)},tt={connect(){const Y=E.getState().gl;Y.xr.addEventListener("sessionstart",Q),Y.xr.addEventListener("sessionend",Q)},disconnect(){const Y=E.getState().gl;Y.xr.removeEventListener("sessionstart",Q),Y.xr.removeEventListener("sessionend",Q)}};typeof((B=b.xr)==null?void 0:B.addEventListener)=="function"&&tt.connect(),P.set({xr:tt})}if(b.shadowMap){const K=b.shadowMap.enabled,Q=b.shadowMap.type;if(b.shadowMap.enabled=!!f,wn.boo(f))b.shadowMap.type=hd;else if(wn.str(f)){var G;const tt={basic:f2,percentage:rg,soft:hd,variance:_a};b.shadowMap.type=(G=tt[f])!=null?G:hd}else wn.obj(f)&&Object.assign(b.shadowMap,f);(K!==b.shadowMap.enabled||Q!==b.shadowMap.type)&&(b.shadowMap.needsUpdate=!0)}const z=AA();z&&("enabled"in z?z.enabled=!d:"legacyMode"in z&&(z.legacyMode=d)),e||bf(b,{outputEncoding:o?3e3:3001,toneMapping:c?Bo:n1}),P.legacy!==d&&P.set(()=>({legacy:d})),P.linear!==o&&P.set(()=>({linear:o})),P.flat!==c&&P.set(()=>({flat:c})),h&&!wn.fun(h)&&!IA(h)&&!wn.equ(h,b,Lf)&&bf(b,h),n&&!P.events.handlers&&P.set({events:n(E)});const X=uz(g,a);return wn.equ(X,P.size,Lf)||P.setSize(X.width,X.height,X.updateStyle,X.top,X.left),S&&P.viewport.dpr!==FA(S)&&P.setDpr(S),P.frameloop!==m&&P.setFrameloop(m),P.onPointerMissed||P.set({onPointerMissed:A}),M&&!wn.equ(M,P.performance,Lf)&&P.set(K=>({performance:{...K.performance,...M}})),y=u,e=!0,this},render(p){return e||this.configure(),wm.updateContainer(Pe.createElement(cz,{store:E,children:p,onCreated:y,rootElement:g}),s,null,()=>{}),E},unmount(){BA(g)}}}function cz({store:g,children:t,onCreated:i,rootElement:x}){return rp(()=>{const T=g.getState();T.set(E=>({internal:{...E.internal,active:!0}})),i&&i(T),g.getState().events.connected||T.events.connect==null||T.events.connect(x)},[]),Pe.createElement(NA.Provider,{value:g},t)}function BA(g,t){const i=_f.get(g),x=i?.fiber;if(x){const T=i?.store.getState();T&&(T.internal.active=!1),wm.updateContainer(null,x,null,()=>{T&&setTimeout(()=>{try{var E,s,y,e;T.events.disconnect==null||T.events.disconnect(),(E=T.gl)==null||(s=E.renderLists)==null||s.dispose==null||s.dispose(),(y=T.gl)==null||y.forceContextLoss==null||y.forceContextLoss(),(e=T.gl)!=null&&e.xr&&T.xr.disconnect(),$7(T),_f.delete(g),t&&t(g)}catch{}},500)})}}wm.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:Pe.version});function Am(){return Am=Object.assign?Object.assign.bind():function(g){for(var t=1;t=0?x=setTimeout(e,t-p):(x=null,i||(y=g.apply(E,T),E=T=null))}var r=function(){E=this,T=arguments,s=Date.now();var p=i&&!x;return x||(x=setTimeout(e,t)),p&&(y=g.apply(E,T),E=T=null),y};return r.clear=function(){x&&(clearTimeout(x),x=null)},r.flush=function(){x&&(y=g.apply(E,T),E=T=null,clearTimeout(x),x=null)},r}wx.debounce=wx;var dz=wx;const dM=Wd(dz);function pz(g){let{debounce:t,scroll:i,polyfill:x,offsetSize:T}=g===void 0?{debounce:0,scroll:!1,offsetSize:!1}:g;const E=x||(typeof window>"u"?class{}:window.ResizeObserver);if(!E)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,y]=Pe.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),e=Pe.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s}),r=t?typeof t=="number"?t:t.scroll:null,p=t?typeof t=="number"?t:t.resize:null,h=Pe.useRef(!1);Pe.useEffect(()=>(h.current=!0,()=>void(h.current=!1)));const[a,l,n]=Pe.useMemo(()=>{const c=()=>{if(!e.current.element)return;const{left:d,top:v,width:m,height:S,bottom:M,right:w,x:C,y:A}=e.current.element.getBoundingClientRect(),P={left:d,top:v,width:m,height:S,bottom:M,right:w,x:C,y:A};e.current.element instanceof HTMLElement&&T&&(P.height=e.current.element.offsetHeight,P.width=e.current.element.offsetWidth),Object.freeze(P),h.current&&!yz(e.current.lastBounds,P)&&y(e.current.lastBounds=P)};return[c,p?dM(c,p):c,r?dM(c,r):c]},[y,T,r,p]);function u(){e.current.scrollContainers&&(e.current.scrollContainers.forEach(c=>c.removeEventListener("scroll",n,!0)),e.current.scrollContainers=null),e.current.resizeObserver&&(e.current.resizeObserver.disconnect(),e.current.resizeObserver=null)}function f(){e.current.element&&(e.current.resizeObserver=new E(n),e.current.resizeObserver.observe(e.current.element),i&&e.current.scrollContainers&&e.current.scrollContainers.forEach(c=>c.addEventListener("scroll",n,{capture:!0,passive:!0})))}const o=c=>{!c||c===e.current.element||(u(),e.current.element=c,e.current.scrollContainers=UA(c),f())};return mz(n,!!i),vz(l),Pe.useEffect(()=>{u(),f()},[i,n,l]),Pe.useEffect(()=>u,[]),[o,s,a]}function vz(g){Pe.useEffect(()=>{const t=g;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[g])}function mz(g,t){Pe.useEffect(()=>{if(t){const i=g;return window.addEventListener("scroll",i,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",i,!0)}},[g,t])}function UA(g){const t=[];if(!g||g===document.body)return t;const{overflow:i,overflowX:x,overflowY:T}=window.getComputedStyle(g);return[i,x,T].some(E=>E==="auto"||E==="scroll")&&t.push(g),[...t,...UA(g.parentElement)]}const gz=["x","y","top","bottom","left","right","width","height"],yz=(g,t)=>gz.every(i=>g[i]===t[i]);var xz=Object.defineProperty,Sz=Object.defineProperties,Tz=Object.getOwnPropertyDescriptors,pM=Object.getOwnPropertySymbols,Ez=Object.prototype.hasOwnProperty,Mz=Object.prototype.propertyIsEnumerable,vM=(g,t,i)=>t in g?xz(g,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):g[t]=i,mM=(g,t)=>{for(var i in t||(t={}))Ez.call(t,i)&&vM(g,i,t[i]);if(pM)for(var i of pM(t))Mz.call(t,i)&&vM(g,i,t[i]);return g},Cz=(g,t)=>Sz(g,Tz(t)),gM,yM;typeof window<"u"&&((gM=window.document)!=null&&gM.createElement||((yM=window.navigator)==null?void 0:yM.product)==="ReactNative")?Pe.useLayoutEffect:Pe.useEffect;function zA(g,t,i){if(!g)return;if(i(g)===!0)return g;let x=t?g.return:g.child;for(;x;){const T=zA(x,t,i);if(T)return T;x=t?null:x.sibling}}function GA(g){try{return Object.defineProperties(g,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return g}}const xM=console.error;console.error=function(){const g=[...arguments].join("");if(g?.startsWith("Warning:")&&g.includes("useContext")){console.error=xM;return}return xM.apply(this,arguments)};const Y1=GA(Pe.createContext(null));class VA extends Pe.Component{render(){return Pe.createElement(Y1.Provider,{value:this._reactInternals},this.props.children)}}function wz(){const g=Pe.useContext(Y1);if(g===null)throw new Error("its-fine: useFiber must be called within a !");const t=Pe.useId();return Pe.useMemo(()=>{for(const x of[g,g?.alternate]){if(!x)continue;const T=zA(x,!1,E=>{let s=E.memoizedState;for(;s;){if(s.memoizedState===t)return!0;s=s.next}});if(T)return T}},[g,t])}function Az(){const g=wz(),[t]=Pe.useState(()=>new Map);t.clear();let i=g;for(;i;){if(i.type&&typeof i.type=="object"){const T=i.type._context===void 0&&i.type.Provider===i.type?i.type:i.type._context;T&&T!==Y1&&!t.has(T)&&t.set(T,Pe.useContext(GA(T)))}i=i.return}return t}function Pz(){const g=Az();return Pe.useMemo(()=>Array.from(g.keys()).reduce((t,i)=>x=>Pe.createElement(t,null,Pe.createElement(i.Provider,Cz(mM({},x),{value:g.get(i)}))),t=>Pe.createElement(VA,mM({},t))),[g])}const cy={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function Rz(g){const{handlePointer:t}=ez(g);return{priority:1,enabled:!0,compute(i,x,T){x.pointer.set(i.offsetX/x.size.width*2-1,-(i.offsetY/x.size.height)*2+1),x.raycaster.setFromCamera(x.pointer,x.camera)},connected:void 0,handlers:Object.keys(cy).reduce((i,x)=>({...i,[x]:t(x)}),{}),update:()=>{var i;const{events:x,internal:T}=g.getState();(i=T.lastEvent)!=null&&i.current&&x.handlers&&x.handlers.onPointerMove(T.lastEvent.current)},connect:i=>{var x;const{set:T,events:E}=g.getState();E.disconnect==null||E.disconnect(),T(s=>({events:{...s.events,connected:i}})),Object.entries((x=E.handlers)!=null?x:[]).forEach(([s,y])=>{const[e,r]=cy[s];i.addEventListener(e,y,{passive:r})})},disconnect:()=>{const{set:i,events:x}=g.getState();if(x.connected){var T;Object.entries((T=x.handlers)!=null?T:[]).forEach(([E,s])=>{if(x&&x.connected instanceof HTMLElement){const[y]=cy[E];x.connected.removeEventListener(y,s)}}),i(E=>({events:{...E.events,connected:void 0}}))}}}}const bz=Pe.forwardRef(function({children:t,fallback:i,resize:x,style:T,gl:E,events:s=Rz,eventSource:y,eventPrefix:e,shadows:r,linear:p,flat:h,legacy:a,orthographic:l,frameloop:n,dpr:u,performance:f,raycaster:o,camera:c,scene:d,onPointerMissed:v,onCreated:m,...S},M){Pe.useMemo(()=>k7(B7),[]);const w=Pz(),[C,A]=pz({scroll:!0,debounce:{scroll:50,resize:0},...x}),P=Pe.useRef(null),b=Pe.useRef(null);Pe.useImperativeHandle(M,()=>P.current);const O=RA(v),[I,D]=Pe.useState(!1),[B,G]=Pe.useState(!1);if(I)throw I;if(B)throw B;const z=Pe.useRef(null);rp(()=>{const K=P.current;A.width>0&&A.height>0&&K&&(z.current||(z.current=fz(K)),z.current.configure({gl:E,events:s,shadows:r,linear:p,flat:h,legacy:a,orthographic:l,frameloop:n,dpr:u,performance:f,raycaster:o,camera:c,scene:d,size:A,onPointerMissed:(...Q)=>O.current==null?void 0:O.current(...Q),onCreated:Q=>{Q.events.connect==null||Q.events.connect(y?j7(y)?y.current:y:b.current),e&&Q.setEvents({compute:(tt,Y)=>{const Z=tt[e+"X"],U=tt[e+"Y"];Y.pointer.set(Z/Y.size.width*2-1,-(U/Y.size.height)*2+1),Y.raycaster.setFromCamera(Y.pointer,Y.camera)}}),m?.(Q)}}),z.current.render(Pe.createElement(w,null,Pe.createElement(bA,{set:G},Pe.createElement(Pe.Suspense,{fallback:Pe.createElement(Z7,{set:D})},t)))))}),Pe.useEffect(()=>{const K=P.current;if(K)return()=>BA(K)},[]);const X=y?"none":"auto";return Pe.createElement("div",Am({ref:b,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:X,...T}},S),Pe.createElement("div",{ref:C,style:{width:"100%",height:"100%"}},Pe.createElement("canvas",{ref:P,style:{display:"block"}},i)))}),Lz=Pe.forwardRef(function(t,i){return Pe.createElement(VA,null,Pe.createElement(bz,Am({},t,{ref:i})))});function Tl(g,t={}){let i=Pe.useCallback(T=>t.keys?k4(g,t.keys,T):g.listen(T),[t.keys,g]),x=g.get.bind(g);return Pe.useSyncExternalStore(i,x,x)}const Fz=[new qa(-Math.PI/2,-Math.PI/2,-Math.PI/2),new qa(0,Math.PI/2,0),new qa(0,-Math.PI/2,-Math.PI/2),new qa(Math.PI/2,Math.PI,Math.PI),new qa(0,0,-Math.PI/2),new qa(Math.PI,0,0)],Oz=({diceValues:g,isRolling:t,textures:i})=>{const x=Pe.useRef([]),T=Pe.useRef([]);return Pe.useEffect(()=>{const E=new aA,s=new ze(16766720);T.current=[new vl({map:E.load(i.side1),color:s}),new vl({map:E.load(i.side2),color:s}),new vl({map:E.load(i.side3),color:s}),new vl({map:E.load(i.side4),color:s}),new vl({map:E.load(i.side5),color:s}),new vl({map:E.load(i.side6),color:s})],x.current.forEach(y=>{y&&(y.material=T.current)})},[i]),lz(()=>{x.current.forEach((E,s)=>{if(E)if(t)E.rotation.x+=.2,E.rotation.y+=.2;else{const y=Fz[g[s]-1];E.rotation.x=om.lerp(E.rotation.x,y.x,.1),E.rotation.y=om.lerp(E.rotation.y,y.y,.1),E.rotation.z=om.lerp(E.rotation.z,y.z,.1)}})}),he.jsx(he.Fragment,{children:g.map((E,s)=>he.jsxs("mesh",{ref:y=>x.current[s]=y,position:[s*2-(g.length-1),0,0],children:[he.jsx("boxGeometry",{args:[1,1,1]}),T.current.length===6&&T.current.map((y,e)=>he.jsx("meshStandardMaterial",{attach:`material-${e}`,...y},e))]},s))})},Dz=({styleClass:g,textures:t,diceCount:i})=>{const x=Tl(xd);Pe.useEffect(()=>{UI("Dice"),GI(t),zI({type:"ROLL_DICE",diceValues:Array(i).fill(1),isRolling:!1})},[t,i]);const T=()=>{CT(!0),setTimeout(()=>{const E=Array.from({length:i},()=>Math.floor(Math.random()*6)+1);console.log("New dice values:",E),l2(E),CT(!1);const s={diceValues:E};Pi.emit("diceRollResult",s)},2e3)};return he.jsxs("div",{className:`flex flex-col items-center justify-center p-4 ${g}`,children:[he.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Dice Roller"}),he.jsxs(Lz,{className:"w-full h-full",camera:{position:[0,0,5]},children:[he.jsx("ambientLight",{intensity:2.5}),he.jsx("pointLight",{position:[10,10,10]}),fT(x.action)&&he.jsx(Oz,{diceValues:x.action.diceValues,isRolling:x.action.isRolling,textures:x.textures})]}),fT(x.action)&&he.jsx("button",{onClick:T,className:`mt-4 p-2 border border-yellow-300 rounded text-yellow-400 ${x.action.isRolling?"opacity-50":""}`,disabled:x.action.isRolling,children:"Roll Dice"})]})};class HA{constructor(t,i,x){this.scene=t,this.gridEngine=i,this.quadtree=x,this.cursor=this.scene.input.keyboard?.createCursorKeys(),this.initializeWASDKeys(),this.registerEventHandlers(),this.tooltip=this.scene.add.text(0,0,"Press [F]",{font:"16px Arial",backgroundColor:"#000000"}).setDepth(4).setPadding(3,2,2,3).setVisible(!1)}initializeWASDKeys(){const t=this.scene.input.keyboard;t&&(this.wasdKeys={W:t.addKey(Phaser.Input.Keyboard.KeyCodes.W),A:t.addKey(Phaser.Input.Keyboard.KeyCodes.A),S:t.addKey(Phaser.Input.Keyboard.KeyCodes.S),D:t.addKey(Phaser.Input.Keyboard.KeyCodes.D)})}handleConsume(t){const i=yl(t);i&&i.consumable?(console.log(`Consuming item: ${i.name}`),NI(i),MT(i.id)):console.log(`Item ${t} is not consumable`)}handleEquip(t){const i=yl(t);i&&(console.log(`Equipping item: ${i.name}`),AI("weapon",i.id))}handleUnequip(t){const i=yl(t);i&&(console.log(`Unequipping item: ${i.name}`),PI("weapon"))}handleDiscard(t){console.log(`Discarding item: ${t}`),MT(t)}handleView(t){const i=yl(t);if(i&&(console.log(`Viewing item: ${i.name} with ${i.slug}`),i.slug)){const x=`https://kbve.com/${i.slug}#${i.name.toLowerCase().replace(/\s+/g,"-").replace(/[^\w-]+/g,"")}`;window.open(x,"_blank")}}registerEventHandlers(){Pi.on("itemAction",this.handleItemAction.bind(this));//! Broken -Pi.on("playerMove",this.handlePlayerMove.bind(this)),Pi.on("playerReward",this.handlePlayerReward.bind(this)),Pi.on("playerDamage",this.handlePlayerCombatDamage.bind(this))}handleItemAction(t){if(t)switch(console.log(`Preparing Action: ${t.itemId} with ${t.action}`),t.action){case"consume":this.handleConsume(t.itemId);break;case"equip":this.handleEquip(t.itemId);break;case"unequip":this.handleUnequip(t.itemId);break;case"discard":this.handleDiscard(t.itemId);break;case"view":this.handleView(t.itemId);break;default:console.log(`Unknown action: ${t.action}`)}}handlePlayerReward(t){console.log("Rewarding the player"),t&&(Pi.emit("notification",{title:"Success",message:t.message,notificationType:Au.success}),wI(t.item))}handlePlayerCombatDamage(t){t&&(o2(parseInt(t.damage)),Pi.emit("notification",{title:"Danger",message:`You taken ${t.damage} points of damage!`,notificationType:Au.danger}))}handlePlayerMove(t){t&&this.gridEngine.moveTo("player",{x:t.x,y:t.y})}checkForNearbyObjects(){const i=this.gridEngine.getPosition("player"),x=i.x*48,T=i.y*48;this.quadtree.query(i).length>0?this.tooltip.setPosition(x,T-60).setVisible(!0):this.tooltip.setVisible(!1)}handleMovement(){if(!this.cursor)return;const t=this.cursor,i=this.wasdKeys;if(this.scene.input.keyboard?.addKey("F").isDown){const x=this.gridEngine.getPosition("player"),T=this.quadtree.query(x);for(const E of T)E.action()}(t.left.isDown||i.A.isDown)&&(t.up.isDown||i.W.isDown)?this.gridEngine.move("player","up-left"):(t.left.isDown||i.A.isDown)&&(t.down.isDown||i.S.isDown)?this.gridEngine.move("player","down-left"):(t.right.isDown||i.D.isDown)&&(t.up.isDown||i.W.isDown)?this.gridEngine.move("player","up-right"):(t.right.isDown||i.D.isDown)&&(t.down.isDown||i.S.isDown)?this.gridEngine.move("player","down-right"):t.left.isDown||i.A.isDown?this.gridEngine.move("player","left"):t.right.isDown||i.D.isDown?this.gridEngine.move("player","right"):t.up.isDown||i.W.isDown?this.gridEngine.move("player","up"):(t.down.isDown||i.S.isDown)&&this.gridEngine.move("player","down"),this.checkForNearbyObjects()}}class WA extends Phaser.GameObjects.Container{constructor(t,i,x,T){const E=i.x,s=i.y-i.height+10;super(t,E,s),this.sprite=i;const y=150,e=40+T.length*20;this.background=t.add.rectangle(0,0,y,e,0,.7),this.text=t.add.text(0,-e/2+10,x,{fontSize:"12px",color:"#ffffff"}).setOrigin(.5),this.buttons=T.map((r,p)=>{const h=t.add.text(0,-e/2+30+p*20,r.label,{fontSize:"12px",color:"#00ff00"}).setOrigin(.5);return h.setInteractive({useHandCursor:!0}),h.on("pointerdown",r.callback),h}),this.add(this.background),this.add(this.text),this.buttons.forEach(r=>this.add(r)),this.scene.add.existing(this)}updatePosition(){this.setPosition(this.sprite.x-30,this.sprite.y-this.sprite.height-this.background.height/2+100)}static attachToSprite(t,i,x,T){i.setInteractive(),i.on("pointerover",E=>{const s={npcId:i.name,npcName:x,actions:T.map(e=>e.label),coords:{x:E.x,y:E.y}};if(Pi.emit("npcInteraction",s),!i.getData("tooltipMenu")){const e=new WA(t,i,x,T);i.setData("tooltipMenu",e)}const y=i.getData("tooltipMenu");y.setVisible(!0),y.updatePosition()}),i.on("pointerout",()=>{const E=i.getData("tooltipMenu");E&&E.setVisible(!1)})}static updateAllTooltipPositions(t){t.children.list.forEach(i=>{if(i instanceof Phaser.GameObjects.Sprite){const x=i.getData("tooltipMenu");x&&x.updatePosition()}})}}let cG=class extends Phaser.GameObjects.Sprite{};function Iz(g,t,i,x){const y=g.add.graphics();y.fillStyle(16777215,1),y.fillRoundedRect(0,0,200,60,16),y.setDepth(99);const e=g.add.text(100,30,i,{fontFamily:"Arial",fontSize:16,color:"#000000"});e.setOrigin(.5),e.setWordWrapWidth(200-10*2),e.setDepth(100);const r=g.add.container(0,0,[y,e]);return r.setDepth(100),t.messageBubble=r,Bz(t),g.time.addEvent({delay:x,callback:()=>{r.destroy(),t.messageBubble===r&&(t.messageBubble=void 0)},callbackScope:g}),r}function Nz(g,t,i){const s=g.add.graphics();s.fillStyle(16777215,1),s.fillRoundedRect(0,0,200,60,16),s.setDepth(99);const y=g.add.text(100,30,i,{fontFamily:"Arial",fontSize:16,color:"#000000"});y.setOrigin(.5),y.setWordWrapWidth(200-10*2),y.setDepth(100);const e=g.add.container(0,0,[s,y]);return e.setDepth(100),t.textBubble=e,Ax(t),e}function Ax(g){const t=g.textBubble;t&&(t.x=g.x,t.y=g.y-g.height-t.height/2)}function Bz(g){const t=g.messageBubble;t&&(t.x=g.x,t.y=g.y-g.height-t.height/2)}class Uz{constructor(){this.actionHandlers={talk:this.talkToNPC.bind(this),quest:this.questWithNPC.bind(this),trade:this.tradeWithNPC.bind(this),combat:this.startCombat.bind(this),heal:this.healNPC.bind(this),steal:this.stealFromNPC.bind(this),lore:this.loreFromNPC.bind(this)}}getActionHandler(t){return this.actionHandlers[t]}loreFromNPC(t){console.log(`Pulling up the lore of the NPC with ID: ${t.npcId}`)}questWithNPC(t){console.log(`Starting quest with NPC with ID: ${t.npcId}`)}healNPC(t){console.log(`Healing NPC with ID: ${t.npcId}`)}talkToNPC(t){console.log(`Talking to NPC with ID: ${t.npcId}`)}tradeWithNPC(t){console.log(`Trading with NPC with ID: ${t.npcId}`)}moveToNPC(t){const x=t.data?.coords||{x:10,y:15};Pi.emit("playerMove",x)}stealFromNPC(t){console.log(`Attempting to steal from NPC with ID: ${t.npcId}`);const i={npcId:t.npcId,npcName:t.npcName,data:t.data};Pi.emit("playerSteal",i)}startCombat(t){console.log(`Starting combat with NPC with ID: ${t.npcId}`)}checkFish(t){console.log(`Checking fish for NPC with ID: ${t.npcId}`)}attachNPCEvent(t,i,x,T){t.setInteractive(),t.on("pointerover",E=>{const s={npcId:t.name||"",npcName:i,actions:x.map(y=>y.label),data:T||{},coords:{x:E.x,y:E.y}};Pi.emit("npcInteraction",s)}),t.on("pointerout",()=>{}),t.on("pointerdown",E=>{const s={npcId:t.name||"",npcName:i,actions:x.map(y=>y.label),data:T||{},coords:{x:E.x,y:E.y}};console.log(`Click Registered at X: ${s.coords.x} Y: ${s.coords.y}`),Pi.emit("npcInteractionClick",s,1e3)})}}const k1=new Uz;var XA={exports:{}};(function(g,t){(function(i,x){g.exports=x()})(vy,function(){var i=function(V,j){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(et,st){et.__proto__=st}||function(et,st){for(var ht in st)Object.prototype.hasOwnProperty.call(st,ht)&&(et[ht]=st[ht])})(V,j)},x=function(){return(x=Object.assign||function(V){for(var j,et=1,st=arguments.length;et"u"||E.Promise||(E.Promise=Promise);var r=Object.getPrototypeOf,p={}.hasOwnProperty;function h(V,j){return p.call(V,j)}function a(V,j){typeof j=="function"&&(j=j(r(V))),(typeof Reflect>"u"?s:Reflect.ownKeys)(j).forEach(function(et){n(V,et,j[et])})}var l=Object.defineProperty;function n(V,j,et,st){l(V,j,e(et&&h(et,"get")&&typeof et.get=="function"?{get:et.get,set:et.set,configurable:!0}:{value:et,configurable:!0,writable:!0},st))}function u(V){return{from:function(j){return V.prototype=Object.create(j.prototype),n(V.prototype,"constructor",V),{extend:a.bind(null,V.prototype)}}}}var f=Object.getOwnPropertyDescriptor,o=[].slice;function c(V,j,et){return o.call(V,j,et)}function d(V,j){return j(V)}function v(V){if(!V)throw new Error("Assertion Failed")}function m(V){E.setImmediate?setImmediate(V):setTimeout(V,0)}function S(V,j){if(typeof j=="string"&&h(V,j))return V[j];if(!j)return V;if(typeof j!="string"){for(var et=[],st=0,ht=j.length;st"u"?[]:function(){var V=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[V,r(V),V];var j=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[j,r(j),V]}(),ne=Gs[0],lr=Gs[1],Gs=Gs[2],lr=lr&&lr.then,oe=ne&&ne.constructor,ge=!!Gs,xe=function(V,j){Ke.push([V,j]),qt&&(queueMicrotask(zi),qt=!1)},Ae=!0,qt=!0,Ge=[],Oe=[],Be=gt,Le={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:rt,pgp:!1,env:{},finalize:rt},ie=Le,Ke=[],ri=0,Ti=[];function le(V){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var j=this._PSD=ie;if(typeof V!="function"){if(V!==Ht)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Me(this,this._value))}this._state=null,this._value=null,++j.ref,function et(st,ht){try{ht(function(pt){if(st._state===null){if(pt===st)throw new TypeError("A promise cannot be resolved with itself.");var Mt=st._lib&&Di();pt&&typeof pt.then=="function"?et(st,function(Nt,zt){pt instanceof le?pt._then(Nt,zt):pt.then(Nt,zt)}):(st._state=!0,st._value=pt,Ce(st)),Mt&&en()}},Me.bind(null,st))}catch(pt){Me(st,pt)}}(this,V)}var xi={get:function(){var V=ie,j=Qr;function et(st,ht){var pt=this,Mt=!V.global&&(V!==ie||j!==Qr),Nt=Mt&&!xs(),zt=new le(function(ct,St){Ve(pt,new bt(ee(st,V,Mt,Nt),ee(ht,V,Mt,Nt),ct,St,V))});return this._consoleTask&&(zt._consoleTask=this._consoleTask),zt}return et.prototype=Ht,et},set:function(V){n(this,"then",V&&V.prototype===Ht?xi:{get:function(){return V},set:xi.set})}};function bt(V,j,et,st,ht){this.onFulfilled=typeof V=="function"?V:null,this.onRejected=typeof j=="function"?j:null,this.resolve=et,this.reject=st,this.psd=ht}function Me(V,j){var et,st;Oe.push(j),V._state===null&&(et=V._lib&&Di(),j=Be(j),V._state=!1,V._value=j,st=V,Ge.some(function(ht){return ht._value===st._value})||Ge.push(st),Ce(V),et&&en())}function Ce(V){var j=V._listeners;V._listeners=[];for(var et=0,st=j.length;et.",$e="String expected.",qe=[],ii="__dbnames",ai="readonly",Ji="readwrite";function hn(V,j){return V?j?function(){return V.apply(this,arguments)&&j.apply(this,arguments)}:V:j}var ki={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function gn(V){return typeof V!="string"||/\./.test(V)?function(j){return j}:function(j){return j[V]===void 0&&V in j&&delete(j=O(j))[V],j}}function ti(){throw q.Type()}function Se(V,j){try{var et=Nr(V),st=Nr(j);if(et!==st)return et==="Array"?1:st==="Array"?-1:et==="binary"?1:st==="binary"?-1:et==="string"?1:st==="string"?-1:et==="Date"?1:st!=="Date"?NaN:-1;switch(et){case"number":case"Date":case"string":return j$t+se&&Kt($t+Ft)})})}var Zt=Ki(et)&&et.limit===1/0&&(typeof V!="function"||V===La)&&{index:et.index,range:et.range};return Kt(0).then(function(){if(0=Ft})).length!==0?(St.forEach(function(Kt){Wt.push(function(){var Zt=It,$t=Kt._cfg.dbschema;Ia(vt,Zt,Ut),Ia(vt,$t,Ut),It=vt._dbSchema=$t;var se=Rn(Zt,$t);se.add.forEach(function(me){Fa(Ut,me[0],me[1].primKey,me[1].indexes)}),se.change.forEach(function(me){if(me.recreate)throw new q.Upgrade("Not yet support for changing primary key");var be=Ut.objectStore(me.name);me.add.forEach(function(_e){return En(be,_e)}),me.change.forEach(function(_e){be.deleteIndex(_e.name),En(be,_e)}),me.del.forEach(function(_e){return be.deleteIndex(_e)})});var ue=Kt._cfg.contentUpgrade;if(ue&&Kt._cfg.version>Ft){ko(vt,Ut),Lt._memoizedTables={};var Re=w($t);se.del.forEach(function(me){Re[me]=Zt[me]}),zr(vt,[vt.Transaction.prototype]),Fl(vt,[vt.Transaction.prototype],s(Re),Re),Lt.schema=Re;var pe,we=Q(ue);return we&&Us(),se=le.follow(function(){var me;(pe=ue(Lt))&&we&&(me=xs.bind(null,null),pe.then(me,me))}),pe&&typeof pe.then=="function"?le.resolve(pe):se.then(function(){return pe})}}),Wt.push(function(Zt){var $t,se,ue=Kt._cfg.dbschema;$t=ue,se=Zt,[].slice.call(se.db.objectStoreNames).forEach(function(Re){return $t[Re]==null&&se.db.deleteObjectStore(Re)}),zr(vt,[vt.Transaction.prototype]),Fl(vt,[vt.Transaction.prototype],vt._storeNames,vt._dbSchema),Lt.schema=vt._dbSchema}),Wt.push(function(Zt){vt.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(vt.idbdb.version/10)===Kt._cfg.version?(vt.idbdb.deleteObjectStore("$meta"),delete vt._dbSchema.$meta,vt._storeNames=vt._storeNames.filter(function($t){return $t!=="$meta"})):Zt.objectStore("$meta").put(Kt._cfg.version,"version"))})}),function Kt(){return Wt.length?le.resolve(Wt.shift()(Lt.idbtrans)).then(Kt):le.resolve()}().then(function(){Oa(It,Ut)})):le.resolve();var vt,Ft,Lt,Ut,Wt,It}).catch(Mt)):(s(ht).forEach(function(St){Fa(et,St,ht[St].primKey,ht[St].indexes)}),ko(V,et),void le.follow(function(){return V.on.populate.fire(pt)}).catch(Mt));var zt,ct})}function Ch(V,j){Oa(V._dbSchema,j),j.db.version%10!=0||j.objectStoreNames.contains("$meta")||j.db.createObjectStore("$meta").add(Math.ceil(j.db.version/10-1),"version");var et=Da(0,V.idbdb,j);Ia(V,V._dbSchema,j);for(var st=0,ht=Rn(et,V._dbSchema).change;stMath.pow(2,62)?0:It.oldVersion,vt=It<1,V.idbdb=Wt.result,pt&&Ch(V,St),yn(V,It/10,St,Lt))},Lt),Wt.onsuccess=di(function(){St=null;var It,Kt,Zt,$t,se,ue=V.idbdb=Wt.result,Re=c(ue.objectStoreNames);if(0"u"?le.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(Ft){function Lt(){return indexedDB.databases().finally(Ft)}zt=setInterval(Lt,100),Lt()}).finally(function(){return clearInterval(zt)}):Promise.resolve()).then(Nt)]).then(function(){return Mt(),j.onReadyBeingFired=[],le.resolve(Wr(function(){return V.on.ready.fire(V.vip)})).then(function Ft(){if(0j.limit?Ft.length=j.limit:V.length===j.limit&&Ft.length=Kt.limit&&(!Kt.values||ue.req.values)&&po(ue.req.query.range,Kt.query.range)}),!1,Zt,$t];case"count":return se=$t.find(function(ue){return _i(ue.req.query.range,Kt.query.range)}),[se,!!se,Zt,$t]}}(j,et,"query",pt),St=ct[0],vt=ct[1],Ft=ct[2],Lt=ct[3];return St&&vt?St.obsSet=pt.obsSet:(vt=st.query(pt).then(function(Ut){var Wt=Ut.result;if(St&&(St.res=Wt),Mt){for(var It=0,Kt=Wt.length;It{console.log(`Texture ${s} loaded successfully.`),this.addNPCToScene(t,E,x,T)}),t.load.start()}else throw new Error(`Sprite with ID ${E.spriteImageId} not found`)}}catch(E){E instanceof Error?console.error(`Failed to load NPC: ${E.message}`):console.error("Failed to load NPC:",E)}}addNPCToScene(t,i,x,T){try{console.log(`Adding NPC to scene: ${JSON.stringify(i)}`),console.log(`Using sprite key: ${i.spriteKey}`);const E=t.add.sprite(0,0,i.spriteKey);E.scale=i.scale||1.5,E.name=i.id||"Error Missing Name",console.log(`NPC Sprite created with texture key ${i.spriteKey} at position (${i.startPosition.x}, ${i.startPosition.y})`);const s={id:i.id,sprite:E,walkingAnimationMapping:i.walkingAnimationMapping,startPosition:{x:x??i.startPosition.x,y:T??i.startPosition.y},speed:i.speed};if(console.log(`Grid engine config: ${JSON.stringify(s)}`),!t.textures.exists(i.spriteKey))throw new Error(`Texture with key ${i.spriteKey} does not exist in the scene`);t.gridEngine.addCharacter(s),console.log(`NPC added to grid engine with ID ${i.id}`),((e,r,p)=>{const h=t.gridEngine.getPosition(e.name);console.log(`Attaching NPC events to ${r} at position: ${JSON.stringify(h)}`),k1.attachNPCEvent(e,r,p,{coords:h})})(E,i.name,i.actions.map(e=>({label:e}))),console.log(`NPC ${i.name} added to scene successfully`)}catch(E){E instanceof Error?console.error(`Error adding NPC to scene from addNPCToScene: ${E.message}`):console.error("Error adding NPC to scene:",E)}}async addDialogue(t){await this.dialogues.put(t)}async getDialogue(t){return await this.dialogues.get(t)}async getAllDialogues(){return await this.dialogues.toArray()}async getDialoguesForNPC(t){const i=await this.getNPC(t);if(!i)throw new Error;return(await Promise.all((i.dialogues||[]).map(T=>this.getDialogue(T.dialogueId)))).filter(T=>T!==void 0)}async markDialogueAsRead(t,i){const x=await this.getNPC(t);if(!x)throw new Error(`NPC with ID ${t} not found`);const T=x.dialogues?.find(E=>E.dialogueId===i);T&&(T.read=!0,await this.addNPC(x))}async fetchDialogues(t){try{const x=(await mn.get(t)).data.key,T=Object.values(x).map(E=>({...E}));await this.dialogues.bulkPut(T)}catch(i){console.error(`Failed to fetch dialogues from ${t}:`,i)}}}const um=new Gz;function YA(g){return+g[g.length-1]}function kA(g){return g.startsWith("monster_bird_")&&!g.startsWith("monster_bird_shadow")}function KA(g,t,i,x,T){const E=[];for(let s=0;s<10;s++){const y=g.add.sprite(0,0,"monster_bird");y.setCrop(t,i,x,T),y.scale=3,E.push(y)}return E}function jA(g){return KA(g,0,0,61,47)}function ZA(g){return KA(g,22,47,16,10)}function JA(g){g.anims.create({key:"bird",frames:g.anims.generateFrameNumbers("monster_bird",{start:0,end:2}),frameRate:10,repeat:-1,yoyo:!0})}class Vz extends Zm.Scene{mainMenuButtonImage;mainMenuButtonText;constructor(){super("Preloader")}preload(){this.load.image("mainBg","https://utfs.io/f/2c17f660-7f39-4edf-b83e-122a71014d99-6gflls.webp"),this.load.image("scroll","https://kbve.com/assets/img/fishchip/scroll.webp"),this.load.audio("music","https://kbve.com/assets/img/fishchip/bg.ogg"),this.load.image("creditsBg","https://utfs.io/f/2c17f660-7f39-4edf-b83e-122a71014d99-6gflls.webp"),this.load.audio("type","https://kbve.com/assets/img/fishchip/type.mp3"),this.load.spritesheet("fishing","https://kbve.com/assets/img/fishchip/animate.png",{frameWidth:800,frameHeight:600}),this.load.image("fish","https://kbve.com/assets/img/letter_logo.png"),this.load.image("background","https://kbve.com/assets/img/fishchip/scaled_fish_menu_minigame.webp"),this.load.image("tiles","https://kbve.com/assets/img/fishchip/desert_tileset_1.png"),this.load.image("cloud-city-tiles","/assets/map/cloud_tileset.png"),this.load.tilemapTiledJSON("cloud-city-map-large","/assets/map/cloud_city_large.json"),this.load.tilemapTiledJSON("cloud-city-map","https://kbve.com/assets/img/fishchip/cloud_city.json"),this.load.spritesheet("player","https://kbve.com/assets/img/fishchip/chip_charactersheet_warmer.png",{frameWidth:52,frameHeight:72}),this.load.spritesheet("knights","/assets/entity/knights.png",{frameWidth:52,frameHeight:72}),this.load.spritesheet("jacko","/assets/entity/jacko.png",{frameWidth:52,frameHeight:72}),this.load.spritesheet("monks","/assets/entity/monks.png",{frameWidth:52,frameHeight:72}),EI()}async create(){await um.initializeDatabase(),this.sound.get("music")?.isPlaying||this.sound.add("music",{loop:!0,volume:.1}).play(),this.add.image(480,480,"mainBg").setScale(.1),this.mainMenuButtonImage=this.add.image(480,480,"scroll").setAlpha(.9).setScale(.7,.2).setInteractive({useHandCursor:!0}),this.mainMenuButtonText=this.add.text(480,480,"Start Game",{fontFamily:"Arial Black",fontSize:50,color:"#ffffff",stroke:"#000000",strokeThickness:6}).setOrigin(.5).setInteractive({useHandCursor:!0}),this.mainMenuButtonText.on("pointerdown",()=>{this.scene.start("SandCity")},this)}}let pG=class extends sd.GameObjects.Sprite{textBubble;tooltip};class Hz extends Zm.Scene{npcSprite;fishNpcSprite;monsterBirdSprites=[];monsterBirdShadows=[];cursor;gridEngine;quadtree;playerController;constructor(){super({key:"SandCity"});const t={xMin:0,xMax:20,yMin:0,yMax:20};this.quadtree=new du(t)}preload(){this.load.spritesheet("monster_bird","/assets/monster/bird_original.png",{frameWidth:61,frameHeight:57}),Pi.emit("notification",{title:"Success",message:`You arrived safely to SandCity Passport: ${i1()}`,notificationType:Au.success})}async create(){const t=this.make.tilemap({key:"cloud-city-map"});t.addTilesetImage("Cloud City","tiles");for(let E=0;E({id:"monster_bird_"+s,sprite:E,startPosition:{x:7,y:7+s},speed:5,collides:!1})),...this.monsterBirdShadows.map((E,s)=>({id:"monster_bird_shadow_"+s,sprite:E,startPosition:{x:7,y:7+s},speed:5,collides:!1}))],numberOfDirections:8};this.gridEngine.create(t,x),this.loadRanges(),this.playerController=new HA(this,this.gridEngine,this.quadtree),Iz(this,this.npcSprite,"Enter the sand pit to start fishing! Go near it and press F!",3e3),await um.loadCharacter(this,"01J2DT4G871KJ0VNSHCNC5REDM"),await um.loadCharacter(this,"01J2HCTMQ58JBMJGW9YA3FBQCG",8,8),await um.loadCharacter(this,"01J2HQJBMBGEEMWDBDWATRCY3T",8,15),this.gridEngine.moveRandomly("npc",1500,3),this.gridEngine.moveRandomly("fishNpc",1500,3);for(let E=0;E<10;E++)this.gridEngine.moveRandomly("monster_bird_"+E,1e3,10);this.gridEngine.positionChangeStarted().subscribe(({charId:E,exitTile:s,enterTile:y})=>{kA(E)&&this.gridEngine.moveTo("monster_bird_shadow_"+YA(E),{x:y.x,y:y.y})});const T=(E,s,y)=>{const e=this.gridEngine.getPosition(E.name);k1.attachNPCEvent(E,s,y,{coords:e})};T(this.npcSprite,"FisherMan",[{label:"Talk"},{label:"Trade"},{label:"Move to"},{label:"Steal"},{label:"Combat"}]),T(this.fishNpcSprite,"Fish NPC Actions",[{label:"Check Fish"},{label:"Move to"}]),window.__GRID_ENGINE__=this.gridEngine}loadRanges(){const t=[{name:"well",bounds:{xMin:2,xMax:5,yMin:10,yMax:14},action:()=>{const i={message:"Seems like there are no fish in the sand pits. You know null, this area could be fixed up a bit too."};Pi.emit("charEvent",i)}},{name:"sign",bounds:{xMin:2,xMax:5,yMin:2,yMax:5},action:()=>{const i={message:"Sign does not have much to say.",character_name:"Evee The BarKeep",character_image:"/assets/npc/barkeep.webp",background_image:"/assets/background/woodensign.webp"};Pi.emit("charEvent",i)}},{name:"building",bounds:{xMin:13,xMax:13,yMin:6,yMax:7},action:()=>{const i={message:"Sorry, we are closed!",character_name:"Evee The BarKeep",character_image:"/assets/npc/barkeep.webp",background_image:"/assets/background/animebar.webp"};Pi.emit("charEvent",i)}},{name:"tombstone",bounds:{xMin:7,xMax:10,yMin:9,yMax:10},action:()=>{const i={message:"Samson the Great was an amazing sailer, died drinking dat drank.",character_name:"Samson Statue",character_image:"/assets/npc/samson.png",background_image:"/assets/background/animetombstone.webp"};Pi.emit("charEvent",i)}}];for(const i of t)this.quadtree.insert(i)}update(){this.playerController?.handleMovement()}}class mG extends sd.GameObjects.Sprite{textBubble}class Wz extends Zm.Scene{npcSprite;fishNpcSprite;monsterBirdSprites=[];monsterBirdShadows=[];cursor;gridEngine;quadtree;playerController;constructor(){super({key:"CloudCity"});const t={xMin:0,xMax:20,yMin:0,yMax:20};this.quadtree=new du(t)}preload(){this.load.spritesheet("monster_bird","/assets/monster/bird_original.png",{frameWidth:61,frameHeight:57})}create(){const t=this.make.tilemap({key:"cloud-city-map-large"});t.addTilesetImage("cloud_tileset","cloud-city-tiles");for(let T=0;T({id:"monster_bird_"+E,sprite:T,startPosition:{x:7,y:7+E},speed:5,collides:!1})),...this.monsterBirdShadows.map((T,E)=>({id:"monster_bird_shadow_"+E,sprite:T,startPosition:{x:7,y:7+E},speed:5,collides:!1}))],numberOfDirections:8};this.gridEngine.create(t,x),this.loadRanges(),this.playerController=new HA(this,this.gridEngine,this.quadtree),Nz(this,this.npcSprite,"Enter the sand pit to start fishing! Go near it and press F!"),this.gridEngine.moveRandomly("npc",1500,3);for(let T=0;T<10;T++)this.gridEngine.moveRandomly("monster_bird_"+T,1e3,20);this.gridEngine.positionChangeStarted().subscribe(({charId:T,exitTile:E,enterTile:s})=>{kA(T)&&this.gridEngine.moveTo("monster_bird_shadow_"+YA(T),{x:s.x,y:s.y})}),window.__GRID_ENGINE__=this.gridEngine}loadRanges(){const t=[{name:"well",bounds:{xMin:2,xMax:5,yMin:10,yMax:14},action:()=>{const i={message:"Seems like there are no fish in the sand pits. You know null, this area could be fixed up a bit too."};Pi.emit("charEvent",i)}},{name:"sign",bounds:{xMin:2,xMax:5,yMin:2,yMax:5},action:async()=>{try{const T={message:`The Database Response time: ${(await(await fetch("https://api.cryptothrone.com/api/v1/speed")).json()).message.time_ms} ms`,character_name:"Planets Be Scalin",character_image:"/assets/npc/barkeep.webp",background_image:"/assets/background/woodensign.webp"};Pi.emit("charEvent",T)}catch(i){console.error("Error fetching data:",i);const x={message:"Sign does not have much to say. Failed to fetch response time.",character_name:"Evee The BarKeep",character_image:"/assets/npc/barkeep.webp",background_image:"/assets/background/woodensign.webp"};Pi.emit("charEvent",x)}}},{name:"building",bounds:{xMin:13,xMax:13,yMin:6,yMax:7},action:()=>{const i={message:"Sorry, we are closed!",character_name:"Evee The BarKeep",character_image:"/assets/npc/barkeep.webp",background_image:"/assets/background/animebar.webp"};Pi.emit("charEvent",i)}},{name:"tombstone",bounds:{xMin:7,xMax:10,yMin:9,yMax:10},action:()=>{const i={message:"Samson the Great was an amazing sailer, died drinking dat drank.",character_name:"Samson Statue",character_image:"/assets/npc/samson.png",background_image:"/assets/background/animetombstone.webp"};Pi.emit("charEvent",i)}}];for(const i of t)this.quadtree.insert(i)}update(){this.playerController?.handleMovement(),this.npcSprite&&this.npcSprite.textBubble&&Ax(this.npcSprite),this.fishNpcSprite&&this.fishNpcSprite.textBubble&&Ax(this.fishNpcSprite)}}const Xz=dm.div` + */(function(g){function t(z,X){var j=z.length;z.push(X);t:for(;0>>1,tt=z[Q];if(0>>1;QT(U,j))HT(J,U)?(z[Q]=J,z[H]=j,Q=H):(z[Q]=U,z[Z]=j,Q=Z);else if(HT(J,j))z[Q]=J,z[H]=j,Q=H;else break t}}return X}function T(z,X){var j=z.sortIndex-X.sortIndex;return j!==0?j:z.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var E=performance;g.unstable_now=function(){return E.now()}}else{var s=Date,y=s.now();g.unstable_now=function(){return s.now()-y}}var e=[],r=[],p=1,h=null,a=3,l=!1,n=!1,u=!1,f=typeof setTimeout=="function"?setTimeout:null,o=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d(z){for(var X=i(r);X!==null;){if(X.callback===null)x(r);else if(X.startTime<=z)x(r),X.sortIndex=X.expirationTime,t(e,X);else break;X=i(r)}}function v(z){if(u=!1,d(z),!n)if(i(e)!==null)n=!0,B(m);else{var X=i(r);X!==null&&G(v,X.startTime-z)}}function m(z,X){n=!1,u&&(u=!1,o(w),w=-1),l=!0;var j=a;try{for(d(X),h=i(e);h!==null&&(!(h.expirationTime>X)||z&&!P());){var Q=h.callback;if(typeof Q=="function"){h.callback=null,a=h.priorityLevel;var tt=Q(h.expirationTime<=X);X=g.unstable_now(),typeof tt=="function"?h.callback=tt:h===i(e)&&x(e),d(X)}else x(e);h=i(e)}if(h!==null)var Y=!0;else{var Z=i(r);Z!==null&&G(v,Z.startTime-X),Y=!1}return Y}finally{h=null,a=j,l=!1}}var S=!1,M=null,w=-1,C=5,A=-1;function P(){return!(g.unstable_now()-Az||125Q?(z.sortIndex=j,t(r,z),i(e)===null&&z===i(r)&&(u?(o(w),w=-1):u=!0,G(v,j-Q))):(z.sortIndex=tt,t(e,z),n||l||(n=!0,B(m))),z},g.unstable_shouldYield=P,g.unstable_wrapCallback=function(z){var X=a;return function(){var j=a;a=X;try{return z.apply(this,arguments)}finally{a=j}}}})(AA);wA.exports=AA;var rM=wA.exports;const X1={},Kz=g=>void Object.assign(X1,g);function Zz(g,t){function i(p,{args:h=[],attach:a,...l},n){let u=`${p[0].toUpperCase()}${p.slice(1)}`,f;if(p==="primitive"){if(l.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const o=l.object;f=Ff(o,{type:p,root:n,attach:a,primitive:!0})}else{const o=X1[u];if(!o)throw new Error(`R3F: ${u} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(h))throw new Error("R3F: The args prop must be an array!");f=Ff(new o(...h),{type:p,root:n,attach:a,memoizedProps:{args:h}})}return f.__r3f.attach===void 0&&(f instanceof Li?f.__r3f.attach="geometry":f instanceof Hr&&(f.__r3f.attach="material")),u!=="inject"&&ly(f,l),f}function x(p,h){let a=!1;if(h){var l,n;(l=h.__r3f)!=null&&l.attach?oy(p,h,h.__r3f.attach):h.isObject3D&&p.isObject3D&&(p.add(h),a=!0),a||(n=p.__r3f)==null||n.objects.push(h),h.__r3f||Ff(h,{}),h.__r3f.parent=p,wx(h),Of(h)}}function T(p,h,a){let l=!1;if(h){var n,u;if((n=h.__r3f)!=null&&n.attach)oy(p,h,h.__r3f.attach);else if(h.isObject3D&&p.isObject3D){h.parent=p,h.dispatchEvent({type:"added"}),p.dispatchEvent({type:"childadded",child:h});const f=p.children.filter(c=>c!==h),o=f.indexOf(a);p.children=[...f.slice(0,o),h,...f.slice(o)],l=!0}l||(u=p.__r3f)==null||u.objects.push(h),h.__r3f||Ff(h,{}),h.__r3f.parent=p,wx(h),Of(h)}}function E(p,h,a=!1){p&&[...p].forEach(l=>s(h,l,a))}function s(p,h,a){if(h){var l,n,u;if(h.__r3f&&(h.__r3f.parent=null),(l=p.__r3f)!=null&&l.objects&&(p.__r3f.objects=p.__r3f.objects.filter(v=>v!==h)),(n=h.__r3f)!=null&&n.attach)hM(p,h,h.__r3f.attach);else if(h.isObject3D&&p.isObject3D){var f;p.remove(h),(f=h.__r3f)!=null&&f.root&&i7(um(h),h)}const c=(u=h.__r3f)==null?void 0:u.primitive,d=!c&&(a===void 0?h.dispose!==null:a);if(!c){var o;E((o=h.__r3f)==null?void 0:o.objects,h,d),E(h.children,h,d)}if(delete h.__r3f,d&&h.dispose&&h.type!=="Scene"){const v=()=>{try{h.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?rM.unstable_scheduleCallback(rM.unstable_IdlePriority,v):v()}Of(p)}}function y(p,h,a,l){var n;const u=(n=p.__r3f)==null?void 0:n.parent;if(!u)return;const f=i(h,a,p.__r3f.root);if(p.children){for(const o of p.children)o.__r3f&&x(f,o);p.children=p.children.filter(o=>!o.__r3f)}p.__r3f.objects.forEach(o=>x(f,o)),p.__r3f.objects=[],p.__r3f.autoRemovedBeforeAppend||s(u,p),f.parent&&(f.__r3f.autoRemovedBeforeAppend=!0),x(u,f),f.raycast&&f.__r3f.eventCount&&um(f).getState().internal.interaction.push(f),[l,l.alternate].forEach(o=>{o!==null&&(o.stateNode=f,o.ref&&(typeof o.ref=="function"?o.ref(f):o.ref.current=f))})}const e=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:jz({createInstance:i,removeChild:s,appendChild:x,appendInitialChild:x,insertBefore:T,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(p,h)=>{if(!h)return;const a=p.getState().scene;a.__r3f&&(a.__r3f.root=p,x(a,h))},removeChildFromContainer:(p,h)=>{h&&s(p.getState().scene,h)},insertInContainerBefore:(p,h,a)=>{if(!h||!a)return;const l=p.getState().scene;l.__r3f&&T(l,h,a)},getRootHostContext:()=>null,getChildHostContext:p=>p,finalizeInitialChildren(p){var h;return!!((h=p?.__r3f)!=null?h:{}).handlers},prepareUpdate(p,h,a,l){var n;if(((n=p?.__r3f)!=null?n:{}).primitive&&l.object&&l.object!==p)return[!0];{const{args:f=[],children:o,...c}=l,{args:d=[],children:v,...m}=a;if(!Array.isArray(f))throw new Error("R3F: the args prop must be an array!");if(f.some((M,w)=>M!==d[w]))return[!0];const S=DA(p,c,m,!0);return S.changes.length?[!1,S]:null}},commitUpdate(p,[h,a],l,n,u,f){h?y(p,l,u,f):ly(p,a)},commitMount(p,h,a,l){var n;const u=(n=p.__r3f)!=null?n:{};p.raycast&&u.handlers&&u.eventCount&&um(p).getState().internal.interaction.push(p)},getPublicInstance:p=>p,prepareForCommit:()=>null,preparePortalMount:p=>Ff(p.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(p){var h;const{attach:a,parent:l}=(h=p.__r3f)!=null?h:{};a&&l&&hM(l,p,a),p.isObject3D&&(p.visible=!1),Of(p)},unhideInstance(p,h){var a;const{attach:l,parent:n}=(a=p.__r3f)!=null?a:{};l&&n&&oy(n,p,l),(p.isObject3D&&h.visible==null||h.visible)&&(p.visible=!0),Of(p)},createTextInstance:e,hideTextInstance:e,unhideTextInstance:e,getCurrentEventPriority:()=>t?t():Hf.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&wn.fun(performance.now)?performance.now:wn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:wn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:wn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:ly}}var sM,aM;const ay=g=>"colorSpace"in g||"outputColorSpace"in g,PA=()=>{var g;return(g=X1.ColorManagement)!=null?g:null},RA=g=>g&&g.isOrthographicCamera,Jz=g=>g&&g.hasOwnProperty("current"),sp=typeof window<"u"&&((sM=window.document)!=null&&sM.createElement||((aM=window.navigator)==null?void 0:aM.product)==="ReactNative")?Ae.useLayoutEffect:Ae.useEffect;function bA(g){const t=Ae.useRef(g);return sp(()=>void(t.current=g),[g]),t}function $z({set:g}){return sp(()=>(g(new Promise(()=>null)),()=>g(!1)),[g]),null}class LA extends Ae.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}}LA.getDerivedStateFromError=()=>({error:!0});const FA="__default",oM=new Map,Qz=g=>g&&!!g.memoized&&!!g.changes;function OA(g){var t;const i=typeof window<"u"?(t=window.devicePixelRatio)!=null?t:2:1;return Array.isArray(g)?Math.min(Math.max(g[0],i),g[1]):g}const qc=g=>{var t;return(t=g.__r3f)==null?void 0:t.root.getState()};function um(g){let t=g.__r3f.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}const wn={obj:g=>g===Object(g)&&!wn.arr(g)&&typeof g!="function",fun:g=>typeof g=="function",str:g=>typeof g=="string",num:g=>typeof g=="number",boo:g=>typeof g=="boolean",und:g=>g===void 0,arr:g=>Array.isArray(g),equ(g,t,{arrays:i="shallow",objects:x="reference",strict:T=!0}={}){if(typeof g!=typeof t||!!g!=!!t)return!1;if(wn.str(g)||wn.num(g))return g===t;const E=wn.obj(g);if(E&&x==="reference")return g===t;const s=wn.arr(g);if(s&&i==="reference")return g===t;if((s||E)&&g===t)return!0;let y;for(y in g)if(!(y in t))return!1;if(E&&i==="shallow"&&x==="shallow"){for(y in T?t:g)if(!wn.equ(g[y],t[y],{strict:T,objects:"reference"}))return!1}else for(y in T?t:g)if(g[y]!==t[y])return!1;if(wn.und(y)){if(s&&g.length===0&&t.length===0||E&&Object.keys(g).length===0&&Object.keys(t).length===0)return!0;if(g!==t)return!1}return!0}};function _z(g){g.dispose&&g.type!=="Scene"&&g.dispose();for(const t in g)t.dispose==null||t.dispose(),delete g[t]}function Ff(g,t){const i=g;return i.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...t},g}function Cx(g,t){let i=g;if(t.includes("-")){const x=t.split("-"),T=x.pop();return i=x.reduce((E,s)=>E[s],g),{target:i,key:T}}else return{target:i,key:t}}const lM=/-\d+$/;function oy(g,t,i){if(wn.str(i)){if(lM.test(i)){const E=i.replace(lM,""),{target:s,key:y}=Cx(g,E);Array.isArray(s[y])||(s[y]=[])}const{target:x,key:T}=Cx(g,i);t.__r3f.previousAttach=x[T],x[T]=t}else t.__r3f.previousAttach=i(g,t)}function hM(g,t,i){var x,T;if(wn.str(i)){const{target:E,key:s}=Cx(g,i),y=t.__r3f.previousAttach;y===void 0?delete E[s]:E[s]=y}else(x=t.__r3f)==null||x.previousAttach==null||x.previousAttach(g,t);(T=t.__r3f)==null||delete T.previousAttach}function DA(g,{children:t,key:i,ref:x,...T},{children:E,key:s,ref:y,...e}={},r=!1){var p;const h=(p=g?.__r3f)!=null?p:{},a=Object.entries(T),l=[];if(r){const u=Object.keys(e);for(let f=0;f{var o;if((o=g.__r3f)!=null&&o.primitive&&u==="object"||wn.equ(f,e[u]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(u))return l.push([u,f,!0,[]]);let c=[];u.includes("-")&&(c=u.split("-")),l.push([u,f,!1,c]);for(const d in T){const v=T[d];d.startsWith(`${u}-`)&&l.push([d,v,!1,d.split("-")])}});const n={...T};return h.memoizedProps&&h.memoizedProps.args&&(n.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(n.attach=h.memoizedProps.attach),{memoized:n,changes:l}}const qz=typeof process<"u"&&!1;function ly(g,t){var i,x,T;const E=(i=g.__r3f)!=null?i:{},s=E.root,y=(x=s==null||s.getState==null?void 0:s.getState())!=null?x:{},{memoized:e,changes:r}=Qz(t)?t:DA(g,t),p=E.eventCount;g.__r3f&&(g.__r3f.memoizedProps=e);for(let a=0;ad[v],g),!(c&&c.set))){const[d,...v]=f.reverse();o=v.reverse().reduce((m,S)=>m[S],g),l=d}if(n===FA+"remove")if(o.constructor){let d=oM.get(o.constructor);d||(d=new o.constructor,oM.set(o.constructor,d)),n=d[l]}else n=0;if(u)n?E.handlers[l]=n:delete E.handlers[l],E.eventCount=Object.keys(E.handlers).length;else if(c&&c.set&&(c.copy||c instanceof Su)){if(Array.isArray(n))c.fromArray?c.fromArray(n):c.set(...n);else if(c.copy&&n&&n.constructor&&(qz?c.constructor.name===n.constructor.name:c.constructor===n.constructor))c.copy(n);else if(n!==void 0){const d=c instanceof ze;!d&&c.setScalar?c.setScalar(n):c instanceof Su&&n instanceof Su?c.mask=n.mask:c.set(n),!PA()&&!y.linear&&d&&c.convertSRGBToLinear()}}else if(o[l]=n,o[l]instanceof Un&&o[l].format===ps&&o[l].type===zo){const d=o[l];ay(d)&&ay(y.gl)?d.colorSpace=y.gl.outputColorSpace:d.encoding=y.gl.outputEncoding}Of(g)}if(E.parent&&g.raycast&&p!==E.eventCount){const a=um(g).getState().internal,l=a.interaction.indexOf(g);l>-1&&a.interaction.splice(l,1),E.eventCount&&a.interaction.push(g)}return!(r.length===1&&r[0][0]==="onUpdate")&&r.length&&(T=g.__r3f)!=null&&T.parent&&wx(g),g}function Of(g){var t,i;const x=(t=g.__r3f)==null||(i=t.root)==null||i.getState==null?void 0:i.getState();x&&x.internal.frames===0&&x.invalidate()}function wx(g){g.onUpdate==null||g.onUpdate(g)}function t7(g,t){g.manual||(RA(g)?(g.left=t.width/-2,g.right=t.width/2,g.top=t.height/2,g.bottom=t.height/-2):g.aspect=t.width/t.height,g.updateProjectionMatrix(),g.updateMatrixWorld())}function Kv(g){return(g.eventObject||g.object).uuid+"/"+g.index+g.instanceId}function e7(){var g;const t=typeof self<"u"&&self||typeof window<"u"&&window;if(!t)return Hf.DefaultEventPriority;switch((g=t.event)==null?void 0:g.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Hf.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Hf.ContinuousEventPriority;default:return Hf.DefaultEventPriority}}function IA(g,t,i,x){const T=i.get(t);T&&(i.delete(t),i.size===0&&(g.delete(x),T.target.releasePointerCapture(x)))}function i7(g,t){const{internal:i}=g.getState();i.interaction=i.interaction.filter(x=>x!==t),i.initialHits=i.initialHits.filter(x=>x!==t),i.hovered.forEach((x,T)=>{(x.eventObject===t||x.object===t)&&i.hovered.delete(T)}),i.capturedMap.forEach((x,T)=>{IA(i.capturedMap,t,x,T)})}function n7(g){function t(e){const{internal:r}=g.getState(),p=e.offsetX-r.initialClick[0],h=e.offsetY-r.initialClick[1];return Math.round(Math.sqrt(p*p+h*h))}function i(e){return e.filter(r=>["Move","Over","Enter","Out","Leave"].some(p=>{var h;return(h=r.__r3f)==null?void 0:h.handlers["onPointer"+p]}))}function x(e,r){const p=g.getState(),h=new Set,a=[],l=r?r(p.internal.interaction):p.internal.interaction;for(let o=0;o{const d=qc(o.object),v=qc(c.object);return!d||!v?o.distance-c.distance:v.events.priority-d.events.priority||o.distance-c.distance}).filter(o=>{const c=Kv(o);return h.has(c)?!1:(h.add(c),!0)});p.events.filter&&(u=p.events.filter(u,p));for(const o of u){let c=o.object;for(;c;){var f;(f=c.__r3f)!=null&&f.eventCount&&a.push({...o,eventObject:c}),c=c.parent}}if("pointerId"in e&&p.internal.capturedMap.has(e.pointerId))for(let o of p.internal.capturedMap.get(e.pointerId).values())h.has(Kv(o.intersection))||a.push(o.intersection);return a}function T(e,r,p,h){const a=g.getState();if(e.length){const l={stopped:!1};for(const n of e){const u=qc(n.object)||a,{raycaster:f,pointer:o,camera:c,internal:d}=u,v=new Ct(o.x,o.y,0).unproject(c),m=A=>{var P,b;return(P=(b=d.capturedMap.get(A))==null?void 0:b.has(n.eventObject))!=null?P:!1},S=A=>{const P={intersection:n,target:r.target};d.capturedMap.has(A)?d.capturedMap.get(A).set(n.eventObject,P):d.capturedMap.set(A,new Map([[n.eventObject,P]])),r.target.setPointerCapture(A)},M=A=>{const P=d.capturedMap.get(A);P&&IA(d.capturedMap,n.eventObject,P,A)};let w={};for(let A in r){let P=r[A];typeof P!="function"&&(w[A]=P)}let C={...n,...w,pointer:o,intersections:e,stopped:l.stopped,delta:p,unprojectedPoint:v,ray:f.ray,camera:c,stopPropagation(){const A="pointerId"in r&&d.capturedMap.get(r.pointerId);if((!A||A.has(n.eventObject))&&(C.stopped=l.stopped=!0,d.hovered.size&&Array.from(d.hovered.values()).find(P=>P.eventObject===n.eventObject))){const P=e.slice(0,e.indexOf(n));E([...P,n])}},target:{hasPointerCapture:m,setPointerCapture:S,releasePointerCapture:M},currentTarget:{hasPointerCapture:m,setPointerCapture:S,releasePointerCapture:M},nativeEvent:r};if(h(C),l.stopped===!0)break}}return e}function E(e){const{internal:r}=g.getState();for(const p of r.hovered.values())if(!e.length||!e.find(h=>h.object===p.object&&h.index===p.index&&h.instanceId===p.instanceId)){const a=p.eventObject.__r3f,l=a?.handlers;if(r.hovered.delete(Kv(p)),a!=null&&a.eventCount){const n={...p,intersections:e};l.onPointerOut==null||l.onPointerOut(n),l.onPointerLeave==null||l.onPointerLeave(n)}}}function s(e,r){for(let p=0;pE([]);case"onLostPointerCapture":return r=>{const{internal:p}=g.getState();"pointerId"in r&&p.capturedMap.has(r.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(r.pointerId)&&(p.capturedMap.delete(r.pointerId),E([]))})}}return function(p){const{onPointerMissed:h,internal:a}=g.getState();a.lastEvent.current=p;const l=e==="onPointerMove",n=e==="onClick"||e==="onContextMenu"||e==="onDoubleClick",f=x(p,l?i:void 0),o=n?t(p):0;e==="onPointerDown"&&(a.initialClick=[p.offsetX,p.offsetY],a.initialHits=f.map(d=>d.eventObject)),n&&!f.length&&o<=2&&(s(p,a.interaction),h&&h(p)),l&&E(f);function c(d){const v=d.eventObject,m=v.__r3f,S=m?.handlers;if(m!=null&&m.eventCount)if(l){if(S.onPointerOver||S.onPointerEnter||S.onPointerOut||S.onPointerLeave){const M=Kv(d),w=a.hovered.get(M);w?w.stopped&&d.stopPropagation():(a.hovered.set(M,d),S.onPointerOver==null||S.onPointerOver(d),S.onPointerEnter==null||S.onPointerEnter(d))}S.onPointerMove==null||S.onPointerMove(d)}else{const M=S[e];M?(!n||a.initialHits.includes(v))&&(s(p,a.interaction.filter(w=>!a.initialHits.includes(w))),M(d)):n&&a.initialHits.includes(v)&&s(p,a.interaction.filter(w=>!a.initialHits.includes(w)))}}T(f,p,o,c)}}return{handlePointer:y}}const NA=g=>!!(g!=null&&g.render),BA=Ae.createContext(null),r7=(g,t)=>{const i=Hz((y,e)=>{const r=new Ct,p=new Ct,h=new Ct;function a(o=e().camera,c=p,d=e().size){const{width:v,height:m,top:S,left:M}=d,w=v/m;c instanceof Ct?h.copy(c):h.set(...c);const C=o.getWorldPosition(r).distanceTo(h);if(RA(o))return{width:v/o.zoom,height:m/o.zoom,top:S,left:M,factor:1,distance:C,aspect:w};{const A=o.fov*Math.PI/180,P=2*Math.tan(A/2)*C,b=P*(v/m);return{width:b,height:P,top:S,left:M,factor:v/b,distance:C,aspect:w}}}let l;const n=o=>y(c=>({performance:{...c.performance,current:o}})),u=new ve;return{set:y,get:e,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(o=1)=>g(e(),o),advance:(o,c)=>t(o,c,e()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new G1,pointer:u,mouse:u,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const o=e();l&&clearTimeout(l),o.performance.current!==o.performance.min&&n(o.performance.min),l=setTimeout(()=>n(e().performance.max),o.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:a},setEvents:o=>y(c=>({...c,events:{...c.events,...o}})),setSize:(o,c,d,v,m)=>{const S=e().camera,M={width:o,height:c,top:v||0,left:m||0,updateStyle:d};y(w=>({size:M,viewport:{...w.viewport,...a(S,p,M)}}))},setDpr:o=>y(c=>{const d=OA(o);return{viewport:{...c.viewport,dpr:d,initialDpr:c.viewport.initialDpr||d}}}),setFrameloop:(o="always")=>{const c=e().clock;c.stop(),c.elapsedTime=0,o!=="never"&&(c.start(),c.elapsedTime=0),y(()=>({frameloop:o}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:Ae.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(o,c,d)=>{const v=e().internal;return v.priority=v.priority+(c>0?1:0),v.subscribers.push({ref:o,priority:c,store:d}),v.subscribers=v.subscribers.sort((m,S)=>m.priority-S.priority),()=>{const m=e().internal;m!=null&&m.subscribers&&(m.priority=m.priority-(c>0?1:0),m.subscribers=m.subscribers.filter(S=>S.ref!==o))}}}}}),x=i.getState();let T=x.size,E=x.viewport.dpr,s=x.camera;return i.subscribe(()=>{const{camera:y,size:e,viewport:r,gl:p,set:h}=i.getState();if(e.width!==T.width||e.height!==T.height||r.dpr!==E){var a;T=e,E=r.dpr,t7(y,e),p.setPixelRatio(r.dpr);const l=(a=e.updateStyle)!=null?a:typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(e.width,e.height,l)}y!==s&&(s=y,h(l=>({viewport:{...l.viewport,...l.viewport.getCurrentViewport(y)}})))}),i.subscribe(y=>g(y)),i};let Zv,s7=new Set,a7=new Set,o7=new Set;function hy(g,t){if(g.size)for(const{callback:i}of g.values())i(t)}function td(g,t){switch(g){case"before":return hy(s7,t);case"after":return hy(a7,t);case"tail":return hy(o7,t)}}let uy,fy;function cy(g,t,i){let x=t.clock.getDelta();for(t.frameloop==="never"&&typeof g=="number"&&(x=g-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=g),uy=t.internal.subscribers,Zv=0;Zv0)&&!((p=E.gl.xr)!=null&&p.isPresenting)&&(x+=cy(r,E))}if(i=!1,td("after",r),x===0)return td("tail",r),t=!1,cancelAnimationFrame(T)}function y(r,p=1){var h;if(!r)return g.forEach(a=>y(a.store.getState(),p));(h=r.gl.xr)!=null&&h.isPresenting||!r.internal.active||r.frameloop==="never"||(p>1?r.internal.frames=Math.min(60,r.internal.frames+p):i?r.internal.frames=2:r.internal.frames=1,t||(t=!0,requestAnimationFrame(s)))}function e(r,p=!0,h,a){if(p&&td("before",r),h)cy(r,h,a);else for(const l of g.values())cy(r,l.store.getState());p&&td("after",r)}return{loop:s,invalidate:y,advance:e}}function h7(){const g=Ae.useContext(BA);if(!g)throw new Error("R3F: Hooks can only be used within the Canvas component!");return g}function u7(g,t=0){const i=h7(),x=i.getState().internal.subscribe,T=bA(g);return sp(()=>x(T,t,i),[t,x,i]),null}const _f=new Map,{invalidate:uM,advance:fM}=l7(_f),{reconciler:wm,applyProps:Rf}=Zz(_f,e7),bf={objects:"shallow",strict:!1},f7=(g,t)=>{const i=typeof g=="function"?g(t):g;return NA(i)?i:new M1({powerPreference:"high-performance",canvas:t,antialias:!0,alpha:!0,...g})};function c7(g,t){const i=typeof HTMLCanvasElement<"u"&&g instanceof HTMLCanvasElement;if(t){const{width:x,height:T,top:E,left:s,updateStyle:y=i}=t;return{width:x,height:T,top:E,left:s,updateStyle:y}}else if(typeof HTMLCanvasElement<"u"&&g instanceof HTMLCanvasElement&&g.parentElement){const{width:x,height:T,top:E,left:s}=g.parentElement.getBoundingClientRect();return{width:x,height:T,top:E,left:s,updateStyle:i}}else if(typeof OffscreenCanvas<"u"&&g instanceof OffscreenCanvas)return{width:g.width,height:g.height,top:0,left:0,updateStyle:i};return{width:0,height:0,top:0,left:0}}function d7(g){const t=_f.get(g),i=t?.fiber,x=t?.store;t&&console.warn("R3F.createRoot should only be called once!");const T=typeof reportError=="function"?reportError:console.error,E=x||r7(uM,fM),s=i||wm.createContainer(E,Hf.ConcurrentRoot,null,!1,null,"",T,null);t||_f.set(g,{fiber:s,store:E});let y,e=!1,r;return{configure(p={}){let{gl:h,size:a,scene:l,events:n,onCreated:u,shadows:f=!1,linear:o=!1,flat:c=!1,legacy:d=!1,orthographic:v=!1,frameloop:m="always",dpr:S=[1,2],performance:M,raycaster:w,camera:C,onPointerMissed:A}=p,P=E.getState(),b=P.gl;P.gl||P.set({gl:b=f7(h,g)});let O=P.raycaster;O||P.set({raycaster:O=new TA});const{params:I,...D}=w||{};if(wn.equ(D,O,bf)||Rf(O,{...D}),wn.equ(I,O.params,bf)||Rf(O,{params:{...O.params,...I}}),!P.camera||P.camera===r&&!wn.equ(r,C,bf)){r=C;const j=C instanceof Qd,Q=j?C:v?new tp(0,0,0,0,.1,1e3):new Or(75,0,.1,1e3);j||(Q.position.z=5,C&&Rf(Q,C),!P.camera&&!(C!=null&&C.rotation)&&Q.lookAt(0,0,0)),P.set({camera:Q}),O.camera=Q}if(!P.scene){let j;l instanceof Mm?j=l:(j=new Mm,l&&Rf(j,l)),P.set({scene:Ff(j)})}if(!P.xr){var B;const j=(Y,Z)=>{const U=E.getState();U.frameloop!=="never"&&fM(Y,!0,U,Z)},Q=()=>{const Y=E.getState();Y.gl.xr.enabled=Y.gl.xr.isPresenting,Y.gl.xr.setAnimationLoop(Y.gl.xr.isPresenting?j:null),Y.gl.xr.isPresenting||uM(Y)},tt={connect(){const Y=E.getState().gl;Y.xr.addEventListener("sessionstart",Q),Y.xr.addEventListener("sessionend",Q)},disconnect(){const Y=E.getState().gl;Y.xr.removeEventListener("sessionstart",Q),Y.xr.removeEventListener("sessionend",Q)}};typeof((B=b.xr)==null?void 0:B.addEventListener)=="function"&&tt.connect(),P.set({xr:tt})}if(b.shadowMap){const j=b.shadowMap.enabled,Q=b.shadowMap.type;if(b.shadowMap.enabled=!!f,wn.boo(f))b.shadowMap.type=hd;else if(wn.str(f)){var G;const tt={basic:c2,percentage:sg,soft:hd,variance:_a};b.shadowMap.type=(G=tt[f])!=null?G:hd}else wn.obj(f)&&Object.assign(b.shadowMap,f);(j!==b.shadowMap.enabled||Q!==b.shadowMap.type)&&(b.shadowMap.needsUpdate=!0)}const z=PA();z&&("enabled"in z?z.enabled=!d:"legacyMode"in z&&(z.legacyMode=d)),e||Rf(b,{outputEncoding:o?3e3:3001,toneMapping:c?Uo:n1}),P.legacy!==d&&P.set(()=>({legacy:d})),P.linear!==o&&P.set(()=>({linear:o})),P.flat!==c&&P.set(()=>({flat:c})),h&&!wn.fun(h)&&!NA(h)&&!wn.equ(h,b,bf)&&Rf(b,h),n&&!P.events.handlers&&P.set({events:n(E)});const X=c7(g,a);return wn.equ(X,P.size,bf)||P.setSize(X.width,X.height,X.updateStyle,X.top,X.left),S&&P.viewport.dpr!==OA(S)&&P.setDpr(S),P.frameloop!==m&&P.setFrameloop(m),P.onPointerMissed||P.set({onPointerMissed:A}),M&&!wn.equ(M,P.performance,bf)&&P.set(j=>({performance:{...j.performance,...M}})),y=u,e=!0,this},render(p){return e||this.configure(),wm.updateContainer(Ae.createElement(p7,{store:E,children:p,onCreated:y,rootElement:g}),s,null,()=>{}),E},unmount(){UA(g)}}}function p7({store:g,children:t,onCreated:i,rootElement:x}){return sp(()=>{const T=g.getState();T.set(E=>({internal:{...E.internal,active:!0}})),i&&i(T),g.getState().events.connected||T.events.connect==null||T.events.connect(x)},[]),Ae.createElement(BA.Provider,{value:g},t)}function UA(g,t){const i=_f.get(g),x=i?.fiber;if(x){const T=i?.store.getState();T&&(T.internal.active=!1),wm.updateContainer(null,x,null,()=>{T&&setTimeout(()=>{try{var E,s,y,e;T.events.disconnect==null||T.events.disconnect(),(E=T.gl)==null||(s=E.renderLists)==null||s.dispose==null||s.dispose(),(y=T.gl)==null||y.forceContextLoss==null||y.forceContextLoss(),(e=T.gl)!=null&&e.xr&&T.xr.disconnect(),_z(T),_f.delete(g),t&&t(g)}catch{}},500)})}}wm.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:Ae.version});function Am(){return Am=Object.assign?Object.assign.bind():function(g){for(var t=1;t=0?x=setTimeout(e,t-p):(x=null,i||(y=g.apply(E,T),E=T=null))}var r=function(){E=this,T=arguments,s=Date.now();var p=i&&!x;return x||(x=setTimeout(e,t)),p&&(y=g.apply(E,T),E=T=null),y};return r.clear=function(){x&&(clearTimeout(x),x=null)},r.flush=function(){x&&(y=g.apply(E,T),E=T=null,clearTimeout(x),x=null)},r}Ax.debounce=Ax;var v7=Ax;const cM=Xd(v7);function m7(g){let{debounce:t,scroll:i,polyfill:x,offsetSize:T}=g===void 0?{debounce:0,scroll:!1,offsetSize:!1}:g;const E=x||(typeof window>"u"?class{}:window.ResizeObserver);if(!E)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,y]=Ae.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),e=Ae.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s}),r=t?typeof t=="number"?t:t.scroll:null,p=t?typeof t=="number"?t:t.resize:null,h=Ae.useRef(!1);Ae.useEffect(()=>(h.current=!0,()=>void(h.current=!1)));const[a,l,n]=Ae.useMemo(()=>{const c=()=>{if(!e.current.element)return;const{left:d,top:v,width:m,height:S,bottom:M,right:w,x:C,y:A}=e.current.element.getBoundingClientRect(),P={left:d,top:v,width:m,height:S,bottom:M,right:w,x:C,y:A};e.current.element instanceof HTMLElement&&T&&(P.height=e.current.element.offsetHeight,P.width=e.current.element.offsetWidth),Object.freeze(P),h.current&&!S7(e.current.lastBounds,P)&&y(e.current.lastBounds=P)};return[c,p?cM(c,p):c,r?cM(c,r):c]},[y,T,r,p]);function u(){e.current.scrollContainers&&(e.current.scrollContainers.forEach(c=>c.removeEventListener("scroll",n,!0)),e.current.scrollContainers=null),e.current.resizeObserver&&(e.current.resizeObserver.disconnect(),e.current.resizeObserver=null)}function f(){e.current.element&&(e.current.resizeObserver=new E(n),e.current.resizeObserver.observe(e.current.element),i&&e.current.scrollContainers&&e.current.scrollContainers.forEach(c=>c.addEventListener("scroll",n,{capture:!0,passive:!0})))}const o=c=>{!c||c===e.current.element||(u(),e.current.element=c,e.current.scrollContainers=zA(c),f())};return y7(n,!!i),g7(l),Ae.useEffect(()=>{u(),f()},[i,n,l]),Ae.useEffect(()=>u,[]),[o,s,a]}function g7(g){Ae.useEffect(()=>{const t=g;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[g])}function y7(g,t){Ae.useEffect(()=>{if(t){const i=g;return window.addEventListener("scroll",i,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",i,!0)}},[g,t])}function zA(g){const t=[];if(!g||g===document.body)return t;const{overflow:i,overflowX:x,overflowY:T}=window.getComputedStyle(g);return[i,x,T].some(E=>E==="auto"||E==="scroll")&&t.push(g),[...t,...zA(g.parentElement)]}const x7=["x","y","top","bottom","left","right","width","height"],S7=(g,t)=>x7.every(i=>g[i]===t[i]);var T7=Object.defineProperty,E7=Object.defineProperties,M7=Object.getOwnPropertyDescriptors,dM=Object.getOwnPropertySymbols,C7=Object.prototype.hasOwnProperty,w7=Object.prototype.propertyIsEnumerable,pM=(g,t,i)=>t in g?T7(g,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):g[t]=i,vM=(g,t)=>{for(var i in t||(t={}))C7.call(t,i)&&pM(g,i,t[i]);if(dM)for(var i of dM(t))w7.call(t,i)&&pM(g,i,t[i]);return g},A7=(g,t)=>E7(g,M7(t)),mM,gM;typeof window<"u"&&((mM=window.document)!=null&&mM.createElement||((gM=window.navigator)==null?void 0:gM.product)==="ReactNative")?Ae.useLayoutEffect:Ae.useEffect;function GA(g,t,i){if(!g)return;if(i(g)===!0)return g;let x=t?g.return:g.child;for(;x;){const T=GA(x,t,i);if(T)return T;x=t?null:x.sibling}}function VA(g){try{return Object.defineProperties(g,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return g}}const yM=console.error;console.error=function(){const g=[...arguments].join("");if(g?.startsWith("Warning:")&&g.includes("useContext")){console.error=yM;return}return yM.apply(this,arguments)};const Y1=VA(Ae.createContext(null));class HA extends Ae.Component{render(){return Ae.createElement(Y1.Provider,{value:this._reactInternals},this.props.children)}}function P7(){const g=Ae.useContext(Y1);if(g===null)throw new Error("its-fine: useFiber must be called within a !");const t=Ae.useId();return Ae.useMemo(()=>{for(const x of[g,g?.alternate]){if(!x)continue;const T=GA(x,!1,E=>{let s=E.memoizedState;for(;s;){if(s.memoizedState===t)return!0;s=s.next}});if(T)return T}},[g,t])}function R7(){const g=P7(),[t]=Ae.useState(()=>new Map);t.clear();let i=g;for(;i;){if(i.type&&typeof i.type=="object"){const T=i.type._context===void 0&&i.type.Provider===i.type?i.type:i.type._context;T&&T!==Y1&&!t.has(T)&&t.set(T,Ae.useContext(VA(T)))}i=i.return}return t}function b7(){const g=R7();return Ae.useMemo(()=>Array.from(g.keys()).reduce((t,i)=>x=>Ae.createElement(t,null,Ae.createElement(i.Provider,A7(vM({},x),{value:g.get(i)}))),t=>Ae.createElement(HA,vM({},t))),[g])}const dy={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function L7(g){const{handlePointer:t}=n7(g);return{priority:1,enabled:!0,compute(i,x,T){x.pointer.set(i.offsetX/x.size.width*2-1,-(i.offsetY/x.size.height)*2+1),x.raycaster.setFromCamera(x.pointer,x.camera)},connected:void 0,handlers:Object.keys(dy).reduce((i,x)=>({...i,[x]:t(x)}),{}),update:()=>{var i;const{events:x,internal:T}=g.getState();(i=T.lastEvent)!=null&&i.current&&x.handlers&&x.handlers.onPointerMove(T.lastEvent.current)},connect:i=>{var x;const{set:T,events:E}=g.getState();E.disconnect==null||E.disconnect(),T(s=>({events:{...s.events,connected:i}})),Object.entries((x=E.handlers)!=null?x:[]).forEach(([s,y])=>{const[e,r]=dy[s];i.addEventListener(e,y,{passive:r})})},disconnect:()=>{const{set:i,events:x}=g.getState();if(x.connected){var T;Object.entries((T=x.handlers)!=null?T:[]).forEach(([E,s])=>{if(x&&x.connected instanceof HTMLElement){const[y]=dy[E];x.connected.removeEventListener(y,s)}}),i(E=>({events:{...E.events,connected:void 0}}))}}}}const F7=Ae.forwardRef(function({children:t,fallback:i,resize:x,style:T,gl:E,events:s=L7,eventSource:y,eventPrefix:e,shadows:r,linear:p,flat:h,legacy:a,orthographic:l,frameloop:n,dpr:u,performance:f,raycaster:o,camera:c,scene:d,onPointerMissed:v,onCreated:m,...S},M){Ae.useMemo(()=>Kz(zz),[]);const w=b7(),[C,A]=m7({scroll:!0,debounce:{scroll:50,resize:0},...x}),P=Ae.useRef(null),b=Ae.useRef(null);Ae.useImperativeHandle(M,()=>P.current);const O=bA(v),[I,D]=Ae.useState(!1),[B,G]=Ae.useState(!1);if(I)throw I;if(B)throw B;const z=Ae.useRef(null);sp(()=>{const j=P.current;A.width>0&&A.height>0&&j&&(z.current||(z.current=d7(j)),z.current.configure({gl:E,events:s,shadows:r,linear:p,flat:h,legacy:a,orthographic:l,frameloop:n,dpr:u,performance:f,raycaster:o,camera:c,scene:d,size:A,onPointerMissed:(...Q)=>O.current==null?void 0:O.current(...Q),onCreated:Q=>{Q.events.connect==null||Q.events.connect(y?Jz(y)?y.current:y:b.current),e&&Q.setEvents({compute:(tt,Y)=>{const Z=tt[e+"X"],U=tt[e+"Y"];Y.pointer.set(Z/Y.size.width*2-1,-(U/Y.size.height)*2+1),Y.raycaster.setFromCamera(Y.pointer,Y.camera)}}),m?.(Q)}}),z.current.render(Ae.createElement(w,null,Ae.createElement(LA,{set:G},Ae.createElement(Ae.Suspense,{fallback:Ae.createElement($z,{set:D})},t)))))}),Ae.useEffect(()=>{const j=P.current;if(j)return()=>UA(j)},[]);const X=y?"none":"auto";return Ae.createElement("div",Am({ref:b,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:X,...T}},S),Ae.createElement("div",{ref:C,style:{width:"100%",height:"100%"}},Ae.createElement("canvas",{ref:P,style:{display:"block"}},i)))}),O7=Ae.forwardRef(function(t,i){return Ae.createElement(HA,null,Ae.createElement(F7,Am({},t,{ref:i})))});function Bo(g,t={}){let i=Ae.useCallback(T=>t.keys?K4(g,t.keys,T):g.listen(T),[t.keys,g]),x=g.get.bind(g);return Ae.useSyncExternalStore(i,x,x)}const D7=[new qa(-Math.PI/2,-Math.PI/2,-Math.PI/2),new qa(0,Math.PI/2,0),new qa(0,-Math.PI/2,-Math.PI/2),new qa(Math.PI/2,Math.PI,Math.PI),new qa(0,0,-Math.PI/2),new qa(Math.PI,0,0)],I7=({diceValues:g,isRolling:t,textures:i})=>{const x=Ae.useRef([]),T=Ae.useRef([]);return Ae.useEffect(()=>{const E=new oA,s=new ze(16766720);T.current=[new ml({map:E.load(i.side1),color:s}),new ml({map:E.load(i.side2),color:s}),new ml({map:E.load(i.side3),color:s}),new ml({map:E.load(i.side4),color:s}),new ml({map:E.load(i.side5),color:s}),new ml({map:E.load(i.side6),color:s})],x.current.forEach(y=>{y&&(y.material=T.current)})},[i]),u7(()=>{x.current.forEach((E,s)=>{if(E)if(t)E.rotation.x+=.2,E.rotation.y+=.2;else{const y=D7[g[s]-1];E.rotation.x=lm.lerp(E.rotation.x,y.x,.1),E.rotation.y=lm.lerp(E.rotation.y,y.y,.1),E.rotation.z=lm.lerp(E.rotation.z,y.z,.1)}})}),Qt.jsx(Qt.Fragment,{children:g.map((E,s)=>Qt.jsxs("mesh",{ref:y=>x.current[s]=y,position:[s*2-(g.length-1),0,0],children:[Qt.jsx("boxGeometry",{args:[1,1,1]}),T.current.length===6&&T.current.map((y,e)=>Qt.jsx("meshStandardMaterial",{attach:`material-${e}`,...y},e))]},s))})},N7=({styleClass:g,textures:t,diceCount:i})=>{const x=Bo(Sd);Ae.useEffect(()=>{GI("Dice"),HI(t),VI({type:"ROLL_DICE",diceValues:Array(i).fill(1),isRolling:!1})},[t,i]);const T=()=>{MT(!0),setTimeout(()=>{const E=Array.from({length:i},()=>Math.floor(Math.random()*6)+1);console.log("New dice values:",E),h2(E),MT(!1);const s={diceValues:E};xi.emit("diceRollResult",s)},2e3)};return Qt.jsxs("div",{className:`flex flex-col items-center justify-center p-4 ${g}`,children:[Qt.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Dice Roller"}),Qt.jsxs(O7,{className:"w-full h-full",camera:{position:[0,0,5]},children:[Qt.jsx("ambientLight",{intensity:2.5}),Qt.jsx("pointLight",{position:[10,10,10]}),uT(x.action)&&Qt.jsx(I7,{diceValues:x.action.diceValues,isRolling:x.action.isRolling,textures:x.textures})]}),uT(x.action)&&Qt.jsx("button",{onClick:T,className:`mt-4 p-2 border border-yellow-300 rounded text-yellow-400 ${x.action.isRolling?"opacity-50":""}`,disabled:x.action.isRolling,children:"Roll Dice"})]})};class WA{constructor(t,i,x){this.scene=t,this.gridEngine=i,this.quadtree=x,this.cursor=this.scene.input.keyboard?.createCursorKeys(),this.initializeWASDKeys(),this.registerEventHandlers(),this.tooltip=this.scene.add.text(0,0,"Press [F]",{font:"16px Arial",backgroundColor:"#000000"}).setDepth(4).setPadding(3,2,2,3).setVisible(!1)}initializeWASDKeys(){const t=this.scene.input.keyboard;t&&(this.wasdKeys={W:t.addKey(Phaser.Input.Keyboard.KeyCodes.W),A:t.addKey(Phaser.Input.Keyboard.KeyCodes.A),S:t.addKey(Phaser.Input.Keyboard.KeyCodes.S),D:t.addKey(Phaser.Input.Keyboard.KeyCodes.D)})}handleConsume(t){const i=xl(t);i&&i.consumable?(console.log(`Consuming item: ${i.name}`),UI(i),ET(i.id)):console.log(`Item ${t} is not consumable`)}handleEquip(t){const i=xl(t);i&&(console.log(`Equipping item: ${i.name}`),RI("weapon",i.id))}handleUnequip(t){const i=xl(t);i&&(console.log(`Unequipping item: ${i.name}`),bI("weapon"))}handleDiscard(t){console.log(`Discarding item: ${t}`),ET(t)}handleView(t){const i=xl(t);if(i&&(console.log(`Viewing item: ${i.name} with ${i.slug}`),i.slug)){const x=`https://kbve.com/${i.slug}#${i.name.toLowerCase().replace(/\s+/g,"-").replace(/[^\w-]+/g,"")}`;window.open(x,"_blank")}}registerEventHandlers(){xi.on("itemAction",this.handleItemAction.bind(this));//! Broken +xi.on("playerMove",this.handlePlayerMove.bind(this)),xi.on("playerReward",this.handlePlayerReward.bind(this)),xi.on("playerDamage",this.handlePlayerCombatDamage.bind(this))}handleItemAction(t){if(t)switch(console.log(`Preparing Action: ${t.itemId} with ${t.action}`),t.action){case"consume":this.handleConsume(t.itemId);break;case"equip":this.handleEquip(t.itemId);break;case"unequip":this.handleUnequip(t.itemId);break;case"discard":this.handleDiscard(t.itemId);break;case"view":this.handleView(t.itemId);break;default:console.log(`Unknown action: ${t.action}`)}}handlePlayerReward(t){console.log("Rewarding the player"),t&&(xi.emit("notification",{title:"Success",message:t.message,notificationType:wu.success}),PI(t.item))}handlePlayerCombatDamage(t){t&&(l2(parseInt(t.damage)),xi.emit("notification",{title:"Danger",message:`You taken ${t.damage} points of damage!`,notificationType:wu.danger}))}handlePlayerMove(t){t&&this.gridEngine.moveTo("player",{x:t.x,y:t.y})}checkForNearbyObjects(){const i=this.gridEngine.getPosition("player"),x=i.x*48,T=i.y*48;this.quadtree.query(i).length>0?this.tooltip.setPosition(x,T-60).setVisible(!0):this.tooltip.setVisible(!1)}handleMovement(){if(!this.cursor)return;const t=this.cursor,i=this.wasdKeys;if(this.scene.input.keyboard?.addKey("F").isDown){const x=this.gridEngine.getPosition("player"),T=this.quadtree.query(x);for(const E of T)E.action()}(t.left.isDown||i.A.isDown)&&(t.up.isDown||i.W.isDown)?this.gridEngine.move("player","up-left"):(t.left.isDown||i.A.isDown)&&(t.down.isDown||i.S.isDown)?this.gridEngine.move("player","down-left"):(t.right.isDown||i.D.isDown)&&(t.up.isDown||i.W.isDown)?this.gridEngine.move("player","up-right"):(t.right.isDown||i.D.isDown)&&(t.down.isDown||i.S.isDown)?this.gridEngine.move("player","down-right"):t.left.isDown||i.A.isDown?this.gridEngine.move("player","left"):t.right.isDown||i.D.isDown?this.gridEngine.move("player","right"):t.up.isDown||i.W.isDown?this.gridEngine.move("player","up"):(t.down.isDown||i.S.isDown)&&this.gridEngine.move("player","down"),this.checkForNearbyObjects()}}class XA extends Phaser.GameObjects.Container{constructor(t,i,x,T){const E=i.x,s=i.y-i.height+10;super(t,E,s),this.sprite=i;const y=150,e=40+T.length*20;this.background=t.add.rectangle(0,0,y,e,0,.7),this.text=t.add.text(0,-e/2+10,x,{fontSize:"12px",color:"#ffffff"}).setOrigin(.5),this.buttons=T.map((r,p)=>{const h=t.add.text(0,-e/2+30+p*20,r.label,{fontSize:"12px",color:"#00ff00"}).setOrigin(.5);return h.setInteractive({useHandCursor:!0}),h.on("pointerdown",r.callback),h}),this.add(this.background),this.add(this.text),this.buttons.forEach(r=>this.add(r)),this.scene.add.existing(this)}updatePosition(){this.setPosition(this.sprite.x-30,this.sprite.y-this.sprite.height-this.background.height/2+100)}static attachToSprite(t,i,x,T){i.setInteractive(),i.on("pointerover",E=>{const s={npcId:i.name,npcName:x,actions:T.map(e=>e.label),coords:{x:E.x,y:E.y}};if(xi.emit("npcInteraction",s),!i.getData("tooltipMenu")){const e=new XA(t,i,x,T);i.setData("tooltipMenu",e)}const y=i.getData("tooltipMenu");y.setVisible(!0),y.updatePosition()}),i.on("pointerout",()=>{const E=i.getData("tooltipMenu");E&&E.setVisible(!1)})}static updateAllTooltipPositions(t){t.children.list.forEach(i=>{if(i instanceof Phaser.GameObjects.Sprite){const x=i.getData("tooltipMenu");x&&x.updatePosition()}})}}let mG=class extends Phaser.GameObjects.Sprite{};function B7(g,t,i,x){const y=g.add.graphics();y.fillStyle(16777215,1),y.fillRoundedRect(0,0,200,60,16),y.setDepth(99);const e=g.add.text(100,30,i,{fontFamily:"Arial",fontSize:16,color:"#000000"});e.setOrigin(.5),e.setWordWrapWidth(200-10*2),e.setDepth(100);const r=g.add.container(0,0,[y,e]);return r.setDepth(100),t.messageBubble=r,z7(t),g.time.addEvent({delay:x,callback:()=>{r.destroy(),t.messageBubble===r&&(t.messageBubble=void 0)},callbackScope:g}),r}function U7(g,t,i){const s=g.add.graphics();s.fillStyle(16777215,1),s.fillRoundedRect(0,0,200,60,16),s.setDepth(99);const y=g.add.text(100,30,i,{fontFamily:"Arial",fontSize:16,color:"#000000"});y.setOrigin(.5),y.setWordWrapWidth(200-10*2),y.setDepth(100);const e=g.add.container(0,0,[s,y]);return e.setDepth(100),t.textBubble=e,Px(t),e}function Px(g){const t=g.textBubble;t&&(t.x=g.x,t.y=g.y-g.height-t.height/2)}function z7(g){const t=g.messageBubble;t&&(t.x=g.x,t.y=g.y-g.height-t.height/2)}var YA={exports:{}};(function(g,t){(function(i,x){g.exports=x()})(my,function(){var i=function(V,K){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(et,st){et.__proto__=st}||function(et,st){for(var ht in st)Object.prototype.hasOwnProperty.call(st,ht)&&(et[ht]=st[ht])})(V,K)},x=function(){return(x=Object.assign||function(V){for(var K,et=1,st=arguments.length;et"u"||E.Promise||(E.Promise=Promise);var r=Object.getPrototypeOf,p={}.hasOwnProperty;function h(V,K){return p.call(V,K)}function a(V,K){typeof K=="function"&&(K=K(r(V))),(typeof Reflect>"u"?s:Reflect.ownKeys)(K).forEach(function(et){n(V,et,K[et])})}var l=Object.defineProperty;function n(V,K,et,st){l(V,K,e(et&&h(et,"get")&&typeof et.get=="function"?{get:et.get,set:et.set,configurable:!0}:{value:et,configurable:!0,writable:!0},st))}function u(V){return{from:function(K){return V.prototype=Object.create(K.prototype),n(V.prototype,"constructor",V),{extend:a.bind(null,V.prototype)}}}}var f=Object.getOwnPropertyDescriptor,o=[].slice;function c(V,K,et){return o.call(V,K,et)}function d(V,K){return K(V)}function v(V){if(!V)throw new Error("Assertion Failed")}function m(V){E.setImmediate?setImmediate(V):setTimeout(V,0)}function S(V,K){if(typeof K=="string"&&h(V,K))return V[K];if(!K)return V;if(typeof K!="string"){for(var et=[],st=0,ht=K.length;st"u"?[]:function(){var V=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[V,r(V),V];var K=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[K,r(K),V]}(),re=Gs[0],lr=Gs[1],Gs=Gs[2],lr=lr&&lr.then,le=re&&re.constructor,ge=!!Gs,xe=function(V,K){je.push([V,K]),te&&(queueMicrotask(zi),te=!1)},Pe=!0,te=!0,Ge=[],Oe=[],Be=gt,Le={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:rt,pgp:!1,env:{},finalize:rt},ne=Le,je=[],ri=0,Ei=[];function he(V){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var K=this._PSD=ne;if(typeof V!="function"){if(V!==Ht)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Me(this,this._value))}this._state=null,this._value=null,++K.ref,function et(st,ht){try{ht(function(pt){if(st._state===null){if(pt===st)throw new TypeError("A promise cannot be resolved with itself.");var Mt=st._lib&&Di();pt&&typeof pt.then=="function"?et(st,function(Nt,zt){pt instanceof he?pt._then(Nt,zt):pt.then(Nt,zt)}):(st._state=!0,st._value=pt,Ce(st)),Mt&&en()}},Me.bind(null,st))}catch(pt){Me(st,pt)}}(this,V)}var Si={get:function(){var V=ne,K=Qr;function et(st,ht){var pt=this,Mt=!V.global&&(V!==ne||K!==Qr),Nt=Mt&&!xs(),zt=new he(function(ct,St){Ve(pt,new bt(ie(st,V,Mt,Nt),ie(ht,V,Mt,Nt),ct,St,V))});return this._consoleTask&&(zt._consoleTask=this._consoleTask),zt}return et.prototype=Ht,et},set:function(V){n(this,"then",V&&V.prototype===Ht?Si:{get:function(){return V},set:Si.set})}};function bt(V,K,et,st,ht){this.onFulfilled=typeof V=="function"?V:null,this.onRejected=typeof K=="function"?K:null,this.resolve=et,this.reject=st,this.psd=ht}function Me(V,K){var et,st;Oe.push(K),V._state===null&&(et=V._lib&&Di(),K=Be(K),V._state=!1,V._value=K,st=V,Ge.some(function(ht){return ht._value===st._value})||Ge.push(st),Ce(V),et&&en())}function Ce(V){var K=V._listeners;V._listeners=[];for(var et=0,st=K.length;et.",$e="String expected.",qe=[],ii="__dbnames",ai="readonly",Ji="readwrite";function hn(V,K){return V?K?function(){return V.apply(this,arguments)&&K.apply(this,arguments)}:V:K}var ki={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function gn(V){return typeof V!="string"||/\./.test(V)?function(K){return K}:function(K){return K[V]===void 0&&V in K&&delete(K=O(K))[V],K}}function ti(){throw q.Type()}function Se(V,K){try{var et=Nr(V),st=Nr(K);if(et!==st)return et==="Array"?1:st==="Array"?-1:et==="binary"?1:st==="binary"?-1:et==="string"?1:st==="string"?-1:et==="Date"?1:st!=="Date"?NaN:-1;switch(et){case"number":case"Date":case"string":return K$t+ae&&jt($t+Ft)})})}var Zt=ji(et)&&et.limit===1/0&&(typeof V!="function"||V===La)&&{index:et.index,range:et.range};return jt(0).then(function(){if(0=Ft})).length!==0?(St.forEach(function(jt){Wt.push(function(){var Zt=It,$t=jt._cfg.dbschema;Ia(vt,Zt,Ut),Ia(vt,$t,Ut),It=vt._dbSchema=$t;var ae=Rn(Zt,$t);ae.add.forEach(function(me){Fa(Ut,me[0],me[1].primKey,me[1].indexes)}),ae.change.forEach(function(me){if(me.recreate)throw new q.Upgrade("Not yet support for changing primary key");var be=Ut.objectStore(me.name);me.add.forEach(function(_e){return En(be,_e)}),me.change.forEach(function(_e){be.deleteIndex(_e.name),En(be,_e)}),me.del.forEach(function(_e){return be.deleteIndex(_e)})});var ue=jt._cfg.contentUpgrade;if(ue&&jt._cfg.version>Ft){jo(vt,Ut),Lt._memoizedTables={};var Re=w($t);ae.del.forEach(function(me){Re[me]=Zt[me]}),zr(vt,[vt.Transaction.prototype]),Fl(vt,[vt.Transaction.prototype],s(Re),Re),Lt.schema=Re;var pe,we=Q(ue);return we&&Us(),ae=he.follow(function(){var me;(pe=ue(Lt))&&we&&(me=xs.bind(null,null),pe.then(me,me))}),pe&&typeof pe.then=="function"?he.resolve(pe):ae.then(function(){return pe})}}),Wt.push(function(Zt){var $t,ae,ue=jt._cfg.dbschema;$t=ue,ae=Zt,[].slice.call(ae.db.objectStoreNames).forEach(function(Re){return $t[Re]==null&&ae.db.deleteObjectStore(Re)}),zr(vt,[vt.Transaction.prototype]),Fl(vt,[vt.Transaction.prototype],vt._storeNames,vt._dbSchema),Lt.schema=vt._dbSchema}),Wt.push(function(Zt){vt.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(vt.idbdb.version/10)===jt._cfg.version?(vt.idbdb.deleteObjectStore("$meta"),delete vt._dbSchema.$meta,vt._storeNames=vt._storeNames.filter(function($t){return $t!=="$meta"})):Zt.objectStore("$meta").put(jt._cfg.version,"version"))})}),function jt(){return Wt.length?he.resolve(Wt.shift()(Lt.idbtrans)).then(jt):he.resolve()}().then(function(){Oa(It,Ut)})):he.resolve();var vt,Ft,Lt,Ut,Wt,It}).catch(Mt)):(s(ht).forEach(function(St){Fa(et,St,ht[St].primKey,ht[St].indexes)}),jo(V,et),void he.follow(function(){return V.on.populate.fire(pt)}).catch(Mt));var zt,ct})}function Ch(V,K){Oa(V._dbSchema,K),K.db.version%10!=0||K.objectStoreNames.contains("$meta")||K.db.createObjectStore("$meta").add(Math.ceil(K.db.version/10-1),"version");var et=Da(0,V.idbdb,K);Ia(V,V._dbSchema,K);for(var st=0,ht=Rn(et,V._dbSchema).change;stMath.pow(2,62)?0:It.oldVersion,vt=It<1,V.idbdb=Wt.result,pt&&Ch(V,St),yn(V,It/10,St,Lt))},Lt),Wt.onsuccess=di(function(){St=null;var It,jt,Zt,$t,ae,ue=V.idbdb=Wt.result,Re=c(ue.objectStoreNames);if(0"u"?he.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(Ft){function Lt(){return indexedDB.databases().finally(Ft)}zt=setInterval(Lt,100),Lt()}).finally(function(){return clearInterval(zt)}):Promise.resolve()).then(Nt)]).then(function(){return Mt(),K.onReadyBeingFired=[],he.resolve(Wr(function(){return V.on.ready.fire(V.vip)})).then(function Ft(){if(0K.limit?Ft.length=K.limit:V.length===K.limit&&Ft.length=jt.limit&&(!jt.values||ue.req.values)&&po(ue.req.query.range,jt.query.range)}),!1,Zt,$t];case"count":return ae=$t.find(function(ue){return _i(ue.req.query.range,jt.query.range)}),[ae,!!ae,Zt,$t]}}(K,et,"query",pt),St=ct[0],vt=ct[1],Ft=ct[2],Lt=ct[3];return St&&vt?St.obsSet=pt.obsSet:(vt=st.query(pt).then(function(Ut){var Wt=Ut.result;if(St&&(St.res=Wt),Mt){for(var It=0,jt=Wt.length;It{console.log(`Texture ${s} loaded successfully.`),this.addNPCToScene(t,E,x,T)}),t.load.start()}else throw new Error(`Sprite with ID ${E.spriteImageId} not found`)}}catch(E){E instanceof Error?console.error(`Failed to load NPC: ${E.message}`):console.error("Failed to load NPC:",E)}}addNPCToScene(t,i,x,T){try{console.log(`Adding NPC to scene: ${JSON.stringify(i)}`),console.log(`Using sprite key: ${i.spriteKey}`);const E=t.add.sprite(0,0,i.spriteKey);E.scale=i.scale||1.5,E.name=i.id||"Error Missing Name",console.log(`NPC Sprite created with texture key ${i.spriteKey} at position (${i.startPosition.x}, ${i.startPosition.y})`);const s={id:i.id,sprite:E,walkingAnimationMapping:i.walkingAnimationMapping,startPosition:{x:x??i.startPosition.x,y:T??i.startPosition.y},speed:i.speed};if(console.log(`Grid engine config: ${JSON.stringify(s)}`),!t.textures.exists(i.spriteKey))throw new Error(`Texture with key ${i.spriteKey} does not exist in the scene`);t.gridEngine.addCharacter(s),console.log(`NPC added to grid engine with ID ${i.id}`),((e,r,p)=>{const h=t.gridEngine.getPosition(e.name);console.log(`Attaching NPC events to ${r} at position: ${JSON.stringify(h)}`),kA.attachNPCEvent(e,r,p,{coords:h})})(E,i.name,i.actions.map(e=>({label:e}))),console.log(`NPC ${i.name} added to scene successfully`)}catch(E){E instanceof Error?console.error(`Error adding NPC to scene from addNPCToScene: ${E.message}`):console.error("Error adding NPC to scene:",E)}}async addDialogue(t){await this.dialogues.put(t)}async getDialogue(t){return await this.dialogues.get(t)}async getAllDialogues(){return await this.dialogues.toArray()}async getDialoguesForNPC(t){const i=await this.getNPC(t);if(!i)throw new Error(`NPC with ID ${t} not found`);return(await Promise.all((i.dialogues||[]).map(T=>this.getDialogue(T.dialogueId)))).filter(T=>T!==void 0)}async markDialogueAsRead(t,i){const x=await this.getNPC(t);if(!x)throw new Error(`NPC with ID ${t} not found`);const T=x.dialogues?.find(E=>E.dialogueId===i);T&&(T.read=!0,await this.addNPC(x))}async fetchDialogues(t){try{const x=(await mn.get(t)).data.key,T=Object.values(x).map(E=>({...E}));await this.dialogues.bulkPut(T)}catch(i){console.error(`Failed to fetch dialogues from ${t}:`,i)}}async getPrioritizedDialoguesForNPC(t){try{const i=await this.getNPC(t);if(!i)throw new Error(`NPC with ID ${t} not found`);const T=(await Promise.all((i.dialogues||[]).map(async E=>{const s=await this.getDialogue(E.dialogueId);return s?{...s,priority:E.priority,read:E.read}:null}))).filter(E=>E!==null);return T.sort((E,s)=>E.priority-s.priority),T}catch(i){return console.error(`Failed to get prioritized dialogues for NPC with ID ${t}:`,i),[]}}async getNPCNameById(t){return(await this.getNPC(t))?.name}}const pd=new V7;class H7{constructor(){this.actionHandlers={talk:this.talkToNPC.bind(this),quest:this.questWithNPC.bind(this),trade:this.tradeWithNPC.bind(this),combat:this.startCombat.bind(this),heal:this.healNPC.bind(this),steal:this.stealFromNPC.bind(this),lore:this.loreFromNPC.bind(this)}}getActionHandler(t){return this.actionHandlers[t]}loreFromNPC(t){console.log(`Pulling up the lore of the NPC with ID: ${t.npcId}`)}questWithNPC(t){console.log(`Starting quest with NPC with ID: ${t.npcId}`)}healNPC(t){console.log(`Healing NPC with ID: ${t.npcId}`)}async talkToNPC(t){try{console.log(`Talking to NPC with ID: ${t.npcId}`);const i=await pd.getPrioritizedDialoguesForNPC(t.npcId);if(console.log(i),i.length>0){const x=i[0];xi.emit("npcDialogue",{npcId:t.npcId,dialogue:x},1e3),console.log(`Displaying dialogue with ID: ${x.id}`)}else console.log("No dialogues available for this NPC.")}catch(i){console.error(`Failed to fetch dialogues for NPC with ID ${t.npcId}:`,i)}}tradeWithNPC(t){console.log(`Trading with NPC with ID: ${t.npcId}`)}moveToNPC(t){const x=t.data?.coords||{x:10,y:15};xi.emit("playerMove",x)}stealFromNPC(t){console.log(`Attempting to steal from NPC with ID: ${t.npcId}`);const i={npcId:t.npcId,npcName:t.npcName,data:t.data};xi.emit("playerSteal",i)}startCombat(t){console.log(`Starting combat with NPC with ID: ${t.npcId}`)}checkFish(t){console.log(`Checking fish for NPC with ID: ${t.npcId}`)}attachNPCEvent(t,i,x,T){t.setInteractive(),t.on("pointerover",E=>{const s={npcId:t.name||"",npcName:i,actions:x.map(y=>y.label),data:T||{},coords:{x:E.x,y:E.y}};xi.emit("npcInteraction",s)}),t.on("pointerout",()=>{}),t.on("pointerdown",E=>{const s={npcId:t.name||"",npcName:i,actions:x.map(y=>y.label),data:T||{},coords:{x:E.x,y:E.y}};console.log(`Click Registered at X: ${s.coords.x} Y: ${s.coords.y}`),xi.emit("npcInteractionClick",s,1e3)})}}const kA=new H7;function jA(g){return+g[g.length-1]}function KA(g){return g.startsWith("monster_bird_")&&!g.startsWith("monster_bird_shadow")}function ZA(g,t,i,x,T){const E=[];for(let s=0;s<10;s++){const y=g.add.sprite(0,0,"monster_bird");y.setCrop(t,i,x,T),y.scale=3,E.push(y)}return E}function JA(g){return ZA(g,0,0,61,47)}function $A(g){return ZA(g,22,47,16,10)}function QA(g){g.anims.create({key:"bird",frames:g.anims.generateFrameNumbers("monster_bird",{start:0,end:2}),frameRate:10,repeat:-1,yoyo:!0})}class W7 extends Jm.Scene{mainMenuButtonImage;mainMenuButtonText;constructor(){super("Preloader")}preload(){this.load.image("mainBg","https://utfs.io/f/2c17f660-7f39-4edf-b83e-122a71014d99-6gflls.webp"),this.load.image("scroll","https://kbve.com/assets/img/fishchip/scroll.webp"),this.load.audio("music","https://kbve.com/assets/img/fishchip/bg.ogg"),this.load.image("creditsBg","https://utfs.io/f/2c17f660-7f39-4edf-b83e-122a71014d99-6gflls.webp"),this.load.audio("type","https://kbve.com/assets/img/fishchip/type.mp3"),this.load.spritesheet("fishing","https://kbve.com/assets/img/fishchip/animate.png",{frameWidth:800,frameHeight:600}),this.load.image("fish","https://kbve.com/assets/img/letter_logo.png"),this.load.image("background","https://kbve.com/assets/img/fishchip/scaled_fish_menu_minigame.webp"),this.load.image("tiles","https://kbve.com/assets/img/fishchip/desert_tileset_1.png"),this.load.image("cloud-city-tiles","/assets/map/cloud_tileset.png"),this.load.tilemapTiledJSON("cloud-city-map-large","/assets/map/cloud_city_large.json"),this.load.tilemapTiledJSON("cloud-city-map","https://kbve.com/assets/img/fishchip/cloud_city.json"),this.load.spritesheet("player","https://kbve.com/assets/img/fishchip/chip_charactersheet_warmer.png",{frameWidth:52,frameHeight:72}),this.load.spritesheet("knights","/assets/entity/knights.png",{frameWidth:52,frameHeight:72}),this.load.spritesheet("jacko","/assets/entity/jacko.png",{frameWidth:52,frameHeight:72}),this.load.spritesheet("monks","/assets/entity/monks.png",{frameWidth:52,frameHeight:72}),CI()}async create(){await pd.initializeDatabase(),this.sound.get("music")?.isPlaying||this.sound.add("music",{loop:!0,volume:.1}).play(),this.add.image(480,480,"mainBg").setScale(.1),this.mainMenuButtonImage=this.add.image(480,480,"scroll").setAlpha(.9).setScale(.7,.2).setInteractive({useHandCursor:!0}),this.mainMenuButtonText=this.add.text(480,480,"Start Game",{fontFamily:"Arial Black",fontSize:50,color:"#ffffff",stroke:"#000000",strokeThickness:6}).setOrigin(.5).setInteractive({useHandCursor:!0}),this.mainMenuButtonText.on("pointerdown",()=>{this.scene.start("SandCity")},this)}}let yG=class extends sd.GameObjects.Sprite{textBubble;tooltip};class X7 extends Jm.Scene{npcSprite;fishNpcSprite;monsterBirdSprites=[];monsterBirdShadows=[];cursor;gridEngine;quadtree;playerController;constructor(){super({key:"SandCity"});const t={xMin:0,xMax:20,yMin:0,yMax:20};this.quadtree=new cu(t)}preload(){this.load.spritesheet("monster_bird","/assets/monster/bird_original.png",{frameWidth:61,frameHeight:57}),xi.emit("notification",{title:"Success",message:`You arrived safely to SandCity Passport: ${i1()}`,notificationType:wu.success})}async create(){const t=this.make.tilemap({key:"cloud-city-map"});t.addTilesetImage("Cloud City","tiles");for(let T=0;T({id:"monster_bird_"+E,sprite:T,startPosition:{x:7,y:7+E},speed:5,collides:!1})),...this.monsterBirdShadows.map((T,E)=>({id:"monster_bird_shadow_"+E,sprite:T,startPosition:{x:7,y:7+E},speed:5,collides:!1}))],numberOfDirections:8};this.gridEngine.create(t,x),this.loadRanges(),this.playerController=new WA(this,this.gridEngine,this.quadtree),B7(this,this.npcSprite,"Enter the sand pit to start fishing! Go near it and press F!",3e3),await pd.loadCharacter(this,"01J2DT4G871KJ0VNSHCNC5REDM",6,6),await pd.loadCharacter(this,"01J2HCTMQ58JBMJGW9YA3FBQCG",8,8),await pd.loadCharacter(this,"01J2HQJBMBGEEMWDBDWATRCY3T",8,15),this.gridEngine.moveRandomly("npc",1500,3),this.gridEngine.moveRandomly("fishNpc",1500,3);for(let T=0;T<10;T++)this.gridEngine.moveRandomly("monster_bird_"+T,1e3,10);this.gridEngine.positionChangeStarted().subscribe(({charId:T,exitTile:E,enterTile:s})=>{KA(T)&&this.gridEngine.moveTo("monster_bird_shadow_"+jA(T),{x:s.x,y:s.y})}),window.__GRID_ENGINE__=this.gridEngine}loadRanges(){const t=[{name:"well",bounds:{xMin:2,xMax:5,yMin:10,yMax:14},action:()=>{const i={message:"Seems like there are no fish in the sand pits. You know null, this area could be fixed up a bit too."};xi.emit("charEvent",i)}},{name:"sign",bounds:{xMin:2,xMax:5,yMin:2,yMax:5},action:()=>{const i={message:"Sign does not have much to say.",character_name:"Evee The BarKeep",character_image:"/assets/npc/barkeep.webp",background_image:"/assets/background/woodensign.webp"};xi.emit("charEvent",i)}},{name:"building",bounds:{xMin:13,xMax:13,yMin:6,yMax:7},action:()=>{const i={message:"Sorry, we are closed!",character_name:"Evee The BarKeep",character_image:"/assets/npc/barkeep.webp",background_image:"/assets/background/animebar.webp"};xi.emit("charEvent",i)}},{name:"tombstone",bounds:{xMin:7,xMax:10,yMin:9,yMax:10},action:()=>{const i={message:"Samson the Great was an amazing sailer, died drinking dat drank.",character_name:"Samson Statue",character_image:"/assets/npc/samson.png",background_image:"/assets/background/animetombstone.webp"};xi.emit("charEvent",i)}}];for(const i of t)this.quadtree.insert(i)}update(){this.playerController?.handleMovement()}}class SG extends sd.GameObjects.Sprite{textBubble}class Y7 extends Jm.Scene{npcSprite;fishNpcSprite;monsterBirdSprites=[];monsterBirdShadows=[];cursor;gridEngine;quadtree;playerController;constructor(){super({key:"CloudCity"});const t={xMin:0,xMax:20,yMin:0,yMax:20};this.quadtree=new cu(t)}preload(){this.load.spritesheet("monster_bird","/assets/monster/bird_original.png",{frameWidth:61,frameHeight:57})}create(){const t=this.make.tilemap({key:"cloud-city-map-large"});t.addTilesetImage("cloud_tileset","cloud-city-tiles");for(let T=0;T({id:"monster_bird_"+E,sprite:T,startPosition:{x:7,y:7+E},speed:5,collides:!1})),...this.monsterBirdShadows.map((T,E)=>({id:"monster_bird_shadow_"+E,sprite:T,startPosition:{x:7,y:7+E},speed:5,collides:!1}))],numberOfDirections:8};this.gridEngine.create(t,x),this.loadRanges(),this.playerController=new WA(this,this.gridEngine,this.quadtree),U7(this,this.npcSprite,"Enter the sand pit to start fishing! Go near it and press F!"),this.gridEngine.moveRandomly("npc",1500,3);for(let T=0;T<10;T++)this.gridEngine.moveRandomly("monster_bird_"+T,1e3,20);this.gridEngine.positionChangeStarted().subscribe(({charId:T,exitTile:E,enterTile:s})=>{KA(T)&&this.gridEngine.moveTo("monster_bird_shadow_"+jA(T),{x:s.x,y:s.y})}),window.__GRID_ENGINE__=this.gridEngine}loadRanges(){const t=[{name:"well",bounds:{xMin:2,xMax:5,yMin:10,yMax:14},action:()=>{const i={message:"Seems like there are no fish in the sand pits. You know null, this area could be fixed up a bit too."};xi.emit("charEvent",i,1e3)}},{name:"sign",bounds:{xMin:2,xMax:5,yMin:2,yMax:5},action:async()=>{try{const T={message:`The Database Response time: ${(await(await fetch("https://api.cryptothrone.com/api/v1/speed")).json()).message.time_ms} ms`,character_name:"Planets Be Scalin",character_image:"/assets/npc/barkeep.webp",background_image:"/assets/background/woodensign.webp"};xi.emit("charEvent",T,1e3)}catch(i){console.error("Error fetching data:",i);const x={message:"Sign does not have much to say. Failed to fetch response time.",character_name:"Evee The BarKeep",character_image:"/assets/npc/barkeep.webp",background_image:"/assets/background/woodensign.webp"};xi.emit("charEvent",x,1e3)}}},{name:"building",bounds:{xMin:13,xMax:13,yMin:6,yMax:7},action:()=>{const i={message:"Sorry, we are closed!",character_name:"Evee The BarKeep",character_image:"/assets/npc/barkeep.webp",background_image:"/assets/background/animebar.webp"};xi.emit("charEvent",i,1e3)}},{name:"tombstone",bounds:{xMin:7,xMax:10,yMin:9,yMax:10},action:()=>{const i={message:"Samson the Great was an amazing sailer, died drinking dat drank.",character_name:"Samson Statue",character_image:"/assets/npc/samson.png",background_image:"/assets/background/animetombstone.webp"};xi.emit("charEvent",i,1e3)}}];for(const i of t)this.quadtree.insert(i)}update(){this.playerController?.handleMovement(),this.npcSprite&&this.npcSprite.textBubble&&Px(this.npcSprite),this.fishNpcSprite&&this.fishNpcSprite.textBubble&&Px(this.fishNpcSprite)}}const k7=dm.div` // Your style here -`;function Yz(){const g=Pe.useRef(null);return Pe.useEffect(()=>{if(g.current){const t=g.current,x={...{title:"CryptoThrone",render:{antialias:!1},scale:{mode:sd.Scale.RESIZE,min:{width:1024,height:768},max:{width:1600,height:1200},zoom:1},type:sd.AUTO,transparent:!0,width:800,height:600,physics:{default:"arcade",arcade:{gravity:{x:0,y:0},debug:!1}},plugins:{scene:[{key:"gridEngine",plugin:X4,mapping:"gridEngine"}]},scene:[Vz,Hz,Wz],input:{mouse:{preventDefaultWheel:!1},touch:{capture:!1}}},parent:t},T=new sd.Game(x);return()=>{T.destroy(!0)}}},[]),he.jsx(Xz,{children:he.jsx("div",{ref:g})})}const TM=bx({message:""}),kz=()=>{const g=Tl(TM);Pe.useEffect(()=>{const i=x=>{if(x){TM.set(x);const T=document.querySelector("#hs-stacked-overlays");T&&(T.classList.remove("hidden"),T.classList.add("open"))}};return Pi.on("charEvent",i),()=>{Pi.off("charEvent",i)}},[]);const t=()=>{const i=document.querySelector("#hs-stacked-overlays");i&&(i.classList.add("hidden"),i.classList.remove("open"))};return he.jsx(he.Fragment,{children:he.jsx("div",{id:"hs-stacked-overlays",className:"hs-overlay hs-overlay-backdrop-open:bg-gray-900/50 hidden size-full fixed top-0 start-0 z-[60] overflow-x-hidden overflow-y-auto pointer-events-none [--overlay-backdrop:static]","data-hs-overlay-keyboard":"false",children:he.jsx("div",{className:"hs-overlay-open:mt-7 hs-overlay-open:opacity-100 hs-overlay-open:duration-500 mt-0 opacity-0 ease-out transition-all sm:max-w-lg sm:w-full m-3 sm:mx-auto",children:he.jsxs("div",{className:"flex flex-col lg:flex-row bg-zinc-950 border border-yellow-500 shadow-sm rounded-xl pointer-events-auto bg-cover",style:{backgroundImage:`url(${g.background_image||"https://kbve.com/assets/img/curved-images/wave.jpg"})`},children:[he.jsxs("div",{className:"w-full lg:w-1/3 p-4 rounded-l-xl flex flex-col items-center justify-center",children:[he.jsx("h3",{className:"font-bold text-yellow-400 bg-zinc-950/80 rounded-2xl text-center mb-4",children:`${g.character_name||"NPC"}`}),he.jsx("img",{src:g.character_image||"/assets/npc/barkeep.webp",alt:"Character",className:"w-full h-auto rounded-md"})]}),he.jsxs("div",{className:"w-full lg:w-2/3 p-4 bg-cover bg-center rounded-r-xl",children:[he.jsxs("div",{className:"flex justify-between items-center pb-3 border-b",children:[he.jsx("h3",{className:"font-bold text-yellow-400",children:""}),he.jsxs("button",{type:"button",className:"flex justify-center items-center size-7 text-sm font-semibold rounded-full border border-transparent text-yellow-400 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none","data-hs-overlay":"#hs-stacked-overlays",onClick:t,children:[he.jsx("span",{className:"sr-only",children:"Close"}),he.jsxs("svg",{className:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[he.jsx("path",{d:"M18 6 6 18"}),he.jsx("path",{d:"m6 6 12 12"})]})]})]}),he.jsx("div",{className:"p-4 overflow-y-auto",children:he.jsx("p",{className:"mt-1 mb-2 text-yellow-400 bg-zinc-950/80 rounded-xl p-4",children:g.message||"No Message"})}),he.jsx("div",{className:"flex justify-end items-center gap-x-2 py-3 px-4 border-t",children:he.jsxs("button",{className:"relative rounded px-5 py-2.5 overflow-hidden group bg-yellow-500 relative hover:bg-gradient-to-r hover:from-yellow-500 hover:to-yellow-400 text-white hover:ring-2 hover:ring-offset-2 hover:ring-yellow-400 transition-all ease-out duration-300 disabled:pointer-events-none","data-hs-overlay":"#hs-stacked-overlays",onClick:t,children:[he.jsx("span",{className:"absolute right-0 w-8 h-32 -mt-12 transition-all duration-1000 transform translate-x-12 bg-white opacity-10 rotate-12 group-hover:-translate-x-40 ease"}),he.jsx("span",{className:"relative",children:"Okay."})]})})]})]})})})})},Kz=(g,t)=>{const i=yl(g);return i?he.jsxs("div",{style:{top:t.y,left:t.x},className:"absolute bg-gray-700 text-white p-2 rounded shadow-lg z-50",children:[he.jsx("p",{className:"text-sm font-semibold",children:i.name}),he.jsxs("p",{className:"text-xs",children:["Type: ",i.type]}),he.jsxs("p",{className:"text-xs",children:["Bonuses: ",JSON.stringify(i.bonuses)]}),he.jsxs("p",{className:"text-xs",children:["Durability: ",i.durability]}),he.jsxs("p",{className:"text-xs",children:["Weight: ",i.weight]})]}):null},jz=(g,t,i,x)=>he.jsx("ul",{className:"grid grid-cols-8 gap-2",children:Object.keys(g).map(T=>{const E=g[T];return Zz(E,t,i,x)})}),Zz=(g,t,i,x)=>{if(!g)return he.jsx("li",{className:"text-sm relative flex items-center justify-center border border-gray-500 bg-gray-200",style:{width:"32px",height:"32px"}},`empty-${Math.random()}`);const T=yl(g);return T?he.jsxs("li",{className:"text-sm relative",onMouseEnter:E=>t(T.id,E),onMouseLeave:i,onClick:E=>x(T.id,E),children:[T.name," (",T.type,") - Bonuses: ",JSON.stringify(T.bonuses)," - Durability: ",T.durability," - Weight: ",T.weight]},T.id):null},Jz=(g,t,i,x)=>he.jsx("ul",{className:"grid grid-cols-8 gap-1",children:g.map((T,E)=>{const s=yl(T);return s?he.jsx("li",{className:"text-sm relative hover:scale-[1.3] transition ease-in-out duration-100",onMouseEnter:y=>t(s.id,y),onMouseLeave:i,onClick:y=>x(s.id,y),children:he.jsx("img",{src:s.img,alt:s.name,style:{width:"32px",height:"32px"},className:"inline-block border border-yellow-400/50"})},E):null})}),$z=()=>{const g=Tl(Sn);Tl(gm),Tl(TI),Tl(Zr),Pe.useEffect(()=>{const r=p=>{};return Pi.on("playerEvent",r),()=>{Pi.off("playerEvent",r)}},[]);const t=(r,p)=>{Wc("tooltipItem",{id:r,position:{x:p.clientX+10,y:p.clientY-150}})},i=()=>{Wc("tooltipItem",{...Jh("tooltipItem"),id:null})},x=(r,p)=>{Wc("submenuItem",{id:r,position:{x:p.clientX,y:p.clientY-150}})},T=()=>{Wc("submenuItem",{...Jh("submenuItem"),id:null})},E=(r,p)=>{const h=yl(r);if(h){const a={itemId:h.id,action:p};Pi.emit("itemAction",a),T()}};if(!g||!g.stats)return null;const s=Jh("submenuItem"),y=s.id?BI(s.id):[],e=Jh("tooltipItem");return he.jsxs("div",{className:"fixed top-24 left-3 w-[350px] p-4 bg-zinc-800 text-yellow-400 border border-yellow-300 rounded-lg z-20 transition transform ease-in-out duration-500 opacity-50 hover:opacity-100",children:[he.jsx("button",{onClick:()=>Wc("isStatsMenuCollapsed",!Jh("isStatsMenuCollapsed")),className:"bg-yellow-500 text-white p-2 rounded",children:Jh("isStatsMenuCollapsed")?he.jsx(HI,{styleClass:"w-8"}):he.jsx(VI,{styleClass:"w-8"})}),he.jsxs("div",{className:`transition transform duration-1000 ease-in-out ${Jh("isStatsMenuCollapsed")?"max-h-0 overflow-hidden":"max-h-screen"}`,children:[he.jsxs("div",{className:"mb-4",children:[he.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Stats"}),he.jsx("p",{className:"text-sm text-green-400",children:`HP: ${g.stats.health||"0"} / ${g.stats.maxHealth}`}),he.jsx("p",{className:"text-sm text-blue-400",children:`MP: ${g.stats.mana||"0"} / ${g.stats.maxMana}`}),he.jsx("p",{className:"text-sm text-yellow-400",children:`EP: ${g.stats.energy||"0"} / ${g.stats.maxEnergy}`})]}),he.jsxs("div",{className:"mb-4",children:[he.jsx("h2",{className:"text-lg font-semibold mb-2",children:"User Information"}),he.jsx("p",{className:"text-sm",children:g.stats.username||"Guest"})]}),he.jsxs("div",{className:"mb-4",children:[he.jsx("h2",{className:"text-lg font-semibold mb-2",children:"General Information"}),he.jsx("p",{className:"text-sm",children:""})]}),he.jsxs("div",{className:"mb-4",children:[he.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Inventory"}),Jz(g.inventory.backpack,t,i,x)]}),he.jsxs("div",{className:"mb-4",children:[he.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Equipment"}),jz(g.inventory.equipment,t,i,x)]}),e.id&&Kz(e.id,e.position),s.id&&he.jsxs("div",{style:{top:s.position.y,left:s.position.x},className:"absolute bg-gray-700 text-white p-2 rounded shadow-lg z-50",children:[he.jsx("button",{onClick:T,className:"absolute top-1 right-1 translate-x-6 bg-yellow-400 p-1 text-white hover:text-gray-400",children:"X"}),he.jsx("p",{className:"text-sm strong",children:"Actions:"}),he.jsxs("ul",{className:"text-xs",children:[y.map(r=>he.jsx("li",{onClick:()=>s.id&&E(s.id,r),className:"cursor-pointer hover:bg-gray-600",children:r.charAt(0).toUpperCase()+r.slice(1)},r)),he.jsx("li",{onClick:T,className:"cursor-pointer hover:bg-gray-600",children:"Close"})]})]})]})]})},dy=bx(null),py=bx(null),Qz=()=>{const g=Tl(dy),[t,i]=Pe.useState({x:0,y:0});Pe.useEffect(()=>{const y=e=>{e&&(dy.set(e),i(x(e.coords.x,e.coords.y)))};return Pi.on("npcInteractionClick",y),()=>{Pi.off("npcInteractionClick",y)}},[]);const x=(y,e)=>{let n=y+250,u=e+250;return n+200>window.innerWidth-10&&(n=window.innerWidth-200-10),u+200>window.innerHeight-10&&(u=window.innerHeight-200-10),n<10&&(n=10),u<10&&(u=10),{x:n,y:u}},T=y=>{if(g){const e=k1.getActionHandler(y);e&&(e(g),E())}},E=()=>{dy.set(null)},s=()=>{if(!g)return null;const{npcName:y,actions:e,npcId:r}=g,{x:p,y:h}=t;return he.jsxs("div",{className:"absolute bg-zinc-900 border border-yellow-300 rounded-md p-2 z-50 transition transform ease-in-out duration-500 opacity-50 hover:opacity-100",style:{left:`${p}px`,top:`${h}px`,transform:"translate(-50%, -100%)"},children:[he.jsxs("div",{className:"flex justify-between items-center mb-2",children:[he.jsx("h3",{className:"font-bold text-sm",children:y}),he.jsx("button",{onClick:E,className:"text-xs font-bold m-1 text-yellow-300 hover:text-yellow-500",children:"X"})]}),e.map((a,l)=>he.jsx("button",{onClick:()=>T(a),className:"block w-full text-xs py-1 px-2 mb-1 bg-yellow-500 hover:bg-yellow-400 rounded",children:a},l)),he.jsx("button",{onClick:E,className:"block w-full text-xs py-1 px-2 mt-2 bg-red-500 hover:bg-red-600 rounded text-white",children:"Close"})]},r)};return he.jsx("div",{children:s()})},_z=()=>{const g=Tl(Zh);Pe.useEffect(()=>{const i=x=>{if(x){const T=Date.now()+Math.random();Zh.set([...Zh.get(),{id:T,...x}]),setTimeout(()=>{Zh.set(Zh.get().filter(E=>E.id!==T))},5e3)}};return Pi.on("notification",i),()=>{Pi.off("notification",i)}},[]);const t=i=>{Zh.set(Zh.get().filter(x=>x.id!==i))};return he.jsx("div",{className:"fixed inset-x-0 bottom-0 z-50 m-4 space-y-2",children:Array.isArray(g)&&g.map(i=>he.jsx("div",{className:`hs-removing:translate-x-5 hs-removing:opacity-0 transition duration-300 max-w-xs border rounded-xl shadow-lg ${i.notificationType.color}`,role:"alert",children:he.jsxs("div",{className:"flex p-4",children:[he.jsx("img",{src:i.notificationType.imgUrl,alt:i.notificationType.type,className:"flex-shrink-0 size-4"}),he.jsxs("div",{className:"ms-2",children:[he.jsx("h3",{className:"text-sm font-bold",children:i.title}),he.jsx("p",{className:"text-sm",children:i.message})]}),he.jsx("div",{className:"ms-auto",children:he.jsxs("button",{type:"button",className:"inline-flex flex-shrink-0 justify-center items-center size-5 rounded-lg text-gray-800 opacity-50 hover:opacity-100 focus:outline-none focus:opacity-100 dark:text-white",onClick:()=>t(i.id),children:[he.jsx("span",{className:"sr-only",children:"Close"}),he.jsxs("svg",{className:"flex-shrink-0 size-4 bg-zinc-900",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[he.jsx("path",{d:"M18 6 6 18"}),he.jsx("path",{d:"m6 6 12 12"})]})]})})]})},i.id))})},qz=()=>{const g=Tl(py),[t,i]=Pe.useState([]),[x,T]=Pe.useState(null);Pe.useEffect(()=>{const y=r=>{r&&py.set(r)},e=r=>{r&&i(r.diceValues)};return Pi.on("playerSteal",y),Pi.on("diceRollResult",e),()=>{Pi.off("playerSteal",y),Pi.off("diceRollResult",e)}},[]),Pe.useEffect(()=>{t.length>0&&E(t)},[t]);const E=y=>{const e=y.reduce((a,l)=>a+l,0);if(T(e),!g)return;let r="",p="";switch(!0){case e===12:r="01J27QABD2GPFNRVK69S51HSGB",p=`You successfully stole a ${r}!`;break;case e===11:r="01J27QN2KZG1RDZW4CE9Q9Z3YQ",p=`You successfully stole a ${r}!`;break;case e===10:r="01J269PK47V1DWX2S1251DEASD",p=`You successfully stole a ${r}!`;break;case e===9:r="Blue Shark",p=`You successfully stole a ${r}!`;break;case e>=7:r="Salmon",p=`You successfully stole a ${r}!`;break;case e===2:Pi.emit("notification",{title:"Danger",message:`You crit failed to steal from ${g.npcName}!`,notificationType:Au.danger}),Pi.emit("playerDamage",{damage:"5"});break;default:Pi.emit("notification",{title:"Danger",message:`You failed to steal from ${g.npcName}!`,notificationType:Au.danger}),Pi.emit("playerDamage",{damage:"1"});return}const h=MI(r);h?Pi.emit("playerReward",{message:p,item:h}):console.warn("Item not found in ItemDB")},s=()=>{l2([]),i([]),T(null),py.set(null)};return g?he.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50 bg-zinc-800 bg-opacity-50",children:he.jsxs("div",{className:"bg-zinc-800 p-4 rounded-lg shadow-lg max-w-xs w-full",children:[he.jsx(tG,{npcName:g.npcName,roll:x}),he.jsx(iG,{}),he.jsx(nG,{handleClose:s})]})}):null},tG=({npcName:g,roll:t})=>he.jsxs("div",{children:[he.jsx("h2",{className:"text-lg text-yellow-400 font-bold mb-4",children:"Steal Attempt"}),he.jsxs("p",{className:"mb-4",children:["Roll the dice to steal from ",g,". You need a total of 7 or higher to succeed."]}),t!==null&&he.jsxs("p",{className:"mb-4",children:["Your roll: ",t]})]}),eG=()=>he.jsx(Dz,{textures:{side1:"/assets/items/set/dice/dice1.png",side2:"/assets/items/set/dice/dice2.png",side3:"/assets/items/set/dice/dice3.png",side4:"/assets/items/set/dice/dice4.png",side5:"/assets/items/set/dice/dice5.png",side6:"/assets/items/set/dice/dice6.png"},styleClass:"h-96",diceCount:4}),iG=Pe.memo(eG),nG=({handleClose:g})=>he.jsx("button",{onClick:g,className:"block w-full py-2 bg-red-500 text-white rounded hover:bg-red-700 mt-2",children:"Close"}),rG=dm.div` +`;function j7(){const g=Ae.useRef(null);return Ae.useEffect(()=>{if(g.current){const t=g.current,x={...{title:"CryptoThrone",render:{antialias:!1},scale:{mode:sd.Scale.RESIZE,min:{width:1024,height:768},max:{width:1600,height:1200},zoom:1},type:sd.AUTO,transparent:!0,width:800,height:600,physics:{default:"arcade",arcade:{gravity:{x:0,y:0},debug:!1}},plugins:{scene:[{key:"gridEngine",plugin:k4,mapping:"gridEngine"}]},scene:[W7,X7,Y7],input:{mouse:{preventDefaultWheel:!1},touch:{capture:!1}}},parent:t},T=new sd.Game(x);return()=>{T.destroy(!0)}}},[]),Qt.jsx(k7,{children:Qt.jsx("div",{ref:g})})}const SM=Rm({message:""}),K7=()=>{const g=Bo(SM);Ae.useEffect(()=>{const i=x=>{if(x){SM.set(x);const T=document.querySelector("#hs-stacked-overlays");T&&(T.classList.remove("hidden"),T.classList.add("open"))}};return xi.on("charEvent",i),()=>{xi.off("charEvent",i)}},[]);const t=()=>{const i=document.querySelector("#hs-stacked-overlays");i&&(i.classList.add("hidden"),i.classList.remove("open"))};return Qt.jsx(Qt.Fragment,{children:Qt.jsx("div",{id:"hs-stacked-overlays",className:"hs-overlay hs-overlay-backdrop-open:bg-gray-900/50 hidden size-full fixed top-0 start-0 z-[60] overflow-x-hidden overflow-y-auto pointer-events-none [--overlay-backdrop:static]","data-hs-overlay-keyboard":"false",children:Qt.jsx("div",{className:"hs-overlay-open:mt-7 hs-overlay-open:opacity-100 hs-overlay-open:duration-500 mt-0 opacity-0 ease-out transition-all sm:max-w-lg sm:w-full m-3 sm:mx-auto",children:Qt.jsxs("div",{className:"flex flex-col lg:flex-row bg-zinc-950 border border-yellow-500 shadow-sm rounded-xl pointer-events-auto bg-cover",style:{backgroundImage:`url(${g.background_image||"https://kbve.com/assets/img/curved-images/wave.jpg"})`},children:[Qt.jsxs("div",{className:"w-full lg:w-1/3 p-4 rounded-l-xl flex flex-col items-center justify-center",children:[Qt.jsx("h3",{className:"font-bold text-yellow-400 bg-zinc-950/80 rounded-2xl text-center mb-4",children:`${g.character_name||"NPC"}`}),Qt.jsx("img",{src:g.character_image||"/assets/npc/barkeep.webp",alt:"Character",className:"w-full h-auto rounded-md"})]}),Qt.jsxs("div",{className:"w-full lg:w-2/3 p-4 bg-cover bg-center rounded-r-xl",children:[Qt.jsxs("div",{className:"flex justify-between items-center pb-3 border-b",children:[Qt.jsx("h3",{className:"font-bold text-yellow-400",children:""}),Qt.jsxs("button",{type:"button",className:"flex justify-center items-center size-7 text-sm font-semibold rounded-full border border-transparent text-yellow-400 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none","data-hs-overlay":"#hs-stacked-overlays",onClick:t,children:[Qt.jsx("span",{className:"sr-only",children:"Close"}),Qt.jsxs("svg",{className:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Qt.jsx("path",{d:"M18 6 6 18"}),Qt.jsx("path",{d:"m6 6 12 12"})]})]})]}),Qt.jsx("div",{className:"p-4 overflow-y-auto",children:Qt.jsx("p",{className:"mt-1 mb-2 text-yellow-400 bg-zinc-950/80 rounded-xl p-4",children:g.message||"No Message"})}),Qt.jsx("div",{className:"flex justify-end items-center gap-x-2 py-3 px-4 border-t",children:Qt.jsxs("button",{className:"relative rounded px-5 py-2.5 overflow-hidden group bg-yellow-500 relative hover:bg-gradient-to-r hover:from-yellow-500 hover:to-yellow-400 text-white hover:ring-2 hover:ring-offset-2 hover:ring-yellow-400 transition-all ease-out duration-300 disabled:pointer-events-none","data-hs-overlay":"#hs-stacked-overlays",onClick:t,children:[Qt.jsx("span",{className:"absolute right-0 w-8 h-32 -mt-12 transition-all duration-1000 transform translate-x-12 bg-white opacity-10 rotate-12 group-hover:-translate-x-40 ease"}),Qt.jsx("span",{className:"relative",children:"Okay."})]})})]})]})})})})},TM=({settingKey:g,label:t,collapseIcon:i=WI,expandIcon:x=XI})=>{const T=Lf(g),E=()=>id(g,!T);return Qt.jsxs("button",{onClick:E,className:"bg-yellow-500 text-white text-sm p-2 rounded ml-2 flex items-center w-20 h-10",children:[T?Qt.jsx(x,{className:"w-2"}):Qt.jsx(i,{className:"w-4"}),Qt.jsx("span",{className:"ml-2 text-xs",children:t})]})},Z7=({stats:g})=>{const t=(i,x)=>{const T=typeof i=="string"?parseInt(i,10):i,E=typeof x=="string"?parseInt(x,10):x;return Math.min(T/E*100,100)};return Qt.jsxs("div",{className:"mb-4",children:[Qt.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Stats"}),Qt.jsxs("div",{className:"mb-2",children:[Qt.jsx("p",{className:"text-sm text-green-400",children:`HP: ${g.health||"0"} / ${g.maxHealth}`}),Qt.jsx("div",{className:"w-full bg-gray-300 h-4 rounded",children:Qt.jsx("div",{className:"bg-green-400 h-full rounded",style:{width:`${t(g.health,g.maxHealth)}%`}})})]}),Qt.jsxs("div",{className:"mb-2",children:[Qt.jsx("p",{className:"text-sm text-blue-400",children:`MP: ${g.mana||"0"} / ${g.maxMana}`}),Qt.jsx("div",{className:"w-full bg-gray-300 h-4 rounded",children:Qt.jsx("div",{className:"bg-blue-400 h-full rounded",style:{width:`${t(g.mana,g.maxMana)}%`}})})]}),Qt.jsxs("div",{className:"mb-2",children:[Qt.jsx("p",{className:"text-sm text-yellow-400",children:`EP: ${g.energy||"0"} / ${g.maxEnergy}`}),Qt.jsx("div",{className:"w-full bg-gray-300 h-4 rounded",children:Qt.jsx("div",{className:"bg-yellow-400 h-full rounded",style:{width:`${t(g.energy,g.maxEnergy)}%`}})})]})]})},J7=(g,t)=>{const i=xl(g);return i?Qt.jsxs("div",{style:{top:t.y,left:t.x},className:"absolute bg-gray-700 text-white p-2 rounded shadow-lg z-50",children:[Qt.jsx("p",{className:"text-sm font-semibold",children:i.name}),Qt.jsxs("p",{className:"text-xs",children:["Type: ",i.type]}),Qt.jsxs("p",{className:"text-xs",children:["Bonuses: ",JSON.stringify(i.bonuses)]}),Qt.jsxs("p",{className:"text-xs",children:["Durability: ",i.durability]}),Qt.jsxs("p",{className:"text-xs",children:["Weight: ",i.weight]})]}):null},$7=(g,t,i,x)=>Qt.jsx("ul",{className:"grid grid-cols-8 gap-2",children:Object.keys(g).map(T=>{const E=g[T];return Q7(E,t,i,x)})}),Q7=(g,t,i,x)=>{if(!g)return Qt.jsx("li",{className:"text-sm relative flex items-center justify-center border border-gray-500 bg-gray-200",style:{width:"32px",height:"32px"}},`empty-${Math.random()}`);const T=xl(g);return T?Qt.jsxs("li",{className:"text-sm relative",onMouseEnter:E=>t(T.id,E),onMouseLeave:i,onClick:E=>x(T.id,E),children:[T.name," (",T.type,") - Bonuses: ",JSON.stringify(T.bonuses)," - Durability: ",T.durability," - Weight: ",T.weight]},T.id):null},_7=(g,t,i,x)=>Qt.jsx("ul",{className:"grid grid-cols-8 gap-1",children:g.map((T,E)=>{const s=xl(T);return s?Qt.jsx("li",{className:"text-sm relative hover:scale-[1.3] transition ease-in-out duration-100",onMouseEnter:y=>t(s.id,y),onMouseLeave:i,onClick:y=>x(s.id,y),children:Qt.jsx("img",{src:s.img,alt:s.name,style:{width:"32px",height:"32px"},className:"inline-block border border-yellow-400/50"})},E):null})}),q7=()=>{const g=Bo(Sn);Bo(gm),Bo(MI),Bo(Zr),Ae.useEffect(()=>{const r=p=>{};return xi.on("playerEvent",r),()=>{xi.off("playerEvent",r)}},[]);const t=(r,p)=>{id("tooltipItem",{id:r,position:{x:p.clientX+10,y:p.clientY-150}})},i=()=>{id("tooltipItem",{...Lf("tooltipItem"),id:null})},x=(r,p)=>{id("submenuItem",{id:r,position:{x:p.clientX,y:p.clientY-150}})},T=()=>{id("submenuItem",{...Lf("submenuItem"),id:null})},E=(r,p)=>{const h=xl(r);if(h){const a={itemId:h.id,action:p};xi.emit("itemAction",a),T()}};if(!g||!g.stats)return null;const s=Lf("submenuItem"),y=s.id?zI(s.id):[],e=Lf("tooltipItem");return Qt.jsxs("div",{className:"fixed top-24 left-3 w-[350px] p-4 bg-zinc-800 text-yellow-400 border border-yellow-300 rounded-lg z-20 transition transform ease-in-out duration-500 opacity-50 hover:opacity-100",children:[Qt.jsxs("div",{className:"flex flex-row space-y-2 align-top",children:[Qt.jsx(TM,{settingKey:"isStatsMenuCollapsed",label:"Stats"}),Qt.jsx(TM,{settingKey:"isSettingsMenuCollapsed",label:"Settings"})]}),Qt.jsxs("div",{className:`transition transform duration-1000 ease-in-out ${Lf("isStatsMenuCollapsed")?"max-h-0 overflow-hidden":"max-h-screen"}`,children:[Qt.jsx(Z7,{stats:g.stats}),Qt.jsxs("div",{className:"mb-4",children:[Qt.jsx("h2",{className:"text-lg font-semibold mb-2",children:"User Information"}),Qt.jsx("p",{className:"text-sm",children:g.stats.username||"Guest"})]}),Qt.jsxs("div",{className:"mb-4",children:[Qt.jsx("h2",{className:"text-lg font-semibold mb-2",children:"General Information"}),Qt.jsx("p",{className:"text-sm",children:""})]}),Qt.jsxs("div",{className:"mb-4",children:[Qt.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Inventory"}),_7(g.inventory.backpack,t,i,x)]}),Qt.jsxs("div",{className:"mb-4",children:[Qt.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Equipment"}),$7(g.inventory.equipment,t,i,x)]}),e.id&&J7(e.id,e.position),s.id&&Qt.jsxs("div",{style:{top:s.position.y,left:s.position.x},className:"absolute bg-gray-700 text-white p-2 rounded shadow-lg z-50",children:[Qt.jsx("button",{onClick:T,className:"absolute top-1 right-1 translate-x-6 bg-yellow-400 p-1 text-white hover:text-gray-400",children:"X"}),Qt.jsx("p",{className:"text-sm strong",children:"Actions:"}),Qt.jsxs("ul",{className:"text-xs",children:[y.map(r=>Qt.jsx("li",{onClick:()=>s.id&&E(s.id,r),className:"cursor-pointer hover:bg-gray-600",children:r.charAt(0).toUpperCase()+r.slice(1)},r)),Qt.jsx("li",{onClick:T,className:"cursor-pointer hover:bg-gray-600",children:"Close"})]})]})]})]})},py=Rm(null),vy=Rm(null),tG=()=>{const g=Bo(py),[t,i]=Ae.useState({x:0,y:0});Ae.useEffect(()=>{const y=e=>{e&&(py.set(e),i(x(e.coords.x,e.coords.y)))};return xi.on("npcInteractionClick",y),()=>{xi.off("npcInteractionClick",y)}},[]);const x=(y,e)=>{let n=y+250,u=e+250;return n+200>window.innerWidth-10&&(n=window.innerWidth-200-10),u+200>window.innerHeight-10&&(u=window.innerHeight-200-10),n<10&&(n=10),u<10&&(u=10),{x:n,y:u}},T=y=>{if(g){const e=kA.getActionHandler(y);e&&(e(g),E())}},E=()=>{py.set(null)},s=()=>{if(!g)return null;const{npcName:y,actions:e,npcId:r}=g,{x:p,y:h}=t;return Qt.jsxs("div",{className:"absolute bg-zinc-900 border border-yellow-300 rounded-md p-2 z-50 transition transform ease-in-out duration-500 opacity-50 hover:opacity-100",style:{left:`${p}px`,top:`${h}px`,transform:"translate(-50%, -100%)"},children:[Qt.jsxs("div",{className:"flex justify-between items-center mb-2",children:[Qt.jsx("h3",{className:"font-bold text-sm",children:y}),Qt.jsx("button",{onClick:E,className:"text-xs font-bold m-1 text-yellow-300 hover:text-yellow-500",children:"X"})]}),e.map((a,l)=>Qt.jsx("button",{onClick:()=>T(a),className:"block w-full text-xs py-1 px-2 mb-1 bg-yellow-500 hover:bg-yellow-400 rounded",children:a},l)),Qt.jsx("button",{onClick:E,className:"block w-full text-xs py-1 px-2 mt-2 bg-red-500 hover:bg-red-600 rounded text-white",children:"Close"})]},r)};return Qt.jsx("div",{children:s()})},EM=Rm(null),eG=()=>{const g=Bo(EM);Ae.useEffect(()=>{const i=x=>{if(x){EM.set(x);const T=document.querySelector("#hs-stacked-overlays-dialogue");T&&(T.classList.remove("hidden"),T.classList.add("open"))}};return xi.on("npcDialogue",i),()=>{xi.off("npcDialogue",i)}},[]);const t=()=>{const i=document.querySelector("#hs-stacked-overlays-dialogue");i&&(i.classList.add("hidden"),i.classList.remove("open"))};return Qt.jsx(Qt.Fragment,{children:Qt.jsx("div",{id:"hs-stacked-overlays-dialogue",className:"hs-overlay hs-overlay-backdrop-open:bg-gray-900/50 hidden size-full fixed top-0 start-0 z-[60] overflow-x-hidden overflow-y-auto pointer-events-none [--overlay-backdrop:static]","data-hs-overlay-keyboard":"false",children:Qt.jsx("div",{className:"hs-overlay-open:mt-7 hs-overlay-open:opacity-100 hs-overlay-open:duration-500 mt-0 opacity-0 ease-out transition-all sm:max-w-lg sm:w-full m-3 sm:mx-auto md:min-w-fit",children:Qt.jsxs("div",{className:"flex flex-col lg:flex-row bg-zinc-950 border border-yellow-500 shadow-sm rounded-xl pointer-events-auto bg-cover",style:{backgroundImage:`url(${g?.dialogue.backgroundImage||"https://kbve.com/assets/img/curved-images/wave.jpg"})`},children:[Qt.jsxs("div",{className:"w-full lg:w-1/3 p-4 rounded-l-xl flex flex-col items-center justify-center",children:[Qt.jsx("h3",{className:"font-bold text-yellow-400 bg-zinc-950/80 rounded-2xl text-center mb-4",children:`NPC: ${g?.npcId||"Unknown"}`}),Qt.jsx("img",{src:g?.dialogue.backgroundImage||"/assets/npc/barkeep.webp",alt:"Character",className:"w-full h-auto rounded-md"})]}),Qt.jsxs("div",{className:"w-full lg:w-2/3 p-4 bg-cover bg-center rounded-r-xl",children:[Qt.jsxs("div",{className:"flex justify-between items-center pb-3 border-b",children:[Qt.jsx("h3",{className:"font-bold text-yellow-400",children:`${g?.dialogue.title||"Dialogue"}`}),Qt.jsxs("button",{type:"button",className:"flex justify-center items-center size-7 text-sm font-semibold rounded-full border border-transparent text-yellow-400 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none","data-hs-overlay":"#hs-stacked-overlays-dialogue",onClick:t,children:[Qt.jsx("span",{className:"sr-only",children:"Close"}),Qt.jsxs("svg",{className:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Qt.jsx("path",{d:"M18 6 6 18"}),Qt.jsx("path",{d:"m6 6 12 12"})]})]})]}),Qt.jsxs("div",{className:"p-4 overflow-y-auto",children:[Qt.jsx("p",{className:"mt-1 mb-2 text-yellow-400 bg-zinc-950/80 rounded-xl p-4",children:g?.dialogue.message||"No Message"}),g?.dialogue.playerResponse&&Qt.jsx("p",{className:"mt-1 mb-2 text-yellow-400 bg-zinc-950/80 rounded-xl p-4",children:g?.dialogue.playerResponse})]}),Qt.jsx("div",{className:"flex justify-end items-center gap-x-2 py-3 px-4 border-t",children:Qt.jsxs("button",{className:"relative rounded px-5 py-2.5 overflow-hidden group bg-yellow-500 relative hover:bg-gradient-to-r hover:from-yellow-500 hover:to-yellow-400 text-white hover:ring-2 hover:ring-offset-2 hover:ring-yellow-400 transition-all ease-out duration-300 disabled:pointer-events-none","data-hs-overlay":"#hs-stacked-overlays-dialogue",onClick:t,children:[Qt.jsx("span",{className:"absolute right-0 w-8 h-32 -mt-12 transition-all duration-1000 transform translate-x-12 bg-white opacity-10 rotate-12 group-hover:-translate-x-40 ease"}),Qt.jsx("span",{className:"relative",children:"Okay."})]})})]})]})})})})},iG=()=>{const g=Bo(Zh);Ae.useEffect(()=>{const i=x=>{if(x){const T=Date.now()+Math.random(),E={id:T,...x};Zh.set([...Zh.get(),E]),setTimeout(()=>{Zh.set(Zh.get().filter(s=>s.id!==T))},5e3)}};return xi.on("notification",i),()=>{xi.off("notification",i)}},[]);const t=i=>{Zh.set(Zh.get().filter(x=>x.id!==i))};return Qt.jsx("div",{className:"fixed inset-x-0 bottom-0 z-50 m-4 space-y-2",children:Array.isArray(g)&&g.map(i=>Qt.jsx("div",{className:`hs-removing:translate-x-5 hs-removing:opacity-0 transition duration-300 max-w-xs border rounded-xl shadow-lg ${i.notificationType.color}`,role:"alert",children:Qt.jsxs("div",{className:"flex p-4",children:[Qt.jsx("img",{src:i.notificationType.imgUrl,alt:i.notificationType.type,className:"flex-shrink-0 size-4"}),Qt.jsxs("div",{className:"ms-2",children:[Qt.jsx("h3",{className:"text-sm font-bold",children:i.title}),Qt.jsx("p",{className:"text-sm",children:i.message})]}),Qt.jsx("div",{className:"ms-auto",children:Qt.jsxs("button",{type:"button",className:"inline-flex flex-shrink-0 justify-center items-center size-5 rounded-lg text-gray-800 opacity-50 hover:opacity-100 focus:outline-none focus:opacity-100 dark:text-white",onClick:()=>t(i.id),children:[Qt.jsx("span",{className:"sr-only",children:"Close"}),Qt.jsxs("svg",{className:"flex-shrink-0 size-4 bg-zinc-900",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Qt.jsx("path",{d:"M18 6 6 18"}),Qt.jsx("path",{d:"m6 6 12 12"})]})]})})]})},i.id))})},nG=()=>{const g=Bo(vy),[t,i]=Ae.useState([]),[x,T]=Ae.useState(null);Ae.useEffect(()=>{const y=r=>{r&&vy.set(r)},e=r=>{r&&i(r.diceValues)};return xi.on("playerSteal",y),xi.on("diceRollResult",e),()=>{xi.off("playerSteal",y),xi.off("diceRollResult",e)}},[]),Ae.useEffect(()=>{t.length>0&&E(t)},[t]);const E=y=>{const e=y.reduce((a,l)=>a+l,0);if(T(e),!g)return;let r="",p="";switch(!0){case e>=45:r="01J27QABD2GPFNRVK69S51HSGB",p=`You successfully stole a ${r}!`;break;case e>=40:r="01J27QN2KZG1RDZW4CE9Q9Z3YQ",p=`You successfully stole a ${r}!`;break;case e>=35:r="01J269PK47V1DWX2S1251DEASD",p=`You successfully stole a ${r}!`;break;case e>=30:r="Blue Shark",p=`You successfully stole a ${r}!`;break;case e>=25:r="Salmon",p=`You successfully stole a ${r}!`;break;case e<=8:xi.emit("notification",{title:"Danger",message:`You crit failed to steal from ${g.npcName}!`,notificationType:wu.danger}),xi.emit("playerDamage",{damage:"5"});break;default:xi.emit("notification",{title:"Danger",message:`You failed to steal from ${g.npcName}!`,notificationType:wu.danger}),xi.emit("playerDamage",{damage:"1"});return}const h=wI(r);h?xi.emit("playerReward",{message:p,item:h}):console.warn("Item not found in ItemDB")},s=()=>{h2([]),i([]),T(null),vy.set(null)};return g?Qt.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50 bg-zinc-800 bg-opacity-50",children:Qt.jsxs("div",{className:"bg-zinc-800 p-4 rounded-lg shadow-lg max-w-xs w-full",children:[Qt.jsx(rG,{npcName:g.npcName,roll:x}),Qt.jsx(aG,{}),Qt.jsx(oG,{handleClose:s})]})}):null},rG=({npcName:g,roll:t})=>Qt.jsxs("div",{children:[Qt.jsx("h2",{className:"text-lg text-yellow-400 font-bold mb-4",children:"Steal Attempt"}),Qt.jsxs("p",{className:"mb-4",children:["Roll the dice to steal from ",g,". You need a total of 25 or higher to succeed."]}),t!==null&&Qt.jsxs("p",{className:"mb-4",children:["Your roll: ",t]})]}),sG=()=>Qt.jsx(N7,{textures:{side1:"/assets/items/set/dice/dice1.png",side2:"/assets/items/set/dice/dice2.png",side3:"/assets/items/set/dice/dice3.png",side4:"/assets/items/set/dice/dice4.png",side5:"/assets/items/set/dice/dice5.png",side6:"/assets/items/set/dice/dice6.png"},styleClass:"h-96",diceCount:4}),aG=Ae.memo(sG),oG=({handleClose:g})=>Qt.jsx("button",{onClick:g,className:"block w-full py-2 bg-red-500 text-white rounded hover:bg-red-700 mt-2",children:"Close"}),lG=dm.div` // Your style here -`;function gG(){return he.jsxs(rG,{children:[he.jsx($z,{}),he.jsx("div",{className:"flex justify-center items-center h-screen",children:he.jsxs("div",{className:"border-4 border-yellow-500 rounded-xl",children:[he.jsx(qz,{}),he.jsx(Yz,{}),he.jsx(_z,{})]})}),he.jsx(Qz,{}),he.jsx(kz,{})]})}export{gG as default}; +`;function TG(){return Qt.jsxs(lG,{children:[Qt.jsx(q7,{}),Qt.jsx("div",{className:"flex justify-center items-center h-screen",children:Qt.jsxs("div",{className:"border-4 border-yellow-500 rounded-xl",children:[Qt.jsx(eG,{}),Qt.jsx(nG,{}),Qt.jsx(j7,{}),Qt.jsx(iG,{})]})}),Qt.jsx(tG,{}),Qt.jsx(K7,{})]})}export{TG as default}; diff --git a/docs/_astro/index.CAgUjoM_.css b/docs/_astro/index.CAgUjoM_.css deleted file mode 100644 index 3594e88..0000000 --- a/docs/_astro/index.CAgUjoM_.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-6{inset:1.5rem}.inset-x-0{left:0;right:0}.-bottom-20{bottom:-5rem}.bottom-0{bottom:0}.bottom-full{bottom:100%}.end-full{inset-inline-end:100%}.left-0{left:0}.left-1\/2{left:50%}.left-3{left:.75rem}.right-0{right:0}.right-1{right:.25rem}.start-0{inset-inline-start:0px}.start-1\/2{inset-inline-start:50%}.top-0{top:0}.top-1{top:.25rem}.top-1\/2{top:50%}.top-24{top:6rem}.top-4{top:1rem}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[1\]{z-index:1}.z-\[60\]{z-index:60}.m-1{margin:.25rem}.m-2{margin:.5rem}.m-3{margin:.75rem}.m-4{margin:1rem}.\!mx-\[10px\]{margin-left:10px!important;margin-right:10px!important}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-12{margin-top:-3rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ms-2{margin-inline-start:.5rem}.ms-5{margin-inline-start:1.25rem}.ms-auto{margin-inline-start:auto}.mt-0{margin-top:0}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-video{aspect-ratio:16 / 9}.size-3{width:.75rem;height:.75rem}.size-3\.5{width:.875rem;height:.875rem}.size-4{width:1rem;height:1rem}.size-5{width:1.25rem;height:1.25rem}.size-6{width:1.5rem;height:1.5rem}.size-7{width:1.75rem;height:1.75rem}.size-8{width:2rem;height:2rem}.size-full{width:100%;height:100%}.h-10{height:2.5rem}.h-12{height:3rem}.h-20{height:5rem}.h-32{height:8rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-96{height:24rem}.h-\[32px\]{height:32px}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100vh}.max-h-0{max-height:0px}.max-h-screen{max-height:100vh}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-24{width:6rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-8{width:2rem}.w-\[1900px\]{width:1900px}.w-\[350px\]{width:350px}.w-\[calc\(100\%-2rem\)\]{width:calc(100% - 2rem)}.w-full{width:100%}.max-w-3xl{max-width:48rem}.max-w-5xl{max-width:64rem}.max-w-\[85rem\]{max-width:85rem}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.basis-full{flex-basis:100%}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-8{--tw-translate-x: -2rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-10{--tw-translate-x: 2.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-12{--tw-translate-x: 3rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-6{--tw-translate-x: 1.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-10{--tw-translate-y: 2.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-8{--tw-translate-y: 2rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-12{--tw-rotate: -12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-12{--tw-rotate: 12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-skew-x-12{--tw-skew-x: -12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.skew-x-12{--tw-skew-x: 12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.resize{resize:both}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.flex-nowrap{flex-wrap:nowrap}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-3\.5{-moz-column-gap:.875rem;column-gap:.875rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-12>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(3rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(3rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[36px\]{border-radius:36px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-l-xl{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.rounded-r-xl{border-top-right-radius:.75rem;border-bottom-right-radius:.75rem}.border{border-width:1px}.border-4{border-width:4px}.border-\[3px\]{border-width:3px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-s{border-inline-start-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-blue-300{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity))}.border-current{border-color:currentColor}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.border-gray-500{--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity))}.border-orange-300{--tw-border-opacity: 1;border-color:rgb(253 186 116 / var(--tw-border-opacity))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity))}.border-transparent{border-color:transparent}.border-yellow-300{--tw-border-opacity: 1;border-color:rgb(253 224 71 / var(--tw-border-opacity))}.border-yellow-400\/50{border-color:#facc1580}.border-yellow-500{--tw-border-opacity: 1;border-color:rgb(234 179 8 / var(--tw-border-opacity))}.border-yellow-700{--tw-border-opacity: 1;border-color:rgb(161 98 7 / var(--tw-border-opacity))}.border-t-transparent{border-top-color:transparent}.bg-\[var\(--sl-color-black\)\]{background-color:var(--sl-color-black)}.bg-blue-200{--tw-bg-opacity: 1;background-color:rgb(191 219 254 / var(--tw-bg-opacity))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity))}.bg-cyan-500{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity))}.bg-cyan-600{--tw-bg-opacity: 1;background-color:rgb(8 145 178 / var(--tw-bg-opacity))}.bg-cyan-700{--tw-bg-opacity: 1;background-color:rgb(14 116 144 / var(--tw-bg-opacity))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity))}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity))}.bg-green-200{--tw-bg-opacity: 1;background-color:rgb(187 247 208 / var(--tw-bg-opacity))}.bg-neutral-200{--tw-bg-opacity: 1;background-color:rgb(229 229 229 / var(--tw-bg-opacity))}.bg-neutral-900{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.bg-orange-200{--tw-bg-opacity: 1;background-color:rgb(254 215 170 / var(--tw-bg-opacity))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity))}.bg-red-200{--tw-bg-opacity: 1;background-color:rgb(254 202 202 / var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity))}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity))}.bg-yellow-600{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity))}.bg-yellow-700{--tw-bg-opacity: 1;background-color:rgb(161 98 7 / var(--tw-bg-opacity))}.bg-zinc-800{--tw-bg-opacity: 1;background-color:rgb(39 39 42 / var(--tw-bg-opacity))}.bg-zinc-900{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity))}.bg-zinc-950{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity))}.bg-zinc-950\/80{background-color:#09090bcc}.bg-opacity-50{--tw-bg-opacity: .5}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.from-neutral-400{--tw-gradient-from: #a3a3a3 var(--tw-gradient-from-position);--tw-gradient-to: rgb(163 163 163 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-neutral-100{--tw-gradient-to: #f5f5f5 var(--tw-gradient-to-position)}.to-neutral-200{--tw-gradient-to: #e5e5e5 var(--tw-gradient-to-position)}.bg-cover{background-size:cover}.bg-center{background-position:center}.stroke-yellow-700\/50{stroke:#a1620780}.object-contain{-o-object-fit:contain;object-fit:contain}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pb-3{padding-bottom:.75rem}.pl-5{padding-left:1.25rem}.ps-5{padding-inline-start:1.25rem}.ps-px{padding-inline-start:1px}.text-left{text-align:left}.text-center{text-align:center}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity))}.text-cyan-600{--tw-text-opacity: 1;color:rgb(8 145 178 / var(--tw-text-opacity))}.text-gray-100{--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity))}.text-orange-700{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity))}.opacity-0{opacity:0}.opacity-10{opacity:.1}.opacity-100{opacity:1}.opacity-50{opacity:.5}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/10{--tw-shadow-color: rgb(0 0 0 / .1);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-lg{--tw-drop-shadow: drop-shadow(0 10px 8px rgb(0 0 0 / .04)) drop-shadow(0 4px 3px rgb(0 0 0 / .1));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[opacity\,margin\]{transition-property:opacity,margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-\[0\.1ms\]{transition-duration:.1ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[--adaptive\:none\]{--adaptive: none}.\[--overlay-backdrop\:static\]{--overlay-backdrop: static}.\[--strategy\:static\]{--strategy: static}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:-end-5:before{content:var(--tw-content);inset-inline-end:-1.25rem}.before\:-top-5:before{content:var(--tw-content);top:-1.25rem}.before\:start-0:before{content:var(--tw-content);inset-inline-start:0px}.before\:top-0:before{content:var(--tw-content);top:0}.before\:h-5:before{content:var(--tw-content);height:1.25rem}.before\:h-full:before{content:var(--tw-content);height:100%}.before\:w-5:before{content:var(--tw-content);width:1.25rem}.before\:w-full:before{content:var(--tw-content);width:100%}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:inset-0:after{content:var(--tw-content);inset:0}.after\:inset-2:after{content:var(--tw-content);inset:.5rem}.after\:inset-2\.5:after{content:var(--tw-content);inset:.625rem}.after\:transform-gpu:after{content:var(--tw-content);transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:rounded-xl:after{content:var(--tw-content);border-radius:.75rem}.after\:bg-cyan-600:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(8 145 178 / var(--tw-bg-opacity))}.after\:bg-gradient-to-b:after{content:var(--tw-content);background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.after\:from-neutral-100:after{content:var(--tw-content);--tw-gradient-from: #f5f5f5 var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 245 245 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.after\:to-neutral-50:after{content:var(--tw-content);--tw-gradient-to: #fafafa var(--tw-gradient-to-position)}.after\:opacity-0:after{content:var(--tw-content);opacity:0}.after\:mix-blend-color:after{content:var(--tw-content);mix-blend-mode:color}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.3\]:hover{--tw-scale-x: 1.3;--tw-scale-y: 1.3;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity))}.hover\:bg-cyan-700:hover{--tw-bg-opacity: 1;background-color:rgb(14 116 144 / var(--tw-bg-opacity))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity))}.hover\:bg-gray-600:hover{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity))}.hover\:bg-yellow-300:hover{--tw-bg-opacity: 1;background-color:rgb(253 224 71 / var(--tw-bg-opacity))}.hover\:bg-yellow-400:hover{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity))}.hover\:bg-gradient-to-r:hover{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.hover\:from-cyan-500:hover{--tw-gradient-from: #06b6d4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-yellow-500:hover{--tw-gradient-from: #eab308 var(--tw-gradient-from-position);--tw-gradient-to: rgb(234 179 8 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-cyan-400:hover{--tw-gradient-to: #22d3ee var(--tw-gradient-to-position)}.hover\:to-yellow-400:hover{--tw-gradient-to: #facc15 var(--tw-gradient-to-position)}.hover\:text-black:hover{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.hover\:text-gray-400:hover{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.hover\:text-yellow-500:hover{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity))}.hover\:text-zinc-950:hover{--tw-text-opacity: 1;color:rgb(9 9 11 / var(--tw-text-opacity))}.hover\:opacity-100:hover{opacity:1}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-cyan-400:hover{--tw-ring-opacity: 1;--tw-ring-color: rgb(34 211 238 / var(--tw-ring-opacity))}.hover\:ring-yellow-400:hover{--tw-ring-opacity: 1;--tw-ring-color: rgb(250 204 21 / var(--tw-ring-opacity))}.hover\:ring-offset-2:hover{--tw-ring-offset-width: 2px}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity))}.focus\:border-indigo-500:focus{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity))}.focus\:ring-indigo-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity))}.focus\:ring-yellow-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(234 179 8 / var(--tw-ring-opacity))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:-translate-x-40{--tw-translate-x: -10rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:-translate-x-96{--tw-translate-x: -24rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:-skew-x-12{--tw-skew-x: -12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:skew-x-12{--tw-skew-x: 12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity))}.group:hover .group-hover\:bg-yellow-700{--tw-bg-opacity: 1;background-color:rgb(161 98 7 / var(--tw-bg-opacity))}.peer:checked~.peer-checked\:from-cyan-500{--tw-gradient-from: #06b6d4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.peer:checked~.peer-checked\:to-cyan-100{--tw-gradient-to: #cffafe var(--tw-gradient-to-position)}.peer:checked~.peer-checked\:drop-shadow-sm{--tw-drop-shadow: drop-shadow(0 1px 1px rgb(0 0 0 / .05));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.peer:checked~.peer-checked\:after\:inset-1:after{content:var(--tw-content);inset:.25rem}.peer:checked~.peer-checked\:after\:from-neutral-200:after{content:var(--tw-content);--tw-gradient-from: #e5e5e5 var(--tw-gradient-from-position);--tw-gradient-to: rgb(229 229 229 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.peer:checked~.peer-checked\:after\:to-neutral-100:after{content:var(--tw-content);--tw-gradient-to: #f5f5f5 var(--tw-gradient-to-position)}.peer:checked~.peer-checked\:after\:opacity-100:after{content:var(--tw-content);opacity:1}.hs-dropdown.open>.hs-dropdown-open\:opacity-100{opacity:1}.hs-dropdown.open .hs-dropdown-toggle .hs-dropdown-open\:opacity-100{opacity:1}.hs-dropdown.open>.hs-dropdown-menu>.hs-dropdown-open\:opacity-100{opacity:1}.hs-removing.hs-removing\:translate-x-5{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hs-removing.hs-removing\:opacity-0{opacity:0}.hs-collapse.open .hs-collapse-open\:block{display:block}.hs-collapse.open .hs-collapse-open\:hidden{display:none}.hs-collapse.open.hs-collapse-open\:block{display:block}.hs-collapse.open.hs-collapse-open\:hidden{display:none}.hs-collapse-toggle.open .hs-collapse-open\:block{display:block}.hs-collapse-toggle.open .hs-collapse-open\:hidden{display:none}.hs-collapse-toggle.open.hs-collapse-open\:block{display:block}.hs-collapse-toggle.open.hs-collapse-open\:hidden{display:none}.open.hs-overlay-open\:mt-7{margin-top:1.75rem}.open.hs-overlay-open\:opacity-100{opacity:1}.open.hs-overlay-open\:duration-500{transition-duration:.5s}.open .hs-overlay-open\:mt-7{margin-top:1.75rem}.open .hs-overlay-open\:opacity-100{opacity:1}.open .hs-overlay-open\:duration-500{transition-duration:.5s}.hs-overlay-backdrop.hs-overlay-backdrop-open\:bg-gray-900\/50,.hs-overlay-backdrop .hs-overlay-backdrop-open\:bg-gray-900\/50{background-color:#11182780}.selected .hs-combo-box-selected\:block,.selected.hs-combo-box-selected\:block{display:block}@media (min-width: 640px){.sm\:mx-auto{margin-left:auto;margin-right:auto}.sm\:w-full{width:100%}.sm\:max-w-lg{max-width:32rem}.sm\:-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 768px){.md\:my-6{margin-top:1.5rem;margin-bottom:1.5rem}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-1\/2{width:50%}.md\:w-48{width:12rem}.md\:flex-row{flex-direction:row}.md\:flex-nowrap{flex-wrap:nowrap}.md\:items-center{align-items:center}.md\:justify-start{justify-content:flex-start}.md\:justify-end{justify-content:flex-end}.md\:justify-between{justify-content:space-between}.md\:border{border-width:1px}.md\:border-s{border-inline-start-width:1px}.md\:border-yellow-500{--tw-border-opacity: 1;border-color:rgb(234 179 8 / var(--tw-border-opacity))}.md\:px-3{padding-left:.75rem;padding-right:.75rem}.md\:px-6{padding-left:1.5rem;padding-right:1.5rem}.md\:py-0{padding-top:0;padding-bottom:0}.md\:ps-6{padding-inline-start:1.5rem}.md\:ps-7{padding-inline-start:1.75rem}.md\:shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.md\:duration-\[150ms\]{transition-duration:.15s}.md\:\[--strategy\:absolute\]{--strategy: absolute}.md\:\[--strategy\:fixed\]{--strategy: fixed}.md\:\[--trigger\:hover\]{--trigger: hover}}@media (min-width: 1024px){.lg\:w-1\/3{width:33.333333%}.lg\:w-2\/3{width:66.666667%}.lg\:w-96{width:24rem}.lg\:flex-row{flex-direction:row}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:pt-16{padding-top:4rem}}@media (min-width: 1280px){.xl\:mx-auto{margin-left:auto;margin-right:auto}.xl\:px-0{padding-left:0;padding-right:0}}@media (prefers-color-scheme: dark){.dark\:border-neutral-700{--tw-border-opacity: 1;border-color:rgb(64 64 64 / var(--tw-border-opacity))}.dark\:bg-neutral-900{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.dark\:bg-opacity-80{--tw-bg-opacity: .8}.dark\:text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.dark\:text-neutral-200{--tw-text-opacity: 1;color:rgb(229 229 229 / var(--tw-text-opacity))}.dark\:text-neutral-400{--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity))}.dark\:text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.dark\:hover\:bg-neutral-800:hover{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:focus\:bg-neutral-800:focus{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}}:root{--accent: 136, 58, 234;--accent-light: 224, 204, 250;--accent-dark: 49, 10, 101;--accent-gradient: linear-gradient( 45deg, rgb(var(--accent)), rgb(var(--accent-light)) 30%, white 60% )}code{font-family:Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace}.hexgrid-background{background-image:url('data:image/svg+xml,');background-repeat:repeat;background-position:0 0;animation:scrollLeft 2s linear infinite}@keyframes scrollLeft{0%{background-position:0 0}to{background-position:-100px 0}}main[data-astro-cid-j7pv25f6]{margin:auto;padding:1rem;width:800px;max-width:calc(100% - 2rem);color:#fff;font-size:20px;line-height:1.6}.astro-a[data-astro-cid-j7pv25f6]{position:absolute;top:-32px;left:50%;transform:translate(-50%);width:220px;height:auto;z-index:-1}h1[data-astro-cid-j7pv25f6]{font-size:4rem;font-weight:700;line-height:1;text-align:center;margin-bottom:1em}.text-gradient[data-astro-cid-j7pv25f6]{background-image:var(--accent-gradient);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-size:400%;background-position:0%}.instructions[data-astro-cid-j7pv25f6]{margin-bottom:2rem;border:1px solid rgba(var(--accent-light),25%);background:linear-gradient(rgba(var(--accent-dark),66%),rgba(var(--accent-dark),33%));padding:1.5rem;border-radius:8px}.instructions[data-astro-cid-j7pv25f6] code[data-astro-cid-j7pv25f6]{font-size:.8em;font-weight:700;background:rgba(var(--accent-light),12%);color:rgb(var(--accent-light));border-radius:4px;padding:.3em .4em}.instructions[data-astro-cid-j7pv25f6] strong[data-astro-cid-j7pv25f6]{color:rgb(var(--accent-light))}.link-card-grid[data-astro-cid-j7pv25f6]{display:grid;grid-template-columns:repeat(auto-fit,minmax(24ch,1fr));gap:2rem;padding:0} diff --git a/docs/_astro/index.JEx9H6V3.css b/docs/_astro/index.JEx9H6V3.css new file mode 100644 index 0000000..251e20b --- /dev/null +++ b/docs/_astro/index.JEx9H6V3.css @@ -0,0 +1 @@ +*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-6{inset:1.5rem}.inset-x-0{left:0;right:0}.-bottom-20{bottom:-5rem}.bottom-0{bottom:0}.bottom-full{bottom:100%}.end-full{inset-inline-end:100%}.left-0{left:0}.left-1\/2{left:50%}.left-3{left:.75rem}.right-0{right:0}.right-1{right:.25rem}.start-0{inset-inline-start:0px}.start-1\/2{inset-inline-start:50%}.top-0{top:0}.top-1{top:.25rem}.top-1\/2{top:50%}.top-24{top:6rem}.top-4{top:1rem}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[1\]{z-index:1}.z-\[60\]{z-index:60}.m-1{margin:.25rem}.m-2{margin:.5rem}.m-3{margin:.75rem}.m-4{margin:1rem}.\!mx-\[10px\]{margin-left:10px!important;margin-right:10px!important}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-12{margin-top:-3rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ms-2{margin-inline-start:.5rem}.ms-5{margin-inline-start:1.25rem}.ms-auto{margin-inline-start:auto}.mt-0{margin-top:0}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-video{aspect-ratio:16 / 9}.size-3{width:.75rem;height:.75rem}.size-3\.5{width:.875rem;height:.875rem}.size-4{width:1rem;height:1rem}.size-5{width:1.25rem;height:1.25rem}.size-6{width:1.5rem;height:1.5rem}.size-7{width:1.75rem;height:1.75rem}.size-8{width:2rem;height:2rem}.size-full{width:100%;height:100%}.h-10{height:2.5rem}.h-12{height:3rem}.h-20{height:5rem}.h-32{height:8rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-96{height:24rem}.h-\[32px\]{height:32px}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100vh}.max-h-0{max-height:0px}.max-h-screen{max-height:100vh}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-8{width:2rem}.w-\[1900px\]{width:1900px}.w-\[350px\]{width:350px}.w-\[calc\(100\%-2rem\)\]{width:calc(100% - 2rem)}.w-full{width:100%}.max-w-3xl{max-width:48rem}.max-w-5xl{max-width:64rem}.max-w-\[85rem\]{max-width:85rem}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.basis-full{flex-basis:100%}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-8{--tw-translate-x: -2rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-10{--tw-translate-x: 2.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-12{--tw-translate-x: 3rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-6{--tw-translate-x: 1.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-10{--tw-translate-y: 2.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-8{--tw-translate-y: 2rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-12{--tw-rotate: -12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-12{--tw-rotate: 12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-skew-x-12{--tw-skew-x: -12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.skew-x-12{--tw-skew-x: 12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.resize{resize:both}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.flex-nowrap{flex-wrap:nowrap}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-3\.5{-moz-column-gap:.875rem;column-gap:.875rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-12>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(3rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(3rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[36px\]{border-radius:36px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-l-xl{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.rounded-r-xl{border-top-right-radius:.75rem;border-bottom-right-radius:.75rem}.border{border-width:1px}.border-4{border-width:4px}.border-\[3px\]{border-width:3px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-s{border-inline-start-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-blue-300{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity))}.border-current{border-color:currentColor}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.border-gray-500{--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity))}.border-orange-300{--tw-border-opacity: 1;border-color:rgb(253 186 116 / var(--tw-border-opacity))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity))}.border-transparent{border-color:transparent}.border-yellow-300{--tw-border-opacity: 1;border-color:rgb(253 224 71 / var(--tw-border-opacity))}.border-yellow-400\/50{border-color:#facc1580}.border-yellow-500{--tw-border-opacity: 1;border-color:rgb(234 179 8 / var(--tw-border-opacity))}.border-yellow-700{--tw-border-opacity: 1;border-color:rgb(161 98 7 / var(--tw-border-opacity))}.border-t-transparent{border-top-color:transparent}.bg-\[var\(--sl-color-black\)\]{background-color:var(--sl-color-black)}.bg-blue-200{--tw-bg-opacity: 1;background-color:rgb(191 219 254 / var(--tw-bg-opacity))}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity))}.bg-cyan-500{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity))}.bg-cyan-600{--tw-bg-opacity: 1;background-color:rgb(8 145 178 / var(--tw-bg-opacity))}.bg-cyan-700{--tw-bg-opacity: 1;background-color:rgb(14 116 144 / var(--tw-bg-opacity))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity))}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity))}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity))}.bg-green-200{--tw-bg-opacity: 1;background-color:rgb(187 247 208 / var(--tw-bg-opacity))}.bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity))}.bg-neutral-200{--tw-bg-opacity: 1;background-color:rgb(229 229 229 / var(--tw-bg-opacity))}.bg-neutral-900{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.bg-orange-200{--tw-bg-opacity: 1;background-color:rgb(254 215 170 / var(--tw-bg-opacity))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity))}.bg-red-200{--tw-bg-opacity: 1;background-color:rgb(254 202 202 / var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity))}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity))}.bg-yellow-600{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity))}.bg-yellow-700{--tw-bg-opacity: 1;background-color:rgb(161 98 7 / var(--tw-bg-opacity))}.bg-zinc-800{--tw-bg-opacity: 1;background-color:rgb(39 39 42 / var(--tw-bg-opacity))}.bg-zinc-900{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity))}.bg-zinc-950{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity))}.bg-zinc-950\/80{background-color:#09090bcc}.bg-opacity-50{--tw-bg-opacity: .5}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.from-neutral-400{--tw-gradient-from: #a3a3a3 var(--tw-gradient-from-position);--tw-gradient-to: rgb(163 163 163 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-neutral-100{--tw-gradient-to: #f5f5f5 var(--tw-gradient-to-position)}.to-neutral-200{--tw-gradient-to: #e5e5e5 var(--tw-gradient-to-position)}.bg-cover{background-size:cover}.bg-center{background-position:center}.stroke-yellow-700\/50{stroke:#a1620780}.object-contain{-o-object-fit:contain;object-fit:contain}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pb-3{padding-bottom:.75rem}.pl-5{padding-left:1.25rem}.ps-5{padding-inline-start:1.25rem}.ps-px{padding-inline-start:1px}.text-left{text-align:left}.text-center{text-align:center}.align-top{vertical-align:top}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity))}.text-cyan-600{--tw-text-opacity: 1;color:rgb(8 145 178 / var(--tw-text-opacity))}.text-gray-100{--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity))}.text-orange-700{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity))}.opacity-0{opacity:0}.opacity-10{opacity:.1}.opacity-100{opacity:1}.opacity-50{opacity:.5}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/10{--tw-shadow-color: rgb(0 0 0 / .1);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-lg{--tw-drop-shadow: drop-shadow(0 10px 8px rgb(0 0 0 / .04)) drop-shadow(0 4px 3px rgb(0 0 0 / .1));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[opacity\,margin\]{transition-property:opacity,margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-\[0\.1ms\]{transition-duration:.1ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[--adaptive\:none\]{--adaptive: none}.\[--overlay-backdrop\:static\]{--overlay-backdrop: static}.\[--strategy\:static\]{--strategy: static}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:-end-5:before{content:var(--tw-content);inset-inline-end:-1.25rem}.before\:-top-5:before{content:var(--tw-content);top:-1.25rem}.before\:start-0:before{content:var(--tw-content);inset-inline-start:0px}.before\:top-0:before{content:var(--tw-content);top:0}.before\:h-5:before{content:var(--tw-content);height:1.25rem}.before\:h-full:before{content:var(--tw-content);height:100%}.before\:w-5:before{content:var(--tw-content);width:1.25rem}.before\:w-full:before{content:var(--tw-content);width:100%}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:inset-0:after{content:var(--tw-content);inset:0}.after\:inset-2:after{content:var(--tw-content);inset:.5rem}.after\:inset-2\.5:after{content:var(--tw-content);inset:.625rem}.after\:transform-gpu:after{content:var(--tw-content);transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:rounded-xl:after{content:var(--tw-content);border-radius:.75rem}.after\:bg-cyan-600:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(8 145 178 / var(--tw-bg-opacity))}.after\:bg-gradient-to-b:after{content:var(--tw-content);background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.after\:from-neutral-100:after{content:var(--tw-content);--tw-gradient-from: #f5f5f5 var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 245 245 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.after\:to-neutral-50:after{content:var(--tw-content);--tw-gradient-to: #fafafa var(--tw-gradient-to-position)}.after\:opacity-0:after{content:var(--tw-content);opacity:0}.after\:mix-blend-color:after{content:var(--tw-content);mix-blend-mode:color}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.3\]:hover{--tw-scale-x: 1.3;--tw-scale-y: 1.3;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity))}.hover\:bg-cyan-700:hover{--tw-bg-opacity: 1;background-color:rgb(14 116 144 / var(--tw-bg-opacity))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity))}.hover\:bg-gray-600:hover{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity))}.hover\:bg-yellow-300:hover{--tw-bg-opacity: 1;background-color:rgb(253 224 71 / var(--tw-bg-opacity))}.hover\:bg-yellow-400:hover{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity))}.hover\:bg-gradient-to-r:hover{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.hover\:from-cyan-500:hover{--tw-gradient-from: #06b6d4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-yellow-500:hover{--tw-gradient-from: #eab308 var(--tw-gradient-from-position);--tw-gradient-to: rgb(234 179 8 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-cyan-400:hover{--tw-gradient-to: #22d3ee var(--tw-gradient-to-position)}.hover\:to-yellow-400:hover{--tw-gradient-to: #facc15 var(--tw-gradient-to-position)}.hover\:text-black:hover{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.hover\:text-gray-400:hover{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.hover\:text-yellow-500:hover{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity))}.hover\:text-zinc-950:hover{--tw-text-opacity: 1;color:rgb(9 9 11 / var(--tw-text-opacity))}.hover\:opacity-100:hover{opacity:1}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-cyan-400:hover{--tw-ring-opacity: 1;--tw-ring-color: rgb(34 211 238 / var(--tw-ring-opacity))}.hover\:ring-yellow-400:hover{--tw-ring-opacity: 1;--tw-ring-color: rgb(250 204 21 / var(--tw-ring-opacity))}.hover\:ring-offset-2:hover{--tw-ring-offset-width: 2px}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity))}.focus\:border-indigo-500:focus{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity))}.focus\:ring-indigo-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity))}.focus\:ring-yellow-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(234 179 8 / var(--tw-ring-opacity))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:-translate-x-40{--tw-translate-x: -10rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:-translate-x-96{--tw-translate-x: -24rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:-skew-x-12{--tw-skew-x: -12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:skew-x-12{--tw-skew-x: 12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity))}.group:hover .group-hover\:bg-yellow-700{--tw-bg-opacity: 1;background-color:rgb(161 98 7 / var(--tw-bg-opacity))}.peer:checked~.peer-checked\:from-cyan-500{--tw-gradient-from: #06b6d4 var(--tw-gradient-from-position);--tw-gradient-to: rgb(6 182 212 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.peer:checked~.peer-checked\:to-cyan-100{--tw-gradient-to: #cffafe var(--tw-gradient-to-position)}.peer:checked~.peer-checked\:drop-shadow-sm{--tw-drop-shadow: drop-shadow(0 1px 1px rgb(0 0 0 / .05));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.peer:checked~.peer-checked\:after\:inset-1:after{content:var(--tw-content);inset:.25rem}.peer:checked~.peer-checked\:after\:from-neutral-200:after{content:var(--tw-content);--tw-gradient-from: #e5e5e5 var(--tw-gradient-from-position);--tw-gradient-to: rgb(229 229 229 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.peer:checked~.peer-checked\:after\:to-neutral-100:after{content:var(--tw-content);--tw-gradient-to: #f5f5f5 var(--tw-gradient-to-position)}.peer:checked~.peer-checked\:after\:opacity-100:after{content:var(--tw-content);opacity:1}.hs-dropdown.open>.hs-dropdown-open\:opacity-100{opacity:1}.hs-dropdown.open .hs-dropdown-toggle .hs-dropdown-open\:opacity-100{opacity:1}.hs-dropdown.open>.hs-dropdown-menu>.hs-dropdown-open\:opacity-100{opacity:1}.hs-removing.hs-removing\:translate-x-5{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hs-removing.hs-removing\:opacity-0{opacity:0}.hs-collapse.open .hs-collapse-open\:block{display:block}.hs-collapse.open .hs-collapse-open\:hidden{display:none}.hs-collapse.open.hs-collapse-open\:block{display:block}.hs-collapse.open.hs-collapse-open\:hidden{display:none}.hs-collapse-toggle.open .hs-collapse-open\:block{display:block}.hs-collapse-toggle.open .hs-collapse-open\:hidden{display:none}.hs-collapse-toggle.open.hs-collapse-open\:block{display:block}.hs-collapse-toggle.open.hs-collapse-open\:hidden{display:none}.open.hs-overlay-open\:mt-7{margin-top:1.75rem}.open.hs-overlay-open\:opacity-100{opacity:1}.open.hs-overlay-open\:duration-500{transition-duration:.5s}.open .hs-overlay-open\:mt-7{margin-top:1.75rem}.open .hs-overlay-open\:opacity-100{opacity:1}.open .hs-overlay-open\:duration-500{transition-duration:.5s}.hs-overlay-backdrop.hs-overlay-backdrop-open\:bg-gray-900\/50,.hs-overlay-backdrop .hs-overlay-backdrop-open\:bg-gray-900\/50{background-color:#11182780}.selected .hs-combo-box-selected\:block,.selected.hs-combo-box-selected\:block{display:block}@media (min-width: 640px){.sm\:mx-auto{margin-left:auto;margin-right:auto}.sm\:w-full{width:100%}.sm\:max-w-lg{max-width:32rem}.sm\:-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 768px){.md\:my-6{margin-top:1.5rem;margin-bottom:1.5rem}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-1\/2{width:50%}.md\:w-48{width:12rem}.md\:min-w-fit{min-width:-moz-fit-content;min-width:fit-content}.md\:flex-row{flex-direction:row}.md\:flex-nowrap{flex-wrap:nowrap}.md\:items-center{align-items:center}.md\:justify-start{justify-content:flex-start}.md\:justify-end{justify-content:flex-end}.md\:justify-between{justify-content:space-between}.md\:border{border-width:1px}.md\:border-s{border-inline-start-width:1px}.md\:border-yellow-500{--tw-border-opacity: 1;border-color:rgb(234 179 8 / var(--tw-border-opacity))}.md\:px-3{padding-left:.75rem;padding-right:.75rem}.md\:px-6{padding-left:1.5rem;padding-right:1.5rem}.md\:py-0{padding-top:0;padding-bottom:0}.md\:ps-6{padding-inline-start:1.5rem}.md\:ps-7{padding-inline-start:1.75rem}.md\:shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.md\:duration-\[150ms\]{transition-duration:.15s}.md\:\[--strategy\:absolute\]{--strategy: absolute}.md\:\[--strategy\:fixed\]{--strategy: fixed}.md\:\[--trigger\:hover\]{--trigger: hover}}@media (min-width: 1024px){.lg\:w-1\/3{width:33.333333%}.lg\:w-2\/3{width:66.666667%}.lg\:w-96{width:24rem}.lg\:flex-row{flex-direction:row}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:pt-16{padding-top:4rem}}@media (min-width: 1280px){.xl\:mx-auto{margin-left:auto;margin-right:auto}.xl\:px-0{padding-left:0;padding-right:0}}@media (prefers-color-scheme: dark){.dark\:border-neutral-700{--tw-border-opacity: 1;border-color:rgb(64 64 64 / var(--tw-border-opacity))}.dark\:bg-neutral-900{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.dark\:bg-opacity-80{--tw-bg-opacity: .8}.dark\:text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.dark\:text-neutral-200{--tw-text-opacity: 1;color:rgb(229 229 229 / var(--tw-text-opacity))}.dark\:text-neutral-400{--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity))}.dark\:text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.dark\:hover\:bg-neutral-800:hover{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:focus\:bg-neutral-800:focus{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}}:root{--accent: 136, 58, 234;--accent-light: 224, 204, 250;--accent-dark: 49, 10, 101;--accent-gradient: linear-gradient( 45deg, rgb(var(--accent)), rgb(var(--accent-light)) 30%, white 60% )}code{font-family:Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace}.hexgrid-background{background-image:url('data:image/svg+xml,');background-repeat:repeat;background-position:0 0;animation:scrollLeft 2s linear infinite}@keyframes scrollLeft{0%{background-position:0 0}to{background-position:-100px 0}}main[data-astro-cid-j7pv25f6]{margin:auto;padding:1rem;width:800px;max-width:calc(100% - 2rem);color:#fff;font-size:20px;line-height:1.6}.astro-a[data-astro-cid-j7pv25f6]{position:absolute;top:-32px;left:50%;transform:translate(-50%);width:220px;height:auto;z-index:-1}h1[data-astro-cid-j7pv25f6]{font-size:4rem;font-weight:700;line-height:1;text-align:center;margin-bottom:1em}.text-gradient[data-astro-cid-j7pv25f6]{background-image:var(--accent-gradient);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-size:400%;background-position:0%}.instructions[data-astro-cid-j7pv25f6]{margin-bottom:2rem;border:1px solid rgba(var(--accent-light),25%);background:linear-gradient(rgba(var(--accent-dark),66%),rgba(var(--accent-dark),33%));padding:1.5rem;border-radius:8px}.instructions[data-astro-cid-j7pv25f6] code[data-astro-cid-j7pv25f6]{font-size:.8em;font-weight:700;background:rgba(var(--accent-light),12%);color:rgb(var(--accent-light));border-radius:4px;padding:.3em .4em}.instructions[data-astro-cid-j7pv25f6] strong[data-astro-cid-j7pv25f6]{color:rgb(var(--accent-light))}.link-card-grid[data-astro-cid-j7pv25f6]{display:grid;grid-template-columns:repeat(auto-fit,minmax(24ch,1fr));gap:2rem;padding:0} diff --git a/docs/index.html b/docs/index.html index aa2008e..78ba54b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,4 +1,4 @@ - Welcome to CryptoThrone. + Welcome to CryptoThrone.