hytopia 0.5.13-dev1 → 0.5.13-dev2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +2 -2
package/server.js CHANGED
@@ -402,7 +402,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
402
402
  `,concatBytes:wR},hW1=(Z,J)=>{let Y=new Uint8Array(Z.length+J.length);return Y.set(Z,0),Y.set(J,Z.length),Y},fW1={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:hW1};import{Buffer as yW1}from"buffer";var tg=(Z,J)=>Z?void 0:bW1.bind(void 0,J),bW1=function*(Z,J){if(typeof J!=="string"&&!b8(J)&&!yW1.isBuffer(J))throw new TypeError(`The \`${Z}\` option's transform must use "objectMode: true" to receive as input: ${typeof J}.`);yield J},eg=(Z,J)=>Z?gW1.bind(void 0,J):mW1.bind(void 0,J),gW1=function*(Z,J){Zm(Z,J),yield J},mW1=function*(Z,J){if(Zm(Z,J),typeof J!=="string"&&!b8(J))throw new TypeError(`The \`${Z}\` option's function must yield a string or an Uint8Array, not ${typeof J}.`);yield J},Zm=(Z,J)=>{if(J===null||J===void 0)throw new TypeError(`The \`${Z}\` option's function must not call \`yield ${J}\`.
403
403
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
404
404
  if (condition) { yield value; }`)};import{Buffer as dW1}from"buffer";import{StringDecoder as uW1}from"string_decoder";var Sq=(Z,J,Y)=>{if(Y)return;if(Z)return{transform:cW1.bind(void 0,new TextEncoder)};let $=new uW1(J);return{transform:lW1.bind(void 0,$),final:pW1.bind(void 0,$)}},cW1=function*(Z,J){if(dW1.isBuffer(J))yield T7(J);else if(typeof J==="string")yield Z.encode(J);else yield J},lW1=function*(Z,J){yield b8(J)?Z.write(J):J},pW1=function*(Z){let J=Z.end();if(J!=="")yield J};import{callbackify as Jm}from"util";var OR=Jm(async(Z,J,Y,$)=>{J.currentIterable=Z(...Y);try{for await(let Q of J.currentIterable)$.push(Q)}finally{delete J.currentIterable}}),_q=async function*(Z,J,Y){if(Y===J.length){yield Z;return}let{transform:$=nW1}=J[Y];for await(let Q of $(Z))yield*_q(Q,J,Y+1)},Ym=async function*(Z){for(let[J,{final:Y}]of Object.entries(Z))yield*iW1(Y,Number(J),Z)},iW1=async function*(Z,J,Y){if(Z===void 0)return;for await(let $ of Z())yield*_q($,Y,J+1)},$m=Jm(async({currentIterable:Z},J)=>{if(Z!==void 0){await(J?Z.throw(J):Z.return());return}if(J)throw J}),nW1=function*(Z){yield Z};var MR=(Z,J,Y,$)=>{try{for(let Q of Z(...J))Y.push(Q);$()}catch(Q){$(Q)}},Qm=(Z,J)=>[...J.flatMap((Y)=>[...MY(Y,Z,0)]),...BG(Z)],MY=function*(Z,J,Y){if(Y===J.length){yield Z;return}let{transform:$=sW1}=J[Y];for(let Q of $(Z))yield*MY(Q,J,Y+1)},BG=function*(Z){for(let[J,{final:Y}]of Object.entries(Z))yield*aW1(Y,Number(J),Z)},aW1=function*(Z,J,Y){if(Z===void 0)return;for(let $ of Z())yield*MY($,Y,J+1)},sW1=function*(Z){yield Z};var NR=({value:Z,value:{transform:J,final:Y,writableObjectMode:$,readableObjectMode:Q},optionName:W},{encoding:X})=>{let K={},G=Xm(Z,X,W),z=OY(J),F=OY(Y),H=z?OR.bind(void 0,_q,K):MR.bind(void 0,MY),V=z||F?OR.bind(void 0,Ym,K):MR.bind(void 0,BG),q=z||F?$m.bind(void 0,K):void 0;return{stream:new oW1({writableObjectMode:$,writableHighWaterMark:Wm($),readableObjectMode:Q,readableHighWaterMark:Wm(Q),transform(w,L,O){H([w,G,0],this,O)},flush(w){V([G],this,w)},destroy:q})}},Aq=(Z,J,Y,$)=>{let Q=J.filter(({type:X})=>X==="generator"),W=$?Q.reverse():Q;for(let{value:X,optionName:K}of W){let G=Xm(X,Y,K);Z=Qm(G,Z)}return Z},Xm=({transform:Z,final:J,binary:Y,writableObjectMode:$,readableObjectMode:Q,preserveNewlines:W},X,K)=>{let G={};return[{transform:tg($,K)},Sq(Y,X,$),vq(Y,W,$,G),{transform:Z,final:J},{transform:eg(Q,K)},rg({binary:Y,preserveNewlines:W,readableObjectMode:Q,state:G})].filter(Boolean)};var Km=(Z,J)=>{for(let Y of rW1(Z))tW1(Z,Y,J)},rW1=(Z)=>new Set(Object.entries(Z).filter(([,{direction:J}])=>J==="input").map(([J])=>Number(J))),tW1=(Z,J,Y)=>{let{stdioItems:$}=Z[J],Q=$.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 ${vZ[K]} with synchronous methods.`)}let X=Q.map(({contents:K})=>K).map((K)=>eW1(K,$));Y.input=zG(X)},eW1=(Z,J)=>{let Y=Aq(Z,J,"utf8",!0);return ZX1(Y),zG(Y)},ZX1=(Z)=>{let J=Z.find((Y)=>typeof Y!=="string"&&!b8(Y));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 QX1,appendFileSync as WX1}from"fs";var xq=({stdioItems:Z,encoding:J,verboseInfo:Y,fdNumber:$})=>$!=="all"&&lQ(Y,$)&&!v5.has(J)&&JX1($)&&(Z.some(({type:Q,value:W})=>Q==="native"&&YX1.has(W))||Z.every(({type:Q})=>t5.has(Q))),JX1=(Z)=>Z===1||Z===2,YX1=new Set(["pipe","overlapped"]),Gm=async(Z,J,Y,$)=>{for await(let Q of Z)if(!$X1(J))Fm(Q,Y,$)},zm=(Z,J,Y)=>{for(let $ of Z)Fm($,J,Y)},$X1=(Z)=>Z._readableState.pipes.length>0,Fm=(Z,J,Y)=>{let $=pV(Z);j4({type:"output",verboseMessage:$,fdNumber:J,verboseInfo:Y})};var Hm=({fileDescriptors:Z,syncResult:{output:J},options:Y,isMaxBuffer:$,verboseInfo:Q})=>{if(J===null)return{output:Array.from({length:3})};let W={},X=new Set([]);return{output:J.map((G,z)=>XX1({result:G,fileDescriptors:Z,fdNumber:z,state:W,outputFiles:X,isMaxBuffer:$,verboseInfo:Q},Y)),...W}},XX1=({result:Z,fileDescriptors:J,fdNumber:Y,state:$,outputFiles:Q,isMaxBuffer:W,verboseInfo:X},{buffer:K,encoding:G,lines:z,stripFinalNewline:F,maxBuffer:H})=>{if(Z===null)return;let V=Vg(Z,W,H),q=T7(V),{stdioItems:U,objectMode:w}=J[Y],L=KX1([q],U,G,$),{serializedResult:O,finalResult:N=O}=GX1({chunks:L,objectMode:w,encoding:G,lines:z,stripFinalNewline:F,fdNumber:Y});zX1({serializedResult:O,fdNumber:Y,state:$,verboseInfo:X,encoding:G,stdioItems:U,objectMode:w});let j=K[Y]?N:void 0;try{if($.error===void 0)FX1(O,U,Q);return j}catch(R){return $.error=R,j}},KX1=(Z,J,Y,$)=>{try{return Aq(Z,J,Y,!1)}catch(Q){return $.error=Q,Z}},GX1=({chunks:Z,objectMode:J,encoding:Y,lines:$,stripFinalNewline:Q,fdNumber:W})=>{if(J)return{serializedResult:Z};if(Y==="buffer")return{serializedResult:zG(Z)};let X=Cf(Z,Y);if($[W])return{serializedResult:X,finalResult:BR(X,!Q[W],J)};return{serializedResult:X}},zX1=({serializedResult:Z,fdNumber:J,state:Y,verboseInfo:$,encoding:Q,stdioItems:W,objectMode:X})=>{if(!xq({stdioItems:W,encoding:Q,verboseInfo:$,fdNumber:J}))return;let K=BR(Z,!1,X);try{zm(K,J,$)}catch(G){Y.error??=G}},FX1=(Z,J,Y)=>{for(let{path:$,append:Q}of J.filter(({type:W})=>Eq.has(W))){let W=typeof $==="string"?$:$.toString();if(Q||Y.has(W))WX1($,Z);else Y.add(W),QX1($,Z)}};var Vm=([,Z,J],Y)=>{if(!Y.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,v7(J,Y,"all")];if(Array.isArray(J))return[v7(Z,Y,"all"),...J];if(b8(Z)&&b8(J))return TN([Z,J]);return`${Z}${J}`};import{once as RR}from"events";var qm=async(Z,J)=>{let[Y,$]=await HX1(Z);return J.isForcefullyTerminated??=!1,[Y,$]},HX1=async(Z)=>{let[J,Y]=await Promise.allSettled([RR(Z,"spawn"),RR(Z,"exit")]);if(J.status==="rejected")return[];return Y.status==="rejected"?Um(Z):Y.value},Um=async(Z)=>{try{return await RR(Z,"exit")}catch{return Um(Z)}},Lm=async(Z)=>{let[J,Y]=await Z;if(!VX1(J,Y)&&jR(J,Y))throw new P4;return[J,Y]},VX1=(Z,J)=>Z===void 0&&J===void 0,jR=(Z,J)=>Z!==0||J!==null;var wm=({error:Z,status:J,signal:Y,output:$},{maxBuffer:Q})=>{let W=qX1(Z,J,Y),X=W?.code==="ETIMEDOUT",K=Hg(W,$,Q);return{resultError:W,exitCode:J,signal:Y,timedOut:X,isMaxBuffer:K}},qX1=(Z,J,Y)=>{if(Z!==void 0)return Z;return jR(J,Y)?new P4:void 0};var Bm=(Z,J,Y)=>{let{file:$,commandArguments:Q,command:W,escapedCommand:X,startTime:K,verboseInfo:G,options:z,fileDescriptors:F}=LX1(Z,J,Y),H=OX1({file:$,commandArguments:Q,options:z,command:W,escapedCommand:X,verboseInfo:G,fileDescriptors:F,startTime:K});return eQ(H,G,z)},LX1=(Z,J,Y)=>{let{command:$,escapedCommand:Q,startTime:W,verboseInfo:X}=nV(Z,J,Y),K=wX1(Y),{file:G,commandArguments:z,options:F}=wq(Z,J,K);BX1(F);let H=ng(F,X);return{file:G,commandArguments:z,command:$,escapedCommand:Q,startTime:W,verboseInfo:X,options:F,fileDescriptors:H}},wX1=(Z)=>Z.node&&!Z.ipc?{...Z,ipc:!1}:Z,BX1=({ipc:Z,ipcInput:J,detached:Y,cancelSignal:$})=>{if(J)hq("ipcInput");if(Z)hq("ipc: true");if(Y)hq("detached: true");if($)hq("cancelSignal")},hq=(Z)=>{throw new TypeError(`The "${Z}" option cannot be used with synchronous methods.`)},OX1=({file:Z,commandArguments:J,options:Y,command:$,escapedCommand:Q,verboseInfo:W,fileDescriptors:X,startTime:K})=>{let G=MX1({file:Z,commandArguments:J,options:Y,command:$,escapedCommand:Q,fileDescriptors:X,startTime:K});if(G.failed)return G;let{resultError:z,exitCode:F,signal:H,timedOut:V,isMaxBuffer:q}=wm(G,Y),{output:U,error:w=z}=Hm({fileDescriptors:X,syncResult:G,options:Y,isMaxBuffer:q,verboseInfo:W}),L=U.map((N,j)=>v7(N,Y,j)),O=v7(Vm(U,Y),Y,"all");return RX1({error:w,exitCode:F,signal:H,timedOut:V,isMaxBuffer:q,stdio:L,all:O,options:Y,command:$,escapedCommand:Q,startTime:K})},MX1=({file:Z,commandArguments:J,options:Y,command:$,escapedCommand:Q,fileDescriptors:W,startTime:X})=>{try{Km(W,Y);let K=NX1(Y);return UX1(Z,J,K)}catch(K){return tQ({error:K,command:$,escapedCommand:Q,fileDescriptors:W,options:Y,startTime:X,isSync:!0})}},NX1=({encoding:Z,maxBuffer:J,...Y})=>({...Y,encoding:"buffer",maxBuffer:Dq(J)}),RX1=({error:Z,exitCode:J,signal:Y,timedOut:$,isMaxBuffer:Q,stdio:W,all:X,options:K,command:G,escapedCommand:z,startTime:F})=>Z===void 0?Cq({command:G,escapedCommand:z,stdio:W,all:X,ipcOutput:[],options:K,startTime:F}):wG({error:Z,command:G,escapedCommand:z,timedOut:$,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:Q,isForcefullyTerminated:!1,exitCode:J,signal:Y,stdio:W,all:X,ipcOutput:[],options:K,startTime:F,isSync:!0});import{setMaxListeners as GG1}from"events";import{spawn as zG1}from"child_process";import jm from"process";import{once as PR,on as jX1}from"events";var Om=({anyProcess:Z,channel:J,isSubprocess:Y,ipc:$},{reference:Q=!0,filter:W}={})=>{return nQ({methodName:"getOneMessage",isSubprocess:Y,ipc:$,isConnected:Fq(Z)}),PX1({anyProcess:Z,channel:J,isSubprocess:Y,filter:W,reference:Q})},PX1=async({anyProcess:Z,channel:J,isSubprocess:Y,filter:$,reference:Q})=>{Xq(J,Q);let W=IZ(Z,J,Y),X=new AbortController;try{return await Promise.race([DX1(W,$,X),CX1(W,Y,X),TX1(W,Y,X)])}catch(K){throw aQ(Z),K}finally{X.abort(),Kq(J,Q)}},DX1=async(Z,J,{signal:Y})=>{if(J===void 0){let[$]=await PR(Z,"message",{signal:Y});return $}for await(let[$]of jX1(Z,"message",{signal:Y}))if(J($))return $},CX1=async(Z,J,{signal:Y})=>{await PR(Z,"disconnect",{signal:Y}),$b(J)},TX1=async(Z,J,{signal:Y})=>{let[$]=await PR(Z,"strict:error",{signal:Y});throw $q($,J)};import{once as Nm,on as kX1}from"events";var Rm=({anyProcess:Z,channel:J,isSubprocess:Y,ipc:$},{reference:Q=!0}={})=>DR({anyProcess:Z,channel:J,isSubprocess:Y,ipc:$,shouldAwait:!Y,reference:Q}),DR=({anyProcess:Z,channel:J,isSubprocess:Y,ipc:$,shouldAwait:Q,reference:W})=>{nQ({methodName:"getEachMessage",isSubprocess:Y,ipc:$,isConnected:Fq(Z)}),Xq(J,W);let X=IZ(Z,J,Y),K=new AbortController,G={};return EX1(Z,X,K),IX1({ipcEmitter:X,isSubprocess:Y,controller:K,state:G}),vX1({anyProcess:Z,channel:J,ipcEmitter:X,isSubprocess:Y,shouldAwait:Q,controller:K,state:G,reference:W})},EX1=async(Z,J,Y)=>{try{await Nm(J,"disconnect",{signal:Y.signal}),Y.abort()}catch{}},IX1=async({ipcEmitter:Z,isSubprocess:J,controller:Y,state:$})=>{try{let[Q]=await Nm(Z,"strict:error",{signal:Y.signal});$.error=$q(Q,J),Y.abort()}catch{}},vX1=async function*({anyProcess:Z,channel:J,ipcEmitter:Y,isSubprocess:$,shouldAwait:Q,controller:W,state:X,reference:K}){try{for await(let[G]of kX1(Y,"message",{signal:W.signal}))Mm(X),yield G}catch{Mm(X)}finally{if(W.abort(),Kq(J,K),!$)aQ(Z);if(Q)await Z}},Mm=({error:Z})=>{if(Z)throw Z};var Pm=(Z,{ipc:J})=>{Object.assign(Z,Cm(Z,!1,J))},Dm=()=>{let Z=jm,J=!0,Y=jm.channel!==void 0;return{...Cm(Z,!0,Y),getCancelSignal:vb.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:!0,ipc:Y})}},Cm=(Z,J,Y)=>({sendMessage:Uq.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:Y}),getOneMessage:Om.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:Y}),getEachMessage:Rm.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:Y})});import{ChildProcess as SX1}from"child_process";import{PassThrough as _X1,Readable as AX1,Writable as xX1,Duplex as hX1}from"stream";var Tm=({error:Z,command:J,escapedCommand:Y,fileDescriptors:$,options:Q,startTime:W,verboseInfo:X})=>{UR($);let K=new SX1;fX1(K,$),Object.assign(K,{readable:yX1,writable:bX1,duplex:gX1});let G=tQ({error:Z,command:J,escapedCommand:Y,fileDescriptors:$,options:Q,startTime:W,isSync:!1}),z=mX1(G,X,Q);return{subprocess:K,promise:z}},fX1=(Z,J)=>{let Y=OG(),$=OG(),Q=OG(),W=Array.from({length:J.length-3},OG),X=OG(),K=[Y,$,Q,...W];Object.assign(Z,{stdin:Y,stdout:$,stderr:Q,all:X,stdio:K})},OG=()=>{let Z=new _X1;return Z.end(),Z},yX1=()=>new AX1({read(){}}),bX1=()=>new xX1({write(){}}),gX1=()=>new hX1({read(){},write(){}}),mX1=async(Z,J,Y)=>eQ(Z,J,Y);import{createReadStream as km,createWriteStream as Em}from"fs";import{Buffer as dX1}from"buffer";import{Readable as MG,Writable as uX1,Duplex as cX1}from"stream";var vm=(Z,J)=>Iq(lX1,Z,J,!1),NG=({type:Z,optionName:J})=>{throw new TypeError(`The \`${J}\` option cannot be ${vZ[Z]}.`)},Im={fileNumber:NG,generator:NR,asyncGenerator:NR,nodeStream:({value:Z})=>({stream:Z}),webTransform({value:{transform:Z,writableObjectMode:J,readableObjectMode:Y}}){let $=J||Y;return{stream:cX1.fromWeb(Z,{objectMode:$})}},duplex:({value:{transform:Z}})=>({stream:Z}),native(){}},lX1={input:{...Im,fileUrl:({value:Z})=>({stream:km(Z)}),filePath:({value:{file:Z}})=>({stream:km(Z)}),webStream:({value:Z})=>({stream:MG.fromWeb(Z)}),iterable:({value:Z})=>({stream:MG.from(Z)}),asyncIterable:({value:Z})=>({stream:MG.from(Z)}),string:({value:Z})=>({stream:MG.from(Z)}),uint8Array:({value:Z})=>({stream:MG.from(dX1.from(Z))})},output:{...Im,fileUrl:({value:Z})=>({stream:Em(Z)}),filePath:({value:{file:Z,append:J}})=>({stream:Em(Z,J?{flags:"a"}:{})}),webStream:({value:Z})=>({stream:uX1.fromWeb(Z)}),iterable:NG,asyncIterable:NG,string:NG,uint8Array:NG}};import{on as pX1,once as Sm}from"events";import{PassThrough as iX1,getDefaultHighWaterMark as nX1}from"stream";import{finished as xm}from"stream/promises";function NY(Z){if(!Array.isArray(Z))throw new TypeError(`Expected an array, got \`${typeof Z}\`.`);for(let Q of Z)CR(Q);let J=Z.some(({readableObjectMode:Q})=>Q),Y=aX1(Z,J),$=new hm({objectMode:J,writableHighWaterMark:Y,readableHighWaterMark:Y});for(let Q of Z)$.add(Q);return $}var aX1=(Z,J)=>{if(Z.length===0)return nX1(J);let Y=Z.filter(({readableObjectMode:$})=>$===J).map(({readableHighWaterMark:$})=>$);return Math.max(...Y)};class hm extends iX1{#Y=new Set([]);#$=new Set([]);#J=new Set([]);#Z;#Q=Symbol("unpipe");#W=new WeakMap;add(Z){if(CR(Z),this.#Y.has(Z))return;this.#Y.add(Z),this.#Z??=sX1(this,this.#Y,this.#Q);let J=tX1({passThroughStream:this,stream:Z,streams:this.#Y,ended:this.#$,aborted:this.#J,onFinished:this.#Z,unpipeEvent:this.#Q});this.#W.set(Z,J),Z.pipe(this,{end:!1})}async remove(Z){if(CR(Z),!this.#Y.has(Z))return!1;let J=this.#W.get(Z);if(J===void 0)return!1;return this.#W.delete(Z),Z.unpipe(this),await J,!0}}var sX1=async(Z,J,Y)=>{fq(Z,_m);let $=new AbortController;try{await Promise.race([oX1(Z,$),rX1(Z,J,Y,$)])}finally{$.abort(),fq(Z,-_m)}},oX1=async(Z,{signal:J})=>{try{await xm(Z,{signal:J,cleanup:!0})}catch(Y){throw fm(Z,Y),Y}},rX1=async(Z,J,Y,{signal:$})=>{for await(let[Q]of pX1(Z,"unpipe",{signal:$}))if(J.has(Q))Q.emit(Y)},CR=(Z)=>{if(typeof Z?.pipe!=="function")throw new TypeError(`Expected a readable stream, got: \`${typeof Z}\`.`)},tX1=async({passThroughStream:Z,stream:J,streams:Y,ended:$,aborted:Q,onFinished:W,unpipeEvent:X})=>{fq(Z,Am);let K=new AbortController;try{await Promise.race([eX1(W,J,K),ZK1({passThroughStream:Z,stream:J,streams:Y,ended:$,aborted:Q,controller:K}),JK1({stream:J,streams:Y,ended:$,aborted:Q,unpipeEvent:X,controller:K})])}finally{K.abort(),fq(Z,-Am)}if(Y.size>0&&Y.size===$.size+Q.size)if($.size===0&&Q.size>0)TR(Z);else YK1(Z)},eX1=async(Z,J,{signal:Y})=>{try{if(await Z,!Y.aborted)TR(J)}catch($){if(!Y.aborted)fm(J,$)}},ZK1=async({passThroughStream:Z,stream:J,streams:Y,ended:$,aborted:Q,controller:{signal:W}})=>{try{if(await xm(J,{signal:W,cleanup:!0,readable:!0,writable:!1}),Y.has(J))$.add(J)}catch(X){if(W.aborted||!Y.has(J))return;if(ym(X))Q.add(J);else bm(Z,X)}},JK1=async({stream:Z,streams:J,ended:Y,aborted:$,unpipeEvent:Q,controller:{signal:W}})=>{if(await Sm(Z,Q,{signal:W}),!Z.readable)return Sm(W,"abort",{signal:W});J.delete(Z),Y.delete(Z),$.delete(Z)},YK1=(Z)=>{if(Z.writable)Z.end()},fm=(Z,J)=>{if(ym(J))TR(Z);else bm(Z,J)},ym=(Z)=>Z?.code==="ERR_STREAM_PREMATURE_CLOSE",TR=(Z)=>{if(Z.readable||Z.writable)Z.destroy()},bm=(Z,J)=>{if(!Z.destroyed)Z.once("error",$K1),Z.destroy(J)},$K1=()=>{},fq=(Z,J)=>{let Y=Z.getMaxListeners();if(Y!==0&&Y!==Number.POSITIVE_INFINITY)Z.setMaxListeners(Y+J)},_m=2,Am=1;import{finished as gm}from"stream/promises";var JW=(Z,J)=>{Z.pipe(J),QK1(Z,J),WK1(Z,J)},QK1=async(Z,J)=>{if(c9(Z)||c9(J))return;try{await gm(Z,{cleanup:!0,readable:!0,writable:!1})}catch{}kR(J)},kR=(Z)=>{if(Z.writable)Z.end()},WK1=async(Z,J)=>{if(c9(Z)||c9(J))return;try{await gm(J,{cleanup:!0,readable:!1,writable:!0})}catch{}ER(Z)},ER=(Z)=>{if(Z.readable)Z.destroy()};var mm=(Z,J,Y)=>{let $=new Map;for(let[Q,{stdioItems:W,direction:X}]of Object.entries(J)){for(let{stream:K}of W.filter(({type:G})=>t5.has(G)))XK1(Z,K,X,Q);for(let{stream:K}of W.filter(({type:G})=>!t5.has(G)))GK1({subprocess:Z,stream:K,direction:X,fdNumber:Q,pipeGroups:$,controller:Y})}for(let[Q,W]of $.entries()){let X=W.length===1?W[0]:NY(W);JW(X,Q)}},XK1=(Z,J,Y,$)=>{if(Y==="output")JW(Z.stdio[$],J);else JW(J,Z.stdio[$]);let Q=KK1[$];if(Q!==void 0)Z[Q]=J;Z.stdio[$]=J},KK1=["stdin","stdout","stderr"],GK1=({subprocess:Z,stream:J,direction:Y,fdNumber:$,pipeGroups:Q,controller:W})=>{if(J===void 0)return;zK1(J,W);let[X,K]=Y==="output"?[J,Z.stdio[$]]:[Z.stdio[$],J],G=Q.get(X)??[];Q.set(X,[...G,K])},zK1=(Z,{signal:J})=>{if(c9(Z))wY(Z,FK1,J)},FK1=2;import{addAbortListener as qK1}from"events";var RY=[];RY.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")RY.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")RY.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var yq=(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",IR=Symbol.for("signal-exit emitter"),vR=globalThis,HK1=Object.defineProperty.bind(Object);class dm{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(vR[IR])return vR[IR];HK1(vR,IR,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(Z,J){this.listeners[Z].push(J)}removeListener(Z,J){let Y=this.listeners[Z],$=Y.indexOf(J);if($===-1)return;if($===0&&Y.length===1)Y.length=0;else Y.splice($,1)}emit(Z,J,Y){if(this.emitted[Z])return!1;this.emitted[Z]=!0;let $=!1;for(let Q of this.listeners[Z])$=Q(J,Y)===!0||$;if(Z==="exit")$=this.emit("afterExit",J,Y)||$;return $}}class _R{}var VK1=(Z)=>{return{onExit(J,Y){return Z.onExit(J,Y)},load(){return Z.load()},unload(){return Z.unload()}}};class um extends _R{onExit(){return()=>{}}load(){}unload(){}}class cm extends _R{#Y=SR.platform==="win32"?"SIGINT":"SIGHUP";#$=new dm;#J;#Z;#Q;#W={};#X=!1;constructor(Z){super();this.#J=Z,this.#W={};for(let J of RY)this.#W[J]=()=>{let Y=this.#J.listeners(J),{count:$}=this.#$,Q=Z;if(typeof Q.__signal_exit_emitter__==="object"&&typeof Q.__signal_exit_emitter__.count==="number")$+=Q.__signal_exit_emitter__.count;if(Y.length===$){this.unload();let W=this.#$.emit("exit",null,J),X=J==="SIGHUP"?this.#Y:J;if(!W)Z.kill(Z.pid,X)}};this.#Q=Z.reallyExit,this.#Z=Z.emit}onExit(Z,J){if(!yq(this.#J))return()=>{};if(this.#X===!1)this.load();let Y=J?.alwaysLast?"afterExit":"exit";return this.#$.on(Y,Z),()=>{if(this.#$.removeListener(Y,Z),this.#$.listeners.exit.length===0&&this.#$.listeners.afterExit.length===0)this.unload()}}load(){if(this.#X)return;this.#X=!0,this.#$.count+=1;for(let Z of RY)try{let J=this.#W[Z];if(J)this.#J.on(Z,J)}catch(J){}this.#J.emit=(Z,...J)=>{return this.#K(Z,...J)},this.#J.reallyExit=(Z)=>{return this.#G(Z)}}unload(){if(!this.#X)return;this.#X=!1,RY.forEach((Z)=>{let J=this.#W[Z];if(!J)throw new Error("Listener not defined for signal: "+Z);try{this.#J.removeListener(Z,J)}catch(Y){}}),this.#J.emit=this.#Z,this.#J.reallyExit=this.#Q,this.#$.count-=1}#G(Z){if(!yq(this.#J))return 0;return this.#J.exitCode=Z||0,this.#$.emit("exit",this.#J.exitCode,null),this.#Q.call(this.#J,this.#J.exitCode)}#K(Z,...J){let Y=this.#Z;if(Z==="exit"&&yq(this.#J)){if(typeof J[0]==="number")this.#J.exitCode=J[0];let $=Y.call(this.#J,Z,...J);return this.#$.emit("exit",this.#J.exitCode,null),$}else return Y.call(this.#J,Z,...J)}}var SR=globalThis.process,{onExit:lm,load:Q$6,unload:W$6}=VK1(yq(SR)?new cm(SR):new um);var pm=(Z,{cleanup:J,detached:Y},{signal:$})=>{if(!J||Y)return;let Q=lm(()=>{Z.kill()});qK1($,()=>{Q()})};var nm=({source:Z,sourcePromise:J,boundOptions:Y,createNested:$},...Q)=>{let W=iV(),{destination:X,destinationStream:K,destinationError:G,from:z,unpipeSignal:F}=UK1(Y,$,Q),{sourceStream:H,sourceError:V}=wK1(Z,z),{options:q,fileDescriptors:U}=C4.get(Z);return{sourcePromise:J,sourceStream:H,sourceOptions:q,sourceError:V,destination:X,destinationStream:K,destinationError:G,unpipeSignal:F,fileDescriptors:U,startTime:W}},UK1=(Z,J,Y)=>{try{let{destination:$,pipeOptions:{from:Q,to:W,unpipeSignal:X}={}}=LK1(Z,J,...Y),K=Wq($,W);return{destination:$,destinationStream:K,from:Q,unpipeSignal:X}}catch($){return{destinationError:$}}},LK1=(Z,J,Y,...$)=>{if(Array.isArray(Y))return{destination:J(im,Z)(Y,...$),pipeOptions:Z};if(typeof Y==="string"||Y instanceof URL||DN(Y)){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]=fV(Y,...$);return{destination:J(im)(Q,W,X),pipeOptions:X}}if(C4.has(Y)){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:Y,pipeOptions:$[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${Y}`)},im=({options:Z})=>({options:{...Z,stdin:"pipe",piped:!0}}),wK1=(Z,J)=>{try{return{sourceStream:sQ(Z,J)}}catch(Y){return{sourceError:Y}}};var sm=({sourceStream:Z,sourceError:J,destinationStream:Y,destinationError:$,fileDescriptors:Q,sourceOptions:W,startTime:X})=>{let K=BK1({sourceStream:Z,sourceError:J,destinationStream:Y,destinationError:$});if(K!==void 0)throw AR({error:K,fileDescriptors:Q,sourceOptions:W,startTime:X})},BK1=({sourceStream:Z,sourceError:J,destinationStream:Y,destinationError:$})=>{if(J!==void 0&&$!==void 0)return $;if($!==void 0)return ER(Z),$;if(J!==void 0)return kR(Y),J},AR=({error:Z,fileDescriptors:J,sourceOptions:Y,startTime:$})=>tQ({error:Z,command:am,escapedCommand:am,fileDescriptors:J,options:Y,startTime:$,isSync:!1}),am="source.pipe(destination)";var om=async(Z)=>{let[{status:J,reason:Y,value:$=Y},{status:Q,reason:W,value:X=W}]=await Z;if(!X.pipedFrom.includes($))X.pipedFrom.push($);if(Q==="rejected")throw X;if(J==="rejected")throw $;return X};import{finished as OK1}from"stream/promises";var rm=(Z,J,Y)=>{let $=bq.has(J)?NK1(Z,J):MK1(Z,J);return wY(Z,jK1,Y.signal),wY(J,PK1,Y.signal),RK1(J),$},MK1=(Z,J)=>{let Y=NY([Z]);return JW(Y,J),bq.set(J,Y),Y},NK1=(Z,J)=>{let Y=bq.get(J);return Y.add(Z),Y},RK1=async(Z)=>{try{await OK1(Z,{cleanup:!0,readable:!1,writable:!0})}catch{}bq.delete(Z)},bq=new WeakMap,jK1=2,PK1=1;import{aborted as DK1}from"util";var tm=(Z,J)=>Z===void 0?[]:[CK1(Z,J)],CK1=async(Z,{sourceStream:J,mergedStream:Y,fileDescriptors:$,sourceOptions:Q,startTime:W})=>{await DK1(Z,J),await Y.remove(J);let X=new Error("Pipe canceled by `unpipeSignal` option.");throw AR({error:X,fileDescriptors:$,sourceOptions:Q,startTime:W})};var gq=(Z,...J)=>{if(M8(J[0]))return gq.bind(void 0,{...Z,boundOptions:{...Z.boundOptions,...J[0]}});let{destination:Y,...$}=nm(Z,...J),Q=TK1({...$,destination:Y});return Q.pipe=gq.bind(void 0,{...Z,source:Y,sourcePromise:Q,boundOptions:{}}),Q},TK1=async({sourcePromise:Z,sourceStream:J,sourceOptions:Y,sourceError:$,destination:Q,destinationStream:W,destinationError:X,unpipeSignal:K,fileDescriptors:G,startTime:z})=>{let F=kK1(Z,Q);sm({sourceStream:J,sourceError:$,destinationStream:W,destinationError:X,fileDescriptors:G,sourceOptions:Y,startTime:z});let H=new AbortController;try{let V=rm(J,W,H);return await Promise.race([om(F),...tm(K,{sourceStream:J,mergedStream:V,sourceOptions:Y,fileDescriptors:G,startTime:z})])}finally{H.abort()}},kK1=(Z,J)=>Promise.allSettled([Z,J]);import{setImmediate as xK1}from"timers/promises";import{on as EK1}from"events";import{getDefaultHighWaterMark as IK1}from"stream";var mq=({subprocessStdout:Z,subprocess:J,binary:Y,shouldEncode:$,encoding:Q,preserveNewlines:W})=>{let X=new AbortController;return vK1(J,X),Zd({stream:Z,controller:X,binary:Y,shouldEncode:!Z.readableObjectMode&&$,encoding:Q,shouldSplit:!Z.readableObjectMode,preserveNewlines:W})},vK1=async(Z,J)=>{try{await Z}catch{}finally{J.abort()}},xR=({stream:Z,onStreamEnd:J,lines:Y,encoding:$,stripFinalNewline:Q,allMixed:W})=>{let X=new AbortController;SK1(J,X,Z);let K=Z.readableObjectMode&&!W;return Zd({stream:Z,controller:X,binary:$==="buffer",shouldEncode:!K,encoding:$,shouldSplit:!K&&Y,preserveNewlines:!Q})},SK1=async(Z,J,Y)=>{try{await Z}catch{Y.destroy()}finally{J.abort()}},Zd=({stream:Z,controller:J,binary:Y,shouldEncode:$,encoding:Q,shouldSplit:W,preserveNewlines:X})=>{let K=EK1(Z,"data",{signal:J.signal,highWaterMark:em,highWatermark:em});return _K1({onStdoutChunk:K,controller:J,binary:Y,shouldEncode:$,encoding:Q,shouldSplit:W,preserveNewlines:X})},hR=IK1(!0),em=hR,_K1=async function*({onStdoutChunk:Z,controller:J,binary:Y,shouldEncode:$,encoding:Q,shouldSplit:W,preserveNewlines:X}){let K=AK1({binary:Y,shouldEncode:$,encoding:Q,shouldSplit:W,preserveNewlines:X});try{for await(let[G]of Z)yield*MY(G,K,0)}catch(G){if(!J.signal.aborted)throw G}finally{yield*BG(K)}},AK1=({binary:Z,shouldEncode:J,encoding:Y,shouldSplit:$,preserveNewlines:Q})=>[Sq(Z,Y,!J),vq(Z,Q,!$,{})].filter(Boolean);var Jd=async({stream:Z,onStreamEnd:J,fdNumber:Y,encoding:$,buffer:Q,maxBuffer:W,lines:X,allMixed:K,stripFinalNewline:G,verboseInfo:z,streamInfo:F})=>{let H=hK1({stream:Z,onStreamEnd:J,fdNumber:Y,encoding:$,allMixed:K,verboseInfo:z,streamInfo:F});if(!Q){await Promise.all([fK1(Z),H]);return}let V=LR(G,Y),q=xR({stream:Z,onStreamEnd:J,lines:X,encoding:$,stripFinalNewline:V,allMixed:K}),[U]=await Promise.all([yK1({stream:Z,iterable:q,fdNumber:Y,encoding:$,maxBuffer:W,lines:X}),H]);return U},hK1=async({stream:Z,onStreamEnd:J,fdNumber:Y,encoding:$,allMixed:Q,verboseInfo:W,streamInfo:{fileDescriptors:X}})=>{if(!xq({stdioItems:X[Y]?.stdioItems,encoding:$,verboseInfo:W,fdNumber:Y}))return;let K=xR({stream:Z,onStreamEnd:J,lines:!0,encoding:$,stripFinalNewline:!0,allMixed:Q});await Gm(K,Z,Y,W)},fK1=async(Z)=>{if(await xK1(),Z.readableFlowing===null)Z.resume()},yK1=async({stream:Z,stream:{readableObjectMode:J},iterable:Y,fdNumber:$,encoding:Q,maxBuffer:W,lines:X})=>{try{if(J||X)return await Nq(Y,{maxBuffer:W});if(Q==="buffer")return new Uint8Array(await Rq(Y,{maxBuffer:W}));return await Pq(Y,{maxBuffer:W})}catch(K){return Yd(Gg({error:K,stream:Z,readableObjectMode:J,lines:X,encoding:Q,fdNumber:$}))}},fR=async(Z)=>{try{return await Z}catch(J){return Yd(J)}},Yd=({bufferedData:Z})=>Pf(Z)?new Uint8Array(Z):Z;import{finished as bK1}from"stream/promises";var RG=async(Z,J,Y,{isSameDirection:$,stopOnExit:Q=!1}={})=>{let W=gK1(Z,Y),X=new AbortController;try{await Promise.race([...Q?[Y.exitPromise]:[],bK1(Z,{cleanup:!0,signal:X.signal})])}catch(K){if(!W.stdinCleanedUp)uK1(K,J,Y,$)}finally{X.abort()}},gK1=(Z,{originalStreams:[J],subprocess:Y})=>{let $={stdinCleanedUp:!1};if(Z===J)mK1(Z,Y,$);return $},mK1=(Z,J,Y)=>{let{_destroy:$}=Z;Z._destroy=(...Q)=>{dK1(J,Y),$.call(Z,...Q)}},dK1=({exitCode:Z,signalCode:J},Y)=>{if(Z!==null||J!==null)Y.stdinCleanedUp=!0},uK1=(Z,J,Y,$)=>{if(!cK1(Z,J,Y,$))throw Z},cK1=(Z,J,Y,$=!0)=>{if(Y.propagating)return $d(Z)||dq(Z);return Y.propagating=!0,yR(Y,J)===$?$d(Z):dq(Z)},yR=({fileDescriptors:Z},J)=>J!=="all"&&Z[J].direction==="input",dq=(Z)=>Z?.code==="ERR_STREAM_PREMATURE_CLOSE",$d=(Z)=>Z?.code==="EPIPE";var Qd=({subprocess:Z,encoding:J,buffer:Y,maxBuffer:$,lines:Q,stripFinalNewline:W,verboseInfo:X,streamInfo:K})=>Z.stdio.map((G,z)=>bR({stream:G,fdNumber:z,encoding:J,buffer:Y[z],maxBuffer:$[z],lines:Q[z],allMixed:!1,stripFinalNewline:W,verboseInfo:X,streamInfo:K})),bR=async({stream:Z,fdNumber:J,encoding:Y,buffer:$,maxBuffer:Q,lines:W,allMixed:X,stripFinalNewline:K,verboseInfo:G,streamInfo:z})=>{if(!Z)return;let F=RG(Z,J,z);if(yR(z,J)){await F;return}let[H]=await Promise.all([Jd({stream:Z,onStreamEnd:F,fdNumber:J,encoding:Y,buffer:$,maxBuffer:Q,lines:W,allMixed:X,stripFinalNewline:K,verboseInfo:G,streamInfo:z}),F]);return H};var Wd=({stdout:Z,stderr:J},{all:Y})=>Y&&(Z||J)?NY([Z,J].filter(Boolean)):void 0,Xd=({subprocess:Z,encoding:J,buffer:Y,maxBuffer:$,lines:Q,stripFinalNewline:W,verboseInfo:X,streamInfo:K})=>bR({...lK1(Z,Y),fdNumber:"all",encoding:J,maxBuffer:$[1]+$[2],lines:Q[1]||Q[2],allMixed:pK1(Z),stripFinalNewline:W,verboseInfo:X,streamInfo:K}),lK1=({stdout:Z,stderr:J,all:Y},[,$,Q])=>{let W=$||Q;if(!W)return{stream:Y,buffer:W};if(!$)return{stream:J,buffer:W};if(!Q)return{stream:Z,buffer:W};return{stream:Y,buffer:W}},pK1=({all:Z,stdout:J,stderr:Y})=>Z&&J&&Y&&J.readableObjectMode!==Y.readableObjectMode;import{once as iK1}from"events";var Kd=(Z)=>lQ(Z,"ipc"),Gd=(Z,J)=>{let Y=pV(Z);j4({type:"ipc",verboseMessage:Y,fdNumber:"ipc",verboseInfo:J})};var zd=async({subprocess:Z,buffer:J,maxBuffer:Y,ipc:$,ipcOutput:Q,verboseInfo:W})=>{if(!$)return Q;let X=Kd(W),K=k7(J,"ipc"),G=k7(Y,"ipc");for await(let z of DR({anyProcess:Z,channel:Z.channel,isSubprocess:!1,ipc:$,shouldAwait:!1,reference:!0})){if(K)zg(Z,Q,G),Q.push(z);if(X)Gd(z,W)}return Q},Fd=async(Z,J)=>{return await Promise.allSettled([Z]),J};var Hd=async({subprocess:Z,options:{encoding:J,buffer:Y,maxBuffer:$,lines:Q,timeoutDuration:W,cancelSignal:X,gracefulCancel:K,forceKillAfterDelay:G,stripFinalNewline:z,ipc:F,ipcInput:H},context:V,verboseInfo:q,fileDescriptors:U,originalStreams:w,onInternalError:L,controller:O})=>{let N=qm(Z,V),j={originalStreams:w,fileDescriptors:U,subprocess:Z,exitPromise:N,propagating:!1},R=Qd({subprocess:Z,encoding:J,buffer:Y,maxBuffer:$,lines:Q,stripFinalNewline:z,verboseInfo:q,streamInfo:j}),D=Xd({subprocess:Z,encoding:J,buffer:Y,maxBuffer:$,lines:Q,stripFinalNewline:z,verboseInfo:q,streamInfo:j}),P=[],C=zd({subprocess:Z,buffer:Y,maxBuffer:$,ipc:F,ipcOutput:P,verboseInfo:q}),T=nK1(w,Z,j),I=aK1(U,j);try{return await Promise.race([Promise.all([{},Lm(N),Promise.all(R),D,C,mb(Z,H),...T,...I]),L,sK1(Z,O),...hb(Z,W,V,O),...Yb({subprocess:Z,cancelSignal:X,gracefulCancel:K,context:V,controller:O}),...Ab({subprocess:Z,cancelSignal:X,gracefulCancel:K,forceKillAfterDelay:G,context:V,controller:O})])}catch(x){return V.terminationReason??="other",Promise.all([{error:x},N,Promise.all(R.map((S)=>fR(S))),fR(D),Fd(C,P),Promise.allSettled(T),Promise.allSettled(I)])}},nK1=(Z,J,Y)=>Z.map(($,Q)=>$===J.stdio[Q]?void 0:RG($,Q,Y)),aK1=(Z,J)=>Z.flatMap(({stdioItems:Y},$)=>Y.filter(({value:Q,stream:W=Q})=>p9(W,{checkOpen:!1})&&!c9(W)).map(({type:Q,value:W,stream:X=W})=>RG(X,$,J,{isSameDirection:t5.has(Q),stopOnExit:Q==="native"}))),sK1=async(Z,{signal:J})=>{let[Y]=await iK1(Z,"error",{signal:J});throw Y};var Vd=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),jG=(Z,J,Y)=>{let $=Z[Y];if(!$.has(J))$.set(J,[]);let Q=$.get(J),W=D4();return Q.push(W),{resolve:W.resolve.bind(W),promises:Q}},YW=async({resolve:Z,promises:J},Y)=>{Z();let[$]=await Promise.race([Promise.allSettled([!0,Y]),Promise.all([!1,...J])]);return!$};import{Readable as oK1}from"stream";import{callbackify as rK1}from"util";import{finished as qd}from"stream/promises";var gR=async(Z)=>{if(Z===void 0)return;try{await mR(Z)}catch{}},Ud=async(Z)=>{if(Z===void 0)return;try{await dR(Z)}catch{}},mR=async(Z)=>{await qd(Z,{cleanup:!0,readable:!1,writable:!0})},dR=async(Z)=>{await qd(Z,{cleanup:!0,readable:!0,writable:!1})},uq=async(Z,J)=>{if(await Z,J)throw J},cq=(Z,J,Y)=>{if(Y&&!dq(Y))Z.destroy(Y);else if(J)Z.destroy()};var Ld=({subprocess:Z,concurrentStreams:J,encoding:Y},{from:$,binary:Q=!0,preserveNewlines:W=!0}={})=>{let X=Q||v5.has(Y),{subprocessStdout:K,waitReadableDestroy:G}=uR(Z,$,J),{readableEncoding:z,readableObjectMode:F,readableHighWaterMark:H}=cR(K,X),{read:V,onStdoutDataDone:q}=lR({subprocessStdout:K,subprocess:Z,binary:X,encoding:Y,preserveNewlines:W}),U=new oK1({read:V,destroy:rK1(iR.bind(void 0,{subprocessStdout:K,subprocess:Z,waitReadableDestroy:G})),highWaterMark:H,objectMode:F,encoding:z});return pR({subprocessStdout:K,onStdoutDataDone:q,readable:U,subprocess:Z}),U},uR=(Z,J,Y)=>{let $=sQ(Z,J),Q=jG(Y,$,"readableDestroy");return{subprocessStdout:$,waitReadableDestroy:Q}},cR=({readableEncoding:Z,readableObjectMode:J,readableHighWaterMark:Y},$)=>$?{readableEncoding:Z,readableObjectMode:J,readableHighWaterMark:Y}:{readableEncoding:Z,readableObjectMode:!0,readableHighWaterMark:hR},lR=({subprocessStdout:Z,subprocess:J,binary:Y,encoding:$,preserveNewlines:Q})=>{let W=D4(),X=mq({subprocessStdout:Z,subprocess:J,binary:Y,shouldEncode:!Y,encoding:$,preserveNewlines:Q});return{read(){tK1(this,X,W)},onStdoutDataDone:W}},tK1=async(Z,J,Y)=>{try{let{value:$,done:Q}=await J.next();if(Q)Y.resolve();else Z.push($)}catch{}},pR=async({subprocessStdout:Z,onStdoutDataDone:J,readable:Y,subprocess:$,subprocessStdin:Q})=>{try{if(await dR(Z),await $,await gR(Q),await J,Y.readable)Y.push(null)}catch(W){await gR(Q),wd(Y,W)}},iR=async({subprocessStdout:Z,subprocess:J,waitReadableDestroy:Y},$)=>{if(await YW(Y,J))wd(Z,$),await uq(J,$)},wd=(Z,J)=>{cq(Z,Z.readable,J)};import{Writable as eK1}from"stream";import{callbackify as Bd}from"util";var Od=({subprocess:Z,concurrentStreams:J},{to:Y}={})=>{let{subprocessStdin:$,waitWritableFinal:Q,waitWritableDestroy:W}=nR(Z,Y,J),X=new eK1({...aR($,Z,Q),destroy:Bd(oR.bind(void 0,{subprocessStdin:$,subprocess:Z,waitWritableFinal:Q,waitWritableDestroy:W})),highWaterMark:$.writableHighWaterMark,objectMode:$.writableObjectMode});return sR($,X),X},nR=(Z,J,Y)=>{let $=Wq(Z,J),Q=jG(Y,$,"writableFinal"),W=jG(Y,$,"writableDestroy");return{subprocessStdin:$,waitWritableFinal:Q,waitWritableDestroy:W}},aR=(Z,J,Y)=>({write:ZG1.bind(void 0,Z),final:Bd(JG1.bind(void 0,Z,J,Y))}),ZG1=(Z,J,Y,$)=>{if(Z.write(J,Y))$();else Z.once("drain",$)},JG1=async(Z,J,Y)=>{if(await YW(Y,J)){if(Z.writable)Z.end();await J}},sR=async(Z,J,Y)=>{try{if(await mR(Z),J.writable)J.end()}catch($){await Ud(Y),Md(J,$)}},oR=async({subprocessStdin:Z,subprocess:J,waitWritableFinal:Y,waitWritableDestroy:$},Q)=>{if(await YW(Y,J),await YW($,J))Md(Z,Q),await uq(J,Q)},Md=(Z,J)=>{cq(Z,Z.writable,J)};import{Duplex as YG1}from"stream";import{callbackify as $G1}from"util";var Nd=({subprocess:Z,concurrentStreams:J,encoding:Y},{from:$,to:Q,binary:W=!0,preserveNewlines:X=!0}={})=>{let K=W||v5.has(Y),{subprocessStdout:G,waitReadableDestroy:z}=uR(Z,$,J),{subprocessStdin:F,waitWritableFinal:H,waitWritableDestroy:V}=nR(Z,Q,J),{readableEncoding:q,readableObjectMode:U,readableHighWaterMark:w}=cR(G,K),{read:L,onStdoutDataDone:O}=lR({subprocessStdout:G,subprocess:Z,binary:K,encoding:Y,preserveNewlines:X}),N=new YG1({read:L,...aR(F,Z,H),destroy:$G1(QG1.bind(void 0,{subprocessStdout:G,subprocessStdin:F,subprocess:Z,waitReadableDestroy:z,waitWritableFinal:H,waitWritableDestroy:V})),readableHighWaterMark:w,writableHighWaterMark:F.writableHighWaterMark,readableObjectMode:U,writableObjectMode:F.writableObjectMode,encoding:q});return pR({subprocessStdout:G,onStdoutDataDone:O,readable:N,subprocess:Z,subprocessStdin:F}),sR(F,N,G),N},QG1=async({subprocessStdout:Z,subprocessStdin:J,subprocess:Y,waitReadableDestroy:$,waitWritableFinal:Q,waitWritableDestroy:W},X)=>{await Promise.all([iR({subprocessStdout:Z,subprocess:Y,waitReadableDestroy:$},X),oR({subprocessStdin:J,subprocess:Y,waitWritableFinal:Q,waitWritableDestroy:W},X)])};var rR=(Z,J,{from:Y,binary:$=!1,preserveNewlines:Q=!1}={})=>{let W=$||v5.has(J),X=sQ(Z,Y),K=mq({subprocessStdout:X,subprocess:Z,binary:W,shouldEncode:!0,encoding:J,preserveNewlines:Q});return WG1(K,X,Z)},WG1=async function*(Z,J,Y){try{yield*Z}finally{if(J.readable)J.destroy();await Y}};var Rd=(Z,{encoding:J})=>{let Y=Vd();Z.readable=Ld.bind(void 0,{subprocess:Z,concurrentStreams:Y,encoding:J}),Z.writable=Od.bind(void 0,{subprocess:Z,concurrentStreams:Y}),Z.duplex=Nd.bind(void 0,{subprocess:Z,concurrentStreams:Y,encoding:J}),Z.iterable=rR.bind(void 0,Z,J),Z[Symbol.asyncIterator]=rR.bind(void 0,Z,J,{})};var jd=(Z,J)=>{for(let[Y,$]of KG1){let Q=$.value.bind(J);Reflect.defineProperty(Z,Y,{...$,value:Q})}},XG1=(async()=>{})().constructor.prototype,KG1=["then","catch","finally"].map((Z)=>[Z,Reflect.getOwnPropertyDescriptor(XG1,Z)]);var Pd=(Z,J,Y,$)=>{let{file:Q,commandArguments:W,command:X,escapedCommand:K,startTime:G,verboseInfo:z,options:F,fileDescriptors:H}=FG1(Z,J,Y),{subprocess:V,promise:q}=VG1({file:Q,commandArguments:W,options:F,startTime:G,verboseInfo:z,command:X,escapedCommand:K,fileDescriptors:H});return V.pipe=gq.bind(void 0,{source:V,sourcePromise:q,boundOptions:{},createNested:$}),jd(V,q),C4.set(V,{options:F,fileDescriptors:H}),V},FG1=(Z,J,Y)=>{let{command:$,escapedCommand:Q,startTime:W,verboseInfo:X}=nV(Z,J,Y),{file:K,commandArguments:G,options:z}=wq(Z,J,Y),F=HG1(z),H=vm(F,X);return{file:K,commandArguments:G,command:$,escapedCommand:Q,startTime:W,verboseInfo:X,options:F,fileDescriptors:H}},HG1=({timeout:Z,signal:J,...Y})=>{if(J!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...Y,timeoutDuration:Z}},VG1=({file:Z,commandArguments:J,options:Y,startTime:$,verboseInfo:Q,command:W,escapedCommand:X,fileDescriptors:K})=>{let G;try{G=zG1(Z,J,Y)}catch(U){return Tm({error:U,command:W,escapedCommand:X,fileDescriptors:K,options:Y,startTime:$,verboseInfo:Q})}let z=new AbortController;GG1(Number.POSITIVE_INFINITY,z.signal);let F=[...G.stdio];mm(G,K,z),pm(G,Y,z);let H={},V=D4();G.kill=Zb.bind(void 0,{kill:G.kill.bind(G),options:Y,onInternalError:V,context:H,controller:z}),G.all=Wd(G,Y),Rd(G,Y),Pm(G,Y);let q=qG1({subprocess:G,options:Y,startTime:$,verboseInfo:Q,fileDescriptors:K,originalStreams:F,command:W,escapedCommand:X,context:H,onInternalError:V,controller:z});return{subprocess:G,promise:q}},qG1=async({subprocess:Z,options:J,startTime:Y,verboseInfo:$,fileDescriptors:Q,originalStreams:W,command:X,escapedCommand:K,context:G,onInternalError:z,controller:F})=>{let[H,[V,q],U,w,L]=await Hd({subprocess:Z,options:J,context:G,verboseInfo:$,fileDescriptors:Q,originalStreams:W,onInternalError:z,controller:F});F.abort(),z.resolve();let O=U.map((R,D)=>v7(R,J,D)),N=v7(w,J,"all"),j=UG1({errorInfo:H,exitCode:V,signal:q,stdio:O,all:N,ipcOutput:L,context:G,options:J,command:X,escapedCommand:K,startTime:Y});return eQ(j,$,J)},UG1=({errorInfo:Z,exitCode:J,signal:Y,stdio:$,all:Q,ipcOutput:W,context:X,options:K,command:G,escapedCommand:z,startTime:F})=>("error"in Z)?wG({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 E7,isForcefullyTerminated:X.isForcefullyTerminated,exitCode:J,signal:Y,stdio:$,all:Q,ipcOutput:W,options:K,startTime:F,isSync:!1}):Cq({command:G,escapedCommand:z,stdio:$,all:Q,ipcOutput:W,options:K,startTime:F});var lq=(Z,J)=>{let Y=Object.fromEntries(Object.entries(J).map(([$,Q])=>[$,LG1($,Z[$],Q)]));return{...Z,...Y}},LG1=(Z,J,Y)=>{if(wG1.has(Z)&&M8(J)&&M8(Y))return{...J,...Y};return Y},wG1=new Set(["env",...vN]);var SZ=(Z,J,Y,$)=>{let Q=(X,K,G)=>SZ(X,K,Y,G),W=(...X)=>BG1({mapArguments:Z,deepOptions:Y,boundOptions:J,setBoundExeca:$,createNested:Q},...X);if($!==void 0)$(W,Q,J);return W},BG1=({mapArguments:Z,deepOptions:J={},boundOptions:Y={},setBoundExeca:$,createNested:Q},W,...X)=>{if(M8(W))return Q(Z,lq(Y,W),$);let{file:K,commandArguments:G,options:z,isSync:F}=OG1({mapArguments:Z,firstArgument:W,nextArguments:X,deepOptions:J,boundOptions:Y});return F?Bm(K,G,z):Pd(K,G,z,Q)},OG1=({mapArguments:Z,firstArgument:J,nextArguments:Y,deepOptions:$,boundOptions:Q})=>{let W=If(J)?vf(J,Y):[J,...Y],[X,K,G]=fV(...W),z=lq(lq($,Q),G),{file:F=X,commandArguments:H=K,options:V=z,isSync:q=!1}=Z({file:X,commandArguments:K,options:z});return{file:F,commandArguments:H,options:V,isSync:q}};var Dd=({file:Z,commandArguments:J})=>Td(Z,J),Cd=({file:Z,commandArguments:J})=>({...Td(Z,J),isSync:!0}),Td=(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,...$]=MG1(Z);return{file:Y,commandArguments:$}},MG1=(Z)=>{if(typeof Z!=="string")throw new TypeError(`The command must be a string: ${String(Z)}.`);let J=Z.trim();if(J==="")return[];let Y=[];for(let $ of J.split(NG1)){let Q=Y.at(-1);if(Q&&Q.endsWith("\\"))Y[Y.length-1]=`${Q.slice(0,-1)} ${$}`;else Y.push($)}return Y},NG1=/ +/g;var kd=(Z,J,Y)=>{Z.sync=J(RG1,Y),Z.s=Z.sync},Ed=({options:Z})=>Id(Z),RG1=({options:Z})=>({...Id(Z),isSync:!0}),Id=(Z)=>({options:{...jG1(Z),...Z}}),jG1=({input:Z,inputFile:J,stdio:Y})=>Z===void 0&&J===void 0&&Y===void 0?{stdin:"inherit"}:{},vd={preferLocal:!0};var Sd=SZ(()=>({})),nW6=SZ(()=>({isSync:!0})),aW6=SZ(Dd),sW6=SZ(Cd),oW6=SZ(yb),rW6=SZ(Ed,{},vd,kd),{sendMessage:tW6,getOneMessage:eW6,getEachMessage:ZX6,getCancelSignal:JX6}=Dm();var{Glob:mL1}=globalThis.Bun;class tR{constructor(){this._listeners={}}addEventListener(Z,J){let Y=this._listeners;if(Y[Z]===void 0)Y[Z]=[];if(Y[Z].indexOf(J)===-1)Y[Z].push(J);return this}removeEventListener(Z,J){let $=this._listeners[Z];if($!==void 0){let Q=$.indexOf(J);if(Q!==-1)$.splice(Q,1)}return this}dispatchEvent(Z){let Y=this._listeners[Z.type];if(Y!==void 0){let $=Y.slice(0);for(let Q=0,W=$.length;Q<W;Q++)$[Q].call(this,Z)}return this}dispose(){for(let Z in this._listeners)delete this._listeners[Z]}}class W5{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=Y,this._attributes=$,!J.isOnGraph(Y))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 $W extends tR{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 Y of this.listParentEdges(Z))J.add(Y.getParent());return Array.from(J)}listChildEdges(Z){return Array.from(this._parentEdges.get(Z)||this._emptySet)}listChildren(Z){let J=new Set;for(let Y of this.listChildEdges(Z))J.add(Y.getChild());return Array.from(J)}disconnectParents(Z,J){for(let Y of this.listParentEdges(Z))if(!J||J(Y.getParent()))Y.dispose();return this}_createEdge(Z,J,Y,$){let Q=new W5(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 PG(){return PG=Object.assign||function(Z){for(var J=1;J<arguments.length;J++){var Y=arguments[J];for(var $ in Y)if(Object.prototype.hasOwnProperty.call(Y,$))Z[$]=Y[$]}return Z},PG.apply(this,arguments)}class U6{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 Y of this.list)if(Y.getChild()===Z)J.push(Y);for(let Y of J)this.remove(Y);return J}listRefsByChild(Z){let J=[];for(let Y of this.list)if(Y.getChild()===Z)J.push(Y);return J}values(){return this.list}}class j0{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 t1{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"),i9=Symbol("immutableKeys");class QW extends tR{constructor(Z){super();this._disposed=!1,this.graph=void 0,this[A0]=void 0,this[i9]=void 0,this.graph=Z,this[i9]=new Set,this[A0]=this._createAttributes()}getDefaults(){return{}}_createAttributes(){let Z=this.getDefaults(),J={};for(let Y in Z){let $=Z[Y];if($ instanceof QW){let Q=this.graph._createEdge(Y,this,$);this[i9].add(Y),J[Y]=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 Y in this[A0]){let $=this[A0][Y];if($ instanceof W5){let Q=$;if(Q.getChild()===Z)this.setRef(Y,J,Q.getAttributes())}else if($ instanceof U6)for(let Q of $.listRefsByChild(Z)){let W=Q.getAttributes();this.removeRef(Y,Z),this.addRef(Y,J,W)}else if($ instanceof j0){let Q=$.getRefByChild(Z);if(Q){let W=Q.getAttributes();this.removeRef(Y,Z),this.addRef(Y,J,W)}}else if($ instanceof t1)for(let Q of $.keys()){let W=$.get(Q);if(W.getChild()===Z)this.setRefMap(Y,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,Y){if(this[i9].has(Z))throw new Error(`Cannot overwrite immutable attribute, "${Z}".`);let $=this[A0][Z];if($)$.dispose();if(!J)return this;let Q=this.graph._createEdge(Z,this,J,Y);return this[A0][Z]=Q,this.dispatchEvent({type:"change",attribute:Z})}listRefs(Z){return this.assertRefList(Z).values().map((Y)=>Y.getChild())}addRef(Z,J,Y){let $=this.graph._createEdge(Z,this,J,Y);return this.assertRefList(Z).add($),this.dispatchEvent({type:"change",attribute:Z})}removeRef(Z,J){let Y=this.assertRefList(Z);if(Y instanceof U6)for(let $ of Y.listRefsByChild(J))$.dispose();else{let $=Y.getRefByChild(J);if($)$.dispose()}return this}assertRefList(Z){let J=this[A0][Z];if(J instanceof U6||J instanceof j0)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 $=this.assertRefMap(Z).get(J);return $?$.getChild():null}setRefMap(Z,J,Y,$){let Q=this.assertRefMap(Z),W=Q.get(J);if(W)W.dispose();if(!Y)return this;$=Object.assign($||{},{key:J});let X=this.graph._createEdge(Z,this,Y,PG({},$,{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 t1)return J;throw new Error(`Expected RefMap for attribute "${Z}"`)}dispatchEvent(Z){return super.dispatchEvent(PG({},Z,{target:this})),this.graph.dispatchEvent(PG({},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[i9].has(J))Z.getChild().dispose()}else if(this[A0][J]instanceof U6)this[A0][J].remove(Z);else if(this[A0][J]instanceof j0)this[A0][J].remove(Z);else if(this[A0][J]instanceof t1){let Y=this[A0][J];for(let $ of Y.keys())if(Y.get($)===Z)Y.delete($)}else return;this.graph._destroyEdge(Z),this.dispatchEvent({type:"change",attribute:J})}}var bd="v4.1.1",oq="@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 rq;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(rq||(rq={}));var S5;(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"})(S5||(S5={}));var tq;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(tq||(tq={}));var S7;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(S7||(S7={}));var xZ={"5120":Int8Array,"5121":Uint8Array,"5122":Int16Array,"5123":Uint16Array,"5125":Uint32Array,"5126":Float32Array},Zj=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 PG1(){var Z=new Zj(3);if(Zj!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function eR(Z){var J=Z[0],Y=Z[1],$=Z[2];return Math.hypot(J,Y,$)}function DG1(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=Y[3]*$+Y[7]*Q+Y[11]*W+Y[15];return X=X||1,Z[0]=(Y[0]*$+Y[4]*Q+Y[8]*W+Y[12])/X,Z[1]=(Y[1]*$+Y[5]*Q+Y[9]*W+Y[13])/X,Z[2]=(Y[2]*$+Y[6]*Q+Y[10]*W+Y[14])/X,Z}(function(){var Z=PG1();return function(J,Y,$,Q,W,X){var K,G;if(!Y)Y=3;if(!$)$=0;if(Q)G=Math.min(Q*Y+$,J.length);else G=J.length;for(K=$;K<G;K+=Y)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 Qj(Z){let J=gd(),Y=Z.propertyType===a.NODE?[Z]:Z.listChildren();for(let $ of Y)$.traverse((Q)=>{let W=Q.getMesh();if(!W)return;let X=CG1(W,Q.getWorldMatrix());if(X.min.every(isFinite)&&X.max.every(isFinite))Jj(X.min,J),Jj(X.max,J)});return J}function CG1(Z,J){let Y=gd();for(let $ of Z.listPrimitives()){let Q=$.getAttribute("POSITION"),W=$.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 F=W?W.getScalar(G):G;X=Q.getElement(F,X),K=DG1(K,X,J),Jj(K,Y)}}return Y}function Jj(Z,J){for(let Y=0;Y<3;Y++)J.min[Y]=Math.min(Z[Y],J.min[Y]),J.max[Y]=Math.max(Z[Y],J.max[Y])}function gd(){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]),Y=new Uint8Array(J.length);for(let $=0;$<J.length;$++)Y[$]=J.charCodeAt($);return Y}else{let J=Z.split(",")[1],Y=Z.indexOf("base64")>=0;return Buffer.from(J,Y?"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 Y=new Uint8Array(J),$=0;for(let Q of Z)Y.set(Q,$),$+=Q.byteLength;return Y}static pad(Z,J=0){let Y=this.padNumber(Z.byteLength);if(Y===Z.byteLength)return Z;let $=new Uint8Array(Y);if($.set(Z),J!==0)for(let Q=Z.byteLength;Q<Y;Q++)$[Q]=J;return $}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 Y=Z.byteLength;while(Y--)if(Z[Y]!==J[Y])return!1;return!0}static toView(Z,J=0,Y=1/0){return new Uint8Array(Z.buffer,Z.byteOffset+J,Math.min(Z.byteLength,Y))}static assertView(Z){if(Z&&!ArrayBuffer.isView(Z))throw new Error(`Method requires Uint8Array parameter; received "${typeof Z}".`);return Z}}class Wj{static hexToFactor(Z,J){Z=Math.floor(Z);let Y=J;return Y[0]=(Z>>16&255)/255,Y[1]=(Z>>8&255)/255,Y[2]=(Z&255)/255,this.convertSRGBToLinear(J,J)}static factorToHex(Z){let J=[...Z],[Y,$,Q]=this.convertLinearToSRGB(Z,J);return Y*255<<16^$*255<<8^Q*255<<0}static convertSRGBToLinear(Z,J){let Y=Z,$=J;for(let Q=0;Q<3;Q++)$[Q]=Y[Q]<0.04045?Y[Q]*0.0773993808:Math.pow(Y[Q]*0.9478672986+0.0521327014,2.4);return J}static convertLinearToSRGB(Z,J){let Y=Z,$=J;for(let Q=0;Q<3;Q++)$[Q]=Y[Q]<0.0031308?Y[Q]*12.92:1.055*Math.pow(Y[Q],0.41666)-0.055;return J}}class md{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(Y=J.getUint16(0,!1),TG1(J,Y),$=J.getUint8(Y+1),$===192||$===193||$===194)return[J.getUint16(Y+7,!1),J.getUint16(Y+5,!1)];J=new DataView(Z.buffer,J.byteOffset+Y+2)}throw new TypeError("Invalid JPG, no size found")}getChannels(Z){return 3}}class JU{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))===JU.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}}JU.PNG_FRIED_CHUNK_NAME="CgBI";class _7{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 Y=0,$=4,Q=this.getSize(Z,J);if(!Q)return null;while(Q[0]>1||Q[1]>1)Y+=Q[0]*Q[1]*$,Q[0]=Math.max(Math.floor(Q[0]/2),1),Q[1]=Math.max(Math.floor(Q[1]/2),1);return Y+=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}`}}_7.impls={"image/jpeg":new md,"image/png":new JU};function TG1(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 A7{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 _7.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 _d(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function jY(Z){if(_d(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let Y=J.prototype;if(_d(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}var Yj,DG;(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"})(DG||(DG={}));class K5{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=K5.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=K5.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=K5.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=K5.Verbosity.ERROR)console.error(Z)}}Yj=K5;K5.Verbosity=DG;K5.DEFAULT_INSTANCE=new Yj(Yj.Verbosity.INFO);function kG1(Z){var J=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],F=Z[9],H=Z[10],V=Z[11],q=Z[12],U=Z[13],w=Z[14],L=Z[15],O=J*X-Y*W,N=J*K-$*W,j=J*G-Q*W,R=Y*K-$*X,D=Y*G-Q*X,P=$*G-Q*K,C=z*U-F*q,T=z*w-H*q,I=z*L-V*q,x=F*w-H*U,S=F*L-V*U,A=H*L-V*w;return O*A-N*S+j*x+R*I-D*T+P*C}function EG1(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],H=J[8],V=J[9],q=J[10],U=J[11],w=J[12],L=J[13],O=J[14],N=J[15],j=Y[0],R=Y[1],D=Y[2],P=Y[3];return Z[0]=j*$+R*K+D*H+P*w,Z[1]=j*Q+R*G+D*V+P*L,Z[2]=j*W+R*z+D*q+P*O,Z[3]=j*X+R*F+D*U+P*N,j=Y[4],R=Y[5],D=Y[6],P=Y[7],Z[4]=j*$+R*K+D*H+P*w,Z[5]=j*Q+R*G+D*V+P*L,Z[6]=j*W+R*z+D*q+P*O,Z[7]=j*X+R*F+D*U+P*N,j=Y[8],R=Y[9],D=Y[10],P=Y[11],Z[8]=j*$+R*K+D*H+P*w,Z[9]=j*Q+R*G+D*V+P*L,Z[10]=j*W+R*z+D*q+P*O,Z[11]=j*X+R*F+D*U+P*N,j=Y[12],R=Y[13],D=Y[14],P=Y[15],Z[12]=j*$+R*K+D*H+P*w,Z[13]=j*Q+R*G+D*V+P*L,Z[14]=j*W+R*z+D*q+P*O,Z[15]=j*X+R*F+D*U+P*N,Z}function IG1(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[4],X=J[5],K=J[6],G=J[8],z=J[9],F=J[10];return Z[0]=Math.hypot(Y,$,Q),Z[1]=Math.hypot(W,X,K),Z[2]=Math.hypot(G,z,F),Z}function vG1(Z,J){var Y=new Zj(3);IG1(Y,J);var $=1/Y[0],Q=1/Y[1],W=1/Y[2],X=J[0]*$,K=J[1]*Q,G=J[2]*W,z=J[4]*$,F=J[5]*Q,H=J[6]*W,V=J[8]*$,q=J[9]*Q,U=J[10]*W,w=X+F+U,L=0;if(w>0)L=Math.sqrt(w+1)*2,Z[3]=0.25*L,Z[0]=(H-q)/L,Z[1]=(V-G)/L,Z[2]=(K-z)/L;else if(X>F&&X>U)L=Math.sqrt(1+X-F-U)*2,Z[3]=(H-q)/L,Z[0]=0.25*L,Z[1]=(K+z)/L,Z[2]=(V+G)/L;else if(F>U)L=Math.sqrt(1+F-X-U)*2,Z[3]=(V-G)/L,Z[0]=(K+z)/L,Z[1]=0.25*L,Z[2]=(H+q)/L;else L=Math.sqrt(1+U-X-F)*2,Z[3]=(K-z)/L,Z[0]=(V+G)/L,Z[1]=(H+q)/L,Z[2]=0.25*L;return Z}class u0{static identity(Z){return Z}static eq(Z,J,Y=0.00001){if(Z.length!==J.length)return!1;for(let $=0;$<Z.length;$++)if(Math.abs(Z[$]-J[$])>Y)return!1;return!0}static clamp(Z,J,Y){if(Z<J)return J;if(Z>Y)return Y;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(u0.clamp(Z,0,1)*65535);case 5121:return Math.round(u0.clamp(Z,0,1)*255);case 5122:return Math.round(u0.clamp(Z,-1,1)*32767);case 5120:return Math.round(u0.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,Y,$){let Q=eR([Z[0],Z[1],Z[2]]),W=eR([Z[4],Z[5],Z[6]]),X=eR([Z[8],Z[9],Z[10]]);if(kG1(Z)<0)Q=-Q;J[0]=Z[12],J[1]=Z[13],J[2]=Z[14];let G=Z.slice(),z=1/Q,F=1/W,H=1/X;G[0]*=z,G[1]*=z,G[2]*=z,G[4]*=F,G[5]*=F,G[6]*=F,G[8]*=H,G[9]*=H,G[10]*=H,vG1(Y,G),$[0]=Q,$[1]=W,$[2]=X}static compose(Z,J,Y,$){let Q=$,W=J[0],X=J[1],K=J[2],G=J[3],z=W+W,F=X+X,H=K+K,V=W*z,q=W*F,U=W*H,w=X*F,L=X*H,O=K*H,N=G*z,j=G*F,R=G*H,D=Y[0],P=Y[1],C=Y[2];return Q[0]=(1-(w+O))*D,Q[1]=(q+R)*D,Q[2]=(U-j)*D,Q[3]=0,Q[4]=(q-R)*P,Q[5]=(1-(V+O))*P,Q[6]=(L+N)*P,Q[7]=0,Q[8]=(U+j)*C,Q[9]=(L-N)*C,Q[10]=(1-(V+w))*C,Q[11]=0,Q[12]=Z[0],Q[13]=Z[1],Q[14]=Z[2],Q[15]=1,Q}}function SG1(Z,J){if(!!Z!==!!J)return!1;let Y=Z.getChild(),$=J.getChild();return Y===$||Y.equals($)}function _G1(Z,J){if(!!Z!==!!J)return!1;let Y=Z.values(),$=J.values();if(Y.length!==$.length)return!1;for(let Q=0;Q<Y.length;Q++){let W=Y[Q],X=$[Q];if(W.getChild()===X.getChild())continue;if(!W.getChild().equals(X.getChild()))return!1}return!0}function AG1(Z,J){if(!!Z!==!!J)return!1;let Y=Z.keys(),$=J.keys();if(Y.length!==$.length)return!1;for(let Q of Y){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 dd(Z,J){if(Z===J)return!0;if(!!Z!==!!J||!Z||!J)return!1;if(Z.length!==J.length)return!1;for(let Y=0;Y<Z.length;Y++)if(Z[Y]!==J[Y])return!1;return!0}function ud(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!jY(Z)||!jY(J))return Z===J;let Y=Z,$=J,Q=0,W=0,X;for(X in Y)Q++;for(X in $)W++;if(Q!==W)return!1;for(X in Y){let K=Y[X],G=$[X];if(eq(K)&&eq(G)){if(!dd(K,G))return!1}else if(jY(K)&&jY(G)){if(!ud(K,G))return!1}else if(K!==G)return!1}return!0}function eq(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var Ad="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ",xG1=999,hG1=6,xd=new Set,fG1=function Z(){let J="";for(let Y=0;Y<hG1;Y++)J+=Ad.charAt(Math.floor(Math.random()*Ad.length));return J},cd=function Z(){for(let J=0;J<xG1;J++){let Y=fG1();if(!xd.has(Y))return xd.add(Y),Y}return""},hd="https://null.example";class e5{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return A7.basename(new URL(Z,hd).pathname)}static extension(Z){return A7.extension(new URL(Z,hd).pathname)}static resolve(Z,J){if(!this.isRelativePath(J))return J;let Y=Z.split("/"),$=J.split("/");Y.pop();for(let Q=0;Q<$.length;Q++){if($[Q]===".")continue;if($[Q]==="..")Y.pop();else Y.push($[Q])}return Y.join("/")}static isAbsoluteURL(Z){return this.PROTOCOL_REGEXP.test(Z)}static isRelativePath(Z){return!/^(?:[a-zA-Z]+:)?\//.test(Z)}}e5.DEFAULT_INIT={};e5.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var AZ=(Z)=>Z,yG1=new Set;class YU extends QW{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,AZ)}copy(Z,J=AZ){for(let Y in this[A0]){let $=this[A0][Y];if($ instanceof W5){if(!this[i9].has(Y))$.dispose()}else if($ instanceof U6||$ instanceof j0)for(let Q of $.values())Q.dispose();else if($ instanceof t1)for(let Q of $.values())Q.dispose()}for(let Y in Z[A0]){let $=this[A0][Y],Q=Z[A0][Y];if(Q instanceof W5)if(this[i9].has(Y))$.getChild().copy(J(Q.getChild()),J);else this.setRef(Y,J(Q.getChild()),Q.getAttributes());else if(Q instanceof j0||Q instanceof U6)for(let W of Q.values())this.addRef(Y,J(W.getChild()),W.getAttributes());else if(Q instanceof t1)for(let W of Q.keys()){let X=Q.get(W);this.setRefMap(Y,W,J(X.getChild()),X.getAttributes())}else if(jY(Q))this[A0][Y]=JSON.parse(JSON.stringify(Q));else if(Array.isArray(Q)||Q instanceof ArrayBuffer||ArrayBuffer.isView(Q))this[A0][Y]=Q.slice();else this[A0][Y]=Q}return this}equals(Z,J=yG1){if(this===Z)return!0;if(this.propertyType!==Z.propertyType)return!1;for(let Y in this[A0]){if(J.has(Y))continue;let $=this[A0][Y],Q=Z[A0][Y];if($ instanceof W5||Q instanceof W5){if(!SG1($,Q))return!1}else if($ instanceof j0||Q instanceof j0||$ instanceof U6||Q instanceof U6){if(!_G1($,Q))return!1}else if($ instanceof t1||Q instanceof t1){if(!AG1($,Q))return!1}else if(jY($)||jY(Q)){if(!ud($,Q))return!1}else if(eq($)||eq(Q)){if(!dd($,Q))return!1}else if($!==Q)return!1}return!0}detach(){return this.graph.disconnectParents(this,(Z)=>Z.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}}class w6 extends YU{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new t1})}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 w6{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(),Y=this.getElementSize(),$=this.getComponentType();if(this.getMin(Z),J)for(let Q=0;Q<Y;Q++)Z[Q]=u0.decodeNormalizedInt(Z[Q],$);return Z}getMin(Z){let J=this.getArray(),Y=this.getCount(),$=this.getElementSize();for(let Q=0;Q<$;Q++)Z[Q]=1/0;for(let Q=0;Q<Y*$;Q+=$)for(let W=0;W<$;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(),Y=this.getElementSize(),$=this.getComponentType();if(this.getMax(Z),J)for(let Q=0;Q<Y;Q++)Z[Q]=u0.decodeNormalizedInt(Z[Q],$);return Z}getMax(Z){let J=this.get("array"),Y=this.getCount(),$=this.getElementSize();for(let Q=0;Q<$;Q++)Z[Q]=-1/0;for(let Q=0;Q<Y*$;Q+=$)for(let W=0;W<$;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(),Y=this.getComponentType(),$=this.getArray();if(this.getNormalized())return u0.decodeNormalizedInt($[Z*J],Y);return $[Z*J]}setScalar(Z,J){let Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();if(this.getNormalized())Q[Z*Y]=u0.encodeNormalizedInt(J,$);else Q[Z*Y]=J;return this}getElement(Z,J){let Y=this.getNormalized(),$=this.getElementSize(),Q=this.getComponentType(),W=this.getArray();for(let X=0;X<$;X++)if(Y)J[X]=u0.decodeNormalizedInt(W[Z*$+X],Q);else J[X]=W[Z*$+X];return J}setElement(Z,J){let Y=this.getNormalized(),$=this.getElementSize(),Q=this.getComponentType(),W=this.getArray();for(let X=0;X<$;X++)if(Y)W[Z*$+X]=u0.encodeNormalizedInt(J[X],Q);else W[Z*$+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?bG1(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 bG1(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 Xj extends w6{init(){this.propertyType=a.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new j0,samplers:new j0})}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 PY extends w6{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)}}PY.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class WW extends w6{init(){this.propertyType=a.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:WW.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:S5.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:S5.OTHER})}}WW.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class Kj extends w6{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 DY extends w6{init(){this.propertyType=a.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:DY.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)}}DY.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class XW extends YU{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}XW.EXTENSION_NAME=void 0;class X5 extends w6{init(){this.propertyType=a.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:X5.WrapMode.REPEAT,wrapT:X5.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)}}X5.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};X5.MagFilter={NEAREST:9728,LINEAR:9729};X5.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:pq,G:iq,B:nq,A:gG1}=tq;class k4 extends w6{init(){this.propertyType=a.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:k4.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new X5(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new X5(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new X5(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new X5(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new X5(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:pq|iq|nq|gG1,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:pq|iq|nq,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:pq|iq|nq})}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:pq})}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:iq|nq})}}k4.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class TG extends w6{init(){this.propertyType=a.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new j0})}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 $U extends w6{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 j0})}copy(Z,J=AZ){if(J===AZ)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 u0.compose(this.get("translation"),this.get("rotation"),this.get("scale"),[])}setMatrix(Z){let J=this.get("translation").slice(),Y=this.get("rotation").slice(),$=this.get("scale").slice();return u0.decompose(Z,J,Y,$),this.set("translation",J).set("rotation",Y).set("scale",$)}getWorldTranslation(){let Z=[0,0,0];return u0.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return u0.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return u0.decompose(this.getWorldMatrix(),[0,0,0],[0,0,0,1],Z),Z}getWorldMatrix(){let Z=[];for(let $=this;$!=null;$=$.getParentNode())Z.push($);let J,Y=Z.pop().getMatrix();while(J=Z.pop())EG1(Y,Y,J.getMatrix());return Y}addChild(Z){let J=Z.getParentNode();if(J)J.removeChild(Z);for(let Y of Z.listParents())if(Y.propertyType===a.SCENE)Y.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 N8 extends w6{init(){this.propertyType=a.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:N8.Mode.TRIANGLES,material:null,indices:null,attributes:new t1,targets:new j0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:S5.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:S5.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)}}N8.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class Gj extends YU{init(){this.propertyType=a.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new t1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:S5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function _6(){return _6=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var Y=arguments[J];for(var $ in Y)({}).hasOwnProperty.call(Y,$)&&(Z[$]=Y[$])}return Z},_6.apply(null,arguments)}class KW extends w6{init(){this.propertyType=a.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new j0})}copy(Z,J=AZ){if(J===AZ)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 zj extends w6{init(){this.propertyType=a.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new j0})}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:S5.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class CY extends w6{init(){this.propertyType=a.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||_7.extensionToMimeType(A7.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=_7.extensionToMimeType(A7.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 _7.getSize(Z,this.getMimeType())}}class TY extends w6{init(){this.propertyType=a.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${bd}`,version:"2.0"},defaultScene:null,accessors:new j0,animations:new j0,buffers:new j0,cameras:new j0,materials:new j0,meshes:new j0,nodes:new j0,scenes:new j0,skins:new j0,textures:new j0})}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=AZ){if(J===AZ)throw new Error("Root cannot be copied.");this.set("asset",_6({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(_6({},Z.getExtras())),this.setDefaultScene(Z.getDefaultScene()?J(Z.getDefaultScene()):null);for(let Y of Z.listRefMapKeys("extensions")){let $=Z.getExtension(Y);this.setExtension(Y,J($))}return this}_addChildOfRoot(Z){if(Z instanceof KW)this.addRef("scenes",Z);else if(Z instanceof $U)this.addRef("nodes",Z);else if(Z instanceof DY)this.addRef("cameras",Z);else if(Z instanceof zj)this.addRef("skins",Z);else if(Z instanceof TG)this.addRef("meshes",Z);else if(Z instanceof k4)this.addRef("materials",Z);else if(Z instanceof CY)this.addRef("textures",Z);else if(Z instanceof Xj)this.addRef("animations",Z);else if(Z instanceof I0)this.addRef("accessors",Z);else if(Z instanceof Kj)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 L6{static fromGraph(Z){return L6._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new $W,this._root=new TY(this._graph),this._logger=K5.DEFAULT_INSTANCE,L6._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((Y)=>Y.name);for(let Y of Z)await Y(this,{stack:J});return this}createExtension(Z){let J=Z.EXTENSION_NAME;return this.getRoot().listExtensionsUsed().find(($)=>$.extensionName===J)||new Z(this)}createScene(Z=""){return new KW(this._graph,Z)}createNode(Z=""){return new $U(this._graph,Z)}createCamera(Z=""){return new DY(this._graph,Z)}createSkin(Z=""){return new zj(this._graph,Z)}createMesh(Z=""){return new TG(this._graph,Z)}createPrimitive(){return new N8(this._graph)}createPrimitiveTarget(Z=""){return new Gj(this._graph,Z)}createMaterial(Z=""){return new k4(this._graph,Z)}createTexture(Z=""){return new CY(this._graph,Z)}createAnimation(Z=""){return new Xj(this._graph,Z)}createAnimationChannel(Z=""){return new PY(this._graph,Z)}createAnimationSampler(Z=""){return new WW(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 Kj(this._graph,Z)}}L6._GRAPH_DOCUMENTS=new WeakMap;class ld{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=(Y)=>{let $=Y,Q=$.target;if(Q instanceof XW&&Q.extensionName===this.extensionName){if($.type==="node:create")this._addExtensionProperty(Q);if($.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}}ld.EXTENSION_NAME=void 0;class pd{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 Y=this.jsonDoc.json.textures[J.index];if(Y.sampler===void 0)return;let $=this.jsonDoc.json.samplers[Y.sampler];if($.magFilter!==void 0)Z.setMagFilter($.magFilter);if($.minFilter!==void 0)Z.setMinFilter($.minFilter);if($.wrapS!==void 0)Z.setWrapS($.wrapS);if($.wrapT!==void 0)Z.setWrapT($.wrapT)}}var fd={logger:K5.DEFAULT_INSTANCE,extensions:[],dependencies:{}},mG1=new Set([a.BUFFER,a.TEXTURE,a.MATERIAL,a.MESH,a.PRIMITIVE,a.NODE,a.SCENE]);class id{static read(Z,J=fd){let Y=_6({},fd,J),{json:$}=Z,Q=new L6().setLogger(Y.logger);this.validate(Z,Y);let W=new pd(Z),X=$.asset,K=Q.getRoot().getAsset();if(X.copyright)K.copyright=X.copyright;if(X.extras)K.extras=X.extras;if($.extras!==void 0)Q.getRoot().setExtras(_6({},$.extras));let G=$.extensionsUsed||[],z=$.extensionsRequired||[];Y.extensions.sort((P,C)=>P.EXTENSION_NAME>C.EXTENSION_NAME?1:-1);for(let P of Y.extensions)if(G.includes(P.EXTENSION_NAME)){let C=Q.createExtension(P).setRequired(z.includes(P.EXTENSION_NAME)),T=C.prereadTypes.filter((I)=>!mG1.has(I));if(T.length)Y.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 I of C.readDependencies)C.install(I,Y.dependencies[I])}let F=$.buffers||[];Q.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.BUFFER)).forEach((P)=>P.preread(W,a.BUFFER)),W.buffers=F.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 H=$.bufferViews||[];W.bufferViewBuffers=H.map((P,C)=>{if(!W.bufferViews[C]){let T=Z.json.buffers[P.buffer],I=T.uri?Z.resources[T.uri]:Z.resources[oq],x=P.byteOffset||0;W.bufferViews[C]=n0.toView(I,x,P.byteLength)}return W.buffers[P.buffer]});let V=$.accessors||[];W.accessors=V.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(sq(P,W)),T});let q=$.images||[],U=$.textures||[];Q.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.TEXTURE)).forEach((P)=>P.preread(W,a.TEXTURE)),W.textures=q.map((P)=>{let C=Q.createTexture(P.name);if(P.extras)C.setExtras(P.extras);if(P.bufferView!==void 0){let T=$.bufferViews[P.bufferView],I=Z.json.buffers[T.buffer],x=I.uri?Z.resources[I.uri]:Z.resources[oq],S=T.byteOffset||0,A=T.byteLength,E=x.slice(S,S+A);C.setImage(E)}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=A7.extension(P.uri);C.setMimeType(_7.extensionToMimeType(T))}return C}),Q.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.MATERIAL)).forEach((P)=>P.preread(W,a.MATERIAL));let w=$.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 I=T.baseColorTexture,x=W.textures[U[I.index].source];C.setBaseColorTexture(x),W.setTextureInfo(C.getBaseColorTextureInfo(),I)}if(P.emissiveTexture!==void 0){let I=P.emissiveTexture,x=W.textures[U[I.index].source];C.setEmissiveTexture(x),W.setTextureInfo(C.getEmissiveTextureInfo(),I)}if(P.normalTexture!==void 0){let I=P.normalTexture,x=W.textures[U[I.index].source];if(C.setNormalTexture(x),W.setTextureInfo(C.getNormalTextureInfo(),I),P.normalTexture.scale!==void 0)C.setNormalScale(P.normalTexture.scale)}if(P.occlusionTexture!==void 0){let I=P.occlusionTexture,x=W.textures[U[I.index].source];if(C.setOcclusionTexture(x),W.setTextureInfo(C.getOcclusionTextureInfo(),I),P.occlusionTexture.strength!==void 0)C.setOcclusionStrength(P.occlusionTexture.strength)}if(T.metallicRoughnessTexture!==void 0){let I=T.metallicRoughnessTexture,x=W.textures[U[I.index].source];C.setMetallicRoughnessTexture(x),W.setTextureInfo(C.getMetallicRoughnessTextureInfo(),I)}return C}),Q.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.MESH)).forEach((P)=>P.preread(W,a.MESH));let L=$.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((I)=>{let x=Q.createPrimitive();if(I.extras)x.setExtras(I.extras);if(I.material!==void 0)x.setMaterial(W.materials[I.material]);if(I.mode!==void 0)x.setMode(I.mode);for(let[E,v]of Object.entries(I.attributes||{}))x.setAttribute(E,W.accessors[v]);if(I.indices!==void 0)x.setIndices(W.accessors[I.indices]);let S=P.extras&&P.extras.targetNames||[];(I.targets||[]).forEach((E,v)=>{let f=S[v]||v.toString(),p=Q.createPrimitiveTarget(f);for(let[n,o]of Object.entries(E))p.setAttribute(n,W.accessors[o]);x.addTarget(p)}),C.addPrimitive(x)}),C});let O=$.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===DY.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 N=$.nodes||[];Q.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.NODE)).forEach((P)=>P.preread(W,a.NODE)),W.nodes=N.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],I=[0,0,0,1],x=[1,1,1];u0.decompose(P.matrix,T,I,x),C.setTranslation(T),C.setRotation(I),C.setScale(x)}if(P.weights!==void 0)C.setWeights(P.weights);return C});let j=$.skins||[];W.skins=j.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}),N.map((P,C)=>{let T=W.nodes[C];if((P.children||[]).forEach((x)=>T.addChild(W.nodes[x])),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 R=$.animations||[];W.animations=R.map((P)=>{let C=Q.createAnimation(P.name);if(P.extras)C.setExtras(P.extras);let I=(P.samplers||[]).map((S)=>{let A=Q.createAnimationSampler().setInput(W.accessors[S.input]).setOutput(W.accessors[S.output]).setInterpolation(S.interpolation||WW.Interpolation.LINEAR);if(S.extras)A.setExtras(S.extras);return C.addSampler(A),A});return(P.channels||[]).forEach((S)=>{let A=Q.createAnimationChannel().setSampler(I[S.sampler]).setTargetPath(S.target.path);if(S.target.node!==void 0)A.setTargetNode(W.nodes[S.target.node]);if(S.extras)A.setExtras(S.extras);C.addChannel(A)}),C});let D=$.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((I)=>W.nodes[I]).forEach((I)=>C.addChild(I)),C}),$.scene!==void 0)Q.getRoot().setDefaultScene(W.scenes[$.scene]);return Q.getRoot().listExtensionsUsed().forEach((P)=>P.read(W)),V.forEach((P,C)=>{let T=W.accessors[C],I=!!P.sparse,x=!P.bufferView&&!T.getArray();if(I||x)T.setSparse(!0).setArray(uG1(P,W))}),Q}static validate(Z,J){let Y=Z.json;if(Y.asset.version!=="2.0")throw new Error(`Unsupported glTF version, "${Y.asset.version}".`);if(Y.extensionsRequired){for(let $ of Y.extensionsRequired)if(!J.extensions.find((Q)=>Q.EXTENSION_NAME===$))throw new Error(`Missing required extension, "${$}".`)}if(Y.extensionsUsed){for(let $ of Y.extensionsUsed)if(!J.extensions.find((Q)=>Q.EXTENSION_NAME===$))J.logger.warn(`Missing optional extension, "${$}".`)}}}function dG1(Z,J){let Y=J.jsonDoc,$=J.bufferViews[Z.bufferView],Q=Y.json.bufferViews[Z.bufferView],W=xZ[Z.componentType],X=I0.getElementSize(Z.type),K=W.BYTES_PER_ELEMENT,G=Z.byteOffset||0,z=new W(Z.count*X),F=new DataView($.buffer,$.byteOffset,$.byteLength),H=Q.byteStride;for(let V=0;V<Z.count;V++)for(let q=0;q<X;q++){let U=G+V*H+q*K,w;switch(Z.componentType){case I0.ComponentType.FLOAT:w=F.getFloat32(U,!0);break;case I0.ComponentType.UNSIGNED_INT:w=F.getUint32(U,!0);break;case I0.ComponentType.UNSIGNED_SHORT:w=F.getUint16(U,!0);break;case I0.ComponentType.UNSIGNED_BYTE:w=F.getUint8(U);break;case I0.ComponentType.SHORT:w=F.getInt16(U,!0);break;case I0.ComponentType.BYTE:w=F.getInt8(U);break;default:throw new Error(`Unexpected componentType "${Z.componentType}".`)}z[V*X+q]=w}return z}function sq(Z,J){let Y=J.jsonDoc,$=J.bufferViews[Z.bufferView],Q=Y.json.bufferViews[Z.bufferView],W=xZ[Z.componentType],X=I0.getElementSize(Z.type),K=W.BYTES_PER_ELEMENT,G=X*K;if(Q.byteStride!==void 0&&Q.byteStride!==G)return dG1(Z,J);let z=$.byteOffset+(Z.byteOffset||0),F=Z.count*X*K;return new W($.buffer.slice(z,z+F))}function uG1(Z,J){let Y=xZ[Z.componentType],$=I0.getElementSize(Z.type),Q;if(Z.bufferView!==void 0)Q=sq(Z,J);else Q=new Y(Z.count*$);let W=Z.sparse;if(!W)return Q;let X=W.count,K=_6({},Z,W.indices,{count:X,type:"SCALAR"}),G=_6({},Z,W.values,{count:X}),z=sq(K,J),F=sq(G,J);for(let H=0;H<K.count;H++)for(let V=0;V<$;V++)Q[z[H]*$+V]=F[H*$+V];return Q}var CG;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(CG||(CG={}));class _Z{constructor(Z,J,Y){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=Y;let $=Z.getRoot(),Q=$.listBuffers().length,W=$.listTextures().length;this.bufferURIGenerator=new $j(Q>1,()=>Y.basename||"buffer"),this.imageURIGenerator=new $j(W>1,(X)=>cG1(Z,X)||Y.basename||"texture"),this.logger=Z.getLogger()}createTextureInfoDef(Z,J){let Y={magFilter:J.getMagFilter()||void 0,minFilter:J.getMinFilter()||void 0,wrapS:J.getWrapS(),wrapT:J.getWrapT()},$=JSON.stringify(Y);if(!this.samplerDefIndexMap.has($))this.samplerDefIndexMap.set($,this.jsonDoc.json.samplers.length),this.jsonDoc.json.samplers.push(Y);let Q={source:this.imageIndexMap.get(Z),sampler:this.samplerDefIndexMap.get($)},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(($)=>$.getName()==="attributes"&&$.getAttributes().key==="POSITION"||$.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,Y){if(this.options.format===S7.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 $=_7.mimeTypeToExtension(Y.getMimeType());Z.uri=this.imageURIGenerator.createURI(Y,$),this.assignResourceURI(Z.uri,J,!1)}}assignResourceURI(Z,J,Y){let $=this.jsonDoc.resources;if(!(Z in $)){$[Z]=J;return}if(J===$[Z]){this.logger.warn(`Duplicate resource URI, "${Z}".`);return}let Q=`Resource URI "${Z}" already assigned to different data.`;if(!Y){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 S5.SPARSE;for(let Y of this._doc.getGraph().listParentEdges(Z)){let{usage:$}=Y.getAttributes();if($)return $;if(Y.getParent().propertyType!==a.ROOT)this.logger.warn(`Missing attribute ".usage" on edge, "${Y.getName()}".`)}return S5.OTHER}addAccessorToUsageGroup(Z,J){let Y=this._accessorUsageMap.get(Z);if(Y&&Y!==J)throw new Error(`Accessor with usage "${Y}" cannot be reused as "${J}".`);return this._accessorUsageMap.set(Z,J),this}}_Z.BufferViewTarget=CG;_Z.BufferViewUsage=S5;_Z.USAGE_TO_TARGET={[S5.ARRAY_BUFFER]:CG.ARRAY_BUFFER,[S5.ELEMENT_ARRAY_BUFFER]:CG.ELEMENT_ARRAY_BUFFER};class $j{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 Y=this.basename(Z);return this.counter[Y]=this.counter[Y]||1,`${Y}_${this.counter[Y]++}.${J}`}}}function cG1(Z,J){let Y=Z.getGraph().listParentEdges(J).find(($)=>$.getParent()!==Z.getRoot());return Y?Y.getName().replace(/texture$/i,""):""}var{BufferViewUsage:aq}=_Z,{UNSIGNED_INT:lG1,UNSIGNED_SHORT:pG1,UNSIGNED_BYTE:iG1}=I0.ComponentType,nG1=new Set([a.ACCESSOR,a.BUFFER,a.MATERIAL,a.MESH]);class nd{static write(Z,J){let Y=Z.getGraph(),$=Z.getRoot(),Q={asset:_6({generator:`glTF-Transform ${bd}`},$.getAsset()),extras:_6({},$.getExtras())},W={json:Q,resources:{}},X=new _Z(Z,W,J),K=J.logger||K5.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),F=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((N)=>!nG1.has(N));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 N of L.writeDependencies)L.install(N,J.dependencies[N])}function H(L,O,N,j){let R=[],D=0;for(let T of L){let I=X.createAccessorDef(T);I.bufferView=Q.bufferViews.length;let x=T.getArray(),S=n0.pad(n0.toView(x));I.byteOffset=D,D+=S.byteLength,R.push(S),X.accessorIndexMap.set(T,Q.accessors.length),Q.accessors.push(I)}let P=n0.concat(R),C={buffer:O,byteOffset:N,byteLength:P.byteLength};if(j)C.target=j;return Q.bufferViews.push(C),{buffers:R,byteLength:D}}function V(L,O,N){let j=L[0].getCount(),R=0;for(let I of L){let x=X.createAccessorDef(I);x.bufferView=Q.bufferViews.length,x.byteOffset=R;let S=I.getElementSize(),A=I.getComponentSize();R+=n0.padNumber(S*A),X.accessorIndexMap.set(I,Q.accessors.length),Q.accessors.push(x)}let D=j*R,P=new ArrayBuffer(D),C=new DataView(P);for(let I=0;I<j;I++){let x=0;for(let S of L){let A=S.getElementSize(),E=S.getComponentSize(),v=S.getComponentType(),f=S.getArray();for(let p=0;p<A;p++){let n=I*R+x+p*E,o=f[I*A+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)}}x+=n0.padNumber(A*E)}}let T={buffer:O,byteOffset:N,byteLength:D,byteStride:R,target:_Z.BufferViewTarget.ARRAY_BUFFER};return Q.bufferViews.push(T),{byteLength:D,buffers:[new Uint8Array(P)]}}function q(L,O,N){let j=[],R=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=[],Y0=new Array(v.getElementSize()).fill(0);for(let a0=0,v8=v.getCount();a0<v8;a0++){if(v.getElement(a0,o),u0.eq(o,Y0,0))continue;P=Math.max(a0,P),p.push(a0);for(let o1=0;o1<o.length;o1++)n.push(o[o1])}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=xZ[v.getComponentType()];C0.indices=p,C0.values=new T0(n)}if(!Number.isFinite(P))return{buffers:j,byteLength:R};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,I=P<255?iG1:P<65535?pG1:lG1,x={buffer:O,byteOffset:N+R,byteLength:0};for(let v of L){let f=D.get(v);if(f.count===0)continue;f.indicesByteOffset=x.byteLength;let p=n0.pad(n0.toView(new T(f.indices)));j.push(p),R+=p.byteLength,x.byteLength+=p.byteLength}Q.bufferViews.push(x);let S=Q.bufferViews.length-1,A={buffer:O,byteOffset:N+R,byteLength:0};for(let v of L){let f=D.get(v);if(f.count===0)continue;f.valuesByteOffset=A.byteLength;let p=n0.pad(n0.toView(f.values));j.push(p),R+=p.byteLength,A.byteLength+=p.byteLength}Q.bufferViews.push(A);let E=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:I},values:{bufferView:E,byteOffset:f.valuesByteOffset}}}return{buffers:j,byteLength:R}}if(Q.accessors=[],Q.bufferViews=[],Q.samplers=[],Q.textures=[],Q.images=$.listTextures().map((L,O)=>{let N=X.createPropertyDef(L);if(L.getMimeType())N.mimeType=L.getMimeType();let j=L.getImage();if(j)X.createImageData(N,j,L);return X.imageIndexMap.set(L,O),N}),z.filter((L)=>L.prewriteTypes.includes(a.ACCESSOR)).forEach((L)=>L.prewrite(X,a.ACCESSOR)),$.listAccessors().forEach((L)=>{let{accessorUsageGroupedByParent:O,accessorParents:N}=X;if(X.accessorIndexMap.has(L))return;let j=X.getAccessorUsage(L);if(X.addAccessorToUsageGroup(L,j),O.has(j)){let R=Y.listParents(L).find((D)=>D.propertyType!==a.ROOT);N.set(L,R)}}),z.filter((L)=>L.prewriteTypes.includes(a.BUFFER)).forEach((L)=>L.prewrite(X,a.BUFFER)),($.listAccessors().length>0||X.otherBufferViews.size>0||$.listTextures().length>0&&J.format===S7.GLB)&&$.listBuffers().length===0)throw new Error("Buffer required for Document resources, but none was found.");if(Q.buffers=[],$.listBuffers().forEach((L,O)=>{let N=X.createPropertyDef(L),j=X.accessorUsageGroupedByParent,R=L.listParents().filter((A)=>A instanceof I0),D=new Set(R.map((A)=>X.accessorParents.get(A))),P=new Map(Array.from(D).map((A,E)=>[A,E])),C={};for(let A of R){var T;if(X.accessorIndexMap.has(A))continue;let E=X.getAccessorUsage(A),v=E;if(j.has(E)){let f=X.accessorParents.get(A);v+=`:${P.get(f)}`}C[T=v]||(C[T]={usage:E,accessors:[]}),C[v].accessors.push(A)}let I=[],x=Q.buffers.length,S=0;for(let{usage:A,accessors:E}of Object.values(C))if(A===aq.ARRAY_BUFFER&&J.vertexLayout===rq.INTERLEAVED){let v=V(E,x,S);S+=v.byteLength;for(let f of v.buffers)I.push(f)}else if(A===aq.ARRAY_BUFFER)for(let v of E){let f=V([v],x,S);S+=f.byteLength;for(let p of f.buffers)I.push(p)}else if(A===aq.SPARSE){let v=q(E,x,S);S+=v.byteLength;for(let f of v.buffers)I.push(f)}else if(A===aq.ELEMENT_ARRAY_BUFFER){let v=_Z.BufferViewTarget.ELEMENT_ARRAY_BUFFER,f=H(E,x,S,v);S+=f.byteLength;for(let p of f.buffers)I.push(p)}else{let v=H(E,x,S);S+=v.byteLength;for(let f of v.buffers)I.push(f)}if(X.imageBufferViews.length&&O===0){for(let A=0;A<X.imageBufferViews.length;A++)if(Q.bufferViews[Q.images[A].bufferView].byteOffset=S,S+=X.imageBufferViews[A].byteLength,I.push(X.imageBufferViews[A]),S%8){let E=8-S%8;S+=E,I.push(new Uint8Array(E))}}if(X.otherBufferViews.has(L))for(let A of X.otherBufferViews.get(L))Q.bufferViews.push({buffer:x,byteOffset:S,byteLength:A.byteLength}),X.otherBufferViewsIndexMap.set(A,Q.bufferViews.length-1),S+=A.byteLength,I.push(A);if(S){let A;if(J.format===S7.GLB)A=oq;else A=X.bufferURIGenerator.createURI(L,"bin"),N.uri=A;N.byteLength=S,X.assignResourceURI(A,n0.concat(I),!0)}Q.buffers.push(N),X.bufferIndexMap.set(L,O)}),$.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=$.listMaterials().map((L,O)=>{let N=X.createPropertyDef(L);if(L.getAlphaMode()!==k4.AlphaMode.OPAQUE)N.alphaMode=L.getAlphaMode();if(L.getAlphaMode()===k4.AlphaMode.MASK)N.alphaCutoff=L.getAlphaCutoff();if(L.getDoubleSided())N.doubleSided=!0;if(N.pbrMetallicRoughness={},!u0.eq(L.getBaseColorFactor(),[1,1,1,1]))N.pbrMetallicRoughness.baseColorFactor=L.getBaseColorFactor();if(!u0.eq(L.getEmissiveFactor(),[0,0,0]))N.emissiveFactor=L.getEmissiveFactor();if(L.getRoughnessFactor()!==1)N.pbrMetallicRoughness.roughnessFactor=L.getRoughnessFactor();if(L.getMetallicFactor()!==1)N.pbrMetallicRoughness.metallicFactor=L.getMetallicFactor();if(L.getBaseColorTexture()){let j=L.getBaseColorTexture(),R=L.getBaseColorTextureInfo();N.pbrMetallicRoughness.baseColorTexture=X.createTextureInfoDef(j,R)}if(L.getEmissiveTexture()){let j=L.getEmissiveTexture(),R=L.getEmissiveTextureInfo();N.emissiveTexture=X.createTextureInfoDef(j,R)}if(L.getNormalTexture()){let j=L.getNormalTexture(),R=L.getNormalTextureInfo(),D=X.createTextureInfoDef(j,R);if(L.getNormalScale()!==1)D.scale=L.getNormalScale();N.normalTexture=D}if(L.getOcclusionTexture()){let j=L.getOcclusionTexture(),R=L.getOcclusionTextureInfo(),D=X.createTextureInfoDef(j,R);if(L.getOcclusionStrength()!==1)D.strength=L.getOcclusionStrength();N.occlusionTexture=D}if(L.getMetallicRoughnessTexture()){let j=L.getMetallicRoughnessTexture(),R=L.getMetallicRoughnessTextureInfo();N.pbrMetallicRoughness.metallicRoughnessTexture=X.createTextureInfoDef(j,R)}return X.materialIndexMap.set(L,O),N}),z.filter((L)=>L.prewriteTypes.includes(a.MESH)).forEach((L)=>L.prewrite(X,a.MESH)),Q.meshes=$.listMeshes().map((L,O)=>{let N=X.createPropertyDef(L),j=null;if(N.primitives=L.listPrimitives().map((R)=>{let D={attributes:{}};D.mode=R.getMode();let P=R.getMaterial();if(P)D.material=X.materialIndexMap.get(P);if(Object.keys(R.getExtras()).length)D.extras=R.getExtras();let C=R.getIndices();if(C)D.indices=X.accessorIndexMap.get(C);for(let T of R.listSemantics())D.attributes[T]=X.accessorIndexMap.get(R.getAttribute(T));for(let T of R.listTargets()){let I={};for(let x of T.listSemantics())I[x]=X.accessorIndexMap.get(T.getAttribute(x));D.targets=D.targets||[],D.targets.push(I)}if(R.listTargets().length&&!j)j=R.listTargets().map((T)=>T.getName());return D}),L.getWeights().length)N.weights=L.getWeights();if(j)N.extras=N.extras||{},N.extras.targetNames=j;return X.meshIndexMap.set(L,O),N}),Q.cameras=$.listCameras().map((L,O)=>{let N=X.createPropertyDef(L);if(N.type=L.getType(),N.type===DY.Type.PERSPECTIVE){N.perspective={znear:L.getZNear(),zfar:L.getZFar(),yfov:L.getYFov()};let j=L.getAspectRatio();if(j!==null)N.perspective.aspectRatio=j}else N.orthographic={znear:L.getZNear(),zfar:L.getZFar(),xmag:L.getXMag(),ymag:L.getYMag()};return X.cameraIndexMap.set(L,O),N}),Q.nodes=$.listNodes().map((L,O)=>{let N=X.createPropertyDef(L);if(!u0.eq(L.getTranslation(),[0,0,0]))N.translation=L.getTranslation();if(!u0.eq(L.getRotation(),[0,0,0,1]))N.rotation=L.getRotation();if(!u0.eq(L.getScale(),[1,1,1]))N.scale=L.getScale();if(L.getWeights().length)N.weights=L.getWeights();return X.nodeIndexMap.set(L,O),N}),Q.skins=$.listSkins().map((L,O)=>{let N=X.createPropertyDef(L),j=L.getInverseBindMatrices();if(j)N.inverseBindMatrices=X.accessorIndexMap.get(j);let R=L.getSkeleton();if(R)N.skeleton=X.nodeIndexMap.get(R);return N.joints=L.listJoints().map((D)=>X.nodeIndexMap.get(D)),X.skinIndexMap.set(L,O),N}),$.listNodes().forEach((L,O)=>{let N=Q.nodes[O],j=L.getMesh();if(j)N.mesh=X.meshIndexMap.get(j);let R=L.getCamera();if(R)N.camera=X.cameraIndexMap.get(R);let D=L.getSkin();if(D)N.skin=X.skinIndexMap.get(D);if(L.listChildren().length>0)N.children=L.listChildren().map((P)=>X.nodeIndexMap.get(P))}),Q.animations=$.listAnimations().map((L,O)=>{let N=X.createPropertyDef(L),j=new Map;return N.samplers=L.listSamplers().map((R,D)=>{let P=X.createPropertyDef(R);return P.input=X.accessorIndexMap.get(R.getInput()),P.output=X.accessorIndexMap.get(R.getOutput()),P.interpolation=R.getInterpolation(),j.set(R,D),P}),N.channels=L.listChannels().map((R)=>{let D=X.createPropertyDef(R);return D.sampler=j.get(R.getSampler()),D.target={node:X.nodeIndexMap.get(R.getTargetNode()),path:R.getTargetPath()},D}),X.animationIndexMap.set(L,O),N}),Q.scenes=$.listScenes().map((L,O)=>{let N=X.createPropertyDef(L);return N.nodes=L.listChildren().map((j)=>X.nodeIndexMap.get(j)),X.sceneIndexMap.set(L,O),N});let w=$.getDefaultScene();if(w)Q.scene=$.listScenes().indexOf(w);return Q.extensionsUsed=z.map((L)=>L.extensionName),Q.extensionsRequired=F.map((L)=>L.extensionName),z.forEach((L)=>L.write(X)),aG1(Q),W}}function aG1(Z){let J=[];for(let Y in Z){let $=Z[Y];if(Array.isArray($)&&$.length===0)J.push(Y);else if($===null||$==="")J.push(Y);else if($&&typeof $==="object"&&Object.keys($).length===0)J.push(Y)}for(let Y of J)delete Z[Y]}var ZU;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(ZU||(ZU={}));class ad{constructor(){this._logger=K5.DEFAULT_INSTANCE,this._extensions=new Set,this._dependencies={},this._vertexLayout=rq.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 Y=yd(J)?this._binaryToJSON(J):{json:JSON.parse(n0.decodeText(J)),resources:{}};return await this._readResourcesExternal(Y,this.dirname(Z)),this._readResourcesInternal(Y),Y}async readJSON(Z){return Z=this._copyJSON(Z),this._readResourcesInternal(Z),id.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 Y=J.json;if(Y.buffers&&Y.buffers.some(($)=>sG1(J,$)))throw new Error("Cannot resolve external buffers with binaryToJSON().");else if(Y.images&&Y.images.some(($)=>oG1(J,$)))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===S7.GLB&&Z.getRoot().listBuffers().length>1)throw new Error("GLB must have 0\u20131 buffers.");return nd.write(Z,{format:J.format||S7.GLTF,basename:J.basename||"",logger:this._logger,vertexLayout:this._vertexLayout,dependencies:_6({},this._dependencies),extensions:Array.from(this._extensions)})}async writeBinary(Z){let{json:J,resources:Y}=await this.writeJSON(Z,{format:S7.GLB}),$=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]);$[$.length-1]+=K.byteLength;let G=Object.values(Y)[0];if(!G||!G.byteLength)return n0.concat([n0.toView($),K]);let z=n0.pad(G,0),F=n0.toView(new Uint32Array([z.byteLength,5130562])),H=n0.concat([F,z]);return $[$.length-1]+=H.byteLength,n0.concat([n0.toView($),K,H])}async _readResourcesExternal(Z,J){var Y=this;let $=Z.json.images||[],Q=Z.json.buffers||[],W=[...$,...Q].map(async function(X){let K=X.uri;if(!K||K.match(/data:/))return Promise.resolve();Z.resources[K]=await Y.readURI(Y.resolve(J,K),"view"),Y.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=`__${cd()}.${A7.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:Y}=Z.json;if(Z={json:_6({},Z.json),resources:_6({},Z.resources)},J)Z.json.images=J.map(($)=>_6({},$));if(Y)Z.json.buffers=Y.map(($)=>_6({},$));return Z}_binaryToJSON(Z){if(!yd(Z))throw new Error("Invalid glTF 2.0 binary.");let J=new Uint32Array(Z.buffer,Z.byteOffset+12,2);if(J[1]!==ZU.JSON)throw new Error("Missing required GLB JSON chunk.");let Y=20,$=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]!==ZU.BIN)return{json:W,resources:{}};let G=K[0],z=n0.toView(Z,X+8,G);return{json:W,resources:{[oq]:z}}}}function sG1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)}function oG1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)&&J.bufferView===void 0}function yd(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 Fj extends ad{constructor(Z=null,J=e5.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(),e5.isAbsoluteURL(Z)){if(!this._fetchEnabled||!this._fetch)throw new Error("Network request blocked. Allow HTTP requests explicitly, if needed.");let Y=await this._fetch(Z,this._fetchConfig);switch(J){case"view":return new Uint8Array(await Y.arrayBuffer());case"text":return Y.text()}}else switch(J){case"view":return this._fs.readFile(Z);case"text":return this._fs.readFile(Z,"utf8")}}resolve(Z,J){if(e5.isAbsoluteURL(Z)||e5.isAbsoluteURL(J))return e5.resolve(Z,J);return this._path.resolve(Z,decodeURIComponent(J))}dirname(Z){if(e5.isAbsoluteURL(Z))return e5.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 Y=this;this.lastWriteBytes=0;let{json:$,resources:Q}=await this.writeJSON(J,{format:S7.GLTF,basename:A7.basename(Z)}),{_fs:W,_path:X}=this,K=X.dirname(Z),G=JSON.stringify($,null,2);await W.writeFile(Z,G),this.lastWriteBytes+=G.length;for(let z of rG1(Object.keys(Q),10))await Promise.all(z.map(async function(F){if(e5.isAbsoluteURL(F)){if(e5.extension(F)==="bin")throw new Error(`Cannot write buffer to path "${F}".`);return}let H=X.join(K,decodeURIComponent(F));await W.mkdir(X.dirname(H),{recursive:!0}),await W.writeFile(H,Q[F]),Y.lastWriteBytes+=Q[F].byteLength}))}async _writeGLB(Z,J){let Y=await this.writeBinary(J);await this._fs.writeFile(Z,Y),this.lastWriteBytes=Y.byteLength}}function rG1(Z,J){let Y=[];for(let $=0,Q=Z.length;$<Q;$+=J){let W=[];for(let X=0;X<J&&$+X<Q;X++)W.push(Z[$+X]);Y.push(W)}return Y}var ll=t(Hj(),1),pl=t(kl(),1),uV1=t(cl(),1);async function cV1(Z,J){if(!(Z instanceof Uint8Array))throw new Error("[ndarray-pixels] Input must be Uint8Array or Buffer.");let{data:Y,info:$}=await pl.default(Z).ensureAlpha().raw().toBuffer({resolveWithObject:!0});return ll.default(new Uint8Array(Y),[$.width,$.height,4],[4,4*$.width|0,1],0)}async function il(Z,J){return cV1(Z)}var lV1="v4.1.3",cj="@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 nl;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(nl||(nl={}));var x5;(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"})(x5||(x5={}));var h5;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(h5||(h5={}));var yj;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(yj||(yj={}));var bj=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 pV1(){var Z=new bj(3);if(bj!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function fj(Z){var J=Z[0],Y=Z[1],$=Z[2];return Math.hypot(J,Y,$)}function iV1(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=Y[3]*$+Y[7]*Q+Y[11]*W+Y[15];return X=X||1,Z[0]=(Y[0]*$+Y[4]*Q+Y[8]*W+Y[12])/X,Z[1]=(Y[1]*$+Y[5]*Q+Y[9]*W+Y[13])/X,Z[2]=(Y[2]*$+Y[6]*Q+Y[10]*W+Y[14])/X,Z}(function(){var Z=pV1();return function(J,Y,$,Q,W,X){var K,G;if(!Y)Y=3;if(!$)$=0;if(Q)G=Math.min(Q*Y+$,J.length);else G=J.length;for(K=$;K<G;K+=Y)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 rl(Z){let J=tl(),Y=Z.propertyType===s.NODE?[Z]:Z.listChildren();for(let $ of Y)$.traverse((Q)=>{let W=Q.getMesh();if(!W)return;let X=nV1(W,Q.getWorldMatrix());if(X.min.every(isFinite)&&X.max.every(isFinite))gj(X.min,J),gj(X.max,J)});return J}function nV1(Z,J){let Y=tl();for(let $ of Z.listPrimitives()){let Q=$.getAttribute("POSITION"),W=$.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 F=W?W.getScalar(G):G;X=Q.getElement(F,X),K=iV1(K,X,J),gj(K,Y)}}return Y}function gj(Z,J){for(let Y=0;Y<3;Y++)J.min[Y]=Math.min(Z[Y],J.min[Y]),J.max[Y]=Math.max(Z[Y],J.max[Y])}function tl(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class B6{static createBufferFromDataURI(Z){if(typeof Buffer==="undefined"){let J=atob(Z.split(",")[1]),Y=new Uint8Array(J.length);for(let $=0;$<J.length;$++)Y[$]=J.charCodeAt($);return Y}else{let J=Z.split(",")[1],Y=Z.indexOf("base64")>=0;return Buffer.from(J,Y?"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 Y=new Uint8Array(J),$=0;for(let Q of Z)Y.set(Q,$),$+=Q.byteLength;return Y}static pad(Z,J=0){let Y=this.padNumber(Z.byteLength);if(Y===Z.byteLength)return Z;let $=new Uint8Array(Y);if($.set(Z),J!==0)for(let Q=Z.byteLength;Q<Y;Q++)$[Q]=J;return $}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 Y=Z.byteLength;while(Y--)if(Z[Y]!==J[Y])return!1;return!0}static toView(Z,J=0,Y=1/0){return new Uint8Array(Z.buffer,Z.byteOffset+J,Math.min(Z.byteLength,Y))}static assertView(Z){if(Z&&!ArrayBuffer.isView(Z))throw new Error(`Method requires Uint8Array parameter; received "${typeof Z}".`);return Z}}class el{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(Y=J.getUint16(0,!1),aV1(J,Y),$=J.getUint8(Y+1),$===192||$===193||$===194)return[J.getUint16(Y+7,!1),J.getUint16(Y+5,!1)];J=new DataView(Z.buffer,J.byteOffset+Y+2)}throw new TypeError("Invalid JPG, no size found")}getChannels(Z){return 3}}class _U{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(B6.decodeText(Z.slice(12,16))===_U.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}}_U.PNG_FRIED_CHUNK_NAME="CgBI";class a9{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 Y=0,$=4,Q=this.getSize(Z,J);if(!Q)return null;while(Q[0]>1||Q[1]>1)Y+=Q[0]*Q[1]*$,Q[0]=Math.max(Math.floor(Q[0]/2),1),Q[1]=Math.max(Math.floor(Q[1]/2),1);return Y+=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}`}}a9.impls={"image/jpeg":new el,"image/png":new _U};function aV1(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 fG{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 a9.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 al(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function vY(Z){if(al(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let Y=J.prototype;if(al(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}var mj,dj;(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"})(dj||(dj={}));class A4{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=A4.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=A4.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=A4.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=A4.Verbosity.ERROR)console.error(Z)}}mj=A4;A4.Verbosity=dj;A4.DEFAULT_INSTANCE=new mj(mj.Verbosity.INFO);function sV1(Z){var J=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],F=Z[9],H=Z[10],V=Z[11],q=Z[12],U=Z[13],w=Z[14],L=Z[15],O=J*X-Y*W,N=J*K-$*W,j=J*G-Q*W,R=Y*K-$*X,D=Y*G-Q*X,P=$*G-Q*K,C=z*U-F*q,T=z*w-H*q,I=z*L-V*q,x=F*w-H*U,S=F*L-V*U,A=H*L-V*w;return O*A-N*S+j*x+R*I-D*T+P*C}function oV1(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],H=J[8],V=J[9],q=J[10],U=J[11],w=J[12],L=J[13],O=J[14],N=J[15],j=Y[0],R=Y[1],D=Y[2],P=Y[3];return Z[0]=j*$+R*K+D*H+P*w,Z[1]=j*Q+R*G+D*V+P*L,Z[2]=j*W+R*z+D*q+P*O,Z[3]=j*X+R*F+D*U+P*N,j=Y[4],R=Y[5],D=Y[6],P=Y[7],Z[4]=j*$+R*K+D*H+P*w,Z[5]=j*Q+R*G+D*V+P*L,Z[6]=j*W+R*z+D*q+P*O,Z[7]=j*X+R*F+D*U+P*N,j=Y[8],R=Y[9],D=Y[10],P=Y[11],Z[8]=j*$+R*K+D*H+P*w,Z[9]=j*Q+R*G+D*V+P*L,Z[10]=j*W+R*z+D*q+P*O,Z[11]=j*X+R*F+D*U+P*N,j=Y[12],R=Y[13],D=Y[14],P=Y[15],Z[12]=j*$+R*K+D*H+P*w,Z[13]=j*Q+R*G+D*V+P*L,Z[14]=j*W+R*z+D*q+P*O,Z[15]=j*X+R*F+D*U+P*N,Z}function rV1(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[4],X=J[5],K=J[6],G=J[8],z=J[9],F=J[10];return Z[0]=Math.hypot(Y,$,Q),Z[1]=Math.hypot(W,X,K),Z[2]=Math.hypot(G,z,F),Z}function tV1(Z,J){var Y=new bj(3);rV1(Y,J);var $=1/Y[0],Q=1/Y[1],W=1/Y[2],X=J[0]*$,K=J[1]*Q,G=J[2]*W,z=J[4]*$,F=J[5]*Q,H=J[6]*W,V=J[8]*$,q=J[9]*Q,U=J[10]*W,w=X+F+U,L=0;if(w>0)L=Math.sqrt(w+1)*2,Z[3]=0.25*L,Z[0]=(H-q)/L,Z[1]=(V-G)/L,Z[2]=(K-z)/L;else if(X>F&&X>U)L=Math.sqrt(1+X-F-U)*2,Z[3]=(H-q)/L,Z[0]=0.25*L,Z[1]=(K+z)/L,Z[2]=(V+G)/L;else if(F>U)L=Math.sqrt(1+F-X-U)*2,Z[3]=(V-G)/L,Z[0]=(K+z)/L,Z[1]=0.25*L,Z[2]=(H+q)/L;else L=Math.sqrt(1+U-X-F)*2,Z[3]=(K-z)/L,Z[0]=(V+G)/L,Z[1]=(H+q)/L,Z[2]=0.25*L;return Z}class G8{static identity(Z){return Z}static eq(Z,J,Y=0.00001){if(Z.length!==J.length)return!1;for(let $=0;$<Z.length;$++)if(Math.abs(Z[$]-J[$])>Y)return!1;return!0}static clamp(Z,J,Y){if(Z<J)return J;if(Z>Y)return Y;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=fj([Z[0],Z[1],Z[2]]),W=fj([Z[4],Z[5],Z[6]]),X=fj([Z[8],Z[9],Z[10]]);if(sV1(Z)<0)Q=-Q;J[0]=Z[12],J[1]=Z[13],J[2]=Z[14];let G=Z.slice(),z=1/Q,F=1/W,H=1/X;G[0]*=z,G[1]*=z,G[2]*=z,G[4]*=F,G[5]*=F,G[6]*=F,G[8]*=H,G[9]*=H,G[10]*=H,tV1(Y,G),$[0]=Q,$[1]=W,$[2]=X}static compose(Z,J,Y,$){let Q=$,W=J[0],X=J[1],K=J[2],G=J[3],z=W+W,F=X+X,H=K+K,V=W*z,q=W*F,U=W*H,w=X*F,L=X*H,O=K*H,N=G*z,j=G*F,R=G*H,D=Y[0],P=Y[1],C=Y[2];return Q[0]=(1-(w+O))*D,Q[1]=(q+R)*D,Q[2]=(U-j)*D,Q[3]=0,Q[4]=(q-R)*P,Q[5]=(1-(V+O))*P,Q[6]=(L+N)*P,Q[7]=0,Q[8]=(U+j)*C,Q[9]=(L-N)*C,Q[10]=(1-(V+w))*C,Q[11]=0,Q[12]=Z[0],Q[13]=Z[1],Q[14]=Z[2],Q[15]=1,Q}}function eV1(Z,J){if(!!Z!==!!J)return!1;let Y=Z.getChild(),$=J.getChild();return Y===$||Y.equals($)}function Zq1(Z,J){if(!!Z!==!!J)return!1;let Y=Z.values(),$=J.values();if(Y.length!==$.length)return!1;for(let Q=0;Q<Y.length;Q++){let W=Y[Q],X=$[Q];if(W.getChild()===X.getChild())continue;if(!W.getChild().equals(X.getChild()))return!1}return!0}function Jq1(Z,J){if(!!Z!==!!J)return!1;let Y=Z.keys(),$=J.keys();if(Y.length!==$.length)return!1;for(let Q of Y){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 Zp(Z,J){if(Z===J)return!0;if(!!Z!==!!J||!Z||!J)return!1;if(Z.length!==J.length)return!1;for(let Y=0;Y<Z.length;Y++)if(Z[Y]!==J[Y])return!1;return!0}function Jp(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!vY(Z)||!vY(J))return Z===J;let Y=Z,$=J,Q=0,W=0,X;for(X in Y)Q++;for(X in $)W++;if(Q!==W)return!1;for(X in Y){let K=Y[X],G=$[X];if(IU(K)&&IU(G)){if(!Zp(K,G))return!1}else if(vY(K)&&vY(G)){if(!Jp(K,G))return!1}else if(K!==G)return!1}return!0}function IU(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var sl="https://null.example";class lj{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return fG.basename(new URL(Z,sl).pathname)}static extension(Z){return fG.extension(new URL(Z,sl).pathname)}static resolve(Z,J){if(!this.isRelativePath(J))return J;let Y=Z.split("/"),$=J.split("/");Y.pop();for(let Q=0;Q<$.length;Q++){if($[Q]===".")continue;if($[Q]==="..")Y.pop();else Y.push($[Q])}return Y.join("/")}static isAbsoluteURL(Z){return this.PROTOCOL_REGEXP.test(Z)}static isRelativePath(Z){return!/^(?:[a-zA-Z]+:)?\//.test(Z)}}lj.DEFAULT_INIT={};lj.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var mZ=(Z)=>Z,Yq1=new Set;class AU extends QW{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,mZ)}copy(Z,J=mZ){for(let Y in this[A0]){let $=this[A0][Y];if($ instanceof W5){if(!this[i9].has(Y))$.dispose()}else if($ instanceof U6||$ instanceof j0)for(let Q of $.values())Q.dispose();else if($ instanceof t1)for(let Q of $.values())Q.dispose()}for(let Y in Z[A0]){let $=this[A0][Y],Q=Z[A0][Y];if(Q instanceof W5)if(this[i9].has(Y))$.getChild().copy(J(Q.getChild()),J);else this.setRef(Y,J(Q.getChild()),Q.getAttributes());else if(Q instanceof j0||Q instanceof U6)for(let W of Q.values())this.addRef(Y,J(W.getChild()),W.getAttributes());else if(Q instanceof t1)for(let W of Q.keys()){let X=Q.get(W);this.setRefMap(Y,W,J(X.getChild()),X.getAttributes())}else if(vY(Q))this[A0][Y]=JSON.parse(JSON.stringify(Q));else if(Array.isArray(Q)||Q instanceof ArrayBuffer||ArrayBuffer.isView(Q))this[A0][Y]=Q.slice();else this[A0][Y]=Q}return this}equals(Z,J=Yq1){if(this===Z)return!0;if(this.propertyType!==Z.propertyType)return!1;for(let Y in this[A0]){if(J.has(Y))continue;let $=this[A0][Y],Q=Z[A0][Y];if($ instanceof W5||Q instanceof W5){if(!eV1($,Q))return!1}else if($ instanceof j0||Q instanceof j0||$ instanceof U6||Q instanceof U6){if(!Zq1($,Q))return!1}else if($ instanceof t1||Q instanceof t1){if(!Jq1($,Q))return!1}else if(vY($)||vY(Q)){if(!Jp($,Q))return!1}else if(IU($)||IU(Q)){if(!Zp($,Q))return!1}else if($!==Q)return!1}return!0}detach(){return this.graph.disconnectParents(this,(Z)=>Z.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}}class O6 extends AU{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new t1})}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 N0 extends O6{init(){this.propertyType=s.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:N0.Type.SCALAR,componentType:N0.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(Z){switch(Z){case N0.Type.SCALAR:return 1;case N0.Type.VEC2:return 2;case N0.Type.VEC3:return 3;case N0.Type.VEC4:return 4;case N0.Type.MAT2:return 4;case N0.Type.MAT3:return 9;case N0.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+Z)}}static getComponentSize(Z){switch(Z){case N0.ComponentType.BYTE:return 1;case N0.ComponentType.UNSIGNED_BYTE:return 1;case N0.ComponentType.SHORT:return 2;case N0.ComponentType.UNSIGNED_SHORT:return 2;case N0.ComponentType.UNSIGNED_INT:return 4;case N0.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+Z)}}getMinNormalized(Z){let J=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType();if(this.getMin(Z),J)for(let Q=0;Q<Y;Q++)Z[Q]=G8.decodeNormalizedInt(Z[Q],$);return Z}getMin(Z){let J=this.getArray(),Y=this.getCount(),$=this.getElementSize();for(let Q=0;Q<$;Q++)Z[Q]=1/0;for(let Q=0;Q<Y*$;Q+=$)for(let W=0;W<$;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(),Y=this.getElementSize(),$=this.getComponentType();if(this.getMax(Z),J)for(let Q=0;Q<Y;Q++)Z[Q]=G8.decodeNormalizedInt(Z[Q],$);return Z}getMax(Z){let J=this.get("array"),Y=this.getCount(),$=this.getElementSize();for(let Q=0;Q<$;Q++)Z[Q]=-1/0;for(let Q=0;Q<Y*$;Q+=$)for(let W=0;W<$;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 N0.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(),Y=this.getComponentType(),$=this.getArray();if(this.getNormalized())return G8.decodeNormalizedInt($[Z*J],Y);return $[Z*J]}setScalar(Z,J){let Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();if(this.getNormalized())Q[Z*Y]=G8.encodeNormalizedInt(J,$);else Q[Z*Y]=J;return this}getElement(Z,J){let Y=this.getNormalized(),$=this.getElementSize(),Q=this.getComponentType(),W=this.getArray();for(let X=0;X<$;X++)if(Y)J[X]=G8.decodeNormalizedInt(W[Z*$+X],Q);else J[X]=W[Z*$+X];return J}setElement(Z,J){let Y=this.getNormalized(),$=this.getElementSize(),Q=this.getComponentType(),W=this.getArray();for(let X=0;X<$;X++)if(Y)W[Z*$+X]=G8.encodeNormalizedInt(J[X],Q);else W[Z*$+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?$q1(Z):N0.ComponentType.FLOAT),this.set("array",Z),this}getByteLength(){let Z=this.get("array");return Z?Z.byteLength:0}}N0.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};N0.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function $q1(Z){switch(Z.constructor){case Float32Array:return N0.ComponentType.FLOAT;case Uint32Array:return N0.ComponentType.UNSIGNED_INT;case Uint16Array:return N0.ComponentType.UNSIGNED_SHORT;case Uint8Array:return N0.ComponentType.UNSIGNED_BYTE;case Int16Array:return N0.ComponentType.SHORT;case Int8Array:return N0.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class pj extends O6{init(){this.propertyType=s.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new j0,samplers:new j0})}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 O6{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 BW extends O6{init(){this.propertyType=s.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:BW.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:x5.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:x5.OTHER})}}BW.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class ij extends O6{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 gG extends O6{init(){this.propertyType=s.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:gG.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)}}gG.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class i1 extends AU{_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 O6{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:TU,G:kU,B:EU,A:Qq1}=h5;class mG extends O6{init(){this.propertyType=s.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:mG.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:TU|kU|EU|Qq1,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:TU|kU|EU,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:TU|kU|EU})}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:TU})}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:kU|EU})}}mG.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class nj extends O6{init(){this.propertyType=s.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new j0})}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 aj extends O6{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 j0})}copy(Z,J=mZ){if(J===mZ)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(),Y=this.get("rotation").slice(),$=this.get("scale").slice();return G8.decompose(Z,J,Y,$),this.set("translation",J).set("rotation",Y).set("scale",$)}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 $=this;$!=null;$=$.getParentNode())Z.push($);let J,Y=Z.pop().getMatrix();while(J=Z.pop())oV1(Y,Y,J.getMatrix());return Y}addChild(Z){let J=Z.getParentNode();if(J)J.removeChild(Z);for(let Y of Z.listParents())if(Y.propertyType===s.SCENE)Y.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 dZ extends O6{init(){this.propertyType=s.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:dZ.Mode.TRIANGLES,material:null,indices:null,attributes:new t1,targets:new j0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:x5.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:x5.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)}}dZ.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class Yp extends AU{init(){this.propertyType=s.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new t1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:x5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function vU(){return vU=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var Y=arguments[J];for(var $ in Y)({}).hasOwnProperty.call(Y,$)&&(Z[$]=Y[$])}return Z},vU.apply(null,arguments)}class sj extends O6{init(){this.propertyType=s.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new j0})}copy(Z,J=mZ){if(J===mZ)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 oj extends O6{init(){this.propertyType=s.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new j0})}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:x5.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class rj extends O6{init(){this.propertyType=s.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||a9.extensionToMimeType(fG.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=a9.extensionToMimeType(fG.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",B6.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return a9.getSize(Z,this.getMimeType())}}class xU extends O6{init(){this.propertyType=s.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${lV1}`,version:"2.0"},defaultScene:null,accessors:new j0,animations:new j0,buffers:new j0,cameras:new j0,materials:new j0,meshes:new j0,nodes:new j0,scenes:new j0,skins:new j0,textures:new j0})}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=mZ){if(J===mZ)throw new Error("Root cannot be copied.");this.set("asset",vU({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(vU({},Z.getExtras())),this.setDefaultScene(Z.getDefaultScene()?J(Z.getDefaultScene()):null);for(let Y of Z.listRefMapKeys("extensions")){let $=Z.getExtension(Y);this.setExtension(Y,J($))}return this}_addChildOfRoot(Z){if(Z instanceof sj)this.addRef("scenes",Z);else if(Z instanceof aj)this.addRef("nodes",Z);else if(Z instanceof gG)this.addRef("cameras",Z);else if(Z instanceof oj)this.addRef("skins",Z);else if(Z instanceof nj)this.addRef("meshes",Z);else if(Z instanceof mG)this.addRef("materials",Z);else if(Z instanceof rj)this.addRef("textures",Z);else if(Z instanceof pj)this.addRef("animations",Z);else if(Z instanceof N0)this.addRef("accessors",Z);else if(Z instanceof ij)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 SU{static fromGraph(Z){return SU._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new $W,this._root=new xU(this._graph),this._logger=A4.DEFAULT_INSTANCE,SU._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((Y)=>Y.name);for(let Y of Z)await Y(this,{stack:J});return this}createExtension(Z){let J=Z.EXTENSION_NAME;return this.getRoot().listExtensionsUsed().find(($)=>$.extensionName===J)||new Z(this)}createScene(Z=""){return new sj(this._graph,Z)}createNode(Z=""){return new aj(this._graph,Z)}createCamera(Z=""){return new gG(this._graph,Z)}createSkin(Z=""){return new oj(this._graph,Z)}createMesh(Z=""){return new nj(this._graph,Z)}createPrimitive(){return new dZ(this._graph)}createPrimitiveTarget(Z=""){return new Yp(this._graph,Z)}createMaterial(Z=""){return new mG(this._graph,Z)}createTexture(Z=""){return new rj(this._graph,Z)}createAnimation(Z=""){return new pj(this._graph,Z)}createAnimationChannel(Z=""){return new bG(this._graph,Z)}createAnimationSampler(Z=""){return new BW(this._graph,Z)}createAccessor(Z="",J=null){if(!J)J=this.getRoot().listBuffers()[0];return new N0(this._graph,Z).setBuffer(J)}createBuffer(Z=""){return new ij(this._graph,Z)}}SU._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=(Y)=>{let $=Y,Q=$.target;if(Q instanceof i1&&Q.extensionName===this.extensionName){if($.type==="node:create")this._addExtensionProperty(Q);if($.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 zK6={logger:A4.DEFAULT_INSTANCE,extensions:[],dependencies:{}},FK6=new Set([s.BUFFER,s.TEXTURE,s.MATERIAL,s.MESH,s.PRIMITIVE,s.NODE,s.SCENE]);var yG;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(yG||(yG={}));class uZ{constructor(Z,J,Y){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=Y;let $=Z.getRoot(),Q=$.listBuffers().length,W=$.listTextures().length;this.bufferURIGenerator=new uj(Q>1,()=>Y.basename||"buffer"),this.imageURIGenerator=new uj(W>1,(X)=>Wq1(Z,X)||Y.basename||"texture"),this.logger=Z.getLogger()}createTextureInfoDef(Z,J){let Y={magFilter:J.getMagFilter()||void 0,minFilter:J.getMinFilter()||void 0,wrapS:J.getWrapS(),wrapT:J.getWrapT()},$=JSON.stringify(Y);if(!this.samplerDefIndexMap.has($))this.samplerDefIndexMap.set($,this.jsonDoc.json.samplers.length),this.jsonDoc.json.samplers.push(Y);let Q={source:this.imageIndexMap.get(Z),sampler:this.samplerDefIndexMap.get($)},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(($)=>$.getName()==="attributes"&&$.getAttributes().key==="POSITION"||$.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,Y){if(this.options.format===yj.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 $=a9.mimeTypeToExtension(Y.getMimeType());Z.uri=this.imageURIGenerator.createURI(Y,$),this.assignResourceURI(Z.uri,J,!1)}}assignResourceURI(Z,J,Y){let $=this.jsonDoc.resources;if(!(Z in $)){$[Z]=J;return}if(J===$[Z]){this.logger.warn(`Duplicate resource URI, "${Z}".`);return}let Q=`Resource URI "${Z}" already assigned to different data.`;if(!Y){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 x5.SPARSE;for(let Y of this._doc.getGraph().listParentEdges(Z)){let{usage:$}=Y.getAttributes();if($)return $;if(Y.getParent().propertyType!==s.ROOT)this.logger.warn(`Missing attribute ".usage" on edge, "${Y.getName()}".`)}return x5.OTHER}addAccessorToUsageGroup(Z,J){let Y=this._accessorUsageMap.get(Z);if(Y&&Y!==J)throw new Error(`Accessor with usage "${Y}" cannot be reused as "${J}".`);return this._accessorUsageMap.set(Z,J),this}}uZ.BufferViewTarget=yG;uZ.BufferViewUsage=x5;uZ.USAGE_TO_TARGET={[x5.ARRAY_BUFFER]:yG.ARRAY_BUFFER,[x5.ELEMENT_ARRAY_BUFFER]:yG.ELEMENT_ARRAY_BUFFER};class uj{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 Y=this.basename(Z);return this.counter[Y]=this.counter[Y]||1,`${Y}_${this.counter[Y]++}.${J}`}}}function Wq1(Z,J){let Y=Z.getGraph().listParentEdges(J).find(($)=>$.getParent()!==Z.getRoot());return Y?Y.getName().replace(/texture$/i,""):""}var{UNSIGNED_INT:HK6,UNSIGNED_SHORT:VK6,UNSIGNED_BYTE:qK6}=N0.ComponentType,UK6=new Set([s.ACCESSOR,s.BUFFER,s.MATERIAL,s.MESH]);var ol;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(ol||(ol={}));var Qp=163,Wp=166;function Xq1(){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 OW{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,Y),this._littleEndian=$,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),Y=Z+4294967296*J;return this._offset+=8,Y}_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 Y=this._offset,$=0;while(this._dataView.getUint8(this._offset)!==J&&$<Z)$++,this._offset++;if($<Z)this._offset++;return new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+Y,$)}}var BK6=new Uint8Array([0]),f6=[171,75,84,88,32,50,48,187,13,10,26,10];function $p(Z){return new TextDecoder().decode(Z)}function hU(Z){let J=new Uint8Array(Z.buffer,Z.byteOffset,f6.length);if(J[0]!==f6[0]||J[1]!==f6[1]||J[2]!==f6[2]||J[3]!==f6[3]||J[4]!==f6[4]||J[5]!==f6[5]||J[6]!==f6[6]||J[7]!==f6[7]||J[8]!==f6[8]||J[9]!==f6[9]||J[10]!==f6[10]||J[11]!==f6[11])throw new Error("Missing KTX 2.0 identifier.");let Y=Xq1(),$=17*Uint32Array.BYTES_PER_ELEMENT,Q=new OW(Z,f6.length,$,!0);Y.vkFormat=Q._nextUint32(),Y.typeSize=Q._nextUint32(),Y.pixelWidth=Q._nextUint32(),Y.pixelHeight=Q._nextUint32(),Y.pixelDepth=Q._nextUint32(),Y.layerCount=Q._nextUint32(),Y.faceCount=Q._nextUint32();let W=Q._nextUint32();Y.supercompressionScheme=Q._nextUint32();let X=Q._nextUint32(),K=Q._nextUint32(),G=Q._nextUint32(),z=Q._nextUint32(),F=Q._nextUint64(),H=Q._nextUint64(),V=W*3*8,q=new OW(Z,f6.length+$,V,!0);for(let W6=0;W6<W;W6++)Y.levels.push({levelData:new Uint8Array(Z.buffer,Z.byteOffset+q._nextUint64(),q._nextUint64()),uncompressedByteLength:q._nextUint64()});let U=new OW(Z,X,K,!0);U._skip(4);let w=U._nextUint16(),L=U._nextUint16(),O=U._nextUint16(),N=U._nextUint16(),j=U._nextUint8(),R=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()],x={vendorId:w,descriptorType:L,versionNumber:O,colorModel:j,colorPrimaries:R,transferFunction:D,flags:P,texelBlockDimension:C,bytesPlane:T,samples:[]},S=6,A=4,E=(N/4-S)/A;for(let W6=0;W6<E;W6++){let R7={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(R7.channelType&64)R7.sampleLower=U._nextInt32(),R7.sampleUpper=U._nextInt32();else R7.sampleLower=U._nextUint32(),R7.sampleUpper=U._nextUint32();x.samples[W6]=R7}Y.dataFormatDescriptor.length=0,Y.dataFormatDescriptor.push(x);let v=new OW(Z,G,z,!0);while(v._offset<z){let W6=v._nextUint32(),R7=v._scan(W6),rH=$p(R7);if(Y.keyValue[rH]=v._nextUint8Array(W6-R7.byteLength-1),rH.match(/^ktx/i)){let Th=$p(Y.keyValue[rH]);Y.keyValue[rH]=Th.substring(0,Th.lastIndexOf("\x00"))}let fZ1=W6%4?4-W6%4:0;v._skip(fZ1)}if(H<=0)return Y;let f=new OW(Z,F,H,!0),p=f._nextUint16(),n=f._nextUint16(),o=f._nextUint32(),Y0=f._nextUint32(),W0=f._nextUint32(),C0=f._nextUint32(),T0=[];for(let W6=0;W6<W;W6++)T0.push({imageFlags:f._nextUint32(),rgbSliceByteOffset:f._nextUint32(),rgbSliceByteLength:f._nextUint32(),alphaSliceByteOffset:f._nextUint32(),alphaSliceByteLength:f._nextUint32()});let a0=F+f._offset,v8=a0+o,o1=v8+Y0,N4=o1+W0,y9=new Uint8Array(Z.buffer,Z.byteOffset+a0,o),fQ=new Uint8Array(Z.buffer,Z.byteOffset+v8,Y0),yQ=new Uint8Array(Z.buffer,Z.byteOffset+o1,W0),GY=new Uint8Array(Z.buffer,Z.byteOffset+N4,C0);return Y.globalData={endpointCount:p,selectorCount:n,imageDescs:T0,endpointsData:y9,selectorsData:fQ,tablesData:yQ,extendedData:GY},Y}var YP="EXT_mesh_gpu_instancing",ej="EXT_meshopt_compression",Kq1="EXT_texture_webp",Gq1="EXT_texture_avif",Mp="KHR_draco_mesh_compression",$P="KHR_lights_punctual",QP="KHR_materials_anisotropy",WP="KHR_materials_clearcoat",XP="KHR_materials_diffuse_transmission",KP="KHR_materials_dispersion",GP="KHR_materials_emissive_strength",zP="KHR_materials_ior",FP="KHR_materials_iridescence",HP="KHR_materials_pbrSpecularGlossiness",VP="KHR_materials_sheen",qP="KHR_materials_specular",UP="KHR_materials_transmission",LP="KHR_materials_unlit",wP="KHR_materials_volume",pY="KHR_materials_variants",zq1="KHR_mesh_quantization",Fq1="KHR_texture_basisu",BP="KHR_texture_transform",fU="KHR_xmp_json_ld",ZP="INSTANCE_ATTRIBUTE";class OP extends i1{init(){this.extensionName=YP,this.propertyType="InstancedMesh",this.parentTypes=[s.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new t1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:ZP})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}OP.EXTENSION_NAME=YP;var SY=YP;class gU extends E1{constructor(...Z){super(...Z);this.extensionName=SY,this.provideTypes=[s.NODE],this.prewriteTypes=[s.ACCESSOR]}createInstancedMesh(){return new OP(this.document.getGraph())}read(Z){return(Z.jsonDoc.json.nodes||[]).forEach(($,Q)=>{if(!$.extensions||!$.extensions[SY])return;let W=$.extensions[SY],X=this.createInstancedMesh();for(let K in W.attributes)X.setAttribute(K,Z.accessors[W.attributes[K]]);Z.nodes[Q].setExtension(SY,X)}),this}prewrite(Z){Z.accessorUsageGroupedByParent.add(ZP);for(let J of this.properties)for(let Y of J.listAttributes())Z.addAccessorToUsageGroup(Y,ZP);return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listNodes().forEach((Y)=>{let $=Y.getExtension(SY);if($){let Q=Z.nodeIndexMap.get(Y),W=J.json.nodes[Q],X={attributes:{}};$.listSemantics().forEach((K)=>{let G=$.getAttribute(K);X.attributes[K]=Z.accessorIndexMap.get(G)}),W.extensions=W.extensions||{},W.extensions[SY]=X}}),this}}gU.EXTENSION_NAME=SY;function y7(){return y7=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var Y=arguments[J];for(var $ in Y)({}).hasOwnProperty.call(Y,$)&&(Z[$]=Y[$])}return Z},y7.apply(null,arguments)}var lG;(function(Z){Z.QUANTIZE="quantize",Z.FILTER="filter"})(lG||(lG={}));var NW;(function(Z){Z.ATTRIBUTES="ATTRIBUTES",Z.TRIANGLES="TRIANGLES",Z.INDICES="INDICES"})(NW||(NW={}));var z8;(function(Z){Z.NONE="NONE",Z.OCTAHEDRAL="OCTAHEDRAL",Z.QUATERNION="QUATERNION",Z.EXPONENTIAL="EXPONENTIAL"})(z8||(z8={}));var{BYTE:Hq1,SHORT:Xp,FLOAT:Vq1}=N0.ComponentType,{encodeNormalizedInt:Kp,decodeNormalizedInt:JP}=G8;function qq1(Z,J,Y,$){let{filter:Q,bits:W}=$,X={array:Z.getArray(),byteStride:Z.getElementSize()*Z.getComponentSize(),componentType:Z.getComponentType(),normalized:Z.getNormalized()};if(Y!==NW.ATTRIBUTES)return X;if(Q!==z8.NONE){let K=Z.getNormalized()?Uq1(Z):new Float32Array(X.array);switch(Q){case z8.EXPONENTIAL:X.byteStride=Z.getElementSize()*4,X.componentType=Vq1,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?Xp:Hq1,X.normalized=!0,K=Z.getElementSize()===3?wq1(K):K,X.array=J.encodeFilterOct(K,Z.getCount(),X.byteStride,W);break;case z8.QUATERNION:X.byteStride=8,X.componentType=Xp,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)=>JP(G,Z.getComponentType())),X.max=X.max.map((G)=>JP(G,Z.getComponentType()));if(X.normalized)X.min=X.min.map((G)=>Kp(G,X.componentType)),X.max=X.max.map((G)=>Kp(G,X.componentType))}else if(X.byteStride%4)X.array=Lq1(X.array,Z.getElementSize()),X.byteStride=X.array.byteLength/Z.getCount();return X}function Uq1(Z){let J=Z.getComponentType(),Y=Z.getArray(),$=new Float32Array(Y.length);for(let Q=0;Q<Y.length;Q++)$[Q]=JP(Y[Q],J);return $}function Lq1(Z,J){let $=B6.padNumber(Z.BYTES_PER_ELEMENT*J)/Z.BYTES_PER_ELEMENT,Q=Z.length/J,W=new Z.constructor(Q*$);for(let X=0;X*J<Z.length;X++)for(let K=0;K<J;K++)W[X*$+K]=Z[X*J+K];return W}function wq1(Z){let J=new Float32Array(Z.length*4/3);for(let Y=0,$=Z.length/3;Y<$;Y++)J[Y*4]=Z[Y*3],J[Y*4+1]=Z[Y*3+1],J[Y*4+2]=Z[Y*3+2];return J}function Bq1(Z,J){if(J===uZ.BufferViewUsage.ELEMENT_ARRAY_BUFFER)return Z.listParents().some(($)=>{return $ instanceof dZ&&$.getMode()===dZ.Mode.TRIANGLES})?NW.TRIANGLES:NW.INDICES;return NW.ATTRIBUTES}function Oq1(Z,J){let Y=J.getGraph().listParentEdges(Z).filter(($)=>!($.getParent()instanceof xU));for(let $ of Y){let Q=$.getName(),W=$.getAttributes().key||"",X=$.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=Np(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 Np(Z){for(let J of Z.listParents()){if(!(J instanceof BW))continue;for(let Y of J.listParents()){if(!(Y instanceof bG))continue;return Y.getTargetPath()}}return null}function Mq1(Z){if(!Z.extensions||!Z.extensions[ej])return!1;return!!Z.extensions[ej].fallback}var y6=ej,Gp={method:lG.QUANTIZE};class iG extends E1{constructor(...Z){super(...Z);this.extensionName=y6,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=Gp,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=y7({},Gp,Z),this}preread(Z,J){if(!this._decoder){if(!this.isRequired())return this;throw new Error(`[${y6}] Please install extension dependency, "meshopt.decoder".`)}if(!this._decoder.supported){if(!this.isRequired())return this;throw new Error(`[${y6}]: 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(($,Q)=>{if(!$.extensions||!$.extensions[y6])return;let W=$.extensions[y6],X=W.byteOffset||0,K=W.byteLength||0,G=W.count,z=W.byteStride,F=new Uint8Array(G*z),H=J.json.buffers[W.buffer],V=H.uri?J.resources[H.uri]:J.resources[cj],q=B6.toView(V,X,K);this._decoder.decodeGltfBuffer(F,G,z,q,W.mode,W.filter),Z.bufferViews[Q]=F})}_prereadPrimitives(Z){let J=Z.jsonDoc;(J.json.bufferViews||[]).forEach(($)=>{if(!$.extensions||!$.extensions[y6])return;let Q=$.extensions[y6],W=Z.buffers[Q.buffer],X=Z.buffers[$.buffer],K=J.json.buffers[$.buffer];if(Mq1(K))this._decoderFallbackBufferMap.set(X,W)})}read(Z){if(!this.isRequired())return this;for(let[J,Y]of this._decoderFallbackBufferMap){for(let $ of J.listParents())if($ instanceof N0)$.swap(J,Y);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,Y=this._encoder,$=this._encoderOptions,Q=this.document.getGraph(),W=this.document.createBuffer(),X=this.document.getRoot().listBuffers().indexOf(W),K=1,G=new Map,z=(F)=>{for(let H of Q.listParents(F)){if(H.propertyType===s.ROOT)continue;let V=G.get(F);if(V===void 0)G.set(F,V=K++);return V}return-1};this._encoderFallbackBuffer=W,this._encoderBufferViews={},this._encoderBufferViewData={},this._encoderBufferViewAccessors={};for(let F of this.document.getRoot().listAccessors()){if(Np(F)==="weights")continue;if(F.getSparse())continue;let H=Z.getAccessorUsage(F),V=Z.accessorUsageGroupedByParent.has(H)?z(F):null,q=Bq1(F,H),U=$.method===lG.FILTER?Oq1(F,this.document):{filter:z8.NONE},w=qq1(F,Y,q,U),{array:L,byteStride:O}=w,N=F.getBuffer();if(!N)throw new Error(`${y6}: Missing buffer for accessor.`);let j=this.document.getRoot().listBuffers().indexOf(N),R=[H,V,q,U.filter,O,j].join(":"),D=this._encoderBufferViews[R],P=this._encoderBufferViewData[R],C=this._encoderBufferViewAccessors[R];if(!D||!P)C=this._encoderBufferViewAccessors[R]=[],P=this._encoderBufferViewData[R]=[],D=this._encoderBufferViews[R]={buffer:X,target:uZ.USAGE_TO_TARGET[H],byteOffset:0,byteLength:0,byteStride:H===uZ.BufferViewUsage.ARRAY_BUFFER?O:void 0,extensions:{[y6]:{buffer:j,byteOffset:0,byteLength:0,mode:q,filter:U.filter!==z8.NONE?U.filter:void 0,byteStride:O,count:0}}};let T=Z.createAccessorDef(F);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(F,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+=F.getCount()}}_prewriteBuffers(Z){let J=this._encoder;for(let Y in this._encoderBufferViews){let $=this._encoderBufferViews[Y],Q=this._encoderBufferViewData[Y],W=this.document.getRoot().listBuffers()[$.extensions[y6].buffer],X=Z.otherBufferViews.get(W)||[],{count:K,byteStride:G,mode:z}=$.extensions[y6],F=B6.concat(Q),H=J.encodeGltfBuffer(F,K,G,z),V=B6.pad(H);$.extensions[y6].byteLength=H.byteLength,Q.length=0,Q.push(V),X.push(V),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 q of z)q.bufferView=G;let F=Z.jsonDoc.json.bufferViews[G],H=F.byteOffset||0;Object.assign(F,X),F.byteOffset=J;let V=F.extensions[y6];V.byteOffset=H,J+=B6.padNumber(X.byteLength)}let Y=this._encoderFallbackBuffer,$=Z.bufferIndexMap.get(Y),Q=Z.jsonDoc.json.buffers[$];return Q.byteLength=J,Q.extensions={[y6]:{fallback:!0}},Y.dispose(),this}}iG.EXTENSION_NAME=y6;iG.EncoderMethod=lG;var dG=Gq1;class Rp{match(Z){return Z.length>=12&&B6.decodeText(Z.slice(4,12))==="ftypavif"}getSize(Z){if(!this.match(Z))return null;let J=new DataView(Z.buffer,Z.byteOffset,Z.byteLength),Y=zp(J,0);if(!Y)return null;let $=Y.end;while(Y=zp(J,$))if(Y.type==="meta")$=Y.start+4;else if(Y.type==="iprp"||Y.type==="ipco")$=Y.start;else if(Y.type==="ispe")return[J.getUint32(Y.start+4),J.getUint32(Y.start+8)];else if(Y.type==="mdat")break;else $=Y.end;return null}getChannels(Z){return 4}}class mU extends E1{constructor(...Z){super(...Z);this.extensionName=dG,this.prereadTypes=[s.TEXTURE]}static register(){a9.registerFormat("image/avif",new Rp)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((Y)=>{if(Y.extensions&&Y.extensions[dG])Y.source=Y.extensions[dG].source}),this}read(Z){return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listTextures().forEach((Y)=>{if(Y.getMimeType()==="image/avif"){let $=Z.imageIndexMap.get(Y);(J.json.textures||[]).forEach((W)=>{if(W.source===$)W.extensions=W.extensions||{},W.extensions[dG]={source:W.source},delete W.source})}}),this}}mU.EXTENSION_NAME=dG;function zp(Z,J){if(Z.byteLength<4+J)return null;let Y=Z.getUint32(J);if(Z.byteLength<Y+J||Y<8)return null;return{type:B6.decodeText(new Uint8Array(Z.buffer,Z.byteOffset+J+4,4)),start:J+8,end:J+Y}}var uG=Kq1;class jp{match(Z){return Z.length>=12&&Z[8]===87&&Z[9]===69&&Z[10]===66&&Z[11]===80}getSize(Z){let J=B6.decodeText(Z.slice(0,4)),Y=B6.decodeText(Z.slice(8,12));if(J!=="RIFF"||Y!=="WEBP")return null;let $=new DataView(Z.buffer,Z.byteOffset),Q=12;while(Q<$.byteLength){let W=B6.decodeText(new Uint8Array([$.getUint8(Q),$.getUint8(Q+1),$.getUint8(Q+2),$.getUint8(Q+3)])),X=$.getUint32(Q+4,!0);if(W==="VP8 "){let K=$.getInt16(Q+14,!0)&16383,G=$.getInt16(Q+16,!0)&16383;return[K,G]}else if(W==="VP8L"){let K=$.getUint8(Q+9),G=$.getUint8(Q+10),z=$.getUint8(Q+11),F=$.getUint8(Q+12),H=1+((G&63)<<8|K),V=1+((F&15)<<10|z<<2|(G&192)>>6);return[H,V]}Q+=8+X+X%2}return null}getChannels(Z){return 4}}class dU extends E1{constructor(...Z){super(...Z);this.extensionName=uG,this.prereadTypes=[s.TEXTURE]}static register(){a9.registerFormat("image/webp",new jp)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((Y)=>{if(Y.extensions&&Y.extensions[uG])Y.source=Y.extensions[uG].source}),this}read(Z){return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listTextures().forEach((Y)=>{if(Y.getMimeType()==="image/webp"){let $=Z.imageIndexMap.get(Y);(J.json.textures||[]).forEach((W)=>{if(W.source===$)W.extensions=W.extensions||{},W.extensions[uG]={source:W.source},delete W.source})}}),this}}dU.EXTENSION_NAME=uG;var Fp=Mp,m8,Pp,Dp;function Nq1(Z,J){let Y=new m8.DecoderBuffer;try{if(Y.Init(J,J.length),Z.GetEncodedGeometryType(Y)!==m8.TRIANGULAR_MESH)throw new Error(`[${Fp}] Unknown geometry type.`);let Q=new m8.Mesh;if(!Z.DecodeBufferToMesh(Y,Q).ok()||Q.ptr===0)throw new Error(`[${Fp}] Decoding failure.`);return Q}finally{m8.destroy(Y)}}function Rq1(Z,J){let $=J.num_faces()*3,Q,W;if(J.num_points()<=65534){let X=$*Uint16Array.BYTES_PER_ELEMENT;Q=m8._malloc(X),Z.GetTrianglesUInt16Array(J,X,Q),W=new Uint16Array(m8.HEAPU16.buffer,Q,$).slice()}else{let X=$*Uint32Array.BYTES_PER_ELEMENT;Q=m8._malloc(X),Z.GetTrianglesUInt32Array(J,X,Q),W=new Uint32Array(m8.HEAPU32.buffer,Q,$).slice()}return m8._free(Q),W}function jq1(Z,J,Y,$){let Q=Dp[$.componentType],W=Pp[$.componentType],X=Y.num_components(),G=J.num_points()*X,z=G*W.BYTES_PER_ELEMENT,F=m8._malloc(z);Z.GetAttributeDataArrayForAllPoints(J,Y,Q,z,F);let H=new W(m8.HEAPF32.buffer,F,G).slice();return m8._free(F),H}function Pq1(Z){m8=Z,Pp={[N0.ComponentType.FLOAT]:Float32Array,[N0.ComponentType.UNSIGNED_INT]:Uint32Array,[N0.ComponentType.UNSIGNED_SHORT]:Uint16Array,[N0.ComponentType.UNSIGNED_BYTE]:Uint8Array,[N0.ComponentType.SHORT]:Int16Array,[N0.ComponentType.BYTE]:Int8Array},Dp={[N0.ComponentType.FLOAT]:m8.DT_FLOAT32,[N0.ComponentType.UNSIGNED_INT]:m8.DT_UINT32,[N0.ComponentType.UNSIGNED_SHORT]:m8.DT_UINT16,[N0.ComponentType.UNSIGNED_BYTE]:m8.DT_UINT8,[N0.ComponentType.SHORT]:m8.DT_INT16,[N0.ComponentType.BYTE]:m8.DT_INT8}}var J9,pG;(function(Z){Z[Z.EDGEBREAKER=1]="EDGEBREAKER",Z[Z.SEQUENTIAL=0]="SEQUENTIAL"})(pG||(pG={}));var Y9;(function(Z){Z.POSITION="POSITION",Z.NORMAL="NORMAL",Z.COLOR="COLOR",Z.TEX_COORD="TEX_COORD",Z.GENERIC="GENERIC"})(Y9||(Y9={}));var Cp={[Y9.POSITION]:14,[Y9.NORMAL]:10,[Y9.COLOR]:8,[Y9.TEX_COORD]:12,[Y9.GENERIC]:12},Hp={decodeSpeed:5,encodeSpeed:5,method:pG.EDGEBREAKER,quantizationBits:Cp,quantizationVolume:"mesh"};function Dq1(Z){J9=Z}function Cq1(Z,J=Hp){let Y=y7({},Hp,J);Y.quantizationBits=y7({},Cp,J.quantizationBits);let $=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=Tq1(w),N=kq1($,L.getComponentType(),Q,J9[O],L.getCount(),L.getElementSize(),L.getArray());if(N===-1)throw new Error(`Error compressing "${w}" attribute.`);if(X[w]=N,Y.quantizationVolume==="mesh"||w!=="POSITION")W.SetAttributeQuantization(N,Y.quantizationBits[O]);else if(typeof Y.quantizationVolume==="object"){let{quantizationVolume:j}=Y,R=Math.max(j.max[0]-j.min[0],j.max[1]-j.min[1],j.max[2]-j.min[2]);W.SetAttributeExplicitQuantization(N,Y.quantizationBits[O],L.getElementSize(),j.min,R)}else throw new Error("Invalid quantization volume state.")}let F=Z.getIndices();if(!F)throw new yU("Primitive must have indices.");if($.AddFacesToMesh(Q,F.getCount()/3,F.getArray()),W.SetSpeedOptions(Y.encodeSpeed,Y.decodeSpeed),W.SetTrackEncodedProperties(!0),Y.method===pG.SEQUENTIAL||G||z)W.SetEncodingMethod(J9.MESH_SEQUENTIAL_ENCODING);else W.SetEncodingMethod(J9.MESH_EDGEBREAKER_ENCODING);let H=W.EncodeToDracoBuffer(!(G||z),K);if(H<=0)throw new yU("Error applying Draco compression.");let V=new Uint8Array(H);for(let w=0;w<H;++w)V[w]=K.GetValue(w);let q=W.GetNumberOfEncodedPoints(),U=W.GetNumberOfEncodedFaces()*3;return J9.destroy(K),J9.destroy(Q),J9.destroy($),J9.destroy(W),{numVertices:q,numIndices:U,data:V,attributeIDs:X}}function Tq1(Z){if(Z==="POSITION")return Y9.POSITION;else if(Z==="NORMAL")return Y9.NORMAL;else if(Z.startsWith("COLOR_"))return Y9.COLOR;else if(Z.startsWith("TEXCOORD_"))return Y9.TEX_COORD;return Y9.GENERIC}function kq1(Z,J,Y,$,Q,W,X){switch(J){case N0.ComponentType.UNSIGNED_BYTE:return Z.AddUInt8Attribute(Y,$,Q,W,X);case N0.ComponentType.BYTE:return Z.AddInt8Attribute(Y,$,Q,W,X);case N0.ComponentType.UNSIGNED_SHORT:return Z.AddUInt16Attribute(Y,$,Q,W,X);case N0.ComponentType.SHORT:return Z.AddInt16Attribute(Y,$,Q,W,X);case N0.ComponentType.UNSIGNED_INT:return Z.AddUInt32Attribute(Y,$,Q,W,X);case N0.ComponentType.FLOAT:return Z.AddFloatAttribute(Y,$,Q,W,X);default:throw new Error(`Unexpected component type, "${J}".`)}}class yU extends Error{}var j8=Mp;class nG extends E1{constructor(...Z){super(...Z);this.extensionName=j8,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,Pq1(this._decoderModule);if(Z==="draco3d.encoder")this._encoderModule=J,Dq1(this._encoderModule);return this}setEncoderOptions(Z){return this._encoderOptions=Z,this}preread(Z){if(!this._decoderModule)throw new Error(`[${j8}] Please install extension dependency, "draco3d.decoder".`);let J=this.document.getLogger(),Y=Z.jsonDoc,$=new Map;try{let Q=Y.json.meshes||[];for(let W of Q)for(let X of W.primitives){if(!X.extensions||!X.extensions[j8])continue;let K=X.extensions[j8],[G,z]=$.get(K.bufferView)||[];if(!z||!G){let F=Y.json.bufferViews[K.bufferView],H=Y.json.buffers[F.buffer],V=H.uri?Y.resources[H.uri]:Y.resources[cj],q=F.byteOffset||0,U=F.byteLength,w=B6.toView(V,q,U);G=new this._decoderModule.Decoder,z=Nq1(G,w),$.set(K.bufferView,[G,z]),J.debug(`[${j8}] Decompressed ${w.byteLength} bytes.`)}for(let F in K.attributes){let H=Z.jsonDoc.json.accessors[X.attributes[F]],V=G.GetAttributeByUniqueId(z,K.attributes[F]),q=jq1(G,z,V,H);Z.accessors[X.attributes[F]].setArray(q)}if(X.indices!==void 0)Z.accessors[X.indices].setArray(Rq1(G,z))}}finally{for(let[Q,W]of Array.from($.values()))this._decoderModule.destroy(Q),this._decoderModule.destroy(W)}return this}read(Z){return this}prewrite(Z,J){if(!this._encoderModule)throw new Error(`[${j8}] Please install extension dependency, "draco3d.encoder".`);let Y=this.document.getLogger();Y.debug(`[${j8}] Compression options: ${JSON.stringify(this._encoderOptions)}`);let $=Eq1(this.document),Q=new Map,W="mesh";if(this._encoderOptions.quantizationVolume==="scene")if(this.document.getRoot().listScenes().length!==1)Y.warn(`[${j8}]: quantizationVolume=scene requires exactly 1 scene.`);else W=rl(this.document.getRoot().listScenes().pop());for(let X of Array.from($.keys())){let K=$.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,F;try{F=Cq1(X,y7({},this._encoderOptions,{quantizationVolume:W}))}catch(q){if(q instanceof yU){Y.warn(`[${j8}]: ${q.message} Skipping primitive compression.`);continue}throw q}Q.set(K,F);let H=Z.createAccessorDef(G);if(H.count=F.numIndices,Z.accessorIndexMap.set(G,z.length),z.push(H),F.numVertices>65534&&N0.getComponentSize(H.componentType)<=2)H.componentType=N0.ComponentType.UNSIGNED_INT;else if(F.numVertices>254&&N0.getComponentSize(H.componentType)<=1)H.componentType=N0.ComponentType.UNSIGNED_SHORT;for(let q of X.listSemantics()){let U=X.getAttribute(q);if(F.attributeIDs[q]===void 0)continue;let w=Z.createAccessorDef(U);w.count=F.numVertices,Z.accessorIndexMap.set(U,z.length),z.push(w)}let V=X.getAttribute("POSITION").getBuffer()||this.document.getRoot().listBuffers()[0];if(!Z.otherBufferViews.has(V))Z.otherBufferViews.set(V,[]);Z.otherBufferViews.get(V).push(F.data)}return Y.debug(`[${j8}] Compressed ${$.size} primitives.`),Z.extensionData[j8]={primitiveHashMap:$,primitiveEncodingMap:Q},this}write(Z){let J=Z.extensionData[j8];for(let Y of this.document.getRoot().listMeshes()){let $=Z.jsonDoc.json.meshes[Z.meshIndexMap.get(Y)];for(let Q=0;Q<Y.listPrimitives().length;Q++){let W=Y.listPrimitives()[Q],X=$.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[j8]={bufferView:Z.otherBufferViewsIndexMap.get(G.data),attributes:G.attributeIDs}}}if(!J.primitiveHashMap.size){let Y=Z.jsonDoc.json;Y.extensionsUsed=(Y.extensionsUsed||[]).filter(($)=>$!==j8),Y.extensionsRequired=(Y.extensionsRequired||[]).filter(($)=>$!==j8)}return this}}nG.EXTENSION_NAME=j8;nG.EncoderMethod=pG;function Eq1(Z){let J=Z.getLogger(),Y=new Set,$=new Set,Q=0,W=0;for(let H of Z.getRoot().listMeshes())for(let V of H.listPrimitives())if(!V.getIndices())$.add(V),Q++;else if(V.getMode()!==dZ.Mode.TRIANGLES)$.add(V),W++;else Y.add(V);if(Q>0)J.warn(`[${j8}] Skipping Draco compression of ${Q} non-indexed primitives.`);if(W>0)J.warn(`[${j8}] Skipping Draco compression of ${W} non-TRIANGLES primitives.`);let X=Z.getRoot().listAccessors(),K=new Map;for(let H=0;H<X.length;H++)K.set(X[H],H);let G=new Map,z=new Set,F=new Map;for(let H of Array.from(Y)){let V=Vp(H,K);if(z.has(V)){F.set(H,V);continue}if(G.has(H.getIndices())){let q=H.getIndices(),U=q.clone();K.set(U,Z.getRoot().listAccessors().length-1),H.swap(q,U)}for(let q of H.listAttributes())if(G.has(q)){let U=q.clone();K.set(U,Z.getRoot().listAccessors().length-1),H.swap(q,U)}V=Vp(H,K),z.add(V),F.set(H,V),G.set(H.getIndices(),V);for(let q of H.listAttributes())G.set(q,V)}for(let H of Array.from(G.keys())){let V=new Set(H.listParents().map((q)=>q.propertyType));if(V.size!==2||!V.has(s.PRIMITIVE)||!V.has(s.ROOT))throw new Error(`[${j8}] Compressed accessors must only be used as indices or vertex attributes.`)}for(let H of Array.from(Y)){let V=F.get(H),q=H.getIndices();if(G.get(q)!==V||H.listAttributes().some((U)=>G.get(U)!==V))throw new Error(`[${j8}] Draco primitives must share all, or no, accessors.`)}for(let H of Array.from($)){let V=H.getIndices();if(G.has(V)||H.listAttributes().some((q)=>G.has(q)))throw new Error(`[${j8}] Accessor cannot be shared by compressed and uncompressed primitives.`)}return F}function Vp(Z,J){let Y=[],$=Z.getIndices();Y.push(J.get($));for(let Q of Z.listAttributes())Y.push(J.get(Q));return Y.sort().join("|")}class RW extends i1{init(){this.extensionName=$P,this.propertyType="Light",this.parentTypes=[s.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{color:[1,1,1],intensity:1,type:RW.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)}}RW.EXTENSION_NAME=$P;RW.Type={POINT:"point",SPOT:"spot",DIRECTIONAL:"directional"};var x4=$P;class MP extends E1{constructor(...Z){super(...Z);this.extensionName=x4}createLight(Z=""){return new RW(this.document.getGraph(),Z)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[x4])return this;let Q=(J.json.extensions[x4].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[x4])return;let K=W.extensions[x4];Z.nodes[X].setExtension(x4,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()===RW.Type.SPOT)X.spot={innerConeAngle:W.getInnerConeAngle(),outerConeAngle:W.getOuterConeAngle()};Y.push(X),$.set(W,Y.length-1)}return this.document.getRoot().listNodes().forEach((Q)=>{let W=Q.getExtension(x4);if(W){let X=Z.nodeIndexMap.get(Q),K=J.json.nodes[X];K.extensions=K.extensions||{},K.extensions[x4]={light:$.get(W)}}}),J.json.extensions=J.json.extensions||{},J.json.extensions[x4]={lights:Y},this}}MP.EXTENSION_NAME=x4;var{R:Iq1,G:vq1,B:Sq1}=h5;class NP extends i1{init(){this.extensionName=QP,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:Iq1|vq1|Sq1})}}NP.EXTENSION_NAME=QP;var _Y=QP;class RP extends E1{constructor(...Z){super(...Z);this.extensionName=_Y,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createAnisotropy(){return new NP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,Y=J.json.materials||[],$=J.json.textures||[];return Y.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[_Y]){let X=this.createAnisotropy();Z.materials[W].setExtension(_Y,X);let K=Q.extensions[_Y];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[$[G.index].source];X.setAnisotropyTexture(z),Z.setTextureInfo(X.getAnisotropyTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{let $=Y.getExtension(_Y);if($){let Q=Z.materialIndexMap.get(Y),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[_Y]={};if($.getAnisotropyStrength()>0)X.anisotropyStrength=$.getAnisotropyStrength();if($.getAnisotropyRotation()!==0)X.anisotropyRotation=$.getAnisotropyRotation();if($.getAnisotropyTexture()){let K=$.getAnisotropyTexture(),G=$.getAnisotropyTextureInfo();X.anisotropyTexture=Z.createTextureInfoDef(K,G)}}}),this}}RP.EXTENSION_NAME=_Y;var{R:qp,G:Up,B:_q1}=h5;class jP extends i1{init(){this.extensionName=WP,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:qp})}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:Up})}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:qp|Up|_q1})}}jP.EXTENSION_NAME=WP;var AY=WP;class PP extends E1{constructor(...Z){super(...Z);this.extensionName=AY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createClearcoat(){return new jP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,Y=J.json.materials||[],$=J.json.textures||[];return Y.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[AY]){let X=this.createClearcoat();Z.materials[W].setExtension(AY,X);let K=Q.extensions[AY];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[$[G.index].source];X.setClearcoatTexture(z),Z.setTextureInfo(X.getClearcoatTextureInfo(),G)}if(K.clearcoatRoughnessTexture!==void 0){let G=K.clearcoatRoughnessTexture,z=Z.textures[$[G.index].source];X.setClearcoatRoughnessTexture(z),Z.setTextureInfo(X.getClearcoatRoughnessTextureInfo(),G)}if(K.clearcoatNormalTexture!==void 0){let G=K.clearcoatNormalTexture,z=Z.textures[$[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((Y)=>{let $=Y.getExtension(AY);if($){let Q=Z.materialIndexMap.get(Y),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[AY]={clearcoatFactor:$.getClearcoatFactor(),clearcoatRoughnessFactor:$.getClearcoatRoughnessFactor()};if($.getClearcoatTexture()){let K=$.getClearcoatTexture(),G=$.getClearcoatTextureInfo();X.clearcoatTexture=Z.createTextureInfoDef(K,G)}if($.getClearcoatRoughnessTexture()){let K=$.getClearcoatRoughnessTexture(),G=$.getClearcoatRoughnessTextureInfo();X.clearcoatRoughnessTexture=Z.createTextureInfoDef(K,G)}if($.getClearcoatNormalTexture()){let K=$.getClearcoatNormalTexture(),G=$.getClearcoatNormalTextureInfo();if(X.clearcoatNormalTexture=Z.createTextureInfoDef(K,G),$.getClearcoatNormalScale()!==1)X.clearcoatNormalTexture.scale=$.getClearcoatNormalScale()}}}),this}}PP.EXTENSION_NAME=AY;var{R:Aq1,G:xq1,B:hq1,A:fq1}=h5;class DP extends i1{init(){this.extensionName=XP,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:fq1})}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:Aq1|xq1|hq1})}}DP.EXTENSION_NAME=XP;var xY=XP;class CP extends E1{constructor(...Z){super(...Z);this.extensionName=xY}createDiffuseTransmission(){return new DP(this.document.getGraph())}read(Z){let J=Z.jsonDoc,Y=J.json.materials||[],$=J.json.textures||[];return Y.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[xY]){let X=this.createDiffuseTransmission();Z.materials[W].setExtension(xY,X);let K=Q.extensions[xY];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[$[G.index].source];X.setDiffuseTransmissionTexture(z),Z.setTextureInfo(X.getDiffuseTransmissionTextureInfo(),G)}if(K.diffuseTransmissionColorTexture!==void 0){let G=K.diffuseTransmissionColorTexture,z=Z.textures[$[G.index].source];X.setDiffuseTransmissionColorTexture(z),Z.setTextureInfo(X.getDiffuseTransmissionColorTextureInfo(),G)}}}),this}write(Z){let J=Z.jsonDoc;for(let Y of this.document.getRoot().listMaterials()){let $=Y.getExtension(xY);if(!$)continue;let Q=Z.materialIndexMap.get(Y),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[xY]={diffuseTransmissionFactor:$.getDiffuseTransmissionFactor(),diffuseTransmissionColorFactor:$.getDiffuseTransmissionColorFactor()};if($.getDiffuseTransmissionTexture()){let K=$.getDiffuseTransmissionTexture(),G=$.getDiffuseTransmissionTextureInfo();X.diffuseTransmissionTexture=Z.createTextureInfoDef(K,G)}if($.getDiffuseTransmissionColorTexture()){let K=$.getDiffuseTransmissionColorTexture(),G=$.getDiffuseTransmissionColorTextureInfo();X.diffuseTransmissionColorTexture=Z.createTextureInfoDef(K,G)}}return this}}CP.EXTENSION_NAME=xY;class TP extends i1{init(){this.extensionName=KP,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)}}TP.EXTENSION_NAME=KP;var hY=KP;class kP extends E1{constructor(...Z){super(...Z);this.extensionName=hY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createDispersion(){return new TP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){return(Z.jsonDoc.json.materials||[]).forEach(($,Q)=>{if($.extensions&&$.extensions[hY]){let W=this.createDispersion();Z.materials[Q].setExtension(hY,W);let X=$.extensions[hY];if(X.dispersion!==void 0)W.setDispersion(X.dispersion)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{let $=Y.getExtension(hY);if($){let Q=Z.materialIndexMap.get(Y),W=J.json.materials[Q];W.extensions=W.extensions||{},W.extensions[hY]={dispersion:$.getDispersion()}}}),this}}kP.EXTENSION_NAME=hY;class EP extends i1{init(){this.extensionName=GP,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)}}EP.EXTENSION_NAME=GP;var fY=GP;class IP extends E1{constructor(...Z){super(...Z);this.extensionName=fY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createEmissiveStrength(){return new EP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){return(Z.jsonDoc.json.materials||[]).forEach(($,Q)=>{if($.extensions&&$.extensions[fY]){let W=this.createEmissiveStrength();Z.materials[Q].setExtension(fY,W);let X=$.extensions[fY];if(X.emissiveStrength!==void 0)W.setEmissiveStrength(X.emissiveStrength)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{let $=Y.getExtension(fY);if($){let Q=Z.materialIndexMap.get(Y),W=J.json.materials[Q];W.extensions=W.extensions||{},W.extensions[fY]={emissiveStrength:$.getEmissiveStrength()}}}),this}}IP.EXTENSION_NAME=fY;class vP extends i1{init(){this.extensionName=zP,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)}}vP.EXTENSION_NAME=zP;var yY=zP;class uU extends E1{constructor(...Z){super(...Z);this.extensionName=yY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createIOR(){return new vP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){return(Z.jsonDoc.json.materials||[]).forEach(($,Q)=>{if($.extensions&&$.extensions[yY]){let W=this.createIOR();Z.materials[Q].setExtension(yY,W);let X=$.extensions[yY];if(X.ior!==void 0)W.setIOR(X.ior)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{let $=Y.getExtension(yY);if($){let Q=Z.materialIndexMap.get(Y),W=J.json.materials[Q];W.extensions=W.extensions||{},W.extensions[yY]={ior:$.getIOR()}}}),this}}uU.EXTENSION_NAME=yY;var{R:yq1,G:bq1}=h5;class SP extends i1{init(){this.extensionName=FP,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:yq1})}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:bq1})}}SP.EXTENSION_NAME=FP;var bY=FP;class _P extends E1{constructor(...Z){super(...Z);this.extensionName=bY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createIridescence(){return new SP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,Y=J.json.materials||[],$=J.json.textures||[];return Y.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[bY]){let X=this.createIridescence();Z.materials[W].setExtension(bY,X);let K=Q.extensions[bY];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[$[G.index].source];X.setIridescenceTexture(z),Z.setTextureInfo(X.getIridescenceTextureInfo(),G)}if(K.iridescenceThicknessTexture!==void 0){let G=K.iridescenceThicknessTexture,z=Z.textures[$[G.index].source];X.setIridescenceThicknessTexture(z),Z.setTextureInfo(X.getIridescenceThicknessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{let $=Y.getExtension(bY);if($){let Q=Z.materialIndexMap.get(Y),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[bY]={};if($.getIridescenceFactor()>0)X.iridescenceFactor=$.getIridescenceFactor();if($.getIridescenceIOR()!==1.3)X.iridescenceIor=$.getIridescenceIOR();if($.getIridescenceThicknessMinimum()!==100)X.iridescenceThicknessMinimum=$.getIridescenceThicknessMinimum();if($.getIridescenceThicknessMaximum()!==400)X.iridescenceThicknessMaximum=$.getIridescenceThicknessMaximum();if($.getIridescenceTexture()){let K=$.getIridescenceTexture(),G=$.getIridescenceTextureInfo();X.iridescenceTexture=Z.createTextureInfoDef(K,G)}if($.getIridescenceThicknessTexture()){let K=$.getIridescenceThicknessTexture(),G=$.getIridescenceThicknessTextureInfo();X.iridescenceThicknessTexture=Z.createTextureInfoDef(K,G)}}}),this}}_P.EXTENSION_NAME=bY;var{R:Lp,G:wp,B:Bp,A:Op}=h5;class AP extends i1{init(){this.extensionName=HP,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:Lp|wp|Bp|Op,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:Lp|wp|Bp|Op})}}AP.EXTENSION_NAME=HP;var gY=HP;class cU extends E1{constructor(...Z){super(...Z);this.extensionName=gY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createPBRSpecularGlossiness(){return new AP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,Y=J.json.materials||[],$=J.json.textures||[];return Y.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[gY]){let X=this.createPBRSpecularGlossiness();Z.materials[W].setExtension(gY,X);let K=Q.extensions[gY];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[$[G.index].source];X.setDiffuseTexture(z),Z.setTextureInfo(X.getDiffuseTextureInfo(),G)}if(K.specularGlossinessTexture!==void 0){let G=K.specularGlossinessTexture,z=Z.textures[$[G.index].source];X.setSpecularGlossinessTexture(z),Z.setTextureInfo(X.getSpecularGlossinessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{let $=Y.getExtension(gY);if($){let Q=Z.materialIndexMap.get(Y),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[gY]={diffuseFactor:$.getDiffuseFactor(),specularFactor:$.getSpecularFactor(),glossinessFactor:$.getGlossinessFactor()};if($.getDiffuseTexture()){let K=$.getDiffuseTexture(),G=$.getDiffuseTextureInfo();X.diffuseTexture=Z.createTextureInfoDef(K,G)}if($.getSpecularGlossinessTexture()){let K=$.getSpecularGlossinessTexture(),G=$.getSpecularGlossinessTextureInfo();X.specularGlossinessTexture=Z.createTextureInfoDef(K,G)}}}),this}}cU.EXTENSION_NAME=gY;var{R:gq1,G:mq1,B:dq1,A:uq1}=h5;class xP extends i1{init(){this.extensionName=VP,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:gq1|mq1|dq1,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:uq1})}}xP.EXTENSION_NAME=VP;var mY=VP;class hP extends E1{constructor(...Z){super(...Z);this.extensionName=mY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createSheen(){return new xP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,Y=J.json.materials||[],$=J.json.textures||[];return Y.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[mY]){let X=this.createSheen();Z.materials[W].setExtension(mY,X);let K=Q.extensions[mY];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[$[G.index].source];X.setSheenColorTexture(z),Z.setTextureInfo(X.getSheenColorTextureInfo(),G)}if(K.sheenRoughnessTexture!==void 0){let G=K.sheenRoughnessTexture,z=Z.textures[$[G.index].source];X.setSheenRoughnessTexture(z),Z.setTextureInfo(X.getSheenRoughnessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{let $=Y.getExtension(mY);if($){let Q=Z.materialIndexMap.get(Y),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[mY]={sheenColorFactor:$.getSheenColorFactor(),sheenRoughnessFactor:$.getSheenRoughnessFactor()};if($.getSheenColorTexture()){let K=$.getSheenColorTexture(),G=$.getSheenColorTextureInfo();X.sheenColorTexture=Z.createTextureInfoDef(K,G)}if($.getSheenRoughnessTexture()){let K=$.getSheenRoughnessTexture(),G=$.getSheenRoughnessTextureInfo();X.sheenRoughnessTexture=Z.createTextureInfoDef(K,G)}}}),this}}hP.EXTENSION_NAME=mY;var{R:cq1,G:lq1,B:pq1,A:iq1}=h5;class fP extends i1{init(){this.extensionName=qP,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:iq1})}getSpecularColorTexture(){return this.getRef("specularColorTexture")}getSpecularColorTextureInfo(){return this.getRef("specularColorTexture")?this.getRef("specularColorTextureInfo"):null}setSpecularColorTexture(Z){return this.setRef("specularColorTexture",Z,{channels:cq1|lq1|pq1,isColor:!0})}}fP.EXTENSION_NAME=qP;var dY=qP;class lU extends E1{constructor(...Z){super(...Z);this.extensionName=dY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createSpecular(){return new fP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,Y=J.json.materials||[],$=J.json.textures||[];return Y.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[dY]){let X=this.createSpecular();Z.materials[W].setExtension(dY,X);let K=Q.extensions[dY];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[$[G.index].source];X.setSpecularTexture(z),Z.setTextureInfo(X.getSpecularTextureInfo(),G)}if(K.specularColorTexture!==void 0){let G=K.specularColorTexture,z=Z.textures[$[G.index].source];X.setSpecularColorTexture(z),Z.setTextureInfo(X.getSpecularColorTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{let $=Y.getExtension(dY);if($){let Q=Z.materialIndexMap.get(Y),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[dY]={};if($.getSpecularFactor()!==1)X.specularFactor=$.getSpecularFactor();if(!G8.eq($.getSpecularColorFactor(),[1,1,1]))X.specularColorFactor=$.getSpecularColorFactor();if($.getSpecularTexture()){let K=$.getSpecularTexture(),G=$.getSpecularTextureInfo();X.specularTexture=Z.createTextureInfoDef(K,G)}if($.getSpecularColorTexture()){let K=$.getSpecularColorTexture(),G=$.getSpecularColorTextureInfo();X.specularColorTexture=Z.createTextureInfoDef(K,G)}}}),this}}lU.EXTENSION_NAME=dY;var{R:nq1}=h5;class yP extends i1{init(){this.extensionName=UP,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:nq1})}}yP.EXTENSION_NAME=UP;var uY=UP;class bP extends E1{constructor(...Z){super(...Z);this.extensionName=uY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createTransmission(){return new yP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,Y=J.json.materials||[],$=J.json.textures||[];return Y.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[uY]){let X=this.createTransmission();Z.materials[W].setExtension(uY,X);let K=Q.extensions[uY];if(K.transmissionFactor!==void 0)X.setTransmissionFactor(K.transmissionFactor);if(K.transmissionTexture!==void 0){let G=K.transmissionTexture,z=Z.textures[$[G.index].source];X.setTransmissionTexture(z),Z.setTextureInfo(X.getTransmissionTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{let $=Y.getExtension(uY);if($){let Q=Z.materialIndexMap.get(Y),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[uY]={transmissionFactor:$.getTransmissionFactor()};if($.getTransmissionTexture()){let K=$.getTransmissionTexture(),G=$.getTransmissionTextureInfo();X.transmissionTexture=Z.createTextureInfoDef(K,G)}}}),this}}bP.EXTENSION_NAME=uY;class gP extends i1{init(){this.extensionName=LP,this.propertyType="Unlit",this.parentTypes=[s.MATERIAL]}}gP.EXTENSION_NAME=LP;var MW=LP;class pU extends E1{constructor(...Z){super(...Z);this.extensionName=MW,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createUnlit(){return new gP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){return(Z.jsonDoc.json.materials||[]).forEach((Y,$)=>{if(Y.extensions&&Y.extensions[MW])Z.materials[$].setExtension(MW,this.createUnlit())}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{if(Y.getExtension(MW)){let $=Z.materialIndexMap.get(Y),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[MW]={}}}),this}}pU.EXTENSION_NAME=MW;class mP extends i1{init(){this.extensionName=pY,this.propertyType="Mapping",this.parentTypes=["MappingList"]}getDefaults(){return Object.assign(super.getDefaults(),{material:null,variants:new j0})}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")}}mP.EXTENSION_NAME=pY;class dP extends i1{init(){this.extensionName=pY,this.propertyType="MappingList",this.parentTypes=[s.PRIMITIVE]}getDefaults(){return Object.assign(super.getDefaults(),{mappings:new j0})}addMapping(Z){return this.addRef("mappings",Z)}removeMapping(Z){return this.removeRef("mappings",Z)}listMappings(){return this.listRefs("mappings")}}dP.EXTENSION_NAME=pY;class bU extends i1{init(){this.extensionName=pY,this.propertyType="Variant",this.parentTypes=["MappingList"]}}bU.EXTENSION_NAME=pY;var h4=pY;class uP extends E1{constructor(...Z){super(...Z);this.extensionName=h4}createMappingList(){return new dP(this.document.getGraph())}createVariant(Z=""){return new bU(this.document.getGraph(),Z)}createMapping(){return new mP(this.document.getGraph())}listVariants(){return Array.from(this.properties).filter((Z)=>Z instanceof bU)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[h4])return this;let Q=(J.json.extensions[h4].variants||[]).map((X)=>this.createVariant().setName(X.name||""));return(J.json.meshes||[]).forEach((X,K)=>{let G=Z.meshes[K];(X.primitives||[]).forEach((F,H)=>{if(!F.extensions||!F.extensions[h4])return;let V=this.createMappingList(),q=F.extensions[h4];for(let U of q.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]);V.addMapping(w)}G.listPrimitives()[H].setExtension(h4,V)})}),this}write(Z){let J=Z.jsonDoc,Y=this.listVariants();if(!Y.length)return this;let $=[],Q=new Map;for(let W of Y)Q.set(W,$.length),$.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(h4);if(!z)return;let F=Z.jsonDoc.json.meshes[X].primitives[G],H=z.listMappings().map((V)=>{let q=Z.createPropertyDef(V),U=V.getMaterial();if(U)q.material=Z.materialIndexMap.get(U);return q.variants=V.listVariants().map((w)=>Q.get(w)),q});F.extensions=F.extensions||{},F.extensions[h4]={mappings:H}})}return J.json.extensions=J.json.extensions||{},J.json.extensions[h4]={variants:$},this}}uP.EXTENSION_NAME=h4;var{G:aq1}=h5;class cP extends i1{init(){this.extensionName=wP,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:aq1})}getAttenuationDistance(){return this.get("attenuationDistance")}setAttenuationDistance(Z){return this.set("attenuationDistance",Z)}getAttenuationColor(){return this.get("attenuationColor")}setAttenuationColor(Z){return this.set("attenuationColor",Z)}}cP.EXTENSION_NAME=wP;var cY=wP;class lP extends E1{constructor(...Z){super(...Z);this.extensionName=cY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createVolume(){return new cP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,Y=J.json.materials||[],$=J.json.textures||[];return Y.forEach((Q,W)=>{if(Q.extensions&&Q.extensions[cY]){let X=this.createVolume();Z.materials[W].setExtension(cY,X);let K=Q.extensions[cY];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[$[G.index].source];X.setThicknessTexture(z),Z.setTextureInfo(X.getThicknessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{let $=Y.getExtension(cY);if($){let Q=Z.materialIndexMap.get(Y),W=J.json.materials[Q];W.extensions=W.extensions||{};let X=W.extensions[cY]={};if($.getThicknessFactor()>0)X.thicknessFactor=$.getThicknessFactor();if(Number.isFinite($.getAttenuationDistance()))X.attenuationDistance=$.getAttenuationDistance();if(!G8.eq($.getAttenuationColor(),[1,1,1]))X.attenuationColor=$.getAttenuationColor();if($.getThicknessTexture()){let K=$.getThicknessTexture(),G=$.getThicknessTextureInfo();X.thicknessTexture=Z.createTextureInfoDef(K,G)}}}),this}}lP.EXTENSION_NAME=cY;var Tp=zq1;class aG extends E1{constructor(...Z){super(...Z);this.extensionName=Tp}read(Z){return this}write(Z){return this}}aG.EXTENSION_NAME=Tp;var cG=Fq1;class kp{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=hU(Z);return[J.pixelWidth,J.pixelHeight]}getChannels(Z){let Y=hU(Z).dataFormatDescriptor[0];if(Y.colorModel===Qp)return Y.samples.length===2&&(Y.samples[1].channelType&15)===15?4:3;else if(Y.colorModel===Wp)return(Y.samples[0].channelType&15)===3?4:3;throw new Error(`Unexpected KTX2 colorModel, "${Y.colorModel}".`)}getVRAMByteLength(Z){let J=hU(Z),Y=this.getChannels(Z)>3,$=0;for(let Q=0;Q<J.levels.length;Q++){let W=J.levels[Q];if(W.uncompressedByteLength)$+=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=Y?16:8;$+=X/4*(K/4)*G}}return $}}class pP extends E1{constructor(...Z){super(...Z);this.extensionName=cG,this.prereadTypes=[s.TEXTURE]}static register(){a9.registerFormat("image/ktx2",new kp)}preread(Z){return Z.jsonDoc.json.textures.forEach((J)=>{if(J.extensions&&J.extensions[cG]){let Y=J.extensions[cG];J.source=Y.source}}),this}read(Z){return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listTextures().forEach((Y)=>{if(Y.getMimeType()==="image/ktx2"){let $=Z.imageIndexMap.get(Y);J.json.textures.forEach((Q)=>{if(Q.source===$)Q.extensions=Q.extensions||{},Q.extensions[cG]={source:Q.source},delete Q.source})}}),this}}pP.EXTENSION_NAME=cG;class iP extends i1{init(){this.extensionName=BP,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)}}iP.EXTENSION_NAME=BP;var lY=BP;class nP extends E1{constructor(...Z){super(...Z);this.extensionName=lY}createTransform(){return new iP(this.document.getGraph())}read(Z){for(let[J,Y]of Array.from(Z.textureInfos.entries())){if(!Y.extensions||!Y.extensions[lY])continue;let $=this.createTransform(),Q=Y.extensions[lY];if(Q.offset!==void 0)$.setOffset(Q.offset);if(Q.rotation!==void 0)$.setRotation(Q.rotation);if(Q.scale!==void 0)$.setScale(Q.scale);if(Q.texCoord!==void 0)$.setTexCoord(Q.texCoord);J.setExtension(lY,$)}return this}write(Z){let J=Array.from(Z.textureInfoDefMap.entries());for(let[Y,$]of J){let Q=Y.getExtension(lY);if(!Q)continue;$.extensions=$.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();$.extensions[lY]=W}return this}}nP.EXTENSION_NAME=lY;var sq1=[s.ROOT,s.SCENE,s.NODE,s.MESH,s.MATERIAL,s.TEXTURE,s.ANIMATION];class aP extends i1{init(){this.extensionName=fU,this.propertyType="Packet",this.parentTypes=sq1}getDefaults(){return Object.assign(super.getDefaults(),{context:{},properties:{}})}getContext(){return this.get("context")}setContext(Z){return this.set("context",y7({},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 Y=y7({},this.get("properties"));if(J)Y[Z]=J;else delete Y[Z];return this.set("properties",Y)}toJSONLD(){let Z=tj(this.get("context")),J=tj(this.get("properties"));return y7({"@context":Z},J)}fromJSONLD(Z){Z=tj(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(`${fU}: Missing context for term, "${Z}".`)}}aP.EXTENSION_NAME=fU;function tj(Z){return JSON.parse(JSON.stringify(Z))}var f7=fU;class sP extends E1{constructor(...Z){super(...Z);this.extensionName=f7}createPacket(){return new aP(this.document.getGraph())}listPackets(){return Array.from(this.properties)}read(Z){var J;let Y=(J=Z.jsonDoc.json.extensions)==null?void 0:J[f7];if(!Y||!Y.packets)return this;let $=Z.jsonDoc.json,Q=this.document.getRoot(),W=Y.packets.map((G)=>this.createPacket().fromJSONLD(G)),X=[[$.asset],$.scenes,$.nodes,$.meshes,$.materials,$.images,$.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 F=0;F<z.length;F++){let H=z[F];if(H.extensions&&H.extensions[f7]){let V=H.extensions[f7];K[G][F].setExtension(f7,W[V.packet])}}}return this}write(Z){let{json:J}=Z.jsonDoc,Y=[];for(let $ of this.properties){Y.push($.toJSONLD());for(let Q of $.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(`[${f7}]: Unsupported parent property, "${Q.propertyType}"`);break}if(!W)continue;W.extensions=W.extensions||{},W.extensions[f7]={packet:Y.length-1}}}if(Y.length>0)J.extensions=J.extensions||{},J.extensions[f7]={packets:Y};return this}}sP.EXTENSION_NAME=f7;var oq1=[nG,MP,RP,PP,CP,kP,IP,uU,_P,cU,lU,hP,bP,pU,uP,lP,aG,pP,nP,sP],RK6=[gU,iG,mU,dU,...oq1];var rq1=t(Hj(),1);function DW(){return DW=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var Y=arguments[J];for(var $ in Y)({}).hasOwnProperty.call(Y,$)&&(Z[$]=Y[$])}return Z},DW.apply(null,arguments)}var{POINTS:Ep,LINES:iU,LINE_STRIP:tq1,LINE_LOOP:eq1,TRIANGLES:nU,TRIANGLE_STRIP:ZU1,TRIANGLE_FAN:JU1}=N8.Mode;function iZ(Z,J){return Object.defineProperty(J,"name",{value:Z}),J}function f4(Z,J){let Y=DW({},Z);for(let $ in J)if(J[$]!==void 0)Y[$]=J[$];return Y}function ap(Z){let J=Z.getIndices(),Y=Z.getAttribute("POSITION");switch(Z.getMode()){case N8.Mode.POINTS:return J?J.getCount():Y.getCount();case N8.Mode.LINES:return J?J.getCount()/2:Y.getCount()/2;case N8.Mode.LINE_LOOP:return J?J.getCount():Y.getCount();case N8.Mode.LINE_STRIP:return J?J.getCount()-1:Y.getCount()-1;case N8.Mode.TRIANGLES:return J?J.getCount()/3:Y.getCount()/3;case N8.Mode.TRIANGLE_STRIP:case N8.Mode.TRIANGLE_FAN:return J?J.getCount()-2:Y.getCount()-2;default:throw new Error("Unexpected mode: "+Z.getMode())}}var YU1=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function eP(Z){return YU1.format(Z)}function $U1(Z,J,Y=2){let $=Z>J?"\u2013":"+",Q="%";return $+(Math.abs(Z-J)/Z*100).toFixed(Y)+"%"}function tU(Z,J){return`${eP(Z)} \u2192 ${eP(J)} (${$U1(Z,J)})`}function XD(Z){let J=[];for(let Y of Z.listAttributes())J.push(Y);for(let Y of Z.listTargets())for(let $ of Y.listAttributes())J.push($);return Array.from(new Set(J))}function QU1(Z,J,Y){Z.swap(J,Y);for(let $ of Z.listTargets())$.swap(J,Y)}function WU1(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 Y=0;Y<Z.length;Y++)if(Z[Y]!==J[Y])return!1;return!0}function b7(Z,J){return Z.createAccessor(J.getName()).setArray(J.getArray()).setType(J.getType()).setBuffer(J.getBuffer()).setNormalized(J.getNormalized()).setSparse(J.getSparse())}function XU1(Z,J=Z){let Y=KD(Z,J);for(let $=0;$<Y.length;$++)Y[$]=$;return Y}function KD(Z,J=Z){return J<=65534?new Uint16Array(Z):new Uint32Array(Z)}function KU1(Z){return Z.listParents().some((J)=>J.propertyType!==a.ROOT)}function sp(Z){for(let J in Z)return!1;return!0}function op(Z){let J=L6.fromGraph(Z.getGraph()),Y=Z.getMaterial(),$=J.getRoot().listMaterials().indexOf(Y),Q=zU1[Z.getMode()],W=!!Z.getIndices(),X=Z.listSemantics().sort().map((G)=>{let z=Z.getAttribute(G),F=z.getElementSize(),H=z.getComponentType();return`${G}:${F}:${H}`}).join("+"),K=Z.listTargets().map((G)=>{return G.listSemantics().sort().map((z)=>{let F=Z.getAttribute(z),H=F.getElementSize(),V=F.getComponentType();return`${z}:${H}:${V}`}).join("+")}).join("~");return`${$}|${Q}|${W}|${X}|${K}`}function GU1(Z){return Math.pow(2,Math.ceil(Math.log(Z)/Math.LN2))}var zU1={[Ep]:Ep,[iU]:iU,[tq1]:iU,[eq1]:iU,[nU]:nU,[ZU1]:nU,[JU1]:nU},jW="center",Ip={pivot:"center"};function rp(Z=Ip){let J=f4(Ip,Z);return iZ(jW,(Y)=>{let $=Y.getLogger(),Q=Y.getRoot(),W=Q.listAnimations().length>0||Q.listSkins().length>0;Y.getRoot().listScenes().forEach((X,K)=>{$.debug(`${jW}: Scene ${K+1} / ${Q.listScenes().length}.`);let G;if(typeof J.pivot==="string"){let F=Qj(X);if(G=[(F.max[0]-F.min[0])/2+F.min[0],(F.max[1]-F.min[1])/2+F.min[1],(F.max[2]-F.min[2])/2+F.min[2]],J.pivot==="above")G[1]=F.max[1];if(J.pivot==="below")G[1]=F.min[1]}else G=J.pivot;$.debug(`${jW}: Pivot "${G.join(", ")}".`);let z=[-1*G[0],-1*G[1],-1*G[2]];if(W){$.debug(`${jW}: Model contains animation or skin. Adding a wrapper node.`);let F=Y.createNode("Pivot").setTranslation(z);X.listChildren().forEach((H)=>F.addChild(H)),X.addChild(F)}else $.debug(`${jW}: Skipping wrapper, offsetting all root nodes.`),X.listChildren().forEach((F)=>{let H=F.getTranslation();F.setTranslation([H[0]+z[0],H[1]+z[1],H[2]+z[2]])})}),$.debug(`${jW}: Complete.`)})}function FU1(Z){let J=new Set,Y=Z,$;while($=Y.getParentNode()){if(J.has($))throw new Error("Circular dependency in scene graph.");J.add($),Y=$}return Y.listParents().filter((Q)=>Q instanceof KW)}function HU1(Z){let J=FU1(Z),Y=Z.getParentNode();if(!Y)return Z;Z.setMatrix(Z.getWorldMatrix()),Y.removeChild(Z);for(let $ of J)$.addChild(Z);return Z}var CW=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 VU1(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],H=J[9],V=J[10],q=J[11],U=J[12],w=J[13],L=J[14],O=J[15],N=Y*K-$*X,j=Y*G-Q*X,R=Y*z-W*X,D=$*G-Q*K,P=$*z-W*K,C=Q*z-W*G,T=F*w-H*U,I=F*L-V*U,x=F*O-q*U,S=H*L-V*w,A=H*O-q*w,E=V*O-q*L,v=N*E-j*A+R*S+D*x-P*I+C*T;if(!v)return null;return v=1/v,Z[0]=(K*E-G*A+z*S)*v,Z[1]=(Q*A-$*E-W*S)*v,Z[2]=(w*C-L*P+O*D)*v,Z[3]=(V*P-H*C-q*D)*v,Z[4]=(G*x-X*E-z*I)*v,Z[5]=(Y*E-Q*x+W*I)*v,Z[6]=(L*R-U*C-O*j)*v,Z[7]=(F*C-V*R+q*j)*v,Z[8]=(X*A-K*x+z*T)*v,Z[9]=($*x-Y*A-W*T)*v,Z[10]=(U*P-w*R+O*N)*v,Z[11]=(H*R-F*P-q*N)*v,Z[12]=(K*I-X*S-G*T)*v,Z[13]=(Y*S-$*I+Q*T)*v,Z[14]=(w*j-U*D-L*N)*v,Z[15]=(F*D-H*j+V*N)*v,Z}function qU1(Z){var J=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],F=Z[9],H=Z[10],V=Z[11],q=Z[12],U=Z[13],w=Z[14],L=Z[15],O=J*X-Y*W,N=J*K-$*W,j=J*G-Q*W,R=Y*K-$*X,D=Y*G-Q*X,P=$*G-Q*K,C=z*U-F*q,T=z*w-H*q,I=z*L-V*q,x=F*w-H*U,S=F*L-V*U,A=H*L-V*w;return O*A-N*S+j*x+R*I-D*T+P*C}function tp(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],H=J[8],V=J[9],q=J[10],U=J[11],w=J[12],L=J[13],O=J[14],N=J[15],j=Y[0],R=Y[1],D=Y[2],P=Y[3];return Z[0]=j*$+R*K+D*H+P*w,Z[1]=j*Q+R*G+D*V+P*L,Z[2]=j*W+R*z+D*q+P*O,Z[3]=j*X+R*F+D*U+P*N,j=Y[4],R=Y[5],D=Y[6],P=Y[7],Z[4]=j*$+R*K+D*H+P*w,Z[5]=j*Q+R*G+D*V+P*L,Z[6]=j*W+R*z+D*q+P*O,Z[7]=j*X+R*F+D*U+P*N,j=Y[8],R=Y[9],D=Y[10],P=Y[11],Z[8]=j*$+R*K+D*H+P*w,Z[9]=j*Q+R*G+D*V+P*L,Z[10]=j*W+R*z+D*q+P*O,Z[11]=j*X+R*F+D*U+P*N,j=Y[12],R=Y[13],D=Y[14],P=Y[15],Z[12]=j*$+R*K+D*H+P*w,Z[13]=j*Q+R*G+D*V+P*L,Z[14]=j*W+R*z+D*q+P*O,Z[15]=j*X+R*F+D*U+P*N,Z}function UU1(){var Z=new CW(9);if(CW!=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 LU1(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 wU1(Z,J){if(Z===J){var Y=J[1],$=J[2],Q=J[5];Z[1]=J[3],Z[2]=J[6],Z[3]=Y,Z[5]=J[7],Z[6]=$,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 BU1(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],H=F*X-K*z,V=-F*W+K*G,q=z*W-X*G,U=Y*H+$*V+Q*q;if(!U)return null;return U=1/U,Z[0]=H*U,Z[1]=(-F*$+Q*z)*U,Z[2]=(K*$-Q*X)*U,Z[3]=V*U,Z[4]=(F*Y-Q*G)*U,Z[5]=(-K*Y+Q*W)*U,Z[6]=q*U,Z[7]=(-z*Y+$*G)*U,Z[8]=(X*Y-$*W)*U,Z}function eU(){var Z=new CW(3);if(CW!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function OU1(Z,J,Y){return Z[0]=J[0]*Y[0],Z[1]=J[1]*Y[1],Z[2]=J[2]*Y[2],Z}function ep(Z,J){var Y=J[0],$=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 MU1(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=Y[3]*$+Y[7]*Q+Y[11]*W+Y[15];return X=X||1,Z[0]=(Y[0]*$+Y[4]*Q+Y[8]*W+Y[12])/X,Z[1]=(Y[1]*$+Y[5]*Q+Y[9]*W+Y[13])/X,Z[2]=(Y[2]*$+Y[6]*Q+Y[10]*W+Y[14])/X,Z}function NU1(Z,J,Y){var $=J[0],Q=J[1],W=J[2];return Z[0]=$*Y[0]+Q*Y[3]+W*Y[6],Z[1]=$*Y[1]+Q*Y[4]+W*Y[7],Z[2]=$*Y[2]+Q*Y[5]+W*Y[8],Z}var RU1=OU1;(function(){var Z=eU();return function(J,Y,$,Q,W,X){var K,G;if(!Y)Y=3;if(!$)$=0;if(Q)G=Math.min(Q*Y+$,J.length);else G=J.length;for(K=$;K<G;K+=Y)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 lZ="dedup",oP={keepUniqueNames:!1,propertyTypes:[a.ACCESSOR,a.MESH,a.TEXTURE,a.MATERIAL,a.SKIN]};function Zi(Z=oP){let J=f4(oP,Z),Y=new Set(J.propertyTypes);for(let $ of J.propertyTypes)if(!oP.propertyTypes.includes($))throw new Error(`${lZ}: Unsupported deduplication on type "${$}".`);return iZ(lZ,($)=>{let Q=$.getLogger();if(Y.has(a.ACCESSOR))jU1($);if(Y.has(a.TEXTURE))DU1($,J);if(Y.has(a.MATERIAL))CU1($,J);if(Y.has(a.MESH))PU1($,J);if(Y.has(a.SKIN))TU1($,J);Q.debug(`${lZ}: Complete.`)})}function jU1(Z){let J=Z.getLogger(),Y=new Map,$=new Map,Q=new Map,W=new Map,X=Z.getRoot().listMeshes();X.forEach((H)=>{H.listPrimitives().forEach((V)=>{V.listAttributes().forEach((q)=>K(q,$)),K(V.getIndices(),Y)})});for(let H of Z.getRoot().listAnimations())for(let V of H.listSamplers())K(V.getInput(),Q),K(V.getOutput(),W);function K(H,V){if(!H)return;let q=[H.getCount(),H.getType(),H.getComponentType(),H.getNormalized(),H.getSparse()].join(":"),U=V.get(q);if(!U)V.set(q,U=new Set);U.add(H)}function G(H,V){for(let q=0;q<H.length;q++){let U=H[q],w=n0.toView(U.getArray());if(V.has(U))continue;for(let L=q+1;L<H.length;L++){let O=H[L];if(V.has(O))continue;if(n0.equals(w,n0.toView(O.getArray())))V.set(O,U)}}}let z=0,F=new Map;for(let H of[$,Y,Q,W])for(let V of H.values())z+=V.size,G(Array.from(V),F);J.debug(`${lZ}: Merged ${F.size} of ${z} accessors.`),X.forEach((H)=>{H.listPrimitives().forEach((V)=>{V.listAttributes().forEach((U)=>{if(F.has(U))V.swap(U,F.get(U))});let q=V.getIndices();if(q&&F.has(q))V.swap(q,F.get(q))})});for(let H of Z.getRoot().listAnimations())for(let V of H.listSamplers()){let q=V.getInput(),U=V.getOutput();if(q&&F.has(q))V.swap(q,F.get(q));if(U&&F.has(U))V.swap(U,F.get(U))}Array.from(F.keys()).forEach((H)=>H.dispose())}function PU1(Z,J){let Y=Z.getLogger(),$=Z.getRoot(),Q=new Map;$.listAccessors().forEach((K,G)=>Q.set(K,G)),$.listMaterials().forEach((K,G)=>Q.set(K,G));let W=$.listMeshes().length,X=new Map;for(let K of $.listMeshes()){let G=[];for(let F of K.listPrimitives())G.push(Ji(F,Q));let z="";if(J.keepUniqueNames)z+=K.getName()+";";if(z+=G.join(";"),X.has(z)){let F=X.get(z);K.listParents().forEach((H)=>{if(H.propertyType!==a.ROOT)H.swap(K,F)}),K.dispose()}else X.set(z,K)}Y.debug(`${lZ}: Merged ${W-X.size} of ${W} meshes.`)}function DU1(Z,J){let Y=Z.getLogger(),$=Z.getRoot(),Q=$.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 F=Q[z],H=F.getImage();if(W.has(F))continue;if(K.getMimeType()!==F.getMimeType())continue;if(J.keepUniqueNames&&K.getName()!==F.getName())continue;let V=K.getSize(),q=F.getSize();if(!V||!q)continue;if(V[0]!==q[0])continue;if(V[1]!==q[1])continue;if(!G||!H)continue;if(n0.equals(G,H))W.set(F,K)}}Y.debug(`${lZ}: Merged ${W.size} of ${$.listTextures().length} textures.`),Array.from(W.entries()).forEach(([X,K])=>{X.listParents().forEach((G)=>{if(!(G instanceof TY))G.swap(X,K)}),X.dispose()})}function CU1(Z,J){let Y=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(vp(z,X))continue;for(let F=G+1;F<Q.length;F++){let H=Q[F];if(W.has(H))continue;if(vp(H,X))continue;if(z.equals(H,K))W.set(H,z)}}Y.debug(`${lZ}: Merged ${W.size} of ${Q.length} materials.`),Array.from(W.entries()).forEach(([G,z])=>{G.listParents().forEach((F)=>{if(!(F instanceof TY))F.swap(G,z)}),G.dispose()})}function TU1(Z,J){let Y=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 F=Q[z];if(W.has(F))continue;if(G.equals(F,X)&&WU1(G.listJoints(),F.listJoints()))W.set(F,G)}}Y.debug(`${lZ}: Merged ${W.size} of ${Q.length} skins.`),Array.from(W.entries()).forEach(([K,G])=>{K.listParents().forEach((z)=>{if(!(z instanceof TY))z.swap(K,G)}),K.dispose()})}function Ji(Z,J){let Y=[];for(let $ of Z.listSemantics()){let Q=Z.getAttribute($);Y.push($+":"+J.get(Q))}if(Z instanceof N8){let $=Z.getIndices();if($)Y.push("indices:"+J.get($));let Q=Z.getMaterial();if(Q)Y.push("material:"+J.get(Q));Y.push("mode:"+Z.getMode());for(let W of Z.listTargets())Y.push("target:"+Ji(W,J))}return Y.join(",")}function vp(Z,J){if(J.has(Z))return J.get(Z);let Y=Z.getGraph(),$=new Set,Q=Y.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($.has(X))continue;for(let K of Y.listChildEdges(X))Q.push(K)}return J.set(Z,!1),!1}function Yi(){var Z=new CW(4);if(CW!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function kU1(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z[2]=J[2]+Y[2],Z[3]=J[3]+Y[3],Z}function EU1(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z[2]=J[2]-Y[2],Z[3]=J[3]-Y[3],Z}function IU1(Z,J,Y){return Z[0]=J[0]*Y[0],Z[1]=J[1]*Y[1],Z[2]=J[2]*Y[2],Z[3]=J[3]*Y[3],Z}function vU1(Z,J,Y){return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z[2]=J[2]*Y,Z[3]=J[3]*Y,Z}function SU1(Z){var J=Z[0],Y=Z[1],$=Z[2],Q=Z[3];return Math.hypot(J,Y,$,Q)}var $i=EU1,_U1=IU1,Qi=SU1;(function(){var Z=Yi();return function(J,Y,$,Q,W,X){var K,G;if(!Y)Y=4;if(!$)$=0;if(Q)G=Math.min(Q*Y+$,J.length);else G=J.length;for(K=$;K<G;K+=Y)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 AU1=/color|emissive|diffuse/i;function xU1(Z){return Z.getGraph().listParentEdges(Z).some((Q)=>{return Q.getAttributes().isColor||AU1.test(Q.getName())})?"srgb":null}function hU1(Z){let J=Z.getGraph(),Y=new Set,$=new Set;function Q(W){let X=new Set;for(let K of J.listChildEdges(W))if(K.getChild()instanceof CY)X.add(K.getName()+"Info");for(let K of J.listChildEdges(W)){let G=K.getChild();if(Y.has(G))continue;if(Y.add(G),G instanceof X5&&X.has(K.getName()))$.add(G);else if(G instanceof XW)Q(G)}}return Q(Z),Array.from($)}function fU1(Z){let Y=L6.fromGraph(Z.getGraph()).getRoot(),$=Z.getGraph().listParentEdges(Z).filter((Q)=>Q.getParent()!==Y).map((Q)=>Q.getName());return Array.from(new Set($))}var PW="prune",ZD=0.011764705882352941,Sp={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 ZL(Z=Sp){let J=f4(Sp,Z),Y=new Set(J.propertyTypes),$=J.keepExtras;return iZ(PW,async(Q)=>{let W=Q.getLogger(),X=Q.getRoot(),K=Q.getGraph(),G=new Wi,z=(F)=>G.dispose(F.target);if(K.addEventListener("node:dispose",z),Y.has(a.MESH))for(let F of X.listMeshes()){if(F.listPrimitives().length>0)continue;F.dispose()}if(Y.has(a.NODE)){if(!J.keepLeaves)for(let F of X.listScenes())Xi(K,F,$);for(let F of X.listNodes())$9(F,$)}if(Y.has(a.SKIN))for(let F of X.listSkins())$9(F,$);if(Y.has(a.MESH))for(let F of X.listMeshes())$9(F,$);if(Y.has(a.CAMERA))for(let F of X.listCameras())$9(F,$);if(Y.has(a.PRIMITIVE))_p(K,a.PRIMITIVE,$);if(Y.has(a.PRIMITIVE_TARGET))_p(K,a.PRIMITIVE_TARGET,$);if(!J.keepAttributes&&Y.has(a.ACCESSOR)){let F=new Map;for(let H of X.listMeshes())for(let V of H.listPrimitives()){let q=V.getMaterial();if(!q)continue;let U=Ki(Q,V,q),w=bU1(V,U);Ap(V,w),V.listTargets().forEach((L)=>Ap(L,w)),F.has(q)?F.get(q).add(V):F.set(q,new Set([V]))}for(let[H,V]of F)gU1(H,Array.from(V))}if(!J.keepIndices&&Y.has(a.ACCESSOR))for(let F of X.listMeshes())for(let H of F.listPrimitives())yU1(H);if(Y.has(a.ANIMATION))for(let F of X.listAnimations()){for(let H of F.listChannels())if(!H.getTargetNode())H.dispose();if(!F.listChannels().length){let H=F.listSamplers();$9(F,$),H.forEach((V)=>$9(V,$))}else F.listSamplers().forEach((H)=>$9(H,$))}if(Y.has(a.MATERIAL))X.listMaterials().forEach((F)=>$9(F,$));if(Y.has(a.TEXTURE)){if(X.listTextures().forEach((F)=>$9(F,$)),!J.keepSolidTextures)await mU1(Q)}if(Y.has(a.ACCESSOR))X.listAccessors().forEach((F)=>$9(F,$));if(Y.has(a.BUFFER))X.listBuffers().forEach((F)=>$9(F,$));if(K.removeEventListener("node:dispose",z),!G.empty()){let F=G.entries().map(([H,V])=>`${H} (${V})`).join(", ");W.info(`${PW}: Removed types... ${F}`)}else W.debug(`${PW}: No unused properties found.`);W.debug(`${PW}: Complete.`)})}class Wi{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 $9(Z,J){let Y=Z.listParents().filter((Q)=>!(Q instanceof TY||Q instanceof PY)),$=J&&!sp(Z.getExtras());if(!Y.length&&!$)Z.dispose()}function _p(Z,J,Y){for(let $ of Z.listEdges()){let Q=$.getParent();if(Q.propertyType===J)$9(Q,Y)}}function Xi(Z,J,Y){if(J.listChildren().forEach((X)=>Xi(Z,X,Y)),J instanceof KW)return;let $=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=Y&&!sp(J.getExtras());if(Q&&!$&&!W)J.dispose()}function Ap(Z,J){for(let Y of J)Z.setAttribute(Y,null)}function yU1(Z){let J=Z.getIndices(),Y=J&&J.getArray(),$=Z.listAttributes()[0];if(!Y||!$)return;if(J.getCount()!==$.getCount())return;for(let Q=0,W=Y.length;Q<W;Q++)if(Q!==Y[Q])return;Z.setIndices(null)}function bU1(Z,J){let Y=[];for(let $ of Z.listSemantics())if($==="NORMAL"&&!J.has($))Y.push($);else if($==="TANGENT"&&!J.has($))Y.push($);else if($.startsWith("TEXCOORD_")&&!J.has($))Y.push($);else if($.startsWith("COLOR_")&&$!=="COLOR_0")Y.push($);return Y}function Ki(Z,J,Y,$=new Set){let W=Z.getGraph().listChildEdges(Y),X=new Set;for(let z of W)if(z.getChild()instanceof CY)X.add(z.getName());for(let z of W){let F=z.getName(),H=z.getChild();if(H instanceof X5){if(X.has(F.replace(/Info$/,"")))$.add(`TEXCOORD_${H.getTexCoord()}`)}if(H instanceof CY&&F.match(/normalTexture/i))$.add("TANGENT");if(H instanceof XW)Ki(Z,J,H,$)}let K=Y instanceof k4&&!Y.getExtension("KHR_materials_unlit"),G=J.getMode()===N8.Mode.POINTS;if(K&&!G)$.add("NORMAL");return $}function gU1(Z,J){let Y=hU1(Z),$=new Set(Y.map((G)=>G.getTexCoord())),Q=Array.from($).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 Y){let z=G.getTexCoord();G.setTexCoord(W.get(z))}for(let G of J){let z=G.listSemantics().filter((F)=>F.startsWith("TEXCOORD_")).sort();K(G,z),G.listTargets().forEach((F)=>K(F,z))}function K(G,z){for(let F of z){let H=G.getAttribute(F);if(!H)continue;let V=X.get(F);if(V===F)continue;G.setAttribute(V,H),G.setAttribute(F,null)}}}async function mU1(Z){let J=Z.getRoot(),Y=Z.getGraph(),$=Z.getLogger(),W=J.listTextures().map(async(X)=>{var K;let G=await uU1(X);if(!G)return;if(xU1(X)==="srgb")Wj.convertSRGBToLinear(G,G);let z=X.getName()||X.getURI(),F=(K=X.getSize())==null?void 0:K.join("x"),H=fU1(X);for(let V of Y.listParentEdges(X)){let q=V.getParent();if(q!==J&&dU1(q,G,V.getName(),$))V.dispose()}if(X.listParents().length===1)X.dispose(),$.debug(`${PW}: Removed solid-color texture "${z}" (${F}px ${H.join(", ")})`)});await Promise.all(W)}function dU1(Z,J,Y,$){if(Z instanceof k4)switch(Y){case"baseColorTexture":return Z.setBaseColorFactor(_U1(J,J,Z.getBaseColorFactor())),!0;case"emissiveTexture":return Z.setEmissiveFactor(RU1([0,0,0],J.slice(0,3),Z.getEmissiveFactor())),!0;case"occlusionTexture":return Math.abs(J[0]-1)<=ZD;case"metallicRoughnessTexture":return Z.setRoughnessFactor(J[1]*Z.getRoughnessFactor()),Z.setMetallicFactor(J[2]*Z.getMetallicFactor()),!0;case"normalTexture":return Qi($i(Yi(),J,[0.5,0.5,1,1]))<=ZD}return $.warn(`${PW}: Detected single-color ${Y} texture. Pruning ${Y} not yet supported.`),!1}async function uU1(Z){let J=await cU1(Z);if(!J)return null;let Y=[1/0,1/0,1/0,1/0],$=[-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++)Y[z]=Math.min(Y[z],J.get(K,G,z)),$[z]=Math.max($[z],J.get(K,G,z));if(Qi($i(Q,$,Y))/255>ZD)return null}return vU1(Q,kU1(Q,$,Y),0.00196078431372549)}async function cU1(Z){try{return await il(Z.getImage(),Z.getMimeType())}catch(J){return null}}var cZ=4294967295;class Gi{constructor(Z){this.attributes=[],this.u8=void 0,this.u32=void 0;let J=0;for(let Y of XD(Z))J+=this._initAttribute(Y);this.u8=new Uint8Array(J),this.u32=new Uint32Array(this.u8.buffer)}_initAttribute(Z){let J=Z.getArray(),Y=new Uint8Array(J.buffer,J.byteOffset,J.byteLength),$=Z.getElementSize()*Z.getComponentSize(),Q=n0.padNumber($);return this.attributes.push({u8:Y,byteStride:$,paddedByteStride:Q}),Q}hash(Z){let J=0;for(let{u8:Y,byteStride:$,paddedByteStride:Q}of this.attributes){for(let W=0;W<Q;W++)if(W<$)this.u8[J+W]=Y[Z*$+W];else this.u8[J+W]=0;J+=Q}return lU1(0,this.u32)}equal(Z,J){for(let{u8:Y,byteStride:$}of this.attributes)for(let Q=0;Q<$;Q++)if(Y[Z*$+Q]!==Y[J*$+Q])return!1;return!0}}function lU1(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 pU1(Z,J,Y,$,Q=cZ){let W=J-1,K=Y.hash($)&W;for(let G=0;G<=W;G++){let z=Z[K];if(z===Q||Y.equal(z,$))return K;K=K+G+1&W}throw new Error("Hash table full.")}var G6;(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"})(G6||(G6={}));function pZ(Z,J){let Y=Z.getAttribute("POSITION"),$=Z.getIndices();switch(J){case G6.RENDER:return $?$.getCount():Y.getCount();case G6.RENDER_CACHED:return $?new Set($.getArray()).size:Y.getCount();case G6.UPLOAD_NAIVE:case G6.UPLOAD:return Y.getCount();case G6.DISTINCT:case G6.DISTINCT_POSITION:return iU1(J);case G6.UNUSED:return $?Y.getCount()-new Set($.getArray()).size:0;default:return nU1(J)}}function iU1(Z){throw new Error(`Not implemented: ${Z}`)}function nU1(Z){throw new Error(`Unexpected value: ${Z}`)}function oG(Z,J,Y){let $=L6.fromGraph(Z.getGraph());if(!J||!Y)[J,Y]=aU1(Z);let Q=Z.getIndices(),W=Q?Q.getArray():null,X=pZ(Z,G6.RENDER),K=$.createAccessor(),G=X,z=KD(G,Y);for(let H=0;H<G;H++)z[H]=J[W?W[H]:H];Z.setIndices(K.setArray(z));let F=XD(Z);for(let H of Z.listAttributes()){let V=b7($,H);JD(H,Q,J,V,Y),Z.swap(H,V)}for(let H of Z.listTargets())for(let V of H.listAttributes()){let q=b7($,V);JD(V,Q,J,q,Y),H.swap(V,q)}if(Q&&Q.listParents().length===1)Q.dispose();for(let H of F)if(H.listParents().length===1)H.dispose();return Z}function JD(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),F=new Uint8Array(Q);for(let H=0;H<G;H++){let V=K?K[H]:H,q=Y[V];if(F[q])continue;for(let U=0;U<W;U++)z[q*W+U]=X[V*W+U];F[q]=1}return $.setArray(z)}function aU1(Z){let J=pZ(Z,G6.UPLOAD),Y=Z.getIndices(),$=Y?Y.getArray():null;if(!Y||!$)return[XU1(J,1e6),J];let Q=new Uint32Array(J).fill(cZ),W=0;for(let X=0;X<$.length;X++){let K=$[X];if(Q[K]===cZ)Q[K]=W++}return[Q,W]}var YD="weld",sU={overwrite:!0,cleanup:!0};function GD(Z=sU){let J=f4(sU,Z);return iZ(YD,async(Y)=>{let $=Y.getLogger();for(let Q of Y.getRoot().listMeshes()){for(let W of Q.listPrimitives())if(JL(W,J),pZ(W,G6.RENDER)===0)W.dispose();if(Q.listPrimitives().length===0)Q.dispose()}if(J.cleanup)await Y.transform(ZL({propertyTypes:[a.ACCESSOR,a.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),Zi({propertyTypes:[a.ACCESSOR]}));$.debug(`${YD}: Complete.`)})}function JL(Z,J=sU){let Y=Z.getGraph(),Q=L6.fromGraph(Y).getLogger(),W=DW({},sU,J);if(Z.getIndices()&&!W.overwrite)return;if(Z.getMode()===N8.Mode.POINTS)return;let X=Z.getAttribute("POSITION").getCount(),K=Z.getIndices(),G=K==null?void 0:K.getArray(),z=K?K.getCount():X,F=new Gi(Z),H=GU1(X+X/4),V=new Uint32Array(H).fill(cZ),q=new Uint32Array(X).fill(cZ),U=0;for(let w=0;w<z;w++){let L=G?G[w]:w;if(q[L]!==cZ)continue;let O=pU1(V,H,F,L,cZ),N=V[O];if(N===cZ)V[O]=L,q[L]=U++;else q[L]=q[N]}Q.debug(`${YD}: ${tU(X,U)} vertices.`),oG(Z,q,U)}var{FLOAT:sU1}=I0.ComponentType;function zi(Z,J){let Y=Z.getAttribute("POSITION");if(Y)xp(J,Y);let $=Z.getAttribute("NORMAL");if($)hp(J,$);let Q=Z.getAttribute("TANGENT");if(Q)fp(J,Q);for(let W of Z.listTargets()){let X=W.getAttribute("POSITION");if(X)xp(J,X);let K=W.getAttribute("NORMAL");if(K)hp(J,K);let G=W.getAttribute("TANGENT");if(G)fp(J,G)}if(qU1(J)<0)oU1(Z)}function xp(Z,J){let Y=J.getComponentType(),$=J.getNormalized(),Q=J.getArray(),W=Y===sU1?Q:new Float32Array(Q.length),X=eU();for(let K=0,G=J.getCount();K<G;K++){if($)X[0]=u0.decodeNormalizedInt(Q[K*3],Y),X[1]=u0.decodeNormalizedInt(Q[K*3+1],Y),X[2]=u0.decodeNormalizedInt(Q[K*3+2],Y);else X[0]=Q[K*3],X[1]=Q[K*3+1],X[2]=Q[K*3+2];MU1(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 hp(Z,J){let Y=J.getArray(),$=J.getNormalized(),Q=J.getComponentType(),W=UU1();LU1(W,Z),BU1(W,W),wU1(W,W);let X=eU();for(let K=0,G=J.getCount();K<G;K++){if($)X[0]=u0.decodeNormalizedInt(Y[K*3],Q),X[1]=u0.decodeNormalizedInt(Y[K*3+1],Q),X[2]=u0.decodeNormalizedInt(Y[K*3+2],Q);else X[0]=Y[K*3],X[1]=Y[K*3+1],X[2]=Y[K*3+2];if(NU1(X,X,W),ep(X,X),$)Y[K*3]=u0.decodeNormalizedInt(X[0],Q),Y[K*3+1]=u0.decodeNormalizedInt(X[1],Q),Y[K*3+2]=u0.decodeNormalizedInt(X[2],Q);else Y[K*3]=X[0],Y[K*3+1]=X[1],Y[K*3+2]=X[2]}}function fp(Z,J){let Y=J.getArray(),$=J.getNormalized(),Q=J.getComponentType(),W=eU();for(let X=0,K=J.getCount();X<K;X++){if($)W[0]=u0.decodeNormalizedInt(Y[X*4],Q),W[1]=u0.decodeNormalizedInt(Y[X*4+1],Q),W[2]=u0.decodeNormalizedInt(Y[X*4+2],Q);else W[0]=Y[X*4],W[1]=Y[X*4+1],W[2]=Y[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],ep(W,W),$)Y[X*4]=u0.decodeNormalizedInt(W[0],Q),Y[X*4+1]=u0.decodeNormalizedInt(W[1],Q),Y[X*4+2]=u0.decodeNormalizedInt(W[2],Q);else Y[X*4]=W[0],Y[X*4+1]=W[1],Y[X*4+2]=W[2]}}function oU1(Z){if(Z.getMode()!==N8.Mode.TRIANGLES)return;if(!Z.getIndices())JL(Z);let J=Z.getIndices();for(let Y=0,$=J.getCount();Y<$;Y+=3){let Q=J.getScalar(Y),W=J.getScalar(Y+2);J.setScalar(Y,W),J.setScalar(Y+2,Q)}}function rU1(Z,J){for(let Y of Z.listPrimitives()){let $=tU1(Y,Z);if(Y!==$)Z.removePrimitive(Y).addPrimitive($)}for(let Y of Z.listPrimitives())oG(Y),zi(Y,J)}function tU1(Z,J){if(Z.listParents().some(($)=>$ instanceof TG&&$!==J))Z=Z.clone();for(let $ of Z.listTargets())if($.listParents().some((W)=>W instanceof N8&&W!==Z))Z.removeTarget($).addTarget($.clone());return Z}var yp=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function Fi(Z){let J=Z.getMesh(),Y=Z.getMatrix();if(J&&!u0.eq(Y,yp))rU1(J,Y);for(let $ of Z.listChildren()){let Q=$.getMatrix();tp(Q,Q,Y),$.setMatrix(Q)}return Z.setMatrix(yp)}var{LINES:eU1,LINE_STRIP:ZL1,LINE_LOOP:JL1,TRIANGLES:YL1,TRIANGLE_STRIP:$L1,TRIANGLE_FAN:QL1}=N8.Mode;function WL1(Z){let J=Z.getGraph(),Y=L6.fromGraph(J);if(!Z.getIndices())JL(Z);let $=Z.getIndices(),Q=$.getArray(),W=ap(Z),K=new xZ[$.getComponentType()](W*2),G=Z.getMode();if(G===ZL1)for(let F=0;F<W;F++)K[F*2]=Q[F],K[F*2+1]=Q[F+1];else if(G===JL1)for(let F=0;F<W;F++)if(F<W-1)K[F*2]=Q[F],K[F*2+1]=Q[F+1];else K[F*2]=Q[F],K[F*2+1]=Q[0];else throw new Error("Only LINE_STRIP and LINE_LOOP may be converted to LINES.");Z.setMode(eU1);let z=Y.getRoot();if($.listParents().some((F)=>F!==z&&F!==Z))Z.setIndices(b7(Y,$).setArray(K));else $.setArray(K)}function Hi(Z){let J=Z.getGraph(),Y=L6.fromGraph(J);if(!Z.getIndices())JL(Z);let $=Z.getIndices(),Q=$.getArray(),W=ap(Z),K=new xZ[$.getComponentType()](W*3),G=Z.getMode();if(G===$L1)for(let F=0,H=Q.length;F<H-2;F++)if(F%2)K[F*3]=Q[F+1],K[F*3+1]=Q[F],K[F*3+2]=Q[F+2];else K[F*3]=Q[F],K[F*3+1]=Q[F+1],K[F*3+2]=Q[F+2];else if(G===QL1)for(let F=0;F<W;F++)K[F*3]=Q[0],K[F*3+1]=Q[F+1],K[F*3+2]=Q[F+2];else throw new Error("Only TRIANGLE_STRIP and TRIANGLE_FAN may be converted to TRIANGLES.");Z.setMode(YL1);let z=Y.getRoot();if($.listParents().some((F)=>F!==z&&F!==Z))Z.setIndices(b7(Y,$).setArray(K));else $.setArray(K)}var bp="dequantize",oU={pattern:/^((?!JOINTS_).)*$/};function Vi(Z=oU){let J=f4(oU,Z);return iZ(bp,(Y)=>{let $=Y.getLogger();for(let Q of Y.getRoot().listMeshes())for(let W of Q.listPrimitives())XL1(W,J);Y.createExtension(aG).dispose(),$.debug(`${bp}: Complete.`)})}function XL1(Z,J=oU){let Y=f4(oU,J);for(let $ of Z.listSemantics())if(Y.pattern.test($))$D(Z.getAttribute($));for(let $ of Z.listTargets())for(let Q of $.listSemantics())if(Y.pattern.test(Q))$D($.getAttribute(Q))}function $D(Z){let J=Z.getArray();if(!J)return;let Y=rU(J,Z.getComponentType(),Z.getNormalized());Z.setArray(Y).setNormalized(!1)}function rU(Z,J,Y){let $=new Float32Array(Z.length);for(let Q=0,W=Z.length;Q<W;Q++)if(Y)$[Q]=u0.decodeNormalizedInt(Z[Q],J);else $[Q]=Z[Q];return $}var{TEXTURE_INFO:qi,ROOT:kK6}=a;function Ui(Z){let J=new L6().setLogger(Z.getLogger()),Y=zD(J,Z);return KL1(J,Z,Y),J.getRoot().copy(Z.getRoot(),Y),J}function KL1(Z,J,Y){Y||(Y=zD(Z,J));for(let $ of J.getRoot().listExtensionsUsed()){let Q=Z.createExtension($.constructor);if($.isRequired())Q.setRequired(!0)}return GL1(Z,J,zL1(J),Y)}function GL1(Z,J,Y,$){$||($=zD(Z,J));let Q=new Map;for(let W of Y)if(!Q.has(W)&&W.propertyType!==qi)Q.set(W,$(W));for(let[W,X]of Q.entries())X.copy(W,$);return Q}function zD(Z,J){let Y=new Map([[J.getRoot(),Z.getRoot()]]);return($)=>{if($.propertyType===qi)return $;let Q=Y.get($);if(!Q)Q=new $.constructor(Z.getGraph()),Y.set($,Q);return Q}}function zL1(Z){let J=new Set;for(let Y of Z.getGraph().listEdges())J.add(Y.getChild());return Array.from(J)}var rP="flatten",gp={cleanup:!0};function Li(Z=gp){let J=f4(gp,Z);return iZ(rP,async(Y)=>{let $=Y.getRoot(),Q=Y.getLogger(),W=new Set;for(let z of $.listSkins())for(let F of z.listJoints())W.add(F);let X=new Set;for(let z of $.listAnimations())for(let F of z.listChannels()){let H=F.getTargetNode();if(H&&F.getTargetPath()!=="weights")X.add(H)}let K=new Set,G=new Set;for(let z of $.listScenes())z.traverse((F)=>{let H=F.getParentNode();if(!H)return;if(W.has(H)||K.has(H))K.add(F);if(X.has(H)||G.has(H))G.add(F)});for(let z of $.listScenes())z.traverse((F)=>{if(X.has(F))return;if(K.has(F))return;if(G.has(F))return;HU1(F)});if(X.size)Q.debug(`${rP}: Flattening node hierarchies with TRS animation not yet supported.`);if(J.cleanup)await Y.transform(ZL({propertyTypes:[a.NODE],keepLeaves:!1}));Q.debug(`${rP}: Complete.`)})}function wi(Z){return Qj(Z)}var FL1={skipValidation:!1},mp=4294967295,{LINE_STRIP:HL1,LINE_LOOP:VL1,TRIANGLE_STRIP:qL1,TRIANGLE_FAN:UL1}=N8.Mode;function LL1(Z,J={}){let Y=f4(FL1,J),$=Z[0],Q=L6.fromGraph($.getGraph());if(!Y.skipValidation&&new Set(Z.map(op)).size>1)throw new Error("Requires >=2 Primitives, sharing the same Material and Mode, with compatible vertex attributes and indices.");for(let q of Z)switch(q.getMode()){case HL1:case VL1:WL1(q);break;case qL1:case UL1:Hi(q);break}let W=[],X=new Uint32Array(Z.length),K=0,G=0;for(let q=0;q<Z.length;q++){let U=Z[q],w=U.getIndices(),L=U.getAttribute("POSITION").getCount(),O=w?w.getArray():null,N=w?w.getCount():L,j=new Uint32Array(L).fill(mp);for(let R=0;R<N;R++){let D=O?O[R]:R;if(j[D]===mp)j[D]=K++,X[q]++}W.push(j),G+=N}let z=Q.createPrimitive().setMode($.getMode()).setMaterial($.getMaterial());for(let q of $.listSemantics()){let U=$.getAttribute(q),w=xZ[U.getComponentType()],L=b7(Q,U).setArray(new w(K*U.getElementSize()));z.setAttribute(q,L)}let F=$.getIndices(),H=F?b7(Q,F).setArray(KD(G,K)):null;z.setIndices(H);let V=0;for(let q=0;q<W.length;q++){let U=Z[q],w=U.getIndices(),L=w?w.getCount():-1,O=W[q];if(w&&H)BL1(w,O,H,V),V+=L;for(let N of z.listSemantics()){let j=U.getAttribute(N),R=z.getAttribute(N);wL1(j,w,O,R)}}return z}function wL1(Z,J,Y,$){let Q=Z.getElementSize(),W=J?J.getArray():null,X=Z.getCount(),K=Z.getArray(),G=$.getArray(),z=new Uint8Array(Z.getCount());for(let F=0,H=J?J.getCount():X;F<H;F++){let V=W?W[F]:F,q=Y[V];if(z[q])continue;for(let U=0;U<Q;U++)G[q*Q+U]=K[V*Q+U];z[q]=1}}function BL1(Z,J,Y,$){let Q=Z.getCount(),W=Z.getArray(),X=Y.getArray();for(let K=0;K<Q;K++){let G=W[K],z=J[G];X[$+K]=z}}var QD="join",{ROOT:OL1,NODE:ML1,MESH:NL1,PRIMITIVE:RL1,ACCESSOR:jL1}=a,tP=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],dp={keepMeshes:!1,keepNamed:!1,cleanup:!0};function Bi(Z=dp){let J=f4(dp,Z);return iZ(QD,async(Y)=>{let $=Y.getRoot(),Q=Y.getLogger();for(let W of $.listScenes())up(Y,W,J),W.traverse((X)=>up(Y,X,J));if(J.cleanup)await Y.transform(ZL({propertyTypes:[ML1,NL1,RL1,jL1],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}));Q.debug(`${QD}: Complete.`)})}function up(Z,J,Y){let $=Z.getLogger(),Q={},W=J.listChildren();for(let G=0;G<W.length;G++){let z=W[G];if(z.listParents().some((V)=>V instanceof PY))continue;let H=z.getMesh();if(!H)continue;if(z.getExtension("EXT_mesh_gpu_instancing"))continue;if(z.getSkin())continue;for(let V of H.listPrimitives()){if(V.listTargets().length>0)continue;let q=V.getMaterial();if(q&&q.getExtension("KHR_materials_volume"))continue;oG(V),DL1(V);let U=op(V),w=H.getName()||z.getName();if(Y.keepMeshes||Y.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(V),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((H)=>{return H.propertyType!==OL1&&G!==H}))G.setMesh(z.clone())}for(let G of X){let{dstNode:z,primNodes:F}=G;G.dstMesh=z.getMesh(),G.primMeshes=F.map((H)=>H.getMesh())}for(let G of X){let{prims:z,primNodes:F,primMeshes:H,dstNode:V,dstMesh:q}=G,U=V.getMatrix();for(let O=0;O<z.length;O++){let N=F[O],j=H[O],R=z[O];if(j.removePrimitive(R),KU1(R))R=z[O]=PL1(z[O]);if(N!==V)tp(tP,VU1(tP,U),N.getMatrix()),zi(R,tP)}let w=LL1(z),L=w.listAttributes()[0].getCount();q.addPrimitive(w),$.debug(`${QD}: Joined Primitives (${z.length}) containing ${eP(L)} vertices under Node "${V.getName()}".`)}}function PL1(Z){let J=Z.clone();for(let $ of J.listSemantics())J.setAttribute($,J.getAttribute($).clone());let Y=J.getIndices();if(Y)J.setIndices(Y.clone());return J}function DL1(Z){for(let J of["POSITION","NORMAL","TANGENT"]){let Y=Z.getAttribute(J);if(Y)$D(Y)}}var{TRANSLATION:EK6,ROTATION:IK6,SCALE:vK6,WEIGHTS:SK6}=PY.TargetPath;var CL1={pattern:/.*/,quantizationVolume:"mesh",quantizePosition:14,quantizeNormal:10,quantizeTexcoord:12,quantizeColor:8,quantizeWeight:8,quantizeGeneric:12,normalizeWeights:!0,cleanup:!0};var _K6=DW({level:"high"},CL1);var TL1="unweld";function kL1(Z,J=new Map){let Y=Z.getIndices();if(!Y)return;let $=Z.getGraph(),Q=L6.fromGraph($),W=Q.getLogger(),X=Z.getAttribute("POSITION").getCount();for(let G of Z.listAttributes())if(Z.swap(G,cp(Q,G,Y,J)),G.listParents().length===1)G.dispose();for(let G of Z.listTargets())for(let z of G.listAttributes())if(G.swap(z,cp(Q,z,Y,J)),z.listParents().length===1)z.dispose();let K=Z.getAttribute("POSITION").getCount();if(W.debug(`${TL1}: ${tU(X,K)} vertices.`),Z.setIndices(null),Y.listParents().length===1)Y.dispose()}function cp(Z,J,Y,$){if($.has(J)&&$.get(J).has(Y))return $.get(J).get(Y);let Q=J.getArray(),X=new Q.constructor(Y.getCount()*J.getElementSize()),K=Y.getArray(),G=J.getElementSize();for(let F=0,H=Y.getCount();F<H;F++)for(let V=0;V<G;V++)X[F*G+V]=Q[K[F]*G+V];if(!$.has(J))$.set(J,new Map);let z=b7(Z,J).setArray(X);return $.get(J).set(Y,z),z}var lp;(function(Z){Z[Z.STEP=0]="STEP",Z[Z.LERP=1]="LERP",Z[Z.SLERP=2]="SLERP"})(lp||(lp={}));var EL1=0.000001;function IL1(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,F=1;for(let H=1;H<z;++H){let V=Z[F-1],q=Z[H],U=Z[H+1],w=(q-V)/(U-V),L=!1;if(q!==U&&(H!==1||q!==Z[0])){if(sG(J,F-1,G),sG(J,H,X),sG(J,H+1,K),Y==="slerp"){let O=_L1(W,G,K,w),N=ip(G,X)+ip(X,K);L=!aU(X,O,$)||N+Number.EPSILON>=Math.PI}else if(Y==="lerp"){let O=SL1(W,G,K,w);L=!aU(X,O,$)}else if(Y==="step")L=!aU(X,G)||!aU(X,K)}if(L){if(H!==F)Z[F]=Z[H],pp(J,F,sG(J,H,W));F++}}if(z>0)Z[F]=Z[z],pp(J,F,sG(J,z,W)),F++;return F}function sG(Z,J,Y){for(let $=0,Q=Y.length;$<Q;$++)Y[$]=Z[J*Q+$];return Y}function pp(Z,J,Y){for(let $=0,Q=Y.length;$<Q;$++)Z[J*Q+$]=Y[$]}function aU(Z,J,Y=0){if(Z.length!==J.length)return!1;for(let $=0;$<Z.length;$++)if(Math.abs(Z[$]-J[$])>Y)return!1;return!0}function vL1(Z,J,Y){return Z*(1-Y)+J*Y}function SL1(Z,J,Y,$){for(let Q=0;Q<J.length;Q++)Z[Q]=vL1(J[Q],Y[Q],$);return Z}function _L1(Z,J,Y,$){let Q=J[0],W=J[1],X=J[2],K=J[3],G=Y[0],z=Y[1],F=Y[2],H=Y[3],V,q,U,w,L;if(q=Q*G+W*z+X*F+K*H,q<0)q=-q,G=-G,z=-z,F=-F,H=-H;if(1-q>EL1)V=Math.acos(q),U=Math.sin(V),w=Math.sin((1-$)*V)/U,L=Math.sin($*V)/U;else w=1-$,L=$;return Z[0]=w*Q+L*G,Z[1]=w*W+L*z,Z[2]=w*X+L*F,Z[3]=w*K+L*H,Z}function ip(Z,J){let Y=AL1(Z,J);return Math.acos(2*Y*Y-1)}function AL1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}var AK6=new Float32Array(0),xK6={ready:Promise.resolve(),resample:IL1,tolerance:0.0001,cleanup:!0};var iY="simplify",{POINTS:Oi,LINES:xL1,LINE_STRIP:hL1,LINE_LOOP:fL1,TRIANGLES:yL1,TRIANGLE_STRIP:Mi,TRIANGLE_FAN:Ni}=N8.Mode,Ri={ratio:0,error:0.0001,lockBorder:!1,cleanup:!0};function ji(Z){let J=f4(Ri,Z),Y=J.simplifier;if(!Y)throw new Error(`${iY}: simplifier dependency required \u2014 install "meshoptimizer".`);return iZ(iY,async($)=>{let Q=$.getLogger();await Y.ready,await $.transform(GD({overwrite:!1,cleanup:J.cleanup}));let W=0;for(let X of $.getRoot().listMeshes()){for(let K of X.listPrimitives()){let G=K.getMode();if(G===yL1||G===Mi||G===Ni){if(np(K,J),pZ(K,G6.RENDER)===0)K.dispose()}else if(K.getMode()===Oi&&!!Y.simplifyPoints){if(np(K,J),pZ(K,G6.RENDER)===0)K.dispose()}else W++}if(X.listPrimitives().length===0)X.dispose()}if(W>0)Q.warn(`${iY}: Skipping simplification of ${W} primitives: Unsupported draw mode.`);if(J.cleanup)await $.transform(ZL({propertyTypes:[a.ACCESSOR,a.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),Zi({propertyTypes:[a.ACCESSOR]}));Q.debug(`${iY}: Complete.`)})}function np(Z,J){let Y=DW({},Ri,J),$=Y.simplifier,Q=Z.getGraph(),W=L6.fromGraph(Q),X=W.getLogger();switch(Z.getMode()){case Oi:return bL1(W,Z,Y);case xL1:case hL1:case fL1:return X.warn(`${iY}: Skipping primitive simplification: Unsupported draw mode.`),Z;case Mi:case Ni:Hi(Z);break}let K=pZ(Z,G6.UPLOAD),G=pZ(Z,G6.RENDER);if(G<K/2)oG(Z);let z=Z.getAttribute("POSITION"),F=Z.getIndices(),H=z.getArray(),V=F.getArray();if(!(H instanceof Float32Array))H=rU(H,z.getComponentType(),z.getNormalized());if(!(V instanceof Uint32Array))V=new Uint32Array(V);let q=Math.floor(Y.ratio*G/3)*3,U=Y.lockBorder?["LockBorder"]:[],[w,L]=$.simplify(V,H,3,q,Y.error,U);if(Z.setIndices(b7(W,F).setArray(w)),F.listParents().length===1)F.dispose();oG(Z);let O=pZ(Z,G6.UPLOAD);if(O<=65534)Z.getIndices().setArray(new Uint16Array(Z.getIndices().getArray()));return X.debug(`${iY}: ${tU(K,O)} vertices, error: ${L.toFixed(4)}.`),Z}function bL1(Z,J,Y){let $=Y.simplifier,Q=Z.getLogger();if(J.getIndices())kL1(J);let X=J.getAttribute("POSITION"),K=J.getAttribute("COLOR_0"),G=X.getCount(),z=X.getArray(),F=K?K.getArray():void 0,H=K?K.getComponentSize():void 0;if(!(z instanceof Float32Array))z=rU(z,X.getComponentType(),X.getNormalized());if(F&&!(F instanceof Float32Array))F=rU(F,X.getComponentType(),X.getNormalized());$.useExperimentalFeatures=!0;let V=Math.floor(Y.ratio*G),q=$.simplifyPoints(z,3,V,F,H);$.useExperimentalFeatures=!1;let[U,w]=$.compactMesh(q);Q.debug(`${iY}: ${tU(X.getCount(),w)} vertices.`);for(let L of XD(J)){let O=b7(Z,L);if(JD(L,null,U,O,w),QU1(J,L,O),L.listParents().length===1)L.dispose()}return J}var WD;(function(Z){Z.LANCZOS3="lanczos3",Z.LANCZOS2="lanczos2"})(WD||(WD={}));var hK6={resizeFilter:WD.LANCZOS3,pattern:void 0,formats:void 0,slots:void 0,quality:void 0,effort:void 0,lossless:!1,nearLossless:!1,limitInputPixels:!0};var yK6=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(q){Y=q.instance,Y.exports.__wasm_call_ctors(),Y.exports.meshopt_encodeVertexVersion(0),Y.exports.meshopt_encodeIndexVersion(1)});function Q(q){var U=new Uint8Array(q.length);for(var w=0;w<q.length;++w){var L=q.charCodeAt(w);U[w]=L>96?L-97:L>64?L-39:L+4}var O=0;for(var w=0;w<q.length;++w)U[O++]=U[w]<60?J[U[w]]:(U[w]-60)*64+U[++w];return U.buffer.slice(0,O)}function W(q){if(!q)throw new Error("Assertion failed")}function X(q){return new Uint8Array(q.buffer,q.byteOffset,q.byteLength)}function K(q,U,w,L){var O=Y.exports.sbrk,N=O(U.length*4),j=O(w*4),R=new Uint8Array(Y.exports.memory.buffer),D=X(U);if(R.set(D,N),L)L(N,N,U.length,w);var P=q(j,N,U.length,w);R=new Uint8Array(Y.exports.memory.buffer);var C=new Uint32Array(w);new Uint8Array(C.buffer).set(R.subarray(j,j+w*4)),D.set(R.subarray(N,N+U.length*4)),O(N-O(0));for(var T=0;T<U.length;++T)U[T]=C[U[T]];return[C,P]}function G(q,U,w,L){var O=Y.exports.sbrk,N=O(w*4),j=O(w*L),R=new Uint8Array(Y.exports.memory.buffer);R.set(X(U),j),q(N,j,w,L),R=new Uint8Array(Y.exports.memory.buffer);var D=new Uint32Array(w);return new Uint8Array(D.buffer).set(R.subarray(N,N+w*4)),O(N-O(0)),D}function z(q,U,w,L,O){var N=Y.exports.sbrk,j=N(U),R=N(L*O),D=new Uint8Array(Y.exports.memory.buffer);D.set(X(w),R);var P=q(j,U,R,L,O),C=new Uint8Array(P);return C.set(D.subarray(j,j+P)),N(j-N(0)),C}function F(q){var U=0;for(var w=0;w<q.length;++w){var L=q[w];U=U<L?L:U}return U}function H(q,U){if(W(U==2||U==4),U==4)return new Uint32Array(q.buffer,q.byteOffset,q.byteLength/4);else{var w=new Uint16Array(q.buffer,q.byteOffset,q.byteLength/2);return new Uint32Array(w)}}function V(q,U,w,L,O,N,j){var R=Y.exports.sbrk,D=R(w*L),P=R(w*N),C=new Uint8Array(Y.exports.memory.buffer);C.set(X(U),P),q(D,w,L,O,P,j);var T=new Uint8Array(w*L);return T.set(C.subarray(D,D+w*L)),R(D-R(0)),T}return{ready:$,supported:!0,reorderMesh:function(q,U,w){var L=U?w?Y.exports.meshopt_optimizeVertexCacheStrip:Y.exports.meshopt_optimizeVertexCache:void 0;return K(Y.exports.meshopt_optimizeVertexFetchRemap,q,F(q)+1,L)},reorderPoints:function(q,U){return W(q instanceof Float32Array),W(q.length%U==0),W(U>=3),G(Y.exports.meshopt_spatialSortRemap,q,q.length/U,U*4)},encodeVertexBuffer:function(q,U,w){W(w>0&&w<=256),W(w%4==0);var L=Y.exports.meshopt_encodeVertexBufferBound(U,w);return z(Y.exports.meshopt_encodeVertexBuffer,L,q,U,w)},encodeIndexBuffer:function(q,U,w){W(w==2||w==4),W(U%3==0);var L=H(q,w),O=Y.exports.meshopt_encodeIndexBufferBound(U,F(L)+1);return z(Y.exports.meshopt_encodeIndexBuffer,O,L,U,4)},encodeIndexSequence:function(q,U,w){W(w==2||w==4);var L=H(q,w),O=Y.exports.meshopt_encodeIndexSequenceBound(U,F(L)+1);return z(Y.exports.meshopt_encodeIndexSequence,O,L,U,4)},encodeGltfBuffer:function(q,U,w,L){var O={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return W(O[L]),O[L](q,U,w)},encodeFilterOct:function(q,U,w,L){return W(w==4||w==8),W(L>=1&&L<=16),V(Y.exports.meshopt_encodeFilterOct,q,U,w,L,16)},encodeFilterQuat:function(q,U,w,L){return W(w==8),W(L>=4&&L<=16),V(Y.exports.meshopt_encodeFilterQuat,q,U,w,L,16)},encodeFilterExp:function(q,U,w,L,O){W(w>0&&w%4==0),W(L>=1&&L<=24);var N={Separate:0,SharedVector:1,SharedComponent:2,Clamped:3};return V(Y.exports.meshopt_encodeFilterExp,q,U,w,L,w,O?N[O]:1)}}}();var gK6=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",Y=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]),$=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(Y)?K(J):K(Z),W,X=WebAssembly.instantiate(Q,{}).then(function(O){W=O.instance,W.exports.__wasm_call_ctors()});function K(O){var N=new Uint8Array(O.length);for(var j=0;j<O.length;++j){var R=O.charCodeAt(j);N[j]=R>96?R-97:R>64?R-39:R+4}var D=0;for(var j=0;j<O.length;++j)N[D++]=N[j]<60?$[N[j]]:(N[j]-60)*64+N[++j];return N.buffer.slice(0,D)}function G(O,N,j,R,D,P,C){var T=O.exports.sbrk,I=R+3&-4,x=T(I*D),S=T(P.length),A=new Uint8Array(O.exports.memory.buffer);A.set(P,S);var E=N(x,R,D,S,P.length);if(E==0&&C)C(x,I,D);if(j.set(A.subarray(x,x+R*D)),T(x-T(0)),E!=0)throw new Error("Malformed buffer data: "+E)}var z={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},F={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},H=[],V=0;function q(O){var N={object:new Worker(O),pending:0,requests:{}};return N.object.onmessage=function(j){var R=j.data;N.pending-=R.count,N.requests[R.id][R.action](R.value),delete N.requests[R.id]},N}function U(O){var N="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(),j=new Blob([N],{type:"text/javascript"}),R=URL.createObjectURL(j);for(var D=H.length;D<O;++D)H[D]=q(R);for(var D=O;D<H.length;++D)H[D].object.postMessage({});H.length=O,URL.revokeObjectURL(R)}function w(O,N,j,R,D){var P=H[0];for(var C=1;C<H.length;++C)if(H[C].pending<P.pending)P=H[C];return new Promise(function(T,I){var x=new Uint8Array(j),S=++V;P.pending+=O,P.requests[S]={resolve:T,reject:I},P.object.postMessage({id:S,count:O,size:N,source:x,mode:R,filter:D},[x.buffer])})}function L(O){var N=O.data;if(!N.id)return self.close();self.ready.then(function(j){try{var R=new Uint8Array(N.count*N.size);G(j,j.exports[N.mode],R,N.count,N.size,N.source,j.exports[N.filter]),self.postMessage({id:N.id,count:N.count,action:"resolve",value:R},[R.buffer])}catch(D){self.postMessage({id:N.id,count:N.count,action:"reject",value:D})}})}return{ready:X,supported:!0,useWorkers:function(O){U(O)},decodeVertexBuffer:function(O,N,j,R,D){G(W,W.exports.meshopt_decodeVertexBuffer,O,N,j,R,W.exports[z[D]])},decodeIndexBuffer:function(O,N,j,R){G(W,W.exports.meshopt_decodeIndexBuffer,O,N,j,R)},decodeIndexSequence:function(O,N,j,R){G(W,W.exports.meshopt_decodeIndexSequence,O,N,j,R)},decodeGltfBuffer:function(O,N,j,R,D,P){G(W,W.exports[F[D]],O,N,j,R,W.exports[z[P]])},decodeGltfBufferAsync:function(O,N,j,R,D){if(H.length>0)return w(O,N,j,F[R],z[D]);return X.then(function(){var P=new Uint8Array(O*N);return G(W,W.exports[F[R]],P,O,N,j,W.exports[z[D]]),P})}}}();var Pi=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){Y=U.instance,Y.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 N=0;for(var L=0;L<U.length;++L)w[N++]=w[L]<60?J[w[L]]:(w[L]-60)*64+w[++L];return w.buffer.slice(0,N)}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=Y.exports.sbrk,N=O(w.length*4),j=O(L*4),R=new Uint8Array(Y.exports.memory.buffer),D=X(w);R.set(D,N);var P=U(j,N,w.length,L);R=new Uint8Array(Y.exports.memory.buffer);var C=new Uint32Array(L);new Uint8Array(C.buffer).set(R.subarray(j,j+L*4)),D.set(R.subarray(N,N+w.length*4)),O(N-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,N,j,R,D,P){var C=Y.exports.sbrk,T=C(4),I=C(L*4),x=C(N*j),S=C(L*4),A=new Uint8Array(Y.exports.memory.buffer);A.set(X(O),x),A.set(X(w),S);var E=U(I,S,L,x,N,j,R,D,P,T);A=new Uint8Array(Y.exports.memory.buffer);var v=new Uint32Array(E);X(v).set(A.subarray(I,I+E*4));var f=new Float32Array(1);return X(f).set(A.subarray(T,T+4)),C(T-C(0)),[v,f[0]]}function F(U,w,L,O,N,j,R,D,P,C,T,I,x){var S=Y.exports.sbrk,A=S(4),E=S(L*4),v=S(N*j),f=S(N*D),p=S(P.length*4),n=S(L*4),o=C?S(N):0,Y0=new Uint8Array(Y.exports.memory.buffer);if(Y0.set(X(O),v),Y0.set(X(R),f),Y0.set(X(P),p),Y0.set(X(w),n),C)Y0.set(X(C),o);var W0=U(E,n,L,v,N,j,f,D,p,P.length,o,T,I,x,A);Y0=new Uint8Array(Y.exports.memory.buffer);var C0=new Uint32Array(W0);X(C0).set(Y0.subarray(E,E+W0*4));var T0=new Float32Array(1);return X(T0).set(Y0.subarray(A,A+4)),S(A-S(0)),[C0,T0[0]]}function H(U,w,L,O){var N=Y.exports.sbrk,j=N(L*O),R=new Uint8Array(Y.exports.memory.buffer);R.set(X(w),j);var D=U(j,L,O);return N(j-N(0)),D}function V(U,w,L,O,N,j,R,D){var P=Y.exports.sbrk,C=P(D*4),T=P(L*O),I=P(L*j),x=new Uint8Array(Y.exports.memory.buffer);if(x.set(X(w),T),N)x.set(X(N),I);var S=U(C,T,L,O,I,j,R,D);x=new Uint8Array(Y.exports.memory.buffer);var A=new Uint32Array(S);return X(A).set(x.subarray(C,C+S*4)),P(C-P(0)),A}var q={LockBorder:1,Sparse:2,ErrorAbsolute:4,Prune:8,_InternalDebug:1073741824};return{ready:$,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(Y.exports.meshopt_optimizeVertexFetchRemap,w,G(U)+1)},simplify:function(U,w,L,O,N,j){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(N>=0);var R=0;for(var D=0;D<(j?j.length:0);++D)W(j[D]in q),W(this.useExperimentalFeatures||j[D]!="Prune"),R|=q[j[D]];var P=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),C=z(Y.exports.meshopt_simplify,P,U.length,w,w.length/L,L*4,O,N,R);return C[0]=U instanceof Uint32Array?C[0]:new U.constructor(C[0]),C},simplifyWithAttributes:function(U,w,L,O,N,j,R,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%N==0),W(N>=0),W(R==null||R instanceof Uint8Array),W(R==null||R.length==w.length/L),W(D>=0&&D<=U.length),W(D%3==0),W(P>=0),W(Array.isArray(j)),W(N>=j.length),W(j.length<=32);for(var T=0;T<j.length;++T)W(j[T]>=0);var I=0;for(var T=0;T<(C?C.length:0);++T)W(C[T]in q),I|=q[C[T]];var x=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),S=F(Y.exports.meshopt_simplifyWithAttributes,x,U.length,w,w.length/L,L*4,O,N*4,new Float32Array(j),R?new Uint8Array(R):null,D,P,I);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),H(Y.exports.meshopt_simplifyScale,U,U.length/w,w*4)},simplifyPoints:function(U,w,L,O,N,j){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%N==0),W(N>=3),W(U.length/w==O.length/N),V(Y.exports.meshopt_simplifyPoints,U,U.length/w,w*4,O,N*4,j,L);else return V(Y.exports.meshopt_simplifyPoints,U,U.length/w,w*4,void 0,0,0,L)}}}();var uK6=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){Y=U.instance,Y.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 N=0;for(var L=0;L<U.length;++L)w[N++]=w[L]<60?J[w[L]]:(w[L]-60)*64+w[++L];return w.buffer.slice(0,N)}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],N=U.meshlets[w*4+2],j=U.meshlets[w*4+3];return{vertices:U.vertices.subarray(L,L+N),triangles:U.triangles.subarray(O,O+j*3)}}function F(U,w,L,O,N,j,R){var D=Y.exports.sbrk,P=Y.exports.meshopt_buildMeshletsBound(U.length,N,j),C=D(P*G),T=D(P*N*4),I=D(P*j*3),x=D(U.byteLength),S=D(w.byteLength),A=new Uint8Array(Y.exports.memory.buffer);A.set(X(U),x),A.set(X(w),S);var E=Y.exports.meshopt_buildMeshlets(C,T,I,x,U.length,S,L,O,N,j,R);A=new Uint8Array(Y.exports.memory.buffer);var v=A.subarray(C,C+E*G),f=new Uint32Array(v.buffer,v.byteOffset,v.byteLength/4).slice();for(var p=0;p<E;++p){var n=f[p*4+0],o=f[p*4+1],L=f[p*4+2],Y0=f[p*4+3];Y.exports.meshopt_optimizeMeshlet(T+n*4,I+o,Y0,L)}var W0=f[(E-1)*4+0],C0=f[(E-1)*4+1],T0=f[(E-1)*4+2],a0=f[(E-1)*4+3],v8=W0+T0,o1=C0+(a0*3+3&-4),N4={meshlets:f,vertices:new Uint32Array(A.buffer,T,v8).slice(),triangles:new Uint8Array(A.buffer,I,o1*3).slice(),meshletCount:E};return D(C-D(0)),N4}function H(U){var w=new Float32Array(Y.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 V(U,w,L,O){var N=Y.exports.sbrk,j=[],R=N(w.byteLength),D=N(U.vertices.byteLength),P=N(U.triangles.byteLength),C=N(K),T=new Uint8Array(Y.exports.memory.buffer);T.set(X(w),R),T.set(X(U.vertices),D),T.set(X(U.triangles),P);for(var I=0;I<U.meshletCount;++I){var x=U.meshlets[I*4+0],S=U.meshlets[I*4+0+1],A=U.meshlets[I*4+0+3];Y.exports.meshopt_computeMeshletBounds(C,D+x*4,P+S,A,R,L,O),j.push(H(C))}return N(R-N(0)),j}function q(U,w,L,O){var N=Y.exports.sbrk,j=N(K),R=N(U.byteLength),D=N(w.byteLength),P=new Uint8Array(Y.exports.memory.buffer);P.set(X(U),R),P.set(X(w),D),Y.exports.meshopt_computeClusterBounds(j,R,U.length,D,L,O);var C=H(j);return N(j-N(0)),C}return{ready:$,supported:!0,buildMeshlets:function(U,w,L,O,N,j){W(U.length%3==0),W(w instanceof Float32Array),W(w.length%L==0),W(L>=3),W(O<=255||O>0),W(N<=512),W(N%4==0),j=j||0;var R=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return F(R,w,w.length/L,L*4,O,N,j)},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 q(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),V(U,w,w.length/L,L*4)},extractMeshlet:function(U,w){return W(w>=0&&w<U.meshletCount),z(U,w)}}}();var TW={OPTIMIZED_DIR:".optimized",CHECKSUM_EXT:".md5",DIRECTORIES:[g7.normalize("node_modules/@hytopia.com/assets"),g7.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 Q9{static instance=new Q9;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(($)=>$.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 Y=this._modelUriTrimeshes.get(Z);if(!Y){m.error(`ModelRegistry.getTrimesh(): Model ${Z} not found!`);return}let $=Y.vertices;if(J!==1){$=new Float32Array($.length);for(let Q=0;Q<$.length;Q++)$[Q]=Y.vertices[Q]*J}return{vertices:$,indices:Y.indices}}modelHasNode(Z,J){let Y=this._modelUriNodeNames.get(Z);if(!Y)m.fatalError(`ModelRegistry.modelHasNode(): Model ${Z} not found!`);return Y.includes(J)}_absoluteModelPathToModelUri(Z){let J=g7.relative(process.cwd(),Z),Y=TW.DIRECTORIES.find((Q)=>J.startsWith(Q));return(Y?g7.relative(Y,J):J).split(g7.sep).join("/")}async _getAbsoluteModelPaths(){let Z=[],J=new mL1("**/*.{gltf,glb}");for(let Y of TW.DIRECTORIES){let $=g7.resolve(process.cwd(),Y);if(!nZ.existsSync($))continue;for await(let Q of J.scan($))Z.push(g7.join($,Q))}return Z}async _loadModelData(Z){let J=await new Fj().read(Z),Y=wi(J.getRoot().listScenes()[0]),$=J.getRoot().listNodes().map((W)=>W.getName()),Q=this._absoluteModelPathToModelUri(Z);this._modelUriDocuments.set(Q,J),this._modelUriBoundingBoxes.set(Q,{min:{x:Y.min[0],y:Y.min[1],z:Y.min[2]},max:{x:Y.max[0],y:Y.max[1],z:Y.max[2]}}),this._modelUriNodeNames.set(Q,$),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)}${TW.CHECKSUM_EXT}`;if(!nZ.existsSync(J))return!1;let Y=this._calculateChecksum(Z),$=nZ.readFileSync(J,"utf8");return Y===$}_calculateChecksum(Z){if(!nZ.existsSync(Z))return"";let J=nZ.readFileSync(Z);return gL1.createHash("sha256").update(J.toString("base64")).digest("hex")}_buildOptimizedModelPath(Z){let J=g7.basename(Z),Y=J.replace(/\.[^/.]+$/,""),$=`${TW.OPTIMIZED_DIR}/${Y}`;return Z.replace(/[^/\\]+$/,`${$}/${J}`)}async _buildTrimesh(Z,J=1,Y=0.001){let $=this._modelUriDocuments.get(Z);if(!$)m.fatalError(`ModelRegistry._buildTrimesh(): Model ${Z} not found!`);let Q=Ui($);Q.setLogger(new K5(DG.WARN)),await Q.transform(rp({pivot:"center"}),Li(),Bi(),GD(),ji({simplifier:Pi,ratio:J,error:Y}),Vi());for(let z of Q.getRoot().listScenes())for(let F of z.listChildren())Fi(F);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 Y=g7.dirname(J);nZ.rmSync(Y,{recursive:!0,force:!0}),nZ.mkdirSync(Y,{recursive:!0}),console.log(`ModelRegistry: Optimizing model ${this._absoluteModelPathToModelUri(Z)}...`);for(let $ of TW.OPTIMIZER_RUNS){let Q=J.replace(/(\.[^/.]+)$/,`${$.suffix}$1`),{stderr:W}=await Sd("bunx",["gltf-transform","optimize",Z,Q,...$.options]);if(W)return m.warning(`ModelRegistry._optimizeModel(): Error optimizing model ${this._absoluteModelPathToModelUri(Z)}, defaulting to unoptimized model. Error: ${W}`),Z}return nZ.writeFileSync(`${J}${TW.CHECKSUM_EXT}`,this._calculateChecksum(Z)),J}}var rG;((Q)=>{Q.DYNAMIC="dynamic";Q.FIXED="fixed";Q.KINEMATIC_POSITION="kinematic_position";Q.KINEMATIC_VELOCITY="kinematic_velocity"})(rG||={});var FD=0.001,Di="dynamic";class nY 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??=Di,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:Y,w:$}=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:Y,principalAngularInertia:$,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 Y={["dynamic"]:K1.RigidBodyType.Dynamic,["fixed"]:K1.RigidBodyType.Fixed,["kinematic_position"]:K1.RigidBodyType.KinematicPositionBased,["kinematic_velocity"]:K1.RigidBodyType.KinematicVelocityBased}[Z];if(Y===void 0)return m.error(`Invalid RigidBodyType: ${Z}`);this._rigidBody?this._rigidBody.setBodyType(Y,!this._explicitSleep):this._rigidBodyDesc.status=Y,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 f5({...Z,parentRigidBody:this,simulation:this._simulation}):this._createAndAddPendingChildCollider(Z)}createAndAddChildCollidersToSimulation(Z){let J=[];return Z.forEach((Y)=>{let $=this.createAndAddChildCollider(Y);if($)J.push($)}),J}getCollidersByTag(Z){let J=[];for(let Y of this._colliders)if(Y.tag===Z)J.push(Y);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(Y in Z)$(Z[Y])})}_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 f5(Z);return this._colliders.add(J),J}_createAndAddPendingChildColliders(Z){let J=[];return Z.forEach((Y)=>{let $=this._createAndAddPendingChildCollider(Y);if($)J.push($)}),J}_createRigidBodyDesc(Z){let J=Z.type??Di;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)<FD&&Math.abs(Z.y)<FD&&Math.abs(Z.z)<FD}}var HD;((Q)=>{Q[Q.Average=0]="Average";Q[Q.Min=1]="Min";Q[Q.Multiply=2]="Multiply";Q[Q.Max=3]="Max"})(HD||={});var tG;((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"})(tG||={});class f5 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,Y){let $=Q9.instance.getBoundingBox(Z),Q=$.max.x-$.min.x,W=$.max.y-$.min.y,X=$.max.z-$.min.z,K=Math.max(Q,X),G=Math.min(Q,X),z=K/G,F=K/W,H=K*J/2,V=(N)=>Math.max(0.01,N),q=()=>({shape:"block",halfExtents:{x:V(Q*J/2),y:V(W*J/2),z:V(X*J/2)}}),U=()=>({shape:"round-cylinder",radius:V(H),halfHeight:V(W*J/2),borderRadius:V(H*0.1)}),w=()=>{let N=Q9.instance.getTrimesh(Z,J);if(!N)return;return{shape:"trimesh",vertices:N.vertices,indices:N.indices}},L=()=>({shape:"wedge",extents:{x:Q*J,y:W*J,z:X*J}}),O=()=>({shape:"capsule",radius:V(H),halfHeight:V(W*J/2-H)});if(Y)switch(Y){case"block":return q();case"capsule":return O();case"round-cylinder":return U();case"trimesh":{let N=w();if(!N){m.error(`Collider.optionsFromModelUri(): Failed to create trimesh options for model ${Z}, falling back to generic shape!`);break}return N}case"wedge":return L();default:m.warning(`Collider.optionsFromModelUri(): Preferred shape ${Y} is not yet supported with Collider.optionsFromModelUri(), defaulting to generic shape!`)}if(z>2)return q();if(F>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?u9.decodeRawCollisionGroups(this._collider.collisionGroups()):u9.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=u9.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,Y=Z?J|K1.ActiveEvents.COLLISION_EVENTS:J&~K1.ActiveEvents.COLLISION_EVENTS;(this._collider??this._colliderDesc).setActiveEvents(Y),this._setActiveCollisionTypes()}enableContactForceEvents(Z){if(!this._requireNotRemoved("enableContactForceEvents"))return;let J=this._collider?this._collider.activeEvents():this._colliderDesc.activeEvents,Y=Z?J|K1.ActiveEvents.CONTACT_FORCE_EVENTS:J&~K1.ActiveEvents.CONTACT_FORCE_EVENTS;(this._collider??this._colliderDesc).setActiveEvents(Y),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[Y]!==void 0)$.call(this,Z[Y])})}_autoAddToSimulation(Z){if(Z.simulation)this.addToSimulation(Z.simulation,Z.parentRigidBody)}_buildWedgeConvexHullVertices(Z){let{x:J,y:Y,z:$}=Z,Q=J/2,W=$/2,X=Y/2;return new Float32Array([-Q,0-X,-W,Q,0-X,-W,Q,0-X,W,-Q,0-X,W,-Q,Y-X,-W,Q,Y-X,-W])}_createColliderDesc(Z){let{shape:J,flags:Y}=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,Y)}case"wedge":{if(!Z.extents)m.fatalError("Wedge collider must have extents!");let $=this._buildWedgeConvexHullVertices(Z.extents),Q=K1.ColliderDesc.convexHull($);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 dL1={shape:"trimesh",flags:ZG.FIX_INTERNAL_EDGES},uL1=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]),cL1=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]),VD;((Y)=>{Y.ENTITY_COLLISION="BLOCK_TYPE.ENTITY_COLLISION";Y.ENTITY_CONTACT_FORCE="BLOCK_TYPE.ENTITY_CONTACT_FORCE"})(VD||={});class y5 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,...dL1}}get isLiquid(){return this._isLiquid}get isMeshable(){return!this._customColliderOptions}get name(){return this._name}get textureUri(){return this._textureUri}createCollider(Z=uL1,J=cL1){let Y=new f5({...this.colliderOptions,indices:Z,vertices:J});if(this.isLiquid)Y.setSensor(!0);if(this.hasListeners("BLOCK_TYPE.ENTITY_COLLISION")||this.isLiquid)Y.enableCollisionEvents(!0);if(this.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))Y.enableContactForceEvents(!0);if(u9.isDefaultCollisionGroups(Y.collisionGroups))Y.setCollisionGroups({belongsTo:[1],collidesWith:[65535&~1]});return Y}serialize(){return p0.serializeBlockType(this)}}var qD;((J)=>J.REGISTER_BLOCK_TYPE="BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE")(qD||={});class eG 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 Y=new class extends y5{constructor($=Z){super($)}};return this.registerBlockType(Y),Y}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 uC={};b9(uC,{worldSchema:()=>dC,worldPacketDefinition:()=>Or,vectorSchema:()=>v1,vectorBooleanSchema:()=>dj1,uiSchema:()=>gC,uiPacketDefinition:()=>wr,uiDatasSchema:()=>mC,uiDatasPacketDefinition:()=>Br,uiDataSendPacketDefinition:()=>Yr,uiDataSchema:()=>P3,syncResponseSchema:()=>bC,syncResponsePacketDefinition:()=>Lr,syncRequestSchema:()=>UC,syncRequestPacketDefinition:()=>Jr,stateRequestSchema:()=>qC,stateRequestPacketDefinition:()=>Zr,sceneUIsSchema:()=>yC,sceneUIsPacketDefinition:()=>Ur,sceneUISchema:()=>fC,rgbColorSchema:()=>g4,registeredPackets:()=>dL,quaternionSchema:()=>TC,playersSchema:()=>hC,playersPacketDefinition:()=>qr,playerSchema:()=>xC,physicsDebugRenderSchema:()=>AC,physicsDebugRenderPacketDefinition:()=>Hr,physicsDebugRaycastsSchema:()=>_C,physicsDebugRaycastsPacketDefinition:()=>Vr,physicsDebugRaycastSchema:()=>SC,outboundPackets:()=>mL,modelNodeOverrideSchema:()=>CC,lightsSchema:()=>vC,lightsPacketDefinition:()=>Fr,lightSchema:()=>IC,isValidPacket:()=>cj1,inputSchema:()=>VC,inputPacketDefinition:()=>eo,inboundPackets:()=>gL,hexColorSchema:()=>FC,heartbeatSchema:()=>zC,heartbeatPacketDefinition:()=>oo,entitySchema:()=>kC,entitiesSchema:()=>EC,entitiesPacketDefinition:()=>zr,definePacket:()=>k0,debugConfigSchema:()=>HC,debugConfigPacketDefinition:()=>to,createPacket:()=>Sj1,connectionSchema:()=>GC,connectionPacketDefinition:()=>so,chunksSchema:()=>DC,chunksPacketDefinition:()=>Gr,chunkSchema:()=>PC,chatMessagesSchema:()=>jC,chatMessagesPacketDefinition:()=>Kr,chatMessageSendPacketDefinition:()=>ro,chatMessageSchema:()=>j3,cameraSchema:()=>RC,cameraPacketDefinition:()=>Xr,blocksSchema:()=>OC,blocksPacketDefinition:()=>Qr,blockTypesSchema:()=>NC,blockTypesPacketDefinition:()=>Wr,blockTypeSchema:()=>MC,blockSchema:()=>BC,bidirectionalPackets:()=>bL,audiosSchema:()=>wC,audiosPacketDefinition:()=>$r,audioSchema:()=>LC,PacketId:()=>h1});var bL={};b9(bL,{heartbeatPacketDefinition:()=>oo,connectionPacketDefinition:()=>so});var XC=t(no(),1);class KC extends XC.default{static instance=new XC.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 Sj1(Z,J,Y){if(!Z.validate(J))throw new Error(`Invalid payload for packet with id ${Z.id}. Error: ${KC.instance.errorsText(Z.validate.errors)}`);let $=[Z.id,J];if(typeof Y==="number")$.push(Y);return $}function k0(Z,J){return{id:Z,schema:J,validate:KC.instance.compile(J)}}var _j1={type:"object",properties:{i:{type:"string"}},required:["i"],additionalProperties:!1},ao={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},Aj1={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},xj1={type:"object",properties:{usernameFragment:{type:"string"},password:{type:"string"},iceLite:{type:"boolean",nullable:!0}},required:["usernameFragment","password"],additionalProperties:!1},hj1={type:"object",properties:{i:{type:"string"},l:{type:"string"}},required:["i","l"],additionalProperties:!1},fj1={type:"object",properties:{port:{type:"number"},OS:{type:"number"},MIS:{type:"number"},maxMessageSize:{type:"number"}},required:["port","OS","MIS","maxMessageSize"],additionalProperties:!0},yj1={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},bj1={type:"object",properties:{i:{type:"string"},f:{type:"string",enum:["cs","sc"]},ip:xj1,ic:{type:"array",items:Aj1},d:ao,s:fj1},required:["i","f","ip","ic","d","s"],additionalProperties:!1},gj1={type:"object",properties:{i:{type:"string"},d:ao},required:["i","d"],additionalProperties:!1},mj1={type:"object",properties:{i:{type:"string",nullable:!0},pi:{type:"string",nullable:!0},l:{type:"string"},s:yj1},required:["l","s"],additionalProperties:!1},GC={type:"object",properties:{i:{type:"string",nullable:!0},c:{...gj1,nullable:!0},ca:{..._j1,nullable:!0},d:{type:"array",items:{...mj1},nullable:!0},pa:{...hj1,nullable:!0},t:{type:"array",items:{...bj1},nullable:!0}},additionalProperties:!1};var so=k0(116,GC);var zC={type:"null",nullable:!0};var oo=k0(117,zC);var gL={};b9(gL,{uiDataSendPacketDefinition:()=>Yr,syncRequestPacketDefinition:()=>Jr,stateRequestPacketDefinition:()=>Zr,inputPacketDefinition:()=>eo,debugConfigPacketDefinition:()=>to,chatMessageSendPacketDefinition:()=>ro});var FC={type:"string",pattern:"^[0-9A-Fa-f]{6}$"};var j3={type:"object",properties:{m:{type:"string"},c:{...FC,nullable:!0},p:{type:"string",nullable:!0}},required:["m"],additionalProperties:!1};var ro=k0(3,j3);var HC={type:"object",properties:{pdr:{type:"boolean",nullable:!0}},additionalProperties:!1};var to=k0(128,HC);var VC={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 eo=k0(1,VC);var qC={type:"object",properties:{},additionalProperties:!1};var Zr=k0(2,qC);var UC={type:"null",nullable:!0};var Jr=k0(0,UC);var P3={type:"object",properties:{},additionalProperties:!0};var Yr=k0(4,P3);var mL={};b9(mL,{worldPacketDefinition:()=>Or,uiPacketDefinition:()=>wr,uiDatasPacketDefinition:()=>Br,syncResponsePacketDefinition:()=>Lr,sceneUIsPacketDefinition:()=>Ur,playersPacketDefinition:()=>qr,physicsDebugRenderPacketDefinition:()=>Hr,physicsDebugRaycastsPacketDefinition:()=>Vr,lightsPacketDefinition:()=>Fr,entitiesPacketDefinition:()=>zr,chunksPacketDefinition:()=>Gr,chatMessagesPacketDefinition:()=>Kr,cameraPacketDefinition:()=>Xr,blocksPacketDefinition:()=>Qr,blockTypesPacketDefinition:()=>Wr,audiosPacketDefinition:()=>$r});var v1={type:"array",items:[{type:"number"},{type:"number"},{type:"number"}],minItems:3,maxItems:3};var LC={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 wC={type:"array",items:{...LC}};var $r=k0(33,wC);var BC={type:"object",properties:{i:{type:"number"},c:v1},required:["i","c"],additionalProperties:!1};var OC={type:"array",items:{...BC}};var Qr=k0(34,OC);var MC={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 NC={type:"array",items:{...MC}};var Wr=k0(35,NC);var RC={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 jC={type:"array",items:{...j3}};var PC={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 DC={type:"array",items:{...PC}};var g4={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 CC={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:{...g4,nullable:!0}},required:["n"],additionalProperties:!1};var TC={type:"array",items:[{type:"number"},{type:"number"},{type:"number"},{type:"number"}],minItems:4,maxItems:4};var kC={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:{...CC},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:{...TC,nullable:!0},rm:{type:"boolean",nullable:!0},s:{type:"number",nullable:!0},t:{...g4,nullable:!0}},required:["i"],additionalProperties:!1};var EC={type:"array",items:{...kC}};var IC={type:"object",properties:{i:{type:"number"},a:{type:"number",nullable:!0},e:{type:"number",nullable:!0},c:{...g4,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 vC={type:"array",items:{...IC}};var SC={type:"object",properties:{o:{...v1},d:{...v1},l:{type:"number"},h:{type:"boolean"}},required:["o","d","l","h"],additionalProperties:!1};var _C={type:"array",items:{...SC}};var AC={type:"object",properties:{v:{type:"array",items:{type:"number"}},c:{type:"array",items:{type:"number"}}},required:["v","c"],additionalProperties:!1};var xC={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 hC={type:"array",items:{...xC}};var fC={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 yC={type:"array",items:{...fC}};var bC={type:"object",properties:{r:{type:"number"},s:{type:"number"},p:{type:"number"},n:{type:"number"}},required:["r","s","p","n"],additionalProperties:!1};var gC={type:"object",properties:{p:{type:"boolean",nullable:!0},u:{type:"string",nullable:!0}},additionalProperties:!1};var mC={type:"array",items:{...P3}};var dj1={type:"array",items:[{type:"boolean"},{type:"boolean"},{type:"boolean"}],minItems:3,maxItems:3};var dC={type:"object",properties:{i:{type:"number"},ac:{...g4,nullable:!0},ai:{type:"number",nullable:!0},dc:{...g4,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 Xr=k0(40,RC);var Kr=k0(36,jC);var Gr=k0(37,DC);var zr=k0(38,EC);var Fr=k0(44,vC);var Hr=k0(192,AC);var Vr=k0(193,_C);var qr=k0(45,hC);var Ur=k0(43,yC);var Lr=k0(32,bC);var wr=k0(41,gC);var Br=k0(42,mC);var Or=k0(39,dC);var dL=new Map,uj1={...bL,...gL,...mL};for(let Z of Object.values(uj1))if("id"in Z&&"schema"in Z){let J=Z;if(dL.has(J.id))throw new Error(`Packet with id ${J.id} is already registered.`);dL.set(J.id,J)}function cj1(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=dL.get(Z[0]);return!!J&&J.validate(Z[1])}var $0=uC;import{WebSocket as lt8}from"ws";var m6=t(jt(),1),rq6=m6.default.v1,tq6=m6.default.v1ToV6,eq6=m6.default.v3,Pt=m6.default.v4,ZU6=m6.default.v5,JU6=m6.default.v6,YU6=m6.default.v6ToV1,$U6=m6.default.v7,QU6=m6.default.NIL,WU6=m6.default.MAX,XU6=m6.default.version,KU6=m6.default.validate,GU6=m6.default.stringify,zU6=m6.default.parse;var oC;try{oC=new TextDecoder}catch(Z){}var e,g5,b=0;var ZT=[],J$=ZT,T3=0,S1={},J1,i7,b5=0,K9=0,d8,n7,L5=[],e0,Dt={useRecords:!1,mapsAsObjects:!0};class sL{}var JT=new sL;JT.name="MessagePack 0xC1";var ZJ=!1,_t=2,rC,tC,eC;try{new Function("")}catch(Z){_t=1/0}class a7{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 ct(()=>{return aL(),this?this.unpack(Z,J):a7.prototype.unpack.call(Dt,Z,J)});if(!Z.buffer&&Z.constructor===ArrayBuffer)Z=typeof Buffer!=="undefined"?Buffer.from(Z):new Uint8Array(Z);if(typeof J==="object")g5=J.end||Z.length,b=J.start||0;else b=0,g5=J>-1?J:Z.length;T3=0,K9=0,i7=null,J$=ZT,d8=null,e=Z;try{e0=Z.dataView||(Z.dataView=new DataView(Z.buffer,Z.byteOffset,Z.byteLength))}catch(Y){if(e=null,Z instanceof Uint8Array)throw Y;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 a7){if(S1=this,this.structures)return J1=this.structures,iL(J);else if(!J1||J1.length>0)J1=[]}else if(S1=Dt,!J1||J1.length>0)J1=[];return iL(J)}unpackMultiple(Z,J){let Y,$=0;try{ZJ=!0;let Q=Z.length,W=this?this.unpack(Z,Q):oL.unpack(Z,Q);if(J){if(J(W,$,b)===!1)return;while(b<Q)if($=b,J(iL(),$,b)===!1)return}else{Y=[W];while(b<Q)$=b,Y.push(iL());return Y}}catch(Q){throw Q.lastPosition=$,Q.values=Y,Q}finally{ZJ=!1,aL()}}_mergeStructures(Z,J){if(tC)Z=tC.call(this,Z);if(Z=Z||[],Object.isFrozen(Z))Z=Z.map((Y)=>Y.slice(0));for(let Y=0,$=Z.length;Y<$;Y++){let Q=Z[Y];if(Q){if(Q.isShared=!0,Y>=32)Q.highByte=Y-32>>5}}Z.sharedLength=Z.length;for(let Y in J||[])if(Y>=0){let $=Z[Y],Q=J[Y];if(Q){if($)(Z.restoreStructures||(Z.restoreStructures=[]))[Y]=$;Z[Y]=Q}}return this.structures=Z}decode(Z,J){return this.unpack(Z,J)}}function iL(Z){try{if(!S1.trusted&&!ZJ){let Y=J1.sharedLength||0;if(Y<J1.length)J1.length=Y}let J;if(S1.randomAccessStructure&&e[b]<64&&e[b]>=32&&rC){if(J=rC(e,b,g5,S1),e=null,!(Z&&Z.lazy)&&J)J=J.toJSON();b=g5}else J=D8();if(d8)b=d8.postBundlePosition,d8=null;if(ZJ)J1.restoreStructures=null;if(b==g5){if(J1&&J1.restoreStructures)Ct();if(J1=null,e=null,n7)n7=null}else if(b>g5)throw new Error("Unexpected end of MessagePack data");else if(!ZJ){let Y;try{Y=JSON.stringify(J,($,Q)=>typeof Q==="bigint"?`${Q}n`:Q).slice(0,100)}catch($){Y="(JSON view not available "+$+")"}throw new Error("Data read, but end of buffer not reached "+Y)}return J}catch(J){if(J1&&J1.restoreStructures)Ct();if(aL(),J instanceof RangeError||J.message.startsWith("Unexpected end of buffer")||b>g5)J.incomplete=!0;throw J}}function Ct(){for(let Z in J1.restoreStructures)J1[Z]=J1.restoreStructures[Z];J1.restoreStructures=null}function D8(){let Z=e[b++];if(Z<160)if(Z<128)if(Z<64)return Z;else{let J=J1[Z&63]||S1.getStructures&&At()[Z&63];if(J){if(!J.read)J.read=YT(J,Z&63);return J.read()}else return Z}else if(Z<144)if(Z-=128,S1.mapsAsObjects){let J={};for(let Y=0;Y<Z;Y++){let $=dt();if($==="__proto__")$="__proto_";J[$]=D8()}return J}else{let J=new Map;for(let Y=0;Y<Z;Y++)J.set(D8(),D8());return J}else{Z-=144;let J=new Array(Z);for(let Y=0;Y<Z;Y++)J[Y]=D8();if(S1.freezeData)return Object.freeze(J);return J}else if(Z<192){let J=Z-160;if(K9>=b)return i7.slice(b-b5,(b+=J)-b5);if(K9==0&&g5<140){let Y=J<16?$T(J):mt(J);if(Y!=null)return Y}return nL(J)}else{let J;switch(Z){case 192:return null;case 193:if(d8)if(J=D8(),J>0)return d8[1].slice(d8.position1,d8.position1+=J);else return d8[0].slice(d8.position0,d8.position0-=J);return JT;case 194:return!1;case 195:return!0;case 196:if(J=e[b++],J===void 0)throw new Error("Unexpected end of buffer");return sC(J);case 197:return J=e0.getUint16(b),b+=2,sC(J);case 198:return J=e0.getUint32(b),b+=4,sC(J);case 199:return Z$(e[b++]);case 200:return J=e0.getUint16(b),b+=2,Z$(J);case 201:return J=e0.getUint32(b),b+=4,Z$(J);case 202:if(J=e0.getFloat32(b),S1.useFloat32>2){let Y=$$[(e[b]&127)<<1|e[b+1]>>7];return b+=4,(Y*J+(J>0?0.5:-0.5)>>0)/Y}return b+=4,J;case 203:return J=e0.getFloat64(b),b+=8,J;case 204:return e[b++];case 205:return J=e0.getUint16(b),b+=2,J;case 206:return J=e0.getUint32(b),b+=4,J;case 207:if(S1.int64AsType==="number")J=e0.getUint32(b)*4294967296,J+=e0.getUint32(b+4);else if(S1.int64AsType==="string")J=e0.getBigUint64(b).toString();else if(S1.int64AsType==="auto"){if(J=e0.getBigUint64(b),J<=BigInt(2)<<BigInt(52))J=Number(J)}else J=e0.getBigUint64(b);return b+=8,J;case 208:return e0.getInt8(b++);case 209:return J=e0.getInt16(b),b+=2,J;case 210:return J=e0.getInt32(b),b+=4,J;case 211:if(S1.int64AsType==="number")J=e0.getInt32(b)*4294967296,J+=e0.getUint32(b+4);else if(S1.int64AsType==="string")J=e0.getBigInt64(b).toString();else if(S1.int64AsType==="auto"){if(J=e0.getBigInt64(b),J>=BigInt(-2)<<BigInt(52)&&J<=BigInt(2)<<BigInt(52))J=Number(J)}else J=e0.getBigInt64(b);return b+=8,J;case 212:if(J=e[b++],J==114)return St(e[b++]&63);else{let Y=L5[J];if(Y)if(Y.read)return b++,Y.read(D8());else if(Y.noBuffer)return b++,Y();else return Y(e.subarray(b,++b));else throw new Error("Unknown extension "+J)}case 213:if(J=e[b],J==114)return b++,St(e[b++]&63,e[b++]);else return Z$(2);case 214:return Z$(4);case 215:return Z$(8);case 216:return Z$(16);case 217:if(J=e[b++],K9>=b)return i7.slice(b-b5,(b+=J)-b5);return xt(J);case 218:if(J=e0.getUint16(b),b+=2,K9>=b)return i7.slice(b-b5,(b+=J)-b5);return ht(J);case 219:if(J=e0.getUint32(b),b+=4,K9>=b)return i7.slice(b-b5,(b+=J)-b5);return ft(J);case 220:return J=e0.getUint16(b),b+=2,kt(J);case 221:return J=e0.getUint32(b),b+=4,kt(J);case 222:return J=e0.getUint16(b),b+=2,Et(J);case 223:return J=e0.getUint32(b),b+=4,Et(J);default:if(Z>=224)return Z-256;if(Z===void 0){let Y=new Error("Unexpected end of MessagePack data");throw Y.incomplete=!0,Y}throw new Error("Unknown MessagePack token "+Z)}}}var OD1=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function YT(Z,J){function Y(){if(Y.count++>_t){let Q=Z.read=new Function("r","return function(){return "+(S1.freezeData?"Object.freeze":"")+"({"+Z.map((W)=>W==="__proto__"?"__proto_:r()":OD1.test(W)?W+":r()":"["+JSON.stringify(W)+"]:r()").join(",")+"})}")(D8);if(Z.highByte===0)Z.read=Tt(J,Z.read);return Q()}let $={};for(let Q=0,W=Z.length;Q<W;Q++){let X=Z[Q];if(X==="__proto__")X="__proto_";$[X]=D8()}if(S1.freezeData)return Object.freeze($);return $}if(Y.count=0,Z.highByte===0)return Tt(J,Y);return Y}var Tt=(Z,J)=>{return function(){let Y=e[b++];if(Y===0)return J();let $=Z<32?-(Z+(Y<<5)):Z+(Y<<5),Q=J1[$]||At()[$];if(!Q)throw new Error("Record id is not defined for "+$);if(!Q.read)Q.read=YT(Q,Z);return Q.read()}};function At(){let Z=ct(()=>{return e=null,S1.getStructures()});return J1=S1._mergeStructures(Z,J1)}var nL=Y$,xt=Y$,ht=Y$,ft=Y$,yt=!1;function bt(Z){yt=!0,nL=J(1),xt=J(2),ht=J(3),ft=J(5);function J(Y){return function $(Q){let W=J$[T3++];if(W==null){if(d8)return Y$(Q);let K=e.byteOffset,G=Z(b-Y+K,g5+K,e.buffer);if(typeof G=="string")W=G,J$=ZT;else if(J$=G,T3=1,K9=1,W=J$[0],W===void 0)throw new Error("Unexpected end of buffer")}let X=W.length;if(X<=Q)return b+=Q,W;return i7=W,b5=b,K9=b+X,b+=Q,W.slice(0,Q)}}}function Y$(Z){let J;if(Z<16){if(J=$T(Z))return J}if(Z>64&&oC)return oC.decode(e.subarray(b,b+=Z));let Y=b+Z,$=[];J="";while(b<Y){let Q=e[b++];if((Q&128)===0)$.push(Q);else if((Q&224)===192){let W=e[b++]&63;$.push((Q&31)<<6|W)}else if((Q&240)===224){let W=e[b++]&63,X=e[b++]&63;$.push((Q&31)<<12|W<<6|X)}else if((Q&248)===240){let W=e[b++]&63,X=e[b++]&63,K=e[b++]&63,G=(Q&7)<<18|W<<12|X<<6|K;if(G>65535)G-=65536,$.push(G>>>10&1023|55296),G=56320|G&1023;$.push(G)}else $.push(Q);if($.length>=4096)J+=s8.apply(String,$),$.length=0}if($.length>0)J+=s8.apply(String,$);return J}function gt(Z,J,Y){let $=e;e=Z,b=J;try{return Y$(Y)}finally{e=$}}function kt(Z){let J=new Array(Z);for(let Y=0;Y<Z;Y++)J[Y]=D8();if(S1.freezeData)return Object.freeze(J);return J}function Et(Z){if(S1.mapsAsObjects){let J={};for(let Y=0;Y<Z;Y++){let $=dt();if($==="__proto__")$="__proto_";J[$]=D8()}return J}else{let J=new Map;for(let Y=0;Y<Z;Y++)J.set(D8(),D8());return J}}var s8=String.fromCharCode;function mt(Z){let J=b,Y=new Array(Z);for(let $=0;$<Z;$++){let Q=e[b++];if((Q&128)>0){b=J;return}Y[$]=Q}return s8.apply(String,Y)}function $T(Z){if(Z<4)if(Z<2)if(Z===0)return"";else{let J=e[b++];if((J&128)>1){b-=1;return}return s8(J)}else{let J=e[b++],Y=e[b++];if((J&128)>0||(Y&128)>0){b-=2;return}if(Z<3)return s8(J,Y);let $=e[b++];if(($&128)>0){b-=3;return}return s8(J,Y,$)}else{let J=e[b++],Y=e[b++],$=e[b++],Q=e[b++];if((J&128)>0||(Y&128)>0||($&128)>0||(Q&128)>0){b-=4;return}if(Z<6)if(Z===4)return s8(J,Y,$,Q);else{let W=e[b++];if((W&128)>0){b-=5;return}return s8(J,Y,$,Q,W)}else if(Z<8){let W=e[b++],X=e[b++];if((W&128)>0||(X&128)>0){b-=6;return}if(Z<7)return s8(J,Y,$,Q,W,X);let K=e[b++];if((K&128)>0){b-=7;return}return s8(J,Y,$,Q,W,X,K)}else{let W=e[b++],X=e[b++],K=e[b++],G=e[b++];if((W&128)>0||(X&128)>0||(K&128)>0||(G&128)>0){b-=8;return}if(Z<10)if(Z===8)return s8(J,Y,$,Q,W,X,K,G);else{let z=e[b++];if((z&128)>0){b-=9;return}return s8(J,Y,$,Q,W,X,K,G,z)}else if(Z<12){let z=e[b++],F=e[b++];if((z&128)>0||(F&128)>0){b-=10;return}if(Z<11)return s8(J,Y,$,Q,W,X,K,G,z,F);let H=e[b++];if((H&128)>0){b-=11;return}return s8(J,Y,$,Q,W,X,K,G,z,F,H)}else{let z=e[b++],F=e[b++],H=e[b++],V=e[b++];if((z&128)>0||(F&128)>0||(H&128)>0||(V&128)>0){b-=12;return}if(Z<14)if(Z===12)return s8(J,Y,$,Q,W,X,K,G,z,F,H,V);else{let q=e[b++];if((q&128)>0){b-=13;return}return s8(J,Y,$,Q,W,X,K,G,z,F,H,V,q)}else{let q=e[b++],U=e[b++];if((q&128)>0||(U&128)>0){b-=14;return}if(Z<15)return s8(J,Y,$,Q,W,X,K,G,z,F,H,V,q,U);let w=e[b++];if((w&128)>0){b-=15;return}return s8(J,Y,$,Q,W,X,K,G,z,F,H,V,q,U,w)}}}}}function It(){let Z=e[b++],J;if(Z<192)J=Z-160;else switch(Z){case 217:J=e[b++];break;case 218:J=e0.getUint16(b),b+=2;break;case 219:J=e0.getUint32(b),b+=4;break;default:throw new Error("Expected string")}return Y$(J)}function sC(Z){return S1.copyBuffers?Uint8Array.prototype.slice.call(e,b,b+=Z):e.subarray(b,b+=Z)}function Z$(Z){let J=e[b++];if(L5[J]){let Y;return L5[J](e.subarray(b,Y=b+=Z),($)=>{b=$;try{return D8()}finally{b=Y}})}else throw new Error("Unknown extension type "+J)}var vt=new Array(4096);function dt(){let Z=e[b++];if(Z>=160&&Z<192){if(Z=Z-160,K9>=b)return i7.slice(b-b5,(b+=Z)-b5);else if(!(K9==0&&g5<180))return nL(Z)}else return b--,ut(D8());let J=(Z<<5^(Z>1?e0.getUint16(b):Z>0?e[b]:0))&4095,Y=vt[J],$=b,Q=b+Z-3,W,X=0;if(Y&&Y.bytes==Z){while($<Q){if(W=e0.getUint32($),W!=Y[X++]){$=1879048192;break}$+=4}Q+=3;while($<Q)if(W=e[$++],W!=Y[X++]){$=1879048192;break}if($===Q)return b=$,Y.string;Q-=3,$=b}Y=[],vt[J]=Y,Y.bytes=Z;while($<Q)W=e0.getUint32($),Y.push(W),$+=4;Q+=3;while($<Q)W=e[$++],Y.push(W);let K=Z<16?$T(Z):mt(Z);if(K!=null)return Y.string=K;return Y.string=nL(Z)}function ut(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 St=(Z,J)=>{let Y=D8().map(ut),$=Z;if(J!==void 0)Z=Z<32?-((J<<5)+Z):(J<<5)+Z,Y.highByte=J;let Q=J1[Z];if(Q&&(Q.isShared||ZJ))(J1.restoreStructures||(J1.restoreStructures=[]))[Z]=Q;return J1[Z]=Y,Y.read=YT(Y,$),Y.read()};L5[0]=()=>{};L5[0].noBuffer=!0;L5[66]=(Z)=>{let J=Z.length,Y=BigInt(Z[0]&128?Z[0]-256:Z[0]);for(let $=1;$<J;$++)Y<<=BigInt(8),Y+=BigInt(Z[$]);return Y};var MD1={Error,TypeError,ReferenceError};L5[101]=()=>{let Z=D8();return(MD1[Z[0]]||Error)(Z[1],{cause:Z[2]})};L5[105]=(Z)=>{if(S1.structuredClone===!1)throw new Error("Structured clone extension is disabled");let J=e0.getUint32(b-4);if(!n7)n7=new Map;let Y=e[b],$;if(Y>=144&&Y<160||Y==220||Y==221)$=[];else if(Y>=128&&Y<144||Y==222||Y==223)$=new Map;else if((Y>=199&&Y<=201||Y>=212&&Y<=216)&&e[b+1]===115)$=new Set;else $={};let Q={target:$};n7.set(J,Q);let W=D8();if(!Q.used)return Q.target=W;else Object.assign($,W);if($ instanceof Map)for(let[X,K]of W.entries())$.set(X,K);if($ instanceof Set)for(let X of Array.from(W))$.add(X);return $};L5[112]=(Z)=>{if(S1.structuredClone===!1)throw new Error("Structured clone extension is disabled");let J=e0.getUint32(b-4),Y=n7.get(J);return Y.used=!0,Y.target};L5[115]=()=>new Set(D8());var QT=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map((Z)=>Z+"Array"),ND1=typeof globalThis==="object"?globalThis:window;L5[116]=(Z)=>{let J=Z[0],Y=Uint8Array.prototype.slice.call(Z,1).buffer,$=QT[J];if(!$){if(J===16)return Y;if(J===17)return new DataView(Y);throw new Error("Could not find typed array for code "+J)}return new ND1[$](Y)};L5[120]=()=>{let Z=D8();return new RegExp(Z[0],Z[1])};var RD1=[];L5[98]=(Z)=>{let J=(Z[0]<<24)+(Z[1]<<16)+(Z[2]<<8)+Z[3],Y=b;return b+=J-Z.length,d8=RD1,d8=[It(),It()],d8.position0=0,d8.position1=0,d8.postBundlePosition=b,b=Y,D8()};L5[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 ct(Z){if(eC)eC();let J=g5,Y=b,$=T3,Q=b5,W=K9,X=i7,K=J$,G=n7,z=d8,F=new Uint8Array(e.slice(0,g5)),H=J1,V=J1.slice(0,J1.length),q=S1,U=ZJ,w=Z();return g5=J,b=Y,T3=$,b5=Q,K9=W,i7=X,J$=K,n7=G,d8=z,e=F,ZJ=U,J1=H,J1.splice(0,J1.length,...V),S1=q,e0=new DataView(e.buffer,e.byteOffset,e.byteLength),w}function aL(){e=null,n7=null,J1=null}var $$=new Array(147);for(let Z=0;Z<256;Z++)$$[Z]=+("1e"+Math.floor(45.15-Z*0.30103));var oL=new a7({useRecords:!1}),jD1=oL.unpack,PD1=oL.unpackMultiple,DD1=oL.unpack;var CD1=new Float32Array(1),HU6=new Uint8Array(CD1.buffer,0,4);function lt(Z,J,Y){rC=Z,tC=J,eC=Y}var tL;try{tL=new TextEncoder}catch(Z){}var KT,at,E3=typeof Buffer!=="undefined",rL=E3?function(Z){return Buffer.allocUnsafeSlow(Z)}:Uint8Array,st=E3?Buffer:Uint8Array,pt=E3?4294967296:2144337920,c,k3,_1,g=0,d6,Z8=null,ot,TD1=21760,kD1=/[\u0080-\uFFFF]/,m4=Symbol("record-id");class Q$ extends a7{constructor(Z){super(Z);this.offset=0;let J,Y,$,Q,W,X=st.prototype.utf8Write?function(E,v){return c.utf8Write(E,v,c.byteLength-v)}:tL&&tL.encodeInto?function(E,v){return tL.encodeInto(E,c.subarray(v)).written}:!1,K=this;if(!Z)Z={};let G=Z&&Z.sequential,z=Z.structures||Z.saveStructures,F=Z.maxSharedStructures;if(F==null)F=z?32:0;if(F>8160)throw new Error("Maximum maxSharedStructure is 8160");if(Z.structuredClone&&Z.moreTypes==null)this.moreTypes=!0;let H=Z.maxOwnStructures;if(H==null)H=z?32:64;if(!this.structures&&Z.useRecords!=!1)this.structures=[];let V=F>32||H+F>64,q=F+64,U=F+H+64;if(U>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let w=[],L=0,O=0;this.pack=this.encode=function(E,v){if(!c)c=new rL(8192),_1=c.dataView||(c.dataView=new DataView(c.buffer,0,8192)),g=0;if(d6=c.length-10,d6-g<2048)c=new rL(c.length),_1=c.dataView||(c.dataView=new DataView(c.buffer,0,c.length)),d6=c.length-10,g=0;else g=g+7&2147483640;if(Y=g,v&xD1)g+=v&255;if(W=K.structuredClone?new Map:null,K.bundleStrings&&typeof E!=="string")Z8=[],Z8.size=1/0;else Z8=null;if(Q=K.structures,Q){if(Q.uninitialized)Q=K._mergeStructures(K.getStructures());let p=Q.sharedLength||0;if(p>F)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 Y0,W0=Q.transitions;for(let C0=0,T0=o.length;C0<T0;C0++){let a0=o[C0];if(Y0=W0[a0],!Y0)Y0=W0[a0]=Object.create(null);W0=Y0}W0[m4]=n+64}this.lastNamedStructuresLength=p}if(!G)Q.nextId=p+64}if($)$=!1;let f;try{if(K.randomAccessStructure&&E&&E.constructor&&E.constructor===Object)A(E);else R(E);let p=Z8;if(Z8)it(Y,R,0);if(W&&W.idsToInsert){let n=W.idsToInsert.sort((C0,T0)=>C0.offset>T0.offset?1:-1),o=n.length,Y0=-1;while(p&&o>0){let C0=n[--o].offset+Y;if(C0<p.stringsPosition+Y&&Y0===-1)Y0=0;if(C0>p.position+Y){if(Y0>=0)Y0+=6}else{if(Y0>=0)_1.setUint32(p.position+Y,_1.getUint32(p.position+Y)+Y0),Y0=-1;p=p.previous,o++}}if(Y0>=0&&p)_1.setUint32(p.position+Y,_1.getUint32(p.position+Y)+Y0);if(g+=n.length*6,g>d6)I(g);K.offset=g;let W0=ID1(c.subarray(Y,g),n);return W=null,W0}if(K.offset=g,v&_D1)return c.start=Y,c.end=g,c;return c.subarray(Y,g)}catch(p){throw f=p,p}finally{if(Q){if(N(),$&&K.saveStructures){let p=Q.sharedLength||0,n=c.subarray(Y,g),o=rt(Q,K);if(!f){if(K.saveStructures(o,o.isCompatible)===!1)return K.pack(E,v);if(K.lastNamedStructuresLength=p,c.length>1073741824)c=null;return n}}}if(c.length>1073741824)c=null;if(v&AD1)g=Y}};let N=()=>{if(O<10)O++;let E=Q.sharedLength||0;if(Q.length>E&&!G)Q.length=E;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][m4]=0;w=[]}},j=(E)=>{var v=E.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++)R(E[f])},R=(E)=>{if(g>d6)c=I(g);var v=typeof E,f;if(v==="string"){let p=E.length;if(Z8&&p>=4&&p<4096){if((Z8.size+=p)>TD1){let W0,C0=(Z8[0]?Z8[0].length*3+Z8[1].length:0)+10;if(g+C0>d6)c=I(g+C0);let T0;if(Z8.position)T0=Z8,c[g]=200,g+=3,c[g++]=98,W0=g-Y,g+=4,it(Y,R,0),_1.setUint16(W0+Y-3,g-Y-W0);else c[g++]=214,c[g++]=98,W0=g-Y,g+=4;Z8=["",""],Z8.previous=T0,Z8.size=0,Z8.position=W0}let Y0=kD1.test(E);Z8[Y0?0:1]+=E,c[g++]=193,R(Y0?-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>d6)c=I(g+o);if(p<64||!X){let Y0,W0,C0,T0=g+n;for(Y0=0;Y0<p;Y0++)if(W0=E.charCodeAt(Y0),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=E.charCodeAt(Y0+1))&64512)===56320)W0=65536+((W0&1023)<<10)+(C0&1023),Y0++,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(E,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(E>>>0===E)if(E<32||E<128&&this.useRecords===!1||E<64&&!this.randomAccessStructure)c[g++]=E;else if(E<256)c[g++]=204,c[g++]=E;else if(E<65536)c[g++]=205,c[g++]=E>>8,c[g++]=E&255;else c[g++]=206,_1.setUint32(g,E),g+=4;else if(E>>0===E)if(E>=-32)c[g++]=256+E;else if(E>=-128)c[g++]=208,c[g++]=E+256;else if(E>=-32768)c[g++]=209,_1.setInt16(g,E),g+=2;else c[g++]=210,_1.setInt32(g,E),g+=4;else{let p;if((p=this.useFloat32)>0&&E<4294967296&&E>=-2147483648){c[g++]=202,_1.setFloat32(g,E);let n;if(p<4||(n=E*$$[(c[g]&127)<<1|c[g+1]>>7])>>0===n){g+=4;return}else g--}c[g++]=203,_1.setFloat64(g,E),g+=8}else if(v==="object"||v==="function")if(!E)c[g++]=192;else{if(W){let n=W.get(E);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(E,{offset:g-Y})}let p=E.constructor;if(p===Object)T(E);else if(p===Array)j(E);else if(p===Map)if(this.mapAsEmptyObject)c[g++]=128;else{if(f=E.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 E)R(n),R(o)}else{for(let n=0,o=KT.length;n<o;n++){let Y0=at[n];if(E instanceof Y0){let W0=KT[n];if(W0.write){if(W0.type)c[g++]=212,c[g++]=W0.type,c[g++]=0;let o1=W0.write.call(this,E);if(o1===E)if(Array.isArray(E))j(E);else T(E);else R(o1);return}let C0=c,T0=_1,a0=g;c=null;let v8;try{v8=W0.pack.call(this,E,(o1)=>{if(c=C0,C0=null,g+=o1,g>d6)I(g);return{target:c,targetView:_1,position:g-o1}},R)}finally{if(C0)c=C0,_1=T0,g=a0,d6=c.length-10}if(v8){if(v8.length+g>d6)I(v8.length+g);g=ED1(v8,c,g,W0.type)}return}}if(Array.isArray(E))j(E);else{if(E.toJSON){let n=E.toJSON();if(n!==E)return R(n)}if(v==="function")return R(this.writeFunction&&this.writeFunction(E));T(E)}}}else if(v==="boolean")c[g++]=E?195:194;else if(v==="bigint"){if(E<9223372036854776000&&E>=-9223372036854776000)c[g++]=211,_1.setBigInt64(g,E);else if(E<18446744073709552000&&E>0)c[g++]=207,_1.setBigUint64(g,E);else if(this.largeBigIntToFloat)c[g++]=203,_1.setFloat64(g,Number(E));else if(this.largeBigIntToString)return R(E.toString());else if((this.useBigIntExtension||this.moreTypes)&&E<BigInt(2)**BigInt(1023)&&E>-(BigInt(2)**BigInt(1023))){c[g++]=199,g++,c[g++]=66;let p=[],n;do{let o=E&BigInt(255);n=(o&BigInt(128))===(E<BigInt(0)?BigInt(128):BigInt(0)),p.push(o),E>>=BigInt(8)}while(!((E===BigInt(0)||E===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(E+" 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?(E)=>{let v;if(this.skipValues){v=[];for(let n in E)if((typeof E.hasOwnProperty!=="function"||E.hasOwnProperty(n))&&!this.skipValues.includes(E[n]))v.push(n)}else v=Object.keys(E);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);R(isNaN(o)?p:o),R(E[p])}else for(let n=0;n<f;n++)R(p=v[n]),R(E[p])}:(E)=>{c[g++]=222;let v=g-Y;g+=2;let f=0;for(let p in E)if(typeof E.hasOwnProperty!=="function"||E.hasOwnProperty(p))R(p),R(E[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+++Y]=f>>8,c[v+Y]=f&255},P=this.useRecords===!1?D:Z.progressiveRecords&&!V?(E)=>{let v,f=Q.transitions||(Q.transitions=Object.create(null)),p=g++-Y,n;for(let o in E)if(typeof E.hasOwnProperty!=="function"||E.hasOwnProperty(o)){if(v=f[o],v)f=v;else{let Y0=Object.keys(E),W0=f;f=Q.transitions;let C0=0;for(let T0=0,a0=Y0.length;T0<a0;T0++){let v8=Y0[T0];if(v=f[v8],!v)v=f[v8]=Object.create(null),C0++;f=v}if(p+Y+1==g)g--,x(f,Y0,C0);else S(f,Y0,p,C0);n=!0,f=W0[o]}R(E[o])}if(!n){let o=f[m4];if(o)c[p+Y]=o;else S(f,Object.keys(E),p,0)}}:(E)=>{let v,f=Q.transitions||(Q.transitions=Object.create(null)),p=0;for(let o in E)if(typeof E.hasOwnProperty!=="function"||E.hasOwnProperty(o)){if(v=f[o],!v)v=f[o]=Object.create(null),p++;f=v}let n=f[m4];if(n)if(n>=96&&V)c[g++]=((n-=96)&31)+96,c[g++]=n>>5;else c[g++]=n;else x(f,f.__keys__||Object.keys(E),p);for(let o in E)if(typeof E.hasOwnProperty!=="function"||E.hasOwnProperty(o))R(E[o])},C=typeof this.useRecords=="function"&&this.useRecords,T=C?(E)=>{C(E)?P(E):D(E)}:P,I=(E)=>{let v;if(E>16777216){if(E-Y>pt)throw new Error("Packed buffer would be larger than maximum buffer size");v=Math.min(pt,Math.round(Math.max((E-Y)*(E>67108864?1.25:2),4194304)/4096)*4096)}else v=(Math.max(E-Y<<2,c.length-1)>>12)+1<<12;let f=new rL(v);if(_1=f.dataView||(f.dataView=new DataView(f.buffer,0,v)),E=Math.min(E,c.length),c.copy)c.copy(f,0,Y,E);else f.set(c.slice(Y,E));return g-=Y,Y=0,d6=f.length-10,c=f},x=(E,v,f)=>{let p=Q.nextId;if(!p)p=64;if(p<q&&this.shouldShareStructure&&!this.shouldShareStructure(v)){if(p=Q.nextOwnId,!(p<U))p=q;Q.nextOwnId=p+1}else{if(p>=U)p=q;Q.nextId=p+1}let n=v.highByte=p>=96&&V?p-96>>5:-1;if(E[m4]=p,E.__keys__=v,Q[p-64]=v,p<q)if(v.isShared=!0,Q.sharedLength=p-63,$=!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>=H)w.shift()[m4]=0;w.push(E),R(v)}},S=(E,v,f,p)=>{let n=c,o=g,Y0=d6,W0=Y;if(c=k3,g=0,Y=0,!c)k3=c=new rL(8192);d6=c.length-10,x(E,v,p),k3=c;let C0=g;if(c=n,g=o,d6=Y0,Y=W0,C0>1){let T0=g+C0-1;if(T0>d6)I(T0);let a0=f+Y;c.copyWithin(a0+C0,a0+1,g),c.set(k3.slice(0,C0),a0),g=T0}else c[f+Y]=k3[0]},A=(E)=>{let v=ot(E,c,Y,g,Q,I,(f,p,n)=>{if(n)return $=!0;g=p;let o=c;if(R(f),N(),o!==c)return{position:g,targetView:_1,target:c};return g},this);if(v===0)return T(E);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=[]}}at=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,sL];KT=[{pack(Z,J,Y){let $=Z.getTime()/1000;if((this.useTimestamp32||Z.getMilliseconds()===0)&&$>=0&&$<4294967296){let{target:Q,targetView:W,position:X}=J(6);Q[X++]=214,Q[X++]=255,W.setUint32(X,$)}else if($>0&&$<4294967296){let{target:Q,targetView:W,position:X}=J(10);Q[X++]=215,Q[X++]=255,W.setUint32(X,Z.getMilliseconds()*4000000+($/1000/4294967296>>0)),W.setUint32(X+4,$)}else if(isNaN($)){if(this.onInvalidDate)return J(0),Y(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($)))}}},{pack(Z,J,Y){if(this.setAsEmptyObject)return J(0),Y({});let $=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,Y){let{target:$,position:Q}=J(this.moreTypes?3:0);if(this.moreTypes)$[Q++]=212,$[Q++]=101,$[Q++]=0;Y([Z.name,Z.message,Z.cause])}},{pack(Z,J,Y){let{target:$,position:Q}=J(this.moreTypes?3:0);if(this.moreTypes)$[Q++]=212,$[Q++]=120,$[Q++]=0;Y([Z.source,Z.flags])}},{pack(Z,J){if(this.moreTypes)WT(Z,16,J);else XT(E3?Buffer.from(Z):new Uint8Array(Z),J)}},{pack(Z,J){let Y=Z.constructor;if(Y!==st&&this.moreTypes)WT(Z,QT.indexOf(Y.name),J);else XT(Z,J)}},{pack(Z,J){if(this.moreTypes)WT(Z,17,J);else XT(E3?Buffer.from(Z):new Uint8Array(Z),J)}},{pack(Z,J){let{target:Y,position:$}=J(1);Y[$]=193}}];function WT(Z,J,Y,$){let Q=Z.byteLength;if(Q+1<256){var{target:W,position:X}=Y(4+Q);W[X++]=199,W[X++]=Q+1}else if(Q+1<65536){var{target:W,position:X}=Y(5+Q);W[X++]=200,W[X++]=Q+1>>8,W[X++]=Q+1&255}else{var{target:W,position:X,targetView:K}=Y(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 XT(Z,J){let Y=Z.byteLength;var $,Q;if(Y<256){var{target:$,position:Q}=J(Y+2);$[Q++]=196,$[Q++]=Y}else if(Y<65536){var{target:$,position:Q}=J(Y+3);$[Q++]=197,$[Q++]=Y>>8,$[Q++]=Y&255}else{var{target:$,position:Q,targetView:W}=J(Y+5);$[Q++]=198,W.setUint32(Q,Y),Q+=4}$.set(Z,Q)}function ED1(Z,J,Y,$){let Q=Z.length;switch(Q){case 1:J[Y++]=212;break;case 2:J[Y++]=213;break;case 4:J[Y++]=214;break;case 8:J[Y++]=215;break;case 16:J[Y++]=216;break;default:if(Q<256)J[Y++]=199,J[Y++]=Q;else if(Q<65536)J[Y++]=200,J[Y++]=Q>>8,J[Y++]=Q&255;else J[Y++]=201,J[Y++]=Q>>24,J[Y++]=Q>>16&255,J[Y++]=Q>>8&255,J[Y++]=Q&255}return J[Y++]=$,J.set(Z,Y),Y+=Q,Y}function ID1(Z,J){let Y,$=J.length*6,Q=Z.length-$;while(Y=J.pop()){let{offset:W,id:X}=Y;Z.copyWithin(W+$,W,Q),$-=6;let K=W+$;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 it(Z,J,Y){if(Z8.length>0){_1.setUint32(Z8.position+Z,g+Y-Z8.position-Z),Z8.stringsPosition=g-Z;let $=Z8;Z8=null,J($[0]),J($[1])}}function rt(Z,J){return Z.isCompatible=(Y)=>{let $=!Y||(J.lastNamedStructuresLength||0)===Y.length;if(!$)J._mergeStructures(Y);return $},Z}function tt(Z,J){ot=Z,rt=J}var et=new Q$({useRecords:!1}),vD1=et.pack,SD1=et.pack;var _D1=512,AD1=1024,xD1=2048;var GT=3,bW=0,I3=2,eL=1,FT=16,Je=["num","object","string","ascii"];Je[FT]="date";var fD1=[!1,!0,!0,!1,!1,!0,!0,!1],Ye;try{new Function(""),Ye=!0}catch(Z){}var W$,yD1=typeof Buffer!=="undefined",Z2,d4;try{Z2=new TextEncoder}catch(Z){}var bD1=yD1?function(Z,J,Y){return Z.utf8Write(J,Y,Z.byteLength-Y)}:Z2&&Z2.encodeInto?function(Z,J,Y){return Z2.encodeInto(J,Z.subarray(Y)).written}:!1,NU6=Symbol("type"),RU6=Symbol("parent");tt($e,cD1);function $e(Z,J,Y,$,Q,W,X,K){let G=K.typedStructs||(K.typedStructs=[]),z=J.dataView,F=(G.lastStringStart||100)+$,H=J.length-10,V=$;if($>H)J=W($),z=J.dataView,$-=Y,V-=Y,F-=Y,Y=0,H=J.length-10;let q,U=F,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;$+=O;let N=[],j,R=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($>H)J=W($),z=J.dataView,$-=Y,V-=Y,F-=Y,U-=Y,Y=0,H=J.length-10;switch(typeof C){case"number":let I=C;if(L<200||!T.num64){if(I>>0===I&&I<536870912&&I>-520093696){if(I<246&&I>=0&&(T.num8&&!(L>200&&T.num32)||I<32&&!T.num32))w=T.num8||w5(T,bW,1),J[$++]=I;else w=T.num32||w5(T,bW,4),z.setUint32($,I,!0),$+=4;break}else if(I<4294967296&&I>=-2147483648){if(z.setFloat32($,I,!0),fD1[J[$+3]>>>5]){let E;if((E=I*$$[(J[$+3]&127)<<1|J[$+2]>>7])>>0===E){w=T.num32||w5(T,bW,4),$+=4;break}}}}w=T.num64||w5(T,bW,8),z.setFloat64($,I,!0),$+=8;break;case"string":let x=C.length;if(q=U-F,(x<<2)+U>H)J=W((x<<2)+U),z=J.dataView,$-=Y,V-=Y,F-=Y,U-=Y,Y=0,H=J.length-10;if(x>65280+q>>2){N.push(P,C,$-V);break}let S,A=U;if(x<64){let E,v,f;for(E=0;E<x;E++)if(v=C.charCodeAt(E),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(E+1))&64512)===56320)S=!0,v=65536+((v&1023)<<10)+(f&1023),E++,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+=bD1(J,C,U),S=U-A>x;if(q<160||q<246&&(T.ascii8||T.string8)){if(S){if(!(w=T.string8))if(G.length>10&&(w=T.ascii8))w.__type=I3,T.ascii8=null,T.string8=w,X(null,0,!0);else w=w5(T,I3,1)}else if(q===0&&!j){j=!0,w=T.ascii0||w5(T,GT,0);break}else if(!(w=T.ascii8)&&!(G.length>10&&(w=T.string8)))w=w5(T,GT,1);J[$++]=q}else w=T.string16||w5(T,I3,2),z.setUint16($,q,!0),$+=2;break;case"object":if(C){if(C.constructor===Date)w=T.date64||w5(T,FT,8),z.setFloat64($,C.getTime(),!0),$+=8;else N.push(P,C,R);break}else if(T=Ze(T,$,z,-10),T)w=T,$=W$;else N.push(P,C,R);break;case"boolean":w=T.num8||T.ascii8||w5(T,bW,1),J[$++]=C?249:248;break;case"undefined":if(T=Ze(T,$,z,-9),T)w=T,$=W$;else N.push(P,C,R);break;default:N.push(P,C,R)}R++}for(let P=0,C=N.length;P<C;){let T=N[P++],I=N[P++],x=N[P++],S=w[T];if(!S)w[T]=S={key:T,parent:w,enumerationOffset:x-R,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null};let A;if(I){let E;if(q=U-F,q<65280)if(w=S.object16,w)E=2;else if(w=S.object32)E=4;else w=w5(S,eL,2),E=2;else w=S.object32||w5(S,eL,4),E=4;if(A=X(I,U),typeof A==="object")U=A.position,z=A.targetView,J=A.target,F-=Y,$-=Y,V-=Y,Y=0;else U=A;if(E===2)z.setUint16($,q,!0),$+=2;else z.setUint32($,q,!0),$+=4}else w=S.object16||w5(S,eL,2),z.setInt16($,I===null?-10:-9,!0),$+=2;R++}let D=w[m4];if(D==null){D=K.typedStructs.length;let P=[],C=w,T,I;while((I=C.__type)!==void 0){let x=C.__size;C=C.__parent,T=C.key;let S=[I,x,T];if(C.enumerationOffset)S.push(C.enumerationOffset);P.push(S),C=C.parent}P.reverse(),w[m4]=D,K.typedStructs[D]=P,X(null,0,!0)}switch(O){case 1:if(D>=16)return 0;J[V]=D+32;break;case 2:if(D>=256)return 0;J[V]=56,J[V+1]=D;break;case 3:if(D>=65536)return 0;J[V]=57,z.setUint16(V+1,D,!0);break;case 4:if(D>=16777216)return 0;z.setUint32(V,(D<<8)+58,!0);break}if($<F){if(F===U)return $;J.copyWithin($,F,U),U+=$-F,G.lastStringStart=$-V}else if($>F){if(F===U)return $;return G.lastStringStart=$-V,$e(Z,J,Y,V,Q,W,X,K)}return U}function Ze(Z,J,Y,$){let Q;if(Q=Z.ascii8||Z.num8)return Y.setInt8(J,$,!0),W$=J+1,Q;if(Q=Z.string16||Z.object16)return Y.setInt16(J,$,!0),W$=J+2,Q;if(Q=Z.num32)return Y.setUint32(J,3758096640+$,!0),W$=J+4,Q;if(Q=Z.num64)return Y.setFloat64(J,NaN,!0),Y.setInt8(J,$),W$=J+8,Q;W$=J;return}function w5(Z,J,Y){let $=Je[J]+(Y<<3),Q=Z[$]||(Z[$]=Object.create(null));return Q.__type=J,Q.__size=Y,Q.__parent=Z,Q}function gD1(Z){if(!(Z instanceof Map))return Z;let J=Z.get("typed")||[];if(Object.isFrozen(J))J=J.map((Q)=>Q.slice(0));let Y=Z.get("named"),$=Object.create(null);for(let Q=0,W=J.length;Q<W;Q++){let X=J[Q],K=$;for(let[G,z,F]of X){let H=K[F];if(!H)K[F]=H={key:F,parent:K,enumerationOffset:0,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null,date64:null};K=w5(H,G,z)}K[m4]=Q}return J.transitions=$,this.typedStructs=J,this.lastTypedStructuresLength=J.length,Y}var zT=Symbol.for("source");function mD1(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=$.typedStructs&&$.typedStructs[Q];if(!W){if(Z=Uint8Array.prototype.slice.call(Z,J,Y),Y-=J,J=0,!$.getStructures)throw new Error(`Reference to shared structure ${Q} without getStructures method`);if($._mergeStructures($.getStructures()),!$.typedStructs)throw new Error("Could not find any shared typed structures");if($.lastTypedStructuresLength=$.typedStructs.length,W=$.typedStructs[Q],!W)throw new Error("Could not find typed structure "+Q)}var{construct:X,fullConstruct:K}=W;if(!X){X=W.construct=function q(){},K=W.fullConstruct=function q(){},K.prototype=$.structPrototype??{};var G=X.prototype=$.structPrototype?Object.create($.structPrototype):{};let F=[],H=0,V;for(let q=0,U=W.length;q<U;q++){let w=W[q],[L,O,N,j]=w;if(N==="__proto__")N="__proto_";let R={key:N,offset:H};if(j)F.splice(q+j,0,R);else F.push(R);let D;switch(O){case 0:D=()=>0;break;case 1:D=(C,T)=>{let I=C.bytes[T+R.offset];return I>=246?yW(I):I};break;case 2:D=(C,T)=>{let I=C.bytes,S=(I.dataView||(I.dataView=new DataView(I.buffer,I.byteOffset,I.byteLength))).getUint16(T+R.offset,!0);return S>=65280?yW(S&255):S};break;case 4:D=(C,T)=>{let I=C.bytes,S=(I.dataView||(I.dataView=new DataView(I.buffer,I.byteOffset,I.byteLength))).getUint32(T+R.offset,!0);return S>=4294967040?yW(S&255):S};break}R.getRef=D,H+=O;let P;switch(L){case GT:if(V&&!V.next)V.next=R;V=R,R.multiGetCount=0,P=function(C){let{bytes:T,position:I}=C,x=H+I,S=D(C,I);if(typeof S!=="number")return S;let A,E=R.next;while(E){if(A=E.getRef(C,I),typeof A==="number")break;else A=null;E=E.next}if(A==null)A=C.bytesEnd-x;if(C.srcString)return C.srcString.slice(S,A);return gt(T,S+x,A-S)};break;case I3:case eL:if(V&&!V.next)V.next=R;V=R,P=function(C){let T=C.position,I=H+T,x=D(C,T);if(typeof x!=="number")return x;let S=C.bytes,A,E=R.next;while(E){if(A=E.getRef(C,T),typeof A==="number")break;else A=null;E=E.next}if(A==null)A=C.bytesEnd-I;if(L===I3)return S.toString("utf8",x+I,A+I);else{d4=C;try{return $.unpack(S,{start:x+I,end:A+I})}finally{d4=null}}};break;case bW:switch(O){case 4:P=function(C){let T=C.bytes,I=T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength)),x=C.position+R.offset,S=I.getInt32(x,!0);if(S<536870912){if(S>-520093696)return S;if(S>-536870912)return yW(S&255)}let A=I.getFloat32(x,!0),E=$$[(T[x+3]&127)<<1|T[x+2]>>7];return(E*A+(A>0?0.5:-0.5)>>0)/E};break;case 8:P=function(C){let T=C.bytes,x=(T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength))).getFloat64(C.position+R.offset,!0);if(isNaN(x)){let S=T[C.position+R.offset];if(S>=246)return yW(S)}return x};break;case 1:P=function(C){let I=C.bytes[C.position+R.offset];return I<246?I:yW(I)};break}break;case FT:P=function(C){let T=C.bytes,I=T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength));return new Date(I.getFloat64(C.position+R.offset,!0))};break}R.get=P}if(Ye){let q=[],U=[],w=0,L;for(let N of F){if($.alwaysLazyProperty&&$.alwaysLazyProperty(N.key)){L=!0;continue}Object.defineProperty(G,N.key,{get:dD1(N.get),enumerable:!0});let j="v"+w++;U.push(j),q.push("o["+JSON.stringify(N.key)+"]="+j+"(s)")}if(L)q.push("__proto__:this");let O=new Function(...U,"var c=this;return function(s){var o=new c();"+q.join(";")+";return o;}").apply(K,F.map((N)=>N.get));Object.defineProperty(G,"toJSON",{value(N){return O.call(this,this[zT])}})}else Object.defineProperty(G,"toJSON",{value(q){let U={};for(let w=0,L=F.length;w<L;w++){let O=F[w].key;U[O]=this[O]}return U}})}var z=new X;return z[zT]={bytes:Z,position:J,srcString:"",bytesEnd:Y},z}function yW(Z){switch(Z){case 246:return null;case 247:return;case 248:return!1;case 249:return!0}throw new Error("Unknown constant")}function dD1(Z){return function(){return Z(this[zT])}}function uD1(){if(d4)d4.bytes=Uint8Array.prototype.slice.call(d4.bytes,d4.position,d4.bytesEnd),d4.position=0,d4.bytesEnd=d4.bytes.length}function cD1(Z,J){if(J.typedStructs){let $=new Map;$.set("named",Z),$.set("typed",J.typedStructs),Z=$}let Y=J.lastTypedStructuresLength||0;return Z.isCompatible=($)=>{let Q=!0;if($ instanceof Map){if(($.get("named")||[]).length!==(J.lastNamedStructuresLength||0))Q=!1;if(($.get("typed")||[]).length!==Y)Q=!1}else if($ instanceof Array||Array.isArray($)){if($.length!==(J.lastNamedStructuresLength||0))Q=!1}if(!Q)J._mergeStructures($);return Q},J.lastTypedStructuresLength=J.typedStructs&&J.typedStructs.length,Z}lt(mD1,gD1,uD1);var iD1=process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED!==void 0&&process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED.toLowerCase()==="true";if(!iD1){let Z;try{if(Z=u("msgpackr-extract"),Z)bt(Z.extractStrings)}catch(J){}}import{WebSocketServer as Vy1}from"ws";import qy1 from"mediasoup";var Kw=t(y40(),1);import zy1 from"http";import Fy1 from"https";import wX from"fs";import Hy1 from"url";var G70=t(X70(),1);import j$ from"fs";import K70 from"path";var Iz="./dev/persistence";class s4{static instance=new s4;gameId=process.env.HYTOPIA_GAME_ID;lobbyId=process.env.HYTOPIA_LOBBY_ID;_creativeGateway;constructor(){try{this._creativeGateway=new G70.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(`
405
- `))}}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(!j$.existsSync(Iz))return;let J=K70.join(Iz,`${Z}.json`);return JSON.parse(j$.readFileSync(J,"utf8"))}catch(J){m.warning(`PlatformGateway._readDevDataLocally(): Failed to read data for key "${Z}": ${J}`)}}_writeDevDataLocally(Z,J){try{if(!j$.existsSync(Iz))j$.mkdirSync(Iz,{recursive:!0});let Y=K70.join(Iz,`${Z}.json`),$={};if(j$.existsSync(Y))$=JSON.parse(j$.readFileSync(Y,"utf8"));let Q={...$,...J};j$.writeFileSync(Y,JSON.stringify(Q,null,2),"utf8")}catch(Y){m.warning(`PlatformGateway._writeDevDataLocally(): Failed to write data for key "${Z}": ${Y}`)}}}var RE=process.env.PORT??8080,jE="0.5.13-dev1",PE;((Q)=>{Q.READY="WEBSERVER.READY";Q.STOPPED="WEBSERVER.STOPPED";Q.ERROR="WEBSERVER.ERROR";Q.UPGRADE="WEBSERVER.UPGRADE"})(PE||={});class BX extends g0{static instance=new BX;_webserver=Kw.default();_internalHttpServer;constructor(){super();this._webserver.use((Z,J,Y)=>{J.header("Access-Control-Allow-Origin","*"),Y()}),this._webserver.get("/",(Z,J)=>{J.json({status:"OK",version:jE})}),this._webserver.use(Kw.default.static("assets")),this._webserver.use(Kw.default.static("node_modules/@hytopia.com/assets"))}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?zy1.createServer(this._webserver):Fy1.createServer({key:wX.existsSync("assets/certs/localhost.key")?wX.readFileSync("assets/certs/localhost.key"):wX.readFileSync("node_modules/@hytopia.com/assets/certs/localhost.key"),cert:wX.existsSync("assets/certs/localhost.crt")?wX.readFileSync("assets/certs/localhost.crt"):wX.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(RE,this._onStarted),console.info(`WebServer.start(): Server running on port ${RE}.`)}stop(){if(this._internalHttpServer)return new Promise((Z,J)=>{this._internalHttpServer.close((Y)=>{if(Y)J(Y);else Z(!0)})});else return m.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(Z,J,Y)=>{let $=Hy1.parse(Z.url??"",!0).query,Q=$.connectionId?.toString()??void 0,W=$.sessionToken?.toString()??"",X=await s4.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
405
+ `))}}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(!j$.existsSync(Iz))return;let J=K70.join(Iz,`${Z}.json`);return JSON.parse(j$.readFileSync(J,"utf8"))}catch(J){m.warning(`PlatformGateway._readDevDataLocally(): Failed to read data for key "${Z}": ${J}`)}}_writeDevDataLocally(Z,J){try{if(!j$.existsSync(Iz))j$.mkdirSync(Iz,{recursive:!0});let Y=K70.join(Iz,`${Z}.json`),$={};if(j$.existsSync(Y))$=JSON.parse(j$.readFileSync(Y,"utf8"));let Q={...$,...J};j$.writeFileSync(Y,JSON.stringify(Q,null,2),"utf8")}catch(Y){m.warning(`PlatformGateway._writeDevDataLocally(): Failed to write data for key "${Z}": ${Y}`)}}}var RE=process.env.PORT??8080,jE="0.5.13-dev2",PE;((Q)=>{Q.READY="WEBSERVER.READY";Q.STOPPED="WEBSERVER.STOPPED";Q.ERROR="WEBSERVER.ERROR";Q.UPGRADE="WEBSERVER.UPGRADE"})(PE||={});class BX extends g0{static instance=new BX;_webserver=Kw.default();_internalHttpServer;constructor(){super();this._webserver.use((Z,J,Y)=>{J.header("Access-Control-Allow-Origin","*"),Y()}),this._webserver.get("/",(Z,J)=>{J.json({status:"OK",version:jE})}),this._webserver.use(Kw.default.static("assets")),this._webserver.use(Kw.default.static("node_modules/@hytopia.com/assets"))}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?zy1.createServer(this._webserver):Fy1.createServer({key:wX.existsSync("assets/certs/localhost.key")?wX.readFileSync("assets/certs/localhost.key"):wX.readFileSync("node_modules/@hytopia.com/assets/certs/localhost.key"),cert:wX.existsSync("assets/certs/localhost.crt")?wX.readFileSync("assets/certs/localhost.crt"):wX.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(RE,this._onStarted),console.info(`WebServer.start(): Server running on port ${RE}.`)}stop(){if(this._internalHttpServer)return new Promise((Z,J)=>{this._internalHttpServer.close((Y)=>{if(Y)J(Y);else Z(!0)})});else return m.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(Z,J,Y)=>{let $=Hy1.parse(Z.url??"",!0).query,Q=$.connectionId?.toString()??void 0,W=$.sessionToken?.toString()??"",X=await s4.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
406
406
  `),J.write(`Content-Type: text/plain\r
407
407
  `),J.write(`Content-Length: ${K.length}\r
408
408
  `),J.write(`Connection: close\r
@@ -433,6 +433,6 @@ Event: ${qJ(Z)}`),!0}return!1}function db1(Z,J){if(!J?.length)return!1;return Ew
433
433
  `),U=q.shift();if(!U)return Z.destroy(),Y(new Error("No header received from proxy CONNECT response"));let w=U.split(" "),L=+(w[1]||0),O=w.slice(2).join(" "),N={};for(let j of q){if(!j)continue;let R=j.indexOf(":");if(R===-1)return Z.destroy(),Y(new Error(`Invalid header from proxy CONNECT response: "${j}"`));let D=j.slice(0,R).toLowerCase(),P=j.slice(R+1).trimStart(),C=N[D];if(typeof C==="string")N[D]=[C,P];else if(Array.isArray(C))C.push(P);else N[D]=P}WM("got proxy server response: %o %o",U,N),X(),J({connect:{statusCode:L,statusText:O,headers:N},buffered:H})}Z.on("error",G),Z.on("end",K),W()})}function SH(...Z){l.log("[https-proxy-agent]",...Z)}class XM extends tx{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??{},SH("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let Y=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),$=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...J?U71(J,"headers"):null,host:Y,port:$}}async connect(Z,J){let{proxy:Y}=this;if(!J.host)throw new TypeError('No "host" provided');let $;if(Y.protocol==="https:"){SH("Creating `tls.Socket`: %o",this.connectOpts);let H=this.connectOpts.servername||this.connectOpts.host;$=ex.connect({...this.connectOpts,servername:H&&jZ.isIP(H)?void 0:H})}else SH("Creating `net.Socket`: %o",this.connectOpts),$=jZ.connect(this.connectOpts);let Q=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},W=jZ.isIPv6(J.host)?`[${J.host}]`:J.host,X=`CONNECT ${W}:${J.port} HTTP/1.1\r
434
434
  `;if(Y.username||Y.password){let H=`${decodeURIComponent(Y.username)}:${decodeURIComponent(Y.password)}`;Q["Proxy-Authorization"]=`Basic ${Buffer.from(H).toString("base64")}`}if(Q.Host=`${W}:${J.port}`,!Q["Proxy-Connection"])Q["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let H of Object.keys(Q))X+=`${H}: ${Q[H]}\r
435
435
  `;let K=q71($);$.write(`${X}\r
436
- `);let{connect:G,buffered:z}=await K;if(Z.emit("proxyConnect",G),this.emit("proxyConnect",G,Z),G.statusCode===200){if(Z.once("socket",er8),J.secureEndpoint){SH("Upgrading socket connection to TLS");let H=J.servername||J.host;return ex.connect({...U71(J,"host","path","port"),socket:$,servername:jZ.isIP(H)?void 0:H})}return $}$.destroy();let F=new jZ.Socket({writable:!1});return F.readable=!0,Z.once("socket",(H)=>{SH("Replaying proxy buffer for failed request"),H.push(z),H.push(null)}),F}}XM.__initStatic();function er8(Z){Z.resume()}function U71(Z,...J){let Y={},$;for($ in Z)if(!J.includes($))Y[$]=Z[$];return Y}var Qt8=32768;function Wt8(Z){return new Yt8({read(){this.push(Z),this.push(null)}})}function Zh(Z){let J;try{J=new URL(Z.url)}catch(G){return T8(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),RJ(Z,()=>Promise.resolve({}))}let Y=J.protocol==="https:",$=Xt8(J,Z.proxy||(Y?process.env.https_proxy:void 0)||process.env.http_proxy),Q=Y?Jt8:Zt8,W=Z.keepAlive===void 0?!1:Z.keepAlive,X=$?new XM($):new Q.Agent({keepAlive:W,maxSockets:30,timeout:2000}),K=Kt8(Z,Z.httpModule??Q,X);return RJ(Z,K)}function Xt8(Z,J){let{no_proxy:Y}=process.env;if(Y?.split(",").some((Q)=>Z.host.endsWith(Q)||Z.hostname.endsWith(Q)))return;else return J}function Kt8(Z,J,Y){let{hostname:$,pathname:Q,port:W,protocol:X,search:K}=new URL(Z.url);return function G(z){return new Promise((F,H)=>{x$(()=>{let V=Wt8(z.body),q={...Z.headers};if(z.body.length>Qt8)q["content-encoding"]="gzip",V=V.pipe($t8());let U=J.request({method:"POST",agent:Y,headers:q,hostname:$,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;F({statusCode:w.statusCode,headers:{"retry-after":L,"x-sentry-rate-limits":Array.isArray(O)?O[0]||null:O}})});U.on("error",H),V.pipe(U)})})}}var Gt8=new Set(["false","f","n","no","off","0"]),zt8=new Set(["true","t","y","yes","on","1"]);function KM(Z,J){let Y=String(Z).toLowerCase();if(Gt8.has(Y))return!1;if(zt8.has(Y))return!0;return J?.strict?null:Boolean(Z)}import{posix as Ft8,sep as Ht8}from"path";function L71(Z){return Z.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function Jh(Z=process.argv[1]?BI(process.argv[1]):process.cwd(),J=Ht8==="\\"){let Y=J?L71(Z):Z;return($)=>{if(!$)return;let Q=J?L71($):$,{dir:W,base:X,ext:K}=Ft8.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(Y)){let F=W.slice(Y.length+1).replace(/\//g,".");return F?`${F}:${G}`:G}return G}}function Yh(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,Y=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,$=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 $h=Bw(NI(Jh()));var B71=t(Z0(),1);import*as w71 from"os";import{threadId as Vt8,isMainThread as qt8}from"worker_threads";var Ut8=60000;class GM extends vw{constructor(Z){let J=Z.serverName||global.process.env.SENTRY_NAME||w71.hostname(),Y={...Z,platform:"node",runtime:{name:"node",version:global.process.version},serverName:J};if(Z.openTelemetryInstrumentations)rX({instrumentations:Z.openTelemetryInstrumentations});tz(Y,"node"),l.log(`Initializing Sentry: process: ${process.pid}, thread: ${qt8?"main":`worker-${Vt8}`}.`);super(Y);if(this.getOptions()._experiments?.enableLogs){if(this._logOnExitFlushListener=()=>{f$(this)},J)this.on("beforeCaptureLog",($)=>{$.attributes={...$.attributes,"server.address":J}});process.on("beforeExit",this._logOnExitFlushListener)}}get tracer(){if(this._tracer)return this._tracer;let Z="@sentry/node",J=C8,Y=B71.trace.getTracer(Z,J);return this._tracer=Y,Y}async flush(Z){let Y=this.traceProvider?.activeSpanProcessor;if(Y)await Y.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??Ut8).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener)}_getTraceInfoFromScope(Z){if(!Z)return[void 0,void 0];return Tr0(this,Z)}}var M4=t(Z0(),1);var AK=t(x1(),1);var O71=t(yB(),1);import Lt8 from"module";var Qh=1e6;function Wh(Z,J={}){if(Z.getOptions().debug)Ot8();let Y=wt8(Z,J);Z.traceProvider=Y}function M71(){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:Y}=O71.createAddHookMessageChannel();Lt8.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:Y,include:[]},transferList:[Y]})}catch(Y){l.warn("Failed to register ESM hook",Y)}}else T8(()=>{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 wt8(Z,J={}){let Y=new y_({sampler:new $A(Z),resource:new KK({[AK.ATTR_SERVICE_NAME]:"node",[AK.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[AK.ATTR_SERVICE_VERSION]:C8}),forceFlushTimeoutMillis:500,spanProcessors:[new YA({timeout:Bt8(Z.getOptions().maxSpanWaitDuration)}),...J.spanProcessors||[]]});return M4.trace.setGlobalTracerProvider(Y),M4.propagation.setGlobalPropagator(new r_),M4.context.setGlobalContextManager(new H71),Y}function Bt8(Z){if(Z==null)return;if(Z>Qh)return m0&&l.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${Qh}`),Qh;else if(Z<=0||Number.isNaN(Z)){m0&&l.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return Z}function Ot8(){let Z=new Proxy(l,{get(J,Y,$){return Reflect.get(J,Y==="verbose"?"debug":Y,$)}});M4.diag.disable(),M4.diag.setLogger(Z,M4.DiagLogLevel.DEBUG)}function Mt8(){return BK()?[OK()]:[]}function N71(){return[g$(),b$(),m$(),d$(),u$(),VK(),UK(),MK(),NK(),wK(),VA(),LK(),r41(),V71(),...Mt8()]}function R71(Z){return[...N71(),...i6(Z)?_K():[]]}function Xh(Z={}){return Nt8(Z,R71)}function Nt8(Z={},J){let Y=Rt8(Z,J);if(Y.debug===!0)if(m0)l.enable();else T8(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")});if(!BK()&&Y.registerEsmLoaderHooks!==!1)M71();if(Er0(),B1().update(Y.initialScope),Y.spotlight&&!Y.integrations.some(({name:W})=>W===gx))Y.integrations.push(mx({sidecarUrl:typeof Y.spotlight==="string"?Y.spotlight:void 0}));let Q=new GM(Y);if(B1().setClient(Q),Q.init(),l.log(`Running in ${BK()?"CommonJS":"ESM"} mode.`),Q.startClientReportTracking(),Dt8(),!Y.skipOpenTelemetrySetup)Wh(Q,{spanProcessors:Y.openTelemetrySpanProcessors}),j71();return Br0(Q),kr0(Q),Q}function j71(){if(!m0)return;let Z=Rr0(),J=["SentryContextManager","SentryPropagator"];if(i6())J.push("SentrySpanProcessor");for(let Y of J)if(!Z.includes(Y))l.error(`You have to set up the ${Y}. 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 Rt8(Z,J){let Y=jt8(Z.release),$=Z.spotlight??KM(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,Q=Pt8(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??Zh,stackParser:pE(Z.stackParser||$h),release:Y,tracesSampleRate:Q,spotlight:$,debug:KM(Z.debug??process.env.SENTRY_DEBUG)},X=Z.integrations,K=Z.defaultIntegrations??J(W);return{...W,integrations:KI({defaultIntegrations:K,integrations:X})}}function jt8(Z){if(Z!==void 0)return Z;let J=Yh();if(J!==void 0)return J;return}function Pt8(Z){if(Z!==void 0)return Z;let J=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!J)return;let Y=parseFloat(J);return isFinite(Y)?Y:void 0}function Dt8(){if(KM(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let Z=process.env.SENTRY_TRACE,J=process.env.SENTRY_BAGGAGE,Y=E$(Z,J);B1().setPropagationContext(Y)}}import*as k71 from"os";var ft8="BunServer",yt8=()=>{return{name:ft8,setupOnce(){bt8()}}},C71=J0(yt8),P71=!1;function bt8(){if(P71)return;Bun.serve=new Proxy(Bun.serve,{apply(Z,J,Y){D71(Y[0]);let $=Z.apply(J,Y),Q=$.reload.bind($);return $.reload=(W)=>{return D71(W),Q(W)},$}}),P71=!0}function D71(Z){gt8(Z),mt8(Z)}function gt8(Z){if(typeof Z.fetch!=="function")return;Z.fetch=new Proxy(Z.fetch,{apply(J,Y,$){return Kh(J,Y,$)}})}function mt8(Z){if(!Z.routes)return;if(typeof Z.routes!=="object")return;Object.keys(Z.routes).forEach((J)=>{let Y=Z.routes[J];if(typeof Y==="function")Z.routes[J]=new Proxy(Y,{apply:($,Q,W)=>{return Kh($,Q,W,J)}});if(Y instanceof Response)return;if(typeof Y==="object")Object.entries(Y).forEach(([$,Q])=>{if(typeof Q==="function")Z.routes[J][$]=new Proxy(Q,{apply:(W,X,K)=>{return Kh(W,X,K,J)}})})})}function Kh(Z,J,Y,$){return BJ((Q)=>{let W=Y[0],X=W.method.toUpperCase();if(X==="OPTIONS"||X==="HEAD")return Z.apply(J,Y);let K=MI(W.url),G=dt8(K,W),z=K?.pathname||"/";if(W.params){if(Object.keys(W.params).forEach((F)=>{G[`url.path.parameter.${F}`]=W.params[F]}),$)G[n1]="route",G["url.template"]=$,z=$}if($?.endsWith("/*"))G[n1]="route",G["url.template"]=$,z=$;return Q.setSDKProcessingMetadata({normalizedRequest:{url:W.url,method:W.method,headers:W.headers.toJSON(),query_string:K?.search}}),az({sentryTrace:W.headers.get("sentry-trace")??"",baggage:W.headers.get("baggage")},()=>A$({attributes:G,op:"http.server",name:`${W.method} ${z}`},async(F)=>{try{let H=await Z.apply(J,Y);if(H?.status)Az(F,H.status),Q.setContext("response",{headers:H.headers.toJSON(),status_code:H.status});return H}catch(H){throw P6(H,{mechanism:{type:"bun",handled:!1,data:{function:"serve"}}}),H}}))})}function dt8(Z,J){let Y={[Y1]:"auto.http.bun.serve",[mE]:J.method||"GET",[n1]:"url"};if(Z){if(Z.search)Y["url.query"]=Z.search;if(Z.hash)Y["url.fragment"]=Z.hash;if(Z.pathname)Y["url.path"]=Z.pathname;if(!OI(Z)){if(Y["url.full"]=Z.href,Z.port)Y["url.port"]=Z.port;if(Z.protocol)Y["url.scheme"]=Z.protocol;if(Z.hostname)Y["url.domain"]=Z.hostname}}return Y}function T71(Z){function J(Y){let $={body:Y.body,method:"POST",headers:Z.headers};try{return x$(()=>{return fetch(Z.url,$).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 h$(Q)}}return RJ(Z,J)}function E71(Z){return[g$(),b$(),m$(),d$(),u$(),VK(),UK(),MK(),NK(),wK(),LK(),OK(),C71(),...i6(Z)?_K():[]]}function Gh(Z={}){tz(Z,"bun");let J={...Z,platform:"javascript",runtime:{name:"bun",version:Bun.version},serverName:Z.serverName||global.process.env.SENTRY_NAME||k71.hostname()};if(J.transport=J.transport||T71,J.defaultIntegrations===void 0)J.defaultIntegrations=E71(J);return Xh(J)}import{heapStats as ct8}from"bun:jsc";if(process.env.NODE_ENV==="production"&&process.env.SENTRY_DSN)Gh({dsn:process.env.SENTRY_DSN,release:jE,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 Y=Z?.start_timestamp,$=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=ct8(),Y=process.memoryUsage(),$={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:Y.heapUsed/1024/1024,unit:"megabyte"},rssSizeMb:{value:Y.rss/1024/1024,unit:"megabyte"}};if(Z)return $;return Object.fromEntries(Object.entries($).map(([Q,W])=>[Q,W.value]))}static startSpan(Z,J){if(oz())return A$({attributes:Z.attributes,name:Z.operation,op:Z.operation},J);else return J()}}var zh=new Q$,pt8=5000,it8=1048576,nt8=512;class H9 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=Pt(),this.onPacket($0.PacketId.CONNECTION,this._onConnectionPacket),this.onPacket($0.PacketId.HEARTBEAT,this._onHeartbeatPacket),this.bindWs(Z),X6.emit("CONNECTION.OPENED",{connection:this,req:J})}static getPackrBuffer(){if(H9._packrBuffers.length>0)return H9._packrBuffers.pop();return Buffer.allocUnsafe(it8)}static serializePackets(Z){for(let Y of Z)if(!$0.isValidPacket(Y))return m.error(`Connection.serializePackets(): Invalid packet payload: ${JSON.stringify(Y)}`);let J=H9._cachedPacketsSerializedBuffer.get(Z);if(J)return J;return X8.startSpan({operation:"serialize_packets",attributes:{packets:Z.length,packetIds:Z.map((Y)=>Y[0]).join(","),"packetsSerializedBuffer.size":H9._packrBuffers.length}},(Y)=>{let $=X8.startSpan({operation:"serialize_packets_encode"},()=>{let Q=H9.getPackrBuffer();zh.useBuffer(Q);let W=zh.pack(Z,nt8),X=W.subarray(W.start,W.end);return H9._packrBuffers.push(Q),X});return Y?.setAttribute("serializedBytes",$.byteLength),H9._cachedPacketsSerializedBuffer.set(Z,$),$})}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=(Y)=>this._onMessage(Y.data),this._ws.onclose=this._onWsClose,this._ws.onerror=this._onWsError,this.send([$0.createPacket($0.bidirectionalPackets.connectionPacketDefinition,{i:this.id})],!0,!0),J)this.emitWithGlobal("CONNECTION.RECONNECTED",{connection:this});if(zJ.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:Y})=>{if(Y[0]===Z)J(Y)})}send(Z,J=!0,Y=!1){if(this._closeTimeout)return;if(this._ws.readyState!==lt8.OPEN)return m.warning("Connection.send(): Connection is not open.");X8.startSpan({operation:"send_packets",attributes:{forceWs:Y?"true":"false",wrtcConnected:this._wrtcServerClientTransport?.iceState==="completed"?"true":"false"}},()=>{try{let $=H9.serializePackets(Z);if(!$)return;if(this._wrtcServerClientTransport?.iceState==="completed"&&$.length<(this._wrtcServerClientTransport?.sctpParameters?.maxMessageSize??0)&&!Y)try{(J?this._wrtcServerClientReliableDataProducer:this._wrtcServerClientUnreliableDataProducer).send($)}catch{this._ws.send($)}else this._ws.send($);this.emitWithGlobal("CONNECTION.PACKETS_SENT",{connection:this,packets:Z})}catch($){m.error(`Connection.send(): Packet send failed. Error: ${$}`)}})}_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],Y=J.c,$=J.d;if(Y){let{i:Q,d:W}=Y,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([$0.createPacket($0.bidirectionalPackets.connectionPacketDefinition,{ca:{i:Q}})])}if($)for(let Q of $){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([$0.createPacket($0.bidirectionalPackets.connectionPacketDefinition,{pa:{i:K.id,l:X}})])}};_onHeartbeatPacket=()=>{this.send([$0.createPacket($0.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()},pt8)};_onWsError=(Z)=>{this.emitWithGlobal("CONNECTION.ERROR",{connection:this,error:Z})};_upgradeToWRTC=async()=>{let Z=await zJ.instance.createWrtcTransports();if(!Z)return!1;let{directTransport:J,clientServerTransport:Y,serverClientTransport:$}=Z;this._wrtcDirectTransport=J,this._wrtcClientServerTransport=Y,this._wrtcClientServerTransport.on("icestatechange",(X)=>{this._onWrtcIceStateChange(this._wrtcClientServerTransport,X)}),this._wrtcServerClientTransport=$,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([$0.createPacket($0.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=zh.unpack(Z);if(!J||typeof J!=="object"||typeof J[0]!=="number")return m.error(`Connection._deserialize(): Invalid packet format. Packet: ${JSON.stringify(J)}`);if(!$0.isValidPacket(J))return m.error(`Connection._deserialize(): Invalid packet payload. Packet: ${JSON.stringify(J)}`);return J}}var I71;(($)=>{$.PLAYER_CONNECTED="PLAYER_MANAGER.PLAYER_CONNECTED";$.PLAYER_DISCONNECTED="PLAYER_MANAGER.PLAYER_DISCONNECTED";$.PLAYER_RECONNECTED="PLAYER_MANAGER.PLAYER_RECONNECTED"})(I71||={});class d5{static instance=new d5;_connectionPlayers=new Map;constructor(){X6.on("CONNECTION.OPENED",({connection:Z,req:J})=>{this._onConnectionOpened(Z,J.session)}),X6.on("CONNECTION.DISCONNECTED",({connection:Z})=>{this._onConnectionDisconnected(Z)}),X6.on("CONNECTION.RECONNECTED",({connection:Z})=>{this._onConnectionReconnected(Z)}),X6.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 Y=new xK(Z,J);this._connectionPlayers.set(Z,Y),X6.emit("PLAYER_MANAGER.PLAYER_CONNECTED",{player:Y})}_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(),X6.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),X6.emit("PLAYER_MANAGER.PLAYER_DISCONNECTED",{player:J});else m.warning(`PlayerManager._onConnectionClosed(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}}var I8=16,hK=I8-1,v71=I8**3,at8=[{neighborOffset:[-1,0,0],generateVertices:(Z,J,Y)=>[Z+0,J+0,Y+0,Z+0,J+0,Y+1,Z+0,J+1,Y+0,Z+0,J+1,Y+0,Z+0,J+0,Y+1,Z+0,J+1,Y+1]},{neighborOffset:[1,0,0],generateVertices:(Z,J,Y)=>[Z+1,J+0,Y+0,Z+1,J+1,Y+0,Z+1,J+0,Y+1,Z+1,J+1,Y+0,Z+1,J+1,Y+1,Z+1,J+0,Y+1]},{neighborOffset:[0,-1,0],generateVertices:(Z,J,Y)=>[Z+0,J+0,Y+0,Z+1,J+0,Y+0,Z+0,J+0,Y+1,Z+1,J+0,Y+0,Z+1,J+0,Y+1,Z+0,J+0,Y+1]},{neighborOffset:[0,1,0],generateVertices:(Z,J,Y)=>[Z+0,J+1,Y+0,Z+0,J+1,Y+1,Z+1,J+1,Y+0,Z+1,J+1,Y+0,Z+0,J+1,Y+1,Z+1,J+1,Y+1]},{neighborOffset:[0,0,-1],generateVertices:(Z,J,Y)=>[Z+0,J+0,Y+0,Z+0,J+1,Y+0,Z+1,J+0,Y+0,Z+0,J+1,Y+0,Z+1,J+1,Y+0,Z+1,J+0,Y+0]},{neighborOffset:[0,0,1],generateVertices:(Z,J,Y)=>[Z+0,J+0,Y+1,Z+1,J+0,Y+1,Z+0,J+1,Y+1,Z+0,J+1,Y+1,Z+1,J+0,Y+1,Z+1,J+1,Y+1]}],Fh;(($)=>{$.DESPAWN="CHUNK.DESPAWN";$.SET_BLOCK="CHUNK.SET_BLOCK";$.SPAWN="CHUNK.SPAWN"})(Fh||={});class I6 extends g0{_blocks;_originCoordinate;_requiresUpdate=!1;_rigidBody;_world;constructor(){super();this._blocks=new Uint8Array(v71)}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%I8,y:(Z/I8|0)%I8,z:Z/(I8*I8)|0}}static globalCoordinateToLocalCoordinate(Z){return{x:Z.x&I8-1,y:Z.y&I8-1,z:Z.z&I8-1}}static globalCoordinateToOriginCoordinate(Z){return{x:Z.x&~(I8-1),y:Z.y&~(I8-1),z:Z.z&~(I8-1)}}static isValidOriginCoordinate(Z){return Z.x%I8===0&&Z.y%I8===0&&Z.z%I8===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(!I6.isValidOriginCoordinate(J))return m.error(`Chunk.spawn(): Chunk coordinates must be divisible by ${I8}`);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 Y=this._getGlobalCoordinate(Z),$=[];if(Z.x===0)$.push({x:-1,y:0,z:0});if(Z.y===0)$.push({x:0,y:-1,z:0});if(Z.z===0)$.push({x:0,y:0,z:-1});if(Z.x===hK)$.push({x:1,y:0,z:0});if(Z.y===hK)$.push({x:0,y:1,z:0});if(Z.z===hK)$.push({x:0,y:0,z:1});for(let Q of $){let W={x:Y.x+Q.x,y:Y.y+Q.y,z:Y.z+Q.z},X=I6.globalCoordinateToOriginCoordinate(W),K=this._world?.chunkLattice.getChunk(X);if(!K?.hasBlock(I6.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 nY({type:"fixed",position:this._originCoordinate,simulation:this._world.simulation}),this._meshColliders().map(([Y,$])=>{if(!Y.isSimulated)Y.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 $=0;$<v71;$++){if(this._blocks[$]===0)continue;let Q=this._blocks[$],W=this._world.blockTypeRegistry.getBlockType(Q),{x:X,y:K,z:G}=I6.blockIndexToLocalCoordinate($);if(!W.isMeshable){let F=W.createCollider();F.setRelativePosition({x:X,y:K,z:G}),J.push([F,W]);continue}let z=Z.get(W)??{indices:[],vertices:[]};Z.set(W,z);for(let F of at8){let[H,V,q]=F.neighborOffset,U={x:X+H,y:K+V,z:G+q},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(...F.generateVertices(X,K,G))}}let Y=[];return Z.forEach(($,Q)=>{if(!$.indices.length)return;let W=Q.createCollider(new Uint32Array($.indices),new Float32Array($.vertices));Y.push([W,Q])}),[...J,...Y]}_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+I8*(Z.y+I8*Z.z)}_isValidLocalCoordinate(Z){return Z.x>=0&&Z.x<=hK&&Z.y>=0&&Z.y<=hK&&Z.z>=0&&Z.z<=hK}}class _H{_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:Y,z:$}=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(I6.globalCoordinateToOriginCoordinate(Z));if(!J)return 0;return J.getBlockId(I6.globalCoordinateToLocalCoordinate(Z))}getBlockType(Z){let J=this.getBlockId(Z);return J?this._world.blockTypeRegistry.getBlockType(J):null}getChunk(Z){if(!I6.isValidOriginCoordinate(Z)){m.error(`ChunkLattice.getChunk(): Chunk coordinates must be divisible by CHUNK_SIZE (${I8})`);return}return this._chunks.get(this._getChunkKey(Z))}getAllChunks(){return Array.from(this._chunks.values())}hasBlock(Z){let J=this.getChunk(I6.globalCoordinateToOriginCoordinate(Z));if(!J)return!1;return J.hasBlock(I6.globalCoordinateToLocalCoordinate(Z))}hasChunk(Z){return this._chunks.has(this._getChunkKey(Z))}setBlock(Z,J){let Y=I6.globalCoordinateToLocalCoordinate(Z),$=I6.globalCoordinateToOriginCoordinate(Z),Q=this.getChunk($);if(!Q)Q=new I6,Q.spawn(this._world,$);Q.setBlock(Y,J)}updateChunks(){this._chunks.forEach((Z)=>{if(Z.requiresUpdate)Z.update()})}_getChunkKey(Z){return`${Z.x},${Z.y},${Z.z}`}}var S71={type:"dynamic",softCcdPrediction:1},_71=0.0025000000000000005,A71=Math.cos(0.005),AH;((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"})(AH||={});class p8 extends nY{_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,Y="modelUri"in Z;if(!J===!Y)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&&!Q9.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??S71);if(J)this._blockHalfExtents=Z.blockHalfExtents,this._blockTextureUri=Z.blockTextureUri;if(Y)this._modelAnimationsPlaybackRate=Z.modelAnimationsPlaybackRate??1,this._modelPreferredShape=Z.modelPreferredShape,this._modelScale=Z.modelScale,this._modelUri=Z.modelUri,Z.modelHiddenNodes?.forEach(($)=>this._modelHiddenNodes.add($.toLowerCase())),Z.modelLoopedAnimations?.forEach(($)=>this._modelLoopedAnimations.add($));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?Q9.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,Y){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 f5(f5.optionsFromBlockHalfExtents(this._blockHalfExtents)));if(this._modelUri&&this.numColliders===0&&this._modelPreferredShape!=="none")this.addChildColliderToSimulation(new f5(f5.optionsFromModelUri(this._modelUri,this._modelScale,this._modelPreferredShape)));if(this.colliders.forEach(($)=>{if(this.hasListeners("ENTITY.BLOCK_COLLISION")||this.hasListeners("ENTITY.ENTITY_COLLISION"))$.enableCollisionEvents(!0);if(this.hasListeners("ENTITY.BLOCK_CONTACT_FORCE")||this.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))$.enableContactForceEvents(!0);if(u9.isDefaultCollisionGroups($.collisionGroups))$.setCollisionGroups({belongsTo:[$.isSensor?4:2],collidesWith:[65535]})}),this.setPosition(J),Y)this.setRotation(Y);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,Y);this.colliders.forEach(($)=>{Z.simulation.colliderMap.setColliderEntity($,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(Y??{x:0,y:0,z:0}),this.setRotation($??{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 Y=Z.x-J.x,$=Z.y-J.y,Q=Z.z-J.z;return Y*Y+$*$+Q*Q>_71}_rotationExceedsThreshold(Z,J){return Math.abs(Z.x*J.x+Z.y*J.y+Z.z*J.z+Z.w*J.w)<A71}}var Hh;((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"})(Hh||={});class xH 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 O7 extends p8{player;nametagSceneUI;constructor(Z){super(Z);this.player=Z.player,this.nametagSceneUI=new xH({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,Y){super.spawn(Z,J,Y),this.nametagSceneUI.load(Z),this.player.on("PLAYER.CHAT_MESSAGE_SEND",({message:$})=>{this.nametagSceneUI.setState({chat:$})})}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:Y}=this.player;this.controller.tickWithPlayerInput(this,J,Y.orientation,Z),super.tick(Z)}}class fH{_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 O7)Z.push(J)}),Z}getPlayerEntitiesByPlayer(Z){let J=[];return this._entities.forEach((Y)=>{if(Y instanceof O7&&Y.player===Z)J.push(Y)}),J}getEntity(Z){return this._entities.get(Z)}getEntitiesByTag(Z){let J=[];return this._entities.forEach((Y)=>{if(Y.tag===Z)J.push(Y)}),J}getEntitiesByTagSubstring(Z){let J=[];return this._entities.forEach((Y)=>{if(Y.tag?.includes(Z))J.push(Y)}),J}getEntityChildren(Z){let J=[];return this._entities.forEach((Y)=>{if(Y.parent===Z)J.push(Y)}),J}tickEntities(Z){this._entities.forEach((J)=>{J.tick(Z)})}checkAndEmitUpdates(){this._entities.forEach((Z)=>{if(!Z.isSpawned)return;Z.checkAndEmitUpdates()})}}class yH{_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 x71;((Y)=>{Y[Y.POINTLIGHT=0]="POINTLIGHT";Y[Y.SPOTLIGHT=1]="SPOTLIGHT"})(x71||={});var Vh;((V)=>{V.DESPAWN="LIGHT.DESPAWN";V.SET_ANGLE="LIGHT.SET_ANGLE";V.SET_ATTACHED_TO_ENTITY="LIGHT.SET_ATTACHED_TO_ENTITY";V.SET_COLOR="LIGHT.SET_COLOR";V.SET_DISTANCE="LIGHT.SET_DISTANCE";V.SET_INTENSITY="LIGHT.SET_INTENSITY";V.SET_OFFSET="LIGHT.SET_OFFSET";V.SET_PENUMBRA="LIGHT.SET_PENUMBRA";V.SET_POSITION="LIGHT.SET_POSITION";V.SET_TRACKED_ENTITY="LIGHT.SET_TRACKED_ENTITY";V.SET_TRACKED_POSITION="LIGHT.SET_TRACKED_POSITION";V.SPAWN="LIGHT.SPAWN"})(Vh||={});class qh 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 h71;(($)=>{$[$.FIRST_PERSON=0]="FIRST_PERSON";$[$.THIRD_PERSON=1]="THIRD_PERSON";$[$.SPECTATOR=2]="SPECTATOR"})(h71||={});var Uh;((q)=>{q.LOOK_AT_ENTITY="PLAYER_CAMERA.LOOK_AT_ENTITY";q.LOOK_AT_POSITION="PLAYER_CAMERA.LOOK_AT_POSITION";q.SET_ATTACHED_TO_ENTITY="PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY";q.SET_ATTACHED_TO_POSITION="PLAYER_CAMERA.SET_ATTACHED_TO_POSITION";q.SET_FILM_OFFSET="PLAYER_CAMERA.SET_FILM_OFFSET";q.SET_FORWARD_OFFSET="PLAYER_CAMERA.SET_FORWARD_OFFSET";q.SET_FOV="PLAYER_CAMERA.SET_FOV";q.SET_MODEL_HIDDEN_NODES="PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES";q.SET_MODE="PLAYER_CAMERA.SET_MODE";q.SET_OFFSET="PLAYER_CAMERA.SET_OFFSET";q.SET_TRACKED_ENTITY="PLAYER_CAMERA.SET_TRACKED_ENTITY";q.SET_TRACKED_POSITION="PLAYER_CAMERA.SET_TRACKED_POSITION";q.SET_ZOOM="PLAYER_CAMERA.SET_ZOOM"})(Uh||={});class bH 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 FM;((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"})(FM||={});class gH 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 mH{_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 st8={x:0,y:-32,z:0},Lh=60,wh;((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"})(wh||={});class dH extends g0{_colliderMap=new mH;_debugRaycastingEnabled=!1;_debugRenderingEnabled=!1;_rapierEventQueue;_rapierSimulation;_world;constructor(Z,J=Lh,Y=st8){super();this._rapierEventQueue=new K1.EventQueue(!0),this._rapierSimulation=new K1.World(Y),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,$.filterFlags,$.filterGroups,$.filterExcludeCollider,$.filterExcludeRigidBody,$.filterPredicate);if(this._debugRaycastingEnabled)this.emitWithWorld(this._world,"SIMULATION.DEBUG_RAYCAST",{simulation:this,origin:Z,direction:J,length:Y,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:bQ.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 F=this._colliderMap.getColliderHandleEntity(G.handle);if(F)return{hitEntity:F,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 Y=[];return this._rapierSimulation.narrowPhase.contactPair(Z,J,($,Q)=>{if($.numContacts()===0)return;let W=$.normal(),X=[];for(let K=0;K<$.numSolverContacts();K++)X.push($.solverContactPoint(K));Y.push({contactPoints:X,localNormalA:!Q?$.localNormal1():$.localNormal2(),localNormalB:!Q?$.localNormal2():$.localNormal1(),normal:!Q?W:{x:-W.x,y:-W.y,z:-W.z}})}),Y}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,Y)=>{let[$,Q]=this._getCollisionObjects(Z,J);if(!$||!Q)return;let W=(X,K)=>{if(X instanceof y5&&K instanceof p8&&X.hasListeners("BLOCK_TYPE.ENTITY_COLLISION"))X.emit("BLOCK_TYPE.ENTITY_COLLISION",{blockType:X,entity:K,started:Y,colliderHandleA:Z,colliderHandleB:J});else if(X instanceof p8&&K instanceof y5&&X.hasListeners("ENTITY.BLOCK_COLLISION"))X.emit("ENTITY.BLOCK_COLLISION",{entity:X,blockType:K,started:Y,colliderHandleA:Z,colliderHandleB:J});else if(X instanceof p8&&K instanceof p8&&X.hasListeners("ENTITY.ENTITY_COLLISION"))X.emit("ENTITY.ENTITY_COLLISION",{entity:X,otherEntity:K,started:Y,colliderHandleA:Z,colliderHandleB:J});else if(typeof X==="function"&&(K instanceof p8||K instanceof y5))X(K,Y,Z,J)};W($,Q),W(Q,$)};_onContactForceEvent=(Z)=>{let[J,Y]=this._getCollisionObjects(Z.collider1(),Z.collider2());if(!J||typeof J==="function"||!Y||typeof Y==="function")return;let $={totalForce:Z.totalForce(),totalForceMagnitude:Z.totalForceMagnitude(),maxForceDirection:Z.maxForceDirection(),maxForceMagnitude:Z.maxForceMagnitude()},Q=(W,X)=>{if(W instanceof y5&&X instanceof p8&&W.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))W.emit("BLOCK_TYPE.ENTITY_CONTACT_FORCE",{blockType:W,entity:X,contactForceData:$});else if(W instanceof p8&&X instanceof y5&&W.hasListeners("ENTITY.BLOCK_CONTACT_FORCE"))W.emit("ENTITY.BLOCK_CONTACT_FORCE",{entity:W,blockType:X,contactForceData:$});else if(W instanceof p8&&X instanceof p8&&W.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))W.emit("ENTITY.ENTITY_CONTACT_FORCE",{entity:W,otherEntity:X,contactForceData:$})};Q(J,Y),Q(Y,J)};_getCollisionObjects(Z,J){let Y=this._colliderMap.getColliderHandleBlockType(Z)??this._colliderMap.getColliderHandleCollisionCallback(Z)??this._colliderMap.getColliderHandleEntity(Z),$=this._colliderMap.getColliderHandleBlockType(J)??this._colliderMap.getColliderHandleCollisionCallback(J)??this._colliderMap.getColliderHandleEntity(J);return[Y,$]}}class HM{_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=[],Y=this._world.loop.currentTick;this._queuedPerPlayerSynchronizations.forEach((V,q)=>{this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(...V)});let $=Object.values(this._queuedEntitySynchronizations);if($.length>0){let[V,q]=$.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(q.length>0){let U=$0.createPacket($0.outboundPackets.entitiesPacketDefinition,q,Y);J.push(U)}if(V.length>0){let U=$0.createPacket($0.outboundPackets.entitiesPacketDefinition,V,Y);Z.push(U),this._synchronizedPlayerReliablePackets.forEach((w)=>w.push(U))}}let Q=Object.values(this._queuedAudioSynchronizations);if(Q.length>0){let V=$0.createPacket($0.outboundPackets.audiosPacketDefinition,Q,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}let W=Object.values(this._queuedBlockTypeSynchronizations);if(W.length>0){let V=$0.createPacket($0.outboundPackets.blockTypesPacketDefinition,W,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}let X=Object.values(this._queuedBlockSynchronizations);if(X.length>0){let V=$0.createPacket($0.outboundPackets.blocksPacketDefinition,X,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}let K=Object.values(this._queuedChunkSynchronizations);if(K.length>0){let V=$0.createPacket($0.outboundPackets.chunksPacketDefinition,K,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}let G=Object.values(this._queuedLightSynchronizations);if(G.length>0){let V=$0.createPacket($0.outboundPackets.lightsPacketDefinition,G,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}this._queuedPerPlayerUISynchronizations.forEach((V,q)=>{let U=$0.createPacket($0.outboundPackets.uiPacketDefinition,V,Y);this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(U)}),this._queuedPerPlayerUIDatasSynchronizations.forEach((V,q)=>{let U=$0.createPacket($0.outboundPackets.uiDatasPacketDefinition,V,Y);this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(U)});let z=Object.values(this._queuedSceneUISynchronizations);if(z.length>0){let V=$0.createPacket($0.outboundPackets.sceneUIsPacketDefinition,z,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}if(this._queuedWorldSynchronization){let V=$0.createPacket($0.outboundPackets.worldPacketDefinition,this._queuedWorldSynchronization,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}this._queuedPerPlayerCameraSynchronizations.forEach((V,q)=>{let U=$0.createPacket($0.outboundPackets.cameraPacketDefinition,V,Y);this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(U)});let F=Object.values(this._queuedPlayerSynchronizations);if(F.length>0){let V=$0.createPacket($0.outboundPackets.playersPacketDefinition,F,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}this._queuedBroadcasts.forEach((V)=>{Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))});let H=this._queuedDebugRaycastSynchronizations;if(H.length>0){let V=$0.createPacket($0.outboundPackets.physicsDebugRaycastsPacketDefinition,H,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}X8.startSpan({operation:"send_all_packets"},()=>{d5.instance.getConnectedPlayersByWorld(this._world).forEach((V)=>{let q=this._synchronizedPlayerReliablePackets.get(V)??Z;if(q.length>0)V.connection.send(q);if(J.length>0)V.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(H.length>0)this._queuedDebugRaycastSynchronizations=[];if($.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(F.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:Y,color:$}=Z;this._queuedBroadcasts.push($0.createPacket($0.outboundPackets.chatMessagesPacketDefinition,[{m:Y,c:$,p:J?.id}],this._world.loop.currentTick))};_onChatSendPlayerMessage=(Z)=>{let{player:J,message:Y,color:$}=Z,Q=this._queuedPerPlayerSynchronizations.get(J)??[];Q.push($0.createPacket($0.outboundPackets.chatMessagesPacketDefinition,[{m:Y,c:$}],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),Y=J.c.join(",");if(this._spawnedChunks.has(Y))delete this._queuedChunkSynchronizations[Y],this._spawnedChunks.delete(Y);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((Y)=>!Z.animations.has(Y)).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((Y)=>!Z.animations.has(Y)).filter(Boolean)};_onEntityStopModelAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.al)J.al=J.al.filter((Y)=>!Z.animations.has(Y)).filter(Boolean);if(J.ao)J.ao=J.ao.filter((Y)=>!Z.animations.has(Y)).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,Y=this._queuedPerPlayerSynchronizations.get(J)??[];Y.push($0.createPacket($0.outboundPackets.worldPacketDefinition,this._world.serialize(),this._world.loop.currentTick)),Y.push($0.createPacket($0.outboundPackets.blockTypesPacketDefinition,this._world.blockTypeRegistry.serialize(),this._world.loop.currentTick)),Y.push($0.createPacket($0.outboundPackets.chunksPacketDefinition,this._world.chunkLattice.getAllChunks().map((Q)=>Q.serialize()),this._world.loop.currentTick)),Y.push($0.createPacket($0.outboundPackets.entitiesPacketDefinition,this._world.entityManager.getAllEntities().map((Q)=>{if(J.camera.attachedToEntity===void 0&&Q instanceof O7&&Q.player===J)J.camera.setAttachedToEntity(Q);return Q.serialize()}),this._world.loop.currentTick)),Y.push($0.createPacket($0.outboundPackets.audiosPacketDefinition,this._world.audioManager.getAllAudios().map((Q)=>Q.serialize()),this._world.loop.currentTick)),Y.push($0.createPacket($0.outboundPackets.lightsPacketDefinition,this._world.lightManager.getAllLights().map((Q)=>Q.serialize()),this._world.loop.currentTick)),Y.push($0.createPacket($0.outboundPackets.sceneUIsPacketDefinition,this._world.sceneUIManager.getAllSceneUIs().map((Q)=>Q.serialize()),this._world.loop.currentTick)),Y.push($0.createPacket($0.outboundPackets.playersPacketDefinition,d5.instance.getConnectedPlayers().map((Q)=>Q.serialize()),this._world.loop.currentTick));let $=this._createOrGetQueuedPlayerCameraSync(J.camera);this._queuedPerPlayerCameraSynchronizations.set(J,{...J.camera.serialize(),...$}),this._queuedPerPlayerSynchronizations.set(J,Y),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([$0.createPacket($0.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($0.createPacket($0.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:Y,z:$}=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:Y,z:$}=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 Y=this._synchronizedPlayerReliablePackets.get(Z);if(!Y)Y=[...J],this._synchronizedPlayerReliablePackets.set(Z,Y);return Y}}class uH{_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 ot8=2,rt8=3;class cH{_accumulatorMs=0;_targetTicksPerSecond;_fixedTimestepMs;_fixedTimestepS;_maxAccumulatorMs;_nextTickMs=0;_lastLoopTimeMs=0;_tickFunction;_tickErrorCallback;_tickHandle=null;constructor(Z,J,Y){this._targetTicksPerSecond=Z,this._fixedTimestepS=Math.fround(1/Z),this._fixedTimestepMs=Math.fround(this._fixedTimestepS*1000),this._maxAccumulatorMs=this._fixedTimestepMs*rt8,this._tickFunction=J,this._tickErrorCallback=Y}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(),Y=J-this._lastLoopTimeMs;if(this._lastLoopTimeMs=J,this._accumulatorMs+=Y,this._accumulatorMs>this._maxAccumulatorMs)this._accumulatorMs=this._maxAccumulatorMs;if(this._accumulatorMs>=this._fixedTimestepMs)X8.startSpan({operation:"ticker_tick"},()=>{let $=0;while(this._accumulatorMs>=this._fixedTimestepMs&&$<ot8)this._tick(this._fixedTimestepMs),this._accumulatorMs-=this._fixedTimestepMs,$++;this._nextTickMs=this._fixedTimestepMs-this._accumulatorMs});this._tickHandle=setImmediate(Z)};Z()}stop(){if(!this._tickHandle)return m.warning("Ticker.stop(): ticker not running.");clearImmediate(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 f71;((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"})(f71||={});class lH extends g0{_currentTick=0;_ticker;_world;constructor(Z,J=Lh){super();this._ticker=new cH(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:d5.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 Bh;((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"})(Bh||={});class pH 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 cK(this),this._blockTypeRegistry=new eG(this),this._chatManager=new iH(this),this._chunkLattice=new _H(this),this._entityManager=new fH(this),this._lightManager=new yH(this),this._loop=new lH(this,Z.tickRate),this._networkSynchronizer=new HM(this),this._sceneUIManager=new uH(this),this._simulation=new dH(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,Y]of Object.entries(Z.blocks)){let[$,Q,W]=J.split(",").map(Number);this.chunkLattice.setBlock({x:$,y:Q,z:W},Y)}if(Z.entities)for(let[J,Y]of Object.entries(Z.entities)){let[$,Q,W]=J.split(",").map(Number);new p8(Y).spawn(this,{x:$,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 tt8=1,y71;((J)=>J.WORLD_CREATED="WORLD_MANAGER.WORLD_CREATED")(y71||={});class fK{static instance=new fK;_worlds=new Map;_nextWorldId=1;createWorld(Z){let J=new pH({...Z,id:this._nextWorldId++});return J.start(),this._worlds.set(J.id,J),X6.emit("WORLD_MANAGER.WORLD_CREATED",{world:J}),J}getAllWorlds(){return Array.from(this._worlds.values())}getDefaultWorld(){return this._worlds.get(tt8)??this.createWorld({name:"Default World",skyboxUri:"skyboxes/partly-cloudy"})}getWorldsByTag(Z){let J=[];return this._worlds.forEach((Y)=>{if(Y.tag===Z)J.push(Y)}),J}getWorld(Z){return this._worlds.get(Z)}}var b71;((Y)=>{Y.START="GAMESERVER.START";Y.STOP="GAMESERVER.STOP"})(b71||={});function et8(Z){K1.init().then(()=>{return PZ.instance.modelRegistry.preloadModels()}).then(()=>{Z(PZ.instance.worldManager.getDefaultWorld()),PZ.instance.start()}).catch((J)=>{m.fatalError(`Failed to initialize the game engine, exiting. Error: ${J}`)})}class PZ{static _instance;_modelRegistry=Q9.instance;_playerManager=d5.instance;_socket=zJ.instance;_worldManager=fK.instance;_webServer=BX.instance;constructor(){Bun.unsafe.gcAggressionLevel(2)}static get instance(){if(!this._instance)this._instance=new PZ;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(){X6.emit("GAMESERVER.START",{startedAtMs:performance.now()}),this._webServer.start()}}class AQ{static instance=new AQ;constructor(){}async getGlobalData(Z){let J=await s4.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 s4.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 Y=await s4.instance.setData(Z,J);if(!Y||Y.error){if(Y?.error)m.warning(`PersistenceManager.setGlobalData(): ${Y.error.message}`);return}return Y}async setPlayerData(Z,J){let Y=await s4.instance.setData(this._getPlayerKey(Z),J);if(!Y||Y.error){if(Y?.error)m.warning(`PersistenceManager.setPlayerData(): ${Y.error.message}`);return}return Y}_getPlayerKey(Z){return`player-${Z.id}`}}var g71=["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"],hH;((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"})(hH||={});class xK 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-${xK._devNextPlayerId++}`,this.username=J?.user.username??this.id,this.profilePictureUrl=J?.user.profilePictureURL??void 0,this.camera=new bH(this),this.connection=Z,this.ui=new gH(this),Z.onPacket($0.PacketId.CHAT_MESSAGE_SEND,this._onChatMessageSendPacket),Z.onPacket($0.PacketId.DEBUG_CONFIG,this._onDebugConfigPacket),Z.onPacket($0.PacketId.INPUT,this._onInputPacket),Z.onPacket($0.PacketId.SYNC_REQUEST,this._onSyncRequestPacket),Z.onPacket($0.PacketId.UI_DATA_SEND,this._onUIDataSendPacket),this.joinWorld(PZ.instance.worldManager.getDefaultWorld())}get input(){return this._input}get world(){return this._world}disconnect(){this._leaveWorld(),this.connection.disconnect()}async getPersistedData(){return AQ.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 AQ.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(g71.forEach((Y)=>{let $=Y;if(J[$]!==void 0)this._input[$]=Boolean(J[$])}),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 Oh;((Y)=>{Y.BROADCAST_MESSAGE="CHAT.BROADCAST_MESSAGE";Y.PLAYER_MESSAGE="CHAT.PLAYER_MESSAGE"})(Oh||={});class iH 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,Y){this.emitWithWorld(this._world,"CHAT.PLAYER_MESSAGE",{player:Z,message:J,color:Y})}_subscribeToPlayerEvents(){this._world.on("PLAYER.CHAT_MESSAGE_SEND",(Z)=>{let{player:J,message:Y}=Z,[$,...Q]=Y.split(" "),W=this._commandCallbacks[$];if(W){W(J,Q,Y);return}this._sendBroadcastMessage(J,Y)})}_sendBroadcastMessage(Z,J,Y){this.emitWithWorld(this._world,"CHAT.BROADCAST_MESSAGE",{player:Z,message:J,color:Y})}}class nH extends zY{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 uK({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:Y})=>{if(!J.isLiquid||!this.canSwim(this))return;if(this._liquidContactCount<=0&&Y){let $=Z.linearVelocity;Z.setLinearVelocity({x:$.x*this.swimGravity,y:$.y*this.swimGravity,z:$.z*this.swimGravity})}if(this._liquidContactCount+=Y?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,Y)=>{if(!Z.isSpawned)return;if(!(J instanceof y5)||!J.isLiquid)this._groundContactCount+=Y?1:-1;if(!this._groundContactCount&&!this.isSwimming)Z.startModelOneshotAnimations(this.jumpOneshotAnimations);else Z.stopModelAnimations(this.jumpOneshotAnimations);if(!(J instanceof p8)||!J.isKinematic)return;if(Y&&this.sticksToPlatforms)this._platform=J;else if(J===this._platform&&!Y)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:F}=J,{yaw:H}=Y,V=Z.linearVelocity,q={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((N)=>!this.runLoopedAnimations.includes(N))),Z.startModelLoopedAnimations(this.runLoopedAnimations),this._stepAudio?.setPlaybackRate(0.75);else Z.stopModelAnimations(Array.from(Z.modelLoopedAnimations).filter((N)=>!this.walkLoopedAnimations.includes(N))),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((N)=>!this.idleLoopedAnimations.includes(N))),Z.startModelLoopedAnimations(this.idleLoopedAnimations);if(F)Z.startModelOneshotAnimations(this.interactOneshotAnimations),J.ml=!this.autoCancelMouseLeftClick;if(U&&this.canRun(this)||!U&&this.canWalk(this)){let N=!this.isSwimming?U?this.runVelocity:this.walkVelocity:U?this.swimFastVelocity:this.swimSlowVelocity;if(Q)q.x-=N*Math.sin(H),q.z-=N*Math.cos(H);if(X)q.x+=N*Math.sin(H),q.z+=N*Math.cos(H);if(W)q.x-=N*Math.cos(H),q.z+=N*Math.sin(H);if(K)q.x+=N*Math.cos(H),q.z-=N*Math.sin(H);let j=Math.sqrt(q.x*q.x+q.z*q.z);if(j>N){let R=N/j;q.x*=R,q.z*=R}}if(this.isSwimming){if(V.y<this.swimMaxGravityVelocity)Z.setLinearVelocity({...V,y:this.swimMaxGravityVelocity});if(V.y>this.swimUpwardVelocity*2)Z.setLinearVelocity({...V,y:this.swimUpwardVelocity*2})}if(G&&this.canJump(this)){if(this.isGrounded&&!this.isSwimming&&V.y>-0.001&&V.y<=3)q.y=this.jumpVelocity;else if(this.isSwimming&&performance.now()>this._swimUpwardCooldownAt)q.y=this.swimUpwardVelocity*Z.gravityScale}let w=this._platform?this._platform.linearVelocity:{x:0,y:0,z:0},L={x:q.x-V.x+w.x,y:q.y+w.y,z:q.z-V.z+w.z};if(!(this.runVelocity>0&&Math.abs(V.x)>this.runVelocity||this.jumpVelocity>0&&Math.abs(V.y)>this.jumpVelocity||this.runVelocity>0&&Math.abs(V.z)>this.runVelocity)||this.isOnPlatform){if(Object.values(L).some((N)=>N!==0)){let N=Z.mass;Z.applyImpulse({x:L.x*N,y:L.y*N,z:L.z*N})}}if(H!==void 0){let N=H/2;Z.setRotation({x:0,y:Math.fround(Math.sin(N)),z:0,w:Math.fround(Math.cos(N))})}}}class Mh extends O7{constructor(Z){super({modelUri:"models/players/player.gltf",modelLoopedAnimations:["idle_lower","idle_upper"],modelScale:0.5,...Z});if(!Z.controller)this.setController(new nH)}}var P0=0.000001,$1=typeof Float32Array!=="undefined"?Float32Array:Array,M7=Math.random;var Fi6=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 y8={};b9(y8,{transpose:()=>Xe8,subtract:()=>d71,sub:()=>Pe8,str:()=>Ue8,set:()=>We8,scale:()=>He8,rotate:()=>Fe8,multiplyScalarAndAdd:()=>Re8,multiplyScalar:()=>Ne8,multiply:()=>m71,mul:()=>je8,invert:()=>Ke8,identity:()=>$e8,fromValues:()=>Qe8,fromScaling:()=>qe8,fromRotation:()=>Ve8,frob:()=>Le8,exactEquals:()=>Oe8,equals:()=>Me8,determinant:()=>ze8,create:()=>Ze8,copy:()=>Ye8,clone:()=>Je8,adjoint:()=>Ge8,add:()=>Be8,LDU:()=>we8});function Ze8(){var Z=new $1(4);if($1!=Float32Array)Z[1]=0,Z[2]=0;return Z[0]=1,Z[3]=1,Z}function Je8(Z){var J=new $1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function Ye8(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function $e8(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=1,Z}function Qe8(Z,J,Y,$){var Q=new $1(4);return Q[0]=Z,Q[1]=J,Q[2]=Y,Q[3]=$,Q}function We8(Z,J,Y,$,Q){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=Q,Z}function Xe8(Z,J){if(Z===J){var Y=J[1];Z[1]=J[2],Z[2]=Y}else Z[0]=J[0],Z[1]=J[2],Z[2]=J[1],Z[3]=J[3];return Z}function Ke8(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=Y*W-Q*$;if(!X)return null;return X=1/X,Z[0]=W*X,Z[1]=-$*X,Z[2]=-Q*X,Z[3]=Y*X,Z}function Ge8(Z,J){var Y=J[0];return Z[0]=J[3],Z[1]=-J[1],Z[2]=-J[2],Z[3]=Y,Z}function ze8(Z){return Z[0]*Z[3]-Z[2]*Z[1]}function m71(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=Y[0],G=Y[1],z=Y[2],F=Y[3];return Z[0]=$*K+W*G,Z[1]=Q*K+X*G,Z[2]=$*z+W*F,Z[3]=Q*z+X*F,Z}function Fe8(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G+W*K,Z[1]=Q*G+X*K,Z[2]=$*-K+W*G,Z[3]=Q*-K+X*G,Z}function He8(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=Y[0],G=Y[1];return Z[0]=$*K,Z[1]=Q*K,Z[2]=W*G,Z[3]=X*G,Z}function Ve8(Z,J){var Y=Math.sin(J),$=Math.cos(J);return Z[0]=$,Z[1]=Y,Z[2]=-Y,Z[3]=$,Z}function qe8(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=J[1],Z}function Ue8(Z){return"mat2("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}function Le8(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3])}function we8(Z,J,Y,$){return Z[2]=$[2]/$[0],Y[0]=$[0],Y[1]=$[1],Y[3]=$[3]-Z[2]*Y[1],[Z,J,Y]}function Be8(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z[2]=J[2]+Y[2],Z[3]=J[3]+Y[3],Z}function d71(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z[2]=J[2]-Y[2],Z[3]=J[3]-Y[3],Z}function Oe8(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function Me8(Z,J){var Y=Z[0],$=Z[1],Q=Z[2],W=Z[3],X=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(Y-X)<=P0*Math.max(1,Math.abs(Y),Math.abs(X))&&Math.abs($-K)<=P0*Math.max(1,Math.abs($),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 Ne8(Z,J,Y){return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z[2]=J[2]*Y,Z[3]=J[3]*Y,Z}function Re8(Z,J,Y,$){return Z[0]=J[0]+Y[0]*$,Z[1]=J[1]+Y[1]*$,Z[2]=J[2]+Y[2]*$,Z[3]=J[3]+Y[3]*$,Z}var je8=m71,Pe8=d71;var l1={};b9(l1,{transpose:()=>ve8,translate:()=>xe8,subtract:()=>c71,sub:()=>te8,str:()=>le8,set:()=>Ee8,scale:()=>fe8,rotate:()=>he8,projection:()=>ce8,normalFromMat4:()=>ue8,multiplyScalarAndAdd:()=>ae8,multiplyScalar:()=>ne8,multiply:()=>u71,mul:()=>re8,invert:()=>Se8,identity:()=>Ie8,fromValues:()=>ke8,fromTranslation:()=>ye8,fromScaling:()=>ge8,fromRotation:()=>be8,fromQuat:()=>de8,fromMat4:()=>De8,fromMat2d:()=>me8,frob:()=>pe8,exactEquals:()=>se8,equals:()=>oe8,determinant:()=>Ae8,create:()=>Nh,copy:()=>Te8,clone:()=>Ce8,adjoint:()=>_e8,add:()=>ie8});function Nh(){var Z=new $1(9);if($1!=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 De8(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 Ce8(Z){var J=new $1(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 Te8(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 ke8(Z,J,Y,$,Q,W,X,K,G){var z=new $1(9);return z[0]=Z,z[1]=J,z[2]=Y,z[3]=$,z[4]=Q,z[5]=W,z[6]=X,z[7]=K,z[8]=G,z}function Ee8(Z,J,Y,$,Q,W,X,K,G,z){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=Q,Z[4]=W,Z[5]=X,Z[6]=K,Z[7]=G,Z[8]=z,Z}function Ie8(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 ve8(Z,J){if(Z===J){var Y=J[1],$=J[2],Q=J[5];Z[1]=J[3],Z[2]=J[6],Z[3]=Y,Z[5]=J[7],Z[6]=$,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 Se8(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],H=F*X-K*z,V=-F*W+K*G,q=z*W-X*G,U=Y*H+$*V+Q*q;if(!U)return null;return U=1/U,Z[0]=H*U,Z[1]=(-F*$+Q*z)*U,Z[2]=(K*$-Q*X)*U,Z[3]=V*U,Z[4]=(F*Y-Q*G)*U,Z[5]=(-K*Y+Q*W)*U,Z[6]=q*U,Z[7]=(-z*Y+$*G)*U,Z[8]=(X*Y-$*W)*U,Z}function _e8(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8];return Z[0]=X*F-K*z,Z[1]=Q*z-$*F,Z[2]=$*K-Q*X,Z[3]=K*G-W*F,Z[4]=Y*F-Q*G,Z[5]=Q*W-Y*K,Z[6]=W*z-X*G,Z[7]=$*G-Y*z,Z[8]=Y*X-$*W,Z}function Ae8(Z){var J=Z[0],Y=Z[1],$=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)+Y*(-z*Q+X*K)+$*(G*Q-W*K)}function u71(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],H=J[8],V=Y[0],q=Y[1],U=Y[2],w=Y[3],L=Y[4],O=Y[5],N=Y[6],j=Y[7],R=Y[8];return Z[0]=V*$+q*X+U*z,Z[1]=V*Q+q*K+U*F,Z[2]=V*W+q*G+U*H,Z[3]=w*$+L*X+O*z,Z[4]=w*Q+L*K+O*F,Z[5]=w*W+L*G+O*H,Z[6]=N*$+j*X+R*z,Z[7]=N*Q+j*K+R*F,Z[8]=N*W+j*G+R*H,Z}function xe8(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],H=J[8],V=Y[0],q=Y[1];return Z[0]=$,Z[1]=Q,Z[2]=W,Z[3]=X,Z[4]=K,Z[5]=G,Z[6]=V*$+q*X+z,Z[7]=V*Q+q*K+F,Z[8]=V*W+q*G+H,Z}function he8(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],H=J[8],V=Math.sin(Y),q=Math.cos(Y);return Z[0]=q*$+V*X,Z[1]=q*Q+V*K,Z[2]=q*W+V*G,Z[3]=q*X-V*$,Z[4]=q*K-V*Q,Z[5]=q*G-V*W,Z[6]=z,Z[7]=F,Z[8]=H,Z}function fe8(Z,J,Y){var $=Y[0],Q=Y[1];return Z[0]=$*J[0],Z[1]=$*J[1],Z[2]=$*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 ye8(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 be8(Z,J){var Y=Math.sin(J),$=Math.cos(J);return Z[0]=$,Z[1]=Y,Z[2]=0,Z[3]=-Y,Z[4]=$,Z[5]=0,Z[6]=0,Z[7]=0,Z[8]=1,Z}function ge8(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 me8(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 de8(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=Y+Y,K=$+$,G=Q+Q,z=Y*X,F=$*X,H=$*K,V=Q*X,q=Q*K,U=Q*G,w=W*X,L=W*K,O=W*G;return Z[0]=1-H-U,Z[3]=F-O,Z[6]=V+L,Z[1]=F+O,Z[4]=1-z-U,Z[7]=q-w,Z[2]=V-L,Z[5]=q+w,Z[8]=1-z-H,Z}function ue8(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],H=J[9],V=J[10],q=J[11],U=J[12],w=J[13],L=J[14],O=J[15],N=Y*K-$*X,j=Y*G-Q*X,R=Y*z-W*X,D=$*G-Q*K,P=$*z-W*K,C=Q*z-W*G,T=F*w-H*U,I=F*L-V*U,x=F*O-q*U,S=H*L-V*w,A=H*O-q*w,E=V*O-q*L,v=N*E-j*A+R*S+D*x-P*I+C*T;if(!v)return null;return v=1/v,Z[0]=(K*E-G*A+z*S)*v,Z[1]=(G*x-X*E-z*I)*v,Z[2]=(X*A-K*x+z*T)*v,Z[3]=(Q*A-$*E-W*S)*v,Z[4]=(Y*E-Q*x+W*I)*v,Z[5]=($*x-Y*A-W*T)*v,Z[6]=(w*C-L*P+O*D)*v,Z[7]=(L*R-U*C-O*j)*v,Z[8]=(U*P-w*R+O*N)*v,Z}function ce8(Z,J,Y){return Z[0]=2/J,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=-2/Y,Z[5]=0,Z[6]=-1,Z[7]=1,Z[8]=1,Z}function le8(Z){return"mat3("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+")"}function pe8(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8])}function ie8(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z[2]=J[2]+Y[2],Z[3]=J[3]+Y[3],Z[4]=J[4]+Y[4],Z[5]=J[5]+Y[5],Z[6]=J[6]+Y[6],Z[7]=J[7]+Y[7],Z[8]=J[8]+Y[8],Z}function c71(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z[2]=J[2]-Y[2],Z[3]=J[3]-Y[3],Z[4]=J[4]-Y[4],Z[5]=J[5]-Y[5],Z[6]=J[6]-Y[6],Z[7]=J[7]-Y[7],Z[8]=J[8]-Y[8],Z}function ne8(Z,J,Y){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]*Y,Z[5]=J[5]*Y,Z[6]=J[6]*Y,Z[7]=J[7]*Y,Z[8]=J[8]*Y,Z}function ae8(Z,J,Y,$){return Z[0]=J[0]+Y[0]*$,Z[1]=J[1]+Y[1]*$,Z[2]=J[2]+Y[2]*$,Z[3]=J[3]+Y[3]*$,Z[4]=J[4]+Y[4]*$,Z[5]=J[5]+Y[5]*$,Z[6]=J[6]+Y[6]*$,Z[7]=J[7]+Y[7]*$,Z[8]=J[8]+Y[8]*$,Z}function se8(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 oe8(Z,J){var Y=Z[0],$=Z[1],Q=Z[2],W=Z[3],X=Z[4],K=Z[5],G=Z[6],z=Z[7],F=Z[8],H=J[0],V=J[1],q=J[2],U=J[3],w=J[4],L=J[5],O=J[6],N=J[7],j=J[8];return Math.abs(Y-H)<=P0*Math.max(1,Math.abs(Y),Math.abs(H))&&Math.abs($-V)<=P0*Math.max(1,Math.abs($),Math.abs(V))&&Math.abs(Q-q)<=P0*Math.max(1,Math.abs(Q),Math.abs(q))&&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-N)<=P0*Math.max(1,Math.abs(z),Math.abs(N))&&Math.abs(F-j)<=P0*Math.max(1,Math.abs(F),Math.abs(j))}var re8=u71,te8=c71;var o0={};b9(o0,{transpose:()=>Q06,translate:()=>G06,targetTo:()=>A06,subtract:()=>o71,sub:()=>u06,str:()=>x06,set:()=>$06,scale:()=>z06,rotateZ:()=>q06,rotateY:()=>V06,rotateX:()=>H06,rotate:()=>F06,perspectiveZO:()=>E06,perspectiveNO:()=>a71,perspectiveFromFieldOfView:()=>I06,perspective:()=>k06,orthoZO:()=>S06,orthoNO:()=>s71,ortho:()=>v06,multiplyScalarAndAdd:()=>b06,multiplyScalar:()=>y06,multiply:()=>p71,mul:()=>d06,lookAt:()=>_06,invert:()=>W06,identity:()=>l71,getTranslation:()=>R06,getScaling:()=>n71,getRotation:()=>j06,frustum:()=>T06,fromZRotation:()=>M06,fromYRotation:()=>O06,fromXRotation:()=>B06,fromValues:()=>Y06,fromTranslation:()=>U06,fromScaling:()=>L06,fromRotationTranslationScaleOrigin:()=>D06,fromRotationTranslationScale:()=>P06,fromRotationTranslation:()=>i71,fromRotation:()=>w06,fromQuat2:()=>N06,fromQuat:()=>C06,frob:()=>h06,exactEquals:()=>g06,equals:()=>m06,determinant:()=>K06,create:()=>ee8,copy:()=>J06,clone:()=>Z06,adjoint:()=>X06,add:()=>f06});function ee8(){var Z=new $1(16);if($1!=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 Z06(Z){var J=new $1(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 J06(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 Y06(Z,J,Y,$,Q,W,X,K,G,z,F,H,V,q,U,w){var L=new $1(16);return L[0]=Z,L[1]=J,L[2]=Y,L[3]=$,L[4]=Q,L[5]=W,L[6]=X,L[7]=K,L[8]=G,L[9]=z,L[10]=F,L[11]=H,L[12]=V,L[13]=q,L[14]=U,L[15]=w,L}function $06(Z,J,Y,$,Q,W,X,K,G,z,F,H,V,q,U,w,L){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=Q,Z[4]=W,Z[5]=X,Z[6]=K,Z[7]=G,Z[8]=z,Z[9]=F,Z[10]=H,Z[11]=V,Z[12]=q,Z[13]=U,Z[14]=w,Z[15]=L,Z}function l71(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 Q06(Z,J){if(Z===J){var Y=J[1],$=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]=Y,Z[6]=J[9],Z[7]=J[13],Z[8]=$,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 W06(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],H=J[9],V=J[10],q=J[11],U=J[12],w=J[13],L=J[14],O=J[15],N=Y*K-$*X,j=Y*G-Q*X,R=Y*z-W*X,D=$*G-Q*K,P=$*z-W*K,C=Q*z-W*G,T=F*w-H*U,I=F*L-V*U,x=F*O-q*U,S=H*L-V*w,A=H*O-q*w,E=V*O-q*L,v=N*E-j*A+R*S+D*x-P*I+C*T;if(!v)return null;return v=1/v,Z[0]=(K*E-G*A+z*S)*v,Z[1]=(Q*A-$*E-W*S)*v,Z[2]=(w*C-L*P+O*D)*v,Z[3]=(V*P-H*C-q*D)*v,Z[4]=(G*x-X*E-z*I)*v,Z[5]=(Y*E-Q*x+W*I)*v,Z[6]=(L*R-U*C-O*j)*v,Z[7]=(F*C-V*R+q*j)*v,Z[8]=(X*A-K*x+z*T)*v,Z[9]=($*x-Y*A-W*T)*v,Z[10]=(U*P-w*R+O*N)*v,Z[11]=(H*R-F*P-q*N)*v,Z[12]=(K*I-X*S-G*T)*v,Z[13]=(Y*S-$*I+Q*T)*v,Z[14]=(w*j-U*D-L*N)*v,Z[15]=(F*D-H*j+V*N)*v,Z}function X06(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],H=J[9],V=J[10],q=J[11],U=J[12],w=J[13],L=J[14],O=J[15];return Z[0]=K*(V*O-q*L)-H*(G*O-z*L)+w*(G*q-z*V),Z[1]=-($*(V*O-q*L)-H*(Q*O-W*L)+w*(Q*q-W*V)),Z[2]=$*(G*O-z*L)-K*(Q*O-W*L)+w*(Q*z-W*G),Z[3]=-($*(G*q-z*V)-K*(Q*q-W*V)+H*(Q*z-W*G)),Z[4]=-(X*(V*O-q*L)-F*(G*O-z*L)+U*(G*q-z*V)),Z[5]=Y*(V*O-q*L)-F*(Q*O-W*L)+U*(Q*q-W*V),Z[6]=-(Y*(G*O-z*L)-X*(Q*O-W*L)+U*(Q*z-W*G)),Z[7]=Y*(G*q-z*V)-X*(Q*q-W*V)+F*(Q*z-W*G),Z[8]=X*(H*O-q*w)-F*(K*O-z*w)+U*(K*q-z*H),Z[9]=-(Y*(H*O-q*w)-F*($*O-W*w)+U*($*q-W*H)),Z[10]=Y*(K*O-z*w)-X*($*O-W*w)+U*($*z-W*K),Z[11]=-(Y*(K*q-z*H)-X*($*q-W*H)+F*($*z-W*K)),Z[12]=-(X*(H*L-V*w)-F*(K*L-G*w)+U*(K*V-G*H)),Z[13]=Y*(H*L-V*w)-F*($*L-Q*w)+U*($*V-Q*H),Z[14]=-(Y*(K*L-G*w)-X*($*L-Q*w)+U*($*G-Q*K)),Z[15]=Y*(K*V-G*H)-X*($*V-Q*H)+F*($*G-Q*K),Z}function K06(Z){var J=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],F=Z[9],H=Z[10],V=Z[11],q=Z[12],U=Z[13],w=Z[14],L=Z[15],O=J*X-Y*W,N=J*K-$*W,j=J*G-Q*W,R=Y*K-$*X,D=Y*G-Q*X,P=$*G-Q*K,C=z*U-F*q,T=z*w-H*q,I=z*L-V*q,x=F*w-H*U,S=F*L-V*U,A=H*L-V*w;return O*A-N*S+j*x+R*I-D*T+P*C}function p71(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],H=J[8],V=J[9],q=J[10],U=J[11],w=J[12],L=J[13],O=J[14],N=J[15],j=Y[0],R=Y[1],D=Y[2],P=Y[3];return Z[0]=j*$+R*K+D*H+P*w,Z[1]=j*Q+R*G+D*V+P*L,Z[2]=j*W+R*z+D*q+P*O,Z[3]=j*X+R*F+D*U+P*N,j=Y[4],R=Y[5],D=Y[6],P=Y[7],Z[4]=j*$+R*K+D*H+P*w,Z[5]=j*Q+R*G+D*V+P*L,Z[6]=j*W+R*z+D*q+P*O,Z[7]=j*X+R*F+D*U+P*N,j=Y[8],R=Y[9],D=Y[10],P=Y[11],Z[8]=j*$+R*K+D*H+P*w,Z[9]=j*Q+R*G+D*V+P*L,Z[10]=j*W+R*z+D*q+P*O,Z[11]=j*X+R*F+D*U+P*N,j=Y[12],R=Y[13],D=Y[14],P=Y[15],Z[12]=j*$+R*K+D*H+P*w,Z[13]=j*Q+R*G+D*V+P*L,Z[14]=j*W+R*z+D*q+P*O,Z[15]=j*X+R*F+D*U+P*N,Z}function G06(Z,J,Y){var $=Y[0],Q=Y[1],W=Y[2],X,K,G,z,F,H,V,q,U,w,L,O;if(J===Z)Z[12]=J[0]*$+J[4]*Q+J[8]*W+J[12],Z[13]=J[1]*$+J[5]*Q+J[9]*W+J[13],Z[14]=J[2]*$+J[6]*Q+J[10]*W+J[14],Z[15]=J[3]*$+J[7]*Q+J[11]*W+J[15];else X=J[0],K=J[1],G=J[2],z=J[3],F=J[4],H=J[5],V=J[6],q=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]=F,Z[5]=H,Z[6]=V,Z[7]=q,Z[8]=U,Z[9]=w,Z[10]=L,Z[11]=O,Z[12]=X*$+F*Q+U*W+J[12],Z[13]=K*$+H*Q+w*W+J[13],Z[14]=G*$+V*Q+L*W+J[14],Z[15]=z*$+q*Q+O*W+J[15];return Z}function z06(Z,J,Y){var $=Y[0],Q=Y[1],W=Y[2];return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z[3]=J[3]*$,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 F06(Z,J,Y,$){var Q=$[0],W=$[1],X=$[2],K=Math.hypot(Q,W,X),G,z,F,H,V,q,U,w,L,O,N,j,R,D,P,C,T,I,x,S,A,E,v,f;if(K<P0)return null;if(K=1/K,Q*=K,W*=K,X*=K,G=Math.sin(Y),z=Math.cos(Y),F=1-z,H=J[0],V=J[1],q=J[2],U=J[3],w=J[4],L=J[5],O=J[6],N=J[7],j=J[8],R=J[9],D=J[10],P=J[11],C=Q*Q*F+z,T=W*Q*F+X*G,I=X*Q*F-W*G,x=Q*W*F-X*G,S=W*W*F+z,A=X*W*F+Q*G,E=Q*X*F+W*G,v=W*X*F-Q*G,f=X*X*F+z,Z[0]=H*C+w*T+j*I,Z[1]=V*C+L*T+R*I,Z[2]=q*C+O*T+D*I,Z[3]=U*C+N*T+P*I,Z[4]=H*x+w*S+j*A,Z[5]=V*x+L*S+R*A,Z[6]=q*x+O*S+D*A,Z[7]=U*x+N*S+P*A,Z[8]=H*E+w*v+j*f,Z[9]=V*E+L*v+R*f,Z[10]=q*E+O*v+D*f,Z[11]=U*E+N*v+P*f,J!==Z)Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z}function H06(Z,J,Y){var $=Math.sin(Y),Q=Math.cos(Y),W=J[4],X=J[5],K=J[6],G=J[7],z=J[8],F=J[9],H=J[10],V=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*$,Z[5]=X*Q+F*$,Z[6]=K*Q+H*$,Z[7]=G*Q+V*$,Z[8]=z*Q-W*$,Z[9]=F*Q-X*$,Z[10]=H*Q-K*$,Z[11]=V*Q-G*$,Z}function V06(Z,J,Y){var $=Math.sin(Y),Q=Math.cos(Y),W=J[0],X=J[1],K=J[2],G=J[3],z=J[8],F=J[9],H=J[10],V=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*$,Z[1]=X*Q-F*$,Z[2]=K*Q-H*$,Z[3]=G*Q-V*$,Z[8]=W*$+z*Q,Z[9]=X*$+F*Q,Z[10]=K*$+H*Q,Z[11]=G*$+V*Q,Z}function q06(Z,J,Y){var $=Math.sin(Y),Q=Math.cos(Y),W=J[0],X=J[1],K=J[2],G=J[3],z=J[4],F=J[5],H=J[6],V=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*$,Z[1]=X*Q+F*$,Z[2]=K*Q+H*$,Z[3]=G*Q+V*$,Z[4]=z*Q-W*$,Z[5]=F*Q-X*$,Z[6]=H*Q-K*$,Z[7]=V*Q-G*$,Z}function U06(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 L06(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 w06(Z,J,Y){var $=Y[0],Q=Y[1],W=Y[2],X=Math.hypot($,Q,W),K,G,z;if(X<P0)return null;return X=1/X,$*=X,Q*=X,W*=X,K=Math.sin(J),G=Math.cos(J),z=1-G,Z[0]=$*$*z+G,Z[1]=Q*$*z+W*K,Z[2]=W*$*z-Q*K,Z[3]=0,Z[4]=$*Q*z-W*K,Z[5]=Q*Q*z+G,Z[6]=W*Q*z+$*K,Z[7]=0,Z[8]=$*W*z+Q*K,Z[9]=Q*W*z-$*K,Z[10]=W*W*z+G,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function B06(Z,J){var Y=Math.sin(J),$=Math.cos(J);return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=$,Z[6]=Y,Z[7]=0,Z[8]=0,Z[9]=-Y,Z[10]=$,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function O06(Z,J){var Y=Math.sin(J),$=Math.cos(J);return Z[0]=$,Z[1]=0,Z[2]=-Y,Z[3]=0,Z[4]=0,Z[5]=1,Z[6]=0,Z[7]=0,Z[8]=Y,Z[9]=0,Z[10]=$,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function M06(Z,J){var Y=Math.sin(J),$=Math.cos(J);return Z[0]=$,Z[1]=Y,Z[2]=0,Z[3]=0,Z[4]=-Y,Z[5]=$,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 i71(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=$+$,G=Q+Q,z=W+W,F=$*K,H=$*G,V=$*z,q=Q*G,U=Q*z,w=W*z,L=X*K,O=X*G,N=X*z;return Z[0]=1-(q+w),Z[1]=H+N,Z[2]=V-O,Z[3]=0,Z[4]=H-N,Z[5]=1-(F+w),Z[6]=U+L,Z[7]=0,Z[8]=V+O,Z[9]=U-L,Z[10]=1-(F+q),Z[11]=0,Z[12]=Y[0],Z[13]=Y[1],Z[14]=Y[2],Z[15]=1,Z}function N06(Z,J){var Y=new $1(3),$=-J[0],Q=-J[1],W=-J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],H=$*$+Q*Q+W*W+X*X;if(H>0)Y[0]=(K*X+F*$+G*W-z*Q)*2/H,Y[1]=(G*X+F*Q+z*$-K*W)*2/H,Y[2]=(z*X+F*W+K*Q-G*$)*2/H;else Y[0]=(K*X+F*$+G*W-z*Q)*2,Y[1]=(G*X+F*Q+z*$-K*W)*2,Y[2]=(z*X+F*W+K*Q-G*$)*2;return i71(Z,J,Y),Z}function R06(Z,J){return Z[0]=J[12],Z[1]=J[13],Z[2]=J[14],Z}function n71(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[4],X=J[5],K=J[6],G=J[8],z=J[9],F=J[10];return Z[0]=Math.hypot(Y,$,Q),Z[1]=Math.hypot(W,X,K),Z[2]=Math.hypot(G,z,F),Z}function j06(Z,J){var Y=new $1(3);n71(Y,J);var $=1/Y[0],Q=1/Y[1],W=1/Y[2],X=J[0]*$,K=J[1]*Q,G=J[2]*W,z=J[4]*$,F=J[5]*Q,H=J[6]*W,V=J[8]*$,q=J[9]*Q,U=J[10]*W,w=X+F+U,L=0;if(w>0)L=Math.sqrt(w+1)*2,Z[3]=0.25*L,Z[0]=(H-q)/L,Z[1]=(V-G)/L,Z[2]=(K-z)/L;else if(X>F&&X>U)L=Math.sqrt(1+X-F-U)*2,Z[3]=(H-q)/L,Z[0]=0.25*L,Z[1]=(K+z)/L,Z[2]=(V+G)/L;else if(F>U)L=Math.sqrt(1+F-X-U)*2,Z[3]=(V-G)/L,Z[0]=(K+z)/L,Z[1]=0.25*L,Z[2]=(H+q)/L;else L=Math.sqrt(1+U-X-F)*2,Z[3]=(K-z)/L,Z[0]=(V+G)/L,Z[1]=(H+q)/L,Z[2]=0.25*L;return Z}function P06(Z,J,Y,$){var Q=J[0],W=J[1],X=J[2],K=J[3],G=Q+Q,z=W+W,F=X+X,H=Q*G,V=Q*z,q=Q*F,U=W*z,w=W*F,L=X*F,O=K*G,N=K*z,j=K*F,R=$[0],D=$[1],P=$[2];return Z[0]=(1-(U+L))*R,Z[1]=(V+j)*R,Z[2]=(q-N)*R,Z[3]=0,Z[4]=(V-j)*D,Z[5]=(1-(H+L))*D,Z[6]=(w+O)*D,Z[7]=0,Z[8]=(q+N)*P,Z[9]=(w-O)*P,Z[10]=(1-(H+U))*P,Z[11]=0,Z[12]=Y[0],Z[13]=Y[1],Z[14]=Y[2],Z[15]=1,Z}function D06(Z,J,Y,$,Q){var W=J[0],X=J[1],K=J[2],G=J[3],z=W+W,F=X+X,H=K+K,V=W*z,q=W*F,U=W*H,w=X*F,L=X*H,O=K*H,N=G*z,j=G*F,R=G*H,D=$[0],P=$[1],C=$[2],T=Q[0],I=Q[1],x=Q[2],S=(1-(w+O))*D,A=(q+R)*D,E=(U-j)*D,v=(q-R)*P,f=(1-(V+O))*P,p=(L+N)*P,n=(U+j)*C,o=(L-N)*C,Y0=(1-(V+w))*C;return Z[0]=S,Z[1]=A,Z[2]=E,Z[3]=0,Z[4]=v,Z[5]=f,Z[6]=p,Z[7]=0,Z[8]=n,Z[9]=o,Z[10]=Y0,Z[11]=0,Z[12]=Y[0]+T-(S*T+v*I+n*x),Z[13]=Y[1]+I-(A*T+f*I+o*x),Z[14]=Y[2]+x-(E*T+p*I+Y0*x),Z[15]=1,Z}function C06(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=Y+Y,K=$+$,G=Q+Q,z=Y*X,F=$*X,H=$*K,V=Q*X,q=Q*K,U=Q*G,w=W*X,L=W*K,O=W*G;return Z[0]=1-H-U,Z[1]=F+O,Z[2]=V-L,Z[3]=0,Z[4]=F-O,Z[5]=1-z-U,Z[6]=q+w,Z[7]=0,Z[8]=V+L,Z[9]=q-w,Z[10]=1-z-H,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function T06(Z,J,Y,$,Q,W,X){var K=1/(Y-J),G=1/(Q-$),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]=(Y+J)*K,Z[9]=(Q+$)*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 a71(Z,J,Y,$,Q){var W=1/Math.tan(J/2),X;if(Z[0]=W/Y,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/($-Q),Z[10]=(Q+$)*X,Z[14]=2*Q*$*X;else Z[10]=-1,Z[14]=-2*$;return Z}var k06=a71;function E06(Z,J,Y,$,Q){var W=1/Math.tan(J/2),X;if(Z[0]=W/Y,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/($-Q),Z[10]=Q*X,Z[14]=Q*$*X;else Z[10]=-1,Z[14]=-$;return Z}function I06(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-$),Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=$*Y/(Y-$),Z[15]=0,Z}function s71(Z,J,Y,$,Q,W,X){var K=1/(J-Y),G=1/($-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+Y)*K,Z[13]=(Q+$)*G,Z[14]=(X+W)*z,Z[15]=1,Z}var v06=s71;function S06(Z,J,Y,$,Q,W,X){var K=1/(J-Y),G=1/($-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+Y)*K,Z[13]=(Q+$)*G,Z[14]=W*z,Z[15]=1,Z}function _06(Z,J,Y,$){var Q,W,X,K,G,z,F,H,V,q,U=J[0],w=J[1],L=J[2],O=$[0],N=$[1],j=$[2],R=Y[0],D=Y[1],P=Y[2];if(Math.abs(U-R)<P0&&Math.abs(w-D)<P0&&Math.abs(L-P)<P0)return l71(Z);if(F=U-R,H=w-D,V=L-P,q=1/Math.hypot(F,H,V),F*=q,H*=q,V*=q,Q=N*V-j*H,W=j*F-O*V,X=O*H-N*F,q=Math.hypot(Q,W,X),!q)Q=0,W=0,X=0;else q=1/q,Q*=q,W*=q,X*=q;if(K=H*X-V*W,G=V*Q-F*X,z=F*W-H*Q,q=Math.hypot(K,G,z),!q)K=0,G=0,z=0;else q=1/q,K*=q,G*=q,z*=q;return Z[0]=Q,Z[1]=K,Z[2]=F,Z[3]=0,Z[4]=W,Z[5]=G,Z[6]=H,Z[7]=0,Z[8]=X,Z[9]=z,Z[10]=V,Z[11]=0,Z[12]=-(Q*U+W*w+X*L),Z[13]=-(K*U+G*w+z*L),Z[14]=-(F*U+H*w+V*L),Z[15]=1,Z}function A06(Z,J,Y,$){var Q=J[0],W=J[1],X=J[2],K=$[0],G=$[1],z=$[2],F=Q-Y[0],H=W-Y[1],V=X-Y[2],q=F*F+H*H+V*V;if(q>0)q=1/Math.sqrt(q),F*=q,H*=q,V*=q;var U=G*V-z*H,w=z*F-K*V,L=K*H-G*F;if(q=U*U+w*w+L*L,q>0)q=1/Math.sqrt(q),U*=q,w*=q,L*=q;return Z[0]=U,Z[1]=w,Z[2]=L,Z[3]=0,Z[4]=H*L-V*w,Z[5]=V*U-F*L,Z[6]=F*w-H*U,Z[7]=0,Z[8]=F,Z[9]=H,Z[10]=V,Z[11]=0,Z[12]=Q,Z[13]=W,Z[14]=X,Z[15]=1,Z}function x06(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 h06(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 f06(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z[2]=J[2]+Y[2],Z[3]=J[3]+Y[3],Z[4]=J[4]+Y[4],Z[5]=J[5]+Y[5],Z[6]=J[6]+Y[6],Z[7]=J[7]+Y[7],Z[8]=J[8]+Y[8],Z[9]=J[9]+Y[9],Z[10]=J[10]+Y[10],Z[11]=J[11]+Y[11],Z[12]=J[12]+Y[12],Z[13]=J[13]+Y[13],Z[14]=J[14]+Y[14],Z[15]=J[15]+Y[15],Z}function o71(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z[2]=J[2]-Y[2],Z[3]=J[3]-Y[3],Z[4]=J[4]-Y[4],Z[5]=J[5]-Y[5],Z[6]=J[6]-Y[6],Z[7]=J[7]-Y[7],Z[8]=J[8]-Y[8],Z[9]=J[9]-Y[9],Z[10]=J[10]-Y[10],Z[11]=J[11]-Y[11],Z[12]=J[12]-Y[12],Z[13]=J[13]-Y[13],Z[14]=J[14]-Y[14],Z[15]=J[15]-Y[15],Z}function y06(Z,J,Y){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]*Y,Z[5]=J[5]*Y,Z[6]=J[6]*Y,Z[7]=J[7]*Y,Z[8]=J[8]*Y,Z[9]=J[9]*Y,Z[10]=J[10]*Y,Z[11]=J[11]*Y,Z[12]=J[12]*Y,Z[13]=J[13]*Y,Z[14]=J[14]*Y,Z[15]=J[15]*Y,Z}function b06(Z,J,Y,$){return Z[0]=J[0]+Y[0]*$,Z[1]=J[1]+Y[1]*$,Z[2]=J[2]+Y[2]*$,Z[3]=J[3]+Y[3]*$,Z[4]=J[4]+Y[4]*$,Z[5]=J[5]+Y[5]*$,Z[6]=J[6]+Y[6]*$,Z[7]=J[7]+Y[7]*$,Z[8]=J[8]+Y[8]*$,Z[9]=J[9]+Y[9]*$,Z[10]=J[10]+Y[10]*$,Z[11]=J[11]+Y[11]*$,Z[12]=J[12]+Y[12]*$,Z[13]=J[13]+Y[13]*$,Z[14]=J[14]+Y[14]*$,Z[15]=J[15]+Y[15]*$,Z}function g06(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 m06(Z,J){var Y=Z[0],$=Z[1],Q=Z[2],W=Z[3],X=Z[4],K=Z[5],G=Z[6],z=Z[7],F=Z[8],H=Z[9],V=Z[10],q=Z[11],U=Z[12],w=Z[13],L=Z[14],O=Z[15],N=J[0],j=J[1],R=J[2],D=J[3],P=J[4],C=J[5],T=J[6],I=J[7],x=J[8],S=J[9],A=J[10],E=J[11],v=J[12],f=J[13],p=J[14],n=J[15];return Math.abs(Y-N)<=P0*Math.max(1,Math.abs(Y),Math.abs(N))&&Math.abs($-j)<=P0*Math.max(1,Math.abs($),Math.abs(j))&&Math.abs(Q-R)<=P0*Math.max(1,Math.abs(Q),Math.abs(R))&&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-I)<=P0*Math.max(1,Math.abs(z),Math.abs(I))&&Math.abs(F-x)<=P0*Math.max(1,Math.abs(F),Math.abs(x))&&Math.abs(H-S)<=P0*Math.max(1,Math.abs(H),Math.abs(S))&&Math.abs(V-A)<=P0*Math.max(1,Math.abs(V),Math.abs(A))&&Math.abs(q-E)<=P0*Math.max(1,Math.abs(q),Math.abs(E))&&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 d06=p71,u06=o71;var R1={};b9(R1,{str:()=>b16,squaredLength:()=>CZ1,sqrLen:()=>n16,sqlerp:()=>r16,slerp:()=>LM,setAxisAngle:()=>BZ1,setAxes:()=>t16,set:()=>u16,scale:()=>jZ1,rotationTo:()=>o16,rotateZ:()=>S16,rotateY:()=>v16,rotateX:()=>I16,random:()=>x16,pow:()=>A16,normalize:()=>Dh,multiply:()=>OZ1,mul:()=>l16,ln:()=>NZ1,lerp:()=>p16,length:()=>DZ1,len:()=>i16,invert:()=>h16,identity:()=>T16,getAxisAngle:()=>k16,getAngle:()=>E16,fromValues:()=>m16,fromMat3:()=>RZ1,fromEuler:()=>y16,exp:()=>MZ1,exactEquals:()=>a16,equals:()=>s16,dot:()=>PZ1,create:()=>Ph,copy:()=>d16,conjugate:()=>f16,clone:()=>g16,calculateW:()=>_16,add:()=>c16});var t0={};b9(t0,{zero:()=>q16,transformQuat:()=>G16,transformMat4:()=>X16,transformMat3:()=>K16,subtract:()=>t71,sub:()=>B16,str:()=>U16,squaredLength:()=>$Z1,squaredDistance:()=>YZ1,sqrLen:()=>j16,sqrDist:()=>R16,set:()=>p06,scaleAndAdd:()=>e06,scale:()=>t06,round:()=>r06,rotateZ:()=>H16,rotateY:()=>F16,rotateX:()=>z16,random:()=>W16,normalize:()=>Rh,negate:()=>Z16,multiply:()=>e71,mul:()=>O16,min:()=>s06,max:()=>o06,lerp:()=>Y16,length:()=>r71,len:()=>jh,inverse:()=>J16,hermite:()=>$16,fromValues:()=>qM,forEach:()=>P16,floor:()=>a06,exactEquals:()=>L16,equals:()=>w16,dot:()=>UM,divide:()=>ZZ1,div:()=>M16,distance:()=>JZ1,dist:()=>N16,cross:()=>aH,create:()=>VM,copy:()=>l06,clone:()=>c06,ceil:()=>n06,bezier:()=>Q16,angle:()=>V16,add:()=>i06});function VM(){var Z=new $1(3);if($1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function c06(Z){var J=new $1(3);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J}function r71(Z){var J=Z[0],Y=Z[1],$=Z[2];return Math.hypot(J,Y,$)}function qM(Z,J,Y){var $=new $1(3);return $[0]=Z,$[1]=J,$[2]=Y,$}function l06(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z}function p06(Z,J,Y,$){return Z[0]=J,Z[1]=Y,Z[2]=$,Z}function i06(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z[2]=J[2]+Y[2],Z}function t71(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z[2]=J[2]-Y[2],Z}function e71(Z,J,Y){return Z[0]=J[0]*Y[0],Z[1]=J[1]*Y[1],Z[2]=J[2]*Y[2],Z}function ZZ1(Z,J,Y){return Z[0]=J[0]/Y[0],Z[1]=J[1]/Y[1],Z[2]=J[2]/Y[2],Z}function n06(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z[2]=Math.ceil(J[2]),Z}function a06(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z[2]=Math.floor(J[2]),Z}function s06(Z,J,Y){return Z[0]=Math.min(J[0],Y[0]),Z[1]=Math.min(J[1],Y[1]),Z[2]=Math.min(J[2],Y[2]),Z}function o06(Z,J,Y){return Z[0]=Math.max(J[0],Y[0]),Z[1]=Math.max(J[1],Y[1]),Z[2]=Math.max(J[2],Y[2]),Z}function r06(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z[2]=Math.round(J[2]),Z}function t06(Z,J,Y){return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z[2]=J[2]*Y,Z}function e06(Z,J,Y,$){return Z[0]=J[0]+Y[0]*$,Z[1]=J[1]+Y[1]*$,Z[2]=J[2]+Y[2]*$,Z}function JZ1(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1],Q=J[2]-Z[2];return Math.hypot(Y,$,Q)}function YZ1(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1],Q=J[2]-Z[2];return Y*Y+$*$+Q*Q}function $Z1(Z){var J=Z[0],Y=Z[1],$=Z[2];return J*J+Y*Y+$*$}function Z16(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z}function J16(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z[2]=1/J[2],Z}function Rh(Z,J){var Y=J[0],$=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 UM(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]}function aH(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=Y[0],K=Y[1],G=Y[2];return Z[0]=Q*G-W*K,Z[1]=W*X-$*G,Z[2]=$*K-Q*X,Z}function Y16(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 $16(Z,J,Y,$,Q,W){var X=W*W,K=X*(2*W-3)+1,G=X*(W-2)+W,z=X*(W-1),F=X*(3-2*W);return Z[0]=J[0]*K+Y[0]*G+$[0]*z+Q[0]*F,Z[1]=J[1]*K+Y[1]*G+$[1]*z+Q[1]*F,Z[2]=J[2]*K+Y[2]*G+$[2]*z+Q[2]*F,Z}function Q16(Z,J,Y,$,Q,W){var X=1-W,K=X*X,G=W*W,z=K*X,F=3*W*K,H=3*G*X,V=G*W;return Z[0]=J[0]*z+Y[0]*F+$[0]*H+Q[0]*V,Z[1]=J[1]*z+Y[1]*F+$[1]*H+Q[1]*V,Z[2]=J[2]*z+Y[2]*F+$[2]*H+Q[2]*V,Z}function W16(Z,J){J=J||1;var Y=M7()*2*Math.PI,$=M7()*2-1,Q=Math.sqrt(1-$*$)*J;return Z[0]=Math.cos(Y)*Q,Z[1]=Math.sin(Y)*Q,Z[2]=$*J,Z}function X16(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=Y[3]*$+Y[7]*Q+Y[11]*W+Y[15];return X=X||1,Z[0]=(Y[0]*$+Y[4]*Q+Y[8]*W+Y[12])/X,Z[1]=(Y[1]*$+Y[5]*Q+Y[9]*W+Y[13])/X,Z[2]=(Y[2]*$+Y[6]*Q+Y[10]*W+Y[14])/X,Z}function K16(Z,J,Y){var $=J[0],Q=J[1],W=J[2];return Z[0]=$*Y[0]+Q*Y[3]+W*Y[6],Z[1]=$*Y[1]+Q*Y[4]+W*Y[7],Z[2]=$*Y[2]+Q*Y[5]+W*Y[8],Z}function G16(Z,J,Y){var $=Y[0],Q=Y[1],W=Y[2],X=Y[3],K=J[0],G=J[1],z=J[2],F=Q*z-W*G,H=W*K-$*z,V=$*G-Q*K,q=Q*V-W*H,U=W*F-$*V,w=$*H-Q*F,L=X*2;return F*=L,H*=L,V*=L,q*=2,U*=2,w*=2,Z[0]=K+F+q,Z[1]=G+H+U,Z[2]=z+V+w,Z}function z16(Z,J,Y,$){var Q=[],W=[];return Q[0]=J[0]-Y[0],Q[1]=J[1]-Y[1],Q[2]=J[2]-Y[2],W[0]=Q[0],W[1]=Q[1]*Math.cos($)-Q[2]*Math.sin($),W[2]=Q[1]*Math.sin($)+Q[2]*Math.cos($),Z[0]=W[0]+Y[0],Z[1]=W[1]+Y[1],Z[2]=W[2]+Y[2],Z}function F16(Z,J,Y,$){var Q=[],W=[];return Q[0]=J[0]-Y[0],Q[1]=J[1]-Y[1],Q[2]=J[2]-Y[2],W[0]=Q[2]*Math.sin($)+Q[0]*Math.cos($),W[1]=Q[1],W[2]=Q[2]*Math.cos($)-Q[0]*Math.sin($),Z[0]=W[0]+Y[0],Z[1]=W[1]+Y[1],Z[2]=W[2]+Y[2],Z}function H16(Z,J,Y,$){var Q=[],W=[];return Q[0]=J[0]-Y[0],Q[1]=J[1]-Y[1],Q[2]=J[2]-Y[2],W[0]=Q[0]*Math.cos($)-Q[1]*Math.sin($),W[1]=Q[0]*Math.sin($)+Q[1]*Math.cos($),W[2]=Q[2],Z[0]=W[0]+Y[0],Z[1]=W[1]+Y[1],Z[2]=W[2]+Y[2],Z}function V16(Z,J){var Y=Z[0],$=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),F=G*z,H=F&&UM(Z,J)/F;return Math.acos(Math.min(Math.max(H,-1),1))}function q16(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z}function U16(Z){return"vec3("+Z[0]+", "+Z[1]+", "+Z[2]+")"}function L16(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]}function w16(Z,J){var Y=Z[0],$=Z[1],Q=Z[2],W=J[0],X=J[1],K=J[2];return Math.abs(Y-W)<=P0*Math.max(1,Math.abs(Y),Math.abs(W))&&Math.abs($-X)<=P0*Math.max(1,Math.abs($),Math.abs(X))&&Math.abs(Q-K)<=P0*Math.max(1,Math.abs(Q),Math.abs(K))}var B16=t71,O16=e71,M16=ZZ1,N16=JZ1,R16=YZ1,jh=r71,j16=$Z1,P16=function(){var Z=VM();return function(J,Y,$,Q,W,X){var K,G;if(!Y)Y=3;if(!$)$=0;if(Q)G=Math.min(Q*Y+$,J.length);else G=J.length;for(K=$;K<G;K+=Y)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 D16(){var Z=new $1(4);if($1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function QZ1(Z){var J=new $1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function WZ1(Z,J,Y,$){var Q=new $1(4);return Q[0]=Z,Q[1]=J,Q[2]=Y,Q[3]=$,Q}function XZ1(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function KZ1(Z,J,Y,$,Q){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=Q,Z}function GZ1(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z[2]=J[2]+Y[2],Z[3]=J[3]+Y[3],Z}function zZ1(Z,J,Y){return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z[2]=J[2]*Y,Z[3]=J[3]*Y,Z}function FZ1(Z){var J=Z[0],Y=Z[1],$=Z[2],Q=Z[3];return Math.hypot(J,Y,$,Q)}function HZ1(Z){var J=Z[0],Y=Z[1],$=Z[2],Q=Z[3];return J*J+Y*Y+$*$+Q*Q}function VZ1(Z,J){var Y=J[0],$=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]=Y*X,Z[1]=$*X,Z[2]=Q*X,Z[3]=W*X,Z}function qZ1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}function UZ1(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 LZ1(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function wZ1(Z,J){var Y=Z[0],$=Z[1],Q=Z[2],W=Z[3],X=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(Y-X)<=P0*Math.max(1,Math.abs(Y),Math.abs(X))&&Math.abs($-K)<=P0*Math.max(1,Math.abs($),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 Hi6=function(){var Z=D16();return function(J,Y,$,Q,W,X){var K,G;if(!Y)Y=4;if(!$)$=0;if(Q)G=Math.min(Q*Y+$,J.length);else G=J.length;for(K=$;K<G;K+=Y)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 Ph(){var Z=new $1(4);if($1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z[3]=1,Z}function T16(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=1,Z}function BZ1(Z,J,Y){Y=Y*0.5;var $=Math.sin(Y);return Z[0]=$*J[0],Z[1]=$*J[1],Z[2]=$*J[2],Z[3]=Math.cos(Y),Z}function k16(Z,J){var Y=Math.acos(J[3])*2,$=Math.sin(Y/2);if($>P0)Z[0]=J[0]/$,Z[1]=J[1]/$,Z[2]=J[2]/$;else Z[0]=1,Z[1]=0,Z[2]=0;return Y}function E16(Z,J){var Y=PZ1(Z,J);return Math.acos(2*Y*Y-1)}function OZ1(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=Y[0],G=Y[1],z=Y[2],F=Y[3];return Z[0]=$*F+X*K+Q*z-W*G,Z[1]=Q*F+X*G+W*K-$*z,Z[2]=W*F+X*z+$*G-Q*K,Z[3]=X*F-$*K-Q*G-W*z,Z}function I16(Z,J,Y){Y*=0.5;var $=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G+X*K,Z[1]=Q*G+W*K,Z[2]=W*G-Q*K,Z[3]=X*G-$*K,Z}function v16(Z,J,Y){Y*=0.5;var $=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G-W*K,Z[1]=Q*G+X*K,Z[2]=W*G+$*K,Z[3]=X*G-Q*K,Z}function S16(Z,J,Y){Y*=0.5;var $=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G+Q*K,Z[1]=Q*G-$*K,Z[2]=W*G+X*K,Z[3]=X*G-W*K,Z}function _16(Z,J){var Y=J[0],$=J[1],Q=J[2];return Z[0]=Y,Z[1]=$,Z[2]=Q,Z[3]=Math.sqrt(Math.abs(1-Y*Y-$*$-Q*Q)),Z}function MZ1(Z,J){var Y=J[0],$=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]=Y*G,Z[1]=$*G,Z[2]=Q*G,Z[3]=K*Math.cos(X),Z}function NZ1(Z,J){var Y=J[0],$=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]=Y*K,Z[1]=$*K,Z[2]=Q*K,Z[3]=0.5*Math.log(Y*Y+$*$+Q*Q+W*W),Z}function A16(Z,J,Y){return NZ1(Z,J),jZ1(Z,Z,Y),MZ1(Z,Z),Z}function LM(Z,J,Y,$){var Q=J[0],W=J[1],X=J[2],K=J[3],G=Y[0],z=Y[1],F=Y[2],H=Y[3],V,q,U,w,L;if(q=Q*G+W*z+X*F+K*H,q<0)q=-q,G=-G,z=-z,F=-F,H=-H;if(1-q>P0)V=Math.acos(q),U=Math.sin(V),w=Math.sin((1-$)*V)/U,L=Math.sin($*V)/U;else w=1-$,L=$;return Z[0]=w*Q+L*G,Z[1]=w*W+L*z,Z[2]=w*X+L*F,Z[3]=w*K+L*H,Z}function x16(Z){var J=M7(),Y=M7(),$=M7(),Q=Math.sqrt(1-J),W=Math.sqrt(J);return Z[0]=Q*Math.sin(2*Math.PI*Y),Z[1]=Q*Math.cos(2*Math.PI*Y),Z[2]=W*Math.sin(2*Math.PI*$),Z[3]=W*Math.cos(2*Math.PI*$),Z}function h16(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=Y*Y+$*$+Q*Q+W*W,K=X?1/X:0;return Z[0]=-Y*K,Z[1]=-$*K,Z[2]=-Q*K,Z[3]=W*K,Z}function f16(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z[3]=J[3],Z}function RZ1(Z,J){var Y=J[0]+J[4]+J[8],$;if(Y>0)$=Math.sqrt(Y+1),Z[3]=0.5*$,$=0.5/$,Z[0]=(J[5]-J[7])*$,Z[1]=(J[6]-J[2])*$,Z[2]=(J[1]-J[3])*$;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;$=Math.sqrt(J[Q*3+Q]-J[W*3+W]-J[X*3+X]+1),Z[Q]=0.5*$,$=0.5/$,Z[3]=(J[W*3+X]-J[X*3+W])*$,Z[W]=(J[W*3+Q]+J[Q*3+W])*$,Z[X]=(J[X*3+Q]+J[Q*3+X])*$}return Z}function y16(Z,J,Y,$){var Q=0.5*Math.PI/180;J*=Q,Y*=Q,$*=Q;var W=Math.sin(J),X=Math.cos(J),K=Math.sin(Y),G=Math.cos(Y),z=Math.sin($),F=Math.cos($);return Z[0]=W*G*F-X*K*z,Z[1]=X*K*F+W*G*z,Z[2]=X*G*z-W*K*F,Z[3]=X*G*F+W*K*z,Z}function b16(Z){return"quat("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}var g16=QZ1,m16=WZ1,d16=XZ1,u16=KZ1,c16=GZ1,l16=OZ1,jZ1=zZ1,PZ1=qZ1,p16=UZ1,DZ1=FZ1,i16=DZ1,CZ1=HZ1,n16=CZ1,Dh=VZ1,a16=LZ1,s16=wZ1,o16=function(){var Z=VM(),J=qM(1,0,0),Y=qM(0,1,0);return function($,Q,W){var X=UM(Q,W);if(X<-0.999999){if(aH(Z,J,Q),jh(Z)<0.000001)aH(Z,Y,Q);return Rh(Z,Z),BZ1($,Z,Math.PI),$}else if(X>0.999999)return $[0]=0,$[1]=0,$[2]=0,$[3]=1,$;else return aH(Z,Q,W),$[0]=Z[0],$[1]=Z[1],$[2]=Z[2],$[3]=1+X,Dh($,$)}}(),r16=function(){var Z=Ph(),J=Ph();return function(Y,$,Q,W,X,K){return LM(Z,$,X,K),LM(J,Q,W,K),LM(Y,Z,J,2*K*(1-K)),Y}}(),t16=function(){var Z=Nh();return function(J,Y,$,Q){return Z[0]=$[0],Z[3]=$[1],Z[6]=$[2],Z[1]=Q[0],Z[4]=Q[1],Z[7]=Q[2],Z[2]=-Y[0],Z[5]=-Y[1],Z[8]=-Y[2],Dh(J,RZ1(J,Z))}}();var X1={};b9(X1,{zero:()=>D86,transformMat4:()=>R86,transformMat3:()=>N86,transformMat2d:()=>M86,transformMat2:()=>O86,subtract:()=>kZ1,sub:()=>I86,str:()=>C86,squaredLength:()=>AZ1,squaredDistance:()=>SZ1,sqrLen:()=>x86,sqrDist:()=>A86,set:()=>Y86,scaleAndAdd:()=>F86,scale:()=>z86,round:()=>G86,rotate:()=>j86,random:()=>B86,normalize:()=>q86,negate:()=>H86,multiply:()=>EZ1,mul:()=>v86,min:()=>X86,max:()=>K86,lerp:()=>w86,length:()=>_Z1,len:()=>E86,inverse:()=>V86,fromValues:()=>Z86,forEach:()=>h86,floor:()=>W86,exactEquals:()=>T86,equals:()=>k86,dot:()=>U86,divide:()=>IZ1,div:()=>S86,distance:()=>vZ1,dist:()=>_86,cross:()=>L86,create:()=>TZ1,copy:()=>J86,clone:()=>e16,ceil:()=>Q86,angle:()=>P86,add:()=>$86});function TZ1(){var Z=new $1(2);if($1!=Float32Array)Z[0]=0,Z[1]=0;return Z}function e16(Z){var J=new $1(2);return J[0]=Z[0],J[1]=Z[1],J}function Z86(Z,J){var Y=new $1(2);return Y[0]=Z,Y[1]=J,Y}function J86(Z,J){return Z[0]=J[0],Z[1]=J[1],Z}function Y86(Z,J,Y){return Z[0]=J,Z[1]=Y,Z}function $86(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z}function kZ1(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z}function EZ1(Z,J,Y){return Z[0]=J[0]*Y[0],Z[1]=J[1]*Y[1],Z}function IZ1(Z,J,Y){return Z[0]=J[0]/Y[0],Z[1]=J[1]/Y[1],Z}function Q86(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z}function W86(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z}function X86(Z,J,Y){return Z[0]=Math.min(J[0],Y[0]),Z[1]=Math.min(J[1],Y[1]),Z}function K86(Z,J,Y){return Z[0]=Math.max(J[0],Y[0]),Z[1]=Math.max(J[1],Y[1]),Z}function G86(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z}function z86(Z,J,Y){return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z}function F86(Z,J,Y,$){return Z[0]=J[0]+Y[0]*$,Z[1]=J[1]+Y[1]*$,Z}function vZ1(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1];return Math.hypot(Y,$)}function SZ1(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1];return Y*Y+$*$}function _Z1(Z){var J=Z[0],Y=Z[1];return Math.hypot(J,Y)}function AZ1(Z){var J=Z[0],Y=Z[1];return J*J+Y*Y}function H86(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z}function V86(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z}function q86(Z,J){var Y=J[0],$=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 U86(Z,J){return Z[0]*J[0]+Z[1]*J[1]}function L86(Z,J,Y){var $=J[0]*Y[1]-J[1]*Y[0];return Z[0]=Z[1]=0,Z[2]=$,Z}function w86(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 B86(Z,J){J=J||1;var Y=M7()*2*Math.PI;return Z[0]=Math.cos(Y)*J,Z[1]=Math.sin(Y)*J,Z}function O86(Z,J,Y){var $=J[0],Q=J[1];return Z[0]=Y[0]*$+Y[2]*Q,Z[1]=Y[1]*$+Y[3]*Q,Z}function M86(Z,J,Y){var $=J[0],Q=J[1];return Z[0]=Y[0]*$+Y[2]*Q+Y[4],Z[1]=Y[1]*$+Y[3]*Q+Y[5],Z}function N86(Z,J,Y){var $=J[0],Q=J[1];return Z[0]=Y[0]*$+Y[3]*Q+Y[6],Z[1]=Y[1]*$+Y[4]*Q+Y[7],Z}function R86(Z,J,Y){var $=J[0],Q=J[1];return Z[0]=Y[0]*$+Y[4]*Q+Y[12],Z[1]=Y[1]*$+Y[5]*Q+Y[13],Z}function j86(Z,J,Y,$){var Q=J[0]-Y[0],W=J[1]-Y[1],X=Math.sin($),K=Math.cos($);return Z[0]=Q*K-W*X+Y[0],Z[1]=Q*X+W*K+Y[1],Z}function P86(Z,J){var Y=Z[0],$=Z[1],Q=J[0],W=J[1],X=Math.sqrt(Y*Y+$*$)*Math.sqrt(Q*Q+W*W),K=X&&(Y*Q+$*W)/X;return Math.acos(Math.min(Math.max(K,-1),1))}function D86(Z){return Z[0]=0,Z[1]=0,Z}function C86(Z){return"vec2("+Z[0]+", "+Z[1]+")"}function T86(Z,J){return Z[0]===J[0]&&Z[1]===J[1]}function k86(Z,J){var Y=Z[0],$=Z[1],Q=J[0],W=J[1];return Math.abs(Y-Q)<=P0*Math.max(1,Math.abs(Y),Math.abs(Q))&&Math.abs($-W)<=P0*Math.max(1,Math.abs($),Math.abs(W))}var E86=_Z1,I86=kZ1,v86=EZ1,S86=IZ1,_86=vZ1,A86=SZ1,x86=AZ1,h86=function(){var Z=TZ1();return function(J,Y,$,Q,W,X){var K,G;if(!Y)Y=2;if(!$)$=0;if(Q)G=Math.min(Q*Y+$,J.length);else G=J.length;for(K=$;K<G;K+=Y)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 hQ extends Float32Array{constructor(Z,J,Y,$){super([Z,J,Y,$])}get determinant(){return y8.determinant(this)}get frobeniusNorm(){return y8.frob(this)}static create(){let Z=new hQ(0,0,0,0);return y8.identity(Z),Z}static fromRotation(Z){let J=hQ.create();return y8.fromRotation(J,Z),J}static fromScaling(Z){let J=hQ.create();return y8.fromScaling(J,Z),J}add(Z){return y8.add(this,this,Z),this}adjoint(){return y8.adjoint(this,this),this}clone(){return new hQ(this[0],this[1],this[2],this[3])}copy(Z){return y8.copy(this,Z),this}equals(Z){return y8.equals(this,Z)}exactEquals(Z){return y8.exactEquals(this,Z)}identity(){return y8.identity(this),this}invert(){return y8.invert(this,this),this}multiply(Z){return y8.mul(this,this,Z),this}multiplyScalar(Z){return y8.multiplyScalar(this,this,Z),this}rotate(Z){return y8.rotate(this,this,Z),this}subtract(Z){return y8.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]}][${this[2]},${this[3]}]`}transpose(){return y8.transpose(this,this),this}}class N7 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 N7(0,0,0,0,0,0,0,0,0);return l1.identity(Z),Z}static fromMatrix4(Z){let J=N7.create();return l1.fromMat4(J,Z),J}static fromQuaternion(Z){let J=N7.create();return l1.fromQuat(J,Z),J}static fromRotation(Z){let J=N7.create();return l1.fromRotation(J,Z),J}static fromScaling(Z){let J=N7.create();return l1.fromScaling(J,Z),J}static fromTranslation(Z){let J=N7.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 N7(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 Y5 extends Float32Array{constructor(Z,J,Y,$,Q,W,X,K,G,z,F,H,V,q,U,w){super([Z,J,Y,$,Q,W,X,K,G,z,F,H,V,q,U,w])}get determinant(){return o0.determinant(this)}get frobeniusNorm(){return o0.frob(this)}static create(){let Z=new Y5(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=Y5.create();return o0.fromQuat(J,Z),J}static fromRotation(Z,J){let Y=Y5.create();return o0.fromRotation(Y,Z,J),Y}static fromRotationTranslation(Z,J){let Y=Y5.create();return o0.fromRotationTranslation(Y,Z,J),Y}static fromRotationTranslationScale(Z,J,Y){let $=Y5.create();return o0.fromRotationTranslationScale($,Z,J,Y),$}static fromRotationTranslationScaleOrigin(Z,J,Y,$){let Q=Y5.create();return o0.fromRotationTranslationScaleOrigin(Q,Z,J,Y,$),Q}static fromScaling(Z){let J=Y5.create();return o0.fromScaling(J,Z),J}static fromTranslation(Z){let J=Y5.create();return o0.fromTranslation(J,Z),J}static fromXRotation(Z){let J=Y5.create();return o0.fromXRotation(J,Z),J}static fromYRotation(Z){let J=Y5.create();return o0.fromYRotation(J,Z),J}static fromZRotation(Z){let J=Y5.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 Y5(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,Y){return o0.lookAt(this,Z,J,Y),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,Y){return o0.targetTo(this,Z,J,Y),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 bK 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,Y){let $=R1.fromEuler(new Float32Array(4),Z,J,Y);return new bK($[0],$[1],$[2],$[3])}static fromQuaternionLike(Z){return new bK(Z.x,Z.y,Z.z,Z.w)}clone(){return new bK(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 sH 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 sH(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 sH(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 gK extends Float32Array{constructor(Z,J,Y){super([Z,J,Y])}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 gK(0,0,0)}static fromVector3Like(Z){return new gK(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 gK(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 j1=function(Z,J,Y,$){function Q(W){return W instanceof Y?W:new Y(function(X){X(W)})}return new(Y||(Y=Promise))(function(W,X){function K(F){try{z($.next(F))}catch(H){X(H)}}function G(F){try{z($.throw(F))}catch(H){X(H)}}function z(F){F.done?W(F.value):Q(F.value).then(K,G)}z(($=$.apply(Z,J||[])).next())})},M1=function(Z,J){var Y={label:0,sent:function(){if(W[0]&1)throw W[1];return W[1]},trys:[],ops:[]},$,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(F){return G([z,F])}}function G(z){if($)throw new TypeError("Generator is already executing.");while(X&&(X=0,z[0]&&(Y=0)),Y)try{if($=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 Y.label++,{value:z[1],done:!1};case 5:Y.label++,Q=z[1],z=[0];continue;case 7:z=Y.ops.pop(),Y.trys.pop();continue;default:if((W=Y.trys,!(W=W.length>0&&W[W.length-1]))&&(z[0]===6||z[0]===2)){Y=0;continue}if(z[0]===3&&(!W||z[1]>W[0]&&z[1]<W[3])){Y.label=z[1];break}if(z[0]===6&&Y.label<W[1]){Y.label=W[1],W=z;break}if(W&&Y.label<W[2]){Y.label=W[2],Y.ops.push(z);break}if(W[2])Y.ops.pop();Y.trys.pop();continue}z=J.call(Z,Y)}catch(F){z=[6,F],Q=0}finally{$=W=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},I5=function(Z,J){var Y=typeof Symbol==="function"&&Z[Symbol.iterator];if(!Y)return Z;var $=Y.call(Z),Q,W=[],X;try{while((J===void 0||J-- >0)&&!(Q=$.next()).done)W.push(Q.value)}catch(K){X={error:K}}finally{try{if(Q&&!Q.done&&(Y=$.return))Y.call($)}finally{if(X)throw X.error}}return W},f9=function(Z,J,Y){if(Y||arguments.length===2){for(var $=0,Q=J.length,W;$<Q;$++)if(W||!($ in J)){if(!W)W=Array.prototype.slice.call(J,0,$);W[$]=J[$]}}return Z.concat(W||Array.prototype.slice.call(J))},xZ1=function(Z){var J=typeof Symbol==="function"&&Symbol.iterator,Y=J&&Z[J],$=0;if(Y)return Y.call(Z);if(Z&&typeof Z.length==="number")return{next:function(){if(Z&&$>=Z.length)Z=void 0;return{value:Z&&Z[$++],done:!Z}}};throw new TypeError(J?"Object is not iterable.":"Symbol.iterator is not defined.")},Oi6=function(){function Z(J){if(J===void 0)J=Z.minComparator;var Y=this;this.compare=J,this.heapArray=[],this._limit=0,this.offer=this.add,this.element=this.peek,this.poll=this.pop,this._invertedCompare=function($,Q){return Y.compare($,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 Y=J%2?1:2;return Math.floor((J-Y)/2)},Z.getSiblingIndexOf=function(J){if(J<=0)return-1;var Y=J%2?1:-1;return J+Y},Z.minComparator=function(J,Y){return j1(this,void 0,void 0,function(){return M1(this,function($){if(J>Y)return[2,1];else if(J<Y)return[2,-1];else return[2,0]})})},Z.maxComparator=function(J,Y){return j1(this,void 0,void 0,function(){return M1(this,function($){if(Y>J)return[2,1];else if(Y<J)return[2,-1];else return[2,0]})})},Z.minComparatorNumber=function(J,Y){return j1(this,void 0,void 0,function(){return M1(this,function($){return[2,J-Y]})})},Z.maxComparatorNumber=function(J,Y){return j1(this,void 0,void 0,function(){return M1(this,function($){return[2,Y-J]})})},Z.defaultIsEqual=function(J,Y){return j1(this,void 0,void 0,function(){return M1(this,function($){return[2,J===Y]})})},Z.print=function(J){function Y(F){var H=Z.getParentIndexOf(F);return Math.floor(Math.log2(H+1))}function $(F,H){var V="";for(;H>0;--H)V+=F;return V}var Q=0,W=[],X=Y(J.length-1)+2,K=0;while(Q<J.length){var G=Y(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(F,H){var V=Math.pow(2,X-H)-1;return $(" ",Math.floor(V/2)*K)+F.map(function(q){var U=(K-q.length)/2;return $(" ",Math.ceil(U))+q+$(" ",Math.floor(U))}).join($(" ",V*K))}).join(`
436
+ `);let{connect:G,buffered:z}=await K;if(Z.emit("proxyConnect",G),this.emit("proxyConnect",G,Z),G.statusCode===200){if(Z.once("socket",er8),J.secureEndpoint){SH("Upgrading socket connection to TLS");let H=J.servername||J.host;return ex.connect({...U71(J,"host","path","port"),socket:$,servername:jZ.isIP(H)?void 0:H})}return $}$.destroy();let F=new jZ.Socket({writable:!1});return F.readable=!0,Z.once("socket",(H)=>{SH("Replaying proxy buffer for failed request"),H.push(z),H.push(null)}),F}}XM.__initStatic();function er8(Z){Z.resume()}function U71(Z,...J){let Y={},$;for($ in Z)if(!J.includes($))Y[$]=Z[$];return Y}var Qt8=32768;function Wt8(Z){return new Yt8({read(){this.push(Z),this.push(null)}})}function Zh(Z){let J;try{J=new URL(Z.url)}catch(G){return T8(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),RJ(Z,()=>Promise.resolve({}))}let Y=J.protocol==="https:",$=Xt8(J,Z.proxy||(Y?process.env.https_proxy:void 0)||process.env.http_proxy),Q=Y?Jt8:Zt8,W=Z.keepAlive===void 0?!1:Z.keepAlive,X=$?new XM($):new Q.Agent({keepAlive:W,maxSockets:30,timeout:2000}),K=Kt8(Z,Z.httpModule??Q,X);return RJ(Z,K)}function Xt8(Z,J){let{no_proxy:Y}=process.env;if(Y?.split(",").some((Q)=>Z.host.endsWith(Q)||Z.hostname.endsWith(Q)))return;else return J}function Kt8(Z,J,Y){let{hostname:$,pathname:Q,port:W,protocol:X,search:K}=new URL(Z.url);return function G(z){return new Promise((F,H)=>{x$(()=>{let V=Wt8(z.body),q={...Z.headers};if(z.body.length>Qt8)q["content-encoding"]="gzip",V=V.pipe($t8());let U=J.request({method:"POST",agent:Y,headers:q,hostname:$,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;F({statusCode:w.statusCode,headers:{"retry-after":L,"x-sentry-rate-limits":Array.isArray(O)?O[0]||null:O}})});U.on("error",H),V.pipe(U)})})}}var Gt8=new Set(["false","f","n","no","off","0"]),zt8=new Set(["true","t","y","yes","on","1"]);function KM(Z,J){let Y=String(Z).toLowerCase();if(Gt8.has(Y))return!1;if(zt8.has(Y))return!0;return J?.strict?null:Boolean(Z)}import{posix as Ft8,sep as Ht8}from"path";function L71(Z){return Z.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function Jh(Z=process.argv[1]?BI(process.argv[1]):process.cwd(),J=Ht8==="\\"){let Y=J?L71(Z):Z;return($)=>{if(!$)return;let Q=J?L71($):$,{dir:W,base:X,ext:K}=Ft8.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(Y)){let F=W.slice(Y.length+1).replace(/\//g,".");return F?`${F}:${G}`:G}return G}}function Yh(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,Y=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,$=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 $h=Bw(NI(Jh()));var B71=t(Z0(),1);import*as w71 from"os";import{threadId as Vt8,isMainThread as qt8}from"worker_threads";var Ut8=60000;class GM extends vw{constructor(Z){let J=Z.serverName||global.process.env.SENTRY_NAME||w71.hostname(),Y={...Z,platform:"node",runtime:{name:"node",version:global.process.version},serverName:J};if(Z.openTelemetryInstrumentations)rX({instrumentations:Z.openTelemetryInstrumentations});tz(Y,"node"),l.log(`Initializing Sentry: process: ${process.pid}, thread: ${qt8?"main":`worker-${Vt8}`}.`);super(Y);if(this.getOptions()._experiments?.enableLogs){if(this._logOnExitFlushListener=()=>{f$(this)},J)this.on("beforeCaptureLog",($)=>{$.attributes={...$.attributes,"server.address":J}});process.on("beforeExit",this._logOnExitFlushListener)}}get tracer(){if(this._tracer)return this._tracer;let Z="@sentry/node",J=C8,Y=B71.trace.getTracer(Z,J);return this._tracer=Y,Y}async flush(Z){let Y=this.traceProvider?.activeSpanProcessor;if(Y)await Y.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??Ut8).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener)}_getTraceInfoFromScope(Z){if(!Z)return[void 0,void 0];return Tr0(this,Z)}}var M4=t(Z0(),1);var AK=t(x1(),1);var O71=t(yB(),1);import Lt8 from"module";var Qh=1e6;function Wh(Z,J={}){if(Z.getOptions().debug)Ot8();let Y=wt8(Z,J);Z.traceProvider=Y}function M71(){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:Y}=O71.createAddHookMessageChannel();Lt8.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:Y,include:[]},transferList:[Y]})}catch(Y){l.warn("Failed to register ESM hook",Y)}}else T8(()=>{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 wt8(Z,J={}){let Y=new y_({sampler:new $A(Z),resource:new KK({[AK.ATTR_SERVICE_NAME]:"node",[AK.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[AK.ATTR_SERVICE_VERSION]:C8}),forceFlushTimeoutMillis:500,spanProcessors:[new YA({timeout:Bt8(Z.getOptions().maxSpanWaitDuration)}),...J.spanProcessors||[]]});return M4.trace.setGlobalTracerProvider(Y),M4.propagation.setGlobalPropagator(new r_),M4.context.setGlobalContextManager(new H71),Y}function Bt8(Z){if(Z==null)return;if(Z>Qh)return m0&&l.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${Qh}`),Qh;else if(Z<=0||Number.isNaN(Z)){m0&&l.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return Z}function Ot8(){let Z=new Proxy(l,{get(J,Y,$){return Reflect.get(J,Y==="verbose"?"debug":Y,$)}});M4.diag.disable(),M4.diag.setLogger(Z,M4.DiagLogLevel.DEBUG)}function Mt8(){return BK()?[OK()]:[]}function N71(){return[g$(),b$(),m$(),d$(),u$(),VK(),UK(),MK(),NK(),wK(),VA(),LK(),r41(),V71(),...Mt8()]}function R71(Z){return[...N71(),...i6(Z)?_K():[]]}function Xh(Z={}){return Nt8(Z,R71)}function Nt8(Z={},J){let Y=Rt8(Z,J);if(Y.debug===!0)if(m0)l.enable();else T8(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")});if(!BK()&&Y.registerEsmLoaderHooks!==!1)M71();if(Er0(),B1().update(Y.initialScope),Y.spotlight&&!Y.integrations.some(({name:W})=>W===gx))Y.integrations.push(mx({sidecarUrl:typeof Y.spotlight==="string"?Y.spotlight:void 0}));let Q=new GM(Y);if(B1().setClient(Q),Q.init(),l.log(`Running in ${BK()?"CommonJS":"ESM"} mode.`),Q.startClientReportTracking(),Dt8(),!Y.skipOpenTelemetrySetup)Wh(Q,{spanProcessors:Y.openTelemetrySpanProcessors}),j71();return Br0(Q),kr0(Q),Q}function j71(){if(!m0)return;let Z=Rr0(),J=["SentryContextManager","SentryPropagator"];if(i6())J.push("SentrySpanProcessor");for(let Y of J)if(!Z.includes(Y))l.error(`You have to set up the ${Y}. 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 Rt8(Z,J){let Y=jt8(Z.release),$=Z.spotlight??KM(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,Q=Pt8(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??Zh,stackParser:pE(Z.stackParser||$h),release:Y,tracesSampleRate:Q,spotlight:$,debug:KM(Z.debug??process.env.SENTRY_DEBUG)},X=Z.integrations,K=Z.defaultIntegrations??J(W);return{...W,integrations:KI({defaultIntegrations:K,integrations:X})}}function jt8(Z){if(Z!==void 0)return Z;let J=Yh();if(J!==void 0)return J;return}function Pt8(Z){if(Z!==void 0)return Z;let J=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!J)return;let Y=parseFloat(J);return isFinite(Y)?Y:void 0}function Dt8(){if(KM(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let Z=process.env.SENTRY_TRACE,J=process.env.SENTRY_BAGGAGE,Y=E$(Z,J);B1().setPropagationContext(Y)}}import*as k71 from"os";var ft8="BunServer",yt8=()=>{return{name:ft8,setupOnce(){bt8()}}},C71=J0(yt8),P71=!1;function bt8(){if(P71)return;Bun.serve=new Proxy(Bun.serve,{apply(Z,J,Y){D71(Y[0]);let $=Z.apply(J,Y),Q=$.reload.bind($);return $.reload=(W)=>{return D71(W),Q(W)},$}}),P71=!0}function D71(Z){gt8(Z),mt8(Z)}function gt8(Z){if(typeof Z.fetch!=="function")return;Z.fetch=new Proxy(Z.fetch,{apply(J,Y,$){return Kh(J,Y,$)}})}function mt8(Z){if(!Z.routes)return;if(typeof Z.routes!=="object")return;Object.keys(Z.routes).forEach((J)=>{let Y=Z.routes[J];if(typeof Y==="function")Z.routes[J]=new Proxy(Y,{apply:($,Q,W)=>{return Kh($,Q,W,J)}});if(Y instanceof Response)return;if(typeof Y==="object")Object.entries(Y).forEach(([$,Q])=>{if(typeof Q==="function")Z.routes[J][$]=new Proxy(Q,{apply:(W,X,K)=>{return Kh(W,X,K,J)}})})})}function Kh(Z,J,Y,$){return BJ((Q)=>{let W=Y[0],X=W.method.toUpperCase();if(X==="OPTIONS"||X==="HEAD")return Z.apply(J,Y);let K=MI(W.url),G=dt8(K,W),z=K?.pathname||"/";if(W.params){if(Object.keys(W.params).forEach((F)=>{G[`url.path.parameter.${F}`]=W.params[F]}),$)G[n1]="route",G["url.template"]=$,z=$}if($?.endsWith("/*"))G[n1]="route",G["url.template"]=$,z=$;return Q.setSDKProcessingMetadata({normalizedRequest:{url:W.url,method:W.method,headers:W.headers.toJSON(),query_string:K?.search}}),az({sentryTrace:W.headers.get("sentry-trace")??"",baggage:W.headers.get("baggage")},()=>A$({attributes:G,op:"http.server",name:`${W.method} ${z}`},async(F)=>{try{let H=await Z.apply(J,Y);if(H?.status)Az(F,H.status),Q.setContext("response",{headers:H.headers.toJSON(),status_code:H.status});return H}catch(H){throw P6(H,{mechanism:{type:"bun",handled:!1,data:{function:"serve"}}}),H}}))})}function dt8(Z,J){let Y={[Y1]:"auto.http.bun.serve",[mE]:J.method||"GET",[n1]:"url"};if(Z){if(Z.search)Y["url.query"]=Z.search;if(Z.hash)Y["url.fragment"]=Z.hash;if(Z.pathname)Y["url.path"]=Z.pathname;if(!OI(Z)){if(Y["url.full"]=Z.href,Z.port)Y["url.port"]=Z.port;if(Z.protocol)Y["url.scheme"]=Z.protocol;if(Z.hostname)Y["url.domain"]=Z.hostname}}return Y}function T71(Z){function J(Y){let $={body:Y.body,method:"POST",headers:Z.headers};try{return x$(()=>{return fetch(Z.url,$).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 h$(Q)}}return RJ(Z,J)}function E71(Z){return[g$(),b$(),m$(),d$(),u$(),VK(),UK(),MK(),NK(),wK(),LK(),OK(),C71(),...i6(Z)?_K():[]]}function Gh(Z={}){tz(Z,"bun");let J={...Z,platform:"javascript",runtime:{name:"bun",version:Bun.version},serverName:Z.serverName||global.process.env.SENTRY_NAME||k71.hostname()};if(J.transport=J.transport||T71,J.defaultIntegrations===void 0)J.defaultIntegrations=E71(J);return Xh(J)}import{heapStats as ct8}from"bun:jsc";if(process.env.NODE_ENV==="production"&&process.env.SENTRY_DSN)Gh({dsn:process.env.SENTRY_DSN,release:jE,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 Y=Z?.start_timestamp,$=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=ct8(),Y=process.memoryUsage(),$={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:Y.heapUsed/1024/1024,unit:"megabyte"},rssSizeMb:{value:Y.rss/1024/1024,unit:"megabyte"}};if(Z)return $;return Object.fromEntries(Object.entries($).map(([Q,W])=>[Q,W.value]))}static startSpan(Z,J){if(oz())return A$({attributes:Z.attributes,name:Z.operation,op:Z.operation},J);else return J()}}var zh=new Q$,pt8=5000,it8=1048576,nt8=512;class H9 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=Pt(),this.onPacket($0.PacketId.CONNECTION,this._onConnectionPacket),this.onPacket($0.PacketId.HEARTBEAT,this._onHeartbeatPacket),this.bindWs(Z),X6.emit("CONNECTION.OPENED",{connection:this,req:J})}static getPackrBuffer(){if(H9._packrBuffers.length>0)return H9._packrBuffers.pop();return Buffer.allocUnsafe(it8)}static serializePackets(Z){for(let Y of Z)if(!$0.isValidPacket(Y))return m.error(`Connection.serializePackets(): Invalid packet payload: ${JSON.stringify(Y)}`);let J=H9._cachedPacketsSerializedBuffer.get(Z);if(J)return J;return X8.startSpan({operation:"serialize_packets",attributes:{packets:Z.length,packetIds:Z.map((Y)=>Y[0]).join(","),"packetsSerializedBuffer.size":H9._packrBuffers.length}},(Y)=>{let $=X8.startSpan({operation:"serialize_packets_encode"},()=>{let Q=H9.getPackrBuffer();zh.useBuffer(Q);let W=zh.pack(Z,nt8),X=W.subarray(W.start,W.end);return H9._packrBuffers.push(Q),X});return Y?.setAttribute("serializedBytes",$.byteLength),H9._cachedPacketsSerializedBuffer.set(Z,$),$})}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=(Y)=>this._onMessage(Y.data),this._ws.onclose=this._onWsClose,this._ws.onerror=this._onWsError,this.send([$0.createPacket($0.bidirectionalPackets.connectionPacketDefinition,{i:this.id})],!0,!0),J)this.emitWithGlobal("CONNECTION.RECONNECTED",{connection:this});if(zJ.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:Y})=>{if(Y[0]===Z)J(Y)})}send(Z,J=!0,Y=!1){if(this._closeTimeout)return;if(this._ws.readyState!==lt8.OPEN)return m.warning("Connection.send(): Connection is not open.");X8.startSpan({operation:"send_packets",attributes:{forceWs:Y?"true":"false",wrtcConnected:this._wrtcServerClientTransport?.iceState==="completed"?"true":"false"}},()=>{try{let $=H9.serializePackets(Z);if(!$)return;if(this._wrtcServerClientTransport?.iceState==="completed"&&$.length<(this._wrtcServerClientTransport?.sctpParameters?.maxMessageSize??0)&&!Y)try{(J?this._wrtcServerClientReliableDataProducer:this._wrtcServerClientUnreliableDataProducer).send($)}catch{this._ws.send($)}else this._ws.send($);this.emitWithGlobal("CONNECTION.PACKETS_SENT",{connection:this,packets:Z})}catch($){m.error(`Connection.send(): Packet send failed. Error: ${$}`)}})}_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],Y=J.c,$=J.d;if(Y){let{i:Q,d:W}=Y,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([$0.createPacket($0.bidirectionalPackets.connectionPacketDefinition,{ca:{i:Q}})])}if($)for(let Q of $){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([$0.createPacket($0.bidirectionalPackets.connectionPacketDefinition,{pa:{i:K.id,l:X}})])}};_onHeartbeatPacket=()=>{this.send([$0.createPacket($0.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()},pt8)};_onWsError=(Z)=>{this.emitWithGlobal("CONNECTION.ERROR",{connection:this,error:Z})};_upgradeToWRTC=async()=>{let Z=await zJ.instance.createWrtcTransports();if(!Z)return!1;let{directTransport:J,clientServerTransport:Y,serverClientTransport:$}=Z;this._wrtcDirectTransport=J,this._wrtcClientServerTransport=Y,this._wrtcClientServerTransport.on("icestatechange",(X)=>{this._onWrtcIceStateChange(this._wrtcClientServerTransport,X)}),this._wrtcServerClientTransport=$,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([$0.createPacket($0.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=zh.unpack(Z);if(!J||typeof J!=="object"||typeof J[0]!=="number")return m.error(`Connection._deserialize(): Invalid packet format. Packet: ${JSON.stringify(J)}`);if(!$0.isValidPacket(J))return m.error(`Connection._deserialize(): Invalid packet payload. Packet: ${JSON.stringify(J)}`);return J}}var I71;(($)=>{$.PLAYER_CONNECTED="PLAYER_MANAGER.PLAYER_CONNECTED";$.PLAYER_DISCONNECTED="PLAYER_MANAGER.PLAYER_DISCONNECTED";$.PLAYER_RECONNECTED="PLAYER_MANAGER.PLAYER_RECONNECTED"})(I71||={});class d5{static instance=new d5;_connectionPlayers=new Map;constructor(){X6.on("CONNECTION.OPENED",({connection:Z,req:J})=>{this._onConnectionOpened(Z,J.session)}),X6.on("CONNECTION.DISCONNECTED",({connection:Z})=>{this._onConnectionDisconnected(Z)}),X6.on("CONNECTION.RECONNECTED",({connection:Z})=>{this._onConnectionReconnected(Z)}),X6.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 Y=new xK(Z,J);this._connectionPlayers.set(Z,Y),X6.emit("PLAYER_MANAGER.PLAYER_CONNECTED",{player:Y})}_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(),X6.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),X6.emit("PLAYER_MANAGER.PLAYER_DISCONNECTED",{player:J});else m.warning(`PlayerManager._onConnectionClosed(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}}var I8=16,hK=I8-1,v71=I8**3,at8=[{neighborOffset:[-1,0,0],generateVertices:(Z,J,Y)=>[Z+0,J+0,Y+0,Z+0,J+0,Y+1,Z+0,J+1,Y+0,Z+0,J+1,Y+0,Z+0,J+0,Y+1,Z+0,J+1,Y+1]},{neighborOffset:[1,0,0],generateVertices:(Z,J,Y)=>[Z+1,J+0,Y+0,Z+1,J+1,Y+0,Z+1,J+0,Y+1,Z+1,J+1,Y+0,Z+1,J+1,Y+1,Z+1,J+0,Y+1]},{neighborOffset:[0,-1,0],generateVertices:(Z,J,Y)=>[Z+0,J+0,Y+0,Z+1,J+0,Y+0,Z+0,J+0,Y+1,Z+1,J+0,Y+0,Z+1,J+0,Y+1,Z+0,J+0,Y+1]},{neighborOffset:[0,1,0],generateVertices:(Z,J,Y)=>[Z+0,J+1,Y+0,Z+0,J+1,Y+1,Z+1,J+1,Y+0,Z+1,J+1,Y+0,Z+0,J+1,Y+1,Z+1,J+1,Y+1]},{neighborOffset:[0,0,-1],generateVertices:(Z,J,Y)=>[Z+0,J+0,Y+0,Z+0,J+1,Y+0,Z+1,J+0,Y+0,Z+0,J+1,Y+0,Z+1,J+1,Y+0,Z+1,J+0,Y+0]},{neighborOffset:[0,0,1],generateVertices:(Z,J,Y)=>[Z+0,J+0,Y+1,Z+1,J+0,Y+1,Z+0,J+1,Y+1,Z+0,J+1,Y+1,Z+1,J+0,Y+1,Z+1,J+1,Y+1]}],Fh;(($)=>{$.DESPAWN="CHUNK.DESPAWN";$.SET_BLOCK="CHUNK.SET_BLOCK";$.SPAWN="CHUNK.SPAWN"})(Fh||={});class I6 extends g0{_blocks;_originCoordinate;_requiresUpdate=!1;_rigidBody;_world;constructor(){super();this._blocks=new Uint8Array(v71)}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%I8,y:(Z/I8|0)%I8,z:Z/(I8*I8)|0}}static globalCoordinateToLocalCoordinate(Z){return{x:Z.x&I8-1,y:Z.y&I8-1,z:Z.z&I8-1}}static globalCoordinateToOriginCoordinate(Z){return{x:Z.x&~(I8-1),y:Z.y&~(I8-1),z:Z.z&~(I8-1)}}static isValidOriginCoordinate(Z){return Z.x%I8===0&&Z.y%I8===0&&Z.z%I8===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(!I6.isValidOriginCoordinate(J))return m.error(`Chunk.spawn(): Chunk coordinates must be divisible by ${I8}`);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 Y=this._getGlobalCoordinate(Z),$=[];if(Z.x===0)$.push({x:-1,y:0,z:0});if(Z.y===0)$.push({x:0,y:-1,z:0});if(Z.z===0)$.push({x:0,y:0,z:-1});if(Z.x===hK)$.push({x:1,y:0,z:0});if(Z.y===hK)$.push({x:0,y:1,z:0});if(Z.z===hK)$.push({x:0,y:0,z:1});for(let Q of $){let W={x:Y.x+Q.x,y:Y.y+Q.y,z:Y.z+Q.z},X=I6.globalCoordinateToOriginCoordinate(W),K=this._world?.chunkLattice.getChunk(X);if(!K?.hasBlock(I6.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 nY({type:"fixed",position:this._originCoordinate,simulation:this._world.simulation}),this._meshColliders().map(([Y,$])=>{if(!Y.isSimulated)Y.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 $=0;$<v71;$++){if(this._blocks[$]===0)continue;let Q=this._blocks[$],W=this._world.blockTypeRegistry.getBlockType(Q),{x:X,y:K,z:G}=I6.blockIndexToLocalCoordinate($);if(!W.isMeshable){let F=W.createCollider();F.setRelativePosition({x:X,y:K,z:G}),J.push([F,W]);continue}let z=Z.get(W)??{indices:[],vertices:[]};Z.set(W,z);for(let F of at8){let[H,V,q]=F.neighborOffset,U={x:X+H,y:K+V,z:G+q},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(...F.generateVertices(X,K,G))}}let Y=[];return Z.forEach(($,Q)=>{if(!$.indices.length)return;let W=Q.createCollider(new Uint32Array($.indices),new Float32Array($.vertices));Y.push([W,Q])}),[...J,...Y]}_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+I8*(Z.y+I8*Z.z)}_isValidLocalCoordinate(Z){return Z.x>=0&&Z.x<=hK&&Z.y>=0&&Z.y<=hK&&Z.z>=0&&Z.z<=hK}}class _H{_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:Y,z:$}=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(I6.globalCoordinateToOriginCoordinate(Z));if(!J)return 0;return J.getBlockId(I6.globalCoordinateToLocalCoordinate(Z))}getBlockType(Z){let J=this.getBlockId(Z);return J?this._world.blockTypeRegistry.getBlockType(J):null}getChunk(Z){if(!I6.isValidOriginCoordinate(Z)){m.error(`ChunkLattice.getChunk(): Chunk coordinates must be divisible by CHUNK_SIZE (${I8})`);return}return this._chunks.get(this._getChunkKey(Z))}getAllChunks(){return Array.from(this._chunks.values())}hasBlock(Z){let J=this.getChunk(I6.globalCoordinateToOriginCoordinate(Z));if(!J)return!1;return J.hasBlock(I6.globalCoordinateToLocalCoordinate(Z))}hasChunk(Z){return this._chunks.has(this._getChunkKey(Z))}setBlock(Z,J){let Y=I6.globalCoordinateToLocalCoordinate(Z),$=I6.globalCoordinateToOriginCoordinate(Z),Q=this.getChunk($);if(!Q)Q=new I6,Q.spawn(this._world,$);Q.setBlock(Y,J)}updateChunks(){this._chunks.forEach((Z)=>{if(Z.requiresUpdate)Z.update()})}_getChunkKey(Z){return`${Z.x},${Z.y},${Z.z}`}}var S71={type:"dynamic",softCcdPrediction:1},_71=0.0025000000000000005,A71=Math.cos(0.005),AH;((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"})(AH||={});class p8 extends nY{_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,Y="modelUri"in Z;if(!J===!Y)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&&!Q9.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??S71);if(J)this._blockHalfExtents=Z.blockHalfExtents,this._blockTextureUri=Z.blockTextureUri;if(Y)this._modelAnimationsPlaybackRate=Z.modelAnimationsPlaybackRate??1,this._modelPreferredShape=Z.modelPreferredShape,this._modelScale=Z.modelScale,this._modelUri=Z.modelUri,Z.modelHiddenNodes?.forEach(($)=>this._modelHiddenNodes.add($.toLowerCase())),Z.modelLoopedAnimations?.forEach(($)=>this._modelLoopedAnimations.add($));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?Q9.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,Y){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 f5(f5.optionsFromBlockHalfExtents(this._blockHalfExtents)));if(this._modelUri&&this.numColliders===0&&this._modelPreferredShape!=="none")this.addChildColliderToSimulation(new f5(f5.optionsFromModelUri(this._modelUri,this._modelScale,this._modelPreferredShape)));if(this.colliders.forEach(($)=>{if(this.hasListeners("ENTITY.BLOCK_COLLISION")||this.hasListeners("ENTITY.ENTITY_COLLISION"))$.enableCollisionEvents(!0);if(this.hasListeners("ENTITY.BLOCK_CONTACT_FORCE")||this.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))$.enableContactForceEvents(!0);if(u9.isDefaultCollisionGroups($.collisionGroups))$.setCollisionGroups({belongsTo:[$.isSensor?4:2],collidesWith:[65535]})}),this.setPosition(J),Y)this.setRotation(Y);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,Y);this.colliders.forEach(($)=>{Z.simulation.colliderMap.setColliderEntity($,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(Y??{x:0,y:0,z:0}),this.setRotation($??{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 Y=Z.x-J.x,$=Z.y-J.y,Q=Z.z-J.z;return Y*Y+$*$+Q*Q>_71}_rotationExceedsThreshold(Z,J){return Math.abs(Z.x*J.x+Z.y*J.y+Z.z*J.z+Z.w*J.w)<A71}}var Hh;((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"})(Hh||={});class xH 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 O7 extends p8{player;nametagSceneUI;constructor(Z){super(Z);this.player=Z.player,this.nametagSceneUI=new xH({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,Y){super.spawn(Z,J,Y),this.nametagSceneUI.load(Z),this.player.on("PLAYER.CHAT_MESSAGE_SEND",({message:$})=>{this.nametagSceneUI.setState({chat:$})})}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:Y}=this.player;this.controller.tickWithPlayerInput(this,J,Y.orientation,Z),super.tick(Z)}}class fH{_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 O7)Z.push(J)}),Z}getPlayerEntitiesByPlayer(Z){let J=[];return this._entities.forEach((Y)=>{if(Y instanceof O7&&Y.player===Z)J.push(Y)}),J}getEntity(Z){return this._entities.get(Z)}getEntitiesByTag(Z){let J=[];return this._entities.forEach((Y)=>{if(Y.tag===Z)J.push(Y)}),J}getEntitiesByTagSubstring(Z){let J=[];return this._entities.forEach((Y)=>{if(Y.tag?.includes(Z))J.push(Y)}),J}getEntityChildren(Z){let J=[];return this._entities.forEach((Y)=>{if(Y.parent===Z)J.push(Y)}),J}tickEntities(Z){this._entities.forEach((J)=>{J.tick(Z)})}checkAndEmitUpdates(){this._entities.forEach((Z)=>{if(!Z.isSpawned)return;Z.checkAndEmitUpdates()})}}class yH{_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 x71;((Y)=>{Y[Y.POINTLIGHT=0]="POINTLIGHT";Y[Y.SPOTLIGHT=1]="SPOTLIGHT"})(x71||={});var Vh;((V)=>{V.DESPAWN="LIGHT.DESPAWN";V.SET_ANGLE="LIGHT.SET_ANGLE";V.SET_ATTACHED_TO_ENTITY="LIGHT.SET_ATTACHED_TO_ENTITY";V.SET_COLOR="LIGHT.SET_COLOR";V.SET_DISTANCE="LIGHT.SET_DISTANCE";V.SET_INTENSITY="LIGHT.SET_INTENSITY";V.SET_OFFSET="LIGHT.SET_OFFSET";V.SET_PENUMBRA="LIGHT.SET_PENUMBRA";V.SET_POSITION="LIGHT.SET_POSITION";V.SET_TRACKED_ENTITY="LIGHT.SET_TRACKED_ENTITY";V.SET_TRACKED_POSITION="LIGHT.SET_TRACKED_POSITION";V.SPAWN="LIGHT.SPAWN"})(Vh||={});class qh 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 h71;(($)=>{$[$.FIRST_PERSON=0]="FIRST_PERSON";$[$.THIRD_PERSON=1]="THIRD_PERSON";$[$.SPECTATOR=2]="SPECTATOR"})(h71||={});var Uh;((q)=>{q.LOOK_AT_ENTITY="PLAYER_CAMERA.LOOK_AT_ENTITY";q.LOOK_AT_POSITION="PLAYER_CAMERA.LOOK_AT_POSITION";q.SET_ATTACHED_TO_ENTITY="PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY";q.SET_ATTACHED_TO_POSITION="PLAYER_CAMERA.SET_ATTACHED_TO_POSITION";q.SET_FILM_OFFSET="PLAYER_CAMERA.SET_FILM_OFFSET";q.SET_FORWARD_OFFSET="PLAYER_CAMERA.SET_FORWARD_OFFSET";q.SET_FOV="PLAYER_CAMERA.SET_FOV";q.SET_MODEL_HIDDEN_NODES="PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES";q.SET_MODE="PLAYER_CAMERA.SET_MODE";q.SET_OFFSET="PLAYER_CAMERA.SET_OFFSET";q.SET_TRACKED_ENTITY="PLAYER_CAMERA.SET_TRACKED_ENTITY";q.SET_TRACKED_POSITION="PLAYER_CAMERA.SET_TRACKED_POSITION";q.SET_ZOOM="PLAYER_CAMERA.SET_ZOOM"})(Uh||={});class bH 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 FM;((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"})(FM||={});class gH 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 mH{_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 st8={x:0,y:-32,z:0},Lh=60,wh;((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"})(wh||={});class dH extends g0{_colliderMap=new mH;_debugRaycastingEnabled=!1;_debugRenderingEnabled=!1;_rapierEventQueue;_rapierSimulation;_world;constructor(Z,J=Lh,Y=st8){super();this._rapierEventQueue=new K1.EventQueue(!0),this._rapierSimulation=new K1.World(Y),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,$.filterFlags,$.filterGroups,$.filterExcludeCollider,$.filterExcludeRigidBody,$.filterPredicate);if(this._debugRaycastingEnabled)this.emitWithWorld(this._world,"SIMULATION.DEBUG_RAYCAST",{simulation:this,origin:Z,direction:J,length:Y,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:bQ.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 F=this._colliderMap.getColliderHandleEntity(G.handle);if(F)return{hitEntity:F,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 Y=[];return this._rapierSimulation.narrowPhase.contactPair(Z,J,($,Q)=>{if($.numContacts()===0)return;let W=$.normal(),X=[];for(let K=0;K<$.numSolverContacts();K++)X.push($.solverContactPoint(K));Y.push({contactPoints:X,localNormalA:!Q?$.localNormal1():$.localNormal2(),localNormalB:!Q?$.localNormal2():$.localNormal1(),normal:!Q?W:{x:-W.x,y:-W.y,z:-W.z}})}),Y}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,Y)=>{let[$,Q]=this._getCollisionObjects(Z,J);if(!$||!Q)return;let W=(X,K)=>{if(X instanceof y5&&K instanceof p8&&X.hasListeners("BLOCK_TYPE.ENTITY_COLLISION"))X.emit("BLOCK_TYPE.ENTITY_COLLISION",{blockType:X,entity:K,started:Y,colliderHandleA:Z,colliderHandleB:J});else if(X instanceof p8&&K instanceof y5&&X.hasListeners("ENTITY.BLOCK_COLLISION"))X.emit("ENTITY.BLOCK_COLLISION",{entity:X,blockType:K,started:Y,colliderHandleA:Z,colliderHandleB:J});else if(X instanceof p8&&K instanceof p8&&X.hasListeners("ENTITY.ENTITY_COLLISION"))X.emit("ENTITY.ENTITY_COLLISION",{entity:X,otherEntity:K,started:Y,colliderHandleA:Z,colliderHandleB:J});else if(typeof X==="function"&&(K instanceof p8||K instanceof y5))X(K,Y,Z,J)};W($,Q),W(Q,$)};_onContactForceEvent=(Z)=>{let[J,Y]=this._getCollisionObjects(Z.collider1(),Z.collider2());if(!J||typeof J==="function"||!Y||typeof Y==="function")return;let $={totalForce:Z.totalForce(),totalForceMagnitude:Z.totalForceMagnitude(),maxForceDirection:Z.maxForceDirection(),maxForceMagnitude:Z.maxForceMagnitude()},Q=(W,X)=>{if(W instanceof y5&&X instanceof p8&&W.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))W.emit("BLOCK_TYPE.ENTITY_CONTACT_FORCE",{blockType:W,entity:X,contactForceData:$});else if(W instanceof p8&&X instanceof y5&&W.hasListeners("ENTITY.BLOCK_CONTACT_FORCE"))W.emit("ENTITY.BLOCK_CONTACT_FORCE",{entity:W,blockType:X,contactForceData:$});else if(W instanceof p8&&X instanceof p8&&W.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))W.emit("ENTITY.ENTITY_CONTACT_FORCE",{entity:W,otherEntity:X,contactForceData:$})};Q(J,Y),Q(Y,J)};_getCollisionObjects(Z,J){let Y=this._colliderMap.getColliderHandleBlockType(Z)??this._colliderMap.getColliderHandleCollisionCallback(Z)??this._colliderMap.getColliderHandleEntity(Z),$=this._colliderMap.getColliderHandleBlockType(J)??this._colliderMap.getColliderHandleCollisionCallback(J)??this._colliderMap.getColliderHandleEntity(J);return[Y,$]}}class HM{_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=[],Y=this._world.loop.currentTick;this._queuedPerPlayerSynchronizations.forEach((V,q)=>{this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(...V)});let $=Object.values(this._queuedEntitySynchronizations);if($.length>0){let[V,q]=$.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(q.length>0){let U=$0.createPacket($0.outboundPackets.entitiesPacketDefinition,q,Y);J.push(U)}if(V.length>0){let U=$0.createPacket($0.outboundPackets.entitiesPacketDefinition,V,Y);Z.push(U),this._synchronizedPlayerReliablePackets.forEach((w)=>w.push(U))}}let Q=Object.values(this._queuedAudioSynchronizations);if(Q.length>0){let V=$0.createPacket($0.outboundPackets.audiosPacketDefinition,Q,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}let W=Object.values(this._queuedBlockTypeSynchronizations);if(W.length>0){let V=$0.createPacket($0.outboundPackets.blockTypesPacketDefinition,W,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}let X=Object.values(this._queuedBlockSynchronizations);if(X.length>0){let V=$0.createPacket($0.outboundPackets.blocksPacketDefinition,X,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}let K=Object.values(this._queuedChunkSynchronizations);if(K.length>0){let V=$0.createPacket($0.outboundPackets.chunksPacketDefinition,K,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}let G=Object.values(this._queuedLightSynchronizations);if(G.length>0){let V=$0.createPacket($0.outboundPackets.lightsPacketDefinition,G,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}this._queuedPerPlayerUISynchronizations.forEach((V,q)=>{let U=$0.createPacket($0.outboundPackets.uiPacketDefinition,V,Y);this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(U)}),this._queuedPerPlayerUIDatasSynchronizations.forEach((V,q)=>{let U=$0.createPacket($0.outboundPackets.uiDatasPacketDefinition,V,Y);this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(U)});let z=Object.values(this._queuedSceneUISynchronizations);if(z.length>0){let V=$0.createPacket($0.outboundPackets.sceneUIsPacketDefinition,z,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}if(this._queuedWorldSynchronization){let V=$0.createPacket($0.outboundPackets.worldPacketDefinition,this._queuedWorldSynchronization,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}this._queuedPerPlayerCameraSynchronizations.forEach((V,q)=>{let U=$0.createPacket($0.outboundPackets.cameraPacketDefinition,V,Y);this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(U)});let F=Object.values(this._queuedPlayerSynchronizations);if(F.length>0){let V=$0.createPacket($0.outboundPackets.playersPacketDefinition,F,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}this._queuedBroadcasts.forEach((V)=>{Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))});let H=this._queuedDebugRaycastSynchronizations;if(H.length>0){let V=$0.createPacket($0.outboundPackets.physicsDebugRaycastsPacketDefinition,H,Y);Z.push(V),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(V))}X8.startSpan({operation:"send_all_packets"},()=>{d5.instance.getConnectedPlayersByWorld(this._world).forEach((V)=>{let q=this._synchronizedPlayerReliablePackets.get(V)??Z;if(q.length>0)V.connection.send(q);if(J.length>0)V.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(H.length>0)this._queuedDebugRaycastSynchronizations=[];if($.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(F.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:Y,color:$}=Z;this._queuedBroadcasts.push($0.createPacket($0.outboundPackets.chatMessagesPacketDefinition,[{m:Y,c:$,p:J?.id}],this._world.loop.currentTick))};_onChatSendPlayerMessage=(Z)=>{let{player:J,message:Y,color:$}=Z,Q=this._queuedPerPlayerSynchronizations.get(J)??[];Q.push($0.createPacket($0.outboundPackets.chatMessagesPacketDefinition,[{m:Y,c:$}],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),Y=J.c.join(",");if(this._spawnedChunks.has(Y))delete this._queuedChunkSynchronizations[Y],this._spawnedChunks.delete(Y);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((Y)=>!Z.animations.has(Y)).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((Y)=>!Z.animations.has(Y)).filter(Boolean)};_onEntityStopModelAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.al)J.al=J.al.filter((Y)=>!Z.animations.has(Y)).filter(Boolean);if(J.ao)J.ao=J.ao.filter((Y)=>!Z.animations.has(Y)).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,Y=this._queuedPerPlayerSynchronizations.get(J)??[];Y.push($0.createPacket($0.outboundPackets.worldPacketDefinition,this._world.serialize(),this._world.loop.currentTick)),Y.push($0.createPacket($0.outboundPackets.blockTypesPacketDefinition,this._world.blockTypeRegistry.serialize(),this._world.loop.currentTick)),Y.push($0.createPacket($0.outboundPackets.chunksPacketDefinition,this._world.chunkLattice.getAllChunks().map((Q)=>Q.serialize()),this._world.loop.currentTick)),Y.push($0.createPacket($0.outboundPackets.entitiesPacketDefinition,this._world.entityManager.getAllEntities().map((Q)=>{if(J.camera.attachedToEntity===void 0&&Q instanceof O7&&Q.player===J)J.camera.setAttachedToEntity(Q);return Q.serialize()}),this._world.loop.currentTick)),Y.push($0.createPacket($0.outboundPackets.audiosPacketDefinition,this._world.audioManager.getAllAudios().map((Q)=>Q.serialize()),this._world.loop.currentTick)),Y.push($0.createPacket($0.outboundPackets.lightsPacketDefinition,this._world.lightManager.getAllLights().map((Q)=>Q.serialize()),this._world.loop.currentTick)),Y.push($0.createPacket($0.outboundPackets.sceneUIsPacketDefinition,this._world.sceneUIManager.getAllSceneUIs().map((Q)=>Q.serialize()),this._world.loop.currentTick)),Y.push($0.createPacket($0.outboundPackets.playersPacketDefinition,d5.instance.getConnectedPlayers().map((Q)=>Q.serialize()),this._world.loop.currentTick));let $=this._createOrGetQueuedPlayerCameraSync(J.camera);this._queuedPerPlayerCameraSynchronizations.set(J,{...J.camera.serialize(),...$}),this._queuedPerPlayerSynchronizations.set(J,Y),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([$0.createPacket($0.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($0.createPacket($0.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:Y,z:$}=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:Y,z:$}=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 Y=this._synchronizedPlayerReliablePackets.get(Z);if(!Y)Y=[...J],this._synchronizedPlayerReliablePackets.set(Z,Y);return Y}}class uH{_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 ot8=2,rt8=3;class cH{_accumulatorMs=0;_targetTicksPerSecond;_fixedTimestepMs;_fixedTimestepS;_maxAccumulatorMs;_nextTickMs=0;_lastLoopTimeMs=0;_tickFunction;_tickErrorCallback;_tickHandle=null;constructor(Z,J,Y){this._targetTicksPerSecond=Z,this._fixedTimestepS=Math.fround(1/Z),this._fixedTimestepMs=Math.fround(this._fixedTimestepS*1000),this._maxAccumulatorMs=this._fixedTimestepMs*rt8,this._tickFunction=J,this._tickErrorCallback=Y}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(),Y=J-this._lastLoopTimeMs;if(this._lastLoopTimeMs=J,this._accumulatorMs+=Y,this._accumulatorMs>this._maxAccumulatorMs)this._accumulatorMs=this._maxAccumulatorMs;if(this._accumulatorMs>=this._fixedTimestepMs)X8.startSpan({operation:"ticker_tick"},()=>{let $=0;while(this._accumulatorMs>=this._fixedTimestepMs&&$<ot8)this._tick(this._fixedTimestepMs),this._accumulatorMs-=this._fixedTimestepMs,$++;this._nextTickMs=this._fixedTimestepMs-this._accumulatorMs});this._tickHandle=setImmediate(Z)};Z()}stop(){if(!this._tickHandle)return m.warning("Ticker.stop(): ticker not running.");clearImmediate(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 f71;((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"})(f71||={});class lH extends g0{_currentTick=0;_ticker;_world;constructor(Z,J=Lh){super();this._ticker=new cH(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:d5.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 Bh;((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"})(Bh||={});class pH 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 cK(this),this._blockTypeRegistry=new eG(this),this._chatManager=new iH(this),this._chunkLattice=new _H(this),this._entityManager=new fH(this),this._lightManager=new yH(this),this._loop=new lH(this,Z.tickRate),this._networkSynchronizer=new HM(this),this._sceneUIManager=new uH(this),this._simulation=new dH(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,Y]of Object.entries(Z.blocks)){let[$,Q,W]=J.split(",").map(Number);this.chunkLattice.setBlock({x:$,y:Q,z:W},Y)}if(Z.entities)for(let[J,Y]of Object.entries(Z.entities)){let[$,Q,W]=J.split(",").map(Number);new p8(Y).spawn(this,{x:$,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 tt8=1,y71;((J)=>J.WORLD_CREATED="WORLD_MANAGER.WORLD_CREATED")(y71||={});class fK{static instance=new fK;_worlds=new Map;_nextWorldId=1;createWorld(Z){let J=new pH({...Z,id:this._nextWorldId++});return J.start(),this._worlds.set(J.id,J),X6.emit("WORLD_MANAGER.WORLD_CREATED",{world:J}),J}getAllWorlds(){return Array.from(this._worlds.values())}getDefaultWorld(){return this._worlds.get(tt8)??this.createWorld({name:"Default World",skyboxUri:"skyboxes/partly-cloudy"})}getWorldsByTag(Z){let J=[];return this._worlds.forEach((Y)=>{if(Y.tag===Z)J.push(Y)}),J}getWorld(Z){return this._worlds.get(Z)}}var b71;((Y)=>{Y.START="GAMESERVER.START";Y.STOP="GAMESERVER.STOP"})(b71||={});function et8(Z){K1.init().then(()=>{return PZ.instance.modelRegistry.preloadModels()}).then(()=>{Z(PZ.instance.worldManager.getDefaultWorld()),PZ.instance.start()}).catch((J)=>{m.fatalError(`Failed to initialize the game engine, exiting. Error: ${J}`)})}class PZ{static _instance;_modelRegistry=Q9.instance;_playerManager=d5.instance;_socket=zJ.instance;_worldManager=fK.instance;_webServer=BX.instance;constructor(){}static get instance(){if(!this._instance)this._instance=new PZ;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(){X6.emit("GAMESERVER.START",{startedAtMs:performance.now()}),this._webServer.start()}}class AQ{static instance=new AQ;constructor(){}async getGlobalData(Z){let J=await s4.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 s4.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 Y=await s4.instance.setData(Z,J);if(!Y||Y.error){if(Y?.error)m.warning(`PersistenceManager.setGlobalData(): ${Y.error.message}`);return}return Y}async setPlayerData(Z,J){let Y=await s4.instance.setData(this._getPlayerKey(Z),J);if(!Y||Y.error){if(Y?.error)m.warning(`PersistenceManager.setPlayerData(): ${Y.error.message}`);return}return Y}_getPlayerKey(Z){return`player-${Z.id}`}}var g71=["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"],hH;((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"})(hH||={});class xK 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-${xK._devNextPlayerId++}`,this.username=J?.user.username??this.id,this.profilePictureUrl=J?.user.profilePictureURL??void 0,this.camera=new bH(this),this.connection=Z,this.ui=new gH(this),Z.onPacket($0.PacketId.CHAT_MESSAGE_SEND,this._onChatMessageSendPacket),Z.onPacket($0.PacketId.DEBUG_CONFIG,this._onDebugConfigPacket),Z.onPacket($0.PacketId.INPUT,this._onInputPacket),Z.onPacket($0.PacketId.SYNC_REQUEST,this._onSyncRequestPacket),Z.onPacket($0.PacketId.UI_DATA_SEND,this._onUIDataSendPacket),this.joinWorld(PZ.instance.worldManager.getDefaultWorld())}get input(){return this._input}get world(){return this._world}disconnect(){this._leaveWorld(),this.connection.disconnect()}async getPersistedData(){return AQ.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 AQ.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(g71.forEach((Y)=>{let $=Y;if(J[$]!==void 0)this._input[$]=Boolean(J[$])}),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 Oh;((Y)=>{Y.BROADCAST_MESSAGE="CHAT.BROADCAST_MESSAGE";Y.PLAYER_MESSAGE="CHAT.PLAYER_MESSAGE"})(Oh||={});class iH 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,Y){this.emitWithWorld(this._world,"CHAT.PLAYER_MESSAGE",{player:Z,message:J,color:Y})}_subscribeToPlayerEvents(){this._world.on("PLAYER.CHAT_MESSAGE_SEND",(Z)=>{let{player:J,message:Y}=Z,[$,...Q]=Y.split(" "),W=this._commandCallbacks[$];if(W){W(J,Q,Y);return}this._sendBroadcastMessage(J,Y)})}_sendBroadcastMessage(Z,J,Y){this.emitWithWorld(this._world,"CHAT.BROADCAST_MESSAGE",{player:Z,message:J,color:Y})}}class nH extends zY{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 uK({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:Y})=>{if(!J.isLiquid||!this.canSwim(this))return;if(this._liquidContactCount<=0&&Y){let $=Z.linearVelocity;Z.setLinearVelocity({x:$.x*this.swimGravity,y:$.y*this.swimGravity,z:$.z*this.swimGravity})}if(this._liquidContactCount+=Y?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,Y)=>{if(!Z.isSpawned)return;if(!(J instanceof y5)||!J.isLiquid)this._groundContactCount+=Y?1:-1;if(!this._groundContactCount&&!this.isSwimming)Z.startModelOneshotAnimations(this.jumpOneshotAnimations);else Z.stopModelAnimations(this.jumpOneshotAnimations);if(!(J instanceof p8)||!J.isKinematic)return;if(Y&&this.sticksToPlatforms)this._platform=J;else if(J===this._platform&&!Y)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:F}=J,{yaw:H}=Y,V=Z.linearVelocity,q={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((N)=>!this.runLoopedAnimations.includes(N))),Z.startModelLoopedAnimations(this.runLoopedAnimations),this._stepAudio?.setPlaybackRate(0.75);else Z.stopModelAnimations(Array.from(Z.modelLoopedAnimations).filter((N)=>!this.walkLoopedAnimations.includes(N))),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((N)=>!this.idleLoopedAnimations.includes(N))),Z.startModelLoopedAnimations(this.idleLoopedAnimations);if(F)Z.startModelOneshotAnimations(this.interactOneshotAnimations),J.ml=!this.autoCancelMouseLeftClick;if(U&&this.canRun(this)||!U&&this.canWalk(this)){let N=!this.isSwimming?U?this.runVelocity:this.walkVelocity:U?this.swimFastVelocity:this.swimSlowVelocity;if(Q)q.x-=N*Math.sin(H),q.z-=N*Math.cos(H);if(X)q.x+=N*Math.sin(H),q.z+=N*Math.cos(H);if(W)q.x-=N*Math.cos(H),q.z+=N*Math.sin(H);if(K)q.x+=N*Math.cos(H),q.z-=N*Math.sin(H);let j=Math.sqrt(q.x*q.x+q.z*q.z);if(j>N){let R=N/j;q.x*=R,q.z*=R}}if(this.isSwimming){if(V.y<this.swimMaxGravityVelocity)Z.setLinearVelocity({...V,y:this.swimMaxGravityVelocity});if(V.y>this.swimUpwardVelocity*2)Z.setLinearVelocity({...V,y:this.swimUpwardVelocity*2})}if(G&&this.canJump(this)){if(this.isGrounded&&!this.isSwimming&&V.y>-0.001&&V.y<=3)q.y=this.jumpVelocity;else if(this.isSwimming&&performance.now()>this._swimUpwardCooldownAt)q.y=this.swimUpwardVelocity*Z.gravityScale}let w=this._platform?this._platform.linearVelocity:{x:0,y:0,z:0},L={x:q.x-V.x+w.x,y:q.y+w.y,z:q.z-V.z+w.z};if(!(this.runVelocity>0&&Math.abs(V.x)>this.runVelocity||this.jumpVelocity>0&&Math.abs(V.y)>this.jumpVelocity||this.runVelocity>0&&Math.abs(V.z)>this.runVelocity)||this.isOnPlatform){if(Object.values(L).some((N)=>N!==0)){let N=Z.mass;Z.applyImpulse({x:L.x*N,y:L.y*N,z:L.z*N})}}if(H!==void 0){let N=H/2;Z.setRotation({x:0,y:Math.fround(Math.sin(N)),z:0,w:Math.fround(Math.cos(N))})}}}class Mh extends O7{constructor(Z){super({modelUri:"models/players/player.gltf",modelLoopedAnimations:["idle_lower","idle_upper"],modelScale:0.5,...Z});if(!Z.controller)this.setController(new nH)}}var P0=0.000001,$1=typeof Float32Array!=="undefined"?Float32Array:Array,M7=Math.random;var Fi6=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 y8={};b9(y8,{transpose:()=>Xe8,subtract:()=>d71,sub:()=>Pe8,str:()=>Ue8,set:()=>We8,scale:()=>He8,rotate:()=>Fe8,multiplyScalarAndAdd:()=>Re8,multiplyScalar:()=>Ne8,multiply:()=>m71,mul:()=>je8,invert:()=>Ke8,identity:()=>$e8,fromValues:()=>Qe8,fromScaling:()=>qe8,fromRotation:()=>Ve8,frob:()=>Le8,exactEquals:()=>Oe8,equals:()=>Me8,determinant:()=>ze8,create:()=>Ze8,copy:()=>Ye8,clone:()=>Je8,adjoint:()=>Ge8,add:()=>Be8,LDU:()=>we8});function Ze8(){var Z=new $1(4);if($1!=Float32Array)Z[1]=0,Z[2]=0;return Z[0]=1,Z[3]=1,Z}function Je8(Z){var J=new $1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function Ye8(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function $e8(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=1,Z}function Qe8(Z,J,Y,$){var Q=new $1(4);return Q[0]=Z,Q[1]=J,Q[2]=Y,Q[3]=$,Q}function We8(Z,J,Y,$,Q){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=Q,Z}function Xe8(Z,J){if(Z===J){var Y=J[1];Z[1]=J[2],Z[2]=Y}else Z[0]=J[0],Z[1]=J[2],Z[2]=J[1],Z[3]=J[3];return Z}function Ke8(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=Y*W-Q*$;if(!X)return null;return X=1/X,Z[0]=W*X,Z[1]=-$*X,Z[2]=-Q*X,Z[3]=Y*X,Z}function Ge8(Z,J){var Y=J[0];return Z[0]=J[3],Z[1]=-J[1],Z[2]=-J[2],Z[3]=Y,Z}function ze8(Z){return Z[0]*Z[3]-Z[2]*Z[1]}function m71(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=Y[0],G=Y[1],z=Y[2],F=Y[3];return Z[0]=$*K+W*G,Z[1]=Q*K+X*G,Z[2]=$*z+W*F,Z[3]=Q*z+X*F,Z}function Fe8(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G+W*K,Z[1]=Q*G+X*K,Z[2]=$*-K+W*G,Z[3]=Q*-K+X*G,Z}function He8(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=Y[0],G=Y[1];return Z[0]=$*K,Z[1]=Q*K,Z[2]=W*G,Z[3]=X*G,Z}function Ve8(Z,J){var Y=Math.sin(J),$=Math.cos(J);return Z[0]=$,Z[1]=Y,Z[2]=-Y,Z[3]=$,Z}function qe8(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=J[1],Z}function Ue8(Z){return"mat2("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}function Le8(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3])}function we8(Z,J,Y,$){return Z[2]=$[2]/$[0],Y[0]=$[0],Y[1]=$[1],Y[3]=$[3]-Z[2]*Y[1],[Z,J,Y]}function Be8(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z[2]=J[2]+Y[2],Z[3]=J[3]+Y[3],Z}function d71(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z[2]=J[2]-Y[2],Z[3]=J[3]-Y[3],Z}function Oe8(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function Me8(Z,J){var Y=Z[0],$=Z[1],Q=Z[2],W=Z[3],X=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(Y-X)<=P0*Math.max(1,Math.abs(Y),Math.abs(X))&&Math.abs($-K)<=P0*Math.max(1,Math.abs($),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 Ne8(Z,J,Y){return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z[2]=J[2]*Y,Z[3]=J[3]*Y,Z}function Re8(Z,J,Y,$){return Z[0]=J[0]+Y[0]*$,Z[1]=J[1]+Y[1]*$,Z[2]=J[2]+Y[2]*$,Z[3]=J[3]+Y[3]*$,Z}var je8=m71,Pe8=d71;var l1={};b9(l1,{transpose:()=>ve8,translate:()=>xe8,subtract:()=>c71,sub:()=>te8,str:()=>le8,set:()=>Ee8,scale:()=>fe8,rotate:()=>he8,projection:()=>ce8,normalFromMat4:()=>ue8,multiplyScalarAndAdd:()=>ae8,multiplyScalar:()=>ne8,multiply:()=>u71,mul:()=>re8,invert:()=>Se8,identity:()=>Ie8,fromValues:()=>ke8,fromTranslation:()=>ye8,fromScaling:()=>ge8,fromRotation:()=>be8,fromQuat:()=>de8,fromMat4:()=>De8,fromMat2d:()=>me8,frob:()=>pe8,exactEquals:()=>se8,equals:()=>oe8,determinant:()=>Ae8,create:()=>Nh,copy:()=>Te8,clone:()=>Ce8,adjoint:()=>_e8,add:()=>ie8});function Nh(){var Z=new $1(9);if($1!=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 De8(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 Ce8(Z){var J=new $1(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 Te8(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 ke8(Z,J,Y,$,Q,W,X,K,G){var z=new $1(9);return z[0]=Z,z[1]=J,z[2]=Y,z[3]=$,z[4]=Q,z[5]=W,z[6]=X,z[7]=K,z[8]=G,z}function Ee8(Z,J,Y,$,Q,W,X,K,G,z){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=Q,Z[4]=W,Z[5]=X,Z[6]=K,Z[7]=G,Z[8]=z,Z}function Ie8(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 ve8(Z,J){if(Z===J){var Y=J[1],$=J[2],Q=J[5];Z[1]=J[3],Z[2]=J[6],Z[3]=Y,Z[5]=J[7],Z[6]=$,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 Se8(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],H=F*X-K*z,V=-F*W+K*G,q=z*W-X*G,U=Y*H+$*V+Q*q;if(!U)return null;return U=1/U,Z[0]=H*U,Z[1]=(-F*$+Q*z)*U,Z[2]=(K*$-Q*X)*U,Z[3]=V*U,Z[4]=(F*Y-Q*G)*U,Z[5]=(-K*Y+Q*W)*U,Z[6]=q*U,Z[7]=(-z*Y+$*G)*U,Z[8]=(X*Y-$*W)*U,Z}function _e8(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8];return Z[0]=X*F-K*z,Z[1]=Q*z-$*F,Z[2]=$*K-Q*X,Z[3]=K*G-W*F,Z[4]=Y*F-Q*G,Z[5]=Q*W-Y*K,Z[6]=W*z-X*G,Z[7]=$*G-Y*z,Z[8]=Y*X-$*W,Z}function Ae8(Z){var J=Z[0],Y=Z[1],$=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)+Y*(-z*Q+X*K)+$*(G*Q-W*K)}function u71(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],H=J[8],V=Y[0],q=Y[1],U=Y[2],w=Y[3],L=Y[4],O=Y[5],N=Y[6],j=Y[7],R=Y[8];return Z[0]=V*$+q*X+U*z,Z[1]=V*Q+q*K+U*F,Z[2]=V*W+q*G+U*H,Z[3]=w*$+L*X+O*z,Z[4]=w*Q+L*K+O*F,Z[5]=w*W+L*G+O*H,Z[6]=N*$+j*X+R*z,Z[7]=N*Q+j*K+R*F,Z[8]=N*W+j*G+R*H,Z}function xe8(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],H=J[8],V=Y[0],q=Y[1];return Z[0]=$,Z[1]=Q,Z[2]=W,Z[3]=X,Z[4]=K,Z[5]=G,Z[6]=V*$+q*X+z,Z[7]=V*Q+q*K+F,Z[8]=V*W+q*G+H,Z}function he8(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],H=J[8],V=Math.sin(Y),q=Math.cos(Y);return Z[0]=q*$+V*X,Z[1]=q*Q+V*K,Z[2]=q*W+V*G,Z[3]=q*X-V*$,Z[4]=q*K-V*Q,Z[5]=q*G-V*W,Z[6]=z,Z[7]=F,Z[8]=H,Z}function fe8(Z,J,Y){var $=Y[0],Q=Y[1];return Z[0]=$*J[0],Z[1]=$*J[1],Z[2]=$*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 ye8(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 be8(Z,J){var Y=Math.sin(J),$=Math.cos(J);return Z[0]=$,Z[1]=Y,Z[2]=0,Z[3]=-Y,Z[4]=$,Z[5]=0,Z[6]=0,Z[7]=0,Z[8]=1,Z}function ge8(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 me8(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 de8(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=Y+Y,K=$+$,G=Q+Q,z=Y*X,F=$*X,H=$*K,V=Q*X,q=Q*K,U=Q*G,w=W*X,L=W*K,O=W*G;return Z[0]=1-H-U,Z[3]=F-O,Z[6]=V+L,Z[1]=F+O,Z[4]=1-z-U,Z[7]=q-w,Z[2]=V-L,Z[5]=q+w,Z[8]=1-z-H,Z}function ue8(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],H=J[9],V=J[10],q=J[11],U=J[12],w=J[13],L=J[14],O=J[15],N=Y*K-$*X,j=Y*G-Q*X,R=Y*z-W*X,D=$*G-Q*K,P=$*z-W*K,C=Q*z-W*G,T=F*w-H*U,I=F*L-V*U,x=F*O-q*U,S=H*L-V*w,A=H*O-q*w,E=V*O-q*L,v=N*E-j*A+R*S+D*x-P*I+C*T;if(!v)return null;return v=1/v,Z[0]=(K*E-G*A+z*S)*v,Z[1]=(G*x-X*E-z*I)*v,Z[2]=(X*A-K*x+z*T)*v,Z[3]=(Q*A-$*E-W*S)*v,Z[4]=(Y*E-Q*x+W*I)*v,Z[5]=($*x-Y*A-W*T)*v,Z[6]=(w*C-L*P+O*D)*v,Z[7]=(L*R-U*C-O*j)*v,Z[8]=(U*P-w*R+O*N)*v,Z}function ce8(Z,J,Y){return Z[0]=2/J,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=-2/Y,Z[5]=0,Z[6]=-1,Z[7]=1,Z[8]=1,Z}function le8(Z){return"mat3("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+")"}function pe8(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8])}function ie8(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z[2]=J[2]+Y[2],Z[3]=J[3]+Y[3],Z[4]=J[4]+Y[4],Z[5]=J[5]+Y[5],Z[6]=J[6]+Y[6],Z[7]=J[7]+Y[7],Z[8]=J[8]+Y[8],Z}function c71(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z[2]=J[2]-Y[2],Z[3]=J[3]-Y[3],Z[4]=J[4]-Y[4],Z[5]=J[5]-Y[5],Z[6]=J[6]-Y[6],Z[7]=J[7]-Y[7],Z[8]=J[8]-Y[8],Z}function ne8(Z,J,Y){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]*Y,Z[5]=J[5]*Y,Z[6]=J[6]*Y,Z[7]=J[7]*Y,Z[8]=J[8]*Y,Z}function ae8(Z,J,Y,$){return Z[0]=J[0]+Y[0]*$,Z[1]=J[1]+Y[1]*$,Z[2]=J[2]+Y[2]*$,Z[3]=J[3]+Y[3]*$,Z[4]=J[4]+Y[4]*$,Z[5]=J[5]+Y[5]*$,Z[6]=J[6]+Y[6]*$,Z[7]=J[7]+Y[7]*$,Z[8]=J[8]+Y[8]*$,Z}function se8(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 oe8(Z,J){var Y=Z[0],$=Z[1],Q=Z[2],W=Z[3],X=Z[4],K=Z[5],G=Z[6],z=Z[7],F=Z[8],H=J[0],V=J[1],q=J[2],U=J[3],w=J[4],L=J[5],O=J[6],N=J[7],j=J[8];return Math.abs(Y-H)<=P0*Math.max(1,Math.abs(Y),Math.abs(H))&&Math.abs($-V)<=P0*Math.max(1,Math.abs($),Math.abs(V))&&Math.abs(Q-q)<=P0*Math.max(1,Math.abs(Q),Math.abs(q))&&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-N)<=P0*Math.max(1,Math.abs(z),Math.abs(N))&&Math.abs(F-j)<=P0*Math.max(1,Math.abs(F),Math.abs(j))}var re8=u71,te8=c71;var o0={};b9(o0,{transpose:()=>Q06,translate:()=>G06,targetTo:()=>A06,subtract:()=>o71,sub:()=>u06,str:()=>x06,set:()=>$06,scale:()=>z06,rotateZ:()=>q06,rotateY:()=>V06,rotateX:()=>H06,rotate:()=>F06,perspectiveZO:()=>E06,perspectiveNO:()=>a71,perspectiveFromFieldOfView:()=>I06,perspective:()=>k06,orthoZO:()=>S06,orthoNO:()=>s71,ortho:()=>v06,multiplyScalarAndAdd:()=>b06,multiplyScalar:()=>y06,multiply:()=>p71,mul:()=>d06,lookAt:()=>_06,invert:()=>W06,identity:()=>l71,getTranslation:()=>R06,getScaling:()=>n71,getRotation:()=>j06,frustum:()=>T06,fromZRotation:()=>M06,fromYRotation:()=>O06,fromXRotation:()=>B06,fromValues:()=>Y06,fromTranslation:()=>U06,fromScaling:()=>L06,fromRotationTranslationScaleOrigin:()=>D06,fromRotationTranslationScale:()=>P06,fromRotationTranslation:()=>i71,fromRotation:()=>w06,fromQuat2:()=>N06,fromQuat:()=>C06,frob:()=>h06,exactEquals:()=>g06,equals:()=>m06,determinant:()=>K06,create:()=>ee8,copy:()=>J06,clone:()=>Z06,adjoint:()=>X06,add:()=>f06});function ee8(){var Z=new $1(16);if($1!=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 Z06(Z){var J=new $1(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 J06(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 Y06(Z,J,Y,$,Q,W,X,K,G,z,F,H,V,q,U,w){var L=new $1(16);return L[0]=Z,L[1]=J,L[2]=Y,L[3]=$,L[4]=Q,L[5]=W,L[6]=X,L[7]=K,L[8]=G,L[9]=z,L[10]=F,L[11]=H,L[12]=V,L[13]=q,L[14]=U,L[15]=w,L}function $06(Z,J,Y,$,Q,W,X,K,G,z,F,H,V,q,U,w,L){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=Q,Z[4]=W,Z[5]=X,Z[6]=K,Z[7]=G,Z[8]=z,Z[9]=F,Z[10]=H,Z[11]=V,Z[12]=q,Z[13]=U,Z[14]=w,Z[15]=L,Z}function l71(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 Q06(Z,J){if(Z===J){var Y=J[1],$=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]=Y,Z[6]=J[9],Z[7]=J[13],Z[8]=$,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 W06(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],H=J[9],V=J[10],q=J[11],U=J[12],w=J[13],L=J[14],O=J[15],N=Y*K-$*X,j=Y*G-Q*X,R=Y*z-W*X,D=$*G-Q*K,P=$*z-W*K,C=Q*z-W*G,T=F*w-H*U,I=F*L-V*U,x=F*O-q*U,S=H*L-V*w,A=H*O-q*w,E=V*O-q*L,v=N*E-j*A+R*S+D*x-P*I+C*T;if(!v)return null;return v=1/v,Z[0]=(K*E-G*A+z*S)*v,Z[1]=(Q*A-$*E-W*S)*v,Z[2]=(w*C-L*P+O*D)*v,Z[3]=(V*P-H*C-q*D)*v,Z[4]=(G*x-X*E-z*I)*v,Z[5]=(Y*E-Q*x+W*I)*v,Z[6]=(L*R-U*C-O*j)*v,Z[7]=(F*C-V*R+q*j)*v,Z[8]=(X*A-K*x+z*T)*v,Z[9]=($*x-Y*A-W*T)*v,Z[10]=(U*P-w*R+O*N)*v,Z[11]=(H*R-F*P-q*N)*v,Z[12]=(K*I-X*S-G*T)*v,Z[13]=(Y*S-$*I+Q*T)*v,Z[14]=(w*j-U*D-L*N)*v,Z[15]=(F*D-H*j+V*N)*v,Z}function X06(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],H=J[9],V=J[10],q=J[11],U=J[12],w=J[13],L=J[14],O=J[15];return Z[0]=K*(V*O-q*L)-H*(G*O-z*L)+w*(G*q-z*V),Z[1]=-($*(V*O-q*L)-H*(Q*O-W*L)+w*(Q*q-W*V)),Z[2]=$*(G*O-z*L)-K*(Q*O-W*L)+w*(Q*z-W*G),Z[3]=-($*(G*q-z*V)-K*(Q*q-W*V)+H*(Q*z-W*G)),Z[4]=-(X*(V*O-q*L)-F*(G*O-z*L)+U*(G*q-z*V)),Z[5]=Y*(V*O-q*L)-F*(Q*O-W*L)+U*(Q*q-W*V),Z[6]=-(Y*(G*O-z*L)-X*(Q*O-W*L)+U*(Q*z-W*G)),Z[7]=Y*(G*q-z*V)-X*(Q*q-W*V)+F*(Q*z-W*G),Z[8]=X*(H*O-q*w)-F*(K*O-z*w)+U*(K*q-z*H),Z[9]=-(Y*(H*O-q*w)-F*($*O-W*w)+U*($*q-W*H)),Z[10]=Y*(K*O-z*w)-X*($*O-W*w)+U*($*z-W*K),Z[11]=-(Y*(K*q-z*H)-X*($*q-W*H)+F*($*z-W*K)),Z[12]=-(X*(H*L-V*w)-F*(K*L-G*w)+U*(K*V-G*H)),Z[13]=Y*(H*L-V*w)-F*($*L-Q*w)+U*($*V-Q*H),Z[14]=-(Y*(K*L-G*w)-X*($*L-Q*w)+U*($*G-Q*K)),Z[15]=Y*(K*V-G*H)-X*($*V-Q*H)+F*($*G-Q*K),Z}function K06(Z){var J=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],F=Z[9],H=Z[10],V=Z[11],q=Z[12],U=Z[13],w=Z[14],L=Z[15],O=J*X-Y*W,N=J*K-$*W,j=J*G-Q*W,R=Y*K-$*X,D=Y*G-Q*X,P=$*G-Q*K,C=z*U-F*q,T=z*w-H*q,I=z*L-V*q,x=F*w-H*U,S=F*L-V*U,A=H*L-V*w;return O*A-N*S+j*x+R*I-D*T+P*C}function p71(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],H=J[8],V=J[9],q=J[10],U=J[11],w=J[12],L=J[13],O=J[14],N=J[15],j=Y[0],R=Y[1],D=Y[2],P=Y[3];return Z[0]=j*$+R*K+D*H+P*w,Z[1]=j*Q+R*G+D*V+P*L,Z[2]=j*W+R*z+D*q+P*O,Z[3]=j*X+R*F+D*U+P*N,j=Y[4],R=Y[5],D=Y[6],P=Y[7],Z[4]=j*$+R*K+D*H+P*w,Z[5]=j*Q+R*G+D*V+P*L,Z[6]=j*W+R*z+D*q+P*O,Z[7]=j*X+R*F+D*U+P*N,j=Y[8],R=Y[9],D=Y[10],P=Y[11],Z[8]=j*$+R*K+D*H+P*w,Z[9]=j*Q+R*G+D*V+P*L,Z[10]=j*W+R*z+D*q+P*O,Z[11]=j*X+R*F+D*U+P*N,j=Y[12],R=Y[13],D=Y[14],P=Y[15],Z[12]=j*$+R*K+D*H+P*w,Z[13]=j*Q+R*G+D*V+P*L,Z[14]=j*W+R*z+D*q+P*O,Z[15]=j*X+R*F+D*U+P*N,Z}function G06(Z,J,Y){var $=Y[0],Q=Y[1],W=Y[2],X,K,G,z,F,H,V,q,U,w,L,O;if(J===Z)Z[12]=J[0]*$+J[4]*Q+J[8]*W+J[12],Z[13]=J[1]*$+J[5]*Q+J[9]*W+J[13],Z[14]=J[2]*$+J[6]*Q+J[10]*W+J[14],Z[15]=J[3]*$+J[7]*Q+J[11]*W+J[15];else X=J[0],K=J[1],G=J[2],z=J[3],F=J[4],H=J[5],V=J[6],q=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]=F,Z[5]=H,Z[6]=V,Z[7]=q,Z[8]=U,Z[9]=w,Z[10]=L,Z[11]=O,Z[12]=X*$+F*Q+U*W+J[12],Z[13]=K*$+H*Q+w*W+J[13],Z[14]=G*$+V*Q+L*W+J[14],Z[15]=z*$+q*Q+O*W+J[15];return Z}function z06(Z,J,Y){var $=Y[0],Q=Y[1],W=Y[2];return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z[3]=J[3]*$,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 F06(Z,J,Y,$){var Q=$[0],W=$[1],X=$[2],K=Math.hypot(Q,W,X),G,z,F,H,V,q,U,w,L,O,N,j,R,D,P,C,T,I,x,S,A,E,v,f;if(K<P0)return null;if(K=1/K,Q*=K,W*=K,X*=K,G=Math.sin(Y),z=Math.cos(Y),F=1-z,H=J[0],V=J[1],q=J[2],U=J[3],w=J[4],L=J[5],O=J[6],N=J[7],j=J[8],R=J[9],D=J[10],P=J[11],C=Q*Q*F+z,T=W*Q*F+X*G,I=X*Q*F-W*G,x=Q*W*F-X*G,S=W*W*F+z,A=X*W*F+Q*G,E=Q*X*F+W*G,v=W*X*F-Q*G,f=X*X*F+z,Z[0]=H*C+w*T+j*I,Z[1]=V*C+L*T+R*I,Z[2]=q*C+O*T+D*I,Z[3]=U*C+N*T+P*I,Z[4]=H*x+w*S+j*A,Z[5]=V*x+L*S+R*A,Z[6]=q*x+O*S+D*A,Z[7]=U*x+N*S+P*A,Z[8]=H*E+w*v+j*f,Z[9]=V*E+L*v+R*f,Z[10]=q*E+O*v+D*f,Z[11]=U*E+N*v+P*f,J!==Z)Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z}function H06(Z,J,Y){var $=Math.sin(Y),Q=Math.cos(Y),W=J[4],X=J[5],K=J[6],G=J[7],z=J[8],F=J[9],H=J[10],V=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*$,Z[5]=X*Q+F*$,Z[6]=K*Q+H*$,Z[7]=G*Q+V*$,Z[8]=z*Q-W*$,Z[9]=F*Q-X*$,Z[10]=H*Q-K*$,Z[11]=V*Q-G*$,Z}function V06(Z,J,Y){var $=Math.sin(Y),Q=Math.cos(Y),W=J[0],X=J[1],K=J[2],G=J[3],z=J[8],F=J[9],H=J[10],V=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*$,Z[1]=X*Q-F*$,Z[2]=K*Q-H*$,Z[3]=G*Q-V*$,Z[8]=W*$+z*Q,Z[9]=X*$+F*Q,Z[10]=K*$+H*Q,Z[11]=G*$+V*Q,Z}function q06(Z,J,Y){var $=Math.sin(Y),Q=Math.cos(Y),W=J[0],X=J[1],K=J[2],G=J[3],z=J[4],F=J[5],H=J[6],V=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*$,Z[1]=X*Q+F*$,Z[2]=K*Q+H*$,Z[3]=G*Q+V*$,Z[4]=z*Q-W*$,Z[5]=F*Q-X*$,Z[6]=H*Q-K*$,Z[7]=V*Q-G*$,Z}function U06(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 L06(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 w06(Z,J,Y){var $=Y[0],Q=Y[1],W=Y[2],X=Math.hypot($,Q,W),K,G,z;if(X<P0)return null;return X=1/X,$*=X,Q*=X,W*=X,K=Math.sin(J),G=Math.cos(J),z=1-G,Z[0]=$*$*z+G,Z[1]=Q*$*z+W*K,Z[2]=W*$*z-Q*K,Z[3]=0,Z[4]=$*Q*z-W*K,Z[5]=Q*Q*z+G,Z[6]=W*Q*z+$*K,Z[7]=0,Z[8]=$*W*z+Q*K,Z[9]=Q*W*z-$*K,Z[10]=W*W*z+G,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function B06(Z,J){var Y=Math.sin(J),$=Math.cos(J);return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=$,Z[6]=Y,Z[7]=0,Z[8]=0,Z[9]=-Y,Z[10]=$,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function O06(Z,J){var Y=Math.sin(J),$=Math.cos(J);return Z[0]=$,Z[1]=0,Z[2]=-Y,Z[3]=0,Z[4]=0,Z[5]=1,Z[6]=0,Z[7]=0,Z[8]=Y,Z[9]=0,Z[10]=$,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function M06(Z,J){var Y=Math.sin(J),$=Math.cos(J);return Z[0]=$,Z[1]=Y,Z[2]=0,Z[3]=0,Z[4]=-Y,Z[5]=$,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 i71(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=$+$,G=Q+Q,z=W+W,F=$*K,H=$*G,V=$*z,q=Q*G,U=Q*z,w=W*z,L=X*K,O=X*G,N=X*z;return Z[0]=1-(q+w),Z[1]=H+N,Z[2]=V-O,Z[3]=0,Z[4]=H-N,Z[5]=1-(F+w),Z[6]=U+L,Z[7]=0,Z[8]=V+O,Z[9]=U-L,Z[10]=1-(F+q),Z[11]=0,Z[12]=Y[0],Z[13]=Y[1],Z[14]=Y[2],Z[15]=1,Z}function N06(Z,J){var Y=new $1(3),$=-J[0],Q=-J[1],W=-J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],H=$*$+Q*Q+W*W+X*X;if(H>0)Y[0]=(K*X+F*$+G*W-z*Q)*2/H,Y[1]=(G*X+F*Q+z*$-K*W)*2/H,Y[2]=(z*X+F*W+K*Q-G*$)*2/H;else Y[0]=(K*X+F*$+G*W-z*Q)*2,Y[1]=(G*X+F*Q+z*$-K*W)*2,Y[2]=(z*X+F*W+K*Q-G*$)*2;return i71(Z,J,Y),Z}function R06(Z,J){return Z[0]=J[12],Z[1]=J[13],Z[2]=J[14],Z}function n71(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[4],X=J[5],K=J[6],G=J[8],z=J[9],F=J[10];return Z[0]=Math.hypot(Y,$,Q),Z[1]=Math.hypot(W,X,K),Z[2]=Math.hypot(G,z,F),Z}function j06(Z,J){var Y=new $1(3);n71(Y,J);var $=1/Y[0],Q=1/Y[1],W=1/Y[2],X=J[0]*$,K=J[1]*Q,G=J[2]*W,z=J[4]*$,F=J[5]*Q,H=J[6]*W,V=J[8]*$,q=J[9]*Q,U=J[10]*W,w=X+F+U,L=0;if(w>0)L=Math.sqrt(w+1)*2,Z[3]=0.25*L,Z[0]=(H-q)/L,Z[1]=(V-G)/L,Z[2]=(K-z)/L;else if(X>F&&X>U)L=Math.sqrt(1+X-F-U)*2,Z[3]=(H-q)/L,Z[0]=0.25*L,Z[1]=(K+z)/L,Z[2]=(V+G)/L;else if(F>U)L=Math.sqrt(1+F-X-U)*2,Z[3]=(V-G)/L,Z[0]=(K+z)/L,Z[1]=0.25*L,Z[2]=(H+q)/L;else L=Math.sqrt(1+U-X-F)*2,Z[3]=(K-z)/L,Z[0]=(V+G)/L,Z[1]=(H+q)/L,Z[2]=0.25*L;return Z}function P06(Z,J,Y,$){var Q=J[0],W=J[1],X=J[2],K=J[3],G=Q+Q,z=W+W,F=X+X,H=Q*G,V=Q*z,q=Q*F,U=W*z,w=W*F,L=X*F,O=K*G,N=K*z,j=K*F,R=$[0],D=$[1],P=$[2];return Z[0]=(1-(U+L))*R,Z[1]=(V+j)*R,Z[2]=(q-N)*R,Z[3]=0,Z[4]=(V-j)*D,Z[5]=(1-(H+L))*D,Z[6]=(w+O)*D,Z[7]=0,Z[8]=(q+N)*P,Z[9]=(w-O)*P,Z[10]=(1-(H+U))*P,Z[11]=0,Z[12]=Y[0],Z[13]=Y[1],Z[14]=Y[2],Z[15]=1,Z}function D06(Z,J,Y,$,Q){var W=J[0],X=J[1],K=J[2],G=J[3],z=W+W,F=X+X,H=K+K,V=W*z,q=W*F,U=W*H,w=X*F,L=X*H,O=K*H,N=G*z,j=G*F,R=G*H,D=$[0],P=$[1],C=$[2],T=Q[0],I=Q[1],x=Q[2],S=(1-(w+O))*D,A=(q+R)*D,E=(U-j)*D,v=(q-R)*P,f=(1-(V+O))*P,p=(L+N)*P,n=(U+j)*C,o=(L-N)*C,Y0=(1-(V+w))*C;return Z[0]=S,Z[1]=A,Z[2]=E,Z[3]=0,Z[4]=v,Z[5]=f,Z[6]=p,Z[7]=0,Z[8]=n,Z[9]=o,Z[10]=Y0,Z[11]=0,Z[12]=Y[0]+T-(S*T+v*I+n*x),Z[13]=Y[1]+I-(A*T+f*I+o*x),Z[14]=Y[2]+x-(E*T+p*I+Y0*x),Z[15]=1,Z}function C06(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=Y+Y,K=$+$,G=Q+Q,z=Y*X,F=$*X,H=$*K,V=Q*X,q=Q*K,U=Q*G,w=W*X,L=W*K,O=W*G;return Z[0]=1-H-U,Z[1]=F+O,Z[2]=V-L,Z[3]=0,Z[4]=F-O,Z[5]=1-z-U,Z[6]=q+w,Z[7]=0,Z[8]=V+L,Z[9]=q-w,Z[10]=1-z-H,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function T06(Z,J,Y,$,Q,W,X){var K=1/(Y-J),G=1/(Q-$),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]=(Y+J)*K,Z[9]=(Q+$)*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 a71(Z,J,Y,$,Q){var W=1/Math.tan(J/2),X;if(Z[0]=W/Y,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/($-Q),Z[10]=(Q+$)*X,Z[14]=2*Q*$*X;else Z[10]=-1,Z[14]=-2*$;return Z}var k06=a71;function E06(Z,J,Y,$,Q){var W=1/Math.tan(J/2),X;if(Z[0]=W/Y,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/($-Q),Z[10]=Q*X,Z[14]=Q*$*X;else Z[10]=-1,Z[14]=-$;return Z}function I06(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-$),Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=$*Y/(Y-$),Z[15]=0,Z}function s71(Z,J,Y,$,Q,W,X){var K=1/(J-Y),G=1/($-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+Y)*K,Z[13]=(Q+$)*G,Z[14]=(X+W)*z,Z[15]=1,Z}var v06=s71;function S06(Z,J,Y,$,Q,W,X){var K=1/(J-Y),G=1/($-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+Y)*K,Z[13]=(Q+$)*G,Z[14]=W*z,Z[15]=1,Z}function _06(Z,J,Y,$){var Q,W,X,K,G,z,F,H,V,q,U=J[0],w=J[1],L=J[2],O=$[0],N=$[1],j=$[2],R=Y[0],D=Y[1],P=Y[2];if(Math.abs(U-R)<P0&&Math.abs(w-D)<P0&&Math.abs(L-P)<P0)return l71(Z);if(F=U-R,H=w-D,V=L-P,q=1/Math.hypot(F,H,V),F*=q,H*=q,V*=q,Q=N*V-j*H,W=j*F-O*V,X=O*H-N*F,q=Math.hypot(Q,W,X),!q)Q=0,W=0,X=0;else q=1/q,Q*=q,W*=q,X*=q;if(K=H*X-V*W,G=V*Q-F*X,z=F*W-H*Q,q=Math.hypot(K,G,z),!q)K=0,G=0,z=0;else q=1/q,K*=q,G*=q,z*=q;return Z[0]=Q,Z[1]=K,Z[2]=F,Z[3]=0,Z[4]=W,Z[5]=G,Z[6]=H,Z[7]=0,Z[8]=X,Z[9]=z,Z[10]=V,Z[11]=0,Z[12]=-(Q*U+W*w+X*L),Z[13]=-(K*U+G*w+z*L),Z[14]=-(F*U+H*w+V*L),Z[15]=1,Z}function A06(Z,J,Y,$){var Q=J[0],W=J[1],X=J[2],K=$[0],G=$[1],z=$[2],F=Q-Y[0],H=W-Y[1],V=X-Y[2],q=F*F+H*H+V*V;if(q>0)q=1/Math.sqrt(q),F*=q,H*=q,V*=q;var U=G*V-z*H,w=z*F-K*V,L=K*H-G*F;if(q=U*U+w*w+L*L,q>0)q=1/Math.sqrt(q),U*=q,w*=q,L*=q;return Z[0]=U,Z[1]=w,Z[2]=L,Z[3]=0,Z[4]=H*L-V*w,Z[5]=V*U-F*L,Z[6]=F*w-H*U,Z[7]=0,Z[8]=F,Z[9]=H,Z[10]=V,Z[11]=0,Z[12]=Q,Z[13]=W,Z[14]=X,Z[15]=1,Z}function x06(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 h06(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 f06(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z[2]=J[2]+Y[2],Z[3]=J[3]+Y[3],Z[4]=J[4]+Y[4],Z[5]=J[5]+Y[5],Z[6]=J[6]+Y[6],Z[7]=J[7]+Y[7],Z[8]=J[8]+Y[8],Z[9]=J[9]+Y[9],Z[10]=J[10]+Y[10],Z[11]=J[11]+Y[11],Z[12]=J[12]+Y[12],Z[13]=J[13]+Y[13],Z[14]=J[14]+Y[14],Z[15]=J[15]+Y[15],Z}function o71(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z[2]=J[2]-Y[2],Z[3]=J[3]-Y[3],Z[4]=J[4]-Y[4],Z[5]=J[5]-Y[5],Z[6]=J[6]-Y[6],Z[7]=J[7]-Y[7],Z[8]=J[8]-Y[8],Z[9]=J[9]-Y[9],Z[10]=J[10]-Y[10],Z[11]=J[11]-Y[11],Z[12]=J[12]-Y[12],Z[13]=J[13]-Y[13],Z[14]=J[14]-Y[14],Z[15]=J[15]-Y[15],Z}function y06(Z,J,Y){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]*Y,Z[5]=J[5]*Y,Z[6]=J[6]*Y,Z[7]=J[7]*Y,Z[8]=J[8]*Y,Z[9]=J[9]*Y,Z[10]=J[10]*Y,Z[11]=J[11]*Y,Z[12]=J[12]*Y,Z[13]=J[13]*Y,Z[14]=J[14]*Y,Z[15]=J[15]*Y,Z}function b06(Z,J,Y,$){return Z[0]=J[0]+Y[0]*$,Z[1]=J[1]+Y[1]*$,Z[2]=J[2]+Y[2]*$,Z[3]=J[3]+Y[3]*$,Z[4]=J[4]+Y[4]*$,Z[5]=J[5]+Y[5]*$,Z[6]=J[6]+Y[6]*$,Z[7]=J[7]+Y[7]*$,Z[8]=J[8]+Y[8]*$,Z[9]=J[9]+Y[9]*$,Z[10]=J[10]+Y[10]*$,Z[11]=J[11]+Y[11]*$,Z[12]=J[12]+Y[12]*$,Z[13]=J[13]+Y[13]*$,Z[14]=J[14]+Y[14]*$,Z[15]=J[15]+Y[15]*$,Z}function g06(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 m06(Z,J){var Y=Z[0],$=Z[1],Q=Z[2],W=Z[3],X=Z[4],K=Z[5],G=Z[6],z=Z[7],F=Z[8],H=Z[9],V=Z[10],q=Z[11],U=Z[12],w=Z[13],L=Z[14],O=Z[15],N=J[0],j=J[1],R=J[2],D=J[3],P=J[4],C=J[5],T=J[6],I=J[7],x=J[8],S=J[9],A=J[10],E=J[11],v=J[12],f=J[13],p=J[14],n=J[15];return Math.abs(Y-N)<=P0*Math.max(1,Math.abs(Y),Math.abs(N))&&Math.abs($-j)<=P0*Math.max(1,Math.abs($),Math.abs(j))&&Math.abs(Q-R)<=P0*Math.max(1,Math.abs(Q),Math.abs(R))&&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-I)<=P0*Math.max(1,Math.abs(z),Math.abs(I))&&Math.abs(F-x)<=P0*Math.max(1,Math.abs(F),Math.abs(x))&&Math.abs(H-S)<=P0*Math.max(1,Math.abs(H),Math.abs(S))&&Math.abs(V-A)<=P0*Math.max(1,Math.abs(V),Math.abs(A))&&Math.abs(q-E)<=P0*Math.max(1,Math.abs(q),Math.abs(E))&&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 d06=p71,u06=o71;var R1={};b9(R1,{str:()=>b16,squaredLength:()=>CZ1,sqrLen:()=>n16,sqlerp:()=>r16,slerp:()=>LM,setAxisAngle:()=>BZ1,setAxes:()=>t16,set:()=>u16,scale:()=>jZ1,rotationTo:()=>o16,rotateZ:()=>S16,rotateY:()=>v16,rotateX:()=>I16,random:()=>x16,pow:()=>A16,normalize:()=>Dh,multiply:()=>OZ1,mul:()=>l16,ln:()=>NZ1,lerp:()=>p16,length:()=>DZ1,len:()=>i16,invert:()=>h16,identity:()=>T16,getAxisAngle:()=>k16,getAngle:()=>E16,fromValues:()=>m16,fromMat3:()=>RZ1,fromEuler:()=>y16,exp:()=>MZ1,exactEquals:()=>a16,equals:()=>s16,dot:()=>PZ1,create:()=>Ph,copy:()=>d16,conjugate:()=>f16,clone:()=>g16,calculateW:()=>_16,add:()=>c16});var t0={};b9(t0,{zero:()=>q16,transformQuat:()=>G16,transformMat4:()=>X16,transformMat3:()=>K16,subtract:()=>t71,sub:()=>B16,str:()=>U16,squaredLength:()=>$Z1,squaredDistance:()=>YZ1,sqrLen:()=>j16,sqrDist:()=>R16,set:()=>p06,scaleAndAdd:()=>e06,scale:()=>t06,round:()=>r06,rotateZ:()=>H16,rotateY:()=>F16,rotateX:()=>z16,random:()=>W16,normalize:()=>Rh,negate:()=>Z16,multiply:()=>e71,mul:()=>O16,min:()=>s06,max:()=>o06,lerp:()=>Y16,length:()=>r71,len:()=>jh,inverse:()=>J16,hermite:()=>$16,fromValues:()=>qM,forEach:()=>P16,floor:()=>a06,exactEquals:()=>L16,equals:()=>w16,dot:()=>UM,divide:()=>ZZ1,div:()=>M16,distance:()=>JZ1,dist:()=>N16,cross:()=>aH,create:()=>VM,copy:()=>l06,clone:()=>c06,ceil:()=>n06,bezier:()=>Q16,angle:()=>V16,add:()=>i06});function VM(){var Z=new $1(3);if($1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function c06(Z){var J=new $1(3);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J}function r71(Z){var J=Z[0],Y=Z[1],$=Z[2];return Math.hypot(J,Y,$)}function qM(Z,J,Y){var $=new $1(3);return $[0]=Z,$[1]=J,$[2]=Y,$}function l06(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z}function p06(Z,J,Y,$){return Z[0]=J,Z[1]=Y,Z[2]=$,Z}function i06(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z[2]=J[2]+Y[2],Z}function t71(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z[2]=J[2]-Y[2],Z}function e71(Z,J,Y){return Z[0]=J[0]*Y[0],Z[1]=J[1]*Y[1],Z[2]=J[2]*Y[2],Z}function ZZ1(Z,J,Y){return Z[0]=J[0]/Y[0],Z[1]=J[1]/Y[1],Z[2]=J[2]/Y[2],Z}function n06(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z[2]=Math.ceil(J[2]),Z}function a06(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z[2]=Math.floor(J[2]),Z}function s06(Z,J,Y){return Z[0]=Math.min(J[0],Y[0]),Z[1]=Math.min(J[1],Y[1]),Z[2]=Math.min(J[2],Y[2]),Z}function o06(Z,J,Y){return Z[0]=Math.max(J[0],Y[0]),Z[1]=Math.max(J[1],Y[1]),Z[2]=Math.max(J[2],Y[2]),Z}function r06(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z[2]=Math.round(J[2]),Z}function t06(Z,J,Y){return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z[2]=J[2]*Y,Z}function e06(Z,J,Y,$){return Z[0]=J[0]+Y[0]*$,Z[1]=J[1]+Y[1]*$,Z[2]=J[2]+Y[2]*$,Z}function JZ1(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1],Q=J[2]-Z[2];return Math.hypot(Y,$,Q)}function YZ1(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1],Q=J[2]-Z[2];return Y*Y+$*$+Q*Q}function $Z1(Z){var J=Z[0],Y=Z[1],$=Z[2];return J*J+Y*Y+$*$}function Z16(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z}function J16(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z[2]=1/J[2],Z}function Rh(Z,J){var Y=J[0],$=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 UM(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]}function aH(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=Y[0],K=Y[1],G=Y[2];return Z[0]=Q*G-W*K,Z[1]=W*X-$*G,Z[2]=$*K-Q*X,Z}function Y16(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 $16(Z,J,Y,$,Q,W){var X=W*W,K=X*(2*W-3)+1,G=X*(W-2)+W,z=X*(W-1),F=X*(3-2*W);return Z[0]=J[0]*K+Y[0]*G+$[0]*z+Q[0]*F,Z[1]=J[1]*K+Y[1]*G+$[1]*z+Q[1]*F,Z[2]=J[2]*K+Y[2]*G+$[2]*z+Q[2]*F,Z}function Q16(Z,J,Y,$,Q,W){var X=1-W,K=X*X,G=W*W,z=K*X,F=3*W*K,H=3*G*X,V=G*W;return Z[0]=J[0]*z+Y[0]*F+$[0]*H+Q[0]*V,Z[1]=J[1]*z+Y[1]*F+$[1]*H+Q[1]*V,Z[2]=J[2]*z+Y[2]*F+$[2]*H+Q[2]*V,Z}function W16(Z,J){J=J||1;var Y=M7()*2*Math.PI,$=M7()*2-1,Q=Math.sqrt(1-$*$)*J;return Z[0]=Math.cos(Y)*Q,Z[1]=Math.sin(Y)*Q,Z[2]=$*J,Z}function X16(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=Y[3]*$+Y[7]*Q+Y[11]*W+Y[15];return X=X||1,Z[0]=(Y[0]*$+Y[4]*Q+Y[8]*W+Y[12])/X,Z[1]=(Y[1]*$+Y[5]*Q+Y[9]*W+Y[13])/X,Z[2]=(Y[2]*$+Y[6]*Q+Y[10]*W+Y[14])/X,Z}function K16(Z,J,Y){var $=J[0],Q=J[1],W=J[2];return Z[0]=$*Y[0]+Q*Y[3]+W*Y[6],Z[1]=$*Y[1]+Q*Y[4]+W*Y[7],Z[2]=$*Y[2]+Q*Y[5]+W*Y[8],Z}function G16(Z,J,Y){var $=Y[0],Q=Y[1],W=Y[2],X=Y[3],K=J[0],G=J[1],z=J[2],F=Q*z-W*G,H=W*K-$*z,V=$*G-Q*K,q=Q*V-W*H,U=W*F-$*V,w=$*H-Q*F,L=X*2;return F*=L,H*=L,V*=L,q*=2,U*=2,w*=2,Z[0]=K+F+q,Z[1]=G+H+U,Z[2]=z+V+w,Z}function z16(Z,J,Y,$){var Q=[],W=[];return Q[0]=J[0]-Y[0],Q[1]=J[1]-Y[1],Q[2]=J[2]-Y[2],W[0]=Q[0],W[1]=Q[1]*Math.cos($)-Q[2]*Math.sin($),W[2]=Q[1]*Math.sin($)+Q[2]*Math.cos($),Z[0]=W[0]+Y[0],Z[1]=W[1]+Y[1],Z[2]=W[2]+Y[2],Z}function F16(Z,J,Y,$){var Q=[],W=[];return Q[0]=J[0]-Y[0],Q[1]=J[1]-Y[1],Q[2]=J[2]-Y[2],W[0]=Q[2]*Math.sin($)+Q[0]*Math.cos($),W[1]=Q[1],W[2]=Q[2]*Math.cos($)-Q[0]*Math.sin($),Z[0]=W[0]+Y[0],Z[1]=W[1]+Y[1],Z[2]=W[2]+Y[2],Z}function H16(Z,J,Y,$){var Q=[],W=[];return Q[0]=J[0]-Y[0],Q[1]=J[1]-Y[1],Q[2]=J[2]-Y[2],W[0]=Q[0]*Math.cos($)-Q[1]*Math.sin($),W[1]=Q[0]*Math.sin($)+Q[1]*Math.cos($),W[2]=Q[2],Z[0]=W[0]+Y[0],Z[1]=W[1]+Y[1],Z[2]=W[2]+Y[2],Z}function V16(Z,J){var Y=Z[0],$=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),F=G*z,H=F&&UM(Z,J)/F;return Math.acos(Math.min(Math.max(H,-1),1))}function q16(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z}function U16(Z){return"vec3("+Z[0]+", "+Z[1]+", "+Z[2]+")"}function L16(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]}function w16(Z,J){var Y=Z[0],$=Z[1],Q=Z[2],W=J[0],X=J[1],K=J[2];return Math.abs(Y-W)<=P0*Math.max(1,Math.abs(Y),Math.abs(W))&&Math.abs($-X)<=P0*Math.max(1,Math.abs($),Math.abs(X))&&Math.abs(Q-K)<=P0*Math.max(1,Math.abs(Q),Math.abs(K))}var B16=t71,O16=e71,M16=ZZ1,N16=JZ1,R16=YZ1,jh=r71,j16=$Z1,P16=function(){var Z=VM();return function(J,Y,$,Q,W,X){var K,G;if(!Y)Y=3;if(!$)$=0;if(Q)G=Math.min(Q*Y+$,J.length);else G=J.length;for(K=$;K<G;K+=Y)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 D16(){var Z=new $1(4);if($1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function QZ1(Z){var J=new $1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function WZ1(Z,J,Y,$){var Q=new $1(4);return Q[0]=Z,Q[1]=J,Q[2]=Y,Q[3]=$,Q}function XZ1(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function KZ1(Z,J,Y,$,Q){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=Q,Z}function GZ1(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z[2]=J[2]+Y[2],Z[3]=J[3]+Y[3],Z}function zZ1(Z,J,Y){return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z[2]=J[2]*Y,Z[3]=J[3]*Y,Z}function FZ1(Z){var J=Z[0],Y=Z[1],$=Z[2],Q=Z[3];return Math.hypot(J,Y,$,Q)}function HZ1(Z){var J=Z[0],Y=Z[1],$=Z[2],Q=Z[3];return J*J+Y*Y+$*$+Q*Q}function VZ1(Z,J){var Y=J[0],$=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]=Y*X,Z[1]=$*X,Z[2]=Q*X,Z[3]=W*X,Z}function qZ1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}function UZ1(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 LZ1(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function wZ1(Z,J){var Y=Z[0],$=Z[1],Q=Z[2],W=Z[3],X=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(Y-X)<=P0*Math.max(1,Math.abs(Y),Math.abs(X))&&Math.abs($-K)<=P0*Math.max(1,Math.abs($),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 Hi6=function(){var Z=D16();return function(J,Y,$,Q,W,X){var K,G;if(!Y)Y=4;if(!$)$=0;if(Q)G=Math.min(Q*Y+$,J.length);else G=J.length;for(K=$;K<G;K+=Y)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 Ph(){var Z=new $1(4);if($1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z[3]=1,Z}function T16(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=1,Z}function BZ1(Z,J,Y){Y=Y*0.5;var $=Math.sin(Y);return Z[0]=$*J[0],Z[1]=$*J[1],Z[2]=$*J[2],Z[3]=Math.cos(Y),Z}function k16(Z,J){var Y=Math.acos(J[3])*2,$=Math.sin(Y/2);if($>P0)Z[0]=J[0]/$,Z[1]=J[1]/$,Z[2]=J[2]/$;else Z[0]=1,Z[1]=0,Z[2]=0;return Y}function E16(Z,J){var Y=PZ1(Z,J);return Math.acos(2*Y*Y-1)}function OZ1(Z,J,Y){var $=J[0],Q=J[1],W=J[2],X=J[3],K=Y[0],G=Y[1],z=Y[2],F=Y[3];return Z[0]=$*F+X*K+Q*z-W*G,Z[1]=Q*F+X*G+W*K-$*z,Z[2]=W*F+X*z+$*G-Q*K,Z[3]=X*F-$*K-Q*G-W*z,Z}function I16(Z,J,Y){Y*=0.5;var $=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G+X*K,Z[1]=Q*G+W*K,Z[2]=W*G-Q*K,Z[3]=X*G-$*K,Z}function v16(Z,J,Y){Y*=0.5;var $=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G-W*K,Z[1]=Q*G+X*K,Z[2]=W*G+$*K,Z[3]=X*G-Q*K,Z}function S16(Z,J,Y){Y*=0.5;var $=J[0],Q=J[1],W=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G+Q*K,Z[1]=Q*G-$*K,Z[2]=W*G+X*K,Z[3]=X*G-W*K,Z}function _16(Z,J){var Y=J[0],$=J[1],Q=J[2];return Z[0]=Y,Z[1]=$,Z[2]=Q,Z[3]=Math.sqrt(Math.abs(1-Y*Y-$*$-Q*Q)),Z}function MZ1(Z,J){var Y=J[0],$=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]=Y*G,Z[1]=$*G,Z[2]=Q*G,Z[3]=K*Math.cos(X),Z}function NZ1(Z,J){var Y=J[0],$=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]=Y*K,Z[1]=$*K,Z[2]=Q*K,Z[3]=0.5*Math.log(Y*Y+$*$+Q*Q+W*W),Z}function A16(Z,J,Y){return NZ1(Z,J),jZ1(Z,Z,Y),MZ1(Z,Z),Z}function LM(Z,J,Y,$){var Q=J[0],W=J[1],X=J[2],K=J[3],G=Y[0],z=Y[1],F=Y[2],H=Y[3],V,q,U,w,L;if(q=Q*G+W*z+X*F+K*H,q<0)q=-q,G=-G,z=-z,F=-F,H=-H;if(1-q>P0)V=Math.acos(q),U=Math.sin(V),w=Math.sin((1-$)*V)/U,L=Math.sin($*V)/U;else w=1-$,L=$;return Z[0]=w*Q+L*G,Z[1]=w*W+L*z,Z[2]=w*X+L*F,Z[3]=w*K+L*H,Z}function x16(Z){var J=M7(),Y=M7(),$=M7(),Q=Math.sqrt(1-J),W=Math.sqrt(J);return Z[0]=Q*Math.sin(2*Math.PI*Y),Z[1]=Q*Math.cos(2*Math.PI*Y),Z[2]=W*Math.sin(2*Math.PI*$),Z[3]=W*Math.cos(2*Math.PI*$),Z}function h16(Z,J){var Y=J[0],$=J[1],Q=J[2],W=J[3],X=Y*Y+$*$+Q*Q+W*W,K=X?1/X:0;return Z[0]=-Y*K,Z[1]=-$*K,Z[2]=-Q*K,Z[3]=W*K,Z}function f16(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z[3]=J[3],Z}function RZ1(Z,J){var Y=J[0]+J[4]+J[8],$;if(Y>0)$=Math.sqrt(Y+1),Z[3]=0.5*$,$=0.5/$,Z[0]=(J[5]-J[7])*$,Z[1]=(J[6]-J[2])*$,Z[2]=(J[1]-J[3])*$;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;$=Math.sqrt(J[Q*3+Q]-J[W*3+W]-J[X*3+X]+1),Z[Q]=0.5*$,$=0.5/$,Z[3]=(J[W*3+X]-J[X*3+W])*$,Z[W]=(J[W*3+Q]+J[Q*3+W])*$,Z[X]=(J[X*3+Q]+J[Q*3+X])*$}return Z}function y16(Z,J,Y,$){var Q=0.5*Math.PI/180;J*=Q,Y*=Q,$*=Q;var W=Math.sin(J),X=Math.cos(J),K=Math.sin(Y),G=Math.cos(Y),z=Math.sin($),F=Math.cos($);return Z[0]=W*G*F-X*K*z,Z[1]=X*K*F+W*G*z,Z[2]=X*G*z-W*K*F,Z[3]=X*G*F+W*K*z,Z}function b16(Z){return"quat("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}var g16=QZ1,m16=WZ1,d16=XZ1,u16=KZ1,c16=GZ1,l16=OZ1,jZ1=zZ1,PZ1=qZ1,p16=UZ1,DZ1=FZ1,i16=DZ1,CZ1=HZ1,n16=CZ1,Dh=VZ1,a16=LZ1,s16=wZ1,o16=function(){var Z=VM(),J=qM(1,0,0),Y=qM(0,1,0);return function($,Q,W){var X=UM(Q,W);if(X<-0.999999){if(aH(Z,J,Q),jh(Z)<0.000001)aH(Z,Y,Q);return Rh(Z,Z),BZ1($,Z,Math.PI),$}else if(X>0.999999)return $[0]=0,$[1]=0,$[2]=0,$[3]=1,$;else return aH(Z,Q,W),$[0]=Z[0],$[1]=Z[1],$[2]=Z[2],$[3]=1+X,Dh($,$)}}(),r16=function(){var Z=Ph(),J=Ph();return function(Y,$,Q,W,X,K){return LM(Z,$,X,K),LM(J,Q,W,K),LM(Y,Z,J,2*K*(1-K)),Y}}(),t16=function(){var Z=Nh();return function(J,Y,$,Q){return Z[0]=$[0],Z[3]=$[1],Z[6]=$[2],Z[1]=Q[0],Z[4]=Q[1],Z[7]=Q[2],Z[2]=-Y[0],Z[5]=-Y[1],Z[8]=-Y[2],Dh(J,RZ1(J,Z))}}();var X1={};b9(X1,{zero:()=>D86,transformMat4:()=>R86,transformMat3:()=>N86,transformMat2d:()=>M86,transformMat2:()=>O86,subtract:()=>kZ1,sub:()=>I86,str:()=>C86,squaredLength:()=>AZ1,squaredDistance:()=>SZ1,sqrLen:()=>x86,sqrDist:()=>A86,set:()=>Y86,scaleAndAdd:()=>F86,scale:()=>z86,round:()=>G86,rotate:()=>j86,random:()=>B86,normalize:()=>q86,negate:()=>H86,multiply:()=>EZ1,mul:()=>v86,min:()=>X86,max:()=>K86,lerp:()=>w86,length:()=>_Z1,len:()=>E86,inverse:()=>V86,fromValues:()=>Z86,forEach:()=>h86,floor:()=>W86,exactEquals:()=>T86,equals:()=>k86,dot:()=>U86,divide:()=>IZ1,div:()=>S86,distance:()=>vZ1,dist:()=>_86,cross:()=>L86,create:()=>TZ1,copy:()=>J86,clone:()=>e16,ceil:()=>Q86,angle:()=>P86,add:()=>$86});function TZ1(){var Z=new $1(2);if($1!=Float32Array)Z[0]=0,Z[1]=0;return Z}function e16(Z){var J=new $1(2);return J[0]=Z[0],J[1]=Z[1],J}function Z86(Z,J){var Y=new $1(2);return Y[0]=Z,Y[1]=J,Y}function J86(Z,J){return Z[0]=J[0],Z[1]=J[1],Z}function Y86(Z,J,Y){return Z[0]=J,Z[1]=Y,Z}function $86(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z}function kZ1(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z}function EZ1(Z,J,Y){return Z[0]=J[0]*Y[0],Z[1]=J[1]*Y[1],Z}function IZ1(Z,J,Y){return Z[0]=J[0]/Y[0],Z[1]=J[1]/Y[1],Z}function Q86(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z}function W86(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z}function X86(Z,J,Y){return Z[0]=Math.min(J[0],Y[0]),Z[1]=Math.min(J[1],Y[1]),Z}function K86(Z,J,Y){return Z[0]=Math.max(J[0],Y[0]),Z[1]=Math.max(J[1],Y[1]),Z}function G86(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z}function z86(Z,J,Y){return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z}function F86(Z,J,Y,$){return Z[0]=J[0]+Y[0]*$,Z[1]=J[1]+Y[1]*$,Z}function vZ1(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1];return Math.hypot(Y,$)}function SZ1(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1];return Y*Y+$*$}function _Z1(Z){var J=Z[0],Y=Z[1];return Math.hypot(J,Y)}function AZ1(Z){var J=Z[0],Y=Z[1];return J*J+Y*Y}function H86(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z}function V86(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z}function q86(Z,J){var Y=J[0],$=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 U86(Z,J){return Z[0]*J[0]+Z[1]*J[1]}function L86(Z,J,Y){var $=J[0]*Y[1]-J[1]*Y[0];return Z[0]=Z[1]=0,Z[2]=$,Z}function w86(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 B86(Z,J){J=J||1;var Y=M7()*2*Math.PI;return Z[0]=Math.cos(Y)*J,Z[1]=Math.sin(Y)*J,Z}function O86(Z,J,Y){var $=J[0],Q=J[1];return Z[0]=Y[0]*$+Y[2]*Q,Z[1]=Y[1]*$+Y[3]*Q,Z}function M86(Z,J,Y){var $=J[0],Q=J[1];return Z[0]=Y[0]*$+Y[2]*Q+Y[4],Z[1]=Y[1]*$+Y[3]*Q+Y[5],Z}function N86(Z,J,Y){var $=J[0],Q=J[1];return Z[0]=Y[0]*$+Y[3]*Q+Y[6],Z[1]=Y[1]*$+Y[4]*Q+Y[7],Z}function R86(Z,J,Y){var $=J[0],Q=J[1];return Z[0]=Y[0]*$+Y[4]*Q+Y[12],Z[1]=Y[1]*$+Y[5]*Q+Y[13],Z}function j86(Z,J,Y,$){var Q=J[0]-Y[0],W=J[1]-Y[1],X=Math.sin($),K=Math.cos($);return Z[0]=Q*K-W*X+Y[0],Z[1]=Q*X+W*K+Y[1],Z}function P86(Z,J){var Y=Z[0],$=Z[1],Q=J[0],W=J[1],X=Math.sqrt(Y*Y+$*$)*Math.sqrt(Q*Q+W*W),K=X&&(Y*Q+$*W)/X;return Math.acos(Math.min(Math.max(K,-1),1))}function D86(Z){return Z[0]=0,Z[1]=0,Z}function C86(Z){return"vec2("+Z[0]+", "+Z[1]+")"}function T86(Z,J){return Z[0]===J[0]&&Z[1]===J[1]}function k86(Z,J){var Y=Z[0],$=Z[1],Q=J[0],W=J[1];return Math.abs(Y-Q)<=P0*Math.max(1,Math.abs(Y),Math.abs(Q))&&Math.abs($-W)<=P0*Math.max(1,Math.abs($),Math.abs(W))}var E86=_Z1,I86=kZ1,v86=EZ1,S86=IZ1,_86=vZ1,A86=SZ1,x86=AZ1,h86=function(){var Z=TZ1();return function(J,Y,$,Q,W,X){var K,G;if(!Y)Y=2;if(!$)$=0;if(Q)G=Math.min(Q*Y+$,J.length);else G=J.length;for(K=$;K<G;K+=Y)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 hQ extends Float32Array{constructor(Z,J,Y,$){super([Z,J,Y,$])}get determinant(){return y8.determinant(this)}get frobeniusNorm(){return y8.frob(this)}static create(){let Z=new hQ(0,0,0,0);return y8.identity(Z),Z}static fromRotation(Z){let J=hQ.create();return y8.fromRotation(J,Z),J}static fromScaling(Z){let J=hQ.create();return y8.fromScaling(J,Z),J}add(Z){return y8.add(this,this,Z),this}adjoint(){return y8.adjoint(this,this),this}clone(){return new hQ(this[0],this[1],this[2],this[3])}copy(Z){return y8.copy(this,Z),this}equals(Z){return y8.equals(this,Z)}exactEquals(Z){return y8.exactEquals(this,Z)}identity(){return y8.identity(this),this}invert(){return y8.invert(this,this),this}multiply(Z){return y8.mul(this,this,Z),this}multiplyScalar(Z){return y8.multiplyScalar(this,this,Z),this}rotate(Z){return y8.rotate(this,this,Z),this}subtract(Z){return y8.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]}][${this[2]},${this[3]}]`}transpose(){return y8.transpose(this,this),this}}class N7 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 N7(0,0,0,0,0,0,0,0,0);return l1.identity(Z),Z}static fromMatrix4(Z){let J=N7.create();return l1.fromMat4(J,Z),J}static fromQuaternion(Z){let J=N7.create();return l1.fromQuat(J,Z),J}static fromRotation(Z){let J=N7.create();return l1.fromRotation(J,Z),J}static fromScaling(Z){let J=N7.create();return l1.fromScaling(J,Z),J}static fromTranslation(Z){let J=N7.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 N7(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 Y5 extends Float32Array{constructor(Z,J,Y,$,Q,W,X,K,G,z,F,H,V,q,U,w){super([Z,J,Y,$,Q,W,X,K,G,z,F,H,V,q,U,w])}get determinant(){return o0.determinant(this)}get frobeniusNorm(){return o0.frob(this)}static create(){let Z=new Y5(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=Y5.create();return o0.fromQuat(J,Z),J}static fromRotation(Z,J){let Y=Y5.create();return o0.fromRotation(Y,Z,J),Y}static fromRotationTranslation(Z,J){let Y=Y5.create();return o0.fromRotationTranslation(Y,Z,J),Y}static fromRotationTranslationScale(Z,J,Y){let $=Y5.create();return o0.fromRotationTranslationScale($,Z,J,Y),$}static fromRotationTranslationScaleOrigin(Z,J,Y,$){let Q=Y5.create();return o0.fromRotationTranslationScaleOrigin(Q,Z,J,Y,$),Q}static fromScaling(Z){let J=Y5.create();return o0.fromScaling(J,Z),J}static fromTranslation(Z){let J=Y5.create();return o0.fromTranslation(J,Z),J}static fromXRotation(Z){let J=Y5.create();return o0.fromXRotation(J,Z),J}static fromYRotation(Z){let J=Y5.create();return o0.fromYRotation(J,Z),J}static fromZRotation(Z){let J=Y5.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 Y5(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,Y){return o0.lookAt(this,Z,J,Y),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,Y){return o0.targetTo(this,Z,J,Y),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 bK 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,Y){let $=R1.fromEuler(new Float32Array(4),Z,J,Y);return new bK($[0],$[1],$[2],$[3])}static fromQuaternionLike(Z){return new bK(Z.x,Z.y,Z.z,Z.w)}clone(){return new bK(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 sH 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 sH(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 sH(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 gK extends Float32Array{constructor(Z,J,Y){super([Z,J,Y])}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 gK(0,0,0)}static fromVector3Like(Z){return new gK(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 gK(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 j1=function(Z,J,Y,$){function Q(W){return W instanceof Y?W:new Y(function(X){X(W)})}return new(Y||(Y=Promise))(function(W,X){function K(F){try{z($.next(F))}catch(H){X(H)}}function G(F){try{z($.throw(F))}catch(H){X(H)}}function z(F){F.done?W(F.value):Q(F.value).then(K,G)}z(($=$.apply(Z,J||[])).next())})},M1=function(Z,J){var Y={label:0,sent:function(){if(W[0]&1)throw W[1];return W[1]},trys:[],ops:[]},$,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(F){return G([z,F])}}function G(z){if($)throw new TypeError("Generator is already executing.");while(X&&(X=0,z[0]&&(Y=0)),Y)try{if($=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 Y.label++,{value:z[1],done:!1};case 5:Y.label++,Q=z[1],z=[0];continue;case 7:z=Y.ops.pop(),Y.trys.pop();continue;default:if((W=Y.trys,!(W=W.length>0&&W[W.length-1]))&&(z[0]===6||z[0]===2)){Y=0;continue}if(z[0]===3&&(!W||z[1]>W[0]&&z[1]<W[3])){Y.label=z[1];break}if(z[0]===6&&Y.label<W[1]){Y.label=W[1],W=z;break}if(W&&Y.label<W[2]){Y.label=W[2],Y.ops.push(z);break}if(W[2])Y.ops.pop();Y.trys.pop();continue}z=J.call(Z,Y)}catch(F){z=[6,F],Q=0}finally{$=W=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},I5=function(Z,J){var Y=typeof Symbol==="function"&&Z[Symbol.iterator];if(!Y)return Z;var $=Y.call(Z),Q,W=[],X;try{while((J===void 0||J-- >0)&&!(Q=$.next()).done)W.push(Q.value)}catch(K){X={error:K}}finally{try{if(Q&&!Q.done&&(Y=$.return))Y.call($)}finally{if(X)throw X.error}}return W},f9=function(Z,J,Y){if(Y||arguments.length===2){for(var $=0,Q=J.length,W;$<Q;$++)if(W||!($ in J)){if(!W)W=Array.prototype.slice.call(J,0,$);W[$]=J[$]}}return Z.concat(W||Array.prototype.slice.call(J))},xZ1=function(Z){var J=typeof Symbol==="function"&&Symbol.iterator,Y=J&&Z[J],$=0;if(Y)return Y.call(Z);if(Z&&typeof Z.length==="number")return{next:function(){if(Z&&$>=Z.length)Z=void 0;return{value:Z&&Z[$++],done:!Z}}};throw new TypeError(J?"Object is not iterable.":"Symbol.iterator is not defined.")},Oi6=function(){function Z(J){if(J===void 0)J=Z.minComparator;var Y=this;this.compare=J,this.heapArray=[],this._limit=0,this.offer=this.add,this.element=this.peek,this.poll=this.pop,this._invertedCompare=function($,Q){return Y.compare($,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 Y=J%2?1:2;return Math.floor((J-Y)/2)},Z.getSiblingIndexOf=function(J){if(J<=0)return-1;var Y=J%2?1:-1;return J+Y},Z.minComparator=function(J,Y){return j1(this,void 0,void 0,function(){return M1(this,function($){if(J>Y)return[2,1];else if(J<Y)return[2,-1];else return[2,0]})})},Z.maxComparator=function(J,Y){return j1(this,void 0,void 0,function(){return M1(this,function($){if(Y>J)return[2,1];else if(Y<J)return[2,-1];else return[2,0]})})},Z.minComparatorNumber=function(J,Y){return j1(this,void 0,void 0,function(){return M1(this,function($){return[2,J-Y]})})},Z.maxComparatorNumber=function(J,Y){return j1(this,void 0,void 0,function(){return M1(this,function($){return[2,Y-J]})})},Z.defaultIsEqual=function(J,Y){return j1(this,void 0,void 0,function(){return M1(this,function($){return[2,J===Y]})})},Z.print=function(J){function Y(F){var H=Z.getParentIndexOf(F);return Math.floor(Math.log2(H+1))}function $(F,H){var V="";for(;H>0;--H)V+=F;return V}var Q=0,W=[],X=Y(J.length-1)+2,K=0;while(Q<J.length){var G=Y(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(F,H){var V=Math.pow(2,X-H)-1;return $(" ",Math.floor(V/2)*K)+F.map(function(q){var U=(K-q.length)/2;return $(" ",Math.ceil(U))+q+$(" ",Math.floor(U))}).join($(" ",V*K))}).join(`
437
437
  `)},Z.heapify=function(J,Y){return j1(this,void 0,void 0,function(){var $;return M1(this,function(Q){switch(Q.label){case 0:return $=new Z(Y),$.heapArray=J,[4,$.init()];case 1:return Q.sent(),[2,$]}})})},Z.heappop=function(J,Y){var $=new Z(Y);return $.heapArray=J,$.pop()},Z.heappush=function(J,Y,$){return j1(this,void 0,void 0,function(){var Q;return M1(this,function(W){switch(W.label){case 0:return Q=new Z($),Q.heapArray=J,[4,Q.push(Y)];case 1:return W.sent(),[2]}})})},Z.heappushpop=function(J,Y,$){var Q=new Z($);return Q.heapArray=J,Q.pushpop(Y)},Z.heapreplace=function(J,Y,$){var Q=new Z($);return Q.heapArray=J,Q.replace(Y)},Z.heaptop=function(J,Y,$){if(Y===void 0)Y=1;var Q=new Z($);return Q.heapArray=J,Q.top(Y)},Z.heapbottom=function(J,Y,$){if(Y===void 0)Y=1;var Q=new Z($);return Q.heapArray=J,Q.bottom(Y)},Z.nlargest=function(J,Y,$){return j1(this,void 0,void 0,function(){var Q;return M1(this,function(W){switch(W.label){case 0:return Q=new Z($),Q.heapArray=f9([],I5(Y),!1),[4,Q.init()];case 1:return W.sent(),[2,Q.top(J)]}})})},Z.nsmallest=function(J,Y,$){return j1(this,void 0,void 0,function(){var Q;return M1(this,function(W){switch(W.label){case 0:return Q=new Z($),Q.heapArray=f9([],I5(Y),!1),[4,Q.init()];case 1:return W.sent(),[2,Q.bottom(J)]}})})},Z.prototype.add=function(J){return j1(this,void 0,void 0,function(){return M1(this,function(Y){switch(Y.label){case 0:return[4,this._sortNodeUp(this.heapArray.push(J)-1)];case 1:return Y.sent(),this._applyLimit(),[2,!0]}})})},Z.prototype.addAll=function(J){return j1(this,void 0,void 0,function(){var Y,$,Q;return M1(this,function(W){switch(W.label){case 0:Y=this.length,(Q=this.heapArray).push.apply(Q,f9([],I5(J),!1)),$=this.length,W.label=1;case 1:if(!(Y<$))return[3,4];return[4,this._sortNodeUp(Y)];case 2:W.sent(),W.label=3;case 3:return++Y,[3,1];case 4:return this._applyLimit(),[2,!0]}})})},Z.prototype.bottom=function(){return j1(this,arguments,void 0,function(J){if(J===void 0)J=1;return M1(this,function(Y){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,f9([],I5(this.heapArray),!1)];else return[2,this._bottomN_push(~~J)]})})},Z.prototype.check=function(){return j1(this,void 0,void 0,function(){var J,Y,$,Q,W,X,K,G,z;return M1(this,function(F){switch(F.label){case 0:J=0,F.label=1;case 1:if(!(J<this.heapArray.length))return[3,10];Y=this.heapArray[J],$=this.getChildrenOf(J),F.label=2;case 2:F.trys.push([2,7,8,9]),Q=(G=void 0,xZ1($)),W=Q.next(),F.label=3;case 3:if(W.done)return[3,6];return X=W.value,[4,this.compare(Y,X)];case 4:if(F.sent()>0)return[2,Y];F.label=5;case 5:return W=Q.next(),[3,3];case 6:return[3,9];case 7:return K=F.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 j1(this,arguments,void 0,function(Y,$){var Q,W,X,K,G,z;if($===void 0)$=Z.defaultIsEqual;return M1(this,function(F){switch(F.label){case 0:F.trys.push([0,5,6,7]),Q=xZ1(this.heapArray),W=Q.next(),F.label=1;case 1:if(W.done)return[3,4];return X=W.value,[4,$(X,Y)];case 2:if(F.sent())return[2,!0];F.label=3;case 3:return W=Q.next(),[3,1];case 4:return[3,7];case 5:return K=F.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 j1(this,void 0,void 0,function(){var Y;return M1(this,function($){switch($.label){case 0:if(J)this.heapArray=f9([],I5(J),!1);Y=Math.floor(this.heapArray.length),$.label=1;case 1:if(!(Y>=0))return[3,4];return[4,this._sortNodeDown(Y)];case 2:$.sent(),$.label=3;case 3:return--Y,[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 j1(this,void 0,void 0,function(){var J;return M1(this,function(Y){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 Y=0;Y<arguments.length;Y++)J[Y]=arguments[Y];return j1(this,void 0,void 0,function(){return M1(this,function($){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 j1(this,void 0,void 0,function(){var Y;return M1(this,function($){switch($.label){case 0:return[4,this.compare(this.heapArray[0],J)];case 1:if(!($.sent()<0))return[3,3];return Y=I5([this.heapArray[0],J],2),J=Y[0],this.heapArray[0]=Y[1],[4,this._sortNodeDown(0)];case 2:$.sent(),$.label=3;case 3:return[2,J]}})})},Z.prototype.remove=function(J){return j1(this,arguments,void 0,function(Y,$){var Q,W,X,K=this;if($===void 0)$=Z.defaultIsEqual;return M1(this,function(G){switch(G.label){case 0:if(!this.heapArray.length)return[2,!1];if(Y!==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,$(this.heapArray[W],Y)];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,f9([],I5(X),!1)),G.label=12;case 12:return[3,3];case 13:return[2,!1]}})})},Z.prototype.replace=function(J){return j1(this,void 0,void 0,function(){var Y;return M1(this,function($){switch($.label){case 0:return Y=this.heapArray[0],this.heapArray[0]=J,[4,this._sortNodeDown(0)];case 1:return $.sent(),[2,Y]}})})},Z.prototype.size=function(){return this.length},Z.prototype.top=function(){return j1(this,arguments,void 0,function(J){if(J===void 0)J=1;return M1(this,function(Y){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,f9([],I5(this.heapArray),!1)];else return[2,this._topN_push(~~J)]})})},Z.prototype.toArray=function(){return f9([],I5(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 Y=this;return Z.getChildrenIndexOf(J).map(function($){return Y.heapArray[$]}).filter(function($){return $!==void 0})},Z.prototype.getParentOf=function(J){var Y=Z.getParentIndexOf(J);return this.heapArray[Y]},Z.prototype[Symbol.iterator]=function(){return M1(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 j1(this,void 0,void 0,function(){var Y,$,Q,W,K,X,K;return M1(this,function(G){switch(G.label){case 0:return Y=new Z(this.compare),Y.limit=J,Y.heapArray=this.heapArray.slice(-J),[4,Y.init()];case 1:G.sent(),$=this.heapArray.length-1-J,Q=Z.getParentIndexOf($),W=[];for(K=$;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],Y.peek())];case 3:if(!(G.sent()>0))return[3,5];return[4,Y.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,Y.toArray()]}})})},Z.prototype._moveNode=function(J,Y){var $;$=I5([this.heapArray[Y],this.heapArray[J]],2),this.heapArray[J]=$[0],this.heapArray[Y]=$[1]},Z.prototype._sortNodeDown=function(J){return j1(this,void 0,void 0,function(){var Y,$,Q,W,X,K;return M1(this,function(G){switch(G.label){case 0:Y=this.heapArray.length,G.label=1;case 1:if($=2*J+1,Q=$+1,W=J,X=$<Y,!X)return[3,3];return[4,this.compare(this.heapArray[$],this.heapArray[W])];case 2:X=G.sent()<0,G.label=3;case 3:if(X)W=$;if(K=Q<Y,!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 j1(this,void 0,void 0,function(){var Y;return M1(this,function($){switch($.label){case 0:if(!(J>0))return[3,2];return Y=Z.getParentIndexOf(J),[4,this.compare(this.heapArray[J],this.heapArray[Y])];case 1:if($.sent()<0)this._moveNode(J,Y),J=Y;else return[3,2];return[3,0];case 2:return[2]}})})},Z.prototype._topN_push=function(J){return j1(this,void 0,void 0,function(){var Y,$,Q,W;return M1(this,function(X){switch(X.label){case 0:Y=new Z(this._invertedCompare),Y.limit=J,$=[0],Q=this.heapArray,X.label=1;case 1:if(!$.length)return[3,7];if(W=$.shift(),!(W<Q.length))return[3,6];if(!(Y.length<J))return[3,3];return[4,Y.push(Q[W])];case 2:return X.sent(),$.push.apply($,f9([],I5(Z.getChildrenIndexOf(W)),!1)),[3,6];case 3:return[4,this.compare(Q[W],Y.peek())];case 4:if(!(X.sent()<0))return[3,6];return[4,Y.replace(Q[W])];case 5:X.sent(),$.push.apply($,f9([],I5(Z.getChildrenIndexOf(W)),!1)),X.label=6;case 6:return[3,1];case 7:return[2,Y.toArray()]}})})},Z.prototype._topN_fill=function(J){return j1(this,void 0,void 0,function(){var Y,$,Q,W,X,X;return M1(this,function(K){switch(K.label){case 0:return Y=this.heapArray,$=new Z(this._invertedCompare),$.limit=J,$.heapArray=Y.slice(0,J),[4,$.init()];case 1:K.sent(),Q=Z.getParentIndexOf(J-1)+1,W=[];for(X=Q;X<J;++X)W.push.apply(W,f9([],I5(Z.getChildrenIndexOf(X).filter(function(G){return G<Y.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<Y.length))return[3,5];return[4,this.compare(Y[X],$.peek())];case 3:if(!(K.sent()<0))return[3,5];return[4,$.replace(Y[X])];case 4:K.sent(),W.push.apply(W,f9([],I5(Z.getChildrenIndexOf(X)),!1)),K.label=5;case 5:return[3,2];case 6:return[2,$.toArray()]}})})},Z.prototype._topN_heap=function(J){return j1(this,void 0,void 0,function(){var Y,$,Q,W,X;return M1(this,function(K){switch(K.label){case 0:Y=this.clone(),$=[],Q=0,K.label=1;case 1:if(!(Q<J))return[3,4];return X=(W=$).push,[4,Y.pop()];case 2:X.apply(W,[K.sent()]),K.label=3;case 3:return++Q,[3,1];case 4:return[2,$]}})})},Z.prototype._topIdxOf=function(J){return j1(this,void 0,void 0,function(){var Y,$,Q,W;return M1(this,function(X){switch(X.label){case 0:if(!J.length)return[2,-1];Y=0,$=J[Y],Q=1,X.label=1;case 1:if(!(Q<J.length))return[3,4];return[4,this.compare(J[Q],$)];case 2:if(W=X.sent(),W<0)Y=Q,$=J[Q];X.label=3;case 3:return++Q,[3,1];case 4:return[2,Y]}})})},Z.prototype._topOf=function(){var J=[];for(var Y=0;Y<arguments.length;Y++)J[Y]=arguments[Y];return j1(this,void 0,void 0,function(){var $;return M1(this,function(Q){switch(Q.label){case 0:return $=new Z(this.compare),[4,$.init(J)];case 1:return Q.sent(),[2,$.peek()]}})})},Z}(),f86=function(Z,J){var Y={label:0,sent:function(){if(W[0]&1)throw W[1];return W[1]},trys:[],ops:[]},$,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(F){return G([z,F])}}function G(z){if($)throw new TypeError("Generator is already executing.");while(X&&(X=0,z[0]&&(Y=0)),Y)try{if($=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 Y.label++,{value:z[1],done:!1};case 5:Y.label++,Q=z[1],z=[0];continue;case 7:z=Y.ops.pop(),Y.trys.pop();continue;default:if((W=Y.trys,!(W=W.length>0&&W[W.length-1]))&&(z[0]===6||z[0]===2)){Y=0;continue}if(z[0]===3&&(!W||z[1]>W[0]&&z[1]<W[3])){Y.label=z[1];break}if(z[0]===6&&Y.label<W[1]){Y.label=W[1],W=z;break}if(W&&Y.label<W[2]){Y.label=W[2],Y.ops.push(z);break}if(W[2])Y.ops.pop();Y.trys.pop();continue}z=J.call(Z,Y)}catch(F){z=[6,F],Q=0}finally{$=W=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},V6=function(Z,J){var Y=typeof Symbol==="function"&&Z[Symbol.iterator];if(!Y)return Z;var $=Y.call(Z),Q,W=[],X;try{while((J===void 0||J-- >0)&&!(Q=$.next()).done)W.push(Q.value)}catch(K){X={error:K}}finally{try{if(Q&&!Q.done&&(Y=$.return))Y.call($)}finally{if(X)throw X.error}}return W},$5=function(Z,J,Y){if(Y||arguments.length===2){for(var $=0,Q=J.length,W;$<Q;$++)if(W||!($ in J)){if(!W)W=Array.prototype.slice.call(J,0,$);W[$]=J[$]}}return Z.concat(W||Array.prototype.slice.call(J))};var hZ1=function(){function Z(J){if(J===void 0)J=Z.minComparator;var Y=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($,Q){return-1*Y.compare($,Q)}}return Z.getChildrenIndexOf=function(J){return[J*2+1,J*2+2]},Z.getParentIndexOf=function(J){if(J<=0)return-1;var Y=J%2?1:2;return Math.floor((J-Y)/2)},Z.getSiblingIndexOf=function(J){if(J<=0)return-1;var Y=J%2?1:-1;return J+Y},Z.minComparator=function(J,Y){if(J>Y)return 1;else if(J<Y)return-1;else return 0},Z.maxComparator=function(J,Y){if(Y>J)return 1;else if(Y<J)return-1;else return 0},Z.minComparatorNumber=function(J,Y){return J-Y},Z.maxComparatorNumber=function(J,Y){return Y-J},Z.defaultIsEqual=function(J,Y){return J===Y},Z.print=function(J){function Y(F){var H=Z.getParentIndexOf(F);return Math.floor(Math.log2(H+1))}function $(F,H){var V="";for(;H>0;--H)V+=F;return V}var Q=0,W=[],X=Y(J.length-1)+2,K=0;while(Q<J.length){var G=Y(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(F,H){var V=Math.pow(2,X-H)-1;return $(" ",Math.floor(V/2)*K)+F.map(function(q){var U=(K-q.length)/2;return $(" ",Math.ceil(U))+q+$(" ",Math.floor(U))}).join($(" ",V*K))}).join(`
438
438
  `)},Z.heapify=function(J,Y){var $=new Z(Y);return $.heapArray=J,$.init(),$},Z.heappop=function(J,Y){var $=new Z(Y);return $.heapArray=J,$.pop()},Z.heappush=function(J,Y,$){var Q=new Z($);Q.heapArray=J,Q.push(Y)},Z.heappushpop=function(J,Y,$){var Q=new Z($);return Q.heapArray=J,Q.pushpop(Y)},Z.heapreplace=function(J,Y,$){var Q=new Z($);return Q.heapArray=J,Q.replace(Y)},Z.heaptop=function(J,Y,$){if(Y===void 0)Y=1;var Q=new Z($);return Q.heapArray=J,Q.top(Y)},Z.heapbottom=function(J,Y,$){if(Y===void 0)Y=1;var Q=new Z($);return Q.heapArray=J,Q.bottom(Y)},Z.nlargest=function(J,Y,$){var Q=new Z($);return Q.heapArray=$5([],V6(Y),!1),Q.init(),Q.top(J)},Z.nsmallest=function(J,Y,$){var Q=new Z($);return Q.heapArray=$5([],V6(Y),!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;(Y=this.heapArray).push.apply(Y,$5([],V6(J),!1));for(var Q=this.length;$<Q;++$)this._sortNodeUp($);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 $5([],V6(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($).find(function(Q){return J.compare(Y,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,Y){if(Y===void 0)Y=Z.defaultIsEqual;return this.indexOf(J,Y)!==-1},Z.prototype.init=function(J){if(J)this.heapArray=$5([],V6(J),!1);for(var Y=Math.floor(this.heapArray.length);Y>=0;--Y)this._sortNodeDown(Y);this._applyLimit()},Z.prototype.isEmpty=function(){return this.length===0},Z.prototype.indexOf=function(J,Y){if(Y===void 0)Y=Z.defaultIsEqual;if(this.heapArray.length===0)return-1;var $=[],Q=0;while(Q<this.heapArray.length){var W=this.heapArray[Q];if(Y(W,J))return Q;else if(this.compare(W,J)<=0)$.push.apply($,$5([],V6(Z.getChildrenIndexOf(Q)),!1));Q=$.shift()||this.heapArray.length}return-1},Z.prototype.indexOfEvery=function(J,Y){if(Y===void 0)Y=Z.defaultIsEqual;if(this.heapArray.length===0)return[];var $=[],Q=[],W=0;while(W<this.heapArray.length){var X=this.heapArray[W];if(Y(X,J))Q.push(W),$.push.apply($,$5([],V6(Z.getChildrenIndexOf(W)),!1));else if(this.compare(X,J)<=0)$.push.apply($,$5([],V6(Z.getChildrenIndexOf(W)),!1));W=$.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 Y=0;Y<arguments.length;Y++)J[Y]=arguments[Y];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 Y;if(this.compare(this.heapArray[0],J)<0)Y=V6([this.heapArray[0],J],2),J=Y[0],this.heapArray[0]=Y[1],this._sortNodeDown(0);return J},Z.prototype.remove=function(J,Y){var $=this;if(Y===void 0)Y=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(Y(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<$.heapArray.length});Q.push.apply(Q,$5([],V6(X),!1))}}return!1},Z.prototype.replace=function(J){var Y=this.heapArray[0];return this.heapArray[0]=J,this._sortNodeDown(0),Y},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 $5([],V6(this.heapArray),!1);else return this._topN_push(~~J)},Z.prototype.toArray=function(){return $5([],V6(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 Y=this;return Z.getChildrenIndexOf(J).map(function($){return Y.heapArray[$]}).filter(function($){return $!==void 0})},Z.prototype.getParentOf=function(J){var Y=Z.getParentIndexOf(J);return this.heapArray[Y]},Z.prototype[Symbol.iterator]=function(){return f86(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 Y=new Z(this.compare);Y.limit=J,Y.heapArray=this.heapArray.slice(-J),Y.init();var $=this.heapArray.length-1-J,Q=Z.getParentIndexOf($),W=[];for(var X=$;X>Q;--X)W.push(X);var K=this.heapArray;while(W.length){var X=W.shift();if(this.compare(K[X],Y.peek())>0){if(Y.replace(K[X]),X%2)W.push(Z.getParentIndexOf(X))}}return Y.toArray()},Z.prototype._moveNode=function(J,Y){var $;$=V6([this.heapArray[Y],this.heapArray[J]],2),this.heapArray[J]=$[0],this.heapArray[Y]=$[1]},Z.prototype._sortNodeDown=function(J){var Y=this.heapArray.length;while(!0){var $=2*J+1,Q=$+1,W=J;if($<Y&&this.compare(this.heapArray[$],this.heapArray[W])<0)W=$;if(Q<Y&&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 Y=Z.getParentIndexOf(J);if(this.compare(this.heapArray[J],this.heapArray[Y])<0)this._moveNode(J,Y),J=Y;else break}},Z.prototype._topN_push=function(J){var Y=new Z(this._invertedCompare);Y.limit=J;var $=[0],Q=this.heapArray;while($.length){var W=$.shift();if(W<Q.length){if(Y.length<J)Y.push(Q[W]),$.push.apply($,$5([],V6(Z.getChildrenIndexOf(W)),!1));else if(this.compare(Q[W],Y.peek())<0)Y.replace(Q[W]),$.push.apply($,$5([],V6(Z.getChildrenIndexOf(W)),!1))}}return Y.toArray()},Z.prototype._topN_fill=function(J){var Y=this.heapArray,$=new Z(this._invertedCompare);$.limit=J,$.heapArray=Y.slice(0,J),$.init();var Q=Z.getParentIndexOf(J-1)+1,W=[];for(var X=Q;X<J;++X)W.push.apply(W,$5([],V6(Z.getChildrenIndexOf(X).filter(function(K){return K<Y.length})),!1));if((J-1)%2)W.push(J);while(W.length){var X=W.shift();if(X<Y.length){if(this.compare(Y[X],$.peek())<0)$.replace(Y[X]),W.push.apply(W,$5([],V6(Z.getChildrenIndexOf(X)),!1))}}return $.toArray()},Z.prototype._topN_heap=function(J){var Y=this.clone(),$=[];for(var Q=0;Q<J;++Q)$.push(Y.pop());return $},Z.prototype._topIdxOf=function(J){if(!J.length)return-1;var Y=0,$=J[Y];for(var Q=1;Q<J.length;++Q){var W=this.compare(J[Q],$);if(W<0)Y=Q,$=J[Q]}return Y},Z.prototype._topOf=function(){var J=[];for(var Y=0;Y<arguments.length;Y++)J[Y]=arguments[Y];var $=new Z(this.compare);return $.init(J),$.peek()},Z}();class oH extends zY{_faceSpeed=0;_faceTarget;_jumpHeight=0;_moveSpeed=0;_moveTarget;_moveIgnoreAxes={};_onFace;_onFaceComplete;_onMove;_onMoveComplete;face(Z,J,Y){this._faceTarget=Z,this._faceSpeed=J,this._onFace=Y?.faceCallback,this._onFaceComplete=Y?.faceCompleteCallback}jump(Z){this._jumpHeight=Z}move(Z,J,Y){this._moveTarget=Z,this._moveSpeed=J,this._moveIgnoreAxes=Y?.moveIgnoreAxes??{},this._onMove=Y?.moveCallback,this._onMoveComplete=Y?.moveCompleteCallback}tick(Z,J){if(super.tick(Z,J),!this._moveTarget&&!this._faceTarget&&!this._jumpHeight)return;let Y=J/1000,$=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-$.x,y:this._moveIgnoreAxes.y?0:this._moveTarget.y-$.y,z:this._moveIgnoreAxes.z?0:this._moveTarget.z-$.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*Y,z=Math.min(X,K)/X,F={x:$.x+Q.x*z,y:$.y+Q.y*z,z:$.z+Q.z*z};if(Z.setPosition(F),this._onMove)this._onMove(F,this._moveTarget)}else if(this._moveTarget=void 0,this._onMoveComplete){let X=this._onMoveComplete;this._onMove=void 0,this._onMoveComplete=void 0,X($)}}if(this._faceTarget){let Q={x:this._faceTarget.x-$.x,z:this._faceTarget.z-$.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*Y,F=Math.abs(G)<z?G:Math.sign(G)*z,V=(K+F)/2,q={x:0,y:Math.fround(Math.sin(V)),z:0,w:Math.fround(Math.cos(V))};if(Z.setRotation(q),this._onFace)this._onFace(X,q)}else if(this._faceTarget=void 0,this._onFaceComplete){let z=this._onFaceComplete;this._onFaceComplete=void 0,z(Z.rotation)}}}}class Ch extends oH{_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,Y){if(this._target=Z,this._speed=J,this._debug=Y?.debug??!1,this._maxFall=Y?.maxFall?-Math.abs(Y.maxFall):0,this._maxJump=Y?.maxJump?Math.abs(Y.maxJump):0,this._maxOpenSetIterations=Y?.maxOpenSetIterations??200,this._onPathfindAbort=Y?.pathfindAbortCallback,this._onPathfindComplete=Y?.pathfindCompleteCallback,this._onWaypointMoveComplete=Y?.waypointMoveCompleteCallback,this._onWaypointMoveSkipped=Y?.waypointMoveSkippedCallback,this._verticalPenalty=Y?.verticalPenalty??0,this._waypoints=[],this._waypointNextIndex=0,this._waypointTimeoutMs=Y?.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 Y={x:Math.floor(this._target.x),y:Math.floor(this._target.y),z:Math.floor(this._target.z)},$=Math.abs(Y.x-J.x),Q=Math.abs(Y.y-J.y),W=Math.abs(Y.z-J.z);if($<=2&&Q<=2&&W<=2&&!this._isNeighborCoordinateBlocked(J,Y,this._entity.height))return this._waypoints=[{x:J.x+0.5,y:J.y+Z/2,z:J.z+0.5},{x:Y.x+0.5,y:Y.y+Z/2,z:Y.z+0.5}],!0;if(J.x===Y.x&&J.y===Y.y&&J.z===Y.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]]),F=new Map([[K,this._pathfindingHeuristic(J,Y)]]),H=new Set,V=new hZ1((j,R)=>{let D=F.get(j[0])??1/0,P=F.get(R[0])??1/0;return D-P});V.push([K,J]);let q=[{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 j=this._maxJump;j>=this._maxFall;j--){if(j===0)continue;let R=Math.abs(J.y+j-Y.y);U.push({y:j,distanceToTargetY:R})}U.sort((j,R)=>j.distanceToTargetY-R.distanceToTargetY);let w=[...q,...U.flatMap(({y:j})=>q.map((R)=>({...R,y:j})))],L=0,O=Math.abs(Y.x-J.x)+Math.abs(Y.y-J.y)+Math.abs(Y.z-J.z),N=Math.min(this._maxOpenSetIterations,O*20);while(!V.isEmpty()&&L<N){L++;let[j,R]=V.pop();if(R.x===Y.x&&R.y===Y.y&&R.z===Y.z){let C=this._reconstructPath(G,R);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}H.add(j);let D=z.get(j),P=new Map;for(let C of w){let T=`${C.x},${C.z}`,I=C.y<0;if(I&&P.has(T))continue;let x={x:R.x+C.x,y:R.y+C.y,z:R.z+C.z};if(Math.abs(Y.x-x.x)+Math.abs(Y.y-x.y)+Math.abs(Y.z-x.z)>O*1.5)continue;let A=this._coordinateToKey(x);if(H.has(A))continue;let E=this._isNeighborCoordinateBlocked(R,x,this._entity.height);if(I&&E){P.set(T,!0);continue}if(E)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,Y0=D+o,W0=z.get(A)??1/0;if(Y0>=W0)continue;G.set(A,R),z.set(A,Y0);let C0=Y0+this._pathfindingHeuristic(x,Y);F.set(A,C0),V.push([A,x])}}if(L>=N){if(this._onPathfindAbort?.(),this._debug)m.warning(`PathfindingEntityController._calculatePath: Maximum open set iterations reached (${N}), 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 Y=[J],$=J;while(Z.has(this._coordinateToKey($)))$=Z.get(this._coordinateToKey($)),Y.unshift($);return Y}_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 Y=0;if(this._entity.isDynamic&&Z&&J.y>Z.y){let $=J.y-Z.y,Q=Math.min($,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,F=J.z+0.5,H=z-K,V=F-G,q=Math.sqrt(H*H+V*V),U=X/W,w=q/this._speed;Y=Math.min(U*0.8,w)*1000}setTimeout(()=>{if(!this._entity)return;let $=Date.now();this.face(J,this._speed),this.move(J,this._speed,{moveIgnoreAxes:{y:this._entity.isDynamic},moveCallback:()=>{if(Date.now()-$>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?.()}})},Y)}_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,Y){if(!this._entity?.world)return!1;let $=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(!$.chunkLattice.hasBlock({x:Q,y:W-1,z:X}))return!0;for(let z=0;z<Y;z++)if($.chunkLattice.hasBlock({x:Q,y:W+z,z:X}))return!0;if(Q!==K&&X!==G)for(let z=0;z<Y;z++){let F=$.chunkLattice.hasBlock({x:Q,y:W+z,z:G}),H=$.chunkLattice.hasBlock({x:K,y:W+z,z:X});if(F||H)return!0}return!1}_findGroundedStart(){if(!this._entity?.world)return;let{x:Z,y:J,z:Y}=this._entity.position,$={x:Math.floor(Z),y:Math.floor(J),z:Math.floor(Y)};for(let Q=0;Q<=Math.abs(this._maxFall);Q++)if(this._entity.world.chunkLattice.hasBlock({...$,y:$.y-Q-1}))return{...$,y:$.y-Q};return}}export{et8 as startServer,y71 as WorldManagerEvent,fK as WorldManager,f71 as WorldLoopEvent,lH as WorldLoop,Bh as WorldEvent,pH as World,PE as WebServerEvent,BX as WebServer,gK as Vector3,sH as Vector2,cH as Ticker,wh as SimulationEvent,dH as Simulation,oH as SimpleEntityController,uH as SceneUIManager,Hh as SceneUIEvent,xH as SceneUI,g71 as SUPPORTED_INPUT_KEYS,rG as RigidBodyType,nY as RigidBody,A71 as ROTATION_UPDATE_THRESHOLD,bK as Quaternion,FM as PlayerUIEvent,gH as PlayerUI,I71 as PlayerManagerEvent,d5 as PlayerManager,hH as PlayerEvent,O7 as PlayerEntity,h71 as PlayerCameraMode,Uh as PlayerCameraEvent,bH as PlayerCamera,xK as Player,AQ as PersistenceManager,Ch as PathfindingEntityController,_71 as POSITION_UPDATE_THRESHOLD_SQ,RE as PORT,Q9 as ModelRegistry,Y5 as Matrix4,N7 as Matrix3,hQ as Matrix2,x71 as LightType,yH as LightManager,Vh as LightEvent,qh as Light,b71 as GameServerEvent,PZ as GameServer,g0 as EventRouter,m as ErrorHandler,fH as EntityManager,AH as EntityEvent,p8 as Entity,nH as DefaultPlayerEntityController,Mh as DefaultPlayerEntity,S71 as DEFAULT_ENTITY_RIGID_BODY_OPTIONS,u9 as CollisionGroupsBuilder,UY as CollisionGroup,tG as ColliderShape,mH as ColliderMap,f5 as Collider,HD as CoefficientCombineRule,_H as ChunkLattice,Fh as ChunkEvent,I6 as Chunk,iH as ChatManager,Oh as ChatEvent,qD as BlockTypeRegistryEvent,eG as BlockTypeRegistry,VD as BlockTypeEvent,y5 as BlockType,bQ as Block,hh as BaseEntityControllerEvent,zY as BaseEntityController,cK as AudioManager,BM as AudioEvent,uK as Audio};