hytopia 0.5.6-dev14 → 0.5.6-dev16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/scripts.js +0 -0
- package/package.json +1 -1
- package/server.js +2 -2
- package/bun.lock +0 -597
package/server.js
CHANGED
@@ -402,7 +402,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
|
|
402
402
|
`,concatBytes:yR},RW1=(Z,J)=>{let Y=new Uint8Array(Z.length+J.length);return Y.set(Z,0),Y.set(J,Z.length),Y},NW1={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:RW1};import{Buffer as PW1}from"buffer";var Gg=(Z,J)=>Z?void 0:jW1.bind(void 0,J),jW1=function*(Z,J){if(typeof J!=="string"&&!T8(J)&&!PW1.isBuffer(J))throw new TypeError(`The \`${Z}\` option's transform must use "objectMode: true" to receive as input: ${typeof J}.`);yield J},zg=(Z,J)=>Z?DW1.bind(void 0,J):CW1.bind(void 0,J),DW1=function*(Z,J){Fg(Z,J),yield J},CW1=function*(Z,J){if(Fg(Z,J),typeof J!=="string"&&!T8(J))throw new TypeError(`The \`${Z}\` option's function must yield a string or an Uint8Array, not ${typeof J}.`);yield J},Fg=(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 TW1}from"buffer";import{StringDecoder as kW1}from"string_decoder";var Yq=(Z,J,Y)=>{if(Y)return;if(Z)return{transform:EW1.bind(void 0,new TextEncoder)};let $=new kW1(J);return{transform:IW1.bind(void 0,$),final:vW1.bind(void 0,$)}},EW1=function*(Z,J){if(TW1.isBuffer(J))yield X7(J);else if(typeof J==="string")yield Z.encode(J);else yield J},IW1=function*(Z,J){yield T8(J)?Z.write(J):J},vW1=function*(Z){let J=Z.end();if(J!=="")yield J};import{callbackify as Vg}from"util";var gR=Vg(async(Z,J,Y,$)=>{J.currentIterable=Z(...Y);try{for await(let W of J.currentIterable)$.push(W)}finally{delete J.currentIterable}}),$q=async function*(Z,J,Y){if(Y===J.length){yield Z;return}let{transform:$=_W1}=J[Y];for await(let W of $(Z))yield*$q(W,J,Y+1)},Hg=async function*(Z){for(let[J,{final:Y}]of Object.entries(Z))yield*SW1(Y,Number(J),Z)},SW1=async function*(Z,J,Y){if(Z===void 0)return;for await(let $ of Z())yield*$q($,Y,J+1)},qg=Vg(async({currentIterable:Z},J)=>{if(Z!==void 0){await(J?Z.throw(J):Z.return());return}if(J)throw J}),_W1=function*(Z){yield Z};var mR=(Z,J,Y,$)=>{try{for(let W of Z(...J))Y.push(W);$()}catch(W){$(W)}},Ug=(Z,J)=>[...J.flatMap((Y)=>[...sJ(Y,Z,0)]),...cK(Z)],sJ=function*(Z,J,Y){if(Y===J.length){yield Z;return}let{transform:$=AW1}=J[Y];for(let W of $(Z))yield*sJ(W,J,Y+1)},cK=function*(Z){for(let[J,{final:Y}]of Object.entries(Z))yield*xW1(Y,Number(J),Z)},xW1=function*(Z,J,Y){if(Z===void 0)return;for(let $ of Z())yield*sJ($,Y,J+1)},AW1=function*(Z){yield Z};var dR=({value:Z,value:{transform:J,final:Y,writableObjectMode:$,readableObjectMode:W},optionName:Q},{encoding:X})=>{let K={},G=Lg(Z,X,Q),z=aJ(J),F=aJ(Y),V=z?gR.bind(void 0,$q,K):mR.bind(void 0,sJ),H=z||F?gR.bind(void 0,Hg,K):mR.bind(void 0,cK),q=z||F?qg.bind(void 0,K):void 0;return{stream:new hW1({writableObjectMode:$,writableHighWaterMark:wg($),readableObjectMode:W,readableHighWaterMark:wg(W),transform(L,w,O){V([L,G,0],this,O)},flush(L){H([G],this,L)},destroy:q})}},Wq=(Z,J,Y,$)=>{let W=J.filter(({type:X})=>X==="generator"),Q=$?W.reverse():W;for(let{value:X,optionName:K}of Q){let G=Lg(X,Y,K);Z=Ug(G,Z)}return Z},Lg=({transform:Z,final:J,binary:Y,writableObjectMode:$,readableObjectMode:W,preserveNewlines:Q},X,K)=>{let G={};return[{transform:Gg($,K)},Yq(Y,X,$),Jq(Y,Q,$,G),{transform:Z,final:J},{transform:zg(W,K)},Kg({binary:Y,preserveNewlines:Q,readableObjectMode:W,state:G})].filter(Boolean)};var Bg=(Z,J)=>{for(let Y of fW1(Z))yW1(Z,Y,J)},fW1=(Z)=>new Set(Object.entries(Z).filter(([,{direction:J}])=>J==="input").map(([J])=>Number(J))),yW1=(Z,J,Y)=>{let{stdioItems:$}=Z[J],W=$.filter(({contents:K})=>K!==void 0);if(W.length===0)return;if(J!==0){let[{type:K,optionName:G}]=W;throw new TypeError(`Only the \`stdin\` option, not \`${G}\`, can be ${KZ[K]} with synchronous methods.`)}let X=W.map(({contents:K})=>K).map((K)=>bW1(K,$));Y.input=hK(X)},bW1=(Z,J)=>{let Y=Wq(Z,J,"utf8",!0);return gW1(Y),hK(Y)},gW1=(Z)=>{let J=Z.find((Y)=>typeof Y!=="string"&&!T8(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 cW1,appendFileSync as lW1}from"fs";var Qq=({stdioItems:Z,encoding:J,verboseInfo:Y,fdNumber:$})=>$!=="all"&&LW(Y,$)&&!w5.has(J)&&mW1($)&&(Z.some(({type:W,value:Q})=>W==="native"&&dW1.has(Q))||Z.every(({type:W})=>h5.has(W))),mW1=(Z)=>Z===1||Z===2,dW1=new Set(["pipe","overlapped"]),Og=async(Z,J,Y,$)=>{for await(let W of Z)if(!uW1(J))Rg(W,Y,$)},Mg=(Z,J,Y)=>{for(let $ of Z)Rg($,J,Y)},uW1=(Z)=>Z._readableState.pipes.length>0,Rg=(Z,J,Y)=>{let $=LH(Z);W4({type:"output",verboseMessage:$,fdNumber:J,verboseInfo:Y})};var Ng=({fileDescriptors:Z,syncResult:{output:J},options:Y,isMaxBuffer:$,verboseInfo:W})=>{if(J===null)return{output:Array.from({length:3})};let Q={},X=new Set([]);return{output:J.map((G,z)=>pW1({result:G,fileDescriptors:Z,fdNumber:z,state:Q,outputFiles:X,isMaxBuffer:$,verboseInfo:W},Y)),...Q}},pW1=({result:Z,fileDescriptors:J,fdNumber:Y,state:$,outputFiles:W,isMaxBuffer:Q,verboseInfo:X},{buffer:K,encoding:G,lines:z,stripFinalNewline:F,maxBuffer:V})=>{if(Z===null)return;let H=Pb(Z,Q,V),q=X7(H),{stdioItems:U,objectMode:L}=J[Y],w=iW1([q],U,G,$),{serializedResult:O,finalResult:R=O}=nW1({chunks:w,objectMode:L,encoding:G,lines:z,stripFinalNewline:F,fdNumber:Y});aW1({serializedResult:O,fdNumber:Y,state:$,verboseInfo:X,encoding:G,stdioItems:U,objectMode:L});let N=K[Y]?R:void 0;try{if($.error===void 0)sW1(O,U,W);return N}catch(P){return $.error=P,N}},iW1=(Z,J,Y,$)=>{try{return Wq(Z,J,Y,!1)}catch(W){return $.error=W,Z}},nW1=({chunks:Z,objectMode:J,encoding:Y,lines:$,stripFinalNewline:W,fdNumber:Q})=>{if(J)return{serializedResult:Z};if(Y==="buffer")return{serializedResult:hK(Z)};let X=hh(Z,Y);if($[Q])return{serializedResult:X,finalResult:bR(X,!W[Q],J)};return{serializedResult:X}},aW1=({serializedResult:Z,fdNumber:J,state:Y,verboseInfo:$,encoding:W,stdioItems:Q,objectMode:X})=>{if(!Qq({stdioItems:Q,encoding:W,verboseInfo:$,fdNumber:J}))return;let K=bR(Z,!1,X);try{Mg(K,J,$)}catch(G){Y.error??=G}},sW1=(Z,J,Y)=>{for(let{path:$,append:W}of J.filter(({type:Q})=>eH.has(Q))){let Q=typeof $==="string"?$:$.toString();if(W||Y.has(Q))lW1($,Z);else Y.add(Q),cW1($,Z)}};var Pg=([,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,F7(J,Y,"all")];if(Array.isArray(J))return[F7(Z,Y,"all"),...J];if(T8(Z)&&T8(J))return nM([Z,J]);return`${Z}${J}`};import{once as uR}from"events";var jg=async(Z,J)=>{let[Y,$]=await oW1(Z);return J.isForcefullyTerminated??=!1,[Y,$]},oW1=async(Z)=>{let[J,Y]=await Promise.allSettled([uR(Z,"spawn"),uR(Z,"exit")]);if(J.status==="rejected")return[];return Y.status==="rejected"?Dg(Z):Y.value},Dg=async(Z)=>{try{return await uR(Z,"exit")}catch{return Dg(Z)}},Cg=async(Z)=>{let[J,Y]=await Z;if(!rW1(J,Y)&&cR(J,Y))throw new Q4;return[J,Y]},rW1=(Z,J)=>Z===void 0&&J===void 0,cR=(Z,J)=>Z!==0||J!==null;var Tg=({error:Z,status:J,signal:Y,output:$},{maxBuffer:W})=>{let Q=tW1(Z,J,Y),X=Q?.code==="ETIMEDOUT",K=Nb(Q,$,W);return{resultError:Q,exitCode:J,signal:Y,timedOut:X,isMaxBuffer:K}},tW1=(Z,J,Y)=>{if(Z!==void 0)return Z;return cR(J,Y)?new Q4:void 0};var kg=(Z,J,Y)=>{let{file:$,commandArguments:W,command:Q,escapedCommand:X,startTime:K,verboseInfo:G,options:z,fileDescriptors:F}=ZQ1(Z,J,Y),V=$Q1({file:$,commandArguments:W,options:z,command:Q,escapedCommand:X,verboseInfo:G,fileDescriptors:F,startTime:K});return CW(V,G,z)},ZQ1=(Z,J,Y)=>{let{command:$,escapedCommand:W,startTime:Q,verboseInfo:X}=OH(Z,J,Y),K=JQ1(Y),{file:G,commandArguments:z,options:F}=dH(Z,J,K);YQ1(F);let V=$g(F,X);return{file:G,commandArguments:z,command:$,escapedCommand:W,startTime:Q,verboseInfo:X,options:F,fileDescriptors:V}},JQ1=(Z)=>Z.node&&!Z.ipc?{...Z,ipc:!1}:Z,YQ1=({ipc:Z,ipcInput:J,detached:Y,cancelSignal:$})=>{if(J)Xq("ipcInput");if(Z)Xq("ipc: true");if(Y)Xq("detached: true");if($)Xq("cancelSignal")},Xq=(Z)=>{throw new TypeError(`The "${Z}" option cannot be used with synchronous methods.`)},$Q1=({file:Z,commandArguments:J,options:Y,command:$,escapedCommand:W,verboseInfo:Q,fileDescriptors:X,startTime:K})=>{let G=WQ1({file:Z,commandArguments:J,options:Y,command:$,escapedCommand:W,fileDescriptors:X,startTime:K});if(G.failed)return G;let{resultError:z,exitCode:F,signal:V,timedOut:H,isMaxBuffer:q}=Tg(G,Y),{output:U,error:L=z}=Ng({fileDescriptors:X,syncResult:G,options:Y,isMaxBuffer:q,verboseInfo:Q}),w=U.map((R,N)=>F7(R,Y,N)),O=F7(Pg(U,Y),Y,"all");return XQ1({error:L,exitCode:F,signal:V,timedOut:H,isMaxBuffer:q,stdio:w,all:O,options:Y,command:$,escapedCommand:W,startTime:K})},WQ1=({file:Z,commandArguments:J,options:Y,command:$,escapedCommand:W,fileDescriptors:Q,startTime:X})=>{try{Bg(Q,Y);let K=QQ1(Y);return eW1(Z,J,K)}catch(K){return DW({error:K,command:$,escapedCommand:W,fileDescriptors:Q,options:Y,startTime:X,isSync:!0})}},QQ1=({encoding:Z,maxBuffer:J,...Y})=>({...Y,encoding:"buffer",maxBuffer:sH(J)}),XQ1=({error:Z,exitCode:J,signal:Y,timedOut:$,isMaxBuffer:W,stdio:Q,all:X,options:K,command:G,escapedCommand:z,startTime:F})=>Z===void 0?oH({command:G,escapedCommand:z,stdio:Q,all:X,ipcOutput:[],options:K,startTime:F}):uK({error:Z,command:G,escapedCommand:z,timedOut:$,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:W,isForcefullyTerminated:!1,exitCode:J,signal:Y,stdio:Q,all:X,ipcOutput:[],options:K,startTime:F,isSync:!0});import{setMaxListeners as nX1}from"events";import{spawn as aX1}from"child_process";import _g from"process";import{once as lR,on as KQ1}from"events";var Eg=({anyProcess:Z,channel:J,isSubprocess:Y,ipc:$},{reference:W=!0,filter:Q}={})=>{return MW({methodName:"getOneMessage",isSubprocess:Y,ipc:$,isConnected:hH(Z)}),GQ1({anyProcess:Z,channel:J,isSubprocess:Y,filter:Q,reference:W})},GQ1=async({anyProcess:Z,channel:J,isSubprocess:Y,filter:$,reference:W})=>{SH(J,W);let Q=XZ(Z,J,Y),X=new AbortController;try{return await Promise.race([zQ1(Q,$,X),FQ1(Q,Y,X),VQ1(Q,Y,X)])}catch(K){throw RW(Z),K}finally{X.abort(),_H(J,W)}},zQ1=async(Z,J,{signal:Y})=>{if(J===void 0){let[$]=await lR(Z,"message",{signal:Y});return $}for await(let[$]of KQ1(Z,"message",{signal:Y}))if(J($))return $},FQ1=async(Z,J,{signal:Y})=>{await lR(Z,"disconnect",{signal:Y}),qy(J)},VQ1=async(Z,J,{signal:Y})=>{let[$]=await lR(Z,"strict:error",{signal:Y});throw EH($,J)};import{once as vg,on as HQ1}from"events";var Sg=({anyProcess:Z,channel:J,isSubprocess:Y,ipc:$},{reference:W=!0}={})=>pR({anyProcess:Z,channel:J,isSubprocess:Y,ipc:$,shouldAwait:!Y,reference:W}),pR=({anyProcess:Z,channel:J,isSubprocess:Y,ipc:$,shouldAwait:W,reference:Q})=>{MW({methodName:"getEachMessage",isSubprocess:Y,ipc:$,isConnected:hH(Z)}),SH(J,Q);let X=XZ(Z,J,Y),K=new AbortController,G={};return qQ1(Z,X,K),UQ1({ipcEmitter:X,isSubprocess:Y,controller:K,state:G}),wQ1({anyProcess:Z,channel:J,ipcEmitter:X,isSubprocess:Y,shouldAwait:W,controller:K,state:G,reference:Q})},qQ1=async(Z,J,Y)=>{try{await vg(J,"disconnect",{signal:Y.signal}),Y.abort()}catch{}},UQ1=async({ipcEmitter:Z,isSubprocess:J,controller:Y,state:$})=>{try{let[W]=await vg(Z,"strict:error",{signal:Y.signal});$.error=EH(W,J),Y.abort()}catch{}},wQ1=async function*({anyProcess:Z,channel:J,ipcEmitter:Y,isSubprocess:$,shouldAwait:W,controller:Q,state:X,reference:K}){try{for await(let[G]of HQ1(Y,"message",{signal:Q.signal}))Ig(X),yield G}catch{Ig(X)}finally{if(Q.abort(),_H(J,K),!$)RW(Z);if(W)await Z}},Ig=({error:Z})=>{if(Z)throw Z};var xg=(Z,{ipc:J})=>{Object.assign(Z,hg(Z,!1,J))},Ag=()=>{let Z=_g,J=!0,Y=_g.channel!==void 0;return{...hg(Z,!0,Y),getCancelSignal:my.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:!0,ipc:Y})}},hg=(Z,J,Y)=>({sendMessage:gH.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:Y}),getOneMessage:Eg.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:Y}),getEachMessage:Sg.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:Y})});import{ChildProcess as LQ1}from"child_process";import{PassThrough as BQ1,Readable as OQ1,Writable as MQ1,Duplex as RQ1}from"stream";var fg=({error:Z,command:J,escapedCommand:Y,fileDescriptors:$,options:W,startTime:Q,verboseInfo:X})=>{hR($);let K=new LQ1;NQ1(K,$),Object.assign(K,{readable:PQ1,writable:jQ1,duplex:DQ1});let G=DW({error:Z,command:J,escapedCommand:Y,fileDescriptors:$,options:W,startTime:Q,isSync:!1}),z=CQ1(G,X,W);return{subprocess:K,promise:z}},NQ1=(Z,J)=>{let Y=lK(),$=lK(),W=lK(),Q=Array.from({length:J.length-3},lK),X=lK(),K=[Y,$,W,...Q];Object.assign(Z,{stdin:Y,stdout:$,stderr:W,all:X,stdio:K})},lK=()=>{let Z=new BQ1;return Z.end(),Z},PQ1=()=>new OQ1({read(){}}),jQ1=()=>new MQ1({write(){}}),DQ1=()=>new RQ1({read(){},write(){}}),CQ1=async(Z,J,Y)=>CW(Z,J,Y);import{createReadStream as yg,createWriteStream as bg}from"fs";import{Buffer as TQ1}from"buffer";import{Readable as pK,Writable as kQ1,Duplex as EQ1}from"stream";var mg=(Z,J)=>Zq(IQ1,Z,J,!1),iK=({type:Z,optionName:J})=>{throw new TypeError(`The \`${J}\` option cannot be ${KZ[Z]}.`)},gg={fileNumber:iK,generator:dR,asyncGenerator:dR,nodeStream:({value:Z})=>({stream:Z}),webTransform({value:{transform:Z,writableObjectMode:J,readableObjectMode:Y}}){let $=J||Y;return{stream:EQ1.fromWeb(Z,{objectMode:$})}},duplex:({value:{transform:Z}})=>({stream:Z}),native(){}},IQ1={input:{...gg,fileUrl:({value:Z})=>({stream:yg(Z)}),filePath:({value:{file:Z}})=>({stream:yg(Z)}),webStream:({value:Z})=>({stream:pK.fromWeb(Z)}),iterable:({value:Z})=>({stream:pK.from(Z)}),asyncIterable:({value:Z})=>({stream:pK.from(Z)}),string:({value:Z})=>({stream:pK.from(Z)}),uint8Array:({value:Z})=>({stream:pK.from(TQ1.from(Z))})},output:{...gg,fileUrl:({value:Z})=>({stream:bg(Z)}),filePath:({value:{file:Z,append:J}})=>({stream:bg(Z,J?{flags:"a"}:{})}),webStream:({value:Z})=>({stream:kQ1.fromWeb(Z)}),iterable:iK,asyncIterable:iK,string:iK,uint8Array:iK}};import{on as vQ1,once as dg}from"events";import{PassThrough as SQ1,getDefaultHighWaterMark as _Q1}from"stream";import{finished as lg}from"stream/promises";function oJ(Z){if(!Array.isArray(Z))throw new TypeError(`Expected an array, got \`${typeof Z}\`.`);for(let W of Z)iR(W);let J=Z.some(({readableObjectMode:W})=>W),Y=xQ1(Z,J),$=new pg({objectMode:J,writableHighWaterMark:Y,readableHighWaterMark:Y});for(let W of Z)$.add(W);return $}var xQ1=(Z,J)=>{if(Z.length===0)return _Q1(J);let Y=Z.filter(({readableObjectMode:$})=>$===J).map(({readableHighWaterMark:$})=>$);return Math.max(...Y)};class pg extends SQ1{#Y=new Set([]);#$=new Set([]);#J=new Set([]);#Z;#W=Symbol("unpipe");#Q=new WeakMap;add(Z){if(iR(Z),this.#Y.has(Z))return;this.#Y.add(Z),this.#Z??=AQ1(this,this.#Y,this.#W);let J=yQ1({passThroughStream:this,stream:Z,streams:this.#Y,ended:this.#$,aborted:this.#J,onFinished:this.#Z,unpipeEvent:this.#W});this.#Q.set(Z,J),Z.pipe(this,{end:!1})}async remove(Z){if(iR(Z),!this.#Y.has(Z))return!1;let J=this.#Q.get(Z);if(J===void 0)return!1;return this.#Q.delete(Z),Z.unpipe(this),await J,!0}}var AQ1=async(Z,J,Y)=>{Kq(Z,ug);let $=new AbortController;try{await Promise.race([hQ1(Z,$),fQ1(Z,J,Y,$)])}finally{$.abort(),Kq(Z,-ug)}},hQ1=async(Z,{signal:J})=>{try{await lg(Z,{signal:J,cleanup:!0})}catch(Y){throw ig(Z,Y),Y}},fQ1=async(Z,J,Y,{signal:$})=>{for await(let[W]of vQ1(Z,"unpipe",{signal:$}))if(J.has(W))W.emit(Y)},iR=(Z)=>{if(typeof Z?.pipe!=="function")throw new TypeError(`Expected a readable stream, got: \`${typeof Z}\`.`)},yQ1=async({passThroughStream:Z,stream:J,streams:Y,ended:$,aborted:W,onFinished:Q,unpipeEvent:X})=>{Kq(Z,cg);let K=new AbortController;try{await Promise.race([bQ1(Q,J,K),gQ1({passThroughStream:Z,stream:J,streams:Y,ended:$,aborted:W,controller:K}),mQ1({stream:J,streams:Y,ended:$,aborted:W,unpipeEvent:X,controller:K})])}finally{K.abort(),Kq(Z,-cg)}if(Y.size>0&&Y.size===$.size+W.size)if($.size===0&&W.size>0)nR(Z);else dQ1(Z)},bQ1=async(Z,J,{signal:Y})=>{try{if(await Z,!Y.aborted)nR(J)}catch($){if(!Y.aborted)ig(J,$)}},gQ1=async({passThroughStream:Z,stream:J,streams:Y,ended:$,aborted:W,controller:{signal:Q}})=>{try{if(await lg(J,{signal:Q,cleanup:!0,readable:!0,writable:!1}),Y.has(J))$.add(J)}catch(X){if(Q.aborted||!Y.has(J))return;if(ng(X))W.add(J);else ag(Z,X)}},mQ1=async({stream:Z,streams:J,ended:Y,aborted:$,unpipeEvent:W,controller:{signal:Q}})=>{if(await dg(Z,W,{signal:Q}),!Z.readable)return dg(Q,"abort",{signal:Q});J.delete(Z),Y.delete(Z),$.delete(Z)},dQ1=(Z)=>{if(Z.writable)Z.end()},ig=(Z,J)=>{if(ng(J))nR(Z);else ag(Z,J)},ng=(Z)=>Z?.code==="ERR_STREAM_PREMATURE_CLOSE",nR=(Z)=>{if(Z.readable||Z.writable)Z.destroy()},ag=(Z,J)=>{if(!Z.destroyed)Z.once("error",uQ1),Z.destroy(J)},uQ1=()=>{},Kq=(Z,J)=>{let Y=Z.getMaxListeners();if(Y!==0&&Y!==Number.POSITIVE_INFINITY)Z.setMaxListeners(Y+J)},ug=2,cg=1;import{finished as sg}from"stream/promises";var kW=(Z,J)=>{Z.pipe(J),cQ1(Z,J),lQ1(Z,J)},cQ1=async(Z,J)=>{if(C9(Z)||C9(J))return;try{await sg(Z,{cleanup:!0,readable:!0,writable:!1})}catch{}aR(J)},aR=(Z)=>{if(Z.writable)Z.end()},lQ1=async(Z,J)=>{if(C9(Z)||C9(J))return;try{await sg(J,{cleanup:!0,readable:!1,writable:!0})}catch{}sR(Z)},sR=(Z)=>{if(Z.readable)Z.destroy()};var og=(Z,J,Y)=>{let $=new Map;for(let[W,{stdioItems:Q,direction:X}]of Object.entries(J)){for(let{stream:K}of Q.filter(({type:G})=>h5.has(G)))pQ1(Z,K,X,W);for(let{stream:K}of Q.filter(({type:G})=>!h5.has(G)))nQ1({subprocess:Z,stream:K,direction:X,fdNumber:W,pipeGroups:$,controller:Y})}for(let[W,Q]of $.entries()){let X=Q.length===1?Q[0]:oJ(Q);kW(X,W)}},pQ1=(Z,J,Y,$)=>{if(Y==="output")kW(Z.stdio[$],J);else kW(J,Z.stdio[$]);let W=iQ1[$];if(W!==void 0)Z[W]=J;Z.stdio[$]=J},iQ1=["stdin","stdout","stderr"],nQ1=({subprocess:Z,stream:J,direction:Y,fdNumber:$,pipeGroups:W,controller:Q})=>{if(J===void 0)return;aQ1(J,Q);let[X,K]=Y==="output"?[J,Z.stdio[$]]:[Z.stdio[$],J],G=W.get(X)??[];W.set(X,[...G,K])},aQ1=(Z,{signal:J})=>{if(C9(Z))iJ(Z,sQ1,J)},sQ1=2;import{addAbortListener as tQ1}from"events";var rJ=[];rJ.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")rJ.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")rJ.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Gq=(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",oR=Symbol.for("signal-exit emitter"),rR=globalThis,oQ1=Object.defineProperty.bind(Object);class rg{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(rR[oR])return rR[oR];oQ1(rR,oR,{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 W of this.listeners[Z])$=W(J,Y)===!0||$;if(Z==="exit")$=this.emit("afterExit",J,Y)||$;return $}}class eR{}var rQ1=(Z)=>{return{onExit(J,Y){return Z.onExit(J,Y)},load(){return Z.load()},unload(){return Z.unload()}}};class tg extends eR{onExit(){return()=>{}}load(){}unload(){}}class eg extends eR{#Y=tR.platform==="win32"?"SIGINT":"SIGHUP";#$=new rg;#J;#Z;#W;#Q={};#X=!1;constructor(Z){super();this.#J=Z,this.#Q={};for(let J of rJ)this.#Q[J]=()=>{let Y=this.#J.listeners(J),{count:$}=this.#$,W=Z;if(typeof W.__signal_exit_emitter__==="object"&&typeof W.__signal_exit_emitter__.count==="number")$+=W.__signal_exit_emitter__.count;if(Y.length===$){this.unload();let Q=this.#$.emit("exit",null,J),X=J==="SIGHUP"?this.#Y:J;if(!Q)Z.kill(Z.pid,X)}};this.#W=Z.reallyExit,this.#Z=Z.emit}onExit(Z,J){if(!Gq(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 rJ)try{let J=this.#Q[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,rJ.forEach((Z)=>{let J=this.#Q[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.#W,this.#$.count-=1}#G(Z){if(!Gq(this.#J))return 0;return this.#J.exitCode=Z||0,this.#$.emit("exit",this.#J.exitCode,null),this.#W.call(this.#J,this.#J.exitCode)}#K(Z,...J){let Y=this.#Z;if(Z==="exit"&&Gq(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 tR=globalThis.process,{onExit:Zm,load:fJ6,unload:yJ6}=rQ1(Gq(tR)?new eg(tR):new tg);var Jm=(Z,{cleanup:J,detached:Y},{signal:$})=>{if(!J||Y)return;let W=Zm(()=>{Z.kill()});tQ1($,()=>{W()})};var $m=({source:Z,sourcePromise:J,boundOptions:Y,createNested:$},...W)=>{let Q=BH(),{destination:X,destinationStream:K,destinationError:G,from:z,unpipeSignal:F}=eQ1(Y,$,W),{sourceStream:V,sourceError:H}=JX1(Z,z),{options:q,fileDescriptors:U}=K4.get(Z);return{sourcePromise:J,sourceStream:V,sourceOptions:q,sourceError:H,destination:X,destinationStream:K,destinationError:G,unpipeSignal:F,fileDescriptors:U,startTime:Q}},eQ1=(Z,J,Y)=>{try{let{destination:$,pipeOptions:{from:W,to:Q,unpipeSignal:X}={}}=ZX1(Z,J,...Y),K=vH($,Q);return{destination:$,destinationStream:K,from:W,unpipeSignal:X}}catch($){return{destinationError:$}}},ZX1=(Z,J,Y,...$)=>{if(Array.isArray(Y))return{destination:J(Ym,Z)(Y,...$),pipeOptions:Z};if(typeof Y==="string"||Y instanceof URL||pM(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[W,Q,X]=KH(Y,...$);return{destination:J(Ym)(W,Q,X),pipeOptions:X}}if(K4.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}`)},Ym=({options:Z})=>({options:{...Z,stdin:"pipe",piped:!0}}),JX1=(Z,J)=>{try{return{sourceStream:NW(Z,J)}}catch(Y){return{sourceError:Y}}};var Qm=({sourceStream:Z,sourceError:J,destinationStream:Y,destinationError:$,fileDescriptors:W,sourceOptions:Q,startTime:X})=>{let K=YX1({sourceStream:Z,sourceError:J,destinationStream:Y,destinationError:$});if(K!==void 0)throw ZN({error:K,fileDescriptors:W,sourceOptions:Q,startTime:X})},YX1=({sourceStream:Z,sourceError:J,destinationStream:Y,destinationError:$})=>{if(J!==void 0&&$!==void 0)return $;if($!==void 0)return sR(Z),$;if(J!==void 0)return aR(Y),J},ZN=({error:Z,fileDescriptors:J,sourceOptions:Y,startTime:$})=>DW({error:Z,command:Wm,escapedCommand:Wm,fileDescriptors:J,options:Y,startTime:$,isSync:!1}),Wm="source.pipe(destination)";var Xm=async(Z)=>{let[{status:J,reason:Y,value:$=Y},{status:W,reason:Q,value:X=Q}]=await Z;if(!X.pipedFrom.includes($))X.pipedFrom.push($);if(W==="rejected")throw X;if(J==="rejected")throw $;return X};import{finished as $X1}from"stream/promises";var Km=(Z,J,Y)=>{let $=zq.has(J)?QX1(Z,J):WX1(Z,J);return iJ(Z,KX1,Y.signal),iJ(J,GX1,Y.signal),XX1(J),$},WX1=(Z,J)=>{let Y=oJ([Z]);return kW(Y,J),zq.set(J,Y),Y},QX1=(Z,J)=>{let Y=zq.get(J);return Y.add(Z),Y},XX1=async(Z)=>{try{await $X1(Z,{cleanup:!0,readable:!1,writable:!0})}catch{}zq.delete(Z)},zq=new WeakMap,KX1=2,GX1=1;import{aborted as zX1}from"util";var Gm=(Z,J)=>Z===void 0?[]:[FX1(Z,J)],FX1=async(Z,{sourceStream:J,mergedStream:Y,fileDescriptors:$,sourceOptions:W,startTime:Q})=>{await zX1(Z,J),await Y.remove(J);let X=new Error("Pipe canceled by `unpipeSignal` option.");throw ZN({error:X,fileDescriptors:$,sourceOptions:W,startTime:Q})};var Fq=(Z,...J)=>{if(K8(J[0]))return Fq.bind(void 0,{...Z,boundOptions:{...Z.boundOptions,...J[0]}});let{destination:Y,...$}=$m(Z,...J),W=VX1({...$,destination:Y});return W.pipe=Fq.bind(void 0,{...Z,source:Y,sourcePromise:W,boundOptions:{}}),W},VX1=async({sourcePromise:Z,sourceStream:J,sourceOptions:Y,sourceError:$,destination:W,destinationStream:Q,destinationError:X,unpipeSignal:K,fileDescriptors:G,startTime:z})=>{let F=HX1(Z,W);Qm({sourceStream:J,sourceError:$,destinationStream:Q,destinationError:X,fileDescriptors:G,sourceOptions:Y,startTime:z});let V=new AbortController;try{let H=Km(J,Q,V);return await Promise.race([Xm(F),...Gm(K,{sourceStream:J,mergedStream:H,sourceOptions:Y,fileDescriptors:G,startTime:z})])}finally{V.abort()}},HX1=(Z,J)=>Promise.allSettled([Z,J]);import{setImmediate as MX1}from"timers/promises";import{on as qX1}from"events";import{getDefaultHighWaterMark as UX1}from"stream";var Vq=({subprocessStdout:Z,subprocess:J,binary:Y,shouldEncode:$,encoding:W,preserveNewlines:Q})=>{let X=new AbortController;return wX1(J,X),Fm({stream:Z,controller:X,binary:Y,shouldEncode:!Z.readableObjectMode&&$,encoding:W,shouldSplit:!Z.readableObjectMode,preserveNewlines:Q})},wX1=async(Z,J)=>{try{await Z}catch{}finally{J.abort()}},JN=({stream:Z,onStreamEnd:J,lines:Y,encoding:$,stripFinalNewline:W,allMixed:Q})=>{let X=new AbortController;LX1(J,X,Z);let K=Z.readableObjectMode&&!Q;return Fm({stream:Z,controller:X,binary:$==="buffer",shouldEncode:!K,encoding:$,shouldSplit:!K&&Y,preserveNewlines:!W})},LX1=async(Z,J,Y)=>{try{await Z}catch{Y.destroy()}finally{J.abort()}},Fm=({stream:Z,controller:J,binary:Y,shouldEncode:$,encoding:W,shouldSplit:Q,preserveNewlines:X})=>{let K=qX1(Z,"data",{signal:J.signal,highWaterMark:zm,highWatermark:zm});return BX1({onStdoutChunk:K,controller:J,binary:Y,shouldEncode:$,encoding:W,shouldSplit:Q,preserveNewlines:X})},YN=UX1(!0),zm=YN,BX1=async function*({onStdoutChunk:Z,controller:J,binary:Y,shouldEncode:$,encoding:W,shouldSplit:Q,preserveNewlines:X}){let K=OX1({binary:Y,shouldEncode:$,encoding:W,shouldSplit:Q,preserveNewlines:X});try{for await(let[G]of Z)yield*sJ(G,K,0)}catch(G){if(!J.signal.aborted)throw G}finally{yield*cK(K)}},OX1=({binary:Z,shouldEncode:J,encoding:Y,shouldSplit:$,preserveNewlines:W})=>[Yq(Z,Y,!J),Jq(Z,W,!$,{})].filter(Boolean);var Vm=async({stream:Z,onStreamEnd:J,fdNumber:Y,encoding:$,buffer:W,maxBuffer:Q,lines:X,allMixed:K,stripFinalNewline:G,verboseInfo:z,streamInfo:F})=>{let V=RX1({stream:Z,onStreamEnd:J,fdNumber:Y,encoding:$,allMixed:K,verboseInfo:z,streamInfo:F});if(!W){await Promise.all([NX1(Z),V]);return}let H=fR(G,Y),q=JN({stream:Z,onStreamEnd:J,lines:X,encoding:$,stripFinalNewline:H,allMixed:K}),[U]=await Promise.all([PX1({stream:Z,iterable:q,fdNumber:Y,encoding:$,maxBuffer:Q,lines:X}),V]);return U},RX1=async({stream:Z,onStreamEnd:J,fdNumber:Y,encoding:$,allMixed:W,verboseInfo:Q,streamInfo:{fileDescriptors:X}})=>{if(!Qq({stdioItems:X[Y]?.stdioItems,encoding:$,verboseInfo:Q,fdNumber:Y}))return;let K=JN({stream:Z,onStreamEnd:J,lines:!0,encoding:$,stripFinalNewline:!0,allMixed:W});await Og(K,Z,Y,Q)},NX1=async(Z)=>{if(await MX1(),Z.readableFlowing===null)Z.resume()},PX1=async({stream:Z,stream:{readableObjectMode:J},iterable:Y,fdNumber:$,encoding:W,maxBuffer:Q,lines:X})=>{try{if(J||X)return await pH(Y,{maxBuffer:Q});if(W==="buffer")return new Uint8Array(await iH(Y,{maxBuffer:Q}));return await aH(Y,{maxBuffer:Q})}catch(K){return Hm(Ob({error:K,stream:Z,readableObjectMode:J,lines:X,encoding:W,fdNumber:$}))}},$N=async(Z)=>{try{return await Z}catch(J){return Hm(J)}},Hm=({bufferedData:Z})=>xh(Z)?new Uint8Array(Z):Z;import{finished as jX1}from"stream/promises";var nK=async(Z,J,Y,{isSameDirection:$,stopOnExit:W=!1}={})=>{let Q=DX1(Z,Y),X=new AbortController;try{await Promise.race([...W?[Y.exitPromise]:[],jX1(Z,{cleanup:!0,signal:X.signal})])}catch(K){if(!Q.stdinCleanedUp)kX1(K,J,Y,$)}finally{X.abort()}},DX1=(Z,{originalStreams:[J],subprocess:Y})=>{let $={stdinCleanedUp:!1};if(Z===J)CX1(Z,Y,$);return $},CX1=(Z,J,Y)=>{let{_destroy:$}=Z;Z._destroy=(...W)=>{TX1(J,Y),$.call(Z,...W)}},TX1=({exitCode:Z,signalCode:J},Y)=>{if(Z!==null||J!==null)Y.stdinCleanedUp=!0},kX1=(Z,J,Y,$)=>{if(!EX1(Z,J,Y,$))throw Z},EX1=(Z,J,Y,$=!0)=>{if(Y.propagating)return qm(Z)||Hq(Z);return Y.propagating=!0,WN(Y,J)===$?qm(Z):Hq(Z)},WN=({fileDescriptors:Z},J)=>J!=="all"&&Z[J].direction==="input",Hq=(Z)=>Z?.code==="ERR_STREAM_PREMATURE_CLOSE",qm=(Z)=>Z?.code==="EPIPE";var Um=({subprocess:Z,encoding:J,buffer:Y,maxBuffer:$,lines:W,stripFinalNewline:Q,verboseInfo:X,streamInfo:K})=>Z.stdio.map((G,z)=>QN({stream:G,fdNumber:z,encoding:J,buffer:Y[z],maxBuffer:$[z],lines:W[z],allMixed:!1,stripFinalNewline:Q,verboseInfo:X,streamInfo:K})),QN=async({stream:Z,fdNumber:J,encoding:Y,buffer:$,maxBuffer:W,lines:Q,allMixed:X,stripFinalNewline:K,verboseInfo:G,streamInfo:z})=>{if(!Z)return;let F=nK(Z,J,z);if(WN(z,J)){await F;return}let[V]=await Promise.all([Vm({stream:Z,onStreamEnd:F,fdNumber:J,encoding:Y,buffer:$,maxBuffer:W,lines:Q,allMixed:X,stripFinalNewline:K,verboseInfo:G,streamInfo:z}),F]);return V};var wm=({stdout:Z,stderr:J},{all:Y})=>Y&&(Z||J)?oJ([Z,J].filter(Boolean)):void 0,Lm=({subprocess:Z,encoding:J,buffer:Y,maxBuffer:$,lines:W,stripFinalNewline:Q,verboseInfo:X,streamInfo:K})=>QN({...IX1(Z,Y),fdNumber:"all",encoding:J,maxBuffer:$[1]+$[2],lines:W[1]||W[2],allMixed:vX1(Z),stripFinalNewline:Q,verboseInfo:X,streamInfo:K}),IX1=({stdout:Z,stderr:J,all:Y},[,$,W])=>{let Q=$||W;if(!Q)return{stream:Y,buffer:Q};if(!$)return{stream:J,buffer:Q};if(!W)return{stream:Z,buffer:Q};return{stream:Y,buffer:Q}},vX1=({all:Z,stdout:J,stderr:Y})=>Z&&J&&Y&&J.readableObjectMode!==Y.readableObjectMode;import{once as SX1}from"events";var Bm=(Z)=>LW(Z,"ipc"),Om=(Z,J)=>{let Y=LH(Z);W4({type:"ipc",verboseMessage:Y,fdNumber:"ipc",verboseInfo:J})};var Mm=async({subprocess:Z,buffer:J,maxBuffer:Y,ipc:$,ipcOutput:W,verboseInfo:Q})=>{if(!$)return W;let X=Bm(Q),K=K7(J,"ipc"),G=K7(Y,"ipc");for await(let z of pR({anyProcess:Z,channel:Z.channel,isSubprocess:!1,ipc:$,shouldAwait:!1,reference:!0})){if(K)Mb(Z,W,G),W.push(z);if(X)Om(z,Q)}return W},Rm=async(Z,J)=>{return await Promise.allSettled([Z]),J};var Nm=async({subprocess:Z,options:{encoding:J,buffer:Y,maxBuffer:$,lines:W,timeoutDuration:Q,cancelSignal:X,gracefulCancel:K,forceKillAfterDelay:G,stripFinalNewline:z,ipc:F,ipcInput:V},context:H,verboseInfo:q,fileDescriptors:U,originalStreams:L,onInternalError:w,controller:O})=>{let R=jg(Z,H),N={originalStreams:L,fileDescriptors:U,subprocess:Z,exitPromise:R,propagating:!1},P=Um({subprocess:Z,encoding:J,buffer:Y,maxBuffer:$,lines:W,stripFinalNewline:z,verboseInfo:q,streamInfo:N}),D=Lm({subprocess:Z,encoding:J,buffer:Y,maxBuffer:$,lines:W,stripFinalNewline:z,verboseInfo:q,streamInfo:N}),j=[],C=Mm({subprocess:Z,buffer:Y,maxBuffer:$,ipc:F,ipcOutput:j,verboseInfo:q}),k=_X1(L,Z,N),I=xX1(U,N);try{return await Promise.race([Promise.all([{},Cg(R),Promise.all(P),D,C,oy(Z,V),...k,...I]),w,AX1(Z,O),...py(Z,Q,H,O),...Hy({subprocess:Z,cancelSignal:X,gracefulCancel:K,context:H,controller:O}),...cy({subprocess:Z,cancelSignal:X,gracefulCancel:K,forceKillAfterDelay:G,context:H,controller:O})])}catch(A){return H.terminationReason??="other",Promise.all([{error:A},R,Promise.all(P.map((v)=>$N(v))),$N(D),Rm(C,j),Promise.allSettled(k),Promise.allSettled(I)])}},_X1=(Z,J,Y)=>Z.map(($,W)=>$===J.stdio[W]?void 0:nK($,W,Y)),xX1=(Z,J)=>Z.flatMap(({stdioItems:Y},$)=>Y.filter(({value:W,stream:Q=W})=>k9(Q,{checkOpen:!1})&&!C9(Q)).map(({type:W,value:Q,stream:X=Q})=>nK(X,$,J,{isSameDirection:h5.has(W),stopOnExit:W==="native"}))),AX1=async(Z,{signal:J})=>{let[Y]=await SX1(Z,"error",{signal:J});throw Y};var Pm=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),aK=(Z,J,Y)=>{let $=Z[Y];if(!$.has(J))$.set(J,[]);let W=$.get(J),Q=X4();return W.push(Q),{resolve:Q.resolve.bind(Q),promises:W}},EW=async({resolve:Z,promises:J},Y)=>{Z();let[$]=await Promise.race([Promise.allSettled([!0,Y]),Promise.all([!1,...J])]);return!$};import{Readable as hX1}from"stream";import{callbackify as fX1}from"util";import{finished as jm}from"stream/promises";var XN=async(Z)=>{if(Z===void 0)return;try{await KN(Z)}catch{}},Dm=async(Z)=>{if(Z===void 0)return;try{await GN(Z)}catch{}},KN=async(Z)=>{await jm(Z,{cleanup:!0,readable:!1,writable:!0})},GN=async(Z)=>{await jm(Z,{cleanup:!0,readable:!0,writable:!1})},qq=async(Z,J)=>{if(await Z,J)throw J},Uq=(Z,J,Y)=>{if(Y&&!Hq(Y))Z.destroy(Y);else if(J)Z.destroy()};var Cm=({subprocess:Z,concurrentStreams:J,encoding:Y},{from:$,binary:W=!0,preserveNewlines:Q=!0}={})=>{let X=W||w5.has(Y),{subprocessStdout:K,waitReadableDestroy:G}=zN(Z,$,J),{readableEncoding:z,readableObjectMode:F,readableHighWaterMark:V}=FN(K,X),{read:H,onStdoutDataDone:q}=VN({subprocessStdout:K,subprocess:Z,binary:X,encoding:Y,preserveNewlines:Q}),U=new hX1({read:H,destroy:fX1(qN.bind(void 0,{subprocessStdout:K,subprocess:Z,waitReadableDestroy:G})),highWaterMark:V,objectMode:F,encoding:z});return HN({subprocessStdout:K,onStdoutDataDone:q,readable:U,subprocess:Z}),U},zN=(Z,J,Y)=>{let $=NW(Z,J),W=aK(Y,$,"readableDestroy");return{subprocessStdout:$,waitReadableDestroy:W}},FN=({readableEncoding:Z,readableObjectMode:J,readableHighWaterMark:Y},$)=>$?{readableEncoding:Z,readableObjectMode:J,readableHighWaterMark:Y}:{readableEncoding:Z,readableObjectMode:!0,readableHighWaterMark:YN},VN=({subprocessStdout:Z,subprocess:J,binary:Y,encoding:$,preserveNewlines:W})=>{let Q=X4(),X=Vq({subprocessStdout:Z,subprocess:J,binary:Y,shouldEncode:!Y,encoding:$,preserveNewlines:W});return{read(){yX1(this,X,Q)},onStdoutDataDone:Q}},yX1=async(Z,J,Y)=>{try{let{value:$,done:W}=await J.next();if(W)Y.resolve();else Z.push($)}catch{}},HN=async({subprocessStdout:Z,onStdoutDataDone:J,readable:Y,subprocess:$,subprocessStdin:W})=>{try{if(await GN(Z),await $,await XN(W),await J,Y.readable)Y.push(null)}catch(Q){await XN(W),Tm(Y,Q)}},qN=async({subprocessStdout:Z,subprocess:J,waitReadableDestroy:Y},$)=>{if(await EW(Y,J))Tm(Z,$),await qq(J,$)},Tm=(Z,J)=>{Uq(Z,Z.readable,J)};import{Writable as bX1}from"stream";import{callbackify as km}from"util";var Em=({subprocess:Z,concurrentStreams:J},{to:Y}={})=>{let{subprocessStdin:$,waitWritableFinal:W,waitWritableDestroy:Q}=UN(Z,Y,J),X=new bX1({...wN($,Z,W),destroy:km(BN.bind(void 0,{subprocessStdin:$,subprocess:Z,waitWritableFinal:W,waitWritableDestroy:Q})),highWaterMark:$.writableHighWaterMark,objectMode:$.writableObjectMode});return LN($,X),X},UN=(Z,J,Y)=>{let $=vH(Z,J),W=aK(Y,$,"writableFinal"),Q=aK(Y,$,"writableDestroy");return{subprocessStdin:$,waitWritableFinal:W,waitWritableDestroy:Q}},wN=(Z,J,Y)=>({write:gX1.bind(void 0,Z),final:km(mX1.bind(void 0,Z,J,Y))}),gX1=(Z,J,Y,$)=>{if(Z.write(J,Y))$();else Z.once("drain",$)},mX1=async(Z,J,Y)=>{if(await EW(Y,J)){if(Z.writable)Z.end();await J}},LN=async(Z,J,Y)=>{try{if(await KN(Z),J.writable)J.end()}catch($){await Dm(Y),Im(J,$)}},BN=async({subprocessStdin:Z,subprocess:J,waitWritableFinal:Y,waitWritableDestroy:$},W)=>{if(await EW(Y,J),await EW($,J))Im(Z,W),await qq(J,W)},Im=(Z,J)=>{Uq(Z,Z.writable,J)};import{Duplex as dX1}from"stream";import{callbackify as uX1}from"util";var vm=({subprocess:Z,concurrentStreams:J,encoding:Y},{from:$,to:W,binary:Q=!0,preserveNewlines:X=!0}={})=>{let K=Q||w5.has(Y),{subprocessStdout:G,waitReadableDestroy:z}=zN(Z,$,J),{subprocessStdin:F,waitWritableFinal:V,waitWritableDestroy:H}=UN(Z,W,J),{readableEncoding:q,readableObjectMode:U,readableHighWaterMark:L}=FN(G,K),{read:w,onStdoutDataDone:O}=VN({subprocessStdout:G,subprocess:Z,binary:K,encoding:Y,preserveNewlines:X}),R=new dX1({read:w,...wN(F,Z,V),destroy:uX1(cX1.bind(void 0,{subprocessStdout:G,subprocessStdin:F,subprocess:Z,waitReadableDestroy:z,waitWritableFinal:V,waitWritableDestroy:H})),readableHighWaterMark:L,writableHighWaterMark:F.writableHighWaterMark,readableObjectMode:U,writableObjectMode:F.writableObjectMode,encoding:q});return HN({subprocessStdout:G,onStdoutDataDone:O,readable:R,subprocess:Z,subprocessStdin:F}),LN(F,R,G),R},cX1=async({subprocessStdout:Z,subprocessStdin:J,subprocess:Y,waitReadableDestroy:$,waitWritableFinal:W,waitWritableDestroy:Q},X)=>{await Promise.all([qN({subprocessStdout:Z,subprocess:Y,waitReadableDestroy:$},X),BN({subprocessStdin:J,subprocess:Y,waitWritableFinal:W,waitWritableDestroy:Q},X)])};var ON=(Z,J,{from:Y,binary:$=!1,preserveNewlines:W=!1}={})=>{let Q=$||w5.has(J),X=NW(Z,Y),K=Vq({subprocessStdout:X,subprocess:Z,binary:Q,shouldEncode:!0,encoding:J,preserveNewlines:W});return lX1(K,X,Z)},lX1=async function*(Z,J,Y){try{yield*Z}finally{if(J.readable)J.destroy();await Y}};var Sm=(Z,{encoding:J})=>{let Y=Pm();Z.readable=Cm.bind(void 0,{subprocess:Z,concurrentStreams:Y,encoding:J}),Z.writable=Em.bind(void 0,{subprocess:Z,concurrentStreams:Y}),Z.duplex=vm.bind(void 0,{subprocess:Z,concurrentStreams:Y,encoding:J}),Z.iterable=ON.bind(void 0,Z,J),Z[Symbol.asyncIterator]=ON.bind(void 0,Z,J,{})};var _m=(Z,J)=>{for(let[Y,$]of iX1){let W=$.value.bind(J);Reflect.defineProperty(Z,Y,{...$,value:W})}},pX1=(async()=>{})().constructor.prototype,iX1=["then","catch","finally"].map((Z)=>[Z,Reflect.getOwnPropertyDescriptor(pX1,Z)]);var xm=(Z,J,Y,$)=>{let{file:W,commandArguments:Q,command:X,escapedCommand:K,startTime:G,verboseInfo:z,options:F,fileDescriptors:V}=sX1(Z,J,Y),{subprocess:H,promise:q}=rX1({file:W,commandArguments:Q,options:F,startTime:G,verboseInfo:z,command:X,escapedCommand:K,fileDescriptors:V});return H.pipe=Fq.bind(void 0,{source:H,sourcePromise:q,boundOptions:{},createNested:$}),_m(H,q),K4.set(H,{options:F,fileDescriptors:V}),H},sX1=(Z,J,Y)=>{let{command:$,escapedCommand:W,startTime:Q,verboseInfo:X}=OH(Z,J,Y),{file:K,commandArguments:G,options:z}=dH(Z,J,Y),F=oX1(z),V=mg(F,X);return{file:K,commandArguments:G,command:$,escapedCommand:W,startTime:Q,verboseInfo:X,options:F,fileDescriptors:V}},oX1=({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}},rX1=({file:Z,commandArguments:J,options:Y,startTime:$,verboseInfo:W,command:Q,escapedCommand:X,fileDescriptors:K})=>{let G;try{G=aX1(Z,J,Y)}catch(U){return fg({error:U,command:Q,escapedCommand:X,fileDescriptors:K,options:Y,startTime:$,verboseInfo:W})}let z=new AbortController;nX1(Number.POSITIVE_INFINITY,z.signal);let F=[...G.stdio];og(G,K,z),Jm(G,Y,z);let V={},H=X4();G.kill=Fy.bind(void 0,{kill:G.kill.bind(G),options:Y,onInternalError:H,context:V,controller:z}),G.all=wm(G,Y),Sm(G,Y),xg(G,Y);let q=tX1({subprocess:G,options:Y,startTime:$,verboseInfo:W,fileDescriptors:K,originalStreams:F,command:Q,escapedCommand:X,context:V,onInternalError:H,controller:z});return{subprocess:G,promise:q}},tX1=async({subprocess:Z,options:J,startTime:Y,verboseInfo:$,fileDescriptors:W,originalStreams:Q,command:X,escapedCommand:K,context:G,onInternalError:z,controller:F})=>{let[V,[H,q],U,L,w]=await Nm({subprocess:Z,options:J,context:G,verboseInfo:$,fileDescriptors:W,originalStreams:Q,onInternalError:z,controller:F});F.abort(),z.resolve();let O=U.map((P,D)=>F7(P,J,D)),R=F7(L,J,"all"),N=eX1({errorInfo:V,exitCode:H,signal:q,stdio:O,all:R,ipcOutput:w,context:G,options:J,command:X,escapedCommand:K,startTime:Y});return CW(N,$,J)},eX1=({errorInfo:Z,exitCode:J,signal:Y,stdio:$,all:W,ipcOutput:Q,context:X,options:K,command:G,escapedCommand:z,startTime:F})=>("error"in Z)?uK({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 G7,isForcefullyTerminated:X.isForcefullyTerminated,exitCode:J,signal:Y,stdio:$,all:W,ipcOutput:Q,options:K,startTime:F,isSync:!1}):oH({command:G,escapedCommand:z,stdio:$,all:W,ipcOutput:Q,options:K,startTime:F});var wq=(Z,J)=>{let Y=Object.fromEntries(Object.entries(J).map(([$,W])=>[$,ZK1($,Z[$],W)]));return{...Z,...Y}},ZK1=(Z,J,Y)=>{if(JK1.has(Z)&&K8(J)&&K8(Y))return{...J,...Y};return Y},JK1=new Set(["env",...rM]);var GZ=(Z,J,Y,$)=>{let W=(X,K,G)=>GZ(X,K,Y,G),Q=(...X)=>YK1({mapArguments:Z,deepOptions:Y,boundOptions:J,setBoundExeca:$,createNested:W},...X);if($!==void 0)$(Q,W,J);return Q},YK1=({mapArguments:Z,deepOptions:J={},boundOptions:Y={},setBoundExeca:$,createNested:W},Q,...X)=>{if(K8(Q))return W(Z,wq(Y,Q),$);let{file:K,commandArguments:G,options:z,isSync:F}=$K1({mapArguments:Z,firstArgument:Q,nextArguments:X,deepOptions:J,boundOptions:Y});return F?kg(K,G,z):xm(K,G,z,W)},$K1=({mapArguments:Z,firstArgument:J,nextArguments:Y,deepOptions:$,boundOptions:W})=>{let Q=gh(J)?mh(J,Y):[J,...Y],[X,K,G]=KH(...Q),z=wq(wq($,W),G),{file:F=X,commandArguments:V=K,options:H=z,isSync:q=!1}=Z({file:X,commandArguments:K,options:z});return{file:F,commandArguments:V,options:H,isSync:q}};var Am=({file:Z,commandArguments:J})=>fm(Z,J),hm=({file:Z,commandArguments:J})=>({...fm(Z,J),isSync:!0}),fm=(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,...$]=WK1(Z);return{file:Y,commandArguments:$}},WK1=(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(QK1)){let W=Y.at(-1);if(W&&W.endsWith("\\"))Y[Y.length-1]=`${W.slice(0,-1)} ${$}`;else Y.push($)}return Y},QK1=/ +/g;var ym=(Z,J,Y)=>{Z.sync=J(XK1,Y),Z.s=Z.sync},bm=({options:Z})=>gm(Z),XK1=({options:Z})=>({...gm(Z),isSync:!0}),gm=(Z)=>({options:{...KK1(Z),...Z}}),KK1=({input:Z,inputFile:J,stdio:Y})=>Z===void 0&&J===void 0&&Y===void 0?{stdin:"inherit"}:{},mm={preferLocal:!0};var dm=GZ(()=>({})),CW6=GZ(()=>({isSync:!0})),TW6=GZ(Am),kW6=GZ(hm),EW6=GZ(ny),IW6=GZ(bm,{},mm,ym),{sendMessage:vW6,getOneMessage:SW6,getEachMessage:_W6,getCancelSignal:xW6}=Ag();var{Glob:CU1}=globalThis.Bun;class MN{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 W=$.indexOf(J);if(W!==-1)$.splice(W,1)}return this}dispatchEvent(Z){let Y=this._listeners[Z.type];if(Y!==void 0){let $=Y.slice(0);for(let W=0,Q=$.length;W<Q;W++)$[W].call(this,Z)}return this}dispose(){for(let Z in this._listeners)delete this._listeners[Z]}}class i6{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 IW extends MN{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 W=new i6(Z,J,Y,$);this._edges.add(W);let Q=W.getParent();if(!this._parentEdges.has(Q))this._parentEdges.set(Q,new Set);this._parentEdges.get(Q).add(W);let X=W.getChild();if(!this._childEdges.has(X))this._childEdges.set(X,new Set);return this._childEdges.get(X).add(W),W}_destroyEdge(Z){return this._edges.delete(Z),this._parentEdges.get(Z.getParent()).delete(Z),this._childEdges.get(Z.getChild()).delete(Z),this}}function sK(){return sK=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},sK.apply(this,arguments)}class J6{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 w0{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 d1{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 C0=Symbol("attributes"),E9=Symbol("immutableKeys");class vW extends MN{constructor(Z){super();this._disposed=!1,this.graph=void 0,this[C0]=void 0,this[E9]=void 0,this.graph=Z,this[E9]=new Set,this[C0]=this._createAttributes()}getDefaults(){return{}}_createAttributes(){let Z=this.getDefaults(),J={};for(let Y in Z){let $=Z[Y];if($ instanceof vW){let W=this.graph._createEdge(Y,this,$);this[E9].add(Y),J[Y]=W}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[C0]){let $=this[C0][Y];if($ instanceof i6){let W=$;if(W.getChild()===Z)this.setRef(Y,J,W.getAttributes())}else if($ instanceof J6)for(let W of $.listRefsByChild(Z)){let Q=W.getAttributes();this.removeRef(Y,Z),this.addRef(Y,J,Q)}else if($ instanceof w0){let W=$.getRefByChild(Z);if(W){let Q=W.getAttributes();this.removeRef(Y,Z),this.addRef(Y,J,Q)}}else if($ instanceof d1)for(let W of $.keys()){let Q=$.get(W);if(Q.getChild()===Z)this.setRefMap(Y,W,J,Q.getAttributes())}}return this}get(Z){return this[C0][Z]}set(Z,J){return this[C0][Z]=J,this.dispatchEvent({type:"change",attribute:Z})}getRef(Z){let J=this[C0][Z];return J?J.getChild():null}setRef(Z,J,Y){if(this[E9].has(Z))throw new Error(`Cannot overwrite immutable attribute, "${Z}".`);let $=this[C0][Z];if($)$.dispose();if(!J)return this;let W=this.graph._createEdge(Z,this,J,Y);return this[C0][Z]=W,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 J6)for(let $ of Y.listRefsByChild(J))$.dispose();else{let $=Y.getRefByChild(J);if($)$.dispose()}return this}assertRefList(Z){let J=this[C0][Z];if(J instanceof J6||J instanceof w0)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 W=this.assertRefMap(Z),Q=W.get(J);if(Q)Q.dispose();if(!Y)return this;$=Object.assign($||{},{key:J});let X=this.graph._createEdge(Z,this,Y,sK({},$,{key:J}));return W.set(J,X),this.dispatchEvent({type:"change",attribute:Z,key:J})}assertRefMap(Z){let J=this[C0][Z];if(J instanceof d1)return J;throw new Error(`Expected RefMap for attribute "${Z}"`)}dispatchEvent(Z){return super.dispatchEvent(sK({},Z,{target:this})),this.graph.dispatchEvent(sK({},Z,{target:this,type:`node:${Z.type}`})),this}_destroyRef(Z){let J=Z.getName();if(this[C0][J]===Z){if(this[C0][J]=null,this[E9].has(J))Z.getChild().dispose()}else if(this[C0][J]instanceof J6)this[C0][J].remove(Z);else if(this[C0][J]instanceof w0)this[C0][J].remove(Z);else if(this[C0][J]instanceof d1){let Y=this[C0][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 am="v4.1.1",Nq="@glb.bin",c;(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"})(c||(c={}));var Pq;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(Pq||(Pq={}));var L5;(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"})(L5||(L5={}));var jq;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(jq||(jq={}));var V7;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(V7||(V7={}));var VZ={"5120":Int8Array,"5121":Uint8Array,"5122":Int16Array,"5123":Uint16Array,"5125":Uint32Array,"5126":Float32Array},NN=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 GK1(){var Z=new NN(3);if(NN!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function RN(Z){var J=Z[0],Y=Z[1],$=Z[2];return Math.hypot(J,Y,$)}function zK1(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=Y[3]*$+Y[7]*W+Y[11]*Q+Y[15];return X=X||1,Z[0]=(Y[0]*$+Y[4]*W+Y[8]*Q+Y[12])/X,Z[1]=(Y[1]*$+Y[5]*W+Y[9]*Q+Y[13])/X,Z[2]=(Y[2]*$+Y[6]*W+Y[10]*Q+Y[14])/X,Z}(function(){var Z=GK1();return function(J,Y,$,W,Q,X){var K,G;if(!Y)Y=3;if(!$)$=0;if(W)G=Math.min(W*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],Q(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}})();function CN(Z){let J=sm(),Y=Z.propertyType===c.NODE?[Z]:Z.listChildren();for(let $ of Y)$.traverse((W)=>{let Q=W.getMesh();if(!Q)return;let X=FK1(Q,W.getWorldMatrix());if(X.min.every(isFinite)&&X.max.every(isFinite))PN(X.min,J),PN(X.max,J)});return J}function FK1(Z,J){let Y=sm();for(let $ of Z.listPrimitives()){let W=$.getAttribute("POSITION"),Q=$.getIndices();if(!W)continue;let X=[0,0,0],K=[0,0,0];for(let G=0,z=Q?Q.getCount():W.getCount();G<z;G++){let F=Q?Q.getScalar(G):G;X=W.getElement(F,X),K=zK1(K,X,J),PN(K,Y)}}return Y}function PN(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 sm(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class m0{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 W of Z)J+=W.byteLength;let Y=new Uint8Array(J),$=0;for(let W of Z)Y.set(W,$),$+=W.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 W=Z.byteLength;W<Y;W++)$[W]=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 TN{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,$,W]=this.convertLinearToSRGB(Z,J);return Y*255<<16^$*255<<8^W*255<<0}static convertSRGBToLinear(Z,J){let Y=Z,$=J;for(let W=0;W<3;W++)$[W]=Y[W]<0.04045?Y[W]*0.0773993808:Math.pow(Y[W]*0.9478672986+0.0521327014,2.4);return J}static convertLinearToSRGB(Z,J){let Y=Z,$=J;for(let W=0;W<3;W++)$[W]=Y[W]<0.0031308?Y[W]*12.92:1.055*Math.pow(Y[W],0.41666)-0.055;return J}}class om{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),VK1(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 Tq{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(m0.decodeText(Z.slice(12,16))===Tq.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}}Tq.PNG_FRIED_CHUNK_NAME="CgBI";class H7{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,W=this.getSize(Z,J);if(!W)return null;while(W[0]>1||W[1]>1)Y+=W[0]*W[1]*$,W[0]=Math.max(Math.floor(W[0]/2),1),W[1]=Math.max(Math.floor(W[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}`}}H7.impls={"image/jpeg":new om,"image/png":new Tq};function VK1(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 q7{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 H7.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 um(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function tJ(Z){if(um(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let Y=J.prototype;if(um(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}var jN,oK;(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"})(oK||(oK={}));class a6{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=a6.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=a6.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=a6.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=a6.Verbosity.ERROR)console.error(Z)}}jN=a6;a6.Verbosity=oK;a6.DEFAULT_INSTANCE=new jN(jN.Verbosity.INFO);function HK1(Z){var J=Z[0],Y=Z[1],$=Z[2],W=Z[3],Q=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],F=Z[9],V=Z[10],H=Z[11],q=Z[12],U=Z[13],L=Z[14],w=Z[15],O=J*X-Y*Q,R=J*K-$*Q,N=J*G-W*Q,P=Y*K-$*X,D=Y*G-W*X,j=$*G-W*K,C=z*U-F*q,k=z*L-V*q,I=z*w-H*q,A=F*L-V*U,v=F*w-H*U,x=V*w-H*L;return O*x-R*v+N*A+P*I-D*k+j*C}function qK1(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],V=J[8],H=J[9],q=J[10],U=J[11],L=J[12],w=J[13],O=J[14],R=J[15],N=Y[0],P=Y[1],D=Y[2],j=Y[3];return Z[0]=N*$+P*K+D*V+j*L,Z[1]=N*W+P*G+D*H+j*w,Z[2]=N*Q+P*z+D*q+j*O,Z[3]=N*X+P*F+D*U+j*R,N=Y[4],P=Y[5],D=Y[6],j=Y[7],Z[4]=N*$+P*K+D*V+j*L,Z[5]=N*W+P*G+D*H+j*w,Z[6]=N*Q+P*z+D*q+j*O,Z[7]=N*X+P*F+D*U+j*R,N=Y[8],P=Y[9],D=Y[10],j=Y[11],Z[8]=N*$+P*K+D*V+j*L,Z[9]=N*W+P*G+D*H+j*w,Z[10]=N*Q+P*z+D*q+j*O,Z[11]=N*X+P*F+D*U+j*R,N=Y[12],P=Y[13],D=Y[14],j=Y[15],Z[12]=N*$+P*K+D*V+j*L,Z[13]=N*W+P*G+D*H+j*w,Z[14]=N*Q+P*z+D*q+j*O,Z[15]=N*X+P*F+D*U+j*R,Z}function UK1(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[4],X=J[5],K=J[6],G=J[8],z=J[9],F=J[10];return Z[0]=Math.hypot(Y,$,W),Z[1]=Math.hypot(Q,X,K),Z[2]=Math.hypot(G,z,F),Z}function wK1(Z,J){var Y=new NN(3);UK1(Y,J);var $=1/Y[0],W=1/Y[1],Q=1/Y[2],X=J[0]*$,K=J[1]*W,G=J[2]*Q,z=J[4]*$,F=J[5]*W,V=J[6]*Q,H=J[8]*$,q=J[9]*W,U=J[10]*Q,L=X+F+U,w=0;if(L>0)w=Math.sqrt(L+1)*2,Z[3]=0.25*w,Z[0]=(V-q)/w,Z[1]=(H-G)/w,Z[2]=(K-z)/w;else if(X>F&&X>U)w=Math.sqrt(1+X-F-U)*2,Z[3]=(V-q)/w,Z[0]=0.25*w,Z[1]=(K+z)/w,Z[2]=(H+G)/w;else if(F>U)w=Math.sqrt(1+F-X-U)*2,Z[3]=(H-G)/w,Z[0]=(K+z)/w,Z[1]=0.25*w,Z[2]=(V+q)/w;else w=Math.sqrt(1+U-X-F)*2,Z[3]=(K-z)/w,Z[0]=(H+G)/w,Z[1]=(V+q)/w,Z[2]=0.25*w;return Z}class A0{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(A0.clamp(Z,0,1)*65535);case 5121:return Math.round(A0.clamp(Z,0,1)*255);case 5122:return Math.round(A0.clamp(Z,-1,1)*32767);case 5120:return Math.round(A0.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,Y,$){let W=RN([Z[0],Z[1],Z[2]]),Q=RN([Z[4],Z[5],Z[6]]),X=RN([Z[8],Z[9],Z[10]]);if(HK1(Z)<0)W=-W;J[0]=Z[12],J[1]=Z[13],J[2]=Z[14];let G=Z.slice(),z=1/W,F=1/Q,V=1/X;G[0]*=z,G[1]*=z,G[2]*=z,G[4]*=F,G[5]*=F,G[6]*=F,G[8]*=V,G[9]*=V,G[10]*=V,wK1(Y,G),$[0]=W,$[1]=Q,$[2]=X}static compose(Z,J,Y,$){let W=$,Q=J[0],X=J[1],K=J[2],G=J[3],z=Q+Q,F=X+X,V=K+K,H=Q*z,q=Q*F,U=Q*V,L=X*F,w=X*V,O=K*V,R=G*z,N=G*F,P=G*V,D=Y[0],j=Y[1],C=Y[2];return W[0]=(1-(L+O))*D,W[1]=(q+P)*D,W[2]=(U-N)*D,W[3]=0,W[4]=(q-P)*j,W[5]=(1-(H+O))*j,W[6]=(w+R)*j,W[7]=0,W[8]=(U+N)*C,W[9]=(w-R)*C,W[10]=(1-(H+L))*C,W[11]=0,W[12]=Z[0],W[13]=Z[1],W[14]=Z[2],W[15]=1,W}}function LK1(Z,J){if(!!Z!==!!J)return!1;let Y=Z.getChild(),$=J.getChild();return Y===$||Y.equals($)}function BK1(Z,J){if(!!Z!==!!J)return!1;let Y=Z.values(),$=J.values();if(Y.length!==$.length)return!1;for(let W=0;W<Y.length;W++){let Q=Y[W],X=$[W];if(Q.getChild()===X.getChild())continue;if(!Q.getChild().equals(X.getChild()))return!1}return!0}function OK1(Z,J){if(!!Z!==!!J)return!1;let Y=Z.keys(),$=J.keys();if(Y.length!==$.length)return!1;for(let W of Y){let Q=Z.get(W),X=J.get(W);if(!!Q!==!!X)return!1;let K=Q.getChild(),G=X.getChild();if(K===G)continue;if(!K.equals(G))return!1}return!0}function rm(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 tm(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!tJ(Z)||!tJ(J))return Z===J;let Y=Z,$=J,W=0,Q=0,X;for(X in Y)W++;for(X in $)Q++;if(W!==Q)return!1;for(X in Y){let K=Y[X],G=$[X];if(Dq(K)&&Dq(G)){if(!rm(K,G))return!1}else if(tJ(K)&&tJ(G)){if(!tm(K,G))return!1}else if(K!==G)return!1}return!0}function Dq(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var cm="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ",MK1=999,RK1=6,lm=new Set,NK1=function Z(){let J="";for(let Y=0;Y<RK1;Y++)J+=cm.charAt(Math.floor(Math.random()*cm.length));return J},em=function Z(){for(let J=0;J<MK1;J++){let Y=NK1();if(!lm.has(Y))return lm.add(Y),Y}return""},pm="https://null.example";class f5{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return q7.basename(new URL(Z,pm).pathname)}static extension(Z){return q7.extension(new URL(Z,pm).pathname)}static resolve(Z,J){if(!this.isRelativePath(J))return J;let Y=Z.split("/"),$=J.split("/");Y.pop();for(let W=0;W<$.length;W++){if($[W]===".")continue;if($[W]==="..")Y.pop();else Y.push($[W])}return Y.join("/")}static isAbsoluteURL(Z){return this.PROTOCOL_REGEXP.test(Z)}static isRelativePath(Z){return!/^(?:[a-zA-Z]+:)?\//.test(Z)}}f5.DEFAULT_INIT={};f5.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var FZ=(Z)=>Z,PK1=new Set;class kq extends vW{constructor(Z,J=""){super(Z);this[C0].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,FZ)}copy(Z,J=FZ){for(let Y in this[C0]){let $=this[C0][Y];if($ instanceof i6){if(!this[E9].has(Y))$.dispose()}else if($ instanceof J6||$ instanceof w0)for(let W of $.values())W.dispose();else if($ instanceof d1)for(let W of $.values())W.dispose()}for(let Y in Z[C0]){let $=this[C0][Y],W=Z[C0][Y];if(W instanceof i6)if(this[E9].has(Y))$.getChild().copy(J(W.getChild()),J);else this.setRef(Y,J(W.getChild()),W.getAttributes());else if(W instanceof w0||W instanceof J6)for(let Q of W.values())this.addRef(Y,J(Q.getChild()),Q.getAttributes());else if(W instanceof d1)for(let Q of W.keys()){let X=W.get(Q);this.setRefMap(Y,Q,J(X.getChild()),X.getAttributes())}else if(tJ(W))this[C0][Y]=JSON.parse(JSON.stringify(W));else if(Array.isArray(W)||W instanceof ArrayBuffer||ArrayBuffer.isView(W))this[C0][Y]=W.slice();else this[C0][Y]=W}return this}equals(Z,J=PK1){if(this===Z)return!0;if(this.propertyType!==Z.propertyType)return!1;for(let Y in this[C0]){if(J.has(Y))continue;let $=this[C0][Y],W=Z[C0][Y];if($ instanceof i6||W instanceof i6){if(!LK1($,W))return!1}else if($ instanceof w0||W instanceof w0||$ instanceof J6||W instanceof J6){if(!BK1($,W))return!1}else if($ instanceof d1||W instanceof d1){if(!OK1($,W))return!1}else if(tJ($)||tJ(W)){if(!tm($,W))return!1}else if(Dq($)||Dq(W)){if(!rm($,W))return!1}else if($!==W)return!1}return!0}detach(){return this.graph.disconnectParents(this,(Z)=>Z.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}}class $6 extends kq{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new d1})}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 $6{init(){this.propertyType=c.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 W=0;W<Y;W++)Z[W]=A0.decodeNormalizedInt(Z[W],$);return Z}getMin(Z){let J=this.getArray(),Y=this.getCount(),$=this.getElementSize();for(let W=0;W<$;W++)Z[W]=1/0;for(let W=0;W<Y*$;W+=$)for(let Q=0;Q<$;Q++){let X=J[W+Q];if(Number.isFinite(X))Z[Q]=Math.min(Z[Q],X)}return Z}getMaxNormalized(Z){let J=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType();if(this.getMax(Z),J)for(let W=0;W<Y;W++)Z[W]=A0.decodeNormalizedInt(Z[W],$);return Z}getMax(Z){let J=this.get("array"),Y=this.getCount(),$=this.getElementSize();for(let W=0;W<$;W++)Z[W]=-1/0;for(let W=0;W<Y*$;W+=$)for(let Q=0;Q<$;Q++){let X=J[W+Q];if(Number.isFinite(X))Z[Q]=Math.max(Z[Q],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 A0.decodeNormalizedInt($[Z*J],Y);return $[Z*J]}setScalar(Z,J){let Y=this.getElementSize(),$=this.getComponentType(),W=this.getArray();if(this.getNormalized())W[Z*Y]=A0.encodeNormalizedInt(J,$);else W[Z*Y]=J;return this}getElement(Z,J){let Y=this.getNormalized(),$=this.getElementSize(),W=this.getComponentType(),Q=this.getArray();for(let X=0;X<$;X++)if(Y)J[X]=A0.decodeNormalizedInt(Q[Z*$+X],W);else J[X]=Q[Z*$+X];return J}setElement(Z,J){let Y=this.getNormalized(),$=this.getElementSize(),W=this.getComponentType(),Q=this.getArray();for(let X=0;X<$;X++)if(Y)Q[Z*$+X]=A0.encodeNormalizedInt(J[X],W);else Q[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?jK1(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 jK1(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 kN extends $6{init(){this.propertyType=c.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new w0,samplers:new w0})}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 eJ extends $6{init(){this.propertyType=c.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)}}eJ.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class SW extends $6{init(){this.propertyType=c.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:SW.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:L5.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:L5.OTHER})}}SW.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class EN extends $6{init(){this.propertyType=c.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(Z){return this.set("uri",Z)}}class ZY extends $6{init(){this.propertyType=c.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:ZY.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)}}ZY.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class _W extends kq{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}_W.EXTENSION_NAME=void 0;class n6 extends $6{init(){this.propertyType=c.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:n6.WrapMode.REPEAT,wrapT:n6.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)}}n6.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};n6.MagFilter={NEAREST:9728,LINEAR:9729};n6.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:Lq,G:Bq,B:Oq,A:DK1}=jq;class z4 extends $6{init(){this.propertyType=c.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:z4.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new n6(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new n6(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new n6(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new n6(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new n6(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:Lq|Bq|Oq|DK1,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:Lq|Bq|Oq,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:Lq|Bq|Oq})}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:Lq})}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:Bq|Oq})}}z4.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class tK extends $6{init(){this.propertyType=c.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new w0})}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 Eq extends $6{init(){this.propertyType=c.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 w0})}copy(Z,J=FZ){if(J===FZ)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 A0.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 A0.decompose(Z,J,Y,$),this.set("translation",J).set("rotation",Y).set("scale",$)}getWorldTranslation(){let Z=[0,0,0];return A0.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return A0.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return A0.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())qK1(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===c.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===c.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 G8 extends $6{init(){this.propertyType=c.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:G8.Mode.TRIANGLES,material:null,indices:null,attributes:new d1,targets:new w0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:L5.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:L5.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)}}G8.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class IN extends kq{init(){this.propertyType=c.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new d1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:L5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function M6(){return M6=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},M6.apply(null,arguments)}class xW extends $6{init(){this.propertyType=c.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new w0})}copy(Z,J=FZ){if(J===FZ)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 vN extends $6{init(){this.propertyType=c.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new w0})}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:L5.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class JY extends $6{init(){this.propertyType=c.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||H7.extensionToMimeType(q7.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=H7.extensionToMimeType(q7.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",m0.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return H7.getSize(Z,this.getMimeType())}}class YY extends $6{init(){this.propertyType=c.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${am}`,version:"2.0"},defaultScene:null,accessors:new w0,animations:new w0,buffers:new w0,cameras:new w0,materials:new w0,meshes:new w0,nodes:new w0,scenes:new w0,skins:new w0,textures:new w0})}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=FZ){if(J===FZ)throw new Error("Root cannot be copied.");this.set("asset",M6({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(M6({},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 xW)this.addRef("scenes",Z);else if(Z instanceof Eq)this.addRef("nodes",Z);else if(Z instanceof ZY)this.addRef("cameras",Z);else if(Z instanceof vN)this.addRef("skins",Z);else if(Z instanceof tK)this.addRef("meshes",Z);else if(Z instanceof z4)this.addRef("materials",Z);else if(Z instanceof JY)this.addRef("textures",Z);else if(Z instanceof kN)this.addRef("animations",Z);else if(Z instanceof N0)this.addRef("accessors",Z);else if(Z instanceof EN)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 Y6{static fromGraph(Z){return Y6._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new IW,this._root=new YY(this._graph),this._logger=a6.DEFAULT_INSTANCE,Y6._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 xW(this._graph,Z)}createNode(Z=""){return new Eq(this._graph,Z)}createCamera(Z=""){return new ZY(this._graph,Z)}createSkin(Z=""){return new vN(this._graph,Z)}createMesh(Z=""){return new tK(this._graph,Z)}createPrimitive(){return new G8(this._graph)}createPrimitiveTarget(Z=""){return new IN(this._graph,Z)}createMaterial(Z=""){return new z4(this._graph,Z)}createTexture(Z=""){return new JY(this._graph,Z)}createAnimation(Z=""){return new kN(this._graph,Z)}createAnimationChannel(Z=""){return new eJ(this._graph,Z)}createAnimationSampler(Z=""){return new SW(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 EN(this._graph,Z)}}Y6._GRAPH_DOCUMENTS=new WeakMap;class Zd{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,W=$.target;if(W instanceof _W&&W.extensionName===this.extensionName){if($.type==="node:create")this._addExtensionProperty(W);if($.type==="node:dispose")this._removeExtensionProperty(W)}};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}}Zd.EXTENSION_NAME=void 0;class Jd{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 im={logger:a6.DEFAULT_INSTANCE,extensions:[],dependencies:{}},CK1=new Set([c.BUFFER,c.TEXTURE,c.MATERIAL,c.MESH,c.PRIMITIVE,c.NODE,c.SCENE]);class Yd{static read(Z,J=im){let Y=M6({},im,J),{json:$}=Z,W=new Y6().setLogger(Y.logger);this.validate(Z,Y);let Q=new Jd(Z),X=$.asset,K=W.getRoot().getAsset();if(X.copyright)K.copyright=X.copyright;if(X.extras)K.extras=X.extras;if($.extras!==void 0)W.getRoot().setExtras(M6({},$.extras));let G=$.extensionsUsed||[],z=$.extensionsRequired||[];Y.extensions.sort((j,C)=>j.EXTENSION_NAME>C.EXTENSION_NAME?1:-1);for(let j of Y.extensions)if(G.includes(j.EXTENSION_NAME)){let C=W.createExtension(j).setRequired(z.includes(j.EXTENSION_NAME)),k=C.prereadTypes.filter((I)=>!CK1.has(I));if(k.length)Y.logger.warn(`Preread hooks for some types (${k.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||[];W.getRoot().listExtensionsUsed().filter((j)=>j.prereadTypes.includes(c.BUFFER)).forEach((j)=>j.preread(Q,c.BUFFER)),Q.buffers=F.map((j)=>{let C=W.createBuffer(j.name);if(j.extras)C.setExtras(j.extras);if(j.uri&&j.uri.indexOf("__")!==0)C.setURI(j.uri);return C});let V=$.bufferViews||[];Q.bufferViewBuffers=V.map((j,C)=>{if(!Q.bufferViews[C]){let k=Z.json.buffers[j.buffer],I=k.uri?Z.resources[k.uri]:Z.resources[Nq],A=j.byteOffset||0;Q.bufferViews[C]=m0.toView(I,A,j.byteLength)}return Q.buffers[j.buffer]});let H=$.accessors||[];Q.accessors=H.map((j)=>{let C=Q.bufferViewBuffers[j.bufferView],k=W.createAccessor(j.name,C).setType(j.type);if(j.extras)k.setExtras(j.extras);if(j.normalized!==void 0)k.setNormalized(j.normalized);if(j.bufferView===void 0)return k;return k.setArray(Rq(j,Q)),k});let q=$.images||[],U=$.textures||[];W.getRoot().listExtensionsUsed().filter((j)=>j.prereadTypes.includes(c.TEXTURE)).forEach((j)=>j.preread(Q,c.TEXTURE)),Q.textures=q.map((j)=>{let C=W.createTexture(j.name);if(j.extras)C.setExtras(j.extras);if(j.bufferView!==void 0){let k=$.bufferViews[j.bufferView],I=Z.json.buffers[k.buffer],A=I.uri?Z.resources[I.uri]:Z.resources[Nq],v=k.byteOffset||0,x=k.byteLength,d=A.slice(v,v+x);C.setImage(d)}else if(j.uri!==void 0){if(C.setImage(Z.resources[j.uri]),j.uri.indexOf("__")!==0)C.setURI(j.uri)}if(j.mimeType!==void 0)C.setMimeType(j.mimeType);else if(j.uri){let k=q7.extension(j.uri);C.setMimeType(H7.extensionToMimeType(k))}return C}),W.getRoot().listExtensionsUsed().filter((j)=>j.prereadTypes.includes(c.MATERIAL)).forEach((j)=>j.preread(Q,c.MATERIAL));let L=$.materials||[];Q.materials=L.map((j)=>{let C=W.createMaterial(j.name);if(j.extras)C.setExtras(j.extras);if(j.alphaMode!==void 0)C.setAlphaMode(j.alphaMode);if(j.alphaCutoff!==void 0)C.setAlphaCutoff(j.alphaCutoff);if(j.doubleSided!==void 0)C.setDoubleSided(j.doubleSided);let k=j.pbrMetallicRoughness||{};if(k.baseColorFactor!==void 0)C.setBaseColorFactor(k.baseColorFactor);if(j.emissiveFactor!==void 0)C.setEmissiveFactor(j.emissiveFactor);if(k.metallicFactor!==void 0)C.setMetallicFactor(k.metallicFactor);if(k.roughnessFactor!==void 0)C.setRoughnessFactor(k.roughnessFactor);if(k.baseColorTexture!==void 0){let I=k.baseColorTexture,A=Q.textures[U[I.index].source];C.setBaseColorTexture(A),Q.setTextureInfo(C.getBaseColorTextureInfo(),I)}if(j.emissiveTexture!==void 0){let I=j.emissiveTexture,A=Q.textures[U[I.index].source];C.setEmissiveTexture(A),Q.setTextureInfo(C.getEmissiveTextureInfo(),I)}if(j.normalTexture!==void 0){let I=j.normalTexture,A=Q.textures[U[I.index].source];if(C.setNormalTexture(A),Q.setTextureInfo(C.getNormalTextureInfo(),I),j.normalTexture.scale!==void 0)C.setNormalScale(j.normalTexture.scale)}if(j.occlusionTexture!==void 0){let I=j.occlusionTexture,A=Q.textures[U[I.index].source];if(C.setOcclusionTexture(A),Q.setTextureInfo(C.getOcclusionTextureInfo(),I),j.occlusionTexture.strength!==void 0)C.setOcclusionStrength(j.occlusionTexture.strength)}if(k.metallicRoughnessTexture!==void 0){let I=k.metallicRoughnessTexture,A=Q.textures[U[I.index].source];C.setMetallicRoughnessTexture(A),Q.setTextureInfo(C.getMetallicRoughnessTextureInfo(),I)}return C}),W.getRoot().listExtensionsUsed().filter((j)=>j.prereadTypes.includes(c.MESH)).forEach((j)=>j.preread(Q,c.MESH));let w=$.meshes||[];W.getRoot().listExtensionsUsed().filter((j)=>j.prereadTypes.includes(c.PRIMITIVE)).forEach((j)=>j.preread(Q,c.PRIMITIVE)),Q.meshes=w.map((j)=>{let C=W.createMesh(j.name);if(j.extras)C.setExtras(j.extras);if(j.weights!==void 0)C.setWeights(j.weights);return(j.primitives||[]).forEach((I)=>{let A=W.createPrimitive();if(I.extras)A.setExtras(I.extras);if(I.material!==void 0)A.setMaterial(Q.materials[I.material]);if(I.mode!==void 0)A.setMode(I.mode);for(let[d,h]of Object.entries(I.attributes||{}))A.setAttribute(d,Q.accessors[h]);if(I.indices!==void 0)A.setIndices(Q.accessors[I.indices]);let v=j.extras&&j.extras.targetNames||[];(I.targets||[]).forEach((d,h)=>{let u=v[h]||h.toString(),W0=W.createPrimitiveTarget(u);for(let[U0,B0]of Object.entries(d))W0.setAttribute(U0,Q.accessors[B0]);A.addTarget(W0)}),C.addPrimitive(A)}),C});let O=$.cameras||[];Q.cameras=O.map((j)=>{let C=W.createCamera(j.name).setType(j.type);if(j.extras)C.setExtras(j.extras);if(j.type===ZY.Type.PERSPECTIVE){let k=j.perspective;if(C.setYFov(k.yfov),C.setZNear(k.znear),k.zfar!==void 0)C.setZFar(k.zfar);if(k.aspectRatio!==void 0)C.setAspectRatio(k.aspectRatio)}else{let k=j.orthographic;C.setZNear(k.znear).setZFar(k.zfar).setXMag(k.xmag).setYMag(k.ymag)}return C});let R=$.nodes||[];W.getRoot().listExtensionsUsed().filter((j)=>j.prereadTypes.includes(c.NODE)).forEach((j)=>j.preread(Q,c.NODE)),Q.nodes=R.map((j)=>{let C=W.createNode(j.name);if(j.extras)C.setExtras(j.extras);if(j.translation!==void 0)C.setTranslation(j.translation);if(j.rotation!==void 0)C.setRotation(j.rotation);if(j.scale!==void 0)C.setScale(j.scale);if(j.matrix!==void 0){let k=[0,0,0],I=[0,0,0,1],A=[1,1,1];A0.decompose(j.matrix,k,I,A),C.setTranslation(k),C.setRotation(I),C.setScale(A)}if(j.weights!==void 0)C.setWeights(j.weights);return C});let N=$.skins||[];Q.skins=N.map((j)=>{let C=W.createSkin(j.name);if(j.extras)C.setExtras(j.extras);if(j.inverseBindMatrices!==void 0)C.setInverseBindMatrices(Q.accessors[j.inverseBindMatrices]);if(j.skeleton!==void 0)C.setSkeleton(Q.nodes[j.skeleton]);for(let k of j.joints)C.addJoint(Q.nodes[k]);return C}),R.map((j,C)=>{let k=Q.nodes[C];if((j.children||[]).forEach((A)=>k.addChild(Q.nodes[A])),j.mesh!==void 0)k.setMesh(Q.meshes[j.mesh]);if(j.camera!==void 0)k.setCamera(Q.cameras[j.camera]);if(j.skin!==void 0)k.setSkin(Q.skins[j.skin])});let P=$.animations||[];Q.animations=P.map((j)=>{let C=W.createAnimation(j.name);if(j.extras)C.setExtras(j.extras);let I=(j.samplers||[]).map((v)=>{let x=W.createAnimationSampler().setInput(Q.accessors[v.input]).setOutput(Q.accessors[v.output]).setInterpolation(v.interpolation||SW.Interpolation.LINEAR);if(v.extras)x.setExtras(v.extras);return C.addSampler(x),x});return(j.channels||[]).forEach((v)=>{let x=W.createAnimationChannel().setSampler(I[v.sampler]).setTargetPath(v.target.path);if(v.target.node!==void 0)x.setTargetNode(Q.nodes[v.target.node]);if(v.extras)x.setExtras(v.extras);C.addChannel(x)}),C});let D=$.scenes||[];if(W.getRoot().listExtensionsUsed().filter((j)=>j.prereadTypes.includes(c.SCENE)).forEach((j)=>j.preread(Q,c.SCENE)),Q.scenes=D.map((j)=>{let C=W.createScene(j.name);if(j.extras)C.setExtras(j.extras);return(j.nodes||[]).map((I)=>Q.nodes[I]).forEach((I)=>C.addChild(I)),C}),$.scene!==void 0)W.getRoot().setDefaultScene(Q.scenes[$.scene]);return W.getRoot().listExtensionsUsed().forEach((j)=>j.read(Q)),H.forEach((j,C)=>{let k=Q.accessors[C],I=!!j.sparse,A=!j.bufferView&&!k.getArray();if(I||A)k.setSparse(!0).setArray(kK1(j,Q))}),W}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((W)=>W.EXTENSION_NAME===$))throw new Error(`Missing required extension, "${$}".`)}if(Y.extensionsUsed){for(let $ of Y.extensionsUsed)if(!J.extensions.find((W)=>W.EXTENSION_NAME===$))J.logger.warn(`Missing optional extension, "${$}".`)}}}function TK1(Z,J){let Y=J.jsonDoc,$=J.bufferViews[Z.bufferView],W=Y.json.bufferViews[Z.bufferView],Q=VZ[Z.componentType],X=N0.getElementSize(Z.type),K=Q.BYTES_PER_ELEMENT,G=Z.byteOffset||0,z=new Q(Z.count*X),F=new DataView($.buffer,$.byteOffset,$.byteLength),V=W.byteStride;for(let H=0;H<Z.count;H++)for(let q=0;q<X;q++){let U=G+H*V+q*K,L;switch(Z.componentType){case N0.ComponentType.FLOAT:L=F.getFloat32(U,!0);break;case N0.ComponentType.UNSIGNED_INT:L=F.getUint32(U,!0);break;case N0.ComponentType.UNSIGNED_SHORT:L=F.getUint16(U,!0);break;case N0.ComponentType.UNSIGNED_BYTE:L=F.getUint8(U);break;case N0.ComponentType.SHORT:L=F.getInt16(U,!0);break;case N0.ComponentType.BYTE:L=F.getInt8(U);break;default:throw new Error(`Unexpected componentType "${Z.componentType}".`)}z[H*X+q]=L}return z}function Rq(Z,J){let Y=J.jsonDoc,$=J.bufferViews[Z.bufferView],W=Y.json.bufferViews[Z.bufferView],Q=VZ[Z.componentType],X=N0.getElementSize(Z.type),K=Q.BYTES_PER_ELEMENT,G=X*K;if(W.byteStride!==void 0&&W.byteStride!==G)return TK1(Z,J);let z=$.byteOffset+(Z.byteOffset||0),F=Z.count*X*K;return new Q($.buffer.slice(z,z+F))}function kK1(Z,J){let Y=VZ[Z.componentType],$=N0.getElementSize(Z.type),W;if(Z.bufferView!==void 0)W=Rq(Z,J);else W=new Y(Z.count*$);let Q=Z.sparse;if(!Q)return W;let X=Q.count,K=M6({},Z,Q.indices,{count:X,type:"SCALAR"}),G=M6({},Z,Q.values,{count:X}),z=Rq(K,J),F=Rq(G,J);for(let V=0;V<K.count;V++)for(let H=0;H<$;H++)W[z[V]*$+H]=F[V*$+H];return W}var rK;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(rK||(rK={}));class zZ{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(),W=$.listBuffers().length,Q=$.listTextures().length;this.bufferURIGenerator=new DN(W>1,()=>Y.basename||"buffer"),this.imageURIGenerator=new DN(Q>1,(X)=>EK1(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 W={source:this.imageIndexMap.get(Z),sampler:this.samplerDefIndexMap.get($)},Q=JSON.stringify(W);if(!this.textureDefIndexMap.has(Q))this.textureDefIndexMap.set(Q,this.jsonDoc.json.textures.length),this.jsonDoc.json.textures.push(W);let X={index:this.textureDefIndexMap.get(Q)};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===V7.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 $=H7.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 W=`Resource URI "${Z}" already assigned to different data.`;if(!Y){this.logger.warn(W);return}throw new Error(W)}getAccessorUsage(Z){let J=this._accessorUsageMap.get(Z);if(J)return J;if(Z.getSparse())return L5.SPARSE;for(let Y of this._doc.getGraph().listParentEdges(Z)){let{usage:$}=Y.getAttributes();if($)return $;if(Y.getParent().propertyType!==c.ROOT)this.logger.warn(`Missing attribute ".usage" on edge, "${Y.getName()}".`)}return L5.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}}zZ.BufferViewTarget=rK;zZ.BufferViewUsage=L5;zZ.USAGE_TO_TARGET={[L5.ARRAY_BUFFER]:rK.ARRAY_BUFFER,[L5.ELEMENT_ARRAY_BUFFER]:rK.ELEMENT_ARRAY_BUFFER};class DN{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 EK1(Z,J){let Y=Z.getGraph().listParentEdges(J).find(($)=>$.getParent()!==Z.getRoot());return Y?Y.getName().replace(/texture$/i,""):""}var{BufferViewUsage:Mq}=zZ,{UNSIGNED_INT:IK1,UNSIGNED_SHORT:vK1,UNSIGNED_BYTE:SK1}=N0.ComponentType,_K1=new Set([c.ACCESSOR,c.BUFFER,c.MATERIAL,c.MESH]);class $d{static write(Z,J){let Y=Z.getGraph(),$=Z.getRoot(),W={asset:M6({generator:`glTF-Transform ${am}`},$.getAsset()),extras:M6({},$.getExtras())},Q={json:W,resources:{}},X=new zZ(Z,Q,J),K=J.logger||a6.DEFAULT_INSTANCE,G=new Set(J.extensions.map((w)=>w.EXTENSION_NAME)),z=Z.getRoot().listExtensionsUsed().filter((w)=>G.has(w.extensionName)).sort((w,O)=>w.extensionName>O.extensionName?1:-1),F=Z.getRoot().listExtensionsRequired().filter((w)=>G.has(w.extensionName)).sort((w,O)=>w.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 w of z){let O=w.prewriteTypes.filter((R)=>!_K1.has(R));if(O.length)K.warn(`Prewrite hooks for some types (${O.join()}), requested by extension ${w.extensionName}, are unsupported. Please file an issue or a PR.`);for(let R of w.writeDependencies)w.install(R,J.dependencies[R])}function V(w,O,R,N){let P=[],D=0;for(let k of w){let I=X.createAccessorDef(k);I.bufferView=W.bufferViews.length;let A=k.getArray(),v=m0.pad(m0.toView(A));I.byteOffset=D,D+=v.byteLength,P.push(v),X.accessorIndexMap.set(k,W.accessors.length),W.accessors.push(I)}let j=m0.concat(P),C={buffer:O,byteOffset:R,byteLength:j.byteLength};if(N)C.target=N;return W.bufferViews.push(C),{buffers:P,byteLength:D}}function H(w,O,R){let N=w[0].getCount(),P=0;for(let I of w){let A=X.createAccessorDef(I);A.bufferView=W.bufferViews.length,A.byteOffset=P;let v=I.getElementSize(),x=I.getComponentSize();P+=m0.padNumber(v*x),X.accessorIndexMap.set(I,W.accessors.length),W.accessors.push(A)}let D=N*P,j=new ArrayBuffer(D),C=new DataView(j);for(let I=0;I<N;I++){let A=0;for(let v of w){let x=v.getElementSize(),d=v.getComponentSize(),h=v.getComponentType(),u=v.getArray();for(let W0=0;W0<x;W0++){let U0=I*P+A+W0*d,B0=u[I*x+W0];switch(h){case N0.ComponentType.FLOAT:C.setFloat32(U0,B0,!0);break;case N0.ComponentType.BYTE:C.setInt8(U0,B0);break;case N0.ComponentType.SHORT:C.setInt16(U0,B0,!0);break;case N0.ComponentType.UNSIGNED_BYTE:C.setUint8(U0,B0);break;case N0.ComponentType.UNSIGNED_SHORT:C.setUint16(U0,B0,!0);break;case N0.ComponentType.UNSIGNED_INT:C.setUint32(U0,B0,!0);break;default:throw new Error("Unexpected component type: "+h)}}A+=m0.padNumber(x*d)}}let k={buffer:O,byteOffset:R,byteLength:D,byteStride:P,target:zZ.BufferViewTarget.ARRAY_BUFFER};return W.bufferViews.push(k),{byteLength:D,buffers:[new Uint8Array(j)]}}function q(w,O,R){let N=[],P=0,D=new Map,j=-1/0,C=!1;for(let h of w){let u=X.createAccessorDef(h);W.accessors.push(u),X.accessorIndexMap.set(h,W.accessors.length-1);let W0=[],U0=[],B0=[],y0=new Array(h.getElementSize()).fill(0);for(let O1=0,O9=h.getCount();O1<O9;O1++){if(h.getElement(O1,B0),A0.eq(B0,y0,0))continue;j=Math.max(O1,j),W0.push(O1);for(let p8=0;p8<B0.length;p8++)U0.push(B0[p8])}let B1=W0.length,B8={accessorDef:u,count:B1};if(D.set(h,B8),B1===0)continue;if(B1>h.getCount()/2)C=!0;let O8=VZ[h.getComponentType()];B8.indices=W0,B8.values=new O8(U0)}if(!Number.isFinite(j))return{buffers:N,byteLength:P};if(C)K.warn("Some sparse accessors have >50% non-zero elements, which may increase file size.");let k=j<255?Uint8Array:j<65535?Uint16Array:Uint32Array,I=j<255?SK1:j<65535?vK1:IK1,A={buffer:O,byteOffset:R+P,byteLength:0};for(let h of w){let u=D.get(h);if(u.count===0)continue;u.indicesByteOffset=A.byteLength;let W0=m0.pad(m0.toView(new k(u.indices)));N.push(W0),P+=W0.byteLength,A.byteLength+=W0.byteLength}W.bufferViews.push(A);let v=W.bufferViews.length-1,x={buffer:O,byteOffset:R+P,byteLength:0};for(let h of w){let u=D.get(h);if(u.count===0)continue;u.valuesByteOffset=x.byteLength;let W0=m0.pad(m0.toView(u.values));N.push(W0),P+=W0.byteLength,x.byteLength+=W0.byteLength}W.bufferViews.push(x);let d=W.bufferViews.length-1;for(let h of w){let u=D.get(h);if(u.count===0)continue;u.accessorDef.sparse={count:u.count,indices:{bufferView:v,byteOffset:u.indicesByteOffset,componentType:I},values:{bufferView:d,byteOffset:u.valuesByteOffset}}}return{buffers:N,byteLength:P}}if(W.accessors=[],W.bufferViews=[],W.samplers=[],W.textures=[],W.images=$.listTextures().map((w,O)=>{let R=X.createPropertyDef(w);if(w.getMimeType())R.mimeType=w.getMimeType();let N=w.getImage();if(N)X.createImageData(R,N,w);return X.imageIndexMap.set(w,O),R}),z.filter((w)=>w.prewriteTypes.includes(c.ACCESSOR)).forEach((w)=>w.prewrite(X,c.ACCESSOR)),$.listAccessors().forEach((w)=>{let{accessorUsageGroupedByParent:O,accessorParents:R}=X;if(X.accessorIndexMap.has(w))return;let N=X.getAccessorUsage(w);if(X.addAccessorToUsageGroup(w,N),O.has(N)){let P=Y.listParents(w).find((D)=>D.propertyType!==c.ROOT);R.set(w,P)}}),z.filter((w)=>w.prewriteTypes.includes(c.BUFFER)).forEach((w)=>w.prewrite(X,c.BUFFER)),($.listAccessors().length>0||X.otherBufferViews.size>0||$.listTextures().length>0&&J.format===V7.GLB)&&$.listBuffers().length===0)throw new Error("Buffer required for Document resources, but none was found.");if(W.buffers=[],$.listBuffers().forEach((w,O)=>{let R=X.createPropertyDef(w),N=X.accessorUsageGroupedByParent,P=w.listParents().filter((x)=>x instanceof N0),D=new Set(P.map((x)=>X.accessorParents.get(x))),j=new Map(Array.from(D).map((x,d)=>[x,d])),C={};for(let x of P){var k;if(X.accessorIndexMap.has(x))continue;let d=X.getAccessorUsage(x),h=d;if(N.has(d)){let u=X.accessorParents.get(x);h+=`:${j.get(u)}`}C[k=h]||(C[k]={usage:d,accessors:[]}),C[h].accessors.push(x)}let I=[],A=W.buffers.length,v=0;for(let{usage:x,accessors:d}of Object.values(C))if(x===Mq.ARRAY_BUFFER&&J.vertexLayout===Pq.INTERLEAVED){let h=H(d,A,v);v+=h.byteLength;for(let u of h.buffers)I.push(u)}else if(x===Mq.ARRAY_BUFFER)for(let h of d){let u=H([h],A,v);v+=u.byteLength;for(let W0 of u.buffers)I.push(W0)}else if(x===Mq.SPARSE){let h=q(d,A,v);v+=h.byteLength;for(let u of h.buffers)I.push(u)}else if(x===Mq.ELEMENT_ARRAY_BUFFER){let h=zZ.BufferViewTarget.ELEMENT_ARRAY_BUFFER,u=V(d,A,v,h);v+=u.byteLength;for(let W0 of u.buffers)I.push(W0)}else{let h=V(d,A,v);v+=h.byteLength;for(let u of h.buffers)I.push(u)}if(X.imageBufferViews.length&&O===0){for(let x=0;x<X.imageBufferViews.length;x++)if(W.bufferViews[W.images[x].bufferView].byteOffset=v,v+=X.imageBufferViews[x].byteLength,I.push(X.imageBufferViews[x]),v%8){let d=8-v%8;v+=d,I.push(new Uint8Array(d))}}if(X.otherBufferViews.has(w))for(let x of X.otherBufferViews.get(w))W.bufferViews.push({buffer:A,byteOffset:v,byteLength:x.byteLength}),X.otherBufferViewsIndexMap.set(x,W.bufferViews.length-1),v+=x.byteLength,I.push(x);if(v){let x;if(J.format===V7.GLB)x=Nq;else x=X.bufferURIGenerator.createURI(w,"bin"),R.uri=x;R.byteLength=v,X.assignResourceURI(x,m0.concat(I),!0)}W.buffers.push(R),X.bufferIndexMap.set(w,O)}),$.listAccessors().find((w)=>!w.getBuffer()))K.warn("Skipped writing one or more Accessors: no Buffer assigned.");z.filter((w)=>w.prewriteTypes.includes(c.MATERIAL)).forEach((w)=>w.prewrite(X,c.MATERIAL)),W.materials=$.listMaterials().map((w,O)=>{let R=X.createPropertyDef(w);if(w.getAlphaMode()!==z4.AlphaMode.OPAQUE)R.alphaMode=w.getAlphaMode();if(w.getAlphaMode()===z4.AlphaMode.MASK)R.alphaCutoff=w.getAlphaCutoff();if(w.getDoubleSided())R.doubleSided=!0;if(R.pbrMetallicRoughness={},!A0.eq(w.getBaseColorFactor(),[1,1,1,1]))R.pbrMetallicRoughness.baseColorFactor=w.getBaseColorFactor();if(!A0.eq(w.getEmissiveFactor(),[0,0,0]))R.emissiveFactor=w.getEmissiveFactor();if(w.getRoughnessFactor()!==1)R.pbrMetallicRoughness.roughnessFactor=w.getRoughnessFactor();if(w.getMetallicFactor()!==1)R.pbrMetallicRoughness.metallicFactor=w.getMetallicFactor();if(w.getBaseColorTexture()){let N=w.getBaseColorTexture(),P=w.getBaseColorTextureInfo();R.pbrMetallicRoughness.baseColorTexture=X.createTextureInfoDef(N,P)}if(w.getEmissiveTexture()){let N=w.getEmissiveTexture(),P=w.getEmissiveTextureInfo();R.emissiveTexture=X.createTextureInfoDef(N,P)}if(w.getNormalTexture()){let N=w.getNormalTexture(),P=w.getNormalTextureInfo(),D=X.createTextureInfoDef(N,P);if(w.getNormalScale()!==1)D.scale=w.getNormalScale();R.normalTexture=D}if(w.getOcclusionTexture()){let N=w.getOcclusionTexture(),P=w.getOcclusionTextureInfo(),D=X.createTextureInfoDef(N,P);if(w.getOcclusionStrength()!==1)D.strength=w.getOcclusionStrength();R.occlusionTexture=D}if(w.getMetallicRoughnessTexture()){let N=w.getMetallicRoughnessTexture(),P=w.getMetallicRoughnessTextureInfo();R.pbrMetallicRoughness.metallicRoughnessTexture=X.createTextureInfoDef(N,P)}return X.materialIndexMap.set(w,O),R}),z.filter((w)=>w.prewriteTypes.includes(c.MESH)).forEach((w)=>w.prewrite(X,c.MESH)),W.meshes=$.listMeshes().map((w,O)=>{let R=X.createPropertyDef(w),N=null;if(R.primitives=w.listPrimitives().map((P)=>{let D={attributes:{}};D.mode=P.getMode();let j=P.getMaterial();if(j)D.material=X.materialIndexMap.get(j);if(Object.keys(P.getExtras()).length)D.extras=P.getExtras();let C=P.getIndices();if(C)D.indices=X.accessorIndexMap.get(C);for(let k of P.listSemantics())D.attributes[k]=X.accessorIndexMap.get(P.getAttribute(k));for(let k of P.listTargets()){let I={};for(let A of k.listSemantics())I[A]=X.accessorIndexMap.get(k.getAttribute(A));D.targets=D.targets||[],D.targets.push(I)}if(P.listTargets().length&&!N)N=P.listTargets().map((k)=>k.getName());return D}),w.getWeights().length)R.weights=w.getWeights();if(N)R.extras=R.extras||{},R.extras.targetNames=N;return X.meshIndexMap.set(w,O),R}),W.cameras=$.listCameras().map((w,O)=>{let R=X.createPropertyDef(w);if(R.type=w.getType(),R.type===ZY.Type.PERSPECTIVE){R.perspective={znear:w.getZNear(),zfar:w.getZFar(),yfov:w.getYFov()};let N=w.getAspectRatio();if(N!==null)R.perspective.aspectRatio=N}else R.orthographic={znear:w.getZNear(),zfar:w.getZFar(),xmag:w.getXMag(),ymag:w.getYMag()};return X.cameraIndexMap.set(w,O),R}),W.nodes=$.listNodes().map((w,O)=>{let R=X.createPropertyDef(w);if(!A0.eq(w.getTranslation(),[0,0,0]))R.translation=w.getTranslation();if(!A0.eq(w.getRotation(),[0,0,0,1]))R.rotation=w.getRotation();if(!A0.eq(w.getScale(),[1,1,1]))R.scale=w.getScale();if(w.getWeights().length)R.weights=w.getWeights();return X.nodeIndexMap.set(w,O),R}),W.skins=$.listSkins().map((w,O)=>{let R=X.createPropertyDef(w),N=w.getInverseBindMatrices();if(N)R.inverseBindMatrices=X.accessorIndexMap.get(N);let P=w.getSkeleton();if(P)R.skeleton=X.nodeIndexMap.get(P);return R.joints=w.listJoints().map((D)=>X.nodeIndexMap.get(D)),X.skinIndexMap.set(w,O),R}),$.listNodes().forEach((w,O)=>{let R=W.nodes[O],N=w.getMesh();if(N)R.mesh=X.meshIndexMap.get(N);let P=w.getCamera();if(P)R.camera=X.cameraIndexMap.get(P);let D=w.getSkin();if(D)R.skin=X.skinIndexMap.get(D);if(w.listChildren().length>0)R.children=w.listChildren().map((j)=>X.nodeIndexMap.get(j))}),W.animations=$.listAnimations().map((w,O)=>{let R=X.createPropertyDef(w),N=new Map;return R.samplers=w.listSamplers().map((P,D)=>{let j=X.createPropertyDef(P);return j.input=X.accessorIndexMap.get(P.getInput()),j.output=X.accessorIndexMap.get(P.getOutput()),j.interpolation=P.getInterpolation(),N.set(P,D),j}),R.channels=w.listChannels().map((P)=>{let D=X.createPropertyDef(P);return D.sampler=N.get(P.getSampler()),D.target={node:X.nodeIndexMap.get(P.getTargetNode()),path:P.getTargetPath()},D}),X.animationIndexMap.set(w,O),R}),W.scenes=$.listScenes().map((w,O)=>{let R=X.createPropertyDef(w);return R.nodes=w.listChildren().map((N)=>X.nodeIndexMap.get(N)),X.sceneIndexMap.set(w,O),R});let L=$.getDefaultScene();if(L)W.scene=$.listScenes().indexOf(L);return W.extensionsUsed=z.map((w)=>w.extensionName),W.extensionsRequired=F.map((w)=>w.extensionName),z.forEach((w)=>w.write(X)),xK1(W),Q}}function xK1(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 Cq;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(Cq||(Cq={}));class Wd{constructor(){this._logger=a6.DEFAULT_INSTANCE,this._extensions=new Set,this._dependencies={},this._vertexLayout=Pq.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=nm(J)?this._binaryToJSON(J):{json:JSON.parse(m0.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),Yd.read(Z,{extensions:Array.from(this._extensions),dependencies:this._dependencies,logger:this._logger})}async binaryToJSON(Z){let J=this._binaryToJSON(m0.assertView(Z));this._readResourcesInternal(J);let Y=J.json;if(Y.buffers&&Y.buffers.some(($)=>AK1(J,$)))throw new Error("Cannot resolve external buffers with binaryToJSON().");else if(Y.images&&Y.images.some(($)=>hK1(J,$)))throw new Error("Cannot resolve external images with binaryToJSON().");return J}async readBinary(Z){return this.readJSON(await this.binaryToJSON(m0.assertView(Z)))}async writeJSON(Z,J={}){if(J.format===V7.GLB&&Z.getRoot().listBuffers().length>1)throw new Error("GLB must have 0\u20131 buffers.");return $d.write(Z,{format:J.format||V7.GLTF,basename:J.basename||"",logger:this._logger,vertexLayout:this._vertexLayout,dependencies:M6({},this._dependencies),extensions:Array.from(this._extensions)})}async writeBinary(Z){let{json:J,resources:Y}=await this.writeJSON(Z,{format:V7.GLB}),$=new Uint32Array([1179937895,2,12]),W=JSON.stringify(J),Q=m0.pad(m0.encodeText(W),32),X=m0.toView(new Uint32Array([Q.byteLength,1313821514])),K=m0.concat([X,Q]);$[$.length-1]+=K.byteLength;let G=Object.values(Y)[0];if(!G||!G.byteLength)return m0.concat([m0.toView($),K]);let z=m0.pad(G,0),F=m0.toView(new Uint32Array([z.byteLength,5130562])),V=m0.concat([F,z]);return $[$.length-1]+=V.byteLength,m0.concat([m0.toView($),K,V])}async _readResourcesExternal(Z,J){var Y=this;let $=Z.json.images||[],W=Z.json.buffers||[],Q=[...$,...W].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(Q)}_readResourcesInternal(Z){function J(W){if(!W.uri)return;if(W.uri in Z.resources){m0.assertView(Z.resources[W.uri]);return}if(W.uri.match(/data:/)){let Q=`__${em()}.${q7.extension(W.uri)}`;Z.resources[Q]=m0.createBufferFromDataURI(W.uri),W.uri=Q}}(Z.json.images||[]).forEach((W)=>{if(W.bufferView===void 0&&W.uri===void 0)throw new Error("Missing resource URI or buffer view.");J(W)}),(Z.json.buffers||[]).forEach(J)}_copyJSON(Z){let{images:J,buffers:Y}=Z.json;if(Z={json:M6({},Z.json),resources:M6({},Z.resources)},J)Z.json.images=J.map(($)=>M6({},$));if(Y)Z.json.buffers=Y.map(($)=>M6({},$));return Z}_binaryToJSON(Z){if(!nm(Z))throw new Error("Invalid glTF 2.0 binary.");let J=new Uint32Array(Z.buffer,Z.byteOffset+12,2);if(J[1]!==Cq.JSON)throw new Error("Missing required GLB JSON chunk.");let Y=20,$=J[0],W=m0.decodeText(m0.toView(Z,Y,$)),Q=JSON.parse(W),X=Y+$;if(Z.byteLength<=X)return{json:Q,resources:{}};let K=new Uint32Array(Z.buffer,Z.byteOffset+X,2);if(K[1]!==Cq.BIN)return{json:Q,resources:{}};let G=K[0],z=m0.toView(Z,X+8,G);return{json:Q,resources:{[Nq]:z}}}}function AK1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)}function hK1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)&&J.bufferView===void 0}function nm(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 SN extends Wd{constructor(Z=null,J=f5.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(),f5.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(f5.isAbsoluteURL(Z)||f5.isAbsoluteURL(J))return f5.resolve(Z,J);return this._path.resolve(Z,decodeURIComponent(J))}dirname(Z){if(f5.isAbsoluteURL(Z))return f5.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:W}=await this.writeJSON(J,{format:V7.GLTF,basename:q7.basename(Z)}),{_fs:Q,_path:X}=this,K=X.dirname(Z),G=JSON.stringify($,null,2);await Q.writeFile(Z,G),this.lastWriteBytes+=G.length;for(let z of fK1(Object.keys(W),10))await Promise.all(z.map(async function(F){if(f5.isAbsoluteURL(F)){if(f5.extension(F)==="bin")throw new Error(`Cannot write buffer to path "${F}".`);return}let V=X.join(K,decodeURIComponent(F));await Q.mkdir(X.dirname(V),{recursive:!0}),await Q.writeFile(V,W[F]),Y.lastWriteBytes+=W[F].byteLength}))}async _writeGLB(Z,J){let Y=await this.writeBinary(J);await this._fs.writeFile(Z,Y),this.lastWriteBytes=Y.byteLength}}function fK1(Z,J){let Y=[];for(let $=0,W=Z.length;$<W;$+=J){let Q=[];for(let X=0;X<J&&$+X<W;X++)Q.push(Z[$+X]);Y.push(Q)}return Y}var Zl=i(_N(),1),Jl=i(yc(),1),kV1=i(ec(),1);async function EV1(Z,J){if(!(Z instanceof Uint8Array))throw new Error("[ndarray-pixels] Input must be Uint8Array or Buffer.");let{data:Y,info:$}=await Jl.default(Z).ensureAlpha().raw().toBuffer({resolveWithObject:!0});return Zl.default(new Uint8Array(Y),[$.width,$.height,4],[4,4*$.width|0,1],0)}async function Yl(Z,J){return EV1(Z)}var IV1="v4.1.3",FP="@glb.bin",l;(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"})(l||(l={}));var $l;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})($l||($l={}));var M5;(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"})(M5||(M5={}));var R5;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(R5||(R5={}));var WP;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(WP||(WP={}));var QP=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 vV1(){var Z=new QP(3);if(QP!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function $P(Z){var J=Z[0],Y=Z[1],$=Z[2];return Math.hypot(J,Y,$)}function SV1(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=Y[3]*$+Y[7]*W+Y[11]*Q+Y[15];return X=X||1,Z[0]=(Y[0]*$+Y[4]*W+Y[8]*Q+Y[12])/X,Z[1]=(Y[1]*$+Y[5]*W+Y[9]*Q+Y[13])/X,Z[2]=(Y[2]*$+Y[6]*W+Y[10]*Q+Y[14])/X,Z}(function(){var Z=vV1();return function(J,Y,$,W,Q,X){var K,G;if(!Y)Y=3;if(!$)$=0;if(W)G=Math.min(W*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],Q(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}})();function Kl(Z){let J=Gl(),Y=Z.propertyType===l.NODE?[Z]:Z.listChildren();for(let $ of Y)$.traverse((W)=>{let Q=W.getMesh();if(!Q)return;let X=_V1(Q,W.getWorldMatrix());if(X.min.every(isFinite)&&X.max.every(isFinite))XP(X.min,J),XP(X.max,J)});return J}function _V1(Z,J){let Y=Gl();for(let $ of Z.listPrimitives()){let W=$.getAttribute("POSITION"),Q=$.getIndices();if(!W)continue;let X=[0,0,0],K=[0,0,0];for(let G=0,z=Q?Q.getCount():W.getCount();G<z;G++){let F=Q?Q.getScalar(G):G;X=W.getElement(F,X),K=SV1(K,X,J),XP(K,Y)}}return Y}function XP(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 Gl(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class W6{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 W of Z)J+=W.byteLength;let Y=new Uint8Array(J),$=0;for(let W of Z)Y.set(W,$),$+=W.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 W=Z.byteLength;W<Y;W++)$[W]=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 zl{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),xV1(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(W6.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 v9{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,W=this.getSize(Z,J);if(!W)return null;while(W[0]>1||W[1]>1)Y+=W[0]*W[1]*$,W[0]=Math.max(Math.floor(W[0]/2),1),W[1]=Math.max(Math.floor(W[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}`}}v9.impls={"image/jpeg":new zl,"image/png":new $U};function xV1(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 GG{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 v9.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 Wl(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function XY(Z){if(Wl(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let Y=J.prototype;if(Wl(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}var KP,GP;(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"})(GP||(GP={}));class w4{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=w4.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=w4.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=w4.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=w4.Verbosity.ERROR)console.error(Z)}}KP=w4;w4.Verbosity=GP;w4.DEFAULT_INSTANCE=new KP(KP.Verbosity.INFO);function AV1(Z){var J=Z[0],Y=Z[1],$=Z[2],W=Z[3],Q=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],F=Z[9],V=Z[10],H=Z[11],q=Z[12],U=Z[13],L=Z[14],w=Z[15],O=J*X-Y*Q,R=J*K-$*Q,N=J*G-W*Q,P=Y*K-$*X,D=Y*G-W*X,j=$*G-W*K,C=z*U-F*q,k=z*L-V*q,I=z*w-H*q,A=F*L-V*U,v=F*w-H*U,x=V*w-H*L;return O*x-R*v+N*A+P*I-D*k+j*C}function hV1(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],V=J[8],H=J[9],q=J[10],U=J[11],L=J[12],w=J[13],O=J[14],R=J[15],N=Y[0],P=Y[1],D=Y[2],j=Y[3];return Z[0]=N*$+P*K+D*V+j*L,Z[1]=N*W+P*G+D*H+j*w,Z[2]=N*Q+P*z+D*q+j*O,Z[3]=N*X+P*F+D*U+j*R,N=Y[4],P=Y[5],D=Y[6],j=Y[7],Z[4]=N*$+P*K+D*V+j*L,Z[5]=N*W+P*G+D*H+j*w,Z[6]=N*Q+P*z+D*q+j*O,Z[7]=N*X+P*F+D*U+j*R,N=Y[8],P=Y[9],D=Y[10],j=Y[11],Z[8]=N*$+P*K+D*V+j*L,Z[9]=N*W+P*G+D*H+j*w,Z[10]=N*Q+P*z+D*q+j*O,Z[11]=N*X+P*F+D*U+j*R,N=Y[12],P=Y[13],D=Y[14],j=Y[15],Z[12]=N*$+P*K+D*V+j*L,Z[13]=N*W+P*G+D*H+j*w,Z[14]=N*Q+P*z+D*q+j*O,Z[15]=N*X+P*F+D*U+j*R,Z}function fV1(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[4],X=J[5],K=J[6],G=J[8],z=J[9],F=J[10];return Z[0]=Math.hypot(Y,$,W),Z[1]=Math.hypot(Q,X,K),Z[2]=Math.hypot(G,z,F),Z}function yV1(Z,J){var Y=new QP(3);fV1(Y,J);var $=1/Y[0],W=1/Y[1],Q=1/Y[2],X=J[0]*$,K=J[1]*W,G=J[2]*Q,z=J[4]*$,F=J[5]*W,V=J[6]*Q,H=J[8]*$,q=J[9]*W,U=J[10]*Q,L=X+F+U,w=0;if(L>0)w=Math.sqrt(L+1)*2,Z[3]=0.25*w,Z[0]=(V-q)/w,Z[1]=(H-G)/w,Z[2]=(K-z)/w;else if(X>F&&X>U)w=Math.sqrt(1+X-F-U)*2,Z[3]=(V-q)/w,Z[0]=0.25*w,Z[1]=(K+z)/w,Z[2]=(H+G)/w;else if(F>U)w=Math.sqrt(1+F-X-U)*2,Z[3]=(H-G)/w,Z[0]=(K+z)/w,Z[1]=0.25*w,Z[2]=(V+q)/w;else w=Math.sqrt(1+U-X-F)*2,Z[3]=(K-z)/w,Z[0]=(H+G)/w,Z[1]=(V+q)/w,Z[2]=0.25*w;return Z}class o1{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(o1.clamp(Z,0,1)*65535);case 5121:return Math.round(o1.clamp(Z,0,1)*255);case 5122:return Math.round(o1.clamp(Z,-1,1)*32767);case 5120:return Math.round(o1.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,Y,$){let W=$P([Z[0],Z[1],Z[2]]),Q=$P([Z[4],Z[5],Z[6]]),X=$P([Z[8],Z[9],Z[10]]);if(AV1(Z)<0)W=-W;J[0]=Z[12],J[1]=Z[13],J[2]=Z[14];let G=Z.slice(),z=1/W,F=1/Q,V=1/X;G[0]*=z,G[1]*=z,G[2]*=z,G[4]*=F,G[5]*=F,G[6]*=F,G[8]*=V,G[9]*=V,G[10]*=V,yV1(Y,G),$[0]=W,$[1]=Q,$[2]=X}static compose(Z,J,Y,$){let W=$,Q=J[0],X=J[1],K=J[2],G=J[3],z=Q+Q,F=X+X,V=K+K,H=Q*z,q=Q*F,U=Q*V,L=X*F,w=X*V,O=K*V,R=G*z,N=G*F,P=G*V,D=Y[0],j=Y[1],C=Y[2];return W[0]=(1-(L+O))*D,W[1]=(q+P)*D,W[2]=(U-N)*D,W[3]=0,W[4]=(q-P)*j,W[5]=(1-(H+O))*j,W[6]=(w+R)*j,W[7]=0,W[8]=(U+N)*C,W[9]=(w-R)*C,W[10]=(1-(H+L))*C,W[11]=0,W[12]=Z[0],W[13]=Z[1],W[14]=Z[2],W[15]=1,W}}function bV1(Z,J){if(!!Z!==!!J)return!1;let Y=Z.getChild(),$=J.getChild();return Y===$||Y.equals($)}function gV1(Z,J){if(!!Z!==!!J)return!1;let Y=Z.values(),$=J.values();if(Y.length!==$.length)return!1;for(let W=0;W<Y.length;W++){let Q=Y[W],X=$[W];if(Q.getChild()===X.getChild())continue;if(!Q.getChild().equals(X.getChild()))return!1}return!0}function mV1(Z,J){if(!!Z!==!!J)return!1;let Y=Z.keys(),$=J.keys();if(Y.length!==$.length)return!1;for(let W of Y){let Q=Z.get(W),X=J.get(W);if(!!Q!==!!X)return!1;let K=Q.getChild(),G=X.getChild();if(K===G)continue;if(!K.equals(G))return!1}return!0}function Fl(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 Vl(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!XY(Z)||!XY(J))return Z===J;let Y=Z,$=J,W=0,Q=0,X;for(X in Y)W++;for(X in $)Q++;if(W!==Q)return!1;for(X in Y){let K=Y[X],G=$[X];if(ZU(K)&&ZU(G)){if(!Fl(K,G))return!1}else if(XY(K)&&XY(G)){if(!Vl(K,G))return!1}else if(K!==G)return!1}return!0}function ZU(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var Ql="https://null.example";class VP{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return GG.basename(new URL(Z,Ql).pathname)}static extension(Z){return GG.extension(new URL(Z,Ql).pathname)}static resolve(Z,J){if(!this.isRelativePath(J))return J;let Y=Z.split("/"),$=J.split("/");Y.pop();for(let W=0;W<$.length;W++){if($[W]===".")continue;if($[W]==="..")Y.pop();else Y.push($[W])}return Y.join("/")}static isAbsoluteURL(Z){return this.PROTOCOL_REGEXP.test(Z)}static isRelativePath(Z){return!/^(?:[a-zA-Z]+:)?\//.test(Z)}}VP.DEFAULT_INIT={};VP.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var BZ=(Z)=>Z,dV1=new Set;class WU extends vW{constructor(Z,J=""){super(Z);this[C0].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,BZ)}copy(Z,J=BZ){for(let Y in this[C0]){let $=this[C0][Y];if($ instanceof i6){if(!this[E9].has(Y))$.dispose()}else if($ instanceof J6||$ instanceof w0)for(let W of $.values())W.dispose();else if($ instanceof d1)for(let W of $.values())W.dispose()}for(let Y in Z[C0]){let $=this[C0][Y],W=Z[C0][Y];if(W instanceof i6)if(this[E9].has(Y))$.getChild().copy(J(W.getChild()),J);else this.setRef(Y,J(W.getChild()),W.getAttributes());else if(W instanceof w0||W instanceof J6)for(let Q of W.values())this.addRef(Y,J(Q.getChild()),Q.getAttributes());else if(W instanceof d1)for(let Q of W.keys()){let X=W.get(Q);this.setRefMap(Y,Q,J(X.getChild()),X.getAttributes())}else if(XY(W))this[C0][Y]=JSON.parse(JSON.stringify(W));else if(Array.isArray(W)||W instanceof ArrayBuffer||ArrayBuffer.isView(W))this[C0][Y]=W.slice();else this[C0][Y]=W}return this}equals(Z,J=dV1){if(this===Z)return!0;if(this.propertyType!==Z.propertyType)return!1;for(let Y in this[C0]){if(J.has(Y))continue;let $=this[C0][Y],W=Z[C0][Y];if($ instanceof i6||W instanceof i6){if(!bV1($,W))return!1}else if($ instanceof w0||W instanceof w0||$ instanceof J6||W instanceof J6){if(!gV1($,W))return!1}else if($ instanceof d1||W instanceof d1){if(!mV1($,W))return!1}else if(XY($)||XY(W)){if(!Vl($,W))return!1}else if(ZU($)||ZU(W)){if(!Fl($,W))return!1}else if($!==W)return!1}return!0}detach(){return this.graph.disconnectParents(this,(Z)=>Z.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}}class Q6 extends WU{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new d1})}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 H0 extends Q6{init(){this.propertyType=l.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:H0.Type.SCALAR,componentType:H0.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(Z){switch(Z){case H0.Type.SCALAR:return 1;case H0.Type.VEC2:return 2;case H0.Type.VEC3:return 3;case H0.Type.VEC4:return 4;case H0.Type.MAT2:return 4;case H0.Type.MAT3:return 9;case H0.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+Z)}}static getComponentSize(Z){switch(Z){case H0.ComponentType.BYTE:return 1;case H0.ComponentType.UNSIGNED_BYTE:return 1;case H0.ComponentType.SHORT:return 2;case H0.ComponentType.UNSIGNED_SHORT:return 2;case H0.ComponentType.UNSIGNED_INT:return 4;case H0.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 W=0;W<Y;W++)Z[W]=o1.decodeNormalizedInt(Z[W],$);return Z}getMin(Z){let J=this.getArray(),Y=this.getCount(),$=this.getElementSize();for(let W=0;W<$;W++)Z[W]=1/0;for(let W=0;W<Y*$;W+=$)for(let Q=0;Q<$;Q++){let X=J[W+Q];if(Number.isFinite(X))Z[Q]=Math.min(Z[Q],X)}return Z}getMaxNormalized(Z){let J=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType();if(this.getMax(Z),J)for(let W=0;W<Y;W++)Z[W]=o1.decodeNormalizedInt(Z[W],$);return Z}getMax(Z){let J=this.get("array"),Y=this.getCount(),$=this.getElementSize();for(let W=0;W<$;W++)Z[W]=-1/0;for(let W=0;W<Y*$;W+=$)for(let Q=0;Q<$;Q++){let X=J[W+Q];if(Number.isFinite(X))Z[Q]=Math.max(Z[Q],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 H0.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 o1.decodeNormalizedInt($[Z*J],Y);return $[Z*J]}setScalar(Z,J){let Y=this.getElementSize(),$=this.getComponentType(),W=this.getArray();if(this.getNormalized())W[Z*Y]=o1.encodeNormalizedInt(J,$);else W[Z*Y]=J;return this}getElement(Z,J){let Y=this.getNormalized(),$=this.getElementSize(),W=this.getComponentType(),Q=this.getArray();for(let X=0;X<$;X++)if(Y)J[X]=o1.decodeNormalizedInt(Q[Z*$+X],W);else J[X]=Q[Z*$+X];return J}setElement(Z,J){let Y=this.getNormalized(),$=this.getElementSize(),W=this.getComponentType(),Q=this.getArray();for(let X=0;X<$;X++)if(Y)Q[Z*$+X]=o1.encodeNormalizedInt(J[X],W);else Q[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?uV1(Z):H0.ComponentType.FLOAT),this.set("array",Z),this}getByteLength(){let Z=this.get("array");return Z?Z.byteLength:0}}H0.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};H0.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function uV1(Z){switch(Z.constructor){case Float32Array:return H0.ComponentType.FLOAT;case Uint32Array:return H0.ComponentType.UNSIGNED_INT;case Uint16Array:return H0.ComponentType.UNSIGNED_SHORT;case Uint8Array:return H0.ComponentType.UNSIGNED_BYTE;case Int16Array:return H0.ComponentType.SHORT;case Int8Array:return H0.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class HP extends Q6{init(){this.propertyType=l.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new w0,samplers:new w0})}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 FG extends Q6{init(){this.propertyType=l.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)}}FG.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class cW extends Q6{init(){this.propertyType=l.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:cW.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:M5.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:M5.OTHER})}}cW.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class qP extends Q6{init(){this.propertyType=l.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(Z){return this.set("uri",Z)}}class VG extends Q6{init(){this.propertyType=l.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:VG.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)}}VG.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class f1 extends WU{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}f1.EXTENSION_NAME=void 0;class U1 extends Q6{init(){this.propertyType=l.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:U1.WrapMode.REPEAT,wrapT:U1.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)}}U1.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};U1.MagFilter={NEAREST:9728,LINEAR:9729};U1.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:rq,G:tq,B:eq,A:cV1}=R5;class HG extends Q6{init(){this.propertyType=l.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:HG.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new U1(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new U1(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new U1(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new U1(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new U1(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:rq|tq|eq|cV1,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:rq|tq|eq,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:rq|tq|eq})}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:rq})}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:tq|eq})}}HG.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class UP extends Q6{init(){this.propertyType=l.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new w0})}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 wP extends Q6{init(){this.propertyType=l.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 w0})}copy(Z,J=BZ){if(J===BZ)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 o1.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 o1.decompose(Z,J,Y,$),this.set("translation",J).set("rotation",Y).set("scale",$)}getWorldTranslation(){let Z=[0,0,0];return o1.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return o1.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return o1.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())hV1(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===l.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===l.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 OZ extends Q6{init(){this.propertyType=l.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:OZ.Mode.TRIANGLES,material:null,indices:null,attributes:new d1,targets:new w0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:M5.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:M5.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)}}OZ.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class Hl extends WU{init(){this.propertyType=l.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new d1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:M5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function JU(){return JU=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},JU.apply(null,arguments)}class LP extends Q6{init(){this.propertyType=l.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new w0})}copy(Z,J=BZ){if(J===BZ)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 BP extends Q6{init(){this.propertyType=l.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new w0})}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:M5.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class OP extends Q6{init(){this.propertyType=l.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||v9.extensionToMimeType(GG.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=v9.extensionToMimeType(GG.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",W6.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return v9.getSize(Z,this.getMimeType())}}class QU extends Q6{init(){this.propertyType=l.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${IV1}`,version:"2.0"},defaultScene:null,accessors:new w0,animations:new w0,buffers:new w0,cameras:new w0,materials:new w0,meshes:new w0,nodes:new w0,scenes:new w0,skins:new w0,textures:new w0})}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=BZ){if(J===BZ)throw new Error("Root cannot be copied.");this.set("asset",JU({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(JU({},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 LP)this.addRef("scenes",Z);else if(Z instanceof wP)this.addRef("nodes",Z);else if(Z instanceof VG)this.addRef("cameras",Z);else if(Z instanceof BP)this.addRef("skins",Z);else if(Z instanceof UP)this.addRef("meshes",Z);else if(Z instanceof HG)this.addRef("materials",Z);else if(Z instanceof OP)this.addRef("textures",Z);else if(Z instanceof HP)this.addRef("animations",Z);else if(Z instanceof H0)this.addRef("accessors",Z);else if(Z instanceof qP)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 YU{static fromGraph(Z){return YU._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new IW,this._root=new QU(this._graph),this._logger=w4.DEFAULT_INSTANCE,YU._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 LP(this._graph,Z)}createNode(Z=""){return new wP(this._graph,Z)}createCamera(Z=""){return new VG(this._graph,Z)}createSkin(Z=""){return new BP(this._graph,Z)}createMesh(Z=""){return new UP(this._graph,Z)}createPrimitive(){return new OZ(this._graph)}createPrimitiveTarget(Z=""){return new Hl(this._graph,Z)}createMaterial(Z=""){return new HG(this._graph,Z)}createTexture(Z=""){return new OP(this._graph,Z)}createAnimation(Z=""){return new HP(this._graph,Z)}createAnimationChannel(Z=""){return new FG(this._graph,Z)}createAnimationSampler(Z=""){return new cW(this._graph,Z)}createAccessor(Z="",J=null){if(!J)J=this.getRoot().listBuffers()[0];return new H0(this._graph,Z).setBuffer(J)}createBuffer(Z=""){return new qP(this._graph,Z)}}YU._GRAPH_DOCUMENTS=new WeakMap;class R1{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,W=$.target;if(W instanceof f1&&W.extensionName===this.extensionName){if($.type==="node:create")this._addExtensionProperty(W);if($.type==="node:dispose")this._removeExtensionProperty(W)}};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}}R1.EXTENSION_NAME=void 0;var dQ6={logger:w4.DEFAULT_INSTANCE,extensions:[],dependencies:{}},uQ6=new Set([l.BUFFER,l.TEXTURE,l.MATERIAL,l.MESH,l.PRIMITIVE,l.NODE,l.SCENE]);var zG;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(zG||(zG={}));class MZ{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(),W=$.listBuffers().length,Q=$.listTextures().length;this.bufferURIGenerator=new zP(W>1,()=>Y.basename||"buffer"),this.imageURIGenerator=new zP(Q>1,(X)=>lV1(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 W={source:this.imageIndexMap.get(Z),sampler:this.samplerDefIndexMap.get($)},Q=JSON.stringify(W);if(!this.textureDefIndexMap.has(Q))this.textureDefIndexMap.set(Q,this.jsonDoc.json.textures.length),this.jsonDoc.json.textures.push(W);let X={index:this.textureDefIndexMap.get(Q)};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===WP.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 $=v9.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 W=`Resource URI "${Z}" already assigned to different data.`;if(!Y){this.logger.warn(W);return}throw new Error(W)}getAccessorUsage(Z){let J=this._accessorUsageMap.get(Z);if(J)return J;if(Z.getSparse())return M5.SPARSE;for(let Y of this._doc.getGraph().listParentEdges(Z)){let{usage:$}=Y.getAttributes();if($)return $;if(Y.getParent().propertyType!==l.ROOT)this.logger.warn(`Missing attribute ".usage" on edge, "${Y.getName()}".`)}return M5.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}}MZ.BufferViewTarget=zG;MZ.BufferViewUsage=M5;MZ.USAGE_TO_TARGET={[M5.ARRAY_BUFFER]:zG.ARRAY_BUFFER,[M5.ELEMENT_ARRAY_BUFFER]:zG.ELEMENT_ARRAY_BUFFER};class zP{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 lV1(Z,J){let Y=Z.getGraph().listParentEdges(J).find(($)=>$.getParent()!==Z.getRoot());return Y?Y.getName().replace(/texture$/i,""):""}var{UNSIGNED_INT:cQ6,UNSIGNED_SHORT:lQ6,UNSIGNED_BYTE:pQ6}=H0.ComponentType,iQ6=new Set([l.ACCESSOR,l.BUFFER,l.MATERIAL,l.MESH]);var Xl;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(Xl||(Xl={}));var Ul=163,wl=166;function pV1(){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 lW{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 sQ6=new Uint8Array([0]),j6=[171,75,84,88,32,50,48,187,13,10,26,10];function ql(Z){return new TextDecoder().decode(Z)}function XU(Z){let J=new Uint8Array(Z.buffer,Z.byteOffset,j6.length);if(J[0]!==j6[0]||J[1]!==j6[1]||J[2]!==j6[2]||J[3]!==j6[3]||J[4]!==j6[4]||J[5]!==j6[5]||J[6]!==j6[6]||J[7]!==j6[7]||J[8]!==j6[8]||J[9]!==j6[9]||J[10]!==j6[10]||J[11]!==j6[11])throw new Error("Missing KTX 2.0 identifier.");let Y=pV1(),$=17*Uint32Array.BYTES_PER_ELEMENT,W=new lW(Z,j6.length,$,!0);Y.vkFormat=W._nextUint32(),Y.typeSize=W._nextUint32(),Y.pixelWidth=W._nextUint32(),Y.pixelHeight=W._nextUint32(),Y.pixelDepth=W._nextUint32(),Y.layerCount=W._nextUint32(),Y.faceCount=W._nextUint32();let Q=W._nextUint32();Y.supercompressionScheme=W._nextUint32();let X=W._nextUint32(),K=W._nextUint32(),G=W._nextUint32(),z=W._nextUint32(),F=W._nextUint64(),V=W._nextUint64(),H=Q*3*8,q=new lW(Z,j6.length+$,H,!0);for(let i8=0;i8<Q;i8++)Y.levels.push({levelData:new Uint8Array(Z.buffer,Z.byteOffset+q._nextUint64(),q._nextUint64()),uncompressedByteLength:q._nextUint64()});let U=new lW(Z,X,K,!0);U._skip(4);let L=U._nextUint16(),w=U._nextUint16(),O=U._nextUint16(),R=U._nextUint16(),N=U._nextUint8(),P=U._nextUint8(),D=U._nextUint8(),j=U._nextUint8(),C=[U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8()],k=[U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8()],A={vendorId:L,descriptorType:w,versionNumber:O,colorModel:N,colorPrimaries:P,transferFunction:D,flags:j,texelBlockDimension:C,bytesPlane:k,samples:[]},v=6,x=4,d=(R/4-v)/x;for(let i8=0;i8<d;i8++){let J7={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(J7.channelType&64)J7.sampleLower=U._nextInt32(),J7.sampleUpper=U._nextInt32();else J7.sampleLower=U._nextUint32(),J7.sampleUpper=U._nextUint32();A.samples[i8]=J7}Y.dataFormatDescriptor.length=0,Y.dataFormatDescriptor.push(A);let h=new lW(Z,G,z,!0);while(h._offset<z){let i8=h._nextUint32(),J7=h._scan(i8),PV=ql(J7);if(Y.keyValue[PV]=h._nextUint8Array(i8-J7.byteLength-1),PV.match(/^ktx/i)){let fA=ql(Y.keyValue[PV]);Y.keyValue[PV]=fA.substring(0,fA.lastIndexOf("\x00"))}let N71=i8%4?4-i8%4:0;h._skip(N71)}if(V<=0)return Y;let u=new lW(Z,F,V,!0),W0=u._nextUint16(),U0=u._nextUint16(),B0=u._nextUint32(),y0=u._nextUint32(),B1=u._nextUint32(),B8=u._nextUint32(),O8=[];for(let i8=0;i8<Q;i8++)O8.push({imageFlags:u._nextUint32(),rgbSliceByteOffset:u._nextUint32(),rgbSliceByteLength:u._nextUint32(),alphaSliceByteOffset:u._nextUint32(),alphaSliceByteLength:u._nextUint32()});let O1=F+u._offset,O9=O1+B0,p8=O9+y0,Y4=p8+B1,M9=new Uint8Array(Z.buffer,Z.byteOffset+O1,B0),GW=new Uint8Array(Z.buffer,Z.byteOffset+O9,y0),zW=new Uint8Array(Z.buffer,Z.byteOffset+p8,B1),bJ=new Uint8Array(Z.buffer,Z.byteOffset+Y4,B8);return Y.globalData={endpointCount:W0,selectorCount:U0,imageDescs:O8,endpointsData:M9,selectorsData:GW,tablesData:zW,extendedData:bJ},Y}var jP="EXT_mesh_gpu_instancing",RP="EXT_meshopt_compression",iV1="EXT_texture_webp",nV1="EXT_texture_avif",Il="KHR_draco_mesh_compression",DP="KHR_lights_punctual",CP="KHR_materials_anisotropy",TP="KHR_materials_clearcoat",kP="KHR_materials_diffuse_transmission",EP="KHR_materials_dispersion",IP="KHR_materials_emissive_strength",vP="KHR_materials_ior",SP="KHR_materials_iridescence",_P="KHR_materials_pbrSpecularGlossiness",xP="KHR_materials_sheen",AP="KHR_materials_specular",hP="KHR_materials_transmission",fP="KHR_materials_unlit",yP="KHR_materials_volume",NY="KHR_materials_variants",aV1="KHR_mesh_quantization",sV1="KHR_texture_basisu",bP="KHR_texture_transform",KU="KHR_xmp_json_ld",NP="INSTANCE_ATTRIBUTE";class gP extends f1{init(){this.extensionName=jP,this.propertyType="InstancedMesh",this.parentTypes=[l.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new d1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:NP})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}gP.EXTENSION_NAME=jP;var KY=jP;class FU extends R1{constructor(...Z){super(...Z);this.extensionName=KY,this.provideTypes=[l.NODE],this.prewriteTypes=[l.ACCESSOR]}createInstancedMesh(){return new gP(this.document.getGraph())}read(Z){return(Z.jsonDoc.json.nodes||[]).forEach(($,W)=>{if(!$.extensions||!$.extensions[KY])return;let Q=$.extensions[KY],X=this.createInstancedMesh();for(let K in Q.attributes)X.setAttribute(K,Z.accessors[Q.attributes[K]]);Z.nodes[W].setExtension(KY,X)}),this}prewrite(Z){Z.accessorUsageGroupedByParent.add(NP);for(let J of this.properties)for(let Y of J.listAttributes())Z.addAccessorToUsageGroup(Y,NP);return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listNodes().forEach((Y)=>{let $=Y.getExtension(KY);if($){let W=Z.nodeIndexMap.get(Y),Q=J.json.nodes[W],X={attributes:{}};$.listSemantics().forEach((K)=>{let G=$.getAttribute(K);X.attributes[K]=Z.accessorIndexMap.get(G)}),Q.extensions=Q.extensions||{},Q.extensions[KY]=X}}),this}}FU.EXTENSION_NAME=KY;function B7(){return B7=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},B7.apply(null,arguments)}var LG;(function(Z){Z.QUANTIZE="quantize",Z.FILTER="filter"})(LG||(LG={}));var iW;(function(Z){Z.ATTRIBUTES="ATTRIBUTES",Z.TRIANGLES="TRIANGLES",Z.INDICES="INDICES"})(iW||(iW={}));var r1;(function(Z){Z.NONE="NONE",Z.OCTAHEDRAL="OCTAHEDRAL",Z.QUATERNION="QUATERNION",Z.EXPONENTIAL="EXPONENTIAL"})(r1||(r1={}));var{BYTE:oV1,SHORT:Ll,FLOAT:rV1}=H0.ComponentType,{encodeNormalizedInt:Bl,decodeNormalizedInt:PP}=o1;function tV1(Z,J,Y,$){let{filter:W,bits:Q}=$,X={array:Z.getArray(),byteStride:Z.getElementSize()*Z.getComponentSize(),componentType:Z.getComponentType(),normalized:Z.getNormalized()};if(Y!==iW.ATTRIBUTES)return X;if(W!==r1.NONE){let K=Z.getNormalized()?eV1(Z):new Float32Array(X.array);switch(W){case r1.EXPONENTIAL:X.byteStride=Z.getElementSize()*4,X.componentType=rV1,X.normalized=!1,X.array=J.encodeFilterExp(K,Z.getCount(),X.byteStride,Q);break;case r1.OCTAHEDRAL:X.byteStride=Q>8?8:4,X.componentType=Q>8?Ll:oV1,X.normalized=!0,K=Z.getElementSize()===3?JH1(K):K,X.array=J.encodeFilterOct(K,Z.getCount(),X.byteStride,Q);break;case r1.QUATERNION:X.byteStride=8,X.componentType=Ll,X.normalized=!0,X.array=J.encodeFilterQuat(K,Z.getCount(),X.byteStride,Q);break;default:throw new Error("Invalid filter.")}if(X.min=Z.getMin([]),X.max=Z.getMax([]),Z.getNormalized())X.min=X.min.map((G)=>PP(G,Z.getComponentType())),X.max=X.max.map((G)=>PP(G,Z.getComponentType()));if(X.normalized)X.min=X.min.map((G)=>Bl(G,X.componentType)),X.max=X.max.map((G)=>Bl(G,X.componentType))}else if(X.byteStride%4)X.array=ZH1(X.array,Z.getElementSize()),X.byteStride=X.array.byteLength/Z.getCount();return X}function eV1(Z){let J=Z.getComponentType(),Y=Z.getArray(),$=new Float32Array(Y.length);for(let W=0;W<Y.length;W++)$[W]=PP(Y[W],J);return $}function ZH1(Z,J){let $=W6.padNumber(Z.BYTES_PER_ELEMENT*J)/Z.BYTES_PER_ELEMENT,W=Z.length/J,Q=new Z.constructor(W*$);for(let X=0;X*J<Z.length;X++)for(let K=0;K<J;K++)Q[X*$+K]=Z[X*J+K];return Q}function JH1(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 YH1(Z,J){if(J===MZ.BufferViewUsage.ELEMENT_ARRAY_BUFFER)return Z.listParents().some(($)=>{return $ instanceof OZ&&$.getMode()===OZ.Mode.TRIANGLES})?iW.TRIANGLES:iW.INDICES;return iW.ATTRIBUTES}function $H1(Z,J){let Y=J.getGraph().listParentEdges(Z).filter(($)=>!($.getParent()instanceof QU));for(let $ of Y){let W=$.getName(),Q=$.getAttributes().key||"",X=$.getParent().propertyType===l.PRIMITIVE_TARGET;if(W==="indices")return{filter:r1.NONE};if(W==="attributes"){if(Q==="POSITION")return{filter:r1.NONE};if(Q==="TEXCOORD_0")return{filter:r1.NONE};if(Q.startsWith("JOINTS_"))return{filter:r1.NONE};if(Q.startsWith("WEIGHTS_"))return{filter:r1.NONE};if(Q==="NORMAL"||Q==="TANGENT")return X?{filter:r1.NONE}:{filter:r1.OCTAHEDRAL,bits:8}}if(W==="output"){let K=vl(Z);if(K==="rotation")return{filter:r1.QUATERNION,bits:16};if(K==="translation")return{filter:r1.EXPONENTIAL,bits:12};if(K==="scale")return{filter:r1.EXPONENTIAL,bits:12};return{filter:r1.NONE}}if(W==="input")return{filter:r1.NONE};if(W==="inverseBindMatrices")return{filter:r1.NONE}}return{filter:r1.NONE}}function vl(Z){for(let J of Z.listParents()){if(!(J instanceof cW))continue;for(let Y of J.listParents()){if(!(Y instanceof FG))continue;return Y.getTargetPath()}}return null}function WH1(Z){if(!Z.extensions||!Z.extensions[RP])return!1;return!!Z.extensions[RP].fallback}var D6=RP,Ol={method:LG.QUANTIZE};class OG extends R1{constructor(...Z){super(...Z);this.extensionName=D6,this.prereadTypes=[l.BUFFER,l.PRIMITIVE],this.prewriteTypes=[l.BUFFER,l.ACCESSOR],this.readDependencies=["meshopt.decoder"],this.writeDependencies=["meshopt.encoder"],this._decoder=null,this._decoderFallbackBufferMap=new Map,this._encoder=null,this._encoderOptions=Ol,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=B7({},Ol,Z),this}preread(Z,J){if(!this._decoder){if(!this.isRequired())return this;throw new Error(`[${D6}] Please install extension dependency, "meshopt.decoder".`)}if(!this._decoder.supported){if(!this.isRequired())return this;throw new Error(`[${D6}]: Missing WASM support.`)}if(J===l.BUFFER)this._prereadBuffers(Z);else if(J===l.PRIMITIVE)this._prereadPrimitives(Z);return this}_prereadBuffers(Z){let J=Z.jsonDoc;(J.json.bufferViews||[]).forEach(($,W)=>{if(!$.extensions||!$.extensions[D6])return;let Q=$.extensions[D6],X=Q.byteOffset||0,K=Q.byteLength||0,G=Q.count,z=Q.byteStride,F=new Uint8Array(G*z),V=J.json.buffers[Q.buffer],H=V.uri?J.resources[V.uri]:J.resources[FP],q=W6.toView(H,X,K);this._decoder.decodeGltfBuffer(F,G,z,q,Q.mode,Q.filter),Z.bufferViews[W]=F})}_prereadPrimitives(Z){let J=Z.jsonDoc;(J.json.bufferViews||[]).forEach(($)=>{if(!$.extensions||!$.extensions[D6])return;let W=$.extensions[D6],Q=Z.buffers[W.buffer],X=Z.buffers[$.buffer],K=J.json.buffers[$.buffer];if(WH1(K))this._decoderFallbackBufferMap.set(X,Q)})}read(Z){if(!this.isRequired())return this;for(let[J,Y]of this._decoderFallbackBufferMap){for(let $ of J.listParents())if($ instanceof H0)$.swap(J,Y);J.dispose()}return this}prewrite(Z,J){if(J===l.ACCESSOR)this._prewriteAccessors(Z);else if(J===l.BUFFER)this._prewriteBuffers(Z);return this}_prewriteAccessors(Z){let J=Z.jsonDoc.json,Y=this._encoder,$=this._encoderOptions,W=this.document.getGraph(),Q=this.document.createBuffer(),X=this.document.getRoot().listBuffers().indexOf(Q),K=1,G=new Map,z=(F)=>{for(let V of W.listParents(F)){if(V.propertyType===l.ROOT)continue;let H=G.get(F);if(H===void 0)G.set(F,H=K++);return H}return-1};this._encoderFallbackBuffer=Q,this._encoderBufferViews={},this._encoderBufferViewData={},this._encoderBufferViewAccessors={};for(let F of this.document.getRoot().listAccessors()){if(vl(F)==="weights")continue;if(F.getSparse())continue;let V=Z.getAccessorUsage(F),H=Z.accessorUsageGroupedByParent.has(V)?z(F):null,q=YH1(F,V),U=$.method===LG.FILTER?$H1(F,this.document):{filter:r1.NONE},L=tV1(F,Y,q,U),{array:w,byteStride:O}=L,R=F.getBuffer();if(!R)throw new Error(`${D6}: Missing buffer for accessor.`);let N=this.document.getRoot().listBuffers().indexOf(R),P=[V,H,q,U.filter,O,N].join(":"),D=this._encoderBufferViews[P],j=this._encoderBufferViewData[P],C=this._encoderBufferViewAccessors[P];if(!D||!j)C=this._encoderBufferViewAccessors[P]=[],j=this._encoderBufferViewData[P]=[],D=this._encoderBufferViews[P]={buffer:X,target:MZ.USAGE_TO_TARGET[V],byteOffset:0,byteLength:0,byteStride:V===MZ.BufferViewUsage.ARRAY_BUFFER?O:void 0,extensions:{[D6]:{buffer:N,byteOffset:0,byteLength:0,mode:q,filter:U.filter!==r1.NONE?U.filter:void 0,byteStride:O,count:0}}};let k=Z.createAccessorDef(F);if(k.componentType=L.componentType,k.normalized=L.normalized,k.byteOffset=D.byteLength,k.min&&L.min)k.min=L.min;if(k.max&&L.max)k.max=L.max;Z.accessorIndexMap.set(F,J.accessors.length),J.accessors.push(k),C.push(k),j.push(new Uint8Array(w.buffer,w.byteOffset,w.byteLength)),D.byteLength+=w.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],W=this._encoderBufferViewData[Y],Q=this.document.getRoot().listBuffers()[$.extensions[D6].buffer],X=Z.otherBufferViews.get(Q)||[],{count:K,byteStride:G,mode:z}=$.extensions[D6],F=W6.concat(W),V=J.encodeGltfBuffer(F,K,G,z),H=W6.pad(V);$.extensions[D6].byteLength=V.byteLength,W.length=0,W.push(H),X.push(H),Z.otherBufferViews.set(Q,X)}}write(Z){let J=0;for(let Q in this._encoderBufferViews){let X=this._encoderBufferViews[Q],K=this._encoderBufferViewData[Q][0],G=Z.otherBufferViewsIndexMap.get(K),z=this._encoderBufferViewAccessors[Q];for(let q of z)q.bufferView=G;let F=Z.jsonDoc.json.bufferViews[G],V=F.byteOffset||0;Object.assign(F,X),F.byteOffset=J;let H=F.extensions[D6];H.byteOffset=V,J+=W6.padNumber(X.byteLength)}let Y=this._encoderFallbackBuffer,$=Z.bufferIndexMap.get(Y),W=Z.jsonDoc.json.buffers[$];return W.byteLength=J,W.extensions={[D6]:{fallback:!0}},Y.dispose(),this}}OG.EXTENSION_NAME=D6;OG.EncoderMethod=LG;var qG=nV1;class Sl{match(Z){return Z.length>=12&&W6.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=Ml(J,0);if(!Y)return null;let $=Y.end;while(Y=Ml(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 VU extends R1{constructor(...Z){super(...Z);this.extensionName=qG,this.prereadTypes=[l.TEXTURE]}static register(){v9.registerFormat("image/avif",new Sl)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((Y)=>{if(Y.extensions&&Y.extensions[qG])Y.source=Y.extensions[qG].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((Q)=>{if(Q.source===$)Q.extensions=Q.extensions||{},Q.extensions[qG]={source:Q.source},delete Q.source})}}),this}}VU.EXTENSION_NAME=qG;function Ml(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:W6.decodeText(new Uint8Array(Z.buffer,Z.byteOffset+J+4,4)),start:J+8,end:J+Y}}var UG=iV1;class _l{match(Z){return Z.length>=12&&Z[8]===87&&Z[9]===69&&Z[10]===66&&Z[11]===80}getSize(Z){let J=W6.decodeText(Z.slice(0,4)),Y=W6.decodeText(Z.slice(8,12));if(J!=="RIFF"||Y!=="WEBP")return null;let $=new DataView(Z.buffer,Z.byteOffset),W=12;while(W<$.byteLength){let Q=W6.decodeText(new Uint8Array([$.getUint8(W),$.getUint8(W+1),$.getUint8(W+2),$.getUint8(W+3)])),X=$.getUint32(W+4,!0);if(Q==="VP8 "){let K=$.getInt16(W+14,!0)&16383,G=$.getInt16(W+16,!0)&16383;return[K,G]}else if(Q==="VP8L"){let K=$.getUint8(W+9),G=$.getUint8(W+10),z=$.getUint8(W+11),F=$.getUint8(W+12),V=1+((G&63)<<8|K),H=1+((F&15)<<10|z<<2|(G&192)>>6);return[V,H]}W+=8+X+X%2}return null}getChannels(Z){return 4}}class HU extends R1{constructor(...Z){super(...Z);this.extensionName=UG,this.prereadTypes=[l.TEXTURE]}static register(){v9.registerFormat("image/webp",new _l)}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((Q)=>{if(Q.source===$)Q.extensions=Q.extensions||{},Q.extensions[UG]={source:Q.source},delete Q.source})}}),this}}HU.EXTENSION_NAME=UG;var Rl=Il,E8,xl,Al;function QH1(Z,J){let Y=new E8.DecoderBuffer;try{if(Y.Init(J,J.length),Z.GetEncodedGeometryType(Y)!==E8.TRIANGULAR_MESH)throw new Error(`[${Rl}] Unknown geometry type.`);let W=new E8.Mesh;if(!Z.DecodeBufferToMesh(Y,W).ok()||W.ptr===0)throw new Error(`[${Rl}] Decoding failure.`);return W}finally{E8.destroy(Y)}}function XH1(Z,J){let $=J.num_faces()*3,W,Q;if(J.num_points()<=65534){let X=$*Uint16Array.BYTES_PER_ELEMENT;W=E8._malloc(X),Z.GetTrianglesUInt16Array(J,X,W),Q=new Uint16Array(E8.HEAPU16.buffer,W,$).slice()}else{let X=$*Uint32Array.BYTES_PER_ELEMENT;W=E8._malloc(X),Z.GetTrianglesUInt32Array(J,X,W),Q=new Uint32Array(E8.HEAPU32.buffer,W,$).slice()}return E8._free(W),Q}function KH1(Z,J,Y,$){let W=Al[$.componentType],Q=xl[$.componentType],X=Y.num_components(),G=J.num_points()*X,z=G*Q.BYTES_PER_ELEMENT,F=E8._malloc(z);Z.GetAttributeDataArrayForAllPoints(J,Y,W,z,F);let V=new Q(E8.HEAPF32.buffer,F,G).slice();return E8._free(F),V}function GH1(Z){E8=Z,xl={[H0.ComponentType.FLOAT]:Float32Array,[H0.ComponentType.UNSIGNED_INT]:Uint32Array,[H0.ComponentType.UNSIGNED_SHORT]:Uint16Array,[H0.ComponentType.UNSIGNED_BYTE]:Uint8Array,[H0.ComponentType.SHORT]:Int16Array,[H0.ComponentType.BYTE]:Int8Array},Al={[H0.ComponentType.FLOAT]:E8.DT_FLOAT32,[H0.ComponentType.UNSIGNED_INT]:E8.DT_UINT32,[H0.ComponentType.UNSIGNED_SHORT]:E8.DT_UINT16,[H0.ComponentType.UNSIGNED_BYTE]:E8.DT_UINT8,[H0.ComponentType.SHORT]:E8.DT_INT16,[H0.ComponentType.BYTE]:E8.DT_INT8}}var b5,BG;(function(Z){Z[Z.EDGEBREAKER=1]="EDGEBREAKER",Z[Z.SEQUENTIAL=0]="SEQUENTIAL"})(BG||(BG={}));var g5;(function(Z){Z.POSITION="POSITION",Z.NORMAL="NORMAL",Z.COLOR="COLOR",Z.TEX_COORD="TEX_COORD",Z.GENERIC="GENERIC"})(g5||(g5={}));var hl={[g5.POSITION]:14,[g5.NORMAL]:10,[g5.COLOR]:8,[g5.TEX_COORD]:12,[g5.GENERIC]:12},Nl={decodeSpeed:5,encodeSpeed:5,method:BG.EDGEBREAKER,quantizationBits:hl,quantizationVolume:"mesh"};function zH1(Z){b5=Z}function FH1(Z,J=Nl){let Y=B7({},Nl,J);Y.quantizationBits=B7({},hl,J.quantizationBits);let $=new b5.MeshBuilder,W=new b5.Mesh,Q=new b5.ExpertEncoder(W),X={},K=new b5.DracoInt8Array,G=Z.listTargets().length>0,z=!1;for(let L of Z.listSemantics()){let w=Z.getAttribute(L);if(w.getSparse()){z=!0;continue}let O=VH1(L),R=HH1($,w.getComponentType(),W,b5[O],w.getCount(),w.getElementSize(),w.getArray());if(R===-1)throw new Error(`Error compressing "${L}" attribute.`);if(X[L]=R,Y.quantizationVolume==="mesh"||L!=="POSITION")Q.SetAttributeQuantization(R,Y.quantizationBits[O]);else if(typeof Y.quantizationVolume==="object"){let{quantizationVolume:N}=Y,P=Math.max(N.max[0]-N.min[0],N.max[1]-N.min[1],N.max[2]-N.min[2]);Q.SetAttributeExplicitQuantization(R,Y.quantizationBits[O],w.getElementSize(),N.min,P)}else throw new Error("Invalid quantization volume state.")}let F=Z.getIndices();if(!F)throw new GU("Primitive must have indices.");if($.AddFacesToMesh(W,F.getCount()/3,F.getArray()),Q.SetSpeedOptions(Y.encodeSpeed,Y.decodeSpeed),Q.SetTrackEncodedProperties(!0),Y.method===BG.SEQUENTIAL||G||z)Q.SetEncodingMethod(b5.MESH_SEQUENTIAL_ENCODING);else Q.SetEncodingMethod(b5.MESH_EDGEBREAKER_ENCODING);let V=Q.EncodeToDracoBuffer(!(G||z),K);if(V<=0)throw new GU("Error applying Draco compression.");let H=new Uint8Array(V);for(let L=0;L<V;++L)H[L]=K.GetValue(L);let q=Q.GetNumberOfEncodedPoints(),U=Q.GetNumberOfEncodedFaces()*3;return b5.destroy(K),b5.destroy(W),b5.destroy($),b5.destroy(Q),{numVertices:q,numIndices:U,data:H,attributeIDs:X}}function VH1(Z){if(Z==="POSITION")return g5.POSITION;else if(Z==="NORMAL")return g5.NORMAL;else if(Z.startsWith("COLOR_"))return g5.COLOR;else if(Z.startsWith("TEXCOORD_"))return g5.TEX_COORD;return g5.GENERIC}function HH1(Z,J,Y,$,W,Q,X){switch(J){case H0.ComponentType.UNSIGNED_BYTE:return Z.AddUInt8Attribute(Y,$,W,Q,X);case H0.ComponentType.BYTE:return Z.AddInt8Attribute(Y,$,W,Q,X);case H0.ComponentType.UNSIGNED_SHORT:return Z.AddUInt16Attribute(Y,$,W,Q,X);case H0.ComponentType.SHORT:return Z.AddInt16Attribute(Y,$,W,Q,X);case H0.ComponentType.UNSIGNED_INT:return Z.AddUInt32Attribute(Y,$,W,Q,X);case H0.ComponentType.FLOAT:return Z.AddFloatAttribute(Y,$,W,Q,X);default:throw new Error(`Unexpected component type, "${J}".`)}}class GU extends Error{}var F8=Il;class MG extends R1{constructor(...Z){super(...Z);this.extensionName=F8,this.prereadTypes=[l.PRIMITIVE],this.prewriteTypes=[l.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,GH1(this._decoderModule);if(Z==="draco3d.encoder")this._encoderModule=J,zH1(this._encoderModule);return this}setEncoderOptions(Z){return this._encoderOptions=Z,this}preread(Z){if(!this._decoderModule)throw new Error(`[${F8}] Please install extension dependency, "draco3d.decoder".`);let J=this.document.getLogger(),Y=Z.jsonDoc,$=new Map;try{let W=Y.json.meshes||[];for(let Q of W)for(let X of Q.primitives){if(!X.extensions||!X.extensions[F8])continue;let K=X.extensions[F8],[G,z]=$.get(K.bufferView)||[];if(!z||!G){let F=Y.json.bufferViews[K.bufferView],V=Y.json.buffers[F.buffer],H=V.uri?Y.resources[V.uri]:Y.resources[FP],q=F.byteOffset||0,U=F.byteLength,L=W6.toView(H,q,U);G=new this._decoderModule.Decoder,z=QH1(G,L),$.set(K.bufferView,[G,z]),J.debug(`[${F8}] Decompressed ${L.byteLength} bytes.`)}for(let F in K.attributes){let V=Z.jsonDoc.json.accessors[X.attributes[F]],H=G.GetAttributeByUniqueId(z,K.attributes[F]),q=KH1(G,z,H,V);Z.accessors[X.attributes[F]].setArray(q)}if(X.indices!==void 0)Z.accessors[X.indices].setArray(XH1(G,z))}}finally{for(let[W,Q]of Array.from($.values()))this._decoderModule.destroy(W),this._decoderModule.destroy(Q)}return this}read(Z){return this}prewrite(Z,J){if(!this._encoderModule)throw new Error(`[${F8}] Please install extension dependency, "draco3d.encoder".`);let Y=this.document.getLogger();Y.debug(`[${F8}] Compression options: ${JSON.stringify(this._encoderOptions)}`);let $=qH1(this.document),W=new Map,Q="mesh";if(this._encoderOptions.quantizationVolume==="scene")if(this.document.getRoot().listScenes().length!==1)Y.warn(`[${F8}]: quantizationVolume=scene requires exactly 1 scene.`);else Q=Kl(this.document.getRoot().listScenes().pop());for(let X of Array.from($.keys())){let K=$.get(X);if(!K)throw new Error("Unexpected primitive.");if(W.has(K)){W.set(K,W.get(K));continue}let G=X.getIndices(),z=Z.jsonDoc.json.accessors,F;try{F=FH1(X,B7({},this._encoderOptions,{quantizationVolume:Q}))}catch(q){if(q instanceof GU){Y.warn(`[${F8}]: ${q.message} Skipping primitive compression.`);continue}throw q}W.set(K,F);let V=Z.createAccessorDef(G);if(V.count=F.numIndices,Z.accessorIndexMap.set(G,z.length),z.push(V),F.numVertices>65534&&H0.getComponentSize(V.componentType)<=2)V.componentType=H0.ComponentType.UNSIGNED_INT;else if(F.numVertices>254&&H0.getComponentSize(V.componentType)<=1)V.componentType=H0.ComponentType.UNSIGNED_SHORT;for(let q of X.listSemantics()){let U=X.getAttribute(q);if(F.attributeIDs[q]===void 0)continue;let L=Z.createAccessorDef(U);L.count=F.numVertices,Z.accessorIndexMap.set(U,z.length),z.push(L)}let H=X.getAttribute("POSITION").getBuffer()||this.document.getRoot().listBuffers()[0];if(!Z.otherBufferViews.has(H))Z.otherBufferViews.set(H,[]);Z.otherBufferViews.get(H).push(F.data)}return Y.debug(`[${F8}] Compressed ${$.size} primitives.`),Z.extensionData[F8]={primitiveHashMap:$,primitiveEncodingMap:W},this}write(Z){let J=Z.extensionData[F8];for(let Y of this.document.getRoot().listMeshes()){let $=Z.jsonDoc.json.meshes[Z.meshIndexMap.get(Y)];for(let W=0;W<Y.listPrimitives().length;W++){let Q=Y.listPrimitives()[W],X=$.primitives[W],K=J.primitiveHashMap.get(Q);if(!K)continue;let G=J.primitiveEncodingMap.get(K);if(!G)continue;X.extensions=X.extensions||{},X.extensions[F8]={bufferView:Z.otherBufferViewsIndexMap.get(G.data),attributes:G.attributeIDs}}}if(!J.primitiveHashMap.size){let Y=Z.jsonDoc.json;Y.extensionsUsed=(Y.extensionsUsed||[]).filter(($)=>$!==F8),Y.extensionsRequired=(Y.extensionsRequired||[]).filter(($)=>$!==F8)}return this}}MG.EXTENSION_NAME=F8;MG.EncoderMethod=BG;function qH1(Z){let J=Z.getLogger(),Y=new Set,$=new Set,W=0,Q=0;for(let V of Z.getRoot().listMeshes())for(let H of V.listPrimitives())if(!H.getIndices())$.add(H),W++;else if(H.getMode()!==OZ.Mode.TRIANGLES)$.add(H),Q++;else Y.add(H);if(W>0)J.warn(`[${F8}] Skipping Draco compression of ${W} non-indexed primitives.`);if(Q>0)J.warn(`[${F8}] Skipping Draco compression of ${Q} non-TRIANGLES primitives.`);let X=Z.getRoot().listAccessors(),K=new Map;for(let V=0;V<X.length;V++)K.set(X[V],V);let G=new Map,z=new Set,F=new Map;for(let V of Array.from(Y)){let H=Pl(V,K);if(z.has(H)){F.set(V,H);continue}if(G.has(V.getIndices())){let q=V.getIndices(),U=q.clone();K.set(U,Z.getRoot().listAccessors().length-1),V.swap(q,U)}for(let q of V.listAttributes())if(G.has(q)){let U=q.clone();K.set(U,Z.getRoot().listAccessors().length-1),V.swap(q,U)}H=Pl(V,K),z.add(H),F.set(V,H),G.set(V.getIndices(),H);for(let q of V.listAttributes())G.set(q,H)}for(let V of Array.from(G.keys())){let H=new Set(V.listParents().map((q)=>q.propertyType));if(H.size!==2||!H.has(l.PRIMITIVE)||!H.has(l.ROOT))throw new Error(`[${F8}] Compressed accessors must only be used as indices or vertex attributes.`)}for(let V of Array.from(Y)){let H=F.get(V),q=V.getIndices();if(G.get(q)!==H||V.listAttributes().some((U)=>G.get(U)!==H))throw new Error(`[${F8}] Draco primitives must share all, or no, accessors.`)}for(let V of Array.from($)){let H=V.getIndices();if(G.has(H)||V.listAttributes().some((q)=>G.has(q)))throw new Error(`[${F8}] Accessor cannot be shared by compressed and uncompressed primitives.`)}return F}function Pl(Z,J){let Y=[],$=Z.getIndices();Y.push(J.get($));for(let W of Z.listAttributes())Y.push(J.get(W));return Y.sort().join("|")}class nW extends f1{init(){this.extensionName=DP,this.propertyType="Light",this.parentTypes=[l.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{color:[1,1,1],intensity:1,type:nW.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)}}nW.EXTENSION_NAME=DP;nW.Type={POINT:"point",SPOT:"spot",DIRECTIONAL:"directional"};var L4=DP;class mP extends R1{constructor(...Z){super(...Z);this.extensionName=L4}createLight(Z=""){return new nW(this.document.getGraph(),Z)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[L4])return this;let W=(J.json.extensions[L4].lights||[]).map((Q)=>{var X,K;let G=this.createLight().setName(Q.name||"").setType(Q.type);if(Q.color!==void 0)G.setColor(Q.color);if(Q.intensity!==void 0)G.setIntensity(Q.intensity);if(Q.range!==void 0)G.setRange(Q.range);if(((X=Q.spot)==null?void 0:X.innerConeAngle)!==void 0)G.setInnerConeAngle(Q.spot.innerConeAngle);if(((K=Q.spot)==null?void 0:K.outerConeAngle)!==void 0)G.setOuterConeAngle(Q.spot.outerConeAngle);return G});return J.json.nodes.forEach((Q,X)=>{if(!Q.extensions||!Q.extensions[L4])return;let K=Q.extensions[L4];Z.nodes[X].setExtension(L4,W[K.light])}),this}write(Z){let J=Z.jsonDoc;if(this.properties.size===0)return this;let Y=[],$=new Map;for(let W of this.properties){let Q=W,X={type:Q.getType()};if(!o1.eq(Q.getColor(),[1,1,1]))X.color=Q.getColor();if(Q.getIntensity()!==1)X.intensity=Q.getIntensity();if(Q.getRange()!=null)X.range=Q.getRange();if(Q.getName())X.name=Q.getName();if(Q.getType()===nW.Type.SPOT)X.spot={innerConeAngle:Q.getInnerConeAngle(),outerConeAngle:Q.getOuterConeAngle()};Y.push(X),$.set(Q,Y.length-1)}return this.document.getRoot().listNodes().forEach((W)=>{let Q=W.getExtension(L4);if(Q){let X=Z.nodeIndexMap.get(W),K=J.json.nodes[X];K.extensions=K.extensions||{},K.extensions[L4]={light:$.get(Q)}}}),J.json.extensions=J.json.extensions||{},J.json.extensions[L4]={lights:Y},this}}mP.EXTENSION_NAME=L4;var{R:UH1,G:wH1,B:LH1}=R5;class dP extends f1{init(){this.extensionName=CP,this.propertyType="Anisotropy",this.parentTypes=[l.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{anisotropyStrength:0,anisotropyRotation:0,anisotropyTexture:null,anisotropyTextureInfo:new U1(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:UH1|wH1|LH1})}}dP.EXTENSION_NAME=CP;var GY=CP;class uP extends R1{constructor(...Z){super(...Z);this.extensionName=GY,this.prereadTypes=[l.MESH],this.prewriteTypes=[l.MESH]}createAnisotropy(){return new dP(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((W,Q)=>{if(W.extensions&&W.extensions[GY]){let X=this.createAnisotropy();Z.materials[Q].setExtension(GY,X);let K=W.extensions[GY];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(GY);if($){let W=Z.materialIndexMap.get(Y),Q=J.json.materials[W];Q.extensions=Q.extensions||{};let X=Q.extensions[GY]={};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}}uP.EXTENSION_NAME=GY;var{R:jl,G:Dl,B:BH1}=R5;class cP extends f1{init(){this.extensionName=TP,this.propertyType="Clearcoat",this.parentTypes=[l.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{clearcoatFactor:0,clearcoatTexture:null,clearcoatTextureInfo:new U1(this.graph,"clearcoatTextureInfo"),clearcoatRoughnessFactor:0,clearcoatRoughnessTexture:null,clearcoatRoughnessTextureInfo:new U1(this.graph,"clearcoatRoughnessTextureInfo"),clearcoatNormalScale:1,clearcoatNormalTexture:null,clearcoatNormalTextureInfo:new U1(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:jl})}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:Dl})}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:jl|Dl|BH1})}}cP.EXTENSION_NAME=TP;var zY=TP;class lP extends R1{constructor(...Z){super(...Z);this.extensionName=zY,this.prereadTypes=[l.MESH],this.prewriteTypes=[l.MESH]}createClearcoat(){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((W,Q)=>{if(W.extensions&&W.extensions[zY]){let X=this.createClearcoat();Z.materials[Q].setExtension(zY,X);let K=W.extensions[zY];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(zY);if($){let W=Z.materialIndexMap.get(Y),Q=J.json.materials[W];Q.extensions=Q.extensions||{};let X=Q.extensions[zY]={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}}lP.EXTENSION_NAME=zY;var{R:OH1,G:MH1,B:RH1,A:NH1}=R5;class pP extends f1{init(){this.extensionName=kP,this.propertyType="DiffuseTransmission",this.parentTypes=[l.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseTransmissionFactor:0,diffuseTransmissionTexture:null,diffuseTransmissionTextureInfo:new U1(this.graph,"diffuseTransmissionTextureInfo"),diffuseTransmissionColorFactor:[1,1,1],diffuseTransmissionColorTexture:null,diffuseTransmissionColorTextureInfo:new U1(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:NH1})}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:OH1|MH1|RH1})}}pP.EXTENSION_NAME=kP;var FY=kP;class iP extends R1{constructor(...Z){super(...Z);this.extensionName=FY}createDiffuseTransmission(){return new pP(this.document.getGraph())}read(Z){let J=Z.jsonDoc,Y=J.json.materials||[],$=J.json.textures||[];return Y.forEach((W,Q)=>{if(W.extensions&&W.extensions[FY]){let X=this.createDiffuseTransmission();Z.materials[Q].setExtension(FY,X);let K=W.extensions[FY];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(FY);if(!$)continue;let W=Z.materialIndexMap.get(Y),Q=J.json.materials[W];Q.extensions=Q.extensions||{};let X=Q.extensions[FY]={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}}iP.EXTENSION_NAME=FY;class nP extends f1{init(){this.extensionName=EP,this.propertyType="Dispersion",this.parentTypes=[l.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{dispersion:0})}getDispersion(){return this.get("dispersion")}setDispersion(Z){return this.set("dispersion",Z)}}nP.EXTENSION_NAME=EP;var VY=EP;class aP extends R1{constructor(...Z){super(...Z);this.extensionName=VY,this.prereadTypes=[l.MESH],this.prewriteTypes=[l.MESH]}createDispersion(){return new nP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){return(Z.jsonDoc.json.materials||[]).forEach(($,W)=>{if($.extensions&&$.extensions[VY]){let Q=this.createDispersion();Z.materials[W].setExtension(VY,Q);let X=$.extensions[VY];if(X.dispersion!==void 0)Q.setDispersion(X.dispersion)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{let $=Y.getExtension(VY);if($){let W=Z.materialIndexMap.get(Y),Q=J.json.materials[W];Q.extensions=Q.extensions||{},Q.extensions[VY]={dispersion:$.getDispersion()}}}),this}}aP.EXTENSION_NAME=VY;class sP extends f1{init(){this.extensionName=IP,this.propertyType="EmissiveStrength",this.parentTypes=[l.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{emissiveStrength:1})}getEmissiveStrength(){return this.get("emissiveStrength")}setEmissiveStrength(Z){return this.set("emissiveStrength",Z)}}sP.EXTENSION_NAME=IP;var HY=IP;class oP extends R1{constructor(...Z){super(...Z);this.extensionName=HY,this.prereadTypes=[l.MESH],this.prewriteTypes=[l.MESH]}createEmissiveStrength(){return new sP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){return(Z.jsonDoc.json.materials||[]).forEach(($,W)=>{if($.extensions&&$.extensions[HY]){let Q=this.createEmissiveStrength();Z.materials[W].setExtension(HY,Q);let X=$.extensions[HY];if(X.emissiveStrength!==void 0)Q.setEmissiveStrength(X.emissiveStrength)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{let $=Y.getExtension(HY);if($){let W=Z.materialIndexMap.get(Y),Q=J.json.materials[W];Q.extensions=Q.extensions||{},Q.extensions[HY]={emissiveStrength:$.getEmissiveStrength()}}}),this}}oP.EXTENSION_NAME=HY;class rP extends f1{init(){this.extensionName=vP,this.propertyType="IOR",this.parentTypes=[l.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{ior:1.5})}getIOR(){return this.get("ior")}setIOR(Z){return this.set("ior",Z)}}rP.EXTENSION_NAME=vP;var qY=vP;class qU extends R1{constructor(...Z){super(...Z);this.extensionName=qY,this.prereadTypes=[l.MESH],this.prewriteTypes=[l.MESH]}createIOR(){return new rP(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){return(Z.jsonDoc.json.materials||[]).forEach(($,W)=>{if($.extensions&&$.extensions[qY]){let Q=this.createIOR();Z.materials[W].setExtension(qY,Q);let X=$.extensions[qY];if(X.ior!==void 0)Q.setIOR(X.ior)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{let $=Y.getExtension(qY);if($){let W=Z.materialIndexMap.get(Y),Q=J.json.materials[W];Q.extensions=Q.extensions||{},Q.extensions[qY]={ior:$.getIOR()}}}),this}}qU.EXTENSION_NAME=qY;var{R:PH1,G:jH1}=R5;class tP extends f1{init(){this.extensionName=SP,this.propertyType="Iridescence",this.parentTypes=[l.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{iridescenceFactor:0,iridescenceTexture:null,iridescenceTextureInfo:new U1(this.graph,"iridescenceTextureInfo"),iridescenceIOR:1.3,iridescenceThicknessMinimum:100,iridescenceThicknessMaximum:400,iridescenceThicknessTexture:null,iridescenceThicknessTextureInfo:new U1(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:PH1})}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:jH1})}}tP.EXTENSION_NAME=SP;var UY=SP;class eP extends R1{constructor(...Z){super(...Z);this.extensionName=UY,this.prereadTypes=[l.MESH],this.prewriteTypes=[l.MESH]}createIridescence(){return new tP(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((W,Q)=>{if(W.extensions&&W.extensions[UY]){let X=this.createIridescence();Z.materials[Q].setExtension(UY,X);let K=W.extensions[UY];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(UY);if($){let W=Z.materialIndexMap.get(Y),Q=J.json.materials[W];Q.extensions=Q.extensions||{};let X=Q.extensions[UY]={};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}}eP.EXTENSION_NAME=UY;var{R:Cl,G:Tl,B:kl,A:El}=R5;class Zj extends f1{init(){this.extensionName=_P,this.propertyType="PBRSpecularGlossiness",this.parentTypes=[l.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseFactor:[1,1,1,1],diffuseTexture:null,diffuseTextureInfo:new U1(this.graph,"diffuseTextureInfo"),specularFactor:[1,1,1],glossinessFactor:1,specularGlossinessTexture:null,specularGlossinessTextureInfo:new U1(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:Cl|Tl|kl|El,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:Cl|Tl|kl|El})}}Zj.EXTENSION_NAME=_P;var wY=_P;class UU extends R1{constructor(...Z){super(...Z);this.extensionName=wY,this.prereadTypes=[l.MESH],this.prewriteTypes=[l.MESH]}createPBRSpecularGlossiness(){return new Zj(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((W,Q)=>{if(W.extensions&&W.extensions[wY]){let X=this.createPBRSpecularGlossiness();Z.materials[Q].setExtension(wY,X);let K=W.extensions[wY];if(K.diffuseFactor!==void 0)X.setDiffuseFactor(K.diffuseFactor);if(K.specularFactor!==void 0)X.setSpecularFactor(K.specularFactor);if(K.glossinessFactor!==void 0)X.setGlossinessFactor(K.glossinessFactor);if(K.diffuseTexture!==void 0){let G=K.diffuseTexture,z=Z.textures[$[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(wY);if($){let W=Z.materialIndexMap.get(Y),Q=J.json.materials[W];Q.extensions=Q.extensions||{};let X=Q.extensions[wY]={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}}UU.EXTENSION_NAME=wY;var{R:DH1,G:CH1,B:TH1,A:kH1}=R5;class Jj extends f1{init(){this.extensionName=xP,this.propertyType="Sheen",this.parentTypes=[l.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{sheenColorFactor:[0,0,0],sheenColorTexture:null,sheenColorTextureInfo:new U1(this.graph,"sheenColorTextureInfo"),sheenRoughnessFactor:0,sheenRoughnessTexture:null,sheenRoughnessTextureInfo:new U1(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:DH1|CH1|TH1,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:kH1})}}Jj.EXTENSION_NAME=xP;var LY=xP;class Yj extends R1{constructor(...Z){super(...Z);this.extensionName=LY,this.prereadTypes=[l.MESH],this.prewriteTypes=[l.MESH]}createSheen(){return new Jj(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((W,Q)=>{if(W.extensions&&W.extensions[LY]){let X=this.createSheen();Z.materials[Q].setExtension(LY,X);let K=W.extensions[LY];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(LY);if($){let W=Z.materialIndexMap.get(Y),Q=J.json.materials[W];Q.extensions=Q.extensions||{};let X=Q.extensions[LY]={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}}Yj.EXTENSION_NAME=LY;var{R:EH1,G:IH1,B:vH1,A:SH1}=R5;class $j extends f1{init(){this.extensionName=AP,this.propertyType="Specular",this.parentTypes=[l.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{specularFactor:1,specularTexture:null,specularTextureInfo:new U1(this.graph,"specularTextureInfo"),specularColorFactor:[1,1,1],specularColorTexture:null,specularColorTextureInfo:new U1(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:SH1})}getSpecularColorTexture(){return this.getRef("specularColorTexture")}getSpecularColorTextureInfo(){return this.getRef("specularColorTexture")?this.getRef("specularColorTextureInfo"):null}setSpecularColorTexture(Z){return this.setRef("specularColorTexture",Z,{channels:EH1|IH1|vH1,isColor:!0})}}$j.EXTENSION_NAME=AP;var BY=AP;class wU extends R1{constructor(...Z){super(...Z);this.extensionName=BY,this.prereadTypes=[l.MESH],this.prewriteTypes=[l.MESH]}createSpecular(){return new $j(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((W,Q)=>{if(W.extensions&&W.extensions[BY]){let X=this.createSpecular();Z.materials[Q].setExtension(BY,X);let K=W.extensions[BY];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(BY);if($){let W=Z.materialIndexMap.get(Y),Q=J.json.materials[W];Q.extensions=Q.extensions||{};let X=Q.extensions[BY]={};if($.getSpecularFactor()!==1)X.specularFactor=$.getSpecularFactor();if(!o1.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}}wU.EXTENSION_NAME=BY;var{R:_H1}=R5;class Wj extends f1{init(){this.extensionName=hP,this.propertyType="Transmission",this.parentTypes=[l.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{transmissionFactor:0,transmissionTexture:null,transmissionTextureInfo:new U1(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:_H1})}}Wj.EXTENSION_NAME=hP;var OY=hP;class Qj extends R1{constructor(...Z){super(...Z);this.extensionName=OY,this.prereadTypes=[l.MESH],this.prewriteTypes=[l.MESH]}createTransmission(){return new Wj(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((W,Q)=>{if(W.extensions&&W.extensions[OY]){let X=this.createTransmission();Z.materials[Q].setExtension(OY,X);let K=W.extensions[OY];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(OY);if($){let W=Z.materialIndexMap.get(Y),Q=J.json.materials[W];Q.extensions=Q.extensions||{};let X=Q.extensions[OY]={transmissionFactor:$.getTransmissionFactor()};if($.getTransmissionTexture()){let K=$.getTransmissionTexture(),G=$.getTransmissionTextureInfo();X.transmissionTexture=Z.createTextureInfoDef(K,G)}}}),this}}Qj.EXTENSION_NAME=OY;class Xj extends f1{init(){this.extensionName=fP,this.propertyType="Unlit",this.parentTypes=[l.MATERIAL]}}Xj.EXTENSION_NAME=fP;var pW=fP;class LU extends R1{constructor(...Z){super(...Z);this.extensionName=pW,this.prereadTypes=[l.MESH],this.prewriteTypes=[l.MESH]}createUnlit(){return new Xj(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[pW])Z.materials[$].setExtension(pW,this.createUnlit())}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((Y)=>{if(Y.getExtension(pW)){let $=Z.materialIndexMap.get(Y),W=J.json.materials[$];W.extensions=W.extensions||{},W.extensions[pW]={}}}),this}}LU.EXTENSION_NAME=pW;class Kj extends f1{init(){this.extensionName=NY,this.propertyType="Mapping",this.parentTypes=["MappingList"]}getDefaults(){return Object.assign(super.getDefaults(),{material:null,variants:new w0})}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")}}Kj.EXTENSION_NAME=NY;class Gj extends f1{init(){this.extensionName=NY,this.propertyType="MappingList",this.parentTypes=[l.PRIMITIVE]}getDefaults(){return Object.assign(super.getDefaults(),{mappings:new w0})}addMapping(Z){return this.addRef("mappings",Z)}removeMapping(Z){return this.removeRef("mappings",Z)}listMappings(){return this.listRefs("mappings")}}Gj.EXTENSION_NAME=NY;class zU extends f1{init(){this.extensionName=NY,this.propertyType="Variant",this.parentTypes=["MappingList"]}}zU.EXTENSION_NAME=NY;var B4=NY;class zj extends R1{constructor(...Z){super(...Z);this.extensionName=B4}createMappingList(){return new Gj(this.document.getGraph())}createVariant(Z=""){return new zU(this.document.getGraph(),Z)}createMapping(){return new Kj(this.document.getGraph())}listVariants(){return Array.from(this.properties).filter((Z)=>Z instanceof zU)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[B4])return this;let W=(J.json.extensions[B4].variants||[]).map((X)=>this.createVariant().setName(X.name||""));return(J.json.meshes||[]).forEach((X,K)=>{let G=Z.meshes[K];(X.primitives||[]).forEach((F,V)=>{if(!F.extensions||!F.extensions[B4])return;let H=this.createMappingList(),q=F.extensions[B4];for(let U of q.mappings){let L=this.createMapping();if(U.material!==void 0)L.setMaterial(Z.materials[U.material]);for(let w of U.variants||[])L.addVariant(W[w]);H.addMapping(L)}G.listPrimitives()[V].setExtension(B4,H)})}),this}write(Z){let J=Z.jsonDoc,Y=this.listVariants();if(!Y.length)return this;let $=[],W=new Map;for(let Q of Y)W.set(Q,$.length),$.push(Z.createPropertyDef(Q));for(let Q of this.document.getRoot().listMeshes()){let X=Z.meshIndexMap.get(Q);Q.listPrimitives().forEach((K,G)=>{let z=K.getExtension(B4);if(!z)return;let F=Z.jsonDoc.json.meshes[X].primitives[G],V=z.listMappings().map((H)=>{let q=Z.createPropertyDef(H),U=H.getMaterial();if(U)q.material=Z.materialIndexMap.get(U);return q.variants=H.listVariants().map((L)=>W.get(L)),q});F.extensions=F.extensions||{},F.extensions[B4]={mappings:V}})}return J.json.extensions=J.json.extensions||{},J.json.extensions[B4]={variants:$},this}}zj.EXTENSION_NAME=B4;var{G:xH1}=R5;class Fj extends f1{init(){this.extensionName=yP,this.propertyType="Volume",this.parentTypes=[l.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{thicknessFactor:0,thicknessTexture:null,thicknessTextureInfo:new U1(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:xH1})}getAttenuationDistance(){return this.get("attenuationDistance")}setAttenuationDistance(Z){return this.set("attenuationDistance",Z)}getAttenuationColor(){return this.get("attenuationColor")}setAttenuationColor(Z){return this.set("attenuationColor",Z)}}Fj.EXTENSION_NAME=yP;var MY=yP;class Vj extends R1{constructor(...Z){super(...Z);this.extensionName=MY,this.prereadTypes=[l.MESH],this.prewriteTypes=[l.MESH]}createVolume(){return new Fj(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((W,Q)=>{if(W.extensions&&W.extensions[MY]){let X=this.createVolume();Z.materials[Q].setExtension(MY,X);let K=W.extensions[MY];if(K.thicknessFactor!==void 0)X.setThicknessFactor(K.thicknessFactor);if(K.attenuationDistance!==void 0)X.setAttenuationDistance(K.attenuationDistance);if(K.attenuationColor!==void 0)X.setAttenuationColor(K.attenuationColor);if(K.thicknessTexture!==void 0){let G=K.thicknessTexture,z=Z.textures[$[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(MY);if($){let W=Z.materialIndexMap.get(Y),Q=J.json.materials[W];Q.extensions=Q.extensions||{};let X=Q.extensions[MY]={};if($.getThicknessFactor()>0)X.thicknessFactor=$.getThicknessFactor();if(Number.isFinite($.getAttenuationDistance()))X.attenuationDistance=$.getAttenuationDistance();if(!o1.eq($.getAttenuationColor(),[1,1,1]))X.attenuationColor=$.getAttenuationColor();if($.getThicknessTexture()){let K=$.getThicknessTexture(),G=$.getThicknessTextureInfo();X.thicknessTexture=Z.createTextureInfoDef(K,G)}}}),this}}Vj.EXTENSION_NAME=MY;var fl=aV1;class RG extends R1{constructor(...Z){super(...Z);this.extensionName=fl}read(Z){return this}write(Z){return this}}RG.EXTENSION_NAME=fl;var wG=sV1;class yl{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=XU(Z);return[J.pixelWidth,J.pixelHeight]}getChannels(Z){let Y=XU(Z).dataFormatDescriptor[0];if(Y.colorModel===Ul)return Y.samples.length===2&&(Y.samples[1].channelType&15)===15?4:3;else if(Y.colorModel===wl)return(Y.samples[0].channelType&15)===3?4:3;throw new Error(`Unexpected KTX2 colorModel, "${Y.colorModel}".`)}getVRAMByteLength(Z){let J=XU(Z),Y=this.getChannels(Z)>3,$=0;for(let W=0;W<J.levels.length;W++){let Q=J.levels[W];if(Q.uncompressedByteLength)$+=Q.uncompressedByteLength;else{let X=Math.max(1,Math.floor(J.pixelWidth/Math.pow(2,W))),K=Math.max(1,Math.floor(J.pixelHeight/Math.pow(2,W))),G=Y?16:8;$+=X/4*(K/4)*G}}return $}}class Hj extends R1{constructor(...Z){super(...Z);this.extensionName=wG,this.prereadTypes=[l.TEXTURE]}static register(){v9.registerFormat("image/ktx2",new yl)}preread(Z){return Z.jsonDoc.json.textures.forEach((J)=>{if(J.extensions&&J.extensions[wG]){let Y=J.extensions[wG];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((W)=>{if(W.source===$)W.extensions=W.extensions||{},W.extensions[wG]={source:W.source},delete W.source})}}),this}}Hj.EXTENSION_NAME=wG;class qj extends f1{init(){this.extensionName=bP,this.propertyType="Transform",this.parentTypes=[l.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)}}qj.EXTENSION_NAME=bP;var RY=bP;class Uj extends R1{constructor(...Z){super(...Z);this.extensionName=RY}createTransform(){return new qj(this.document.getGraph())}read(Z){for(let[J,Y]of Array.from(Z.textureInfos.entries())){if(!Y.extensions||!Y.extensions[RY])continue;let $=this.createTransform(),W=Y.extensions[RY];if(W.offset!==void 0)$.setOffset(W.offset);if(W.rotation!==void 0)$.setRotation(W.rotation);if(W.scale!==void 0)$.setScale(W.scale);if(W.texCoord!==void 0)$.setTexCoord(W.texCoord);J.setExtension(RY,$)}return this}write(Z){let J=Array.from(Z.textureInfoDefMap.entries());for(let[Y,$]of J){let W=Y.getExtension(RY);if(!W)continue;$.extensions=$.extensions||{};let Q={},X=o1.eq;if(!X(W.getOffset(),[0,0]))Q.offset=W.getOffset();if(W.getRotation()!==0)Q.rotation=W.getRotation();if(!X(W.getScale(),[1,1]))Q.scale=W.getScale();if(W.getTexCoord()!=null)Q.texCoord=W.getTexCoord();$.extensions[RY]=Q}return this}}Uj.EXTENSION_NAME=RY;var AH1=[l.ROOT,l.SCENE,l.NODE,l.MESH,l.MATERIAL,l.TEXTURE,l.ANIMATION];class wj extends f1{init(){this.extensionName=KU,this.propertyType="Packet",this.parentTypes=AH1}getDefaults(){return Object.assign(super.getDefaults(),{context:{},properties:{}})}getContext(){return this.get("context")}setContext(Z){return this.set("context",B7({},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=B7({},this.get("properties"));if(J)Y[Z]=J;else delete Y[Z];return this.set("properties",Y)}toJSONLD(){let Z=MP(this.get("context")),J=MP(this.get("properties"));return B7({"@context":Z},J)}fromJSONLD(Z){Z=MP(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(`${KU}: Missing context for term, "${Z}".`)}}wj.EXTENSION_NAME=KU;function MP(Z){return JSON.parse(JSON.stringify(Z))}var L7=KU;class Lj extends R1{constructor(...Z){super(...Z);this.extensionName=L7}createPacket(){return new wj(this.document.getGraph())}listPackets(){return Array.from(this.properties)}read(Z){var J;let Y=(J=Z.jsonDoc.json.extensions)==null?void 0:J[L7];if(!Y||!Y.packets)return this;let $=Z.jsonDoc.json,W=this.document.getRoot(),Q=Y.packets.map((G)=>this.createPacket().fromJSONLD(G)),X=[[$.asset],$.scenes,$.nodes,$.meshes,$.materials,$.images,$.animations],K=[[W],W.listScenes(),W.listNodes(),W.listMeshes(),W.listMaterials(),W.listTextures(),W.listAnimations()];for(let G=0;G<X.length;G++){let z=X[G]||[];for(let F=0;F<z.length;F++){let V=z[F];if(V.extensions&&V.extensions[L7]){let H=V.extensions[L7];K[G][F].setExtension(L7,Q[H.packet])}}}return this}write(Z){let{json:J}=Z.jsonDoc,Y=[];for(let $ of this.properties){Y.push($.toJSONLD());for(let W of $.listParents()){let Q;switch(W.propertyType){case l.ROOT:Q=J.asset;break;case l.SCENE:Q=J.scenes[Z.sceneIndexMap.get(W)];break;case l.NODE:Q=J.nodes[Z.nodeIndexMap.get(W)];break;case l.MESH:Q=J.meshes[Z.meshIndexMap.get(W)];break;case l.MATERIAL:Q=J.materials[Z.materialIndexMap.get(W)];break;case l.TEXTURE:Q=J.images[Z.imageIndexMap.get(W)];break;case l.ANIMATION:Q=J.animations[Z.animationIndexMap.get(W)];break;default:Q=null,this.document.getLogger().warn(`[${L7}]: Unsupported parent property, "${W.propertyType}"`);break}if(!Q)continue;Q.extensions=Q.extensions||{},Q.extensions[L7]={packet:Y.length-1}}}if(Y.length>0)J.extensions=J.extensions||{},J.extensions[L7]={packets:Y};return this}}Lj.EXTENSION_NAME=L7;var hH1=[MG,mP,uP,lP,iP,aP,oP,qU,eP,UU,wU,Yj,Qj,LU,zj,Vj,RG,Hj,Uj,Lj],eQ6=[FU,OG,VU,HU,...hH1];var fH1=i(_N(),1);function oW(){return oW=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},oW.apply(null,arguments)}var{POINTS:bl,LINES:BU,LINE_STRIP:yH1,LINE_LOOP:bH1,TRIANGLES:OU,TRIANGLE_STRIP:gH1,TRIANGLE_FAN:mH1}=G8.Mode;function jZ(Z,J){return Object.defineProperty(J,"name",{value:Z}),J}function O4(Z,J){let Y=oW({},Z);for(let $ in J)if(J[$]!==void 0)Y[$]=J[$];return Y}function Wp(Z){let J=Z.getIndices(),Y=Z.getAttribute("POSITION");switch(Z.getMode()){case G8.Mode.POINTS:return J?J.getCount():Y.getCount();case G8.Mode.LINES:return J?J.getCount()/2:Y.getCount()/2;case G8.Mode.LINE_LOOP:return J?J.getCount():Y.getCount();case G8.Mode.LINE_STRIP:return J?J.getCount()-1:Y.getCount()-1;case G8.Mode.TRIANGLES:return J?J.getCount()/3:Y.getCount()/3;case G8.Mode.TRIANGLE_STRIP:case G8.Mode.TRIANGLE_FAN:return J?J.getCount()-2:Y.getCount()-2;default:throw new Error("Unexpected mode: "+Z.getMode())}}var dH1=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function Rj(Z){return dH1.format(Z)}function uH1(Z,J,Y=2){let $=Z>J?"\u2013":"+",W="%";return $+(Math.abs(Z-J)/Z*100).toFixed(Y)+"%"}function jU(Z,J){return`${Rj(Z)} \u2192 ${Rj(J)} (${uH1(Z,J)})`}function kj(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 cH1(Z,J,Y){Z.swap(J,Y);for(let $ of Z.listTargets())$.swap(J,Y)}function lH1(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 O7(Z,J){return Z.createAccessor(J.getName()).setArray(J.getArray()).setType(J.getType()).setBuffer(J.getBuffer()).setNormalized(J.getNormalized()).setSparse(J.getSparse())}function pH1(Z,J=Z){let Y=Ej(Z,J);for(let $=0;$<Y.length;$++)Y[$]=$;return Y}function Ej(Z,J=Z){return J<=65534?new Uint16Array(Z):new Uint32Array(Z)}function iH1(Z){return Z.listParents().some((J)=>J.propertyType!==c.ROOT)}function Qp(Z){for(let J in Z)return!1;return!0}function Xp(Z){let J=Y6.fromGraph(Z.getGraph()),Y=Z.getMaterial(),$=J.getRoot().listMaterials().indexOf(Y),W=aH1[Z.getMode()],Q=!!Z.getIndices(),X=Z.listSemantics().sort().map((G)=>{let z=Z.getAttribute(G),F=z.getElementSize(),V=z.getComponentType();return`${G}:${F}:${V}`}).join("+"),K=Z.listTargets().map((G)=>{return G.listSemantics().sort().map((z)=>{let F=Z.getAttribute(z),V=F.getElementSize(),H=F.getComponentType();return`${z}:${V}:${H}`}).join("+")}).join("~");return`${$}|${W}|${Q}|${X}|${K}`}function nH1(Z){return Math.pow(2,Math.ceil(Math.log(Z)/Math.LN2))}var aH1={[bl]:bl,[BU]:BU,[yH1]:BU,[bH1]:BU,[OU]:OU,[gH1]:OU,[mH1]:OU},aW="center",gl={pivot:"center"};function Kp(Z=gl){let J=O4(gl,Z);return jZ(aW,(Y)=>{let $=Y.getLogger(),W=Y.getRoot(),Q=W.listAnimations().length>0||W.listSkins().length>0;Y.getRoot().listScenes().forEach((X,K)=>{$.debug(`${aW}: Scene ${K+1} / ${W.listScenes().length}.`);let G;if(typeof J.pivot==="string"){let F=CN(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(`${aW}: Pivot "${G.join(", ")}".`);let z=[-1*G[0],-1*G[1],-1*G[2]];if(Q){$.debug(`${aW}: Model contains animation or skin. Adding a wrapper node.`);let F=Y.createNode("Pivot").setTranslation(z);X.listChildren().forEach((V)=>F.addChild(V)),X.addChild(F)}else $.debug(`${aW}: Skipping wrapper, offsetting all root nodes.`),X.listChildren().forEach((F)=>{let V=F.getTranslation();F.setTranslation([V[0]+z[0],V[1]+z[1],V[2]+z[2]])})}),$.debug(`${aW}: Complete.`)})}function sH1(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((W)=>W instanceof xW)}function oH1(Z){let J=sH1(Z),Y=Z.getParentNode();if(!Y)return Z;Z.setMatrix(Z.getWorldMatrix()),Y.removeChild(Z);for(let $ of J)$.addChild(Z);return Z}var rW=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 rH1(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],V=J[9],H=J[10],q=J[11],U=J[12],L=J[13],w=J[14],O=J[15],R=Y*K-$*X,N=Y*G-W*X,P=Y*z-Q*X,D=$*G-W*K,j=$*z-Q*K,C=W*z-Q*G,k=F*L-V*U,I=F*w-H*U,A=F*O-q*U,v=V*w-H*L,x=V*O-q*L,d=H*O-q*w,h=R*d-N*x+P*v+D*A-j*I+C*k;if(!h)return null;return h=1/h,Z[0]=(K*d-G*x+z*v)*h,Z[1]=(W*x-$*d-Q*v)*h,Z[2]=(L*C-w*j+O*D)*h,Z[3]=(H*j-V*C-q*D)*h,Z[4]=(G*A-X*d-z*I)*h,Z[5]=(Y*d-W*A+Q*I)*h,Z[6]=(w*P-U*C-O*N)*h,Z[7]=(F*C-H*P+q*N)*h,Z[8]=(X*x-K*A+z*k)*h,Z[9]=($*A-Y*x-Q*k)*h,Z[10]=(U*j-L*P+O*R)*h,Z[11]=(V*P-F*j-q*R)*h,Z[12]=(K*I-X*v-G*k)*h,Z[13]=(Y*v-$*I+W*k)*h,Z[14]=(L*N-U*D-w*R)*h,Z[15]=(F*D-V*N+H*R)*h,Z}function tH1(Z){var J=Z[0],Y=Z[1],$=Z[2],W=Z[3],Q=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],F=Z[9],V=Z[10],H=Z[11],q=Z[12],U=Z[13],L=Z[14],w=Z[15],O=J*X-Y*Q,R=J*K-$*Q,N=J*G-W*Q,P=Y*K-$*X,D=Y*G-W*X,j=$*G-W*K,C=z*U-F*q,k=z*L-V*q,I=z*w-H*q,A=F*L-V*U,v=F*w-H*U,x=V*w-H*L;return O*x-R*v+N*A+P*I-D*k+j*C}function Gp(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],V=J[8],H=J[9],q=J[10],U=J[11],L=J[12],w=J[13],O=J[14],R=J[15],N=Y[0],P=Y[1],D=Y[2],j=Y[3];return Z[0]=N*$+P*K+D*V+j*L,Z[1]=N*W+P*G+D*H+j*w,Z[2]=N*Q+P*z+D*q+j*O,Z[3]=N*X+P*F+D*U+j*R,N=Y[4],P=Y[5],D=Y[6],j=Y[7],Z[4]=N*$+P*K+D*V+j*L,Z[5]=N*W+P*G+D*H+j*w,Z[6]=N*Q+P*z+D*q+j*O,Z[7]=N*X+P*F+D*U+j*R,N=Y[8],P=Y[9],D=Y[10],j=Y[11],Z[8]=N*$+P*K+D*V+j*L,Z[9]=N*W+P*G+D*H+j*w,Z[10]=N*Q+P*z+D*q+j*O,Z[11]=N*X+P*F+D*U+j*R,N=Y[12],P=Y[13],D=Y[14],j=Y[15],Z[12]=N*$+P*K+D*V+j*L,Z[13]=N*W+P*G+D*H+j*w,Z[14]=N*Q+P*z+D*q+j*O,Z[15]=N*X+P*F+D*U+j*R,Z}function eH1(){var Z=new rW(9);if(rW!=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 Zq1(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 Jq1(Z,J){if(Z===J){var Y=J[1],$=J[2],W=J[5];Z[1]=J[3],Z[2]=J[6],Z[3]=Y,Z[5]=J[7],Z[6]=$,Z[7]=W}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 Yq1(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],V=F*X-K*z,H=-F*Q+K*G,q=z*Q-X*G,U=Y*V+$*H+W*q;if(!U)return null;return U=1/U,Z[0]=V*U,Z[1]=(-F*$+W*z)*U,Z[2]=(K*$-W*X)*U,Z[3]=H*U,Z[4]=(F*Y-W*G)*U,Z[5]=(-K*Y+W*Q)*U,Z[6]=q*U,Z[7]=(-z*Y+$*G)*U,Z[8]=(X*Y-$*Q)*U,Z}function DU(){var Z=new rW(3);if(rW!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function $q1(Z,J,Y){return Z[0]=J[0]*Y[0],Z[1]=J[1]*Y[1],Z[2]=J[2]*Y[2],Z}function zp(Z,J){var Y=J[0],$=J[1],W=J[2],Q=Y*Y+$*$+W*W;if(Q>0)Q=1/Math.sqrt(Q);return Z[0]=J[0]*Q,Z[1]=J[1]*Q,Z[2]=J[2]*Q,Z}function Wq1(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=Y[3]*$+Y[7]*W+Y[11]*Q+Y[15];return X=X||1,Z[0]=(Y[0]*$+Y[4]*W+Y[8]*Q+Y[12])/X,Z[1]=(Y[1]*$+Y[5]*W+Y[9]*Q+Y[13])/X,Z[2]=(Y[2]*$+Y[6]*W+Y[10]*Q+Y[14])/X,Z}function Qq1(Z,J,Y){var $=J[0],W=J[1],Q=J[2];return Z[0]=$*Y[0]+W*Y[3]+Q*Y[6],Z[1]=$*Y[1]+W*Y[4]+Q*Y[7],Z[2]=$*Y[2]+W*Y[5]+Q*Y[8],Z}var Xq1=$q1;(function(){var Z=DU();return function(J,Y,$,W,Q,X){var K,G;if(!Y)Y=3;if(!$)$=0;if(W)G=Math.min(W*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],Q(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}})();var NZ="dedup",Bj={keepUniqueNames:!1,propertyTypes:[c.ACCESSOR,c.MESH,c.TEXTURE,c.MATERIAL,c.SKIN]};function Fp(Z=Bj){let J=O4(Bj,Z),Y=new Set(J.propertyTypes);for(let $ of J.propertyTypes)if(!Bj.propertyTypes.includes($))throw new Error(`${NZ}: Unsupported deduplication on type "${$}".`);return jZ(NZ,($)=>{let W=$.getLogger();if(Y.has(c.ACCESSOR))Kq1($);if(Y.has(c.TEXTURE))zq1($,J);if(Y.has(c.MATERIAL))Fq1($,J);if(Y.has(c.MESH))Gq1($,J);if(Y.has(c.SKIN))Vq1($,J);W.debug(`${NZ}: Complete.`)})}function Kq1(Z){let J=Z.getLogger(),Y=new Map,$=new Map,W=new Map,Q=new Map,X=Z.getRoot().listMeshes();X.forEach((V)=>{V.listPrimitives().forEach((H)=>{H.listAttributes().forEach((q)=>K(q,$)),K(H.getIndices(),Y)})});for(let V of Z.getRoot().listAnimations())for(let H of V.listSamplers())K(H.getInput(),W),K(H.getOutput(),Q);function K(V,H){if(!V)return;let q=[V.getCount(),V.getType(),V.getComponentType(),V.getNormalized(),V.getSparse()].join(":"),U=H.get(q);if(!U)H.set(q,U=new Set);U.add(V)}function G(V,H){for(let q=0;q<V.length;q++){let U=V[q],L=m0.toView(U.getArray());if(H.has(U))continue;for(let w=q+1;w<V.length;w++){let O=V[w];if(H.has(O))continue;if(m0.equals(L,m0.toView(O.getArray())))H.set(O,U)}}}let z=0,F=new Map;for(let V of[$,Y,W,Q])for(let H of V.values())z+=H.size,G(Array.from(H),F);J.debug(`${NZ}: Merged ${F.size} of ${z} accessors.`),X.forEach((V)=>{V.listPrimitives().forEach((H)=>{H.listAttributes().forEach((U)=>{if(F.has(U))H.swap(U,F.get(U))});let q=H.getIndices();if(q&&F.has(q))H.swap(q,F.get(q))})});for(let V of Z.getRoot().listAnimations())for(let H of V.listSamplers()){let q=H.getInput(),U=H.getOutput();if(q&&F.has(q))H.swap(q,F.get(q));if(U&&F.has(U))H.swap(U,F.get(U))}Array.from(F.keys()).forEach((V)=>V.dispose())}function Gq1(Z,J){let Y=Z.getLogger(),$=Z.getRoot(),W=new Map;$.listAccessors().forEach((K,G)=>W.set(K,G)),$.listMaterials().forEach((K,G)=>W.set(K,G));let Q=$.listMeshes().length,X=new Map;for(let K of $.listMeshes()){let G=[];for(let F of K.listPrimitives())G.push(Vp(F,W));let z="";if(J.keepUniqueNames)z+=K.getName()+";";if(z+=G.join(";"),X.has(z)){let F=X.get(z);K.listParents().forEach((V)=>{if(V.propertyType!==c.ROOT)V.swap(K,F)}),K.dispose()}else X.set(z,K)}Y.debug(`${NZ}: Merged ${Q-X.size} of ${Q} meshes.`)}function zq1(Z,J){let Y=Z.getLogger(),$=Z.getRoot(),W=$.listTextures(),Q=new Map;for(let X=0;X<W.length;X++){let K=W[X],G=K.getImage();if(Q.has(K))continue;for(let z=X+1;z<W.length;z++){let F=W[z],V=F.getImage();if(Q.has(F))continue;if(K.getMimeType()!==F.getMimeType())continue;if(J.keepUniqueNames&&K.getName()!==F.getName())continue;let H=K.getSize(),q=F.getSize();if(!H||!q)continue;if(H[0]!==q[0])continue;if(H[1]!==q[1])continue;if(!G||!V)continue;if(m0.equals(G,V))Q.set(F,K)}}Y.debug(`${NZ}: Merged ${Q.size} of ${$.listTextures().length} textures.`),Array.from(Q.entries()).forEach(([X,K])=>{X.listParents().forEach((G)=>{if(!(G instanceof YY))G.swap(X,K)}),X.dispose()})}function Fq1(Z,J){let Y=Z.getLogger(),W=Z.getRoot().listMaterials(),Q=new Map,X=new Map,K=new Set;if(!J.keepUniqueNames)K.add("name");for(let G=0;G<W.length;G++){let z=W[G];if(Q.has(z))continue;if(ml(z,X))continue;for(let F=G+1;F<W.length;F++){let V=W[F];if(Q.has(V))continue;if(ml(V,X))continue;if(z.equals(V,K))Q.set(V,z)}}Y.debug(`${NZ}: Merged ${Q.size} of ${W.length} materials.`),Array.from(Q.entries()).forEach(([G,z])=>{G.listParents().forEach((F)=>{if(!(F instanceof YY))F.swap(G,z)}),G.dispose()})}function Vq1(Z,J){let Y=Z.getLogger(),W=Z.getRoot().listSkins(),Q=new Map,X=new Set(["joints"]);if(!J.keepUniqueNames)X.add("name");for(let K=0;K<W.length;K++){let G=W[K];if(Q.has(G))continue;for(let z=K+1;z<W.length;z++){let F=W[z];if(Q.has(F))continue;if(G.equals(F,X)&&lH1(G.listJoints(),F.listJoints()))Q.set(F,G)}}Y.debug(`${NZ}: Merged ${Q.size} of ${W.length} skins.`),Array.from(Q.entries()).forEach(([K,G])=>{K.listParents().forEach((z)=>{if(!(z instanceof YY))z.swap(K,G)}),K.dispose()})}function Vp(Z,J){let Y=[];for(let $ of Z.listSemantics()){let W=Z.getAttribute($);Y.push($+":"+J.get(W))}if(Z instanceof G8){let $=Z.getIndices();if($)Y.push("indices:"+J.get($));let W=Z.getMaterial();if(W)Y.push("material:"+J.get(W));Y.push("mode:"+Z.getMode());for(let Q of Z.listTargets())Y.push("target:"+Vp(Q,J))}return Y.join(",")}function ml(Z,J){if(J.has(Z))return J.get(Z);let Y=Z.getGraph(),$=new Set,W=Y.listParentEdges(Z);while(W.length>0){let Q=W.pop();if(Q.getAttributes().modifyChild===!0)return J.set(Z,!0),!0;let X=Q.getChild();if($.has(X))continue;for(let K of Y.listChildEdges(X))W.push(K)}return J.set(Z,!1),!1}function Hp(){var Z=new rW(4);if(rW!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function Hq1(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 qq1(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 Uq1(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 wq1(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 Lq1(Z){var J=Z[0],Y=Z[1],$=Z[2],W=Z[3];return Math.hypot(J,Y,$,W)}var qp=qq1,Bq1=Uq1,Up=Lq1;(function(){var Z=Hp();return function(J,Y,$,W,Q,X){var K,G;if(!Y)Y=4;if(!$)$=0;if(W)G=Math.min(W*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],Q(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 Oq1=/color|emissive|diffuse/i;function Mq1(Z){return Z.getGraph().listParentEdges(Z).some((W)=>{return W.getAttributes().isColor||Oq1.test(W.getName())})?"srgb":null}function Rq1(Z){let J=Z.getGraph(),Y=new Set,$=new Set;function W(Q){let X=new Set;for(let K of J.listChildEdges(Q))if(K.getChild()instanceof JY)X.add(K.getName()+"Info");for(let K of J.listChildEdges(Q)){let G=K.getChild();if(Y.has(G))continue;if(Y.add(G),G instanceof n6&&X.has(K.getName()))$.add(G);else if(G instanceof _W)W(G)}}return W(Z),Array.from($)}function Nq1(Z){let Y=Y6.fromGraph(Z.getGraph()).getRoot(),$=Z.getGraph().listParentEdges(Z).filter((W)=>W.getParent()!==Y).map((W)=>W.getName());return Array.from(new Set($))}var sW="prune",Nj=0.011764705882352941,dl={propertyTypes:[c.NODE,c.SKIN,c.MESH,c.CAMERA,c.PRIMITIVE,c.PRIMITIVE_TARGET,c.ANIMATION,c.MATERIAL,c.TEXTURE,c.ACCESSOR,c.BUFFER],keepLeaves:!1,keepAttributes:!1,keepIndices:!1,keepSolidTextures:!1,keepExtras:!1};function CU(Z=dl){let J=O4(dl,Z),Y=new Set(J.propertyTypes),$=J.keepExtras;return jZ(sW,async(W)=>{let Q=W.getLogger(),X=W.getRoot(),K=W.getGraph(),G=new wp,z=(F)=>G.dispose(F.target);if(K.addEventListener("node:dispose",z),Y.has(c.MESH))for(let F of X.listMeshes()){if(F.listPrimitives().length>0)continue;F.dispose()}if(Y.has(c.NODE)){if(!J.keepLeaves)for(let F of X.listScenes())Lp(K,F,$);for(let F of X.listNodes())m5(F,$)}if(Y.has(c.SKIN))for(let F of X.listSkins())m5(F,$);if(Y.has(c.MESH))for(let F of X.listMeshes())m5(F,$);if(Y.has(c.CAMERA))for(let F of X.listCameras())m5(F,$);if(Y.has(c.PRIMITIVE))ul(K,c.PRIMITIVE,$);if(Y.has(c.PRIMITIVE_TARGET))ul(K,c.PRIMITIVE_TARGET,$);if(!J.keepAttributes&&Y.has(c.ACCESSOR)){let F=new Map;for(let V of X.listMeshes())for(let H of V.listPrimitives()){let q=H.getMaterial();if(!q)continue;let U=Bp(W,H,q),L=jq1(H,U);cl(H,L),H.listTargets().forEach((w)=>cl(w,L)),F.has(q)?F.get(q).add(H):F.set(q,new Set([H]))}for(let[V,H]of F)Dq1(V,Array.from(H))}if(!J.keepIndices&&Y.has(c.ACCESSOR))for(let F of X.listMeshes())for(let V of F.listPrimitives())Pq1(V);if(Y.has(c.ANIMATION))for(let F of X.listAnimations()){for(let V of F.listChannels())if(!V.getTargetNode())V.dispose();if(!F.listChannels().length){let V=F.listSamplers();m5(F,$),V.forEach((H)=>m5(H,$))}else F.listSamplers().forEach((V)=>m5(V,$))}if(Y.has(c.MATERIAL))X.listMaterials().forEach((F)=>m5(F,$));if(Y.has(c.TEXTURE)){if(X.listTextures().forEach((F)=>m5(F,$)),!J.keepSolidTextures)await Cq1(W)}if(Y.has(c.ACCESSOR))X.listAccessors().forEach((F)=>m5(F,$));if(Y.has(c.BUFFER))X.listBuffers().forEach((F)=>m5(F,$));if(K.removeEventListener("node:dispose",z),!G.empty()){let F=G.entries().map(([V,H])=>`${V} (${H})`).join(", ");Q.info(`${sW}: Removed types... ${F}`)}else Q.debug(`${sW}: No unused properties found.`);Q.debug(`${sW}: Complete.`)})}class wp{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 m5(Z,J){let Y=Z.listParents().filter((W)=>!(W instanceof YY||W instanceof eJ)),$=J&&!Qp(Z.getExtras());if(!Y.length&&!$)Z.dispose()}function ul(Z,J,Y){for(let $ of Z.listEdges()){let W=$.getParent();if(W.propertyType===J)m5(W,Y)}}function Lp(Z,J,Y){if(J.listChildren().forEach((X)=>Lp(Z,X,Y)),J instanceof xW)return;let $=Z.listParentEdges(J).some((X)=>{let K=X.getParent().propertyType;return K!==c.ROOT&&K!==c.SCENE&&K!==c.NODE}),W=Z.listChildren(J).length===0,Q=Y&&!Qp(J.getExtras());if(W&&!$&&!Q)J.dispose()}function cl(Z,J){for(let Y of J)Z.setAttribute(Y,null)}function Pq1(Z){let J=Z.getIndices(),Y=J&&J.getArray(),$=Z.listAttributes()[0];if(!Y||!$)return;if(J.getCount()!==$.getCount())return;for(let W=0,Q=Y.length;W<Q;W++)if(W!==Y[W])return;Z.setIndices(null)}function jq1(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 Bp(Z,J,Y,$=new Set){let Q=Z.getGraph().listChildEdges(Y),X=new Set;for(let z of Q)if(z.getChild()instanceof JY)X.add(z.getName());for(let z of Q){let F=z.getName(),V=z.getChild();if(V instanceof n6){if(X.has(F.replace(/Info$/,"")))$.add(`TEXCOORD_${V.getTexCoord()}`)}if(V instanceof JY&&F.match(/normalTexture/i))$.add("TANGENT");if(V instanceof _W)Bp(Z,J,V,$)}let K=Y instanceof z4&&!Y.getExtension("KHR_materials_unlit"),G=J.getMode()===G8.Mode.POINTS;if(K&&!G)$.add("NORMAL");return $}function Dq1(Z,J){let Y=Rq1(Z),$=new Set(Y.map((G)=>G.getTexCoord())),W=Array.from($).sort(),Q=new Map(W.map((G,z)=>[G,z])),X=new Map(W.map((G,z)=>[`TEXCOORD_${G}`,`TEXCOORD_${z}`]));for(let G of Y){let z=G.getTexCoord();G.setTexCoord(Q.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 V=G.getAttribute(F);if(!V)continue;let H=X.get(F);if(H===F)continue;G.setAttribute(H,V),G.setAttribute(F,null)}}}async function Cq1(Z){let J=Z.getRoot(),Y=Z.getGraph(),$=Z.getLogger(),Q=J.listTextures().map(async(X)=>{var K;let G=await kq1(X);if(!G)return;if(Mq1(X)==="srgb")TN.convertSRGBToLinear(G,G);let z=X.getName()||X.getURI(),F=(K=X.getSize())==null?void 0:K.join("x"),V=Nq1(X);for(let H of Y.listParentEdges(X)){let q=H.getParent();if(q!==J&&Tq1(q,G,H.getName(),$))H.dispose()}if(X.listParents().length===1)X.dispose(),$.debug(`${sW}: Removed solid-color texture "${z}" (${F}px ${V.join(", ")})`)});await Promise.all(Q)}function Tq1(Z,J,Y,$){if(Z instanceof z4)switch(Y){case"baseColorTexture":return Z.setBaseColorFactor(Bq1(J,J,Z.getBaseColorFactor())),!0;case"emissiveTexture":return Z.setEmissiveFactor(Xq1([0,0,0],J.slice(0,3),Z.getEmissiveFactor())),!0;case"occlusionTexture":return Math.abs(J[0]-1)<=Nj;case"metallicRoughnessTexture":return Z.setRoughnessFactor(J[1]*Z.getRoughnessFactor()),Z.setMetallicFactor(J[2]*Z.getMetallicFactor()),!0;case"normalTexture":return Up(qp(Hp(),J,[0.5,0.5,1,1]))<=Nj}return $.warn(`${sW}: Detected single-color ${Y} texture. Pruning ${Y} not yet supported.`),!1}async function kq1(Z){let J=await Eq1(Z);if(!J)return null;let Y=[1/0,1/0,1/0,1/0],$=[-1/0,-1/0,-1/0,-1/0],W=[0,0,0,0],[Q,X]=J.shape;for(let K=0;K<Q;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(Up(qp(W,$,Y))/255>Nj)return null}return wq1(W,Hq1(W,$,Y),0.00196078431372549)}async function Eq1(Z){try{return await Yl(Z.getImage(),Z.getMimeType())}catch(J){return null}}var RZ=4294967295;class Op{constructor(Z){this.attributes=[],this.u8=void 0,this.u32=void 0;let J=0;for(let Y of kj(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(),W=m0.padNumber($);return this.attributes.push({u8:Y,byteStride:$,paddedByteStride:W}),W}hash(Z){let J=0;for(let{u8:Y,byteStride:$,paddedByteStride:W}of this.attributes){for(let Q=0;Q<W;Q++)if(Q<$)this.u8[J+Q]=Y[Z*$+Q];else this.u8[J+Q]=0;J+=W}return Iq1(0,this.u32)}equal(Z,J){for(let{u8:Y,byteStride:$}of this.attributes)for(let W=0;W<$;W++)if(Y[Z*$+W]!==Y[J*$+W])return!1;return!0}}function Iq1(Z,J){for(let W=0,Q=J.length;W<Q;W++){let X=J[W];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 vq1(Z,J,Y,$,W=RZ){let Q=J-1,K=Y.hash($)&Q;for(let G=0;G<=Q;G++){let z=Z[K];if(z===W||Y.equal(z,$))return K;K=K+G+1&Q}throw new Error("Hash table full.")}var s8;(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"})(s8||(s8={}));function PZ(Z,J){let Y=Z.getAttribute("POSITION"),$=Z.getIndices();switch(J){case s8.RENDER:return $?$.getCount():Y.getCount();case s8.RENDER_CACHED:return $?new Set($.getArray()).size:Y.getCount();case s8.UPLOAD_NAIVE:case s8.UPLOAD:return Y.getCount();case s8.DISTINCT:case s8.DISTINCT_POSITION:return Sq1(J);case s8.UNUSED:return $?Y.getCount()-new Set($.getArray()).size:0;default:return _q1(J)}}function Sq1(Z){throw new Error(`Not implemented: ${Z}`)}function _q1(Z){throw new Error(`Unexpected value: ${Z}`)}function PG(Z,J,Y){let $=Y6.fromGraph(Z.getGraph());if(!J||!Y)[J,Y]=xq1(Z);let W=Z.getIndices(),Q=W?W.getArray():null,X=PZ(Z,s8.RENDER),K=$.createAccessor(),G=X,z=Ej(G,Y);for(let V=0;V<G;V++)z[V]=J[Q?Q[V]:V];Z.setIndices(K.setArray(z));let F=kj(Z);for(let V of Z.listAttributes()){let H=O7($,V);Pj(V,W,J,H,Y),Z.swap(V,H)}for(let V of Z.listTargets())for(let H of V.listAttributes()){let q=O7($,H);Pj(H,W,J,q,Y),V.swap(H,q)}if(W&&W.listParents().length===1)W.dispose();for(let V of F)if(V.listParents().length===1)V.dispose();return Z}function Pj(Z,J,Y,$,W){let Q=Z.getElementSize(),X=Z.getArray(),K=J?J.getArray():null,G=J?J.getCount():Z.getCount(),z=new X.constructor(W*Q),F=new Uint8Array(W);for(let V=0;V<G;V++){let H=K?K[V]:V,q=Y[H];if(F[q])continue;for(let U=0;U<Q;U++)z[q*Q+U]=X[H*Q+U];F[q]=1}return $.setArray(z)}function xq1(Z){let J=PZ(Z,s8.UPLOAD),Y=Z.getIndices(),$=Y?Y.getArray():null;if(!Y||!$)return[pH1(J,1e6),J];let W=new Uint32Array(J).fill(RZ),Q=0;for(let X=0;X<$.length;X++){let K=$[X];if(W[K]===RZ)W[K]=Q++}return[W,Q]}var jj="weld",RU={overwrite:!0,cleanup:!0};function Ij(Z=RU){let J=O4(RU,Z);return jZ(jj,async(Y)=>{let $=Y.getLogger();for(let W of Y.getRoot().listMeshes()){for(let Q of W.listPrimitives())if(TU(Q,J),PZ(Q,s8.RENDER)===0)Q.dispose();if(W.listPrimitives().length===0)W.dispose()}if(J.cleanup)await Y.transform(CU({propertyTypes:[c.ACCESSOR,c.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),Fp({propertyTypes:[c.ACCESSOR]}));$.debug(`${jj}: Complete.`)})}function TU(Z,J=RU){let Y=Z.getGraph(),W=Y6.fromGraph(Y).getLogger(),Q=oW({},RU,J);if(Z.getIndices()&&!Q.overwrite)return;if(Z.getMode()===G8.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 Op(Z),V=nH1(X+X/4),H=new Uint32Array(V).fill(RZ),q=new Uint32Array(X).fill(RZ),U=0;for(let L=0;L<z;L++){let w=G?G[L]:L;if(q[w]!==RZ)continue;let O=vq1(H,V,F,w,RZ),R=H[O];if(R===RZ)H[O]=w,q[w]=U++;else q[w]=q[R]}W.debug(`${jj}: ${jU(X,U)} vertices.`),PG(Z,q,U)}var{FLOAT:Aq1}=N0.ComponentType;function Mp(Z,J){let Y=Z.getAttribute("POSITION");if(Y)ll(J,Y);let $=Z.getAttribute("NORMAL");if($)pl(J,$);let W=Z.getAttribute("TANGENT");if(W)il(J,W);for(let Q of Z.listTargets()){let X=Q.getAttribute("POSITION");if(X)ll(J,X);let K=Q.getAttribute("NORMAL");if(K)pl(J,K);let G=Q.getAttribute("TANGENT");if(G)il(J,G)}if(tH1(J)<0)hq1(Z)}function ll(Z,J){let Y=J.getComponentType(),$=J.getNormalized(),W=J.getArray(),Q=Y===Aq1?W:new Float32Array(W.length),X=DU();for(let K=0,G=J.getCount();K<G;K++){if($)X[0]=A0.decodeNormalizedInt(W[K*3],Y),X[1]=A0.decodeNormalizedInt(W[K*3+1],Y),X[2]=A0.decodeNormalizedInt(W[K*3+2],Y);else X[0]=W[K*3],X[1]=W[K*3+1],X[2]=W[K*3+2];Wq1(X,X,Z),Q[K*3]=X[0],Q[K*3+1]=X[1],Q[K*3+2]=X[2]}J.setArray(Q).setNormalized(!1)}function pl(Z,J){let Y=J.getArray(),$=J.getNormalized(),W=J.getComponentType(),Q=eH1();Zq1(Q,Z),Yq1(Q,Q),Jq1(Q,Q);let X=DU();for(let K=0,G=J.getCount();K<G;K++){if($)X[0]=A0.decodeNormalizedInt(Y[K*3],W),X[1]=A0.decodeNormalizedInt(Y[K*3+1],W),X[2]=A0.decodeNormalizedInt(Y[K*3+2],W);else X[0]=Y[K*3],X[1]=Y[K*3+1],X[2]=Y[K*3+2];if(Qq1(X,X,Q),zp(X,X),$)Y[K*3]=A0.decodeNormalizedInt(X[0],W),Y[K*3+1]=A0.decodeNormalizedInt(X[1],W),Y[K*3+2]=A0.decodeNormalizedInt(X[2],W);else Y[K*3]=X[0],Y[K*3+1]=X[1],Y[K*3+2]=X[2]}}function il(Z,J){let Y=J.getArray(),$=J.getNormalized(),W=J.getComponentType(),Q=DU();for(let X=0,K=J.getCount();X<K;X++){if($)Q[0]=A0.decodeNormalizedInt(Y[X*4],W),Q[1]=A0.decodeNormalizedInt(Y[X*4+1],W),Q[2]=A0.decodeNormalizedInt(Y[X*4+2],W);else Q[0]=Y[X*4],Q[1]=Y[X*4+1],Q[2]=Y[X*4+2];if(Q[0]=Z[0]*Q[0]+Z[4]*Q[1]+Z[8]*Q[2],Q[1]=Z[1]*Q[0]+Z[5]*Q[1]+Z[9]*Q[2],Q[2]=Z[2]*Q[0]+Z[6]*Q[1]+Z[10]*Q[2],zp(Q,Q),$)Y[X*4]=A0.decodeNormalizedInt(Q[0],W),Y[X*4+1]=A0.decodeNormalizedInt(Q[1],W),Y[X*4+2]=A0.decodeNormalizedInt(Q[2],W);else Y[X*4]=Q[0],Y[X*4+1]=Q[1],Y[X*4+2]=Q[2]}}function hq1(Z){if(Z.getMode()!==G8.Mode.TRIANGLES)return;if(!Z.getIndices())TU(Z);let J=Z.getIndices();for(let Y=0,$=J.getCount();Y<$;Y+=3){let W=J.getScalar(Y),Q=J.getScalar(Y+2);J.setScalar(Y,Q),J.setScalar(Y+2,W)}}function fq1(Z,J){for(let Y of Z.listPrimitives()){let $=yq1(Y,Z);if(Y!==$)Z.removePrimitive(Y).addPrimitive($)}for(let Y of Z.listPrimitives())PG(Y),Mp(Y,J)}function yq1(Z,J){if(Z.listParents().some(($)=>$ instanceof tK&&$!==J))Z=Z.clone();for(let $ of Z.listTargets())if($.listParents().some((Q)=>Q instanceof G8&&Q!==Z))Z.removeTarget($).addTarget($.clone());return Z}var nl=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function Rp(Z){let J=Z.getMesh(),Y=Z.getMatrix();if(J&&!A0.eq(Y,nl))fq1(J,Y);for(let $ of Z.listChildren()){let W=$.getMatrix();Gp(W,W,Y),$.setMatrix(W)}return Z.setMatrix(nl)}var{LINES:bq1,LINE_STRIP:gq1,LINE_LOOP:mq1,TRIANGLES:dq1,TRIANGLE_STRIP:uq1,TRIANGLE_FAN:cq1}=G8.Mode;function lq1(Z){let J=Z.getGraph(),Y=Y6.fromGraph(J);if(!Z.getIndices())TU(Z);let $=Z.getIndices(),W=$.getArray(),Q=Wp(Z),K=new VZ[$.getComponentType()](Q*2),G=Z.getMode();if(G===gq1)for(let F=0;F<Q;F++)K[F*2]=W[F],K[F*2+1]=W[F+1];else if(G===mq1)for(let F=0;F<Q;F++)if(F<Q-1)K[F*2]=W[F],K[F*2+1]=W[F+1];else K[F*2]=W[F],K[F*2+1]=W[0];else throw new Error("Only LINE_STRIP and LINE_LOOP may be converted to LINES.");Z.setMode(bq1);let z=Y.getRoot();if($.listParents().some((F)=>F!==z&&F!==Z))Z.setIndices(O7(Y,$).setArray(K));else $.setArray(K)}function Np(Z){let J=Z.getGraph(),Y=Y6.fromGraph(J);if(!Z.getIndices())TU(Z);let $=Z.getIndices(),W=$.getArray(),Q=Wp(Z),K=new VZ[$.getComponentType()](Q*3),G=Z.getMode();if(G===uq1)for(let F=0,V=W.length;F<V-2;F++)if(F%2)K[F*3]=W[F+1],K[F*3+1]=W[F],K[F*3+2]=W[F+2];else K[F*3]=W[F],K[F*3+1]=W[F+1],K[F*3+2]=W[F+2];else if(G===cq1)for(let F=0;F<Q;F++)K[F*3]=W[0],K[F*3+1]=W[F+1],K[F*3+2]=W[F+2];else throw new Error("Only TRIANGLE_STRIP and TRIANGLE_FAN may be converted to TRIANGLES.");Z.setMode(dq1);let z=Y.getRoot();if($.listParents().some((F)=>F!==z&&F!==Z))Z.setIndices(O7(Y,$).setArray(K));else $.setArray(K)}var al="dequantize",NU={pattern:/^((?!JOINTS_).)*$/};function Pp(Z=NU){let J=O4(NU,Z);return jZ(al,(Y)=>{let $=Y.getLogger();for(let W of Y.getRoot().listMeshes())for(let Q of W.listPrimitives())pq1(Q,J);Y.createExtension(RG).dispose(),$.debug(`${al}: Complete.`)})}function pq1(Z,J=NU){let Y=O4(NU,J);for(let $ of Z.listSemantics())if(Y.pattern.test($))Dj(Z.getAttribute($));for(let $ of Z.listTargets())for(let W of $.listSemantics())if(Y.pattern.test(W))Dj($.getAttribute(W))}function Dj(Z){let J=Z.getArray();if(!J)return;let Y=PU(J,Z.getComponentType(),Z.getNormalized());Z.setArray(Y).setNormalized(!1)}function PU(Z,J,Y){let $=new Float32Array(Z.length);for(let W=0,Q=Z.length;W<Q;W++)if(Y)$[W]=A0.decodeNormalizedInt(Z[W],J);else $[W]=Z[W];return $}var{TEXTURE_INFO:jp,ROOT:QX6}=c;function Dp(Z){let J=new Y6().setLogger(Z.getLogger()),Y=vj(J,Z);return iq1(J,Z,Y),J.getRoot().copy(Z.getRoot(),Y),J}function iq1(Z,J,Y){Y||(Y=vj(Z,J));for(let $ of J.getRoot().listExtensionsUsed()){let W=Z.createExtension($.constructor);if($.isRequired())W.setRequired(!0)}return nq1(Z,J,aq1(J),Y)}function nq1(Z,J,Y,$){$||($=vj(Z,J));let W=new Map;for(let Q of Y)if(!W.has(Q)&&Q.propertyType!==jp)W.set(Q,$(Q));for(let[Q,X]of W.entries())X.copy(Q,$);return W}function vj(Z,J){let Y=new Map([[J.getRoot(),Z.getRoot()]]);return($)=>{if($.propertyType===jp)return $;let W=Y.get($);if(!W)W=new $.constructor(Z.getGraph()),Y.set($,W);return W}}function aq1(Z){let J=new Set;for(let Y of Z.getGraph().listEdges())J.add(Y.getChild());return Array.from(J)}var Oj="flatten",sl={cleanup:!0};function Cp(Z=sl){let J=O4(sl,Z);return jZ(Oj,async(Y)=>{let $=Y.getRoot(),W=Y.getLogger(),Q=new Set;for(let z of $.listSkins())for(let F of z.listJoints())Q.add(F);let X=new Set;for(let z of $.listAnimations())for(let F of z.listChannels()){let V=F.getTargetNode();if(V&&F.getTargetPath()!=="weights")X.add(V)}let K=new Set,G=new Set;for(let z of $.listScenes())z.traverse((F)=>{let V=F.getParentNode();if(!V)return;if(Q.has(V)||K.has(V))K.add(F);if(X.has(V)||G.has(V))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;oH1(F)});if(X.size)W.debug(`${Oj}: Flattening node hierarchies with TRS animation not yet supported.`);if(J.cleanup)await Y.transform(CU({propertyTypes:[c.NODE],keepLeaves:!1}));W.debug(`${Oj}: Complete.`)})}function Tp(Z){return CN(Z)}var sq1={skipValidation:!1},ol=4294967295,{LINE_STRIP:oq1,LINE_LOOP:rq1,TRIANGLE_STRIP:tq1,TRIANGLE_FAN:eq1}=G8.Mode;function ZU1(Z,J={}){let Y=O4(sq1,J),$=Z[0],W=Y6.fromGraph($.getGraph());if(!Y.skipValidation&&new Set(Z.map(Xp)).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 oq1:case rq1:lq1(q);break;case tq1:case eq1:Np(q);break}let Q=[],X=new Uint32Array(Z.length),K=0,G=0;for(let q=0;q<Z.length;q++){let U=Z[q],L=U.getIndices(),w=U.getAttribute("POSITION").getCount(),O=L?L.getArray():null,R=L?L.getCount():w,N=new Uint32Array(w).fill(ol);for(let P=0;P<R;P++){let D=O?O[P]:P;if(N[D]===ol)N[D]=K++,X[q]++}Q.push(N),G+=R}let z=W.createPrimitive().setMode($.getMode()).setMaterial($.getMaterial());for(let q of $.listSemantics()){let U=$.getAttribute(q),L=VZ[U.getComponentType()],w=O7(W,U).setArray(new L(K*U.getElementSize()));z.setAttribute(q,w)}let F=$.getIndices(),V=F?O7(W,F).setArray(Ej(G,K)):null;z.setIndices(V);let H=0;for(let q=0;q<Q.length;q++){let U=Z[q],L=U.getIndices(),w=L?L.getCount():-1,O=Q[q];if(L&&V)YU1(L,O,V,H),H+=w;for(let R of z.listSemantics()){let N=U.getAttribute(R),P=z.getAttribute(R);JU1(N,L,O,P)}}return z}function JU1(Z,J,Y,$){let W=Z.getElementSize(),Q=J?J.getArray():null,X=Z.getCount(),K=Z.getArray(),G=$.getArray(),z=new Uint8Array(Z.getCount());for(let F=0,V=J?J.getCount():X;F<V;F++){let H=Q?Q[F]:F,q=Y[H];if(z[q])continue;for(let U=0;U<W;U++)G[q*W+U]=K[H*W+U];z[q]=1}}function YU1(Z,J,Y,$){let W=Z.getCount(),Q=Z.getArray(),X=Y.getArray();for(let K=0;K<W;K++){let G=Q[K],z=J[G];X[$+K]=z}}var Cj="join",{ROOT:$U1,NODE:WU1,MESH:QU1,PRIMITIVE:XU1,ACCESSOR:KU1}=c,Mj=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],rl={keepMeshes:!1,keepNamed:!1,cleanup:!0};function kp(Z=rl){let J=O4(rl,Z);return jZ(Cj,async(Y)=>{let $=Y.getRoot(),W=Y.getLogger();for(let Q of $.listScenes())tl(Y,Q,J),Q.traverse((X)=>tl(Y,X,J));if(J.cleanup)await Y.transform(CU({propertyTypes:[WU1,QU1,XU1,KU1],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}));W.debug(`${Cj}: Complete.`)})}function tl(Z,J,Y){let $=Z.getLogger(),W={},Q=J.listChildren();for(let G=0;G<Q.length;G++){let z=Q[G];if(z.listParents().some((H)=>H instanceof eJ))continue;let V=z.getMesh();if(!V)continue;if(z.getExtension("EXT_mesh_gpu_instancing"))continue;if(z.getSkin())continue;for(let H of V.listPrimitives()){if(H.listTargets().length>0)continue;let q=H.getMaterial();if(q&&q.getExtension("KHR_materials_volume"))continue;PG(H),zU1(H);let U=Xp(H),L=V.getName()||z.getName();if(Y.keepMeshes||Y.keepNamed&&L)U+=`|${G}`;if(!(U in W))W[U]={prims:[],primMeshes:[],primNodes:[],dstNode:z,dstMesh:void 0};let w=W[U];w.prims.push(H),w.primNodes.push(z)}}let X=Object.values(W).filter(({prims:G})=>G.length>1),K=new Set(X.flatMap((G)=>G.primNodes));for(let G of K){let z=G.getMesh();if(z.listParents().some((V)=>{return V.propertyType!==$U1&&G!==V}))G.setMesh(z.clone())}for(let G of X){let{dstNode:z,primNodes:F}=G;G.dstMesh=z.getMesh(),G.primMeshes=F.map((V)=>V.getMesh())}for(let G of X){let{prims:z,primNodes:F,primMeshes:V,dstNode:H,dstMesh:q}=G,U=H.getMatrix();for(let O=0;O<z.length;O++){let R=F[O],N=V[O],P=z[O];if(N.removePrimitive(P),iH1(P))P=z[O]=GU1(z[O]);if(R!==H)Gp(Mj,rH1(Mj,U),R.getMatrix()),Mp(P,Mj)}let L=ZU1(z),w=L.listAttributes()[0].getCount();q.addPrimitive(L),$.debug(`${Cj}: Joined Primitives (${z.length}) containing ${Rj(w)} vertices under Node "${H.getName()}".`)}}function GU1(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 zU1(Z){for(let J of["POSITION","NORMAL","TANGENT"]){let Y=Z.getAttribute(J);if(Y)Dj(Y)}}var{TRANSLATION:XX6,ROTATION:KX6,SCALE:GX6,WEIGHTS:zX6}=eJ.TargetPath;var FU1={pattern:/.*/,quantizationVolume:"mesh",quantizePosition:14,quantizeNormal:10,quantizeTexcoord:12,quantizeColor:8,quantizeWeight:8,quantizeGeneric:12,normalizeWeights:!0,cleanup:!0};var FX6=oW({level:"high"},FU1);var VU1="unweld";function HU1(Z,J=new Map){let Y=Z.getIndices();if(!Y)return;let $=Z.getGraph(),W=Y6.fromGraph($),Q=W.getLogger(),X=Z.getAttribute("POSITION").getCount();for(let G of Z.listAttributes())if(Z.swap(G,el(W,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,el(W,z,Y,J)),z.listParents().length===1)z.dispose();let K=Z.getAttribute("POSITION").getCount();if(Q.debug(`${VU1}: ${jU(X,K)} vertices.`),Z.setIndices(null),Y.listParents().length===1)Y.dispose()}function el(Z,J,Y,$){if($.has(J)&&$.get(J).has(Y))return $.get(J).get(Y);let W=J.getArray(),X=new W.constructor(Y.getCount()*J.getElementSize()),K=Y.getArray(),G=J.getElementSize();for(let F=0,V=Y.getCount();F<V;F++)for(let H=0;H<G;H++)X[F*G+H]=W[K[F]*G+H];if(!$.has(J))$.set(J,new Map);let z=O7(Z,J).setArray(X);return $.get(J).set(Y,z),z}var Zp;(function(Z){Z[Z.STEP=0]="STEP",Z[Z.LERP=1]="LERP",Z[Z.SLERP=2]="SLERP"})(Zp||(Zp={}));var qU1=0.000001;function UU1(Z,J,Y,$=0.0001){let W=J.length/Z.length,Q=new Array(W).fill(0),X=new Array(W).fill(0),K=new Array(W).fill(0),G=new Array(W).fill(0),z=Z.length-1,F=1;for(let V=1;V<z;++V){let H=Z[F-1],q=Z[V],U=Z[V+1],L=(q-H)/(U-H),w=!1;if(q!==U&&(V!==1||q!==Z[0])){if(NG(J,F-1,G),NG(J,V,X),NG(J,V+1,K),Y==="slerp"){let O=BU1(Q,G,K,L),R=Yp(G,X)+Yp(X,K);w=!MU(X,O,$)||R+Number.EPSILON>=Math.PI}else if(Y==="lerp"){let O=LU1(Q,G,K,L);w=!MU(X,O,$)}else if(Y==="step")w=!MU(X,G)||!MU(X,K)}if(w){if(V!==F)Z[F]=Z[V],Jp(J,F,NG(J,V,Q));F++}}if(z>0)Z[F]=Z[z],Jp(J,F,NG(J,z,Q)),F++;return F}function NG(Z,J,Y){for(let $=0,W=Y.length;$<W;$++)Y[$]=Z[J*W+$];return Y}function Jp(Z,J,Y){for(let $=0,W=Y.length;$<W;$++)Z[J*W+$]=Y[$]}function MU(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 wU1(Z,J,Y){return Z*(1-Y)+J*Y}function LU1(Z,J,Y,$){for(let W=0;W<J.length;W++)Z[W]=wU1(J[W],Y[W],$);return Z}function BU1(Z,J,Y,$){let W=J[0],Q=J[1],X=J[2],K=J[3],G=Y[0],z=Y[1],F=Y[2],V=Y[3],H,q,U,L,w;if(q=W*G+Q*z+X*F+K*V,q<0)q=-q,G=-G,z=-z,F=-F,V=-V;if(1-q>qU1)H=Math.acos(q),U=Math.sin(H),L=Math.sin((1-$)*H)/U,w=Math.sin($*H)/U;else L=1-$,w=$;return Z[0]=L*W+w*G,Z[1]=L*Q+w*z,Z[2]=L*X+w*F,Z[3]=L*K+w*V,Z}function Yp(Z,J){let Y=OU1(Z,J);return Math.acos(2*Y*Y-1)}function OU1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}var VX6=new Float32Array(0),HX6={ready:Promise.resolve(),resample:UU1,tolerance:0.0001,cleanup:!0};var PY="simplify",{POINTS:Ep,LINES:MU1,LINE_STRIP:RU1,LINE_LOOP:NU1,TRIANGLES:PU1,TRIANGLE_STRIP:Ip,TRIANGLE_FAN:vp}=G8.Mode,Sp={ratio:0,error:0.0001,lockBorder:!1,cleanup:!0};function _p(Z){let J=O4(Sp,Z),Y=J.simplifier;if(!Y)throw new Error(`${PY}: simplifier dependency required \u2014 install "meshoptimizer".`);return jZ(PY,async($)=>{let W=$.getLogger();await Y.ready,await $.transform(Ij({overwrite:!1,cleanup:J.cleanup}));let Q=0;for(let X of $.getRoot().listMeshes()){for(let K of X.listPrimitives()){let G=K.getMode();if(G===PU1||G===Ip||G===vp){if($p(K,J),PZ(K,s8.RENDER)===0)K.dispose()}else if(K.getMode()===Ep&&!!Y.simplifyPoints){if($p(K,J),PZ(K,s8.RENDER)===0)K.dispose()}else Q++}if(X.listPrimitives().length===0)X.dispose()}if(Q>0)W.warn(`${PY}: Skipping simplification of ${Q} primitives: Unsupported draw mode.`);if(J.cleanup)await $.transform(CU({propertyTypes:[c.ACCESSOR,c.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),Fp({propertyTypes:[c.ACCESSOR]}));W.debug(`${PY}: Complete.`)})}function $p(Z,J){let Y=oW({},Sp,J),$=Y.simplifier,W=Z.getGraph(),Q=Y6.fromGraph(W),X=Q.getLogger();switch(Z.getMode()){case Ep:return jU1(Q,Z,Y);case MU1:case RU1:case NU1:return X.warn(`${PY}: Skipping primitive simplification: Unsupported draw mode.`),Z;case Ip:case vp:Np(Z);break}let K=PZ(Z,s8.UPLOAD),G=PZ(Z,s8.RENDER);if(G<K/2)PG(Z);let z=Z.getAttribute("POSITION"),F=Z.getIndices(),V=z.getArray(),H=F.getArray();if(!(V instanceof Float32Array))V=PU(V,z.getComponentType(),z.getNormalized());if(!(H instanceof Uint32Array))H=new Uint32Array(H);let q=Math.floor(Y.ratio*G/3)*3,U=Y.lockBorder?["LockBorder"]:[],[L,w]=$.simplify(H,V,3,q,Y.error,U);if(Z.setIndices(O7(Q,F).setArray(L)),F.listParents().length===1)F.dispose();PG(Z);let O=PZ(Z,s8.UPLOAD);if(O<=65534)Z.getIndices().setArray(new Uint16Array(Z.getIndices().getArray()));return X.debug(`${PY}: ${jU(K,O)} vertices, error: ${w.toFixed(4)}.`),Z}function jU1(Z,J,Y){let $=Y.simplifier,W=Z.getLogger();if(J.getIndices())HU1(J);let X=J.getAttribute("POSITION"),K=J.getAttribute("COLOR_0"),G=X.getCount(),z=X.getArray(),F=K?K.getArray():void 0,V=K?K.getComponentSize():void 0;if(!(z instanceof Float32Array))z=PU(z,X.getComponentType(),X.getNormalized());if(F&&!(F instanceof Float32Array))F=PU(F,X.getComponentType(),X.getNormalized());$.useExperimentalFeatures=!0;let H=Math.floor(Y.ratio*G),q=$.simplifyPoints(z,3,H,F,V);$.useExperimentalFeatures=!1;let[U,L]=$.compactMesh(q);W.debug(`${PY}: ${jU(X.getCount(),L)} vertices.`);for(let w of kj(J)){let O=O7(Z,w);if(Pj(w,null,U,O,L),cH1(J,w,O),w.listParents().length===1)w.dispose()}return J}var Tj;(function(Z){Z.LANCZOS3="lanczos3",Z.LANCZOS2="lanczos2"})(Tj||(Tj={}));var qX6={resizeFilter:Tj.LANCZOS3,pattern:void 0,formats:void 0,slots:void 0,quality:void 0,effort:void 0,lossless:!1,nearLossless:!1,limitInputPixels:!0};var wX6=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(W(Z),{}).then(function(q){Y=q.instance,Y.exports.__wasm_call_ctors(),Y.exports.meshopt_encodeVertexVersion(0),Y.exports.meshopt_encodeIndexVersion(1)});function W(q){var U=new Uint8Array(q.length);for(var L=0;L<q.length;++L){var w=q.charCodeAt(L);U[L]=w>96?w-97:w>64?w-39:w+4}var O=0;for(var L=0;L<q.length;++L)U[O++]=U[L]<60?J[U[L]]:(U[L]-60)*64+U[++L];return U.buffer.slice(0,O)}function Q(q){if(!q)throw new Error("Assertion failed")}function X(q){return new Uint8Array(q.buffer,q.byteOffset,q.byteLength)}function K(q,U,L,w){var O=Y.exports.sbrk,R=O(U.length*4),N=O(L*4),P=new Uint8Array(Y.exports.memory.buffer),D=X(U);if(P.set(D,R),w)w(R,R,U.length,L);var j=q(N,R,U.length,L);P=new Uint8Array(Y.exports.memory.buffer);var C=new Uint32Array(L);new Uint8Array(C.buffer).set(P.subarray(N,N+L*4)),D.set(P.subarray(R,R+U.length*4)),O(R-O(0));for(var k=0;k<U.length;++k)U[k]=C[U[k]];return[C,j]}function G(q,U,L,w){var O=Y.exports.sbrk,R=O(L*4),N=O(L*w),P=new Uint8Array(Y.exports.memory.buffer);P.set(X(U),N),q(R,N,L,w),P=new Uint8Array(Y.exports.memory.buffer);var D=new Uint32Array(L);return new Uint8Array(D.buffer).set(P.subarray(R,R+L*4)),O(R-O(0)),D}function z(q,U,L,w,O){var R=Y.exports.sbrk,N=R(U),P=R(w*O),D=new Uint8Array(Y.exports.memory.buffer);D.set(X(L),P);var j=q(N,U,P,w,O),C=new Uint8Array(j);return C.set(D.subarray(N,N+j)),R(N-R(0)),C}function F(q){var U=0;for(var L=0;L<q.length;++L){var w=q[L];U=U<w?w:U}return U}function V(q,U){if(Q(U==2||U==4),U==4)return new Uint32Array(q.buffer,q.byteOffset,q.byteLength/4);else{var L=new Uint16Array(q.buffer,q.byteOffset,q.byteLength/2);return new Uint32Array(L)}}function H(q,U,L,w,O,R,N){var P=Y.exports.sbrk,D=P(L*w),j=P(L*R),C=new Uint8Array(Y.exports.memory.buffer);C.set(X(U),j),q(D,L,w,O,j,N);var k=new Uint8Array(L*w);return k.set(C.subarray(D,D+L*w)),P(D-P(0)),k}return{ready:$,supported:!0,reorderMesh:function(q,U,L){var w=U?L?Y.exports.meshopt_optimizeVertexCacheStrip:Y.exports.meshopt_optimizeVertexCache:void 0;return K(Y.exports.meshopt_optimizeVertexFetchRemap,q,F(q)+1,w)},reorderPoints:function(q,U){return Q(q instanceof Float32Array),Q(q.length%U==0),Q(U>=3),G(Y.exports.meshopt_spatialSortRemap,q,q.length/U,U*4)},encodeVertexBuffer:function(q,U,L){Q(L>0&&L<=256),Q(L%4==0);var w=Y.exports.meshopt_encodeVertexBufferBound(U,L);return z(Y.exports.meshopt_encodeVertexBuffer,w,q,U,L)},encodeIndexBuffer:function(q,U,L){Q(L==2||L==4),Q(U%3==0);var w=V(q,L),O=Y.exports.meshopt_encodeIndexBufferBound(U,F(w)+1);return z(Y.exports.meshopt_encodeIndexBuffer,O,w,U,4)},encodeIndexSequence:function(q,U,L){Q(L==2||L==4);var w=V(q,L),O=Y.exports.meshopt_encodeIndexSequenceBound(U,F(w)+1);return z(Y.exports.meshopt_encodeIndexSequence,O,w,U,4)},encodeGltfBuffer:function(q,U,L,w){var O={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return Q(O[w]),O[w](q,U,L)},encodeFilterOct:function(q,U,L,w){return Q(L==4||L==8),Q(w>=1&&w<=16),H(Y.exports.meshopt_encodeFilterOct,q,U,L,w,16)},encodeFilterQuat:function(q,U,L,w){return Q(L==8),Q(w>=4&&w<=16),H(Y.exports.meshopt_encodeFilterQuat,q,U,L,w,16)},encodeFilterExp:function(q,U,L,w,O){Q(L>0&&L%4==0),Q(w>=1&&w<=24);var R={Separate:0,SharedVector:1,SharedComponent:2,Clamped:3};return H(Y.exports.meshopt_encodeFilterExp,q,U,L,w,L,O?R[O]:1)}}}();var BX6=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 W=WebAssembly.validate(Y)?K(J):K(Z),Q,X=WebAssembly.instantiate(W,{}).then(function(O){Q=O.instance,Q.exports.__wasm_call_ctors()});function K(O){var R=new Uint8Array(O.length);for(var N=0;N<O.length;++N){var P=O.charCodeAt(N);R[N]=P>96?P-97:P>64?P-39:P+4}var D=0;for(var N=0;N<O.length;++N)R[D++]=R[N]<60?$[R[N]]:(R[N]-60)*64+R[++N];return R.buffer.slice(0,D)}function G(O,R,N,P,D,j,C){var k=O.exports.sbrk,I=P+3&-4,A=k(I*D),v=k(j.length),x=new Uint8Array(O.exports.memory.buffer);x.set(j,v);var d=R(A,P,D,v,j.length);if(d==0&&C)C(A,I,D);if(N.set(x.subarray(A,A+P*D)),k(A-k(0)),d!=0)throw new Error("Malformed buffer data: "+d)}var z={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},F={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},V=[],H=0;function q(O){var R={object:new Worker(O),pending:0,requests:{}};return R.object.onmessage=function(N){var P=N.data;R.pending-=P.count,R.requests[P.id][P.action](P.value),delete R.requests[P.id]},R}function U(O){var R="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(W)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+w.name+";"+G.toString()+w.toString(),N=new Blob([R],{type:"text/javascript"}),P=URL.createObjectURL(N);for(var D=V.length;D<O;++D)V[D]=q(P);for(var D=O;D<V.length;++D)V[D].object.postMessage({});V.length=O,URL.revokeObjectURL(P)}function L(O,R,N,P,D){var j=V[0];for(var C=1;C<V.length;++C)if(V[C].pending<j.pending)j=V[C];return new Promise(function(k,I){var A=new Uint8Array(N),v=++H;j.pending+=O,j.requests[v]={resolve:k,reject:I},j.object.postMessage({id:v,count:O,size:R,source:A,mode:P,filter:D},[A.buffer])})}function w(O){var R=O.data;if(!R.id)return self.close();self.ready.then(function(N){try{var P=new Uint8Array(R.count*R.size);G(N,N.exports[R.mode],P,R.count,R.size,R.source,N.exports[R.filter]),self.postMessage({id:R.id,count:R.count,action:"resolve",value:P},[P.buffer])}catch(D){self.postMessage({id:R.id,count:R.count,action:"reject",value:D})}})}return{ready:X,supported:!0,useWorkers:function(O){U(O)},decodeVertexBuffer:function(O,R,N,P,D){G(Q,Q.exports.meshopt_decodeVertexBuffer,O,R,N,P,Q.exports[z[D]])},decodeIndexBuffer:function(O,R,N,P){G(Q,Q.exports.meshopt_decodeIndexBuffer,O,R,N,P)},decodeIndexSequence:function(O,R,N,P){G(Q,Q.exports.meshopt_decodeIndexSequence,O,R,N,P)},decodeGltfBuffer:function(O,R,N,P,D,j){G(Q,Q.exports[F[D]],O,R,N,P,Q.exports[z[j]])},decodeGltfBufferAsync:function(O,R,N,P,D){if(V.length>0)return L(O,R,N,F[P],z[D]);return X.then(function(){var j=new Uint8Array(O*R);return G(Q,Q.exports[F[P]],j,O,R,N,Q.exports[z[D]]),j})}}}();var xp=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(W(Z),{}).then(function(U){Y=U.instance,Y.exports.__wasm_call_ctors()});function W(U){var L=new Uint8Array(U.length);for(var w=0;w<U.length;++w){var O=U.charCodeAt(w);L[w]=O>96?O-97:O>64?O-39:O+4}var R=0;for(var w=0;w<U.length;++w)L[R++]=L[w]<60?J[L[w]]:(L[w]-60)*64+L[++w];return L.buffer.slice(0,R)}function Q(U){if(!U)throw new Error("Assertion failed")}function X(U){return new Uint8Array(U.buffer,U.byteOffset,U.byteLength)}function K(U,L,w){var O=Y.exports.sbrk,R=O(L.length*4),N=O(w*4),P=new Uint8Array(Y.exports.memory.buffer),D=X(L);P.set(D,R);var j=U(N,R,L.length,w);P=new Uint8Array(Y.exports.memory.buffer);var C=new Uint32Array(w);new Uint8Array(C.buffer).set(P.subarray(N,N+w*4)),D.set(P.subarray(R,R+L.length*4)),O(R-O(0));for(var k=0;k<L.length;++k)L[k]=C[L[k]];return[C,j]}function G(U){var L=0;for(var w=0;w<U.length;++w){var O=U[w];L=L<O?O:L}return L}function z(U,L,w,O,R,N,P,D,j){var C=Y.exports.sbrk,k=C(4),I=C(w*4),A=C(R*N),v=C(w*4),x=new Uint8Array(Y.exports.memory.buffer);x.set(X(O),A),x.set(X(L),v);var d=U(I,v,w,A,R,N,P,D,j,k);x=new Uint8Array(Y.exports.memory.buffer);var h=new Uint32Array(d);X(h).set(x.subarray(I,I+d*4));var u=new Float32Array(1);return X(u).set(x.subarray(k,k+4)),C(k-C(0)),[h,u[0]]}function F(U,L,w,O,R,N,P,D,j,C,k,I,A){var v=Y.exports.sbrk,x=v(4),d=v(w*4),h=v(R*N),u=v(R*D),W0=v(j.length*4),U0=v(w*4),B0=C?v(R):0,y0=new Uint8Array(Y.exports.memory.buffer);if(y0.set(X(O),h),y0.set(X(P),u),y0.set(X(j),W0),y0.set(X(L),U0),C)y0.set(X(C),B0);var B1=U(d,U0,w,h,R,N,u,D,W0,j.length,B0,k,I,A,x);y0=new Uint8Array(Y.exports.memory.buffer);var B8=new Uint32Array(B1);X(B8).set(y0.subarray(d,d+B1*4));var O8=new Float32Array(1);return X(O8).set(y0.subarray(x,x+4)),v(x-v(0)),[B8,O8[0]]}function V(U,L,w,O){var R=Y.exports.sbrk,N=R(w*O),P=new Uint8Array(Y.exports.memory.buffer);P.set(X(L),N);var D=U(N,w,O);return R(N-R(0)),D}function H(U,L,w,O,R,N,P,D){var j=Y.exports.sbrk,C=j(D*4),k=j(w*O),I=j(w*N),A=new Uint8Array(Y.exports.memory.buffer);if(A.set(X(L),k),R)A.set(X(R),I);var v=U(C,k,w,O,I,N,P,D);A=new Uint8Array(Y.exports.memory.buffer);var x=new Uint32Array(v);return X(x).set(A.subarray(C,C+v*4)),j(C-j(0)),x}var q={LockBorder:1,Sparse:2,ErrorAbsolute:4,Prune:8,_InternalDebug:1073741824};return{ready:$,supported:!0,useExperimentalFeatures:!1,compactMesh:function(U){Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0);var L=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return K(Y.exports.meshopt_optimizeVertexFetchRemap,L,G(U)+1)},simplify:function(U,L,w,O,R,N){Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0),Q(L instanceof Float32Array),Q(L.length%w==0),Q(w>=3),Q(O>=0&&O<=U.length),Q(O%3==0),Q(R>=0);var P=0;for(var D=0;D<(N?N.length:0);++D)Q(N[D]in q),Q(this.useExperimentalFeatures||N[D]!="Prune"),P|=q[N[D]];var j=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),C=z(Y.exports.meshopt_simplify,j,U.length,L,L.length/w,w*4,O,R,P);return C[0]=U instanceof Uint32Array?C[0]:new U.constructor(C[0]),C},simplifyWithAttributes:function(U,L,w,O,R,N,P,D,j,C){Q(this.useExperimentalFeatures),Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0),Q(L instanceof Float32Array),Q(L.length%w==0),Q(w>=3),Q(O instanceof Float32Array),Q(O.length%R==0),Q(R>=0),Q(P==null||P instanceof Uint8Array),Q(P==null||P.length==L.length/w),Q(D>=0&&D<=U.length),Q(D%3==0),Q(j>=0),Q(Array.isArray(N)),Q(R>=N.length),Q(N.length<=32);for(var k=0;k<N.length;++k)Q(N[k]>=0);var I=0;for(var k=0;k<(C?C.length:0);++k)Q(C[k]in q),I|=q[C[k]];var A=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),v=F(Y.exports.meshopt_simplifyWithAttributes,A,U.length,L,L.length/w,w*4,O,R*4,new Float32Array(N),P?new Uint8Array(P):null,D,j,I);return v[0]=U instanceof Uint32Array?v[0]:new U.constructor(v[0]),v},getScale:function(U,L){return Q(U instanceof Float32Array),Q(U.length%L==0),Q(L>=3),V(Y.exports.meshopt_simplifyScale,U,U.length/L,L*4)},simplifyPoints:function(U,L,w,O,R,N){if(Q(this.useExperimentalFeatures),Q(U instanceof Float32Array),Q(U.length%L==0),Q(L>=3),Q(w>=0&&w<=U.length/L),O)return Q(O instanceof Float32Array),Q(O.length%R==0),Q(R>=3),Q(U.length/L==O.length/R),H(Y.exports.meshopt_simplifyPoints,U,U.length/L,L*4,O,R*4,N,w);else return H(Y.exports.meshopt_simplifyPoints,U,U.length/L,L*4,void 0,0,0,w)}}}();var RX6=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(W(Z),{}).then(function(U){Y=U.instance,Y.exports.__wasm_call_ctors()});function W(U){var L=new Uint8Array(U.length);for(var w=0;w<U.length;++w){var O=U.charCodeAt(w);L[w]=O>96?O-97:O>64?O-39:O+4}var R=0;for(var w=0;w<U.length;++w)L[R++]=L[w]<60?J[L[w]]:(L[w]-60)*64+L[++w];return L.buffer.slice(0,R)}function Q(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,L){var w=U.meshlets[L*4+0],O=U.meshlets[L*4+1],R=U.meshlets[L*4+2],N=U.meshlets[L*4+3];return{vertices:U.vertices.subarray(w,w+R),triangles:U.triangles.subarray(O,O+N*3)}}function F(U,L,w,O,R,N,P){var D=Y.exports.sbrk,j=Y.exports.meshopt_buildMeshletsBound(U.length,R,N),C=D(j*G),k=D(j*R*4),I=D(j*N*3),A=D(U.byteLength),v=D(L.byteLength),x=new Uint8Array(Y.exports.memory.buffer);x.set(X(U),A),x.set(X(L),v);var d=Y.exports.meshopt_buildMeshlets(C,k,I,A,U.length,v,w,O,R,N,P);x=new Uint8Array(Y.exports.memory.buffer);var h=x.subarray(C,C+d*G),u=new Uint32Array(h.buffer,h.byteOffset,h.byteLength/4).slice();for(var W0=0;W0<d;++W0){var U0=u[W0*4+0],B0=u[W0*4+1],w=u[W0*4+2],y0=u[W0*4+3];Y.exports.meshopt_optimizeMeshlet(k+U0*4,I+B0,y0,w)}var B1=u[(d-1)*4+0],B8=u[(d-1)*4+1],O8=u[(d-1)*4+2],O1=u[(d-1)*4+3],O9=B1+O8,p8=B8+(O1*3+3&-4),Y4={meshlets:u,vertices:new Uint32Array(x.buffer,k,O9).slice(),triangles:new Uint8Array(x.buffer,I,p8*3).slice(),meshletCount:d};return D(C-D(0)),Y4}function V(U){var L=new Float32Array(Y.exports.memory.buffer,U,K/4);return{centerX:L[0],centerY:L[1],centerZ:L[2],radius:L[3],coneApexX:L[4],coneApexY:L[5],coneApexZ:L[6],coneAxisX:L[7],coneAxisY:L[8],coneAxisZ:L[9],coneCutoff:L[10]}}function H(U,L,w,O){var R=Y.exports.sbrk,N=[],P=R(L.byteLength),D=R(U.vertices.byteLength),j=R(U.triangles.byteLength),C=R(K),k=new Uint8Array(Y.exports.memory.buffer);k.set(X(L),P),k.set(X(U.vertices),D),k.set(X(U.triangles),j);for(var I=0;I<U.meshletCount;++I){var A=U.meshlets[I*4+0],v=U.meshlets[I*4+0+1],x=U.meshlets[I*4+0+3];Y.exports.meshopt_computeMeshletBounds(C,D+A*4,j+v,x,P,w,O),N.push(V(C))}return R(P-R(0)),N}function q(U,L,w,O){var R=Y.exports.sbrk,N=R(K),P=R(U.byteLength),D=R(L.byteLength),j=new Uint8Array(Y.exports.memory.buffer);j.set(X(U),P),j.set(X(L),D),Y.exports.meshopt_computeClusterBounds(N,P,U.length,D,w,O);var C=V(N);return R(N-R(0)),C}return{ready:$,supported:!0,buildMeshlets:function(U,L,w,O,R,N){Q(U.length%3==0),Q(L instanceof Float32Array),Q(L.length%w==0),Q(w>=3),Q(O<=255||O>0),Q(R<=512),Q(R%4==0),N=N||0;var P=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return F(P,L,L.length/w,w*4,O,R,N)},computeClusterBounds:function(U,L,w){Q(U.length%3==0),Q(U.length/3<=512),Q(L instanceof Float32Array),Q(L.length%w==0),Q(w>=3);var O=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return q(O,L,L.length/w,w*4)},computeMeshletBounds:function(U,L,w){return Q(U.meshletCount!=0),Q(L instanceof Float32Array),Q(L.length%w==0),Q(w>=3),H(U,L,L.length/w,w*4)},extractMeshlet:function(U,L){return Q(L>=0&&L<U.meshletCount),z(U,L)}}}();var tW={OPTIMIZED_DIR:".optimized",CHECKSUM_EXT:".md5",DIRECTORIES:[M7.normalize("node_modules/@hytopia.com/assets"),M7.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 d5{static instance=new d5;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)f.fatalError(`ModelRegistry.getAnimationNames(): Model ${Z} not found!`);return J.getRoot().listAnimations().map(($)=>$.getName())}getBoundingBox(Z){let J=this._modelUriBoundingBoxes.get(Z);if(!J)f.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)f.fatalError(`ModelRegistry.getNodeNames(): Model ${Z} not found!`);return J}getTrimesh(Z,J=1){let Y=this._modelUriTrimeshes.get(Z);if(!Y){f.error(`ModelRegistry.getTrimesh(): Model ${Z} not found!`);return}let $=Y.vertices;if(J!==1){$=new Float32Array($.length);for(let W=0;W<$.length;W++)$[W]=Y.vertices[W]*J}return{vertices:$,indices:Y.indices}}modelHasNode(Z,J){let Y=this._modelUriNodeNames.get(Z);if(!Y)f.fatalError(`ModelRegistry.modelHasNode(): Model ${Z} not found!`);return Y.includes(J)}_absoluteModelPathToModelUri(Z){let J=M7.relative(process.cwd(),Z),Y=tW.DIRECTORIES.find((W)=>J.startsWith(W));return(Y?M7.relative(Y,J):J).split(M7.sep).join("/")}async _getAbsoluteModelPaths(){let Z=[],J=new CU1("**/*.{gltf,glb}");for(let Y of tW.DIRECTORIES){let $=M7.resolve(process.cwd(),Y);if(!DZ.existsSync($))continue;for await(let W of J.scan($))Z.push(M7.join($,W))}return Z}async _loadModelData(Z){let J=await new SN().read(Z),Y=Tp(J.getRoot().listScenes()[0]),$=J.getRoot().listNodes().map((Q)=>Q.getName()),W=this._absoluteModelPathToModelUri(Z);this._modelUriDocuments.set(W,J),this._modelUriBoundingBoxes.set(W,{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(W,$),this._modelUriTrimeshes.set(W,await this._buildTrimesh(W))}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(!DZ.existsSync(J))return!1;let Y=this._calculateChecksum(Z),$=DZ.readFileSync(J,"utf8");return Y===$}_calculateChecksum(Z){if(!DZ.existsSync(Z))return"";let J=DZ.readFileSync(Z);return DU1.createHash("sha256").update(J.toString("base64")).digest("hex")}_buildOptimizedModelPath(Z){let J=M7.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(!$)f.fatalError(`ModelRegistry._buildTrimesh(): Model ${Z} not found!`);let W=Dp($);W.setLogger(new a6(oK.WARN)),await W.transform(Kp({pivot:"center"}),Cp(),kp(),Ij(),_p({simplifier:xp,ratio:J,error:Y}),Pp());for(let z of W.getRoot().listScenes())for(let F of z.listChildren())Rp(F);let Q=W.getRoot().listMeshes()[0];if(!Q){f.error(`ModelRegistry._buildTrimesh(): Model ${Z} has no root mesh!`);return}let X=Q.listPrimitives()[0];if(!X){f.error(`ModelRegistry._buildTrimesh(): Model ${Z} has no root primitive!`);return}let K=X.getAttribute("POSITION"),G=X.getIndices();if(!K||!G){f.error(`ModelRegistry._buildTrimesh(): Model ${Z} missing required geometry data!`);return}return{vertices:K.getArray(),indices:G.getArray()}}async _optimizeModel(Z,J){let Y=M7.dirname(J);DZ.rmSync(Y,{recursive:!0,force:!0}),DZ.mkdirSync(Y,{recursive:!0}),console.log(`ModelRegistry: Optimizing model ${this._absoluteModelPathToModelUri(Z)}...`);for(let $ of tW.OPTIMIZER_RUNS){let W=J.replace(/(\.[^/.]+)$/,`${$.suffix}$1`),{stderr:Q}=await dm("bunx",["gltf-transform","optimize",Z,W,...$.options]);if(Q)return f.warning(`ModelRegistry._optimizeModel(): Error optimizing model ${this._absoluteModelPathToModelUri(Z)}, defaulting to unoptimized model. Error: ${Q}`),Z}return DZ.writeFileSync(`${J}${tW.CHECKSUM_EXT}`,this._calculateChecksum(Z)),J}}var jG;((W)=>{W.DYNAMIC="dynamic";W.FIXED="fixed";W.KINEMATIC_POSITION="kinematic_position";W.KINEMATIC_VELOCITY="kinematic_velocity"})(jG||={});var Sj=0.001,Ap="dynamic";class jY extends S0{_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??=Ap,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:W}=Z;this._rigidBody?this._rigidBody.setAdditionalMassProperties(J,Y,$,W,!this._explicitSleep):this._rigidBodyDesc.setAdditionalMassProperties(J,Y,$,W)}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"]:r0.RigidBodyType.Dynamic,["fixed"]:r0.RigidBodyType.Fixed,["kinematic_position"]:r0.RigidBodyType.KinematicPositionBased,["kinematic_velocity"]:r0.RigidBodyType.KinematicVelocityBased}[Z];if(Y===void 0)return f.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 f.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 N5({...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 f.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 f.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 f.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 N5(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??Ap;return{["dynamic"]:()=>r0.RigidBodyDesc.dynamic(),["fixed"]:()=>r0.RigidBodyDesc.fixed(),["kinematic_position"]:()=>r0.RigidBodyDesc.kinematicPositionBased(),["kinematic_velocity"]:()=>r0.RigidBodyDesc.kinematicVelocityBased()}[J]()}_requireCreated(Z){if(!this._rigidBody||!this._simulation)f.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)f.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)f.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)f.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)f.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)f.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)<Sj&&Math.abs(Z.y)<Sj&&Math.abs(Z.z)<Sj}}var _j;((W)=>{W[W.Average=0]="Average";W[W.Min=1]="Min";W[W.Multiply=2]="Multiply";W[W.Max=3]="Max"})(_j||={});var DG;((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"})(DG||={});class N5 extends S0{_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 $=d5.instance.getBoundingBox(Z),W=$.max.x-$.min.x,Q=$.max.y-$.min.y,X=$.max.z-$.min.z,K=Math.max(W,X),G=Math.min(W,X),z=K/G,F=K/Q,V=K*J/2,H=(R)=>Math.max(0.01,R),q=()=>({shape:"block",halfExtents:{x:H(W*J/2),y:H(Q*J/2),z:H(X*J/2)}}),U=()=>({shape:"round-cylinder",radius:H(V),halfHeight:H(Q*J/2),borderRadius:H(V*0.1)}),L=()=>{let R=d5.instance.getTrimesh(Z,J);if(!R)return;return{shape:"trimesh",vertices:R.vertices,indices:R.indices}},w=()=>({shape:"wedge",extents:{x:W*J,y:Q*J,z:X*J}}),O=()=>({shape:"capsule",radius:H(V),halfHeight:H(Q*J/2-V)});if(Y)switch(Y){case"block":return q();case"capsule":return O();case"round-cylinder":return U();case"trimesh":{let R=L();if(!R){f.error(`Collider.optionsFromModelUri(): Failed to create trimesh options for model ${Z}, falling back to generic shape!`);break}return R}case"wedge":return w();default:f.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?D9.decodeRawCollisionGroups(this._collider.collisionGroups()):D9.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=D9.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 f.error("Collider.addToSimulation(): Rigid body must be simulated before adding a collider to it!");if(J.type==="dynamic"&&this.shape==="trimesh")f.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|r0.ActiveEvents.COLLISION_EVENTS:J&~r0.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|r0.ActiveEvents.CONTACT_FORCE_EVENTS:J&~r0.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,W=J/2,Q=$/2,X=Y/2;return new Float32Array([-W,0-X,-Q,W,0-X,-Q,W,0-X,Q,-W,0-X,Q,-W,Y-X,-Q,W,Y-X,-Q])}_createColliderDesc(Z){let{shape:J,flags:Y}=Z;switch(J){case"ball":{if(!Z.radius)f.fatalError("Ball collider must have a radius!");return r0.ColliderDesc.ball(Z.radius)}case"block":{if(!Z.halfExtents)f.fatalError("Block collider must have halfExtents!");return r0.ColliderDesc.cuboid(Z.halfExtents.x,Z.halfExtents.y,Z.halfExtents.z)}case"capsule":{if(!Z.halfHeight||!Z.radius)f.fatalError("Capsule collider must have halfHeight and radius!");return r0.ColliderDesc.capsule(Z.halfHeight,Z.radius)}case"cone":{if(!Z.radius||!Z.halfHeight)f.fatalError("Cone collider must have radius and halfHeight!");return r0.ColliderDesc.cone(Z.halfHeight,Z.radius)}case"cylinder":{if(!Z.radius||!Z.halfHeight)f.fatalError("Cylinder collider must have radius and halfHeight!");return r0.ColliderDesc.cylinder(Z.halfHeight,Z.radius)}case"round-cylinder":{if(!Z.radius||!Z.halfHeight||!Z.borderRadius)f.fatalError("Round cylinder collider must have radius, halfHeight, and borderRadius!");return r0.ColliderDesc.roundCylinder(Z.halfHeight,Z.radius,Z.borderRadius)}case"trimesh":{if(!Z.indices||!Z.vertices)f.fatalError("Trimesh collider must have vertices and indices!");return r0.ColliderDesc.trimesh(Z.vertices,Z.indices,Y)}case"wedge":{if(!Z.extents)f.fatalError("Wedge collider must have extents!");let $=this._buildWedgeConvexHullVertices(Z.extents),W=r0.ColliderDesc.convexHull($);if(!W)throw f.fatalError("Failed to create convex hull for wedge collider!"),new Error("Convex hull creation failed");return W}default:f.fatalError(`Collider._createColliderDesc(): ${J} is not a valid collider shape!`)}}_requireSimulated(Z){if(!this.isSimulated)f.error(`Collider._requireSimulated(): Collider is not simulated, invoked method: ${Z}()`);return this.isSimulated}_requireUnsimulated(Z){if(this.isSimulated)f.error(`Collider._requireUnsimulated(): Collider is already simulated, invoked method: ${Z}()`);return!this.isSimulated}_requireNotRemoved(Z){if(this.isRemoved)f.error(`Collider._requireNotRemoved(): Collider is removed, invoked method: ${Z}()`);return!this.isRemoved}_setActiveCollisionTypes(){(this._collider??this._colliderDesc).setActiveCollisionTypes(r0.ActiveCollisionTypes.DYNAMIC_DYNAMIC|r0.ActiveCollisionTypes.DYNAMIC_KINEMATIC|r0.ActiveCollisionTypes.DYNAMIC_FIXED|r0.ActiveCollisionTypes.KINEMATIC_KINEMATIC|r0.ActiveCollisionTypes.KINEMATIC_FIXED)}}var TU1={shape:"trimesh",flags:TK.FIX_INTERNAL_EDGES},kU1=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]),EU1=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]),xj;((Y)=>{Y.ENTITY_COLLISION="BLOCK_TYPE.ENTITY_COLLISION";Y.ENTITY_CONTACT_FORCE="BLOCK_TYPE.ENTITY_CONTACT_FORCE"})(xj||={});class P5 extends S0{_id;_customColliderOptions;_isLiquid;_name;_textureUri;constructor(Z={id:-1,textureUri:"textures/missing.png",name:"Unknown"}){if(Z.id<0)f.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,...TU1}}get isLiquid(){return this._isLiquid}get isMeshable(){return!this._customColliderOptions}get name(){return this._name}get textureUri(){return this._textureUri}createCollider(Z=kU1,J=EU1){let Y=new N5({...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(D9.isDefaultCollisionGroups(Y.collisionGroups))Y.setCollisionGroups({belongsTo:[1],collidesWith:[65535&~1]});return Y}serialize(){return b0.serializeBlockType(this)}}var Aj;((J)=>J.REGISTER_BLOCK_TYPE="BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE")(Aj||={});class CG extends S0{_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)f.fatalError(`BlockTypeRegistry.getBlockType(): BlockType with id ${Z} not found.`);return J}registerGenericBlockType(Z){let Y=new class extends P5{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 b0.serializeBlockTypeRegistry(this)}}var zC={};R9(zC,{worldSchema:()=>GC,worldPacketDefinition:()=>ko,vectorSchema:()=>P1,vectorBooleanSchema:()=>TN1,uiSchema:()=>XC,uiPacketDefinition:()=>Co,uiDatasSchema:()=>KC,uiDatasPacketDefinition:()=>To,uiDataSendPacketDefinition:()=>Vo,uiDataSchema:()=>sG,syncResponseSchema:()=>QC,syncResponsePacketDefinition:()=>Do,syncRequestSchema:()=>hD,syncRequestPacketDefinition:()=>Fo,stateRequestSchema:()=>AD,stateRequestPacketDefinition:()=>zo,sceneUIsSchema:()=>WC,sceneUIsPacketDefinition:()=>jo,sceneUISchema:()=>$C,rgbColorSchema:()=>N4,registeredPackets:()=>Hw,quaternionSchema:()=>nD,playersSchema:()=>YC,playersPacketDefinition:()=>Po,playerSchema:()=>JC,physicsDebugRenderSchema:()=>ZC,physicsDebugRenderPacketDefinition:()=>Ro,physicsDebugRaycastsSchema:()=>eD,physicsDebugRaycastsPacketDefinition:()=>No,physicsDebugRaycastSchema:()=>tD,outboundPackets:()=>Vw,modelNodeOverrideSchema:()=>iD,lightsSchema:()=>rD,lightsPacketDefinition:()=>Mo,lightSchema:()=>oD,isValidPacket:()=>EN1,inputSchema:()=>xD,inputPacketDefinition:()=>Go,inboundPackets:()=>Fw,hexColorSchema:()=>SD,heartbeatSchema:()=>vD,heartbeatPacketDefinition:()=>Qo,entitySchema:()=>aD,entitiesSchema:()=>sD,entitiesPacketDefinition:()=>Oo,definePacket:()=>M0,debugConfigSchema:()=>_D,debugConfigPacketDefinition:()=>Ko,createPacket:()=>LN1,connectionSchema:()=>ID,connectionPacketDefinition:()=>Wo,chunksSchema:()=>pD,chunksPacketDefinition:()=>Bo,chunkSchema:()=>lD,chatMessagesSchema:()=>cD,chatMessagesPacketDefinition:()=>Lo,chatMessageSendPacketDefinition:()=>Xo,chatMessageSchema:()=>aG,cameraSchema:()=>uD,cameraPacketDefinition:()=>wo,blocksSchema:()=>gD,blocksPacketDefinition:()=>qo,blockTypesSchema:()=>dD,blockTypesPacketDefinition:()=>Uo,blockTypeSchema:()=>mD,blockSchema:()=>bD,bidirectionalPackets:()=>zw,audiosSchema:()=>yD,audiosPacketDefinition:()=>Ho,audioSchema:()=>fD,PacketId:()=>C1});var zw={};R9(zw,{heartbeatPacketDefinition:()=>Qo,connectionPacketDefinition:()=>Wo});var kD=i(Yo(),1);class ED extends kD.default{static instance=new kD.default}var C1;((k)=>{k[k.SYNC_REQUEST=0]="SYNC_REQUEST";k[k.INPUT=1]="INPUT";k[k.STATE_REQUEST=2]="STATE_REQUEST";k[k.CHAT_MESSAGE_SEND=3]="CHAT_MESSAGE_SEND";k[k.UI_DATA_SEND=4]="UI_DATA_SEND";k[k.SYNC_RESPONSE=32]="SYNC_RESPONSE";k[k.AUDIOS=33]="AUDIOS";k[k.BLOCKS=34]="BLOCKS";k[k.BLOCK_TYPES=35]="BLOCK_TYPES";k[k.CHAT_MESSAGES=36]="CHAT_MESSAGES";k[k.CHUNKS=37]="CHUNKS";k[k.ENTITIES=38]="ENTITIES";k[k.WORLD=39]="WORLD";k[k.CAMERA=40]="CAMERA";k[k.UI=41]="UI";k[k.UI_DATAS=42]="UI_DATAS";k[k.SCENE_UIS=43]="SCENE_UIS";k[k.LIGHTS=44]="LIGHTS";k[k.PLAYERS=45]="PLAYERS";k[k.CONNECTION=116]="CONNECTION";k[k.HEARTBEAT=117]="HEARTBEAT";k[k.DEBUG_CONFIG=128]="DEBUG_CONFIG";k[k.PHYSICS_DEBUG_RENDER=192]="PHYSICS_DEBUG_RENDER";k[k.PHYSICS_DEBUG_RAYCASTS=193]="PHYSICS_DEBUG_RAYCASTS"})(C1||={});function LN1(Z,J,Y){if(!Z.validate(J))throw new Error(`Invalid payload for packet with id ${Z.id}. Error: ${ED.instance.errorsText(Z.validate.errors)}`);let $=[Z.id,J];if(typeof Y==="number")$.push(Y);return $}function M0(Z,J){return{id:Z,schema:J,validate:ED.instance.compile(J)}}var BN1={type:"object",properties:{i:{type:"string"}},required:["i"],additionalProperties:!1},$o={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},ON1={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},MN1={type:"object",properties:{usernameFragment:{type:"string"},password:{type:"string"},iceLite:{type:"boolean",nullable:!0}},required:["usernameFragment","password"],additionalProperties:!1},RN1={type:"object",properties:{i:{type:"string"},l:{type:"string"}},required:["i","l"],additionalProperties:!1},NN1={type:"object",properties:{port:{type:"number"},OS:{type:"number"},MIS:{type:"number"},maxMessageSize:{type:"number"}},required:["port","OS","MIS","maxMessageSize"],additionalProperties:!0},PN1={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},jN1={type:"object",properties:{i:{type:"string"},f:{type:"string",enum:["cs","sc"]},ip:MN1,ic:{type:"array",items:ON1},d:$o,s:NN1},required:["i","f","ip","ic","d","s"],additionalProperties:!1},DN1={type:"object",properties:{i:{type:"string"},d:$o},required:["i","d"],additionalProperties:!1},CN1={type:"object",properties:{i:{type:"string",nullable:!0},pi:{type:"string",nullable:!0},l:{type:"string"},s:PN1},required:["l","s"],additionalProperties:!1},ID={type:"object",properties:{i:{type:"string",nullable:!0},c:{...DN1,nullable:!0},ca:{...BN1,nullable:!0},d:{type:"array",items:{...CN1},nullable:!0},pa:{...RN1,nullable:!0},t:{type:"array",items:{...jN1},nullable:!0}},additionalProperties:!1};var Wo=M0(116,ID);var vD={type:"null",nullable:!0};var Qo=M0(117,vD);var Fw={};R9(Fw,{uiDataSendPacketDefinition:()=>Vo,syncRequestPacketDefinition:()=>Fo,stateRequestPacketDefinition:()=>zo,inputPacketDefinition:()=>Go,debugConfigPacketDefinition:()=>Ko,chatMessageSendPacketDefinition:()=>Xo});var SD={type:"string",pattern:"^[0-9A-Fa-f]{6}$"};var aG={type:"object",properties:{m:{type:"string"},c:{...SD,nullable:!0},p:{type:"string",nullable:!0}},required:["m"],additionalProperties:!1};var Xo=M0(3,aG);var _D={type:"object",properties:{pdr:{type:"boolean",nullable:!0}},additionalProperties:!1};var Ko=M0(128,_D);var xD={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 Go=M0(1,xD);var AD={type:"object",properties:{},additionalProperties:!1};var zo=M0(2,AD);var hD={type:"null",nullable:!0};var Fo=M0(0,hD);var sG={type:"object",properties:{},additionalProperties:!0};var Vo=M0(4,sG);var Vw={};R9(Vw,{worldPacketDefinition:()=>ko,uiPacketDefinition:()=>Co,uiDatasPacketDefinition:()=>To,syncResponsePacketDefinition:()=>Do,sceneUIsPacketDefinition:()=>jo,playersPacketDefinition:()=>Po,physicsDebugRenderPacketDefinition:()=>Ro,physicsDebugRaycastsPacketDefinition:()=>No,lightsPacketDefinition:()=>Mo,entitiesPacketDefinition:()=>Oo,chunksPacketDefinition:()=>Bo,chatMessagesPacketDefinition:()=>Lo,cameraPacketDefinition:()=>wo,blocksPacketDefinition:()=>qo,blockTypesPacketDefinition:()=>Uo,audiosPacketDefinition:()=>Ho});var P1={type:"array",items:[{type:"number"},{type:"number"},{type:"number"}],minItems:3,maxItems:3};var fD={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:{...P1,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 yD={type:"array",items:{...fD}};var Ho=M0(33,yD);var bD={type:"object",properties:{i:{type:"number"},c:P1},required:["i","c"],additionalProperties:!1};var gD={type:"array",items:{...bD}};var qo=M0(34,gD);var mD={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 dD={type:"array",items:{...mD}};var Uo=M0(35,dD);var uD={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:{...P1,nullable:!0},pt:{...P1,nullable:!0},pl:{...P1,nullable:!0},h:{type:"array",items:{type:"string"},nullable:!0},o:{...P1,nullable:!0},z:{type:"number",nullable:!0}},additionalProperties:!1};var cD={type:"array",items:{...aG}};var lD={type:"object",properties:{c:P1,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 pD={type:"array",items:{...lD}};var N4={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 iD={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:{...N4,nullable:!0}},required:["n"],additionalProperties:!1};var nD={type:"array",items:[{type:"number"},{type:"number"},{type:"number"},{type:"number"}],minItems:4,maxItems:4};var aD={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:{...P1,nullable:!0},bt:{type:"string",nullable:!0},h:{type:"array",items:{type:"string"},nullable:!0},m:{type:"string",nullable:!0},mo:{type:"array",items:{...iD},nullable:!0},n:{type:"string",nullable:!0},o:{type:"number",nullable:!0},p:{...P1,nullable:!0},pe:{type:"number",nullable:!0},pn:{type:"string",nullable:!0},r:{...nD,nullable:!0},rm:{type:"boolean",nullable:!0},s:{type:"number",nullable:!0},t:{...N4,nullable:!0}},required:["i"],additionalProperties:!1};var sD={type:"array",items:{...aD}};var oD={type:"object",properties:{i:{type:"number"},a:{type:"number",nullable:!0},e:{type:"number",nullable:!0},c:{...N4,nullable:!0},d:{type:"number",nullable:!0},n:{type:"number",nullable:!0},o:{...P1,nullable:!0},p:{...P1,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:{...P1,nullable:!0}},required:["i"],additionalProperties:!1};var rD={type:"array",items:{...oD}};var tD={type:"object",properties:{o:{...P1},d:{...P1},l:{type:"number"},h:{type:"boolean"}},required:["o","d","l","h"],additionalProperties:!1};var eD={type:"array",items:{...tD}};var ZC={type:"object",properties:{v:{type:"array",items:{type:"number"}},c:{type:"array",items:{type:"number"}}},required:["v","c"],additionalProperties:!1};var JC={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 YC={type:"array",items:{...JC}};var $C={type:"object",properties:{i:{type:"number"},e:{type:"number",nullable:!0},o:{...P1,nullable:!0},p:{...P1,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 WC={type:"array",items:{...$C}};var QC={type:"object",properties:{r:{type:"number"},s:{type:"number"},p:{type:"number"},n:{type:"number"}},required:["r","s","p","n"],additionalProperties:!1};var XC={type:"object",properties:{p:{type:"boolean",nullable:!0},u:{type:"string",nullable:!0}},additionalProperties:!1};var KC={type:"array",items:{...sG}};var TN1={type:"array",items:[{type:"boolean"},{type:"boolean"},{type:"boolean"}],minItems:3,maxItems:3};var GC={type:"object",properties:{i:{type:"number"},ac:{...N4,nullable:!0},ai:{type:"number",nullable:!0},dc:{...N4,nullable:!0},di:{type:"number",nullable:!0},dp:{...P1,nullable:!0},n:{type:"string",nullable:!0},s:{type:"string",nullable:!0},t:{type:"number",nullable:!0}},required:["i"],additionalProperties:!1};var wo=M0(40,uD);var Lo=M0(36,cD);var Bo=M0(37,pD);var Oo=M0(38,sD);var Mo=M0(44,rD);var Ro=M0(192,ZC);var No=M0(193,eD);var Po=M0(45,YC);var jo=M0(43,WC);var Do=M0(32,QC);var Co=M0(41,XC);var To=M0(42,KC);var ko=M0(39,GC);var Hw=new Map,kN1={...zw,...Fw,...Vw};for(let Z of Object.values(kN1))if("id"in Z&&"schema"in Z){let J=Z;if(Hw.has(J.id))throw new Error(`Packet with id ${J.id} is already registered.`);Hw.set(J.id,J)}function EN1(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=Hw.get(Z[0]);return!!J&&J.validate(Z[1])}var s=zC;import{WebSocket as Dr8}from"ws";var k6=i(_r(),1),IH6=k6.default.v1,vH6=k6.default.v1ToV6,SH6=k6.default.v3,xr=k6.default.v4,_H6=k6.default.v5,xH6=k6.default.v6,AH6=k6.default.v6ToV1,hH6=k6.default.v7,fH6=k6.default.NIL,yH6=k6.default.MAX,bH6=k6.default.version,gH6=k6.default.validate,mH6=k6.default.stringify,dH6=k6.default.parse;function Ar(Z){let J=Z.length,Y=0,$=0;while($<J){let W=Z.charCodeAt($++);if((W&4294967168)===0){Y++;continue}else if((W&4294965248)===0)Y+=2;else{if(W>=55296&&W<=56319){if($<J){let Q=Z.charCodeAt($);if((Q&64512)===56320)++$,W=((W&1023)<<10)+(Q&1023)+65536}}if((W&4294901760)===0)Y+=3;else Y+=4}}return Y}function $j1(Z,J,Y){let $=Z.length,W=Y,Q=0;while(Q<$){let X=Z.charCodeAt(Q++);if((X&4294967168)===0){J[W++]=X;continue}else if((X&4294965248)===0)J[W++]=X>>6&31|192;else{if(X>=55296&&X<=56319){if(Q<$){let K=Z.charCodeAt(Q);if((K&64512)===56320)++Q,X=((X&1023)<<10)+(K&1023)+65536}}if((X&4294901760)===0)J[W++]=X>>12&15|224,J[W++]=X>>6&63|128;else J[W++]=X>>18&7|240,J[W++]=X>>12&63|128,J[W++]=X>>6&63|128}J[W++]=X&63|128}}var Wj1=new TextEncoder,Qj1=50;function Xj1(Z,J,Y){Wj1.encodeInto(Z,J.subarray(Y))}function hr(Z,J,Y){if(Z.length>Qj1)Xj1(Z,J,Y);else $j1(Z,J,Y)}var Kj1=4096;function LC(Z,J,Y){let $=J,W=$+Y,Q=[],X="";while($<W){let K=Z[$++];if((K&128)===0)Q.push(K);else if((K&224)===192){let G=Z[$++]&63;Q.push((K&31)<<6|G)}else if((K&240)===224){let G=Z[$++]&63,z=Z[$++]&63;Q.push((K&31)<<12|G<<6|z)}else if((K&248)===240){let G=Z[$++]&63,z=Z[$++]&63,F=Z[$++]&63,V=(K&7)<<18|G<<12|z<<6|F;if(V>65535)V-=65536,Q.push(V>>>10&1023|55296),V=56320|V&1023;Q.push(V)}else Q.push(K);if(Q.length>=Kj1)X+=String.fromCharCode(...Q),Q.length=0}if(Q.length>0)X+=String.fromCharCode(...Q);return X}var Gj1=new TextDecoder,zj1=200;function Fj1(Z,J,Y){let $=Z.subarray(J,J+Y);return Gj1.decode($)}function fr(Z,J,Y){if(Y>zj1)return Fj1(Z,J,Y);else return LC(Z,J,Y)}class zQ{constructor(Z,J){this.type=Z,this.data=J}}class E6 extends Error{constructor(Z){super(Z);let J=Object.create(E6.prototype);Object.setPrototypeOf(this,J),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:E6.name})}}var FQ=4294967295;function yr(Z,J,Y){let $=Y/4294967296,W=Y;Z.setUint32(J,$),Z.setUint32(J+4,W)}function Bw(Z,J,Y){let $=Math.floor(Y/4294967296),W=Y;Z.setUint32(J,$),Z.setUint32(J+4,W)}function Ow(Z,J){let Y=Z.getInt32(J),$=Z.getUint32(J+4);return Y*4294967296+$}function br(Z,J){let Y=Z.getUint32(J),$=Z.getUint32(J+4);return Y*4294967296+$}var Vj1=-1,Hj1=4294967295,qj1=17179869183;function Uj1({sec:Z,nsec:J}){if(Z>=0&&J>=0&&Z<=qj1)if(J===0&&Z<=Hj1){let Y=new Uint8Array(4);return new DataView(Y.buffer).setUint32(0,Z),Y}else{let Y=Z/4294967296,$=Z&4294967295,W=new Uint8Array(8),Q=new DataView(W.buffer);return Q.setUint32(0,J<<2|Y&3),Q.setUint32(4,$),W}else{let Y=new Uint8Array(12),$=new DataView(Y.buffer);return $.setUint32(0,J),Bw($,4,Z),Y}}function wj1(Z){let J=Z.getTime(),Y=Math.floor(J/1000),$=(J-Y*1000)*1e6,W=Math.floor($/1e9);return{sec:Y+W,nsec:$-W*1e9}}function Lj1(Z){if(Z instanceof Date){let J=wj1(Z);return Uj1(J)}else return null}function Bj1(Z){let J=new DataView(Z.buffer,Z.byteOffset,Z.byteLength);switch(Z.byteLength){case 4:{let Y=J.getUint32(0),$=0;return{sec:Y,nsec:0}}case 8:{let Y=J.getUint32(0),$=J.getUint32(4),W=(Y&3)*4294967296+$,Q=Y>>>2;return{sec:W,nsec:Q}}case 12:{let Y=Ow(J,4),$=J.getUint32(0);return{sec:Y,nsec:$}}default:throw new E6(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${Z.length}`)}}function Oj1(Z){let J=Bj1(Z);return new Date(J.sec*1000+J.nsec/1e6)}var gr={type:Vj1,encode:Lj1,decode:Oj1};class vY{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(gr)}register({type:Z,encode:J,decode:Y}){if(Z>=0)this.encoders[Z]=J,this.decoders[Z]=Y;else{let $=-1-Z;this.builtInEncoders[$]=J,this.builtInDecoders[$]=Y}}tryToEncode(Z,J){for(let Y=0;Y<this.builtInEncoders.length;Y++){let $=this.builtInEncoders[Y];if($!=null){let W=$(Z,J);if(W!=null){let Q=-1-Y;return new zQ(Q,W)}}}for(let Y=0;Y<this.encoders.length;Y++){let $=this.encoders[Y];if($!=null){let W=$(Z,J);if(W!=null)return new zQ(Y,W)}}if(Z instanceof zQ)return Z;return null}decode(Z,J,Y){let $=J<0?this.builtInDecoders[-1-J]:this.decoders[J];if($)return $(Z,J,Y);else return new zQ(J,Z)}}vY.defaultCodec=new vY;function Mj1(Z){return Z instanceof ArrayBuffer||typeof SharedArrayBuffer!=="undefined"&&Z instanceof SharedArrayBuffer}function tG(Z){if(Z instanceof Uint8Array)return Z;else if(ArrayBuffer.isView(Z))return new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength);else if(Mj1(Z))return new Uint8Array(Z);else return Uint8Array.from(Z)}var Rj1=100,Nj1=2048;class Mw{constructor(Z){this.entered=!1,this.extensionCodec=Z?.extensionCodec??vY.defaultCodec,this.context=Z?.context,this.useBigInt64=Z?.useBigInt64??!1,this.maxDepth=Z?.maxDepth??Rj1,this.initialBufferSize=Z?.initialBufferSize??Nj1,this.sortKeys=Z?.sortKeys??!1,this.forceFloat32=Z?.forceFloat32??!1,this.ignoreUndefined=Z?.ignoreUndefined??!1,this.forceIntegerToFloat=Z?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new Mw({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(Z){if(this.entered)return this.clone().encodeSharedRef(Z);try{return this.entered=!0,this.reinitializeState(),this.doEncode(Z,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(Z){if(this.entered)return this.clone().encode(Z);try{return this.entered=!0,this.reinitializeState(),this.doEncode(Z,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(Z,J){if(J>this.maxDepth)throw new Error(`Too deep objects in depth ${J}`);if(Z==null)this.encodeNil();else if(typeof Z==="boolean")this.encodeBoolean(Z);else if(typeof Z==="number")if(!this.forceIntegerToFloat)this.encodeNumber(Z);else this.encodeNumberAsFloat(Z);else if(typeof Z==="string")this.encodeString(Z);else if(this.useBigInt64&&typeof Z==="bigint")this.encodeBigInt64(Z);else this.encodeObject(Z,J)}ensureBufferSizeToWrite(Z){let J=this.pos+Z;if(this.view.byteLength<J)this.resizeBuffer(J*2)}resizeBuffer(Z){let J=new ArrayBuffer(Z),Y=new Uint8Array(J),$=new DataView(J);Y.set(this.bytes),this.view=$,this.bytes=Y}encodeNil(){this.writeU8(192)}encodeBoolean(Z){if(Z===!1)this.writeU8(194);else this.writeU8(195)}encodeNumber(Z){if(!this.forceIntegerToFloat&&Number.isSafeInteger(Z))if(Z>=0)if(Z<128)this.writeU8(Z);else if(Z<256)this.writeU8(204),this.writeU8(Z);else if(Z<65536)this.writeU8(205),this.writeU16(Z);else if(Z<4294967296)this.writeU8(206),this.writeU32(Z);else if(!this.useBigInt64)this.writeU8(207),this.writeU64(Z);else this.encodeNumberAsFloat(Z);else if(Z>=-32)this.writeU8(224|Z+32);else if(Z>=-128)this.writeU8(208),this.writeI8(Z);else if(Z>=-32768)this.writeU8(209),this.writeI16(Z);else if(Z>=-2147483648)this.writeU8(210),this.writeI32(Z);else if(!this.useBigInt64)this.writeU8(211),this.writeI64(Z);else this.encodeNumberAsFloat(Z);else this.encodeNumberAsFloat(Z)}encodeNumberAsFloat(Z){if(this.forceFloat32)this.writeU8(202),this.writeF32(Z);else this.writeU8(203),this.writeF64(Z)}encodeBigInt64(Z){if(Z>=BigInt(0))this.writeU8(207),this.writeBigUint64(Z);else this.writeU8(211),this.writeBigInt64(Z)}writeStringHeader(Z){if(Z<32)this.writeU8(160+Z);else if(Z<256)this.writeU8(217),this.writeU8(Z);else if(Z<65536)this.writeU8(218),this.writeU16(Z);else if(Z<4294967296)this.writeU8(219),this.writeU32(Z);else throw new Error(`Too long string: ${Z} bytes in UTF-8`)}encodeString(Z){let Y=Ar(Z);this.ensureBufferSizeToWrite(5+Y),this.writeStringHeader(Y),hr(Z,this.bytes,this.pos),this.pos+=Y}encodeObject(Z,J){let Y=this.extensionCodec.tryToEncode(Z,this.context);if(Y!=null)this.encodeExtension(Y);else if(Array.isArray(Z))this.encodeArray(Z,J);else if(ArrayBuffer.isView(Z))this.encodeBinary(Z);else if(typeof Z==="object")this.encodeMap(Z,J);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(Z)}`)}encodeBinary(Z){let J=Z.byteLength;if(J<256)this.writeU8(196),this.writeU8(J);else if(J<65536)this.writeU8(197),this.writeU16(J);else if(J<4294967296)this.writeU8(198),this.writeU32(J);else throw new Error(`Too large binary: ${J}`);let Y=tG(Z);this.writeU8a(Y)}encodeArray(Z,J){let Y=Z.length;if(Y<16)this.writeU8(144+Y);else if(Y<65536)this.writeU8(220),this.writeU16(Y);else if(Y<4294967296)this.writeU8(221),this.writeU32(Y);else throw new Error(`Too large array: ${Y}`);for(let $ of Z)this.doEncode($,J+1)}countWithoutUndefined(Z,J){let Y=0;for(let $ of J)if(Z[$]!==void 0)Y++;return Y}encodeMap(Z,J){let Y=Object.keys(Z);if(this.sortKeys)Y.sort();let $=this.ignoreUndefined?this.countWithoutUndefined(Z,Y):Y.length;if($<16)this.writeU8(128+$);else if($<65536)this.writeU8(222),this.writeU16($);else if($<4294967296)this.writeU8(223),this.writeU32($);else throw new Error(`Too large map object: ${$}`);for(let W of Y){let Q=Z[W];if(!(this.ignoreUndefined&&Q===void 0))this.encodeString(W),this.doEncode(Q,J+1)}}encodeExtension(Z){if(typeof Z.data==="function"){let Y=Z.data(this.pos+6),$=Y.length;if($>=4294967296)throw new Error(`Too large extension object: ${$}`);this.writeU8(201),this.writeU32($),this.writeI8(Z.type),this.writeU8a(Y);return}let J=Z.data.length;if(J===1)this.writeU8(212);else if(J===2)this.writeU8(213);else if(J===4)this.writeU8(214);else if(J===8)this.writeU8(215);else if(J===16)this.writeU8(216);else if(J<256)this.writeU8(199),this.writeU8(J);else if(J<65536)this.writeU8(200),this.writeU16(J);else if(J<4294967296)this.writeU8(201),this.writeU32(J);else throw new Error(`Too large extension object: ${J}`);this.writeI8(Z.type),this.writeU8a(Z.data)}writeU8(Z){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,Z),this.pos++}writeU8a(Z){let J=Z.length;this.ensureBufferSizeToWrite(J),this.bytes.set(Z,this.pos),this.pos+=J}writeI8(Z){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,Z),this.pos++}writeU16(Z){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,Z),this.pos+=2}writeI16(Z){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,Z),this.pos+=2}writeU32(Z){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,Z),this.pos+=4}writeI32(Z){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,Z),this.pos+=4}writeF32(Z){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,Z),this.pos+=4}writeF64(Z){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,Z),this.pos+=8}writeU64(Z){this.ensureBufferSizeToWrite(8),yr(this.view,this.pos,Z),this.pos+=8}writeI64(Z){this.ensureBufferSizeToWrite(8),Bw(this.view,this.pos,Z),this.pos+=8}writeBigUint64(Z){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,Z),this.pos+=8}writeBigInt64(Z){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,Z),this.pos+=8}}function BC(Z,J){return new Mw(J).encodeSharedRef(Z)}function Rw(Z){return`${Z<0?"-":""}0x${Math.abs(Z).toString(16).padStart(2,"0")}`}var Pj1=16,jj1=16;class OC{constructor(Z=Pj1,J=jj1){this.hit=0,this.miss=0,this.maxKeyLength=Z,this.maxLengthPerKey=J,this.caches=[];for(let Y=0;Y<this.maxKeyLength;Y++)this.caches.push([])}canBeCached(Z){return Z>0&&Z<=this.maxKeyLength}find(Z,J,Y){let $=this.caches[Y-1];Z:for(let W of $){let Q=W.bytes;for(let X=0;X<Y;X++)if(Q[X]!==Z[J+X])continue Z;return W.str}return null}store(Z,J){let Y=this.caches[Z.length-1],$={bytes:Z,str:J};if(Y.length>=this.maxLengthPerKey)Y[Math.random()*Y.length|0]=$;else Y.push($)}decode(Z,J,Y){let $=this.find(Z,J,Y);if($!=null)return this.hit++,$;this.miss++;let W=LC(Z,J,Y),Q=Uint8Array.prototype.slice.call(Z,J,J+Y);return this.store(Q,W),W}}var MC="array",Z3="map_key",dr="map_value",Dj1=(Z)=>{if(typeof Z==="string"||typeof Z==="number")return Z;throw new E6("The type of key must be string or number but "+typeof Z)};class ur{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(Z){let J=this.getUninitializedStateFromPool();J.type=MC,J.position=0,J.size=Z,J.array=new Array(Z)}pushMapState(Z){let J=this.getUninitializedStateFromPool();J.type=Z3,J.readCount=0,J.size=Z,J.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let Z={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(Z)}return this.stack[this.stackHeadPosition]}release(Z){if(this.stack[this.stackHeadPosition]!==Z)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(Z.type===MC){let Y=Z;Y.size=0,Y.array=void 0,Y.position=0,Y.type=void 0}if(Z.type===Z3||Z.type===dr){let Y=Z;Y.size=0,Y.map=void 0,Y.readCount=0,Y.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}var eG=-1,RC=new DataView(new ArrayBuffer(0)),Cj1=new Uint8Array(RC.buffer);try{RC.getInt8(0)}catch(Z){if(!(Z instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var mr=new RangeError("Insufficient data"),Tj1=new OC;class Nw{constructor(Z){this.totalPos=0,this.pos=0,this.view=RC,this.bytes=Cj1,this.headByte=eG,this.stack=new ur,this.entered=!1,this.extensionCodec=Z?.extensionCodec??vY.defaultCodec,this.context=Z?.context,this.useBigInt64=Z?.useBigInt64??!1,this.rawStrings=Z?.rawStrings??!1,this.maxStrLength=Z?.maxStrLength??FQ,this.maxBinLength=Z?.maxBinLength??FQ,this.maxArrayLength=Z?.maxArrayLength??FQ,this.maxMapLength=Z?.maxMapLength??FQ,this.maxExtLength=Z?.maxExtLength??FQ,this.keyDecoder=Z?.keyDecoder!==void 0?Z.keyDecoder:Tj1,this.mapKeyConverter=Z?.mapKeyConverter??Dj1}clone(){return new Nw({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=eG,this.stack.reset()}setBuffer(Z){let J=tG(Z);this.bytes=J,this.view=new DataView(J.buffer,J.byteOffset,J.byteLength),this.pos=0}appendBuffer(Z){if(this.headByte===eG&&!this.hasRemaining(1))this.setBuffer(Z);else{let J=this.bytes.subarray(this.pos),Y=tG(Z),$=new Uint8Array(J.length+Y.length);$.set(J),$.set(Y,J.length),this.setBuffer($)}}hasRemaining(Z){return this.view.byteLength-this.pos>=Z}createExtraByteError(Z){let{view:J,pos:Y}=this;return new RangeError(`Extra ${J.byteLength-Y} of ${J.byteLength} byte(s) found at buffer[${Z}]`)}decode(Z){if(this.entered)return this.clone().decode(Z);try{this.entered=!0,this.reinitializeState(),this.setBuffer(Z);let J=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return J}finally{this.entered=!1}}*decodeMulti(Z){if(this.entered){yield*this.clone().decodeMulti(Z);return}try{this.entered=!0,this.reinitializeState(),this.setBuffer(Z);while(this.hasRemaining(1))yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(Z){if(this.entered)return this.clone().decodeAsync(Z);try{this.entered=!0;let J=!1,Y;for await(let X of Z){if(J)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(X);try{Y=this.doDecodeSync(),J=!0}catch(K){if(!(K instanceof RangeError))throw K}this.totalPos+=this.pos}if(J){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return Y}let{headByte:$,pos:W,totalPos:Q}=this;throw new RangeError(`Insufficient data in parsing ${Rw($)} at ${Q} (${W} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(Z){return this.decodeMultiAsync(Z,!0)}decodeStream(Z){return this.decodeMultiAsync(Z,!1)}async*decodeMultiAsync(Z,J){if(this.entered){yield*this.clone().decodeMultiAsync(Z,J);return}try{this.entered=!0;let Y=J,$=-1;for await(let W of Z){if(J&&$===0)throw this.createExtraByteError(this.totalPos);if(this.appendBuffer(W),Y)$=this.readArraySize(),Y=!1,this.complete();try{while(!0)if(yield this.doDecodeSync(),--$===0)break}catch(Q){if(!(Q instanceof RangeError))throw Q}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){Z:while(!0){let Z=this.readHeadByte(),J;if(Z>=224)J=Z-256;else if(Z<192)if(Z<128)J=Z;else if(Z<144){let $=Z-128;if($!==0){this.pushMapState($),this.complete();continue Z}else J={}}else if(Z<160){let $=Z-144;if($!==0){this.pushArrayState($),this.complete();continue Z}else J=[]}else{let $=Z-160;J=this.decodeString($,0)}else if(Z===192)J=null;else if(Z===194)J=!1;else if(Z===195)J=!0;else if(Z===202)J=this.readF32();else if(Z===203)J=this.readF64();else if(Z===204)J=this.readU8();else if(Z===205)J=this.readU16();else if(Z===206)J=this.readU32();else if(Z===207)if(this.useBigInt64)J=this.readU64AsBigInt();else J=this.readU64();else if(Z===208)J=this.readI8();else if(Z===209)J=this.readI16();else if(Z===210)J=this.readI32();else if(Z===211)if(this.useBigInt64)J=this.readI64AsBigInt();else J=this.readI64();else if(Z===217){let $=this.lookU8();J=this.decodeString($,1)}else if(Z===218){let $=this.lookU16();J=this.decodeString($,2)}else if(Z===219){let $=this.lookU32();J=this.decodeString($,4)}else if(Z===220){let $=this.readU16();if($!==0){this.pushArrayState($),this.complete();continue Z}else J=[]}else if(Z===221){let $=this.readU32();if($!==0){this.pushArrayState($),this.complete();continue Z}else J=[]}else if(Z===222){let $=this.readU16();if($!==0){this.pushMapState($),this.complete();continue Z}else J={}}else if(Z===223){let $=this.readU32();if($!==0){this.pushMapState($),this.complete();continue Z}else J={}}else if(Z===196){let $=this.lookU8();J=this.decodeBinary($,1)}else if(Z===197){let $=this.lookU16();J=this.decodeBinary($,2)}else if(Z===198){let $=this.lookU32();J=this.decodeBinary($,4)}else if(Z===212)J=this.decodeExtension(1,0);else if(Z===213)J=this.decodeExtension(2,0);else if(Z===214)J=this.decodeExtension(4,0);else if(Z===215)J=this.decodeExtension(8,0);else if(Z===216)J=this.decodeExtension(16,0);else if(Z===199){let $=this.lookU8();J=this.decodeExtension($,1)}else if(Z===200){let $=this.lookU16();J=this.decodeExtension($,2)}else if(Z===201){let $=this.lookU32();J=this.decodeExtension($,4)}else throw new E6(`Unrecognized type byte: ${Rw(Z)}`);this.complete();let Y=this.stack;while(Y.length>0){let $=Y.top();if($.type===MC)if($.array[$.position]=J,$.position++,$.position===$.size)J=$.array,Y.release($);else continue Z;else if($.type===Z3){if(J==="__proto__")throw new E6("The key __proto__ is not allowed");$.key=this.mapKeyConverter(J),$.type=dr;continue Z}else if($.map[$.key]=J,$.readCount++,$.readCount===$.size)J=$.map,Y.release($);else{$.key=null,$.type=Z3;continue Z}}return J}}readHeadByte(){if(this.headByte===eG)this.headByte=this.readU8();return this.headByte}complete(){this.headByte=eG}readArraySize(){let Z=this.readHeadByte();switch(Z){case 220:return this.readU16();case 221:return this.readU32();default:if(Z<160)return Z-144;else throw new E6(`Unrecognized array type byte: ${Rw(Z)}`)}}pushMapState(Z){if(Z>this.maxMapLength)throw new E6(`Max length exceeded: map length (${Z}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(Z)}pushArrayState(Z){if(Z>this.maxArrayLength)throw new E6(`Max length exceeded: array length (${Z}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(Z)}decodeString(Z,J){if(!this.rawStrings||this.stateIsMapKey())return this.decodeUtf8String(Z,J);return this.decodeBinary(Z,J)}decodeUtf8String(Z,J){if(Z>this.maxStrLength)throw new E6(`Max length exceeded: UTF-8 byte length (${Z}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+J+Z)throw mr;let Y=this.pos+J,$;if(this.stateIsMapKey()&&this.keyDecoder?.canBeCached(Z))$=this.keyDecoder.decode(this.bytes,Y,Z);else $=fr(this.bytes,Y,Z);return this.pos+=J+Z,$}stateIsMapKey(){if(this.stack.length>0)return this.stack.top().type===Z3;return!1}decodeBinary(Z,J){if(Z>this.maxBinLength)throw new E6(`Max length exceeded: bin length (${Z}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(Z+J))throw mr;let Y=this.pos+J,$=this.bytes.subarray(Y,Y+Z);return this.pos+=J+Z,$}decodeExtension(Z,J){if(Z>this.maxExtLength)throw new E6(`Max length exceeded: ext length (${Z}) > maxExtLength (${this.maxExtLength})`);let Y=this.view.getInt8(this.pos+J),$=this.decodeBinary(Z,J+1);return this.extensionCodec.decode($,Y,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let Z=this.view.getUint8(this.pos);return this.pos++,Z}readI8(){let Z=this.view.getInt8(this.pos);return this.pos++,Z}readU16(){let Z=this.view.getUint16(this.pos);return this.pos+=2,Z}readI16(){let Z=this.view.getInt16(this.pos);return this.pos+=2,Z}readU32(){let Z=this.view.getUint32(this.pos);return this.pos+=4,Z}readI32(){let Z=this.view.getInt32(this.pos);return this.pos+=4,Z}readU64(){let Z=br(this.view,this.pos);return this.pos+=8,Z}readI64(){let Z=Ow(this.view,this.pos);return this.pos+=8,Z}readU64AsBigInt(){let Z=this.view.getBigUint64(this.pos);return this.pos+=8,Z}readI64AsBigInt(){let Z=this.view.getBigInt64(this.pos);return this.pos+=8,Z}readF32(){let Z=this.view.getFloat32(this.pos);return this.pos+=4,Z}readF64(){let Z=this.view.getFloat64(this.pos);return this.pos+=8,Z}}function NC(Z,J){return new Nw(J).decode(Z)}import{WebSocketServer as ih1}from"ws";import nh1 from"mediasoup";var E2=i(P90(),1);import ch1 from"http";import lh1 from"https";import uQ from"fs";import ph1 from"url";var n90=i(p90(),1);import nY from"fs";import i90 from"path";var Zz="./dev/persistence";class I4{static instance=new I4;gameId=process.env.HYTOPIA_GAME_ID;lobbyId=process.env.HYTOPIA_LOBBY_ID;_creativeGateway;constructor(){try{this._creativeGateway=new n90.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 f.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 f.warning("PlatformGateway.setData(): Cannot set data with an error property.");if(!this._creativeGateway&&process.env.NODE_ENV==="production")return f.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(!nY.existsSync(Zz))return;let J=i90.join(Zz,`${Z}.json`);return JSON.parse(nY.readFileSync(J,"utf8"))}catch(J){f.warning(`PlatformGateway._readDevDataLocally(): Failed to read data for key "${Z}": ${J}`)}}_writeDevDataLocally(Z,J){try{if(!nY.existsSync(Zz))nY.mkdirSync(Zz,{recursive:!0});let Y=i90.join(Zz,`${Z}.json`),$={};if(nY.existsSync(Y))$=JSON.parse(nY.readFileSync(Y,"utf8"));let W={...$,...J};nY.writeFileSync(Y,JSON.stringify(W,null,2),"utf8")}catch(Y){f.warning(`PlatformGateway._writeDevDataLocally(): Failed to write data for key "${Z}": ${Y}`)}}}var _k=process.env.PORT??8080,xk="0.5.6-
|
405
|
+
`))}}get isGatewayAvailable(){return!!this._creativeGateway}async getData(Z){if(!this._creativeGateway&&process.env.NODE_ENV==="production")return f.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 f.warning("PlatformGateway.setData(): Cannot set data with an error property.");if(!this._creativeGateway&&process.env.NODE_ENV==="production")return f.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(!nY.existsSync(Zz))return;let J=i90.join(Zz,`${Z}.json`);return JSON.parse(nY.readFileSync(J,"utf8"))}catch(J){f.warning(`PlatformGateway._readDevDataLocally(): Failed to read data for key "${Z}": ${J}`)}}_writeDevDataLocally(Z,J){try{if(!nY.existsSync(Zz))nY.mkdirSync(Zz,{recursive:!0});let Y=i90.join(Zz,`${Z}.json`),$={};if(nY.existsSync(Y))$=JSON.parse(nY.readFileSync(Y,"utf8"));let W={...$,...J};nY.writeFileSync(Y,JSON.stringify(W,null,2),"utf8")}catch(Y){f.warning(`PlatformGateway._writeDevDataLocally(): Failed to write data for key "${Z}": ${Y}`)}}}var _k=process.env.PORT??8080,xk="0.5.6-dev16",Ak;((W)=>{W.READY="WEBSERVER.READY";W.STOPPED="WEBSERVER.STOPPED";W.ERROR="WEBSERVER.ERROR";W.UPGRADE="WEBSERVER.UPGRADE"})(Ak||={});class cQ extends S0{static instance=new cQ;_webserver=E2.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:xk})}),this._webserver.use(E2.default.static("assets")),this._webserver.use(E2.default.static("node_modules/@hytopia.com/assets"))}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?ch1.createServer(this._webserver):lh1.createServer({key:uQ.existsSync("assets/certs/localhost.key")?uQ.readFileSync("assets/certs/localhost.key"):uQ.readFileSync("node_modules/@hytopia.com/assets/certs/localhost.key"),cert:uQ.existsSync("assets/certs/localhost.crt")?uQ.readFileSync("assets/certs/localhost.crt"):uQ.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 f.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(_k,this._onStarted),console.info(`WebServer.start(): Server running on port ${_k}.`)}stop(){if(this._internalHttpServer)return new Promise((Z,J)=>{this._internalHttpServer.close((Y)=>{if(Y)J(Y);else Z(!0)})});else return f.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(Z,J,Y)=>{let $=ph1.parse(Z.url??"",!0).query,W=$.connectionId?.toString()??void 0,Q=$.sessionToken?.toString()??"",X=await I4.instance.getPlayerSession(Q);if(W)Z.connectionId=W;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: ${cZ(Z)}`),!0}return!1}function Ny1(Z,J){if(!J?.length)return!1;return s2
|
|
433
433
|
`),U=q.shift();if(!U)return Z.destroy(),Y(new Error("No header received from proxy CONNECT response"));let L=U.split(" "),w=+(L[1]||0),O=L.slice(2).join(" "),R={};for(let N of q){if(!N)continue;let P=N.indexOf(":");if(P===-1)return Z.destroy(),Y(new Error(`Invalid header from proxy CONNECT response: "${N}"`));let D=N.slice(0,P).toLowerCase(),j=N.slice(P+1).trimStart(),C=R[D];if(typeof C==="string")R[D]=[C,j];else if(Array.isArray(C))C.push(j);else R[D]=j}TO("got proxy server response: %o %o",U,R),X(),J({connect:{statusCode:w,statusText:O,headers:R},buffered:V})}Z.on("error",G),Z.on("end",K),Q()})}function YV(...Z){g.log("[https-proxy-agent]",...Z)}class kO extends zA{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??{},YV("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?e91(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:"){YV("Creating `tls.Socket`: %o",this.connectOpts);let V=this.connectOpts.servername||this.connectOpts.host;$=FA.connect({...this.connectOpts,servername:V&&e7.isIP(V)?void 0:V})}else YV("Creating `net.Socket`: %o",this.connectOpts),$=e7.connect(this.connectOpts);let W=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},Q=e7.isIPv6(J.host)?`[${J.host}]`:J.host,X=`CONNECT ${Q}:${J.port} HTTP/1.1\r
|
434
434
|
`;if(Y.username||Y.password){let V=`${decodeURIComponent(Y.username)}:${decodeURIComponent(Y.password)}`;W["Proxy-Authorization"]=`Basic ${Buffer.from(V).toString("base64")}`}if(W.Host=`${Q}:${J.port}`,!W["Proxy-Connection"])W["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let V of Object.keys(W))X+=`${V}: ${W[V]}\r
|
435
435
|
`;let K=t91($);$.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",xo8),J.secureEndpoint){YV("Upgrading socket connection to TLS");let V=J.servername||J.host;return FA.connect({...e91(J,"host","path","port"),socket:$,servername:e7.isIP(V)?void 0:V})}return $}$.destroy();let F=new e7.Socket({writable:!1});return F.readable=!0,Z.once("socket",(V)=>{YV("Replaying proxy buffer for failed request"),V.push(z),V.push(null)}),F}}kO.__initStatic();function xo8(Z){Z.resume()}function e91(Z,...J){let Y={},$;for($ in Z)if(!J.includes($))Y[$]=Z[$];return Y}var bo8=32768;function go8(Z){return new fo8({read(){this.push(Z),this.push(null)}})}function VA(Z){let J;try{J=new URL(Z.url)}catch(G){return q8(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),rZ(Z,()=>Promise.resolve({}))}let Y=J.protocol==="https:",$=mo8(J,Z.proxy||(Y?process.env.https_proxy:void 0)||process.env.http_proxy),W=Y?ho8:Ao8,Q=Z.keepAlive===void 0?!1:Z.keepAlive,X=$?new kO($):new W.Agent({keepAlive:Q,maxSockets:30,timeout:2000}),K=do8(Z,Z.httpModule??W,X);return rZ(Z,K)}function mo8(Z,J){let{no_proxy:Y}=process.env;if(Y?.split(",").some((W)=>Z.host.endsWith(W)||Z.hostname.endsWith(W)))return;else return J}function do8(Z,J,Y){let{hostname:$,pathname:W,port:Q,protocol:X,search:K}=new URL(Z.url);return function G(z){return new Promise((F,V)=>{X$(()=>{let H=go8(z.body),q={...Z.headers};if(z.body.length>bo8)q["content-encoding"]="gzip",H=H.pipe(yo8());let U=J.request({method:"POST",agent:Y,headers:q,hostname:$,path:`${W}${K}`,port:Q,protocol:X,ca:Z.caCerts},(L)=>{L.on("data",()=>{}),L.on("end",()=>{}),L.setEncoding("utf8");let w=L.headers["retry-after"]??null,O=L.headers["x-sentry-rate-limits"]??null;F({statusCode:L.statusCode,headers:{"retry-after":w,"x-sentry-rate-limits":Array.isArray(O)?O[0]||null:O}})});U.on("error",V),H.pipe(U)})})}}var uo8=new Set(["false","f","n","no","off","0"]),co8=new Set(["true","t","y","yes","on","1"]);function EO(Z,J){let Y=String(Z).toLowerCase();if(uo8.has(Y))return!1;if(co8.has(Y))return!0;return J?.strict?null:Boolean(Z)}import{posix as lo8,sep as po8}from"path";function Z41(Z){return Z.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function HA(Z=process.argv[1]?EE(process.argv[1]):process.cwd(),J=po8==="\\"){let Y=J?Z41(Z):Z;return($)=>{if(!$)return;let W=J?Z41($):$,{dir:Q,base:X,ext:K}=lo8.parse(W);if(K===".js"||K===".mjs"||K===".cjs")X=X.slice(0,K.length*-1);let G=decodeURIComponent(X);if(!Q)Q=".";let z=Q.lastIndexOf("/node_modules");if(z>-1)return`${Q.slice(z+14).replace(/\//g,".")}:${G}`;if(Q.startsWith(Y)){let F=Q.slice(Y.length+1).replace(/\//g,".");return F?`${F}:${G}`:G}return G}}function qA(Z){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(P0.SENTRY_RELEASE?.id)return P0.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 UA=b2(SE(HA()));var Y41=i(n(),1);import*as J41 from"os";import{threadId as io8,isMainThread as no8}from"worker_threads";var ao8=60000;class IO extends r2{constructor(Z){let J=Z.serverName||global.process.env.SENTRY_NAME||J41.hostname(),Y={...Z,platform:"node",runtime:{name:"node",version:global.process.version},serverName:J};if(Z.openTelemetryInstrumentations)jX({instrumentations:Z.openTelemetryInstrumentations});jz(Y,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${no8?"main":`worker-${io8}`}.`);super(Y);if(this.getOptions()._experiments?.enableLogs){if(this._logOnExitFlushListener=()=>{G$(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=H8,Y=Y41.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(()=>{_0&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},Z.clientReportFlushInterval??ao8).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener)}_getTraceInfoFromScope(Z){if(!Z)return[void 0,void 0];return Vo0(this,Z)}}var J4=i(n(),1);var QK=i(D1(),1);var $41=i(WB(),1);import so8 from"module";var wA=1e6;function LA(Z,J={}){if(Z.getOptions().debug)to8();let Y=oo8(Z,J);Z.traceProvider=Y}function W41(){let[Z=0,J=0]=process.versions.node.split(".").map(Number);if(Z>=21||Z===20&&J>=6||Z===18&&J>=19){if(!P0._sentryEsmLoaderHookRegistered)try{let{addHookMessagePort:Y}=$41.createAddHookMessageChannel();so8.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:Y,include:[]},transferList:[Y]})}catch(Y){g.warn("Failed to register ESM hook",Y)}}else q8(()=>{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 oo8(Z,J={}){let Y=new aS({sampler:new U_(Z),resource:new xX({[QK.ATTR_SERVICE_NAME]:"node",[QK.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[QK.ATTR_SERVICE_VERSION]:H8}),forceFlushTimeoutMillis:500,spanProcessors:[new q_({timeout:ro8(Z.getOptions().maxSpanWaitDuration)}),...J.spanProcessors||[]]});return J4.trace.setGlobalTracerProvider(Y),J4.propagation.setGlobalPropagator(new G_),J4.context.setGlobalContextManager(new o91),Y}function ro8(Z){if(Z==null)return;if(Z>wA)return _0&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${wA}`),wA;else if(Z<=0||Number.isNaN(Z)){_0&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return Z}function to8(){let Z=new Proxy(g,{get(J,Y,$){return Reflect.get(J,Y==="verbose"?"debug":Y,$)}});J4.diag.disable(),J4.diag.setLogger(Z,J4.DiagLogLevel.DEBUG)}function eo8(){return cX()?[lX()]:[]}function Q41(){return[V$(),F$(),H$(),q$(),U$(),bX(),mX(),pX(),iX(),uX(),j_(),dX(),f91(),r91(),...eo8()]}function X41(Z){return[...Q41(),...x6(Z)?WK():[]]}function BA(Z={}){return Zr8(Z,X41)}function Zr8(Z={},J){let Y=Jr8(Z,J);if(Y.debug===!0)if(_0)g.enable();else q8(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")});if(!cX()&&Y.registerEsmLoaderHooks!==!1)W41();if(qo0(),K1().update(Y.initialScope),Y.spotlight&&!Y.integrations.some(({name:Q})=>Q===ox))Y.integrations.push(rx({sidecarUrl:typeof Y.spotlight==="string"?Y.spotlight:void 0}));let W=new IO(Y);if(K1().setClient(W),W.init(),g.log(`Running in ${cX()?"CommonJS":"ESM"} mode.`),W.startClientReportTracking(),Wr8(),!Y.skipOpenTelemetrySetup)LA(W,{spanProcessors:Y.openTelemetrySpanProcessors}),K41();return Yo0(W),Ho0(W),W}function K41(){if(!_0)return;let Z=Xo0(),J=["SentryContextManager","SentryPropagator"];if(x6())J.push("SentrySpanProcessor");for(let Y of J)if(!Z.includes(Y))g.error(`You have to set up the ${Y}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);if(!Z.includes("SentrySampler"))g.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 Jr8(Z,J){let Y=Yr8(Z.release),$=Z.spotlight??EO(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,W=$r8(Z.tracesSampleRate),Q={...Z,dsn:Z.dsn??process.env.SENTRY_DSN,environment:Z.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:Z.sendClientReports??!0,transport:Z.transport??VA,stackParser:YE(Z.stackParser||UA),release:Y,tracesSampleRate:W,spotlight:$,debug:EO(Z.debug??process.env.SENTRY_DEBUG)},X=Z.integrations,K=Z.defaultIntegrations??J(Q);return{...Q,integrations:OE({defaultIntegrations:K,integrations:X})}}function Yr8(Z){if(Z!==void 0)return Z;let J=qA();if(J!==void 0)return J;return}function $r8(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 Wr8(){if(EO(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let Z=process.env.SENTRY_TRACE,J=process.env.SENTRY_BAGGAGE,Y=Z$(Z,J);K1().setPropagationContext(Y)}}import*as H41 from"os";var Lr8="BunServer",Br8=()=>{return{name:Lr8,setupOnce(){Or8()}}},F41=a(Br8),G41=!1;function Or8(){if(G41)return;Bun.serve=new Proxy(Bun.serve,{apply(Z,J,Y){z41(Y[0]);let $=Z.apply(J,Y),W=$.reload.bind($);return $.reload=(Q)=>{return z41(Q),W(Q)},$}}),G41=!0}function z41(Z){Mr8(Z),Rr8(Z)}function Mr8(Z){if(typeof Z.fetch!=="function")return;Z.fetch=new Proxy(Z.fetch,{apply(J,Y,$){return OA(J,Y,$)}})}function Rr8(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:($,W,Q)=>{return OA($,W,Q,J)}});if(Y instanceof Response)return;if(typeof Y==="object")Object.entries(Y).forEach(([$,W])=>{if(typeof W==="function")Z.routes[J][$]=new Proxy(W,{apply:(Q,X,K)=>{return OA(Q,X,K,J)}})})})}function OA(Z,J,Y,$){return nZ((W)=>{let Q=Y[0],X=Q.method.toUpperCase();if(X==="OPTIONS"||X==="HEAD")return Z.apply(J,Y);let K=vE(Q.url),G=Nr8(K,Q),z=K?.pathname||"/";if(Q.params){if(Object.keys(Q.params).forEach((F)=>{G[`url.path.parameter.${F}`]=Q.params[F]}),$)G[y1]="route",G["url.template"]=$,z=$}if($?.endsWith("/*"))G[y1]="route",G["url.template"]=$,z=$;return W.setSDKProcessingMetadata({normalizedRequest:{url:Q.url,method:Q.method,headers:Q.headers.toJSON(),query_string:K?.search}}),Mz({sentryTrace:Q.headers.get("sentry-trace")??"",baggage:Q.headers.get("baggage")},()=>Q$({attributes:G,op:"http.server",name:`${Q.method} ${z}`},async(F)=>{try{let V=await Z.apply(J,Y);if(V?.status)Wz(F,V.status),W.setContext("response",{headers:V.headers.toJSON(),status_code:V.status});return V}catch(V){throw F6(V,{mechanism:{type:"bun",handled:!1,data:{function:"serve"}}}),V}}))})}function Nr8(Z,J){let Y={[i0]:"auto.http.bun.serve",[rk]:J.method||"GET",[y1]:"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(!IE(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 V41(Z){function J(Y){let $={body:Y.body,method:"POST",headers:Z.headers};try{return X$(()=>{return fetch(Z.url,$).then((W)=>{return{statusCode:W.status,headers:{"x-sentry-rate-limits":W.headers.get("X-Sentry-Rate-Limits"),"retry-after":W.headers.get("Retry-After")}}})})}catch(W){return K$(W)}}return rZ(Z,J)}function q41(Z){return[V$(),F$(),H$(),q$(),U$(),bX(),mX(),pX(),iX(),uX(),dX(),lX(),F41(),...x6(Z)?WK():[]]}function MA(Z={}){jz(Z,"bun");let J={...Z,platform:"javascript",runtime:{name:"bun",version:Bun.version},serverName:Z.serverName||global.process.env.SENTRY_NAME||H41.hostname()};if(J.transport=J.transport||V41,J.defaultIntegrations===void 0)J.defaultIntegrations=q41(J);return BA(J)}import{heapStats as jr8}from"bun:jsc";if(process.env.NODE_ENV==="production"&&process.env.SENTRY_DSN)MA({dsn:process.env.SENTRY_DSN,release:xk,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=a1.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>100)return Z.measurements=a1.getProcessStats(!0),Z}return null}}),console.log("Telemetry: Sentry.io initialized!");class a1{static getProcessStats(Z=!1){let J=jr8(),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"}};if(Z)return $;return Object.fromEntries(Object.entries($).map(([W,Q])=>[W,Q.value]))}static startSpan(Z,J){if(Nz())return Q$({attributes:Z.attributes,name:Z.operation,op:Z.operation},J);else return J()}}var Cr8=5000;class aY extends S0{static _serializedPackets=new WeakMap;_closeTimeout=null;_wrtcDirectTransport=null;_wrtcClientServerTransport=null;_wrtcClientServerDataProducers=[];_wrtcClientServerDataConsumers=[];_wrtcServerClientTransport=null;_wrtcServerClientReliableDataProducer=null;_wrtcServerClientUnreliableDataProducer=null;_wrtcServerClientDataConsumers=[];_ws;id;constructor(Z,J){super();this.id=xr(),this.onPacket(s.PacketId.CONNECTION,this._onConnectionPacket),this.onPacket(s.PacketId.HEARTBEAT,this._onHeartbeatPacket),this.bindWs(Z),n8.emit("CONNECTION.OPENED",{connection:this,req:J})}static serializePackets(Z){for(let Y of Z)if(!s.isValidPacket(Y))return f.error(`Connection.serializePackets(): Invalid packet payload: ${JSON.stringify(Y)}`);let J=aY._serializedPackets.get(Z);if(J)return J;return a1.startSpan({operation:"serialize_packets",attributes:{packets:Z.length,packetIds:Z.map((Y)=>Y[0]).join(",")}},(Y)=>{let $=BC(Z),W=Buffer.from($.buffer,$.byteOffset,$.byteLength);return Y?.setAttribute("serializedBytes",$.byteLength),aY._serializedPackets.set(Z,W),W})}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([s.createPacket(s.bidirectionalPackets.connectionPacketDefinition,{i:this.id})],!0,!0),J)this.emitWithGlobal("CONNECTION.RECONNECTED",{connection:this});if(gZ.instance.isWrtcEnabled)this._upgradeToWRTC()}closeWrtc(){this._closeWrtcClientServerTransport(),this._closeWrtcServerClientTransport()}disconnect(){try{this._ws.close()}catch(Z){f.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!==Dr8.OPEN)return f.warning("Connection.send(): Connection is not open.");a1.startSpan({operation:"send_packets",attributes:{forceWs:Y?"true":"false",wrtcConnected:this._wrtcServerClientTransport?.iceState==="completed"?"true":"false"}},()=>{try{let $=aY.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($){f.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:W,d:Q}=Y,X=!1;if(W==this._wrtcClientServerTransport?.id)await this._wrtcClientServerTransport.connect({dtlsParameters:Q}),X=!0;if(W==this._wrtcServerClientTransport?.id)await this._wrtcServerClientTransport.connect({dtlsParameters:Q}),X=!0;if(X)this.send([s.createPacket(s.bidirectionalPackets.connectionPacketDefinition,{ca:{i:W}})])}if($)for(let W of $){let{s:Q,l:X}=W,K=await this._wrtcClientServerTransport.produceData({label:X,sctpStreamParameters:Q}),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([s.createPacket(s.bidirectionalPackets.connectionPacketDefinition,{pa:{i:K.id,l:X}})])}};_onHeartbeatPacket=()=>{this.send([s.createPacket(s.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){f.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()},Cr8)};_onWsError=(Z)=>{this.emitWithGlobal("CONNECTION.ERROR",{connection:this,error:Z})};_upgradeToWRTC=async()=>{let Z=await gZ.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 W=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientReliableDataProducer.id}),Q=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientUnreliableDataProducer.id});return this._wrtcServerClientDataConsumers.push(W,Q),this.send([s.createPacket(s.bidirectionalPackets.connectionPacketDefinition,{d:[{i:W.id,pi:W.dataProducerId,l:"scr",s:W.sctpStreamParameters},{i:Q.id,pi:Q.dataProducerId,l:"scu",s:Q.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=NC(Z);if(!J||typeof J!=="object"||typeof J[0]!=="number")return f.error(`Connection._deserialize(): Invalid packet format. Packet: ${JSON.stringify(J)}`);if(!s.isValidPacket(J))return f.error(`Connection._deserialize(): Invalid packet payload. Packet: ${JSON.stringify(J)}`);return J}}var U41;(($)=>{$.PLAYER_CONNECTED="PLAYER_MANAGER.PLAYER_CONNECTED";$.PLAYER_DISCONNECTED="PLAYER_MANAGER.PLAYER_DISCONNECTED";$.PLAYER_RECONNECTED="PLAYER_MANAGER.PLAYER_RECONNECTED"})(U41||={});class D5{static instance=new D5;_connectionPlayers=new Map;constructor(){n8.on("CONNECTION.OPENED",({connection:Z,req:J})=>{this._onConnectionOpened(Z,J.session)}),n8.on("CONNECTION.DISCONNECTED",({connection:Z})=>{this._onConnectionDisconnected(Z)}),n8.on("CONNECTION.RECONNECTED",({connection:Z})=>{this._onConnectionReconnected(Z)}),n8.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),n8.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(),n8.emit("PLAYER_MANAGER.PLAYER_RECONNECTED",{player:J});else f.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),n8.emit("PLAYER_MANAGER.PLAYER_DISCONNECTED",{player:J});else f.warning(`PlayerManager._onConnectionClosed(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}}var L8=16,KK=L8-1,w41=L8**3,Tr8=[{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]}],RA;(($)=>{$.DESPAWN="CHUNK.DESPAWN";$.SET_BLOCK="CHUNK.SET_BLOCK";$.SPAWN="CHUNK.SPAWN"})(RA||={});class L6 extends S0{_blocks;_originCoordinate;_requiresUpdate=!1;_rigidBody;_world;constructor(){super();this._blocks=new Uint8Array(w41)}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%L8,y:(Z/L8|0)%L8,z:Z/(L8*L8)|0}}static globalCoordinateToLocalCoordinate(Z){return{x:Z.x&L8-1,y:Z.y&L8-1,z:Z.z&L8-1}}static globalCoordinateToOriginCoordinate(Z){return{x:Z.x&~(L8-1),y:Z.y&~(L8-1),z:Z.z&~(L8-1)}}static isValidOriginCoordinate(Z){return Z.x%L8===0&&Z.y%L8===0&&Z.z%L8===0}spawn(Z,J){if(this.isSpawned){let{x:Y,y:$,z:W}=this.originCoordinate;return f.error(`Chunk.spawn(): Chunk is already spawned at origin ${Y}, ${$}, ${W}!`)}if(!L6.isValidOriginCoordinate(J))return f.error(`Chunk.spawn(): Chunk coordinates must be divisible by ${L8}`);this._originCoordinate=J,this._world=Z,this._world.chunkLattice.registerChunk(this),this._requiresUpdate=!0}despawn(){if(!this.isSpawned)return f.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 f.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===KK)$.push({x:1,y:0,z:0});if(Z.y===KK)$.push({x:0,y:1,z:0});if(Z.z===KK)$.push({x:0,y:0,z:1});for(let W of $){let Q={x:Y.x+W.x,y:Y.y+W.y,z:Y.z+W.z},X=L6.globalCoordinateToOriginCoordinate(Q),K=this._world?.chunkLattice.getChunk(X);if(!K?.hasBlock(L6.globalCoordinateToLocalCoordinate(Q)))continue;K.setRequiresUpdate(!0)}}this._requiresUpdate=!0}setRequiresUpdate(Z){this._requiresUpdate=Z}update(){if(!this._requiresUpdate)return;if(!this.isSpawned)return f.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 jY({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 b0.serializeChunk(this)}_meshColliders(){if(!this._world)return f.error("Chunk._meshColliders(): Chunk is not spawned and cannot be meshed."),[];let Z=new Map,J=[];for(let $=0;$<w41;$++){if(this._blocks[$]===0)continue;let W=this._blocks[$],Q=this._world.blockTypeRegistry.getBlockType(W),{x:X,y:K,z:G}=L6.blockIndexToLocalCoordinate($);if(!Q.isMeshable){let F=Q.createCollider();F.setRelativePosition({x:X,y:K,z:G}),J.push([F,Q]);continue}let z=Z.get(Q)??{indices:[],vertices:[]};Z.set(Q,z);for(let F of Tr8){let[V,H,q]=F.neighborOffset,U={x:X+V,y:K+H,z:G+q},L=this._getGlobalCoordinate(U),w=this._world.chunkLattice.getBlockType(L);if(w&&!w.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(($,W)=>{if(!$.indices.length)return;let Q=W.createCollider(new Uint32Array($.indices),new Float32Array($.vertices));Y.push([Q,W])}),[...J,...Y]}_removeFromSimulation(){if(!this._rigidBody||!this._world)return;this._rigidBody.removeFromSimulation(),this._rigidBody=void 0}_getGlobalCoordinate(Z){if(!this.originCoordinate)f.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+L8*(Z.y+L8*Z.z)}_isValidLocalCoordinate(Z){return Z.x>=0&&Z.x<=KK&&Z.y>=0&&Z.y<=KK&&Z.z>=0&&Z.z<=KK}}class $V{_chunks=new Map;_world;constructor(Z){this._world=Z}get chunkCount(){return this._chunks.size}registerChunk(Z){if(!Z.isSpawned)return f.error("ChunkLattice.registerChunk(): Chunk is not spawned.");if(this.hasChunk(Z.originCoordinate)){let{x:J,y:Y,z:$}=Z.originCoordinate;return f.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 f.error("ChunkLattice.registerChunk(): Chunk world does not match lattice world.");this._chunks.set(this._getChunkKey(Z.originCoordinate),Z)}unregisterChunk(Z){if(!Z.isSpawned)return f.error("ChunkLattice.unregisterChunk(): Chunk is not spawned.");if(Z.world.id!==this._world.id)return f.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(L6.globalCoordinateToOriginCoordinate(Z));if(!J)return 0;return J.getBlockId(L6.globalCoordinateToLocalCoordinate(Z))}getBlockType(Z){let J=this.getBlockId(Z);return J?this._world.blockTypeRegistry.getBlockType(J):null}getChunk(Z){if(!L6.isValidOriginCoordinate(Z)){f.error(`ChunkLattice.getChunk(): Chunk coordinates must be divisible by CHUNK_SIZE (${L8})`);return}return this._chunks.get(this._getChunkKey(Z))}getAllChunks(){return Array.from(this._chunks.values())}hasBlock(Z){let J=this.getChunk(L6.globalCoordinateToOriginCoordinate(Z));if(!J)return!1;return J.hasBlock(L6.globalCoordinateToLocalCoordinate(Z))}hasChunk(Z){return this._chunks.has(this._getChunkKey(Z))}setBlock(Z,J){let Y=L6.globalCoordinateToLocalCoordinate(Z),$=L6.globalCoordinateToOriginCoordinate(Z),W=this.getChunk($);if(!W)W=new L6,W.spawn(this._world,$);W.setBlock(Y,J)}updateChunks(){this._chunks.forEach((Z)=>{if(Z.requiresUpdate)Z.update()})}_getChunkKey(Z){return`${Z.x},${Z.y},${Z.z}`}}var L41={type:"dynamic",softCcdPrediction:1},B41=0.0025000000000000005,O41=Math.cos(0.005),WV;((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"})(WV||={});class _8 extends jY{_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)f.fatalError("Entity.constructor(): Entity data must include a blockTextureUri or modelUri, but not both.");if(J&&!Z.blockHalfExtents)f.fatalError("Entity.constructor(): Block entity must have blockHalfExtents!");if(Z.parent&&!Z.parent.isSpawned)f.fatalError("Entity.constructor(): Parent entity must be spawned before child entity!");if(Z.parent?.modelUri&&Z.parentNodeName&&!d5.instance.modelHasNode(Z.parent.modelUri,Z.parentNodeName))f.fatalError(`Entity.constructor(): Parent node name ${Z.parentNodeName} not found in parent model ${Z.parent.modelUri}!`);super(Z.rigidBodyOptions??L41);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?d5.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 f.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 N5(N5.optionsFromBlockHalfExtents(this._blockHalfExtents)));if(this._modelUri&&this.numColliders===0&&this._modelPreferredShape!=="none")this.addChildColliderToSimulation(new N5(N5.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(D9.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 f.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((W)=>W.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 b0.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)f.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,W=Z.z-J.z;return Y*Y+$*$+W*W>B41}_rotationExceedsThreshold(Z,J){return Math.abs(Z.x*J.x+Z.y*J.y+Z.z*J.z+Z.w*J.w)<O41}}var NA;((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"})(NA||={});class QV extends S0{_id;_attachedToEntity;_offset;_position;_state={};_templateId;_viewDistance;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)f.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 f.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 f.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 b0.serializeSceneUI(this)}}class t4 extends _8{player;nametagSceneUI;constructor(Z){super(Z);this.player=Z.player,this.nametagSceneUI=new QV({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 f.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 KV{_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)f.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 f.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 t4)Z.push(J)}),Z}getPlayerEntitiesByPlayer(Z){let J=[];return this._entities.forEach((Y)=>{if(Y instanceof t4&&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 GV{_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 M41;((Y)=>{Y[Y.POINTLIGHT=0]="POINTLIGHT";Y[Y.SPOTLIGHT=1]="SPOTLIGHT"})(M41||={});var PA;((H)=>{H.DESPAWN="LIGHT.DESPAWN";H.SET_ANGLE="LIGHT.SET_ANGLE";H.SET_ATTACHED_TO_ENTITY="LIGHT.SET_ATTACHED_TO_ENTITY";H.SET_COLOR="LIGHT.SET_COLOR";H.SET_DISTANCE="LIGHT.SET_DISTANCE";H.SET_INTENSITY="LIGHT.SET_INTENSITY";H.SET_OFFSET="LIGHT.SET_OFFSET";H.SET_PENUMBRA="LIGHT.SET_PENUMBRA";H.SET_POSITION="LIGHT.SET_POSITION";H.SET_TRACKED_ENTITY="LIGHT.SET_TRACKED_ENTITY";H.SET_TRACKED_POSITION="LIGHT.SET_TRACKED_POSITION";H.SPAWN="LIGHT.SPAWN"})(PA||={});class jA extends S0{_id;_angle;_attachedToEntity;_color;_distance;_intensity;_offset;_penumbra;_position;_trackedEntity;_trackedPosition;_type;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)f.fatalError("Either attachedToEntity or position must be set, but not both");super();f.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 f.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 f.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 f.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 b0.serializeLight(this)}}var R41;(($)=>{$[$.FIRST_PERSON=0]="FIRST_PERSON";$[$.THIRD_PERSON=1]="THIRD_PERSON";$[$.SPECTATOR=2]="SPECTATOR"})(R41||={});var DA;((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"})(DA||={});class zV extends S0{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 f.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 b0.serializePlayerCamera(this)}_requirePlayerWorld(){if(!this.player.world)f.error(`PlayerCamera._requirePlayerWorld(): Player ${this.player.id} is not in a world!`);return!!this.player.world}}var SO;((W)=>{W.DATA="PLAYER_UI.DATA";W.LOAD="PLAYER_UI.LOAD";W.LOCK_POINTER="PLAYER_UI.LOCK_POINTER";W.SEND_DATA="PLAYER_UI.SEND_DATA"})(SO||={});class FV extends S0{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 VV{_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);this._cleanupBlockTypeColliderHandles.clear();for(let Z of this._cleanupCollisionCallbackColliderHandles)this._colliderHandleCollisionCallbackMap.delete(Z);this._cleanupCollisionCallbackColliderHandles.clear();for(let Z of this._cleanupEntityColliderHandles)this._colliderHandleEntityMap.delete(Z);this._cleanupEntityColliderHandles.clear(),[[this._pendingCleanupBlockTypeColliderHandles,this._cleanupBlockTypeColliderHandles],[this._pendingCleanupCollisionCallbackColliderHandles,this._cleanupCollisionCallbackColliderHandles],[this._pendingCleanupEntityColliderHandles,this._cleanupEntityColliderHandles]].forEach(([Z,J])=>{for(let Y of Z.keys())J.add(Y);Z.clear()})}_requireSimulatedCollider(Z){if(!Z.rawCollider)f.error("ColliderMap._requireSimulatedCollider(): Collider is not in the simulation.");return!!Z.rawCollider}}var kr8={x:0,y:-32,z:0},CA=60,TA;((W)=>{W.STEP_START="SIMULATION.STEP_START";W.STEP_END="SIMULATION.STEP_END";W.DEBUG_RAYCAST="SIMULATION.DEBUG_RAYCAST";W.DEBUG_RENDER="SIMULATION.DEBUG_RENDER"})(TA||={});class HV extends S0{_colliderMap=new VV;_debugRaycastingEnabled=!1;_debugRenderingEnabled=!1;_rapierEventQueue;_rapierSimulation;_world;constructor(Z,J=CA,Y=kr8){super();this._rapierEventQueue=new r0.EventQueue(!0),this._rapierSimulation=new r0.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 W=new r0.Ray(Z,J),Q=this._rapierSimulation.castRay(W,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:!!Q});if(!Q)return null;let X=W.pointAt(Q.timeOfImpact),K=Q.timeOfImpact,G=Q.collider,z=this._colliderMap.getColliderHandleBlockType(G.handle);if(z)return{hitBlock:FW.fromGlobalCoordinate({x:Math.floor(X.x-(W.dir.x<0?0.0001:-0.0001)),y:Math.floor(X.y-(W.dir.y<0?0.0001:-0.0001)),z:Math.floor(X.z-(W.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,($,W)=>{if($.numContacts()===0)return;let Q=$.normal(),X=[];for(let K=0;K<$.numSolverContacts();K++)X.push($.solverContactPoint(K));Y.push({contactPoints:X,localNormalA:!W?$.localNormal1():$.localNormal2(),localNormalB:!W?$.localNormal2():$.localNormal1(),normal:!W?Q:{x:-Q.x,y:-Q.y,z:-Q.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(a1.startSpan({operation:"physics_step"},()=>{this._rapierSimulation.step(this._rapierEventQueue)}),a1.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[$,W]=this._getCollisionObjects(Z,J);if(!$||!W)return;let Q=(X,K)=>{if(X instanceof P5&&K instanceof _8&&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 _8&&K instanceof P5&&X.hasListeners("ENTITY.BLOCK_COLLISION"))X.emit("ENTITY.BLOCK_COLLISION",{entity:X,blockType:K,started:Y,colliderHandleA:Z,colliderHandleB:J});else if(X instanceof _8&&K instanceof _8&&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 _8||K instanceof P5))X(K,Y,Z,J)};Q($,W),Q(W,$)};_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()},W=(Q,X)=>{if(Q instanceof P5&&X instanceof _8&&Q.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))Q.emit("BLOCK_TYPE.ENTITY_CONTACT_FORCE",{blockType:Q,entity:X,contactForceData:$});else if(Q instanceof _8&&X instanceof P5&&Q.hasListeners("ENTITY.BLOCK_CONTACT_FORCE"))Q.emit("ENTITY.BLOCK_CONTACT_FORCE",{entity:Q,blockType:X,contactForceData:$});else if(Q instanceof _8&&X instanceof _8&&Q.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))Q.emit("ENTITY.ENTITY_CONTACT_FORCE",{entity:Q,otherEntity:X,contactForceData:$})};W(J,Y),W(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 _O{_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;a1.startSpan({operation:"build_packets"},()=>{this._queuedPerPlayerSynchronizations.forEach((H,q)=>{this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(...H)});let $=Object.values(this._queuedEntitySynchronizations);if($.length>0){let[H,q]=$.reduce(([U,L],w)=>{for(let O in w)if(O!=="i"&&O!=="p"&&O!=="r")return U.push(w),[U,L];return L.push(w),[U,L]},[[],[]]);if(q.length>0){let U=s.createPacket(s.outboundPackets.entitiesPacketDefinition,q,Y);J.push(U)}if(H.length>0){let U=s.createPacket(s.outboundPackets.entitiesPacketDefinition,H,Y);Z.push(U),this._synchronizedPlayerReliablePackets.forEach((L)=>L.push(U))}}let W=Object.values(this._queuedAudioSynchronizations);if(W.length>0){let H=s.createPacket(s.outboundPackets.audiosPacketDefinition,W,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}let Q=Object.values(this._queuedBlockTypeSynchronizations);if(Q.length>0){let H=s.createPacket(s.outboundPackets.blockTypesPacketDefinition,Q,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}let X=Object.values(this._queuedBlockSynchronizations);if(X.length>0){let H=s.createPacket(s.outboundPackets.blocksPacketDefinition,X,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}let K=Object.values(this._queuedChunkSynchronizations);if(K.length>0){let H=s.createPacket(s.outboundPackets.chunksPacketDefinition,K,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}let G=Object.values(this._queuedLightSynchronizations);if(G.length>0){let H=s.createPacket(s.outboundPackets.lightsPacketDefinition,G,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}this._queuedPerPlayerUISynchronizations.forEach((H,q)=>{let U=s.createPacket(s.outboundPackets.uiPacketDefinition,H,Y);this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(U)}),this._queuedPerPlayerUIDatasSynchronizations.forEach((H,q)=>{let U=s.createPacket(s.outboundPackets.uiDatasPacketDefinition,H,Y);this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(U)});let z=Object.values(this._queuedSceneUISynchronizations);if(z.length>0){let H=s.createPacket(s.outboundPackets.sceneUIsPacketDefinition,z,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}if(this._queuedWorldSynchronization){let H=s.createPacket(s.outboundPackets.worldPacketDefinition,this._queuedWorldSynchronization,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}this._queuedPerPlayerCameraSynchronizations.forEach((H,q)=>{let U=s.createPacket(s.outboundPackets.cameraPacketDefinition,H,Y);this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(U)});let F=Object.values(this._queuedPlayerSynchronizations);if(F.length>0){let H=s.createPacket(s.outboundPackets.playersPacketDefinition,F,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}this._queuedBroadcasts.forEach((H)=>{Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))});let V=this._queuedDebugRaycastSynchronizations;if(V.length>0){let H=s.createPacket(s.outboundPackets.physicsDebugRaycastsPacketDefinition,V,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}}),a1.startSpan({operation:"send_all_packets"},()=>{D5.instance.getConnectedPlayersByWorld(this._world).forEach(($)=>{let W=this._synchronizedPlayerReliablePackets.get($)??Z;if(W.length>0)$.connection.send(W);if(J.length>0)$.connection.send(J,!1)})}),a1.startSpan({operation:"network_synchronize_cleanup"},()=>{this._queuedBroadcasts=[],this._queuedAudioSynchronizations={},this._queuedBlockSynchronizations={},this._queuedBlockTypeSynchronizations={},this._queuedChunkSynchronizations={},this._queuedDebugRaycastSynchronizations=[],this._queuedEntitySynchronizations={},this._queuedLightSynchronizations={},this._queuedPerPlayerSynchronizations.clear(),this._queuedPerPlayerCameraSynchronizations.clear(),this._queuedPerPlayerUISynchronizations.clear(),this._queuedPerPlayerUIDatasSynchronizations.clear(),this._queuedPlayerSynchronizations={},this._queuedSceneUISynchronizations={},this._queuedWorldSynchronization=void 0,this._loadedSceneUIs.clear(),this._spawnedChunks.clear(),this._spawnedEntities.clear(),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?b0.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(s.createPacket(s.outboundPackets.chatMessagesPacketDefinition,[{m:Y,c:$,p:J?.id}],this._world.loop.currentTick))};_onChatSendPlayerMessage=(Z)=>{let{player:J,message:Y,color:$}=Z,W=this._queuedPerPlayerSynchronizations.get(J)??[];W.push(s.createPacket(s.outboundPackets.chatMessagesPacketDefinition,[{m:Y,c:$}],this._world.loop.currentTick)),this._queuedPerPlayerSynchronizations.set(J,W)};_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?b0.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=b0.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?b0.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?b0.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?b0.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=b0.serializeVector(Z.entity.position),delete J.et,delete J.pt};_onPlayerCameraLookAtPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=Z.position?b0.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?b0.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?b0.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?b0.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(s.createPacket(s.outboundPackets.worldPacketDefinition,this._world.serialize(),this._world.loop.currentTick)),Y.push(s.createPacket(s.outboundPackets.blockTypesPacketDefinition,this._world.blockTypeRegistry.serialize(),this._world.loop.currentTick)),Y.push(s.createPacket(s.outboundPackets.chunksPacketDefinition,this._world.chunkLattice.getAllChunks().map((W)=>W.serialize()),this._world.loop.currentTick)),Y.push(s.createPacket(s.outboundPackets.entitiesPacketDefinition,this._world.entityManager.getAllEntities().map((W)=>{if(J.camera.attachedToEntity===void 0&&W instanceof t4&&W.player===J)J.camera.setAttachedToEntity(W);return W.serialize()}),this._world.loop.currentTick)),Y.push(s.createPacket(s.outboundPackets.audiosPacketDefinition,this._world.audioManager.getAllAudios().map((W)=>W.serialize()),this._world.loop.currentTick)),Y.push(s.createPacket(s.outboundPackets.lightsPacketDefinition,this._world.lightManager.getAllLights().map((W)=>W.serialize()),this._world.loop.currentTick)),Y.push(s.createPacket(s.outboundPackets.sceneUIsPacketDefinition,this._world.sceneUIManager.getAllSceneUIs().map((W)=>W.serialize()),this._world.loop.currentTick)),Y.push(s.createPacket(s.outboundPackets.playersPacketDefinition,D5.instance.getConnectedPlayers().map((W)=>W.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([s.createPacket(s.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?b0.serializeVector(Z.offset):void 0};_onSceneUISetPosition=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.p=Z.position?b0.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(b0.serializePhysicsDebugRaycast(Z))};_onSimulationDebugRender=(Z)=>{this._queuedBroadcasts.push(s.createPacket(s.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=b0.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=b0.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=b0.serializeVector(Z.position)};_createOrGetQueuedAudioSync(Z){if(Z.id===void 0)f.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)f.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)f.fatalError("NetworkSynchronizer._createOrGetQueuedEntitySync(): Entity has no id!");return this._queuedEntitySynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedLightSync(Z){if(Z.id===void 0)f.fatalError("NetworkSynchronizer._createOrGetQueuedLightSync(): Light has no id!");return this._queuedLightSynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedPlayerSync(Z){if(Z.id===void 0)f.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)f.fatalError("NetworkSynchronizer._createOrGetQueuedSceneUISync(): SceneUI has no id!");return this._queuedSceneUISynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedWorldSync(Z){if(Z.id!==this._world.id)f.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 qV{_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 Er8=2,Ir8=3;class UV{_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*Ir8,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 f.warning("Ticker.start(): ticker already running.");this._lastLoopTimeMs=performance.now();let Z=()=>{a1.startSpan({operation:"ticker_tick"},()=>{let J=performance.now(),Y=J-this._lastLoopTimeMs;if(this._lastLoopTimeMs=J,this._accumulatorMs+=Y,this._accumulatorMs>this._maxAccumulatorMs)this._accumulatorMs=this._maxAccumulatorMs;let $=0;while(this._accumulatorMs>=this._fixedTimestepMs&&$<Er8)this._tick(this._fixedTimestepMs),this._accumulatorMs-=this._fixedTimestepMs,$++;this._nextTickMs=this._fixedTimestepMs-this._accumulatorMs}),this._tickHandle=setTimeout(Z,0)};Z()}stop(){if(!this._tickHandle)return f.warning("Ticker.stop(): ticker not running.");clearTimeout(this._tickHandle),this._tickHandle=null}_tick(Z){try{this._tickFunction(Z)}catch(J){if(J instanceof Error&&this._tickErrorCallback)this._tickErrorCallback(J);else f.warning(`Ticker._tick(): tick callback threw an error, but it was not an instance of Error. Error: ${J}`)}}}var N41;((Q)=>{Q.START="WORLD_LOOP.START";Q.STOP="WORLD_LOOP.STOP";Q.TICK_START="WORLD_LOOP.TICK_START";Q.TICK_END="WORLD_LOOP.TICK_END";Q.TICK_ERROR="WORLD_LOOP.TICK_ERROR"})(N41||={});class wV extends S0{_currentTick=0;_ticker;_world;constructor(Z,J=CA){super();this._ticker=new UV(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();a1.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}},()=>{a1.startSpan({operation:"chunks_update"},()=>this._world.chunkLattice.updateChunks()),a1.startSpan({operation:"entities_tick"},()=>this._world.entityManager.tickEntities(Z)),a1.startSpan({operation:"simulation_step"},()=>this._world.simulation.step(Z)),a1.startSpan({operation:"entities_emit_updates"},()=>this._world.entityManager.checkAndEmitUpdates()),a1.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)=>{f.error(`WorldLoop._onTickError(): Error: ${Z}`),this.emitWithWorld(this._world,"WORLD_LOOP.TICK_ERROR",{worldLoop:this,error:Z})}}var kA;((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"})(kA||={});class LV extends S0{_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 wK(this),this._blockTypeRegistry=new CG(this),this._chatManager=new BV(this),this._chunkLattice=new $V(this),this._entityManager=new KV(this),this._lightManager=new GV(this),this._loop=new wV(this,Z.tickRate),this._networkSynchronizer=new _O(this),this._sceneUIManager=new qV(this),this._simulation=new HV(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[$,W,Q]=J.split(",").map(Number);this.chunkLattice.setBlock({x:$,y:W,z:Q},Y)}if(Z.entities)for(let[J,Y]of Object.entries(Z.entities)){let[$,W,Q]=J.split(",").map(Number);new _8(Y).spawn(this,{x:$,y:W,z:Q})}}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 b0.serializeWorld(this)}}var vr8=1,P41;((J)=>J.WORLD_CREATED="WORLD_MANAGER.WORLD_CREATED")(P41||={});class GK{static instance=new GK;_worlds=new Map;_nextWorldId=1;createWorld(Z){let J=new LV({...Z,id:this._nextWorldId++});return J.start(),this._worlds.set(J.id,J),n8.emit("WORLD_MANAGER.WORLD_CREATED",{world:J}),J}getAllWorlds(){return Array.from(this._worlds.values())}getDefaultWorld(){return this._worlds.get(vr8)??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 j41;((Y)=>{Y.START="GAMESERVER.START";Y.STOP="GAMESERVER.STOP"})(j41||={});function Sr8(Z){r0.init().then(()=>{return ZZ.instance.modelRegistry.preloadModels()}).then(()=>{Z(ZZ.instance.worldManager.getDefaultWorld()),ZZ.instance.start()}).catch((J)=>{f.fatalError(`Failed to initialize the game engine, exiting. Error: ${J}`)})}class ZZ{static _instance;_modelRegistry=d5.instance;_playerManager=D5.instance;_socket=gZ.instance;_worldManager=GK.instance;_webServer=cQ.instance;constructor(){}static get instance(){if(!this._instance)this._instance=new ZZ;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(){n8.emit("GAMESERVER.START",{startedAtMs:performance.now()}),this._webServer.start()}}class QW{static instance=new QW;constructor(){}async getGlobalData(Z){let J=await I4.instance.getData(Z);if(!J||J.error){if(J?.error)f.warning(`PersistenceManager.getGlobalData(): ${J.error.message}`);return}return J}async getPlayerData(Z){let J=await I4.instance.getData(this._getPlayerKey(Z));if(!J||J.error){if(J?.error)f.warning(`PersistenceManager.getPlayerData(): ${J.error.message}`);return}return J}async setGlobalData(Z,J){let Y=await I4.instance.setData(Z,J);if(!Y||Y.error){if(Y?.error)f.warning(`PersistenceManager.setGlobalData(): ${Y.error.message}`);return}return Y}async setPlayerData(Z,J){let Y=await I4.instance.setData(this._getPlayerKey(Z),J);if(!Y||Y.error){if(Y?.error)f.warning(`PersistenceManager.setPlayerData(): ${Y.error.message}`);return}return Y}_getPlayerKey(Z){return`player-${Z.id}`}}var D41=["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"],XV;((Q)=>{Q.CHAT_MESSAGE_SEND="PLAYER.CHAT_MESSAGE_SEND";Q.JOINED_WORLD="PLAYER.JOINED_WORLD";Q.LEFT_WORLD="PLAYER.LEFT_WORLD";Q.RECONNECTED_WORLD="PLAYER.RECONNECTED_WORLD";Q.REQUEST_SYNC="PLAYER.REQUEST_SYNC"})(XV||={});class XK extends S0{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 zV(this),this.connection=Z,this.ui=new FV(this),Z.onPacket(s.PacketId.CHAT_MESSAGE_SEND,this._onChatMessageSendPacket),Z.onPacket(s.PacketId.DEBUG_CONFIG,this._onDebugConfigPacket),Z.onPacket(s.PacketId.INPUT,this._onInputPacket),Z.onPacket(s.PacketId.SYNC_REQUEST,this._onSyncRequestPacket),Z.onPacket(s.PacketId.UI_DATA_SEND,this._onUIDataSendPacket),this.joinWorld(ZZ.instance.worldManager.getDefaultWorld())}get input(){return this._input}get world(){return this._world}disconnect(){this._leaveWorld(),this.connection.disconnect()}async getPersistedData(){return QW.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 QW.instance.setPlayerData(this,Z)}serialize(){return b0.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(D41.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 EA;((Y)=>{Y.BROADCAST_MESSAGE="CHAT.BROADCAST_MESSAGE";Y.PLAYER_MESSAGE="CHAT.PLAYER_MESSAGE"})(EA||={});class BV extends S0{_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,[$,...W]=Y.split(" "),Q=this._commandCallbacks[$];if(Q){Q(J,W,Y);return}this._sendBroadcastMessage(J,Y)})}_sendBroadcastMessage(Z,J,Y){this.emitWithWorld(this._world,"CHAT.BROADCAST_MESSAGE",{player:Z,message:J,color:Y})}}class OV extends gJ{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 f.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 P5)||!J.isLiquid)this._groundContactCount+=Y?1:-1;if(!this._groundContactCount&&!this.isSwimming)Z.startModelOneshotAnimations(this.jumpOneshotAnimations);else Z.stopModelAnimations(this.jumpOneshotAnimations);if(!(J instanceof _8)||!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:W,a:Q,s:X,d:K,sp:G,sh:z,ml:F}=J,{yaw:V}=Y,H=Z.linearVelocity,q={x:0,y:0,z:0},U=z;if(this.isGrounded&&!this.isSwimming&&(W||Q||X||K)){if(U)Z.stopModelAnimations(Array.from(Z.modelLoopedAnimations).filter((R)=>!this.runLoopedAnimations.includes(R))),Z.startModelLoopedAnimations(this.runLoopedAnimations),this._stepAudio?.setPlaybackRate(0.75);else Z.stopModelAnimations(Array.from(Z.modelLoopedAnimations).filter((R)=>!this.walkLoopedAnimations.includes(R))),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((R)=>!this.idleLoopedAnimations.includes(R))),Z.startModelLoopedAnimations(this.idleLoopedAnimations);if(F)Z.startModelOneshotAnimations(this.interactOneshotAnimations),J.ml=!this.autoCancelMouseLeftClick;if(U&&this.canRun(this)||!U&&this.canWalk(this)){let R=!this.isSwimming?U?this.runVelocity:this.walkVelocity:U?this.swimFastVelocity:this.swimSlowVelocity;if(W)q.x-=R*Math.sin(V),q.z-=R*Math.cos(V);if(X)q.x+=R*Math.sin(V),q.z+=R*Math.cos(V);if(Q)q.x-=R*Math.cos(V),q.z+=R*Math.sin(V);if(K)q.x+=R*Math.cos(V),q.z-=R*Math.sin(V);let N=Math.sqrt(q.x*q.x+q.z*q.z);if(N>R){let P=R/N;q.x*=P,q.z*=P}}if(this.isSwimming){if(H.y<this.swimMaxGravityVelocity)Z.setLinearVelocity({...H,y:this.swimMaxGravityVelocity});if(H.y>this.swimUpwardVelocity*2)Z.setLinearVelocity({...H,y:this.swimUpwardVelocity*2})}if(G&&this.canJump(this)){if(this.isGrounded&&!this.isSwimming&&H.y>-0.001&&H.y<=3)q.y=this.jumpVelocity;else if(this.isSwimming&&performance.now()>this._swimUpwardCooldownAt)q.y=this.swimUpwardVelocity*Z.gravityScale}let L=this._platform?this._platform.linearVelocity:{x:0,y:0,z:0},w={x:q.x-H.x+L.x,y:q.y+L.y,z:q.z-H.z+L.z};if(!(this.runVelocity>0&&Math.abs(H.x)>this.runVelocity||this.jumpVelocity>0&&Math.abs(H.y)>this.jumpVelocity||this.runVelocity>0&&Math.abs(H.z)>this.runVelocity)||this.isOnPlatform){if(Object.values(w).some((R)=>R!==0)){let R=Z.mass;Z.applyImpulse({x:w.x*R,y:w.y*R,z:w.z*R})}}if(V!==void 0){let R=V/2;Z.setRotation({x:0,y:Math.fround(Math.sin(R)),z:0,w:Math.fround(Math.cos(R))})}}}class IA extends t4{constructor(Z){super({modelUri:"models/players/player.gltf",modelLoopedAnimations:["idle_lower","idle_upper"],modelScale:0.5,...Z});if(!Z.controller)this.setController(new OV)}}var L0=0.000001,n0=typeof Float32Array!=="undefined"?Float32Array:Array,e4=Math.random;var cl6=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 C8={};R9(C8,{transpose:()=>br8,subtract:()=>T41,sub:()=>Jt8,str:()=>ir8,set:()=>yr8,scale:()=>cr8,rotate:()=>ur8,multiplyScalarAndAdd:()=>er8,multiplyScalar:()=>tr8,multiply:()=>C41,mul:()=>Zt8,invert:()=>gr8,identity:()=>hr8,fromValues:()=>fr8,fromScaling:()=>pr8,fromRotation:()=>lr8,frob:()=>nr8,exactEquals:()=>or8,equals:()=>rr8,determinant:()=>dr8,create:()=>_r8,copy:()=>Ar8,clone:()=>xr8,adjoint:()=>mr8,add:()=>sr8,LDU:()=>ar8});function _r8(){var Z=new n0(4);if(n0!=Float32Array)Z[1]=0,Z[2]=0;return Z[0]=1,Z[3]=1,Z}function xr8(Z){var J=new n0(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function Ar8(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function hr8(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=1,Z}function fr8(Z,J,Y,$){var W=new n0(4);return W[0]=Z,W[1]=J,W[2]=Y,W[3]=$,W}function yr8(Z,J,Y,$,W){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=W,Z}function br8(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 gr8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=Y*Q-W*$;if(!X)return null;return X=1/X,Z[0]=Q*X,Z[1]=-$*X,Z[2]=-W*X,Z[3]=Y*X,Z}function mr8(Z,J){var Y=J[0];return Z[0]=J[3],Z[1]=-J[1],Z[2]=-J[2],Z[3]=Y,Z}function dr8(Z){return Z[0]*Z[3]-Z[2]*Z[1]}function C41(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=Y[0],G=Y[1],z=Y[2],F=Y[3];return Z[0]=$*K+Q*G,Z[1]=W*K+X*G,Z[2]=$*z+Q*F,Z[3]=W*z+X*F,Z}function ur8(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G+Q*K,Z[1]=W*G+X*K,Z[2]=$*-K+Q*G,Z[3]=W*-K+X*G,Z}function cr8(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=Y[0],G=Y[1];return Z[0]=$*K,Z[1]=W*K,Z[2]=Q*G,Z[3]=X*G,Z}function lr8(Z,J){var Y=Math.sin(J),$=Math.cos(J);return Z[0]=$,Z[1]=Y,Z[2]=-Y,Z[3]=$,Z}function pr8(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=J[1],Z}function ir8(Z){return"mat2("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}function nr8(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3])}function ar8(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 sr8(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 T41(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 or8(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function rr8(Z,J){var Y=Z[0],$=Z[1],W=Z[2],Q=Z[3],X=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(Y-X)<=L0*Math.max(1,Math.abs(Y),Math.abs(X))&&Math.abs($-K)<=L0*Math.max(1,Math.abs($),Math.abs(K))&&Math.abs(W-G)<=L0*Math.max(1,Math.abs(W),Math.abs(G))&&Math.abs(Q-z)<=L0*Math.max(1,Math.abs(Q),Math.abs(z))}function tr8(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 er8(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 Zt8=C41,Jt8=T41;var A1={};R9(A1,{transpose:()=>Gt8,translate:()=>Ht8,subtract:()=>E41,sub:()=>vt8,str:()=>Pt8,set:()=>Xt8,scale:()=>Ut8,rotate:()=>qt8,projection:()=>Nt8,normalFromMat4:()=>Rt8,multiplyScalarAndAdd:()=>Tt8,multiplyScalar:()=>Ct8,multiply:()=>k41,mul:()=>It8,invert:()=>zt8,identity:()=>Kt8,fromValues:()=>Qt8,fromTranslation:()=>wt8,fromScaling:()=>Bt8,fromRotation:()=>Lt8,fromQuat:()=>Mt8,fromMat4:()=>Yt8,fromMat2d:()=>Ot8,frob:()=>jt8,exactEquals:()=>kt8,equals:()=>Et8,determinant:()=>Vt8,create:()=>vA,copy:()=>Wt8,clone:()=>$t8,adjoint:()=>Ft8,add:()=>Dt8});function vA(){var Z=new n0(9);if(n0!=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 Yt8(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 $t8(Z){var J=new n0(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 Wt8(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 Qt8(Z,J,Y,$,W,Q,X,K,G){var z=new n0(9);return z[0]=Z,z[1]=J,z[2]=Y,z[3]=$,z[4]=W,z[5]=Q,z[6]=X,z[7]=K,z[8]=G,z}function Xt8(Z,J,Y,$,W,Q,X,K,G,z){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=W,Z[4]=Q,Z[5]=X,Z[6]=K,Z[7]=G,Z[8]=z,Z}function Kt8(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 Gt8(Z,J){if(Z===J){var Y=J[1],$=J[2],W=J[5];Z[1]=J[3],Z[2]=J[6],Z[3]=Y,Z[5]=J[7],Z[6]=$,Z[7]=W}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 zt8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],V=F*X-K*z,H=-F*Q+K*G,q=z*Q-X*G,U=Y*V+$*H+W*q;if(!U)return null;return U=1/U,Z[0]=V*U,Z[1]=(-F*$+W*z)*U,Z[2]=(K*$-W*X)*U,Z[3]=H*U,Z[4]=(F*Y-W*G)*U,Z[5]=(-K*Y+W*Q)*U,Z[6]=q*U,Z[7]=(-z*Y+$*G)*U,Z[8]=(X*Y-$*Q)*U,Z}function Ft8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=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]=W*z-$*F,Z[2]=$*K-W*X,Z[3]=K*G-Q*F,Z[4]=Y*F-W*G,Z[5]=W*Q-Y*K,Z[6]=Q*z-X*G,Z[7]=$*G-Y*z,Z[8]=Y*X-$*Q,Z}function Vt8(Z){var J=Z[0],Y=Z[1],$=Z[2],W=Z[3],Q=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8];return J*(z*Q-X*G)+Y*(-z*W+X*K)+$*(G*W-Q*K)}function k41(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],V=J[8],H=Y[0],q=Y[1],U=Y[2],L=Y[3],w=Y[4],O=Y[5],R=Y[6],N=Y[7],P=Y[8];return Z[0]=H*$+q*X+U*z,Z[1]=H*W+q*K+U*F,Z[2]=H*Q+q*G+U*V,Z[3]=L*$+w*X+O*z,Z[4]=L*W+w*K+O*F,Z[5]=L*Q+w*G+O*V,Z[6]=R*$+N*X+P*z,Z[7]=R*W+N*K+P*F,Z[8]=R*Q+N*G+P*V,Z}function Ht8(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],V=J[8],H=Y[0],q=Y[1];return Z[0]=$,Z[1]=W,Z[2]=Q,Z[3]=X,Z[4]=K,Z[5]=G,Z[6]=H*$+q*X+z,Z[7]=H*W+q*K+F,Z[8]=H*Q+q*G+V,Z}function qt8(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],V=J[8],H=Math.sin(Y),q=Math.cos(Y);return Z[0]=q*$+H*X,Z[1]=q*W+H*K,Z[2]=q*Q+H*G,Z[3]=q*X-H*$,Z[4]=q*K-H*W,Z[5]=q*G-H*Q,Z[6]=z,Z[7]=F,Z[8]=V,Z}function Ut8(Z,J,Y){var $=Y[0],W=Y[1];return Z[0]=$*J[0],Z[1]=$*J[1],Z[2]=$*J[2],Z[3]=W*J[3],Z[4]=W*J[4],Z[5]=W*J[5],Z[6]=J[6],Z[7]=J[7],Z[8]=J[8],Z}function wt8(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 Lt8(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 Bt8(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 Ot8(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 Mt8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=Y+Y,K=$+$,G=W+W,z=Y*X,F=$*X,V=$*K,H=W*X,q=W*K,U=W*G,L=Q*X,w=Q*K,O=Q*G;return Z[0]=1-V-U,Z[3]=F-O,Z[6]=H+w,Z[1]=F+O,Z[4]=1-z-U,Z[7]=q-L,Z[2]=H-w,Z[5]=q+L,Z[8]=1-z-V,Z}function Rt8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],V=J[9],H=J[10],q=J[11],U=J[12],L=J[13],w=J[14],O=J[15],R=Y*K-$*X,N=Y*G-W*X,P=Y*z-Q*X,D=$*G-W*K,j=$*z-Q*K,C=W*z-Q*G,k=F*L-V*U,I=F*w-H*U,A=F*O-q*U,v=V*w-H*L,x=V*O-q*L,d=H*O-q*w,h=R*d-N*x+P*v+D*A-j*I+C*k;if(!h)return null;return h=1/h,Z[0]=(K*d-G*x+z*v)*h,Z[1]=(G*A-X*d-z*I)*h,Z[2]=(X*x-K*A+z*k)*h,Z[3]=(W*x-$*d-Q*v)*h,Z[4]=(Y*d-W*A+Q*I)*h,Z[5]=($*A-Y*x-Q*k)*h,Z[6]=(L*C-w*j+O*D)*h,Z[7]=(w*P-U*C-O*N)*h,Z[8]=(U*j-L*P+O*R)*h,Z}function Nt8(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 Pt8(Z){return"mat3("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+")"}function jt8(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8])}function Dt8(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 E41(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 Ct8(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 Tt8(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 kt8(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 Et8(Z,J){var Y=Z[0],$=Z[1],W=Z[2],Q=Z[3],X=Z[4],K=Z[5],G=Z[6],z=Z[7],F=Z[8],V=J[0],H=J[1],q=J[2],U=J[3],L=J[4],w=J[5],O=J[6],R=J[7],N=J[8];return Math.abs(Y-V)<=L0*Math.max(1,Math.abs(Y),Math.abs(V))&&Math.abs($-H)<=L0*Math.max(1,Math.abs($),Math.abs(H))&&Math.abs(W-q)<=L0*Math.max(1,Math.abs(W),Math.abs(q))&&Math.abs(Q-U)<=L0*Math.max(1,Math.abs(Q),Math.abs(U))&&Math.abs(X-L)<=L0*Math.max(1,Math.abs(X),Math.abs(L))&&Math.abs(K-w)<=L0*Math.max(1,Math.abs(K),Math.abs(w))&&Math.abs(G-O)<=L0*Math.max(1,Math.abs(G),Math.abs(O))&&Math.abs(z-R)<=L0*Math.max(1,Math.abs(z),Math.abs(R))&&Math.abs(F-N)<=L0*Math.max(1,Math.abs(F),Math.abs(N))}var It8=k41,vt8=E41;var u0={};R9(u0,{transpose:()=>ft8,translate:()=>mt8,targetTo:()=>Ve8,subtract:()=>h41,sub:()=>Re8,str:()=>He8,set:()=>ht8,scale:()=>dt8,rotateZ:()=>pt8,rotateY:()=>lt8,rotateX:()=>ct8,rotate:()=>ut8,perspectiveZO:()=>Xe8,perspectiveNO:()=>x41,perspectiveFromFieldOfView:()=>Ke8,perspective:()=>Qe8,orthoZO:()=>ze8,orthoNO:()=>A41,ortho:()=>Ge8,multiplyScalarAndAdd:()=>Le8,multiplyScalar:()=>we8,multiply:()=>v41,mul:()=>Me8,lookAt:()=>Fe8,invert:()=>yt8,identity:()=>I41,getTranslation:()=>et8,getScaling:()=>_41,getRotation:()=>Ze8,frustum:()=>We8,fromZRotation:()=>rt8,fromYRotation:()=>ot8,fromXRotation:()=>st8,fromValues:()=>At8,fromTranslation:()=>it8,fromScaling:()=>nt8,fromRotationTranslationScaleOrigin:()=>Ye8,fromRotationTranslationScale:()=>Je8,fromRotationTranslation:()=>S41,fromRotation:()=>at8,fromQuat2:()=>tt8,fromQuat:()=>$e8,frob:()=>qe8,exactEquals:()=>Be8,equals:()=>Oe8,determinant:()=>gt8,create:()=>St8,copy:()=>xt8,clone:()=>_t8,adjoint:()=>bt8,add:()=>Ue8});function St8(){var Z=new n0(16);if(n0!=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 _t8(Z){var J=new n0(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 xt8(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 At8(Z,J,Y,$,W,Q,X,K,G,z,F,V,H,q,U,L){var w=new n0(16);return w[0]=Z,w[1]=J,w[2]=Y,w[3]=$,w[4]=W,w[5]=Q,w[6]=X,w[7]=K,w[8]=G,w[9]=z,w[10]=F,w[11]=V,w[12]=H,w[13]=q,w[14]=U,w[15]=L,w}function ht8(Z,J,Y,$,W,Q,X,K,G,z,F,V,H,q,U,L,w){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=W,Z[4]=Q,Z[5]=X,Z[6]=K,Z[7]=G,Z[8]=z,Z[9]=F,Z[10]=V,Z[11]=H,Z[12]=q,Z[13]=U,Z[14]=L,Z[15]=w,Z}function I41(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 ft8(Z,J){if(Z===J){var Y=J[1],$=J[2],W=J[3],Q=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]=Q,Z[11]=J[14],Z[12]=W,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 yt8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],V=J[9],H=J[10],q=J[11],U=J[12],L=J[13],w=J[14],O=J[15],R=Y*K-$*X,N=Y*G-W*X,P=Y*z-Q*X,D=$*G-W*K,j=$*z-Q*K,C=W*z-Q*G,k=F*L-V*U,I=F*w-H*U,A=F*O-q*U,v=V*w-H*L,x=V*O-q*L,d=H*O-q*w,h=R*d-N*x+P*v+D*A-j*I+C*k;if(!h)return null;return h=1/h,Z[0]=(K*d-G*x+z*v)*h,Z[1]=(W*x-$*d-Q*v)*h,Z[2]=(L*C-w*j+O*D)*h,Z[3]=(H*j-V*C-q*D)*h,Z[4]=(G*A-X*d-z*I)*h,Z[5]=(Y*d-W*A+Q*I)*h,Z[6]=(w*P-U*C-O*N)*h,Z[7]=(F*C-H*P+q*N)*h,Z[8]=(X*x-K*A+z*k)*h,Z[9]=($*A-Y*x-Q*k)*h,Z[10]=(U*j-L*P+O*R)*h,Z[11]=(V*P-F*j-q*R)*h,Z[12]=(K*I-X*v-G*k)*h,Z[13]=(Y*v-$*I+W*k)*h,Z[14]=(L*N-U*D-w*R)*h,Z[15]=(F*D-V*N+H*R)*h,Z}function bt8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],V=J[9],H=J[10],q=J[11],U=J[12],L=J[13],w=J[14],O=J[15];return Z[0]=K*(H*O-q*w)-V*(G*O-z*w)+L*(G*q-z*H),Z[1]=-($*(H*O-q*w)-V*(W*O-Q*w)+L*(W*q-Q*H)),Z[2]=$*(G*O-z*w)-K*(W*O-Q*w)+L*(W*z-Q*G),Z[3]=-($*(G*q-z*H)-K*(W*q-Q*H)+V*(W*z-Q*G)),Z[4]=-(X*(H*O-q*w)-F*(G*O-z*w)+U*(G*q-z*H)),Z[5]=Y*(H*O-q*w)-F*(W*O-Q*w)+U*(W*q-Q*H),Z[6]=-(Y*(G*O-z*w)-X*(W*O-Q*w)+U*(W*z-Q*G)),Z[7]=Y*(G*q-z*H)-X*(W*q-Q*H)+F*(W*z-Q*G),Z[8]=X*(V*O-q*L)-F*(K*O-z*L)+U*(K*q-z*V),Z[9]=-(Y*(V*O-q*L)-F*($*O-Q*L)+U*($*q-Q*V)),Z[10]=Y*(K*O-z*L)-X*($*O-Q*L)+U*($*z-Q*K),Z[11]=-(Y*(K*q-z*V)-X*($*q-Q*V)+F*($*z-Q*K)),Z[12]=-(X*(V*w-H*L)-F*(K*w-G*L)+U*(K*H-G*V)),Z[13]=Y*(V*w-H*L)-F*($*w-W*L)+U*($*H-W*V),Z[14]=-(Y*(K*w-G*L)-X*($*w-W*L)+U*($*G-W*K)),Z[15]=Y*(K*H-G*V)-X*($*H-W*V)+F*($*G-W*K),Z}function gt8(Z){var J=Z[0],Y=Z[1],$=Z[2],W=Z[3],Q=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],F=Z[9],V=Z[10],H=Z[11],q=Z[12],U=Z[13],L=Z[14],w=Z[15],O=J*X-Y*Q,R=J*K-$*Q,N=J*G-W*Q,P=Y*K-$*X,D=Y*G-W*X,j=$*G-W*K,C=z*U-F*q,k=z*L-V*q,I=z*w-H*q,A=F*L-V*U,v=F*w-H*U,x=V*w-H*L;return O*x-R*v+N*A+P*I-D*k+j*C}function v41(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],V=J[8],H=J[9],q=J[10],U=J[11],L=J[12],w=J[13],O=J[14],R=J[15],N=Y[0],P=Y[1],D=Y[2],j=Y[3];return Z[0]=N*$+P*K+D*V+j*L,Z[1]=N*W+P*G+D*H+j*w,Z[2]=N*Q+P*z+D*q+j*O,Z[3]=N*X+P*F+D*U+j*R,N=Y[4],P=Y[5],D=Y[6],j=Y[7],Z[4]=N*$+P*K+D*V+j*L,Z[5]=N*W+P*G+D*H+j*w,Z[6]=N*Q+P*z+D*q+j*O,Z[7]=N*X+P*F+D*U+j*R,N=Y[8],P=Y[9],D=Y[10],j=Y[11],Z[8]=N*$+P*K+D*V+j*L,Z[9]=N*W+P*G+D*H+j*w,Z[10]=N*Q+P*z+D*q+j*O,Z[11]=N*X+P*F+D*U+j*R,N=Y[12],P=Y[13],D=Y[14],j=Y[15],Z[12]=N*$+P*K+D*V+j*L,Z[13]=N*W+P*G+D*H+j*w,Z[14]=N*Q+P*z+D*q+j*O,Z[15]=N*X+P*F+D*U+j*R,Z}function mt8(Z,J,Y){var $=Y[0],W=Y[1],Q=Y[2],X,K,G,z,F,V,H,q,U,L,w,O;if(J===Z)Z[12]=J[0]*$+J[4]*W+J[8]*Q+J[12],Z[13]=J[1]*$+J[5]*W+J[9]*Q+J[13],Z[14]=J[2]*$+J[6]*W+J[10]*Q+J[14],Z[15]=J[3]*$+J[7]*W+J[11]*Q+J[15];else X=J[0],K=J[1],G=J[2],z=J[3],F=J[4],V=J[5],H=J[6],q=J[7],U=J[8],L=J[9],w=J[10],O=J[11],Z[0]=X,Z[1]=K,Z[2]=G,Z[3]=z,Z[4]=F,Z[5]=V,Z[6]=H,Z[7]=q,Z[8]=U,Z[9]=L,Z[10]=w,Z[11]=O,Z[12]=X*$+F*W+U*Q+J[12],Z[13]=K*$+V*W+L*Q+J[13],Z[14]=G*$+H*W+w*Q+J[14],Z[15]=z*$+q*W+O*Q+J[15];return Z}function dt8(Z,J,Y){var $=Y[0],W=Y[1],Q=Y[2];return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z[3]=J[3]*$,Z[4]=J[4]*W,Z[5]=J[5]*W,Z[6]=J[6]*W,Z[7]=J[7]*W,Z[8]=J[8]*Q,Z[9]=J[9]*Q,Z[10]=J[10]*Q,Z[11]=J[11]*Q,Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15],Z}function ut8(Z,J,Y,$){var W=$[0],Q=$[1],X=$[2],K=Math.hypot(W,Q,X),G,z,F,V,H,q,U,L,w,O,R,N,P,D,j,C,k,I,A,v,x,d,h,u;if(K<L0)return null;if(K=1/K,W*=K,Q*=K,X*=K,G=Math.sin(Y),z=Math.cos(Y),F=1-z,V=J[0],H=J[1],q=J[2],U=J[3],L=J[4],w=J[5],O=J[6],R=J[7],N=J[8],P=J[9],D=J[10],j=J[11],C=W*W*F+z,k=Q*W*F+X*G,I=X*W*F-Q*G,A=W*Q*F-X*G,v=Q*Q*F+z,x=X*Q*F+W*G,d=W*X*F+Q*G,h=Q*X*F-W*G,u=X*X*F+z,Z[0]=V*C+L*k+N*I,Z[1]=H*C+w*k+P*I,Z[2]=q*C+O*k+D*I,Z[3]=U*C+R*k+j*I,Z[4]=V*A+L*v+N*x,Z[5]=H*A+w*v+P*x,Z[6]=q*A+O*v+D*x,Z[7]=U*A+R*v+j*x,Z[8]=V*d+L*h+N*u,Z[9]=H*d+w*h+P*u,Z[10]=q*d+O*h+D*u,Z[11]=U*d+R*h+j*u,J!==Z)Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z}function ct8(Z,J,Y){var $=Math.sin(Y),W=Math.cos(Y),Q=J[4],X=J[5],K=J[6],G=J[7],z=J[8],F=J[9],V=J[10],H=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]=Q*W+z*$,Z[5]=X*W+F*$,Z[6]=K*W+V*$,Z[7]=G*W+H*$,Z[8]=z*W-Q*$,Z[9]=F*W-X*$,Z[10]=V*W-K*$,Z[11]=H*W-G*$,Z}function lt8(Z,J,Y){var $=Math.sin(Y),W=Math.cos(Y),Q=J[0],X=J[1],K=J[2],G=J[3],z=J[8],F=J[9],V=J[10],H=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]=Q*W-z*$,Z[1]=X*W-F*$,Z[2]=K*W-V*$,Z[3]=G*W-H*$,Z[8]=Q*$+z*W,Z[9]=X*$+F*W,Z[10]=K*$+V*W,Z[11]=G*$+H*W,Z}function pt8(Z,J,Y){var $=Math.sin(Y),W=Math.cos(Y),Q=J[0],X=J[1],K=J[2],G=J[3],z=J[4],F=J[5],V=J[6],H=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]=Q*W+z*$,Z[1]=X*W+F*$,Z[2]=K*W+V*$,Z[3]=G*W+H*$,Z[4]=z*W-Q*$,Z[5]=F*W-X*$,Z[6]=V*W-K*$,Z[7]=H*W-G*$,Z}function it8(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 nt8(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 at8(Z,J,Y){var $=Y[0],W=Y[1],Q=Y[2],X=Math.hypot($,W,Q),K,G,z;if(X<L0)return null;return X=1/X,$*=X,W*=X,Q*=X,K=Math.sin(J),G=Math.cos(J),z=1-G,Z[0]=$*$*z+G,Z[1]=W*$*z+Q*K,Z[2]=Q*$*z-W*K,Z[3]=0,Z[4]=$*W*z-Q*K,Z[5]=W*W*z+G,Z[6]=Q*W*z+$*K,Z[7]=0,Z[8]=$*Q*z+W*K,Z[9]=W*Q*z-$*K,Z[10]=Q*Q*z+G,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function st8(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 ot8(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 rt8(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 S41(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=$+$,G=W+W,z=Q+Q,F=$*K,V=$*G,H=$*z,q=W*G,U=W*z,L=Q*z,w=X*K,O=X*G,R=X*z;return Z[0]=1-(q+L),Z[1]=V+R,Z[2]=H-O,Z[3]=0,Z[4]=V-R,Z[5]=1-(F+L),Z[6]=U+w,Z[7]=0,Z[8]=H+O,Z[9]=U-w,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 tt8(Z,J){var Y=new n0(3),$=-J[0],W=-J[1],Q=-J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],V=$*$+W*W+Q*Q+X*X;if(V>0)Y[0]=(K*X+F*$+G*Q-z*W)*2/V,Y[1]=(G*X+F*W+z*$-K*Q)*2/V,Y[2]=(z*X+F*Q+K*W-G*$)*2/V;else Y[0]=(K*X+F*$+G*Q-z*W)*2,Y[1]=(G*X+F*W+z*$-K*Q)*2,Y[2]=(z*X+F*Q+K*W-G*$)*2;return S41(Z,J,Y),Z}function et8(Z,J){return Z[0]=J[12],Z[1]=J[13],Z[2]=J[14],Z}function _41(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[4],X=J[5],K=J[6],G=J[8],z=J[9],F=J[10];return Z[0]=Math.hypot(Y,$,W),Z[1]=Math.hypot(Q,X,K),Z[2]=Math.hypot(G,z,F),Z}function Ze8(Z,J){var Y=new n0(3);_41(Y,J);var $=1/Y[0],W=1/Y[1],Q=1/Y[2],X=J[0]*$,K=J[1]*W,G=J[2]*Q,z=J[4]*$,F=J[5]*W,V=J[6]*Q,H=J[8]*$,q=J[9]*W,U=J[10]*Q,L=X+F+U,w=0;if(L>0)w=Math.sqrt(L+1)*2,Z[3]=0.25*w,Z[0]=(V-q)/w,Z[1]=(H-G)/w,Z[2]=(K-z)/w;else if(X>F&&X>U)w=Math.sqrt(1+X-F-U)*2,Z[3]=(V-q)/w,Z[0]=0.25*w,Z[1]=(K+z)/w,Z[2]=(H+G)/w;else if(F>U)w=Math.sqrt(1+F-X-U)*2,Z[3]=(H-G)/w,Z[0]=(K+z)/w,Z[1]=0.25*w,Z[2]=(V+q)/w;else w=Math.sqrt(1+U-X-F)*2,Z[3]=(K-z)/w,Z[0]=(H+G)/w,Z[1]=(V+q)/w,Z[2]=0.25*w;return Z}function Je8(Z,J,Y,$){var W=J[0],Q=J[1],X=J[2],K=J[3],G=W+W,z=Q+Q,F=X+X,V=W*G,H=W*z,q=W*F,U=Q*z,L=Q*F,w=X*F,O=K*G,R=K*z,N=K*F,P=$[0],D=$[1],j=$[2];return Z[0]=(1-(U+w))*P,Z[1]=(H+N)*P,Z[2]=(q-R)*P,Z[3]=0,Z[4]=(H-N)*D,Z[5]=(1-(V+w))*D,Z[6]=(L+O)*D,Z[7]=0,Z[8]=(q+R)*j,Z[9]=(L-O)*j,Z[10]=(1-(V+U))*j,Z[11]=0,Z[12]=Y[0],Z[13]=Y[1],Z[14]=Y[2],Z[15]=1,Z}function Ye8(Z,J,Y,$,W){var Q=J[0],X=J[1],K=J[2],G=J[3],z=Q+Q,F=X+X,V=K+K,H=Q*z,q=Q*F,U=Q*V,L=X*F,w=X*V,O=K*V,R=G*z,N=G*F,P=G*V,D=$[0],j=$[1],C=$[2],k=W[0],I=W[1],A=W[2],v=(1-(L+O))*D,x=(q+P)*D,d=(U-N)*D,h=(q-P)*j,u=(1-(H+O))*j,W0=(w+R)*j,U0=(U+N)*C,B0=(w-R)*C,y0=(1-(H+L))*C;return Z[0]=v,Z[1]=x,Z[2]=d,Z[3]=0,Z[4]=h,Z[5]=u,Z[6]=W0,Z[7]=0,Z[8]=U0,Z[9]=B0,Z[10]=y0,Z[11]=0,Z[12]=Y[0]+k-(v*k+h*I+U0*A),Z[13]=Y[1]+I-(x*k+u*I+B0*A),Z[14]=Y[2]+A-(d*k+W0*I+y0*A),Z[15]=1,Z}function $e8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=Y+Y,K=$+$,G=W+W,z=Y*X,F=$*X,V=$*K,H=W*X,q=W*K,U=W*G,L=Q*X,w=Q*K,O=Q*G;return Z[0]=1-V-U,Z[1]=F+O,Z[2]=H-w,Z[3]=0,Z[4]=F-O,Z[5]=1-z-U,Z[6]=q+L,Z[7]=0,Z[8]=H+w,Z[9]=q-L,Z[10]=1-z-V,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function We8(Z,J,Y,$,W,Q,X){var K=1/(Y-J),G=1/(W-$),z=1/(Q-X);return Z[0]=Q*2*K,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=Q*2*G,Z[6]=0,Z[7]=0,Z[8]=(Y+J)*K,Z[9]=(W+$)*G,Z[10]=(X+Q)*z,Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=X*Q*2*z,Z[15]=0,Z}function x41(Z,J,Y,$,W){var Q=1/Math.tan(J/2),X;if(Z[0]=Q/Y,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=Q,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[11]=-1,Z[12]=0,Z[13]=0,Z[15]=0,W!=null&&W!==1/0)X=1/($-W),Z[10]=(W+$)*X,Z[14]=2*W*$*X;else Z[10]=-1,Z[14]=-2*$;return Z}var Qe8=x41;function Xe8(Z,J,Y,$,W){var Q=1/Math.tan(J/2),X;if(Z[0]=Q/Y,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=Q,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[11]=-1,Z[12]=0,Z[13]=0,Z[15]=0,W!=null&&W!==1/0)X=1/($-W),Z[10]=W*X,Z[14]=W*$*X;else Z[10]=-1,Z[14]=-$;return Z}function Ke8(Z,J,Y,$){var W=Math.tan(J.upDegrees*Math.PI/180),Q=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/(W+Q);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]=(W-Q)*z*0.5,Z[10]=$/(Y-$),Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=$*Y/(Y-$),Z[15]=0,Z}function A41(Z,J,Y,$,W,Q,X){var K=1/(J-Y),G=1/($-W),z=1/(Q-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]=(W+$)*G,Z[14]=(X+Q)*z,Z[15]=1,Z}var Ge8=A41;function ze8(Z,J,Y,$,W,Q,X){var K=1/(J-Y),G=1/($-W),z=1/(Q-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]=(W+$)*G,Z[14]=Q*z,Z[15]=1,Z}function Fe8(Z,J,Y,$){var W,Q,X,K,G,z,F,V,H,q,U=J[0],L=J[1],w=J[2],O=$[0],R=$[1],N=$[2],P=Y[0],D=Y[1],j=Y[2];if(Math.abs(U-P)<L0&&Math.abs(L-D)<L0&&Math.abs(w-j)<L0)return I41(Z);if(F=U-P,V=L-D,H=w-j,q=1/Math.hypot(F,V,H),F*=q,V*=q,H*=q,W=R*H-N*V,Q=N*F-O*H,X=O*V-R*F,q=Math.hypot(W,Q,X),!q)W=0,Q=0,X=0;else q=1/q,W*=q,Q*=q,X*=q;if(K=V*X-H*Q,G=H*W-F*X,z=F*Q-V*W,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]=W,Z[1]=K,Z[2]=F,Z[3]=0,Z[4]=Q,Z[5]=G,Z[6]=V,Z[7]=0,Z[8]=X,Z[9]=z,Z[10]=H,Z[11]=0,Z[12]=-(W*U+Q*L+X*w),Z[13]=-(K*U+G*L+z*w),Z[14]=-(F*U+V*L+H*w),Z[15]=1,Z}function Ve8(Z,J,Y,$){var W=J[0],Q=J[1],X=J[2],K=$[0],G=$[1],z=$[2],F=W-Y[0],V=Q-Y[1],H=X-Y[2],q=F*F+V*V+H*H;if(q>0)q=1/Math.sqrt(q),F*=q,V*=q,H*=q;var U=G*H-z*V,L=z*F-K*H,w=K*V-G*F;if(q=U*U+L*L+w*w,q>0)q=1/Math.sqrt(q),U*=q,L*=q,w*=q;return Z[0]=U,Z[1]=L,Z[2]=w,Z[3]=0,Z[4]=V*w-H*L,Z[5]=H*U-F*w,Z[6]=F*L-V*U,Z[7]=0,Z[8]=F,Z[9]=V,Z[10]=H,Z[11]=0,Z[12]=W,Z[13]=Q,Z[14]=X,Z[15]=1,Z}function He8(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 qe8(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 Ue8(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 h41(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 we8(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 Le8(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 Be8(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 Oe8(Z,J){var Y=Z[0],$=Z[1],W=Z[2],Q=Z[3],X=Z[4],K=Z[5],G=Z[6],z=Z[7],F=Z[8],V=Z[9],H=Z[10],q=Z[11],U=Z[12],L=Z[13],w=Z[14],O=Z[15],R=J[0],N=J[1],P=J[2],D=J[3],j=J[4],C=J[5],k=J[6],I=J[7],A=J[8],v=J[9],x=J[10],d=J[11],h=J[12],u=J[13],W0=J[14],U0=J[15];return Math.abs(Y-R)<=L0*Math.max(1,Math.abs(Y),Math.abs(R))&&Math.abs($-N)<=L0*Math.max(1,Math.abs($),Math.abs(N))&&Math.abs(W-P)<=L0*Math.max(1,Math.abs(W),Math.abs(P))&&Math.abs(Q-D)<=L0*Math.max(1,Math.abs(Q),Math.abs(D))&&Math.abs(X-j)<=L0*Math.max(1,Math.abs(X),Math.abs(j))&&Math.abs(K-C)<=L0*Math.max(1,Math.abs(K),Math.abs(C))&&Math.abs(G-k)<=L0*Math.max(1,Math.abs(G),Math.abs(k))&&Math.abs(z-I)<=L0*Math.max(1,Math.abs(z),Math.abs(I))&&Math.abs(F-A)<=L0*Math.max(1,Math.abs(F),Math.abs(A))&&Math.abs(V-v)<=L0*Math.max(1,Math.abs(V),Math.abs(v))&&Math.abs(H-x)<=L0*Math.max(1,Math.abs(H),Math.abs(x))&&Math.abs(q-d)<=L0*Math.max(1,Math.abs(q),Math.abs(d))&&Math.abs(U-h)<=L0*Math.max(1,Math.abs(U),Math.abs(h))&&Math.abs(L-u)<=L0*Math.max(1,Math.abs(L),Math.abs(u))&&Math.abs(w-W0)<=L0*Math.max(1,Math.abs(w),Math.abs(W0))&&Math.abs(O-U0)<=L0*Math.max(1,Math.abs(O),Math.abs(U0))}var Me8=v41,Re8=h41;var V1={};R9(V1,{str:()=>L06,squaredLength:()=>F71,sqrLen:()=>C06,sqlerp:()=>I06,slerp:()=>fO,setAxisAngle:()=>Y71,setAxes:()=>v06,set:()=>R06,scale:()=>K71,rotationTo:()=>E06,rotateZ:()=>z06,rotateY:()=>G06,rotateX:()=>K06,random:()=>H06,pow:()=>V06,normalize:()=>AA,multiply:()=>$71,mul:()=>P06,ln:()=>Q71,lerp:()=>j06,length:()=>z71,len:()=>D06,invert:()=>q06,identity:()=>W06,getAxisAngle:()=>Q06,getAngle:()=>X06,fromValues:()=>O06,fromMat3:()=>X71,fromEuler:()=>w06,exp:()=>W71,exactEquals:()=>T06,equals:()=>k06,dot:()=>G71,create:()=>xA,copy:()=>M06,conjugate:()=>U06,clone:()=>B06,calculateW:()=>F06,add:()=>N06});var l0={};R9(l0,{zero:()=>pe8,transformQuat:()=>me8,transformMat4:()=>be8,transformMat3:()=>ge8,subtract:()=>y41,sub:()=>se8,str:()=>ie8,squaredLength:()=>u41,squaredDistance:()=>d41,sqrLen:()=>Z06,sqrDist:()=>ee8,set:()=>je8,scaleAndAdd:()=>Se8,scale:()=>ve8,round:()=>Ie8,rotateZ:()=>ce8,rotateY:()=>ue8,rotateX:()=>de8,random:()=>ye8,normalize:()=>SA,negate:()=>_e8,multiply:()=>b41,mul:()=>oe8,min:()=>ke8,max:()=>Ee8,lerp:()=>Ae8,length:()=>f41,len:()=>_A,inverse:()=>xe8,hermite:()=>he8,fromValues:()=>AO,forEach:()=>J06,floor:()=>Te8,exactEquals:()=>ne8,equals:()=>ae8,dot:()=>hO,divide:()=>g41,div:()=>re8,distance:()=>m41,dist:()=>te8,cross:()=>MV,create:()=>xO,copy:()=>Pe8,clone:()=>Ne8,ceil:()=>Ce8,bezier:()=>fe8,angle:()=>le8,add:()=>De8});function xO(){var Z=new n0(3);if(n0!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function Ne8(Z){var J=new n0(3);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J}function f41(Z){var J=Z[0],Y=Z[1],$=Z[2];return Math.hypot(J,Y,$)}function AO(Z,J,Y){var $=new n0(3);return $[0]=Z,$[1]=J,$[2]=Y,$}function Pe8(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z}function je8(Z,J,Y,$){return Z[0]=J,Z[1]=Y,Z[2]=$,Z}function De8(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z[2]=J[2]+Y[2],Z}function y41(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z[2]=J[2]-Y[2],Z}function b41(Z,J,Y){return Z[0]=J[0]*Y[0],Z[1]=J[1]*Y[1],Z[2]=J[2]*Y[2],Z}function g41(Z,J,Y){return Z[0]=J[0]/Y[0],Z[1]=J[1]/Y[1],Z[2]=J[2]/Y[2],Z}function Ce8(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z[2]=Math.ceil(J[2]),Z}function Te8(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z[2]=Math.floor(J[2]),Z}function ke8(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 Ee8(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 Ie8(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z[2]=Math.round(J[2]),Z}function ve8(Z,J,Y){return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z[2]=J[2]*Y,Z}function Se8(Z,J,Y,$){return Z[0]=J[0]+Y[0]*$,Z[1]=J[1]+Y[1]*$,Z[2]=J[2]+Y[2]*$,Z}function m41(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1],W=J[2]-Z[2];return Math.hypot(Y,$,W)}function d41(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1],W=J[2]-Z[2];return Y*Y+$*$+W*W}function u41(Z){var J=Z[0],Y=Z[1],$=Z[2];return J*J+Y*Y+$*$}function _e8(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z}function xe8(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z[2]=1/J[2],Z}function SA(Z,J){var Y=J[0],$=J[1],W=J[2],Q=Y*Y+$*$+W*W;if(Q>0)Q=1/Math.sqrt(Q);return Z[0]=J[0]*Q,Z[1]=J[1]*Q,Z[2]=J[2]*Q,Z}function hO(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]}function MV(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=Y[0],K=Y[1],G=Y[2];return Z[0]=W*G-Q*K,Z[1]=Q*X-$*G,Z[2]=$*K-W*X,Z}function Ae8(Z,J,Y,$){var W=J[0],Q=J[1],X=J[2];return Z[0]=W+$*(Y[0]-W),Z[1]=Q+$*(Y[1]-Q),Z[2]=X+$*(Y[2]-X),Z}function he8(Z,J,Y,$,W,Q){var X=Q*Q,K=X*(2*Q-3)+1,G=X*(Q-2)+Q,z=X*(Q-1),F=X*(3-2*Q);return Z[0]=J[0]*K+Y[0]*G+$[0]*z+W[0]*F,Z[1]=J[1]*K+Y[1]*G+$[1]*z+W[1]*F,Z[2]=J[2]*K+Y[2]*G+$[2]*z+W[2]*F,Z}function fe8(Z,J,Y,$,W,Q){var X=1-Q,K=X*X,G=Q*Q,z=K*X,F=3*Q*K,V=3*G*X,H=G*Q;return Z[0]=J[0]*z+Y[0]*F+$[0]*V+W[0]*H,Z[1]=J[1]*z+Y[1]*F+$[1]*V+W[1]*H,Z[2]=J[2]*z+Y[2]*F+$[2]*V+W[2]*H,Z}function ye8(Z,J){J=J||1;var Y=e4()*2*Math.PI,$=e4()*2-1,W=Math.sqrt(1-$*$)*J;return Z[0]=Math.cos(Y)*W,Z[1]=Math.sin(Y)*W,Z[2]=$*J,Z}function be8(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=Y[3]*$+Y[7]*W+Y[11]*Q+Y[15];return X=X||1,Z[0]=(Y[0]*$+Y[4]*W+Y[8]*Q+Y[12])/X,Z[1]=(Y[1]*$+Y[5]*W+Y[9]*Q+Y[13])/X,Z[2]=(Y[2]*$+Y[6]*W+Y[10]*Q+Y[14])/X,Z}function ge8(Z,J,Y){var $=J[0],W=J[1],Q=J[2];return Z[0]=$*Y[0]+W*Y[3]+Q*Y[6],Z[1]=$*Y[1]+W*Y[4]+Q*Y[7],Z[2]=$*Y[2]+W*Y[5]+Q*Y[8],Z}function me8(Z,J,Y){var $=Y[0],W=Y[1],Q=Y[2],X=Y[3],K=J[0],G=J[1],z=J[2],F=W*z-Q*G,V=Q*K-$*z,H=$*G-W*K,q=W*H-Q*V,U=Q*F-$*H,L=$*V-W*F,w=X*2;return F*=w,V*=w,H*=w,q*=2,U*=2,L*=2,Z[0]=K+F+q,Z[1]=G+V+U,Z[2]=z+H+L,Z}function de8(Z,J,Y,$){var W=[],Q=[];return W[0]=J[0]-Y[0],W[1]=J[1]-Y[1],W[2]=J[2]-Y[2],Q[0]=W[0],Q[1]=W[1]*Math.cos($)-W[2]*Math.sin($),Q[2]=W[1]*Math.sin($)+W[2]*Math.cos($),Z[0]=Q[0]+Y[0],Z[1]=Q[1]+Y[1],Z[2]=Q[2]+Y[2],Z}function ue8(Z,J,Y,$){var W=[],Q=[];return W[0]=J[0]-Y[0],W[1]=J[1]-Y[1],W[2]=J[2]-Y[2],Q[0]=W[2]*Math.sin($)+W[0]*Math.cos($),Q[1]=W[1],Q[2]=W[2]*Math.cos($)-W[0]*Math.sin($),Z[0]=Q[0]+Y[0],Z[1]=Q[1]+Y[1],Z[2]=Q[2]+Y[2],Z}function ce8(Z,J,Y,$){var W=[],Q=[];return W[0]=J[0]-Y[0],W[1]=J[1]-Y[1],W[2]=J[2]-Y[2],Q[0]=W[0]*Math.cos($)-W[1]*Math.sin($),Q[1]=W[0]*Math.sin($)+W[1]*Math.cos($),Q[2]=W[2],Z[0]=Q[0]+Y[0],Z[1]=Q[1]+Y[1],Z[2]=Q[2]+Y[2],Z}function le8(Z,J){var Y=Z[0],$=Z[1],W=Z[2],Q=J[0],X=J[1],K=J[2],G=Math.sqrt(Y*Y+$*$+W*W),z=Math.sqrt(Q*Q+X*X+K*K),F=G*z,V=F&&hO(Z,J)/F;return Math.acos(Math.min(Math.max(V,-1),1))}function pe8(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z}function ie8(Z){return"vec3("+Z[0]+", "+Z[1]+", "+Z[2]+")"}function ne8(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]}function ae8(Z,J){var Y=Z[0],$=Z[1],W=Z[2],Q=J[0],X=J[1],K=J[2];return Math.abs(Y-Q)<=L0*Math.max(1,Math.abs(Y),Math.abs(Q))&&Math.abs($-X)<=L0*Math.max(1,Math.abs($),Math.abs(X))&&Math.abs(W-K)<=L0*Math.max(1,Math.abs(W),Math.abs(K))}var se8=y41,oe8=b41,re8=g41,te8=m41,ee8=d41,_A=f41,Z06=u41,J06=function(){var Z=xO();return function(J,Y,$,W,Q,X){var K,G;if(!Y)Y=3;if(!$)$=0;if(W)G=Math.min(W*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],Q(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}}();function Y06(){var Z=new n0(4);if(n0!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function c41(Z){var J=new n0(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function l41(Z,J,Y,$){var W=new n0(4);return W[0]=Z,W[1]=J,W[2]=Y,W[3]=$,W}function p41(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function i41(Z,J,Y,$,W){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=W,Z}function n41(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 a41(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 s41(Z){var J=Z[0],Y=Z[1],$=Z[2],W=Z[3];return Math.hypot(J,Y,$,W)}function o41(Z){var J=Z[0],Y=Z[1],$=Z[2],W=Z[3];return J*J+Y*Y+$*$+W*W}function r41(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=Y*Y+$*$+W*W+Q*Q;if(X>0)X=1/Math.sqrt(X);return Z[0]=Y*X,Z[1]=$*X,Z[2]=W*X,Z[3]=Q*X,Z}function t41(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}function e41(Z,J,Y,$){var W=J[0],Q=J[1],X=J[2],K=J[3];return Z[0]=W+$*(Y[0]-W),Z[1]=Q+$*(Y[1]-Q),Z[2]=X+$*(Y[2]-X),Z[3]=K+$*(Y[3]-K),Z}function Z71(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function J71(Z,J){var Y=Z[0],$=Z[1],W=Z[2],Q=Z[3],X=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(Y-X)<=L0*Math.max(1,Math.abs(Y),Math.abs(X))&&Math.abs($-K)<=L0*Math.max(1,Math.abs($),Math.abs(K))&&Math.abs(W-G)<=L0*Math.max(1,Math.abs(W),Math.abs(G))&&Math.abs(Q-z)<=L0*Math.max(1,Math.abs(Q),Math.abs(z))}var ll6=function(){var Z=Y06();return function(J,Y,$,W,Q,X){var K,G;if(!Y)Y=4;if(!$)$=0;if(W)G=Math.min(W*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],Q(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 xA(){var Z=new n0(4);if(n0!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z[3]=1,Z}function W06(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=1,Z}function Y71(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 Q06(Z,J){var Y=Math.acos(J[3])*2,$=Math.sin(Y/2);if($>L0)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 X06(Z,J){var Y=G71(Z,J);return Math.acos(2*Y*Y-1)}function $71(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=Y[0],G=Y[1],z=Y[2],F=Y[3];return Z[0]=$*F+X*K+W*z-Q*G,Z[1]=W*F+X*G+Q*K-$*z,Z[2]=Q*F+X*z+$*G-W*K,Z[3]=X*F-$*K-W*G-Q*z,Z}function K06(Z,J,Y){Y*=0.5;var $=J[0],W=J[1],Q=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G+X*K,Z[1]=W*G+Q*K,Z[2]=Q*G-W*K,Z[3]=X*G-$*K,Z}function G06(Z,J,Y){Y*=0.5;var $=J[0],W=J[1],Q=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G-Q*K,Z[1]=W*G+X*K,Z[2]=Q*G+$*K,Z[3]=X*G-W*K,Z}function z06(Z,J,Y){Y*=0.5;var $=J[0],W=J[1],Q=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G+W*K,Z[1]=W*G-$*K,Z[2]=Q*G+X*K,Z[3]=X*G-Q*K,Z}function F06(Z,J){var Y=J[0],$=J[1],W=J[2];return Z[0]=Y,Z[1]=$,Z[2]=W,Z[3]=Math.sqrt(Math.abs(1-Y*Y-$*$-W*W)),Z}function W71(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=Math.sqrt(Y*Y+$*$+W*W),K=Math.exp(Q),G=X>0?K*Math.sin(X)/X:0;return Z[0]=Y*G,Z[1]=$*G,Z[2]=W*G,Z[3]=K*Math.cos(X),Z}function Q71(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=Math.sqrt(Y*Y+$*$+W*W),K=X>0?Math.atan2(X,Q)/X:0;return Z[0]=Y*K,Z[1]=$*K,Z[2]=W*K,Z[3]=0.5*Math.log(Y*Y+$*$+W*W+Q*Q),Z}function V06(Z,J,Y){return Q71(Z,J),K71(Z,Z,Y),W71(Z,Z),Z}function fO(Z,J,Y,$){var W=J[0],Q=J[1],X=J[2],K=J[3],G=Y[0],z=Y[1],F=Y[2],V=Y[3],H,q,U,L,w;if(q=W*G+Q*z+X*F+K*V,q<0)q=-q,G=-G,z=-z,F=-F,V=-V;if(1-q>L0)H=Math.acos(q),U=Math.sin(H),L=Math.sin((1-$)*H)/U,w=Math.sin($*H)/U;else L=1-$,w=$;return Z[0]=L*W+w*G,Z[1]=L*Q+w*z,Z[2]=L*X+w*F,Z[3]=L*K+w*V,Z}function H06(Z){var J=e4(),Y=e4(),$=e4(),W=Math.sqrt(1-J),Q=Math.sqrt(J);return Z[0]=W*Math.sin(2*Math.PI*Y),Z[1]=W*Math.cos(2*Math.PI*Y),Z[2]=Q*Math.sin(2*Math.PI*$),Z[3]=Q*Math.cos(2*Math.PI*$),Z}function q06(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=Y*Y+$*$+W*W+Q*Q,K=X?1/X:0;return Z[0]=-Y*K,Z[1]=-$*K,Z[2]=-W*K,Z[3]=Q*K,Z}function U06(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z[3]=J[3],Z}function X71(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 W=0;if(J[4]>J[0])W=1;if(J[8]>J[W*3+W])W=2;var Q=(W+1)%3,X=(W+2)%3;$=Math.sqrt(J[W*3+W]-J[Q*3+Q]-J[X*3+X]+1),Z[W]=0.5*$,$=0.5/$,Z[3]=(J[Q*3+X]-J[X*3+Q])*$,Z[Q]=(J[Q*3+W]+J[W*3+Q])*$,Z[X]=(J[X*3+W]+J[W*3+X])*$}return Z}function w06(Z,J,Y,$){var W=0.5*Math.PI/180;J*=W,Y*=W,$*=W;var Q=Math.sin(J),X=Math.cos(J),K=Math.sin(Y),G=Math.cos(Y),z=Math.sin($),F=Math.cos($);return Z[0]=Q*G*F-X*K*z,Z[1]=X*K*F+Q*G*z,Z[2]=X*G*z-Q*K*F,Z[3]=X*G*F+Q*K*z,Z}function L06(Z){return"quat("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}var B06=c41,O06=l41,M06=p41,R06=i41,N06=n41,P06=$71,K71=a41,G71=t41,j06=e41,z71=s41,D06=z71,F71=o41,C06=F71,AA=r41,T06=Z71,k06=J71,E06=function(){var Z=xO(),J=AO(1,0,0),Y=AO(0,1,0);return function($,W,Q){var X=hO(W,Q);if(X<-0.999999){if(MV(Z,J,W),_A(Z)<0.000001)MV(Z,Y,W);return SA(Z,Z),Y71($,Z,Math.PI),$}else if(X>0.999999)return $[0]=0,$[1]=0,$[2]=0,$[3]=1,$;else return MV(Z,W,Q),$[0]=Z[0],$[1]=Z[1],$[2]=Z[2],$[3]=1+X,AA($,$)}}(),I06=function(){var Z=xA(),J=xA();return function(Y,$,W,Q,X,K){return fO(Z,$,X,K),fO(J,W,Q,K),fO(Y,Z,J,2*K*(1-K)),Y}}(),v06=function(){var Z=vA();return function(J,Y,$,W){return Z[0]=$[0],Z[3]=$[1],Z[6]=$[2],Z[1]=W[0],Z[4]=W[1],Z[7]=W[2],Z[2]=-Y[0],Z[5]=-Y[1],Z[8]=-Y[2],AA(J,X71(J,Z))}}();var o0={};R9(o0,{zero:()=>Y16,transformMat4:()=>e06,transformMat3:()=>t06,transformMat2d:()=>r06,transformMat2:()=>o06,subtract:()=>H71,sub:()=>K16,str:()=>$16,squaredLength:()=>O71,squaredDistance:()=>L71,sqrLen:()=>H16,sqrDist:()=>V16,set:()=>A06,scaleAndAdd:()=>u06,scale:()=>d06,round:()=>m06,rotate:()=>Z16,random:()=>s06,normalize:()=>p06,negate:()=>c06,multiply:()=>q71,mul:()=>G16,min:()=>b06,max:()=>g06,lerp:()=>a06,length:()=>B71,len:()=>X16,inverse:()=>l06,fromValues:()=>_06,forEach:()=>q16,floor:()=>y06,exactEquals:()=>W16,equals:()=>Q16,dot:()=>i06,divide:()=>U71,div:()=>z16,distance:()=>w71,dist:()=>F16,cross:()=>n06,create:()=>V71,copy:()=>x06,clone:()=>S06,ceil:()=>f06,angle:()=>J16,add:()=>h06});function V71(){var Z=new n0(2);if(n0!=Float32Array)Z[0]=0,Z[1]=0;return Z}function S06(Z){var J=new n0(2);return J[0]=Z[0],J[1]=Z[1],J}function _06(Z,J){var Y=new n0(2);return Y[0]=Z,Y[1]=J,Y}function x06(Z,J){return Z[0]=J[0],Z[1]=J[1],Z}function A06(Z,J,Y){return Z[0]=J,Z[1]=Y,Z}function h06(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z}function H71(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z}function q71(Z,J,Y){return Z[0]=J[0]*Y[0],Z[1]=J[1]*Y[1],Z}function U71(Z,J,Y){return Z[0]=J[0]/Y[0],Z[1]=J[1]/Y[1],Z}function f06(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z}function y06(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z}function b06(Z,J,Y){return Z[0]=Math.min(J[0],Y[0]),Z[1]=Math.min(J[1],Y[1]),Z}function g06(Z,J,Y){return Z[0]=Math.max(J[0],Y[0]),Z[1]=Math.max(J[1],Y[1]),Z}function m06(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z}function d06(Z,J,Y){return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z}function u06(Z,J,Y,$){return Z[0]=J[0]+Y[0]*$,Z[1]=J[1]+Y[1]*$,Z}function w71(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1];return Math.hypot(Y,$)}function L71(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1];return Y*Y+$*$}function B71(Z){var J=Z[0],Y=Z[1];return Math.hypot(J,Y)}function O71(Z){var J=Z[0],Y=Z[1];return J*J+Y*Y}function c06(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z}function l06(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z}function p06(Z,J){var Y=J[0],$=J[1],W=Y*Y+$*$;if(W>0)W=1/Math.sqrt(W);return Z[0]=J[0]*W,Z[1]=J[1]*W,Z}function i06(Z,J){return Z[0]*J[0]+Z[1]*J[1]}function n06(Z,J,Y){var $=J[0]*Y[1]-J[1]*Y[0];return Z[0]=Z[1]=0,Z[2]=$,Z}function a06(Z,J,Y,$){var W=J[0],Q=J[1];return Z[0]=W+$*(Y[0]-W),Z[1]=Q+$*(Y[1]-Q),Z}function s06(Z,J){J=J||1;var Y=e4()*2*Math.PI;return Z[0]=Math.cos(Y)*J,Z[1]=Math.sin(Y)*J,Z}function o06(Z,J,Y){var $=J[0],W=J[1];return Z[0]=Y[0]*$+Y[2]*W,Z[1]=Y[1]*$+Y[3]*W,Z}function r06(Z,J,Y){var $=J[0],W=J[1];return Z[0]=Y[0]*$+Y[2]*W+Y[4],Z[1]=Y[1]*$+Y[3]*W+Y[5],Z}function t06(Z,J,Y){var $=J[0],W=J[1];return Z[0]=Y[0]*$+Y[3]*W+Y[6],Z[1]=Y[1]*$+Y[4]*W+Y[7],Z}function e06(Z,J,Y){var $=J[0],W=J[1];return Z[0]=Y[0]*$+Y[4]*W+Y[12],Z[1]=Y[1]*$+Y[5]*W+Y[13],Z}function Z16(Z,J,Y,$){var W=J[0]-Y[0],Q=J[1]-Y[1],X=Math.sin($),K=Math.cos($);return Z[0]=W*K-Q*X+Y[0],Z[1]=W*X+Q*K+Y[1],Z}function J16(Z,J){var Y=Z[0],$=Z[1],W=J[0],Q=J[1],X=Math.sqrt(Y*Y+$*$)*Math.sqrt(W*W+Q*Q),K=X&&(Y*W+$*Q)/X;return Math.acos(Math.min(Math.max(K,-1),1))}function Y16(Z){return Z[0]=0,Z[1]=0,Z}function $16(Z){return"vec2("+Z[0]+", "+Z[1]+")"}function W16(Z,J){return Z[0]===J[0]&&Z[1]===J[1]}function Q16(Z,J){var Y=Z[0],$=Z[1],W=J[0],Q=J[1];return Math.abs(Y-W)<=L0*Math.max(1,Math.abs(Y),Math.abs(W))&&Math.abs($-Q)<=L0*Math.max(1,Math.abs($),Math.abs(Q))}var X16=B71,K16=H71,G16=q71,z16=U71,F16=w71,V16=L71,H16=O71,q16=function(){var Z=V71();return function(J,Y,$,W,Q,X){var K,G;if(!Y)Y=2;if(!$)$=0;if(W)G=Math.min(W*Y+$,J.length);else G=J.length;for(K=$;K<G;K+=Y)Z[0]=J[K],Z[1]=J[K+1],Q(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1];return J}}();class KW extends Float32Array{constructor(Z,J,Y,$){super([Z,J,Y,$])}get determinant(){return C8.determinant(this)}get frobeniusNorm(){return C8.frob(this)}static create(){let Z=new KW(0,0,0,0);return C8.identity(Z),Z}static fromRotation(Z){let J=KW.create();return C8.fromRotation(J,Z),J}static fromScaling(Z){let J=KW.create();return C8.fromScaling(J,Z),J}add(Z){return C8.add(this,this,Z),this}adjoint(){return C8.adjoint(this,this),this}clone(){return new KW(this[0],this[1],this[2],this[3])}copy(Z){return C8.copy(this,Z),this}equals(Z){return C8.equals(this,Z)}exactEquals(Z){return C8.exactEquals(this,Z)}identity(){return C8.identity(this),this}invert(){return C8.invert(this,this),this}multiply(Z){return C8.mul(this,this,Z),this}multiplyScalar(Z){return C8.multiplyScalar(this,this,Z),this}rotate(Z){return C8.rotate(this,this,Z),this}subtract(Z){return C8.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]}][${this[2]},${this[3]}]`}transpose(){return C8.transpose(this,this),this}}class Z7 extends Float32Array{constructor(Z,J,Y,$,W,Q,X,K,G){super([Z,J,Y,$,W,Q,X,K,G])}get determinant(){return A1.determinant(this)}get frobeniusNorm(){return A1.frob(this)}static create(){let Z=new Z7(0,0,0,0,0,0,0,0,0);return A1.identity(Z),Z}static fromMatrix4(Z){let J=Z7.create();return A1.fromMat4(J,Z),J}static fromQuaternion(Z){let J=Z7.create();return A1.fromQuat(J,Z),J}static fromRotation(Z){let J=Z7.create();return A1.fromRotation(J,Z),J}static fromScaling(Z){let J=Z7.create();return A1.fromScaling(J,Z),J}static fromTranslation(Z){let J=Z7.create();return A1.fromTranslation(J,Z),J}add(Z){return A1.add(this,this,Z),this}adjoint(){return A1.adjoint(this,this),this}clone(){return new Z7(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8])}copy(Z){return A1.copy(this,Z),this}equals(Z){return A1.equals(this,Z)}exactEquals(Z){return A1.exactEquals(this,Z)}identity(){return A1.identity(this),this}invert(){return A1.invert(this,this),this}multiply(Z){return A1.mul(this,this,Z),this}multiplyScalar(Z){return A1.multiplyScalar(this,this,Z),this}transformVector(Z){return Z.transformMatrix3(this)}projection(Z,J){return A1.projection(this,Z,J),this}rotate(Z){return A1.rotate(this,this,Z),this}subtract(Z){return A1.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 A1.transpose(this,this),this}}class c6 extends Float32Array{constructor(Z,J,Y,$,W,Q,X,K,G,z,F,V,H,q,U,L){super([Z,J,Y,$,W,Q,X,K,G,z,F,V,H,q,U,L])}get determinant(){return u0.determinant(this)}get frobeniusNorm(){return u0.frob(this)}static create(){let Z=new c6(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return u0.identity(Z),Z}static fromQuaternion(Z){let J=c6.create();return u0.fromQuat(J,Z),J}static fromRotation(Z,J){let Y=c6.create();return u0.fromRotation(Y,Z,J),Y}static fromRotationTranslation(Z,J){let Y=c6.create();return u0.fromRotationTranslation(Y,Z,J),Y}static fromRotationTranslationScale(Z,J,Y){let $=c6.create();return u0.fromRotationTranslationScale($,Z,J,Y),$}static fromRotationTranslationScaleOrigin(Z,J,Y,$){let W=c6.create();return u0.fromRotationTranslationScaleOrigin(W,Z,J,Y,$),W}static fromScaling(Z){let J=c6.create();return u0.fromScaling(J,Z),J}static fromTranslation(Z){let J=c6.create();return u0.fromTranslation(J,Z),J}static fromXRotation(Z){let J=c6.create();return u0.fromXRotation(J,Z),J}static fromYRotation(Z){let J=c6.create();return u0.fromYRotation(J,Z),J}static fromZRotation(Z){let J=c6.create();return u0.fromZRotation(J,Z),J}add(Z){return u0.add(this,this,Z),this}adjoint(){return u0.adjoint(this,this),this}clone(){return new c6(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 u0.copy(this,Z),this}equals(Z){return u0.equals(this,Z)}exactEquals(Z){return u0.exactEquals(this,Z)}frustrum(Z,J,Y,$,W,Q){return u0.frustum(this,Z,J,Y,$,W,Q),this}identity(){return u0.identity(this),this}invert(){return u0.invert(this,this),this}lookAt(Z,J,Y){return u0.lookAt(this,Z,J,Y),this}multiply(Z){return u0.mul(this,this,Z),this}multiplyScalar(Z){return u0.multiplyScalar(this,this,Z),this}orthographic(Z,J,Y,$,W,Q){return u0.ortho(this,Z,J,Y,$,W,Q),this}perspective(Z,J,Y,$){return u0.perspective(this,Z,J,Y,$),this}rotate(Z,J){return u0.rotate(this,this,Z,J),this}rotateX(Z){return u0.rotateX(this,this,Z),this}rotateY(Z){return u0.rotateY(this,this,Z),this}rotateZ(Z){return u0.rotateZ(this,this,Z),this}scale(Z){return u0.scale(this,this,Z),this}subtract(Z){return u0.sub(this,this,Z),this}targetTo(Z,J,Y){return u0.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 u0.translate(this,this,Z),this}transpose(){return u0.transpose(this,this),this}}class FK extends Float32Array{constructor(Z,J,Y,$){super([Z,J,Y,$])}get length(){return V1.length(this)}get squaredLength(){return V1.squaredLength(this)}get magnitude(){return V1.length(this)}get squaredMagnitude(){return V1.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 $=V1.fromEuler(new Float32Array(4),Z,J,Y);return new FK($[0],$[1],$[2],$[3])}static fromQuaternionLike(Z){return new FK(Z.x,Z.y,Z.z,Z.w)}clone(){return new FK(this.x,this.y,this.z,this.w)}conjugate(){return V1.conjugate(this,this),this}copy(Z){return V1.copy(this,Z),this}dot(Z){return V1.dot(this,Z)}exponential(){return V1.exp(this,this),this}equals(Z){return V1.equals(this,Z)}exactEquals(Z){return V1.exactEquals(this,Z)}getAngle(Z){return V1.getAngle(this,Z)}identity(){return V1.identity(this),this}invert(){return V1.invert(this,this),this}lerp(Z,J){return V1.lerp(this,this,Z,J),this}logarithm(){return V1.ln(this,this),this}multiply(Z){return V1.multiply(this,this,Z),this}transformVector(Z){return Z.transformQuaternion(this)}normalize(){return V1.normalize(this,this),this}power(Z){return V1.pow(this,this,Z),this}randomize(){return V1.random(this),this}rotateX(Z){return V1.rotateX(this,this,Z),this}rotateY(Z){return V1.rotateY(this,this,Z),this}rotateZ(Z){return V1.rotateZ(this,this,Z),this}scale(Z){return V1.scale(this,this,Z),this}setAxisAngle(Z,J){return V1.setAxisAngle(this,Z,J),this}slerp(Z,J){return V1.slerp(this,this,Z,J),this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}}class RV extends Float32Array{constructor(Z,J){super([Z,J])}get length(){return o0.length(this)}get squaredLength(){return o0.squaredLength(this)}get magnitude(){return o0.length(this)}get squaredMagnitude(){return o0.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 RV(0,0)}add(Z){return o0.add(this,this,Z),this}angle(Z){return o0.angle(this,Z)}ceil(){return o0.ceil(this,this),this}clone(){return new RV(this.x,this.y)}copy(Z){return o0.copy(this,Z),this}distance(Z){return o0.distance(this,Z)}divide(Z){return o0.divide(this,this,Z),this}dot(Z){return o0.dot(this,Z)}equals(Z){return o0.equals(this,Z)}exactEquals(Z){return o0.exactEquals(this,Z)}floor(){return o0.floor(this,this),this}invert(){return o0.inverse(this,this),this}lerp(Z,J){return o0.lerp(this,this,Z,J),this}max(Z){return o0.max(this,this,Z),this}min(Z){return o0.min(this,this,Z),this}multiply(Z){return o0.mul(this,this,Z),this}negate(){return o0.negate(this,this),this}normalize(){return o0.normalize(this,this),this}randomize(Z){return o0.random(this,Z),this}rotate(Z,J){return o0.rotate(this,this,Z,J),this}round(){return o0.round(this,this),this}scale(Z){return o0.scale(this,this,Z),this}scaleAndAdd(Z,J){return o0.scaleAndAdd(this,this,Z,J),this}subtract(Z){return o0.sub(this,this,Z),this}toString(){return`${this.x},${this.y}`}transformMatrix2(Z){return o0.transformMat2(this,this,Z),this}transformMatrix3(Z){return o0.transformMat3(this,this,Z),this}transformMatrix4(Z){return o0.transformMat4(this,this,Z),this}zero(){return o0.zero(this),this}}class VK extends Float32Array{constructor(Z,J,Y){super([Z,J,Y])}get length(){return l0.length(this)}get squaredLength(){return l0.squaredLength(this)}get magnitude(){return l0.length(this)}get squaredMagnitude(){return l0.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 VK(0,0,0)}static fromVector3Like(Z){return new VK(Z.x,Z.y,Z.z)}add(Z){return l0.add(this,this,Z),this}ceil(){return l0.ceil(this,this),this}clone(){return new VK(this.x,this.y,this.z)}copy(Z){return l0.copy(this,Z),this}cross(Z){return l0.cross(this,this,Z),this}distance(Z){return l0.distance(this,Z)}divide(Z){return l0.div(this,this,Z),this}dot(Z){return l0.dot(this,Z)}equals(Z){return l0.equals(this,Z)}exactEquals(Z){return l0.exactEquals(this,Z)}floor(){return l0.floor(this,this),this}invert(){return l0.inverse(this,this),this}lerp(Z,J){return l0.lerp(this,this,Z,J),this}max(Z){return l0.max(this,this,Z),this}min(Z){return l0.min(this,this,Z),this}multiply(Z){return l0.mul(this,this,Z),this}negate(){return l0.negate(this,this),this}normalize(){return l0.normalize(this,this),this}randomize(Z){return l0.random(this,Z),this}rotateX(Z,J){return l0.rotateX(this,this,Z,J),this}rotateY(Z,J){return l0.rotateY(this,this,Z,J),this}rotateZ(Z,J){return l0.rotateZ(this,this,Z,J),this}round(){return l0.round(this,this),this}scale(Z){return l0.scale(this,this,Z),this}scaleAndAdd(Z,J){return l0.scaleAndAdd(this,this,Z,J),this}subtract(Z){return l0.sub(this,this,Z),this}toString(){return`${this.x},${this.y},${this.z}`}transformMatrix3(Z){return l0.transformMat3(this,this,Z),this}transformMatrix4(Z){return l0.transformMat4(this,this,Z),this}transformQuaternion(Z){return l0.transformQuat(this,this,Z),this}zero(){return l0.zero(this),this}}var H1=function(Z,J,Y,$){function W(Q){return Q instanceof Y?Q:new Y(function(X){X(Q)})}return new(Y||(Y=Promise))(function(Q,X){function K(F){try{z($.next(F))}catch(V){X(V)}}function G(F){try{z($.throw(F))}catch(V){X(V)}}function z(F){F.done?Q(F.value):W(F.value).then(K,G)}z(($=$.apply(Z,J||[])).next())})},z1=function(Z,J){var Y={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},$,W,Q,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,W&&(Q=z[0]&2?W.return:z[0]?W.throw||((Q=W.return)&&Q.call(W),0):W.next)&&!(Q=Q.call(W,z[1])).done)return Q;if(W=0,Q)z=[z[0]&2,Q.value];switch(z[0]){case 0:case 1:Q=z;break;case 4:return Y.label++,{value:z[1],done:!1};case 5:Y.label++,W=z[1],z=[0];continue;case 7:z=Y.ops.pop(),Y.trys.pop();continue;default:if((Q=Y.trys,!(Q=Q.length>0&&Q[Q.length-1]))&&(z[0]===6||z[0]===2)){Y=0;continue}if(z[0]===3&&(!Q||z[1]>Q[0]&&z[1]<Q[3])){Y.label=z[1];break}if(z[0]===6&&Y.label<Q[1]){Y.label=Q[1],Q=z;break}if(Q&&Y.label<Q[2]){Y.label=Q[2],Y.ops.push(z);break}if(Q[2])Y.ops.pop();Y.trys.pop();continue}z=J.call(Z,Y)}catch(F){z=[6,F],W=0}finally{$=Q=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},U5=function(Z,J){var Y=typeof Symbol==="function"&&Z[Symbol.iterator];if(!Y)return Z;var $=Y.call(Z),W,Q=[],X;try{while((J===void 0||J-- >0)&&!(W=$.next()).done)Q.push(W.value)}catch(K){X={error:K}}finally{try{if(W&&!W.done&&(Y=$.return))Y.call($)}finally{if(X)throw X.error}}return Q},B9=function(Z,J,Y){if(Y||arguments.length===2){for(var $=0,W=J.length,Q;$<W;$++)if(Q||!($ in J)){if(!Q)Q=Array.prototype.slice.call(J,0,$);Q[$]=J[$]}}return Z.concat(Q||Array.prototype.slice.call(J))},M71=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.")},rl6=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($,W){return Y.compare($,W).then(function(Q){return-1*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){return H1(this,void 0,void 0,function(){return z1(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 H1(this,void 0,void 0,function(){return z1(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 H1(this,void 0,void 0,function(){return z1(this,function($){return[2,J-Y]})})},Z.maxComparatorNumber=function(J,Y){return H1(this,void 0,void 0,function(){return z1(this,function($){return[2,Y-J]})})},Z.defaultIsEqual=function(J,Y){return H1(this,void 0,void 0,function(){return z1(this,function($){return[2,J===Y]})})},Z.print=function(J){function Y(F){var V=Z.getParentIndexOf(F);return Math.floor(Math.log2(V+1))}function $(F,V){var H="";for(;V>0;--V)H+=F;return H}var W=0,Q=[],X=Y(J.length-1)+2,K=0;while(W<J.length){var G=Y(W)+1;if(W===0)G=0;var z=String(J.get(W));if(z.length>K)K=z.length;Q[G]=Q[G]||[],Q[G].push(z),W+=1}return Q.map(function(F,V){var H=Math.pow(2,X-V)-1;return $(" ",Math.floor(H/2)*K)+F.map(function(q){var U=(K-q.length)/2;return $(" ",Math.ceil(U))+q+$(" ",Math.floor(U))}).join($(" ",H*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",xo8),J.secureEndpoint){YV("Upgrading socket connection to TLS");let V=J.servername||J.host;return FA.connect({...e91(J,"host","path","port"),socket:$,servername:e7.isIP(V)?void 0:V})}return $}$.destroy();let F=new e7.Socket({writable:!1});return F.readable=!0,Z.once("socket",(V)=>{YV("Replaying proxy buffer for failed request"),V.push(z),V.push(null)}),F}}kO.__initStatic();function xo8(Z){Z.resume()}function e91(Z,...J){let Y={},$;for($ in Z)if(!J.includes($))Y[$]=Z[$];return Y}var bo8=32768;function go8(Z){return new fo8({read(){this.push(Z),this.push(null)}})}function VA(Z){let J;try{J=new URL(Z.url)}catch(G){return q8(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),rZ(Z,()=>Promise.resolve({}))}let Y=J.protocol==="https:",$=mo8(J,Z.proxy||(Y?process.env.https_proxy:void 0)||process.env.http_proxy),W=Y?ho8:Ao8,Q=Z.keepAlive===void 0?!1:Z.keepAlive,X=$?new kO($):new W.Agent({keepAlive:Q,maxSockets:30,timeout:2000}),K=do8(Z,Z.httpModule??W,X);return rZ(Z,K)}function mo8(Z,J){let{no_proxy:Y}=process.env;if(Y?.split(",").some((W)=>Z.host.endsWith(W)||Z.hostname.endsWith(W)))return;else return J}function do8(Z,J,Y){let{hostname:$,pathname:W,port:Q,protocol:X,search:K}=new URL(Z.url);return function G(z){return new Promise((F,V)=>{X$(()=>{let H=go8(z.body),q={...Z.headers};if(z.body.length>bo8)q["content-encoding"]="gzip",H=H.pipe(yo8());let U=J.request({method:"POST",agent:Y,headers:q,hostname:$,path:`${W}${K}`,port:Q,protocol:X,ca:Z.caCerts},(L)=>{L.on("data",()=>{}),L.on("end",()=>{}),L.setEncoding("utf8");let w=L.headers["retry-after"]??null,O=L.headers["x-sentry-rate-limits"]??null;F({statusCode:L.statusCode,headers:{"retry-after":w,"x-sentry-rate-limits":Array.isArray(O)?O[0]||null:O}})});U.on("error",V),H.pipe(U)})})}}var uo8=new Set(["false","f","n","no","off","0"]),co8=new Set(["true","t","y","yes","on","1"]);function EO(Z,J){let Y=String(Z).toLowerCase();if(uo8.has(Y))return!1;if(co8.has(Y))return!0;return J?.strict?null:Boolean(Z)}import{posix as lo8,sep as po8}from"path";function Z41(Z){return Z.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function HA(Z=process.argv[1]?EE(process.argv[1]):process.cwd(),J=po8==="\\"){let Y=J?Z41(Z):Z;return($)=>{if(!$)return;let W=J?Z41($):$,{dir:Q,base:X,ext:K}=lo8.parse(W);if(K===".js"||K===".mjs"||K===".cjs")X=X.slice(0,K.length*-1);let G=decodeURIComponent(X);if(!Q)Q=".";let z=Q.lastIndexOf("/node_modules");if(z>-1)return`${Q.slice(z+14).replace(/\//g,".")}:${G}`;if(Q.startsWith(Y)){let F=Q.slice(Y.length+1).replace(/\//g,".");return F?`${F}:${G}`:G}return G}}function qA(Z){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(P0.SENTRY_RELEASE?.id)return P0.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 UA=b2(SE(HA()));var Y41=i(n(),1);import*as J41 from"os";import{threadId as io8,isMainThread as no8}from"worker_threads";var ao8=60000;class IO extends r2{constructor(Z){let J=Z.serverName||global.process.env.SENTRY_NAME||J41.hostname(),Y={...Z,platform:"node",runtime:{name:"node",version:global.process.version},serverName:J};if(Z.openTelemetryInstrumentations)jX({instrumentations:Z.openTelemetryInstrumentations});jz(Y,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${no8?"main":`worker-${io8}`}.`);super(Y);if(this.getOptions()._experiments?.enableLogs){if(this._logOnExitFlushListener=()=>{G$(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=H8,Y=Y41.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(()=>{_0&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},Z.clientReportFlushInterval??ao8).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener)}_getTraceInfoFromScope(Z){if(!Z)return[void 0,void 0];return Vo0(this,Z)}}var J4=i(n(),1);var QK=i(D1(),1);var $41=i(WB(),1);import so8 from"module";var wA=1e6;function LA(Z,J={}){if(Z.getOptions().debug)to8();let Y=oo8(Z,J);Z.traceProvider=Y}function W41(){let[Z=0,J=0]=process.versions.node.split(".").map(Number);if(Z>=21||Z===20&&J>=6||Z===18&&J>=19){if(!P0._sentryEsmLoaderHookRegistered)try{let{addHookMessagePort:Y}=$41.createAddHookMessageChannel();so8.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:Y,include:[]},transferList:[Y]})}catch(Y){g.warn("Failed to register ESM hook",Y)}}else q8(()=>{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 oo8(Z,J={}){let Y=new aS({sampler:new U_(Z),resource:new xX({[QK.ATTR_SERVICE_NAME]:"node",[QK.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[QK.ATTR_SERVICE_VERSION]:H8}),forceFlushTimeoutMillis:500,spanProcessors:[new q_({timeout:ro8(Z.getOptions().maxSpanWaitDuration)}),...J.spanProcessors||[]]});return J4.trace.setGlobalTracerProvider(Y),J4.propagation.setGlobalPropagator(new G_),J4.context.setGlobalContextManager(new o91),Y}function ro8(Z){if(Z==null)return;if(Z>wA)return _0&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${wA}`),wA;else if(Z<=0||Number.isNaN(Z)){_0&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return Z}function to8(){let Z=new Proxy(g,{get(J,Y,$){return Reflect.get(J,Y==="verbose"?"debug":Y,$)}});J4.diag.disable(),J4.diag.setLogger(Z,J4.DiagLogLevel.DEBUG)}function eo8(){return cX()?[lX()]:[]}function Q41(){return[V$(),F$(),H$(),q$(),U$(),bX(),mX(),pX(),iX(),uX(),j_(),dX(),f91(),r91(),...eo8()]}function X41(Z){return[...Q41(),...x6(Z)?WK():[]]}function BA(Z={}){return Zr8(Z,X41)}function Zr8(Z={},J){let Y=Jr8(Z,J);if(Y.debug===!0)if(_0)g.enable();else q8(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")});if(!cX()&&Y.registerEsmLoaderHooks!==!1)W41();if(qo0(),K1().update(Y.initialScope),Y.spotlight&&!Y.integrations.some(({name:Q})=>Q===ox))Y.integrations.push(rx({sidecarUrl:typeof Y.spotlight==="string"?Y.spotlight:void 0}));let W=new IO(Y);if(K1().setClient(W),W.init(),g.log(`Running in ${cX()?"CommonJS":"ESM"} mode.`),W.startClientReportTracking(),Wr8(),!Y.skipOpenTelemetrySetup)LA(W,{spanProcessors:Y.openTelemetrySpanProcessors}),K41();return Yo0(W),Ho0(W),W}function K41(){if(!_0)return;let Z=Xo0(),J=["SentryContextManager","SentryPropagator"];if(x6())J.push("SentrySpanProcessor");for(let Y of J)if(!Z.includes(Y))g.error(`You have to set up the ${Y}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);if(!Z.includes("SentrySampler"))g.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 Jr8(Z,J){let Y=Yr8(Z.release),$=Z.spotlight??EO(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,W=$r8(Z.tracesSampleRate),Q={...Z,dsn:Z.dsn??process.env.SENTRY_DSN,environment:Z.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:Z.sendClientReports??!0,transport:Z.transport??VA,stackParser:YE(Z.stackParser||UA),release:Y,tracesSampleRate:W,spotlight:$,debug:EO(Z.debug??process.env.SENTRY_DEBUG)},X=Z.integrations,K=Z.defaultIntegrations??J(Q);return{...Q,integrations:OE({defaultIntegrations:K,integrations:X})}}function Yr8(Z){if(Z!==void 0)return Z;let J=qA();if(J!==void 0)return J;return}function $r8(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 Wr8(){if(EO(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let Z=process.env.SENTRY_TRACE,J=process.env.SENTRY_BAGGAGE,Y=Z$(Z,J);K1().setPropagationContext(Y)}}import*as H41 from"os";var Lr8="BunServer",Br8=()=>{return{name:Lr8,setupOnce(){Or8()}}},F41=a(Br8),G41=!1;function Or8(){if(G41)return;Bun.serve=new Proxy(Bun.serve,{apply(Z,J,Y){z41(Y[0]);let $=Z.apply(J,Y),W=$.reload.bind($);return $.reload=(Q)=>{return z41(Q),W(Q)},$}}),G41=!0}function z41(Z){Mr8(Z),Rr8(Z)}function Mr8(Z){if(typeof Z.fetch!=="function")return;Z.fetch=new Proxy(Z.fetch,{apply(J,Y,$){return OA(J,Y,$)}})}function Rr8(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:($,W,Q)=>{return OA($,W,Q,J)}});if(Y instanceof Response)return;if(typeof Y==="object")Object.entries(Y).forEach(([$,W])=>{if(typeof W==="function")Z.routes[J][$]=new Proxy(W,{apply:(Q,X,K)=>{return OA(Q,X,K,J)}})})})}function OA(Z,J,Y,$){return nZ((W)=>{let Q=Y[0],X=Q.method.toUpperCase();if(X==="OPTIONS"||X==="HEAD")return Z.apply(J,Y);let K=vE(Q.url),G=Nr8(K,Q),z=K?.pathname||"/";if(Q.params){if(Object.keys(Q.params).forEach((F)=>{G[`url.path.parameter.${F}`]=Q.params[F]}),$)G[y1]="route",G["url.template"]=$,z=$}if($?.endsWith("/*"))G[y1]="route",G["url.template"]=$,z=$;return W.setSDKProcessingMetadata({normalizedRequest:{url:Q.url,method:Q.method,headers:Q.headers.toJSON(),query_string:K?.search}}),Mz({sentryTrace:Q.headers.get("sentry-trace")??"",baggage:Q.headers.get("baggage")},()=>Q$({attributes:G,op:"http.server",name:`${Q.method} ${z}`},async(F)=>{try{let V=await Z.apply(J,Y);if(V?.status)Wz(F,V.status),W.setContext("response",{headers:V.headers.toJSON(),status_code:V.status});return V}catch(V){throw F6(V,{mechanism:{type:"bun",handled:!1,data:{function:"serve"}}}),V}}))})}function Nr8(Z,J){let Y={[i0]:"auto.http.bun.serve",[rk]:J.method||"GET",[y1]:"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(!IE(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 V41(Z){function J(Y){let $={body:Y.body,method:"POST",headers:Z.headers};try{return X$(()=>{return fetch(Z.url,$).then((W)=>{return{statusCode:W.status,headers:{"x-sentry-rate-limits":W.headers.get("X-Sentry-Rate-Limits"),"retry-after":W.headers.get("Retry-After")}}})})}catch(W){return K$(W)}}return rZ(Z,J)}function q41(Z){return[V$(),F$(),H$(),q$(),U$(),bX(),mX(),pX(),iX(),uX(),dX(),lX(),F41(),...x6(Z)?WK():[]]}function MA(Z={}){jz(Z,"bun");let J={...Z,platform:"javascript",runtime:{name:"bun",version:Bun.version},serverName:Z.serverName||global.process.env.SENTRY_NAME||H41.hostname()};if(J.transport=J.transport||V41,J.defaultIntegrations===void 0)J.defaultIntegrations=q41(J);return BA(J)}import{heapStats as jr8}from"bun:jsc";if(process.env.NODE_ENV==="production"&&process.env.SENTRY_DSN)MA({dsn:process.env.SENTRY_DSN,release:xk,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=a1.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=a1.getProcessStats(!0),Z}return null}}),console.log("Telemetry: Sentry.io initialized!");class a1{static getProcessStats(Z=!1){let J=jr8(),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"}};if(Z)return $;return Object.fromEntries(Object.entries($).map(([W,Q])=>[W,Q.value]))}static startSpan(Z,J){if(Nz())return Q$({attributes:Z.attributes,name:Z.operation,op:Z.operation},J);else return J()}}var Cr8=5000;class aY extends S0{static _serializedPackets=new WeakMap;_closeTimeout=null;_wrtcDirectTransport=null;_wrtcClientServerTransport=null;_wrtcClientServerDataProducers=[];_wrtcClientServerDataConsumers=[];_wrtcServerClientTransport=null;_wrtcServerClientReliableDataProducer=null;_wrtcServerClientUnreliableDataProducer=null;_wrtcServerClientDataConsumers=[];_ws;id;constructor(Z,J){super();this.id=xr(),this.onPacket(s.PacketId.CONNECTION,this._onConnectionPacket),this.onPacket(s.PacketId.HEARTBEAT,this._onHeartbeatPacket),this.bindWs(Z),n8.emit("CONNECTION.OPENED",{connection:this,req:J})}static serializePackets(Z){for(let Y of Z)if(!s.isValidPacket(Y))return f.error(`Connection.serializePackets(): Invalid packet payload: ${JSON.stringify(Y)}`);let J=aY._serializedPackets.get(Z);if(J)return J;return a1.startSpan({operation:"serialize_packets",attributes:{packets:Z.length,packetIds:Z.map((Y)=>Y[0]).join(",")}},(Y)=>{let $=BC(Z),W=Buffer.from($.buffer,$.byteOffset,$.byteLength);return Y?.setAttribute("serializedBytes",$.byteLength),aY._serializedPackets.set(Z,W),W})}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([s.createPacket(s.bidirectionalPackets.connectionPacketDefinition,{i:this.id})],!0,!0),J)this.emitWithGlobal("CONNECTION.RECONNECTED",{connection:this});if(gZ.instance.isWrtcEnabled)this._upgradeToWRTC()}closeWrtc(){this._closeWrtcClientServerTransport(),this._closeWrtcServerClientTransport()}disconnect(){try{this._ws.close()}catch(Z){f.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!==Dr8.OPEN)return f.warning("Connection.send(): Connection is not open.");a1.startSpan({operation:"send_packets",attributes:{forceWs:Y?"true":"false",wrtcConnected:this._wrtcServerClientTransport?.iceState==="completed"?"true":"false"}},()=>{try{let $=aY.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($){f.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:W,d:Q}=Y,X=!1;if(W==this._wrtcClientServerTransport?.id)await this._wrtcClientServerTransport.connect({dtlsParameters:Q}),X=!0;if(W==this._wrtcServerClientTransport?.id)await this._wrtcServerClientTransport.connect({dtlsParameters:Q}),X=!0;if(X)this.send([s.createPacket(s.bidirectionalPackets.connectionPacketDefinition,{ca:{i:W}})])}if($)for(let W of $){let{s:Q,l:X}=W,K=await this._wrtcClientServerTransport.produceData({label:X,sctpStreamParameters:Q}),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([s.createPacket(s.bidirectionalPackets.connectionPacketDefinition,{pa:{i:K.id,l:X}})])}};_onHeartbeatPacket=()=>{this.send([s.createPacket(s.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){f.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()},Cr8)};_onWsError=(Z)=>{this.emitWithGlobal("CONNECTION.ERROR",{connection:this,error:Z})};_upgradeToWRTC=async()=>{let Z=await gZ.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 W=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientReliableDataProducer.id}),Q=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientUnreliableDataProducer.id});return this._wrtcServerClientDataConsumers.push(W,Q),this.send([s.createPacket(s.bidirectionalPackets.connectionPacketDefinition,{d:[{i:W.id,pi:W.dataProducerId,l:"scr",s:W.sctpStreamParameters},{i:Q.id,pi:Q.dataProducerId,l:"scu",s:Q.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=NC(Z);if(!J||typeof J!=="object"||typeof J[0]!=="number")return f.error(`Connection._deserialize(): Invalid packet format. Packet: ${JSON.stringify(J)}`);if(!s.isValidPacket(J))return f.error(`Connection._deserialize(): Invalid packet payload. Packet: ${JSON.stringify(J)}`);return J}}var U41;(($)=>{$.PLAYER_CONNECTED="PLAYER_MANAGER.PLAYER_CONNECTED";$.PLAYER_DISCONNECTED="PLAYER_MANAGER.PLAYER_DISCONNECTED";$.PLAYER_RECONNECTED="PLAYER_MANAGER.PLAYER_RECONNECTED"})(U41||={});class D5{static instance=new D5;_connectionPlayers=new Map;constructor(){n8.on("CONNECTION.OPENED",({connection:Z,req:J})=>{this._onConnectionOpened(Z,J.session)}),n8.on("CONNECTION.DISCONNECTED",({connection:Z})=>{this._onConnectionDisconnected(Z)}),n8.on("CONNECTION.RECONNECTED",({connection:Z})=>{this._onConnectionReconnected(Z)}),n8.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),n8.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(),n8.emit("PLAYER_MANAGER.PLAYER_RECONNECTED",{player:J});else f.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),n8.emit("PLAYER_MANAGER.PLAYER_DISCONNECTED",{player:J});else f.warning(`PlayerManager._onConnectionClosed(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}}var L8=16,KK=L8-1,w41=L8**3,Tr8=[{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]}],RA;(($)=>{$.DESPAWN="CHUNK.DESPAWN";$.SET_BLOCK="CHUNK.SET_BLOCK";$.SPAWN="CHUNK.SPAWN"})(RA||={});class L6 extends S0{_blocks;_originCoordinate;_requiresUpdate=!1;_rigidBody;_world;constructor(){super();this._blocks=new Uint8Array(w41)}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%L8,y:(Z/L8|0)%L8,z:Z/(L8*L8)|0}}static globalCoordinateToLocalCoordinate(Z){return{x:Z.x&L8-1,y:Z.y&L8-1,z:Z.z&L8-1}}static globalCoordinateToOriginCoordinate(Z){return{x:Z.x&~(L8-1),y:Z.y&~(L8-1),z:Z.z&~(L8-1)}}static isValidOriginCoordinate(Z){return Z.x%L8===0&&Z.y%L8===0&&Z.z%L8===0}spawn(Z,J){if(this.isSpawned){let{x:Y,y:$,z:W}=this.originCoordinate;return f.error(`Chunk.spawn(): Chunk is already spawned at origin ${Y}, ${$}, ${W}!`)}if(!L6.isValidOriginCoordinate(J))return f.error(`Chunk.spawn(): Chunk coordinates must be divisible by ${L8}`);this._originCoordinate=J,this._world=Z,this._world.chunkLattice.registerChunk(this),this._requiresUpdate=!0}despawn(){if(!this.isSpawned)return f.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 f.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===KK)$.push({x:1,y:0,z:0});if(Z.y===KK)$.push({x:0,y:1,z:0});if(Z.z===KK)$.push({x:0,y:0,z:1});for(let W of $){let Q={x:Y.x+W.x,y:Y.y+W.y,z:Y.z+W.z},X=L6.globalCoordinateToOriginCoordinate(Q),K=this._world?.chunkLattice.getChunk(X);if(!K?.hasBlock(L6.globalCoordinateToLocalCoordinate(Q)))continue;K.setRequiresUpdate(!0)}}this._requiresUpdate=!0}setRequiresUpdate(Z){this._requiresUpdate=Z}update(){if(!this._requiresUpdate)return;if(!this.isSpawned)return f.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 jY({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 b0.serializeChunk(this)}_meshColliders(){if(!this._world)return f.error("Chunk._meshColliders(): Chunk is not spawned and cannot be meshed."),[];let Z=new Map,J=[];for(let $=0;$<w41;$++){if(this._blocks[$]===0)continue;let W=this._blocks[$],Q=this._world.blockTypeRegistry.getBlockType(W),{x:X,y:K,z:G}=L6.blockIndexToLocalCoordinate($);if(!Q.isMeshable){let F=Q.createCollider();F.setRelativePosition({x:X,y:K,z:G}),J.push([F,Q]);continue}let z=Z.get(Q)??{indices:[],vertices:[]};Z.set(Q,z);for(let F of Tr8){let[V,H,q]=F.neighborOffset,U={x:X+V,y:K+H,z:G+q},L=this._getGlobalCoordinate(U),w=this._world.chunkLattice.getBlockType(L);if(w&&!w.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(($,W)=>{if(!$.indices.length)return;let Q=W.createCollider(new Uint32Array($.indices),new Float32Array($.vertices));Y.push([Q,W])}),[...J,...Y]}_removeFromSimulation(){if(!this._rigidBody||!this._world)return;this._rigidBody.removeFromSimulation(),this._rigidBody=void 0}_getGlobalCoordinate(Z){if(!this.originCoordinate)f.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+L8*(Z.y+L8*Z.z)}_isValidLocalCoordinate(Z){return Z.x>=0&&Z.x<=KK&&Z.y>=0&&Z.y<=KK&&Z.z>=0&&Z.z<=KK}}class $V{_chunks=new Map;_world;constructor(Z){this._world=Z}get chunkCount(){return this._chunks.size}registerChunk(Z){if(!Z.isSpawned)return f.error("ChunkLattice.registerChunk(): Chunk is not spawned.");if(this.hasChunk(Z.originCoordinate)){let{x:J,y:Y,z:$}=Z.originCoordinate;return f.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 f.error("ChunkLattice.registerChunk(): Chunk world does not match lattice world.");this._chunks.set(this._getChunkKey(Z.originCoordinate),Z)}unregisterChunk(Z){if(!Z.isSpawned)return f.error("ChunkLattice.unregisterChunk(): Chunk is not spawned.");if(Z.world.id!==this._world.id)return f.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(L6.globalCoordinateToOriginCoordinate(Z));if(!J)return 0;return J.getBlockId(L6.globalCoordinateToLocalCoordinate(Z))}getBlockType(Z){let J=this.getBlockId(Z);return J?this._world.blockTypeRegistry.getBlockType(J):null}getChunk(Z){if(!L6.isValidOriginCoordinate(Z)){f.error(`ChunkLattice.getChunk(): Chunk coordinates must be divisible by CHUNK_SIZE (${L8})`);return}return this._chunks.get(this._getChunkKey(Z))}getAllChunks(){return Array.from(this._chunks.values())}hasBlock(Z){let J=this.getChunk(L6.globalCoordinateToOriginCoordinate(Z));if(!J)return!1;return J.hasBlock(L6.globalCoordinateToLocalCoordinate(Z))}hasChunk(Z){return this._chunks.has(this._getChunkKey(Z))}setBlock(Z,J){let Y=L6.globalCoordinateToLocalCoordinate(Z),$=L6.globalCoordinateToOriginCoordinate(Z),W=this.getChunk($);if(!W)W=new L6,W.spawn(this._world,$);W.setBlock(Y,J)}updateChunks(){this._chunks.forEach((Z)=>{if(Z.requiresUpdate)Z.update()})}_getChunkKey(Z){return`${Z.x},${Z.y},${Z.z}`}}var L41={type:"dynamic",softCcdPrediction:1},B41=0.0025000000000000005,O41=Math.cos(0.005),WV;((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"})(WV||={});class _8 extends jY{_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)f.fatalError("Entity.constructor(): Entity data must include a blockTextureUri or modelUri, but not both.");if(J&&!Z.blockHalfExtents)f.fatalError("Entity.constructor(): Block entity must have blockHalfExtents!");if(Z.parent&&!Z.parent.isSpawned)f.fatalError("Entity.constructor(): Parent entity must be spawned before child entity!");if(Z.parent?.modelUri&&Z.parentNodeName&&!d5.instance.modelHasNode(Z.parent.modelUri,Z.parentNodeName))f.fatalError(`Entity.constructor(): Parent node name ${Z.parentNodeName} not found in parent model ${Z.parent.modelUri}!`);super(Z.rigidBodyOptions??L41);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?d5.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 f.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 N5(N5.optionsFromBlockHalfExtents(this._blockHalfExtents)));if(this._modelUri&&this.numColliders===0&&this._modelPreferredShape!=="none")this.addChildColliderToSimulation(new N5(N5.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(D9.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 f.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((W)=>W.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 b0.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)f.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,W=Z.z-J.z;return Y*Y+$*$+W*W>B41}_rotationExceedsThreshold(Z,J){return Math.abs(Z.x*J.x+Z.y*J.y+Z.z*J.z+Z.w*J.w)<O41}}var NA;((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"})(NA||={});class QV extends S0{_id;_attachedToEntity;_offset;_position;_state={};_templateId;_viewDistance;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)f.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 f.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 f.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 b0.serializeSceneUI(this)}}class t4 extends _8{player;nametagSceneUI;constructor(Z){super(Z);this.player=Z.player,this.nametagSceneUI=new QV({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 f.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 KV{_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)f.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 f.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 t4)Z.push(J)}),Z}getPlayerEntitiesByPlayer(Z){let J=[];return this._entities.forEach((Y)=>{if(Y instanceof t4&&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 GV{_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 M41;((Y)=>{Y[Y.POINTLIGHT=0]="POINTLIGHT";Y[Y.SPOTLIGHT=1]="SPOTLIGHT"})(M41||={});var PA;((H)=>{H.DESPAWN="LIGHT.DESPAWN";H.SET_ANGLE="LIGHT.SET_ANGLE";H.SET_ATTACHED_TO_ENTITY="LIGHT.SET_ATTACHED_TO_ENTITY";H.SET_COLOR="LIGHT.SET_COLOR";H.SET_DISTANCE="LIGHT.SET_DISTANCE";H.SET_INTENSITY="LIGHT.SET_INTENSITY";H.SET_OFFSET="LIGHT.SET_OFFSET";H.SET_PENUMBRA="LIGHT.SET_PENUMBRA";H.SET_POSITION="LIGHT.SET_POSITION";H.SET_TRACKED_ENTITY="LIGHT.SET_TRACKED_ENTITY";H.SET_TRACKED_POSITION="LIGHT.SET_TRACKED_POSITION";H.SPAWN="LIGHT.SPAWN"})(PA||={});class jA extends S0{_id;_angle;_attachedToEntity;_color;_distance;_intensity;_offset;_penumbra;_position;_trackedEntity;_trackedPosition;_type;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)f.fatalError("Either attachedToEntity or position must be set, but not both");super();f.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 f.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 f.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 f.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 b0.serializeLight(this)}}var R41;(($)=>{$[$.FIRST_PERSON=0]="FIRST_PERSON";$[$.THIRD_PERSON=1]="THIRD_PERSON";$[$.SPECTATOR=2]="SPECTATOR"})(R41||={});var DA;((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"})(DA||={});class zV extends S0{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 f.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 b0.serializePlayerCamera(this)}_requirePlayerWorld(){if(!this.player.world)f.error(`PlayerCamera._requirePlayerWorld(): Player ${this.player.id} is not in a world!`);return!!this.player.world}}var SO;((W)=>{W.DATA="PLAYER_UI.DATA";W.LOAD="PLAYER_UI.LOAD";W.LOCK_POINTER="PLAYER_UI.LOCK_POINTER";W.SEND_DATA="PLAYER_UI.SEND_DATA"})(SO||={});class FV extends S0{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 VV{_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);this._cleanupBlockTypeColliderHandles.clear();for(let Z of this._cleanupCollisionCallbackColliderHandles)this._colliderHandleCollisionCallbackMap.delete(Z);this._cleanupCollisionCallbackColliderHandles.clear();for(let Z of this._cleanupEntityColliderHandles)this._colliderHandleEntityMap.delete(Z);this._cleanupEntityColliderHandles.clear(),[[this._pendingCleanupBlockTypeColliderHandles,this._cleanupBlockTypeColliderHandles],[this._pendingCleanupCollisionCallbackColliderHandles,this._cleanupCollisionCallbackColliderHandles],[this._pendingCleanupEntityColliderHandles,this._cleanupEntityColliderHandles]].forEach(([Z,J])=>{for(let Y of Z.keys())J.add(Y);Z.clear()})}_requireSimulatedCollider(Z){if(!Z.rawCollider)f.error("ColliderMap._requireSimulatedCollider(): Collider is not in the simulation.");return!!Z.rawCollider}}var kr8={x:0,y:-32,z:0},CA=60,TA;((W)=>{W.STEP_START="SIMULATION.STEP_START";W.STEP_END="SIMULATION.STEP_END";W.DEBUG_RAYCAST="SIMULATION.DEBUG_RAYCAST";W.DEBUG_RENDER="SIMULATION.DEBUG_RENDER"})(TA||={});class HV extends S0{_colliderMap=new VV;_debugRaycastingEnabled=!1;_debugRenderingEnabled=!1;_rapierEventQueue;_rapierSimulation;_world;constructor(Z,J=CA,Y=kr8){super();this._rapierEventQueue=new r0.EventQueue(!0),this._rapierSimulation=new r0.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 W=new r0.Ray(Z,J),Q=this._rapierSimulation.castRay(W,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:!!Q});if(!Q)return null;let X=W.pointAt(Q.timeOfImpact),K=Q.timeOfImpact,G=Q.collider,z=this._colliderMap.getColliderHandleBlockType(G.handle);if(z)return{hitBlock:FW.fromGlobalCoordinate({x:Math.floor(X.x-(W.dir.x<0?0.0001:-0.0001)),y:Math.floor(X.y-(W.dir.y<0?0.0001:-0.0001)),z:Math.floor(X.z-(W.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,($,W)=>{if($.numContacts()===0)return;let Q=$.normal(),X=[];for(let K=0;K<$.numSolverContacts();K++)X.push($.solverContactPoint(K));Y.push({contactPoints:X,localNormalA:!W?$.localNormal1():$.localNormal2(),localNormalB:!W?$.localNormal2():$.localNormal1(),normal:!W?Q:{x:-Q.x,y:-Q.y,z:-Q.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(a1.startSpan({operation:"physics_step"},()=>{this._rapierSimulation.step(this._rapierEventQueue)}),a1.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[$,W]=this._getCollisionObjects(Z,J);if(!$||!W)return;let Q=(X,K)=>{if(X instanceof P5&&K instanceof _8&&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 _8&&K instanceof P5&&X.hasListeners("ENTITY.BLOCK_COLLISION"))X.emit("ENTITY.BLOCK_COLLISION",{entity:X,blockType:K,started:Y,colliderHandleA:Z,colliderHandleB:J});else if(X instanceof _8&&K instanceof _8&&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 _8||K instanceof P5))X(K,Y,Z,J)};Q($,W),Q(W,$)};_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()},W=(Q,X)=>{if(Q instanceof P5&&X instanceof _8&&Q.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))Q.emit("BLOCK_TYPE.ENTITY_CONTACT_FORCE",{blockType:Q,entity:X,contactForceData:$});else if(Q instanceof _8&&X instanceof P5&&Q.hasListeners("ENTITY.BLOCK_CONTACT_FORCE"))Q.emit("ENTITY.BLOCK_CONTACT_FORCE",{entity:Q,blockType:X,contactForceData:$});else if(Q instanceof _8&&X instanceof _8&&Q.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))Q.emit("ENTITY.ENTITY_CONTACT_FORCE",{entity:Q,otherEntity:X,contactForceData:$})};W(J,Y),W(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 _O{_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;a1.startSpan({operation:"build_packets"},()=>{this._queuedPerPlayerSynchronizations.forEach((H,q)=>{this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(...H)});let $=Object.values(this._queuedEntitySynchronizations);if($.length>0){let[H,q]=$.reduce(([U,L],w)=>{for(let O in w)if(O!=="i"&&O!=="p"&&O!=="r")return U.push(w),[U,L];return L.push(w),[U,L]},[[],[]]);if(q.length>0){let U=s.createPacket(s.outboundPackets.entitiesPacketDefinition,q,Y);J.push(U)}if(H.length>0){let U=s.createPacket(s.outboundPackets.entitiesPacketDefinition,H,Y);Z.push(U),this._synchronizedPlayerReliablePackets.forEach((L)=>L.push(U))}}let W=Object.values(this._queuedAudioSynchronizations);if(W.length>0){let H=s.createPacket(s.outboundPackets.audiosPacketDefinition,W,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}let Q=Object.values(this._queuedBlockTypeSynchronizations);if(Q.length>0){let H=s.createPacket(s.outboundPackets.blockTypesPacketDefinition,Q,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}let X=Object.values(this._queuedBlockSynchronizations);if(X.length>0){let H=s.createPacket(s.outboundPackets.blocksPacketDefinition,X,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}let K=Object.values(this._queuedChunkSynchronizations);if(K.length>0){let H=s.createPacket(s.outboundPackets.chunksPacketDefinition,K,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}let G=Object.values(this._queuedLightSynchronizations);if(G.length>0){let H=s.createPacket(s.outboundPackets.lightsPacketDefinition,G,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}this._queuedPerPlayerUISynchronizations.forEach((H,q)=>{let U=s.createPacket(s.outboundPackets.uiPacketDefinition,H,Y);this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(U)}),this._queuedPerPlayerUIDatasSynchronizations.forEach((H,q)=>{let U=s.createPacket(s.outboundPackets.uiDatasPacketDefinition,H,Y);this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(U)});let z=Object.values(this._queuedSceneUISynchronizations);if(z.length>0){let H=s.createPacket(s.outboundPackets.sceneUIsPacketDefinition,z,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}if(this._queuedWorldSynchronization){let H=s.createPacket(s.outboundPackets.worldPacketDefinition,this._queuedWorldSynchronization,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}this._queuedPerPlayerCameraSynchronizations.forEach((H,q)=>{let U=s.createPacket(s.outboundPackets.cameraPacketDefinition,H,Y);this._createOrGetSynchronizedPlayerReliablePackets(q,Z).push(U)});let F=Object.values(this._queuedPlayerSynchronizations);if(F.length>0){let H=s.createPacket(s.outboundPackets.playersPacketDefinition,F,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}this._queuedBroadcasts.forEach((H)=>{Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))});let V=this._queuedDebugRaycastSynchronizations;if(V.length>0){let H=s.createPacket(s.outboundPackets.physicsDebugRaycastsPacketDefinition,V,Y);Z.push(H),this._synchronizedPlayerReliablePackets.forEach((q)=>q.push(H))}}),a1.startSpan({operation:"send_all_packets"},()=>{D5.instance.getConnectedPlayersByWorld(this._world).forEach(($)=>{let W=this._synchronizedPlayerReliablePackets.get($)??Z;if(W.length>0)$.connection.send(W);if(J.length>0)$.connection.send(J,!1)})}),a1.startSpan({operation:"network_synchronize_cleanup"},()=>{this._queuedBroadcasts=[],this._queuedAudioSynchronizations={},this._queuedBlockSynchronizations={},this._queuedBlockTypeSynchronizations={},this._queuedChunkSynchronizations={},this._queuedDebugRaycastSynchronizations=[],this._queuedEntitySynchronizations={},this._queuedLightSynchronizations={},this._queuedPerPlayerSynchronizations.clear(),this._queuedPerPlayerCameraSynchronizations.clear(),this._queuedPerPlayerUISynchronizations.clear(),this._queuedPerPlayerUIDatasSynchronizations.clear(),this._queuedPlayerSynchronizations={},this._queuedSceneUISynchronizations={},this._queuedWorldSynchronization=void 0,this._loadedSceneUIs.clear(),this._spawnedChunks.clear(),this._spawnedEntities.clear(),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?b0.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(s.createPacket(s.outboundPackets.chatMessagesPacketDefinition,[{m:Y,c:$,p:J?.id}],this._world.loop.currentTick))};_onChatSendPlayerMessage=(Z)=>{let{player:J,message:Y,color:$}=Z,W=this._queuedPerPlayerSynchronizations.get(J)??[];W.push(s.createPacket(s.outboundPackets.chatMessagesPacketDefinition,[{m:Y,c:$}],this._world.loop.currentTick)),this._queuedPerPlayerSynchronizations.set(J,W)};_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?b0.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=b0.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?b0.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?b0.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?b0.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=b0.serializeVector(Z.entity.position),delete J.et,delete J.pt};_onPlayerCameraLookAtPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=Z.position?b0.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?b0.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?b0.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?b0.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(s.createPacket(s.outboundPackets.worldPacketDefinition,this._world.serialize(),this._world.loop.currentTick)),Y.push(s.createPacket(s.outboundPackets.blockTypesPacketDefinition,this._world.blockTypeRegistry.serialize(),this._world.loop.currentTick)),Y.push(s.createPacket(s.outboundPackets.chunksPacketDefinition,this._world.chunkLattice.getAllChunks().map((W)=>W.serialize()),this._world.loop.currentTick)),Y.push(s.createPacket(s.outboundPackets.entitiesPacketDefinition,this._world.entityManager.getAllEntities().map((W)=>{if(J.camera.attachedToEntity===void 0&&W instanceof t4&&W.player===J)J.camera.setAttachedToEntity(W);return W.serialize()}),this._world.loop.currentTick)),Y.push(s.createPacket(s.outboundPackets.audiosPacketDefinition,this._world.audioManager.getAllAudios().map((W)=>W.serialize()),this._world.loop.currentTick)),Y.push(s.createPacket(s.outboundPackets.lightsPacketDefinition,this._world.lightManager.getAllLights().map((W)=>W.serialize()),this._world.loop.currentTick)),Y.push(s.createPacket(s.outboundPackets.sceneUIsPacketDefinition,this._world.sceneUIManager.getAllSceneUIs().map((W)=>W.serialize()),this._world.loop.currentTick)),Y.push(s.createPacket(s.outboundPackets.playersPacketDefinition,D5.instance.getConnectedPlayers().map((W)=>W.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([s.createPacket(s.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?b0.serializeVector(Z.offset):void 0};_onSceneUISetPosition=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.p=Z.position?b0.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(b0.serializePhysicsDebugRaycast(Z))};_onSimulationDebugRender=(Z)=>{this._queuedBroadcasts.push(s.createPacket(s.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=b0.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=b0.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=b0.serializeVector(Z.position)};_createOrGetQueuedAudioSync(Z){if(Z.id===void 0)f.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)f.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)f.fatalError("NetworkSynchronizer._createOrGetQueuedEntitySync(): Entity has no id!");return this._queuedEntitySynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedLightSync(Z){if(Z.id===void 0)f.fatalError("NetworkSynchronizer._createOrGetQueuedLightSync(): Light has no id!");return this._queuedLightSynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedPlayerSync(Z){if(Z.id===void 0)f.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)f.fatalError("NetworkSynchronizer._createOrGetQueuedSceneUISync(): SceneUI has no id!");return this._queuedSceneUISynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedWorldSync(Z){if(Z.id!==this._world.id)f.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 qV{_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 Er8=2,Ir8=3;class UV{_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*Ir8,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 f.warning("Ticker.start(): ticker already running.");this._lastLoopTimeMs=performance.now();let Z=()=>{a1.startSpan({operation:"ticker_tick"},()=>{let J=performance.now(),Y=J-this._lastLoopTimeMs;if(this._lastLoopTimeMs=J,this._accumulatorMs+=Y,this._accumulatorMs>this._maxAccumulatorMs)this._accumulatorMs=this._maxAccumulatorMs;let $=0;while(this._accumulatorMs>=this._fixedTimestepMs&&$<Er8)this._tick(this._fixedTimestepMs),this._accumulatorMs-=this._fixedTimestepMs,$++;this._nextTickMs=this._fixedTimestepMs-this._accumulatorMs}),this._tickHandle=setTimeout(Z,0)};Z()}stop(){if(!this._tickHandle)return f.warning("Ticker.stop(): ticker not running.");clearTimeout(this._tickHandle),this._tickHandle=null}_tick(Z){try{this._tickFunction(Z)}catch(J){if(J instanceof Error&&this._tickErrorCallback)this._tickErrorCallback(J);else f.warning(`Ticker._tick(): tick callback threw an error, but it was not an instance of Error. Error: ${J}`)}}}var N41;((Q)=>{Q.START="WORLD_LOOP.START";Q.STOP="WORLD_LOOP.STOP";Q.TICK_START="WORLD_LOOP.TICK_START";Q.TICK_END="WORLD_LOOP.TICK_END";Q.TICK_ERROR="WORLD_LOOP.TICK_ERROR"})(N41||={});class wV extends S0{_currentTick=0;_ticker;_world;constructor(Z,J=CA){super();this._ticker=new UV(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();a1.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}},()=>{a1.startSpan({operation:"chunks_update"},()=>this._world.chunkLattice.updateChunks()),a1.startSpan({operation:"entities_tick"},()=>this._world.entityManager.tickEntities(Z)),a1.startSpan({operation:"simulation_step"},()=>this._world.simulation.step(Z)),a1.startSpan({operation:"entities_emit_updates"},()=>this._world.entityManager.checkAndEmitUpdates()),a1.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)=>{f.error(`WorldLoop._onTickError(): Error: ${Z}`),this.emitWithWorld(this._world,"WORLD_LOOP.TICK_ERROR",{worldLoop:this,error:Z})}}var kA;((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"})(kA||={});class LV extends S0{_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 wK(this),this._blockTypeRegistry=new CG(this),this._chatManager=new BV(this),this._chunkLattice=new $V(this),this._entityManager=new KV(this),this._lightManager=new GV(this),this._loop=new wV(this,Z.tickRate),this._networkSynchronizer=new _O(this),this._sceneUIManager=new qV(this),this._simulation=new HV(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[$,W,Q]=J.split(",").map(Number);this.chunkLattice.setBlock({x:$,y:W,z:Q},Y)}if(Z.entities)for(let[J,Y]of Object.entries(Z.entities)){let[$,W,Q]=J.split(",").map(Number);new _8(Y).spawn(this,{x:$,y:W,z:Q})}}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 b0.serializeWorld(this)}}var vr8=1,P41;((J)=>J.WORLD_CREATED="WORLD_MANAGER.WORLD_CREATED")(P41||={});class GK{static instance=new GK;_worlds=new Map;_nextWorldId=1;createWorld(Z){let J=new LV({...Z,id:this._nextWorldId++});return J.start(),this._worlds.set(J.id,J),n8.emit("WORLD_MANAGER.WORLD_CREATED",{world:J}),J}getAllWorlds(){return Array.from(this._worlds.values())}getDefaultWorld(){return this._worlds.get(vr8)??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 j41;((Y)=>{Y.START="GAMESERVER.START";Y.STOP="GAMESERVER.STOP"})(j41||={});function Sr8(Z){r0.init().then(()=>{return ZZ.instance.modelRegistry.preloadModels()}).then(()=>{Z(ZZ.instance.worldManager.getDefaultWorld()),ZZ.instance.start()}).catch((J)=>{f.fatalError(`Failed to initialize the game engine, exiting. Error: ${J}`)})}class ZZ{static _instance;_modelRegistry=d5.instance;_playerManager=D5.instance;_socket=gZ.instance;_worldManager=GK.instance;_webServer=cQ.instance;constructor(){}static get instance(){if(!this._instance)this._instance=new ZZ;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(){n8.emit("GAMESERVER.START",{startedAtMs:performance.now()}),this._webServer.start()}}class QW{static instance=new QW;constructor(){}async getGlobalData(Z){let J=await I4.instance.getData(Z);if(!J||J.error){if(J?.error)f.warning(`PersistenceManager.getGlobalData(): ${J.error.message}`);return}return J}async getPlayerData(Z){let J=await I4.instance.getData(this._getPlayerKey(Z));if(!J||J.error){if(J?.error)f.warning(`PersistenceManager.getPlayerData(): ${J.error.message}`);return}return J}async setGlobalData(Z,J){let Y=await I4.instance.setData(Z,J);if(!Y||Y.error){if(Y?.error)f.warning(`PersistenceManager.setGlobalData(): ${Y.error.message}`);return}return Y}async setPlayerData(Z,J){let Y=await I4.instance.setData(this._getPlayerKey(Z),J);if(!Y||Y.error){if(Y?.error)f.warning(`PersistenceManager.setPlayerData(): ${Y.error.message}`);return}return Y}_getPlayerKey(Z){return`player-${Z.id}`}}var D41=["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"],XV;((Q)=>{Q.CHAT_MESSAGE_SEND="PLAYER.CHAT_MESSAGE_SEND";Q.JOINED_WORLD="PLAYER.JOINED_WORLD";Q.LEFT_WORLD="PLAYER.LEFT_WORLD";Q.RECONNECTED_WORLD="PLAYER.RECONNECTED_WORLD";Q.REQUEST_SYNC="PLAYER.REQUEST_SYNC"})(XV||={});class XK extends S0{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 zV(this),this.connection=Z,this.ui=new FV(this),Z.onPacket(s.PacketId.CHAT_MESSAGE_SEND,this._onChatMessageSendPacket),Z.onPacket(s.PacketId.DEBUG_CONFIG,this._onDebugConfigPacket),Z.onPacket(s.PacketId.INPUT,this._onInputPacket),Z.onPacket(s.PacketId.SYNC_REQUEST,this._onSyncRequestPacket),Z.onPacket(s.PacketId.UI_DATA_SEND,this._onUIDataSendPacket),this.joinWorld(ZZ.instance.worldManager.getDefaultWorld())}get input(){return this._input}get world(){return this._world}disconnect(){this._leaveWorld(),this.connection.disconnect()}async getPersistedData(){return QW.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 QW.instance.setPlayerData(this,Z)}serialize(){return b0.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(D41.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 EA;((Y)=>{Y.BROADCAST_MESSAGE="CHAT.BROADCAST_MESSAGE";Y.PLAYER_MESSAGE="CHAT.PLAYER_MESSAGE"})(EA||={});class BV extends S0{_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,[$,...W]=Y.split(" "),Q=this._commandCallbacks[$];if(Q){Q(J,W,Y);return}this._sendBroadcastMessage(J,Y)})}_sendBroadcastMessage(Z,J,Y){this.emitWithWorld(this._world,"CHAT.BROADCAST_MESSAGE",{player:Z,message:J,color:Y})}}class OV extends gJ{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 f.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 P5)||!J.isLiquid)this._groundContactCount+=Y?1:-1;if(!this._groundContactCount&&!this.isSwimming)Z.startModelOneshotAnimations(this.jumpOneshotAnimations);else Z.stopModelAnimations(this.jumpOneshotAnimations);if(!(J instanceof _8)||!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:W,a:Q,s:X,d:K,sp:G,sh:z,ml:F}=J,{yaw:V}=Y,H=Z.linearVelocity,q={x:0,y:0,z:0},U=z;if(this.isGrounded&&!this.isSwimming&&(W||Q||X||K)){if(U)Z.stopModelAnimations(Array.from(Z.modelLoopedAnimations).filter((R)=>!this.runLoopedAnimations.includes(R))),Z.startModelLoopedAnimations(this.runLoopedAnimations),this._stepAudio?.setPlaybackRate(0.75);else Z.stopModelAnimations(Array.from(Z.modelLoopedAnimations).filter((R)=>!this.walkLoopedAnimations.includes(R))),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((R)=>!this.idleLoopedAnimations.includes(R))),Z.startModelLoopedAnimations(this.idleLoopedAnimations);if(F)Z.startModelOneshotAnimations(this.interactOneshotAnimations),J.ml=!this.autoCancelMouseLeftClick;if(U&&this.canRun(this)||!U&&this.canWalk(this)){let R=!this.isSwimming?U?this.runVelocity:this.walkVelocity:U?this.swimFastVelocity:this.swimSlowVelocity;if(W)q.x-=R*Math.sin(V),q.z-=R*Math.cos(V);if(X)q.x+=R*Math.sin(V),q.z+=R*Math.cos(V);if(Q)q.x-=R*Math.cos(V),q.z+=R*Math.sin(V);if(K)q.x+=R*Math.cos(V),q.z-=R*Math.sin(V);let N=Math.sqrt(q.x*q.x+q.z*q.z);if(N>R){let P=R/N;q.x*=P,q.z*=P}}if(this.isSwimming){if(H.y<this.swimMaxGravityVelocity)Z.setLinearVelocity({...H,y:this.swimMaxGravityVelocity});if(H.y>this.swimUpwardVelocity*2)Z.setLinearVelocity({...H,y:this.swimUpwardVelocity*2})}if(G&&this.canJump(this)){if(this.isGrounded&&!this.isSwimming&&H.y>-0.001&&H.y<=3)q.y=this.jumpVelocity;else if(this.isSwimming&&performance.now()>this._swimUpwardCooldownAt)q.y=this.swimUpwardVelocity*Z.gravityScale}let L=this._platform?this._platform.linearVelocity:{x:0,y:0,z:0},w={x:q.x-H.x+L.x,y:q.y+L.y,z:q.z-H.z+L.z};if(!(this.runVelocity>0&&Math.abs(H.x)>this.runVelocity||this.jumpVelocity>0&&Math.abs(H.y)>this.jumpVelocity||this.runVelocity>0&&Math.abs(H.z)>this.runVelocity)||this.isOnPlatform){if(Object.values(w).some((R)=>R!==0)){let R=Z.mass;Z.applyImpulse({x:w.x*R,y:w.y*R,z:w.z*R})}}if(V!==void 0){let R=V/2;Z.setRotation({x:0,y:Math.fround(Math.sin(R)),z:0,w:Math.fround(Math.cos(R))})}}}class IA extends t4{constructor(Z){super({modelUri:"models/players/player.gltf",modelLoopedAnimations:["idle_lower","idle_upper"],modelScale:0.5,...Z});if(!Z.controller)this.setController(new OV)}}var L0=0.000001,n0=typeof Float32Array!=="undefined"?Float32Array:Array,e4=Math.random;var cl6=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 C8={};R9(C8,{transpose:()=>br8,subtract:()=>T41,sub:()=>Jt8,str:()=>ir8,set:()=>yr8,scale:()=>cr8,rotate:()=>ur8,multiplyScalarAndAdd:()=>er8,multiplyScalar:()=>tr8,multiply:()=>C41,mul:()=>Zt8,invert:()=>gr8,identity:()=>hr8,fromValues:()=>fr8,fromScaling:()=>pr8,fromRotation:()=>lr8,frob:()=>nr8,exactEquals:()=>or8,equals:()=>rr8,determinant:()=>dr8,create:()=>_r8,copy:()=>Ar8,clone:()=>xr8,adjoint:()=>mr8,add:()=>sr8,LDU:()=>ar8});function _r8(){var Z=new n0(4);if(n0!=Float32Array)Z[1]=0,Z[2]=0;return Z[0]=1,Z[3]=1,Z}function xr8(Z){var J=new n0(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function Ar8(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function hr8(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=1,Z}function fr8(Z,J,Y,$){var W=new n0(4);return W[0]=Z,W[1]=J,W[2]=Y,W[3]=$,W}function yr8(Z,J,Y,$,W){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=W,Z}function br8(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 gr8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=Y*Q-W*$;if(!X)return null;return X=1/X,Z[0]=Q*X,Z[1]=-$*X,Z[2]=-W*X,Z[3]=Y*X,Z}function mr8(Z,J){var Y=J[0];return Z[0]=J[3],Z[1]=-J[1],Z[2]=-J[2],Z[3]=Y,Z}function dr8(Z){return Z[0]*Z[3]-Z[2]*Z[1]}function C41(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=Y[0],G=Y[1],z=Y[2],F=Y[3];return Z[0]=$*K+Q*G,Z[1]=W*K+X*G,Z[2]=$*z+Q*F,Z[3]=W*z+X*F,Z}function ur8(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G+Q*K,Z[1]=W*G+X*K,Z[2]=$*-K+Q*G,Z[3]=W*-K+X*G,Z}function cr8(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=Y[0],G=Y[1];return Z[0]=$*K,Z[1]=W*K,Z[2]=Q*G,Z[3]=X*G,Z}function lr8(Z,J){var Y=Math.sin(J),$=Math.cos(J);return Z[0]=$,Z[1]=Y,Z[2]=-Y,Z[3]=$,Z}function pr8(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=J[1],Z}function ir8(Z){return"mat2("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}function nr8(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3])}function ar8(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 sr8(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 T41(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 or8(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function rr8(Z,J){var Y=Z[0],$=Z[1],W=Z[2],Q=Z[3],X=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(Y-X)<=L0*Math.max(1,Math.abs(Y),Math.abs(X))&&Math.abs($-K)<=L0*Math.max(1,Math.abs($),Math.abs(K))&&Math.abs(W-G)<=L0*Math.max(1,Math.abs(W),Math.abs(G))&&Math.abs(Q-z)<=L0*Math.max(1,Math.abs(Q),Math.abs(z))}function tr8(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 er8(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 Zt8=C41,Jt8=T41;var A1={};R9(A1,{transpose:()=>Gt8,translate:()=>Ht8,subtract:()=>E41,sub:()=>vt8,str:()=>Pt8,set:()=>Xt8,scale:()=>Ut8,rotate:()=>qt8,projection:()=>Nt8,normalFromMat4:()=>Rt8,multiplyScalarAndAdd:()=>Tt8,multiplyScalar:()=>Ct8,multiply:()=>k41,mul:()=>It8,invert:()=>zt8,identity:()=>Kt8,fromValues:()=>Qt8,fromTranslation:()=>wt8,fromScaling:()=>Bt8,fromRotation:()=>Lt8,fromQuat:()=>Mt8,fromMat4:()=>Yt8,fromMat2d:()=>Ot8,frob:()=>jt8,exactEquals:()=>kt8,equals:()=>Et8,determinant:()=>Vt8,create:()=>vA,copy:()=>Wt8,clone:()=>$t8,adjoint:()=>Ft8,add:()=>Dt8});function vA(){var Z=new n0(9);if(n0!=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 Yt8(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 $t8(Z){var J=new n0(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 Wt8(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 Qt8(Z,J,Y,$,W,Q,X,K,G){var z=new n0(9);return z[0]=Z,z[1]=J,z[2]=Y,z[3]=$,z[4]=W,z[5]=Q,z[6]=X,z[7]=K,z[8]=G,z}function Xt8(Z,J,Y,$,W,Q,X,K,G,z){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=W,Z[4]=Q,Z[5]=X,Z[6]=K,Z[7]=G,Z[8]=z,Z}function Kt8(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 Gt8(Z,J){if(Z===J){var Y=J[1],$=J[2],W=J[5];Z[1]=J[3],Z[2]=J[6],Z[3]=Y,Z[5]=J[7],Z[6]=$,Z[7]=W}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 zt8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],V=F*X-K*z,H=-F*Q+K*G,q=z*Q-X*G,U=Y*V+$*H+W*q;if(!U)return null;return U=1/U,Z[0]=V*U,Z[1]=(-F*$+W*z)*U,Z[2]=(K*$-W*X)*U,Z[3]=H*U,Z[4]=(F*Y-W*G)*U,Z[5]=(-K*Y+W*Q)*U,Z[6]=q*U,Z[7]=(-z*Y+$*G)*U,Z[8]=(X*Y-$*Q)*U,Z}function Ft8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=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]=W*z-$*F,Z[2]=$*K-W*X,Z[3]=K*G-Q*F,Z[4]=Y*F-W*G,Z[5]=W*Q-Y*K,Z[6]=Q*z-X*G,Z[7]=$*G-Y*z,Z[8]=Y*X-$*Q,Z}function Vt8(Z){var J=Z[0],Y=Z[1],$=Z[2],W=Z[3],Q=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8];return J*(z*Q-X*G)+Y*(-z*W+X*K)+$*(G*W-Q*K)}function k41(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],V=J[8],H=Y[0],q=Y[1],U=Y[2],L=Y[3],w=Y[4],O=Y[5],R=Y[6],N=Y[7],P=Y[8];return Z[0]=H*$+q*X+U*z,Z[1]=H*W+q*K+U*F,Z[2]=H*Q+q*G+U*V,Z[3]=L*$+w*X+O*z,Z[4]=L*W+w*K+O*F,Z[5]=L*Q+w*G+O*V,Z[6]=R*$+N*X+P*z,Z[7]=R*W+N*K+P*F,Z[8]=R*Q+N*G+P*V,Z}function Ht8(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],V=J[8],H=Y[0],q=Y[1];return Z[0]=$,Z[1]=W,Z[2]=Q,Z[3]=X,Z[4]=K,Z[5]=G,Z[6]=H*$+q*X+z,Z[7]=H*W+q*K+F,Z[8]=H*Q+q*G+V,Z}function qt8(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],V=J[8],H=Math.sin(Y),q=Math.cos(Y);return Z[0]=q*$+H*X,Z[1]=q*W+H*K,Z[2]=q*Q+H*G,Z[3]=q*X-H*$,Z[4]=q*K-H*W,Z[5]=q*G-H*Q,Z[6]=z,Z[7]=F,Z[8]=V,Z}function Ut8(Z,J,Y){var $=Y[0],W=Y[1];return Z[0]=$*J[0],Z[1]=$*J[1],Z[2]=$*J[2],Z[3]=W*J[3],Z[4]=W*J[4],Z[5]=W*J[5],Z[6]=J[6],Z[7]=J[7],Z[8]=J[8],Z}function wt8(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 Lt8(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 Bt8(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 Ot8(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 Mt8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=Y+Y,K=$+$,G=W+W,z=Y*X,F=$*X,V=$*K,H=W*X,q=W*K,U=W*G,L=Q*X,w=Q*K,O=Q*G;return Z[0]=1-V-U,Z[3]=F-O,Z[6]=H+w,Z[1]=F+O,Z[4]=1-z-U,Z[7]=q-L,Z[2]=H-w,Z[5]=q+L,Z[8]=1-z-V,Z}function Rt8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],V=J[9],H=J[10],q=J[11],U=J[12],L=J[13],w=J[14],O=J[15],R=Y*K-$*X,N=Y*G-W*X,P=Y*z-Q*X,D=$*G-W*K,j=$*z-Q*K,C=W*z-Q*G,k=F*L-V*U,I=F*w-H*U,A=F*O-q*U,v=V*w-H*L,x=V*O-q*L,d=H*O-q*w,h=R*d-N*x+P*v+D*A-j*I+C*k;if(!h)return null;return h=1/h,Z[0]=(K*d-G*x+z*v)*h,Z[1]=(G*A-X*d-z*I)*h,Z[2]=(X*x-K*A+z*k)*h,Z[3]=(W*x-$*d-Q*v)*h,Z[4]=(Y*d-W*A+Q*I)*h,Z[5]=($*A-Y*x-Q*k)*h,Z[6]=(L*C-w*j+O*D)*h,Z[7]=(w*P-U*C-O*N)*h,Z[8]=(U*j-L*P+O*R)*h,Z}function Nt8(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 Pt8(Z){return"mat3("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+")"}function jt8(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8])}function Dt8(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 E41(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 Ct8(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 Tt8(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 kt8(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 Et8(Z,J){var Y=Z[0],$=Z[1],W=Z[2],Q=Z[3],X=Z[4],K=Z[5],G=Z[6],z=Z[7],F=Z[8],V=J[0],H=J[1],q=J[2],U=J[3],L=J[4],w=J[5],O=J[6],R=J[7],N=J[8];return Math.abs(Y-V)<=L0*Math.max(1,Math.abs(Y),Math.abs(V))&&Math.abs($-H)<=L0*Math.max(1,Math.abs($),Math.abs(H))&&Math.abs(W-q)<=L0*Math.max(1,Math.abs(W),Math.abs(q))&&Math.abs(Q-U)<=L0*Math.max(1,Math.abs(Q),Math.abs(U))&&Math.abs(X-L)<=L0*Math.max(1,Math.abs(X),Math.abs(L))&&Math.abs(K-w)<=L0*Math.max(1,Math.abs(K),Math.abs(w))&&Math.abs(G-O)<=L0*Math.max(1,Math.abs(G),Math.abs(O))&&Math.abs(z-R)<=L0*Math.max(1,Math.abs(z),Math.abs(R))&&Math.abs(F-N)<=L0*Math.max(1,Math.abs(F),Math.abs(N))}var It8=k41,vt8=E41;var u0={};R9(u0,{transpose:()=>ft8,translate:()=>mt8,targetTo:()=>Ve8,subtract:()=>h41,sub:()=>Re8,str:()=>He8,set:()=>ht8,scale:()=>dt8,rotateZ:()=>pt8,rotateY:()=>lt8,rotateX:()=>ct8,rotate:()=>ut8,perspectiveZO:()=>Xe8,perspectiveNO:()=>x41,perspectiveFromFieldOfView:()=>Ke8,perspective:()=>Qe8,orthoZO:()=>ze8,orthoNO:()=>A41,ortho:()=>Ge8,multiplyScalarAndAdd:()=>Le8,multiplyScalar:()=>we8,multiply:()=>v41,mul:()=>Me8,lookAt:()=>Fe8,invert:()=>yt8,identity:()=>I41,getTranslation:()=>et8,getScaling:()=>_41,getRotation:()=>Ze8,frustum:()=>We8,fromZRotation:()=>rt8,fromYRotation:()=>ot8,fromXRotation:()=>st8,fromValues:()=>At8,fromTranslation:()=>it8,fromScaling:()=>nt8,fromRotationTranslationScaleOrigin:()=>Ye8,fromRotationTranslationScale:()=>Je8,fromRotationTranslation:()=>S41,fromRotation:()=>at8,fromQuat2:()=>tt8,fromQuat:()=>$e8,frob:()=>qe8,exactEquals:()=>Be8,equals:()=>Oe8,determinant:()=>gt8,create:()=>St8,copy:()=>xt8,clone:()=>_t8,adjoint:()=>bt8,add:()=>Ue8});function St8(){var Z=new n0(16);if(n0!=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 _t8(Z){var J=new n0(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 xt8(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 At8(Z,J,Y,$,W,Q,X,K,G,z,F,V,H,q,U,L){var w=new n0(16);return w[0]=Z,w[1]=J,w[2]=Y,w[3]=$,w[4]=W,w[5]=Q,w[6]=X,w[7]=K,w[8]=G,w[9]=z,w[10]=F,w[11]=V,w[12]=H,w[13]=q,w[14]=U,w[15]=L,w}function ht8(Z,J,Y,$,W,Q,X,K,G,z,F,V,H,q,U,L,w){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=W,Z[4]=Q,Z[5]=X,Z[6]=K,Z[7]=G,Z[8]=z,Z[9]=F,Z[10]=V,Z[11]=H,Z[12]=q,Z[13]=U,Z[14]=L,Z[15]=w,Z}function I41(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 ft8(Z,J){if(Z===J){var Y=J[1],$=J[2],W=J[3],Q=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]=Q,Z[11]=J[14],Z[12]=W,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 yt8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],V=J[9],H=J[10],q=J[11],U=J[12],L=J[13],w=J[14],O=J[15],R=Y*K-$*X,N=Y*G-W*X,P=Y*z-Q*X,D=$*G-W*K,j=$*z-Q*K,C=W*z-Q*G,k=F*L-V*U,I=F*w-H*U,A=F*O-q*U,v=V*w-H*L,x=V*O-q*L,d=H*O-q*w,h=R*d-N*x+P*v+D*A-j*I+C*k;if(!h)return null;return h=1/h,Z[0]=(K*d-G*x+z*v)*h,Z[1]=(W*x-$*d-Q*v)*h,Z[2]=(L*C-w*j+O*D)*h,Z[3]=(H*j-V*C-q*D)*h,Z[4]=(G*A-X*d-z*I)*h,Z[5]=(Y*d-W*A+Q*I)*h,Z[6]=(w*P-U*C-O*N)*h,Z[7]=(F*C-H*P+q*N)*h,Z[8]=(X*x-K*A+z*k)*h,Z[9]=($*A-Y*x-Q*k)*h,Z[10]=(U*j-L*P+O*R)*h,Z[11]=(V*P-F*j-q*R)*h,Z[12]=(K*I-X*v-G*k)*h,Z[13]=(Y*v-$*I+W*k)*h,Z[14]=(L*N-U*D-w*R)*h,Z[15]=(F*D-V*N+H*R)*h,Z}function bt8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=J[4],K=J[5],G=J[6],z=J[7],F=J[8],V=J[9],H=J[10],q=J[11],U=J[12],L=J[13],w=J[14],O=J[15];return Z[0]=K*(H*O-q*w)-V*(G*O-z*w)+L*(G*q-z*H),Z[1]=-($*(H*O-q*w)-V*(W*O-Q*w)+L*(W*q-Q*H)),Z[2]=$*(G*O-z*w)-K*(W*O-Q*w)+L*(W*z-Q*G),Z[3]=-($*(G*q-z*H)-K*(W*q-Q*H)+V*(W*z-Q*G)),Z[4]=-(X*(H*O-q*w)-F*(G*O-z*w)+U*(G*q-z*H)),Z[5]=Y*(H*O-q*w)-F*(W*O-Q*w)+U*(W*q-Q*H),Z[6]=-(Y*(G*O-z*w)-X*(W*O-Q*w)+U*(W*z-Q*G)),Z[7]=Y*(G*q-z*H)-X*(W*q-Q*H)+F*(W*z-Q*G),Z[8]=X*(V*O-q*L)-F*(K*O-z*L)+U*(K*q-z*V),Z[9]=-(Y*(V*O-q*L)-F*($*O-Q*L)+U*($*q-Q*V)),Z[10]=Y*(K*O-z*L)-X*($*O-Q*L)+U*($*z-Q*K),Z[11]=-(Y*(K*q-z*V)-X*($*q-Q*V)+F*($*z-Q*K)),Z[12]=-(X*(V*w-H*L)-F*(K*w-G*L)+U*(K*H-G*V)),Z[13]=Y*(V*w-H*L)-F*($*w-W*L)+U*($*H-W*V),Z[14]=-(Y*(K*w-G*L)-X*($*w-W*L)+U*($*G-W*K)),Z[15]=Y*(K*H-G*V)-X*($*H-W*V)+F*($*G-W*K),Z}function gt8(Z){var J=Z[0],Y=Z[1],$=Z[2],W=Z[3],Q=Z[4],X=Z[5],K=Z[6],G=Z[7],z=Z[8],F=Z[9],V=Z[10],H=Z[11],q=Z[12],U=Z[13],L=Z[14],w=Z[15],O=J*X-Y*Q,R=J*K-$*Q,N=J*G-W*Q,P=Y*K-$*X,D=Y*G-W*X,j=$*G-W*K,C=z*U-F*q,k=z*L-V*q,I=z*w-H*q,A=F*L-V*U,v=F*w-H*U,x=V*w-H*L;return O*x-R*v+N*A+P*I-D*k+j*C}function v41(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],V=J[8],H=J[9],q=J[10],U=J[11],L=J[12],w=J[13],O=J[14],R=J[15],N=Y[0],P=Y[1],D=Y[2],j=Y[3];return Z[0]=N*$+P*K+D*V+j*L,Z[1]=N*W+P*G+D*H+j*w,Z[2]=N*Q+P*z+D*q+j*O,Z[3]=N*X+P*F+D*U+j*R,N=Y[4],P=Y[5],D=Y[6],j=Y[7],Z[4]=N*$+P*K+D*V+j*L,Z[5]=N*W+P*G+D*H+j*w,Z[6]=N*Q+P*z+D*q+j*O,Z[7]=N*X+P*F+D*U+j*R,N=Y[8],P=Y[9],D=Y[10],j=Y[11],Z[8]=N*$+P*K+D*V+j*L,Z[9]=N*W+P*G+D*H+j*w,Z[10]=N*Q+P*z+D*q+j*O,Z[11]=N*X+P*F+D*U+j*R,N=Y[12],P=Y[13],D=Y[14],j=Y[15],Z[12]=N*$+P*K+D*V+j*L,Z[13]=N*W+P*G+D*H+j*w,Z[14]=N*Q+P*z+D*q+j*O,Z[15]=N*X+P*F+D*U+j*R,Z}function mt8(Z,J,Y){var $=Y[0],W=Y[1],Q=Y[2],X,K,G,z,F,V,H,q,U,L,w,O;if(J===Z)Z[12]=J[0]*$+J[4]*W+J[8]*Q+J[12],Z[13]=J[1]*$+J[5]*W+J[9]*Q+J[13],Z[14]=J[2]*$+J[6]*W+J[10]*Q+J[14],Z[15]=J[3]*$+J[7]*W+J[11]*Q+J[15];else X=J[0],K=J[1],G=J[2],z=J[3],F=J[4],V=J[5],H=J[6],q=J[7],U=J[8],L=J[9],w=J[10],O=J[11],Z[0]=X,Z[1]=K,Z[2]=G,Z[3]=z,Z[4]=F,Z[5]=V,Z[6]=H,Z[7]=q,Z[8]=U,Z[9]=L,Z[10]=w,Z[11]=O,Z[12]=X*$+F*W+U*Q+J[12],Z[13]=K*$+V*W+L*Q+J[13],Z[14]=G*$+H*W+w*Q+J[14],Z[15]=z*$+q*W+O*Q+J[15];return Z}function dt8(Z,J,Y){var $=Y[0],W=Y[1],Q=Y[2];return Z[0]=J[0]*$,Z[1]=J[1]*$,Z[2]=J[2]*$,Z[3]=J[3]*$,Z[4]=J[4]*W,Z[5]=J[5]*W,Z[6]=J[6]*W,Z[7]=J[7]*W,Z[8]=J[8]*Q,Z[9]=J[9]*Q,Z[10]=J[10]*Q,Z[11]=J[11]*Q,Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15],Z}function ut8(Z,J,Y,$){var W=$[0],Q=$[1],X=$[2],K=Math.hypot(W,Q,X),G,z,F,V,H,q,U,L,w,O,R,N,P,D,j,C,k,I,A,v,x,d,h,u;if(K<L0)return null;if(K=1/K,W*=K,Q*=K,X*=K,G=Math.sin(Y),z=Math.cos(Y),F=1-z,V=J[0],H=J[1],q=J[2],U=J[3],L=J[4],w=J[5],O=J[6],R=J[7],N=J[8],P=J[9],D=J[10],j=J[11],C=W*W*F+z,k=Q*W*F+X*G,I=X*W*F-Q*G,A=W*Q*F-X*G,v=Q*Q*F+z,x=X*Q*F+W*G,d=W*X*F+Q*G,h=Q*X*F-W*G,u=X*X*F+z,Z[0]=V*C+L*k+N*I,Z[1]=H*C+w*k+P*I,Z[2]=q*C+O*k+D*I,Z[3]=U*C+R*k+j*I,Z[4]=V*A+L*v+N*x,Z[5]=H*A+w*v+P*x,Z[6]=q*A+O*v+D*x,Z[7]=U*A+R*v+j*x,Z[8]=V*d+L*h+N*u,Z[9]=H*d+w*h+P*u,Z[10]=q*d+O*h+D*u,Z[11]=U*d+R*h+j*u,J!==Z)Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z}function ct8(Z,J,Y){var $=Math.sin(Y),W=Math.cos(Y),Q=J[4],X=J[5],K=J[6],G=J[7],z=J[8],F=J[9],V=J[10],H=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]=Q*W+z*$,Z[5]=X*W+F*$,Z[6]=K*W+V*$,Z[7]=G*W+H*$,Z[8]=z*W-Q*$,Z[9]=F*W-X*$,Z[10]=V*W-K*$,Z[11]=H*W-G*$,Z}function lt8(Z,J,Y){var $=Math.sin(Y),W=Math.cos(Y),Q=J[0],X=J[1],K=J[2],G=J[3],z=J[8],F=J[9],V=J[10],H=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]=Q*W-z*$,Z[1]=X*W-F*$,Z[2]=K*W-V*$,Z[3]=G*W-H*$,Z[8]=Q*$+z*W,Z[9]=X*$+F*W,Z[10]=K*$+V*W,Z[11]=G*$+H*W,Z}function pt8(Z,J,Y){var $=Math.sin(Y),W=Math.cos(Y),Q=J[0],X=J[1],K=J[2],G=J[3],z=J[4],F=J[5],V=J[6],H=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]=Q*W+z*$,Z[1]=X*W+F*$,Z[2]=K*W+V*$,Z[3]=G*W+H*$,Z[4]=z*W-Q*$,Z[5]=F*W-X*$,Z[6]=V*W-K*$,Z[7]=H*W-G*$,Z}function it8(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 nt8(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 at8(Z,J,Y){var $=Y[0],W=Y[1],Q=Y[2],X=Math.hypot($,W,Q),K,G,z;if(X<L0)return null;return X=1/X,$*=X,W*=X,Q*=X,K=Math.sin(J),G=Math.cos(J),z=1-G,Z[0]=$*$*z+G,Z[1]=W*$*z+Q*K,Z[2]=Q*$*z-W*K,Z[3]=0,Z[4]=$*W*z-Q*K,Z[5]=W*W*z+G,Z[6]=Q*W*z+$*K,Z[7]=0,Z[8]=$*Q*z+W*K,Z[9]=W*Q*z-$*K,Z[10]=Q*Q*z+G,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function st8(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 ot8(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 rt8(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 S41(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=$+$,G=W+W,z=Q+Q,F=$*K,V=$*G,H=$*z,q=W*G,U=W*z,L=Q*z,w=X*K,O=X*G,R=X*z;return Z[0]=1-(q+L),Z[1]=V+R,Z[2]=H-O,Z[3]=0,Z[4]=V-R,Z[5]=1-(F+L),Z[6]=U+w,Z[7]=0,Z[8]=H+O,Z[9]=U-w,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 tt8(Z,J){var Y=new n0(3),$=-J[0],W=-J[1],Q=-J[2],X=J[3],K=J[4],G=J[5],z=J[6],F=J[7],V=$*$+W*W+Q*Q+X*X;if(V>0)Y[0]=(K*X+F*$+G*Q-z*W)*2/V,Y[1]=(G*X+F*W+z*$-K*Q)*2/V,Y[2]=(z*X+F*Q+K*W-G*$)*2/V;else Y[0]=(K*X+F*$+G*Q-z*W)*2,Y[1]=(G*X+F*W+z*$-K*Q)*2,Y[2]=(z*X+F*Q+K*W-G*$)*2;return S41(Z,J,Y),Z}function et8(Z,J){return Z[0]=J[12],Z[1]=J[13],Z[2]=J[14],Z}function _41(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[4],X=J[5],K=J[6],G=J[8],z=J[9],F=J[10];return Z[0]=Math.hypot(Y,$,W),Z[1]=Math.hypot(Q,X,K),Z[2]=Math.hypot(G,z,F),Z}function Ze8(Z,J){var Y=new n0(3);_41(Y,J);var $=1/Y[0],W=1/Y[1],Q=1/Y[2],X=J[0]*$,K=J[1]*W,G=J[2]*Q,z=J[4]*$,F=J[5]*W,V=J[6]*Q,H=J[8]*$,q=J[9]*W,U=J[10]*Q,L=X+F+U,w=0;if(L>0)w=Math.sqrt(L+1)*2,Z[3]=0.25*w,Z[0]=(V-q)/w,Z[1]=(H-G)/w,Z[2]=(K-z)/w;else if(X>F&&X>U)w=Math.sqrt(1+X-F-U)*2,Z[3]=(V-q)/w,Z[0]=0.25*w,Z[1]=(K+z)/w,Z[2]=(H+G)/w;else if(F>U)w=Math.sqrt(1+F-X-U)*2,Z[3]=(H-G)/w,Z[0]=(K+z)/w,Z[1]=0.25*w,Z[2]=(V+q)/w;else w=Math.sqrt(1+U-X-F)*2,Z[3]=(K-z)/w,Z[0]=(H+G)/w,Z[1]=(V+q)/w,Z[2]=0.25*w;return Z}function Je8(Z,J,Y,$){var W=J[0],Q=J[1],X=J[2],K=J[3],G=W+W,z=Q+Q,F=X+X,V=W*G,H=W*z,q=W*F,U=Q*z,L=Q*F,w=X*F,O=K*G,R=K*z,N=K*F,P=$[0],D=$[1],j=$[2];return Z[0]=(1-(U+w))*P,Z[1]=(H+N)*P,Z[2]=(q-R)*P,Z[3]=0,Z[4]=(H-N)*D,Z[5]=(1-(V+w))*D,Z[6]=(L+O)*D,Z[7]=0,Z[8]=(q+R)*j,Z[9]=(L-O)*j,Z[10]=(1-(V+U))*j,Z[11]=0,Z[12]=Y[0],Z[13]=Y[1],Z[14]=Y[2],Z[15]=1,Z}function Ye8(Z,J,Y,$,W){var Q=J[0],X=J[1],K=J[2],G=J[3],z=Q+Q,F=X+X,V=K+K,H=Q*z,q=Q*F,U=Q*V,L=X*F,w=X*V,O=K*V,R=G*z,N=G*F,P=G*V,D=$[0],j=$[1],C=$[2],k=W[0],I=W[1],A=W[2],v=(1-(L+O))*D,x=(q+P)*D,d=(U-N)*D,h=(q-P)*j,u=(1-(H+O))*j,W0=(w+R)*j,U0=(U+N)*C,B0=(w-R)*C,y0=(1-(H+L))*C;return Z[0]=v,Z[1]=x,Z[2]=d,Z[3]=0,Z[4]=h,Z[5]=u,Z[6]=W0,Z[7]=0,Z[8]=U0,Z[9]=B0,Z[10]=y0,Z[11]=0,Z[12]=Y[0]+k-(v*k+h*I+U0*A),Z[13]=Y[1]+I-(x*k+u*I+B0*A),Z[14]=Y[2]+A-(d*k+W0*I+y0*A),Z[15]=1,Z}function $e8(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=Y+Y,K=$+$,G=W+W,z=Y*X,F=$*X,V=$*K,H=W*X,q=W*K,U=W*G,L=Q*X,w=Q*K,O=Q*G;return Z[0]=1-V-U,Z[1]=F+O,Z[2]=H-w,Z[3]=0,Z[4]=F-O,Z[5]=1-z-U,Z[6]=q+L,Z[7]=0,Z[8]=H+w,Z[9]=q-L,Z[10]=1-z-V,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function We8(Z,J,Y,$,W,Q,X){var K=1/(Y-J),G=1/(W-$),z=1/(Q-X);return Z[0]=Q*2*K,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=Q*2*G,Z[6]=0,Z[7]=0,Z[8]=(Y+J)*K,Z[9]=(W+$)*G,Z[10]=(X+Q)*z,Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=X*Q*2*z,Z[15]=0,Z}function x41(Z,J,Y,$,W){var Q=1/Math.tan(J/2),X;if(Z[0]=Q/Y,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=Q,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[11]=-1,Z[12]=0,Z[13]=0,Z[15]=0,W!=null&&W!==1/0)X=1/($-W),Z[10]=(W+$)*X,Z[14]=2*W*$*X;else Z[10]=-1,Z[14]=-2*$;return Z}var Qe8=x41;function Xe8(Z,J,Y,$,W){var Q=1/Math.tan(J/2),X;if(Z[0]=Q/Y,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=Q,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[11]=-1,Z[12]=0,Z[13]=0,Z[15]=0,W!=null&&W!==1/0)X=1/($-W),Z[10]=W*X,Z[14]=W*$*X;else Z[10]=-1,Z[14]=-$;return Z}function Ke8(Z,J,Y,$){var W=Math.tan(J.upDegrees*Math.PI/180),Q=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/(W+Q);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]=(W-Q)*z*0.5,Z[10]=$/(Y-$),Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=$*Y/(Y-$),Z[15]=0,Z}function A41(Z,J,Y,$,W,Q,X){var K=1/(J-Y),G=1/($-W),z=1/(Q-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]=(W+$)*G,Z[14]=(X+Q)*z,Z[15]=1,Z}var Ge8=A41;function ze8(Z,J,Y,$,W,Q,X){var K=1/(J-Y),G=1/($-W),z=1/(Q-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]=(W+$)*G,Z[14]=Q*z,Z[15]=1,Z}function Fe8(Z,J,Y,$){var W,Q,X,K,G,z,F,V,H,q,U=J[0],L=J[1],w=J[2],O=$[0],R=$[1],N=$[2],P=Y[0],D=Y[1],j=Y[2];if(Math.abs(U-P)<L0&&Math.abs(L-D)<L0&&Math.abs(w-j)<L0)return I41(Z);if(F=U-P,V=L-D,H=w-j,q=1/Math.hypot(F,V,H),F*=q,V*=q,H*=q,W=R*H-N*V,Q=N*F-O*H,X=O*V-R*F,q=Math.hypot(W,Q,X),!q)W=0,Q=0,X=0;else q=1/q,W*=q,Q*=q,X*=q;if(K=V*X-H*Q,G=H*W-F*X,z=F*Q-V*W,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]=W,Z[1]=K,Z[2]=F,Z[3]=0,Z[4]=Q,Z[5]=G,Z[6]=V,Z[7]=0,Z[8]=X,Z[9]=z,Z[10]=H,Z[11]=0,Z[12]=-(W*U+Q*L+X*w),Z[13]=-(K*U+G*L+z*w),Z[14]=-(F*U+V*L+H*w),Z[15]=1,Z}function Ve8(Z,J,Y,$){var W=J[0],Q=J[1],X=J[2],K=$[0],G=$[1],z=$[2],F=W-Y[0],V=Q-Y[1],H=X-Y[2],q=F*F+V*V+H*H;if(q>0)q=1/Math.sqrt(q),F*=q,V*=q,H*=q;var U=G*H-z*V,L=z*F-K*H,w=K*V-G*F;if(q=U*U+L*L+w*w,q>0)q=1/Math.sqrt(q),U*=q,L*=q,w*=q;return Z[0]=U,Z[1]=L,Z[2]=w,Z[3]=0,Z[4]=V*w-H*L,Z[5]=H*U-F*w,Z[6]=F*L-V*U,Z[7]=0,Z[8]=F,Z[9]=V,Z[10]=H,Z[11]=0,Z[12]=W,Z[13]=Q,Z[14]=X,Z[15]=1,Z}function He8(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 qe8(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 Ue8(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 h41(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 we8(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 Le8(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 Be8(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 Oe8(Z,J){var Y=Z[0],$=Z[1],W=Z[2],Q=Z[3],X=Z[4],K=Z[5],G=Z[6],z=Z[7],F=Z[8],V=Z[9],H=Z[10],q=Z[11],U=Z[12],L=Z[13],w=Z[14],O=Z[15],R=J[0],N=J[1],P=J[2],D=J[3],j=J[4],C=J[5],k=J[6],I=J[7],A=J[8],v=J[9],x=J[10],d=J[11],h=J[12],u=J[13],W0=J[14],U0=J[15];return Math.abs(Y-R)<=L0*Math.max(1,Math.abs(Y),Math.abs(R))&&Math.abs($-N)<=L0*Math.max(1,Math.abs($),Math.abs(N))&&Math.abs(W-P)<=L0*Math.max(1,Math.abs(W),Math.abs(P))&&Math.abs(Q-D)<=L0*Math.max(1,Math.abs(Q),Math.abs(D))&&Math.abs(X-j)<=L0*Math.max(1,Math.abs(X),Math.abs(j))&&Math.abs(K-C)<=L0*Math.max(1,Math.abs(K),Math.abs(C))&&Math.abs(G-k)<=L0*Math.max(1,Math.abs(G),Math.abs(k))&&Math.abs(z-I)<=L0*Math.max(1,Math.abs(z),Math.abs(I))&&Math.abs(F-A)<=L0*Math.max(1,Math.abs(F),Math.abs(A))&&Math.abs(V-v)<=L0*Math.max(1,Math.abs(V),Math.abs(v))&&Math.abs(H-x)<=L0*Math.max(1,Math.abs(H),Math.abs(x))&&Math.abs(q-d)<=L0*Math.max(1,Math.abs(q),Math.abs(d))&&Math.abs(U-h)<=L0*Math.max(1,Math.abs(U),Math.abs(h))&&Math.abs(L-u)<=L0*Math.max(1,Math.abs(L),Math.abs(u))&&Math.abs(w-W0)<=L0*Math.max(1,Math.abs(w),Math.abs(W0))&&Math.abs(O-U0)<=L0*Math.max(1,Math.abs(O),Math.abs(U0))}var Me8=v41,Re8=h41;var V1={};R9(V1,{str:()=>L06,squaredLength:()=>F71,sqrLen:()=>C06,sqlerp:()=>I06,slerp:()=>fO,setAxisAngle:()=>Y71,setAxes:()=>v06,set:()=>R06,scale:()=>K71,rotationTo:()=>E06,rotateZ:()=>z06,rotateY:()=>G06,rotateX:()=>K06,random:()=>H06,pow:()=>V06,normalize:()=>AA,multiply:()=>$71,mul:()=>P06,ln:()=>Q71,lerp:()=>j06,length:()=>z71,len:()=>D06,invert:()=>q06,identity:()=>W06,getAxisAngle:()=>Q06,getAngle:()=>X06,fromValues:()=>O06,fromMat3:()=>X71,fromEuler:()=>w06,exp:()=>W71,exactEquals:()=>T06,equals:()=>k06,dot:()=>G71,create:()=>xA,copy:()=>M06,conjugate:()=>U06,clone:()=>B06,calculateW:()=>F06,add:()=>N06});var l0={};R9(l0,{zero:()=>pe8,transformQuat:()=>me8,transformMat4:()=>be8,transformMat3:()=>ge8,subtract:()=>y41,sub:()=>se8,str:()=>ie8,squaredLength:()=>u41,squaredDistance:()=>d41,sqrLen:()=>Z06,sqrDist:()=>ee8,set:()=>je8,scaleAndAdd:()=>Se8,scale:()=>ve8,round:()=>Ie8,rotateZ:()=>ce8,rotateY:()=>ue8,rotateX:()=>de8,random:()=>ye8,normalize:()=>SA,negate:()=>_e8,multiply:()=>b41,mul:()=>oe8,min:()=>ke8,max:()=>Ee8,lerp:()=>Ae8,length:()=>f41,len:()=>_A,inverse:()=>xe8,hermite:()=>he8,fromValues:()=>AO,forEach:()=>J06,floor:()=>Te8,exactEquals:()=>ne8,equals:()=>ae8,dot:()=>hO,divide:()=>g41,div:()=>re8,distance:()=>m41,dist:()=>te8,cross:()=>MV,create:()=>xO,copy:()=>Pe8,clone:()=>Ne8,ceil:()=>Ce8,bezier:()=>fe8,angle:()=>le8,add:()=>De8});function xO(){var Z=new n0(3);if(n0!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function Ne8(Z){var J=new n0(3);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J}function f41(Z){var J=Z[0],Y=Z[1],$=Z[2];return Math.hypot(J,Y,$)}function AO(Z,J,Y){var $=new n0(3);return $[0]=Z,$[1]=J,$[2]=Y,$}function Pe8(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z}function je8(Z,J,Y,$){return Z[0]=J,Z[1]=Y,Z[2]=$,Z}function De8(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z[2]=J[2]+Y[2],Z}function y41(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z[2]=J[2]-Y[2],Z}function b41(Z,J,Y){return Z[0]=J[0]*Y[0],Z[1]=J[1]*Y[1],Z[2]=J[2]*Y[2],Z}function g41(Z,J,Y){return Z[0]=J[0]/Y[0],Z[1]=J[1]/Y[1],Z[2]=J[2]/Y[2],Z}function Ce8(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z[2]=Math.ceil(J[2]),Z}function Te8(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z[2]=Math.floor(J[2]),Z}function ke8(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 Ee8(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 Ie8(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z[2]=Math.round(J[2]),Z}function ve8(Z,J,Y){return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z[2]=J[2]*Y,Z}function Se8(Z,J,Y,$){return Z[0]=J[0]+Y[0]*$,Z[1]=J[1]+Y[1]*$,Z[2]=J[2]+Y[2]*$,Z}function m41(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1],W=J[2]-Z[2];return Math.hypot(Y,$,W)}function d41(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1],W=J[2]-Z[2];return Y*Y+$*$+W*W}function u41(Z){var J=Z[0],Y=Z[1],$=Z[2];return J*J+Y*Y+$*$}function _e8(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z}function xe8(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z[2]=1/J[2],Z}function SA(Z,J){var Y=J[0],$=J[1],W=J[2],Q=Y*Y+$*$+W*W;if(Q>0)Q=1/Math.sqrt(Q);return Z[0]=J[0]*Q,Z[1]=J[1]*Q,Z[2]=J[2]*Q,Z}function hO(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]}function MV(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=Y[0],K=Y[1],G=Y[2];return Z[0]=W*G-Q*K,Z[1]=Q*X-$*G,Z[2]=$*K-W*X,Z}function Ae8(Z,J,Y,$){var W=J[0],Q=J[1],X=J[2];return Z[0]=W+$*(Y[0]-W),Z[1]=Q+$*(Y[1]-Q),Z[2]=X+$*(Y[2]-X),Z}function he8(Z,J,Y,$,W,Q){var X=Q*Q,K=X*(2*Q-3)+1,G=X*(Q-2)+Q,z=X*(Q-1),F=X*(3-2*Q);return Z[0]=J[0]*K+Y[0]*G+$[0]*z+W[0]*F,Z[1]=J[1]*K+Y[1]*G+$[1]*z+W[1]*F,Z[2]=J[2]*K+Y[2]*G+$[2]*z+W[2]*F,Z}function fe8(Z,J,Y,$,W,Q){var X=1-Q,K=X*X,G=Q*Q,z=K*X,F=3*Q*K,V=3*G*X,H=G*Q;return Z[0]=J[0]*z+Y[0]*F+$[0]*V+W[0]*H,Z[1]=J[1]*z+Y[1]*F+$[1]*V+W[1]*H,Z[2]=J[2]*z+Y[2]*F+$[2]*V+W[2]*H,Z}function ye8(Z,J){J=J||1;var Y=e4()*2*Math.PI,$=e4()*2-1,W=Math.sqrt(1-$*$)*J;return Z[0]=Math.cos(Y)*W,Z[1]=Math.sin(Y)*W,Z[2]=$*J,Z}function be8(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=Y[3]*$+Y[7]*W+Y[11]*Q+Y[15];return X=X||1,Z[0]=(Y[0]*$+Y[4]*W+Y[8]*Q+Y[12])/X,Z[1]=(Y[1]*$+Y[5]*W+Y[9]*Q+Y[13])/X,Z[2]=(Y[2]*$+Y[6]*W+Y[10]*Q+Y[14])/X,Z}function ge8(Z,J,Y){var $=J[0],W=J[1],Q=J[2];return Z[0]=$*Y[0]+W*Y[3]+Q*Y[6],Z[1]=$*Y[1]+W*Y[4]+Q*Y[7],Z[2]=$*Y[2]+W*Y[5]+Q*Y[8],Z}function me8(Z,J,Y){var $=Y[0],W=Y[1],Q=Y[2],X=Y[3],K=J[0],G=J[1],z=J[2],F=W*z-Q*G,V=Q*K-$*z,H=$*G-W*K,q=W*H-Q*V,U=Q*F-$*H,L=$*V-W*F,w=X*2;return F*=w,V*=w,H*=w,q*=2,U*=2,L*=2,Z[0]=K+F+q,Z[1]=G+V+U,Z[2]=z+H+L,Z}function de8(Z,J,Y,$){var W=[],Q=[];return W[0]=J[0]-Y[0],W[1]=J[1]-Y[1],W[2]=J[2]-Y[2],Q[0]=W[0],Q[1]=W[1]*Math.cos($)-W[2]*Math.sin($),Q[2]=W[1]*Math.sin($)+W[2]*Math.cos($),Z[0]=Q[0]+Y[0],Z[1]=Q[1]+Y[1],Z[2]=Q[2]+Y[2],Z}function ue8(Z,J,Y,$){var W=[],Q=[];return W[0]=J[0]-Y[0],W[1]=J[1]-Y[1],W[2]=J[2]-Y[2],Q[0]=W[2]*Math.sin($)+W[0]*Math.cos($),Q[1]=W[1],Q[2]=W[2]*Math.cos($)-W[0]*Math.sin($),Z[0]=Q[0]+Y[0],Z[1]=Q[1]+Y[1],Z[2]=Q[2]+Y[2],Z}function ce8(Z,J,Y,$){var W=[],Q=[];return W[0]=J[0]-Y[0],W[1]=J[1]-Y[1],W[2]=J[2]-Y[2],Q[0]=W[0]*Math.cos($)-W[1]*Math.sin($),Q[1]=W[0]*Math.sin($)+W[1]*Math.cos($),Q[2]=W[2],Z[0]=Q[0]+Y[0],Z[1]=Q[1]+Y[1],Z[2]=Q[2]+Y[2],Z}function le8(Z,J){var Y=Z[0],$=Z[1],W=Z[2],Q=J[0],X=J[1],K=J[2],G=Math.sqrt(Y*Y+$*$+W*W),z=Math.sqrt(Q*Q+X*X+K*K),F=G*z,V=F&&hO(Z,J)/F;return Math.acos(Math.min(Math.max(V,-1),1))}function pe8(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z}function ie8(Z){return"vec3("+Z[0]+", "+Z[1]+", "+Z[2]+")"}function ne8(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]}function ae8(Z,J){var Y=Z[0],$=Z[1],W=Z[2],Q=J[0],X=J[1],K=J[2];return Math.abs(Y-Q)<=L0*Math.max(1,Math.abs(Y),Math.abs(Q))&&Math.abs($-X)<=L0*Math.max(1,Math.abs($),Math.abs(X))&&Math.abs(W-K)<=L0*Math.max(1,Math.abs(W),Math.abs(K))}var se8=y41,oe8=b41,re8=g41,te8=m41,ee8=d41,_A=f41,Z06=u41,J06=function(){var Z=xO();return function(J,Y,$,W,Q,X){var K,G;if(!Y)Y=3;if(!$)$=0;if(W)G=Math.min(W*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],Q(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}}();function Y06(){var Z=new n0(4);if(n0!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function c41(Z){var J=new n0(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function l41(Z,J,Y,$){var W=new n0(4);return W[0]=Z,W[1]=J,W[2]=Y,W[3]=$,W}function p41(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function i41(Z,J,Y,$,W){return Z[0]=J,Z[1]=Y,Z[2]=$,Z[3]=W,Z}function n41(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 a41(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 s41(Z){var J=Z[0],Y=Z[1],$=Z[2],W=Z[3];return Math.hypot(J,Y,$,W)}function o41(Z){var J=Z[0],Y=Z[1],$=Z[2],W=Z[3];return J*J+Y*Y+$*$+W*W}function r41(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=Y*Y+$*$+W*W+Q*Q;if(X>0)X=1/Math.sqrt(X);return Z[0]=Y*X,Z[1]=$*X,Z[2]=W*X,Z[3]=Q*X,Z}function t41(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}function e41(Z,J,Y,$){var W=J[0],Q=J[1],X=J[2],K=J[3];return Z[0]=W+$*(Y[0]-W),Z[1]=Q+$*(Y[1]-Q),Z[2]=X+$*(Y[2]-X),Z[3]=K+$*(Y[3]-K),Z}function Z71(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function J71(Z,J){var Y=Z[0],$=Z[1],W=Z[2],Q=Z[3],X=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(Y-X)<=L0*Math.max(1,Math.abs(Y),Math.abs(X))&&Math.abs($-K)<=L0*Math.max(1,Math.abs($),Math.abs(K))&&Math.abs(W-G)<=L0*Math.max(1,Math.abs(W),Math.abs(G))&&Math.abs(Q-z)<=L0*Math.max(1,Math.abs(Q),Math.abs(z))}var ll6=function(){var Z=Y06();return function(J,Y,$,W,Q,X){var K,G;if(!Y)Y=4;if(!$)$=0;if(W)G=Math.min(W*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],Q(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 xA(){var Z=new n0(4);if(n0!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z[3]=1,Z}function W06(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=1,Z}function Y71(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 Q06(Z,J){var Y=Math.acos(J[3])*2,$=Math.sin(Y/2);if($>L0)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 X06(Z,J){var Y=G71(Z,J);return Math.acos(2*Y*Y-1)}function $71(Z,J,Y){var $=J[0],W=J[1],Q=J[2],X=J[3],K=Y[0],G=Y[1],z=Y[2],F=Y[3];return Z[0]=$*F+X*K+W*z-Q*G,Z[1]=W*F+X*G+Q*K-$*z,Z[2]=Q*F+X*z+$*G-W*K,Z[3]=X*F-$*K-W*G-Q*z,Z}function K06(Z,J,Y){Y*=0.5;var $=J[0],W=J[1],Q=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G+X*K,Z[1]=W*G+Q*K,Z[2]=Q*G-W*K,Z[3]=X*G-$*K,Z}function G06(Z,J,Y){Y*=0.5;var $=J[0],W=J[1],Q=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G-Q*K,Z[1]=W*G+X*K,Z[2]=Q*G+$*K,Z[3]=X*G-W*K,Z}function z06(Z,J,Y){Y*=0.5;var $=J[0],W=J[1],Q=J[2],X=J[3],K=Math.sin(Y),G=Math.cos(Y);return Z[0]=$*G+W*K,Z[1]=W*G-$*K,Z[2]=Q*G+X*K,Z[3]=X*G-Q*K,Z}function F06(Z,J){var Y=J[0],$=J[1],W=J[2];return Z[0]=Y,Z[1]=$,Z[2]=W,Z[3]=Math.sqrt(Math.abs(1-Y*Y-$*$-W*W)),Z}function W71(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=Math.sqrt(Y*Y+$*$+W*W),K=Math.exp(Q),G=X>0?K*Math.sin(X)/X:0;return Z[0]=Y*G,Z[1]=$*G,Z[2]=W*G,Z[3]=K*Math.cos(X),Z}function Q71(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=Math.sqrt(Y*Y+$*$+W*W),K=X>0?Math.atan2(X,Q)/X:0;return Z[0]=Y*K,Z[1]=$*K,Z[2]=W*K,Z[3]=0.5*Math.log(Y*Y+$*$+W*W+Q*Q),Z}function V06(Z,J,Y){return Q71(Z,J),K71(Z,Z,Y),W71(Z,Z),Z}function fO(Z,J,Y,$){var W=J[0],Q=J[1],X=J[2],K=J[3],G=Y[0],z=Y[1],F=Y[2],V=Y[3],H,q,U,L,w;if(q=W*G+Q*z+X*F+K*V,q<0)q=-q,G=-G,z=-z,F=-F,V=-V;if(1-q>L0)H=Math.acos(q),U=Math.sin(H),L=Math.sin((1-$)*H)/U,w=Math.sin($*H)/U;else L=1-$,w=$;return Z[0]=L*W+w*G,Z[1]=L*Q+w*z,Z[2]=L*X+w*F,Z[3]=L*K+w*V,Z}function H06(Z){var J=e4(),Y=e4(),$=e4(),W=Math.sqrt(1-J),Q=Math.sqrt(J);return Z[0]=W*Math.sin(2*Math.PI*Y),Z[1]=W*Math.cos(2*Math.PI*Y),Z[2]=Q*Math.sin(2*Math.PI*$),Z[3]=Q*Math.cos(2*Math.PI*$),Z}function q06(Z,J){var Y=J[0],$=J[1],W=J[2],Q=J[3],X=Y*Y+$*$+W*W+Q*Q,K=X?1/X:0;return Z[0]=-Y*K,Z[1]=-$*K,Z[2]=-W*K,Z[3]=Q*K,Z}function U06(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z[3]=J[3],Z}function X71(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 W=0;if(J[4]>J[0])W=1;if(J[8]>J[W*3+W])W=2;var Q=(W+1)%3,X=(W+2)%3;$=Math.sqrt(J[W*3+W]-J[Q*3+Q]-J[X*3+X]+1),Z[W]=0.5*$,$=0.5/$,Z[3]=(J[Q*3+X]-J[X*3+Q])*$,Z[Q]=(J[Q*3+W]+J[W*3+Q])*$,Z[X]=(J[X*3+W]+J[W*3+X])*$}return Z}function w06(Z,J,Y,$){var W=0.5*Math.PI/180;J*=W,Y*=W,$*=W;var Q=Math.sin(J),X=Math.cos(J),K=Math.sin(Y),G=Math.cos(Y),z=Math.sin($),F=Math.cos($);return Z[0]=Q*G*F-X*K*z,Z[1]=X*K*F+Q*G*z,Z[2]=X*G*z-Q*K*F,Z[3]=X*G*F+Q*K*z,Z}function L06(Z){return"quat("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}var B06=c41,O06=l41,M06=p41,R06=i41,N06=n41,P06=$71,K71=a41,G71=t41,j06=e41,z71=s41,D06=z71,F71=o41,C06=F71,AA=r41,T06=Z71,k06=J71,E06=function(){var Z=xO(),J=AO(1,0,0),Y=AO(0,1,0);return function($,W,Q){var X=hO(W,Q);if(X<-0.999999){if(MV(Z,J,W),_A(Z)<0.000001)MV(Z,Y,W);return SA(Z,Z),Y71($,Z,Math.PI),$}else if(X>0.999999)return $[0]=0,$[1]=0,$[2]=0,$[3]=1,$;else return MV(Z,W,Q),$[0]=Z[0],$[1]=Z[1],$[2]=Z[2],$[3]=1+X,AA($,$)}}(),I06=function(){var Z=xA(),J=xA();return function(Y,$,W,Q,X,K){return fO(Z,$,X,K),fO(J,W,Q,K),fO(Y,Z,J,2*K*(1-K)),Y}}(),v06=function(){var Z=vA();return function(J,Y,$,W){return Z[0]=$[0],Z[3]=$[1],Z[6]=$[2],Z[1]=W[0],Z[4]=W[1],Z[7]=W[2],Z[2]=-Y[0],Z[5]=-Y[1],Z[8]=-Y[2],AA(J,X71(J,Z))}}();var o0={};R9(o0,{zero:()=>Y16,transformMat4:()=>e06,transformMat3:()=>t06,transformMat2d:()=>r06,transformMat2:()=>o06,subtract:()=>H71,sub:()=>K16,str:()=>$16,squaredLength:()=>O71,squaredDistance:()=>L71,sqrLen:()=>H16,sqrDist:()=>V16,set:()=>A06,scaleAndAdd:()=>u06,scale:()=>d06,round:()=>m06,rotate:()=>Z16,random:()=>s06,normalize:()=>p06,negate:()=>c06,multiply:()=>q71,mul:()=>G16,min:()=>b06,max:()=>g06,lerp:()=>a06,length:()=>B71,len:()=>X16,inverse:()=>l06,fromValues:()=>_06,forEach:()=>q16,floor:()=>y06,exactEquals:()=>W16,equals:()=>Q16,dot:()=>i06,divide:()=>U71,div:()=>z16,distance:()=>w71,dist:()=>F16,cross:()=>n06,create:()=>V71,copy:()=>x06,clone:()=>S06,ceil:()=>f06,angle:()=>J16,add:()=>h06});function V71(){var Z=new n0(2);if(n0!=Float32Array)Z[0]=0,Z[1]=0;return Z}function S06(Z){var J=new n0(2);return J[0]=Z[0],J[1]=Z[1],J}function _06(Z,J){var Y=new n0(2);return Y[0]=Z,Y[1]=J,Y}function x06(Z,J){return Z[0]=J[0],Z[1]=J[1],Z}function A06(Z,J,Y){return Z[0]=J,Z[1]=Y,Z}function h06(Z,J,Y){return Z[0]=J[0]+Y[0],Z[1]=J[1]+Y[1],Z}function H71(Z,J,Y){return Z[0]=J[0]-Y[0],Z[1]=J[1]-Y[1],Z}function q71(Z,J,Y){return Z[0]=J[0]*Y[0],Z[1]=J[1]*Y[1],Z}function U71(Z,J,Y){return Z[0]=J[0]/Y[0],Z[1]=J[1]/Y[1],Z}function f06(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z}function y06(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z}function b06(Z,J,Y){return Z[0]=Math.min(J[0],Y[0]),Z[1]=Math.min(J[1],Y[1]),Z}function g06(Z,J,Y){return Z[0]=Math.max(J[0],Y[0]),Z[1]=Math.max(J[1],Y[1]),Z}function m06(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z}function d06(Z,J,Y){return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z}function u06(Z,J,Y,$){return Z[0]=J[0]+Y[0]*$,Z[1]=J[1]+Y[1]*$,Z}function w71(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1];return Math.hypot(Y,$)}function L71(Z,J){var Y=J[0]-Z[0],$=J[1]-Z[1];return Y*Y+$*$}function B71(Z){var J=Z[0],Y=Z[1];return Math.hypot(J,Y)}function O71(Z){var J=Z[0],Y=Z[1];return J*J+Y*Y}function c06(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z}function l06(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z}function p06(Z,J){var Y=J[0],$=J[1],W=Y*Y+$*$;if(W>0)W=1/Math.sqrt(W);return Z[0]=J[0]*W,Z[1]=J[1]*W,Z}function i06(Z,J){return Z[0]*J[0]+Z[1]*J[1]}function n06(Z,J,Y){var $=J[0]*Y[1]-J[1]*Y[0];return Z[0]=Z[1]=0,Z[2]=$,Z}function a06(Z,J,Y,$){var W=J[0],Q=J[1];return Z[0]=W+$*(Y[0]-W),Z[1]=Q+$*(Y[1]-Q),Z}function s06(Z,J){J=J||1;var Y=e4()*2*Math.PI;return Z[0]=Math.cos(Y)*J,Z[1]=Math.sin(Y)*J,Z}function o06(Z,J,Y){var $=J[0],W=J[1];return Z[0]=Y[0]*$+Y[2]*W,Z[1]=Y[1]*$+Y[3]*W,Z}function r06(Z,J,Y){var $=J[0],W=J[1];return Z[0]=Y[0]*$+Y[2]*W+Y[4],Z[1]=Y[1]*$+Y[3]*W+Y[5],Z}function t06(Z,J,Y){var $=J[0],W=J[1];return Z[0]=Y[0]*$+Y[3]*W+Y[6],Z[1]=Y[1]*$+Y[4]*W+Y[7],Z}function e06(Z,J,Y){var $=J[0],W=J[1];return Z[0]=Y[0]*$+Y[4]*W+Y[12],Z[1]=Y[1]*$+Y[5]*W+Y[13],Z}function Z16(Z,J,Y,$){var W=J[0]-Y[0],Q=J[1]-Y[1],X=Math.sin($),K=Math.cos($);return Z[0]=W*K-Q*X+Y[0],Z[1]=W*X+Q*K+Y[1],Z}function J16(Z,J){var Y=Z[0],$=Z[1],W=J[0],Q=J[1],X=Math.sqrt(Y*Y+$*$)*Math.sqrt(W*W+Q*Q),K=X&&(Y*W+$*Q)/X;return Math.acos(Math.min(Math.max(K,-1),1))}function Y16(Z){return Z[0]=0,Z[1]=0,Z}function $16(Z){return"vec2("+Z[0]+", "+Z[1]+")"}function W16(Z,J){return Z[0]===J[0]&&Z[1]===J[1]}function Q16(Z,J){var Y=Z[0],$=Z[1],W=J[0],Q=J[1];return Math.abs(Y-W)<=L0*Math.max(1,Math.abs(Y),Math.abs(W))&&Math.abs($-Q)<=L0*Math.max(1,Math.abs($),Math.abs(Q))}var X16=B71,K16=H71,G16=q71,z16=U71,F16=w71,V16=L71,H16=O71,q16=function(){var Z=V71();return function(J,Y,$,W,Q,X){var K,G;if(!Y)Y=2;if(!$)$=0;if(W)G=Math.min(W*Y+$,J.length);else G=J.length;for(K=$;K<G;K+=Y)Z[0]=J[K],Z[1]=J[K+1],Q(Z,Z,X),J[K]=Z[0],J[K+1]=Z[1];return J}}();class KW extends Float32Array{constructor(Z,J,Y,$){super([Z,J,Y,$])}get determinant(){return C8.determinant(this)}get frobeniusNorm(){return C8.frob(this)}static create(){let Z=new KW(0,0,0,0);return C8.identity(Z),Z}static fromRotation(Z){let J=KW.create();return C8.fromRotation(J,Z),J}static fromScaling(Z){let J=KW.create();return C8.fromScaling(J,Z),J}add(Z){return C8.add(this,this,Z),this}adjoint(){return C8.adjoint(this,this),this}clone(){return new KW(this[0],this[1],this[2],this[3])}copy(Z){return C8.copy(this,Z),this}equals(Z){return C8.equals(this,Z)}exactEquals(Z){return C8.exactEquals(this,Z)}identity(){return C8.identity(this),this}invert(){return C8.invert(this,this),this}multiply(Z){return C8.mul(this,this,Z),this}multiplyScalar(Z){return C8.multiplyScalar(this,this,Z),this}rotate(Z){return C8.rotate(this,this,Z),this}subtract(Z){return C8.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]}][${this[2]},${this[3]}]`}transpose(){return C8.transpose(this,this),this}}class Z7 extends Float32Array{constructor(Z,J,Y,$,W,Q,X,K,G){super([Z,J,Y,$,W,Q,X,K,G])}get determinant(){return A1.determinant(this)}get frobeniusNorm(){return A1.frob(this)}static create(){let Z=new Z7(0,0,0,0,0,0,0,0,0);return A1.identity(Z),Z}static fromMatrix4(Z){let J=Z7.create();return A1.fromMat4(J,Z),J}static fromQuaternion(Z){let J=Z7.create();return A1.fromQuat(J,Z),J}static fromRotation(Z){let J=Z7.create();return A1.fromRotation(J,Z),J}static fromScaling(Z){let J=Z7.create();return A1.fromScaling(J,Z),J}static fromTranslation(Z){let J=Z7.create();return A1.fromTranslation(J,Z),J}add(Z){return A1.add(this,this,Z),this}adjoint(){return A1.adjoint(this,this),this}clone(){return new Z7(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8])}copy(Z){return A1.copy(this,Z),this}equals(Z){return A1.equals(this,Z)}exactEquals(Z){return A1.exactEquals(this,Z)}identity(){return A1.identity(this),this}invert(){return A1.invert(this,this),this}multiply(Z){return A1.mul(this,this,Z),this}multiplyScalar(Z){return A1.multiplyScalar(this,this,Z),this}transformVector(Z){return Z.transformMatrix3(this)}projection(Z,J){return A1.projection(this,Z,J),this}rotate(Z){return A1.rotate(this,this,Z),this}subtract(Z){return A1.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 A1.transpose(this,this),this}}class c6 extends Float32Array{constructor(Z,J,Y,$,W,Q,X,K,G,z,F,V,H,q,U,L){super([Z,J,Y,$,W,Q,X,K,G,z,F,V,H,q,U,L])}get determinant(){return u0.determinant(this)}get frobeniusNorm(){return u0.frob(this)}static create(){let Z=new c6(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return u0.identity(Z),Z}static fromQuaternion(Z){let J=c6.create();return u0.fromQuat(J,Z),J}static fromRotation(Z,J){let Y=c6.create();return u0.fromRotation(Y,Z,J),Y}static fromRotationTranslation(Z,J){let Y=c6.create();return u0.fromRotationTranslation(Y,Z,J),Y}static fromRotationTranslationScale(Z,J,Y){let $=c6.create();return u0.fromRotationTranslationScale($,Z,J,Y),$}static fromRotationTranslationScaleOrigin(Z,J,Y,$){let W=c6.create();return u0.fromRotationTranslationScaleOrigin(W,Z,J,Y,$),W}static fromScaling(Z){let J=c6.create();return u0.fromScaling(J,Z),J}static fromTranslation(Z){let J=c6.create();return u0.fromTranslation(J,Z),J}static fromXRotation(Z){let J=c6.create();return u0.fromXRotation(J,Z),J}static fromYRotation(Z){let J=c6.create();return u0.fromYRotation(J,Z),J}static fromZRotation(Z){let J=c6.create();return u0.fromZRotation(J,Z),J}add(Z){return u0.add(this,this,Z),this}adjoint(){return u0.adjoint(this,this),this}clone(){return new c6(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 u0.copy(this,Z),this}equals(Z){return u0.equals(this,Z)}exactEquals(Z){return u0.exactEquals(this,Z)}frustrum(Z,J,Y,$,W,Q){return u0.frustum(this,Z,J,Y,$,W,Q),this}identity(){return u0.identity(this),this}invert(){return u0.invert(this,this),this}lookAt(Z,J,Y){return u0.lookAt(this,Z,J,Y),this}multiply(Z){return u0.mul(this,this,Z),this}multiplyScalar(Z){return u0.multiplyScalar(this,this,Z),this}orthographic(Z,J,Y,$,W,Q){return u0.ortho(this,Z,J,Y,$,W,Q),this}perspective(Z,J,Y,$){return u0.perspective(this,Z,J,Y,$),this}rotate(Z,J){return u0.rotate(this,this,Z,J),this}rotateX(Z){return u0.rotateX(this,this,Z),this}rotateY(Z){return u0.rotateY(this,this,Z),this}rotateZ(Z){return u0.rotateZ(this,this,Z),this}scale(Z){return u0.scale(this,this,Z),this}subtract(Z){return u0.sub(this,this,Z),this}targetTo(Z,J,Y){return u0.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 u0.translate(this,this,Z),this}transpose(){return u0.transpose(this,this),this}}class FK extends Float32Array{constructor(Z,J,Y,$){super([Z,J,Y,$])}get length(){return V1.length(this)}get squaredLength(){return V1.squaredLength(this)}get magnitude(){return V1.length(this)}get squaredMagnitude(){return V1.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 $=V1.fromEuler(new Float32Array(4),Z,J,Y);return new FK($[0],$[1],$[2],$[3])}static fromQuaternionLike(Z){return new FK(Z.x,Z.y,Z.z,Z.w)}clone(){return new FK(this.x,this.y,this.z,this.w)}conjugate(){return V1.conjugate(this,this),this}copy(Z){return V1.copy(this,Z),this}dot(Z){return V1.dot(this,Z)}exponential(){return V1.exp(this,this),this}equals(Z){return V1.equals(this,Z)}exactEquals(Z){return V1.exactEquals(this,Z)}getAngle(Z){return V1.getAngle(this,Z)}identity(){return V1.identity(this),this}invert(){return V1.invert(this,this),this}lerp(Z,J){return V1.lerp(this,this,Z,J),this}logarithm(){return V1.ln(this,this),this}multiply(Z){return V1.multiply(this,this,Z),this}transformVector(Z){return Z.transformQuaternion(this)}normalize(){return V1.normalize(this,this),this}power(Z){return V1.pow(this,this,Z),this}randomize(){return V1.random(this),this}rotateX(Z){return V1.rotateX(this,this,Z),this}rotateY(Z){return V1.rotateY(this,this,Z),this}rotateZ(Z){return V1.rotateZ(this,this,Z),this}scale(Z){return V1.scale(this,this,Z),this}setAxisAngle(Z,J){return V1.setAxisAngle(this,Z,J),this}slerp(Z,J){return V1.slerp(this,this,Z,J),this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}}class RV extends Float32Array{constructor(Z,J){super([Z,J])}get length(){return o0.length(this)}get squaredLength(){return o0.squaredLength(this)}get magnitude(){return o0.length(this)}get squaredMagnitude(){return o0.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 RV(0,0)}add(Z){return o0.add(this,this,Z),this}angle(Z){return o0.angle(this,Z)}ceil(){return o0.ceil(this,this),this}clone(){return new RV(this.x,this.y)}copy(Z){return o0.copy(this,Z),this}distance(Z){return o0.distance(this,Z)}divide(Z){return o0.divide(this,this,Z),this}dot(Z){return o0.dot(this,Z)}equals(Z){return o0.equals(this,Z)}exactEquals(Z){return o0.exactEquals(this,Z)}floor(){return o0.floor(this,this),this}invert(){return o0.inverse(this,this),this}lerp(Z,J){return o0.lerp(this,this,Z,J),this}max(Z){return o0.max(this,this,Z),this}min(Z){return o0.min(this,this,Z),this}multiply(Z){return o0.mul(this,this,Z),this}negate(){return o0.negate(this,this),this}normalize(){return o0.normalize(this,this),this}randomize(Z){return o0.random(this,Z),this}rotate(Z,J){return o0.rotate(this,this,Z,J),this}round(){return o0.round(this,this),this}scale(Z){return o0.scale(this,this,Z),this}scaleAndAdd(Z,J){return o0.scaleAndAdd(this,this,Z,J),this}subtract(Z){return o0.sub(this,this,Z),this}toString(){return`${this.x},${this.y}`}transformMatrix2(Z){return o0.transformMat2(this,this,Z),this}transformMatrix3(Z){return o0.transformMat3(this,this,Z),this}transformMatrix4(Z){return o0.transformMat4(this,this,Z),this}zero(){return o0.zero(this),this}}class VK extends Float32Array{constructor(Z,J,Y){super([Z,J,Y])}get length(){return l0.length(this)}get squaredLength(){return l0.squaredLength(this)}get magnitude(){return l0.length(this)}get squaredMagnitude(){return l0.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 VK(0,0,0)}static fromVector3Like(Z){return new VK(Z.x,Z.y,Z.z)}add(Z){return l0.add(this,this,Z),this}ceil(){return l0.ceil(this,this),this}clone(){return new VK(this.x,this.y,this.z)}copy(Z){return l0.copy(this,Z),this}cross(Z){return l0.cross(this,this,Z),this}distance(Z){return l0.distance(this,Z)}divide(Z){return l0.div(this,this,Z),this}dot(Z){return l0.dot(this,Z)}equals(Z){return l0.equals(this,Z)}exactEquals(Z){return l0.exactEquals(this,Z)}floor(){return l0.floor(this,this),this}invert(){return l0.inverse(this,this),this}lerp(Z,J){return l0.lerp(this,this,Z,J),this}max(Z){return l0.max(this,this,Z),this}min(Z){return l0.min(this,this,Z),this}multiply(Z){return l0.mul(this,this,Z),this}negate(){return l0.negate(this,this),this}normalize(){return l0.normalize(this,this),this}randomize(Z){return l0.random(this,Z),this}rotateX(Z,J){return l0.rotateX(this,this,Z,J),this}rotateY(Z,J){return l0.rotateY(this,this,Z,J),this}rotateZ(Z,J){return l0.rotateZ(this,this,Z,J),this}round(){return l0.round(this,this),this}scale(Z){return l0.scale(this,this,Z),this}scaleAndAdd(Z,J){return l0.scaleAndAdd(this,this,Z,J),this}subtract(Z){return l0.sub(this,this,Z),this}toString(){return`${this.x},${this.y},${this.z}`}transformMatrix3(Z){return l0.transformMat3(this,this,Z),this}transformMatrix4(Z){return l0.transformMat4(this,this,Z),this}transformQuaternion(Z){return l0.transformQuat(this,this,Z),this}zero(){return l0.zero(this),this}}var H1=function(Z,J,Y,$){function W(Q){return Q instanceof Y?Q:new Y(function(X){X(Q)})}return new(Y||(Y=Promise))(function(Q,X){function K(F){try{z($.next(F))}catch(V){X(V)}}function G(F){try{z($.throw(F))}catch(V){X(V)}}function z(F){F.done?Q(F.value):W(F.value).then(K,G)}z(($=$.apply(Z,J||[])).next())})},z1=function(Z,J){var Y={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},$,W,Q,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,W&&(Q=z[0]&2?W.return:z[0]?W.throw||((Q=W.return)&&Q.call(W),0):W.next)&&!(Q=Q.call(W,z[1])).done)return Q;if(W=0,Q)z=[z[0]&2,Q.value];switch(z[0]){case 0:case 1:Q=z;break;case 4:return Y.label++,{value:z[1],done:!1};case 5:Y.label++,W=z[1],z=[0];continue;case 7:z=Y.ops.pop(),Y.trys.pop();continue;default:if((Q=Y.trys,!(Q=Q.length>0&&Q[Q.length-1]))&&(z[0]===6||z[0]===2)){Y=0;continue}if(z[0]===3&&(!Q||z[1]>Q[0]&&z[1]<Q[3])){Y.label=z[1];break}if(z[0]===6&&Y.label<Q[1]){Y.label=Q[1],Q=z;break}if(Q&&Y.label<Q[2]){Y.label=Q[2],Y.ops.push(z);break}if(Q[2])Y.ops.pop();Y.trys.pop();continue}z=J.call(Z,Y)}catch(F){z=[6,F],W=0}finally{$=Q=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},U5=function(Z,J){var Y=typeof Symbol==="function"&&Z[Symbol.iterator];if(!Y)return Z;var $=Y.call(Z),W,Q=[],X;try{while((J===void 0||J-- >0)&&!(W=$.next()).done)Q.push(W.value)}catch(K){X={error:K}}finally{try{if(W&&!W.done&&(Y=$.return))Y.call($)}finally{if(X)throw X.error}}return Q},B9=function(Z,J,Y){if(Y||arguments.length===2){for(var $=0,W=J.length,Q;$<W;$++)if(Q||!($ in J)){if(!Q)Q=Array.prototype.slice.call(J,0,$);Q[$]=J[$]}}return Z.concat(Q||Array.prototype.slice.call(J))},M71=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.")},rl6=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($,W){return Y.compare($,W).then(function(Q){return-1*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){return H1(this,void 0,void 0,function(){return z1(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 H1(this,void 0,void 0,function(){return z1(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 H1(this,void 0,void 0,function(){return z1(this,function($){return[2,J-Y]})})},Z.maxComparatorNumber=function(J,Y){return H1(this,void 0,void 0,function(){return z1(this,function($){return[2,Y-J]})})},Z.defaultIsEqual=function(J,Y){return H1(this,void 0,void 0,function(){return z1(this,function($){return[2,J===Y]})})},Z.print=function(J){function Y(F){var V=Z.getParentIndexOf(F);return Math.floor(Math.log2(V+1))}function $(F,V){var H="";for(;V>0;--V)H+=F;return H}var W=0,Q=[],X=Y(J.length-1)+2,K=0;while(W<J.length){var G=Y(W)+1;if(W===0)G=0;var z=String(J.get(W));if(z.length>K)K=z.length;Q[G]=Q[G]||[],Q[G].push(z),W+=1}return Q.map(function(F,V){var H=Math.pow(2,X-V)-1;return $(" ",Math.floor(H/2)*K)+F.map(function(q){var U=(K-q.length)/2;return $(" ",Math.ceil(U))+q+$(" ",Math.floor(U))}).join($(" ",H*K))}).join(`
|
437
437
|
`)},Z.heapify=function(J,Y){return H1(this,void 0,void 0,function(){var $;return z1(this,function(W){switch(W.label){case 0:return $=new Z(Y),$.heapArray=J,[4,$.init()];case 1:return W.sent(),[2,$]}})})},Z.heappop=function(J,Y){var $=new Z(Y);return $.heapArray=J,$.pop()},Z.heappush=function(J,Y,$){return H1(this,void 0,void 0,function(){var W;return z1(this,function(Q){switch(Q.label){case 0:return W=new Z($),W.heapArray=J,[4,W.push(Y)];case 1:return Q.sent(),[2]}})})},Z.heappushpop=function(J,Y,$){var W=new Z($);return W.heapArray=J,W.pushpop(Y)},Z.heapreplace=function(J,Y,$){var W=new Z($);return W.heapArray=J,W.replace(Y)},Z.heaptop=function(J,Y,$){if(Y===void 0)Y=1;var W=new Z($);return W.heapArray=J,W.top(Y)},Z.heapbottom=function(J,Y,$){if(Y===void 0)Y=1;var W=new Z($);return W.heapArray=J,W.bottom(Y)},Z.nlargest=function(J,Y,$){return H1(this,void 0,void 0,function(){var W;return z1(this,function(Q){switch(Q.label){case 0:return W=new Z($),W.heapArray=B9([],U5(Y),!1),[4,W.init()];case 1:return Q.sent(),[2,W.top(J)]}})})},Z.nsmallest=function(J,Y,$){return H1(this,void 0,void 0,function(){var W;return z1(this,function(Q){switch(Q.label){case 0:return W=new Z($),W.heapArray=B9([],U5(Y),!1),[4,W.init()];case 1:return Q.sent(),[2,W.bottom(J)]}})})},Z.prototype.add=function(J){return H1(this,void 0,void 0,function(){return z1(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 H1(this,void 0,void 0,function(){var Y,$,W;return z1(this,function(Q){switch(Q.label){case 0:Y=this.length,(W=this.heapArray).push.apply(W,B9([],U5(J),!1)),$=this.length,Q.label=1;case 1:if(!(Y<$))return[3,4];return[4,this._sortNodeUp(Y)];case 2:Q.sent(),Q.label=3;case 3:return++Y,[3,1];case 4:return this._applyLimit(),[2,!0]}})})},Z.prototype.bottom=function(){return H1(this,arguments,void 0,function(J){if(J===void 0)J=1;return z1(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,B9([],U5(this.heapArray),!1)];else return[2,this._bottomN_push(~~J)]})})},Z.prototype.check=function(){return H1(this,void 0,void 0,function(){var J,Y,$,W,Q,X,K,G,z;return z1(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]),W=(G=void 0,M71($)),Q=W.next(),F.label=3;case 3:if(Q.done)return[3,6];return X=Q.value,[4,this.compare(Y,X)];case 4:if(F.sent()>0)return[2,Y];F.label=5;case 5:return Q=W.next(),[3,3];case 6:return[3,9];case 7:return K=F.sent(),G={error:K},[3,9];case 8:try{if(Q&&!Q.done&&(z=W.return))z.call(W)}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 H1(this,arguments,void 0,function(Y,$){var W,Q,X,K,G,z;if($===void 0)$=Z.defaultIsEqual;return z1(this,function(F){switch(F.label){case 0:F.trys.push([0,5,6,7]),W=M71(this.heapArray),Q=W.next(),F.label=1;case 1:if(Q.done)return[3,4];return X=Q.value,[4,$(X,Y)];case 2:if(F.sent())return[2,!0];F.label=3;case 3:return Q=W.next(),[3,1];case 4:return[3,7];case 5:return K=F.sent(),G={error:K},[3,7];case 6:try{if(Q&&!Q.done&&(z=W.return))z.call(W)}finally{if(G)throw G.error}return[7];case 7:return[2,!1]}})})},Z.prototype.init=function(J){return H1(this,void 0,void 0,function(){var Y;return z1(this,function($){switch($.label){case 0:if(J)this.heapArray=B9([],U5(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 H1(this,void 0,void 0,function(){var J;return z1(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 H1(this,void 0,void 0,function(){return z1(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 H1(this,void 0,void 0,function(){var Y;return z1(this,function($){switch($.label){case 0:return[4,this.compare(this.heapArray[0],J)];case 1:if(!($.sent()<0))return[3,3];return Y=U5([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 H1(this,arguments,void 0,function(Y,$){var W,Q,X,K=this;if($===void 0)$=Z.defaultIsEqual;return z1(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:W=[0],G.label=3;case 3:if(!W.length)return[3,13];return Q=W.shift(),[4,$(this.heapArray[Q],Y)];case 4:if(!G.sent())return[3,11];if(Q!==0)return[3,6];return[4,this.pop()];case 5:return G.sent(),[3,10];case 6:if(Q!==this.heapArray.length-1)return[3,7];return this.heapArray.pop(),[3,10];case 7:return this.heapArray.splice(Q,1,this.heapArray.pop()),[4,this._sortNodeUp(Q)];case 8:return G.sent(),[4,this._sortNodeDown(Q)];case 9:G.sent(),G.label=10;case 10:return[2,!0];case 11:X=Z.getChildrenIndexOf(Q).filter(function(z){return z<K.heapArray.length}),W.push.apply(W,B9([],U5(X),!1)),G.label=12;case 12:return[3,3];case 13:return[2,!1]}})})},Z.prototype.replace=function(J){return H1(this,void 0,void 0,function(){var Y;return z1(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 H1(this,arguments,void 0,function(J){if(J===void 0)J=1;return z1(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,B9([],U5(this.heapArray),!1)];else return[2,this._topN_push(~~J)]})})},Z.prototype.toArray=function(){return B9([],U5(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 z1(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 H1(this,void 0,void 0,function(){var Y,$,W,Q,K,X,K;return z1(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,W=Z.getParentIndexOf($),Q=[];for(K=$;K>W;--K)Q.push(K);X=this.heapArray,G.label=2;case 2:if(!Q.length)return[3,6];return K=Q.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)Q.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 $;$=U5([this.heapArray[Y],this.heapArray[J]],2),this.heapArray[J]=$[0],this.heapArray[Y]=$[1]},Z.prototype._sortNodeDown=function(J){return H1(this,void 0,void 0,function(){var Y,$,W,Q,X,K;return z1(this,function(G){switch(G.label){case 0:Y=this.heapArray.length,G.label=1;case 1:if($=2*J+1,W=$+1,Q=J,X=$<Y,!X)return[3,3];return[4,this.compare(this.heapArray[$],this.heapArray[Q])];case 2:X=G.sent()<0,G.label=3;case 3:if(X)Q=$;if(K=W<Y,!K)return[3,5];return[4,this.compare(this.heapArray[W],this.heapArray[Q])];case 4:K=G.sent()<0,G.label=5;case 5:if(K)Q=W;if(Q===J)return[3,7];this._moveNode(J,Q),J=Q,G.label=6;case 6:return[3,1];case 7:return[2]}})})},Z.prototype._sortNodeUp=function(J){return H1(this,void 0,void 0,function(){var Y;return z1(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 H1(this,void 0,void 0,function(){var Y,$,W,Q;return z1(this,function(X){switch(X.label){case 0:Y=new Z(this._invertedCompare),Y.limit=J,$=[0],W=this.heapArray,X.label=1;case 1:if(!$.length)return[3,7];if(Q=$.shift(),!(Q<W.length))return[3,6];if(!(Y.length<J))return[3,3];return[4,Y.push(W[Q])];case 2:return X.sent(),$.push.apply($,B9([],U5(Z.getChildrenIndexOf(Q)),!1)),[3,6];case 3:return[4,this.compare(W[Q],Y.peek())];case 4:if(!(X.sent()<0))return[3,6];return[4,Y.replace(W[Q])];case 5:X.sent(),$.push.apply($,B9([],U5(Z.getChildrenIndexOf(Q)),!1)),X.label=6;case 6:return[3,1];case 7:return[2,Y.toArray()]}})})},Z.prototype._topN_fill=function(J){return H1(this,void 0,void 0,function(){var Y,$,W,Q,X,X;return z1(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(),W=Z.getParentIndexOf(J-1)+1,Q=[];for(X=W;X<J;++X)Q.push.apply(Q,B9([],U5(Z.getChildrenIndexOf(X).filter(function(G){return G<Y.length})),!1));if((J-1)%2)Q.push(J);K.label=2;case 2:if(!Q.length)return[3,6];if(X=Q.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(),Q.push.apply(Q,B9([],U5(Z.getChildrenIndexOf(X)),!1)),K.label=5;case 5:return[3,2];case 6:return[2,$.toArray()]}})})},Z.prototype._topN_heap=function(J){return H1(this,void 0,void 0,function(){var Y,$,W,Q,X;return z1(this,function(K){switch(K.label){case 0:Y=this.clone(),$=[],W=0,K.label=1;case 1:if(!(W<J))return[3,4];return X=(Q=$).push,[4,Y.pop()];case 2:X.apply(Q,[K.sent()]),K.label=3;case 3:return++W,[3,1];case 4:return[2,$]}})})},Z.prototype._topIdxOf=function(J){return H1(this,void 0,void 0,function(){var Y,$,W,Q;return z1(this,function(X){switch(X.label){case 0:if(!J.length)return[2,-1];Y=0,$=J[Y],W=1,X.label=1;case 1:if(!(W<J.length))return[3,4];return[4,this.compare(J[W],$)];case 2:if(Q=X.sent(),Q<0)Y=W,$=J[W];X.label=3;case 3:return++W,[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 H1(this,void 0,void 0,function(){var $;return z1(this,function(W){switch(W.label){case 0:return $=new Z(this.compare),[4,$.init(J)];case 1:return W.sent(),[2,$.peek()]}})})},Z}(),U16=function(Z,J){var Y={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},$,W,Q,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,W&&(Q=z[0]&2?W.return:z[0]?W.throw||((Q=W.return)&&Q.call(W),0):W.next)&&!(Q=Q.call(W,z[1])).done)return Q;if(W=0,Q)z=[z[0]&2,Q.value];switch(z[0]){case 0:case 1:Q=z;break;case 4:return Y.label++,{value:z[1],done:!1};case 5:Y.label++,W=z[1],z=[0];continue;case 7:z=Y.ops.pop(),Y.trys.pop();continue;default:if((Q=Y.trys,!(Q=Q.length>0&&Q[Q.length-1]))&&(z[0]===6||z[0]===2)){Y=0;continue}if(z[0]===3&&(!Q||z[1]>Q[0]&&z[1]<Q[3])){Y.label=z[1];break}if(z[0]===6&&Y.label<Q[1]){Y.label=Q[1],Q=z;break}if(Q&&Y.label<Q[2]){Y.label=Q[2],Y.ops.push(z);break}if(Q[2])Y.ops.pop();Y.trys.pop();continue}z=J.call(Z,Y)}catch(F){z=[6,F],W=0}finally{$=Q=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},e8=function(Z,J){var Y=typeof Symbol==="function"&&Z[Symbol.iterator];if(!Y)return Z;var $=Y.call(Z),W,Q=[],X;try{while((J===void 0||J-- >0)&&!(W=$.next()).done)Q.push(W.value)}catch(K){X={error:K}}finally{try{if(W&&!W.done&&(Y=$.return))Y.call($)}finally{if(X)throw X.error}}return Q},l6=function(Z,J,Y){if(Y||arguments.length===2){for(var $=0,W=J.length,Q;$<W;$++)if(Q||!($ in J)){if(!Q)Q=Array.prototype.slice.call(J,0,$);Q[$]=J[$]}}return Z.concat(Q||Array.prototype.slice.call(J))};var R71=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($,W){return-1*Y.compare($,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){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 V=Z.getParentIndexOf(F);return Math.floor(Math.log2(V+1))}function $(F,V){var H="";for(;V>0;--V)H+=F;return H}var W=0,Q=[],X=Y(J.length-1)+2,K=0;while(W<J.length){var G=Y(W)+1;if(W===0)G=0;var z=String(J.get(W));if(z.length>K)K=z.length;Q[G]=Q[G]||[],Q[G].push(z),W+=1}return Q.map(function(F,V){var H=Math.pow(2,X-V)-1;return $(" ",Math.floor(H/2)*K)+F.map(function(q){var U=(K-q.length)/2;return $(" ",Math.ceil(U))+q+$(" ",Math.floor(U))}).join($(" ",H*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 W=new Z($);W.heapArray=J,W.push(Y)},Z.heappushpop=function(J,Y,$){var W=new Z($);return W.heapArray=J,W.pushpop(Y)},Z.heapreplace=function(J,Y,$){var W=new Z($);return W.heapArray=J,W.replace(Y)},Z.heaptop=function(J,Y,$){if(Y===void 0)Y=1;var W=new Z($);return W.heapArray=J,W.top(Y)},Z.heapbottom=function(J,Y,$){if(Y===void 0)Y=1;var W=new Z($);return W.heapArray=J,W.bottom(Y)},Z.nlargest=function(J,Y,$){var W=new Z($);return W.heapArray=l6([],e8(Y),!1),W.init(),W.top(J)},Z.nsmallest=function(J,Y,$){var W=new Z($);return W.heapArray=l6([],e8(Y),!1),W.init(),W.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,l6([],e8(J),!1));for(var W=this.length;$<W;++$)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 l6([],e8(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(W){return J.compare(Y,W)>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=l6([],e8(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 $=[],W=0;while(W<this.heapArray.length){var Q=this.heapArray[W];if(Y(Q,J))return W;else if(this.compare(Q,J)<=0)$.push.apply($,l6([],e8(Z.getChildrenIndexOf(W)),!1));W=$.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 $=[],W=[],Q=0;while(Q<this.heapArray.length){var X=this.heapArray[Q];if(Y(X,J))W.push(Q),$.push.apply($,l6([],e8(Z.getChildrenIndexOf(Q)),!1));else if(this.compare(X,J)<=0)$.push.apply($,l6([],e8(Z.getChildrenIndexOf(Q)),!1));Q=$.shift()||this.heapArray.length}return W},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=e8([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 W=[0];while(W.length){var Q=W.shift();if(Y(this.heapArray[Q],J)){if(Q===0)this.pop();else if(Q===this.heapArray.length-1)this.heapArray.pop();else this.heapArray.splice(Q,1,this.heapArray.pop()),this._sortNodeUp(Q),this._sortNodeDown(Q);return!0}else if(this.compare(this.heapArray[Q],J)<=0){var X=Z.getChildrenIndexOf(Q).filter(function(K){return K<$.heapArray.length});W.push.apply(W,l6([],e8(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 l6([],e8(this.heapArray),!1);else return this._topN_push(~~J)},Z.prototype.toArray=function(){return l6([],e8(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 U16(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,W=Z.getParentIndexOf($),Q=[];for(var X=$;X>W;--X)Q.push(X);var K=this.heapArray;while(Q.length){var X=Q.shift();if(this.compare(K[X],Y.peek())>0){if(Y.replace(K[X]),X%2)Q.push(Z.getParentIndexOf(X))}}return Y.toArray()},Z.prototype._moveNode=function(J,Y){var $;$=e8([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,W=$+1,Q=J;if($<Y&&this.compare(this.heapArray[$],this.heapArray[Q])<0)Q=$;if(W<Y&&this.compare(this.heapArray[W],this.heapArray[Q])<0)Q=W;if(Q===J)break;this._moveNode(J,Q),J=Q}},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],W=this.heapArray;while($.length){var Q=$.shift();if(Q<W.length){if(Y.length<J)Y.push(W[Q]),$.push.apply($,l6([],e8(Z.getChildrenIndexOf(Q)),!1));else if(this.compare(W[Q],Y.peek())<0)Y.replace(W[Q]),$.push.apply($,l6([],e8(Z.getChildrenIndexOf(Q)),!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 W=Z.getParentIndexOf(J-1)+1,Q=[];for(var X=W;X<J;++X)Q.push.apply(Q,l6([],e8(Z.getChildrenIndexOf(X).filter(function(K){return K<Y.length})),!1));if((J-1)%2)Q.push(J);while(Q.length){var X=Q.shift();if(X<Y.length){if(this.compare(Y[X],$.peek())<0)$.replace(Y[X]),Q.push.apply(Q,l6([],e8(Z.getChildrenIndexOf(X)),!1))}}return $.toArray()},Z.prototype._topN_heap=function(J){var Y=this.clone(),$=[];for(var W=0;W<J;++W)$.push(Y.pop());return $},Z.prototype._topIdxOf=function(J){if(!J.length)return-1;var Y=0,$=J[Y];for(var W=1;W<J.length;++W){var Q=this.compare(J[W],$);if(Q<0)Y=W,$=J[W]}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 NV extends gJ{_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 W=Math.abs(Z.world.simulation.gravity.y),Q=Math.sqrt(2*W*this._jumpHeight);Z.applyImpulse({x:0,y:Q*Z.mass,z:0}),this._jumpHeight=0}if(this._moveTarget){let W={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},Q=W.x*W.x+W.y*W.y+W.z*W.z;if(Q>0.1){let X=Math.sqrt(Q),K=this._moveSpeed*Y,z=Math.min(X,K)/X,F={x:$.x+W.x*z,y:$.y+W.y*z,z:$.z+W.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 W={x:this._faceTarget.x-$.x,z:this._faceTarget.z-$.z},Q=Math.atan2(-W.x,-W.z),X=Z.rotation,K=Math.atan2(2*(X.w*X.y),1-2*(X.y*X.y)),G=Q-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,H=(K+F)/2,q={x:0,y:Math.fround(Math.sin(H)),z:0,w:Math.fround(Math.cos(H))};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 hA extends NV{_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 f.error("PathfindingEntityController._calculatePath: No target or world"),!1;let Z=this._entity.height,J=this._findGroundedStart();if(!J){if(this._debug)f.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),W=Math.abs(Y.y-J.y),Q=Math.abs(Y.z-J.z);if($<=2&&W<=2&&Q<=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)]]),V=new Set,H=new R71((N,P)=>{let D=F.get(N[0])??1/0,j=F.get(P[0])??1/0;return D-j});H.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 N=this._maxJump;N>=this._maxFall;N--){if(N===0)continue;let P=Math.abs(J.y+N-Y.y);U.push({y:N,distanceToTargetY:P})}U.sort((N,P)=>N.distanceToTargetY-P.distanceToTargetY);let L=[...q,...U.flatMap(({y:N})=>q.map((P)=>({...P,y:N})))],w=0,O=Math.abs(Y.x-J.x)+Math.abs(Y.y-J.y)+Math.abs(Y.z-J.z),R=Math.min(this._maxOpenSetIterations,O*20);while(!H.isEmpty()&&w<R){w++;let[N,P]=H.pop();if(P.x===Y.x&&P.y===Y.y&&P.z===Y.z){let C=this._reconstructPath(G,P);if(this._waypoints=C.map((k)=>({x:k.x+0.5,y:k.y+Z/2,z:k.z+0.5})),this._debug)console.log(`PathfindingEntityController._calculatePath: Path found after ${w} open set iterations. Start: ${this._coordinateToKey(J)}, Target: ${this._coordinateToKey(this._target)}`);return!0}V.add(N);let D=z.get(N),j=new Map;for(let C of L){let k=`${C.x},${C.z}`,I=C.y<0;if(I&&j.has(k))continue;let A={x:P.x+C.x,y:P.y+C.y,z:P.z+C.z};if(Math.abs(Y.x-A.x)+Math.abs(Y.y-A.y)+Math.abs(Y.z-A.z)>O*1.5)continue;let x=this._coordinateToKey(A);if(V.has(x))continue;let d=this._isNeighborCoordinateBlocked(P,A,this._entity.height);if(I&&d){j.set(k,!0);continue}if(d)continue;let h=Math.abs(C.x),u=Math.abs(C.y),W0=Math.abs(C.z),U0=u===0?0:this._verticalPenalty,B0=(Math.max(h,u,W0)===1&&h+u+W0>1?1.4:1)+U0,y0=D+B0,B1=z.get(x)??1/0;if(y0>=B1)continue;G.set(x,P),z.set(x,y0);let B8=y0+this._pathfindingHeuristic(A,Y);F.set(x,B8),H.push([x,A])}}if(w>=R){if(this._onPathfindAbort?.(),this._debug)f.warning(`PathfindingEntityController._calculatePath: Maximum open set iterations reached (${R}), path search aborted. Start: ${this._coordinateToKey(J)}, Target: ${this._coordinateToKey(this._target)}`)}else if(this._debug)f.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,W=Math.min($,this._maxJump)+0.75;this.jump(W);let Q=Math.abs(this._entity.world.simulation.gravity.y),X=Math.sqrt(2*Q*W),K=Z.x+0.5,G=Z.z+0.5,z=J.x+0.5,F=J.z+0.5,V=z-K,H=F-G,q=Math.sqrt(V*V+H*H),U=X/Q,L=q/this._speed;Y=Math.min(U*0.8,L)*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,W=Math.floor(J.x),Q=Math.floor(J.y),X=Math.floor(J.z),K=Math.floor(Z.x),G=Math.floor(Z.z);if(!$.chunkLattice.hasBlock({x:W,y:Q-1,z:X}))return!0;for(let z=0;z<Y;z++)if($.chunkLattice.hasBlock({x:W,y:Q+z,z:X}))return!0;if(W!==K&&X!==G)for(let z=0;z<Y;z++){let F=$.chunkLattice.hasBlock({x:W,y:Q+z,z:G}),V=$.chunkLattice.hasBlock({x:K,y:Q+z,z:X});if(F||V)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 W=0;W<=Math.abs(this._maxFall);W++)if(this._entity.world.chunkLattice.hasBlock({...$,y:$.y-W-1}))return{...$,y:$.y-W};return}}export{Sr8 as startServer,P41 as WorldManagerEvent,GK as WorldManager,N41 as WorldLoopEvent,wV as WorldLoop,kA as WorldEvent,LV as World,Ak as WebServerEvent,cQ as WebServer,VK as Vector3,RV as Vector2,UV as Ticker,TA as SimulationEvent,HV as Simulation,NV as SimpleEntityController,qV as SceneUIManager,NA as SceneUIEvent,QV as SceneUI,D41 as SUPPORTED_INPUT_KEYS,jG as RigidBodyType,jY as RigidBody,O41 as ROTATION_UPDATE_THRESHOLD,FK as Quaternion,SO as PlayerUIEvent,FV as PlayerUI,U41 as PlayerManagerEvent,D5 as PlayerManager,XV as PlayerEvent,t4 as PlayerEntity,R41 as PlayerCameraMode,DA as PlayerCameraEvent,zV as PlayerCamera,XK as Player,QW as PersistenceManager,hA as PathfindingEntityController,B41 as POSITION_UPDATE_THRESHOLD_SQ,_k as PORT,d5 as ModelRegistry,c6 as Matrix4,Z7 as Matrix3,KW as Matrix2,M41 as LightType,GV as LightManager,PA as LightEvent,jA as Light,j41 as GameServerEvent,ZZ as GameServer,S0 as EventRouter,f as ErrorHandler,KV as EntityManager,WV as EntityEvent,_8 as Entity,OV as DefaultPlayerEntityController,IA as DefaultPlayerEntity,L41 as DEFAULT_ENTITY_RIGID_BODY_OPTIONS,D9 as CollisionGroupsBuilder,lJ as CollisionGroup,DG as ColliderShape,VV as ColliderMap,N5 as Collider,_j as CoefficientCombineRule,$V as ChunkLattice,RA as ChunkEvent,L6 as Chunk,BV as ChatManager,EA as ChatEvent,Aj as BlockTypeRegistryEvent,CG as BlockTypeRegistry,xj as BlockTypeEvent,P5 as BlockType,FW as Block,pA as BaseEntityControllerEvent,gJ as BaseEntityController,wK as AudioManager,bO as AudioEvent,UK as Audio};
|