hytopia 0.5.13-dev4 → 0.5.13-dev5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server.js +2 -2
package/server.js
CHANGED
@@ -404,7 +404,7 @@ Instead, \`yield\` should either be called with a value, or not be called at all
|
|
404
404
|
if (condition) { yield value; }`)};import{Buffer as G31}from"buffer";import{StringDecoder as z31}from"string_decoder";var kU=(Z,J,$)=>{if($)return;if(Z)return{transform:H31.bind(void 0,new TextEncoder)};let Y=new z31(J);return{transform:V31.bind(void 0,Y),final:q31.bind(void 0,Y)}},H31=function*(Z,J){if(G31.isBuffer(J))yield o7(J);else if(typeof J==="string")yield Z.encode(J);else yield J},V31=function*(Z,J){yield u8(J)?Z.write(J):J},q31=function*(Z){let J=Z.end();if(J!=="")yield J};import{callbackify as _u}from"util";var _N=_u(async(Z,J,$,Y)=>{J.currentIterable=Z(...$);try{for await(let Q of J.currentIterable)Y.push(Q)}finally{delete J.currentIterable}}),EU=async function*(Z,J,$){if($===J.length){yield Z;return}let{transform:Y=U31}=J[$];for await(let Q of Y(Z))yield*EU(Q,J,$+1)},Au=async function*(Z){for(let[J,{final:$}]of Object.entries(Z))yield*F31($,Number(J),Z)},F31=async function*(Z,J,$){if(Z===void 0)return;for await(let Y of Z())yield*EU(Y,$,J+1)},xu=_u(async({currentIterable:Z},J)=>{if(Z!==void 0){await(J?Z.throw(J):Z.return());return}if(J)throw J}),U31=function*(Z){yield Z};var AN=(Z,J,$,Y)=>{try{for(let Q of Z(...J))$.push(Q);Y()}catch(Q){Y(Q)}},hu=(Z,J)=>[...J.flatMap(($)=>[...n$($,Z,0)]),...e3(Z)],n$=function*(Z,J,$){if($===J.length){yield Z;return}let{transform:Y=w31}=J[$];for(let Q of Y(Z))yield*n$(Q,J,$+1)},e3=function*(Z){for(let[J,{final:$}]of Object.entries(Z))yield*L31($,Number(J),Z)},L31=function*(Z,J,$){if(Z===void 0)return;for(let Y of Z())yield*n$(Y,$,J+1)},w31=function*(Z){yield Z};var xN=({value:Z,value:{transform:J,final:$,writableObjectMode:Y,readableObjectMode:Q},optionName:W},{encoding:X})=>{let K={},G=bu(Z,X,W),z=i$(J),H=i$($),V=z?_N.bind(void 0,EU,K):AN.bind(void 0,n$),q=z||H?_N.bind(void 0,Au,K):AN.bind(void 0,e3),F=z||H?xu.bind(void 0,K):void 0;return{stream:new B31({writableObjectMode:Y,writableHighWaterMark:fu(Y),readableObjectMode:Q,readableHighWaterMark:fu(Q),transform(w,L,O){V([w,G,0],this,O)},flush(w){q([G],this,w)},destroy:F})}},IU=(Z,J,$,Y)=>{let Q=J.filter(({type:X})=>X==="generator"),W=Y?Q.reverse():Q;for(let{value:X,optionName:K}of W){let G=bu(X,$,K);Z=hu(G,Z)}return Z},bu=({transform:Z,final:J,binary:$,writableObjectMode:Y,readableObjectMode:Q,preserveNewlines:W},X,K)=>{let G={};return[{transform:Iu(Y,K)},kU($,X,Y),TU($,W,Y,G),{transform:Z,final:J},{transform:vu(Q,K)},Eu({binary:$,preserveNewlines:W,readableObjectMode:Q,state:G})].filter(Boolean)};var yu=(Z,J)=>{for(let $ of O31(Z))j31(Z,$,J)},O31=(Z)=>new Set(Object.entries(Z).filter(([,{direction:J}])=>J==="input").map(([J])=>Number(J))),j31=(Z,J,$)=>{let{stdioItems:Y}=Z[J],Q=Y.filter(({contents:K})=>K!==void 0);if(Q.length===0)return;if(J!==0){let[{type:K,optionName:G}]=Q;throw new TypeError(`Only the \`stdin\` option, not \`${G}\`, can be ${$J[K]} with synchronous methods.`)}let X=Q.map(({contents:K})=>K).map((K)=>M31(K,Y));$.input=p3(X)},M31=(Z,J)=>{let $=IU(Z,J,"utf8",!0);return R31($),p3($)},R31=(Z)=>{let J=Z.find(($)=>typeof $!=="string"&&!u8($));if(J!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${J}.`)};import{writeFileSync as C31,appendFileSync as T31}from"fs";var vU=({stdioItems:Z,encoding:J,verboseInfo:$,fdNumber:Y})=>Y!=="all"&&jW($,Y)&&!u5.has(J)&&N31(Y)&&(Z.some(({type:Q,value:W})=>Q==="native"&&P31.has(W))||Z.every(({type:Q})=>q9.has(Q))),N31=(Z)=>Z===1||Z===2,P31=new Set(["pipe","overlapped"]),gu=async(Z,J,$,Y)=>{for await(let Q of Z)if(!D31(J))uu(Q,$,Y)},mu=(Z,J,$)=>{for(let Y of Z)uu(Y,J,$)},D31=(Z)=>Z._readableState.pipes.length>0,uu=(Z,J,$)=>{let Y=uF(Z);c4({type:"output",verboseMessage:Y,fdNumber:J,verboseInfo:$})};var du=({fileDescriptors:Z,syncResult:{output:J},options:$,isMaxBuffer:Y,verboseInfo:Q})=>{if(J===null)return{output:Array.from({length:3})};let W={},X=new Set([]);return{output:J.map((G,z)=>k31({result:G,fileDescriptors:Z,fdNumber:z,state:W,outputFiles:X,isMaxBuffer:Y,verboseInfo:Q},$)),...W}},k31=({result:Z,fileDescriptors:J,fdNumber:$,state:Y,outputFiles:Q,isMaxBuffer:W,verboseInfo:X},{buffer:K,encoding:G,lines:z,stripFinalNewline:H,maxBuffer:V})=>{if(Z===null)return;let q=cm(Z,W,V),F=o7(q),{stdioItems:U,objectMode:w}=J[$],L=E31([F],U,G,Y),{serializedResult:O,finalResult:j=O}=I31({chunks:L,objectMode:w,encoding:G,lines:z,stripFinalNewline:H,fdNumber:$});v31({serializedResult:O,fdNumber:$,state:Y,verboseInfo:X,encoding:G,stdioItems:U,objectMode:w});let M=K[$]?j:void 0;try{if(Y.error===void 0)S31(O,U,Q);return M}catch(N){return Y.error=N,M}},E31=(Z,J,$,Y)=>{try{return IU(Z,J,$,!1)}catch(Q){return Y.error=Q,Z}},I31=({chunks:Z,objectMode:J,encoding:$,lines:Y,stripFinalNewline:Q,fdNumber:W})=>{if(J)return{serializedResult:Z};if($==="buffer")return{serializedResult:p3(Z)};let X=Yy(Z,$);if(Y[W])return{serializedResult:X,finalResult:SN(X,!Q[W],J)};return{serializedResult:X}},v31=({serializedResult:Z,fdNumber:J,state:$,verboseInfo:Y,encoding:Q,stdioItems:W,objectMode:X})=>{if(!vU({stdioItems:W,encoding:Q,verboseInfo:Y,fdNumber:J}))return;let K=SN(Z,!1,X);try{mu(K,J,Y)}catch(G){$.error??=G}},S31=(Z,J,$)=>{for(let{path:Y,append:Q}of J.filter(({type:W})=>DU.has(W))){let W=typeof Y==="string"?Y:Y.toString();if(Q||$.has(W))T31(Y,Z);else $.add(W),C31(Y,Z)}};var cu=([,Z,J],$)=>{if(!$.all)return;if(Z===void 0)return J;if(J===void 0)return Z;if(Array.isArray(Z))return Array.isArray(J)?[...Z,...J]:[...Z,ZZ(J,$,"all")];if(Array.isArray(J))return[ZZ(Z,$,"all"),...J];if(u8(Z)&&u8(J))return mR([Z,J]);return`${Z}${J}`};import{once as hN}from"events";var lu=async(Z,J)=>{let[$,Y]=await _31(Z);return J.isForcefullyTerminated??=!1,[$,Y]},_31=async(Z)=>{let[J,$]=await Promise.allSettled([hN(Z,"spawn"),hN(Z,"exit")]);if(J.status==="rejected")return[];return $.status==="rejected"?pu(Z):$.value},pu=async(Z)=>{try{return await hN(Z,"exit")}catch{return pu(Z)}},iu=async(Z)=>{let[J,$]=await Z;if(!A31(J,$)&&fN(J,$))throw new l4;return[J,$]},A31=(Z,J)=>Z===void 0&&J===void 0,fN=(Z,J)=>Z!==0||J!==null;var nu=({error:Z,status:J,signal:$,output:Y},{maxBuffer:Q})=>{let W=x31(Z,J,$),X=W?.code==="ETIMEDOUT",K=dm(W,Y,Q);return{resultError:W,exitCode:J,signal:$,timedOut:X,isMaxBuffer:K}},x31=(Z,J,$)=>{if(Z!==void 0)return Z;return fN(J,$)?new l4:void 0};var au=(Z,J,$)=>{let{file:Y,commandArguments:Q,command:W,escapedCommand:X,startTime:K,verboseInfo:G,options:z,fileDescriptors:H}=f31(Z,J,$),V=g31({file:Y,commandArguments:Q,options:z,command:W,escapedCommand:X,verboseInfo:G,fileDescriptors:H,startTime:K});return EW(V,G,z)},f31=(Z,J,$)=>{let{command:Y,escapedCommand:Q,startTime:W,verboseInfo:X}=cF(Z,J,$),K=b31($),{file:G,commandArguments:z,options:H}=qU(Z,J,K);y31(H);let V=Du(H,X);return{file:G,commandArguments:z,command:Y,escapedCommand:Q,startTime:W,verboseInfo:X,options:H,fileDescriptors:V}},b31=(Z)=>Z.node&&!Z.ipc?{...Z,ipc:!1}:Z,y31=({ipc:Z,ipcInput:J,detached:$,cancelSignal:Y})=>{if(J)SU("ipcInput");if(Z)SU("ipc: true");if($)SU("detached: true");if(Y)SU("cancelSignal")},SU=(Z)=>{throw new TypeError(`The "${Z}" option cannot be used with synchronous methods.`)},g31=({file:Z,commandArguments:J,options:$,command:Y,escapedCommand:Q,verboseInfo:W,fileDescriptors:X,startTime:K})=>{let G=m31({file:Z,commandArguments:J,options:$,command:Y,escapedCommand:Q,fileDescriptors:X,startTime:K});if(G.failed)return G;let{resultError:z,exitCode:H,signal:V,timedOut:q,isMaxBuffer:F}=nu(G,$),{output:U,error:w=z}=du({fileDescriptors:X,syncResult:G,options:$,isMaxBuffer:F,verboseInfo:W}),L=U.map((j,M)=>ZZ(j,$,M)),O=ZZ(cu(U,$),$,"all");return d31({error:w,exitCode:H,signal:V,timedOut:q,isMaxBuffer:F,stdio:L,all:O,options:$,command:Y,escapedCommand:Q,startTime:K})},m31=({file:Z,commandArguments:J,options:$,command:Y,escapedCommand:Q,fileDescriptors:W,startTime:X})=>{try{yu(W,$);let K=u31($);return h31(Z,J,K)}catch(K){return kW({error:K,command:Y,escapedCommand:Q,fileDescriptors:W,options:$,startTime:X,isSync:!0})}},u31=({encoding:Z,maxBuffer:J,...$})=>({...$,encoding:"buffer",maxBuffer:MU(J)}),d31=({error:Z,exitCode:J,signal:$,timedOut:Y,isMaxBuffer:Q,stdio:W,all:X,options:K,command:G,escapedCommand:z,startTime:H})=>Z===void 0?RU({command:G,escapedCommand:z,stdio:W,all:X,ipcOutput:[],options:K,startTime:H}):t3({error:Z,command:G,escapedCommand:z,timedOut:Y,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:Q,isForcefullyTerminated:!1,exitCode:J,signal:$,stdio:W,all:X,ipcOutput:[],options:K,startTime:H,isSync:!0});import{setMaxListeners as Iz1}from"events";import{spawn as vz1}from"child_process";import eu from"process";import{once as bN,on as c31}from"events";var su=({anyProcess:Z,channel:J,isSubprocess:$,ipc:Y},{reference:Q=!0,filter:W}={})=>{return NW({methodName:"getOneMessage",isSubprocess:$,ipc:Y,isConnected:XU(Z)}),l31({anyProcess:Z,channel:J,isSubprocess:$,filter:W,reference:Q})},l31=async({anyProcess:Z,channel:J,isSubprocess:$,filter:Y,reference:Q})=>{$U(J,Q);let W=JJ(Z,J,$),X=new AbortController;try{return await Promise.race([p31(W,Y,X),i31(W,$,X),n31(W,$,X)])}catch(K){throw PW(Z),K}finally{X.abort(),YU(J,Q)}},p31=async(Z,J,{signal:$})=>{if(J===void 0){let[Y]=await bN(Z,"message",{signal:$});return Y}for await(let[Y]of c31(Z,"message",{signal:$}))if(J(Y))return Y},i31=async(Z,J,{signal:$})=>{await bN(Z,"disconnect",{signal:$}),xg(J)},n31=async(Z,J,{signal:$})=>{let[Y]=await bN(Z,"strict:error",{signal:$});throw eF(Y,J)};import{once as ru,on as a31}from"events";var tu=({anyProcess:Z,channel:J,isSubprocess:$,ipc:Y},{reference:Q=!0}={})=>yN({anyProcess:Z,channel:J,isSubprocess:$,ipc:Y,shouldAwait:!$,reference:Q}),yN=({anyProcess:Z,channel:J,isSubprocess:$,ipc:Y,shouldAwait:Q,reference:W})=>{NW({methodName:"getEachMessage",isSubprocess:$,ipc:Y,isConnected:XU(Z)}),$U(J,W);let X=JJ(Z,J,$),K=new AbortController,G={};return s31(Z,X,K),o31({ipcEmitter:X,isSubprocess:$,controller:K,state:G}),r31({anyProcess:Z,channel:J,ipcEmitter:X,isSubprocess:$,shouldAwait:Q,controller:K,state:G,reference:W})},s31=async(Z,J,$)=>{try{await ru(J,"disconnect",{signal:$.signal}),$.abort()}catch{}},o31=async({ipcEmitter:Z,isSubprocess:J,controller:$,state:Y})=>{try{let[Q]=await ru(Z,"strict:error",{signal:$.signal});Y.error=eF(Q,J),$.abort()}catch{}},r31=async function*({anyProcess:Z,channel:J,ipcEmitter:$,isSubprocess:Y,shouldAwait:Q,controller:W,state:X,reference:K}){try{for await(let[G]of a31($,"message",{signal:W.signal}))ou(X),yield G}catch{ou(X)}finally{if(W.abort(),YU(J,K),!Y)PW(Z);if(Q)await Z}},ou=({error:Z})=>{if(Z)throw Z};var Zd=(Z,{ipc:J})=>{Object.assign(Z,$d(Z,!1,J))},Jd=()=>{let Z=eu,J=!0,$=eu.channel!==void 0;return{...$d(Z,!0,$),getCancelSignal:Km.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:!0,ipc:$})}},$d=(Z,J,$)=>({sendMessage:HU.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:$}),getOneMessage:su.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:$}),getEachMessage:tu.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:$})});import{ChildProcess as t31}from"child_process";import{PassThrough as e31,Readable as ZG1,Writable as JG1,Duplex as $G1}from"stream";var Yd=({error:Z,command:J,escapedCommand:$,fileDescriptors:Y,options:Q,startTime:W,verboseInfo:X})=>{EN(Y);let K=new t31;YG1(K,Y),Object.assign(K,{readable:QG1,writable:WG1,duplex:XG1});let G=kW({error:Z,command:J,escapedCommand:$,fileDescriptors:Y,options:Q,startTime:W,isSync:!1}),z=KG1(G,X,Q);return{subprocess:K,promise:z}},YG1=(Z,J)=>{let $=ZG(),Y=ZG(),Q=ZG(),W=Array.from({length:J.length-3},ZG),X=ZG(),K=[$,Y,Q,...W];Object.assign(Z,{stdin:$,stdout:Y,stderr:Q,all:X,stdio:K})},ZG=()=>{let Z=new e31;return Z.end(),Z},QG1=()=>new ZG1({read(){}}),WG1=()=>new JG1({write(){}}),XG1=()=>new $G1({read(){},write(){}}),KG1=async(Z,J,$)=>EW(Z,J,$);import{createReadStream as Qd,createWriteStream as Wd}from"fs";import{Buffer as GG1}from"buffer";import{Readable as JG,Writable as zG1,Duplex as HG1}from"stream";var Kd=(Z,J)=>CU(VG1,Z,J,!1),$G=({type:Z,optionName:J})=>{throw new TypeError(`The \`${J}\` option cannot be ${$J[Z]}.`)},Xd={fileNumber:$G,generator:xN,asyncGenerator:xN,nodeStream:({value:Z})=>({stream:Z}),webTransform({value:{transform:Z,writableObjectMode:J,readableObjectMode:$}}){let Y=J||$;return{stream:HG1.fromWeb(Z,{objectMode:Y})}},duplex:({value:{transform:Z}})=>({stream:Z}),native(){}},VG1={input:{...Xd,fileUrl:({value:Z})=>({stream:Qd(Z)}),filePath:({value:{file:Z}})=>({stream:Qd(Z)}),webStream:({value:Z})=>({stream:JG.fromWeb(Z)}),iterable:({value:Z})=>({stream:JG.from(Z)}),asyncIterable:({value:Z})=>({stream:JG.from(Z)}),string:({value:Z})=>({stream:JG.from(Z)}),uint8Array:({value:Z})=>({stream:JG.from(GG1.from(Z))})},output:{...Xd,fileUrl:({value:Z})=>({stream:Wd(Z)}),filePath:({value:{file:Z,append:J}})=>({stream:Wd(Z,J?{flags:"a"}:{})}),webStream:({value:Z})=>({stream:zG1.fromWeb(Z)}),iterable:$G,asyncIterable:$G,string:$G,uint8Array:$G}};import{on as qG1,once as Gd}from"events";import{PassThrough as FG1,getDefaultHighWaterMark as UG1}from"stream";import{finished as Vd}from"stream/promises";function a$(Z){if(!Array.isArray(Z))throw new TypeError(`Expected an array, got \`${typeof Z}\`.`);for(let Q of Z)gN(Q);let J=Z.some(({readableObjectMode:Q})=>Q),$=LG1(Z,J),Y=new qd({objectMode:J,writableHighWaterMark:$,readableHighWaterMark:$});for(let Q of Z)Y.add(Q);return Y}var LG1=(Z,J)=>{if(Z.length===0)return UG1(J);let $=Z.filter(({readableObjectMode:Y})=>Y===J).map(({readableHighWaterMark:Y})=>Y);return Math.max(...$)};class qd extends FG1{#Z=new Set([]);#J=new Set([]);#Y=new Set([]);#$;#Q=Symbol("unpipe");#H=new WeakMap;add(Z){if(gN(Z),this.#Z.has(Z))return;this.#Z.add(Z),this.#$??=wG1(this,this.#Z,this.#Q);let J=jG1({passThroughStream:this,stream:Z,streams:this.#Z,ended:this.#J,aborted:this.#Y,onFinished:this.#$,unpipeEvent:this.#Q});this.#H.set(Z,J),Z.pipe(this,{end:!1})}async remove(Z){if(gN(Z),!this.#Z.has(Z))return!1;let J=this.#H.get(Z);if(J===void 0)return!1;return this.#H.delete(Z),Z.unpipe(this),await J,!0}}var wG1=async(Z,J,$)=>{_U(Z,zd);let Y=new AbortController;try{await Promise.race([BG1(Z,Y),OG1(Z,J,$,Y)])}finally{Y.abort(),_U(Z,-zd)}},BG1=async(Z,{signal:J})=>{try{await Vd(Z,{signal:J,cleanup:!0})}catch($){throw Fd(Z,$),$}},OG1=async(Z,J,$,{signal:Y})=>{for await(let[Q]of qG1(Z,"unpipe",{signal:Y}))if(J.has(Q))Q.emit($)},gN=(Z)=>{if(typeof Z?.pipe!=="function")throw new TypeError(`Expected a readable stream, got: \`${typeof Z}\`.`)},jG1=async({passThroughStream:Z,stream:J,streams:$,ended:Y,aborted:Q,onFinished:W,unpipeEvent:X})=>{_U(Z,Hd);let K=new AbortController;try{await Promise.race([MG1(W,J,K),RG1({passThroughStream:Z,stream:J,streams:$,ended:Y,aborted:Q,controller:K}),NG1({stream:J,streams:$,ended:Y,aborted:Q,unpipeEvent:X,controller:K})])}finally{K.abort(),_U(Z,-Hd)}if($.size>0&&$.size===Y.size+Q.size)if(Y.size===0&&Q.size>0)mN(Z);else PG1(Z)},MG1=async(Z,J,{signal:$})=>{try{if(await Z,!$.aborted)mN(J)}catch(Y){if(!$.aborted)Fd(J,Y)}},RG1=async({passThroughStream:Z,stream:J,streams:$,ended:Y,aborted:Q,controller:{signal:W}})=>{try{if(await Vd(J,{signal:W,cleanup:!0,readable:!0,writable:!1}),$.has(J))Y.add(J)}catch(X){if(W.aborted||!$.has(J))return;if(Ud(X))Q.add(J);else Ld(Z,X)}},NG1=async({stream:Z,streams:J,ended:$,aborted:Y,unpipeEvent:Q,controller:{signal:W}})=>{if(await Gd(Z,Q,{signal:W}),!Z.readable)return Gd(W,"abort",{signal:W});J.delete(Z),$.delete(Z),Y.delete(Z)},PG1=(Z)=>{if(Z.writable)Z.end()},Fd=(Z,J)=>{if(Ud(J))mN(Z);else Ld(Z,J)},Ud=(Z)=>Z?.code==="ERR_STREAM_PREMATURE_CLOSE",mN=(Z)=>{if(Z.readable||Z.writable)Z.destroy()},Ld=(Z,J)=>{if(!Z.destroyed)Z.once("error",DG1),Z.destroy(J)},DG1=()=>{},_U=(Z,J)=>{let $=Z.getMaxListeners();if($!==0&&$!==Number.POSITIVE_INFINITY)Z.setMaxListeners($+J)},zd=2,Hd=1;import{finished as wd}from"stream/promises";var vW=(Z,J)=>{Z.pipe(J),CG1(Z,J),TG1(Z,J)},CG1=async(Z,J)=>{if(K4(Z)||K4(J))return;try{await wd(Z,{cleanup:!0,readable:!0,writable:!1})}catch{}uN(J)},uN=(Z)=>{if(Z.writable)Z.end()},TG1=async(Z,J)=>{if(K4(Z)||K4(J))return;try{await wd(J,{cleanup:!0,readable:!1,writable:!0})}catch{}dN(Z)},dN=(Z)=>{if(Z.readable)Z.destroy()};var Bd=(Z,J,$)=>{let Y=new Map;for(let[Q,{stdioItems:W,direction:X}]of Object.entries(J)){for(let{stream:K}of W.filter(({type:G})=>q9.has(G)))kG1(Z,K,X,Q);for(let{stream:K}of W.filter(({type:G})=>!q9.has(G)))IG1({subprocess:Z,stream:K,direction:X,fdNumber:Q,pipeGroups:Y,controller:$})}for(let[Q,W]of Y.entries()){let X=W.length===1?W[0]:a$(W);vW(X,Q)}},kG1=(Z,J,$,Y)=>{if($==="output")vW(Z.stdio[Y],J);else vW(J,Z.stdio[Y]);let Q=EG1[Y];if(Q!==void 0)Z[Q]=J;Z.stdio[Y]=J},EG1=["stdin","stdout","stderr"],IG1=({subprocess:Z,stream:J,direction:$,fdNumber:Y,pipeGroups:Q,controller:W})=>{if(J===void 0)return;vG1(J,W);let[X,K]=$==="output"?[J,Z.stdio[Y]]:[Z.stdio[Y],J],G=Q.get(X)??[];Q.set(X,[...G,K])},vG1=(Z,{signal:J})=>{if(K4(Z))l$(Z,SG1,J)},SG1=2;import{addAbortListener as xG1}from"events";var s$=[];s$.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")s$.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")s$.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var AU=(Z)=>!!Z&&typeof Z==="object"&&typeof Z.removeListener==="function"&&typeof Z.emit==="function"&&typeof Z.reallyExit==="function"&&typeof Z.listeners==="function"&&typeof Z.kill==="function"&&typeof Z.pid==="number"&&typeof Z.on==="function",cN=Symbol.for("signal-exit emitter"),lN=globalThis,_G1=Object.defineProperty.bind(Object);class Od{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(lN[cN])return lN[cN];_G1(lN,cN,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(Z,J){this.listeners[Z].push(J)}removeListener(Z,J){let $=this.listeners[Z],Y=$.indexOf(J);if(Y===-1)return;if(Y===0&&$.length===1)$.length=0;else $.splice(Y,1)}emit(Z,J,$){if(this.emitted[Z])return!1;this.emitted[Z]=!0;let Y=!1;for(let Q of this.listeners[Z])Y=Q(J,$)===!0||Y;if(Z==="exit")Y=this.emit("afterExit",J,$)||Y;return Y}}class iN{}var AG1=(Z)=>{return{onExit(J,$){return Z.onExit(J,$)},load(){return Z.load()},unload(){return Z.unload()}}};class jd extends iN{onExit(){return()=>{}}load(){}unload(){}}class Md extends iN{#Z=pN.platform==="win32"?"SIGINT":"SIGHUP";#J=new Od;#Y;#$;#Q;#H={};#q=!1;constructor(Z){super();this.#Y=Z,this.#H={};for(let J of s$)this.#H[J]=()=>{let $=this.#Y.listeners(J),{count:Y}=this.#J,Q=Z;if(typeof Q.__signal_exit_emitter__==="object"&&typeof Q.__signal_exit_emitter__.count==="number")Y+=Q.__signal_exit_emitter__.count;if($.length===Y){this.unload();let W=this.#J.emit("exit",null,J),X=J==="SIGHUP"?this.#Z:J;if(!W)Z.kill(Z.pid,X)}};this.#Q=Z.reallyExit,this.#$=Z.emit}onExit(Z,J){if(!AU(this.#Y))return()=>{};if(this.#q===!1)this.load();let $=J?.alwaysLast?"afterExit":"exit";return this.#J.on($,Z),()=>{if(this.#J.removeListener($,Z),this.#J.listeners.exit.length===0&&this.#J.listeners.afterExit.length===0)this.unload()}}load(){if(this.#q)return;this.#q=!0,this.#J.count+=1;for(let Z of s$)try{let J=this.#H[Z];if(J)this.#Y.on(Z,J)}catch(J){}this.#Y.emit=(Z,...J)=>{return this.#G(Z,...J)},this.#Y.reallyExit=(Z)=>{return this.#K(Z)}}unload(){if(!this.#q)return;this.#q=!1,s$.forEach((Z)=>{let J=this.#H[Z];if(!J)throw new Error("Listener not defined for signal: "+Z);try{this.#Y.removeListener(Z,J)}catch($){}}),this.#Y.emit=this.#$,this.#Y.reallyExit=this.#Q,this.#J.count-=1}#K(Z){if(!AU(this.#Y))return 0;return this.#Y.exitCode=Z||0,this.#J.emit("exit",this.#Y.exitCode,null),this.#Q.call(this.#Y,this.#Y.exitCode)}#G(Z,...J){let $=this.#$;if(Z==="exit"&&AU(this.#Y)){if(typeof J[0]==="number")this.#Y.exitCode=J[0];let Y=$.call(this.#Y,Z,...J);return this.#J.emit("exit",this.#Y.exitCode,null),Y}else return $.call(this.#Y,Z,...J)}}var pN=globalThis.process,{onExit:Rd,load:FX6,unload:UX6}=AG1(AU(pN)?new Md(pN):new jd);var Nd=(Z,{cleanup:J,detached:$},{signal:Y})=>{if(!J||$)return;let Q=Rd(()=>{Z.kill()});xG1(Y,()=>{Q()})};var Dd=({source:Z,sourcePromise:J,boundOptions:$,createNested:Y},...Q)=>{let W=dF(),{destination:X,destinationStream:K,destinationError:G,from:z,unpipeSignal:H}=hG1($,Y,Q),{sourceStream:V,sourceError:q}=bG1(Z,z),{options:F,fileDescriptors:U}=i4.get(Z);return{sourcePromise:J,sourceStream:V,sourceOptions:F,sourceError:q,destination:X,destinationStream:K,destinationError:G,unpipeSignal:H,fileDescriptors:U,startTime:W}},hG1=(Z,J,$)=>{try{let{destination:Y,pipeOptions:{from:Q,to:W,unpipeSignal:X}={}}=fG1(Z,J,...$),K=JU(Y,W);return{destination:Y,destinationStream:K,from:Q,unpipeSignal:X}}catch(Y){return{destinationError:Y}}},fG1=(Z,J,$,...Y)=>{if(Array.isArray($))return{destination:J(Pd,Z)($,...Y),pipeOptions:Z};if(typeof $==="string"||$ instanceof URL||yR($)){if(Object.keys(Z).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[Q,W,X]=_F($,...Y);return{destination:J(Pd)(Q,W,X),pipeOptions:X}}if(i4.has($)){if(Object.keys(Z).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:$,pipeOptions:Y[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${$}`)},Pd=({options:Z})=>({options:{...Z,stdin:"pipe",piped:!0}}),bG1=(Z,J)=>{try{return{sourceStream:DW(Z,J)}}catch($){return{sourceError:$}}};var Td=({sourceStream:Z,sourceError:J,destinationStream:$,destinationError:Y,fileDescriptors:Q,sourceOptions:W,startTime:X})=>{let K=yG1({sourceStream:Z,sourceError:J,destinationStream:$,destinationError:Y});if(K!==void 0)throw nN({error:K,fileDescriptors:Q,sourceOptions:W,startTime:X})},yG1=({sourceStream:Z,sourceError:J,destinationStream:$,destinationError:Y})=>{if(J!==void 0&&Y!==void 0)return Y;if(Y!==void 0)return dN(Z),Y;if(J!==void 0)return uN($),J},nN=({error:Z,fileDescriptors:J,sourceOptions:$,startTime:Y})=>kW({error:Z,command:Cd,escapedCommand:Cd,fileDescriptors:J,options:$,startTime:Y,isSync:!1}),Cd="source.pipe(destination)";var kd=async(Z)=>{let[{status:J,reason:$,value:Y=$},{status:Q,reason:W,value:X=W}]=await Z;if(!X.pipedFrom.includes(Y))X.pipedFrom.push(Y);if(Q==="rejected")throw X;if(J==="rejected")throw Y;return X};import{finished as gG1}from"stream/promises";var Ed=(Z,J,$)=>{let Y=xU.has(J)?uG1(Z,J):mG1(Z,J);return l$(Z,cG1,$.signal),l$(J,lG1,$.signal),dG1(J),Y},mG1=(Z,J)=>{let $=a$([Z]);return vW($,J),xU.set(J,$),$},uG1=(Z,J)=>{let $=xU.get(J);return $.add(Z),$},dG1=async(Z)=>{try{await gG1(Z,{cleanup:!0,readable:!1,writable:!0})}catch{}xU.delete(Z)},xU=new WeakMap,cG1=2,lG1=1;import{aborted as pG1}from"util";var Id=(Z,J)=>Z===void 0?[]:[iG1(Z,J)],iG1=async(Z,{sourceStream:J,mergedStream:$,fileDescriptors:Y,sourceOptions:Q,startTime:W})=>{await pG1(Z,J),await $.remove(J);let X=new Error("Pipe canceled by `unpipeSignal` option.");throw nN({error:X,fileDescriptors:Y,sourceOptions:Q,startTime:W})};var hU=(Z,...J)=>{if(j8(J[0]))return hU.bind(void 0,{...Z,boundOptions:{...Z.boundOptions,...J[0]}});let{destination:$,...Y}=Dd(Z,...J),Q=nG1({...Y,destination:$});return Q.pipe=hU.bind(void 0,{...Z,source:$,sourcePromise:Q,boundOptions:{}}),Q},nG1=async({sourcePromise:Z,sourceStream:J,sourceOptions:$,sourceError:Y,destination:Q,destinationStream:W,destinationError:X,unpipeSignal:K,fileDescriptors:G,startTime:z})=>{let H=aG1(Z,Q);Td({sourceStream:J,sourceError:Y,destinationStream:W,destinationError:X,fileDescriptors:G,sourceOptions:$,startTime:z});let V=new AbortController;try{let q=Ed(J,W,V);return await Promise.race([kd(H),...Id(K,{sourceStream:J,mergedStream:q,sourceOptions:$,fileDescriptors:G,startTime:z})])}finally{V.abort()}},aG1=(Z,J)=>Promise.allSettled([Z,J]);import{setImmediate as Jz1}from"timers/promises";import{on as sG1}from"events";import{getDefaultHighWaterMark as oG1}from"stream";var fU=({subprocessStdout:Z,subprocess:J,binary:$,shouldEncode:Y,encoding:Q,preserveNewlines:W})=>{let X=new AbortController;return rG1(J,X),Sd({stream:Z,controller:X,binary:$,shouldEncode:!Z.readableObjectMode&&Y,encoding:Q,shouldSplit:!Z.readableObjectMode,preserveNewlines:W})},rG1=async(Z,J)=>{try{await Z}catch{}finally{J.abort()}},aN=({stream:Z,onStreamEnd:J,lines:$,encoding:Y,stripFinalNewline:Q,allMixed:W})=>{let X=new AbortController;tG1(J,X,Z);let K=Z.readableObjectMode&&!W;return Sd({stream:Z,controller:X,binary:Y==="buffer",shouldEncode:!K,encoding:Y,shouldSplit:!K&&$,preserveNewlines:!Q})},tG1=async(Z,J,$)=>{try{await Z}catch{$.destroy()}finally{J.abort()}},Sd=({stream:Z,controller:J,binary:$,shouldEncode:Y,encoding:Q,shouldSplit:W,preserveNewlines:X})=>{let K=sG1(Z,"data",{signal:J.signal,highWaterMark:vd,highWatermark:vd});return eG1({onStdoutChunk:K,controller:J,binary:$,shouldEncode:Y,encoding:Q,shouldSplit:W,preserveNewlines:X})},sN=oG1(!0),vd=sN,eG1=async function*({onStdoutChunk:Z,controller:J,binary:$,shouldEncode:Y,encoding:Q,shouldSplit:W,preserveNewlines:X}){let K=Zz1({binary:$,shouldEncode:Y,encoding:Q,shouldSplit:W,preserveNewlines:X});try{for await(let[G]of Z)yield*n$(G,K,0)}catch(G){if(!J.signal.aborted)throw G}finally{yield*e3(K)}},Zz1=({binary:Z,shouldEncode:J,encoding:$,shouldSplit:Y,preserveNewlines:Q})=>[kU(Z,$,!J),TU(Z,Q,!Y,{})].filter(Boolean);var _d=async({stream:Z,onStreamEnd:J,fdNumber:$,encoding:Y,buffer:Q,maxBuffer:W,lines:X,allMixed:K,stripFinalNewline:G,verboseInfo:z,streamInfo:H})=>{let V=$z1({stream:Z,onStreamEnd:J,fdNumber:$,encoding:Y,allMixed:K,verboseInfo:z,streamInfo:H});if(!Q){await Promise.all([Yz1(Z),V]);return}let q=IN(G,$),F=aN({stream:Z,onStreamEnd:J,lines:X,encoding:Y,stripFinalNewline:q,allMixed:K}),[U]=await Promise.all([Qz1({stream:Z,iterable:F,fdNumber:$,encoding:Y,maxBuffer:W,lines:X}),V]);return U},$z1=async({stream:Z,onStreamEnd:J,fdNumber:$,encoding:Y,allMixed:Q,verboseInfo:W,streamInfo:{fileDescriptors:X}})=>{if(!vU({stdioItems:X[$]?.stdioItems,encoding:Y,verboseInfo:W,fdNumber:$}))return;let K=aN({stream:Z,onStreamEnd:J,lines:!0,encoding:Y,stripFinalNewline:!0,allMixed:Q});await gu(K,Z,$,W)},Yz1=async(Z)=>{if(await Jz1(),Z.readableFlowing===null)Z.resume()},Qz1=async({stream:Z,stream:{readableObjectMode:J},iterable:$,fdNumber:Y,encoding:Q,maxBuffer:W,lines:X})=>{try{if(J||X)return await wU($,{maxBuffer:W});if(Q==="buffer")return new Uint8Array(await BU($,{maxBuffer:W}));return await jU($,{maxBuffer:W})}catch(K){return Ad(gm({error:K,stream:Z,readableObjectMode:J,lines:X,encoding:Q,fdNumber:Y}))}},oN=async(Z)=>{try{return await Z}catch(J){return Ad(J)}},Ad=({bufferedData:Z})=>Jy(Z)?new Uint8Array(Z):Z;import{finished as Wz1}from"stream/promises";var YG=async(Z,J,$,{isSameDirection:Y,stopOnExit:Q=!1}={})=>{let W=Xz1(Z,$),X=new AbortController;try{await Promise.race([...Q?[$.exitPromise]:[],Wz1(Z,{cleanup:!0,signal:X.signal})])}catch(K){if(!W.stdinCleanedUp)zz1(K,J,$,Y)}finally{X.abort()}},Xz1=(Z,{originalStreams:[J],subprocess:$})=>{let Y={stdinCleanedUp:!1};if(Z===J)Kz1(Z,$,Y);return Y},Kz1=(Z,J,$)=>{let{_destroy:Y}=Z;Z._destroy=(...Q)=>{Gz1(J,$),Y.call(Z,...Q)}},Gz1=({exitCode:Z,signalCode:J},$)=>{if(Z!==null||J!==null)$.stdinCleanedUp=!0},zz1=(Z,J,$,Y)=>{if(!Hz1(Z,J,$,Y))throw Z},Hz1=(Z,J,$,Y=!0)=>{if($.propagating)return xd(Z)||bU(Z);return $.propagating=!0,rN($,J)===Y?xd(Z):bU(Z)},rN=({fileDescriptors:Z},J)=>J!=="all"&&Z[J].direction==="input",bU=(Z)=>Z?.code==="ERR_STREAM_PREMATURE_CLOSE",xd=(Z)=>Z?.code==="EPIPE";var hd=({subprocess:Z,encoding:J,buffer:$,maxBuffer:Y,lines:Q,stripFinalNewline:W,verboseInfo:X,streamInfo:K})=>Z.stdio.map((G,z)=>tN({stream:G,fdNumber:z,encoding:J,buffer:$[z],maxBuffer:Y[z],lines:Q[z],allMixed:!1,stripFinalNewline:W,verboseInfo:X,streamInfo:K})),tN=async({stream:Z,fdNumber:J,encoding:$,buffer:Y,maxBuffer:Q,lines:W,allMixed:X,stripFinalNewline:K,verboseInfo:G,streamInfo:z})=>{if(!Z)return;let H=YG(Z,J,z);if(rN(z,J)){await H;return}let[V]=await Promise.all([_d({stream:Z,onStreamEnd:H,fdNumber:J,encoding:$,buffer:Y,maxBuffer:Q,lines:W,allMixed:X,stripFinalNewline:K,verboseInfo:G,streamInfo:z}),H]);return V};var fd=({stdout:Z,stderr:J},{all:$})=>$&&(Z||J)?a$([Z,J].filter(Boolean)):void 0,bd=({subprocess:Z,encoding:J,buffer:$,maxBuffer:Y,lines:Q,stripFinalNewline:W,verboseInfo:X,streamInfo:K})=>tN({...Vz1(Z,$),fdNumber:"all",encoding:J,maxBuffer:Y[1]+Y[2],lines:Q[1]||Q[2],allMixed:qz1(Z),stripFinalNewline:W,verboseInfo:X,streamInfo:K}),Vz1=({stdout:Z,stderr:J,all:$},[,Y,Q])=>{let W=Y||Q;if(!W)return{stream:$,buffer:W};if(!Y)return{stream:J,buffer:W};if(!Q)return{stream:Z,buffer:W};return{stream:$,buffer:W}},qz1=({all:Z,stdout:J,stderr:$})=>Z&&J&&$&&J.readableObjectMode!==$.readableObjectMode;import{once as Fz1}from"events";var yd=(Z)=>jW(Z,"ipc"),gd=(Z,J)=>{let $=uF(Z);c4({type:"ipc",verboseMessage:$,fdNumber:"ipc",verboseInfo:J})};var md=async({subprocess:Z,buffer:J,maxBuffer:$,ipc:Y,ipcOutput:Q,verboseInfo:W})=>{if(!Y)return Q;let X=yd(W),K=r7(J,"ipc"),G=r7($,"ipc");for await(let z of yN({anyProcess:Z,channel:Z.channel,isSubprocess:!1,ipc:Y,shouldAwait:!1,reference:!0})){if(K)mm(Z,Q,G),Q.push(z);if(X)gd(z,W)}return Q},ud=async(Z,J)=>{return await Promise.allSettled([Z]),J};var dd=async({subprocess:Z,options:{encoding:J,buffer:$,maxBuffer:Y,lines:Q,timeoutDuration:W,cancelSignal:X,gracefulCancel:K,forceKillAfterDelay:G,stripFinalNewline:z,ipc:H,ipcInput:V},context:q,verboseInfo:F,fileDescriptors:U,originalStreams:w,onInternalError:L,controller:O})=>{let j=lu(Z,q),M={originalStreams:w,fileDescriptors:U,subprocess:Z,exitPromise:j,propagating:!1},N=hd({subprocess:Z,encoding:J,buffer:$,maxBuffer:Y,lines:Q,stripFinalNewline:z,verboseInfo:F,streamInfo:M}),D=bd({subprocess:Z,encoding:J,buffer:$,maxBuffer:Y,lines:Q,stripFinalNewline:z,verboseInfo:F,streamInfo:M}),P=[],C=md({subprocess:Z,buffer:$,maxBuffer:Y,ipc:H,ipcOutput:P,verboseInfo:F}),T=Uz1(w,Z,M),E=Lz1(U,M);try{return await Promise.race([Promise.all([{},iu(j),Promise.all(N),D,C,Bm(Z,V),...T,...E]),L,wz1(Z,O),...qm(Z,W,q,O),...Ag({subprocess:Z,cancelSignal:X,gracefulCancel:K,context:q,controller:O}),...Hm({subprocess:Z,cancelSignal:X,gracefulCancel:K,forceKillAfterDelay:G,context:q,controller:O})])}catch(A){return q.terminationReason??="other",Promise.all([{error:A},j,Promise.all(N.map((S)=>oN(S))),oN(D),ud(C,P),Promise.allSettled(T),Promise.allSettled(E)])}},Uz1=(Z,J,$)=>Z.map((Y,Q)=>Y===J.stdio[Q]?void 0:YG(Y,Q,$)),Lz1=(Z,J)=>Z.flatMap(({stdioItems:$},Y)=>$.filter(({value:Q,stream:W=Q})=>z4(W,{checkOpen:!1})&&!K4(W)).map(({type:Q,value:W,stream:X=W})=>YG(X,Y,J,{isSameDirection:q9.has(Q),stopOnExit:Q==="native"}))),wz1=async(Z,{signal:J})=>{let[$]=await Fz1(Z,"error",{signal:J});throw $};var cd=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),QG=(Z,J,$)=>{let Y=Z[$];if(!Y.has(J))Y.set(J,[]);let Q=Y.get(J),W=p4();return Q.push(W),{resolve:W.resolve.bind(W),promises:Q}},SW=async({resolve:Z,promises:J},$)=>{Z();let[Y]=await Promise.race([Promise.allSettled([!0,$]),Promise.all([!1,...J])]);return!Y};import{Readable as Bz1}from"stream";import{callbackify as Oz1}from"util";import{finished as ld}from"stream/promises";var eN=async(Z)=>{if(Z===void 0)return;try{await ZP(Z)}catch{}},pd=async(Z)=>{if(Z===void 0)return;try{await JP(Z)}catch{}},ZP=async(Z)=>{await ld(Z,{cleanup:!0,readable:!1,writable:!0})},JP=async(Z)=>{await ld(Z,{cleanup:!0,readable:!0,writable:!1})},yU=async(Z,J)=>{if(await Z,J)throw J},gU=(Z,J,$)=>{if($&&!bU($))Z.destroy($);else if(J)Z.destroy()};var id=({subprocess:Z,concurrentStreams:J,encoding:$},{from:Y,binary:Q=!0,preserveNewlines:W=!0}={})=>{let X=Q||u5.has($),{subprocessStdout:K,waitReadableDestroy:G}=$P(Z,Y,J),{readableEncoding:z,readableObjectMode:H,readableHighWaterMark:V}=YP(K,X),{read:q,onStdoutDataDone:F}=QP({subprocessStdout:K,subprocess:Z,binary:X,encoding:$,preserveNewlines:W}),U=new Bz1({read:q,destroy:Oz1(XP.bind(void 0,{subprocessStdout:K,subprocess:Z,waitReadableDestroy:G})),highWaterMark:V,objectMode:H,encoding:z});return WP({subprocessStdout:K,onStdoutDataDone:F,readable:U,subprocess:Z}),U},$P=(Z,J,$)=>{let Y=DW(Z,J),Q=QG($,Y,"readableDestroy");return{subprocessStdout:Y,waitReadableDestroy:Q}},YP=({readableEncoding:Z,readableObjectMode:J,readableHighWaterMark:$},Y)=>Y?{readableEncoding:Z,readableObjectMode:J,readableHighWaterMark:$}:{readableEncoding:Z,readableObjectMode:!0,readableHighWaterMark:sN},QP=({subprocessStdout:Z,subprocess:J,binary:$,encoding:Y,preserveNewlines:Q})=>{let W=p4(),X=fU({subprocessStdout:Z,subprocess:J,binary:$,shouldEncode:!$,encoding:Y,preserveNewlines:Q});return{read(){jz1(this,X,W)},onStdoutDataDone:W}},jz1=async(Z,J,$)=>{try{let{value:Y,done:Q}=await J.next();if(Q)$.resolve();else Z.push(Y)}catch{}},WP=async({subprocessStdout:Z,onStdoutDataDone:J,readable:$,subprocess:Y,subprocessStdin:Q})=>{try{if(await JP(Z),await Y,await eN(Q),await J,$.readable)$.push(null)}catch(W){await eN(Q),nd($,W)}},XP=async({subprocessStdout:Z,subprocess:J,waitReadableDestroy:$},Y)=>{if(await SW($,J))nd(Z,Y),await yU(J,Y)},nd=(Z,J)=>{gU(Z,Z.readable,J)};import{Writable as Mz1}from"stream";import{callbackify as ad}from"util";var sd=({subprocess:Z,concurrentStreams:J},{to:$}={})=>{let{subprocessStdin:Y,waitWritableFinal:Q,waitWritableDestroy:W}=KP(Z,$,J),X=new Mz1({...GP(Y,Z,Q),destroy:ad(HP.bind(void 0,{subprocessStdin:Y,subprocess:Z,waitWritableFinal:Q,waitWritableDestroy:W})),highWaterMark:Y.writableHighWaterMark,objectMode:Y.writableObjectMode});return zP(Y,X),X},KP=(Z,J,$)=>{let Y=JU(Z,J),Q=QG($,Y,"writableFinal"),W=QG($,Y,"writableDestroy");return{subprocessStdin:Y,waitWritableFinal:Q,waitWritableDestroy:W}},GP=(Z,J,$)=>({write:Rz1.bind(void 0,Z),final:ad(Nz1.bind(void 0,Z,J,$))}),Rz1=(Z,J,$,Y)=>{if(Z.write(J,$))Y();else Z.once("drain",Y)},Nz1=async(Z,J,$)=>{if(await SW($,J)){if(Z.writable)Z.end();await J}},zP=async(Z,J,$)=>{try{if(await ZP(Z),J.writable)J.end()}catch(Y){await pd($),od(J,Y)}},HP=async({subprocessStdin:Z,subprocess:J,waitWritableFinal:$,waitWritableDestroy:Y},Q)=>{if(await SW($,J),await SW(Y,J))od(Z,Q),await yU(J,Q)},od=(Z,J)=>{gU(Z,Z.writable,J)};import{Duplex as Pz1}from"stream";import{callbackify as Dz1}from"util";var rd=({subprocess:Z,concurrentStreams:J,encoding:$},{from:Y,to:Q,binary:W=!0,preserveNewlines:X=!0}={})=>{let K=W||u5.has($),{subprocessStdout:G,waitReadableDestroy:z}=$P(Z,Y,J),{subprocessStdin:H,waitWritableFinal:V,waitWritableDestroy:q}=KP(Z,Q,J),{readableEncoding:F,readableObjectMode:U,readableHighWaterMark:w}=YP(G,K),{read:L,onStdoutDataDone:O}=QP({subprocessStdout:G,subprocess:Z,binary:K,encoding:$,preserveNewlines:X}),j=new Pz1({read:L,...GP(H,Z,V),destroy:Dz1(Cz1.bind(void 0,{subprocessStdout:G,subprocessStdin:H,subprocess:Z,waitReadableDestroy:z,waitWritableFinal:V,waitWritableDestroy:q})),readableHighWaterMark:w,writableHighWaterMark:H.writableHighWaterMark,readableObjectMode:U,writableObjectMode:H.writableObjectMode,encoding:F});return WP({subprocessStdout:G,onStdoutDataDone:O,readable:j,subprocess:Z,subprocessStdin:H}),zP(H,j,G),j},Cz1=async({subprocessStdout:Z,subprocessStdin:J,subprocess:$,waitReadableDestroy:Y,waitWritableFinal:Q,waitWritableDestroy:W},X)=>{await Promise.all([XP({subprocessStdout:Z,subprocess:$,waitReadableDestroy:Y},X),HP({subprocessStdin:J,subprocess:$,waitWritableFinal:Q,waitWritableDestroy:W},X)])};var VP=(Z,J,{from:$,binary:Y=!1,preserveNewlines:Q=!1}={})=>{let W=Y||u5.has(J),X=DW(Z,$),K=fU({subprocessStdout:X,subprocess:Z,binary:W,shouldEncode:!0,encoding:J,preserveNewlines:Q});return Tz1(K,X,Z)},Tz1=async function*(Z,J,$){try{yield*Z}finally{if(J.readable)J.destroy();await $}};var td=(Z,{encoding:J})=>{let $=cd();Z.readable=id.bind(void 0,{subprocess:Z,concurrentStreams:$,encoding:J}),Z.writable=sd.bind(void 0,{subprocess:Z,concurrentStreams:$}),Z.duplex=rd.bind(void 0,{subprocess:Z,concurrentStreams:$,encoding:J}),Z.iterable=VP.bind(void 0,Z,J),Z[Symbol.asyncIterator]=VP.bind(void 0,Z,J,{})};var ed=(Z,J)=>{for(let[$,Y]of Ez1){let Q=Y.value.bind(J);Reflect.defineProperty(Z,$,{...Y,value:Q})}},kz1=(async()=>{})().constructor.prototype,Ez1=["then","catch","finally"].map((Z)=>[Z,Reflect.getOwnPropertyDescriptor(kz1,Z)]);var Zc=(Z,J,$,Y)=>{let{file:Q,commandArguments:W,command:X,escapedCommand:K,startTime:G,verboseInfo:z,options:H,fileDescriptors:V}=Sz1(Z,J,$),{subprocess:q,promise:F}=Az1({file:Q,commandArguments:W,options:H,startTime:G,verboseInfo:z,command:X,escapedCommand:K,fileDescriptors:V});return q.pipe=hU.bind(void 0,{source:q,sourcePromise:F,boundOptions:{},createNested:Y}),ed(q,F),i4.set(q,{options:H,fileDescriptors:V}),q},Sz1=(Z,J,$)=>{let{command:Y,escapedCommand:Q,startTime:W,verboseInfo:X}=cF(Z,J,$),{file:K,commandArguments:G,options:z}=qU(Z,J,$),H=_z1(z),V=Kd(H,X);return{file:K,commandArguments:G,command:Y,escapedCommand:Q,startTime:W,verboseInfo:X,options:H,fileDescriptors:V}},_z1=({timeout:Z,signal:J,...$})=>{if(J!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...$,timeoutDuration:Z}},Az1=({file:Z,commandArguments:J,options:$,startTime:Y,verboseInfo:Q,command:W,escapedCommand:X,fileDescriptors:K})=>{let G;try{G=vz1(Z,J,$)}catch(U){return Yd({error:U,command:W,escapedCommand:X,fileDescriptors:K,options:$,startTime:Y,verboseInfo:Q})}let z=new AbortController;Iz1(Number.POSITIVE_INFINITY,z.signal);let H=[...G.stdio];Bd(G,K,z),Nd(G,$,z);let V={},q=p4();G.kill=Sg.bind(void 0,{kill:G.kill.bind(G),options:$,onInternalError:q,context:V,controller:z}),G.all=fd(G,$),td(G,$),Zd(G,$);let F=xz1({subprocess:G,options:$,startTime:Y,verboseInfo:Q,fileDescriptors:K,originalStreams:H,command:W,escapedCommand:X,context:V,onInternalError:q,controller:z});return{subprocess:G,promise:F}},xz1=async({subprocess:Z,options:J,startTime:$,verboseInfo:Y,fileDescriptors:Q,originalStreams:W,command:X,escapedCommand:K,context:G,onInternalError:z,controller:H})=>{let[V,[q,F],U,w,L]=await dd({subprocess:Z,options:J,context:G,verboseInfo:Y,fileDescriptors:Q,originalStreams:W,onInternalError:z,controller:H});H.abort(),z.resolve();let O=U.map((N,D)=>ZZ(N,J,D)),j=ZZ(w,J,"all"),M=hz1({errorInfo:V,exitCode:q,signal:F,stdio:O,all:j,ipcOutput:L,context:G,options:J,command:X,escapedCommand:K,startTime:$});return EW(M,Y,J)},hz1=({errorInfo:Z,exitCode:J,signal:$,stdio:Y,all:Q,ipcOutput:W,context:X,options:K,command:G,escapedCommand:z,startTime:H})=>("error"in Z)?t3({error:Z.error,command:G,escapedCommand:z,timedOut:X.terminationReason==="timeout",isCanceled:X.terminationReason==="cancel"||X.terminationReason==="gracefulCancel",isGracefullyCanceled:X.terminationReason==="gracefulCancel",isMaxBuffer:Z.error instanceof t7,isForcefullyTerminated:X.isForcefullyTerminated,exitCode:J,signal:$,stdio:Y,all:Q,ipcOutput:W,options:K,startTime:H,isSync:!1}):RU({command:G,escapedCommand:z,stdio:Y,all:Q,ipcOutput:W,options:K,startTime:H});var mU=(Z,J)=>{let $=Object.fromEntries(Object.entries(J).map(([Y,Q])=>[Y,fz1(Y,Z[Y],Q)]));return{...Z,...$}},fz1=(Z,J,$)=>{if(bz1.has(Z)&&j8(J)&&j8($))return{...J,...$};return $},bz1=new Set(["env",...lR]);var YJ=(Z,J,$,Y)=>{let Q=(X,K,G)=>YJ(X,K,$,G),W=(...X)=>yz1({mapArguments:Z,deepOptions:$,boundOptions:J,setBoundExeca:Y,createNested:Q},...X);if(Y!==void 0)Y(W,Q,J);return W},yz1=({mapArguments:Z,deepOptions:J={},boundOptions:$={},setBoundExeca:Y,createNested:Q},W,...X)=>{if(j8(W))return Q(Z,mU($,W),Y);let{file:K,commandArguments:G,options:z,isSync:H}=gz1({mapArguments:Z,firstArgument:W,nextArguments:X,deepOptions:J,boundOptions:$});return H?au(K,G,z):Zc(K,G,z,Q)},gz1=({mapArguments:Z,firstArgument:J,nextArguments:$,deepOptions:Y,boundOptions:Q})=>{let W=Ky(J)?Gy(J,$):[J,...$],[X,K,G]=_F(...W),z=mU(mU(Y,Q),G),{file:H=X,commandArguments:V=K,options:q=z,isSync:F=!1}=Z({file:X,commandArguments:K,options:z});return{file:H,commandArguments:V,options:q,isSync:F}};var Jc=({file:Z,commandArguments:J})=>Yc(Z,J),$c=({file:Z,commandArguments:J})=>({...Yc(Z,J),isSync:!0}),Yc=(Z,J)=>{if(J.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${Z} ${J}.`);let[$,...Y]=mz1(Z);return{file:$,commandArguments:Y}},mz1=(Z)=>{if(typeof Z!=="string")throw new TypeError(`The command must be a string: ${String(Z)}.`);let J=Z.trim();if(J==="")return[];let $=[];for(let Y of J.split(uz1)){let Q=$.at(-1);if(Q&&Q.endsWith("\\"))$[$.length-1]=`${Q.slice(0,-1)} ${Y}`;else $.push(Y)}return $},uz1=/ +/g;var Qc=(Z,J,$)=>{Z.sync=J(dz1,$),Z.s=Z.sync},Wc=({options:Z})=>Xc(Z),dz1=({options:Z})=>({...Xc(Z),isSync:!0}),Xc=(Z)=>({options:{...cz1(Z),...Z}}),cz1=({input:Z,inputFile:J,stdio:$})=>Z===void 0&&J===void 0&&$===void 0?{stdin:"inherit"}:{},Kc={preferLocal:!0};var Gc=YJ(()=>({})),$G6=YJ(()=>({isSync:!0})),YG6=YJ(Jc),QG6=YJ($c),WG6=YJ(Um),XG6=YJ(Wc,{},Kc,Qc),{sendMessage:KG6,getOneMessage:GG6,getEachMessage:zG6,getCancelSignal:HG6}=Jd();var Ec=t(Mc(),1);var XG=(Z)=>{if(typeof Z!=="string")throw new TypeError("invalid pattern");if(Z.length>65536)throw new TypeError("pattern is too long")};var rz1={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},KG=(Z)=>Z.replace(/[[\]\\-]/g,"\\$&"),tz1=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Rc=(Z)=>Z.join(""),Nc=(Z,J)=>{let $=J;if(Z.charAt($)!=="[")throw new Error("not in a brace expression");let Y=[],Q=[],W=$+1,X=!1,K=!1,G=!1,z=!1,H=$,V="";Z:while(W<Z.length){let w=Z.charAt(W);if((w==="!"||w==="^")&&W===$+1){z=!0,W++;continue}if(w==="]"&&X&&!G){H=W+1;break}if(X=!0,w==="\\"){if(!G){G=!0,W++;continue}}if(w==="["&&!G){for(let[L,[O,j,M]]of Object.entries(rz1))if(Z.startsWith(L,W)){if(V)return["$.",!1,Z.length-$,!0];if(W+=L.length,M)Q.push(O);else Y.push(O);K=K||j;continue Z}}if(G=!1,V){if(w>V)Y.push(KG(V)+"-"+KG(w));else if(w===V)Y.push(KG(w));V="",W++;continue}if(Z.startsWith("-]",W+1)){Y.push(KG(w+"-")),W+=2;continue}if(Z.startsWith("-",W+1)){V=w,W+=2;continue}Y.push(KG(w)),W++}if(H<W)return["",!1,0,!1];if(!Y.length&&!Q.length)return["$.",!1,Z.length-$,!0];if(Q.length===0&&Y.length===1&&/^\\?.$/.test(Y[0])&&!z){let w=Y[0].length===2?Y[0].slice(-1):Y[0];return[tz1(w),!1,H-$,!1]}let q="["+(z?"^":"")+Rc(Y)+"]",F="["+(z?"":"^")+Rc(Q)+"]";return[Y.length&&Q.length?"("+q+"|"+F+")":Y.length?q:F,K,H-$,!0]};var H4=(Z,{windowsPathsNoEscape:J=!1}={})=>{return J?Z.replace(/\[([^\/\\])\]/g,"$1"):Z.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var ez1=new Set(["!","?","+","*","@"]),Pc=(Z)=>ez1.has(Z),ZH1="(?!(?:^|/)\\.\\.?(?:$|/))",uU="(?!\\.)",JH1=new Set(["[","."]),$H1=new Set(["..","."]),YH1=new Set("().*{}+?[]^$\\!"),QH1=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),LP="[^/]",Dc=LP+"*?",Cc=LP+"+?";class U6{type;#Z;#J;#Y=!1;#$=[];#Q;#H;#q;#K=!1;#G;#z;#V=!1;constructor(Z,J,$={}){if(this.type=Z,Z)this.#J=!0;if(this.#Q=J,this.#Z=this.#Q?this.#Q.#Z:this,this.#G=this.#Z===this?$:this.#Z.#G,this.#q=this.#Z===this?[]:this.#Z.#q,Z==="!"&&!this.#Z.#K)this.#q.push(this);this.#H=this.#Q?this.#Q.#$.length:0}get hasMagic(){if(this.#J!==void 0)return this.#J;for(let Z of this.#$){if(typeof Z==="string")continue;if(Z.type||Z.hasMagic)return this.#J=!0}return this.#J}toString(){if(this.#z!==void 0)return this.#z;if(!this.type)return this.#z=this.#$.map((Z)=>String(Z)).join("");else return this.#z=this.type+"("+this.#$.map((Z)=>String(Z)).join("|")+")"}#W(){if(this!==this.#Z)throw new Error("should only call on root");if(this.#K)return this;this.toString(),this.#K=!0;let Z;while(Z=this.#q.pop()){if(Z.type!=="!")continue;let J=Z,$=J.#Q;while($){for(let Y=J.#H+1;!$.type&&Y<$.#$.length;Y++)for(let Q of Z.#$){if(typeof Q==="string")throw new Error("string part in extglob AST??");Q.copyIn($.#$[Y])}J=$,$=J.#Q}}return this}push(...Z){for(let J of Z){if(J==="")continue;if(typeof J!=="string"&&!(J instanceof U6&&J.#Q===this))throw new Error("invalid part: "+J);this.#$.push(J)}}toJSON(){let Z=this.type===null?this.#$.slice().map((J)=>typeof J==="string"?J:J.toJSON()):[this.type,...this.#$.map((J)=>J.toJSON())];if(this.isStart()&&!this.type)Z.unshift([]);if(this.isEnd()&&(this===this.#Z||this.#Z.#K&&this.#Q?.type==="!"))Z.push({});return Z}isStart(){if(this.#Z===this)return!0;if(!this.#Q?.isStart())return!1;if(this.#H===0)return!0;let Z=this.#Q;for(let J=0;J<this.#H;J++){let $=Z.#$[J];if(!($ instanceof U6&&$.type==="!"))return!1}return!0}isEnd(){if(this.#Z===this)return!0;if(this.#Q?.type==="!")return!0;if(!this.#Q?.isEnd())return!1;if(!this.type)return this.#Q?.isEnd();let Z=this.#Q?this.#Q.#$.length:0;return this.#H===Z-1}copyIn(Z){if(typeof Z==="string")this.push(Z);else this.push(Z.clone(this))}clone(Z){let J=new U6(this.type,Z);for(let $ of this.#$)J.copyIn($);return J}static#U(Z,J,$,Y){let Q=!1,W=!1,X=-1,K=!1;if(J.type===null){let q=$,F="";while(q<Z.length){let U=Z.charAt(q++);if(Q||U==="\\"){Q=!Q,F+=U;continue}if(W){if(q===X+1){if(U==="^"||U==="!")K=!0}else if(U==="]"&&!(q===X+2&&K))W=!1;F+=U;continue}else if(U==="["){W=!0,X=q,K=!1,F+=U;continue}if(!Y.noext&&Pc(U)&&Z.charAt(q)==="("){J.push(F),F="";let w=new U6(U,J);q=U6.#U(Z,w,q,Y),J.push(w);continue}F+=U}return J.push(F),q}let G=$+1,z=new U6(null,J),H=[],V="";while(G<Z.length){let q=Z.charAt(G++);if(Q||q==="\\"){Q=!Q,V+=q;continue}if(W){if(G===X+1){if(q==="^"||q==="!")K=!0}else if(q==="]"&&!(G===X+2&&K))W=!1;V+=q;continue}else if(q==="["){W=!0,X=G,K=!1,V+=q;continue}if(Pc(q)&&Z.charAt(G)==="("){z.push(V),V="";let F=new U6(q,z);z.push(F),G=U6.#U(Z,F,G,Y);continue}if(q==="|"){z.push(V),V="",H.push(z),z=new U6(null,J);continue}if(q===")"){if(V===""&&J.#$.length===0)J.#V=!0;return z.push(V),V="",J.push(...H,z),G}V+=q}return J.type=null,J.#J=void 0,J.#$=[Z.substring($-1)],G}static fromGlob(Z,J={}){let $=new U6(null,void 0,J);return U6.#U(Z,$,0,J),$}toMMPattern(){if(this!==this.#Z)return this.#Z.toMMPattern();let Z=this.toString(),[J,$,Y,Q]=this.toRegExpSource();if(!(Y||this.#J||this.#G.nocase&&!this.#G.nocaseMagicOnly&&Z.toUpperCase()!==Z.toLowerCase()))return $;let X=(this.#G.nocase?"i":"")+(Q?"u":"");return Object.assign(new RegExp(`^${J}$`,X),{_src:J,_glob:Z})}get options(){return this.#G}toRegExpSource(Z){let J=Z??!!this.#G.dot;if(this.#Z===this)this.#W();if(!this.type){let K=this.isStart()&&this.isEnd(),G=this.#$.map((q)=>{let[F,U,w,L]=typeof q==="string"?U6.#L(q,this.#J,K):q.toRegExpSource(Z);return this.#J=this.#J||w,this.#Y=this.#Y||L,F}).join(""),z="";if(this.isStart()){if(typeof this.#$[0]==="string"){if(!(this.#$.length===1&&$H1.has(this.#$[0]))){let F=JH1,U=J&&F.has(G.charAt(0))||G.startsWith("\\.")&&F.has(G.charAt(2))||G.startsWith("\\.\\.")&&F.has(G.charAt(4)),w=!J&&!Z&&F.has(G.charAt(0));z=U?ZH1:w?uU:""}}}let H="";if(this.isEnd()&&this.#Z.#K&&this.#Q?.type==="!")H="(?:$|\\/)";return[z+G+H,H4(G),this.#J=!!this.#J,this.#Y]}let $=this.type==="*"||this.type==="+",Y=this.type==="!"?"(?:(?!(?:":"(?:",Q=this.#w(J);if(this.isStart()&&this.isEnd()&&!Q&&this.type!=="!"){let K=this.toString();return this.#$=[K],this.type=null,this.#J=void 0,[K,H4(this.toString()),!1,!1]}let W=!$||Z||J||!uU?"":this.#w(!0);if(W===Q)W="";if(W)Q=`(?:${Q})(?:${W})*?`;let X="";if(this.type==="!"&&this.#V)X=(this.isStart()&&!J?uU:"")+Cc;else{let K=this.type==="!"?"))"+(this.isStart()&&!J&&!Z?uU:"")+Dc+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&W?")":this.type==="*"&&W?")?":`)${this.type}`;X=Y+Q+K}return[X,H4(Q),this.#J=!!this.#J,this.#Y]}#w(Z){return this.#$.map((J)=>{if(typeof J==="string")throw new Error("string type in extglob ast??");let[$,Y,Q,W]=J.toRegExpSource(Z);return this.#Y=this.#Y||W,$}).filter((J)=>!(this.isStart()&&this.isEnd())||!!J).join("|")}static#L(Z,J,$=!1){let Y=!1,Q="",W=!1;for(let X=0;X<Z.length;X++){let K=Z.charAt(X);if(Y){Y=!1,Q+=(YH1.has(K)?"\\":"")+K;continue}if(K==="\\"){if(X===Z.length-1)Q+="\\\\";else Y=!0;continue}if(K==="["){let[G,z,H,V]=Nc(Z,X);if(H){Q+=G,W=W||z,X+=H-1,J=J||V;continue}}if(K==="*"){if($&&Z==="*")Q+=Cc;else Q+=Dc;J=!0;continue}if(K==="?"){Q+=LP,J=!0;continue}Q+=QH1(K)}return[Q,H4(Z),!!J,W]}}var _W=(Z,{windowsPathsNoEscape:J=!1}={})=>{return J?Z.replace(/[?*()[\]]/g,"[$&]"):Z.replace(/[?*()[\]\\]/g,"\\$&")};var d6=(Z,J,$={})=>{if(XG(J),!$.nocomment&&J.charAt(0)==="#")return!1;return new U9(J,$).match(Z)},WH1=/^\*+([^+@!?\*\[\(]*)$/,XH1=(Z)=>(J)=>!J.startsWith(".")&&J.endsWith(Z),KH1=(Z)=>(J)=>J.endsWith(Z),GH1=(Z)=>{return Z=Z.toLowerCase(),(J)=>!J.startsWith(".")&&J.toLowerCase().endsWith(Z)},zH1=(Z)=>{return Z=Z.toLowerCase(),(J)=>J.toLowerCase().endsWith(Z)},HH1=/^\*+\.\*+$/,VH1=(Z)=>!Z.startsWith(".")&&Z.includes("."),qH1=(Z)=>Z!=="."&&Z!==".."&&Z.includes("."),FH1=/^\.\*+$/,UH1=(Z)=>Z!=="."&&Z!==".."&&Z.startsWith("."),LH1=/^\*+$/,wH1=(Z)=>Z.length!==0&&!Z.startsWith("."),BH1=(Z)=>Z.length!==0&&Z!=="."&&Z!=="..",OH1=/^\?+([^+@!?\*\[\(]*)?$/,jH1=([Z,J=""])=>{let $=Ic([Z]);if(!J)return $;return J=J.toLowerCase(),(Y)=>$(Y)&&Y.toLowerCase().endsWith(J)},MH1=([Z,J=""])=>{let $=vc([Z]);if(!J)return $;return J=J.toLowerCase(),(Y)=>$(Y)&&Y.toLowerCase().endsWith(J)},RH1=([Z,J=""])=>{let $=vc([Z]);return!J?$:(Y)=>$(Y)&&Y.endsWith(J)},NH1=([Z,J=""])=>{let $=Ic([Z]);return!J?$:(Y)=>$(Y)&&Y.endsWith(J)},Ic=([Z])=>{let J=Z.length;return($)=>$.length===J&&!$.startsWith(".")},vc=([Z])=>{let J=Z.length;return($)=>$.length===J&&$!=="."&&$!==".."},Sc=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Tc={win32:{sep:"\\"},posix:{sep:"/"}},PH1=Sc==="win32"?Tc.win32.sep:Tc.posix.sep;d6.sep=PH1;var L6=Symbol("globstar **");d6.GLOBSTAR=L6;var DH1="[^/]",CH1=DH1+"*?",TH1="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",kH1="(?:(?!(?:\\/|^)\\.).)*?",EH1=(Z,J={})=>($)=>d6($,Z,J);d6.filter=EH1;var F9=(Z,J={})=>Object.assign({},Z,J),IH1=(Z)=>{if(!Z||typeof Z!=="object"||!Object.keys(Z).length)return d6;let J=d6;return Object.assign((Y,Q,W={})=>J(Y,Q,F9(Z,W)),{Minimatch:class Y extends J.Minimatch{constructor(Q,W={}){super(Q,F9(Z,W))}static defaults(Q){return J.defaults(F9(Z,Q)).Minimatch}},AST:class Y extends J.AST{constructor(Q,W,X={}){super(Q,W,F9(Z,X))}static fromGlob(Q,W={}){return J.AST.fromGlob(Q,F9(Z,W))}},unescape:(Y,Q={})=>J.unescape(Y,F9(Z,Q)),escape:(Y,Q={})=>J.escape(Y,F9(Z,Q)),filter:(Y,Q={})=>J.filter(Y,F9(Z,Q)),defaults:(Y)=>J.defaults(F9(Z,Y)),makeRe:(Y,Q={})=>J.makeRe(Y,F9(Z,Q)),braceExpand:(Y,Q={})=>J.braceExpand(Y,F9(Z,Q)),match:(Y,Q,W={})=>J.match(Y,Q,F9(Z,W)),sep:J.sep,GLOBSTAR:L6})};d6.defaults=IH1;var _c=(Z,J={})=>{if(XG(Z),J.nobrace||!/\{(?:(?!\{).)*\}/.test(Z))return[Z];return Ec.default(Z)};d6.braceExpand=_c;var vH1=(Z,J={})=>new U9(Z,J).makeRe();d6.makeRe=vH1;var SH1=(Z,J,$={})=>{let Y=new U9(J,$);if(Z=Z.filter((Q)=>Y.match(Q)),Y.options.nonull&&!Z.length)Z.push(J);return Z};d6.match=SH1;var kc=/[?*]|[+@!]\(.*?\)|\[|\]/,_H1=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class U9{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(Z,J={}){if(XG(Z),J=J||{},this.options=J,this.pattern=Z,this.platform=J.platform||Sc,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!J.windowsPathsNoEscape||J.allowWindowsEscape===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!J.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!J.nonegate,this.comment=!1,this.empty=!1,this.partial=!!J.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=J.windowsNoMagicRoot!==void 0?J.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let Z of this.set)for(let J of Z)if(typeof J!=="string")return!0;return!1}debug(...Z){}make(){let Z=this.pattern,J=this.options;if(!J.nocomment&&Z.charAt(0)==="#"){this.comment=!0;return}if(!Z){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],J.debug)this.debug=(...Q)=>console.error(...Q);this.debug(this.pattern,this.globSet);let $=this.globSet.map((Q)=>this.slashSplit(Q));this.globParts=this.preprocess($),this.debug(this.pattern,this.globParts);let Y=this.globParts.map((Q,W,X)=>{if(this.isWindows&&this.windowsNoMagicRoot){let K=Q[0]===""&&Q[1]===""&&(Q[2]==="?"||!kc.test(Q[2]))&&!kc.test(Q[3]),G=/^[a-z]:/i.test(Q[0]);if(K)return[...Q.slice(0,4),...Q.slice(4).map((z)=>this.parse(z))];else if(G)return[Q[0],...Q.slice(1).map((z)=>this.parse(z))]}return Q.map((K)=>this.parse(K))});if(this.debug(this.pattern,Y),this.set=Y.filter((Q)=>Q.indexOf(!1)===-1),this.isWindows)for(let Q=0;Q<this.set.length;Q++){let W=this.set[Q];if(W[0]===""&&W[1]===""&&this.globParts[Q][2]==="?"&&typeof W[3]==="string"&&/^[a-z]:$/i.test(W[3]))W[2]="?"}this.debug(this.pattern,this.set)}preprocess(Z){if(this.options.noglobstar){for(let $=0;$<Z.length;$++)for(let Y=0;Y<Z[$].length;Y++)if(Z[$][Y]==="**")Z[$][Y]="*"}let{optimizationLevel:J=1}=this.options;if(J>=2)Z=this.firstPhasePreProcess(Z),Z=this.secondPhasePreProcess(Z);else if(J>=1)Z=this.levelOneOptimize(Z);else Z=this.adjascentGlobstarOptimize(Z);return Z}adjascentGlobstarOptimize(Z){return Z.map((J)=>{let $=-1;while(($=J.indexOf("**",$+1))!==-1){let Y=$;while(J[Y+1]==="**")Y++;if(Y!==$)J.splice($,Y-$)}return J})}levelOneOptimize(Z){return Z.map((J)=>{return J=J.reduce(($,Y)=>{let Q=$[$.length-1];if(Y==="**"&&Q==="**")return $;if(Y===".."){if(Q&&Q!==".."&&Q!=="."&&Q!=="**")return $.pop(),$}return $.push(Y),$},[]),J.length===0?[""]:J})}levelTwoFileOptimize(Z){if(!Array.isArray(Z))Z=this.slashSplit(Z);let J=!1;do{if(J=!1,!this.preserveMultipleSlashes){for(let Y=1;Y<Z.length-1;Y++){let Q=Z[Y];if(Y===1&&Q===""&&Z[0]==="")continue;if(Q==="."||Q==="")J=!0,Z.splice(Y,1),Y--}if(Z[0]==="."&&Z.length===2&&(Z[1]==="."||Z[1]===""))J=!0,Z.pop()}let $=0;while(($=Z.indexOf("..",$+1))!==-1){let Y=Z[$-1];if(Y&&Y!=="."&&Y!==".."&&Y!=="**")J=!0,Z.splice($-1,2),$-=2}}while(J);return Z.length===0?[""]:Z}firstPhasePreProcess(Z){let J=!1;do{J=!1;for(let $ of Z){let Y=-1;while((Y=$.indexOf("**",Y+1))!==-1){let W=Y;while($[W+1]==="**")W++;if(W>Y)$.splice(Y+1,W-Y);let X=$[Y+1],K=$[Y+2],G=$[Y+3];if(X!=="..")continue;if(!K||K==="."||K===".."||!G||G==="."||G==="..")continue;J=!0,$.splice(Y,1);let z=$.slice(0);z[Y]="**",Z.push(z),Y--}if(!this.preserveMultipleSlashes){for(let W=1;W<$.length-1;W++){let X=$[W];if(W===1&&X===""&&$[0]==="")continue;if(X==="."||X==="")J=!0,$.splice(W,1),W--}if($[0]==="."&&$.length===2&&($[1]==="."||$[1]===""))J=!0,$.pop()}let Q=0;while((Q=$.indexOf("..",Q+1))!==-1){let W=$[Q-1];if(W&&W!=="."&&W!==".."&&W!=="**"){J=!0;let K=Q===1&&$[Q+1]==="**"?["."]:[];if($.splice(Q-1,2,...K),$.length===0)$.push("");Q-=2}}}}while(J);return Z}secondPhasePreProcess(Z){for(let J=0;J<Z.length-1;J++)for(let $=J+1;$<Z.length;$++){let Y=this.partsMatch(Z[J],Z[$],!this.preserveMultipleSlashes);if(Y){Z[J]=[],Z[$]=Y;break}}return Z.filter((J)=>J.length)}partsMatch(Z,J,$=!1){let Y=0,Q=0,W=[],X="";while(Y<Z.length&&Q<J.length)if(Z[Y]===J[Q])W.push(X==="b"?J[Q]:Z[Y]),Y++,Q++;else if($&&Z[Y]==="**"&&J[Q]===Z[Y+1])W.push(Z[Y]),Y++;else if($&&J[Q]==="**"&&Z[Y]===J[Q+1])W.push(J[Q]),Q++;else if(Z[Y]==="*"&&J[Q]&&(this.options.dot||!J[Q].startsWith("."))&&J[Q]!=="**"){if(X==="b")return!1;X="a",W.push(Z[Y]),Y++,Q++}else if(J[Q]==="*"&&Z[Y]&&(this.options.dot||!Z[Y].startsWith("."))&&Z[Y]!=="**"){if(X==="a")return!1;X="b",W.push(J[Q]),Y++,Q++}else return!1;return Z.length===J.length&&W}parseNegate(){if(this.nonegate)return;let Z=this.pattern,J=!1,$=0;for(let Y=0;Y<Z.length&&Z.charAt(Y)==="!";Y++)J=!J,$++;if($)this.pattern=Z.slice($);this.negate=J}matchOne(Z,J,$=!1){let Y=this.options;if(this.isWindows){let U=typeof Z[0]==="string"&&/^[a-z]:$/i.test(Z[0]),w=!U&&Z[0]===""&&Z[1]===""&&Z[2]==="?"&&/^[a-z]:$/i.test(Z[3]),L=typeof J[0]==="string"&&/^[a-z]:$/i.test(J[0]),O=!L&&J[0]===""&&J[1]===""&&J[2]==="?"&&typeof J[3]==="string"&&/^[a-z]:$/i.test(J[3]),j=w?3:U?0:void 0,M=O?3:L?0:void 0;if(typeof j==="number"&&typeof M==="number"){let[N,D]=[Z[j],J[M]];if(N.toLowerCase()===D.toLowerCase()){if(J[M]=N,M>j)J=J.slice(M);else if(j>M)Z=Z.slice(j)}}}let{optimizationLevel:Q=1}=this.options;if(Q>=2)Z=this.levelTwoFileOptimize(Z);this.debug("matchOne",this,{file:Z,pattern:J}),this.debug("matchOne",Z.length,J.length);for(var W=0,X=0,K=Z.length,G=J.length;W<K&&X<G;W++,X++){this.debug("matchOne loop");var z=J[X],H=Z[W];if(this.debug(J,z,H),z===!1)return!1;if(z===L6){this.debug("GLOBSTAR",[J,z,H]);var V=W,q=X+1;if(q===G){this.debug("** at the end");for(;W<K;W++)if(Z[W]==="."||Z[W]===".."||!Y.dot&&Z[W].charAt(0)===".")return!1;return!0}while(V<K){var F=Z[V];if(this.debug(`
|
405
405
|
globstar while`,Z,V,J,q,F),this.matchOne(Z.slice(V),J.slice(q),$))return this.debug("globstar found match!",V,K,F),!0;else{if(F==="."||F===".."||!Y.dot&&F.charAt(0)==="."){this.debug("dot detected!",Z,V,J,q);break}this.debug("globstar swallow a segment, and continue"),V++}}if($){if(this.debug(`
|
406
406
|
>>> no match, partial?`,Z,V,J,q),V===K)return!0}return!1}let U;if(typeof z==="string")U=H===z,this.debug("string match",z,H,U);else U=z.test(H),this.debug("pattern match",z,H,U);if(!U)return!1}if(W===K&&X===G)return!0;else if(W===K)return $;else if(X===G)return W===K-1&&Z[W]==="";else throw new Error("wtf?")}braceExpand(){return _c(this.pattern,this.options)}parse(Z){XG(Z);let J=this.options;if(Z==="**")return L6;if(Z==="")return"";let $,Y=null;if($=Z.match(LH1))Y=J.dot?BH1:wH1;else if($=Z.match(WH1))Y=(J.nocase?J.dot?zH1:GH1:J.dot?KH1:XH1)($[1]);else if($=Z.match(OH1))Y=(J.nocase?J.dot?MH1:jH1:J.dot?RH1:NH1)($);else if($=Z.match(HH1))Y=J.dot?qH1:VH1;else if($=Z.match(FH1))Y=UH1;let Q=U6.fromGlob(Z,this.options).toMMPattern();if(Y&&typeof Q==="object")Reflect.defineProperty(Q,"test",{value:Y});return Q}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Z=this.set;if(!Z.length)return this.regexp=!1,this.regexp;let J=this.options,$=J.noglobstar?CH1:J.dot?TH1:kH1,Y=new Set(J.nocase?["i"]:[]),Q=Z.map((K)=>{let G=K.map((z)=>{if(z instanceof RegExp)for(let H of z.flags.split(""))Y.add(H);return typeof z==="string"?_H1(z):z===L6?L6:z._src});return G.forEach((z,H)=>{let V=G[H+1],q=G[H-1];if(z!==L6||q===L6)return;if(q===void 0)if(V!==void 0&&V!==L6)G[H+1]="(?:\\/|"+$+"\\/)?"+V;else G[H]=$;else if(V===void 0)G[H-1]=q+"(?:\\/|"+$+")?";else if(V!==L6)G[H-1]=q+"(?:\\/|\\/"+$+"\\/)"+V,G[H+1]=L6}),G.filter((z)=>z!==L6).join("/")}).join("|"),[W,X]=Z.length>1?["(?:",")"]:["",""];if(Q="^"+W+Q+X+"$",this.negate)Q="^(?!"+Q+").+$";try{this.regexp=new RegExp(Q,[...Y].join(""))}catch(K){this.regexp=!1}return this.regexp}slashSplit(Z){if(this.preserveMultipleSlashes)return Z.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(Z))return["",...Z.split(/\/+/)];else return Z.split(/\/+/)}match(Z,J=this.partial){if(this.debug("match",Z,this.pattern),this.comment)return!1;if(this.empty)return Z==="";if(Z==="/"&&J)return!0;let $=this.options;if(this.isWindows)Z=Z.split("\\").join("/");let Y=this.slashSplit(Z);this.debug(this.pattern,"split",Y);let Q=this.set;this.debug(this.pattern,"set",Q);let W=Y[Y.length-1];if(!W)for(let X=Y.length-2;!W&&X>=0;X--)W=Y[X];for(let X=0;X<Q.length;X++){let K=Q[X],G=Y;if($.matchBase&&K.length===1)G=[W];if(this.matchOne(G,K,J)){if($.flipNegate)return!0;return!this.negate}}if($.flipNegate)return!1;return this.negate}static defaults(Z){return d6.defaults(Z).Minimatch}}d6.AST=U6;d6.Minimatch=U9;d6.escape=_W;d6.unescape=H4;import{fileURLToPath as HV1}from"url";var AW=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,xc=new Set,wP=typeof process==="object"&&!!process?process:{},hc=(Z,J,$,Y)=>{typeof wP.emitWarning==="function"?wP.emitWarning(Z,J,$,Y):console.error(`[${$}] ${J}: ${Z}`)},dU=globalThis.AbortController,Ac=globalThis.AbortSignal;if(typeof dU==="undefined"){Ac=class ${onabort;_onabort=[];reason;aborted=!1;addEventListener(Y,Q){this._onabort.push(Q)}},dU=class ${constructor(){J()}signal=new Ac;abort(Y){if(this.signal.aborted)return;this.signal.reason=Y,this.signal.aborted=!0;for(let Q of this.signal._onabort)Q(Y);this.signal.onabort?.(Y)}};let Z=wP.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",J=()=>{if(!Z)return;Z=!1,hc("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",J)}}var AH1=(Z)=>!xc.has(Z),IG6=Symbol("type"),QJ=(Z)=>Z&&Z===Math.floor(Z)&&Z>0&&isFinite(Z),fc=(Z)=>!QJ(Z)?null:Z<=Math.pow(2,8)?Uint8Array:Z<=Math.pow(2,16)?Uint16Array:Z<=Math.pow(2,32)?Uint32Array:Z<=Number.MAX_SAFE_INTEGER?GG:null;class GG extends Array{constructor(Z){super(Z);this.fill(0)}}class xW{heap;length;static#Z=!1;static create(Z){let J=fc(Z);if(!J)return[];xW.#Z=!0;let $=new xW(Z,J);return xW.#Z=!1,$}constructor(Z,J){if(!xW.#Z)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new J(Z),this.length=0}push(Z){this.heap[this.length++]=Z}pop(){return this.heap[--this.length]}}class zG{#Z;#J;#Y;#$;#Q;#H;#q;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#K;#G;#z;#V;#W;#U;#w;#L;#O;#k;#j;#E;#N;#R;#M;#C;#B;#v;static unsafeExposeInternals(Z){return{starts:Z.#N,ttls:Z.#R,sizes:Z.#E,keyMap:Z.#z,keyList:Z.#V,valList:Z.#W,next:Z.#U,prev:Z.#w,get head(){return Z.#L},get tail(){return Z.#O},free:Z.#k,isBackgroundFetch:(J)=>Z.#F(J),backgroundFetch:(J,$,Y,Q)=>Z.#h(J,$,Y,Q),moveToTail:(J)=>Z.#y(J),indexes:(J)=>Z.#T(J),rindexes:(J)=>Z.#I(J),isStale:(J)=>Z.#D(J)}}get max(){return this.#Z}get maxSize(){return this.#J}get calculatedSize(){return this.#G}get size(){return this.#K}get fetchMethod(){return this.#H}get memoMethod(){return this.#q}get dispose(){return this.#Y}get onInsert(){return this.#$}get disposeAfter(){return this.#Q}constructor(Z){let{max:J=0,ttl:$,ttlResolution:Y=1,ttlAutopurge:Q,updateAgeOnGet:W,updateAgeOnHas:X,allowStale:K,dispose:G,onInsert:z,disposeAfter:H,noDisposeOnSet:V,noUpdateTTL:q,maxSize:F=0,maxEntrySize:U=0,sizeCalculation:w,fetchMethod:L,memoMethod:O,noDeleteOnFetchRejection:j,noDeleteOnStaleGet:M,allowStaleOnFetchRejection:N,allowStaleOnFetchAbort:D,ignoreFetchAbort:P}=Z;if(J!==0&&!QJ(J))throw new TypeError("max option must be a nonnegative integer");let C=J?fc(J):Array;if(!C)throw new Error("invalid max value: "+J);if(this.#Z=J,this.#J=F,this.maxEntrySize=U||this.#J,this.sizeCalculation=w,this.sizeCalculation){if(!this.#J&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw new TypeError("sizeCalculation set to non-function")}if(O!==void 0&&typeof O!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#q=O,L!==void 0&&typeof L!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#H=L,this.#C=!!L,this.#z=new Map,this.#V=new Array(J).fill(void 0),this.#W=new Array(J).fill(void 0),this.#U=new C(J),this.#w=new C(J),this.#L=0,this.#O=0,this.#k=xW.create(J),this.#K=0,this.#G=0,typeof G==="function")this.#Y=G;if(typeof z==="function")this.#$=z;if(typeof H==="function")this.#Q=H,this.#j=[];else this.#Q=void 0,this.#j=void 0;if(this.#M=!!this.#Y,this.#v=!!this.#$,this.#B=!!this.#Q,this.noDisposeOnSet=!!V,this.noUpdateTTL=!!q,this.noDeleteOnFetchRejection=!!j,this.allowStaleOnFetchRejection=!!N,this.allowStaleOnFetchAbort=!!D,this.ignoreFetchAbort=!!P,this.maxEntrySize!==0){if(this.#J!==0){if(!QJ(this.#J))throw new TypeError("maxSize must be a positive integer if specified")}if(!QJ(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#m()}if(this.allowStale=!!K,this.noDeleteOnStaleGet=!!M,this.updateAgeOnGet=!!W,this.updateAgeOnHas=!!X,this.ttlResolution=QJ(Y)||Y===0?Y:1,this.ttlAutopurge=!!Q,this.ttl=$||0,this.ttl){if(!QJ(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#X()}if(this.#Z===0&&this.ttl===0&&this.#J===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Z&&!this.#J){if(AH1("LRU_CACHE_UNBOUNDED"))xc.add("LRU_CACHE_UNBOUNDED"),hc("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",zG)}}getRemainingTTL(Z){return this.#z.has(Z)?1/0:0}#X(){let Z=new GG(this.#Z),J=new GG(this.#Z);this.#R=Z,this.#N=J,this.#S=(Q,W,X=AW.now())=>{if(J[Q]=W!==0?X:0,Z[Q]=W,W!==0&&this.ttlAutopurge){let K=setTimeout(()=>{if(this.#D(Q))this.#_(this.#V[Q],"expire")},W+1);if(K.unref)K.unref()}},this.#A=(Q)=>{J[Q]=Z[Q]!==0?AW.now():0},this.#P=(Q,W)=>{if(Z[W]){let X=Z[W],K=J[W];if(!X||!K)return;Q.ttl=X,Q.start=K,Q.now=$||Y();let G=Q.now-K;Q.remainingTTL=X-G}};let $=0,Y=()=>{let Q=AW.now();if(this.ttlResolution>0){$=Q;let W=setTimeout(()=>$=0,this.ttlResolution);if(W.unref)W.unref()}return Q};this.getRemainingTTL=(Q)=>{let W=this.#z.get(Q);if(W===void 0)return 0;let X=Z[W],K=J[W];if(!X||!K)return 1/0;let G=($||Y())-K;return X-G},this.#D=(Q)=>{let W=J[Q],X=Z[Q];return!!X&&!!W&&($||Y())-W>X}}#A=()=>{};#P=()=>{};#S=()=>{};#D=()=>!1;#m(){let Z=new GG(this.#Z);this.#G=0,this.#E=Z,this.#x=(J)=>{this.#G-=Z[J],Z[J]=0},this.#u=(J,$,Y,Q)=>{if(this.#F($))return 0;if(!QJ(Y))if(Q){if(typeof Q!=="function")throw new TypeError("sizeCalculation must be a function");if(Y=Q($,J),!QJ(Y))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return Y},this.#f=(J,$,Y)=>{if(Z[J]=$,this.#J){let Q=this.#J-Z[J];while(this.#G>Q)this.#b(!0)}if(this.#G+=Z[J],Y)Y.entrySize=$,Y.totalCalculatedSize=this.#G}}#x=(Z)=>{};#f=(Z,J,$)=>{};#u=(Z,J,$,Y)=>{if($||Y)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:Z=this.allowStale}={}){if(this.#K)for(let J=this.#O;;){if(!this.#d(J))break;if(Z||!this.#D(J))yield J;if(J===this.#L)break;else J=this.#w[J]}}*#I({allowStale:Z=this.allowStale}={}){if(this.#K)for(let J=this.#L;;){if(!this.#d(J))break;if(Z||!this.#D(J))yield J;if(J===this.#O)break;else J=this.#U[J]}}#d(Z){return Z!==void 0&&this.#z.get(this.#V[Z])===Z}*entries(){for(let Z of this.#T())if(this.#W[Z]!==void 0&&this.#V[Z]!==void 0&&!this.#F(this.#W[Z]))yield[this.#V[Z],this.#W[Z]]}*rentries(){for(let Z of this.#I())if(this.#W[Z]!==void 0&&this.#V[Z]!==void 0&&!this.#F(this.#W[Z]))yield[this.#V[Z],this.#W[Z]]}*keys(){for(let Z of this.#T()){let J=this.#V[Z];if(J!==void 0&&!this.#F(this.#W[Z]))yield J}}*rkeys(){for(let Z of this.#I()){let J=this.#V[Z];if(J!==void 0&&!this.#F(this.#W[Z]))yield J}}*values(){for(let Z of this.#T())if(this.#W[Z]!==void 0&&!this.#F(this.#W[Z]))yield this.#W[Z]}*rvalues(){for(let Z of this.#I())if(this.#W[Z]!==void 0&&!this.#F(this.#W[Z]))yield this.#W[Z]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(Z,J={}){for(let $ of this.#T()){let Y=this.#W[$],Q=this.#F(Y)?Y.__staleWhileFetching:Y;if(Q===void 0)continue;if(Z(Q,this.#V[$],this))return this.get(this.#V[$],J)}}forEach(Z,J=this){for(let $ of this.#T()){let Y=this.#W[$],Q=this.#F(Y)?Y.__staleWhileFetching:Y;if(Q===void 0)continue;Z.call(J,Q,this.#V[$],this)}}rforEach(Z,J=this){for(let $ of this.#I()){let Y=this.#W[$],Q=this.#F(Y)?Y.__staleWhileFetching:Y;if(Q===void 0)continue;Z.call(J,Q,this.#V[$],this)}}purgeStale(){let Z=!1;for(let J of this.#I({allowStale:!0}))if(this.#D(J))this.#_(this.#V[J],"expire"),Z=!0;return Z}info(Z){let J=this.#z.get(Z);if(J===void 0)return;let $=this.#W[J],Y=this.#F($)?$.__staleWhileFetching:$;if(Y===void 0)return;let Q={value:Y};if(this.#R&&this.#N){let W=this.#R[J],X=this.#N[J];if(W&&X){let K=W-(AW.now()-X);Q.ttl=K,Q.start=Date.now()}}if(this.#E)Q.size=this.#E[J];return Q}dump(){let Z=[];for(let J of this.#T({allowStale:!0})){let $=this.#V[J],Y=this.#W[J],Q=this.#F(Y)?Y.__staleWhileFetching:Y;if(Q===void 0||$===void 0)continue;let W={value:Q};if(this.#R&&this.#N){W.ttl=this.#R[J];let X=AW.now()-this.#N[J];W.start=Math.floor(Date.now()-X)}if(this.#E)W.size=this.#E[J];Z.unshift([$,W])}return Z}load(Z){this.clear();for(let[J,$]of Z){if($.start){let Y=Date.now()-$.start;$.start=AW.now()-Y}this.set(J,$.value,$)}}set(Z,J,$={}){if(J===void 0)return this.delete(Z),this;let{ttl:Y=this.ttl,start:Q,noDisposeOnSet:W=this.noDisposeOnSet,sizeCalculation:X=this.sizeCalculation,status:K}=$,{noUpdateTTL:G=this.noUpdateTTL}=$,z=this.#u(Z,J,$.size||0,X);if(this.maxEntrySize&&z>this.maxEntrySize){if(K)K.set="miss",K.maxEntrySizeExceeded=!0;return this.#_(Z,"set"),this}let H=this.#K===0?void 0:this.#z.get(Z);if(H===void 0){if(H=this.#K===0?this.#O:this.#k.length!==0?this.#k.pop():this.#K===this.#Z?this.#b(!1):this.#K,this.#V[H]=Z,this.#W[H]=J,this.#z.set(Z,H),this.#U[this.#O]=H,this.#w[H]=this.#O,this.#O=H,this.#K++,this.#f(H,z,K),K)K.set="add";if(G=!1,this.#v)this.#$?.(J,Z,"add")}else{this.#y(H);let V=this.#W[H];if(J!==V){if(this.#C&&this.#F(V)){V.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:q}=V;if(q!==void 0&&!W){if(this.#M)this.#Y?.(q,Z,"set");if(this.#B)this.#j?.push([q,Z,"set"])}}else if(!W){if(this.#M)this.#Y?.(V,Z,"set");if(this.#B)this.#j?.push([V,Z,"set"])}if(this.#x(H),this.#f(H,z,K),this.#W[H]=J,K){K.set="replace";let q=V&&this.#F(V)?V.__staleWhileFetching:V;if(q!==void 0)K.oldValue=q}}else if(K)K.set="update";if(this.#v)this.onInsert?.(J,Z,J===V?"update":"replace")}if(Y!==0&&!this.#R)this.#X();if(this.#R){if(!G)this.#S(H,Y,Q);if(K)this.#P(K,H)}if(!W&&this.#B&&this.#j){let V=this.#j,q;while(q=V?.shift())this.#Q?.(...q)}return this}pop(){try{while(this.#K){let Z=this.#W[this.#L];if(this.#b(!0),this.#F(Z)){if(Z.__staleWhileFetching)return Z.__staleWhileFetching}else if(Z!==void 0)return Z}}finally{if(this.#B&&this.#j){let Z=this.#j,J;while(J=Z?.shift())this.#Q?.(...J)}}}#b(Z){let J=this.#L,$=this.#V[J],Y=this.#W[J];if(this.#C&&this.#F(Y))Y.__abortController.abort(new Error("evicted"));else if(this.#M||this.#B){if(this.#M)this.#Y?.(Y,$,"evict");if(this.#B)this.#j?.push([Y,$,"evict"])}if(this.#x(J),Z)this.#V[J]=void 0,this.#W[J]=void 0,this.#k.push(J);if(this.#K===1)this.#L=this.#O=0,this.#k.length=0;else this.#L=this.#U[J];return this.#z.delete($),this.#K--,J}has(Z,J={}){let{updateAgeOnHas:$=this.updateAgeOnHas,status:Y}=J,Q=this.#z.get(Z);if(Q!==void 0){let W=this.#W[Q];if(this.#F(W)&&W.__staleWhileFetching===void 0)return!1;if(!this.#D(Q)){if($)this.#A(Q);if(Y)Y.has="hit",this.#P(Y,Q);return!0}else if(Y)Y.has="stale",this.#P(Y,Q)}else if(Y)Y.has="miss";return!1}peek(Z,J={}){let{allowStale:$=this.allowStale}=J,Y=this.#z.get(Z);if(Y===void 0||!$&&this.#D(Y))return;let Q=this.#W[Y];return this.#F(Q)?Q.__staleWhileFetching:Q}#h(Z,J,$,Y){let Q=J===void 0?void 0:this.#W[J];if(this.#F(Q))return Q;let W=new dU,{signal:X}=$;X?.addEventListener("abort",()=>W.abort(X.reason),{signal:W.signal});let K={signal:W.signal,options:$,context:Y},G=(U,w=!1)=>{let{aborted:L}=W.signal,O=$.ignoreFetchAbort&&U!==void 0;if($.status)if(L&&!w){if($.status.fetchAborted=!0,$.status.fetchError=W.signal.reason,O)$.status.fetchAbortIgnored=!0}else $.status.fetchResolved=!0;if(L&&!O&&!w)return H(W.signal.reason);let j=q;if(this.#W[J]===q)if(U===void 0)if(j.__staleWhileFetching)this.#W[J]=j.__staleWhileFetching;else this.#_(Z,"fetch");else{if($.status)$.status.fetchUpdated=!0;this.set(Z,U,K.options)}return U},z=(U)=>{if($.status)$.status.fetchRejected=!0,$.status.fetchError=U;return H(U)},H=(U)=>{let{aborted:w}=W.signal,L=w&&$.allowStaleOnFetchAbort,O=L||$.allowStaleOnFetchRejection,j=O||$.noDeleteOnFetchRejection,M=q;if(this.#W[J]===q){if(!j||M.__staleWhileFetching===void 0)this.#_(Z,"fetch");else if(!L)this.#W[J]=M.__staleWhileFetching}if(O){if($.status&&M.__staleWhileFetching!==void 0)$.status.returnedStale=!0;return M.__staleWhileFetching}else if(M.__returned===M)throw U},V=(U,w)=>{let L=this.#H?.(Z,Q,K);if(L&&L instanceof Promise)L.then((O)=>U(O===void 0?void 0:O),w);W.signal.addEventListener("abort",()=>{if(!$.ignoreFetchAbort||$.allowStaleOnFetchAbort){if(U(void 0),$.allowStaleOnFetchAbort)U=(O)=>G(O,!0)}})};if($.status)$.status.fetchDispatched=!0;let q=new Promise(V).then(G,z),F=Object.assign(q,{__abortController:W,__staleWhileFetching:Q,__returned:void 0});if(J===void 0)this.set(Z,F,{...K.options,status:void 0}),J=this.#z.get(Z);else this.#W[J]=F;return F}#F(Z){if(!this.#C)return!1;let J=Z;return!!J&&J instanceof Promise&&J.hasOwnProperty("__staleWhileFetching")&&J.__abortController instanceof dU}async fetch(Z,J={}){let{allowStale:$=this.allowStale,updateAgeOnGet:Y=this.updateAgeOnGet,noDeleteOnStaleGet:Q=this.noDeleteOnStaleGet,ttl:W=this.ttl,noDisposeOnSet:X=this.noDisposeOnSet,size:K=0,sizeCalculation:G=this.sizeCalculation,noUpdateTTL:z=this.noUpdateTTL,noDeleteOnFetchRejection:H=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:V=this.allowStaleOnFetchRejection,ignoreFetchAbort:q=this.ignoreFetchAbort,allowStaleOnFetchAbort:F=this.allowStaleOnFetchAbort,context:U,forceRefresh:w=!1,status:L,signal:O}=J;if(!this.#C){if(L)L.fetch="get";return this.get(Z,{allowStale:$,updateAgeOnGet:Y,noDeleteOnStaleGet:Q,status:L})}let j={allowStale:$,updateAgeOnGet:Y,noDeleteOnStaleGet:Q,ttl:W,noDisposeOnSet:X,size:K,sizeCalculation:G,noUpdateTTL:z,noDeleteOnFetchRejection:H,allowStaleOnFetchRejection:V,allowStaleOnFetchAbort:F,ignoreFetchAbort:q,status:L,signal:O},M=this.#z.get(Z);if(M===void 0){if(L)L.fetch="miss";let N=this.#h(Z,M,j,U);return N.__returned=N}else{let N=this.#W[M];if(this.#F(N)){let E=$&&N.__staleWhileFetching!==void 0;if(L){if(L.fetch="inflight",E)L.returnedStale=!0}return E?N.__staleWhileFetching:N.__returned=N}let D=this.#D(M);if(!w&&!D){if(L)L.fetch="hit";if(this.#y(M),Y)this.#A(M);if(L)this.#P(L,M);return N}let P=this.#h(Z,M,j,U),T=P.__staleWhileFetching!==void 0&&$;if(L){if(L.fetch=D?"stale":"refresh",T&&D)L.returnedStale=!0}return T?P.__staleWhileFetching:P.__returned=P}}async forceFetch(Z,J={}){let $=await this.fetch(Z,J);if($===void 0)throw new Error("fetch() returned undefined");return $}memo(Z,J={}){let $=this.#q;if(!$)throw new Error("no memoMethod provided to constructor");let{context:Y,forceRefresh:Q,...W}=J,X=this.get(Z,W);if(!Q&&X!==void 0)return X;let K=$(Z,X,{options:W,context:Y});return this.set(Z,K,W),K}get(Z,J={}){let{allowStale:$=this.allowStale,updateAgeOnGet:Y=this.updateAgeOnGet,noDeleteOnStaleGet:Q=this.noDeleteOnStaleGet,status:W}=J,X=this.#z.get(Z);if(X!==void 0){let K=this.#W[X],G=this.#F(K);if(W)this.#P(W,X);if(this.#D(X)){if(W)W.get="stale";if(!G){if(!Q)this.#_(Z,"expire");if(W&&$)W.returnedStale=!0;return $?K:void 0}else{if(W&&$&&K.__staleWhileFetching!==void 0)W.returnedStale=!0;return $?K.__staleWhileFetching:void 0}}else{if(W)W.get="hit";if(G)return K.__staleWhileFetching;if(this.#y(X),Y)this.#A(X);return K}}else if(W)W.get="miss"}#c(Z,J){this.#w[J]=Z,this.#U[Z]=J}#y(Z){if(Z!==this.#O){if(Z===this.#L)this.#L=this.#U[Z];else this.#c(this.#w[Z],this.#U[Z]);this.#c(this.#O,Z),this.#O=Z}}delete(Z){return this.#_(Z,"delete")}#_(Z,J){let $=!1;if(this.#K!==0){let Y=this.#z.get(Z);if(Y!==void 0)if($=!0,this.#K===1)this.#g(J);else{this.#x(Y);let Q=this.#W[Y];if(this.#F(Q))Q.__abortController.abort(new Error("deleted"));else if(this.#M||this.#B){if(this.#M)this.#Y?.(Q,Z,J);if(this.#B)this.#j?.push([Q,Z,J])}if(this.#z.delete(Z),this.#V[Y]=void 0,this.#W[Y]=void 0,Y===this.#O)this.#O=this.#w[Y];else if(Y===this.#L)this.#L=this.#U[Y];else{let W=this.#w[Y];this.#U[W]=this.#U[Y];let X=this.#U[Y];this.#w[X]=this.#w[Y]}this.#K--,this.#k.push(Y)}}if(this.#B&&this.#j?.length){let Y=this.#j,Q;while(Q=Y?.shift())this.#Q?.(...Q)}return $}clear(){return this.#g("delete")}#g(Z){for(let J of this.#I({allowStale:!0})){let $=this.#W[J];if(this.#F($))$.__abortController.abort(new Error("deleted"));else{let Y=this.#V[J];if(this.#M)this.#Y?.($,Y,Z);if(this.#B)this.#j?.push([$,Y,Z])}}if(this.#z.clear(),this.#W.fill(void 0),this.#V.fill(void 0),this.#R&&this.#N)this.#R.fill(0),this.#N.fill(0);if(this.#E)this.#E.fill(0);if(this.#L=0,this.#O=0,this.#k.length=0,this.#G=0,this.#K=0,this.#B&&this.#j){let J=this.#j,$;while($=J?.shift())this.#Q?.(...$)}}}import{posix as lH1,win32 as TP}from"path";import{fileURLToPath as pH1}from"url";import{lstatSync as iH1,readdir as nH1,readdirSync as aH1,readlinkSync as sH1,realpathSync as oH1}from"fs";import*as rH1 from"fs";import{lstat as eH1,readdir as ZV1,readlink as JV1,realpath as $V1}from"fs/promises";import{EventEmitter as NP}from"events";import uc from"stream";import{StringDecoder as xH1}from"string_decoder";var bc=typeof process==="object"&&process?process:{stdout:null,stderr:null},hH1=(Z)=>!!Z&&typeof Z==="object"&&(Z instanceof r$||Z instanceof uc||fH1(Z)||bH1(Z)),fH1=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof NP&&typeof Z.pipe==="function"&&Z.pipe!==uc.Writable.prototype.pipe,bH1=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof NP&&typeof Z.write==="function"&&typeof Z.end==="function",JZ=Symbol("EOF"),$Z=Symbol("maybeEmitEnd"),WJ=Symbol("emittedEnd"),cU=Symbol("emittingEnd"),HG=Symbol("emittedError"),lU=Symbol("closed"),yc=Symbol("read"),pU=Symbol("flush"),gc=Symbol("flushChunk"),V4=Symbol("encoding"),hW=Symbol("decoder"),r8=Symbol("flowing"),VG=Symbol("paused"),fW=Symbol("resume"),t8=Symbol("buffer"),c6=Symbol("pipes"),e8=Symbol("bufferLength"),BP=Symbol("bufferPush"),iU=Symbol("bufferShift"),P6=Symbol("objectMode"),M8=Symbol("destroyed"),OP=Symbol("error"),jP=Symbol("emitData"),mc=Symbol("emitEnd"),MP=Symbol("emitEnd2"),a4=Symbol("async"),RP=Symbol("abort"),nU=Symbol("aborted"),qG=Symbol("signal"),o$=Symbol("dataListeners"),d5=Symbol("discarded"),FG=(Z)=>Promise.resolve().then(Z),yH1=(Z)=>Z(),gH1=(Z)=>Z==="end"||Z==="finish"||Z==="prefinish",mH1=(Z)=>Z instanceof ArrayBuffer||!!Z&&typeof Z==="object"&&Z.constructor&&Z.constructor.name==="ArrayBuffer"&&Z.byteLength>=0,uH1=(Z)=>!Buffer.isBuffer(Z)&&ArrayBuffer.isView(Z);class PP{src;dest;opts;ondrain;constructor(Z,J,$){this.src=Z,this.dest=J,this.opts=$,this.ondrain=()=>Z[fW](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(Z){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class dc extends PP{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Z,J,$){super(Z,J,$);this.proxyErrors=(Y)=>J.emit("error",Y),Z.on("error",this.proxyErrors)}}var dH1=(Z)=>!!Z.objectMode,cH1=(Z)=>!Z.objectMode&&!!Z.encoding&&Z.encoding!=="buffer";class r$ extends NP{[r8]=!1;[VG]=!1;[c6]=[];[t8]=[];[P6];[V4];[a4];[hW];[JZ]=!1;[WJ]=!1;[cU]=!1;[lU]=!1;[HG]=null;[e8]=0;[M8]=!1;[qG];[nU]=!1;[o$]=0;[d5]=!1;writable=!0;readable=!0;constructor(...Z){let J=Z[0]||{};super();if(J.objectMode&&typeof J.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(dH1(J))this[P6]=!0,this[V4]=null;else if(cH1(J))this[V4]=J.encoding,this[P6]=!1;else this[P6]=!1,this[V4]=null;if(this[a4]=!!J.async,this[hW]=this[V4]?new xH1(this[V4]):null,J&&J.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[t8]});if(J&&J.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[c6]});let{signal:$}=J;if($)if(this[qG]=$,$.aborted)this[RP]();else $.addEventListener("abort",()=>this[RP]())}get bufferLength(){return this[e8]}get encoding(){return this[V4]}set encoding(Z){throw new Error("Encoding must be set at instantiation time")}setEncoding(Z){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[P6]}set objectMode(Z){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[a4]}set["async"](Z){this[a4]=this[a4]||!!Z}[RP](){this[nU]=!0,this.emit("abort",this[qG]?.reason),this.destroy(this[qG]?.reason)}get aborted(){return this[nU]}set aborted(Z){}write(Z,J,$){if(this[nU])return!1;if(this[JZ])throw new Error("write after end");if(this[M8])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof J==="function")$=J,J="utf8";if(!J)J="utf8";let Y=this[a4]?FG:yH1;if(!this[P6]&&!Buffer.isBuffer(Z)){if(uH1(Z))Z=Buffer.from(Z.buffer,Z.byteOffset,Z.byteLength);else if(mH1(Z))Z=Buffer.from(Z);else if(typeof Z!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[P6]){if(this[r8]&&this[e8]!==0)this[pU](!0);if(this[r8])this.emit("data",Z);else this[BP](Z);if(this[e8]!==0)this.emit("readable");if($)Y($);return this[r8]}if(!Z.length){if(this[e8]!==0)this.emit("readable");if($)Y($);return this[r8]}if(typeof Z==="string"&&!(J===this[V4]&&!this[hW]?.lastNeed))Z=Buffer.from(Z,J);if(Buffer.isBuffer(Z)&&this[V4])Z=this[hW].write(Z);if(this[r8]&&this[e8]!==0)this[pU](!0);if(this[r8])this.emit("data",Z);else this[BP](Z);if(this[e8]!==0)this.emit("readable");if($)Y($);return this[r8]}read(Z){if(this[M8])return null;if(this[d5]=!1,this[e8]===0||Z===0||Z&&Z>this[e8])return this[$Z](),null;if(this[P6])Z=null;if(this[t8].length>1&&!this[P6])this[t8]=[this[V4]?this[t8].join(""):Buffer.concat(this[t8],this[e8])];let J=this[yc](Z||null,this[t8][0]);return this[$Z](),J}[yc](Z,J){if(this[P6])this[iU]();else{let $=J;if(Z===$.length||Z===null)this[iU]();else if(typeof $==="string")this[t8][0]=$.slice(Z),J=$.slice(0,Z),this[e8]-=Z;else this[t8][0]=$.subarray(Z),J=$.subarray(0,Z),this[e8]-=Z}if(this.emit("data",J),!this[t8].length&&!this[JZ])this.emit("drain");return J}end(Z,J,$){if(typeof Z==="function")$=Z,Z=void 0;if(typeof J==="function")$=J,J="utf8";if(Z!==void 0)this.write(Z,J);if($)this.once("end",$);if(this[JZ]=!0,this.writable=!1,this[r8]||!this[VG])this[$Z]();return this}[fW](){if(this[M8])return;if(!this[o$]&&!this[c6].length)this[d5]=!0;if(this[VG]=!1,this[r8]=!0,this.emit("resume"),this[t8].length)this[pU]();else if(this[JZ])this[$Z]();else this.emit("drain")}resume(){return this[fW]()}pause(){this[r8]=!1,this[VG]=!0,this[d5]=!1}get destroyed(){return this[M8]}get flowing(){return this[r8]}get paused(){return this[VG]}[BP](Z){if(this[P6])this[e8]+=1;else this[e8]+=Z.length;this[t8].push(Z)}[iU](){if(this[P6])this[e8]-=1;else this[e8]-=this[t8][0].length;return this[t8].shift()}[pU](Z=!1){do;while(this[gc](this[iU]())&&this[t8].length);if(!Z&&!this[t8].length&&!this[JZ])this.emit("drain")}[gc](Z){return this.emit("data",Z),this[r8]}pipe(Z,J){if(this[M8])return Z;this[d5]=!1;let $=this[WJ];if(J=J||{},Z===bc.stdout||Z===bc.stderr)J.end=!1;else J.end=J.end!==!1;if(J.proxyErrors=!!J.proxyErrors,$){if(J.end)Z.end()}else if(this[c6].push(!J.proxyErrors?new PP(this,Z,J):new dc(this,Z,J)),this[a4])FG(()=>this[fW]());else this[fW]();return Z}unpipe(Z){let J=this[c6].find(($)=>$.dest===Z);if(J){if(this[c6].length===1){if(this[r8]&&this[o$]===0)this[r8]=!1;this[c6]=[]}else this[c6].splice(this[c6].indexOf(J),1);J.unpipe()}}addListener(Z,J){return this.on(Z,J)}on(Z,J){let $=super.on(Z,J);if(Z==="data"){if(this[d5]=!1,this[o$]++,!this[c6].length&&!this[r8])this[fW]()}else if(Z==="readable"&&this[e8]!==0)super.emit("readable");else if(gH1(Z)&&this[WJ])super.emit(Z),this.removeAllListeners(Z);else if(Z==="error"&&this[HG]){let Y=J;if(this[a4])FG(()=>Y.call(this,this[HG]));else Y.call(this,this[HG])}return $}removeListener(Z,J){return this.off(Z,J)}off(Z,J){let $=super.off(Z,J);if(Z==="data"){if(this[o$]=this.listeners("data").length,this[o$]===0&&!this[d5]&&!this[c6].length)this[r8]=!1}return $}removeAllListeners(Z){let J=super.removeAllListeners(Z);if(Z==="data"||Z===void 0){if(this[o$]=0,!this[d5]&&!this[c6].length)this[r8]=!1}return J}get emittedEnd(){return this[WJ]}[$Z](){if(!this[cU]&&!this[WJ]&&!this[M8]&&this[t8].length===0&&this[JZ]){if(this[cU]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[lU])this.emit("close");this[cU]=!1}}emit(Z,...J){let $=J[0];if(Z!=="error"&&Z!=="close"&&Z!==M8&&this[M8])return!1;else if(Z==="data")return!this[P6]&&!$?!1:this[a4]?(FG(()=>this[jP]($)),!0):this[jP]($);else if(Z==="end")return this[mc]();else if(Z==="close"){if(this[lU]=!0,!this[WJ]&&!this[M8])return!1;let Q=super.emit("close");return this.removeAllListeners("close"),Q}else if(Z==="error"){this[HG]=$,super.emit(OP,$);let Q=!this[qG]||this.listeners("error").length?super.emit("error",$):!1;return this[$Z](),Q}else if(Z==="resume"){let Q=super.emit("resume");return this[$Z](),Q}else if(Z==="finish"||Z==="prefinish"){let Q=super.emit(Z);return this.removeAllListeners(Z),Q}let Y=super.emit(Z,...J);return this[$Z](),Y}[jP](Z){for(let $ of this[c6])if($.dest.write(Z)===!1)this.pause();let J=this[d5]?!1:super.emit("data",Z);return this[$Z](),J}[mc](){if(this[WJ])return!1;return this[WJ]=!0,this.readable=!1,this[a4]?(FG(()=>this[MP]()),!0):this[MP]()}[MP](){if(this[hW]){let J=this[hW].end();if(J){for(let $ of this[c6])$.dest.write(J);if(!this[d5])super.emit("data",J)}}for(let J of this[c6])J.end();let Z=super.emit("end");return this.removeAllListeners("end"),Z}async collect(){let Z=Object.assign([],{dataLength:0});if(!this[P6])Z.dataLength=0;let J=this.promise();return this.on("data",($)=>{if(Z.push($),!this[P6])Z.dataLength+=$.length}),await J,Z}async concat(){if(this[P6])throw new Error("cannot concat in objectMode");let Z=await this.collect();return this[V4]?Z.join(""):Buffer.concat(Z,Z.dataLength)}async promise(){return new Promise((Z,J)=>{this.on(M8,()=>J(new Error("stream destroyed"))),this.on("error",($)=>J($)),this.on("end",()=>Z())})}[Symbol.asyncIterator](){this[d5]=!1;let Z=!1,J=async()=>{return this.pause(),Z=!0,{value:void 0,done:!0}};return{next:()=>{if(Z)return J();let Y=this.read();if(Y!==null)return Promise.resolve({done:!1,value:Y});if(this[JZ])return J();let Q,W,X=(H)=>{this.off("data",K),this.off("end",G),this.off(M8,z),J(),W(H)},K=(H)=>{this.off("error",X),this.off("end",G),this.off(M8,z),this.pause(),Q({value:H,done:!!this[JZ]})},G=()=>{this.off("error",X),this.off("data",K),this.off(M8,z),J(),Q({done:!0,value:void 0})},z=()=>X(new Error("stream destroyed"));return new Promise((H,V)=>{W=V,Q=H,this.once(M8,z),this.once("error",X),this.once("end",G),this.once("data",K)})},throw:J,return:J,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[d5]=!1;let Z=!1,J=()=>{return this.pause(),this.off(OP,J),this.off(M8,J),this.off("end",J),Z=!0,{done:!0,value:void 0}},$=()=>{if(Z)return J();let Y=this.read();return Y===null?J():{done:!1,value:Y}};return this.once("end",J),this.once(OP,J),this.once(M8,J),{next:$,throw:J,return:J,[Symbol.iterator](){return this}}}destroy(Z){if(this[M8]){if(Z)this.emit("error",Z);else this.emit(M8);return this}this[M8]=!0,this[d5]=!0,this[t8].length=0,this[e8]=0;let J=this;if(typeof J.close==="function"&&!this[lU])J.close();if(Z)this.emit("error",Z);else this.emit(M8);return this}static get isStream(){return hH1}}var tH1=oH1.native,LG={lstatSync:iH1,readdir:nH1,readdirSync:aH1,readlinkSync:sH1,realpathSync:tH1,promises:{lstat:eH1,readdir:ZV1,readlink:JV1,realpath:$V1}},nc=(Z)=>!Z||Z===LG||Z===rH1?LG:{...LG,...Z,promises:{...LG.promises,...Z.promises||{}}},ac=/^\\\\\?\\([a-z]:)\\?$/i,YV1=(Z)=>Z.replace(/\//g,"\\").replace(ac,"$1\\"),QV1=/[\\\/]/,w9=0,sc=1,oc=2,s4=4,rc=6,tc=8,t$=10,ec=12,L9=15,UG=~L9,DP=16,cc=32,wG=64,q4=128,aU=256,oU=512,lc=wG|q4|oU,WV1=1023,CP=(Z)=>Z.isFile()?tc:Z.isDirectory()?s4:Z.isSymbolicLink()?t$:Z.isCharacterDevice()?oc:Z.isBlockDevice()?rc:Z.isSocket()?ec:Z.isFIFO()?sc:w9,pc=new Map,BG=(Z)=>{let J=pc.get(Z);if(J)return J;let $=Z.normalize("NFKD");return pc.set(Z,$),$},ic=new Map,sU=(Z)=>{let J=ic.get(Z);if(J)return J;let $=BG(Z.toLowerCase());return ic.set(Z,$),$};class kP extends zG{constructor(){super({max:256})}}class Zl extends zG{constructor(Z=16384){super({maxSize:Z,sizeCalculation:(J)=>J.length+1})}}var Jl=Symbol("PathScurry setAsCwd");class l6{name;root;roots;parent;nocase;isCWD=!1;#Z;#J;get dev(){return this.#J}#Y;get mode(){return this.#Y}#$;get nlink(){return this.#$}#Q;get uid(){return this.#Q}#H;get gid(){return this.#H}#q;get rdev(){return this.#q}#K;get blksize(){return this.#K}#G;get ino(){return this.#G}#z;get size(){return this.#z}#V;get blocks(){return this.#V}#W;get atimeMs(){return this.#W}#U;get mtimeMs(){return this.#U}#w;get ctimeMs(){return this.#w}#L;get birthtimeMs(){return this.#L}#O;get atime(){return this.#O}#k;get mtime(){return this.#k}#j;get ctime(){return this.#j}#E;get birthtime(){return this.#E}#N;#R;#M;#C;#B;#v;#X;#A;#P;#S;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Z,J=w9,$,Y,Q,W,X){if(this.name=Z,this.#N=Q?sU(Z):BG(Z),this.#X=J&WV1,this.nocase=Q,this.roots=Y,this.root=$||this,this.#A=W,this.#M=X.fullpath,this.#B=X.relative,this.#v=X.relativePosix,this.parent=X.parent,this.parent)this.#Z=this.parent.#Z;else this.#Z=nc(X.fs)}depth(){if(this.#R!==void 0)return this.#R;if(!this.parent)return this.#R=0;return this.#R=this.parent.depth()+1}childrenCache(){return this.#A}resolve(Z){if(!Z)return this;let J=this.getRootString(Z),Y=Z.substring(J.length).split(this.splitSep);return J?this.getRoot(J).#D(Y):this.#D(Y)}#D(Z){let J=this;for(let $ of Z)J=J.child($);return J}children(){let Z=this.#A.get(this);if(Z)return Z;let J=Object.assign([],{provisional:0});return this.#A.set(this,J),this.#X&=~DP,J}child(Z,J){if(Z===""||Z===".")return this;if(Z==="..")return this.parent||this;let $=this.children(),Y=this.nocase?sU(Z):BG(Z);for(let K of $)if(K.#N===Y)return K;let Q=this.parent?this.sep:"",W=this.#M?this.#M+Q+Z:void 0,X=this.newChild(Z,w9,{...J,parent:this,fullpath:W});if(!this.canReaddir())X.#X|=q4;return $.push(X),X}relative(){if(this.isCWD)return"";if(this.#B!==void 0)return this.#B;let Z=this.name,J=this.parent;if(!J)return this.#B=this.name;let $=J.relative();return $+(!$||!J.parent?"":this.sep)+Z}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#v!==void 0)return this.#v;let Z=this.name,J=this.parent;if(!J)return this.#v=this.fullpathPosix();let $=J.relativePosix();return $+(!$||!J.parent?"":"/")+Z}fullpath(){if(this.#M!==void 0)return this.#M;let Z=this.name,J=this.parent;if(!J)return this.#M=this.name;let Y=J.fullpath()+(!J.parent?"":this.sep)+Z;return this.#M=Y}fullpathPosix(){if(this.#C!==void 0)return this.#C;if(this.sep==="/")return this.#C=this.fullpath();if(!this.parent){let Y=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(Y))return this.#C=`//?/${Y}`;else return this.#C=Y}let Z=this.parent,J=Z.fullpathPosix(),$=J+(!J||!Z.parent?"":"/")+this.name;return this.#C=$}isUnknown(){return(this.#X&L9)===w9}isType(Z){return this[`is${Z}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#X&L9)===tc}isDirectory(){return(this.#X&L9)===s4}isCharacterDevice(){return(this.#X&L9)===oc}isBlockDevice(){return(this.#X&L9)===rc}isFIFO(){return(this.#X&L9)===sc}isSocket(){return(this.#X&L9)===ec}isSymbolicLink(){return(this.#X&t$)===t$}lstatCached(){return this.#X&cc?this:void 0}readlinkCached(){return this.#P}realpathCached(){return this.#S}readdirCached(){let Z=this.children();return Z.slice(0,Z.provisional)}canReadlink(){if(this.#P)return!0;if(!this.parent)return!1;let Z=this.#X&L9;return!(Z!==w9&&Z!==t$||this.#X&aU||this.#X&q4)}calledReaddir(){return!!(this.#X&DP)}isENOENT(){return!!(this.#X&q4)}isNamed(Z){return!this.nocase?this.#N===BG(Z):this.#N===sU(Z)}async readlink(){let Z=this.#P;if(Z)return Z;if(!this.canReadlink())return;if(!this.parent)return;try{let J=await this.#Z.promises.readlink(this.fullpath()),$=(await this.parent.realpath())?.resolve(J);if($)return this.#P=$}catch(J){this.#b(J.code);return}}readlinkSync(){let Z=this.#P;if(Z)return Z;if(!this.canReadlink())return;if(!this.parent)return;try{let J=this.#Z.readlinkSync(this.fullpath()),$=this.parent.realpathSync()?.resolve(J);if($)return this.#P=$}catch(J){this.#b(J.code);return}}#m(Z){this.#X|=DP;for(let J=Z.provisional;J<Z.length;J++){let $=Z[J];if($)$.#x()}}#x(){if(this.#X&q4)return;this.#X=(this.#X|q4)&UG,this.#f()}#f(){let Z=this.children();Z.provisional=0;for(let J of Z)J.#x()}#u(){this.#X|=oU,this.#T()}#T(){if(this.#X&wG)return;let Z=this.#X;if((Z&L9)===s4)Z&=UG;this.#X=Z|wG,this.#f()}#I(Z=""){if(Z==="ENOTDIR"||Z==="EPERM")this.#T();else if(Z==="ENOENT")this.#x();else this.children().provisional=0}#d(Z=""){if(Z==="ENOTDIR")this.parent.#T();else if(Z==="ENOENT")this.#x()}#b(Z=""){let J=this.#X;if(J|=aU,Z==="ENOENT")J|=q4;if(Z==="EINVAL"||Z==="UNKNOWN")J&=UG;if(this.#X=J,Z==="ENOTDIR"&&this.parent)this.parent.#T()}#h(Z,J){return this.#c(Z,J)||this.#F(Z,J)}#F(Z,J){let $=CP(Z),Y=this.newChild(Z.name,$,{parent:this}),Q=Y.#X&L9;if(Q!==s4&&Q!==t$&&Q!==w9)Y.#X|=wG;return J.unshift(Y),J.provisional++,Y}#c(Z,J){for(let $=J.provisional;$<J.length;$++){let Y=J[$];if((this.nocase?sU(Z.name):BG(Z.name))!==Y.#N)continue;return this.#y(Z,Y,$,J)}}#y(Z,J,$,Y){let Q=J.name;if(J.#X=J.#X&UG|CP(Z),Q!==Z.name)J.name=Z.name;if($!==Y.provisional){if($===Y.length-1)Y.pop();else Y.splice($,1);Y.unshift(J)}return Y.provisional++,J}async lstat(){if((this.#X&q4)===0)try{return this.#_(await this.#Z.promises.lstat(this.fullpath())),this}catch(Z){this.#d(Z.code)}}lstatSync(){if((this.#X&q4)===0)try{return this.#_(this.#Z.lstatSync(this.fullpath())),this}catch(Z){this.#d(Z.code)}}#_(Z){let{atime:J,atimeMs:$,birthtime:Y,birthtimeMs:Q,blksize:W,blocks:X,ctime:K,ctimeMs:G,dev:z,gid:H,ino:V,mode:q,mtime:F,mtimeMs:U,nlink:w,rdev:L,size:O,uid:j}=Z;this.#O=J,this.#W=$,this.#E=Y,this.#L=Q,this.#K=W,this.#V=X,this.#j=K,this.#w=G,this.#J=z,this.#H=H,this.#G=V,this.#Y=q,this.#k=F,this.#U=U,this.#$=w,this.#q=L,this.#z=O,this.#Q=j;let M=CP(Z);if(this.#X=this.#X&UG|M|cc,M!==w9&&M!==s4&&M!==t$)this.#X|=wG}#g=[];#p=!1;#i(Z){this.#p=!1;let J=this.#g.slice();this.#g.length=0,J.forEach(($)=>$(null,Z))}readdirCB(Z,J=!1){if(!this.canReaddir()){if(J)Z(null,[]);else queueMicrotask(()=>Z(null,[]));return}let $=this.children();if(this.calledReaddir()){let Q=$.slice(0,$.provisional);if(J)Z(null,Q);else queueMicrotask(()=>Z(null,Q));return}if(this.#g.push(Z),this.#p)return;this.#p=!0;let Y=this.fullpath();this.#Z.readdir(Y,{withFileTypes:!0},(Q,W)=>{if(Q)this.#I(Q.code),$.provisional=0;else{for(let X of W)this.#h(X,$);this.#m($)}this.#i($.slice(0,$.provisional));return})}#l;async readdir(){if(!this.canReaddir())return[];let Z=this.children();if(this.calledReaddir())return Z.slice(0,Z.provisional);let J=this.fullpath();if(this.#l)await this.#l;else{let $=()=>{};this.#l=new Promise((Y)=>$=Y);try{for(let Y of await this.#Z.promises.readdir(J,{withFileTypes:!0}))this.#h(Y,Z);this.#m(Z)}catch(Y){this.#I(Y.code),Z.provisional=0}this.#l=void 0,$()}return Z.slice(0,Z.provisional)}readdirSync(){if(!this.canReaddir())return[];let Z=this.children();if(this.calledReaddir())return Z.slice(0,Z.provisional);let J=this.fullpath();try{for(let $ of this.#Z.readdirSync(J,{withFileTypes:!0}))this.#h($,Z);this.#m(Z)}catch($){this.#I($.code),Z.provisional=0}return Z.slice(0,Z.provisional)}canReaddir(){if(this.#X&lc)return!1;let Z=L9&this.#X;if(!(Z===w9||Z===s4||Z===t$))return!1;return!0}shouldWalk(Z,J){return(this.#X&s4)===s4&&!(this.#X&lc)&&!Z.has(this)&&(!J||J(this))}async realpath(){if(this.#S)return this.#S;if((oU|aU|q4)&this.#X)return;try{let Z=await this.#Z.promises.realpath(this.fullpath());return this.#S=this.resolve(Z)}catch(Z){this.#u()}}realpathSync(){if(this.#S)return this.#S;if((oU|aU|q4)&this.#X)return;try{let Z=this.#Z.realpathSync(this.fullpath());return this.#S=this.resolve(Z)}catch(Z){this.#u()}}[Jl](Z){if(Z===this)return;Z.isCWD=!1,this.isCWD=!0;let J=new Set([]),$=[],Y=this;while(Y&&Y.parent)J.add(Y),Y.#B=$.join(this.sep),Y.#v=$.join("/"),Y=Y.parent,$.push("..");Y=Z;while(Y&&Y.parent&&!J.has(Y))Y.#B=void 0,Y.#v=void 0,Y=Y.parent}}class rU extends l6{sep="\\";splitSep=QV1;constructor(Z,J=w9,$,Y,Q,W,X){super(Z,J,$,Y,Q,W,X)}newChild(Z,J=w9,$={}){return new rU(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),$)}getRootString(Z){return TP.parse(Z).root}getRoot(Z){if(Z=YV1(Z.toUpperCase()),Z===this.root.name)return this.root;for(let[J,$]of Object.entries(this.roots))if(this.sameRoot(Z,J))return this.roots[Z]=$;return this.roots[Z]=new OG(Z,this).root}sameRoot(Z,J=this.root.name){return Z=Z.toUpperCase().replace(/\//g,"\\").replace(ac,"$1\\"),Z===J}}class tU extends l6{splitSep="/";sep="/";constructor(Z,J=w9,$,Y,Q,W,X){super(Z,J,$,Y,Q,W,X)}getRootString(Z){return Z.startsWith("/")?"/":""}getRoot(Z){return this.root}newChild(Z,J=w9,$={}){return new tU(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),$)}}class EP{root;rootPath;roots;cwd;#Z;#J;#Y;nocase;#$;constructor(Z=process.cwd(),J,$,{nocase:Y,childrenCacheSize:Q=16384,fs:W=LG}={}){if(this.#$=nc(W),Z instanceof URL||Z.startsWith("file://"))Z=pH1(Z);let X=J.resolve(Z);this.roots=Object.create(null),this.rootPath=this.parseRootPath(X),this.#Z=new kP,this.#J=new kP,this.#Y=new Zl(Q);let K=X.substring(this.rootPath.length).split($);if(K.length===1&&!K[0])K.pop();if(Y===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=Y,this.root=this.newRoot(this.#$),this.roots[this.rootPath]=this.root;let G=this.root,z=K.length-1,H=J.sep,V=this.rootPath,q=!1;for(let F of K){let U=z--;G=G.child(F,{relative:new Array(U).fill("..").join(H),relativePosix:new Array(U).fill("..").join("/"),fullpath:V+=(q?"":H)+F}),q=!0}this.cwd=G}depth(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.depth()}childrenCache(){return this.#Y}resolve(...Z){let J="";for(let Q=Z.length-1;Q>=0;Q--){let W=Z[Q];if(!W||W===".")continue;if(J=J?`${W}/${J}`:W,this.isAbsolute(W))break}let $=this.#Z.get(J);if($!==void 0)return $;let Y=this.cwd.resolve(J).fullpath();return this.#Z.set(J,Y),Y}resolvePosix(...Z){let J="";for(let Q=Z.length-1;Q>=0;Q--){let W=Z[Q];if(!W||W===".")continue;if(J=J?`${W}/${J}`:W,this.isAbsolute(W))break}let $=this.#J.get(J);if($!==void 0)return $;let Y=this.cwd.resolve(J).fullpathPosix();return this.#J.set(J,Y),Y}relative(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.relative()}relativePosix(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.relativePosix()}basename(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.name}dirname(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return(Z.parent||Z).fullpath()}async readdir(Z=this.cwd,J={withFileTypes:!0}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof l6))J=Z,Z=this.cwd;let{withFileTypes:$}=J;if(!Z.canReaddir())return[];else{let Y=await Z.readdir();return $?Y:Y.map((Q)=>Q.name)}}readdirSync(Z=this.cwd,J={withFileTypes:!0}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof l6))J=Z,Z=this.cwd;let{withFileTypes:$=!0}=J;if(!Z.canReaddir())return[];else if($)return Z.readdirSync();else return Z.readdirSync().map((Y)=>Y.name)}async lstat(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.lstat()}lstatSync(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.lstatSync()}async readlink(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof l6))J=Z.withFileTypes,Z=this.cwd;let $=await Z.readlink();return J?$:$?.fullpath()}readlinkSync(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof l6))J=Z.withFileTypes,Z=this.cwd;let $=Z.readlinkSync();return J?$:$?.fullpath()}async realpath(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof l6))J=Z.withFileTypes,Z=this.cwd;let $=await Z.realpath();return J?$:$?.fullpath()}realpathSync(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof l6))J=Z.withFileTypes,Z=this.cwd;let $=Z.realpathSync();return J?$:$?.fullpath()}async walk(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof l6))J=Z,Z=this.cwd;let{withFileTypes:$=!0,follow:Y=!1,filter:Q,walkFilter:W}=J,X=[];if(!Q||Q(Z))X.push($?Z:Z.fullpath());let K=new Set,G=(H,V)=>{K.add(H),H.readdirCB((q,F)=>{if(q)return V(q);let U=F.length;if(!U)return V();let w=()=>{if(--U===0)V()};for(let L of F){if(!Q||Q(L))X.push($?L:L.fullpath());if(Y&&L.isSymbolicLink())L.realpath().then((O)=>O?.isUnknown()?O.lstat():O).then((O)=>O?.shouldWalk(K,W)?G(O,w):w());else if(L.shouldWalk(K,W))G(L,w);else w()}},!0)},z=Z;return new Promise((H,V)=>{G(z,(q)=>{if(q)return V(q);H(X)})})}walkSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof l6))J=Z,Z=this.cwd;let{withFileTypes:$=!0,follow:Y=!1,filter:Q,walkFilter:W}=J,X=[];if(!Q||Q(Z))X.push($?Z:Z.fullpath());let K=new Set([Z]);for(let G of K){let z=G.readdirSync();for(let H of z){if(!Q||Q(H))X.push($?H:H.fullpath());let V=H;if(H.isSymbolicLink()){if(!(Y&&(V=H.realpathSync())))continue;if(V.isUnknown())V.lstatSync()}if(V.shouldWalk(K,W))K.add(V)}}return X}[Symbol.asyncIterator](){return this.iterate()}iterate(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof l6))J=Z,Z=this.cwd;return this.stream(Z,J)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof l6))J=Z,Z=this.cwd;let{withFileTypes:$=!0,follow:Y=!1,filter:Q,walkFilter:W}=J;if(!Q||Q(Z))yield $?Z:Z.fullpath();let X=new Set([Z]);for(let K of X){let G=K.readdirSync();for(let z of G){if(!Q||Q(z))yield $?z:z.fullpath();let H=z;if(z.isSymbolicLink()){if(!(Y&&(H=z.realpathSync())))continue;if(H.isUnknown())H.lstatSync()}if(H.shouldWalk(X,W))X.add(H)}}}stream(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof l6))J=Z,Z=this.cwd;let{withFileTypes:$=!0,follow:Y=!1,filter:Q,walkFilter:W}=J,X=new r$({objectMode:!0});if(!Q||Q(Z))X.write($?Z:Z.fullpath());let K=new Set,G=[Z],z=0,H=()=>{let V=!1;while(!V){let q=G.shift();if(!q){if(z===0)X.end();return}z++,K.add(q);let F=(w,L,O=!1)=>{if(w)return X.emit("error",w);if(Y&&!O){let j=[];for(let M of L)if(M.isSymbolicLink())j.push(M.realpath().then((N)=>N?.isUnknown()?N.lstat():N));if(j.length){Promise.all(j).then(()=>F(null,L,!0));return}}for(let j of L)if(j&&(!Q||Q(j))){if(!X.write($?j:j.fullpath()))V=!0}z--;for(let j of L){let M=j.realpathCached()||j;if(M.shouldWalk(K,W))G.push(M)}if(V&&!X.flowing)X.once("drain",H);else if(!U)H()},U=!0;q.readdirCB(F,!0),U=!1}};return H(),X}streamSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof l6))J=Z,Z=this.cwd;let{withFileTypes:$=!0,follow:Y=!1,filter:Q,walkFilter:W}=J,X=new r$({objectMode:!0}),K=new Set;if(!Q||Q(Z))X.write($?Z:Z.fullpath());let G=[Z],z=0,H=()=>{let V=!1;while(!V){let q=G.shift();if(!q){if(z===0)X.end();return}z++,K.add(q);let F=q.readdirSync();for(let U of F)if(!Q||Q(U)){if(!X.write($?U:U.fullpath()))V=!0}z--;for(let U of F){let w=U;if(U.isSymbolicLink()){if(!(Y&&(w=U.realpathSync())))continue;if(w.isUnknown())w.lstatSync()}if(w.shouldWalk(K,W))G.push(w)}}if(V&&!X.flowing)X.once("drain",H)};return H(),X}chdir(Z=this.cwd){let J=this.cwd;this.cwd=typeof Z==="string"?this.cwd.resolve(Z):Z,this.cwd[Jl](J)}}class OG extends EP{sep="\\";constructor(Z=process.cwd(),J={}){let{nocase:$=!0}=J;super(Z,TP,"\\",{...J,nocase:$});this.nocase=$;for(let Y=this.cwd;Y;Y=Y.parent)Y.nocase=this.nocase}parseRootPath(Z){return TP.parse(Z).root.toUpperCase()}newRoot(Z){return new rU(this.rootPath,s4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")||Z.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Z)}}class jG extends EP{sep="/";constructor(Z=process.cwd(),J={}){let{nocase:$=!1}=J;super(Z,lH1,"/",{...J,nocase:$});this.nocase=$}parseRootPath(Z){return"/"}newRoot(Z){return new tU(this.rootPath,s4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")}}class eU extends jG{constructor(Z=process.cwd(),J={}){let{nocase:$=!0}=J;super(Z,{...J,nocase:$})}}var uG6=process.platform==="win32"?rU:tU,$l=process.platform==="win32"?OG:process.platform==="darwin"?eU:jG;var XV1=(Z)=>Z.length>=1,KV1=(Z)=>Z.length>=1;class bW{#Z;#J;#Y;length;#$;#Q;#H;#q;#K;#G;#z=!0;constructor(Z,J,$,Y){if(!XV1(Z))throw new TypeError("empty pattern list");if(!KV1(J))throw new TypeError("empty glob list");if(J.length!==Z.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=Z.length,$<0||$>=this.length)throw new TypeError("index out of range");if(this.#Z=Z,this.#J=J,this.#Y=$,this.#$=Y,this.#Y===0){if(this.isUNC()){let[Q,W,X,K,...G]=this.#Z,[z,H,V,q,...F]=this.#J;if(G[0]==="")G.shift(),F.shift();let U=[Q,W,X,K,""].join("/"),w=[z,H,V,q,""].join("/");this.#Z=[U,...G],this.#J=[w,...F],this.length=this.#Z.length}else if(this.isDrive()||this.isAbsolute()){let[Q,...W]=this.#Z,[X,...K]=this.#J;if(W[0]==="")W.shift(),K.shift();let G=Q+"/",z=X+"/";this.#Z=[G,...W],this.#J=[z,...K],this.length=this.#Z.length}}}pattern(){return this.#Z[this.#Y]}isString(){return typeof this.#Z[this.#Y]==="string"}isGlobstar(){return this.#Z[this.#Y]===L6}isRegExp(){return this.#Z[this.#Y]instanceof RegExp}globString(){return this.#H=this.#H||(this.#Y===0?this.isAbsolute()?this.#J[0]+this.#J.slice(1).join("/"):this.#J.join("/"):this.#J.slice(this.#Y).join("/"))}hasMore(){return this.length>this.#Y+1}rest(){if(this.#Q!==void 0)return this.#Q;if(!this.hasMore())return this.#Q=null;return this.#Q=new bW(this.#Z,this.#J,this.#Y+1,this.#$),this.#Q.#G=this.#G,this.#Q.#K=this.#K,this.#Q.#q=this.#q,this.#Q}isUNC(){let Z=this.#Z;return this.#K!==void 0?this.#K:this.#K=this.#$==="win32"&&this.#Y===0&&Z[0]===""&&Z[1]===""&&typeof Z[2]==="string"&&!!Z[2]&&typeof Z[3]==="string"&&!!Z[3]}isDrive(){let Z=this.#Z;return this.#q!==void 0?this.#q:this.#q=this.#$==="win32"&&this.#Y===0&&this.length>1&&typeof Z[0]==="string"&&/^[a-z]:$/i.test(Z[0])}isAbsolute(){let Z=this.#Z;return this.#G!==void 0?this.#G:this.#G=Z[0]===""&&Z.length>1||this.isDrive()||this.isUNC()}root(){let Z=this.#Z[0];return typeof Z==="string"&&this.isAbsolute()&&this.#Y===0?Z:""}checkFollowGlobstar(){return!(this.#Y===0||!this.isGlobstar()||!this.#z)}markFollowGlobstar(){if(this.#Y===0||!this.isGlobstar()||!this.#z)return!1;return this.#z=!1,!0}}var GV1=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class MG{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Z,{nobrace:J,nocase:$,noext:Y,noglobstar:Q,platform:W=GV1}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=W,this.mmopts={dot:!0,nobrace:J,nocase:$,noext:Y,noglobstar:Q,optimizationLevel:2,platform:W,nocomment:!0,nonegate:!0};for(let X of Z)this.add(X)}add(Z){let J=new U9(Z,this.mmopts);for(let $=0;$<J.set.length;$++){let Y=J.set[$],Q=J.globParts[$];if(!Y||!Q)throw new Error("invalid pattern object");while(Y[0]==="."&&Q[0]===".")Y.shift(),Q.shift();let W=new bW(Y,Q,0,this.platform),X=new U9(W.globString(),this.mmopts),K=Q[Q.length-1]==="**",G=W.isAbsolute();if(G)this.absolute.push(X);else this.relative.push(X);if(K)if(G)this.absoluteChildren.push(X);else this.relativeChildren.push(X)}}ignored(Z){let J=Z.fullpath(),$=`${J}/`,Y=Z.relative()||".",Q=`${Y}/`;for(let W of this.relative)if(W.match(Y)||W.match(Q))return!0;for(let W of this.absolute)if(W.match(J)||W.match($))return!0;return!1}childrenIgnored(Z){let J=Z.fullpath()+"/",$=(Z.relative()||".")+"/";for(let Y of this.relativeChildren)if(Y.match($))return!0;for(let Y of this.absoluteChildren)if(Y.match(J))return!0;return!1}}class IP{store;constructor(Z=new Map){this.store=Z}copy(){return new IP(new Map(this.store))}hasWalked(Z,J){return this.store.get(Z.fullpath())?.has(J.globString())}storeWalked(Z,J){let $=Z.fullpath(),Y=this.store.get($);if(Y)Y.add(J.globString());else this.store.set($,new Set([J.globString()]))}}class Yl{store=new Map;add(Z,J,$){let Y=(J?2:0)|($?1:0),Q=this.store.get(Z);this.store.set(Z,Q===void 0?Y:Y&Q)}entries(){return[...this.store.entries()].map(([Z,J])=>[Z,!!(J&2),!!(J&1)])}}class Ql{store=new Map;add(Z,J){if(!Z.canReaddir())return;let $=this.store.get(Z);if($){if(!$.find((Y)=>Y.globString()===J.globString()))$.push(J)}else this.store.set(Z,[J])}get(Z){let J=this.store.get(Z);if(!J)throw new Error("attempting to walk unknown path");return J}entries(){return this.keys().map((Z)=>[Z,this.store.get(Z)])}keys(){return[...this.store.keys()].filter((Z)=>Z.canReaddir())}}class RG{hasWalkedCache;matches=new Yl;subwalks=new Ql;patterns;follow;dot;opts;constructor(Z,J){this.opts=Z,this.follow=!!Z.follow,this.dot=!!Z.dot,this.hasWalkedCache=J?J.copy():new IP}processPatterns(Z,J){this.patterns=J;let $=J.map((Y)=>[Z,Y]);for(let[Y,Q]of $){this.hasWalkedCache.storeWalked(Y,Q);let W=Q.root(),X=Q.isAbsolute()&&this.opts.absolute!==!1;if(W){Y=Y.resolve(W==="/"&&this.opts.root!==void 0?this.opts.root:W);let H=Q.rest();if(!H){this.matches.add(Y,!0,!1);continue}else Q=H}if(Y.isENOENT())continue;let K,G,z=!1;while(typeof(K=Q.pattern())==="string"&&(G=Q.rest()))Y=Y.resolve(K),Q=G,z=!0;if(K=Q.pattern(),G=Q.rest(),z){if(this.hasWalkedCache.hasWalked(Y,Q))continue;this.hasWalkedCache.storeWalked(Y,Q)}if(typeof K==="string"){let H=K===".."||K===""||K===".";this.matches.add(Y.resolve(K),X,H);continue}else if(K===L6){if(!Y.isSymbolicLink()||this.follow||Q.checkFollowGlobstar())this.subwalks.add(Y,Q);let H=G?.pattern(),V=G?.rest();if(!G||(H===""||H===".")&&!V)this.matches.add(Y,X,H===""||H===".");else if(H===".."){let q=Y.parent||Y;if(!V)this.matches.add(q,X,!0);else if(!this.hasWalkedCache.hasWalked(q,V))this.subwalks.add(q,V)}}else if(K instanceof RegExp)this.subwalks.add(Y,Q)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new RG(this.opts,this.hasWalkedCache)}filterEntries(Z,J){let $=this.subwalks.get(Z),Y=this.child();for(let Q of J)for(let W of $){let X=W.isAbsolute(),K=W.pattern(),G=W.rest();if(K===L6)Y.testGlobstar(Q,W,G,X);else if(K instanceof RegExp)Y.testRegExp(Q,K,G,X);else Y.testString(Q,K,G,X)}return Y}testGlobstar(Z,J,$,Y){if(this.dot||!Z.name.startsWith(".")){if(!J.hasMore())this.matches.add(Z,Y,!1);if(Z.canReaddir()){if(this.follow||!Z.isSymbolicLink())this.subwalks.add(Z,J);else if(Z.isSymbolicLink()){if($&&J.checkFollowGlobstar())this.subwalks.add(Z,$);else if(J.markFollowGlobstar())this.subwalks.add(Z,J)}}}if($){let Q=$.pattern();if(typeof Q==="string"&&Q!==".."&&Q!==""&&Q!==".")this.testString(Z,Q,$.rest(),Y);else if(Q===".."){let W=Z.parent||Z;this.subwalks.add(W,$)}else if(Q instanceof RegExp)this.testRegExp(Z,Q,$.rest(),Y)}}testRegExp(Z,J,$,Y){if(!J.test(Z.name))return;if(!$)this.matches.add(Z,Y,!1);else this.subwalks.add(Z,$)}testString(Z,J,$,Y){if(!Z.isNamed(J))return;if(!$)this.matches.add(Z,Y,!1);else this.subwalks.add(Z,$)}}var zV1=(Z,J)=>typeof Z==="string"?new MG([Z],J):Array.isArray(Z)?new MG(Z,J):Z;class vP{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#Z=[];#J;#Y;signal;maxDepth;includeChildMatches;constructor(Z,J,$){if(this.patterns=Z,this.path=J,this.opts=$,this.#Y=!$.posix&&$.platform==="win32"?"\\":"/",this.includeChildMatches=$.includeChildMatches!==!1,$.ignore||!this.includeChildMatches){if(this.#J=zV1($.ignore??[],$),!this.includeChildMatches&&typeof this.#J.add!=="function")throw new Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=$.maxDepth||1/0,$.signal)this.signal=$.signal,this.signal.addEventListener("abort",()=>{this.#Z.length=0})}#$(Z){return this.seen.has(Z)||!!this.#J?.ignored?.(Z)}#Q(Z){return!!this.#J?.childrenIgnored?.(Z)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let Z=void 0;while(!this.paused&&(Z=this.#Z.shift()))Z()}onResume(Z){if(this.signal?.aborted)return;if(!this.paused)Z();else this.#Z.push(Z)}async matchCheck(Z,J){if(J&&this.opts.nodir)return;let $;if(this.opts.realpath){if($=Z.realpathCached()||await Z.realpath(),!$)return;Z=$}let Q=Z.isUnknown()||this.opts.stat?await Z.lstat():Z;if(this.opts.follow&&this.opts.nodir&&Q?.isSymbolicLink()){let W=await Q.realpath();if(W&&(W.isUnknown()||this.opts.stat))await W.lstat()}return this.matchCheckTest(Q,J)}matchCheckTest(Z,J){return Z&&(this.maxDepth===1/0||Z.depth()<=this.maxDepth)&&(!J||Z.canReaddir())&&(!this.opts.nodir||!Z.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!Z.isSymbolicLink()||!Z.realpathCached()?.isDirectory())&&!this.#$(Z)?Z:void 0}matchCheckSync(Z,J){if(J&&this.opts.nodir)return;let $;if(this.opts.realpath){if($=Z.realpathCached()||Z.realpathSync(),!$)return;Z=$}let Q=Z.isUnknown()||this.opts.stat?Z.lstatSync():Z;if(this.opts.follow&&this.opts.nodir&&Q?.isSymbolicLink()){let W=Q.realpathSync();if(W&&(W?.isUnknown()||this.opts.stat))W.lstatSync()}return this.matchCheckTest(Q,J)}matchFinish(Z,J){if(this.#$(Z))return;if(!this.includeChildMatches&&this.#J?.add){let Q=`${Z.relativePosix()}/**`;this.#J.add(Q)}let $=this.opts.absolute===void 0?J:this.opts.absolute;this.seen.add(Z);let Y=this.opts.mark&&Z.isDirectory()?this.#Y:"";if(this.opts.withFileTypes)this.matchEmit(Z);else if($){let Q=this.opts.posix?Z.fullpathPosix():Z.fullpath();this.matchEmit(Q+Y)}else{let Q=this.opts.posix?Z.relativePosix():Z.relative(),W=this.opts.dotRelative&&!Q.startsWith(".."+this.#Y)?"."+this.#Y:"";this.matchEmit(!Q?"."+Y:W+Q+Y)}}async match(Z,J,$){let Y=await this.matchCheck(Z,$);if(Y)this.matchFinish(Y,J)}matchSync(Z,J,$){let Y=this.matchCheckSync(Z,$);if(Y)this.matchFinish(Y,J)}walkCB(Z,J,$){if(this.signal?.aborted)$();this.walkCB2(Z,J,new RG(this.opts),$)}walkCB2(Z,J,$,Y){if(this.#Q(Z))return Y();if(this.signal?.aborted)Y();if(this.paused){this.onResume(()=>this.walkCB2(Z,J,$,Y));return}$.processPatterns(Z,J);let Q=1,W=()=>{if(--Q===0)Y()};for(let[X,K,G]of $.matches.entries()){if(this.#$(X))continue;Q++,this.match(X,K,G).then(()=>W())}for(let X of $.subwalkTargets()){if(this.maxDepth!==1/0&&X.depth()>=this.maxDepth)continue;Q++;let K=X.readdirCached();if(X.calledReaddir())this.walkCB3(X,K,$,W);else X.readdirCB((G,z)=>this.walkCB3(X,z,$,W),!0)}W()}walkCB3(Z,J,$,Y){$=$.filterEntries(Z,J);let Q=1,W=()=>{if(--Q===0)Y()};for(let[X,K,G]of $.matches.entries()){if(this.#$(X))continue;Q++,this.match(X,K,G).then(()=>W())}for(let[X,K]of $.subwalks.entries())Q++,this.walkCB2(X,K,$.child(),W);W()}walkCBSync(Z,J,$){if(this.signal?.aborted)$();this.walkCB2Sync(Z,J,new RG(this.opts),$)}walkCB2Sync(Z,J,$,Y){if(this.#Q(Z))return Y();if(this.signal?.aborted)Y();if(this.paused){this.onResume(()=>this.walkCB2Sync(Z,J,$,Y));return}$.processPatterns(Z,J);let Q=1,W=()=>{if(--Q===0)Y()};for(let[X,K,G]of $.matches.entries()){if(this.#$(X))continue;this.matchSync(X,K,G)}for(let X of $.subwalkTargets()){if(this.maxDepth!==1/0&&X.depth()>=this.maxDepth)continue;Q++;let K=X.readdirSync();this.walkCB3Sync(X,K,$,W)}W()}walkCB3Sync(Z,J,$,Y){$=$.filterEntries(Z,J);let Q=1,W=()=>{if(--Q===0)Y()};for(let[X,K,G]of $.matches.entries()){if(this.#$(X))continue;this.matchSync(X,K,G)}for(let[X,K]of $.subwalks.entries())Q++,this.walkCB2Sync(X,K,$.child(),W);W()}}class Z2 extends vP{matches=new Set;constructor(Z,J,$){super(Z,J,$)}matchEmit(Z){this.matches.add(Z)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((Z,J)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)J(this.signal.reason);else Z(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class J2 extends vP{results;constructor(Z,J,$){super(Z,J,$);this.results=new r$({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(Z){if(this.results.write(Z),!this.results.flowing)this.pause()}stream(){let Z=this.path;if(Z.isUnknown())Z.lstat().then(()=>{this.walkCB(Z,this.patterns,()=>this.results.end())});else this.walkCB(Z,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var VV1=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class o4{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(Z,J){if(!J)throw new TypeError("glob options required");if(this.withFileTypes=!!J.withFileTypes,this.signal=J.signal,this.follow=!!J.follow,this.dot=!!J.dot,this.dotRelative=!!J.dotRelative,this.nodir=!!J.nodir,this.mark=!!J.mark,!J.cwd)this.cwd="";else if(J.cwd instanceof URL||J.cwd.startsWith("file://"))J.cwd=HV1(J.cwd);if(this.cwd=J.cwd||"",this.root=J.root,this.magicalBraces=!!J.magicalBraces,this.nobrace=!!J.nobrace,this.noext=!!J.noext,this.realpath=!!J.realpath,this.absolute=J.absolute,this.includeChildMatches=J.includeChildMatches!==!1,this.noglobstar=!!J.noglobstar,this.matchBase=!!J.matchBase,this.maxDepth=typeof J.maxDepth==="number"?J.maxDepth:1/0,this.stat=!!J.stat,this.ignore=J.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof Z==="string")Z=[Z];if(this.windowsPathsNoEscape=!!J.windowsPathsNoEscape||J.allowWindowsEscape===!1,this.windowsPathsNoEscape)Z=Z.map((K)=>K.replace(/\\/g,"/"));if(this.matchBase){if(J.noglobstar)throw new TypeError("base matching requires globstar");Z=Z.map((K)=>K.includes("/")?K:`./**/${K}`)}if(this.pattern=Z,this.platform=J.platform||VV1,this.opts={...J,platform:this.platform},J.scurry){if(this.scurry=J.scurry,J.nocase!==void 0&&J.nocase!==J.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let K=J.platform==="win32"?OG:J.platform==="darwin"?eU:J.platform?jG:$l;this.scurry=new K(this.cwd,{nocase:J.nocase,fs:J.fs})}this.nocase=this.scurry.nocase;let $=this.platform==="darwin"||this.platform==="win32",Y={...J,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:$,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},Q=this.pattern.map((K)=>new U9(K,Y)),[W,X]=Q.reduce((K,G)=>{return K[0].push(...G.set),K[1].push(...G.globParts),K},[[],[]]);this.patterns=W.map((K,G)=>{let z=X[G];if(!z)throw new Error("invalid pattern object");return new bW(K,z,0,this.platform)})}async walk(){return[...await new Z2(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new Z2(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new J2(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new J2(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}var SP=(Z,J={})=>{if(!Array.isArray(Z))Z=[Z];for(let $ of Z)if(new U9($,J).hasMagic())return!0;return!1};function Y2(Z,J={}){return new o4(Z,J).streamSync()}function Xl(Z,J={}){return new o4(Z,J).stream()}function Kl(Z,J={}){return new o4(Z,J).walkSync()}async function Wl(Z,J={}){return new o4(Z,J).walk()}function Q2(Z,J={}){return new o4(Z,J).iterateSync()}function Gl(Z,J={}){return new o4(Z,J).iterate()}var qV1=Y2,FV1=Object.assign(Xl,{sync:Y2}),UV1=Q2,LV1=Object.assign(Gl,{sync:Q2}),wV1=Object.assign(Kl,{stream:Y2,iterate:Q2}),$2=Object.assign(Wl,{glob:Wl,globSync:Kl,sync:wV1,globStream:Xl,stream:FV1,globStreamSync:Y2,streamSync:qV1,globIterate:Gl,iterate:LV1,globIterateSync:Q2,iterateSync:UV1,Glob:o4,hasMagic:SP,escape:_W,unescape:H4});$2.glob=$2;class _P{constructor(){this._listeners={}}addEventListener(Z,J){let $=this._listeners;if($[Z]===void 0)$[Z]=[];if($[Z].indexOf(J)===-1)$[Z].push(J);return this}removeEventListener(Z,J){let Y=this._listeners[Z];if(Y!==void 0){let Q=Y.indexOf(J);if(Q!==-1)Y.splice(Q,1)}return this}dispatchEvent(Z){let $=this._listeners[Z.type];if($!==void 0){let Y=$.slice(0);for(let Q=0,W=Y.length;Q<W;Q++)Y[Q].call(this,Z)}return this}dispose(){for(let Z in this._listeners)delete this._listeners[Z]}}class B5{constructor(Z,J,$,Y={}){if(this._name=void 0,this._parent=void 0,this._child=void 0,this._attributes=void 0,this._disposed=!1,this._name=Z,this._parent=J,this._child=$,this._attributes=Y,!J.isOnGraph($))throw new Error("Cannot connect disconnected graphs.")}getName(){return this._name}getParent(){return this._parent}getChild(){return this._child}setChild(Z){return this._child=Z,this}getAttributes(){return this._attributes}dispose(){if(this._disposed)return;this._parent._destroyRef(this),this._disposed=!0}isDisposed(){return this._disposed}}class yW extends _P{constructor(...Z){super(...Z);this._emptySet=new Set,this._edges=new Set,this._parentEdges=new Map,this._childEdges=new Map}listEdges(){return Array.from(this._edges)}listParentEdges(Z){return Array.from(this._childEdges.get(Z)||this._emptySet)}listParents(Z){let J=new Set;for(let $ of this.listParentEdges(Z))J.add($.getParent());return Array.from(J)}listChildEdges(Z){return Array.from(this._parentEdges.get(Z)||this._emptySet)}listChildren(Z){let J=new Set;for(let $ of this.listChildEdges(Z))J.add($.getChild());return Array.from(J)}disconnectParents(Z,J){for(let $ of this.listParentEdges(Z))if(!J||J($.getParent()))$.dispose();return this}_createEdge(Z,J,$,Y){let Q=new B5(Z,J,$,Y);this._edges.add(Q);let W=Q.getParent();if(!this._parentEdges.has(W))this._parentEdges.set(W,new Set);this._parentEdges.get(W).add(Q);let X=Q.getChild();if(!this._childEdges.has(X))this._childEdges.set(X,new Set);return this._childEdges.get(X).add(Q),Q}_destroyEdge(Z){return this._edges.delete(Z),this._parentEdges.get(Z.getParent()).delete(Z),this._childEdges.get(Z.getChild()).delete(Z),this}}function NG(){return NG=Object.assign||function(Z){for(var J=1;J<arguments.length;J++){var $=arguments[J];for(var Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=$[Y]}return Z},NG.apply(this,arguments)}class D6{constructor(Z){if(this.list=[],Z)for(let J of Z)this.list.push(J)}add(Z){this.list.push(Z)}remove(Z){let J=this.list.indexOf(Z);if(J>=0)this.list.splice(J,1)}removeChild(Z){let J=[];for(let $ of this.list)if($.getChild()===Z)J.push($);for(let $ of J)this.remove($);return J}listRefsByChild(Z){let J=[];for(let $ of this.list)if($.getChild()===Z)J.push($);return J}values(){return this.list}}class N0{constructor(Z){if(this.set=new Set,this.map=new Map,Z)for(let J of Z)this.add(J)}add(Z){let J=Z.getChild();this.removeChild(J),this.set.add(Z),this.map.set(J,Z)}remove(Z){this.set.delete(Z),this.map.delete(Z.getChild())}removeChild(Z){let J=this.map.get(Z)||null;if(J)this.remove(J);return J}getRefByChild(Z){return this.map.get(Z)||null}values(){return Array.from(this.set)}}class r1{constructor(Z){if(this.map={},Z)Object.assign(this.map,Z)}set(Z,J){this.map[Z]=J}delete(Z){delete this.map[Z]}get(Z){return this.map[Z]||null}keys(){return Object.keys(this.map)}values(){return Object.values(this.map)}}var A0=Symbol("attributes"),F4=Symbol("immutableKeys");class gW extends _P{constructor(Z){super();this._disposed=!1,this.graph=void 0,this[A0]=void 0,this[F4]=void 0,this.graph=Z,this[F4]=new Set,this[A0]=this._createAttributes()}getDefaults(){return{}}_createAttributes(){let Z=this.getDefaults(),J={};for(let $ in Z){let Y=Z[$];if(Y instanceof gW){let Q=this.graph._createEdge($,this,Y);this[F4].add($),J[$]=Q}else J[$]=Y}return J}isOnGraph(Z){return this.graph===Z.graph}isDisposed(){return this._disposed}dispose(){if(this._disposed)return;this.graph.listChildEdges(this).forEach((Z)=>Z.dispose()),this.graph.disconnectParents(this),this._disposed=!0,this.dispatchEvent({type:"dispose"})}detach(){return this.graph.disconnectParents(this),this}swap(Z,J){for(let $ in this[A0]){let Y=this[A0][$];if(Y instanceof B5){let Q=Y;if(Q.getChild()===Z)this.setRef($,J,Q.getAttributes())}else if(Y instanceof D6)for(let Q of Y.listRefsByChild(Z)){let W=Q.getAttributes();this.removeRef($,Z),this.addRef($,J,W)}else if(Y instanceof N0){let Q=Y.getRefByChild(Z);if(Q){let W=Q.getAttributes();this.removeRef($,Z),this.addRef($,J,W)}}else if(Y instanceof r1)for(let Q of Y.keys()){let W=Y.get(Q);if(W.getChild()===Z)this.setRefMap($,Q,J,W.getAttributes())}}return this}get(Z){return this[A0][Z]}set(Z,J){return this[A0][Z]=J,this.dispatchEvent({type:"change",attribute:Z})}getRef(Z){let J=this[A0][Z];return J?J.getChild():null}setRef(Z,J,$){if(this[F4].has(Z))throw new Error(`Cannot overwrite immutable attribute, "${Z}".`);let Y=this[A0][Z];if(Y)Y.dispose();if(!J)return this;let Q=this.graph._createEdge(Z,this,J,$);return this[A0][Z]=Q,this.dispatchEvent({type:"change",attribute:Z})}listRefs(Z){return this.assertRefList(Z).values().map(($)=>$.getChild())}addRef(Z,J,$){let Y=this.graph._createEdge(Z,this,J,$);return this.assertRefList(Z).add(Y),this.dispatchEvent({type:"change",attribute:Z})}removeRef(Z,J){let $=this.assertRefList(Z);if($ instanceof D6)for(let Y of $.listRefsByChild(J))Y.dispose();else{let Y=$.getRefByChild(J);if(Y)Y.dispose()}return this}assertRefList(Z){let J=this[A0][Z];if(J instanceof D6||J instanceof N0)return J;throw new Error(`Expected RefList or RefSet for attribute "${Z}"`)}listRefMapKeys(Z){return this.assertRefMap(Z).keys()}listRefMapValues(Z){return this.assertRefMap(Z).values().map((J)=>J.getChild())}getRefMap(Z,J){let Y=this.assertRefMap(Z).get(J);return Y?Y.getChild():null}setRefMap(Z,J,$,Y){let Q=this.assertRefMap(Z),W=Q.get(J);if(W)W.dispose();if(!$)return this;Y=Object.assign(Y||{},{key:J});let X=this.graph._createEdge(Z,this,$,NG({},Y,{key:J}));return Q.set(J,X),this.dispatchEvent({type:"change",attribute:Z,key:J})}assertRefMap(Z){let J=this[A0][Z];if(J instanceof r1)return J;throw new Error(`Expected RefMap for attribute "${Z}"`)}dispatchEvent(Z){return super.dispatchEvent(NG({},Z,{target:this})),this.graph.dispatchEvent(NG({},Z,{target:this,type:`node:${Z.type}`})),this}_destroyRef(Z){let J=Z.getName();if(this[A0][J]===Z){if(this[A0][J]=null,this[F4].has(J))Z.getChild().dispose()}else if(this[A0][J]instanceof D6)this[A0][J].remove(Z);else if(this[A0][J]instanceof N0)this[A0][J].remove(Z);else if(this[A0][J]instanceof r1){let $=this[A0][J];for(let Y of $.keys())if($.get(Y)===Z)$.delete(Y)}else return;this.graph._destroyEdge(Z),this.dispatchEvent({type:"change",attribute:J})}}var Ll="v4.1.1",H2="@glb.bin",a;(function(Z){Z.ACCESSOR="Accessor",Z.ANIMATION="Animation",Z.ANIMATION_CHANNEL="AnimationChannel",Z.ANIMATION_SAMPLER="AnimationSampler",Z.BUFFER="Buffer",Z.CAMERA="Camera",Z.MATERIAL="Material",Z.MESH="Mesh",Z.PRIMITIVE="Primitive",Z.PRIMITIVE_TARGET="PrimitiveTarget",Z.NODE="Node",Z.ROOT="Root",Z.SCENE="Scene",Z.SKIN="Skin",Z.TEXTURE="Texture",Z.TEXTURE_INFO="TextureInfo"})(a||(a={}));var V2;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(V2||(V2={}));var c5;(function(Z){Z.ARRAY_BUFFER="ARRAY_BUFFER",Z.ELEMENT_ARRAY_BUFFER="ELEMENT_ARRAY_BUFFER",Z.INVERSE_BIND_MATRICES="INVERSE_BIND_MATRICES",Z.OTHER="OTHER",Z.SPARSE="SPARSE"})(c5||(c5={}));var q2;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(q2||(q2={}));var YZ;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(YZ||(YZ={}));var GJ={"5120":Int8Array,"5121":Uint8Array,"5122":Int16Array,"5123":Uint16Array,"5125":Uint32Array,"5126":Float32Array},xP=typeof Float32Array!=="undefined"?Float32Array:Array;if(!Math.hypot)Math.hypot=function(){var Z=0,J=arguments.length;while(J--)Z+=arguments[J]*arguments[J];return Math.sqrt(Z)};function BV1(){var Z=new xP(3);if(xP!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function AP(Z){var J=Z[0],$=Z[1],Y=Z[2];return Math.hypot(J,$,Y)}function OV1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=$[3]*Y+$[7]*Q+$[11]*W+$[15];return X=X||1,Z[0]=($[0]*Y+$[4]*Q+$[8]*W+$[12])/X,Z[1]=($[1]*Y+$[5]*Q+$[9]*W+$[13])/X,Z[2]=($[2]*Y+$[6]*Q+$[10]*W+$[14])/X,Z}(function(){var Z=BV1();return function(J,$,Y,Q,W,X){var K,G;if(!$)$=3;if(!Y)Y=0;if(Q)G=Math.min(Q*$+Y,J.length);else G=J.length;for(K=Y;K<G;K+=$)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],W(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}})();function yP(Z){let J=wl(),$=Z.propertyType===a.NODE?[Z]:Z.listChildren();for(let Y of $)Y.traverse((Q)=>{let W=Q.getMesh();if(!W)return;let X=jV1(W,Q.getWorldMatrix());if(X.min.every(isFinite)&&X.max.every(isFinite))hP(X.min,J),hP(X.max,J)});return J}function jV1(Z,J){let $=wl();for(let Y of Z.listPrimitives()){let Q=Y.getAttribute("POSITION"),W=Y.getIndices();if(!Q)continue;let X=[0,0,0],K=[0,0,0];for(let G=0,z=W?W.getCount():Q.getCount();G<z;G++){let H=W?W.getScalar(G):G;X=Q.getElement(H,X),K=OV1(K,X,J),hP(K,$)}}return $}function hP(Z,J){for(let $=0;$<3;$++)J.min[$]=Math.min(Z[$],J.min[$]),J.max[$]=Math.max(Z[$],J.max[$])}function wl(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class n0{static createBufferFromDataURI(Z){if(typeof Buffer==="undefined"){let J=atob(Z.split(",")[1]),$=new Uint8Array(J.length);for(let Y=0;Y<J.length;Y++)$[Y]=J.charCodeAt(Y);return $}else{let J=Z.split(",")[1],$=Z.indexOf("base64")>=0;return Buffer.from(J,$?"base64":"utf8")}}static encodeText(Z){return new TextEncoder().encode(Z)}static decodeText(Z){return new TextDecoder().decode(Z)}static concat(Z){let J=0;for(let Q of Z)J+=Q.byteLength;let $=new Uint8Array(J),Y=0;for(let Q of Z)$.set(Q,Y),Y+=Q.byteLength;return $}static pad(Z,J=0){let $=this.padNumber(Z.byteLength);if($===Z.byteLength)return Z;let Y=new Uint8Array($);if(Y.set(Z),J!==0)for(let Q=Z.byteLength;Q<$;Q++)Y[Q]=J;return Y}static padNumber(Z){return Math.ceil(Z/4)*4}static equals(Z,J){if(Z===J)return!0;if(Z.byteLength!==J.byteLength)return!1;let $=Z.byteLength;while($--)if(Z[$]!==J[$])return!1;return!0}static toView(Z,J=0,$=1/0){return new Uint8Array(Z.buffer,Z.byteOffset+J,Math.min(Z.byteLength,$))}static assertView(Z){if(Z&&!ArrayBuffer.isView(Z))throw new Error(`Method requires Uint8Array parameter; received "${typeof Z}".`);return Z}}class gP{static hexToFactor(Z,J){Z=Math.floor(Z);let $=J;return $[0]=(Z>>16&255)/255,$[1]=(Z>>8&255)/255,$[2]=(Z&255)/255,this.convertSRGBToLinear(J,J)}static factorToHex(Z){let J=[...Z],[$,Y,Q]=this.convertLinearToSRGB(Z,J);return $*255<<16^Y*255<<8^Q*255<<0}static convertSRGBToLinear(Z,J){let $=Z,Y=J;for(let Q=0;Q<3;Q++)Y[Q]=$[Q]<0.04045?$[Q]*0.0773993808:Math.pow($[Q]*0.9478672986+0.0521327014,2.4);return J}static convertLinearToSRGB(Z,J){let $=Z,Y=J;for(let Q=0;Q<3;Q++)Y[Q]=$[Q]<0.0031308?$[Q]*12.92:1.055*Math.pow($[Q],0.41666)-0.055;return J}}class Bl{match(Z){return Z.length>=3&&Z[0]===255&&Z[1]===216&&Z[2]===255}getSize(Z){let J=new DataView(Z.buffer,Z.byteOffset+4),$,Y;while(J.byteLength){if($=J.getUint16(0,!1),MV1(J,$),Y=J.getUint8($+1),Y===192||Y===193||Y===194)return[J.getUint16($+7,!1),J.getUint16($+5,!1)];J=new DataView(Z.buffer,J.byteOffset+$+2)}throw new TypeError("Invalid JPG, no size found")}getChannels(Z){return 3}}class L2{match(Z){return Z.length>=8&&Z[0]===137&&Z[1]===80&&Z[2]===78&&Z[3]===71&&Z[4]===13&&Z[5]===10&&Z[6]===26&&Z[7]===10}getSize(Z){let J=new DataView(Z.buffer,Z.byteOffset);if(n0.decodeText(Z.slice(12,16))===L2.PNG_FRIED_CHUNK_NAME)return[J.getUint32(32,!1),J.getUint32(36,!1)];return[J.getUint32(16,!1),J.getUint32(20,!1)]}getChannels(Z){return 4}}L2.PNG_FRIED_CHUNK_NAME="CgBI";class QZ{static registerFormat(Z,J){this.impls[Z]=J}static getMimeType(Z){for(let J in this.impls)if(this.impls[J].match(Z))return J;return null}static getSize(Z,J){if(!this.impls[J])return null;return this.impls[J].getSize(Z)}static getChannels(Z,J){if(!this.impls[J])return null;return this.impls[J].getChannels(Z)}static getVRAMByteLength(Z,J){if(!this.impls[J])return null;if(this.impls[J].getVRAMByteLength)return this.impls[J].getVRAMByteLength(Z);let $=0,Y=4,Q=this.getSize(Z,J);if(!Q)return null;while(Q[0]>1||Q[1]>1)$+=Q[0]*Q[1]*Y,Q[0]=Math.max(Math.floor(Q[0]/2),1),Q[1]=Math.max(Math.floor(Q[1]/2),1);return $+=1*Y,$}static mimeTypeToExtension(Z){if(Z==="image/jpeg")return"jpg";return Z.split("/").pop()}static extensionToMimeType(Z){if(Z==="jpg")return"image/jpeg";if(!Z)return"";return`image/${Z}`}}QZ.impls={"image/jpeg":new Bl,"image/png":new L2};function MV1(Z,J){if(J>Z.byteLength)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(Z.getUint8(J)!==255)throw new TypeError("Invalid JPG, marker table corrupted");return Z}class WZ{static basename(Z){let J=Z.split(/[\\/]/).pop();return J.substring(0,J.lastIndexOf("."))}static extension(Z){if(Z.startsWith("data:image/")){let J=Z.match(/data:(image\/\w+)/)[1];return QZ.mimeTypeToExtension(J)}else if(Z.startsWith("data:model/gltf+json"))return"gltf";else if(Z.startsWith("data:model/gltf-binary"))return"glb";else if(Z.startsWith("data:application/"))return"bin";return Z.split(/[\\/]/).pop().split(/[.]/).pop()}}function zl(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function e$(Z){if(zl(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let $=J.prototype;if(zl($)===!1)return!1;if(Object.prototype.hasOwnProperty.call($,"isPrototypeOf")===!1)return!1;return!0}var fP,PG;(function(Z){Z[Z.SILENT=4]="SILENT",Z[Z.ERROR=3]="ERROR",Z[Z.WARN=2]="WARN",Z[Z.INFO=1]="INFO",Z[Z.DEBUG=0]="DEBUG"})(PG||(PG={}));class j5{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=j5.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=j5.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=j5.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=j5.Verbosity.ERROR)console.error(Z)}}fP=j5;j5.Verbosity=PG;j5.DEFAULT_INSTANCE=new fP(fP.Verbosity.INFO);function RV1(Z){var J=Z[0],$=Z[1],Y=Z[2],Q=Z[3],W=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],H=Z[9],V=Z[10],q=Z[11],F=Z[12],U=Z[13],w=Z[14],L=Z[15],O=J*X-$*W,j=J*K-Y*W,M=J*G-Q*W,N=$*K-Y*X,D=$*G-Q*X,P=Y*G-Q*K,C=z*U-H*F,T=z*w-V*F,E=z*L-q*F,A=H*w-V*U,S=H*L-q*U,x=V*L-q*w;return O*x-j*S+M*A+N*E-D*T+P*C}function NV1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=J[9],F=J[10],U=J[11],w=J[12],L=J[13],O=J[14],j=J[15],M=$[0],N=$[1],D=$[2],P=$[3];return Z[0]=M*Y+N*K+D*V+P*w,Z[1]=M*Q+N*G+D*q+P*L,Z[2]=M*W+N*z+D*F+P*O,Z[3]=M*X+N*H+D*U+P*j,M=$[4],N=$[5],D=$[6],P=$[7],Z[4]=M*Y+N*K+D*V+P*w,Z[5]=M*Q+N*G+D*q+P*L,Z[6]=M*W+N*z+D*F+P*O,Z[7]=M*X+N*H+D*U+P*j,M=$[8],N=$[9],D=$[10],P=$[11],Z[8]=M*Y+N*K+D*V+P*w,Z[9]=M*Q+N*G+D*q+P*L,Z[10]=M*W+N*z+D*F+P*O,Z[11]=M*X+N*H+D*U+P*j,M=$[12],N=$[13],D=$[14],P=$[15],Z[12]=M*Y+N*K+D*V+P*w,Z[13]=M*Q+N*G+D*q+P*L,Z[14]=M*W+N*z+D*F+P*O,Z[15]=M*X+N*H+D*U+P*j,Z}function PV1(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[4],X=J[5],K=J[6],G=J[8],z=J[9],H=J[10];return Z[0]=Math.hypot($,Y,Q),Z[1]=Math.hypot(W,X,K),Z[2]=Math.hypot(G,z,H),Z}function DV1(Z,J){var $=new xP(3);PV1($,J);var Y=1/$[0],Q=1/$[1],W=1/$[2],X=J[0]*Y,K=J[1]*Q,G=J[2]*W,z=J[4]*Y,H=J[5]*Q,V=J[6]*W,q=J[8]*Y,F=J[9]*Q,U=J[10]*W,w=X+H+U,L=0;if(w>0)L=Math.sqrt(w+1)*2,Z[3]=0.25*L,Z[0]=(V-F)/L,Z[1]=(q-G)/L,Z[2]=(K-z)/L;else if(X>H&&X>U)L=Math.sqrt(1+X-H-U)*2,Z[3]=(V-F)/L,Z[0]=0.25*L,Z[1]=(K+z)/L,Z[2]=(q+G)/L;else if(H>U)L=Math.sqrt(1+H-X-U)*2,Z[3]=(q-G)/L,Z[0]=(K+z)/L,Z[1]=0.25*L,Z[2]=(V+F)/L;else L=Math.sqrt(1+U-X-H)*2,Z[3]=(K-z)/L,Z[0]=(q+G)/L,Z[1]=(V+F)/L,Z[2]=0.25*L;return Z}class d0{static identity(Z){return Z}static eq(Z,J,$=0.00001){if(Z.length!==J.length)return!1;for(let Y=0;Y<Z.length;Y++)if(Math.abs(Z[Y]-J[Y])>$)return!1;return!0}static clamp(Z,J,$){if(Z<J)return J;if(Z>$)return $;return Z}static decodeNormalizedInt(Z,J){switch(J){case 5126:return Z;case 5123:return Z/65535;case 5121:return Z/255;case 5122:return Math.max(Z/32767,-1);case 5120:return Math.max(Z/127,-1);default:throw new Error("Invalid component type.")}}static encodeNormalizedInt(Z,J){switch(J){case 5126:return Z;case 5123:return Math.round(d0.clamp(Z,0,1)*65535);case 5121:return Math.round(d0.clamp(Z,0,1)*255);case 5122:return Math.round(d0.clamp(Z,-1,1)*32767);case 5120:return Math.round(d0.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,$,Y){let Q=AP([Z[0],Z[1],Z[2]]),W=AP([Z[4],Z[5],Z[6]]),X=AP([Z[8],Z[9],Z[10]]);if(RV1(Z)<0)Q=-Q;J[0]=Z[12],J[1]=Z[13],J[2]=Z[14];let G=Z.slice(),z=1/Q,H=1/W,V=1/X;G[0]*=z,G[1]*=z,G[2]*=z,G[4]*=H,G[5]*=H,G[6]*=H,G[8]*=V,G[9]*=V,G[10]*=V,DV1($,G),Y[0]=Q,Y[1]=W,Y[2]=X}static compose(Z,J,$,Y){let Q=Y,W=J[0],X=J[1],K=J[2],G=J[3],z=W+W,H=X+X,V=K+K,q=W*z,F=W*H,U=W*V,w=X*H,L=X*V,O=K*V,j=G*z,M=G*H,N=G*V,D=$[0],P=$[1],C=$[2];return Q[0]=(1-(w+O))*D,Q[1]=(F+N)*D,Q[2]=(U-M)*D,Q[3]=0,Q[4]=(F-N)*P,Q[5]=(1-(q+O))*P,Q[6]=(L+j)*P,Q[7]=0,Q[8]=(U+M)*C,Q[9]=(L-j)*C,Q[10]=(1-(q+w))*C,Q[11]=0,Q[12]=Z[0],Q[13]=Z[1],Q[14]=Z[2],Q[15]=1,Q}}function CV1(Z,J){if(!!Z!==!!J)return!1;let $=Z.getChild(),Y=J.getChild();return $===Y||$.equals(Y)}function TV1(Z,J){if(!!Z!==!!J)return!1;let $=Z.values(),Y=J.values();if($.length!==Y.length)return!1;for(let Q=0;Q<$.length;Q++){let W=$[Q],X=Y[Q];if(W.getChild()===X.getChild())continue;if(!W.getChild().equals(X.getChild()))return!1}return!0}function kV1(Z,J){if(!!Z!==!!J)return!1;let $=Z.keys(),Y=J.keys();if($.length!==Y.length)return!1;for(let Q of $){let W=Z.get(Q),X=J.get(Q);if(!!W!==!!X)return!1;let K=W.getChild(),G=X.getChild();if(K===G)continue;if(!K.equals(G))return!1}return!0}function Ol(Z,J){if(Z===J)return!0;if(!!Z!==!!J||!Z||!J)return!1;if(Z.length!==J.length)return!1;for(let $=0;$<Z.length;$++)if(Z[$]!==J[$])return!1;return!0}function jl(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!e$(Z)||!e$(J))return Z===J;let $=Z,Y=J,Q=0,W=0,X;for(X in $)Q++;for(X in Y)W++;if(Q!==W)return!1;for(X in $){let K=$[X],G=Y[X];if(F2(K)&&F2(G)){if(!Ol(K,G))return!1}else if(e$(K)&&e$(G)){if(!jl(K,G))return!1}else if(K!==G)return!1}return!0}function F2(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var Hl="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ",EV1=999,IV1=6,Vl=new Set,vV1=function Z(){let J="";for(let $=0;$<IV1;$++)J+=Hl.charAt(Math.floor(Math.random()*Hl.length));return J},Ml=function Z(){for(let J=0;J<EV1;J++){let $=vV1();if(!Vl.has($))return Vl.add($),$}return""},ql="https://null.example";class B9{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return WZ.basename(new URL(Z,ql).pathname)}static extension(Z){return WZ.extension(new URL(Z,ql).pathname)}static resolve(Z,J){if(!this.isRelativePath(J))return J;let $=Z.split("/"),Y=J.split("/");$.pop();for(let Q=0;Q<Y.length;Q++){if(Y[Q]===".")continue;if(Y[Q]==="..")$.pop();else $.push(Y[Q])}return $.join("/")}static isAbsoluteURL(Z){return this.PROTOCOL_REGEXP.test(Z)}static isRelativePath(Z){return!/^(?:[a-zA-Z]+:)?\//.test(Z)}}B9.DEFAULT_INIT={};B9.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var KJ=(Z)=>Z,SV1=new Set;class w2 extends gW{constructor(Z,J=""){super(Z);this[A0].name=J,this.init(),this.dispatchEvent({type:"create"})}getGraph(){return this.graph}getDefaults(){return Object.assign(super.getDefaults(),{name:"",extras:{}})}set(Z,J){if(Array.isArray(J))J=J.slice();return super.set(Z,J)}getName(){return this.get("name")}setName(Z){return this.set("name",Z)}getExtras(){return this.get("extras")}setExtras(Z){return this.set("extras",Z)}clone(){return new this.constructor(this.graph).copy(this,KJ)}copy(Z,J=KJ){for(let $ in this[A0]){let Y=this[A0][$];if(Y instanceof B5){if(!this[F4].has($))Y.dispose()}else if(Y instanceof D6||Y instanceof N0)for(let Q of Y.values())Q.dispose();else if(Y instanceof r1)for(let Q of Y.values())Q.dispose()}for(let $ in Z[A0]){let Y=this[A0][$],Q=Z[A0][$];if(Q instanceof B5)if(this[F4].has($))Y.getChild().copy(J(Q.getChild()),J);else this.setRef($,J(Q.getChild()),Q.getAttributes());else if(Q instanceof N0||Q instanceof D6)for(let W of Q.values())this.addRef($,J(W.getChild()),W.getAttributes());else if(Q instanceof r1)for(let W of Q.keys()){let X=Q.get(W);this.setRefMap($,W,J(X.getChild()),X.getAttributes())}else if(e$(Q))this[A0][$]=JSON.parse(JSON.stringify(Q));else if(Array.isArray(Q)||Q instanceof ArrayBuffer||ArrayBuffer.isView(Q))this[A0][$]=Q.slice();else this[A0][$]=Q}return this}equals(Z,J=SV1){if(this===Z)return!0;if(this.propertyType!==Z.propertyType)return!1;for(let $ in this[A0]){if(J.has($))continue;let Y=this[A0][$],Q=Z[A0][$];if(Y instanceof B5||Q instanceof B5){if(!CV1(Y,Q))return!1}else if(Y instanceof N0||Q instanceof N0||Y instanceof D6||Q instanceof D6){if(!TV1(Y,Q))return!1}else if(Y instanceof r1||Q instanceof r1){if(!kV1(Y,Q))return!1}else if(e$(Y)||e$(Q)){if(!jl(Y,Q))return!1}else if(F2(Y)||F2(Q)){if(!Ol(Y,Q))return!1}else if(Y!==Q)return!1}return!0}detach(){return this.graph.disconnectParents(this,(Z)=>Z.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}}class T6 extends w2{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new r1})}getExtension(Z){return this.getRefMap("extensions",Z)}setExtension(Z,J){if(J)J._validateParent(this);return this.setRefMap("extensions",Z,J)}listExtensions(){return this.listRefMapValues("extensions")}}class I0 extends T6{init(){this.propertyType=a.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:I0.Type.SCALAR,componentType:I0.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(Z){switch(Z){case I0.Type.SCALAR:return 1;case I0.Type.VEC2:return 2;case I0.Type.VEC3:return 3;case I0.Type.VEC4:return 4;case I0.Type.MAT2:return 4;case I0.Type.MAT3:return 9;case I0.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+Z)}}static getComponentSize(Z){switch(Z){case I0.ComponentType.BYTE:return 1;case I0.ComponentType.UNSIGNED_BYTE:return 1;case I0.ComponentType.SHORT:return 2;case I0.ComponentType.UNSIGNED_SHORT:return 2;case I0.ComponentType.UNSIGNED_INT:return 4;case I0.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+Z)}}getMinNormalized(Z){let J=this.getNormalized(),$=this.getElementSize(),Y=this.getComponentType();if(this.getMin(Z),J)for(let Q=0;Q<$;Q++)Z[Q]=d0.decodeNormalizedInt(Z[Q],Y);return Z}getMin(Z){let J=this.getArray(),$=this.getCount(),Y=this.getElementSize();for(let Q=0;Q<Y;Q++)Z[Q]=1/0;for(let Q=0;Q<$*Y;Q+=Y)for(let W=0;W<Y;W++){let X=J[Q+W];if(Number.isFinite(X))Z[W]=Math.min(Z[W],X)}return Z}getMaxNormalized(Z){let J=this.getNormalized(),$=this.getElementSize(),Y=this.getComponentType();if(this.getMax(Z),J)for(let Q=0;Q<$;Q++)Z[Q]=d0.decodeNormalizedInt(Z[Q],Y);return Z}getMax(Z){let J=this.get("array"),$=this.getCount(),Y=this.getElementSize();for(let Q=0;Q<Y;Q++)Z[Q]=-1/0;for(let Q=0;Q<$*Y;Q+=Y)for(let W=0;W<Y;W++){let X=J[Q+W];if(Number.isFinite(X))Z[W]=Math.max(Z[W],X)}return Z}getCount(){let Z=this.get("array");return Z?Z.length/this.getElementSize():0}getType(){return this.get("type")}setType(Z){return this.set("type",Z)}getElementSize(){return I0.getElementSize(this.get("type"))}getComponentSize(){return this.get("array").BYTES_PER_ELEMENT}getComponentType(){return this.get("componentType")}getNormalized(){return this.get("normalized")}setNormalized(Z){return this.set("normalized",Z)}getScalar(Z){let J=this.getElementSize(),$=this.getComponentType(),Y=this.getArray();if(this.getNormalized())return d0.decodeNormalizedInt(Y[Z*J],$);return Y[Z*J]}setScalar(Z,J){let $=this.getElementSize(),Y=this.getComponentType(),Q=this.getArray();if(this.getNormalized())Q[Z*$]=d0.encodeNormalizedInt(J,Y);else Q[Z*$]=J;return this}getElement(Z,J){let $=this.getNormalized(),Y=this.getElementSize(),Q=this.getComponentType(),W=this.getArray();for(let X=0;X<Y;X++)if($)J[X]=d0.decodeNormalizedInt(W[Z*Y+X],Q);else J[X]=W[Z*Y+X];return J}setElement(Z,J){let $=this.getNormalized(),Y=this.getElementSize(),Q=this.getComponentType(),W=this.getArray();for(let X=0;X<Y;X++)if($)W[Z*Y+X]=d0.encodeNormalizedInt(J[X],Q);else W[Z*Y+X]=J[X];return this}getSparse(){return this.get("sparse")}setSparse(Z){return this.set("sparse",Z)}getBuffer(){return this.getRef("buffer")}setBuffer(Z){return this.setRef("buffer",Z)}getArray(){return this.get("array")}setArray(Z){return this.set("componentType",Z?_V1(Z):I0.ComponentType.FLOAT),this.set("array",Z),this}getByteLength(){let Z=this.get("array");return Z?Z.byteLength:0}}I0.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};I0.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function _V1(Z){switch(Z.constructor){case Float32Array:return I0.ComponentType.FLOAT;case Uint32Array:return I0.ComponentType.UNSIGNED_INT;case Uint16Array:return I0.ComponentType.UNSIGNED_SHORT;case Uint8Array:return I0.ComponentType.UNSIGNED_BYTE;case Int16Array:return I0.ComponentType.SHORT;case Int8Array:return I0.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class mP extends T6{init(){this.propertyType=a.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new N0,samplers:new N0})}addChannel(Z){return this.addRef("channels",Z)}removeChannel(Z){return this.removeRef("channels",Z)}listChannels(){return this.listRefs("channels")}addSampler(Z){return this.addRef("samplers",Z)}removeSampler(Z){return this.removeRef("samplers",Z)}listSamplers(){return this.listRefs("samplers")}}class ZY extends T6{init(){this.propertyType=a.ANIMATION_CHANNEL}getDefaults(){return Object.assign(super.getDefaults(),{targetPath:null,targetNode:null,sampler:null})}getTargetPath(){return this.get("targetPath")}setTargetPath(Z){return this.set("targetPath",Z)}getTargetNode(){return this.getRef("targetNode")}setTargetNode(Z){return this.setRef("targetNode",Z)}getSampler(){return this.getRef("sampler")}setSampler(Z){return this.setRef("sampler",Z)}}ZY.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class mW extends T6{init(){this.propertyType=a.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:mW.Interpolation.LINEAR,input:null,output:null})}getInterpolation(){return this.get("interpolation")}setInterpolation(Z){return this.set("interpolation",Z)}getInput(){return this.getRef("input")}setInput(Z){return this.setRef("input",Z,{usage:c5.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:c5.OTHER})}}mW.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class uP extends T6{init(){this.propertyType=a.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(Z){return this.set("uri",Z)}}class JY extends T6{init(){this.propertyType=a.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:JY.Type.PERSPECTIVE,znear:0.1,zfar:100,aspectRatio:null,yfov:Math.PI*2*50/360,xmag:1,ymag:1})}getType(){return this.get("type")}setType(Z){return this.set("type",Z)}getZNear(){return this.get("znear")}setZNear(Z){return this.set("znear",Z)}getZFar(){return this.get("zfar")}setZFar(Z){return this.set("zfar",Z)}getAspectRatio(){return this.get("aspectRatio")}setAspectRatio(Z){return this.set("aspectRatio",Z)}getYFov(){return this.get("yfov")}setYFov(Z){return this.set("yfov",Z)}getXMag(){return this.get("xmag")}setXMag(Z){return this.set("xmag",Z)}getYMag(){return this.get("ymag")}setYMag(Z){return this.set("ymag",Z)}}JY.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class uW extends w2{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}uW.EXTENSION_NAME=void 0;class O5 extends T6{init(){this.propertyType=a.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:O5.WrapMode.REPEAT,wrapT:O5.WrapMode.REPEAT})}getTexCoord(){return this.get("texCoord")}setTexCoord(Z){return this.set("texCoord",Z)}getMagFilter(){return this.get("magFilter")}setMagFilter(Z){return this.set("magFilter",Z)}getMinFilter(){return this.get("minFilter")}setMinFilter(Z){return this.set("minFilter",Z)}getWrapS(){return this.get("wrapS")}setWrapS(Z){return this.set("wrapS",Z)}getWrapT(){return this.get("wrapT")}setWrapT(Z){return this.set("wrapT",Z)}}O5.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};O5.MagFilter={NEAREST:9728,LINEAR:9729};O5.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:W2,G:X2,B:K2,A:AV1}=q2;class r4 extends T6{init(){this.propertyType=a.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:r4.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new O5(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new O5(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new O5(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new O5(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new O5(this.graph,"metallicRoughnessTextureInfo")})}getDoubleSided(){return this.get("doubleSided")}setDoubleSided(Z){return this.set("doubleSided",Z)}getAlpha(){return this.get("baseColorFactor")[3]}setAlpha(Z){let J=this.get("baseColorFactor").slice();return J[3]=Z,this.set("baseColorFactor",J)}getAlphaMode(){return this.get("alphaMode")}setAlphaMode(Z){return this.set("alphaMode",Z)}getAlphaCutoff(){return this.get("alphaCutoff")}setAlphaCutoff(Z){return this.set("alphaCutoff",Z)}getBaseColorFactor(){return this.get("baseColorFactor")}setBaseColorFactor(Z){return this.set("baseColorFactor",Z)}getBaseColorTexture(){return this.getRef("baseColorTexture")}getBaseColorTextureInfo(){return this.getRef("baseColorTexture")?this.getRef("baseColorTextureInfo"):null}setBaseColorTexture(Z){return this.setRef("baseColorTexture",Z,{channels:W2|X2|K2|AV1,isColor:!0})}getEmissiveFactor(){return this.get("emissiveFactor")}setEmissiveFactor(Z){return this.set("emissiveFactor",Z)}getEmissiveTexture(){return this.getRef("emissiveTexture")}getEmissiveTextureInfo(){return this.getRef("emissiveTexture")?this.getRef("emissiveTextureInfo"):null}setEmissiveTexture(Z){return this.setRef("emissiveTexture",Z,{channels:W2|X2|K2,isColor:!0})}getNormalScale(){return this.get("normalScale")}setNormalScale(Z){return this.set("normalScale",Z)}getNormalTexture(){return this.getRef("normalTexture")}getNormalTextureInfo(){return this.getRef("normalTexture")?this.getRef("normalTextureInfo"):null}setNormalTexture(Z){return this.setRef("normalTexture",Z,{channels:W2|X2|K2})}getOcclusionStrength(){return this.get("occlusionStrength")}setOcclusionStrength(Z){return this.set("occlusionStrength",Z)}getOcclusionTexture(){return this.getRef("occlusionTexture")}getOcclusionTextureInfo(){return this.getRef("occlusionTexture")?this.getRef("occlusionTextureInfo"):null}setOcclusionTexture(Z){return this.setRef("occlusionTexture",Z,{channels:W2})}getRoughnessFactor(){return this.get("roughnessFactor")}setRoughnessFactor(Z){return this.set("roughnessFactor",Z)}getMetallicFactor(){return this.get("metallicFactor")}setMetallicFactor(Z){return this.set("metallicFactor",Z)}getMetallicRoughnessTexture(){return this.getRef("metallicRoughnessTexture")}getMetallicRoughnessTextureInfo(){return this.getRef("metallicRoughnessTexture")?this.getRef("metallicRoughnessTextureInfo"):null}setMetallicRoughnessTexture(Z){return this.setRef("metallicRoughnessTexture",Z,{channels:X2|K2})}}r4.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class CG extends T6{init(){this.propertyType=a.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new N0})}addPrimitive(Z){return this.addRef("primitives",Z)}removePrimitive(Z){return this.removeRef("primitives",Z)}listPrimitives(){return this.listRefs("primitives")}getWeights(){return this.get("weights")}setWeights(Z){return this.set("weights",Z)}}class B2 extends T6{init(){this.propertyType=a.NODE}getDefaults(){return Object.assign(super.getDefaults(),{translation:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1],weights:[],camera:null,mesh:null,skin:null,children:new N0})}copy(Z,J=KJ){if(J===KJ)throw new Error("Node cannot be copied.");return super.copy(Z,J)}getTranslation(){return this.get("translation")}getRotation(){return this.get("rotation")}getScale(){return this.get("scale")}setTranslation(Z){return this.set("translation",Z)}setRotation(Z){return this.set("rotation",Z)}setScale(Z){return this.set("scale",Z)}getMatrix(){return d0.compose(this.get("translation"),this.get("rotation"),this.get("scale"),[])}setMatrix(Z){let J=this.get("translation").slice(),$=this.get("rotation").slice(),Y=this.get("scale").slice();return d0.decompose(Z,J,$,Y),this.set("translation",J).set("rotation",$).set("scale",Y)}getWorldTranslation(){let Z=[0,0,0];return d0.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return d0.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return d0.decompose(this.getWorldMatrix(),[0,0,0],[0,0,0,1],Z),Z}getWorldMatrix(){let Z=[];for(let Y=this;Y!=null;Y=Y.getParentNode())Z.push(Y);let J,$=Z.pop().getMatrix();while(J=Z.pop())NV1($,$,J.getMatrix());return $}addChild(Z){let J=Z.getParentNode();if(J)J.removeChild(Z);for(let $ of Z.listParents())if($.propertyType===a.SCENE)$.removeChild(Z);return this.addRef("children",Z)}removeChild(Z){return this.removeRef("children",Z)}listChildren(){return this.listRefs("children")}getParentNode(){for(let Z of this.listParents())if(Z.propertyType===a.NODE)return Z;return null}getMesh(){return this.getRef("mesh")}setMesh(Z){return this.setRef("mesh",Z)}getCamera(){return this.getRef("camera")}setCamera(Z){return this.setRef("camera",Z)}getSkin(){return this.getRef("skin")}setSkin(Z){return this.setRef("skin",Z)}getWeights(){return this.get("weights")}setWeights(Z){return this.set("weights",Z)}traverse(Z){Z(this);for(let J of this.listChildren())J.traverse(Z);return this}}class R8 extends T6{init(){this.propertyType=a.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:R8.Mode.TRIANGLES,material:null,indices:null,attributes:new r1,targets:new N0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:c5.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:c5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}getMaterial(){return this.getRef("material")}setMaterial(Z){return this.setRef("material",Z)}getMode(){return this.get("mode")}setMode(Z){return this.set("mode",Z)}listTargets(){return this.listRefs("targets")}addTarget(Z){return this.addRef("targets",Z)}removeTarget(Z){return this.removeRef("targets",Z)}}R8.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class dP extends w2{init(){this.propertyType=a.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new r1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:c5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function p6(){return p6=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var $=arguments[J];for(var Y in $)({}).hasOwnProperty.call($,Y)&&(Z[Y]=$[Y])}return Z},p6.apply(null,arguments)}class dW extends T6{init(){this.propertyType=a.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new N0})}copy(Z,J=KJ){if(J===KJ)throw new Error("Scene cannot be copied.");return super.copy(Z,J)}addChild(Z){let J=Z.getParentNode();if(J)J.removeChild(Z);return this.addRef("children",Z)}removeChild(Z){return this.removeRef("children",Z)}listChildren(){return this.listRefs("children")}traverse(Z){for(let J of this.listChildren())J.traverse(Z);return this}}class cP extends T6{init(){this.propertyType=a.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new N0})}getSkeleton(){return this.getRef("skeleton")}setSkeleton(Z){return this.setRef("skeleton",Z)}getInverseBindMatrices(){return this.getRef("inverseBindMatrices")}setInverseBindMatrices(Z){return this.setRef("inverseBindMatrices",Z,{usage:c5.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class $Y extends T6{init(){this.propertyType=a.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||QZ.extensionToMimeType(WZ.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=QZ.extensionToMimeType(WZ.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",n0.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return QZ.getSize(Z,this.getMimeType())}}class YY extends T6{init(){this.propertyType=a.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${Ll}`,version:"2.0"},defaultScene:null,accessors:new N0,animations:new N0,buffers:new N0,cameras:new N0,materials:new N0,meshes:new N0,nodes:new N0,scenes:new N0,skins:new N0,textures:new N0})}constructor(Z){super(Z);this._extensions=new Set,Z.addEventListener("node:create",(J)=>{this._addChildOfRoot(J.target)})}clone(){throw new Error("Root cannot be cloned.")}copy(Z,J=KJ){if(J===KJ)throw new Error("Root cannot be copied.");this.set("asset",p6({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(p6({},Z.getExtras())),this.setDefaultScene(Z.getDefaultScene()?J(Z.getDefaultScene()):null);for(let $ of Z.listRefMapKeys("extensions")){let Y=Z.getExtension($);this.setExtension($,J(Y))}return this}_addChildOfRoot(Z){if(Z instanceof dW)this.addRef("scenes",Z);else if(Z instanceof B2)this.addRef("nodes",Z);else if(Z instanceof JY)this.addRef("cameras",Z);else if(Z instanceof cP)this.addRef("skins",Z);else if(Z instanceof CG)this.addRef("meshes",Z);else if(Z instanceof r4)this.addRef("materials",Z);else if(Z instanceof $Y)this.addRef("textures",Z);else if(Z instanceof mP)this.addRef("animations",Z);else if(Z instanceof I0)this.addRef("accessors",Z);else if(Z instanceof uP)this.addRef("buffers",Z);return this}getAsset(){return this.get("asset")}listExtensionsUsed(){return Array.from(this._extensions)}listExtensionsRequired(){return this.listExtensionsUsed().filter((Z)=>Z.isRequired())}_enableExtension(Z){return this._extensions.add(Z),this}_disableExtension(Z){return this._extensions.delete(Z),this}listScenes(){return this.listRefs("scenes")}setDefaultScene(Z){return this.setRef("defaultScene",Z)}getDefaultScene(){return this.getRef("defaultScene")}listNodes(){return this.listRefs("nodes")}listCameras(){return this.listRefs("cameras")}listSkins(){return this.listRefs("skins")}listMeshes(){return this.listRefs("meshes")}listMaterials(){return this.listRefs("materials")}listTextures(){return this.listRefs("textures")}listAnimations(){return this.listRefs("animations")}listAccessors(){return this.listRefs("accessors")}listBuffers(){return this.listRefs("buffers")}}class C6{static fromGraph(Z){return C6._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new yW,this._root=new YY(this._graph),this._logger=j5.DEFAULT_INSTANCE,C6._GRAPH_DOCUMENTS.set(this._graph,this)}getRoot(){return this._root}getGraph(){return this._graph}getLogger(){return this._logger}setLogger(Z){return this._logger=Z,this}clone(){throw new Error("Use 'cloneDocument(source)' from '@gltf-transform/functions'.")}merge(Z){throw new Error("Use 'mergeDocuments(target, source)' from '@gltf-transform/functions'.")}async transform(...Z){let J=Z.map(($)=>$.name);for(let $ of Z)await $(this,{stack:J});return this}createExtension(Z){let J=Z.EXTENSION_NAME;return this.getRoot().listExtensionsUsed().find((Y)=>Y.extensionName===J)||new Z(this)}createScene(Z=""){return new dW(this._graph,Z)}createNode(Z=""){return new B2(this._graph,Z)}createCamera(Z=""){return new JY(this._graph,Z)}createSkin(Z=""){return new cP(this._graph,Z)}createMesh(Z=""){return new CG(this._graph,Z)}createPrimitive(){return new R8(this._graph)}createPrimitiveTarget(Z=""){return new dP(this._graph,Z)}createMaterial(Z=""){return new r4(this._graph,Z)}createTexture(Z=""){return new $Y(this._graph,Z)}createAnimation(Z=""){return new mP(this._graph,Z)}createAnimationChannel(Z=""){return new ZY(this._graph,Z)}createAnimationSampler(Z=""){return new mW(this._graph,Z)}createAccessor(Z="",J=null){if(!J)J=this.getRoot().listBuffers()[0];return new I0(this._graph,Z).setBuffer(J)}createBuffer(Z=""){return new uP(this._graph,Z)}}C6._GRAPH_DOCUMENTS=new WeakMap;class Rl{constructor(Z){this.extensionName="",this.prereadTypes=[],this.prewriteTypes=[],this.readDependencies=[],this.writeDependencies=[],this.document=void 0,this.required=!1,this.properties=new Set,this._listener=void 0,this.document=Z,Z.getRoot()._enableExtension(this),this._listener=($)=>{let Y=$,Q=Y.target;if(Q instanceof uW&&Q.extensionName===this.extensionName){if(Y.type==="node:create")this._addExtensionProperty(Q);if(Y.type==="node:dispose")this._removeExtensionProperty(Q)}};let J=Z.getGraph();J.addEventListener("node:create",this._listener),J.addEventListener("node:dispose",this._listener)}dispose(){this.document.getRoot()._disableExtension(this);let Z=this.document.getGraph();Z.removeEventListener("node:create",this._listener),Z.removeEventListener("node:dispose",this._listener);for(let J of this.properties)J.dispose()}static register(){}isRequired(){return this.required}setRequired(Z){return this.required=Z,this}listProperties(){return Array.from(this.properties)}_addExtensionProperty(Z){return this.properties.add(Z),this}_removeExtensionProperty(Z){return this.properties.delete(Z),this}install(Z,J){return this}preread(Z,J){return this}prewrite(Z,J){return this}}Rl.EXTENSION_NAME=void 0;class Nl{constructor(Z){this.jsonDoc=void 0,this.buffers=[],this.bufferViews=[],this.bufferViewBuffers=[],this.accessors=[],this.textures=[],this.textureInfos=new Map,this.materials=[],this.meshes=[],this.cameras=[],this.nodes=[],this.skins=[],this.animations=[],this.scenes=[],this.jsonDoc=Z}setTextureInfo(Z,J){if(this.textureInfos.set(Z,J),J.texCoord!==void 0)Z.setTexCoord(J.texCoord);if(J.extras!==void 0)Z.setExtras(J.extras);let $=this.jsonDoc.json.textures[J.index];if($.sampler===void 0)return;let Y=this.jsonDoc.json.samplers[$.sampler];if(Y.magFilter!==void 0)Z.setMagFilter(Y.magFilter);if(Y.minFilter!==void 0)Z.setMinFilter(Y.minFilter);if(Y.wrapS!==void 0)Z.setWrapS(Y.wrapS);if(Y.wrapT!==void 0)Z.setWrapT(Y.wrapT)}}var Fl={logger:j5.DEFAULT_INSTANCE,extensions:[],dependencies:{}},xV1=new Set([a.BUFFER,a.TEXTURE,a.MATERIAL,a.MESH,a.PRIMITIVE,a.NODE,a.SCENE]);class Pl{static read(Z,J=Fl){let $=p6({},Fl,J),{json:Y}=Z,Q=new C6().setLogger($.logger);this.validate(Z,$);let W=new Nl(Z),X=Y.asset,K=Q.getRoot().getAsset();if(X.copyright)K.copyright=X.copyright;if(X.extras)K.extras=X.extras;if(Y.extras!==void 0)Q.getRoot().setExtras(p6({},Y.extras));let G=Y.extensionsUsed||[],z=Y.extensionsRequired||[];$.extensions.sort((P,C)=>P.EXTENSION_NAME>C.EXTENSION_NAME?1:-1);for(let P of $.extensions)if(G.includes(P.EXTENSION_NAME)){let C=Q.createExtension(P).setRequired(z.includes(P.EXTENSION_NAME)),T=C.prereadTypes.filter((E)=>!xV1.has(E));if(T.length)$.logger.warn(`Preread hooks for some types (${T.join()}), requested by extension ${C.extensionName}, are unsupported. Please file an issue or a PR.`);for(let E of C.readDependencies)C.install(E,$.dependencies[E])}let H=Y.buffers||[];Q.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.BUFFER)).forEach((P)=>P.preread(W,a.BUFFER)),W.buffers=H.map((P)=>{let C=Q.createBuffer(P.name);if(P.extras)C.setExtras(P.extras);if(P.uri&&P.uri.indexOf("__")!==0)C.setURI(P.uri);return C});let V=Y.bufferViews||[];W.bufferViewBuffers=V.map((P,C)=>{if(!W.bufferViews[C]){let T=Z.json.buffers[P.buffer],E=T.uri?Z.resources[T.uri]:Z.resources[H2],A=P.byteOffset||0;W.bufferViews[C]=n0.toView(E,A,P.byteLength)}return W.buffers[P.buffer]});let q=Y.accessors||[];W.accessors=q.map((P)=>{let C=W.bufferViewBuffers[P.bufferView],T=Q.createAccessor(P.name,C).setType(P.type);if(P.extras)T.setExtras(P.extras);if(P.normalized!==void 0)T.setNormalized(P.normalized);if(P.bufferView===void 0)return T;return T.setArray(z2(P,W)),T});let F=Y.images||[],U=Y.textures||[];Q.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.TEXTURE)).forEach((P)=>P.preread(W,a.TEXTURE)),W.textures=F.map((P)=>{let C=Q.createTexture(P.name);if(P.extras)C.setExtras(P.extras);if(P.bufferView!==void 0){let T=Y.bufferViews[P.bufferView],E=Z.json.buffers[T.buffer],A=E.uri?Z.resources[E.uri]:Z.resources[H2],S=T.byteOffset||0,x=T.byteLength,I=A.slice(S,S+x);C.setImage(I)}else if(P.uri!==void 0){if(C.setImage(Z.resources[P.uri]),P.uri.indexOf("__")!==0)C.setURI(P.uri)}if(P.mimeType!==void 0)C.setMimeType(P.mimeType);else if(P.uri){let T=WZ.extension(P.uri);C.setMimeType(QZ.extensionToMimeType(T))}return C}),Q.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.MATERIAL)).forEach((P)=>P.preread(W,a.MATERIAL));let w=Y.materials||[];W.materials=w.map((P)=>{let C=Q.createMaterial(P.name);if(P.extras)C.setExtras(P.extras);if(P.alphaMode!==void 0)C.setAlphaMode(P.alphaMode);if(P.alphaCutoff!==void 0)C.setAlphaCutoff(P.alphaCutoff);if(P.doubleSided!==void 0)C.setDoubleSided(P.doubleSided);let T=P.pbrMetallicRoughness||{};if(T.baseColorFactor!==void 0)C.setBaseColorFactor(T.baseColorFactor);if(P.emissiveFactor!==void 0)C.setEmissiveFactor(P.emissiveFactor);if(T.metallicFactor!==void 0)C.setMetallicFactor(T.metallicFactor);if(T.roughnessFactor!==void 0)C.setRoughnessFactor(T.roughnessFactor);if(T.baseColorTexture!==void 0){let E=T.baseColorTexture,A=W.textures[U[E.index].source];C.setBaseColorTexture(A),W.setTextureInfo(C.getBaseColorTextureInfo(),E)}if(P.emissiveTexture!==void 0){let E=P.emissiveTexture,A=W.textures[U[E.index].source];C.setEmissiveTexture(A),W.setTextureInfo(C.getEmissiveTextureInfo(),E)}if(P.normalTexture!==void 0){let E=P.normalTexture,A=W.textures[U[E.index].source];if(C.setNormalTexture(A),W.setTextureInfo(C.getNormalTextureInfo(),E),P.normalTexture.scale!==void 0)C.setNormalScale(P.normalTexture.scale)}if(P.occlusionTexture!==void 0){let E=P.occlusionTexture,A=W.textures[U[E.index].source];if(C.setOcclusionTexture(A),W.setTextureInfo(C.getOcclusionTextureInfo(),E),P.occlusionTexture.strength!==void 0)C.setOcclusionStrength(P.occlusionTexture.strength)}if(T.metallicRoughnessTexture!==void 0){let E=T.metallicRoughnessTexture,A=W.textures[U[E.index].source];C.setMetallicRoughnessTexture(A),W.setTextureInfo(C.getMetallicRoughnessTextureInfo(),E)}return C}),Q.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.MESH)).forEach((P)=>P.preread(W,a.MESH));let L=Y.meshes||[];Q.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.PRIMITIVE)).forEach((P)=>P.preread(W,a.PRIMITIVE)),W.meshes=L.map((P)=>{let C=Q.createMesh(P.name);if(P.extras)C.setExtras(P.extras);if(P.weights!==void 0)C.setWeights(P.weights);return(P.primitives||[]).forEach((E)=>{let A=Q.createPrimitive();if(E.extras)A.setExtras(E.extras);if(E.material!==void 0)A.setMaterial(W.materials[E.material]);if(E.mode!==void 0)A.setMode(E.mode);for(let[I,v]of Object.entries(E.attributes||{}))A.setAttribute(I,W.accessors[v]);if(E.indices!==void 0)A.setIndices(W.accessors[E.indices]);let S=P.extras&&P.extras.targetNames||[];(E.targets||[]).forEach((I,v)=>{let f=S[v]||v.toString(),p=Q.createPrimitiveTarget(f);for(let[n,o]of Object.entries(I))p.setAttribute(n,W.accessors[o]);A.addTarget(p)}),C.addPrimitive(A)}),C});let O=Y.cameras||[];W.cameras=O.map((P)=>{let C=Q.createCamera(P.name).setType(P.type);if(P.extras)C.setExtras(P.extras);if(P.type===JY.Type.PERSPECTIVE){let T=P.perspective;if(C.setYFov(T.yfov),C.setZNear(T.znear),T.zfar!==void 0)C.setZFar(T.zfar);if(T.aspectRatio!==void 0)C.setAspectRatio(T.aspectRatio)}else{let T=P.orthographic;C.setZNear(T.znear).setZFar(T.zfar).setXMag(T.xmag).setYMag(T.ymag)}return C});let j=Y.nodes||[];Q.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.NODE)).forEach((P)=>P.preread(W,a.NODE)),W.nodes=j.map((P)=>{let C=Q.createNode(P.name);if(P.extras)C.setExtras(P.extras);if(P.translation!==void 0)C.setTranslation(P.translation);if(P.rotation!==void 0)C.setRotation(P.rotation);if(P.scale!==void 0)C.setScale(P.scale);if(P.matrix!==void 0){let T=[0,0,0],E=[0,0,0,1],A=[1,1,1];d0.decompose(P.matrix,T,E,A),C.setTranslation(T),C.setRotation(E),C.setScale(A)}if(P.weights!==void 0)C.setWeights(P.weights);return C});let M=Y.skins||[];W.skins=M.map((P)=>{let C=Q.createSkin(P.name);if(P.extras)C.setExtras(P.extras);if(P.inverseBindMatrices!==void 0)C.setInverseBindMatrices(W.accessors[P.inverseBindMatrices]);if(P.skeleton!==void 0)C.setSkeleton(W.nodes[P.skeleton]);for(let T of P.joints)C.addJoint(W.nodes[T]);return C}),j.map((P,C)=>{let T=W.nodes[C];if((P.children||[]).forEach((A)=>T.addChild(W.nodes[A])),P.mesh!==void 0)T.setMesh(W.meshes[P.mesh]);if(P.camera!==void 0)T.setCamera(W.cameras[P.camera]);if(P.skin!==void 0)T.setSkin(W.skins[P.skin])});let N=Y.animations||[];W.animations=N.map((P)=>{let C=Q.createAnimation(P.name);if(P.extras)C.setExtras(P.extras);let E=(P.samplers||[]).map((S)=>{let x=Q.createAnimationSampler().setInput(W.accessors[S.input]).setOutput(W.accessors[S.output]).setInterpolation(S.interpolation||mW.Interpolation.LINEAR);if(S.extras)x.setExtras(S.extras);return C.addSampler(x),x});return(P.channels||[]).forEach((S)=>{let x=Q.createAnimationChannel().setSampler(E[S.sampler]).setTargetPath(S.target.path);if(S.target.node!==void 0)x.setTargetNode(W.nodes[S.target.node]);if(S.extras)x.setExtras(S.extras);C.addChannel(x)}),C});let D=Y.scenes||[];if(Q.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.SCENE)).forEach((P)=>P.preread(W,a.SCENE)),W.scenes=D.map((P)=>{let C=Q.createScene(P.name);if(P.extras)C.setExtras(P.extras);return(P.nodes||[]).map((E)=>W.nodes[E]).forEach((E)=>C.addChild(E)),C}),Y.scene!==void 0)Q.getRoot().setDefaultScene(W.scenes[Y.scene]);return Q.getRoot().listExtensionsUsed().forEach((P)=>P.read(W)),q.forEach((P,C)=>{let T=W.accessors[C],E=!!P.sparse,A=!P.bufferView&&!T.getArray();if(E||A)T.setSparse(!0).setArray(fV1(P,W))}),Q}static validate(Z,J){let $=Z.json;if($.asset.version!=="2.0")throw new Error(`Unsupported glTF version, "${$.asset.version}".`);if($.extensionsRequired){for(let Y of $.extensionsRequired)if(!J.extensions.find((Q)=>Q.EXTENSION_NAME===Y))throw new Error(`Missing required extension, "${Y}".`)}if($.extensionsUsed){for(let Y of $.extensionsUsed)if(!J.extensions.find((Q)=>Q.EXTENSION_NAME===Y))J.logger.warn(`Missing optional extension, "${Y}".`)}}}function hV1(Z,J){let $=J.jsonDoc,Y=J.bufferViews[Z.bufferView],Q=$.json.bufferViews[Z.bufferView],W=GJ[Z.componentType],X=I0.getElementSize(Z.type),K=W.BYTES_PER_ELEMENT,G=Z.byteOffset||0,z=new W(Z.count*X),H=new DataView(Y.buffer,Y.byteOffset,Y.byteLength),V=Q.byteStride;for(let q=0;q<Z.count;q++)for(let F=0;F<X;F++){let U=G+q*V+F*K,w;switch(Z.componentType){case I0.ComponentType.FLOAT:w=H.getFloat32(U,!0);break;case I0.ComponentType.UNSIGNED_INT:w=H.getUint32(U,!0);break;case I0.ComponentType.UNSIGNED_SHORT:w=H.getUint16(U,!0);break;case I0.ComponentType.UNSIGNED_BYTE:w=H.getUint8(U);break;case I0.ComponentType.SHORT:w=H.getInt16(U,!0);break;case I0.ComponentType.BYTE:w=H.getInt8(U);break;default:throw new Error(`Unexpected componentType "${Z.componentType}".`)}z[q*X+F]=w}return z}function z2(Z,J){let $=J.jsonDoc,Y=J.bufferViews[Z.bufferView],Q=$.json.bufferViews[Z.bufferView],W=GJ[Z.componentType],X=I0.getElementSize(Z.type),K=W.BYTES_PER_ELEMENT,G=X*K;if(Q.byteStride!==void 0&&Q.byteStride!==G)return hV1(Z,J);let z=Y.byteOffset+(Z.byteOffset||0),H=Z.count*X*K;return new W(Y.buffer.slice(z,z+H))}function fV1(Z,J){let $=GJ[Z.componentType],Y=I0.getElementSize(Z.type),Q;if(Z.bufferView!==void 0)Q=z2(Z,J);else Q=new $(Z.count*Y);let W=Z.sparse;if(!W)return Q;let X=W.count,K=p6({},Z,W.indices,{count:X,type:"SCALAR"}),G=p6({},Z,W.values,{count:X}),z=z2(K,J),H=z2(G,J);for(let V=0;V<K.count;V++)for(let q=0;q<Y;q++)Q[z[V]*Y+q]=H[V*Y+q];return Q}var DG;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(DG||(DG={}));class XJ{constructor(Z,J,$){this._doc=void 0,this.jsonDoc=void 0,this.options=void 0,this.accessorIndexMap=new Map,this.animationIndexMap=new Map,this.bufferIndexMap=new Map,this.cameraIndexMap=new Map,this.skinIndexMap=new Map,this.materialIndexMap=new Map,this.meshIndexMap=new Map,this.nodeIndexMap=new Map,this.imageIndexMap=new Map,this.textureDefIndexMap=new Map,this.textureInfoDefMap=new Map,this.samplerDefIndexMap=new Map,this.sceneIndexMap=new Map,this.imageBufferViews=[],this.otherBufferViews=new Map,this.otherBufferViewsIndexMap=new Map,this.extensionData={},this.bufferURIGenerator=void 0,this.imageURIGenerator=void 0,this.logger=void 0,this._accessorUsageMap=new Map,this.accessorUsageGroupedByParent=new Set(["ARRAY_BUFFER"]),this.accessorParents=new Map,this._doc=Z,this.jsonDoc=J,this.options=$;let Y=Z.getRoot(),Q=Y.listBuffers().length,W=Y.listTextures().length;this.bufferURIGenerator=new bP(Q>1,()=>$.basename||"buffer"),this.imageURIGenerator=new bP(W>1,(X)=>bV1(Z,X)||$.basename||"texture"),this.logger=Z.getLogger()}createTextureInfoDef(Z,J){let $={magFilter:J.getMagFilter()||void 0,minFilter:J.getMinFilter()||void 0,wrapS:J.getWrapS(),wrapT:J.getWrapT()},Y=JSON.stringify($);if(!this.samplerDefIndexMap.has(Y))this.samplerDefIndexMap.set(Y,this.jsonDoc.json.samplers.length),this.jsonDoc.json.samplers.push($);let Q={source:this.imageIndexMap.get(Z),sampler:this.samplerDefIndexMap.get(Y)},W=JSON.stringify(Q);if(!this.textureDefIndexMap.has(W))this.textureDefIndexMap.set(W,this.jsonDoc.json.textures.length),this.jsonDoc.json.textures.push(Q);let X={index:this.textureDefIndexMap.get(W)};if(J.getTexCoord()!==0)X.texCoord=J.getTexCoord();if(Object.keys(J.getExtras()).length>0)X.extras=J.getExtras();return this.textureInfoDefMap.set(J,X),X}createPropertyDef(Z){let J={};if(Z.getName())J.name=Z.getName();if(Object.keys(Z.getExtras()).length>0)J.extras=Z.getExtras();return J}createAccessorDef(Z){let J=this.createPropertyDef(Z);if(J.type=Z.getType(),J.componentType=Z.getComponentType(),J.count=Z.getCount(),this._doc.getGraph().listParentEdges(Z).some((Y)=>Y.getName()==="attributes"&&Y.getAttributes().key==="POSITION"||Y.getName()==="input"))J.max=Z.getMax([]).map(Math.fround),J.min=Z.getMin([]).map(Math.fround);if(Z.getNormalized())J.normalized=Z.getNormalized();return J}createImageData(Z,J,$){if(this.options.format===YZ.GLB)this.imageBufferViews.push(J),Z.bufferView=this.jsonDoc.json.bufferViews.length,this.jsonDoc.json.bufferViews.push({buffer:0,byteOffset:-1,byteLength:J.byteLength});else{let Y=QZ.mimeTypeToExtension($.getMimeType());Z.uri=this.imageURIGenerator.createURI($,Y),this.assignResourceURI(Z.uri,J,!1)}}assignResourceURI(Z,J,$){let Y=this.jsonDoc.resources;if(!(Z in Y)){Y[Z]=J;return}if(J===Y[Z]){this.logger.warn(`Duplicate resource URI, "${Z}".`);return}let Q=`Resource URI "${Z}" already assigned to different data.`;if(!$){this.logger.warn(Q);return}throw new Error(Q)}getAccessorUsage(Z){let J=this._accessorUsageMap.get(Z);if(J)return J;if(Z.getSparse())return c5.SPARSE;for(let $ of this._doc.getGraph().listParentEdges(Z)){let{usage:Y}=$.getAttributes();if(Y)return Y;if($.getParent().propertyType!==a.ROOT)this.logger.warn(`Missing attribute ".usage" on edge, "${$.getName()}".`)}return c5.OTHER}addAccessorToUsageGroup(Z,J){let $=this._accessorUsageMap.get(Z);if($&&$!==J)throw new Error(`Accessor with usage "${$}" cannot be reused as "${J}".`);return this._accessorUsageMap.set(Z,J),this}}XJ.BufferViewTarget=DG;XJ.BufferViewUsage=c5;XJ.USAGE_TO_TARGET={[c5.ARRAY_BUFFER]:DG.ARRAY_BUFFER,[c5.ELEMENT_ARRAY_BUFFER]:DG.ELEMENT_ARRAY_BUFFER};class bP{constructor(Z,J){this.multiple=void 0,this.basename=void 0,this.counter={},this.multiple=Z,this.basename=J}createURI(Z,J){if(Z.getURI())return Z.getURI();else if(!this.multiple)return`${this.basename(Z)}.${J}`;else{let $=this.basename(Z);return this.counter[$]=this.counter[$]||1,`${$}_${this.counter[$]++}.${J}`}}}function bV1(Z,J){let $=Z.getGraph().listParentEdges(J).find((Y)=>Y.getParent()!==Z.getRoot());return $?$.getName().replace(/texture$/i,""):""}var{BufferViewUsage:G2}=XJ,{UNSIGNED_INT:yV1,UNSIGNED_SHORT:gV1,UNSIGNED_BYTE:mV1}=I0.ComponentType,uV1=new Set([a.ACCESSOR,a.BUFFER,a.MATERIAL,a.MESH]);class Dl{static write(Z,J){let $=Z.getGraph(),Y=Z.getRoot(),Q={asset:p6({generator:`glTF-Transform ${Ll}`},Y.getAsset()),extras:p6({},Y.getExtras())},W={json:Q,resources:{}},X=new XJ(Z,W,J),K=J.logger||j5.DEFAULT_INSTANCE,G=new Set(J.extensions.map((L)=>L.EXTENSION_NAME)),z=Z.getRoot().listExtensionsUsed().filter((L)=>G.has(L.extensionName)).sort((L,O)=>L.extensionName>O.extensionName?1:-1),H=Z.getRoot().listExtensionsRequired().filter((L)=>G.has(L.extensionName)).sort((L,O)=>L.extensionName>O.extensionName?1:-1);if(z.length<Z.getRoot().listExtensionsUsed().length)K.warn("Some extensions were not registered for I/O, and will not be written.");for(let L of z){let O=L.prewriteTypes.filter((j)=>!uV1.has(j));if(O.length)K.warn(`Prewrite hooks for some types (${O.join()}), requested by extension ${L.extensionName}, are unsupported. Please file an issue or a PR.`);for(let j of L.writeDependencies)L.install(j,J.dependencies[j])}function V(L,O,j,M){let N=[],D=0;for(let T of L){let E=X.createAccessorDef(T);E.bufferView=Q.bufferViews.length;let A=T.getArray(),S=n0.pad(n0.toView(A));E.byteOffset=D,D+=S.byteLength,N.push(S),X.accessorIndexMap.set(T,Q.accessors.length),Q.accessors.push(E)}let P=n0.concat(N),C={buffer:O,byteOffset:j,byteLength:P.byteLength};if(M)C.target=M;return Q.bufferViews.push(C),{buffers:N,byteLength:D}}function q(L,O,j){let M=L[0].getCount(),N=0;for(let E of L){let A=X.createAccessorDef(E);A.bufferView=Q.bufferViews.length,A.byteOffset=N;let S=E.getElementSize(),x=E.getComponentSize();N+=n0.padNumber(S*x),X.accessorIndexMap.set(E,Q.accessors.length),Q.accessors.push(A)}let D=M*N,P=new ArrayBuffer(D),C=new DataView(P);for(let E=0;E<M;E++){let A=0;for(let S of L){let x=S.getElementSize(),I=S.getComponentSize(),v=S.getComponentType(),f=S.getArray();for(let p=0;p<x;p++){let n=E*N+A+p*I,o=f[E*x+p];switch(v){case I0.ComponentType.FLOAT:C.setFloat32(n,o,!0);break;case I0.ComponentType.BYTE:C.setInt8(n,o);break;case I0.ComponentType.SHORT:C.setInt16(n,o,!0);break;case I0.ComponentType.UNSIGNED_BYTE:C.setUint8(n,o);break;case I0.ComponentType.UNSIGNED_SHORT:C.setUint16(n,o,!0);break;case I0.ComponentType.UNSIGNED_INT:C.setUint32(n,o,!0);break;default:throw new Error("Unexpected component type: "+v)}}A+=n0.padNumber(x*I)}}let T={buffer:O,byteOffset:j,byteLength:D,byteStride:N,target:XJ.BufferViewTarget.ARRAY_BUFFER};return Q.bufferViews.push(T),{byteLength:D,buffers:[new Uint8Array(P)]}}function F(L,O,j){let M=[],N=0,D=new Map,P=-1/0,C=!1;for(let v of L){let f=X.createAccessorDef(v);Q.accessors.push(f),X.accessorIndexMap.set(v,Q.accessors.length-1);let p=[],n=[],o=[],$0=new Array(v.getElementSize()).fill(0);for(let a0=0,_8=v.getCount();a0<_8;a0++){if(v.getElement(a0,o),d0.eq(o,$0,0))continue;P=Math.max(a0,P),p.push(a0);for(let s1=0;s1<o.length;s1++)n.push(o[s1])}let W0=p.length,C0={accessorDef:f,count:W0};if(D.set(v,C0),W0===0)continue;if(W0>v.getCount()/2)C=!0;let T0=GJ[v.getComponentType()];C0.indices=p,C0.values=new T0(n)}if(!Number.isFinite(P))return{buffers:M,byteLength:N};if(C)K.warn("Some sparse accessors have >50% non-zero elements, which may increase file size.");let T=P<255?Uint8Array:P<65535?Uint16Array:Uint32Array,E=P<255?mV1:P<65535?gV1:yV1,A={buffer:O,byteOffset:j+N,byteLength:0};for(let v of L){let f=D.get(v);if(f.count===0)continue;f.indicesByteOffset=A.byteLength;let p=n0.pad(n0.toView(new T(f.indices)));M.push(p),N+=p.byteLength,A.byteLength+=p.byteLength}Q.bufferViews.push(A);let S=Q.bufferViews.length-1,x={buffer:O,byteOffset:j+N,byteLength:0};for(let v of L){let f=D.get(v);if(f.count===0)continue;f.valuesByteOffset=x.byteLength;let p=n0.pad(n0.toView(f.values));M.push(p),N+=p.byteLength,x.byteLength+=p.byteLength}Q.bufferViews.push(x);let I=Q.bufferViews.length-1;for(let v of L){let f=D.get(v);if(f.count===0)continue;f.accessorDef.sparse={count:f.count,indices:{bufferView:S,byteOffset:f.indicesByteOffset,componentType:E},values:{bufferView:I,byteOffset:f.valuesByteOffset}}}return{buffers:M,byteLength:N}}if(Q.accessors=[],Q.bufferViews=[],Q.samplers=[],Q.textures=[],Q.images=Y.listTextures().map((L,O)=>{let j=X.createPropertyDef(L);if(L.getMimeType())j.mimeType=L.getMimeType();let M=L.getImage();if(M)X.createImageData(j,M,L);return X.imageIndexMap.set(L,O),j}),z.filter((L)=>L.prewriteTypes.includes(a.ACCESSOR)).forEach((L)=>L.prewrite(X,a.ACCESSOR)),Y.listAccessors().forEach((L)=>{let{accessorUsageGroupedByParent:O,accessorParents:j}=X;if(X.accessorIndexMap.has(L))return;let M=X.getAccessorUsage(L);if(X.addAccessorToUsageGroup(L,M),O.has(M)){let N=$.listParents(L).find((D)=>D.propertyType!==a.ROOT);j.set(L,N)}}),z.filter((L)=>L.prewriteTypes.includes(a.BUFFER)).forEach((L)=>L.prewrite(X,a.BUFFER)),(Y.listAccessors().length>0||X.otherBufferViews.size>0||Y.listTextures().length>0&&J.format===YZ.GLB)&&Y.listBuffers().length===0)throw new Error("Buffer required for Document resources, but none was found.");if(Q.buffers=[],Y.listBuffers().forEach((L,O)=>{let j=X.createPropertyDef(L),M=X.accessorUsageGroupedByParent,N=L.listParents().filter((x)=>x instanceof I0),D=new Set(N.map((x)=>X.accessorParents.get(x))),P=new Map(Array.from(D).map((x,I)=>[x,I])),C={};for(let x of N){var T;if(X.accessorIndexMap.has(x))continue;let I=X.getAccessorUsage(x),v=I;if(M.has(I)){let f=X.accessorParents.get(x);v+=`:${P.get(f)}`}C[T=v]||(C[T]={usage:I,accessors:[]}),C[v].accessors.push(x)}let E=[],A=Q.buffers.length,S=0;for(let{usage:x,accessors:I}of Object.values(C))if(x===G2.ARRAY_BUFFER&&J.vertexLayout===V2.INTERLEAVED){let v=q(I,A,S);S+=v.byteLength;for(let f of v.buffers)E.push(f)}else if(x===G2.ARRAY_BUFFER)for(let v of I){let f=q([v],A,S);S+=f.byteLength;for(let p of f.buffers)E.push(p)}else if(x===G2.SPARSE){let v=F(I,A,S);S+=v.byteLength;for(let f of v.buffers)E.push(f)}else if(x===G2.ELEMENT_ARRAY_BUFFER){let v=XJ.BufferViewTarget.ELEMENT_ARRAY_BUFFER,f=V(I,A,S,v);S+=f.byteLength;for(let p of f.buffers)E.push(p)}else{let v=V(I,A,S);S+=v.byteLength;for(let f of v.buffers)E.push(f)}if(X.imageBufferViews.length&&O===0){for(let x=0;x<X.imageBufferViews.length;x++)if(Q.bufferViews[Q.images[x].bufferView].byteOffset=S,S+=X.imageBufferViews[x].byteLength,E.push(X.imageBufferViews[x]),S%8){let I=8-S%8;S+=I,E.push(new Uint8Array(I))}}if(X.otherBufferViews.has(L))for(let x of X.otherBufferViews.get(L))Q.bufferViews.push({buffer:A,byteOffset:S,byteLength:x.byteLength}),X.otherBufferViewsIndexMap.set(x,Q.bufferViews.length-1),S+=x.byteLength,E.push(x);if(S){let x;if(J.format===YZ.GLB)x=H2;else x=X.bufferURIGenerator.createURI(L,"bin"),j.uri=x;j.byteLength=S,X.assignResourceURI(x,n0.concat(E),!0)}Q.buffers.push(j),X.bufferIndexMap.set(L,O)}),Y.listAccessors().find((L)=>!L.getBuffer()))K.warn("Skipped writing one or more Accessors: no Buffer assigned.");z.filter((L)=>L.prewriteTypes.includes(a.MATERIAL)).forEach((L)=>L.prewrite(X,a.MATERIAL)),Q.materials=Y.listMaterials().map((L,O)=>{let j=X.createPropertyDef(L);if(L.getAlphaMode()!==r4.AlphaMode.OPAQUE)j.alphaMode=L.getAlphaMode();if(L.getAlphaMode()===r4.AlphaMode.MASK)j.alphaCutoff=L.getAlphaCutoff();if(L.getDoubleSided())j.doubleSided=!0;if(j.pbrMetallicRoughness={},!d0.eq(L.getBaseColorFactor(),[1,1,1,1]))j.pbrMetallicRoughness.baseColorFactor=L.getBaseColorFactor();if(!d0.eq(L.getEmissiveFactor(),[0,0,0]))j.emissiveFactor=L.getEmissiveFactor();if(L.getRoughnessFactor()!==1)j.pbrMetallicRoughness.roughnessFactor=L.getRoughnessFactor();if(L.getMetallicFactor()!==1)j.pbrMetallicRoughness.metallicFactor=L.getMetallicFactor();if(L.getBaseColorTexture()){let M=L.getBaseColorTexture(),N=L.getBaseColorTextureInfo();j.pbrMetallicRoughness.baseColorTexture=X.createTextureInfoDef(M,N)}if(L.getEmissiveTexture()){let M=L.getEmissiveTexture(),N=L.getEmissiveTextureInfo();j.emissiveTexture=X.createTextureInfoDef(M,N)}if(L.getNormalTexture()){let M=L.getNormalTexture(),N=L.getNormalTextureInfo(),D=X.createTextureInfoDef(M,N);if(L.getNormalScale()!==1)D.scale=L.getNormalScale();j.normalTexture=D}if(L.getOcclusionTexture()){let M=L.getOcclusionTexture(),N=L.getOcclusionTextureInfo(),D=X.createTextureInfoDef(M,N);if(L.getOcclusionStrength()!==1)D.strength=L.getOcclusionStrength();j.occlusionTexture=D}if(L.getMetallicRoughnessTexture()){let M=L.getMetallicRoughnessTexture(),N=L.getMetallicRoughnessTextureInfo();j.pbrMetallicRoughness.metallicRoughnessTexture=X.createTextureInfoDef(M,N)}return X.materialIndexMap.set(L,O),j}),z.filter((L)=>L.prewriteTypes.includes(a.MESH)).forEach((L)=>L.prewrite(X,a.MESH)),Q.meshes=Y.listMeshes().map((L,O)=>{let j=X.createPropertyDef(L),M=null;if(j.primitives=L.listPrimitives().map((N)=>{let D={attributes:{}};D.mode=N.getMode();let P=N.getMaterial();if(P)D.material=X.materialIndexMap.get(P);if(Object.keys(N.getExtras()).length)D.extras=N.getExtras();let C=N.getIndices();if(C)D.indices=X.accessorIndexMap.get(C);for(let T of N.listSemantics())D.attributes[T]=X.accessorIndexMap.get(N.getAttribute(T));for(let T of N.listTargets()){let E={};for(let A of T.listSemantics())E[A]=X.accessorIndexMap.get(T.getAttribute(A));D.targets=D.targets||[],D.targets.push(E)}if(N.listTargets().length&&!M)M=N.listTargets().map((T)=>T.getName());return D}),L.getWeights().length)j.weights=L.getWeights();if(M)j.extras=j.extras||{},j.extras.targetNames=M;return X.meshIndexMap.set(L,O),j}),Q.cameras=Y.listCameras().map((L,O)=>{let j=X.createPropertyDef(L);if(j.type=L.getType(),j.type===JY.Type.PERSPECTIVE){j.perspective={znear:L.getZNear(),zfar:L.getZFar(),yfov:L.getYFov()};let M=L.getAspectRatio();if(M!==null)j.perspective.aspectRatio=M}else j.orthographic={znear:L.getZNear(),zfar:L.getZFar(),xmag:L.getXMag(),ymag:L.getYMag()};return X.cameraIndexMap.set(L,O),j}),Q.nodes=Y.listNodes().map((L,O)=>{let j=X.createPropertyDef(L);if(!d0.eq(L.getTranslation(),[0,0,0]))j.translation=L.getTranslation();if(!d0.eq(L.getRotation(),[0,0,0,1]))j.rotation=L.getRotation();if(!d0.eq(L.getScale(),[1,1,1]))j.scale=L.getScale();if(L.getWeights().length)j.weights=L.getWeights();return X.nodeIndexMap.set(L,O),j}),Q.skins=Y.listSkins().map((L,O)=>{let j=X.createPropertyDef(L),M=L.getInverseBindMatrices();if(M)j.inverseBindMatrices=X.accessorIndexMap.get(M);let N=L.getSkeleton();if(N)j.skeleton=X.nodeIndexMap.get(N);return j.joints=L.listJoints().map((D)=>X.nodeIndexMap.get(D)),X.skinIndexMap.set(L,O),j}),Y.listNodes().forEach((L,O)=>{let j=Q.nodes[O],M=L.getMesh();if(M)j.mesh=X.meshIndexMap.get(M);let N=L.getCamera();if(N)j.camera=X.cameraIndexMap.get(N);let D=L.getSkin();if(D)j.skin=X.skinIndexMap.get(D);if(L.listChildren().length>0)j.children=L.listChildren().map((P)=>X.nodeIndexMap.get(P))}),Q.animations=Y.listAnimations().map((L,O)=>{let j=X.createPropertyDef(L),M=new Map;return j.samplers=L.listSamplers().map((N,D)=>{let P=X.createPropertyDef(N);return P.input=X.accessorIndexMap.get(N.getInput()),P.output=X.accessorIndexMap.get(N.getOutput()),P.interpolation=N.getInterpolation(),M.set(N,D),P}),j.channels=L.listChannels().map((N)=>{let D=X.createPropertyDef(N);return D.sampler=M.get(N.getSampler()),D.target={node:X.nodeIndexMap.get(N.getTargetNode()),path:N.getTargetPath()},D}),X.animationIndexMap.set(L,O),j}),Q.scenes=Y.listScenes().map((L,O)=>{let j=X.createPropertyDef(L);return j.nodes=L.listChildren().map((M)=>X.nodeIndexMap.get(M)),X.sceneIndexMap.set(L,O),j});let w=Y.getDefaultScene();if(w)Q.scene=Y.listScenes().indexOf(w);return Q.extensionsUsed=z.map((L)=>L.extensionName),Q.extensionsRequired=H.map((L)=>L.extensionName),z.forEach((L)=>L.write(X)),dV1(Q),W}}function dV1(Z){let J=[];for(let $ in Z){let Y=Z[$];if(Array.isArray(Y)&&Y.length===0)J.push($);else if(Y===null||Y==="")J.push($);else if(Y&&typeof Y==="object"&&Object.keys(Y).length===0)J.push($)}for(let $ of J)delete Z[$]}var U2;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(U2||(U2={}));class Cl{constructor(){this._logger=j5.DEFAULT_INSTANCE,this._extensions=new Set,this._dependencies={},this._vertexLayout=V2.INTERLEAVED,this.lastReadBytes=0,this.lastWriteBytes=0}setLogger(Z){return this._logger=Z,this}registerExtensions(Z){for(let J of Z)this._extensions.add(J),J.register();return this}registerDependencies(Z){return Object.assign(this._dependencies,Z),this}setVertexLayout(Z){return this._vertexLayout=Z,this}async read(Z){return await this.readJSON(await this.readAsJSON(Z))}async readAsJSON(Z){let J=await this.readURI(Z,"view");this.lastReadBytes=J.byteLength;let $=Ul(J)?this._binaryToJSON(J):{json:JSON.parse(n0.decodeText(J)),resources:{}};return await this._readResourcesExternal($,this.dirname(Z)),this._readResourcesInternal($),$}async readJSON(Z){return Z=this._copyJSON(Z),this._readResourcesInternal(Z),Pl.read(Z,{extensions:Array.from(this._extensions),dependencies:this._dependencies,logger:this._logger})}async binaryToJSON(Z){let J=this._binaryToJSON(n0.assertView(Z));this._readResourcesInternal(J);let $=J.json;if($.buffers&&$.buffers.some((Y)=>cV1(J,Y)))throw new Error("Cannot resolve external buffers with binaryToJSON().");else if($.images&&$.images.some((Y)=>lV1(J,Y)))throw new Error("Cannot resolve external images with binaryToJSON().");return J}async readBinary(Z){return this.readJSON(await this.binaryToJSON(n0.assertView(Z)))}async writeJSON(Z,J={}){if(J.format===YZ.GLB&&Z.getRoot().listBuffers().length>1)throw new Error("GLB must have 0\u20131 buffers.");return Dl.write(Z,{format:J.format||YZ.GLTF,basename:J.basename||"",logger:this._logger,vertexLayout:this._vertexLayout,dependencies:p6({},this._dependencies),extensions:Array.from(this._extensions)})}async writeBinary(Z){let{json:J,resources:$}=await this.writeJSON(Z,{format:YZ.GLB}),Y=new Uint32Array([1179937895,2,12]),Q=JSON.stringify(J),W=n0.pad(n0.encodeText(Q),32),X=n0.toView(new Uint32Array([W.byteLength,1313821514])),K=n0.concat([X,W]);Y[Y.length-1]+=K.byteLength;let G=Object.values($)[0];if(!G||!G.byteLength)return n0.concat([n0.toView(Y),K]);let z=n0.pad(G,0),H=n0.toView(new Uint32Array([z.byteLength,5130562])),V=n0.concat([H,z]);return Y[Y.length-1]+=V.byteLength,n0.concat([n0.toView(Y),K,V])}async _readResourcesExternal(Z,J){var $=this;let Y=Z.json.images||[],Q=Z.json.buffers||[],W=[...Y,...Q].map(async function(X){let K=X.uri;if(!K||K.match(/data:/))return Promise.resolve();Z.resources[K]=await $.readURI($.resolve(J,K),"view"),$.lastReadBytes+=Z.resources[K].byteLength});await Promise.all(W)}_readResourcesInternal(Z){function J(Q){if(!Q.uri)return;if(Q.uri in Z.resources){n0.assertView(Z.resources[Q.uri]);return}if(Q.uri.match(/data:/)){let W=`__${Ml()}.${WZ.extension(Q.uri)}`;Z.resources[W]=n0.createBufferFromDataURI(Q.uri),Q.uri=W}}(Z.json.images||[]).forEach((Q)=>{if(Q.bufferView===void 0&&Q.uri===void 0)throw new Error("Missing resource URI or buffer view.");J(Q)}),(Z.json.buffers||[]).forEach(J)}_copyJSON(Z){let{images:J,buffers:$}=Z.json;if(Z={json:p6({},Z.json),resources:p6({},Z.resources)},J)Z.json.images=J.map((Y)=>p6({},Y));if($)Z.json.buffers=$.map((Y)=>p6({},Y));return Z}_binaryToJSON(Z){if(!Ul(Z))throw new Error("Invalid glTF 2.0 binary.");let J=new Uint32Array(Z.buffer,Z.byteOffset+12,2);if(J[1]!==U2.JSON)throw new Error("Missing required GLB JSON chunk.");let $=20,Y=J[0],Q=n0.decodeText(n0.toView(Z,$,Y)),W=JSON.parse(Q),X=$+Y;if(Z.byteLength<=X)return{json:W,resources:{}};let K=new Uint32Array(Z.buffer,Z.byteOffset+X,2);if(K[1]!==U2.BIN)return{json:W,resources:{}};let G=K[0],z=n0.toView(Z,X+8,G);return{json:W,resources:{[H2]:z}}}}function cV1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)}function lV1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)&&J.bufferView===void 0}function Ul(Z){if(Z.byteLength<3*Uint32Array.BYTES_PER_ELEMENT)return!1;let J=new Uint32Array(Z.buffer,Z.byteOffset,3);return J[0]===1179937895&&J[1]===2}class lP extends Cl{constructor(Z=null,J=B9.DEFAULT_INIT){super();this._fetch=void 0,this._fetchConfig=void 0,this._init=void 0,this._fetchEnabled=!1,this._fetch=Z,this._fetchConfig=J,this._init=this.init()}async init(){if(this._init)return this._init;return Promise.all([import("fs"),import("path")]).then(([Z,J])=>{this._fs=Z.promises,this._path=J})}setAllowNetwork(Z){if(Z&&!this._fetch)throw new Error("NodeIO requires a Fetch API implementation for HTTP requests.");return this._fetchEnabled=Z,this}async readURI(Z,J){if(await this.init(),B9.isAbsoluteURL(Z)){if(!this._fetchEnabled||!this._fetch)throw new Error("Network request blocked. Allow HTTP requests explicitly, if needed.");let $=await this._fetch(Z,this._fetchConfig);switch(J){case"view":return new Uint8Array(await $.arrayBuffer());case"text":return $.text()}}else switch(J){case"view":return this._fs.readFile(Z);case"text":return this._fs.readFile(Z,"utf8")}}resolve(Z,J){if(B9.isAbsoluteURL(Z)||B9.isAbsoluteURL(J))return B9.resolve(Z,J);return this._path.resolve(Z,decodeURIComponent(J))}dirname(Z){if(B9.isAbsoluteURL(Z))return B9.dirname(Z);return this._path.dirname(Z)}async write(Z,J){await this.init(),await(!!Z.match(/\.glb$/)?this._writeGLB(Z,J):this._writeGLTF(Z,J))}async _writeGLTF(Z,J){var $=this;this.lastWriteBytes=0;let{json:Y,resources:Q}=await this.writeJSON(J,{format:YZ.GLTF,basename:WZ.basename(Z)}),{_fs:W,_path:X}=this,K=X.dirname(Z),G=JSON.stringify(Y,null,2);await W.writeFile(Z,G),this.lastWriteBytes+=G.length;for(let z of pV1(Object.keys(Q),10))await Promise.all(z.map(async function(H){if(B9.isAbsoluteURL(H)){if(B9.extension(H)==="bin")throw new Error(`Cannot write buffer to path "${H}".`);return}let V=X.join(K,decodeURIComponent(H));await W.mkdir(X.dirname(V),{recursive:!0}),await W.writeFile(V,Q[H]),$.lastWriteBytes+=Q[H].byteLength}))}async _writeGLB(Z,J){let $=await this.writeBinary(J);await this._fs.writeFile(Z,$),this.lastWriteBytes=$.byteLength}}function pV1(Z,J){let $=[];for(let Y=0,Q=Z.length;Y<Q;Y+=J){let W=[];for(let X=0;X<J&&Y+X<Q;X++)W.push(Z[Y+X]);$.push(W)}return $}var Rn=t(pP(),1),Nn=t(Qn(),1),fL1=t(Mn(),1);async function bL1(Z,J){if(!(Z instanceof Uint8Array))throw new Error("[ndarray-pixels] Input must be Uint8Array or Buffer.");let{data:$,info:Y}=await Nn.default(Z).ensureAlpha().raw().toBuffer({resolveWithObject:!0});return Rn.default(new Uint8Array($),[Y.width,Y.height,4],[4,4*Y.width|0,1],0)}async function Pn(Z,J){return bL1(Z)}var yL1="v4.1.3",PD="@glb.bin",s;(function(Z){Z.ACCESSOR="Accessor",Z.ANIMATION="Animation",Z.ANIMATION_CHANNEL="AnimationChannel",Z.ANIMATION_SAMPLER="AnimationSampler",Z.BUFFER="Buffer",Z.CAMERA="Camera",Z.MATERIAL="Material",Z.MESH="Mesh",Z.PRIMITIVE="Primitive",Z.PRIMITIVE_TARGET="PrimitiveTarget",Z.NODE="Node",Z.ROOT="Root",Z.SCENE="Scene",Z.SKIN="Skin",Z.TEXTURE="Texture",Z.TEXTURE_INFO="TextureInfo"})(s||(s={}));var Dn;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(Dn||(Dn={}));var i5;(function(Z){Z.ARRAY_BUFFER="ARRAY_BUFFER",Z.ELEMENT_ARRAY_BUFFER="ELEMENT_ARRAY_BUFFER",Z.INVERSE_BIND_MATRICES="INVERSE_BIND_MATRICES",Z.OTHER="OTHER",Z.SPARSE="SPARSE"})(i5||(i5={}));var n5;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(n5||(n5={}));var BD;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(BD||(BD={}));var OD=typeof Float32Array!=="undefined"?Float32Array:Array;if(!Math.hypot)Math.hypot=function(){var Z=0,J=arguments.length;while(J--)Z+=arguments[J]*arguments[J];return Math.sqrt(Z)};function gL1(){var Z=new OD(3);if(OD!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function wD(Z){var J=Z[0],$=Z[1],Y=Z[2];return Math.hypot(J,$,Y)}function mL1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=$[3]*Y+$[7]*Q+$[11]*W+$[15];return X=X||1,Z[0]=($[0]*Y+$[4]*Q+$[8]*W+$[12])/X,Z[1]=($[1]*Y+$[5]*Q+$[9]*W+$[13])/X,Z[2]=($[2]*Y+$[6]*Q+$[10]*W+$[14])/X,Z}(function(){var Z=gL1();return function(J,$,Y,Q,W,X){var K,G;if(!$)$=3;if(!Y)Y=0;if(Q)G=Math.min(Q*$+Y,J.length);else G=J.length;for(K=Y;K<G;K+=$)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],W(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}})();function En(Z){let J=In(),$=Z.propertyType===s.NODE?[Z]:Z.listChildren();for(let Y of $)Y.traverse((Q)=>{let W=Q.getMesh();if(!W)return;let X=uL1(W,Q.getWorldMatrix());if(X.min.every(isFinite)&&X.max.every(isFinite))jD(X.min,J),jD(X.max,J)});return J}function uL1(Z,J){let $=In();for(let Y of Z.listPrimitives()){let Q=Y.getAttribute("POSITION"),W=Y.getIndices();if(!Q)continue;let X=[0,0,0],K=[0,0,0];for(let G=0,z=W?W.getCount():Q.getCount();G<z;G++){let H=W?W.getScalar(G):G;X=Q.getElement(H,X),K=mL1(K,X,J),jD(K,$)}}return $}function jD(Z,J){for(let $=0;$<3;$++)J.min[$]=Math.min(Z[$],J.min[$]),J.max[$]=Math.max(Z[$],J.max[$])}function In(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class k6{static createBufferFromDataURI(Z){if(typeof Buffer==="undefined"){let J=atob(Z.split(",")[1]),$=new Uint8Array(J.length);for(let Y=0;Y<J.length;Y++)$[Y]=J.charCodeAt(Y);return $}else{let J=Z.split(",")[1],$=Z.indexOf("base64")>=0;return Buffer.from(J,$?"base64":"utf8")}}static encodeText(Z){return new TextEncoder().encode(Z)}static decodeText(Z){return new TextDecoder().decode(Z)}static concat(Z){let J=0;for(let Q of Z)J+=Q.byteLength;let $=new Uint8Array(J),Y=0;for(let Q of Z)$.set(Q,Y),Y+=Q.byteLength;return $}static pad(Z,J=0){let $=this.padNumber(Z.byteLength);if($===Z.byteLength)return Z;let Y=new Uint8Array($);if(Y.set(Z),J!==0)for(let Q=Z.byteLength;Q<$;Q++)Y[Q]=J;return Y}static padNumber(Z){return Math.ceil(Z/4)*4}static equals(Z,J){if(Z===J)return!0;if(Z.byteLength!==J.byteLength)return!1;let $=Z.byteLength;while($--)if(Z[$]!==J[$])return!1;return!0}static toView(Z,J=0,$=1/0){return new Uint8Array(Z.buffer,Z.byteOffset+J,Math.min(Z.byteLength,$))}static assertView(Z){if(Z&&!ArrayBuffer.isView(Z))throw new Error(`Method requires Uint8Array parameter; received "${typeof Z}".`);return Z}}class vn{match(Z){return Z.length>=3&&Z[0]===255&&Z[1]===216&&Z[2]===255}getSize(Z){let J=new DataView(Z.buffer,Z.byteOffset+4),$,Y;while(J.byteLength){if($=J.getUint16(0,!1),dL1(J,$),Y=J.getUint8($+1),Y===192||Y===193||Y===194)return[J.getUint16($+7,!1),J.getUint16($+5,!1)];J=new DataView(Z.buffer,J.byteOffset+$+2)}throw new TypeError("Invalid JPG, no size found")}getChannels(Z){return 3}}class i2{match(Z){return Z.length>=8&&Z[0]===137&&Z[1]===80&&Z[2]===78&&Z[3]===71&&Z[4]===13&&Z[5]===10&&Z[6]===26&&Z[7]===10}getSize(Z){let J=new DataView(Z.buffer,Z.byteOffset);if(k6.decodeText(Z.slice(12,16))===i2.PNG_FRIED_CHUNK_NAME)return[J.getUint32(32,!1),J.getUint32(36,!1)];return[J.getUint32(16,!1),J.getUint32(20,!1)]}getChannels(Z){return 4}}i2.PNG_FRIED_CHUNK_NAME="CgBI";class L4{static registerFormat(Z,J){this.impls[Z]=J}static getMimeType(Z){for(let J in this.impls)if(this.impls[J].match(Z))return J;return null}static getSize(Z,J){if(!this.impls[J])return null;return this.impls[J].getSize(Z)}static getChannels(Z,J){if(!this.impls[J])return null;return this.impls[J].getChannels(Z)}static getVRAMByteLength(Z,J){if(!this.impls[J])return null;if(this.impls[J].getVRAMByteLength)return this.impls[J].getVRAMByteLength(Z);let $=0,Y=4,Q=this.getSize(Z,J);if(!Q)return null;while(Q[0]>1||Q[1]>1)$+=Q[0]*Q[1]*Y,Q[0]=Math.max(Math.floor(Q[0]/2),1),Q[1]=Math.max(Math.floor(Q[1]/2),1);return $+=1*Y,$}static mimeTypeToExtension(Z){if(Z==="image/jpeg")return"jpg";return Z.split("/").pop()}static extensionToMimeType(Z){if(Z==="jpg")return"image/jpeg";if(!Z)return"";return`image/${Z}`}}L4.impls={"image/jpeg":new vn,"image/png":new i2};function dL1(Z,J){if(J>Z.byteLength)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(Z.getUint8(J)!==255)throw new TypeError("Invalid JPG, marker table corrupted");return Z}class hG{static basename(Z){let J=Z.split(/[\\/]/).pop();return J.substring(0,J.lastIndexOf("."))}static extension(Z){if(Z.startsWith("data:image/")){let J=Z.match(/data:(image\/\w+)/)[1];return L4.mimeTypeToExtension(J)}else if(Z.startsWith("data:model/gltf+json"))return"gltf";else if(Z.startsWith("data:model/gltf-binary"))return"glb";else if(Z.startsWith("data:application/"))return"bin";return Z.split(/[\\/]/).pop().split(/[.]/).pop()}}function Cn(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function KY(Z){if(Cn(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let $=J.prototype;if(Cn($)===!1)return!1;if(Object.prototype.hasOwnProperty.call($,"isPrototypeOf")===!1)return!1;return!0}var MD,RD;(function(Z){Z[Z.SILENT=4]="SILENT",Z[Z.ERROR=3]="ERROR",Z[Z.WARN=2]="WARN",Z[Z.INFO=1]="INFO",Z[Z.DEBUG=0]="DEBUG"})(RD||(RD={}));class Y7{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=Y7.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=Y7.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=Y7.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=Y7.Verbosity.ERROR)console.error(Z)}}MD=Y7;Y7.Verbosity=RD;Y7.DEFAULT_INSTANCE=new MD(MD.Verbosity.INFO);function cL1(Z){var J=Z[0],$=Z[1],Y=Z[2],Q=Z[3],W=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],H=Z[9],V=Z[10],q=Z[11],F=Z[12],U=Z[13],w=Z[14],L=Z[15],O=J*X-$*W,j=J*K-Y*W,M=J*G-Q*W,N=$*K-Y*X,D=$*G-Q*X,P=Y*G-Q*K,C=z*U-H*F,T=z*w-V*F,E=z*L-q*F,A=H*w-V*U,S=H*L-q*U,x=V*L-q*w;return O*x-j*S+M*A+N*E-D*T+P*C}function lL1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=J[9],F=J[10],U=J[11],w=J[12],L=J[13],O=J[14],j=J[15],M=$[0],N=$[1],D=$[2],P=$[3];return Z[0]=M*Y+N*K+D*V+P*w,Z[1]=M*Q+N*G+D*q+P*L,Z[2]=M*W+N*z+D*F+P*O,Z[3]=M*X+N*H+D*U+P*j,M=$[4],N=$[5],D=$[6],P=$[7],Z[4]=M*Y+N*K+D*V+P*w,Z[5]=M*Q+N*G+D*q+P*L,Z[6]=M*W+N*z+D*F+P*O,Z[7]=M*X+N*H+D*U+P*j,M=$[8],N=$[9],D=$[10],P=$[11],Z[8]=M*Y+N*K+D*V+P*w,Z[9]=M*Q+N*G+D*q+P*L,Z[10]=M*W+N*z+D*F+P*O,Z[11]=M*X+N*H+D*U+P*j,M=$[12],N=$[13],D=$[14],P=$[15],Z[12]=M*Y+N*K+D*V+P*w,Z[13]=M*Q+N*G+D*q+P*L,Z[14]=M*W+N*z+D*F+P*O,Z[15]=M*X+N*H+D*U+P*j,Z}function pL1(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[4],X=J[5],K=J[6],G=J[8],z=J[9],H=J[10];return Z[0]=Math.hypot($,Y,Q),Z[1]=Math.hypot(W,X,K),Z[2]=Math.hypot(G,z,H),Z}function iL1(Z,J){var $=new OD(3);pL1($,J);var Y=1/$[0],Q=1/$[1],W=1/$[2],X=J[0]*Y,K=J[1]*Q,G=J[2]*W,z=J[4]*Y,H=J[5]*Q,V=J[6]*W,q=J[8]*Y,F=J[9]*Q,U=J[10]*W,w=X+H+U,L=0;if(w>0)L=Math.sqrt(w+1)*2,Z[3]=0.25*L,Z[0]=(V-F)/L,Z[1]=(q-G)/L,Z[2]=(K-z)/L;else if(X>H&&X>U)L=Math.sqrt(1+X-H-U)*2,Z[3]=(V-F)/L,Z[0]=0.25*L,Z[1]=(K+z)/L,Z[2]=(q+G)/L;else if(H>U)L=Math.sqrt(1+H-X-U)*2,Z[3]=(q-G)/L,Z[0]=(K+z)/L,Z[1]=0.25*L,Z[2]=(V+F)/L;else L=Math.sqrt(1+U-X-H)*2,Z[3]=(K-z)/L,Z[0]=(q+G)/L,Z[1]=(V+F)/L,Z[2]=0.25*L;return Z}class G8{static identity(Z){return Z}static eq(Z,J,$=0.00001){if(Z.length!==J.length)return!1;for(let Y=0;Y<Z.length;Y++)if(Math.abs(Z[Y]-J[Y])>$)return!1;return!0}static clamp(Z,J,$){if(Z<J)return J;if(Z>$)return $;return Z}static decodeNormalizedInt(Z,J){switch(J){case 5126:return Z;case 5123:return Z/65535;case 5121:return Z/255;case 5122:return Math.max(Z/32767,-1);case 5120:return Math.max(Z/127,-1);default:throw new Error("Invalid component type.")}}static encodeNormalizedInt(Z,J){switch(J){case 5126:return Z;case 5123:return Math.round(G8.clamp(Z,0,1)*65535);case 5121:return Math.round(G8.clamp(Z,0,1)*255);case 5122:return Math.round(G8.clamp(Z,-1,1)*32767);case 5120:return Math.round(G8.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,$,Y){let Q=wD([Z[0],Z[1],Z[2]]),W=wD([Z[4],Z[5],Z[6]]),X=wD([Z[8],Z[9],Z[10]]);if(cL1(Z)<0)Q=-Q;J[0]=Z[12],J[1]=Z[13],J[2]=Z[14];let G=Z.slice(),z=1/Q,H=1/W,V=1/X;G[0]*=z,G[1]*=z,G[2]*=z,G[4]*=H,G[5]*=H,G[6]*=H,G[8]*=V,G[9]*=V,G[10]*=V,iL1($,G),Y[0]=Q,Y[1]=W,Y[2]=X}static compose(Z,J,$,Y){let Q=Y,W=J[0],X=J[1],K=J[2],G=J[3],z=W+W,H=X+X,V=K+K,q=W*z,F=W*H,U=W*V,w=X*H,L=X*V,O=K*V,j=G*z,M=G*H,N=G*V,D=$[0],P=$[1],C=$[2];return Q[0]=(1-(w+O))*D,Q[1]=(F+N)*D,Q[2]=(U-M)*D,Q[3]=0,Q[4]=(F-N)*P,Q[5]=(1-(q+O))*P,Q[6]=(L+j)*P,Q[7]=0,Q[8]=(U+M)*C,Q[9]=(L-j)*C,Q[10]=(1-(q+w))*C,Q[11]=0,Q[12]=Z[0],Q[13]=Z[1],Q[14]=Z[2],Q[15]=1,Q}}function nL1(Z,J){if(!!Z!==!!J)return!1;let $=Z.getChild(),Y=J.getChild();return $===Y||$.equals(Y)}function aL1(Z,J){if(!!Z!==!!J)return!1;let $=Z.values(),Y=J.values();if($.length!==Y.length)return!1;for(let Q=0;Q<$.length;Q++){let W=$[Q],X=Y[Q];if(W.getChild()===X.getChild())continue;if(!W.getChild().equals(X.getChild()))return!1}return!0}function sL1(Z,J){if(!!Z!==!!J)return!1;let $=Z.keys(),Y=J.keys();if($.length!==Y.length)return!1;for(let Q of $){let W=Z.get(Q),X=J.get(Q);if(!!W!==!!X)return!1;let K=W.getChild(),G=X.getChild();if(K===G)continue;if(!K.equals(G))return!1}return!0}function Sn(Z,J){if(Z===J)return!0;if(!!Z!==!!J||!Z||!J)return!1;if(Z.length!==J.length)return!1;for(let $=0;$<Z.length;$++)if(Z[$]!==J[$])return!1;return!0}function _n(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!KY(Z)||!KY(J))return Z===J;let $=Z,Y=J,Q=0,W=0,X;for(X in $)Q++;for(X in Y)W++;if(Q!==W)return!1;for(X in $){let K=$[X],G=Y[X];if(c2(K)&&c2(G)){if(!Sn(K,G))return!1}else if(KY(K)&&KY(G)){if(!_n(K,G))return!1}else if(K!==G)return!1}return!0}function c2(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var Tn="https://null.example";class DD{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return hG.basename(new URL(Z,Tn).pathname)}static extension(Z){return hG.extension(new URL(Z,Tn).pathname)}static resolve(Z,J){if(!this.isRelativePath(J))return J;let $=Z.split("/"),Y=J.split("/");$.pop();for(let Q=0;Q<Y.length;Q++){if(Y[Q]===".")continue;if(Y[Q]==="..")$.pop();else $.push(Y[Q])}return $.join("/")}static isAbsoluteURL(Z){return this.PROTOCOL_REGEXP.test(Z)}static isRelativePath(Z){return!/^(?:[a-zA-Z]+:)?\//.test(Z)}}DD.DEFAULT_INIT={};DD.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var UJ=(Z)=>Z,oL1=new Set;class n2 extends gW{constructor(Z,J=""){super(Z);this[A0].name=J,this.init(),this.dispatchEvent({type:"create"})}getGraph(){return this.graph}getDefaults(){return Object.assign(super.getDefaults(),{name:"",extras:{}})}set(Z,J){if(Array.isArray(J))J=J.slice();return super.set(Z,J)}getName(){return this.get("name")}setName(Z){return this.set("name",Z)}getExtras(){return this.get("extras")}setExtras(Z){return this.set("extras",Z)}clone(){return new this.constructor(this.graph).copy(this,UJ)}copy(Z,J=UJ){for(let $ in this[A0]){let Y=this[A0][$];if(Y instanceof B5){if(!this[F4].has($))Y.dispose()}else if(Y instanceof D6||Y instanceof N0)for(let Q of Y.values())Q.dispose();else if(Y instanceof r1)for(let Q of Y.values())Q.dispose()}for(let $ in Z[A0]){let Y=this[A0][$],Q=Z[A0][$];if(Q instanceof B5)if(this[F4].has($))Y.getChild().copy(J(Q.getChild()),J);else this.setRef($,J(Q.getChild()),Q.getAttributes());else if(Q instanceof N0||Q instanceof D6)for(let W of Q.values())this.addRef($,J(W.getChild()),W.getAttributes());else if(Q instanceof r1)for(let W of Q.keys()){let X=Q.get(W);this.setRefMap($,W,J(X.getChild()),X.getAttributes())}else if(KY(Q))this[A0][$]=JSON.parse(JSON.stringify(Q));else if(Array.isArray(Q)||Q instanceof ArrayBuffer||ArrayBuffer.isView(Q))this[A0][$]=Q.slice();else this[A0][$]=Q}return this}equals(Z,J=oL1){if(this===Z)return!0;if(this.propertyType!==Z.propertyType)return!1;for(let $ in this[A0]){if(J.has($))continue;let Y=this[A0][$],Q=Z[A0][$];if(Y instanceof B5||Q instanceof B5){if(!nL1(Y,Q))return!1}else if(Y instanceof N0||Q instanceof N0||Y instanceof D6||Q instanceof D6){if(!aL1(Y,Q))return!1}else if(Y instanceof r1||Q instanceof r1){if(!sL1(Y,Q))return!1}else if(KY(Y)||KY(Q)){if(!_n(Y,Q))return!1}else if(c2(Y)||c2(Q)){if(!Sn(Y,Q))return!1}else if(Y!==Q)return!1}return!0}detach(){return this.graph.disconnectParents(this,(Z)=>Z.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}}class E6 extends n2{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new r1})}getExtension(Z){return this.getRefMap("extensions",Z)}setExtension(Z,J){if(J)J._validateParent(this);return this.setRefMap("extensions",Z,J)}listExtensions(){return this.listRefMapValues("extensions")}}class M0 extends E6{init(){this.propertyType=s.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:M0.Type.SCALAR,componentType:M0.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(Z){switch(Z){case M0.Type.SCALAR:return 1;case M0.Type.VEC2:return 2;case M0.Type.VEC3:return 3;case M0.Type.VEC4:return 4;case M0.Type.MAT2:return 4;case M0.Type.MAT3:return 9;case M0.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+Z)}}static getComponentSize(Z){switch(Z){case M0.ComponentType.BYTE:return 1;case M0.ComponentType.UNSIGNED_BYTE:return 1;case M0.ComponentType.SHORT:return 2;case M0.ComponentType.UNSIGNED_SHORT:return 2;case M0.ComponentType.UNSIGNED_INT:return 4;case M0.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+Z)}}getMinNormalized(Z){let J=this.getNormalized(),$=this.getElementSize(),Y=this.getComponentType();if(this.getMin(Z),J)for(let Q=0;Q<$;Q++)Z[Q]=G8.decodeNormalizedInt(Z[Q],Y);return Z}getMin(Z){let J=this.getArray(),$=this.getCount(),Y=this.getElementSize();for(let Q=0;Q<Y;Q++)Z[Q]=1/0;for(let Q=0;Q<$*Y;Q+=Y)for(let W=0;W<Y;W++){let X=J[Q+W];if(Number.isFinite(X))Z[W]=Math.min(Z[W],X)}return Z}getMaxNormalized(Z){let J=this.getNormalized(),$=this.getElementSize(),Y=this.getComponentType();if(this.getMax(Z),J)for(let Q=0;Q<$;Q++)Z[Q]=G8.decodeNormalizedInt(Z[Q],Y);return Z}getMax(Z){let J=this.get("array"),$=this.getCount(),Y=this.getElementSize();for(let Q=0;Q<Y;Q++)Z[Q]=-1/0;for(let Q=0;Q<$*Y;Q+=Y)for(let W=0;W<Y;W++){let X=J[Q+W];if(Number.isFinite(X))Z[W]=Math.max(Z[W],X)}return Z}getCount(){let Z=this.get("array");return Z?Z.length/this.getElementSize():0}getType(){return this.get("type")}setType(Z){return this.set("type",Z)}getElementSize(){return M0.getElementSize(this.get("type"))}getComponentSize(){return this.get("array").BYTES_PER_ELEMENT}getComponentType(){return this.get("componentType")}getNormalized(){return this.get("normalized")}setNormalized(Z){return this.set("normalized",Z)}getScalar(Z){let J=this.getElementSize(),$=this.getComponentType(),Y=this.getArray();if(this.getNormalized())return G8.decodeNormalizedInt(Y[Z*J],$);return Y[Z*J]}setScalar(Z,J){let $=this.getElementSize(),Y=this.getComponentType(),Q=this.getArray();if(this.getNormalized())Q[Z*$]=G8.encodeNormalizedInt(J,Y);else Q[Z*$]=J;return this}getElement(Z,J){let $=this.getNormalized(),Y=this.getElementSize(),Q=this.getComponentType(),W=this.getArray();for(let X=0;X<Y;X++)if($)J[X]=G8.decodeNormalizedInt(W[Z*Y+X],Q);else J[X]=W[Z*Y+X];return J}setElement(Z,J){let $=this.getNormalized(),Y=this.getElementSize(),Q=this.getComponentType(),W=this.getArray();for(let X=0;X<Y;X++)if($)W[Z*Y+X]=G8.encodeNormalizedInt(J[X],Q);else W[Z*Y+X]=J[X];return this}getSparse(){return this.get("sparse")}setSparse(Z){return this.set("sparse",Z)}getBuffer(){return this.getRef("buffer")}setBuffer(Z){return this.setRef("buffer",Z)}getArray(){return this.get("array")}setArray(Z){return this.set("componentType",Z?rL1(Z):M0.ComponentType.FLOAT),this.set("array",Z),this}getByteLength(){let Z=this.get("array");return Z?Z.byteLength:0}}M0.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};M0.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function rL1(Z){switch(Z.constructor){case Float32Array:return M0.ComponentType.FLOAT;case Uint32Array:return M0.ComponentType.UNSIGNED_INT;case Uint16Array:return M0.ComponentType.UNSIGNED_SHORT;case Uint8Array:return M0.ComponentType.UNSIGNED_BYTE;case Int16Array:return M0.ComponentType.SHORT;case Int8Array:return M0.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class CD extends E6{init(){this.propertyType=s.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new N0,samplers:new N0})}addChannel(Z){return this.addRef("channels",Z)}removeChannel(Z){return this.removeRef("channels",Z)}listChannels(){return this.listRefs("channels")}addSampler(Z){return this.addRef("samplers",Z)}removeSampler(Z){return this.removeRef("samplers",Z)}listSamplers(){return this.listRefs("samplers")}}class bG extends E6{init(){this.propertyType=s.ANIMATION_CHANNEL}getDefaults(){return Object.assign(super.getDefaults(),{targetPath:null,targetNode:null,sampler:null})}getTargetPath(){return this.get("targetPath")}setTargetPath(Z){return this.set("targetPath",Z)}getTargetNode(){return this.getRef("targetNode")}setTargetNode(Z){return this.setRef("targetNode",Z)}getSampler(){return this.getRef("sampler")}setSampler(Z){return this.setRef("sampler",Z)}}bG.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class tW extends E6{init(){this.propertyType=s.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:tW.Interpolation.LINEAR,input:null,output:null})}getInterpolation(){return this.get("interpolation")}setInterpolation(Z){return this.set("interpolation",Z)}getInput(){return this.getRef("input")}setInput(Z){return this.setRef("input",Z,{usage:i5.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:i5.OTHER})}}tW.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class TD extends E6{init(){this.propertyType=s.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(Z){return this.set("uri",Z)}}class yG extends E6{init(){this.propertyType=s.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:yG.Type.PERSPECTIVE,znear:0.1,zfar:100,aspectRatio:null,yfov:Math.PI*2*50/360,xmag:1,ymag:1})}getType(){return this.get("type")}setType(Z){return this.set("type",Z)}getZNear(){return this.get("znear")}setZNear(Z){return this.set("znear",Z)}getZFar(){return this.get("zfar")}setZFar(Z){return this.set("zfar",Z)}getAspectRatio(){return this.get("aspectRatio")}setAspectRatio(Z){return this.set("aspectRatio",Z)}getYFov(){return this.get("yfov")}setYFov(Z){return this.set("yfov",Z)}getXMag(){return this.get("xmag")}setXMag(Z){return this.set("xmag",Z)}getYMag(){return this.get("ymag")}setYMag(Z){return this.set("ymag",Z)}}yG.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class i1 extends n2{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}i1.EXTENSION_NAME=void 0;class D1 extends E6{init(){this.propertyType=s.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:D1.WrapMode.REPEAT,wrapT:D1.WrapMode.REPEAT})}getTexCoord(){return this.get("texCoord")}setTexCoord(Z){return this.set("texCoord",Z)}getMagFilter(){return this.get("magFilter")}setMagFilter(Z){return this.set("magFilter",Z)}getMinFilter(){return this.get("minFilter")}setMinFilter(Z){return this.set("minFilter",Z)}getWrapS(){return this.get("wrapS")}setWrapS(Z){return this.set("wrapS",Z)}getWrapT(){return this.get("wrapT")}setWrapT(Z){return this.set("wrapT",Z)}}D1.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};D1.MagFilter={NEAREST:9728,LINEAR:9729};D1.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:m2,G:u2,B:d2,A:tL1}=n5;class gG extends E6{init(){this.propertyType=s.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:gG.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new D1(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new D1(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new D1(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new D1(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new D1(this.graph,"metallicRoughnessTextureInfo")})}getDoubleSided(){return this.get("doubleSided")}setDoubleSided(Z){return this.set("doubleSided",Z)}getAlpha(){return this.get("baseColorFactor")[3]}setAlpha(Z){let J=this.get("baseColorFactor").slice();return J[3]=Z,this.set("baseColorFactor",J)}getAlphaMode(){return this.get("alphaMode")}setAlphaMode(Z){return this.set("alphaMode",Z)}getAlphaCutoff(){return this.get("alphaCutoff")}setAlphaCutoff(Z){return this.set("alphaCutoff",Z)}getBaseColorFactor(){return this.get("baseColorFactor")}setBaseColorFactor(Z){return this.set("baseColorFactor",Z)}getBaseColorTexture(){return this.getRef("baseColorTexture")}getBaseColorTextureInfo(){return this.getRef("baseColorTexture")?this.getRef("baseColorTextureInfo"):null}setBaseColorTexture(Z){return this.setRef("baseColorTexture",Z,{channels:m2|u2|d2|tL1,isColor:!0})}getEmissiveFactor(){return this.get("emissiveFactor")}setEmissiveFactor(Z){return this.set("emissiveFactor",Z)}getEmissiveTexture(){return this.getRef("emissiveTexture")}getEmissiveTextureInfo(){return this.getRef("emissiveTexture")?this.getRef("emissiveTextureInfo"):null}setEmissiveTexture(Z){return this.setRef("emissiveTexture",Z,{channels:m2|u2|d2,isColor:!0})}getNormalScale(){return this.get("normalScale")}setNormalScale(Z){return this.set("normalScale",Z)}getNormalTexture(){return this.getRef("normalTexture")}getNormalTextureInfo(){return this.getRef("normalTexture")?this.getRef("normalTextureInfo"):null}setNormalTexture(Z){return this.setRef("normalTexture",Z,{channels:m2|u2|d2})}getOcclusionStrength(){return this.get("occlusionStrength")}setOcclusionStrength(Z){return this.set("occlusionStrength",Z)}getOcclusionTexture(){return this.getRef("occlusionTexture")}getOcclusionTextureInfo(){return this.getRef("occlusionTexture")?this.getRef("occlusionTextureInfo"):null}setOcclusionTexture(Z){return this.setRef("occlusionTexture",Z,{channels:m2})}getRoughnessFactor(){return this.get("roughnessFactor")}setRoughnessFactor(Z){return this.set("roughnessFactor",Z)}getMetallicFactor(){return this.get("metallicFactor")}setMetallicFactor(Z){return this.set("metallicFactor",Z)}getMetallicRoughnessTexture(){return this.getRef("metallicRoughnessTexture")}getMetallicRoughnessTextureInfo(){return this.getRef("metallicRoughnessTexture")?this.getRef("metallicRoughnessTextureInfo"):null}setMetallicRoughnessTexture(Z){return this.setRef("metallicRoughnessTexture",Z,{channels:u2|d2})}}gG.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class kD extends E6{init(){this.propertyType=s.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new N0})}addPrimitive(Z){return this.addRef("primitives",Z)}removePrimitive(Z){return this.removeRef("primitives",Z)}listPrimitives(){return this.listRefs("primitives")}getWeights(){return this.get("weights")}setWeights(Z){return this.set("weights",Z)}}class ED extends E6{init(){this.propertyType=s.NODE}getDefaults(){return Object.assign(super.getDefaults(),{translation:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1],weights:[],camera:null,mesh:null,skin:null,children:new N0})}copy(Z,J=UJ){if(J===UJ)throw new Error("Node cannot be copied.");return super.copy(Z,J)}getTranslation(){return this.get("translation")}getRotation(){return this.get("rotation")}getScale(){return this.get("scale")}setTranslation(Z){return this.set("translation",Z)}setRotation(Z){return this.set("rotation",Z)}setScale(Z){return this.set("scale",Z)}getMatrix(){return G8.compose(this.get("translation"),this.get("rotation"),this.get("scale"),[])}setMatrix(Z){let J=this.get("translation").slice(),$=this.get("rotation").slice(),Y=this.get("scale").slice();return G8.decompose(Z,J,$,Y),this.set("translation",J).set("rotation",$).set("scale",Y)}getWorldTranslation(){let Z=[0,0,0];return G8.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return G8.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return G8.decompose(this.getWorldMatrix(),[0,0,0],[0,0,0,1],Z),Z}getWorldMatrix(){let Z=[];for(let Y=this;Y!=null;Y=Y.getParentNode())Z.push(Y);let J,$=Z.pop().getMatrix();while(J=Z.pop())lL1($,$,J.getMatrix());return $}addChild(Z){let J=Z.getParentNode();if(J)J.removeChild(Z);for(let $ of Z.listParents())if($.propertyType===s.SCENE)$.removeChild(Z);return this.addRef("children",Z)}removeChild(Z){return this.removeRef("children",Z)}listChildren(){return this.listRefs("children")}getParentNode(){for(let Z of this.listParents())if(Z.propertyType===s.NODE)return Z;return null}getMesh(){return this.getRef("mesh")}setMesh(Z){return this.setRef("mesh",Z)}getCamera(){return this.getRef("camera")}setCamera(Z){return this.setRef("camera",Z)}getSkin(){return this.getRef("skin")}setSkin(Z){return this.setRef("skin",Z)}getWeights(){return this.get("weights")}setWeights(Z){return this.set("weights",Z)}traverse(Z){Z(this);for(let J of this.listChildren())J.traverse(Z);return this}}class LJ extends E6{init(){this.propertyType=s.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:LJ.Mode.TRIANGLES,material:null,indices:null,attributes:new r1,targets:new N0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:i5.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:i5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}getMaterial(){return this.getRef("material")}setMaterial(Z){return this.setRef("material",Z)}getMode(){return this.get("mode")}setMode(Z){return this.set("mode",Z)}listTargets(){return this.listRefs("targets")}addTarget(Z){return this.addRef("targets",Z)}removeTarget(Z){return this.removeRef("targets",Z)}}LJ.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class An extends n2{init(){this.propertyType=s.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new r1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:i5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function l2(){return l2=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var $=arguments[J];for(var Y in $)({}).hasOwnProperty.call($,Y)&&(Z[Y]=$[Y])}return Z},l2.apply(null,arguments)}class ID extends E6{init(){this.propertyType=s.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new N0})}copy(Z,J=UJ){if(J===UJ)throw new Error("Scene cannot be copied.");return super.copy(Z,J)}addChild(Z){let J=Z.getParentNode();if(J)J.removeChild(Z);return this.addRef("children",Z)}removeChild(Z){return this.removeRef("children",Z)}listChildren(){return this.listRefs("children")}traverse(Z){for(let J of this.listChildren())J.traverse(Z);return this}}class vD extends E6{init(){this.propertyType=s.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new N0})}getSkeleton(){return this.getRef("skeleton")}setSkeleton(Z){return this.setRef("skeleton",Z)}getInverseBindMatrices(){return this.getRef("inverseBindMatrices")}setInverseBindMatrices(Z){return this.setRef("inverseBindMatrices",Z,{usage:i5.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class SD extends E6{init(){this.propertyType=s.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||L4.extensionToMimeType(hG.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=L4.extensionToMimeType(hG.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",k6.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return L4.getSize(Z,this.getMimeType())}}class a2 extends E6{init(){this.propertyType=s.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${yL1}`,version:"2.0"},defaultScene:null,accessors:new N0,animations:new N0,buffers:new N0,cameras:new N0,materials:new N0,meshes:new N0,nodes:new N0,scenes:new N0,skins:new N0,textures:new N0})}constructor(Z){super(Z);this._extensions=new Set,Z.addEventListener("node:create",(J)=>{this._addChildOfRoot(J.target)})}clone(){throw new Error("Root cannot be cloned.")}copy(Z,J=UJ){if(J===UJ)throw new Error("Root cannot be copied.");this.set("asset",l2({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(l2({},Z.getExtras())),this.setDefaultScene(Z.getDefaultScene()?J(Z.getDefaultScene()):null);for(let $ of Z.listRefMapKeys("extensions")){let Y=Z.getExtension($);this.setExtension($,J(Y))}return this}_addChildOfRoot(Z){if(Z instanceof ID)this.addRef("scenes",Z);else if(Z instanceof ED)this.addRef("nodes",Z);else if(Z instanceof yG)this.addRef("cameras",Z);else if(Z instanceof vD)this.addRef("skins",Z);else if(Z instanceof kD)this.addRef("meshes",Z);else if(Z instanceof gG)this.addRef("materials",Z);else if(Z instanceof SD)this.addRef("textures",Z);else if(Z instanceof CD)this.addRef("animations",Z);else if(Z instanceof M0)this.addRef("accessors",Z);else if(Z instanceof TD)this.addRef("buffers",Z);return this}getAsset(){return this.get("asset")}listExtensionsUsed(){return Array.from(this._extensions)}listExtensionsRequired(){return this.listExtensionsUsed().filter((Z)=>Z.isRequired())}_enableExtension(Z){return this._extensions.add(Z),this}_disableExtension(Z){return this._extensions.delete(Z),this}listScenes(){return this.listRefs("scenes")}setDefaultScene(Z){return this.setRef("defaultScene",Z)}getDefaultScene(){return this.getRef("defaultScene")}listNodes(){return this.listRefs("nodes")}listCameras(){return this.listRefs("cameras")}listSkins(){return this.listRefs("skins")}listMeshes(){return this.listRefs("meshes")}listMaterials(){return this.listRefs("materials")}listTextures(){return this.listRefs("textures")}listAnimations(){return this.listRefs("animations")}listAccessors(){return this.listRefs("accessors")}listBuffers(){return this.listRefs("buffers")}}class p2{static fromGraph(Z){return p2._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new yW,this._root=new a2(this._graph),this._logger=Y7.DEFAULT_INSTANCE,p2._GRAPH_DOCUMENTS.set(this._graph,this)}getRoot(){return this._root}getGraph(){return this._graph}getLogger(){return this._logger}setLogger(Z){return this._logger=Z,this}clone(){throw new Error("Use 'cloneDocument(source)' from '@gltf-transform/functions'.")}merge(Z){throw new Error("Use 'mergeDocuments(target, source)' from '@gltf-transform/functions'.")}async transform(...Z){let J=Z.map(($)=>$.name);for(let $ of Z)await $(this,{stack:J});return this}createExtension(Z){let J=Z.EXTENSION_NAME;return this.getRoot().listExtensionsUsed().find((Y)=>Y.extensionName===J)||new Z(this)}createScene(Z=""){return new ID(this._graph,Z)}createNode(Z=""){return new ED(this._graph,Z)}createCamera(Z=""){return new yG(this._graph,Z)}createSkin(Z=""){return new vD(this._graph,Z)}createMesh(Z=""){return new kD(this._graph,Z)}createPrimitive(){return new LJ(this._graph)}createPrimitiveTarget(Z=""){return new An(this._graph,Z)}createMaterial(Z=""){return new gG(this._graph,Z)}createTexture(Z=""){return new SD(this._graph,Z)}createAnimation(Z=""){return new CD(this._graph,Z)}createAnimationChannel(Z=""){return new bG(this._graph,Z)}createAnimationSampler(Z=""){return new tW(this._graph,Z)}createAccessor(Z="",J=null){if(!J)J=this.getRoot().listBuffers()[0];return new M0(this._graph,Z).setBuffer(J)}createBuffer(Z=""){return new TD(this._graph,Z)}}p2._GRAPH_DOCUMENTS=new WeakMap;class E1{constructor(Z){this.extensionName="",this.prereadTypes=[],this.prewriteTypes=[],this.readDependencies=[],this.writeDependencies=[],this.document=void 0,this.required=!1,this.properties=new Set,this._listener=void 0,this.document=Z,Z.getRoot()._enableExtension(this),this._listener=($)=>{let Y=$,Q=Y.target;if(Q instanceof i1&&Q.extensionName===this.extensionName){if(Y.type==="node:create")this._addExtensionProperty(Q);if(Y.type==="node:dispose")this._removeExtensionProperty(Q)}};let J=Z.getGraph();J.addEventListener("node:create",this._listener),J.addEventListener("node:dispose",this._listener)}dispose(){this.document.getRoot()._disableExtension(this);let Z=this.document.getGraph();Z.removeEventListener("node:create",this._listener),Z.removeEventListener("node:dispose",this._listener);for(let J of this.properties)J.dispose()}static register(){}isRequired(){return this.required}setRequired(Z){return this.required=Z,this}listProperties(){return Array.from(this.properties)}_addExtensionProperty(Z){return this.properties.add(Z),this}_removeExtensionProperty(Z){return this.properties.delete(Z),this}install(Z,J){return this}preread(Z,J){return this}prewrite(Z,J){return this}}E1.EXTENSION_NAME=void 0;var NH6={logger:Y7.DEFAULT_INSTANCE,extensions:[],dependencies:{}},PH6=new Set([s.BUFFER,s.TEXTURE,s.MATERIAL,s.MESH,s.PRIMITIVE,s.NODE,s.SCENE]);var fG;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(fG||(fG={}));class wJ{constructor(Z,J,$){this._doc=void 0,this.jsonDoc=void 0,this.options=void 0,this.accessorIndexMap=new Map,this.animationIndexMap=new Map,this.bufferIndexMap=new Map,this.cameraIndexMap=new Map,this.skinIndexMap=new Map,this.materialIndexMap=new Map,this.meshIndexMap=new Map,this.nodeIndexMap=new Map,this.imageIndexMap=new Map,this.textureDefIndexMap=new Map,this.textureInfoDefMap=new Map,this.samplerDefIndexMap=new Map,this.sceneIndexMap=new Map,this.imageBufferViews=[],this.otherBufferViews=new Map,this.otherBufferViewsIndexMap=new Map,this.extensionData={},this.bufferURIGenerator=void 0,this.imageURIGenerator=void 0,this.logger=void 0,this._accessorUsageMap=new Map,this.accessorUsageGroupedByParent=new Set(["ARRAY_BUFFER"]),this.accessorParents=new Map,this._doc=Z,this.jsonDoc=J,this.options=$;let Y=Z.getRoot(),Q=Y.listBuffers().length,W=Y.listTextures().length;this.bufferURIGenerator=new ND(Q>1,()=>$.basename||"buffer"),this.imageURIGenerator=new ND(W>1,(X)=>eL1(Z,X)||$.basename||"texture"),this.logger=Z.getLogger()}createTextureInfoDef(Z,J){let $={magFilter:J.getMagFilter()||void 0,minFilter:J.getMinFilter()||void 0,wrapS:J.getWrapS(),wrapT:J.getWrapT()},Y=JSON.stringify($);if(!this.samplerDefIndexMap.has(Y))this.samplerDefIndexMap.set(Y,this.jsonDoc.json.samplers.length),this.jsonDoc.json.samplers.push($);let Q={source:this.imageIndexMap.get(Z),sampler:this.samplerDefIndexMap.get(Y)},W=JSON.stringify(Q);if(!this.textureDefIndexMap.has(W))this.textureDefIndexMap.set(W,this.jsonDoc.json.textures.length),this.jsonDoc.json.textures.push(Q);let X={index:this.textureDefIndexMap.get(W)};if(J.getTexCoord()!==0)X.texCoord=J.getTexCoord();if(Object.keys(J.getExtras()).length>0)X.extras=J.getExtras();return this.textureInfoDefMap.set(J,X),X}createPropertyDef(Z){let J={};if(Z.getName())J.name=Z.getName();if(Object.keys(Z.getExtras()).length>0)J.extras=Z.getExtras();return J}createAccessorDef(Z){let J=this.createPropertyDef(Z);if(J.type=Z.getType(),J.componentType=Z.getComponentType(),J.count=Z.getCount(),this._doc.getGraph().listParentEdges(Z).some((Y)=>Y.getName()==="attributes"&&Y.getAttributes().key==="POSITION"||Y.getName()==="input"))J.max=Z.getMax([]).map(Math.fround),J.min=Z.getMin([]).map(Math.fround);if(Z.getNormalized())J.normalized=Z.getNormalized();return J}createImageData(Z,J,$){if(this.options.format===BD.GLB)this.imageBufferViews.push(J),Z.bufferView=this.jsonDoc.json.bufferViews.length,this.jsonDoc.json.bufferViews.push({buffer:0,byteOffset:-1,byteLength:J.byteLength});else{let Y=L4.mimeTypeToExtension($.getMimeType());Z.uri=this.imageURIGenerator.createURI($,Y),this.assignResourceURI(Z.uri,J,!1)}}assignResourceURI(Z,J,$){let Y=this.jsonDoc.resources;if(!(Z in Y)){Y[Z]=J;return}if(J===Y[Z]){this.logger.warn(`Duplicate resource URI, "${Z}".`);return}let Q=`Resource URI "${Z}" already assigned to different data.`;if(!$){this.logger.warn(Q);return}throw new Error(Q)}getAccessorUsage(Z){let J=this._accessorUsageMap.get(Z);if(J)return J;if(Z.getSparse())return i5.SPARSE;for(let $ of this._doc.getGraph().listParentEdges(Z)){let{usage:Y}=$.getAttributes();if(Y)return Y;if($.getParent().propertyType!==s.ROOT)this.logger.warn(`Missing attribute ".usage" on edge, "${$.getName()}".`)}return i5.OTHER}addAccessorToUsageGroup(Z,J){let $=this._accessorUsageMap.get(Z);if($&&$!==J)throw new Error(`Accessor with usage "${$}" cannot be reused as "${J}".`);return this._accessorUsageMap.set(Z,J),this}}wJ.BufferViewTarget=fG;wJ.BufferViewUsage=i5;wJ.USAGE_TO_TARGET={[i5.ARRAY_BUFFER]:fG.ARRAY_BUFFER,[i5.ELEMENT_ARRAY_BUFFER]:fG.ELEMENT_ARRAY_BUFFER};class ND{constructor(Z,J){this.multiple=void 0,this.basename=void 0,this.counter={},this.multiple=Z,this.basename=J}createURI(Z,J){if(Z.getURI())return Z.getURI();else if(!this.multiple)return`${this.basename(Z)}.${J}`;else{let $=this.basename(Z);return this.counter[$]=this.counter[$]||1,`${$}_${this.counter[$]++}.${J}`}}}function eL1(Z,J){let $=Z.getGraph().listParentEdges(J).find((Y)=>Y.getParent()!==Z.getRoot());return $?$.getName().replace(/texture$/i,""):""}var{UNSIGNED_INT:DH6,UNSIGNED_SHORT:CH6,UNSIGNED_BYTE:TH6}=M0.ComponentType,kH6=new Set([s.ACCESSOR,s.BUFFER,s.MATERIAL,s.MESH]);var kn;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(kn||(kn={}));var hn=163,fn=166;function Zw1(){return{vkFormat:0,typeSize:1,pixelWidth:0,pixelHeight:0,pixelDepth:0,layerCount:0,faceCount:1,supercompressionScheme:0,levels:[],dataFormatDescriptor:[{vendorId:0,descriptorType:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],keyValue:{},globalData:null}}class eW{constructor(Z,J,$,Y){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(Z.buffer,Z.byteOffset+J,$),this._littleEndian=Y,this._offset=0}_nextUint8(){let Z=this._dataView.getUint8(this._offset);return this._offset+=1,Z}_nextUint16(){let Z=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,Z}_nextUint32(){let Z=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,Z}_nextUint64(){let Z=this._dataView.getUint32(this._offset,this._littleEndian),J=this._dataView.getUint32(this._offset+4,this._littleEndian),$=Z+4294967296*J;return this._offset+=8,$}_nextInt32(){let Z=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,Z}_nextUint8Array(Z){let J=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,Z);return this._offset+=Z,J}_skip(Z){return this._offset+=Z,this}_scan(Z,J=0){let $=this._offset,Y=0;while(this._dataView.getUint8(this._offset)!==J&&Y<Z)Y++,this._offset++;if(Y<Z)this._offset++;return new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+$,Y)}}var vH6=new Uint8Array([0]),s6=[171,75,84,88,32,50,48,187,13,10,26,10];function xn(Z){return new TextDecoder().decode(Z)}function s2(Z){let J=new Uint8Array(Z.buffer,Z.byteOffset,s6.length);if(J[0]!==s6[0]||J[1]!==s6[1]||J[2]!==s6[2]||J[3]!==s6[3]||J[4]!==s6[4]||J[5]!==s6[5]||J[6]!==s6[6]||J[7]!==s6[7]||J[8]!==s6[8]||J[9]!==s6[9]||J[10]!==s6[10]||J[11]!==s6[11])throw new Error("Missing KTX 2.0 identifier.");let $=Zw1(),Y=17*Uint32Array.BYTES_PER_ELEMENT,Q=new eW(Z,s6.length,Y,!0);$.vkFormat=Q._nextUint32(),$.typeSize=Q._nextUint32(),$.pixelWidth=Q._nextUint32(),$.pixelHeight=Q._nextUint32(),$.pixelDepth=Q._nextUint32(),$.layerCount=Q._nextUint32(),$.faceCount=Q._nextUint32();let W=Q._nextUint32();$.supercompressionScheme=Q._nextUint32();let X=Q._nextUint32(),K=Q._nextUint32(),G=Q._nextUint32(),z=Q._nextUint32(),H=Q._nextUint64(),V=Q._nextUint64(),q=W*3*8,F=new eW(Z,s6.length+Y,q,!0);for(let V6=0;V6<W;V6++)$.levels.push({levelData:new Uint8Array(Z.buffer,Z.byteOffset+F._nextUint64(),F._nextUint64()),uncompressedByteLength:F._nextUint64()});let U=new eW(Z,X,K,!0);U._skip(4);let w=U._nextUint16(),L=U._nextUint16(),O=U._nextUint16(),j=U._nextUint16(),M=U._nextUint8(),N=U._nextUint8(),D=U._nextUint8(),P=U._nextUint8(),C=[U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8()],T=[U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8()],A={vendorId:w,descriptorType:L,versionNumber:O,colorModel:M,colorPrimaries:N,transferFunction:D,flags:P,texelBlockDimension:C,bytesPlane:T,samples:[]},S=6,x=4,I=(j/4-S)/x;for(let V6=0;V6<I;V6++){let p7={bitOffset:U._nextUint16(),bitLength:U._nextUint8(),channelType:U._nextUint8(),samplePosition:[U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8()],sampleLower:Number.NEGATIVE_INFINITY,sampleUpper:Number.POSITIVE_INFINITY};if(p7.channelType&64)p7.sampleLower=U._nextInt32(),p7.sampleUpper=U._nextInt32();else p7.sampleLower=U._nextUint32(),p7.sampleUpper=U._nextUint32();A.samples[V6]=p7}$.dataFormatDescriptor.length=0,$.dataFormatDescriptor.push(A);let v=new eW(Z,G,z,!0);while(v._offset<z){let V6=v._nextUint32(),p7=v._scan(V6),nq=xn(p7);if($.keyValue[nq]=v._nextUint8Array(V6-p7.byteLength-1),nq.match(/^ktx/i)){let Qb=xn($.keyValue[nq]);$.keyValue[nq]=Qb.substring(0,Qb.lastIndexOf("\x00"))}let YY1=V6%4?4-V6%4:0;v._skip(YY1)}if(V<=0)return $;let f=new eW(Z,H,V,!0),p=f._nextUint16(),n=f._nextUint16(),o=f._nextUint32(),$0=f._nextUint32(),W0=f._nextUint32(),C0=f._nextUint32(),T0=[];for(let V6=0;V6<W;V6++)T0.push({imageFlags:f._nextUint32(),rgbSliceByteOffset:f._nextUint32(),rgbSliceByteLength:f._nextUint32(),alphaSliceByteOffset:f._nextUint32(),alphaSliceByteLength:f._nextUint32()});let a0=H+f._offset,_8=a0+o,s1=_8+$0,u4=s1+W0,J4=new Uint8Array(Z.buffer,Z.byteOffset+a0,o),VW=new Uint8Array(Z.buffer,Z.byteOffset+_8,$0),qW=new Uint8Array(Z.buffer,Z.byteOffset+s1,W0),f$=new Uint8Array(Z.buffer,Z.byteOffset+u4,C0);return $.globalData={endpointCount:p,selectorCount:n,imageDescs:T0,endpointsData:J4,selectorsData:VW,tablesData:qW,extendedData:f$},$}var fD="EXT_mesh_gpu_instancing",AD="EXT_meshopt_compression",Jw1="EXT_texture_webp",$w1="EXT_texture_avif",rn="KHR_draco_mesh_compression",bD="KHR_lights_punctual",yD="KHR_materials_anisotropy",gD="KHR_materials_clearcoat",mD="KHR_materials_diffuse_transmission",uD="KHR_materials_dispersion",dD="KHR_materials_emissive_strength",cD="KHR_materials_ior",lD="KHR_materials_iridescence",pD="KHR_materials_pbrSpecularGlossiness",iD="KHR_materials_sheen",nD="KHR_materials_specular",aD="KHR_materials_transmission",sD="KHR_materials_unlit",oD="KHR_materials_volume",NY="KHR_materials_variants",Yw1="KHR_mesh_quantization",Qw1="KHR_texture_basisu",rD="KHR_texture_transform",o2="KHR_xmp_json_ld",xD="INSTANCE_ATTRIBUTE";class tD extends i1{init(){this.extensionName=fD,this.propertyType="InstancedMesh",this.parentTypes=[s.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new r1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:xD})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}tD.EXTENSION_NAME=fD;var GY=fD;class e2 extends E1{constructor(...Z){super(...Z);this.extensionName=GY,this.provideTypes=[s.NODE],this.prewriteTypes=[s.ACCESSOR]}createInstancedMesh(){return new tD(this.document.getGraph())}read(Z){return(Z.jsonDoc.json.nodes||[]).forEach((Y,Q)=>{if(!Y.extensions||!Y.extensions[GY])return;let W=Y.extensions[GY],X=this.createInstancedMesh();for(let K in W.attributes)X.setAttribute(K,Z.accessors[W.attributes[K]]);Z.nodes[Q].setExtension(GY,X)}),this}prewrite(Z){Z.accessorUsageGroupedByParent.add(xD);for(let J of this.properties)for(let $ of J.listAttributes())Z.addAccessorToUsageGroup($,xD);return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listNodes().forEach(($)=>{let Y=$.getExtension(GY);if(Y){let Q=Z.nodeIndexMap.get($),W=J.json.nodes[Q],X={attributes:{}};Y.listSemantics().forEach((K)=>{let G=Y.getAttribute(K);X.attributes[K]=Z.accessorIndexMap.get(G)}),W.extensions=W.extensions||{},W.extensions[GY]=X}}),this}}e2.EXTENSION_NAME=GY;function zZ(){return zZ=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var $=arguments[J];for(var Y in $)({}).hasOwnProperty.call($,Y)&&(Z[Y]=$[Y])}return Z},zZ.apply(null,arguments)}var cG;(function(Z){Z.QUANTIZE="quantize",Z.FILTER="filter"})(cG||(cG={}));var JX;(function(Z){Z.ATTRIBUTES="ATTRIBUTES",Z.TRIANGLES="TRIANGLES",Z.INDICES="INDICES"})(JX||(JX={}));var z8;(function(Z){Z.NONE="NONE",Z.OCTAHEDRAL="OCTAHEDRAL",Z.QUATERNION="QUATERNION",Z.EXPONENTIAL="EXPONENTIAL"})(z8||(z8={}));var{BYTE:Ww1,SHORT:bn,FLOAT:Xw1}=M0.ComponentType,{encodeNormalizedInt:yn,decodeNormalizedInt:hD}=G8;function Kw1(Z,J,$,Y){let{filter:Q,bits:W}=Y,X={array:Z.getArray(),byteStride:Z.getElementSize()*Z.getComponentSize(),componentType:Z.getComponentType(),normalized:Z.getNormalized()};if($!==JX.ATTRIBUTES)return X;if(Q!==z8.NONE){let K=Z.getNormalized()?Gw1(Z):new Float32Array(X.array);switch(Q){case z8.EXPONENTIAL:X.byteStride=Z.getElementSize()*4,X.componentType=Xw1,X.normalized=!1,X.array=J.encodeFilterExp(K,Z.getCount(),X.byteStride,W);break;case z8.OCTAHEDRAL:X.byteStride=W>8?8:4,X.componentType=W>8?bn:Ww1,X.normalized=!0,K=Z.getElementSize()===3?Hw1(K):K,X.array=J.encodeFilterOct(K,Z.getCount(),X.byteStride,W);break;case z8.QUATERNION:X.byteStride=8,X.componentType=bn,X.normalized=!0,X.array=J.encodeFilterQuat(K,Z.getCount(),X.byteStride,W);break;default:throw new Error("Invalid filter.")}if(X.min=Z.getMin([]),X.max=Z.getMax([]),Z.getNormalized())X.min=X.min.map((G)=>hD(G,Z.getComponentType())),X.max=X.max.map((G)=>hD(G,Z.getComponentType()));if(X.normalized)X.min=X.min.map((G)=>yn(G,X.componentType)),X.max=X.max.map((G)=>yn(G,X.componentType))}else if(X.byteStride%4)X.array=zw1(X.array,Z.getElementSize()),X.byteStride=X.array.byteLength/Z.getCount();return X}function Gw1(Z){let J=Z.getComponentType(),$=Z.getArray(),Y=new Float32Array($.length);for(let Q=0;Q<$.length;Q++)Y[Q]=hD($[Q],J);return Y}function zw1(Z,J){let Y=k6.padNumber(Z.BYTES_PER_ELEMENT*J)/Z.BYTES_PER_ELEMENT,Q=Z.length/J,W=new Z.constructor(Q*Y);for(let X=0;X*J<Z.length;X++)for(let K=0;K<J;K++)W[X*Y+K]=Z[X*J+K];return W}function Hw1(Z){let J=new Float32Array(Z.length*4/3);for(let $=0,Y=Z.length/3;$<Y;$++)J[$*4]=Z[$*3],J[$*4+1]=Z[$*3+1],J[$*4+2]=Z[$*3+2];return J}function Vw1(Z,J){if(J===wJ.BufferViewUsage.ELEMENT_ARRAY_BUFFER)return Z.listParents().some((Y)=>{return Y instanceof LJ&&Y.getMode()===LJ.Mode.TRIANGLES})?JX.TRIANGLES:JX.INDICES;return JX.ATTRIBUTES}function qw1(Z,J){let $=J.getGraph().listParentEdges(Z).filter((Y)=>!(Y.getParent()instanceof a2));for(let Y of $){let Q=Y.getName(),W=Y.getAttributes().key||"",X=Y.getParent().propertyType===s.PRIMITIVE_TARGET;if(Q==="indices")return{filter:z8.NONE};if(Q==="attributes"){if(W==="POSITION")return{filter:z8.NONE};if(W==="TEXCOORD_0")return{filter:z8.NONE};if(W.startsWith("JOINTS_"))return{filter:z8.NONE};if(W.startsWith("WEIGHTS_"))return{filter:z8.NONE};if(W==="NORMAL"||W==="TANGENT")return X?{filter:z8.NONE}:{filter:z8.OCTAHEDRAL,bits:8}}if(Q==="output"){let K=tn(Z);if(K==="rotation")return{filter:z8.QUATERNION,bits:16};if(K==="translation")return{filter:z8.EXPONENTIAL,bits:12};if(K==="scale")return{filter:z8.EXPONENTIAL,bits:12};return{filter:z8.NONE}}if(Q==="input")return{filter:z8.NONE};if(Q==="inverseBindMatrices")return{filter:z8.NONE}}return{filter:z8.NONE}}function tn(Z){for(let J of Z.listParents()){if(!(J instanceof tW))continue;for(let $ of J.listParents()){if(!($ instanceof bG))continue;return $.getTargetPath()}}return null}function Fw1(Z){if(!Z.extensions||!Z.extensions[AD])return!1;return!!Z.extensions[AD].fallback}var o6=AD,gn={method:cG.QUANTIZE};class pG extends E1{constructor(...Z){super(...Z);this.extensionName=o6,this.prereadTypes=[s.BUFFER,s.PRIMITIVE],this.prewriteTypes=[s.BUFFER,s.ACCESSOR],this.readDependencies=["meshopt.decoder"],this.writeDependencies=["meshopt.encoder"],this._decoder=null,this._decoderFallbackBufferMap=new Map,this._encoder=null,this._encoderOptions=gn,this._encoderFallbackBuffer=null,this._encoderBufferViews={},this._encoderBufferViewData={},this._encoderBufferViewAccessors={}}install(Z,J){if(Z==="meshopt.decoder")this._decoder=J;if(Z==="meshopt.encoder")this._encoder=J;return this}setEncoderOptions(Z){return this._encoderOptions=zZ({},gn,Z),this}preread(Z,J){if(!this._decoder){if(!this.isRequired())return this;throw new Error(`[${o6}] Please install extension dependency, "meshopt.decoder".`)}if(!this._decoder.supported){if(!this.isRequired())return this;throw new Error(`[${o6}]: Missing WASM support.`)}if(J===s.BUFFER)this._prereadBuffers(Z);else if(J===s.PRIMITIVE)this._prereadPrimitives(Z);return this}_prereadBuffers(Z){let J=Z.jsonDoc;(J.json.bufferViews||[]).forEach((Y,Q)=>{if(!Y.extensions||!Y.extensions[o6])return;let W=Y.extensions[o6],X=W.byteOffset||0,K=W.byteLength||0,G=W.count,z=W.byteStride,H=new Uint8Array(G*z),V=J.json.buffers[W.buffer],q=V.uri?J.resources[V.uri]:J.resources[PD],F=k6.toView(q,X,K);this._decoder.decodeGltfBuffer(H,G,z,F,W.mode,W.filter),Z.bufferViews[Q]=H})}_prereadPrimitives(Z){let J=Z.jsonDoc;(J.json.bufferViews||[]).forEach((Y)=>{if(!Y.extensions||!Y.extensions[o6])return;let Q=Y.extensions[o6],W=Z.buffers[Q.buffer],X=Z.buffers[Y.buffer],K=J.json.buffers[Y.buffer];if(Fw1(K))this._decoderFallbackBufferMap.set(X,W)})}read(Z){if(!this.isRequired())return this;for(let[J,$]of this._decoderFallbackBufferMap){for(let Y of J.listParents())if(Y instanceof M0)Y.swap(J,$);J.dispose()}return this}prewrite(Z,J){if(J===s.ACCESSOR)this._prewriteAccessors(Z);else if(J===s.BUFFER)this._prewriteBuffers(Z);return this}_prewriteAccessors(Z){let J=Z.jsonDoc.json,$=this._encoder,Y=this._encoderOptions,Q=this.document.getGraph(),W=this.document.createBuffer(),X=this.document.getRoot().listBuffers().indexOf(W),K=1,G=new Map,z=(H)=>{for(let V of Q.listParents(H)){if(V.propertyType===s.ROOT)continue;let q=G.get(H);if(q===void 0)G.set(H,q=K++);return q}return-1};this._encoderFallbackBuffer=W,this._encoderBufferViews={},this._encoderBufferViewData={},this._encoderBufferViewAccessors={};for(let H of this.document.getRoot().listAccessors()){if(tn(H)==="weights")continue;if(H.getSparse())continue;let V=Z.getAccessorUsage(H),q=Z.accessorUsageGroupedByParent.has(V)?z(H):null,F=Vw1(H,V),U=Y.method===cG.FILTER?qw1(H,this.document):{filter:z8.NONE},w=Kw1(H,$,F,U),{array:L,byteStride:O}=w,j=H.getBuffer();if(!j)throw new Error(`${o6}: Missing buffer for accessor.`);let M=this.document.getRoot().listBuffers().indexOf(j),N=[V,q,F,U.filter,O,M].join(":"),D=this._encoderBufferViews[N],P=this._encoderBufferViewData[N],C=this._encoderBufferViewAccessors[N];if(!D||!P)C=this._encoderBufferViewAccessors[N]=[],P=this._encoderBufferViewData[N]=[],D=this._encoderBufferViews[N]={buffer:X,target:wJ.USAGE_TO_TARGET[V],byteOffset:0,byteLength:0,byteStride:V===wJ.BufferViewUsage.ARRAY_BUFFER?O:void 0,extensions:{[o6]:{buffer:M,byteOffset:0,byteLength:0,mode:F,filter:U.filter!==z8.NONE?U.filter:void 0,byteStride:O,count:0}}};let T=Z.createAccessorDef(H);if(T.componentType=w.componentType,T.normalized=w.normalized,T.byteOffset=D.byteLength,T.min&&w.min)T.min=w.min;if(T.max&&w.max)T.max=w.max;Z.accessorIndexMap.set(H,J.accessors.length),J.accessors.push(T),C.push(T),P.push(new Uint8Array(L.buffer,L.byteOffset,L.byteLength)),D.byteLength+=L.byteLength,D.extensions.EXT_meshopt_compression.count+=H.getCount()}}_prewriteBuffers(Z){let J=this._encoder;for(let $ in this._encoderBufferViews){let Y=this._encoderBufferViews[$],Q=this._encoderBufferViewData[$],W=this.document.getRoot().listBuffers()[Y.extensions[o6].buffer],X=Z.otherBufferViews.get(W)||[],{count:K,byteStride:G,mode:z}=Y.extensions[o6],H=k6.concat(Q),V=J.encodeGltfBuffer(H,K,G,z),q=k6.pad(V);Y.extensions[o6].byteLength=V.byteLength,Q.length=0,Q.push(q),X.push(q),Z.otherBufferViews.set(W,X)}}write(Z){let J=0;for(let W in this._encoderBufferViews){let X=this._encoderBufferViews[W],K=this._encoderBufferViewData[W][0],G=Z.otherBufferViewsIndexMap.get(K),z=this._encoderBufferViewAccessors[W];for(let F of z)F.bufferView=G;let H=Z.jsonDoc.json.bufferViews[G],V=H.byteOffset||0;Object.assign(H,X),H.byteOffset=J;let q=H.extensions[o6];q.byteOffset=V,J+=k6.padNumber(X.byteLength)}let $=this._encoderFallbackBuffer,Y=Z.bufferIndexMap.get($),Q=Z.jsonDoc.json.buffers[Y];return Q.byteLength=J,Q.extensions={[o6]:{fallback:!0}},$.dispose(),this}}pG.EXTENSION_NAME=o6;pG.EncoderMethod=cG;var mG=$w1;class en{match(Z){return Z.length>=12&&k6.decodeText(Z.slice(4,12))==="ftypavif"}getSize(Z){if(!this.match(Z))return null;let J=new DataView(Z.buffer,Z.byteOffset,Z.byteLength),$=mn(J,0);if(!$)return null;let Y=$.end;while($=mn(J,Y))if($.type==="meta")Y=$.start+4;else if($.type==="iprp"||$.type==="ipco")Y=$.start;else if($.type==="ispe")return[J.getUint32($.start+4),J.getUint32($.start+8)];else if($.type==="mdat")break;else Y=$.end;return null}getChannels(Z){return 4}}class ZL extends E1{constructor(...Z){super(...Z);this.extensionName=mG,this.prereadTypes=[s.TEXTURE]}static register(){L4.registerFormat("image/avif",new en)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach(($)=>{if($.extensions&&$.extensions[mG])$.source=$.extensions[mG].source}),this}read(Z){return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listTextures().forEach(($)=>{if($.getMimeType()==="image/avif"){let Y=Z.imageIndexMap.get($);(J.json.textures||[]).forEach((W)=>{if(W.source===Y)W.extensions=W.extensions||{},W.extensions[mG]={source:W.source},delete W.source})}}),this}}ZL.EXTENSION_NAME=mG;function mn(Z,J){if(Z.byteLength<4+J)return null;let $=Z.getUint32(J);if(Z.byteLength<$+J||$<8)return null;return{type:k6.decodeText(new Uint8Array(Z.buffer,Z.byteOffset+J+4,4)),start:J+8,end:J+$}}var uG=Jw1;class Za{match(Z){return Z.length>=12&&Z[8]===87&&Z[9]===69&&Z[10]===66&&Z[11]===80}getSize(Z){let J=k6.decodeText(Z.slice(0,4)),$=k6.decodeText(Z.slice(8,12));if(J!=="RIFF"||$!=="WEBP")return null;let Y=new DataView(Z.buffer,Z.byteOffset),Q=12;while(Q<Y.byteLength){let W=k6.decodeText(new Uint8Array([Y.getUint8(Q),Y.getUint8(Q+1),Y.getUint8(Q+2),Y.getUint8(Q+3)])),X=Y.getUint32(Q+4,!0);if(W==="VP8 "){let K=Y.getInt16(Q+14,!0)&16383,G=Y.getInt16(Q+16,!0)&16383;return[K,G]}else if(W==="VP8L"){let K=Y.getUint8(Q+9),G=Y.getUint8(Q+10),z=Y.getUint8(Q+11),H=Y.getUint8(Q+12),V=1+((G&63)<<8|K),q=1+((H&15)<<10|z<<2|(G&192)>>6);return[V,q]}Q+=8+X+X%2}return null}getChannels(Z){return 4}}class JL extends E1{constructor(...Z){super(...Z);this.extensionName=uG,this.prereadTypes=[s.TEXTURE]}static register(){L4.registerFormat("image/webp",new Za)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach(($)=>{if($.extensions&&$.extensions[uG])$.source=$.extensions[uG].source}),this}read(Z){return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listTextures().forEach(($)=>{if($.getMimeType()==="image/webp"){let Y=Z.imageIndexMap.get($);(J.json.textures||[]).forEach((W)=>{if(W.source===Y)W.extensions=W.extensions||{},W.extensions[uG]={source:W.source},delete W.source})}}),this}}JL.EXTENSION_NAME=uG;var un=rn,c8,Ja,$a;function Uw1(Z,J){let $=new c8.DecoderBuffer;try{if($.Init(J,J.length),Z.GetEncodedGeometryType($)!==c8.TRIANGULAR_MESH)throw new Error(`[${un}] Unknown geometry type.`);let Q=new c8.Mesh;if(!Z.DecodeBufferToMesh($,Q).ok()||Q.ptr===0)throw new Error(`[${un}] Decoding failure.`);return Q}finally{c8.destroy($)}}function Lw1(Z,J){let Y=J.num_faces()*3,Q,W;if(J.num_points()<=65534){let X=Y*Uint16Array.BYTES_PER_ELEMENT;Q=c8._malloc(X),Z.GetTrianglesUInt16Array(J,X,Q),W=new Uint16Array(c8.HEAPU16.buffer,Q,Y).slice()}else{let X=Y*Uint32Array.BYTES_PER_ELEMENT;Q=c8._malloc(X),Z.GetTrianglesUInt32Array(J,X,Q),W=new Uint32Array(c8.HEAPU32.buffer,Q,Y).slice()}return c8._free(Q),W}function ww1(Z,J,$,Y){let Q=$a[Y.componentType],W=Ja[Y.componentType],X=$.num_components(),G=J.num_points()*X,z=G*W.BYTES_PER_ELEMENT,H=c8._malloc(z);Z.GetAttributeDataArrayForAllPoints(J,$,Q,z,H);let V=new W(c8.HEAPF32.buffer,H,G).slice();return c8._free(H),V}function Bw1(Z){c8=Z,Ja={[M0.ComponentType.FLOAT]:Float32Array,[M0.ComponentType.UNSIGNED_INT]:Uint32Array,[M0.ComponentType.UNSIGNED_SHORT]:Uint16Array,[M0.ComponentType.UNSIGNED_BYTE]:Uint8Array,[M0.ComponentType.SHORT]:Int16Array,[M0.ComponentType.BYTE]:Int8Array},$a={[M0.ComponentType.FLOAT]:c8.DT_FLOAT32,[M0.ComponentType.UNSIGNED_INT]:c8.DT_UINT32,[M0.ComponentType.UNSIGNED_SHORT]:c8.DT_UINT16,[M0.ComponentType.UNSIGNED_BYTE]:c8.DT_UINT8,[M0.ComponentType.SHORT]:c8.DT_INT16,[M0.ComponentType.BYTE]:c8.DT_INT8}}var j9,lG;(function(Z){Z[Z.EDGEBREAKER=1]="EDGEBREAKER",Z[Z.SEQUENTIAL=0]="SEQUENTIAL"})(lG||(lG={}));var M9;(function(Z){Z.POSITION="POSITION",Z.NORMAL="NORMAL",Z.COLOR="COLOR",Z.TEX_COORD="TEX_COORD",Z.GENERIC="GENERIC"})(M9||(M9={}));var Ya={[M9.POSITION]:14,[M9.NORMAL]:10,[M9.COLOR]:8,[M9.TEX_COORD]:12,[M9.GENERIC]:12},dn={decodeSpeed:5,encodeSpeed:5,method:lG.EDGEBREAKER,quantizationBits:Ya,quantizationVolume:"mesh"};function Ow1(Z){j9=Z}function jw1(Z,J=dn){let $=zZ({},dn,J);$.quantizationBits=zZ({},Ya,J.quantizationBits);let Y=new j9.MeshBuilder,Q=new j9.Mesh,W=new j9.ExpertEncoder(Q),X={},K=new j9.DracoInt8Array,G=Z.listTargets().length>0,z=!1;for(let w of Z.listSemantics()){let L=Z.getAttribute(w);if(L.getSparse()){z=!0;continue}let O=Mw1(w),j=Rw1(Y,L.getComponentType(),Q,j9[O],L.getCount(),L.getElementSize(),L.getArray());if(j===-1)throw new Error(`Error compressing "${w}" attribute.`);if(X[w]=j,$.quantizationVolume==="mesh"||w!=="POSITION")W.SetAttributeQuantization(j,$.quantizationBits[O]);else if(typeof $.quantizationVolume==="object"){let{quantizationVolume:M}=$,N=Math.max(M.max[0]-M.min[0],M.max[1]-M.min[1],M.max[2]-M.min[2]);W.SetAttributeExplicitQuantization(j,$.quantizationBits[O],L.getElementSize(),M.min,N)}else throw new Error("Invalid quantization volume state.")}let H=Z.getIndices();if(!H)throw new r2("Primitive must have indices.");if(Y.AddFacesToMesh(Q,H.getCount()/3,H.getArray()),W.SetSpeedOptions($.encodeSpeed,$.decodeSpeed),W.SetTrackEncodedProperties(!0),$.method===lG.SEQUENTIAL||G||z)W.SetEncodingMethod(j9.MESH_SEQUENTIAL_ENCODING);else W.SetEncodingMethod(j9.MESH_EDGEBREAKER_ENCODING);let V=W.EncodeToDracoBuffer(!(G||z),K);if(V<=0)throw new r2("Error applying Draco compression.");let q=new Uint8Array(V);for(let w=0;w<V;++w)q[w]=K.GetValue(w);let F=W.GetNumberOfEncodedPoints(),U=W.GetNumberOfEncodedFaces()*3;return j9.destroy(K),j9.destroy(Q),j9.destroy(Y),j9.destroy(W),{numVertices:F,numIndices:U,data:q,attributeIDs:X}}function Mw1(Z){if(Z==="POSITION")return M9.POSITION;else if(Z==="NORMAL")return M9.NORMAL;else if(Z.startsWith("COLOR_"))return M9.COLOR;else if(Z.startsWith("TEXCOORD_"))return M9.TEX_COORD;return M9.GENERIC}function Rw1(Z,J,$,Y,Q,W,X){switch(J){case M0.ComponentType.UNSIGNED_BYTE:return Z.AddUInt8Attribute($,Y,Q,W,X);case M0.ComponentType.BYTE:return Z.AddInt8Attribute($,Y,Q,W,X);case M0.ComponentType.UNSIGNED_SHORT:return Z.AddUInt16Attribute($,Y,Q,W,X);case M0.ComponentType.SHORT:return Z.AddInt16Attribute($,Y,Q,W,X);case M0.ComponentType.UNSIGNED_INT:return Z.AddUInt32Attribute($,Y,Q,W,X);case M0.ComponentType.FLOAT:return Z.AddFloatAttribute($,Y,Q,W,X);default:throw new Error(`Unexpected component type, "${J}".`)}}class r2 extends Error{}var P8=rn;class iG extends E1{constructor(...Z){super(...Z);this.extensionName=P8,this.prereadTypes=[s.PRIMITIVE],this.prewriteTypes=[s.ACCESSOR],this.readDependencies=["draco3d.decoder"],this.writeDependencies=["draco3d.encoder"],this._decoderModule=null,this._encoderModule=null,this._encoderOptions={}}install(Z,J){if(Z==="draco3d.decoder")this._decoderModule=J,Bw1(this._decoderModule);if(Z==="draco3d.encoder")this._encoderModule=J,Ow1(this._encoderModule);return this}setEncoderOptions(Z){return this._encoderOptions=Z,this}preread(Z){if(!this._decoderModule)throw new Error(`[${P8}] Please install extension dependency, "draco3d.decoder".`);let J=this.document.getLogger(),$=Z.jsonDoc,Y=new Map;try{let Q=$.json.meshes||[];for(let W of Q)for(let X of W.primitives){if(!X.extensions||!X.extensions[P8])continue;let K=X.extensions[P8],[G,z]=Y.get(K.bufferView)||[];if(!z||!G){let H=$.json.bufferViews[K.bufferView],V=$.json.buffers[H.buffer],q=V.uri?$.resources[V.uri]:$.resources[PD],F=H.byteOffset||0,U=H.byteLength,w=k6.toView(q,F,U);G=new this._decoderModule.Decoder,z=Uw1(G,w),Y.set(K.bufferView,[G,z]),J.debug(`[${P8}] Decompressed ${w.byteLength} bytes.`)}for(let H in K.attributes){let V=Z.jsonDoc.json.accessors[X.attributes[H]],q=G.GetAttributeByUniqueId(z,K.attributes[H]),F=ww1(G,z,q,V);Z.accessors[X.attributes[H]].setArray(F)}if(X.indices!==void 0)Z.accessors[X.indices].setArray(Lw1(G,z))}}finally{for(let[Q,W]of Array.from(Y.values()))this._decoderModule.destroy(Q),this._decoderModule.destroy(W)}return this}read(Z){return this}prewrite(Z,J){if(!this._encoderModule)throw new Error(`[${P8}] Please install extension dependency, "draco3d.encoder".`);let $=this.document.getLogger();$.debug(`[${P8}] Compression options: ${JSON.stringify(this._encoderOptions)}`);let Y=Nw1(this.document),Q=new Map,W="mesh";if(this._encoderOptions.quantizationVolume==="scene")if(this.document.getRoot().listScenes().length!==1)$.warn(`[${P8}]: quantizationVolume=scene requires exactly 1 scene.`);else W=En(this.document.getRoot().listScenes().pop());for(let X of Array.from(Y.keys())){let K=Y.get(X);if(!K)throw new Error("Unexpected primitive.");if(Q.has(K)){Q.set(K,Q.get(K));continue}let G=X.getIndices(),z=Z.jsonDoc.json.accessors,H;try{H=jw1(X,zZ({},this._encoderOptions,{quantizationVolume:W}))}catch(F){if(F instanceof r2){$.warn(`[${P8}]: ${F.message} Skipping primitive compression.`);continue}throw F}Q.set(K,H);let V=Z.createAccessorDef(G);if(V.count=H.numIndices,Z.accessorIndexMap.set(G,z.length),z.push(V),H.numVertices>65534&&M0.getComponentSize(V.componentType)<=2)V.componentType=M0.ComponentType.UNSIGNED_INT;else if(H.numVertices>254&&M0.getComponentSize(V.componentType)<=1)V.componentType=M0.ComponentType.UNSIGNED_SHORT;for(let F of X.listSemantics()){let U=X.getAttribute(F);if(H.attributeIDs[F]===void 0)continue;let w=Z.createAccessorDef(U);w.count=H.numVertices,Z.accessorIndexMap.set(U,z.length),z.push(w)}let q=X.getAttribute("POSITION").getBuffer()||this.document.getRoot().listBuffers()[0];if(!Z.otherBufferViews.has(q))Z.otherBufferViews.set(q,[]);Z.otherBufferViews.get(q).push(H.data)}return $.debug(`[${P8}] Compressed ${Y.size} primitives.`),Z.extensionData[P8]={primitiveHashMap:Y,primitiveEncodingMap:Q},this}write(Z){let J=Z.extensionData[P8];for(let $ of this.document.getRoot().listMeshes()){let Y=Z.jsonDoc.json.meshes[Z.meshIndexMap.get($)];for(let Q=0;Q<$.listPrimitives().length;Q++){let W=$.listPrimitives()[Q],X=Y.primitives[Q],K=J.primitiveHashMap.get(W);if(!K)continue;let G=J.primitiveEncodingMap.get(K);if(!G)continue;X.extensions=X.extensions||{},X.extensions[P8]={bufferView:Z.otherBufferViewsIndexMap.get(G.data),attributes:G.attributeIDs}}}if(!J.primitiveHashMap.size){let $=Z.jsonDoc.json;$.extensionsUsed=($.extensionsUsed||[]).filter((Y)=>Y!==P8),$.extensionsRequired=($.extensionsRequired||[]).filter((Y)=>Y!==P8)}return this}}iG.EXTENSION_NAME=P8;iG.EncoderMethod=lG;function Nw1(Z){let J=Z.getLogger(),$=new Set,Y=new Set,Q=0,W=0;for(let V of Z.getRoot().listMeshes())for(let q of V.listPrimitives())if(!q.getIndices())Y.add(q),Q++;else if(q.getMode()!==LJ.Mode.TRIANGLES)Y.add(q),W++;else $.add(q);if(Q>0)J.warn(`[${P8}] Skipping Draco compression of ${Q} non-indexed primitives.`);if(W>0)J.warn(`[${P8}] Skipping Draco compression of ${W} non-TRIANGLES primitives.`);let X=Z.getRoot().listAccessors(),K=new Map;for(let V=0;V<X.length;V++)K.set(X[V],V);let G=new Map,z=new Set,H=new Map;for(let V of Array.from($)){let q=cn(V,K);if(z.has(q)){H.set(V,q);continue}if(G.has(V.getIndices())){let F=V.getIndices(),U=F.clone();K.set(U,Z.getRoot().listAccessors().length-1),V.swap(F,U)}for(let F of V.listAttributes())if(G.has(F)){let U=F.clone();K.set(U,Z.getRoot().listAccessors().length-1),V.swap(F,U)}q=cn(V,K),z.add(q),H.set(V,q),G.set(V.getIndices(),q);for(let F of V.listAttributes())G.set(F,q)}for(let V of Array.from(G.keys())){let q=new Set(V.listParents().map((F)=>F.propertyType));if(q.size!==2||!q.has(s.PRIMITIVE)||!q.has(s.ROOT))throw new Error(`[${P8}] Compressed accessors must only be used as indices or vertex attributes.`)}for(let V of Array.from($)){let q=H.get(V),F=V.getIndices();if(G.get(F)!==q||V.listAttributes().some((U)=>G.get(U)!==q))throw new Error(`[${P8}] Draco primitives must share all, or no, accessors.`)}for(let V of Array.from(Y)){let q=V.getIndices();if(G.has(q)||V.listAttributes().some((F)=>G.has(F)))throw new Error(`[${P8}] Accessor cannot be shared by compressed and uncompressed primitives.`)}return H}function cn(Z,J){let $=[],Y=Z.getIndices();$.push(J.get(Y));for(let Q of Z.listAttributes())$.push(J.get(Q));return $.sort().join("|")}class $X extends i1{init(){this.extensionName=bD,this.propertyType="Light",this.parentTypes=[s.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{color:[1,1,1],intensity:1,type:$X.Type.POINT,range:null,innerConeAngle:0,outerConeAngle:Math.PI/4})}getColor(){return this.get("color")}setColor(Z){return this.set("color",Z)}getIntensity(){return this.get("intensity")}setIntensity(Z){return this.set("intensity",Z)}getType(){return this.get("type")}setType(Z){return this.set("type",Z)}getRange(){return this.get("range")}setRange(Z){return this.set("range",Z)}getInnerConeAngle(){return this.get("innerConeAngle")}setInnerConeAngle(Z){return this.set("innerConeAngle",Z)}getOuterConeAngle(){return this.get("outerConeAngle")}setOuterConeAngle(Z){return this.set("outerConeAngle",Z)}}$X.EXTENSION_NAME=bD;$X.Type={POINT:"point",SPOT:"spot",DIRECTIONAL:"directional"};var Q7=bD;class eD extends E1{constructor(...Z){super(...Z);this.extensionName=Q7}createLight(Z=""){return new $X(this.document.getGraph(),Z)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[Q7])return this;let Q=(J.json.extensions[Q7].lights||[]).map((W)=>{var X,K;let G=this.createLight().setName(W.name||"").setType(W.type);if(W.color!==void 0)G.setColor(W.color);if(W.intensity!==void 0)G.setIntensity(W.intensity);if(W.range!==void 0)G.setRange(W.range);if(((X=W.spot)==null?void 0:X.innerConeAngle)!==void 0)G.setInnerConeAngle(W.spot.innerConeAngle);if(((K=W.spot)==null?void 0:K.outerConeAngle)!==void 0)G.setOuterConeAngle(W.spot.outerConeAngle);return G});return J.json.nodes.forEach((W,X)=>{if(!W.extensions||!W.extensions[Q7])return;let K=W.extensions[Q7];Z.nodes[X].setExtension(Q7,Q[K.light])}),this}write(Z){let J=Z.jsonDoc;if(this.properties.size===0)return this;let $=[],Y=new Map;for(let Q of this.properties){let W=Q,X={type:W.getType()};if(!G8.eq(W.getColor(),[1,1,1]))X.color=W.getColor();if(W.getIntensity()!==1)X.intensity=W.getIntensity();if(W.getRange()!=null)X.range=W.getRange();if(W.getName())X.name=W.getName();if(W.getType()===$X.Type.SPOT)X.spot={innerConeAngle:W.getInnerConeAngle(),outerConeAngle:W.getOuterConeAngle()};$.push(X),Y.set(W,$.length-1)}return this.document.getRoot().listNodes().forEach((Q)=>{let W=Q.getExtension(Q7);if(W){let X=Z.nodeIndexMap.get(Q),K=J.json.nodes[X];K.extensions=K.extensions||{},K.extensions[Q7]={light:Y.get(W)}}}),J.json.extensions=J.json.extensions||{},J.json.extensions[Q7]={lights:$},this}}eD.EXTENSION_NAME=Q7;var{R:Pw1,G:Dw1,B:Cw1}=n5;class ZC extends i1{init(){this.extensionName=yD,this.propertyType="Anisotropy",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{anisotropyStrength:0,anisotropyRotation:0,anisotropyTexture:null,anisotropyTextureInfo:new D1(this.graph,"anisotropyTextureInfo")})}getAnisotropyStrength(){return this.get("anisotropyStrength")}setAnisotropyStrength(Z){return this.set("anisotropyStrength",Z)}getAnisotropyRotation(){return this.get("anisotropyRotation")}setAnisotropyRotation(Z){return this.set("anisotropyRotation",Z)}getAnisotropyTexture(){return this.getRef("anisotropyTexture")}getAnisotropyTextureInfo(){return this.getRef("anisotropyTexture")?this.getRef("anisotropyTextureInfo"):null}setAnisotropyTexture(Z){return this.setRef("anisotropyTexture",Z,{channels:Pw1|Dw1|Cw1})}}ZC.EXTENSION_NAME=yD;var zY=yD;class JC extends E1{constructor(...Z){super(...Z);this.extensionName=zY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createAnisotropy(){return new ZC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,$=J.json.materials||[],Y=J.json.textures||[];return $.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[zY]){let X=this.createAnisotropy();Z.materials[W].setExtension(zY,X);let K=Q.extensions[zY];if(K.anisotropyStrength!==void 0)X.setAnisotropyStrength(K.anisotropyStrength);if(K.anisotropyRotation!==void 0)X.setAnisotropyRotation(K.anisotropyRotation);if(K.anisotropyTexture!==void 0){let G=K.anisotropyTexture,z=Z.textures[Y[G.index].source];X.setAnisotropyTexture(z),Z.setTextureInfo(X.getAnisotropyTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach(($)=>{let Y=$.getExtension(zY);if(Y){let Q=Z.materialIndexMap.get($),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[zY]={};if(Y.getAnisotropyStrength()>0)X.anisotropyStrength=Y.getAnisotropyStrength();if(Y.getAnisotropyRotation()!==0)X.anisotropyRotation=Y.getAnisotropyRotation();if(Y.getAnisotropyTexture()){let K=Y.getAnisotropyTexture(),G=Y.getAnisotropyTextureInfo();X.anisotropyTexture=Z.createTextureInfoDef(K,G)}}}),this}}JC.EXTENSION_NAME=zY;var{R:ln,G:pn,B:Tw1}=n5;class $C extends i1{init(){this.extensionName=gD,this.propertyType="Clearcoat",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{clearcoatFactor:0,clearcoatTexture:null,clearcoatTextureInfo:new D1(this.graph,"clearcoatTextureInfo"),clearcoatRoughnessFactor:0,clearcoatRoughnessTexture:null,clearcoatRoughnessTextureInfo:new D1(this.graph,"clearcoatRoughnessTextureInfo"),clearcoatNormalScale:1,clearcoatNormalTexture:null,clearcoatNormalTextureInfo:new D1(this.graph,"clearcoatNormalTextureInfo")})}getClearcoatFactor(){return this.get("clearcoatFactor")}setClearcoatFactor(Z){return this.set("clearcoatFactor",Z)}getClearcoatTexture(){return this.getRef("clearcoatTexture")}getClearcoatTextureInfo(){return this.getRef("clearcoatTexture")?this.getRef("clearcoatTextureInfo"):null}setClearcoatTexture(Z){return this.setRef("clearcoatTexture",Z,{channels:ln})}getClearcoatRoughnessFactor(){return this.get("clearcoatRoughnessFactor")}setClearcoatRoughnessFactor(Z){return this.set("clearcoatRoughnessFactor",Z)}getClearcoatRoughnessTexture(){return this.getRef("clearcoatRoughnessTexture")}getClearcoatRoughnessTextureInfo(){return this.getRef("clearcoatRoughnessTexture")?this.getRef("clearcoatRoughnessTextureInfo"):null}setClearcoatRoughnessTexture(Z){return this.setRef("clearcoatRoughnessTexture",Z,{channels:pn})}getClearcoatNormalScale(){return this.get("clearcoatNormalScale")}setClearcoatNormalScale(Z){return this.set("clearcoatNormalScale",Z)}getClearcoatNormalTexture(){return this.getRef("clearcoatNormalTexture")}getClearcoatNormalTextureInfo(){return this.getRef("clearcoatNormalTexture")?this.getRef("clearcoatNormalTextureInfo"):null}setClearcoatNormalTexture(Z){return this.setRef("clearcoatNormalTexture",Z,{channels:ln|pn|Tw1})}}$C.EXTENSION_NAME=gD;var HY=gD;class YC extends E1{constructor(...Z){super(...Z);this.extensionName=HY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createClearcoat(){return new $C(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,$=J.json.materials||[],Y=J.json.textures||[];return $.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[HY]){let X=this.createClearcoat();Z.materials[W].setExtension(HY,X);let K=Q.extensions[HY];if(K.clearcoatFactor!==void 0)X.setClearcoatFactor(K.clearcoatFactor);if(K.clearcoatRoughnessFactor!==void 0)X.setClearcoatRoughnessFactor(K.clearcoatRoughnessFactor);if(K.clearcoatTexture!==void 0){let G=K.clearcoatTexture,z=Z.textures[Y[G.index].source];X.setClearcoatTexture(z),Z.setTextureInfo(X.getClearcoatTextureInfo(),G)}if(K.clearcoatRoughnessTexture!==void 0){let G=K.clearcoatRoughnessTexture,z=Z.textures[Y[G.index].source];X.setClearcoatRoughnessTexture(z),Z.setTextureInfo(X.getClearcoatRoughnessTextureInfo(),G)}if(K.clearcoatNormalTexture!==void 0){let G=K.clearcoatNormalTexture,z=Z.textures[Y[G.index].source];if(X.setClearcoatNormalTexture(z),Z.setTextureInfo(X.getClearcoatNormalTextureInfo(),G),G.scale!==void 0)X.setClearcoatNormalScale(G.scale)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach(($)=>{let Y=$.getExtension(HY);if(Y){let Q=Z.materialIndexMap.get($),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[HY]={clearcoatFactor:Y.getClearcoatFactor(),clearcoatRoughnessFactor:Y.getClearcoatRoughnessFactor()};if(Y.getClearcoatTexture()){let K=Y.getClearcoatTexture(),G=Y.getClearcoatTextureInfo();X.clearcoatTexture=Z.createTextureInfoDef(K,G)}if(Y.getClearcoatRoughnessTexture()){let K=Y.getClearcoatRoughnessTexture(),G=Y.getClearcoatRoughnessTextureInfo();X.clearcoatRoughnessTexture=Z.createTextureInfoDef(K,G)}if(Y.getClearcoatNormalTexture()){let K=Y.getClearcoatNormalTexture(),G=Y.getClearcoatNormalTextureInfo();if(X.clearcoatNormalTexture=Z.createTextureInfoDef(K,G),Y.getClearcoatNormalScale()!==1)X.clearcoatNormalTexture.scale=Y.getClearcoatNormalScale()}}}),this}}YC.EXTENSION_NAME=HY;var{R:kw1,G:Ew1,B:Iw1,A:vw1}=n5;class QC extends i1{init(){this.extensionName=mD,this.propertyType="DiffuseTransmission",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseTransmissionFactor:0,diffuseTransmissionTexture:null,diffuseTransmissionTextureInfo:new D1(this.graph,"diffuseTransmissionTextureInfo"),diffuseTransmissionColorFactor:[1,1,1],diffuseTransmissionColorTexture:null,diffuseTransmissionColorTextureInfo:new D1(this.graph,"diffuseTransmissionColorTextureInfo")})}getDiffuseTransmissionFactor(){return this.get("diffuseTransmissionFactor")}setDiffuseTransmissionFactor(Z){return this.set("diffuseTransmissionFactor",Z)}getDiffuseTransmissionTexture(){return this.getRef("diffuseTransmissionTexture")}getDiffuseTransmissionTextureInfo(){return this.getRef("diffuseTransmissionTexture")?this.getRef("diffuseTransmissionTextureInfo"):null}setDiffuseTransmissionTexture(Z){return this.setRef("diffuseTransmissionTexture",Z,{channels:vw1})}getDiffuseTransmissionColorFactor(){return this.get("diffuseTransmissionColorFactor")}setDiffuseTransmissionColorFactor(Z){return this.set("diffuseTransmissionColorFactor",Z)}getDiffuseTransmissionColorTexture(){return this.getRef("diffuseTransmissionColorTexture")}getDiffuseTransmissionColorTextureInfo(){return this.getRef("diffuseTransmissionColorTexture")?this.getRef("diffuseTransmissionColorTextureInfo"):null}setDiffuseTransmissionColorTexture(Z){return this.setRef("diffuseTransmissionColorTexture",Z,{channels:kw1|Ew1|Iw1})}}QC.EXTENSION_NAME=mD;var VY=mD;class WC extends E1{constructor(...Z){super(...Z);this.extensionName=VY}createDiffuseTransmission(){return new QC(this.document.getGraph())}read(Z){let J=Z.jsonDoc,$=J.json.materials||[],Y=J.json.textures||[];return $.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[VY]){let X=this.createDiffuseTransmission();Z.materials[W].setExtension(VY,X);let K=Q.extensions[VY];if(K.diffuseTransmissionFactor!==void 0)X.setDiffuseTransmissionFactor(K.diffuseTransmissionFactor);if(K.diffuseTransmissionColorFactor!==void 0)X.setDiffuseTransmissionColorFactor(K.diffuseTransmissionColorFactor);if(K.diffuseTransmissionTexture!==void 0){let G=K.diffuseTransmissionTexture,z=Z.textures[Y[G.index].source];X.setDiffuseTransmissionTexture(z),Z.setTextureInfo(X.getDiffuseTransmissionTextureInfo(),G)}if(K.diffuseTransmissionColorTexture!==void 0){let G=K.diffuseTransmissionColorTexture,z=Z.textures[Y[G.index].source];X.setDiffuseTransmissionColorTexture(z),Z.setTextureInfo(X.getDiffuseTransmissionColorTextureInfo(),G)}}}),this}write(Z){let J=Z.jsonDoc;for(let $ of this.document.getRoot().listMaterials()){let Y=$.getExtension(VY);if(!Y)continue;let Q=Z.materialIndexMap.get($),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[VY]={diffuseTransmissionFactor:Y.getDiffuseTransmissionFactor(),diffuseTransmissionColorFactor:Y.getDiffuseTransmissionColorFactor()};if(Y.getDiffuseTransmissionTexture()){let K=Y.getDiffuseTransmissionTexture(),G=Y.getDiffuseTransmissionTextureInfo();X.diffuseTransmissionTexture=Z.createTextureInfoDef(K,G)}if(Y.getDiffuseTransmissionColorTexture()){let K=Y.getDiffuseTransmissionColorTexture(),G=Y.getDiffuseTransmissionColorTextureInfo();X.diffuseTransmissionColorTexture=Z.createTextureInfoDef(K,G)}}return this}}WC.EXTENSION_NAME=VY;class XC extends i1{init(){this.extensionName=uD,this.propertyType="Dispersion",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{dispersion:0})}getDispersion(){return this.get("dispersion")}setDispersion(Z){return this.set("dispersion",Z)}}XC.EXTENSION_NAME=uD;var qY=uD;class KC extends E1{constructor(...Z){super(...Z);this.extensionName=qY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createDispersion(){return new XC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){return(Z.jsonDoc.json.materials||[]).forEach((Y,Q)=>{if(Y.extensions&&Y.extensions[qY]){let W=this.createDispersion();Z.materials[Q].setExtension(qY,W);let X=Y.extensions[qY];if(X.dispersion!==void 0)W.setDispersion(X.dispersion)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach(($)=>{let Y=$.getExtension(qY);if(Y){let Q=Z.materialIndexMap.get($),W=J.json.materials[Q];W.extensions=W.extensions||{},W.extensions[qY]={dispersion:Y.getDispersion()}}}),this}}KC.EXTENSION_NAME=qY;class GC extends i1{init(){this.extensionName=dD,this.propertyType="EmissiveStrength",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{emissiveStrength:1})}getEmissiveStrength(){return this.get("emissiveStrength")}setEmissiveStrength(Z){return this.set("emissiveStrength",Z)}}GC.EXTENSION_NAME=dD;var FY=dD;class zC extends E1{constructor(...Z){super(...Z);this.extensionName=FY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createEmissiveStrength(){return new GC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){return(Z.jsonDoc.json.materials||[]).forEach((Y,Q)=>{if(Y.extensions&&Y.extensions[FY]){let W=this.createEmissiveStrength();Z.materials[Q].setExtension(FY,W);let X=Y.extensions[FY];if(X.emissiveStrength!==void 0)W.setEmissiveStrength(X.emissiveStrength)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach(($)=>{let Y=$.getExtension(FY);if(Y){let Q=Z.materialIndexMap.get($),W=J.json.materials[Q];W.extensions=W.extensions||{},W.extensions[FY]={emissiveStrength:Y.getEmissiveStrength()}}}),this}}zC.EXTENSION_NAME=FY;class HC extends i1{init(){this.extensionName=cD,this.propertyType="IOR",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{ior:1.5})}getIOR(){return this.get("ior")}setIOR(Z){return this.set("ior",Z)}}HC.EXTENSION_NAME=cD;var UY=cD;class $L extends E1{constructor(...Z){super(...Z);this.extensionName=UY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createIOR(){return new HC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){return(Z.jsonDoc.json.materials||[]).forEach((Y,Q)=>{if(Y.extensions&&Y.extensions[UY]){let W=this.createIOR();Z.materials[Q].setExtension(UY,W);let X=Y.extensions[UY];if(X.ior!==void 0)W.setIOR(X.ior)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach(($)=>{let Y=$.getExtension(UY);if(Y){let Q=Z.materialIndexMap.get($),W=J.json.materials[Q];W.extensions=W.extensions||{},W.extensions[UY]={ior:Y.getIOR()}}}),this}}$L.EXTENSION_NAME=UY;var{R:Sw1,G:_w1}=n5;class VC extends i1{init(){this.extensionName=lD,this.propertyType="Iridescence",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{iridescenceFactor:0,iridescenceTexture:null,iridescenceTextureInfo:new D1(this.graph,"iridescenceTextureInfo"),iridescenceIOR:1.3,iridescenceThicknessMinimum:100,iridescenceThicknessMaximum:400,iridescenceThicknessTexture:null,iridescenceThicknessTextureInfo:new D1(this.graph,"iridescenceThicknessTextureInfo")})}getIridescenceFactor(){return this.get("iridescenceFactor")}setIridescenceFactor(Z){return this.set("iridescenceFactor",Z)}getIridescenceTexture(){return this.getRef("iridescenceTexture")}getIridescenceTextureInfo(){return this.getRef("iridescenceTexture")?this.getRef("iridescenceTextureInfo"):null}setIridescenceTexture(Z){return this.setRef("iridescenceTexture",Z,{channels:Sw1})}getIridescenceIOR(){return this.get("iridescenceIOR")}setIridescenceIOR(Z){return this.set("iridescenceIOR",Z)}getIridescenceThicknessMinimum(){return this.get("iridescenceThicknessMinimum")}setIridescenceThicknessMinimum(Z){return this.set("iridescenceThicknessMinimum",Z)}getIridescenceThicknessMaximum(){return this.get("iridescenceThicknessMaximum")}setIridescenceThicknessMaximum(Z){return this.set("iridescenceThicknessMaximum",Z)}getIridescenceThicknessTexture(){return this.getRef("iridescenceThicknessTexture")}getIridescenceThicknessTextureInfo(){return this.getRef("iridescenceThicknessTexture")?this.getRef("iridescenceThicknessTextureInfo"):null}setIridescenceThicknessTexture(Z){return this.setRef("iridescenceThicknessTexture",Z,{channels:_w1})}}VC.EXTENSION_NAME=lD;var LY=lD;class qC extends E1{constructor(...Z){super(...Z);this.extensionName=LY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createIridescence(){return new VC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,$=J.json.materials||[],Y=J.json.textures||[];return $.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[LY]){let X=this.createIridescence();Z.materials[W].setExtension(LY,X);let K=Q.extensions[LY];if(K.iridescenceFactor!==void 0)X.setIridescenceFactor(K.iridescenceFactor);if(K.iridescenceIor!==void 0)X.setIridescenceIOR(K.iridescenceIor);if(K.iridescenceThicknessMinimum!==void 0)X.setIridescenceThicknessMinimum(K.iridescenceThicknessMinimum);if(K.iridescenceThicknessMaximum!==void 0)X.setIridescenceThicknessMaximum(K.iridescenceThicknessMaximum);if(K.iridescenceTexture!==void 0){let G=K.iridescenceTexture,z=Z.textures[Y[G.index].source];X.setIridescenceTexture(z),Z.setTextureInfo(X.getIridescenceTextureInfo(),G)}if(K.iridescenceThicknessTexture!==void 0){let G=K.iridescenceThicknessTexture,z=Z.textures[Y[G.index].source];X.setIridescenceThicknessTexture(z),Z.setTextureInfo(X.getIridescenceThicknessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach(($)=>{let Y=$.getExtension(LY);if(Y){let Q=Z.materialIndexMap.get($),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[LY]={};if(Y.getIridescenceFactor()>0)X.iridescenceFactor=Y.getIridescenceFactor();if(Y.getIridescenceIOR()!==1.3)X.iridescenceIor=Y.getIridescenceIOR();if(Y.getIridescenceThicknessMinimum()!==100)X.iridescenceThicknessMinimum=Y.getIridescenceThicknessMinimum();if(Y.getIridescenceThicknessMaximum()!==400)X.iridescenceThicknessMaximum=Y.getIridescenceThicknessMaximum();if(Y.getIridescenceTexture()){let K=Y.getIridescenceTexture(),G=Y.getIridescenceTextureInfo();X.iridescenceTexture=Z.createTextureInfoDef(K,G)}if(Y.getIridescenceThicknessTexture()){let K=Y.getIridescenceThicknessTexture(),G=Y.getIridescenceThicknessTextureInfo();X.iridescenceThicknessTexture=Z.createTextureInfoDef(K,G)}}}),this}}qC.EXTENSION_NAME=LY;var{R:nn,G:an,B:sn,A:on}=n5;class FC extends i1{init(){this.extensionName=pD,this.propertyType="PBRSpecularGlossiness",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseFactor:[1,1,1,1],diffuseTexture:null,diffuseTextureInfo:new D1(this.graph,"diffuseTextureInfo"),specularFactor:[1,1,1],glossinessFactor:1,specularGlossinessTexture:null,specularGlossinessTextureInfo:new D1(this.graph,"specularGlossinessTextureInfo")})}getDiffuseFactor(){return this.get("diffuseFactor")}setDiffuseFactor(Z){return this.set("diffuseFactor",Z)}getDiffuseTexture(){return this.getRef("diffuseTexture")}getDiffuseTextureInfo(){return this.getRef("diffuseTexture")?this.getRef("diffuseTextureInfo"):null}setDiffuseTexture(Z){return this.setRef("diffuseTexture",Z,{channels:nn|an|sn|on,isColor:!0})}getSpecularFactor(){return this.get("specularFactor")}setSpecularFactor(Z){return this.set("specularFactor",Z)}getGlossinessFactor(){return this.get("glossinessFactor")}setGlossinessFactor(Z){return this.set("glossinessFactor",Z)}getSpecularGlossinessTexture(){return this.getRef("specularGlossinessTexture")}getSpecularGlossinessTextureInfo(){return this.getRef("specularGlossinessTexture")?this.getRef("specularGlossinessTextureInfo"):null}setSpecularGlossinessTexture(Z){return this.setRef("specularGlossinessTexture",Z,{channels:nn|an|sn|on})}}FC.EXTENSION_NAME=pD;var wY=pD;class YL extends E1{constructor(...Z){super(...Z);this.extensionName=wY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createPBRSpecularGlossiness(){return new FC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,$=J.json.materials||[],Y=J.json.textures||[];return $.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[wY]){let X=this.createPBRSpecularGlossiness();Z.materials[W].setExtension(wY,X);let K=Q.extensions[wY];if(K.diffuseFactor!==void 0)X.setDiffuseFactor(K.diffuseFactor);if(K.specularFactor!==void 0)X.setSpecularFactor(K.specularFactor);if(K.glossinessFactor!==void 0)X.setGlossinessFactor(K.glossinessFactor);if(K.diffuseTexture!==void 0){let G=K.diffuseTexture,z=Z.textures[Y[G.index].source];X.setDiffuseTexture(z),Z.setTextureInfo(X.getDiffuseTextureInfo(),G)}if(K.specularGlossinessTexture!==void 0){let G=K.specularGlossinessTexture,z=Z.textures[Y[G.index].source];X.setSpecularGlossinessTexture(z),Z.setTextureInfo(X.getSpecularGlossinessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach(($)=>{let Y=$.getExtension(wY);if(Y){let Q=Z.materialIndexMap.get($),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[wY]={diffuseFactor:Y.getDiffuseFactor(),specularFactor:Y.getSpecularFactor(),glossinessFactor:Y.getGlossinessFactor()};if(Y.getDiffuseTexture()){let K=Y.getDiffuseTexture(),G=Y.getDiffuseTextureInfo();X.diffuseTexture=Z.createTextureInfoDef(K,G)}if(Y.getSpecularGlossinessTexture()){let K=Y.getSpecularGlossinessTexture(),G=Y.getSpecularGlossinessTextureInfo();X.specularGlossinessTexture=Z.createTextureInfoDef(K,G)}}}),this}}YL.EXTENSION_NAME=wY;var{R:Aw1,G:xw1,B:hw1,A:fw1}=n5;class UC extends i1{init(){this.extensionName=iD,this.propertyType="Sheen",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{sheenColorFactor:[0,0,0],sheenColorTexture:null,sheenColorTextureInfo:new D1(this.graph,"sheenColorTextureInfo"),sheenRoughnessFactor:0,sheenRoughnessTexture:null,sheenRoughnessTextureInfo:new D1(this.graph,"sheenRoughnessTextureInfo")})}getSheenColorFactor(){return this.get("sheenColorFactor")}setSheenColorFactor(Z){return this.set("sheenColorFactor",Z)}getSheenColorTexture(){return this.getRef("sheenColorTexture")}getSheenColorTextureInfo(){return this.getRef("sheenColorTexture")?this.getRef("sheenColorTextureInfo"):null}setSheenColorTexture(Z){return this.setRef("sheenColorTexture",Z,{channels:Aw1|xw1|hw1,isColor:!0})}getSheenRoughnessFactor(){return this.get("sheenRoughnessFactor")}setSheenRoughnessFactor(Z){return this.set("sheenRoughnessFactor",Z)}getSheenRoughnessTexture(){return this.getRef("sheenRoughnessTexture")}getSheenRoughnessTextureInfo(){return this.getRef("sheenRoughnessTexture")?this.getRef("sheenRoughnessTextureInfo"):null}setSheenRoughnessTexture(Z){return this.setRef("sheenRoughnessTexture",Z,{channels:fw1})}}UC.EXTENSION_NAME=iD;var BY=iD;class LC extends E1{constructor(...Z){super(...Z);this.extensionName=BY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createSheen(){return new UC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,$=J.json.materials||[],Y=J.json.textures||[];return $.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[BY]){let X=this.createSheen();Z.materials[W].setExtension(BY,X);let K=Q.extensions[BY];if(K.sheenColorFactor!==void 0)X.setSheenColorFactor(K.sheenColorFactor);if(K.sheenRoughnessFactor!==void 0)X.setSheenRoughnessFactor(K.sheenRoughnessFactor);if(K.sheenColorTexture!==void 0){let G=K.sheenColorTexture,z=Z.textures[Y[G.index].source];X.setSheenColorTexture(z),Z.setTextureInfo(X.getSheenColorTextureInfo(),G)}if(K.sheenRoughnessTexture!==void 0){let G=K.sheenRoughnessTexture,z=Z.textures[Y[G.index].source];X.setSheenRoughnessTexture(z),Z.setTextureInfo(X.getSheenRoughnessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach(($)=>{let Y=$.getExtension(BY);if(Y){let Q=Z.materialIndexMap.get($),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[BY]={sheenColorFactor:Y.getSheenColorFactor(),sheenRoughnessFactor:Y.getSheenRoughnessFactor()};if(Y.getSheenColorTexture()){let K=Y.getSheenColorTexture(),G=Y.getSheenColorTextureInfo();X.sheenColorTexture=Z.createTextureInfoDef(K,G)}if(Y.getSheenRoughnessTexture()){let K=Y.getSheenRoughnessTexture(),G=Y.getSheenRoughnessTextureInfo();X.sheenRoughnessTexture=Z.createTextureInfoDef(K,G)}}}),this}}LC.EXTENSION_NAME=BY;var{R:bw1,G:yw1,B:gw1,A:mw1}=n5;class wC extends i1{init(){this.extensionName=nD,this.propertyType="Specular",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{specularFactor:1,specularTexture:null,specularTextureInfo:new D1(this.graph,"specularTextureInfo"),specularColorFactor:[1,1,1],specularColorTexture:null,specularColorTextureInfo:new D1(this.graph,"specularColorTextureInfo")})}getSpecularFactor(){return this.get("specularFactor")}setSpecularFactor(Z){return this.set("specularFactor",Z)}getSpecularColorFactor(){return this.get("specularColorFactor")}setSpecularColorFactor(Z){return this.set("specularColorFactor",Z)}getSpecularTexture(){return this.getRef("specularTexture")}getSpecularTextureInfo(){return this.getRef("specularTexture")?this.getRef("specularTextureInfo"):null}setSpecularTexture(Z){return this.setRef("specularTexture",Z,{channels:mw1})}getSpecularColorTexture(){return this.getRef("specularColorTexture")}getSpecularColorTextureInfo(){return this.getRef("specularColorTexture")?this.getRef("specularColorTextureInfo"):null}setSpecularColorTexture(Z){return this.setRef("specularColorTexture",Z,{channels:bw1|yw1|gw1,isColor:!0})}}wC.EXTENSION_NAME=nD;var OY=nD;class QL extends E1{constructor(...Z){super(...Z);this.extensionName=OY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createSpecular(){return new wC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,$=J.json.materials||[],Y=J.json.textures||[];return $.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[OY]){let X=this.createSpecular();Z.materials[W].setExtension(OY,X);let K=Q.extensions[OY];if(K.specularFactor!==void 0)X.setSpecularFactor(K.specularFactor);if(K.specularColorFactor!==void 0)X.setSpecularColorFactor(K.specularColorFactor);if(K.specularTexture!==void 0){let G=K.specularTexture,z=Z.textures[Y[G.index].source];X.setSpecularTexture(z),Z.setTextureInfo(X.getSpecularTextureInfo(),G)}if(K.specularColorTexture!==void 0){let G=K.specularColorTexture,z=Z.textures[Y[G.index].source];X.setSpecularColorTexture(z),Z.setTextureInfo(X.getSpecularColorTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach(($)=>{let Y=$.getExtension(OY);if(Y){let Q=Z.materialIndexMap.get($),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[OY]={};if(Y.getSpecularFactor()!==1)X.specularFactor=Y.getSpecularFactor();if(!G8.eq(Y.getSpecularColorFactor(),[1,1,1]))X.specularColorFactor=Y.getSpecularColorFactor();if(Y.getSpecularTexture()){let K=Y.getSpecularTexture(),G=Y.getSpecularTextureInfo();X.specularTexture=Z.createTextureInfoDef(K,G)}if(Y.getSpecularColorTexture()){let K=Y.getSpecularColorTexture(),G=Y.getSpecularColorTextureInfo();X.specularColorTexture=Z.createTextureInfoDef(K,G)}}}),this}}QL.EXTENSION_NAME=OY;var{R:uw1}=n5;class BC extends i1{init(){this.extensionName=aD,this.propertyType="Transmission",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{transmissionFactor:0,transmissionTexture:null,transmissionTextureInfo:new D1(this.graph,"transmissionTextureInfo")})}getTransmissionFactor(){return this.get("transmissionFactor")}setTransmissionFactor(Z){return this.set("transmissionFactor",Z)}getTransmissionTexture(){return this.getRef("transmissionTexture")}getTransmissionTextureInfo(){return this.getRef("transmissionTexture")?this.getRef("transmissionTextureInfo"):null}setTransmissionTexture(Z){return this.setRef("transmissionTexture",Z,{channels:uw1})}}BC.EXTENSION_NAME=aD;var jY=aD;class OC extends E1{constructor(...Z){super(...Z);this.extensionName=jY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createTransmission(){return new BC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,$=J.json.materials||[],Y=J.json.textures||[];return $.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[jY]){let X=this.createTransmission();Z.materials[W].setExtension(jY,X);let K=Q.extensions[jY];if(K.transmissionFactor!==void 0)X.setTransmissionFactor(K.transmissionFactor);if(K.transmissionTexture!==void 0){let G=K.transmissionTexture,z=Z.textures[Y[G.index].source];X.setTransmissionTexture(z),Z.setTextureInfo(X.getTransmissionTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach(($)=>{let Y=$.getExtension(jY);if(Y){let Q=Z.materialIndexMap.get($),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[jY]={transmissionFactor:Y.getTransmissionFactor()};if(Y.getTransmissionTexture()){let K=Y.getTransmissionTexture(),G=Y.getTransmissionTextureInfo();X.transmissionTexture=Z.createTextureInfoDef(K,G)}}}),this}}OC.EXTENSION_NAME=jY;class jC extends i1{init(){this.extensionName=sD,this.propertyType="Unlit",this.parentTypes=[s.MATERIAL]}}jC.EXTENSION_NAME=sD;var ZX=sD;class WL extends E1{constructor(...Z){super(...Z);this.extensionName=ZX,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createUnlit(){return new jC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){return(Z.jsonDoc.json.materials||[]).forEach(($,Y)=>{if($.extensions&&$.extensions[ZX])Z.materials[Y].setExtension(ZX,this.createUnlit())}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach(($)=>{if($.getExtension(ZX)){let Y=Z.materialIndexMap.get($),Q=J.json.materials[Y];Q.extensions=Q.extensions||{},Q.extensions[ZX]={}}}),this}}WL.EXTENSION_NAME=ZX;class MC extends i1{init(){this.extensionName=NY,this.propertyType="Mapping",this.parentTypes=["MappingList"]}getDefaults(){return Object.assign(super.getDefaults(),{material:null,variants:new N0})}getMaterial(){return this.getRef("material")}setMaterial(Z){return this.setRef("material",Z)}addVariant(Z){return this.addRef("variants",Z)}removeVariant(Z){return this.removeRef("variants",Z)}listVariants(){return this.listRefs("variants")}}MC.EXTENSION_NAME=NY;class RC extends i1{init(){this.extensionName=NY,this.propertyType="MappingList",this.parentTypes=[s.PRIMITIVE]}getDefaults(){return Object.assign(super.getDefaults(),{mappings:new N0})}addMapping(Z){return this.addRef("mappings",Z)}removeMapping(Z){return this.removeRef("mappings",Z)}listMappings(){return this.listRefs("mappings")}}RC.EXTENSION_NAME=NY;class t2 extends i1{init(){this.extensionName=NY,this.propertyType="Variant",this.parentTypes=["MappingList"]}}t2.EXTENSION_NAME=NY;var W7=NY;class NC extends E1{constructor(...Z){super(...Z);this.extensionName=W7}createMappingList(){return new RC(this.document.getGraph())}createVariant(Z=""){return new t2(this.document.getGraph(),Z)}createMapping(){return new MC(this.document.getGraph())}listVariants(){return Array.from(this.properties).filter((Z)=>Z instanceof t2)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[W7])return this;let Q=(J.json.extensions[W7].variants||[]).map((X)=>this.createVariant().setName(X.name||""));return(J.json.meshes||[]).forEach((X,K)=>{let G=Z.meshes[K];(X.primitives||[]).forEach((H,V)=>{if(!H.extensions||!H.extensions[W7])return;let q=this.createMappingList(),F=H.extensions[W7];for(let U of F.mappings){let w=this.createMapping();if(U.material!==void 0)w.setMaterial(Z.materials[U.material]);for(let L of U.variants||[])w.addVariant(Q[L]);q.addMapping(w)}G.listPrimitives()[V].setExtension(W7,q)})}),this}write(Z){let J=Z.jsonDoc,$=this.listVariants();if(!$.length)return this;let Y=[],Q=new Map;for(let W of $)Q.set(W,Y.length),Y.push(Z.createPropertyDef(W));for(let W of this.document.getRoot().listMeshes()){let X=Z.meshIndexMap.get(W);W.listPrimitives().forEach((K,G)=>{let z=K.getExtension(W7);if(!z)return;let H=Z.jsonDoc.json.meshes[X].primitives[G],V=z.listMappings().map((q)=>{let F=Z.createPropertyDef(q),U=q.getMaterial();if(U)F.material=Z.materialIndexMap.get(U);return F.variants=q.listVariants().map((w)=>Q.get(w)),F});H.extensions=H.extensions||{},H.extensions[W7]={mappings:V}})}return J.json.extensions=J.json.extensions||{},J.json.extensions[W7]={variants:Y},this}}NC.EXTENSION_NAME=W7;var{G:dw1}=n5;class PC extends i1{init(){this.extensionName=oD,this.propertyType="Volume",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{thicknessFactor:0,thicknessTexture:null,thicknessTextureInfo:new D1(this.graph,"thicknessTexture"),attenuationDistance:1/0,attenuationColor:[1,1,1]})}getThicknessFactor(){return this.get("thicknessFactor")}setThicknessFactor(Z){return this.set("thicknessFactor",Z)}getThicknessTexture(){return this.getRef("thicknessTexture")}getThicknessTextureInfo(){return this.getRef("thicknessTexture")?this.getRef("thicknessTextureInfo"):null}setThicknessTexture(Z){return this.setRef("thicknessTexture",Z,{channels:dw1})}getAttenuationDistance(){return this.get("attenuationDistance")}setAttenuationDistance(Z){return this.set("attenuationDistance",Z)}getAttenuationColor(){return this.get("attenuationColor")}setAttenuationColor(Z){return this.set("attenuationColor",Z)}}PC.EXTENSION_NAME=oD;var MY=oD;class DC extends E1{constructor(...Z){super(...Z);this.extensionName=MY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createVolume(){return new PC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,$=J.json.materials||[],Y=J.json.textures||[];return $.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[MY]){let X=this.createVolume();Z.materials[W].setExtension(MY,X);let K=Q.extensions[MY];if(K.thicknessFactor!==void 0)X.setThicknessFactor(K.thicknessFactor);if(K.attenuationDistance!==void 0)X.setAttenuationDistance(K.attenuationDistance);if(K.attenuationColor!==void 0)X.setAttenuationColor(K.attenuationColor);if(K.thicknessTexture!==void 0){let G=K.thicknessTexture,z=Z.textures[Y[G.index].source];X.setThicknessTexture(z),Z.setTextureInfo(X.getThicknessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach(($)=>{let Y=$.getExtension(MY);if(Y){let Q=Z.materialIndexMap.get($),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[MY]={};if(Y.getThicknessFactor()>0)X.thicknessFactor=Y.getThicknessFactor();if(Number.isFinite(Y.getAttenuationDistance()))X.attenuationDistance=Y.getAttenuationDistance();if(!G8.eq(Y.getAttenuationColor(),[1,1,1]))X.attenuationColor=Y.getAttenuationColor();if(Y.getThicknessTexture()){let K=Y.getThicknessTexture(),G=Y.getThicknessTextureInfo();X.thicknessTexture=Z.createTextureInfoDef(K,G)}}}),this}}DC.EXTENSION_NAME=MY;var Qa=Yw1;class nG extends E1{constructor(...Z){super(...Z);this.extensionName=Qa}read(Z){return this}write(Z){return this}}nG.EXTENSION_NAME=Qa;var dG=Qw1;class Wa{match(Z){return Z[0]===171&&Z[1]===75&&Z[2]===84&&Z[3]===88&&Z[4]===32&&Z[5]===50&&Z[6]===48&&Z[7]===187&&Z[8]===13&&Z[9]===10&&Z[10]===26&&Z[11]===10}getSize(Z){let J=s2(Z);return[J.pixelWidth,J.pixelHeight]}getChannels(Z){let $=s2(Z).dataFormatDescriptor[0];if($.colorModel===hn)return $.samples.length===2&&($.samples[1].channelType&15)===15?4:3;else if($.colorModel===fn)return($.samples[0].channelType&15)===3?4:3;throw new Error(`Unexpected KTX2 colorModel, "${$.colorModel}".`)}getVRAMByteLength(Z){let J=s2(Z),$=this.getChannels(Z)>3,Y=0;for(let Q=0;Q<J.levels.length;Q++){let W=J.levels[Q];if(W.uncompressedByteLength)Y+=W.uncompressedByteLength;else{let X=Math.max(1,Math.floor(J.pixelWidth/Math.pow(2,Q))),K=Math.max(1,Math.floor(J.pixelHeight/Math.pow(2,Q))),G=$?16:8;Y+=X/4*(K/4)*G}}return Y}}class CC extends E1{constructor(...Z){super(...Z);this.extensionName=dG,this.prereadTypes=[s.TEXTURE]}static register(){L4.registerFormat("image/ktx2",new Wa)}preread(Z){return Z.jsonDoc.json.textures.forEach((J)=>{if(J.extensions&&J.extensions[dG]){let $=J.extensions[dG];J.source=$.source}}),this}read(Z){return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listTextures().forEach(($)=>{if($.getMimeType()==="image/ktx2"){let Y=Z.imageIndexMap.get($);J.json.textures.forEach((Q)=>{if(Q.source===Y)Q.extensions=Q.extensions||{},Q.extensions[dG]={source:Q.source},delete Q.source})}}),this}}CC.EXTENSION_NAME=dG;class TC extends i1{init(){this.extensionName=rD,this.propertyType="Transform",this.parentTypes=[s.TEXTURE_INFO]}getDefaults(){return Object.assign(super.getDefaults(),{offset:[0,0],rotation:0,scale:[1,1],texCoord:null})}getOffset(){return this.get("offset")}setOffset(Z){return this.set("offset",Z)}getRotation(){return this.get("rotation")}setRotation(Z){return this.set("rotation",Z)}getScale(){return this.get("scale")}setScale(Z){return this.set("scale",Z)}getTexCoord(){return this.get("texCoord")}setTexCoord(Z){return this.set("texCoord",Z)}}TC.EXTENSION_NAME=rD;var RY=rD;class kC extends E1{constructor(...Z){super(...Z);this.extensionName=RY}createTransform(){return new TC(this.document.getGraph())}read(Z){for(let[J,$]of Array.from(Z.textureInfos.entries())){if(!$.extensions||!$.extensions[RY])continue;let Y=this.createTransform(),Q=$.extensions[RY];if(Q.offset!==void 0)Y.setOffset(Q.offset);if(Q.rotation!==void 0)Y.setRotation(Q.rotation);if(Q.scale!==void 0)Y.setScale(Q.scale);if(Q.texCoord!==void 0)Y.setTexCoord(Q.texCoord);J.setExtension(RY,Y)}return this}write(Z){let J=Array.from(Z.textureInfoDefMap.entries());for(let[$,Y]of J){let Q=$.getExtension(RY);if(!Q)continue;Y.extensions=Y.extensions||{};let W={},X=G8.eq;if(!X(Q.getOffset(),[0,0]))W.offset=Q.getOffset();if(Q.getRotation()!==0)W.rotation=Q.getRotation();if(!X(Q.getScale(),[1,1]))W.scale=Q.getScale();if(Q.getTexCoord()!=null)W.texCoord=Q.getTexCoord();Y.extensions[RY]=W}return this}}kC.EXTENSION_NAME=RY;var cw1=[s.ROOT,s.SCENE,s.NODE,s.MESH,s.MATERIAL,s.TEXTURE,s.ANIMATION];class EC extends i1{init(){this.extensionName=o2,this.propertyType="Packet",this.parentTypes=cw1}getDefaults(){return Object.assign(super.getDefaults(),{context:{},properties:{}})}getContext(){return this.get("context")}setContext(Z){return this.set("context",zZ({},Z))}listProperties(){return Object.keys(this.get("properties"))}getProperty(Z){let J=this.get("properties");return Z in J?J[Z]:null}setProperty(Z,J){this._assertContext(Z);let $=zZ({},this.get("properties"));if(J)$[Z]=J;else delete $[Z];return this.set("properties",$)}toJSONLD(){let Z=_D(this.get("context")),J=_D(this.get("properties"));return zZ({"@context":Z},J)}fromJSONLD(Z){Z=_D(Z);let J=Z["@context"];if(J)this.set("context",J);return delete Z["@context"],this.set("properties",Z)}_assertContext(Z){if(!(Z.split(":")[0]in this.get("context")))throw new Error(`${o2}: Missing context for term, "${Z}".`)}}EC.EXTENSION_NAME=o2;function _D(Z){return JSON.parse(JSON.stringify(Z))}var GZ=o2;class IC extends E1{constructor(...Z){super(...Z);this.extensionName=GZ}createPacket(){return new EC(this.document.getGraph())}listPackets(){return Array.from(this.properties)}read(Z){var J;let $=(J=Z.jsonDoc.json.extensions)==null?void 0:J[GZ];if(!$||!$.packets)return this;let Y=Z.jsonDoc.json,Q=this.document.getRoot(),W=$.packets.map((G)=>this.createPacket().fromJSONLD(G)),X=[[Y.asset],Y.scenes,Y.nodes,Y.meshes,Y.materials,Y.images,Y.animations],K=[[Q],Q.listScenes(),Q.listNodes(),Q.listMeshes(),Q.listMaterials(),Q.listTextures(),Q.listAnimations()];for(let G=0;G<X.length;G++){let z=X[G]||[];for(let H=0;H<z.length;H++){let V=z[H];if(V.extensions&&V.extensions[GZ]){let q=V.extensions[GZ];K[G][H].setExtension(GZ,W[q.packet])}}}return this}write(Z){let{json:J}=Z.jsonDoc,$=[];for(let Y of this.properties){$.push(Y.toJSONLD());for(let Q of Y.listParents()){let W;switch(Q.propertyType){case s.ROOT:W=J.asset;break;case s.SCENE:W=J.scenes[Z.sceneIndexMap.get(Q)];break;case s.NODE:W=J.nodes[Z.nodeIndexMap.get(Q)];break;case s.MESH:W=J.meshes[Z.meshIndexMap.get(Q)];break;case s.MATERIAL:W=J.materials[Z.materialIndexMap.get(Q)];break;case s.TEXTURE:W=J.images[Z.imageIndexMap.get(Q)];break;case s.ANIMATION:W=J.animations[Z.animationIndexMap.get(Q)];break;default:W=null,this.document.getLogger().warn(`[${GZ}]: Unsupported parent property, "${Q.propertyType}"`);break}if(!W)continue;W.extensions=W.extensions||{},W.extensions[GZ]={packet:$.length-1}}}if($.length>0)J.extensions=J.extensions||{},J.extensions[GZ]={packets:$};return this}}IC.EXTENSION_NAME=GZ;var lw1=[iG,eD,JC,YC,WC,KC,zC,$L,qC,YL,QL,LC,OC,WL,NC,DC,nG,CC,kC,IC],xH6=[e2,pG,ZL,JL,...lw1];var pw1=t(pP(),1);function WX(){return WX=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var $=arguments[J];for(var Y in $)({}).hasOwnProperty.call($,Y)&&(Z[Y]=$[Y])}return Z},WX.apply(null,arguments)}var{POINTS:Xa,LINES:XL,LINE_STRIP:iw1,LINE_LOOP:nw1,TRIANGLES:KL,TRIANGLE_STRIP:aw1,TRIANGLE_FAN:sw1}=R8.Mode;function MJ(Z,J){return Object.defineProperty(J,"name",{value:Z}),J}function X7(Z,J){let $=WX({},Z);for(let Y in J)if(J[Y]!==void 0)$[Y]=J[Y];return $}function Ta(Z){let J=Z.getIndices(),$=Z.getAttribute("POSITION");switch(Z.getMode()){case R8.Mode.POINTS:return J?J.getCount():$.getCount();case R8.Mode.LINES:return J?J.getCount()/2:$.getCount()/2;case R8.Mode.LINE_LOOP:return J?J.getCount():$.getCount();case R8.Mode.LINE_STRIP:return J?J.getCount()-1:$.getCount()-1;case R8.Mode.TRIANGLES:return J?J.getCount()/3:$.getCount()/3;case R8.Mode.TRIANGLE_STRIP:case R8.Mode.TRIANGLE_FAN:return J?J.getCount()-2:$.getCount()-2;default:throw new Error("Unexpected mode: "+Z.getMode())}}var ow1=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function AC(Z){return ow1.format(Z)}function rw1(Z,J,$=2){let Y=Z>J?"\u2013":"+",Q="%";return Y+(Math.abs(Z-J)/Z*100).toFixed($)+"%"}function qL(Z,J){return`${AC(Z)} \u2192 ${AC(J)} (${rw1(Z,J)})`}function mC(Z){let J=[];for(let $ of Z.listAttributes())J.push($);for(let $ of Z.listTargets())for(let Y of $.listAttributes())J.push(Y);return Array.from(new Set(J))}function tw1(Z,J,$){Z.swap(J,$);for(let Y of Z.listTargets())Y.swap(J,$)}function ew1(Z,J){if(Z==null&&J==null)return!0;if(Z==null||J==null)return!1;if(Z.length!==J.length)return!1;for(let $=0;$<Z.length;$++)if(Z[$]!==J[$])return!1;return!0}function HZ(Z,J){return Z.createAccessor(J.getName()).setArray(J.getArray()).setType(J.getType()).setBuffer(J.getBuffer()).setNormalized(J.getNormalized()).setSparse(J.getSparse())}function ZB1(Z,J=Z){let $=uC(Z,J);for(let Y=0;Y<$.length;Y++)$[Y]=Y;return $}function uC(Z,J=Z){return J<=65534?new Uint16Array(Z):new Uint32Array(Z)}function JB1(Z){return Z.listParents().some((J)=>J.propertyType!==a.ROOT)}function ka(Z){for(let J in Z)return!1;return!0}function Ea(Z){let J=C6.fromGraph(Z.getGraph()),$=Z.getMaterial(),Y=J.getRoot().listMaterials().indexOf($),Q=YB1[Z.getMode()],W=!!Z.getIndices(),X=Z.listSemantics().sort().map((G)=>{let z=Z.getAttribute(G),H=z.getElementSize(),V=z.getComponentType();return`${G}:${H}:${V}`}).join("+"),K=Z.listTargets().map((G)=>{return G.listSemantics().sort().map((z)=>{let H=Z.getAttribute(z),V=H.getElementSize(),q=H.getComponentType();return`${z}:${V}:${q}`}).join("+")}).join("~");return`${Y}|${Q}|${W}|${X}|${K}`}function $B1(Z){return Math.pow(2,Math.ceil(Math.log(Z)/Math.LN2))}var YB1={[Xa]:Xa,[XL]:XL,[iw1]:XL,[nw1]:XL,[KL]:KL,[aw1]:KL,[sw1]:KL},YX="center",Ka={pivot:"center"};function Ia(Z=Ka){let J=X7(Ka,Z);return MJ(YX,($)=>{let Y=$.getLogger(),Q=$.getRoot(),W=Q.listAnimations().length>0||Q.listSkins().length>0;$.getRoot().listScenes().forEach((X,K)=>{Y.debug(`${YX}: Scene ${K+1} / ${Q.listScenes().length}.`);let G;if(typeof J.pivot==="string"){let H=yP(X);if(G=[(H.max[0]-H.min[0])/2+H.min[0],(H.max[1]-H.min[1])/2+H.min[1],(H.max[2]-H.min[2])/2+H.min[2]],J.pivot==="above")G[1]=H.max[1];if(J.pivot==="below")G[1]=H.min[1]}else G=J.pivot;Y.debug(`${YX}: Pivot "${G.join(", ")}".`);let z=[-1*G[0],-1*G[1],-1*G[2]];if(W){Y.debug(`${YX}: Model contains animation or skin. Adding a wrapper node.`);let H=$.createNode("Pivot").setTranslation(z);X.listChildren().forEach((V)=>H.addChild(V)),X.addChild(H)}else Y.debug(`${YX}: Skipping wrapper, offsetting all root nodes.`),X.listChildren().forEach((H)=>{let V=H.getTranslation();H.setTranslation([V[0]+z[0],V[1]+z[1],V[2]+z[2]])})}),Y.debug(`${YX}: Complete.`)})}function QB1(Z){let J=new Set,$=Z,Y;while(Y=$.getParentNode()){if(J.has(Y))throw new Error("Circular dependency in scene graph.");J.add(Y),$=Y}return $.listParents().filter((Q)=>Q instanceof dW)}function WB1(Z){let J=QB1(Z),$=Z.getParentNode();if(!$)return Z;Z.setMatrix(Z.getWorldMatrix()),$.removeChild(Z);for(let Y of J)Y.addChild(Z);return Z}var XX=typeof Float32Array!=="undefined"?Float32Array:Array;if(!Math.hypot)Math.hypot=function(){var Z=0,J=arguments.length;while(J--)Z+=arguments[J]*arguments[J];return Math.sqrt(Z)};function XB1(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],O=J[15],j=$*K-Y*X,M=$*G-Q*X,N=$*z-W*X,D=Y*G-Q*K,P=Y*z-W*K,C=Q*z-W*G,T=H*w-V*U,E=H*L-q*U,A=H*O-F*U,S=V*L-q*w,x=V*O-F*w,I=q*O-F*L,v=j*I-M*x+N*S+D*A-P*E+C*T;if(!v)return null;return v=1/v,Z[0]=(K*I-G*x+z*S)*v,Z[1]=(Q*x-Y*I-W*S)*v,Z[2]=(w*C-L*P+O*D)*v,Z[3]=(q*P-V*C-F*D)*v,Z[4]=(G*A-X*I-z*E)*v,Z[5]=($*I-Q*A+W*E)*v,Z[6]=(L*N-U*C-O*M)*v,Z[7]=(H*C-q*N+F*M)*v,Z[8]=(X*x-K*A+z*T)*v,Z[9]=(Y*A-$*x-W*T)*v,Z[10]=(U*P-w*N+O*j)*v,Z[11]=(V*N-H*P-F*j)*v,Z[12]=(K*E-X*S-G*T)*v,Z[13]=($*S-Y*E+Q*T)*v,Z[14]=(w*M-U*D-L*j)*v,Z[15]=(H*D-V*M+q*j)*v,Z}function KB1(Z){var J=Z[0],$=Z[1],Y=Z[2],Q=Z[3],W=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],H=Z[9],V=Z[10],q=Z[11],F=Z[12],U=Z[13],w=Z[14],L=Z[15],O=J*X-$*W,j=J*K-Y*W,M=J*G-Q*W,N=$*K-Y*X,D=$*G-Q*X,P=Y*G-Q*K,C=z*U-H*F,T=z*w-V*F,E=z*L-q*F,A=H*w-V*U,S=H*L-q*U,x=V*L-q*w;return O*x-j*S+M*A+N*E-D*T+P*C}function va(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=J[9],F=J[10],U=J[11],w=J[12],L=J[13],O=J[14],j=J[15],M=$[0],N=$[1],D=$[2],P=$[3];return Z[0]=M*Y+N*K+D*V+P*w,Z[1]=M*Q+N*G+D*q+P*L,Z[2]=M*W+N*z+D*F+P*O,Z[3]=M*X+N*H+D*U+P*j,M=$[4],N=$[5],D=$[6],P=$[7],Z[4]=M*Y+N*K+D*V+P*w,Z[5]=M*Q+N*G+D*q+P*L,Z[6]=M*W+N*z+D*F+P*O,Z[7]=M*X+N*H+D*U+P*j,M=$[8],N=$[9],D=$[10],P=$[11],Z[8]=M*Y+N*K+D*V+P*w,Z[9]=M*Q+N*G+D*q+P*L,Z[10]=M*W+N*z+D*F+P*O,Z[11]=M*X+N*H+D*U+P*j,M=$[12],N=$[13],D=$[14],P=$[15],Z[12]=M*Y+N*K+D*V+P*w,Z[13]=M*Q+N*G+D*q+P*L,Z[14]=M*W+N*z+D*F+P*O,Z[15]=M*X+N*H+D*U+P*j,Z}function GB1(){var Z=new XX(9);if(XX!=Float32Array)Z[1]=0,Z[2]=0,Z[3]=0,Z[5]=0,Z[6]=0,Z[7]=0;return Z[0]=1,Z[4]=1,Z[8]=1,Z}function zB1(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[4],Z[4]=J[5],Z[5]=J[6],Z[6]=J[8],Z[7]=J[9],Z[8]=J[10],Z}function HB1(Z,J){if(Z===J){var $=J[1],Y=J[2],Q=J[5];Z[1]=J[3],Z[2]=J[6],Z[3]=$,Z[5]=J[7],Z[6]=Y,Z[7]=Q}else Z[0]=J[0],Z[1]=J[3],Z[2]=J[6],Z[3]=J[1],Z[4]=J[4],Z[5]=J[7],Z[6]=J[2],Z[7]=J[5],Z[8]=J[8];return Z}function VB1(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=H*X-K*z,q=-H*W+K*G,F=z*W-X*G,U=$*V+Y*q+Q*F;if(!U)return null;return U=1/U,Z[0]=V*U,Z[1]=(-H*Y+Q*z)*U,Z[2]=(K*Y-Q*X)*U,Z[3]=q*U,Z[4]=(H*$-Q*G)*U,Z[5]=(-K*$+Q*W)*U,Z[6]=F*U,Z[7]=(-z*$+Y*G)*U,Z[8]=(X*$-Y*W)*U,Z}function FL(){var Z=new XX(3);if(XX!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function qB1(Z,J,$){return Z[0]=J[0]*$[0],Z[1]=J[1]*$[1],Z[2]=J[2]*$[2],Z}function Sa(Z,J){var $=J[0],Y=J[1],Q=J[2],W=$*$+Y*Y+Q*Q;if(W>0)W=1/Math.sqrt(W);return Z[0]=J[0]*W,Z[1]=J[1]*W,Z[2]=J[2]*W,Z}function FB1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=$[3]*Y+$[7]*Q+$[11]*W+$[15];return X=X||1,Z[0]=($[0]*Y+$[4]*Q+$[8]*W+$[12])/X,Z[1]=($[1]*Y+$[5]*Q+$[9]*W+$[13])/X,Z[2]=($[2]*Y+$[6]*Q+$[10]*W+$[14])/X,Z}function UB1(Z,J,$){var Y=J[0],Q=J[1],W=J[2];return Z[0]=Y*$[0]+Q*$[3]+W*$[6],Z[1]=Y*$[1]+Q*$[4]+W*$[7],Z[2]=Y*$[2]+Q*$[5]+W*$[8],Z}var LB1=qB1;(function(){var Z=FL();return function(J,$,Y,Q,W,X){var K,G;if(!$)$=3;if(!Y)Y=0;if(Q)G=Math.min(Q*$+Y,J.length);else G=J.length;for(K=Y;K<G;K+=$)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],W(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}})();var OJ="dedup",vC={keepUniqueNames:!1,propertyTypes:[a.ACCESSOR,a.MESH,a.TEXTURE,a.MATERIAL,a.SKIN]};function _a(Z=vC){let J=X7(vC,Z),$=new Set(J.propertyTypes);for(let Y of J.propertyTypes)if(!vC.propertyTypes.includes(Y))throw new Error(`${OJ}: Unsupported deduplication on type "${Y}".`);return MJ(OJ,(Y)=>{let Q=Y.getLogger();if($.has(a.ACCESSOR))wB1(Y);if($.has(a.TEXTURE))OB1(Y,J);if($.has(a.MATERIAL))jB1(Y,J);if($.has(a.MESH))BB1(Y,J);if($.has(a.SKIN))MB1(Y,J);Q.debug(`${OJ}: Complete.`)})}function wB1(Z){let J=Z.getLogger(),$=new Map,Y=new Map,Q=new Map,W=new Map,X=Z.getRoot().listMeshes();X.forEach((V)=>{V.listPrimitives().forEach((q)=>{q.listAttributes().forEach((F)=>K(F,Y)),K(q.getIndices(),$)})});for(let V of Z.getRoot().listAnimations())for(let q of V.listSamplers())K(q.getInput(),Q),K(q.getOutput(),W);function K(V,q){if(!V)return;let F=[V.getCount(),V.getType(),V.getComponentType(),V.getNormalized(),V.getSparse()].join(":"),U=q.get(F);if(!U)q.set(F,U=new Set);U.add(V)}function G(V,q){for(let F=0;F<V.length;F++){let U=V[F],w=n0.toView(U.getArray());if(q.has(U))continue;for(let L=F+1;L<V.length;L++){let O=V[L];if(q.has(O))continue;if(n0.equals(w,n0.toView(O.getArray())))q.set(O,U)}}}let z=0,H=new Map;for(let V of[Y,$,Q,W])for(let q of V.values())z+=q.size,G(Array.from(q),H);J.debug(`${OJ}: Merged ${H.size} of ${z} accessors.`),X.forEach((V)=>{V.listPrimitives().forEach((q)=>{q.listAttributes().forEach((U)=>{if(H.has(U))q.swap(U,H.get(U))});let F=q.getIndices();if(F&&H.has(F))q.swap(F,H.get(F))})});for(let V of Z.getRoot().listAnimations())for(let q of V.listSamplers()){let F=q.getInput(),U=q.getOutput();if(F&&H.has(F))q.swap(F,H.get(F));if(U&&H.has(U))q.swap(U,H.get(U))}Array.from(H.keys()).forEach((V)=>V.dispose())}function BB1(Z,J){let $=Z.getLogger(),Y=Z.getRoot(),Q=new Map;Y.listAccessors().forEach((K,G)=>Q.set(K,G)),Y.listMaterials().forEach((K,G)=>Q.set(K,G));let W=Y.listMeshes().length,X=new Map;for(let K of Y.listMeshes()){let G=[];for(let H of K.listPrimitives())G.push(Aa(H,Q));let z="";if(J.keepUniqueNames)z+=K.getName()+";";if(z+=G.join(";"),X.has(z)){let H=X.get(z);K.listParents().forEach((V)=>{if(V.propertyType!==a.ROOT)V.swap(K,H)}),K.dispose()}else X.set(z,K)}$.debug(`${OJ}: Merged ${W-X.size} of ${W} meshes.`)}function OB1(Z,J){let $=Z.getLogger(),Y=Z.getRoot(),Q=Y.listTextures(),W=new Map;for(let X=0;X<Q.length;X++){let K=Q[X],G=K.getImage();if(W.has(K))continue;for(let z=X+1;z<Q.length;z++){let H=Q[z],V=H.getImage();if(W.has(H))continue;if(K.getMimeType()!==H.getMimeType())continue;if(J.keepUniqueNames&&K.getName()!==H.getName())continue;let q=K.getSize(),F=H.getSize();if(!q||!F)continue;if(q[0]!==F[0])continue;if(q[1]!==F[1])continue;if(!G||!V)continue;if(n0.equals(G,V))W.set(H,K)}}$.debug(`${OJ}: Merged ${W.size} of ${Y.listTextures().length} textures.`),Array.from(W.entries()).forEach(([X,K])=>{X.listParents().forEach((G)=>{if(!(G instanceof YY))G.swap(X,K)}),X.dispose()})}function jB1(Z,J){let $=Z.getLogger(),Q=Z.getRoot().listMaterials(),W=new Map,X=new Map,K=new Set;if(!J.keepUniqueNames)K.add("name");for(let G=0;G<Q.length;G++){let z=Q[G];if(W.has(z))continue;if(Ga(z,X))continue;for(let H=G+1;H<Q.length;H++){let V=Q[H];if(W.has(V))continue;if(Ga(V,X))continue;if(z.equals(V,K))W.set(V,z)}}$.debug(`${OJ}: Merged ${W.size} of ${Q.length} materials.`),Array.from(W.entries()).forEach(([G,z])=>{G.listParents().forEach((H)=>{if(!(H instanceof YY))H.swap(G,z)}),G.dispose()})}function MB1(Z,J){let $=Z.getLogger(),Q=Z.getRoot().listSkins(),W=new Map,X=new Set(["joints"]);if(!J.keepUniqueNames)X.add("name");for(let K=0;K<Q.length;K++){let G=Q[K];if(W.has(G))continue;for(let z=K+1;z<Q.length;z++){let H=Q[z];if(W.has(H))continue;if(G.equals(H,X)&&ew1(G.listJoints(),H.listJoints()))W.set(H,G)}}$.debug(`${OJ}: Merged ${W.size} of ${Q.length} skins.`),Array.from(W.entries()).forEach(([K,G])=>{K.listParents().forEach((z)=>{if(!(z instanceof YY))z.swap(K,G)}),K.dispose()})}function Aa(Z,J){let $=[];for(let Y of Z.listSemantics()){let Q=Z.getAttribute(Y);$.push(Y+":"+J.get(Q))}if(Z instanceof R8){let Y=Z.getIndices();if(Y)$.push("indices:"+J.get(Y));let Q=Z.getMaterial();if(Q)$.push("material:"+J.get(Q));$.push("mode:"+Z.getMode());for(let W of Z.listTargets())$.push("target:"+Aa(W,J))}return $.join(",")}function Ga(Z,J){if(J.has(Z))return J.get(Z);let $=Z.getGraph(),Y=new Set,Q=$.listParentEdges(Z);while(Q.length>0){let W=Q.pop();if(W.getAttributes().modifyChild===!0)return J.set(Z,!0),!0;let X=W.getChild();if(Y.has(X))continue;for(let K of $.listChildEdges(X))Q.push(K)}return J.set(Z,!1),!1}function xa(){var Z=new XX(4);if(XX!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function RB1(Z,J,$){return Z[0]=J[0]+$[0],Z[1]=J[1]+$[1],Z[2]=J[2]+$[2],Z[3]=J[3]+$[3],Z}function NB1(Z,J,$){return Z[0]=J[0]-$[0],Z[1]=J[1]-$[1],Z[2]=J[2]-$[2],Z[3]=J[3]-$[3],Z}function PB1(Z,J,$){return Z[0]=J[0]*$[0],Z[1]=J[1]*$[1],Z[2]=J[2]*$[2],Z[3]=J[3]*$[3],Z}function DB1(Z,J,$){return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z[3]=J[3]*$,Z}function CB1(Z){var J=Z[0],$=Z[1],Y=Z[2],Q=Z[3];return Math.hypot(J,$,Y,Q)}var ha=NB1,TB1=PB1,fa=CB1;(function(){var Z=xa();return function(J,$,Y,Q,W,X){var K,G;if(!$)$=4;if(!Y)Y=0;if(Q)G=Math.min(Q*$+Y,J.length);else G=J.length;for(K=Y;K<G;K+=$)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Z[3]=J[K+3],W(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2],J[K+3]=Z[3];return J}})();var kB1=/color|emissive|diffuse/i;function EB1(Z){return Z.getGraph().listParentEdges(Z).some((Q)=>{return Q.getAttributes().isColor||kB1.test(Q.getName())})?"srgb":null}function IB1(Z){let J=Z.getGraph(),$=new Set,Y=new Set;function Q(W){let X=new Set;for(let K of J.listChildEdges(W))if(K.getChild()instanceof $Y)X.add(K.getName()+"Info");for(let K of J.listChildEdges(W)){let G=K.getChild();if($.has(G))continue;if($.add(G),G instanceof O5&&X.has(K.getName()))Y.add(G);else if(G instanceof uW)Q(G)}}return Q(Z),Array.from(Y)}function vB1(Z){let $=C6.fromGraph(Z.getGraph()).getRoot(),Y=Z.getGraph().listParentEdges(Z).filter((Q)=>Q.getParent()!==$).map((Q)=>Q.getName());return Array.from(new Set(Y))}var QX="prune",xC=0.011764705882352941,za={propertyTypes:[a.NODE,a.SKIN,a.MESH,a.CAMERA,a.PRIMITIVE,a.PRIMITIVE_TARGET,a.ANIMATION,a.MATERIAL,a.TEXTURE,a.ACCESSOR,a.BUFFER],keepLeaves:!1,keepAttributes:!1,keepIndices:!1,keepSolidTextures:!1,keepExtras:!1};function UL(Z=za){let J=X7(za,Z),$=new Set(J.propertyTypes),Y=J.keepExtras;return MJ(QX,async(Q)=>{let W=Q.getLogger(),X=Q.getRoot(),K=Q.getGraph(),G=new ba,z=(H)=>G.dispose(H.target);if(K.addEventListener("node:dispose",z),$.has(a.MESH))for(let H of X.listMeshes()){if(H.listPrimitives().length>0)continue;H.dispose()}if($.has(a.NODE)){if(!J.keepLeaves)for(let H of X.listScenes())ya(K,H,Y);for(let H of X.listNodes())R9(H,Y)}if($.has(a.SKIN))for(let H of X.listSkins())R9(H,Y);if($.has(a.MESH))for(let H of X.listMeshes())R9(H,Y);if($.has(a.CAMERA))for(let H of X.listCameras())R9(H,Y);if($.has(a.PRIMITIVE))Ha(K,a.PRIMITIVE,Y);if($.has(a.PRIMITIVE_TARGET))Ha(K,a.PRIMITIVE_TARGET,Y);if(!J.keepAttributes&&$.has(a.ACCESSOR)){let H=new Map;for(let V of X.listMeshes())for(let q of V.listPrimitives()){let F=q.getMaterial();if(!F)continue;let U=ga(Q,q,F),w=_B1(q,U);Va(q,w),q.listTargets().forEach((L)=>Va(L,w)),H.has(F)?H.get(F).add(q):H.set(F,new Set([q]))}for(let[V,q]of H)AB1(V,Array.from(q))}if(!J.keepIndices&&$.has(a.ACCESSOR))for(let H of X.listMeshes())for(let V of H.listPrimitives())SB1(V);if($.has(a.ANIMATION))for(let H of X.listAnimations()){for(let V of H.listChannels())if(!V.getTargetNode())V.dispose();if(!H.listChannels().length){let V=H.listSamplers();R9(H,Y),V.forEach((q)=>R9(q,Y))}else H.listSamplers().forEach((V)=>R9(V,Y))}if($.has(a.MATERIAL))X.listMaterials().forEach((H)=>R9(H,Y));if($.has(a.TEXTURE)){if(X.listTextures().forEach((H)=>R9(H,Y)),!J.keepSolidTextures)await xB1(Q)}if($.has(a.ACCESSOR))X.listAccessors().forEach((H)=>R9(H,Y));if($.has(a.BUFFER))X.listBuffers().forEach((H)=>R9(H,Y));if(K.removeEventListener("node:dispose",z),!G.empty()){let H=G.entries().map(([V,q])=>`${V} (${q})`).join(", ");W.info(`${QX}: Removed types... ${H}`)}else W.debug(`${QX}: No unused properties found.`);W.debug(`${QX}: Complete.`)})}class ba{constructor(){this.disposed={}}empty(){for(let Z in this.disposed)return!1;return!0}entries(){return Object.entries(this.disposed)}dispose(Z){this.disposed[Z.propertyType]=this.disposed[Z.propertyType]||0,this.disposed[Z.propertyType]++}}function R9(Z,J){let $=Z.listParents().filter((Q)=>!(Q instanceof YY||Q instanceof ZY)),Y=J&&!ka(Z.getExtras());if(!$.length&&!Y)Z.dispose()}function Ha(Z,J,$){for(let Y of Z.listEdges()){let Q=Y.getParent();if(Q.propertyType===J)R9(Q,$)}}function ya(Z,J,$){if(J.listChildren().forEach((X)=>ya(Z,X,$)),J instanceof dW)return;let Y=Z.listParentEdges(J).some((X)=>{let K=X.getParent().propertyType;return K!==a.ROOT&&K!==a.SCENE&&K!==a.NODE}),Q=Z.listChildren(J).length===0,W=$&&!ka(J.getExtras());if(Q&&!Y&&!W)J.dispose()}function Va(Z,J){for(let $ of J)Z.setAttribute($,null)}function SB1(Z){let J=Z.getIndices(),$=J&&J.getArray(),Y=Z.listAttributes()[0];if(!$||!Y)return;if(J.getCount()!==Y.getCount())return;for(let Q=0,W=$.length;Q<W;Q++)if(Q!==$[Q])return;Z.setIndices(null)}function _B1(Z,J){let $=[];for(let Y of Z.listSemantics())if(Y==="NORMAL"&&!J.has(Y))$.push(Y);else if(Y==="TANGENT"&&!J.has(Y))$.push(Y);else if(Y.startsWith("TEXCOORD_")&&!J.has(Y))$.push(Y);else if(Y.startsWith("COLOR_")&&Y!=="COLOR_0")$.push(Y);return $}function ga(Z,J,$,Y=new Set){let W=Z.getGraph().listChildEdges($),X=new Set;for(let z of W)if(z.getChild()instanceof $Y)X.add(z.getName());for(let z of W){let H=z.getName(),V=z.getChild();if(V instanceof O5){if(X.has(H.replace(/Info$/,"")))Y.add(`TEXCOORD_${V.getTexCoord()}`)}if(V instanceof $Y&&H.match(/normalTexture/i))Y.add("TANGENT");if(V instanceof uW)ga(Z,J,V,Y)}let K=$ instanceof r4&&!$.getExtension("KHR_materials_unlit"),G=J.getMode()===R8.Mode.POINTS;if(K&&!G)Y.add("NORMAL");return Y}function AB1(Z,J){let $=IB1(Z),Y=new Set($.map((G)=>G.getTexCoord())),Q=Array.from(Y).sort(),W=new Map(Q.map((G,z)=>[G,z])),X=new Map(Q.map((G,z)=>[`TEXCOORD_${G}`,`TEXCOORD_${z}`]));for(let G of $){let z=G.getTexCoord();G.setTexCoord(W.get(z))}for(let G of J){let z=G.listSemantics().filter((H)=>H.startsWith("TEXCOORD_")).sort();K(G,z),G.listTargets().forEach((H)=>K(H,z))}function K(G,z){for(let H of z){let V=G.getAttribute(H);if(!V)continue;let q=X.get(H);if(q===H)continue;G.setAttribute(q,V),G.setAttribute(H,null)}}}async function xB1(Z){let J=Z.getRoot(),$=Z.getGraph(),Y=Z.getLogger(),W=J.listTextures().map(async(X)=>{var K;let G=await fB1(X);if(!G)return;if(EB1(X)==="srgb")gP.convertSRGBToLinear(G,G);let z=X.getName()||X.getURI(),H=(K=X.getSize())==null?void 0:K.join("x"),V=vB1(X);for(let q of $.listParentEdges(X)){let F=q.getParent();if(F!==J&&hB1(F,G,q.getName(),Y))q.dispose()}if(X.listParents().length===1)X.dispose(),Y.debug(`${QX}: Removed solid-color texture "${z}" (${H}px ${V.join(", ")})`)});await Promise.all(W)}function hB1(Z,J,$,Y){if(Z instanceof r4)switch($){case"baseColorTexture":return Z.setBaseColorFactor(TB1(J,J,Z.getBaseColorFactor())),!0;case"emissiveTexture":return Z.setEmissiveFactor(LB1([0,0,0],J.slice(0,3),Z.getEmissiveFactor())),!0;case"occlusionTexture":return Math.abs(J[0]-1)<=xC;case"metallicRoughnessTexture":return Z.setRoughnessFactor(J[1]*Z.getRoughnessFactor()),Z.setMetallicFactor(J[2]*Z.getMetallicFactor()),!0;case"normalTexture":return fa(ha(xa(),J,[0.5,0.5,1,1]))<=xC}return Y.warn(`${QX}: Detected single-color ${$} texture. Pruning ${$} not yet supported.`),!1}async function fB1(Z){let J=await bB1(Z);if(!J)return null;let $=[1/0,1/0,1/0,1/0],Y=[-1/0,-1/0,-1/0,-1/0],Q=[0,0,0,0],[W,X]=J.shape;for(let K=0;K<W;K++){for(let G=0;G<X;G++)for(let z=0;z<4;z++)$[z]=Math.min($[z],J.get(K,G,z)),Y[z]=Math.max(Y[z],J.get(K,G,z));if(fa(ha(Q,Y,$))/255>xC)return null}return DB1(Q,RB1(Q,Y,$),0.00196078431372549)}async function bB1(Z){try{return await Pn(Z.getImage(),Z.getMimeType())}catch(J){return null}}var BJ=4294967295;class ma{constructor(Z){this.attributes=[],this.u8=void 0,this.u32=void 0;let J=0;for(let $ of mC(Z))J+=this._initAttribute($);this.u8=new Uint8Array(J),this.u32=new Uint32Array(this.u8.buffer)}_initAttribute(Z){let J=Z.getArray(),$=new Uint8Array(J.buffer,J.byteOffset,J.byteLength),Y=Z.getElementSize()*Z.getComponentSize(),Q=n0.padNumber(Y);return this.attributes.push({u8:$,byteStride:Y,paddedByteStride:Q}),Q}hash(Z){let J=0;for(let{u8:$,byteStride:Y,paddedByteStride:Q}of this.attributes){for(let W=0;W<Q;W++)if(W<Y)this.u8[J+W]=$[Z*Y+W];else this.u8[J+W]=0;J+=Q}return yB1(0,this.u32)}equal(Z,J){for(let{u8:$,byteStride:Y}of this.attributes)for(let Q=0;Q<Y;Q++)if($[Z*Y+Q]!==$[J*Y+Q])return!1;return!0}}function yB1(Z,J){for(let Q=0,W=J.length;Q<W;Q++){let X=J[Q];X=Math.imul(X,1540483477)>>>0,X=(X^X>>24)>>>0,X=Math.imul(X,1540483477)>>>0,Z=Math.imul(Z,1540483477)>>>0,Z=(Z^X)>>>0}return Z}function gB1(Z,J,$,Y,Q=BJ){let W=J-1,K=$.hash(Y)&W;for(let G=0;G<=W;G++){let z=Z[K];if(z===Q||$.equal(z,Y))return K;K=K+G+1&W}throw new Error("Hash table full.")}var w6;(function(Z){Z.RENDER="render",Z.RENDER_CACHED="render-cached",Z.UPLOAD="upload",Z.UPLOAD_NAIVE="upload-naive",Z.DISTINCT="distinct",Z.DISTINCT_POSITION="distinct-position",Z.UNUSED="unused"})(w6||(w6={}));function jJ(Z,J){let $=Z.getAttribute("POSITION"),Y=Z.getIndices();switch(J){case w6.RENDER:return Y?Y.getCount():$.getCount();case w6.RENDER_CACHED:return Y?new Set(Y.getArray()).size:$.getCount();case w6.UPLOAD_NAIVE:case w6.UPLOAD:return $.getCount();case w6.DISTINCT:case w6.DISTINCT_POSITION:return mB1(J);case w6.UNUSED:return Y?$.getCount()-new Set(Y.getArray()).size:0;default:return uB1(J)}}function mB1(Z){throw new Error(`Not implemented: ${Z}`)}function uB1(Z){throw new Error(`Unexpected value: ${Z}`)}function sG(Z,J,$){let Y=C6.fromGraph(Z.getGraph());if(!J||!$)[J,$]=dB1(Z);let Q=Z.getIndices(),W=Q?Q.getArray():null,X=jJ(Z,w6.RENDER),K=Y.createAccessor(),G=X,z=uC(G,$);for(let V=0;V<G;V++)z[V]=J[W?W[V]:V];Z.setIndices(K.setArray(z));let H=mC(Z);for(let V of Z.listAttributes()){let q=HZ(Y,V);hC(V,Q,J,q,$),Z.swap(V,q)}for(let V of Z.listTargets())for(let q of V.listAttributes()){let F=HZ(Y,q);hC(q,Q,J,F,$),V.swap(q,F)}if(Q&&Q.listParents().length===1)Q.dispose();for(let V of H)if(V.listParents().length===1)V.dispose();return Z}function hC(Z,J,$,Y,Q){let W=Z.getElementSize(),X=Z.getArray(),K=J?J.getArray():null,G=J?J.getCount():Z.getCount(),z=new X.constructor(Q*W),H=new Uint8Array(Q);for(let V=0;V<G;V++){let q=K?K[V]:V,F=$[q];if(H[F])continue;for(let U=0;U<W;U++)z[F*W+U]=X[q*W+U];H[F]=1}return Y.setArray(z)}function dB1(Z){let J=jJ(Z,w6.UPLOAD),$=Z.getIndices(),Y=$?$.getArray():null;if(!$||!Y)return[ZB1(J,1e6),J];let Q=new Uint32Array(J).fill(BJ),W=0;for(let X=0;X<Y.length;X++){let K=Y[X];if(Q[K]===BJ)Q[K]=W++}return[Q,W]}var fC="weld",zL={overwrite:!0,cleanup:!0};function dC(Z=zL){let J=X7(zL,Z);return MJ(fC,async($)=>{let Y=$.getLogger();for(let Q of $.getRoot().listMeshes()){for(let W of Q.listPrimitives())if(LL(W,J),jJ(W,w6.RENDER)===0)W.dispose();if(Q.listPrimitives().length===0)Q.dispose()}if(J.cleanup)await $.transform(UL({propertyTypes:[a.ACCESSOR,a.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),_a({propertyTypes:[a.ACCESSOR]}));Y.debug(`${fC}: Complete.`)})}function LL(Z,J=zL){let $=Z.getGraph(),Q=C6.fromGraph($).getLogger(),W=WX({},zL,J);if(Z.getIndices()&&!W.overwrite)return;if(Z.getMode()===R8.Mode.POINTS)return;let X=Z.getAttribute("POSITION").getCount(),K=Z.getIndices(),G=K==null?void 0:K.getArray(),z=K?K.getCount():X,H=new ma(Z),V=$B1(X+X/4),q=new Uint32Array(V).fill(BJ),F=new Uint32Array(X).fill(BJ),U=0;for(let w=0;w<z;w++){let L=G?G[w]:w;if(F[L]!==BJ)continue;let O=gB1(q,V,H,L,BJ),j=q[O];if(j===BJ)q[O]=L,F[L]=U++;else F[L]=F[j]}Q.debug(`${fC}: ${qL(X,U)} vertices.`),sG(Z,F,U)}var{FLOAT:cB1}=I0.ComponentType;function ua(Z,J){let $=Z.getAttribute("POSITION");if($)qa(J,$);let Y=Z.getAttribute("NORMAL");if(Y)Fa(J,Y);let Q=Z.getAttribute("TANGENT");if(Q)Ua(J,Q);for(let W of Z.listTargets()){let X=W.getAttribute("POSITION");if(X)qa(J,X);let K=W.getAttribute("NORMAL");if(K)Fa(J,K);let G=W.getAttribute("TANGENT");if(G)Ua(J,G)}if(KB1(J)<0)lB1(Z)}function qa(Z,J){let $=J.getComponentType(),Y=J.getNormalized(),Q=J.getArray(),W=$===cB1?Q:new Float32Array(Q.length),X=FL();for(let K=0,G=J.getCount();K<G;K++){if(Y)X[0]=d0.decodeNormalizedInt(Q[K*3],$),X[1]=d0.decodeNormalizedInt(Q[K*3+1],$),X[2]=d0.decodeNormalizedInt(Q[K*3+2],$);else X[0]=Q[K*3],X[1]=Q[K*3+1],X[2]=Q[K*3+2];FB1(X,X,Z),W[K*3]=X[0],W[K*3+1]=X[1],W[K*3+2]=X[2]}J.setArray(W).setNormalized(!1)}function Fa(Z,J){let $=J.getArray(),Y=J.getNormalized(),Q=J.getComponentType(),W=GB1();zB1(W,Z),VB1(W,W),HB1(W,W);let X=FL();for(let K=0,G=J.getCount();K<G;K++){if(Y)X[0]=d0.decodeNormalizedInt($[K*3],Q),X[1]=d0.decodeNormalizedInt($[K*3+1],Q),X[2]=d0.decodeNormalizedInt($[K*3+2],Q);else X[0]=$[K*3],X[1]=$[K*3+1],X[2]=$[K*3+2];if(UB1(X,X,W),Sa(X,X),Y)$[K*3]=d0.decodeNormalizedInt(X[0],Q),$[K*3+1]=d0.decodeNormalizedInt(X[1],Q),$[K*3+2]=d0.decodeNormalizedInt(X[2],Q);else $[K*3]=X[0],$[K*3+1]=X[1],$[K*3+2]=X[2]}}function Ua(Z,J){let $=J.getArray(),Y=J.getNormalized(),Q=J.getComponentType(),W=FL();for(let X=0,K=J.getCount();X<K;X++){if(Y)W[0]=d0.decodeNormalizedInt($[X*4],Q),W[1]=d0.decodeNormalizedInt($[X*4+1],Q),W[2]=d0.decodeNormalizedInt($[X*4+2],Q);else W[0]=$[X*4],W[1]=$[X*4+1],W[2]=$[X*4+2];if(W[0]=Z[0]*W[0]+Z[4]*W[1]+Z[8]*W[2],W[1]=Z[1]*W[0]+Z[5]*W[1]+Z[9]*W[2],W[2]=Z[2]*W[0]+Z[6]*W[1]+Z[10]*W[2],Sa(W,W),Y)$[X*4]=d0.decodeNormalizedInt(W[0],Q),$[X*4+1]=d0.decodeNormalizedInt(W[1],Q),$[X*4+2]=d0.decodeNormalizedInt(W[2],Q);else $[X*4]=W[0],$[X*4+1]=W[1],$[X*4+2]=W[2]}}function lB1(Z){if(Z.getMode()!==R8.Mode.TRIANGLES)return;if(!Z.getIndices())LL(Z);let J=Z.getIndices();for(let $=0,Y=J.getCount();$<Y;$+=3){let Q=J.getScalar($),W=J.getScalar($+2);J.setScalar($,W),J.setScalar($+2,Q)}}function pB1(Z,J){for(let $ of Z.listPrimitives()){let Y=iB1($,Z);if($!==Y)Z.removePrimitive($).addPrimitive(Y)}for(let $ of Z.listPrimitives())sG($),ua($,J)}function iB1(Z,J){if(Z.listParents().some((Y)=>Y instanceof CG&&Y!==J))Z=Z.clone();for(let Y of Z.listTargets())if(Y.listParents().some((W)=>W instanceof R8&&W!==Z))Z.removeTarget(Y).addTarget(Y.clone());return Z}var La=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function da(Z){let J=Z.getMesh(),$=Z.getMatrix();if(J&&!d0.eq($,La))pB1(J,$);for(let Y of Z.listChildren()){let Q=Y.getMatrix();va(Q,Q,$),Y.setMatrix(Q)}return Z.setMatrix(La)}var{LINES:nB1,LINE_STRIP:aB1,LINE_LOOP:sB1,TRIANGLES:oB1,TRIANGLE_STRIP:rB1,TRIANGLE_FAN:tB1}=R8.Mode;function eB1(Z){let J=Z.getGraph(),$=C6.fromGraph(J);if(!Z.getIndices())LL(Z);let Y=Z.getIndices(),Q=Y.getArray(),W=Ta(Z),K=new GJ[Y.getComponentType()](W*2),G=Z.getMode();if(G===aB1)for(let H=0;H<W;H++)K[H*2]=Q[H],K[H*2+1]=Q[H+1];else if(G===sB1)for(let H=0;H<W;H++)if(H<W-1)K[H*2]=Q[H],K[H*2+1]=Q[H+1];else K[H*2]=Q[H],K[H*2+1]=Q[0];else throw new Error("Only LINE_STRIP and LINE_LOOP may be converted to LINES.");Z.setMode(nB1);let z=$.getRoot();if(Y.listParents().some((H)=>H!==z&&H!==Z))Z.setIndices(HZ($,Y).setArray(K));else Y.setArray(K)}function ca(Z){let J=Z.getGraph(),$=C6.fromGraph(J);if(!Z.getIndices())LL(Z);let Y=Z.getIndices(),Q=Y.getArray(),W=Ta(Z),K=new GJ[Y.getComponentType()](W*3),G=Z.getMode();if(G===rB1)for(let H=0,V=Q.length;H<V-2;H++)if(H%2)K[H*3]=Q[H+1],K[H*3+1]=Q[H],K[H*3+2]=Q[H+2];else K[H*3]=Q[H],K[H*3+1]=Q[H+1],K[H*3+2]=Q[H+2];else if(G===tB1)for(let H=0;H<W;H++)K[H*3]=Q[0],K[H*3+1]=Q[H+1],K[H*3+2]=Q[H+2];else throw new Error("Only TRIANGLE_STRIP and TRIANGLE_FAN may be converted to TRIANGLES.");Z.setMode(oB1);let z=$.getRoot();if(Y.listParents().some((H)=>H!==z&&H!==Z))Z.setIndices(HZ($,Y).setArray(K));else Y.setArray(K)}var wa="dequantize",HL={pattern:/^((?!JOINTS_).)*$/};function la(Z=HL){let J=X7(HL,Z);return MJ(wa,($)=>{let Y=$.getLogger();for(let Q of $.getRoot().listMeshes())for(let W of Q.listPrimitives())ZO1(W,J);$.createExtension(nG).dispose(),Y.debug(`${wa}: Complete.`)})}function ZO1(Z,J=HL){let $=X7(HL,J);for(let Y of Z.listSemantics())if($.pattern.test(Y))bC(Z.getAttribute(Y));for(let Y of Z.listTargets())for(let Q of Y.listSemantics())if($.pattern.test(Q))bC(Y.getAttribute(Q))}function bC(Z){let J=Z.getArray();if(!J)return;let $=VL(J,Z.getComponentType(),Z.getNormalized());Z.setArray($).setNormalized(!1)}function VL(Z,J,$){let Y=new Float32Array(Z.length);for(let Q=0,W=Z.length;Q<W;Q++)if($)Y[Q]=d0.decodeNormalizedInt(Z[Q],J);else Y[Q]=Z[Q];return Y}var{TEXTURE_INFO:pa,ROOT:mH6}=a;function ia(Z){let J=new C6().setLogger(Z.getLogger()),$=cC(J,Z);return JO1(J,Z,$),J.getRoot().copy(Z.getRoot(),$),J}function JO1(Z,J,$){$||($=cC(Z,J));for(let Y of J.getRoot().listExtensionsUsed()){let Q=Z.createExtension(Y.constructor);if(Y.isRequired())Q.setRequired(!0)}return $O1(Z,J,YO1(J),$)}function $O1(Z,J,$,Y){Y||(Y=cC(Z,J));let Q=new Map;for(let W of $)if(!Q.has(W)&&W.propertyType!==pa)Q.set(W,Y(W));for(let[W,X]of Q.entries())X.copy(W,Y);return Q}function cC(Z,J){let $=new Map([[J.getRoot(),Z.getRoot()]]);return(Y)=>{if(Y.propertyType===pa)return Y;let Q=$.get(Y);if(!Q)Q=new Y.constructor(Z.getGraph()),$.set(Y,Q);return Q}}function YO1(Z){let J=new Set;for(let $ of Z.getGraph().listEdges())J.add($.getChild());return Array.from(J)}var SC="flatten",Ba={cleanup:!0};function na(Z=Ba){let J=X7(Ba,Z);return MJ(SC,async($)=>{let Y=$.getRoot(),Q=$.getLogger(),W=new Set;for(let z of Y.listSkins())for(let H of z.listJoints())W.add(H);let X=new Set;for(let z of Y.listAnimations())for(let H of z.listChannels()){let V=H.getTargetNode();if(V&&H.getTargetPath()!=="weights")X.add(V)}let K=new Set,G=new Set;for(let z of Y.listScenes())z.traverse((H)=>{let V=H.getParentNode();if(!V)return;if(W.has(V)||K.has(V))K.add(H);if(X.has(V)||G.has(V))G.add(H)});for(let z of Y.listScenes())z.traverse((H)=>{if(X.has(H))return;if(K.has(H))return;if(G.has(H))return;WB1(H)});if(X.size)Q.debug(`${SC}: Flattening node hierarchies with TRS animation not yet supported.`);if(J.cleanup)await $.transform(UL({propertyTypes:[a.NODE],keepLeaves:!1}));Q.debug(`${SC}: Complete.`)})}function aa(Z){return yP(Z)}var QO1={skipValidation:!1},Oa=4294967295,{LINE_STRIP:WO1,LINE_LOOP:XO1,TRIANGLE_STRIP:KO1,TRIANGLE_FAN:GO1}=R8.Mode;function zO1(Z,J={}){let $=X7(QO1,J),Y=Z[0],Q=C6.fromGraph(Y.getGraph());if(!$.skipValidation&&new Set(Z.map(Ea)).size>1)throw new Error("Requires >=2 Primitives, sharing the same Material and Mode, with compatible vertex attributes and indices.");for(let F of Z)switch(F.getMode()){case WO1:case XO1:eB1(F);break;case KO1:case GO1:ca(F);break}let W=[],X=new Uint32Array(Z.length),K=0,G=0;for(let F=0;F<Z.length;F++){let U=Z[F],w=U.getIndices(),L=U.getAttribute("POSITION").getCount(),O=w?w.getArray():null,j=w?w.getCount():L,M=new Uint32Array(L).fill(Oa);for(let N=0;N<j;N++){let D=O?O[N]:N;if(M[D]===Oa)M[D]=K++,X[F]++}W.push(M),G+=j}let z=Q.createPrimitive().setMode(Y.getMode()).setMaterial(Y.getMaterial());for(let F of Y.listSemantics()){let U=Y.getAttribute(F),w=GJ[U.getComponentType()],L=HZ(Q,U).setArray(new w(K*U.getElementSize()));z.setAttribute(F,L)}let H=Y.getIndices(),V=H?HZ(Q,H).setArray(uC(G,K)):null;z.setIndices(V);let q=0;for(let F=0;F<W.length;F++){let U=Z[F],w=U.getIndices(),L=w?w.getCount():-1,O=W[F];if(w&&V)VO1(w,O,V,q),q+=L;for(let j of z.listSemantics()){let M=U.getAttribute(j),N=z.getAttribute(j);HO1(M,w,O,N)}}return z}function HO1(Z,J,$,Y){let Q=Z.getElementSize(),W=J?J.getArray():null,X=Z.getCount(),K=Z.getArray(),G=Y.getArray(),z=new Uint8Array(Z.getCount());for(let H=0,V=J?J.getCount():X;H<V;H++){let q=W?W[H]:H,F=$[q];if(z[F])continue;for(let U=0;U<Q;U++)G[F*Q+U]=K[q*Q+U];z[F]=1}}function VO1(Z,J,$,Y){let Q=Z.getCount(),W=Z.getArray(),X=$.getArray();for(let K=0;K<Q;K++){let G=W[K],z=J[G];X[Y+K]=z}}var yC="join",{ROOT:qO1,NODE:FO1,MESH:UO1,PRIMITIVE:LO1,ACCESSOR:wO1}=a,_C=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ja={keepMeshes:!1,keepNamed:!1,cleanup:!0};function sa(Z=ja){let J=X7(ja,Z);return MJ(yC,async($)=>{let Y=$.getRoot(),Q=$.getLogger();for(let W of Y.listScenes())Ma($,W,J),W.traverse((X)=>Ma($,X,J));if(J.cleanup)await $.transform(UL({propertyTypes:[FO1,UO1,LO1,wO1],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}));Q.debug(`${yC}: Complete.`)})}function Ma(Z,J,$){let Y=Z.getLogger(),Q={},W=J.listChildren();for(let G=0;G<W.length;G++){let z=W[G];if(z.listParents().some((q)=>q instanceof ZY))continue;let V=z.getMesh();if(!V)continue;if(z.getExtension("EXT_mesh_gpu_instancing"))continue;if(z.getSkin())continue;for(let q of V.listPrimitives()){if(q.listTargets().length>0)continue;let F=q.getMaterial();if(F&&F.getExtension("KHR_materials_volume"))continue;sG(q),OO1(q);let U=Ea(q),w=V.getName()||z.getName();if($.keepMeshes||$.keepNamed&&w)U+=`|${G}`;if(!(U in Q))Q[U]={prims:[],primMeshes:[],primNodes:[],dstNode:z,dstMesh:void 0};let L=Q[U];L.prims.push(q),L.primNodes.push(z)}}let X=Object.values(Q).filter(({prims:G})=>G.length>1),K=new Set(X.flatMap((G)=>G.primNodes));for(let G of K){let z=G.getMesh();if(z.listParents().some((V)=>{return V.propertyType!==qO1&&G!==V}))G.setMesh(z.clone())}for(let G of X){let{dstNode:z,primNodes:H}=G;G.dstMesh=z.getMesh(),G.primMeshes=H.map((V)=>V.getMesh())}for(let G of X){let{prims:z,primNodes:H,primMeshes:V,dstNode:q,dstMesh:F}=G,U=q.getMatrix();for(let O=0;O<z.length;O++){let j=H[O],M=V[O],N=z[O];if(M.removePrimitive(N),JB1(N))N=z[O]=BO1(z[O]);if(j!==q)va(_C,XB1(_C,U),j.getMatrix()),ua(N,_C)}let w=zO1(z),L=w.listAttributes()[0].getCount();F.addPrimitive(w),Y.debug(`${yC}: Joined Primitives (${z.length}) containing ${AC(L)} vertices under Node "${q.getName()}".`)}}function BO1(Z){let J=Z.clone();for(let Y of J.listSemantics())J.setAttribute(Y,J.getAttribute(Y).clone());let $=J.getIndices();if($)J.setIndices($.clone());return J}function OO1(Z){for(let J of["POSITION","NORMAL","TANGENT"]){let $=Z.getAttribute(J);if($)bC($)}}var{TRANSLATION:uH6,ROTATION:dH6,SCALE:cH6,WEIGHTS:lH6}=ZY.TargetPath;var jO1={pattern:/.*/,quantizationVolume:"mesh",quantizePosition:14,quantizeNormal:10,quantizeTexcoord:12,quantizeColor:8,quantizeWeight:8,quantizeGeneric:12,normalizeWeights:!0,cleanup:!0};var pH6=WX({level:"high"},jO1);var MO1="unweld";function RO1(Z,J=new Map){let $=Z.getIndices();if(!$)return;let Y=Z.getGraph(),Q=C6.fromGraph(Y),W=Q.getLogger(),X=Z.getAttribute("POSITION").getCount();for(let G of Z.listAttributes())if(Z.swap(G,Ra(Q,G,$,J)),G.listParents().length===1)G.dispose();for(let G of Z.listTargets())for(let z of G.listAttributes())if(G.swap(z,Ra(Q,z,$,J)),z.listParents().length===1)z.dispose();let K=Z.getAttribute("POSITION").getCount();if(W.debug(`${MO1}: ${qL(X,K)} vertices.`),Z.setIndices(null),$.listParents().length===1)$.dispose()}function Ra(Z,J,$,Y){if(Y.has(J)&&Y.get(J).has($))return Y.get(J).get($);let Q=J.getArray(),X=new Q.constructor($.getCount()*J.getElementSize()),K=$.getArray(),G=J.getElementSize();for(let H=0,V=$.getCount();H<V;H++)for(let q=0;q<G;q++)X[H*G+q]=Q[K[H]*G+q];if(!Y.has(J))Y.set(J,new Map);let z=HZ(Z,J).setArray(X);return Y.get(J).set($,z),z}var Na;(function(Z){Z[Z.STEP=0]="STEP",Z[Z.LERP=1]="LERP",Z[Z.SLERP=2]="SLERP"})(Na||(Na={}));var NO1=0.000001;function PO1(Z,J,$,Y=0.0001){let Q=J.length/Z.length,W=new Array(Q).fill(0),X=new Array(Q).fill(0),K=new Array(Q).fill(0),G=new Array(Q).fill(0),z=Z.length-1,H=1;for(let V=1;V<z;++V){let q=Z[H-1],F=Z[V],U=Z[V+1],w=(F-q)/(U-q),L=!1;if(F!==U&&(V!==1||F!==Z[0])){if(aG(J,H-1,G),aG(J,V,X),aG(J,V+1,K),$==="slerp"){let O=TO1(W,G,K,w),j=Da(G,X)+Da(X,K);L=!GL(X,O,Y)||j+Number.EPSILON>=Math.PI}else if($==="lerp"){let O=CO1(W,G,K,w);L=!GL(X,O,Y)}else if($==="step")L=!GL(X,G)||!GL(X,K)}if(L){if(V!==H)Z[H]=Z[V],Pa(J,H,aG(J,V,W));H++}}if(z>0)Z[H]=Z[z],Pa(J,H,aG(J,z,W)),H++;return H}function aG(Z,J,$){for(let Y=0,Q=$.length;Y<Q;Y++)$[Y]=Z[J*Q+Y];return $}function Pa(Z,J,$){for(let Y=0,Q=$.length;Y<Q;Y++)Z[J*Q+Y]=$[Y]}function GL(Z,J,$=0){if(Z.length!==J.length)return!1;for(let Y=0;Y<Z.length;Y++)if(Math.abs(Z[Y]-J[Y])>$)return!1;return!0}function DO1(Z,J,$){return Z*(1-$)+J*$}function CO1(Z,J,$,Y){for(let Q=0;Q<J.length;Q++)Z[Q]=DO1(J[Q],$[Q],Y);return Z}function TO1(Z,J,$,Y){let Q=J[0],W=J[1],X=J[2],K=J[3],G=$[0],z=$[1],H=$[2],V=$[3],q,F,U,w,L;if(F=Q*G+W*z+X*H+K*V,F<0)F=-F,G=-G,z=-z,H=-H,V=-V;if(1-F>NO1)q=Math.acos(F),U=Math.sin(q),w=Math.sin((1-Y)*q)/U,L=Math.sin(Y*q)/U;else w=1-Y,L=Y;return Z[0]=w*Q+L*G,Z[1]=w*W+L*z,Z[2]=w*X+L*H,Z[3]=w*K+L*V,Z}function Da(Z,J){let $=kO1(Z,J);return Math.acos(2*$*$-1)}function kO1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}var iH6=new Float32Array(0),nH6={ready:Promise.resolve(),resample:PO1,tolerance:0.0001,cleanup:!0};var PY="simplify",{POINTS:oa,LINES:EO1,LINE_STRIP:IO1,LINE_LOOP:vO1,TRIANGLES:SO1,TRIANGLE_STRIP:ra,TRIANGLE_FAN:ta}=R8.Mode,ea={ratio:0,error:0.0001,lockBorder:!1,cleanup:!0};function Zs(Z){let J=X7(ea,Z),$=J.simplifier;if(!$)throw new Error(`${PY}: simplifier dependency required \u2014 install "meshoptimizer".`);return MJ(PY,async(Y)=>{let Q=Y.getLogger();await $.ready,await Y.transform(dC({overwrite:!1,cleanup:J.cleanup}));let W=0;for(let X of Y.getRoot().listMeshes()){for(let K of X.listPrimitives()){let G=K.getMode();if(G===SO1||G===ra||G===ta){if(Ca(K,J),jJ(K,w6.RENDER)===0)K.dispose()}else if(K.getMode()===oa&&!!$.simplifyPoints){if(Ca(K,J),jJ(K,w6.RENDER)===0)K.dispose()}else W++}if(X.listPrimitives().length===0)X.dispose()}if(W>0)Q.warn(`${PY}: Skipping simplification of ${W} primitives: Unsupported draw mode.`);if(J.cleanup)await Y.transform(UL({propertyTypes:[a.ACCESSOR,a.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),_a({propertyTypes:[a.ACCESSOR]}));Q.debug(`${PY}: Complete.`)})}function Ca(Z,J){let $=WX({},ea,J),Y=$.simplifier,Q=Z.getGraph(),W=C6.fromGraph(Q),X=W.getLogger();switch(Z.getMode()){case oa:return _O1(W,Z,$);case EO1:case IO1:case vO1:return X.warn(`${PY}: Skipping primitive simplification: Unsupported draw mode.`),Z;case ra:case ta:ca(Z);break}let K=jJ(Z,w6.UPLOAD),G=jJ(Z,w6.RENDER);if(G<K/2)sG(Z);let z=Z.getAttribute("POSITION"),H=Z.getIndices(),V=z.getArray(),q=H.getArray();if(!(V instanceof Float32Array))V=VL(V,z.getComponentType(),z.getNormalized());if(!(q instanceof Uint32Array))q=new Uint32Array(q);let F=Math.floor($.ratio*G/3)*3,U=$.lockBorder?["LockBorder"]:[],[w,L]=Y.simplify(q,V,3,F,$.error,U);if(Z.setIndices(HZ(W,H).setArray(w)),H.listParents().length===1)H.dispose();sG(Z);let O=jJ(Z,w6.UPLOAD);if(O<=65534)Z.getIndices().setArray(new Uint16Array(Z.getIndices().getArray()));return X.debug(`${PY}: ${qL(K,O)} vertices, error: ${L.toFixed(4)}.`),Z}function _O1(Z,J,$){let Y=$.simplifier,Q=Z.getLogger();if(J.getIndices())RO1(J);let X=J.getAttribute("POSITION"),K=J.getAttribute("COLOR_0"),G=X.getCount(),z=X.getArray(),H=K?K.getArray():void 0,V=K?K.getComponentSize():void 0;if(!(z instanceof Float32Array))z=VL(z,X.getComponentType(),X.getNormalized());if(H&&!(H instanceof Float32Array))H=VL(H,X.getComponentType(),X.getNormalized());Y.useExperimentalFeatures=!0;let q=Math.floor($.ratio*G),F=Y.simplifyPoints(z,3,q,H,V);Y.useExperimentalFeatures=!1;let[U,w]=Y.compactMesh(F);Q.debug(`${PY}: ${qL(X.getCount(),w)} vertices.`);for(let L of mC(J)){let O=HZ(Z,L);if(hC(L,null,U,O,w),tw1(J,L,O),L.listParents().length===1)L.dispose()}return J}var gC;(function(Z){Z.LANCZOS3="lanczos3",Z.LANCZOS2="lanczos2"})(gC||(gC={}));var aH6={resizeFilter:gC.LANCZOS3,pattern:void 0,formats:void 0,slots:void 0,quality:void 0,effort:void 0,lossless:!1,nearLossless:!1,limitInputPixels:!0};var oH6=function(){var Z="b9H79TebbbeJq9Geueu9Geub9Gbb9Gvuuuuueu9Gduueu9Gluuuueu9Gvuuuuub9Gouuuuuub9Gluuuub9GiuuueuiKLdilevlevlooroowwvwbDDbelve9Weiiviebeoweuec:G:Qdkr;RiOo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949c919M9MWVbe8F9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949c919M9MWV9c9V919U9KbdE9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949wWV79P9V9UbiY9TW79O9V9Wt9FW9U9J9V9KW69U9KW949c919M9MWVbl8E9TW79O9V9Wt9FW9U9J9V9KW69U9KW949c919M9MWV9c9V919U9Kbv8A9TW79O9V9Wt9FW9U9J9V9KW69U9KW949wWV79P9V9UboE9TW79O9V9Wt9FW9U9J9V9KW69U9KW949tWG91W9U9JWbra9TW79O9V9Wt9FW9U9J9V9KW69U9KW949tWG91W9U9JW9c9V919U9KbwL9TW79O9V9Wt9FW9U9J9V9KWS9P2tWV9p9JtbDK9TW79O9V9Wt9FW9U9J9V9KWS9P2tWV9r919HtbqL9TW79O9V9Wt9FW9U9J9V9KWS9P2tWVT949WbkE9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94J9H9J9OWbPa9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94J9H9J9OW9ttV9P9Wbsa9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94SWt9J9O9sW9T9H9WbzK9TW79O9V9Wt9F79W9Ht9P9H29t9VVt9sW9T9H9WbHl79IV9RbODwebcekdQXq;A9pLdbk;QqeKu8Jjjjjbcjo9Rgv8Kjjjjbcbhodnalcefae0mbabcbRbN:kjjbc:GeV86bbavcjdfcbcjdzNjjjb8AdnaiTmbavcjdfadalz:tjjjb8Akabaefhrabcefhwavalfcbcbcjdal9RalcFe0EzNjjjb8Aavavcjdfalz:tjjjbhDcj;abal9Uc;WFbGgecjdaecjd6Ehqcbhkindndnaiak9nmbaDcjlfcbcjdzNjjjb8Aaqaiak9Rakaqfai6Egxcsfgecl4cifcd4hmadakal2fhPdndndnaec9WGgsTmbcbhzaPhHawhOxekdnaxmbalheinaraw9Ram6miawcbamzNjjjbamfhwaecufgembxvkkcbhAaPhOinaDaAfRbbhCaDcjlfheaOhoaxhXinaeaoRbbgQaC9RgCcetaCcKtcK91cr4786bbaoalfhoaecefheaQhCaXcufgXmbkaraw9Ram6mdaOcefhOawcbamzNjjjbamfhwaAcefgAal9hmbxlkkindnaxTmbaDazfRbbhCaDcjlfheaHhoaxhXinaeaoRbbgQaC9RgCcetaCcKtcK91cr4786bbaoalfhoaecefheaQhCaXcufgXmbkkaraO9Ram6mearaOcbamzNjjjbgLamfgw9RcK6mecbhKaDcjlfhOinaDcjlfaKfhYcwhAczhQceheindndnaegXce9hmbcuhoaYRbbmecbhodninaogecsSmeaecefhoaOaefcefRbbTmbkkcucbaecs6EhoxekaXcethocuaXtc;:bGcFb7hCcbheinaoaCaOaefRbb9nfhoaecefgecz9hmbkkaoaQaoaQ6geEhQaXaAaeEhAaXcetheaXcl6mbkdndndndnaAcufPdiebkaLaKco4fgeaeRbbcdciaAclSEaKci4coGtV86bbaAcw9hmeawaY8Pbb83bbawcwfaYcwf8Pbb83bbawczfhwxdkaLaKco4fgeaeRbbceaKci4coGtV86bbkdncwaA9Tg8Ambinawcb86bbawcefhwxbkkcuaAtcu7hYcbhEaOh3ina3hea8AhCcbhoinaeRbbgQaYcFeGgXaQaX6EaoaAtVhoaecefheaCcufgCmbkawao86bba3a8Afh3awcefhwaEa8AfgEcz6mbkcbheindnaOaefRbbgoaX6mbawao86bbawcefhwkaecefgecz9hmbkkdnaKczfgKas9pmbaOczfhOaraw9RcL0mekkaKas6meawTmeaHcefhHawhOazcefgzalSmixbkkcbhoxikcbhoaraw9Ralcaalca0E6mddnalc8F0mbawcbcaal9RgezNjjjbaefhwkawaDcjdfalz:tjjjbalfab9RhoxdkaDaPaxcufal2falz:tjjjb8Aaxakfhkawmbkcbhokavcjof8Kjjjjbaok9heeuaecaaeca0Eabcj;abae9Uc;WFbGgdcjdadcjd6Egdfcufad9Uae2adcl4cifcd4adV2fcefkmbcbabBdN:kjjbk:zse5u8Jjjjjbc;ae9Rgl8Kjjjjbcbhvdnaici9UgocHfae0mbabcbyd:e:kjjbgrc;GeV86bbalc;abfcFecjezNjjjb8AalcUfgw9cu83ibalc8WfgD9cu83ibalcyfgq9cu83ibalcafgk9cu83ibalcKfgx9cu83ibalczfgm9cu83ibal9cu83iwal9cu83ibabaefc9WfhPabcefgsaofhednaiTmbcmcsarcb9kgzEhHcbhOcbhAcbhCcbhXcbhQindnaeaP9nmbcbhvxikaQcufhvadaCcdtfgLydbhKaLcwfydbhYaLclfydbh8AcbhEdndndninalc;abfavcsGcitfgoydlh3dndndnaoydbgoaK9hmba3a8ASmekdnaoa8A9hmba3aY9hmbaEcefhExekaoaY9hmea3aK9hmeaEcdfhEkaEc870mdaXcufhvaLaEciGcx2goc:y1jjbfydbcdtfydbh3aLaocN1jjbfydbcdtfydbh8AaLaoc:q1jjbfydbcdtfydbhKcbhodnindnalavcsGcdtfydba39hmbaohYxdkcuhYavcufhvaocefgocz9hmbkkaOa3aOSgvaYce9iaYaH9oVgoGfhOdndndncbcsavEaYaoEgvcs9hmbarce9imba3a3aAa3cefaASgvEgAcefSmecmcsavEhvkasavaEcdtc;WeGV86bbavcs9hmea3aA9Rgvcetavc8F917hvinaeavcFb0crtavcFbGV86bbaecefheavcje6hoavcr4hvaoTmbka3hAxvkcPhvasaEcdtcPV86bba3hAkavTmiavaH9omicdhocehEaQhYxlkavcufhvaEclfgEc;ab9hmbkkdnaLceaYaOSceta8AaOSEcx2gvc:q1jjbfydbcdtfydbgKTaLavcN1jjbfydbcdtfydbg8AceSGaLavc:y1jjbfydbcdtfydbg3cdSGaOcb9hGazGg5ce9hmbaw9cu83ibaD9cu83ibaq9cu83ibak9cu83ibax9cu83ibam9cu83ibal9cu83iwal9cu83ibcbhOkcbhEaXcufgvhodnindnalaocsGcdtfydba8A9hmbaEhYxdkcuhYaocufhoaEcefgEcz9hmbkkcbhodnindnalavcsGcdtfydba39hmbaohExdkcuhEavcufhvaocefgocz9hmbkkaOaKaOSg8EfhLdndnaYcm0mbaYcefhYxekcbcsa8AaLSgvEhYaLavfhLkdndnaEcm0mbaEcefhExekcbcsa3aLSgvEhEaLavfhLkc9:cua8EEh8FcbhvaEaYcltVgacFeGhodndndninavcj1jjbfRbbaoSmeavcefgvcz9hmbxdkka5aKaO9havcm0VVmbasavc;WeV86bbxekasa8F86bbaeaa86bbaecefhekdna8EmbaKaA9Rgvcetavc8F917hvinaeavcFb0gocrtavcFbGV86bbavcr4hvaecefheaombkaKhAkdnaYcs9hmba8AaA9Rgvcetavc8F917hvinaeavcFb0gocrtavcFbGV86bbavcr4hvaecefheaombka8AhAkdnaEcs9hmba3aA9Rgvcetavc8F917hvinaeavcFb0gocrtavcFbGV86bbavcr4hvaecefheaombka3hAkalaXcdtfaKBdbaXcefcsGhvdndnaYPzbeeeeeeeeeeeeeebekalavcdtfa8ABdbaXcdfcsGhvkdndnaEPzbeeeeeeeeeeeeeebekalavcdtfa3BdbavcefcsGhvkcihoalc;abfaQcitfgEaKBdlaEa8ABdbaQcefcsGhYcdhEavhXaLhOxekcdhoalaXcdtfa3BdbcehEaXcefcsGhXaQhYkalc;abfaYcitfgva8ABdlava3Bdbalc;abfaQaEfcsGcitfgva3BdlavaKBdbascefhsaQaofcsGhQaCcifgCai6mbkkcbhvaeaP0mbcbhvinaeavfavcj1jjbfRbb86bbavcefgvcz9hmbkaeab9Ravfhvkalc;aef8KjjjjbavkZeeucbhddninadcefgdc8F0meceadtae6mbkkadcrfcFeGcr9Uci2cdfabci9U2cHfkmbcbabBd:e:kjjbk:ydewu8Jjjjjbcz9Rhlcbhvdnaicvfae0mbcbhvabcbRb:e:kjjbc;qeV86bbal9cb83iwabcefhoabaefc98fhrdnaiTmbcbhwcbhDindnaoar6mbcbskadaDcdtfydbgqalcwfawaqav9Rgvavc8F91gv7av9Rc507gwcdtfgkydb9Rgvc8E91c9:Gavcdt7awVhvinaoavcFb0gecrtavcFbGV86bbavcr4hvaocefhoaembkakaqBdbaqhvaDcefgDai9hmbkkcbhvaoar0mbaocbBbbaoab9RclfhvkavkBeeucbhddninadcefgdc8F0meceadtae6mbkkadcwfcFeGcr9Uab2cvfk:bvli99dui99ludnaeTmbcuadcetcuftcu7:Yhvdndncuaicuftcu7:YgoJbbbZMgr:lJbbb9p9DTmbar:Ohwxekcjjjj94hwkcbhicbhDinalclfIdbgrJbbbbJbbjZalIdbgq:lar:lMalcwfIdbgk:lMgr:varJbbbb9BEgrNhxaqarNhrdndnakJbbbb9GTmbaxhqxekJbbjZar:l:tgqaq:maxJbbbb9GEhqJbbjZax:l:tgxax:marJbbbb9GEhrkdndnalcxfIdbgxJbbj:;axJbbj:;9GEgkJbbjZakJbbjZ9FEavNJbbbZJbbb:;axJbbbb9GEMgx:lJbbb9p9DTmbax:Ohmxekcjjjj94hmkdndnaqJbbj:;aqJbbj:;9GEgxJbbjZaxJbbjZ9FEaoNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:OhPxekcjjjj94hPkdndnarJbbj:;arJbbj:;9GEgqJbbjZaqJbbjZ9FEaoNJbbbZJbbb:;arJbbbb9GEMgr:lJbbb9p9DTmbar:Ohsxekcjjjj94hskdndnadcl9hmbabaifgzas86bbazcifam86bbazcdfaw86bbazcefaP86bbxekabaDfgzas87ebazcofam87ebazclfaw87ebazcdfaP87ebkalczfhlaiclfhiaDcwfhDaecufgembkkk;hlld99eud99eudnaeTmbdndncuaicuftcu7:YgvJbbbZMgo:lJbbb9p9DTmbao:Ohixekcjjjj94hikaic;8FiGhrinabcofcicdalclfIdb:lalIdb:l9EgialcwfIdb:lalaicdtfIdb:l9EEgialcxfIdb:lalaicdtfIdb:l9EEgiarV87ebdndnJbbj:;JbbjZalaicdtfIdbJbbbb9DEgoalaicd7cdtfIdbJ;Zl:1ZNNgwJbbj:;awJbbj:;9GEgDJbbjZaDJbbjZ9FEavNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohqxekcjjjj94hqkabcdfaq87ebdndnalaicefciGcdtfIdbJ;Zl:1ZNaoNgwJbbj:;awJbbj:;9GEgDJbbjZaDJbbjZ9FEavNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohqxekcjjjj94hqkabaq87ebdndnaoalaicufciGcdtfIdbJ;Zl:1ZNNgoJbbj:;aoJbbj:;9GEgwJbbjZawJbbjZ9FEavNJbbbZJbbb:;aoJbbbb9GEMgo:lJbbb9p9DTmbao:Ohixekcjjjj94hikabclfai87ebabcwfhbalczfhlaecufgembkkk;3viDue99eu8Jjjjjbcjd9Rgo8Kjjjjbadcd4hrdndndndnavcd9hmbadcl6meaohwarhDinawc:CuBdbawclfhwaDcufgDmbkaeTmiadcl6mdarcdthqalhkcbhxinaohwakhDarhminawawydbgPcbaDIdbgs:8cL4cFeGc:cufasJbbbb9BEgzaPaz9kEBdbaDclfhDawclfhwamcufgmmbkakaqfhkaxcefgxaeSmixbkkaeTmdxekaeTmekarcdthkavce9hhqadcl6hdcbhxindndndnaqmbadmdc:CuhDalhwarhminaDcbawIdbgs:8cL4cFeGc:cufasJbbbb9BEgPaDaP9kEhDawclfhwamcufgmmbxdkkc:CuhDdndnavPleddbdkadmdaohwalhmarhPinawcbamIdbgs:8cL4cFeGgzc;:bazc;:b9kEc:cufasJbbbb9BEBdbamclfhmawclfhwaPcufgPmbxdkkadmecbhwarhminaoawfcbalawfIdbgs:8cL4cFeGgPc8AaPc8A9kEc:cufasJbbbb9BEBdbawclfhwamcufgmmbkkadmbcbhwarhPinaDhmdnavceSmbaoawfydbhmkdndnalawfIdbgscjjj;8iamai9RcefgmcLt9R::NJbbbZJbbb:;asJbbbb9GEMgs:lJbbb9p9DTmbas:Ohzxekcjjjj94hzkabawfazcFFFrGamcKtVBdbawclfhwaPcufgPmbkkabakfhbalakfhlaxcefgxae9hmbkkaocjdf8Kjjjjbk;HqdCui998Jjjjjbc:qd9Rgv8Kjjjjbavc:Sefcbc;KbzNjjjb8AcbhodnadTmbcbhoaiTmbdnabae9hmbavcuadcdtgradcFFFFi0Ecbyd:m:kjjbHjjjjbbgeBd:SeavceBd:mdaeabarz:tjjjb8Akavc:GefcwfcbBdbav9cb83i:Geavc:Gefaeadaiavc:Sefz:njjjbavyd:Gehwadci9UgDcbyd:m:kjjbHjjjjbbhravc:Sefavyd:mdgqcdtfarBdbavaqcefgkBd:mdarcbaDzNjjjbhxavc:SefakcdtfcuaicdtaicFFFFi0Ecbyd:m:kjjbHjjjjbbgmBdbavaqcdfgPBd:mdawhramhkinakalIdbalarydbgscwascw6Ecdtfc;ebfIdbMUdbarclfhrakclfhkaicufgimbkavc:SefaPcdtfcuaDcdtadcFFFF970Ecbyd:m:kjjbHjjjjbbgPBdbdnadci6mbaehraPhkaDhiinakamarydbcdtfIdbamarclfydbcdtfIdbMamarcwfydbcdtfIdbMUdbarcxfhrakclfhkaicufgimbkkaqcifhoavc;qbfhzavhravyd:KehHavyd:OehOcbhscbhkcbhAcehCinarhXcihQaeakci2gLcdtfgrydbhdarclfydbhqabaAcx2fgicwfarcwfydbgKBdbaiclfaqBdbaiadBdbaxakfce86bbazaKBdwazaqBdlazadBdbaPakcdtfcbBdbdnasTmbcihQaXhiinazaQcdtfaiydbgrBdbaQaraK9harad9haraq9hGGfhQaiclfhiascufgsmbkkaAcefhAcbhsinaOaHaeasaLfcdtfydbcdtgifydbcdtfgKhrawaifgqydbgdhidnadTmbdninarydbakSmearclfhraicufgiTmdxbkkaraKadcdtfc98fydbBdbaqaqydbcufBdbkascefgsci9hmbkdndnaQTmbcuhkJbbbbhYcbhqavyd:KehKavyd:OehLindndnawazaqcdtfydbcdtgsfydbgrmbaqcefhqxekaqcs0hiamasfgdIdbh8AadalcbaqcefgqaiEcdtfIdbalarcwarcw6Ecdtfc;ebfIdbMgEUdbaEa8A:thEarcdthiaLaKasfydbcdtfhrinaParydbgscdtfgdaEadIdbMg8AUdba8AaYaYa8A9DgdEhYasakadEhkarclfhraic98fgimbkkaqaQ9hmbkakcu9hmekaCaD9pmdindnaxaCfRbbmbaChkxdkaDaCcefgC9hmbxikkaQczaQcz6EhsazhraXhzakcu9hmbkkaocdtavc:Seffc98fhrdninaoTmearydbcbyd1:kjjbH:bjjjbbarc98fhraocufhoxbkkavc:qdf8Kjjjjbk;IlevucuaicdtgvaicFFFFi0Egocbyd:m:kjjbHjjjjbbhralalyd9GgwcdtfarBdbalawcefBd9GabarBdbaocbyd:m:kjjbHjjjjbbhralalyd9GgocdtfarBdbalaocefBd9GabarBdlcuadcdtadcFFFFi0Ecbyd:m:kjjbHjjjjbbhralalyd9GgocdtfarBdbalaocefBd9GabarBdwabydbcbavzNjjjb8Aadci9UhDdnadTmbabydbhoaehladhrinaoalydbcdtfgvavydbcefBdbalclfhlarcufgrmbkkdnaiTmbabydbhlabydlhrcbhvaihoinaravBdbarclfhralydbavfhvalclfhlaocufgombkkdnadci6mbabydlhrabydwhvcbhlinaecwfydbhoaeclfydbhdaraeydbcdtfgwawydbgwcefBdbavawcdtfalBdbaradcdtfgdadydbgdcefBdbavadcdtfalBdbaraocdtfgoaoydbgocefBdbavaocdtfalBdbaecxfheaDalcefgl9hmbkkdnaiTmbabydlheabydbhlinaeaeydbalydb9RBdbalclfhlaeclfheaicufgimbkkkQbabaeadaic:01jjbz:mjjjbkQbabaeadaic:C:jjjbz:mjjjbk9DeeuabcFeaicdtzNjjjbhlcbhbdnadTmbindnalaeydbcdtfgiydbcu9hmbaiabBdbabcefhbkaeclfheadcufgdmbkkabk;Wkivuo99lu8Jjjjjbc;W;Gb9Rgl8Kjjjjbcbhvalcj;Gbfcbc;KbzNjjjb8AalcuadcdtadcFFFFi0Egocbyd:m:kjjbHjjjjbbgrBdj9GalceBd;G9GalcFFF;7rBdwal9cFFF;7;3FF:;Fb83dbalcFFF97Bd;S9Gal9cFFF;7FFF:;u83d;K9Gaicd4hwdndnadmbJFFuFhDJFFuuhqJFFuuhkJFFuFhxJFFuuhmJFFuFhPxekawcdthsaehzincbhiinalaifgHazaifIdbgDaHIdbgxaxaD9EEUdbalc;K;GbfaifgHaDaHIdbgxaxaD9DEUdbaiclfgicx9hmbkazasfhzavcefgvad9hmbkalIdwhqalId;S9GhDalIdlhkalId;O9GhxalIdbhmalId;K9GhPkdndnadTmbJbbbbJbbjZJbbbbaPam:tgPaPJbbbb9DEgPaxak:tgxaxaP9DEgxaDaq:tgDaDax9DEgD:vaDJbbbb9BEhDawcdthsarhHadhzindndnaDaeIdbam:tNJb;au9eNJbbbZMgx:lJbbb9p9DTmbax:Ohixekcjjjj94hikaicztaicwtcj;GiGVaicsGVc:p;G:dKGcH2c;d;H:WKGcv2c;j:KM;jbGhvdndnaDaeclfIdbak:tNJb;au9eNJbbbZMgx:lJbbb9p9DTmbax:Ohixekcjjjj94hikaicztaicwtcj;GiGVaicsGVc:p;G:dKGcH2c;d;H:WKGcq2cM;j:KMeGavVhvdndnaDaecwfIdbaq:tNJb;au9eNJbbbZMgx:lJbbb9p9DTmbax:Ohixekcjjjj94hikaHavaicztaicwtcj;GiGVaicsGVc:p;G:dKGcH2c;d;H:WKGcC2c:KM;j:KdGVBdbaeasfheaHclfhHazcufgzmbkalcbcj;GbzNjjjbhiarhHadheinaiaHydbgzcFrGcx2fgvavydbcefBdbaiazcq4cFrGcx2fgvavydlcefBdlaiazcC4cFrGcx2fgzazydwcefBdwaHclfhHaecufgembxdkkalcbcj;GbzNjjjb8AkcbhHcbhzcbhecbhvinalaHfgiydbhsaiazBdbaicwfgwydbhOawavBdbaiclfgiydbhwaiaeBdbasazfhzaOavfhvawaefheaHcxfgHcj;Gb9hmbkcbhHalaocbyd:m:kjjbHjjjjbbgiBd:e9GdnadTmbabhzinazaHBdbazclfhzadaHcefgH9hmbkabhHadhzinalaraHydbgecdtfydbcFrGcx2fgvavydbgvcefBdbaiavcdtfaeBdbaHclfhHazcufgzmbkaihHadhzinalaraHydbgecdtfydbcq4cFrGcx2fgvavydlgvcefBdlabavcdtfaeBdbaHclfhHazcufgzmbkabhHadhzinalaraHydbgecdtfydbcC4cFrGcx2fgvavydwgvcefBdwaiavcdtfaeBdbaHclfhHazcufgzmbkcbhHinabaiydbcdtfaHBdbaiclfhiadaHcefgH9hmbkkclhidninaic98Smealcj;Gbfaifydbcbyd1:kjjbH:bjjjbbaic98fhixbkkalc;W;Gbf8Kjjjjbk9teiucbcbyd:q:kjjbgeabcifc98GfgbBd:q:kjjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabk9teiucbcbyd:q:kjjbgeabcrfc94GfgbBd:q:kjjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik9:eiuZbhedndncbyd:q:kjjbgdaecztgi9nmbcuheadai9RcFFifcz4nbcuSmekadhekcbabae9Rcifc98Gcbyd:q:kjjbfgdBd:q:kjjbdnadZbcztge9nmbadae9RcFFifcz4nb8Akkk:Iddbcjwk:edb4:h9w9N94:P:gW:j9O:ye9Pbbbbbbebbbdbbbebbbdbbbbbbbdbbbbbbbebbbbbbb:l29hZ;69:9kZ;N;76Z;rg97Z;z;o9xZ8J;B85Z;:;u9yZ;b;k9HZ:2;Z9DZ9e:l9mZ59A8KZ:r;T3Z:A:zYZ79OHZ;j4::8::Y:D9V8:bbbb9s:49:Z8R:hBZ9M9M;M8:L;z;o8:;8:PG89q;x:J878R:hQ8::M:B;e87bbbbbbjZbbjZbbjZ:E;V;N8::Y:DsZ9i;H;68:xd;R8:;h0838:;W:NoZbbbb:WV9O8:uf888:9i;H;68:9c9G;L89;n;m9m89;D8Ko8:bbbbf:8tZ9m836ZS:2AZL;zPZZ818EZ9e:lxZ;U98F8:819E;68:bc:eqkzebbbebbbdbbba:vbb",J=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!=="object")return{supported:!1};var $,Y=WebAssembly.instantiate(Q(Z),{}).then(function(F){$=F.instance,$.exports.__wasm_call_ctors(),$.exports.meshopt_encodeVertexVersion(0),$.exports.meshopt_encodeIndexVersion(1)});function Q(F){var U=new Uint8Array(F.length);for(var w=0;w<F.length;++w){var L=F.charCodeAt(w);U[w]=L>96?L-97:L>64?L-39:L+4}var O=0;for(var w=0;w<F.length;++w)U[O++]=U[w]<60?J[U[w]]:(U[w]-60)*64+U[++w];return U.buffer.slice(0,O)}function W(F){if(!F)throw new Error("Assertion failed")}function X(F){return new Uint8Array(F.buffer,F.byteOffset,F.byteLength)}function K(F,U,w,L){var O=$.exports.sbrk,j=O(U.length*4),M=O(w*4),N=new Uint8Array($.exports.memory.buffer),D=X(U);if(N.set(D,j),L)L(j,j,U.length,w);var P=F(M,j,U.length,w);N=new Uint8Array($.exports.memory.buffer);var C=new Uint32Array(w);new Uint8Array(C.buffer).set(N.subarray(M,M+w*4)),D.set(N.subarray(j,j+U.length*4)),O(j-O(0));for(var T=0;T<U.length;++T)U[T]=C[U[T]];return[C,P]}function G(F,U,w,L){var O=$.exports.sbrk,j=O(w*4),M=O(w*L),N=new Uint8Array($.exports.memory.buffer);N.set(X(U),M),F(j,M,w,L),N=new Uint8Array($.exports.memory.buffer);var D=new Uint32Array(w);return new Uint8Array(D.buffer).set(N.subarray(j,j+w*4)),O(j-O(0)),D}function z(F,U,w,L,O){var j=$.exports.sbrk,M=j(U),N=j(L*O),D=new Uint8Array($.exports.memory.buffer);D.set(X(w),N);var P=F(M,U,N,L,O),C=new Uint8Array(P);return C.set(D.subarray(M,M+P)),j(M-j(0)),C}function H(F){var U=0;for(var w=0;w<F.length;++w){var L=F[w];U=U<L?L:U}return U}function V(F,U){if(W(U==2||U==4),U==4)return new Uint32Array(F.buffer,F.byteOffset,F.byteLength/4);else{var w=new Uint16Array(F.buffer,F.byteOffset,F.byteLength/2);return new Uint32Array(w)}}function q(F,U,w,L,O,j,M){var N=$.exports.sbrk,D=N(w*L),P=N(w*j),C=new Uint8Array($.exports.memory.buffer);C.set(X(U),P),F(D,w,L,O,P,M);var T=new Uint8Array(w*L);return T.set(C.subarray(D,D+w*L)),N(D-N(0)),T}return{ready:Y,supported:!0,reorderMesh:function(F,U,w){var L=U?w?$.exports.meshopt_optimizeVertexCacheStrip:$.exports.meshopt_optimizeVertexCache:void 0;return K($.exports.meshopt_optimizeVertexFetchRemap,F,H(F)+1,L)},reorderPoints:function(F,U){return W(F instanceof Float32Array),W(F.length%U==0),W(U>=3),G($.exports.meshopt_spatialSortRemap,F,F.length/U,U*4)},encodeVertexBuffer:function(F,U,w){W(w>0&&w<=256),W(w%4==0);var L=$.exports.meshopt_encodeVertexBufferBound(U,w);return z($.exports.meshopt_encodeVertexBuffer,L,F,U,w)},encodeIndexBuffer:function(F,U,w){W(w==2||w==4),W(U%3==0);var L=V(F,w),O=$.exports.meshopt_encodeIndexBufferBound(U,H(L)+1);return z($.exports.meshopt_encodeIndexBuffer,O,L,U,4)},encodeIndexSequence:function(F,U,w){W(w==2||w==4);var L=V(F,w),O=$.exports.meshopt_encodeIndexSequenceBound(U,H(L)+1);return z($.exports.meshopt_encodeIndexSequence,O,L,U,4)},encodeGltfBuffer:function(F,U,w,L){var O={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return W(O[L]),O[L](F,U,w)},encodeFilterOct:function(F,U,w,L){return W(w==4||w==8),W(L>=1&&L<=16),q($.exports.meshopt_encodeFilterOct,F,U,w,L,16)},encodeFilterQuat:function(F,U,w,L){return W(w==8),W(L>=4&&L<=16),q($.exports.meshopt_encodeFilterQuat,F,U,w,L,16)},encodeFilterExp:function(F,U,w,L,O){W(w>0&&w%4==0),W(L>=1&&L<=24);var j={Separate:0,SharedVector:1,SharedComponent:2,Clamped:3};return q($.exports.meshopt_encodeFilterExp,F,U,w,L,w,O?j[O]:1)}}}();var tH6=function(){var Z="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q:Odkr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq;w8Wqdbk;esezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9Uc;WFbGgocjdaocjd6EhDaicefhocbhqdnindndndnaeaq9nmbaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxalc9WGgmTmecbhPawcjdfhsaohzinaraz9Rax6mvarazaxfgo9RcK6mvczhlcbhHinalgic9WfgOawcj;cbffhldndndndndnazaOco4fRbbaHcoG4ciGPlbedibkal9cb83ibalcwf9cb83ibxikalaoRblaoRbbgOco4gAaAciSgAE86bbawcj;cbfaifglcGfaoclfaAfgARbbaOcl4ciGgCaCciSgCE86bbalcVfaAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc7faAaCfgARbbaOciGgOaOciSgOE86bbalctfaAaOfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkalaoRbwaoRbbgOcl4gAaAcsSgAE86bbawcj;cbfaifglcGfaocwfaAfgARbbaOcsGgOaOcsSgOE86bbalcVfaAaOfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekalao8Pbb83bbalcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaHcdfhHaiczfhlarao9RcL0mekkaiam6mvaoTmvdnakTmbawaPfRbbhHawcj;cbfhlashiakhOinaialRbbgzce4cbazceG9R7aHfgH86bbaiadfhialcefhlaOcufgOmbkkascefhsaohzaPcefgPad9hmbxikkcbc99arao9Radcaadca0ESEhoxlkaoaxad2fhCdnakmbadhlinaoTmlarao9Rax6mlaoaxfhoalcufglmbkaChoxekcbhmawcjdfhAinarao9Rax6miawamfRbbhHawcj;cbfhlaAhiakhOinaialRbbgzce4cbazceG9R7aHfgH86bbaiadfhialcefhlaOcufgOmbkaAcefhAaoaxfhoamcefgmad9hmbkaChokabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekc9:hokavcj;ebf8Kjjjjbaok;cseHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhDaicefgqarfhidnaeTmbcmcsawceSEhkcbhxcbhmcbhPcbhwcbhlindnaiaD9nmbc9:hoxikdndnaqRbbgoc;Ve0mbavc;abfalaocu7gscl4fcsGcitfgzydlhrazydbhzdnaocsGgHak9pmbavawasfcsGcdtfydbaxaHEhoaHThsdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkaxasfhxcdhHavawcdtfaoBdbawasfhwcehsalhOxdkdndnaHcsSmbaHc987aHamffcefhoxekaicefhoai8SbbgHcFeGhsdndnaHcu9mmbaohixekaicvfhiascFbGhscrhHdninao8SbbgOcFbGaHtasVhsaOcu9kmeaocefhoaHcrfgHc8J9hmbxdkkaocefhikasce4cbasceG9R7amfhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhHavawcdtfaoBdbcehsawcefhwalhOaohmxekdnaocpe0mbaxcefgHavawaDaocsGfRbbgocl49RcsGcdtfydbaocz6gzEhravawao9RcsGcdtfydbaHazfgAaocsGgHEhoaHThCdndnadcd9hmbabaPcetfgHax87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHaxBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfaxBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgOaxBdlaOarBdbavawazfgwcsGcdtfaoBdbalcefcsGhOawaCfhwaxhzaAaCfhxxekaxcbaiRbbgOEgzaoc;:eSgHfhraOcsGhCaOcl4hAdndnaOcs0mbarcefhoxekarhoavawaA9RcsGcdtfydbhrkdndnaCmbaocefhxxekaohxavawaO9RcsGcdtfydbhokdndnaHTmbaicefhHxekaicdfhHai8SbegscFeGhzdnascu9kmbaicofhXazcFbGhzcrhidninaH8SbbgscFbGaitazVhzascu9kmeaHcefhHaicrfgic8J9hmbkaXhHxekaHcefhHkazce4cbazceG9R7amfgmhzkdndnaAcsSmbaHhsxekaHcefhsaH8SbbgicFeGhrdnaicu9kmbaHcvfhXarcFbGhrcrhidninas8SbbgHcFbGaitarVhraHcu9kmeascefhsaicrfgic8J9hmbkaXhsxekascefhskarce4cbarceG9R7amfgmhrkdndnaCcsSmbashixekascefhias8SbbgocFeGhHdnaocu9kmbascvfhXaHcFbGhHcrhodninai8SbbgscFbGaotaHVhHascu9kmeaicefhiaocrfgoc8J9hmbkaXhixekaicefhikaHce4cbaHceG9R7amfgmhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfazBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgXazBdlaXarBdbavawaOcz6aAcsSVfgwcsGcdtfaoBdbawaCTaCcsSVfhwalcefcsGhOkaqcefhqavc;abfaOcitfgOarBdlaOaoBdbavc;abfalasfcsGcitfgraoBdlarazBdbawcsGhwalaHfcsGhlaPcifgPae6mbkkcbc99aiaDSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;oiliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabaiavcefciGfcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:OhDxekcjjjj94hDkabaiavciGfgkcd7cetfaD87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:OhDxekcjjjj94hDkabaiavcufciGfcetfaD87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohvxekcjjjj94hvkabakcetfav87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklzNbb",J="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q:6dkr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq:p9sqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk:N8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhlaicefhodnaeTmbadTmbalc;WFbGglcjdalcjd6EhwcbhDinawaeaD9RaDawfae6Egqcsfglc9WGgkci2hxakcethmalcl4cifcd4hPabaDad2fhsakc;ab6hzcbhHincbhOaohAdndninaraA9RaP6meavcj;cbfaOak2fhCaAaPfhocbhidnazmbarao9Rc;Gb6mbcbhlinaCalfhidndndndndnaAalco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklbaoczfhokdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklzaoczfhokdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklaaoczfhokdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WaoclfaYpQbfaXc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WaocwfaYpQbfaXc:q:yjjbfRbbfhoxekaiaopbbbpkl8Waoczfhokalc;abfhialcjefak0meaihlarao9Rc;Fb0mbkkdnaiak9pmbaici4hlinarao9RcK6miaCaifhXdndndndndnaAaico4fRbbalcoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpkbbxikaXaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkbbaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaXaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkbbaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaXaopbbbpkbbaoczfhokalcdfhlaiczfgiak6mbkkaoTmeaohAaOcefgOclSmdxbkkc9:hoxlkdnakTmbavcjdfaHfhiavaHfpbdbhYcbhXinaiavcj;cbfaXfglpblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLalakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEalamfpblbg3cep9Ta3aQp9op9Hp9rg3alaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfhiaXczfgXak6mbkkaHclfgHad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfgDae6mbkkcbc99arao9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk::seHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhDaicefgqarfhidnaeTmbcmcsawceSEhkcbhxcbhmcbhPcbhwcbhlindnaiaD9nmbc9:hoxikdndnaqRbbgoc;Ve0mbavc;abfalaocu7gscl4fcsGcitfgzydlhrazydbhzdnaocsGgHak9pmbavawasfcsGcdtfydbaxaHEhoaHThsdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkaxasfhxcdhHavawcdtfaoBdbawasfhwcehsalhOxdkdndnaHcsSmbaHc987aHamffcefhoxekaicefhoai8SbbgHcFeGhsdndnaHcu9mmbaohixekaicvfhiascFbGhscrhHdninao8SbbgOcFbGaHtasVhsaOcu9kmeaocefhoaHcrfgHc8J9hmbxdkkaocefhikasce4cbasceG9R7amfhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhHavawcdtfaoBdbcehsawcefhwalhOaohmxekdnaocpe0mbaxcefgHavawaDaocsGfRbbgocl49RcsGcdtfydbaocz6gzEhravawao9RcsGcdtfydbaHazfgAaocsGgHEhoaHThCdndnadcd9hmbabaPcetfgHax87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHaxBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfaxBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgOaxBdlaOarBdbavawazfgwcsGcdtfaoBdbalcefcsGhOawaCfhwaxhzaAaCfhxxekaxcbaiRbbgOEgzaoc;:eSgHfhraOcsGhCaOcl4hAdndnaOcs0mbarcefhoxekarhoavawaA9RcsGcdtfydbhrkdndnaCmbaocefhxxekaohxavawaO9RcsGcdtfydbhokdndnaHTmbaicefhHxekaicdfhHai8SbegscFeGhzdnascu9kmbaicofhXazcFbGhzcrhidninaH8SbbgscFbGaitazVhzascu9kmeaHcefhHaicrfgic8J9hmbkaXhHxekaHcefhHkazce4cbazceG9R7amfgmhzkdndnaAcsSmbaHhsxekaHcefhsaH8SbbgicFeGhrdnaicu9kmbaHcvfhXarcFbGhrcrhidninas8SbbgHcFbGaitarVhraHcu9kmeascefhsaicrfgic8J9hmbkaXhsxekascefhskarce4cbarceG9R7amfgmhrkdndnaCcsSmbashixekascefhias8SbbgocFeGhHdnaocu9kmbascvfhXaHcFbGhHcrhodninai8SbbgscFbGaotaHVhHascu9kmeaicefhiaocrfgoc8J9hmbkaXhixekaicefhikaHce4cbaHceG9R7amfgmhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfazBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgXazBdlaXarBdbavawaOcz6aAcsSVfgwcsGcdtfaoBdbawaCTaCcsSVfhwalcefcsGhOkaqcefhqavc;abfaOcitfgOarBdlaOaoBdbavc;abfalasfcsGcitfgraoBdlarazBdbawcsGhwalaHfcsGhlaPcifgPae6mbkkcbc99aiaDSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalaeSmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;Meawaqawamp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oaoarpmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalaeSmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;Meawaqawamp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oaoarpmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaDakp;Mearp;Keamp9oaqakp;Mearp;Keczp:Rep9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalaeSmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaDakp;Mearp;Keamp9oaqakp;Mearp;Keczp:Rep9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbadczfhdaeclfgeav6mbkkdnavalSmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz:Dbb",$=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),Y=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!=="object")return{supported:!1};var Q=WebAssembly.validate($)?K(J):K(Z),W,X=WebAssembly.instantiate(Q,{}).then(function(O){W=O.instance,W.exports.__wasm_call_ctors()});function K(O){var j=new Uint8Array(O.length);for(var M=0;M<O.length;++M){var N=O.charCodeAt(M);j[M]=N>96?N-97:N>64?N-39:N+4}var D=0;for(var M=0;M<O.length;++M)j[D++]=j[M]<60?Y[j[M]]:(j[M]-60)*64+j[++M];return j.buffer.slice(0,D)}function G(O,j,M,N,D,P,C){var T=O.exports.sbrk,E=N+3&-4,A=T(E*D),S=T(P.length),x=new Uint8Array(O.exports.memory.buffer);x.set(P,S);var I=j(A,N,D,S,P.length);if(I==0&&C)C(A,E,D);if(M.set(x.subarray(A,A+N*D)),T(A-T(0)),I!=0)throw new Error("Malformed buffer data: "+I)}var z={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},H={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},V=[],q=0;function F(O){var j={object:new Worker(O),pending:0,requests:{}};return j.object.onmessage=function(M){var N=M.data;j.pending-=N.count,j.requests[N.id][N.action](N.value),delete j.requests[N.id]},j}function U(O){var j="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(Q)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+L.name+";"+G.toString()+L.toString(),M=new Blob([j],{type:"text/javascript"}),N=URL.createObjectURL(M);for(var D=V.length;D<O;++D)V[D]=F(N);for(var D=O;D<V.length;++D)V[D].object.postMessage({});V.length=O,URL.revokeObjectURL(N)}function w(O,j,M,N,D){var P=V[0];for(var C=1;C<V.length;++C)if(V[C].pending<P.pending)P=V[C];return new Promise(function(T,E){var A=new Uint8Array(M),S=++q;P.pending+=O,P.requests[S]={resolve:T,reject:E},P.object.postMessage({id:S,count:O,size:j,source:A,mode:N,filter:D},[A.buffer])})}function L(O){var j=O.data;if(!j.id)return self.close();self.ready.then(function(M){try{var N=new Uint8Array(j.count*j.size);G(M,M.exports[j.mode],N,j.count,j.size,j.source,M.exports[j.filter]),self.postMessage({id:j.id,count:j.count,action:"resolve",value:N},[N.buffer])}catch(D){self.postMessage({id:j.id,count:j.count,action:"reject",value:D})}})}return{ready:X,supported:!0,useWorkers:function(O){U(O)},decodeVertexBuffer:function(O,j,M,N,D){G(W,W.exports.meshopt_decodeVertexBuffer,O,j,M,N,W.exports[z[D]])},decodeIndexBuffer:function(O,j,M,N){G(W,W.exports.meshopt_decodeIndexBuffer,O,j,M,N)},decodeIndexSequence:function(O,j,M,N){G(W,W.exports.meshopt_decodeIndexSequence,O,j,M,N)},decodeGltfBuffer:function(O,j,M,N,D,P){G(W,W.exports[H[D]],O,j,M,N,W.exports[z[P]])},decodeGltfBufferAsync:function(O,j,M,N,D){if(V.length>0)return w(O,j,M,H[N],z[D]);return X.then(function(){var P=new Uint8Array(O*j);return G(W,W.exports[H[N]],P,O,j,M,W.exports[z[D]]),P})}}}();var Js=function(){var Z="b9H79Tebbbe9Hk9Geueu9Geub9Gbb9Gsuuuuuuuuuuuu99uueu9Gvuuuuub9Gvuuuuue999Gquuuuuuu99uueu9Gwuuuuuu99ueu9Giuuue999Gluuuueu9GiuuueuizsdilvoirwDbqqbeqlve9Weiiviebeoweuecj:Pdkr:Tewo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bbz9TW79O9V9Wt9F79P9T9W29P9M95bl8E9TW79O9V9Wt9F79P9T9W29P9M959x9Pt9OcttV9P9I91tW7bvQ9TW79O9V9Wt9F79P9T9W29P9M959q9V9P9Ut7boX9TW79O9V9Wt9F79P9T9W29P9M959t9J9H2Wbra9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94SWt9J9O9sW9T9H9Wbwl79IV9RbDDwebcekdmxq;UMesdbk:kfvKue99euY99Qu8Jjjjjbc;W;qb9Rgs8Kjjjjbcbhzascxfcbc;Kbz:ljjjb8AdnabaeSmbabaeadcdtz:kjjjb8AkdnamcdGTmbalcrfci4gHcbyd;S1jjbHjjjjbbheascxfasyd2gOcdtfaeBdbasaOcefBd2aecbaHz:ljjjbhAcbhlcbhednadTmbcbhlabheadhHinaAaeydbgOci4fgCaCRbbgCceaOcrGgOtV86bbaCcu7aO4ceGalfhlaeclfheaHcufgHmbkcualcdtalcFFFFi0Ehekaecbyd;S1jjbHjjjjbbhzascxfasyd2gecdtfazBdbasaecefBd2alcd4alfhOcehHinaHgecethHaeaO6mbkcbhXcuaecdtgOaecFFFFi0Ecbyd;S1jjbHjjjjbbhHascxfasyd2gCcdtfaHBdbasaCcefBd2aHcFeaOz:ljjjbhQdnadTmbaecufhCcbhLinabaXcdtfgKydbgAc:v;t;h;Ev2hOcbhedndninaQaOaCGgOcdtfgYydbgHcuSmeazaHcdtfydbaASmdaecefgeaOfhOaeaC9nmbxdkkazaLcdtfaABdbaYaLBdbaLhHaLcefhLkaKaHBdbaXcefgXad9hmbkkaQcbyd;O1jjbH:bjjjbbasasyd2cufBd2kcualcefgecdtaecFFFFi0Ecbyd;S1jjbHjjjjbbh8Aascxfasyd2gecdtfa8ABdbasa8ABdlasaecefBd2cuadcitadcFFFFe0Ecbyd;S1jjbHjjjjbbhEascxfasyd2gecdtfaEBdbasaEBdwasaecefBd2asclfabadalcbz:cjjjbcualcdtg3alcFFFFi0Eg5cbyd;S1jjbHjjjjbbhQascxfasyd2gecdtfaQBdbasaecefBd2a5cbyd;S1jjbHjjjjbbh8Eascxfasyd2gecdtfa8EBdbasaecefBd2alcd4alfhOcehHinaHgecethHaeaO6mbkcbhLcuaecdtgOaecFFFFi0Ecbyd;S1jjbHjjjjbbhHascxfasyd2gCcdtfaHBdbasaCcefBd2aHcFeaOz:ljjjbhXdnalTmbavcd4hCaecufhHinaLhednazTmbazaLcdtfydbhekaiaeaC2cdtfgeydlgOcH4aO7c:F:b:DD2aeydbgOcH4aO7c;D;O:B8J27aeydwgecH4ae7c:3F;N8N27aHGheaLcdth8FdndndndndnazTmbaza8FfhKcbhOinaXaecdtfgYydbgAcuSmlaiazaAcdtfydbaC2cdtfaiaKydbaC2cdtfcxz:ojjjbTmiaOcefgOaefaHGheaOaH9nmbxdkkaiaLaC2cdtfhKcbhOinaXaecdtfgYydbgAcuSmiaiaAaC2cdtfaKcxz:ojjjbTmdaOcefgOaefaHGheaOaH9nmbkkcbhYkaYydbgecu9hmekaYaLBdbaLhekaQa8FfaeBdbaLcefgLal9hmbkcbhea8EhHinaHaeBdbaHclfhHalaecefge9hmbkcbheaQhHa8EhOindnaeaHydbgCSmbaOa8EaCcdtfgCydbBdbaCaeBdbkaHclfhHaOclfhOalaecefge9hmbkkcbhaaXcbyd;O1jjbH:bjjjbbasasyd2cufBd2alcbyd;S1jjbHjjjjbbhXascxfasyd2gecdtfaXBdbasaecefBd2a5cbyd;S1jjbHjjjjbbheascxfasyd2gHcdtfaeBdbasaHcefBd2a5cbyd;S1jjbHjjjjbbhHascxfasyd2gOcdtfaHBdbasaOcefBd2aecFea3z:ljjjbhhaHcFea3z:ljjjbhgdnalTmbaEcwfh8Jindna8AaagOcefgacdtfydbgCa8AaOcdtgefydbgHSmbaCaH9Rh8FaEaHcitfh3agaefh8KahaefhLcbhAindndna3aAcitfydbgYaO9hmbaLaOBdba8KaOBdbxekdna8AaYcdtg8LfgeclfydbgHaeydbgeSmbaEaecitgCfydbaOSmeaHae9Rh8Maecu7aHfhKa8JaCfhHcbheinaKaeSmeaecefheaHydbhCaHcwfhHaCaO9hmbkaea8M6mekaga8LfgeaOaYaeydbcuSEBdbaLaYaOaLydbcuSEBdbkaAcefgAa8F9hmbkkaaal9hmbkaQhHa8EhOaghCahhAcbheindndnaeaHydbgY9hmbdnaeaOydbgY9hmbaAydbhYdnaCydbgKcu9hmbaYcu9hmbaXaefcb86bbxikaXaefhLdnaeaKSmbaeaYSmbaLce86bbxikaLcl86bbxdkdnaea8EaYcdtgKfydb9hmbdnaCydbgLcuSmbaeaLSmbaAydbg8FcuSmbaea8FSmbagaKfydbg3cuSmba3aYSmbahaKfydbgKcuSmbaKaYSmbdnaQaLcdtfydbgYaQaKcdtfydb9hmbaYaQa8FcdtfydbgKSmbaKaQa3cdtfydb9hmbaXaefcd86bbxlkaXaefcl86bbxikaXaefcl86bbxdkaXaefcl86bbxekaXaefaXaYfRbb86bbkaHclfhHaOclfhOaCclfhCaAclfhAalaecefge9hmbkdnaqTmbdndnazTmbazheaQhHalhOindnaqaeydbfRbbTmbaXaHydbfcl86bbkaeclfheaHclfhHaOcufgOmbxdkkaQhealhHindnaqRbbTmbaXaeydbfcl86bbkaqcefhqaeclfheaHcufgHmbkkaQhealhOaXhHindnaXaeydbfRbbcl9hmbaHcl86bbkaeclfheaHcefhHaOcufgOmbkkamceGTmbaXhealhHindnaeRbbce9hmbaecl86bbkaecefheaHcufgHmbkkcualcx2alc;v:Q;v:Qe0Ecbyd;S1jjbHjjjjbbhaascxfasyd2gecdtfaaBdbasaecefBd2aaaialavazz:djjjbh8NdndnaDmbcbhycbh8Jxekcbh8JawhecbhHindnaeIdbJbbbb9ETmbasc;Wbfa8JcdtfaHBdba8Jcefh8JkaeclfheaDaHcefgH9hmbkcua8Jal2gecdtaecFFFFi0Ecbyd;S1jjbHjjjjbbhyascxfasyd2gecdtfayBdbasaecefBd2alTmba8JTmbarcd4hLdnazTmba8JcdthicbhYayhKinaoazaYcdtfydbaL2cdtfhAasc;WbfheaKhHa8JhOinaHaAaeydbcdtgCfIdbawaCfIdbNUdbaeclfheaHclfhHaOcufgOmbkaKaifhKaYcefgYal9hmbxdkka8JcdthicbhYayhKinaoaYaL2cdtfhAasc;WbfheaKhHa8JhOinaHaAaeydbcdtgCfIdbawaCfIdbNUdbaeclfheaHclfhHaOcufgOmbkaKaifhKaYcefgYal9hmbkkcualc8S2gHalc;D;O;f8U0EgCcbyd;S1jjbHjjjjbbheascxfasyd2gOcdtfaeBdbasaOcefBd2aecbaHz:ljjjbhqdndndndna8JTmbaCcbyd;S1jjbHjjjjbbhvascxfasyd2gecdtfavBdbcehOasaecefBd2avcbaHz:ljjjb8Acua8Jal2gecltgHaecFFFFb0Ecbyd;S1jjbHjjjjbbhrascxfasyd2gecdtfarBdbasaecefBd2arcbaHz:ljjjb8AadmexikcbhvadTmecbhrkcbhAabhHindnaaaHclfydbgYcx2fgeIdbaaaHydbgKcx2fgOIdbg8P:tgIaaaHcwfydbgLcx2fgCIdlaOIdlg8R:tg8SNaCIdba8P:tgRaeIdla8R:tg8UN:tg8Va8VNa8UaCIdwaOIdwg8W:tg8XNa8SaeIdwa8W:tg8UN:tg8Sa8SNa8UaRNa8XaIN:tgIaINMM:rgRJbbbb9ETmba8VaR:vh8VaIaR:vhIa8SaR:vh8SkaqaQaKcdtfydbc8S2fgea8SaR:rgRa8SNNg8UaeIdbMUdbaeaIaRaINg8YNg8XaeIdlMUdlaea8VaRa8VNg8ZNg80aeIdwMUdwaea8Ya8SNg8YaeIdxMUdxaea8Za8SNg81aeIdzMUdzaea8ZaINg8ZaeIdCMUdCaea8SaRa8Va8WNa8Sa8PNa8RaINMM:mg8RNg8PNg8SaeIdKMUdKaeaIa8PNgIaeId3MUd3aea8Va8PNg8VaeIdaMUdaaea8Pa8RNg8PaeId8KMUd8KaeaRaeIdyMUdyaqaQaYcdtfydbc8S2fgea8UaeIdbMUdbaea8XaeIdlMUdlaea80aeIdwMUdwaea8YaeIdxMUdxaea81aeIdzMUdzaea8ZaeIdCMUdCaea8SaeIdKMUdKaeaIaeId3MUd3aea8VaeIdaMUdaaea8PaeId8KMUd8KaeaRaeIdyMUdyaqaQaLcdtfydbc8S2fgea8UaeIdbMUdbaea8XaeIdlMUdlaea80aeIdwMUdwaea8YaeIdxMUdxaea81aeIdzMUdzaea8ZaeIdCMUdCaea8SaeIdKMUdKaeaIaeId3MUd3aea8VaeIdaMUdaaea8PaeId8KMUd8KaeaRaeIdyMUdyaHcxfhHaAcifgAad6mbkcbhiabhKinabaicdtfhYcbhHinaXaYaHc:G1jjbfydbcdtfydbgOfRbbhedndnaXaKaHfydbgCfRbbgAc99fcFeGcpe0mbaeceSmbaecd9hmekdnaAcufcFeGce0mbahaCcdtfydbaO9hmekdnaecufcFeGce0mbagaOcdtfydbaC9hmekdnaAcv2aefcj1jjbfRbbTmbaQaOcdtfydbaQaCcdtfydb0mekJbbacJbbacJbbjZaeceSEaAceSEh8ZdnaaaYaHc:K1jjbfydbcdtfydbcx2fgeIdwaaaCcx2fgAIdwg8R:tg8VaaaOcx2fgLIdwa8R:tg8Sa8SNaLIdbaAIdbg8W:tgIaINaLIdlaAIdlg8U:tgRaRNMMg8PNa8Va8SNaeIdba8W:tg80aINaRaeIdla8U:tg8YNMMg8Xa8SN:tg8Va8VNa80a8PNa8XaIN:tg8Sa8SNa8Ya8PNa8XaRN:tgIaINMM:rgRJbbbb9ETmba8VaR:vh8VaIaR:vhIa8SaR:vh8SkaqaQaCcdtfydbc8S2fgea8Sa8Za8P:rNgRa8SNNg8XaeIdbMUdbaeaIaRaINg8ZNg80aeIdlMUdlaea8VaRa8VNg8PNg8YaeIdwMUdwaea8Za8SNg8ZaeIdxMUdxaea8Pa8SNg81aeIdzMUdzaea8PaINgBaeIdCMUdCaea8SaRa8Va8RNa8Sa8WNa8UaINMM:mg8RNg8PNg8SaeIdKMUdKaeaIa8PNgIaeId3MUd3aea8Va8PNg8VaeIdaMUdaaea8Pa8RNg8PaeId8KMUd8KaeaRaeIdyMUdyaqaQaOcdtfydbc8S2fgea8XaeIdbMUdbaea80aeIdlMUdlaea8YaeIdwMUdwaea8ZaeIdxMUdxaea81aeIdzMUdzaeaBaeIdCMUdCaea8SaeIdKMUdKaeaIaeId3MUd3aea8VaeIdaMUdaaea8PaeId8KMUd8KaeaRaeIdyMUdykaHclfgHcx9hmbkaKcxfhKaicifgiad6mbkdna8JTmbcbhKinJbbbbh8WaaabaKcdtfgeclfydbgLcx2fgHIdwaaaeydbgicx2fgOIdwg8Y:tgIaINaHIdbaOIdbg81:tg8Va8VNaHIdlaOIdlgB:tgRaRNMMg8Zaaaecwfydbg8Fcx2fgeIdwa8Y:tg8PNaIaIa8PNa8VaeIdba81:tg8RNaRaeIdlaB:tg8UNMMg8SN:tJbbbbJbbjZa8Za8Pa8PNa8Ra8RNa8Ua8UNMMg80Na8Sa8SN:tg8X:va8XJbbbb9BEg8XNh83a80aINa8Pa8SN:ta8XNhUa8Za8UNaRa8SN:ta8XNh85a80aRNa8Ua8SN:ta8XNh86a8Za8RNa8Va8SN:ta8XNh87a80a8VNa8Ra8SN:ta8XNh88a8Va8UNa8RaRN:tg8Sa8SNaRa8PNa8UaIN:tg8Sa8SNaIa8RNa8Pa8VN:tg8Sa8SNMM:rJbbbZNh8Sayaia8J2g3cdtfhHaya8Fa8J2gwcdtfhOayaLa8J2g8LcdtfhCa8Y:mh89aB:mh8:a81:mhZcbhAa8JhYJbbbbh8UJbbbbh8XJbbbbh8ZJbbbbh80Jbbbbh8YJbbbbh81JbbbbhBJbbbbhnJbbbbhcinasc;WbfaAfgecwfa8SaUaCIdbaHIdbg8P:tgRNa83aOIdba8P:tg8RNMgINUdbaeclfa8Sa86aRNa85a8RNMg8VNUdbaea8Sa88aRNa87a8RNMgRNUdbaecxfa8Sa89aINa8:a8VNa8PaZaRNMMMg8PNUdba8SaIa8VNNa80Mh80a8SaIaRNNa8YMh8Ya8Sa8VaRNNa81Mh81a8Sa8Pa8PNNa8WMh8Wa8SaIa8PNNa8UMh8Ua8Sa8Va8PNNa8XMh8Xa8SaRa8PNNa8ZMh8Za8SaIaINNaBMhBa8Sa8Va8VNNanMhna8SaRaRNNacMhcaHclfhHaCclfhCaOclfhOaAczfhAaYcufgYmbkavaic8S2fgeacaeIdbMUdbaeanaeIdlMUdlaeaBaeIdwMUdwaea81aeIdxMUdxaea8YaeIdzMUdzaea80aeIdCMUdCaea8ZaeIdKMUdKaea8XaeId3MUd3aea8UaeIdaMUdaaea8WaeId8KMUd8Kaea8SaeIdyMUdyavaLc8S2fgeacaeIdbMUdbaeanaeIdlMUdlaeaBaeIdwMUdwaea81aeIdxMUdxaea8YaeIdzMUdzaea80aeIdCMUdCaea8ZaeIdKMUdKaea8XaeId3MUd3aea8UaeIdaMUdaaea8WaeId8KMUd8Kaea8SaeIdyMUdyava8Fc8S2fgeacaeIdbMUdbaeanaeIdlMUdlaeaBaeIdwMUdwaea81aeIdxMUdxaea8YaeIdzMUdzaea80aeIdCMUdCaea8ZaeIdKMUdKaea8XaeId3MUd3aea8UaeIdaMUdaaea8WaeId8KMUd8Kaea8SaeIdyMUdyara3cltfhYcbhHa8JhCinaYaHfgeasc;WbfaHfgOIdbaeIdbMUdbaeclfgAaOclfIdbaAIdbMUdbaecwfgAaOcwfIdbaAIdbMUdbaecxfgeaOcxfIdbaeIdbMUdbaHczfhHaCcufgCmbkara8LcltfhYcbhHa8JhCinaYaHfgeasc;WbfaHfgOIdbaeIdbMUdbaeclfgAaOclfIdbaAIdbMUdbaecwfgAaOcwfIdbaAIdbMUdbaecxfgeaOcxfIdbaeIdbMUdbaHczfhHaCcufgCmbkarawcltfhYcbhHa8JhCinaYaHfgeasc;WbfaHfgOIdbaeIdbMUdbaeclfgAaOclfIdbaAIdbMUdbaecwfgAaOcwfIdbaAIdbMUdbaecxfgeaOcxfIdbaeIdbMUdbaHczfhHaCcufgCmbkaKcifgKad6mbkkcbhOxekcehOcbhrkcbh8FdndnamcwGg9cmbJbbbbh8ZcbhJcbhocbhCxekcbhea5cbyd;S1jjbHjjjjbbhCascxfasyd2gHcdtfaCBdbasaHcefBd2dnalTmbaChHinaHaeBdbaHclfhHalaecefge9hmbkkdnaOmbcbhiinabaicdtfhLcbhKinaQaLaKcdtgec:G1jjbfydbcdtfydbcdtfydbhHdnaCaQaLaefydbcdtfydbgOcdtfgAydbgeaOSmbinaAaCaegOcdtfgYydbgeBdbaYhAaOae9hmbkkdnaCaHcdtfgAydbgeaHSmbinaAaCaegHcdtfgYydbgeBdbaYhAaHae9hmbkkdnaOaHSmbaCaOaHaOaH0EcdtfaOaHaOaH6EBdbkaKcefgKci9hmbkaicifgiad6mbkkcbhJdnalTmbcbhYindnaQaYcdtgefydbaY9hmbaYhHdnaCaefgKydbgeaYSmbaKhOinaOaCaegHcdtfgAydbgeBdbaAhOaHae9hmbkkaKaHBdbkaYcefgYal9hmbkcbheaQhOaChHcbhJindndnaeaOydbgA9hmbdnaeaHydbgA9hmbaHaJBdbaJcefhJxdkaHaCaAcdtfydbBdbxekaHaCaAcdtfydbBdbkaOclfhOaHclfhHalaecefge9hmbkkcuaJcltgeaJcjjjjiGEcbyd;S1jjbHjjjjbbhoascxfasyd2gHcdtfaoBdbasaHcefBd2aocbaez:ljjjbhAdnalTmbaChOaahealhYinaecwfIdbh8SaeclfIdbhIaAaOydbcltfgHaeIdbaHIdbMUdbaHclfgKaIaKIdbMUdbaHcwfgKa8SaKIdbMUdbaHcxfgHaHIdbJbbjZMUdbaOclfhOaecxfheaYcufgYmbkkdnaJTmbaAheaJhHinaecxfgOIdbh8SaOcbBdbaeaeIdbJbbbbJbbjZa8S:va8SJbbbb9BEg8SNUdbaeclfgOa8SaOIdbNUdbaecwfgOa8SaOIdbNUdbaeczfheaHcufgHmbkkdnalTmbaChOaahealhYinaAaOydbcltfgHcxfgKaecwfIdbaHcwfIdb:tg8Sa8SNaeIdbaHIdb:tg8Sa8SNaeclfIdbaHclfIdb:tg8Sa8SNMMg8SaKIdbgIaIa8S9DEUdbaOclfhOaecxfheaYcufgYmbkkdnaJmbcbhJJFFuuh8ZxekaAcxfheaAhHaJhOinaHaeIdbUdbaeczfheaHclfhHaOcufgOmbkJFFuuh8ZaAheaJhHinaeIdbg8Sa8Za8Za8S9EEh8ZaeclfheaHcufgHmbkkasydlh9ednalTmba9eclfhea9eydbhAaXhHalhYcbhOincbaeydbgKaA9RaHRbbcpeGEaOfhOaHcefhHaeclfheaKhAaYcufgYmbkaOce4h8Fkcuada8F9RcifgTcx2aTc;v:Q;v:Qe0Ecbyd;S1jjbHjjjjbbhDascxfasyd2gecdtfaDBdbasaecefBd2cuaTcdtaTcFFFFi0Ecbyd;S1jjbHjjjjbbhSascxfasyd2gecdtfaSBdbasaecefBd2a5cbyd;S1jjbHjjjjbbh8Mascxfasyd2gecdtfa8MBdbasaecefBd2alcbyd;S1jjbHjjjjbbh9hascxfasyd2gecdtfa9hBdbasaecefBd2axaxNa8NJbbjZamclGEg83a83N:vhcJbbbbhndnadak9nmbdnaTci6mba8Jclth9iaDcwfh6JbbbbhBJbbbbhninasclfabadalaQz:cjjjbabh8FcbhEcbh5inaba5cdtfh3cbheindnaQa8FaefydbgOcdtgifydbgYaQa3aec:W1jjbfydbcdtfydbgHcdtgwfydbgKSmbaXaHfRbbgLcv2aXaOfRbbgAfc;a1jjbfRbbg8AaAcv2aLfg8Lc;a1jjbfRbbg8KVcFeGTmbdnaKaY9nmba8Lcj1jjbfRbbcFeGmekaAcufhYdnaAaL9hmbaYcFeGce0mbahaifydbaH9hmekdndnaAclSmbaLcl9hmekdnaYcFeGce0mbahaifydbaH9hmdkaLcufcFeGce0mbagawfydbaO9hmekaDaEcx2fgAaHaOa8KcFeGgYEBdlaAaOaHaYEBdbaAaYa8AGcb9hBdwaEcefhEkaeclfgecx9hmbkdna5cifg5ad9pmba8Fcxfh8FaEcifaT9nmekkaETmdcbhiinJbbbbJbbjZaqaQaDaicx2fgAydlgKaAydbgYaAydwgHEgLcdtfydbc8S2fgeIdyg8S:va8SJbbbb9BEaeIdwaaaYaKaHEg8Fcx2fgHIdwgRNaeIdzaHIdbg8PNaeIdaMg8Sa8SMMaRNaeIdlaHIdlg8RNaeIdCaRNaeId3Mg8Sa8SMMa8RNaeIdba8PNaeIdxa8RNaeIdKMg8Sa8SMMa8PNaeId8KMMM:lNh80JbbbbJbbjZaqaQaYcdtfydbc8S2fgeIdyg8S:va8SJbbbb9BEaeIdwaaaKcx2fgHIdwg8VNaeIdzaHIdbg8WNaeIdaMg8Sa8SMMa8VNaeIdlaHIdlg8UNaeIdCa8VNaeId3Mg8Sa8SMMa8UNaeIdba8WNaeIdxa8UNaeIdKMg8Sa8SMMa8WNaeId8KMMM:lNh8YaAcwfh3aAclfhwdna8JTmbavaYc8S2fgOIdwa8VNaOIdza8WNaOIdaMg8Sa8SMMa8VNaOIdla8UNaOIdCa8VNaOId3Mg8Sa8SMMa8UNaOIdba8WNaOIdxa8UNaOIdKMg8Sa8SMMa8WNaOId8KMMMh8SayaKa8J2cdtfhHaraYa8J2cltfheaOIdyh8Xa8JhOinaHIdbgIaIa8XNaecxfIdba8VaecwfIdbNa8WaeIdbNa8UaeclfIdbNMMMgIaIM:tNa8SMh8SaHclfhHaeczfheaOcufgOmbkavaLc8S2fgOIdwaRNaOIdza8PNaOIdaMgIaIMMaRNaOIdla8RNaOIdCaRNaOId3MgIaIMMa8RNaOIdba8PNaOIdxa8RNaOIdKMgIaIMMa8PNaOId8KMMMhIaya8Fa8J2cdtfhHaraLa8J2cltfheaOIdyh8Wa8JhOinaHIdbg8Va8Va8WNaecxfIdbaRaecwfIdbNa8PaeIdbNa8RaeclfIdbNMMMg8Va8VM:tNaIMhIaHclfhHaeczfheaOcufgOmbka80aI:lMh80a8Ya8S:lMh8YkawaKa8Fa8Ya809FgeEBdbaAaYaLaeEBdba3a8Ya80aeEUdbaicefgiaE9hmbkasc;Wbfcbcj;qbz:ljjjb8Aa6heaEhHinasc;WbfaeydbcA4cF8FGgOcFAaOcFA6EcdtfgOaOydbcefBdbaecxfheaHcufgHmbkcbhecbhHinasc;WbfaefgOydbhAaOaHBdbaAaHfhHaeclfgecj;qb9hmbkcbhea6hHinasc;WbfaHydbcA4cF8FGgOcFAaOcFA6EcdtfgOaOydbgOcefBdbaSaOcdtfaeBdbaHcxfhHaEaecefge9hmbkadak9RgOci9Uh9kdnalTmbcbhea8MhHinaHaeBdbaHclfhHalaecefge9hmbkkcbh0a9hcbalz:ljjjbh9maOcO9Uh9na9kce4h9oasydwh9pcbh8KcbhwdninaDaSawcdtfydbcx2fg3Idwg8Sac9Emea8Ka9k9pmeJFFuuhIdna9oaE9pmbaDaSa9ocdtfydbcx2fIdwJbb;aZNhIkdna8SaI9ETmba8San9ETmba8Ka9n0mdkdna9maQa3ydlgicdtg9qfydbgAfg9rRbba9maQa3ydbgLcdtg9sfydbgHfg9tRbbVmbaXaLfRbbh9udna9eaHcdtfgeclfydbgOaeydbgeSmbaOae9RhKa9paecitfheaaaAcx2fg8Lcwfh5a8Lclfh9vaaaHcx2fg8Acwfh9wa8Aclfh9xcbhHceh8Fdnindna8MaeydbcdtfydbgOaASmba8MaeclfydbcdtfydbgYaASmbaOaYSmbaaaYcx2fgYIdbaaaOcx2fgOIdbg8V:tg8Sa9xIdbaOIdlgR:tg8WNa8AIdba8V:tg8UaYIdlaR:tgIN:tg8Pa8Sa9vIdbaR:tg8XNa8LIdba8V:tg80aIN:tgRNaIa9wIdbaOIdwg8R:tg8YNa8WaYIdwa8R:tg8VN:tg8WaIa5Idba8R:tg81Na8Xa8VN:tgINa8Va8UNa8Ya8SN:tg8Ra8Va80Na81a8SN:tg8SNMMa8Pa8PNa8Wa8WNa8Ra8RNMMaRaRNaIaINa8Sa8SNMMN:rJbbj8:N9FmdkaecwfheaHcefgHaK6h8FaKaH9hmbkka8FceGTmba9ocefh9oxeka3cwfhHdndndndna9uc9:fPdebdkaLheina8MaecdtgefaiBdba8EaefydbgeaL9hmbxikkdnagahaha9sfydbaiSEa8Ea9sfydbgLcdtfydbgecu9hmba8Ea9qfydbheka8Ma9sfaiBdbaehika8MaLcdtfaiBdbka9tce86bba9rce86bbaHIdbg8Sanana8S9DEhna0cefh0cecda9uceSEa8Kfh8KkawcefgwaE9hmbkka0TmddnalTmbcbhKcbhiindna8MaicdtgefydbgOaiSmbaQaOcdtfydbh8FdnaiaQaefydb9hg3mbaqa8Fc8S2fgeaqaic8S2fgHIdbaeIdbMUdbaeaHIdlaeIdlMUdlaeaHIdwaeIdwMUdwaeaHIdxaeIdxMUdxaeaHIdzaeIdzMUdzaeaHIdCaeIdCMUdCaeaHIdKaeIdKMUdKaeaHId3aeId3MUd3aeaHIdaaeIdaMUdaaeaHId8KaeId8KMUd8KaeaHIdyaeIdyMUdyka8JTmbavaOc8S2fgeavaic8S2gwfgHIdbaeIdbMUdbaeaHIdlaeIdlMUdlaeaHIdwaeIdwMUdwaeaHIdxaeIdxMUdxaeaHIdzaeIdzMUdzaeaHIdCaeIdCMUdCaeaHIdKaeIdKMUdKaeaHId3aeId3MUd3aeaHIdaaeIdaMUdaaeaHId8KaeId8KMUd8KaeaHIdyaeIdyMUdya9iaO2hLarhHa8JhAinaHaLfgeaHaKfgOIdbaeIdbMUdbaeclfgYaOclfIdbaYIdbMUdbaecwfgYaOcwfIdbaYIdbMUdbaecxfgeaOcxfIdbaeIdbMUdbaHczfhHaAcufgAmbka3mbJbbbbJbbjZaqawfgeIdyg8S:va8SJbbbb9BEaeIdwaaa8Fcx2fgHIdwg8SNaeIdzaHIdbgINaeIdaMg8Va8VMMa8SNaeIdlaHIdlg8VNaeIdCa8SNaeId3Mg8Sa8SMMa8VNaeIdbaINaeIdxa8VNaeIdKMg8Sa8SMMaINaeId8KMMM:lNg8SaBaBa8S9DEhBkaKa9ifhKaicefgial9hmbkcbhHahheindnaeydbgOcuSmbdnaHa8MaOcdtgAfydbgO9hmbcuhOahaAfydbgAcuSmba8MaAcdtfydbhOkaeaOBdbkaeclfhealaHcefgH9hmbkcbhHagheindnaeydbgOcuSmbdnaHa8MaOcdtgAfydbgO9hmbcuhOagaAfydbgAcuSmba8MaAcdtfydbhOkaeaOBdbkaeclfhealaHcefgH9hmbkkaBana8JEhBcbhYabhecbhKindna8MaeydbcdtfydbgHa8MaeclfydbcdtfydbgOSmbaHa8MaecwfydbcdtfydbgASmbaOaASmbabaYcdtfgLaHBdbaLcwfaABdbaLclfaOBdbaYcifhYkaecxfheaKcifgKad6mbkdndna9cTmbaYak9nmba8ZaB9FTmbcbhdabhecbhHindnaoaCaeydbgOcdtfydbcdtfIdbaB9ETmbabadcdtfgAaOBdbaAclfaeclfydbBdbaAcwfaecwfydbBdbadcifhdkaecxfheaHcifgHaY6mbkJFFuuh8ZaJTmeaoheaJhHJFFuuh8SinaeIdbgIa8Sa8SaI9EEg8Va8SaIaB9EgOEh8Sa8Va8ZaOEh8ZaeclfheaHcufgHmbxdkkaYhdkadak0mbxdkkasclfabadalaQz:cjjjbkdndnadak0mbadhOxekdna9cmbadhOxekdna8Zac9FmbadhOxekina8ZJbb;aZNg8Saca8Sac9DEh8VJbbbbh8SdnaJTmbaoheaJhHinaeIdbgIa8SaIa8V9FEa8SaIa8S9EEh8SaeclfheaHcufgHmbkkcbhOabhecbhHindnaoaCaeydbgAcdtfydbcdtfIdba8V9ETmbabaOcdtfgYaABdbaYclfaeclfydbBdbaYcwfaecwfydbBdbaOcifhOkaecxfheaHcifgHad6mbkJFFuuh8ZdnaJTmbaoheaJhHJFFuuhIinaeIdbgRaIaIaR9EEg8PaIaRa8V9EgAEhIa8Pa8ZaAEh8ZaeclfheaHcufgHmbkkdnaOad9hmbadhOxdka8Sanana8S9DEhnaOak9nmeaOhda8Zac9FmbkkdnamcjjjjlGTmbazmbaOTmbcbhQabheinaXaeydbgAfRbbc3thKaecwfgLydbhHdndnahaAcdtg8FfydbaeclfgiydbgCSmbcbhYagaCcdtfydbaA9hmekcjjjj94hYkaeaKaYVaAVBdbaXaCfRbbc3thKdndnahaCcdtfydbaHSmbcbhYagaHcdtfydbaC9hmekcjjjj94hYkaiaKaYVaCVBdbaXaHfRbbc3thYdndnahaHcdtfydbaASmbcbhCaga8FfydbaH9hmekcjjjj94hCkaLaYaCVaHVBdbaecxfheaQcifgQaO6mbkkdnazTmbaOTmbaOheinabazabydbcdtfydbBdbabclfhbaecufgembkkdnaPTmbaPa83an:rNUdbkasyd2gecdtascxffc98fhHdninaeTmeaHydbcbyd;O1jjbH:bjjjbbaHc98fhHaecufhexbkkasc;W;qbf8KjjjjbaOk;Yieouabydlhvabydbclfcbaicdtz:ljjjbhoadci9UhrdnadTmbdnalTmbaehwadhDinaoalawydbcdtfydbcdtfgqaqydbcefBdbawclfhwaDcufgDmbxdkkaehwadhDinaoawydbcdtfgqaqydbcefBdbawclfhwaDcufgDmbkkdnaiTmbcbhDaohwinawydbhqawaDBdbawclfhwaqaDfhDaicufgimbkkdnadci6mbinaecwfydbhwaeclfydbhDaeydbhidnalTmbalawcdtfydbhwalaDcdtfydbhDalaicdtfydbhikavaoaicdtfgqydbcitfaDBdbavaqydbcitfawBdlaqaqydbcefBdbavaoaDcdtfgqydbcitfawBdbavaqydbcitfaiBdlaqaqydbcefBdbavaoawcdtfgwydbcitfaiBdbavawydbcitfaDBdlawawydbcefBdbaecxfhearcufgrmbkkabydbcbBdbk;Podvuv998Jjjjjbca9RgvcFFF;7rBd3av9cFFF;7;3FF:;Fb83dCavcFFF97Bdzav9cFFF;7FFF:;u83dwdnadTmbaicd4hodnabmbdnalTmbcbhrinaealarcdtfydbao2cdtfhwcbhiinavcCfaifgDawaifIdbgqaDIdbgkakaq9EEUdbavcwfaifgDaqaDIdbgkakaq9DEUdbaiclfgicx9hmbkarcefgrad9hmbxikkaocdthrcbhwincbhiinavcCfaifgDaeaifIdbgqaDIdbgkakaq9EEUdbavcwfaifgDaqaDIdbgkakaq9DEUdbaiclfgicx9hmbkaearfheawcefgwad9hmbxdkkdnalTmbcbhrinabarcx2fgiaealarcdtfydbao2cdtfgwIdbUdbaiawIdlUdlaiawIdwUdwcbhiinavcCfaifgDawaifIdbgqaDIdbgkakaq9EEUdbavcwfaifgDaqaDIdbgkakaq9DEUdbaiclfgicx9hmbkarcefgrad9hmbxdkkaocdthlcbhraehwinabarcx2fgiaearao2cdtfgDIdbUdbaiaDIdlUdlaiaDIdwUdwcbhiinavcCfaifgDawaifIdbgqaDIdbgkakaq9EEUdbavcwfaifgDaqaDIdbgkakaq9DEUdbaiclfgicx9hmbkawalfhwarcefgrad9hmbkkJbbbbavIdwavIdCgk:tgqaqJbbbb9DEgqavIdxavIdKgx:tgmamaq9DEgqavIdzavId3gm:tgPaPaq9DEhPdnabTmbadTmbJbbbbJbbjZaP:vaPJbbbb9BEhqinabaqabIdbak:tNUdbabclfgvaqavIdbax:tNUdbabcwfgvaqavIdbam:tNUdbabcxfhbadcufgdmbkkaPk8MbabaeadaialavcbcbcbcbcbaoarawaDz:bjjjbk8MbabaeadaialavaoarawaDaqakaxamaPz:bjjjbk:nCoDud99rue99lul998Jjjjjbc;Wb9Rgw8KjjjjbdndnarmbcbhDxekawcxfcbc;Kbz:ljjjb8Aawcuadcx2adc;v:Q;v:Qe0Ecbyd;S1jjbHjjjjbbgqBdxawceBd2aqaeadaicbz:djjjb8AawcuadcdtadcFFFFi0Egkcbyd;S1jjbHjjjjbbgxBdzawcdBd2adcd4adfhmceheinaegicetheaiam6mbkcbhPawcuaicdtgsaicFFFFi0Ecbyd;S1jjbHjjjjbbgzBdCawciBd2dndnar:ZgH:rJbbbZMgO:lJbbb9p9DTmbaO:Ohexekcjjjj94hekaicufhAc:bwhmcbhCadhXcbhQinaChLaeamgKcufaeaK9iEaPgDcefaeaD9kEhYdndnadTmbaYcuf:YhOaqhiaxheadhmindndnaiIdbaONJbbbZMg8A:lJbbb9p9DTmba8A:OhCxekcjjjj94hCkaCcCthCdndnaiclfIdbaONJbbbZMg8A:lJbbb9p9DTmba8A:OhExekcjjjj94hEkaEcqtaCVhCdndnaicwfIdbaONJbbbZMg8A:lJbbb9p9DTmba8A:OhExekcjjjj94hEkaeaCaEVBdbaicxfhiaeclfheamcufgmmbkazcFeasz:ljjjbh3cbh5cbh8Eindna3axa8EcdtfydbgCcm4aC7c:v;t;h;Ev2gics4ai7aAGgmcdtfgEydbgecuSmbaeaCSmbcehiina3amaifaAGgmcdtfgEydbgecuSmeaicefhiaeaC9hmbkkaEaCBdba5aecuSfh5a8Ecefg8Ead9hmbxdkkazcFeasz:ljjjb8Acbh5kaDaYa5ar0giEhPaLa5aiEhCdna5arSmbaYaKaiEgmaP9Rcd9imbdndnaQcl0mbdnaX:ZgOaL:Zg8A:taY:Yg8FaD:Y:tgaa8FaK:Y:tgha5:ZggaH:tNNNaOaH:tahNa8Aag:tNa8AaH:taaNagaO:tNM:va8FMJbbbZMgO:lJbbb9p9DTmbaO:Ohexdkcjjjj94hexekaPamfcd9Theka5aXaiEhXaQcefgQcs9hmekkdndnaCmbcihicbhDxekcbhiawakcbyd;S1jjbHjjjjbbg8EBdKawclBd2aPcuf:Yh8AdndnadTmbaqhiaxheadhmindndnaiIdba8ANJbbbZMgO:lJbbb9p9DTmbaO:OhCxekcjjjj94hCkaCcCthCdndnaiclfIdba8ANJbbbZMgO:lJbbb9p9DTmbaO:OhExekcjjjj94hEkaEcqtaCVhCdndnaicwfIdba8ANJbbbZMgO:lJbbb9p9DTmbaO:OhExekcjjjj94hEkaeaCaEVBdbaicxfhiaeclfheamcufgmmbkazcFeasz:ljjjbh3cbhDcbh5inaxa5cdtgYfydbgCcm4aC7c:v;t;h;Ev2gics4ai7hecbhidndnina3aeaAGgmcdtfgEydbgecuSmednaxaecdtgEfydbaCSmbaicefgiamfheaiaA9nmekka8EaEfydbhixekaEa5BdbaDhiaDcefhDka8EaYfaiBdba5cefg5ad9hmbkcuaDc32giaDc;j:KM;jb0EhexekazcFeasz:ljjjb8AcbhDcbhekawaecbyd;S1jjbHjjjjbbgeBd3awcvBd2aecbaiz:ljjjbhEavcd4hxdnadTmbdnalTmbaxcdth3a8EhCalheaqhmadhAinaEaCydbc32fgiamIdbaiIdbMUdbaiamclfIdbaiIdlMUdlaiamcwfIdbaiIdwMUdwaiaeIdbaiIdxMUdxaiaeclfIdbaiIdzMUdzaiaecwfIdbaiIdCMUdCaiaiIdKJbbjZMUdKaCclfhCaea3fheamcxfhmaAcufgAmbxdkka8EhmaqheadhCinaEamydbc32fgiaeIdbaiIdbMUdbaiaeclfIdbaiIdlMUdlaiaecwfIdbaiIdwMUdwaiaiIdxJbbbbMUdxaiaiIdzJbbbbMUdzaiaiIdCJbbbbMUdCaiaiIdKJbbjZMUdKamclfhmaecxfheaCcufgCmbkkdnaDTmbaEhiaDheinaiaiIdbJbbbbJbbjZaicKfIdbgO:vaOJbbbb9BEgONUdbaiclfgmaOamIdbNUdbaicwfgmaOamIdbNUdbaicxfgmaOamIdbNUdbaiczfgmaOamIdbNUdbaicCfgmaOamIdbNUdbaic3fhiaecufgembkkcbhCawcuaDcdtgYaDcFFFFi0Egicbyd;S1jjbHjjjjbbgeBdaawcoBd2awaicbyd;S1jjbHjjjjbbg3Bd8KaecFeaYz:ljjjbh5dnadTmbJbbjZJbbjZa8A:vaPceSEaoNgOaONh8Aaxcdthxalheina8Aaec;C1jjbalEgmIdwaEa8EydbgAc32fgiIdC:tgOaONamIdbaiIdx:tgOaONamIdlaiIdz:tgOaONMMNaqcwfIdbaiIdw:tgOaONaqIdbaiIdb:tgOaONaqclfIdbaiIdl:tgOaONMMMhOdndna5aAcdtgifgmydbcuSmba3aifIdbaO9ETmekamaCBdba3aifaOUdbka8Eclfh8EaeaxfheaqcxfhqadaCcefgC9hmbkkaba5aYz:kjjjb8AcrhikaicdthiinaiTmeaic98fgiawcxffydbcbyd;O1jjbH:bjjjbbxbkkawc;Wbf8KjjjjbaDk:Odieui99iu8Jjjjjbca9RgicFFF;7rBd3ai9cFFF;7;3FF:;Fb83dCaicFFF97Bdzai9cFFF;7FFF:;u83dwdndnaembJbbjFhlJbbjFhvJbbjFhoxekadcd4cdthrcbhwincbhdinaicCfadfgDabadfIdbglaDIdbgvaval9EEUdbaicwfadfgDalaDIdbgvaval9DEUdbadclfgdcx9hmbkabarfhbawcefgwae9hmbkaiIdzaiId3:thoaiIdxaiIdK:thvaiIdwaiIdC:thlkJbbbbalalJbbbb9DEglavaval9DEglaoaoal9DEk9DeeuabcFeaicdtz:ljjjbhlcbhbdnadTmbindnalaeydbcdtfgiydbcu9hmbaiabBdbabcefhbkaeclfheadcufgdmbkkabk9teiucbcbyd;W1jjbgeabcifc98GfgbBd;W1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabk9teiucbcbyd;W1jjbgeabcrfc94GfgbBd;W1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik9:eiuZbhedndncbyd;W1jjbgdaecztgi9nmbcuheadai9RcFFifcz4nbcuSmekadhekcbabae9Rcifc98Gcbyd;W1jjbfgdBd;W1jjbdnadZbcztge9nmbadae9RcFFifcz4nb8Akk6eiucbhidnadTmbdninabRbbglaeRbbgv9hmeaecefheabcefhbadcufgdmbxdkkalav9Rhikaikk:bedbcjwk9Oeeebeebebbeeebebbbbbebebbbbbbbbbebbbdbbbbbbbebbbebbbdbbbbbbbbbbbeeeeebebbebbebebbbeebbbbbbbbbbbbbbbbbbbbbc;OwkxebbbdbbbjNbb",J=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!=="object")return{supported:!1};var $,Y=WebAssembly.instantiate(Q(Z),{}).then(function(U){$=U.instance,$.exports.__wasm_call_ctors()});function Q(U){var w=new Uint8Array(U.length);for(var L=0;L<U.length;++L){var O=U.charCodeAt(L);w[L]=O>96?O-97:O>64?O-39:O+4}var j=0;for(var L=0;L<U.length;++L)w[j++]=w[L]<60?J[w[L]]:(w[L]-60)*64+w[++L];return w.buffer.slice(0,j)}function W(U){if(!U)throw new Error("Assertion failed")}function X(U){return new Uint8Array(U.buffer,U.byteOffset,U.byteLength)}function K(U,w,L){var O=$.exports.sbrk,j=O(w.length*4),M=O(L*4),N=new Uint8Array($.exports.memory.buffer),D=X(w);N.set(D,j);var P=U(M,j,w.length,L);N=new Uint8Array($.exports.memory.buffer);var C=new Uint32Array(L);new Uint8Array(C.buffer).set(N.subarray(M,M+L*4)),D.set(N.subarray(j,j+w.length*4)),O(j-O(0));for(var T=0;T<w.length;++T)w[T]=C[w[T]];return[C,P]}function G(U){var w=0;for(var L=0;L<U.length;++L){var O=U[L];w=w<O?O:w}return w}function z(U,w,L,O,j,M,N,D,P){var C=$.exports.sbrk,T=C(4),E=C(L*4),A=C(j*M),S=C(L*4),x=new Uint8Array($.exports.memory.buffer);x.set(X(O),A),x.set(X(w),S);var I=U(E,S,L,A,j,M,N,D,P,T);x=new Uint8Array($.exports.memory.buffer);var v=new Uint32Array(I);X(v).set(x.subarray(E,E+I*4));var f=new Float32Array(1);return X(f).set(x.subarray(T,T+4)),C(T-C(0)),[v,f[0]]}function H(U,w,L,O,j,M,N,D,P,C,T,E,A){var S=$.exports.sbrk,x=S(4),I=S(L*4),v=S(j*M),f=S(j*D),p=S(P.length*4),n=S(L*4),o=C?S(j):0,$0=new Uint8Array($.exports.memory.buffer);if($0.set(X(O),v),$0.set(X(N),f),$0.set(X(P),p),$0.set(X(w),n),C)$0.set(X(C),o);var W0=U(I,n,L,v,j,M,f,D,p,P.length,o,T,E,A,x);$0=new Uint8Array($.exports.memory.buffer);var C0=new Uint32Array(W0);X(C0).set($0.subarray(I,I+W0*4));var T0=new Float32Array(1);return X(T0).set($0.subarray(x,x+4)),S(x-S(0)),[C0,T0[0]]}function V(U,w,L,O){var j=$.exports.sbrk,M=j(L*O),N=new Uint8Array($.exports.memory.buffer);N.set(X(w),M);var D=U(M,L,O);return j(M-j(0)),D}function q(U,w,L,O,j,M,N,D){var P=$.exports.sbrk,C=P(D*4),T=P(L*O),E=P(L*M),A=new Uint8Array($.exports.memory.buffer);if(A.set(X(w),T),j)A.set(X(j),E);var S=U(C,T,L,O,E,M,N,D);A=new Uint8Array($.exports.memory.buffer);var x=new Uint32Array(S);return X(x).set(A.subarray(C,C+S*4)),P(C-P(0)),x}var F={LockBorder:1,Sparse:2,ErrorAbsolute:4,Prune:8,_InternalDebug:1073741824};return{ready:Y,supported:!0,useExperimentalFeatures:!1,compactMesh:function(U){W(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),W(U.length%3==0);var w=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return K($.exports.meshopt_optimizeVertexFetchRemap,w,G(U)+1)},simplify:function(U,w,L,O,j,M){W(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),W(U.length%3==0),W(w instanceof Float32Array),W(w.length%L==0),W(L>=3),W(O>=0&&O<=U.length),W(O%3==0),W(j>=0);var N=0;for(var D=0;D<(M?M.length:0);++D)W(M[D]in F),W(this.useExperimentalFeatures||M[D]!="Prune"),N|=F[M[D]];var P=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),C=z($.exports.meshopt_simplify,P,U.length,w,w.length/L,L*4,O,j,N);return C[0]=U instanceof Uint32Array?C[0]:new U.constructor(C[0]),C},simplifyWithAttributes:function(U,w,L,O,j,M,N,D,P,C){W(this.useExperimentalFeatures),W(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),W(U.length%3==0),W(w instanceof Float32Array),W(w.length%L==0),W(L>=3),W(O instanceof Float32Array),W(O.length%j==0),W(j>=0),W(N==null||N instanceof Uint8Array),W(N==null||N.length==w.length/L),W(D>=0&&D<=U.length),W(D%3==0),W(P>=0),W(Array.isArray(M)),W(j>=M.length),W(M.length<=32);for(var T=0;T<M.length;++T)W(M[T]>=0);var E=0;for(var T=0;T<(C?C.length:0);++T)W(C[T]in F),E|=F[C[T]];var A=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),S=H($.exports.meshopt_simplifyWithAttributes,A,U.length,w,w.length/L,L*4,O,j*4,new Float32Array(M),N?new Uint8Array(N):null,D,P,E);return S[0]=U instanceof Uint32Array?S[0]:new U.constructor(S[0]),S},getScale:function(U,w){return W(U instanceof Float32Array),W(U.length%w==0),W(w>=3),V($.exports.meshopt_simplifyScale,U,U.length/w,w*4)},simplifyPoints:function(U,w,L,O,j,M){if(W(this.useExperimentalFeatures),W(U instanceof Float32Array),W(U.length%w==0),W(w>=3),W(L>=0&&L<=U.length/w),O)return W(O instanceof Float32Array),W(O.length%j==0),W(j>=3),W(U.length/w==O.length/j),q($.exports.meshopt_simplifyPoints,U,U.length/w,w*4,O,j*4,M,L);else return q($.exports.meshopt_simplifyPoints,U,U.length/w,w*4,void 0,0,0,L)}}}();var JV6=function(){var Z="b9H79Tebbbefx9Geueu9Geub9Gbb9Giuuueu9Gkuuuuuuuuuu99eu9Gvuuuuueu9Gkuuuuuuuuu9999eu9Gruuuuuuub9Gkuuuuuuuuuuueu9Gouuuuuub9Giuuub9GluuuubiOHdilvorwDqrkbiibeilve9Weiiviebeoweuec:q:Odkr:Yewo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9I919P29K9nW79O2Wt79c9V919U9KbeX9TW79O9V9Wt9F9I919P29K9nW79O2Wt7bd39TW79O9V9Wt9F9J9V9T9W91tWJ2917tWV9c9V919U9K7br39TW79O9V9Wt9F9J9V9T9W91tW9nW79O2Wt9c9V919U9K7bDL9TW79O9V9Wt9F9V9Wt9P9T9P96W9nW79O2Wtbql79IV9RbkDwebcekdsPq;L9kHdbkIbabaec9:fgefcufae9Ugeabci9Uadfcufad9Ugbaeab0Ek:oAlPue99eux998Jjjjjbc:We9Rgk8Kjjjjbakc;mbfcbc;Kbz:njjjb8AakcuaocdtgxaocFFFFi0Egmcbyd:e1jjbHjjjjbbgPBd9makceBd:SeakaPBdnakamcbyd:e1jjbHjjjjbbgsBd9qakcdBd:SeakasBd9eakcualcdtalcFFFFi0Ecbyd:e1jjbHjjjjbbgzBd9uakazBd9iakciBd:SeaPcbaxz:njjjbhHalci9UhOdnalTmbaihPalhAinaHaPydbcdtfgCaCydbcefBdbaPclfhPaAcufgAmbkkdnaoTmbcbhPashAaHhCaohXinaAaPBdbaAclfhAaCydbaPfhPaCclfhCaXcufgXmbkkdnalci6mbcbhPaihAinaAcwfydbhCaAclfydbhXasaAydbcdtfgQaQydbgQcefBdbazaQcdtfaPBdbasaXcdtfgXaXydbgXcefBdbazaXcdtfaPBdbasaCcdtfgCaCydbgCcefBdbazaCcdtfaPBdbaAcxfhAaOaPcefgP9hmbkkdnaoTmbaHhAashPaohCinaPaPydbaAydb9RBdbaAclfhAaPclfhPaCcufgCmbkkakamcbyd:e1jjbHjjjjbbgPBd9yakclBd:SeaPaHaxz:mjjjbhmakaOcbyd:e1jjbHjjjjbbgPBd9CakcvBd:SeaPcbaOz:njjjbhLakcuaOcK2alcjjjjd0Ecbyd:e1jjbHjjjjbbgKBd9GakcoBd:SeJbbbbhYdnalci6g8Ambarcd4hxaihAaKhPaOhrJbbbbhEinavaAclfydbax2cdtfgCIdlh3avaAydbax2cdtfgXIdlhYavaAcwfydbax2cdtfgQIdlh5aCIdwh8EaXIdwh8FaQIdwhaaPaCIdbghaXIdbggMaQIdbg8JMJbbnn:vUdbaPclfaXIdlaCIdlMaQIdlMJbbnn:vUdbaQIdwh8KaCIdwh8LaXIdwh8MaPcxfa3aY:tg3aaa8F:tgaNa5aY:tg5a8Ea8F:tg8EN:tgYJbbbbJbbjZahag:tgha5Na8Jag:tgga3N:tg8Fa8FNaYaYNa8EagNaaahN:tgYaYNMM:rgg:vagJbbbb9BEg3NUdbaPczfaYa3NUdbaPcCfa8Fa3NUdbaPcwfa8Ka8Ma8LMMJbbnn:vUdbaEagMhEaAcxfhAaPcKfhParcufgrmbkaEaO:Z:vJbbbZNhYkakcuaOcdtalcFFFF970Ecbyd:e1jjbHjjjjbbgCBd9KakcrBd:SeaYaD:ZN:rhYdna8AmbcbhPaChAinaAaPBdbaAclfhAaOaPcefgP9hmbkkaYJbbbZNh8MakcuaOcltalcFFFFd0Ecbyd:e1jjbHjjjjbbg8ABd9OakcwBd:Secba8AaKaCaOz:djjjb8Aakaocbyd:e1jjbHjjjjbbgPBd2aPcFeaoz:njjjbhrakc8Wfcwf9cb83ibak9cb83i8WcbhPJbbbbhEJbbbbh5Jbbbbh8EJbbbbhYJbbbbh8FJbbbbhgcbhlinJbbbbh3dnaPTmbJbbjZaP:Z:vh3kaka8Ea3NgaUdaaka5a3NghUd3akaEa3Ng8JUdKJbbbbh3dnagagNaYaYNa8Fa8FNMMg8KJbbbb9BmbJbbjZa8K:r:vh3kakaga3NUd8Saka8Fa3NUdyakaYa3NUd8Kdndndnakyd8WgQakydUgAakcKfaeaiakc;abfaKamara8Maqz:ejjjbgCcuSmbdnaPaD9pmbaAaraiaCcx2fgXydbfRbbcFeSfaraXclfydbfRbbcFeSfaraXcwfydbfRbbcFeSfaw9nmdkaQaAcbaeaiakc;abfaKamara8MJbbbbz:ejjjbgCcu9hmekakaaUdCakahUdzaka8JUdxakcuBdwakcFFF;7rBdla8AcbaKaLakcxfakcwfakclfz:fjjjbakydwgCcuSmekdnakc8WfaiaCcx2fgOydbgPaOclfydbgAaOcwfydbgXarabaeadalawaDz:gjjjbTmbalcefhlJbbbbhEJbbbbh5Jbbbbh8EJbbbbhYJbbbbh8FJbbbbhgkamaPcdtfgPaPydbcufBdbamaAcdtfgPaPydbcufBdbamaXcdtfgPaPydbcufBdbcbhXinazasaOaXcdtfydbcdtgAfydbcdtfgxhPaHaAfgvydbgQhAdnaQTmbdninaPydbaCSmeaPclfhPaAcufgATmdxbkkaPaxaQcdtfc98fydbBdbavavydbcufBdbkaXcefgXci9hmbkaKaCcK2fgPIdbh3aPIdlhaaPIdwhhaPIdxh8JaPIdzh8KaPIdCh8LaLaCfce86bbaga8LMhga8Fa8KMh8FaYa8JMhYa8EahMh8Ea5aaMh5aEa3MhEakyd88hPxekkdnaPTmbdnakyd80gAaPci2fgCciGTmbadaCfcbaPaAcu7fciGcefz:njjjb8AkabalcltfgPak8Pi8W83dbaPcwfakc8Wfcwf8Pib83dbalcefhlkcahPdninaPc98Smeakc;mbfaPfydbcbydj1jjbH:bjjjbbaPc98fhPxbkkakc:Wef8Kjjjjbalk;3vivuv99lu8Jjjjjbca9Rgv8Kjjjjbdndnalcw0mbaiydbhoaeabcitfgralcdtcufBdlaraoBdbdnalcd6mbaiclfhoalcufhwarcxfhrinaoydbhDarcuBdbarc98faDBdbarcwfhraoclfhoawcufgwmbkkalabfhrxekcbhDavczfcwfcbBdbav9cb83izavcwfcbBdbav9cb83ibJbbjZhqJbbjZhkinadaiaDcdtfydbcK2fhwcbhrinavczfarfgoawarfIdbgxaoIdbgm:tgPakNamMgmUdbavarfgoaPaxam:tNaoIdbMUdbarclfgrcx9hmbkJbbjZaqJbbjZMgq:vhkaDcefgDal9hmbkcbhoadcbcecdavIdlgxavIdwgm9GEgravIdbgPam9GEaraPax9GEgscdtgrfhzavczfarfIdbhxaihralhwinaiaocdtfgDydbhHaDarydbgOBdbaraHBdbarclfhraoazaOcK2fIdbax9Dfhoawcufgwmbkaeabcitfhrdndnaocv6mbaoalc98f6mekaraiydbBdbaralcdtcufBdlaiclfhoalcufhwarcxfhrinaoydbhDarcuBdbarc98faDBdbarcwfhraoclfhoawcufgwmbkalabfhrxekaraxUdbaeabcitfgrarydlc98GasVBdlabcefaeadaiaoz:djjjbhwararydlciGawabcu7fcdtVBdlawaeadaiaocdtfalao9Rz:djjjbhrkavcaf8Kjjjjbark;Bloeue99vue99Due99dndnaembcuhkxekJbbjZaq:thxaiabcdtfhmavydbhPavydlhsavydwhzcbhHJFFuuhOcvhbcuhkindnaPamaHcdtfydbcdtgvfydbgATmbazasavfydbcdtfhiindndnawalaiydbgCcx2fgvclfydbgXfRbbcFeSawavydbgQfRbbcFeSfawavcwfydbgLfRbbcFeSfgKmbcbhvxekcehvaraQcdtfydbgYceSmbcehvaraXcdtfydbg8AceSmbcehvaraLcdtfydbgEceSmbdna8AcdSaYcdSfaEcdSfcd6mbaKcefhvxekaKcdfhvkdnavab9kmbdndnadTmbaoaCcK2fgQIdwadIdw:tg3a3NaQIdbadIdb:tg3a3NaQIdladIdl:tg3a3NMM:raD:vaxNJbbjZMJ9VO:d86JbbjZaQIdCadIdCNaQIdxadIdxNaQIdzadIdzNMMaqN:tg3a3J9VO:d869DENh3xekaraQcdtfydbaraXcdtfydbfaraLcdtfydbfc99f:Zh3kaCakavab6a3aO9DVgQEhkavabaQEhba3aOaQEhOkaiclfhiaAcufgAmbkkaHcefgHae9hmbkkakk;bddlue99dndndnabaecitfgrydlgwciGgDci9hmbarclfhqxekinabcbawcd4gwalaDcdtfIdbabaecitfIdb:tgkJbbbb9FEgDaecefgefadaialavaoz:fjjjbak:laoIdb9FTmdabaDaw7aefgecitfgrydlgwciGgDci9hmbkarclfhqkabaecitfhecuhbindnaiaeydbgDfRbbmbadaDcK2fgrIdwalIdw:tgkakNarIdbalIdb:tgkakNarIdlalIdl:tgkakNMM:rgkaoIdb9DTmbaoakUdbavaDBdbaqydbhwkaecwfheabcefgbawcd46mbkkk;yleoudnaladfgkRbbcFeSalaefgxRbbgmcFeSfabydwgPfalaifgsRbbcFeSfaD0abydxaq9pVgzce9hmbavawcltfgmab8Pdb83dbamcwfabcwfgm8Pdb83dbdndnamydbmbcbhqxekcbhDaohminalamabydbcdtfydbfcFe86bbamclfhmaDcefgDabydwgq6mbkkdnabydxglci2gDabydlgmfgPciGTmbaraPfcbalamcu7fciGcefz:njjjb8Aabydxci2hDabydlhmabydwhqkab9cb83dwababydbaqfBdbabaDcifc98GamfBdlaxRbbhmcbhPkdnamcFeGcFe9hmbaxaP86bbababydwgmcefBdwaoabydbcdtfamcdtfaeBdbkdnakRbbcFe9hmbakabydw86bbababydwgmcefBdwaoabydbcdtfamcdtfadBdbkdnasRbbcFe9hmbasabydw86bbababydwgmcefBdwaoabydbcdtfamcdtfaiBdbkarabydlfabydxci2faxRbb86bbarabydlfabydxci2fcefakRbb86bbarabydlfabydxci2fcdfasRbb86bbababydxcefBdxazk;Ckovud99euv99eul998Jjjjjbc:G;ae9Rgo8KjjjjbdndnadTmbavcd4hrcbhwcbhDindnaiaeclfydbar2cdtfgvIdbaiaeydbar2cdtfgqIdbgk:tgxaiaecwfydbar2cdtfgmIdlaqIdlgP:tgsNamIdbak:tgzavIdlaP:tgPN:tgkakNaPamIdwaqIdwgH:tgONasavIdwaH:tgHN:tgPaPNaHazNaOaxN:tgxaxNMM:rgsJbbbb9Bmbaoc:G:qefawcx2fgAakas:vUdwaAaxas:vUdlaAaPas:vUdbaocafawc8K2fgAaq8Pdb83dbaAav8Pdb83dxaAam8Pdb83dKaAcwfaqcwfydbBdbaAcCfavcwfydbBdbaAcafamcwfydbBdbawcefhwkaecxfheaDcifgDad6mbkab9cb83dbabcyf9cb83dbabcaf9cb83dbabcKf9cb83dbabczf9cb83dbabcwf9cb83dbawTmeao9cb83iKao9cb83izaoczfaocafawci2z1jjjbaoIdKhCaoIdChXaoIdzhQao9cb83iwao9cb83ibaoaoc:G:qefawz1jjjbJbbjZhkaoIdwgPJbbbbJbbjZaPaPNaoIdbgPaPNaoIdlgsasNMM:rgx:vaxJbbbb9BEgzNhxasazNhsaPazNhzaoc:G:qefheawhvinaecwfIdbaxNaeIdbazNasaeclfIdbNMMgPakaPak9DEhkaecxfheavcufgvmbkabaCUdwabaXUdlabaQUdbabaoId3UdxdndnakJ;n;m;m899FmbJbbbbhPaoc:G:qefheaocafhvinaCavcwfIdb:taecwfIdbgHNaQavIdb:taeIdbgONaXavclfIdb:taeclfIdbgLNMMaxaHNazaONasaLNMM:vgHaPaHaP9EEhPavc8KfhvaecxfheawcufgwmbkabazUd3abc8KfaxUdbabcafasUdbabcKfaCaxaPN:tUdbabcCfaXasaPN:tUdbabaQazaPN:tUdzabJbbjZakakN:t:rgkUdydndnaxJbbj:;axJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;axJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohexekcjjjj94hekabc8Ufae86bbdndnasJbbj:;asJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;asJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkabcRfav86bbdndnazJbbj:;azJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;azJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohqxekcjjjj94hqkabaq86b8SdndnaecKtcK91:YJbb;:9c:vax:t:lavcKtcK91:YJbb;:9c:vas:t:laqcKtcK91:YJbb;:9c:vaz:t:lakMMMJbb;:9cNJbbjZMgk:lJbbb9p9DTmbak:Ohexekcjjjj94hekaecFbaecFb9iEhexekabcjjj;8iBdycFbhekabae86b8Vxekab9cb83dbabcyf9cb83dbabcaf9cb83dbabcKf9cb83dbabczf9cb83dbabcwf9cb83dbkaoc:G;aef8Kjjjjbk:mvdouq99cbhi8Jjjjjbca9RglczfcwfcbBdbal9cb83izalcwfcbBdbal9cb83ibdnadTmbcbhvinaeaifhocbhrinalczfarfgwavawydbgwaoarfIdbgDaearawcx2ffIdb9DEBdbalarfgwavawydbgwaDaearawcx2ffIdb9EEBdbarclfgrcx9hmbkaicxfhiavcefgvad9hmbkkJbbbbhDcbhrcbhicbhvinaealarfydbcx2fgwIdwaealczfarfydbcx2fgoIdw:tgqaqNawIdbaoIdb:tgqaqNawIdlaoIdl:tgqaqNMMgqaDaqaD9EgwEhDavaiawEhiarclfhravcefgvci9hmbkaealczfaicdtgvfydbcx2fgrIdwaealavfydbcx2fglIdwMJbbbZNhqarIdlalIdlMJbbbZNhkarIdbalIdbMJbbbZNhxaD:rJbbbZNhDdnadTmbindnaecwfIdbgmaq:tgPaPNaeIdbgsax:tgPaPNaeclfIdbgzak:tgPaPNMMgPaDaDN9ETmbaqaDaP:rgH:vJbbbZNJbbbZMgPNamJbbjZaP:tgONMhqakaPNazaONMhkaxaPNasaONMhxaDaHMJbbbZNhDkaecxfheadcufgdmbkkabaDUdxabaqUdwabakUdlabaxUdbkjeeiu8Jjjjjbcj8W9Rgr8Kjjjjbaici2hwdnaiTmbawceawce0EhDarhiinaiaeadRbbcdtfydbBdbadcefhdaiclfhiaDcufgDmbkkabarawaladaoz:hjjjbarcj8Wf8Kjjjjbk:Ylequ8Jjjjjbcjx9Rgl8Kjjjjbcbhvalcjqfcbaiz:njjjb8AdndnadTmbcjehoaehrincuhwarhDcuhqavhkdninawakaoalcjqfaDcefRbbfRbb9RcFeGci6aoalcjqfaDRbbfRbb9RcFeGci6faoalcjqfaDcdfRbbfRbb9RcFeGci6fgxaq9mgmEhwdnammbaxce0mdkaxaqaxaq9kEhqaDcifhDadakcefgk9hmbkkaeawci2fgDcdfRbbhqaDcefRbbhxaDRbbhkaeavci2fgDcifaDawav9Rci2z:qjjjb8Aakalcjqffaocefgo86bbaxalcjqffao86bbaDcdfaq86bbaDcefax86bbaDak86bbaqalcjqffao86bbarcifhravcefgvad9hmbkalcFeaiz:njjjbhoadci2gDceaDce0EhqcbhxindnaoaeRbbgkfgwRbbgDcFe9hmbawax86bbaocjdfaxcdtfabakcdtfydbBdbaxhDaxcefhxkaeaD86bbaecefheaqcufgqmbkaxcdthDxekcbhDkabalcjdfaDz:mjjjb8Aalcjxf8Kjjjjbk9teiucbcbyd11jjbgeabcifc98GfgbBd11jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabk9teiucbcbyd11jjbgeabcrfc94GfgbBd11jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik9:eiuZbhedndncbyd11jjbgdaecztgi9nmbcuheadai9RcFFifcz4nbcuSmekadhekcbabae9Rcifc98Gcbyd11jjbfgdBd11jjbdnadZbcztge9nmbadae9RcFFifcz4nb8Akk:;Deludndndnadch9pmbabaeSmdaeabadfgi9Rcbadcet9R0mekabaead;8qbbxekaeab7ciGhldndndnabae9pmbdnalTmbadhvabhixikdnabciGmbadhvabhixdkadTmiabaeRbb86bbadcufhvdnabcefgiciGmbaecefhexdkavTmiabaeRbe86beadc9:fhvdnabcdfgiciGmbaecdfhexdkavTmiabaeRbd86bdadc99fhvdnabcifgiciGmbaecifhexdkavTmiabaeRbi86biabclfhiaeclfheadc98fhvxekdnalmbdnaiciGTmbadTmlabadcufgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc9:fgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc99fgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc98fgdfaeadfRbb86bbkadcl6mbdnadc98fgocd4cefciGgiTmbaec98fhlabc98fhvinavadfaladfydbBdbadc98fhdaicufgimbkkaocx6mbaec9Wfhvabc9WfhoinaoadfgicxfavadfglcxfydbBdbaicwfalcwfydbBdbaiclfalclfydbBdbaialydbBdbadc9Wfgdci0mbkkadTmdadhidnadciGglTmbaecufhvabcufhoadhiinaoaifavaifRbb86bbaicufhialcufglmbkkadcl6mdaec98fhlabc98fhvinavaifgecifalaifgdcifRbb86bbaecdfadcdfRbb86bbaecefadcefRbb86bbaeadRbb86bbaic98fgimbxikkavcl6mbdnavc98fglcd4cefcrGgdTmbavadcdt9RhvinaiaeydbBdbaeclfheaiclfhiadcufgdmbkkalc36mbinaiaeydbBdbaiaeydlBdlaiaeydwBdwaiaeydxBdxaiaeydzBdzaiaeydCBdCaiaeydKBdKaiaeyd3Bd3aecafheaicafhiavc9Gfgvci0mbkkavTmbdndnavcrGgdmbavhlxekavc94GhlinaiaeRbb86bbaicefhiaecefheadcufgdmbkkavcw6mbinaiaeRbb86bbaiaeRbe86beaiaeRbd86bdaiaeRbi86biaiaeRbl86blaiaeRbv86bvaiaeRbo86boaiaeRbr86braicwfhiaecwfhealc94fglmbkkabkkAebcjwkxebbbdbbbzNbb",J=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!=="object")return{supported:!1};var $,Y=WebAssembly.instantiate(Q(Z),{}).then(function(U){$=U.instance,$.exports.__wasm_call_ctors()});function Q(U){var w=new Uint8Array(U.length);for(var L=0;L<U.length;++L){var O=U.charCodeAt(L);w[L]=O>96?O-97:O>64?O-39:O+4}var j=0;for(var L=0;L<U.length;++L)w[j++]=w[L]<60?J[w[L]]:(w[L]-60)*64+w[++L];return w.buffer.slice(0,j)}function W(U){if(!U)throw new Error("Assertion failed")}function X(U){return new Uint8Array(U.buffer,U.byteOffset,U.byteLength)}var K=48,G=16;function z(U,w){var L=U.meshlets[w*4+0],O=U.meshlets[w*4+1],j=U.meshlets[w*4+2],M=U.meshlets[w*4+3];return{vertices:U.vertices.subarray(L,L+j),triangles:U.triangles.subarray(O,O+M*3)}}function H(U,w,L,O,j,M,N){var D=$.exports.sbrk,P=$.exports.meshopt_buildMeshletsBound(U.length,j,M),C=D(P*G),T=D(P*j*4),E=D(P*M*3),A=D(U.byteLength),S=D(w.byteLength),x=new Uint8Array($.exports.memory.buffer);x.set(X(U),A),x.set(X(w),S);var I=$.exports.meshopt_buildMeshlets(C,T,E,A,U.length,S,L,O,j,M,N);x=new Uint8Array($.exports.memory.buffer);var v=x.subarray(C,C+I*G),f=new Uint32Array(v.buffer,v.byteOffset,v.byteLength/4).slice();for(var p=0;p<I;++p){var n=f[p*4+0],o=f[p*4+1],L=f[p*4+2],$0=f[p*4+3];$.exports.meshopt_optimizeMeshlet(T+n*4,E+o,$0,L)}var W0=f[(I-1)*4+0],C0=f[(I-1)*4+1],T0=f[(I-1)*4+2],a0=f[(I-1)*4+3],_8=W0+T0,s1=C0+(a0*3+3&-4),u4={meshlets:f,vertices:new Uint32Array(x.buffer,T,_8).slice(),triangles:new Uint8Array(x.buffer,E,s1*3).slice(),meshletCount:I};return D(C-D(0)),u4}function V(U){var w=new Float32Array($.exports.memory.buffer,U,K/4);return{centerX:w[0],centerY:w[1],centerZ:w[2],radius:w[3],coneApexX:w[4],coneApexY:w[5],coneApexZ:w[6],coneAxisX:w[7],coneAxisY:w[8],coneAxisZ:w[9],coneCutoff:w[10]}}function q(U,w,L,O){var j=$.exports.sbrk,M=[],N=j(w.byteLength),D=j(U.vertices.byteLength),P=j(U.triangles.byteLength),C=j(K),T=new Uint8Array($.exports.memory.buffer);T.set(X(w),N),T.set(X(U.vertices),D),T.set(X(U.triangles),P);for(var E=0;E<U.meshletCount;++E){var A=U.meshlets[E*4+0],S=U.meshlets[E*4+0+1],x=U.meshlets[E*4+0+3];$.exports.meshopt_computeMeshletBounds(C,D+A*4,P+S,x,N,L,O),M.push(V(C))}return j(N-j(0)),M}function F(U,w,L,O){var j=$.exports.sbrk,M=j(K),N=j(U.byteLength),D=j(w.byteLength),P=new Uint8Array($.exports.memory.buffer);P.set(X(U),N),P.set(X(w),D),$.exports.meshopt_computeClusterBounds(M,N,U.length,D,L,O);var C=V(M);return j(M-j(0)),C}return{ready:Y,supported:!0,buildMeshlets:function(U,w,L,O,j,M){W(U.length%3==0),W(w instanceof Float32Array),W(w.length%L==0),W(L>=3),W(O<=255||O>0),W(j<=512),W(j%4==0),M=M||0;var N=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return H(N,w,w.length/L,L*4,O,j,M)},computeClusterBounds:function(U,w,L){W(U.length%3==0),W(U.length/3<=512),W(w instanceof Float32Array),W(w.length%L==0),W(L>=3);var O=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return F(O,w,w.length/L,L*4)},computeMeshletBounds:function(U,w,L){return W(U.meshletCount!=0),W(w instanceof Float32Array),W(w.length%L==0),W(L>=3),q(U,w,w.length/L,L*4)},extractMeshlet:function(U,w){return W(w>=0&&w<U.meshletCount),z(U,w)}}}();var KX={OPTIMIZED_DIR:".optimized",CHECKSUM_EXT:".md5",DIRECTORIES:[VZ.normalize("node_modules/@hytopia.com/assets"),VZ.normalize("assets")],OPTIMIZER_RUNS:[{suffix:"",options:["--compress","false","--instance","false","--simplify","false"]},{suffix:"-named-nodes",options:["--compress","false","--instance","false","--simplify","false","--join","true","--join-named","false"]}]};class N9{static instance=new N9;optimize=!0;optimizeEveryStart=!1;_modelUriDocuments=new Map;_modelUriBoundingBoxes=new Map;_modelUriNodeNames=new Map;_modelUriTrimeshes=new Map;constructor(){}async preloadModels(){let Z=await this._getAbsoluteModelPaths();console.log(`ModelRegistry.preloadModels(): Preloading ${Z.length} models...`);for(let J of Z){if(this.optimize)await this._resolveOptimizedModelPath(J);await this._loadModelData(J)}console.log(`ModelRegistry.preloadModels(): Preloaded ${Z.length} models!`)}getAnimationNames(Z){let J=this._modelUriDocuments.get(Z);if(!J)m.fatalError(`ModelRegistry.getAnimationNames(): Model ${Z} not found!`);return J.getRoot().listAnimations().map((Y)=>Y.getName())}getBoundingBox(Z){let J=this._modelUriBoundingBoxes.get(Z);if(!J)m.fatalError(`ModelRegistry.getBoundingBox(): Model ${Z} not found!`);return J}getHeight(Z){let J=this.getBoundingBox(Z);return J.max.y-J.min.y}getNodeNames(Z){let J=this._modelUriNodeNames.get(Z);if(!J)m.fatalError(`ModelRegistry.getNodeNames(): Model ${Z} not found!`);return J}getTrimesh(Z,J=1){let $=this._modelUriTrimeshes.get(Z);if(!$){m.error(`ModelRegistry.getTrimesh(): Model ${Z} not found!`);return}let Y=$.vertices;if(J!==1){Y=new Float32Array(Y.length);for(let Q=0;Q<Y.length;Q++)Y[Q]=$.vertices[Q]*J}return{vertices:Y,indices:$.indices}}modelHasNode(Z,J){let $=this._modelUriNodeNames.get(Z);if(!$)m.fatalError(`ModelRegistry.modelHasNode(): Model ${Z} not found!`);return $.includes(J)}_absoluteModelPathToModelUri(Z){let J=VZ.relative(process.cwd(),Z),$=KX.DIRECTORIES.find((Q)=>J.startsWith(Q));return($?VZ.relative($,J):J).split(VZ.sep).join("/")}async _getAbsoluteModelPaths(){let Z=[];for(let J of KX.DIRECTORIES){let $=VZ.resolve(process.cwd(),J);if(!RJ.existsSync($))continue;let Y=await $2("**/*.{gltf,glb}",{cwd:$,follow:!0});for(let Q of Y)Z.push(VZ.join($,Q))}return Z}async _loadModelData(Z){let J=await new lP().read(Z),$=aa(J.getRoot().listScenes()[0]),Y=J.getRoot().listNodes().map((W)=>W.getName()),Q=this._absoluteModelPathToModelUri(Z);this._modelUriDocuments.set(Q,J),this._modelUriBoundingBoxes.set(Q,{min:{x:$.min[0],y:$.min[1],z:$.min[2]},max:{x:$.max[0],y:$.max[1],z:$.max[2]}}),this._modelUriNodeNames.set(Q,Y),this._modelUriTrimeshes.set(Q,await this._buildTrimesh(Q))}async _resolveOptimizedModelPath(Z){let J=this._buildOptimizedModelPath(Z);if(!this.optimizeEveryStart&&this._isOptimizedVersionValid(Z))return J;return await this._optimizeModel(Z,J)}_isOptimizedVersionValid(Z){let J=`${this._buildOptimizedModelPath(Z)}${KX.CHECKSUM_EXT}`;if(!RJ.existsSync(J))return!1;let $=this._calculateChecksum(Z),Y=RJ.readFileSync(J,"utf8");return $===Y}_calculateChecksum(Z){if(!RJ.existsSync(Z))return"";let J=RJ.readFileSync(Z);return AO1.createHash("sha256").update(J.toString("base64")).digest("hex")}_buildOptimizedModelPath(Z){let J=VZ.basename(Z),$=J.replace(/\.[^/.]+$/,""),Y=`${KX.OPTIMIZED_DIR}/${$}`;return Z.replace(/[^/\\]+$/,`${Y}/${J}`)}async _buildTrimesh(Z,J=1,$=0.001){let Y=this._modelUriDocuments.get(Z);if(!Y)m.fatalError(`ModelRegistry._buildTrimesh(): Model ${Z} not found!`);let Q=ia(Y);Q.setLogger(new j5(PG.WARN)),await Q.transform(Ia({pivot:"center"}),na(),sa(),dC(),Zs({simplifier:Js,ratio:J,error:$}),la());for(let z of Q.getRoot().listScenes())for(let H of z.listChildren())da(H);let W=Q.getRoot().listMeshes()[0];if(!W){m.error(`ModelRegistry._buildTrimesh(): Model ${Z} has no root mesh!`);return}let X=W.listPrimitives()[0];if(!X){m.error(`ModelRegistry._buildTrimesh(): Model ${Z} has no root primitive!`);return}let K=X.getAttribute("POSITION"),G=X.getIndices();if(!K||!G){m.error(`ModelRegistry._buildTrimesh(): Model ${Z} missing required geometry data!`);return}return{vertices:K.getArray(),indices:G.getArray()}}async _optimizeModel(Z,J){let $=VZ.dirname(J);RJ.rmSync($,{recursive:!0,force:!0}),RJ.mkdirSync($,{recursive:!0}),console.log(`ModelRegistry: Optimizing model ${this._absoluteModelPathToModelUri(Z)}...`);for(let Y of KX.OPTIMIZER_RUNS){let Q=J.replace(/(\.[^/.]+)$/,`${Y.suffix}$1`),{stderr:W}=await Gc("bunx",["gltf-transform","optimize",Z,Q,...Y.options]);if(W)return m.warning(`ModelRegistry._optimizeModel(): Error optimizing model ${this._absoluteModelPathToModelUri(Z)}, defaulting to unoptimized model. Error: ${W}`),Z}return RJ.writeFileSync(`${J}${KX.CHECKSUM_EXT}`,this._calculateChecksum(Z)),J}}var oG;((Q)=>{Q.DYNAMIC="dynamic";Q.FIXED="fixed";Q.KINEMATIC_POSITION="kinematic_position";Q.KINEMATIC_VELOCITY="kinematic_velocity"})(oG||={});var lC=0.001,$s="dynamic";class DY extends g0{_additionalMass=0;_colliders=new Set;_explicitSleep=!1;_enabledPositions={x:!0,y:!0,z:!0};_enabledRotations={x:!0,y:!0,z:!0};_rigidBody;_rigidBodyDesc;_rigidBodyType;_simulation;constructor(Z){super();Z.type??=$s,this._rigidBodyDesc=this._createRigidBodyDesc(Z),this._rigidBodyType=Z.type,this._applyRigidBodyOptions(Z),this._autoAddToSimulation(Z)}get additionalMass(){if(!this._requireNotRemoved("additionalMass"))return 0;return this._additionalMass}get additionalSolverIterations(){if(!this._requireNotRemoved("additionalSolverIterations"))return 0;return this._rigidBody?this._rigidBody.additionalSolverIterations():this._rigidBodyDesc.additionalSolverIterations}get angularDamping(){if(!this._requireNotRemoved("angularDamping"))return 0;return this._rigidBody?this._rigidBody.angularDamping():this._rigidBodyDesc.angularDamping}get angularVelocity(){if(!this._requireNotRemoved("angularVelocity"))return{x:0,y:0,z:0};return this._rigidBody?this._rigidBody.angvel():this._rigidBodyDesc.angvel}get colliders(){return this._colliders}get dominanceGroup(){if(!this._requireNotRemoved("dominanceGroup"))return 0;return this._rigidBody?this._rigidBody.dominanceGroup():this._rigidBodyDesc.dominanceGroup}get directionFromRotation(){let{x:Z,y:J,z:$,w:Y}=this.rotation;return{x:2*(Z*$+Y*J),y:2*(J*$-Y*Z),z:1-2*(Z*Z+J*J)}}get effectiveAngularInertia(){if(!this._requireNotRemoved("effectiveAngularInertia"))return;return this._rigidBody?this._rigidBody.effectiveAngularInertia():void 0}get effectiveInverseMass(){if(!this._requireNotRemoved("effectiveInverseMass"))return;return this._rigidBody?this._rigidBody.effectiveInvMass():void 0}get effectiveWorldInversePrincipalAngularInertiaSqrt(){if(!this._requireNotRemoved("effectiveWorldInversePrincipalAngularInertiaSqrt"))return;return this._rigidBody?this._rigidBody.effectiveWorldInvInertiaSqrt():void 0}get enabledRotations(){if(!this._requireNotRemoved("enabledRotations"))return{x:!0,y:!0,z:!0};return this._enabledRotations}get enabledPositions(){if(!this._requireNotRemoved("enabledPositions"))return{x:!0,y:!0,z:!0};return this._enabledPositions}get gravityScale(){if(!this._requireNotRemoved("gravityScale"))return 0;return this._rigidBody?this._rigidBody.gravityScale():this._rigidBodyDesc.gravityScale}get inverseMass(){if(!this._requireNotRemoved("inverseMass"))return;return this._rigidBody?this._rigidBody.invMass():void 0}get inversePrincipalAngularInertiaSqrt(){if(!this._requireNotRemoved("inversePrincipalAngularInertiaSqrt"))return;return this._rigidBody?this._rigidBody.invPrincipalInertiaSqrt():void 0}get isCcdEnabled(){if(!this._requireNotRemoved("isCcdEnabled"))return!1;return this._rigidBody?this._rigidBody.isCcdEnabled():this._rigidBodyDesc.ccdEnabled}get isDynamic(){if(!this._requireNotRemoved("isDynamic"))return!1;return this._rigidBodyType==="dynamic"}get isEnabled(){if(!this._requireNotRemoved("isEnabled"))return!1;return this._rigidBody?this._rigidBody.isEnabled():this._rigidBodyDesc.enabled}get isFixed(){if(!this._requireNotRemoved("isFixed"))return!1;return this._rigidBodyType==="fixed"}get isKinematic(){if(!this._requireNotRemoved("isKinematic"))return!1;return["kinematic_position","kinematic_velocity"].includes(this._rigidBodyType)}get isKinematicPositionBased(){if(!this._requireNotRemoved("isKinematicPositionBased"))return!1;return this._rigidBodyType==="kinematic_position"}get isKinematicVelocityBased(){if(!this._requireNotRemoved("isKinematicVelocityBased"))return!1;return this._rigidBodyType==="kinematic_velocity"}get isMoving(){if(!this._requireNotRemoved("isMoving"))return!1;return this._rigidBody?this._rigidBody.isMoving():!1}get isRemoved(){return!this._rigidBody&&!this._rigidBodyDesc}get isSimulated(){if(!this._requireNotRemoved("isSimulated"))return!1;return this._rigidBody?!0:!1}get isSleeping(){if(!this._requireNotRemoved("isSleeping"))return!1;return this._rigidBody?this._rigidBody.isSleeping():this._rigidBodyDesc.sleeping}get linearDamping(){if(!this._requireNotRemoved("linearDamping"))return 0;return this._rigidBody?this._rigidBody.linearDamping():this._rigidBodyDesc.linearDamping}get linearVelocity(){if(!this._requireNotRemoved("linearVelocity"))return{x:0,y:0,z:0};return this._rigidBody?this._rigidBody.linvel():this._rigidBodyDesc.linvel}get localCenterOfMass(){if(!this._requireNotRemoved("localCenterOfMass"))return{x:0,y:0,z:0};return this._rigidBody?this._rigidBody.localCom():this._rigidBodyDesc.centerOfMass}get mass(){if(!this._requireNotRemoved("mass"))return 0;return this._rigidBody?this._rigidBody.mass():this._rigidBodyDesc.mass}get nextKinematicRotation(){if(!this._requireNotRemoved("nextKinematicRotation"))return{x:0,y:0,z:0,w:1};return this._rigidBody?this._rigidBody.nextRotation():this._rigidBodyDesc.rotation}get nextKinematicPosition(){if(!this._requireNotRemoved("nextKinematicPosition"))return{x:0,y:0,z:0};return this._rigidBody?this._rigidBody.nextTranslation():this._rigidBodyDesc.translation}get numColliders(){return this._colliders.size}get principalAngularInertia(){if(!this._requireNotRemoved("principalAngularInertia"))return{x:0,y:0,z:0};return this._rigidBody?this._rigidBody.principalInertia():this._rigidBodyDesc.principalAngularInertia}get principalAngularInertiaLocalFrame(){if(!this._requireNotRemoved("principalAngularInertiaLocalFrame"))return;return this._rigidBody?this._rigidBody.principalInertiaLocalFrame():void 0}get position(){if(!this._requireNotRemoved("position"))return{x:0,y:0,z:0};return this._rigidBody?this._rigidBody.translation():this._rigidBodyDesc.translation}get rawRigidBody(){if(!this._requireNotRemoved("rawRigidBody"))return;return this._rigidBody}get rotation(){if(!this._requireNotRemoved("rotation"))return{x:0,y:0,z:0,w:1};return this._rigidBody?this._rigidBody.rotation():this._rigidBodyDesc.rotation}get softCcdPrediction(){if(!this._requireNotRemoved("softCcdPrediction"))return 0;return this._rigidBody?this._rigidBody.softCcdPrediction():this._rigidBodyDesc.softCcdPrediction}get type(){if(!this._requireNotRemoved("type"))return"dynamic";return this._rigidBodyType}get worldCenterOfMass(){if(!this._requireNotRemoved("worldCenterOfMass"))return;return this._rigidBody?this._rigidBody.worldCom():void 0}setAdditionalMass(Z){if(!this._requireDynamic("setAdditionalMass"))return;if(!this._requireNotRemoved("setAdditionalMass"))return;this._rigidBody?this._rigidBody.setAdditionalMass(Z,!this._explicitSleep):this._rigidBodyDesc.setAdditionalMass(Z)}setAdditionalMassProperties(Z){if(!this._requireDynamic("setAdditionalMassProperties"))return;if(!this._requireNotRemoved("setAdditionalMassProperties"))return;let{additionalMass:J,centerOfMass:$,principalAngularInertia:Y,principalAngularInertiaLocalFrame:Q}=Z;this._rigidBody?this._rigidBody.setAdditionalMassProperties(J,$,Y,Q,!this._explicitSleep):this._rigidBodyDesc.setAdditionalMassProperties(J,$,Y,Q)}setAdditionalSolverIterations(Z){if(!this._requireDynamic("setAdditionalSolverIterations"))return;if(!this._requireNotRemoved("setAdditionalSolverIterations"))return;this._rigidBody?this._rigidBody.setAdditionalSolverIterations(Z):this._rigidBodyDesc.setAdditionalSolverIterations(Z)}setAngularDamping(Z){if(!this._requireDynamic("setAngularDamping"))return;if(!this._requireNotRemoved("setAngularDamping"))return;this._rigidBody?this._rigidBody.setAngularDamping(Z):this._rigidBodyDesc.setAngularDamping(Z)}setAngularVelocity(Z){if(!this._requireNotKinematicPositionBased("setAngularVelocity"))return;if(!this._requireNotRemoved("setAngularVelocity"))return;this._rigidBody?this._rigidBody.setAngvel(Z,!this._explicitSleep):this._rigidBodyDesc.setAngvel(Z)}setCcdEnabled(Z){if(!this._requireDynamic("setCcdEnabled"))return;if(!this._requireNotRemoved("setCcdEnabled"))return;this._rigidBody?this._rigidBody.enableCcd(Z):this._rigidBodyDesc.setCcdEnabled(Z)}setDominanceGroup(Z){if(!this._requireDynamic("setDominanceGroup"))return;if(!this._requireNotRemoved("setDominanceGroup"))return;this._rigidBody?this._rigidBody.setDominanceGroup(Z):this._rigidBodyDesc.setDominanceGroup(Z)}setEnabled(Z){if(!this._requireNotRemoved("setEnabled"))return;this._rigidBody?this._rigidBody.setEnabled(Z):this._rigidBodyDesc.setEnabled(Z)}setEnabledPositions(Z){if(!this._requireDynamic("setEnabledPositions"))return;if(!this._requireNotRemoved("setEnabledPositions"))return;this._rigidBody?this._rigidBody.setEnabledTranslations(Z.x,Z.y,Z.z,!this._explicitSleep):this._rigidBodyDesc.enabledTranslations(Z.x,Z.y,Z.z),this._enabledPositions=Z}setEnabledRotations(Z){if(!this._requireDynamic("setEnabledRotations"))return;if(!this._requireNotRemoved("setEnabledRotations"))return;this._rigidBody?this._rigidBody.setEnabledRotations(Z.x,Z.y,Z.z,!this._explicitSleep):this._rigidBodyDesc.enabledRotations(Z.x,Z.y,Z.z),this._enabledRotations=Z}setGravityScale(Z){if(!this._requireDynamic("setGravityScale"))return;if(!this._requireNotRemoved("setGravityScale"))return;this._rigidBody?this._rigidBody.setGravityScale(Z,!this._explicitSleep):this._rigidBodyDesc.setGravityScale(Z)}setLinearDamping(Z){if(!this._requireDynamic("setLinearDamping"))return;if(!this._requireNotRemoved("setLinearDamping"))return;this._rigidBody?this._rigidBody.setLinearDamping(Z):this._rigidBodyDesc.setLinearDamping(Z)}setLinearVelocity(Z){if(!this._requireNotKinematicPositionBased("setLinearVelocity"))return;if(!this._requireNotRemoved("setLinearVelocity"))return;this._rigidBody?this._rigidBody.setLinvel(Z,!this._explicitSleep):this._rigidBodyDesc.setLinvel(Z.x,Z.y,Z.z)}setNextKinematicRotation(Z){if(!this._requireKinematic("setNextKinematicRotation"))return;if(!this._requireNotRemoved("setNextKinematicRotation"))return;this._rigidBody?this._rigidBody.setNextKinematicRotation(Z):this._rigidBodyDesc.setRotation(Z)}setNextKinematicPosition(Z){if(!this._requireKinematic("setNextKinematicPosition"))return;if(!this._requireNotRemoved("setNextKinematicPosition"))return;this._rigidBody?this._rigidBody.setNextKinematicTranslation(Z):this._rigidBodyDesc.setTranslation(Z.x,Z.y,Z.z)}setPosition(Z){if(!this._requireNotRemoved("setPosition"))return;this._rigidBody?this._rigidBody.setTranslation(Z,!this._explicitSleep):this._rigidBodyDesc.setTranslation(Z.x,Z.y,Z.z)}setRotation(Z){if(!this._requireNotRemoved("setRotation"))return;this._rigidBody?this._rigidBody.setRotation(Z,!this._explicitSleep):this._rigidBodyDesc.setRotation(Z)}setSleeping(Z){if(!this._requireDynamic("setSleeping"))return;if(!this._requireNotRemoved("setSleeping"))return;this._rigidBody?Z?this._rigidBody.sleep():this._rigidBody.wakeUp():this._rigidBodyDesc.sleeping=Z,this._explicitSleep=Z}setSoftCcdPrediction(Z){if(!this._requireDynamic("setSoftCcdPrediction"))return;if(!this._requireNotRemoved("setSoftCcdPrediction"))return;this._rigidBody?this._rigidBody.setSoftCcdPrediction(Z):this._rigidBodyDesc.setSoftCcdPrediction(Z)}setCollisionGroupsForSolidColliders(Z){if(!this._requireNotRemoved("setCollisionGroupsForSolidColliders"))return;this._colliders.forEach((J)=>{if(J.isSensor)return;J.setCollisionGroups(Z)})}setCollisionGroupsForSensorColliders(Z){if(!this._requireNotRemoved("setCollisionGroupsForSensorColliders"))return;this._colliders.forEach((J)=>{if(!J.isSensor)return;J.setCollisionGroups(Z)})}setType(Z){if(!this._requireNotRemoved("setType"))return;let $={["dynamic"]:K1.RigidBodyType.Dynamic,["fixed"]:K1.RigidBodyType.Fixed,["kinematic_position"]:K1.RigidBodyType.KinematicPositionBased,["kinematic_velocity"]:K1.RigidBodyType.KinematicVelocityBased}[Z];if($===void 0)return m.error(`Invalid RigidBodyType: ${Z}`);this._rigidBody?this._rigidBody.setBodyType($,!this._explicitSleep):this._rigidBodyDesc.status=$,this._rigidBodyType=Z}addForce(Z){if(!this._requireNotRemoved("addForce"))return;if(!this._requireCreated("addForce"))return;if(!this._requireDynamic("addForce"))return;if(this._isNegligibleVector(Z))return;this._rigidBody.addForce(Z,!this._explicitSleep)}addTorque(Z){if(!this._requireNotRemoved("addTorque"))return;if(!this._requireCreated("addTorque"))return;if(!this._requireDynamic("addTorque"))return;if(this._isNegligibleVector(Z))return;this._rigidBody.addTorque(Z,!this._explicitSleep)}addChildColliderToSimulation(Z){if(!this._requireNotRemoved("addChildColliderToSimulation"))return;if(!this._requireCreated("addChildColliderToSimulation"))return;Z.addToSimulation(this._simulation,this)}addToSimulation(Z){if(!this._requireNotRemoved("addToSimulation"))return;if(this._rigidBody)return m.error("RigidBody.addToSimulation(): Rigid body already exists in the simulation!");this._simulation=Z,this._rigidBody=this._simulation.createRawRigidBody(this._rigidBodyDesc),this._colliders.forEach((J)=>{if(!J.isSimulated)J.addToSimulation(Z,this)})}applyImpulse(Z){if(!this._requireNotRemoved("applyImpulse"))return;if(!this._requireCreated("applyImpulse"))return;if(!this._requireDynamic("applyImpulse"))return;if(this._isNegligibleVector(Z))return;this._rigidBody.applyImpulse(Z,!this._explicitSleep)}applyImpulseAtPoint(Z,J){if(!this._requireNotRemoved("applyImpulseAtPoint"))return;if(!this._requireCreated("applyImpulseAtPoint"))return;if(!this._requireDynamic("applyImpulseAtPoint"))return;if(this._isNegligibleVector(Z))return;this._rigidBody.applyImpulseAtPoint(Z,J,!this._explicitSleep)}applyTorqueImpulse(Z){if(!this._requireNotRemoved("applyTorqueImpulse"))return;if(!this._requireCreated("applyTorqueImpulse"))return;if(!this._requireDynamic("applyTorqueImpulse"))return;this._rigidBody.applyTorqueImpulse(Z,!this._explicitSleep)}createAndAddChildCollider(Z){if(!this._requireNotRemoved("createAndAddChildCollider"))return null;return this._simulation?new a5({...Z,parentRigidBody:this,simulation:this._simulation}):this._createAndAddPendingChildCollider(Z)}createAndAddChildCollidersToSimulation(Z){let J=[];return Z.forEach(($)=>{let Y=this.createAndAddChildCollider($);if(Y)J.push(Y)}),J}getCollidersByTag(Z){let J=[];for(let $ of this._colliders)if($.tag===Z)J.push($);return J}linkCollider(Z){if(!this._requireNotRemoved("linkCollider"))return;if(Z.parentRigidBody!==this)return m.error("RigidBody.linkCollider(): Collider cannot be linked because it is not a child of this rigid body!");this._colliders.add(Z)}lockAllRotations(){if(!this._requireNotRemoved("lockAllRotations"))return;this.setEnabledRotations({x:!1,y:!1,z:!1})}lockAllPositions(){if(!this._requireNotRemoved("lockAllPositions"))return;this.setEnabledPositions({x:!1,y:!1,z:!1})}removeFromSimulation(){if(!this._requireNotRemoved("removeFromSimulation"))return;if(!this._rigidBody)return m.error("RigidBody.removeFromSimulation(): Rigid body does not exist in the simulation!");this._colliders.forEach((Z)=>{Z.removeFromSimulation()}),this._simulation.removeRawRigidBody(this._rigidBody),this._simulation=void 0,this._rigidBody=void 0}unlinkCollider(Z){if(!this._requireNotRemoved("unlinkCollider"))return;if(!Z.isRemoved)return m.error("RigidBody.unlinkCollider(): Collider is still simulated and therefore cannot be unlinked from this rigid body!");this._colliders.delete(Z)}resetAngularVelocity(){if(!this._requireNotRemoved("resetAngularVelocity"))return;if(!this._requireCreated("resetAngularVelocity"))return;this.setAngularVelocity({x:0,y:0,z:0})}resetForces(){if(!this._requireNotRemoved("resetForces"))return;if(!this._requireCreated("resetForces"))return;this._rigidBody.resetForces(!this._explicitSleep)}resetLinearVelocity(){if(!this._requireNotRemoved("resetLinearVelocity"))return;if(!this._requireCreated("resetLinearVelocity"))return;this.setLinearVelocity({x:0,y:0,z:0})}resetTorques(){if(!this._requireNotRemoved("resetTorques"))return;if(!this._requireCreated("resetTorques"))return;this._rigidBody.resetTorques(!this._explicitSleep)}sleep(){if(!this._requireNotRemoved("sleep"))return;this.setSleeping(!0)}wakeUp(){if(!this._requireNotRemoved("wakeUp"))return;this.setSleeping(!1)}_applyRigidBodyOptions(Z){[["additionalMass",this.setAdditionalMass.bind(this)],["additionalMassProperties",this.setAdditionalMassProperties.bind(this)],["additionalSolverIterations",this.setAdditionalSolverIterations.bind(this)],["angularDamping",this.setAngularDamping.bind(this)],["angularVelocity",this.setAngularVelocity.bind(this)],["dominanceGroup",this.setDominanceGroup.bind(this)],["ccdEnabled",this.setCcdEnabled.bind(this)],["enabled",this.setEnabled.bind(this)],["enabledPositions",this.setEnabledPositions.bind(this)],["enabledRotations",this.setEnabledRotations.bind(this)],["gravityScale",this.setGravityScale.bind(this)],["linearDamping",this.setLinearDamping.bind(this)],["linearVelocity",this.setLinearVelocity.bind(this)],["position",this.setPosition.bind(this)],["rotation",this.setRotation.bind(this)],["sleeping",this.setSleeping.bind(this)],["softCcdPrediction",this.setSoftCcdPrediction.bind(this)]].forEach(([$,Y])=>{if($ in Z)Y(Z[$])})}_autoAddToSimulation(Z){if(Z.colliders)this._createAndAddPendingChildColliders(Z.colliders);if(Z.simulation)this.addToSimulation(Z.simulation)}_createAndAddPendingChildCollider(Z){if(!this._requireNotRemoved("createAndAddPendingChildCollider"))return null;if(!this._requireNotSimulated("createAndAddPendingChildCollider"))return null;let J=new a5(Z);return this._colliders.add(J),J}_createAndAddPendingChildColliders(Z){let J=[];return Z.forEach(($)=>{let Y=this._createAndAddPendingChildCollider($);if(Y)J.push(Y)}),J}_createRigidBodyDesc(Z){let J=Z.type??$s;return{["dynamic"]:()=>K1.RigidBodyDesc.dynamic(),["fixed"]:()=>K1.RigidBodyDesc.fixed(),["kinematic_position"]:()=>K1.RigidBodyDesc.kinematicPositionBased(),["kinematic_velocity"]:()=>K1.RigidBodyDesc.kinematicVelocityBased()}[J]()}_requireCreated(Z){if(!this._rigidBody||!this._simulation)m.error(`RigidBody._requireCreated(): Rigid body has not been created and therefore does not support the invoked method: ${Z}()`);return!!this._rigidBody&&!!this._simulation}_requireDynamic(Z){if(!this.isDynamic)m.error(`RigidBody._requireDynamic(): Rigid body is not dynamic and therefore does not support the invoked method: ${Z}()`);return this.isDynamic}_requireKinematic(Z){if(!this.isKinematic)m.error(`RigidBody._requireKinematic(): Rigid body is not kinematic and therefore does not support the invoked method: ${Z}()`);return this.isKinematic}_requireNotKinematicPositionBased(Z){if(this.isKinematicPositionBased)m.error(`RigidBody._requireNotKinematicPositionBased(): Rigid body is kinematic position based and therefore does not support the invoked method: ${Z}()`);return!this.isKinematicPositionBased}_requireNotRemoved(Z){if(!this._rigidBody&&!this._rigidBodyDesc)m.error(`RigidBody._requireNotRemoved(): Rigid body has been removed and therefore does not support the invoked method: ${Z}()`);return!!this._rigidBody||!!this._rigidBodyDesc}_requireNotSimulated(Z){if(this.isSimulated)m.error(`RigidBody._requireNotSimulated(): Rigid body is simulated and therefore does not support the invoked method: ${Z}()`);return!this.isSimulated}_isNegligibleVector(Z){return Math.abs(Z.x)<lC&&Math.abs(Z.y)<lC&&Math.abs(Z.z)<lC}}var pC;((Q)=>{Q[Q.Average=0]="Average";Q[Q.Min=1]="Min";Q[Q.Multiply=2]="Multiply";Q[Q.Max=3]="Max"})(pC||={});var rG;((z)=>{z.NONE="none";z.BALL="ball";z.BLOCK="block";z.CAPSULE="capsule";z.CONE="cone";z.CYLINDER="cylinder";z.ROUND_CYLINDER="round-cylinder";z.TRIMESH="trimesh";z.WEDGE="wedge"})(rG||={});class a5 extends g0{_collider;_colliderDesc;_onCollision;_parentRigidBody;_shape;_simulation;_tag;constructor(Z){super();this._colliderDesc=this._createColliderDesc(Z),this._shape=Z.shape,this._applyColliderOptions(Z),this._autoAddToSimulation(Z)}static optionsFromBlockHalfExtents(Z){return{shape:"block",halfExtents:Z}}static optionsFromModelUri(Z,J=1,$){let Y=N9.instance.getBoundingBox(Z),Q=Y.max.x-Y.min.x,W=Y.max.y-Y.min.y,X=Y.max.z-Y.min.z,K=Math.max(Q,X),G=Math.min(Q,X),z=K/G,H=K/W,V=K*J/2,q=(j)=>Math.max(0.01,j),F=()=>({shape:"block",halfExtents:{x:q(Q*J/2),y:q(W*J/2),z:q(X*J/2)}}),U=()=>({shape:"round-cylinder",radius:q(V),halfHeight:q(W*J/2),borderRadius:q(V*0.1)}),w=()=>{let j=N9.instance.getTrimesh(Z,J);if(!j)return;return{shape:"trimesh",vertices:j.vertices,indices:j.indices}},L=()=>({shape:"wedge",extents:{x:Q*J,y:W*J,z:X*J}}),O=()=>({shape:"capsule",radius:q(V),halfHeight:q(W*J/2-V)});if($)switch($){case"block":return F();case"capsule":return O();case"round-cylinder":return U();case"trimesh":{let j=w();if(!j){m.error(`Collider.optionsFromModelUri(): Failed to create trimesh options for model ${Z}, falling back to generic shape!`);break}return j}case"wedge":return L();default:m.warning(`Collider.optionsFromModelUri(): Preferred shape ${$} is not yet supported with Collider.optionsFromModelUri(), defaulting to generic shape!`)}if(z>2)return F();if(H>1.5)return U();return O()}get bounciness(){if(!this._requireNotRemoved("bounciness"))return 0;return this._collider?this._collider.restitution():this._colliderDesc.restitution}get bouncinessCombineRule(){if(!this._requireNotRemoved("bouncinessCombineRule"))return 0;return this._collider?this._collider.restitutionCombineRule():this._colliderDesc.restitutionCombineRule}get collisionGroups(){if(!this._requireNotRemoved("collisionGroups"))return{belongsTo:[],collidesWith:[]};return this._collider?X4.decodeRawCollisionGroups(this._collider.collisionGroups()):X4.decodeRawCollisionGroups(this._colliderDesc.collisionGroups)}get friction(){if(!this._requireNotRemoved("friction"))return 0;return this._collider?this._collider.friction():this._colliderDesc.friction}get frictionCombineRule(){if(!this._requireNotRemoved("frictionCombineRule"))return 0;return this._collider?this._collider.frictionCombineRule():this._colliderDesc.frictionCombineRule}get isEnabled(){if(!this._requireNotRemoved("isEnabled"))return!1;return this._collider?this._collider.isEnabled():this._colliderDesc.enabled}get isRemoved(){return!this._collider&&!this._colliderDesc}get isSensor(){if(!this._requireNotRemoved("isSensor"))return!1;return this._collider?this._collider.isSensor():this._colliderDesc.isSensor}get isSimulated(){if(!this._requireNotRemoved("isSimulated"))return!1;return!!this._collider}get parentRigidBody(){if(!this._requireNotRemoved("parentRigidBody"))return;return this._parentRigidBody}get rawCollider(){if(!this._requireNotRemoved("rawCollider"))return;return this._collider}get relativePosition(){if(!this._requireNotRemoved("relativePosition"))return{x:0,y:0,z:0};return this._collider?this._collider.translation():this._colliderDesc.translation}get relativeRotation(){if(!this._requireNotRemoved("relativeRotation"))return{x:0,y:0,z:0,w:1};return this._collider?this._collider.rotation():this._colliderDesc.rotation}get shape(){if(!this._requireNotRemoved("shape"))return"none";return this._shape}get tag(){if(!this._requireNotRemoved("tag"))return;return this._tag}setBounciness(Z){if(!this._requireNotRemoved("setBounciness"))return;this._collider?this._collider.setRestitution(Z):this._colliderDesc.setRestitution(Z)}setBouncinessCombineRule(Z){if(!this._requireNotRemoved("setBouncinessCombineRule"))return;this._collider?this._collider.setRestitutionCombineRule(Z):this._colliderDesc.setRestitutionCombineRule(Z)}setCollisionGroups(Z){if(!this._requireNotRemoved("setCollisionGroups"))return;let J=X4.buildRawCollisionGroups(Z);this._collider?this._collider.setCollisionGroups(J):this._colliderDesc.setCollisionGroups(J)}setEnabled(Z){if(!this._requireNotRemoved("setEnabled"))return;this._collider?this._collider.setEnabled(Z):this._colliderDesc.setEnabled(Z)}setFriction(Z){if(!this._requireNotRemoved("setFriction"))return;this._collider?this._collider.setFriction(Z):this._colliderDesc.setFriction(Z)}setFrictionCombineRule(Z){if(!this._requireNotRemoved("setFrictionCombineRule"))return;this._collider?this._collider.setFrictionCombineRule(Z):this._colliderDesc.setFrictionCombineRule(Z)}setMass(Z){if(!this._requireNotRemoved("setMass"))return;this._collider?this._collider.setMass(Z):this._colliderDesc.setMass(Z)}setOnCollision(Z){if(!this._requireNotRemoved("setOnCollision"))return;if(this._onCollision=Z,this.isSimulated)if(this.enableCollisionEvents(!!Z),Z)this._simulation.colliderMap.setColliderCollisionCallback(this,Z);else this._simulation.colliderMap.removeColliderCollisionCallback(this)}setRelativeRotation(Z){if(!this._requireNotRemoved("setRelativeRotation"))return;this._collider?this._collider.setRotation(Z):this._colliderDesc.setRotation(Z)}setRelativePosition(Z){if(!this._requireNotRemoved("setRelativePosition"))return;this._collider?this._collider.setTranslation(Z):this._colliderDesc.setTranslation(Z.x,Z.y,Z.z)}setSensor(Z){if(!this._requireNotRemoved("setSensor"))return;this._collider?this._collider.setSensor(Z):this._colliderDesc.setSensor(Z)}setTag(Z){if(!this._requireNotRemoved("setTag"))return;this._tag=Z}addToSimulation(Z,J){if(!this._requireNotRemoved("addToSimulation"))return;if(!this._requireUnsimulated("addToSimulation"))return;if(J){if(!J.isSimulated)return m.error("Collider.addToSimulation(): Rigid body must be simulated before adding a collider to it!");if(J.type==="dynamic"&&this.shape==="trimesh")m.warning("Collider.addToSimulation(): Trimesh colliders are strongly discouraged to be used with dynamic rigid bodies, they will not contribute any mass!")}if(this._simulation=Z,this._parentRigidBody=J,this._collider=this._simulation.createRawCollider(this._colliderDesc,J?.rawRigidBody),this._colliderDesc=void 0,J)J.linkCollider(this);if(this._onCollision)this.setOnCollision(this._onCollision)}enableCollisionEvents(Z){if(!this._requireNotRemoved("enableCollisionEvents"))return;let J=this._collider?this._collider.activeEvents():this._colliderDesc.activeEvents,$=Z?J|K1.ActiveEvents.COLLISION_EVENTS:J&~K1.ActiveEvents.COLLISION_EVENTS;(this._collider??this._colliderDesc).setActiveEvents($),this._setActiveCollisionTypes()}enableContactForceEvents(Z){if(!this._requireNotRemoved("enableContactForceEvents"))return;let J=this._collider?this._collider.activeEvents():this._colliderDesc.activeEvents,$=Z?J|K1.ActiveEvents.CONTACT_FORCE_EVENTS:J&~K1.ActiveEvents.CONTACT_FORCE_EVENTS;(this._collider??this._colliderDesc).setActiveEvents($),this._setActiveCollisionTypes()}removeFromSimulation(){if(!this._requireNotRemoved("removeFromSimulation"))return;if(!this._requireSimulated("removeFromSimulation"))return;if(this._simulation.removeRawCollider(this._collider),this._simulation=void 0,this._collider=void 0,this._parentRigidBody)this._parentRigidBody.unlinkCollider(this);this._parentRigidBody=void 0}_applyColliderOptions(Z){[["bounciness",this.setBounciness.bind(this)],["bouncinessCombineRule",this.setBouncinessCombineRule.bind(this)],["collisionGroups",this.setCollisionGroups.bind(this)],["enabled",this.setEnabled.bind(this)],["friction",this.setFriction.bind(this)],["frictionCombineRule",this.setFrictionCombineRule.bind(this)],["isSensor",this.setSensor.bind(this)],["mass",this.setMass.bind(this)],["onCollision",this.setOnCollision.bind(this)],["relativePosition",this.setRelativePosition.bind(this)],["relativeRotation",this.setRelativeRotation.bind(this)],["tag",this.setTag.bind(this)]].forEach(([$,Y])=>{if(Z[$]!==void 0)Y.call(this,Z[$])})}_autoAddToSimulation(Z){if(Z.simulation)this.addToSimulation(Z.simulation,Z.parentRigidBody)}_buildWedgeConvexHullVertices(Z){let{x:J,y:$,z:Y}=Z,Q=J/2,W=Y/2,X=$/2;return new Float32Array([-Q,0-X,-W,Q,0-X,-W,Q,0-X,W,-Q,0-X,W,-Q,$-X,-W,Q,$-X,-W])}_createColliderDesc(Z){let{shape:J,flags:$}=Z;switch(J){case"ball":{if(!Z.radius)m.fatalError("Ball collider must have a radius!");return K1.ColliderDesc.ball(Z.radius)}case"block":{if(!Z.halfExtents)m.fatalError("Block collider must have halfExtents!");return K1.ColliderDesc.cuboid(Z.halfExtents.x,Z.halfExtents.y,Z.halfExtents.z)}case"capsule":{if(!Z.halfHeight||!Z.radius)m.fatalError("Capsule collider must have halfHeight and radius!");return K1.ColliderDesc.capsule(Z.halfHeight,Z.radius)}case"cone":{if(!Z.radius||!Z.halfHeight)m.fatalError("Cone collider must have radius and halfHeight!");return K1.ColliderDesc.cone(Z.halfHeight,Z.radius)}case"cylinder":{if(!Z.radius||!Z.halfHeight)m.fatalError("Cylinder collider must have radius and halfHeight!");return K1.ColliderDesc.cylinder(Z.halfHeight,Z.radius)}case"round-cylinder":{if(!Z.radius||!Z.halfHeight||!Z.borderRadius)m.fatalError("Round cylinder collider must have radius, halfHeight, and borderRadius!");return K1.ColliderDesc.roundCylinder(Z.halfHeight,Z.radius,Z.borderRadius)}case"trimesh":{if(!Z.indices||!Z.vertices)m.fatalError("Trimesh collider must have vertices and indices!");return K1.ColliderDesc.trimesh(Z.vertices,Z.indices,$)}case"wedge":{if(!Z.extents)m.fatalError("Wedge collider must have extents!");let Y=this._buildWedgeConvexHullVertices(Z.extents),Q=K1.ColliderDesc.convexHull(Y);if(!Q)throw m.fatalError("Failed to create convex hull for wedge collider!"),new Error("Convex hull creation failed");return Q}default:m.fatalError(`Collider._createColliderDesc(): ${J} is not a valid collider shape!`)}}_requireSimulated(Z){if(!this.isSimulated)m.error(`Collider._requireSimulated(): Collider is not simulated, invoked method: ${Z}()`);return this.isSimulated}_requireUnsimulated(Z){if(this.isSimulated)m.error(`Collider._requireUnsimulated(): Collider is already simulated, invoked method: ${Z}()`);return!this.isSimulated}_requireNotRemoved(Z){if(this.isRemoved)m.error(`Collider._requireNotRemoved(): Collider is removed, invoked method: ${Z}()`);return!this.isRemoved}_setActiveCollisionTypes(){(this._collider??this._colliderDesc).setActiveCollisionTypes(K1.ActiveCollisionTypes.DYNAMIC_DYNAMIC|K1.ActiveCollisionTypes.DYNAMIC_KINEMATIC|K1.ActiveCollisionTypes.DYNAMIC_FIXED|K1.ActiveCollisionTypes.KINEMATIC_KINEMATIC|K1.ActiveCollisionTypes.KINEMATIC_FIXED)}}var xO1={shape:"trimesh",flags:f3.FIX_INTERNAL_EDGES},hO1=new Uint32Array([0,1,2,2,3,0,4,5,6,6,7,4,8,9,10,10,11,8,12,13,14,14,15,12,16,17,18,18,19,16,20,21,22,22,23,20]),fO1=new Float32Array([-0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,0.5,0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5]),iC;(($)=>{$.ENTITY_COLLISION="BLOCK_TYPE.ENTITY_COLLISION";$.ENTITY_CONTACT_FORCE="BLOCK_TYPE.ENTITY_CONTACT_FORCE"})(iC||={});class s5 extends g0{_id;_customColliderOptions;_isLiquid;_name;_textureUri;constructor(Z={id:-1,textureUri:"textures/missing.png",name:"Unknown"}){if(Z.id<0)m.fatalError("BlockType.constructor(): BlockType id not set.");super();this._id=Z.id,this._customColliderOptions=Z.customColliderOptions,this._isLiquid=Z.isLiquid??!1,this._name=Z.name,this._textureUri=Z.textureUri}get id(){return this._id}get colliderOptions(){return{...this._customColliderOptions,...xO1}}get isLiquid(){return this._isLiquid}get isMeshable(){return!this._customColliderOptions}get name(){return this._name}get textureUri(){return this._textureUri}createCollider(Z=hO1,J=fO1){let $=new a5({...this.colliderOptions,indices:Z,vertices:J});if(this.isLiquid)$.setSensor(!0);if(this.hasListeners("BLOCK_TYPE.ENTITY_COLLISION")||this.isLiquid)$.enableCollisionEvents(!0);if(this.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))$.enableContactForceEvents(!0);if(X4.isDefaultCollisionGroups($.collisionGroups))$.setCollisionGroups({belongsTo:[1],collidesWith:[65535&~1]});return $}serialize(){return p0.serializeBlockType(this)}}var nC;((J)=>J.REGISTER_BLOCK_TYPE="BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE")(nC||={});class tG extends g0{_blockTypes=new Map;_world;constructor(Z){super();this._world=Z}get world(){return this._world}getAllBlockTypes(){return Array.from(this._blockTypes.values())}getBlockType(Z){let J=this._blockTypes.get(Z);if(!J)m.fatalError(`BlockTypeRegistry.getBlockType(): BlockType with id ${Z} not found.`);return J}registerGenericBlockType(Z){let $=new class extends s5{constructor(Y=Z){super(Y)}};return this.registerBlockType($),$}registerBlockType(Z){this._blockTypes.set(Z.id,Z),this.emitWithWorld(this._world,"BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE",{blockTypeRegistry:this,id:Z.id,blockType:Z})}serialize(){return p0.serializeBlockTypeRegistry(this)}}var Nk={};$4(Nk,{worldSchema:()=>Rk,worldPacketDefinition:()=>se,vectorSchema:()=>v1,vectorBooleanSchema:()=>xT1,uiSchema:()=>jk,uiPacketDefinition:()=>ne,uiDatasSchema:()=>Mk,uiDatasPacketDefinition:()=>ae,uiDataSendPacketDefinition:()=>Ae,uiDataSchema:()=>Nz,syncResponseSchema:()=>Ok,syncResponsePacketDefinition:()=>ie,syncRequestSchema:()=>aT,syncRequestPacketDefinition:()=>_e,stateRequestSchema:()=>nT,stateRequestPacketDefinition:()=>Se,sceneUIsSchema:()=>Bk,sceneUIsPacketDefinition:()=>pe,sceneUISchema:()=>wk,rgbColorSchema:()=>z7,registeredPackets:()=>Jw,quaternionSchema:()=>Xk,playersSchema:()=>Lk,playersPacketDefinition:()=>le,playerSchema:()=>Uk,physicsDebugRenderSchema:()=>Fk,physicsDebugRenderPacketDefinition:()=>de,physicsDebugRaycastsSchema:()=>qk,physicsDebugRaycastsPacketDefinition:()=>ce,physicsDebugRaycastSchema:()=>Vk,outboundPackets:()=>Zw,modelNodeOverrideSchema:()=>Wk,lightsSchema:()=>Hk,lightsPacketDefinition:()=>ue,lightSchema:()=>zk,isValidPacket:()=>fT1,inputSchema:()=>iT,inputPacketDefinition:()=>ve,inboundPackets:()=>eL,hexColorSchema:()=>lT,heartbeatSchema:()=>cT,heartbeatPacketDefinition:()=>ke,entitySchema:()=>Kk,entitiesSchema:()=>Gk,entitiesPacketDefinition:()=>me,definePacket:()=>k0,debugConfigSchema:()=>pT,debugConfigPacketDefinition:()=>Ie,createPacket:()=>DT1,connectionSchema:()=>dT,connectionPacketDefinition:()=>Te,chunksSchema:()=>Qk,chunksPacketDefinition:()=>ge,chunkSchema:()=>Yk,chatMessagesSchema:()=>$k,chatMessagesPacketDefinition:()=>ye,chatMessageSendPacketDefinition:()=>Ee,chatMessageSchema:()=>Rz,cameraSchema:()=>Jk,cameraPacketDefinition:()=>be,blocksSchema:()=>tT,blocksPacketDefinition:()=>he,blockTypesSchema:()=>Zk,blockTypesPacketDefinition:()=>fe,blockTypeSchema:()=>eT,blockSchema:()=>rT,bidirectionalPackets:()=>tL,audiosSchema:()=>oT,audiosPacketDefinition:()=>xe,audioSchema:()=>sT,PacketId:()=>h1});var tL={};$4(tL,{heartbeatPacketDefinition:()=>ke,connectionPacketDefinition:()=>Te});var mT=t(De(),1);class uT extends mT.default{static instance=new mT.default}var h1;((T)=>{T[T.SYNC_REQUEST=0]="SYNC_REQUEST";T[T.INPUT=1]="INPUT";T[T.STATE_REQUEST=2]="STATE_REQUEST";T[T.CHAT_MESSAGE_SEND=3]="CHAT_MESSAGE_SEND";T[T.UI_DATA_SEND=4]="UI_DATA_SEND";T[T.SYNC_RESPONSE=32]="SYNC_RESPONSE";T[T.AUDIOS=33]="AUDIOS";T[T.BLOCKS=34]="BLOCKS";T[T.BLOCK_TYPES=35]="BLOCK_TYPES";T[T.CHAT_MESSAGES=36]="CHAT_MESSAGES";T[T.CHUNKS=37]="CHUNKS";T[T.ENTITIES=38]="ENTITIES";T[T.WORLD=39]="WORLD";T[T.CAMERA=40]="CAMERA";T[T.UI=41]="UI";T[T.UI_DATAS=42]="UI_DATAS";T[T.SCENE_UIS=43]="SCENE_UIS";T[T.LIGHTS=44]="LIGHTS";T[T.PLAYERS=45]="PLAYERS";T[T.CONNECTION=116]="CONNECTION";T[T.HEARTBEAT=117]="HEARTBEAT";T[T.DEBUG_CONFIG=128]="DEBUG_CONFIG";T[T.PHYSICS_DEBUG_RENDER=192]="PHYSICS_DEBUG_RENDER";T[T.PHYSICS_DEBUG_RAYCASTS=193]="PHYSICS_DEBUG_RAYCASTS"})(h1||={});function DT1(Z,J,$){if(!Z.validate(J))throw new Error(`Invalid payload for packet with id ${Z.id}. Error: ${uT.instance.errorsText(Z.validate.errors)}`);let Y=[Z.id,J];if(typeof $==="number")Y.push($);return Y}function k0(Z,J){return{id:Z,schema:J,validate:uT.instance.compile(J)}}var CT1={type:"object",properties:{i:{type:"string"}},required:["i"],additionalProperties:!1},Ce={type:"object",properties:{role:{type:"string",enum:["auto","client","server"],nullable:!0},fingerprints:{type:"array",items:{type:"object",properties:{algorithm:{type:"string",enum:["sha-1","sha-224","sha-256","sha-384","sha-512"]},value:{type:"string"}},required:["algorithm","value"]}}},required:["fingerprints"],additionalProperties:!1},TT1={type:"object",properties:{foundation:{type:"string"},priority:{type:"number"},ip:{type:"string"},address:{type:"string"},protocol:{type:"string",enum:["udp","tcp"]},port:{type:"number"},type:{type:"string",enum:["host"]},tcpType:{type:"string",enum:["passive"],nullable:!0}},required:["foundation","priority","ip","address","protocol","port","type"],additionalProperties:!1},kT1={type:"object",properties:{usernameFragment:{type:"string"},password:{type:"string"},iceLite:{type:"boolean",nullable:!0}},required:["usernameFragment","password"],additionalProperties:!1},ET1={type:"object",properties:{i:{type:"string"},l:{type:"string"}},required:["i","l"],additionalProperties:!1},IT1={type:"object",properties:{port:{type:"number"},OS:{type:"number"},MIS:{type:"number"},maxMessageSize:{type:"number"}},required:["port","OS","MIS","maxMessageSize"],additionalProperties:!0},vT1={type:"object",properties:{streamId:{type:"number"},ordered:{type:"boolean",nullable:!0},maxPacketLifeTime:{type:"number",nullable:!0},maxRetransmits:{type:"number",nullable:!0}},required:["streamId"],additionalProperties:!1},ST1={type:"object",properties:{i:{type:"string"},f:{type:"string",enum:["cs","sc"]},ip:kT1,ic:{type:"array",items:TT1},d:Ce,s:IT1},required:["i","f","ip","ic","d","s"],additionalProperties:!1},_T1={type:"object",properties:{i:{type:"string"},d:Ce},required:["i","d"],additionalProperties:!1},AT1={type:"object",properties:{i:{type:"string",nullable:!0},pi:{type:"string",nullable:!0},l:{type:"string"},s:vT1},required:["l","s"],additionalProperties:!1},dT={type:"object",properties:{i:{type:"string",nullable:!0},c:{..._T1,nullable:!0},ca:{...CT1,nullable:!0},d:{type:"array",items:{...AT1},nullable:!0},pa:{...ET1,nullable:!0},t:{type:"array",items:{...ST1},nullable:!0}},additionalProperties:!1};var Te=k0(116,dT);var cT={type:"null",nullable:!0};var ke=k0(117,cT);var eL={};$4(eL,{uiDataSendPacketDefinition:()=>Ae,syncRequestPacketDefinition:()=>_e,stateRequestPacketDefinition:()=>Se,inputPacketDefinition:()=>ve,debugConfigPacketDefinition:()=>Ie,chatMessageSendPacketDefinition:()=>Ee});var lT={type:"string",pattern:"^[0-9A-Fa-f]{6}$"};var Rz={type:"object",properties:{m:{type:"string"},c:{...lT,nullable:!0},p:{type:"string",nullable:!0}},required:["m"],additionalProperties:!1};var Ee=k0(3,Rz);var pT={type:"object",properties:{pdr:{type:"boolean",nullable:!0}},additionalProperties:!1};var Ie=k0(128,pT);var iT={type:"object",properties:{"1":{type:"boolean",nullable:!0},"2":{type:"boolean",nullable:!0},"3":{type:"boolean",nullable:!0},"4":{type:"boolean",nullable:!0},"5":{type:"boolean",nullable:!0},"6":{type:"boolean",nullable:!0},"7":{type:"boolean",nullable:!0},"8":{type:"boolean",nullable:!0},"9":{type:"boolean",nullable:!0},"0":{type:"boolean",nullable:!0},w:{type:"boolean",nullable:!0},a:{type:"boolean",nullable:!0},s:{type:"boolean",nullable:!0},d:{type:"boolean",nullable:!0},q:{type:"boolean",nullable:!0},e:{type:"boolean",nullable:!0},r:{type:"boolean",nullable:!0},f:{type:"boolean",nullable:!0},z:{type:"boolean",nullable:!0},x:{type:"boolean",nullable:!0},c:{type:"boolean",nullable:!0},v:{type:"boolean",nullable:!0},sp:{type:"boolean",nullable:!0},sh:{type:"boolean",nullable:!0},tb:{type:"boolean",nullable:!0},ml:{type:"boolean",nullable:!0},mr:{type:"boolean",nullable:!0},cp:{type:"number",nullable:!0},cy:{type:"number",nullable:!0},sq:{type:"number",nullable:!0}},additionalProperties:!1};var ve=k0(1,iT);var nT={type:"object",properties:{},additionalProperties:!1};var Se=k0(2,nT);var aT={type:"null",nullable:!0};var _e=k0(0,aT);var Nz={type:"object",properties:{},additionalProperties:!0};var Ae=k0(4,Nz);var Zw={};$4(Zw,{worldPacketDefinition:()=>se,uiPacketDefinition:()=>ne,uiDatasPacketDefinition:()=>ae,syncResponsePacketDefinition:()=>ie,sceneUIsPacketDefinition:()=>pe,playersPacketDefinition:()=>le,physicsDebugRenderPacketDefinition:()=>de,physicsDebugRaycastsPacketDefinition:()=>ce,lightsPacketDefinition:()=>ue,entitiesPacketDefinition:()=>me,chunksPacketDefinition:()=>ge,chatMessagesPacketDefinition:()=>ye,cameraPacketDefinition:()=>be,blocksPacketDefinition:()=>he,blockTypesPacketDefinition:()=>fe,audiosPacketDefinition:()=>xe});var v1={type:"array",items:[{type:"number"},{type:"number"},{type:"number"}],minItems:3,maxItems:3};var sT={type:"object",properties:{i:{type:"number"},a:{type:"string",nullable:!0},cd:{type:"number",nullable:!0},d:{type:"number",nullable:!0},de:{type:"number",nullable:!0},di:{type:"number",minimum:0,nullable:!0},e:{type:"number",nullable:!0},l:{type:"boolean",nullable:!0},o:{type:"number",nullable:!0},p:{...v1,nullable:!0},pa:{type:"boolean",nullable:!0},pl:{type:"boolean",nullable:!0},pr:{type:"number",minimum:0,nullable:!0},r:{type:"boolean",nullable:!0},rd:{type:"number",nullable:!0},s:{type:"number",nullable:!0},v:{type:"number",minimum:0,maximum:1,nullable:!0}},required:["i"],additionalProperties:!1};var oT={type:"array",items:{...sT}};var xe=k0(33,oT);var rT={type:"object",properties:{i:{type:"number"},c:v1},required:["i","c"],additionalProperties:!1};var tT={type:"array",items:{...rT}};var he=k0(34,tT);var eT={type:"object",properties:{i:{type:"number"},l:{type:"boolean",nullable:!0},n:{type:"string",nullable:!0},t:{type:"string",nullable:!0}},required:["i"],additionalProperties:!1};var Zk={type:"array",items:{...eT}};var fe=k0(35,Zk);var Jk={type:"object",properties:{m:{type:"number",nullable:!0},e:{type:"number",nullable:!0},et:{type:"number",nullable:!0},fo:{type:"number",nullable:!0},ffo:{type:"number",nullable:!0},fv:{type:"number",nullable:!0},p:{...v1,nullable:!0},pt:{...v1,nullable:!0},pl:{...v1,nullable:!0},h:{type:"array",items:{type:"string"},nullable:!0},o:{...v1,nullable:!0},z:{type:"number",nullable:!0}},additionalProperties:!1};var $k={type:"array",items:{...Rz}};var Yk={type:"object",properties:{c:v1,b:{type:"array",items:{type:"number",minimum:0,maximum:255},minItems:4096,maxItems:4096,nullable:!0},rm:{type:"boolean",nullable:!0}},required:["c"],additionalProperties:!1};var Qk={type:"array",items:{...Yk}};var z7={type:"array",items:[{type:"number",minimum:0,maximum:255},{type:"number",minimum:0,maximum:255},{type:"number",minimum:0,maximum:255}],minItems:3,maxItems:3};var Wk={type:"object",properties:{n:{type:"string"},h:{type:"boolean",nullable:!0},o:{type:"number",minimum:0,maximum:1,nullable:!0},r:{type:"boolean",nullable:!0},s:{type:"number",nullable:!0},t:{...z7,nullable:!0}},required:["n"],additionalProperties:!1};var Xk={type:"array",items:[{type:"number"},{type:"number"},{type:"number"},{type:"number"}],minItems:4,maxItems:4};var Kk={type:"object",properties:{i:{type:"number"},al:{type:"array",items:{type:"string"},nullable:!0},ao:{type:"array",items:{type:"string"},nullable:!0},ap:{type:"number",nullable:!0},as:{type:"array",items:{type:"string"},nullable:!0},bh:{...v1,nullable:!0},bt:{type:"string",nullable:!0},h:{type:"array",items:{type:"string"},nullable:!0},m:{type:"string",nullable:!0},mo:{type:"array",items:{...Wk},nullable:!0},n:{type:"string",nullable:!0},o:{type:"number",nullable:!0},p:{...v1,nullable:!0},pe:{type:"number",nullable:!0},pn:{type:"string",nullable:!0},r:{...Xk,nullable:!0},rm:{type:"boolean",nullable:!0},s:{type:"number",nullable:!0},t:{...z7,nullable:!0}},required:["i"],additionalProperties:!1};var Gk={type:"array",items:{...Kk}};var zk={type:"object",properties:{i:{type:"number"},a:{type:"number",nullable:!0},e:{type:"number",nullable:!0},c:{...z7,nullable:!0},d:{type:"number",nullable:!0},n:{type:"number",nullable:!0},o:{...v1,nullable:!0},p:{...v1,nullable:!0},pe:{type:"number",minimum:0,maximum:1,nullable:!0},rm:{type:"boolean",nullable:!0},t:{type:"number",nullable:!0},te:{type:"number",nullable:!0},tp:{...v1,nullable:!0}},required:["i"],additionalProperties:!1};var Hk={type:"array",items:{...zk}};var Vk={type:"object",properties:{o:{...v1},d:{...v1},l:{type:"number"},h:{type:"boolean"}},required:["o","d","l","h"],additionalProperties:!1};var qk={type:"array",items:{...Vk}};var Fk={type:"object",properties:{v:{type:"array",items:{type:"number"}},c:{type:"array",items:{type:"number"}}},required:["v","c"],additionalProperties:!1};var Uk={type:"object",properties:{i:{type:"string"},p:{type:"string",nullable:!0},rm:{type:"boolean",nullable:!0},u:{type:"string",nullable:!0}},required:["i"],additionalProperties:!1};var Lk={type:"array",items:{...Uk}};var wk={type:"object",properties:{i:{type:"number"},e:{type:"number",nullable:!0},o:{...v1,nullable:!0},p:{...v1,nullable:!0},rm:{type:"boolean",nullable:!0},s:{type:"object",nullable:!0},t:{type:"string",nullable:!0},v:{type:"number",nullable:!0}},required:["i"],additionalProperties:!1};var Bk={type:"array",items:{...wk}};var Ok={type:"object",properties:{r:{type:"number"},s:{type:"number"},p:{type:"number"},n:{type:"number"}},required:["r","s","p","n"],additionalProperties:!1};var jk={type:"object",properties:{p:{type:"boolean",nullable:!0},u:{type:"string",nullable:!0}},additionalProperties:!1};var Mk={type:"array",items:{...Nz}};var xT1={type:"array",items:[{type:"boolean"},{type:"boolean"},{type:"boolean"}],minItems:3,maxItems:3};var Rk={type:"object",properties:{i:{type:"number"},ac:{...z7,nullable:!0},ai:{type:"number",nullable:!0},dc:{...z7,nullable:!0},di:{type:"number",nullable:!0},dp:{...v1,nullable:!0},n:{type:"string",nullable:!0},s:{type:"string",nullable:!0},t:{type:"number",nullable:!0}},required:["i"],additionalProperties:!1};var be=k0(40,Jk);var ye=k0(36,$k);var ge=k0(37,Qk);var me=k0(38,Gk);var ue=k0(44,Hk);var de=k0(192,Fk);var ce=k0(193,qk);var le=k0(45,Lk);var pe=k0(43,Bk);var ie=k0(32,Ok);var ne=k0(41,jk);var ae=k0(42,Mk);var se=k0(39,Rk);var Jw=new Map,hT1={...tL,...eL,...Zw};for(let Z of Object.values(hT1))if("id"in Z&&"schema"in Z){let J=Z;if(Jw.has(J.id))throw new Error(`Packet with id ${J.id} is already registered.`);Jw.set(J.id,J)}function fT1(Z){if(typeof Z!=="object"||Z===null||typeof Z[0]!=="number"||Z[0]<0||Z[1]===void 0||Z[2]!==void 0&&(typeof Z[2]!=="number"||Z[2]<0))return!1;let J=Jw.get(Z[0]);return!!J&&J.validate(Z[1])}var Y0=Nk;import{WebSocket as e16}from"ws";var e6=t(e00(),1),HB6=e6.default.v1,VB6=e6.default.v1ToV6,qB6=e6.default.v3,Z10=e6.default.v4,FB6=e6.default.v5,UB6=e6.default.v6,LB6=e6.default.v6ToV1,wB6=e6.default.v7,BB6=e6.default.NIL,OB6=e6.default.MAX,jB6=e6.default.version,MB6=e6.default.validate,RB6=e6.default.stringify,NB6=e6.default.parse;var vk;try{vk=new TextDecoder}catch(Z){}var e,r5,y=0;var xk=[],_Y=xk,Cz=0,S1={},J1,OZ,o5=0,C9=0,l8,jZ,k5=[],e0,J10={useRecords:!1,mapsAsObjects:!0};class zw{}var hk=new zw;hk.name="MessagePack 0xC1";var EJ=!1,z10=2,Sk,_k,Ak;try{new Function("")}catch(Z){z10=1/0}class MZ{constructor(Z){if(Z){if(Z.useRecords===!1&&Z.mapsAsObjects===void 0)Z.mapsAsObjects=!0;if(Z.sequential&&Z.trusted!==!1){if(Z.trusted=!0,!Z.structures&&Z.useRecords!=!1){if(Z.structures=[],!Z.maxSharedStructures)Z.maxSharedStructures=0}}if(Z.structures)Z.structures.sharedLength=Z.structures.length;else if(Z.getStructures)(Z.structures=[]).uninitialized=!0,Z.structures.sharedLength=0;if(Z.int64AsNumber)Z.int64AsType="number"}Object.assign(this,Z)}unpack(Z,J){if(e)return M10(()=>{return Gw(),this?this.unpack(Z,J):MZ.prototype.unpack.call(J10,Z,J)});if(!Z.buffer&&Z.constructor===ArrayBuffer)Z=typeof Buffer!=="undefined"?Buffer.from(Z):new Uint8Array(Z);if(typeof J==="object")r5=J.end||Z.length,y=J.start||0;else y=0,r5=J>-1?J:Z.length;Cz=0,C9=0,OZ=null,_Y=xk,l8=null,e=Z;try{e0=Z.dataView||(Z.dataView=new DataView(Z.buffer,Z.byteOffset,Z.byteLength))}catch($){if(e=null,Z instanceof Uint8Array)throw $;throw new Error("Source must be a Uint8Array or Buffer but was a "+(Z&&typeof Z=="object"?Z.constructor.name:typeof Z))}if(this instanceof MZ){if(S1=this,this.structures)return J1=this.structures,Xw(J);else if(!J1||J1.length>0)J1=[]}else if(S1=J10,!J1||J1.length>0)J1=[];return Xw(J)}unpackMultiple(Z,J){let $,Y=0;try{EJ=!0;let Q=Z.length,W=this?this.unpack(Z,Q):Hw.unpack(Z,Q);if(J){if(J(W,Y,y)===!1)return;while(y<Q)if(Y=y,J(Xw(),Y,y)===!1)return}else{$=[W];while(y<Q)Y=y,$.push(Xw());return $}}catch(Q){throw Q.lastPosition=Y,Q.values=$,Q}finally{EJ=!1,Gw()}}_mergeStructures(Z,J){if(_k)Z=_k.call(this,Z);if(Z=Z||[],Object.isFrozen(Z))Z=Z.map(($)=>$.slice(0));for(let $=0,Y=Z.length;$<Y;$++){let Q=Z[$];if(Q){if(Q.isShared=!0,$>=32)Q.highByte=$-32>>5}}Z.sharedLength=Z.length;for(let $ in J||[])if($>=0){let Y=Z[$],Q=J[$];if(Q){if(Y)(Z.restoreStructures||(Z.restoreStructures=[]))[$]=Y;Z[$]=Q}}return this.structures=Z}decode(Z,J){return this.unpack(Z,J)}}function Xw(Z){try{if(!S1.trusted&&!EJ){let $=J1.sharedLength||0;if($<J1.length)J1.length=$}let J;if(S1.randomAccessStructure&&e[y]<64&&e[y]>=32&&Sk){if(J=Sk(e,y,r5,S1),e=null,!(Z&&Z.lazy)&&J)J=J.toJSON();y=r5}else J=C8();if(l8)y=l8.postBundlePosition,l8=null;if(EJ)J1.restoreStructures=null;if(y==r5){if(J1&&J1.restoreStructures)$10();if(J1=null,e=null,jZ)jZ=null}else if(y>r5)throw new Error("Unexpected end of MessagePack data");else if(!EJ){let $;try{$=JSON.stringify(J,(Y,Q)=>typeof Q==="bigint"?`${Q}n`:Q).slice(0,100)}catch(Y){$="(JSON view not available "+Y+")"}throw new Error("Data read, but end of buffer not reached "+$)}return J}catch(J){if(J1&&J1.restoreStructures)$10();if(Gw(),J instanceof RangeError||J.message.startsWith("Unexpected end of buffer")||y>r5)J.incomplete=!0;throw J}}function $10(){for(let Z in J1.restoreStructures)J1[Z]=J1.restoreStructures[Z];J1.restoreStructures=null}function C8(){let Z=e[y++];if(Z<160)if(Z<128)if(Z<64)return Z;else{let J=J1[Z&63]||S1.getStructures&&H10()[Z&63];if(J){if(!J.read)J.read=fk(J,Z&63);return J.read()}else return Z}else if(Z<144)if(Z-=128,S1.mapsAsObjects){let J={};for(let $=0;$<Z;$++){let Y=O10();if(Y==="__proto__")Y="__proto_";J[Y]=C8()}return J}else{let J=new Map;for(let $=0;$<Z;$++)J.set(C8(),C8());return J}else{Z-=144;let J=new Array(Z);for(let $=0;$<Z;$++)J[$]=C8();if(S1.freezeData)return Object.freeze(J);return J}else if(Z<192){let J=Z-160;if(C9>=y)return OZ.slice(y-o5,(y+=J)-o5);if(C9==0&&r5<140){let $=J<16?bk(J):B10(J);if($!=null)return $}return Kw(J)}else{let J;switch(Z){case 192:return null;case 193:if(l8)if(J=C8(),J>0)return l8[1].slice(l8.position1,l8.position1+=J);else return l8[0].slice(l8.position0,l8.position0-=J);return hk;case 194:return!1;case 195:return!0;case 196:if(J=e[y++],J===void 0)throw new Error("Unexpected end of buffer");return Ik(J);case 197:return J=e0.getUint16(y),y+=2,Ik(J);case 198:return J=e0.getUint32(y),y+=4,Ik(J);case 199:return SY(e[y++]);case 200:return J=e0.getUint16(y),y+=2,SY(J);case 201:return J=e0.getUint32(y),y+=4,SY(J);case 202:if(J=e0.getFloat32(y),S1.useFloat32>2){let $=xY[(e[y]&127)<<1|e[y+1]>>7];return y+=4,($*J+(J>0?0.5:-0.5)>>0)/$}return y+=4,J;case 203:return J=e0.getFloat64(y),y+=8,J;case 204:return e[y++];case 205:return J=e0.getUint16(y),y+=2,J;case 206:return J=e0.getUint32(y),y+=4,J;case 207:if(S1.int64AsType==="number")J=e0.getUint32(y)*4294967296,J+=e0.getUint32(y+4);else if(S1.int64AsType==="string")J=e0.getBigUint64(y).toString();else if(S1.int64AsType==="auto"){if(J=e0.getBigUint64(y),J<=BigInt(2)<<BigInt(52))J=Number(J)}else J=e0.getBigUint64(y);return y+=8,J;case 208:return e0.getInt8(y++);case 209:return J=e0.getInt16(y),y+=2,J;case 210:return J=e0.getInt32(y),y+=4,J;case 211:if(S1.int64AsType==="number")J=e0.getInt32(y)*4294967296,J+=e0.getUint32(y+4);else if(S1.int64AsType==="string")J=e0.getBigInt64(y).toString();else if(S1.int64AsType==="auto"){if(J=e0.getBigInt64(y),J>=BigInt(-2)<<BigInt(52)&&J<=BigInt(2)<<BigInt(52))J=Number(J)}else J=e0.getBigInt64(y);return y+=8,J;case 212:if(J=e[y++],J==114)return G10(e[y++]&63);else{let $=k5[J];if($)if($.read)return y++,$.read(C8());else if($.noBuffer)return y++,$();else return $(e.subarray(y,++y));else throw new Error("Unknown extension "+J)}case 213:if(J=e[y],J==114)return y++,G10(e[y++]&63,e[y++]);else return SY(2);case 214:return SY(4);case 215:return SY(8);case 216:return SY(16);case 217:if(J=e[y++],C9>=y)return OZ.slice(y-o5,(y+=J)-o5);return V10(J);case 218:if(J=e0.getUint16(y),y+=2,C9>=y)return OZ.slice(y-o5,(y+=J)-o5);return q10(J);case 219:if(J=e0.getUint32(y),y+=4,C9>=y)return OZ.slice(y-o5,(y+=J)-o5);return F10(J);case 220:return J=e0.getUint16(y),y+=2,Q10(J);case 221:return J=e0.getUint32(y),y+=4,Q10(J);case 222:return J=e0.getUint16(y),y+=2,W10(J);case 223:return J=e0.getUint32(y),y+=4,W10(J);default:if(Z>=224)return Z-256;if(Z===void 0){let $=new Error("Unexpected end of MessagePack data");throw $.incomplete=!0,$}throw new Error("Unknown MessagePack token "+Z)}}}var VE1=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function fk(Z,J){function $(){if($.count++>z10){let Q=Z.read=new Function("r","return function(){return "+(S1.freezeData?"Object.freeze":"")+"({"+Z.map((W)=>W==="__proto__"?"__proto_:r()":VE1.test(W)?W+":r()":"["+JSON.stringify(W)+"]:r()").join(",")+"})}")(C8);if(Z.highByte===0)Z.read=Y10(J,Z.read);return Q()}let Y={};for(let Q=0,W=Z.length;Q<W;Q++){let X=Z[Q];if(X==="__proto__")X="__proto_";Y[X]=C8()}if(S1.freezeData)return Object.freeze(Y);return Y}if($.count=0,Z.highByte===0)return Y10(J,$);return $}var Y10=(Z,J)=>{return function(){let $=e[y++];if($===0)return J();let Y=Z<32?-(Z+($<<5)):Z+($<<5),Q=J1[Y]||H10()[Y];if(!Q)throw new Error("Record id is not defined for "+Y);if(!Q.read)Q.read=fk(Q,Z);return Q.read()}};function H10(){let Z=M10(()=>{return e=null,S1.getStructures()});return J1=S1._mergeStructures(Z,J1)}var Kw=AY,V10=AY,q10=AY,F10=AY,U10=!1;function L10(Z){U10=!0,Kw=J(1),V10=J(2),q10=J(3),F10=J(5);function J($){return function Y(Q){let W=_Y[Cz++];if(W==null){if(l8)return AY(Q);let K=e.byteOffset,G=Z(y-$+K,r5+K,e.buffer);if(typeof G=="string")W=G,_Y=xk;else if(_Y=G,Cz=1,C9=1,W=_Y[0],W===void 0)throw new Error("Unexpected end of buffer")}let X=W.length;if(X<=Q)return y+=Q,W;return OZ=W,o5=y,C9=y+X,y+=Q,W.slice(0,Q)}}}function AY(Z){let J;if(Z<16){if(J=bk(Z))return J}if(Z>64&&vk)return vk.decode(e.subarray(y,y+=Z));let $=y+Z,Y=[];J="";while(y<$){let Q=e[y++];if((Q&128)===0)Y.push(Q);else if((Q&224)===192){let W=e[y++]&63;Y.push((Q&31)<<6|W)}else if((Q&240)===224){let W=e[y++]&63,X=e[y++]&63;Y.push((Q&31)<<12|W<<6|X)}else if((Q&248)===240){let W=e[y++]&63,X=e[y++]&63,K=e[y++]&63,G=(Q&7)<<18|W<<12|X<<6|K;if(G>65535)G-=65536,Y.push(G>>>10&1023|55296),G=56320|G&1023;Y.push(G)}else Y.push(Q);if(Y.length>=4096)J+=J6.apply(String,Y),Y.length=0}if(Y.length>0)J+=J6.apply(String,Y);return J}function w10(Z,J,$){let Y=e;e=Z,y=J;try{return AY($)}finally{e=Y}}function Q10(Z){let J=new Array(Z);for(let $=0;$<Z;$++)J[$]=C8();if(S1.freezeData)return Object.freeze(J);return J}function W10(Z){if(S1.mapsAsObjects){let J={};for(let $=0;$<Z;$++){let Y=O10();if(Y==="__proto__")Y="__proto_";J[Y]=C8()}return J}else{let J=new Map;for(let $=0;$<Z;$++)J.set(C8(),C8());return J}}var J6=String.fromCharCode;function B10(Z){let J=y,$=new Array(Z);for(let Y=0;Y<Z;Y++){let Q=e[y++];if((Q&128)>0){y=J;return}$[Y]=Q}return J6.apply(String,$)}function bk(Z){if(Z<4)if(Z<2)if(Z===0)return"";else{let J=e[y++];if((J&128)>1){y-=1;return}return J6(J)}else{let J=e[y++],$=e[y++];if((J&128)>0||($&128)>0){y-=2;return}if(Z<3)return J6(J,$);let Y=e[y++];if((Y&128)>0){y-=3;return}return J6(J,$,Y)}else{let J=e[y++],$=e[y++],Y=e[y++],Q=e[y++];if((J&128)>0||($&128)>0||(Y&128)>0||(Q&128)>0){y-=4;return}if(Z<6)if(Z===4)return J6(J,$,Y,Q);else{let W=e[y++];if((W&128)>0){y-=5;return}return J6(J,$,Y,Q,W)}else if(Z<8){let W=e[y++],X=e[y++];if((W&128)>0||(X&128)>0){y-=6;return}if(Z<7)return J6(J,$,Y,Q,W,X);let K=e[y++];if((K&128)>0){y-=7;return}return J6(J,$,Y,Q,W,X,K)}else{let W=e[y++],X=e[y++],K=e[y++],G=e[y++];if((W&128)>0||(X&128)>0||(K&128)>0||(G&128)>0){y-=8;return}if(Z<10)if(Z===8)return J6(J,$,Y,Q,W,X,K,G);else{let z=e[y++];if((z&128)>0){y-=9;return}return J6(J,$,Y,Q,W,X,K,G,z)}else if(Z<12){let z=e[y++],H=e[y++];if((z&128)>0||(H&128)>0){y-=10;return}if(Z<11)return J6(J,$,Y,Q,W,X,K,G,z,H);let V=e[y++];if((V&128)>0){y-=11;return}return J6(J,$,Y,Q,W,X,K,G,z,H,V)}else{let z=e[y++],H=e[y++],V=e[y++],q=e[y++];if((z&128)>0||(H&128)>0||(V&128)>0||(q&128)>0){y-=12;return}if(Z<14)if(Z===12)return J6(J,$,Y,Q,W,X,K,G,z,H,V,q);else{let F=e[y++];if((F&128)>0){y-=13;return}return J6(J,$,Y,Q,W,X,K,G,z,H,V,q,F)}else{let F=e[y++],U=e[y++];if((F&128)>0||(U&128)>0){y-=14;return}if(Z<15)return J6(J,$,Y,Q,W,X,K,G,z,H,V,q,F,U);let w=e[y++];if((w&128)>0){y-=15;return}return J6(J,$,Y,Q,W,X,K,G,z,H,V,q,F,U,w)}}}}}function X10(){let Z=e[y++],J;if(Z<192)J=Z-160;else switch(Z){case 217:J=e[y++];break;case 218:J=e0.getUint16(y),y+=2;break;case 219:J=e0.getUint32(y),y+=4;break;default:throw new Error("Expected string")}return AY(J)}function Ik(Z){return S1.copyBuffers?Uint8Array.prototype.slice.call(e,y,y+=Z):e.subarray(y,y+=Z)}function SY(Z){let J=e[y++];if(k5[J]){let $;return k5[J](e.subarray(y,$=y+=Z),(Y)=>{y=Y;try{return C8()}finally{y=$}})}else throw new Error("Unknown extension type "+J)}var K10=new Array(4096);function O10(){let Z=e[y++];if(Z>=160&&Z<192){if(Z=Z-160,C9>=y)return OZ.slice(y-o5,(y+=Z)-o5);else if(!(C9==0&&r5<180))return Kw(Z)}else return y--,j10(C8());let J=(Z<<5^(Z>1?e0.getUint16(y):Z>0?e[y]:0))&4095,$=K10[J],Y=y,Q=y+Z-3,W,X=0;if($&&$.bytes==Z){while(Y<Q){if(W=e0.getUint32(Y),W!=$[X++]){Y=1879048192;break}Y+=4}Q+=3;while(Y<Q)if(W=e[Y++],W!=$[X++]){Y=1879048192;break}if(Y===Q)return y=Y,$.string;Q-=3,Y=y}$=[],K10[J]=$,$.bytes=Z;while(Y<Q)W=e0.getUint32(Y),$.push(W),Y+=4;Q+=3;while(Y<Q)W=e[Y++],$.push(W);let K=Z<16?bk(Z):B10(Z);if(K!=null)return $.string=K;return $.string=Kw(Z)}function j10(Z){if(typeof Z==="string")return Z;if(typeof Z==="number"||typeof Z==="boolean"||typeof Z==="bigint")return Z.toString();if(Z==null)return Z+"";if(S1.allowArraysInMapKeys&&Array.isArray(Z)&&Z.flat().every((J)=>["string","number","boolean","bigint"].includes(typeof J)))return Z.flat().toString();throw new Error(`Invalid property type for record: ${typeof Z}`)}var G10=(Z,J)=>{let $=C8().map(j10),Y=Z;if(J!==void 0)Z=Z<32?-((J<<5)+Z):(J<<5)+Z,$.highByte=J;let Q=J1[Z];if(Q&&(Q.isShared||EJ))(J1.restoreStructures||(J1.restoreStructures=[]))[Z]=Q;return J1[Z]=$,$.read=fk($,Y),$.read()};k5[0]=()=>{};k5[0].noBuffer=!0;k5[66]=(Z)=>{let J=Z.length,$=BigInt(Z[0]&128?Z[0]-256:Z[0]);for(let Y=1;Y<J;Y++)$<<=BigInt(8),$+=BigInt(Z[Y]);return $};var qE1={Error,TypeError,ReferenceError};k5[101]=()=>{let Z=C8();return(qE1[Z[0]]||Error)(Z[1],{cause:Z[2]})};k5[105]=(Z)=>{if(S1.structuredClone===!1)throw new Error("Structured clone extension is disabled");let J=e0.getUint32(y-4);if(!jZ)jZ=new Map;let $=e[y],Y;if($>=144&&$<160||$==220||$==221)Y=[];else if($>=128&&$<144||$==222||$==223)Y=new Map;else if(($>=199&&$<=201||$>=212&&$<=216)&&e[y+1]===115)Y=new Set;else Y={};let Q={target:Y};jZ.set(J,Q);let W=C8();if(!Q.used)return Q.target=W;else Object.assign(Y,W);if(Y instanceof Map)for(let[X,K]of W.entries())Y.set(X,K);if(Y instanceof Set)for(let X of Array.from(W))Y.add(X);return Y};k5[112]=(Z)=>{if(S1.structuredClone===!1)throw new Error("Structured clone extension is disabled");let J=e0.getUint32(y-4),$=jZ.get(J);return $.used=!0,$.target};k5[115]=()=>new Set(C8());var yk=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map((Z)=>Z+"Array"),FE1=typeof globalThis==="object"?globalThis:window;k5[116]=(Z)=>{let J=Z[0],$=Uint8Array.prototype.slice.call(Z,1).buffer,Y=yk[J];if(!Y){if(J===16)return $;if(J===17)return new DataView($);throw new Error("Could not find typed array for code "+J)}return new FE1[Y]($)};k5[120]=()=>{let Z=C8();return new RegExp(Z[0],Z[1])};var UE1=[];k5[98]=(Z)=>{let J=(Z[0]<<24)+(Z[1]<<16)+(Z[2]<<8)+Z[3],$=y;return y+=J-Z.length,l8=UE1,l8=[X10(),X10()],l8.position0=0,l8.position1=0,l8.postBundlePosition=y,y=$,C8()};k5[255]=(Z)=>{if(Z.length==4)return new Date((Z[0]*16777216+(Z[1]<<16)+(Z[2]<<8)+Z[3])*1000);else if(Z.length==8)return new Date(((Z[0]<<22)+(Z[1]<<14)+(Z[2]<<6)+(Z[3]>>2))/1e6+((Z[3]&3)*4294967296+Z[4]*16777216+(Z[5]<<16)+(Z[6]<<8)+Z[7])*1000);else if(Z.length==12)return new Date(((Z[0]<<24)+(Z[1]<<16)+(Z[2]<<8)+Z[3])/1e6+((Z[4]&128?-281474976710656:0)+Z[6]*1099511627776+Z[7]*4294967296+Z[8]*16777216+(Z[9]<<16)+(Z[10]<<8)+Z[11])*1000);else return new Date("invalid")};function M10(Z){if(Ak)Ak();let J=r5,$=y,Y=Cz,Q=o5,W=C9,X=OZ,K=_Y,G=jZ,z=l8,H=new Uint8Array(e.slice(0,r5)),V=J1,q=J1.slice(0,J1.length),F=S1,U=EJ,w=Z();return r5=J,y=$,Cz=Y,o5=Q,C9=W,OZ=X,_Y=K,jZ=G,l8=z,e=H,EJ=U,J1=V,J1.splice(0,J1.length,...q),S1=F,e0=new DataView(e.buffer,e.byteOffset,e.byteLength),w}function Gw(){e=null,jZ=null,J1=null}var xY=new Array(147);for(let Z=0;Z<256;Z++)xY[Z]=+("1e"+Math.floor(45.15-Z*0.30103));var Hw=new MZ({useRecords:!1}),LE1=Hw.unpack,wE1=Hw.unpackMultiple,BE1=Hw.unpack;var OE1=new Float32Array(1),DB6=new Uint8Array(OE1.buffer,0,4);function R10(Z,J,$){Sk=Z,_k=J,Ak=$}var qw;try{qw=new TextEncoder}catch(Z){}var uk,C10,kz=typeof Buffer!=="undefined",Vw=kz?function(Z){return Buffer.allocUnsafeSlow(Z)}:Uint8Array,T10=kz?Buffer:Uint8Array,N10=kz?4294967296:2144337920,c,Tz,_1,g=0,Z5,e1=null,k10,jE1=21760,ME1=/[\u0080-\uFFFF]/,H7=Symbol("record-id");class hY extends MZ{constructor(Z){super(Z);this.offset=0;let J,$,Y,Q,W,X=T10.prototype.utf8Write?function(I,v){return c.utf8Write(I,v,c.byteLength-v)}:qw&&qw.encodeInto?function(I,v){return qw.encodeInto(I,c.subarray(v)).written}:!1,K=this;if(!Z)Z={};let G=Z&&Z.sequential,z=Z.structures||Z.saveStructures,H=Z.maxSharedStructures;if(H==null)H=z?32:0;if(H>8160)throw new Error("Maximum maxSharedStructure is 8160");if(Z.structuredClone&&Z.moreTypes==null)this.moreTypes=!0;let V=Z.maxOwnStructures;if(V==null)V=z?32:64;if(!this.structures&&Z.useRecords!=!1)this.structures=[];let q=H>32||V+H>64,F=H+64,U=H+V+64;if(U>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let w=[],L=0,O=0;this.pack=this.encode=function(I,v){if(!c)c=new Vw(8192),_1=c.dataView||(c.dataView=new DataView(c.buffer,0,8192)),g=0;if(Z5=c.length-10,Z5-g<2048)c=new Vw(c.length),_1=c.dataView||(c.dataView=new DataView(c.buffer,0,c.length)),Z5=c.length-10,g=0;else g=g+7&2147483640;if($=g,v&kE1)g+=v&255;if(W=K.structuredClone?new Map:null,K.bundleStrings&&typeof I!=="string")e1=[],e1.size=1/0;else e1=null;if(Q=K.structures,Q){if(Q.uninitialized)Q=K._mergeStructures(K.getStructures());let p=Q.sharedLength||0;if(p>H)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+Q.sharedLength);if(!Q.transitions){Q.transitions=Object.create(null);for(let n=0;n<p;n++){let o=Q[n];if(!o)continue;let $0,W0=Q.transitions;for(let C0=0,T0=o.length;C0<T0;C0++){let a0=o[C0];if($0=W0[a0],!$0)$0=W0[a0]=Object.create(null);W0=$0}W0[H7]=n+64}this.lastNamedStructuresLength=p}if(!G)Q.nextId=p+64}if(Y)Y=!1;let f;try{if(K.randomAccessStructure&&I&&I.constructor&&I.constructor===Object)x(I);else N(I);let p=e1;if(e1)P10($,N,0);if(W&&W.idsToInsert){let n=W.idsToInsert.sort((C0,T0)=>C0.offset>T0.offset?1:-1),o=n.length,$0=-1;while(p&&o>0){let C0=n[--o].offset+$;if(C0<p.stringsPosition+$&&$0===-1)$0=0;if(C0>p.position+$){if($0>=0)$0+=6}else{if($0>=0)_1.setUint32(p.position+$,_1.getUint32(p.position+$)+$0),$0=-1;p=p.previous,o++}}if($0>=0&&p)_1.setUint32(p.position+$,_1.getUint32(p.position+$)+$0);if(g+=n.length*6,g>Z5)E(g);K.offset=g;let W0=NE1(c.subarray($,g),n);return W=null,W0}if(K.offset=g,v&CE1)return c.start=$,c.end=g,c;return c.subarray($,g)}catch(p){throw f=p,p}finally{if(Q){if(j(),Y&&K.saveStructures){let p=Q.sharedLength||0,n=c.subarray($,g),o=E10(Q,K);if(!f){if(K.saveStructures(o,o.isCompatible)===!1)return K.pack(I,v);if(K.lastNamedStructuresLength=p,c.length>1073741824)c=null;return n}}}if(c.length>1073741824)c=null;if(v&TE1)g=$}};let j=()=>{if(O<10)O++;let I=Q.sharedLength||0;if(Q.length>I&&!G)Q.length=I;if(L>1e4){if(Q.transitions=null,O=0,L=0,w.length>0)w=[]}else if(w.length>0&&!G){for(let v=0,f=w.length;v<f;v++)w[v][H7]=0;w=[]}},M=(I)=>{var v=I.length;if(v<16)c[g++]=144|v;else if(v<65536)c[g++]=220,c[g++]=v>>8,c[g++]=v&255;else c[g++]=221,_1.setUint32(g,v),g+=4;for(let f=0;f<v;f++)N(I[f])},N=(I)=>{if(g>Z5)c=E(g);var v=typeof I,f;if(v==="string"){let p=I.length;if(e1&&p>=4&&p<4096){if((e1.size+=p)>jE1){let W0,C0=(e1[0]?e1[0].length*3+e1[1].length:0)+10;if(g+C0>Z5)c=E(g+C0);let T0;if(e1.position)T0=e1,c[g]=200,g+=3,c[g++]=98,W0=g-$,g+=4,P10($,N,0),_1.setUint16(W0+$-3,g-$-W0);else c[g++]=214,c[g++]=98,W0=g-$,g+=4;e1=["",""],e1.previous=T0,e1.size=0,e1.position=W0}let $0=ME1.test(I);e1[$0?0:1]+=I,c[g++]=193,N($0?-p:p);return}let n;if(p<32)n=1;else if(p<256)n=2;else if(p<65536)n=3;else n=5;let o=p*3;if(g+o>Z5)c=E(g+o);if(p<64||!X){let $0,W0,C0,T0=g+n;for($0=0;$0<p;$0++)if(W0=I.charCodeAt($0),W0<128)c[T0++]=W0;else if(W0<2048)c[T0++]=W0>>6|192,c[T0++]=W0&63|128;else if((W0&64512)===55296&&((C0=I.charCodeAt($0+1))&64512)===56320)W0=65536+((W0&1023)<<10)+(C0&1023),$0++,c[T0++]=W0>>18|240,c[T0++]=W0>>12&63|128,c[T0++]=W0>>6&63|128,c[T0++]=W0&63|128;else c[T0++]=W0>>12|224,c[T0++]=W0>>6&63|128,c[T0++]=W0&63|128;f=T0-g-n}else f=X(I,g+n);if(f<32)c[g++]=160|f;else if(f<256){if(n<2)c.copyWithin(g+2,g+1,g+1+f);c[g++]=217,c[g++]=f}else if(f<65536){if(n<3)c.copyWithin(g+3,g+2,g+2+f);c[g++]=218,c[g++]=f>>8,c[g++]=f&255}else{if(n<5)c.copyWithin(g+5,g+3,g+3+f);c[g++]=219,_1.setUint32(g,f),g+=4}g+=f}else if(v==="number")if(I>>>0===I)if(I<32||I<128&&this.useRecords===!1||I<64&&!this.randomAccessStructure)c[g++]=I;else if(I<256)c[g++]=204,c[g++]=I;else if(I<65536)c[g++]=205,c[g++]=I>>8,c[g++]=I&255;else c[g++]=206,_1.setUint32(g,I),g+=4;else if(I>>0===I)if(I>=-32)c[g++]=256+I;else if(I>=-128)c[g++]=208,c[g++]=I+256;else if(I>=-32768)c[g++]=209,_1.setInt16(g,I),g+=2;else c[g++]=210,_1.setInt32(g,I),g+=4;else{let p;if((p=this.useFloat32)>0&&I<4294967296&&I>=-2147483648){c[g++]=202,_1.setFloat32(g,I);let n;if(p<4||(n=I*xY[(c[g]&127)<<1|c[g+1]>>7])>>0===n){g+=4;return}else g--}c[g++]=203,_1.setFloat64(g,I),g+=8}else if(v==="object"||v==="function")if(!I)c[g++]=192;else{if(W){let n=W.get(I);if(n){if(!n.id){let o=W.idsToInsert||(W.idsToInsert=[]);n.id=o.push(n)}c[g++]=214,c[g++]=112,_1.setUint32(g,n.id),g+=4;return}else W.set(I,{offset:g-$})}let p=I.constructor;if(p===Object)T(I);else if(p===Array)M(I);else if(p===Map)if(this.mapAsEmptyObject)c[g++]=128;else{if(f=I.size,f<16)c[g++]=128|f;else if(f<65536)c[g++]=222,c[g++]=f>>8,c[g++]=f&255;else c[g++]=223,_1.setUint32(g,f),g+=4;for(let[n,o]of I)N(n),N(o)}else{for(let n=0,o=uk.length;n<o;n++){let $0=C10[n];if(I instanceof $0){let W0=uk[n];if(W0.write){if(W0.type)c[g++]=212,c[g++]=W0.type,c[g++]=0;let s1=W0.write.call(this,I);if(s1===I)if(Array.isArray(I))M(I);else T(I);else N(s1);return}let C0=c,T0=_1,a0=g;c=null;let _8;try{_8=W0.pack.call(this,I,(s1)=>{if(c=C0,C0=null,g+=s1,g>Z5)E(g);return{target:c,targetView:_1,position:g-s1}},N)}finally{if(C0)c=C0,_1=T0,g=a0,Z5=c.length-10}if(_8){if(_8.length+g>Z5)E(_8.length+g);g=RE1(_8,c,g,W0.type)}return}}if(Array.isArray(I))M(I);else{if(I.toJSON){let n=I.toJSON();if(n!==I)return N(n)}if(v==="function")return N(this.writeFunction&&this.writeFunction(I));T(I)}}}else if(v==="boolean")c[g++]=I?195:194;else if(v==="bigint"){if(I<9223372036854776000&&I>=-9223372036854776000)c[g++]=211,_1.setBigInt64(g,I);else if(I<18446744073709552000&&I>0)c[g++]=207,_1.setBigUint64(g,I);else if(this.largeBigIntToFloat)c[g++]=203,_1.setFloat64(g,Number(I));else if(this.largeBigIntToString)return N(I.toString());else if((this.useBigIntExtension||this.moreTypes)&&I<BigInt(2)**BigInt(1023)&&I>-(BigInt(2)**BigInt(1023))){c[g++]=199,g++,c[g++]=66;let p=[],n;do{let o=I&BigInt(255);n=(o&BigInt(128))===(I<BigInt(0)?BigInt(128):BigInt(0)),p.push(o),I>>=BigInt(8)}while(!((I===BigInt(0)||I===BigInt(-1))&&n));c[g-2]=p.length;for(let o=p.length;o>0;)c[g++]=Number(p[--o]);return}else throw new RangeError(I+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string");g+=8}else if(v==="undefined")if(this.encodeUndefinedAsNil)c[g++]=192;else c[g++]=212,c[g++]=0,c[g++]=0;else throw new Error("Unknown type: "+v)},D=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?(I)=>{let v;if(this.skipValues){v=[];for(let n in I)if((typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(n))&&!this.skipValues.includes(I[n]))v.push(n)}else v=Object.keys(I);let f=v.length;if(f<16)c[g++]=128|f;else if(f<65536)c[g++]=222,c[g++]=f>>8,c[g++]=f&255;else c[g++]=223,_1.setUint32(g,f),g+=4;let p;if(this.coercibleKeyAsNumber)for(let n=0;n<f;n++){p=v[n];let o=Number(p);N(isNaN(o)?p:o),N(I[p])}else for(let n=0;n<f;n++)N(p=v[n]),N(I[p])}:(I)=>{c[g++]=222;let v=g-$;g+=2;let f=0;for(let p in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(p))N(p),N(I[p]),f++;if(f>65535)throw new Error('Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object');c[v+++$]=f>>8,c[v+$]=f&255},P=this.useRecords===!1?D:Z.progressiveRecords&&!q?(I)=>{let v,f=Q.transitions||(Q.transitions=Object.create(null)),p=g++-$,n;for(let o in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(o)){if(v=f[o],v)f=v;else{let $0=Object.keys(I),W0=f;f=Q.transitions;let C0=0;for(let T0=0,a0=$0.length;T0<a0;T0++){let _8=$0[T0];if(v=f[_8],!v)v=f[_8]=Object.create(null),C0++;f=v}if(p+$+1==g)g--,A(f,$0,C0);else S(f,$0,p,C0);n=!0,f=W0[o]}N(I[o])}if(!n){let o=f[H7];if(o)c[p+$]=o;else S(f,Object.keys(I),p,0)}}:(I)=>{let v,f=Q.transitions||(Q.transitions=Object.create(null)),p=0;for(let o in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(o)){if(v=f[o],!v)v=f[o]=Object.create(null),p++;f=v}let n=f[H7];if(n)if(n>=96&&q)c[g++]=((n-=96)&31)+96,c[g++]=n>>5;else c[g++]=n;else A(f,f.__keys__||Object.keys(I),p);for(let o in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(o))N(I[o])},C=typeof this.useRecords=="function"&&this.useRecords,T=C?(I)=>{C(I)?P(I):D(I)}:P,E=(I)=>{let v;if(I>16777216){if(I-$>N10)throw new Error("Packed buffer would be larger than maximum buffer size");v=Math.min(N10,Math.round(Math.max((I-$)*(I>67108864?1.25:2),4194304)/4096)*4096)}else v=(Math.max(I-$<<2,c.length-1)>>12)+1<<12;let f=new Vw(v);if(_1=f.dataView||(f.dataView=new DataView(f.buffer,0,v)),I=Math.min(I,c.length),c.copy)c.copy(f,0,$,I);else f.set(c.slice($,I));return g-=$,$=0,Z5=f.length-10,c=f},A=(I,v,f)=>{let p=Q.nextId;if(!p)p=64;if(p<F&&this.shouldShareStructure&&!this.shouldShareStructure(v)){if(p=Q.nextOwnId,!(p<U))p=F;Q.nextOwnId=p+1}else{if(p>=U)p=F;Q.nextId=p+1}let n=v.highByte=p>=96&&q?p-96>>5:-1;if(I[H7]=p,I.__keys__=v,Q[p-64]=v,p<F)if(v.isShared=!0,Q.sharedLength=p-63,Y=!0,n>=0)c[g++]=(p&31)+96,c[g++]=n;else c[g++]=p;else{if(n>=0)c[g++]=213,c[g++]=114,c[g++]=(p&31)+96,c[g++]=n;else c[g++]=212,c[g++]=114,c[g++]=p;if(f)L+=O*f;if(w.length>=V)w.shift()[H7]=0;w.push(I),N(v)}},S=(I,v,f,p)=>{let n=c,o=g,$0=Z5,W0=$;if(c=Tz,g=0,$=0,!c)Tz=c=new Vw(8192);Z5=c.length-10,A(I,v,p),Tz=c;let C0=g;if(c=n,g=o,Z5=$0,$=W0,C0>1){let T0=g+C0-1;if(T0>Z5)E(T0);let a0=f+$;c.copyWithin(a0+C0,a0+1,g),c.set(Tz.slice(0,C0),a0),g=T0}else c[f+$]=Tz[0]},x=(I)=>{let v=k10(I,c,$,g,Q,E,(f,p,n)=>{if(n)return Y=!0;g=p;let o=c;if(N(f),j(),o!==c)return{position:g,targetView:_1,target:c};return g},this);if(v===0)return T(I);g=v}}useBuffer(Z){c=Z,c.dataView||(c.dataView=new DataView(c.buffer,c.byteOffset,c.byteLength)),_1=c.dataView,g=0}set position(Z){g=Z}get position(){return g}clearSharedData(){if(this.structures)this.structures=[];if(this.typedStructs)this.typedStructs=[]}}C10=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,zw];uk=[{pack(Z,J,$){let Y=Z.getTime()/1000;if((this.useTimestamp32||Z.getMilliseconds()===0)&&Y>=0&&Y<4294967296){let{target:Q,targetView:W,position:X}=J(6);Q[X++]=214,Q[X++]=255,W.setUint32(X,Y)}else if(Y>0&&Y<4294967296){let{target:Q,targetView:W,position:X}=J(10);Q[X++]=215,Q[X++]=255,W.setUint32(X,Z.getMilliseconds()*4000000+(Y/1000/4294967296>>0)),W.setUint32(X+4,Y)}else if(isNaN(Y)){if(this.onInvalidDate)return J(0),$(this.onInvalidDate());let{target:Q,targetView:W,position:X}=J(3);Q[X++]=212,Q[X++]=255,Q[X++]=255}else{let{target:Q,targetView:W,position:X}=J(15);Q[X++]=199,Q[X++]=12,Q[X++]=255,W.setUint32(X,Z.getMilliseconds()*1e6),W.setBigInt64(X+4,BigInt(Math.floor(Y)))}}},{pack(Z,J,$){if(this.setAsEmptyObject)return J(0),$({});let Y=Array.from(Z),{target:Q,position:W}=J(this.moreTypes?3:0);if(this.moreTypes)Q[W++]=212,Q[W++]=115,Q[W++]=0;$(Y)}},{pack(Z,J,$){let{target:Y,position:Q}=J(this.moreTypes?3:0);if(this.moreTypes)Y[Q++]=212,Y[Q++]=101,Y[Q++]=0;$([Z.name,Z.message,Z.cause])}},{pack(Z,J,$){let{target:Y,position:Q}=J(this.moreTypes?3:0);if(this.moreTypes)Y[Q++]=212,Y[Q++]=120,Y[Q++]=0;$([Z.source,Z.flags])}},{pack(Z,J){if(this.moreTypes)gk(Z,16,J);else mk(kz?Buffer.from(Z):new Uint8Array(Z),J)}},{pack(Z,J){let $=Z.constructor;if($!==T10&&this.moreTypes)gk(Z,yk.indexOf($.name),J);else mk(Z,J)}},{pack(Z,J){if(this.moreTypes)gk(Z,17,J);else mk(kz?Buffer.from(Z):new Uint8Array(Z),J)}},{pack(Z,J){let{target:$,position:Y}=J(1);$[Y]=193}}];function gk(Z,J,$,Y){let Q=Z.byteLength;if(Q+1<256){var{target:W,position:X}=$(4+Q);W[X++]=199,W[X++]=Q+1}else if(Q+1<65536){var{target:W,position:X}=$(5+Q);W[X++]=200,W[X++]=Q+1>>8,W[X++]=Q+1&255}else{var{target:W,position:X,targetView:K}=$(7+Q);W[X++]=201,K.setUint32(X,Q+1),X+=4}if(W[X++]=116,W[X++]=J,!Z.buffer)Z=new Uint8Array(Z);W.set(new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength),X)}function mk(Z,J){let $=Z.byteLength;var Y,Q;if($<256){var{target:Y,position:Q}=J($+2);Y[Q++]=196,Y[Q++]=$}else if($<65536){var{target:Y,position:Q}=J($+3);Y[Q++]=197,Y[Q++]=$>>8,Y[Q++]=$&255}else{var{target:Y,position:Q,targetView:W}=J($+5);Y[Q++]=198,W.setUint32(Q,$),Q+=4}Y.set(Z,Q)}function RE1(Z,J,$,Y){let Q=Z.length;switch(Q){case 1:J[$++]=212;break;case 2:J[$++]=213;break;case 4:J[$++]=214;break;case 8:J[$++]=215;break;case 16:J[$++]=216;break;default:if(Q<256)J[$++]=199,J[$++]=Q;else if(Q<65536)J[$++]=200,J[$++]=Q>>8,J[$++]=Q&255;else J[$++]=201,J[$++]=Q>>24,J[$++]=Q>>16&255,J[$++]=Q>>8&255,J[$++]=Q&255}return J[$++]=Y,J.set(Z,$),$+=Q,$}function NE1(Z,J){let $,Y=J.length*6,Q=Z.length-Y;while($=J.pop()){let{offset:W,id:X}=$;Z.copyWithin(W+Y,W,Q),Y-=6;let K=W+Y;Z[K++]=214,Z[K++]=105,Z[K++]=X>>24,Z[K++]=X>>16&255,Z[K++]=X>>8&255,Z[K++]=X&255,Q=W}return Z}function P10(Z,J,$){if(e1.length>0){_1.setUint32(e1.position+Z,g+$-e1.position-Z),e1.stringsPosition=g-Z;let Y=e1;e1=null,J(Y[0]),J(Y[1])}}function E10(Z,J){return Z.isCompatible=($)=>{let Y=!$||(J.lastNamedStructuresLength||0)===$.length;if(!Y)J._mergeStructures($);return Y},Z}function I10(Z,J){k10=Z,E10=J}var v10=new hY({useRecords:!1}),PE1=v10.pack,DE1=v10.pack;var CE1=512,TE1=1024,kE1=2048;var dk=3,jX=0,Ez=2,Fw=1,lk=16,_10=["num","object","string","ascii"];_10[lk]="date";var IE1=[!1,!0,!0,!1,!1,!0,!0,!1],A10;try{new Function(""),A10=!0}catch(Z){}var fY,vE1=typeof Buffer!=="undefined",Uw,V7;try{Uw=new TextEncoder}catch(Z){}var SE1=vE1?function(Z,J,$){return Z.utf8Write(J,$,Z.byteLength-$)}:Uw&&Uw.encodeInto?function(Z,J,$){return Uw.encodeInto(J,Z.subarray($)).written}:!1,AB6=Symbol("type"),xB6=Symbol("parent");I10(x10,fE1);function x10(Z,J,$,Y,Q,W,X,K){let G=K.typedStructs||(K.typedStructs=[]),z=J.dataView,H=(G.lastStringStart||100)+Y,V=J.length-10,q=Y;if(Y>V)J=W(Y),z=J.dataView,Y-=$,q-=$,H-=$,$=0,V=J.length-10;let F,U=H,w=G.transitions||(G.transitions=Object.create(null)),L=G.nextId||G.length,O=L<15?1:L<240?2:L<61440?3:L<15728640?4:0;if(O===0)return 0;Y+=O;let j=[],M,N=0;for(let P in Z){let C=Z[P],T=w[P];if(!T)w[P]=T={key:P,parent:w,enumerationOffset:0,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null,date64:null};if(Y>V)J=W(Y),z=J.dataView,Y-=$,q-=$,H-=$,U-=$,$=0,V=J.length-10;switch(typeof C){case"number":let E=C;if(L<200||!T.num64){if(E>>0===E&&E<536870912&&E>-520093696){if(E<246&&E>=0&&(T.num8&&!(L>200&&T.num32)||E<32&&!T.num32))w=T.num8||E5(T,jX,1),J[Y++]=E;else w=T.num32||E5(T,jX,4),z.setUint32(Y,E,!0),Y+=4;break}else if(E<4294967296&&E>=-2147483648){if(z.setFloat32(Y,E,!0),IE1[J[Y+3]>>>5]){let I;if((I=E*xY[(J[Y+3]&127)<<1|J[Y+2]>>7])>>0===I){w=T.num32||E5(T,jX,4),Y+=4;break}}}}w=T.num64||E5(T,jX,8),z.setFloat64(Y,E,!0),Y+=8;break;case"string":let A=C.length;if(F=U-H,(A<<2)+U>V)J=W((A<<2)+U),z=J.dataView,Y-=$,q-=$,H-=$,U-=$,$=0,V=J.length-10;if(A>65280+F>>2){j.push(P,C,Y-q);break}let S,x=U;if(A<64){let I,v,f;for(I=0;I<A;I++)if(v=C.charCodeAt(I),v<128)J[U++]=v;else if(v<2048)S=!0,J[U++]=v>>6|192,J[U++]=v&63|128;else if((v&64512)===55296&&((f=C.charCodeAt(I+1))&64512)===56320)S=!0,v=65536+((v&1023)<<10)+(f&1023),I++,J[U++]=v>>18|240,J[U++]=v>>12&63|128,J[U++]=v>>6&63|128,J[U++]=v&63|128;else S=!0,J[U++]=v>>12|224,J[U++]=v>>6&63|128,J[U++]=v&63|128}else U+=SE1(J,C,U),S=U-x>A;if(F<160||F<246&&(T.ascii8||T.string8)){if(S){if(!(w=T.string8))if(G.length>10&&(w=T.ascii8))w.__type=Ez,T.ascii8=null,T.string8=w,X(null,0,!0);else w=E5(T,Ez,1)}else if(F===0&&!M){M=!0,w=T.ascii0||E5(T,dk,0);break}else if(!(w=T.ascii8)&&!(G.length>10&&(w=T.string8)))w=E5(T,dk,1);J[Y++]=F}else w=T.string16||E5(T,Ez,2),z.setUint16(Y,F,!0),Y+=2;break;case"object":if(C){if(C.constructor===Date)w=T.date64||E5(T,lk,8),z.setFloat64(Y,C.getTime(),!0),Y+=8;else j.push(P,C,N);break}else if(T=S10(T,Y,z,-10),T)w=T,Y=fY;else j.push(P,C,N);break;case"boolean":w=T.num8||T.ascii8||E5(T,jX,1),J[Y++]=C?249:248;break;case"undefined":if(T=S10(T,Y,z,-9),T)w=T,Y=fY;else j.push(P,C,N);break;default:j.push(P,C,N)}N++}for(let P=0,C=j.length;P<C;){let T=j[P++],E=j[P++],A=j[P++],S=w[T];if(!S)w[T]=S={key:T,parent:w,enumerationOffset:A-N,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null};let x;if(E){let I;if(F=U-H,F<65280)if(w=S.object16,w)I=2;else if(w=S.object32)I=4;else w=E5(S,Fw,2),I=2;else w=S.object32||E5(S,Fw,4),I=4;if(x=X(E,U),typeof x==="object")U=x.position,z=x.targetView,J=x.target,H-=$,Y-=$,q-=$,$=0;else U=x;if(I===2)z.setUint16(Y,F,!0),Y+=2;else z.setUint32(Y,F,!0),Y+=4}else w=S.object16||E5(S,Fw,2),z.setInt16(Y,E===null?-10:-9,!0),Y+=2;N++}let D=w[H7];if(D==null){D=K.typedStructs.length;let P=[],C=w,T,E;while((E=C.__type)!==void 0){let A=C.__size;C=C.__parent,T=C.key;let S=[E,A,T];if(C.enumerationOffset)S.push(C.enumerationOffset);P.push(S),C=C.parent}P.reverse(),w[H7]=D,K.typedStructs[D]=P,X(null,0,!0)}switch(O){case 1:if(D>=16)return 0;J[q]=D+32;break;case 2:if(D>=256)return 0;J[q]=56,J[q+1]=D;break;case 3:if(D>=65536)return 0;J[q]=57,z.setUint16(q+1,D,!0);break;case 4:if(D>=16777216)return 0;z.setUint32(q,(D<<8)+58,!0);break}if(Y<H){if(H===U)return Y;J.copyWithin(Y,H,U),U+=Y-H,G.lastStringStart=Y-q}else if(Y>H){if(H===U)return Y;return G.lastStringStart=Y-q,x10(Z,J,$,q,Q,W,X,K)}return U}function S10(Z,J,$,Y){let Q;if(Q=Z.ascii8||Z.num8)return $.setInt8(J,Y,!0),fY=J+1,Q;if(Q=Z.string16||Z.object16)return $.setInt16(J,Y,!0),fY=J+2,Q;if(Q=Z.num32)return $.setUint32(J,3758096640+Y,!0),fY=J+4,Q;if(Q=Z.num64)return $.setFloat64(J,NaN,!0),$.setInt8(J,Y),fY=J+8,Q;fY=J;return}function E5(Z,J,$){let Y=_10[J]+($<<3),Q=Z[Y]||(Z[Y]=Object.create(null));return Q.__type=J,Q.__size=$,Q.__parent=Z,Q}function _E1(Z){if(!(Z instanceof Map))return Z;let J=Z.get("typed")||[];if(Object.isFrozen(J))J=J.map((Q)=>Q.slice(0));let $=Z.get("named"),Y=Object.create(null);for(let Q=0,W=J.length;Q<W;Q++){let X=J[Q],K=Y;for(let[G,z,H]of X){let V=K[H];if(!V)K[H]=V={key:H,parent:K,enumerationOffset:0,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null,date64:null};K=E5(V,G,z)}K[H7]=Q}return J.transitions=Y,this.typedStructs=J,this.lastTypedStructuresLength=J.length,$}var ck=Symbol.for("source");function AE1(Z,J,$,Y){let Q=Z[J++]-32;if(Q>=24)switch(Q){case 24:Q=Z[J++];break;case 25:Q=Z[J++]+(Z[J++]<<8);break;case 26:Q=Z[J++]+(Z[J++]<<8)+(Z[J++]<<16);break;case 27:Q=Z[J++]+(Z[J++]<<8)+(Z[J++]<<16)+(Z[J++]<<24);break}let W=Y.typedStructs&&Y.typedStructs[Q];if(!W){if(Z=Uint8Array.prototype.slice.call(Z,J,$),$-=J,J=0,!Y.getStructures)throw new Error(`Reference to shared structure ${Q} without getStructures method`);if(Y._mergeStructures(Y.getStructures()),!Y.typedStructs)throw new Error("Could not find any shared typed structures");if(Y.lastTypedStructuresLength=Y.typedStructs.length,W=Y.typedStructs[Q],!W)throw new Error("Could not find typed structure "+Q)}var{construct:X,fullConstruct:K}=W;if(!X){X=W.construct=function F(){},K=W.fullConstruct=function F(){},K.prototype=Y.structPrototype??{};var G=X.prototype=Y.structPrototype?Object.create(Y.structPrototype):{};let H=[],V=0,q;for(let F=0,U=W.length;F<U;F++){let w=W[F],[L,O,j,M]=w;if(j==="__proto__")j="__proto_";let N={key:j,offset:V};if(M)H.splice(F+M,0,N);else H.push(N);let D;switch(O){case 0:D=()=>0;break;case 1:D=(C,T)=>{let E=C.bytes[T+N.offset];return E>=246?OX(E):E};break;case 2:D=(C,T)=>{let E=C.bytes,S=(E.dataView||(E.dataView=new DataView(E.buffer,E.byteOffset,E.byteLength))).getUint16(T+N.offset,!0);return S>=65280?OX(S&255):S};break;case 4:D=(C,T)=>{let E=C.bytes,S=(E.dataView||(E.dataView=new DataView(E.buffer,E.byteOffset,E.byteLength))).getUint32(T+N.offset,!0);return S>=4294967040?OX(S&255):S};break}N.getRef=D,V+=O;let P;switch(L){case dk:if(q&&!q.next)q.next=N;q=N,N.multiGetCount=0,P=function(C){let{bytes:T,position:E}=C,A=V+E,S=D(C,E);if(typeof S!=="number")return S;let x,I=N.next;while(I){if(x=I.getRef(C,E),typeof x==="number")break;else x=null;I=I.next}if(x==null)x=C.bytesEnd-A;if(C.srcString)return C.srcString.slice(S,x);return w10(T,S+A,x-S)};break;case Ez:case Fw:if(q&&!q.next)q.next=N;q=N,P=function(C){let T=C.position,E=V+T,A=D(C,T);if(typeof A!=="number")return A;let S=C.bytes,x,I=N.next;while(I){if(x=I.getRef(C,T),typeof x==="number")break;else x=null;I=I.next}if(x==null)x=C.bytesEnd-E;if(L===Ez)return S.toString("utf8",A+E,x+E);else{V7=C;try{return Y.unpack(S,{start:A+E,end:x+E})}finally{V7=null}}};break;case jX:switch(O){case 4:P=function(C){let T=C.bytes,E=T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength)),A=C.position+N.offset,S=E.getInt32(A,!0);if(S<536870912){if(S>-520093696)return S;if(S>-536870912)return OX(S&255)}let x=E.getFloat32(A,!0),I=xY[(T[A+3]&127)<<1|T[A+2]>>7];return(I*x+(x>0?0.5:-0.5)>>0)/I};break;case 8:P=function(C){let T=C.bytes,A=(T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength))).getFloat64(C.position+N.offset,!0);if(isNaN(A)){let S=T[C.position+N.offset];if(S>=246)return OX(S)}return A};break;case 1:P=function(C){let E=C.bytes[C.position+N.offset];return E<246?E:OX(E)};break}break;case lk:P=function(C){let T=C.bytes,E=T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength));return new Date(E.getFloat64(C.position+N.offset,!0))};break}N.get=P}if(A10){let F=[],U=[],w=0,L;for(let j of H){if(Y.alwaysLazyProperty&&Y.alwaysLazyProperty(j.key)){L=!0;continue}Object.defineProperty(G,j.key,{get:xE1(j.get),enumerable:!0});let M="v"+w++;U.push(M),F.push("o["+JSON.stringify(j.key)+"]="+M+"(s)")}if(L)F.push("__proto__:this");let O=new Function(...U,"var c=this;return function(s){var o=new c();"+F.join(";")+";return o;}").apply(K,H.map((j)=>j.get));Object.defineProperty(G,"toJSON",{value(j){return O.call(this,this[ck])}})}else Object.defineProperty(G,"toJSON",{value(F){let U={};for(let w=0,L=H.length;w<L;w++){let O=H[w].key;U[O]=this[O]}return U}})}var z=new X;return z[ck]={bytes:Z,position:J,srcString:"",bytesEnd:$},z}function OX(Z){switch(Z){case 246:return null;case 247:return;case 248:return!1;case 249:return!0}throw new Error("Unknown constant")}function xE1(Z){return function(){return Z(this[ck])}}function hE1(){if(V7)V7.bytes=Uint8Array.prototype.slice.call(V7.bytes,V7.position,V7.bytesEnd),V7.position=0,V7.bytesEnd=V7.bytes.length}function fE1(Z,J){if(J.typedStructs){let Y=new Map;Y.set("named",Z),Y.set("typed",J.typedStructs),Z=Y}let $=J.lastTypedStructuresLength||0;return Z.isCompatible=(Y)=>{let Q=!0;if(Y instanceof Map){if((Y.get("named")||[]).length!==(J.lastNamedStructuresLength||0))Q=!1;if((Y.get("typed")||[]).length!==$)Q=!1}else if(Y instanceof Array||Array.isArray(Y)){if(Y.length!==(J.lastNamedStructuresLength||0))Q=!1}if(!Q)J._mergeStructures(Y);return Q},J.lastTypedStructuresLength=J.typedStructs&&J.typedStructs.length,Z}R10(AE1,_E1,hE1);var gE1=process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED!==void 0&&process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED.toLowerCase()==="true";if(!gE1){let Z;try{if(Z=d("msgpackr-extract"),Z)L10(Z.extractStrings)}catch(J){}}import{WebSocketServer as Wu1}from"ws";import Xu1 from"mediasoup";var RB=t(UJ0(),1);import $u1 from"http";import Yu1 from"https";import rX from"fs";import Qu1 from"url";var gJ0=t(bJ0(),1);import eY from"fs";import yJ0 from"path";var EH="./dev/persistence";class j7{static instance=new j7;gameId=process.env.HYTOPIA_GAME_ID;lobbyId=process.env.HYTOPIA_LOBBY_ID;_creativeGateway;constructor(){try{this._creativeGateway=new gJ0.CreativeGateway}catch{console.warn(["\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501","\uD83D\uDEA8 HYTOPIA PLATFORM GATEWAY IS NOT INITIALIZED \uD83D\uDEA8","","\uD83D\uDD27 Local development is still possible, but these features will be disabled:"," \u2022 \uD83D\uDC64 Player Accounts"," \u2022 \uD83C\uDFAD Player Cosmetics"," \u2022 \uD83D\uDC1B Crash Analytics & Debug Logs","","\uD83D\uDCA1 These features will be enabled but modified:"," \u2022 \uD83D\uDCBE Player & Global Persisted Data - Data will be persisted"," locally in the ./dev/persistence directory of your project."," Player ids for data persistence will begin at 1 for the first "," player to join your local server, and increments for each"," additional player. This means that if you restart your"," server, the first player id will be 1 again. This is to ensure"," that data persistence across server restarts can be easily"," tested and debugged in local development.","","To enable the HYTOPIA Platform Gateway locally:"," 1. Set these environment variables:"," HYTOPIA_API_KEY, HYTOPIA_GAME_ID, HYTOPIA_LOBBY_ID"," 2. You can find these values at: https://create.hytopia.com","","Note: In production, these environment variables will be auto-populated ","& the HYTOPIA Platform Gateway will automatically be initialized \uD83D\uDE80","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",""].join(`
|
407
|
-
`))}}get isGatewayAvailable(){return!!this._creativeGateway}async getData(Z){if(!this._creativeGateway&&process.env.NODE_ENV==="production")return m.warning("PlatformGateway.getData(): You are running in production mode, but the Platform Gateway is not initialized! No data will be returned.");return this._creativeGateway?await this._creativeGateway.kv.get(Z):this._readDevDataLocally(Z)}async getPlayerLoadout(Z){if(!this._creativeGateway)return;return await this._creativeGateway.getLoadout(Z)}async getPlayerSession(Z){if(!this._creativeGateway)return;return await this._creativeGateway.getSession(Z)}async setData(Z,J){if(J.error)return m.warning("PlatformGateway.setData(): Cannot set data with an error property.");if(!this._creativeGateway&&process.env.NODE_ENV==="production")return m.warning("PlatformGateway.setData(): You are running in production mode, but the Platform Gateway is not initialized! No data will be set.");return this._creativeGateway?await this._creativeGateway.kv.set(Z,J):this._writeDevDataLocally(Z,J)}_readDevDataLocally(Z){try{if(!eY.existsSync(EH))return;let J=yJ0.join(EH,`${Z}.json`);return JSON.parse(eY.readFileSync(J,"utf8"))}catch(J){m.warning(`PlatformGateway._readDevDataLocally(): Failed to read data for key "${Z}": ${J}`)}}_writeDevDataLocally(Z,J){try{if(!eY.existsSync(EH))eY.mkdirSync(EH,{recursive:!0});let $=yJ0.join(EH,`${Z}.json`),Y={};if(eY.existsSync($))Y=JSON.parse(eY.readFileSync($,"utf8"));let Q={...Y,...J};eY.writeFileSync($,JSON.stringify(Q,null,2),"utf8")}catch($){m.warning(`PlatformGateway._writeDevDataLocally(): Failed to write data for key "${Z}": ${$}`)}}}var Jv=process.env.PORT??8080,$v="0.5.13-
|
407
|
+
`))}}get isGatewayAvailable(){return!!this._creativeGateway}async getData(Z){if(!this._creativeGateway&&process.env.NODE_ENV==="production")return m.warning("PlatformGateway.getData(): You are running in production mode, but the Platform Gateway is not initialized! No data will be returned.");return this._creativeGateway?await this._creativeGateway.kv.get(Z):this._readDevDataLocally(Z)}async getPlayerLoadout(Z){if(!this._creativeGateway)return;return await this._creativeGateway.getLoadout(Z)}async getPlayerSession(Z){if(!this._creativeGateway)return;return await this._creativeGateway.getSession(Z)}async setData(Z,J){if(J.error)return m.warning("PlatformGateway.setData(): Cannot set data with an error property.");if(!this._creativeGateway&&process.env.NODE_ENV==="production")return m.warning("PlatformGateway.setData(): You are running in production mode, but the Platform Gateway is not initialized! No data will be set.");return this._creativeGateway?await this._creativeGateway.kv.set(Z,J):this._writeDevDataLocally(Z,J)}_readDevDataLocally(Z){try{if(!eY.existsSync(EH))return;let J=yJ0.join(EH,`${Z}.json`);return JSON.parse(eY.readFileSync(J,"utf8"))}catch(J){m.warning(`PlatformGateway._readDevDataLocally(): Failed to read data for key "${Z}": ${J}`)}}_writeDevDataLocally(Z,J){try{if(!eY.existsSync(EH))eY.mkdirSync(EH,{recursive:!0});let $=yJ0.join(EH,`${Z}.json`),Y={};if(eY.existsSync($))Y=JSON.parse(eY.readFileSync($,"utf8"));let Q={...Y,...J};eY.writeFileSync($,JSON.stringify(Q,null,2),"utf8")}catch($){m.warning(`PlatformGateway._writeDevDataLocally(): Failed to write data for key "${Z}": ${$}`)}}}var Jv=process.env.PORT??8080,$v="0.5.13-dev5",Yv;((Q)=>{Q.READY="WEBSERVER.READY";Q.STOPPED="WEBSERVER.STOPPED";Q.ERROR="WEBSERVER.ERROR";Q.UPGRADE="WEBSERVER.UPGRADE"})(Yv||={});class tX extends g0{static instance=new tX;_webserver=RB.default();_internalHttpServer;constructor(){super();this._webserver.use((Z,J,$)=>{J.header("Access-Control-Allow-Origin","*"),$()}),this._webserver.get("/",(Z,J)=>{J.json({status:"OK",version:$v})}),this._webserver.use(RB.default.static("assets")),this._webserver.use(RB.default.static("node_modules/@hytopia.com/assets"))}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?$u1.createServer(this._webserver):Yu1.createServer({key:rX.existsSync("assets/certs/localhost.key")?rX.readFileSync("assets/certs/localhost.key"):rX.readFileSync("node_modules/@hytopia.com/assets/certs/localhost.key"),cert:rX.existsSync("assets/certs/localhost.crt")?rX.readFileSync("assets/certs/localhost.crt"):rX.readFileSync("node_modules/@hytopia.com/assets/certs/localhost.crt")},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else m.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(Jv,this._onStarted),console.info(`WebServer.start(): Server running on port ${Jv}.`)}stop(){if(this._internalHttpServer)return new Promise((Z,J)=>{this._internalHttpServer.close(($)=>{if($)J($);else Z(!0)})});else return m.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(Z,J,$)=>{let Y=Qu1.parse(Z.url??"",!0).query,Q=Y.connectionId?.toString()??void 0,W=Y.sessionToken?.toString()??"",X=await j7.instance.getPlayerSession(W);if(Q)Z.connectionId=Q;if(X)if(!X.error)Z.session=X;else{let K=`${X.error.code}: ${X.error.message}`;J.write(`HTTP/1.1 401 Unauthorized\r
|
408
408
|
`),J.write(`Content-Type: text/plain\r
|
409
409
|
`),J.write(`Content-Length: ${K.length}\r
|
410
410
|
`),J.write(`Connection: close\r
|
@@ -435,6 +435,6 @@ Event: ${uJ(Z)}`),!0}return!1}function hd1(Z,J){if(!J?.length)return!1;return dB
|
|
435
435
|
`),U=F.shift();if(!U)return Z.destroy(),$(new Error("No header received from proxy CONNECT response"));let w=U.split(" "),L=+(w[1]||0),O=w.slice(2).join(" "),j={};for(let M of F){if(!M)continue;let N=M.indexOf(":");if(N===-1)return Z.destroy(),$(new Error(`Invalid header from proxy CONNECT response: "${M}"`));let D=M.slice(0,N).toLowerCase(),P=M.slice(N+1).trimStart(),C=j[D];if(typeof C==="string")j[D]=[C,P];else if(Array.isArray(C))C.push(P);else j[D]=P}jM("got proxy server response: %o %o",U,j),X(),J({connect:{statusCode:L,statusText:O,headers:j},buffered:V})}Z.on("error",G),Z.on("end",K),W()})}function kq(...Z){l.log("[https-proxy-agent]",...Z)}class MM extends If{static __initStatic(){this.protocols=["http","https"]}constructor(Z,J){super(J);this.options={},this.proxy=typeof Z==="string"?new URL(Z):Z,this.proxyHeaders=J?.headers??{},kq("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let $=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),Y=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...J?hJ1(J,"headers"):null,host:$,port:Y}}async connect(Z,J){let{proxy:$}=this;if(!J.host)throw new TypeError('No "host" provided');let Y;if($.protocol==="https:"){kq("Creating `tls.Socket`: %o",this.connectOpts);let V=this.connectOpts.servername||this.connectOpts.host;Y=vf.connect({...this.connectOpts,servername:V&&aZ.isIP(V)?void 0:V})}else kq("Creating `net.Socket`: %o",this.connectOpts),Y=aZ.connect(this.connectOpts);let Q=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},W=aZ.isIPv6(J.host)?`[${J.host}]`:J.host,X=`CONNECT ${W}:${J.port} HTTP/1.1\r
|
436
436
|
`;if($.username||$.password){let V=`${decodeURIComponent($.username)}:${decodeURIComponent($.password)}`;Q["Proxy-Authorization"]=`Basic ${Buffer.from(V).toString("base64")}`}if(Q.Host=`${W}:${J.port}`,!Q["Proxy-Connection"])Q["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let V of Object.keys(Q))X+=`${V}: ${Q[V]}\r
|
437
437
|
`;let K=xJ1(Y);Y.write(`${X}\r
|
438
|
-
`);let{connect:G,buffered:z}=await K;if(Z.emit("proxyConnect",G),this.emit("proxyConnect",G,Z),G.statusCode===200){if(Z.once("socket",G16),J.secureEndpoint){kq("Upgrading socket connection to TLS");let V=J.servername||J.host;return vf.connect({...hJ1(J,"host","path","port"),socket:Y,servername:aZ.isIP(V)?void 0:V})}return Y}Y.destroy();let H=new aZ.Socket({writable:!1});return H.readable=!0,Z.once("socket",(V)=>{kq("Replaying proxy buffer for failed request"),V.push(z),V.push(null)}),H}}MM.__initStatic();function G16(Z){Z.resume()}function hJ1(Z,...J){let $={},Y;for(Y in Z)if(!J.includes(Y))$[Y]=Z[Y];return $}var F16=32768;function U16(Z){return new V16({read(){this.push(Z),this.push(null)}})}function Sf(Z){let J;try{J=new URL(Z.url)}catch(G){return k8(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),sJ(Z,()=>Promise.resolve({}))}let $=J.protocol==="https:",Y=L16(J,Z.proxy||($?process.env.https_proxy:void 0)||process.env.http_proxy),Q=$?H16:z16,W=Z.keepAlive===void 0?!1:Z.keepAlive,X=Y?new MM(Y):new Q.Agent({keepAlive:W,maxSockets:30,timeout:2000}),K=w16(Z,Z.httpModule??Q,X);return sJ(Z,K)}function L16(Z,J){let{no_proxy:$}=process.env;if($?.split(",").some((Q)=>Z.host.endsWith(Q)||Z.hostname.endsWith(Q)))return;else return J}function w16(Z,J,$){let{hostname:Y,pathname:Q,port:W,protocol:X,search:K}=new URL(Z.url);return function G(z){return new Promise((H,V)=>{VQ(()=>{let q=U16(z.body),F={...Z.headers};if(z.body.length>F16)F["content-encoding"]="gzip",q=q.pipe(q16());let U=J.request({method:"POST",agent:$,headers:F,hostname:Y,path:`${Q}${K}`,port:W,protocol:X,ca:Z.caCerts},(w)=>{w.on("data",()=>{}),w.on("end",()=>{}),w.setEncoding("utf8");let L=w.headers["retry-after"]??null,O=w.headers["x-sentry-rate-limits"]??null;H({statusCode:w.statusCode,headers:{"retry-after":L,"x-sentry-rate-limits":Array.isArray(O)?O[0]||null:O}})});U.on("error",V),q.pipe(U)})})}}var B16=new Set(["false","f","n","no","off","0"]),O16=new Set(["true","t","y","yes","on","1"]);function RM(Z,J){let $=String(Z).toLowerCase();if(B16.has($))return!1;if(O16.has($))return!0;return J?.strict?null:Boolean(Z)}import{posix as j16,sep as M16}from"path";function fJ1(Z){return Z.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function _f(Z=process.argv[1]?rv(process.argv[1]):process.cwd(),J=M16==="\\"){let $=J?fJ1(Z):Z;return(Y)=>{if(!Y)return;let Q=J?fJ1(Y):Y,{dir:W,base:X,ext:K}=j16.parse(Q);if(K===".js"||K===".mjs"||K===".cjs")X=X.slice(0,K.length*-1);let G=decodeURIComponent(X);if(!W)W=".";let z=W.lastIndexOf("/node_modules");if(z>-1)return`${W.slice(z+14).replace(/\//g,".")}:${G}`;if(W.startsWith($)){let H=W.slice($.length+1).replace(/\//g,".");return H?`${H}:${G}`:G}return G}}function Af(Z){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(v0.SENTRY_RELEASE?.id)return v0.SENTRY_RELEASE.id;let J=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,$=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,Y=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return J||$||Y||Z}var xf=SB(ZS(_f()));var yJ1=t(Z0(),1);import*as bJ1 from"os";import{threadId as R16,isMainThread as N16}from"worker_threads";var P16=60000;class NM extends lB{constructor(Z){let J=Z.serverName||global.process.env.SENTRY_NAME||bJ1.hostname(),$={...Z,platform:"node",runtime:{name:"node",version:global.process.version},serverName:J};if(Z.openTelemetryInstrumentations)_K({instrumentations:Z.openTelemetryInstrumentations});rH($,"node"),l.log(`Initializing Sentry: process: ${process.pid}, thread: ${N16?"main":`worker-${R16}`}.`);super($);if(this.getOptions()._experiments?.enableLogs){if(this._logOnExitFlushListener=()=>{FQ(this)},J)this.on("beforeCaptureLog",(Y)=>{Y.attributes={...Y.attributes,"server.address":J}});process.on("beforeExit",this._logOnExitFlushListener)}}get tracer(){if(this._tracer)return this._tracer;let Z="@sentry/node",J=T8,$=yJ1.trace.getTracer(Z,J);return this._tracer=$,$}async flush(Z){let $=this.traceProvider?.activeSpanProcessor;if($)await $.forceFlush();if(this.getOptions().sendClientReports)this._flushOutcomes();return super.flush(Z)}close(Z){if(this._clientReportInterval)clearInterval(this._clientReportInterval);if(this._clientReportOnExitFlushListener)process.off("beforeExit",this._clientReportOnExitFlushListener);if(this._logOnExitFlushListener)process.off("beforeExit",this._logOnExitFlushListener);return super.close(Z)}startClientReportTracking(){let Z=this.getOptions();if(Z.sendClientReports)this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{m0&&l.log("Flushing client reports based on interval."),this._flushOutcomes()},Z.clientReportFlushInterval??P16).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener)}_getTraceInfoFromScope(Z){if(!Z)return[void 0,void 0];return Y01(this,Z)}}var m4=t(Z0(),1);var L3=t(x1(),1);var gJ1=t(rO(),1);import D16 from"module";var hf=1e6;function ff(Z,J={}){if(Z.getOptions().debug)k16();let $=C16(Z,J);Z.traceProvider=$}function mJ1(){let[Z=0,J=0]=process.versions.node.split(".").map(Number);if(Z>=21||Z===20&&J>=6||Z===18&&J>=19){if(!v0._sentryEsmLoaderHookRegistered)try{let{addHookMessagePort:$}=gJ1.createAddHookMessageChannel();D16.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:$,include:[]},transferList:[$]})}catch($){l.warn("Failed to register ESM hook",$)}}else k8(()=>{console.warn(`[Sentry] You are using Node.js v${process.versions.node} in ESM mode ("import syntax"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS ("require() syntax"), or upgrade your Node.js version.`)})}function C16(Z,J={}){let $=new Bx({sampler:new bx(Z),resource:new dK({[L3.ATTR_SERVICE_NAME]:"node",[L3.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[L3.ATTR_SERVICE_VERSION]:T8}),forceFlushTimeoutMillis:500,spanProcessors:[new fx({timeout:T16(Z.getOptions().maxSpanWaitDuration)}),...J.spanProcessors||[]]});return m4.trace.setGlobalTracerProvider($),m4.propagation.setGlobalPropagator(new Sx),m4.context.setGlobalContextManager(new _J1),$}function T16(Z){if(Z==null)return;if(Z>hf)return m0&&l.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${hf}`),hf;else if(Z<=0||Number.isNaN(Z)){m0&&l.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return Z}function k16(){let Z=new Proxy(l,{get(J,$,Y){return Reflect.get(J,$==="verbose"?"debug":$,Y)}});m4.diag.disable(),m4.diag.setLogger(Z,m4.DiagLogLevel.DEBUG)}function E16(){return eK()?[Z3()]:[]}function uJ1(){return[wQ(),LQ(),BQ(),OQ(),jQ(),aK(),oK(),J3(),$3(),tK(),ix(),rK(),OJ1(),AJ1(),...E16()]}function dJ1(Z){return[...uJ1(),...W5(Z)?U3():[]]}function bf(Z={}){return I16(Z,dJ1)}function I16(Z={},J){let $=v16(Z,J);if($.debug===!0)if(m0)l.enable();else k8(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")});if(!eK()&&$.registerEsmLoaderHooks!==!1)mJ1();if(W01(),B1().update($.initialScope),$.spotlight&&!$.integrations.some(({name:W})=>W===wf))$.integrations.push(Bf({sidecarUrl:typeof $.spotlight==="string"?$.spotlight:void 0}));let Q=new NM($);if(B1().setClient(Q),Q.init(),l.log(`Running in ${eK()?"CommonJS":"ESM"} mode.`),Q.startClientReportTracking(),A16(),!$.skipOpenTelemetrySetup)ff(Q,{spanProcessors:$.openTelemetrySpanProcessors}),cJ1();return ae0(Q),Q01(Q),Q}function cJ1(){if(!m0)return;let Z=te0(),J=["SentryContextManager","SentryPropagator"];if(W5())J.push("SentrySpanProcessor");for(let $ of J)if(!Z.includes($))l.error(`You have to set up the ${$}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);if(!Z.includes("SentrySampler"))l.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function v16(Z,J){let $=S16(Z.release),Y=Z.spotlight??RM(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,Q=_16(Z.tracesSampleRate),W={...Z,dsn:Z.dsn??process.env.SENTRY_DSN,environment:Z.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:Z.sendClientReports??!0,transport:Z.transport??Sf,stackParser:Cv(Z.stackParser||xf),release:$,tracesSampleRate:Q,spotlight:Y,debug:RM(Z.debug??process.env.SENTRY_DEBUG)},X=Z.integrations,K=Z.defaultIntegrations??J(W);return{...W,integrations:uv({defaultIntegrations:K,integrations:X})}}function S16(Z){if(Z!==void 0)return Z;let J=Af();if(J!==void 0)return J;return}function _16(Z){if(Z!==void 0)return Z;let J=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!J)return;let $=parseFloat(J);return isFinite($)?$:void 0}function A16(){if(RM(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let Z=process.env.SENTRY_TRACE,J=process.env.SENTRY_BAGGAGE,$=WQ(Z,J);B1().setPropagationContext($)}}import*as aJ1 from"os";var p16="BunServer",i16=()=>{return{name:p16,setupOnce(){n16()}}},iJ1=J0(i16),lJ1=!1;function n16(){if(lJ1)return;Bun.serve=new Proxy(Bun.serve,{apply(Z,J,$){pJ1($[0]);let Y=Z.apply(J,$),Q=Y.reload.bind(Y);return Y.reload=(W)=>{return pJ1(W),Q(W)},Y}}),lJ1=!0}function pJ1(Z){a16(Z),s16(Z)}function a16(Z){if(typeof Z.fetch!=="function")return;Z.fetch=new Proxy(Z.fetch,{apply(J,$,Y){return yf(J,$,Y)}})}function s16(Z){if(!Z.routes)return;if(typeof Z.routes!=="object")return;Object.keys(Z.routes).forEach((J)=>{let $=Z.routes[J];if(typeof $==="function")Z.routes[J]=new Proxy($,{apply:(Y,Q,W)=>{return yf(Y,Q,W,J)}});if($ instanceof Response)return;if(typeof $==="object")Object.entries($).forEach(([Y,Q])=>{if(typeof Q==="function")Z.routes[J][Y]=new Proxy(Q,{apply:(W,X,K)=>{return yf(W,X,K,J)}})})})}function yf(Z,J,$,Y){return pJ((Q)=>{let W=$[0],X=W.method.toUpperCase();if(X==="OPTIONS"||X==="HEAD")return Z.apply(J,$);let K=ev(W.url),G=o16(K,W),z=K?.pathname||"/";if(W.params){if(Object.keys(W.params).forEach((H)=>{G[`url.path.parameter.${H}`]=W.params[H]}),Y)G[n1]="route",G["url.template"]=Y,z=Y}if(Y?.endsWith("/*"))G[n1]="route",G["url.template"]=Y,z=Y;return Q.setSDKProcessingMetadata({normalizedRequest:{url:W.url,method:W.method,headers:W.headers.toJSON(),query_string:K?.search}}),nH({sentryTrace:W.headers.get("sentry-trace")??"",baggage:W.headers.get("baggage")},()=>HQ({attributes:G,op:"http.server",name:`${W.method} ${z}`},async(H)=>{try{let V=await Z.apply(J,$);if(V?.status)_H(H,V.status),Q.setContext("response",{headers:V.headers.toJSON(),status_code:V.status});return V}catch(V){throw A6(V,{mechanism:{type:"bun",handled:!1,data:{function:"serve"}}}),V}}))})}function o16(Z,J){let $={[$1]:"auto.http.bun.serve",[Mv]:J.method||"GET",[n1]:"url"};if(Z){if(Z.search)$["url.query"]=Z.search;if(Z.hash)$["url.fragment"]=Z.hash;if(Z.pathname)$["url.path"]=Z.pathname;if(!tv(Z)){if($["url.full"]=Z.href,Z.port)$["url.port"]=Z.port;if(Z.protocol)$["url.scheme"]=Z.protocol;if(Z.hostname)$["url.domain"]=Z.hostname}}return $}function nJ1(Z){function J($){let Y={body:$.body,method:"POST",headers:Z.headers};try{return VQ(()=>{return fetch(Z.url,Y).then((Q)=>{return{statusCode:Q.status,headers:{"x-sentry-rate-limits":Q.headers.get("X-Sentry-Rate-Limits"),"retry-after":Q.headers.get("Retry-After")}}})})}catch(Q){return qQ(Q)}}return sJ(Z,J)}function sJ1(Z){return[wQ(),LQ(),BQ(),OQ(),jQ(),aK(),oK(),J3(),$3(),tK(),rK(),Z3(),iJ1(),...W5(Z)?U3():[]]}function gf(Z={}){rH(Z,"bun");let J={...Z,platform:"javascript",runtime:{name:"bun",version:Bun.version},serverName:Z.serverName||global.process.env.SENTRY_NAME||aJ1.hostname()};if(J.transport=J.transport||nJ1,J.defaultIntegrations===void 0)J.defaultIntegrations=sJ1(J);return bf(J)}import{heapStats as t16}from"bun:jsc";if(process.env.NODE_ENV==="production"&&process.env.SENTRY_DSN)gf({dsn:process.env.SENTRY_DSN,release:$v,tracesSampleRate:1,initialScope:{tags:{gameId:process.env.HYTOPIA_GAME_ID??"unknown",gameSlug:process.env.HYTOPIA_GAME_SLUG??"unknown",lobbyId:process.env.HYTOPIA_LOBBY_ID??"unknown",region:process.env.REGION??"unknown"}},beforeSend:(Z)=>{return Z.extra=X8.getProcessStats(),Z},beforeSendTransaction:(Z)=>{if(Z.contexts?.trace?.op==="ticker_tick"){let $=Z?.start_timestamp,Y=Z?.timestamp;if(!$||!Y)return null;if((Y-$)*1000>30)return Z.measurements=X8.getProcessStats(!0),Z}return null}}),console.log("Telemetry: Sentry.io initialized!");class X8{static getProcessStats(Z=!1){let J=t16(),$=process.memoryUsage(),Y={jsHeapSizeMb:{value:J.heapSize/1024/1024,unit:"megabyte"},jsHeapCapacityMb:{value:J.heapCapacity/1024/1024,unit:"megabyte"},jsHeapUsagePercent:{value:J.heapSize/J.heapCapacity,unit:"percent"},processHeapSizeMb:{value:$.heapUsed/1024/1024,unit:"megabyte"},rssSizeMb:{value:$.rss/1024/1024,unit:"megabyte"}};if(Z)return Y;return Object.fromEntries(Object.entries(Y).map(([Q,W])=>[Q,W.value]))}static startSpan(Z,J){if(sH())return HQ({attributes:Z.attributes,name:Z.operation,op:Z.operation},J);else return J()}}var mf=new hY,Z86=5000,J86=1048576,$86=512;class I9 extends g0{static _cachedPacketsSerializedBuffer=new Map;static _packrBuffers=[];_closeTimeout=null;_wrtcDirectTransport=null;_wrtcClientServerTransport=null;_wrtcClientServerDataProducers=[];_wrtcClientServerDataConsumers=[];_wrtcServerClientTransport=null;_wrtcServerClientReliableDataProducer=null;_wrtcServerClientUnreliableDataProducer=null;_wrtcServerClientDataConsumers=[];_ws;id;constructor(Z,J){super();this.id=Z10(),this.onPacket(Y0.PacketId.CONNECTION,this._onConnectionPacket),this.onPacket(Y0.PacketId.HEARTBEAT,this._onHeartbeatPacket),this.bindWs(Z),q6.emit("CONNECTION.OPENED",{connection:this,req:J})}static getPackrBuffer(){if(I9._packrBuffers.length>0)return I9._packrBuffers.pop();return Buffer.allocUnsafe(J86)}static serializePackets(Z){for(let $ of Z)if(!Y0.isValidPacket($))return m.error(`Connection.serializePackets(): Invalid packet payload: ${JSON.stringify($)}`);let J=I9._cachedPacketsSerializedBuffer.get(Z);if(J)return J;return X8.startSpan({operation:"serialize_packets",attributes:{packets:Z.length,packetIds:Z.map(($)=>$[0]).join(","),"packetsSerializedBuffer.size":I9._packrBuffers.length}},($)=>{let Y=X8.startSpan({operation:"serialize_packets_encode"},()=>{let Q=I9.getPackrBuffer();mf.useBuffer(Q);let W=mf.pack(Z,$86),X=W.subarray(W.start,W.end);return I9._packrBuffers.push(Q),X});return $?.setAttribute("serializedBytes",Y.byteLength),I9._cachedPacketsSerializedBuffer.set(Z,Y),Y})}bindWs(Z){let J=this._closeTimeout!==null;if(J)clearTimeout(this._closeTimeout),this._closeTimeout=null;if(this._ws=Z,this._ws.binaryType="nodebuffer",this._ws.onmessage=($)=>this._onMessage($.data),this._ws.onclose=this._onWsClose,this._ws.onerror=this._onWsError,this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{i:this.id})],!0,!0),J)this.emitWithGlobal("CONNECTION.RECONNECTED",{connection:this});if(bJ.instance.isWrtcEnabled)this._upgradeToWRTC()}closeWrtc(){this._closeWrtcClientServerTransport(),this._closeWrtcServerClientTransport()}disconnect(){try{this._ws.close()}catch(Z){m.error(`Connection.disconnect(): Connection disconnect failed. Error: ${Z}`)}}onPacket(Z,J){this.on("CONNECTION.PACKET_RECEIVED",({packet:$})=>{if($[0]===Z)J($)})}send(Z,J=!0,$=!1){if(this._closeTimeout)return;if(this._ws.readyState!==e16.OPEN)return m.warning("Connection.send(): Connection is not open.");X8.startSpan({operation:"send_packets",attributes:{forceWs:$?"true":"false",wrtcConnected:this._wrtcServerClientTransport?.iceState==="completed"?"true":"false"}},()=>{try{let Y=I9.serializePackets(Z);if(!Y)return;if(this._wrtcServerClientTransport?.iceState==="completed"&&Y.length<(this._wrtcServerClientTransport?.sctpParameters?.maxMessageSize??0)&&!$)try{(J?this._wrtcServerClientReliableDataProducer:this._wrtcServerClientUnreliableDataProducer).send(Y)}catch{this._ws.send(Y)}else this._ws.send(Y);this.emitWithGlobal("CONNECTION.PACKETS_SENT",{connection:this,packets:Z})}catch(Y){m.error(`Connection.send(): Packet send failed. Error: ${Y}`)}})}_closeWrtcClientServerTransport(){this._wrtcDirectTransport?.close(),this._wrtcDirectTransport=null,this._wrtcClientServerTransport?.close(),this._wrtcClientServerTransport=null,this._wrtcClientServerDataProducers.forEach((Z)=>Z.close()),this._wrtcClientServerDataProducers=[],this._wrtcClientServerDataConsumers.forEach((Z)=>Z.close()),this._wrtcClientServerDataConsumers=[]}_closeWrtcServerClientTransport(){this._wrtcServerClientTransport?.close(),this._wrtcServerClientTransport=null,this._wrtcServerClientDataConsumers.forEach((Z)=>Z.close()),this._wrtcServerClientDataConsumers=[],this._wrtcServerClientReliableDataProducer?.close(),this._wrtcServerClientReliableDataProducer=null,this._wrtcServerClientUnreliableDataProducer?.close(),this._wrtcServerClientUnreliableDataProducer=null}_onConnectionPacket=async(Z)=>{let J=Z[1],$=J.c,Y=J.d;if($){let{i:Q,d:W}=$,X=!1;if(Q==this._wrtcClientServerTransport?.id)await this._wrtcClientServerTransport.connect({dtlsParameters:W}),X=!0;if(Q==this._wrtcServerClientTransport?.id)await this._wrtcServerClientTransport.connect({dtlsParameters:W}),X=!0;if(X)this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{ca:{i:Q}})])}if(Y)for(let Q of Y){let{s:W,l:X}=Q,K=await this._wrtcClientServerTransport.produceData({label:X,sctpStreamParameters:W}),G=await this._wrtcDirectTransport.consumeData({dataProducerId:K.id});this._wrtcClientServerDataProducers.push(K),this._wrtcClientServerDataConsumers.push(G),G.on("message",(z)=>this._onMessage(z)),this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{pa:{i:K.id,l:X}})])}};_onHeartbeatPacket=()=>{this.send([Y0.createPacket(Y0.bidirectionalPackets.heartbeatPacketDefinition,null)],!0,!0)};_onMessage=(Z)=>{try{let J=this._deserialize(Z);if(!J)return;this.emitWithGlobal("CONNECTION.PACKET_RECEIVED",{connection:this,packet:J})}catch(J){m.error(`Connection._ws.onmessage(): Error: ${J}`)}};_onWrtcIceStateChange=(Z,J)=>{if(["disconnected","closed"].includes(J)){if(Z==this._wrtcClientServerTransport)this._closeWrtcClientServerTransport();else if(Z==this._wrtcServerClientTransport)this._closeWrtcServerClientTransport()}};_onWsClose=()=>{this.closeWrtc(),this.emitWithGlobal("CONNECTION.DISCONNECTED",{connection:this}),this._closeTimeout=setTimeout(()=>{this.emitWithGlobal("CONNECTION.CLOSED",{connection:this}),this.offAll()},Z86)};_onWsError=(Z)=>{this.emitWithGlobal("CONNECTION.ERROR",{connection:this,error:Z})};_upgradeToWRTC=async()=>{let Z=await bJ.instance.createWrtcTransports();if(!Z)return!1;let{directTransport:J,clientServerTransport:$,serverClientTransport:Y}=Z;this._wrtcDirectTransport=J,this._wrtcClientServerTransport=$,this._wrtcClientServerTransport.on("icestatechange",(X)=>{this._onWrtcIceStateChange(this._wrtcClientServerTransport,X)}),this._wrtcServerClientTransport=Y,this._wrtcServerClientTransport.on("icestatechange",(X)=>{this._onWrtcIceStateChange(this._wrtcServerClientTransport,X)}),this._wrtcServerClientReliableDataProducer=await this._wrtcServerClientTransport.produceData({label:"scr",sctpStreamParameters:{streamId:0,ordered:!0}}),this._wrtcServerClientUnreliableDataProducer=await this._wrtcServerClientTransport.produceData({label:"scu",sctpStreamParameters:{streamId:1,ordered:!1,maxPacketLifeTime:35}});let Q=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientReliableDataProducer.id}),W=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientUnreliableDataProducer.id});return this._wrtcServerClientDataConsumers.push(Q,W),this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{d:[{i:Q.id,pi:Q.dataProducerId,l:"scr",s:Q.sctpStreamParameters},{i:W.id,pi:W.dataProducerId,l:"scu",s:W.sctpStreamParameters}],t:[{i:this._wrtcClientServerTransport.id,f:"cs",d:this._wrtcClientServerTransport.dtlsParameters,ic:this._wrtcClientServerTransport.iceCandidates,ip:this._wrtcClientServerTransport.iceParameters,s:this._wrtcClientServerTransport.sctpParameters},{i:this._wrtcServerClientTransport.id,f:"sc",d:this._wrtcServerClientTransport.dtlsParameters,ic:this._wrtcServerClientTransport.iceCandidates,ip:this._wrtcServerClientTransport.iceParameters,s:this._wrtcServerClientTransport.sctpParameters}]})]),!0};_deserialize(Z){let J=mf.unpack(Z);if(!J||typeof J!=="object"||typeof J[0]!=="number")return m.error(`Connection._deserialize(): Invalid packet format. Packet: ${JSON.stringify(J)}`);if(!Y0.isValidPacket(J))return m.error(`Connection._deserialize(): Invalid packet payload. Packet: ${JSON.stringify(J)}`);return J}}var oJ1;((Y)=>{Y.PLAYER_CONNECTED="PLAYER_MANAGER.PLAYER_CONNECTED";Y.PLAYER_DISCONNECTED="PLAYER_MANAGER.PLAYER_DISCONNECTED";Y.PLAYER_RECONNECTED="PLAYER_MANAGER.PLAYER_RECONNECTED"})(oJ1||={});class e5{static instance=new e5;_connectionPlayers=new Map;constructor(){q6.on("CONNECTION.OPENED",({connection:Z,req:J})=>{this._onConnectionOpened(Z,J.session)}),q6.on("CONNECTION.DISCONNECTED",({connection:Z})=>{this._onConnectionDisconnected(Z)}),q6.on("CONNECTION.RECONNECTED",({connection:Z})=>{this._onConnectionReconnected(Z)}),q6.on("CONNECTION.CLOSED",({connection:Z})=>{this._onConnectionClosed(Z)})}get playerCount(){return this._connectionPlayers.size}getConnectedPlayers(){return Array.from(this._connectionPlayers.values())}getConnectedPlayersByWorld(Z){return this.getConnectedPlayers().filter((J)=>J.world===Z)}getConnectedPlayerByUsername(Z){return Array.from(this._connectionPlayers.values()).find((J)=>{return J.username.toLowerCase()===Z.toLowerCase()})}_onConnectionOpened(Z,J){let $=new w3(Z,J);this._connectionPlayers.set(Z,$),q6.emit("PLAYER_MANAGER.PLAYER_CONNECTED",{player:$})}_onConnectionDisconnected(Z){let J=this._connectionPlayers.get(Z);if(J)J.resetInputs(),J.camera.reset()}_onConnectionReconnected(Z){let J=this._connectionPlayers.get(Z);if(J)J.reconnect(),q6.emit("PLAYER_MANAGER.PLAYER_RECONNECTED",{player:J});else m.warning(`PlayerManager._onConnectionReconnected(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}_onConnectionClosed(Z){let J=this._connectionPlayers.get(Z);if(J)J.disconnect(),this._connectionPlayers.delete(Z),q6.emit("PLAYER_MANAGER.PLAYER_DISCONNECTED",{player:J});else m.warning(`PlayerManager._onConnectionClosed(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}}var S8=16,B3=S8-1,rJ1=S8**3,Y86=[{neighborOffset:[-1,0,0],generateVertices:(Z,J,$)=>[Z+0,J+0,$+0,Z+0,J+0,$+1,Z+0,J+1,$+0,Z+0,J+1,$+0,Z+0,J+0,$+1,Z+0,J+1,$+1]},{neighborOffset:[1,0,0],generateVertices:(Z,J,$)=>[Z+1,J+0,$+0,Z+1,J+1,$+0,Z+1,J+0,$+1,Z+1,J+1,$+0,Z+1,J+1,$+1,Z+1,J+0,$+1]},{neighborOffset:[0,-1,0],generateVertices:(Z,J,$)=>[Z+0,J+0,$+0,Z+1,J+0,$+0,Z+0,J+0,$+1,Z+1,J+0,$+0,Z+1,J+0,$+1,Z+0,J+0,$+1]},{neighborOffset:[0,1,0],generateVertices:(Z,J,$)=>[Z+0,J+1,$+0,Z+0,J+1,$+1,Z+1,J+1,$+0,Z+1,J+1,$+0,Z+0,J+1,$+1,Z+1,J+1,$+1]},{neighborOffset:[0,0,-1],generateVertices:(Z,J,$)=>[Z+0,J+0,$+0,Z+0,J+1,$+0,Z+1,J+0,$+0,Z+0,J+1,$+0,Z+1,J+1,$+0,Z+1,J+0,$+0]},{neighborOffset:[0,0,1],generateVertices:(Z,J,$)=>[Z+0,J+0,$+1,Z+1,J+0,$+1,Z+0,J+1,$+1,Z+0,J+1,$+1,Z+1,J+0,$+1,Z+1,J+1,$+1]}],uf;((Y)=>{Y.DESPAWN="CHUNK.DESPAWN";Y.SET_BLOCK="CHUNK.SET_BLOCK";Y.SPAWN="CHUNK.SPAWN"})(uf||={});class g6 extends g0{_blocks;_originCoordinate;_requiresUpdate=!1;_rigidBody;_world;constructor(){super();this._blocks=new Uint8Array(rJ1)}get blocks(){return this._blocks}get requiresUpdate(){return this._requiresUpdate}get isSimulated(){return!!this._rigidBody}get isSpawned(){return!!this._originCoordinate&&!!this._world}get originCoordinate(){return this._originCoordinate}get world(){return this._world}static blockIndexToLocalCoordinate(Z){return{x:Z%S8,y:(Z/S8|0)%S8,z:Z/(S8*S8)|0}}static globalCoordinateToLocalCoordinate(Z){return{x:Z.x&S8-1,y:Z.y&S8-1,z:Z.z&S8-1}}static globalCoordinateToOriginCoordinate(Z){return{x:Z.x&~(S8-1),y:Z.y&~(S8-1),z:Z.z&~(S8-1)}}static isValidOriginCoordinate(Z){return Z.x%S8===0&&Z.y%S8===0&&Z.z%S8===0}spawn(Z,J){if(this.isSpawned){let{x:$,y:Y,z:Q}=this.originCoordinate;return m.error(`Chunk.spawn(): Chunk is already spawned at origin ${$}, ${Y}, ${Q}!`)}if(!g6.isValidOriginCoordinate(J))return m.error(`Chunk.spawn(): Chunk coordinates must be divisible by ${S8}`);this._originCoordinate=J,this._world=Z,this._world.chunkLattice.registerChunk(this),this._requiresUpdate=!0}despawn(){if(!this.isSpawned)return m.error("Chunk.despawn(): Chunk has not been spawned and cannot be despawned!");this.emitWithWorld(this._world,"CHUNK.DESPAWN",{chunk:this}),this._removeFromSimulation(),this._world.chunkLattice.unregisterChunk(this),this._originCoordinate=void 0,this._world=void 0}getBlockId(Z){return this._blocks[this._getIndex(Z)]}hasBlock(Z){return this._blocks[this._getIndex(Z)]!==0}setBlock(Z,J){if(!this._isValidLocalCoordinate(Z))return m.error("Chunk.setBlock(): Block local coordinate is out of bounds");if(this._blocks[this._getIndex(Z)]===J)return;if(this._blocks[this._getIndex(Z)]=J,this.isSpawned&&this.isSimulated){this.emitWithWorld(this._world,"CHUNK.SET_BLOCK",{chunk:this,globalCoordinate:this._getGlobalCoordinate(Z),localCoordinate:Z,blockTypeId:J});let $=this._getGlobalCoordinate(Z),Y=[];if(Z.x===0)Y.push({x:-1,y:0,z:0});if(Z.y===0)Y.push({x:0,y:-1,z:0});if(Z.z===0)Y.push({x:0,y:0,z:-1});if(Z.x===B3)Y.push({x:1,y:0,z:0});if(Z.y===B3)Y.push({x:0,y:1,z:0});if(Z.z===B3)Y.push({x:0,y:0,z:1});for(let Q of Y){let W={x:$.x+Q.x,y:$.y+Q.y,z:$.z+Q.z},X=g6.globalCoordinateToOriginCoordinate(W),K=this._world?.chunkLattice.getChunk(X);if(!K?.hasBlock(g6.globalCoordinateToLocalCoordinate(W)))continue;K.setRequiresUpdate(!0)}}this._requiresUpdate=!0}setRequiresUpdate(Z){this._requiresUpdate=Z}update(){if(!this._requiresUpdate)return;if(!this.isSpawned)return m.error("Chunk.update(): Chunk is not spawned and cannot be updated.");let Z=!this._rigidBody,J=this._world.simulation;if(this._removeFromSimulation(),this._rigidBody=new DY({type:"fixed",position:this._originCoordinate,simulation:this._world.simulation}),this._meshColliders().map(([$,Y])=>{if(!$.isSimulated)$.addToSimulation(J,this._rigidBody);J.colliderMap.setColliderBlockType($,Y)}),this._requiresUpdate=!1,Z)this.emitWithWorld(this._world,"CHUNK.SPAWN",{chunk:this})}serialize(){return p0.serializeChunk(this)}_meshColliders(){if(!this._world)return m.error("Chunk._meshColliders(): Chunk is not spawned and cannot be meshed."),[];let Z=new Map,J=[];for(let Y=0;Y<rJ1;Y++){if(this._blocks[Y]===0)continue;let Q=this._blocks[Y],W=this._world.blockTypeRegistry.getBlockType(Q),{x:X,y:K,z:G}=g6.blockIndexToLocalCoordinate(Y);if(!W.isMeshable){let H=W.createCollider();H.setRelativePosition({x:X,y:K,z:G}),J.push([H,W]);continue}let z=Z.get(W)??{indices:[],vertices:[]};Z.set(W,z);for(let H of Y86){let[V,q,F]=H.neighborOffset,U={x:X+V,y:K+q,z:G+F},w=this._getGlobalCoordinate(U),L=this._world.chunkLattice.getBlockType(w);if(L&&!L.isLiquid)continue;let O=z.indices.length;z.indices.push(O,O+1,O+2,O+3,O+4,O+5),z.vertices.push(...H.generateVertices(X,K,G))}}let $=[];return Z.forEach((Y,Q)=>{if(!Y.indices.length)return;let W=Q.createCollider(new Uint32Array(Y.indices),new Float32Array(Y.vertices));$.push([W,Q])}),[...J,...$]}_removeFromSimulation(){if(!this._rigidBody||!this._world)return;this._rigidBody.removeFromSimulation(),this._rigidBody=void 0}_getGlobalCoordinate(Z){if(!this.originCoordinate)m.fatalError("Chunk._getGlobalCoordinate(): Chunk is not spawned, calculating global coordinate is impossible.");return{x:this.originCoordinate.x+Z.x,y:this.originCoordinate.y+Z.y,z:this.originCoordinate.z+Z.z}}_getIndex(Z){return Z.x+S8*(Z.y+S8*Z.z)}_isValidLocalCoordinate(Z){return Z.x>=0&&Z.x<=B3&&Z.y>=0&&Z.y<=B3&&Z.z>=0&&Z.z<=B3}}class Eq{_chunks=new Map;_world;constructor(Z){this._world=Z}get chunkCount(){return this._chunks.size}registerChunk(Z){if(!Z.isSpawned)return m.error("ChunkLattice.registerChunk(): Chunk is not spawned.");if(this.hasChunk(Z.originCoordinate)){let{x:J,y:$,z:Y}=Z.originCoordinate;return m.error(`ChunkLattice.registerChunk(): Chunk exists at origin (${J}, ${$}, ${Y}), despawn the current chunk before registering another at the same origin.`)}if(Z.world.id!==this._world.id)return m.error("ChunkLattice.registerChunk(): Chunk world does not match lattice world.");this._chunks.set(this._getChunkKey(Z.originCoordinate),Z)}unregisterChunk(Z){if(!Z.isSpawned)return m.error("ChunkLattice.unregisterChunk(): Chunk is not spawned.");if(Z.world.id!==this._world.id)return m.error("ChunkLattice.unregisterChunk(): Chunk world does not match lattice world.");this._chunks.delete(this._getChunkKey(Z.originCoordinate))}clear(){this._chunks.forEach((Z)=>Z.despawn()),this._chunks.clear()}getBlockId(Z){let J=this.getChunk(g6.globalCoordinateToOriginCoordinate(Z));if(!J)return 0;return J.getBlockId(g6.globalCoordinateToLocalCoordinate(Z))}getBlockType(Z){let J=this.getBlockId(Z);return J?this._world.blockTypeRegistry.getBlockType(J):null}getChunk(Z){if(!g6.isValidOriginCoordinate(Z)){m.error(`ChunkLattice.getChunk(): Chunk coordinates must be divisible by CHUNK_SIZE (${S8})`);return}return this._chunks.get(this._getChunkKey(Z))}getAllChunks(){return Array.from(this._chunks.values())}hasBlock(Z){let J=this.getChunk(g6.globalCoordinateToOriginCoordinate(Z));if(!J)return!1;return J.hasBlock(g6.globalCoordinateToLocalCoordinate(Z))}hasChunk(Z){return this._chunks.has(this._getChunkKey(Z))}setBlock(Z,J){let $=g6.globalCoordinateToLocalCoordinate(Z),Y=g6.globalCoordinateToOriginCoordinate(Z),Q=this.getChunk(Y);if(!Q)Q=new g6,Q.spawn(this._world,Y);Q.setBlock($,J)}updateChunks(){this._chunks.forEach((Z)=>{if(Z.requiresUpdate)Z.update()})}_getChunkKey(Z){return`${Z.x},${Z.y},${Z.z}`}}var tJ1={type:"dynamic",softCcdPrediction:1},eJ1=0.0025000000000000005,Z$1=Math.cos(0.005),Iq;((O)=>{O.BLOCK_COLLISION="ENTITY.BLOCK_COLLISION";O.BLOCK_CONTACT_FORCE="ENTITY.BLOCK_CONTACT_FORCE";O.DESPAWN="ENTITY.DESPAWN";O.ENTITY_COLLISION="ENTITY.ENTITY_COLLISION";O.ENTITY_CONTACT_FORCE="ENTITY.ENTITY_CONTACT_FORCE";O.SET_MODEL_ANIMATIONS_PLAYBACK_RATE="ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE";O.SET_MODEL_HIDDEN_NODES="ENTITY.SET_MODEL_HIDDEN_NODES";O.SET_OPACITY="ENTITY.SET_OPACITY";O.SET_PARENT="ENTITY.SET_PARENT";O.SET_TINT_COLOR="ENTITY.SET_TINT_COLOR";O.SPAWN="ENTITY.SPAWN";O.START_MODEL_LOOPED_ANIMATIONS="ENTITY.START_MODEL_LOOPED_ANIMATIONS";O.START_MODEL_ONESHOT_ANIMATIONS="ENTITY.START_MODEL_ONESHOT_ANIMATIONS";O.STOP_MODEL_ANIMATIONS="ENTITY.STOP_MODEL_ANIMATIONS";O.TICK="ENTITY.TICK";O.UPDATE_POSITION="ENTITY.UPDATE_POSITION";O.UPDATE_ROTATION="ENTITY.UPDATE_ROTATION"})(Iq||={});class a8 extends DY{_id;_blockHalfExtents;_blockTextureUri;_controller;_modelAnimationsPlaybackRate=1;_modelHiddenNodes=new Set;_modelLoopedAnimations=new Set;_modelOneshotAnimations=new Set;_modelPreferredShape;_modelScale;_modelUri;_name;_opacity;_parent;_parentNodeName;_tag;_tintColor;_lastUpdatedPosition={x:0,y:0,z:0};_lastUpdatedRotation={x:0,y:0,z:0,w:1};_lastParentlessType="dynamic";_world;constructor(Z){let J="blockTextureUri"in Z,$="modelUri"in Z;if(!J===!$)m.fatalError("Entity.constructor(): Entity data must include a blockTextureUri or modelUri, but not both.");if(J&&!Z.blockHalfExtents)m.fatalError("Entity.constructor(): Block entity must have blockHalfExtents!");if(Z.parent&&!Z.parent.isSpawned)m.fatalError("Entity.constructor(): Parent entity must be spawned before child entity!");if(Z.parent?.modelUri&&Z.parentNodeName&&!N9.instance.modelHasNode(Z.parent.modelUri,Z.parentNodeName))m.fatalError(`Entity.constructor(): Parent node name ${Z.parentNodeName} not found in parent model ${Z.parent.modelUri}!`);super(Z.rigidBodyOptions??tJ1);if(J)this._blockHalfExtents=Z.blockHalfExtents,this._blockTextureUri=Z.blockTextureUri;if($)this._modelAnimationsPlaybackRate=Z.modelAnimationsPlaybackRate??1,this._modelPreferredShape=Z.modelPreferredShape,this._modelScale=Z.modelScale,this._modelUri=Z.modelUri,Z.modelHiddenNodes?.forEach((Y)=>this._modelHiddenNodes.add(Y.toLowerCase())),Z.modelLoopedAnimations?.forEach((Y)=>this._modelLoopedAnimations.add(Y));if(this._name=Z.name??"Nameless",this._opacity=Z.opacity??1,this._parent=Z.parent,this._parentNodeName=Z.parentNodeName,this._tag=Z.tag,this._tintColor=Z.tintColor,Z.controller)this.setController(Z.controller)}get id(){return this._id}get blockHalfExtents(){return this._blockHalfExtents}get blockTextureUri(){return this._blockTextureUri}get controller(){return this._controller}get height(){return this.isModelEntity?N9.instance.getHeight(this._modelUri)*(this._modelScale??1):this._blockHalfExtents.y*2}get modelAnimationsPlaybackRate(){return this._modelAnimationsPlaybackRate}get modelHiddenNodes(){return this._modelHiddenNodes}get modelLoopedAnimations(){return this._modelLoopedAnimations}get modelPreferredShape(){return this._modelPreferredShape}get modelScale(){return this._modelScale}get modelUri(){return this._modelUri}get name(){return this._name}get opacity(){return this._opacity}get parent(){return this._parent}get parentNodeName(){return this._parentNodeName}get tag(){return this._tag}get tintColor(){return this._tintColor}get isBlockEntity(){return!!this._blockTextureUri}get isModelEntity(){return!!this._modelUri}get isSpawned(){return!!this._world}get world(){return this._world}spawn(Z,J,$){if(this.isSpawned)return m.error(`Entity.spawn(): Entity ${this._name} is already spawned with id ${this._id}!`);if(!this.isSimulated)this.addToSimulation(Z.simulation);if(this._blockTextureUri&&this._blockHalfExtents&&this.numColliders===0)this.addChildColliderToSimulation(new a5(a5.optionsFromBlockHalfExtents(this._blockHalfExtents)));if(this._modelUri&&this.numColliders===0&&this._modelPreferredShape!=="none")this.addChildColliderToSimulation(new a5(a5.optionsFromModelUri(this._modelUri,this._modelScale,this._modelPreferredShape)));if(this.colliders.forEach((Y)=>{if(this.hasListeners("ENTITY.BLOCK_COLLISION")||this.hasListeners("ENTITY.ENTITY_COLLISION"))Y.enableCollisionEvents(!0);if(this.hasListeners("ENTITY.BLOCK_CONTACT_FORCE")||this.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))Y.enableContactForceEvents(!0);if(X4.isDefaultCollisionGroups(Y.collisionGroups))Y.setCollisionGroups({belongsTo:[Y.isSensor?4:2],collidesWith:[65535]})}),this.setPosition(J),$)this.setRotation($);if(this._id=Z.entityManager.registerEntity(this),this._world=Z,this._controller)this._controller.spawn(this);if(this._parent)this.setParent(this._parent,this._parentNodeName,J,$);this.colliders.forEach((Y)=>{Z.simulation.colliderMap.setColliderEntity(Y,this)}),this.emitWithWorld(Z,"ENTITY.SPAWN",{entity:this})}despawn(){if(!this._requireSpawned("despawn"))return;if(this._world.entityManager.getEntityChildren(this).forEach((Z)=>{Z.despawn()}),this._controller)this._controller.detach(this),this._controller.despawn(this);if(this.emitWithWorld(this._world,"ENTITY.DESPAWN",{entity:this}),this.isSimulated)this.removeFromSimulation();this._world.entityManager.unregisterEntity(this),this._world.audioManager.unregisterEntityAttachedAudios(this),this._world.lightManager.despawnEntityAttachedLights(this),this._world.sceneUIManager.unloadEntityAttachedSceneUIs(this),this._id=void 0,this._world=void 0}setModelAnimationsPlaybackRate(Z){if(!this._requireSpawned("setModelAnimationsPlaybackRate"))return;if(!this.isModelEntity||this._modelAnimationsPlaybackRate===Z)return;this._modelAnimationsPlaybackRate=Z,this.emitWithWorld(this._world,"ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE",{entity:this,playbackRate:Z})}setController(Z){if(this._controller===Z)return;if(this._controller)this._controller.detach(this);if(this._controller=Z,this._controller)this._controller.attach(this)}setModelHiddenNodes(Z){if(!this._requireSpawned("setModelHiddenNodes"))return;this._modelHiddenNodes=new Set(Z.map((J)=>J.toLowerCase())),this.emitWithWorld(this._world,"ENTITY.SET_MODEL_HIDDEN_NODES",{entity:this,modelHiddenNodes:this._modelHiddenNodes})}setOpacity(Z){if(!this._requireSpawned("setOpacity"))return;if(this._opacity===Z)return;this._opacity=Z,this.emitWithWorld(this._world,"ENTITY.SET_OPACITY",{entity:this,opacity:Z})}setParent(Z,J,$,Y){if(!this._requireSpawned("setParent"))return;if(Z&&!Z.isSpawned)return m.error("Entity.setParent(): Parent entity is not spawned, cannot set parent!");if(!this._parent&&Z)this._lastParentlessType=this.type;if(this._parent=Z,this._parentNodeName=J,this.colliders.forEach((Q)=>Q.setEnabled(!Z)),this.setType(!Z?this._lastParentlessType:"kinematic_velocity"),this.setPosition($??{x:0,y:0,z:0}),this.setRotation(Y??{x:0,y:0,z:0,w:1}),!this.isKinematicPositionBased)this.resetAngularVelocity(),this.resetForces(),this.resetLinearVelocity(),this.resetTorques();this.emitWithWorld(this._world,"ENTITY.SET_PARENT",{entity:this,parent:Z,parentNodeName:J})}setTintColor(Z){if(!this._requireSpawned("setTintColor"))return;if(!Z&&!this._tintColor||Z&&this._tintColor&&Z.r===this._tintColor.r&&Z.g===this._tintColor.g&&Z.b===this._tintColor.b)return;this._tintColor=Z,this.emitWithWorld(this._world,"ENTITY.SET_TINT_COLOR",{entity:this,tintColor:Z})}startModelLoopedAnimations(Z){if(!this._requireSpawned("startModelLoopedAnimations"))return;if(!this.isModelEntity||!Z.length)return;if(!Z.some((J)=>!this._modelLoopedAnimations.has(J)))return;Z.forEach((J)=>{this._modelLoopedAnimations.add(J)}),this.emitWithWorld(this._world,"ENTITY.START_MODEL_LOOPED_ANIMATIONS",{entity:this,animations:new Set(Z)})}startModelOneshotAnimations(Z){if(!this._requireSpawned("startModelOneshotAnimations"))return;if(!this.isModelEntity||!Z.length)return;Z.forEach((J)=>{this._modelOneshotAnimations.add(J)}),this.emitWithWorld(this._world,"ENTITY.START_MODEL_ONESHOT_ANIMATIONS",{entity:this,animations:new Set(Z)})}stopModelAnimations(Z){if(!this._requireSpawned("stopModelAnimations"))return;if(!this.isModelEntity||!Z.length)return;if(!Z.some((J)=>this._modelLoopedAnimations.has(J))&&!Z.some((J)=>this._modelOneshotAnimations.has(J)))return;Z.forEach((J)=>{this._modelLoopedAnimations.delete(J),this._modelOneshotAnimations.delete(J)}),this.emitWithWorld(this._world,"ENTITY.STOP_MODEL_ANIMATIONS",{entity:this,animations:new Set(Z)})}serialize(){return p0.serializeEntity(this)}tick(Z){if(this.emit("ENTITY.TICK",{entity:this,tickDeltaMs:Z}),this._controller)this._controller.tick(this,Z)}checkAndEmitUpdates(){if(!this._requireSpawned("checkAndEmitUpdates"))return;let Z=this.position,J=this.rotation;if(this._rotationExceedsThreshold(J,this._lastUpdatedRotation))this._lastUpdatedRotation=J,this.emitWithWorld(this._world,"ENTITY.UPDATE_ROTATION",{entity:this,rotation:J});if(this._positionExceedsThreshold(Z,this._lastUpdatedPosition))this._lastUpdatedPosition=Z,this.emitWithWorld(this._world,"ENTITY.UPDATE_POSITION",{entity:this,position:Z})}_requireSpawned(Z){if(!this.isSpawned)m.error(`Entity._requireSpawned(): Entity ${this._name} is not spawned, cannot invoke ${Z}()!`);return this.isSpawned}_positionExceedsThreshold(Z,J){let $=Z.x-J.x,Y=Z.y-J.y,Q=Z.z-J.z;return $*$+Y*Y+Q*Q>eJ1}_rotationExceedsThreshold(Z,J){return Math.abs(Z.x*J.x+Z.y*J.y+Z.z*J.z+Z.w*J.w)<Z$1}}var df;((K)=>{K.LOAD="SCENE_UI.LOAD";K.SET_ATTACHED_TO_ENTITY="SCENE_UI.SET_ATTACHED_TO_ENTITY";K.SET_OFFSET="SCENE_UI.SET_OFFSET";K.SET_POSITION="SCENE_UI.SET_POSITION";K.SET_STATE="SCENE_UI.SET_STATE";K.SET_VIEW_DISTANCE="SCENE_UI.SET_VIEW_DISTANCE";K.UNLOAD="SCENE_UI.UNLOAD"})(df||={});class vq extends g0{_id;_attachedToEntity;_offset;_position;_state={};_templateId;_viewDistance;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)m.fatalError("Either attachedToEntity or position must be set, but not both");super();this._attachedToEntity=Z.attachedToEntity,this._offset=Z.offset,this._position=Z.position,this._state=Z.state??{},this._templateId=Z.templateId,this._viewDistance=Z.viewDistance}get id(){return this._id}get attachedToEntity(){return this._attachedToEntity}get isLoaded(){return this._id!==void 0}get offset(){return this._offset}get position(){return this._position}get state(){return this._state}get templateId(){return this._templateId}get viewDistance(){return this._viewDistance}get world(){return this._world}load(Z){if(this.isLoaded)return;if(this._attachedToEntity&&!this._attachedToEntity.isSpawned)return m.error(`SceneUI.load(): Attached entity ${this._attachedToEntity.id} must be spawned before loading SceneUI!`);this._id=Z.sceneUIManager.registerSceneUI(this),this._world=Z,this.emitWithWorld(Z,"SCENE_UI.LOAD",{sceneUI:this})}setAttachedToEntity(Z){if(!Z.isSpawned)return m.error(`SceneUI.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);if(this._attachedToEntity===Z)return;if(this._attachedToEntity=Z,this._position=void 0,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_ATTACHED_TO_ENTITY",{sceneUI:this,entity:Z})}setOffset(Z){if(this._offset===Z)return;if(this._offset=Z,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_OFFSET",{sceneUI:this,offset:Z})}setPosition(Z){if(this._position===Z)return;if(this._attachedToEntity=void 0,this._position=Z,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_POSITION",{sceneUI:this,position:Z})}setState(Z){if(this._state={...this._state,...Z},this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_STATE",{sceneUI:this,state:this._state})}setViewDistance(Z){if(this._viewDistance=Z,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_VIEW_DISTANCE",{sceneUI:this,viewDistance:Z})}unload(){if(!this.isLoaded||!this._world)return;this._world.sceneUIManager.unregisterSceneUI(this),this.emitWithWorld(this._world,"SCENE_UI.UNLOAD",{sceneUI:this}),this._id=void 0,this._world=void 0}serialize(){return p0.serializeSceneUI(this)}}class d7 extends a8{player;nametagSceneUI;constructor(Z){super(Z);this.player=Z.player,this.nametagSceneUI=new vq({templateId:"hytopia:nametag",attachedToEntity:this,offset:{x:0,y:1,z:0},viewDistance:15,state:{username:this.player.username,profilePictureUrl:this.player.profilePictureUrl}})}spawn(Z,J,$){super.spawn(Z,J,$),this.nametagSceneUI.load(Z),this.player.on("PLAYER.CHAT_MESSAGE_SEND",({message:Y})=>{this.nametagSceneUI.setState({chat:Y})})}tick(Z){if(!this.isSpawned||!this.world)return;if(!this.controller)return m.error(`PlayerEntity.tick(): PlayerEntity "${this.name}" must have a controller.`);let{input:J,camera:$}=this.player;this.controller.tickWithPlayerInput(this,J,$.orientation,Z),super.tick(Z)}}class _q{_entities=new Map;_nextEntityId=1;_world;constructor(Z){this._world=Z}get entityCount(){return this._entities.size}get world(){return this._world}registerEntity(Z){if(Z.id!==void 0)m.fatalError(`EntityManager.registerEntity(): Entity ${Z.name} is already assigned the id ${Z.id}!`);let J=this._nextEntityId;return this._entities.set(J,Z),this._nextEntityId++,J}unregisterEntity(Z){if(Z.id===void 0)return m.error(`EntityManager.unregisterEntity(): Entity ${Z.name} is not assigned an id!`);this._entities.delete(Z.id)}getAllEntities(){return Array.from(this._entities.values())}getAllPlayerEntities(){let Z=[];return this._entities.forEach((J)=>{if(J instanceof d7)Z.push(J)}),Z}getPlayerEntitiesByPlayer(Z){let J=[];return this._entities.forEach(($)=>{if($ instanceof d7&&$.player===Z)J.push($)}),J}getEntity(Z){return this._entities.get(Z)}getEntitiesByTag(Z){let J=[];return this._entities.forEach(($)=>{if($.tag===Z)J.push($)}),J}getEntitiesByTagSubstring(Z){let J=[];return this._entities.forEach(($)=>{if($.tag?.includes(Z))J.push($)}),J}getEntityChildren(Z){let J=[];return this._entities.forEach(($)=>{if($.parent===Z)J.push($)}),J}tickEntities(Z){this._entities.forEach((J)=>{J.tick(Z)})}checkAndEmitUpdates(){this._entities.forEach((Z)=>{if(!Z.isSpawned)return;Z.checkAndEmitUpdates()})}}class Aq{_lights=new Map;_nextLightId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}despawnEntityAttachedLights(Z){this.getAllEntityAttachedLights(Z).forEach((J)=>{J.despawn()})}getAllLights(){return Array.from(this._lights.values())}getAllEntityAttachedLights(Z){return this.getAllLights().filter((J)=>J.attachedToEntity===Z)}registerLight(Z){if(Z.id!==void 0)return Z.id;let J=this._nextLightId;return this._lights.set(J,Z),this._nextLightId++,J}unregisterLight(Z){if(Z.id===void 0)return;this._lights.delete(Z.id)}}var J$1;(($)=>{$[$.POINTLIGHT=0]="POINTLIGHT";$[$.SPOTLIGHT=1]="SPOTLIGHT"})(J$1||={});var cf;((q)=>{q.DESPAWN="LIGHT.DESPAWN";q.SET_ANGLE="LIGHT.SET_ANGLE";q.SET_ATTACHED_TO_ENTITY="LIGHT.SET_ATTACHED_TO_ENTITY";q.SET_COLOR="LIGHT.SET_COLOR";q.SET_DISTANCE="LIGHT.SET_DISTANCE";q.SET_INTENSITY="LIGHT.SET_INTENSITY";q.SET_OFFSET="LIGHT.SET_OFFSET";q.SET_PENUMBRA="LIGHT.SET_PENUMBRA";q.SET_POSITION="LIGHT.SET_POSITION";q.SET_TRACKED_ENTITY="LIGHT.SET_TRACKED_ENTITY";q.SET_TRACKED_POSITION="LIGHT.SET_TRACKED_POSITION";q.SPAWN="LIGHT.SPAWN"})(cf||={});class lf extends g0{_id;_angle;_attachedToEntity;_color;_distance;_intensity;_offset;_penumbra;_position;_trackedEntity;_trackedPosition;_type;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)m.fatalError("Either attachedToEntity or position must be set, but not both");super();m.warning("WARNING: Lights are poorly optimized at this time. Using more than a few lights in your game can cause extremely bad performance (FPS) issues. Use lights sparingly!"),this._angle=Z.angle,this._attachedToEntity=Z.attachedToEntity,this._color=Z.color??{r:255,g:255,b:255},this._distance=Z.distance,this._intensity=Z.intensity??1,this._offset=Z.offset,this._penumbra=Z.penumbra,this._position=Z.position,this._trackedEntity=Z.trackedEntity,this._trackedPosition=Z.trackedPosition,this._type=Z.type??0}get id(){return this._id}get angle(){return this._angle}get attachedToEntity(){return this._attachedToEntity}get color(){return this._color}get distance(){return this._distance}get intensity(){return this._intensity}get isSpawned(){return this._id!==void 0}get offset(){return this._offset}get penumbra(){return this._penumbra}get position(){return this._position}get trackedEntity(){return this._trackedEntity}get trackedPosition(){return this._trackedPosition}get type(){return this._type}get world(){return this._world}setAngle(Z){if(this._angle===Z)return;if(this._angle=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_ANGLE",{light:this,angle:Z})}setAttachedToEntity(Z){if(!Z.isSpawned)return m.error(`Light.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);if(this._attachedToEntity===Z)return;if(this._attachedToEntity=Z,this._position=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_ATTACHED_TO_ENTITY",{light:this,entity:Z})}setColor(Z){if(this._color.r===Z.r&&this._color.g===Z.g&&this._color.b===Z.b)return;if(this._color=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_COLOR",{light:this,color:Z})}setDistance(Z){if(this._distance===Z)return;if(this._distance=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_DISTANCE",{light:this,distance:Z})}setIntensity(Z){if(this._intensity===Z)return;if(this._intensity=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_INTENSITY",{light:this,intensity:Z})}setOffset(Z){if(this._offset===Z)return;if(this._offset=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_OFFSET",{light:this,offset:Z})}setPenumbra(Z){if(this._penumbra===Z)return;if(this._penumbra=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_PENUMBRA",{light:this,penumbra:Z})}setPosition(Z){if(this._position===Z)return;if(this._position=Z,this._attachedToEntity=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_POSITION",{light:this,position:Z})}setTrackedEntity(Z){if(!Z.isSpawned)return m.error(`Light.setTrackedEntity(): Entity ${Z.id} is not spawned!`);if(this._trackedEntity===Z)return;if(this._trackedEntity=Z,this._trackedPosition=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_TRACKED_ENTITY",{light:this,entity:Z})}setTrackedPosition(Z){if(this._trackedPosition===Z)return;if(this._trackedPosition=Z,this._trackedEntity=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_TRACKED_POSITION",{light:this,position:Z})}despawn(){if(!this.isSpawned||!this._world)return;this._world.lightManager.unregisterLight(this),this.emitWithWorld(this._world,"LIGHT.DESPAWN",{light:this}),this._id=void 0,this._world=void 0}spawn(Z){if(this.isSpawned)return;if(this._attachedToEntity&&!this._attachedToEntity.isSpawned)return m.error(`Light.spawn(): Attached entity ${this._attachedToEntity.id} must be spawned before spawning Light!`);this._id=Z.lightManager.registerLight(this),this._world=Z,this.emitWithWorld(Z,"LIGHT.SPAWN",{light:this})}serialize(){return p0.serializeLight(this)}}var $$1;((Y)=>{Y[Y.FIRST_PERSON=0]="FIRST_PERSON";Y[Y.THIRD_PERSON=1]="THIRD_PERSON";Y[Y.SPECTATOR=2]="SPECTATOR"})($$1||={});var pf;((F)=>{F.LOOK_AT_ENTITY="PLAYER_CAMERA.LOOK_AT_ENTITY";F.LOOK_AT_POSITION="PLAYER_CAMERA.LOOK_AT_POSITION";F.SET_ATTACHED_TO_ENTITY="PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY";F.SET_ATTACHED_TO_POSITION="PLAYER_CAMERA.SET_ATTACHED_TO_POSITION";F.SET_FILM_OFFSET="PLAYER_CAMERA.SET_FILM_OFFSET";F.SET_FORWARD_OFFSET="PLAYER_CAMERA.SET_FORWARD_OFFSET";F.SET_FOV="PLAYER_CAMERA.SET_FOV";F.SET_MODEL_HIDDEN_NODES="PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES";F.SET_MODE="PLAYER_CAMERA.SET_MODE";F.SET_OFFSET="PLAYER_CAMERA.SET_OFFSET";F.SET_TRACKED_ENTITY="PLAYER_CAMERA.SET_TRACKED_ENTITY";F.SET_TRACKED_POSITION="PLAYER_CAMERA.SET_TRACKED_POSITION";F.SET_ZOOM="PLAYER_CAMERA.SET_ZOOM"})(pf||={});class xq extends g0{player;_attachedToEntity;_attachedToPosition;_filmOffset=0;_forwardOffset=0;_fov=75;_modelHiddenNodes=new Set;_mode=1;_offset={x:0,y:0,z:0};_orientation={pitch:0,yaw:0};_trackedEntity;_trackedPosition;_zoom=1;constructor(Z){super();this.player=Z}get attachedToEntity(){return this._attachedToEntity}get attachedToPosition(){return this._attachedToPosition}get facingDirection(){return{x:-Math.sin(this._orientation.yaw)*Math.cos(this._orientation.pitch),y:Math.sin(this._orientation.pitch),z:-Math.cos(this._orientation.yaw)*Math.cos(this._orientation.pitch)}}get filmOffset(){return this._filmOffset}get forwardOffset(){return this._forwardOffset}get fov(){return this._fov}get modelHiddenNodes(){return this._modelHiddenNodes}get mode(){return this._mode}get offset(){return this._offset}get orientation(){return this._orientation}get trackedEntity(){return this._trackedEntity}get trackedPosition(){return this._trackedPosition}get zoom(){return this._zoom}lookAtEntity(Z){if(!this._requirePlayerWorld())return;this.emitWithWorld(this.player.world,"PLAYER_CAMERA.LOOK_AT_ENTITY",{playerCamera:this,entity:Z})}lookAtPosition(Z){if(!this._requirePlayerWorld())return;this.emitWithWorld(this.player.world,"PLAYER_CAMERA.LOOK_AT_POSITION",{playerCamera:this,position:Z})}reset(){this._attachedToEntity=void 0,this._attachedToPosition=void 0,this._orientation={pitch:0,yaw:0},this._trackedEntity=void 0,this._trackedPosition=void 0}setAttachedToEntity(Z){if(!this._requirePlayerWorld())return;if(!Z.isSpawned)return m.error(`PlayerCamera.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);this._attachedToEntity=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY",{playerCamera:this,entity:Z})}setAttachedToPosition(Z){if(!this._requirePlayerWorld())return;this._attachedToPosition=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_ATTACHED_TO_POSITION",{playerCamera:this,position:Z})}setFilmOffset(Z){if(!this._requirePlayerWorld())return;this._filmOffset=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FILM_OFFSET",{playerCamera:this,filmOffset:Z})}setForwardOffset(Z){if(!this._requirePlayerWorld())return;this._forwardOffset=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FORWARD_OFFSET",{playerCamera:this,forwardOffset:Z})}setFov(Z){if(!this._requirePlayerWorld())return;this._fov=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FOV",{playerCamera:this,fov:Z})}setModelHiddenNodes(Z){if(!this._requirePlayerWorld())return;this._modelHiddenNodes=new Set(Z.map((J)=>J.toLowerCase())),this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES",{playerCamera:this,modelHiddenNodes:this._modelHiddenNodes})}setMode(Z){if(!this._requirePlayerWorld())return;this._mode=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_MODE",{playerCamera:this,mode:Z})}setOffset(Z){if(!this._requirePlayerWorld())return;this._offset=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_OFFSET",{playerCamera:this,offset:Z})}setOrientationPitch(Z){this._orientation.pitch=Z}setOrientationYaw(Z){this._orientation.yaw=Z}setTrackedEntity(Z){if(!this._requirePlayerWorld())return;this._trackedEntity=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_TRACKED_ENTITY",{playerCamera:this,entity:Z})}setTrackedPosition(Z){if(!this._requirePlayerWorld())return;this._trackedPosition=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_TRACKED_POSITION",{playerCamera:this,position:Z})}setZoom(Z){if(!this._requirePlayerWorld())return;this._zoom=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_ZOOM",{playerCamera:this,zoom:Z})}serialize(){return p0.serializePlayerCamera(this)}_requirePlayerWorld(){if(!this.player.world)m.error(`PlayerCamera._requirePlayerWorld(): Player ${this.player.id} is not in a world!`);return!!this.player.world}}var DM;((Q)=>{Q.DATA="PLAYER_UI.DATA";Q.LOAD="PLAYER_UI.LOAD";Q.LOCK_POINTER="PLAYER_UI.LOCK_POINTER";Q.SEND_DATA="PLAYER_UI.SEND_DATA"})(DM||={});class hq extends g0{player;constructor(Z){super();this.player=Z}load(Z){if(!this.player.world)return;this.emitWithWorld(this.player.world,"PLAYER_UI.LOAD",{playerUI:this,htmlUri:Z})}lockPointer(Z){if(!this.player.world)return;this.emitWithWorld(this.player.world,"PLAYER_UI.LOCK_POINTER",{playerUI:this,lock:Z})}sendData(Z){if(!this.player.world)return;this.emitWithWorld(this.player.world,"PLAYER_UI.SEND_DATA",{playerUI:this,data:Z})}}class fq{_colliderHandleBlockTypeMap=new Map;_colliderHandleCollisionCallbackMap=new Map;_colliderHandleEntityMap=new Map;_cleanupBlockTypeColliderHandles=new Set;_pendingCleanupBlockTypeColliderHandles=new Set;_cleanupCollisionCallbackColliderHandles=new Set;_pendingCleanupCollisionCallbackColliderHandles=new Set;_cleanupEntityColliderHandles=new Set;_pendingCleanupEntityColliderHandles=new Set;getColliderBlockType(Z){if(!this._requireSimulatedCollider(Z))return;return this._colliderHandleBlockTypeMap.get(Z.rawCollider.handle)}getColliderCollisionCallback(Z){if(!this._requireSimulatedCollider(Z))return;return this._colliderHandleCollisionCallbackMap.get(Z.rawCollider.handle)}getColliderEntity(Z){if(!this._requireSimulatedCollider(Z))return;return this._colliderHandleEntityMap.get(Z.rawCollider.handle)}getColliderHandleBlockType(Z){return this._colliderHandleBlockTypeMap.get(Z)}getColliderHandleCollisionCallback(Z){return this._colliderHandleCollisionCallbackMap.get(Z)}getColliderHandleEntity(Z){return this._colliderHandleEntityMap.get(Z)}removeColliderBlockType(Z){if(!this._requireSimulatedCollider(Z))return;this.removeColliderHandleBlockType(Z.rawCollider.handle)}removeColliderCollisionCallback(Z){if(!this._requireSimulatedCollider(Z))return;this.removeColliderHandleCollisionCallback(Z.rawCollider.handle)}removeColliderEntity(Z){if(!this._requireSimulatedCollider(Z))return;this.removeColliderHandleEntity(Z.rawCollider.handle)}removeColliderHandleBlockType(Z){this._colliderHandleBlockTypeMap.delete(Z)}removeColliderHandleCollisionCallback(Z){this._colliderHandleCollisionCallbackMap.delete(Z)}removeColliderHandleEntity(Z){this._colliderHandleEntityMap.delete(Z)}setColliderBlockType(Z,J){if(!this._requireSimulatedCollider(Z))return;this.setColliderHandleBlockType(Z.rawCollider.handle,J)}setColliderCollisionCallback(Z,J){if(!this._requireSimulatedCollider(Z))return;this.setColliderHandleCollisionCallback(Z.rawCollider.handle,J)}setColliderEntity(Z,J){if(!this._requireSimulatedCollider(Z))return;this.setColliderHandleEntity(Z.rawCollider.handle,J)}setColliderHandleBlockType(Z,J){this._colliderHandleBlockTypeMap.set(Z,J),this._cleanupBlockTypeColliderHandles.delete(Z),this._pendingCleanupBlockTypeColliderHandles.delete(Z)}setColliderHandleCollisionCallback(Z,J){this._colliderHandleCollisionCallbackMap.set(Z,J),this._cleanupCollisionCallbackColliderHandles.delete(Z),this._pendingCleanupCollisionCallbackColliderHandles.delete(Z)}setColliderHandleEntity(Z,J){this._colliderHandleEntityMap.set(Z,J),this._cleanupEntityColliderHandles.delete(Z),this._pendingCleanupEntityColliderHandles.delete(Z)}queueColliderHandleForCleanup(Z){if(this._colliderHandleBlockTypeMap.has(Z))this._pendingCleanupBlockTypeColliderHandles.add(Z);if(this._colliderHandleCollisionCallbackMap.has(Z))this._pendingCleanupCollisionCallbackColliderHandles.add(Z);if(this._colliderHandleEntityMap.has(Z))this._pendingCleanupEntityColliderHandles.add(Z)}cleanup(){for(let Z of this._cleanupBlockTypeColliderHandles)this._colliderHandleBlockTypeMap.delete(Z);if(this._cleanupBlockTypeColliderHandles.size>0)this._cleanupBlockTypeColliderHandles.clear();for(let Z of this._cleanupCollisionCallbackColliderHandles)this._colliderHandleCollisionCallbackMap.delete(Z);if(this._cleanupCollisionCallbackColliderHandles.size>0)this._cleanupCollisionCallbackColliderHandles.clear();for(let Z of this._cleanupEntityColliderHandles)this._colliderHandleEntityMap.delete(Z);if(this._cleanupEntityColliderHandles.size>0)this._cleanupEntityColliderHandles.clear();for(let Z of this._pendingCleanupBlockTypeColliderHandles.keys())this._cleanupBlockTypeColliderHandles.add(Z);if(this._pendingCleanupBlockTypeColliderHandles.size>0)this._pendingCleanupBlockTypeColliderHandles.clear();for(let Z of this._pendingCleanupCollisionCallbackColliderHandles.keys())this._cleanupCollisionCallbackColliderHandles.add(Z);if(this._pendingCleanupCollisionCallbackColliderHandles.size>0)this._pendingCleanupCollisionCallbackColliderHandles.clear();for(let Z of this._pendingCleanupEntityColliderHandles.keys())this._cleanupEntityColliderHandles.add(Z);if(this._pendingCleanupEntityColliderHandles.size>0)this._pendingCleanupEntityColliderHandles.clear()}_requireSimulatedCollider(Z){if(!Z.rawCollider)m.error("ColliderMap._requireSimulatedCollider(): Collider is not in the simulation.");return!!Z.rawCollider}}var Q86={x:0,y:-32,z:0},nf=60,af;((Q)=>{Q.STEP_START="SIMULATION.STEP_START";Q.STEP_END="SIMULATION.STEP_END";Q.DEBUG_RAYCAST="SIMULATION.DEBUG_RAYCAST";Q.DEBUG_RENDER="SIMULATION.DEBUG_RENDER"})(af||={});class bq extends g0{_colliderMap=new fq;_debugRaycastingEnabled=!1;_debugRenderingEnabled=!1;_rapierEventQueue;_rapierSimulation;_world;constructor(Z,J=nf,$=Q86){super();this._rapierEventQueue=new K1.EventQueue(!0),this._rapierSimulation=new K1.World($),this._rapierSimulation.timestep=Math.fround(1/J),this._world=Z}get colliderMap(){return this._colliderMap}get isDebugRaycastingEnabled(){return this._debugRaycastingEnabled}get isDebugRenderingEnabled(){return this._debugRenderingEnabled}get gravity(){return this._rapierSimulation.gravity}get timestepS(){return this._rapierSimulation.timestep}get world(){return this._world}raycast(Z,J,$,Y={}){let Q=new K1.Ray(Z,J),W=this._rapierSimulation.castRay(Q,$,Y.ignoresSensors??!0,Y.filterFlags,Y.filterGroups,Y.filterExcludeCollider,Y.filterExcludeRigidBody,Y.filterPredicate);if(this._debugRaycastingEnabled)this.emitWithWorld(this._world,"SIMULATION.DEBUG_RAYCAST",{simulation:this,origin:Z,direction:J,length:$,hit:!!W});if(!W)return null;let X=Q.pointAt(W.timeOfImpact),K=W.timeOfImpact,G=W.collider,z=this._colliderMap.getColliderHandleBlockType(G.handle);if(z)return{hitBlock:FW.fromGlobalCoordinate({x:Math.floor(X.x-(Q.dir.x<0?0.0001:-0.0001)),y:Math.floor(X.y-(Q.dir.y<0?0.0001:-0.0001)),z:Math.floor(X.z-(Q.dir.z<0?0.0001:-0.0001))},z),hitPoint:X,hitDistance:K};let H=this._colliderMap.getColliderHandleEntity(G.handle);if(H)return{hitEntity:H,hitPoint:X,hitDistance:K};return null}createRawCollider(Z,J){return this._rapierSimulation.createCollider(Z,J)}createRawRigidBody(Z){return this._rapierSimulation.createRigidBody(Z)}enableDebugRaycasting(Z){this._debugRaycastingEnabled=Z}enableDebugRendering(Z){this._debugRenderingEnabled=Z}getContactManifolds(Z,J){let $=[];return this._rapierSimulation.narrowPhase.contactPair(Z,J,(Y,Q)=>{if(Y.numContacts()===0)return;let W=Y.normal(),X=[];for(let K=0;K<Y.numSolverContacts();K++)X.push(Y.solverContactPoint(K));$.push({contactPoints:X,localNormalA:!Q?Y.localNormal1():Y.localNormal2(),localNormalB:!Q?Y.localNormal2():Y.localNormal1(),normal:!Q?W:{x:-W.x,y:-W.y,z:-W.z}})}),$}removeRawCollider(Z){this._colliderMap.queueColliderHandleForCleanup(Z.handle),this._rapierSimulation.removeCollider(Z,!1)}removeRawRigidBody(Z){this._rapierSimulation.removeRigidBody(Z)}setGravity(Z){this._rapierSimulation.gravity=Z}step=(Z)=>{this.emitWithWorld(this._world,"SIMULATION.STEP_START",{simulation:this,tickDeltaMs:Z});let J=performance.now();if(X8.startSpan({operation:"physics_step"},()=>{this._rapierSimulation.step(this._rapierEventQueue)}),X8.startSpan({operation:"physics_cleanup"},()=>{this._rapierEventQueue.drainContactForceEvents(this._onContactForceEvent),this._rapierEventQueue.drainCollisionEvents(this._onCollisionEvent),this._colliderMap.cleanup()}),this.emitWithWorld(this._world,"SIMULATION.STEP_END",{simulation:this,stepDurationMs:performance.now()-J}),this._debugRenderingEnabled)this.emitWithWorld(this._world,"SIMULATION.DEBUG_RENDER",{simulation:this,...this._rapierSimulation.debugRender()})};_onCollisionEvent=(Z,J,$)=>{let[Y,Q]=this._getCollisionObjects(Z,J);if(!Y||!Q)return;let W=(X,K)=>{if(X instanceof s5&&K instanceof a8&&X.hasListeners("BLOCK_TYPE.ENTITY_COLLISION"))X.emit("BLOCK_TYPE.ENTITY_COLLISION",{blockType:X,entity:K,started:$,colliderHandleA:Z,colliderHandleB:J});else if(X instanceof a8&&K instanceof s5&&X.hasListeners("ENTITY.BLOCK_COLLISION"))X.emit("ENTITY.BLOCK_COLLISION",{entity:X,blockType:K,started:$,colliderHandleA:Z,colliderHandleB:J});else if(X instanceof a8&&K instanceof a8&&X.hasListeners("ENTITY.ENTITY_COLLISION"))X.emit("ENTITY.ENTITY_COLLISION",{entity:X,otherEntity:K,started:$,colliderHandleA:Z,colliderHandleB:J});else if(typeof X==="function"&&(K instanceof a8||K instanceof s5))X(K,$,Z,J)};W(Y,Q),W(Q,Y)};_onContactForceEvent=(Z)=>{let[J,$]=this._getCollisionObjects(Z.collider1(),Z.collider2());if(!J||typeof J==="function"||!$||typeof $==="function")return;let Y={totalForce:Z.totalForce(),totalForceMagnitude:Z.totalForceMagnitude(),maxForceDirection:Z.maxForceDirection(),maxForceMagnitude:Z.maxForceMagnitude()},Q=(W,X)=>{if(W instanceof s5&&X instanceof a8&&W.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))W.emit("BLOCK_TYPE.ENTITY_CONTACT_FORCE",{blockType:W,entity:X,contactForceData:Y});else if(W instanceof a8&&X instanceof s5&&W.hasListeners("ENTITY.BLOCK_CONTACT_FORCE"))W.emit("ENTITY.BLOCK_CONTACT_FORCE",{entity:W,blockType:X,contactForceData:Y});else if(W instanceof a8&&X instanceof a8&&W.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))W.emit("ENTITY.ENTITY_CONTACT_FORCE",{entity:W,otherEntity:X,contactForceData:Y})};Q(J,$),Q($,J)};_getCollisionObjects(Z,J){let $=this._colliderMap.getColliderHandleBlockType(Z)??this._colliderMap.getColliderHandleCollisionCallback(Z)??this._colliderMap.getColliderHandleEntity(Z),Y=this._colliderMap.getColliderHandleBlockType(J)??this._colliderMap.getColliderHandleCollisionCallback(J)??this._colliderMap.getColliderHandleEntity(J);return[$,Y]}}class CM{_synchronizedPlayerReliablePackets=new Map;_queuedBroadcasts=[];_queuedAudioSynchronizations={};_queuedBlockSynchronizations={};_queuedBlockTypeSynchronizations={};_queuedChunkSynchronizations={};_queuedDebugRaycastSynchronizations=[];_queuedEntitySynchronizations={};_queuedLightSynchronizations={};_queuedPerPlayerSynchronizations=new Map;_queuedPerPlayerCameraSynchronizations=new Map;_queuedPerPlayerUISynchronizations=new Map;_queuedPerPlayerUIDatasSynchronizations=new Map;_queuedPlayerSynchronizations={};_queuedSceneUISynchronizations={};_queuedWorldSynchronization;_loadedSceneUIs=new Set;_spawnedChunks=new Set;_spawnedEntities=new Set;_world;constructor(Z){this._world=Z,this._subscribeToAudioEvents(),this._subscribeToBlockTypeRegistryEvents(),this._subscribeToChatEvents(),this._subscribeToChunkEvents(),this._subscribeToEntityEvents(),this._subscribeToLightEvents(),this._subscribeToPlayerEvents(),this._subscribeToPlayerCameraEvents(),this._subscribeToPlayerUIEvents(),this._subscribeToSceneUIEvents(),this._subscribeToSimulationEvents(),this._subscribeToWorldEvents()}synchronize(){let Z=[],J=[],$=this._world.loop.currentTick;this._queuedPerPlayerSynchronizations.forEach((q,F)=>{this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(...q)});let Y=Object.values(this._queuedEntitySynchronizations);if(Y.length>0){let[q,F]=Y.reduce(([U,w],L)=>{for(let O in L)if(O!=="i"&&O!=="p"&&O!=="r")return U.push(L),[U,w];return w.push(L),[U,w]},[[],[]]);if(F.length>0){let U=Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,F,$);J.push(U)}if(q.length>0){let U=Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,q,$);Z.push(U),this._synchronizedPlayerReliablePackets.forEach((w)=>w.push(U))}}let Q=Object.values(this._queuedAudioSynchronizations);if(Q.length>0){let q=Y0.createPacket(Y0.outboundPackets.audiosPacketDefinition,Q,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let W=Object.values(this._queuedBlockTypeSynchronizations);if(W.length>0){let q=Y0.createPacket(Y0.outboundPackets.blockTypesPacketDefinition,W,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let X=Object.values(this._queuedBlockSynchronizations);if(X.length>0){let q=Y0.createPacket(Y0.outboundPackets.blocksPacketDefinition,X,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let K=Object.values(this._queuedChunkSynchronizations);if(K.length>0){let q=Y0.createPacket(Y0.outboundPackets.chunksPacketDefinition,K,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let G=Object.values(this._queuedLightSynchronizations);if(G.length>0){let q=Y0.createPacket(Y0.outboundPackets.lightsPacketDefinition,G,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}this._queuedPerPlayerUISynchronizations.forEach((q,F)=>{let U=Y0.createPacket(Y0.outboundPackets.uiPacketDefinition,q,$);this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(U)}),this._queuedPerPlayerUIDatasSynchronizations.forEach((q,F)=>{let U=Y0.createPacket(Y0.outboundPackets.uiDatasPacketDefinition,q,$);this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(U)});let z=Object.values(this._queuedSceneUISynchronizations);if(z.length>0){let q=Y0.createPacket(Y0.outboundPackets.sceneUIsPacketDefinition,z,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}if(this._queuedWorldSynchronization){let q=Y0.createPacket(Y0.outboundPackets.worldPacketDefinition,this._queuedWorldSynchronization,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}this._queuedPerPlayerCameraSynchronizations.forEach((q,F)=>{let U=Y0.createPacket(Y0.outboundPackets.cameraPacketDefinition,q,$);this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(U)});let H=Object.values(this._queuedPlayerSynchronizations);if(H.length>0){let q=Y0.createPacket(Y0.outboundPackets.playersPacketDefinition,H,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}this._queuedBroadcasts.forEach((q)=>{Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))});let V=this._queuedDebugRaycastSynchronizations;if(V.length>0){let q=Y0.createPacket(Y0.outboundPackets.physicsDebugRaycastsPacketDefinition,V,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}X8.startSpan({operation:"send_all_packets"},()=>{e5.instance.getConnectedPlayersByWorld(this._world).forEach((q)=>{let F=this._synchronizedPlayerReliablePackets.get(q)??Z;if(F.length>0)q.connection.send(F);if(J.length>0)q.connection.send(J,!1)})}),X8.startSpan({operation:"network_synchronize_cleanup"},()=>{if(this._queuedBroadcasts.length>0)this._queuedBroadcasts=[];if(Q.length>0)this._queuedAudioSynchronizations={};if(X.length>0)this._queuedBlockSynchronizations={};if(W.length>0)this._queuedBlockTypeSynchronizations={};if(K.length>0)this._queuedChunkSynchronizations={};if(V.length>0)this._queuedDebugRaycastSynchronizations=[];if(Y.length>0)this._queuedEntitySynchronizations={};if(G.length>0)this._queuedLightSynchronizations={};if(this._queuedPerPlayerSynchronizations.size>0)this._queuedPerPlayerSynchronizations.clear();if(this._queuedPerPlayerCameraSynchronizations.size>0)this._queuedPerPlayerCameraSynchronizations.clear();if(this._queuedPerPlayerUISynchronizations.size>0)this._queuedPerPlayerUISynchronizations.clear();if(this._queuedPerPlayerUIDatasSynchronizations.size>0)this._queuedPerPlayerUIDatasSynchronizations.clear();if(H.length>0)this._queuedPlayerSynchronizations={};if(z.length>0)this._queuedSceneUISynchronizations={};if(this._queuedWorldSynchronization)this._queuedWorldSynchronization=void 0;if(this._loadedSceneUIs.size>0)this._loadedSceneUIs.clear();if(this._spawnedChunks.size>0)this._spawnedChunks.clear();if(this._spawnedEntities.size>0)this._spawnedEntities.clear();if(this._synchronizedPlayerReliablePackets.size>0)this._synchronizedPlayerReliablePackets.clear()})}_subscribeToAudioEvents(){this._world.final("AUDIO.PAUSE",this._onAudioPause),this._world.final("AUDIO.PLAY",this._onAudioPlay),this._world.final("AUDIO.PLAY_RESTART",this._onAudioPlayRestart),this._world.final("AUDIO.SET_ATTACHED_TO_ENTITY",this._onAudioSetAttachedToEntity),this._world.final("AUDIO.SET_CUTOFF_DISTANCE",this._onAudioSetCutoffDistance),this._world.final("AUDIO.SET_DETUNE",this._onAudioSetDetune),this._world.final("AUDIO.SET_DISTORTION",this._onAudioSetDistortion),this._world.final("AUDIO.SET_POSITION",this._onAudioSetPosition),this._world.final("AUDIO.SET_PLAYBACK_RATE",this._onAudioSetPlaybackRate),this._world.final("AUDIO.SET_REFERENCE_DISTANCE",this._onAudioSetReferenceDistance),this._world.final("AUDIO.SET_VOLUME",this._onAudioSetVolume)}_subscribeToBlockTypeRegistryEvents(){this._world.final("BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE",this._onBlockTypeRegistryRegisterBlockType)}_subscribeToChatEvents(){this._world.final("CHAT.BROADCAST_MESSAGE",this._onChatSendBroadcastMessage),this._world.final("CHAT.PLAYER_MESSAGE",this._onChatSendPlayerMessage)}_subscribeToChunkEvents(){this._world.final("CHUNK.SPAWN",this._onChunkSpawn),this._world.final("CHUNK.DESPAWN",this._onChunkDespawn),this._world.final("CHUNK.SET_BLOCK",this._onChunkSetBlock)}_subscribeToEntityEvents(){this._world.final("ENTITY.SPAWN",this._onEntitySpawn),this._world.final("ENTITY.DESPAWN",this._onEntityDespawn),this._world.final("ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE",this._onEntitySetModelAnimationsPlaybackRate),this._world.final("ENTITY.SET_MODEL_HIDDEN_NODES",this._onEntitySetModelHiddenNodes),this._world.final("ENTITY.SET_OPACITY",this._onEntitySetOpacity),this._world.final("ENTITY.SET_PARENT",this._onEntitySetParent),this._world.final("ENTITY.SET_TINT_COLOR",this._onEntitySetTintColor),this._world.final("ENTITY.START_MODEL_LOOPED_ANIMATIONS",this._onEntityStartModelLoopedAnimations),this._world.final("ENTITY.START_MODEL_ONESHOT_ANIMATIONS",this._onEntityStartModelOneshotAnimations),this._world.final("ENTITY.STOP_MODEL_ANIMATIONS",this._onEntityStopModelAnimations),this._world.final("ENTITY.UPDATE_POSITION",this._onEntityUpdatePosition),this._world.final("ENTITY.UPDATE_ROTATION",this._onEntityUpdateRotation)}_subscribeToLightEvents(){this._world.final("LIGHT.DESPAWN",this._onLightDespawn),this._world.final("LIGHT.SET_ANGLE",this._onLightSetAngle),this._world.final("LIGHT.SET_ATTACHED_TO_ENTITY",this._onLightSetAttachedToEntity),this._world.final("LIGHT.SET_COLOR",this._onLightSetColor),this._world.final("LIGHT.SET_DISTANCE",this._onLightSetDistance),this._world.final("LIGHT.SET_INTENSITY",this._onLightSetIntensity),this._world.final("LIGHT.SET_OFFSET",this._onLightSetOffset),this._world.final("LIGHT.SET_PENUMBRA",this._onLightSetPenumbra),this._world.final("LIGHT.SET_POSITION",this._onLightSetPosition),this._world.final("LIGHT.SET_TRACKED_ENTITY",this._onLightSetTrackedEntity),this._world.final("LIGHT.SET_TRACKED_POSITION",this._onLightSetTrackedPosition),this._world.final("LIGHT.SPAWN",this._onLightSpawn)}_subscribeToPlayerEvents(){this._world.final("PLAYER.JOINED_WORLD",this._onPlayerJoinedWorld),this._world.final("PLAYER.LEFT_WORLD",this._onPlayerLeftWorld),this._world.final("PLAYER.RECONNECTED_WORLD",this._onPlayerReconnectedWorld),this._world.final("PLAYER.REQUEST_SYNC",this._onPlayerRequestSync)}_subscribeToPlayerCameraEvents(){this._world.final("PLAYER_CAMERA.LOOK_AT_ENTITY",this._onPlayerCameraLookAtEntity),this._world.final("PLAYER_CAMERA.LOOK_AT_POSITION",this._onPlayerCameraLookAtPosition),this._world.final("PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY",this._onPlayerCameraSetAttachedToEntity),this._world.final("PLAYER_CAMERA.SET_ATTACHED_TO_POSITION",this._onPlayerCameraSetAttachedToPosition),this._world.final("PLAYER_CAMERA.SET_FILM_OFFSET",this._onPlayerCameraSetFilmOffset),this._world.final("PLAYER_CAMERA.SET_FORWARD_OFFSET",this._onPlayerCameraSetForwardOffset),this._world.final("PLAYER_CAMERA.SET_FOV",this._onPlayerCameraSetFov),this._world.final("PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES",this._onPlayerCameraSetModelHiddenNodes),this._world.final("PLAYER_CAMERA.SET_MODE",this._onPlayerCameraSetMode),this._world.final("PLAYER_CAMERA.SET_OFFSET",this._onPlayerCameraSetOffset),this._world.final("PLAYER_CAMERA.SET_TRACKED_ENTITY",this._onPlayerCameraSetTrackedEntity),this._world.final("PLAYER_CAMERA.SET_TRACKED_POSITION",this._onPlayerCameraSetTrackedPosition),this._world.final("PLAYER_CAMERA.SET_ZOOM",this._onPlayerCameraSetZoom)}_subscribeToPlayerUIEvents(){this._world.final("PLAYER_UI.LOAD",this._onPlayerUILoad),this._world.final("PLAYER_UI.LOCK_POINTER",this._onPlayerUILockPointer),this._world.final("PLAYER_UI.SEND_DATA",this._onPlayerUISendData)}_subscribeToSceneUIEvents(){this._world.final("SCENE_UI.LOAD",this._onSceneUILoad),this._world.final("SCENE_UI.SET_ATTACHED_TO_ENTITY",this._onSceneUISetAttachedToEntity),this._world.final("SCENE_UI.SET_OFFSET",this._onSceneUISetOffset),this._world.final("SCENE_UI.SET_POSITION",this._onSceneUISetPosition),this._world.final("SCENE_UI.SET_STATE",this._onSceneUISetState),this._world.final("SCENE_UI.SET_VIEW_DISTANCE",this._onSceneUISetViewDistance),this._world.final("SCENE_UI.UNLOAD",this._onSceneUIUnload)}_subscribeToSimulationEvents(){this._world.final("SIMULATION.DEBUG_RAYCAST",this._onSimulationDebugRaycast),this._world.final("SIMULATION.DEBUG_RENDER",this._onSimulationDebugRender)}_subscribeToWorldEvents(){this._world.final("WORLD.SET_AMBIENT_LIGHT_COLOR",this._onWorldSetAmbientLightColor),this._world.final("WORLD.SET_AMBIENT_LIGHT_INTENSITY",this._onWorldSetAmbientLightIntensity),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_COLOR",this._onWorldSetDirectionalLightColor),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY",this._onWorldSetDirectionalLightIntensity),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_POSITION",this._onWorldSetDirectionalLightPosition)}_onAudioPause=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.pa=!0,delete J.pl,delete J.r};_onAudioPlay=(Z)=>{let J=Z.audio.serialize();J.pl=!0,delete J.pa,delete J.r,this._queuedAudioSynchronizations[J.i]=J};_onAudioPlayRestart=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.r=!0,delete J.pa,delete J.pl,this._queuedAudioSynchronizations[J.i]=J};_onAudioSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onAudioSetCutoffDistance=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.cd=Z.cutoffDistance};_onAudioSetDetune=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.de=Z.detune};_onAudioSetDistortion=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.di=Z.distortion};_onAudioSetPosition=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.e=Z.position?void 0:J.e,J.p=Z.position?p0.serializeVector(Z.position):void 0};_onAudioSetPlaybackRate=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.pr=Z.playbackRate};_onAudioSetReferenceDistance=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.rd=Z.referenceDistance};_onAudioSetVolume=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.v=Z.volume};_onBlockTypeRegistryRegisterBlockType=(Z)=>{let J=Z.blockType.serialize();this._queuedBlockTypeSynchronizations[Z.blockType.id]=J};_onChatSendBroadcastMessage=(Z)=>{let{player:J,message:$,color:Y}=Z;this._queuedBroadcasts.push(Y0.createPacket(Y0.outboundPackets.chatMessagesPacketDefinition,[{m:$,c:Y,p:J?.id}],this._world.loop.currentTick))};_onChatSendPlayerMessage=(Z)=>{let{player:J,message:$,color:Y}=Z,Q=this._queuedPerPlayerSynchronizations.get(J)??[];Q.push(Y0.createPacket(Y0.outboundPackets.chatMessagesPacketDefinition,[{m:$,c:Y}],this._world.loop.currentTick)),this._queuedPerPlayerSynchronizations.set(J,Q)};_onChunkSpawn=(Z)=>{let J=this._createOrGetQueuedChunkSync(Z.chunk);J.b=Array.from(Z.chunk.blocks),J.rm=void 0,this._spawnedChunks.add(J.c.join(","))};_onChunkDespawn=(Z)=>{let J=this._createOrGetQueuedChunkSync(Z.chunk),$=J.c.join(",");if(this._spawnedChunks.has($))delete this._queuedChunkSynchronizations[$],this._spawnedChunks.delete($);else J.rm=!0};_onChunkSetBlock=(Z)=>{let J=this._createOrGetQueuedBlockSync(Z.globalCoordinate);J.i=Z.blockTypeId};_onEntitySetModelAnimationsPlaybackRate=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.ap=Z.playbackRate};_onEntitySpawn=(Z)=>{let J=Z.entity.serialize();this._queuedEntitySynchronizations[J.i]=J,this._spawnedEntities.add(J.i)};_onEntityDespawn=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(this._spawnedEntities.has(J.i))delete this._queuedEntitySynchronizations[J.i],this._spawnedEntities.delete(J.i);else J.rm=!0};_onEntitySetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.h=Array.from(Z.modelHiddenNodes)};_onEntitySetOpacity=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.o=Z.opacity};_onEntitySetParent=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.pe=Z.parent?Z.parent.id:void 0,J.pn=Z.parentNodeName};_onEntitySetTintColor=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.t=Z.tintColor?p0.serializeRgbColor(Z.tintColor):void 0};_onEntityStartModelLoopedAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.al=Array.from(new Set([...J.al??[],...Z.animations])),J.as)J.as=J.as.filter(($)=>!Z.animations.has($)).filter(Boolean)};_onEntityStartModelOneshotAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.ao=Array.from(new Set([...J.ao??[],...Z.animations])),J.as)J.as=J.as.filter(($)=>!Z.animations.has($)).filter(Boolean)};_onEntityStopModelAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.al)J.al=J.al.filter(($)=>!Z.animations.has($)).filter(Boolean);if(J.ao)J.ao=J.ao.filter(($)=>!Z.animations.has($)).filter(Boolean);J.as=Array.from(new Set([...J.as??[],...Z.animations]))};_onEntityUpdateRotation=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.r=[Z.rotation.x,Z.rotation.y,Z.rotation.z,Z.rotation.w]};_onEntityUpdatePosition=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.p=[Z.position.x,Z.position.y,Z.position.z]};_onLightDespawn=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.rm=!0};_onLightSetAngle=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.a=Z.angle};_onLightSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onLightSetColor=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.c=p0.serializeRgbColor(Z.color)};_onLightSetDistance=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.d=Z.distance};_onLightSetIntensity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.n=Z.intensity};_onLightSetOffset=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.o=Z.offset?p0.serializeVector(Z.offset):void 0};_onLightSetPenumbra=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.pe=Z.penumbra};_onLightSetPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.p=Z.position?p0.serializeVector(Z.position):void 0,J.e=Z.position?void 0:J.e};_onLightSetTrackedEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.te=Z.entity?Z.entity.id:void 0,J.tp=Z.entity?void 0:J.tp};_onLightSetTrackedPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.tp=Z.position?p0.serializeVector(Z.position):void 0,J.te=Z.position?void 0:J.te};_onLightSpawn=(Z)=>{let J=Z.light.serialize();this._queuedLightSynchronizations[J.i]=J};_onPlayerCameraLookAtEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=p0.serializeVector(Z.entity.position),delete J.et,delete J.pt};_onPlayerCameraLookAtPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=Z.position?p0.serializeVector(Z.position):void 0,delete J.et,delete J.pt};_onPlayerCameraSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.e=Z.entity.id,delete J.p};_onPlayerCameraSetAttachedToPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.p=Z.position?p0.serializeVector(Z.position):void 0,delete J.e};_onPlayerCameraSetFilmOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fo=Z.filmOffset};_onPlayerCameraSetForwardOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.ffo=Z.forwardOffset};_onPlayerCameraSetFov=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fv=Z.fov};_onPlayerCameraSetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.h=Array.from(Z.modelHiddenNodes)};_onPlayerCameraSetMode=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.m=Z.mode};_onPlayerCameraSetOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.o=Z.offset?p0.serializeVector(Z.offset):void 0};_onPlayerCameraSetTrackedEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.et=Z.entity?Z.entity.id:void 0,delete J.pl,delete J.pt};_onPlayerCameraSetTrackedPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pt=Z.position?p0.serializeVector(Z.position):void 0,delete J.et,delete J.pl};_onPlayerCameraSetZoom=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.z=Z.zoom};_onPlayerJoinedWorld=(Z)=>{let{player:J}=Z,$=this._queuedPerPlayerSynchronizations.get(J)??[];$.push(Y0.createPacket(Y0.outboundPackets.worldPacketDefinition,this._world.serialize(),this._world.loop.currentTick)),$.push(Y0.createPacket(Y0.outboundPackets.blockTypesPacketDefinition,this._world.blockTypeRegistry.serialize(),this._world.loop.currentTick)),$.push(Y0.createPacket(Y0.outboundPackets.chunksPacketDefinition,this._world.chunkLattice.getAllChunks().map((Q)=>Q.serialize()),this._world.loop.currentTick)),$.push(Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,this._world.entityManager.getAllEntities().map((Q)=>{if(J.camera.attachedToEntity===void 0&&Q instanceof d7&&Q.player===J)J.camera.setAttachedToEntity(Q);return Q.serialize()}),this._world.loop.currentTick)),$.push(Y0.createPacket(Y0.outboundPackets.audiosPacketDefinition,this._world.audioManager.getAllAudios().map((Q)=>Q.serialize()),this._world.loop.currentTick)),$.push(Y0.createPacket(Y0.outboundPackets.lightsPacketDefinition,this._world.lightManager.getAllLights().map((Q)=>Q.serialize()),this._world.loop.currentTick)),$.push(Y0.createPacket(Y0.outboundPackets.sceneUIsPacketDefinition,this._world.sceneUIManager.getAllSceneUIs().map((Q)=>Q.serialize()),this._world.loop.currentTick)),$.push(Y0.createPacket(Y0.outboundPackets.playersPacketDefinition,e5.instance.getConnectedPlayers().map((Q)=>Q.serialize()),this._world.loop.currentTick));let Y=this._createOrGetQueuedPlayerCameraSync(J.camera);this._queuedPerPlayerCameraSynchronizations.set(J,{...J.camera.serialize(),...Y}),this._queuedPerPlayerSynchronizations.set(J,$),this._queuedPlayerSynchronizations[J.id]=J.serialize()};_onPlayerLeftWorld=(Z)=>{let J=this._createOrGetQueuedPlayerSync(Z.player);J.rm=!0};_onPlayerReconnectedWorld=(Z)=>{this._onPlayerJoinedWorld(Z)};_onPlayerRequestSync=(Z)=>{Z.player.connection.send([Y0.createPacket(Y0.outboundPackets.syncResponsePacketDefinition,{r:Z.receivedAt,s:Date.now(),p:performance.now()-Z.receivedAtMs,n:this._world.loop.nextTickMs},this._world.loop.currentTick)])};_onPlayerUILoad=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.u=Z.htmlUri};_onPlayerUILockPointer=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.p=Z.lock};_onPlayerUISendData=(Z)=>{this._createOrGetQueuedPlayerUIDatasSync(Z.playerUI).push(Z.data)};_onSceneUILoad=(Z)=>{let J=Z.sceneUI.serialize();this._queuedSceneUISynchronizations[J.i]=J,this._loadedSceneUIs.add(J.i)};_onSceneUISetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onSceneUISetOffset=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.o=Z.offset?p0.serializeVector(Z.offset):void 0};_onSceneUISetPosition=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.p=Z.position?p0.serializeVector(Z.position):void 0,J.e=Z.position?void 0:J.e};_onSceneUISetState=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.s=Z.state};_onSceneUISetViewDistance=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.v=Z.viewDistance};_onSceneUIUnload=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);if(this._loadedSceneUIs.has(J.i))delete this._queuedSceneUISynchronizations[J.i],this._loadedSceneUIs.delete(J.i);else J.rm=!0};_onSimulationDebugRaycast=(Z)=>{this._queuedDebugRaycastSynchronizations.push(p0.serializePhysicsDebugRaycast(Z))};_onSimulationDebugRender=(Z)=>{this._queuedBroadcasts.push(Y0.createPacket(Y0.outboundPackets.physicsDebugRenderPacketDefinition,{v:Array.from(Z.vertices),c:Array.from(Z.colors)},this._world.loop.currentTick))};_onWorldSetAmbientLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ac=p0.serializeRgbColor(Z.color)};_onWorldSetAmbientLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ai=Z.intensity};_onWorldSetDirectionalLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dc=p0.serializeRgbColor(Z.color)};_onWorldSetDirectionalLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.di=Z.intensity};_onWorldSetDirectionalLightPosition=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dp=p0.serializeVector(Z.position)};_createOrGetQueuedAudioSync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedAudioSync(): Audio has no id!");return this._queuedAudioSynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedBlockSync(Z){let{x:J,y:$,z:Y}=Z;return this._queuedBlockSynchronizations[`${J},${$},${Y}`]??={i:0,c:[J,$,Y]}}_createOrGetQueuedChunkSync(Z){if(!Z.originCoordinate)m.fatalError("NetworkSynchronizer._createOrGetQueuedChunkSync(): Chunk has no origin coordinate!");let{x:J,y:$,z:Y}=Z.originCoordinate;return this._queuedChunkSynchronizations[`${J},${$},${Y}`]??={c:[J,$,Y]}}_createOrGetQueuedEntitySync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedEntitySync(): Entity has no id!");return this._queuedEntitySynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedLightSync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedLightSync(): Light has no id!");return this._queuedLightSynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedPlayerSync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedPlayerSync(): Player has no id!");return this._queuedPlayerSynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedPlayerCameraSync(Z){let J=this._queuedPerPlayerCameraSynchronizations.get(Z.player);if(!J)J={},this._queuedPerPlayerCameraSynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUISync(Z){let J=this._queuedPerPlayerUISynchronizations.get(Z.player);if(!J)J={},this._queuedPerPlayerUISynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUIDatasSync(Z){let J=this._queuedPerPlayerUIDatasSynchronizations.get(Z.player);if(!J)J=[],this._queuedPerPlayerUIDatasSynchronizations.set(Z.player,J);return J}_createOrGetQueuedSceneUISync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedSceneUISync(): SceneUI has no id!");return this._queuedSceneUISynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedWorldSync(Z){if(Z.id!==this._world.id)m.fatalError("NetworkSynchronizer._createOrGetQueuedWorldSync(): World does not match this network synchronizer world!");return this._queuedWorldSynchronization??={i:Z.id}}_createOrGetSynchronizedPlayerReliablePackets(Z,J){let $=this._synchronizedPlayerReliablePackets.get(Z);if(!$)$=[...J],this._synchronizedPlayerReliablePackets.set(Z,$);return $}}class yq{_sceneUIs=new Map;_nextSceneUIId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}getAllSceneUIs(){return Array.from(this._sceneUIs.values())}getAllEntityAttachedSceneUIs(Z){return this.getAllSceneUIs().filter((J)=>J.attachedToEntity===Z)}getSceneUIById(Z){return this._sceneUIs.get(Z)}registerSceneUI(Z){if(Z.id!==void 0)return Z.id;let J=this._nextSceneUIId;return this._sceneUIs.set(J,Z),this._nextSceneUIId++,J}unloadEntityAttachedSceneUIs(Z){this.getAllEntityAttachedSceneUIs(Z).forEach((J)=>{J.unload()})}unregisterSceneUI(Z){if(Z.id===void 0)return;this._sceneUIs.delete(Z.id)}}var W86=2,X86=3;class gq{_accumulatorMs=0;_targetTicksPerSecond;_fixedTimestepMs;_fixedTimestepS;_maxAccumulatorMs;_nextTickMs=0;_lastLoopTimeMs=0;_tickFunction;_tickErrorCallback;_tickHandle=null;constructor(Z,J,$){this._targetTicksPerSecond=Z,this._fixedTimestepS=Math.fround(1/Z),this._fixedTimestepMs=Math.fround(this._fixedTimestepS*1000),this._maxAccumulatorMs=this._fixedTimestepMs*X86,this._tickFunction=J,this._tickErrorCallback=$}get targetTicksPerSecond(){return this._targetTicksPerSecond}get fixedTimestepMs(){return this._fixedTimestepMs}get fixedTimestepS(){return this._fixedTimestepS}get nextTickMs(){return this._nextTickMs}start(){if(this._tickHandle)return m.warning("Ticker.start(): ticker already running.");this._lastLoopTimeMs=performance.now();let Z=()=>{let J=performance.now(),$=J-this._lastLoopTimeMs;if(this._lastLoopTimeMs=J,this._accumulatorMs+=$,this._accumulatorMs>this._maxAccumulatorMs)this._accumulatorMs=this._maxAccumulatorMs;if(this._accumulatorMs>=this._fixedTimestepMs)X8.startSpan({operation:"ticker_tick"},()=>{let Q=0;while(this._accumulatorMs>=this._fixedTimestepMs&&Q<W86)this._tick(this._fixedTimestepMs),this._accumulatorMs-=this._fixedTimestepMs,Q++;this._nextTickMs=this._fixedTimestepMs-this._accumulatorMs});let Y=Math.max(0,this._nextTickMs);this._tickHandle=setTimeout(Z,Y)};Z()}stop(){if(!this._tickHandle)return m.warning("Ticker.stop(): ticker not running.");clearTimeout(this._tickHandle),this._tickHandle=null}_tick(Z){try{this._tickFunction(Z)}catch(J){if(J instanceof Error&&this._tickErrorCallback)this._tickErrorCallback(J);else m.warning(`Ticker._tick(): tick callback threw an error, but it was not an instance of Error. Error: ${J}`)}}}var Y$1;((W)=>{W.START="WORLD_LOOP.START";W.STOP="WORLD_LOOP.STOP";W.TICK_START="WORLD_LOOP.TICK_START";W.TICK_END="WORLD_LOOP.TICK_END";W.TICK_ERROR="WORLD_LOOP.TICK_ERROR"})(Y$1||={});class mq extends g0{_currentTick=0;_ticker;_world;constructor(Z,J=nf){super();this._ticker=new gq(J,this._tick,this._onTickError),this._world=Z}get currentTick(){return this._currentTick}get nextTickMs(){return this._ticker.nextTickMs}get timestepS(){return this._ticker.fixedTimestepS}get world(){return this._world}start(){this._ticker.start(),this.emitWithWorld(this._world,"WORLD_LOOP.START",{worldLoop:this})}stop(){this._ticker.stop(),this.emitWithWorld(this._world,"WORLD_LOOP.STOP",{worldLoop:this})}_tick=(Z)=>{this.emitWithWorld(this._world,"WORLD_LOOP.TICK_START",{worldLoop:this,tickDeltaMs:Z});let J=performance.now();X8.startSpan({operation:"world_tick",attributes:{serverPlayerCount:e5.instance.playerCount,targetTickRate:this._ticker.targetTicksPerSecond,targetTickRateMs:this._ticker.fixedTimestepMs,worldId:this._world.id,worldName:this._world.name,worldChunkCount:this._world.chunkLattice.chunkCount,worldEntityCount:this._world.entityManager.entityCount,worldLoopTick:this._currentTick}},()=>{X8.startSpan({operation:"chunks_update"},()=>this._world.chunkLattice.updateChunks()),X8.startSpan({operation:"entities_tick"},()=>this._world.entityManager.tickEntities(Z)),X8.startSpan({operation:"simulation_step"},()=>this._world.simulation.step(Z)),X8.startSpan({operation:"entities_emit_updates"},()=>this._world.entityManager.checkAndEmitUpdates()),X8.startSpan({operation:"network_synchronize"},()=>this._world.networkSynchronizer.synchronize())}),this._currentTick++,this.emitWithWorld(this._world,"WORLD_LOOP.TICK_END",{worldLoop:this,tickDurationMs:performance.now()-J})};_onTickError=(Z)=>{m.error(`WorldLoop._onTickError(): Error: ${Z}`),this.emitWithWorld(this._world,"WORLD_LOOP.TICK_ERROR",{worldLoop:this,error:Z})}}var sf;((K)=>{K.SET_AMBIENT_LIGHT_COLOR="WORLD.SET_AMBIENT_LIGHT_COLOR";K.SET_AMBIENT_LIGHT_INTENSITY="WORLD.SET_AMBIENT_LIGHT_INTENSITY";K.SET_DIRECTIONAL_LIGHT_COLOR="WORLD.SET_DIRECTIONAL_LIGHT_COLOR";K.SET_DIRECTIONAL_LIGHT_INTENSITY="WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY";K.SET_DIRECTIONAL_LIGHT_POSITION="WORLD.SET_DIRECTIONAL_LIGHT_POSITION";K.START="WORLD.START";K.STOP="WORLD.STOP"})(sf||={});class uq extends g0{_id;_ambientLightColor;_ambientLightIntensity;_directionalLightColor;_directionalLightIntensity;_directionalLightPosition;_name;_skyboxUri;_audioManager;_blockTypeRegistry;_chatManager;_chunkLattice;_entityManager;_lightManager;_loop;_networkSynchronizer;_sceneUIManager;_simulation;_tag;constructor(Z){super();this._id=Z.id,this._ambientLightColor=Z.ambientLightColor??{r:255,g:255,b:255},this._ambientLightIntensity=Z.ambientLightIntensity??1,this._directionalLightColor=Z.directionalLightColor??{r:255,g:255,b:255},this._directionalLightIntensity=Z.directionalLightIntensity??3,this._directionalLightPosition=Z.directionalLightPosition??{x:100,y:150,z:100},this._name=Z.name,this._skyboxUri=Z.skyboxUri,this._tag=Z.tag,this._audioManager=new C3(this),this._blockTypeRegistry=new tG(this),this._chatManager=new dq(this),this._chunkLattice=new Eq(this),this._entityManager=new _q(this),this._lightManager=new Aq(this),this._loop=new mq(this,Z.tickRate),this._networkSynchronizer=new CM(this),this._sceneUIManager=new yq(this),this._simulation=new bq(this,Z.tickRate,Z.gravity)}get id(){return this._id}get ambientLightColor(){return this._ambientLightColor}get ambientLightIntensity(){return this._ambientLightIntensity}get directionalLightColor(){return this._directionalLightColor}get directionalLightIntensity(){return this._directionalLightIntensity}get directionalLightPosition(){return this._directionalLightPosition}get name(){return this._name}get skyboxUri(){return this._skyboxUri}get audioManager(){return this._audioManager}get tag(){return this._tag}get blockTypeRegistry(){return this._blockTypeRegistry}get chatManager(){return this._chatManager}get chunkLattice(){return this._chunkLattice}get entityManager(){return this._entityManager}get lightManager(){return this._lightManager}get loop(){return this._loop}get networkSynchronizer(){return this._networkSynchronizer}get sceneUIManager(){return this._sceneUIManager}get simulation(){return this._simulation}loadMap(Z){if(this.chunkLattice.clear(),Z.blockTypes)for(let J of Z.blockTypes)this.blockTypeRegistry.registerGenericBlockType({id:J.id,isLiquid:J.isLiquid,name:J.name,textureUri:J.textureUri});if(Z.blocks)for(let[J,$]of Object.entries(Z.blocks)){let[Y,Q,W]=J.split(",").map(Number);this.chunkLattice.setBlock({x:Y,y:Q,z:W},$)}if(Z.entities)for(let[J,$]of Object.entries(Z.entities)){let[Y,Q,W]=J.split(",").map(Number);new a8($).spawn(this,{x:Y,y:Q,z:W})}}setAmbientLightColor(Z){this._ambientLightColor=Z,this.emit("WORLD.SET_AMBIENT_LIGHT_COLOR",{world:this,color:Z})}setAmbientLightIntensity(Z){this._ambientLightIntensity=Z,this.emit("WORLD.SET_AMBIENT_LIGHT_INTENSITY",{world:this,intensity:Z})}setDirectionalLightColor(Z){this._directionalLightColor=Z,this.emit("WORLD.SET_DIRECTIONAL_LIGHT_COLOR",{world:this,color:Z})}setDirectionalLightIntensity(Z){this._directionalLightIntensity=Z,this.emit("WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY",{world:this,intensity:Z})}setDirectionalLightPosition(Z){this._directionalLightPosition=Z,this.emit("WORLD.SET_DIRECTIONAL_LIGHT_POSITION",{world:this,position:Z})}start(){this._loop.start(),this.emit("WORLD.START",{world:this,startedAtMs:Date.now()})}stop(){this._loop.stop(),this.emit("WORLD.STOP",{world:this,stoppedAtMs:Date.now()})}serialize(){return p0.serializeWorld(this)}}var K86=1,Q$1;((J)=>J.WORLD_CREATED="WORLD_MANAGER.WORLD_CREATED")(Q$1||={});class O3{static instance=new O3;_worlds=new Map;_nextWorldId=1;createWorld(Z){let J=new uq({...Z,id:this._nextWorldId++});return J.start(),this._worlds.set(J.id,J),q6.emit("WORLD_MANAGER.WORLD_CREATED",{world:J}),J}getAllWorlds(){return Array.from(this._worlds.values())}getDefaultWorld(){return this._worlds.get(K86)??this.createWorld({name:"Default World",skyboxUri:"skyboxes/partly-cloudy"})}getWorldsByTag(Z){let J=[];return this._worlds.forEach(($)=>{if($.tag===Z)J.push($)}),J}getWorld(Z){return this._worlds.get(Z)}}var W$1;(($)=>{$.START="GAMESERVER.START";$.STOP="GAMESERVER.STOP"})(W$1||={});function G86(Z){K1.init().then(()=>{return sZ.instance.modelRegistry.preloadModels()}).then(()=>{Z(sZ.instance.worldManager.getDefaultWorld()),sZ.instance.start()}).catch((J)=>{m.fatalError(`Failed to initialize the game engine, exiting. Error: ${J}`)})}class sZ{static _instance;_modelRegistry=N9.instance;_playerManager=e5.instance;_socket=bJ.instance;_worldManager=O3.instance;_webServer=tX.instance;constructor(){if(Bun)setInterval(()=>Bun.gc(!1),2000)}static get instance(){if(!this._instance)this._instance=new sZ;return this._instance}get modelRegistry(){return this._modelRegistry}get playerManager(){return this._playerManager}get socket(){return this._socket}get webServer(){return this._webServer}get worldManager(){return this._worldManager}start(){q6.emit("GAMESERVER.START",{startedAtMs:performance.now()}),this._webServer.start()}}class GW{static instance=new GW;constructor(){}async getGlobalData(Z){let J=await j7.instance.getData(Z);if(!J||J.error){if(J?.error)m.warning(`PersistenceManager.getGlobalData(): ${J.error.message}`);return}return J}async getPlayerData(Z){let J=await j7.instance.getData(this._getPlayerKey(Z));if(!J||J.error){if(J?.error)m.warning(`PersistenceManager.getPlayerData(): ${J.error.message}`);return}return J}async setGlobalData(Z,J){let $=await j7.instance.setData(Z,J);if(!$||$.error){if($?.error)m.warning(`PersistenceManager.setGlobalData(): ${$.error.message}`);return}return $}async setPlayerData(Z,J){let $=await j7.instance.setData(this._getPlayerKey(Z),J);if(!$||$.error){if($?.error)m.warning(`PersistenceManager.setPlayerData(): ${$.error.message}`);return}return $}_getPlayerKey(Z){return`player-${Z.id}`}}var X$1=["w","a","s","d","sp","sh","tb","ml","mr","q","e","r","f","z","x","c","v","1","2","3","4","5","6","7","8","9","0"],Sq;((W)=>{W.CHAT_MESSAGE_SEND="PLAYER.CHAT_MESSAGE_SEND";W.JOINED_WORLD="PLAYER.JOINED_WORLD";W.LEFT_WORLD="PLAYER.LEFT_WORLD";W.RECONNECTED_WORLD="PLAYER.RECONNECTED_WORLD";W.REQUEST_SYNC="PLAYER.REQUEST_SYNC"})(Sq||={});class w3 extends g0{static _devNextPlayerId=1;id;username;profilePictureUrl;camera;connection;ui;_input={};_lastUnreliableInputSequenceNumber=0;_world;constructor(Z,J){super();this.id=J?.user.id??`player-${w3._devNextPlayerId++}`,this.username=J?.user.username??this.id,this.profilePictureUrl=J?.user.profilePictureURL??void 0,this.camera=new xq(this),this.connection=Z,this.ui=new hq(this),Z.onPacket(Y0.PacketId.CHAT_MESSAGE_SEND,this._onChatMessageSendPacket),Z.onPacket(Y0.PacketId.DEBUG_CONFIG,this._onDebugConfigPacket),Z.onPacket(Y0.PacketId.INPUT,this._onInputPacket),Z.onPacket(Y0.PacketId.SYNC_REQUEST,this._onSyncRequestPacket),Z.onPacket(Y0.PacketId.UI_DATA_SEND,this._onUIDataSendPacket),this.joinWorld(sZ.instance.worldManager.getDefaultWorld())}get input(){return this._input}get world(){return this._world}disconnect(){this._leaveWorld(),this.connection.disconnect()}async getPersistedData(){return GW.instance.getPlayerData(this)}joinWorld(Z){if(this._world)this.disconnect();this._world=Z,this.emitWithWorld(this._world,"PLAYER.JOINED_WORLD",{player:this,world:this._world})}reconnect(){if(!this._world)return;this._lastUnreliableInputSequenceNumber=0,this.emitWithWorld(this._world,"PLAYER.RECONNECTED_WORLD",{player:this,world:this._world})}resetInputs(){this._input={}}async setPersistedData(Z){return GW.instance.setPlayerData(this,Z)}serialize(){return p0.serializePlayer(this)}_leaveWorld(){if(!this._world)return;this.emitWithWorld(this._world,"PLAYER.LEFT_WORLD",{player:this,world:this._world}),this._world=void 0}_onChatMessageSendPacket=(Z)=>{if(this._world)this.emitWithWorld(this._world,"PLAYER.CHAT_MESSAGE_SEND",{player:this,message:Z[1].m})};_onDebugConfigPacket=(Z)=>{console.log(Z)};_onInputPacket=(Z)=>{let J=Z[1];if(J.sq!==void 0){if(J.sq<this._lastUnreliableInputSequenceNumber)return;this._lastUnreliableInputSequenceNumber=J.sq}if(X$1.forEach(($)=>{let Y=$;if(J[Y]!==void 0)this._input[Y]=Boolean(J[Y])}),J.cp!==void 0)this.camera.setOrientationPitch(J.cp);if(J.cy!==void 0)this.camera.setOrientationYaw(J.cy)};_onSyncRequestPacket=()=>{if(this._world)this.emitWithWorld(this._world,"PLAYER.REQUEST_SYNC",{player:this,receivedAt:Date.now(),receivedAtMs:performance.now()})};_onUIDataSendPacket=(Z)=>{this.ui.emit("PLAYER_UI.DATA",{playerUI:this.ui,data:Z[1]})}}var of;(($)=>{$.BROADCAST_MESSAGE="CHAT.BROADCAST_MESSAGE";$.PLAYER_MESSAGE="CHAT.PLAYER_MESSAGE"})(of||={});class dq extends g0{_commandCallbacks={};_world;constructor(Z){super();this._world=Z,this._subscribeToPlayerEvents()}registerCommand(Z,J){this._commandCallbacks[Z]=J}unregisterCommand(Z){delete this._commandCallbacks[Z]}sendBroadcastMessage(Z,J){this._sendBroadcastMessage(void 0,Z,J)}sendPlayerMessage(Z,J,$){this.emitWithWorld(this._world,"CHAT.PLAYER_MESSAGE",{player:Z,message:J,color:$})}_subscribeToPlayerEvents(){this._world.on("PLAYER.CHAT_MESSAGE_SEND",(Z)=>{let{player:J,message:$}=Z,[Y,...Q]=$.split(" "),W=this._commandCallbacks[Y];if(W){W(J,Q,$);return}this._sendBroadcastMessage(J,$)})}_sendBroadcastMessage(Z,J,$){this.emitWithWorld(this._world,"CHAT.BROADCAST_MESSAGE",{player:Z,message:J,color:$})}}class cq extends b${autoCancelMouseLeftClick=!0;canJump=()=>!0;canRun=()=>!0;canSwim=()=>!0;canWalk=()=>!0;idleLoopedAnimations=["idle_upper","idle_lower"];interactOneshotAnimations=["simple_interact"];jumpOneshotAnimations=["jump_loop"];jumpVelocity=10;runLoopedAnimations=["run_upper","run_lower"];runVelocity=8;sticksToPlatforms=!0;swimFastVelocity=5;swimGravity=0.1;swimLoopedAnimations=["crawling"];swimMaxGravityVelocity=-1;swimSlowVelocity=3;swimUpwardVelocity=2;walkLoopedAnimations=["walk_upper","walk_lower"];walkVelocity=4;_stepAudio;_groundContactCount=0;_liquidContactCount=0;_platform;_swimUpwardCooldownAt=0;constructor(Z={}){super();this.autoCancelMouseLeftClick=Z.autoCancelMouseLeftClick??this.autoCancelMouseLeftClick,this.jumpVelocity=Z.jumpVelocity??this.jumpVelocity,this.runVelocity=Z.runVelocity??this.runVelocity,this.walkVelocity=Z.walkVelocity??this.walkVelocity,this.canJump=Z.canJump??this.canJump,this.canRun=Z.canRun??this.canRun,this.canSwim=Z.canSwim??this.canSwim,this.canWalk=Z.canWalk??this.canWalk,this.sticksToPlatforms=Z.sticksToPlatforms??this.sticksToPlatforms,this.swimFastVelocity=Z.swimFastVelocity??this.swimFastVelocity,this.swimGravity=Z.swimGravity??this.swimGravity,this.swimLoopedAnimations=Z.swimLoopedAnimations??this.swimLoopedAnimations,this.swimSlowVelocity=Z.swimSlowVelocity??this.swimSlowVelocity,this.swimUpwardVelocity=Z.swimUpwardVelocity??this.swimUpwardVelocity}get isGrounded(){return this._groundContactCount>0}get isOnPlatform(){return!!this._platform}get isSwimming(){return this._liquidContactCount>0}get platform(){return this._platform}attach(Z){this._stepAudio=new D3({uri:"audio/sfx/step/stone/stone-step-04.mp3",loop:!0,volume:0.1,referenceDistance:2,cutoffDistance:15,attachedToEntity:Z}),Z.setCcdEnabled(!0),Z.lockAllRotations(),Z.on("ENTITY.BLOCK_COLLISION",({blockType:J,started:$})=>{if(!J.isLiquid||!this.canSwim(this))return;if(this._liquidContactCount<=0&&$){let Y=Z.linearVelocity;Z.setLinearVelocity({x:Y.x*this.swimGravity,y:Y.y*this.swimGravity,z:Y.z*this.swimGravity})}if(this._liquidContactCount+=$?1:-1,this._liquidContactCount>0)Z.setGravityScale(this.swimGravity),Z.startModelLoopedAnimations(this.swimLoopedAnimations),this._swimUpwardCooldownAt=performance.now()+600;else Z.setGravityScale(1),Z.stopModelAnimations(this.swimLoopedAnimations)})}spawn(Z){if(!Z.isSpawned)return m.error("DefaultPlayerEntityController.spawn(): Entity is not spawned!");Z.createAndAddChildCollider({shape:"cylinder",radius:0.23,halfHeight:0.125,collisionGroups:{belongsTo:[4],collidesWith:[1,2]},isSensor:!0,relativePosition:{x:0,y:-0.75,z:0},tag:"groundSensor",onCollision:(J,$)=>{if(!Z.isSpawned)return;if(!(J instanceof s5)||!J.isLiquid)this._groundContactCount+=$?1:-1;if(!this._groundContactCount&&!this.isSwimming)Z.startModelOneshotAnimations(this.jumpOneshotAnimations);else Z.stopModelAnimations(this.jumpOneshotAnimations);if(!(J instanceof a8)||!J.isKinematic)return;if($&&this.sticksToPlatforms)this._platform=J;else if(J===this._platform&&!$)this._platform=void 0}}),Z.createAndAddChildCollider({shape:"capsule",halfHeight:0.33,radius:0.4,collisionGroups:{belongsTo:[4],collidesWith:[1,2]},friction:0,frictionCombineRule:1,tag:"wallCollider"})}tickWithPlayerInput(Z,J,$,Y){if(!Z.isSpawned||!Z.world)return;if(super.tickWithPlayerInput(Z,J,$,Y),Z.parent)return;let{w:Q,a:W,s:X,d:K,sp:G,sh:z,ml:H}=J,{yaw:V}=$,q=Z.linearVelocity,F={x:0,y:0,z:0},U=z;if(this.isGrounded&&!this.isSwimming&&(Q||W||X||K)){if(U)Z.stopModelAnimations(Array.from(Z.modelLoopedAnimations).filter((j)=>!this.runLoopedAnimations.includes(j))),Z.startModelLoopedAnimations(this.runLoopedAnimations),this._stepAudio?.setPlaybackRate(0.75);else Z.stopModelAnimations(Array.from(Z.modelLoopedAnimations).filter((j)=>!this.walkLoopedAnimations.includes(j))),Z.startModelLoopedAnimations(this.walkLoopedAnimations),this._stepAudio?.setPlaybackRate(0.51);this._stepAudio?.play(Z.world,!this._stepAudio?.isPlaying)}else if(this._stepAudio?.pause(),!this.isSwimming)Z.stopModelAnimations(Array.from(Z.modelLoopedAnimations).filter((j)=>!this.idleLoopedAnimations.includes(j))),Z.startModelLoopedAnimations(this.idleLoopedAnimations);if(H)Z.startModelOneshotAnimations(this.interactOneshotAnimations),J.ml=!this.autoCancelMouseLeftClick;if(U&&this.canRun(this)||!U&&this.canWalk(this)){let j=!this.isSwimming?U?this.runVelocity:this.walkVelocity:U?this.swimFastVelocity:this.swimSlowVelocity;if(Q)F.x-=j*Math.sin(V),F.z-=j*Math.cos(V);if(X)F.x+=j*Math.sin(V),F.z+=j*Math.cos(V);if(W)F.x-=j*Math.cos(V),F.z+=j*Math.sin(V);if(K)F.x+=j*Math.cos(V),F.z-=j*Math.sin(V);let M=Math.sqrt(F.x*F.x+F.z*F.z);if(M>j){let N=j/M;F.x*=N,F.z*=N}}if(this.isSwimming){if(q.y<this.swimMaxGravityVelocity)Z.setLinearVelocity({...q,y:this.swimMaxGravityVelocity});if(q.y>this.swimUpwardVelocity*2)Z.setLinearVelocity({...q,y:this.swimUpwardVelocity*2})}if(G&&this.canJump(this)){if(this.isGrounded&&!this.isSwimming&&q.y>-0.001&&q.y<=3)F.y=this.jumpVelocity;else if(this.isSwimming&&performance.now()>this._swimUpwardCooldownAt)F.y=this.swimUpwardVelocity*Z.gravityScale}let w=this._platform?this._platform.linearVelocity:{x:0,y:0,z:0},L={x:F.x-q.x+w.x,y:F.y+w.y,z:F.z-q.z+w.z};if(!(this.runVelocity>0&&Math.abs(q.x)>this.runVelocity||this.jumpVelocity>0&&Math.abs(q.y)>this.jumpVelocity||this.runVelocity>0&&Math.abs(q.z)>this.runVelocity)||this.isOnPlatform){if(Object.values(L).some((j)=>j!==0)){let j=Z.mass;Z.applyImpulse({x:L.x*j,y:L.y*j,z:L.z*j})}}if(V!==void 0){let j=V/2;Z.setRotation({x:0,y:Math.fround(Math.sin(j)),z:0,w:Math.fround(Math.cos(j))})}}}class rf extends d7{constructor(Z){super({modelUri:"models/players/player.gltf",modelLoopedAnimations:["idle_lower","idle_upper"],modelScale:0.5,...Z});if(!Z.controller)this.setController(new cq)}}var P0=0.000001,Y1=typeof Float32Array!=="undefined"?Float32Array:Array,c7=Math.random;var To6=Math.PI/180;if(!Math.hypot)Math.hypot=function(){var Z=0,J=arguments.length;while(J--)Z+=arguments[J]*arguments[J];return Math.sqrt(Z)};var m8={};$4(m8,{transpose:()=>L86,subtract:()=>G$1,sub:()=>_86,str:()=>P86,set:()=>U86,scale:()=>M86,rotate:()=>j86,multiplyScalarAndAdd:()=>v86,multiplyScalar:()=>I86,multiply:()=>K$1,mul:()=>S86,invert:()=>w86,identity:()=>q86,fromValues:()=>F86,fromScaling:()=>N86,fromRotation:()=>R86,frob:()=>D86,exactEquals:()=>k86,equals:()=>E86,determinant:()=>O86,create:()=>z86,copy:()=>V86,clone:()=>H86,adjoint:()=>B86,add:()=>T86,LDU:()=>C86});function z86(){var Z=new Y1(4);if(Y1!=Float32Array)Z[1]=0,Z[2]=0;return Z[0]=1,Z[3]=1,Z}function H86(Z){var J=new Y1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function V86(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function q86(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=1,Z}function F86(Z,J,$,Y){var Q=new Y1(4);return Q[0]=Z,Q[1]=J,Q[2]=$,Q[3]=Y,Q}function U86(Z,J,$,Y,Q){return Z[0]=J,Z[1]=$,Z[2]=Y,Z[3]=Q,Z}function L86(Z,J){if(Z===J){var $=J[1];Z[1]=J[2],Z[2]=$}else Z[0]=J[0],Z[1]=J[2],Z[2]=J[1],Z[3]=J[3];return Z}function w86(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=$*W-Q*Y;if(!X)return null;return X=1/X,Z[0]=W*X,Z[1]=-Y*X,Z[2]=-Q*X,Z[3]=$*X,Z}function B86(Z,J){var $=J[0];return Z[0]=J[3],Z[1]=-J[1],Z[2]=-J[2],Z[3]=$,Z}function O86(Z){return Z[0]*Z[3]-Z[2]*Z[1]}function K$1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=$[0],G=$[1],z=$[2],H=$[3];return Z[0]=Y*K+W*G,Z[1]=Q*K+X*G,Z[2]=Y*z+W*H,Z[3]=Q*z+X*H,Z}function j86(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin($),G=Math.cos($);return Z[0]=Y*G+W*K,Z[1]=Q*G+X*K,Z[2]=Y*-K+W*G,Z[3]=Q*-K+X*G,Z}function M86(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=$[0],G=$[1];return Z[0]=Y*K,Z[1]=Q*K,Z[2]=W*G,Z[3]=X*G,Z}function R86(Z,J){var $=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=$,Z[2]=-$,Z[3]=Y,Z}function N86(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=J[1],Z}function P86(Z){return"mat2("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}function D86(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3])}function C86(Z,J,$,Y){return Z[2]=Y[2]/Y[0],$[0]=Y[0],$[1]=Y[1],$[3]=Y[3]-Z[2]*$[1],[Z,J,$]}function T86(Z,J,$){return Z[0]=J[0]+$[0],Z[1]=J[1]+$[1],Z[2]=J[2]+$[2],Z[3]=J[3]+$[3],Z}function G$1(Z,J,$){return Z[0]=J[0]-$[0],Z[1]=J[1]-$[1],Z[2]=J[2]-$[2],Z[3]=J[3]-$[3],Z}function k86(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function E86(Z,J){var $=Z[0],Y=Z[1],Q=Z[2],W=Z[3],X=J[0],K=J[1],G=J[2],z=J[3];return Math.abs($-X)<=P0*Math.max(1,Math.abs($),Math.abs(X))&&Math.abs(Y-K)<=P0*Math.max(1,Math.abs(Y),Math.abs(K))&&Math.abs(Q-G)<=P0*Math.max(1,Math.abs(Q),Math.abs(G))&&Math.abs(W-z)<=P0*Math.max(1,Math.abs(W),Math.abs(z))}function I86(Z,J,$){return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z[3]=J[3]*$,Z}function v86(Z,J,$,Y){return Z[0]=J[0]+$[0]*Y,Z[1]=J[1]+$[1]*Y,Z[2]=J[2]+$[2]*Y,Z[3]=J[3]+$[3]*Y,Z}var S86=K$1,_86=G$1;var l1={};$4(l1,{transpose:()=>g86,translate:()=>c86,subtract:()=>H$1,sub:()=>K66,str:()=>e86,set:()=>b86,scale:()=>p86,rotate:()=>l86,projection:()=>t86,normalFromMat4:()=>r86,multiplyScalarAndAdd:()=>Y66,multiplyScalar:()=>$66,multiply:()=>z$1,mul:()=>X66,invert:()=>m86,identity:()=>y86,fromValues:()=>f86,fromTranslation:()=>i86,fromScaling:()=>a86,fromRotation:()=>n86,fromQuat:()=>o86,fromMat4:()=>A86,fromMat2d:()=>s86,frob:()=>Z66,exactEquals:()=>Q66,equals:()=>W66,determinant:()=>d86,create:()=>tf,copy:()=>h86,clone:()=>x86,adjoint:()=>u86,add:()=>J66});function tf(){var Z=new Y1(9);if(Y1!=Float32Array)Z[1]=0,Z[2]=0,Z[3]=0,Z[5]=0,Z[6]=0,Z[7]=0;return Z[0]=1,Z[4]=1,Z[8]=1,Z}function A86(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[4],Z[4]=J[5],Z[5]=J[6],Z[6]=J[8],Z[7]=J[9],Z[8]=J[10],Z}function x86(Z){var J=new Y1(9);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J[4]=Z[4],J[5]=Z[5],J[6]=Z[6],J[7]=Z[7],J[8]=Z[8],J}function h86(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z[4]=J[4],Z[5]=J[5],Z[6]=J[6],Z[7]=J[7],Z[8]=J[8],Z}function f86(Z,J,$,Y,Q,W,X,K,G){var z=new Y1(9);return z[0]=Z,z[1]=J,z[2]=$,z[3]=Y,z[4]=Q,z[5]=W,z[6]=X,z[7]=K,z[8]=G,z}function b86(Z,J,$,Y,Q,W,X,K,G,z){return Z[0]=J,Z[1]=$,Z[2]=Y,Z[3]=Q,Z[4]=W,Z[5]=X,Z[6]=K,Z[7]=G,Z[8]=z,Z}function y86(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=1,Z[5]=0,Z[6]=0,Z[7]=0,Z[8]=1,Z}function g86(Z,J){if(Z===J){var $=J[1],Y=J[2],Q=J[5];Z[1]=J[3],Z[2]=J[6],Z[3]=$,Z[5]=J[7],Z[6]=Y,Z[7]=Q}else Z[0]=J[0],Z[1]=J[3],Z[2]=J[6],Z[3]=J[1],Z[4]=J[4],Z[5]=J[7],Z[6]=J[2],Z[7]=J[5],Z[8]=J[8];return Z}function m86(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=H*X-K*z,q=-H*W+K*G,F=z*W-X*G,U=$*V+Y*q+Q*F;if(!U)return null;return U=1/U,Z[0]=V*U,Z[1]=(-H*Y+Q*z)*U,Z[2]=(K*Y-Q*X)*U,Z[3]=q*U,Z[4]=(H*$-Q*G)*U,Z[5]=(-K*$+Q*W)*U,Z[6]=F*U,Z[7]=(-z*$+Y*G)*U,Z[8]=(X*$-Y*W)*U,Z}function u86(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],H=J[8];return Z[0]=X*H-K*z,Z[1]=Q*z-Y*H,Z[2]=Y*K-Q*X,Z[3]=K*G-W*H,Z[4]=$*H-Q*G,Z[5]=Q*W-$*K,Z[6]=W*z-X*G,Z[7]=Y*G-$*z,Z[8]=$*X-Y*W,Z}function d86(Z){var J=Z[0],$=Z[1],Y=Z[2],Q=Z[3],W=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8];return J*(z*W-X*G)+$*(-z*Q+X*K)+Y*(G*Q-W*K)}function z$1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=$[0],F=$[1],U=$[2],w=$[3],L=$[4],O=$[5],j=$[6],M=$[7],N=$[8];return Z[0]=q*Y+F*X+U*z,Z[1]=q*Q+F*K+U*H,Z[2]=q*W+F*G+U*V,Z[3]=w*Y+L*X+O*z,Z[4]=w*Q+L*K+O*H,Z[5]=w*W+L*G+O*V,Z[6]=j*Y+M*X+N*z,Z[7]=j*Q+M*K+N*H,Z[8]=j*W+M*G+N*V,Z}function c86(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=$[0],F=$[1];return Z[0]=Y,Z[1]=Q,Z[2]=W,Z[3]=X,Z[4]=K,Z[5]=G,Z[6]=q*Y+F*X+z,Z[7]=q*Q+F*K+H,Z[8]=q*W+F*G+V,Z}function l86(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=Math.sin($),F=Math.cos($);return Z[0]=F*Y+q*X,Z[1]=F*Q+q*K,Z[2]=F*W+q*G,Z[3]=F*X-q*Y,Z[4]=F*K-q*Q,Z[5]=F*G-q*W,Z[6]=z,Z[7]=H,Z[8]=V,Z}function p86(Z,J,$){var Y=$[0],Q=$[1];return Z[0]=Y*J[0],Z[1]=Y*J[1],Z[2]=Y*J[2],Z[3]=Q*J[3],Z[4]=Q*J[4],Z[5]=Q*J[5],Z[6]=J[6],Z[7]=J[7],Z[8]=J[8],Z}function i86(Z,J){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=1,Z[5]=0,Z[6]=J[0],Z[7]=J[1],Z[8]=1,Z}function n86(Z,J){var $=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=$,Z[2]=0,Z[3]=-$,Z[4]=Y,Z[5]=0,Z[6]=0,Z[7]=0,Z[8]=1,Z}function a86(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=J[1],Z[5]=0,Z[6]=0,Z[7]=0,Z[8]=1,Z}function s86(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=0,Z[3]=J[2],Z[4]=J[3],Z[5]=0,Z[6]=J[4],Z[7]=J[5],Z[8]=1,Z}function o86(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=$+$,K=Y+Y,G=Q+Q,z=$*X,H=Y*X,V=Y*K,q=Q*X,F=Q*K,U=Q*G,w=W*X,L=W*K,O=W*G;return Z[0]=1-V-U,Z[3]=H-O,Z[6]=q+L,Z[1]=H+O,Z[4]=1-z-U,Z[7]=F-w,Z[2]=q-L,Z[5]=F+w,Z[8]=1-z-V,Z}function r86(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],O=J[15],j=$*K-Y*X,M=$*G-Q*X,N=$*z-W*X,D=Y*G-Q*K,P=Y*z-W*K,C=Q*z-W*G,T=H*w-V*U,E=H*L-q*U,A=H*O-F*U,S=V*L-q*w,x=V*O-F*w,I=q*O-F*L,v=j*I-M*x+N*S+D*A-P*E+C*T;if(!v)return null;return v=1/v,Z[0]=(K*I-G*x+z*S)*v,Z[1]=(G*A-X*I-z*E)*v,Z[2]=(X*x-K*A+z*T)*v,Z[3]=(Q*x-Y*I-W*S)*v,Z[4]=($*I-Q*A+W*E)*v,Z[5]=(Y*A-$*x-W*T)*v,Z[6]=(w*C-L*P+O*D)*v,Z[7]=(L*N-U*C-O*M)*v,Z[8]=(U*P-w*N+O*j)*v,Z}function t86(Z,J,$){return Z[0]=2/J,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=-2/$,Z[5]=0,Z[6]=-1,Z[7]=1,Z[8]=1,Z}function e86(Z){return"mat3("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+")"}function Z66(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8])}function J66(Z,J,$){return Z[0]=J[0]+$[0],Z[1]=J[1]+$[1],Z[2]=J[2]+$[2],Z[3]=J[3]+$[3],Z[4]=J[4]+$[4],Z[5]=J[5]+$[5],Z[6]=J[6]+$[6],Z[7]=J[7]+$[7],Z[8]=J[8]+$[8],Z}function H$1(Z,J,$){return Z[0]=J[0]-$[0],Z[1]=J[1]-$[1],Z[2]=J[2]-$[2],Z[3]=J[3]-$[3],Z[4]=J[4]-$[4],Z[5]=J[5]-$[5],Z[6]=J[6]-$[6],Z[7]=J[7]-$[7],Z[8]=J[8]-$[8],Z}function $66(Z,J,$){return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z[3]=J[3]*$,Z[4]=J[4]*$,Z[5]=J[5]*$,Z[6]=J[6]*$,Z[7]=J[7]*$,Z[8]=J[8]*$,Z}function Y66(Z,J,$,Y){return Z[0]=J[0]+$[0]*Y,Z[1]=J[1]+$[1]*Y,Z[2]=J[2]+$[2]*Y,Z[3]=J[3]+$[3]*Y,Z[4]=J[4]+$[4]*Y,Z[5]=J[5]+$[5]*Y,Z[6]=J[6]+$[6]*Y,Z[7]=J[7]+$[7]*Y,Z[8]=J[8]+$[8]*Y,Z}function Q66(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]&&Z[4]===J[4]&&Z[5]===J[5]&&Z[6]===J[6]&&Z[7]===J[7]&&Z[8]===J[8]}function W66(Z,J){var $=Z[0],Y=Z[1],Q=Z[2],W=Z[3],X=Z[4],K=Z[5],G=Z[6],z=Z[7],H=Z[8],V=J[0],q=J[1],F=J[2],U=J[3],w=J[4],L=J[5],O=J[6],j=J[7],M=J[8];return Math.abs($-V)<=P0*Math.max(1,Math.abs($),Math.abs(V))&&Math.abs(Y-q)<=P0*Math.max(1,Math.abs(Y),Math.abs(q))&&Math.abs(Q-F)<=P0*Math.max(1,Math.abs(Q),Math.abs(F))&&Math.abs(W-U)<=P0*Math.max(1,Math.abs(W),Math.abs(U))&&Math.abs(X-w)<=P0*Math.max(1,Math.abs(X),Math.abs(w))&&Math.abs(K-L)<=P0*Math.max(1,Math.abs(K),Math.abs(L))&&Math.abs(G-O)<=P0*Math.max(1,Math.abs(G),Math.abs(O))&&Math.abs(z-j)<=P0*Math.max(1,Math.abs(z),Math.abs(j))&&Math.abs(H-M)<=P0*Math.max(1,Math.abs(H),Math.abs(M))}var X66=z$1,K66=H$1;var o0={};$4(o0,{transpose:()=>F66,translate:()=>B66,targetTo:()=>d66,subtract:()=>B$1,sub:()=>r66,str:()=>c66,set:()=>q66,scale:()=>O66,rotateZ:()=>N66,rotateY:()=>R66,rotateX:()=>M66,rotate:()=>j66,perspectiveZO:()=>b66,perspectiveNO:()=>L$1,perspectiveFromFieldOfView:()=>y66,perspective:()=>f66,orthoZO:()=>m66,orthoNO:()=>w$1,ortho:()=>g66,multiplyScalarAndAdd:()=>n66,multiplyScalar:()=>i66,multiply:()=>q$1,mul:()=>o66,lookAt:()=>u66,invert:()=>U66,identity:()=>V$1,getTranslation:()=>v66,getScaling:()=>U$1,getRotation:()=>S66,frustum:()=>h66,fromZRotation:()=>E66,fromYRotation:()=>k66,fromXRotation:()=>T66,fromValues:()=>V66,fromTranslation:()=>P66,fromScaling:()=>D66,fromRotationTranslationScaleOrigin:()=>A66,fromRotationTranslationScale:()=>_66,fromRotationTranslation:()=>F$1,fromRotation:()=>C66,fromQuat2:()=>I66,fromQuat:()=>x66,frob:()=>l66,exactEquals:()=>a66,equals:()=>s66,determinant:()=>w66,create:()=>G66,copy:()=>H66,clone:()=>z66,adjoint:()=>L66,add:()=>p66});function G66(){var Z=new Y1(16);if(Y1!=Float32Array)Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0;return Z[0]=1,Z[5]=1,Z[10]=1,Z[15]=1,Z}function z66(Z){var J=new Y1(16);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J[4]=Z[4],J[5]=Z[5],J[6]=Z[6],J[7]=Z[7],J[8]=Z[8],J[9]=Z[9],J[10]=Z[10],J[11]=Z[11],J[12]=Z[12],J[13]=Z[13],J[14]=Z[14],J[15]=Z[15],J}function H66(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z[4]=J[4],Z[5]=J[5],Z[6]=J[6],Z[7]=J[7],Z[8]=J[8],Z[9]=J[9],Z[10]=J[10],Z[11]=J[11],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15],Z}function V66(Z,J,$,Y,Q,W,X,K,G,z,H,V,q,F,U,w){var L=new Y1(16);return L[0]=Z,L[1]=J,L[2]=$,L[3]=Y,L[4]=Q,L[5]=W,L[6]=X,L[7]=K,L[8]=G,L[9]=z,L[10]=H,L[11]=V,L[12]=q,L[13]=F,L[14]=U,L[15]=w,L}function q66(Z,J,$,Y,Q,W,X,K,G,z,H,V,q,F,U,w,L){return Z[0]=J,Z[1]=$,Z[2]=Y,Z[3]=Q,Z[4]=W,Z[5]=X,Z[6]=K,Z[7]=G,Z[8]=z,Z[9]=H,Z[10]=V,Z[11]=q,Z[12]=F,Z[13]=U,Z[14]=w,Z[15]=L,Z}function V$1(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=1,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=1,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function F66(Z,J){if(Z===J){var $=J[1],Y=J[2],Q=J[3],W=J[6],X=J[7],K=J[11];Z[1]=J[4],Z[2]=J[8],Z[3]=J[12],Z[4]=$,Z[6]=J[9],Z[7]=J[13],Z[8]=Y,Z[9]=W,Z[11]=J[14],Z[12]=Q,Z[13]=X,Z[14]=K}else Z[0]=J[0],Z[1]=J[4],Z[2]=J[8],Z[3]=J[12],Z[4]=J[1],Z[5]=J[5],Z[6]=J[9],Z[7]=J[13],Z[8]=J[2],Z[9]=J[6],Z[10]=J[10],Z[11]=J[14],Z[12]=J[3],Z[13]=J[7],Z[14]=J[11],Z[15]=J[15];return Z}function U66(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],O=J[15],j=$*K-Y*X,M=$*G-Q*X,N=$*z-W*X,D=Y*G-Q*K,P=Y*z-W*K,C=Q*z-W*G,T=H*w-V*U,E=H*L-q*U,A=H*O-F*U,S=V*L-q*w,x=V*O-F*w,I=q*O-F*L,v=j*I-M*x+N*S+D*A-P*E+C*T;if(!v)return null;return v=1/v,Z[0]=(K*I-G*x+z*S)*v,Z[1]=(Q*x-Y*I-W*S)*v,Z[2]=(w*C-L*P+O*D)*v,Z[3]=(q*P-V*C-F*D)*v,Z[4]=(G*A-X*I-z*E)*v,Z[5]=($*I-Q*A+W*E)*v,Z[6]=(L*N-U*C-O*M)*v,Z[7]=(H*C-q*N+F*M)*v,Z[8]=(X*x-K*A+z*T)*v,Z[9]=(Y*A-$*x-W*T)*v,Z[10]=(U*P-w*N+O*j)*v,Z[11]=(V*N-H*P-F*j)*v,Z[12]=(K*E-X*S-G*T)*v,Z[13]=($*S-Y*E+Q*T)*v,Z[14]=(w*M-U*D-L*j)*v,Z[15]=(H*D-V*M+q*j)*v,Z}function L66(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],O=J[15];return Z[0]=K*(q*O-F*L)-V*(G*O-z*L)+w*(G*F-z*q),Z[1]=-(Y*(q*O-F*L)-V*(Q*O-W*L)+w*(Q*F-W*q)),Z[2]=Y*(G*O-z*L)-K*(Q*O-W*L)+w*(Q*z-W*G),Z[3]=-(Y*(G*F-z*q)-K*(Q*F-W*q)+V*(Q*z-W*G)),Z[4]=-(X*(q*O-F*L)-H*(G*O-z*L)+U*(G*F-z*q)),Z[5]=$*(q*O-F*L)-H*(Q*O-W*L)+U*(Q*F-W*q),Z[6]=-($*(G*O-z*L)-X*(Q*O-W*L)+U*(Q*z-W*G)),Z[7]=$*(G*F-z*q)-X*(Q*F-W*q)+H*(Q*z-W*G),Z[8]=X*(V*O-F*w)-H*(K*O-z*w)+U*(K*F-z*V),Z[9]=-($*(V*O-F*w)-H*(Y*O-W*w)+U*(Y*F-W*V)),Z[10]=$*(K*O-z*w)-X*(Y*O-W*w)+U*(Y*z-W*K),Z[11]=-($*(K*F-z*V)-X*(Y*F-W*V)+H*(Y*z-W*K)),Z[12]=-(X*(V*L-q*w)-H*(K*L-G*w)+U*(K*q-G*V)),Z[13]=$*(V*L-q*w)-H*(Y*L-Q*w)+U*(Y*q-Q*V),Z[14]=-($*(K*L-G*w)-X*(Y*L-Q*w)+U*(Y*G-Q*K)),Z[15]=$*(K*q-G*V)-X*(Y*q-Q*V)+H*(Y*G-Q*K),Z}function w66(Z){var J=Z[0],$=Z[1],Y=Z[2],Q=Z[3],W=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],H=Z[9],V=Z[10],q=Z[11],F=Z[12],U=Z[13],w=Z[14],L=Z[15],O=J*X-$*W,j=J*K-Y*W,M=J*G-Q*W,N=$*K-Y*X,D=$*G-Q*X,P=Y*G-Q*K,C=z*U-H*F,T=z*w-V*F,E=z*L-q*F,A=H*w-V*U,S=H*L-q*U,x=V*L-q*w;return O*x-j*S+M*A+N*E-D*T+P*C}function q$1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=J[9],F=J[10],U=J[11],w=J[12],L=J[13],O=J[14],j=J[15],M=$[0],N=$[1],D=$[2],P=$[3];return Z[0]=M*Y+N*K+D*V+P*w,Z[1]=M*Q+N*G+D*q+P*L,Z[2]=M*W+N*z+D*F+P*O,Z[3]=M*X+N*H+D*U+P*j,M=$[4],N=$[5],D=$[6],P=$[7],Z[4]=M*Y+N*K+D*V+P*w,Z[5]=M*Q+N*G+D*q+P*L,Z[6]=M*W+N*z+D*F+P*O,Z[7]=M*X+N*H+D*U+P*j,M=$[8],N=$[9],D=$[10],P=$[11],Z[8]=M*Y+N*K+D*V+P*w,Z[9]=M*Q+N*G+D*q+P*L,Z[10]=M*W+N*z+D*F+P*O,Z[11]=M*X+N*H+D*U+P*j,M=$[12],N=$[13],D=$[14],P=$[15],Z[12]=M*Y+N*K+D*V+P*w,Z[13]=M*Q+N*G+D*q+P*L,Z[14]=M*W+N*z+D*F+P*O,Z[15]=M*X+N*H+D*U+P*j,Z}function B66(Z,J,$){var Y=$[0],Q=$[1],W=$[2],X,K,G,z,H,V,q,F,U,w,L,O;if(J===Z)Z[12]=J[0]*Y+J[4]*Q+J[8]*W+J[12],Z[13]=J[1]*Y+J[5]*Q+J[9]*W+J[13],Z[14]=J[2]*Y+J[6]*Q+J[10]*W+J[14],Z[15]=J[3]*Y+J[7]*Q+J[11]*W+J[15];else X=J[0],K=J[1],G=J[2],z=J[3],H=J[4],V=J[5],q=J[6],F=J[7],U=J[8],w=J[9],L=J[10],O=J[11],Z[0]=X,Z[1]=K,Z[2]=G,Z[3]=z,Z[4]=H,Z[5]=V,Z[6]=q,Z[7]=F,Z[8]=U,Z[9]=w,Z[10]=L,Z[11]=O,Z[12]=X*Y+H*Q+U*W+J[12],Z[13]=K*Y+V*Q+w*W+J[13],Z[14]=G*Y+q*Q+L*W+J[14],Z[15]=z*Y+F*Q+O*W+J[15];return Z}function O66(Z,J,$){var Y=$[0],Q=$[1],W=$[2];return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z[2]=J[2]*Y,Z[3]=J[3]*Y,Z[4]=J[4]*Q,Z[5]=J[5]*Q,Z[6]=J[6]*Q,Z[7]=J[7]*Q,Z[8]=J[8]*W,Z[9]=J[9]*W,Z[10]=J[10]*W,Z[11]=J[11]*W,Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15],Z}function j66(Z,J,$,Y){var Q=Y[0],W=Y[1],X=Y[2],K=Math.hypot(Q,W,X),G,z,H,V,q,F,U,w,L,O,j,M,N,D,P,C,T,E,A,S,x,I,v,f;if(K<P0)return null;if(K=1/K,Q*=K,W*=K,X*=K,G=Math.sin($),z=Math.cos($),H=1-z,V=J[0],q=J[1],F=J[2],U=J[3],w=J[4],L=J[5],O=J[6],j=J[7],M=J[8],N=J[9],D=J[10],P=J[11],C=Q*Q*H+z,T=W*Q*H+X*G,E=X*Q*H-W*G,A=Q*W*H-X*G,S=W*W*H+z,x=X*W*H+Q*G,I=Q*X*H+W*G,v=W*X*H-Q*G,f=X*X*H+z,Z[0]=V*C+w*T+M*E,Z[1]=q*C+L*T+N*E,Z[2]=F*C+O*T+D*E,Z[3]=U*C+j*T+P*E,Z[4]=V*A+w*S+M*x,Z[5]=q*A+L*S+N*x,Z[6]=F*A+O*S+D*x,Z[7]=U*A+j*S+P*x,Z[8]=V*I+w*v+M*f,Z[9]=q*I+L*v+N*f,Z[10]=F*I+O*v+D*f,Z[11]=U*I+j*v+P*f,J!==Z)Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z}function M66(Z,J,$){var Y=Math.sin($),Q=Math.cos($),W=J[4],X=J[5],K=J[6],G=J[7],z=J[8],H=J[9],V=J[10],q=J[11];if(J!==Z)Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[4]=W*Q+z*Y,Z[5]=X*Q+H*Y,Z[6]=K*Q+V*Y,Z[7]=G*Q+q*Y,Z[8]=z*Q-W*Y,Z[9]=H*Q-X*Y,Z[10]=V*Q-K*Y,Z[11]=q*Q-G*Y,Z}function R66(Z,J,$){var Y=Math.sin($),Q=Math.cos($),W=J[0],X=J[1],K=J[2],G=J[3],z=J[8],H=J[9],V=J[10],q=J[11];if(J!==Z)Z[4]=J[4],Z[5]=J[5],Z[6]=J[6],Z[7]=J[7],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[0]=W*Q-z*Y,Z[1]=X*Q-H*Y,Z[2]=K*Q-V*Y,Z[3]=G*Q-q*Y,Z[8]=W*Y+z*Q,Z[9]=X*Y+H*Q,Z[10]=K*Y+V*Q,Z[11]=G*Y+q*Q,Z}function N66(Z,J,$){var Y=Math.sin($),Q=Math.cos($),W=J[0],X=J[1],K=J[2],G=J[3],z=J[4],H=J[5],V=J[6],q=J[7];if(J!==Z)Z[8]=J[8],Z[9]=J[9],Z[10]=J[10],Z[11]=J[11],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[0]=W*Q+z*Y,Z[1]=X*Q+H*Y,Z[2]=K*Q+V*Y,Z[3]=G*Q+q*Y,Z[4]=z*Q-W*Y,Z[5]=H*Q-X*Y,Z[6]=V*Q-K*Y,Z[7]=q*Q-G*Y,Z}function P66(Z,J){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=1,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=1,Z[11]=0,Z[12]=J[0],Z[13]=J[1],Z[14]=J[2],Z[15]=1,Z}function D66(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=J[1],Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=J[2],Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function C66(Z,J,$){var Y=$[0],Q=$[1],W=$[2],X=Math.hypot(Y,Q,W),K,G,z;if(X<P0)return null;return X=1/X,Y*=X,Q*=X,W*=X,K=Math.sin(J),G=Math.cos(J),z=1-G,Z[0]=Y*Y*z+G,Z[1]=Q*Y*z+W*K,Z[2]=W*Y*z-Q*K,Z[3]=0,Z[4]=Y*Q*z-W*K,Z[5]=Q*Q*z+G,Z[6]=W*Q*z+Y*K,Z[7]=0,Z[8]=Y*W*z+Q*K,Z[9]=Q*W*z-Y*K,Z[10]=W*W*z+G,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function T66(Z,J){var $=Math.sin(J),Y=Math.cos(J);return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=Y,Z[6]=$,Z[7]=0,Z[8]=0,Z[9]=-$,Z[10]=Y,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function k66(Z,J){var $=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=0,Z[2]=-$,Z[3]=0,Z[4]=0,Z[5]=1,Z[6]=0,Z[7]=0,Z[8]=$,Z[9]=0,Z[10]=Y,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function E66(Z,J){var $=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=$,Z[2]=0,Z[3]=0,Z[4]=-$,Z[5]=Y,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=1,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function F$1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=Y+Y,G=Q+Q,z=W+W,H=Y*K,V=Y*G,q=Y*z,F=Q*G,U=Q*z,w=W*z,L=X*K,O=X*G,j=X*z;return Z[0]=1-(F+w),Z[1]=V+j,Z[2]=q-O,Z[3]=0,Z[4]=V-j,Z[5]=1-(H+w),Z[6]=U+L,Z[7]=0,Z[8]=q+O,Z[9]=U-L,Z[10]=1-(H+F),Z[11]=0,Z[12]=$[0],Z[13]=$[1],Z[14]=$[2],Z[15]=1,Z}function I66(Z,J){var $=new Y1(3),Y=-J[0],Q=-J[1],W=-J[2],X=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=Y*Y+Q*Q+W*W+X*X;if(V>0)$[0]=(K*X+H*Y+G*W-z*Q)*2/V,$[1]=(G*X+H*Q+z*Y-K*W)*2/V,$[2]=(z*X+H*W+K*Q-G*Y)*2/V;else $[0]=(K*X+H*Y+G*W-z*Q)*2,$[1]=(G*X+H*Q+z*Y-K*W)*2,$[2]=(z*X+H*W+K*Q-G*Y)*2;return F$1(Z,J,$),Z}function v66(Z,J){return Z[0]=J[12],Z[1]=J[13],Z[2]=J[14],Z}function U$1(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[4],X=J[5],K=J[6],G=J[8],z=J[9],H=J[10];return Z[0]=Math.hypot($,Y,Q),Z[1]=Math.hypot(W,X,K),Z[2]=Math.hypot(G,z,H),Z}function S66(Z,J){var $=new Y1(3);U$1($,J);var Y=1/$[0],Q=1/$[1],W=1/$[2],X=J[0]*Y,K=J[1]*Q,G=J[2]*W,z=J[4]*Y,H=J[5]*Q,V=J[6]*W,q=J[8]*Y,F=J[9]*Q,U=J[10]*W,w=X+H+U,L=0;if(w>0)L=Math.sqrt(w+1)*2,Z[3]=0.25*L,Z[0]=(V-F)/L,Z[1]=(q-G)/L,Z[2]=(K-z)/L;else if(X>H&&X>U)L=Math.sqrt(1+X-H-U)*2,Z[3]=(V-F)/L,Z[0]=0.25*L,Z[1]=(K+z)/L,Z[2]=(q+G)/L;else if(H>U)L=Math.sqrt(1+H-X-U)*2,Z[3]=(q-G)/L,Z[0]=(K+z)/L,Z[1]=0.25*L,Z[2]=(V+F)/L;else L=Math.sqrt(1+U-X-H)*2,Z[3]=(K-z)/L,Z[0]=(q+G)/L,Z[1]=(V+F)/L,Z[2]=0.25*L;return Z}function _66(Z,J,$,Y){var Q=J[0],W=J[1],X=J[2],K=J[3],G=Q+Q,z=W+W,H=X+X,V=Q*G,q=Q*z,F=Q*H,U=W*z,w=W*H,L=X*H,O=K*G,j=K*z,M=K*H,N=Y[0],D=Y[1],P=Y[2];return Z[0]=(1-(U+L))*N,Z[1]=(q+M)*N,Z[2]=(F-j)*N,Z[3]=0,Z[4]=(q-M)*D,Z[5]=(1-(V+L))*D,Z[6]=(w+O)*D,Z[7]=0,Z[8]=(F+j)*P,Z[9]=(w-O)*P,Z[10]=(1-(V+U))*P,Z[11]=0,Z[12]=$[0],Z[13]=$[1],Z[14]=$[2],Z[15]=1,Z}function A66(Z,J,$,Y,Q){var W=J[0],X=J[1],K=J[2],G=J[3],z=W+W,H=X+X,V=K+K,q=W*z,F=W*H,U=W*V,w=X*H,L=X*V,O=K*V,j=G*z,M=G*H,N=G*V,D=Y[0],P=Y[1],C=Y[2],T=Q[0],E=Q[1],A=Q[2],S=(1-(w+O))*D,x=(F+N)*D,I=(U-M)*D,v=(F-N)*P,f=(1-(q+O))*P,p=(L+j)*P,n=(U+M)*C,o=(L-j)*C,$0=(1-(q+w))*C;return Z[0]=S,Z[1]=x,Z[2]=I,Z[3]=0,Z[4]=v,Z[5]=f,Z[6]=p,Z[7]=0,Z[8]=n,Z[9]=o,Z[10]=$0,Z[11]=0,Z[12]=$[0]+T-(S*T+v*E+n*A),Z[13]=$[1]+E-(x*T+f*E+o*A),Z[14]=$[2]+A-(I*T+p*E+$0*A),Z[15]=1,Z}function x66(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=$+$,K=Y+Y,G=Q+Q,z=$*X,H=Y*X,V=Y*K,q=Q*X,F=Q*K,U=Q*G,w=W*X,L=W*K,O=W*G;return Z[0]=1-V-U,Z[1]=H+O,Z[2]=q-L,Z[3]=0,Z[4]=H-O,Z[5]=1-z-U,Z[6]=F+w,Z[7]=0,Z[8]=q+L,Z[9]=F-w,Z[10]=1-z-V,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function h66(Z,J,$,Y,Q,W,X){var K=1/($-J),G=1/(Q-Y),z=1/(W-X);return Z[0]=W*2*K,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=W*2*G,Z[6]=0,Z[7]=0,Z[8]=($+J)*K,Z[9]=(Q+Y)*G,Z[10]=(X+W)*z,Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=X*W*2*z,Z[15]=0,Z}function L$1(Z,J,$,Y,Q){var W=1/Math.tan(J/2),X;if(Z[0]=W/$,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=W,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[11]=-1,Z[12]=0,Z[13]=0,Z[15]=0,Q!=null&&Q!==1/0)X=1/(Y-Q),Z[10]=(Q+Y)*X,Z[14]=2*Q*Y*X;else Z[10]=-1,Z[14]=-2*Y;return Z}var f66=L$1;function b66(Z,J,$,Y,Q){var W=1/Math.tan(J/2),X;if(Z[0]=W/$,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=W,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[11]=-1,Z[12]=0,Z[13]=0,Z[15]=0,Q!=null&&Q!==1/0)X=1/(Y-Q),Z[10]=Q*X,Z[14]=Q*Y*X;else Z[10]=-1,Z[14]=-Y;return Z}function y66(Z,J,$,Y){var Q=Math.tan(J.upDegrees*Math.PI/180),W=Math.tan(J.downDegrees*Math.PI/180),X=Math.tan(J.leftDegrees*Math.PI/180),K=Math.tan(J.rightDegrees*Math.PI/180),G=2/(X+K),z=2/(Q+W);return Z[0]=G,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=z,Z[6]=0,Z[7]=0,Z[8]=-((X-K)*G*0.5),Z[9]=(Q-W)*z*0.5,Z[10]=Y/($-Y),Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=Y*$/($-Y),Z[15]=0,Z}function w$1(Z,J,$,Y,Q,W,X){var K=1/(J-$),G=1/(Y-Q),z=1/(W-X);return Z[0]=-2*K,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=-2*G,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=2*z,Z[11]=0,Z[12]=(J+$)*K,Z[13]=(Q+Y)*G,Z[14]=(X+W)*z,Z[15]=1,Z}var g66=w$1;function m66(Z,J,$,Y,Q,W,X){var K=1/(J-$),G=1/(Y-Q),z=1/(W-X);return Z[0]=-2*K,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=-2*G,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=z,Z[11]=0,Z[12]=(J+$)*K,Z[13]=(Q+Y)*G,Z[14]=W*z,Z[15]=1,Z}function u66(Z,J,$,Y){var Q,W,X,K,G,z,H,V,q,F,U=J[0],w=J[1],L=J[2],O=Y[0],j=Y[1],M=Y[2],N=$[0],D=$[1],P=$[2];if(Math.abs(U-N)<P0&&Math.abs(w-D)<P0&&Math.abs(L-P)<P0)return V$1(Z);if(H=U-N,V=w-D,q=L-P,F=1/Math.hypot(H,V,q),H*=F,V*=F,q*=F,Q=j*q-M*V,W=M*H-O*q,X=O*V-j*H,F=Math.hypot(Q,W,X),!F)Q=0,W=0,X=0;else F=1/F,Q*=F,W*=F,X*=F;if(K=V*X-q*W,G=q*Q-H*X,z=H*W-V*Q,F=Math.hypot(K,G,z),!F)K=0,G=0,z=0;else F=1/F,K*=F,G*=F,z*=F;return Z[0]=Q,Z[1]=K,Z[2]=H,Z[3]=0,Z[4]=W,Z[5]=G,Z[6]=V,Z[7]=0,Z[8]=X,Z[9]=z,Z[10]=q,Z[11]=0,Z[12]=-(Q*U+W*w+X*L),Z[13]=-(K*U+G*w+z*L),Z[14]=-(H*U+V*w+q*L),Z[15]=1,Z}function d66(Z,J,$,Y){var Q=J[0],W=J[1],X=J[2],K=Y[0],G=Y[1],z=Y[2],H=Q-$[0],V=W-$[1],q=X-$[2],F=H*H+V*V+q*q;if(F>0)F=1/Math.sqrt(F),H*=F,V*=F,q*=F;var U=G*q-z*V,w=z*H-K*q,L=K*V-G*H;if(F=U*U+w*w+L*L,F>0)F=1/Math.sqrt(F),U*=F,w*=F,L*=F;return Z[0]=U,Z[1]=w,Z[2]=L,Z[3]=0,Z[4]=V*L-q*w,Z[5]=q*U-H*L,Z[6]=H*w-V*U,Z[7]=0,Z[8]=H,Z[9]=V,Z[10]=q,Z[11]=0,Z[12]=Q,Z[13]=W,Z[14]=X,Z[15]=1,Z}function c66(Z){return"mat4("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+", "+Z[9]+", "+Z[10]+", "+Z[11]+", "+Z[12]+", "+Z[13]+", "+Z[14]+", "+Z[15]+")"}function l66(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8],Z[9],Z[10],Z[11],Z[12],Z[13],Z[14],Z[15])}function p66(Z,J,$){return Z[0]=J[0]+$[0],Z[1]=J[1]+$[1],Z[2]=J[2]+$[2],Z[3]=J[3]+$[3],Z[4]=J[4]+$[4],Z[5]=J[5]+$[5],Z[6]=J[6]+$[6],Z[7]=J[7]+$[7],Z[8]=J[8]+$[8],Z[9]=J[9]+$[9],Z[10]=J[10]+$[10],Z[11]=J[11]+$[11],Z[12]=J[12]+$[12],Z[13]=J[13]+$[13],Z[14]=J[14]+$[14],Z[15]=J[15]+$[15],Z}function B$1(Z,J,$){return Z[0]=J[0]-$[0],Z[1]=J[1]-$[1],Z[2]=J[2]-$[2],Z[3]=J[3]-$[3],Z[4]=J[4]-$[4],Z[5]=J[5]-$[5],Z[6]=J[6]-$[6],Z[7]=J[7]-$[7],Z[8]=J[8]-$[8],Z[9]=J[9]-$[9],Z[10]=J[10]-$[10],Z[11]=J[11]-$[11],Z[12]=J[12]-$[12],Z[13]=J[13]-$[13],Z[14]=J[14]-$[14],Z[15]=J[15]-$[15],Z}function i66(Z,J,$){return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z[3]=J[3]*$,Z[4]=J[4]*$,Z[5]=J[5]*$,Z[6]=J[6]*$,Z[7]=J[7]*$,Z[8]=J[8]*$,Z[9]=J[9]*$,Z[10]=J[10]*$,Z[11]=J[11]*$,Z[12]=J[12]*$,Z[13]=J[13]*$,Z[14]=J[14]*$,Z[15]=J[15]*$,Z}function n66(Z,J,$,Y){return Z[0]=J[0]+$[0]*Y,Z[1]=J[1]+$[1]*Y,Z[2]=J[2]+$[2]*Y,Z[3]=J[3]+$[3]*Y,Z[4]=J[4]+$[4]*Y,Z[5]=J[5]+$[5]*Y,Z[6]=J[6]+$[6]*Y,Z[7]=J[7]+$[7]*Y,Z[8]=J[8]+$[8]*Y,Z[9]=J[9]+$[9]*Y,Z[10]=J[10]+$[10]*Y,Z[11]=J[11]+$[11]*Y,Z[12]=J[12]+$[12]*Y,Z[13]=J[13]+$[13]*Y,Z[14]=J[14]+$[14]*Y,Z[15]=J[15]+$[15]*Y,Z}function a66(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]&&Z[4]===J[4]&&Z[5]===J[5]&&Z[6]===J[6]&&Z[7]===J[7]&&Z[8]===J[8]&&Z[9]===J[9]&&Z[10]===J[10]&&Z[11]===J[11]&&Z[12]===J[12]&&Z[13]===J[13]&&Z[14]===J[14]&&Z[15]===J[15]}function s66(Z,J){var $=Z[0],Y=Z[1],Q=Z[2],W=Z[3],X=Z[4],K=Z[5],G=Z[6],z=Z[7],H=Z[8],V=Z[9],q=Z[10],F=Z[11],U=Z[12],w=Z[13],L=Z[14],O=Z[15],j=J[0],M=J[1],N=J[2],D=J[3],P=J[4],C=J[5],T=J[6],E=J[7],A=J[8],S=J[9],x=J[10],I=J[11],v=J[12],f=J[13],p=J[14],n=J[15];return Math.abs($-j)<=P0*Math.max(1,Math.abs($),Math.abs(j))&&Math.abs(Y-M)<=P0*Math.max(1,Math.abs(Y),Math.abs(M))&&Math.abs(Q-N)<=P0*Math.max(1,Math.abs(Q),Math.abs(N))&&Math.abs(W-D)<=P0*Math.max(1,Math.abs(W),Math.abs(D))&&Math.abs(X-P)<=P0*Math.max(1,Math.abs(X),Math.abs(P))&&Math.abs(K-C)<=P0*Math.max(1,Math.abs(K),Math.abs(C))&&Math.abs(G-T)<=P0*Math.max(1,Math.abs(G),Math.abs(T))&&Math.abs(z-E)<=P0*Math.max(1,Math.abs(z),Math.abs(E))&&Math.abs(H-A)<=P0*Math.max(1,Math.abs(H),Math.abs(A))&&Math.abs(V-S)<=P0*Math.max(1,Math.abs(V),Math.abs(S))&&Math.abs(q-x)<=P0*Math.max(1,Math.abs(q),Math.abs(x))&&Math.abs(F-I)<=P0*Math.max(1,Math.abs(F),Math.abs(I))&&Math.abs(U-v)<=P0*Math.max(1,Math.abs(U),Math.abs(v))&&Math.abs(w-f)<=P0*Math.max(1,Math.abs(w),Math.abs(f))&&Math.abs(L-p)<=P0*Math.max(1,Math.abs(L),Math.abs(p))&&Math.abs(O-n)<=P0*Math.max(1,Math.abs(O),Math.abs(n))}var o66=q$1,r66=B$1;var R1={};$4(R1,{str:()=>n56,squaredLength:()=>i$1,sqrLen:()=>$96,sqlerp:()=>X96,slerp:()=>IM,setAxisAngle:()=>y$1,setAxes:()=>K96,set:()=>r56,scale:()=>c$1,rotationTo:()=>W96,rotateZ:()=>m56,rotateY:()=>g56,rotateX:()=>y56,random:()=>c56,pow:()=>d56,normalize:()=>$b,multiply:()=>g$1,mul:()=>e56,ln:()=>u$1,lerp:()=>Z96,length:()=>p$1,len:()=>J96,invert:()=>l56,identity:()=>h56,getAxisAngle:()=>f56,getAngle:()=>b56,fromValues:()=>s56,fromMat3:()=>d$1,fromEuler:()=>i56,exp:()=>m$1,exactEquals:()=>Y96,equals:()=>Q96,dot:()=>l$1,create:()=>Jb,copy:()=>o56,conjugate:()=>p56,clone:()=>a56,calculateW:()=>u56,add:()=>t56});var t0={};$4(t0,{zero:()=>N56,transformQuat:()=>B56,transformMat4:()=>L56,transformMat3:()=>w56,subtract:()=>j$1,sub:()=>T56,str:()=>P56,squaredLength:()=>D$1,squaredDistance:()=>P$1,sqrLen:()=>S56,sqrDist:()=>v56,set:()=>Z56,scaleAndAdd:()=>G56,scale:()=>K56,round:()=>X56,rotateZ:()=>M56,rotateY:()=>j56,rotateX:()=>O56,random:()=>U56,normalize:()=>ef,negate:()=>z56,multiply:()=>M$1,mul:()=>k56,min:()=>Q56,max:()=>W56,lerp:()=>V56,length:()=>O$1,len:()=>Zb,inverse:()=>H56,hermite:()=>q56,fromValues:()=>kM,forEach:()=>_56,floor:()=>Y56,exactEquals:()=>D56,equals:()=>C56,dot:()=>EM,divide:()=>R$1,div:()=>E56,distance:()=>N$1,dist:()=>I56,cross:()=>lq,create:()=>TM,copy:()=>e66,clone:()=>t66,ceil:()=>$56,bezier:()=>F56,angle:()=>R56,add:()=>J56});function TM(){var Z=new Y1(3);if(Y1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function t66(Z){var J=new Y1(3);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J}function O$1(Z){var J=Z[0],$=Z[1],Y=Z[2];return Math.hypot(J,$,Y)}function kM(Z,J,$){var Y=new Y1(3);return Y[0]=Z,Y[1]=J,Y[2]=$,Y}function e66(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z}function Z56(Z,J,$,Y){return Z[0]=J,Z[1]=$,Z[2]=Y,Z}function J56(Z,J,$){return Z[0]=J[0]+$[0],Z[1]=J[1]+$[1],Z[2]=J[2]+$[2],Z}function j$1(Z,J,$){return Z[0]=J[0]-$[0],Z[1]=J[1]-$[1],Z[2]=J[2]-$[2],Z}function M$1(Z,J,$){return Z[0]=J[0]*$[0],Z[1]=J[1]*$[1],Z[2]=J[2]*$[2],Z}function R$1(Z,J,$){return Z[0]=J[0]/$[0],Z[1]=J[1]/$[1],Z[2]=J[2]/$[2],Z}function $56(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z[2]=Math.ceil(J[2]),Z}function Y56(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z[2]=Math.floor(J[2]),Z}function Q56(Z,J,$){return Z[0]=Math.min(J[0],$[0]),Z[1]=Math.min(J[1],$[1]),Z[2]=Math.min(J[2],$[2]),Z}function W56(Z,J,$){return Z[0]=Math.max(J[0],$[0]),Z[1]=Math.max(J[1],$[1]),Z[2]=Math.max(J[2],$[2]),Z}function X56(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z[2]=Math.round(J[2]),Z}function K56(Z,J,$){return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z}function G56(Z,J,$,Y){return Z[0]=J[0]+$[0]*Y,Z[1]=J[1]+$[1]*Y,Z[2]=J[2]+$[2]*Y,Z}function N$1(Z,J){var $=J[0]-Z[0],Y=J[1]-Z[1],Q=J[2]-Z[2];return Math.hypot($,Y,Q)}function P$1(Z,J){var $=J[0]-Z[0],Y=J[1]-Z[1],Q=J[2]-Z[2];return $*$+Y*Y+Q*Q}function D$1(Z){var J=Z[0],$=Z[1],Y=Z[2];return J*J+$*$+Y*Y}function z56(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z}function H56(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z[2]=1/J[2],Z}function ef(Z,J){var $=J[0],Y=J[1],Q=J[2],W=$*$+Y*Y+Q*Q;if(W>0)W=1/Math.sqrt(W);return Z[0]=J[0]*W,Z[1]=J[1]*W,Z[2]=J[2]*W,Z}function EM(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]}function lq(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=$[0],K=$[1],G=$[2];return Z[0]=Q*G-W*K,Z[1]=W*X-Y*G,Z[2]=Y*K-Q*X,Z}function V56(Z,J,$,Y){var Q=J[0],W=J[1],X=J[2];return Z[0]=Q+Y*($[0]-Q),Z[1]=W+Y*($[1]-W),Z[2]=X+Y*($[2]-X),Z}function q56(Z,J,$,Y,Q,W){var X=W*W,K=X*(2*W-3)+1,G=X*(W-2)+W,z=X*(W-1),H=X*(3-2*W);return Z[0]=J[0]*K+$[0]*G+Y[0]*z+Q[0]*H,Z[1]=J[1]*K+$[1]*G+Y[1]*z+Q[1]*H,Z[2]=J[2]*K+$[2]*G+Y[2]*z+Q[2]*H,Z}function F56(Z,J,$,Y,Q,W){var X=1-W,K=X*X,G=W*W,z=K*X,H=3*W*K,V=3*G*X,q=G*W;return Z[0]=J[0]*z+$[0]*H+Y[0]*V+Q[0]*q,Z[1]=J[1]*z+$[1]*H+Y[1]*V+Q[1]*q,Z[2]=J[2]*z+$[2]*H+Y[2]*V+Q[2]*q,Z}function U56(Z,J){J=J||1;var $=c7()*2*Math.PI,Y=c7()*2-1,Q=Math.sqrt(1-Y*Y)*J;return Z[0]=Math.cos($)*Q,Z[1]=Math.sin($)*Q,Z[2]=Y*J,Z}function L56(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=$[3]*Y+$[7]*Q+$[11]*W+$[15];return X=X||1,Z[0]=($[0]*Y+$[4]*Q+$[8]*W+$[12])/X,Z[1]=($[1]*Y+$[5]*Q+$[9]*W+$[13])/X,Z[2]=($[2]*Y+$[6]*Q+$[10]*W+$[14])/X,Z}function w56(Z,J,$){var Y=J[0],Q=J[1],W=J[2];return Z[0]=Y*$[0]+Q*$[3]+W*$[6],Z[1]=Y*$[1]+Q*$[4]+W*$[7],Z[2]=Y*$[2]+Q*$[5]+W*$[8],Z}function B56(Z,J,$){var Y=$[0],Q=$[1],W=$[2],X=$[3],K=J[0],G=J[1],z=J[2],H=Q*z-W*G,V=W*K-Y*z,q=Y*G-Q*K,F=Q*q-W*V,U=W*H-Y*q,w=Y*V-Q*H,L=X*2;return H*=L,V*=L,q*=L,F*=2,U*=2,w*=2,Z[0]=K+H+F,Z[1]=G+V+U,Z[2]=z+q+w,Z}function O56(Z,J,$,Y){var Q=[],W=[];return Q[0]=J[0]-$[0],Q[1]=J[1]-$[1],Q[2]=J[2]-$[2],W[0]=Q[0],W[1]=Q[1]*Math.cos(Y)-Q[2]*Math.sin(Y),W[2]=Q[1]*Math.sin(Y)+Q[2]*Math.cos(Y),Z[0]=W[0]+$[0],Z[1]=W[1]+$[1],Z[2]=W[2]+$[2],Z}function j56(Z,J,$,Y){var Q=[],W=[];return Q[0]=J[0]-$[0],Q[1]=J[1]-$[1],Q[2]=J[2]-$[2],W[0]=Q[2]*Math.sin(Y)+Q[0]*Math.cos(Y),W[1]=Q[1],W[2]=Q[2]*Math.cos(Y)-Q[0]*Math.sin(Y),Z[0]=W[0]+$[0],Z[1]=W[1]+$[1],Z[2]=W[2]+$[2],Z}function M56(Z,J,$,Y){var Q=[],W=[];return Q[0]=J[0]-$[0],Q[1]=J[1]-$[1],Q[2]=J[2]-$[2],W[0]=Q[0]*Math.cos(Y)-Q[1]*Math.sin(Y),W[1]=Q[0]*Math.sin(Y)+Q[1]*Math.cos(Y),W[2]=Q[2],Z[0]=W[0]+$[0],Z[1]=W[1]+$[1],Z[2]=W[2]+$[2],Z}function R56(Z,J){var $=Z[0],Y=Z[1],Q=Z[2],W=J[0],X=J[1],K=J[2],G=Math.sqrt($*$+Y*Y+Q*Q),z=Math.sqrt(W*W+X*X+K*K),H=G*z,V=H&&EM(Z,J)/H;return Math.acos(Math.min(Math.max(V,-1),1))}function N56(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z}function P56(Z){return"vec3("+Z[0]+", "+Z[1]+", "+Z[2]+")"}function D56(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]}function C56(Z,J){var $=Z[0],Y=Z[1],Q=Z[2],W=J[0],X=J[1],K=J[2];return Math.abs($-W)<=P0*Math.max(1,Math.abs($),Math.abs(W))&&Math.abs(Y-X)<=P0*Math.max(1,Math.abs(Y),Math.abs(X))&&Math.abs(Q-K)<=P0*Math.max(1,Math.abs(Q),Math.abs(K))}var T56=j$1,k56=M$1,E56=R$1,I56=N$1,v56=P$1,Zb=O$1,S56=D$1,_56=function(){var Z=TM();return function(J,$,Y,Q,W,X){var K,G;if(!$)$=3;if(!Y)Y=0;if(Q)G=Math.min(Q*$+Y,J.length);else G=J.length;for(K=Y;K<G;K+=$)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],W(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}}();function A56(){var Z=new Y1(4);if(Y1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function C$1(Z){var J=new Y1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function T$1(Z,J,$,Y){var Q=new Y1(4);return Q[0]=Z,Q[1]=J,Q[2]=$,Q[3]=Y,Q}function k$1(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function E$1(Z,J,$,Y,Q){return Z[0]=J,Z[1]=$,Z[2]=Y,Z[3]=Q,Z}function I$1(Z,J,$){return Z[0]=J[0]+$[0],Z[1]=J[1]+$[1],Z[2]=J[2]+$[2],Z[3]=J[3]+$[3],Z}function v$1(Z,J,$){return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z[3]=J[3]*$,Z}function S$1(Z){var J=Z[0],$=Z[1],Y=Z[2],Q=Z[3];return Math.hypot(J,$,Y,Q)}function _$1(Z){var J=Z[0],$=Z[1],Y=Z[2],Q=Z[3];return J*J+$*$+Y*Y+Q*Q}function A$1(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=$*$+Y*Y+Q*Q+W*W;if(X>0)X=1/Math.sqrt(X);return Z[0]=$*X,Z[1]=Y*X,Z[2]=Q*X,Z[3]=W*X,Z}function x$1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}function h$1(Z,J,$,Y){var Q=J[0],W=J[1],X=J[2],K=J[3];return Z[0]=Q+Y*($[0]-Q),Z[1]=W+Y*($[1]-W),Z[2]=X+Y*($[2]-X),Z[3]=K+Y*($[3]-K),Z}function f$1(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function b$1(Z,J){var $=Z[0],Y=Z[1],Q=Z[2],W=Z[3],X=J[0],K=J[1],G=J[2],z=J[3];return Math.abs($-X)<=P0*Math.max(1,Math.abs($),Math.abs(X))&&Math.abs(Y-K)<=P0*Math.max(1,Math.abs(Y),Math.abs(K))&&Math.abs(Q-G)<=P0*Math.max(1,Math.abs(Q),Math.abs(G))&&Math.abs(W-z)<=P0*Math.max(1,Math.abs(W),Math.abs(z))}var ko6=function(){var Z=A56();return function(J,$,Y,Q,W,X){var K,G;if(!$)$=4;if(!Y)Y=0;if(Q)G=Math.min(Q*$+Y,J.length);else G=J.length;for(K=Y;K<G;K+=$)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Z[3]=J[K+3],W(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2],J[K+3]=Z[3];return J}}();function Jb(){var Z=new Y1(4);if(Y1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z[3]=1,Z}function h56(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=1,Z}function y$1(Z,J,$){$=$*0.5;var Y=Math.sin($);return Z[0]=Y*J[0],Z[1]=Y*J[1],Z[2]=Y*J[2],Z[3]=Math.cos($),Z}function f56(Z,J){var $=Math.acos(J[3])*2,Y=Math.sin($/2);if(Y>P0)Z[0]=J[0]/Y,Z[1]=J[1]/Y,Z[2]=J[2]/Y;else Z[0]=1,Z[1]=0,Z[2]=0;return $}function b56(Z,J){var $=l$1(Z,J);return Math.acos(2*$*$-1)}function g$1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=$[0],G=$[1],z=$[2],H=$[3];return Z[0]=Y*H+X*K+Q*z-W*G,Z[1]=Q*H+X*G+W*K-Y*z,Z[2]=W*H+X*z+Y*G-Q*K,Z[3]=X*H-Y*K-Q*G-W*z,Z}function y56(Z,J,$){$*=0.5;var Y=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin($),G=Math.cos($);return Z[0]=Y*G+X*K,Z[1]=Q*G+W*K,Z[2]=W*G-Q*K,Z[3]=X*G-Y*K,Z}function g56(Z,J,$){$*=0.5;var Y=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin($),G=Math.cos($);return Z[0]=Y*G-W*K,Z[1]=Q*G+X*K,Z[2]=W*G+Y*K,Z[3]=X*G-Q*K,Z}function m56(Z,J,$){$*=0.5;var Y=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin($),G=Math.cos($);return Z[0]=Y*G+Q*K,Z[1]=Q*G-Y*K,Z[2]=W*G+X*K,Z[3]=X*G-W*K,Z}function u56(Z,J){var $=J[0],Y=J[1],Q=J[2];return Z[0]=$,Z[1]=Y,Z[2]=Q,Z[3]=Math.sqrt(Math.abs(1-$*$-Y*Y-Q*Q)),Z}function m$1(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=Math.sqrt($*$+Y*Y+Q*Q),K=Math.exp(W),G=X>0?K*Math.sin(X)/X:0;return Z[0]=$*G,Z[1]=Y*G,Z[2]=Q*G,Z[3]=K*Math.cos(X),Z}function u$1(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=Math.sqrt($*$+Y*Y+Q*Q),K=X>0?Math.atan2(X,W)/X:0;return Z[0]=$*K,Z[1]=Y*K,Z[2]=Q*K,Z[3]=0.5*Math.log($*$+Y*Y+Q*Q+W*W),Z}function d56(Z,J,$){return u$1(Z,J),c$1(Z,Z,$),m$1(Z,Z),Z}function IM(Z,J,$,Y){var Q=J[0],W=J[1],X=J[2],K=J[3],G=$[0],z=$[1],H=$[2],V=$[3],q,F,U,w,L;if(F=Q*G+W*z+X*H+K*V,F<0)F=-F,G=-G,z=-z,H=-H,V=-V;if(1-F>P0)q=Math.acos(F),U=Math.sin(q),w=Math.sin((1-Y)*q)/U,L=Math.sin(Y*q)/U;else w=1-Y,L=Y;return Z[0]=w*Q+L*G,Z[1]=w*W+L*z,Z[2]=w*X+L*H,Z[3]=w*K+L*V,Z}function c56(Z){var J=c7(),$=c7(),Y=c7(),Q=Math.sqrt(1-J),W=Math.sqrt(J);return Z[0]=Q*Math.sin(2*Math.PI*$),Z[1]=Q*Math.cos(2*Math.PI*$),Z[2]=W*Math.sin(2*Math.PI*Y),Z[3]=W*Math.cos(2*Math.PI*Y),Z}function l56(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=$*$+Y*Y+Q*Q+W*W,K=X?1/X:0;return Z[0]=-$*K,Z[1]=-Y*K,Z[2]=-Q*K,Z[3]=W*K,Z}function p56(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z[3]=J[3],Z}function d$1(Z,J){var $=J[0]+J[4]+J[8],Y;if($>0)Y=Math.sqrt($+1),Z[3]=0.5*Y,Y=0.5/Y,Z[0]=(J[5]-J[7])*Y,Z[1]=(J[6]-J[2])*Y,Z[2]=(J[1]-J[3])*Y;else{var Q=0;if(J[4]>J[0])Q=1;if(J[8]>J[Q*3+Q])Q=2;var W=(Q+1)%3,X=(Q+2)%3;Y=Math.sqrt(J[Q*3+Q]-J[W*3+W]-J[X*3+X]+1),Z[Q]=0.5*Y,Y=0.5/Y,Z[3]=(J[W*3+X]-J[X*3+W])*Y,Z[W]=(J[W*3+Q]+J[Q*3+W])*Y,Z[X]=(J[X*3+Q]+J[Q*3+X])*Y}return Z}function i56(Z,J,$,Y){var Q=0.5*Math.PI/180;J*=Q,$*=Q,Y*=Q;var W=Math.sin(J),X=Math.cos(J),K=Math.sin($),G=Math.cos($),z=Math.sin(Y),H=Math.cos(Y);return Z[0]=W*G*H-X*K*z,Z[1]=X*K*H+W*G*z,Z[2]=X*G*z-W*K*H,Z[3]=X*G*H+W*K*z,Z}function n56(Z){return"quat("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}var a56=C$1,s56=T$1,o56=k$1,r56=E$1,t56=I$1,e56=g$1,c$1=v$1,l$1=x$1,Z96=h$1,p$1=S$1,J96=p$1,i$1=_$1,$96=i$1,$b=A$1,Y96=f$1,Q96=b$1,W96=function(){var Z=TM(),J=kM(1,0,0),$=kM(0,1,0);return function(Y,Q,W){var X=EM(Q,W);if(X<-0.999999){if(lq(Z,J,Q),Zb(Z)<0.000001)lq(Z,$,Q);return ef(Z,Z),y$1(Y,Z,Math.PI),Y}else if(X>0.999999)return Y[0]=0,Y[1]=0,Y[2]=0,Y[3]=1,Y;else return lq(Z,Q,W),Y[0]=Z[0],Y[1]=Z[1],Y[2]=Z[2],Y[3]=1+X,$b(Y,Y)}}(),X96=function(){var Z=Jb(),J=Jb();return function($,Y,Q,W,X,K){return IM(Z,Y,X,K),IM(J,Q,W,K),IM($,Z,J,2*K*(1-K)),$}}(),K96=function(){var Z=tf();return function(J,$,Y,Q){return Z[0]=Y[0],Z[3]=Y[1],Z[6]=Y[2],Z[1]=Q[0],Z[4]=Q[1],Z[7]=Q[2],Z[2]=-$[0],Z[5]=-$[1],Z[8]=-$[2],$b(J,d$1(J,Z))}}();var X1={};$4(X1,{zero:()=>A96,transformMat4:()=>v96,transformMat3:()=>I96,transformMat2d:()=>E96,transformMat2:()=>k96,subtract:()=>a$1,sub:()=>y96,str:()=>x96,squaredLength:()=>ZY1,squaredDistance:()=>t$1,sqrLen:()=>c96,sqrDist:()=>d96,set:()=>V96,scaleAndAdd:()=>j96,scale:()=>O96,round:()=>B96,rotate:()=>S96,random:()=>T96,normalize:()=>N96,negate:()=>M96,multiply:()=>s$1,mul:()=>g96,min:()=>L96,max:()=>w96,lerp:()=>C96,length:()=>e$1,len:()=>b96,inverse:()=>R96,fromValues:()=>z96,forEach:()=>l96,floor:()=>U96,exactEquals:()=>h96,equals:()=>f96,dot:()=>P96,divide:()=>o$1,div:()=>m96,distance:()=>r$1,dist:()=>u96,cross:()=>D96,create:()=>n$1,copy:()=>H96,clone:()=>G96,ceil:()=>F96,angle:()=>_96,add:()=>q96});function n$1(){var Z=new Y1(2);if(Y1!=Float32Array)Z[0]=0,Z[1]=0;return Z}function G96(Z){var J=new Y1(2);return J[0]=Z[0],J[1]=Z[1],J}function z96(Z,J){var $=new Y1(2);return $[0]=Z,$[1]=J,$}function H96(Z,J){return Z[0]=J[0],Z[1]=J[1],Z}function V96(Z,J,$){return Z[0]=J,Z[1]=$,Z}function q96(Z,J,$){return Z[0]=J[0]+$[0],Z[1]=J[1]+$[1],Z}function a$1(Z,J,$){return Z[0]=J[0]-$[0],Z[1]=J[1]-$[1],Z}function s$1(Z,J,$){return Z[0]=J[0]*$[0],Z[1]=J[1]*$[1],Z}function o$1(Z,J,$){return Z[0]=J[0]/$[0],Z[1]=J[1]/$[1],Z}function F96(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z}function U96(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z}function L96(Z,J,$){return Z[0]=Math.min(J[0],$[0]),Z[1]=Math.min(J[1],$[1]),Z}function w96(Z,J,$){return Z[0]=Math.max(J[0],$[0]),Z[1]=Math.max(J[1],$[1]),Z}function B96(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z}function O96(Z,J,$){return Z[0]=J[0]*$,Z[1]=J[1]*$,Z}function j96(Z,J,$,Y){return Z[0]=J[0]+$[0]*Y,Z[1]=J[1]+$[1]*Y,Z}function r$1(Z,J){var $=J[0]-Z[0],Y=J[1]-Z[1];return Math.hypot($,Y)}function t$1(Z,J){var $=J[0]-Z[0],Y=J[1]-Z[1];return $*$+Y*Y}function e$1(Z){var J=Z[0],$=Z[1];return Math.hypot(J,$)}function ZY1(Z){var J=Z[0],$=Z[1];return J*J+$*$}function M96(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z}function R96(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z}function N96(Z,J){var $=J[0],Y=J[1],Q=$*$+Y*Y;if(Q>0)Q=1/Math.sqrt(Q);return Z[0]=J[0]*Q,Z[1]=J[1]*Q,Z}function P96(Z,J){return Z[0]*J[0]+Z[1]*J[1]}function D96(Z,J,$){var Y=J[0]*$[1]-J[1]*$[0];return Z[0]=Z[1]=0,Z[2]=Y,Z}function C96(Z,J,$,Y){var Q=J[0],W=J[1];return Z[0]=Q+Y*($[0]-Q),Z[1]=W+Y*($[1]-W),Z}function T96(Z,J){J=J||1;var $=c7()*2*Math.PI;return Z[0]=Math.cos($)*J,Z[1]=Math.sin($)*J,Z}function k96(Z,J,$){var Y=J[0],Q=J[1];return Z[0]=$[0]*Y+$[2]*Q,Z[1]=$[1]*Y+$[3]*Q,Z}function E96(Z,J,$){var Y=J[0],Q=J[1];return Z[0]=$[0]*Y+$[2]*Q+$[4],Z[1]=$[1]*Y+$[3]*Q+$[5],Z}function I96(Z,J,$){var Y=J[0],Q=J[1];return Z[0]=$[0]*Y+$[3]*Q+$[6],Z[1]=$[1]*Y+$[4]*Q+$[7],Z}function v96(Z,J,$){var Y=J[0],Q=J[1];return Z[0]=$[0]*Y+$[4]*Q+$[12],Z[1]=$[1]*Y+$[5]*Q+$[13],Z}function S96(Z,J,$,Y){var Q=J[0]-$[0],W=J[1]-$[1],X=Math.sin(Y),K=Math.cos(Y);return Z[0]=Q*K-W*X+$[0],Z[1]=Q*X+W*K+$[1],Z}function _96(Z,J){var $=Z[0],Y=Z[1],Q=J[0],W=J[1],X=Math.sqrt($*$+Y*Y)*Math.sqrt(Q*Q+W*W),K=X&&($*Q+Y*W)/X;return Math.acos(Math.min(Math.max(K,-1),1))}function A96(Z){return Z[0]=0,Z[1]=0,Z}function x96(Z){return"vec2("+Z[0]+", "+Z[1]+")"}function h96(Z,J){return Z[0]===J[0]&&Z[1]===J[1]}function f96(Z,J){var $=Z[0],Y=Z[1],Q=J[0],W=J[1];return Math.abs($-Q)<=P0*Math.max(1,Math.abs($),Math.abs(Q))&&Math.abs(Y-W)<=P0*Math.max(1,Math.abs(Y),Math.abs(W))}var b96=e$1,y96=a$1,g96=s$1,m96=o$1,u96=r$1,d96=t$1,c96=ZY1,l96=function(){var Z=n$1();return function(J,$,Y,Q,W,X){var K,G;if(!$)$=2;if(!Y)Y=0;if(Q)G=Math.min(Q*$+Y,J.length);else G=J.length;for(K=Y;K<G;K+=$)Z[0]=J[K],Z[1]=J[K+1],W(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1];return J}}();class HW extends Float32Array{constructor(Z,J,$,Y){super([Z,J,$,Y])}get determinant(){return m8.determinant(this)}get frobeniusNorm(){return m8.frob(this)}static create(){let Z=new HW(0,0,0,0);return m8.identity(Z),Z}static fromRotation(Z){let J=HW.create();return m8.fromRotation(J,Z),J}static fromScaling(Z){let J=HW.create();return m8.fromScaling(J,Z),J}add(Z){return m8.add(this,this,Z),this}adjoint(){return m8.adjoint(this,this),this}clone(){return new HW(this[0],this[1],this[2],this[3])}copy(Z){return m8.copy(this,Z),this}equals(Z){return m8.equals(this,Z)}exactEquals(Z){return m8.exactEquals(this,Z)}identity(){return m8.identity(this),this}invert(){return m8.invert(this,this),this}multiply(Z){return m8.mul(this,this,Z),this}multiplyScalar(Z){return m8.multiplyScalar(this,this,Z),this}rotate(Z){return m8.rotate(this,this,Z),this}subtract(Z){return m8.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]}][${this[2]},${this[3]}]`}transpose(){return m8.transpose(this,this),this}}class l7 extends Float32Array{constructor(Z,J,$,Y,Q,W,X,K,G){super([Z,J,$,Y,Q,W,X,K,G])}get determinant(){return l1.determinant(this)}get frobeniusNorm(){return l1.frob(this)}static create(){let Z=new l7(0,0,0,0,0,0,0,0,0);return l1.identity(Z),Z}static fromMatrix4(Z){let J=l7.create();return l1.fromMat4(J,Z),J}static fromQuaternion(Z){let J=l7.create();return l1.fromQuat(J,Z),J}static fromRotation(Z){let J=l7.create();return l1.fromRotation(J,Z),J}static fromScaling(Z){let J=l7.create();return l1.fromScaling(J,Z),J}static fromTranslation(Z){let J=l7.create();return l1.fromTranslation(J,Z),J}add(Z){return l1.add(this,this,Z),this}adjoint(){return l1.adjoint(this,this),this}clone(){return new l7(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8])}copy(Z){return l1.copy(this,Z),this}equals(Z){return l1.equals(this,Z)}exactEquals(Z){return l1.exactEquals(this,Z)}identity(){return l1.identity(this),this}invert(){return l1.invert(this,this),this}multiply(Z){return l1.mul(this,this,Z),this}multiplyScalar(Z){return l1.multiplyScalar(this,this,Z),this}transformVector(Z){return Z.transformMatrix3(this)}projection(Z,J){return l1.projection(this,Z,J),this}rotate(Z){return l1.rotate(this,this,Z),this}subtract(Z){return l1.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]},${this[2]}][${this[3]},${this[4]},${this[5]}][${this[6]},${this[7]},${this[8]}]`}transpose(){return l1.transpose(this,this),this}}class U5 extends Float32Array{constructor(Z,J,$,Y,Q,W,X,K,G,z,H,V,q,F,U,w){super([Z,J,$,Y,Q,W,X,K,G,z,H,V,q,F,U,w])}get determinant(){return o0.determinant(this)}get frobeniusNorm(){return o0.frob(this)}static create(){let Z=new U5(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return o0.identity(Z),Z}static fromQuaternion(Z){let J=U5.create();return o0.fromQuat(J,Z),J}static fromRotation(Z,J){let $=U5.create();return o0.fromRotation($,Z,J),$}static fromRotationTranslation(Z,J){let $=U5.create();return o0.fromRotationTranslation($,Z,J),$}static fromRotationTranslationScale(Z,J,$){let Y=U5.create();return o0.fromRotationTranslationScale(Y,Z,J,$),Y}static fromRotationTranslationScaleOrigin(Z,J,$,Y){let Q=U5.create();return o0.fromRotationTranslationScaleOrigin(Q,Z,J,$,Y),Q}static fromScaling(Z){let J=U5.create();return o0.fromScaling(J,Z),J}static fromTranslation(Z){let J=U5.create();return o0.fromTranslation(J,Z),J}static fromXRotation(Z){let J=U5.create();return o0.fromXRotation(J,Z),J}static fromYRotation(Z){let J=U5.create();return o0.fromYRotation(J,Z),J}static fromZRotation(Z){let J=U5.create();return o0.fromZRotation(J,Z),J}add(Z){return o0.add(this,this,Z),this}adjoint(){return o0.adjoint(this,this),this}clone(){return new U5(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8],this[9],this[10],this[11],this[12],this[13],this[14],this[15])}copy(Z){return o0.copy(this,Z),this}equals(Z){return o0.equals(this,Z)}exactEquals(Z){return o0.exactEquals(this,Z)}frustrum(Z,J,$,Y,Q,W){return o0.frustum(this,Z,J,$,Y,Q,W),this}identity(){return o0.identity(this),this}invert(){return o0.invert(this,this),this}lookAt(Z,J,$){return o0.lookAt(this,Z,J,$),this}multiply(Z){return o0.mul(this,this,Z),this}multiplyScalar(Z){return o0.multiplyScalar(this,this,Z),this}orthographic(Z,J,$,Y,Q,W){return o0.ortho(this,Z,J,$,Y,Q,W),this}perspective(Z,J,$,Y){return o0.perspective(this,Z,J,$,Y),this}rotate(Z,J){return o0.rotate(this,this,Z,J),this}rotateX(Z){return o0.rotateX(this,this,Z),this}rotateY(Z){return o0.rotateY(this,this,Z),this}rotateZ(Z){return o0.rotateZ(this,this,Z),this}scale(Z){return o0.scale(this,this,Z),this}subtract(Z){return o0.sub(this,this,Z),this}targetTo(Z,J,$){return o0.targetTo(this,Z,J,$),this}toString(){return`[${this[0]},${this[1]},${this[2]},${this[3]}][${this[4]},${this[5]},${this[6]},${this[7]}][${this[8]},${this[9]},${this[10]},${this[11]}][${this[12]},${this[13]},${this[14]},${this[15]}]`}translate(Z){return o0.translate(this,this,Z),this}transpose(){return o0.transpose(this,this),this}}class M3 extends Float32Array{constructor(Z,J,$,Y){super([Z,J,$,Y])}get length(){return R1.length(this)}get squaredLength(){return R1.squaredLength(this)}get magnitude(){return R1.length(this)}get squaredMagnitude(){return R1.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}get z(){return this[2]}set z(Z){this[2]=Z}get w(){return this[3]}set w(Z){this[3]=Z}static fromEuler(Z,J,$){let Y=R1.fromEuler(new Float32Array(4),Z,J,$);return new M3(Y[0],Y[1],Y[2],Y[3])}static fromQuaternionLike(Z){return new M3(Z.x,Z.y,Z.z,Z.w)}clone(){return new M3(this.x,this.y,this.z,this.w)}conjugate(){return R1.conjugate(this,this),this}copy(Z){return R1.copy(this,Z),this}dot(Z){return R1.dot(this,Z)}exponential(){return R1.exp(this,this),this}equals(Z){return R1.equals(this,Z)}exactEquals(Z){return R1.exactEquals(this,Z)}getAngle(Z){return R1.getAngle(this,Z)}identity(){return R1.identity(this),this}invert(){return R1.invert(this,this),this}lerp(Z,J){return R1.lerp(this,this,Z,J),this}logarithm(){return R1.ln(this,this),this}multiply(Z){return R1.multiply(this,this,Z),this}transformVector(Z){return Z.transformQuaternion(this)}normalize(){return R1.normalize(this,this),this}power(Z){return R1.pow(this,this,Z),this}randomize(){return R1.random(this),this}rotateX(Z){return R1.rotateX(this,this,Z),this}rotateY(Z){return R1.rotateY(this,this,Z),this}rotateZ(Z){return R1.rotateZ(this,this,Z),this}scale(Z){return R1.scale(this,this,Z),this}setAxisAngle(Z,J){return R1.setAxisAngle(this,Z,J),this}slerp(Z,J){return R1.slerp(this,this,Z,J),this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}}class pq extends Float32Array{constructor(Z,J){super([Z,J])}get length(){return X1.length(this)}get squaredLength(){return X1.squaredLength(this)}get magnitude(){return X1.length(this)}get squaredMagnitude(){return X1.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}static create(){return new pq(0,0)}add(Z){return X1.add(this,this,Z),this}angle(Z){return X1.angle(this,Z)}ceil(){return X1.ceil(this,this),this}clone(){return new pq(this.x,this.y)}copy(Z){return X1.copy(this,Z),this}distance(Z){return X1.distance(this,Z)}divide(Z){return X1.divide(this,this,Z),this}dot(Z){return X1.dot(this,Z)}equals(Z){return X1.equals(this,Z)}exactEquals(Z){return X1.exactEquals(this,Z)}floor(){return X1.floor(this,this),this}invert(){return X1.inverse(this,this),this}lerp(Z,J){return X1.lerp(this,this,Z,J),this}max(Z){return X1.max(this,this,Z),this}min(Z){return X1.min(this,this,Z),this}multiply(Z){return X1.mul(this,this,Z),this}negate(){return X1.negate(this,this),this}normalize(){return X1.normalize(this,this),this}randomize(Z){return X1.random(this,Z),this}rotate(Z,J){return X1.rotate(this,this,Z,J),this}round(){return X1.round(this,this),this}scale(Z){return X1.scale(this,this,Z),this}scaleAndAdd(Z,J){return X1.scaleAndAdd(this,this,Z,J),this}subtract(Z){return X1.sub(this,this,Z),this}toString(){return`${this.x},${this.y}`}transformMatrix2(Z){return X1.transformMat2(this,this,Z),this}transformMatrix3(Z){return X1.transformMat3(this,this,Z),this}transformMatrix4(Z){return X1.transformMat4(this,this,Z),this}zero(){return X1.zero(this),this}}class R3 extends Float32Array{constructor(Z,J,$){super([Z,J,$])}get length(){return t0.length(this)}get squaredLength(){return t0.squaredLength(this)}get magnitude(){return t0.length(this)}get squaredMagnitude(){return t0.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}get z(){return this[2]}set z(Z){this[2]=Z}static create(){return new R3(0,0,0)}static fromVector3Like(Z){return new R3(Z.x,Z.y,Z.z)}add(Z){return t0.add(this,this,Z),this}ceil(){return t0.ceil(this,this),this}clone(){return new R3(this.x,this.y,this.z)}copy(Z){return t0.copy(this,Z),this}cross(Z){return t0.cross(this,this,Z),this}distance(Z){return t0.distance(this,Z)}divide(Z){return t0.div(this,this,Z),this}dot(Z){return t0.dot(this,Z)}equals(Z){return t0.equals(this,Z)}exactEquals(Z){return t0.exactEquals(this,Z)}floor(){return t0.floor(this,this),this}invert(){return t0.inverse(this,this),this}lerp(Z,J){return t0.lerp(this,this,Z,J),this}max(Z){return t0.max(this,this,Z),this}min(Z){return t0.min(this,this,Z),this}multiply(Z){return t0.mul(this,this,Z),this}negate(){return t0.negate(this,this),this}normalize(){return t0.normalize(this,this),this}randomize(Z){return t0.random(this,Z),this}rotateX(Z,J){return t0.rotateX(this,this,Z,J),this}rotateY(Z,J){return t0.rotateY(this,this,Z,J),this}rotateZ(Z,J){return t0.rotateZ(this,this,Z,J),this}round(){return t0.round(this,this),this}scale(Z){return t0.scale(this,this,Z),this}scaleAndAdd(Z,J){return t0.scaleAndAdd(this,this,Z,J),this}subtract(Z){return t0.sub(this,this,Z),this}toString(){return`${this.x},${this.y},${this.z}`}transformMatrix3(Z){return t0.transformMat3(this,this,Z),this}transformMatrix4(Z){return t0.transformMat4(this,this,Z),this}transformQuaternion(Z){return t0.transformQuat(this,this,Z),this}zero(){return t0.zero(this),this}}var N1=function(Z,J,$,Y){function Q(W){return W instanceof $?W:new $(function(X){X(W)})}return new($||($=Promise))(function(W,X){function K(H){try{z(Y.next(H))}catch(V){X(V)}}function G(H){try{z(Y.throw(H))}catch(V){X(V)}}function z(H){H.done?W(H.value):Q(H.value).then(K,G)}z((Y=Y.apply(Z,J||[])).next())})},j1=function(Z,J){var $={label:0,sent:function(){if(W[0]&1)throw W[1];return W[1]},trys:[],ops:[]},Y,Q,W,X=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return X.next=K(0),X.throw=K(1),X.return=K(2),typeof Symbol==="function"&&(X[Symbol.iterator]=function(){return this}),X;function K(z){return function(H){return G([z,H])}}function G(z){if(Y)throw new TypeError("Generator is already executing.");while(X&&(X=0,z[0]&&($=0)),$)try{if(Y=1,Q&&(W=z[0]&2?Q.return:z[0]?Q.throw||((W=Q.return)&&W.call(Q),0):Q.next)&&!(W=W.call(Q,z[1])).done)return W;if(Q=0,W)z=[z[0]&2,W.value];switch(z[0]){case 0:case 1:W=z;break;case 4:return $.label++,{value:z[1],done:!1};case 5:$.label++,Q=z[1],z=[0];continue;case 7:z=$.ops.pop(),$.trys.pop();continue;default:if((W=$.trys,!(W=W.length>0&&W[W.length-1]))&&(z[0]===6||z[0]===2)){$=0;continue}if(z[0]===3&&(!W||z[1]>W[0]&&z[1]<W[3])){$.label=z[1];break}if(z[0]===6&&$.label<W[1]){$.label=W[1],W=z;break}if(W&&$.label<W[2]){$.label=W[2],$.ops.push(z);break}if(W[2])$.ops.pop();$.trys.pop();continue}z=J.call(Z,$)}catch(H){z=[6,H],Q=0}finally{Y=W=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},m5=function(Z,J){var $=typeof Symbol==="function"&&Z[Symbol.iterator];if(!$)return Z;var Y=$.call(Z),Q,W=[],X;try{while((J===void 0||J-- >0)&&!(Q=Y.next()).done)W.push(Q.value)}catch(K){X={error:K}}finally{try{if(Q&&!Q.done&&($=Y.return))$.call(Y)}finally{if(X)throw X.error}}return W},Z4=function(Z,J,$){if($||arguments.length===2){for(var Y=0,Q=J.length,W;Y<Q;Y++)if(W||!(Y in J)){if(!W)W=Array.prototype.slice.call(J,0,Y);W[Y]=J[Y]}}return Z.concat(W||Array.prototype.slice.call(J))},JY1=function(Z){var J=typeof Symbol==="function"&&Symbol.iterator,$=J&&Z[J],Y=0;if($)return $.call(Z);if(Z&&typeof Z.length==="number")return{next:function(){if(Z&&Y>=Z.length)Z=void 0;return{value:Z&&Z[Y++],done:!Z}}};throw new TypeError(J?"Object is not iterable.":"Symbol.iterator is not defined.")},xo6=function(){function Z(J){if(J===void 0)J=Z.minComparator;var $=this;this.compare=J,this.heapArray=[],this._limit=0,this.offer=this.add,this.element=this.peek,this.poll=this.pop,this._invertedCompare=function(Y,Q){return $.compare(Y,Q).then(function(W){return-1*W})}}return Z.getChildrenIndexOf=function(J){return[J*2+1,J*2+2]},Z.getParentIndexOf=function(J){if(J<=0)return-1;var $=J%2?1:2;return Math.floor((J-$)/2)},Z.getSiblingIndexOf=function(J){if(J<=0)return-1;var $=J%2?1:-1;return J+$},Z.minComparator=function(J,$){return N1(this,void 0,void 0,function(){return j1(this,function(Y){if(J>$)return[2,1];else if(J<$)return[2,-1];else return[2,0]})})},Z.maxComparator=function(J,$){return N1(this,void 0,void 0,function(){return j1(this,function(Y){if($>J)return[2,1];else if($<J)return[2,-1];else return[2,0]})})},Z.minComparatorNumber=function(J,$){return N1(this,void 0,void 0,function(){return j1(this,function(Y){return[2,J-$]})})},Z.maxComparatorNumber=function(J,$){return N1(this,void 0,void 0,function(){return j1(this,function(Y){return[2,$-J]})})},Z.defaultIsEqual=function(J,$){return N1(this,void 0,void 0,function(){return j1(this,function(Y){return[2,J===$]})})},Z.print=function(J){function $(H){var V=Z.getParentIndexOf(H);return Math.floor(Math.log2(V+1))}function Y(H,V){var q="";for(;V>0;--V)q+=H;return q}var Q=0,W=[],X=$(J.length-1)+2,K=0;while(Q<J.length){var G=$(Q)+1;if(Q===0)G=0;var z=String(J.get(Q));if(z.length>K)K=z.length;W[G]=W[G]||[],W[G].push(z),Q+=1}return W.map(function(H,V){var q=Math.pow(2,X-V)-1;return Y(" ",Math.floor(q/2)*K)+H.map(function(F){var U=(K-F.length)/2;return Y(" ",Math.ceil(U))+F+Y(" ",Math.floor(U))}).join(Y(" ",q*K))}).join(`
|
438
|
+
`);let{connect:G,buffered:z}=await K;if(Z.emit("proxyConnect",G),this.emit("proxyConnect",G,Z),G.statusCode===200){if(Z.once("socket",G16),J.secureEndpoint){kq("Upgrading socket connection to TLS");let V=J.servername||J.host;return vf.connect({...hJ1(J,"host","path","port"),socket:Y,servername:aZ.isIP(V)?void 0:V})}return Y}Y.destroy();let H=new aZ.Socket({writable:!1});return H.readable=!0,Z.once("socket",(V)=>{kq("Replaying proxy buffer for failed request"),V.push(z),V.push(null)}),H}}MM.__initStatic();function G16(Z){Z.resume()}function hJ1(Z,...J){let $={},Y;for(Y in Z)if(!J.includes(Y))$[Y]=Z[Y];return $}var F16=32768;function U16(Z){return new V16({read(){this.push(Z),this.push(null)}})}function Sf(Z){let J;try{J=new URL(Z.url)}catch(G){return k8(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),sJ(Z,()=>Promise.resolve({}))}let $=J.protocol==="https:",Y=L16(J,Z.proxy||($?process.env.https_proxy:void 0)||process.env.http_proxy),Q=$?H16:z16,W=Z.keepAlive===void 0?!1:Z.keepAlive,X=Y?new MM(Y):new Q.Agent({keepAlive:W,maxSockets:30,timeout:2000}),K=w16(Z,Z.httpModule??Q,X);return sJ(Z,K)}function L16(Z,J){let{no_proxy:$}=process.env;if($?.split(",").some((Q)=>Z.host.endsWith(Q)||Z.hostname.endsWith(Q)))return;else return J}function w16(Z,J,$){let{hostname:Y,pathname:Q,port:W,protocol:X,search:K}=new URL(Z.url);return function G(z){return new Promise((H,V)=>{VQ(()=>{let q=U16(z.body),F={...Z.headers};if(z.body.length>F16)F["content-encoding"]="gzip",q=q.pipe(q16());let U=J.request({method:"POST",agent:$,headers:F,hostname:Y,path:`${Q}${K}`,port:W,protocol:X,ca:Z.caCerts},(w)=>{w.on("data",()=>{}),w.on("end",()=>{}),w.setEncoding("utf8");let L=w.headers["retry-after"]??null,O=w.headers["x-sentry-rate-limits"]??null;H({statusCode:w.statusCode,headers:{"retry-after":L,"x-sentry-rate-limits":Array.isArray(O)?O[0]||null:O}})});U.on("error",V),q.pipe(U)})})}}var B16=new Set(["false","f","n","no","off","0"]),O16=new Set(["true","t","y","yes","on","1"]);function RM(Z,J){let $=String(Z).toLowerCase();if(B16.has($))return!1;if(O16.has($))return!0;return J?.strict?null:Boolean(Z)}import{posix as j16,sep as M16}from"path";function fJ1(Z){return Z.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function _f(Z=process.argv[1]?rv(process.argv[1]):process.cwd(),J=M16==="\\"){let $=J?fJ1(Z):Z;return(Y)=>{if(!Y)return;let Q=J?fJ1(Y):Y,{dir:W,base:X,ext:K}=j16.parse(Q);if(K===".js"||K===".mjs"||K===".cjs")X=X.slice(0,K.length*-1);let G=decodeURIComponent(X);if(!W)W=".";let z=W.lastIndexOf("/node_modules");if(z>-1)return`${W.slice(z+14).replace(/\//g,".")}:${G}`;if(W.startsWith($)){let H=W.slice($.length+1).replace(/\//g,".");return H?`${H}:${G}`:G}return G}}function Af(Z){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(v0.SENTRY_RELEASE?.id)return v0.SENTRY_RELEASE.id;let J=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,$=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,Y=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return J||$||Y||Z}var xf=SB(ZS(_f()));var yJ1=t(Z0(),1);import*as bJ1 from"os";import{threadId as R16,isMainThread as N16}from"worker_threads";var P16=60000;class NM extends lB{constructor(Z){let J=Z.serverName||global.process.env.SENTRY_NAME||bJ1.hostname(),$={...Z,platform:"node",runtime:{name:"node",version:global.process.version},serverName:J};if(Z.openTelemetryInstrumentations)_K({instrumentations:Z.openTelemetryInstrumentations});rH($,"node"),l.log(`Initializing Sentry: process: ${process.pid}, thread: ${N16?"main":`worker-${R16}`}.`);super($);if(this.getOptions()._experiments?.enableLogs){if(this._logOnExitFlushListener=()=>{FQ(this)},J)this.on("beforeCaptureLog",(Y)=>{Y.attributes={...Y.attributes,"server.address":J}});process.on("beforeExit",this._logOnExitFlushListener)}}get tracer(){if(this._tracer)return this._tracer;let Z="@sentry/node",J=T8,$=yJ1.trace.getTracer(Z,J);return this._tracer=$,$}async flush(Z){let $=this.traceProvider?.activeSpanProcessor;if($)await $.forceFlush();if(this.getOptions().sendClientReports)this._flushOutcomes();return super.flush(Z)}close(Z){if(this._clientReportInterval)clearInterval(this._clientReportInterval);if(this._clientReportOnExitFlushListener)process.off("beforeExit",this._clientReportOnExitFlushListener);if(this._logOnExitFlushListener)process.off("beforeExit",this._logOnExitFlushListener);return super.close(Z)}startClientReportTracking(){let Z=this.getOptions();if(Z.sendClientReports)this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{m0&&l.log("Flushing client reports based on interval."),this._flushOutcomes()},Z.clientReportFlushInterval??P16).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener)}_getTraceInfoFromScope(Z){if(!Z)return[void 0,void 0];return Y01(this,Z)}}var m4=t(Z0(),1);var L3=t(x1(),1);var gJ1=t(rO(),1);import D16 from"module";var hf=1e6;function ff(Z,J={}){if(Z.getOptions().debug)k16();let $=C16(Z,J);Z.traceProvider=$}function mJ1(){let[Z=0,J=0]=process.versions.node.split(".").map(Number);if(Z>=21||Z===20&&J>=6||Z===18&&J>=19){if(!v0._sentryEsmLoaderHookRegistered)try{let{addHookMessagePort:$}=gJ1.createAddHookMessageChannel();D16.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:$,include:[]},transferList:[$]})}catch($){l.warn("Failed to register ESM hook",$)}}else k8(()=>{console.warn(`[Sentry] You are using Node.js v${process.versions.node} in ESM mode ("import syntax"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS ("require() syntax"), or upgrade your Node.js version.`)})}function C16(Z,J={}){let $=new Bx({sampler:new bx(Z),resource:new dK({[L3.ATTR_SERVICE_NAME]:"node",[L3.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[L3.ATTR_SERVICE_VERSION]:T8}),forceFlushTimeoutMillis:500,spanProcessors:[new fx({timeout:T16(Z.getOptions().maxSpanWaitDuration)}),...J.spanProcessors||[]]});return m4.trace.setGlobalTracerProvider($),m4.propagation.setGlobalPropagator(new Sx),m4.context.setGlobalContextManager(new _J1),$}function T16(Z){if(Z==null)return;if(Z>hf)return m0&&l.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${hf}`),hf;else if(Z<=0||Number.isNaN(Z)){m0&&l.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return Z}function k16(){let Z=new Proxy(l,{get(J,$,Y){return Reflect.get(J,$==="verbose"?"debug":$,Y)}});m4.diag.disable(),m4.diag.setLogger(Z,m4.DiagLogLevel.DEBUG)}function E16(){return eK()?[Z3()]:[]}function uJ1(){return[wQ(),LQ(),BQ(),OQ(),jQ(),aK(),oK(),J3(),$3(),tK(),ix(),rK(),OJ1(),AJ1(),...E16()]}function dJ1(Z){return[...uJ1(),...W5(Z)?U3():[]]}function bf(Z={}){return I16(Z,dJ1)}function I16(Z={},J){let $=v16(Z,J);if($.debug===!0)if(m0)l.enable();else k8(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")});if(!eK()&&$.registerEsmLoaderHooks!==!1)mJ1();if(W01(),B1().update($.initialScope),$.spotlight&&!$.integrations.some(({name:W})=>W===wf))$.integrations.push(Bf({sidecarUrl:typeof $.spotlight==="string"?$.spotlight:void 0}));let Q=new NM($);if(B1().setClient(Q),Q.init(),l.log(`Running in ${eK()?"CommonJS":"ESM"} mode.`),Q.startClientReportTracking(),A16(),!$.skipOpenTelemetrySetup)ff(Q,{spanProcessors:$.openTelemetrySpanProcessors}),cJ1();return ae0(Q),Q01(Q),Q}function cJ1(){if(!m0)return;let Z=te0(),J=["SentryContextManager","SentryPropagator"];if(W5())J.push("SentrySpanProcessor");for(let $ of J)if(!Z.includes($))l.error(`You have to set up the ${$}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);if(!Z.includes("SentrySampler"))l.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function v16(Z,J){let $=S16(Z.release),Y=Z.spotlight??RM(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,Q=_16(Z.tracesSampleRate),W={...Z,dsn:Z.dsn??process.env.SENTRY_DSN,environment:Z.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:Z.sendClientReports??!0,transport:Z.transport??Sf,stackParser:Cv(Z.stackParser||xf),release:$,tracesSampleRate:Q,spotlight:Y,debug:RM(Z.debug??process.env.SENTRY_DEBUG)},X=Z.integrations,K=Z.defaultIntegrations??J(W);return{...W,integrations:uv({defaultIntegrations:K,integrations:X})}}function S16(Z){if(Z!==void 0)return Z;let J=Af();if(J!==void 0)return J;return}function _16(Z){if(Z!==void 0)return Z;let J=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!J)return;let $=parseFloat(J);return isFinite($)?$:void 0}function A16(){if(RM(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let Z=process.env.SENTRY_TRACE,J=process.env.SENTRY_BAGGAGE,$=WQ(Z,J);B1().setPropagationContext($)}}import*as aJ1 from"os";var p16="BunServer",i16=()=>{return{name:p16,setupOnce(){n16()}}},iJ1=J0(i16),lJ1=!1;function n16(){if(lJ1)return;Bun.serve=new Proxy(Bun.serve,{apply(Z,J,$){pJ1($[0]);let Y=Z.apply(J,$),Q=Y.reload.bind(Y);return Y.reload=(W)=>{return pJ1(W),Q(W)},Y}}),lJ1=!0}function pJ1(Z){a16(Z),s16(Z)}function a16(Z){if(typeof Z.fetch!=="function")return;Z.fetch=new Proxy(Z.fetch,{apply(J,$,Y){return yf(J,$,Y)}})}function s16(Z){if(!Z.routes)return;if(typeof Z.routes!=="object")return;Object.keys(Z.routes).forEach((J)=>{let $=Z.routes[J];if(typeof $==="function")Z.routes[J]=new Proxy($,{apply:(Y,Q,W)=>{return yf(Y,Q,W,J)}});if($ instanceof Response)return;if(typeof $==="object")Object.entries($).forEach(([Y,Q])=>{if(typeof Q==="function")Z.routes[J][Y]=new Proxy(Q,{apply:(W,X,K)=>{return yf(W,X,K,J)}})})})}function yf(Z,J,$,Y){return pJ((Q)=>{let W=$[0],X=W.method.toUpperCase();if(X==="OPTIONS"||X==="HEAD")return Z.apply(J,$);let K=ev(W.url),G=o16(K,W),z=K?.pathname||"/";if(W.params){if(Object.keys(W.params).forEach((H)=>{G[`url.path.parameter.${H}`]=W.params[H]}),Y)G[n1]="route",G["url.template"]=Y,z=Y}if(Y?.endsWith("/*"))G[n1]="route",G["url.template"]=Y,z=Y;return Q.setSDKProcessingMetadata({normalizedRequest:{url:W.url,method:W.method,headers:W.headers.toJSON(),query_string:K?.search}}),nH({sentryTrace:W.headers.get("sentry-trace")??"",baggage:W.headers.get("baggage")},()=>HQ({attributes:G,op:"http.server",name:`${W.method} ${z}`},async(H)=>{try{let V=await Z.apply(J,$);if(V?.status)_H(H,V.status),Q.setContext("response",{headers:V.headers.toJSON(),status_code:V.status});return V}catch(V){throw A6(V,{mechanism:{type:"bun",handled:!1,data:{function:"serve"}}}),V}}))})}function o16(Z,J){let $={[$1]:"auto.http.bun.serve",[Mv]:J.method||"GET",[n1]:"url"};if(Z){if(Z.search)$["url.query"]=Z.search;if(Z.hash)$["url.fragment"]=Z.hash;if(Z.pathname)$["url.path"]=Z.pathname;if(!tv(Z)){if($["url.full"]=Z.href,Z.port)$["url.port"]=Z.port;if(Z.protocol)$["url.scheme"]=Z.protocol;if(Z.hostname)$["url.domain"]=Z.hostname}}return $}function nJ1(Z){function J($){let Y={body:$.body,method:"POST",headers:Z.headers};try{return VQ(()=>{return fetch(Z.url,Y).then((Q)=>{return{statusCode:Q.status,headers:{"x-sentry-rate-limits":Q.headers.get("X-Sentry-Rate-Limits"),"retry-after":Q.headers.get("Retry-After")}}})})}catch(Q){return qQ(Q)}}return sJ(Z,J)}function sJ1(Z){return[wQ(),LQ(),BQ(),OQ(),jQ(),aK(),oK(),J3(),$3(),tK(),rK(),Z3(),iJ1(),...W5(Z)?U3():[]]}function gf(Z={}){rH(Z,"bun");let J={...Z,platform:"javascript",runtime:{name:"bun",version:Bun.version},serverName:Z.serverName||global.process.env.SENTRY_NAME||aJ1.hostname()};if(J.transport=J.transport||nJ1,J.defaultIntegrations===void 0)J.defaultIntegrations=sJ1(J);return bf(J)}import{heapStats as t16}from"bun:jsc";if(process.env.NODE_ENV==="production"&&process.env.SENTRY_DSN)gf({dsn:process.env.SENTRY_DSN,release:$v,tracesSampleRate:1,initialScope:{tags:{gameId:process.env.HYTOPIA_GAME_ID??"unknown",gameSlug:process.env.HYTOPIA_GAME_SLUG??"unknown",lobbyId:process.env.HYTOPIA_LOBBY_ID??"unknown",region:process.env.REGION??"unknown"}},beforeSend:(Z)=>{return Z.extra=X8.getProcessStats(),Z},beforeSendTransaction:(Z)=>{if(Z.contexts?.trace?.op==="ticker_tick"){let $=Z?.start_timestamp,Y=Z?.timestamp;if(!$||!Y)return null;if((Y-$)*1000>30)return Z.measurements=X8.getProcessStats(!0),Z}return null}}),console.log("Telemetry: Sentry.io initialized!");class X8{static getProcessStats(Z=!1){let J=t16(),$=process.memoryUsage(),Y={jsHeapSizeMb:{value:J.heapSize/1024/1024,unit:"megabyte"},jsHeapCapacityMb:{value:J.heapCapacity/1024/1024,unit:"megabyte"},jsHeapUsagePercent:{value:J.heapSize/J.heapCapacity,unit:"percent"},processHeapSizeMb:{value:$.heapUsed/1024/1024,unit:"megabyte"},rssSizeMb:{value:$.rss/1024/1024,unit:"megabyte"}};if(Z)return Y;return Object.fromEntries(Object.entries(Y).map(([Q,W])=>[Q,W.value]))}static startSpan(Z,J){if(sH())return HQ({attributes:Z.attributes,name:Z.operation,op:Z.operation},J);else return J()}}var mf=new hY,Z86=5000,J86=1048576,$86=512;class I9 extends g0{static _cachedPacketsSerializedBuffer=new Map;static _packrBuffers=[];_closeTimeout=null;_wrtcDirectTransport=null;_wrtcClientServerTransport=null;_wrtcClientServerDataProducers=[];_wrtcClientServerDataConsumers=[];_wrtcServerClientTransport=null;_wrtcServerClientReliableDataProducer=null;_wrtcServerClientUnreliableDataProducer=null;_wrtcServerClientDataConsumers=[];_ws;id;constructor(Z,J){super();this.id=Z10(),this.onPacket(Y0.PacketId.CONNECTION,this._onConnectionPacket),this.onPacket(Y0.PacketId.HEARTBEAT,this._onHeartbeatPacket),this.bindWs(Z),q6.emit("CONNECTION.OPENED",{connection:this,req:J})}static getPackrBuffer(){if(I9._packrBuffers.length>0)return I9._packrBuffers.pop();return Buffer.allocUnsafe(J86)}static serializePackets(Z){for(let $ of Z)if(!Y0.isValidPacket($))return m.error(`Connection.serializePackets(): Invalid packet payload: ${JSON.stringify($)}`);let J=I9._cachedPacketsSerializedBuffer.get(Z);if(J)return J;return X8.startSpan({operation:"serialize_packets",attributes:{packets:Z.length,packetIds:Z.map(($)=>$[0]).join(","),"packetsSerializedBuffer.size":I9._packrBuffers.length}},($)=>{let Y=X8.startSpan({operation:"serialize_packets_encode"},()=>{let Q=I9.getPackrBuffer();mf.useBuffer(Q);let W=mf.pack(Z,$86),X=W.subarray(W.start,W.end);return I9._packrBuffers.push(Q),X});return $?.setAttribute("serializedBytes",Y.byteLength),I9._cachedPacketsSerializedBuffer.set(Z,Y),Y})}bindWs(Z){let J=this._closeTimeout!==null;if(J)clearTimeout(this._closeTimeout),this._closeTimeout=null;if(this._ws=Z,this._ws.binaryType="nodebuffer",this._ws.onmessage=($)=>this._onMessage($.data),this._ws.onclose=this._onWsClose,this._ws.onerror=this._onWsError,this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{i:this.id})],!0,!0),J)this.emitWithGlobal("CONNECTION.RECONNECTED",{connection:this});if(bJ.instance.isWrtcEnabled)this._upgradeToWRTC()}closeWrtc(){this._closeWrtcClientServerTransport(),this._closeWrtcServerClientTransport()}disconnect(){try{this._ws.close()}catch(Z){m.error(`Connection.disconnect(): Connection disconnect failed. Error: ${Z}`)}}onPacket(Z,J){this.on("CONNECTION.PACKET_RECEIVED",({packet:$})=>{if($[0]===Z)J($)})}send(Z,J=!0,$=!1){if(this._closeTimeout)return;if(this._ws.readyState!==e16.OPEN)return m.warning("Connection.send(): Connection is not open.");X8.startSpan({operation:"send_packets",attributes:{forceWs:$?"true":"false",wrtcConnected:this._wrtcServerClientTransport?.iceState==="completed"?"true":"false"}},()=>{try{let Y=I9.serializePackets(Z);if(!Y)return;if(this._wrtcServerClientTransport?.iceState==="completed"&&Y.length<(this._wrtcServerClientTransport?.sctpParameters?.maxMessageSize??0)&&!$)try{(J?this._wrtcServerClientReliableDataProducer:this._wrtcServerClientUnreliableDataProducer).send(Y)}catch{this._ws.send(Y)}else this._ws.send(Y);this.emitWithGlobal("CONNECTION.PACKETS_SENT",{connection:this,packets:Z})}catch(Y){m.error(`Connection.send(): Packet send failed. Error: ${Y}`)}})}_closeWrtcClientServerTransport(){this._wrtcDirectTransport?.close(),this._wrtcDirectTransport=null,this._wrtcClientServerTransport?.close(),this._wrtcClientServerTransport=null,this._wrtcClientServerDataProducers.forEach((Z)=>Z.close()),this._wrtcClientServerDataProducers=[],this._wrtcClientServerDataConsumers.forEach((Z)=>Z.close()),this._wrtcClientServerDataConsumers=[]}_closeWrtcServerClientTransport(){this._wrtcServerClientTransport?.close(),this._wrtcServerClientTransport=null,this._wrtcServerClientDataConsumers.forEach((Z)=>Z.close()),this._wrtcServerClientDataConsumers=[],this._wrtcServerClientReliableDataProducer?.close(),this._wrtcServerClientReliableDataProducer=null,this._wrtcServerClientUnreliableDataProducer?.close(),this._wrtcServerClientUnreliableDataProducer=null}_onConnectionPacket=async(Z)=>{let J=Z[1],$=J.c,Y=J.d;if($){let{i:Q,d:W}=$,X=!1;if(Q==this._wrtcClientServerTransport?.id)await this._wrtcClientServerTransport.connect({dtlsParameters:W}),X=!0;if(Q==this._wrtcServerClientTransport?.id)await this._wrtcServerClientTransport.connect({dtlsParameters:W}),X=!0;if(X)this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{ca:{i:Q}})])}if(Y)for(let Q of Y){let{s:W,l:X}=Q,K=await this._wrtcClientServerTransport.produceData({label:X,sctpStreamParameters:W}),G=await this._wrtcDirectTransport.consumeData({dataProducerId:K.id});this._wrtcClientServerDataProducers.push(K),this._wrtcClientServerDataConsumers.push(G),G.on("message",(z)=>this._onMessage(z)),this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{pa:{i:K.id,l:X}})])}};_onHeartbeatPacket=()=>{this.send([Y0.createPacket(Y0.bidirectionalPackets.heartbeatPacketDefinition,null)],!0,!0)};_onMessage=(Z)=>{try{let J=this._deserialize(Z);if(!J)return;this.emitWithGlobal("CONNECTION.PACKET_RECEIVED",{connection:this,packet:J})}catch(J){m.error(`Connection._ws.onmessage(): Error: ${J}`)}};_onWrtcIceStateChange=(Z,J)=>{if(["disconnected","closed"].includes(J)){if(Z==this._wrtcClientServerTransport)this._closeWrtcClientServerTransport();else if(Z==this._wrtcServerClientTransport)this._closeWrtcServerClientTransport()}};_onWsClose=()=>{this.closeWrtc(),this.emitWithGlobal("CONNECTION.DISCONNECTED",{connection:this}),this._closeTimeout=setTimeout(()=>{this.emitWithGlobal("CONNECTION.CLOSED",{connection:this}),this.offAll()},Z86)};_onWsError=(Z)=>{this.emitWithGlobal("CONNECTION.ERROR",{connection:this,error:Z})};_upgradeToWRTC=async()=>{let Z=await bJ.instance.createWrtcTransports();if(!Z)return!1;let{directTransport:J,clientServerTransport:$,serverClientTransport:Y}=Z;this._wrtcDirectTransport=J,this._wrtcClientServerTransport=$,this._wrtcClientServerTransport.on("icestatechange",(X)=>{this._onWrtcIceStateChange(this._wrtcClientServerTransport,X)}),this._wrtcServerClientTransport=Y,this._wrtcServerClientTransport.on("icestatechange",(X)=>{this._onWrtcIceStateChange(this._wrtcServerClientTransport,X)}),this._wrtcServerClientReliableDataProducer=await this._wrtcServerClientTransport.produceData({label:"scr",sctpStreamParameters:{streamId:0,ordered:!0}}),this._wrtcServerClientUnreliableDataProducer=await this._wrtcServerClientTransport.produceData({label:"scu",sctpStreamParameters:{streamId:1,ordered:!1,maxPacketLifeTime:35}});let Q=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientReliableDataProducer.id}),W=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientUnreliableDataProducer.id});return this._wrtcServerClientDataConsumers.push(Q,W),this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{d:[{i:Q.id,pi:Q.dataProducerId,l:"scr",s:Q.sctpStreamParameters},{i:W.id,pi:W.dataProducerId,l:"scu",s:W.sctpStreamParameters}],t:[{i:this._wrtcClientServerTransport.id,f:"cs",d:this._wrtcClientServerTransport.dtlsParameters,ic:this._wrtcClientServerTransport.iceCandidates,ip:this._wrtcClientServerTransport.iceParameters,s:this._wrtcClientServerTransport.sctpParameters},{i:this._wrtcServerClientTransport.id,f:"sc",d:this._wrtcServerClientTransport.dtlsParameters,ic:this._wrtcServerClientTransport.iceCandidates,ip:this._wrtcServerClientTransport.iceParameters,s:this._wrtcServerClientTransport.sctpParameters}]})]),!0};_deserialize(Z){let J=mf.unpack(Z);if(!J||typeof J!=="object"||typeof J[0]!=="number")return m.error(`Connection._deserialize(): Invalid packet format. Packet: ${JSON.stringify(J)}`);if(!Y0.isValidPacket(J))return m.error(`Connection._deserialize(): Invalid packet payload. Packet: ${JSON.stringify(J)}`);return J}}var oJ1;((Y)=>{Y.PLAYER_CONNECTED="PLAYER_MANAGER.PLAYER_CONNECTED";Y.PLAYER_DISCONNECTED="PLAYER_MANAGER.PLAYER_DISCONNECTED";Y.PLAYER_RECONNECTED="PLAYER_MANAGER.PLAYER_RECONNECTED"})(oJ1||={});class e5{static instance=new e5;_connectionPlayers=new Map;constructor(){q6.on("CONNECTION.OPENED",({connection:Z,req:J})=>{this._onConnectionOpened(Z,J.session)}),q6.on("CONNECTION.DISCONNECTED",({connection:Z})=>{this._onConnectionDisconnected(Z)}),q6.on("CONNECTION.RECONNECTED",({connection:Z})=>{this._onConnectionReconnected(Z)}),q6.on("CONNECTION.CLOSED",({connection:Z})=>{this._onConnectionClosed(Z)})}get playerCount(){return this._connectionPlayers.size}getConnectedPlayers(){return Array.from(this._connectionPlayers.values())}getConnectedPlayersByWorld(Z){return this.getConnectedPlayers().filter((J)=>J.world===Z)}getConnectedPlayerByUsername(Z){return Array.from(this._connectionPlayers.values()).find((J)=>{return J.username.toLowerCase()===Z.toLowerCase()})}_onConnectionOpened(Z,J){let $=new w3(Z,J);this._connectionPlayers.set(Z,$),q6.emit("PLAYER_MANAGER.PLAYER_CONNECTED",{player:$})}_onConnectionDisconnected(Z){let J=this._connectionPlayers.get(Z);if(J)J.resetInputs(),J.camera.reset()}_onConnectionReconnected(Z){let J=this._connectionPlayers.get(Z);if(J)J.reconnect(),q6.emit("PLAYER_MANAGER.PLAYER_RECONNECTED",{player:J});else m.warning(`PlayerManager._onConnectionReconnected(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}_onConnectionClosed(Z){let J=this._connectionPlayers.get(Z);if(J)J.disconnect(),this._connectionPlayers.delete(Z),q6.emit("PLAYER_MANAGER.PLAYER_DISCONNECTED",{player:J});else m.warning(`PlayerManager._onConnectionClosed(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}}var S8=16,B3=S8-1,rJ1=S8**3,Y86=[{neighborOffset:[-1,0,0],generateVertices:(Z,J,$)=>[Z+0,J+0,$+0,Z+0,J+0,$+1,Z+0,J+1,$+0,Z+0,J+1,$+0,Z+0,J+0,$+1,Z+0,J+1,$+1]},{neighborOffset:[1,0,0],generateVertices:(Z,J,$)=>[Z+1,J+0,$+0,Z+1,J+1,$+0,Z+1,J+0,$+1,Z+1,J+1,$+0,Z+1,J+1,$+1,Z+1,J+0,$+1]},{neighborOffset:[0,-1,0],generateVertices:(Z,J,$)=>[Z+0,J+0,$+0,Z+1,J+0,$+0,Z+0,J+0,$+1,Z+1,J+0,$+0,Z+1,J+0,$+1,Z+0,J+0,$+1]},{neighborOffset:[0,1,0],generateVertices:(Z,J,$)=>[Z+0,J+1,$+0,Z+0,J+1,$+1,Z+1,J+1,$+0,Z+1,J+1,$+0,Z+0,J+1,$+1,Z+1,J+1,$+1]},{neighborOffset:[0,0,-1],generateVertices:(Z,J,$)=>[Z+0,J+0,$+0,Z+0,J+1,$+0,Z+1,J+0,$+0,Z+0,J+1,$+0,Z+1,J+1,$+0,Z+1,J+0,$+0]},{neighborOffset:[0,0,1],generateVertices:(Z,J,$)=>[Z+0,J+0,$+1,Z+1,J+0,$+1,Z+0,J+1,$+1,Z+0,J+1,$+1,Z+1,J+0,$+1,Z+1,J+1,$+1]}],uf;((Y)=>{Y.DESPAWN="CHUNK.DESPAWN";Y.SET_BLOCK="CHUNK.SET_BLOCK";Y.SPAWN="CHUNK.SPAWN"})(uf||={});class g6 extends g0{_blocks;_originCoordinate;_requiresUpdate=!1;_rigidBody;_world;constructor(){super();this._blocks=new Uint8Array(rJ1)}get blocks(){return this._blocks}get requiresUpdate(){return this._requiresUpdate}get isSimulated(){return!!this._rigidBody}get isSpawned(){return!!this._originCoordinate&&!!this._world}get originCoordinate(){return this._originCoordinate}get world(){return this._world}static blockIndexToLocalCoordinate(Z){return{x:Z%S8,y:(Z/S8|0)%S8,z:Z/(S8*S8)|0}}static globalCoordinateToLocalCoordinate(Z){return{x:Z.x&S8-1,y:Z.y&S8-1,z:Z.z&S8-1}}static globalCoordinateToOriginCoordinate(Z){return{x:Z.x&~(S8-1),y:Z.y&~(S8-1),z:Z.z&~(S8-1)}}static isValidOriginCoordinate(Z){return Z.x%S8===0&&Z.y%S8===0&&Z.z%S8===0}spawn(Z,J){if(this.isSpawned){let{x:$,y:Y,z:Q}=this.originCoordinate;return m.error(`Chunk.spawn(): Chunk is already spawned at origin ${$}, ${Y}, ${Q}!`)}if(!g6.isValidOriginCoordinate(J))return m.error(`Chunk.spawn(): Chunk coordinates must be divisible by ${S8}`);this._originCoordinate=J,this._world=Z,this._world.chunkLattice.registerChunk(this),this._requiresUpdate=!0}despawn(){if(!this.isSpawned)return m.error("Chunk.despawn(): Chunk has not been spawned and cannot be despawned!");this.emitWithWorld(this._world,"CHUNK.DESPAWN",{chunk:this}),this._removeFromSimulation(),this._world.chunkLattice.unregisterChunk(this),this._originCoordinate=void 0,this._world=void 0}getBlockId(Z){return this._blocks[this._getIndex(Z)]}hasBlock(Z){return this._blocks[this._getIndex(Z)]!==0}setBlock(Z,J){if(!this._isValidLocalCoordinate(Z))return m.error("Chunk.setBlock(): Block local coordinate is out of bounds");if(this._blocks[this._getIndex(Z)]===J)return;if(this._blocks[this._getIndex(Z)]=J,this.isSpawned&&this.isSimulated){this.emitWithWorld(this._world,"CHUNK.SET_BLOCK",{chunk:this,globalCoordinate:this._getGlobalCoordinate(Z),localCoordinate:Z,blockTypeId:J});let $=this._getGlobalCoordinate(Z),Y=[];if(Z.x===0)Y.push({x:-1,y:0,z:0});if(Z.y===0)Y.push({x:0,y:-1,z:0});if(Z.z===0)Y.push({x:0,y:0,z:-1});if(Z.x===B3)Y.push({x:1,y:0,z:0});if(Z.y===B3)Y.push({x:0,y:1,z:0});if(Z.z===B3)Y.push({x:0,y:0,z:1});for(let Q of Y){let W={x:$.x+Q.x,y:$.y+Q.y,z:$.z+Q.z},X=g6.globalCoordinateToOriginCoordinate(W),K=this._world?.chunkLattice.getChunk(X);if(!K?.hasBlock(g6.globalCoordinateToLocalCoordinate(W)))continue;K.setRequiresUpdate(!0)}}this._requiresUpdate=!0}setRequiresUpdate(Z){this._requiresUpdate=Z}update(){if(!this._requiresUpdate)return;if(!this.isSpawned)return m.error("Chunk.update(): Chunk is not spawned and cannot be updated.");let Z=!this._rigidBody,J=this._world.simulation;if(this._removeFromSimulation(),this._rigidBody=new DY({type:"fixed",position:this._originCoordinate,simulation:this._world.simulation}),this._meshColliders().map(([$,Y])=>{if(!$.isSimulated)$.addToSimulation(J,this._rigidBody);J.colliderMap.setColliderBlockType($,Y)}),this._requiresUpdate=!1,Z)this.emitWithWorld(this._world,"CHUNK.SPAWN",{chunk:this})}serialize(){return p0.serializeChunk(this)}_meshColliders(){if(!this._world)return m.error("Chunk._meshColliders(): Chunk is not spawned and cannot be meshed."),[];let Z=new Map,J=[];for(let Y=0;Y<rJ1;Y++){if(this._blocks[Y]===0)continue;let Q=this._blocks[Y],W=this._world.blockTypeRegistry.getBlockType(Q),{x:X,y:K,z:G}=g6.blockIndexToLocalCoordinate(Y);if(!W.isMeshable){let H=W.createCollider();H.setRelativePosition({x:X,y:K,z:G}),J.push([H,W]);continue}let z=Z.get(W)??{indices:[],vertices:[]};Z.set(W,z);for(let H of Y86){let[V,q,F]=H.neighborOffset,U={x:X+V,y:K+q,z:G+F},w=this._getGlobalCoordinate(U),L=this._world.chunkLattice.getBlockType(w);if(L&&!L.isLiquid)continue;let O=z.indices.length;z.indices.push(O,O+1,O+2,O+3,O+4,O+5),z.vertices.push(...H.generateVertices(X,K,G))}}let $=[];return Z.forEach((Y,Q)=>{if(!Y.indices.length)return;let W=Q.createCollider(new Uint32Array(Y.indices),new Float32Array(Y.vertices));$.push([W,Q])}),[...J,...$]}_removeFromSimulation(){if(!this._rigidBody||!this._world)return;this._rigidBody.removeFromSimulation(),this._rigidBody=void 0}_getGlobalCoordinate(Z){if(!this.originCoordinate)m.fatalError("Chunk._getGlobalCoordinate(): Chunk is not spawned, calculating global coordinate is impossible.");return{x:this.originCoordinate.x+Z.x,y:this.originCoordinate.y+Z.y,z:this.originCoordinate.z+Z.z}}_getIndex(Z){return Z.x+S8*(Z.y+S8*Z.z)}_isValidLocalCoordinate(Z){return Z.x>=0&&Z.x<=B3&&Z.y>=0&&Z.y<=B3&&Z.z>=0&&Z.z<=B3}}class Eq{_chunks=new Map;_world;constructor(Z){this._world=Z}get chunkCount(){return this._chunks.size}registerChunk(Z){if(!Z.isSpawned)return m.error("ChunkLattice.registerChunk(): Chunk is not spawned.");if(this.hasChunk(Z.originCoordinate)){let{x:J,y:$,z:Y}=Z.originCoordinate;return m.error(`ChunkLattice.registerChunk(): Chunk exists at origin (${J}, ${$}, ${Y}), despawn the current chunk before registering another at the same origin.`)}if(Z.world.id!==this._world.id)return m.error("ChunkLattice.registerChunk(): Chunk world does not match lattice world.");this._chunks.set(this._getChunkKey(Z.originCoordinate),Z)}unregisterChunk(Z){if(!Z.isSpawned)return m.error("ChunkLattice.unregisterChunk(): Chunk is not spawned.");if(Z.world.id!==this._world.id)return m.error("ChunkLattice.unregisterChunk(): Chunk world does not match lattice world.");this._chunks.delete(this._getChunkKey(Z.originCoordinate))}clear(){this._chunks.forEach((Z)=>Z.despawn()),this._chunks.clear()}getBlockId(Z){let J=this.getChunk(g6.globalCoordinateToOriginCoordinate(Z));if(!J)return 0;return J.getBlockId(g6.globalCoordinateToLocalCoordinate(Z))}getBlockType(Z){let J=this.getBlockId(Z);return J?this._world.blockTypeRegistry.getBlockType(J):null}getChunk(Z){if(!g6.isValidOriginCoordinate(Z)){m.error(`ChunkLattice.getChunk(): Chunk coordinates must be divisible by CHUNK_SIZE (${S8})`);return}return this._chunks.get(this._getChunkKey(Z))}getAllChunks(){return Array.from(this._chunks.values())}hasBlock(Z){let J=this.getChunk(g6.globalCoordinateToOriginCoordinate(Z));if(!J)return!1;return J.hasBlock(g6.globalCoordinateToLocalCoordinate(Z))}hasChunk(Z){return this._chunks.has(this._getChunkKey(Z))}setBlock(Z,J){let $=g6.globalCoordinateToLocalCoordinate(Z),Y=g6.globalCoordinateToOriginCoordinate(Z),Q=this.getChunk(Y);if(!Q)Q=new g6,Q.spawn(this._world,Y);Q.setBlock($,J)}updateChunks(){this._chunks.forEach((Z)=>{if(Z.requiresUpdate)Z.update()})}_getChunkKey(Z){return`${Z.x},${Z.y},${Z.z}`}}var tJ1={type:"dynamic",softCcdPrediction:1},eJ1=0.0025000000000000005,Z$1=Math.cos(0.005),Iq;((O)=>{O.BLOCK_COLLISION="ENTITY.BLOCK_COLLISION";O.BLOCK_CONTACT_FORCE="ENTITY.BLOCK_CONTACT_FORCE";O.DESPAWN="ENTITY.DESPAWN";O.ENTITY_COLLISION="ENTITY.ENTITY_COLLISION";O.ENTITY_CONTACT_FORCE="ENTITY.ENTITY_CONTACT_FORCE";O.SET_MODEL_ANIMATIONS_PLAYBACK_RATE="ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE";O.SET_MODEL_HIDDEN_NODES="ENTITY.SET_MODEL_HIDDEN_NODES";O.SET_OPACITY="ENTITY.SET_OPACITY";O.SET_PARENT="ENTITY.SET_PARENT";O.SET_TINT_COLOR="ENTITY.SET_TINT_COLOR";O.SPAWN="ENTITY.SPAWN";O.START_MODEL_LOOPED_ANIMATIONS="ENTITY.START_MODEL_LOOPED_ANIMATIONS";O.START_MODEL_ONESHOT_ANIMATIONS="ENTITY.START_MODEL_ONESHOT_ANIMATIONS";O.STOP_MODEL_ANIMATIONS="ENTITY.STOP_MODEL_ANIMATIONS";O.TICK="ENTITY.TICK";O.UPDATE_POSITION="ENTITY.UPDATE_POSITION";O.UPDATE_ROTATION="ENTITY.UPDATE_ROTATION"})(Iq||={});class a8 extends DY{_id;_blockHalfExtents;_blockTextureUri;_controller;_modelAnimationsPlaybackRate=1;_modelHiddenNodes=new Set;_modelLoopedAnimations=new Set;_modelOneshotAnimations=new Set;_modelPreferredShape;_modelScale;_modelUri;_name;_opacity;_parent;_parentNodeName;_tag;_tintColor;_lastUpdatedPosition={x:0,y:0,z:0};_lastUpdatedRotation={x:0,y:0,z:0,w:1};_lastParentlessType="dynamic";_world;constructor(Z){let J="blockTextureUri"in Z,$="modelUri"in Z;if(!J===!$)m.fatalError("Entity.constructor(): Entity data must include a blockTextureUri or modelUri, but not both.");if(J&&!Z.blockHalfExtents)m.fatalError("Entity.constructor(): Block entity must have blockHalfExtents!");if(Z.parent&&!Z.parent.isSpawned)m.fatalError("Entity.constructor(): Parent entity must be spawned before child entity!");if(Z.parent?.modelUri&&Z.parentNodeName&&!N9.instance.modelHasNode(Z.parent.modelUri,Z.parentNodeName))m.fatalError(`Entity.constructor(): Parent node name ${Z.parentNodeName} not found in parent model ${Z.parent.modelUri}!`);super(Z.rigidBodyOptions??tJ1);if(J)this._blockHalfExtents=Z.blockHalfExtents,this._blockTextureUri=Z.blockTextureUri;if($)this._modelAnimationsPlaybackRate=Z.modelAnimationsPlaybackRate??1,this._modelPreferredShape=Z.modelPreferredShape,this._modelScale=Z.modelScale,this._modelUri=Z.modelUri,Z.modelHiddenNodes?.forEach((Y)=>this._modelHiddenNodes.add(Y.toLowerCase())),Z.modelLoopedAnimations?.forEach((Y)=>this._modelLoopedAnimations.add(Y));if(this._name=Z.name??"Nameless",this._opacity=Z.opacity??1,this._parent=Z.parent,this._parentNodeName=Z.parentNodeName,this._tag=Z.tag,this._tintColor=Z.tintColor,Z.controller)this.setController(Z.controller)}get id(){return this._id}get blockHalfExtents(){return this._blockHalfExtents}get blockTextureUri(){return this._blockTextureUri}get controller(){return this._controller}get height(){return this.isModelEntity?N9.instance.getHeight(this._modelUri)*(this._modelScale??1):this._blockHalfExtents.y*2}get modelAnimationsPlaybackRate(){return this._modelAnimationsPlaybackRate}get modelHiddenNodes(){return this._modelHiddenNodes}get modelLoopedAnimations(){return this._modelLoopedAnimations}get modelPreferredShape(){return this._modelPreferredShape}get modelScale(){return this._modelScale}get modelUri(){return this._modelUri}get name(){return this._name}get opacity(){return this._opacity}get parent(){return this._parent}get parentNodeName(){return this._parentNodeName}get tag(){return this._tag}get tintColor(){return this._tintColor}get isBlockEntity(){return!!this._blockTextureUri}get isModelEntity(){return!!this._modelUri}get isSpawned(){return!!this._world}get world(){return this._world}spawn(Z,J,$){if(this.isSpawned)return m.error(`Entity.spawn(): Entity ${this._name} is already spawned with id ${this._id}!`);if(!this.isSimulated)this.addToSimulation(Z.simulation);if(this._blockTextureUri&&this._blockHalfExtents&&this.numColliders===0)this.addChildColliderToSimulation(new a5(a5.optionsFromBlockHalfExtents(this._blockHalfExtents)));if(this._modelUri&&this.numColliders===0&&this._modelPreferredShape!=="none")this.addChildColliderToSimulation(new a5(a5.optionsFromModelUri(this._modelUri,this._modelScale,this._modelPreferredShape)));if(this.colliders.forEach((Y)=>{if(this.hasListeners("ENTITY.BLOCK_COLLISION")||this.hasListeners("ENTITY.ENTITY_COLLISION"))Y.enableCollisionEvents(!0);if(this.hasListeners("ENTITY.BLOCK_CONTACT_FORCE")||this.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))Y.enableContactForceEvents(!0);if(X4.isDefaultCollisionGroups(Y.collisionGroups))Y.setCollisionGroups({belongsTo:[Y.isSensor?4:2],collidesWith:[65535]})}),this.setPosition(J),$)this.setRotation($);if(this._id=Z.entityManager.registerEntity(this),this._world=Z,this._controller)this._controller.spawn(this);if(this._parent)this.setParent(this._parent,this._parentNodeName,J,$);this.colliders.forEach((Y)=>{Z.simulation.colliderMap.setColliderEntity(Y,this)}),this.emitWithWorld(Z,"ENTITY.SPAWN",{entity:this})}despawn(){if(!this._requireSpawned("despawn"))return;if(this._world.entityManager.getEntityChildren(this).forEach((Z)=>{Z.despawn()}),this._controller)this._controller.detach(this),this._controller.despawn(this);if(this.emitWithWorld(this._world,"ENTITY.DESPAWN",{entity:this}),this.isSimulated)this.removeFromSimulation();this._world.entityManager.unregisterEntity(this),this._world.audioManager.unregisterEntityAttachedAudios(this),this._world.lightManager.despawnEntityAttachedLights(this),this._world.sceneUIManager.unloadEntityAttachedSceneUIs(this),this._id=void 0,this._world=void 0}setModelAnimationsPlaybackRate(Z){if(!this._requireSpawned("setModelAnimationsPlaybackRate"))return;if(!this.isModelEntity||this._modelAnimationsPlaybackRate===Z)return;this._modelAnimationsPlaybackRate=Z,this.emitWithWorld(this._world,"ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE",{entity:this,playbackRate:Z})}setController(Z){if(this._controller===Z)return;if(this._controller)this._controller.detach(this);if(this._controller=Z,this._controller)this._controller.attach(this)}setModelHiddenNodes(Z){if(!this._requireSpawned("setModelHiddenNodes"))return;this._modelHiddenNodes=new Set(Z.map((J)=>J.toLowerCase())),this.emitWithWorld(this._world,"ENTITY.SET_MODEL_HIDDEN_NODES",{entity:this,modelHiddenNodes:this._modelHiddenNodes})}setOpacity(Z){if(!this._requireSpawned("setOpacity"))return;if(this._opacity===Z)return;this._opacity=Z,this.emitWithWorld(this._world,"ENTITY.SET_OPACITY",{entity:this,opacity:Z})}setParent(Z,J,$,Y){if(!this._requireSpawned("setParent"))return;if(Z&&!Z.isSpawned)return m.error("Entity.setParent(): Parent entity is not spawned, cannot set parent!");if(!this._parent&&Z)this._lastParentlessType=this.type;if(this._parent=Z,this._parentNodeName=J,this.colliders.forEach((Q)=>Q.setEnabled(!Z)),this.setType(!Z?this._lastParentlessType:"kinematic_velocity"),this.setPosition($??{x:0,y:0,z:0}),this.setRotation(Y??{x:0,y:0,z:0,w:1}),!this.isKinematicPositionBased)this.resetAngularVelocity(),this.resetForces(),this.resetLinearVelocity(),this.resetTorques();this.emitWithWorld(this._world,"ENTITY.SET_PARENT",{entity:this,parent:Z,parentNodeName:J})}setTintColor(Z){if(!this._requireSpawned("setTintColor"))return;if(!Z&&!this._tintColor||Z&&this._tintColor&&Z.r===this._tintColor.r&&Z.g===this._tintColor.g&&Z.b===this._tintColor.b)return;this._tintColor=Z,this.emitWithWorld(this._world,"ENTITY.SET_TINT_COLOR",{entity:this,tintColor:Z})}startModelLoopedAnimations(Z){if(!this._requireSpawned("startModelLoopedAnimations"))return;if(!this.isModelEntity||!Z.length)return;if(!Z.some((J)=>!this._modelLoopedAnimations.has(J)))return;Z.forEach((J)=>{this._modelLoopedAnimations.add(J)}),this.emitWithWorld(this._world,"ENTITY.START_MODEL_LOOPED_ANIMATIONS",{entity:this,animations:new Set(Z)})}startModelOneshotAnimations(Z){if(!this._requireSpawned("startModelOneshotAnimations"))return;if(!this.isModelEntity||!Z.length)return;Z.forEach((J)=>{this._modelOneshotAnimations.add(J)}),this.emitWithWorld(this._world,"ENTITY.START_MODEL_ONESHOT_ANIMATIONS",{entity:this,animations:new Set(Z)})}stopModelAnimations(Z){if(!this._requireSpawned("stopModelAnimations"))return;if(!this.isModelEntity||!Z.length)return;if(!Z.some((J)=>this._modelLoopedAnimations.has(J))&&!Z.some((J)=>this._modelOneshotAnimations.has(J)))return;Z.forEach((J)=>{this._modelLoopedAnimations.delete(J),this._modelOneshotAnimations.delete(J)}),this.emitWithWorld(this._world,"ENTITY.STOP_MODEL_ANIMATIONS",{entity:this,animations:new Set(Z)})}serialize(){return p0.serializeEntity(this)}tick(Z){if(this.emit("ENTITY.TICK",{entity:this,tickDeltaMs:Z}),this._controller)this._controller.tick(this,Z)}checkAndEmitUpdates(){if(!this._requireSpawned("checkAndEmitUpdates"))return;let Z=this.position,J=this.rotation;if(this._rotationExceedsThreshold(J,this._lastUpdatedRotation))this._lastUpdatedRotation=J,this.emitWithWorld(this._world,"ENTITY.UPDATE_ROTATION",{entity:this,rotation:J});if(this._positionExceedsThreshold(Z,this._lastUpdatedPosition))this._lastUpdatedPosition=Z,this.emitWithWorld(this._world,"ENTITY.UPDATE_POSITION",{entity:this,position:Z})}_requireSpawned(Z){if(!this.isSpawned)m.error(`Entity._requireSpawned(): Entity ${this._name} is not spawned, cannot invoke ${Z}()!`);return this.isSpawned}_positionExceedsThreshold(Z,J){let $=Z.x-J.x,Y=Z.y-J.y,Q=Z.z-J.z;return $*$+Y*Y+Q*Q>eJ1}_rotationExceedsThreshold(Z,J){return Math.abs(Z.x*J.x+Z.y*J.y+Z.z*J.z+Z.w*J.w)<Z$1}}var df;((K)=>{K.LOAD="SCENE_UI.LOAD";K.SET_ATTACHED_TO_ENTITY="SCENE_UI.SET_ATTACHED_TO_ENTITY";K.SET_OFFSET="SCENE_UI.SET_OFFSET";K.SET_POSITION="SCENE_UI.SET_POSITION";K.SET_STATE="SCENE_UI.SET_STATE";K.SET_VIEW_DISTANCE="SCENE_UI.SET_VIEW_DISTANCE";K.UNLOAD="SCENE_UI.UNLOAD"})(df||={});class vq extends g0{_id;_attachedToEntity;_offset;_position;_state={};_templateId;_viewDistance;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)m.fatalError("Either attachedToEntity or position must be set, but not both");super();this._attachedToEntity=Z.attachedToEntity,this._offset=Z.offset,this._position=Z.position,this._state=Z.state??{},this._templateId=Z.templateId,this._viewDistance=Z.viewDistance}get id(){return this._id}get attachedToEntity(){return this._attachedToEntity}get isLoaded(){return this._id!==void 0}get offset(){return this._offset}get position(){return this._position}get state(){return this._state}get templateId(){return this._templateId}get viewDistance(){return this._viewDistance}get world(){return this._world}load(Z){if(this.isLoaded)return;if(this._attachedToEntity&&!this._attachedToEntity.isSpawned)return m.error(`SceneUI.load(): Attached entity ${this._attachedToEntity.id} must be spawned before loading SceneUI!`);this._id=Z.sceneUIManager.registerSceneUI(this),this._world=Z,this.emitWithWorld(Z,"SCENE_UI.LOAD",{sceneUI:this})}setAttachedToEntity(Z){if(!Z.isSpawned)return m.error(`SceneUI.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);if(this._attachedToEntity===Z)return;if(this._attachedToEntity=Z,this._position=void 0,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_ATTACHED_TO_ENTITY",{sceneUI:this,entity:Z})}setOffset(Z){if(this._offset===Z)return;if(this._offset=Z,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_OFFSET",{sceneUI:this,offset:Z})}setPosition(Z){if(this._position===Z)return;if(this._attachedToEntity=void 0,this._position=Z,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_POSITION",{sceneUI:this,position:Z})}setState(Z){if(this._state={...this._state,...Z},this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_STATE",{sceneUI:this,state:this._state})}setViewDistance(Z){if(this._viewDistance=Z,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_VIEW_DISTANCE",{sceneUI:this,viewDistance:Z})}unload(){if(!this.isLoaded||!this._world)return;this._world.sceneUIManager.unregisterSceneUI(this),this.emitWithWorld(this._world,"SCENE_UI.UNLOAD",{sceneUI:this}),this._id=void 0,this._world=void 0}serialize(){return p0.serializeSceneUI(this)}}class d7 extends a8{player;nametagSceneUI;constructor(Z){super(Z);this.player=Z.player,this.nametagSceneUI=new vq({templateId:"hytopia:nametag",attachedToEntity:this,offset:{x:0,y:1,z:0},viewDistance:15,state:{username:this.player.username,profilePictureUrl:this.player.profilePictureUrl}})}spawn(Z,J,$){super.spawn(Z,J,$),this.nametagSceneUI.load(Z),this.player.on("PLAYER.CHAT_MESSAGE_SEND",({message:Y})=>{this.nametagSceneUI.setState({chat:Y})})}tick(Z){if(!this.isSpawned||!this.world)return;if(!this.controller)return m.error(`PlayerEntity.tick(): PlayerEntity "${this.name}" must have a controller.`);let{input:J,camera:$}=this.player;this.controller.tickWithPlayerInput(this,J,$.orientation,Z),super.tick(Z)}}class _q{_entities=new Map;_nextEntityId=1;_world;constructor(Z){this._world=Z}get entityCount(){return this._entities.size}get world(){return this._world}registerEntity(Z){if(Z.id!==void 0)m.fatalError(`EntityManager.registerEntity(): Entity ${Z.name} is already assigned the id ${Z.id}!`);let J=this._nextEntityId;return this._entities.set(J,Z),this._nextEntityId++,J}unregisterEntity(Z){if(Z.id===void 0)return m.error(`EntityManager.unregisterEntity(): Entity ${Z.name} is not assigned an id!`);this._entities.delete(Z.id)}getAllEntities(){return Array.from(this._entities.values())}getAllPlayerEntities(){let Z=[];return this._entities.forEach((J)=>{if(J instanceof d7)Z.push(J)}),Z}getPlayerEntitiesByPlayer(Z){let J=[];return this._entities.forEach(($)=>{if($ instanceof d7&&$.player===Z)J.push($)}),J}getEntity(Z){return this._entities.get(Z)}getEntitiesByTag(Z){let J=[];return this._entities.forEach(($)=>{if($.tag===Z)J.push($)}),J}getEntitiesByTagSubstring(Z){let J=[];return this._entities.forEach(($)=>{if($.tag?.includes(Z))J.push($)}),J}getEntityChildren(Z){let J=[];return this._entities.forEach(($)=>{if($.parent===Z)J.push($)}),J}tickEntities(Z){this._entities.forEach((J)=>{J.tick(Z)})}checkAndEmitUpdates(){this._entities.forEach((Z)=>{if(!Z.isSpawned)return;Z.checkAndEmitUpdates()})}}class Aq{_lights=new Map;_nextLightId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}despawnEntityAttachedLights(Z){this.getAllEntityAttachedLights(Z).forEach((J)=>{J.despawn()})}getAllLights(){return Array.from(this._lights.values())}getAllEntityAttachedLights(Z){return this.getAllLights().filter((J)=>J.attachedToEntity===Z)}registerLight(Z){if(Z.id!==void 0)return Z.id;let J=this._nextLightId;return this._lights.set(J,Z),this._nextLightId++,J}unregisterLight(Z){if(Z.id===void 0)return;this._lights.delete(Z.id)}}var J$1;(($)=>{$[$.POINTLIGHT=0]="POINTLIGHT";$[$.SPOTLIGHT=1]="SPOTLIGHT"})(J$1||={});var cf;((q)=>{q.DESPAWN="LIGHT.DESPAWN";q.SET_ANGLE="LIGHT.SET_ANGLE";q.SET_ATTACHED_TO_ENTITY="LIGHT.SET_ATTACHED_TO_ENTITY";q.SET_COLOR="LIGHT.SET_COLOR";q.SET_DISTANCE="LIGHT.SET_DISTANCE";q.SET_INTENSITY="LIGHT.SET_INTENSITY";q.SET_OFFSET="LIGHT.SET_OFFSET";q.SET_PENUMBRA="LIGHT.SET_PENUMBRA";q.SET_POSITION="LIGHT.SET_POSITION";q.SET_TRACKED_ENTITY="LIGHT.SET_TRACKED_ENTITY";q.SET_TRACKED_POSITION="LIGHT.SET_TRACKED_POSITION";q.SPAWN="LIGHT.SPAWN"})(cf||={});class lf extends g0{_id;_angle;_attachedToEntity;_color;_distance;_intensity;_offset;_penumbra;_position;_trackedEntity;_trackedPosition;_type;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)m.fatalError("Either attachedToEntity or position must be set, but not both");super();m.warning("WARNING: Lights are poorly optimized at this time. Using more than a few lights in your game can cause extremely bad performance (FPS) issues. Use lights sparingly!"),this._angle=Z.angle,this._attachedToEntity=Z.attachedToEntity,this._color=Z.color??{r:255,g:255,b:255},this._distance=Z.distance,this._intensity=Z.intensity??1,this._offset=Z.offset,this._penumbra=Z.penumbra,this._position=Z.position,this._trackedEntity=Z.trackedEntity,this._trackedPosition=Z.trackedPosition,this._type=Z.type??0}get id(){return this._id}get angle(){return this._angle}get attachedToEntity(){return this._attachedToEntity}get color(){return this._color}get distance(){return this._distance}get intensity(){return this._intensity}get isSpawned(){return this._id!==void 0}get offset(){return this._offset}get penumbra(){return this._penumbra}get position(){return this._position}get trackedEntity(){return this._trackedEntity}get trackedPosition(){return this._trackedPosition}get type(){return this._type}get world(){return this._world}setAngle(Z){if(this._angle===Z)return;if(this._angle=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_ANGLE",{light:this,angle:Z})}setAttachedToEntity(Z){if(!Z.isSpawned)return m.error(`Light.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);if(this._attachedToEntity===Z)return;if(this._attachedToEntity=Z,this._position=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_ATTACHED_TO_ENTITY",{light:this,entity:Z})}setColor(Z){if(this._color.r===Z.r&&this._color.g===Z.g&&this._color.b===Z.b)return;if(this._color=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_COLOR",{light:this,color:Z})}setDistance(Z){if(this._distance===Z)return;if(this._distance=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_DISTANCE",{light:this,distance:Z})}setIntensity(Z){if(this._intensity===Z)return;if(this._intensity=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_INTENSITY",{light:this,intensity:Z})}setOffset(Z){if(this._offset===Z)return;if(this._offset=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_OFFSET",{light:this,offset:Z})}setPenumbra(Z){if(this._penumbra===Z)return;if(this._penumbra=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_PENUMBRA",{light:this,penumbra:Z})}setPosition(Z){if(this._position===Z)return;if(this._position=Z,this._attachedToEntity=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_POSITION",{light:this,position:Z})}setTrackedEntity(Z){if(!Z.isSpawned)return m.error(`Light.setTrackedEntity(): Entity ${Z.id} is not spawned!`);if(this._trackedEntity===Z)return;if(this._trackedEntity=Z,this._trackedPosition=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_TRACKED_ENTITY",{light:this,entity:Z})}setTrackedPosition(Z){if(this._trackedPosition===Z)return;if(this._trackedPosition=Z,this._trackedEntity=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_TRACKED_POSITION",{light:this,position:Z})}despawn(){if(!this.isSpawned||!this._world)return;this._world.lightManager.unregisterLight(this),this.emitWithWorld(this._world,"LIGHT.DESPAWN",{light:this}),this._id=void 0,this._world=void 0}spawn(Z){if(this.isSpawned)return;if(this._attachedToEntity&&!this._attachedToEntity.isSpawned)return m.error(`Light.spawn(): Attached entity ${this._attachedToEntity.id} must be spawned before spawning Light!`);this._id=Z.lightManager.registerLight(this),this._world=Z,this.emitWithWorld(Z,"LIGHT.SPAWN",{light:this})}serialize(){return p0.serializeLight(this)}}var $$1;((Y)=>{Y[Y.FIRST_PERSON=0]="FIRST_PERSON";Y[Y.THIRD_PERSON=1]="THIRD_PERSON";Y[Y.SPECTATOR=2]="SPECTATOR"})($$1||={});var pf;((F)=>{F.LOOK_AT_ENTITY="PLAYER_CAMERA.LOOK_AT_ENTITY";F.LOOK_AT_POSITION="PLAYER_CAMERA.LOOK_AT_POSITION";F.SET_ATTACHED_TO_ENTITY="PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY";F.SET_ATTACHED_TO_POSITION="PLAYER_CAMERA.SET_ATTACHED_TO_POSITION";F.SET_FILM_OFFSET="PLAYER_CAMERA.SET_FILM_OFFSET";F.SET_FORWARD_OFFSET="PLAYER_CAMERA.SET_FORWARD_OFFSET";F.SET_FOV="PLAYER_CAMERA.SET_FOV";F.SET_MODEL_HIDDEN_NODES="PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES";F.SET_MODE="PLAYER_CAMERA.SET_MODE";F.SET_OFFSET="PLAYER_CAMERA.SET_OFFSET";F.SET_TRACKED_ENTITY="PLAYER_CAMERA.SET_TRACKED_ENTITY";F.SET_TRACKED_POSITION="PLAYER_CAMERA.SET_TRACKED_POSITION";F.SET_ZOOM="PLAYER_CAMERA.SET_ZOOM"})(pf||={});class xq extends g0{player;_attachedToEntity;_attachedToPosition;_filmOffset=0;_forwardOffset=0;_fov=75;_modelHiddenNodes=new Set;_mode=1;_offset={x:0,y:0,z:0};_orientation={pitch:0,yaw:0};_trackedEntity;_trackedPosition;_zoom=1;constructor(Z){super();this.player=Z}get attachedToEntity(){return this._attachedToEntity}get attachedToPosition(){return this._attachedToPosition}get facingDirection(){return{x:-Math.sin(this._orientation.yaw)*Math.cos(this._orientation.pitch),y:Math.sin(this._orientation.pitch),z:-Math.cos(this._orientation.yaw)*Math.cos(this._orientation.pitch)}}get filmOffset(){return this._filmOffset}get forwardOffset(){return this._forwardOffset}get fov(){return this._fov}get modelHiddenNodes(){return this._modelHiddenNodes}get mode(){return this._mode}get offset(){return this._offset}get orientation(){return this._orientation}get trackedEntity(){return this._trackedEntity}get trackedPosition(){return this._trackedPosition}get zoom(){return this._zoom}lookAtEntity(Z){if(!this._requirePlayerWorld())return;this.emitWithWorld(this.player.world,"PLAYER_CAMERA.LOOK_AT_ENTITY",{playerCamera:this,entity:Z})}lookAtPosition(Z){if(!this._requirePlayerWorld())return;this.emitWithWorld(this.player.world,"PLAYER_CAMERA.LOOK_AT_POSITION",{playerCamera:this,position:Z})}reset(){this._attachedToEntity=void 0,this._attachedToPosition=void 0,this._orientation={pitch:0,yaw:0},this._trackedEntity=void 0,this._trackedPosition=void 0}setAttachedToEntity(Z){if(!this._requirePlayerWorld())return;if(!Z.isSpawned)return m.error(`PlayerCamera.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);this._attachedToEntity=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY",{playerCamera:this,entity:Z})}setAttachedToPosition(Z){if(!this._requirePlayerWorld())return;this._attachedToPosition=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_ATTACHED_TO_POSITION",{playerCamera:this,position:Z})}setFilmOffset(Z){if(!this._requirePlayerWorld())return;this._filmOffset=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FILM_OFFSET",{playerCamera:this,filmOffset:Z})}setForwardOffset(Z){if(!this._requirePlayerWorld())return;this._forwardOffset=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FORWARD_OFFSET",{playerCamera:this,forwardOffset:Z})}setFov(Z){if(!this._requirePlayerWorld())return;this._fov=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FOV",{playerCamera:this,fov:Z})}setModelHiddenNodes(Z){if(!this._requirePlayerWorld())return;this._modelHiddenNodes=new Set(Z.map((J)=>J.toLowerCase())),this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES",{playerCamera:this,modelHiddenNodes:this._modelHiddenNodes})}setMode(Z){if(!this._requirePlayerWorld())return;this._mode=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_MODE",{playerCamera:this,mode:Z})}setOffset(Z){if(!this._requirePlayerWorld())return;this._offset=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_OFFSET",{playerCamera:this,offset:Z})}setOrientationPitch(Z){this._orientation.pitch=Z}setOrientationYaw(Z){this._orientation.yaw=Z}setTrackedEntity(Z){if(!this._requirePlayerWorld())return;this._trackedEntity=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_TRACKED_ENTITY",{playerCamera:this,entity:Z})}setTrackedPosition(Z){if(!this._requirePlayerWorld())return;this._trackedPosition=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_TRACKED_POSITION",{playerCamera:this,position:Z})}setZoom(Z){if(!this._requirePlayerWorld())return;this._zoom=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_ZOOM",{playerCamera:this,zoom:Z})}serialize(){return p0.serializePlayerCamera(this)}_requirePlayerWorld(){if(!this.player.world)m.error(`PlayerCamera._requirePlayerWorld(): Player ${this.player.id} is not in a world!`);return!!this.player.world}}var DM;((Q)=>{Q.DATA="PLAYER_UI.DATA";Q.LOAD="PLAYER_UI.LOAD";Q.LOCK_POINTER="PLAYER_UI.LOCK_POINTER";Q.SEND_DATA="PLAYER_UI.SEND_DATA"})(DM||={});class hq extends g0{player;constructor(Z){super();this.player=Z}load(Z){if(!this.player.world)return;this.emitWithWorld(this.player.world,"PLAYER_UI.LOAD",{playerUI:this,htmlUri:Z})}lockPointer(Z){if(!this.player.world)return;this.emitWithWorld(this.player.world,"PLAYER_UI.LOCK_POINTER",{playerUI:this,lock:Z})}sendData(Z){if(!this.player.world)return;this.emitWithWorld(this.player.world,"PLAYER_UI.SEND_DATA",{playerUI:this,data:Z})}}class fq{_colliderHandleBlockTypeMap=new Map;_colliderHandleCollisionCallbackMap=new Map;_colliderHandleEntityMap=new Map;_cleanupBlockTypeColliderHandles=new Set;_pendingCleanupBlockTypeColliderHandles=new Set;_cleanupCollisionCallbackColliderHandles=new Set;_pendingCleanupCollisionCallbackColliderHandles=new Set;_cleanupEntityColliderHandles=new Set;_pendingCleanupEntityColliderHandles=new Set;getColliderBlockType(Z){if(!this._requireSimulatedCollider(Z))return;return this._colliderHandleBlockTypeMap.get(Z.rawCollider.handle)}getColliderCollisionCallback(Z){if(!this._requireSimulatedCollider(Z))return;return this._colliderHandleCollisionCallbackMap.get(Z.rawCollider.handle)}getColliderEntity(Z){if(!this._requireSimulatedCollider(Z))return;return this._colliderHandleEntityMap.get(Z.rawCollider.handle)}getColliderHandleBlockType(Z){return this._colliderHandleBlockTypeMap.get(Z)}getColliderHandleCollisionCallback(Z){return this._colliderHandleCollisionCallbackMap.get(Z)}getColliderHandleEntity(Z){return this._colliderHandleEntityMap.get(Z)}removeColliderBlockType(Z){if(!this._requireSimulatedCollider(Z))return;this.removeColliderHandleBlockType(Z.rawCollider.handle)}removeColliderCollisionCallback(Z){if(!this._requireSimulatedCollider(Z))return;this.removeColliderHandleCollisionCallback(Z.rawCollider.handle)}removeColliderEntity(Z){if(!this._requireSimulatedCollider(Z))return;this.removeColliderHandleEntity(Z.rawCollider.handle)}removeColliderHandleBlockType(Z){this._colliderHandleBlockTypeMap.delete(Z)}removeColliderHandleCollisionCallback(Z){this._colliderHandleCollisionCallbackMap.delete(Z)}removeColliderHandleEntity(Z){this._colliderHandleEntityMap.delete(Z)}setColliderBlockType(Z,J){if(!this._requireSimulatedCollider(Z))return;this.setColliderHandleBlockType(Z.rawCollider.handle,J)}setColliderCollisionCallback(Z,J){if(!this._requireSimulatedCollider(Z))return;this.setColliderHandleCollisionCallback(Z.rawCollider.handle,J)}setColliderEntity(Z,J){if(!this._requireSimulatedCollider(Z))return;this.setColliderHandleEntity(Z.rawCollider.handle,J)}setColliderHandleBlockType(Z,J){this._colliderHandleBlockTypeMap.set(Z,J),this._cleanupBlockTypeColliderHandles.delete(Z),this._pendingCleanupBlockTypeColliderHandles.delete(Z)}setColliderHandleCollisionCallback(Z,J){this._colliderHandleCollisionCallbackMap.set(Z,J),this._cleanupCollisionCallbackColliderHandles.delete(Z),this._pendingCleanupCollisionCallbackColliderHandles.delete(Z)}setColliderHandleEntity(Z,J){this._colliderHandleEntityMap.set(Z,J),this._cleanupEntityColliderHandles.delete(Z),this._pendingCleanupEntityColliderHandles.delete(Z)}queueColliderHandleForCleanup(Z){if(this._colliderHandleBlockTypeMap.has(Z))this._pendingCleanupBlockTypeColliderHandles.add(Z);if(this._colliderHandleCollisionCallbackMap.has(Z))this._pendingCleanupCollisionCallbackColliderHandles.add(Z);if(this._colliderHandleEntityMap.has(Z))this._pendingCleanupEntityColliderHandles.add(Z)}cleanup(){for(let Z of this._cleanupBlockTypeColliderHandles)this._colliderHandleBlockTypeMap.delete(Z);if(this._cleanupBlockTypeColliderHandles.size>0)this._cleanupBlockTypeColliderHandles.clear();for(let Z of this._cleanupCollisionCallbackColliderHandles)this._colliderHandleCollisionCallbackMap.delete(Z);if(this._cleanupCollisionCallbackColliderHandles.size>0)this._cleanupCollisionCallbackColliderHandles.clear();for(let Z of this._cleanupEntityColliderHandles)this._colliderHandleEntityMap.delete(Z);if(this._cleanupEntityColliderHandles.size>0)this._cleanupEntityColliderHandles.clear();for(let Z of this._pendingCleanupBlockTypeColliderHandles.keys())this._cleanupBlockTypeColliderHandles.add(Z);if(this._pendingCleanupBlockTypeColliderHandles.size>0)this._pendingCleanupBlockTypeColliderHandles.clear();for(let Z of this._pendingCleanupCollisionCallbackColliderHandles.keys())this._cleanupCollisionCallbackColliderHandles.add(Z);if(this._pendingCleanupCollisionCallbackColliderHandles.size>0)this._pendingCleanupCollisionCallbackColliderHandles.clear();for(let Z of this._pendingCleanupEntityColliderHandles.keys())this._cleanupEntityColliderHandles.add(Z);if(this._pendingCleanupEntityColliderHandles.size>0)this._pendingCleanupEntityColliderHandles.clear()}_requireSimulatedCollider(Z){if(!Z.rawCollider)m.error("ColliderMap._requireSimulatedCollider(): Collider is not in the simulation.");return!!Z.rawCollider}}var Q86={x:0,y:-32,z:0},nf=60,af;((Q)=>{Q.STEP_START="SIMULATION.STEP_START";Q.STEP_END="SIMULATION.STEP_END";Q.DEBUG_RAYCAST="SIMULATION.DEBUG_RAYCAST";Q.DEBUG_RENDER="SIMULATION.DEBUG_RENDER"})(af||={});class bq extends g0{_colliderMap=new fq;_debugRaycastingEnabled=!1;_debugRenderingEnabled=!1;_rapierEventQueue;_rapierSimulation;_world;constructor(Z,J=nf,$=Q86){super();this._rapierEventQueue=new K1.EventQueue(!0),this._rapierSimulation=new K1.World($),this._rapierSimulation.timestep=Math.fround(1/J),this._world=Z}get colliderMap(){return this._colliderMap}get isDebugRaycastingEnabled(){return this._debugRaycastingEnabled}get isDebugRenderingEnabled(){return this._debugRenderingEnabled}get gravity(){return this._rapierSimulation.gravity}get timestepS(){return this._rapierSimulation.timestep}get world(){return this._world}raycast(Z,J,$,Y={}){let Q=new K1.Ray(Z,J),W=this._rapierSimulation.castRay(Q,$,Y.ignoresSensors??!0,Y.filterFlags,Y.filterGroups,Y.filterExcludeCollider,Y.filterExcludeRigidBody,Y.filterPredicate);if(this._debugRaycastingEnabled)this.emitWithWorld(this._world,"SIMULATION.DEBUG_RAYCAST",{simulation:this,origin:Z,direction:J,length:$,hit:!!W});if(!W)return null;let X=Q.pointAt(W.timeOfImpact),K=W.timeOfImpact,G=W.collider,z=this._colliderMap.getColliderHandleBlockType(G.handle);if(z)return{hitBlock:FW.fromGlobalCoordinate({x:Math.floor(X.x-(Q.dir.x<0?0.0001:-0.0001)),y:Math.floor(X.y-(Q.dir.y<0?0.0001:-0.0001)),z:Math.floor(X.z-(Q.dir.z<0?0.0001:-0.0001))},z),hitPoint:X,hitDistance:K};let H=this._colliderMap.getColliderHandleEntity(G.handle);if(H)return{hitEntity:H,hitPoint:X,hitDistance:K};return null}createRawCollider(Z,J){return this._rapierSimulation.createCollider(Z,J)}createRawRigidBody(Z){return this._rapierSimulation.createRigidBody(Z)}enableDebugRaycasting(Z){this._debugRaycastingEnabled=Z}enableDebugRendering(Z){this._debugRenderingEnabled=Z}getContactManifolds(Z,J){let $=[];return this._rapierSimulation.narrowPhase.contactPair(Z,J,(Y,Q)=>{if(Y.numContacts()===0)return;let W=Y.normal(),X=[];for(let K=0;K<Y.numSolverContacts();K++)X.push(Y.solverContactPoint(K));$.push({contactPoints:X,localNormalA:!Q?Y.localNormal1():Y.localNormal2(),localNormalB:!Q?Y.localNormal2():Y.localNormal1(),normal:!Q?W:{x:-W.x,y:-W.y,z:-W.z}})}),$}removeRawCollider(Z){this._colliderMap.queueColliderHandleForCleanup(Z.handle),this._rapierSimulation.removeCollider(Z,!1)}removeRawRigidBody(Z){this._rapierSimulation.removeRigidBody(Z)}setGravity(Z){this._rapierSimulation.gravity=Z}step=(Z)=>{this.emitWithWorld(this._world,"SIMULATION.STEP_START",{simulation:this,tickDeltaMs:Z});let J=performance.now();if(X8.startSpan({operation:"physics_step"},()=>{this._rapierSimulation.step(this._rapierEventQueue)}),X8.startSpan({operation:"physics_cleanup"},()=>{this._rapierEventQueue.drainContactForceEvents(this._onContactForceEvent),this._rapierEventQueue.drainCollisionEvents(this._onCollisionEvent),this._colliderMap.cleanup()}),this.emitWithWorld(this._world,"SIMULATION.STEP_END",{simulation:this,stepDurationMs:performance.now()-J}),this._debugRenderingEnabled)this.emitWithWorld(this._world,"SIMULATION.DEBUG_RENDER",{simulation:this,...this._rapierSimulation.debugRender()})};_onCollisionEvent=(Z,J,$)=>{let[Y,Q]=this._getCollisionObjects(Z,J);if(!Y||!Q)return;let W=(X,K)=>{if(X instanceof s5&&K instanceof a8&&X.hasListeners("BLOCK_TYPE.ENTITY_COLLISION"))X.emit("BLOCK_TYPE.ENTITY_COLLISION",{blockType:X,entity:K,started:$,colliderHandleA:Z,colliderHandleB:J});else if(X instanceof a8&&K instanceof s5&&X.hasListeners("ENTITY.BLOCK_COLLISION"))X.emit("ENTITY.BLOCK_COLLISION",{entity:X,blockType:K,started:$,colliderHandleA:Z,colliderHandleB:J});else if(X instanceof a8&&K instanceof a8&&X.hasListeners("ENTITY.ENTITY_COLLISION"))X.emit("ENTITY.ENTITY_COLLISION",{entity:X,otherEntity:K,started:$,colliderHandleA:Z,colliderHandleB:J});else if(typeof X==="function"&&(K instanceof a8||K instanceof s5))X(K,$,Z,J)};W(Y,Q),W(Q,Y)};_onContactForceEvent=(Z)=>{let[J,$]=this._getCollisionObjects(Z.collider1(),Z.collider2());if(!J||typeof J==="function"||!$||typeof $==="function")return;let Y={totalForce:Z.totalForce(),totalForceMagnitude:Z.totalForceMagnitude(),maxForceDirection:Z.maxForceDirection(),maxForceMagnitude:Z.maxForceMagnitude()},Q=(W,X)=>{if(W instanceof s5&&X instanceof a8&&W.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))W.emit("BLOCK_TYPE.ENTITY_CONTACT_FORCE",{blockType:W,entity:X,contactForceData:Y});else if(W instanceof a8&&X instanceof s5&&W.hasListeners("ENTITY.BLOCK_CONTACT_FORCE"))W.emit("ENTITY.BLOCK_CONTACT_FORCE",{entity:W,blockType:X,contactForceData:Y});else if(W instanceof a8&&X instanceof a8&&W.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))W.emit("ENTITY.ENTITY_CONTACT_FORCE",{entity:W,otherEntity:X,contactForceData:Y})};Q(J,$),Q($,J)};_getCollisionObjects(Z,J){let $=this._colliderMap.getColliderHandleBlockType(Z)??this._colliderMap.getColliderHandleCollisionCallback(Z)??this._colliderMap.getColliderHandleEntity(Z),Y=this._colliderMap.getColliderHandleBlockType(J)??this._colliderMap.getColliderHandleCollisionCallback(J)??this._colliderMap.getColliderHandleEntity(J);return[$,Y]}}class CM{_synchronizedPlayerReliablePackets=new Map;_queuedBroadcasts=[];_queuedAudioSynchronizations={};_queuedBlockSynchronizations={};_queuedBlockTypeSynchronizations={};_queuedChunkSynchronizations={};_queuedDebugRaycastSynchronizations=[];_queuedEntitySynchronizations={};_queuedLightSynchronizations={};_queuedPerPlayerSynchronizations=new Map;_queuedPerPlayerCameraSynchronizations=new Map;_queuedPerPlayerUISynchronizations=new Map;_queuedPerPlayerUIDatasSynchronizations=new Map;_queuedPlayerSynchronizations={};_queuedSceneUISynchronizations={};_queuedWorldSynchronization;_loadedSceneUIs=new Set;_spawnedChunks=new Set;_spawnedEntities=new Set;_world;constructor(Z){this._world=Z,this._subscribeToAudioEvents(),this._subscribeToBlockTypeRegistryEvents(),this._subscribeToChatEvents(),this._subscribeToChunkEvents(),this._subscribeToEntityEvents(),this._subscribeToLightEvents(),this._subscribeToPlayerEvents(),this._subscribeToPlayerCameraEvents(),this._subscribeToPlayerUIEvents(),this._subscribeToSceneUIEvents(),this._subscribeToSimulationEvents(),this._subscribeToWorldEvents()}synchronize(){let Z=[],J=[],$=this._world.loop.currentTick;this._queuedPerPlayerSynchronizations.forEach((q,F)=>{this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(...q)});let Y=Object.values(this._queuedEntitySynchronizations);if(Y.length>0){let[q,F]=Y.reduce(([U,w],L)=>{for(let O in L)if(O!=="i"&&O!=="p"&&O!=="r")return U.push(L),[U,w];return w.push(L),[U,w]},[[],[]]);if(F.length>0){let U=Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,F,$);J.push(U)}if(q.length>0){let U=Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,q,$);Z.push(U),this._synchronizedPlayerReliablePackets.forEach((w)=>w.push(U))}}let Q=Object.values(this._queuedAudioSynchronizations);if(Q.length>0){let q=Y0.createPacket(Y0.outboundPackets.audiosPacketDefinition,Q,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let W=Object.values(this._queuedBlockTypeSynchronizations);if(W.length>0){let q=Y0.createPacket(Y0.outboundPackets.blockTypesPacketDefinition,W,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let X=Object.values(this._queuedBlockSynchronizations);if(X.length>0){let q=Y0.createPacket(Y0.outboundPackets.blocksPacketDefinition,X,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let K=Object.values(this._queuedChunkSynchronizations);if(K.length>0){let q=Y0.createPacket(Y0.outboundPackets.chunksPacketDefinition,K,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let G=Object.values(this._queuedLightSynchronizations);if(G.length>0){let q=Y0.createPacket(Y0.outboundPackets.lightsPacketDefinition,G,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}this._queuedPerPlayerUISynchronizations.forEach((q,F)=>{let U=Y0.createPacket(Y0.outboundPackets.uiPacketDefinition,q,$);this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(U)}),this._queuedPerPlayerUIDatasSynchronizations.forEach((q,F)=>{let U=Y0.createPacket(Y0.outboundPackets.uiDatasPacketDefinition,q,$);this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(U)});let z=Object.values(this._queuedSceneUISynchronizations);if(z.length>0){let q=Y0.createPacket(Y0.outboundPackets.sceneUIsPacketDefinition,z,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}if(this._queuedWorldSynchronization){let q=Y0.createPacket(Y0.outboundPackets.worldPacketDefinition,this._queuedWorldSynchronization,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}this._queuedPerPlayerCameraSynchronizations.forEach((q,F)=>{let U=Y0.createPacket(Y0.outboundPackets.cameraPacketDefinition,q,$);this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(U)});let H=Object.values(this._queuedPlayerSynchronizations);if(H.length>0){let q=Y0.createPacket(Y0.outboundPackets.playersPacketDefinition,H,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}this._queuedBroadcasts.forEach((q)=>{Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))});let V=this._queuedDebugRaycastSynchronizations;if(V.length>0){let q=Y0.createPacket(Y0.outboundPackets.physicsDebugRaycastsPacketDefinition,V,$);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}X8.startSpan({operation:"send_all_packets"},()=>{e5.instance.getConnectedPlayersByWorld(this._world).forEach((q)=>{let F=this._synchronizedPlayerReliablePackets.get(q)??Z;if(F.length>0)q.connection.send(F);if(J.length>0)q.connection.send(J,!1)})}),X8.startSpan({operation:"network_synchronize_cleanup"},()=>{if(this._queuedBroadcasts.length>0)this._queuedBroadcasts=[];if(Q.length>0)this._queuedAudioSynchronizations={};if(X.length>0)this._queuedBlockSynchronizations={};if(W.length>0)this._queuedBlockTypeSynchronizations={};if(K.length>0)this._queuedChunkSynchronizations={};if(V.length>0)this._queuedDebugRaycastSynchronizations=[];if(Y.length>0)this._queuedEntitySynchronizations={};if(G.length>0)this._queuedLightSynchronizations={};if(this._queuedPerPlayerSynchronizations.size>0)this._queuedPerPlayerSynchronizations.clear();if(this._queuedPerPlayerCameraSynchronizations.size>0)this._queuedPerPlayerCameraSynchronizations.clear();if(this._queuedPerPlayerUISynchronizations.size>0)this._queuedPerPlayerUISynchronizations.clear();if(this._queuedPerPlayerUIDatasSynchronizations.size>0)this._queuedPerPlayerUIDatasSynchronizations.clear();if(H.length>0)this._queuedPlayerSynchronizations={};if(z.length>0)this._queuedSceneUISynchronizations={};if(this._queuedWorldSynchronization)this._queuedWorldSynchronization=void 0;if(this._loadedSceneUIs.size>0)this._loadedSceneUIs.clear();if(this._spawnedChunks.size>0)this._spawnedChunks.clear();if(this._spawnedEntities.size>0)this._spawnedEntities.clear();if(this._synchronizedPlayerReliablePackets.size>0)this._synchronizedPlayerReliablePackets.clear()})}_subscribeToAudioEvents(){this._world.final("AUDIO.PAUSE",this._onAudioPause),this._world.final("AUDIO.PLAY",this._onAudioPlay),this._world.final("AUDIO.PLAY_RESTART",this._onAudioPlayRestart),this._world.final("AUDIO.SET_ATTACHED_TO_ENTITY",this._onAudioSetAttachedToEntity),this._world.final("AUDIO.SET_CUTOFF_DISTANCE",this._onAudioSetCutoffDistance),this._world.final("AUDIO.SET_DETUNE",this._onAudioSetDetune),this._world.final("AUDIO.SET_DISTORTION",this._onAudioSetDistortion),this._world.final("AUDIO.SET_POSITION",this._onAudioSetPosition),this._world.final("AUDIO.SET_PLAYBACK_RATE",this._onAudioSetPlaybackRate),this._world.final("AUDIO.SET_REFERENCE_DISTANCE",this._onAudioSetReferenceDistance),this._world.final("AUDIO.SET_VOLUME",this._onAudioSetVolume)}_subscribeToBlockTypeRegistryEvents(){this._world.final("BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE",this._onBlockTypeRegistryRegisterBlockType)}_subscribeToChatEvents(){this._world.final("CHAT.BROADCAST_MESSAGE",this._onChatSendBroadcastMessage),this._world.final("CHAT.PLAYER_MESSAGE",this._onChatSendPlayerMessage)}_subscribeToChunkEvents(){this._world.final("CHUNK.SPAWN",this._onChunkSpawn),this._world.final("CHUNK.DESPAWN",this._onChunkDespawn),this._world.final("CHUNK.SET_BLOCK",this._onChunkSetBlock)}_subscribeToEntityEvents(){this._world.final("ENTITY.SPAWN",this._onEntitySpawn),this._world.final("ENTITY.DESPAWN",this._onEntityDespawn),this._world.final("ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE",this._onEntitySetModelAnimationsPlaybackRate),this._world.final("ENTITY.SET_MODEL_HIDDEN_NODES",this._onEntitySetModelHiddenNodes),this._world.final("ENTITY.SET_OPACITY",this._onEntitySetOpacity),this._world.final("ENTITY.SET_PARENT",this._onEntitySetParent),this._world.final("ENTITY.SET_TINT_COLOR",this._onEntitySetTintColor),this._world.final("ENTITY.START_MODEL_LOOPED_ANIMATIONS",this._onEntityStartModelLoopedAnimations),this._world.final("ENTITY.START_MODEL_ONESHOT_ANIMATIONS",this._onEntityStartModelOneshotAnimations),this._world.final("ENTITY.STOP_MODEL_ANIMATIONS",this._onEntityStopModelAnimations),this._world.final("ENTITY.UPDATE_POSITION",this._onEntityUpdatePosition),this._world.final("ENTITY.UPDATE_ROTATION",this._onEntityUpdateRotation)}_subscribeToLightEvents(){this._world.final("LIGHT.DESPAWN",this._onLightDespawn),this._world.final("LIGHT.SET_ANGLE",this._onLightSetAngle),this._world.final("LIGHT.SET_ATTACHED_TO_ENTITY",this._onLightSetAttachedToEntity),this._world.final("LIGHT.SET_COLOR",this._onLightSetColor),this._world.final("LIGHT.SET_DISTANCE",this._onLightSetDistance),this._world.final("LIGHT.SET_INTENSITY",this._onLightSetIntensity),this._world.final("LIGHT.SET_OFFSET",this._onLightSetOffset),this._world.final("LIGHT.SET_PENUMBRA",this._onLightSetPenumbra),this._world.final("LIGHT.SET_POSITION",this._onLightSetPosition),this._world.final("LIGHT.SET_TRACKED_ENTITY",this._onLightSetTrackedEntity),this._world.final("LIGHT.SET_TRACKED_POSITION",this._onLightSetTrackedPosition),this._world.final("LIGHT.SPAWN",this._onLightSpawn)}_subscribeToPlayerEvents(){this._world.final("PLAYER.JOINED_WORLD",this._onPlayerJoinedWorld),this._world.final("PLAYER.LEFT_WORLD",this._onPlayerLeftWorld),this._world.final("PLAYER.RECONNECTED_WORLD",this._onPlayerReconnectedWorld),this._world.final("PLAYER.REQUEST_SYNC",this._onPlayerRequestSync)}_subscribeToPlayerCameraEvents(){this._world.final("PLAYER_CAMERA.LOOK_AT_ENTITY",this._onPlayerCameraLookAtEntity),this._world.final("PLAYER_CAMERA.LOOK_AT_POSITION",this._onPlayerCameraLookAtPosition),this._world.final("PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY",this._onPlayerCameraSetAttachedToEntity),this._world.final("PLAYER_CAMERA.SET_ATTACHED_TO_POSITION",this._onPlayerCameraSetAttachedToPosition),this._world.final("PLAYER_CAMERA.SET_FILM_OFFSET",this._onPlayerCameraSetFilmOffset),this._world.final("PLAYER_CAMERA.SET_FORWARD_OFFSET",this._onPlayerCameraSetForwardOffset),this._world.final("PLAYER_CAMERA.SET_FOV",this._onPlayerCameraSetFov),this._world.final("PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES",this._onPlayerCameraSetModelHiddenNodes),this._world.final("PLAYER_CAMERA.SET_MODE",this._onPlayerCameraSetMode),this._world.final("PLAYER_CAMERA.SET_OFFSET",this._onPlayerCameraSetOffset),this._world.final("PLAYER_CAMERA.SET_TRACKED_ENTITY",this._onPlayerCameraSetTrackedEntity),this._world.final("PLAYER_CAMERA.SET_TRACKED_POSITION",this._onPlayerCameraSetTrackedPosition),this._world.final("PLAYER_CAMERA.SET_ZOOM",this._onPlayerCameraSetZoom)}_subscribeToPlayerUIEvents(){this._world.final("PLAYER_UI.LOAD",this._onPlayerUILoad),this._world.final("PLAYER_UI.LOCK_POINTER",this._onPlayerUILockPointer),this._world.final("PLAYER_UI.SEND_DATA",this._onPlayerUISendData)}_subscribeToSceneUIEvents(){this._world.final("SCENE_UI.LOAD",this._onSceneUILoad),this._world.final("SCENE_UI.SET_ATTACHED_TO_ENTITY",this._onSceneUISetAttachedToEntity),this._world.final("SCENE_UI.SET_OFFSET",this._onSceneUISetOffset),this._world.final("SCENE_UI.SET_POSITION",this._onSceneUISetPosition),this._world.final("SCENE_UI.SET_STATE",this._onSceneUISetState),this._world.final("SCENE_UI.SET_VIEW_DISTANCE",this._onSceneUISetViewDistance),this._world.final("SCENE_UI.UNLOAD",this._onSceneUIUnload)}_subscribeToSimulationEvents(){this._world.final("SIMULATION.DEBUG_RAYCAST",this._onSimulationDebugRaycast),this._world.final("SIMULATION.DEBUG_RENDER",this._onSimulationDebugRender)}_subscribeToWorldEvents(){this._world.final("WORLD.SET_AMBIENT_LIGHT_COLOR",this._onWorldSetAmbientLightColor),this._world.final("WORLD.SET_AMBIENT_LIGHT_INTENSITY",this._onWorldSetAmbientLightIntensity),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_COLOR",this._onWorldSetDirectionalLightColor),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY",this._onWorldSetDirectionalLightIntensity),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_POSITION",this._onWorldSetDirectionalLightPosition)}_onAudioPause=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.pa=!0,delete J.pl,delete J.r};_onAudioPlay=(Z)=>{let J=Z.audio.serialize();J.pl=!0,delete J.pa,delete J.r,this._queuedAudioSynchronizations[J.i]=J};_onAudioPlayRestart=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.r=!0,delete J.pa,delete J.pl,this._queuedAudioSynchronizations[J.i]=J};_onAudioSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onAudioSetCutoffDistance=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.cd=Z.cutoffDistance};_onAudioSetDetune=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.de=Z.detune};_onAudioSetDistortion=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.di=Z.distortion};_onAudioSetPosition=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.e=Z.position?void 0:J.e,J.p=Z.position?p0.serializeVector(Z.position):void 0};_onAudioSetPlaybackRate=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.pr=Z.playbackRate};_onAudioSetReferenceDistance=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.rd=Z.referenceDistance};_onAudioSetVolume=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.v=Z.volume};_onBlockTypeRegistryRegisterBlockType=(Z)=>{let J=Z.blockType.serialize();this._queuedBlockTypeSynchronizations[Z.blockType.id]=J};_onChatSendBroadcastMessage=(Z)=>{let{player:J,message:$,color:Y}=Z;this._queuedBroadcasts.push(Y0.createPacket(Y0.outboundPackets.chatMessagesPacketDefinition,[{m:$,c:Y,p:J?.id}],this._world.loop.currentTick))};_onChatSendPlayerMessage=(Z)=>{let{player:J,message:$,color:Y}=Z,Q=this._queuedPerPlayerSynchronizations.get(J)??[];Q.push(Y0.createPacket(Y0.outboundPackets.chatMessagesPacketDefinition,[{m:$,c:Y}],this._world.loop.currentTick)),this._queuedPerPlayerSynchronizations.set(J,Q)};_onChunkSpawn=(Z)=>{let J=this._createOrGetQueuedChunkSync(Z.chunk);J.b=Array.from(Z.chunk.blocks),J.rm=void 0,this._spawnedChunks.add(J.c.join(","))};_onChunkDespawn=(Z)=>{let J=this._createOrGetQueuedChunkSync(Z.chunk),$=J.c.join(",");if(this._spawnedChunks.has($))delete this._queuedChunkSynchronizations[$],this._spawnedChunks.delete($);else J.rm=!0};_onChunkSetBlock=(Z)=>{let J=this._createOrGetQueuedBlockSync(Z.globalCoordinate);J.i=Z.blockTypeId};_onEntitySetModelAnimationsPlaybackRate=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.ap=Z.playbackRate};_onEntitySpawn=(Z)=>{let J=Z.entity.serialize();this._queuedEntitySynchronizations[J.i]=J,this._spawnedEntities.add(J.i)};_onEntityDespawn=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(this._spawnedEntities.has(J.i))delete this._queuedEntitySynchronizations[J.i],this._spawnedEntities.delete(J.i);else J.rm=!0};_onEntitySetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.h=Array.from(Z.modelHiddenNodes)};_onEntitySetOpacity=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.o=Z.opacity};_onEntitySetParent=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.pe=Z.parent?Z.parent.id:void 0,J.pn=Z.parentNodeName};_onEntitySetTintColor=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.t=Z.tintColor?p0.serializeRgbColor(Z.tintColor):void 0};_onEntityStartModelLoopedAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.al=Array.from(new Set([...J.al??[],...Z.animations])),J.as)J.as=J.as.filter(($)=>!Z.animations.has($)).filter(Boolean)};_onEntityStartModelOneshotAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.ao=Array.from(new Set([...J.ao??[],...Z.animations])),J.as)J.as=J.as.filter(($)=>!Z.animations.has($)).filter(Boolean)};_onEntityStopModelAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.al)J.al=J.al.filter(($)=>!Z.animations.has($)).filter(Boolean);if(J.ao)J.ao=J.ao.filter(($)=>!Z.animations.has($)).filter(Boolean);J.as=Array.from(new Set([...J.as??[],...Z.animations]))};_onEntityUpdateRotation=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.r=[Z.rotation.x,Z.rotation.y,Z.rotation.z,Z.rotation.w]};_onEntityUpdatePosition=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.p=[Z.position.x,Z.position.y,Z.position.z]};_onLightDespawn=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.rm=!0};_onLightSetAngle=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.a=Z.angle};_onLightSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onLightSetColor=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.c=p0.serializeRgbColor(Z.color)};_onLightSetDistance=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.d=Z.distance};_onLightSetIntensity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.n=Z.intensity};_onLightSetOffset=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.o=Z.offset?p0.serializeVector(Z.offset):void 0};_onLightSetPenumbra=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.pe=Z.penumbra};_onLightSetPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.p=Z.position?p0.serializeVector(Z.position):void 0,J.e=Z.position?void 0:J.e};_onLightSetTrackedEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.te=Z.entity?Z.entity.id:void 0,J.tp=Z.entity?void 0:J.tp};_onLightSetTrackedPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.tp=Z.position?p0.serializeVector(Z.position):void 0,J.te=Z.position?void 0:J.te};_onLightSpawn=(Z)=>{let J=Z.light.serialize();this._queuedLightSynchronizations[J.i]=J};_onPlayerCameraLookAtEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=p0.serializeVector(Z.entity.position),delete J.et,delete J.pt};_onPlayerCameraLookAtPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=Z.position?p0.serializeVector(Z.position):void 0,delete J.et,delete J.pt};_onPlayerCameraSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.e=Z.entity.id,delete J.p};_onPlayerCameraSetAttachedToPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.p=Z.position?p0.serializeVector(Z.position):void 0,delete J.e};_onPlayerCameraSetFilmOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fo=Z.filmOffset};_onPlayerCameraSetForwardOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.ffo=Z.forwardOffset};_onPlayerCameraSetFov=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fv=Z.fov};_onPlayerCameraSetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.h=Array.from(Z.modelHiddenNodes)};_onPlayerCameraSetMode=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.m=Z.mode};_onPlayerCameraSetOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.o=Z.offset?p0.serializeVector(Z.offset):void 0};_onPlayerCameraSetTrackedEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.et=Z.entity?Z.entity.id:void 0,delete J.pl,delete J.pt};_onPlayerCameraSetTrackedPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pt=Z.position?p0.serializeVector(Z.position):void 0,delete J.et,delete J.pl};_onPlayerCameraSetZoom=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.z=Z.zoom};_onPlayerJoinedWorld=(Z)=>{let{player:J}=Z,$=this._queuedPerPlayerSynchronizations.get(J)??[];$.push(Y0.createPacket(Y0.outboundPackets.worldPacketDefinition,this._world.serialize(),this._world.loop.currentTick)),$.push(Y0.createPacket(Y0.outboundPackets.blockTypesPacketDefinition,this._world.blockTypeRegistry.serialize(),this._world.loop.currentTick)),$.push(Y0.createPacket(Y0.outboundPackets.chunksPacketDefinition,this._world.chunkLattice.getAllChunks().map((Q)=>Q.serialize()),this._world.loop.currentTick)),$.push(Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,this._world.entityManager.getAllEntities().map((Q)=>{if(J.camera.attachedToEntity===void 0&&Q instanceof d7&&Q.player===J)J.camera.setAttachedToEntity(Q);return Q.serialize()}),this._world.loop.currentTick)),$.push(Y0.createPacket(Y0.outboundPackets.audiosPacketDefinition,this._world.audioManager.getAllAudios().map((Q)=>Q.serialize()),this._world.loop.currentTick)),$.push(Y0.createPacket(Y0.outboundPackets.lightsPacketDefinition,this._world.lightManager.getAllLights().map((Q)=>Q.serialize()),this._world.loop.currentTick)),$.push(Y0.createPacket(Y0.outboundPackets.sceneUIsPacketDefinition,this._world.sceneUIManager.getAllSceneUIs().map((Q)=>Q.serialize()),this._world.loop.currentTick)),$.push(Y0.createPacket(Y0.outboundPackets.playersPacketDefinition,e5.instance.getConnectedPlayers().map((Q)=>Q.serialize()),this._world.loop.currentTick));let Y=this._createOrGetQueuedPlayerCameraSync(J.camera);this._queuedPerPlayerCameraSynchronizations.set(J,{...J.camera.serialize(),...Y}),this._queuedPerPlayerSynchronizations.set(J,$),this._queuedPlayerSynchronizations[J.id]=J.serialize()};_onPlayerLeftWorld=(Z)=>{let J=this._createOrGetQueuedPlayerSync(Z.player);J.rm=!0};_onPlayerReconnectedWorld=(Z)=>{this._onPlayerJoinedWorld(Z)};_onPlayerRequestSync=(Z)=>{Z.player.connection.send([Y0.createPacket(Y0.outboundPackets.syncResponsePacketDefinition,{r:Z.receivedAt,s:Date.now(),p:performance.now()-Z.receivedAtMs,n:this._world.loop.nextTickMs},this._world.loop.currentTick)])};_onPlayerUILoad=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.u=Z.htmlUri};_onPlayerUILockPointer=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.p=Z.lock};_onPlayerUISendData=(Z)=>{this._createOrGetQueuedPlayerUIDatasSync(Z.playerUI).push(Z.data)};_onSceneUILoad=(Z)=>{let J=Z.sceneUI.serialize();this._queuedSceneUISynchronizations[J.i]=J,this._loadedSceneUIs.add(J.i)};_onSceneUISetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onSceneUISetOffset=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.o=Z.offset?p0.serializeVector(Z.offset):void 0};_onSceneUISetPosition=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.p=Z.position?p0.serializeVector(Z.position):void 0,J.e=Z.position?void 0:J.e};_onSceneUISetState=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.s=Z.state};_onSceneUISetViewDistance=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.v=Z.viewDistance};_onSceneUIUnload=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);if(this._loadedSceneUIs.has(J.i))delete this._queuedSceneUISynchronizations[J.i],this._loadedSceneUIs.delete(J.i);else J.rm=!0};_onSimulationDebugRaycast=(Z)=>{this._queuedDebugRaycastSynchronizations.push(p0.serializePhysicsDebugRaycast(Z))};_onSimulationDebugRender=(Z)=>{this._queuedBroadcasts.push(Y0.createPacket(Y0.outboundPackets.physicsDebugRenderPacketDefinition,{v:Array.from(Z.vertices),c:Array.from(Z.colors)},this._world.loop.currentTick))};_onWorldSetAmbientLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ac=p0.serializeRgbColor(Z.color)};_onWorldSetAmbientLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ai=Z.intensity};_onWorldSetDirectionalLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dc=p0.serializeRgbColor(Z.color)};_onWorldSetDirectionalLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.di=Z.intensity};_onWorldSetDirectionalLightPosition=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dp=p0.serializeVector(Z.position)};_createOrGetQueuedAudioSync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedAudioSync(): Audio has no id!");return this._queuedAudioSynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedBlockSync(Z){let{x:J,y:$,z:Y}=Z;return this._queuedBlockSynchronizations[`${J},${$},${Y}`]??={i:0,c:[J,$,Y]}}_createOrGetQueuedChunkSync(Z){if(!Z.originCoordinate)m.fatalError("NetworkSynchronizer._createOrGetQueuedChunkSync(): Chunk has no origin coordinate!");let{x:J,y:$,z:Y}=Z.originCoordinate;return this._queuedChunkSynchronizations[`${J},${$},${Y}`]??={c:[J,$,Y]}}_createOrGetQueuedEntitySync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedEntitySync(): Entity has no id!");return this._queuedEntitySynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedLightSync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedLightSync(): Light has no id!");return this._queuedLightSynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedPlayerSync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedPlayerSync(): Player has no id!");return this._queuedPlayerSynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedPlayerCameraSync(Z){let J=this._queuedPerPlayerCameraSynchronizations.get(Z.player);if(!J)J={},this._queuedPerPlayerCameraSynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUISync(Z){let J=this._queuedPerPlayerUISynchronizations.get(Z.player);if(!J)J={},this._queuedPerPlayerUISynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUIDatasSync(Z){let J=this._queuedPerPlayerUIDatasSynchronizations.get(Z.player);if(!J)J=[],this._queuedPerPlayerUIDatasSynchronizations.set(Z.player,J);return J}_createOrGetQueuedSceneUISync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedSceneUISync(): SceneUI has no id!");return this._queuedSceneUISynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedWorldSync(Z){if(Z.id!==this._world.id)m.fatalError("NetworkSynchronizer._createOrGetQueuedWorldSync(): World does not match this network synchronizer world!");return this._queuedWorldSynchronization??={i:Z.id}}_createOrGetSynchronizedPlayerReliablePackets(Z,J){let $=this._synchronizedPlayerReliablePackets.get(Z);if(!$)$=[...J],this._synchronizedPlayerReliablePackets.set(Z,$);return $}}class yq{_sceneUIs=new Map;_nextSceneUIId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}getAllSceneUIs(){return Array.from(this._sceneUIs.values())}getAllEntityAttachedSceneUIs(Z){return this.getAllSceneUIs().filter((J)=>J.attachedToEntity===Z)}getSceneUIById(Z){return this._sceneUIs.get(Z)}registerSceneUI(Z){if(Z.id!==void 0)return Z.id;let J=this._nextSceneUIId;return this._sceneUIs.set(J,Z),this._nextSceneUIId++,J}unloadEntityAttachedSceneUIs(Z){this.getAllEntityAttachedSceneUIs(Z).forEach((J)=>{J.unload()})}unregisterSceneUI(Z){if(Z.id===void 0)return;this._sceneUIs.delete(Z.id)}}var W86=2,X86=3;class gq{_accumulatorMs=0;_targetTicksPerSecond;_fixedTimestepMs;_fixedTimestepS;_maxAccumulatorMs;_nextTickMs=0;_lastLoopTimeMs=0;_tickFunction;_tickErrorCallback;_tickHandle=null;constructor(Z,J,$){this._targetTicksPerSecond=Z,this._fixedTimestepS=Math.fround(1/Z),this._fixedTimestepMs=Math.fround(this._fixedTimestepS*1000),this._maxAccumulatorMs=this._fixedTimestepMs*X86,this._tickFunction=J,this._tickErrorCallback=$}get targetTicksPerSecond(){return this._targetTicksPerSecond}get fixedTimestepMs(){return this._fixedTimestepMs}get fixedTimestepS(){return this._fixedTimestepS}get nextTickMs(){return this._nextTickMs}start(){if(this._tickHandle)return m.warning("Ticker.start(): ticker already running.");this._lastLoopTimeMs=performance.now();let Z=()=>{let J=performance.now(),$=J-this._lastLoopTimeMs;if(this._lastLoopTimeMs=J,this._accumulatorMs+=$,this._accumulatorMs>this._maxAccumulatorMs)this._accumulatorMs=this._maxAccumulatorMs;if(this._accumulatorMs>=this._fixedTimestepMs)X8.startSpan({operation:"ticker_tick"},()=>{let Y=0;while(this._accumulatorMs>=this._fixedTimestepMs&&Y<W86)this._tick(this._fixedTimestepMs),this._accumulatorMs-=this._fixedTimestepMs,Y++;this._nextTickMs=Math.max(0,this._fixedTimestepMs-this._accumulatorMs)});this._tickHandle=setTimeout(Z,this._nextTickMs)};Z()}stop(){if(!this._tickHandle)return m.warning("Ticker.stop(): ticker not running.");clearTimeout(this._tickHandle),this._tickHandle=null}_tick(Z){try{this._tickFunction(Z)}catch(J){if(J instanceof Error&&this._tickErrorCallback)this._tickErrorCallback(J);else m.warning(`Ticker._tick(): tick callback threw an error, but it was not an instance of Error. Error: ${J}`)}}}var Y$1;((W)=>{W.START="WORLD_LOOP.START";W.STOP="WORLD_LOOP.STOP";W.TICK_START="WORLD_LOOP.TICK_START";W.TICK_END="WORLD_LOOP.TICK_END";W.TICK_ERROR="WORLD_LOOP.TICK_ERROR"})(Y$1||={});class mq extends g0{_currentTick=0;_ticker;_world;constructor(Z,J=nf){super();this._ticker=new gq(J,this._tick,this._onTickError),this._world=Z}get currentTick(){return this._currentTick}get nextTickMs(){return this._ticker.nextTickMs}get timestepS(){return this._ticker.fixedTimestepS}get world(){return this._world}start(){this._ticker.start(),this.emitWithWorld(this._world,"WORLD_LOOP.START",{worldLoop:this})}stop(){this._ticker.stop(),this.emitWithWorld(this._world,"WORLD_LOOP.STOP",{worldLoop:this})}_tick=(Z)=>{this.emitWithWorld(this._world,"WORLD_LOOP.TICK_START",{worldLoop:this,tickDeltaMs:Z});let J=performance.now();X8.startSpan({operation:"world_tick",attributes:{serverPlayerCount:e5.instance.playerCount,targetTickRate:this._ticker.targetTicksPerSecond,targetTickRateMs:this._ticker.fixedTimestepMs,worldId:this._world.id,worldName:this._world.name,worldChunkCount:this._world.chunkLattice.chunkCount,worldEntityCount:this._world.entityManager.entityCount,worldLoopTick:this._currentTick}},()=>{X8.startSpan({operation:"chunks_update"},()=>this._world.chunkLattice.updateChunks()),X8.startSpan({operation:"entities_tick"},()=>this._world.entityManager.tickEntities(Z)),X8.startSpan({operation:"simulation_step"},()=>this._world.simulation.step(Z)),X8.startSpan({operation:"entities_emit_updates"},()=>this._world.entityManager.checkAndEmitUpdates()),X8.startSpan({operation:"network_synchronize"},()=>this._world.networkSynchronizer.synchronize())}),this._currentTick++,this.emitWithWorld(this._world,"WORLD_LOOP.TICK_END",{worldLoop:this,tickDurationMs:performance.now()-J})};_onTickError=(Z)=>{m.error(`WorldLoop._onTickError(): Error: ${Z}`),this.emitWithWorld(this._world,"WORLD_LOOP.TICK_ERROR",{worldLoop:this,error:Z})}}var sf;((K)=>{K.SET_AMBIENT_LIGHT_COLOR="WORLD.SET_AMBIENT_LIGHT_COLOR";K.SET_AMBIENT_LIGHT_INTENSITY="WORLD.SET_AMBIENT_LIGHT_INTENSITY";K.SET_DIRECTIONAL_LIGHT_COLOR="WORLD.SET_DIRECTIONAL_LIGHT_COLOR";K.SET_DIRECTIONAL_LIGHT_INTENSITY="WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY";K.SET_DIRECTIONAL_LIGHT_POSITION="WORLD.SET_DIRECTIONAL_LIGHT_POSITION";K.START="WORLD.START";K.STOP="WORLD.STOP"})(sf||={});class uq extends g0{_id;_ambientLightColor;_ambientLightIntensity;_directionalLightColor;_directionalLightIntensity;_directionalLightPosition;_name;_skyboxUri;_audioManager;_blockTypeRegistry;_chatManager;_chunkLattice;_entityManager;_lightManager;_loop;_networkSynchronizer;_sceneUIManager;_simulation;_tag;constructor(Z){super();this._id=Z.id,this._ambientLightColor=Z.ambientLightColor??{r:255,g:255,b:255},this._ambientLightIntensity=Z.ambientLightIntensity??1,this._directionalLightColor=Z.directionalLightColor??{r:255,g:255,b:255},this._directionalLightIntensity=Z.directionalLightIntensity??3,this._directionalLightPosition=Z.directionalLightPosition??{x:100,y:150,z:100},this._name=Z.name,this._skyboxUri=Z.skyboxUri,this._tag=Z.tag,this._audioManager=new C3(this),this._blockTypeRegistry=new tG(this),this._chatManager=new dq(this),this._chunkLattice=new Eq(this),this._entityManager=new _q(this),this._lightManager=new Aq(this),this._loop=new mq(this,Z.tickRate),this._networkSynchronizer=new CM(this),this._sceneUIManager=new yq(this),this._simulation=new bq(this,Z.tickRate,Z.gravity)}get id(){return this._id}get ambientLightColor(){return this._ambientLightColor}get ambientLightIntensity(){return this._ambientLightIntensity}get directionalLightColor(){return this._directionalLightColor}get directionalLightIntensity(){return this._directionalLightIntensity}get directionalLightPosition(){return this._directionalLightPosition}get name(){return this._name}get skyboxUri(){return this._skyboxUri}get audioManager(){return this._audioManager}get tag(){return this._tag}get blockTypeRegistry(){return this._blockTypeRegistry}get chatManager(){return this._chatManager}get chunkLattice(){return this._chunkLattice}get entityManager(){return this._entityManager}get lightManager(){return this._lightManager}get loop(){return this._loop}get networkSynchronizer(){return this._networkSynchronizer}get sceneUIManager(){return this._sceneUIManager}get simulation(){return this._simulation}loadMap(Z){if(this.chunkLattice.clear(),Z.blockTypes)for(let J of Z.blockTypes)this.blockTypeRegistry.registerGenericBlockType({id:J.id,isLiquid:J.isLiquid,name:J.name,textureUri:J.textureUri});if(Z.blocks)for(let[J,$]of Object.entries(Z.blocks)){let[Y,Q,W]=J.split(",").map(Number);this.chunkLattice.setBlock({x:Y,y:Q,z:W},$)}if(Z.entities)for(let[J,$]of Object.entries(Z.entities)){let[Y,Q,W]=J.split(",").map(Number);new a8($).spawn(this,{x:Y,y:Q,z:W})}}setAmbientLightColor(Z){this._ambientLightColor=Z,this.emit("WORLD.SET_AMBIENT_LIGHT_COLOR",{world:this,color:Z})}setAmbientLightIntensity(Z){this._ambientLightIntensity=Z,this.emit("WORLD.SET_AMBIENT_LIGHT_INTENSITY",{world:this,intensity:Z})}setDirectionalLightColor(Z){this._directionalLightColor=Z,this.emit("WORLD.SET_DIRECTIONAL_LIGHT_COLOR",{world:this,color:Z})}setDirectionalLightIntensity(Z){this._directionalLightIntensity=Z,this.emit("WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY",{world:this,intensity:Z})}setDirectionalLightPosition(Z){this._directionalLightPosition=Z,this.emit("WORLD.SET_DIRECTIONAL_LIGHT_POSITION",{world:this,position:Z})}start(){this._loop.start(),this.emit("WORLD.START",{world:this,startedAtMs:Date.now()})}stop(){this._loop.stop(),this.emit("WORLD.STOP",{world:this,stoppedAtMs:Date.now()})}serialize(){return p0.serializeWorld(this)}}var K86=1,Q$1;((J)=>J.WORLD_CREATED="WORLD_MANAGER.WORLD_CREATED")(Q$1||={});class O3{static instance=new O3;_worlds=new Map;_nextWorldId=1;createWorld(Z){let J=new uq({...Z,id:this._nextWorldId++});return J.start(),this._worlds.set(J.id,J),q6.emit("WORLD_MANAGER.WORLD_CREATED",{world:J}),J}getAllWorlds(){return Array.from(this._worlds.values())}getDefaultWorld(){return this._worlds.get(K86)??this.createWorld({name:"Default World",skyboxUri:"skyboxes/partly-cloudy"})}getWorldsByTag(Z){let J=[];return this._worlds.forEach(($)=>{if($.tag===Z)J.push($)}),J}getWorld(Z){return this._worlds.get(Z)}}var W$1;(($)=>{$.START="GAMESERVER.START";$.STOP="GAMESERVER.STOP"})(W$1||={});function G86(Z){K1.init().then(()=>{return sZ.instance.modelRegistry.preloadModels()}).then(()=>{Z(sZ.instance.worldManager.getDefaultWorld()),sZ.instance.start()}).catch((J)=>{m.fatalError(`Failed to initialize the game engine, exiting. Error: ${J}`)})}class sZ{static _instance;_modelRegistry=N9.instance;_playerManager=e5.instance;_socket=bJ.instance;_worldManager=O3.instance;_webServer=tX.instance;constructor(){if(Bun)setInterval(()=>Bun.gc(!1),2000)}static get instance(){if(!this._instance)this._instance=new sZ;return this._instance}get modelRegistry(){return this._modelRegistry}get playerManager(){return this._playerManager}get socket(){return this._socket}get webServer(){return this._webServer}get worldManager(){return this._worldManager}start(){q6.emit("GAMESERVER.START",{startedAtMs:performance.now()}),this._webServer.start()}}class GW{static instance=new GW;constructor(){}async getGlobalData(Z){let J=await j7.instance.getData(Z);if(!J||J.error){if(J?.error)m.warning(`PersistenceManager.getGlobalData(): ${J.error.message}`);return}return J}async getPlayerData(Z){let J=await j7.instance.getData(this._getPlayerKey(Z));if(!J||J.error){if(J?.error)m.warning(`PersistenceManager.getPlayerData(): ${J.error.message}`);return}return J}async setGlobalData(Z,J){let $=await j7.instance.setData(Z,J);if(!$||$.error){if($?.error)m.warning(`PersistenceManager.setGlobalData(): ${$.error.message}`);return}return $}async setPlayerData(Z,J){let $=await j7.instance.setData(this._getPlayerKey(Z),J);if(!$||$.error){if($?.error)m.warning(`PersistenceManager.setPlayerData(): ${$.error.message}`);return}return $}_getPlayerKey(Z){return`player-${Z.id}`}}var X$1=["w","a","s","d","sp","sh","tb","ml","mr","q","e","r","f","z","x","c","v","1","2","3","4","5","6","7","8","9","0"],Sq;((W)=>{W.CHAT_MESSAGE_SEND="PLAYER.CHAT_MESSAGE_SEND";W.JOINED_WORLD="PLAYER.JOINED_WORLD";W.LEFT_WORLD="PLAYER.LEFT_WORLD";W.RECONNECTED_WORLD="PLAYER.RECONNECTED_WORLD";W.REQUEST_SYNC="PLAYER.REQUEST_SYNC"})(Sq||={});class w3 extends g0{static _devNextPlayerId=1;id;username;profilePictureUrl;camera;connection;ui;_input={};_lastUnreliableInputSequenceNumber=0;_world;constructor(Z,J){super();this.id=J?.user.id??`player-${w3._devNextPlayerId++}`,this.username=J?.user.username??this.id,this.profilePictureUrl=J?.user.profilePictureURL??void 0,this.camera=new xq(this),this.connection=Z,this.ui=new hq(this),Z.onPacket(Y0.PacketId.CHAT_MESSAGE_SEND,this._onChatMessageSendPacket),Z.onPacket(Y0.PacketId.DEBUG_CONFIG,this._onDebugConfigPacket),Z.onPacket(Y0.PacketId.INPUT,this._onInputPacket),Z.onPacket(Y0.PacketId.SYNC_REQUEST,this._onSyncRequestPacket),Z.onPacket(Y0.PacketId.UI_DATA_SEND,this._onUIDataSendPacket),this.joinWorld(sZ.instance.worldManager.getDefaultWorld())}get input(){return this._input}get world(){return this._world}disconnect(){this._leaveWorld(),this.connection.disconnect()}async getPersistedData(){return GW.instance.getPlayerData(this)}joinWorld(Z){if(this._world)this.disconnect();this._world=Z,this.emitWithWorld(this._world,"PLAYER.JOINED_WORLD",{player:this,world:this._world})}reconnect(){if(!this._world)return;this._lastUnreliableInputSequenceNumber=0,this.emitWithWorld(this._world,"PLAYER.RECONNECTED_WORLD",{player:this,world:this._world})}resetInputs(){this._input={}}async setPersistedData(Z){return GW.instance.setPlayerData(this,Z)}serialize(){return p0.serializePlayer(this)}_leaveWorld(){if(!this._world)return;this.emitWithWorld(this._world,"PLAYER.LEFT_WORLD",{player:this,world:this._world}),this._world=void 0}_onChatMessageSendPacket=(Z)=>{if(this._world)this.emitWithWorld(this._world,"PLAYER.CHAT_MESSAGE_SEND",{player:this,message:Z[1].m})};_onDebugConfigPacket=(Z)=>{console.log(Z)};_onInputPacket=(Z)=>{let J=Z[1];if(J.sq!==void 0){if(J.sq<this._lastUnreliableInputSequenceNumber)return;this._lastUnreliableInputSequenceNumber=J.sq}if(X$1.forEach(($)=>{let Y=$;if(J[Y]!==void 0)this._input[Y]=Boolean(J[Y])}),J.cp!==void 0)this.camera.setOrientationPitch(J.cp);if(J.cy!==void 0)this.camera.setOrientationYaw(J.cy)};_onSyncRequestPacket=()=>{if(this._world)this.emitWithWorld(this._world,"PLAYER.REQUEST_SYNC",{player:this,receivedAt:Date.now(),receivedAtMs:performance.now()})};_onUIDataSendPacket=(Z)=>{this.ui.emit("PLAYER_UI.DATA",{playerUI:this.ui,data:Z[1]})}}var of;(($)=>{$.BROADCAST_MESSAGE="CHAT.BROADCAST_MESSAGE";$.PLAYER_MESSAGE="CHAT.PLAYER_MESSAGE"})(of||={});class dq extends g0{_commandCallbacks={};_world;constructor(Z){super();this._world=Z,this._subscribeToPlayerEvents()}registerCommand(Z,J){this._commandCallbacks[Z]=J}unregisterCommand(Z){delete this._commandCallbacks[Z]}sendBroadcastMessage(Z,J){this._sendBroadcastMessage(void 0,Z,J)}sendPlayerMessage(Z,J,$){this.emitWithWorld(this._world,"CHAT.PLAYER_MESSAGE",{player:Z,message:J,color:$})}_subscribeToPlayerEvents(){this._world.on("PLAYER.CHAT_MESSAGE_SEND",(Z)=>{let{player:J,message:$}=Z,[Y,...Q]=$.split(" "),W=this._commandCallbacks[Y];if(W){W(J,Q,$);return}this._sendBroadcastMessage(J,$)})}_sendBroadcastMessage(Z,J,$){this.emitWithWorld(this._world,"CHAT.BROADCAST_MESSAGE",{player:Z,message:J,color:$})}}class cq extends b${autoCancelMouseLeftClick=!0;canJump=()=>!0;canRun=()=>!0;canSwim=()=>!0;canWalk=()=>!0;idleLoopedAnimations=["idle_upper","idle_lower"];interactOneshotAnimations=["simple_interact"];jumpOneshotAnimations=["jump_loop"];jumpVelocity=10;runLoopedAnimations=["run_upper","run_lower"];runVelocity=8;sticksToPlatforms=!0;swimFastVelocity=5;swimGravity=0.1;swimLoopedAnimations=["crawling"];swimMaxGravityVelocity=-1;swimSlowVelocity=3;swimUpwardVelocity=2;walkLoopedAnimations=["walk_upper","walk_lower"];walkVelocity=4;_stepAudio;_groundContactCount=0;_liquidContactCount=0;_platform;_swimUpwardCooldownAt=0;constructor(Z={}){super();this.autoCancelMouseLeftClick=Z.autoCancelMouseLeftClick??this.autoCancelMouseLeftClick,this.jumpVelocity=Z.jumpVelocity??this.jumpVelocity,this.runVelocity=Z.runVelocity??this.runVelocity,this.walkVelocity=Z.walkVelocity??this.walkVelocity,this.canJump=Z.canJump??this.canJump,this.canRun=Z.canRun??this.canRun,this.canSwim=Z.canSwim??this.canSwim,this.canWalk=Z.canWalk??this.canWalk,this.sticksToPlatforms=Z.sticksToPlatforms??this.sticksToPlatforms,this.swimFastVelocity=Z.swimFastVelocity??this.swimFastVelocity,this.swimGravity=Z.swimGravity??this.swimGravity,this.swimLoopedAnimations=Z.swimLoopedAnimations??this.swimLoopedAnimations,this.swimSlowVelocity=Z.swimSlowVelocity??this.swimSlowVelocity,this.swimUpwardVelocity=Z.swimUpwardVelocity??this.swimUpwardVelocity}get isGrounded(){return this._groundContactCount>0}get isOnPlatform(){return!!this._platform}get isSwimming(){return this._liquidContactCount>0}get platform(){return this._platform}attach(Z){this._stepAudio=new D3({uri:"audio/sfx/step/stone/stone-step-04.mp3",loop:!0,volume:0.1,referenceDistance:2,cutoffDistance:15,attachedToEntity:Z}),Z.setCcdEnabled(!0),Z.lockAllRotations(),Z.on("ENTITY.BLOCK_COLLISION",({blockType:J,started:$})=>{if(!J.isLiquid||!this.canSwim(this))return;if(this._liquidContactCount<=0&&$){let Y=Z.linearVelocity;Z.setLinearVelocity({x:Y.x*this.swimGravity,y:Y.y*this.swimGravity,z:Y.z*this.swimGravity})}if(this._liquidContactCount+=$?1:-1,this._liquidContactCount>0)Z.setGravityScale(this.swimGravity),Z.startModelLoopedAnimations(this.swimLoopedAnimations),this._swimUpwardCooldownAt=performance.now()+600;else Z.setGravityScale(1),Z.stopModelAnimations(this.swimLoopedAnimations)})}spawn(Z){if(!Z.isSpawned)return m.error("DefaultPlayerEntityController.spawn(): Entity is not spawned!");Z.createAndAddChildCollider({shape:"cylinder",radius:0.23,halfHeight:0.125,collisionGroups:{belongsTo:[4],collidesWith:[1,2]},isSensor:!0,relativePosition:{x:0,y:-0.75,z:0},tag:"groundSensor",onCollision:(J,$)=>{if(!Z.isSpawned)return;if(!(J instanceof s5)||!J.isLiquid)this._groundContactCount+=$?1:-1;if(!this._groundContactCount&&!this.isSwimming)Z.startModelOneshotAnimations(this.jumpOneshotAnimations);else Z.stopModelAnimations(this.jumpOneshotAnimations);if(!(J instanceof a8)||!J.isKinematic)return;if($&&this.sticksToPlatforms)this._platform=J;else if(J===this._platform&&!$)this._platform=void 0}}),Z.createAndAddChildCollider({shape:"capsule",halfHeight:0.33,radius:0.4,collisionGroups:{belongsTo:[4],collidesWith:[1,2]},friction:0,frictionCombineRule:1,tag:"wallCollider"})}tickWithPlayerInput(Z,J,$,Y){if(!Z.isSpawned||!Z.world)return;if(super.tickWithPlayerInput(Z,J,$,Y),Z.parent)return;let{w:Q,a:W,s:X,d:K,sp:G,sh:z,ml:H}=J,{yaw:V}=$,q=Z.linearVelocity,F={x:0,y:0,z:0},U=z;if(this.isGrounded&&!this.isSwimming&&(Q||W||X||K)){if(U)Z.stopModelAnimations(Array.from(Z.modelLoopedAnimations).filter((j)=>!this.runLoopedAnimations.includes(j))),Z.startModelLoopedAnimations(this.runLoopedAnimations),this._stepAudio?.setPlaybackRate(0.75);else Z.stopModelAnimations(Array.from(Z.modelLoopedAnimations).filter((j)=>!this.walkLoopedAnimations.includes(j))),Z.startModelLoopedAnimations(this.walkLoopedAnimations),this._stepAudio?.setPlaybackRate(0.51);this._stepAudio?.play(Z.world,!this._stepAudio?.isPlaying)}else if(this._stepAudio?.pause(),!this.isSwimming)Z.stopModelAnimations(Array.from(Z.modelLoopedAnimations).filter((j)=>!this.idleLoopedAnimations.includes(j))),Z.startModelLoopedAnimations(this.idleLoopedAnimations);if(H)Z.startModelOneshotAnimations(this.interactOneshotAnimations),J.ml=!this.autoCancelMouseLeftClick;if(U&&this.canRun(this)||!U&&this.canWalk(this)){let j=!this.isSwimming?U?this.runVelocity:this.walkVelocity:U?this.swimFastVelocity:this.swimSlowVelocity;if(Q)F.x-=j*Math.sin(V),F.z-=j*Math.cos(V);if(X)F.x+=j*Math.sin(V),F.z+=j*Math.cos(V);if(W)F.x-=j*Math.cos(V),F.z+=j*Math.sin(V);if(K)F.x+=j*Math.cos(V),F.z-=j*Math.sin(V);let M=Math.sqrt(F.x*F.x+F.z*F.z);if(M>j){let N=j/M;F.x*=N,F.z*=N}}if(this.isSwimming){if(q.y<this.swimMaxGravityVelocity)Z.setLinearVelocity({...q,y:this.swimMaxGravityVelocity});if(q.y>this.swimUpwardVelocity*2)Z.setLinearVelocity({...q,y:this.swimUpwardVelocity*2})}if(G&&this.canJump(this)){if(this.isGrounded&&!this.isSwimming&&q.y>-0.001&&q.y<=3)F.y=this.jumpVelocity;else if(this.isSwimming&&performance.now()>this._swimUpwardCooldownAt)F.y=this.swimUpwardVelocity*Z.gravityScale}let w=this._platform?this._platform.linearVelocity:{x:0,y:0,z:0},L={x:F.x-q.x+w.x,y:F.y+w.y,z:F.z-q.z+w.z};if(!(this.runVelocity>0&&Math.abs(q.x)>this.runVelocity||this.jumpVelocity>0&&Math.abs(q.y)>this.jumpVelocity||this.runVelocity>0&&Math.abs(q.z)>this.runVelocity)||this.isOnPlatform){if(Object.values(L).some((j)=>j!==0)){let j=Z.mass;Z.applyImpulse({x:L.x*j,y:L.y*j,z:L.z*j})}}if(V!==void 0){let j=V/2;Z.setRotation({x:0,y:Math.fround(Math.sin(j)),z:0,w:Math.fround(Math.cos(j))})}}}class rf extends d7{constructor(Z){super({modelUri:"models/players/player.gltf",modelLoopedAnimations:["idle_lower","idle_upper"],modelScale:0.5,...Z});if(!Z.controller)this.setController(new cq)}}var P0=0.000001,Y1=typeof Float32Array!=="undefined"?Float32Array:Array,c7=Math.random;var To6=Math.PI/180;if(!Math.hypot)Math.hypot=function(){var Z=0,J=arguments.length;while(J--)Z+=arguments[J]*arguments[J];return Math.sqrt(Z)};var m8={};$4(m8,{transpose:()=>L86,subtract:()=>G$1,sub:()=>_86,str:()=>P86,set:()=>U86,scale:()=>M86,rotate:()=>j86,multiplyScalarAndAdd:()=>v86,multiplyScalar:()=>I86,multiply:()=>K$1,mul:()=>S86,invert:()=>w86,identity:()=>q86,fromValues:()=>F86,fromScaling:()=>N86,fromRotation:()=>R86,frob:()=>D86,exactEquals:()=>k86,equals:()=>E86,determinant:()=>O86,create:()=>z86,copy:()=>V86,clone:()=>H86,adjoint:()=>B86,add:()=>T86,LDU:()=>C86});function z86(){var Z=new Y1(4);if(Y1!=Float32Array)Z[1]=0,Z[2]=0;return Z[0]=1,Z[3]=1,Z}function H86(Z){var J=new Y1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function V86(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function q86(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=1,Z}function F86(Z,J,$,Y){var Q=new Y1(4);return Q[0]=Z,Q[1]=J,Q[2]=$,Q[3]=Y,Q}function U86(Z,J,$,Y,Q){return Z[0]=J,Z[1]=$,Z[2]=Y,Z[3]=Q,Z}function L86(Z,J){if(Z===J){var $=J[1];Z[1]=J[2],Z[2]=$}else Z[0]=J[0],Z[1]=J[2],Z[2]=J[1],Z[3]=J[3];return Z}function w86(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=$*W-Q*Y;if(!X)return null;return X=1/X,Z[0]=W*X,Z[1]=-Y*X,Z[2]=-Q*X,Z[3]=$*X,Z}function B86(Z,J){var $=J[0];return Z[0]=J[3],Z[1]=-J[1],Z[2]=-J[2],Z[3]=$,Z}function O86(Z){return Z[0]*Z[3]-Z[2]*Z[1]}function K$1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=$[0],G=$[1],z=$[2],H=$[3];return Z[0]=Y*K+W*G,Z[1]=Q*K+X*G,Z[2]=Y*z+W*H,Z[3]=Q*z+X*H,Z}function j86(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin($),G=Math.cos($);return Z[0]=Y*G+W*K,Z[1]=Q*G+X*K,Z[2]=Y*-K+W*G,Z[3]=Q*-K+X*G,Z}function M86(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=$[0],G=$[1];return Z[0]=Y*K,Z[1]=Q*K,Z[2]=W*G,Z[3]=X*G,Z}function R86(Z,J){var $=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=$,Z[2]=-$,Z[3]=Y,Z}function N86(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=J[1],Z}function P86(Z){return"mat2("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}function D86(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3])}function C86(Z,J,$,Y){return Z[2]=Y[2]/Y[0],$[0]=Y[0],$[1]=Y[1],$[3]=Y[3]-Z[2]*$[1],[Z,J,$]}function T86(Z,J,$){return Z[0]=J[0]+$[0],Z[1]=J[1]+$[1],Z[2]=J[2]+$[2],Z[3]=J[3]+$[3],Z}function G$1(Z,J,$){return Z[0]=J[0]-$[0],Z[1]=J[1]-$[1],Z[2]=J[2]-$[2],Z[3]=J[3]-$[3],Z}function k86(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function E86(Z,J){var $=Z[0],Y=Z[1],Q=Z[2],W=Z[3],X=J[0],K=J[1],G=J[2],z=J[3];return Math.abs($-X)<=P0*Math.max(1,Math.abs($),Math.abs(X))&&Math.abs(Y-K)<=P0*Math.max(1,Math.abs(Y),Math.abs(K))&&Math.abs(Q-G)<=P0*Math.max(1,Math.abs(Q),Math.abs(G))&&Math.abs(W-z)<=P0*Math.max(1,Math.abs(W),Math.abs(z))}function I86(Z,J,$){return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z[3]=J[3]*$,Z}function v86(Z,J,$,Y){return Z[0]=J[0]+$[0]*Y,Z[1]=J[1]+$[1]*Y,Z[2]=J[2]+$[2]*Y,Z[3]=J[3]+$[3]*Y,Z}var S86=K$1,_86=G$1;var l1={};$4(l1,{transpose:()=>g86,translate:()=>c86,subtract:()=>H$1,sub:()=>K66,str:()=>e86,set:()=>b86,scale:()=>p86,rotate:()=>l86,projection:()=>t86,normalFromMat4:()=>r86,multiplyScalarAndAdd:()=>Y66,multiplyScalar:()=>$66,multiply:()=>z$1,mul:()=>X66,invert:()=>m86,identity:()=>y86,fromValues:()=>f86,fromTranslation:()=>i86,fromScaling:()=>a86,fromRotation:()=>n86,fromQuat:()=>o86,fromMat4:()=>A86,fromMat2d:()=>s86,frob:()=>Z66,exactEquals:()=>Q66,equals:()=>W66,determinant:()=>d86,create:()=>tf,copy:()=>h86,clone:()=>x86,adjoint:()=>u86,add:()=>J66});function tf(){var Z=new Y1(9);if(Y1!=Float32Array)Z[1]=0,Z[2]=0,Z[3]=0,Z[5]=0,Z[6]=0,Z[7]=0;return Z[0]=1,Z[4]=1,Z[8]=1,Z}function A86(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[4],Z[4]=J[5],Z[5]=J[6],Z[6]=J[8],Z[7]=J[9],Z[8]=J[10],Z}function x86(Z){var J=new Y1(9);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J[4]=Z[4],J[5]=Z[5],J[6]=Z[6],J[7]=Z[7],J[8]=Z[8],J}function h86(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z[4]=J[4],Z[5]=J[5],Z[6]=J[6],Z[7]=J[7],Z[8]=J[8],Z}function f86(Z,J,$,Y,Q,W,X,K,G){var z=new Y1(9);return z[0]=Z,z[1]=J,z[2]=$,z[3]=Y,z[4]=Q,z[5]=W,z[6]=X,z[7]=K,z[8]=G,z}function b86(Z,J,$,Y,Q,W,X,K,G,z){return Z[0]=J,Z[1]=$,Z[2]=Y,Z[3]=Q,Z[4]=W,Z[5]=X,Z[6]=K,Z[7]=G,Z[8]=z,Z}function y86(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=1,Z[5]=0,Z[6]=0,Z[7]=0,Z[8]=1,Z}function g86(Z,J){if(Z===J){var $=J[1],Y=J[2],Q=J[5];Z[1]=J[3],Z[2]=J[6],Z[3]=$,Z[5]=J[7],Z[6]=Y,Z[7]=Q}else Z[0]=J[0],Z[1]=J[3],Z[2]=J[6],Z[3]=J[1],Z[4]=J[4],Z[5]=J[7],Z[6]=J[2],Z[7]=J[5],Z[8]=J[8];return Z}function m86(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=H*X-K*z,q=-H*W+K*G,F=z*W-X*G,U=$*V+Y*q+Q*F;if(!U)return null;return U=1/U,Z[0]=V*U,Z[1]=(-H*Y+Q*z)*U,Z[2]=(K*Y-Q*X)*U,Z[3]=q*U,Z[4]=(H*$-Q*G)*U,Z[5]=(-K*$+Q*W)*U,Z[6]=F*U,Z[7]=(-z*$+Y*G)*U,Z[8]=(X*$-Y*W)*U,Z}function u86(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],H=J[8];return Z[0]=X*H-K*z,Z[1]=Q*z-Y*H,Z[2]=Y*K-Q*X,Z[3]=K*G-W*H,Z[4]=$*H-Q*G,Z[5]=Q*W-$*K,Z[6]=W*z-X*G,Z[7]=Y*G-$*z,Z[8]=$*X-Y*W,Z}function d86(Z){var J=Z[0],$=Z[1],Y=Z[2],Q=Z[3],W=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8];return J*(z*W-X*G)+$*(-z*Q+X*K)+Y*(G*Q-W*K)}function z$1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=$[0],F=$[1],U=$[2],w=$[3],L=$[4],O=$[5],j=$[6],M=$[7],N=$[8];return Z[0]=q*Y+F*X+U*z,Z[1]=q*Q+F*K+U*H,Z[2]=q*W+F*G+U*V,Z[3]=w*Y+L*X+O*z,Z[4]=w*Q+L*K+O*H,Z[5]=w*W+L*G+O*V,Z[6]=j*Y+M*X+N*z,Z[7]=j*Q+M*K+N*H,Z[8]=j*W+M*G+N*V,Z}function c86(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=$[0],F=$[1];return Z[0]=Y,Z[1]=Q,Z[2]=W,Z[3]=X,Z[4]=K,Z[5]=G,Z[6]=q*Y+F*X+z,Z[7]=q*Q+F*K+H,Z[8]=q*W+F*G+V,Z}function l86(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=Math.sin($),F=Math.cos($);return Z[0]=F*Y+q*X,Z[1]=F*Q+q*K,Z[2]=F*W+q*G,Z[3]=F*X-q*Y,Z[4]=F*K-q*Q,Z[5]=F*G-q*W,Z[6]=z,Z[7]=H,Z[8]=V,Z}function p86(Z,J,$){var Y=$[0],Q=$[1];return Z[0]=Y*J[0],Z[1]=Y*J[1],Z[2]=Y*J[2],Z[3]=Q*J[3],Z[4]=Q*J[4],Z[5]=Q*J[5],Z[6]=J[6],Z[7]=J[7],Z[8]=J[8],Z}function i86(Z,J){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=1,Z[5]=0,Z[6]=J[0],Z[7]=J[1],Z[8]=1,Z}function n86(Z,J){var $=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=$,Z[2]=0,Z[3]=-$,Z[4]=Y,Z[5]=0,Z[6]=0,Z[7]=0,Z[8]=1,Z}function a86(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=J[1],Z[5]=0,Z[6]=0,Z[7]=0,Z[8]=1,Z}function s86(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=0,Z[3]=J[2],Z[4]=J[3],Z[5]=0,Z[6]=J[4],Z[7]=J[5],Z[8]=1,Z}function o86(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=$+$,K=Y+Y,G=Q+Q,z=$*X,H=Y*X,V=Y*K,q=Q*X,F=Q*K,U=Q*G,w=W*X,L=W*K,O=W*G;return Z[0]=1-V-U,Z[3]=H-O,Z[6]=q+L,Z[1]=H+O,Z[4]=1-z-U,Z[7]=F-w,Z[2]=q-L,Z[5]=F+w,Z[8]=1-z-V,Z}function r86(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],O=J[15],j=$*K-Y*X,M=$*G-Q*X,N=$*z-W*X,D=Y*G-Q*K,P=Y*z-W*K,C=Q*z-W*G,T=H*w-V*U,E=H*L-q*U,A=H*O-F*U,S=V*L-q*w,x=V*O-F*w,I=q*O-F*L,v=j*I-M*x+N*S+D*A-P*E+C*T;if(!v)return null;return v=1/v,Z[0]=(K*I-G*x+z*S)*v,Z[1]=(G*A-X*I-z*E)*v,Z[2]=(X*x-K*A+z*T)*v,Z[3]=(Q*x-Y*I-W*S)*v,Z[4]=($*I-Q*A+W*E)*v,Z[5]=(Y*A-$*x-W*T)*v,Z[6]=(w*C-L*P+O*D)*v,Z[7]=(L*N-U*C-O*M)*v,Z[8]=(U*P-w*N+O*j)*v,Z}function t86(Z,J,$){return Z[0]=2/J,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=-2/$,Z[5]=0,Z[6]=-1,Z[7]=1,Z[8]=1,Z}function e86(Z){return"mat3("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+")"}function Z66(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8])}function J66(Z,J,$){return Z[0]=J[0]+$[0],Z[1]=J[1]+$[1],Z[2]=J[2]+$[2],Z[3]=J[3]+$[3],Z[4]=J[4]+$[4],Z[5]=J[5]+$[5],Z[6]=J[6]+$[6],Z[7]=J[7]+$[7],Z[8]=J[8]+$[8],Z}function H$1(Z,J,$){return Z[0]=J[0]-$[0],Z[1]=J[1]-$[1],Z[2]=J[2]-$[2],Z[3]=J[3]-$[3],Z[4]=J[4]-$[4],Z[5]=J[5]-$[5],Z[6]=J[6]-$[6],Z[7]=J[7]-$[7],Z[8]=J[8]-$[8],Z}function $66(Z,J,$){return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z[3]=J[3]*$,Z[4]=J[4]*$,Z[5]=J[5]*$,Z[6]=J[6]*$,Z[7]=J[7]*$,Z[8]=J[8]*$,Z}function Y66(Z,J,$,Y){return Z[0]=J[0]+$[0]*Y,Z[1]=J[1]+$[1]*Y,Z[2]=J[2]+$[2]*Y,Z[3]=J[3]+$[3]*Y,Z[4]=J[4]+$[4]*Y,Z[5]=J[5]+$[5]*Y,Z[6]=J[6]+$[6]*Y,Z[7]=J[7]+$[7]*Y,Z[8]=J[8]+$[8]*Y,Z}function Q66(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]&&Z[4]===J[4]&&Z[5]===J[5]&&Z[6]===J[6]&&Z[7]===J[7]&&Z[8]===J[8]}function W66(Z,J){var $=Z[0],Y=Z[1],Q=Z[2],W=Z[3],X=Z[4],K=Z[5],G=Z[6],z=Z[7],H=Z[8],V=J[0],q=J[1],F=J[2],U=J[3],w=J[4],L=J[5],O=J[6],j=J[7],M=J[8];return Math.abs($-V)<=P0*Math.max(1,Math.abs($),Math.abs(V))&&Math.abs(Y-q)<=P0*Math.max(1,Math.abs(Y),Math.abs(q))&&Math.abs(Q-F)<=P0*Math.max(1,Math.abs(Q),Math.abs(F))&&Math.abs(W-U)<=P0*Math.max(1,Math.abs(W),Math.abs(U))&&Math.abs(X-w)<=P0*Math.max(1,Math.abs(X),Math.abs(w))&&Math.abs(K-L)<=P0*Math.max(1,Math.abs(K),Math.abs(L))&&Math.abs(G-O)<=P0*Math.max(1,Math.abs(G),Math.abs(O))&&Math.abs(z-j)<=P0*Math.max(1,Math.abs(z),Math.abs(j))&&Math.abs(H-M)<=P0*Math.max(1,Math.abs(H),Math.abs(M))}var X66=z$1,K66=H$1;var o0={};$4(o0,{transpose:()=>F66,translate:()=>B66,targetTo:()=>d66,subtract:()=>B$1,sub:()=>r66,str:()=>c66,set:()=>q66,scale:()=>O66,rotateZ:()=>N66,rotateY:()=>R66,rotateX:()=>M66,rotate:()=>j66,perspectiveZO:()=>b66,perspectiveNO:()=>L$1,perspectiveFromFieldOfView:()=>y66,perspective:()=>f66,orthoZO:()=>m66,orthoNO:()=>w$1,ortho:()=>g66,multiplyScalarAndAdd:()=>n66,multiplyScalar:()=>i66,multiply:()=>q$1,mul:()=>o66,lookAt:()=>u66,invert:()=>U66,identity:()=>V$1,getTranslation:()=>v66,getScaling:()=>U$1,getRotation:()=>S66,frustum:()=>h66,fromZRotation:()=>E66,fromYRotation:()=>k66,fromXRotation:()=>T66,fromValues:()=>V66,fromTranslation:()=>P66,fromScaling:()=>D66,fromRotationTranslationScaleOrigin:()=>A66,fromRotationTranslationScale:()=>_66,fromRotationTranslation:()=>F$1,fromRotation:()=>C66,fromQuat2:()=>I66,fromQuat:()=>x66,frob:()=>l66,exactEquals:()=>a66,equals:()=>s66,determinant:()=>w66,create:()=>G66,copy:()=>H66,clone:()=>z66,adjoint:()=>L66,add:()=>p66});function G66(){var Z=new Y1(16);if(Y1!=Float32Array)Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0;return Z[0]=1,Z[5]=1,Z[10]=1,Z[15]=1,Z}function z66(Z){var J=new Y1(16);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J[4]=Z[4],J[5]=Z[5],J[6]=Z[6],J[7]=Z[7],J[8]=Z[8],J[9]=Z[9],J[10]=Z[10],J[11]=Z[11],J[12]=Z[12],J[13]=Z[13],J[14]=Z[14],J[15]=Z[15],J}function H66(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z[4]=J[4],Z[5]=J[5],Z[6]=J[6],Z[7]=J[7],Z[8]=J[8],Z[9]=J[9],Z[10]=J[10],Z[11]=J[11],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15],Z}function V66(Z,J,$,Y,Q,W,X,K,G,z,H,V,q,F,U,w){var L=new Y1(16);return L[0]=Z,L[1]=J,L[2]=$,L[3]=Y,L[4]=Q,L[5]=W,L[6]=X,L[7]=K,L[8]=G,L[9]=z,L[10]=H,L[11]=V,L[12]=q,L[13]=F,L[14]=U,L[15]=w,L}function q66(Z,J,$,Y,Q,W,X,K,G,z,H,V,q,F,U,w,L){return Z[0]=J,Z[1]=$,Z[2]=Y,Z[3]=Q,Z[4]=W,Z[5]=X,Z[6]=K,Z[7]=G,Z[8]=z,Z[9]=H,Z[10]=V,Z[11]=q,Z[12]=F,Z[13]=U,Z[14]=w,Z[15]=L,Z}function V$1(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=1,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=1,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function F66(Z,J){if(Z===J){var $=J[1],Y=J[2],Q=J[3],W=J[6],X=J[7],K=J[11];Z[1]=J[4],Z[2]=J[8],Z[3]=J[12],Z[4]=$,Z[6]=J[9],Z[7]=J[13],Z[8]=Y,Z[9]=W,Z[11]=J[14],Z[12]=Q,Z[13]=X,Z[14]=K}else Z[0]=J[0],Z[1]=J[4],Z[2]=J[8],Z[3]=J[12],Z[4]=J[1],Z[5]=J[5],Z[6]=J[9],Z[7]=J[13],Z[8]=J[2],Z[9]=J[6],Z[10]=J[10],Z[11]=J[14],Z[12]=J[3],Z[13]=J[7],Z[14]=J[11],Z[15]=J[15];return Z}function U66(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],O=J[15],j=$*K-Y*X,M=$*G-Q*X,N=$*z-W*X,D=Y*G-Q*K,P=Y*z-W*K,C=Q*z-W*G,T=H*w-V*U,E=H*L-q*U,A=H*O-F*U,S=V*L-q*w,x=V*O-F*w,I=q*O-F*L,v=j*I-M*x+N*S+D*A-P*E+C*T;if(!v)return null;return v=1/v,Z[0]=(K*I-G*x+z*S)*v,Z[1]=(Q*x-Y*I-W*S)*v,Z[2]=(w*C-L*P+O*D)*v,Z[3]=(q*P-V*C-F*D)*v,Z[4]=(G*A-X*I-z*E)*v,Z[5]=($*I-Q*A+W*E)*v,Z[6]=(L*N-U*C-O*M)*v,Z[7]=(H*C-q*N+F*M)*v,Z[8]=(X*x-K*A+z*T)*v,Z[9]=(Y*A-$*x-W*T)*v,Z[10]=(U*P-w*N+O*j)*v,Z[11]=(V*N-H*P-F*j)*v,Z[12]=(K*E-X*S-G*T)*v,Z[13]=($*S-Y*E+Q*T)*v,Z[14]=(w*M-U*D-L*j)*v,Z[15]=(H*D-V*M+q*j)*v,Z}function L66(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],O=J[15];return Z[0]=K*(q*O-F*L)-V*(G*O-z*L)+w*(G*F-z*q),Z[1]=-(Y*(q*O-F*L)-V*(Q*O-W*L)+w*(Q*F-W*q)),Z[2]=Y*(G*O-z*L)-K*(Q*O-W*L)+w*(Q*z-W*G),Z[3]=-(Y*(G*F-z*q)-K*(Q*F-W*q)+V*(Q*z-W*G)),Z[4]=-(X*(q*O-F*L)-H*(G*O-z*L)+U*(G*F-z*q)),Z[5]=$*(q*O-F*L)-H*(Q*O-W*L)+U*(Q*F-W*q),Z[6]=-($*(G*O-z*L)-X*(Q*O-W*L)+U*(Q*z-W*G)),Z[7]=$*(G*F-z*q)-X*(Q*F-W*q)+H*(Q*z-W*G),Z[8]=X*(V*O-F*w)-H*(K*O-z*w)+U*(K*F-z*V),Z[9]=-($*(V*O-F*w)-H*(Y*O-W*w)+U*(Y*F-W*V)),Z[10]=$*(K*O-z*w)-X*(Y*O-W*w)+U*(Y*z-W*K),Z[11]=-($*(K*F-z*V)-X*(Y*F-W*V)+H*(Y*z-W*K)),Z[12]=-(X*(V*L-q*w)-H*(K*L-G*w)+U*(K*q-G*V)),Z[13]=$*(V*L-q*w)-H*(Y*L-Q*w)+U*(Y*q-Q*V),Z[14]=-($*(K*L-G*w)-X*(Y*L-Q*w)+U*(Y*G-Q*K)),Z[15]=$*(K*q-G*V)-X*(Y*q-Q*V)+H*(Y*G-Q*K),Z}function w66(Z){var J=Z[0],$=Z[1],Y=Z[2],Q=Z[3],W=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],H=Z[9],V=Z[10],q=Z[11],F=Z[12],U=Z[13],w=Z[14],L=Z[15],O=J*X-$*W,j=J*K-Y*W,M=J*G-Q*W,N=$*K-Y*X,D=$*G-Q*X,P=Y*G-Q*K,C=z*U-H*F,T=z*w-V*F,E=z*L-q*F,A=H*w-V*U,S=H*L-q*U,x=V*L-q*w;return O*x-j*S+M*A+N*E-D*T+P*C}function q$1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=J[9],F=J[10],U=J[11],w=J[12],L=J[13],O=J[14],j=J[15],M=$[0],N=$[1],D=$[2],P=$[3];return Z[0]=M*Y+N*K+D*V+P*w,Z[1]=M*Q+N*G+D*q+P*L,Z[2]=M*W+N*z+D*F+P*O,Z[3]=M*X+N*H+D*U+P*j,M=$[4],N=$[5],D=$[6],P=$[7],Z[4]=M*Y+N*K+D*V+P*w,Z[5]=M*Q+N*G+D*q+P*L,Z[6]=M*W+N*z+D*F+P*O,Z[7]=M*X+N*H+D*U+P*j,M=$[8],N=$[9],D=$[10],P=$[11],Z[8]=M*Y+N*K+D*V+P*w,Z[9]=M*Q+N*G+D*q+P*L,Z[10]=M*W+N*z+D*F+P*O,Z[11]=M*X+N*H+D*U+P*j,M=$[12],N=$[13],D=$[14],P=$[15],Z[12]=M*Y+N*K+D*V+P*w,Z[13]=M*Q+N*G+D*q+P*L,Z[14]=M*W+N*z+D*F+P*O,Z[15]=M*X+N*H+D*U+P*j,Z}function B66(Z,J,$){var Y=$[0],Q=$[1],W=$[2],X,K,G,z,H,V,q,F,U,w,L,O;if(J===Z)Z[12]=J[0]*Y+J[4]*Q+J[8]*W+J[12],Z[13]=J[1]*Y+J[5]*Q+J[9]*W+J[13],Z[14]=J[2]*Y+J[6]*Q+J[10]*W+J[14],Z[15]=J[3]*Y+J[7]*Q+J[11]*W+J[15];else X=J[0],K=J[1],G=J[2],z=J[3],H=J[4],V=J[5],q=J[6],F=J[7],U=J[8],w=J[9],L=J[10],O=J[11],Z[0]=X,Z[1]=K,Z[2]=G,Z[3]=z,Z[4]=H,Z[5]=V,Z[6]=q,Z[7]=F,Z[8]=U,Z[9]=w,Z[10]=L,Z[11]=O,Z[12]=X*Y+H*Q+U*W+J[12],Z[13]=K*Y+V*Q+w*W+J[13],Z[14]=G*Y+q*Q+L*W+J[14],Z[15]=z*Y+F*Q+O*W+J[15];return Z}function O66(Z,J,$){var Y=$[0],Q=$[1],W=$[2];return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z[2]=J[2]*Y,Z[3]=J[3]*Y,Z[4]=J[4]*Q,Z[5]=J[5]*Q,Z[6]=J[6]*Q,Z[7]=J[7]*Q,Z[8]=J[8]*W,Z[9]=J[9]*W,Z[10]=J[10]*W,Z[11]=J[11]*W,Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15],Z}function j66(Z,J,$,Y){var Q=Y[0],W=Y[1],X=Y[2],K=Math.hypot(Q,W,X),G,z,H,V,q,F,U,w,L,O,j,M,N,D,P,C,T,E,A,S,x,I,v,f;if(K<P0)return null;if(K=1/K,Q*=K,W*=K,X*=K,G=Math.sin($),z=Math.cos($),H=1-z,V=J[0],q=J[1],F=J[2],U=J[3],w=J[4],L=J[5],O=J[6],j=J[7],M=J[8],N=J[9],D=J[10],P=J[11],C=Q*Q*H+z,T=W*Q*H+X*G,E=X*Q*H-W*G,A=Q*W*H-X*G,S=W*W*H+z,x=X*W*H+Q*G,I=Q*X*H+W*G,v=W*X*H-Q*G,f=X*X*H+z,Z[0]=V*C+w*T+M*E,Z[1]=q*C+L*T+N*E,Z[2]=F*C+O*T+D*E,Z[3]=U*C+j*T+P*E,Z[4]=V*A+w*S+M*x,Z[5]=q*A+L*S+N*x,Z[6]=F*A+O*S+D*x,Z[7]=U*A+j*S+P*x,Z[8]=V*I+w*v+M*f,Z[9]=q*I+L*v+N*f,Z[10]=F*I+O*v+D*f,Z[11]=U*I+j*v+P*f,J!==Z)Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z}function M66(Z,J,$){var Y=Math.sin($),Q=Math.cos($),W=J[4],X=J[5],K=J[6],G=J[7],z=J[8],H=J[9],V=J[10],q=J[11];if(J!==Z)Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[4]=W*Q+z*Y,Z[5]=X*Q+H*Y,Z[6]=K*Q+V*Y,Z[7]=G*Q+q*Y,Z[8]=z*Q-W*Y,Z[9]=H*Q-X*Y,Z[10]=V*Q-K*Y,Z[11]=q*Q-G*Y,Z}function R66(Z,J,$){var Y=Math.sin($),Q=Math.cos($),W=J[0],X=J[1],K=J[2],G=J[3],z=J[8],H=J[9],V=J[10],q=J[11];if(J!==Z)Z[4]=J[4],Z[5]=J[5],Z[6]=J[6],Z[7]=J[7],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[0]=W*Q-z*Y,Z[1]=X*Q-H*Y,Z[2]=K*Q-V*Y,Z[3]=G*Q-q*Y,Z[8]=W*Y+z*Q,Z[9]=X*Y+H*Q,Z[10]=K*Y+V*Q,Z[11]=G*Y+q*Q,Z}function N66(Z,J,$){var Y=Math.sin($),Q=Math.cos($),W=J[0],X=J[1],K=J[2],G=J[3],z=J[4],H=J[5],V=J[6],q=J[7];if(J!==Z)Z[8]=J[8],Z[9]=J[9],Z[10]=J[10],Z[11]=J[11],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[0]=W*Q+z*Y,Z[1]=X*Q+H*Y,Z[2]=K*Q+V*Y,Z[3]=G*Q+q*Y,Z[4]=z*Q-W*Y,Z[5]=H*Q-X*Y,Z[6]=V*Q-K*Y,Z[7]=q*Q-G*Y,Z}function P66(Z,J){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=1,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=1,Z[11]=0,Z[12]=J[0],Z[13]=J[1],Z[14]=J[2],Z[15]=1,Z}function D66(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=J[1],Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=J[2],Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function C66(Z,J,$){var Y=$[0],Q=$[1],W=$[2],X=Math.hypot(Y,Q,W),K,G,z;if(X<P0)return null;return X=1/X,Y*=X,Q*=X,W*=X,K=Math.sin(J),G=Math.cos(J),z=1-G,Z[0]=Y*Y*z+G,Z[1]=Q*Y*z+W*K,Z[2]=W*Y*z-Q*K,Z[3]=0,Z[4]=Y*Q*z-W*K,Z[5]=Q*Q*z+G,Z[6]=W*Q*z+Y*K,Z[7]=0,Z[8]=Y*W*z+Q*K,Z[9]=Q*W*z-Y*K,Z[10]=W*W*z+G,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function T66(Z,J){var $=Math.sin(J),Y=Math.cos(J);return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=Y,Z[6]=$,Z[7]=0,Z[8]=0,Z[9]=-$,Z[10]=Y,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function k66(Z,J){var $=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=0,Z[2]=-$,Z[3]=0,Z[4]=0,Z[5]=1,Z[6]=0,Z[7]=0,Z[8]=$,Z[9]=0,Z[10]=Y,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function E66(Z,J){var $=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=$,Z[2]=0,Z[3]=0,Z[4]=-$,Z[5]=Y,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=1,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function F$1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=Y+Y,G=Q+Q,z=W+W,H=Y*K,V=Y*G,q=Y*z,F=Q*G,U=Q*z,w=W*z,L=X*K,O=X*G,j=X*z;return Z[0]=1-(F+w),Z[1]=V+j,Z[2]=q-O,Z[3]=0,Z[4]=V-j,Z[5]=1-(H+w),Z[6]=U+L,Z[7]=0,Z[8]=q+O,Z[9]=U-L,Z[10]=1-(H+F),Z[11]=0,Z[12]=$[0],Z[13]=$[1],Z[14]=$[2],Z[15]=1,Z}function I66(Z,J){var $=new Y1(3),Y=-J[0],Q=-J[1],W=-J[2],X=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=Y*Y+Q*Q+W*W+X*X;if(V>0)$[0]=(K*X+H*Y+G*W-z*Q)*2/V,$[1]=(G*X+H*Q+z*Y-K*W)*2/V,$[2]=(z*X+H*W+K*Q-G*Y)*2/V;else $[0]=(K*X+H*Y+G*W-z*Q)*2,$[1]=(G*X+H*Q+z*Y-K*W)*2,$[2]=(z*X+H*W+K*Q-G*Y)*2;return F$1(Z,J,$),Z}function v66(Z,J){return Z[0]=J[12],Z[1]=J[13],Z[2]=J[14],Z}function U$1(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[4],X=J[5],K=J[6],G=J[8],z=J[9],H=J[10];return Z[0]=Math.hypot($,Y,Q),Z[1]=Math.hypot(W,X,K),Z[2]=Math.hypot(G,z,H),Z}function S66(Z,J){var $=new Y1(3);U$1($,J);var Y=1/$[0],Q=1/$[1],W=1/$[2],X=J[0]*Y,K=J[1]*Q,G=J[2]*W,z=J[4]*Y,H=J[5]*Q,V=J[6]*W,q=J[8]*Y,F=J[9]*Q,U=J[10]*W,w=X+H+U,L=0;if(w>0)L=Math.sqrt(w+1)*2,Z[3]=0.25*L,Z[0]=(V-F)/L,Z[1]=(q-G)/L,Z[2]=(K-z)/L;else if(X>H&&X>U)L=Math.sqrt(1+X-H-U)*2,Z[3]=(V-F)/L,Z[0]=0.25*L,Z[1]=(K+z)/L,Z[2]=(q+G)/L;else if(H>U)L=Math.sqrt(1+H-X-U)*2,Z[3]=(q-G)/L,Z[0]=(K+z)/L,Z[1]=0.25*L,Z[2]=(V+F)/L;else L=Math.sqrt(1+U-X-H)*2,Z[3]=(K-z)/L,Z[0]=(q+G)/L,Z[1]=(V+F)/L,Z[2]=0.25*L;return Z}function _66(Z,J,$,Y){var Q=J[0],W=J[1],X=J[2],K=J[3],G=Q+Q,z=W+W,H=X+X,V=Q*G,q=Q*z,F=Q*H,U=W*z,w=W*H,L=X*H,O=K*G,j=K*z,M=K*H,N=Y[0],D=Y[1],P=Y[2];return Z[0]=(1-(U+L))*N,Z[1]=(q+M)*N,Z[2]=(F-j)*N,Z[3]=0,Z[4]=(q-M)*D,Z[5]=(1-(V+L))*D,Z[6]=(w+O)*D,Z[7]=0,Z[8]=(F+j)*P,Z[9]=(w-O)*P,Z[10]=(1-(V+U))*P,Z[11]=0,Z[12]=$[0],Z[13]=$[1],Z[14]=$[2],Z[15]=1,Z}function A66(Z,J,$,Y,Q){var W=J[0],X=J[1],K=J[2],G=J[3],z=W+W,H=X+X,V=K+K,q=W*z,F=W*H,U=W*V,w=X*H,L=X*V,O=K*V,j=G*z,M=G*H,N=G*V,D=Y[0],P=Y[1],C=Y[2],T=Q[0],E=Q[1],A=Q[2],S=(1-(w+O))*D,x=(F+N)*D,I=(U-M)*D,v=(F-N)*P,f=(1-(q+O))*P,p=(L+j)*P,n=(U+M)*C,o=(L-j)*C,$0=(1-(q+w))*C;return Z[0]=S,Z[1]=x,Z[2]=I,Z[3]=0,Z[4]=v,Z[5]=f,Z[6]=p,Z[7]=0,Z[8]=n,Z[9]=o,Z[10]=$0,Z[11]=0,Z[12]=$[0]+T-(S*T+v*E+n*A),Z[13]=$[1]+E-(x*T+f*E+o*A),Z[14]=$[2]+A-(I*T+p*E+$0*A),Z[15]=1,Z}function x66(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=$+$,K=Y+Y,G=Q+Q,z=$*X,H=Y*X,V=Y*K,q=Q*X,F=Q*K,U=Q*G,w=W*X,L=W*K,O=W*G;return Z[0]=1-V-U,Z[1]=H+O,Z[2]=q-L,Z[3]=0,Z[4]=H-O,Z[5]=1-z-U,Z[6]=F+w,Z[7]=0,Z[8]=q+L,Z[9]=F-w,Z[10]=1-z-V,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function h66(Z,J,$,Y,Q,W,X){var K=1/($-J),G=1/(Q-Y),z=1/(W-X);return Z[0]=W*2*K,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=W*2*G,Z[6]=0,Z[7]=0,Z[8]=($+J)*K,Z[9]=(Q+Y)*G,Z[10]=(X+W)*z,Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=X*W*2*z,Z[15]=0,Z}function L$1(Z,J,$,Y,Q){var W=1/Math.tan(J/2),X;if(Z[0]=W/$,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=W,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[11]=-1,Z[12]=0,Z[13]=0,Z[15]=0,Q!=null&&Q!==1/0)X=1/(Y-Q),Z[10]=(Q+Y)*X,Z[14]=2*Q*Y*X;else Z[10]=-1,Z[14]=-2*Y;return Z}var f66=L$1;function b66(Z,J,$,Y,Q){var W=1/Math.tan(J/2),X;if(Z[0]=W/$,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=W,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[11]=-1,Z[12]=0,Z[13]=0,Z[15]=0,Q!=null&&Q!==1/0)X=1/(Y-Q),Z[10]=Q*X,Z[14]=Q*Y*X;else Z[10]=-1,Z[14]=-Y;return Z}function y66(Z,J,$,Y){var Q=Math.tan(J.upDegrees*Math.PI/180),W=Math.tan(J.downDegrees*Math.PI/180),X=Math.tan(J.leftDegrees*Math.PI/180),K=Math.tan(J.rightDegrees*Math.PI/180),G=2/(X+K),z=2/(Q+W);return Z[0]=G,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=z,Z[6]=0,Z[7]=0,Z[8]=-((X-K)*G*0.5),Z[9]=(Q-W)*z*0.5,Z[10]=Y/($-Y),Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=Y*$/($-Y),Z[15]=0,Z}function w$1(Z,J,$,Y,Q,W,X){var K=1/(J-$),G=1/(Y-Q),z=1/(W-X);return Z[0]=-2*K,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=-2*G,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=2*z,Z[11]=0,Z[12]=(J+$)*K,Z[13]=(Q+Y)*G,Z[14]=(X+W)*z,Z[15]=1,Z}var g66=w$1;function m66(Z,J,$,Y,Q,W,X){var K=1/(J-$),G=1/(Y-Q),z=1/(W-X);return Z[0]=-2*K,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=-2*G,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=z,Z[11]=0,Z[12]=(J+$)*K,Z[13]=(Q+Y)*G,Z[14]=W*z,Z[15]=1,Z}function u66(Z,J,$,Y){var Q,W,X,K,G,z,H,V,q,F,U=J[0],w=J[1],L=J[2],O=Y[0],j=Y[1],M=Y[2],N=$[0],D=$[1],P=$[2];if(Math.abs(U-N)<P0&&Math.abs(w-D)<P0&&Math.abs(L-P)<P0)return V$1(Z);if(H=U-N,V=w-D,q=L-P,F=1/Math.hypot(H,V,q),H*=F,V*=F,q*=F,Q=j*q-M*V,W=M*H-O*q,X=O*V-j*H,F=Math.hypot(Q,W,X),!F)Q=0,W=0,X=0;else F=1/F,Q*=F,W*=F,X*=F;if(K=V*X-q*W,G=q*Q-H*X,z=H*W-V*Q,F=Math.hypot(K,G,z),!F)K=0,G=0,z=0;else F=1/F,K*=F,G*=F,z*=F;return Z[0]=Q,Z[1]=K,Z[2]=H,Z[3]=0,Z[4]=W,Z[5]=G,Z[6]=V,Z[7]=0,Z[8]=X,Z[9]=z,Z[10]=q,Z[11]=0,Z[12]=-(Q*U+W*w+X*L),Z[13]=-(K*U+G*w+z*L),Z[14]=-(H*U+V*w+q*L),Z[15]=1,Z}function d66(Z,J,$,Y){var Q=J[0],W=J[1],X=J[2],K=Y[0],G=Y[1],z=Y[2],H=Q-$[0],V=W-$[1],q=X-$[2],F=H*H+V*V+q*q;if(F>0)F=1/Math.sqrt(F),H*=F,V*=F,q*=F;var U=G*q-z*V,w=z*H-K*q,L=K*V-G*H;if(F=U*U+w*w+L*L,F>0)F=1/Math.sqrt(F),U*=F,w*=F,L*=F;return Z[0]=U,Z[1]=w,Z[2]=L,Z[3]=0,Z[4]=V*L-q*w,Z[5]=q*U-H*L,Z[6]=H*w-V*U,Z[7]=0,Z[8]=H,Z[9]=V,Z[10]=q,Z[11]=0,Z[12]=Q,Z[13]=W,Z[14]=X,Z[15]=1,Z}function c66(Z){return"mat4("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+", "+Z[9]+", "+Z[10]+", "+Z[11]+", "+Z[12]+", "+Z[13]+", "+Z[14]+", "+Z[15]+")"}function l66(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8],Z[9],Z[10],Z[11],Z[12],Z[13],Z[14],Z[15])}function p66(Z,J,$){return Z[0]=J[0]+$[0],Z[1]=J[1]+$[1],Z[2]=J[2]+$[2],Z[3]=J[3]+$[3],Z[4]=J[4]+$[4],Z[5]=J[5]+$[5],Z[6]=J[6]+$[6],Z[7]=J[7]+$[7],Z[8]=J[8]+$[8],Z[9]=J[9]+$[9],Z[10]=J[10]+$[10],Z[11]=J[11]+$[11],Z[12]=J[12]+$[12],Z[13]=J[13]+$[13],Z[14]=J[14]+$[14],Z[15]=J[15]+$[15],Z}function B$1(Z,J,$){return Z[0]=J[0]-$[0],Z[1]=J[1]-$[1],Z[2]=J[2]-$[2],Z[3]=J[3]-$[3],Z[4]=J[4]-$[4],Z[5]=J[5]-$[5],Z[6]=J[6]-$[6],Z[7]=J[7]-$[7],Z[8]=J[8]-$[8],Z[9]=J[9]-$[9],Z[10]=J[10]-$[10],Z[11]=J[11]-$[11],Z[12]=J[12]-$[12],Z[13]=J[13]-$[13],Z[14]=J[14]-$[14],Z[15]=J[15]-$[15],Z}function i66(Z,J,$){return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z[3]=J[3]*$,Z[4]=J[4]*$,Z[5]=J[5]*$,Z[6]=J[6]*$,Z[7]=J[7]*$,Z[8]=J[8]*$,Z[9]=J[9]*$,Z[10]=J[10]*$,Z[11]=J[11]*$,Z[12]=J[12]*$,Z[13]=J[13]*$,Z[14]=J[14]*$,Z[15]=J[15]*$,Z}function n66(Z,J,$,Y){return Z[0]=J[0]+$[0]*Y,Z[1]=J[1]+$[1]*Y,Z[2]=J[2]+$[2]*Y,Z[3]=J[3]+$[3]*Y,Z[4]=J[4]+$[4]*Y,Z[5]=J[5]+$[5]*Y,Z[6]=J[6]+$[6]*Y,Z[7]=J[7]+$[7]*Y,Z[8]=J[8]+$[8]*Y,Z[9]=J[9]+$[9]*Y,Z[10]=J[10]+$[10]*Y,Z[11]=J[11]+$[11]*Y,Z[12]=J[12]+$[12]*Y,Z[13]=J[13]+$[13]*Y,Z[14]=J[14]+$[14]*Y,Z[15]=J[15]+$[15]*Y,Z}function a66(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]&&Z[4]===J[4]&&Z[5]===J[5]&&Z[6]===J[6]&&Z[7]===J[7]&&Z[8]===J[8]&&Z[9]===J[9]&&Z[10]===J[10]&&Z[11]===J[11]&&Z[12]===J[12]&&Z[13]===J[13]&&Z[14]===J[14]&&Z[15]===J[15]}function s66(Z,J){var $=Z[0],Y=Z[1],Q=Z[2],W=Z[3],X=Z[4],K=Z[5],G=Z[6],z=Z[7],H=Z[8],V=Z[9],q=Z[10],F=Z[11],U=Z[12],w=Z[13],L=Z[14],O=Z[15],j=J[0],M=J[1],N=J[2],D=J[3],P=J[4],C=J[5],T=J[6],E=J[7],A=J[8],S=J[9],x=J[10],I=J[11],v=J[12],f=J[13],p=J[14],n=J[15];return Math.abs($-j)<=P0*Math.max(1,Math.abs($),Math.abs(j))&&Math.abs(Y-M)<=P0*Math.max(1,Math.abs(Y),Math.abs(M))&&Math.abs(Q-N)<=P0*Math.max(1,Math.abs(Q),Math.abs(N))&&Math.abs(W-D)<=P0*Math.max(1,Math.abs(W),Math.abs(D))&&Math.abs(X-P)<=P0*Math.max(1,Math.abs(X),Math.abs(P))&&Math.abs(K-C)<=P0*Math.max(1,Math.abs(K),Math.abs(C))&&Math.abs(G-T)<=P0*Math.max(1,Math.abs(G),Math.abs(T))&&Math.abs(z-E)<=P0*Math.max(1,Math.abs(z),Math.abs(E))&&Math.abs(H-A)<=P0*Math.max(1,Math.abs(H),Math.abs(A))&&Math.abs(V-S)<=P0*Math.max(1,Math.abs(V),Math.abs(S))&&Math.abs(q-x)<=P0*Math.max(1,Math.abs(q),Math.abs(x))&&Math.abs(F-I)<=P0*Math.max(1,Math.abs(F),Math.abs(I))&&Math.abs(U-v)<=P0*Math.max(1,Math.abs(U),Math.abs(v))&&Math.abs(w-f)<=P0*Math.max(1,Math.abs(w),Math.abs(f))&&Math.abs(L-p)<=P0*Math.max(1,Math.abs(L),Math.abs(p))&&Math.abs(O-n)<=P0*Math.max(1,Math.abs(O),Math.abs(n))}var o66=q$1,r66=B$1;var R1={};$4(R1,{str:()=>n56,squaredLength:()=>i$1,sqrLen:()=>$96,sqlerp:()=>X96,slerp:()=>IM,setAxisAngle:()=>y$1,setAxes:()=>K96,set:()=>r56,scale:()=>c$1,rotationTo:()=>W96,rotateZ:()=>m56,rotateY:()=>g56,rotateX:()=>y56,random:()=>c56,pow:()=>d56,normalize:()=>$b,multiply:()=>g$1,mul:()=>e56,ln:()=>u$1,lerp:()=>Z96,length:()=>p$1,len:()=>J96,invert:()=>l56,identity:()=>h56,getAxisAngle:()=>f56,getAngle:()=>b56,fromValues:()=>s56,fromMat3:()=>d$1,fromEuler:()=>i56,exp:()=>m$1,exactEquals:()=>Y96,equals:()=>Q96,dot:()=>l$1,create:()=>Jb,copy:()=>o56,conjugate:()=>p56,clone:()=>a56,calculateW:()=>u56,add:()=>t56});var t0={};$4(t0,{zero:()=>N56,transformQuat:()=>B56,transformMat4:()=>L56,transformMat3:()=>w56,subtract:()=>j$1,sub:()=>T56,str:()=>P56,squaredLength:()=>D$1,squaredDistance:()=>P$1,sqrLen:()=>S56,sqrDist:()=>v56,set:()=>Z56,scaleAndAdd:()=>G56,scale:()=>K56,round:()=>X56,rotateZ:()=>M56,rotateY:()=>j56,rotateX:()=>O56,random:()=>U56,normalize:()=>ef,negate:()=>z56,multiply:()=>M$1,mul:()=>k56,min:()=>Q56,max:()=>W56,lerp:()=>V56,length:()=>O$1,len:()=>Zb,inverse:()=>H56,hermite:()=>q56,fromValues:()=>kM,forEach:()=>_56,floor:()=>Y56,exactEquals:()=>D56,equals:()=>C56,dot:()=>EM,divide:()=>R$1,div:()=>E56,distance:()=>N$1,dist:()=>I56,cross:()=>lq,create:()=>TM,copy:()=>e66,clone:()=>t66,ceil:()=>$56,bezier:()=>F56,angle:()=>R56,add:()=>J56});function TM(){var Z=new Y1(3);if(Y1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function t66(Z){var J=new Y1(3);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J}function O$1(Z){var J=Z[0],$=Z[1],Y=Z[2];return Math.hypot(J,$,Y)}function kM(Z,J,$){var Y=new Y1(3);return Y[0]=Z,Y[1]=J,Y[2]=$,Y}function e66(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z}function Z56(Z,J,$,Y){return Z[0]=J,Z[1]=$,Z[2]=Y,Z}function J56(Z,J,$){return Z[0]=J[0]+$[0],Z[1]=J[1]+$[1],Z[2]=J[2]+$[2],Z}function j$1(Z,J,$){return Z[0]=J[0]-$[0],Z[1]=J[1]-$[1],Z[2]=J[2]-$[2],Z}function M$1(Z,J,$){return Z[0]=J[0]*$[0],Z[1]=J[1]*$[1],Z[2]=J[2]*$[2],Z}function R$1(Z,J,$){return Z[0]=J[0]/$[0],Z[1]=J[1]/$[1],Z[2]=J[2]/$[2],Z}function $56(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z[2]=Math.ceil(J[2]),Z}function Y56(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z[2]=Math.floor(J[2]),Z}function Q56(Z,J,$){return Z[0]=Math.min(J[0],$[0]),Z[1]=Math.min(J[1],$[1]),Z[2]=Math.min(J[2],$[2]),Z}function W56(Z,J,$){return Z[0]=Math.max(J[0],$[0]),Z[1]=Math.max(J[1],$[1]),Z[2]=Math.max(J[2],$[2]),Z}function X56(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z[2]=Math.round(J[2]),Z}function K56(Z,J,$){return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z}function G56(Z,J,$,Y){return Z[0]=J[0]+$[0]*Y,Z[1]=J[1]+$[1]*Y,Z[2]=J[2]+$[2]*Y,Z}function N$1(Z,J){var $=J[0]-Z[0],Y=J[1]-Z[1],Q=J[2]-Z[2];return Math.hypot($,Y,Q)}function P$1(Z,J){var $=J[0]-Z[0],Y=J[1]-Z[1],Q=J[2]-Z[2];return $*$+Y*Y+Q*Q}function D$1(Z){var J=Z[0],$=Z[1],Y=Z[2];return J*J+$*$+Y*Y}function z56(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z}function H56(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z[2]=1/J[2],Z}function ef(Z,J){var $=J[0],Y=J[1],Q=J[2],W=$*$+Y*Y+Q*Q;if(W>0)W=1/Math.sqrt(W);return Z[0]=J[0]*W,Z[1]=J[1]*W,Z[2]=J[2]*W,Z}function EM(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]}function lq(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=$[0],K=$[1],G=$[2];return Z[0]=Q*G-W*K,Z[1]=W*X-Y*G,Z[2]=Y*K-Q*X,Z}function V56(Z,J,$,Y){var Q=J[0],W=J[1],X=J[2];return Z[0]=Q+Y*($[0]-Q),Z[1]=W+Y*($[1]-W),Z[2]=X+Y*($[2]-X),Z}function q56(Z,J,$,Y,Q,W){var X=W*W,K=X*(2*W-3)+1,G=X*(W-2)+W,z=X*(W-1),H=X*(3-2*W);return Z[0]=J[0]*K+$[0]*G+Y[0]*z+Q[0]*H,Z[1]=J[1]*K+$[1]*G+Y[1]*z+Q[1]*H,Z[2]=J[2]*K+$[2]*G+Y[2]*z+Q[2]*H,Z}function F56(Z,J,$,Y,Q,W){var X=1-W,K=X*X,G=W*W,z=K*X,H=3*W*K,V=3*G*X,q=G*W;return Z[0]=J[0]*z+$[0]*H+Y[0]*V+Q[0]*q,Z[1]=J[1]*z+$[1]*H+Y[1]*V+Q[1]*q,Z[2]=J[2]*z+$[2]*H+Y[2]*V+Q[2]*q,Z}function U56(Z,J){J=J||1;var $=c7()*2*Math.PI,Y=c7()*2-1,Q=Math.sqrt(1-Y*Y)*J;return Z[0]=Math.cos($)*Q,Z[1]=Math.sin($)*Q,Z[2]=Y*J,Z}function L56(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=$[3]*Y+$[7]*Q+$[11]*W+$[15];return X=X||1,Z[0]=($[0]*Y+$[4]*Q+$[8]*W+$[12])/X,Z[1]=($[1]*Y+$[5]*Q+$[9]*W+$[13])/X,Z[2]=($[2]*Y+$[6]*Q+$[10]*W+$[14])/X,Z}function w56(Z,J,$){var Y=J[0],Q=J[1],W=J[2];return Z[0]=Y*$[0]+Q*$[3]+W*$[6],Z[1]=Y*$[1]+Q*$[4]+W*$[7],Z[2]=Y*$[2]+Q*$[5]+W*$[8],Z}function B56(Z,J,$){var Y=$[0],Q=$[1],W=$[2],X=$[3],K=J[0],G=J[1],z=J[2],H=Q*z-W*G,V=W*K-Y*z,q=Y*G-Q*K,F=Q*q-W*V,U=W*H-Y*q,w=Y*V-Q*H,L=X*2;return H*=L,V*=L,q*=L,F*=2,U*=2,w*=2,Z[0]=K+H+F,Z[1]=G+V+U,Z[2]=z+q+w,Z}function O56(Z,J,$,Y){var Q=[],W=[];return Q[0]=J[0]-$[0],Q[1]=J[1]-$[1],Q[2]=J[2]-$[2],W[0]=Q[0],W[1]=Q[1]*Math.cos(Y)-Q[2]*Math.sin(Y),W[2]=Q[1]*Math.sin(Y)+Q[2]*Math.cos(Y),Z[0]=W[0]+$[0],Z[1]=W[1]+$[1],Z[2]=W[2]+$[2],Z}function j56(Z,J,$,Y){var Q=[],W=[];return Q[0]=J[0]-$[0],Q[1]=J[1]-$[1],Q[2]=J[2]-$[2],W[0]=Q[2]*Math.sin(Y)+Q[0]*Math.cos(Y),W[1]=Q[1],W[2]=Q[2]*Math.cos(Y)-Q[0]*Math.sin(Y),Z[0]=W[0]+$[0],Z[1]=W[1]+$[1],Z[2]=W[2]+$[2],Z}function M56(Z,J,$,Y){var Q=[],W=[];return Q[0]=J[0]-$[0],Q[1]=J[1]-$[1],Q[2]=J[2]-$[2],W[0]=Q[0]*Math.cos(Y)-Q[1]*Math.sin(Y),W[1]=Q[0]*Math.sin(Y)+Q[1]*Math.cos(Y),W[2]=Q[2],Z[0]=W[0]+$[0],Z[1]=W[1]+$[1],Z[2]=W[2]+$[2],Z}function R56(Z,J){var $=Z[0],Y=Z[1],Q=Z[2],W=J[0],X=J[1],K=J[2],G=Math.sqrt($*$+Y*Y+Q*Q),z=Math.sqrt(W*W+X*X+K*K),H=G*z,V=H&&EM(Z,J)/H;return Math.acos(Math.min(Math.max(V,-1),1))}function N56(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z}function P56(Z){return"vec3("+Z[0]+", "+Z[1]+", "+Z[2]+")"}function D56(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]}function C56(Z,J){var $=Z[0],Y=Z[1],Q=Z[2],W=J[0],X=J[1],K=J[2];return Math.abs($-W)<=P0*Math.max(1,Math.abs($),Math.abs(W))&&Math.abs(Y-X)<=P0*Math.max(1,Math.abs(Y),Math.abs(X))&&Math.abs(Q-K)<=P0*Math.max(1,Math.abs(Q),Math.abs(K))}var T56=j$1,k56=M$1,E56=R$1,I56=N$1,v56=P$1,Zb=O$1,S56=D$1,_56=function(){var Z=TM();return function(J,$,Y,Q,W,X){var K,G;if(!$)$=3;if(!Y)Y=0;if(Q)G=Math.min(Q*$+Y,J.length);else G=J.length;for(K=Y;K<G;K+=$)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],W(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}}();function A56(){var Z=new Y1(4);if(Y1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function C$1(Z){var J=new Y1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function T$1(Z,J,$,Y){var Q=new Y1(4);return Q[0]=Z,Q[1]=J,Q[2]=$,Q[3]=Y,Q}function k$1(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function E$1(Z,J,$,Y,Q){return Z[0]=J,Z[1]=$,Z[2]=Y,Z[3]=Q,Z}function I$1(Z,J,$){return Z[0]=J[0]+$[0],Z[1]=J[1]+$[1],Z[2]=J[2]+$[2],Z[3]=J[3]+$[3],Z}function v$1(Z,J,$){return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z[3]=J[3]*$,Z}function S$1(Z){var J=Z[0],$=Z[1],Y=Z[2],Q=Z[3];return Math.hypot(J,$,Y,Q)}function _$1(Z){var J=Z[0],$=Z[1],Y=Z[2],Q=Z[3];return J*J+$*$+Y*Y+Q*Q}function A$1(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=$*$+Y*Y+Q*Q+W*W;if(X>0)X=1/Math.sqrt(X);return Z[0]=$*X,Z[1]=Y*X,Z[2]=Q*X,Z[3]=W*X,Z}function x$1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}function h$1(Z,J,$,Y){var Q=J[0],W=J[1],X=J[2],K=J[3];return Z[0]=Q+Y*($[0]-Q),Z[1]=W+Y*($[1]-W),Z[2]=X+Y*($[2]-X),Z[3]=K+Y*($[3]-K),Z}function f$1(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function b$1(Z,J){var $=Z[0],Y=Z[1],Q=Z[2],W=Z[3],X=J[0],K=J[1],G=J[2],z=J[3];return Math.abs($-X)<=P0*Math.max(1,Math.abs($),Math.abs(X))&&Math.abs(Y-K)<=P0*Math.max(1,Math.abs(Y),Math.abs(K))&&Math.abs(Q-G)<=P0*Math.max(1,Math.abs(Q),Math.abs(G))&&Math.abs(W-z)<=P0*Math.max(1,Math.abs(W),Math.abs(z))}var ko6=function(){var Z=A56();return function(J,$,Y,Q,W,X){var K,G;if(!$)$=4;if(!Y)Y=0;if(Q)G=Math.min(Q*$+Y,J.length);else G=J.length;for(K=Y;K<G;K+=$)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Z[3]=J[K+3],W(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2],J[K+3]=Z[3];return J}}();function Jb(){var Z=new Y1(4);if(Y1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z[3]=1,Z}function h56(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=1,Z}function y$1(Z,J,$){$=$*0.5;var Y=Math.sin($);return Z[0]=Y*J[0],Z[1]=Y*J[1],Z[2]=Y*J[2],Z[3]=Math.cos($),Z}function f56(Z,J){var $=Math.acos(J[3])*2,Y=Math.sin($/2);if(Y>P0)Z[0]=J[0]/Y,Z[1]=J[1]/Y,Z[2]=J[2]/Y;else Z[0]=1,Z[1]=0,Z[2]=0;return $}function b56(Z,J){var $=l$1(Z,J);return Math.acos(2*$*$-1)}function g$1(Z,J,$){var Y=J[0],Q=J[1],W=J[2],X=J[3],K=$[0],G=$[1],z=$[2],H=$[3];return Z[0]=Y*H+X*K+Q*z-W*G,Z[1]=Q*H+X*G+W*K-Y*z,Z[2]=W*H+X*z+Y*G-Q*K,Z[3]=X*H-Y*K-Q*G-W*z,Z}function y56(Z,J,$){$*=0.5;var Y=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin($),G=Math.cos($);return Z[0]=Y*G+X*K,Z[1]=Q*G+W*K,Z[2]=W*G-Q*K,Z[3]=X*G-Y*K,Z}function g56(Z,J,$){$*=0.5;var Y=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin($),G=Math.cos($);return Z[0]=Y*G-W*K,Z[1]=Q*G+X*K,Z[2]=W*G+Y*K,Z[3]=X*G-Q*K,Z}function m56(Z,J,$){$*=0.5;var Y=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin($),G=Math.cos($);return Z[0]=Y*G+Q*K,Z[1]=Q*G-Y*K,Z[2]=W*G+X*K,Z[3]=X*G-W*K,Z}function u56(Z,J){var $=J[0],Y=J[1],Q=J[2];return Z[0]=$,Z[1]=Y,Z[2]=Q,Z[3]=Math.sqrt(Math.abs(1-$*$-Y*Y-Q*Q)),Z}function m$1(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=Math.sqrt($*$+Y*Y+Q*Q),K=Math.exp(W),G=X>0?K*Math.sin(X)/X:0;return Z[0]=$*G,Z[1]=Y*G,Z[2]=Q*G,Z[3]=K*Math.cos(X),Z}function u$1(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=Math.sqrt($*$+Y*Y+Q*Q),K=X>0?Math.atan2(X,W)/X:0;return Z[0]=$*K,Z[1]=Y*K,Z[2]=Q*K,Z[3]=0.5*Math.log($*$+Y*Y+Q*Q+W*W),Z}function d56(Z,J,$){return u$1(Z,J),c$1(Z,Z,$),m$1(Z,Z),Z}function IM(Z,J,$,Y){var Q=J[0],W=J[1],X=J[2],K=J[3],G=$[0],z=$[1],H=$[2],V=$[3],q,F,U,w,L;if(F=Q*G+W*z+X*H+K*V,F<0)F=-F,G=-G,z=-z,H=-H,V=-V;if(1-F>P0)q=Math.acos(F),U=Math.sin(q),w=Math.sin((1-Y)*q)/U,L=Math.sin(Y*q)/U;else w=1-Y,L=Y;return Z[0]=w*Q+L*G,Z[1]=w*W+L*z,Z[2]=w*X+L*H,Z[3]=w*K+L*V,Z}function c56(Z){var J=c7(),$=c7(),Y=c7(),Q=Math.sqrt(1-J),W=Math.sqrt(J);return Z[0]=Q*Math.sin(2*Math.PI*$),Z[1]=Q*Math.cos(2*Math.PI*$),Z[2]=W*Math.sin(2*Math.PI*Y),Z[3]=W*Math.cos(2*Math.PI*Y),Z}function l56(Z,J){var $=J[0],Y=J[1],Q=J[2],W=J[3],X=$*$+Y*Y+Q*Q+W*W,K=X?1/X:0;return Z[0]=-$*K,Z[1]=-Y*K,Z[2]=-Q*K,Z[3]=W*K,Z}function p56(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z[3]=J[3],Z}function d$1(Z,J){var $=J[0]+J[4]+J[8],Y;if($>0)Y=Math.sqrt($+1),Z[3]=0.5*Y,Y=0.5/Y,Z[0]=(J[5]-J[7])*Y,Z[1]=(J[6]-J[2])*Y,Z[2]=(J[1]-J[3])*Y;else{var Q=0;if(J[4]>J[0])Q=1;if(J[8]>J[Q*3+Q])Q=2;var W=(Q+1)%3,X=(Q+2)%3;Y=Math.sqrt(J[Q*3+Q]-J[W*3+W]-J[X*3+X]+1),Z[Q]=0.5*Y,Y=0.5/Y,Z[3]=(J[W*3+X]-J[X*3+W])*Y,Z[W]=(J[W*3+Q]+J[Q*3+W])*Y,Z[X]=(J[X*3+Q]+J[Q*3+X])*Y}return Z}function i56(Z,J,$,Y){var Q=0.5*Math.PI/180;J*=Q,$*=Q,Y*=Q;var W=Math.sin(J),X=Math.cos(J),K=Math.sin($),G=Math.cos($),z=Math.sin(Y),H=Math.cos(Y);return Z[0]=W*G*H-X*K*z,Z[1]=X*K*H+W*G*z,Z[2]=X*G*z-W*K*H,Z[3]=X*G*H+W*K*z,Z}function n56(Z){return"quat("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}var a56=C$1,s56=T$1,o56=k$1,r56=E$1,t56=I$1,e56=g$1,c$1=v$1,l$1=x$1,Z96=h$1,p$1=S$1,J96=p$1,i$1=_$1,$96=i$1,$b=A$1,Y96=f$1,Q96=b$1,W96=function(){var Z=TM(),J=kM(1,0,0),$=kM(0,1,0);return function(Y,Q,W){var X=EM(Q,W);if(X<-0.999999){if(lq(Z,J,Q),Zb(Z)<0.000001)lq(Z,$,Q);return ef(Z,Z),y$1(Y,Z,Math.PI),Y}else if(X>0.999999)return Y[0]=0,Y[1]=0,Y[2]=0,Y[3]=1,Y;else return lq(Z,Q,W),Y[0]=Z[0],Y[1]=Z[1],Y[2]=Z[2],Y[3]=1+X,$b(Y,Y)}}(),X96=function(){var Z=Jb(),J=Jb();return function($,Y,Q,W,X,K){return IM(Z,Y,X,K),IM(J,Q,W,K),IM($,Z,J,2*K*(1-K)),$}}(),K96=function(){var Z=tf();return function(J,$,Y,Q){return Z[0]=Y[0],Z[3]=Y[1],Z[6]=Y[2],Z[1]=Q[0],Z[4]=Q[1],Z[7]=Q[2],Z[2]=-$[0],Z[5]=-$[1],Z[8]=-$[2],$b(J,d$1(J,Z))}}();var X1={};$4(X1,{zero:()=>A96,transformMat4:()=>v96,transformMat3:()=>I96,transformMat2d:()=>E96,transformMat2:()=>k96,subtract:()=>a$1,sub:()=>y96,str:()=>x96,squaredLength:()=>ZY1,squaredDistance:()=>t$1,sqrLen:()=>c96,sqrDist:()=>d96,set:()=>V96,scaleAndAdd:()=>j96,scale:()=>O96,round:()=>B96,rotate:()=>S96,random:()=>T96,normalize:()=>N96,negate:()=>M96,multiply:()=>s$1,mul:()=>g96,min:()=>L96,max:()=>w96,lerp:()=>C96,length:()=>e$1,len:()=>b96,inverse:()=>R96,fromValues:()=>z96,forEach:()=>l96,floor:()=>U96,exactEquals:()=>h96,equals:()=>f96,dot:()=>P96,divide:()=>o$1,div:()=>m96,distance:()=>r$1,dist:()=>u96,cross:()=>D96,create:()=>n$1,copy:()=>H96,clone:()=>G96,ceil:()=>F96,angle:()=>_96,add:()=>q96});function n$1(){var Z=new Y1(2);if(Y1!=Float32Array)Z[0]=0,Z[1]=0;return Z}function G96(Z){var J=new Y1(2);return J[0]=Z[0],J[1]=Z[1],J}function z96(Z,J){var $=new Y1(2);return $[0]=Z,$[1]=J,$}function H96(Z,J){return Z[0]=J[0],Z[1]=J[1],Z}function V96(Z,J,$){return Z[0]=J,Z[1]=$,Z}function q96(Z,J,$){return Z[0]=J[0]+$[0],Z[1]=J[1]+$[1],Z}function a$1(Z,J,$){return Z[0]=J[0]-$[0],Z[1]=J[1]-$[1],Z}function s$1(Z,J,$){return Z[0]=J[0]*$[0],Z[1]=J[1]*$[1],Z}function o$1(Z,J,$){return Z[0]=J[0]/$[0],Z[1]=J[1]/$[1],Z}function F96(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z}function U96(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z}function L96(Z,J,$){return Z[0]=Math.min(J[0],$[0]),Z[1]=Math.min(J[1],$[1]),Z}function w96(Z,J,$){return Z[0]=Math.max(J[0],$[0]),Z[1]=Math.max(J[1],$[1]),Z}function B96(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z}function O96(Z,J,$){return Z[0]=J[0]*$,Z[1]=J[1]*$,Z}function j96(Z,J,$,Y){return Z[0]=J[0]+$[0]*Y,Z[1]=J[1]+$[1]*Y,Z}function r$1(Z,J){var $=J[0]-Z[0],Y=J[1]-Z[1];return Math.hypot($,Y)}function t$1(Z,J){var $=J[0]-Z[0],Y=J[1]-Z[1];return $*$+Y*Y}function e$1(Z){var J=Z[0],$=Z[1];return Math.hypot(J,$)}function ZY1(Z){var J=Z[0],$=Z[1];return J*J+$*$}function M96(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z}function R96(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z}function N96(Z,J){var $=J[0],Y=J[1],Q=$*$+Y*Y;if(Q>0)Q=1/Math.sqrt(Q);return Z[0]=J[0]*Q,Z[1]=J[1]*Q,Z}function P96(Z,J){return Z[0]*J[0]+Z[1]*J[1]}function D96(Z,J,$){var Y=J[0]*$[1]-J[1]*$[0];return Z[0]=Z[1]=0,Z[2]=Y,Z}function C96(Z,J,$,Y){var Q=J[0],W=J[1];return Z[0]=Q+Y*($[0]-Q),Z[1]=W+Y*($[1]-W),Z}function T96(Z,J){J=J||1;var $=c7()*2*Math.PI;return Z[0]=Math.cos($)*J,Z[1]=Math.sin($)*J,Z}function k96(Z,J,$){var Y=J[0],Q=J[1];return Z[0]=$[0]*Y+$[2]*Q,Z[1]=$[1]*Y+$[3]*Q,Z}function E96(Z,J,$){var Y=J[0],Q=J[1];return Z[0]=$[0]*Y+$[2]*Q+$[4],Z[1]=$[1]*Y+$[3]*Q+$[5],Z}function I96(Z,J,$){var Y=J[0],Q=J[1];return Z[0]=$[0]*Y+$[3]*Q+$[6],Z[1]=$[1]*Y+$[4]*Q+$[7],Z}function v96(Z,J,$){var Y=J[0],Q=J[1];return Z[0]=$[0]*Y+$[4]*Q+$[12],Z[1]=$[1]*Y+$[5]*Q+$[13],Z}function S96(Z,J,$,Y){var Q=J[0]-$[0],W=J[1]-$[1],X=Math.sin(Y),K=Math.cos(Y);return Z[0]=Q*K-W*X+$[0],Z[1]=Q*X+W*K+$[1],Z}function _96(Z,J){var $=Z[0],Y=Z[1],Q=J[0],W=J[1],X=Math.sqrt($*$+Y*Y)*Math.sqrt(Q*Q+W*W),K=X&&($*Q+Y*W)/X;return Math.acos(Math.min(Math.max(K,-1),1))}function A96(Z){return Z[0]=0,Z[1]=0,Z}function x96(Z){return"vec2("+Z[0]+", "+Z[1]+")"}function h96(Z,J){return Z[0]===J[0]&&Z[1]===J[1]}function f96(Z,J){var $=Z[0],Y=Z[1],Q=J[0],W=J[1];return Math.abs($-Q)<=P0*Math.max(1,Math.abs($),Math.abs(Q))&&Math.abs(Y-W)<=P0*Math.max(1,Math.abs(Y),Math.abs(W))}var b96=e$1,y96=a$1,g96=s$1,m96=o$1,u96=r$1,d96=t$1,c96=ZY1,l96=function(){var Z=n$1();return function(J,$,Y,Q,W,X){var K,G;if(!$)$=2;if(!Y)Y=0;if(Q)G=Math.min(Q*$+Y,J.length);else G=J.length;for(K=Y;K<G;K+=$)Z[0]=J[K],Z[1]=J[K+1],W(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1];return J}}();class HW extends Float32Array{constructor(Z,J,$,Y){super([Z,J,$,Y])}get determinant(){return m8.determinant(this)}get frobeniusNorm(){return m8.frob(this)}static create(){let Z=new HW(0,0,0,0);return m8.identity(Z),Z}static fromRotation(Z){let J=HW.create();return m8.fromRotation(J,Z),J}static fromScaling(Z){let J=HW.create();return m8.fromScaling(J,Z),J}add(Z){return m8.add(this,this,Z),this}adjoint(){return m8.adjoint(this,this),this}clone(){return new HW(this[0],this[1],this[2],this[3])}copy(Z){return m8.copy(this,Z),this}equals(Z){return m8.equals(this,Z)}exactEquals(Z){return m8.exactEquals(this,Z)}identity(){return m8.identity(this),this}invert(){return m8.invert(this,this),this}multiply(Z){return m8.mul(this,this,Z),this}multiplyScalar(Z){return m8.multiplyScalar(this,this,Z),this}rotate(Z){return m8.rotate(this,this,Z),this}subtract(Z){return m8.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]}][${this[2]},${this[3]}]`}transpose(){return m8.transpose(this,this),this}}class l7 extends Float32Array{constructor(Z,J,$,Y,Q,W,X,K,G){super([Z,J,$,Y,Q,W,X,K,G])}get determinant(){return l1.determinant(this)}get frobeniusNorm(){return l1.frob(this)}static create(){let Z=new l7(0,0,0,0,0,0,0,0,0);return l1.identity(Z),Z}static fromMatrix4(Z){let J=l7.create();return l1.fromMat4(J,Z),J}static fromQuaternion(Z){let J=l7.create();return l1.fromQuat(J,Z),J}static fromRotation(Z){let J=l7.create();return l1.fromRotation(J,Z),J}static fromScaling(Z){let J=l7.create();return l1.fromScaling(J,Z),J}static fromTranslation(Z){let J=l7.create();return l1.fromTranslation(J,Z),J}add(Z){return l1.add(this,this,Z),this}adjoint(){return l1.adjoint(this,this),this}clone(){return new l7(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8])}copy(Z){return l1.copy(this,Z),this}equals(Z){return l1.equals(this,Z)}exactEquals(Z){return l1.exactEquals(this,Z)}identity(){return l1.identity(this),this}invert(){return l1.invert(this,this),this}multiply(Z){return l1.mul(this,this,Z),this}multiplyScalar(Z){return l1.multiplyScalar(this,this,Z),this}transformVector(Z){return Z.transformMatrix3(this)}projection(Z,J){return l1.projection(this,Z,J),this}rotate(Z){return l1.rotate(this,this,Z),this}subtract(Z){return l1.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]},${this[2]}][${this[3]},${this[4]},${this[5]}][${this[6]},${this[7]},${this[8]}]`}transpose(){return l1.transpose(this,this),this}}class U5 extends Float32Array{constructor(Z,J,$,Y,Q,W,X,K,G,z,H,V,q,F,U,w){super([Z,J,$,Y,Q,W,X,K,G,z,H,V,q,F,U,w])}get determinant(){return o0.determinant(this)}get frobeniusNorm(){return o0.frob(this)}static create(){let Z=new U5(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return o0.identity(Z),Z}static fromQuaternion(Z){let J=U5.create();return o0.fromQuat(J,Z),J}static fromRotation(Z,J){let $=U5.create();return o0.fromRotation($,Z,J),$}static fromRotationTranslation(Z,J){let $=U5.create();return o0.fromRotationTranslation($,Z,J),$}static fromRotationTranslationScale(Z,J,$){let Y=U5.create();return o0.fromRotationTranslationScale(Y,Z,J,$),Y}static fromRotationTranslationScaleOrigin(Z,J,$,Y){let Q=U5.create();return o0.fromRotationTranslationScaleOrigin(Q,Z,J,$,Y),Q}static fromScaling(Z){let J=U5.create();return o0.fromScaling(J,Z),J}static fromTranslation(Z){let J=U5.create();return o0.fromTranslation(J,Z),J}static fromXRotation(Z){let J=U5.create();return o0.fromXRotation(J,Z),J}static fromYRotation(Z){let J=U5.create();return o0.fromYRotation(J,Z),J}static fromZRotation(Z){let J=U5.create();return o0.fromZRotation(J,Z),J}add(Z){return o0.add(this,this,Z),this}adjoint(){return o0.adjoint(this,this),this}clone(){return new U5(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8],this[9],this[10],this[11],this[12],this[13],this[14],this[15])}copy(Z){return o0.copy(this,Z),this}equals(Z){return o0.equals(this,Z)}exactEquals(Z){return o0.exactEquals(this,Z)}frustrum(Z,J,$,Y,Q,W){return o0.frustum(this,Z,J,$,Y,Q,W),this}identity(){return o0.identity(this),this}invert(){return o0.invert(this,this),this}lookAt(Z,J,$){return o0.lookAt(this,Z,J,$),this}multiply(Z){return o0.mul(this,this,Z),this}multiplyScalar(Z){return o0.multiplyScalar(this,this,Z),this}orthographic(Z,J,$,Y,Q,W){return o0.ortho(this,Z,J,$,Y,Q,W),this}perspective(Z,J,$,Y){return o0.perspective(this,Z,J,$,Y),this}rotate(Z,J){return o0.rotate(this,this,Z,J),this}rotateX(Z){return o0.rotateX(this,this,Z),this}rotateY(Z){return o0.rotateY(this,this,Z),this}rotateZ(Z){return o0.rotateZ(this,this,Z),this}scale(Z){return o0.scale(this,this,Z),this}subtract(Z){return o0.sub(this,this,Z),this}targetTo(Z,J,$){return o0.targetTo(this,Z,J,$),this}toString(){return`[${this[0]},${this[1]},${this[2]},${this[3]}][${this[4]},${this[5]},${this[6]},${this[7]}][${this[8]},${this[9]},${this[10]},${this[11]}][${this[12]},${this[13]},${this[14]},${this[15]}]`}translate(Z){return o0.translate(this,this,Z),this}transpose(){return o0.transpose(this,this),this}}class M3 extends Float32Array{constructor(Z,J,$,Y){super([Z,J,$,Y])}get length(){return R1.length(this)}get squaredLength(){return R1.squaredLength(this)}get magnitude(){return R1.length(this)}get squaredMagnitude(){return R1.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}get z(){return this[2]}set z(Z){this[2]=Z}get w(){return this[3]}set w(Z){this[3]=Z}static fromEuler(Z,J,$){let Y=R1.fromEuler(new Float32Array(4),Z,J,$);return new M3(Y[0],Y[1],Y[2],Y[3])}static fromQuaternionLike(Z){return new M3(Z.x,Z.y,Z.z,Z.w)}clone(){return new M3(this.x,this.y,this.z,this.w)}conjugate(){return R1.conjugate(this,this),this}copy(Z){return R1.copy(this,Z),this}dot(Z){return R1.dot(this,Z)}exponential(){return R1.exp(this,this),this}equals(Z){return R1.equals(this,Z)}exactEquals(Z){return R1.exactEquals(this,Z)}getAngle(Z){return R1.getAngle(this,Z)}identity(){return R1.identity(this),this}invert(){return R1.invert(this,this),this}lerp(Z,J){return R1.lerp(this,this,Z,J),this}logarithm(){return R1.ln(this,this),this}multiply(Z){return R1.multiply(this,this,Z),this}transformVector(Z){return Z.transformQuaternion(this)}normalize(){return R1.normalize(this,this),this}power(Z){return R1.pow(this,this,Z),this}randomize(){return R1.random(this),this}rotateX(Z){return R1.rotateX(this,this,Z),this}rotateY(Z){return R1.rotateY(this,this,Z),this}rotateZ(Z){return R1.rotateZ(this,this,Z),this}scale(Z){return R1.scale(this,this,Z),this}setAxisAngle(Z,J){return R1.setAxisAngle(this,Z,J),this}slerp(Z,J){return R1.slerp(this,this,Z,J),this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}}class pq extends Float32Array{constructor(Z,J){super([Z,J])}get length(){return X1.length(this)}get squaredLength(){return X1.squaredLength(this)}get magnitude(){return X1.length(this)}get squaredMagnitude(){return X1.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}static create(){return new pq(0,0)}add(Z){return X1.add(this,this,Z),this}angle(Z){return X1.angle(this,Z)}ceil(){return X1.ceil(this,this),this}clone(){return new pq(this.x,this.y)}copy(Z){return X1.copy(this,Z),this}distance(Z){return X1.distance(this,Z)}divide(Z){return X1.divide(this,this,Z),this}dot(Z){return X1.dot(this,Z)}equals(Z){return X1.equals(this,Z)}exactEquals(Z){return X1.exactEquals(this,Z)}floor(){return X1.floor(this,this),this}invert(){return X1.inverse(this,this),this}lerp(Z,J){return X1.lerp(this,this,Z,J),this}max(Z){return X1.max(this,this,Z),this}min(Z){return X1.min(this,this,Z),this}multiply(Z){return X1.mul(this,this,Z),this}negate(){return X1.negate(this,this),this}normalize(){return X1.normalize(this,this),this}randomize(Z){return X1.random(this,Z),this}rotate(Z,J){return X1.rotate(this,this,Z,J),this}round(){return X1.round(this,this),this}scale(Z){return X1.scale(this,this,Z),this}scaleAndAdd(Z,J){return X1.scaleAndAdd(this,this,Z,J),this}subtract(Z){return X1.sub(this,this,Z),this}toString(){return`${this.x},${this.y}`}transformMatrix2(Z){return X1.transformMat2(this,this,Z),this}transformMatrix3(Z){return X1.transformMat3(this,this,Z),this}transformMatrix4(Z){return X1.transformMat4(this,this,Z),this}zero(){return X1.zero(this),this}}class R3 extends Float32Array{constructor(Z,J,$){super([Z,J,$])}get length(){return t0.length(this)}get squaredLength(){return t0.squaredLength(this)}get magnitude(){return t0.length(this)}get squaredMagnitude(){return t0.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}get z(){return this[2]}set z(Z){this[2]=Z}static create(){return new R3(0,0,0)}static fromVector3Like(Z){return new R3(Z.x,Z.y,Z.z)}add(Z){return t0.add(this,this,Z),this}ceil(){return t0.ceil(this,this),this}clone(){return new R3(this.x,this.y,this.z)}copy(Z){return t0.copy(this,Z),this}cross(Z){return t0.cross(this,this,Z),this}distance(Z){return t0.distance(this,Z)}divide(Z){return t0.div(this,this,Z),this}dot(Z){return t0.dot(this,Z)}equals(Z){return t0.equals(this,Z)}exactEquals(Z){return t0.exactEquals(this,Z)}floor(){return t0.floor(this,this),this}invert(){return t0.inverse(this,this),this}lerp(Z,J){return t0.lerp(this,this,Z,J),this}max(Z){return t0.max(this,this,Z),this}min(Z){return t0.min(this,this,Z),this}multiply(Z){return t0.mul(this,this,Z),this}negate(){return t0.negate(this,this),this}normalize(){return t0.normalize(this,this),this}randomize(Z){return t0.random(this,Z),this}rotateX(Z,J){return t0.rotateX(this,this,Z,J),this}rotateY(Z,J){return t0.rotateY(this,this,Z,J),this}rotateZ(Z,J){return t0.rotateZ(this,this,Z,J),this}round(){return t0.round(this,this),this}scale(Z){return t0.scale(this,this,Z),this}scaleAndAdd(Z,J){return t0.scaleAndAdd(this,this,Z,J),this}subtract(Z){return t0.sub(this,this,Z),this}toString(){return`${this.x},${this.y},${this.z}`}transformMatrix3(Z){return t0.transformMat3(this,this,Z),this}transformMatrix4(Z){return t0.transformMat4(this,this,Z),this}transformQuaternion(Z){return t0.transformQuat(this,this,Z),this}zero(){return t0.zero(this),this}}var N1=function(Z,J,$,Y){function Q(W){return W instanceof $?W:new $(function(X){X(W)})}return new($||($=Promise))(function(W,X){function K(H){try{z(Y.next(H))}catch(V){X(V)}}function G(H){try{z(Y.throw(H))}catch(V){X(V)}}function z(H){H.done?W(H.value):Q(H.value).then(K,G)}z((Y=Y.apply(Z,J||[])).next())})},j1=function(Z,J){var $={label:0,sent:function(){if(W[0]&1)throw W[1];return W[1]},trys:[],ops:[]},Y,Q,W,X=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return X.next=K(0),X.throw=K(1),X.return=K(2),typeof Symbol==="function"&&(X[Symbol.iterator]=function(){return this}),X;function K(z){return function(H){return G([z,H])}}function G(z){if(Y)throw new TypeError("Generator is already executing.");while(X&&(X=0,z[0]&&($=0)),$)try{if(Y=1,Q&&(W=z[0]&2?Q.return:z[0]?Q.throw||((W=Q.return)&&W.call(Q),0):Q.next)&&!(W=W.call(Q,z[1])).done)return W;if(Q=0,W)z=[z[0]&2,W.value];switch(z[0]){case 0:case 1:W=z;break;case 4:return $.label++,{value:z[1],done:!1};case 5:$.label++,Q=z[1],z=[0];continue;case 7:z=$.ops.pop(),$.trys.pop();continue;default:if((W=$.trys,!(W=W.length>0&&W[W.length-1]))&&(z[0]===6||z[0]===2)){$=0;continue}if(z[0]===3&&(!W||z[1]>W[0]&&z[1]<W[3])){$.label=z[1];break}if(z[0]===6&&$.label<W[1]){$.label=W[1],W=z;break}if(W&&$.label<W[2]){$.label=W[2],$.ops.push(z);break}if(W[2])$.ops.pop();$.trys.pop();continue}z=J.call(Z,$)}catch(H){z=[6,H],Q=0}finally{Y=W=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},m5=function(Z,J){var $=typeof Symbol==="function"&&Z[Symbol.iterator];if(!$)return Z;var Y=$.call(Z),Q,W=[],X;try{while((J===void 0||J-- >0)&&!(Q=Y.next()).done)W.push(Q.value)}catch(K){X={error:K}}finally{try{if(Q&&!Q.done&&($=Y.return))$.call(Y)}finally{if(X)throw X.error}}return W},Z4=function(Z,J,$){if($||arguments.length===2){for(var Y=0,Q=J.length,W;Y<Q;Y++)if(W||!(Y in J)){if(!W)W=Array.prototype.slice.call(J,0,Y);W[Y]=J[Y]}}return Z.concat(W||Array.prototype.slice.call(J))},JY1=function(Z){var J=typeof Symbol==="function"&&Symbol.iterator,$=J&&Z[J],Y=0;if($)return $.call(Z);if(Z&&typeof Z.length==="number")return{next:function(){if(Z&&Y>=Z.length)Z=void 0;return{value:Z&&Z[Y++],done:!Z}}};throw new TypeError(J?"Object is not iterable.":"Symbol.iterator is not defined.")},xo6=function(){function Z(J){if(J===void 0)J=Z.minComparator;var $=this;this.compare=J,this.heapArray=[],this._limit=0,this.offer=this.add,this.element=this.peek,this.poll=this.pop,this._invertedCompare=function(Y,Q){return $.compare(Y,Q).then(function(W){return-1*W})}}return Z.getChildrenIndexOf=function(J){return[J*2+1,J*2+2]},Z.getParentIndexOf=function(J){if(J<=0)return-1;var $=J%2?1:2;return Math.floor((J-$)/2)},Z.getSiblingIndexOf=function(J){if(J<=0)return-1;var $=J%2?1:-1;return J+$},Z.minComparator=function(J,$){return N1(this,void 0,void 0,function(){return j1(this,function(Y){if(J>$)return[2,1];else if(J<$)return[2,-1];else return[2,0]})})},Z.maxComparator=function(J,$){return N1(this,void 0,void 0,function(){return j1(this,function(Y){if($>J)return[2,1];else if($<J)return[2,-1];else return[2,0]})})},Z.minComparatorNumber=function(J,$){return N1(this,void 0,void 0,function(){return j1(this,function(Y){return[2,J-$]})})},Z.maxComparatorNumber=function(J,$){return N1(this,void 0,void 0,function(){return j1(this,function(Y){return[2,$-J]})})},Z.defaultIsEqual=function(J,$){return N1(this,void 0,void 0,function(){return j1(this,function(Y){return[2,J===$]})})},Z.print=function(J){function $(H){var V=Z.getParentIndexOf(H);return Math.floor(Math.log2(V+1))}function Y(H,V){var q="";for(;V>0;--V)q+=H;return q}var Q=0,W=[],X=$(J.length-1)+2,K=0;while(Q<J.length){var G=$(Q)+1;if(Q===0)G=0;var z=String(J.get(Q));if(z.length>K)K=z.length;W[G]=W[G]||[],W[G].push(z),Q+=1}return W.map(function(H,V){var q=Math.pow(2,X-V)-1;return Y(" ",Math.floor(q/2)*K)+H.map(function(F){var U=(K-F.length)/2;return Y(" ",Math.ceil(U))+F+Y(" ",Math.floor(U))}).join(Y(" ",q*K))}).join(`
|
439
439
|
`)},Z.heapify=function(J,$){return N1(this,void 0,void 0,function(){var Y;return j1(this,function(Q){switch(Q.label){case 0:return Y=new Z($),Y.heapArray=J,[4,Y.init()];case 1:return Q.sent(),[2,Y]}})})},Z.heappop=function(J,$){var Y=new Z($);return Y.heapArray=J,Y.pop()},Z.heappush=function(J,$,Y){return N1(this,void 0,void 0,function(){var Q;return j1(this,function(W){switch(W.label){case 0:return Q=new Z(Y),Q.heapArray=J,[4,Q.push($)];case 1:return W.sent(),[2]}})})},Z.heappushpop=function(J,$,Y){var Q=new Z(Y);return Q.heapArray=J,Q.pushpop($)},Z.heapreplace=function(J,$,Y){var Q=new Z(Y);return Q.heapArray=J,Q.replace($)},Z.heaptop=function(J,$,Y){if($===void 0)$=1;var Q=new Z(Y);return Q.heapArray=J,Q.top($)},Z.heapbottom=function(J,$,Y){if($===void 0)$=1;var Q=new Z(Y);return Q.heapArray=J,Q.bottom($)},Z.nlargest=function(J,$,Y){return N1(this,void 0,void 0,function(){var Q;return j1(this,function(W){switch(W.label){case 0:return Q=new Z(Y),Q.heapArray=Z4([],m5($),!1),[4,Q.init()];case 1:return W.sent(),[2,Q.top(J)]}})})},Z.nsmallest=function(J,$,Y){return N1(this,void 0,void 0,function(){var Q;return j1(this,function(W){switch(W.label){case 0:return Q=new Z(Y),Q.heapArray=Z4([],m5($),!1),[4,Q.init()];case 1:return W.sent(),[2,Q.bottom(J)]}})})},Z.prototype.add=function(J){return N1(this,void 0,void 0,function(){return j1(this,function($){switch($.label){case 0:return[4,this._sortNodeUp(this.heapArray.push(J)-1)];case 1:return $.sent(),this._applyLimit(),[2,!0]}})})},Z.prototype.addAll=function(J){return N1(this,void 0,void 0,function(){var $,Y,Q;return j1(this,function(W){switch(W.label){case 0:$=this.length,(Q=this.heapArray).push.apply(Q,Z4([],m5(J),!1)),Y=this.length,W.label=1;case 1:if(!($<Y))return[3,4];return[4,this._sortNodeUp($)];case 2:W.sent(),W.label=3;case 3:return++$,[3,1];case 4:return this._applyLimit(),[2,!0]}})})},Z.prototype.bottom=function(){return N1(this,arguments,void 0,function(J){if(J===void 0)J=1;return j1(this,function($){if(this.heapArray.length===0||J<=0)return[2,[]];else if(this.heapArray.length===1)return[2,[this.heapArray[0]]];else if(J>=this.heapArray.length)return[2,Z4([],m5(this.heapArray),!1)];else return[2,this._bottomN_push(~~J)]})})},Z.prototype.check=function(){return N1(this,void 0,void 0,function(){var J,$,Y,Q,W,X,K,G,z;return j1(this,function(H){switch(H.label){case 0:J=0,H.label=1;case 1:if(!(J<this.heapArray.length))return[3,10];$=this.heapArray[J],Y=this.getChildrenOf(J),H.label=2;case 2:H.trys.push([2,7,8,9]),Q=(G=void 0,JY1(Y)),W=Q.next(),H.label=3;case 3:if(W.done)return[3,6];return X=W.value,[4,this.compare($,X)];case 4:if(H.sent()>0)return[2,$];H.label=5;case 5:return W=Q.next(),[3,3];case 6:return[3,9];case 7:return K=H.sent(),G={error:K},[3,9];case 8:try{if(W&&!W.done&&(z=Q.return))z.call(Q)}finally{if(G)throw G.error}return[7];case 9:return++J,[3,1];case 10:return[2]}})})},Z.prototype.clear=function(){this.heapArray=[]},Z.prototype.clone=function(){var J=new Z(this.comparator());return J.heapArray=this.toArray(),J._limit=this._limit,J},Z.prototype.comparator=function(){return this.compare},Z.prototype.contains=function(J){return N1(this,arguments,void 0,function($,Y){var Q,W,X,K,G,z;if(Y===void 0)Y=Z.defaultIsEqual;return j1(this,function(H){switch(H.label){case 0:H.trys.push([0,5,6,7]),Q=JY1(this.heapArray),W=Q.next(),H.label=1;case 1:if(W.done)return[3,4];return X=W.value,[4,Y(X,$)];case 2:if(H.sent())return[2,!0];H.label=3;case 3:return W=Q.next(),[3,1];case 4:return[3,7];case 5:return K=H.sent(),G={error:K},[3,7];case 6:try{if(W&&!W.done&&(z=Q.return))z.call(Q)}finally{if(G)throw G.error}return[7];case 7:return[2,!1]}})})},Z.prototype.init=function(J){return N1(this,void 0,void 0,function(){var $;return j1(this,function(Y){switch(Y.label){case 0:if(J)this.heapArray=Z4([],m5(J),!1);$=Math.floor(this.heapArray.length),Y.label=1;case 1:if(!($>=0))return[3,4];return[4,this._sortNodeDown($)];case 2:Y.sent(),Y.label=3;case 3:return--$,[3,1];case 4:return this._applyLimit(),[2]}})})},Z.prototype.isEmpty=function(){return this.length===0},Z.prototype.leafs=function(){if(this.heapArray.length===0)return[];var J=Z.getParentIndexOf(this.heapArray.length-1);return this.heapArray.slice(J+1)},Object.defineProperty(Z.prototype,"length",{get:function(){return this.heapArray.length},enumerable:!1,configurable:!0}),Object.defineProperty(Z.prototype,"limit",{get:function(){return this._limit},set:function(J){this._limit=~~J,this._applyLimit()},enumerable:!1,configurable:!0}),Z.prototype.peek=function(){return this.heapArray[0]},Z.prototype.pop=function(){return N1(this,void 0,void 0,function(){var J;return j1(this,function($){if(J=this.heapArray.pop(),this.length>0&&J!==void 0)return[2,this.replace(J)];return[2,J]})})},Z.prototype.push=function(){var J=[];for(var $=0;$<arguments.length;$++)J[$]=arguments[$];return N1(this,void 0,void 0,function(){return j1(this,function(Y){if(J.length<1)return[2,!1];else if(J.length===1)return[2,this.add(J[0])];else return[2,this.addAll(J)]})})},Z.prototype.pushpop=function(J){return N1(this,void 0,void 0,function(){var $;return j1(this,function(Y){switch(Y.label){case 0:return[4,this.compare(this.heapArray[0],J)];case 1:if(!(Y.sent()<0))return[3,3];return $=m5([this.heapArray[0],J],2),J=$[0],this.heapArray[0]=$[1],[4,this._sortNodeDown(0)];case 2:Y.sent(),Y.label=3;case 3:return[2,J]}})})},Z.prototype.remove=function(J){return N1(this,arguments,void 0,function($,Y){var Q,W,X,K=this;if(Y===void 0)Y=Z.defaultIsEqual;return j1(this,function(G){switch(G.label){case 0:if(!this.heapArray.length)return[2,!1];if($!==void 0)return[3,2];return[4,this.pop()];case 1:return G.sent(),[2,!0];case 2:Q=[0],G.label=3;case 3:if(!Q.length)return[3,13];return W=Q.shift(),[4,Y(this.heapArray[W],$)];case 4:if(!G.sent())return[3,11];if(W!==0)return[3,6];return[4,this.pop()];case 5:return G.sent(),[3,10];case 6:if(W!==this.heapArray.length-1)return[3,7];return this.heapArray.pop(),[3,10];case 7:return this.heapArray.splice(W,1,this.heapArray.pop()),[4,this._sortNodeUp(W)];case 8:return G.sent(),[4,this._sortNodeDown(W)];case 9:G.sent(),G.label=10;case 10:return[2,!0];case 11:X=Z.getChildrenIndexOf(W).filter(function(z){return z<K.heapArray.length}),Q.push.apply(Q,Z4([],m5(X),!1)),G.label=12;case 12:return[3,3];case 13:return[2,!1]}})})},Z.prototype.replace=function(J){return N1(this,void 0,void 0,function(){var $;return j1(this,function(Y){switch(Y.label){case 0:return $=this.heapArray[0],this.heapArray[0]=J,[4,this._sortNodeDown(0)];case 1:return Y.sent(),[2,$]}})})},Z.prototype.size=function(){return this.length},Z.prototype.top=function(){return N1(this,arguments,void 0,function(J){if(J===void 0)J=1;return j1(this,function($){if(this.heapArray.length===0||J<=0)return[2,[]];else if(this.heapArray.length===1||J===1)return[2,[this.heapArray[0]]];else if(J>=this.heapArray.length)return[2,Z4([],m5(this.heapArray),!1)];else return[2,this._topN_push(~~J)]})})},Z.prototype.toArray=function(){return Z4([],m5(this.heapArray),!1)},Z.prototype.toString=function(){return this.heapArray.toString()},Z.prototype.get=function(J){return this.heapArray[J]},Z.prototype.getChildrenOf=function(J){var $=this;return Z.getChildrenIndexOf(J).map(function(Y){return $.heapArray[Y]}).filter(function(Y){return Y!==void 0})},Z.prototype.getParentOf=function(J){var $=Z.getParentIndexOf(J);return this.heapArray[$]},Z.prototype[Symbol.iterator]=function(){return j1(this,function(J){switch(J.label){case 0:if(!this.length)return[3,2];return[4,this.pop()];case 1:return J.sent(),[3,0];case 2:return[2]}})},Z.prototype.iterator=function(){return this},Z.prototype._applyLimit=function(){if(this._limit&&this._limit<this.heapArray.length){var J=this.heapArray.length-this._limit;while(J)this.heapArray.pop(),--J}},Z.prototype._bottomN_push=function(J){return N1(this,void 0,void 0,function(){var $,Y,Q,W,K,X,K;return j1(this,function(G){switch(G.label){case 0:return $=new Z(this.compare),$.limit=J,$.heapArray=this.heapArray.slice(-J),[4,$.init()];case 1:G.sent(),Y=this.heapArray.length-1-J,Q=Z.getParentIndexOf(Y),W=[];for(K=Y;K>Q;--K)W.push(K);X=this.heapArray,G.label=2;case 2:if(!W.length)return[3,6];return K=W.shift(),[4,this.compare(X[K],$.peek())];case 3:if(!(G.sent()>0))return[3,5];return[4,$.replace(X[K])];case 4:if(G.sent(),K%2)W.push(Z.getParentIndexOf(K));G.label=5;case 5:return[3,2];case 6:return[2,$.toArray()]}})})},Z.prototype._moveNode=function(J,$){var Y;Y=m5([this.heapArray[$],this.heapArray[J]],2),this.heapArray[J]=Y[0],this.heapArray[$]=Y[1]},Z.prototype._sortNodeDown=function(J){return N1(this,void 0,void 0,function(){var $,Y,Q,W,X,K;return j1(this,function(G){switch(G.label){case 0:$=this.heapArray.length,G.label=1;case 1:if(Y=2*J+1,Q=Y+1,W=J,X=Y<$,!X)return[3,3];return[4,this.compare(this.heapArray[Y],this.heapArray[W])];case 2:X=G.sent()<0,G.label=3;case 3:if(X)W=Y;if(K=Q<$,!K)return[3,5];return[4,this.compare(this.heapArray[Q],this.heapArray[W])];case 4:K=G.sent()<0,G.label=5;case 5:if(K)W=Q;if(W===J)return[3,7];this._moveNode(J,W),J=W,G.label=6;case 6:return[3,1];case 7:return[2]}})})},Z.prototype._sortNodeUp=function(J){return N1(this,void 0,void 0,function(){var $;return j1(this,function(Y){switch(Y.label){case 0:if(!(J>0))return[3,2];return $=Z.getParentIndexOf(J),[4,this.compare(this.heapArray[J],this.heapArray[$])];case 1:if(Y.sent()<0)this._moveNode(J,$),J=$;else return[3,2];return[3,0];case 2:return[2]}})})},Z.prototype._topN_push=function(J){return N1(this,void 0,void 0,function(){var $,Y,Q,W;return j1(this,function(X){switch(X.label){case 0:$=new Z(this._invertedCompare),$.limit=J,Y=[0],Q=this.heapArray,X.label=1;case 1:if(!Y.length)return[3,7];if(W=Y.shift(),!(W<Q.length))return[3,6];if(!($.length<J))return[3,3];return[4,$.push(Q[W])];case 2:return X.sent(),Y.push.apply(Y,Z4([],m5(Z.getChildrenIndexOf(W)),!1)),[3,6];case 3:return[4,this.compare(Q[W],$.peek())];case 4:if(!(X.sent()<0))return[3,6];return[4,$.replace(Q[W])];case 5:X.sent(),Y.push.apply(Y,Z4([],m5(Z.getChildrenIndexOf(W)),!1)),X.label=6;case 6:return[3,1];case 7:return[2,$.toArray()]}})})},Z.prototype._topN_fill=function(J){return N1(this,void 0,void 0,function(){var $,Y,Q,W,X,X;return j1(this,function(K){switch(K.label){case 0:return $=this.heapArray,Y=new Z(this._invertedCompare),Y.limit=J,Y.heapArray=$.slice(0,J),[4,Y.init()];case 1:K.sent(),Q=Z.getParentIndexOf(J-1)+1,W=[];for(X=Q;X<J;++X)W.push.apply(W,Z4([],m5(Z.getChildrenIndexOf(X).filter(function(G){return G<$.length})),!1));if((J-1)%2)W.push(J);K.label=2;case 2:if(!W.length)return[3,6];if(X=W.shift(),!(X<$.length))return[3,5];return[4,this.compare($[X],Y.peek())];case 3:if(!(K.sent()<0))return[3,5];return[4,Y.replace($[X])];case 4:K.sent(),W.push.apply(W,Z4([],m5(Z.getChildrenIndexOf(X)),!1)),K.label=5;case 5:return[3,2];case 6:return[2,Y.toArray()]}})})},Z.prototype._topN_heap=function(J){return N1(this,void 0,void 0,function(){var $,Y,Q,W,X;return j1(this,function(K){switch(K.label){case 0:$=this.clone(),Y=[],Q=0,K.label=1;case 1:if(!(Q<J))return[3,4];return X=(W=Y).push,[4,$.pop()];case 2:X.apply(W,[K.sent()]),K.label=3;case 3:return++Q,[3,1];case 4:return[2,Y]}})})},Z.prototype._topIdxOf=function(J){return N1(this,void 0,void 0,function(){var $,Y,Q,W;return j1(this,function(X){switch(X.label){case 0:if(!J.length)return[2,-1];$=0,Y=J[$],Q=1,X.label=1;case 1:if(!(Q<J.length))return[3,4];return[4,this.compare(J[Q],Y)];case 2:if(W=X.sent(),W<0)$=Q,Y=J[Q];X.label=3;case 3:return++Q,[3,1];case 4:return[2,$]}})})},Z.prototype._topOf=function(){var J=[];for(var $=0;$<arguments.length;$++)J[$]=arguments[$];return N1(this,void 0,void 0,function(){var Y;return j1(this,function(Q){switch(Q.label){case 0:return Y=new Z(this.compare),[4,Y.init(J)];case 1:return Q.sent(),[2,Y.peek()]}})})},Z}(),p96=function(Z,J){var $={label:0,sent:function(){if(W[0]&1)throw W[1];return W[1]},trys:[],ops:[]},Y,Q,W,X=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return X.next=K(0),X.throw=K(1),X.return=K(2),typeof Symbol==="function"&&(X[Symbol.iterator]=function(){return this}),X;function K(z){return function(H){return G([z,H])}}function G(z){if(Y)throw new TypeError("Generator is already executing.");while(X&&(X=0,z[0]&&($=0)),$)try{if(Y=1,Q&&(W=z[0]&2?Q.return:z[0]?Q.throw||((W=Q.return)&&W.call(Q),0):Q.next)&&!(W=W.call(Q,z[1])).done)return W;if(Q=0,W)z=[z[0]&2,W.value];switch(z[0]){case 0:case 1:W=z;break;case 4:return $.label++,{value:z[1],done:!1};case 5:$.label++,Q=z[1],z=[0];continue;case 7:z=$.ops.pop(),$.trys.pop();continue;default:if((W=$.trys,!(W=W.length>0&&W[W.length-1]))&&(z[0]===6||z[0]===2)){$=0;continue}if(z[0]===3&&(!W||z[1]>W[0]&&z[1]<W[3])){$.label=z[1];break}if(z[0]===6&&$.label<W[1]){$.label=W[1],W=z;break}if(W&&$.label<W[2]){$.label=W[2],$.ops.push(z);break}if(W[2])$.ops.pop();$.trys.pop();continue}z=J.call(Z,$)}catch(H){z=[6,H],Q=0}finally{Y=W=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},R6=function(Z,J){var $=typeof Symbol==="function"&&Z[Symbol.iterator];if(!$)return Z;var Y=$.call(Z),Q,W=[],X;try{while((J===void 0||J-- >0)&&!(Q=Y.next()).done)W.push(Q.value)}catch(K){X={error:K}}finally{try{if(Q&&!Q.done&&($=Y.return))$.call(Y)}finally{if(X)throw X.error}}return W},L5=function(Z,J,$){if($||arguments.length===2){for(var Y=0,Q=J.length,W;Y<Q;Y++)if(W||!(Y in J)){if(!W)W=Array.prototype.slice.call(J,0,Y);W[Y]=J[Y]}}return Z.concat(W||Array.prototype.slice.call(J))};var $Y1=function(){function Z(J){if(J===void 0)J=Z.minComparator;var $=this;this.compare=J,this.heapArray=[],this._limit=0,this.offer=this.add,this.element=this.peek,this.poll=this.pop,this.removeAll=this.clear,this._invertedCompare=function(Y,Q){return-1*$.compare(Y,Q)}}return Z.getChildrenIndexOf=function(J){return[J*2+1,J*2+2]},Z.getParentIndexOf=function(J){if(J<=0)return-1;var $=J%2?1:2;return Math.floor((J-$)/2)},Z.getSiblingIndexOf=function(J){if(J<=0)return-1;var $=J%2?1:-1;return J+$},Z.minComparator=function(J,$){if(J>$)return 1;else if(J<$)return-1;else return 0},Z.maxComparator=function(J,$){if($>J)return 1;else if($<J)return-1;else return 0},Z.minComparatorNumber=function(J,$){return J-$},Z.maxComparatorNumber=function(J,$){return $-J},Z.defaultIsEqual=function(J,$){return J===$},Z.print=function(J){function $(H){var V=Z.getParentIndexOf(H);return Math.floor(Math.log2(V+1))}function Y(H,V){var q="";for(;V>0;--V)q+=H;return q}var Q=0,W=[],X=$(J.length-1)+2,K=0;while(Q<J.length){var G=$(Q)+1;if(Q===0)G=0;var z=String(J.get(Q));if(z.length>K)K=z.length;W[G]=W[G]||[],W[G].push(z),Q+=1}return W.map(function(H,V){var q=Math.pow(2,X-V)-1;return Y(" ",Math.floor(q/2)*K)+H.map(function(F){var U=(K-F.length)/2;return Y(" ",Math.ceil(U))+F+Y(" ",Math.floor(U))}).join(Y(" ",q*K))}).join(`
|
440
440
|
`)},Z.heapify=function(J,$){var Y=new Z($);return Y.heapArray=J,Y.init(),Y},Z.heappop=function(J,$){var Y=new Z($);return Y.heapArray=J,Y.pop()},Z.heappush=function(J,$,Y){var Q=new Z(Y);Q.heapArray=J,Q.push($)},Z.heappushpop=function(J,$,Y){var Q=new Z(Y);return Q.heapArray=J,Q.pushpop($)},Z.heapreplace=function(J,$,Y){var Q=new Z(Y);return Q.heapArray=J,Q.replace($)},Z.heaptop=function(J,$,Y){if($===void 0)$=1;var Q=new Z(Y);return Q.heapArray=J,Q.top($)},Z.heapbottom=function(J,$,Y){if($===void 0)$=1;var Q=new Z(Y);return Q.heapArray=J,Q.bottom($)},Z.nlargest=function(J,$,Y){var Q=new Z(Y);return Q.heapArray=L5([],R6($),!1),Q.init(),Q.top(J)},Z.nsmallest=function(J,$,Y){var Q=new Z(Y);return Q.heapArray=L5([],R6($),!1),Q.init(),Q.bottom(J)},Z.prototype.add=function(J){return this._sortNodeUp(this.heapArray.push(J)-1),this._applyLimit(),!0},Z.prototype.addAll=function(J){var $,Y=this.length;($=this.heapArray).push.apply($,L5([],R6(J),!1));for(var Q=this.length;Y<Q;++Y)this._sortNodeUp(Y);return this._applyLimit(),!0},Z.prototype.bottom=function(J){if(J===void 0)J=1;if(this.heapArray.length===0||J<=0)return[];else if(this.heapArray.length===1)return[this.heapArray[0]];else if(J>=this.heapArray.length)return L5([],R6(this.heapArray),!1);else return this._bottomN_push(~~J)},Z.prototype.check=function(){var J=this;return this.heapArray.find(function($,Y){return!!J.getChildrenOf(Y).find(function(Q){return J.compare($,Q)>0})})},Z.prototype.clear=function(){this.heapArray=[]},Z.prototype.clone=function(){var J=new Z(this.comparator());return J.heapArray=this.toArray(),J._limit=this._limit,J},Z.prototype.comparator=function(){return this.compare},Z.prototype.contains=function(J,$){if($===void 0)$=Z.defaultIsEqual;return this.indexOf(J,$)!==-1},Z.prototype.init=function(J){if(J)this.heapArray=L5([],R6(J),!1);for(var $=Math.floor(this.heapArray.length);$>=0;--$)this._sortNodeDown($);this._applyLimit()},Z.prototype.isEmpty=function(){return this.length===0},Z.prototype.indexOf=function(J,$){if($===void 0)$=Z.defaultIsEqual;if(this.heapArray.length===0)return-1;var Y=[],Q=0;while(Q<this.heapArray.length){var W=this.heapArray[Q];if($(W,J))return Q;else if(this.compare(W,J)<=0)Y.push.apply(Y,L5([],R6(Z.getChildrenIndexOf(Q)),!1));Q=Y.shift()||this.heapArray.length}return-1},Z.prototype.indexOfEvery=function(J,$){if($===void 0)$=Z.defaultIsEqual;if(this.heapArray.length===0)return[];var Y=[],Q=[],W=0;while(W<this.heapArray.length){var X=this.heapArray[W];if($(X,J))Q.push(W),Y.push.apply(Y,L5([],R6(Z.getChildrenIndexOf(W)),!1));else if(this.compare(X,J)<=0)Y.push.apply(Y,L5([],R6(Z.getChildrenIndexOf(W)),!1));W=Y.shift()||this.heapArray.length}return Q},Z.prototype.leafs=function(){if(this.heapArray.length===0)return[];var J=Z.getParentIndexOf(this.heapArray.length-1);return this.heapArray.slice(J+1)},Object.defineProperty(Z.prototype,"length",{get:function(){return this.heapArray.length},enumerable:!1,configurable:!0}),Object.defineProperty(Z.prototype,"limit",{get:function(){return this._limit},set:function(J){if(J<0||isNaN(J))this._limit=0;else this._limit=~~J;this._applyLimit()},enumerable:!1,configurable:!0}),Z.prototype.setLimit=function(J){if(this.limit=J,J<0||isNaN(J))return NaN;else return this._limit},Z.prototype.peek=function(){return this.heapArray[0]},Z.prototype.pop=function(){var J=this.heapArray.pop();if(this.length>0&&J!==void 0)return this.replace(J);return J},Z.prototype.push=function(){var J=[];for(var $=0;$<arguments.length;$++)J[$]=arguments[$];if(J.length<1)return!1;else if(J.length===1)return this.add(J[0]);else return this.addAll(J)},Z.prototype.pushpop=function(J){var $;if(this.compare(this.heapArray[0],J)<0)$=R6([this.heapArray[0],J],2),J=$[0],this.heapArray[0]=$[1],this._sortNodeDown(0);return J},Z.prototype.remove=function(J,$){var Y=this;if($===void 0)$=Z.defaultIsEqual;if(!this.heapArray.length)return!1;if(J===void 0)return this.pop(),!0;var Q=[0];while(Q.length){var W=Q.shift();if($(this.heapArray[W],J)){if(W===0)this.pop();else if(W===this.heapArray.length-1)this.heapArray.pop();else this.heapArray.splice(W,1,this.heapArray.pop()),this._sortNodeUp(W),this._sortNodeDown(W);return!0}else if(this.compare(this.heapArray[W],J)<=0){var X=Z.getChildrenIndexOf(W).filter(function(K){return K<Y.heapArray.length});Q.push.apply(Q,L5([],R6(X),!1))}}return!1},Z.prototype.replace=function(J){var $=this.heapArray[0];return this.heapArray[0]=J,this._sortNodeDown(0),$},Z.prototype.size=function(){return this.length},Z.prototype.top=function(J){if(J===void 0)J=1;if(this.heapArray.length===0||J<=0)return[];else if(this.heapArray.length===1||J===1)return[this.heapArray[0]];else if(J>=this.heapArray.length)return L5([],R6(this.heapArray),!1);else return this._topN_push(~~J)},Z.prototype.toArray=function(){return L5([],R6(this.heapArray),!1)},Z.prototype.toString=function(){return this.heapArray.toString()},Z.prototype.get=function(J){return this.heapArray[J]},Z.prototype.getChildrenOf=function(J){var $=this;return Z.getChildrenIndexOf(J).map(function(Y){return $.heapArray[Y]}).filter(function(Y){return Y!==void 0})},Z.prototype.getParentOf=function(J){var $=Z.getParentIndexOf(J);return this.heapArray[$]},Z.prototype[Symbol.iterator]=function(){return p96(this,function(J){switch(J.label){case 0:if(!this.length)return[3,2];return[4,this.pop()];case 1:return J.sent(),[3,0];case 2:return[2]}})},Z.prototype.iterator=function(){return this.toArray()},Z.prototype._applyLimit=function(){if(this._limit>0&&this._limit<this.heapArray.length){var J=this.heapArray.length-this._limit;while(J)this.heapArray.pop(),--J}},Z.prototype._bottomN_push=function(J){var $=new Z(this.compare);$.limit=J,$.heapArray=this.heapArray.slice(-J),$.init();var Y=this.heapArray.length-1-J,Q=Z.getParentIndexOf(Y),W=[];for(var X=Y;X>Q;--X)W.push(X);var K=this.heapArray;while(W.length){var X=W.shift();if(this.compare(K[X],$.peek())>0){if($.replace(K[X]),X%2)W.push(Z.getParentIndexOf(X))}}return $.toArray()},Z.prototype._moveNode=function(J,$){var Y;Y=R6([this.heapArray[$],this.heapArray[J]],2),this.heapArray[J]=Y[0],this.heapArray[$]=Y[1]},Z.prototype._sortNodeDown=function(J){var $=this.heapArray.length;while(!0){var Y=2*J+1,Q=Y+1,W=J;if(Y<$&&this.compare(this.heapArray[Y],this.heapArray[W])<0)W=Y;if(Q<$&&this.compare(this.heapArray[Q],this.heapArray[W])<0)W=Q;if(W===J)break;this._moveNode(J,W),J=W}},Z.prototype._sortNodeUp=function(J){while(J>0){var $=Z.getParentIndexOf(J);if(this.compare(this.heapArray[J],this.heapArray[$])<0)this._moveNode(J,$),J=$;else break}},Z.prototype._topN_push=function(J){var $=new Z(this._invertedCompare);$.limit=J;var Y=[0],Q=this.heapArray;while(Y.length){var W=Y.shift();if(W<Q.length){if($.length<J)$.push(Q[W]),Y.push.apply(Y,L5([],R6(Z.getChildrenIndexOf(W)),!1));else if(this.compare(Q[W],$.peek())<0)$.replace(Q[W]),Y.push.apply(Y,L5([],R6(Z.getChildrenIndexOf(W)),!1))}}return $.toArray()},Z.prototype._topN_fill=function(J){var $=this.heapArray,Y=new Z(this._invertedCompare);Y.limit=J,Y.heapArray=$.slice(0,J),Y.init();var Q=Z.getParentIndexOf(J-1)+1,W=[];for(var X=Q;X<J;++X)W.push.apply(W,L5([],R6(Z.getChildrenIndexOf(X).filter(function(K){return K<$.length})),!1));if((J-1)%2)W.push(J);while(W.length){var X=W.shift();if(X<$.length){if(this.compare($[X],Y.peek())<0)Y.replace($[X]),W.push.apply(W,L5([],R6(Z.getChildrenIndexOf(X)),!1))}}return Y.toArray()},Z.prototype._topN_heap=function(J){var $=this.clone(),Y=[];for(var Q=0;Q<J;++Q)Y.push($.pop());return Y},Z.prototype._topIdxOf=function(J){if(!J.length)return-1;var $=0,Y=J[$];for(var Q=1;Q<J.length;++Q){var W=this.compare(J[Q],Y);if(W<0)$=Q,Y=J[Q]}return $},Z.prototype._topOf=function(){var J=[];for(var $=0;$<arguments.length;$++)J[$]=arguments[$];var Y=new Z(this.compare);return Y.init(J),Y.peek()},Z}();class iq extends b${_faceSpeed=0;_faceTarget;_jumpHeight=0;_moveSpeed=0;_moveTarget;_moveIgnoreAxes={};_onFace;_onFaceComplete;_onMove;_onMoveComplete;face(Z,J,$){this._faceTarget=Z,this._faceSpeed=J,this._onFace=$?.faceCallback,this._onFaceComplete=$?.faceCompleteCallback}jump(Z){this._jumpHeight=Z}move(Z,J,$){this._moveTarget=Z,this._moveSpeed=J,this._moveIgnoreAxes=$?.moveIgnoreAxes??{},this._onMove=$?.moveCallback,this._onMoveComplete=$?.moveCompleteCallback}tick(Z,J){if(super.tick(Z,J),!this._moveTarget&&!this._faceTarget&&!this._jumpHeight)return;let $=J/1000,Y=Z.position;if(Z.isDynamic&&this._jumpHeight>0){let Q=Math.abs(Z.world.simulation.gravity.y),W=Math.sqrt(2*Q*this._jumpHeight);Z.applyImpulse({x:0,y:W*Z.mass,z:0}),this._jumpHeight=0}if(this._moveTarget){let Q={x:this._moveIgnoreAxes.x?0:this._moveTarget.x-Y.x,y:this._moveIgnoreAxes.y?0:this._moveTarget.y-Y.y,z:this._moveIgnoreAxes.z?0:this._moveTarget.z-Y.z},W=Q.x*Q.x+Q.y*Q.y+Q.z*Q.z;if(W>0.1){let X=Math.sqrt(W),K=this._moveSpeed*$,z=Math.min(X,K)/X,H={x:Y.x+Q.x*z,y:Y.y+Q.y*z,z:Y.z+Q.z*z};if(Z.setPosition(H),this._onMove)this._onMove(H,this._moveTarget)}else if(this._moveTarget=void 0,this._onMoveComplete){let X=this._onMoveComplete;this._onMove=void 0,this._onMoveComplete=void 0,X(Y)}}if(this._faceTarget){let Q={x:this._faceTarget.x-Y.x,z:this._faceTarget.z-Y.z},W=Math.atan2(-Q.x,-Q.z),X=Z.rotation,K=Math.atan2(2*(X.w*X.y),1-2*(X.y*X.y)),G=W-K;while(G>Math.PI)G-=2*Math.PI;while(G<-Math.PI)G+=2*Math.PI;if(Math.abs(G)>0.01){let z=this._faceSpeed*$,H=Math.abs(G)<z?G:Math.sign(G)*z,q=(K+H)/2,F={x:0,y:Math.fround(Math.sin(q)),z:0,w:Math.fround(Math.cos(q))};if(Z.setRotation(F),this._onFace)this._onFace(X,F)}else if(this._faceTarget=void 0,this._onFaceComplete){let z=this._onFaceComplete;this._onFaceComplete=void 0,z(Z.rotation)}}}}class Yb extends iq{_debug=!1;_entity;_maxFall=0;_maxJump=0;_maxOpenSetIterations=200;_onPathfindAbort;_onPathfindComplete;_onWaypointMoveComplete;_onWaypointMoveSkipped;_speed=0;_target;_verticalPenalty=0;_waypoints=[];_waypointNextIndex=0;_waypointTimeoutMs=2000;get debug(){return this._debug}get maxFall(){return this._maxFall}get maxJump(){return this._maxJump}get maxOpenSetIterations(){return this._maxOpenSetIterations}get speed(){return this._speed}get target(){return this._target}get verticalPenalty(){return this._verticalPenalty}get waypoints(){return this._waypoints}get waypointNextIndex(){return this._waypointNextIndex}get waypointTimeoutMs(){return this._waypointTimeoutMs}pathfind(Z,J,$){if(this._target=Z,this._speed=J,this._debug=$?.debug??!1,this._maxFall=$?.maxFall?-Math.abs($.maxFall):0,this._maxJump=$?.maxJump?Math.abs($.maxJump):0,this._maxOpenSetIterations=$?.maxOpenSetIterations??200,this._onPathfindAbort=$?.pathfindAbortCallback,this._onPathfindComplete=$?.pathfindCompleteCallback,this._onWaypointMoveComplete=$?.waypointMoveCompleteCallback,this._onWaypointMoveSkipped=$?.waypointMoveSkippedCallback,this._verticalPenalty=$?.verticalPenalty??0,this._waypoints=[],this._waypointNextIndex=0,this._waypointTimeoutMs=$?.waypointTimeoutMs??2000/J,!this._calculatePath())return!1;return this._moveToNextWaypoint(),!0}attach(Z){super.attach(Z),this._entity=Z}detach(Z){super.detach(Z),this._entity=void 0}tick(Z,J){super.tick(Z,J)}_calculatePath(){if(!this._target||!this._entity?.world)return m.error("PathfindingEntityController._calculatePath: No target or world"),!1;let Z=this._entity.height,J=this._findGroundedStart();if(!J){if(this._debug)m.warning(`PathfindingEntityController._calculatePath: No valid grounded start found within maxFall distance, path search aborted. Start: ${this._coordinateToKey(this._target)}, Target: ${this._coordinateToKey(this._target)}`);return!1}let $={x:Math.floor(this._target.x),y:Math.floor(this._target.y),z:Math.floor(this._target.z)},Y=Math.abs($.x-J.x),Q=Math.abs($.y-J.y),W=Math.abs($.z-J.z);if(Y<=2&&Q<=2&&W<=2&&!this._isNeighborCoordinateBlocked(J,$,this._entity.height))return this._waypoints=[{x:J.x+0.5,y:J.y+Z/2,z:J.z+0.5},{x:$.x+0.5,y:$.y+Z/2,z:$.z+0.5}],!0;if(J.x===$.x&&J.y===$.y&&J.z===$.z)return this._waypoints=[{x:J.x+0.5,y:J.y+Z/2,z:J.z+0.5}],!0;let K=this._coordinateToKey(J),G=new Map,z=new Map([[K,0]]),H=new Map([[K,this._pathfindingHeuristic(J,$)]]),V=new Set,q=new $Y1((M,N)=>{let D=H.get(M[0])??1/0,P=H.get(N[0])??1/0;return D-P});q.push([K,J]);let F=[{x:0,y:0,z:1},{x:1,y:0,z:0},{x:0,y:0,z:-1},{x:-1,y:0,z:0},{x:1,y:0,z:1},{x:1,y:0,z:-1},{x:-1,y:0,z:1},{x:-1,y:0,z:-1}],U=[];for(let M=this._maxJump;M>=this._maxFall;M--){if(M===0)continue;let N=Math.abs(J.y+M-$.y);U.push({y:M,distanceToTargetY:N})}U.sort((M,N)=>M.distanceToTargetY-N.distanceToTargetY);let w=[...F,...U.flatMap(({y:M})=>F.map((N)=>({...N,y:M})))],L=0,O=Math.abs($.x-J.x)+Math.abs($.y-J.y)+Math.abs($.z-J.z),j=Math.min(this._maxOpenSetIterations,O*20);while(!q.isEmpty()&&L<j){L++;let[M,N]=q.pop();if(N.x===$.x&&N.y===$.y&&N.z===$.z){let C=this._reconstructPath(G,N);if(this._waypoints=C.map((T)=>({x:T.x+0.5,y:T.y+Z/2,z:T.z+0.5})),this._debug)console.log(`PathfindingEntityController._calculatePath: Path found after ${L} open set iterations. Start: ${this._coordinateToKey(J)}, Target: ${this._coordinateToKey(this._target)}`);return!0}V.add(M);let D=z.get(M),P=new Map;for(let C of w){let T=`${C.x},${C.z}`,E=C.y<0;if(E&&P.has(T))continue;let A={x:N.x+C.x,y:N.y+C.y,z:N.z+C.z};if(Math.abs($.x-A.x)+Math.abs($.y-A.y)+Math.abs($.z-A.z)>O*1.5)continue;let x=this._coordinateToKey(A);if(V.has(x))continue;let I=this._isNeighborCoordinateBlocked(N,A,this._entity.height);if(E&&I){P.set(T,!0);continue}if(I)continue;let v=Math.abs(C.x),f=Math.abs(C.y),p=Math.abs(C.z),n=f===0?0:this._verticalPenalty,o=(Math.max(v,f,p)===1&&v+f+p>1?1.4:1)+n,$0=D+o,W0=z.get(x)??1/0;if($0>=W0)continue;G.set(x,N),z.set(x,$0);let C0=$0+this._pathfindingHeuristic(A,$);H.set(x,C0),q.push([x,A])}}if(L>=j){if(this._onPathfindAbort?.(),this._debug)m.warning(`PathfindingEntityController._calculatePath: Maximum open set iterations reached (${j}), path search aborted. Start: ${this._coordinateToKey(J)}, Target: ${this._coordinateToKey(this._target)}`)}else if(this._debug)m.warning(`PathfindingEntityController._calculatePath: No valid path found. Start: ${this._coordinateToKey(J)}, Target: ${this._coordinateToKey(this._target)}`);return this._target=void 0,this._waypoints=[],!1}_reconstructPath(Z,J){let $=[J],Y=J;while(Z.has(this._coordinateToKey(Y)))Y=Z.get(this._coordinateToKey(Y)),$.unshift(Y);return $}_coordinateToKey(Z){return`${Z.x},${Z.y},${Z.z}`}_moveToNextWaypoint(){let Z=this._waypointNextIndex>0?this._waypoints[this._waypointNextIndex-1]:void 0,J=this._waypoints[this._waypointNextIndex];if(!J||!this._entity)return;let $=0;if(this._entity.isDynamic&&Z&&J.y>Z.y){let Y=J.y-Z.y,Q=Math.min(Y,this._maxJump)+0.75;this.jump(Q);let W=Math.abs(this._entity.world.simulation.gravity.y),X=Math.sqrt(2*W*Q),K=Z.x+0.5,G=Z.z+0.5,z=J.x+0.5,H=J.z+0.5,V=z-K,q=H-G,F=Math.sqrt(V*V+q*q),U=X/W,w=F/this._speed;$=Math.min(U*0.8,w)*1000}setTimeout(()=>{if(!this._entity)return;let Y=Date.now();this.face(J,this._speed),this.move(J,this._speed,{moveIgnoreAxes:{y:this._entity.isDynamic},moveCallback:()=>{if(Date.now()-Y>this._waypointTimeoutMs&&this._waypointNextIndex<this._waypoints.length-1)this._onWaypointMoveSkipped?.(J,this._waypointNextIndex),this._waypointNextIndex++,this._moveToNextWaypoint()},moveCompleteCallback:()=>{if(this._waypointNextIndex<this._waypoints.length-1)this._onWaypointMoveComplete?.(J,this._waypointNextIndex),this._waypointNextIndex++,this._moveToNextWaypoint();else this._onPathfindComplete?.()}})},$)}_pathfindingHeuristic(Z,J){return Math.abs(Z.x-J.x)+Math.abs(Z.y-J.y)+Math.abs(Z.z-J.z)}_isNeighborCoordinateBlocked(Z,J,$){if(!this._entity?.world)return!1;let Y=this._entity.world,Q=Math.floor(J.x),W=Math.floor(J.y),X=Math.floor(J.z),K=Math.floor(Z.x),G=Math.floor(Z.z);if(!Y.chunkLattice.hasBlock({x:Q,y:W-1,z:X}))return!0;for(let z=0;z<$;z++)if(Y.chunkLattice.hasBlock({x:Q,y:W+z,z:X}))return!0;if(Q!==K&&X!==G)for(let z=0;z<$;z++){let H=Y.chunkLattice.hasBlock({x:Q,y:W+z,z:G}),V=Y.chunkLattice.hasBlock({x:K,y:W+z,z:X});if(H||V)return!0}return!1}_findGroundedStart(){if(!this._entity?.world)return;let{x:Z,y:J,z:$}=this._entity.position,Y={x:Math.floor(Z),y:Math.floor(J),z:Math.floor($)};for(let Q=0;Q<=Math.abs(this._maxFall);Q++)if(this._entity.world.chunkLattice.hasBlock({...Y,y:Y.y-Q-1}))return{...Y,y:Y.y-Q};return}}export{G86 as startServer,Q$1 as WorldManagerEvent,O3 as WorldManager,Y$1 as WorldLoopEvent,mq as WorldLoop,sf as WorldEvent,uq as World,Yv as WebServerEvent,tX as WebServer,R3 as Vector3,pq as Vector2,gq as Ticker,af as SimulationEvent,bq as Simulation,iq as SimpleEntityController,yq as SceneUIManager,df as SceneUIEvent,vq as SceneUI,X$1 as SUPPORTED_INPUT_KEYS,oG as RigidBodyType,DY as RigidBody,Z$1 as ROTATION_UPDATE_THRESHOLD,M3 as Quaternion,DM as PlayerUIEvent,hq as PlayerUI,oJ1 as PlayerManagerEvent,e5 as PlayerManager,Sq as PlayerEvent,d7 as PlayerEntity,$$1 as PlayerCameraMode,pf as PlayerCameraEvent,xq as PlayerCamera,w3 as Player,GW as PersistenceManager,Yb as PathfindingEntityController,eJ1 as POSITION_UPDATE_THRESHOLD_SQ,Jv as PORT,N9 as ModelRegistry,U5 as Matrix4,l7 as Matrix3,HW as Matrix2,J$1 as LightType,Aq as LightManager,cf as LightEvent,lf as Light,W$1 as GameServerEvent,sZ as GameServer,g0 as EventRouter,m as ErrorHandler,_q as EntityManager,Iq as EntityEvent,a8 as Entity,cq as DefaultPlayerEntityController,rf as DefaultPlayerEntity,tJ1 as DEFAULT_ENTITY_RIGID_BODY_OPTIONS,X4 as CollisionGroupsBuilder,d$ as CollisionGroup,rG as ColliderShape,fq as ColliderMap,a5 as Collider,pC as CoefficientCombineRule,Eq as ChunkLattice,uf as ChunkEvent,g6 as Chunk,dq as ChatManager,of as ChatEvent,nC as BlockTypeRegistryEvent,tG as BlockTypeRegistry,iC as BlockTypeEvent,s5 as BlockType,FW as Block,Fb as BaseEntityControllerEvent,b$ as BaseEntityController,C3 as AudioManager,SM as AudioEvent,D3 as Audio};
|