hytopia 0.6.5 → 0.6.6

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/bun-server.mjs CHANGED
@@ -403,7 +403,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
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 ZU=(Z,J,X)=>{if(X)return;if(Z)return{transform:EW1.bind(void 0,new TextEncoder)};let Y=new kW1(J);return{transform:IW1.bind(void 0,Y),final:vW1.bind(void 0,Y)}},EW1=function*(Z,J){if(TW1.isBuffer(J))yield r7(J);else if(typeof J==="string")yield Z.encode(J);else yield J},IW1=function*(Z,J){yield m8(J)?Z.write(J):J},vW1=function*(Z){let J=Z.end();if(J!=="")yield J};import{callbackify as mm}from"util";var jN=mm(async(Z,J,X,Y)=>{J.currentIterable=Z(...X);try{for await(let $ of J.currentIterable)Y.push($)}finally{delete J.currentIterable}}),JU=async function*(Z,J,X){if(X===J.length){yield Z;return}let{transform:Y=_W1}=J[X];for await(let $ of Y(Z))yield*JU($,J,X+1)},um=async function*(Z){for(let[J,{final:X}]of Object.entries(Z))yield*SW1(X,Number(J),Z)},SW1=async function*(Z,J,X){if(Z===void 0)return;for await(let Y of Z())yield*JU(Y,X,J+1)},dm=mm(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 ON=(Z,J,X,Y)=>{try{for(let $ of Z(...J))X.push($);Y()}catch($){Y($)}},cm=(Z,J)=>[...J.flatMap((X)=>[...lX(X,Z,0)]),..._G(Z)],lX=function*(Z,J,X){if(X===J.length){yield Z;return}let{transform:Y=xW1}=J[X];for(let $ of Y(Z))yield*lX($,J,X+1)},_G=function*(Z){for(let[J,{final:X}]of Object.entries(Z))yield*AW1(X,Number(J),Z)},AW1=function*(Z,J,X){if(Z===void 0)return;for(let Y of Z())yield*lX(Y,X,J+1)},xW1=function*(Z){yield Z};var MN=({value:Z,value:{transform:J,final:X,writableObjectMode:Y,readableObjectMode:$},optionName:Q},{encoding:K})=>{let W={},G=pm(Z,K,Q),z=cX(J),V=cX(X),H=z?jN.bind(void 0,JU,W):ON.bind(void 0,lX),q=z||V?jN.bind(void 0,um,W):ON.bind(void 0,_G),F=z||V?dm.bind(void 0,W):void 0;return{stream:new hW1({writableObjectMode:Y,writableHighWaterMark:lm(Y),readableObjectMode:$,readableHighWaterMark:lm($),transform(w,L,j){H([w,G,0],this,j)},flush(w){q([G],this,w)},destroy:F})}},XU=(Z,J,X,Y)=>{let $=J.filter(({type:K})=>K==="generator"),Q=Y?$.reverse():$;for(let{value:K,optionName:W}of Q){let G=pm(K,X,W);Z=cm(G,Z)}return Z},pm=({transform:Z,final:J,binary:X,writableObjectMode:Y,readableObjectMode:$,preserveNewlines:Q},K,W)=>{let G={};return[{transform:bm(Y,W)},ZU(X,K,Y),eF(X,Q,Y,G),{transform:Z,final:J},{transform:ym($,W)},fm({binary:X,preserveNewlines:Q,readableObjectMode:$,state:G})].filter(Boolean)};var im=(Z,J)=>{for(let X of fW1(Z))bW1(Z,X,J)},fW1=(Z)=>new Set(Object.entries(Z).filter(([,{direction:J}])=>J==="input").map(([J])=>Number(J))),bW1=(Z,J,X)=>{let{stdioItems:Y}=Z[J],$=Y.filter(({contents:W})=>W!==void 0);if($.length===0)return;if(J!==0){let[{type:W,optionName:G}]=$;throw new TypeError(`Only the \`stdin\` option, not \`${G}\`, can be ${XJ[W]} with synchronous methods.`)}let K=$.map(({contents:W})=>W).map((W)=>yW1(W,Y));X.input=DG(K)},yW1=(Z,J)=>{let X=XU(Z,J,"utf8",!0);return gW1(X),DG(X)},gW1=(Z)=>{let J=Z.find((X)=>typeof X!=="string"&&!m8(X));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 YU=({stdioItems:Z,encoding:J,verboseInfo:X,fdNumber:Y})=>Y!=="all"&&KQ(X,Y)&&!m5.has(J)&&mW1(Y)&&(Z.some(({type:$,value:Q})=>$==="native"&&uW1.has(Q))||Z.every(({type:$})=>F9.has($))),mW1=(Z)=>Z===1||Z===2,uW1=new Set(["pipe","overlapped"]),nm=async(Z,J,X,Y)=>{for await(let $ of Z)if(!dW1(J))sm($,X,Y)},am=(Z,J,X)=>{for(let Y of Z)sm(Y,J,X)},dW1=(Z)=>Z._readableState.pipes.length>0,sm=(Z,J,X)=>{let Y=UF(Z);l4({type:"output",verboseMessage:Y,fdNumber:J,verboseInfo:X})};var om=({fileDescriptors:Z,syncResult:{output:J},options:X,isMaxBuffer:Y,verboseInfo:$})=>{if(J===null)return{output:Array.from({length:3})};let Q={},K=new Set([]);return{output:J.map((G,z)=>pW1({result:G,fileDescriptors:Z,fdNumber:z,state:Q,outputFiles:K,isMaxBuffer:Y,verboseInfo:$},X)),...Q}},pW1=({result:Z,fileDescriptors:J,fdNumber:X,state:Y,outputFiles:$,isMaxBuffer:Q,verboseInfo:K},{buffer:W,encoding:G,lines:z,stripFinalNewline:V,maxBuffer:H})=>{if(Z===null)return;let q=rg(Z,Q,H),F=r7(q),{stdioItems:U,objectMode:w}=J[X],L=iW1([F],U,G,Y),{serializedResult:j,finalResult:R=j}=nW1({chunks:L,objectMode:w,encoding:G,lines:z,stripFinalNewline:V,fdNumber:X});aW1({serializedResult:j,fdNumber:X,state:Y,verboseInfo:K,encoding:G,stdioItems:U,objectMode:w});let O=W[X]?R:void 0;try{if(Y.error===void 0)sW1(j,U,$);return O}catch(N){return Y.error=N,O}},iW1=(Z,J,X,Y)=>{try{return XU(Z,J,X,!1)}catch($){return Y.error=$,Z}},nW1=({chunks:Z,objectMode:J,encoding:X,lines:Y,stripFinalNewline:$,fdNumber:Q})=>{if(J)return{serializedResult:Z};if(X==="buffer")return{serializedResult:DG(Z)};let K=Hb(Z,X);if(Y[Q])return{serializedResult:K,finalResult:BN(K,!$[Q],J)};return{serializedResult:K}},aW1=({serializedResult:Z,fdNumber:J,state:X,verboseInfo:Y,encoding:$,stdioItems:Q,objectMode:K})=>{if(!YU({stdioItems:Q,encoding:$,verboseInfo:Y,fdNumber:J}))return;let W=BN(Z,!1,K);try{am(W,J,Y)}catch(G){X.error??=G}},sW1=(Z,J,X)=>{for(let{path:Y,append:$}of J.filter(({type:Q})=>rF.has(Q))){let Q=typeof Y==="string"?Y:Y.toString();if($||X.has(Q))lW1(Y,Z);else X.add(Q),cW1(Y,Z)}};var rm=([,Z,J],X)=>{if(!X.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,JZ(J,X,"all")];if(Array.isArray(J))return[JZ(Z,X,"all"),...J];if(m8(Z)&&m8(J))return TR([Z,J]);return`${Z}${J}`};import{once as RN}from"events";var tm=async(Z,J)=>{let[X,Y]=await oW1(Z);return J.isForcefullyTerminated??=!1,[X,Y]},oW1=async(Z)=>{let[J,X]=await Promise.allSettled([RN(Z,"spawn"),RN(Z,"exit")]);if(J.status==="rejected")return[];return X.status==="rejected"?em(Z):X.value},em=async(Z)=>{try{return await RN(Z,"exit")}catch{return em(Z)}},Zu=async(Z)=>{let[J,X]=await Z;if(!rW1(J,X)&&NN(J,X))throw new p4;return[J,X]},rW1=(Z,J)=>Z===void 0&&J===void 0,NN=(Z,J)=>Z!==0||J!==null;var Ju=({error:Z,status:J,signal:X,output:Y},{maxBuffer:$})=>{let Q=tW1(Z,J,X),K=Q?.code==="ETIMEDOUT",W=og(Q,Y,$);return{resultError:Q,exitCode:J,signal:X,timedOut:K,isMaxBuffer:W}},tW1=(Z,J,X)=>{if(Z!==void 0)return Z;return NN(J,X)?new p4:void 0};var Xu=(Z,J,X)=>{let{file:Y,commandArguments:$,command:Q,escapedCommand:K,startTime:W,verboseInfo:G,options:z,fileDescriptors:V}=ZG1(Z,J,X),H=YG1({file:Y,commandArguments:$,options:z,command:Q,escapedCommand:K,verboseInfo:G,fileDescriptors:V,startTime:W});return LQ(H,G,z)},ZG1=(Z,J,X)=>{let{command:Y,escapedCommand:$,startTime:Q,verboseInfo:K}=wF(Z,J,X),W=JG1(X),{file:G,commandArguments:z,options:V}=gF(Z,J,W);XG1(V);let H=_m(V,K);return{file:G,commandArguments:z,command:Y,escapedCommand:$,startTime:Q,verboseInfo:K,options:V,fileDescriptors:H}},JG1=(Z)=>Z.node&&!Z.ipc?{...Z,ipc:!1}:Z,XG1=({ipc:Z,ipcInput:J,detached:X,cancelSignal:Y})=>{if(J)$U("ipcInput");if(Z)$U("ipc: true");if(X)$U("detached: true");if(Y)$U("cancelSignal")},$U=(Z)=>{throw new TypeError(`The "${Z}" option cannot be used with synchronous methods.`)},YG1=({file:Z,commandArguments:J,options:X,command:Y,escapedCommand:$,verboseInfo:Q,fileDescriptors:K,startTime:W})=>{let G=$G1({file:Z,commandArguments:J,options:X,command:Y,escapedCommand:$,fileDescriptors:K,startTime:W});if(G.failed)return G;let{resultError:z,exitCode:V,signal:H,timedOut:q,isMaxBuffer:F}=Ju(G,X),{output:U,error:w=z}=om({fileDescriptors:K,syncResult:G,options:X,isMaxBuffer:F,verboseInfo:Q}),L=U.map((R,O)=>JZ(R,X,O)),j=JZ(rm(U,X),X,"all");return KG1({error:w,exitCode:V,signal:H,timedOut:q,isMaxBuffer:F,stdio:L,all:j,options:X,command:Y,escapedCommand:$,startTime:W})},$G1=({file:Z,commandArguments:J,options:X,command:Y,escapedCommand:$,fileDescriptors:Q,startTime:K})=>{try{im(Q,X);let W=QG1(X);return eW1(Z,J,W)}catch(W){return UQ({error:W,command:Y,escapedCommand:$,fileDescriptors:Q,options:X,startTime:K,isSync:!0})}},QG1=({encoding:Z,maxBuffer:J,...X})=>({...X,encoding:"buffer",maxBuffer:nF(J)}),KG1=({error:Z,exitCode:J,signal:X,timedOut:Y,isMaxBuffer:$,stdio:Q,all:K,options:W,command:G,escapedCommand:z,startTime:V})=>Z===void 0?aF({command:G,escapedCommand:z,stdio:Q,all:K,ipcOutput:[],options:W,startTime:V}):SG({error:Z,command:G,escapedCommand:z,timedOut:Y,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:$,isForcefullyTerminated:!1,exitCode:J,signal:X,stdio:Q,all:K,ipcOutput:[],options:W,startTime:V,isSync:!0});import{setMaxListeners as n31}from"events";import{spawn as a31}from"child_process";import Wu from"process";import{once as PN,on as WG1}from"events";var Yu=({anyProcess:Z,channel:J,isSubprocess:X,ipc:Y},{reference:$=!0,filter:Q}={})=>{return zQ({methodName:"getOneMessage",isSubprocess:X,ipc:Y,isConnected:AF(Z)}),GG1({anyProcess:Z,channel:J,isSubprocess:X,filter:Q,reference:$})},GG1=async({anyProcess:Z,channel:J,isSubprocess:X,filter:Y,reference:$})=>{IF(J,$);let Q=JJ(Z,J,X),K=new AbortController;try{return await Promise.race([zG1(Q,Y,K),VG1(Q,X,K),HG1(Q,X,K)])}catch(W){throw VQ(Z),W}finally{K.abort(),vF(J,$)}},zG1=async(Z,J,{signal:X})=>{if(J===void 0){let[Y]=await PN(Z,"message",{signal:X});return Y}for await(let[Y]of WG1(Z,"message",{signal:X}))if(J(Y))return Y},VG1=async(Z,J,{signal:X})=>{await PN(Z,"disconnect",{signal:X}),dy(J)},HG1=async(Z,J,{signal:X})=>{let[Y]=await PN(Z,"strict:error",{signal:X});throw TF(Y,J)};import{once as Qu,on as qG1}from"events";var Ku=({anyProcess:Z,channel:J,isSubprocess:X,ipc:Y},{reference:$=!0}={})=>DN({anyProcess:Z,channel:J,isSubprocess:X,ipc:Y,shouldAwait:!X,reference:$}),DN=({anyProcess:Z,channel:J,isSubprocess:X,ipc:Y,shouldAwait:$,reference:Q})=>{zQ({methodName:"getEachMessage",isSubprocess:X,ipc:Y,isConnected:AF(Z)}),IF(J,Q);let K=JJ(Z,J,X),W=new AbortController,G={};return FG1(Z,K,W),UG1({ipcEmitter:K,isSubprocess:X,controller:W,state:G}),LG1({anyProcess:Z,channel:J,ipcEmitter:K,isSubprocess:X,shouldAwait:$,controller:W,state:G,reference:Q})},FG1=async(Z,J,X)=>{try{await Qu(J,"disconnect",{signal:X.signal}),X.abort()}catch{}},UG1=async({ipcEmitter:Z,isSubprocess:J,controller:X,state:Y})=>{try{let[$]=await Qu(Z,"strict:error",{signal:X.signal});Y.error=TF($,J),X.abort()}catch{}},LG1=async function*({anyProcess:Z,channel:J,ipcEmitter:X,isSubprocess:Y,shouldAwait:$,controller:Q,state:K,reference:W}){try{for await(let[G]of qG1(X,"message",{signal:Q.signal}))$u(K),yield G}catch{$u(K)}finally{if(Q.abort(),vF(J,W),!Y)VQ(Z);if($)await Z}},$u=({error:Z})=>{if(Z)throw Z};var Gu=(Z,{ipc:J})=>{Object.assign(Z,Vu(Z,!1,J))},zu=()=>{let Z=Wu,J=!0,X=Wu.channel!==void 0;return{...Vu(Z,!0,X),getCancelSignal:Lg.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:!0,ipc:X})}},Vu=(Z,J,X)=>({sendMessage:bF.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:X}),getOneMessage:Yu.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:X}),getEachMessage:Ku.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:X})});import{ChildProcess as wG1}from"child_process";import{PassThrough as BG1,Readable as jG1,Writable as OG1,Duplex as MG1}from"stream";var Hu=({error:Z,command:J,escapedCommand:X,fileDescriptors:Y,options:$,startTime:Q,verboseInfo:K})=>{UN(Y);let W=new wG1;RG1(W,Y),Object.assign(W,{readable:NG1,writable:PG1,duplex:DG1});let G=UQ({error:Z,command:J,escapedCommand:X,fileDescriptors:Y,options:$,startTime:Q,isSync:!1}),z=CG1(G,K,$);return{subprocess:W,promise:z}},RG1=(Z,J)=>{let X=AG(),Y=AG(),$=AG(),Q=Array.from({length:J.length-3},AG),K=AG(),W=[X,Y,$,...Q];Object.assign(Z,{stdin:X,stdout:Y,stderr:$,all:K,stdio:W})},AG=()=>{let Z=new BG1;return Z.end(),Z},NG1=()=>new jG1({read(){}}),PG1=()=>new OG1({write(){}}),DG1=()=>new MG1({read(){},write(){}}),CG1=async(Z,J,X)=>LQ(Z,J,X);import{createReadStream as qu,createWriteStream as Fu}from"fs";import{Buffer as TG1}from"buffer";import{Readable as xG,Writable as kG1,Duplex as EG1}from"stream";var Lu=(Z,J)=>tF(IG1,Z,J,!1),hG=({type:Z,optionName:J})=>{throw new TypeError(`The \`${J}\` option cannot be ${XJ[Z]}.`)},Uu={fileNumber:hG,generator:MN,asyncGenerator:MN,nodeStream:({value:Z})=>({stream:Z}),webTransform({value:{transform:Z,writableObjectMode:J,readableObjectMode:X}}){let Y=J||X;return{stream:EG1.fromWeb(Z,{objectMode:Y})}},duplex:({value:{transform:Z}})=>({stream:Z}),native(){}},IG1={input:{...Uu,fileUrl:({value:Z})=>({stream:qu(Z)}),filePath:({value:{file:Z}})=>({stream:qu(Z)}),webStream:({value:Z})=>({stream:xG.fromWeb(Z)}),iterable:({value:Z})=>({stream:xG.from(Z)}),asyncIterable:({value:Z})=>({stream:xG.from(Z)}),string:({value:Z})=>({stream:xG.from(Z)}),uint8Array:({value:Z})=>({stream:xG.from(TG1.from(Z))})},output:{...Uu,fileUrl:({value:Z})=>({stream:Fu(Z)}),filePath:({value:{file:Z,append:J}})=>({stream:Fu(Z,J?{flags:"a"}:{})}),webStream:({value:Z})=>({stream:kG1.fromWeb(Z)}),iterable:hG,asyncIterable:hG,string:hG,uint8Array:hG}};import{on as vG1,once as wu}from"events";import{PassThrough as SG1,getDefaultHighWaterMark as _G1}from"stream";import{finished as Ou}from"stream/promises";function pX(Z){if(!Array.isArray(Z))throw new TypeError(`Expected an array, got \`${typeof Z}\`.`);for(let $ of Z)CN($);let J=Z.some(({readableObjectMode:$})=>$),X=AG1(Z,J),Y=new Mu({objectMode:J,writableHighWaterMark:X,readableHighWaterMark:X});for(let $ of Z)Y.add($);return Y}var AG1=(Z,J)=>{if(Z.length===0)return _G1(J);let X=Z.filter(({readableObjectMode:Y})=>Y===J).map(({readableHighWaterMark:Y})=>Y);return Math.max(...X)};class Mu extends SG1{#Z=new Set([]);#J=new Set([]);#Y=new Set([]);#X;#$=Symbol("unpipe");#V=new WeakMap;add(Z){if(CN(Z),this.#Z.has(Z))return;this.#Z.add(Z),this.#X??=xG1(this,this.#Z,this.#$);let J=bG1({passThroughStream:this,stream:Z,streams:this.#Z,ended:this.#J,aborted:this.#Y,onFinished:this.#X,unpipeEvent:this.#$});this.#V.set(Z,J),Z.pipe(this,{end:!1})}async remove(Z){if(CN(Z),!this.#Z.has(Z))return!1;let J=this.#V.get(Z);if(J===void 0)return!1;return this.#V.delete(Z),Z.unpipe(this),await J,!0}}var xG1=async(Z,J,X)=>{QU(Z,Bu);let Y=new AbortController;try{await Promise.race([hG1(Z,Y),fG1(Z,J,X,Y)])}finally{Y.abort(),QU(Z,-Bu)}},hG1=async(Z,{signal:J})=>{try{await Ou(Z,{signal:J,cleanup:!0})}catch(X){throw Ru(Z,X),X}},fG1=async(Z,J,X,{signal:Y})=>{for await(let[$]of vG1(Z,"unpipe",{signal:Y}))if(J.has($))$.emit(X)},CN=(Z)=>{if(typeof Z?.pipe!=="function")throw new TypeError(`Expected a readable stream, got: \`${typeof Z}\`.`)},bG1=async({passThroughStream:Z,stream:J,streams:X,ended:Y,aborted:$,onFinished:Q,unpipeEvent:K})=>{QU(Z,ju);let W=new AbortController;try{await Promise.race([yG1(Q,J,W),gG1({passThroughStream:Z,stream:J,streams:X,ended:Y,aborted:$,controller:W}),mG1({stream:J,streams:X,ended:Y,aborted:$,unpipeEvent:K,controller:W})])}finally{W.abort(),QU(Z,-ju)}if(X.size>0&&X.size===Y.size+$.size)if(Y.size===0&&$.size>0)TN(Z);else uG1(Z)},yG1=async(Z,J,{signal:X})=>{try{if(await Z,!X.aborted)TN(J)}catch(Y){if(!X.aborted)Ru(J,Y)}},gG1=async({passThroughStream:Z,stream:J,streams:X,ended:Y,aborted:$,controller:{signal:Q}})=>{try{if(await Ou(J,{signal:Q,cleanup:!0,readable:!0,writable:!1}),X.has(J))Y.add(J)}catch(K){if(Q.aborted||!X.has(J))return;if(Nu(K))$.add(J);else Pu(Z,K)}},mG1=async({stream:Z,streams:J,ended:X,aborted:Y,unpipeEvent:$,controller:{signal:Q}})=>{if(await wu(Z,$,{signal:Q}),!Z.readable)return wu(Q,"abort",{signal:Q});J.delete(Z),X.delete(Z),Y.delete(Z)},uG1=(Z)=>{if(Z.writable)Z.end()},Ru=(Z,J)=>{if(Nu(J))TN(Z);else Pu(Z,J)},Nu=(Z)=>Z?.code==="ERR_STREAM_PREMATURE_CLOSE",TN=(Z)=>{if(Z.readable||Z.writable)Z.destroy()},Pu=(Z,J)=>{if(!Z.destroyed)Z.once("error",dG1),Z.destroy(J)},dG1=()=>{},QU=(Z,J)=>{let X=Z.getMaxListeners();if(X!==0&&X!==Number.POSITIVE_INFINITY)Z.setMaxListeners(X+J)},Bu=2,ju=1;import{finished as Du}from"stream/promises";var BQ=(Z,J)=>{Z.pipe(J),cG1(Z,J),lG1(Z,J)},cG1=async(Z,J)=>{if(X4(Z)||X4(J))return;try{await Du(Z,{cleanup:!0,readable:!0,writable:!1})}catch{}kN(J)},kN=(Z)=>{if(Z.writable)Z.end()},lG1=async(Z,J)=>{if(X4(Z)||X4(J))return;try{await Du(J,{cleanup:!0,readable:!1,writable:!0})}catch{}EN(Z)},EN=(Z)=>{if(Z.readable)Z.destroy()};var Cu=(Z,J,X)=>{let Y=new Map;for(let[$,{stdioItems:Q,direction:K}]of Object.entries(J)){for(let{stream:W}of Q.filter(({type:G})=>F9.has(G)))pG1(Z,W,K,$);for(let{stream:W}of Q.filter(({type:G})=>!F9.has(G)))nG1({subprocess:Z,stream:W,direction:K,fdNumber:$,pipeGroups:Y,controller:X})}for(let[$,Q]of Y.entries()){let K=Q.length===1?Q[0]:pX(Q);BQ(K,$)}},pG1=(Z,J,X,Y)=>{if(X==="output")BQ(Z.stdio[Y],J);else BQ(J,Z.stdio[Y]);let $=iG1[Y];if($!==void 0)Z[$]=J;Z.stdio[Y]=J},iG1=["stdin","stdout","stderr"],nG1=({subprocess:Z,stream:J,direction:X,fdNumber:Y,pipeGroups:$,controller:Q})=>{if(J===void 0)return;aG1(J,Q);let[K,W]=X==="output"?[J,Z.stdio[Y]]:[Z.stdio[Y],J],G=$.get(K)??[];$.set(K,[...G,W])},aG1=(Z,{signal:J})=>{if(X4(Z))uX(Z,sG1,J)},sG1=2;import{addAbortListener as tG1}from"events";var iX=[];iX.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")iX.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")iX.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var KU=(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",IN=Symbol.for("signal-exit emitter"),vN=globalThis,oG1=Object.defineProperty.bind(Object);class Tu{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(vN[IN])return vN[IN];oG1(vN,IN,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(Z,J){this.listeners[Z].push(J)}removeListener(Z,J){let X=this.listeners[Z],Y=X.indexOf(J);if(Y===-1)return;if(Y===0&&X.length===1)X.length=0;else X.splice(Y,1)}emit(Z,J,X){if(this.emitted[Z])return!1;this.emitted[Z]=!0;let Y=!1;for(let $ of this.listeners[Z])Y=$(J,X)===!0||Y;if(Z==="exit")Y=this.emit("afterExit",J,X)||Y;return Y}}class _N{}var rG1=(Z)=>{return{onExit(J,X){return Z.onExit(J,X)},load(){return Z.load()},unload(){return Z.unload()}}};class ku extends _N{onExit(){return()=>{}}load(){}unload(){}}class Eu extends _N{#Z=SN.platform==="win32"?"SIGINT":"SIGHUP";#J=new Tu;#Y;#X;#$;#V={};#q=!1;constructor(Z){super();this.#Y=Z,this.#V={};for(let J of iX)this.#V[J]=()=>{let X=this.#Y.listeners(J),{count:Y}=this.#J,$=Z;if(typeof $.__signal_exit_emitter__==="object"&&typeof $.__signal_exit_emitter__.count==="number")Y+=$.__signal_exit_emitter__.count;if(X.length===Y){this.unload();let Q=this.#J.emit("exit",null,J),K=J==="SIGHUP"?this.#Z:J;if(!Q)Z.kill(Z.pid,K)}};this.#$=Z.reallyExit,this.#X=Z.emit}onExit(Z,J){if(!KU(this.#Y))return()=>{};if(this.#q===!1)this.load();let X=J?.alwaysLast?"afterExit":"exit";return this.#J.on(X,Z),()=>{if(this.#J.removeListener(X,Z),this.#J.listeners.exit.length===0&&this.#J.listeners.afterExit.length===0)this.unload()}}load(){if(this.#q)return;this.#q=!0,this.#J.count+=1;for(let Z of iX)try{let J=this.#V[Z];if(J)this.#Y.on(Z,J)}catch(J){}this.#Y.emit=(Z,...J)=>{return this.#G(Z,...J)},this.#Y.reallyExit=(Z)=>{return this.#W(Z)}}unload(){if(!this.#q)return;this.#q=!1,iX.forEach((Z)=>{let J=this.#V[Z];if(!J)throw new Error("Listener not defined for signal: "+Z);try{this.#Y.removeListener(Z,J)}catch(X){}}),this.#Y.emit=this.#X,this.#Y.reallyExit=this.#$,this.#J.count-=1}#W(Z){if(!KU(this.#Y))return 0;return this.#Y.exitCode=Z||0,this.#J.emit("exit",this.#Y.exitCode,null),this.#$.call(this.#Y,this.#Y.exitCode)}#G(Z,...J){let X=this.#X;if(Z==="exit"&&KU(this.#Y)){if(typeof J[0]==="number")this.#Y.exitCode=J[0];let Y=X.call(this.#Y,Z,...J);return this.#J.emit("exit",this.#Y.exitCode,null),Y}else return X.call(this.#Y,Z,...J)}}var SN=globalThis.process,{onExit:Iu,load:vQ6,unload:SQ6}=rG1(KU(SN)?new Eu(SN):new ku);var vu=(Z,{cleanup:J,detached:X},{signal:Y})=>{if(!J||X)return;let $=Iu(()=>{Z.kill()});tG1(Y,()=>{$()})};var _u=({source:Z,sourcePromise:J,boundOptions:X,createNested:Y},...$)=>{let Q=LF(),{destination:K,destinationStream:W,destinationError:G,from:z,unpipeSignal:V}=eG1(X,Y,$),{sourceStream:H,sourceError:q}=J31(Z,z),{options:F,fileDescriptors:U}=n4.get(Z);return{sourcePromise:J,sourceStream:H,sourceOptions:F,sourceError:q,destination:K,destinationStream:W,destinationError:G,unpipeSignal:V,fileDescriptors:U,startTime:Q}},eG1=(Z,J,X)=>{try{let{destination:Y,pipeOptions:{from:$,to:Q,unpipeSignal:K}={}}=Z31(Z,J,...X),W=EF(Y,Q);return{destination:Y,destinationStream:W,from:$,unpipeSignal:K}}catch(Y){return{destinationError:Y}}},Z31=(Z,J,X,...Y)=>{if(Array.isArray(X))return{destination:J(Su,Z)(X,...Y),pipeOptions:Z};if(typeof X==="string"||X instanceof URL||DR(X)){if(Object.keys(Z).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[$,Q,K]=QF(X,...Y);return{destination:J(Su)($,Q,K),pipeOptions:K}}if(n4.has(X)){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:X,pipeOptions:Y[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${X}`)},Su=({options:Z})=>({options:{...Z,stdin:"pipe",piped:!0}}),J31=(Z,J)=>{try{return{sourceStream:HQ(Z,J)}}catch(X){return{sourceError:X}}};var xu=({sourceStream:Z,sourceError:J,destinationStream:X,destinationError:Y,fileDescriptors:$,sourceOptions:Q,startTime:K})=>{let W=X31({sourceStream:Z,sourceError:J,destinationStream:X,destinationError:Y});if(W!==void 0)throw AN({error:W,fileDescriptors:$,sourceOptions:Q,startTime:K})},X31=({sourceStream:Z,sourceError:J,destinationStream:X,destinationError:Y})=>{if(J!==void 0&&Y!==void 0)return Y;if(Y!==void 0)return EN(Z),Y;if(J!==void 0)return kN(X),J},AN=({error:Z,fileDescriptors:J,sourceOptions:X,startTime:Y})=>UQ({error:Z,command:Au,escapedCommand:Au,fileDescriptors:J,options:X,startTime:Y,isSync:!1}),Au="source.pipe(destination)";var hu=async(Z)=>{let[{status:J,reason:X,value:Y=X},{status:$,reason:Q,value:K=Q}]=await Z;if(!K.pipedFrom.includes(Y))K.pipedFrom.push(Y);if($==="rejected")throw K;if(J==="rejected")throw Y;return K};import{finished as Y31}from"stream/promises";var fu=(Z,J,X)=>{let Y=WU.has(J)?Q31(Z,J):$31(Z,J);return uX(Z,W31,X.signal),uX(J,G31,X.signal),K31(J),Y},$31=(Z,J)=>{let X=pX([Z]);return BQ(X,J),WU.set(J,X),X},Q31=(Z,J)=>{let X=WU.get(J);return X.add(Z),X},K31=async(Z)=>{try{await Y31(Z,{cleanup:!0,readable:!1,writable:!0})}catch{}WU.delete(Z)},WU=new WeakMap,W31=2,G31=1;import{aborted as z31}from"util";var bu=(Z,J)=>Z===void 0?[]:[V31(Z,J)],V31=async(Z,{sourceStream:J,mergedStream:X,fileDescriptors:Y,sourceOptions:$,startTime:Q})=>{await z31(Z,J),await X.remove(J);let K=new Error("Pipe canceled by `unpipeSignal` option.");throw AN({error:K,fileDescriptors:Y,sourceOptions:$,startTime:Q})};var GU=(Z,...J)=>{if(j8(J[0]))return GU.bind(void 0,{...Z,boundOptions:{...Z.boundOptions,...J[0]}});let{destination:X,...Y}=_u(Z,...J),$=H31({...Y,destination:X});return $.pipe=GU.bind(void 0,{...Z,source:X,sourcePromise:$,boundOptions:{}}),$},H31=async({sourcePromise:Z,sourceStream:J,sourceOptions:X,sourceError:Y,destination:$,destinationStream:Q,destinationError:K,unpipeSignal:W,fileDescriptors:G,startTime:z})=>{let V=q31(Z,$);xu({sourceStream:J,sourceError:Y,destinationStream:Q,destinationError:K,fileDescriptors:G,sourceOptions:X,startTime:z});let H=new AbortController;try{let q=fu(J,Q,H);return await Promise.race([hu(V),...bu(W,{sourceStream:J,mergedStream:q,sourceOptions:X,fileDescriptors:G,startTime:z})])}finally{H.abort()}},q31=(Z,J)=>Promise.allSettled([Z,J]);import{setImmediate as O31}from"timers/promises";import{on as F31}from"events";import{getDefaultHighWaterMark as U31}from"stream";var zU=({subprocessStdout:Z,subprocess:J,binary:X,shouldEncode:Y,encoding:$,preserveNewlines:Q})=>{let K=new AbortController;return L31(J,K),gu({stream:Z,controller:K,binary:X,shouldEncode:!Z.readableObjectMode&&Y,encoding:$,shouldSplit:!Z.readableObjectMode,preserveNewlines:Q})},L31=async(Z,J)=>{try{await Z}catch{}finally{J.abort()}},xN=({stream:Z,onStreamEnd:J,lines:X,encoding:Y,stripFinalNewline:$,allMixed:Q})=>{let K=new AbortController;w31(J,K,Z);let W=Z.readableObjectMode&&!Q;return gu({stream:Z,controller:K,binary:Y==="buffer",shouldEncode:!W,encoding:Y,shouldSplit:!W&&X,preserveNewlines:!$})},w31=async(Z,J,X)=>{try{await Z}catch{X.destroy()}finally{J.abort()}},gu=({stream:Z,controller:J,binary:X,shouldEncode:Y,encoding:$,shouldSplit:Q,preserveNewlines:K})=>{let W=F31(Z,"data",{signal:J.signal,highWaterMark:yu,highWatermark:yu});return B31({onStdoutChunk:W,controller:J,binary:X,shouldEncode:Y,encoding:$,shouldSplit:Q,preserveNewlines:K})},hN=U31(!0),yu=hN,B31=async function*({onStdoutChunk:Z,controller:J,binary:X,shouldEncode:Y,encoding:$,shouldSplit:Q,preserveNewlines:K}){let W=j31({binary:X,shouldEncode:Y,encoding:$,shouldSplit:Q,preserveNewlines:K});try{for await(let[G]of Z)yield*lX(G,W,0)}catch(G){if(!J.signal.aborted)throw G}finally{yield*_G(W)}},j31=({binary:Z,shouldEncode:J,encoding:X,shouldSplit:Y,preserveNewlines:$})=>[ZU(Z,X,!J),eF(Z,$,!Y,{})].filter(Boolean);var mu=async({stream:Z,onStreamEnd:J,fdNumber:X,encoding:Y,buffer:$,maxBuffer:Q,lines:K,allMixed:W,stripFinalNewline:G,verboseInfo:z,streamInfo:V})=>{let H=M31({stream:Z,onStreamEnd:J,fdNumber:X,encoding:Y,allMixed:W,verboseInfo:z,streamInfo:V});if(!$){await Promise.all([R31(Z),H]);return}let q=LN(G,X),F=xN({stream:Z,onStreamEnd:J,lines:K,encoding:Y,stripFinalNewline:q,allMixed:W}),[U]=await Promise.all([N31({stream:Z,iterable:F,fdNumber:X,encoding:Y,maxBuffer:Q,lines:K}),H]);return U},M31=async({stream:Z,onStreamEnd:J,fdNumber:X,encoding:Y,allMixed:$,verboseInfo:Q,streamInfo:{fileDescriptors:K}})=>{if(!YU({stdioItems:K[X]?.stdioItems,encoding:Y,verboseInfo:Q,fdNumber:X}))return;let W=xN({stream:Z,onStreamEnd:J,lines:!0,encoding:Y,stripFinalNewline:!0,allMixed:$});await nm(W,Z,X,Q)},R31=async(Z)=>{if(await O31(),Z.readableFlowing===null)Z.resume()},N31=async({stream:Z,stream:{readableObjectMode:J},iterable:X,fdNumber:Y,encoding:$,maxBuffer:Q,lines:K})=>{try{if(J||K)return await cF(X,{maxBuffer:Q});if($==="buffer")return new Uint8Array(await lF(X,{maxBuffer:Q}));return await iF(X,{maxBuffer:Q})}catch(W){return uu(ng({error:W,stream:Z,readableObjectMode:J,lines:K,encoding:$,fdNumber:Y}))}},fN=async(Z)=>{try{return await Z}catch(J){return uu(J)}},uu=({bufferedData:Z})=>zb(Z)?new Uint8Array(Z):Z;import{finished as P31}from"stream/promises";var fG=async(Z,J,X,{isSameDirection:Y,stopOnExit:$=!1}={})=>{let Q=D31(Z,X),K=new AbortController;try{await Promise.race([...$?[X.exitPromise]:[],P31(Z,{cleanup:!0,signal:K.signal})])}catch(W){if(!Q.stdinCleanedUp)k31(W,J,X,Y)}finally{K.abort()}},D31=(Z,{originalStreams:[J],subprocess:X})=>{let Y={stdinCleanedUp:!1};if(Z===J)C31(Z,X,Y);return Y},C31=(Z,J,X)=>{let{_destroy:Y}=Z;Z._destroy=(...$)=>{T31(J,X),Y.call(Z,...$)}},T31=({exitCode:Z,signalCode:J},X)=>{if(Z!==null||J!==null)X.stdinCleanedUp=!0},k31=(Z,J,X,Y)=>{if(!E31(Z,J,X,Y))throw Z},E31=(Z,J,X,Y=!0)=>{if(X.propagating)return du(Z)||VU(Z);return X.propagating=!0,bN(X,J)===Y?du(Z):VU(Z)},bN=({fileDescriptors:Z},J)=>J!=="all"&&Z[J].direction==="input",VU=(Z)=>Z?.code==="ERR_STREAM_PREMATURE_CLOSE",du=(Z)=>Z?.code==="EPIPE";var cu=({subprocess:Z,encoding:J,buffer:X,maxBuffer:Y,lines:$,stripFinalNewline:Q,verboseInfo:K,streamInfo:W})=>Z.stdio.map((G,z)=>yN({stream:G,fdNumber:z,encoding:J,buffer:X[z],maxBuffer:Y[z],lines:$[z],allMixed:!1,stripFinalNewline:Q,verboseInfo:K,streamInfo:W})),yN=async({stream:Z,fdNumber:J,encoding:X,buffer:Y,maxBuffer:$,lines:Q,allMixed:K,stripFinalNewline:W,verboseInfo:G,streamInfo:z})=>{if(!Z)return;let V=fG(Z,J,z);if(bN(z,J)){await V;return}let[H]=await Promise.all([mu({stream:Z,onStreamEnd:V,fdNumber:J,encoding:X,buffer:Y,maxBuffer:$,lines:Q,allMixed:K,stripFinalNewline:W,verboseInfo:G,streamInfo:z}),V]);return H};var lu=({stdout:Z,stderr:J},{all:X})=>X&&(Z||J)?pX([Z,J].filter(Boolean)):void 0,pu=({subprocess:Z,encoding:J,buffer:X,maxBuffer:Y,lines:$,stripFinalNewline:Q,verboseInfo:K,streamInfo:W})=>yN({...I31(Z,X),fdNumber:"all",encoding:J,maxBuffer:Y[1]+Y[2],lines:$[1]||$[2],allMixed:v31(Z),stripFinalNewline:Q,verboseInfo:K,streamInfo:W}),I31=({stdout:Z,stderr:J,all:X},[,Y,$])=>{let Q=Y||$;if(!Q)return{stream:X,buffer:Q};if(!Y)return{stream:J,buffer:Q};if(!$)return{stream:Z,buffer:Q};return{stream:X,buffer:Q}},v31=({all:Z,stdout:J,stderr:X})=>Z&&J&&X&&J.readableObjectMode!==X.readableObjectMode;import{once as S31}from"events";var iu=(Z)=>KQ(Z,"ipc"),nu=(Z,J)=>{let X=UF(Z);l4({type:"ipc",verboseMessage:X,fdNumber:"ipc",verboseInfo:J})};var au=async({subprocess:Z,buffer:J,maxBuffer:X,ipc:Y,ipcOutput:$,verboseInfo:Q})=>{if(!Y)return $;let K=iu(Q),W=t7(J,"ipc"),G=t7(X,"ipc");for await(let z of DN({anyProcess:Z,channel:Z.channel,isSubprocess:!1,ipc:Y,shouldAwait:!1,reference:!0})){if(W)ag(Z,$,G),$.push(z);if(K)nu(z,Q)}return $},su=async(Z,J)=>{return await Promise.allSettled([Z]),J};var ou=async({subprocess:Z,options:{encoding:J,buffer:X,maxBuffer:Y,lines:$,timeoutDuration:Q,cancelSignal:K,gracefulCancel:W,forceKillAfterDelay:G,stripFinalNewline:z,ipc:V,ipcInput:H},context:q,verboseInfo:F,fileDescriptors:U,originalStreams:w,onInternalError:L,controller:j})=>{let R=tm(Z,q),O={originalStreams:w,fileDescriptors:U,subprocess:Z,exitPromise:R,propagating:!1},N=cu({subprocess:Z,encoding:J,buffer:X,maxBuffer:Y,lines:$,stripFinalNewline:z,verboseInfo:F,streamInfo:O}),D=pu({subprocess:Z,encoding:J,buffer:X,maxBuffer:Y,lines:$,stripFinalNewline:z,verboseInfo:F,streamInfo:O}),P=[],C=au({subprocess:Z,buffer:X,maxBuffer:Y,ipc:V,ipcOutput:P,verboseInfo:F}),T=_31(w,Z,O),k=A31(U,O);try{return await Promise.race([Promise.all([{},Zu(R),Promise.all(N),D,C,Cg(Z,H),...T,...k]),L,x31(Z,j),...Mg(Z,Q,q,j),...uy({subprocess:Z,cancelSignal:K,gracefulCancel:W,context:q,controller:j}),...jg({subprocess:Z,cancelSignal:K,gracefulCancel:W,forceKillAfterDelay:G,context:q,controller:j})])}catch(A){return q.terminationReason??="other",Promise.all([{error:A},R,Promise.all(N.map((S)=>fN(S))),fN(D),su(C,P),Promise.allSettled(T),Promise.allSettled(k)])}},_31=(Z,J,X)=>Z.map((Y,$)=>Y===J.stdio[$]?void 0:fG(Y,$,X)),A31=(Z,J)=>Z.flatMap(({stdioItems:X},Y)=>X.filter(({value:$,stream:Q=$})=>$4(Q,{checkOpen:!1})&&!X4(Q)).map(({type:$,value:Q,stream:K=Q})=>fG(K,Y,J,{isSameDirection:F9.has($),stopOnExit:$==="native"}))),x31=async(Z,{signal:J})=>{let[X]=await S31(Z,"error",{signal:J});throw X};var ru=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),bG=(Z,J,X)=>{let Y=Z[X];if(!Y.has(J))Y.set(J,[]);let $=Y.get(J),Q=i4();return $.push(Q),{resolve:Q.resolve.bind(Q),promises:$}},jQ=async({resolve:Z,promises:J},X)=>{Z();let[Y]=await Promise.race([Promise.allSettled([!0,X]),Promise.all([!1,...J])]);return!Y};import{Readable as h31}from"stream";import{callbackify as f31}from"util";import{finished as tu}from"stream/promises";var gN=async(Z)=>{if(Z===void 0)return;try{await mN(Z)}catch{}},eu=async(Z)=>{if(Z===void 0)return;try{await uN(Z)}catch{}},mN=async(Z)=>{await tu(Z,{cleanup:!0,readable:!1,writable:!0})},uN=async(Z)=>{await tu(Z,{cleanup:!0,readable:!0,writable:!1})},HU=async(Z,J)=>{if(await Z,J)throw J},qU=(Z,J,X)=>{if(X&&!VU(X))Z.destroy(X);else if(J)Z.destroy()};var Zd=({subprocess:Z,concurrentStreams:J,encoding:X},{from:Y,binary:$=!0,preserveNewlines:Q=!0}={})=>{let K=$||m5.has(X),{subprocessStdout:W,waitReadableDestroy:G}=dN(Z,Y,J),{readableEncoding:z,readableObjectMode:V,readableHighWaterMark:H}=cN(W,K),{read:q,onStdoutDataDone:F}=lN({subprocessStdout:W,subprocess:Z,binary:K,encoding:X,preserveNewlines:Q}),U=new h31({read:q,destroy:f31(iN.bind(void 0,{subprocessStdout:W,subprocess:Z,waitReadableDestroy:G})),highWaterMark:H,objectMode:V,encoding:z});return pN({subprocessStdout:W,onStdoutDataDone:F,readable:U,subprocess:Z}),U},dN=(Z,J,X)=>{let Y=HQ(Z,J),$=bG(X,Y,"readableDestroy");return{subprocessStdout:Y,waitReadableDestroy:$}},cN=({readableEncoding:Z,readableObjectMode:J,readableHighWaterMark:X},Y)=>Y?{readableEncoding:Z,readableObjectMode:J,readableHighWaterMark:X}:{readableEncoding:Z,readableObjectMode:!0,readableHighWaterMark:hN},lN=({subprocessStdout:Z,subprocess:J,binary:X,encoding:Y,preserveNewlines:$})=>{let Q=i4(),K=zU({subprocessStdout:Z,subprocess:J,binary:X,shouldEncode:!X,encoding:Y,preserveNewlines:$});return{read(){b31(this,K,Q)},onStdoutDataDone:Q}},b31=async(Z,J,X)=>{try{let{value:Y,done:$}=await J.next();if($)X.resolve();else Z.push(Y)}catch{}},pN=async({subprocessStdout:Z,onStdoutDataDone:J,readable:X,subprocess:Y,subprocessStdin:$})=>{try{if(await uN(Z),await Y,await gN($),await J,X.readable)X.push(null)}catch(Q){await gN($),Jd(X,Q)}},iN=async({subprocessStdout:Z,subprocess:J,waitReadableDestroy:X},Y)=>{if(await jQ(X,J))Jd(Z,Y),await HU(J,Y)},Jd=(Z,J)=>{qU(Z,Z.readable,J)};import{Writable as y31}from"stream";import{callbackify as Xd}from"util";var Yd=({subprocess:Z,concurrentStreams:J},{to:X}={})=>{let{subprocessStdin:Y,waitWritableFinal:$,waitWritableDestroy:Q}=nN(Z,X,J),K=new y31({...aN(Y,Z,$),destroy:Xd(oN.bind(void 0,{subprocessStdin:Y,subprocess:Z,waitWritableFinal:$,waitWritableDestroy:Q})),highWaterMark:Y.writableHighWaterMark,objectMode:Y.writableObjectMode});return sN(Y,K),K},nN=(Z,J,X)=>{let Y=EF(Z,J),$=bG(X,Y,"writableFinal"),Q=bG(X,Y,"writableDestroy");return{subprocessStdin:Y,waitWritableFinal:$,waitWritableDestroy:Q}},aN=(Z,J,X)=>({write:g31.bind(void 0,Z),final:Xd(m31.bind(void 0,Z,J,X))}),g31=(Z,J,X,Y)=>{if(Z.write(J,X))Y();else Z.once("drain",Y)},m31=async(Z,J,X)=>{if(await jQ(X,J)){if(Z.writable)Z.end();await J}},sN=async(Z,J,X)=>{try{if(await mN(Z),J.writable)J.end()}catch(Y){await eu(X),$d(J,Y)}},oN=async({subprocessStdin:Z,subprocess:J,waitWritableFinal:X,waitWritableDestroy:Y},$)=>{if(await jQ(X,J),await jQ(Y,J))$d(Z,$),await HU(J,$)},$d=(Z,J)=>{qU(Z,Z.writable,J)};import{Duplex as u31}from"stream";import{callbackify as d31}from"util";var Qd=({subprocess:Z,concurrentStreams:J,encoding:X},{from:Y,to:$,binary:Q=!0,preserveNewlines:K=!0}={})=>{let W=Q||m5.has(X),{subprocessStdout:G,waitReadableDestroy:z}=dN(Z,Y,J),{subprocessStdin:V,waitWritableFinal:H,waitWritableDestroy:q}=nN(Z,$,J),{readableEncoding:F,readableObjectMode:U,readableHighWaterMark:w}=cN(G,W),{read:L,onStdoutDataDone:j}=lN({subprocessStdout:G,subprocess:Z,binary:W,encoding:X,preserveNewlines:K}),R=new u31({read:L,...aN(V,Z,H),destroy:d31(c31.bind(void 0,{subprocessStdout:G,subprocessStdin:V,subprocess:Z,waitReadableDestroy:z,waitWritableFinal:H,waitWritableDestroy:q})),readableHighWaterMark:w,writableHighWaterMark:V.writableHighWaterMark,readableObjectMode:U,writableObjectMode:V.writableObjectMode,encoding:F});return pN({subprocessStdout:G,onStdoutDataDone:j,readable:R,subprocess:Z,subprocessStdin:V}),sN(V,R,G),R},c31=async({subprocessStdout:Z,subprocessStdin:J,subprocess:X,waitReadableDestroy:Y,waitWritableFinal:$,waitWritableDestroy:Q},K)=>{await Promise.all([iN({subprocessStdout:Z,subprocess:X,waitReadableDestroy:Y},K),oN({subprocessStdin:J,subprocess:X,waitWritableFinal:$,waitWritableDestroy:Q},K)])};var rN=(Z,J,{from:X,binary:Y=!1,preserveNewlines:$=!1}={})=>{let Q=Y||m5.has(J),K=HQ(Z,X),W=zU({subprocessStdout:K,subprocess:Z,binary:Q,shouldEncode:!0,encoding:J,preserveNewlines:$});return l31(W,K,Z)},l31=async function*(Z,J,X){try{yield*Z}finally{if(J.readable)J.destroy();await X}};var Kd=(Z,{encoding:J})=>{let X=ru();Z.readable=Zd.bind(void 0,{subprocess:Z,concurrentStreams:X,encoding:J}),Z.writable=Yd.bind(void 0,{subprocess:Z,concurrentStreams:X}),Z.duplex=Qd.bind(void 0,{subprocess:Z,concurrentStreams:X,encoding:J}),Z.iterable=rN.bind(void 0,Z,J),Z[Symbol.asyncIterator]=rN.bind(void 0,Z,J,{})};var Wd=(Z,J)=>{for(let[X,Y]of i31){let $=Y.value.bind(J);Reflect.defineProperty(Z,X,{...Y,value:$})}},p31=(async()=>{})().constructor.prototype,i31=["then","catch","finally"].map((Z)=>[Z,Reflect.getOwnPropertyDescriptor(p31,Z)]);var Gd=(Z,J,X,Y)=>{let{file:$,commandArguments:Q,command:K,escapedCommand:W,startTime:G,verboseInfo:z,options:V,fileDescriptors:H}=s31(Z,J,X),{subprocess:q,promise:F}=r31({file:$,commandArguments:Q,options:V,startTime:G,verboseInfo:z,command:K,escapedCommand:W,fileDescriptors:H});return q.pipe=GU.bind(void 0,{source:q,sourcePromise:F,boundOptions:{},createNested:Y}),Wd(q,F),n4.set(q,{options:V,fileDescriptors:H}),q},s31=(Z,J,X)=>{let{command:Y,escapedCommand:$,startTime:Q,verboseInfo:K}=wF(Z,J,X),{file:W,commandArguments:G,options:z}=gF(Z,J,X),V=o31(z),H=Lu(V,K);return{file:W,commandArguments:G,command:Y,escapedCommand:$,startTime:Q,verboseInfo:K,options:V,fileDescriptors:H}},o31=({timeout:Z,signal:J,...X})=>{if(J!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...X,timeoutDuration:Z}},r31=({file:Z,commandArguments:J,options:X,startTime:Y,verboseInfo:$,command:Q,escapedCommand:K,fileDescriptors:W})=>{let G;try{G=a31(Z,J,X)}catch(U){return Hu({error:U,command:Q,escapedCommand:K,fileDescriptors:W,options:X,startTime:Y,verboseInfo:$})}let z=new AbortController;n31(Number.POSITIVE_INFINITY,z.signal);let V=[...G.stdio];Cu(G,W,z),vu(G,X,z);let H={},q=i4();G.kill=gy.bind(void 0,{kill:G.kill.bind(G),options:X,onInternalError:q,context:H,controller:z}),G.all=lu(G,X),Kd(G,X),Gu(G,X);let F=t31({subprocess:G,options:X,startTime:Y,verboseInfo:$,fileDescriptors:W,originalStreams:V,command:Q,escapedCommand:K,context:H,onInternalError:q,controller:z});return{subprocess:G,promise:F}},t31=async({subprocess:Z,options:J,startTime:X,verboseInfo:Y,fileDescriptors:$,originalStreams:Q,command:K,escapedCommand:W,context:G,onInternalError:z,controller:V})=>{let[H,[q,F],U,w,L]=await ou({subprocess:Z,options:J,context:G,verboseInfo:Y,fileDescriptors:$,originalStreams:Q,onInternalError:z,controller:V});V.abort(),z.resolve();let j=U.map((N,D)=>JZ(N,J,D)),R=JZ(w,J,"all"),O=e31({errorInfo:H,exitCode:q,signal:F,stdio:j,all:R,ipcOutput:L,context:G,options:J,command:K,escapedCommand:W,startTime:X});return LQ(O,Y,J)},e31=({errorInfo:Z,exitCode:J,signal:X,stdio:Y,all:$,ipcOutput:Q,context:K,options:W,command:G,escapedCommand:z,startTime:V})=>("error"in Z)?SG({error:Z.error,command:G,escapedCommand:z,timedOut:K.terminationReason==="timeout",isCanceled:K.terminationReason==="cancel"||K.terminationReason==="gracefulCancel",isGracefullyCanceled:K.terminationReason==="gracefulCancel",isMaxBuffer:Z.error instanceof e7,isForcefullyTerminated:K.isForcefullyTerminated,exitCode:J,signal:X,stdio:Y,all:$,ipcOutput:Q,options:W,startTime:V,isSync:!1}):aF({command:G,escapedCommand:z,stdio:Y,all:$,ipcOutput:Q,options:W,startTime:V});var FU=(Z,J)=>{let X=Object.fromEntries(Object.entries(J).map(([Y,$])=>[Y,Zz1(Y,Z[Y],$)]));return{...Z,...X}},Zz1=(Z,J,X)=>{if(Jz1.has(Z)&&j8(J)&&j8(X))return{...J,...X};return X},Jz1=new Set(["env",...vR]);var YJ=(Z,J,X,Y)=>{let $=(K,W,G)=>YJ(K,W,X,G),Q=(...K)=>Xz1({mapArguments:Z,deepOptions:X,boundOptions:J,setBoundExeca:Y,createNested:$},...K);if(Y!==void 0)Y(Q,$,J);return Q},Xz1=({mapArguments:Z,deepOptions:J={},boundOptions:X={},setBoundExeca:Y,createNested:$},Q,...K)=>{if(j8(Q))return $(Z,FU(X,Q),Y);let{file:W,commandArguments:G,options:z,isSync:V}=Yz1({mapArguments:Z,firstArgument:Q,nextArguments:K,deepOptions:J,boundOptions:X});return V?Xu(W,G,z):Gd(W,G,z,$)},Yz1=({mapArguments:Z,firstArgument:J,nextArguments:X,deepOptions:Y,boundOptions:$})=>{let Q=Lb(J)?wb(J,X):[J,...X],[K,W,G]=QF(...Q),z=FU(FU(Y,$),G),{file:V=K,commandArguments:H=W,options:q=z,isSync:F=!1}=Z({file:K,commandArguments:W,options:z});return{file:V,commandArguments:H,options:q,isSync:F}};var zd=({file:Z,commandArguments:J})=>Hd(Z,J),Vd=({file:Z,commandArguments:J})=>({...Hd(Z,J),isSync:!0}),Hd=(Z,J)=>{if(J.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${Z} ${J}.`);let[X,...Y]=$z1(Z);return{file:X,commandArguments:Y}},$z1=(Z)=>{if(typeof Z!=="string")throw new TypeError(`The command must be a string: ${String(Z)}.`);let J=Z.trim();if(J==="")return[];let X=[];for(let Y of J.split(Qz1)){let $=X.at(-1);if($&&$.endsWith("\\"))X[X.length-1]=`${$.slice(0,-1)} ${Y}`;else X.push(Y)}return X},Qz1=/ +/g;var qd=(Z,J,X)=>{Z.sync=J(Kz1,X),Z.s=Z.sync},Fd=({options:Z})=>Ud(Z),Kz1=({options:Z})=>({...Ud(Z),isSync:!0}),Ud=(Z)=>({options:{...Wz1(Z),...Z}}),Wz1=({input:Z,inputFile:J,stdio:X})=>Z===void 0&&J===void 0&&X===void 0?{stdin:"inherit"}:{},Ld={preferLocal:!0};var wd=YJ(()=>({})),OG6=YJ(()=>({isSync:!0})),MG6=YJ(zd),RG6=YJ(Vd),NG6=YJ(Ng),PG6=YJ(Fd,{},Ld,qd),{sendMessage:DG6,getOneMessage:CG6,getEachMessage:TG6,getCancelSignal:kG6}=zu();var fd=t(Ed(),1);var gG=(Z)=>{if(typeof Z!=="string")throw new TypeError("invalid pattern");if(Z.length>65536)throw new TypeError("pattern is too long")};var Lz1={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},mG=(Z)=>Z.replace(/[[\]\\-]/g,"\\$&"),wz1=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Id=(Z)=>Z.join(""),vd=(Z,J)=>{let X=J;if(Z.charAt(X)!=="[")throw new Error("not in a brace expression");let Y=[],$=[],Q=X+1,K=!1,W=!1,G=!1,z=!1,V=X,H="";Z:while(Q<Z.length){let w=Z.charAt(Q);if((w==="!"||w==="^")&&Q===X+1){z=!0,Q++;continue}if(w==="]"&&K&&!G){V=Q+1;break}if(K=!0,w==="\\"){if(!G){G=!0,Q++;continue}}if(w==="["&&!G){for(let[L,[j,R,O]]of Object.entries(Lz1))if(Z.startsWith(L,Q)){if(H)return["$.",!1,Z.length-X,!0];if(Q+=L.length,O)$.push(j);else Y.push(j);W=W||R;continue Z}}if(G=!1,H){if(w>H)Y.push(mG(H)+"-"+mG(w));else if(w===H)Y.push(mG(w));H="",Q++;continue}if(Z.startsWith("-]",Q+1)){Y.push(mG(w+"-")),Q+=2;continue}if(Z.startsWith("-",Q+1)){H=w,Q+=2;continue}Y.push(mG(w)),Q++}if(V<Q)return["",!1,0,!1];if(!Y.length&&!$.length)return["$.",!1,Z.length-X,!0];if($.length===0&&Y.length===1&&/^\\?.$/.test(Y[0])&&!z){let w=Y[0].length===2?Y[0].slice(-1):Y[0];return[wz1(w),!1,V-X,!1]}let q="["+(z?"^":"")+Id(Y)+"]",F="["+(z?"":"^")+Id($)+"]";return[Y.length&&$.length?"("+q+"|"+F+")":Y.length?q:F,W,V-X,!0]};var Q4=(Z,{windowsPathsNoEscape:J=!1}={})=>{return J?Z.replace(/\[([^\/\\])\]/g,"$1"):Z.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var Bz1=new Set(["!","?","+","*","@"]),Sd=(Z)=>Bz1.has(Z),jz1="(?!(?:^|/)\\.\\.?(?:$|/))",UU="(?!\\.)",Oz1=new Set(["[","."]),Mz1=new Set(["..","."]),Rz1=new Set("().*{}+?[]^$\\!"),Nz1=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),JP="[^/]",_d=JP+"*?",Ad=JP+"+?";class U6{type;#Z;#J;#Y=!1;#X=[];#$;#V;#q;#W=!1;#G;#z;#H=!1;constructor(Z,J,X={}){if(this.type=Z,Z)this.#J=!0;if(this.#$=J,this.#Z=this.#$?this.#$.#Z:this,this.#G=this.#Z===this?X:this.#Z.#G,this.#q=this.#Z===this?[]:this.#Z.#q,Z==="!"&&!this.#Z.#W)this.#q.push(this);this.#V=this.#$?this.#$.#X.length:0}get hasMagic(){if(this.#J!==void 0)return this.#J;for(let Z of this.#X){if(typeof Z==="string")continue;if(Z.type||Z.hasMagic)return this.#J=!0}return this.#J}toString(){if(this.#z!==void 0)return this.#z;if(!this.type)return this.#z=this.#X.map((Z)=>String(Z)).join("");else return this.#z=this.type+"("+this.#X.map((Z)=>String(Z)).join("|")+")"}#Q(){if(this!==this.#Z)throw new Error("should only call on root");if(this.#W)return this;this.toString(),this.#W=!0;let Z;while(Z=this.#q.pop()){if(Z.type!=="!")continue;let J=Z,X=J.#$;while(X){for(let Y=J.#V+1;!X.type&&Y<X.#X.length;Y++)for(let $ of Z.#X){if(typeof $==="string")throw new Error("string part in extglob AST??");$.copyIn(X.#X[Y])}J=X,X=J.#$}}return this}push(...Z){for(let J of Z){if(J==="")continue;if(typeof J!=="string"&&!(J instanceof U6&&J.#$===this))throw new Error("invalid part: "+J);this.#X.push(J)}}toJSON(){let Z=this.type===null?this.#X.slice().map((J)=>typeof J==="string"?J:J.toJSON()):[this.type,...this.#X.map((J)=>J.toJSON())];if(this.isStart()&&!this.type)Z.unshift([]);if(this.isEnd()&&(this===this.#Z||this.#Z.#W&&this.#$?.type==="!"))Z.push({});return Z}isStart(){if(this.#Z===this)return!0;if(!this.#$?.isStart())return!1;if(this.#V===0)return!0;let Z=this.#$;for(let J=0;J<this.#V;J++){let X=Z.#X[J];if(!(X instanceof U6&&X.type==="!"))return!1}return!0}isEnd(){if(this.#Z===this)return!0;if(this.#$?.type==="!")return!0;if(!this.#$?.isEnd())return!1;if(!this.type)return this.#$?.isEnd();let Z=this.#$?this.#$.#X.length:0;return this.#V===Z-1}copyIn(Z){if(typeof Z==="string")this.push(Z);else this.push(Z.clone(this))}clone(Z){let J=new U6(this.type,Z);for(let X of this.#X)J.copyIn(X);return J}static#U(Z,J,X,Y){let $=!1,Q=!1,K=-1,W=!1;if(J.type===null){let q=X,F="";while(q<Z.length){let U=Z.charAt(q++);if($||U==="\\"){$=!$,F+=U;continue}if(Q){if(q===K+1){if(U==="^"||U==="!")W=!0}else if(U==="]"&&!(q===K+2&&W))Q=!1;F+=U;continue}else if(U==="["){Q=!0,K=q,W=!1,F+=U;continue}if(!Y.noext&&Sd(U)&&Z.charAt(q)==="("){J.push(F),F="";let w=new U6(U,J);q=U6.#U(Z,w,q,Y),J.push(w);continue}F+=U}return J.push(F),q}let G=X+1,z=new U6(null,J),V=[],H="";while(G<Z.length){let q=Z.charAt(G++);if($||q==="\\"){$=!$,H+=q;continue}if(Q){if(G===K+1){if(q==="^"||q==="!")W=!0}else if(q==="]"&&!(G===K+2&&W))Q=!1;H+=q;continue}else if(q==="["){Q=!0,K=G,W=!1,H+=q;continue}if(Sd(q)&&Z.charAt(G)==="("){z.push(H),H="";let F=new U6(q,z);z.push(F),G=U6.#U(Z,F,G,Y);continue}if(q==="|"){z.push(H),H="",V.push(z),z=new U6(null,J);continue}if(q===")"){if(H===""&&J.#X.length===0)J.#H=!0;return z.push(H),H="",J.push(...V,z),G}H+=q}return J.type=null,J.#J=void 0,J.#X=[Z.substring(X-1)],G}static fromGlob(Z,J={}){let X=new U6(null,void 0,J);return U6.#U(Z,X,0,J),X}toMMPattern(){if(this!==this.#Z)return this.#Z.toMMPattern();let Z=this.toString(),[J,X,Y,$]=this.toRegExpSource();if(!(Y||this.#J||this.#G.nocase&&!this.#G.nocaseMagicOnly&&Z.toUpperCase()!==Z.toLowerCase()))return X;let K=(this.#G.nocase?"i":"")+($?"u":"");return Object.assign(new RegExp(`^${J}$`,K),{_src:J,_glob:Z})}get options(){return this.#G}toRegExpSource(Z){let J=Z??!!this.#G.dot;if(this.#Z===this)this.#Q();if(!this.type){let W=this.isStart()&&this.isEnd(),G=this.#X.map((q)=>{let[F,U,w,L]=typeof q==="string"?U6.#L(q,this.#J,W):q.toRegExpSource(Z);return this.#J=this.#J||w,this.#Y=this.#Y||L,F}).join(""),z="";if(this.isStart()){if(typeof this.#X[0]==="string"){if(!(this.#X.length===1&&Mz1.has(this.#X[0]))){let F=Oz1,U=J&&F.has(G.charAt(0))||G.startsWith("\\.")&&F.has(G.charAt(2))||G.startsWith("\\.\\.")&&F.has(G.charAt(4)),w=!J&&!Z&&F.has(G.charAt(0));z=U?jz1:w?UU:""}}}let V="";if(this.isEnd()&&this.#Z.#W&&this.#$?.type==="!")V="(?:$|\\/)";return[z+G+V,Q4(G),this.#J=!!this.#J,this.#Y]}let X=this.type==="*"||this.type==="+",Y=this.type==="!"?"(?:(?!(?:":"(?:",$=this.#w(J);if(this.isStart()&&this.isEnd()&&!$&&this.type!=="!"){let W=this.toString();return this.#X=[W],this.type=null,this.#J=void 0,[W,Q4(this.toString()),!1,!1]}let Q=!X||Z||J||!UU?"":this.#w(!0);if(Q===$)Q="";if(Q)$=`(?:${$})(?:${Q})*?`;let K="";if(this.type==="!"&&this.#H)K=(this.isStart()&&!J?UU:"")+Ad;else{let W=this.type==="!"?"))"+(this.isStart()&&!J&&!Z?UU:"")+_d+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&Q?")":this.type==="*"&&Q?")?":`)${this.type}`;K=Y+$+W}return[K,Q4($),this.#J=!!this.#J,this.#Y]}#w(Z){return this.#X.map((J)=>{if(typeof J==="string")throw new Error("string type in extglob ast??");let[X,Y,$,Q]=J.toRegExpSource(Z);return this.#Y=this.#Y||Q,X}).filter((J)=>!(this.isStart()&&this.isEnd())||!!J).join("|")}static#L(Z,J,X=!1){let Y=!1,$="",Q=!1;for(let K=0;K<Z.length;K++){let W=Z.charAt(K);if(Y){Y=!1,$+=(Rz1.has(W)?"\\":"")+W;continue}if(W==="\\"){if(K===Z.length-1)$+="\\\\";else Y=!0;continue}if(W==="["){let[G,z,V,H]=vd(Z,K);if(V){$+=G,Q=Q||z,K+=V-1,J=J||H;continue}}if(W==="*"){if(X&&Z==="*")$+=Ad;else $+=_d;J=!0;continue}if(W==="?"){$+=JP,J=!0;continue}$+=Nz1(W)}return[$,Q4(Z),!!J,Q]}}var OQ=(Z,{windowsPathsNoEscape:J=!1}={})=>{return J?Z.replace(/[?*()[\]]/g,"[$&]"):Z.replace(/[?*()[\]\\]/g,"\\$&")};var m6=(Z,J,X={})=>{if(gG(J),!X.nocomment&&J.charAt(0)==="#")return!1;return new L9(J,X).match(Z)},Pz1=/^\*+([^+@!?\*\[\(]*)$/,Dz1=(Z)=>(J)=>!J.startsWith(".")&&J.endsWith(Z),Cz1=(Z)=>(J)=>J.endsWith(Z),Tz1=(Z)=>{return Z=Z.toLowerCase(),(J)=>!J.startsWith(".")&&J.toLowerCase().endsWith(Z)},kz1=(Z)=>{return Z=Z.toLowerCase(),(J)=>J.toLowerCase().endsWith(Z)},Ez1=/^\*+\.\*+$/,Iz1=(Z)=>!Z.startsWith(".")&&Z.includes("."),vz1=(Z)=>Z!=="."&&Z!==".."&&Z.includes("."),Sz1=/^\.\*+$/,_z1=(Z)=>Z!=="."&&Z!==".."&&Z.startsWith("."),Az1=/^\*+$/,xz1=(Z)=>Z.length!==0&&!Z.startsWith("."),hz1=(Z)=>Z.length!==0&&Z!=="."&&Z!=="..",fz1=/^\?+([^+@!?\*\[\(]*)?$/,bz1=([Z,J=""])=>{let X=bd([Z]);if(!J)return X;return J=J.toLowerCase(),(Y)=>X(Y)&&Y.toLowerCase().endsWith(J)},yz1=([Z,J=""])=>{let X=yd([Z]);if(!J)return X;return J=J.toLowerCase(),(Y)=>X(Y)&&Y.toLowerCase().endsWith(J)},gz1=([Z,J=""])=>{let X=yd([Z]);return!J?X:(Y)=>X(Y)&&Y.endsWith(J)},mz1=([Z,J=""])=>{let X=bd([Z]);return!J?X:(Y)=>X(Y)&&Y.endsWith(J)},bd=([Z])=>{let J=Z.length;return(X)=>X.length===J&&!X.startsWith(".")},yd=([Z])=>{let J=Z.length;return(X)=>X.length===J&&X!=="."&&X!==".."},gd=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",xd={win32:{sep:"\\"},posix:{sep:"/"}},uz1=gd==="win32"?xd.win32.sep:xd.posix.sep;m6.sep=uz1;var L6=Symbol("globstar **");m6.GLOBSTAR=L6;var dz1="[^/]",cz1=dz1+"*?",lz1="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",pz1="(?:(?!(?:\\/|^)\\.).)*?",iz1=(Z,J={})=>(X)=>m6(X,Z,J);m6.filter=iz1;var U9=(Z,J={})=>Object.assign({},Z,J),nz1=(Z)=>{if(!Z||typeof Z!=="object"||!Object.keys(Z).length)return m6;let J=m6;return Object.assign((Y,$,Q={})=>J(Y,$,U9(Z,Q)),{Minimatch:class Y extends J.Minimatch{constructor($,Q={}){super($,U9(Z,Q))}static defaults($){return J.defaults(U9(Z,$)).Minimatch}},AST:class Y extends J.AST{constructor($,Q,K={}){super($,Q,U9(Z,K))}static fromGlob($,Q={}){return J.AST.fromGlob($,U9(Z,Q))}},unescape:(Y,$={})=>J.unescape(Y,U9(Z,$)),escape:(Y,$={})=>J.escape(Y,U9(Z,$)),filter:(Y,$={})=>J.filter(Y,U9(Z,$)),defaults:(Y)=>J.defaults(U9(Z,Y)),makeRe:(Y,$={})=>J.makeRe(Y,U9(Z,$)),braceExpand:(Y,$={})=>J.braceExpand(Y,U9(Z,$)),match:(Y,$,Q={})=>J.match(Y,$,U9(Z,Q)),sep:J.sep,GLOBSTAR:L6})};m6.defaults=nz1;var md=(Z,J={})=>{if(gG(Z),J.nobrace||!/\{(?:(?!\{).)*\}/.test(Z))return[Z];return fd.default(Z)};m6.braceExpand=md;var az1=(Z,J={})=>new L9(Z,J).makeRe();m6.makeRe=az1;var sz1=(Z,J,X={})=>{let Y=new L9(J,X);if(Z=Z.filter(($)=>Y.match($)),Y.options.nonull&&!Z.length)Z.push(J);return Z};m6.match=sz1;var hd=/[?*]|[+@!]\(.*?\)|\[|\]/,oz1=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class L9{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(Z,J={}){if(gG(Z),J=J||{},this.options=J,this.pattern=Z,this.platform=J.platform||gd,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!J.windowsPathsNoEscape||J.allowWindowsEscape===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!J.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!J.nonegate,this.comment=!1,this.empty=!1,this.partial=!!J.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=J.windowsNoMagicRoot!==void 0?J.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let Z of this.set)for(let J of Z)if(typeof J!=="string")return!0;return!1}debug(...Z){}make(){let Z=this.pattern,J=this.options;if(!J.nocomment&&Z.charAt(0)==="#"){this.comment=!0;return}if(!Z){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],J.debug)this.debug=(...$)=>console.error(...$);this.debug(this.pattern,this.globSet);let X=this.globSet.map(($)=>this.slashSplit($));this.globParts=this.preprocess(X),this.debug(this.pattern,this.globParts);let Y=this.globParts.map(($,Q,K)=>{if(this.isWindows&&this.windowsNoMagicRoot){let W=$[0]===""&&$[1]===""&&($[2]==="?"||!hd.test($[2]))&&!hd.test($[3]),G=/^[a-z]:/i.test($[0]);if(W)return[...$.slice(0,4),...$.slice(4).map((z)=>this.parse(z))];else if(G)return[$[0],...$.slice(1).map((z)=>this.parse(z))]}return $.map((W)=>this.parse(W))});if(this.debug(this.pattern,Y),this.set=Y.filter(($)=>$.indexOf(!1)===-1),this.isWindows)for(let $=0;$<this.set.length;$++){let Q=this.set[$];if(Q[0]===""&&Q[1]===""&&this.globParts[$][2]==="?"&&typeof Q[3]==="string"&&/^[a-z]:$/i.test(Q[3]))Q[2]="?"}this.debug(this.pattern,this.set)}preprocess(Z){if(this.options.noglobstar){for(let X=0;X<Z.length;X++)for(let Y=0;Y<Z[X].length;Y++)if(Z[X][Y]==="**")Z[X][Y]="*"}let{optimizationLevel:J=1}=this.options;if(J>=2)Z=this.firstPhasePreProcess(Z),Z=this.secondPhasePreProcess(Z);else if(J>=1)Z=this.levelOneOptimize(Z);else Z=this.adjascentGlobstarOptimize(Z);return Z}adjascentGlobstarOptimize(Z){return Z.map((J)=>{let X=-1;while((X=J.indexOf("**",X+1))!==-1){let Y=X;while(J[Y+1]==="**")Y++;if(Y!==X)J.splice(X,Y-X)}return J})}levelOneOptimize(Z){return Z.map((J)=>{return J=J.reduce((X,Y)=>{let $=X[X.length-1];if(Y==="**"&&$==="**")return X;if(Y===".."){if($&&$!==".."&&$!=="."&&$!=="**")return X.pop(),X}return X.push(Y),X},[]),J.length===0?[""]:J})}levelTwoFileOptimize(Z){if(!Array.isArray(Z))Z=this.slashSplit(Z);let J=!1;do{if(J=!1,!this.preserveMultipleSlashes){for(let Y=1;Y<Z.length-1;Y++){let $=Z[Y];if(Y===1&&$===""&&Z[0]==="")continue;if($==="."||$==="")J=!0,Z.splice(Y,1),Y--}if(Z[0]==="."&&Z.length===2&&(Z[1]==="."||Z[1]===""))J=!0,Z.pop()}let X=0;while((X=Z.indexOf("..",X+1))!==-1){let Y=Z[X-1];if(Y&&Y!=="."&&Y!==".."&&Y!=="**")J=!0,Z.splice(X-1,2),X-=2}}while(J);return Z.length===0?[""]:Z}firstPhasePreProcess(Z){let J=!1;do{J=!1;for(let X of Z){let Y=-1;while((Y=X.indexOf("**",Y+1))!==-1){let Q=Y;while(X[Q+1]==="**")Q++;if(Q>Y)X.splice(Y+1,Q-Y);let K=X[Y+1],W=X[Y+2],G=X[Y+3];if(K!=="..")continue;if(!W||W==="."||W===".."||!G||G==="."||G==="..")continue;J=!0,X.splice(Y,1);let z=X.slice(0);z[Y]="**",Z.push(z),Y--}if(!this.preserveMultipleSlashes){for(let Q=1;Q<X.length-1;Q++){let K=X[Q];if(Q===1&&K===""&&X[0]==="")continue;if(K==="."||K==="")J=!0,X.splice(Q,1),Q--}if(X[0]==="."&&X.length===2&&(X[1]==="."||X[1]===""))J=!0,X.pop()}let $=0;while(($=X.indexOf("..",$+1))!==-1){let Q=X[$-1];if(Q&&Q!=="."&&Q!==".."&&Q!=="**"){J=!0;let W=$===1&&X[$+1]==="**"?["."]:[];if(X.splice($-1,2,...W),X.length===0)X.push("");$-=2}}}}while(J);return Z}secondPhasePreProcess(Z){for(let J=0;J<Z.length-1;J++)for(let X=J+1;X<Z.length;X++){let Y=this.partsMatch(Z[J],Z[X],!this.preserveMultipleSlashes);if(Y){Z[J]=[],Z[X]=Y;break}}return Z.filter((J)=>J.length)}partsMatch(Z,J,X=!1){let Y=0,$=0,Q=[],K="";while(Y<Z.length&&$<J.length)if(Z[Y]===J[$])Q.push(K==="b"?J[$]:Z[Y]),Y++,$++;else if(X&&Z[Y]==="**"&&J[$]===Z[Y+1])Q.push(Z[Y]),Y++;else if(X&&J[$]==="**"&&Z[Y]===J[$+1])Q.push(J[$]),$++;else if(Z[Y]==="*"&&J[$]&&(this.options.dot||!J[$].startsWith("."))&&J[$]!=="**"){if(K==="b")return!1;K="a",Q.push(Z[Y]),Y++,$++}else if(J[$]==="*"&&Z[Y]&&(this.options.dot||!Z[Y].startsWith("."))&&Z[Y]!=="**"){if(K==="a")return!1;K="b",Q.push(J[$]),Y++,$++}else return!1;return Z.length===J.length&&Q}parseNegate(){if(this.nonegate)return;let Z=this.pattern,J=!1,X=0;for(let Y=0;Y<Z.length&&Z.charAt(Y)==="!";Y++)J=!J,X++;if(X)this.pattern=Z.slice(X);this.negate=J}matchOne(Z,J,X=!1){let Y=this.options;if(this.isWindows){let U=typeof Z[0]==="string"&&/^[a-z]:$/i.test(Z[0]),w=!U&&Z[0]===""&&Z[1]===""&&Z[2]==="?"&&/^[a-z]:$/i.test(Z[3]),L=typeof J[0]==="string"&&/^[a-z]:$/i.test(J[0]),j=!L&&J[0]===""&&J[1]===""&&J[2]==="?"&&typeof J[3]==="string"&&/^[a-z]:$/i.test(J[3]),R=w?3:U?0:void 0,O=j?3:L?0:void 0;if(typeof R==="number"&&typeof O==="number"){let[N,D]=[Z[R],J[O]];if(N.toLowerCase()===D.toLowerCase()){if(J[O]=N,O>R)J=J.slice(O);else if(R>O)Z=Z.slice(R)}}}let{optimizationLevel:$=1}=this.options;if($>=2)Z=this.levelTwoFileOptimize(Z);this.debug("matchOne",this,{file:Z,pattern:J}),this.debug("matchOne",Z.length,J.length);for(var Q=0,K=0,W=Z.length,G=J.length;Q<W&&K<G;Q++,K++){this.debug("matchOne loop");var z=J[K],V=Z[Q];if(this.debug(J,z,V),z===!1)return!1;if(z===L6){this.debug("GLOBSTAR",[J,z,V]);var H=Q,q=K+1;if(q===G){this.debug("** at the end");for(;Q<W;Q++)if(Z[Q]==="."||Z[Q]===".."||!Y.dot&&Z[Q].charAt(0)===".")return!1;return!0}while(H<W){var F=Z[H];if(this.debug(`
405
405
  globstar while`,Z,H,J,q,F),this.matchOne(Z.slice(H),J.slice(q),X))return this.debug("globstar found match!",H,W,F),!0;else{if(F==="."||F===".."||!Y.dot&&F.charAt(0)==="."){this.debug("dot detected!",Z,H,J,q);break}this.debug("globstar swallow a segment, and continue"),H++}}if(X){if(this.debug(`
406
- >>> no match, partial?`,Z,H,J,q),H===W)return!0}return!1}let U;if(typeof z==="string")U=V===z,this.debug("string match",z,V,U);else U=z.test(V),this.debug("pattern match",z,V,U);if(!U)return!1}if(Q===W&&K===G)return!0;else if(Q===W)return X;else if(K===G)return Q===W-1&&Z[Q]==="";else throw new Error("wtf?")}braceExpand(){return md(this.pattern,this.options)}parse(Z){gG(Z);let J=this.options;if(Z==="**")return L6;if(Z==="")return"";let X,Y=null;if(X=Z.match(Az1))Y=J.dot?hz1:xz1;else if(X=Z.match(Pz1))Y=(J.nocase?J.dot?kz1:Tz1:J.dot?Cz1:Dz1)(X[1]);else if(X=Z.match(fz1))Y=(J.nocase?J.dot?yz1:bz1:J.dot?gz1:mz1)(X);else if(X=Z.match(Ez1))Y=J.dot?vz1:Iz1;else if(X=Z.match(Sz1))Y=_z1;let $=U6.fromGlob(Z,this.options).toMMPattern();if(Y&&typeof $==="object")Reflect.defineProperty($,"test",{value:Y});return $}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Z=this.set;if(!Z.length)return this.regexp=!1,this.regexp;let J=this.options,X=J.noglobstar?cz1:J.dot?lz1:pz1,Y=new Set(J.nocase?["i"]:[]),$=Z.map((W)=>{let G=W.map((z)=>{if(z instanceof RegExp)for(let V of z.flags.split(""))Y.add(V);return typeof z==="string"?oz1(z):z===L6?L6:z._src});return G.forEach((z,V)=>{let H=G[V+1],q=G[V-1];if(z!==L6||q===L6)return;if(q===void 0)if(H!==void 0&&H!==L6)G[V+1]="(?:\\/|"+X+"\\/)?"+H;else G[V]=X;else if(H===void 0)G[V-1]=q+"(?:\\/|"+X+")?";else if(H!==L6)G[V-1]=q+"(?:\\/|\\/"+X+"\\/)"+H,G[V+1]=L6}),G.filter((z)=>z!==L6).join("/")}).join("|"),[Q,K]=Z.length>1?["(?:",")"]:["",""];if($="^"+Q+$+K+"$",this.negate)$="^(?!"+$+").+$";try{this.regexp=new RegExp($,[...Y].join(""))}catch(W){this.regexp=!1}return this.regexp}slashSplit(Z){if(this.preserveMultipleSlashes)return Z.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(Z))return["",...Z.split(/\/+/)];else return Z.split(/\/+/)}match(Z,J=this.partial){if(this.debug("match",Z,this.pattern),this.comment)return!1;if(this.empty)return Z==="";if(Z==="/"&&J)return!0;let X=this.options;if(this.isWindows)Z=Z.split("\\").join("/");let Y=this.slashSplit(Z);this.debug(this.pattern,"split",Y);let $=this.set;this.debug(this.pattern,"set",$);let Q=Y[Y.length-1];if(!Q)for(let K=Y.length-2;!Q&&K>=0;K--)Q=Y[K];for(let K=0;K<$.length;K++){let W=$[K],G=Y;if(X.matchBase&&W.length===1)G=[Q];if(this.matchOne(G,W,J)){if(X.flipNegate)return!0;return!this.negate}}if(X.flipNegate)return!1;return this.negate}static defaults(Z){return m6.defaults(Z).Minimatch}}m6.AST=U6;m6.Minimatch=L9;m6.escape=OQ;m6.unescape=Q4;import{fileURLToPath as EV1}from"url";var MQ=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,dd=new Set,XP=typeof process==="object"&&!!process?process:{},cd=(Z,J,X,Y)=>{typeof XP.emitWarning==="function"?XP.emitWarning(Z,J,X,Y):console.error(`[${X}] ${J}: ${Z}`)},LU=globalThis.AbortController,ud=globalThis.AbortSignal;if(typeof LU==="undefined"){ud=class X{onabort;_onabort=[];reason;aborted=!1;addEventListener(Y,$){this._onabort.push($)}},LU=class X{constructor(){J()}signal=new ud;abort(Y){if(this.signal.aborted)return;this.signal.reason=Y,this.signal.aborted=!0;for(let $ of this.signal._onabort)$(Y);this.signal.onabort?.(Y)}};let Z=XP.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",J=()=>{if(!Z)return;Z=!1,cd("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",J)}}var rz1=(Z)=>!dd.has(Z),iG6=Symbol("type"),$J=(Z)=>Z&&Z===Math.floor(Z)&&Z>0&&isFinite(Z),ld=(Z)=>!$J(Z)?null:Z<=Math.pow(2,8)?Uint8Array:Z<=Math.pow(2,16)?Uint16Array:Z<=Math.pow(2,32)?Uint32Array:Z<=Number.MAX_SAFE_INTEGER?uG:null;class uG extends Array{constructor(Z){super(Z);this.fill(0)}}class RQ{heap;length;static#Z=!1;static create(Z){let J=ld(Z);if(!J)return[];RQ.#Z=!0;let X=new RQ(Z,J);return RQ.#Z=!1,X}constructor(Z,J){if(!RQ.#Z)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new J(Z),this.length=0}push(Z){this.heap[this.length++]=Z}pop(){return this.heap[--this.length]}}class dG{#Z;#J;#Y;#X;#$;#V;#q;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#W;#G;#z;#H;#Q;#U;#w;#L;#j;#k;#O;#E;#N;#R;#M;#C;#B;#v;static unsafeExposeInternals(Z){return{starts:Z.#N,ttls:Z.#R,sizes:Z.#E,keyMap:Z.#z,keyList:Z.#H,valList:Z.#Q,next:Z.#U,prev:Z.#w,get head(){return Z.#L},get tail(){return Z.#j},free:Z.#k,isBackgroundFetch:(J)=>Z.#F(J),backgroundFetch:(J,X,Y,$)=>Z.#h(J,X,Y,$),moveToTail:(J)=>Z.#y(J),indexes:(J)=>Z.#T(J),rindexes:(J)=>Z.#I(J),isStale:(J)=>Z.#D(J)}}get max(){return this.#Z}get maxSize(){return this.#J}get calculatedSize(){return this.#G}get size(){return this.#W}get fetchMethod(){return this.#V}get memoMethod(){return this.#q}get dispose(){return this.#Y}get onInsert(){return this.#X}get disposeAfter(){return this.#$}constructor(Z){let{max:J=0,ttl:X,ttlResolution:Y=1,ttlAutopurge:$,updateAgeOnGet:Q,updateAgeOnHas:K,allowStale:W,dispose:G,onInsert:z,disposeAfter:V,noDisposeOnSet:H,noUpdateTTL:q,maxSize:F=0,maxEntrySize:U=0,sizeCalculation:w,fetchMethod:L,memoMethod:j,noDeleteOnFetchRejection:R,noDeleteOnStaleGet:O,allowStaleOnFetchRejection:N,allowStaleOnFetchAbort:D,ignoreFetchAbort:P}=Z;if(J!==0&&!$J(J))throw new TypeError("max option must be a nonnegative integer");let C=J?ld(J):Array;if(!C)throw new Error("invalid max value: "+J);if(this.#Z=J,this.#J=F,this.maxEntrySize=U||this.#J,this.sizeCalculation=w,this.sizeCalculation){if(!this.#J&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw new TypeError("sizeCalculation set to non-function")}if(j!==void 0&&typeof j!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#q=j,L!==void 0&&typeof L!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#V=L,this.#C=!!L,this.#z=new Map,this.#H=new Array(J).fill(void 0),this.#Q=new Array(J).fill(void 0),this.#U=new C(J),this.#w=new C(J),this.#L=0,this.#j=0,this.#k=RQ.create(J),this.#W=0,this.#G=0,typeof G==="function")this.#Y=G;if(typeof z==="function")this.#X=z;if(typeof V==="function")this.#$=V,this.#O=[];else this.#$=void 0,this.#O=void 0;if(this.#M=!!this.#Y,this.#v=!!this.#X,this.#B=!!this.#$,this.noDisposeOnSet=!!H,this.noUpdateTTL=!!q,this.noDeleteOnFetchRejection=!!R,this.allowStaleOnFetchRejection=!!N,this.allowStaleOnFetchAbort=!!D,this.ignoreFetchAbort=!!P,this.maxEntrySize!==0){if(this.#J!==0){if(!$J(this.#J))throw new TypeError("maxSize must be a positive integer if specified")}if(!$J(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#m()}if(this.allowStale=!!W,this.noDeleteOnStaleGet=!!O,this.updateAgeOnGet=!!Q,this.updateAgeOnHas=!!K,this.ttlResolution=$J(Y)||Y===0?Y:1,this.ttlAutopurge=!!$,this.ttl=X||0,this.ttl){if(!$J(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#K()}if(this.#Z===0&&this.ttl===0&&this.#J===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Z&&!this.#J){if(rz1("LRU_CACHE_UNBOUNDED"))dd.add("LRU_CACHE_UNBOUNDED"),cd("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",dG)}}getRemainingTTL(Z){return this.#z.has(Z)?1/0:0}#K(){let Z=new uG(this.#Z),J=new uG(this.#Z);this.#R=Z,this.#N=J,this.#S=($,Q,K=MQ.now())=>{if(J[$]=Q!==0?K:0,Z[$]=Q,Q!==0&&this.ttlAutopurge){let W=setTimeout(()=>{if(this.#D($))this.#_(this.#H[$],"expire")},Q+1);if(W.unref)W.unref()}},this.#A=($)=>{J[$]=Z[$]!==0?MQ.now():0},this.#P=($,Q)=>{if(Z[Q]){let K=Z[Q],W=J[Q];if(!K||!W)return;$.ttl=K,$.start=W,$.now=X||Y();let G=$.now-W;$.remainingTTL=K-G}};let X=0,Y=()=>{let $=MQ.now();if(this.ttlResolution>0){X=$;let Q=setTimeout(()=>X=0,this.ttlResolution);if(Q.unref)Q.unref()}return $};this.getRemainingTTL=($)=>{let Q=this.#z.get($);if(Q===void 0)return 0;let K=Z[Q],W=J[Q];if(!K||!W)return 1/0;let G=(X||Y())-W;return K-G},this.#D=($)=>{let Q=J[$],K=Z[$];return!!K&&!!Q&&(X||Y())-Q>K}}#A=()=>{};#P=()=>{};#S=()=>{};#D=()=>!1;#m(){let Z=new uG(this.#Z);this.#G=0,this.#E=Z,this.#x=(J)=>{this.#G-=Z[J],Z[J]=0},this.#u=(J,X,Y,$)=>{if(this.#F(X))return 0;if(!$J(Y))if($){if(typeof $!=="function")throw new TypeError("sizeCalculation must be a function");if(Y=$(X,J),!$J(Y))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return Y},this.#f=(J,X,Y)=>{if(Z[J]=X,this.#J){let $=this.#J-Z[J];while(this.#G>$)this.#b(!0)}if(this.#G+=Z[J],Y)Y.entrySize=X,Y.totalCalculatedSize=this.#G}}#x=(Z)=>{};#f=(Z,J,X)=>{};#u=(Z,J,X,Y)=>{if(X||Y)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:Z=this.allowStale}={}){if(this.#W)for(let J=this.#j;;){if(!this.#d(J))break;if(Z||!this.#D(J))yield J;if(J===this.#L)break;else J=this.#w[J]}}*#I({allowStale:Z=this.allowStale}={}){if(this.#W)for(let J=this.#L;;){if(!this.#d(J))break;if(Z||!this.#D(J))yield J;if(J===this.#j)break;else J=this.#U[J]}}#d(Z){return Z!==void 0&&this.#z.get(this.#H[Z])===Z}*entries(){for(let Z of this.#T())if(this.#Q[Z]!==void 0&&this.#H[Z]!==void 0&&!this.#F(this.#Q[Z]))yield[this.#H[Z],this.#Q[Z]]}*rentries(){for(let Z of this.#I())if(this.#Q[Z]!==void 0&&this.#H[Z]!==void 0&&!this.#F(this.#Q[Z]))yield[this.#H[Z],this.#Q[Z]]}*keys(){for(let Z of this.#T()){let J=this.#H[Z];if(J!==void 0&&!this.#F(this.#Q[Z]))yield J}}*rkeys(){for(let Z of this.#I()){let J=this.#H[Z];if(J!==void 0&&!this.#F(this.#Q[Z]))yield J}}*values(){for(let Z of this.#T())if(this.#Q[Z]!==void 0&&!this.#F(this.#Q[Z]))yield this.#Q[Z]}*rvalues(){for(let Z of this.#I())if(this.#Q[Z]!==void 0&&!this.#F(this.#Q[Z]))yield this.#Q[Z]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(Z,J={}){for(let X of this.#T()){let Y=this.#Q[X],$=this.#F(Y)?Y.__staleWhileFetching:Y;if($===void 0)continue;if(Z($,this.#H[X],this))return this.get(this.#H[X],J)}}forEach(Z,J=this){for(let X of this.#T()){let Y=this.#Q[X],$=this.#F(Y)?Y.__staleWhileFetching:Y;if($===void 0)continue;Z.call(J,$,this.#H[X],this)}}rforEach(Z,J=this){for(let X of this.#I()){let Y=this.#Q[X],$=this.#F(Y)?Y.__staleWhileFetching:Y;if($===void 0)continue;Z.call(J,$,this.#H[X],this)}}purgeStale(){let Z=!1;for(let J of this.#I({allowStale:!0}))if(this.#D(J))this.#_(this.#H[J],"expire"),Z=!0;return Z}info(Z){let J=this.#z.get(Z);if(J===void 0)return;let X=this.#Q[J],Y=this.#F(X)?X.__staleWhileFetching:X;if(Y===void 0)return;let $={value:Y};if(this.#R&&this.#N){let Q=this.#R[J],K=this.#N[J];if(Q&&K){let W=Q-(MQ.now()-K);$.ttl=W,$.start=Date.now()}}if(this.#E)$.size=this.#E[J];return $}dump(){let Z=[];for(let J of this.#T({allowStale:!0})){let X=this.#H[J],Y=this.#Q[J],$=this.#F(Y)?Y.__staleWhileFetching:Y;if($===void 0||X===void 0)continue;let Q={value:$};if(this.#R&&this.#N){Q.ttl=this.#R[J];let K=MQ.now()-this.#N[J];Q.start=Math.floor(Date.now()-K)}if(this.#E)Q.size=this.#E[J];Z.unshift([X,Q])}return Z}load(Z){this.clear();for(let[J,X]of Z){if(X.start){let Y=Date.now()-X.start;X.start=MQ.now()-Y}this.set(J,X.value,X)}}set(Z,J,X={}){if(J===void 0)return this.delete(Z),this;let{ttl:Y=this.ttl,start:$,noDisposeOnSet:Q=this.noDisposeOnSet,sizeCalculation:K=this.sizeCalculation,status:W}=X,{noUpdateTTL:G=this.noUpdateTTL}=X,z=this.#u(Z,J,X.size||0,K);if(this.maxEntrySize&&z>this.maxEntrySize){if(W)W.set="miss",W.maxEntrySizeExceeded=!0;return this.#_(Z,"set"),this}let V=this.#W===0?void 0:this.#z.get(Z);if(V===void 0){if(V=this.#W===0?this.#j:this.#k.length!==0?this.#k.pop():this.#W===this.#Z?this.#b(!1):this.#W,this.#H[V]=Z,this.#Q[V]=J,this.#z.set(Z,V),this.#U[this.#j]=V,this.#w[V]=this.#j,this.#j=V,this.#W++,this.#f(V,z,W),W)W.set="add";if(G=!1,this.#v)this.#X?.(J,Z,"add")}else{this.#y(V);let H=this.#Q[V];if(J!==H){if(this.#C&&this.#F(H)){H.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:q}=H;if(q!==void 0&&!Q){if(this.#M)this.#Y?.(q,Z,"set");if(this.#B)this.#O?.push([q,Z,"set"])}}else if(!Q){if(this.#M)this.#Y?.(H,Z,"set");if(this.#B)this.#O?.push([H,Z,"set"])}if(this.#x(V),this.#f(V,z,W),this.#Q[V]=J,W){W.set="replace";let q=H&&this.#F(H)?H.__staleWhileFetching:H;if(q!==void 0)W.oldValue=q}}else if(W)W.set="update";if(this.#v)this.onInsert?.(J,Z,J===H?"update":"replace")}if(Y!==0&&!this.#R)this.#K();if(this.#R){if(!G)this.#S(V,Y,$);if(W)this.#P(W,V)}if(!Q&&this.#B&&this.#O){let H=this.#O,q;while(q=H?.shift())this.#$?.(...q)}return this}pop(){try{while(this.#W){let Z=this.#Q[this.#L];if(this.#b(!0),this.#F(Z)){if(Z.__staleWhileFetching)return Z.__staleWhileFetching}else if(Z!==void 0)return Z}}finally{if(this.#B&&this.#O){let Z=this.#O,J;while(J=Z?.shift())this.#$?.(...J)}}}#b(Z){let J=this.#L,X=this.#H[J],Y=this.#Q[J];if(this.#C&&this.#F(Y))Y.__abortController.abort(new Error("evicted"));else if(this.#M||this.#B){if(this.#M)this.#Y?.(Y,X,"evict");if(this.#B)this.#O?.push([Y,X,"evict"])}if(this.#x(J),Z)this.#H[J]=void 0,this.#Q[J]=void 0,this.#k.push(J);if(this.#W===1)this.#L=this.#j=0,this.#k.length=0;else this.#L=this.#U[J];return this.#z.delete(X),this.#W--,J}has(Z,J={}){let{updateAgeOnHas:X=this.updateAgeOnHas,status:Y}=J,$=this.#z.get(Z);if($!==void 0){let Q=this.#Q[$];if(this.#F(Q)&&Q.__staleWhileFetching===void 0)return!1;if(!this.#D($)){if(X)this.#A($);if(Y)Y.has="hit",this.#P(Y,$);return!0}else if(Y)Y.has="stale",this.#P(Y,$)}else if(Y)Y.has="miss";return!1}peek(Z,J={}){let{allowStale:X=this.allowStale}=J,Y=this.#z.get(Z);if(Y===void 0||!X&&this.#D(Y))return;let $=this.#Q[Y];return this.#F($)?$.__staleWhileFetching:$}#h(Z,J,X,Y){let $=J===void 0?void 0:this.#Q[J];if(this.#F($))return $;let Q=new LU,{signal:K}=X;K?.addEventListener("abort",()=>Q.abort(K.reason),{signal:Q.signal});let W={signal:Q.signal,options:X,context:Y},G=(U,w=!1)=>{let{aborted:L}=Q.signal,j=X.ignoreFetchAbort&&U!==void 0;if(X.status)if(L&&!w){if(X.status.fetchAborted=!0,X.status.fetchError=Q.signal.reason,j)X.status.fetchAbortIgnored=!0}else X.status.fetchResolved=!0;if(L&&!j&&!w)return V(Q.signal.reason);let R=q;if(this.#Q[J]===q)if(U===void 0)if(R.__staleWhileFetching)this.#Q[J]=R.__staleWhileFetching;else this.#_(Z,"fetch");else{if(X.status)X.status.fetchUpdated=!0;this.set(Z,U,W.options)}return U},z=(U)=>{if(X.status)X.status.fetchRejected=!0,X.status.fetchError=U;return V(U)},V=(U)=>{let{aborted:w}=Q.signal,L=w&&X.allowStaleOnFetchAbort,j=L||X.allowStaleOnFetchRejection,R=j||X.noDeleteOnFetchRejection,O=q;if(this.#Q[J]===q){if(!R||O.__staleWhileFetching===void 0)this.#_(Z,"fetch");else if(!L)this.#Q[J]=O.__staleWhileFetching}if(j){if(X.status&&O.__staleWhileFetching!==void 0)X.status.returnedStale=!0;return O.__staleWhileFetching}else if(O.__returned===O)throw U},H=(U,w)=>{let L=this.#V?.(Z,$,W);if(L&&L instanceof Promise)L.then((j)=>U(j===void 0?void 0:j),w);Q.signal.addEventListener("abort",()=>{if(!X.ignoreFetchAbort||X.allowStaleOnFetchAbort){if(U(void 0),X.allowStaleOnFetchAbort)U=(j)=>G(j,!0)}})};if(X.status)X.status.fetchDispatched=!0;let q=new Promise(H).then(G,z),F=Object.assign(q,{__abortController:Q,__staleWhileFetching:$,__returned:void 0});if(J===void 0)this.set(Z,F,{...W.options,status:void 0}),J=this.#z.get(Z);else this.#Q[J]=F;return F}#F(Z){if(!this.#C)return!1;let J=Z;return!!J&&J instanceof Promise&&J.hasOwnProperty("__staleWhileFetching")&&J.__abortController instanceof LU}async fetch(Z,J={}){let{allowStale:X=this.allowStale,updateAgeOnGet:Y=this.updateAgeOnGet,noDeleteOnStaleGet:$=this.noDeleteOnStaleGet,ttl:Q=this.ttl,noDisposeOnSet:K=this.noDisposeOnSet,size:W=0,sizeCalculation:G=this.sizeCalculation,noUpdateTTL:z=this.noUpdateTTL,noDeleteOnFetchRejection:V=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:H=this.allowStaleOnFetchRejection,ignoreFetchAbort:q=this.ignoreFetchAbort,allowStaleOnFetchAbort:F=this.allowStaleOnFetchAbort,context:U,forceRefresh:w=!1,status:L,signal:j}=J;if(!this.#C){if(L)L.fetch="get";return this.get(Z,{allowStale:X,updateAgeOnGet:Y,noDeleteOnStaleGet:$,status:L})}let R={allowStale:X,updateAgeOnGet:Y,noDeleteOnStaleGet:$,ttl:Q,noDisposeOnSet:K,size:W,sizeCalculation:G,noUpdateTTL:z,noDeleteOnFetchRejection:V,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:F,ignoreFetchAbort:q,status:L,signal:j},O=this.#z.get(Z);if(O===void 0){if(L)L.fetch="miss";let N=this.#h(Z,O,R,U);return N.__returned=N}else{let N=this.#Q[O];if(this.#F(N)){let k=X&&N.__staleWhileFetching!==void 0;if(L){if(L.fetch="inflight",k)L.returnedStale=!0}return k?N.__staleWhileFetching:N.__returned=N}let D=this.#D(O);if(!w&&!D){if(L)L.fetch="hit";if(this.#y(O),Y)this.#A(O);if(L)this.#P(L,O);return N}let P=this.#h(Z,O,R,U),T=P.__staleWhileFetching!==void 0&&X;if(L){if(L.fetch=D?"stale":"refresh",T&&D)L.returnedStale=!0}return T?P.__staleWhileFetching:P.__returned=P}}async forceFetch(Z,J={}){let X=await this.fetch(Z,J);if(X===void 0)throw new Error("fetch() returned undefined");return X}memo(Z,J={}){let X=this.#q;if(!X)throw new Error("no memoMethod provided to constructor");let{context:Y,forceRefresh:$,...Q}=J,K=this.get(Z,Q);if(!$&&K!==void 0)return K;let W=X(Z,K,{options:Q,context:Y});return this.set(Z,W,Q),W}get(Z,J={}){let{allowStale:X=this.allowStale,updateAgeOnGet:Y=this.updateAgeOnGet,noDeleteOnStaleGet:$=this.noDeleteOnStaleGet,status:Q}=J,K=this.#z.get(Z);if(K!==void 0){let W=this.#Q[K],G=this.#F(W);if(Q)this.#P(Q,K);if(this.#D(K)){if(Q)Q.get="stale";if(!G){if(!$)this.#_(Z,"expire");if(Q&&X)Q.returnedStale=!0;return X?W:void 0}else{if(Q&&X&&W.__staleWhileFetching!==void 0)Q.returnedStale=!0;return X?W.__staleWhileFetching:void 0}}else{if(Q)Q.get="hit";if(G)return W.__staleWhileFetching;if(this.#y(K),Y)this.#A(K);return W}}else if(Q)Q.get="miss"}#c(Z,J){this.#w[J]=Z,this.#U[Z]=J}#y(Z){if(Z!==this.#j){if(Z===this.#L)this.#L=this.#U[Z];else this.#c(this.#w[Z],this.#U[Z]);this.#c(this.#j,Z),this.#j=Z}}delete(Z){return this.#_(Z,"delete")}#_(Z,J){let X=!1;if(this.#W!==0){let Y=this.#z.get(Z);if(Y!==void 0)if(X=!0,this.#W===1)this.#g(J);else{this.#x(Y);let $=this.#Q[Y];if(this.#F($))$.__abortController.abort(new Error("deleted"));else if(this.#M||this.#B){if(this.#M)this.#Y?.($,Z,J);if(this.#B)this.#O?.push([$,Z,J])}if(this.#z.delete(Z),this.#H[Y]=void 0,this.#Q[Y]=void 0,Y===this.#j)this.#j=this.#w[Y];else if(Y===this.#L)this.#L=this.#U[Y];else{let Q=this.#w[Y];this.#U[Q]=this.#U[Y];let K=this.#U[Y];this.#w[K]=this.#w[Y]}this.#W--,this.#k.push(Y)}}if(this.#B&&this.#O?.length){let Y=this.#O,$;while($=Y?.shift())this.#$?.(...$)}return X}clear(){return this.#g("delete")}#g(Z){for(let J of this.#I({allowStale:!0})){let X=this.#Q[J];if(this.#F(X))X.__abortController.abort(new Error("deleted"));else{let Y=this.#H[J];if(this.#M)this.#Y?.(X,Y,Z);if(this.#B)this.#O?.push([X,Y,Z])}}if(this.#z.clear(),this.#Q.fill(void 0),this.#H.fill(void 0),this.#R&&this.#N)this.#R.fill(0),this.#N.fill(0);if(this.#E)this.#E.fill(0);if(this.#L=0,this.#j=0,this.#k.length=0,this.#G=0,this.#W=0,this.#B&&this.#O){let J=this.#O,X;while(X=J?.shift())this.#$?.(...X)}}}import{posix as GV1,win32 as qP}from"path";import{fileURLToPath as zV1}from"url";import{lstatSync as VV1,readdir as HV1,readdirSync as qV1,readlinkSync as FV1,realpathSync as UV1}from"fs";import*as LV1 from"fs";import{lstat as BV1,readdir as jV1,readlink as OV1,realpath as MV1}from"fs/promises";import{EventEmitter as GP}from"events";import sd from"stream";import{StringDecoder as tz1}from"string_decoder";var pd=typeof process==="object"&&process?process:{stdout:null,stderr:null},ez1=(Z)=>!!Z&&typeof Z==="object"&&(Z instanceof aX||Z instanceof sd||ZV1(Z)||JV1(Z)),ZV1=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof GP&&typeof Z.pipe==="function"&&Z.pipe!==sd.Writable.prototype.pipe,JV1=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof GP&&typeof Z.write==="function"&&typeof Z.end==="function",XZ=Symbol("EOF"),YZ=Symbol("maybeEmitEnd"),QJ=Symbol("emittedEnd"),wU=Symbol("emittingEnd"),cG=Symbol("emittedError"),BU=Symbol("closed"),id=Symbol("read"),jU=Symbol("flush"),nd=Symbol("flushChunk"),K4=Symbol("encoding"),NQ=Symbol("decoder"),r8=Symbol("flowing"),lG=Symbol("paused"),PQ=Symbol("resume"),t8=Symbol("buffer"),u6=Symbol("pipes"),e8=Symbol("bufferLength"),YP=Symbol("bufferPush"),OU=Symbol("bufferShift"),P6=Symbol("objectMode"),O8=Symbol("destroyed"),$P=Symbol("error"),QP=Symbol("emitData"),ad=Symbol("emitEnd"),KP=Symbol("emitEnd2"),s4=Symbol("async"),WP=Symbol("abort"),MU=Symbol("aborted"),pG=Symbol("signal"),nX=Symbol("dataListeners"),u5=Symbol("discarded"),iG=(Z)=>Promise.resolve().then(Z),XV1=(Z)=>Z(),YV1=(Z)=>Z==="end"||Z==="finish"||Z==="prefinish",$V1=(Z)=>Z instanceof ArrayBuffer||!!Z&&typeof Z==="object"&&Z.constructor&&Z.constructor.name==="ArrayBuffer"&&Z.byteLength>=0,QV1=(Z)=>!Buffer.isBuffer(Z)&&ArrayBuffer.isView(Z);class zP{src;dest;opts;ondrain;constructor(Z,J,X){this.src=Z,this.dest=J,this.opts=X,this.ondrain=()=>Z[PQ](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(Z){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class od extends zP{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Z,J,X){super(Z,J,X);this.proxyErrors=(Y)=>J.emit("error",Y),Z.on("error",this.proxyErrors)}}var KV1=(Z)=>!!Z.objectMode,WV1=(Z)=>!Z.objectMode&&!!Z.encoding&&Z.encoding!=="buffer";class aX extends GP{[r8]=!1;[lG]=!1;[u6]=[];[t8]=[];[P6];[K4];[s4];[NQ];[XZ]=!1;[QJ]=!1;[wU]=!1;[BU]=!1;[cG]=null;[e8]=0;[O8]=!1;[pG];[MU]=!1;[nX]=0;[u5]=!1;writable=!0;readable=!0;constructor(...Z){let J=Z[0]||{};super();if(J.objectMode&&typeof J.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(KV1(J))this[P6]=!0,this[K4]=null;else if(WV1(J))this[K4]=J.encoding,this[P6]=!1;else this[P6]=!1,this[K4]=null;if(this[s4]=!!J.async,this[NQ]=this[K4]?new tz1(this[K4]):null,J&&J.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[t8]});if(J&&J.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[u6]});let{signal:X}=J;if(X)if(this[pG]=X,X.aborted)this[WP]();else X.addEventListener("abort",()=>this[WP]())}get bufferLength(){return this[e8]}get encoding(){return this[K4]}set encoding(Z){throw new Error("Encoding must be set at instantiation time")}setEncoding(Z){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[P6]}set objectMode(Z){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[s4]}set["async"](Z){this[s4]=this[s4]||!!Z}[WP](){this[MU]=!0,this.emit("abort",this[pG]?.reason),this.destroy(this[pG]?.reason)}get aborted(){return this[MU]}set aborted(Z){}write(Z,J,X){if(this[MU])return!1;if(this[XZ])throw new Error("write after end");if(this[O8])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof J==="function")X=J,J="utf8";if(!J)J="utf8";let Y=this[s4]?iG:XV1;if(!this[P6]&&!Buffer.isBuffer(Z)){if(QV1(Z))Z=Buffer.from(Z.buffer,Z.byteOffset,Z.byteLength);else if($V1(Z))Z=Buffer.from(Z);else if(typeof Z!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[P6]){if(this[r8]&&this[e8]!==0)this[jU](!0);if(this[r8])this.emit("data",Z);else this[YP](Z);if(this[e8]!==0)this.emit("readable");if(X)Y(X);return this[r8]}if(!Z.length){if(this[e8]!==0)this.emit("readable");if(X)Y(X);return this[r8]}if(typeof Z==="string"&&!(J===this[K4]&&!this[NQ]?.lastNeed))Z=Buffer.from(Z,J);if(Buffer.isBuffer(Z)&&this[K4])Z=this[NQ].write(Z);if(this[r8]&&this[e8]!==0)this[jU](!0);if(this[r8])this.emit("data",Z);else this[YP](Z);if(this[e8]!==0)this.emit("readable");if(X)Y(X);return this[r8]}read(Z){if(this[O8])return null;if(this[u5]=!1,this[e8]===0||Z===0||Z&&Z>this[e8])return this[YZ](),null;if(this[P6])Z=null;if(this[t8].length>1&&!this[P6])this[t8]=[this[K4]?this[t8].join(""):Buffer.concat(this[t8],this[e8])];let J=this[id](Z||null,this[t8][0]);return this[YZ](),J}[id](Z,J){if(this[P6])this[OU]();else{let X=J;if(Z===X.length||Z===null)this[OU]();else if(typeof X==="string")this[t8][0]=X.slice(Z),J=X.slice(0,Z),this[e8]-=Z;else this[t8][0]=X.subarray(Z),J=X.subarray(0,Z),this[e8]-=Z}if(this.emit("data",J),!this[t8].length&&!this[XZ])this.emit("drain");return J}end(Z,J,X){if(typeof Z==="function")X=Z,Z=void 0;if(typeof J==="function")X=J,J="utf8";if(Z!==void 0)this.write(Z,J);if(X)this.once("end",X);if(this[XZ]=!0,this.writable=!1,this[r8]||!this[lG])this[YZ]();return this}[PQ](){if(this[O8])return;if(!this[nX]&&!this[u6].length)this[u5]=!0;if(this[lG]=!1,this[r8]=!0,this.emit("resume"),this[t8].length)this[jU]();else if(this[XZ])this[YZ]();else this.emit("drain")}resume(){return this[PQ]()}pause(){this[r8]=!1,this[lG]=!0,this[u5]=!1}get destroyed(){return this[O8]}get flowing(){return this[r8]}get paused(){return this[lG]}[YP](Z){if(this[P6])this[e8]+=1;else this[e8]+=Z.length;this[t8].push(Z)}[OU](){if(this[P6])this[e8]-=1;else this[e8]-=this[t8][0].length;return this[t8].shift()}[jU](Z=!1){do;while(this[nd](this[OU]())&&this[t8].length);if(!Z&&!this[t8].length&&!this[XZ])this.emit("drain")}[nd](Z){return this.emit("data",Z),this[r8]}pipe(Z,J){if(this[O8])return Z;this[u5]=!1;let X=this[QJ];if(J=J||{},Z===pd.stdout||Z===pd.stderr)J.end=!1;else J.end=J.end!==!1;if(J.proxyErrors=!!J.proxyErrors,X){if(J.end)Z.end()}else if(this[u6].push(!J.proxyErrors?new zP(this,Z,J):new od(this,Z,J)),this[s4])iG(()=>this[PQ]());else this[PQ]();return Z}unpipe(Z){let J=this[u6].find((X)=>X.dest===Z);if(J){if(this[u6].length===1){if(this[r8]&&this[nX]===0)this[r8]=!1;this[u6]=[]}else this[u6].splice(this[u6].indexOf(J),1);J.unpipe()}}addListener(Z,J){return this.on(Z,J)}on(Z,J){let X=super.on(Z,J);if(Z==="data"){if(this[u5]=!1,this[nX]++,!this[u6].length&&!this[r8])this[PQ]()}else if(Z==="readable"&&this[e8]!==0)super.emit("readable");else if(YV1(Z)&&this[QJ])super.emit(Z),this.removeAllListeners(Z);else if(Z==="error"&&this[cG]){let Y=J;if(this[s4])iG(()=>Y.call(this,this[cG]));else Y.call(this,this[cG])}return X}removeListener(Z,J){return this.off(Z,J)}off(Z,J){let X=super.off(Z,J);if(Z==="data"){if(this[nX]=this.listeners("data").length,this[nX]===0&&!this[u5]&&!this[u6].length)this[r8]=!1}return X}removeAllListeners(Z){let J=super.removeAllListeners(Z);if(Z==="data"||Z===void 0){if(this[nX]=0,!this[u5]&&!this[u6].length)this[r8]=!1}return J}get emittedEnd(){return this[QJ]}[YZ](){if(!this[wU]&&!this[QJ]&&!this[O8]&&this[t8].length===0&&this[XZ]){if(this[wU]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[BU])this.emit("close");this[wU]=!1}}emit(Z,...J){let X=J[0];if(Z!=="error"&&Z!=="close"&&Z!==O8&&this[O8])return!1;else if(Z==="data")return!this[P6]&&!X?!1:this[s4]?(iG(()=>this[QP](X)),!0):this[QP](X);else if(Z==="end")return this[ad]();else if(Z==="close"){if(this[BU]=!0,!this[QJ]&&!this[O8])return!1;let $=super.emit("close");return this.removeAllListeners("close"),$}else if(Z==="error"){this[cG]=X,super.emit($P,X);let $=!this[pG]||this.listeners("error").length?super.emit("error",X):!1;return this[YZ](),$}else if(Z==="resume"){let $=super.emit("resume");return this[YZ](),$}else if(Z==="finish"||Z==="prefinish"){let $=super.emit(Z);return this.removeAllListeners(Z),$}let Y=super.emit(Z,...J);return this[YZ](),Y}[QP](Z){for(let X of this[u6])if(X.dest.write(Z)===!1)this.pause();let J=this[u5]?!1:super.emit("data",Z);return this[YZ](),J}[ad](){if(this[QJ])return!1;return this[QJ]=!0,this.readable=!1,this[s4]?(iG(()=>this[KP]()),!0):this[KP]()}[KP](){if(this[NQ]){let J=this[NQ].end();if(J){for(let X of this[u6])X.dest.write(J);if(!this[u5])super.emit("data",J)}}for(let J of this[u6])J.end();let Z=super.emit("end");return this.removeAllListeners("end"),Z}async collect(){let Z=Object.assign([],{dataLength:0});if(!this[P6])Z.dataLength=0;let J=this.promise();return this.on("data",(X)=>{if(Z.push(X),!this[P6])Z.dataLength+=X.length}),await J,Z}async concat(){if(this[P6])throw new Error("cannot concat in objectMode");let Z=await this.collect();return this[K4]?Z.join(""):Buffer.concat(Z,Z.dataLength)}async promise(){return new Promise((Z,J)=>{this.on(O8,()=>J(new Error("stream destroyed"))),this.on("error",(X)=>J(X)),this.on("end",()=>Z())})}[Symbol.asyncIterator](){this[u5]=!1;let Z=!1,J=async()=>{return this.pause(),Z=!0,{value:void 0,done:!0}};return{next:()=>{if(Z)return J();let Y=this.read();if(Y!==null)return Promise.resolve({done:!1,value:Y});if(this[XZ])return J();let $,Q,K=(V)=>{this.off("data",W),this.off("end",G),this.off(O8,z),J(),Q(V)},W=(V)=>{this.off("error",K),this.off("end",G),this.off(O8,z),this.pause(),$({value:V,done:!!this[XZ]})},G=()=>{this.off("error",K),this.off("data",W),this.off(O8,z),J(),$({done:!0,value:void 0})},z=()=>K(new Error("stream destroyed"));return new Promise((V,H)=>{Q=H,$=V,this.once(O8,z),this.once("error",K),this.once("end",G),this.once("data",W)})},throw:J,return:J,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[u5]=!1;let Z=!1,J=()=>{return this.pause(),this.off($P,J),this.off(O8,J),this.off("end",J),Z=!0,{done:!0,value:void 0}},X=()=>{if(Z)return J();let Y=this.read();return Y===null?J():{done:!1,value:Y}};return this.once("end",J),this.once($P,J),this.once(O8,J),{next:X,throw:J,return:J,[Symbol.iterator](){return this}}}destroy(Z){if(this[O8]){if(Z)this.emit("error",Z);else this.emit(O8);return this}this[O8]=!0,this[u5]=!0,this[t8].length=0,this[e8]=0;let J=this;if(typeof J.close==="function"&&!this[BU])J.close();if(Z)this.emit("error",Z);else this.emit(O8);return this}static get isStream(){return ez1}}var wV1=UV1.native,aG={lstatSync:VV1,readdir:HV1,readdirSync:qV1,readlinkSync:FV1,realpathSync:wV1,promises:{lstat:BV1,readdir:jV1,readlink:OV1,realpath:MV1}},Jc=(Z)=>!Z||Z===aG||Z===LV1?aG:{...aG,...Z,promises:{...aG.promises,...Z.promises||{}}},Xc=/^\\\\\?\\([a-z]:)\\?$/i,RV1=(Z)=>Z.replace(/\//g,"\\").replace(Xc,"$1\\"),NV1=/[\\\/]/,B9=0,Yc=1,$c=2,o4=4,Qc=6,Kc=8,sX=10,Wc=12,w9=15,nG=~w9,VP=16,rd=32,sG=64,W4=128,RU=256,PU=512,td=sG|W4|PU,PV1=1023,HP=(Z)=>Z.isFile()?Kc:Z.isDirectory()?o4:Z.isSymbolicLink()?sX:Z.isCharacterDevice()?$c:Z.isBlockDevice()?Qc:Z.isSocket()?Wc:Z.isFIFO()?Yc:B9,ed=new Map,oG=(Z)=>{let J=ed.get(Z);if(J)return J;let X=Z.normalize("NFKD");return ed.set(Z,X),X},Zc=new Map,NU=(Z)=>{let J=Zc.get(Z);if(J)return J;let X=oG(Z.toLowerCase());return Zc.set(Z,X),X};class FP extends dG{constructor(){super({max:256})}}class Gc extends dG{constructor(Z=16384){super({maxSize:Z,sizeCalculation:(J)=>J.length+1})}}var zc=Symbol("PathScurry setAsCwd");class d6{name;root;roots;parent;nocase;isCWD=!1;#Z;#J;get dev(){return this.#J}#Y;get mode(){return this.#Y}#X;get nlink(){return this.#X}#$;get uid(){return this.#$}#V;get gid(){return this.#V}#q;get rdev(){return this.#q}#W;get blksize(){return this.#W}#G;get ino(){return this.#G}#z;get size(){return this.#z}#H;get blocks(){return this.#H}#Q;get atimeMs(){return this.#Q}#U;get mtimeMs(){return this.#U}#w;get ctimeMs(){return this.#w}#L;get birthtimeMs(){return this.#L}#j;get atime(){return this.#j}#k;get mtime(){return this.#k}#O;get ctime(){return this.#O}#E;get birthtime(){return this.#E}#N;#R;#M;#C;#B;#v;#K;#A;#P;#S;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Z,J=B9,X,Y,$,Q,K){if(this.name=Z,this.#N=$?NU(Z):oG(Z),this.#K=J&PV1,this.nocase=$,this.roots=Y,this.root=X||this,this.#A=Q,this.#M=K.fullpath,this.#B=K.relative,this.#v=K.relativePosix,this.parent=K.parent,this.parent)this.#Z=this.parent.#Z;else this.#Z=Jc(K.fs)}depth(){if(this.#R!==void 0)return this.#R;if(!this.parent)return this.#R=0;return this.#R=this.parent.depth()+1}childrenCache(){return this.#A}resolve(Z){if(!Z)return this;let J=this.getRootString(Z),Y=Z.substring(J.length).split(this.splitSep);return J?this.getRoot(J).#D(Y):this.#D(Y)}#D(Z){let J=this;for(let X of Z)J=J.child(X);return J}children(){let Z=this.#A.get(this);if(Z)return Z;let J=Object.assign([],{provisional:0});return this.#A.set(this,J),this.#K&=~VP,J}child(Z,J){if(Z===""||Z===".")return this;if(Z==="..")return this.parent||this;let X=this.children(),Y=this.nocase?NU(Z):oG(Z);for(let W of X)if(W.#N===Y)return W;let $=this.parent?this.sep:"",Q=this.#M?this.#M+$+Z:void 0,K=this.newChild(Z,B9,{...J,parent:this,fullpath:Q});if(!this.canReaddir())K.#K|=W4;return X.push(K),K}relative(){if(this.isCWD)return"";if(this.#B!==void 0)return this.#B;let Z=this.name,J=this.parent;if(!J)return this.#B=this.name;let X=J.relative();return X+(!X||!J.parent?"":this.sep)+Z}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#v!==void 0)return this.#v;let Z=this.name,J=this.parent;if(!J)return this.#v=this.fullpathPosix();let X=J.relativePosix();return X+(!X||!J.parent?"":"/")+Z}fullpath(){if(this.#M!==void 0)return this.#M;let Z=this.name,J=this.parent;if(!J)return this.#M=this.name;let Y=J.fullpath()+(!J.parent?"":this.sep)+Z;return this.#M=Y}fullpathPosix(){if(this.#C!==void 0)return this.#C;if(this.sep==="/")return this.#C=this.fullpath();if(!this.parent){let Y=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(Y))return this.#C=`//?/${Y}`;else return this.#C=Y}let Z=this.parent,J=Z.fullpathPosix(),X=J+(!J||!Z.parent?"":"/")+this.name;return this.#C=X}isUnknown(){return(this.#K&w9)===B9}isType(Z){return this[`is${Z}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#K&w9)===Kc}isDirectory(){return(this.#K&w9)===o4}isCharacterDevice(){return(this.#K&w9)===$c}isBlockDevice(){return(this.#K&w9)===Qc}isFIFO(){return(this.#K&w9)===Yc}isSocket(){return(this.#K&w9)===Wc}isSymbolicLink(){return(this.#K&sX)===sX}lstatCached(){return this.#K&rd?this:void 0}readlinkCached(){return this.#P}realpathCached(){return this.#S}readdirCached(){let Z=this.children();return Z.slice(0,Z.provisional)}canReadlink(){if(this.#P)return!0;if(!this.parent)return!1;let Z=this.#K&w9;return!(Z!==B9&&Z!==sX||this.#K&RU||this.#K&W4)}calledReaddir(){return!!(this.#K&VP)}isENOENT(){return!!(this.#K&W4)}isNamed(Z){return!this.nocase?this.#N===oG(Z):this.#N===NU(Z)}async readlink(){let Z=this.#P;if(Z)return Z;if(!this.canReadlink())return;if(!this.parent)return;try{let J=await this.#Z.promises.readlink(this.fullpath()),X=(await this.parent.realpath())?.resolve(J);if(X)return this.#P=X}catch(J){this.#b(J.code);return}}readlinkSync(){let Z=this.#P;if(Z)return Z;if(!this.canReadlink())return;if(!this.parent)return;try{let J=this.#Z.readlinkSync(this.fullpath()),X=this.parent.realpathSync()?.resolve(J);if(X)return this.#P=X}catch(J){this.#b(J.code);return}}#m(Z){this.#K|=VP;for(let J=Z.provisional;J<Z.length;J++){let X=Z[J];if(X)X.#x()}}#x(){if(this.#K&W4)return;this.#K=(this.#K|W4)&nG,this.#f()}#f(){let Z=this.children();Z.provisional=0;for(let J of Z)J.#x()}#u(){this.#K|=PU,this.#T()}#T(){if(this.#K&sG)return;let Z=this.#K;if((Z&w9)===o4)Z&=nG;this.#K=Z|sG,this.#f()}#I(Z=""){if(Z==="ENOTDIR"||Z==="EPERM")this.#T();else if(Z==="ENOENT")this.#x();else this.children().provisional=0}#d(Z=""){if(Z==="ENOTDIR")this.parent.#T();else if(Z==="ENOENT")this.#x()}#b(Z=""){let J=this.#K;if(J|=RU,Z==="ENOENT")J|=W4;if(Z==="EINVAL"||Z==="UNKNOWN")J&=nG;if(this.#K=J,Z==="ENOTDIR"&&this.parent)this.parent.#T()}#h(Z,J){return this.#c(Z,J)||this.#F(Z,J)}#F(Z,J){let X=HP(Z),Y=this.newChild(Z.name,X,{parent:this}),$=Y.#K&w9;if($!==o4&&$!==sX&&$!==B9)Y.#K|=sG;return J.unshift(Y),J.provisional++,Y}#c(Z,J){for(let X=J.provisional;X<J.length;X++){let Y=J[X];if((this.nocase?NU(Z.name):oG(Z.name))!==Y.#N)continue;return this.#y(Z,Y,X,J)}}#y(Z,J,X,Y){let $=J.name;if(J.#K=J.#K&nG|HP(Z),$!==Z.name)J.name=Z.name;if(X!==Y.provisional){if(X===Y.length-1)Y.pop();else Y.splice(X,1);Y.unshift(J)}return Y.provisional++,J}async lstat(){if((this.#K&W4)===0)try{return this.#_(await this.#Z.promises.lstat(this.fullpath())),this}catch(Z){this.#d(Z.code)}}lstatSync(){if((this.#K&W4)===0)try{return this.#_(this.#Z.lstatSync(this.fullpath())),this}catch(Z){this.#d(Z.code)}}#_(Z){let{atime:J,atimeMs:X,birthtime:Y,birthtimeMs:$,blksize:Q,blocks:K,ctime:W,ctimeMs:G,dev:z,gid:V,ino:H,mode:q,mtime:F,mtimeMs:U,nlink:w,rdev:L,size:j,uid:R}=Z;this.#j=J,this.#Q=X,this.#E=Y,this.#L=$,this.#W=Q,this.#H=K,this.#O=W,this.#w=G,this.#J=z,this.#V=V,this.#G=H,this.#Y=q,this.#k=F,this.#U=U,this.#X=w,this.#q=L,this.#z=j,this.#$=R;let O=HP(Z);if(this.#K=this.#K&nG|O|rd,O!==B9&&O!==o4&&O!==sX)this.#K|=sG}#g=[];#p=!1;#i(Z){this.#p=!1;let J=this.#g.slice();this.#g.length=0,J.forEach((X)=>X(null,Z))}readdirCB(Z,J=!1){if(!this.canReaddir()){if(J)Z(null,[]);else queueMicrotask(()=>Z(null,[]));return}let X=this.children();if(this.calledReaddir()){let $=X.slice(0,X.provisional);if(J)Z(null,$);else queueMicrotask(()=>Z(null,$));return}if(this.#g.push(Z),this.#p)return;this.#p=!0;let Y=this.fullpath();this.#Z.readdir(Y,{withFileTypes:!0},($,Q)=>{if($)this.#I($.code),X.provisional=0;else{for(let K of Q)this.#h(K,X);this.#m(X)}this.#i(X.slice(0,X.provisional));return})}#l;async readdir(){if(!this.canReaddir())return[];let Z=this.children();if(this.calledReaddir())return Z.slice(0,Z.provisional);let J=this.fullpath();if(this.#l)await this.#l;else{let X=()=>{};this.#l=new Promise((Y)=>X=Y);try{for(let Y of await this.#Z.promises.readdir(J,{withFileTypes:!0}))this.#h(Y,Z);this.#m(Z)}catch(Y){this.#I(Y.code),Z.provisional=0}this.#l=void 0,X()}return Z.slice(0,Z.provisional)}readdirSync(){if(!this.canReaddir())return[];let Z=this.children();if(this.calledReaddir())return Z.slice(0,Z.provisional);let J=this.fullpath();try{for(let X of this.#Z.readdirSync(J,{withFileTypes:!0}))this.#h(X,Z);this.#m(Z)}catch(X){this.#I(X.code),Z.provisional=0}return Z.slice(0,Z.provisional)}canReaddir(){if(this.#K&td)return!1;let Z=w9&this.#K;if(!(Z===B9||Z===o4||Z===sX))return!1;return!0}shouldWalk(Z,J){return(this.#K&o4)===o4&&!(this.#K&td)&&!Z.has(this)&&(!J||J(this))}async realpath(){if(this.#S)return this.#S;if((PU|RU|W4)&this.#K)return;try{let Z=await this.#Z.promises.realpath(this.fullpath());return this.#S=this.resolve(Z)}catch(Z){this.#u()}}realpathSync(){if(this.#S)return this.#S;if((PU|RU|W4)&this.#K)return;try{let Z=this.#Z.realpathSync(this.fullpath());return this.#S=this.resolve(Z)}catch(Z){this.#u()}}[zc](Z){if(Z===this)return;Z.isCWD=!1,this.isCWD=!0;let J=new Set([]),X=[],Y=this;while(Y&&Y.parent)J.add(Y),Y.#B=X.join(this.sep),Y.#v=X.join("/"),Y=Y.parent,X.push("..");Y=Z;while(Y&&Y.parent&&!J.has(Y))Y.#B=void 0,Y.#v=void 0,Y=Y.parent}}class DU extends d6{sep="\\";splitSep=NV1;constructor(Z,J=B9,X,Y,$,Q,K){super(Z,J,X,Y,$,Q,K)}newChild(Z,J=B9,X={}){return new DU(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),X)}getRootString(Z){return qP.parse(Z).root}getRoot(Z){if(Z=RV1(Z.toUpperCase()),Z===this.root.name)return this.root;for(let[J,X]of Object.entries(this.roots))if(this.sameRoot(Z,J))return this.roots[Z]=X;return this.roots[Z]=new rG(Z,this).root}sameRoot(Z,J=this.root.name){return Z=Z.toUpperCase().replace(/\//g,"\\").replace(Xc,"$1\\"),Z===J}}class CU extends d6{splitSep="/";sep="/";constructor(Z,J=B9,X,Y,$,Q,K){super(Z,J,X,Y,$,Q,K)}getRootString(Z){return Z.startsWith("/")?"/":""}getRoot(Z){return this.root}newChild(Z,J=B9,X={}){return new CU(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),X)}}class UP{root;rootPath;roots;cwd;#Z;#J;#Y;nocase;#X;constructor(Z=process.cwd(),J,X,{nocase:Y,childrenCacheSize:$=16384,fs:Q=aG}={}){if(this.#X=Jc(Q),Z instanceof URL||Z.startsWith("file://"))Z=zV1(Z);let K=J.resolve(Z);this.roots=Object.create(null),this.rootPath=this.parseRootPath(K),this.#Z=new FP,this.#J=new FP,this.#Y=new Gc($);let W=K.substring(this.rootPath.length).split(X);if(W.length===1&&!W[0])W.pop();if(Y===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=Y,this.root=this.newRoot(this.#X),this.roots[this.rootPath]=this.root;let G=this.root,z=W.length-1,V=J.sep,H=this.rootPath,q=!1;for(let F of W){let U=z--;G=G.child(F,{relative:new Array(U).fill("..").join(V),relativePosix:new Array(U).fill("..").join("/"),fullpath:H+=(q?"":V)+F}),q=!0}this.cwd=G}depth(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.depth()}childrenCache(){return this.#Y}resolve(...Z){let J="";for(let $=Z.length-1;$>=0;$--){let Q=Z[$];if(!Q||Q===".")continue;if(J=J?`${Q}/${J}`:Q,this.isAbsolute(Q))break}let X=this.#Z.get(J);if(X!==void 0)return X;let Y=this.cwd.resolve(J).fullpath();return this.#Z.set(J,Y),Y}resolvePosix(...Z){let J="";for(let $=Z.length-1;$>=0;$--){let Q=Z[$];if(!Q||Q===".")continue;if(J=J?`${Q}/${J}`:Q,this.isAbsolute(Q))break}let X=this.#J.get(J);if(X!==void 0)return X;let Y=this.cwd.resolve(J).fullpathPosix();return this.#J.set(J,Y),Y}relative(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.relative()}relativePosix(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.relativePosix()}basename(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.name}dirname(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return(Z.parent||Z).fullpath()}async readdir(Z=this.cwd,J={withFileTypes:!0}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;let{withFileTypes:X}=J;if(!Z.canReaddir())return[];else{let Y=await Z.readdir();return X?Y:Y.map(($)=>$.name)}}readdirSync(Z=this.cwd,J={withFileTypes:!0}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;let{withFileTypes:X=!0}=J;if(!Z.canReaddir())return[];else if(X)return Z.readdirSync();else return Z.readdirSync().map((Y)=>Y.name)}async lstat(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.lstat()}lstatSync(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.lstatSync()}async readlink(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z.withFileTypes,Z=this.cwd;let X=await Z.readlink();return J?X:X?.fullpath()}readlinkSync(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z.withFileTypes,Z=this.cwd;let X=Z.readlinkSync();return J?X:X?.fullpath()}async realpath(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z.withFileTypes,Z=this.cwd;let X=await Z.realpath();return J?X:X?.fullpath()}realpathSync(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z.withFileTypes,Z=this.cwd;let X=Z.realpathSync();return J?X:X?.fullpath()}async walk(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,K=[];if(!$||$(Z))K.push(X?Z:Z.fullpath());let W=new Set,G=(V,H)=>{W.add(V),V.readdirCB((q,F)=>{if(q)return H(q);let U=F.length;if(!U)return H();let w=()=>{if(--U===0)H()};for(let L of F){if(!$||$(L))K.push(X?L:L.fullpath());if(Y&&L.isSymbolicLink())L.realpath().then((j)=>j?.isUnknown()?j.lstat():j).then((j)=>j?.shouldWalk(W,Q)?G(j,w):w());else if(L.shouldWalk(W,Q))G(L,w);else w()}},!0)},z=Z;return new Promise((V,H)=>{G(z,(q)=>{if(q)return H(q);V(K)})})}walkSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,K=[];if(!$||$(Z))K.push(X?Z:Z.fullpath());let W=new Set([Z]);for(let G of W){let z=G.readdirSync();for(let V of z){if(!$||$(V))K.push(X?V:V.fullpath());let H=V;if(V.isSymbolicLink()){if(!(Y&&(H=V.realpathSync())))continue;if(H.isUnknown())H.lstatSync()}if(H.shouldWalk(W,Q))W.add(H)}}return K}[Symbol.asyncIterator](){return this.iterate()}iterate(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;return this.stream(Z,J)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J;if(!$||$(Z))yield X?Z:Z.fullpath();let K=new Set([Z]);for(let W of K){let G=W.readdirSync();for(let z of G){if(!$||$(z))yield X?z:z.fullpath();let V=z;if(z.isSymbolicLink()){if(!(Y&&(V=z.realpathSync())))continue;if(V.isUnknown())V.lstatSync()}if(V.shouldWalk(K,Q))K.add(V)}}}stream(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,K=new aX({objectMode:!0});if(!$||$(Z))K.write(X?Z:Z.fullpath());let W=new Set,G=[Z],z=0,V=()=>{let H=!1;while(!H){let q=G.shift();if(!q){if(z===0)K.end();return}z++,W.add(q);let F=(w,L,j=!1)=>{if(w)return K.emit("error",w);if(Y&&!j){let R=[];for(let O of L)if(O.isSymbolicLink())R.push(O.realpath().then((N)=>N?.isUnknown()?N.lstat():N));if(R.length){Promise.all(R).then(()=>F(null,L,!0));return}}for(let R of L)if(R&&(!$||$(R))){if(!K.write(X?R:R.fullpath()))H=!0}z--;for(let R of L){let O=R.realpathCached()||R;if(O.shouldWalk(W,Q))G.push(O)}if(H&&!K.flowing)K.once("drain",V);else if(!U)V()},U=!0;q.readdirCB(F,!0),U=!1}};return V(),K}streamSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,K=new aX({objectMode:!0}),W=new Set;if(!$||$(Z))K.write(X?Z:Z.fullpath());let G=[Z],z=0,V=()=>{let H=!1;while(!H){let q=G.shift();if(!q){if(z===0)K.end();return}z++,W.add(q);let F=q.readdirSync();for(let U of F)if(!$||$(U)){if(!K.write(X?U:U.fullpath()))H=!0}z--;for(let U of F){let w=U;if(U.isSymbolicLink()){if(!(Y&&(w=U.realpathSync())))continue;if(w.isUnknown())w.lstatSync()}if(w.shouldWalk(W,Q))G.push(w)}}if(H&&!K.flowing)K.once("drain",V)};return V(),K}chdir(Z=this.cwd){let J=this.cwd;this.cwd=typeof Z==="string"?this.cwd.resolve(Z):Z,this.cwd[zc](J)}}class rG extends UP{sep="\\";constructor(Z=process.cwd(),J={}){let{nocase:X=!0}=J;super(Z,qP,"\\",{...J,nocase:X});this.nocase=X;for(let Y=this.cwd;Y;Y=Y.parent)Y.nocase=this.nocase}parseRootPath(Z){return qP.parse(Z).root.toUpperCase()}newRoot(Z){return new DU(this.rootPath,o4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")||Z.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Z)}}class tG extends UP{sep="/";constructor(Z=process.cwd(),J={}){let{nocase:X=!1}=J;super(Z,GV1,"/",{...J,nocase:X});this.nocase=X}parseRootPath(Z){return"/"}newRoot(Z){return new CU(this.rootPath,o4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")}}class TU extends tG{constructor(Z=process.cwd(),J={}){let{nocase:X=!0}=J;super(Z,{...J,nocase:X})}}var $36=process.platform==="win32"?DU:CU,Vc=process.platform==="win32"?rG:process.platform==="darwin"?TU:tG;var DV1=(Z)=>Z.length>=1,CV1=(Z)=>Z.length>=1;class DQ{#Z;#J;#Y;length;#X;#$;#V;#q;#W;#G;#z=!0;constructor(Z,J,X,Y){if(!DV1(Z))throw new TypeError("empty pattern list");if(!CV1(J))throw new TypeError("empty glob list");if(J.length!==Z.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=Z.length,X<0||X>=this.length)throw new TypeError("index out of range");if(this.#Z=Z,this.#J=J,this.#Y=X,this.#X=Y,this.#Y===0){if(this.isUNC()){let[$,Q,K,W,...G]=this.#Z,[z,V,H,q,...F]=this.#J;if(G[0]==="")G.shift(),F.shift();let U=[$,Q,K,W,""].join("/"),w=[z,V,H,q,""].join("/");this.#Z=[U,...G],this.#J=[w,...F],this.length=this.#Z.length}else if(this.isDrive()||this.isAbsolute()){let[$,...Q]=this.#Z,[K,...W]=this.#J;if(Q[0]==="")Q.shift(),W.shift();let G=$+"/",z=K+"/";this.#Z=[G,...Q],this.#J=[z,...W],this.length=this.#Z.length}}}pattern(){return this.#Z[this.#Y]}isString(){return typeof this.#Z[this.#Y]==="string"}isGlobstar(){return this.#Z[this.#Y]===L6}isRegExp(){return this.#Z[this.#Y]instanceof RegExp}globString(){return this.#V=this.#V||(this.#Y===0?this.isAbsolute()?this.#J[0]+this.#J.slice(1).join("/"):this.#J.join("/"):this.#J.slice(this.#Y).join("/"))}hasMore(){return this.length>this.#Y+1}rest(){if(this.#$!==void 0)return this.#$;if(!this.hasMore())return this.#$=null;return this.#$=new DQ(this.#Z,this.#J,this.#Y+1,this.#X),this.#$.#G=this.#G,this.#$.#W=this.#W,this.#$.#q=this.#q,this.#$}isUNC(){let Z=this.#Z;return this.#W!==void 0?this.#W:this.#W=this.#X==="win32"&&this.#Y===0&&Z[0]===""&&Z[1]===""&&typeof Z[2]==="string"&&!!Z[2]&&typeof Z[3]==="string"&&!!Z[3]}isDrive(){let Z=this.#Z;return this.#q!==void 0?this.#q:this.#q=this.#X==="win32"&&this.#Y===0&&this.length>1&&typeof Z[0]==="string"&&/^[a-z]:$/i.test(Z[0])}isAbsolute(){let Z=this.#Z;return this.#G!==void 0?this.#G:this.#G=Z[0]===""&&Z.length>1||this.isDrive()||this.isUNC()}root(){let Z=this.#Z[0];return typeof Z==="string"&&this.isAbsolute()&&this.#Y===0?Z:""}checkFollowGlobstar(){return!(this.#Y===0||!this.isGlobstar()||!this.#z)}markFollowGlobstar(){if(this.#Y===0||!this.isGlobstar()||!this.#z)return!1;return this.#z=!1,!0}}var TV1=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class eG{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Z,{nobrace:J,nocase:X,noext:Y,noglobstar:$,platform:Q=TV1}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=Q,this.mmopts={dot:!0,nobrace:J,nocase:X,noext:Y,noglobstar:$,optimizationLevel:2,platform:Q,nocomment:!0,nonegate:!0};for(let K of Z)this.add(K)}add(Z){let J=new L9(Z,this.mmopts);for(let X=0;X<J.set.length;X++){let Y=J.set[X],$=J.globParts[X];if(!Y||!$)throw new Error("invalid pattern object");while(Y[0]==="."&&$[0]===".")Y.shift(),$.shift();let Q=new DQ(Y,$,0,this.platform),K=new L9(Q.globString(),this.mmopts),W=$[$.length-1]==="**",G=Q.isAbsolute();if(G)this.absolute.push(K);else this.relative.push(K);if(W)if(G)this.absoluteChildren.push(K);else this.relativeChildren.push(K)}}ignored(Z){let J=Z.fullpath(),X=`${J}/`,Y=Z.relative()||".",$=`${Y}/`;for(let Q of this.relative)if(Q.match(Y)||Q.match($))return!0;for(let Q of this.absolute)if(Q.match(J)||Q.match(X))return!0;return!1}childrenIgnored(Z){let J=Z.fullpath()+"/",X=(Z.relative()||".")+"/";for(let Y of this.relativeChildren)if(Y.match(X))return!0;for(let Y of this.absoluteChildren)if(Y.match(J))return!0;return!1}}class LP{store;constructor(Z=new Map){this.store=Z}copy(){return new LP(new Map(this.store))}hasWalked(Z,J){return this.store.get(Z.fullpath())?.has(J.globString())}storeWalked(Z,J){let X=Z.fullpath(),Y=this.store.get(X);if(Y)Y.add(J.globString());else this.store.set(X,new Set([J.globString()]))}}class Hc{store=new Map;add(Z,J,X){let Y=(J?2:0)|(X?1:0),$=this.store.get(Z);this.store.set(Z,$===void 0?Y:Y&$)}entries(){return[...this.store.entries()].map(([Z,J])=>[Z,!!(J&2),!!(J&1)])}}class qc{store=new Map;add(Z,J){if(!Z.canReaddir())return;let X=this.store.get(Z);if(X){if(!X.find((Y)=>Y.globString()===J.globString()))X.push(J)}else this.store.set(Z,[J])}get(Z){let J=this.store.get(Z);if(!J)throw new Error("attempting to walk unknown path");return J}entries(){return this.keys().map((Z)=>[Z,this.store.get(Z)])}keys(){return[...this.store.keys()].filter((Z)=>Z.canReaddir())}}class Z3{hasWalkedCache;matches=new Hc;subwalks=new qc;patterns;follow;dot;opts;constructor(Z,J){this.opts=Z,this.follow=!!Z.follow,this.dot=!!Z.dot,this.hasWalkedCache=J?J.copy():new LP}processPatterns(Z,J){this.patterns=J;let X=J.map((Y)=>[Z,Y]);for(let[Y,$]of X){this.hasWalkedCache.storeWalked(Y,$);let Q=$.root(),K=$.isAbsolute()&&this.opts.absolute!==!1;if(Q){Y=Y.resolve(Q==="/"&&this.opts.root!==void 0?this.opts.root:Q);let V=$.rest();if(!V){this.matches.add(Y,!0,!1);continue}else $=V}if(Y.isENOENT())continue;let W,G,z=!1;while(typeof(W=$.pattern())==="string"&&(G=$.rest()))Y=Y.resolve(W),$=G,z=!0;if(W=$.pattern(),G=$.rest(),z){if(this.hasWalkedCache.hasWalked(Y,$))continue;this.hasWalkedCache.storeWalked(Y,$)}if(typeof W==="string"){let V=W===".."||W===""||W===".";this.matches.add(Y.resolve(W),K,V);continue}else if(W===L6){if(!Y.isSymbolicLink()||this.follow||$.checkFollowGlobstar())this.subwalks.add(Y,$);let V=G?.pattern(),H=G?.rest();if(!G||(V===""||V===".")&&!H)this.matches.add(Y,K,V===""||V===".");else if(V===".."){let q=Y.parent||Y;if(!H)this.matches.add(q,K,!0);else if(!this.hasWalkedCache.hasWalked(q,H))this.subwalks.add(q,H)}}else if(W instanceof RegExp)this.subwalks.add(Y,$)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new Z3(this.opts,this.hasWalkedCache)}filterEntries(Z,J){let X=this.subwalks.get(Z),Y=this.child();for(let $ of J)for(let Q of X){let K=Q.isAbsolute(),W=Q.pattern(),G=Q.rest();if(W===L6)Y.testGlobstar($,Q,G,K);else if(W instanceof RegExp)Y.testRegExp($,W,G,K);else Y.testString($,W,G,K)}return Y}testGlobstar(Z,J,X,Y){if(this.dot||!Z.name.startsWith(".")){if(!J.hasMore())this.matches.add(Z,Y,!1);if(Z.canReaddir()){if(this.follow||!Z.isSymbolicLink())this.subwalks.add(Z,J);else if(Z.isSymbolicLink()){if(X&&J.checkFollowGlobstar())this.subwalks.add(Z,X);else if(J.markFollowGlobstar())this.subwalks.add(Z,J)}}}if(X){let $=X.pattern();if(typeof $==="string"&&$!==".."&&$!==""&&$!==".")this.testString(Z,$,X.rest(),Y);else if($===".."){let Q=Z.parent||Z;this.subwalks.add(Q,X)}else if($ instanceof RegExp)this.testRegExp(Z,$,X.rest(),Y)}}testRegExp(Z,J,X,Y){if(!J.test(Z.name))return;if(!X)this.matches.add(Z,Y,!1);else this.subwalks.add(Z,X)}testString(Z,J,X,Y){if(!Z.isNamed(J))return;if(!X)this.matches.add(Z,Y,!1);else this.subwalks.add(Z,X)}}var kV1=(Z,J)=>typeof Z==="string"?new eG([Z],J):Array.isArray(Z)?new eG(Z,J):Z;class wP{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#Z=[];#J;#Y;signal;maxDepth;includeChildMatches;constructor(Z,J,X){if(this.patterns=Z,this.path=J,this.opts=X,this.#Y=!X.posix&&X.platform==="win32"?"\\":"/",this.includeChildMatches=X.includeChildMatches!==!1,X.ignore||!this.includeChildMatches){if(this.#J=kV1(X.ignore??[],X),!this.includeChildMatches&&typeof this.#J.add!=="function")throw new Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=X.maxDepth||1/0,X.signal)this.signal=X.signal,this.signal.addEventListener("abort",()=>{this.#Z.length=0})}#X(Z){return this.seen.has(Z)||!!this.#J?.ignored?.(Z)}#$(Z){return!!this.#J?.childrenIgnored?.(Z)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let Z=void 0;while(!this.paused&&(Z=this.#Z.shift()))Z()}onResume(Z){if(this.signal?.aborted)return;if(!this.paused)Z();else this.#Z.push(Z)}async matchCheck(Z,J){if(J&&this.opts.nodir)return;let X;if(this.opts.realpath){if(X=Z.realpathCached()||await Z.realpath(),!X)return;Z=X}let $=Z.isUnknown()||this.opts.stat?await Z.lstat():Z;if(this.opts.follow&&this.opts.nodir&&$?.isSymbolicLink()){let Q=await $.realpath();if(Q&&(Q.isUnknown()||this.opts.stat))await Q.lstat()}return this.matchCheckTest($,J)}matchCheckTest(Z,J){return Z&&(this.maxDepth===1/0||Z.depth()<=this.maxDepth)&&(!J||Z.canReaddir())&&(!this.opts.nodir||!Z.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!Z.isSymbolicLink()||!Z.realpathCached()?.isDirectory())&&!this.#X(Z)?Z:void 0}matchCheckSync(Z,J){if(J&&this.opts.nodir)return;let X;if(this.opts.realpath){if(X=Z.realpathCached()||Z.realpathSync(),!X)return;Z=X}let $=Z.isUnknown()||this.opts.stat?Z.lstatSync():Z;if(this.opts.follow&&this.opts.nodir&&$?.isSymbolicLink()){let Q=$.realpathSync();if(Q&&(Q?.isUnknown()||this.opts.stat))Q.lstatSync()}return this.matchCheckTest($,J)}matchFinish(Z,J){if(this.#X(Z))return;if(!this.includeChildMatches&&this.#J?.add){let $=`${Z.relativePosix()}/**`;this.#J.add($)}let X=this.opts.absolute===void 0?J:this.opts.absolute;this.seen.add(Z);let Y=this.opts.mark&&Z.isDirectory()?this.#Y:"";if(this.opts.withFileTypes)this.matchEmit(Z);else if(X){let $=this.opts.posix?Z.fullpathPosix():Z.fullpath();this.matchEmit($+Y)}else{let $=this.opts.posix?Z.relativePosix():Z.relative(),Q=this.opts.dotRelative&&!$.startsWith(".."+this.#Y)?"."+this.#Y:"";this.matchEmit(!$?"."+Y:Q+$+Y)}}async match(Z,J,X){let Y=await this.matchCheck(Z,X);if(Y)this.matchFinish(Y,J)}matchSync(Z,J,X){let Y=this.matchCheckSync(Z,X);if(Y)this.matchFinish(Y,J)}walkCB(Z,J,X){if(this.signal?.aborted)X();this.walkCB2(Z,J,new Z3(this.opts),X)}walkCB2(Z,J,X,Y){if(this.#$(Z))return Y();if(this.signal?.aborted)Y();if(this.paused){this.onResume(()=>this.walkCB2(Z,J,X,Y));return}X.processPatterns(Z,J);let $=1,Q=()=>{if(--$===0)Y()};for(let[K,W,G]of X.matches.entries()){if(this.#X(K))continue;$++,this.match(K,W,G).then(()=>Q())}for(let K of X.subwalkTargets()){if(this.maxDepth!==1/0&&K.depth()>=this.maxDepth)continue;$++;let W=K.readdirCached();if(K.calledReaddir())this.walkCB3(K,W,X,Q);else K.readdirCB((G,z)=>this.walkCB3(K,z,X,Q),!0)}Q()}walkCB3(Z,J,X,Y){X=X.filterEntries(Z,J);let $=1,Q=()=>{if(--$===0)Y()};for(let[K,W,G]of X.matches.entries()){if(this.#X(K))continue;$++,this.match(K,W,G).then(()=>Q())}for(let[K,W]of X.subwalks.entries())$++,this.walkCB2(K,W,X.child(),Q);Q()}walkCBSync(Z,J,X){if(this.signal?.aborted)X();this.walkCB2Sync(Z,J,new Z3(this.opts),X)}walkCB2Sync(Z,J,X,Y){if(this.#$(Z))return Y();if(this.signal?.aborted)Y();if(this.paused){this.onResume(()=>this.walkCB2Sync(Z,J,X,Y));return}X.processPatterns(Z,J);let $=1,Q=()=>{if(--$===0)Y()};for(let[K,W,G]of X.matches.entries()){if(this.#X(K))continue;this.matchSync(K,W,G)}for(let K of X.subwalkTargets()){if(this.maxDepth!==1/0&&K.depth()>=this.maxDepth)continue;$++;let W=K.readdirSync();this.walkCB3Sync(K,W,X,Q)}Q()}walkCB3Sync(Z,J,X,Y){X=X.filterEntries(Z,J);let $=1,Q=()=>{if(--$===0)Y()};for(let[K,W,G]of X.matches.entries()){if(this.#X(K))continue;this.matchSync(K,W,G)}for(let[K,W]of X.subwalks.entries())$++,this.walkCB2Sync(K,W,X.child(),Q);Q()}}class kU extends wP{matches=new Set;constructor(Z,J,X){super(Z,J,X)}matchEmit(Z){this.matches.add(Z)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((Z,J)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)J(this.signal.reason);else Z(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class EU extends wP{results;constructor(Z,J,X){super(Z,J,X);this.results=new aX({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(Z){if(this.results.write(Z),!this.results.flowing)this.pause()}stream(){let Z=this.path;if(Z.isUnknown())Z.lstat().then(()=>{this.walkCB(Z,this.patterns,()=>this.results.end())});else this.walkCB(Z,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var IV1=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class r4{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(Z,J){if(!J)throw new TypeError("glob options required");if(this.withFileTypes=!!J.withFileTypes,this.signal=J.signal,this.follow=!!J.follow,this.dot=!!J.dot,this.dotRelative=!!J.dotRelative,this.nodir=!!J.nodir,this.mark=!!J.mark,!J.cwd)this.cwd="";else if(J.cwd instanceof URL||J.cwd.startsWith("file://"))J.cwd=EV1(J.cwd);if(this.cwd=J.cwd||"",this.root=J.root,this.magicalBraces=!!J.magicalBraces,this.nobrace=!!J.nobrace,this.noext=!!J.noext,this.realpath=!!J.realpath,this.absolute=J.absolute,this.includeChildMatches=J.includeChildMatches!==!1,this.noglobstar=!!J.noglobstar,this.matchBase=!!J.matchBase,this.maxDepth=typeof J.maxDepth==="number"?J.maxDepth:1/0,this.stat=!!J.stat,this.ignore=J.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof Z==="string")Z=[Z];if(this.windowsPathsNoEscape=!!J.windowsPathsNoEscape||J.allowWindowsEscape===!1,this.windowsPathsNoEscape)Z=Z.map((W)=>W.replace(/\\/g,"/"));if(this.matchBase){if(J.noglobstar)throw new TypeError("base matching requires globstar");Z=Z.map((W)=>W.includes("/")?W:`./**/${W}`)}if(this.pattern=Z,this.platform=J.platform||IV1,this.opts={...J,platform:this.platform},J.scurry){if(this.scurry=J.scurry,J.nocase!==void 0&&J.nocase!==J.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let W=J.platform==="win32"?rG:J.platform==="darwin"?TU:J.platform?tG:Vc;this.scurry=new W(this.cwd,{nocase:J.nocase,fs:J.fs})}this.nocase=this.scurry.nocase;let X=this.platform==="darwin"||this.platform==="win32",Y={...J,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:X,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},$=this.pattern.map((W)=>new L9(W,Y)),[Q,K]=$.reduce((W,G)=>{return W[0].push(...G.set),W[1].push(...G.globParts),W},[[],[]]);this.patterns=Q.map((W,G)=>{let z=K[G];if(!z)throw new Error("invalid pattern object");return new DQ(W,z,0,this.platform)})}async walk(){return[...await new kU(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new kU(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new EU(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new EU(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}var BP=(Z,J={})=>{if(!Array.isArray(Z))Z=[Z];for(let X of Z)if(new L9(X,J).hasMagic())return!0;return!1};function vU(Z,J={}){return new r4(Z,J).streamSync()}function Uc(Z,J={}){return new r4(Z,J).stream()}function Lc(Z,J={}){return new r4(Z,J).walkSync()}async function Fc(Z,J={}){return new r4(Z,J).walk()}function SU(Z,J={}){return new r4(Z,J).iterateSync()}function wc(Z,J={}){return new r4(Z,J).iterate()}var vV1=vU,SV1=Object.assign(Uc,{sync:vU}),_V1=SU,AV1=Object.assign(wc,{sync:SU}),xV1=Object.assign(Lc,{stream:vU,iterate:SU}),IU=Object.assign(Fc,{glob:Fc,globSync:Lc,sync:xV1,globStream:Uc,stream:SV1,globStreamSync:vU,streamSync:vV1,globIterate:wc,iterate:AV1,globIterateSync:SU,iterateSync:_V1,Glob:r4,hasMagic:BP,escape:OQ,unescape:Q4});IU.glob=IU;class jP{constructor(){this._listeners={}}addEventListener(Z,J){let X=this._listeners;if(X[Z]===void 0)X[Z]=[];if(X[Z].indexOf(J)===-1)X[Z].push(J);return this}removeEventListener(Z,J){let Y=this._listeners[Z];if(Y!==void 0){let $=Y.indexOf(J);if($!==-1)Y.splice($,1)}return this}dispatchEvent(Z){let X=this._listeners[Z.type];if(X!==void 0){let Y=X.slice(0);for(let $=0,Q=Y.length;$<Q;$++)Y[$].call(this,Z)}return this}dispose(){for(let Z in this._listeners)delete this._listeners[Z]}}class w5{constructor(Z,J,X,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=X,this._attributes=Y,!J.isOnGraph(X))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 CQ extends jP{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 X of this.listParentEdges(Z))J.add(X.getParent());return Array.from(J)}listChildEdges(Z){return Array.from(this._parentEdges.get(Z)||this._emptySet)}listChildren(Z){let J=new Set;for(let X of this.listChildEdges(Z))J.add(X.getChild());return Array.from(J)}disconnectParents(Z,J){for(let X of this.listParentEdges(Z))if(!J||J(X.getParent()))X.dispose();return this}_createEdge(Z,J,X,Y){let $=new w5(Z,J,X,Y);this._edges.add($);let Q=$.getParent();if(!this._parentEdges.has(Q))this._parentEdges.set(Q,new Set);this._parentEdges.get(Q).add($);let K=$.getChild();if(!this._childEdges.has(K))this._childEdges.set(K,new Set);return this._childEdges.get(K).add($),$}_destroyEdge(Z){return this._edges.delete(Z),this._parentEdges.get(Z.getParent()).delete(Z),this._childEdges.get(Z.getChild()).delete(Z),this}}function J3(){return J3=Object.assign||function(Z){for(var J=1;J<arguments.length;J++){var X=arguments[J];for(var Y in X)if(Object.prototype.hasOwnProperty.call(X,Y))Z[Y]=X[Y]}return Z},J3.apply(this,arguments)}class D6{constructor(Z){if(this.list=[],Z)for(let J of Z)this.list.push(J)}add(Z){this.list.push(Z)}remove(Z){let J=this.list.indexOf(Z);if(J>=0)this.list.splice(J,1)}removeChild(Z){let J=[];for(let X of this.list)if(X.getChild()===Z)J.push(X);for(let X of J)this.remove(X);return J}listRefsByChild(Z){let J=[];for(let X of this.list)if(X.getChild()===Z)J.push(X);return J}values(){return this.list}}class N0{constructor(Z){if(this.set=new Set,this.map=new Map,Z)for(let J of Z)this.add(J)}add(Z){let J=Z.getChild();this.removeChild(J),this.set.add(Z),this.map.set(J,Z)}remove(Z){this.set.delete(Z),this.map.delete(Z.getChild())}removeChild(Z){let J=this.map.get(Z)||null;if(J)this.remove(J);return J}getRefByChild(Z){return this.map.get(Z)||null}values(){return Array.from(this.set)}}class r1{constructor(Z){if(this.map={},Z)Object.assign(this.map,Z)}set(Z,J){this.map[Z]=J}delete(Z){delete this.map[Z]}get(Z){return this.map[Z]||null}keys(){return Object.keys(this.map)}values(){return Object.values(this.map)}}var A0=Symbol("attributes"),G4=Symbol("immutableKeys");class TQ extends jP{constructor(Z){super();this._disposed=!1,this.graph=void 0,this[A0]=void 0,this[G4]=void 0,this.graph=Z,this[G4]=new Set,this[A0]=this._createAttributes()}getDefaults(){return{}}_createAttributes(){let Z=this.getDefaults(),J={};for(let X in Z){let Y=Z[X];if(Y instanceof TQ){let $=this.graph._createEdge(X,this,Y);this[G4].add(X),J[X]=$}else J[X]=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 X in this[A0]){let Y=this[A0][X];if(Y instanceof w5){let $=Y;if($.getChild()===Z)this.setRef(X,J,$.getAttributes())}else if(Y instanceof D6)for(let $ of Y.listRefsByChild(Z)){let Q=$.getAttributes();this.removeRef(X,Z),this.addRef(X,J,Q)}else if(Y instanceof N0){let $=Y.getRefByChild(Z);if($){let Q=$.getAttributes();this.removeRef(X,Z),this.addRef(X,J,Q)}}else if(Y instanceof r1)for(let $ of Y.keys()){let Q=Y.get($);if(Q.getChild()===Z)this.setRefMap(X,$,J,Q.getAttributes())}}return this}get(Z){return this[A0][Z]}set(Z,J){return this[A0][Z]=J,this.dispatchEvent({type:"change",attribute:Z})}getRef(Z){let J=this[A0][Z];return J?J.getChild():null}setRef(Z,J,X){if(this[G4].has(Z))throw new Error(`Cannot overwrite immutable attribute, "${Z}".`);let Y=this[A0][Z];if(Y)Y.dispose();if(!J)return this;let $=this.graph._createEdge(Z,this,J,X);return this[A0][Z]=$,this.dispatchEvent({type:"change",attribute:Z})}listRefs(Z){return this.assertRefList(Z).values().map((X)=>X.getChild())}addRef(Z,J,X){let Y=this.graph._createEdge(Z,this,J,X);return this.assertRefList(Z).add(Y),this.dispatchEvent({type:"change",attribute:Z})}removeRef(Z,J){let X=this.assertRefList(Z);if(X instanceof D6)for(let Y of X.listRefsByChild(J))Y.dispose();else{let Y=X.getRefByChild(J);if(Y)Y.dispose()}return this}assertRefList(Z){let J=this[A0][Z];if(J instanceof D6||J instanceof N0)return J;throw new Error(`Expected RefList or RefSet for attribute "${Z}"`)}listRefMapKeys(Z){return this.assertRefMap(Z).keys()}listRefMapValues(Z){return this.assertRefMap(Z).values().map((J)=>J.getChild())}getRefMap(Z,J){let Y=this.assertRefMap(Z).get(J);return Y?Y.getChild():null}setRefMap(Z,J,X,Y){let $=this.assertRefMap(Z),Q=$.get(J);if(Q)Q.dispose();if(!X)return this;Y=Object.assign(Y||{},{key:J});let K=this.graph._createEdge(Z,this,X,J3({},Y,{key:J}));return $.set(J,K),this.dispatchEvent({type:"change",attribute:Z,key:J})}assertRefMap(Z){let J=this[A0][Z];if(J instanceof r1)return J;throw new Error(`Expected RefMap for attribute "${Z}"`)}dispatchEvent(Z){return super.dispatchEvent(J3({},Z,{target:this})),this.graph.dispatchEvent(J3({},Z,{target:this,type:`node:${Z.type}`})),this}_destroyRef(Z){let J=Z.getName();if(this[A0][J]===Z){if(this[A0][J]=null,this[G4].has(J))Z.getChild().dispose()}else if(this[A0][J]instanceof D6)this[A0][J].remove(Z);else if(this[A0][J]instanceof N0)this[A0][J].remove(Z);else if(this[A0][J]instanceof r1){let X=this[A0][J];for(let Y of X.keys())if(X.get(Y)===Z)X.delete(Y)}else return;this.graph._destroyEdge(Z),this.dispatchEvent({type:"change",attribute:J})}}var Pc="v4.1.1",bU="@glb.bin",a;(function(Z){Z.ACCESSOR="Accessor",Z.ANIMATION="Animation",Z.ANIMATION_CHANNEL="AnimationChannel",Z.ANIMATION_SAMPLER="AnimationSampler",Z.BUFFER="Buffer",Z.CAMERA="Camera",Z.MATERIAL="Material",Z.MESH="Mesh",Z.PRIMITIVE="Primitive",Z.PRIMITIVE_TARGET="PrimitiveTarget",Z.NODE="Node",Z.ROOT="Root",Z.SCENE="Scene",Z.SKIN="Skin",Z.TEXTURE="Texture",Z.TEXTURE_INFO="TextureInfo"})(a||(a={}));var yU;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(yU||(yU={}));var d5;(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"})(d5||(d5={}));var gU;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(gU||(gU={}));var $Z;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})($Z||($Z={}));var GJ={"5120":Int8Array,"5121":Uint8Array,"5122":Int16Array,"5123":Uint16Array,"5125":Uint32Array,"5126":Float32Array},MP=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 hV1(){var Z=new MP(3);if(MP!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function OP(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function fV1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=X[3]*Y+X[7]*$+X[11]*Q+X[15];return K=K||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/K,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/K,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/K,Z}(function(){var Z=hV1();return function(J,X,Y,$,Q,K){var W,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(W=Y;W<G;W+=X)Z[0]=J[W],Z[1]=J[W+1],Z[2]=J[W+2],Q(Z,Z,K),J[W]=Z[0],J[W+1]=Z[1],J[W+2]=Z[2];return J}})();function DP(Z){let J=Dc(),X=Z.propertyType===a.NODE?[Z]:Z.listChildren();for(let Y of X)Y.traverse(($)=>{let Q=$.getMesh();if(!Q)return;let K=bV1(Q,$.getWorldMatrix());if(K.min.every(isFinite)&&K.max.every(isFinite))RP(K.min,J),RP(K.max,J)});return J}function bV1(Z,J){let X=Dc();for(let Y of Z.listPrimitives()){let $=Y.getAttribute("POSITION"),Q=Y.getIndices();if(!$)continue;let K=[0,0,0],W=[0,0,0];for(let G=0,z=Q?Q.getCount():$.getCount();G<z;G++){let V=Q?Q.getScalar(G):G;K=$.getElement(V,K),W=fV1(W,K,J),RP(W,X)}}return X}function RP(Z,J){for(let X=0;X<3;X++)J.min[X]=Math.min(Z[X],J.min[X]),J.max[X]=Math.max(Z[X],J.max[X])}function Dc(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class n0{static createBufferFromDataURI(Z){if(typeof Buffer==="undefined"){let J=atob(Z.split(",")[1]),X=new Uint8Array(J.length);for(let Y=0;Y<J.length;Y++)X[Y]=J.charCodeAt(Y);return X}else{let J=Z.split(",")[1],X=Z.indexOf("base64")>=0;return Buffer.from(J,X?"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 $ of Z)J+=$.byteLength;let X=new Uint8Array(J),Y=0;for(let $ of Z)X.set($,Y),Y+=$.byteLength;return X}static pad(Z,J=0){let X=this.padNumber(Z.byteLength);if(X===Z.byteLength)return Z;let Y=new Uint8Array(X);if(Y.set(Z),J!==0)for(let $=Z.byteLength;$<X;$++)Y[$]=J;return Y}static padNumber(Z){return Math.ceil(Z/4)*4}static equals(Z,J){if(Z===J)return!0;if(Z.byteLength!==J.byteLength)return!1;let X=Z.byteLength;while(X--)if(Z[X]!==J[X])return!1;return!0}static toView(Z,J=0,X=1/0){return new Uint8Array(Z.buffer,Z.byteOffset+J,Math.min(Z.byteLength,X))}static assertView(Z){if(Z&&!ArrayBuffer.isView(Z))throw new Error(`Method requires Uint8Array parameter; received "${typeof Z}".`);return Z}}class CP{static hexToFactor(Z,J){Z=Math.floor(Z);let X=J;return X[0]=(Z>>16&255)/255,X[1]=(Z>>8&255)/255,X[2]=(Z&255)/255,this.convertSRGBToLinear(J,J)}static factorToHex(Z){let J=[...Z],[X,Y,$]=this.convertLinearToSRGB(Z,J);return X*255<<16^Y*255<<8^$*255<<0}static convertSRGBToLinear(Z,J){let X=Z,Y=J;for(let $=0;$<3;$++)Y[$]=X[$]<0.04045?X[$]*0.0773993808:Math.pow(X[$]*0.9478672986+0.0521327014,2.4);return J}static convertLinearToSRGB(Z,J){let X=Z,Y=J;for(let $=0;$<3;$++)Y[$]=X[$]<0.0031308?X[$]*12.92:1.055*Math.pow(X[$],0.41666)-0.055;return J}}class Cc{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),X,Y;while(J.byteLength){if(X=J.getUint16(0,!1),yV1(J,X),Y=J.getUint8(X+1),Y===192||Y===193||Y===194)return[J.getUint16(X+7,!1),J.getUint16(X+5,!1)];J=new DataView(Z.buffer,J.byteOffset+X+2)}throw new TypeError("Invalid JPG, no size found")}getChannels(Z){return 3}}class dU{match(Z){return Z.length>=8&&Z[0]===137&&Z[1]===80&&Z[2]===78&&Z[3]===71&&Z[4]===13&&Z[5]===10&&Z[6]===26&&Z[7]===10}getSize(Z){let J=new DataView(Z.buffer,Z.byteOffset);if(n0.decodeText(Z.slice(12,16))===dU.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}}dU.PNG_FRIED_CHUNK_NAME="CgBI";class QZ{static registerFormat(Z,J){this.impls[Z]=J}static getMimeType(Z){for(let J in this.impls)if(this.impls[J].match(Z))return J;return null}static getSize(Z,J){if(!this.impls[J])return null;return this.impls[J].getSize(Z)}static getChannels(Z,J){if(!this.impls[J])return null;return this.impls[J].getChannels(Z)}static getVRAMByteLength(Z,J){if(!this.impls[J])return null;if(this.impls[J].getVRAMByteLength)return this.impls[J].getVRAMByteLength(Z);let X=0,Y=4,$=this.getSize(Z,J);if(!$)return null;while($[0]>1||$[1]>1)X+=$[0]*$[1]*Y,$[0]=Math.max(Math.floor($[0]/2),1),$[1]=Math.max(Math.floor($[1]/2),1);return X+=1*Y,X}static mimeTypeToExtension(Z){if(Z==="image/jpeg")return"jpg";return Z.split("/").pop()}static extensionToMimeType(Z){if(Z==="jpg")return"image/jpeg";if(!Z)return"";return`image/${Z}`}}QZ.impls={"image/jpeg":new Cc,"image/png":new dU};function yV1(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 KZ{static basename(Z){let J=Z.split(/[\\/]/).pop();return J.substring(0,J.lastIndexOf("."))}static extension(Z){if(Z.startsWith("data:image/")){let J=Z.match(/data:(image\/\w+)/)[1];return QZ.mimeTypeToExtension(J)}else if(Z.startsWith("data:model/gltf+json"))return"gltf";else if(Z.startsWith("data:model/gltf-binary"))return"glb";else if(Z.startsWith("data:application/"))return"bin";return Z.split(/[\\/]/).pop().split(/[.]/).pop()}}function Bc(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function oX(Z){if(Bc(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let X=J.prototype;if(Bc(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}var NP,X3;(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"})(X3||(X3={}));class j5{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=j5.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=j5.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=j5.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=j5.Verbosity.ERROR)console.error(Z)}}NP=j5;j5.Verbosity=X3;j5.DEFAULT_INSTANCE=new NP(NP.Verbosity.INFO);function gV1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],K=Z[5],W=Z[6],G=Z[7],z=Z[8],V=Z[9],H=Z[10],q=Z[11],F=Z[12],U=Z[13],w=Z[14],L=Z[15],j=J*K-X*Q,R=J*W-Y*Q,O=J*G-$*Q,N=X*W-Y*K,D=X*G-$*K,P=Y*G-$*W,C=z*U-V*F,T=z*w-H*F,k=z*L-q*F,A=V*w-H*U,S=V*L-q*U,x=H*L-q*w;return j*x-R*S+O*A+N*k-D*T+P*C}function mV1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=J[8],q=J[9],F=J[10],U=J[11],w=J[12],L=J[13],j=J[14],R=J[15],O=X[0],N=X[1],D=X[2],P=X[3];return Z[0]=O*Y+N*W+D*H+P*w,Z[1]=O*$+N*G+D*q+P*L,Z[2]=O*Q+N*z+D*F+P*j,Z[3]=O*K+N*V+D*U+P*R,O=X[4],N=X[5],D=X[6],P=X[7],Z[4]=O*Y+N*W+D*H+P*w,Z[5]=O*$+N*G+D*q+P*L,Z[6]=O*Q+N*z+D*F+P*j,Z[7]=O*K+N*V+D*U+P*R,O=X[8],N=X[9],D=X[10],P=X[11],Z[8]=O*Y+N*W+D*H+P*w,Z[9]=O*$+N*G+D*q+P*L,Z[10]=O*Q+N*z+D*F+P*j,Z[11]=O*K+N*V+D*U+P*R,O=X[12],N=X[13],D=X[14],P=X[15],Z[12]=O*Y+N*W+D*H+P*w,Z[13]=O*$+N*G+D*q+P*L,Z[14]=O*Q+N*z+D*F+P*j,Z[15]=O*K+N*V+D*U+P*R,Z}function uV1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[4],K=J[5],W=J[6],G=J[8],z=J[9],V=J[10];return Z[0]=Math.hypot(X,Y,$),Z[1]=Math.hypot(Q,K,W),Z[2]=Math.hypot(G,z,V),Z}function dV1(Z,J){var X=new MP(3);uV1(X,J);var Y=1/X[0],$=1/X[1],Q=1/X[2],K=J[0]*Y,W=J[1]*$,G=J[2]*Q,z=J[4]*Y,V=J[5]*$,H=J[6]*Q,q=J[8]*Y,F=J[9]*$,U=J[10]*Q,w=K+V+U,L=0;if(w>0)L=Math.sqrt(w+1)*2,Z[3]=0.25*L,Z[0]=(H-F)/L,Z[1]=(q-G)/L,Z[2]=(W-z)/L;else if(K>V&&K>U)L=Math.sqrt(1+K-V-U)*2,Z[3]=(H-F)/L,Z[0]=0.25*L,Z[1]=(W+z)/L,Z[2]=(q+G)/L;else if(V>U)L=Math.sqrt(1+V-K-U)*2,Z[3]=(q-G)/L,Z[0]=(W+z)/L,Z[1]=0.25*L,Z[2]=(H+F)/L;else L=Math.sqrt(1+U-K-V)*2,Z[3]=(W-z)/L,Z[0]=(q+G)/L,Z[1]=(H+F)/L,Z[2]=0.25*L;return Z}class d0{static identity(Z){return Z}static eq(Z,J,X=0.00001){if(Z.length!==J.length)return!1;for(let Y=0;Y<Z.length;Y++)if(Math.abs(Z[Y]-J[Y])>X)return!1;return!0}static clamp(Z,J,X){if(Z<J)return J;if(Z>X)return X;return Z}static decodeNormalizedInt(Z,J){switch(J){case 5126:return Z;case 5123:return Z/65535;case 5121:return Z/255;case 5122:return Math.max(Z/32767,-1);case 5120:return Math.max(Z/127,-1);default:throw new Error("Invalid component type.")}}static encodeNormalizedInt(Z,J){switch(J){case 5126:return Z;case 5123:return Math.round(d0.clamp(Z,0,1)*65535);case 5121:return Math.round(d0.clamp(Z,0,1)*255);case 5122:return Math.round(d0.clamp(Z,-1,1)*32767);case 5120:return Math.round(d0.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,X,Y){let $=OP([Z[0],Z[1],Z[2]]),Q=OP([Z[4],Z[5],Z[6]]),K=OP([Z[8],Z[9],Z[10]]);if(gV1(Z)<0)$=-$;J[0]=Z[12],J[1]=Z[13],J[2]=Z[14];let G=Z.slice(),z=1/$,V=1/Q,H=1/K;G[0]*=z,G[1]*=z,G[2]*=z,G[4]*=V,G[5]*=V,G[6]*=V,G[8]*=H,G[9]*=H,G[10]*=H,dV1(X,G),Y[0]=$,Y[1]=Q,Y[2]=K}static compose(Z,J,X,Y){let $=Y,Q=J[0],K=J[1],W=J[2],G=J[3],z=Q+Q,V=K+K,H=W+W,q=Q*z,F=Q*V,U=Q*H,w=K*V,L=K*H,j=W*H,R=G*z,O=G*V,N=G*H,D=X[0],P=X[1],C=X[2];return $[0]=(1-(w+j))*D,$[1]=(F+N)*D,$[2]=(U-O)*D,$[3]=0,$[4]=(F-N)*P,$[5]=(1-(q+j))*P,$[6]=(L+R)*P,$[7]=0,$[8]=(U+O)*C,$[9]=(L-R)*C,$[10]=(1-(q+w))*C,$[11]=0,$[12]=Z[0],$[13]=Z[1],$[14]=Z[2],$[15]=1,$}}function cV1(Z,J){if(!!Z!==!!J)return!1;let X=Z.getChild(),Y=J.getChild();return X===Y||X.equals(Y)}function lV1(Z,J){if(!!Z!==!!J)return!1;let X=Z.values(),Y=J.values();if(X.length!==Y.length)return!1;for(let $=0;$<X.length;$++){let Q=X[$],K=Y[$];if(Q.getChild()===K.getChild())continue;if(!Q.getChild().equals(K.getChild()))return!1}return!0}function pV1(Z,J){if(!!Z!==!!J)return!1;let X=Z.keys(),Y=J.keys();if(X.length!==Y.length)return!1;for(let $ of X){let Q=Z.get($),K=J.get($);if(!!Q!==!!K)return!1;let W=Q.getChild(),G=K.getChild();if(W===G)continue;if(!W.equals(G))return!1}return!0}function Tc(Z,J){if(Z===J)return!0;if(!!Z!==!!J||!Z||!J)return!1;if(Z.length!==J.length)return!1;for(let X=0;X<Z.length;X++)if(Z[X]!==J[X])return!1;return!0}function kc(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!oX(Z)||!oX(J))return Z===J;let X=Z,Y=J,$=0,Q=0,K;for(K in X)$++;for(K in Y)Q++;if($!==Q)return!1;for(K in X){let W=X[K],G=Y[K];if(mU(W)&&mU(G)){if(!Tc(W,G))return!1}else if(oX(W)&&oX(G)){if(!kc(W,G))return!1}else if(W!==G)return!1}return!0}function mU(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var jc="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ",iV1=999,nV1=6,Oc=new Set,aV1=function Z(){let J="";for(let X=0;X<nV1;X++)J+=jc.charAt(Math.floor(Math.random()*jc.length));return J},Ec=function Z(){for(let J=0;J<iV1;J++){let X=aV1();if(!Oc.has(X))return Oc.add(X),X}return""},Mc="https://null.example";class j9{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return KZ.basename(new URL(Z,Mc).pathname)}static extension(Z){return KZ.extension(new URL(Z,Mc).pathname)}static resolve(Z,J){if(!this.isRelativePath(J))return J;let X=Z.split("/"),Y=J.split("/");X.pop();for(let $=0;$<Y.length;$++){if(Y[$]===".")continue;if(Y[$]==="..")X.pop();else X.push(Y[$])}return X.join("/")}static isAbsoluteURL(Z){return this.PROTOCOL_REGEXP.test(Z)}static isRelativePath(Z){return!/^(?:[a-zA-Z]+:)?\//.test(Z)}}j9.DEFAULT_INIT={};j9.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var WJ=(Z)=>Z,sV1=new Set;class cU extends TQ{constructor(Z,J=""){super(Z);this[A0].name=J,this.init(),this.dispatchEvent({type:"create"})}getGraph(){return this.graph}getDefaults(){return Object.assign(super.getDefaults(),{name:"",extras:{}})}set(Z,J){if(Array.isArray(J))J=J.slice();return super.set(Z,J)}getName(){return this.get("name")}setName(Z){return this.set("name",Z)}getExtras(){return this.get("extras")}setExtras(Z){return this.set("extras",Z)}clone(){return new this.constructor(this.graph).copy(this,WJ)}copy(Z,J=WJ){for(let X in this[A0]){let Y=this[A0][X];if(Y instanceof w5){if(!this[G4].has(X))Y.dispose()}else if(Y instanceof D6||Y instanceof N0)for(let $ of Y.values())$.dispose();else if(Y instanceof r1)for(let $ of Y.values())$.dispose()}for(let X in Z[A0]){let Y=this[A0][X],$=Z[A0][X];if($ instanceof w5)if(this[G4].has(X))Y.getChild().copy(J($.getChild()),J);else this.setRef(X,J($.getChild()),$.getAttributes());else if($ instanceof N0||$ instanceof D6)for(let Q of $.values())this.addRef(X,J(Q.getChild()),Q.getAttributes());else if($ instanceof r1)for(let Q of $.keys()){let K=$.get(Q);this.setRefMap(X,Q,J(K.getChild()),K.getAttributes())}else if(oX($))this[A0][X]=JSON.parse(JSON.stringify($));else if(Array.isArray($)||$ instanceof ArrayBuffer||ArrayBuffer.isView($))this[A0][X]=$.slice();else this[A0][X]=$}return this}equals(Z,J=sV1){if(this===Z)return!0;if(this.propertyType!==Z.propertyType)return!1;for(let X in this[A0]){if(J.has(X))continue;let Y=this[A0][X],$=Z[A0][X];if(Y instanceof w5||$ instanceof w5){if(!cV1(Y,$))return!1}else if(Y instanceof N0||$ instanceof N0||Y instanceof D6||$ instanceof D6){if(!lV1(Y,$))return!1}else if(Y instanceof r1||$ instanceof r1){if(!pV1(Y,$))return!1}else if(oX(Y)||oX($)){if(!kc(Y,$))return!1}else if(mU(Y)||mU($)){if(!Tc(Y,$))return!1}else if(Y!==$)return!1}return!0}detach(){return this.graph.disconnectParents(this,(Z)=>Z.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}}class T6 extends cU{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new r1})}getExtension(Z){return this.getRefMap("extensions",Z)}setExtension(Z,J){if(J)J._validateParent(this);return this.setRefMap("extensions",Z,J)}listExtensions(){return this.listRefMapValues("extensions")}}class E0 extends T6{init(){this.propertyType=a.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:E0.Type.SCALAR,componentType:E0.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(Z){switch(Z){case E0.Type.SCALAR:return 1;case E0.Type.VEC2:return 2;case E0.Type.VEC3:return 3;case E0.Type.VEC4:return 4;case E0.Type.MAT2:return 4;case E0.Type.MAT3:return 9;case E0.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+Z)}}static getComponentSize(Z){switch(Z){case E0.ComponentType.BYTE:return 1;case E0.ComponentType.UNSIGNED_BYTE:return 1;case E0.ComponentType.SHORT:return 2;case E0.ComponentType.UNSIGNED_SHORT:return 2;case E0.ComponentType.UNSIGNED_INT:return 4;case E0.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+Z)}}getMinNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMin(Z),J)for(let $=0;$<X;$++)Z[$]=d0.decodeNormalizedInt(Z[$],Y);return Z}getMin(Z){let J=this.getArray(),X=this.getCount(),Y=this.getElementSize();for(let $=0;$<Y;$++)Z[$]=1/0;for(let $=0;$<X*Y;$+=Y)for(let Q=0;Q<Y;Q++){let K=J[$+Q];if(Number.isFinite(K))Z[Q]=Math.min(Z[Q],K)}return Z}getMaxNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMax(Z),J)for(let $=0;$<X;$++)Z[$]=d0.decodeNormalizedInt(Z[$],Y);return Z}getMax(Z){let J=this.get("array"),X=this.getCount(),Y=this.getElementSize();for(let $=0;$<Y;$++)Z[$]=-1/0;for(let $=0;$<X*Y;$+=Y)for(let Q=0;Q<Y;Q++){let K=J[$+Q];if(Number.isFinite(K))Z[Q]=Math.max(Z[Q],K)}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 E0.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(),X=this.getComponentType(),Y=this.getArray();if(this.getNormalized())return d0.decodeNormalizedInt(Y[Z*J],X);return Y[Z*J]}setScalar(Z,J){let X=this.getElementSize(),Y=this.getComponentType(),$=this.getArray();if(this.getNormalized())$[Z*X]=d0.encodeNormalizedInt(J,Y);else $[Z*X]=J;return this}getElement(Z,J){let X=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();for(let K=0;K<Y;K++)if(X)J[K]=d0.decodeNormalizedInt(Q[Z*Y+K],$);else J[K]=Q[Z*Y+K];return J}setElement(Z,J){let X=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();for(let K=0;K<Y;K++)if(X)Q[Z*Y+K]=d0.encodeNormalizedInt(J[K],$);else Q[Z*Y+K]=J[K];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?oV1(Z):E0.ComponentType.FLOAT),this.set("array",Z),this}getByteLength(){let Z=this.get("array");return Z?Z.byteLength:0}}E0.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};E0.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function oV1(Z){switch(Z.constructor){case Float32Array:return E0.ComponentType.FLOAT;case Uint32Array:return E0.ComponentType.UNSIGNED_INT;case Uint16Array:return E0.ComponentType.UNSIGNED_SHORT;case Uint8Array:return E0.ComponentType.UNSIGNED_BYTE;case Int16Array:return E0.ComponentType.SHORT;case Int8Array:return E0.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class TP extends T6{init(){this.propertyType=a.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new N0,samplers:new N0})}addChannel(Z){return this.addRef("channels",Z)}removeChannel(Z){return this.removeRef("channels",Z)}listChannels(){return this.listRefs("channels")}addSampler(Z){return this.addRef("samplers",Z)}removeSampler(Z){return this.removeRef("samplers",Z)}listSamplers(){return this.listRefs("samplers")}}class rX extends T6{init(){this.propertyType=a.ANIMATION_CHANNEL}getDefaults(){return Object.assign(super.getDefaults(),{targetPath:null,targetNode:null,sampler:null})}getTargetPath(){return this.get("targetPath")}setTargetPath(Z){return this.set("targetPath",Z)}getTargetNode(){return this.getRef("targetNode")}setTargetNode(Z){return this.setRef("targetNode",Z)}getSampler(){return this.getRef("sampler")}setSampler(Z){return this.setRef("sampler",Z)}}rX.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class kQ extends T6{init(){this.propertyType=a.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:kQ.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:d5.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:d5.OTHER})}}kQ.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class kP extends T6{init(){this.propertyType=a.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(Z){return this.set("uri",Z)}}class tX extends T6{init(){this.propertyType=a.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:tX.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)}}tX.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class EQ extends cU{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}EQ.EXTENSION_NAME=void 0;class B5 extends T6{init(){this.propertyType=a.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:B5.WrapMode.REPEAT,wrapT:B5.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)}}B5.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};B5.MagFilter={NEAREST:9728,LINEAR:9729};B5.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:_U,G:AU,B:xU,A:rV1}=gU;class t4 extends T6{init(){this.propertyType=a.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:t4.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new B5(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new B5(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new B5(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new B5(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new B5(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:_U|AU|xU|rV1,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:_U|AU|xU,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:_U|AU|xU})}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:_U})}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:AU|xU})}}t4.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class $3 extends T6{init(){this.propertyType=a.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new N0})}addPrimitive(Z){return this.addRef("primitives",Z)}removePrimitive(Z){return this.removeRef("primitives",Z)}listPrimitives(){return this.listRefs("primitives")}getWeights(){return this.get("weights")}setWeights(Z){return this.set("weights",Z)}}class lU extends T6{init(){this.propertyType=a.NODE}getDefaults(){return Object.assign(super.getDefaults(),{translation:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1],weights:[],camera:null,mesh:null,skin:null,children:new N0})}copy(Z,J=WJ){if(J===WJ)throw new Error("Node cannot be copied.");return super.copy(Z,J)}getTranslation(){return this.get("translation")}getRotation(){return this.get("rotation")}getScale(){return this.get("scale")}setTranslation(Z){return this.set("translation",Z)}setRotation(Z){return this.set("rotation",Z)}setScale(Z){return this.set("scale",Z)}getMatrix(){return d0.compose(this.get("translation"),this.get("rotation"),this.get("scale"),[])}setMatrix(Z){let J=this.get("translation").slice(),X=this.get("rotation").slice(),Y=this.get("scale").slice();return d0.decompose(Z,J,X,Y),this.set("translation",J).set("rotation",X).set("scale",Y)}getWorldTranslation(){let Z=[0,0,0];return d0.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return d0.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return d0.decompose(this.getWorldMatrix(),[0,0,0],[0,0,0,1],Z),Z}getWorldMatrix(){let Z=[];for(let Y=this;Y!=null;Y=Y.getParentNode())Z.push(Y);let J,X=Z.pop().getMatrix();while(J=Z.pop())mV1(X,X,J.getMatrix());return X}addChild(Z){let J=Z.getParentNode();if(J)J.removeChild(Z);for(let X of Z.listParents())if(X.propertyType===a.SCENE)X.removeChild(Z);return this.addRef("children",Z)}removeChild(Z){return this.removeRef("children",Z)}listChildren(){return this.listRefs("children")}getParentNode(){for(let Z of this.listParents())if(Z.propertyType===a.NODE)return Z;return null}getMesh(){return this.getRef("mesh")}setMesh(Z){return this.setRef("mesh",Z)}getCamera(){return this.getRef("camera")}setCamera(Z){return this.setRef("camera",Z)}getSkin(){return this.getRef("skin")}setSkin(Z){return this.setRef("skin",Z)}getWeights(){return this.get("weights")}setWeights(Z){return this.set("weights",Z)}traverse(Z){Z(this);for(let J of this.listChildren())J.traverse(Z);return this}}class M8 extends T6{init(){this.propertyType=a.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:M8.Mode.TRIANGLES,material:null,indices:null,attributes:new r1,targets:new N0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:d5.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:d5.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)}}M8.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class EP extends cU{init(){this.propertyType=a.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new r1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:d5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function c6(){return c6=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var X=arguments[J];for(var Y in X)({}).hasOwnProperty.call(X,Y)&&(Z[Y]=X[Y])}return Z},c6.apply(null,arguments)}class IQ extends T6{init(){this.propertyType=a.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new N0})}copy(Z,J=WJ){if(J===WJ)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 IP extends T6{init(){this.propertyType=a.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new N0})}getSkeleton(){return this.getRef("skeleton")}setSkeleton(Z){return this.setRef("skeleton",Z)}getInverseBindMatrices(){return this.getRef("inverseBindMatrices")}setInverseBindMatrices(Z){return this.setRef("inverseBindMatrices",Z,{usage:d5.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class eX extends T6{init(){this.propertyType=a.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||QZ.extensionToMimeType(KZ.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=QZ.extensionToMimeType(KZ.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",n0.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return QZ.getSize(Z,this.getMimeType())}}class ZY extends T6{init(){this.propertyType=a.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${Pc}`,version:"2.0"},defaultScene:null,accessors:new N0,animations:new N0,buffers:new N0,cameras:new N0,materials:new N0,meshes:new N0,nodes:new N0,scenes:new N0,skins:new N0,textures:new N0})}constructor(Z){super(Z);this._extensions=new Set,Z.addEventListener("node:create",(J)=>{this._addChildOfRoot(J.target)})}clone(){throw new Error("Root cannot be cloned.")}copy(Z,J=WJ){if(J===WJ)throw new Error("Root cannot be copied.");this.set("asset",c6({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(c6({},Z.getExtras())),this.setDefaultScene(Z.getDefaultScene()?J(Z.getDefaultScene()):null);for(let X of Z.listRefMapKeys("extensions")){let Y=Z.getExtension(X);this.setExtension(X,J(Y))}return this}_addChildOfRoot(Z){if(Z instanceof IQ)this.addRef("scenes",Z);else if(Z instanceof lU)this.addRef("nodes",Z);else if(Z instanceof tX)this.addRef("cameras",Z);else if(Z instanceof IP)this.addRef("skins",Z);else if(Z instanceof $3)this.addRef("meshes",Z);else if(Z instanceof t4)this.addRef("materials",Z);else if(Z instanceof eX)this.addRef("textures",Z);else if(Z instanceof TP)this.addRef("animations",Z);else if(Z instanceof E0)this.addRef("accessors",Z);else if(Z instanceof kP)this.addRef("buffers",Z);return this}getAsset(){return this.get("asset")}listExtensionsUsed(){return Array.from(this._extensions)}listExtensionsRequired(){return this.listExtensionsUsed().filter((Z)=>Z.isRequired())}_enableExtension(Z){return this._extensions.add(Z),this}_disableExtension(Z){return this._extensions.delete(Z),this}listScenes(){return this.listRefs("scenes")}setDefaultScene(Z){return this.setRef("defaultScene",Z)}getDefaultScene(){return this.getRef("defaultScene")}listNodes(){return this.listRefs("nodes")}listCameras(){return this.listRefs("cameras")}listSkins(){return this.listRefs("skins")}listMeshes(){return this.listRefs("meshes")}listMaterials(){return this.listRefs("materials")}listTextures(){return this.listRefs("textures")}listAnimations(){return this.listRefs("animations")}listAccessors(){return this.listRefs("accessors")}listBuffers(){return this.listRefs("buffers")}}class C6{static fromGraph(Z){return C6._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new CQ,this._root=new ZY(this._graph),this._logger=j5.DEFAULT_INSTANCE,C6._GRAPH_DOCUMENTS.set(this._graph,this)}getRoot(){return this._root}getGraph(){return this._graph}getLogger(){return this._logger}setLogger(Z){return this._logger=Z,this}clone(){throw new Error("Use 'cloneDocument(source)' from '@gltf-transform/functions'.")}merge(Z){throw new Error("Use 'mergeDocuments(target, source)' from '@gltf-transform/functions'.")}async transform(...Z){let J=Z.map((X)=>X.name);for(let X of Z)await X(this,{stack:J});return this}createExtension(Z){let J=Z.EXTENSION_NAME;return this.getRoot().listExtensionsUsed().find((Y)=>Y.extensionName===J)||new Z(this)}createScene(Z=""){return new IQ(this._graph,Z)}createNode(Z=""){return new lU(this._graph,Z)}createCamera(Z=""){return new tX(this._graph,Z)}createSkin(Z=""){return new IP(this._graph,Z)}createMesh(Z=""){return new $3(this._graph,Z)}createPrimitive(){return new M8(this._graph)}createPrimitiveTarget(Z=""){return new EP(this._graph,Z)}createMaterial(Z=""){return new t4(this._graph,Z)}createTexture(Z=""){return new eX(this._graph,Z)}createAnimation(Z=""){return new TP(this._graph,Z)}createAnimationChannel(Z=""){return new rX(this._graph,Z)}createAnimationSampler(Z=""){return new kQ(this._graph,Z)}createAccessor(Z="",J=null){if(!J)J=this.getRoot().listBuffers()[0];return new E0(this._graph,Z).setBuffer(J)}createBuffer(Z=""){return new kP(this._graph,Z)}}C6._GRAPH_DOCUMENTS=new WeakMap;class Ic{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=(X)=>{let Y=X,$=Y.target;if($ instanceof EQ&&$.extensionName===this.extensionName){if(Y.type==="node:create")this._addExtensionProperty($);if(Y.type==="node:dispose")this._removeExtensionProperty($)}};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}}Ic.EXTENSION_NAME=void 0;class vc{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 X=this.jsonDoc.json.textures[J.index];if(X.sampler===void 0)return;let Y=this.jsonDoc.json.samplers[X.sampler];if(Y.magFilter!==void 0)Z.setMagFilter(Y.magFilter);if(Y.minFilter!==void 0)Z.setMinFilter(Y.minFilter);if(Y.wrapS!==void 0)Z.setWrapS(Y.wrapS);if(Y.wrapT!==void 0)Z.setWrapT(Y.wrapT)}}var Rc={logger:j5.DEFAULT_INSTANCE,extensions:[],dependencies:{}},tV1=new Set([a.BUFFER,a.TEXTURE,a.MATERIAL,a.MESH,a.PRIMITIVE,a.NODE,a.SCENE]);class Sc{static read(Z,J=Rc){let X=c6({},Rc,J),{json:Y}=Z,$=new C6().setLogger(X.logger);this.validate(Z,X);let Q=new vc(Z),K=Y.asset,W=$.getRoot().getAsset();if(K.copyright)W.copyright=K.copyright;if(K.extras)W.extras=K.extras;if(Y.extras!==void 0)$.getRoot().setExtras(c6({},Y.extras));let G=Y.extensionsUsed||[],z=Y.extensionsRequired||[];X.extensions.sort((P,C)=>P.EXTENSION_NAME>C.EXTENSION_NAME?1:-1);for(let P of X.extensions)if(G.includes(P.EXTENSION_NAME)){let C=$.createExtension(P).setRequired(z.includes(P.EXTENSION_NAME)),T=C.prereadTypes.filter((k)=>!tV1.has(k));if(T.length)X.logger.warn(`Preread hooks for some types (${T.join()}), requested by extension ${C.extensionName}, are unsupported. Please file an issue or a PR.`);for(let k of C.readDependencies)C.install(k,X.dependencies[k])}let V=Y.buffers||[];$.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.BUFFER)).forEach((P)=>P.preread(Q,a.BUFFER)),Q.buffers=V.map((P)=>{let C=$.createBuffer(P.name);if(P.extras)C.setExtras(P.extras);if(P.uri&&P.uri.indexOf("__")!==0)C.setURI(P.uri);return C});let H=Y.bufferViews||[];Q.bufferViewBuffers=H.map((P,C)=>{if(!Q.bufferViews[C]){let T=Z.json.buffers[P.buffer],k=T.uri?Z.resources[T.uri]:Z.resources[bU],A=P.byteOffset||0;Q.bufferViews[C]=n0.toView(k,A,P.byteLength)}return Q.buffers[P.buffer]});let q=Y.accessors||[];Q.accessors=q.map((P)=>{let C=Q.bufferViewBuffers[P.bufferView],T=$.createAccessor(P.name,C).setType(P.type);if(P.extras)T.setExtras(P.extras);if(P.normalized!==void 0)T.setNormalized(P.normalized);if(P.bufferView===void 0)return T;return T.setArray(fU(P,Q)),T});let F=Y.images||[],U=Y.textures||[];$.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.TEXTURE)).forEach((P)=>P.preread(Q,a.TEXTURE)),Q.textures=F.map((P)=>{let C=$.createTexture(P.name);if(P.extras)C.setExtras(P.extras);if(P.bufferView!==void 0){let T=Y.bufferViews[P.bufferView],k=Z.json.buffers[T.buffer],A=k.uri?Z.resources[k.uri]:Z.resources[bU],S=T.byteOffset||0,x=T.byteLength,I=A.slice(S,S+x);C.setImage(I)}else if(P.uri!==void 0){if(C.setImage(Z.resources[P.uri]),P.uri.indexOf("__")!==0)C.setURI(P.uri)}if(P.mimeType!==void 0)C.setMimeType(P.mimeType);else if(P.uri){let T=KZ.extension(P.uri);C.setMimeType(QZ.extensionToMimeType(T))}return C}),$.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.MATERIAL)).forEach((P)=>P.preread(Q,a.MATERIAL));let w=Y.materials||[];Q.materials=w.map((P)=>{let C=$.createMaterial(P.name);if(P.extras)C.setExtras(P.extras);if(P.alphaMode!==void 0)C.setAlphaMode(P.alphaMode);if(P.alphaCutoff!==void 0)C.setAlphaCutoff(P.alphaCutoff);if(P.doubleSided!==void 0)C.setDoubleSided(P.doubleSided);let T=P.pbrMetallicRoughness||{};if(T.baseColorFactor!==void 0)C.setBaseColorFactor(T.baseColorFactor);if(P.emissiveFactor!==void 0)C.setEmissiveFactor(P.emissiveFactor);if(T.metallicFactor!==void 0)C.setMetallicFactor(T.metallicFactor);if(T.roughnessFactor!==void 0)C.setRoughnessFactor(T.roughnessFactor);if(T.baseColorTexture!==void 0){let k=T.baseColorTexture,A=Q.textures[U[k.index].source];C.setBaseColorTexture(A),Q.setTextureInfo(C.getBaseColorTextureInfo(),k)}if(P.emissiveTexture!==void 0){let k=P.emissiveTexture,A=Q.textures[U[k.index].source];C.setEmissiveTexture(A),Q.setTextureInfo(C.getEmissiveTextureInfo(),k)}if(P.normalTexture!==void 0){let k=P.normalTexture,A=Q.textures[U[k.index].source];if(C.setNormalTexture(A),Q.setTextureInfo(C.getNormalTextureInfo(),k),P.normalTexture.scale!==void 0)C.setNormalScale(P.normalTexture.scale)}if(P.occlusionTexture!==void 0){let k=P.occlusionTexture,A=Q.textures[U[k.index].source];if(C.setOcclusionTexture(A),Q.setTextureInfo(C.getOcclusionTextureInfo(),k),P.occlusionTexture.strength!==void 0)C.setOcclusionStrength(P.occlusionTexture.strength)}if(T.metallicRoughnessTexture!==void 0){let k=T.metallicRoughnessTexture,A=Q.textures[U[k.index].source];C.setMetallicRoughnessTexture(A),Q.setTextureInfo(C.getMetallicRoughnessTextureInfo(),k)}return C}),$.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.MESH)).forEach((P)=>P.preread(Q,a.MESH));let L=Y.meshes||[];$.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.PRIMITIVE)).forEach((P)=>P.preread(Q,a.PRIMITIVE)),Q.meshes=L.map((P)=>{let C=$.createMesh(P.name);if(P.extras)C.setExtras(P.extras);if(P.weights!==void 0)C.setWeights(P.weights);return(P.primitives||[]).forEach((k)=>{let A=$.createPrimitive();if(k.extras)A.setExtras(k.extras);if(k.material!==void 0)A.setMaterial(Q.materials[k.material]);if(k.mode!==void 0)A.setMode(k.mode);for(let[I,v]of Object.entries(k.attributes||{}))A.setAttribute(I,Q.accessors[v]);if(k.indices!==void 0)A.setIndices(Q.accessors[k.indices]);let S=P.extras&&P.extras.targetNames||[];(k.targets||[]).forEach((I,v)=>{let f=S[v]||v.toString(),p=$.createPrimitiveTarget(f);for(let[n,o]of Object.entries(I))p.setAttribute(n,Q.accessors[o]);A.addTarget(p)}),C.addPrimitive(A)}),C});let j=Y.cameras||[];Q.cameras=j.map((P)=>{let C=$.createCamera(P.name).setType(P.type);if(P.extras)C.setExtras(P.extras);if(P.type===tX.Type.PERSPECTIVE){let T=P.perspective;if(C.setYFov(T.yfov),C.setZNear(T.znear),T.zfar!==void 0)C.setZFar(T.zfar);if(T.aspectRatio!==void 0)C.setAspectRatio(T.aspectRatio)}else{let T=P.orthographic;C.setZNear(T.znear).setZFar(T.zfar).setXMag(T.xmag).setYMag(T.ymag)}return C});let R=Y.nodes||[];$.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.NODE)).forEach((P)=>P.preread(Q,a.NODE)),Q.nodes=R.map((P)=>{let C=$.createNode(P.name);if(P.extras)C.setExtras(P.extras);if(P.translation!==void 0)C.setTranslation(P.translation);if(P.rotation!==void 0)C.setRotation(P.rotation);if(P.scale!==void 0)C.setScale(P.scale);if(P.matrix!==void 0){let T=[0,0,0],k=[0,0,0,1],A=[1,1,1];d0.decompose(P.matrix,T,k,A),C.setTranslation(T),C.setRotation(k),C.setScale(A)}if(P.weights!==void 0)C.setWeights(P.weights);return C});let O=Y.skins||[];Q.skins=O.map((P)=>{let C=$.createSkin(P.name);if(P.extras)C.setExtras(P.extras);if(P.inverseBindMatrices!==void 0)C.setInverseBindMatrices(Q.accessors[P.inverseBindMatrices]);if(P.skeleton!==void 0)C.setSkeleton(Q.nodes[P.skeleton]);for(let T of P.joints)C.addJoint(Q.nodes[T]);return C}),R.map((P,C)=>{let T=Q.nodes[C];if((P.children||[]).forEach((A)=>T.addChild(Q.nodes[A])),P.mesh!==void 0)T.setMesh(Q.meshes[P.mesh]);if(P.camera!==void 0)T.setCamera(Q.cameras[P.camera]);if(P.skin!==void 0)T.setSkin(Q.skins[P.skin])});let N=Y.animations||[];Q.animations=N.map((P)=>{let C=$.createAnimation(P.name);if(P.extras)C.setExtras(P.extras);let k=(P.samplers||[]).map((S)=>{let x=$.createAnimationSampler().setInput(Q.accessors[S.input]).setOutput(Q.accessors[S.output]).setInterpolation(S.interpolation||kQ.Interpolation.LINEAR);if(S.extras)x.setExtras(S.extras);return C.addSampler(x),x});return(P.channels||[]).forEach((S)=>{let x=$.createAnimationChannel().setSampler(k[S.sampler]).setTargetPath(S.target.path);if(S.target.node!==void 0)x.setTargetNode(Q.nodes[S.target.node]);if(S.extras)x.setExtras(S.extras);C.addChannel(x)}),C});let D=Y.scenes||[];if($.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.SCENE)).forEach((P)=>P.preread(Q,a.SCENE)),Q.scenes=D.map((P)=>{let C=$.createScene(P.name);if(P.extras)C.setExtras(P.extras);return(P.nodes||[]).map((k)=>Q.nodes[k]).forEach((k)=>C.addChild(k)),C}),Y.scene!==void 0)$.getRoot().setDefaultScene(Q.scenes[Y.scene]);return $.getRoot().listExtensionsUsed().forEach((P)=>P.read(Q)),q.forEach((P,C)=>{let T=Q.accessors[C],k=!!P.sparse,A=!P.bufferView&&!T.getArray();if(k||A)T.setSparse(!0).setArray(ZH1(P,Q))}),$}static validate(Z,J){let X=Z.json;if(X.asset.version!=="2.0")throw new Error(`Unsupported glTF version, "${X.asset.version}".`);if(X.extensionsRequired){for(let Y of X.extensionsRequired)if(!J.extensions.find(($)=>$.EXTENSION_NAME===Y))throw new Error(`Missing required extension, "${Y}".`)}if(X.extensionsUsed){for(let Y of X.extensionsUsed)if(!J.extensions.find(($)=>$.EXTENSION_NAME===Y))J.logger.warn(`Missing optional extension, "${Y}".`)}}}function eV1(Z,J){let X=J.jsonDoc,Y=J.bufferViews[Z.bufferView],$=X.json.bufferViews[Z.bufferView],Q=GJ[Z.componentType],K=E0.getElementSize(Z.type),W=Q.BYTES_PER_ELEMENT,G=Z.byteOffset||0,z=new Q(Z.count*K),V=new DataView(Y.buffer,Y.byteOffset,Y.byteLength),H=$.byteStride;for(let q=0;q<Z.count;q++)for(let F=0;F<K;F++){let U=G+q*H+F*W,w;switch(Z.componentType){case E0.ComponentType.FLOAT:w=V.getFloat32(U,!0);break;case E0.ComponentType.UNSIGNED_INT:w=V.getUint32(U,!0);break;case E0.ComponentType.UNSIGNED_SHORT:w=V.getUint16(U,!0);break;case E0.ComponentType.UNSIGNED_BYTE:w=V.getUint8(U);break;case E0.ComponentType.SHORT:w=V.getInt16(U,!0);break;case E0.ComponentType.BYTE:w=V.getInt8(U);break;default:throw new Error(`Unexpected componentType "${Z.componentType}".`)}z[q*K+F]=w}return z}function fU(Z,J){let X=J.jsonDoc,Y=J.bufferViews[Z.bufferView],$=X.json.bufferViews[Z.bufferView],Q=GJ[Z.componentType],K=E0.getElementSize(Z.type),W=Q.BYTES_PER_ELEMENT,G=K*W;if($.byteStride!==void 0&&$.byteStride!==G)return eV1(Z,J);let z=Y.byteOffset+(Z.byteOffset||0),V=Z.count*K*W;return new Q(Y.buffer.slice(z,z+V))}function ZH1(Z,J){let X=GJ[Z.componentType],Y=E0.getElementSize(Z.type),$;if(Z.bufferView!==void 0)$=fU(Z,J);else $=new X(Z.count*Y);let Q=Z.sparse;if(!Q)return $;let K=Q.count,W=c6({},Z,Q.indices,{count:K,type:"SCALAR"}),G=c6({},Z,Q.values,{count:K}),z=fU(W,J),V=fU(G,J);for(let H=0;H<W.count;H++)for(let q=0;q<Y;q++)$[z[H]*Y+q]=V[H*Y+q];return $}var Y3;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(Y3||(Y3={}));class KJ{constructor(Z,J,X){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=X;let Y=Z.getRoot(),$=Y.listBuffers().length,Q=Y.listTextures().length;this.bufferURIGenerator=new PP($>1,()=>X.basename||"buffer"),this.imageURIGenerator=new PP(Q>1,(K)=>JH1(Z,K)||X.basename||"texture"),this.logger=Z.getLogger()}createTextureInfoDef(Z,J){let X={magFilter:J.getMagFilter()||void 0,minFilter:J.getMinFilter()||void 0,wrapS:J.getWrapS(),wrapT:J.getWrapT()},Y=JSON.stringify(X);if(!this.samplerDefIndexMap.has(Y))this.samplerDefIndexMap.set(Y,this.jsonDoc.json.samplers.length),this.jsonDoc.json.samplers.push(X);let $={source:this.imageIndexMap.get(Z),sampler:this.samplerDefIndexMap.get(Y)},Q=JSON.stringify($);if(!this.textureDefIndexMap.has(Q))this.textureDefIndexMap.set(Q,this.jsonDoc.json.textures.length),this.jsonDoc.json.textures.push($);let K={index:this.textureDefIndexMap.get(Q)};if(J.getTexCoord()!==0)K.texCoord=J.getTexCoord();if(Object.keys(J.getExtras()).length>0)K.extras=J.getExtras();return this.textureInfoDefMap.set(J,K),K}createPropertyDef(Z){let J={};if(Z.getName())J.name=Z.getName();if(Object.keys(Z.getExtras()).length>0)J.extras=Z.getExtras();return J}createAccessorDef(Z){let J=this.createPropertyDef(Z);if(J.type=Z.getType(),J.componentType=Z.getComponentType(),J.count=Z.getCount(),this._doc.getGraph().listParentEdges(Z).some((Y)=>Y.getName()==="attributes"&&Y.getAttributes().key==="POSITION"||Y.getName()==="input"))J.max=Z.getMax([]).map(Math.fround),J.min=Z.getMin([]).map(Math.fround);if(Z.getNormalized())J.normalized=Z.getNormalized();return J}createImageData(Z,J,X){if(this.options.format===$Z.GLB)this.imageBufferViews.push(J),Z.bufferView=this.jsonDoc.json.bufferViews.length,this.jsonDoc.json.bufferViews.push({buffer:0,byteOffset:-1,byteLength:J.byteLength});else{let Y=QZ.mimeTypeToExtension(X.getMimeType());Z.uri=this.imageURIGenerator.createURI(X,Y),this.assignResourceURI(Z.uri,J,!1)}}assignResourceURI(Z,J,X){let Y=this.jsonDoc.resources;if(!(Z in Y)){Y[Z]=J;return}if(J===Y[Z]){this.logger.warn(`Duplicate resource URI, "${Z}".`);return}let $=`Resource URI "${Z}" already assigned to different data.`;if(!X){this.logger.warn($);return}throw new Error($)}getAccessorUsage(Z){let J=this._accessorUsageMap.get(Z);if(J)return J;if(Z.getSparse())return d5.SPARSE;for(let X of this._doc.getGraph().listParentEdges(Z)){let{usage:Y}=X.getAttributes();if(Y)return Y;if(X.getParent().propertyType!==a.ROOT)this.logger.warn(`Missing attribute ".usage" on edge, "${X.getName()}".`)}return d5.OTHER}addAccessorToUsageGroup(Z,J){let X=this._accessorUsageMap.get(Z);if(X&&X!==J)throw new Error(`Accessor with usage "${X}" cannot be reused as "${J}".`);return this._accessorUsageMap.set(Z,J),this}}KJ.BufferViewTarget=Y3;KJ.BufferViewUsage=d5;KJ.USAGE_TO_TARGET={[d5.ARRAY_BUFFER]:Y3.ARRAY_BUFFER,[d5.ELEMENT_ARRAY_BUFFER]:Y3.ELEMENT_ARRAY_BUFFER};class PP{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 X=this.basename(Z);return this.counter[X]=this.counter[X]||1,`${X}_${this.counter[X]++}.${J}`}}}function JH1(Z,J){let X=Z.getGraph().listParentEdges(J).find((Y)=>Y.getParent()!==Z.getRoot());return X?X.getName().replace(/texture$/i,""):""}var{BufferViewUsage:hU}=KJ,{UNSIGNED_INT:XH1,UNSIGNED_SHORT:YH1,UNSIGNED_BYTE:$H1}=E0.ComponentType,QH1=new Set([a.ACCESSOR,a.BUFFER,a.MATERIAL,a.MESH]);class _c{static write(Z,J){let X=Z.getGraph(),Y=Z.getRoot(),$={asset:c6({generator:`glTF-Transform ${Pc}`},Y.getAsset()),extras:c6({},Y.getExtras())},Q={json:$,resources:{}},K=new KJ(Z,Q,J),W=J.logger||j5.DEFAULT_INSTANCE,G=new Set(J.extensions.map((L)=>L.EXTENSION_NAME)),z=Z.getRoot().listExtensionsUsed().filter((L)=>G.has(L.extensionName)).sort((L,j)=>L.extensionName>j.extensionName?1:-1),V=Z.getRoot().listExtensionsRequired().filter((L)=>G.has(L.extensionName)).sort((L,j)=>L.extensionName>j.extensionName?1:-1);if(z.length<Z.getRoot().listExtensionsUsed().length)W.warn("Some extensions were not registered for I/O, and will not be written.");for(let L of z){let j=L.prewriteTypes.filter((R)=>!QH1.has(R));if(j.length)W.warn(`Prewrite hooks for some types (${j.join()}), requested by extension ${L.extensionName}, are unsupported. Please file an issue or a PR.`);for(let R of L.writeDependencies)L.install(R,J.dependencies[R])}function H(L,j,R,O){let N=[],D=0;for(let T of L){let k=K.createAccessorDef(T);k.bufferView=$.bufferViews.length;let A=T.getArray(),S=n0.pad(n0.toView(A));k.byteOffset=D,D+=S.byteLength,N.push(S),K.accessorIndexMap.set(T,$.accessors.length),$.accessors.push(k)}let P=n0.concat(N),C={buffer:j,byteOffset:R,byteLength:P.byteLength};if(O)C.target=O;return $.bufferViews.push(C),{buffers:N,byteLength:D}}function q(L,j,R){let O=L[0].getCount(),N=0;for(let k of L){let A=K.createAccessorDef(k);A.bufferView=$.bufferViews.length,A.byteOffset=N;let S=k.getElementSize(),x=k.getComponentSize();N+=n0.padNumber(S*x),K.accessorIndexMap.set(k,$.accessors.length),$.accessors.push(A)}let D=O*N,P=new ArrayBuffer(D),C=new DataView(P);for(let k=0;k<O;k++){let A=0;for(let S of L){let x=S.getElementSize(),I=S.getComponentSize(),v=S.getComponentType(),f=S.getArray();for(let p=0;p<x;p++){let n=k*N+A+p*I,o=f[k*x+p];switch(v){case E0.ComponentType.FLOAT:C.setFloat32(n,o,!0);break;case E0.ComponentType.BYTE:C.setInt8(n,o);break;case E0.ComponentType.SHORT:C.setInt16(n,o,!0);break;case E0.ComponentType.UNSIGNED_BYTE:C.setUint8(n,o);break;case E0.ComponentType.UNSIGNED_SHORT:C.setUint16(n,o,!0);break;case E0.ComponentType.UNSIGNED_INT:C.setUint32(n,o,!0);break;default:throw new Error("Unexpected component type: "+v)}}A+=n0.padNumber(x*I)}}let T={buffer:j,byteOffset:R,byteLength:D,byteStride:N,target:KJ.BufferViewTarget.ARRAY_BUFFER};return $.bufferViews.push(T),{byteLength:D,buffers:[new Uint8Array(P)]}}function F(L,j,R){let O=[],N=0,D=new Map,P=-1/0,C=!1;for(let v of L){let f=K.createAccessorDef(v);$.accessors.push(f),K.accessorIndexMap.set(v,$.accessors.length-1);let p=[],n=[],o=[],J0=new Array(v.getElementSize()).fill(0);for(let a0=0,v8=v.getCount();a0<v8;a0++){if(v.getElement(a0,o),d0.eq(o,J0,0))continue;P=Math.max(a0,P),p.push(a0);for(let s1=0;s1<o.length;s1++)n.push(o[s1])}let Q0=p.length,C0={accessorDef:f,count:Q0};if(D.set(v,C0),Q0===0)continue;if(Q0>v.getCount()/2)C=!0;let T0=GJ[v.getComponentType()];C0.indices=p,C0.values=new T0(n)}if(!Number.isFinite(P))return{buffers:O,byteLength:N};if(C)W.warn("Some sparse accessors have >50% non-zero elements, which may increase file size.");let T=P<255?Uint8Array:P<65535?Uint16Array:Uint32Array,k=P<255?$H1:P<65535?YH1:XH1,A={buffer:j,byteOffset:R+N,byteLength:0};for(let v of L){let f=D.get(v);if(f.count===0)continue;f.indicesByteOffset=A.byteLength;let p=n0.pad(n0.toView(new T(f.indices)));O.push(p),N+=p.byteLength,A.byteLength+=p.byteLength}$.bufferViews.push(A);let S=$.bufferViews.length-1,x={buffer:j,byteOffset:R+N,byteLength:0};for(let v of L){let f=D.get(v);if(f.count===0)continue;f.valuesByteOffset=x.byteLength;let p=n0.pad(n0.toView(f.values));O.push(p),N+=p.byteLength,x.byteLength+=p.byteLength}$.bufferViews.push(x);let I=$.bufferViews.length-1;for(let v of L){let f=D.get(v);if(f.count===0)continue;f.accessorDef.sparse={count:f.count,indices:{bufferView:S,byteOffset:f.indicesByteOffset,componentType:k},values:{bufferView:I,byteOffset:f.valuesByteOffset}}}return{buffers:O,byteLength:N}}if($.accessors=[],$.bufferViews=[],$.samplers=[],$.textures=[],$.images=Y.listTextures().map((L,j)=>{let R=K.createPropertyDef(L);if(L.getMimeType())R.mimeType=L.getMimeType();let O=L.getImage();if(O)K.createImageData(R,O,L);return K.imageIndexMap.set(L,j),R}),z.filter((L)=>L.prewriteTypes.includes(a.ACCESSOR)).forEach((L)=>L.prewrite(K,a.ACCESSOR)),Y.listAccessors().forEach((L)=>{let{accessorUsageGroupedByParent:j,accessorParents:R}=K;if(K.accessorIndexMap.has(L))return;let O=K.getAccessorUsage(L);if(K.addAccessorToUsageGroup(L,O),j.has(O)){let N=X.listParents(L).find((D)=>D.propertyType!==a.ROOT);R.set(L,N)}}),z.filter((L)=>L.prewriteTypes.includes(a.BUFFER)).forEach((L)=>L.prewrite(K,a.BUFFER)),(Y.listAccessors().length>0||K.otherBufferViews.size>0||Y.listTextures().length>0&&J.format===$Z.GLB)&&Y.listBuffers().length===0)throw new Error("Buffer required for Document resources, but none was found.");if($.buffers=[],Y.listBuffers().forEach((L,j)=>{let R=K.createPropertyDef(L),O=K.accessorUsageGroupedByParent,N=L.listParents().filter((x)=>x instanceof E0),D=new Set(N.map((x)=>K.accessorParents.get(x))),P=new Map(Array.from(D).map((x,I)=>[x,I])),C={};for(let x of N){var T;if(K.accessorIndexMap.has(x))continue;let I=K.getAccessorUsage(x),v=I;if(O.has(I)){let f=K.accessorParents.get(x);v+=`:${P.get(f)}`}C[T=v]||(C[T]={usage:I,accessors:[]}),C[v].accessors.push(x)}let k=[],A=$.buffers.length,S=0;for(let{usage:x,accessors:I}of Object.values(C))if(x===hU.ARRAY_BUFFER&&J.vertexLayout===yU.INTERLEAVED){let v=q(I,A,S);S+=v.byteLength;for(let f of v.buffers)k.push(f)}else if(x===hU.ARRAY_BUFFER)for(let v of I){let f=q([v],A,S);S+=f.byteLength;for(let p of f.buffers)k.push(p)}else if(x===hU.SPARSE){let v=F(I,A,S);S+=v.byteLength;for(let f of v.buffers)k.push(f)}else if(x===hU.ELEMENT_ARRAY_BUFFER){let v=KJ.BufferViewTarget.ELEMENT_ARRAY_BUFFER,f=H(I,A,S,v);S+=f.byteLength;for(let p of f.buffers)k.push(p)}else{let v=H(I,A,S);S+=v.byteLength;for(let f of v.buffers)k.push(f)}if(K.imageBufferViews.length&&j===0){for(let x=0;x<K.imageBufferViews.length;x++)if($.bufferViews[$.images[x].bufferView].byteOffset=S,S+=K.imageBufferViews[x].byteLength,k.push(K.imageBufferViews[x]),S%8){let I=8-S%8;S+=I,k.push(new Uint8Array(I))}}if(K.otherBufferViews.has(L))for(let x of K.otherBufferViews.get(L))$.bufferViews.push({buffer:A,byteOffset:S,byteLength:x.byteLength}),K.otherBufferViewsIndexMap.set(x,$.bufferViews.length-1),S+=x.byteLength,k.push(x);if(S){let x;if(J.format===$Z.GLB)x=bU;else x=K.bufferURIGenerator.createURI(L,"bin"),R.uri=x;R.byteLength=S,K.assignResourceURI(x,n0.concat(k),!0)}$.buffers.push(R),K.bufferIndexMap.set(L,j)}),Y.listAccessors().find((L)=>!L.getBuffer()))W.warn("Skipped writing one or more Accessors: no Buffer assigned.");z.filter((L)=>L.prewriteTypes.includes(a.MATERIAL)).forEach((L)=>L.prewrite(K,a.MATERIAL)),$.materials=Y.listMaterials().map((L,j)=>{let R=K.createPropertyDef(L);if(L.getAlphaMode()!==t4.AlphaMode.OPAQUE)R.alphaMode=L.getAlphaMode();if(L.getAlphaMode()===t4.AlphaMode.MASK)R.alphaCutoff=L.getAlphaCutoff();if(L.getDoubleSided())R.doubleSided=!0;if(R.pbrMetallicRoughness={},!d0.eq(L.getBaseColorFactor(),[1,1,1,1]))R.pbrMetallicRoughness.baseColorFactor=L.getBaseColorFactor();if(!d0.eq(L.getEmissiveFactor(),[0,0,0]))R.emissiveFactor=L.getEmissiveFactor();if(L.getRoughnessFactor()!==1)R.pbrMetallicRoughness.roughnessFactor=L.getRoughnessFactor();if(L.getMetallicFactor()!==1)R.pbrMetallicRoughness.metallicFactor=L.getMetallicFactor();if(L.getBaseColorTexture()){let O=L.getBaseColorTexture(),N=L.getBaseColorTextureInfo();R.pbrMetallicRoughness.baseColorTexture=K.createTextureInfoDef(O,N)}if(L.getEmissiveTexture()){let O=L.getEmissiveTexture(),N=L.getEmissiveTextureInfo();R.emissiveTexture=K.createTextureInfoDef(O,N)}if(L.getNormalTexture()){let O=L.getNormalTexture(),N=L.getNormalTextureInfo(),D=K.createTextureInfoDef(O,N);if(L.getNormalScale()!==1)D.scale=L.getNormalScale();R.normalTexture=D}if(L.getOcclusionTexture()){let O=L.getOcclusionTexture(),N=L.getOcclusionTextureInfo(),D=K.createTextureInfoDef(O,N);if(L.getOcclusionStrength()!==1)D.strength=L.getOcclusionStrength();R.occlusionTexture=D}if(L.getMetallicRoughnessTexture()){let O=L.getMetallicRoughnessTexture(),N=L.getMetallicRoughnessTextureInfo();R.pbrMetallicRoughness.metallicRoughnessTexture=K.createTextureInfoDef(O,N)}return K.materialIndexMap.set(L,j),R}),z.filter((L)=>L.prewriteTypes.includes(a.MESH)).forEach((L)=>L.prewrite(K,a.MESH)),$.meshes=Y.listMeshes().map((L,j)=>{let R=K.createPropertyDef(L),O=null;if(R.primitives=L.listPrimitives().map((N)=>{let D={attributes:{}};D.mode=N.getMode();let P=N.getMaterial();if(P)D.material=K.materialIndexMap.get(P);if(Object.keys(N.getExtras()).length)D.extras=N.getExtras();let C=N.getIndices();if(C)D.indices=K.accessorIndexMap.get(C);for(let T of N.listSemantics())D.attributes[T]=K.accessorIndexMap.get(N.getAttribute(T));for(let T of N.listTargets()){let k={};for(let A of T.listSemantics())k[A]=K.accessorIndexMap.get(T.getAttribute(A));D.targets=D.targets||[],D.targets.push(k)}if(N.listTargets().length&&!O)O=N.listTargets().map((T)=>T.getName());return D}),L.getWeights().length)R.weights=L.getWeights();if(O)R.extras=R.extras||{},R.extras.targetNames=O;return K.meshIndexMap.set(L,j),R}),$.cameras=Y.listCameras().map((L,j)=>{let R=K.createPropertyDef(L);if(R.type=L.getType(),R.type===tX.Type.PERSPECTIVE){R.perspective={znear:L.getZNear(),zfar:L.getZFar(),yfov:L.getYFov()};let O=L.getAspectRatio();if(O!==null)R.perspective.aspectRatio=O}else R.orthographic={znear:L.getZNear(),zfar:L.getZFar(),xmag:L.getXMag(),ymag:L.getYMag()};return K.cameraIndexMap.set(L,j),R}),$.nodes=Y.listNodes().map((L,j)=>{let R=K.createPropertyDef(L);if(!d0.eq(L.getTranslation(),[0,0,0]))R.translation=L.getTranslation();if(!d0.eq(L.getRotation(),[0,0,0,1]))R.rotation=L.getRotation();if(!d0.eq(L.getScale(),[1,1,1]))R.scale=L.getScale();if(L.getWeights().length)R.weights=L.getWeights();return K.nodeIndexMap.set(L,j),R}),$.skins=Y.listSkins().map((L,j)=>{let R=K.createPropertyDef(L),O=L.getInverseBindMatrices();if(O)R.inverseBindMatrices=K.accessorIndexMap.get(O);let N=L.getSkeleton();if(N)R.skeleton=K.nodeIndexMap.get(N);return R.joints=L.listJoints().map((D)=>K.nodeIndexMap.get(D)),K.skinIndexMap.set(L,j),R}),Y.listNodes().forEach((L,j)=>{let R=$.nodes[j],O=L.getMesh();if(O)R.mesh=K.meshIndexMap.get(O);let N=L.getCamera();if(N)R.camera=K.cameraIndexMap.get(N);let D=L.getSkin();if(D)R.skin=K.skinIndexMap.get(D);if(L.listChildren().length>0)R.children=L.listChildren().map((P)=>K.nodeIndexMap.get(P))}),$.animations=Y.listAnimations().map((L,j)=>{let R=K.createPropertyDef(L),O=new Map;return R.samplers=L.listSamplers().map((N,D)=>{let P=K.createPropertyDef(N);return P.input=K.accessorIndexMap.get(N.getInput()),P.output=K.accessorIndexMap.get(N.getOutput()),P.interpolation=N.getInterpolation(),O.set(N,D),P}),R.channels=L.listChannels().map((N)=>{let D=K.createPropertyDef(N);return D.sampler=O.get(N.getSampler()),D.target={node:K.nodeIndexMap.get(N.getTargetNode()),path:N.getTargetPath()},D}),K.animationIndexMap.set(L,j),R}),$.scenes=Y.listScenes().map((L,j)=>{let R=K.createPropertyDef(L);return R.nodes=L.listChildren().map((O)=>K.nodeIndexMap.get(O)),K.sceneIndexMap.set(L,j),R});let w=Y.getDefaultScene();if(w)$.scene=Y.listScenes().indexOf(w);return $.extensionsUsed=z.map((L)=>L.extensionName),$.extensionsRequired=V.map((L)=>L.extensionName),z.forEach((L)=>L.write(K)),KH1($),Q}}function KH1(Z){let J=[];for(let X in Z){let Y=Z[X];if(Array.isArray(Y)&&Y.length===0)J.push(X);else if(Y===null||Y==="")J.push(X);else if(Y&&typeof Y==="object"&&Object.keys(Y).length===0)J.push(X)}for(let X of J)delete Z[X]}var uU;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(uU||(uU={}));class Ac{constructor(){this._logger=j5.DEFAULT_INSTANCE,this._extensions=new Set,this._dependencies={},this._vertexLayout=yU.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 X=Nc(J)?this._binaryToJSON(J):{json:JSON.parse(n0.decodeText(J)),resources:{}};return await this._readResourcesExternal(X,this.dirname(Z)),this._readResourcesInternal(X),X}async readJSON(Z){return Z=this._copyJSON(Z),this._readResourcesInternal(Z),Sc.read(Z,{extensions:Array.from(this._extensions),dependencies:this._dependencies,logger:this._logger})}async binaryToJSON(Z){let J=this._binaryToJSON(n0.assertView(Z));this._readResourcesInternal(J);let X=J.json;if(X.buffers&&X.buffers.some((Y)=>WH1(J,Y)))throw new Error("Cannot resolve external buffers with binaryToJSON().");else if(X.images&&X.images.some((Y)=>GH1(J,Y)))throw new Error("Cannot resolve external images with binaryToJSON().");return J}async readBinary(Z){return this.readJSON(await this.binaryToJSON(n0.assertView(Z)))}async writeJSON(Z,J={}){if(J.format===$Z.GLB&&Z.getRoot().listBuffers().length>1)throw new Error("GLB must have 0\u20131 buffers.");return _c.write(Z,{format:J.format||$Z.GLTF,basename:J.basename||"",logger:this._logger,vertexLayout:this._vertexLayout,dependencies:c6({},this._dependencies),extensions:Array.from(this._extensions)})}async writeBinary(Z){let{json:J,resources:X}=await this.writeJSON(Z,{format:$Z.GLB}),Y=new Uint32Array([1179937895,2,12]),$=JSON.stringify(J),Q=n0.pad(n0.encodeText($),32),K=n0.toView(new Uint32Array([Q.byteLength,1313821514])),W=n0.concat([K,Q]);Y[Y.length-1]+=W.byteLength;let G=Object.values(X)[0];if(!G||!G.byteLength)return n0.concat([n0.toView(Y),W]);let z=n0.pad(G,0),V=n0.toView(new Uint32Array([z.byteLength,5130562])),H=n0.concat([V,z]);return Y[Y.length-1]+=H.byteLength,n0.concat([n0.toView(Y),W,H])}async _readResourcesExternal(Z,J){var X=this;let Y=Z.json.images||[],$=Z.json.buffers||[],Q=[...Y,...$].map(async function(K){let W=K.uri;if(!W||W.match(/data:/))return Promise.resolve();Z.resources[W]=await X.readURI(X.resolve(J,W),"view"),X.lastReadBytes+=Z.resources[W].byteLength});await Promise.all(Q)}_readResourcesInternal(Z){function J($){if(!$.uri)return;if($.uri in Z.resources){n0.assertView(Z.resources[$.uri]);return}if($.uri.match(/data:/)){let Q=`__${Ec()}.${KZ.extension($.uri)}`;Z.resources[Q]=n0.createBufferFromDataURI($.uri),$.uri=Q}}(Z.json.images||[]).forEach(($)=>{if($.bufferView===void 0&&$.uri===void 0)throw new Error("Missing resource URI or buffer view.");J($)}),(Z.json.buffers||[]).forEach(J)}_copyJSON(Z){let{images:J,buffers:X}=Z.json;if(Z={json:c6({},Z.json),resources:c6({},Z.resources)},J)Z.json.images=J.map((Y)=>c6({},Y));if(X)Z.json.buffers=X.map((Y)=>c6({},Y));return Z}_binaryToJSON(Z){if(!Nc(Z))throw new Error("Invalid glTF 2.0 binary.");let J=new Uint32Array(Z.buffer,Z.byteOffset+12,2);if(J[1]!==uU.JSON)throw new Error("Missing required GLB JSON chunk.");let X=20,Y=J[0],$=n0.decodeText(n0.toView(Z,X,Y)),Q=JSON.parse($),K=X+Y;if(Z.byteLength<=K)return{json:Q,resources:{}};let W=new Uint32Array(Z.buffer,Z.byteOffset+K,2);if(W[1]!==uU.BIN)return{json:Q,resources:{}};let G=W[0],z=n0.toView(Z,K+8,G);return{json:Q,resources:{[bU]:z}}}}function WH1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)}function GH1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)&&J.bufferView===void 0}function Nc(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 vP extends Ac{constructor(Z=null,J=j9.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(),j9.isAbsoluteURL(Z)){if(!this._fetchEnabled||!this._fetch)throw new Error("Network request blocked. Allow HTTP requests explicitly, if needed.");let X=await this._fetch(Z,this._fetchConfig);switch(J){case"view":return new Uint8Array(await X.arrayBuffer());case"text":return X.text()}}else switch(J){case"view":return this._fs.readFile(Z);case"text":return this._fs.readFile(Z,"utf8")}}resolve(Z,J){if(j9.isAbsoluteURL(Z)||j9.isAbsoluteURL(J))return j9.resolve(Z,J);return this._path.resolve(Z,decodeURIComponent(J))}dirname(Z){if(j9.isAbsoluteURL(Z))return j9.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 X=this;this.lastWriteBytes=0;let{json:Y,resources:$}=await this.writeJSON(J,{format:$Z.GLTF,basename:KZ.basename(Z)}),{_fs:Q,_path:K}=this,W=K.dirname(Z),G=JSON.stringify(Y,null,2);await Q.writeFile(Z,G),this.lastWriteBytes+=G.length;for(let z of zH1(Object.keys($),10))await Promise.all(z.map(async function(V){if(j9.isAbsoluteURL(V)){if(j9.extension(V)==="bin")throw new Error(`Cannot write buffer to path "${V}".`);return}let H=K.join(W,decodeURIComponent(V));await Q.mkdir(K.dirname(H),{recursive:!0}),await Q.writeFile(H,$[V]),X.lastWriteBytes+=$[V].byteLength}))}async _writeGLB(Z,J){let X=await this.writeBinary(J);await this._fs.writeFile(Z,X),this.lastWriteBytes=X.byteLength}}function zH1(Z,J){let X=[];for(let Y=0,$=Z.length;Y<$;Y+=J){let Q=[];for(let K=0;K<J&&Y+K<$;K++)Q.push(Z[Y+K]);X.push(Q)}return X}var Ii=t(SP(),1),vi=t(qi(),1),ZL1=t(Ei(),1);async function JL1(Z,J){if(!(Z instanceof Uint8Array))throw new Error("[ndarray-pixels] Input must be Uint8Array or Buffer.");let{data:X,info:Y}=await vi.default(Z).ensureAlpha().raw().toBuffer({resolveWithObject:!0});return Ii.default(new Uint8Array(X),[Y.width,Y.height,4],[4,4*Y.width|0,1],0)}async function Si(Z,J){return JL1(Z)}var XL1="v4.1.3",zD="@glb.bin",s;(function(Z){Z.ACCESSOR="Accessor",Z.ANIMATION="Animation",Z.ANIMATION_CHANNEL="AnimationChannel",Z.ANIMATION_SAMPLER="AnimationSampler",Z.BUFFER="Buffer",Z.CAMERA="Camera",Z.MATERIAL="Material",Z.MESH="Mesh",Z.PRIMITIVE="Primitive",Z.PRIMITIVE_TARGET="PrimitiveTarget",Z.NODE="Node",Z.ROOT="Root",Z.SCENE="Scene",Z.SKIN="Skin",Z.TEXTURE="Texture",Z.TEXTURE_INFO="TextureInfo"})(s||(s={}));var _i;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(_i||(_i={}));var p5;(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"})(p5||(p5={}));var i5;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(i5||(i5={}));var YD;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(YD||(YD={}));var $D=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 YL1(){var Z=new $D(3);if($D!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function XD(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function $L1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=X[3]*Y+X[7]*$+X[11]*Q+X[15];return K=K||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/K,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/K,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/K,Z}(function(){var Z=YL1();return function(J,X,Y,$,Q,K){var W,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(W=Y;W<G;W+=X)Z[0]=J[W],Z[1]=J[W+1],Z[2]=J[W+2],Q(Z,Z,K),J[W]=Z[0],J[W+1]=Z[1],J[W+2]=Z[2];return J}})();function fi(Z){let J=bi(),X=Z.propertyType===s.NODE?[Z]:Z.listChildren();for(let Y of X)Y.traverse(($)=>{let Q=$.getMesh();if(!Q)return;let K=QL1(Q,$.getWorldMatrix());if(K.min.every(isFinite)&&K.max.every(isFinite))QD(K.min,J),QD(K.max,J)});return J}function QL1(Z,J){let X=bi();for(let Y of Z.listPrimitives()){let $=Y.getAttribute("POSITION"),Q=Y.getIndices();if(!$)continue;let K=[0,0,0],W=[0,0,0];for(let G=0,z=Q?Q.getCount():$.getCount();G<z;G++){let V=Q?Q.getScalar(G):G;K=$.getElement(V,K),W=$L1(W,K,J),QD(W,X)}}return X}function QD(Z,J){for(let X=0;X<3;X++)J.min[X]=Math.min(Z[X],J.min[X]),J.max[X]=Math.max(Z[X],J.max[X])}function bi(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class k6{static createBufferFromDataURI(Z){if(typeof Buffer==="undefined"){let J=atob(Z.split(",")[1]),X=new Uint8Array(J.length);for(let Y=0;Y<J.length;Y++)X[Y]=J.charCodeAt(Y);return X}else{let J=Z.split(",")[1],X=Z.indexOf("base64")>=0;return Buffer.from(J,X?"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 $ of Z)J+=$.byteLength;let X=new Uint8Array(J),Y=0;for(let $ of Z)X.set($,Y),Y+=$.byteLength;return X}static pad(Z,J=0){let X=this.padNumber(Z.byteLength);if(X===Z.byteLength)return Z;let Y=new Uint8Array(X);if(Y.set(Z),J!==0)for(let $=Z.byteLength;$<X;$++)Y[$]=J;return Y}static padNumber(Z){return Math.ceil(Z/4)*4}static equals(Z,J){if(Z===J)return!0;if(Z.byteLength!==J.byteLength)return!1;let X=Z.byteLength;while(X--)if(Z[X]!==J[X])return!1;return!0}static toView(Z,J=0,X=1/0){return new Uint8Array(Z.buffer,Z.byteOffset+J,Math.min(Z.byteLength,X))}static assertView(Z){if(Z&&!ArrayBuffer.isView(Z))throw new Error(`Method requires Uint8Array parameter; received "${typeof Z}".`);return Z}}class yi{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),X,Y;while(J.byteLength){if(X=J.getUint16(0,!1),KL1(J,X),Y=J.getUint8(X+1),Y===192||Y===193||Y===194)return[J.getUint16(X+7,!1),J.getUint16(X+5,!1)];J=new DataView(Z.buffer,J.byteOffset+X+2)}throw new TypeError("Invalid JPG, no size found")}getChannels(Z){return 3}}class O2{match(Z){return Z.length>=8&&Z[0]===137&&Z[1]===80&&Z[2]===78&&Z[3]===71&&Z[4]===13&&Z[5]===10&&Z[6]===26&&Z[7]===10}getSize(Z){let J=new DataView(Z.buffer,Z.byteOffset);if(k6.decodeText(Z.slice(12,16))===O2.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}}O2.PNG_FRIED_CHUNK_NAME="CgBI";class V4{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 X=0,Y=4,$=this.getSize(Z,J);if(!$)return null;while($[0]>1||$[1]>1)X+=$[0]*$[1]*Y,$[0]=Math.max(Math.floor($[0]/2),1),$[1]=Math.max(Math.floor($[1]/2),1);return X+=1*Y,X}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}`}}V4.impls={"image/jpeg":new yi,"image/png":new O2};function KL1(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 U3{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 V4.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 Ai(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function $Y(Z){if(Ai(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let X=J.prototype;if(Ai(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}var KD,WD;(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"})(WD||(WD={}));class $7{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=$7.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=$7.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=$7.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=$7.Verbosity.ERROR)console.error(Z)}}KD=$7;$7.Verbosity=WD;$7.DEFAULT_INSTANCE=new KD(KD.Verbosity.INFO);function WL1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],K=Z[5],W=Z[6],G=Z[7],z=Z[8],V=Z[9],H=Z[10],q=Z[11],F=Z[12],U=Z[13],w=Z[14],L=Z[15],j=J*K-X*Q,R=J*W-Y*Q,O=J*G-$*Q,N=X*W-Y*K,D=X*G-$*K,P=Y*G-$*W,C=z*U-V*F,T=z*w-H*F,k=z*L-q*F,A=V*w-H*U,S=V*L-q*U,x=H*L-q*w;return j*x-R*S+O*A+N*k-D*T+P*C}function GL1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=J[8],q=J[9],F=J[10],U=J[11],w=J[12],L=J[13],j=J[14],R=J[15],O=X[0],N=X[1],D=X[2],P=X[3];return Z[0]=O*Y+N*W+D*H+P*w,Z[1]=O*$+N*G+D*q+P*L,Z[2]=O*Q+N*z+D*F+P*j,Z[3]=O*K+N*V+D*U+P*R,O=X[4],N=X[5],D=X[6],P=X[7],Z[4]=O*Y+N*W+D*H+P*w,Z[5]=O*$+N*G+D*q+P*L,Z[6]=O*Q+N*z+D*F+P*j,Z[7]=O*K+N*V+D*U+P*R,O=X[8],N=X[9],D=X[10],P=X[11],Z[8]=O*Y+N*W+D*H+P*w,Z[9]=O*$+N*G+D*q+P*L,Z[10]=O*Q+N*z+D*F+P*j,Z[11]=O*K+N*V+D*U+P*R,O=X[12],N=X[13],D=X[14],P=X[15],Z[12]=O*Y+N*W+D*H+P*w,Z[13]=O*$+N*G+D*q+P*L,Z[14]=O*Q+N*z+D*F+P*j,Z[15]=O*K+N*V+D*U+P*R,Z}function zL1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[4],K=J[5],W=J[6],G=J[8],z=J[9],V=J[10];return Z[0]=Math.hypot(X,Y,$),Z[1]=Math.hypot(Q,K,W),Z[2]=Math.hypot(G,z,V),Z}function VL1(Z,J){var X=new $D(3);zL1(X,J);var Y=1/X[0],$=1/X[1],Q=1/X[2],K=J[0]*Y,W=J[1]*$,G=J[2]*Q,z=J[4]*Y,V=J[5]*$,H=J[6]*Q,q=J[8]*Y,F=J[9]*$,U=J[10]*Q,w=K+V+U,L=0;if(w>0)L=Math.sqrt(w+1)*2,Z[3]=0.25*L,Z[0]=(H-F)/L,Z[1]=(q-G)/L,Z[2]=(W-z)/L;else if(K>V&&K>U)L=Math.sqrt(1+K-V-U)*2,Z[3]=(H-F)/L,Z[0]=0.25*L,Z[1]=(W+z)/L,Z[2]=(q+G)/L;else if(V>U)L=Math.sqrt(1+V-K-U)*2,Z[3]=(q-G)/L,Z[0]=(W+z)/L,Z[1]=0.25*L,Z[2]=(H+F)/L;else L=Math.sqrt(1+U-K-V)*2,Z[3]=(W-z)/L,Z[0]=(q+G)/L,Z[1]=(H+F)/L,Z[2]=0.25*L;return Z}class W8{static identity(Z){return Z}static eq(Z,J,X=0.00001){if(Z.length!==J.length)return!1;for(let Y=0;Y<Z.length;Y++)if(Math.abs(Z[Y]-J[Y])>X)return!1;return!0}static clamp(Z,J,X){if(Z<J)return J;if(Z>X)return X;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(W8.clamp(Z,0,1)*65535);case 5121:return Math.round(W8.clamp(Z,0,1)*255);case 5122:return Math.round(W8.clamp(Z,-1,1)*32767);case 5120:return Math.round(W8.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,X,Y){let $=XD([Z[0],Z[1],Z[2]]),Q=XD([Z[4],Z[5],Z[6]]),K=XD([Z[8],Z[9],Z[10]]);if(WL1(Z)<0)$=-$;J[0]=Z[12],J[1]=Z[13],J[2]=Z[14];let G=Z.slice(),z=1/$,V=1/Q,H=1/K;G[0]*=z,G[1]*=z,G[2]*=z,G[4]*=V,G[5]*=V,G[6]*=V,G[8]*=H,G[9]*=H,G[10]*=H,VL1(X,G),Y[0]=$,Y[1]=Q,Y[2]=K}static compose(Z,J,X,Y){let $=Y,Q=J[0],K=J[1],W=J[2],G=J[3],z=Q+Q,V=K+K,H=W+W,q=Q*z,F=Q*V,U=Q*H,w=K*V,L=K*H,j=W*H,R=G*z,O=G*V,N=G*H,D=X[0],P=X[1],C=X[2];return $[0]=(1-(w+j))*D,$[1]=(F+N)*D,$[2]=(U-O)*D,$[3]=0,$[4]=(F-N)*P,$[5]=(1-(q+j))*P,$[6]=(L+R)*P,$[7]=0,$[8]=(U+O)*C,$[9]=(L-R)*C,$[10]=(1-(q+w))*C,$[11]=0,$[12]=Z[0],$[13]=Z[1],$[14]=Z[2],$[15]=1,$}}function HL1(Z,J){if(!!Z!==!!J)return!1;let X=Z.getChild(),Y=J.getChild();return X===Y||X.equals(Y)}function qL1(Z,J){if(!!Z!==!!J)return!1;let X=Z.values(),Y=J.values();if(X.length!==Y.length)return!1;for(let $=0;$<X.length;$++){let Q=X[$],K=Y[$];if(Q.getChild()===K.getChild())continue;if(!Q.getChild().equals(K.getChild()))return!1}return!0}function FL1(Z,J){if(!!Z!==!!J)return!1;let X=Z.keys(),Y=J.keys();if(X.length!==Y.length)return!1;for(let $ of X){let Q=Z.get($),K=J.get($);if(!!Q!==!!K)return!1;let W=Q.getChild(),G=K.getChild();if(W===G)continue;if(!W.equals(G))return!1}return!0}function gi(Z,J){if(Z===J)return!0;if(!!Z!==!!J||!Z||!J)return!1;if(Z.length!==J.length)return!1;for(let X=0;X<Z.length;X++)if(Z[X]!==J[X])return!1;return!0}function mi(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!$Y(Z)||!$Y(J))return Z===J;let X=Z,Y=J,$=0,Q=0,K;for(K in X)$++;for(K in Y)Q++;if($!==Q)return!1;for(K in X){let W=X[K],G=Y[K];if(w2(W)&&w2(G)){if(!gi(W,G))return!1}else if($Y(W)&&$Y(G)){if(!mi(W,G))return!1}else if(W!==G)return!1}return!0}function w2(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var xi="https://null.example";class VD{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return U3.basename(new URL(Z,xi).pathname)}static extension(Z){return U3.extension(new URL(Z,xi).pathname)}static resolve(Z,J){if(!this.isRelativePath(J))return J;let X=Z.split("/"),Y=J.split("/");X.pop();for(let $=0;$<Y.length;$++){if(Y[$]===".")continue;if(Y[$]==="..")X.pop();else X.push(Y[$])}return X.join("/")}static isAbsoluteURL(Z){return this.PROTOCOL_REGEXP.test(Z)}static isRelativePath(Z){return!/^(?:[a-zA-Z]+:)?\//.test(Z)}}VD.DEFAULT_INIT={};VD.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var UJ=(Z)=>Z,UL1=new Set;class M2 extends TQ{constructor(Z,J=""){super(Z);this[A0].name=J,this.init(),this.dispatchEvent({type:"create"})}getGraph(){return this.graph}getDefaults(){return Object.assign(super.getDefaults(),{name:"",extras:{}})}set(Z,J){if(Array.isArray(J))J=J.slice();return super.set(Z,J)}getName(){return this.get("name")}setName(Z){return this.set("name",Z)}getExtras(){return this.get("extras")}setExtras(Z){return this.set("extras",Z)}clone(){return new this.constructor(this.graph).copy(this,UJ)}copy(Z,J=UJ){for(let X in this[A0]){let Y=this[A0][X];if(Y instanceof w5){if(!this[G4].has(X))Y.dispose()}else if(Y instanceof D6||Y instanceof N0)for(let $ of Y.values())$.dispose();else if(Y instanceof r1)for(let $ of Y.values())$.dispose()}for(let X in Z[A0]){let Y=this[A0][X],$=Z[A0][X];if($ instanceof w5)if(this[G4].has(X))Y.getChild().copy(J($.getChild()),J);else this.setRef(X,J($.getChild()),$.getAttributes());else if($ instanceof N0||$ instanceof D6)for(let Q of $.values())this.addRef(X,J(Q.getChild()),Q.getAttributes());else if($ instanceof r1)for(let Q of $.keys()){let K=$.get(Q);this.setRefMap(X,Q,J(K.getChild()),K.getAttributes())}else if($Y($))this[A0][X]=JSON.parse(JSON.stringify($));else if(Array.isArray($)||$ instanceof ArrayBuffer||ArrayBuffer.isView($))this[A0][X]=$.slice();else this[A0][X]=$}return this}equals(Z,J=UL1){if(this===Z)return!0;if(this.propertyType!==Z.propertyType)return!1;for(let X in this[A0]){if(J.has(X))continue;let Y=this[A0][X],$=Z[A0][X];if(Y instanceof w5||$ instanceof w5){if(!HL1(Y,$))return!1}else if(Y instanceof N0||$ instanceof N0||Y instanceof D6||$ instanceof D6){if(!qL1(Y,$))return!1}else if(Y instanceof r1||$ instanceof r1){if(!FL1(Y,$))return!1}else if($Y(Y)||$Y($)){if(!mi(Y,$))return!1}else if(w2(Y)||w2($)){if(!gi(Y,$))return!1}else if(Y!==$)return!1}return!0}detach(){return this.graph.disconnectParents(this,(Z)=>Z.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}}class E6 extends M2{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new r1})}getExtension(Z){return this.getRefMap("extensions",Z)}setExtension(Z,J){if(J)J._validateParent(this);return this.setRefMap("extensions",Z,J)}listExtensions(){return this.listRefMapValues("extensions")}}class O0 extends E6{init(){this.propertyType=s.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:O0.Type.SCALAR,componentType:O0.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(Z){switch(Z){case O0.Type.SCALAR:return 1;case O0.Type.VEC2:return 2;case O0.Type.VEC3:return 3;case O0.Type.VEC4:return 4;case O0.Type.MAT2:return 4;case O0.Type.MAT3:return 9;case O0.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+Z)}}static getComponentSize(Z){switch(Z){case O0.ComponentType.BYTE:return 1;case O0.ComponentType.UNSIGNED_BYTE:return 1;case O0.ComponentType.SHORT:return 2;case O0.ComponentType.UNSIGNED_SHORT:return 2;case O0.ComponentType.UNSIGNED_INT:return 4;case O0.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+Z)}}getMinNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMin(Z),J)for(let $=0;$<X;$++)Z[$]=W8.decodeNormalizedInt(Z[$],Y);return Z}getMin(Z){let J=this.getArray(),X=this.getCount(),Y=this.getElementSize();for(let $=0;$<Y;$++)Z[$]=1/0;for(let $=0;$<X*Y;$+=Y)for(let Q=0;Q<Y;Q++){let K=J[$+Q];if(Number.isFinite(K))Z[Q]=Math.min(Z[Q],K)}return Z}getMaxNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMax(Z),J)for(let $=0;$<X;$++)Z[$]=W8.decodeNormalizedInt(Z[$],Y);return Z}getMax(Z){let J=this.get("array"),X=this.getCount(),Y=this.getElementSize();for(let $=0;$<Y;$++)Z[$]=-1/0;for(let $=0;$<X*Y;$+=Y)for(let Q=0;Q<Y;Q++){let K=J[$+Q];if(Number.isFinite(K))Z[Q]=Math.max(Z[Q],K)}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 O0.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(),X=this.getComponentType(),Y=this.getArray();if(this.getNormalized())return W8.decodeNormalizedInt(Y[Z*J],X);return Y[Z*J]}setScalar(Z,J){let X=this.getElementSize(),Y=this.getComponentType(),$=this.getArray();if(this.getNormalized())$[Z*X]=W8.encodeNormalizedInt(J,Y);else $[Z*X]=J;return this}getElement(Z,J){let X=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();for(let K=0;K<Y;K++)if(X)J[K]=W8.decodeNormalizedInt(Q[Z*Y+K],$);else J[K]=Q[Z*Y+K];return J}setElement(Z,J){let X=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();for(let K=0;K<Y;K++)if(X)Q[Z*Y+K]=W8.encodeNormalizedInt(J[K],$);else Q[Z*Y+K]=J[K];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?LL1(Z):O0.ComponentType.FLOAT),this.set("array",Z),this}getByteLength(){let Z=this.get("array");return Z?Z.byteLength:0}}O0.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};O0.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function LL1(Z){switch(Z.constructor){case Float32Array:return O0.ComponentType.FLOAT;case Uint32Array:return O0.ComponentType.UNSIGNED_INT;case Uint16Array:return O0.ComponentType.UNSIGNED_SHORT;case Uint8Array:return O0.ComponentType.UNSIGNED_BYTE;case Int16Array:return O0.ComponentType.SHORT;case Int8Array:return O0.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class HD extends E6{init(){this.propertyType=s.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new N0,samplers:new N0})}addChannel(Z){return this.addRef("channels",Z)}removeChannel(Z){return this.removeRef("channels",Z)}listChannels(){return this.listRefs("channels")}addSampler(Z){return this.addRef("samplers",Z)}removeSampler(Z){return this.removeRef("samplers",Z)}listSamplers(){return this.listRefs("samplers")}}class w3 extends E6{init(){this.propertyType=s.ANIMATION_CHANNEL}getDefaults(){return Object.assign(super.getDefaults(),{targetPath:null,targetNode:null,sampler:null})}getTargetPath(){return this.get("targetPath")}setTargetPath(Z){return this.set("targetPath",Z)}getTargetNode(){return this.getRef("targetNode")}setTargetNode(Z){return this.setRef("targetNode",Z)}getSampler(){return this.getRef("sampler")}setSampler(Z){return this.setRef("sampler",Z)}}w3.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class gQ extends E6{init(){this.propertyType=s.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:gQ.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:p5.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:p5.OTHER})}}gQ.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class qD extends E6{init(){this.propertyType=s.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(Z){return this.set("uri",Z)}}class B3 extends E6{init(){this.propertyType=s.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:B3.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)}}B3.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class n1 extends M2{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}n1.EXTENSION_NAME=void 0;class C1 extends E6{init(){this.propertyType=s.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:C1.WrapMode.REPEAT,wrapT:C1.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)}}C1.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};C1.MagFilter={NEAREST:9728,LINEAR:9729};C1.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:F2,G:U2,B:L2,A:wL1}=i5;class j3 extends E6{init(){this.propertyType=s.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:j3.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new C1(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new C1(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new C1(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new C1(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new C1(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:F2|U2|L2|wL1,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:F2|U2|L2,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:F2|U2|L2})}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:F2})}getRoughnessFactor(){return this.get("roughnessFactor")}setRoughnessFactor(Z){return this.set("roughnessFactor",Z)}getMetallicFactor(){return this.get("metallicFactor")}setMetallicFactor(Z){return this.set("metallicFactor",Z)}getMetallicRoughnessTexture(){return this.getRef("metallicRoughnessTexture")}getMetallicRoughnessTextureInfo(){return this.getRef("metallicRoughnessTexture")?this.getRef("metallicRoughnessTextureInfo"):null}setMetallicRoughnessTexture(Z){return this.setRef("metallicRoughnessTexture",Z,{channels:U2|L2})}}j3.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class FD extends E6{init(){this.propertyType=s.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new N0})}addPrimitive(Z){return this.addRef("primitives",Z)}removePrimitive(Z){return this.removeRef("primitives",Z)}listPrimitives(){return this.listRefs("primitives")}getWeights(){return this.get("weights")}setWeights(Z){return this.set("weights",Z)}}class UD extends E6{init(){this.propertyType=s.NODE}getDefaults(){return Object.assign(super.getDefaults(),{translation:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1],weights:[],camera:null,mesh:null,skin:null,children:new N0})}copy(Z,J=UJ){if(J===UJ)throw new Error("Node cannot be copied.");return super.copy(Z,J)}getTranslation(){return this.get("translation")}getRotation(){return this.get("rotation")}getScale(){return this.get("scale")}setTranslation(Z){return this.set("translation",Z)}setRotation(Z){return this.set("rotation",Z)}setScale(Z){return this.set("scale",Z)}getMatrix(){return W8.compose(this.get("translation"),this.get("rotation"),this.get("scale"),[])}setMatrix(Z){let J=this.get("translation").slice(),X=this.get("rotation").slice(),Y=this.get("scale").slice();return W8.decompose(Z,J,X,Y),this.set("translation",J).set("rotation",X).set("scale",Y)}getWorldTranslation(){let Z=[0,0,0];return W8.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return W8.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return W8.decompose(this.getWorldMatrix(),[0,0,0],[0,0,0,1],Z),Z}getWorldMatrix(){let Z=[];for(let Y=this;Y!=null;Y=Y.getParentNode())Z.push(Y);let J,X=Z.pop().getMatrix();while(J=Z.pop())GL1(X,X,J.getMatrix());return X}addChild(Z){let J=Z.getParentNode();if(J)J.removeChild(Z);for(let X of Z.listParents())if(X.propertyType===s.SCENE)X.removeChild(Z);return this.addRef("children",Z)}removeChild(Z){return this.removeRef("children",Z)}listChildren(){return this.listRefs("children")}getParentNode(){for(let Z of this.listParents())if(Z.propertyType===s.NODE)return Z;return null}getMesh(){return this.getRef("mesh")}setMesh(Z){return this.setRef("mesh",Z)}getCamera(){return this.getRef("camera")}setCamera(Z){return this.setRef("camera",Z)}getSkin(){return this.getRef("skin")}setSkin(Z){return this.setRef("skin",Z)}getWeights(){return this.get("weights")}setWeights(Z){return this.set("weights",Z)}traverse(Z){Z(this);for(let J of this.listChildren())J.traverse(Z);return this}}class LJ extends E6{init(){this.propertyType=s.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:LJ.Mode.TRIANGLES,material:null,indices:null,attributes:new r1,targets:new N0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:p5.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:p5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}getMaterial(){return this.getRef("material")}setMaterial(Z){return this.setRef("material",Z)}getMode(){return this.get("mode")}setMode(Z){return this.set("mode",Z)}listTargets(){return this.listRefs("targets")}addTarget(Z){return this.addRef("targets",Z)}removeTarget(Z){return this.removeRef("targets",Z)}}LJ.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class ui extends M2{init(){this.propertyType=s.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new r1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:p5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function B2(){return B2=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var X=arguments[J];for(var Y in X)({}).hasOwnProperty.call(X,Y)&&(Z[Y]=X[Y])}return Z},B2.apply(null,arguments)}class LD extends E6{init(){this.propertyType=s.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new N0})}copy(Z,J=UJ){if(J===UJ)throw new Error("Scene cannot be copied.");return super.copy(Z,J)}addChild(Z){let J=Z.getParentNode();if(J)J.removeChild(Z);return this.addRef("children",Z)}removeChild(Z){return this.removeRef("children",Z)}listChildren(){return this.listRefs("children")}traverse(Z){for(let J of this.listChildren())J.traverse(Z);return this}}class wD extends E6{init(){this.propertyType=s.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new N0})}getSkeleton(){return this.getRef("skeleton")}setSkeleton(Z){return this.setRef("skeleton",Z)}getInverseBindMatrices(){return this.getRef("inverseBindMatrices")}setInverseBindMatrices(Z){return this.setRef("inverseBindMatrices",Z,{usage:p5.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class BD extends E6{init(){this.propertyType=s.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||V4.extensionToMimeType(U3.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=V4.extensionToMimeType(U3.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",k6.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return V4.getSize(Z,this.getMimeType())}}class R2 extends E6{init(){this.propertyType=s.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${XL1}`,version:"2.0"},defaultScene:null,accessors:new N0,animations:new N0,buffers:new N0,cameras:new N0,materials:new N0,meshes:new N0,nodes:new N0,scenes:new N0,skins:new N0,textures:new N0})}constructor(Z){super(Z);this._extensions=new Set,Z.addEventListener("node:create",(J)=>{this._addChildOfRoot(J.target)})}clone(){throw new Error("Root cannot be cloned.")}copy(Z,J=UJ){if(J===UJ)throw new Error("Root cannot be copied.");this.set("asset",B2({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(B2({},Z.getExtras())),this.setDefaultScene(Z.getDefaultScene()?J(Z.getDefaultScene()):null);for(let X of Z.listRefMapKeys("extensions")){let Y=Z.getExtension(X);this.setExtension(X,J(Y))}return this}_addChildOfRoot(Z){if(Z instanceof LD)this.addRef("scenes",Z);else if(Z instanceof UD)this.addRef("nodes",Z);else if(Z instanceof B3)this.addRef("cameras",Z);else if(Z instanceof wD)this.addRef("skins",Z);else if(Z instanceof FD)this.addRef("meshes",Z);else if(Z instanceof j3)this.addRef("materials",Z);else if(Z instanceof BD)this.addRef("textures",Z);else if(Z instanceof HD)this.addRef("animations",Z);else if(Z instanceof O0)this.addRef("accessors",Z);else if(Z instanceof qD)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 j2{static fromGraph(Z){return j2._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new CQ,this._root=new R2(this._graph),this._logger=$7.DEFAULT_INSTANCE,j2._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((X)=>X.name);for(let X of Z)await X(this,{stack:J});return this}createExtension(Z){let J=Z.EXTENSION_NAME;return this.getRoot().listExtensionsUsed().find((Y)=>Y.extensionName===J)||new Z(this)}createScene(Z=""){return new LD(this._graph,Z)}createNode(Z=""){return new UD(this._graph,Z)}createCamera(Z=""){return new B3(this._graph,Z)}createSkin(Z=""){return new wD(this._graph,Z)}createMesh(Z=""){return new FD(this._graph,Z)}createPrimitive(){return new LJ(this._graph)}createPrimitiveTarget(Z=""){return new ui(this._graph,Z)}createMaterial(Z=""){return new j3(this._graph,Z)}createTexture(Z=""){return new BD(this._graph,Z)}createAnimation(Z=""){return new HD(this._graph,Z)}createAnimationChannel(Z=""){return new w3(this._graph,Z)}createAnimationSampler(Z=""){return new gQ(this._graph,Z)}createAccessor(Z="",J=null){if(!J)J=this.getRoot().listBuffers()[0];return new O0(this._graph,Z).setBuffer(J)}createBuffer(Z=""){return new qD(this._graph,Z)}}j2._GRAPH_DOCUMENTS=new WeakMap;class E1{constructor(Z){this.extensionName="",this.prereadTypes=[],this.prewriteTypes=[],this.readDependencies=[],this.writeDependencies=[],this.document=void 0,this.required=!1,this.properties=new Set,this._listener=void 0,this.document=Z,Z.getRoot()._enableExtension(this),this._listener=(X)=>{let Y=X,$=Y.target;if($ instanceof n1&&$.extensionName===this.extensionName){if(Y.type==="node:create")this._addExtensionProperty($);if(Y.type==="node:dispose")this._removeExtensionProperty($)}};let J=Z.getGraph();J.addEventListener("node:create",this._listener),J.addEventListener("node:dispose",this._listener)}dispose(){this.document.getRoot()._disableExtension(this);let Z=this.document.getGraph();Z.removeEventListener("node:create",this._listener),Z.removeEventListener("node:dispose",this._listener);for(let J of this.properties)J.dispose()}static register(){}isRequired(){return this.required}setRequired(Z){return this.required=Z,this}listProperties(){return Array.from(this.properties)}_addExtensionProperty(Z){return this.properties.add(Z),this}_removeExtensionProperty(Z){return this.properties.delete(Z),this}install(Z,J){return this}preread(Z,J){return this}prewrite(Z,J){return this}}E1.EXTENSION_NAME=void 0;var gz6={logger:$7.DEFAULT_INSTANCE,extensions:[],dependencies:{}},mz6=new Set([s.BUFFER,s.TEXTURE,s.MATERIAL,s.MESH,s.PRIMITIVE,s.NODE,s.SCENE]);var L3;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(L3||(L3={}));class wJ{constructor(Z,J,X){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=X;let Y=Z.getRoot(),$=Y.listBuffers().length,Q=Y.listTextures().length;this.bufferURIGenerator=new GD($>1,()=>X.basename||"buffer"),this.imageURIGenerator=new GD(Q>1,(K)=>BL1(Z,K)||X.basename||"texture"),this.logger=Z.getLogger()}createTextureInfoDef(Z,J){let X={magFilter:J.getMagFilter()||void 0,minFilter:J.getMinFilter()||void 0,wrapS:J.getWrapS(),wrapT:J.getWrapT()},Y=JSON.stringify(X);if(!this.samplerDefIndexMap.has(Y))this.samplerDefIndexMap.set(Y,this.jsonDoc.json.samplers.length),this.jsonDoc.json.samplers.push(X);let $={source:this.imageIndexMap.get(Z),sampler:this.samplerDefIndexMap.get(Y)},Q=JSON.stringify($);if(!this.textureDefIndexMap.has(Q))this.textureDefIndexMap.set(Q,this.jsonDoc.json.textures.length),this.jsonDoc.json.textures.push($);let K={index:this.textureDefIndexMap.get(Q)};if(J.getTexCoord()!==0)K.texCoord=J.getTexCoord();if(Object.keys(J.getExtras()).length>0)K.extras=J.getExtras();return this.textureInfoDefMap.set(J,K),K}createPropertyDef(Z){let J={};if(Z.getName())J.name=Z.getName();if(Object.keys(Z.getExtras()).length>0)J.extras=Z.getExtras();return J}createAccessorDef(Z){let J=this.createPropertyDef(Z);if(J.type=Z.getType(),J.componentType=Z.getComponentType(),J.count=Z.getCount(),this._doc.getGraph().listParentEdges(Z).some((Y)=>Y.getName()==="attributes"&&Y.getAttributes().key==="POSITION"||Y.getName()==="input"))J.max=Z.getMax([]).map(Math.fround),J.min=Z.getMin([]).map(Math.fround);if(Z.getNormalized())J.normalized=Z.getNormalized();return J}createImageData(Z,J,X){if(this.options.format===YD.GLB)this.imageBufferViews.push(J),Z.bufferView=this.jsonDoc.json.bufferViews.length,this.jsonDoc.json.bufferViews.push({buffer:0,byteOffset:-1,byteLength:J.byteLength});else{let Y=V4.mimeTypeToExtension(X.getMimeType());Z.uri=this.imageURIGenerator.createURI(X,Y),this.assignResourceURI(Z.uri,J,!1)}}assignResourceURI(Z,J,X){let Y=this.jsonDoc.resources;if(!(Z in Y)){Y[Z]=J;return}if(J===Y[Z]){this.logger.warn(`Duplicate resource URI, "${Z}".`);return}let $=`Resource URI "${Z}" already assigned to different data.`;if(!X){this.logger.warn($);return}throw new Error($)}getAccessorUsage(Z){let J=this._accessorUsageMap.get(Z);if(J)return J;if(Z.getSparse())return p5.SPARSE;for(let X of this._doc.getGraph().listParentEdges(Z)){let{usage:Y}=X.getAttributes();if(Y)return Y;if(X.getParent().propertyType!==s.ROOT)this.logger.warn(`Missing attribute ".usage" on edge, "${X.getName()}".`)}return p5.OTHER}addAccessorToUsageGroup(Z,J){let X=this._accessorUsageMap.get(Z);if(X&&X!==J)throw new Error(`Accessor with usage "${X}" cannot be reused as "${J}".`);return this._accessorUsageMap.set(Z,J),this}}wJ.BufferViewTarget=L3;wJ.BufferViewUsage=p5;wJ.USAGE_TO_TARGET={[p5.ARRAY_BUFFER]:L3.ARRAY_BUFFER,[p5.ELEMENT_ARRAY_BUFFER]:L3.ELEMENT_ARRAY_BUFFER};class GD{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 X=this.basename(Z);return this.counter[X]=this.counter[X]||1,`${X}_${this.counter[X]++}.${J}`}}}function BL1(Z,J){let X=Z.getGraph().listParentEdges(J).find((Y)=>Y.getParent()!==Z.getRoot());return X?X.getName().replace(/texture$/i,""):""}var{UNSIGNED_INT:uz6,UNSIGNED_SHORT:dz6,UNSIGNED_BYTE:cz6}=O0.ComponentType,lz6=new Set([s.ACCESSOR,s.BUFFER,s.MATERIAL,s.MESH]);var hi;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(hi||(hi={}));var ci=163,li=166;function jL1(){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 mQ{constructor(Z,J,X,Y){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(Z.buffer,Z.byteOffset+J,X),this._littleEndian=Y,this._offset=0}_nextUint8(){let Z=this._dataView.getUint8(this._offset);return this._offset+=1,Z}_nextUint16(){let Z=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,Z}_nextUint32(){let Z=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,Z}_nextUint64(){let Z=this._dataView.getUint32(this._offset,this._littleEndian),J=this._dataView.getUint32(this._offset+4,this._littleEndian),X=Z+4294967296*J;return this._offset+=8,X}_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 X=this._offset,Y=0;while(this._dataView.getUint8(this._offset)!==J&&Y<Z)Y++,this._offset++;if(Y<Z)this._offset++;return new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+X,Y)}}var nz6=new Uint8Array([0]),n6=[171,75,84,88,32,50,48,187,13,10,26,10];function di(Z){return new TextDecoder().decode(Z)}function N2(Z){let J=new Uint8Array(Z.buffer,Z.byteOffset,n6.length);if(J[0]!==n6[0]||J[1]!==n6[1]||J[2]!==n6[2]||J[3]!==n6[3]||J[4]!==n6[4]||J[5]!==n6[5]||J[6]!==n6[6]||J[7]!==n6[7]||J[8]!==n6[8]||J[9]!==n6[9]||J[10]!==n6[10]||J[11]!==n6[11])throw new Error("Missing KTX 2.0 identifier.");let X=jL1(),Y=17*Uint32Array.BYTES_PER_ELEMENT,$=new mQ(Z,n6.length,Y,!0);X.vkFormat=$._nextUint32(),X.typeSize=$._nextUint32(),X.pixelWidth=$._nextUint32(),X.pixelHeight=$._nextUint32(),X.pixelDepth=$._nextUint32(),X.layerCount=$._nextUint32(),X.faceCount=$._nextUint32();let Q=$._nextUint32();X.supercompressionScheme=$._nextUint32();let K=$._nextUint32(),W=$._nextUint32(),G=$._nextUint32(),z=$._nextUint32(),V=$._nextUint64(),H=$._nextUint64(),q=Q*3*8,F=new mQ(Z,n6.length+Y,q,!0);for(let H6=0;H6<Q;H6++)X.levels.push({levelData:new Uint8Array(Z.buffer,Z.byteOffset+F._nextUint64(),F._nextUint64()),uncompressedByteLength:F._nextUint64()});let U=new mQ(Z,K,W,!0);U._skip(4);let w=U._nextUint16(),L=U._nextUint16(),j=U._nextUint16(),R=U._nextUint16(),O=U._nextUint8(),N=U._nextUint8(),D=U._nextUint8(),P=U._nextUint8(),C=[U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8()],T=[U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8()],A={vendorId:w,descriptorType:L,versionNumber:j,colorModel:O,colorPrimaries:N,transferFunction:D,flags:P,texelBlockDimension:C,bytesPlane:T,samples:[]},S=6,x=4,I=(R/4-S)/x;for(let H6=0;H6<I;H6++){let i7={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(i7.channelType&64)i7.sampleLower=U._nextInt32(),i7.sampleUpper=U._nextInt32();else i7.sampleLower=U._nextUint32(),i7.sampleUpper=U._nextUint32();A.samples[H6]=i7}X.dataFormatDescriptor.length=0,X.dataFormatDescriptor.push(A);let v=new mQ(Z,G,z,!0);while(v._offset<z){let H6=v._nextUint32(),i7=v._scan(H6),Mq=di(i7);if(X.keyValue[Mq]=v._nextUint8Array(H6-i7.byteLength-1),Mq.match(/^ktx/i)){let Uf=di(X.keyValue[Mq]);X.keyValue[Mq]=Uf.substring(0,Uf.lastIndexOf("\x00"))}let NX1=H6%4?4-H6%4:0;v._skip(NX1)}if(H<=0)return X;let f=new mQ(Z,V,H,!0),p=f._nextUint16(),n=f._nextUint16(),o=f._nextUint32(),J0=f._nextUint32(),Q0=f._nextUint32(),C0=f._nextUint32(),T0=[];for(let H6=0;H6<Q;H6++)T0.push({imageFlags:f._nextUint32(),rgbSliceByteOffset:f._nextUint32(),rgbSliceByteLength:f._nextUint32(),alphaSliceByteOffset:f._nextUint32(),alphaSliceByteLength:f._nextUint32()});let a0=V+f._offset,v8=a0+o,s1=v8+J0,u4=s1+Q0,r9=new Uint8Array(Z.buffer,Z.byteOffset+a0,o),t$=new Uint8Array(Z.buffer,Z.byteOffset+v8,J0),e$=new Uint8Array(Z.buffer,Z.byteOffset+s1,Q0),AX=new Uint8Array(Z.buffer,Z.byteOffset+u4,C0);return X.globalData={endpointCount:p,selectorCount:n,imageDescs:T0,endpointsData:r9,selectorsData:t$,tablesData:e$,extendedData:AX},X}var ND="EXT_mesh_gpu_instancing",OD="EXT_meshopt_compression",OL1="EXT_texture_webp",ML1="EXT_texture_avif",$n="KHR_draco_mesh_compression",PD="KHR_lights_punctual",DD="KHR_materials_anisotropy",CD="KHR_materials_clearcoat",TD="KHR_materials_diffuse_transmission",kD="KHR_materials_dispersion",ED="KHR_materials_emissive_strength",ID="KHR_materials_ior",vD="KHR_materials_iridescence",SD="KHR_materials_pbrSpecularGlossiness",_D="KHR_materials_sheen",AD="KHR_materials_specular",xD="KHR_materials_transmission",hD="KHR_materials_unlit",fD="KHR_materials_volume",OY="KHR_materials_variants",RL1="KHR_mesh_quantization",NL1="KHR_texture_basisu",bD="KHR_texture_transform",P2="KHR_xmp_json_ld",MD="INSTANCE_ATTRIBUTE";class yD extends n1{init(){this.extensionName=ND,this.propertyType="InstancedMesh",this.parentTypes=[s.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new r1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:MD})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}yD.EXTENSION_NAME=ND;var QY=ND;class T2 extends E1{constructor(...Z){super(...Z);this.extensionName=QY,this.provideTypes=[s.NODE],this.prewriteTypes=[s.ACCESSOR]}createInstancedMesh(){return new yD(this.document.getGraph())}read(Z){return(Z.jsonDoc.json.nodes||[]).forEach((Y,$)=>{if(!Y.extensions||!Y.extensions[QY])return;let Q=Y.extensions[QY],K=this.createInstancedMesh();for(let W in Q.attributes)K.setAttribute(W,Z.accessors[Q.attributes[W]]);Z.nodes[$].setExtension(QY,K)}),this}prewrite(Z){Z.accessorUsageGroupedByParent.add(MD);for(let J of this.properties)for(let X of J.listAttributes())Z.addAccessorToUsageGroup(X,MD);return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listNodes().forEach((X)=>{let Y=X.getExtension(QY);if(Y){let $=Z.nodeIndexMap.get(X),Q=J.json.nodes[$],K={attributes:{}};Y.listSemantics().forEach((W)=>{let G=Y.getAttribute(W);K.attributes[W]=Z.accessorIndexMap.get(G)}),Q.extensions=Q.extensions||{},Q.extensions[QY]=K}}),this}}T2.EXTENSION_NAME=QY;function VZ(){return VZ=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var X=arguments[J];for(var Y in X)({}).hasOwnProperty.call(X,Y)&&(Z[Y]=X[Y])}return Z},VZ.apply(null,arguments)}var N3;(function(Z){Z.QUANTIZE="quantize",Z.FILTER="filter"})(N3||(N3={}));var dQ;(function(Z){Z.ATTRIBUTES="ATTRIBUTES",Z.TRIANGLES="TRIANGLES",Z.INDICES="INDICES"})(dQ||(dQ={}));var G8;(function(Z){Z.NONE="NONE",Z.OCTAHEDRAL="OCTAHEDRAL",Z.QUATERNION="QUATERNION",Z.EXPONENTIAL="EXPONENTIAL"})(G8||(G8={}));var{BYTE:PL1,SHORT:pi,FLOAT:DL1}=O0.ComponentType,{encodeNormalizedInt:ii,decodeNormalizedInt:RD}=W8;function CL1(Z,J,X,Y){let{filter:$,bits:Q}=Y,K={array:Z.getArray(),byteStride:Z.getElementSize()*Z.getComponentSize(),componentType:Z.getComponentType(),normalized:Z.getNormalized()};if(X!==dQ.ATTRIBUTES)return K;if($!==G8.NONE){let W=Z.getNormalized()?TL1(Z):new Float32Array(K.array);switch($){case G8.EXPONENTIAL:K.byteStride=Z.getElementSize()*4,K.componentType=DL1,K.normalized=!1,K.array=J.encodeFilterExp(W,Z.getCount(),K.byteStride,Q);break;case G8.OCTAHEDRAL:K.byteStride=Q>8?8:4,K.componentType=Q>8?pi:PL1,K.normalized=!0,W=Z.getElementSize()===3?EL1(W):W,K.array=J.encodeFilterOct(W,Z.getCount(),K.byteStride,Q);break;case G8.QUATERNION:K.byteStride=8,K.componentType=pi,K.normalized=!0,K.array=J.encodeFilterQuat(W,Z.getCount(),K.byteStride,Q);break;default:throw new Error("Invalid filter.")}if(K.min=Z.getMin([]),K.max=Z.getMax([]),Z.getNormalized())K.min=K.min.map((G)=>RD(G,Z.getComponentType())),K.max=K.max.map((G)=>RD(G,Z.getComponentType()));if(K.normalized)K.min=K.min.map((G)=>ii(G,K.componentType)),K.max=K.max.map((G)=>ii(G,K.componentType))}else if(K.byteStride%4)K.array=kL1(K.array,Z.getElementSize()),K.byteStride=K.array.byteLength/Z.getCount();return K}function TL1(Z){let J=Z.getComponentType(),X=Z.getArray(),Y=new Float32Array(X.length);for(let $=0;$<X.length;$++)Y[$]=RD(X[$],J);return Y}function kL1(Z,J){let Y=k6.padNumber(Z.BYTES_PER_ELEMENT*J)/Z.BYTES_PER_ELEMENT,$=Z.length/J,Q=new Z.constructor($*Y);for(let K=0;K*J<Z.length;K++)for(let W=0;W<J;W++)Q[K*Y+W]=Z[K*J+W];return Q}function EL1(Z){let J=new Float32Array(Z.length*4/3);for(let X=0,Y=Z.length/3;X<Y;X++)J[X*4]=Z[X*3],J[X*4+1]=Z[X*3+1],J[X*4+2]=Z[X*3+2];return J}function IL1(Z,J){if(J===wJ.BufferViewUsage.ELEMENT_ARRAY_BUFFER)return Z.listParents().some((Y)=>{return Y instanceof LJ&&Y.getMode()===LJ.Mode.TRIANGLES})?dQ.TRIANGLES:dQ.INDICES;return dQ.ATTRIBUTES}function vL1(Z,J){let X=J.getGraph().listParentEdges(Z).filter((Y)=>!(Y.getParent()instanceof R2));for(let Y of X){let $=Y.getName(),Q=Y.getAttributes().key||"",K=Y.getParent().propertyType===s.PRIMITIVE_TARGET;if($==="indices")return{filter:G8.NONE};if($==="attributes"){if(Q==="POSITION")return{filter:G8.NONE};if(Q==="TEXCOORD_0")return{filter:G8.NONE};if(Q.startsWith("JOINTS_"))return{filter:G8.NONE};if(Q.startsWith("WEIGHTS_"))return{filter:G8.NONE};if(Q==="NORMAL"||Q==="TANGENT")return K?{filter:G8.NONE}:{filter:G8.OCTAHEDRAL,bits:8}}if($==="output"){let W=Qn(Z);if(W==="rotation")return{filter:G8.QUATERNION,bits:16};if(W==="translation")return{filter:G8.EXPONENTIAL,bits:12};if(W==="scale")return{filter:G8.EXPONENTIAL,bits:12};return{filter:G8.NONE}}if($==="input")return{filter:G8.NONE};if($==="inverseBindMatrices")return{filter:G8.NONE}}return{filter:G8.NONE}}function Qn(Z){for(let J of Z.listParents()){if(!(J instanceof gQ))continue;for(let X of J.listParents()){if(!(X instanceof w3))continue;return X.getTargetPath()}}return null}function SL1(Z){if(!Z.extensions||!Z.extensions[OD])return!1;return!!Z.extensions[OD].fallback}var a6=OD,ni={method:N3.QUANTIZE};class D3 extends E1{constructor(...Z){super(...Z);this.extensionName=a6,this.prereadTypes=[s.BUFFER,s.PRIMITIVE],this.prewriteTypes=[s.BUFFER,s.ACCESSOR],this.readDependencies=["meshopt.decoder"],this.writeDependencies=["meshopt.encoder"],this._decoder=null,this._decoderFallbackBufferMap=new Map,this._encoder=null,this._encoderOptions=ni,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=VZ({},ni,Z),this}preread(Z,J){if(!this._decoder){if(!this.isRequired())return this;throw new Error(`[${a6}] Please install extension dependency, "meshopt.decoder".`)}if(!this._decoder.supported){if(!this.isRequired())return this;throw new Error(`[${a6}]: Missing WASM support.`)}if(J===s.BUFFER)this._prereadBuffers(Z);else if(J===s.PRIMITIVE)this._prereadPrimitives(Z);return this}_prereadBuffers(Z){let J=Z.jsonDoc;(J.json.bufferViews||[]).forEach((Y,$)=>{if(!Y.extensions||!Y.extensions[a6])return;let Q=Y.extensions[a6],K=Q.byteOffset||0,W=Q.byteLength||0,G=Q.count,z=Q.byteStride,V=new Uint8Array(G*z),H=J.json.buffers[Q.buffer],q=H.uri?J.resources[H.uri]:J.resources[zD],F=k6.toView(q,K,W);this._decoder.decodeGltfBuffer(V,G,z,F,Q.mode,Q.filter),Z.bufferViews[$]=V})}_prereadPrimitives(Z){let J=Z.jsonDoc;(J.json.bufferViews||[]).forEach((Y)=>{if(!Y.extensions||!Y.extensions[a6])return;let $=Y.extensions[a6],Q=Z.buffers[$.buffer],K=Z.buffers[Y.buffer],W=J.json.buffers[Y.buffer];if(SL1(W))this._decoderFallbackBufferMap.set(K,Q)})}read(Z){if(!this.isRequired())return this;for(let[J,X]of this._decoderFallbackBufferMap){for(let Y of J.listParents())if(Y instanceof O0)Y.swap(J,X);J.dispose()}return this}prewrite(Z,J){if(J===s.ACCESSOR)this._prewriteAccessors(Z);else if(J===s.BUFFER)this._prewriteBuffers(Z);return this}_prewriteAccessors(Z){let J=Z.jsonDoc.json,X=this._encoder,Y=this._encoderOptions,$=this.document.getGraph(),Q=this.document.createBuffer(),K=this.document.getRoot().listBuffers().indexOf(Q),W=1,G=new Map,z=(V)=>{for(let H of $.listParents(V)){if(H.propertyType===s.ROOT)continue;let q=G.get(V);if(q===void 0)G.set(V,q=W++);return q}return-1};this._encoderFallbackBuffer=Q,this._encoderBufferViews={},this._encoderBufferViewData={},this._encoderBufferViewAccessors={};for(let V of this.document.getRoot().listAccessors()){if(Qn(V)==="weights")continue;if(V.getSparse())continue;let H=Z.getAccessorUsage(V),q=Z.accessorUsageGroupedByParent.has(H)?z(V):null,F=IL1(V,H),U=Y.method===N3.FILTER?vL1(V,this.document):{filter:G8.NONE},w=CL1(V,X,F,U),{array:L,byteStride:j}=w,R=V.getBuffer();if(!R)throw new Error(`${a6}: Missing buffer for accessor.`);let O=this.document.getRoot().listBuffers().indexOf(R),N=[H,q,F,U.filter,j,O].join(":"),D=this._encoderBufferViews[N],P=this._encoderBufferViewData[N],C=this._encoderBufferViewAccessors[N];if(!D||!P)C=this._encoderBufferViewAccessors[N]=[],P=this._encoderBufferViewData[N]=[],D=this._encoderBufferViews[N]={buffer:K,target:wJ.USAGE_TO_TARGET[H],byteOffset:0,byteLength:0,byteStride:H===wJ.BufferViewUsage.ARRAY_BUFFER?j:void 0,extensions:{[a6]:{buffer:O,byteOffset:0,byteLength:0,mode:F,filter:U.filter!==G8.NONE?U.filter:void 0,byteStride:j,count:0}}};let T=Z.createAccessorDef(V);if(T.componentType=w.componentType,T.normalized=w.normalized,T.byteOffset=D.byteLength,T.min&&w.min)T.min=w.min;if(T.max&&w.max)T.max=w.max;Z.accessorIndexMap.set(V,J.accessors.length),J.accessors.push(T),C.push(T),P.push(new Uint8Array(L.buffer,L.byteOffset,L.byteLength)),D.byteLength+=L.byteLength,D.extensions.EXT_meshopt_compression.count+=V.getCount()}}_prewriteBuffers(Z){let J=this._encoder;for(let X in this._encoderBufferViews){let Y=this._encoderBufferViews[X],$=this._encoderBufferViewData[X],Q=this.document.getRoot().listBuffers()[Y.extensions[a6].buffer],K=Z.otherBufferViews.get(Q)||[],{count:W,byteStride:G,mode:z}=Y.extensions[a6],V=k6.concat($),H=J.encodeGltfBuffer(V,W,G,z),q=k6.pad(H);Y.extensions[a6].byteLength=H.byteLength,$.length=0,$.push(q),K.push(q),Z.otherBufferViews.set(Q,K)}}write(Z){let J=0;for(let Q in this._encoderBufferViews){let K=this._encoderBufferViews[Q],W=this._encoderBufferViewData[Q][0],G=Z.otherBufferViewsIndexMap.get(W),z=this._encoderBufferViewAccessors[Q];for(let F of z)F.bufferView=G;let V=Z.jsonDoc.json.bufferViews[G],H=V.byteOffset||0;Object.assign(V,K),V.byteOffset=J;let q=V.extensions[a6];q.byteOffset=H,J+=k6.padNumber(K.byteLength)}let X=this._encoderFallbackBuffer,Y=Z.bufferIndexMap.get(X),$=Z.jsonDoc.json.buffers[Y];return $.byteLength=J,$.extensions={[a6]:{fallback:!0}},X.dispose(),this}}D3.EXTENSION_NAME=a6;D3.EncoderMethod=N3;var O3=ML1;class Kn{match(Z){return Z.length>=12&&k6.decodeText(Z.slice(4,12))==="ftypavif"}getSize(Z){if(!this.match(Z))return null;let J=new DataView(Z.buffer,Z.byteOffset,Z.byteLength),X=ai(J,0);if(!X)return null;let Y=X.end;while(X=ai(J,Y))if(X.type==="meta")Y=X.start+4;else if(X.type==="iprp"||X.type==="ipco")Y=X.start;else if(X.type==="ispe")return[J.getUint32(X.start+4),J.getUint32(X.start+8)];else if(X.type==="mdat")break;else Y=X.end;return null}getChannels(Z){return 4}}class k2 extends E1{constructor(...Z){super(...Z);this.extensionName=O3,this.prereadTypes=[s.TEXTURE]}static register(){V4.registerFormat("image/avif",new Kn)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((X)=>{if(X.extensions&&X.extensions[O3])X.source=X.extensions[O3].source}),this}read(Z){return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listTextures().forEach((X)=>{if(X.getMimeType()==="image/avif"){let Y=Z.imageIndexMap.get(X);(J.json.textures||[]).forEach((Q)=>{if(Q.source===Y)Q.extensions=Q.extensions||{},Q.extensions[O3]={source:Q.source},delete Q.source})}}),this}}k2.EXTENSION_NAME=O3;function ai(Z,J){if(Z.byteLength<4+J)return null;let X=Z.getUint32(J);if(Z.byteLength<X+J||X<8)return null;return{type:k6.decodeText(new Uint8Array(Z.buffer,Z.byteOffset+J+4,4)),start:J+8,end:J+X}}var M3=OL1;class Wn{match(Z){return Z.length>=12&&Z[8]===87&&Z[9]===69&&Z[10]===66&&Z[11]===80}getSize(Z){let J=k6.decodeText(Z.slice(0,4)),X=k6.decodeText(Z.slice(8,12));if(J!=="RIFF"||X!=="WEBP")return null;let Y=new DataView(Z.buffer,Z.byteOffset),$=12;while($<Y.byteLength){let Q=k6.decodeText(new Uint8Array([Y.getUint8($),Y.getUint8($+1),Y.getUint8($+2),Y.getUint8($+3)])),K=Y.getUint32($+4,!0);if(Q==="VP8 "){let W=Y.getInt16($+14,!0)&16383,G=Y.getInt16($+16,!0)&16383;return[W,G]}else if(Q==="VP8L"){let W=Y.getUint8($+9),G=Y.getUint8($+10),z=Y.getUint8($+11),V=Y.getUint8($+12),H=1+((G&63)<<8|W),q=1+((V&15)<<10|z<<2|(G&192)>>6);return[H,q]}$+=8+K+K%2}return null}getChannels(Z){return 4}}class E2 extends E1{constructor(...Z){super(...Z);this.extensionName=M3,this.prereadTypes=[s.TEXTURE]}static register(){V4.registerFormat("image/webp",new Wn)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((X)=>{if(X.extensions&&X.extensions[M3])X.source=X.extensions[M3].source}),this}read(Z){return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listTextures().forEach((X)=>{if(X.getMimeType()==="image/webp"){let Y=Z.imageIndexMap.get(X);(J.json.textures||[]).forEach((Q)=>{if(Q.source===Y)Q.extensions=Q.extensions||{},Q.extensions[M3]={source:Q.source},delete Q.source})}}),this}}E2.EXTENSION_NAME=M3;var si=$n,d8,Gn,zn;function _L1(Z,J){let X=new d8.DecoderBuffer;try{if(X.Init(J,J.length),Z.GetEncodedGeometryType(X)!==d8.TRIANGULAR_MESH)throw new Error(`[${si}] Unknown geometry type.`);let $=new d8.Mesh;if(!Z.DecodeBufferToMesh(X,$).ok()||$.ptr===0)throw new Error(`[${si}] Decoding failure.`);return $}finally{d8.destroy(X)}}function AL1(Z,J){let Y=J.num_faces()*3,$,Q;if(J.num_points()<=65534){let K=Y*Uint16Array.BYTES_PER_ELEMENT;$=d8._malloc(K),Z.GetTrianglesUInt16Array(J,K,$),Q=new Uint16Array(d8.HEAPU16.buffer,$,Y).slice()}else{let K=Y*Uint32Array.BYTES_PER_ELEMENT;$=d8._malloc(K),Z.GetTrianglesUInt32Array(J,K,$),Q=new Uint32Array(d8.HEAPU32.buffer,$,Y).slice()}return d8._free($),Q}function xL1(Z,J,X,Y){let $=zn[Y.componentType],Q=Gn[Y.componentType],K=X.num_components(),G=J.num_points()*K,z=G*Q.BYTES_PER_ELEMENT,V=d8._malloc(z);Z.GetAttributeDataArrayForAllPoints(J,X,$,z,V);let H=new Q(d8.HEAPF32.buffer,V,G).slice();return d8._free(V),H}function hL1(Z){d8=Z,Gn={[O0.ComponentType.FLOAT]:Float32Array,[O0.ComponentType.UNSIGNED_INT]:Uint32Array,[O0.ComponentType.UNSIGNED_SHORT]:Uint16Array,[O0.ComponentType.UNSIGNED_BYTE]:Uint8Array,[O0.ComponentType.SHORT]:Int16Array,[O0.ComponentType.BYTE]:Int8Array},zn={[O0.ComponentType.FLOAT]:d8.DT_FLOAT32,[O0.ComponentType.UNSIGNED_INT]:d8.DT_UINT32,[O0.ComponentType.UNSIGNED_SHORT]:d8.DT_UINT16,[O0.ComponentType.UNSIGNED_BYTE]:d8.DT_UINT8,[O0.ComponentType.SHORT]:d8.DT_INT16,[O0.ComponentType.BYTE]:d8.DT_INT8}}var M9,P3;(function(Z){Z[Z.EDGEBREAKER=1]="EDGEBREAKER",Z[Z.SEQUENTIAL=0]="SEQUENTIAL"})(P3||(P3={}));var R9;(function(Z){Z.POSITION="POSITION",Z.NORMAL="NORMAL",Z.COLOR="COLOR",Z.TEX_COORD="TEX_COORD",Z.GENERIC="GENERIC"})(R9||(R9={}));var Vn={[R9.POSITION]:14,[R9.NORMAL]:10,[R9.COLOR]:8,[R9.TEX_COORD]:12,[R9.GENERIC]:12},oi={decodeSpeed:5,encodeSpeed:5,method:P3.EDGEBREAKER,quantizationBits:Vn,quantizationVolume:"mesh"};function fL1(Z){M9=Z}function bL1(Z,J=oi){let X=VZ({},oi,J);X.quantizationBits=VZ({},Vn,J.quantizationBits);let Y=new M9.MeshBuilder,$=new M9.Mesh,Q=new M9.ExpertEncoder($),K={},W=new M9.DracoInt8Array,G=Z.listTargets().length>0,z=!1;for(let w of Z.listSemantics()){let L=Z.getAttribute(w);if(L.getSparse()){z=!0;continue}let j=yL1(w),R=gL1(Y,L.getComponentType(),$,M9[j],L.getCount(),L.getElementSize(),L.getArray());if(R===-1)throw new Error(`Error compressing "${w}" attribute.`);if(K[w]=R,X.quantizationVolume==="mesh"||w!=="POSITION")Q.SetAttributeQuantization(R,X.quantizationBits[j]);else if(typeof X.quantizationVolume==="object"){let{quantizationVolume:O}=X,N=Math.max(O.max[0]-O.min[0],O.max[1]-O.min[1],O.max[2]-O.min[2]);Q.SetAttributeExplicitQuantization(R,X.quantizationBits[j],L.getElementSize(),O.min,N)}else throw new Error("Invalid quantization volume state.")}let V=Z.getIndices();if(!V)throw new D2("Primitive must have indices.");if(Y.AddFacesToMesh($,V.getCount()/3,V.getArray()),Q.SetSpeedOptions(X.encodeSpeed,X.decodeSpeed),Q.SetTrackEncodedProperties(!0),X.method===P3.SEQUENTIAL||G||z)Q.SetEncodingMethod(M9.MESH_SEQUENTIAL_ENCODING);else Q.SetEncodingMethod(M9.MESH_EDGEBREAKER_ENCODING);let H=Q.EncodeToDracoBuffer(!(G||z),W);if(H<=0)throw new D2("Error applying Draco compression.");let q=new Uint8Array(H);for(let w=0;w<H;++w)q[w]=W.GetValue(w);let F=Q.GetNumberOfEncodedPoints(),U=Q.GetNumberOfEncodedFaces()*3;return M9.destroy(W),M9.destroy($),M9.destroy(Y),M9.destroy(Q),{numVertices:F,numIndices:U,data:q,attributeIDs:K}}function yL1(Z){if(Z==="POSITION")return R9.POSITION;else if(Z==="NORMAL")return R9.NORMAL;else if(Z.startsWith("COLOR_"))return R9.COLOR;else if(Z.startsWith("TEXCOORD_"))return R9.TEX_COORD;return R9.GENERIC}function gL1(Z,J,X,Y,$,Q,K){switch(J){case O0.ComponentType.UNSIGNED_BYTE:return Z.AddUInt8Attribute(X,Y,$,Q,K);case O0.ComponentType.BYTE:return Z.AddInt8Attribute(X,Y,$,Q,K);case O0.ComponentType.UNSIGNED_SHORT:return Z.AddUInt16Attribute(X,Y,$,Q,K);case O0.ComponentType.SHORT:return Z.AddInt16Attribute(X,Y,$,Q,K);case O0.ComponentType.UNSIGNED_INT:return Z.AddUInt32Attribute(X,Y,$,Q,K);case O0.ComponentType.FLOAT:return Z.AddFloatAttribute(X,Y,$,Q,K);default:throw new Error(`Unexpected component type, "${J}".`)}}class D2 extends Error{}var N8=$n;class C3 extends E1{constructor(...Z){super(...Z);this.extensionName=N8,this.prereadTypes=[s.PRIMITIVE],this.prewriteTypes=[s.ACCESSOR],this.readDependencies=["draco3d.decoder"],this.writeDependencies=["draco3d.encoder"],this._decoderModule=null,this._encoderModule=null,this._encoderOptions={}}install(Z,J){if(Z==="draco3d.decoder")this._decoderModule=J,hL1(this._decoderModule);if(Z==="draco3d.encoder")this._encoderModule=J,fL1(this._encoderModule);return this}setEncoderOptions(Z){return this._encoderOptions=Z,this}preread(Z){if(!this._decoderModule)throw new Error(`[${N8}] Please install extension dependency, "draco3d.decoder".`);let J=this.document.getLogger(),X=Z.jsonDoc,Y=new Map;try{let $=X.json.meshes||[];for(let Q of $)for(let K of Q.primitives){if(!K.extensions||!K.extensions[N8])continue;let W=K.extensions[N8],[G,z]=Y.get(W.bufferView)||[];if(!z||!G){let V=X.json.bufferViews[W.bufferView],H=X.json.buffers[V.buffer],q=H.uri?X.resources[H.uri]:X.resources[zD],F=V.byteOffset||0,U=V.byteLength,w=k6.toView(q,F,U);G=new this._decoderModule.Decoder,z=_L1(G,w),Y.set(W.bufferView,[G,z]),J.debug(`[${N8}] Decompressed ${w.byteLength} bytes.`)}for(let V in W.attributes){let H=Z.jsonDoc.json.accessors[K.attributes[V]],q=G.GetAttributeByUniqueId(z,W.attributes[V]),F=xL1(G,z,q,H);Z.accessors[K.attributes[V]].setArray(F)}if(K.indices!==void 0)Z.accessors[K.indices].setArray(AL1(G,z))}}finally{for(let[$,Q]of Array.from(Y.values()))this._decoderModule.destroy($),this._decoderModule.destroy(Q)}return this}read(Z){return this}prewrite(Z,J){if(!this._encoderModule)throw new Error(`[${N8}] Please install extension dependency, "draco3d.encoder".`);let X=this.document.getLogger();X.debug(`[${N8}] Compression options: ${JSON.stringify(this._encoderOptions)}`);let Y=mL1(this.document),$=new Map,Q="mesh";if(this._encoderOptions.quantizationVolume==="scene")if(this.document.getRoot().listScenes().length!==1)X.warn(`[${N8}]: quantizationVolume=scene requires exactly 1 scene.`);else Q=fi(this.document.getRoot().listScenes().pop());for(let K of Array.from(Y.keys())){let W=Y.get(K);if(!W)throw new Error("Unexpected primitive.");if($.has(W)){$.set(W,$.get(W));continue}let G=K.getIndices(),z=Z.jsonDoc.json.accessors,V;try{V=bL1(K,VZ({},this._encoderOptions,{quantizationVolume:Q}))}catch(F){if(F instanceof D2){X.warn(`[${N8}]: ${F.message} Skipping primitive compression.`);continue}throw F}$.set(W,V);let H=Z.createAccessorDef(G);if(H.count=V.numIndices,Z.accessorIndexMap.set(G,z.length),z.push(H),V.numVertices>65534&&O0.getComponentSize(H.componentType)<=2)H.componentType=O0.ComponentType.UNSIGNED_INT;else if(V.numVertices>254&&O0.getComponentSize(H.componentType)<=1)H.componentType=O0.ComponentType.UNSIGNED_SHORT;for(let F of K.listSemantics()){let U=K.getAttribute(F);if(V.attributeIDs[F]===void 0)continue;let w=Z.createAccessorDef(U);w.count=V.numVertices,Z.accessorIndexMap.set(U,z.length),z.push(w)}let q=K.getAttribute("POSITION").getBuffer()||this.document.getRoot().listBuffers()[0];if(!Z.otherBufferViews.has(q))Z.otherBufferViews.set(q,[]);Z.otherBufferViews.get(q).push(V.data)}return X.debug(`[${N8}] Compressed ${Y.size} primitives.`),Z.extensionData[N8]={primitiveHashMap:Y,primitiveEncodingMap:$},this}write(Z){let J=Z.extensionData[N8];for(let X of this.document.getRoot().listMeshes()){let Y=Z.jsonDoc.json.meshes[Z.meshIndexMap.get(X)];for(let $=0;$<X.listPrimitives().length;$++){let Q=X.listPrimitives()[$],K=Y.primitives[$],W=J.primitiveHashMap.get(Q);if(!W)continue;let G=J.primitiveEncodingMap.get(W);if(!G)continue;K.extensions=K.extensions||{},K.extensions[N8]={bufferView:Z.otherBufferViewsIndexMap.get(G.data),attributes:G.attributeIDs}}}if(!J.primitiveHashMap.size){let X=Z.jsonDoc.json;X.extensionsUsed=(X.extensionsUsed||[]).filter((Y)=>Y!==N8),X.extensionsRequired=(X.extensionsRequired||[]).filter((Y)=>Y!==N8)}return this}}C3.EXTENSION_NAME=N8;C3.EncoderMethod=P3;function mL1(Z){let J=Z.getLogger(),X=new Set,Y=new Set,$=0,Q=0;for(let H of Z.getRoot().listMeshes())for(let q of H.listPrimitives())if(!q.getIndices())Y.add(q),$++;else if(q.getMode()!==LJ.Mode.TRIANGLES)Y.add(q),Q++;else X.add(q);if($>0)J.warn(`[${N8}] Skipping Draco compression of ${$} non-indexed primitives.`);if(Q>0)J.warn(`[${N8}] Skipping Draco compression of ${Q} non-TRIANGLES primitives.`);let K=Z.getRoot().listAccessors(),W=new Map;for(let H=0;H<K.length;H++)W.set(K[H],H);let G=new Map,z=new Set,V=new Map;for(let H of Array.from(X)){let q=ri(H,W);if(z.has(q)){V.set(H,q);continue}if(G.has(H.getIndices())){let F=H.getIndices(),U=F.clone();W.set(U,Z.getRoot().listAccessors().length-1),H.swap(F,U)}for(let F of H.listAttributes())if(G.has(F)){let U=F.clone();W.set(U,Z.getRoot().listAccessors().length-1),H.swap(F,U)}q=ri(H,W),z.add(q),V.set(H,q),G.set(H.getIndices(),q);for(let F of H.listAttributes())G.set(F,q)}for(let H of Array.from(G.keys())){let q=new Set(H.listParents().map((F)=>F.propertyType));if(q.size!==2||!q.has(s.PRIMITIVE)||!q.has(s.ROOT))throw new Error(`[${N8}] Compressed accessors must only be used as indices or vertex attributes.`)}for(let H of Array.from(X)){let q=V.get(H),F=H.getIndices();if(G.get(F)!==q||H.listAttributes().some((U)=>G.get(U)!==q))throw new Error(`[${N8}] Draco primitives must share all, or no, accessors.`)}for(let H of Array.from(Y)){let q=H.getIndices();if(G.has(q)||H.listAttributes().some((F)=>G.has(F)))throw new Error(`[${N8}] Accessor cannot be shared by compressed and uncompressed primitives.`)}return V}function ri(Z,J){let X=[],Y=Z.getIndices();X.push(J.get(Y));for(let $ of Z.listAttributes())X.push(J.get($));return X.sort().join("|")}class cQ extends n1{init(){this.extensionName=PD,this.propertyType="Light",this.parentTypes=[s.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{color:[1,1,1],intensity:1,type:cQ.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)}}cQ.EXTENSION_NAME=PD;cQ.Type={POINT:"point",SPOT:"spot",DIRECTIONAL:"directional"};var Q7=PD;class gD extends E1{constructor(...Z){super(...Z);this.extensionName=Q7}createLight(Z=""){return new cQ(this.document.getGraph(),Z)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[Q7])return this;let $=(J.json.extensions[Q7].lights||[]).map((Q)=>{var K,W;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(((K=Q.spot)==null?void 0:K.innerConeAngle)!==void 0)G.setInnerConeAngle(Q.spot.innerConeAngle);if(((W=Q.spot)==null?void 0:W.outerConeAngle)!==void 0)G.setOuterConeAngle(Q.spot.outerConeAngle);return G});return J.json.nodes.forEach((Q,K)=>{if(!Q.extensions||!Q.extensions[Q7])return;let W=Q.extensions[Q7];Z.nodes[K].setExtension(Q7,$[W.light])}),this}write(Z){let J=Z.jsonDoc;if(this.properties.size===0)return this;let X=[],Y=new Map;for(let $ of this.properties){let Q=$,K={type:Q.getType()};if(!W8.eq(Q.getColor(),[1,1,1]))K.color=Q.getColor();if(Q.getIntensity()!==1)K.intensity=Q.getIntensity();if(Q.getRange()!=null)K.range=Q.getRange();if(Q.getName())K.name=Q.getName();if(Q.getType()===cQ.Type.SPOT)K.spot={innerConeAngle:Q.getInnerConeAngle(),outerConeAngle:Q.getOuterConeAngle()};X.push(K),Y.set(Q,X.length-1)}return this.document.getRoot().listNodes().forEach(($)=>{let Q=$.getExtension(Q7);if(Q){let K=Z.nodeIndexMap.get($),W=J.json.nodes[K];W.extensions=W.extensions||{},W.extensions[Q7]={light:Y.get(Q)}}}),J.json.extensions=J.json.extensions||{},J.json.extensions[Q7]={lights:X},this}}gD.EXTENSION_NAME=Q7;var{R:uL1,G:dL1,B:cL1}=i5;class mD extends n1{init(){this.extensionName=DD,this.propertyType="Anisotropy",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{anisotropyStrength:0,anisotropyRotation:0,anisotropyTexture:null,anisotropyTextureInfo:new C1(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:uL1|dL1|cL1})}}mD.EXTENSION_NAME=DD;var KY=DD;class uD extends E1{constructor(...Z){super(...Z);this.extensionName=KY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createAnisotropy(){return new mD(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[KY]){let K=this.createAnisotropy();Z.materials[Q].setExtension(KY,K);let W=$.extensions[KY];if(W.anisotropyStrength!==void 0)K.setAnisotropyStrength(W.anisotropyStrength);if(W.anisotropyRotation!==void 0)K.setAnisotropyRotation(W.anisotropyRotation);if(W.anisotropyTexture!==void 0){let G=W.anisotropyTexture,z=Z.textures[Y[G.index].source];K.setAnisotropyTexture(z),Z.setTextureInfo(K.getAnisotropyTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(KY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[KY]={};if(Y.getAnisotropyStrength()>0)K.anisotropyStrength=Y.getAnisotropyStrength();if(Y.getAnisotropyRotation()!==0)K.anisotropyRotation=Y.getAnisotropyRotation();if(Y.getAnisotropyTexture()){let W=Y.getAnisotropyTexture(),G=Y.getAnisotropyTextureInfo();K.anisotropyTexture=Z.createTextureInfoDef(W,G)}}}),this}}uD.EXTENSION_NAME=KY;var{R:ti,G:ei,B:lL1}=i5;class dD extends n1{init(){this.extensionName=CD,this.propertyType="Clearcoat",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{clearcoatFactor:0,clearcoatTexture:null,clearcoatTextureInfo:new C1(this.graph,"clearcoatTextureInfo"),clearcoatRoughnessFactor:0,clearcoatRoughnessTexture:null,clearcoatRoughnessTextureInfo:new C1(this.graph,"clearcoatRoughnessTextureInfo"),clearcoatNormalScale:1,clearcoatNormalTexture:null,clearcoatNormalTextureInfo:new C1(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:ti})}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:ei})}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:ti|ei|lL1})}}dD.EXTENSION_NAME=CD;var WY=CD;class cD extends E1{constructor(...Z){super(...Z);this.extensionName=WY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createClearcoat(){return new dD(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[WY]){let K=this.createClearcoat();Z.materials[Q].setExtension(WY,K);let W=$.extensions[WY];if(W.clearcoatFactor!==void 0)K.setClearcoatFactor(W.clearcoatFactor);if(W.clearcoatRoughnessFactor!==void 0)K.setClearcoatRoughnessFactor(W.clearcoatRoughnessFactor);if(W.clearcoatTexture!==void 0){let G=W.clearcoatTexture,z=Z.textures[Y[G.index].source];K.setClearcoatTexture(z),Z.setTextureInfo(K.getClearcoatTextureInfo(),G)}if(W.clearcoatRoughnessTexture!==void 0){let G=W.clearcoatRoughnessTexture,z=Z.textures[Y[G.index].source];K.setClearcoatRoughnessTexture(z),Z.setTextureInfo(K.getClearcoatRoughnessTextureInfo(),G)}if(W.clearcoatNormalTexture!==void 0){let G=W.clearcoatNormalTexture,z=Z.textures[Y[G.index].source];if(K.setClearcoatNormalTexture(z),Z.setTextureInfo(K.getClearcoatNormalTextureInfo(),G),G.scale!==void 0)K.setClearcoatNormalScale(G.scale)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(WY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[WY]={clearcoatFactor:Y.getClearcoatFactor(),clearcoatRoughnessFactor:Y.getClearcoatRoughnessFactor()};if(Y.getClearcoatTexture()){let W=Y.getClearcoatTexture(),G=Y.getClearcoatTextureInfo();K.clearcoatTexture=Z.createTextureInfoDef(W,G)}if(Y.getClearcoatRoughnessTexture()){let W=Y.getClearcoatRoughnessTexture(),G=Y.getClearcoatRoughnessTextureInfo();K.clearcoatRoughnessTexture=Z.createTextureInfoDef(W,G)}if(Y.getClearcoatNormalTexture()){let W=Y.getClearcoatNormalTexture(),G=Y.getClearcoatNormalTextureInfo();if(K.clearcoatNormalTexture=Z.createTextureInfoDef(W,G),Y.getClearcoatNormalScale()!==1)K.clearcoatNormalTexture.scale=Y.getClearcoatNormalScale()}}}),this}}cD.EXTENSION_NAME=WY;var{R:pL1,G:iL1,B:nL1,A:aL1}=i5;class lD extends n1{init(){this.extensionName=TD,this.propertyType="DiffuseTransmission",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseTransmissionFactor:0,diffuseTransmissionTexture:null,diffuseTransmissionTextureInfo:new C1(this.graph,"diffuseTransmissionTextureInfo"),diffuseTransmissionColorFactor:[1,1,1],diffuseTransmissionColorTexture:null,diffuseTransmissionColorTextureInfo:new C1(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:aL1})}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:pL1|iL1|nL1})}}lD.EXTENSION_NAME=TD;var GY=TD;class pD extends E1{constructor(...Z){super(...Z);this.extensionName=GY}createDiffuseTransmission(){return new lD(this.document.getGraph())}read(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[GY]){let K=this.createDiffuseTransmission();Z.materials[Q].setExtension(GY,K);let W=$.extensions[GY];if(W.diffuseTransmissionFactor!==void 0)K.setDiffuseTransmissionFactor(W.diffuseTransmissionFactor);if(W.diffuseTransmissionColorFactor!==void 0)K.setDiffuseTransmissionColorFactor(W.diffuseTransmissionColorFactor);if(W.diffuseTransmissionTexture!==void 0){let G=W.diffuseTransmissionTexture,z=Z.textures[Y[G.index].source];K.setDiffuseTransmissionTexture(z),Z.setTextureInfo(K.getDiffuseTransmissionTextureInfo(),G)}if(W.diffuseTransmissionColorTexture!==void 0){let G=W.diffuseTransmissionColorTexture,z=Z.textures[Y[G.index].source];K.setDiffuseTransmissionColorTexture(z),Z.setTextureInfo(K.getDiffuseTransmissionColorTextureInfo(),G)}}}),this}write(Z){let J=Z.jsonDoc;for(let X of this.document.getRoot().listMaterials()){let Y=X.getExtension(GY);if(!Y)continue;let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[GY]={diffuseTransmissionFactor:Y.getDiffuseTransmissionFactor(),diffuseTransmissionColorFactor:Y.getDiffuseTransmissionColorFactor()};if(Y.getDiffuseTransmissionTexture()){let W=Y.getDiffuseTransmissionTexture(),G=Y.getDiffuseTransmissionTextureInfo();K.diffuseTransmissionTexture=Z.createTextureInfoDef(W,G)}if(Y.getDiffuseTransmissionColorTexture()){let W=Y.getDiffuseTransmissionColorTexture(),G=Y.getDiffuseTransmissionColorTextureInfo();K.diffuseTransmissionColorTexture=Z.createTextureInfoDef(W,G)}}return this}}pD.EXTENSION_NAME=GY;class iD extends n1{init(){this.extensionName=kD,this.propertyType="Dispersion",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{dispersion:0})}getDispersion(){return this.get("dispersion")}setDispersion(Z){return this.set("dispersion",Z)}}iD.EXTENSION_NAME=kD;var zY=kD;class nD extends E1{constructor(...Z){super(...Z);this.extensionName=zY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createDispersion(){return new iD(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[zY]){let Q=this.createDispersion();Z.materials[$].setExtension(zY,Q);let K=Y.extensions[zY];if(K.dispersion!==void 0)Q.setDispersion(K.dispersion)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(zY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[zY]={dispersion:Y.getDispersion()}}}),this}}nD.EXTENSION_NAME=zY;class aD extends n1{init(){this.extensionName=ED,this.propertyType="EmissiveStrength",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{emissiveStrength:1})}getEmissiveStrength(){return this.get("emissiveStrength")}setEmissiveStrength(Z){return this.set("emissiveStrength",Z)}}aD.EXTENSION_NAME=ED;var VY=ED;class sD extends E1{constructor(...Z){super(...Z);this.extensionName=VY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createEmissiveStrength(){return new aD(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[VY]){let Q=this.createEmissiveStrength();Z.materials[$].setExtension(VY,Q);let K=Y.extensions[VY];if(K.emissiveStrength!==void 0)Q.setEmissiveStrength(K.emissiveStrength)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(VY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[VY]={emissiveStrength:Y.getEmissiveStrength()}}}),this}}sD.EXTENSION_NAME=VY;class oD extends n1{init(){this.extensionName=ID,this.propertyType="IOR",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{ior:1.5})}getIOR(){return this.get("ior")}setIOR(Z){return this.set("ior",Z)}}oD.EXTENSION_NAME=ID;var HY=ID;class I2 extends E1{constructor(...Z){super(...Z);this.extensionName=HY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createIOR(){return new oD(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[HY]){let Q=this.createIOR();Z.materials[$].setExtension(HY,Q);let K=Y.extensions[HY];if(K.ior!==void 0)Q.setIOR(K.ior)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(HY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[HY]={ior:Y.getIOR()}}}),this}}I2.EXTENSION_NAME=HY;var{R:sL1,G:oL1}=i5;class rD extends n1{init(){this.extensionName=vD,this.propertyType="Iridescence",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{iridescenceFactor:0,iridescenceTexture:null,iridescenceTextureInfo:new C1(this.graph,"iridescenceTextureInfo"),iridescenceIOR:1.3,iridescenceThicknessMinimum:100,iridescenceThicknessMaximum:400,iridescenceThicknessTexture:null,iridescenceThicknessTextureInfo:new C1(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:sL1})}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:oL1})}}rD.EXTENSION_NAME=vD;var qY=vD;class tD extends E1{constructor(...Z){super(...Z);this.extensionName=qY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createIridescence(){return new rD(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[qY]){let K=this.createIridescence();Z.materials[Q].setExtension(qY,K);let W=$.extensions[qY];if(W.iridescenceFactor!==void 0)K.setIridescenceFactor(W.iridescenceFactor);if(W.iridescenceIor!==void 0)K.setIridescenceIOR(W.iridescenceIor);if(W.iridescenceThicknessMinimum!==void 0)K.setIridescenceThicknessMinimum(W.iridescenceThicknessMinimum);if(W.iridescenceThicknessMaximum!==void 0)K.setIridescenceThicknessMaximum(W.iridescenceThicknessMaximum);if(W.iridescenceTexture!==void 0){let G=W.iridescenceTexture,z=Z.textures[Y[G.index].source];K.setIridescenceTexture(z),Z.setTextureInfo(K.getIridescenceTextureInfo(),G)}if(W.iridescenceThicknessTexture!==void 0){let G=W.iridescenceThicknessTexture,z=Z.textures[Y[G.index].source];K.setIridescenceThicknessTexture(z),Z.setTextureInfo(K.getIridescenceThicknessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(qY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[qY]={};if(Y.getIridescenceFactor()>0)K.iridescenceFactor=Y.getIridescenceFactor();if(Y.getIridescenceIOR()!==1.3)K.iridescenceIor=Y.getIridescenceIOR();if(Y.getIridescenceThicknessMinimum()!==100)K.iridescenceThicknessMinimum=Y.getIridescenceThicknessMinimum();if(Y.getIridescenceThicknessMaximum()!==400)K.iridescenceThicknessMaximum=Y.getIridescenceThicknessMaximum();if(Y.getIridescenceTexture()){let W=Y.getIridescenceTexture(),G=Y.getIridescenceTextureInfo();K.iridescenceTexture=Z.createTextureInfoDef(W,G)}if(Y.getIridescenceThicknessTexture()){let W=Y.getIridescenceThicknessTexture(),G=Y.getIridescenceThicknessTextureInfo();K.iridescenceThicknessTexture=Z.createTextureInfoDef(W,G)}}}),this}}tD.EXTENSION_NAME=qY;var{R:Zn,G:Jn,B:Xn,A:Yn}=i5;class eD extends n1{init(){this.extensionName=SD,this.propertyType="PBRSpecularGlossiness",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseFactor:[1,1,1,1],diffuseTexture:null,diffuseTextureInfo:new C1(this.graph,"diffuseTextureInfo"),specularFactor:[1,1,1],glossinessFactor:1,specularGlossinessTexture:null,specularGlossinessTextureInfo:new C1(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:Zn|Jn|Xn|Yn,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:Zn|Jn|Xn|Yn})}}eD.EXTENSION_NAME=SD;var FY=SD;class v2 extends E1{constructor(...Z){super(...Z);this.extensionName=FY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createPBRSpecularGlossiness(){return new eD(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[FY]){let K=this.createPBRSpecularGlossiness();Z.materials[Q].setExtension(FY,K);let W=$.extensions[FY];if(W.diffuseFactor!==void 0)K.setDiffuseFactor(W.diffuseFactor);if(W.specularFactor!==void 0)K.setSpecularFactor(W.specularFactor);if(W.glossinessFactor!==void 0)K.setGlossinessFactor(W.glossinessFactor);if(W.diffuseTexture!==void 0){let G=W.diffuseTexture,z=Z.textures[Y[G.index].source];K.setDiffuseTexture(z),Z.setTextureInfo(K.getDiffuseTextureInfo(),G)}if(W.specularGlossinessTexture!==void 0){let G=W.specularGlossinessTexture,z=Z.textures[Y[G.index].source];K.setSpecularGlossinessTexture(z),Z.setTextureInfo(K.getSpecularGlossinessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(FY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[FY]={diffuseFactor:Y.getDiffuseFactor(),specularFactor:Y.getSpecularFactor(),glossinessFactor:Y.getGlossinessFactor()};if(Y.getDiffuseTexture()){let W=Y.getDiffuseTexture(),G=Y.getDiffuseTextureInfo();K.diffuseTexture=Z.createTextureInfoDef(W,G)}if(Y.getSpecularGlossinessTexture()){let W=Y.getSpecularGlossinessTexture(),G=Y.getSpecularGlossinessTextureInfo();K.specularGlossinessTexture=Z.createTextureInfoDef(W,G)}}}),this}}v2.EXTENSION_NAME=FY;var{R:rL1,G:tL1,B:eL1,A:Zw1}=i5;class ZC extends n1{init(){this.extensionName=_D,this.propertyType="Sheen",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{sheenColorFactor:[0,0,0],sheenColorTexture:null,sheenColorTextureInfo:new C1(this.graph,"sheenColorTextureInfo"),sheenRoughnessFactor:0,sheenRoughnessTexture:null,sheenRoughnessTextureInfo:new C1(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:rL1|tL1|eL1,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:Zw1})}}ZC.EXTENSION_NAME=_D;var UY=_D;class JC extends E1{constructor(...Z){super(...Z);this.extensionName=UY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createSheen(){return new ZC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[UY]){let K=this.createSheen();Z.materials[Q].setExtension(UY,K);let W=$.extensions[UY];if(W.sheenColorFactor!==void 0)K.setSheenColorFactor(W.sheenColorFactor);if(W.sheenRoughnessFactor!==void 0)K.setSheenRoughnessFactor(W.sheenRoughnessFactor);if(W.sheenColorTexture!==void 0){let G=W.sheenColorTexture,z=Z.textures[Y[G.index].source];K.setSheenColorTexture(z),Z.setTextureInfo(K.getSheenColorTextureInfo(),G)}if(W.sheenRoughnessTexture!==void 0){let G=W.sheenRoughnessTexture,z=Z.textures[Y[G.index].source];K.setSheenRoughnessTexture(z),Z.setTextureInfo(K.getSheenRoughnessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(UY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[UY]={sheenColorFactor:Y.getSheenColorFactor(),sheenRoughnessFactor:Y.getSheenRoughnessFactor()};if(Y.getSheenColorTexture()){let W=Y.getSheenColorTexture(),G=Y.getSheenColorTextureInfo();K.sheenColorTexture=Z.createTextureInfoDef(W,G)}if(Y.getSheenRoughnessTexture()){let W=Y.getSheenRoughnessTexture(),G=Y.getSheenRoughnessTextureInfo();K.sheenRoughnessTexture=Z.createTextureInfoDef(W,G)}}}),this}}JC.EXTENSION_NAME=UY;var{R:Jw1,G:Xw1,B:Yw1,A:$w1}=i5;class XC extends n1{init(){this.extensionName=AD,this.propertyType="Specular",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{specularFactor:1,specularTexture:null,specularTextureInfo:new C1(this.graph,"specularTextureInfo"),specularColorFactor:[1,1,1],specularColorTexture:null,specularColorTextureInfo:new C1(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:$w1})}getSpecularColorTexture(){return this.getRef("specularColorTexture")}getSpecularColorTextureInfo(){return this.getRef("specularColorTexture")?this.getRef("specularColorTextureInfo"):null}setSpecularColorTexture(Z){return this.setRef("specularColorTexture",Z,{channels:Jw1|Xw1|Yw1,isColor:!0})}}XC.EXTENSION_NAME=AD;var LY=AD;class S2 extends E1{constructor(...Z){super(...Z);this.extensionName=LY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createSpecular(){return new XC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[LY]){let K=this.createSpecular();Z.materials[Q].setExtension(LY,K);let W=$.extensions[LY];if(W.specularFactor!==void 0)K.setSpecularFactor(W.specularFactor);if(W.specularColorFactor!==void 0)K.setSpecularColorFactor(W.specularColorFactor);if(W.specularTexture!==void 0){let G=W.specularTexture,z=Z.textures[Y[G.index].source];K.setSpecularTexture(z),Z.setTextureInfo(K.getSpecularTextureInfo(),G)}if(W.specularColorTexture!==void 0){let G=W.specularColorTexture,z=Z.textures[Y[G.index].source];K.setSpecularColorTexture(z),Z.setTextureInfo(K.getSpecularColorTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(LY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[LY]={};if(Y.getSpecularFactor()!==1)K.specularFactor=Y.getSpecularFactor();if(!W8.eq(Y.getSpecularColorFactor(),[1,1,1]))K.specularColorFactor=Y.getSpecularColorFactor();if(Y.getSpecularTexture()){let W=Y.getSpecularTexture(),G=Y.getSpecularTextureInfo();K.specularTexture=Z.createTextureInfoDef(W,G)}if(Y.getSpecularColorTexture()){let W=Y.getSpecularColorTexture(),G=Y.getSpecularColorTextureInfo();K.specularColorTexture=Z.createTextureInfoDef(W,G)}}}),this}}S2.EXTENSION_NAME=LY;var{R:Qw1}=i5;class YC extends n1{init(){this.extensionName=xD,this.propertyType="Transmission",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{transmissionFactor:0,transmissionTexture:null,transmissionTextureInfo:new C1(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:Qw1})}}YC.EXTENSION_NAME=xD;var wY=xD;class $C extends E1{constructor(...Z){super(...Z);this.extensionName=wY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createTransmission(){return new YC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[wY]){let K=this.createTransmission();Z.materials[Q].setExtension(wY,K);let W=$.extensions[wY];if(W.transmissionFactor!==void 0)K.setTransmissionFactor(W.transmissionFactor);if(W.transmissionTexture!==void 0){let G=W.transmissionTexture,z=Z.textures[Y[G.index].source];K.setTransmissionTexture(z),Z.setTextureInfo(K.getTransmissionTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(wY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[wY]={transmissionFactor:Y.getTransmissionFactor()};if(Y.getTransmissionTexture()){let W=Y.getTransmissionTexture(),G=Y.getTransmissionTextureInfo();K.transmissionTexture=Z.createTextureInfoDef(W,G)}}}),this}}$C.EXTENSION_NAME=wY;class QC extends n1{init(){this.extensionName=hD,this.propertyType="Unlit",this.parentTypes=[s.MATERIAL]}}QC.EXTENSION_NAME=hD;var uQ=hD;class _2 extends E1{constructor(...Z){super(...Z);this.extensionName=uQ,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createUnlit(){return new QC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){return(Z.jsonDoc.json.materials||[]).forEach((X,Y)=>{if(X.extensions&&X.extensions[uQ])Z.materials[Y].setExtension(uQ,this.createUnlit())}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{if(X.getExtension(uQ)){let Y=Z.materialIndexMap.get(X),$=J.json.materials[Y];$.extensions=$.extensions||{},$.extensions[uQ]={}}}),this}}_2.EXTENSION_NAME=uQ;class KC extends n1{init(){this.extensionName=OY,this.propertyType="Mapping",this.parentTypes=["MappingList"]}getDefaults(){return Object.assign(super.getDefaults(),{material:null,variants:new N0})}getMaterial(){return this.getRef("material")}setMaterial(Z){return this.setRef("material",Z)}addVariant(Z){return this.addRef("variants",Z)}removeVariant(Z){return this.removeRef("variants",Z)}listVariants(){return this.listRefs("variants")}}KC.EXTENSION_NAME=OY;class WC extends n1{init(){this.extensionName=OY,this.propertyType="MappingList",this.parentTypes=[s.PRIMITIVE]}getDefaults(){return Object.assign(super.getDefaults(),{mappings:new N0})}addMapping(Z){return this.addRef("mappings",Z)}removeMapping(Z){return this.removeRef("mappings",Z)}listMappings(){return this.listRefs("mappings")}}WC.EXTENSION_NAME=OY;class C2 extends n1{init(){this.extensionName=OY,this.propertyType="Variant",this.parentTypes=["MappingList"]}}C2.EXTENSION_NAME=OY;var K7=OY;class GC extends E1{constructor(...Z){super(...Z);this.extensionName=K7}createMappingList(){return new WC(this.document.getGraph())}createVariant(Z=""){return new C2(this.document.getGraph(),Z)}createMapping(){return new KC(this.document.getGraph())}listVariants(){return Array.from(this.properties).filter((Z)=>Z instanceof C2)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[K7])return this;let $=(J.json.extensions[K7].variants||[]).map((K)=>this.createVariant().setName(K.name||""));return(J.json.meshes||[]).forEach((K,W)=>{let G=Z.meshes[W];(K.primitives||[]).forEach((V,H)=>{if(!V.extensions||!V.extensions[K7])return;let q=this.createMappingList(),F=V.extensions[K7];for(let U of F.mappings){let w=this.createMapping();if(U.material!==void 0)w.setMaterial(Z.materials[U.material]);for(let L of U.variants||[])w.addVariant($[L]);q.addMapping(w)}G.listPrimitives()[H].setExtension(K7,q)})}),this}write(Z){let J=Z.jsonDoc,X=this.listVariants();if(!X.length)return this;let Y=[],$=new Map;for(let Q of X)$.set(Q,Y.length),Y.push(Z.createPropertyDef(Q));for(let Q of this.document.getRoot().listMeshes()){let K=Z.meshIndexMap.get(Q);Q.listPrimitives().forEach((W,G)=>{let z=W.getExtension(K7);if(!z)return;let V=Z.jsonDoc.json.meshes[K].primitives[G],H=z.listMappings().map((q)=>{let F=Z.createPropertyDef(q),U=q.getMaterial();if(U)F.material=Z.materialIndexMap.get(U);return F.variants=q.listVariants().map((w)=>$.get(w)),F});V.extensions=V.extensions||{},V.extensions[K7]={mappings:H}})}return J.json.extensions=J.json.extensions||{},J.json.extensions[K7]={variants:Y},this}}GC.EXTENSION_NAME=K7;var{G:Kw1}=i5;class zC extends n1{init(){this.extensionName=fD,this.propertyType="Volume",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{thicknessFactor:0,thicknessTexture:null,thicknessTextureInfo:new C1(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:Kw1})}getAttenuationDistance(){return this.get("attenuationDistance")}setAttenuationDistance(Z){return this.set("attenuationDistance",Z)}getAttenuationColor(){return this.get("attenuationColor")}setAttenuationColor(Z){return this.set("attenuationColor",Z)}}zC.EXTENSION_NAME=fD;var BY=fD;class VC extends E1{constructor(...Z){super(...Z);this.extensionName=BY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createVolume(){return new zC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[BY]){let K=this.createVolume();Z.materials[Q].setExtension(BY,K);let W=$.extensions[BY];if(W.thicknessFactor!==void 0)K.setThicknessFactor(W.thicknessFactor);if(W.attenuationDistance!==void 0)K.setAttenuationDistance(W.attenuationDistance);if(W.attenuationColor!==void 0)K.setAttenuationColor(W.attenuationColor);if(W.thicknessTexture!==void 0){let G=W.thicknessTexture,z=Z.textures[Y[G.index].source];K.setThicknessTexture(z),Z.setTextureInfo(K.getThicknessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(BY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[BY]={};if(Y.getThicknessFactor()>0)K.thicknessFactor=Y.getThicknessFactor();if(Number.isFinite(Y.getAttenuationDistance()))K.attenuationDistance=Y.getAttenuationDistance();if(!W8.eq(Y.getAttenuationColor(),[1,1,1]))K.attenuationColor=Y.getAttenuationColor();if(Y.getThicknessTexture()){let W=Y.getThicknessTexture(),G=Y.getThicknessTextureInfo();K.thicknessTexture=Z.createTextureInfoDef(W,G)}}}),this}}VC.EXTENSION_NAME=BY;var Hn=RL1;class T3 extends E1{constructor(...Z){super(...Z);this.extensionName=Hn}read(Z){return this}write(Z){return this}}T3.EXTENSION_NAME=Hn;var R3=NL1;class qn{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=N2(Z);return[J.pixelWidth,J.pixelHeight]}getChannels(Z){let X=N2(Z).dataFormatDescriptor[0];if(X.colorModel===ci)return X.samples.length===2&&(X.samples[1].channelType&15)===15?4:3;else if(X.colorModel===li)return(X.samples[0].channelType&15)===3?4:3;throw new Error(`Unexpected KTX2 colorModel, "${X.colorModel}".`)}getVRAMByteLength(Z){let J=N2(Z),X=this.getChannels(Z)>3,Y=0;for(let $=0;$<J.levels.length;$++){let Q=J.levels[$];if(Q.uncompressedByteLength)Y+=Q.uncompressedByteLength;else{let K=Math.max(1,Math.floor(J.pixelWidth/Math.pow(2,$))),W=Math.max(1,Math.floor(J.pixelHeight/Math.pow(2,$))),G=X?16:8;Y+=K/4*(W/4)*G}}return Y}}class HC extends E1{constructor(...Z){super(...Z);this.extensionName=R3,this.prereadTypes=[s.TEXTURE]}static register(){V4.registerFormat("image/ktx2",new qn)}preread(Z){return Z.jsonDoc.json.textures.forEach((J)=>{if(J.extensions&&J.extensions[R3]){let X=J.extensions[R3];J.source=X.source}}),this}read(Z){return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listTextures().forEach((X)=>{if(X.getMimeType()==="image/ktx2"){let Y=Z.imageIndexMap.get(X);J.json.textures.forEach(($)=>{if($.source===Y)$.extensions=$.extensions||{},$.extensions[R3]={source:$.source},delete $.source})}}),this}}HC.EXTENSION_NAME=R3;class qC extends n1{init(){this.extensionName=bD,this.propertyType="Transform",this.parentTypes=[s.TEXTURE_INFO]}getDefaults(){return Object.assign(super.getDefaults(),{offset:[0,0],rotation:0,scale:[1,1],texCoord:null})}getOffset(){return this.get("offset")}setOffset(Z){return this.set("offset",Z)}getRotation(){return this.get("rotation")}setRotation(Z){return this.set("rotation",Z)}getScale(){return this.get("scale")}setScale(Z){return this.set("scale",Z)}getTexCoord(){return this.get("texCoord")}setTexCoord(Z){return this.set("texCoord",Z)}}qC.EXTENSION_NAME=bD;var jY=bD;class FC extends E1{constructor(...Z){super(...Z);this.extensionName=jY}createTransform(){return new qC(this.document.getGraph())}read(Z){for(let[J,X]of Array.from(Z.textureInfos.entries())){if(!X.extensions||!X.extensions[jY])continue;let Y=this.createTransform(),$=X.extensions[jY];if($.offset!==void 0)Y.setOffset($.offset);if($.rotation!==void 0)Y.setRotation($.rotation);if($.scale!==void 0)Y.setScale($.scale);if($.texCoord!==void 0)Y.setTexCoord($.texCoord);J.setExtension(jY,Y)}return this}write(Z){let J=Array.from(Z.textureInfoDefMap.entries());for(let[X,Y]of J){let $=X.getExtension(jY);if(!$)continue;Y.extensions=Y.extensions||{};let Q={},K=W8.eq;if(!K($.getOffset(),[0,0]))Q.offset=$.getOffset();if($.getRotation()!==0)Q.rotation=$.getRotation();if(!K($.getScale(),[1,1]))Q.scale=$.getScale();if($.getTexCoord()!=null)Q.texCoord=$.getTexCoord();Y.extensions[jY]=Q}return this}}FC.EXTENSION_NAME=jY;var Ww1=[s.ROOT,s.SCENE,s.NODE,s.MESH,s.MATERIAL,s.TEXTURE,s.ANIMATION];class UC extends n1{init(){this.extensionName=P2,this.propertyType="Packet",this.parentTypes=Ww1}getDefaults(){return Object.assign(super.getDefaults(),{context:{},properties:{}})}getContext(){return this.get("context")}setContext(Z){return this.set("context",VZ({},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 X=VZ({},this.get("properties"));if(J)X[Z]=J;else delete X[Z];return this.set("properties",X)}toJSONLD(){let Z=jD(this.get("context")),J=jD(this.get("properties"));return VZ({"@context":Z},J)}fromJSONLD(Z){Z=jD(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(`${P2}: Missing context for term, "${Z}".`)}}UC.EXTENSION_NAME=P2;function jD(Z){return JSON.parse(JSON.stringify(Z))}var zZ=P2;class LC extends E1{constructor(...Z){super(...Z);this.extensionName=zZ}createPacket(){return new UC(this.document.getGraph())}listPackets(){return Array.from(this.properties)}read(Z){var J;let X=(J=Z.jsonDoc.json.extensions)==null?void 0:J[zZ];if(!X||!X.packets)return this;let Y=Z.jsonDoc.json,$=this.document.getRoot(),Q=X.packets.map((G)=>this.createPacket().fromJSONLD(G)),K=[[Y.asset],Y.scenes,Y.nodes,Y.meshes,Y.materials,Y.images,Y.animations],W=[[$],$.listScenes(),$.listNodes(),$.listMeshes(),$.listMaterials(),$.listTextures(),$.listAnimations()];for(let G=0;G<K.length;G++){let z=K[G]||[];for(let V=0;V<z.length;V++){let H=z[V];if(H.extensions&&H.extensions[zZ]){let q=H.extensions[zZ];W[G][V].setExtension(zZ,Q[q.packet])}}}return this}write(Z){let{json:J}=Z.jsonDoc,X=[];for(let Y of this.properties){X.push(Y.toJSONLD());for(let $ of Y.listParents()){let Q;switch($.propertyType){case s.ROOT:Q=J.asset;break;case s.SCENE:Q=J.scenes[Z.sceneIndexMap.get($)];break;case s.NODE:Q=J.nodes[Z.nodeIndexMap.get($)];break;case s.MESH:Q=J.meshes[Z.meshIndexMap.get($)];break;case s.MATERIAL:Q=J.materials[Z.materialIndexMap.get($)];break;case s.TEXTURE:Q=J.images[Z.imageIndexMap.get($)];break;case s.ANIMATION:Q=J.animations[Z.animationIndexMap.get($)];break;default:Q=null,this.document.getLogger().warn(`[${zZ}]: Unsupported parent property, "${$.propertyType}"`);break}if(!Q)continue;Q.extensions=Q.extensions||{},Q.extensions[zZ]={packet:X.length-1}}}if(X.length>0)J.extensions=J.extensions||{},J.extensions[zZ]={packets:X};return this}}LC.EXTENSION_NAME=zZ;var Gw1=[C3,gD,uD,cD,pD,nD,sD,I2,tD,v2,S2,JC,$C,_2,GC,VC,T3,HC,FC,LC],rz6=[T2,D3,k2,E2,...Gw1];var zw1=t(SP(),1);function iQ(){return iQ=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var X=arguments[J];for(var Y in X)({}).hasOwnProperty.call(X,Y)&&(Z[Y]=X[Y])}return Z},iQ.apply(null,arguments)}var{POINTS:Fn,LINES:A2,LINE_STRIP:Vw1,LINE_LOOP:Hw1,TRIANGLES:x2,TRIANGLE_STRIP:qw1,TRIANGLE_FAN:Fw1}=M8.Mode;function MJ(Z,J){return Object.defineProperty(J,"name",{value:Z}),J}function W7(Z,J){let X=iQ({},Z);for(let Y in J)if(J[Y]!==void 0)X[Y]=J[Y];return X}function An(Z){let J=Z.getIndices(),X=Z.getAttribute("POSITION");switch(Z.getMode()){case M8.Mode.POINTS:return J?J.getCount():X.getCount();case M8.Mode.LINES:return J?J.getCount()/2:X.getCount()/2;case M8.Mode.LINE_LOOP:return J?J.getCount():X.getCount();case M8.Mode.LINE_STRIP:return J?J.getCount()-1:X.getCount()-1;case M8.Mode.TRIANGLES:return J?J.getCount()/3:X.getCount()/3;case M8.Mode.TRIANGLE_STRIP:case M8.Mode.TRIANGLE_FAN:return J?J.getCount()-2:X.getCount()-2;default:throw new Error("Unexpected mode: "+Z.getMode())}}var Uw1=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function OC(Z){return Uw1.format(Z)}function Lw1(Z,J,X=2){let Y=Z>J?"\u2013":"+",$="%";return Y+(Math.abs(Z-J)/Z*100).toFixed(X)+"%"}function g2(Z,J){return`${OC(Z)} \u2192 ${OC(J)} (${Lw1(Z,J)})`}function TC(Z){let J=[];for(let X of Z.listAttributes())J.push(X);for(let X of Z.listTargets())for(let Y of X.listAttributes())J.push(Y);return Array.from(new Set(J))}function ww1(Z,J,X){Z.swap(J,X);for(let Y of Z.listTargets())Y.swap(J,X)}function Bw1(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 X=0;X<Z.length;X++)if(Z[X]!==J[X])return!1;return!0}function HZ(Z,J){return Z.createAccessor(J.getName()).setArray(J.getArray()).setType(J.getType()).setBuffer(J.getBuffer()).setNormalized(J.getNormalized()).setSparse(J.getSparse())}function jw1(Z,J=Z){let X=kC(Z,J);for(let Y=0;Y<X.length;Y++)X[Y]=Y;return X}function kC(Z,J=Z){return J<=65534?new Uint16Array(Z):new Uint32Array(Z)}function Ow1(Z){return Z.listParents().some((J)=>J.propertyType!==a.ROOT)}function xn(Z){for(let J in Z)return!1;return!0}function hn(Z){let J=C6.fromGraph(Z.getGraph()),X=Z.getMaterial(),Y=J.getRoot().listMaterials().indexOf(X),$=Rw1[Z.getMode()],Q=!!Z.getIndices(),K=Z.listSemantics().sort().map((G)=>{let z=Z.getAttribute(G),V=z.getElementSize(),H=z.getComponentType();return`${G}:${V}:${H}`}).join("+"),W=Z.listTargets().map((G)=>{return G.listSemantics().sort().map((z)=>{let V=Z.getAttribute(z),H=V.getElementSize(),q=V.getComponentType();return`${z}:${H}:${q}`}).join("+")}).join("~");return`${Y}|${$}|${Q}|${K}|${W}`}function Mw1(Z){return Math.pow(2,Math.ceil(Math.log(Z)/Math.LN2))}var Rw1={[Fn]:Fn,[A2]:A2,[Vw1]:A2,[Hw1]:A2,[x2]:x2,[qw1]:x2,[Fw1]:x2},lQ="center",Un={pivot:"center"};function fn(Z=Un){let J=W7(Un,Z);return MJ(lQ,(X)=>{let Y=X.getLogger(),$=X.getRoot(),Q=$.listAnimations().length>0||$.listSkins().length>0;X.getRoot().listScenes().forEach((K,W)=>{Y.debug(`${lQ}: Scene ${W+1} / ${$.listScenes().length}.`);let G;if(typeof J.pivot==="string"){let V=DP(K);if(G=[(V.max[0]-V.min[0])/2+V.min[0],(V.max[1]-V.min[1])/2+V.min[1],(V.max[2]-V.min[2])/2+V.min[2]],J.pivot==="above")G[1]=V.max[1];if(J.pivot==="below")G[1]=V.min[1]}else G=J.pivot;Y.debug(`${lQ}: Pivot "${G.join(", ")}".`);let z=[-1*G[0],-1*G[1],-1*G[2]];if(Q){Y.debug(`${lQ}: Model contains animation or skin. Adding a wrapper node.`);let V=X.createNode("Pivot").setTranslation(z);K.listChildren().forEach((H)=>V.addChild(H)),K.addChild(V)}else Y.debug(`${lQ}: Skipping wrapper, offsetting all root nodes.`),K.listChildren().forEach((V)=>{let H=V.getTranslation();V.setTranslation([H[0]+z[0],H[1]+z[1],H[2]+z[2]])})}),Y.debug(`${lQ}: Complete.`)})}function Nw1(Z){let J=new Set,X=Z,Y;while(Y=X.getParentNode()){if(J.has(Y))throw new Error("Circular dependency in scene graph.");J.add(Y),X=Y}return X.listParents().filter(($)=>$ instanceof IQ)}function Pw1(Z){let J=Nw1(Z),X=Z.getParentNode();if(!X)return Z;Z.setMatrix(Z.getWorldMatrix()),X.removeChild(Z);for(let Y of J)Y.addChild(Z);return Z}var nQ=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 Dw1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=J[4],W=J[5],G=J[6],z=J[7],V=J[8],H=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],j=J[15],R=X*W-Y*K,O=X*G-$*K,N=X*z-Q*K,D=Y*G-$*W,P=Y*z-Q*W,C=$*z-Q*G,T=V*w-H*U,k=V*L-q*U,A=V*j-F*U,S=H*L-q*w,x=H*j-F*w,I=q*j-F*L,v=R*I-O*x+N*S+D*A-P*k+C*T;if(!v)return null;return v=1/v,Z[0]=(W*I-G*x+z*S)*v,Z[1]=($*x-Y*I-Q*S)*v,Z[2]=(w*C-L*P+j*D)*v,Z[3]=(q*P-H*C-F*D)*v,Z[4]=(G*A-K*I-z*k)*v,Z[5]=(X*I-$*A+Q*k)*v,Z[6]=(L*N-U*C-j*O)*v,Z[7]=(V*C-q*N+F*O)*v,Z[8]=(K*x-W*A+z*T)*v,Z[9]=(Y*A-X*x-Q*T)*v,Z[10]=(U*P-w*N+j*R)*v,Z[11]=(H*N-V*P-F*R)*v,Z[12]=(W*k-K*S-G*T)*v,Z[13]=(X*S-Y*k+$*T)*v,Z[14]=(w*O-U*D-L*R)*v,Z[15]=(V*D-H*O+q*R)*v,Z}function Cw1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],K=Z[5],W=Z[6],G=Z[7],z=Z[8],V=Z[9],H=Z[10],q=Z[11],F=Z[12],U=Z[13],w=Z[14],L=Z[15],j=J*K-X*Q,R=J*W-Y*Q,O=J*G-$*Q,N=X*W-Y*K,D=X*G-$*K,P=Y*G-$*W,C=z*U-V*F,T=z*w-H*F,k=z*L-q*F,A=V*w-H*U,S=V*L-q*U,x=H*L-q*w;return j*x-R*S+O*A+N*k-D*T+P*C}function bn(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=J[8],q=J[9],F=J[10],U=J[11],w=J[12],L=J[13],j=J[14],R=J[15],O=X[0],N=X[1],D=X[2],P=X[3];return Z[0]=O*Y+N*W+D*H+P*w,Z[1]=O*$+N*G+D*q+P*L,Z[2]=O*Q+N*z+D*F+P*j,Z[3]=O*K+N*V+D*U+P*R,O=X[4],N=X[5],D=X[6],P=X[7],Z[4]=O*Y+N*W+D*H+P*w,Z[5]=O*$+N*G+D*q+P*L,Z[6]=O*Q+N*z+D*F+P*j,Z[7]=O*K+N*V+D*U+P*R,O=X[8],N=X[9],D=X[10],P=X[11],Z[8]=O*Y+N*W+D*H+P*w,Z[9]=O*$+N*G+D*q+P*L,Z[10]=O*Q+N*z+D*F+P*j,Z[11]=O*K+N*V+D*U+P*R,O=X[12],N=X[13],D=X[14],P=X[15],Z[12]=O*Y+N*W+D*H+P*w,Z[13]=O*$+N*G+D*q+P*L,Z[14]=O*Q+N*z+D*F+P*j,Z[15]=O*K+N*V+D*U+P*R,Z}function Tw1(){var Z=new nQ(9);if(nQ!=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 kw1(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 Ew1(Z,J){if(Z===J){var X=J[1],Y=J[2],$=J[5];Z[1]=J[3],Z[2]=J[6],Z[3]=X,Z[5]=J[7],Z[6]=Y,Z[7]=$}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 Iw1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=J[4],W=J[5],G=J[6],z=J[7],V=J[8],H=V*K-W*z,q=-V*Q+W*G,F=z*Q-K*G,U=X*H+Y*q+$*F;if(!U)return null;return U=1/U,Z[0]=H*U,Z[1]=(-V*Y+$*z)*U,Z[2]=(W*Y-$*K)*U,Z[3]=q*U,Z[4]=(V*X-$*G)*U,Z[5]=(-W*X+$*Q)*U,Z[6]=F*U,Z[7]=(-z*X+Y*G)*U,Z[8]=(K*X-Y*Q)*U,Z}function m2(){var Z=new nQ(3);if(nQ!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function vw1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z}function yn(Z,J){var X=J[0],Y=J[1],$=J[2],Q=X*X+Y*Y+$*$;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 Sw1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=X[3]*Y+X[7]*$+X[11]*Q+X[15];return K=K||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/K,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/K,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/K,Z}function _w1(Z,J,X){var Y=J[0],$=J[1],Q=J[2];return Z[0]=Y*X[0]+$*X[3]+Q*X[6],Z[1]=Y*X[1]+$*X[4]+Q*X[7],Z[2]=Y*X[2]+$*X[5]+Q*X[8],Z}var Aw1=vw1;(function(){var Z=m2();return function(J,X,Y,$,Q,K){var W,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(W=Y;W<G;W+=X)Z[0]=J[W],Z[1]=J[W+1],Z[2]=J[W+2],Q(Z,Z,K),J[W]=Z[0],J[W+1]=Z[1],J[W+2]=Z[2];return J}})();var jJ="dedup",wC={keepUniqueNames:!1,propertyTypes:[a.ACCESSOR,a.MESH,a.TEXTURE,a.MATERIAL,a.SKIN]};function gn(Z=wC){let J=W7(wC,Z),X=new Set(J.propertyTypes);for(let Y of J.propertyTypes)if(!wC.propertyTypes.includes(Y))throw new Error(`${jJ}: Unsupported deduplication on type "${Y}".`);return MJ(jJ,(Y)=>{let $=Y.getLogger();if(X.has(a.ACCESSOR))xw1(Y);if(X.has(a.TEXTURE))fw1(Y,J);if(X.has(a.MATERIAL))bw1(Y,J);if(X.has(a.MESH))hw1(Y,J);if(X.has(a.SKIN))yw1(Y,J);$.debug(`${jJ}: Complete.`)})}function xw1(Z){let J=Z.getLogger(),X=new Map,Y=new Map,$=new Map,Q=new Map,K=Z.getRoot().listMeshes();K.forEach((H)=>{H.listPrimitives().forEach((q)=>{q.listAttributes().forEach((F)=>W(F,Y)),W(q.getIndices(),X)})});for(let H of Z.getRoot().listAnimations())for(let q of H.listSamplers())W(q.getInput(),$),W(q.getOutput(),Q);function W(H,q){if(!H)return;let F=[H.getCount(),H.getType(),H.getComponentType(),H.getNormalized(),H.getSparse()].join(":"),U=q.get(F);if(!U)q.set(F,U=new Set);U.add(H)}function G(H,q){for(let F=0;F<H.length;F++){let U=H[F],w=n0.toView(U.getArray());if(q.has(U))continue;for(let L=F+1;L<H.length;L++){let j=H[L];if(q.has(j))continue;if(n0.equals(w,n0.toView(j.getArray())))q.set(j,U)}}}let z=0,V=new Map;for(let H of[Y,X,$,Q])for(let q of H.values())z+=q.size,G(Array.from(q),V);J.debug(`${jJ}: Merged ${V.size} of ${z} accessors.`),K.forEach((H)=>{H.listPrimitives().forEach((q)=>{q.listAttributes().forEach((U)=>{if(V.has(U))q.swap(U,V.get(U))});let F=q.getIndices();if(F&&V.has(F))q.swap(F,V.get(F))})});for(let H of Z.getRoot().listAnimations())for(let q of H.listSamplers()){let F=q.getInput(),U=q.getOutput();if(F&&V.has(F))q.swap(F,V.get(F));if(U&&V.has(U))q.swap(U,V.get(U))}Array.from(V.keys()).forEach((H)=>H.dispose())}function hw1(Z,J){let X=Z.getLogger(),Y=Z.getRoot(),$=new Map;Y.listAccessors().forEach((W,G)=>$.set(W,G)),Y.listMaterials().forEach((W,G)=>$.set(W,G));let Q=Y.listMeshes().length,K=new Map;for(let W of Y.listMeshes()){let G=[];for(let V of W.listPrimitives())G.push(mn(V,$));let z="";if(J.keepUniqueNames)z+=W.getName()+";";if(z+=G.join(";"),K.has(z)){let V=K.get(z);W.listParents().forEach((H)=>{if(H.propertyType!==a.ROOT)H.swap(W,V)}),W.dispose()}else K.set(z,W)}X.debug(`${jJ}: Merged ${Q-K.size} of ${Q} meshes.`)}function fw1(Z,J){let X=Z.getLogger(),Y=Z.getRoot(),$=Y.listTextures(),Q=new Map;for(let K=0;K<$.length;K++){let W=$[K],G=W.getImage();if(Q.has(W))continue;for(let z=K+1;z<$.length;z++){let V=$[z],H=V.getImage();if(Q.has(V))continue;if(W.getMimeType()!==V.getMimeType())continue;if(J.keepUniqueNames&&W.getName()!==V.getName())continue;let q=W.getSize(),F=V.getSize();if(!q||!F)continue;if(q[0]!==F[0])continue;if(q[1]!==F[1])continue;if(!G||!H)continue;if(n0.equals(G,H))Q.set(V,W)}}X.debug(`${jJ}: Merged ${Q.size} of ${Y.listTextures().length} textures.`),Array.from(Q.entries()).forEach(([K,W])=>{K.listParents().forEach((G)=>{if(!(G instanceof ZY))G.swap(K,W)}),K.dispose()})}function bw1(Z,J){let X=Z.getLogger(),$=Z.getRoot().listMaterials(),Q=new Map,K=new Map,W=new Set;if(!J.keepUniqueNames)W.add("name");for(let G=0;G<$.length;G++){let z=$[G];if(Q.has(z))continue;if(Ln(z,K))continue;for(let V=G+1;V<$.length;V++){let H=$[V];if(Q.has(H))continue;if(Ln(H,K))continue;if(z.equals(H,W))Q.set(H,z)}}X.debug(`${jJ}: Merged ${Q.size} of ${$.length} materials.`),Array.from(Q.entries()).forEach(([G,z])=>{G.listParents().forEach((V)=>{if(!(V instanceof ZY))V.swap(G,z)}),G.dispose()})}function yw1(Z,J){let X=Z.getLogger(),$=Z.getRoot().listSkins(),Q=new Map,K=new Set(["joints"]);if(!J.keepUniqueNames)K.add("name");for(let W=0;W<$.length;W++){let G=$[W];if(Q.has(G))continue;for(let z=W+1;z<$.length;z++){let V=$[z];if(Q.has(V))continue;if(G.equals(V,K)&&Bw1(G.listJoints(),V.listJoints()))Q.set(V,G)}}X.debug(`${jJ}: Merged ${Q.size} of ${$.length} skins.`),Array.from(Q.entries()).forEach(([W,G])=>{W.listParents().forEach((z)=>{if(!(z instanceof ZY))z.swap(W,G)}),W.dispose()})}function mn(Z,J){let X=[];for(let Y of Z.listSemantics()){let $=Z.getAttribute(Y);X.push(Y+":"+J.get($))}if(Z instanceof M8){let Y=Z.getIndices();if(Y)X.push("indices:"+J.get(Y));let $=Z.getMaterial();if($)X.push("material:"+J.get($));X.push("mode:"+Z.getMode());for(let Q of Z.listTargets())X.push("target:"+mn(Q,J))}return X.join(",")}function Ln(Z,J){if(J.has(Z))return J.get(Z);let X=Z.getGraph(),Y=new Set,$=X.listParentEdges(Z);while($.length>0){let Q=$.pop();if(Q.getAttributes().modifyChild===!0)return J.set(Z,!0),!0;let K=Q.getChild();if(Y.has(K))continue;for(let W of X.listChildEdges(K))$.push(W)}return J.set(Z,!1),!1}function un(){var Z=new nQ(4);if(nQ!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function gw1(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z}function mw1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z[3]=J[3]-X[3],Z}function uw1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z[3]=J[3]*X[3],Z}function dw1(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z}function cw1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return Math.hypot(J,X,Y,$)}var dn=mw1,lw1=uw1,cn=cw1;(function(){var Z=un();return function(J,X,Y,$,Q,K){var W,G;if(!X)X=4;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(W=Y;W<G;W+=X)Z[0]=J[W],Z[1]=J[W+1],Z[2]=J[W+2],Z[3]=J[W+3],Q(Z,Z,K),J[W]=Z[0],J[W+1]=Z[1],J[W+2]=Z[2],J[W+3]=Z[3];return J}})();var pw1=/color|emissive|diffuse/i;function iw1(Z){return Z.getGraph().listParentEdges(Z).some(($)=>{return $.getAttributes().isColor||pw1.test($.getName())})?"srgb":null}function nw1(Z){let J=Z.getGraph(),X=new Set,Y=new Set;function $(Q){let K=new Set;for(let W of J.listChildEdges(Q))if(W.getChild()instanceof eX)K.add(W.getName()+"Info");for(let W of J.listChildEdges(Q)){let G=W.getChild();if(X.has(G))continue;if(X.add(G),G instanceof B5&&K.has(W.getName()))Y.add(G);else if(G instanceof EQ)$(G)}}return $(Z),Array.from(Y)}function aw1(Z){let X=C6.fromGraph(Z.getGraph()).getRoot(),Y=Z.getGraph().listParentEdges(Z).filter(($)=>$.getParent()!==X).map(($)=>$.getName());return Array.from(new Set(Y))}var pQ="prune",MC=0.011764705882352941,wn={propertyTypes:[a.NODE,a.SKIN,a.MESH,a.CAMERA,a.PRIMITIVE,a.PRIMITIVE_TARGET,a.ANIMATION,a.MATERIAL,a.TEXTURE,a.ACCESSOR,a.BUFFER],keepLeaves:!1,keepAttributes:!1,keepIndices:!1,keepSolidTextures:!1,keepExtras:!1};function u2(Z=wn){let J=W7(wn,Z),X=new Set(J.propertyTypes),Y=J.keepExtras;return MJ(pQ,async($)=>{let Q=$.getLogger(),K=$.getRoot(),W=$.getGraph(),G=new ln,z=(V)=>G.dispose(V.target);if(W.addEventListener("node:dispose",z),X.has(a.MESH))for(let V of K.listMeshes()){if(V.listPrimitives().length>0)continue;V.dispose()}if(X.has(a.NODE)){if(!J.keepLeaves)for(let V of K.listScenes())pn(W,V,Y);for(let V of K.listNodes())N9(V,Y)}if(X.has(a.SKIN))for(let V of K.listSkins())N9(V,Y);if(X.has(a.MESH))for(let V of K.listMeshes())N9(V,Y);if(X.has(a.CAMERA))for(let V of K.listCameras())N9(V,Y);if(X.has(a.PRIMITIVE))Bn(W,a.PRIMITIVE,Y);if(X.has(a.PRIMITIVE_TARGET))Bn(W,a.PRIMITIVE_TARGET,Y);if(!J.keepAttributes&&X.has(a.ACCESSOR)){let V=new Map;for(let H of K.listMeshes())for(let q of H.listPrimitives()){let F=q.getMaterial();if(!F)continue;let U=nn($,q,F),w=ow1(q,U);jn(q,w),q.listTargets().forEach((L)=>jn(L,w)),V.has(F)?V.get(F).add(q):V.set(F,new Set([q]))}for(let[H,q]of V)rw1(H,Array.from(q))}if(!J.keepIndices&&X.has(a.ACCESSOR))for(let V of K.listMeshes())for(let H of V.listPrimitives())sw1(H);if(X.has(a.ANIMATION))for(let V of K.listAnimations()){for(let H of V.listChannels())if(!H.getTargetNode())H.dispose();if(!V.listChannels().length){let H=V.listSamplers();N9(V,Y),H.forEach((q)=>N9(q,Y))}else V.listSamplers().forEach((H)=>N9(H,Y))}if(X.has(a.MATERIAL))K.listMaterials().forEach((V)=>N9(V,Y));if(X.has(a.TEXTURE)){if(K.listTextures().forEach((V)=>N9(V,Y)),!J.keepSolidTextures)await tw1($)}if(X.has(a.ACCESSOR))K.listAccessors().forEach((V)=>N9(V,Y));if(X.has(a.BUFFER))K.listBuffers().forEach((V)=>N9(V,Y));if(W.removeEventListener("node:dispose",z),!G.empty()){let V=G.entries().map(([H,q])=>`${H} (${q})`).join(", ");Q.info(`${pQ}: Removed types... ${V}`)}else Q.debug(`${pQ}: No unused properties found.`);Q.debug(`${pQ}: Complete.`)})}class ln{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 N9(Z,J){let X=Z.listParents().filter(($)=>!($ instanceof ZY||$ instanceof rX)),Y=J&&!xn(Z.getExtras());if(!X.length&&!Y)Z.dispose()}function Bn(Z,J,X){for(let Y of Z.listEdges()){let $=Y.getParent();if($.propertyType===J)N9($,X)}}function pn(Z,J,X){if(J.listChildren().forEach((K)=>pn(Z,K,X)),J instanceof IQ)return;let Y=Z.listParentEdges(J).some((K)=>{let W=K.getParent().propertyType;return W!==a.ROOT&&W!==a.SCENE&&W!==a.NODE}),$=Z.listChildren(J).length===0,Q=X&&!xn(J.getExtras());if($&&!Y&&!Q)J.dispose()}function jn(Z,J){for(let X of J)Z.setAttribute(X,null)}function sw1(Z){let J=Z.getIndices(),X=J&&J.getArray(),Y=Z.listAttributes()[0];if(!X||!Y)return;if(J.getCount()!==Y.getCount())return;for(let $=0,Q=X.length;$<Q;$++)if($!==X[$])return;Z.setIndices(null)}function ow1(Z,J){let X=[];for(let Y of Z.listSemantics())if(Y==="NORMAL"&&!J.has(Y))X.push(Y);else if(Y==="TANGENT"&&!J.has(Y))X.push(Y);else if(Y.startsWith("TEXCOORD_")&&!J.has(Y))X.push(Y);else if(Y.startsWith("COLOR_")&&Y!=="COLOR_0")X.push(Y);return X}function nn(Z,J,X,Y=new Set){let Q=Z.getGraph().listChildEdges(X),K=new Set;for(let z of Q)if(z.getChild()instanceof eX)K.add(z.getName());for(let z of Q){let V=z.getName(),H=z.getChild();if(H instanceof B5){if(K.has(V.replace(/Info$/,"")))Y.add(`TEXCOORD_${H.getTexCoord()}`)}if(H instanceof eX&&V.match(/normalTexture/i))Y.add("TANGENT");if(H instanceof EQ)nn(Z,J,H,Y)}let W=X instanceof t4&&!X.getExtension("KHR_materials_unlit"),G=J.getMode()===M8.Mode.POINTS;if(W&&!G)Y.add("NORMAL");return Y}function rw1(Z,J){let X=nw1(Z),Y=new Set(X.map((G)=>G.getTexCoord())),$=Array.from(Y).sort(),Q=new Map($.map((G,z)=>[G,z])),K=new Map($.map((G,z)=>[`TEXCOORD_${G}`,`TEXCOORD_${z}`]));for(let G of X){let z=G.getTexCoord();G.setTexCoord(Q.get(z))}for(let G of J){let z=G.listSemantics().filter((V)=>V.startsWith("TEXCOORD_")).sort();W(G,z),G.listTargets().forEach((V)=>W(V,z))}function W(G,z){for(let V of z){let H=G.getAttribute(V);if(!H)continue;let q=K.get(V);if(q===V)continue;G.setAttribute(q,H),G.setAttribute(V,null)}}}async function tw1(Z){let J=Z.getRoot(),X=Z.getGraph(),Y=Z.getLogger(),Q=J.listTextures().map(async(K)=>{var W;let G=await ZB1(K);if(!G)return;if(iw1(K)==="srgb")CP.convertSRGBToLinear(G,G);let z=K.getName()||K.getURI(),V=(W=K.getSize())==null?void 0:W.join("x"),H=aw1(K);for(let q of X.listParentEdges(K)){let F=q.getParent();if(F!==J&&ew1(F,G,q.getName(),Y))q.dispose()}if(K.listParents().length===1)K.dispose(),Y.debug(`${pQ}: Removed solid-color texture "${z}" (${V}px ${H.join(", ")})`)});await Promise.all(Q)}function ew1(Z,J,X,Y){if(Z instanceof t4)switch(X){case"baseColorTexture":return Z.setBaseColorFactor(lw1(J,J,Z.getBaseColorFactor())),!0;case"emissiveTexture":return Z.setEmissiveFactor(Aw1([0,0,0],J.slice(0,3),Z.getEmissiveFactor())),!0;case"occlusionTexture":return Math.abs(J[0]-1)<=MC;case"metallicRoughnessTexture":return Z.setRoughnessFactor(J[1]*Z.getRoughnessFactor()),Z.setMetallicFactor(J[2]*Z.getMetallicFactor()),!0;case"normalTexture":return cn(dn(un(),J,[0.5,0.5,1,1]))<=MC}return Y.warn(`${pQ}: Detected single-color ${X} texture. Pruning ${X} not yet supported.`),!1}async function ZB1(Z){let J=await JB1(Z);if(!J)return null;let X=[1/0,1/0,1/0,1/0],Y=[-1/0,-1/0,-1/0,-1/0],$=[0,0,0,0],[Q,K]=J.shape;for(let W=0;W<Q;W++){for(let G=0;G<K;G++)for(let z=0;z<4;z++)X[z]=Math.min(X[z],J.get(W,G,z)),Y[z]=Math.max(Y[z],J.get(W,G,z));if(cn(dn($,Y,X))/255>MC)return null}return dw1($,gw1($,Y,X),0.00196078431372549)}async function JB1(Z){try{return await Si(Z.getImage(),Z.getMimeType())}catch(J){return null}}var BJ=4294967295;class an{constructor(Z){this.attributes=[],this.u8=void 0,this.u32=void 0;let J=0;for(let X of TC(Z))J+=this._initAttribute(X);this.u8=new Uint8Array(J),this.u32=new Uint32Array(this.u8.buffer)}_initAttribute(Z){let J=Z.getArray(),X=new Uint8Array(J.buffer,J.byteOffset,J.byteLength),Y=Z.getElementSize()*Z.getComponentSize(),$=n0.padNumber(Y);return this.attributes.push({u8:X,byteStride:Y,paddedByteStride:$}),$}hash(Z){let J=0;for(let{u8:X,byteStride:Y,paddedByteStride:$}of this.attributes){for(let Q=0;Q<$;Q++)if(Q<Y)this.u8[J+Q]=X[Z*Y+Q];else this.u8[J+Q]=0;J+=$}return XB1(0,this.u32)}equal(Z,J){for(let{u8:X,byteStride:Y}of this.attributes)for(let $=0;$<Y;$++)if(X[Z*Y+$]!==X[J*Y+$])return!1;return!0}}function XB1(Z,J){for(let $=0,Q=J.length;$<Q;$++){let K=J[$];K=Math.imul(K,1540483477)>>>0,K=(K^K>>24)>>>0,K=Math.imul(K,1540483477)>>>0,Z=Math.imul(Z,1540483477)>>>0,Z=(Z^K)>>>0}return Z}function YB1(Z,J,X,Y,$=BJ){let Q=J-1,W=X.hash(Y)&Q;for(let G=0;G<=Q;G++){let z=Z[W];if(z===$||X.equal(z,Y))return W;W=W+G+1&Q}throw new Error("Hash table full.")}var w6;(function(Z){Z.RENDER="render",Z.RENDER_CACHED="render-cached",Z.UPLOAD="upload",Z.UPLOAD_NAIVE="upload-naive",Z.DISTINCT="distinct",Z.DISTINCT_POSITION="distinct-position",Z.UNUSED="unused"})(w6||(w6={}));function OJ(Z,J){let X=Z.getAttribute("POSITION"),Y=Z.getIndices();switch(J){case w6.RENDER:return Y?Y.getCount():X.getCount();case w6.RENDER_CACHED:return Y?new Set(Y.getArray()).size:X.getCount();case w6.UPLOAD_NAIVE:case w6.UPLOAD:return X.getCount();case w6.DISTINCT:case w6.DISTINCT_POSITION:return $B1(J);case w6.UNUSED:return Y?X.getCount()-new Set(Y.getArray()).size:0;default:return QB1(J)}}function $B1(Z){throw new Error(`Not implemented: ${Z}`)}function QB1(Z){throw new Error(`Unexpected value: ${Z}`)}function E3(Z,J,X){let Y=C6.fromGraph(Z.getGraph());if(!J||!X)[J,X]=KB1(Z);let $=Z.getIndices(),Q=$?$.getArray():null,K=OJ(Z,w6.RENDER),W=Y.createAccessor(),G=K,z=kC(G,X);for(let H=0;H<G;H++)z[H]=J[Q?Q[H]:H];Z.setIndices(W.setArray(z));let V=TC(Z);for(let H of Z.listAttributes()){let q=HZ(Y,H);RC(H,$,J,q,X),Z.swap(H,q)}for(let H of Z.listTargets())for(let q of H.listAttributes()){let F=HZ(Y,q);RC(q,$,J,F,X),H.swap(q,F)}if($&&$.listParents().length===1)$.dispose();for(let H of V)if(H.listParents().length===1)H.dispose();return Z}function RC(Z,J,X,Y,$){let Q=Z.getElementSize(),K=Z.getArray(),W=J?J.getArray():null,G=J?J.getCount():Z.getCount(),z=new K.constructor($*Q),V=new Uint8Array($);for(let H=0;H<G;H++){let q=W?W[H]:H,F=X[q];if(V[F])continue;for(let U=0;U<Q;U++)z[F*Q+U]=K[q*Q+U];V[F]=1}return Y.setArray(z)}function KB1(Z){let J=OJ(Z,w6.UPLOAD),X=Z.getIndices(),Y=X?X.getArray():null;if(!X||!Y)return[jw1(J,1e6),J];let $=new Uint32Array(J).fill(BJ),Q=0;for(let K=0;K<Y.length;K++){let W=Y[K];if($[W]===BJ)$[W]=Q++}return[$,Q]}var NC="weld",f2={overwrite:!0,cleanup:!0};function EC(Z=f2){let J=W7(f2,Z);return MJ(NC,async(X)=>{let Y=X.getLogger();for(let $ of X.getRoot().listMeshes()){for(let Q of $.listPrimitives())if(d2(Q,J),OJ(Q,w6.RENDER)===0)Q.dispose();if($.listPrimitives().length===0)$.dispose()}if(J.cleanup)await X.transform(u2({propertyTypes:[a.ACCESSOR,a.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),gn({propertyTypes:[a.ACCESSOR]}));Y.debug(`${NC}: Complete.`)})}function d2(Z,J=f2){let X=Z.getGraph(),$=C6.fromGraph(X).getLogger(),Q=iQ({},f2,J);if(Z.getIndices()&&!Q.overwrite)return;if(Z.getMode()===M8.Mode.POINTS)return;let K=Z.getAttribute("POSITION").getCount(),W=Z.getIndices(),G=W==null?void 0:W.getArray(),z=W?W.getCount():K,V=new an(Z),H=Mw1(K+K/4),q=new Uint32Array(H).fill(BJ),F=new Uint32Array(K).fill(BJ),U=0;for(let w=0;w<z;w++){let L=G?G[w]:w;if(F[L]!==BJ)continue;let j=YB1(q,H,V,L,BJ),R=q[j];if(R===BJ)q[j]=L,F[L]=U++;else F[L]=F[R]}$.debug(`${NC}: ${g2(K,U)} vertices.`),E3(Z,F,U)}var{FLOAT:WB1}=E0.ComponentType;function sn(Z,J){let X=Z.getAttribute("POSITION");if(X)On(J,X);let Y=Z.getAttribute("NORMAL");if(Y)Mn(J,Y);let $=Z.getAttribute("TANGENT");if($)Rn(J,$);for(let Q of Z.listTargets()){let K=Q.getAttribute("POSITION");if(K)On(J,K);let W=Q.getAttribute("NORMAL");if(W)Mn(J,W);let G=Q.getAttribute("TANGENT");if(G)Rn(J,G)}if(Cw1(J)<0)GB1(Z)}function On(Z,J){let X=J.getComponentType(),Y=J.getNormalized(),$=J.getArray(),Q=X===WB1?$:new Float32Array($.length),K=m2();for(let W=0,G=J.getCount();W<G;W++){if(Y)K[0]=d0.decodeNormalizedInt($[W*3],X),K[1]=d0.decodeNormalizedInt($[W*3+1],X),K[2]=d0.decodeNormalizedInt($[W*3+2],X);else K[0]=$[W*3],K[1]=$[W*3+1],K[2]=$[W*3+2];Sw1(K,K,Z),Q[W*3]=K[0],Q[W*3+1]=K[1],Q[W*3+2]=K[2]}J.setArray(Q).setNormalized(!1)}function Mn(Z,J){let X=J.getArray(),Y=J.getNormalized(),$=J.getComponentType(),Q=Tw1();kw1(Q,Z),Iw1(Q,Q),Ew1(Q,Q);let K=m2();for(let W=0,G=J.getCount();W<G;W++){if(Y)K[0]=d0.decodeNormalizedInt(X[W*3],$),K[1]=d0.decodeNormalizedInt(X[W*3+1],$),K[2]=d0.decodeNormalizedInt(X[W*3+2],$);else K[0]=X[W*3],K[1]=X[W*3+1],K[2]=X[W*3+2];if(_w1(K,K,Q),yn(K,K),Y)X[W*3]=d0.decodeNormalizedInt(K[0],$),X[W*3+1]=d0.decodeNormalizedInt(K[1],$),X[W*3+2]=d0.decodeNormalizedInt(K[2],$);else X[W*3]=K[0],X[W*3+1]=K[1],X[W*3+2]=K[2]}}function Rn(Z,J){let X=J.getArray(),Y=J.getNormalized(),$=J.getComponentType(),Q=m2();for(let K=0,W=J.getCount();K<W;K++){if(Y)Q[0]=d0.decodeNormalizedInt(X[K*4],$),Q[1]=d0.decodeNormalizedInt(X[K*4+1],$),Q[2]=d0.decodeNormalizedInt(X[K*4+2],$);else Q[0]=X[K*4],Q[1]=X[K*4+1],Q[2]=X[K*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],yn(Q,Q),Y)X[K*4]=d0.decodeNormalizedInt(Q[0],$),X[K*4+1]=d0.decodeNormalizedInt(Q[1],$),X[K*4+2]=d0.decodeNormalizedInt(Q[2],$);else X[K*4]=Q[0],X[K*4+1]=Q[1],X[K*4+2]=Q[2]}}function GB1(Z){if(Z.getMode()!==M8.Mode.TRIANGLES)return;if(!Z.getIndices())d2(Z);let J=Z.getIndices();for(let X=0,Y=J.getCount();X<Y;X+=3){let $=J.getScalar(X),Q=J.getScalar(X+2);J.setScalar(X,Q),J.setScalar(X+2,$)}}function zB1(Z,J){for(let X of Z.listPrimitives()){let Y=VB1(X,Z);if(X!==Y)Z.removePrimitive(X).addPrimitive(Y)}for(let X of Z.listPrimitives())E3(X),sn(X,J)}function VB1(Z,J){if(Z.listParents().some((Y)=>Y instanceof $3&&Y!==J))Z=Z.clone();for(let Y of Z.listTargets())if(Y.listParents().some((Q)=>Q instanceof M8&&Q!==Z))Z.removeTarget(Y).addTarget(Y.clone());return Z}var Nn=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function on(Z){let J=Z.getMesh(),X=Z.getMatrix();if(J&&!d0.eq(X,Nn))zB1(J,X);for(let Y of Z.listChildren()){let $=Y.getMatrix();bn($,$,X),Y.setMatrix($)}return Z.setMatrix(Nn)}var{LINES:HB1,LINE_STRIP:qB1,LINE_LOOP:FB1,TRIANGLES:UB1,TRIANGLE_STRIP:LB1,TRIANGLE_FAN:wB1}=M8.Mode;function BB1(Z){let J=Z.getGraph(),X=C6.fromGraph(J);if(!Z.getIndices())d2(Z);let Y=Z.getIndices(),$=Y.getArray(),Q=An(Z),W=new GJ[Y.getComponentType()](Q*2),G=Z.getMode();if(G===qB1)for(let V=0;V<Q;V++)W[V*2]=$[V],W[V*2+1]=$[V+1];else if(G===FB1)for(let V=0;V<Q;V++)if(V<Q-1)W[V*2]=$[V],W[V*2+1]=$[V+1];else W[V*2]=$[V],W[V*2+1]=$[0];else throw new Error("Only LINE_STRIP and LINE_LOOP may be converted to LINES.");Z.setMode(HB1);let z=X.getRoot();if(Y.listParents().some((V)=>V!==z&&V!==Z))Z.setIndices(HZ(X,Y).setArray(W));else Y.setArray(W)}function rn(Z){let J=Z.getGraph(),X=C6.fromGraph(J);if(!Z.getIndices())d2(Z);let Y=Z.getIndices(),$=Y.getArray(),Q=An(Z),W=new GJ[Y.getComponentType()](Q*3),G=Z.getMode();if(G===LB1)for(let V=0,H=$.length;V<H-2;V++)if(V%2)W[V*3]=$[V+1],W[V*3+1]=$[V],W[V*3+2]=$[V+2];else W[V*3]=$[V],W[V*3+1]=$[V+1],W[V*3+2]=$[V+2];else if(G===wB1)for(let V=0;V<Q;V++)W[V*3]=$[0],W[V*3+1]=$[V+1],W[V*3+2]=$[V+2];else throw new Error("Only TRIANGLE_STRIP and TRIANGLE_FAN may be converted to TRIANGLES.");Z.setMode(UB1);let z=X.getRoot();if(Y.listParents().some((V)=>V!==z&&V!==Z))Z.setIndices(HZ(X,Y).setArray(W));else Y.setArray(W)}var Pn="dequantize",b2={pattern:/^((?!JOINTS_).)*$/};function tn(Z=b2){let J=W7(b2,Z);return MJ(Pn,(X)=>{let Y=X.getLogger();for(let $ of X.getRoot().listMeshes())for(let Q of $.listPrimitives())jB1(Q,J);X.createExtension(T3).dispose(),Y.debug(`${Pn}: Complete.`)})}function jB1(Z,J=b2){let X=W7(b2,J);for(let Y of Z.listSemantics())if(X.pattern.test(Y))PC(Z.getAttribute(Y));for(let Y of Z.listTargets())for(let $ of Y.listSemantics())if(X.pattern.test($))PC(Y.getAttribute($))}function PC(Z){let J=Z.getArray();if(!J)return;let X=y2(J,Z.getComponentType(),Z.getNormalized());Z.setArray(X).setNormalized(!1)}function y2(Z,J,X){let Y=new Float32Array(Z.length);for(let $=0,Q=Z.length;$<Q;$++)if(X)Y[$]=d0.decodeNormalizedInt(Z[$],J);else Y[$]=Z[$];return Y}var{TEXTURE_INFO:en,ROOT:YV6}=a;function Za(Z){let J=new C6().setLogger(Z.getLogger()),X=IC(J,Z);return OB1(J,Z,X),J.getRoot().copy(Z.getRoot(),X),J}function OB1(Z,J,X){X||(X=IC(Z,J));for(let Y of J.getRoot().listExtensionsUsed()){let $=Z.createExtension(Y.constructor);if(Y.isRequired())$.setRequired(!0)}return MB1(Z,J,RB1(J),X)}function MB1(Z,J,X,Y){Y||(Y=IC(Z,J));let $=new Map;for(let Q of X)if(!$.has(Q)&&Q.propertyType!==en)$.set(Q,Y(Q));for(let[Q,K]of $.entries())K.copy(Q,Y);return $}function IC(Z,J){let X=new Map([[J.getRoot(),Z.getRoot()]]);return(Y)=>{if(Y.propertyType===en)return Y;let $=X.get(Y);if(!$)$=new Y.constructor(Z.getGraph()),X.set(Y,$);return $}}function RB1(Z){let J=new Set;for(let X of Z.getGraph().listEdges())J.add(X.getChild());return Array.from(J)}var BC="flatten",Dn={cleanup:!0};function Ja(Z=Dn){let J=W7(Dn,Z);return MJ(BC,async(X)=>{let Y=X.getRoot(),$=X.getLogger(),Q=new Set;for(let z of Y.listSkins())for(let V of z.listJoints())Q.add(V);let K=new Set;for(let z of Y.listAnimations())for(let V of z.listChannels()){let H=V.getTargetNode();if(H&&V.getTargetPath()!=="weights")K.add(H)}let W=new Set,G=new Set;for(let z of Y.listScenes())z.traverse((V)=>{let H=V.getParentNode();if(!H)return;if(Q.has(H)||W.has(H))W.add(V);if(K.has(H)||G.has(H))G.add(V)});for(let z of Y.listScenes())z.traverse((V)=>{if(K.has(V))return;if(W.has(V))return;if(G.has(V))return;Pw1(V)});if(K.size)$.debug(`${BC}: Flattening node hierarchies with TRS animation not yet supported.`);if(J.cleanup)await X.transform(u2({propertyTypes:[a.NODE],keepLeaves:!1}));$.debug(`${BC}: Complete.`)})}function Xa(Z){return DP(Z)}var NB1={skipValidation:!1},Cn=4294967295,{LINE_STRIP:PB1,LINE_LOOP:DB1,TRIANGLE_STRIP:CB1,TRIANGLE_FAN:TB1}=M8.Mode;function kB1(Z,J={}){let X=W7(NB1,J),Y=Z[0],$=C6.fromGraph(Y.getGraph());if(!X.skipValidation&&new Set(Z.map(hn)).size>1)throw new Error("Requires >=2 Primitives, sharing the same Material and Mode, with compatible vertex attributes and indices.");for(let F of Z)switch(F.getMode()){case PB1:case DB1:BB1(F);break;case CB1:case TB1:rn(F);break}let Q=[],K=new Uint32Array(Z.length),W=0,G=0;for(let F=0;F<Z.length;F++){let U=Z[F],w=U.getIndices(),L=U.getAttribute("POSITION").getCount(),j=w?w.getArray():null,R=w?w.getCount():L,O=new Uint32Array(L).fill(Cn);for(let N=0;N<R;N++){let D=j?j[N]:N;if(O[D]===Cn)O[D]=W++,K[F]++}Q.push(O),G+=R}let z=$.createPrimitive().setMode(Y.getMode()).setMaterial(Y.getMaterial());for(let F of Y.listSemantics()){let U=Y.getAttribute(F),w=GJ[U.getComponentType()],L=HZ($,U).setArray(new w(W*U.getElementSize()));z.setAttribute(F,L)}let V=Y.getIndices(),H=V?HZ($,V).setArray(kC(G,W)):null;z.setIndices(H);let q=0;for(let F=0;F<Q.length;F++){let U=Z[F],w=U.getIndices(),L=w?w.getCount():-1,j=Q[F];if(w&&H)IB1(w,j,H,q),q+=L;for(let R of z.listSemantics()){let O=U.getAttribute(R),N=z.getAttribute(R);EB1(O,w,j,N)}}return z}function EB1(Z,J,X,Y){let $=Z.getElementSize(),Q=J?J.getArray():null,K=Z.getCount(),W=Z.getArray(),G=Y.getArray(),z=new Uint8Array(Z.getCount());for(let V=0,H=J?J.getCount():K;V<H;V++){let q=Q?Q[V]:V,F=X[q];if(z[F])continue;for(let U=0;U<$;U++)G[F*$+U]=W[q*$+U];z[F]=1}}function IB1(Z,J,X,Y){let $=Z.getCount(),Q=Z.getArray(),K=X.getArray();for(let W=0;W<$;W++){let G=Q[W],z=J[G];K[Y+W]=z}}var DC="join",{ROOT:vB1,NODE:SB1,MESH:_B1,PRIMITIVE:AB1,ACCESSOR:xB1}=a,jC=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Tn={keepMeshes:!1,keepNamed:!1,cleanup:!0};function Ya(Z=Tn){let J=W7(Tn,Z);return MJ(DC,async(X)=>{let Y=X.getRoot(),$=X.getLogger();for(let Q of Y.listScenes())kn(X,Q,J),Q.traverse((K)=>kn(X,K,J));if(J.cleanup)await X.transform(u2({propertyTypes:[SB1,_B1,AB1,xB1],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}));$.debug(`${DC}: Complete.`)})}function kn(Z,J,X){let Y=Z.getLogger(),$={},Q=J.listChildren();for(let G=0;G<Q.length;G++){let z=Q[G];if(z.listParents().some((q)=>q instanceof rX))continue;let H=z.getMesh();if(!H)continue;if(z.getExtension("EXT_mesh_gpu_instancing"))continue;if(z.getSkin())continue;for(let q of H.listPrimitives()){if(q.listTargets().length>0)continue;let F=q.getMaterial();if(F&&F.getExtension("KHR_materials_volume"))continue;E3(q),fB1(q);let U=hn(q),w=H.getName()||z.getName();if(X.keepMeshes||X.keepNamed&&w)U+=`|${G}`;if(!(U in $))$[U]={prims:[],primMeshes:[],primNodes:[],dstNode:z,dstMesh:void 0};let L=$[U];L.prims.push(q),L.primNodes.push(z)}}let K=Object.values($).filter(({prims:G})=>G.length>1),W=new Set(K.flatMap((G)=>G.primNodes));for(let G of W){let z=G.getMesh();if(z.listParents().some((H)=>{return H.propertyType!==vB1&&G!==H}))G.setMesh(z.clone())}for(let G of K){let{dstNode:z,primNodes:V}=G;G.dstMesh=z.getMesh(),G.primMeshes=V.map((H)=>H.getMesh())}for(let G of K){let{prims:z,primNodes:V,primMeshes:H,dstNode:q,dstMesh:F}=G,U=q.getMatrix();for(let j=0;j<z.length;j++){let R=V[j],O=H[j],N=z[j];if(O.removePrimitive(N),Ow1(N))N=z[j]=hB1(z[j]);if(R!==q)bn(jC,Dw1(jC,U),R.getMatrix()),sn(N,jC)}let w=kB1(z),L=w.listAttributes()[0].getCount();F.addPrimitive(w),Y.debug(`${DC}: Joined Primitives (${z.length}) containing ${OC(L)} vertices under Node "${q.getName()}".`)}}function hB1(Z){let J=Z.clone();for(let Y of J.listSemantics())J.setAttribute(Y,J.getAttribute(Y).clone());let X=J.getIndices();if(X)J.setIndices(X.clone());return J}function fB1(Z){for(let J of["POSITION","NORMAL","TANGENT"]){let X=Z.getAttribute(J);if(X)PC(X)}}var{TRANSLATION:$V6,ROTATION:QV6,SCALE:KV6,WEIGHTS:WV6}=rX.TargetPath;var bB1={pattern:/.*/,quantizationVolume:"mesh",quantizePosition:14,quantizeNormal:10,quantizeTexcoord:12,quantizeColor:8,quantizeWeight:8,quantizeGeneric:12,normalizeWeights:!0,cleanup:!0};var GV6=iQ({level:"high"},bB1);var yB1="unweld";function gB1(Z,J=new Map){let X=Z.getIndices();if(!X)return;let Y=Z.getGraph(),$=C6.fromGraph(Y),Q=$.getLogger(),K=Z.getAttribute("POSITION").getCount();for(let G of Z.listAttributes())if(Z.swap(G,En($,G,X,J)),G.listParents().length===1)G.dispose();for(let G of Z.listTargets())for(let z of G.listAttributes())if(G.swap(z,En($,z,X,J)),z.listParents().length===1)z.dispose();let W=Z.getAttribute("POSITION").getCount();if(Q.debug(`${yB1}: ${g2(K,W)} vertices.`),Z.setIndices(null),X.listParents().length===1)X.dispose()}function En(Z,J,X,Y){if(Y.has(J)&&Y.get(J).has(X))return Y.get(J).get(X);let $=J.getArray(),K=new $.constructor(X.getCount()*J.getElementSize()),W=X.getArray(),G=J.getElementSize();for(let V=0,H=X.getCount();V<H;V++)for(let q=0;q<G;q++)K[V*G+q]=$[W[V]*G+q];if(!Y.has(J))Y.set(J,new Map);let z=HZ(Z,J).setArray(K);return Y.get(J).set(X,z),z}var In;(function(Z){Z[Z.STEP=0]="STEP",Z[Z.LERP=1]="LERP",Z[Z.SLERP=2]="SLERP"})(In||(In={}));var mB1=0.000001;function uB1(Z,J,X,Y=0.0001){let $=J.length/Z.length,Q=new Array($).fill(0),K=new Array($).fill(0),W=new Array($).fill(0),G=new Array($).fill(0),z=Z.length-1,V=1;for(let H=1;H<z;++H){let q=Z[V-1],F=Z[H],U=Z[H+1],w=(F-q)/(U-q),L=!1;if(F!==U&&(H!==1||F!==Z[0])){if(k3(J,V-1,G),k3(J,H,K),k3(J,H+1,W),X==="slerp"){let j=lB1(Q,G,W,w),R=Sn(G,K)+Sn(K,W);L=!h2(K,j,Y)||R+Number.EPSILON>=Math.PI}else if(X==="lerp"){let j=cB1(Q,G,W,w);L=!h2(K,j,Y)}else if(X==="step")L=!h2(K,G)||!h2(K,W)}if(L){if(H!==V)Z[V]=Z[H],vn(J,V,k3(J,H,Q));V++}}if(z>0)Z[V]=Z[z],vn(J,V,k3(J,z,Q)),V++;return V}function k3(Z,J,X){for(let Y=0,$=X.length;Y<$;Y++)X[Y]=Z[J*$+Y];return X}function vn(Z,J,X){for(let Y=0,$=X.length;Y<$;Y++)Z[J*$+Y]=X[Y]}function h2(Z,J,X=0){if(Z.length!==J.length)return!1;for(let Y=0;Y<Z.length;Y++)if(Math.abs(Z[Y]-J[Y])>X)return!1;return!0}function dB1(Z,J,X){return Z*(1-X)+J*X}function cB1(Z,J,X,Y){for(let $=0;$<J.length;$++)Z[$]=dB1(J[$],X[$],Y);return Z}function lB1(Z,J,X,Y){let $=J[0],Q=J[1],K=J[2],W=J[3],G=X[0],z=X[1],V=X[2],H=X[3],q,F,U,w,L;if(F=$*G+Q*z+K*V+W*H,F<0)F=-F,G=-G,z=-z,V=-V,H=-H;if(1-F>mB1)q=Math.acos(F),U=Math.sin(q),w=Math.sin((1-Y)*q)/U,L=Math.sin(Y*q)/U;else w=1-Y,L=Y;return Z[0]=w*$+L*G,Z[1]=w*Q+L*z,Z[2]=w*K+L*V,Z[3]=w*W+L*H,Z}function Sn(Z,J){let X=pB1(Z,J);return Math.acos(2*X*X-1)}function pB1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}var zV6=new Float32Array(0),VV6={ready:Promise.resolve(),resample:uB1,tolerance:0.0001,cleanup:!0};var MY="simplify",{POINTS:$a,LINES:iB1,LINE_STRIP:nB1,LINE_LOOP:aB1,TRIANGLES:sB1,TRIANGLE_STRIP:Qa,TRIANGLE_FAN:Ka}=M8.Mode,Wa={ratio:0,error:0.0001,lockBorder:!1,cleanup:!0};function Ga(Z){let J=W7(Wa,Z),X=J.simplifier;if(!X)throw new Error(`${MY}: simplifier dependency required \u2014 install "meshoptimizer".`);return MJ(MY,async(Y)=>{let $=Y.getLogger();await X.ready,await Y.transform(EC({overwrite:!1,cleanup:J.cleanup}));let Q=0;for(let K of Y.getRoot().listMeshes()){for(let W of K.listPrimitives()){let G=W.getMode();if(G===sB1||G===Qa||G===Ka){if(_n(W,J),OJ(W,w6.RENDER)===0)W.dispose()}else if(W.getMode()===$a&&!!X.simplifyPoints){if(_n(W,J),OJ(W,w6.RENDER)===0)W.dispose()}else Q++}if(K.listPrimitives().length===0)K.dispose()}if(Q>0)$.warn(`${MY}: Skipping simplification of ${Q} primitives: Unsupported draw mode.`);if(J.cleanup)await Y.transform(u2({propertyTypes:[a.ACCESSOR,a.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),gn({propertyTypes:[a.ACCESSOR]}));$.debug(`${MY}: Complete.`)})}function _n(Z,J){let X=iQ({},Wa,J),Y=X.simplifier,$=Z.getGraph(),Q=C6.fromGraph($),K=Q.getLogger();switch(Z.getMode()){case $a:return oB1(Q,Z,X);case iB1:case nB1:case aB1:return K.warn(`${MY}: Skipping primitive simplification: Unsupported draw mode.`),Z;case Qa:case Ka:rn(Z);break}let W=OJ(Z,w6.UPLOAD),G=OJ(Z,w6.RENDER);if(G<W/2)E3(Z);let z=Z.getAttribute("POSITION"),V=Z.getIndices(),H=z.getArray(),q=V.getArray();if(!(H instanceof Float32Array))H=y2(H,z.getComponentType(),z.getNormalized());if(!(q instanceof Uint32Array))q=new Uint32Array(q);let F=Math.floor(X.ratio*G/3)*3,U=X.lockBorder?["LockBorder"]:[],[w,L]=Y.simplify(q,H,3,F,X.error,U);if(Z.setIndices(HZ(Q,V).setArray(w)),V.listParents().length===1)V.dispose();E3(Z);let j=OJ(Z,w6.UPLOAD);if(j<=65534)Z.getIndices().setArray(new Uint16Array(Z.getIndices().getArray()));return K.debug(`${MY}: ${g2(W,j)} vertices, error: ${L.toFixed(4)}.`),Z}function oB1(Z,J,X){let Y=X.simplifier,$=Z.getLogger();if(J.getIndices())gB1(J);let K=J.getAttribute("POSITION"),W=J.getAttribute("COLOR_0"),G=K.getCount(),z=K.getArray(),V=W?W.getArray():void 0,H=W?W.getComponentSize():void 0;if(!(z instanceof Float32Array))z=y2(z,K.getComponentType(),K.getNormalized());if(V&&!(V instanceof Float32Array))V=y2(V,K.getComponentType(),K.getNormalized());Y.useExperimentalFeatures=!0;let q=Math.floor(X.ratio*G),F=Y.simplifyPoints(z,3,q,V,H);Y.useExperimentalFeatures=!1;let[U,w]=Y.compactMesh(F);$.debug(`${MY}: ${g2(K.getCount(),w)} vertices.`);for(let L of TC(J)){let j=HZ(Z,L);if(RC(L,null,U,j,w),ww1(J,L,j),L.listParents().length===1)L.dispose()}return J}var CC;(function(Z){Z.LANCZOS3="lanczos3",Z.LANCZOS2="lanczos2"})(CC||(CC={}));var HV6={resizeFilter:CC.LANCZOS3,pattern:void 0,formats:void 0,slots:void 0,quality:void 0,effort:void 0,lossless:!1,nearLossless:!1,limitInputPixels:!0};var FV6=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 X,Y=WebAssembly.instantiate($(Z),{}).then(function(F){X=F.instance,X.exports.__wasm_call_ctors(),X.exports.meshopt_encodeVertexVersion(0),X.exports.meshopt_encodeIndexVersion(1)});function $(F){var U=new Uint8Array(F.length);for(var w=0;w<F.length;++w){var L=F.charCodeAt(w);U[w]=L>96?L-97:L>64?L-39:L+4}var j=0;for(var w=0;w<F.length;++w)U[j++]=U[w]<60?J[U[w]]:(U[w]-60)*64+U[++w];return U.buffer.slice(0,j)}function Q(F){if(!F)throw new Error("Assertion failed")}function K(F){return new Uint8Array(F.buffer,F.byteOffset,F.byteLength)}function W(F,U,w,L){var j=X.exports.sbrk,R=j(U.length*4),O=j(w*4),N=new Uint8Array(X.exports.memory.buffer),D=K(U);if(N.set(D,R),L)L(R,R,U.length,w);var P=F(O,R,U.length,w);N=new Uint8Array(X.exports.memory.buffer);var C=new Uint32Array(w);new Uint8Array(C.buffer).set(N.subarray(O,O+w*4)),D.set(N.subarray(R,R+U.length*4)),j(R-j(0));for(var T=0;T<U.length;++T)U[T]=C[U[T]];return[C,P]}function G(F,U,w,L){var j=X.exports.sbrk,R=j(w*4),O=j(w*L),N=new Uint8Array(X.exports.memory.buffer);N.set(K(U),O),F(R,O,w,L),N=new Uint8Array(X.exports.memory.buffer);var D=new Uint32Array(w);return new Uint8Array(D.buffer).set(N.subarray(R,R+w*4)),j(R-j(0)),D}function z(F,U,w,L,j){var R=X.exports.sbrk,O=R(U),N=R(L*j),D=new Uint8Array(X.exports.memory.buffer);D.set(K(w),N);var P=F(O,U,N,L,j),C=new Uint8Array(P);return C.set(D.subarray(O,O+P)),R(O-R(0)),C}function V(F){var U=0;for(var w=0;w<F.length;++w){var L=F[w];U=U<L?L:U}return U}function H(F,U){if(Q(U==2||U==4),U==4)return new Uint32Array(F.buffer,F.byteOffset,F.byteLength/4);else{var w=new Uint16Array(F.buffer,F.byteOffset,F.byteLength/2);return new Uint32Array(w)}}function q(F,U,w,L,j,R,O){var N=X.exports.sbrk,D=N(w*L),P=N(w*R),C=new Uint8Array(X.exports.memory.buffer);C.set(K(U),P),F(D,w,L,j,P,O);var T=new Uint8Array(w*L);return T.set(C.subarray(D,D+w*L)),N(D-N(0)),T}return{ready:Y,supported:!0,reorderMesh:function(F,U,w){var L=U?w?X.exports.meshopt_optimizeVertexCacheStrip:X.exports.meshopt_optimizeVertexCache:void 0;return W(X.exports.meshopt_optimizeVertexFetchRemap,F,V(F)+1,L)},reorderPoints:function(F,U){return Q(F instanceof Float32Array),Q(F.length%U==0),Q(U>=3),G(X.exports.meshopt_spatialSortRemap,F,F.length/U,U*4)},encodeVertexBuffer:function(F,U,w){Q(w>0&&w<=256),Q(w%4==0);var L=X.exports.meshopt_encodeVertexBufferBound(U,w);return z(X.exports.meshopt_encodeVertexBuffer,L,F,U,w)},encodeIndexBuffer:function(F,U,w){Q(w==2||w==4),Q(U%3==0);var L=H(F,w),j=X.exports.meshopt_encodeIndexBufferBound(U,V(L)+1);return z(X.exports.meshopt_encodeIndexBuffer,j,L,U,4)},encodeIndexSequence:function(F,U,w){Q(w==2||w==4);var L=H(F,w),j=X.exports.meshopt_encodeIndexSequenceBound(U,V(L)+1);return z(X.exports.meshopt_encodeIndexSequence,j,L,U,4)},encodeGltfBuffer:function(F,U,w,L){var j={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return Q(j[L]),j[L](F,U,w)},encodeFilterOct:function(F,U,w,L){return Q(w==4||w==8),Q(L>=1&&L<=16),q(X.exports.meshopt_encodeFilterOct,F,U,w,L,16)},encodeFilterQuat:function(F,U,w,L){return Q(w==8),Q(L>=4&&L<=16),q(X.exports.meshopt_encodeFilterQuat,F,U,w,L,16)},encodeFilterExp:function(F,U,w,L,j){Q(w>0&&w%4==0),Q(L>=1&&L<=24);var R={Separate:0,SharedVector:1,SharedComponent:2,Clamped:3};return q(X.exports.meshopt_encodeFilterExp,F,U,w,L,w,j?R[j]:1)}}}();var LV6=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",X=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),Y=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!=="object")return{supported:!1};var $=WebAssembly.validate(X)?W(J):W(Z),Q,K=WebAssembly.instantiate($,{}).then(function(j){Q=j.instance,Q.exports.__wasm_call_ctors()});function W(j){var R=new Uint8Array(j.length);for(var O=0;O<j.length;++O){var N=j.charCodeAt(O);R[O]=N>96?N-97:N>64?N-39:N+4}var D=0;for(var O=0;O<j.length;++O)R[D++]=R[O]<60?Y[R[O]]:(R[O]-60)*64+R[++O];return R.buffer.slice(0,D)}function G(j,R,O,N,D,P,C){var T=j.exports.sbrk,k=N+3&-4,A=T(k*D),S=T(P.length),x=new Uint8Array(j.exports.memory.buffer);x.set(P,S);var I=R(A,N,D,S,P.length);if(I==0&&C)C(A,k,D);if(O.set(x.subarray(A,A+N*D)),T(A-T(0)),I!=0)throw new Error("Malformed buffer data: "+I)}var z={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},V={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},H=[],q=0;function F(j){var R={object:new Worker(j),pending:0,requests:{}};return R.object.onmessage=function(O){var N=O.data;R.pending-=N.count,R.requests[N.id][N.action](N.value),delete R.requests[N.id]},R}function U(j){var R="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array($)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+L.name+";"+G.toString()+L.toString(),O=new Blob([R],{type:"text/javascript"}),N=URL.createObjectURL(O);for(var D=H.length;D<j;++D)H[D]=F(N);for(var D=j;D<H.length;++D)H[D].object.postMessage({});H.length=j,URL.revokeObjectURL(N)}function w(j,R,O,N,D){var P=H[0];for(var C=1;C<H.length;++C)if(H[C].pending<P.pending)P=H[C];return new Promise(function(T,k){var A=new Uint8Array(O),S=++q;P.pending+=j,P.requests[S]={resolve:T,reject:k},P.object.postMessage({id:S,count:j,size:R,source:A,mode:N,filter:D},[A.buffer])})}function L(j){var R=j.data;if(!R.id)return self.close();self.ready.then(function(O){try{var N=new Uint8Array(R.count*R.size);G(O,O.exports[R.mode],N,R.count,R.size,R.source,O.exports[R.filter]),self.postMessage({id:R.id,count:R.count,action:"resolve",value:N},[N.buffer])}catch(D){self.postMessage({id:R.id,count:R.count,action:"reject",value:D})}})}return{ready:K,supported:!0,useWorkers:function(j){U(j)},decodeVertexBuffer:function(j,R,O,N,D){G(Q,Q.exports.meshopt_decodeVertexBuffer,j,R,O,N,Q.exports[z[D]])},decodeIndexBuffer:function(j,R,O,N){G(Q,Q.exports.meshopt_decodeIndexBuffer,j,R,O,N)},decodeIndexSequence:function(j,R,O,N){G(Q,Q.exports.meshopt_decodeIndexSequence,j,R,O,N)},decodeGltfBuffer:function(j,R,O,N,D,P){G(Q,Q.exports[V[D]],j,R,O,N,Q.exports[z[P]])},decodeGltfBufferAsync:function(j,R,O,N,D){if(H.length>0)return w(j,R,O,V[N],z[D]);return K.then(function(){var P=new Uint8Array(j*R);return G(Q,Q.exports[V[N]],P,j,R,O,Q.exports[z[D]]),P})}}}();var za=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 X,Y=WebAssembly.instantiate($(Z),{}).then(function(U){X=U.instance,X.exports.__wasm_call_ctors()});function $(U){var w=new Uint8Array(U.length);for(var L=0;L<U.length;++L){var j=U.charCodeAt(L);w[L]=j>96?j-97:j>64?j-39:j+4}var R=0;for(var L=0;L<U.length;++L)w[R++]=w[L]<60?J[w[L]]:(w[L]-60)*64+w[++L];return w.buffer.slice(0,R)}function Q(U){if(!U)throw new Error("Assertion failed")}function K(U){return new Uint8Array(U.buffer,U.byteOffset,U.byteLength)}function W(U,w,L){var j=X.exports.sbrk,R=j(w.length*4),O=j(L*4),N=new Uint8Array(X.exports.memory.buffer),D=K(w);N.set(D,R);var P=U(O,R,w.length,L);N=new Uint8Array(X.exports.memory.buffer);var C=new Uint32Array(L);new Uint8Array(C.buffer).set(N.subarray(O,O+L*4)),D.set(N.subarray(R,R+w.length*4)),j(R-j(0));for(var T=0;T<w.length;++T)w[T]=C[w[T]];return[C,P]}function G(U){var w=0;for(var L=0;L<U.length;++L){var j=U[L];w=w<j?j:w}return w}function z(U,w,L,j,R,O,N,D,P){var C=X.exports.sbrk,T=C(4),k=C(L*4),A=C(R*O),S=C(L*4),x=new Uint8Array(X.exports.memory.buffer);x.set(K(j),A),x.set(K(w),S);var I=U(k,S,L,A,R,O,N,D,P,T);x=new Uint8Array(X.exports.memory.buffer);var v=new Uint32Array(I);K(v).set(x.subarray(k,k+I*4));var f=new Float32Array(1);return K(f).set(x.subarray(T,T+4)),C(T-C(0)),[v,f[0]]}function V(U,w,L,j,R,O,N,D,P,C,T,k,A){var S=X.exports.sbrk,x=S(4),I=S(L*4),v=S(R*O),f=S(R*D),p=S(P.length*4),n=S(L*4),o=C?S(R):0,J0=new Uint8Array(X.exports.memory.buffer);if(J0.set(K(j),v),J0.set(K(N),f),J0.set(K(P),p),J0.set(K(w),n),C)J0.set(K(C),o);var Q0=U(I,n,L,v,R,O,f,D,p,P.length,o,T,k,A,x);J0=new Uint8Array(X.exports.memory.buffer);var C0=new Uint32Array(Q0);K(C0).set(J0.subarray(I,I+Q0*4));var T0=new Float32Array(1);return K(T0).set(J0.subarray(x,x+4)),S(x-S(0)),[C0,T0[0]]}function H(U,w,L,j){var R=X.exports.sbrk,O=R(L*j),N=new Uint8Array(X.exports.memory.buffer);N.set(K(w),O);var D=U(O,L,j);return R(O-R(0)),D}function q(U,w,L,j,R,O,N,D){var P=X.exports.sbrk,C=P(D*4),T=P(L*j),k=P(L*O),A=new Uint8Array(X.exports.memory.buffer);if(A.set(K(w),T),R)A.set(K(R),k);var S=U(C,T,L,j,k,O,N,D);A=new Uint8Array(X.exports.memory.buffer);var x=new Uint32Array(S);return K(x).set(A.subarray(C,C+S*4)),P(C-P(0)),x}var F={LockBorder:1,Sparse:2,ErrorAbsolute:4,Prune:8,_InternalDebug:1073741824};return{ready:Y,supported:!0,useExperimentalFeatures:!1,compactMesh:function(U){Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0);var w=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return W(X.exports.meshopt_optimizeVertexFetchRemap,w,G(U)+1)},simplify:function(U,w,L,j,R,O){Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0),Q(w instanceof Float32Array),Q(w.length%L==0),Q(L>=3),Q(j>=0&&j<=U.length),Q(j%3==0),Q(R>=0);var N=0;for(var D=0;D<(O?O.length:0);++D)Q(O[D]in F),Q(this.useExperimentalFeatures||O[D]!="Prune"),N|=F[O[D]];var P=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),C=z(X.exports.meshopt_simplify,P,U.length,w,w.length/L,L*4,j,R,N);return C[0]=U instanceof Uint32Array?C[0]:new U.constructor(C[0]),C},simplifyWithAttributes:function(U,w,L,j,R,O,N,D,P,C){Q(this.useExperimentalFeatures),Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0),Q(w instanceof Float32Array),Q(w.length%L==0),Q(L>=3),Q(j instanceof Float32Array),Q(j.length%R==0),Q(R>=0),Q(N==null||N instanceof Uint8Array),Q(N==null||N.length==w.length/L),Q(D>=0&&D<=U.length),Q(D%3==0),Q(P>=0),Q(Array.isArray(O)),Q(R>=O.length),Q(O.length<=32);for(var T=0;T<O.length;++T)Q(O[T]>=0);var k=0;for(var T=0;T<(C?C.length:0);++T)Q(C[T]in F),k|=F[C[T]];var A=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),S=V(X.exports.meshopt_simplifyWithAttributes,A,U.length,w,w.length/L,L*4,j,R*4,new Float32Array(O),N?new Uint8Array(N):null,D,P,k);return S[0]=U instanceof Uint32Array?S[0]:new U.constructor(S[0]),S},getScale:function(U,w){return Q(U instanceof Float32Array),Q(U.length%w==0),Q(w>=3),H(X.exports.meshopt_simplifyScale,U,U.length/w,w*4)},simplifyPoints:function(U,w,L,j,R,O){if(Q(this.useExperimentalFeatures),Q(U instanceof Float32Array),Q(U.length%w==0),Q(w>=3),Q(L>=0&&L<=U.length/w),j)return Q(j instanceof Float32Array),Q(j.length%R==0),Q(R>=3),Q(U.length/w==j.length/R),q(X.exports.meshopt_simplifyPoints,U,U.length/w,w*4,j,R*4,O,L);else return q(X.exports.meshopt_simplifyPoints,U,U.length/w,w*4,void 0,0,0,L)}}}();var jV6=function(){var Z="b9H79Tebbbefx9Geueu9Geub9Gbb9Giuuueu9Gkuuuuuuuuuu99eu9Gvuuuuueu9Gkuuuuuuuuu9999eu9Gruuuuuuub9Gkuuuuuuuuuuueu9Gouuuuuub9Giuuub9GluuuubiOHdilvorwDqrkbiibeilve9Weiiviebeoweuec:q:Odkr:Yewo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9I919P29K9nW79O2Wt79c9V919U9KbeX9TW79O9V9Wt9F9I919P29K9nW79O2Wt7bd39TW79O9V9Wt9F9J9V9T9W91tWJ2917tWV9c9V919U9K7br39TW79O9V9Wt9F9J9V9T9W91tW9nW79O2Wt9c9V919U9K7bDL9TW79O9V9Wt9F9V9Wt9P9T9P96W9nW79O2Wtbql79IV9RbkDwebcekdsPq;L9kHdbkIbabaec9:fgefcufae9Ugeabci9Uadfcufad9Ugbaeab0Ek:oAlPue99eux998Jjjjjbc:We9Rgk8Kjjjjbakc;mbfcbc;Kbz:njjjb8AakcuaocdtgxaocFFFFi0Egmcbyd:e1jjbHjjjjbbgPBd9makceBd:SeakaPBdnakamcbyd:e1jjbHjjjjbbgsBd9qakcdBd:SeakasBd9eakcualcdtalcFFFFi0Ecbyd:e1jjbHjjjjbbgzBd9uakazBd9iakciBd:SeaPcbaxz:njjjbhHalci9UhOdnalTmbaihPalhAinaHaPydbcdtfgCaCydbcefBdbaPclfhPaAcufgAmbkkdnaoTmbcbhPashAaHhCaohXinaAaPBdbaAclfhAaCydbaPfhPaCclfhCaXcufgXmbkkdnalci6mbcbhPaihAinaAcwfydbhCaAclfydbhXasaAydbcdtfgQaQydbgQcefBdbazaQcdtfaPBdbasaXcdtfgXaXydbgXcefBdbazaXcdtfaPBdbasaCcdtfgCaCydbgCcefBdbazaCcdtfaPBdbaAcxfhAaOaPcefgP9hmbkkdnaoTmbaHhAashPaohCinaPaPydbaAydb9RBdbaAclfhAaPclfhPaCcufgCmbkkakamcbyd:e1jjbHjjjjbbgPBd9yakclBd:SeaPaHaxz:mjjjbhmakaOcbyd:e1jjbHjjjjbbgPBd9CakcvBd:SeaPcbaOz:njjjbhLakcuaOcK2alcjjjjd0Ecbyd:e1jjbHjjjjbbgKBd9GakcoBd:SeJbbbbhYdnalci6g8Ambarcd4hxaihAaKhPaOhrJbbbbhEinavaAclfydbax2cdtfgCIdlh3avaAydbax2cdtfgXIdlhYavaAcwfydbax2cdtfgQIdlh5aCIdwh8EaXIdwh8FaQIdwhaaPaCIdbghaXIdbggMaQIdbg8JMJbbnn:vUdbaPclfaXIdlaCIdlMaQIdlMJbbnn:vUdbaQIdwh8KaCIdwh8LaXIdwh8MaPcxfa3aY:tg3aaa8F:tgaNa5aY:tg5a8Ea8F:tg8EN:tgYJbbbbJbbjZahag:tgha5Na8Jag:tgga3N:tg8Fa8FNaYaYNa8EagNaaahN:tgYaYNMM:rgg:vagJbbbb9BEg3NUdbaPczfaYa3NUdbaPcCfa8Fa3NUdbaPcwfa8Ka8Ma8LMMJbbnn:vUdbaEagMhEaAcxfhAaPcKfhParcufgrmbkaEaO:Z:vJbbbZNhYkakcuaOcdtalcFFFF970Ecbyd:e1jjbHjjjjbbgCBd9KakcrBd:SeaYaD:ZN:rhYdna8AmbcbhPaChAinaAaPBdbaAclfhAaOaPcefgP9hmbkkaYJbbbZNh8MakcuaOcltalcFFFFd0Ecbyd:e1jjbHjjjjbbg8ABd9OakcwBd:Secba8AaKaCaOz:djjjb8Aakaocbyd:e1jjbHjjjjbbgPBd2aPcFeaoz:njjjbhrakc8Wfcwf9cb83ibak9cb83i8WcbhPJbbbbhEJbbbbh5Jbbbbh8EJbbbbhYJbbbbh8FJbbbbhgcbhlinJbbbbh3dnaPTmbJbbjZaP:Z:vh3kaka8Ea3NgaUdaaka5a3NghUd3akaEa3Ng8JUdKJbbbbh3dnagagNaYaYNa8Fa8FNMMg8KJbbbb9BmbJbbjZa8K:r:vh3kakaga3NUd8Saka8Fa3NUdyakaYa3NUd8Kdndndnakyd8WgQakydUgAakcKfaeaiakc;abfaKamara8Maqz:ejjjbgCcuSmbdnaPaD9pmbaAaraiaCcx2fgXydbfRbbcFeSfaraXclfydbfRbbcFeSfaraXcwfydbfRbbcFeSfaw9nmdkaQaAcbaeaiakc;abfaKamara8MJbbbbz:ejjjbgCcu9hmekakaaUdCakahUdzaka8JUdxakcuBdwakcFFF;7rBdla8AcbaKaLakcxfakcwfakclfz:fjjjbakydwgCcuSmekdnakc8WfaiaCcx2fgOydbgPaOclfydbgAaOcwfydbgXarabaeadalawaDz:gjjjbTmbalcefhlJbbbbhEJbbbbh5Jbbbbh8EJbbbbhYJbbbbh8FJbbbbhgkamaPcdtfgPaPydbcufBdbamaAcdtfgPaPydbcufBdbamaXcdtfgPaPydbcufBdbcbhXinazasaOaXcdtfydbcdtgAfydbcdtfgxhPaHaAfgvydbgQhAdnaQTmbdninaPydbaCSmeaPclfhPaAcufgATmdxbkkaPaxaQcdtfc98fydbBdbavavydbcufBdbkaXcefgXci9hmbkaKaCcK2fgPIdbh3aPIdlhaaPIdwhhaPIdxh8JaPIdzh8KaPIdCh8LaLaCfce86bbaga8LMhga8Fa8KMh8FaYa8JMhYa8EahMh8Ea5aaMh5aEa3MhEakyd88hPxekkdnaPTmbdnakyd80gAaPci2fgCciGTmbadaCfcbaPaAcu7fciGcefz:njjjb8AkabalcltfgPak8Pi8W83dbaPcwfakc8Wfcwf8Pib83dbalcefhlkcahPdninaPc98Smeakc;mbfaPfydbcbydj1jjbH:bjjjbbaPc98fhPxbkkakc:Wef8Kjjjjbalk;3vivuv99lu8Jjjjjbca9Rgv8Kjjjjbdndnalcw0mbaiydbhoaeabcitfgralcdtcufBdlaraoBdbdnalcd6mbaiclfhoalcufhwarcxfhrinaoydbhDarcuBdbarc98faDBdbarcwfhraoclfhoawcufgwmbkkalabfhrxekcbhDavczfcwfcbBdbav9cb83izavcwfcbBdbav9cb83ibJbbjZhqJbbjZhkinadaiaDcdtfydbcK2fhwcbhrinavczfarfgoawarfIdbgxaoIdbgm:tgPakNamMgmUdbavarfgoaPaxam:tNaoIdbMUdbarclfgrcx9hmbkJbbjZaqJbbjZMgq:vhkaDcefgDal9hmbkcbhoadcbcecdavIdlgxavIdwgm9GEgravIdbgPam9GEaraPax9GEgscdtgrfhzavczfarfIdbhxaihralhwinaiaocdtfgDydbhHaDarydbgOBdbaraHBdbarclfhraoazaOcK2fIdbax9Dfhoawcufgwmbkaeabcitfhrdndnaocv6mbaoalc98f6mekaraiydbBdbaralcdtcufBdlaiclfhoalcufhwarcxfhrinaoydbhDarcuBdbarc98faDBdbarcwfhraoclfhoawcufgwmbkalabfhrxekaraxUdbaeabcitfgrarydlc98GasVBdlabcefaeadaiaoz:djjjbhwararydlciGawabcu7fcdtVBdlawaeadaiaocdtfalao9Rz:djjjbhrkavcaf8Kjjjjbark;Bloeue99vue99Due99dndnaembcuhkxekJbbjZaq:thxaiabcdtfhmavydbhPavydlhsavydwhzcbhHJFFuuhOcvhbcuhkindnaPamaHcdtfydbcdtgvfydbgATmbazasavfydbcdtfhiindndnawalaiydbgCcx2fgvclfydbgXfRbbcFeSawavydbgQfRbbcFeSfawavcwfydbgLfRbbcFeSfgKmbcbhvxekcehvaraQcdtfydbgYceSmbcehvaraXcdtfydbg8AceSmbcehvaraLcdtfydbgEceSmbdna8AcdSaYcdSfaEcdSfcd6mbaKcefhvxekaKcdfhvkdnavab9kmbdndnadTmbaoaCcK2fgQIdwadIdw:tg3a3NaQIdbadIdb:tg3a3NaQIdladIdl:tg3a3NMM:raD:vaxNJbbjZMJ9VO:d86JbbjZaQIdCadIdCNaQIdxadIdxNaQIdzadIdzNMMaqN:tg3a3J9VO:d869DENh3xekaraQcdtfydbaraXcdtfydbfaraLcdtfydbfc99f:Zh3kaCakavab6a3aO9DVgQEhkavabaQEhba3aOaQEhOkaiclfhiaAcufgAmbkkaHcefgHae9hmbkkakk;bddlue99dndndnabaecitfgrydlgwciGgDci9hmbarclfhqxekinabcbawcd4gwalaDcdtfIdbabaecitfIdb:tgkJbbbb9FEgDaecefgefadaialavaoz:fjjjbak:laoIdb9FTmdabaDaw7aefgecitfgrydlgwciGgDci9hmbkarclfhqkabaecitfhecuhbindnaiaeydbgDfRbbmbadaDcK2fgrIdwalIdw:tgkakNarIdbalIdb:tgkakNarIdlalIdl:tgkakNMM:rgkaoIdb9DTmbaoakUdbavaDBdbaqydbhwkaecwfheabcefgbawcd46mbkkk;yleoudnaladfgkRbbcFeSalaefgxRbbgmcFeSfabydwgPfalaifgsRbbcFeSfaD0abydxaq9pVgzce9hmbavawcltfgmab8Pdb83dbamcwfabcwfgm8Pdb83dbdndnamydbmbcbhqxekcbhDaohminalamabydbcdtfydbfcFe86bbamclfhmaDcefgDabydwgq6mbkkdnabydxglci2gDabydlgmfgPciGTmbaraPfcbalamcu7fciGcefz:njjjb8Aabydxci2hDabydlhmabydwhqkab9cb83dwababydbaqfBdbabaDcifc98GamfBdlaxRbbhmcbhPkdnamcFeGcFe9hmbaxaP86bbababydwgmcefBdwaoabydbcdtfamcdtfaeBdbkdnakRbbcFe9hmbakabydw86bbababydwgmcefBdwaoabydbcdtfamcdtfadBdbkdnasRbbcFe9hmbasabydw86bbababydwgmcefBdwaoabydbcdtfamcdtfaiBdbkarabydlfabydxci2faxRbb86bbarabydlfabydxci2fcefakRbb86bbarabydlfabydxci2fcdfasRbb86bbababydxcefBdxazk;Ckovud99euv99eul998Jjjjjbc:G;ae9Rgo8KjjjjbdndnadTmbavcd4hrcbhwcbhDindnaiaeclfydbar2cdtfgvIdbaiaeydbar2cdtfgqIdbgk:tgxaiaecwfydbar2cdtfgmIdlaqIdlgP:tgsNamIdbak:tgzavIdlaP:tgPN:tgkakNaPamIdwaqIdwgH:tgONasavIdwaH:tgHN:tgPaPNaHazNaOaxN:tgxaxNMM:rgsJbbbb9Bmbaoc:G:qefawcx2fgAakas:vUdwaAaxas:vUdlaAaPas:vUdbaocafawc8K2fgAaq8Pdb83dbaAav8Pdb83dxaAam8Pdb83dKaAcwfaqcwfydbBdbaAcCfavcwfydbBdbaAcafamcwfydbBdbawcefhwkaecxfheaDcifgDad6mbkab9cb83dbabcyf9cb83dbabcaf9cb83dbabcKf9cb83dbabczf9cb83dbabcwf9cb83dbawTmeao9cb83iKao9cb83izaoczfaocafawci2z1jjjbaoIdKhCaoIdChXaoIdzhQao9cb83iwao9cb83ibaoaoc:G:qefawz1jjjbJbbjZhkaoIdwgPJbbbbJbbjZaPaPNaoIdbgPaPNaoIdlgsasNMM:rgx:vaxJbbbb9BEgzNhxasazNhsaPazNhzaoc:G:qefheawhvinaecwfIdbaxNaeIdbazNasaeclfIdbNMMgPakaPak9DEhkaecxfheavcufgvmbkabaCUdwabaXUdlabaQUdbabaoId3UdxdndnakJ;n;m;m899FmbJbbbbhPaoc:G:qefheaocafhvinaCavcwfIdb:taecwfIdbgHNaQavIdb:taeIdbgONaXavclfIdb:taeclfIdbgLNMMaxaHNazaONasaLNMM:vgHaPaHaP9EEhPavc8KfhvaecxfheawcufgwmbkabazUd3abc8KfaxUdbabcafasUdbabcKfaCaxaPN:tUdbabcCfaXasaPN:tUdbabaQazaPN:tUdzabJbbjZakakN:t:rgkUdydndnaxJbbj:;axJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;axJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohexekcjjjj94hekabc8Ufae86bbdndnasJbbj:;asJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;asJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkabcRfav86bbdndnazJbbj:;azJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;azJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohqxekcjjjj94hqkabaq86b8SdndnaecKtcK91:YJbb;:9c:vax:t:lavcKtcK91:YJbb;:9c:vas:t:laqcKtcK91:YJbb;:9c:vaz:t:lakMMMJbb;:9cNJbbjZMgk:lJbbb9p9DTmbak:Ohexekcjjjj94hekaecFbaecFb9iEhexekabcjjj;8iBdycFbhekabae86b8Vxekab9cb83dbabcyf9cb83dbabcaf9cb83dbabcKf9cb83dbabczf9cb83dbabcwf9cb83dbkaoc:G;aef8Kjjjjbk:mvdouq99cbhi8Jjjjjbca9RglczfcwfcbBdbal9cb83izalcwfcbBdbal9cb83ibdnadTmbcbhvinaeaifhocbhrinalczfarfgwavawydbgwaoarfIdbgDaearawcx2ffIdb9DEBdbalarfgwavawydbgwaDaearawcx2ffIdb9EEBdbarclfgrcx9hmbkaicxfhiavcefgvad9hmbkkJbbbbhDcbhrcbhicbhvinaealarfydbcx2fgwIdwaealczfarfydbcx2fgoIdw:tgqaqNawIdbaoIdb:tgqaqNawIdlaoIdl:tgqaqNMMgqaDaqaD9EgwEhDavaiawEhiarclfhravcefgvci9hmbkaealczfaicdtgvfydbcx2fgrIdwaealavfydbcx2fglIdwMJbbbZNhqarIdlalIdlMJbbbZNhkarIdbalIdbMJbbbZNhxaD:rJbbbZNhDdnadTmbindnaecwfIdbgmaq:tgPaPNaeIdbgsax:tgPaPNaeclfIdbgzak:tgPaPNMMgPaDaDN9ETmbaqaDaP:rgH:vJbbbZNJbbbZMgPNamJbbjZaP:tgONMhqakaPNazaONMhkaxaPNasaONMhxaDaHMJbbbZNhDkaecxfheadcufgdmbkkabaDUdxabaqUdwabakUdlabaxUdbkjeeiu8Jjjjjbcj8W9Rgr8Kjjjjbaici2hwdnaiTmbawceawce0EhDarhiinaiaeadRbbcdtfydbBdbadcefhdaiclfhiaDcufgDmbkkabarawaladaoz:hjjjbarcj8Wf8Kjjjjbk:Ylequ8Jjjjjbcjx9Rgl8Kjjjjbcbhvalcjqfcbaiz:njjjb8AdndnadTmbcjehoaehrincuhwarhDcuhqavhkdninawakaoalcjqfaDcefRbbfRbb9RcFeGci6aoalcjqfaDRbbfRbb9RcFeGci6faoalcjqfaDcdfRbbfRbb9RcFeGci6fgxaq9mgmEhwdnammbaxce0mdkaxaqaxaq9kEhqaDcifhDadakcefgk9hmbkkaeawci2fgDcdfRbbhqaDcefRbbhxaDRbbhkaeavci2fgDcifaDawav9Rci2z:qjjjb8Aakalcjqffaocefgo86bbaxalcjqffao86bbaDcdfaq86bbaDcefax86bbaDak86bbaqalcjqffao86bbarcifhravcefgvad9hmbkalcFeaiz:njjjbhoadci2gDceaDce0EhqcbhxindnaoaeRbbgkfgwRbbgDcFe9hmbawax86bbaocjdfaxcdtfabakcdtfydbBdbaxhDaxcefhxkaeaD86bbaecefheaqcufgqmbkaxcdthDxekcbhDkabalcjdfaDz:mjjjb8Aalcjxf8Kjjjjbk9teiucbcbyd11jjbgeabcifc98GfgbBd11jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabk9teiucbcbyd11jjbgeabcrfc94GfgbBd11jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik9:eiuZbhedndncbyd11jjbgdaecztgi9nmbcuheadai9RcFFifcz4nbcuSmekadhekcbabae9Rcifc98Gcbyd11jjbfgdBd11jjbdnadZbcztge9nmbadae9RcFFifcz4nb8Akk:;Deludndndnadch9pmbabaeSmdaeabadfgi9Rcbadcet9R0mekabaead;8qbbxekaeab7ciGhldndndnabae9pmbdnalTmbadhvabhixikdnabciGmbadhvabhixdkadTmiabaeRbb86bbadcufhvdnabcefgiciGmbaecefhexdkavTmiabaeRbe86beadc9:fhvdnabcdfgiciGmbaecdfhexdkavTmiabaeRbd86bdadc99fhvdnabcifgiciGmbaecifhexdkavTmiabaeRbi86biabclfhiaeclfheadc98fhvxekdnalmbdnaiciGTmbadTmlabadcufgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc9:fgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc99fgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc98fgdfaeadfRbb86bbkadcl6mbdnadc98fgocd4cefciGgiTmbaec98fhlabc98fhvinavadfaladfydbBdbadc98fhdaicufgimbkkaocx6mbaec9Wfhvabc9WfhoinaoadfgicxfavadfglcxfydbBdbaicwfalcwfydbBdbaiclfalclfydbBdbaialydbBdbadc9Wfgdci0mbkkadTmdadhidnadciGglTmbaecufhvabcufhoadhiinaoaifavaifRbb86bbaicufhialcufglmbkkadcl6mdaec98fhlabc98fhvinavaifgecifalaifgdcifRbb86bbaecdfadcdfRbb86bbaecefadcefRbb86bbaeadRbb86bbaic98fgimbxikkavcl6mbdnavc98fglcd4cefcrGgdTmbavadcdt9RhvinaiaeydbBdbaeclfheaiclfhiadcufgdmbkkalc36mbinaiaeydbBdbaiaeydlBdlaiaeydwBdwaiaeydxBdxaiaeydzBdzaiaeydCBdCaiaeydKBdKaiaeyd3Bd3aecafheaicafhiavc9Gfgvci0mbkkavTmbdndnavcrGgdmbavhlxekavc94GhlinaiaeRbb86bbaicefhiaecefheadcufgdmbkkavcw6mbinaiaeRbb86bbaiaeRbe86beaiaeRbd86bdaiaeRbi86biaiaeRbl86blaiaeRbv86bvaiaeRbo86boaiaeRbr86braicwfhiaecwfhealc94fglmbkkabkkAebcjwkxebbbdbbbzNbb",J=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!=="object")return{supported:!1};var X,Y=WebAssembly.instantiate($(Z),{}).then(function(U){X=U.instance,X.exports.__wasm_call_ctors()});function $(U){var w=new Uint8Array(U.length);for(var L=0;L<U.length;++L){var j=U.charCodeAt(L);w[L]=j>96?j-97:j>64?j-39:j+4}var R=0;for(var L=0;L<U.length;++L)w[R++]=w[L]<60?J[w[L]]:(w[L]-60)*64+w[++L];return w.buffer.slice(0,R)}function Q(U){if(!U)throw new Error("Assertion failed")}function K(U){return new Uint8Array(U.buffer,U.byteOffset,U.byteLength)}var W=48,G=16;function z(U,w){var L=U.meshlets[w*4+0],j=U.meshlets[w*4+1],R=U.meshlets[w*4+2],O=U.meshlets[w*4+3];return{vertices:U.vertices.subarray(L,L+R),triangles:U.triangles.subarray(j,j+O*3)}}function V(U,w,L,j,R,O,N){var D=X.exports.sbrk,P=X.exports.meshopt_buildMeshletsBound(U.length,R,O),C=D(P*G),T=D(P*R*4),k=D(P*O*3),A=D(U.byteLength),S=D(w.byteLength),x=new Uint8Array(X.exports.memory.buffer);x.set(K(U),A),x.set(K(w),S);var I=X.exports.meshopt_buildMeshlets(C,T,k,A,U.length,S,L,j,R,O,N);x=new Uint8Array(X.exports.memory.buffer);var v=x.subarray(C,C+I*G),f=new Uint32Array(v.buffer,v.byteOffset,v.byteLength/4).slice();for(var p=0;p<I;++p){var n=f[p*4+0],o=f[p*4+1],L=f[p*4+2],J0=f[p*4+3];X.exports.meshopt_optimizeMeshlet(T+n*4,k+o,J0,L)}var Q0=f[(I-1)*4+0],C0=f[(I-1)*4+1],T0=f[(I-1)*4+2],a0=f[(I-1)*4+3],v8=Q0+T0,s1=C0+(a0*3+3&-4),u4={meshlets:f,vertices:new Uint32Array(x.buffer,T,v8).slice(),triangles:new Uint8Array(x.buffer,k,s1*3).slice(),meshletCount:I};return D(C-D(0)),u4}function H(U){var w=new Float32Array(X.exports.memory.buffer,U,W/4);return{centerX:w[0],centerY:w[1],centerZ:w[2],radius:w[3],coneApexX:w[4],coneApexY:w[5],coneApexZ:w[6],coneAxisX:w[7],coneAxisY:w[8],coneAxisZ:w[9],coneCutoff:w[10]}}function q(U,w,L,j){var R=X.exports.sbrk,O=[],N=R(w.byteLength),D=R(U.vertices.byteLength),P=R(U.triangles.byteLength),C=R(W),T=new Uint8Array(X.exports.memory.buffer);T.set(K(w),N),T.set(K(U.vertices),D),T.set(K(U.triangles),P);for(var k=0;k<U.meshletCount;++k){var A=U.meshlets[k*4+0],S=U.meshlets[k*4+0+1],x=U.meshlets[k*4+0+3];X.exports.meshopt_computeMeshletBounds(C,D+A*4,P+S,x,N,L,j),O.push(H(C))}return R(N-R(0)),O}function F(U,w,L,j){var R=X.exports.sbrk,O=R(W),N=R(U.byteLength),D=R(w.byteLength),P=new Uint8Array(X.exports.memory.buffer);P.set(K(U),N),P.set(K(w),D),X.exports.meshopt_computeClusterBounds(O,N,U.length,D,L,j);var C=H(O);return R(O-R(0)),C}return{ready:Y,supported:!0,buildMeshlets:function(U,w,L,j,R,O){Q(U.length%3==0),Q(w instanceof Float32Array),Q(w.length%L==0),Q(L>=3),Q(j<=255||j>0),Q(R<=512),Q(R%4==0),O=O||0;var N=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return V(N,w,w.length/L,L*4,j,R,O)},computeClusterBounds:function(U,w,L){Q(U.length%3==0),Q(U.length/3<=512),Q(w instanceof Float32Array),Q(w.length%L==0),Q(L>=3);var j=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return F(j,w,w.length/L,L*4)},computeMeshletBounds:function(U,w,L){return Q(U.meshletCount!=0),Q(w instanceof Float32Array),Q(w.length%L==0),Q(L>=3),q(U,w,w.length/L,L*4)},extractMeshlet:function(U,w){return Q(w>=0&&w<U.meshletCount),z(U,w)}}}();var aQ={OPTIMIZED_DIR:".optimized",CHECKSUM_EXT:".md5",DIRECTORIES:[(()=>{try{return n5.dirname(u.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js"))}catch{return null}})(),n5.resolve(process.cwd(),"assets")].filter(Boolean),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 P9{static instance=new P9;optimize=!0;optimizeEveryStart=!1;_modelUriDocuments=new Map;_modelUriBoundingBoxes=new Map;_modelUriNodeNames=new Map;_modelUriTrimeshes=new Map;constructor(){}async preloadModels(){let Z=await this._getAbsoluteModelPaths();console.log(`ModelRegistry.preloadModels(): Preloading ${Z.length} models...`);for(let J of Z){if(this.optimize)await this._resolveOptimizedModelPath(J);await this._loadModelData(J)}console.log(`ModelRegistry.preloadModels(): Preloaded ${Z.length} models!`)}getAnimationNames(Z){let J=this._modelUriDocuments.get(Z);if(!J)m.fatalError(`ModelRegistry.getAnimationNames(): Model ${Z} not found!`);return J.getRoot().listAnimations().map((Y)=>Y.getName())}getBoundingBox(Z){let J=this._modelUriBoundingBoxes.get(Z);if(!J)m.fatalError(`ModelRegistry.getBoundingBox(): Model ${Z} not found!`);return J}getHeight(Z){let J=this.getBoundingBox(Z);return J.max.y-J.min.y}getNodeNames(Z){let J=this._modelUriNodeNames.get(Z);if(!J)m.fatalError(`ModelRegistry.getNodeNames(): Model ${Z} not found!`);return J}getTrimesh(Z,J=1){let X=this._modelUriTrimeshes.get(Z);if(!X){m.error(`ModelRegistry.getTrimesh(): Model ${Z} not found!`);return}let Y=X.vertices;if(J!==1){Y=new Float32Array(Y.length);for(let $=0;$<Y.length;$++)Y[$]=X.vertices[$]*J}return{vertices:Y,indices:X.indices}}modelHasNode(Z,J){let X=this._modelUriNodeNames.get(Z);if(!X)m.fatalError(`ModelRegistry.modelHasNode(): Model ${Z} not found!`);return X.includes(J)}_absoluteModelPathToModelUri(Z){let J=n5.normalize(Z);for(let X of aQ.DIRECTORIES){let Y=n5.normalize(X);if(J.startsWith(Y))return n5.relative(Y,J).replace(/\\/g,"/")}return n5.basename(J)}async _getAbsoluteModelPaths(){let Z=[];for(let J of aQ.DIRECTORIES){let X=n5.resolve(process.cwd(),J);if(!RJ.existsSync(X))continue;let Y=await IU("**/*.{gltf,glb}",{cwd:X,follow:!0});for(let $ of Y)Z.push(n5.join(X,$))}return Z}async _loadModelData(Z){let J=await new vP().read(Z),X=Xa(J.getRoot().listScenes()[0]),Y=J.getRoot().listNodes().map((Q)=>Q.getName()),$=this._absoluteModelPathToModelUri(Z);this._modelUriDocuments.set($,J),this._modelUriBoundingBoxes.set($,{min:{x:X.min[0],y:X.min[1],z:X.min[2]},max:{x:X.max[0],y:X.max[1],z:X.max[2]}}),this._modelUriNodeNames.set($,Y),this._modelUriTrimeshes.set($,await this._buildTrimesh($))}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)}${aQ.CHECKSUM_EXT}`;if(!RJ.existsSync(J))return!1;let X=this._calculateChecksum(Z),Y=RJ.readFileSync(J,"utf8");return X===Y}_calculateChecksum(Z){if(!RJ.existsSync(Z))return"";let J=RJ.readFileSync(Z);return rB1.createHash("sha256").update(J.toString("base64")).digest("hex")}_buildOptimizedModelPath(Z){let J=n5.basename(Z),X=J.replace(/\.[^/.]+$/,""),Y=n5.dirname(Z),$=n5.join(Y,aQ.OPTIMIZED_DIR,X);return n5.join($,J)}async _buildTrimesh(Z,J=1,X=0.001){let Y=this._modelUriDocuments.get(Z);if(!Y)m.fatalError(`ModelRegistry._buildTrimesh(): Model ${Z} not found!`);let $=Za(Y);$.setLogger(new j5(X3.WARN)),await $.transform(fn({pivot:"center"}),Ja(),Ya(),EC(),Ga({simplifier:za,ratio:J,error:X}),tn());for(let z of $.getRoot().listScenes())for(let V of z.listChildren())on(V);let Q=$.getRoot().listMeshes()[0];if(!Q){m.error(`ModelRegistry._buildTrimesh(): Model ${Z} has no root mesh!`);return}let K=Q.listPrimitives()[0];if(!K){m.error(`ModelRegistry._buildTrimesh(): Model ${Z} has no root primitive!`);return}let W=K.getAttribute("POSITION"),G=K.getIndices();if(!W||!G){m.error(`ModelRegistry._buildTrimesh(): Model ${Z} missing required geometry data!`);return}return{vertices:W.getArray(),indices:G.getArray()}}async _optimizeModel(Z,J){let X=n5.dirname(J);RJ.rmSync(X,{recursive:!0,force:!0}),RJ.mkdirSync(X,{recursive:!0}),console.log(`ModelRegistry: Optimizing model ${this._absoluteModelPathToModelUri(Z)}...`);for(let Y of aQ.OPTIMIZER_RUNS){let $=J.replace(/(\.[^/.]+)$/,`${Y.suffix}$1`),{stderr:Q}=await wd("npx",["gltf-transform","optimize",Z,$,...Y.options]);if(Q)return m.warning(`ModelRegistry._optimizeModel(): Error optimizing model ${this._absoluteModelPathToModelUri(Z)}, defaulting to unoptimized model. Error: ${Q}`),Z}return RJ.writeFileSync(`${J}${aQ.CHECKSUM_EXT}`,this._calculateChecksum(Z)),J}}var I3;(($)=>{$.DYNAMIC="dynamic";$.FIXED="fixed";$.KINEMATIC_POSITION="kinematic_position";$.KINEMATIC_VELOCITY="kinematic_velocity"})(I3||={});var vC=0.001,Va="dynamic";class RY extends g0{_additionalMass=0;_colliders=new Set;_explicitSleep=!1;_enabledPositions={x:!0,y:!0,z:!0};_enabledRotations={x:!0,y:!0,z:!0};_rigidBody;_rigidBodyDesc;_rigidBodyType;_simulation;constructor(Z){super();Z.type??=Va,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:X,w:Y}=this.rotation;return{x:-2*(Z*X+Y*J),y:-2*(J*X-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:X,principalAngularInertia:Y,principalAngularInertiaLocalFrame:$}=Z;this._rigidBody?this._rigidBody.setAdditionalMassProperties(J,X,Y,$,!this._explicitSleep):this._rigidBodyDesc.setAdditionalMassProperties(J,X,Y,$)}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 X={["dynamic"]:$1.RigidBodyType.Dynamic,["fixed"]:$1.RigidBodyType.Fixed,["kinematic_position"]:$1.RigidBodyType.KinematicPositionBased,["kinematic_velocity"]:$1.RigidBodyType.KinematicVelocityBased}[Z];if(X===void 0)return m.error(`Invalid RigidBodyType: ${Z}`);this._rigidBody?this._rigidBody.setBodyType(X,!this._explicitSleep):this._rigidBodyDesc.status=X,this._rigidBodyType=Z}addForce(Z){if(!this._requireNotRemoved("addForce"))return;if(!this._requireCreated("addForce"))return;if(!this._requireDynamic("addForce"))return;if(this._isNegligibleVector(Z))return;this._rigidBody.addForce(Z,!this._explicitSleep)}addTorque(Z){if(!this._requireNotRemoved("addTorque"))return;if(!this._requireCreated("addTorque"))return;if(!this._requireDynamic("addTorque"))return;if(this._isNegligibleVector(Z))return;this._rigidBody.addTorque(Z,!this._explicitSleep)}addChildColliderToSimulation(Z){if(!this._requireNotRemoved("addChildColliderToSimulation"))return;if(!this._requireCreated("addChildColliderToSimulation"))return;Z.addToSimulation(this._simulation,this)}addToSimulation(Z){if(!this._requireNotRemoved("addToSimulation"))return;if(this._rigidBody)return m.error("RigidBody.addToSimulation(): Rigid body already exists in the simulation!");this._simulation=Z,this._rigidBody=this._simulation.createRawRigidBody(this._rigidBodyDesc),this._colliders.forEach((J)=>{if(!J.isSimulated)J.addToSimulation(Z,this)})}applyImpulse(Z){if(!this._requireNotRemoved("applyImpulse"))return;if(!this._requireCreated("applyImpulse"))return;if(!this._requireDynamic("applyImpulse"))return;if(this._isNegligibleVector(Z))return;this._rigidBody.applyImpulse(Z,!this._explicitSleep)}applyImpulseAtPoint(Z,J){if(!this._requireNotRemoved("applyImpulseAtPoint"))return;if(!this._requireCreated("applyImpulseAtPoint"))return;if(!this._requireDynamic("applyImpulseAtPoint"))return;if(this._isNegligibleVector(Z))return;this._rigidBody.applyImpulseAtPoint(Z,J,!this._explicitSleep)}applyTorqueImpulse(Z){if(!this._requireNotRemoved("applyTorqueImpulse"))return;if(!this._requireCreated("applyTorqueImpulse"))return;if(!this._requireDynamic("applyTorqueImpulse"))return;this._rigidBody.applyTorqueImpulse(Z,!this._explicitSleep)}createAndAddChildCollider(Z){if(!this._requireNotRemoved("createAndAddChildCollider"))return null;return this._simulation?new a5({...Z,parentRigidBody:this,simulation:this._simulation}):this._createAndAddPendingChildCollider(Z)}createAndAddChildCollidersToSimulation(Z){let J=[];return Z.forEach((X)=>{let Y=this.createAndAddChildCollider(X);if(Y)J.push(Y)}),J}getCollidersByTag(Z){let J=[];for(let X of this._colliders)if(X.tag===Z)J.push(X);return J}linkCollider(Z){if(!this._requireNotRemoved("linkCollider"))return;if(Z.parentRigidBody!==this)return m.error("RigidBody.linkCollider(): Collider cannot be linked because it is not a child of this rigid body!");this._colliders.add(Z)}lockAllRotations(){if(!this._requireNotRemoved("lockAllRotations"))return;this.setEnabledRotations({x:!1,y:!1,z:!1})}lockAllPositions(){if(!this._requireNotRemoved("lockAllPositions"))return;this.setEnabledPositions({x:!1,y:!1,z:!1})}removeFromSimulation(){if(!this._requireNotRemoved("removeFromSimulation"))return;if(!this._rigidBody)return m.error("RigidBody.removeFromSimulation(): Rigid body does not exist in the simulation!");this._colliders.forEach((Z)=>{Z.removeFromSimulation()}),this._simulation.removeRawRigidBody(this._rigidBody),this._simulation=void 0,this._rigidBody=void 0}unlinkCollider(Z){if(!this._requireNotRemoved("unlinkCollider"))return;if(!Z.isRemoved)return m.error("RigidBody.unlinkCollider(): Collider is still simulated and therefore cannot be unlinked from this rigid body!");this._colliders.delete(Z)}resetAngularVelocity(){if(!this._requireNotRemoved("resetAngularVelocity"))return;if(!this._requireCreated("resetAngularVelocity"))return;this.setAngularVelocity({x:0,y:0,z:0})}resetForces(){if(!this._requireNotRemoved("resetForces"))return;if(!this._requireCreated("resetForces"))return;this._rigidBody.resetForces(!this._explicitSleep)}resetLinearVelocity(){if(!this._requireNotRemoved("resetLinearVelocity"))return;if(!this._requireCreated("resetLinearVelocity"))return;this.setLinearVelocity({x:0,y:0,z:0})}resetTorques(){if(!this._requireNotRemoved("resetTorques"))return;if(!this._requireCreated("resetTorques"))return;this._rigidBody.resetTorques(!this._explicitSleep)}sleep(){if(!this._requireNotRemoved("sleep"))return;this.setSleeping(!0)}wakeUp(){if(!this._requireNotRemoved("wakeUp"))return;this.setSleeping(!1)}_applyRigidBodyOptions(Z){[["additionalMass",this.setAdditionalMass.bind(this)],["additionalMassProperties",this.setAdditionalMassProperties.bind(this)],["additionalSolverIterations",this.setAdditionalSolverIterations.bind(this)],["angularDamping",this.setAngularDamping.bind(this)],["angularVelocity",this.setAngularVelocity.bind(this)],["dominanceGroup",this.setDominanceGroup.bind(this)],["ccdEnabled",this.setCcdEnabled.bind(this)],["enabled",this.setEnabled.bind(this)],["enabledPositions",this.setEnabledPositions.bind(this)],["enabledRotations",this.setEnabledRotations.bind(this)],["gravityScale",this.setGravityScale.bind(this)],["linearDamping",this.setLinearDamping.bind(this)],["linearVelocity",this.setLinearVelocity.bind(this)],["position",this.setPosition.bind(this)],["rotation",this.setRotation.bind(this)],["sleeping",this.setSleeping.bind(this)],["softCcdPrediction",this.setSoftCcdPrediction.bind(this)]].forEach(([X,Y])=>{if(X in Z)Y(Z[X])})}_autoAddToSimulation(Z){if(Z.colliders)this._createAndAddPendingChildColliders(Z.colliders);if(Z.simulation)this.addToSimulation(Z.simulation)}_createAndAddPendingChildCollider(Z){if(!this._requireNotRemoved("createAndAddPendingChildCollider"))return null;if(!this._requireNotSimulated("createAndAddPendingChildCollider"))return null;let J=new a5(Z);return this._colliders.add(J),J}_createAndAddPendingChildColliders(Z){let J=[];return Z.forEach((X)=>{let Y=this._createAndAddPendingChildCollider(X);if(Y)J.push(Y)}),J}_createRigidBodyDesc(Z){let J=Z.type??Va;return{["dynamic"]:()=>$1.RigidBodyDesc.dynamic(),["fixed"]:()=>$1.RigidBodyDesc.fixed(),["kinematic_position"]:()=>$1.RigidBodyDesc.kinematicPositionBased(),["kinematic_velocity"]:()=>$1.RigidBodyDesc.kinematicVelocityBased()}[J]()}_requireCreated(Z){if(!this._rigidBody||!this._simulation)m.error(`RigidBody._requireCreated(): Rigid body has not been created and therefore does not support the invoked method: ${Z}()`);return!!this._rigidBody&&!!this._simulation}_requireDynamic(Z){if(!this.isDynamic)m.error(`RigidBody._requireDynamic(): Rigid body is not dynamic and therefore does not support the invoked method: ${Z}()`);return this.isDynamic}_requireKinematic(Z){if(!this.isKinematic)m.error(`RigidBody._requireKinematic(): Rigid body is not kinematic and therefore does not support the invoked method: ${Z}()`);return this.isKinematic}_requireNotKinematicPositionBased(Z){if(this.isKinematicPositionBased)m.error(`RigidBody._requireNotKinematicPositionBased(): Rigid body is kinematic position based and therefore does not support the invoked method: ${Z}()`);return!this.isKinematicPositionBased}_requireNotRemoved(Z){if(!this._rigidBody&&!this._rigidBodyDesc)m.error(`RigidBody._requireNotRemoved(): Rigid body has been removed and therefore does not support the invoked method: ${Z}()`);return!!this._rigidBody||!!this._rigidBodyDesc}_requireNotSimulated(Z){if(this.isSimulated)m.error(`RigidBody._requireNotSimulated(): Rigid body is simulated and therefore does not support the invoked method: ${Z}()`);return!this.isSimulated}_isNegligibleVector(Z){return Math.abs(Z.x)<vC&&Math.abs(Z.y)<vC&&Math.abs(Z.z)<vC}}var SC;(($)=>{$[$.Average=0]="Average";$[$.Min=1]="Min";$[$.Multiply=2]="Multiply";$[$.Max=3]="Max"})(SC||={});var v3;((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"})(v3||={});class a5 extends g0{_collider;_colliderDesc;_onCollision;_parentRigidBody;_shape;_simulation;_tag;constructor(Z){super();this._colliderDesc=this._createColliderDesc(Z),this._shape=Z.shape,this._applyColliderOptions(Z),this._autoAddToSimulation(Z)}static optionsFromBlockHalfExtents(Z){return{shape:"block",halfExtents:Z}}static optionsFromModelUri(Z,J=1,X){let Y=P9.instance.getBoundingBox(Z),$=Y.max.x-Y.min.x,Q=Y.max.y-Y.min.y,K=Y.max.z-Y.min.z,W=Math.max($,K),G=Math.min($,K),z=W/G,V=W/Q,H=W*J/2,q=(R)=>Math.max(0.01,R),F=()=>({shape:"block",halfExtents:{x:q($*J/2),y:q(Q*J/2),z:q(K*J/2)}}),U=()=>({shape:"round-cylinder",radius:q(H),halfHeight:q(Q*J/2),borderRadius:q(H*0.1)}),w=()=>{let R=P9.instance.getTrimesh(Z,J);if(!R)return;return{shape:"trimesh",vertices:R.vertices,indices:R.indices}},L=()=>({shape:"wedge",extents:{x:$*J,y:Q*J,z:K*J}}),j=()=>({shape:"capsule",radius:q(H),halfHeight:q(Q*J/2-H)});if(X)switch(X){case"block":return F();case"capsule":return j();case"round-cylinder":return U();case"trimesh":{let R=w();if(!R){m.error(`Collider.optionsFromModelUri(): Failed to create trimesh options for model ${Z}, falling back to generic shape!`);break}return R}case"wedge":return L();default:m.warning(`Collider.optionsFromModelUri(): Preferred shape ${X} is not yet supported with Collider.optionsFromModelUri(), defaulting to generic shape!`)}if(z>2)return F();if(V>1.5)return U();return j()}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?J4.decodeRawCollisionGroups(this._collider.collisionGroups()):J4.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=J4.buildRawCollisionGroups(Z);this._collider?this._collider.setCollisionGroups(J):this._colliderDesc.setCollisionGroups(J)}setEnabled(Z){if(!this._requireNotRemoved("setEnabled"))return;this._collider?this._collider.setEnabled(Z):this._colliderDesc.setEnabled(Z)}setFriction(Z){if(!this._requireNotRemoved("setFriction"))return;this._collider?this._collider.setFriction(Z):this._colliderDesc.setFriction(Z)}setFrictionCombineRule(Z){if(!this._requireNotRemoved("setFrictionCombineRule"))return;this._collider?this._collider.setFrictionCombineRule(Z):this._colliderDesc.setFrictionCombineRule(Z)}setMass(Z){if(!this._requireNotRemoved("setMass"))return;this._collider?this._collider.setMass(Z):this._colliderDesc.setMass(Z)}setOnCollision(Z){if(!this._requireNotRemoved("setOnCollision"))return;if(this._onCollision=Z,this.isSimulated)if(this.enableCollisionEvents(!!Z),Z)this._simulation.colliderMap.setColliderCollisionCallback(this,Z);else this._simulation.colliderMap.removeColliderCollisionCallback(this)}setRelativeRotation(Z){if(!this._requireNotRemoved("setRelativeRotation"))return;this._collider?this._collider.setRotation(Z):this._colliderDesc.setRotation(Z)}setRelativePosition(Z){if(!this._requireNotRemoved("setRelativePosition"))return;this._collider?this._collider.setTranslation(Z):this._colliderDesc.setTranslation(Z.x,Z.y,Z.z)}setSensor(Z){if(!this._requireNotRemoved("setSensor"))return;this._collider?this._collider.setSensor(Z):this._colliderDesc.setSensor(Z)}setTag(Z){if(!this._requireNotRemoved("setTag"))return;this._tag=Z}addToSimulation(Z,J){if(!this._requireNotRemoved("addToSimulation"))return;if(!this._requireUnsimulated("addToSimulation"))return;if(J){if(!J.isSimulated)return m.error("Collider.addToSimulation(): Rigid body must be simulated before adding a collider to it!");if(J.type==="dynamic"&&this.shape==="trimesh")m.warning("Collider.addToSimulation(): Trimesh colliders are strongly discouraged to be used with dynamic rigid bodies, they will not contribute any mass!")}if(this._simulation=Z,this._parentRigidBody=J,this._collider=this._simulation.createRawCollider(this._colliderDesc,J?.rawRigidBody),this._colliderDesc=void 0,J)J.linkCollider(this);if(this._onCollision)this.setOnCollision(this._onCollision)}enableCollisionEvents(Z){if(!this._requireNotRemoved("enableCollisionEvents"))return;let J=this._collider?this._collider.activeEvents():this._colliderDesc.activeEvents,X=Z?J|$1.ActiveEvents.COLLISION_EVENTS:J&~$1.ActiveEvents.COLLISION_EVENTS;(this._collider??this._colliderDesc).setActiveEvents(X),this._setActiveCollisionTypes()}enableContactForceEvents(Z){if(!this._requireNotRemoved("enableContactForceEvents"))return;let J=this._collider?this._collider.activeEvents():this._colliderDesc.activeEvents,X=Z?J|$1.ActiveEvents.CONTACT_FORCE_EVENTS:J&~$1.ActiveEvents.CONTACT_FORCE_EVENTS;(this._collider??this._colliderDesc).setActiveEvents(X),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(([X,Y])=>{if(Z[X]!==void 0)Y.call(this,Z[X])})}_autoAddToSimulation(Z){if(Z.simulation)this.addToSimulation(Z.simulation,Z.parentRigidBody)}_buildWedgeConvexHullVertices(Z){let{x:J,y:X,z:Y}=Z,$=J/2,Q=Y/2,K=X/2;return new Float32Array([-$,0-K,-Q,$,0-K,-Q,$,0-K,Q,-$,0-K,Q,-$,X-K,-Q,$,X-K,-Q])}_createColliderDesc(Z){let{shape:J,flags:X}=Z;switch(J){case"ball":{if(!Z.radius)m.fatalError("Ball collider must have a radius!");return $1.ColliderDesc.ball(Z.radius)}case"block":{if(!Z.halfExtents)m.fatalError("Block collider must have halfExtents!");return $1.ColliderDesc.cuboid(Z.halfExtents.x,Z.halfExtents.y,Z.halfExtents.z)}case"capsule":{if(!Z.halfHeight||!Z.radius)m.fatalError("Capsule collider must have halfHeight and radius!");return $1.ColliderDesc.capsule(Z.halfHeight,Z.radius)}case"cone":{if(!Z.radius||!Z.halfHeight)m.fatalError("Cone collider must have radius and halfHeight!");return $1.ColliderDesc.cone(Z.halfHeight,Z.radius)}case"cylinder":{if(!Z.radius||!Z.halfHeight)m.fatalError("Cylinder collider must have radius and halfHeight!");return $1.ColliderDesc.cylinder(Z.halfHeight,Z.radius)}case"round-cylinder":{if(!Z.radius||!Z.halfHeight||!Z.borderRadius)m.fatalError("Round cylinder collider must have radius, halfHeight, and borderRadius!");return $1.ColliderDesc.roundCylinder(Z.halfHeight,Z.radius,Z.borderRadius)}case"trimesh":{if(!Z.indices||!Z.vertices)m.fatalError("Trimesh collider must have vertices and indices!");return $1.ColliderDesc.trimesh(Z.vertices,Z.indices,X)}case"wedge":{if(!Z.extents)m.fatalError("Wedge collider must have extents!");let Y=this._buildWedgeConvexHullVertices(Z.extents),$=$1.ColliderDesc.convexHull(Y);if(!$)throw m.fatalError("Failed to create convex hull for wedge collider!"),new Error("Convex hull creation failed");return $}default:m.fatalError(`Collider._createColliderDesc(): ${J} is not a valid collider shape!`)}}_requireSimulated(Z){if(!this.isSimulated)m.error(`Collider._requireSimulated(): Collider is not simulated, invoked method: ${Z}()`);return this.isSimulated}_requireUnsimulated(Z){if(this.isSimulated)m.error(`Collider._requireUnsimulated(): Collider is already simulated, invoked method: ${Z}()`);return!this.isSimulated}_requireNotRemoved(Z){if(this.isRemoved)m.error(`Collider._requireNotRemoved(): Collider is removed, invoked method: ${Z}()`);return!this.isRemoved}_setActiveCollisionTypes(){(this._collider??this._colliderDesc).setActiveCollisionTypes($1.ActiveCollisionTypes.DYNAMIC_DYNAMIC|$1.ActiveCollisionTypes.DYNAMIC_KINEMATIC|$1.ActiveCollisionTypes.DYNAMIC_FIXED|$1.ActiveCollisionTypes.KINEMATIC_KINEMATIC|$1.ActiveCollisionTypes.KINEMATIC_FIXED)}}var tB1={shape:"trimesh",flags:LG.FIX_INTERNAL_EDGES},eB1=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]),Zj1=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]),_C;((X)=>{X.ENTITY_COLLISION="BLOCK_TYPE.ENTITY_COLLISION";X.ENTITY_CONTACT_FORCE="BLOCK_TYPE.ENTITY_CONTACT_FORCE"})(_C||={});class s5 extends g0{_id;_customColliderOptions;_isLiquid;_name;_textureUri;constructor(Z={id:-1,textureUri:"textures/missing.png",name:"Unknown"}){if(Z.id<0)m.fatalError("BlockType.constructor(): BlockType id not set.");super();this._id=Z.id,this._customColliderOptions=Z.customColliderOptions,this._isLiquid=Z.isLiquid??!1,this._name=Z.name,this._textureUri=Z.textureUri}get id(){return this._id}get colliderOptions(){return{...this._customColliderOptions,...tB1}}get isLiquid(){return this._isLiquid}get isMeshable(){return!this._customColliderOptions}get name(){return this._name}get textureUri(){return this._textureUri}createCollider(Z=eB1,J=Zj1){let X=new a5({...this.colliderOptions,indices:Z,vertices:J});if(this.isLiquid)X.setSensor(!0);if(this.hasListeners("BLOCK_TYPE.ENTITY_COLLISION")||this.isLiquid)X.enableCollisionEvents(!0);if(this.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))X.enableContactForceEvents(!0);if(J4.isDefaultCollisionGroups(X.collisionGroups))X.setCollisionGroups({belongsTo:[1],collidesWith:[65535&~1]});return X}serialize(){return p0.serializeBlockType(this)}}var AC;((J)=>J.REGISTER_BLOCK_TYPE="BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE")(AC||={});class S3 extends g0{_blockTypes=new Map;_world;constructor(Z){super();this._world=Z}get world(){return this._world}getAllBlockTypes(){return Array.from(this._blockTypes.values())}getBlockType(Z){let J=this._blockTypes.get(Z);if(!J)m.fatalError(`BlockTypeRegistry.getBlockType(): BlockType with id ${Z} not found.`);return J}registerGenericBlockType(Z){let X=new class extends s5{constructor(Y=Z){super(Y)}};return this.registerBlockType(X),X}registerBlockType(Z){this._blockTypes.set(Z.id,Z),this.emitWithWorld(this._world,"BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE",{blockTypeRegistry:this,id:Z.id,blockType:Z})}serialize(){return p0.serializeBlockTypeRegistry(this)}}var Gk={};d4(Gk,{worldSchema:()=>Wk,worldPacketDefinition:()=>Ye,vectorSchema:()=>v1,vectorBooleanSchema:()=>tC1,uiSchema:()=>Qk,uiPacketDefinition:()=>Je,uiDatasSchema:()=>Kk,uiDatasPacketDefinition:()=>Xe,uiDataSendPacketDefinition:()=>ut,uiDataSchema:()=>Jz,syncResponseSchema:()=>$k,syncResponsePacketDefinition:()=>Ze,syncRequestSchema:()=>xT,syncRequestPacketDefinition:()=>mt,stateRequestSchema:()=>AT,stateRequestPacketDefinition:()=>gt,sceneUIsSchema:()=>Yk,sceneUIsPacketDefinition:()=>et,sceneUISchema:()=>Xk,rgbColorSchema:()=>V7,registeredPackets:()=>EL,quaternionSchema:()=>iT,playersSchema:()=>Jk,playersPacketDefinition:()=>tt,playerSchema:()=>Zk,physicsDebugRenderSchema:()=>eT,physicsDebugRenderPacketDefinition:()=>ot,physicsDebugRaycastsSchema:()=>tT,physicsDebugRaycastsPacketDefinition:()=>rt,physicsDebugRaycastSchema:()=>rT,outboundPackets:()=>kL,modelNodeOverrideSchema:()=>pT,lightsSchema:()=>oT,lightsPacketDefinition:()=>st,lightSchema:()=>sT,isValidPacket:()=>ZT1,inputSchema:()=>_T,inputPacketDefinition:()=>yt,inboundPackets:()=>TL,hexColorSchema:()=>vT,heartbeatSchema:()=>IT,heartbeatPacketDefinition:()=>ht,entitySchema:()=>nT,entitiesSchema:()=>aT,entitiesPacketDefinition:()=>at,definePacket:()=>k0,debugConfigSchema:()=>ST,debugConfigPacketDefinition:()=>bt,createPacket:()=>dC1,connectionSchema:()=>ET,connectionPacketDefinition:()=>xt,chunksSchema:()=>lT,chunksPacketDefinition:()=>nt,chunkSchema:()=>cT,chatMessagesSchema:()=>dT,chatMessagesPacketDefinition:()=>it,chatMessageSendPacketDefinition:()=>ft,chatMessageSchema:()=>Zz,cameraSchema:()=>uT,cameraPacketDefinition:()=>pt,blocksSchema:()=>yT,blocksPacketDefinition:()=>ct,blockTypesSchema:()=>mT,blockTypesPacketDefinition:()=>lt,blockTypeSchema:()=>gT,blockSchema:()=>bT,bidirectionalPackets:()=>CL,audiosSchema:()=>fT,audiosPacketDefinition:()=>dt,audioSchema:()=>hT,PacketId:()=>x1});var CL={};d4(CL,{heartbeatPacketDefinition:()=>ht,connectionPacketDefinition:()=>xt});var TT=t(_t(),1);class kT extends TT.default{static instance=new TT.default}var x1;((T)=>{T[T.SYNC_REQUEST=0]="SYNC_REQUEST";T[T.INPUT=1]="INPUT";T[T.STATE_REQUEST=2]="STATE_REQUEST";T[T.CHAT_MESSAGE_SEND=3]="CHAT_MESSAGE_SEND";T[T.UI_DATA_SEND=4]="UI_DATA_SEND";T[T.SYNC_RESPONSE=32]="SYNC_RESPONSE";T[T.AUDIOS=33]="AUDIOS";T[T.BLOCKS=34]="BLOCKS";T[T.BLOCK_TYPES=35]="BLOCK_TYPES";T[T.CHAT_MESSAGES=36]="CHAT_MESSAGES";T[T.CHUNKS=37]="CHUNKS";T[T.ENTITIES=38]="ENTITIES";T[T.WORLD=39]="WORLD";T[T.CAMERA=40]="CAMERA";T[T.UI=41]="UI";T[T.UI_DATAS=42]="UI_DATAS";T[T.SCENE_UIS=43]="SCENE_UIS";T[T.LIGHTS=44]="LIGHTS";T[T.PLAYERS=45]="PLAYERS";T[T.CONNECTION=116]="CONNECTION";T[T.HEARTBEAT=117]="HEARTBEAT";T[T.DEBUG_CONFIG=128]="DEBUG_CONFIG";T[T.PHYSICS_DEBUG_RENDER=192]="PHYSICS_DEBUG_RENDER";T[T.PHYSICS_DEBUG_RAYCASTS=193]="PHYSICS_DEBUG_RAYCASTS"})(x1||={});function dC1(Z,J,X){if(!Z.validate(J))throw new Error(`Invalid payload for packet with id ${Z.id}. Error: ${kT.instance.errorsText(Z.validate.errors)}`);let Y=[Z.id,J];if(typeof X==="number")Y.push(X);return Y}function k0(Z,J){return{id:Z,schema:J,validate:kT.instance.compile(J)}}var cC1={type:"object",properties:{i:{type:"string"}},required:["i"],additionalProperties:!1},At={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},lC1={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},pC1={type:"object",properties:{usernameFragment:{type:"string"},password:{type:"string"},iceLite:{type:"boolean",nullable:!0}},required:["usernameFragment","password"],additionalProperties:!1},iC1={type:"object",properties:{i:{type:"string"},l:{type:"string"}},required:["i","l"],additionalProperties:!1},nC1={type:"object",properties:{port:{type:"number"},OS:{type:"number"},MIS:{type:"number"},maxMessageSize:{type:"number"}},required:["port","OS","MIS","maxMessageSize"],additionalProperties:!0},aC1={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},sC1={type:"object",properties:{i:{type:"string"},f:{type:"string",enum:["cs","sc"]},ip:pC1,ic:{type:"array",items:lC1},d:At,s:nC1},required:["i","f","ip","ic","d","s"],additionalProperties:!1},oC1={type:"object",properties:{i:{type:"string"},d:At},required:["i","d"],additionalProperties:!1},rC1={type:"object",properties:{i:{type:"string",nullable:!0},pi:{type:"string",nullable:!0},l:{type:"string"},s:aC1},required:["l","s"],additionalProperties:!1},ET={type:"object",properties:{i:{type:"string",nullable:!0},c:{...oC1,nullable:!0},ca:{...cC1,nullable:!0},d:{type:"array",items:{...rC1},nullable:!0},pa:{...iC1,nullable:!0},t:{type:"array",items:{...sC1},nullable:!0}},additionalProperties:!1};var xt=k0(116,ET);var IT={type:"null",nullable:!0};var ht=k0(117,IT);var TL={};d4(TL,{uiDataSendPacketDefinition:()=>ut,syncRequestPacketDefinition:()=>mt,stateRequestPacketDefinition:()=>gt,inputPacketDefinition:()=>yt,debugConfigPacketDefinition:()=>bt,chatMessageSendPacketDefinition:()=>ft});var vT={type:"string",pattern:"^[0-9A-Fa-f]{6}$"};var Zz={type:"object",properties:{m:{type:"string"},c:{...vT,nullable:!0},p:{type:"string",nullable:!0}},required:["m"],additionalProperties:!1};var ft=k0(3,Zz);var ST={type:"object",properties:{pdr:{type:"boolean",nullable:!0}},additionalProperties:!1};var bt=k0(128,ST);var _T={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 yt=k0(1,_T);var AT={type:"object",properties:{},additionalProperties:!1};var gt=k0(2,AT);var xT={type:"null",nullable:!0};var mt=k0(0,xT);var Jz={type:"object",properties:{},additionalProperties:!0};var ut=k0(4,Jz);var kL={};d4(kL,{worldPacketDefinition:()=>Ye,uiPacketDefinition:()=>Je,uiDatasPacketDefinition:()=>Xe,syncResponsePacketDefinition:()=>Ze,sceneUIsPacketDefinition:()=>et,playersPacketDefinition:()=>tt,physicsDebugRenderPacketDefinition:()=>ot,physicsDebugRaycastsPacketDefinition:()=>rt,lightsPacketDefinition:()=>st,entitiesPacketDefinition:()=>at,chunksPacketDefinition:()=>nt,chatMessagesPacketDefinition:()=>it,cameraPacketDefinition:()=>pt,blocksPacketDefinition:()=>ct,blockTypesPacketDefinition:()=>lt,audiosPacketDefinition:()=>dt});var v1={type:"array",items:[{type:"number"},{type:"number"},{type:"number"}],minItems:3,maxItems:3};var hT={type:"object",properties:{i:{type:"number"},a:{type:"string",nullable:!0},cd:{type:"number",nullable:!0},d:{type:"number",nullable:!0},de:{type:"number",nullable:!0},di:{type:"number",minimum:0,nullable:!0},e:{type:"number",nullable:!0},l:{type:"boolean",nullable:!0},o:{type:"number",nullable:!0},p:{...v1,nullable:!0},pa:{type:"boolean",nullable:!0},pl:{type:"boolean",nullable:!0},pr:{type:"number",minimum:0,nullable:!0},r:{type:"boolean",nullable:!0},rd:{type:"number",nullable:!0},s:{type:"number",nullable:!0},v:{type:"number",minimum:0,maximum:1,nullable:!0}},required:["i"],additionalProperties:!1};var fT={type:"array",items:{...hT}};var dt=k0(33,fT);var bT={type:"object",properties:{i:{type:"number"},c:v1},required:["i","c"],additionalProperties:!1};var yT={type:"array",items:{...bT}};var ct=k0(34,yT);var gT={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 mT={type:"array",items:{...gT}};var lt=k0(35,mT);var uT={type:"object",properties:{m:{type:"number",nullable:!0},e:{type:"number",nullable:!0},et:{type:"number",nullable:!0},fo:{type:"number",nullable:!0},ffo:{type:"number",nullable:!0},fv:{type:"number",nullable:!0},p:{...v1,nullable:!0},pt:{...v1,nullable:!0},pl:{...v1,nullable:!0},h:{type:"array",items:{type:"string"},nullable:!0},o:{...v1,nullable:!0},z:{type:"number",nullable:!0}},additionalProperties:!1};var dT={type:"array",items:{...Zz}};var cT={type:"object",properties:{c:v1,b:{type:"array",items:{type:"number",minimum:0,maximum:255},minItems:4096,maxItems:4096,nullable:!0},rm:{type:"boolean",nullable:!0}},required:["c"],additionalProperties:!1};var lT={type:"array",items:{...cT}};var V7={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 pT={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:{...V7,nullable:!0}},required:["n"],additionalProperties:!1};var iT={type:"array",items:[{type:"number"},{type:"number"},{type:"number"},{type:"number"}],minItems:4,maxItems:4};var nT={type:"object",properties:{i:{type:"number"},al:{type:"array",items:{type:"string"},nullable:!0},ao:{type:"array",items:{type:"string"},nullable:!0},ap:{type:"number",nullable:!0},as:{type:"array",items:{type:"string"},nullable:!0},bh:{...v1,nullable:!0},bt:{type:"string",nullable:!0},h:{type:"array",items:{type:"string"},nullable:!0},m:{type:"string",nullable:!0},mo:{type:"array",items:{...pT},nullable:!0},n:{type:"string",nullable:!0},o:{type:"number",nullable:!0},p:{...v1,nullable:!0},pe:{type:"number",nullable:!0},pn:{type:"string",nullable:!0},r:{...iT,nullable:!0},rm:{type:"boolean",nullable:!0},s:{type:"number",nullable:!0},t:{...V7,nullable:!0}},required:["i"],additionalProperties:!1};var aT={type:"array",items:{...nT}};var sT={type:"object",properties:{i:{type:"number"},a:{type:"number",nullable:!0},e:{type:"number",nullable:!0},c:{...V7,nullable:!0},d:{type:"number",nullable:!0},n:{type:"number",nullable:!0},o:{...v1,nullable:!0},p:{...v1,nullable:!0},pe:{type:"number",minimum:0,maximum:1,nullable:!0},rm:{type:"boolean",nullable:!0},t:{type:"number",nullable:!0},te:{type:"number",nullable:!0},tp:{...v1,nullable:!0}},required:["i"],additionalProperties:!1};var oT={type:"array",items:{...sT}};var rT={type:"object",properties:{o:{...v1},d:{...v1},l:{type:"number"},h:{type:"boolean"}},required:["o","d","l","h"],additionalProperties:!1};var tT={type:"array",items:{...rT}};var eT={type:"object",properties:{v:{type:"array",items:{type:"number"}},c:{type:"array",items:{type:"number"}}},required:["v","c"],additionalProperties:!1};var Zk={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 Jk={type:"array",items:{...Zk}};var Xk={type:"object",properties:{i:{type:"number"},e:{type:"number",nullable:!0},o:{...v1,nullable:!0},p:{...v1,nullable:!0},rm:{type:"boolean",nullable:!0},s:{type:"object",nullable:!0},t:{type:"string",nullable:!0},v:{type:"number",nullable:!0}},required:["i"],additionalProperties:!1};var Yk={type:"array",items:{...Xk}};var $k={type:"object",properties:{r:{type:"number"},s:{type:"number"},p:{type:"number"},n:{type:"number"}},required:["r","s","p","n"],additionalProperties:!1};var Qk={type:"object",properties:{p:{type:"boolean",nullable:!0},u:{type:"string",nullable:!0}},additionalProperties:!1};var Kk={type:"array",items:{...Jz}};var tC1={type:"array",items:[{type:"boolean"},{type:"boolean"},{type:"boolean"}],minItems:3,maxItems:3};var Wk={type:"object",properties:{i:{type:"number"},ac:{...V7,nullable:!0},ai:{type:"number",nullable:!0},dc:{...V7,nullable:!0},di:{type:"number",nullable:!0},dp:{...v1,nullable:!0},n:{type:"string",nullable:!0},s:{type:"string",nullable:!0},si:{type:"number",nullable:!0},t:{type:"number",nullable:!0}},required:["i"],additionalProperties:!1};var pt=k0(40,uT);var it=k0(36,dT);var nt=k0(37,lT);var at=k0(38,aT);var st=k0(44,oT);var ot=k0(192,eT);var rt=k0(193,tT);var tt=k0(45,Jk);var et=k0(43,Yk);var Ze=k0(32,$k);var Je=k0(41,Qk);var Xe=k0(42,Kk);var Ye=k0(39,Wk);var EL=new Map,eC1={...CL,...TL,...kL};for(let Z of Object.values(eC1))if("id"in Z&&"schema"in Z){let J=Z;if(EL.has(J.id))throw new Error(`Packet with id ${J.id} is already registered.`);EL.set(J.id,J)}function ZT1(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=EL.get(Z[0]);return!!J&&J.validate(Z[1])}var X0=Gk;import{WebSocket as O16}from"ws";var r6=t(W00(),1),Ew6=r6.default.v1,Iw6=r6.default.v1ToV6,vw6=r6.default.v3,G00=r6.default.v4,Sw6=r6.default.v5,_w6=r6.default.v6,Aw6=r6.default.v6ToV1,xw6=r6.default.v7,hw6=r6.default.NIL,fw6=r6.default.MAX,bw6=r6.default.version,yw6=r6.default.validate,gw6=r6.default.stringify,mw6=r6.default.parse;var wk;try{wk=new TextDecoder}catch(Z){}var e,r5,y=0;var Mk=[],IY=Mk,$z=0,S1={},X1,jZ,o5=0,T9=0,c8,OZ,T5=[],e0,z00={useRecords:!1,mapsAsObjects:!0};class fL{}var Rk=new fL;Rk.name="MessagePack 0xC1";var EJ=!1,B00=2,Bk,jk,Ok;try{new Function("")}catch(Z){B00=1/0}class MZ{constructor(Z){if(Z){if(Z.useRecords===!1&&Z.mapsAsObjects===void 0)Z.mapsAsObjects=!0;if(Z.sequential&&Z.trusted!==!1){if(Z.trusted=!0,!Z.structures&&Z.useRecords!=!1){if(Z.structures=[],!Z.maxSharedStructures)Z.maxSharedStructures=0}}if(Z.structures)Z.structures.sharedLength=Z.structures.length;else if(Z.getStructures)(Z.structures=[]).uninitialized=!0,Z.structures.sharedLength=0;if(Z.int64AsNumber)Z.int64AsType="number"}Object.assign(this,Z)}unpack(Z,J){if(e)return E00(()=>{return hL(),this?this.unpack(Z,J):MZ.prototype.unpack.call(z00,Z,J)});if(!Z.buffer&&Z.constructor===ArrayBuffer)Z=typeof Buffer!=="undefined"?Buffer.from(Z):new Uint8Array(Z);if(typeof J==="object")r5=J.end||Z.length,y=J.start||0;else y=0,r5=J>-1?J:Z.length;$z=0,T9=0,jZ=null,IY=Mk,c8=null,e=Z;try{e0=Z.dataView||(Z.dataView=new DataView(Z.buffer,Z.byteOffset,Z.byteLength))}catch(X){if(e=null,Z instanceof Uint8Array)throw X;throw new Error("Source must be a Uint8Array or Buffer but was a "+(Z&&typeof Z=="object"?Z.constructor.name:typeof Z))}if(this instanceof MZ){if(S1=this,this.structures)return X1=this.structures,AL(J);else if(!X1||X1.length>0)X1=[]}else if(S1=z00,!X1||X1.length>0)X1=[];return AL(J)}unpackMultiple(Z,J){let X,Y=0;try{EJ=!0;let $=Z.length,Q=this?this.unpack(Z,$):bL.unpack(Z,$);if(J){if(J(Q,Y,y)===!1)return;while(y<$)if(Y=y,J(AL(),Y,y)===!1)return}else{X=[Q];while(y<$)Y=y,X.push(AL());return X}}catch($){throw $.lastPosition=Y,$.values=X,$}finally{EJ=!1,hL()}}_mergeStructures(Z,J){if(jk)Z=jk.call(this,Z);if(Z=Z||[],Object.isFrozen(Z))Z=Z.map((X)=>X.slice(0));for(let X=0,Y=Z.length;X<Y;X++){let $=Z[X];if($){if($.isShared=!0,X>=32)$.highByte=X-32>>5}}Z.sharedLength=Z.length;for(let X in J||[])if(X>=0){let Y=Z[X],$=J[X];if($){if(Y)(Z.restoreStructures||(Z.restoreStructures=[]))[X]=Y;Z[X]=$}}return this.structures=Z}decode(Z,J){return this.unpack(Z,J)}}function AL(Z){try{if(!S1.trusted&&!EJ){let X=X1.sharedLength||0;if(X<X1.length)X1.length=X}let J;if(S1.randomAccessStructure&&e[y]<64&&e[y]>=32&&Bk){if(J=Bk(e,y,r5,S1),e=null,!(Z&&Z.lazy)&&J)J=J.toJSON();y=r5}else J=D8();if(c8)y=c8.postBundlePosition,c8=null;if(EJ)X1.restoreStructures=null;if(y==r5){if(X1&&X1.restoreStructures)V00();if(X1=null,e=null,OZ)OZ=null}else if(y>r5)throw new Error("Unexpected end of MessagePack data");else if(!EJ){let X;try{X=JSON.stringify(J,(Y,$)=>typeof $==="bigint"?`${$}n`:$).slice(0,100)}catch(Y){X="(JSON view not available "+Y+")"}throw new Error("Data read, but end of buffer not reached "+X)}return J}catch(J){if(X1&&X1.restoreStructures)V00();if(hL(),J instanceof RangeError||J.message.startsWith("Unexpected end of buffer")||y>r5)J.incomplete=!0;throw J}}function V00(){for(let Z in X1.restoreStructures)X1[Z]=X1.restoreStructures[Z];X1.restoreStructures=null}function D8(){let Z=e[y++];if(Z<160)if(Z<128)if(Z<64)return Z;else{let J=X1[Z&63]||S1.getStructures&&j00()[Z&63];if(J){if(!J.read)J.read=Nk(J,Z&63);return J.read()}else return Z}else if(Z<144)if(Z-=128,S1.mapsAsObjects){let J={};for(let X=0;X<Z;X++){let Y=T00();if(Y==="__proto__")Y="__proto_";J[Y]=D8()}return J}else{let J=new Map;for(let X=0;X<Z;X++)J.set(D8(),D8());return J}else{Z-=144;let J=new Array(Z);for(let X=0;X<Z;X++)J[X]=D8();if(S1.freezeData)return Object.freeze(J);return J}else if(Z<192){let J=Z-160;if(T9>=y)return jZ.slice(y-o5,(y+=J)-o5);if(T9==0&&r5<140){let X=J<16?Pk(J):C00(J);if(X!=null)return X}return xL(J)}else{let J;switch(Z){case 192:return null;case 193:if(c8)if(J=D8(),J>0)return c8[1].slice(c8.position1,c8.position1+=J);else return c8[0].slice(c8.position0,c8.position0-=J);return Rk;case 194:return!1;case 195:return!0;case 196:if(J=e[y++],J===void 0)throw new Error("Unexpected end of buffer");return Lk(J);case 197:return J=e0.getUint16(y),y+=2,Lk(J);case 198:return J=e0.getUint32(y),y+=4,Lk(J);case 199:return EY(e[y++]);case 200:return J=e0.getUint16(y),y+=2,EY(J);case 201:return J=e0.getUint32(y),y+=4,EY(J);case 202:if(J=e0.getFloat32(y),S1.useFloat32>2){let X=SY[(e[y]&127)<<1|e[y+1]>>7];return y+=4,(X*J+(J>0?0.5:-0.5)>>0)/X}return y+=4,J;case 203:return J=e0.getFloat64(y),y+=8,J;case 204:return e[y++];case 205:return J=e0.getUint16(y),y+=2,J;case 206:return J=e0.getUint32(y),y+=4,J;case 207:if(S1.int64AsType==="number")J=e0.getUint32(y)*4294967296,J+=e0.getUint32(y+4);else if(S1.int64AsType==="string")J=e0.getBigUint64(y).toString();else if(S1.int64AsType==="auto"){if(J=e0.getBigUint64(y),J<=BigInt(2)<<BigInt(52))J=Number(J)}else J=e0.getBigUint64(y);return y+=8,J;case 208:return e0.getInt8(y++);case 209:return J=e0.getInt16(y),y+=2,J;case 210:return J=e0.getInt32(y),y+=4,J;case 211:if(S1.int64AsType==="number")J=e0.getInt32(y)*4294967296,J+=e0.getUint32(y+4);else if(S1.int64AsType==="string")J=e0.getBigInt64(y).toString();else if(S1.int64AsType==="auto"){if(J=e0.getBigInt64(y),J>=BigInt(-2)<<BigInt(52)&&J<=BigInt(2)<<BigInt(52))J=Number(J)}else J=e0.getBigInt64(y);return y+=8,J;case 212:if(J=e[y++],J==114)return w00(e[y++]&63);else{let X=T5[J];if(X)if(X.read)return y++,X.read(D8());else if(X.noBuffer)return y++,X();else return X(e.subarray(y,++y));else throw new Error("Unknown extension "+J)}case 213:if(J=e[y],J==114)return y++,w00(e[y++]&63,e[y++]);else return EY(2);case 214:return EY(4);case 215:return EY(8);case 216:return EY(16);case 217:if(J=e[y++],T9>=y)return jZ.slice(y-o5,(y+=J)-o5);return O00(J);case 218:if(J=e0.getUint16(y),y+=2,T9>=y)return jZ.slice(y-o5,(y+=J)-o5);return M00(J);case 219:if(J=e0.getUint32(y),y+=4,T9>=y)return jZ.slice(y-o5,(y+=J)-o5);return R00(J);case 220:return J=e0.getUint16(y),y+=2,q00(J);case 221:return J=e0.getUint32(y),y+=4,q00(J);case 222:return J=e0.getUint16(y),y+=2,F00(J);case 223:return J=e0.getUint32(y),y+=4,F00(J);default:if(Z>=224)return Z-256;if(Z===void 0){let X=new Error("Unexpected end of MessagePack data");throw X.incomplete=!0,X}throw new Error("Unknown MessagePack token "+Z)}}}var Ik1=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Nk(Z,J){function X(){if(X.count++>B00){let $=Z.read=new Function("r","return function(){return "+(S1.freezeData?"Object.freeze":"")+"({"+Z.map((Q)=>Q==="__proto__"?"__proto_:r()":Ik1.test(Q)?Q+":r()":"["+JSON.stringify(Q)+"]:r()").join(",")+"})}")(D8);if(Z.highByte===0)Z.read=H00(J,Z.read);return $()}let Y={};for(let $=0,Q=Z.length;$<Q;$++){let K=Z[$];if(K==="__proto__")K="__proto_";Y[K]=D8()}if(S1.freezeData)return Object.freeze(Y);return Y}if(X.count=0,Z.highByte===0)return H00(J,X);return X}var H00=(Z,J)=>{return function(){let X=e[y++];if(X===0)return J();let Y=Z<32?-(Z+(X<<5)):Z+(X<<5),$=X1[Y]||j00()[Y];if(!$)throw new Error("Record id is not defined for "+Y);if(!$.read)$.read=Nk($,Z);return $.read()}};function j00(){let Z=E00(()=>{return e=null,S1.getStructures()});return X1=S1._mergeStructures(Z,X1)}var xL=vY,O00=vY,M00=vY,R00=vY,N00=!1;function P00(Z){N00=!0,xL=J(1),O00=J(2),M00=J(3),R00=J(5);function J(X){return function Y($){let Q=IY[$z++];if(Q==null){if(c8)return vY($);let W=e.byteOffset,G=Z(y-X+W,r5+W,e.buffer);if(typeof G=="string")Q=G,IY=Mk;else if(IY=G,$z=1,T9=1,Q=IY[0],Q===void 0)throw new Error("Unexpected end of buffer")}let K=Q.length;if(K<=$)return y+=$,Q;return jZ=Q,o5=y,T9=y+K,y+=$,Q.slice(0,$)}}}function vY(Z){let J;if(Z<16){if(J=Pk(Z))return J}if(Z>64&&wk)return wk.decode(e.subarray(y,y+=Z));let X=y+Z,Y=[];J="";while(y<X){let $=e[y++];if(($&128)===0)Y.push($);else if(($&224)===192){let Q=e[y++]&63;Y.push(($&31)<<6|Q)}else if(($&240)===224){let Q=e[y++]&63,K=e[y++]&63;Y.push(($&31)<<12|Q<<6|K)}else if(($&248)===240){let Q=e[y++]&63,K=e[y++]&63,W=e[y++]&63,G=($&7)<<18|Q<<12|K<<6|W;if(G>65535)G-=65536,Y.push(G>>>10&1023|55296),G=56320|G&1023;Y.push(G)}else Y.push($);if(Y.length>=4096)J+=J6.apply(String,Y),Y.length=0}if(Y.length>0)J+=J6.apply(String,Y);return J}function D00(Z,J,X){let Y=e;e=Z,y=J;try{return vY(X)}finally{e=Y}}function q00(Z){let J=new Array(Z);for(let X=0;X<Z;X++)J[X]=D8();if(S1.freezeData)return Object.freeze(J);return J}function F00(Z){if(S1.mapsAsObjects){let J={};for(let X=0;X<Z;X++){let Y=T00();if(Y==="__proto__")Y="__proto_";J[Y]=D8()}return J}else{let J=new Map;for(let X=0;X<Z;X++)J.set(D8(),D8());return J}}var J6=String.fromCharCode;function C00(Z){let J=y,X=new Array(Z);for(let Y=0;Y<Z;Y++){let $=e[y++];if(($&128)>0){y=J;return}X[Y]=$}return J6.apply(String,X)}function Pk(Z){if(Z<4)if(Z<2)if(Z===0)return"";else{let J=e[y++];if((J&128)>1){y-=1;return}return J6(J)}else{let J=e[y++],X=e[y++];if((J&128)>0||(X&128)>0){y-=2;return}if(Z<3)return J6(J,X);let Y=e[y++];if((Y&128)>0){y-=3;return}return J6(J,X,Y)}else{let J=e[y++],X=e[y++],Y=e[y++],$=e[y++];if((J&128)>0||(X&128)>0||(Y&128)>0||($&128)>0){y-=4;return}if(Z<6)if(Z===4)return J6(J,X,Y,$);else{let Q=e[y++];if((Q&128)>0){y-=5;return}return J6(J,X,Y,$,Q)}else if(Z<8){let Q=e[y++],K=e[y++];if((Q&128)>0||(K&128)>0){y-=6;return}if(Z<7)return J6(J,X,Y,$,Q,K);let W=e[y++];if((W&128)>0){y-=7;return}return J6(J,X,Y,$,Q,K,W)}else{let Q=e[y++],K=e[y++],W=e[y++],G=e[y++];if((Q&128)>0||(K&128)>0||(W&128)>0||(G&128)>0){y-=8;return}if(Z<10)if(Z===8)return J6(J,X,Y,$,Q,K,W,G);else{let z=e[y++];if((z&128)>0){y-=9;return}return J6(J,X,Y,$,Q,K,W,G,z)}else if(Z<12){let z=e[y++],V=e[y++];if((z&128)>0||(V&128)>0){y-=10;return}if(Z<11)return J6(J,X,Y,$,Q,K,W,G,z,V);let H=e[y++];if((H&128)>0){y-=11;return}return J6(J,X,Y,$,Q,K,W,G,z,V,H)}else{let z=e[y++],V=e[y++],H=e[y++],q=e[y++];if((z&128)>0||(V&128)>0||(H&128)>0||(q&128)>0){y-=12;return}if(Z<14)if(Z===12)return J6(J,X,Y,$,Q,K,W,G,z,V,H,q);else{let F=e[y++];if((F&128)>0){y-=13;return}return J6(J,X,Y,$,Q,K,W,G,z,V,H,q,F)}else{let F=e[y++],U=e[y++];if((F&128)>0||(U&128)>0){y-=14;return}if(Z<15)return J6(J,X,Y,$,Q,K,W,G,z,V,H,q,F,U);let w=e[y++];if((w&128)>0){y-=15;return}return J6(J,X,Y,$,Q,K,W,G,z,V,H,q,F,U,w)}}}}}function U00(){let Z=e[y++],J;if(Z<192)J=Z-160;else switch(Z){case 217:J=e[y++];break;case 218:J=e0.getUint16(y),y+=2;break;case 219:J=e0.getUint32(y),y+=4;break;default:throw new Error("Expected string")}return vY(J)}function Lk(Z){return S1.copyBuffers?Uint8Array.prototype.slice.call(e,y,y+=Z):e.subarray(y,y+=Z)}function EY(Z){let J=e[y++];if(T5[J]){let X;return T5[J](e.subarray(y,X=y+=Z),(Y)=>{y=Y;try{return D8()}finally{y=X}})}else throw new Error("Unknown extension type "+J)}var L00=new Array(4096);function T00(){let Z=e[y++];if(Z>=160&&Z<192){if(Z=Z-160,T9>=y)return jZ.slice(y-o5,(y+=Z)-o5);else if(!(T9==0&&r5<180))return xL(Z)}else return y--,k00(D8());let J=(Z<<5^(Z>1?e0.getUint16(y):Z>0?e[y]:0))&4095,X=L00[J],Y=y,$=y+Z-3,Q,K=0;if(X&&X.bytes==Z){while(Y<$){if(Q=e0.getUint32(Y),Q!=X[K++]){Y=1879048192;break}Y+=4}$+=3;while(Y<$)if(Q=e[Y++],Q!=X[K++]){Y=1879048192;break}if(Y===$)return y=Y,X.string;$-=3,Y=y}X=[],L00[J]=X,X.bytes=Z;while(Y<$)Q=e0.getUint32(Y),X.push(Q),Y+=4;$+=3;while(Y<$)Q=e[Y++],X.push(Q);let W=Z<16?Pk(Z):C00(Z);if(W!=null)return X.string=W;return X.string=xL(Z)}function k00(Z){if(typeof Z==="string")return Z;if(typeof Z==="number"||typeof Z==="boolean"||typeof Z==="bigint")return Z.toString();if(Z==null)return Z+"";if(S1.allowArraysInMapKeys&&Array.isArray(Z)&&Z.flat().every((J)=>["string","number","boolean","bigint"].includes(typeof J)))return Z.flat().toString();throw new Error(`Invalid property type for record: ${typeof Z}`)}var w00=(Z,J)=>{let X=D8().map(k00),Y=Z;if(J!==void 0)Z=Z<32?-((J<<5)+Z):(J<<5)+Z,X.highByte=J;let $=X1[Z];if($&&($.isShared||EJ))(X1.restoreStructures||(X1.restoreStructures=[]))[Z]=$;return X1[Z]=X,X.read=Nk(X,Y),X.read()};T5[0]=()=>{};T5[0].noBuffer=!0;T5[66]=(Z)=>{let J=Z.length,X=BigInt(Z[0]&128?Z[0]-256:Z[0]);for(let Y=1;Y<J;Y++)X<<=BigInt(8),X+=BigInt(Z[Y]);return X};var vk1={Error,TypeError,ReferenceError};T5[101]=()=>{let Z=D8();return(vk1[Z[0]]||Error)(Z[1],{cause:Z[2]})};T5[105]=(Z)=>{if(S1.structuredClone===!1)throw new Error("Structured clone extension is disabled");let J=e0.getUint32(y-4);if(!OZ)OZ=new Map;let X=e[y],Y;if(X>=144&&X<160||X==220||X==221)Y=[];else if(X>=128&&X<144||X==222||X==223)Y=new Map;else if((X>=199&&X<=201||X>=212&&X<=216)&&e[y+1]===115)Y=new Set;else Y={};let $={target:Y};OZ.set(J,$);let Q=D8();if(!$.used)return $.target=Q;else Object.assign(Y,Q);if(Y instanceof Map)for(let[K,W]of Q.entries())Y.set(K,W);if(Y instanceof Set)for(let K of Array.from(Q))Y.add(K);return Y};T5[112]=(Z)=>{if(S1.structuredClone===!1)throw new Error("Structured clone extension is disabled");let J=e0.getUint32(y-4),X=OZ.get(J);return X.used=!0,X.target};T5[115]=()=>new Set(D8());var Dk=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map((Z)=>Z+"Array"),Sk1=typeof globalThis==="object"?globalThis:window;T5[116]=(Z)=>{let J=Z[0],X=Uint8Array.prototype.slice.call(Z,1).buffer,Y=Dk[J];if(!Y){if(J===16)return X;if(J===17)return new DataView(X);throw new Error("Could not find typed array for code "+J)}return new Sk1[Y](X)};T5[120]=()=>{let Z=D8();return new RegExp(Z[0],Z[1])};var _k1=[];T5[98]=(Z)=>{let J=(Z[0]<<24)+(Z[1]<<16)+(Z[2]<<8)+Z[3],X=y;return y+=J-Z.length,c8=_k1,c8=[U00(),U00()],c8.position0=0,c8.position1=0,c8.postBundlePosition=y,y=X,D8()};T5[255]=(Z)=>{if(Z.length==4)return new Date((Z[0]*16777216+(Z[1]<<16)+(Z[2]<<8)+Z[3])*1000);else if(Z.length==8)return new Date(((Z[0]<<22)+(Z[1]<<14)+(Z[2]<<6)+(Z[3]>>2))/1e6+((Z[3]&3)*4294967296+Z[4]*16777216+(Z[5]<<16)+(Z[6]<<8)+Z[7])*1000);else if(Z.length==12)return new Date(((Z[0]<<24)+(Z[1]<<16)+(Z[2]<<8)+Z[3])/1e6+((Z[4]&128?-281474976710656:0)+Z[6]*1099511627776+Z[7]*4294967296+Z[8]*16777216+(Z[9]<<16)+(Z[10]<<8)+Z[11])*1000);else return new Date("invalid")};function E00(Z){if(Ok)Ok();let J=r5,X=y,Y=$z,$=o5,Q=T9,K=jZ,W=IY,G=OZ,z=c8,V=new Uint8Array(e.slice(0,r5)),H=X1,q=X1.slice(0,X1.length),F=S1,U=EJ,w=Z();return r5=J,y=X,$z=Y,o5=$,T9=Q,jZ=K,IY=W,OZ=G,c8=z,e=V,EJ=U,X1=H,X1.splice(0,X1.length,...q),S1=F,e0=new DataView(e.buffer,e.byteOffset,e.byteLength),w}function hL(){e=null,OZ=null,X1=null}var SY=new Array(147);for(let Z=0;Z<256;Z++)SY[Z]=+("1e"+Math.floor(45.15-Z*0.30103));var bL=new MZ({useRecords:!1}),Ak1=bL.unpack,xk1=bL.unpackMultiple,hk1=bL.unpack;var fk1=new Float32Array(1),dw6=new Uint8Array(fk1.buffer,0,4);function I00(Z,J,X){Bk=Z,jk=J,Ok=X}var gL;try{gL=new TextEncoder}catch(Z){}var kk,A00,Kz=typeof Buffer!=="undefined",yL=Kz?function(Z){return Buffer.allocUnsafeSlow(Z)}:Uint8Array,x00=Kz?Buffer:Uint8Array,v00=Kz?4294967296:2144337920,c,Qz,h1,g=0,t6,e1=null,h00,bk1=21760,yk1=/[\u0080-\uFFFF]/,H7=Symbol("record-id");class _Y extends MZ{constructor(Z){super(Z);this.offset=0;let J,X,Y,$,Q,K=x00.prototype.utf8Write?function(I,v){return c.utf8Write(I,v,c.byteLength-v)}:gL&&gL.encodeInto?function(I,v){return gL.encodeInto(I,c.subarray(v)).written}:!1,W=this;if(!Z)Z={};let G=Z&&Z.sequential,z=Z.structures||Z.saveStructures,V=Z.maxSharedStructures;if(V==null)V=z?32:0;if(V>8160)throw new Error("Maximum maxSharedStructure is 8160");if(Z.structuredClone&&Z.moreTypes==null)this.moreTypes=!0;let H=Z.maxOwnStructures;if(H==null)H=z?32:64;if(!this.structures&&Z.useRecords!=!1)this.structures=[];let q=V>32||H+V>64,F=V+64,U=V+H+64;if(U>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let w=[],L=0,j=0;this.pack=this.encode=function(I,v){if(!c)c=new yL(8192),h1=c.dataView||(c.dataView=new DataView(c.buffer,0,8192)),g=0;if(t6=c.length-10,t6-g<2048)c=new yL(c.length),h1=c.dataView||(c.dataView=new DataView(c.buffer,0,c.length)),t6=c.length-10,g=0;else g=g+7&2147483640;if(X=g,v&pk1)g+=v&255;if(Q=W.structuredClone?new Map:null,W.bundleStrings&&typeof I!=="string")e1=[],e1.size=1/0;else e1=null;if($=W.structures,$){if($.uninitialized)$=W._mergeStructures(W.getStructures());let p=$.sharedLength||0;if(p>V)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+$.sharedLength);if(!$.transitions){$.transitions=Object.create(null);for(let n=0;n<p;n++){let o=$[n];if(!o)continue;let J0,Q0=$.transitions;for(let C0=0,T0=o.length;C0<T0;C0++){let a0=o[C0];if(J0=Q0[a0],!J0)J0=Q0[a0]=Object.create(null);Q0=J0}Q0[H7]=n+64}this.lastNamedStructuresLength=p}if(!G)$.nextId=p+64}if(Y)Y=!1;let f;try{if(W.randomAccessStructure&&I&&I.constructor&&I.constructor===Object)x(I);else N(I);let p=e1;if(e1)S00(X,N,0);if(Q&&Q.idsToInsert){let n=Q.idsToInsert.sort((C0,T0)=>C0.offset>T0.offset?1:-1),o=n.length,J0=-1;while(p&&o>0){let C0=n[--o].offset+X;if(C0<p.stringsPosition+X&&J0===-1)J0=0;if(C0>p.position+X){if(J0>=0)J0+=6}else{if(J0>=0)h1.setUint32(p.position+X,h1.getUint32(p.position+X)+J0),J0=-1;p=p.previous,o++}}if(J0>=0&&p)h1.setUint32(p.position+X,h1.getUint32(p.position+X)+J0);if(g+=n.length*6,g>t6)k(g);W.offset=g;let Q0=mk1(c.subarray(X,g),n);return Q=null,Q0}if(W.offset=g,v&ck1)return c.start=X,c.end=g,c;return c.subarray(X,g)}catch(p){throw f=p,p}finally{if($){if(R(),Y&&W.saveStructures){let p=$.sharedLength||0,n=c.subarray(X,g),o=f00($,W);if(!f){if(W.saveStructures(o,o.isCompatible)===!1)return W.pack(I,v);if(W.lastNamedStructuresLength=p,c.length>1073741824)c=null;return n}}}if(c.length>1073741824)c=null;if(v&lk1)g=X}};let R=()=>{if(j<10)j++;let I=$.sharedLength||0;if($.length>I&&!G)$.length=I;if(L>1e4){if($.transitions=null,j=0,L=0,w.length>0)w=[]}else if(w.length>0&&!G){for(let v=0,f=w.length;v<f;v++)w[v][H7]=0;w=[]}},O=(I)=>{var v=I.length;if(v<16)c[g++]=144|v;else if(v<65536)c[g++]=220,c[g++]=v>>8,c[g++]=v&255;else c[g++]=221,h1.setUint32(g,v),g+=4;for(let f=0;f<v;f++)N(I[f])},N=(I)=>{if(g>t6)c=k(g);var v=typeof I,f;if(v==="string"){let p=I.length;if(e1&&p>=4&&p<4096){if((e1.size+=p)>bk1){let Q0,C0=(e1[0]?e1[0].length*3+e1[1].length:0)+10;if(g+C0>t6)c=k(g+C0);let T0;if(e1.position)T0=e1,c[g]=200,g+=3,c[g++]=98,Q0=g-X,g+=4,S00(X,N,0),h1.setUint16(Q0+X-3,g-X-Q0);else c[g++]=214,c[g++]=98,Q0=g-X,g+=4;e1=["",""],e1.previous=T0,e1.size=0,e1.position=Q0}let J0=yk1.test(I);e1[J0?0:1]+=I,c[g++]=193,N(J0?-p:p);return}let n;if(p<32)n=1;else if(p<256)n=2;else if(p<65536)n=3;else n=5;let o=p*3;if(g+o>t6)c=k(g+o);if(p<64||!K){let J0,Q0,C0,T0=g+n;for(J0=0;J0<p;J0++)if(Q0=I.charCodeAt(J0),Q0<128)c[T0++]=Q0;else if(Q0<2048)c[T0++]=Q0>>6|192,c[T0++]=Q0&63|128;else if((Q0&64512)===55296&&((C0=I.charCodeAt(J0+1))&64512)===56320)Q0=65536+((Q0&1023)<<10)+(C0&1023),J0++,c[T0++]=Q0>>18|240,c[T0++]=Q0>>12&63|128,c[T0++]=Q0>>6&63|128,c[T0++]=Q0&63|128;else c[T0++]=Q0>>12|224,c[T0++]=Q0>>6&63|128,c[T0++]=Q0&63|128;f=T0-g-n}else f=K(I,g+n);if(f<32)c[g++]=160|f;else if(f<256){if(n<2)c.copyWithin(g+2,g+1,g+1+f);c[g++]=217,c[g++]=f}else if(f<65536){if(n<3)c.copyWithin(g+3,g+2,g+2+f);c[g++]=218,c[g++]=f>>8,c[g++]=f&255}else{if(n<5)c.copyWithin(g+5,g+3,g+3+f);c[g++]=219,h1.setUint32(g,f),g+=4}g+=f}else if(v==="number")if(I>>>0===I)if(I<32||I<128&&this.useRecords===!1||I<64&&!this.randomAccessStructure)c[g++]=I;else if(I<256)c[g++]=204,c[g++]=I;else if(I<65536)c[g++]=205,c[g++]=I>>8,c[g++]=I&255;else c[g++]=206,h1.setUint32(g,I),g+=4;else if(I>>0===I)if(I>=-32)c[g++]=256+I;else if(I>=-128)c[g++]=208,c[g++]=I+256;else if(I>=-32768)c[g++]=209,h1.setInt16(g,I),g+=2;else c[g++]=210,h1.setInt32(g,I),g+=4;else{let p;if((p=this.useFloat32)>0&&I<4294967296&&I>=-2147483648){c[g++]=202,h1.setFloat32(g,I);let n;if(p<4||(n=I*SY[(c[g]&127)<<1|c[g+1]>>7])>>0===n){g+=4;return}else g--}c[g++]=203,h1.setFloat64(g,I),g+=8}else if(v==="object"||v==="function")if(!I)c[g++]=192;else{if(Q){let n=Q.get(I);if(n){if(!n.id){let o=Q.idsToInsert||(Q.idsToInsert=[]);n.id=o.push(n)}c[g++]=214,c[g++]=112,h1.setUint32(g,n.id),g+=4;return}else Q.set(I,{offset:g-X})}let p=I.constructor;if(p===Object)T(I);else if(p===Array)O(I);else if(p===Map)if(this.mapAsEmptyObject)c[g++]=128;else{if(f=I.size,f<16)c[g++]=128|f;else if(f<65536)c[g++]=222,c[g++]=f>>8,c[g++]=f&255;else c[g++]=223,h1.setUint32(g,f),g+=4;for(let[n,o]of I)N(n),N(o)}else{for(let n=0,o=kk.length;n<o;n++){let J0=A00[n];if(I instanceof J0){let Q0=kk[n];if(Q0.write){if(Q0.type)c[g++]=212,c[g++]=Q0.type,c[g++]=0;let s1=Q0.write.call(this,I);if(s1===I)if(Array.isArray(I))O(I);else T(I);else N(s1);return}let C0=c,T0=h1,a0=g;c=null;let v8;try{v8=Q0.pack.call(this,I,(s1)=>{if(c=C0,C0=null,g+=s1,g>t6)k(g);return{target:c,targetView:h1,position:g-s1}},N)}finally{if(C0)c=C0,h1=T0,g=a0,t6=c.length-10}if(v8){if(v8.length+g>t6)k(v8.length+g);g=gk1(v8,c,g,Q0.type)}return}}if(Array.isArray(I))O(I);else{if(I.toJSON){let n=I.toJSON();if(n!==I)return N(n)}if(v==="function")return N(this.writeFunction&&this.writeFunction(I));T(I)}}}else if(v==="boolean")c[g++]=I?195:194;else if(v==="bigint"){if(I<9223372036854776000&&I>=-9223372036854776000)c[g++]=211,h1.setBigInt64(g,I);else if(I<18446744073709552000&&I>0)c[g++]=207,h1.setBigUint64(g,I);else if(this.largeBigIntToFloat)c[g++]=203,h1.setFloat64(g,Number(I));else if(this.largeBigIntToString)return N(I.toString());else if((this.useBigIntExtension||this.moreTypes)&&I<BigInt(2)**BigInt(1023)&&I>-(BigInt(2)**BigInt(1023))){c[g++]=199,g++,c[g++]=66;let p=[],n;do{let o=I&BigInt(255);n=(o&BigInt(128))===(I<BigInt(0)?BigInt(128):BigInt(0)),p.push(o),I>>=BigInt(8)}while(!((I===BigInt(0)||I===BigInt(-1))&&n));c[g-2]=p.length;for(let o=p.length;o>0;)c[g++]=Number(p[--o]);return}else throw new RangeError(I+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string");g+=8}else if(v==="undefined")if(this.encodeUndefinedAsNil)c[g++]=192;else c[g++]=212,c[g++]=0,c[g++]=0;else throw new Error("Unknown type: "+v)},D=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?(I)=>{let v;if(this.skipValues){v=[];for(let n in I)if((typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(n))&&!this.skipValues.includes(I[n]))v.push(n)}else v=Object.keys(I);let f=v.length;if(f<16)c[g++]=128|f;else if(f<65536)c[g++]=222,c[g++]=f>>8,c[g++]=f&255;else c[g++]=223,h1.setUint32(g,f),g+=4;let p;if(this.coercibleKeyAsNumber)for(let n=0;n<f;n++){p=v[n];let o=Number(p);N(isNaN(o)?p:o),N(I[p])}else for(let n=0;n<f;n++)N(p=v[n]),N(I[p])}:(I)=>{c[g++]=222;let v=g-X;g+=2;let f=0;for(let p in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(p))N(p),N(I[p]),f++;if(f>65535)throw new Error('Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object');c[v+++X]=f>>8,c[v+X]=f&255},P=this.useRecords===!1?D:Z.progressiveRecords&&!q?(I)=>{let v,f=$.transitions||($.transitions=Object.create(null)),p=g++-X,n;for(let o in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(o)){if(v=f[o],v)f=v;else{let J0=Object.keys(I),Q0=f;f=$.transitions;let C0=0;for(let T0=0,a0=J0.length;T0<a0;T0++){let v8=J0[T0];if(v=f[v8],!v)v=f[v8]=Object.create(null),C0++;f=v}if(p+X+1==g)g--,A(f,J0,C0);else S(f,J0,p,C0);n=!0,f=Q0[o]}N(I[o])}if(!n){let o=f[H7];if(o)c[p+X]=o;else S(f,Object.keys(I),p,0)}}:(I)=>{let v,f=$.transitions||($.transitions=Object.create(null)),p=0;for(let o in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(o)){if(v=f[o],!v)v=f[o]=Object.create(null),p++;f=v}let n=f[H7];if(n)if(n>=96&&q)c[g++]=((n-=96)&31)+96,c[g++]=n>>5;else c[g++]=n;else A(f,f.__keys__||Object.keys(I),p);for(let o in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(o))N(I[o])},C=typeof this.useRecords=="function"&&this.useRecords,T=C?(I)=>{C(I)?P(I):D(I)}:P,k=(I)=>{let v;if(I>16777216){if(I-X>v00)throw new Error("Packed buffer would be larger than maximum buffer size");v=Math.min(v00,Math.round(Math.max((I-X)*(I>67108864?1.25:2),4194304)/4096)*4096)}else v=(Math.max(I-X<<2,c.length-1)>>12)+1<<12;let f=new yL(v);if(h1=f.dataView||(f.dataView=new DataView(f.buffer,0,v)),I=Math.min(I,c.length),c.copy)c.copy(f,0,X,I);else f.set(c.slice(X,I));return g-=X,X=0,t6=f.length-10,c=f},A=(I,v,f)=>{let p=$.nextId;if(!p)p=64;if(p<F&&this.shouldShareStructure&&!this.shouldShareStructure(v)){if(p=$.nextOwnId,!(p<U))p=F;$.nextOwnId=p+1}else{if(p>=U)p=F;$.nextId=p+1}let n=v.highByte=p>=96&&q?p-96>>5:-1;if(I[H7]=p,I.__keys__=v,$[p-64]=v,p<F)if(v.isShared=!0,$.sharedLength=p-63,Y=!0,n>=0)c[g++]=(p&31)+96,c[g++]=n;else c[g++]=p;else{if(n>=0)c[g++]=213,c[g++]=114,c[g++]=(p&31)+96,c[g++]=n;else c[g++]=212,c[g++]=114,c[g++]=p;if(f)L+=j*f;if(w.length>=H)w.shift()[H7]=0;w.push(I),N(v)}},S=(I,v,f,p)=>{let n=c,o=g,J0=t6,Q0=X;if(c=Qz,g=0,X=0,!c)Qz=c=new yL(8192);t6=c.length-10,A(I,v,p),Qz=c;let C0=g;if(c=n,g=o,t6=J0,X=Q0,C0>1){let T0=g+C0-1;if(T0>t6)k(T0);let a0=f+X;c.copyWithin(a0+C0,a0+1,g),c.set(Qz.slice(0,C0),a0),g=T0}else c[f+X]=Qz[0]},x=(I)=>{let v=h00(I,c,X,g,$,k,(f,p,n)=>{if(n)return Y=!0;g=p;let o=c;if(N(f),R(),o!==c)return{position:g,targetView:h1,target:c};return g},this);if(v===0)return T(I);g=v}}useBuffer(Z){c=Z,c.dataView||(c.dataView=new DataView(c.buffer,c.byteOffset,c.byteLength)),g=0}set position(Z){g=Z}get position(){return g}clearSharedData(){if(this.structures)this.structures=[];if(this.typedStructs)this.typedStructs=[]}}A00=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,fL];kk=[{pack(Z,J,X){let Y=Z.getTime()/1000;if((this.useTimestamp32||Z.getMilliseconds()===0)&&Y>=0&&Y<4294967296){let{target:$,targetView:Q,position:K}=J(6);$[K++]=214,$[K++]=255,Q.setUint32(K,Y)}else if(Y>0&&Y<4294967296){let{target:$,targetView:Q,position:K}=J(10);$[K++]=215,$[K++]=255,Q.setUint32(K,Z.getMilliseconds()*4000000+(Y/1000/4294967296>>0)),Q.setUint32(K+4,Y)}else if(isNaN(Y)){if(this.onInvalidDate)return J(0),X(this.onInvalidDate());let{target:$,targetView:Q,position:K}=J(3);$[K++]=212,$[K++]=255,$[K++]=255}else{let{target:$,targetView:Q,position:K}=J(15);$[K++]=199,$[K++]=12,$[K++]=255,Q.setUint32(K,Z.getMilliseconds()*1e6),Q.setBigInt64(K+4,BigInt(Math.floor(Y)))}}},{pack(Z,J,X){if(this.setAsEmptyObject)return J(0),X({});let Y=Array.from(Z),{target:$,position:Q}=J(this.moreTypes?3:0);if(this.moreTypes)$[Q++]=212,$[Q++]=115,$[Q++]=0;X(Y)}},{pack(Z,J,X){let{target:Y,position:$}=J(this.moreTypes?3:0);if(this.moreTypes)Y[$++]=212,Y[$++]=101,Y[$++]=0;X([Z.name,Z.message,Z.cause])}},{pack(Z,J,X){let{target:Y,position:$}=J(this.moreTypes?3:0);if(this.moreTypes)Y[$++]=212,Y[$++]=120,Y[$++]=0;X([Z.source,Z.flags])}},{pack(Z,J){if(this.moreTypes)Ck(Z,16,J);else Tk(Kz?Buffer.from(Z):new Uint8Array(Z),J)}},{pack(Z,J){let X=Z.constructor;if(X!==x00&&this.moreTypes)Ck(Z,Dk.indexOf(X.name),J);else Tk(Z,J)}},{pack(Z,J){if(this.moreTypes)Ck(Z,17,J);else Tk(Kz?Buffer.from(Z):new Uint8Array(Z),J)}},{pack(Z,J){let{target:X,position:Y}=J(1);X[Y]=193}}];function Ck(Z,J,X,Y){let $=Z.byteLength;if($+1<256){var{target:Q,position:K}=X(4+$);Q[K++]=199,Q[K++]=$+1}else if($+1<65536){var{target:Q,position:K}=X(5+$);Q[K++]=200,Q[K++]=$+1>>8,Q[K++]=$+1&255}else{var{target:Q,position:K,targetView:W}=X(7+$);Q[K++]=201,W.setUint32(K,$+1),K+=4}if(Q[K++]=116,Q[K++]=J,!Z.buffer)Z=new Uint8Array(Z);Q.set(new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength),K)}function Tk(Z,J){let X=Z.byteLength;var Y,$;if(X<256){var{target:Y,position:$}=J(X+2);Y[$++]=196,Y[$++]=X}else if(X<65536){var{target:Y,position:$}=J(X+3);Y[$++]=197,Y[$++]=X>>8,Y[$++]=X&255}else{var{target:Y,position:$,targetView:Q}=J(X+5);Y[$++]=198,Q.setUint32($,X),$+=4}Y.set(Z,$)}function gk1(Z,J,X,Y){let $=Z.length;switch($){case 1:J[X++]=212;break;case 2:J[X++]=213;break;case 4:J[X++]=214;break;case 8:J[X++]=215;break;case 16:J[X++]=216;break;default:if($<256)J[X++]=199,J[X++]=$;else if($<65536)J[X++]=200,J[X++]=$>>8,J[X++]=$&255;else J[X++]=201,J[X++]=$>>24,J[X++]=$>>16&255,J[X++]=$>>8&255,J[X++]=$&255}return J[X++]=Y,J.set(Z,X),X+=$,X}function mk1(Z,J){let X,Y=J.length*6,$=Z.length-Y;while(X=J.pop()){let{offset:Q,id:K}=X;Z.copyWithin(Q+Y,Q,$),Y-=6;let W=Q+Y;Z[W++]=214,Z[W++]=105,Z[W++]=K>>24,Z[W++]=K>>16&255,Z[W++]=K>>8&255,Z[W++]=K&255,$=Q}return Z}function S00(Z,J,X){if(e1.length>0){h1.setUint32(e1.position+Z,g+X-e1.position-Z),e1.stringsPosition=g-Z;let Y=e1;e1=null,J(Y[0]),J(Y[1])}}function f00(Z,J){return Z.isCompatible=(X)=>{let Y=!X||(J.lastNamedStructuresLength||0)===X.length;if(!Y)J._mergeStructures(X);return Y},Z}function b00(Z,J){h00=Z,f00=J}var y00=new _Y({useRecords:!1}),uk1=y00.pack,dk1=y00.pack;var ck1=512,lk1=1024,pk1=2048;var Ek=3,KK=0,Wz=2,mL=1,vk=16,m00=["num","object","string","ascii"];m00[vk]="date";var nk1=[!1,!0,!0,!1,!1,!0,!0,!1],u00;try{new Function(""),u00=!0}catch(Z){}var AY,ak1=typeof Buffer!=="undefined",uL,q7;try{uL=new TextEncoder}catch(Z){}var sk1=ak1?function(Z,J,X){return Z.utf8Write(J,X,Z.byteLength-X)}:uL&&uL.encodeInto?function(Z,J,X){return uL.encodeInto(J,Z.subarray(X)).written}:!1,rw6=Symbol("type"),tw6=Symbol("parent");b00(d00,ZE1);function d00(Z,J,X,Y,$,Q,K,W){let G=W.typedStructs||(W.typedStructs=[]),z=J.dataView,V=(G.lastStringStart||100)+Y,H=J.length-10,q=Y;if(Y>H)J=Q(Y),z=J.dataView,Y-=X,q-=X,V-=X,X=0,H=J.length-10;let F,U=V,w=G.transitions||(G.transitions=Object.create(null)),L=G.nextId||G.length,j=L<15?1:L<240?2:L<61440?3:L<15728640?4:0;if(j===0)return 0;Y+=j;let R=[],O,N=0;for(let P in Z){let C=Z[P],T=w[P];if(!T)w[P]=T={key:P,parent:w,enumerationOffset:0,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null,date64:null};if(Y>H)J=Q(Y),z=J.dataView,Y-=X,q-=X,V-=X,U-=X,X=0,H=J.length-10;switch(typeof C){case"number":let k=C;if(L<200||!T.num64){if(k>>0===k&&k<536870912&&k>-520093696){if(k<246&&k>=0&&(T.num8&&!(L>200&&T.num32)||k<32&&!T.num32))w=T.num8||k5(T,KK,1),J[Y++]=k;else w=T.num32||k5(T,KK,4),z.setUint32(Y,k,!0),Y+=4;break}else if(k<4294967296&&k>=-2147483648){if(z.setFloat32(Y,k,!0),nk1[J[Y+3]>>>5]){let I;if((I=k*SY[(J[Y+3]&127)<<1|J[Y+2]>>7])>>0===I){w=T.num32||k5(T,KK,4),Y+=4;break}}}}w=T.num64||k5(T,KK,8),z.setFloat64(Y,k,!0),Y+=8;break;case"string":let A=C.length;if(F=U-V,(A<<2)+U>H)J=Q((A<<2)+U),z=J.dataView,Y-=X,q-=X,V-=X,U-=X,X=0,H=J.length-10;if(A>65280+F>>2){R.push(P,C,Y-q);break}let S,x=U;if(A<64){let I,v,f;for(I=0;I<A;I++)if(v=C.charCodeAt(I),v<128)J[U++]=v;else if(v<2048)S=!0,J[U++]=v>>6|192,J[U++]=v&63|128;else if((v&64512)===55296&&((f=C.charCodeAt(I+1))&64512)===56320)S=!0,v=65536+((v&1023)<<10)+(f&1023),I++,J[U++]=v>>18|240,J[U++]=v>>12&63|128,J[U++]=v>>6&63|128,J[U++]=v&63|128;else S=!0,J[U++]=v>>12|224,J[U++]=v>>6&63|128,J[U++]=v&63|128}else U+=sk1(J,C,U),S=U-x>A;if(F<160||F<246&&(T.ascii8||T.string8)){if(S){if(!(w=T.string8))if(G.length>10&&(w=T.ascii8))w.__type=Wz,T.ascii8=null,T.string8=w,K(null,0,!0);else w=k5(T,Wz,1)}else if(F===0&&!O){O=!0,w=T.ascii0||k5(T,Ek,0);break}else if(!(w=T.ascii8)&&!(G.length>10&&(w=T.string8)))w=k5(T,Ek,1);J[Y++]=F}else w=T.string16||k5(T,Wz,2),z.setUint16(Y,F,!0),Y+=2;break;case"object":if(C){if(C.constructor===Date)w=T.date64||k5(T,vk,8),z.setFloat64(Y,C.getTime(),!0),Y+=8;else R.push(P,C,N);break}else if(T=g00(T,Y,z,-10),T)w=T,Y=AY;else R.push(P,C,N);break;case"boolean":w=T.num8||T.ascii8||k5(T,KK,1),J[Y++]=C?249:248;break;case"undefined":if(T=g00(T,Y,z,-9),T)w=T,Y=AY;else R.push(P,C,N);break;default:R.push(P,C,N)}N++}for(let P=0,C=R.length;P<C;){let T=R[P++],k=R[P++],A=R[P++],S=w[T];if(!S)w[T]=S={key:T,parent:w,enumerationOffset:A-N,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null};let x;if(k){let I;if(F=U-V,F<65280)if(w=S.object16,w)I=2;else if(w=S.object32)I=4;else w=k5(S,mL,2),I=2;else w=S.object32||k5(S,mL,4),I=4;if(x=K(k,U),typeof x==="object")U=x.position,z=x.targetView,J=x.target,V-=X,Y-=X,q-=X,X=0;else U=x;if(I===2)z.setUint16(Y,F,!0),Y+=2;else z.setUint32(Y,F,!0),Y+=4}else w=S.object16||k5(S,mL,2),z.setInt16(Y,k===null?-10:-9,!0),Y+=2;N++}let D=w[H7];if(D==null){D=W.typedStructs.length;let P=[],C=w,T,k;while((k=C.__type)!==void 0){let A=C.__size;C=C.__parent,T=C.key;let S=[k,A,T];if(C.enumerationOffset)S.push(C.enumerationOffset);P.push(S),C=C.parent}P.reverse(),w[H7]=D,W.typedStructs[D]=P,K(null,0,!0)}switch(j){case 1:if(D>=16)return 0;J[q]=D+32;break;case 2:if(D>=256)return 0;J[q]=56,J[q+1]=D;break;case 3:if(D>=65536)return 0;J[q]=57,z.setUint16(q+1,D,!0);break;case 4:if(D>=16777216)return 0;z.setUint32(q,(D<<8)+58,!0);break}if(Y<V){if(V===U)return Y;J.copyWithin(Y,V,U),U+=Y-V,G.lastStringStart=Y-q}else if(Y>V){if(V===U)return Y;return G.lastStringStart=Y-q,d00(Z,J,X,q,$,Q,K,W)}return U}function g00(Z,J,X,Y){let $;if($=Z.ascii8||Z.num8)return X.setInt8(J,Y,!0),AY=J+1,$;if($=Z.string16||Z.object16)return X.setInt16(J,Y,!0),AY=J+2,$;if($=Z.num32)return X.setUint32(J,3758096640+Y,!0),AY=J+4,$;if($=Z.num64)return X.setFloat64(J,NaN,!0),X.setInt8(J,Y),AY=J+8,$;AY=J;return}function k5(Z,J,X){let Y=m00[J]+(X<<3),$=Z[Y]||(Z[Y]=Object.create(null));return $.__type=J,$.__size=X,$.__parent=Z,$}function ok1(Z){if(!(Z instanceof Map))return Z;let J=Z.get("typed")||[];if(Object.isFrozen(J))J=J.map(($)=>$.slice(0));let X=Z.get("named"),Y=Object.create(null);for(let $=0,Q=J.length;$<Q;$++){let K=J[$],W=Y;for(let[G,z,V]of K){let H=W[V];if(!H)W[V]=H={key:V,parent:W,enumerationOffset:0,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null,date64:null};W=k5(H,G,z)}W[H7]=$}return J.transitions=Y,this.typedStructs=J,this.lastTypedStructuresLength=J.length,X}var Ik=Symbol.for("source");function rk1(Z,J,X,Y){let $=Z[J++]-32;if($>=24)switch($){case 24:$=Z[J++];break;case 25:$=Z[J++]+(Z[J++]<<8);break;case 26:$=Z[J++]+(Z[J++]<<8)+(Z[J++]<<16);break;case 27:$=Z[J++]+(Z[J++]<<8)+(Z[J++]<<16)+(Z[J++]<<24);break}let Q=Y.typedStructs&&Y.typedStructs[$];if(!Q){if(Z=Uint8Array.prototype.slice.call(Z,J,X),X-=J,J=0,!Y.getStructures)throw new Error(`Reference to shared structure ${$} without getStructures method`);if(Y._mergeStructures(Y.getStructures()),!Y.typedStructs)throw new Error("Could not find any shared typed structures");if(Y.lastTypedStructuresLength=Y.typedStructs.length,Q=Y.typedStructs[$],!Q)throw new Error("Could not find typed structure "+$)}var{construct:K,fullConstruct:W}=Q;if(!K){K=Q.construct=function F(){},W=Q.fullConstruct=function F(){},W.prototype=Y.structPrototype??{};var G=K.prototype=Y.structPrototype?Object.create(Y.structPrototype):{};let V=[],H=0,q;for(let F=0,U=Q.length;F<U;F++){let w=Q[F],[L,j,R,O]=w;if(R==="__proto__")R="__proto_";let N={key:R,offset:H};if(O)V.splice(F+O,0,N);else V.push(N);let D;switch(j){case 0:D=()=>0;break;case 1:D=(C,T)=>{let k=C.bytes[T+N.offset];return k>=246?QK(k):k};break;case 2:D=(C,T)=>{let k=C.bytes,S=(k.dataView||(k.dataView=new DataView(k.buffer,k.byteOffset,k.byteLength))).getUint16(T+N.offset,!0);return S>=65280?QK(S&255):S};break;case 4:D=(C,T)=>{let k=C.bytes,S=(k.dataView||(k.dataView=new DataView(k.buffer,k.byteOffset,k.byteLength))).getUint32(T+N.offset,!0);return S>=4294967040?QK(S&255):S};break}N.getRef=D,H+=j;let P;switch(L){case Ek:if(q&&!q.next)q.next=N;q=N,N.multiGetCount=0,P=function(C){let{bytes:T,position:k}=C,A=H+k,S=D(C,k);if(typeof S!=="number")return S;let x,I=N.next;while(I){if(x=I.getRef(C,k),typeof x==="number")break;else x=null;I=I.next}if(x==null)x=C.bytesEnd-A;if(C.srcString)return C.srcString.slice(S,x);return D00(T,S+A,x-S)};break;case Wz:case mL:if(q&&!q.next)q.next=N;q=N,P=function(C){let T=C.position,k=H+T,A=D(C,T);if(typeof A!=="number")return A;let S=C.bytes,x,I=N.next;while(I){if(x=I.getRef(C,T),typeof x==="number")break;else x=null;I=I.next}if(x==null)x=C.bytesEnd-k;if(L===Wz)return S.toString("utf8",A+k,x+k);else{q7=C;try{return Y.unpack(S,{start:A+k,end:x+k})}finally{q7=null}}};break;case KK:switch(j){case 4:P=function(C){let T=C.bytes,k=T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength)),A=C.position+N.offset,S=k.getInt32(A,!0);if(S<536870912){if(S>-520093696)return S;if(S>-536870912)return QK(S&255)}let x=k.getFloat32(A,!0),I=SY[(T[A+3]&127)<<1|T[A+2]>>7];return(I*x+(x>0?0.5:-0.5)>>0)/I};break;case 8:P=function(C){let T=C.bytes,A=(T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength))).getFloat64(C.position+N.offset,!0);if(isNaN(A)){let S=T[C.position+N.offset];if(S>=246)return QK(S)}return A};break;case 1:P=function(C){let k=C.bytes[C.position+N.offset];return k<246?k:QK(k)};break}break;case vk:P=function(C){let T=C.bytes,k=T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength));return new Date(k.getFloat64(C.position+N.offset,!0))};break}N.get=P}if(u00){let F=[],U=[],w=0,L;for(let R of V){if(Y.alwaysLazyProperty&&Y.alwaysLazyProperty(R.key)){L=!0;continue}Object.defineProperty(G,R.key,{get:tk1(R.get),enumerable:!0});let O="v"+w++;U.push(O),F.push("o["+JSON.stringify(R.key)+"]="+O+"(s)")}if(L)F.push("__proto__:this");let j=new Function(...U,"var c=this;return function(s){var o=new c();"+F.join(";")+";return o;}").apply(W,V.map((R)=>R.get));Object.defineProperty(G,"toJSON",{value(R){return j.call(this,this[Ik])}})}else Object.defineProperty(G,"toJSON",{value(F){let U={};for(let w=0,L=V.length;w<L;w++){let j=V[w].key;U[j]=this[j]}return U}})}var z=new K;return z[Ik]={bytes:Z,position:J,srcString:"",bytesEnd:X},z}function QK(Z){switch(Z){case 246:return null;case 247:return;case 248:return!1;case 249:return!0}throw new Error("Unknown constant")}function tk1(Z){return function(){return Z(this[Ik])}}function ek1(){if(q7)q7.bytes=Uint8Array.prototype.slice.call(q7.bytes,q7.position,q7.bytesEnd),q7.position=0,q7.bytesEnd=q7.bytes.length}function ZE1(Z,J){if(J.typedStructs){let Y=new Map;Y.set("named",Z),Y.set("typed",J.typedStructs),Z=Y}let X=J.lastTypedStructuresLength||0;return Z.isCompatible=(Y)=>{let $=!0;if(Y instanceof Map){if((Y.get("named")||[]).length!==(J.lastNamedStructuresLength||0))$=!1;if((Y.get("typed")||[]).length!==X)$=!1}else if(Y instanceof Array||Array.isArray(Y)){if(Y.length!==(J.lastNamedStructuresLength||0))$=!1}if(!$)J._mergeStructures(Y);return $},J.lastTypedStructuresLength=J.typedStructs&&J.typedStructs.length,Z}I00(rk1,ok1,ek1);var YE1=process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED!==void 0&&process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED.toLowerCase()==="true";if(!YE1){let Z;try{if(Z=u("msgpackr-extract"),Z)P00(Z.extractStrings)}catch(J){}}import{WebSocketServer as Dm1}from"ws";import Cm1 from"mediasoup";var sw=t(NZ0(),1);import Mm1 from"http";import Rm1 from"https";import aw from"fs";import Nm1 from"path";import Pm1 from"url";var nZ0=t(pZ0(),1);import oY from"fs";import iZ0 from"path";var WV="./dev/persistence";class M7{static instance=new M7;gameId=process.env.HYTOPIA_GAME_ID;lobbyId=process.env.HYTOPIA_LOBBY_ID;_creativeGateway;constructor(){try{this._creativeGateway=new nZ0.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(`
406
+ >>> no match, partial?`,Z,H,J,q),H===W)return!0}return!1}let U;if(typeof z==="string")U=V===z,this.debug("string match",z,V,U);else U=z.test(V),this.debug("pattern match",z,V,U);if(!U)return!1}if(Q===W&&K===G)return!0;else if(Q===W)return X;else if(K===G)return Q===W-1&&Z[Q]==="";else throw new Error("wtf?")}braceExpand(){return md(this.pattern,this.options)}parse(Z){gG(Z);let J=this.options;if(Z==="**")return L6;if(Z==="")return"";let X,Y=null;if(X=Z.match(Az1))Y=J.dot?hz1:xz1;else if(X=Z.match(Pz1))Y=(J.nocase?J.dot?kz1:Tz1:J.dot?Cz1:Dz1)(X[1]);else if(X=Z.match(fz1))Y=(J.nocase?J.dot?yz1:bz1:J.dot?gz1:mz1)(X);else if(X=Z.match(Ez1))Y=J.dot?vz1:Iz1;else if(X=Z.match(Sz1))Y=_z1;let $=U6.fromGlob(Z,this.options).toMMPattern();if(Y&&typeof $==="object")Reflect.defineProperty($,"test",{value:Y});return $}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Z=this.set;if(!Z.length)return this.regexp=!1,this.regexp;let J=this.options,X=J.noglobstar?cz1:J.dot?lz1:pz1,Y=new Set(J.nocase?["i"]:[]),$=Z.map((W)=>{let G=W.map((z)=>{if(z instanceof RegExp)for(let V of z.flags.split(""))Y.add(V);return typeof z==="string"?oz1(z):z===L6?L6:z._src});return G.forEach((z,V)=>{let H=G[V+1],q=G[V-1];if(z!==L6||q===L6)return;if(q===void 0)if(H!==void 0&&H!==L6)G[V+1]="(?:\\/|"+X+"\\/)?"+H;else G[V]=X;else if(H===void 0)G[V-1]=q+"(?:\\/|"+X+")?";else if(H!==L6)G[V-1]=q+"(?:\\/|\\/"+X+"\\/)"+H,G[V+1]=L6}),G.filter((z)=>z!==L6).join("/")}).join("|"),[Q,K]=Z.length>1?["(?:",")"]:["",""];if($="^"+Q+$+K+"$",this.negate)$="^(?!"+$+").+$";try{this.regexp=new RegExp($,[...Y].join(""))}catch(W){this.regexp=!1}return this.regexp}slashSplit(Z){if(this.preserveMultipleSlashes)return Z.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(Z))return["",...Z.split(/\/+/)];else return Z.split(/\/+/)}match(Z,J=this.partial){if(this.debug("match",Z,this.pattern),this.comment)return!1;if(this.empty)return Z==="";if(Z==="/"&&J)return!0;let X=this.options;if(this.isWindows)Z=Z.split("\\").join("/");let Y=this.slashSplit(Z);this.debug(this.pattern,"split",Y);let $=this.set;this.debug(this.pattern,"set",$);let Q=Y[Y.length-1];if(!Q)for(let K=Y.length-2;!Q&&K>=0;K--)Q=Y[K];for(let K=0;K<$.length;K++){let W=$[K],G=Y;if(X.matchBase&&W.length===1)G=[Q];if(this.matchOne(G,W,J)){if(X.flipNegate)return!0;return!this.negate}}if(X.flipNegate)return!1;return this.negate}static defaults(Z){return m6.defaults(Z).Minimatch}}m6.AST=U6;m6.Minimatch=L9;m6.escape=OQ;m6.unescape=Q4;import{fileURLToPath as EV1}from"url";var MQ=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,dd=new Set,XP=typeof process==="object"&&!!process?process:{},cd=(Z,J,X,Y)=>{typeof XP.emitWarning==="function"?XP.emitWarning(Z,J,X,Y):console.error(`[${X}] ${J}: ${Z}`)},LU=globalThis.AbortController,ud=globalThis.AbortSignal;if(typeof LU==="undefined"){ud=class X{onabort;_onabort=[];reason;aborted=!1;addEventListener(Y,$){this._onabort.push($)}},LU=class X{constructor(){J()}signal=new ud;abort(Y){if(this.signal.aborted)return;this.signal.reason=Y,this.signal.aborted=!0;for(let $ of this.signal._onabort)$(Y);this.signal.onabort?.(Y)}};let Z=XP.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",J=()=>{if(!Z)return;Z=!1,cd("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",J)}}var rz1=(Z)=>!dd.has(Z),iG6=Symbol("type"),$J=(Z)=>Z&&Z===Math.floor(Z)&&Z>0&&isFinite(Z),ld=(Z)=>!$J(Z)?null:Z<=Math.pow(2,8)?Uint8Array:Z<=Math.pow(2,16)?Uint16Array:Z<=Math.pow(2,32)?Uint32Array:Z<=Number.MAX_SAFE_INTEGER?uG:null;class uG extends Array{constructor(Z){super(Z);this.fill(0)}}class RQ{heap;length;static#Z=!1;static create(Z){let J=ld(Z);if(!J)return[];RQ.#Z=!0;let X=new RQ(Z,J);return RQ.#Z=!1,X}constructor(Z,J){if(!RQ.#Z)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new J(Z),this.length=0}push(Z){this.heap[this.length++]=Z}pop(){return this.heap[--this.length]}}class dG{#Z;#J;#Y;#X;#$;#V;#q;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#W;#G;#z;#H;#Q;#U;#w;#L;#j;#k;#O;#E;#N;#R;#M;#C;#B;#v;static unsafeExposeInternals(Z){return{starts:Z.#N,ttls:Z.#R,sizes:Z.#E,keyMap:Z.#z,keyList:Z.#H,valList:Z.#Q,next:Z.#U,prev:Z.#w,get head(){return Z.#L},get tail(){return Z.#j},free:Z.#k,isBackgroundFetch:(J)=>Z.#F(J),backgroundFetch:(J,X,Y,$)=>Z.#h(J,X,Y,$),moveToTail:(J)=>Z.#y(J),indexes:(J)=>Z.#T(J),rindexes:(J)=>Z.#I(J),isStale:(J)=>Z.#D(J)}}get max(){return this.#Z}get maxSize(){return this.#J}get calculatedSize(){return this.#G}get size(){return this.#W}get fetchMethod(){return this.#V}get memoMethod(){return this.#q}get dispose(){return this.#Y}get onInsert(){return this.#X}get disposeAfter(){return this.#$}constructor(Z){let{max:J=0,ttl:X,ttlResolution:Y=1,ttlAutopurge:$,updateAgeOnGet:Q,updateAgeOnHas:K,allowStale:W,dispose:G,onInsert:z,disposeAfter:V,noDisposeOnSet:H,noUpdateTTL:q,maxSize:F=0,maxEntrySize:U=0,sizeCalculation:w,fetchMethod:L,memoMethod:j,noDeleteOnFetchRejection:R,noDeleteOnStaleGet:O,allowStaleOnFetchRejection:N,allowStaleOnFetchAbort:D,ignoreFetchAbort:P}=Z;if(J!==0&&!$J(J))throw new TypeError("max option must be a nonnegative integer");let C=J?ld(J):Array;if(!C)throw new Error("invalid max value: "+J);if(this.#Z=J,this.#J=F,this.maxEntrySize=U||this.#J,this.sizeCalculation=w,this.sizeCalculation){if(!this.#J&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw new TypeError("sizeCalculation set to non-function")}if(j!==void 0&&typeof j!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#q=j,L!==void 0&&typeof L!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#V=L,this.#C=!!L,this.#z=new Map,this.#H=new Array(J).fill(void 0),this.#Q=new Array(J).fill(void 0),this.#U=new C(J),this.#w=new C(J),this.#L=0,this.#j=0,this.#k=RQ.create(J),this.#W=0,this.#G=0,typeof G==="function")this.#Y=G;if(typeof z==="function")this.#X=z;if(typeof V==="function")this.#$=V,this.#O=[];else this.#$=void 0,this.#O=void 0;if(this.#M=!!this.#Y,this.#v=!!this.#X,this.#B=!!this.#$,this.noDisposeOnSet=!!H,this.noUpdateTTL=!!q,this.noDeleteOnFetchRejection=!!R,this.allowStaleOnFetchRejection=!!N,this.allowStaleOnFetchAbort=!!D,this.ignoreFetchAbort=!!P,this.maxEntrySize!==0){if(this.#J!==0){if(!$J(this.#J))throw new TypeError("maxSize must be a positive integer if specified")}if(!$J(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#m()}if(this.allowStale=!!W,this.noDeleteOnStaleGet=!!O,this.updateAgeOnGet=!!Q,this.updateAgeOnHas=!!K,this.ttlResolution=$J(Y)||Y===0?Y:1,this.ttlAutopurge=!!$,this.ttl=X||0,this.ttl){if(!$J(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#K()}if(this.#Z===0&&this.ttl===0&&this.#J===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Z&&!this.#J){if(rz1("LRU_CACHE_UNBOUNDED"))dd.add("LRU_CACHE_UNBOUNDED"),cd("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",dG)}}getRemainingTTL(Z){return this.#z.has(Z)?1/0:0}#K(){let Z=new uG(this.#Z),J=new uG(this.#Z);this.#R=Z,this.#N=J,this.#S=($,Q,K=MQ.now())=>{if(J[$]=Q!==0?K:0,Z[$]=Q,Q!==0&&this.ttlAutopurge){let W=setTimeout(()=>{if(this.#D($))this.#_(this.#H[$],"expire")},Q+1);if(W.unref)W.unref()}},this.#A=($)=>{J[$]=Z[$]!==0?MQ.now():0},this.#P=($,Q)=>{if(Z[Q]){let K=Z[Q],W=J[Q];if(!K||!W)return;$.ttl=K,$.start=W,$.now=X||Y();let G=$.now-W;$.remainingTTL=K-G}};let X=0,Y=()=>{let $=MQ.now();if(this.ttlResolution>0){X=$;let Q=setTimeout(()=>X=0,this.ttlResolution);if(Q.unref)Q.unref()}return $};this.getRemainingTTL=($)=>{let Q=this.#z.get($);if(Q===void 0)return 0;let K=Z[Q],W=J[Q];if(!K||!W)return 1/0;let G=(X||Y())-W;return K-G},this.#D=($)=>{let Q=J[$],K=Z[$];return!!K&&!!Q&&(X||Y())-Q>K}}#A=()=>{};#P=()=>{};#S=()=>{};#D=()=>!1;#m(){let Z=new uG(this.#Z);this.#G=0,this.#E=Z,this.#x=(J)=>{this.#G-=Z[J],Z[J]=0},this.#u=(J,X,Y,$)=>{if(this.#F(X))return 0;if(!$J(Y))if($){if(typeof $!=="function")throw new TypeError("sizeCalculation must be a function");if(Y=$(X,J),!$J(Y))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return Y},this.#f=(J,X,Y)=>{if(Z[J]=X,this.#J){let $=this.#J-Z[J];while(this.#G>$)this.#b(!0)}if(this.#G+=Z[J],Y)Y.entrySize=X,Y.totalCalculatedSize=this.#G}}#x=(Z)=>{};#f=(Z,J,X)=>{};#u=(Z,J,X,Y)=>{if(X||Y)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:Z=this.allowStale}={}){if(this.#W)for(let J=this.#j;;){if(!this.#d(J))break;if(Z||!this.#D(J))yield J;if(J===this.#L)break;else J=this.#w[J]}}*#I({allowStale:Z=this.allowStale}={}){if(this.#W)for(let J=this.#L;;){if(!this.#d(J))break;if(Z||!this.#D(J))yield J;if(J===this.#j)break;else J=this.#U[J]}}#d(Z){return Z!==void 0&&this.#z.get(this.#H[Z])===Z}*entries(){for(let Z of this.#T())if(this.#Q[Z]!==void 0&&this.#H[Z]!==void 0&&!this.#F(this.#Q[Z]))yield[this.#H[Z],this.#Q[Z]]}*rentries(){for(let Z of this.#I())if(this.#Q[Z]!==void 0&&this.#H[Z]!==void 0&&!this.#F(this.#Q[Z]))yield[this.#H[Z],this.#Q[Z]]}*keys(){for(let Z of this.#T()){let J=this.#H[Z];if(J!==void 0&&!this.#F(this.#Q[Z]))yield J}}*rkeys(){for(let Z of this.#I()){let J=this.#H[Z];if(J!==void 0&&!this.#F(this.#Q[Z]))yield J}}*values(){for(let Z of this.#T())if(this.#Q[Z]!==void 0&&!this.#F(this.#Q[Z]))yield this.#Q[Z]}*rvalues(){for(let Z of this.#I())if(this.#Q[Z]!==void 0&&!this.#F(this.#Q[Z]))yield this.#Q[Z]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(Z,J={}){for(let X of this.#T()){let Y=this.#Q[X],$=this.#F(Y)?Y.__staleWhileFetching:Y;if($===void 0)continue;if(Z($,this.#H[X],this))return this.get(this.#H[X],J)}}forEach(Z,J=this){for(let X of this.#T()){let Y=this.#Q[X],$=this.#F(Y)?Y.__staleWhileFetching:Y;if($===void 0)continue;Z.call(J,$,this.#H[X],this)}}rforEach(Z,J=this){for(let X of this.#I()){let Y=this.#Q[X],$=this.#F(Y)?Y.__staleWhileFetching:Y;if($===void 0)continue;Z.call(J,$,this.#H[X],this)}}purgeStale(){let Z=!1;for(let J of this.#I({allowStale:!0}))if(this.#D(J))this.#_(this.#H[J],"expire"),Z=!0;return Z}info(Z){let J=this.#z.get(Z);if(J===void 0)return;let X=this.#Q[J],Y=this.#F(X)?X.__staleWhileFetching:X;if(Y===void 0)return;let $={value:Y};if(this.#R&&this.#N){let Q=this.#R[J],K=this.#N[J];if(Q&&K){let W=Q-(MQ.now()-K);$.ttl=W,$.start=Date.now()}}if(this.#E)$.size=this.#E[J];return $}dump(){let Z=[];for(let J of this.#T({allowStale:!0})){let X=this.#H[J],Y=this.#Q[J],$=this.#F(Y)?Y.__staleWhileFetching:Y;if($===void 0||X===void 0)continue;let Q={value:$};if(this.#R&&this.#N){Q.ttl=this.#R[J];let K=MQ.now()-this.#N[J];Q.start=Math.floor(Date.now()-K)}if(this.#E)Q.size=this.#E[J];Z.unshift([X,Q])}return Z}load(Z){this.clear();for(let[J,X]of Z){if(X.start){let Y=Date.now()-X.start;X.start=MQ.now()-Y}this.set(J,X.value,X)}}set(Z,J,X={}){if(J===void 0)return this.delete(Z),this;let{ttl:Y=this.ttl,start:$,noDisposeOnSet:Q=this.noDisposeOnSet,sizeCalculation:K=this.sizeCalculation,status:W}=X,{noUpdateTTL:G=this.noUpdateTTL}=X,z=this.#u(Z,J,X.size||0,K);if(this.maxEntrySize&&z>this.maxEntrySize){if(W)W.set="miss",W.maxEntrySizeExceeded=!0;return this.#_(Z,"set"),this}let V=this.#W===0?void 0:this.#z.get(Z);if(V===void 0){if(V=this.#W===0?this.#j:this.#k.length!==0?this.#k.pop():this.#W===this.#Z?this.#b(!1):this.#W,this.#H[V]=Z,this.#Q[V]=J,this.#z.set(Z,V),this.#U[this.#j]=V,this.#w[V]=this.#j,this.#j=V,this.#W++,this.#f(V,z,W),W)W.set="add";if(G=!1,this.#v)this.#X?.(J,Z,"add")}else{this.#y(V);let H=this.#Q[V];if(J!==H){if(this.#C&&this.#F(H)){H.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:q}=H;if(q!==void 0&&!Q){if(this.#M)this.#Y?.(q,Z,"set");if(this.#B)this.#O?.push([q,Z,"set"])}}else if(!Q){if(this.#M)this.#Y?.(H,Z,"set");if(this.#B)this.#O?.push([H,Z,"set"])}if(this.#x(V),this.#f(V,z,W),this.#Q[V]=J,W){W.set="replace";let q=H&&this.#F(H)?H.__staleWhileFetching:H;if(q!==void 0)W.oldValue=q}}else if(W)W.set="update";if(this.#v)this.onInsert?.(J,Z,J===H?"update":"replace")}if(Y!==0&&!this.#R)this.#K();if(this.#R){if(!G)this.#S(V,Y,$);if(W)this.#P(W,V)}if(!Q&&this.#B&&this.#O){let H=this.#O,q;while(q=H?.shift())this.#$?.(...q)}return this}pop(){try{while(this.#W){let Z=this.#Q[this.#L];if(this.#b(!0),this.#F(Z)){if(Z.__staleWhileFetching)return Z.__staleWhileFetching}else if(Z!==void 0)return Z}}finally{if(this.#B&&this.#O){let Z=this.#O,J;while(J=Z?.shift())this.#$?.(...J)}}}#b(Z){let J=this.#L,X=this.#H[J],Y=this.#Q[J];if(this.#C&&this.#F(Y))Y.__abortController.abort(new Error("evicted"));else if(this.#M||this.#B){if(this.#M)this.#Y?.(Y,X,"evict");if(this.#B)this.#O?.push([Y,X,"evict"])}if(this.#x(J),Z)this.#H[J]=void 0,this.#Q[J]=void 0,this.#k.push(J);if(this.#W===1)this.#L=this.#j=0,this.#k.length=0;else this.#L=this.#U[J];return this.#z.delete(X),this.#W--,J}has(Z,J={}){let{updateAgeOnHas:X=this.updateAgeOnHas,status:Y}=J,$=this.#z.get(Z);if($!==void 0){let Q=this.#Q[$];if(this.#F(Q)&&Q.__staleWhileFetching===void 0)return!1;if(!this.#D($)){if(X)this.#A($);if(Y)Y.has="hit",this.#P(Y,$);return!0}else if(Y)Y.has="stale",this.#P(Y,$)}else if(Y)Y.has="miss";return!1}peek(Z,J={}){let{allowStale:X=this.allowStale}=J,Y=this.#z.get(Z);if(Y===void 0||!X&&this.#D(Y))return;let $=this.#Q[Y];return this.#F($)?$.__staleWhileFetching:$}#h(Z,J,X,Y){let $=J===void 0?void 0:this.#Q[J];if(this.#F($))return $;let Q=new LU,{signal:K}=X;K?.addEventListener("abort",()=>Q.abort(K.reason),{signal:Q.signal});let W={signal:Q.signal,options:X,context:Y},G=(U,w=!1)=>{let{aborted:L}=Q.signal,j=X.ignoreFetchAbort&&U!==void 0;if(X.status)if(L&&!w){if(X.status.fetchAborted=!0,X.status.fetchError=Q.signal.reason,j)X.status.fetchAbortIgnored=!0}else X.status.fetchResolved=!0;if(L&&!j&&!w)return V(Q.signal.reason);let R=q;if(this.#Q[J]===q)if(U===void 0)if(R.__staleWhileFetching)this.#Q[J]=R.__staleWhileFetching;else this.#_(Z,"fetch");else{if(X.status)X.status.fetchUpdated=!0;this.set(Z,U,W.options)}return U},z=(U)=>{if(X.status)X.status.fetchRejected=!0,X.status.fetchError=U;return V(U)},V=(U)=>{let{aborted:w}=Q.signal,L=w&&X.allowStaleOnFetchAbort,j=L||X.allowStaleOnFetchRejection,R=j||X.noDeleteOnFetchRejection,O=q;if(this.#Q[J]===q){if(!R||O.__staleWhileFetching===void 0)this.#_(Z,"fetch");else if(!L)this.#Q[J]=O.__staleWhileFetching}if(j){if(X.status&&O.__staleWhileFetching!==void 0)X.status.returnedStale=!0;return O.__staleWhileFetching}else if(O.__returned===O)throw U},H=(U,w)=>{let L=this.#V?.(Z,$,W);if(L&&L instanceof Promise)L.then((j)=>U(j===void 0?void 0:j),w);Q.signal.addEventListener("abort",()=>{if(!X.ignoreFetchAbort||X.allowStaleOnFetchAbort){if(U(void 0),X.allowStaleOnFetchAbort)U=(j)=>G(j,!0)}})};if(X.status)X.status.fetchDispatched=!0;let q=new Promise(H).then(G,z),F=Object.assign(q,{__abortController:Q,__staleWhileFetching:$,__returned:void 0});if(J===void 0)this.set(Z,F,{...W.options,status:void 0}),J=this.#z.get(Z);else this.#Q[J]=F;return F}#F(Z){if(!this.#C)return!1;let J=Z;return!!J&&J instanceof Promise&&J.hasOwnProperty("__staleWhileFetching")&&J.__abortController instanceof LU}async fetch(Z,J={}){let{allowStale:X=this.allowStale,updateAgeOnGet:Y=this.updateAgeOnGet,noDeleteOnStaleGet:$=this.noDeleteOnStaleGet,ttl:Q=this.ttl,noDisposeOnSet:K=this.noDisposeOnSet,size:W=0,sizeCalculation:G=this.sizeCalculation,noUpdateTTL:z=this.noUpdateTTL,noDeleteOnFetchRejection:V=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:H=this.allowStaleOnFetchRejection,ignoreFetchAbort:q=this.ignoreFetchAbort,allowStaleOnFetchAbort:F=this.allowStaleOnFetchAbort,context:U,forceRefresh:w=!1,status:L,signal:j}=J;if(!this.#C){if(L)L.fetch="get";return this.get(Z,{allowStale:X,updateAgeOnGet:Y,noDeleteOnStaleGet:$,status:L})}let R={allowStale:X,updateAgeOnGet:Y,noDeleteOnStaleGet:$,ttl:Q,noDisposeOnSet:K,size:W,sizeCalculation:G,noUpdateTTL:z,noDeleteOnFetchRejection:V,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:F,ignoreFetchAbort:q,status:L,signal:j},O=this.#z.get(Z);if(O===void 0){if(L)L.fetch="miss";let N=this.#h(Z,O,R,U);return N.__returned=N}else{let N=this.#Q[O];if(this.#F(N)){let k=X&&N.__staleWhileFetching!==void 0;if(L){if(L.fetch="inflight",k)L.returnedStale=!0}return k?N.__staleWhileFetching:N.__returned=N}let D=this.#D(O);if(!w&&!D){if(L)L.fetch="hit";if(this.#y(O),Y)this.#A(O);if(L)this.#P(L,O);return N}let P=this.#h(Z,O,R,U),T=P.__staleWhileFetching!==void 0&&X;if(L){if(L.fetch=D?"stale":"refresh",T&&D)L.returnedStale=!0}return T?P.__staleWhileFetching:P.__returned=P}}async forceFetch(Z,J={}){let X=await this.fetch(Z,J);if(X===void 0)throw new Error("fetch() returned undefined");return X}memo(Z,J={}){let X=this.#q;if(!X)throw new Error("no memoMethod provided to constructor");let{context:Y,forceRefresh:$,...Q}=J,K=this.get(Z,Q);if(!$&&K!==void 0)return K;let W=X(Z,K,{options:Q,context:Y});return this.set(Z,W,Q),W}get(Z,J={}){let{allowStale:X=this.allowStale,updateAgeOnGet:Y=this.updateAgeOnGet,noDeleteOnStaleGet:$=this.noDeleteOnStaleGet,status:Q}=J,K=this.#z.get(Z);if(K!==void 0){let W=this.#Q[K],G=this.#F(W);if(Q)this.#P(Q,K);if(this.#D(K)){if(Q)Q.get="stale";if(!G){if(!$)this.#_(Z,"expire");if(Q&&X)Q.returnedStale=!0;return X?W:void 0}else{if(Q&&X&&W.__staleWhileFetching!==void 0)Q.returnedStale=!0;return X?W.__staleWhileFetching:void 0}}else{if(Q)Q.get="hit";if(G)return W.__staleWhileFetching;if(this.#y(K),Y)this.#A(K);return W}}else if(Q)Q.get="miss"}#c(Z,J){this.#w[J]=Z,this.#U[Z]=J}#y(Z){if(Z!==this.#j){if(Z===this.#L)this.#L=this.#U[Z];else this.#c(this.#w[Z],this.#U[Z]);this.#c(this.#j,Z),this.#j=Z}}delete(Z){return this.#_(Z,"delete")}#_(Z,J){let X=!1;if(this.#W!==0){let Y=this.#z.get(Z);if(Y!==void 0)if(X=!0,this.#W===1)this.#g(J);else{this.#x(Y);let $=this.#Q[Y];if(this.#F($))$.__abortController.abort(new Error("deleted"));else if(this.#M||this.#B){if(this.#M)this.#Y?.($,Z,J);if(this.#B)this.#O?.push([$,Z,J])}if(this.#z.delete(Z),this.#H[Y]=void 0,this.#Q[Y]=void 0,Y===this.#j)this.#j=this.#w[Y];else if(Y===this.#L)this.#L=this.#U[Y];else{let Q=this.#w[Y];this.#U[Q]=this.#U[Y];let K=this.#U[Y];this.#w[K]=this.#w[Y]}this.#W--,this.#k.push(Y)}}if(this.#B&&this.#O?.length){let Y=this.#O,$;while($=Y?.shift())this.#$?.(...$)}return X}clear(){return this.#g("delete")}#g(Z){for(let J of this.#I({allowStale:!0})){let X=this.#Q[J];if(this.#F(X))X.__abortController.abort(new Error("deleted"));else{let Y=this.#H[J];if(this.#M)this.#Y?.(X,Y,Z);if(this.#B)this.#O?.push([X,Y,Z])}}if(this.#z.clear(),this.#Q.fill(void 0),this.#H.fill(void 0),this.#R&&this.#N)this.#R.fill(0),this.#N.fill(0);if(this.#E)this.#E.fill(0);if(this.#L=0,this.#j=0,this.#k.length=0,this.#G=0,this.#W=0,this.#B&&this.#O){let J=this.#O,X;while(X=J?.shift())this.#$?.(...X)}}}import{posix as GV1,win32 as qP}from"path";import{fileURLToPath as zV1}from"url";import{lstatSync as VV1,readdir as HV1,readdirSync as qV1,readlinkSync as FV1,realpathSync as UV1}from"fs";import*as LV1 from"fs";import{lstat as BV1,readdir as jV1,readlink as OV1,realpath as MV1}from"fs/promises";import{EventEmitter as GP}from"events";import sd from"stream";import{StringDecoder as tz1}from"string_decoder";var pd=typeof process==="object"&&process?process:{stdout:null,stderr:null},ez1=(Z)=>!!Z&&typeof Z==="object"&&(Z instanceof aX||Z instanceof sd||ZV1(Z)||JV1(Z)),ZV1=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof GP&&typeof Z.pipe==="function"&&Z.pipe!==sd.Writable.prototype.pipe,JV1=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof GP&&typeof Z.write==="function"&&typeof Z.end==="function",XZ=Symbol("EOF"),YZ=Symbol("maybeEmitEnd"),QJ=Symbol("emittedEnd"),wU=Symbol("emittingEnd"),cG=Symbol("emittedError"),BU=Symbol("closed"),id=Symbol("read"),jU=Symbol("flush"),nd=Symbol("flushChunk"),K4=Symbol("encoding"),NQ=Symbol("decoder"),r8=Symbol("flowing"),lG=Symbol("paused"),PQ=Symbol("resume"),t8=Symbol("buffer"),u6=Symbol("pipes"),e8=Symbol("bufferLength"),YP=Symbol("bufferPush"),OU=Symbol("bufferShift"),P6=Symbol("objectMode"),O8=Symbol("destroyed"),$P=Symbol("error"),QP=Symbol("emitData"),ad=Symbol("emitEnd"),KP=Symbol("emitEnd2"),s4=Symbol("async"),WP=Symbol("abort"),MU=Symbol("aborted"),pG=Symbol("signal"),nX=Symbol("dataListeners"),u5=Symbol("discarded"),iG=(Z)=>Promise.resolve().then(Z),XV1=(Z)=>Z(),YV1=(Z)=>Z==="end"||Z==="finish"||Z==="prefinish",$V1=(Z)=>Z instanceof ArrayBuffer||!!Z&&typeof Z==="object"&&Z.constructor&&Z.constructor.name==="ArrayBuffer"&&Z.byteLength>=0,QV1=(Z)=>!Buffer.isBuffer(Z)&&ArrayBuffer.isView(Z);class zP{src;dest;opts;ondrain;constructor(Z,J,X){this.src=Z,this.dest=J,this.opts=X,this.ondrain=()=>Z[PQ](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(Z){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class od extends zP{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Z,J,X){super(Z,J,X);this.proxyErrors=(Y)=>J.emit("error",Y),Z.on("error",this.proxyErrors)}}var KV1=(Z)=>!!Z.objectMode,WV1=(Z)=>!Z.objectMode&&!!Z.encoding&&Z.encoding!=="buffer";class aX extends GP{[r8]=!1;[lG]=!1;[u6]=[];[t8]=[];[P6];[K4];[s4];[NQ];[XZ]=!1;[QJ]=!1;[wU]=!1;[BU]=!1;[cG]=null;[e8]=0;[O8]=!1;[pG];[MU]=!1;[nX]=0;[u5]=!1;writable=!0;readable=!0;constructor(...Z){let J=Z[0]||{};super();if(J.objectMode&&typeof J.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(KV1(J))this[P6]=!0,this[K4]=null;else if(WV1(J))this[K4]=J.encoding,this[P6]=!1;else this[P6]=!1,this[K4]=null;if(this[s4]=!!J.async,this[NQ]=this[K4]?new tz1(this[K4]):null,J&&J.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[t8]});if(J&&J.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[u6]});let{signal:X}=J;if(X)if(this[pG]=X,X.aborted)this[WP]();else X.addEventListener("abort",()=>this[WP]())}get bufferLength(){return this[e8]}get encoding(){return this[K4]}set encoding(Z){throw new Error("Encoding must be set at instantiation time")}setEncoding(Z){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[P6]}set objectMode(Z){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[s4]}set["async"](Z){this[s4]=this[s4]||!!Z}[WP](){this[MU]=!0,this.emit("abort",this[pG]?.reason),this.destroy(this[pG]?.reason)}get aborted(){return this[MU]}set aborted(Z){}write(Z,J,X){if(this[MU])return!1;if(this[XZ])throw new Error("write after end");if(this[O8])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof J==="function")X=J,J="utf8";if(!J)J="utf8";let Y=this[s4]?iG:XV1;if(!this[P6]&&!Buffer.isBuffer(Z)){if(QV1(Z))Z=Buffer.from(Z.buffer,Z.byteOffset,Z.byteLength);else if($V1(Z))Z=Buffer.from(Z);else if(typeof Z!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[P6]){if(this[r8]&&this[e8]!==0)this[jU](!0);if(this[r8])this.emit("data",Z);else this[YP](Z);if(this[e8]!==0)this.emit("readable");if(X)Y(X);return this[r8]}if(!Z.length){if(this[e8]!==0)this.emit("readable");if(X)Y(X);return this[r8]}if(typeof Z==="string"&&!(J===this[K4]&&!this[NQ]?.lastNeed))Z=Buffer.from(Z,J);if(Buffer.isBuffer(Z)&&this[K4])Z=this[NQ].write(Z);if(this[r8]&&this[e8]!==0)this[jU](!0);if(this[r8])this.emit("data",Z);else this[YP](Z);if(this[e8]!==0)this.emit("readable");if(X)Y(X);return this[r8]}read(Z){if(this[O8])return null;if(this[u5]=!1,this[e8]===0||Z===0||Z&&Z>this[e8])return this[YZ](),null;if(this[P6])Z=null;if(this[t8].length>1&&!this[P6])this[t8]=[this[K4]?this[t8].join(""):Buffer.concat(this[t8],this[e8])];let J=this[id](Z||null,this[t8][0]);return this[YZ](),J}[id](Z,J){if(this[P6])this[OU]();else{let X=J;if(Z===X.length||Z===null)this[OU]();else if(typeof X==="string")this[t8][0]=X.slice(Z),J=X.slice(0,Z),this[e8]-=Z;else this[t8][0]=X.subarray(Z),J=X.subarray(0,Z),this[e8]-=Z}if(this.emit("data",J),!this[t8].length&&!this[XZ])this.emit("drain");return J}end(Z,J,X){if(typeof Z==="function")X=Z,Z=void 0;if(typeof J==="function")X=J,J="utf8";if(Z!==void 0)this.write(Z,J);if(X)this.once("end",X);if(this[XZ]=!0,this.writable=!1,this[r8]||!this[lG])this[YZ]();return this}[PQ](){if(this[O8])return;if(!this[nX]&&!this[u6].length)this[u5]=!0;if(this[lG]=!1,this[r8]=!0,this.emit("resume"),this[t8].length)this[jU]();else if(this[XZ])this[YZ]();else this.emit("drain")}resume(){return this[PQ]()}pause(){this[r8]=!1,this[lG]=!0,this[u5]=!1}get destroyed(){return this[O8]}get flowing(){return this[r8]}get paused(){return this[lG]}[YP](Z){if(this[P6])this[e8]+=1;else this[e8]+=Z.length;this[t8].push(Z)}[OU](){if(this[P6])this[e8]-=1;else this[e8]-=this[t8][0].length;return this[t8].shift()}[jU](Z=!1){do;while(this[nd](this[OU]())&&this[t8].length);if(!Z&&!this[t8].length&&!this[XZ])this.emit("drain")}[nd](Z){return this.emit("data",Z),this[r8]}pipe(Z,J){if(this[O8])return Z;this[u5]=!1;let X=this[QJ];if(J=J||{},Z===pd.stdout||Z===pd.stderr)J.end=!1;else J.end=J.end!==!1;if(J.proxyErrors=!!J.proxyErrors,X){if(J.end)Z.end()}else if(this[u6].push(!J.proxyErrors?new zP(this,Z,J):new od(this,Z,J)),this[s4])iG(()=>this[PQ]());else this[PQ]();return Z}unpipe(Z){let J=this[u6].find((X)=>X.dest===Z);if(J){if(this[u6].length===1){if(this[r8]&&this[nX]===0)this[r8]=!1;this[u6]=[]}else this[u6].splice(this[u6].indexOf(J),1);J.unpipe()}}addListener(Z,J){return this.on(Z,J)}on(Z,J){let X=super.on(Z,J);if(Z==="data"){if(this[u5]=!1,this[nX]++,!this[u6].length&&!this[r8])this[PQ]()}else if(Z==="readable"&&this[e8]!==0)super.emit("readable");else if(YV1(Z)&&this[QJ])super.emit(Z),this.removeAllListeners(Z);else if(Z==="error"&&this[cG]){let Y=J;if(this[s4])iG(()=>Y.call(this,this[cG]));else Y.call(this,this[cG])}return X}removeListener(Z,J){return this.off(Z,J)}off(Z,J){let X=super.off(Z,J);if(Z==="data"){if(this[nX]=this.listeners("data").length,this[nX]===0&&!this[u5]&&!this[u6].length)this[r8]=!1}return X}removeAllListeners(Z){let J=super.removeAllListeners(Z);if(Z==="data"||Z===void 0){if(this[nX]=0,!this[u5]&&!this[u6].length)this[r8]=!1}return J}get emittedEnd(){return this[QJ]}[YZ](){if(!this[wU]&&!this[QJ]&&!this[O8]&&this[t8].length===0&&this[XZ]){if(this[wU]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[BU])this.emit("close");this[wU]=!1}}emit(Z,...J){let X=J[0];if(Z!=="error"&&Z!=="close"&&Z!==O8&&this[O8])return!1;else if(Z==="data")return!this[P6]&&!X?!1:this[s4]?(iG(()=>this[QP](X)),!0):this[QP](X);else if(Z==="end")return this[ad]();else if(Z==="close"){if(this[BU]=!0,!this[QJ]&&!this[O8])return!1;let $=super.emit("close");return this.removeAllListeners("close"),$}else if(Z==="error"){this[cG]=X,super.emit($P,X);let $=!this[pG]||this.listeners("error").length?super.emit("error",X):!1;return this[YZ](),$}else if(Z==="resume"){let $=super.emit("resume");return this[YZ](),$}else if(Z==="finish"||Z==="prefinish"){let $=super.emit(Z);return this.removeAllListeners(Z),$}let Y=super.emit(Z,...J);return this[YZ](),Y}[QP](Z){for(let X of this[u6])if(X.dest.write(Z)===!1)this.pause();let J=this[u5]?!1:super.emit("data",Z);return this[YZ](),J}[ad](){if(this[QJ])return!1;return this[QJ]=!0,this.readable=!1,this[s4]?(iG(()=>this[KP]()),!0):this[KP]()}[KP](){if(this[NQ]){let J=this[NQ].end();if(J){for(let X of this[u6])X.dest.write(J);if(!this[u5])super.emit("data",J)}}for(let J of this[u6])J.end();let Z=super.emit("end");return this.removeAllListeners("end"),Z}async collect(){let Z=Object.assign([],{dataLength:0});if(!this[P6])Z.dataLength=0;let J=this.promise();return this.on("data",(X)=>{if(Z.push(X),!this[P6])Z.dataLength+=X.length}),await J,Z}async concat(){if(this[P6])throw new Error("cannot concat in objectMode");let Z=await this.collect();return this[K4]?Z.join(""):Buffer.concat(Z,Z.dataLength)}async promise(){return new Promise((Z,J)=>{this.on(O8,()=>J(new Error("stream destroyed"))),this.on("error",(X)=>J(X)),this.on("end",()=>Z())})}[Symbol.asyncIterator](){this[u5]=!1;let Z=!1,J=async()=>{return this.pause(),Z=!0,{value:void 0,done:!0}};return{next:()=>{if(Z)return J();let Y=this.read();if(Y!==null)return Promise.resolve({done:!1,value:Y});if(this[XZ])return J();let $,Q,K=(V)=>{this.off("data",W),this.off("end",G),this.off(O8,z),J(),Q(V)},W=(V)=>{this.off("error",K),this.off("end",G),this.off(O8,z),this.pause(),$({value:V,done:!!this[XZ]})},G=()=>{this.off("error",K),this.off("data",W),this.off(O8,z),J(),$({done:!0,value:void 0})},z=()=>K(new Error("stream destroyed"));return new Promise((V,H)=>{Q=H,$=V,this.once(O8,z),this.once("error",K),this.once("end",G),this.once("data",W)})},throw:J,return:J,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[u5]=!1;let Z=!1,J=()=>{return this.pause(),this.off($P,J),this.off(O8,J),this.off("end",J),Z=!0,{done:!0,value:void 0}},X=()=>{if(Z)return J();let Y=this.read();return Y===null?J():{done:!1,value:Y}};return this.once("end",J),this.once($P,J),this.once(O8,J),{next:X,throw:J,return:J,[Symbol.iterator](){return this}}}destroy(Z){if(this[O8]){if(Z)this.emit("error",Z);else this.emit(O8);return this}this[O8]=!0,this[u5]=!0,this[t8].length=0,this[e8]=0;let J=this;if(typeof J.close==="function"&&!this[BU])J.close();if(Z)this.emit("error",Z);else this.emit(O8);return this}static get isStream(){return ez1}}var wV1=UV1.native,aG={lstatSync:VV1,readdir:HV1,readdirSync:qV1,readlinkSync:FV1,realpathSync:wV1,promises:{lstat:BV1,readdir:jV1,readlink:OV1,realpath:MV1}},Jc=(Z)=>!Z||Z===aG||Z===LV1?aG:{...aG,...Z,promises:{...aG.promises,...Z.promises||{}}},Xc=/^\\\\\?\\([a-z]:)\\?$/i,RV1=(Z)=>Z.replace(/\//g,"\\").replace(Xc,"$1\\"),NV1=/[\\\/]/,B9=0,Yc=1,$c=2,o4=4,Qc=6,Kc=8,sX=10,Wc=12,w9=15,nG=~w9,VP=16,rd=32,sG=64,W4=128,RU=256,PU=512,td=sG|W4|PU,PV1=1023,HP=(Z)=>Z.isFile()?Kc:Z.isDirectory()?o4:Z.isSymbolicLink()?sX:Z.isCharacterDevice()?$c:Z.isBlockDevice()?Qc:Z.isSocket()?Wc:Z.isFIFO()?Yc:B9,ed=new Map,oG=(Z)=>{let J=ed.get(Z);if(J)return J;let X=Z.normalize("NFKD");return ed.set(Z,X),X},Zc=new Map,NU=(Z)=>{let J=Zc.get(Z);if(J)return J;let X=oG(Z.toLowerCase());return Zc.set(Z,X),X};class FP extends dG{constructor(){super({max:256})}}class Gc extends dG{constructor(Z=16384){super({maxSize:Z,sizeCalculation:(J)=>J.length+1})}}var zc=Symbol("PathScurry setAsCwd");class d6{name;root;roots;parent;nocase;isCWD=!1;#Z;#J;get dev(){return this.#J}#Y;get mode(){return this.#Y}#X;get nlink(){return this.#X}#$;get uid(){return this.#$}#V;get gid(){return this.#V}#q;get rdev(){return this.#q}#W;get blksize(){return this.#W}#G;get ino(){return this.#G}#z;get size(){return this.#z}#H;get blocks(){return this.#H}#Q;get atimeMs(){return this.#Q}#U;get mtimeMs(){return this.#U}#w;get ctimeMs(){return this.#w}#L;get birthtimeMs(){return this.#L}#j;get atime(){return this.#j}#k;get mtime(){return this.#k}#O;get ctime(){return this.#O}#E;get birthtime(){return this.#E}#N;#R;#M;#C;#B;#v;#K;#A;#P;#S;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Z,J=B9,X,Y,$,Q,K){if(this.name=Z,this.#N=$?NU(Z):oG(Z),this.#K=J&PV1,this.nocase=$,this.roots=Y,this.root=X||this,this.#A=Q,this.#M=K.fullpath,this.#B=K.relative,this.#v=K.relativePosix,this.parent=K.parent,this.parent)this.#Z=this.parent.#Z;else this.#Z=Jc(K.fs)}depth(){if(this.#R!==void 0)return this.#R;if(!this.parent)return this.#R=0;return this.#R=this.parent.depth()+1}childrenCache(){return this.#A}resolve(Z){if(!Z)return this;let J=this.getRootString(Z),Y=Z.substring(J.length).split(this.splitSep);return J?this.getRoot(J).#D(Y):this.#D(Y)}#D(Z){let J=this;for(let X of Z)J=J.child(X);return J}children(){let Z=this.#A.get(this);if(Z)return Z;let J=Object.assign([],{provisional:0});return this.#A.set(this,J),this.#K&=~VP,J}child(Z,J){if(Z===""||Z===".")return this;if(Z==="..")return this.parent||this;let X=this.children(),Y=this.nocase?NU(Z):oG(Z);for(let W of X)if(W.#N===Y)return W;let $=this.parent?this.sep:"",Q=this.#M?this.#M+$+Z:void 0,K=this.newChild(Z,B9,{...J,parent:this,fullpath:Q});if(!this.canReaddir())K.#K|=W4;return X.push(K),K}relative(){if(this.isCWD)return"";if(this.#B!==void 0)return this.#B;let Z=this.name,J=this.parent;if(!J)return this.#B=this.name;let X=J.relative();return X+(!X||!J.parent?"":this.sep)+Z}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#v!==void 0)return this.#v;let Z=this.name,J=this.parent;if(!J)return this.#v=this.fullpathPosix();let X=J.relativePosix();return X+(!X||!J.parent?"":"/")+Z}fullpath(){if(this.#M!==void 0)return this.#M;let Z=this.name,J=this.parent;if(!J)return this.#M=this.name;let Y=J.fullpath()+(!J.parent?"":this.sep)+Z;return this.#M=Y}fullpathPosix(){if(this.#C!==void 0)return this.#C;if(this.sep==="/")return this.#C=this.fullpath();if(!this.parent){let Y=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(Y))return this.#C=`//?/${Y}`;else return this.#C=Y}let Z=this.parent,J=Z.fullpathPosix(),X=J+(!J||!Z.parent?"":"/")+this.name;return this.#C=X}isUnknown(){return(this.#K&w9)===B9}isType(Z){return this[`is${Z}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#K&w9)===Kc}isDirectory(){return(this.#K&w9)===o4}isCharacterDevice(){return(this.#K&w9)===$c}isBlockDevice(){return(this.#K&w9)===Qc}isFIFO(){return(this.#K&w9)===Yc}isSocket(){return(this.#K&w9)===Wc}isSymbolicLink(){return(this.#K&sX)===sX}lstatCached(){return this.#K&rd?this:void 0}readlinkCached(){return this.#P}realpathCached(){return this.#S}readdirCached(){let Z=this.children();return Z.slice(0,Z.provisional)}canReadlink(){if(this.#P)return!0;if(!this.parent)return!1;let Z=this.#K&w9;return!(Z!==B9&&Z!==sX||this.#K&RU||this.#K&W4)}calledReaddir(){return!!(this.#K&VP)}isENOENT(){return!!(this.#K&W4)}isNamed(Z){return!this.nocase?this.#N===oG(Z):this.#N===NU(Z)}async readlink(){let Z=this.#P;if(Z)return Z;if(!this.canReadlink())return;if(!this.parent)return;try{let J=await this.#Z.promises.readlink(this.fullpath()),X=(await this.parent.realpath())?.resolve(J);if(X)return this.#P=X}catch(J){this.#b(J.code);return}}readlinkSync(){let Z=this.#P;if(Z)return Z;if(!this.canReadlink())return;if(!this.parent)return;try{let J=this.#Z.readlinkSync(this.fullpath()),X=this.parent.realpathSync()?.resolve(J);if(X)return this.#P=X}catch(J){this.#b(J.code);return}}#m(Z){this.#K|=VP;for(let J=Z.provisional;J<Z.length;J++){let X=Z[J];if(X)X.#x()}}#x(){if(this.#K&W4)return;this.#K=(this.#K|W4)&nG,this.#f()}#f(){let Z=this.children();Z.provisional=0;for(let J of Z)J.#x()}#u(){this.#K|=PU,this.#T()}#T(){if(this.#K&sG)return;let Z=this.#K;if((Z&w9)===o4)Z&=nG;this.#K=Z|sG,this.#f()}#I(Z=""){if(Z==="ENOTDIR"||Z==="EPERM")this.#T();else if(Z==="ENOENT")this.#x();else this.children().provisional=0}#d(Z=""){if(Z==="ENOTDIR")this.parent.#T();else if(Z==="ENOENT")this.#x()}#b(Z=""){let J=this.#K;if(J|=RU,Z==="ENOENT")J|=W4;if(Z==="EINVAL"||Z==="UNKNOWN")J&=nG;if(this.#K=J,Z==="ENOTDIR"&&this.parent)this.parent.#T()}#h(Z,J){return this.#c(Z,J)||this.#F(Z,J)}#F(Z,J){let X=HP(Z),Y=this.newChild(Z.name,X,{parent:this}),$=Y.#K&w9;if($!==o4&&$!==sX&&$!==B9)Y.#K|=sG;return J.unshift(Y),J.provisional++,Y}#c(Z,J){for(let X=J.provisional;X<J.length;X++){let Y=J[X];if((this.nocase?NU(Z.name):oG(Z.name))!==Y.#N)continue;return this.#y(Z,Y,X,J)}}#y(Z,J,X,Y){let $=J.name;if(J.#K=J.#K&nG|HP(Z),$!==Z.name)J.name=Z.name;if(X!==Y.provisional){if(X===Y.length-1)Y.pop();else Y.splice(X,1);Y.unshift(J)}return Y.provisional++,J}async lstat(){if((this.#K&W4)===0)try{return this.#_(await this.#Z.promises.lstat(this.fullpath())),this}catch(Z){this.#d(Z.code)}}lstatSync(){if((this.#K&W4)===0)try{return this.#_(this.#Z.lstatSync(this.fullpath())),this}catch(Z){this.#d(Z.code)}}#_(Z){let{atime:J,atimeMs:X,birthtime:Y,birthtimeMs:$,blksize:Q,blocks:K,ctime:W,ctimeMs:G,dev:z,gid:V,ino:H,mode:q,mtime:F,mtimeMs:U,nlink:w,rdev:L,size:j,uid:R}=Z;this.#j=J,this.#Q=X,this.#E=Y,this.#L=$,this.#W=Q,this.#H=K,this.#O=W,this.#w=G,this.#J=z,this.#V=V,this.#G=H,this.#Y=q,this.#k=F,this.#U=U,this.#X=w,this.#q=L,this.#z=j,this.#$=R;let O=HP(Z);if(this.#K=this.#K&nG|O|rd,O!==B9&&O!==o4&&O!==sX)this.#K|=sG}#g=[];#p=!1;#i(Z){this.#p=!1;let J=this.#g.slice();this.#g.length=0,J.forEach((X)=>X(null,Z))}readdirCB(Z,J=!1){if(!this.canReaddir()){if(J)Z(null,[]);else queueMicrotask(()=>Z(null,[]));return}let X=this.children();if(this.calledReaddir()){let $=X.slice(0,X.provisional);if(J)Z(null,$);else queueMicrotask(()=>Z(null,$));return}if(this.#g.push(Z),this.#p)return;this.#p=!0;let Y=this.fullpath();this.#Z.readdir(Y,{withFileTypes:!0},($,Q)=>{if($)this.#I($.code),X.provisional=0;else{for(let K of Q)this.#h(K,X);this.#m(X)}this.#i(X.slice(0,X.provisional));return})}#l;async readdir(){if(!this.canReaddir())return[];let Z=this.children();if(this.calledReaddir())return Z.slice(0,Z.provisional);let J=this.fullpath();if(this.#l)await this.#l;else{let X=()=>{};this.#l=new Promise((Y)=>X=Y);try{for(let Y of await this.#Z.promises.readdir(J,{withFileTypes:!0}))this.#h(Y,Z);this.#m(Z)}catch(Y){this.#I(Y.code),Z.provisional=0}this.#l=void 0,X()}return Z.slice(0,Z.provisional)}readdirSync(){if(!this.canReaddir())return[];let Z=this.children();if(this.calledReaddir())return Z.slice(0,Z.provisional);let J=this.fullpath();try{for(let X of this.#Z.readdirSync(J,{withFileTypes:!0}))this.#h(X,Z);this.#m(Z)}catch(X){this.#I(X.code),Z.provisional=0}return Z.slice(0,Z.provisional)}canReaddir(){if(this.#K&td)return!1;let Z=w9&this.#K;if(!(Z===B9||Z===o4||Z===sX))return!1;return!0}shouldWalk(Z,J){return(this.#K&o4)===o4&&!(this.#K&td)&&!Z.has(this)&&(!J||J(this))}async realpath(){if(this.#S)return this.#S;if((PU|RU|W4)&this.#K)return;try{let Z=await this.#Z.promises.realpath(this.fullpath());return this.#S=this.resolve(Z)}catch(Z){this.#u()}}realpathSync(){if(this.#S)return this.#S;if((PU|RU|W4)&this.#K)return;try{let Z=this.#Z.realpathSync(this.fullpath());return this.#S=this.resolve(Z)}catch(Z){this.#u()}}[zc](Z){if(Z===this)return;Z.isCWD=!1,this.isCWD=!0;let J=new Set([]),X=[],Y=this;while(Y&&Y.parent)J.add(Y),Y.#B=X.join(this.sep),Y.#v=X.join("/"),Y=Y.parent,X.push("..");Y=Z;while(Y&&Y.parent&&!J.has(Y))Y.#B=void 0,Y.#v=void 0,Y=Y.parent}}class DU extends d6{sep="\\";splitSep=NV1;constructor(Z,J=B9,X,Y,$,Q,K){super(Z,J,X,Y,$,Q,K)}newChild(Z,J=B9,X={}){return new DU(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),X)}getRootString(Z){return qP.parse(Z).root}getRoot(Z){if(Z=RV1(Z.toUpperCase()),Z===this.root.name)return this.root;for(let[J,X]of Object.entries(this.roots))if(this.sameRoot(Z,J))return this.roots[Z]=X;return this.roots[Z]=new rG(Z,this).root}sameRoot(Z,J=this.root.name){return Z=Z.toUpperCase().replace(/\//g,"\\").replace(Xc,"$1\\"),Z===J}}class CU extends d6{splitSep="/";sep="/";constructor(Z,J=B9,X,Y,$,Q,K){super(Z,J,X,Y,$,Q,K)}getRootString(Z){return Z.startsWith("/")?"/":""}getRoot(Z){return this.root}newChild(Z,J=B9,X={}){return new CU(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),X)}}class UP{root;rootPath;roots;cwd;#Z;#J;#Y;nocase;#X;constructor(Z=process.cwd(),J,X,{nocase:Y,childrenCacheSize:$=16384,fs:Q=aG}={}){if(this.#X=Jc(Q),Z instanceof URL||Z.startsWith("file://"))Z=zV1(Z);let K=J.resolve(Z);this.roots=Object.create(null),this.rootPath=this.parseRootPath(K),this.#Z=new FP,this.#J=new FP,this.#Y=new Gc($);let W=K.substring(this.rootPath.length).split(X);if(W.length===1&&!W[0])W.pop();if(Y===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=Y,this.root=this.newRoot(this.#X),this.roots[this.rootPath]=this.root;let G=this.root,z=W.length-1,V=J.sep,H=this.rootPath,q=!1;for(let F of W){let U=z--;G=G.child(F,{relative:new Array(U).fill("..").join(V),relativePosix:new Array(U).fill("..").join("/"),fullpath:H+=(q?"":V)+F}),q=!0}this.cwd=G}depth(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.depth()}childrenCache(){return this.#Y}resolve(...Z){let J="";for(let $=Z.length-1;$>=0;$--){let Q=Z[$];if(!Q||Q===".")continue;if(J=J?`${Q}/${J}`:Q,this.isAbsolute(Q))break}let X=this.#Z.get(J);if(X!==void 0)return X;let Y=this.cwd.resolve(J).fullpath();return this.#Z.set(J,Y),Y}resolvePosix(...Z){let J="";for(let $=Z.length-1;$>=0;$--){let Q=Z[$];if(!Q||Q===".")continue;if(J=J?`${Q}/${J}`:Q,this.isAbsolute(Q))break}let X=this.#J.get(J);if(X!==void 0)return X;let Y=this.cwd.resolve(J).fullpathPosix();return this.#J.set(J,Y),Y}relative(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.relative()}relativePosix(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.relativePosix()}basename(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.name}dirname(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return(Z.parent||Z).fullpath()}async readdir(Z=this.cwd,J={withFileTypes:!0}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;let{withFileTypes:X}=J;if(!Z.canReaddir())return[];else{let Y=await Z.readdir();return X?Y:Y.map(($)=>$.name)}}readdirSync(Z=this.cwd,J={withFileTypes:!0}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;let{withFileTypes:X=!0}=J;if(!Z.canReaddir())return[];else if(X)return Z.readdirSync();else return Z.readdirSync().map((Y)=>Y.name)}async lstat(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.lstat()}lstatSync(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.lstatSync()}async readlink(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z.withFileTypes,Z=this.cwd;let X=await Z.readlink();return J?X:X?.fullpath()}readlinkSync(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z.withFileTypes,Z=this.cwd;let X=Z.readlinkSync();return J?X:X?.fullpath()}async realpath(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z.withFileTypes,Z=this.cwd;let X=await Z.realpath();return J?X:X?.fullpath()}realpathSync(Z=this.cwd,{withFileTypes:J}={withFileTypes:!1}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z.withFileTypes,Z=this.cwd;let X=Z.realpathSync();return J?X:X?.fullpath()}async walk(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,K=[];if(!$||$(Z))K.push(X?Z:Z.fullpath());let W=new Set,G=(V,H)=>{W.add(V),V.readdirCB((q,F)=>{if(q)return H(q);let U=F.length;if(!U)return H();let w=()=>{if(--U===0)H()};for(let L of F){if(!$||$(L))K.push(X?L:L.fullpath());if(Y&&L.isSymbolicLink())L.realpath().then((j)=>j?.isUnknown()?j.lstat():j).then((j)=>j?.shouldWalk(W,Q)?G(j,w):w());else if(L.shouldWalk(W,Q))G(L,w);else w()}},!0)},z=Z;return new Promise((V,H)=>{G(z,(q)=>{if(q)return H(q);V(K)})})}walkSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,K=[];if(!$||$(Z))K.push(X?Z:Z.fullpath());let W=new Set([Z]);for(let G of W){let z=G.readdirSync();for(let V of z){if(!$||$(V))K.push(X?V:V.fullpath());let H=V;if(V.isSymbolicLink()){if(!(Y&&(H=V.realpathSync())))continue;if(H.isUnknown())H.lstatSync()}if(H.shouldWalk(W,Q))W.add(H)}}return K}[Symbol.asyncIterator](){return this.iterate()}iterate(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;return this.stream(Z,J)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J;if(!$||$(Z))yield X?Z:Z.fullpath();let K=new Set([Z]);for(let W of K){let G=W.readdirSync();for(let z of G){if(!$||$(z))yield X?z:z.fullpath();let V=z;if(z.isSymbolicLink()){if(!(Y&&(V=z.realpathSync())))continue;if(V.isUnknown())V.lstatSync()}if(V.shouldWalk(K,Q))K.add(V)}}}stream(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,K=new aX({objectMode:!0});if(!$||$(Z))K.write(X?Z:Z.fullpath());let W=new Set,G=[Z],z=0,V=()=>{let H=!1;while(!H){let q=G.shift();if(!q){if(z===0)K.end();return}z++,W.add(q);let F=(w,L,j=!1)=>{if(w)return K.emit("error",w);if(Y&&!j){let R=[];for(let O of L)if(O.isSymbolicLink())R.push(O.realpath().then((N)=>N?.isUnknown()?N.lstat():N));if(R.length){Promise.all(R).then(()=>F(null,L,!0));return}}for(let R of L)if(R&&(!$||$(R))){if(!K.write(X?R:R.fullpath()))H=!0}z--;for(let R of L){let O=R.realpathCached()||R;if(O.shouldWalk(W,Q))G.push(O)}if(H&&!K.flowing)K.once("drain",V);else if(!U)V()},U=!0;q.readdirCB(F,!0),U=!1}};return V(),K}streamSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof d6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,K=new aX({objectMode:!0}),W=new Set;if(!$||$(Z))K.write(X?Z:Z.fullpath());let G=[Z],z=0,V=()=>{let H=!1;while(!H){let q=G.shift();if(!q){if(z===0)K.end();return}z++,W.add(q);let F=q.readdirSync();for(let U of F)if(!$||$(U)){if(!K.write(X?U:U.fullpath()))H=!0}z--;for(let U of F){let w=U;if(U.isSymbolicLink()){if(!(Y&&(w=U.realpathSync())))continue;if(w.isUnknown())w.lstatSync()}if(w.shouldWalk(W,Q))G.push(w)}}if(H&&!K.flowing)K.once("drain",V)};return V(),K}chdir(Z=this.cwd){let J=this.cwd;this.cwd=typeof Z==="string"?this.cwd.resolve(Z):Z,this.cwd[zc](J)}}class rG extends UP{sep="\\";constructor(Z=process.cwd(),J={}){let{nocase:X=!0}=J;super(Z,qP,"\\",{...J,nocase:X});this.nocase=X;for(let Y=this.cwd;Y;Y=Y.parent)Y.nocase=this.nocase}parseRootPath(Z){return qP.parse(Z).root.toUpperCase()}newRoot(Z){return new DU(this.rootPath,o4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")||Z.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Z)}}class tG extends UP{sep="/";constructor(Z=process.cwd(),J={}){let{nocase:X=!1}=J;super(Z,GV1,"/",{...J,nocase:X});this.nocase=X}parseRootPath(Z){return"/"}newRoot(Z){return new CU(this.rootPath,o4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")}}class TU extends tG{constructor(Z=process.cwd(),J={}){let{nocase:X=!0}=J;super(Z,{...J,nocase:X})}}var $36=process.platform==="win32"?DU:CU,Vc=process.platform==="win32"?rG:process.platform==="darwin"?TU:tG;var DV1=(Z)=>Z.length>=1,CV1=(Z)=>Z.length>=1;class DQ{#Z;#J;#Y;length;#X;#$;#V;#q;#W;#G;#z=!0;constructor(Z,J,X,Y){if(!DV1(Z))throw new TypeError("empty pattern list");if(!CV1(J))throw new TypeError("empty glob list");if(J.length!==Z.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=Z.length,X<0||X>=this.length)throw new TypeError("index out of range");if(this.#Z=Z,this.#J=J,this.#Y=X,this.#X=Y,this.#Y===0){if(this.isUNC()){let[$,Q,K,W,...G]=this.#Z,[z,V,H,q,...F]=this.#J;if(G[0]==="")G.shift(),F.shift();let U=[$,Q,K,W,""].join("/"),w=[z,V,H,q,""].join("/");this.#Z=[U,...G],this.#J=[w,...F],this.length=this.#Z.length}else if(this.isDrive()||this.isAbsolute()){let[$,...Q]=this.#Z,[K,...W]=this.#J;if(Q[0]==="")Q.shift(),W.shift();let G=$+"/",z=K+"/";this.#Z=[G,...Q],this.#J=[z,...W],this.length=this.#Z.length}}}pattern(){return this.#Z[this.#Y]}isString(){return typeof this.#Z[this.#Y]==="string"}isGlobstar(){return this.#Z[this.#Y]===L6}isRegExp(){return this.#Z[this.#Y]instanceof RegExp}globString(){return this.#V=this.#V||(this.#Y===0?this.isAbsolute()?this.#J[0]+this.#J.slice(1).join("/"):this.#J.join("/"):this.#J.slice(this.#Y).join("/"))}hasMore(){return this.length>this.#Y+1}rest(){if(this.#$!==void 0)return this.#$;if(!this.hasMore())return this.#$=null;return this.#$=new DQ(this.#Z,this.#J,this.#Y+1,this.#X),this.#$.#G=this.#G,this.#$.#W=this.#W,this.#$.#q=this.#q,this.#$}isUNC(){let Z=this.#Z;return this.#W!==void 0?this.#W:this.#W=this.#X==="win32"&&this.#Y===0&&Z[0]===""&&Z[1]===""&&typeof Z[2]==="string"&&!!Z[2]&&typeof Z[3]==="string"&&!!Z[3]}isDrive(){let Z=this.#Z;return this.#q!==void 0?this.#q:this.#q=this.#X==="win32"&&this.#Y===0&&this.length>1&&typeof Z[0]==="string"&&/^[a-z]:$/i.test(Z[0])}isAbsolute(){let Z=this.#Z;return this.#G!==void 0?this.#G:this.#G=Z[0]===""&&Z.length>1||this.isDrive()||this.isUNC()}root(){let Z=this.#Z[0];return typeof Z==="string"&&this.isAbsolute()&&this.#Y===0?Z:""}checkFollowGlobstar(){return!(this.#Y===0||!this.isGlobstar()||!this.#z)}markFollowGlobstar(){if(this.#Y===0||!this.isGlobstar()||!this.#z)return!1;return this.#z=!1,!0}}var TV1=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class eG{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Z,{nobrace:J,nocase:X,noext:Y,noglobstar:$,platform:Q=TV1}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=Q,this.mmopts={dot:!0,nobrace:J,nocase:X,noext:Y,noglobstar:$,optimizationLevel:2,platform:Q,nocomment:!0,nonegate:!0};for(let K of Z)this.add(K)}add(Z){let J=new L9(Z,this.mmopts);for(let X=0;X<J.set.length;X++){let Y=J.set[X],$=J.globParts[X];if(!Y||!$)throw new Error("invalid pattern object");while(Y[0]==="."&&$[0]===".")Y.shift(),$.shift();let Q=new DQ(Y,$,0,this.platform),K=new L9(Q.globString(),this.mmopts),W=$[$.length-1]==="**",G=Q.isAbsolute();if(G)this.absolute.push(K);else this.relative.push(K);if(W)if(G)this.absoluteChildren.push(K);else this.relativeChildren.push(K)}}ignored(Z){let J=Z.fullpath(),X=`${J}/`,Y=Z.relative()||".",$=`${Y}/`;for(let Q of this.relative)if(Q.match(Y)||Q.match($))return!0;for(let Q of this.absolute)if(Q.match(J)||Q.match(X))return!0;return!1}childrenIgnored(Z){let J=Z.fullpath()+"/",X=(Z.relative()||".")+"/";for(let Y of this.relativeChildren)if(Y.match(X))return!0;for(let Y of this.absoluteChildren)if(Y.match(J))return!0;return!1}}class LP{store;constructor(Z=new Map){this.store=Z}copy(){return new LP(new Map(this.store))}hasWalked(Z,J){return this.store.get(Z.fullpath())?.has(J.globString())}storeWalked(Z,J){let X=Z.fullpath(),Y=this.store.get(X);if(Y)Y.add(J.globString());else this.store.set(X,new Set([J.globString()]))}}class Hc{store=new Map;add(Z,J,X){let Y=(J?2:0)|(X?1:0),$=this.store.get(Z);this.store.set(Z,$===void 0?Y:Y&$)}entries(){return[...this.store.entries()].map(([Z,J])=>[Z,!!(J&2),!!(J&1)])}}class qc{store=new Map;add(Z,J){if(!Z.canReaddir())return;let X=this.store.get(Z);if(X){if(!X.find((Y)=>Y.globString()===J.globString()))X.push(J)}else this.store.set(Z,[J])}get(Z){let J=this.store.get(Z);if(!J)throw new Error("attempting to walk unknown path");return J}entries(){return this.keys().map((Z)=>[Z,this.store.get(Z)])}keys(){return[...this.store.keys()].filter((Z)=>Z.canReaddir())}}class Z3{hasWalkedCache;matches=new Hc;subwalks=new qc;patterns;follow;dot;opts;constructor(Z,J){this.opts=Z,this.follow=!!Z.follow,this.dot=!!Z.dot,this.hasWalkedCache=J?J.copy():new LP}processPatterns(Z,J){this.patterns=J;let X=J.map((Y)=>[Z,Y]);for(let[Y,$]of X){this.hasWalkedCache.storeWalked(Y,$);let Q=$.root(),K=$.isAbsolute()&&this.opts.absolute!==!1;if(Q){Y=Y.resolve(Q==="/"&&this.opts.root!==void 0?this.opts.root:Q);let V=$.rest();if(!V){this.matches.add(Y,!0,!1);continue}else $=V}if(Y.isENOENT())continue;let W,G,z=!1;while(typeof(W=$.pattern())==="string"&&(G=$.rest()))Y=Y.resolve(W),$=G,z=!0;if(W=$.pattern(),G=$.rest(),z){if(this.hasWalkedCache.hasWalked(Y,$))continue;this.hasWalkedCache.storeWalked(Y,$)}if(typeof W==="string"){let V=W===".."||W===""||W===".";this.matches.add(Y.resolve(W),K,V);continue}else if(W===L6){if(!Y.isSymbolicLink()||this.follow||$.checkFollowGlobstar())this.subwalks.add(Y,$);let V=G?.pattern(),H=G?.rest();if(!G||(V===""||V===".")&&!H)this.matches.add(Y,K,V===""||V===".");else if(V===".."){let q=Y.parent||Y;if(!H)this.matches.add(q,K,!0);else if(!this.hasWalkedCache.hasWalked(q,H))this.subwalks.add(q,H)}}else if(W instanceof RegExp)this.subwalks.add(Y,$)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new Z3(this.opts,this.hasWalkedCache)}filterEntries(Z,J){let X=this.subwalks.get(Z),Y=this.child();for(let $ of J)for(let Q of X){let K=Q.isAbsolute(),W=Q.pattern(),G=Q.rest();if(W===L6)Y.testGlobstar($,Q,G,K);else if(W instanceof RegExp)Y.testRegExp($,W,G,K);else Y.testString($,W,G,K)}return Y}testGlobstar(Z,J,X,Y){if(this.dot||!Z.name.startsWith(".")){if(!J.hasMore())this.matches.add(Z,Y,!1);if(Z.canReaddir()){if(this.follow||!Z.isSymbolicLink())this.subwalks.add(Z,J);else if(Z.isSymbolicLink()){if(X&&J.checkFollowGlobstar())this.subwalks.add(Z,X);else if(J.markFollowGlobstar())this.subwalks.add(Z,J)}}}if(X){let $=X.pattern();if(typeof $==="string"&&$!==".."&&$!==""&&$!==".")this.testString(Z,$,X.rest(),Y);else if($===".."){let Q=Z.parent||Z;this.subwalks.add(Q,X)}else if($ instanceof RegExp)this.testRegExp(Z,$,X.rest(),Y)}}testRegExp(Z,J,X,Y){if(!J.test(Z.name))return;if(!X)this.matches.add(Z,Y,!1);else this.subwalks.add(Z,X)}testString(Z,J,X,Y){if(!Z.isNamed(J))return;if(!X)this.matches.add(Z,Y,!1);else this.subwalks.add(Z,X)}}var kV1=(Z,J)=>typeof Z==="string"?new eG([Z],J):Array.isArray(Z)?new eG(Z,J):Z;class wP{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#Z=[];#J;#Y;signal;maxDepth;includeChildMatches;constructor(Z,J,X){if(this.patterns=Z,this.path=J,this.opts=X,this.#Y=!X.posix&&X.platform==="win32"?"\\":"/",this.includeChildMatches=X.includeChildMatches!==!1,X.ignore||!this.includeChildMatches){if(this.#J=kV1(X.ignore??[],X),!this.includeChildMatches&&typeof this.#J.add!=="function")throw new Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=X.maxDepth||1/0,X.signal)this.signal=X.signal,this.signal.addEventListener("abort",()=>{this.#Z.length=0})}#X(Z){return this.seen.has(Z)||!!this.#J?.ignored?.(Z)}#$(Z){return!!this.#J?.childrenIgnored?.(Z)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let Z=void 0;while(!this.paused&&(Z=this.#Z.shift()))Z()}onResume(Z){if(this.signal?.aborted)return;if(!this.paused)Z();else this.#Z.push(Z)}async matchCheck(Z,J){if(J&&this.opts.nodir)return;let X;if(this.opts.realpath){if(X=Z.realpathCached()||await Z.realpath(),!X)return;Z=X}let $=Z.isUnknown()||this.opts.stat?await Z.lstat():Z;if(this.opts.follow&&this.opts.nodir&&$?.isSymbolicLink()){let Q=await $.realpath();if(Q&&(Q.isUnknown()||this.opts.stat))await Q.lstat()}return this.matchCheckTest($,J)}matchCheckTest(Z,J){return Z&&(this.maxDepth===1/0||Z.depth()<=this.maxDepth)&&(!J||Z.canReaddir())&&(!this.opts.nodir||!Z.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!Z.isSymbolicLink()||!Z.realpathCached()?.isDirectory())&&!this.#X(Z)?Z:void 0}matchCheckSync(Z,J){if(J&&this.opts.nodir)return;let X;if(this.opts.realpath){if(X=Z.realpathCached()||Z.realpathSync(),!X)return;Z=X}let $=Z.isUnknown()||this.opts.stat?Z.lstatSync():Z;if(this.opts.follow&&this.opts.nodir&&$?.isSymbolicLink()){let Q=$.realpathSync();if(Q&&(Q?.isUnknown()||this.opts.stat))Q.lstatSync()}return this.matchCheckTest($,J)}matchFinish(Z,J){if(this.#X(Z))return;if(!this.includeChildMatches&&this.#J?.add){let $=`${Z.relativePosix()}/**`;this.#J.add($)}let X=this.opts.absolute===void 0?J:this.opts.absolute;this.seen.add(Z);let Y=this.opts.mark&&Z.isDirectory()?this.#Y:"";if(this.opts.withFileTypes)this.matchEmit(Z);else if(X){let $=this.opts.posix?Z.fullpathPosix():Z.fullpath();this.matchEmit($+Y)}else{let $=this.opts.posix?Z.relativePosix():Z.relative(),Q=this.opts.dotRelative&&!$.startsWith(".."+this.#Y)?"."+this.#Y:"";this.matchEmit(!$?"."+Y:Q+$+Y)}}async match(Z,J,X){let Y=await this.matchCheck(Z,X);if(Y)this.matchFinish(Y,J)}matchSync(Z,J,X){let Y=this.matchCheckSync(Z,X);if(Y)this.matchFinish(Y,J)}walkCB(Z,J,X){if(this.signal?.aborted)X();this.walkCB2(Z,J,new Z3(this.opts),X)}walkCB2(Z,J,X,Y){if(this.#$(Z))return Y();if(this.signal?.aborted)Y();if(this.paused){this.onResume(()=>this.walkCB2(Z,J,X,Y));return}X.processPatterns(Z,J);let $=1,Q=()=>{if(--$===0)Y()};for(let[K,W,G]of X.matches.entries()){if(this.#X(K))continue;$++,this.match(K,W,G).then(()=>Q())}for(let K of X.subwalkTargets()){if(this.maxDepth!==1/0&&K.depth()>=this.maxDepth)continue;$++;let W=K.readdirCached();if(K.calledReaddir())this.walkCB3(K,W,X,Q);else K.readdirCB((G,z)=>this.walkCB3(K,z,X,Q),!0)}Q()}walkCB3(Z,J,X,Y){X=X.filterEntries(Z,J);let $=1,Q=()=>{if(--$===0)Y()};for(let[K,W,G]of X.matches.entries()){if(this.#X(K))continue;$++,this.match(K,W,G).then(()=>Q())}for(let[K,W]of X.subwalks.entries())$++,this.walkCB2(K,W,X.child(),Q);Q()}walkCBSync(Z,J,X){if(this.signal?.aborted)X();this.walkCB2Sync(Z,J,new Z3(this.opts),X)}walkCB2Sync(Z,J,X,Y){if(this.#$(Z))return Y();if(this.signal?.aborted)Y();if(this.paused){this.onResume(()=>this.walkCB2Sync(Z,J,X,Y));return}X.processPatterns(Z,J);let $=1,Q=()=>{if(--$===0)Y()};for(let[K,W,G]of X.matches.entries()){if(this.#X(K))continue;this.matchSync(K,W,G)}for(let K of X.subwalkTargets()){if(this.maxDepth!==1/0&&K.depth()>=this.maxDepth)continue;$++;let W=K.readdirSync();this.walkCB3Sync(K,W,X,Q)}Q()}walkCB3Sync(Z,J,X,Y){X=X.filterEntries(Z,J);let $=1,Q=()=>{if(--$===0)Y()};for(let[K,W,G]of X.matches.entries()){if(this.#X(K))continue;this.matchSync(K,W,G)}for(let[K,W]of X.subwalks.entries())$++,this.walkCB2Sync(K,W,X.child(),Q);Q()}}class kU extends wP{matches=new Set;constructor(Z,J,X){super(Z,J,X)}matchEmit(Z){this.matches.add(Z)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((Z,J)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)J(this.signal.reason);else Z(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class EU extends wP{results;constructor(Z,J,X){super(Z,J,X);this.results=new aX({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(Z){if(this.results.write(Z),!this.results.flowing)this.pause()}stream(){let Z=this.path;if(Z.isUnknown())Z.lstat().then(()=>{this.walkCB(Z,this.patterns,()=>this.results.end())});else this.walkCB(Z,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var IV1=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class r4{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(Z,J){if(!J)throw new TypeError("glob options required");if(this.withFileTypes=!!J.withFileTypes,this.signal=J.signal,this.follow=!!J.follow,this.dot=!!J.dot,this.dotRelative=!!J.dotRelative,this.nodir=!!J.nodir,this.mark=!!J.mark,!J.cwd)this.cwd="";else if(J.cwd instanceof URL||J.cwd.startsWith("file://"))J.cwd=EV1(J.cwd);if(this.cwd=J.cwd||"",this.root=J.root,this.magicalBraces=!!J.magicalBraces,this.nobrace=!!J.nobrace,this.noext=!!J.noext,this.realpath=!!J.realpath,this.absolute=J.absolute,this.includeChildMatches=J.includeChildMatches!==!1,this.noglobstar=!!J.noglobstar,this.matchBase=!!J.matchBase,this.maxDepth=typeof J.maxDepth==="number"?J.maxDepth:1/0,this.stat=!!J.stat,this.ignore=J.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof Z==="string")Z=[Z];if(this.windowsPathsNoEscape=!!J.windowsPathsNoEscape||J.allowWindowsEscape===!1,this.windowsPathsNoEscape)Z=Z.map((W)=>W.replace(/\\/g,"/"));if(this.matchBase){if(J.noglobstar)throw new TypeError("base matching requires globstar");Z=Z.map((W)=>W.includes("/")?W:`./**/${W}`)}if(this.pattern=Z,this.platform=J.platform||IV1,this.opts={...J,platform:this.platform},J.scurry){if(this.scurry=J.scurry,J.nocase!==void 0&&J.nocase!==J.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let W=J.platform==="win32"?rG:J.platform==="darwin"?TU:J.platform?tG:Vc;this.scurry=new W(this.cwd,{nocase:J.nocase,fs:J.fs})}this.nocase=this.scurry.nocase;let X=this.platform==="darwin"||this.platform==="win32",Y={...J,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:X,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},$=this.pattern.map((W)=>new L9(W,Y)),[Q,K]=$.reduce((W,G)=>{return W[0].push(...G.set),W[1].push(...G.globParts),W},[[],[]]);this.patterns=Q.map((W,G)=>{let z=K[G];if(!z)throw new Error("invalid pattern object");return new DQ(W,z,0,this.platform)})}async walk(){return[...await new kU(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new kU(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new EU(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new EU(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}var BP=(Z,J={})=>{if(!Array.isArray(Z))Z=[Z];for(let X of Z)if(new L9(X,J).hasMagic())return!0;return!1};function vU(Z,J={}){return new r4(Z,J).streamSync()}function Uc(Z,J={}){return new r4(Z,J).stream()}function Lc(Z,J={}){return new r4(Z,J).walkSync()}async function Fc(Z,J={}){return new r4(Z,J).walk()}function SU(Z,J={}){return new r4(Z,J).iterateSync()}function wc(Z,J={}){return new r4(Z,J).iterate()}var vV1=vU,SV1=Object.assign(Uc,{sync:vU}),_V1=SU,AV1=Object.assign(wc,{sync:SU}),xV1=Object.assign(Lc,{stream:vU,iterate:SU}),IU=Object.assign(Fc,{glob:Fc,globSync:Lc,sync:xV1,globStream:Uc,stream:SV1,globStreamSync:vU,streamSync:vV1,globIterate:wc,iterate:AV1,globIterateSync:SU,iterateSync:_V1,Glob:r4,hasMagic:BP,escape:OQ,unescape:Q4});IU.glob=IU;class jP{constructor(){this._listeners={}}addEventListener(Z,J){let X=this._listeners;if(X[Z]===void 0)X[Z]=[];if(X[Z].indexOf(J)===-1)X[Z].push(J);return this}removeEventListener(Z,J){let Y=this._listeners[Z];if(Y!==void 0){let $=Y.indexOf(J);if($!==-1)Y.splice($,1)}return this}dispatchEvent(Z){let X=this._listeners[Z.type];if(X!==void 0){let Y=X.slice(0);for(let $=0,Q=Y.length;$<Q;$++)Y[$].call(this,Z)}return this}dispose(){for(let Z in this._listeners)delete this._listeners[Z]}}class w5{constructor(Z,J,X,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=X,this._attributes=Y,!J.isOnGraph(X))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 CQ extends jP{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 X of this.listParentEdges(Z))J.add(X.getParent());return Array.from(J)}listChildEdges(Z){return Array.from(this._parentEdges.get(Z)||this._emptySet)}listChildren(Z){let J=new Set;for(let X of this.listChildEdges(Z))J.add(X.getChild());return Array.from(J)}disconnectParents(Z,J){for(let X of this.listParentEdges(Z))if(!J||J(X.getParent()))X.dispose();return this}_createEdge(Z,J,X,Y){let $=new w5(Z,J,X,Y);this._edges.add($);let Q=$.getParent();if(!this._parentEdges.has(Q))this._parentEdges.set(Q,new Set);this._parentEdges.get(Q).add($);let K=$.getChild();if(!this._childEdges.has(K))this._childEdges.set(K,new Set);return this._childEdges.get(K).add($),$}_destroyEdge(Z){return this._edges.delete(Z),this._parentEdges.get(Z.getParent()).delete(Z),this._childEdges.get(Z.getChild()).delete(Z),this}}function J3(){return J3=Object.assign||function(Z){for(var J=1;J<arguments.length;J++){var X=arguments[J];for(var Y in X)if(Object.prototype.hasOwnProperty.call(X,Y))Z[Y]=X[Y]}return Z},J3.apply(this,arguments)}class D6{constructor(Z){if(this.list=[],Z)for(let J of Z)this.list.push(J)}add(Z){this.list.push(Z)}remove(Z){let J=this.list.indexOf(Z);if(J>=0)this.list.splice(J,1)}removeChild(Z){let J=[];for(let X of this.list)if(X.getChild()===Z)J.push(X);for(let X of J)this.remove(X);return J}listRefsByChild(Z){let J=[];for(let X of this.list)if(X.getChild()===Z)J.push(X);return J}values(){return this.list}}class N0{constructor(Z){if(this.set=new Set,this.map=new Map,Z)for(let J of Z)this.add(J)}add(Z){let J=Z.getChild();this.removeChild(J),this.set.add(Z),this.map.set(J,Z)}remove(Z){this.set.delete(Z),this.map.delete(Z.getChild())}removeChild(Z){let J=this.map.get(Z)||null;if(J)this.remove(J);return J}getRefByChild(Z){return this.map.get(Z)||null}values(){return Array.from(this.set)}}class r1{constructor(Z){if(this.map={},Z)Object.assign(this.map,Z)}set(Z,J){this.map[Z]=J}delete(Z){delete this.map[Z]}get(Z){return this.map[Z]||null}keys(){return Object.keys(this.map)}values(){return Object.values(this.map)}}var A0=Symbol("attributes"),G4=Symbol("immutableKeys");class TQ extends jP{constructor(Z){super();this._disposed=!1,this.graph=void 0,this[A0]=void 0,this[G4]=void 0,this.graph=Z,this[G4]=new Set,this[A0]=this._createAttributes()}getDefaults(){return{}}_createAttributes(){let Z=this.getDefaults(),J={};for(let X in Z){let Y=Z[X];if(Y instanceof TQ){let $=this.graph._createEdge(X,this,Y);this[G4].add(X),J[X]=$}else J[X]=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 X in this[A0]){let Y=this[A0][X];if(Y instanceof w5){let $=Y;if($.getChild()===Z)this.setRef(X,J,$.getAttributes())}else if(Y instanceof D6)for(let $ of Y.listRefsByChild(Z)){let Q=$.getAttributes();this.removeRef(X,Z),this.addRef(X,J,Q)}else if(Y instanceof N0){let $=Y.getRefByChild(Z);if($){let Q=$.getAttributes();this.removeRef(X,Z),this.addRef(X,J,Q)}}else if(Y instanceof r1)for(let $ of Y.keys()){let Q=Y.get($);if(Q.getChild()===Z)this.setRefMap(X,$,J,Q.getAttributes())}}return this}get(Z){return this[A0][Z]}set(Z,J){return this[A0][Z]=J,this.dispatchEvent({type:"change",attribute:Z})}getRef(Z){let J=this[A0][Z];return J?J.getChild():null}setRef(Z,J,X){if(this[G4].has(Z))throw new Error(`Cannot overwrite immutable attribute, "${Z}".`);let Y=this[A0][Z];if(Y)Y.dispose();if(!J)return this;let $=this.graph._createEdge(Z,this,J,X);return this[A0][Z]=$,this.dispatchEvent({type:"change",attribute:Z})}listRefs(Z){return this.assertRefList(Z).values().map((X)=>X.getChild())}addRef(Z,J,X){let Y=this.graph._createEdge(Z,this,J,X);return this.assertRefList(Z).add(Y),this.dispatchEvent({type:"change",attribute:Z})}removeRef(Z,J){let X=this.assertRefList(Z);if(X instanceof D6)for(let Y of X.listRefsByChild(J))Y.dispose();else{let Y=X.getRefByChild(J);if(Y)Y.dispose()}return this}assertRefList(Z){let J=this[A0][Z];if(J instanceof D6||J instanceof N0)return J;throw new Error(`Expected RefList or RefSet for attribute "${Z}"`)}listRefMapKeys(Z){return this.assertRefMap(Z).keys()}listRefMapValues(Z){return this.assertRefMap(Z).values().map((J)=>J.getChild())}getRefMap(Z,J){let Y=this.assertRefMap(Z).get(J);return Y?Y.getChild():null}setRefMap(Z,J,X,Y){let $=this.assertRefMap(Z),Q=$.get(J);if(Q)Q.dispose();if(!X)return this;Y=Object.assign(Y||{},{key:J});let K=this.graph._createEdge(Z,this,X,J3({},Y,{key:J}));return $.set(J,K),this.dispatchEvent({type:"change",attribute:Z,key:J})}assertRefMap(Z){let J=this[A0][Z];if(J instanceof r1)return J;throw new Error(`Expected RefMap for attribute "${Z}"`)}dispatchEvent(Z){return super.dispatchEvent(J3({},Z,{target:this})),this.graph.dispatchEvent(J3({},Z,{target:this,type:`node:${Z.type}`})),this}_destroyRef(Z){let J=Z.getName();if(this[A0][J]===Z){if(this[A0][J]=null,this[G4].has(J))Z.getChild().dispose()}else if(this[A0][J]instanceof D6)this[A0][J].remove(Z);else if(this[A0][J]instanceof N0)this[A0][J].remove(Z);else if(this[A0][J]instanceof r1){let X=this[A0][J];for(let Y of X.keys())if(X.get(Y)===Z)X.delete(Y)}else return;this.graph._destroyEdge(Z),this.dispatchEvent({type:"change",attribute:J})}}var Pc="v4.1.1",bU="@glb.bin",a;(function(Z){Z.ACCESSOR="Accessor",Z.ANIMATION="Animation",Z.ANIMATION_CHANNEL="AnimationChannel",Z.ANIMATION_SAMPLER="AnimationSampler",Z.BUFFER="Buffer",Z.CAMERA="Camera",Z.MATERIAL="Material",Z.MESH="Mesh",Z.PRIMITIVE="Primitive",Z.PRIMITIVE_TARGET="PrimitiveTarget",Z.NODE="Node",Z.ROOT="Root",Z.SCENE="Scene",Z.SKIN="Skin",Z.TEXTURE="Texture",Z.TEXTURE_INFO="TextureInfo"})(a||(a={}));var yU;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(yU||(yU={}));var d5;(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"})(d5||(d5={}));var gU;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(gU||(gU={}));var $Z;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})($Z||($Z={}));var GJ={"5120":Int8Array,"5121":Uint8Array,"5122":Int16Array,"5123":Uint16Array,"5125":Uint32Array,"5126":Float32Array},MP=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 hV1(){var Z=new MP(3);if(MP!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function OP(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function fV1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=X[3]*Y+X[7]*$+X[11]*Q+X[15];return K=K||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/K,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/K,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/K,Z}(function(){var Z=hV1();return function(J,X,Y,$,Q,K){var W,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(W=Y;W<G;W+=X)Z[0]=J[W],Z[1]=J[W+1],Z[2]=J[W+2],Q(Z,Z,K),J[W]=Z[0],J[W+1]=Z[1],J[W+2]=Z[2];return J}})();function DP(Z){let J=Dc(),X=Z.propertyType===a.NODE?[Z]:Z.listChildren();for(let Y of X)Y.traverse(($)=>{let Q=$.getMesh();if(!Q)return;let K=bV1(Q,$.getWorldMatrix());if(K.min.every(isFinite)&&K.max.every(isFinite))RP(K.min,J),RP(K.max,J)});return J}function bV1(Z,J){let X=Dc();for(let Y of Z.listPrimitives()){let $=Y.getAttribute("POSITION"),Q=Y.getIndices();if(!$)continue;let K=[0,0,0],W=[0,0,0];for(let G=0,z=Q?Q.getCount():$.getCount();G<z;G++){let V=Q?Q.getScalar(G):G;K=$.getElement(V,K),W=fV1(W,K,J),RP(W,X)}}return X}function RP(Z,J){for(let X=0;X<3;X++)J.min[X]=Math.min(Z[X],J.min[X]),J.max[X]=Math.max(Z[X],J.max[X])}function Dc(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class n0{static createBufferFromDataURI(Z){if(typeof Buffer==="undefined"){let J=atob(Z.split(",")[1]),X=new Uint8Array(J.length);for(let Y=0;Y<J.length;Y++)X[Y]=J.charCodeAt(Y);return X}else{let J=Z.split(",")[1],X=Z.indexOf("base64")>=0;return Buffer.from(J,X?"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 $ of Z)J+=$.byteLength;let X=new Uint8Array(J),Y=0;for(let $ of Z)X.set($,Y),Y+=$.byteLength;return X}static pad(Z,J=0){let X=this.padNumber(Z.byteLength);if(X===Z.byteLength)return Z;let Y=new Uint8Array(X);if(Y.set(Z),J!==0)for(let $=Z.byteLength;$<X;$++)Y[$]=J;return Y}static padNumber(Z){return Math.ceil(Z/4)*4}static equals(Z,J){if(Z===J)return!0;if(Z.byteLength!==J.byteLength)return!1;let X=Z.byteLength;while(X--)if(Z[X]!==J[X])return!1;return!0}static toView(Z,J=0,X=1/0){return new Uint8Array(Z.buffer,Z.byteOffset+J,Math.min(Z.byteLength,X))}static assertView(Z){if(Z&&!ArrayBuffer.isView(Z))throw new Error(`Method requires Uint8Array parameter; received "${typeof Z}".`);return Z}}class CP{static hexToFactor(Z,J){Z=Math.floor(Z);let X=J;return X[0]=(Z>>16&255)/255,X[1]=(Z>>8&255)/255,X[2]=(Z&255)/255,this.convertSRGBToLinear(J,J)}static factorToHex(Z){let J=[...Z],[X,Y,$]=this.convertLinearToSRGB(Z,J);return X*255<<16^Y*255<<8^$*255<<0}static convertSRGBToLinear(Z,J){let X=Z,Y=J;for(let $=0;$<3;$++)Y[$]=X[$]<0.04045?X[$]*0.0773993808:Math.pow(X[$]*0.9478672986+0.0521327014,2.4);return J}static convertLinearToSRGB(Z,J){let X=Z,Y=J;for(let $=0;$<3;$++)Y[$]=X[$]<0.0031308?X[$]*12.92:1.055*Math.pow(X[$],0.41666)-0.055;return J}}class Cc{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),X,Y;while(J.byteLength){if(X=J.getUint16(0,!1),yV1(J,X),Y=J.getUint8(X+1),Y===192||Y===193||Y===194)return[J.getUint16(X+7,!1),J.getUint16(X+5,!1)];J=new DataView(Z.buffer,J.byteOffset+X+2)}throw new TypeError("Invalid JPG, no size found")}getChannels(Z){return 3}}class dU{match(Z){return Z.length>=8&&Z[0]===137&&Z[1]===80&&Z[2]===78&&Z[3]===71&&Z[4]===13&&Z[5]===10&&Z[6]===26&&Z[7]===10}getSize(Z){let J=new DataView(Z.buffer,Z.byteOffset);if(n0.decodeText(Z.slice(12,16))===dU.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}}dU.PNG_FRIED_CHUNK_NAME="CgBI";class QZ{static registerFormat(Z,J){this.impls[Z]=J}static getMimeType(Z){for(let J in this.impls)if(this.impls[J].match(Z))return J;return null}static getSize(Z,J){if(!this.impls[J])return null;return this.impls[J].getSize(Z)}static getChannels(Z,J){if(!this.impls[J])return null;return this.impls[J].getChannels(Z)}static getVRAMByteLength(Z,J){if(!this.impls[J])return null;if(this.impls[J].getVRAMByteLength)return this.impls[J].getVRAMByteLength(Z);let X=0,Y=4,$=this.getSize(Z,J);if(!$)return null;while($[0]>1||$[1]>1)X+=$[0]*$[1]*Y,$[0]=Math.max(Math.floor($[0]/2),1),$[1]=Math.max(Math.floor($[1]/2),1);return X+=1*Y,X}static mimeTypeToExtension(Z){if(Z==="image/jpeg")return"jpg";return Z.split("/").pop()}static extensionToMimeType(Z){if(Z==="jpg")return"image/jpeg";if(!Z)return"";return`image/${Z}`}}QZ.impls={"image/jpeg":new Cc,"image/png":new dU};function yV1(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 KZ{static basename(Z){let J=Z.split(/[\\/]/).pop();return J.substring(0,J.lastIndexOf("."))}static extension(Z){if(Z.startsWith("data:image/")){let J=Z.match(/data:(image\/\w+)/)[1];return QZ.mimeTypeToExtension(J)}else if(Z.startsWith("data:model/gltf+json"))return"gltf";else if(Z.startsWith("data:model/gltf-binary"))return"glb";else if(Z.startsWith("data:application/"))return"bin";return Z.split(/[\\/]/).pop().split(/[.]/).pop()}}function Bc(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function oX(Z){if(Bc(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let X=J.prototype;if(Bc(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}var NP,X3;(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"})(X3||(X3={}));class j5{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=j5.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=j5.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=j5.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=j5.Verbosity.ERROR)console.error(Z)}}NP=j5;j5.Verbosity=X3;j5.DEFAULT_INSTANCE=new NP(NP.Verbosity.INFO);function gV1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],K=Z[5],W=Z[6],G=Z[7],z=Z[8],V=Z[9],H=Z[10],q=Z[11],F=Z[12],U=Z[13],w=Z[14],L=Z[15],j=J*K-X*Q,R=J*W-Y*Q,O=J*G-$*Q,N=X*W-Y*K,D=X*G-$*K,P=Y*G-$*W,C=z*U-V*F,T=z*w-H*F,k=z*L-q*F,A=V*w-H*U,S=V*L-q*U,x=H*L-q*w;return j*x-R*S+O*A+N*k-D*T+P*C}function mV1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=J[8],q=J[9],F=J[10],U=J[11],w=J[12],L=J[13],j=J[14],R=J[15],O=X[0],N=X[1],D=X[2],P=X[3];return Z[0]=O*Y+N*W+D*H+P*w,Z[1]=O*$+N*G+D*q+P*L,Z[2]=O*Q+N*z+D*F+P*j,Z[3]=O*K+N*V+D*U+P*R,O=X[4],N=X[5],D=X[6],P=X[7],Z[4]=O*Y+N*W+D*H+P*w,Z[5]=O*$+N*G+D*q+P*L,Z[6]=O*Q+N*z+D*F+P*j,Z[7]=O*K+N*V+D*U+P*R,O=X[8],N=X[9],D=X[10],P=X[11],Z[8]=O*Y+N*W+D*H+P*w,Z[9]=O*$+N*G+D*q+P*L,Z[10]=O*Q+N*z+D*F+P*j,Z[11]=O*K+N*V+D*U+P*R,O=X[12],N=X[13],D=X[14],P=X[15],Z[12]=O*Y+N*W+D*H+P*w,Z[13]=O*$+N*G+D*q+P*L,Z[14]=O*Q+N*z+D*F+P*j,Z[15]=O*K+N*V+D*U+P*R,Z}function uV1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[4],K=J[5],W=J[6],G=J[8],z=J[9],V=J[10];return Z[0]=Math.hypot(X,Y,$),Z[1]=Math.hypot(Q,K,W),Z[2]=Math.hypot(G,z,V),Z}function dV1(Z,J){var X=new MP(3);uV1(X,J);var Y=1/X[0],$=1/X[1],Q=1/X[2],K=J[0]*Y,W=J[1]*$,G=J[2]*Q,z=J[4]*Y,V=J[5]*$,H=J[6]*Q,q=J[8]*Y,F=J[9]*$,U=J[10]*Q,w=K+V+U,L=0;if(w>0)L=Math.sqrt(w+1)*2,Z[3]=0.25*L,Z[0]=(H-F)/L,Z[1]=(q-G)/L,Z[2]=(W-z)/L;else if(K>V&&K>U)L=Math.sqrt(1+K-V-U)*2,Z[3]=(H-F)/L,Z[0]=0.25*L,Z[1]=(W+z)/L,Z[2]=(q+G)/L;else if(V>U)L=Math.sqrt(1+V-K-U)*2,Z[3]=(q-G)/L,Z[0]=(W+z)/L,Z[1]=0.25*L,Z[2]=(H+F)/L;else L=Math.sqrt(1+U-K-V)*2,Z[3]=(W-z)/L,Z[0]=(q+G)/L,Z[1]=(H+F)/L,Z[2]=0.25*L;return Z}class d0{static identity(Z){return Z}static eq(Z,J,X=0.00001){if(Z.length!==J.length)return!1;for(let Y=0;Y<Z.length;Y++)if(Math.abs(Z[Y]-J[Y])>X)return!1;return!0}static clamp(Z,J,X){if(Z<J)return J;if(Z>X)return X;return Z}static decodeNormalizedInt(Z,J){switch(J){case 5126:return Z;case 5123:return Z/65535;case 5121:return Z/255;case 5122:return Math.max(Z/32767,-1);case 5120:return Math.max(Z/127,-1);default:throw new Error("Invalid component type.")}}static encodeNormalizedInt(Z,J){switch(J){case 5126:return Z;case 5123:return Math.round(d0.clamp(Z,0,1)*65535);case 5121:return Math.round(d0.clamp(Z,0,1)*255);case 5122:return Math.round(d0.clamp(Z,-1,1)*32767);case 5120:return Math.round(d0.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,X,Y){let $=OP([Z[0],Z[1],Z[2]]),Q=OP([Z[4],Z[5],Z[6]]),K=OP([Z[8],Z[9],Z[10]]);if(gV1(Z)<0)$=-$;J[0]=Z[12],J[1]=Z[13],J[2]=Z[14];let G=Z.slice(),z=1/$,V=1/Q,H=1/K;G[0]*=z,G[1]*=z,G[2]*=z,G[4]*=V,G[5]*=V,G[6]*=V,G[8]*=H,G[9]*=H,G[10]*=H,dV1(X,G),Y[0]=$,Y[1]=Q,Y[2]=K}static compose(Z,J,X,Y){let $=Y,Q=J[0],K=J[1],W=J[2],G=J[3],z=Q+Q,V=K+K,H=W+W,q=Q*z,F=Q*V,U=Q*H,w=K*V,L=K*H,j=W*H,R=G*z,O=G*V,N=G*H,D=X[0],P=X[1],C=X[2];return $[0]=(1-(w+j))*D,$[1]=(F+N)*D,$[2]=(U-O)*D,$[3]=0,$[4]=(F-N)*P,$[5]=(1-(q+j))*P,$[6]=(L+R)*P,$[7]=0,$[8]=(U+O)*C,$[9]=(L-R)*C,$[10]=(1-(q+w))*C,$[11]=0,$[12]=Z[0],$[13]=Z[1],$[14]=Z[2],$[15]=1,$}}function cV1(Z,J){if(!!Z!==!!J)return!1;let X=Z.getChild(),Y=J.getChild();return X===Y||X.equals(Y)}function lV1(Z,J){if(!!Z!==!!J)return!1;let X=Z.values(),Y=J.values();if(X.length!==Y.length)return!1;for(let $=0;$<X.length;$++){let Q=X[$],K=Y[$];if(Q.getChild()===K.getChild())continue;if(!Q.getChild().equals(K.getChild()))return!1}return!0}function pV1(Z,J){if(!!Z!==!!J)return!1;let X=Z.keys(),Y=J.keys();if(X.length!==Y.length)return!1;for(let $ of X){let Q=Z.get($),K=J.get($);if(!!Q!==!!K)return!1;let W=Q.getChild(),G=K.getChild();if(W===G)continue;if(!W.equals(G))return!1}return!0}function Tc(Z,J){if(Z===J)return!0;if(!!Z!==!!J||!Z||!J)return!1;if(Z.length!==J.length)return!1;for(let X=0;X<Z.length;X++)if(Z[X]!==J[X])return!1;return!0}function kc(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!oX(Z)||!oX(J))return Z===J;let X=Z,Y=J,$=0,Q=0,K;for(K in X)$++;for(K in Y)Q++;if($!==Q)return!1;for(K in X){let W=X[K],G=Y[K];if(mU(W)&&mU(G)){if(!Tc(W,G))return!1}else if(oX(W)&&oX(G)){if(!kc(W,G))return!1}else if(W!==G)return!1}return!0}function mU(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var jc="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ",iV1=999,nV1=6,Oc=new Set,aV1=function Z(){let J="";for(let X=0;X<nV1;X++)J+=jc.charAt(Math.floor(Math.random()*jc.length));return J},Ec=function Z(){for(let J=0;J<iV1;J++){let X=aV1();if(!Oc.has(X))return Oc.add(X),X}return""},Mc="https://null.example";class j9{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return KZ.basename(new URL(Z,Mc).pathname)}static extension(Z){return KZ.extension(new URL(Z,Mc).pathname)}static resolve(Z,J){if(!this.isRelativePath(J))return J;let X=Z.split("/"),Y=J.split("/");X.pop();for(let $=0;$<Y.length;$++){if(Y[$]===".")continue;if(Y[$]==="..")X.pop();else X.push(Y[$])}return X.join("/")}static isAbsoluteURL(Z){return this.PROTOCOL_REGEXP.test(Z)}static isRelativePath(Z){return!/^(?:[a-zA-Z]+:)?\//.test(Z)}}j9.DEFAULT_INIT={};j9.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var WJ=(Z)=>Z,sV1=new Set;class cU extends TQ{constructor(Z,J=""){super(Z);this[A0].name=J,this.init(),this.dispatchEvent({type:"create"})}getGraph(){return this.graph}getDefaults(){return Object.assign(super.getDefaults(),{name:"",extras:{}})}set(Z,J){if(Array.isArray(J))J=J.slice();return super.set(Z,J)}getName(){return this.get("name")}setName(Z){return this.set("name",Z)}getExtras(){return this.get("extras")}setExtras(Z){return this.set("extras",Z)}clone(){return new this.constructor(this.graph).copy(this,WJ)}copy(Z,J=WJ){for(let X in this[A0]){let Y=this[A0][X];if(Y instanceof w5){if(!this[G4].has(X))Y.dispose()}else if(Y instanceof D6||Y instanceof N0)for(let $ of Y.values())$.dispose();else if(Y instanceof r1)for(let $ of Y.values())$.dispose()}for(let X in Z[A0]){let Y=this[A0][X],$=Z[A0][X];if($ instanceof w5)if(this[G4].has(X))Y.getChild().copy(J($.getChild()),J);else this.setRef(X,J($.getChild()),$.getAttributes());else if($ instanceof N0||$ instanceof D6)for(let Q of $.values())this.addRef(X,J(Q.getChild()),Q.getAttributes());else if($ instanceof r1)for(let Q of $.keys()){let K=$.get(Q);this.setRefMap(X,Q,J(K.getChild()),K.getAttributes())}else if(oX($))this[A0][X]=JSON.parse(JSON.stringify($));else if(Array.isArray($)||$ instanceof ArrayBuffer||ArrayBuffer.isView($))this[A0][X]=$.slice();else this[A0][X]=$}return this}equals(Z,J=sV1){if(this===Z)return!0;if(this.propertyType!==Z.propertyType)return!1;for(let X in this[A0]){if(J.has(X))continue;let Y=this[A0][X],$=Z[A0][X];if(Y instanceof w5||$ instanceof w5){if(!cV1(Y,$))return!1}else if(Y instanceof N0||$ instanceof N0||Y instanceof D6||$ instanceof D6){if(!lV1(Y,$))return!1}else if(Y instanceof r1||$ instanceof r1){if(!pV1(Y,$))return!1}else if(oX(Y)||oX($)){if(!kc(Y,$))return!1}else if(mU(Y)||mU($)){if(!Tc(Y,$))return!1}else if(Y!==$)return!1}return!0}detach(){return this.graph.disconnectParents(this,(Z)=>Z.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}}class T6 extends cU{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new r1})}getExtension(Z){return this.getRefMap("extensions",Z)}setExtension(Z,J){if(J)J._validateParent(this);return this.setRefMap("extensions",Z,J)}listExtensions(){return this.listRefMapValues("extensions")}}class E0 extends T6{init(){this.propertyType=a.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:E0.Type.SCALAR,componentType:E0.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(Z){switch(Z){case E0.Type.SCALAR:return 1;case E0.Type.VEC2:return 2;case E0.Type.VEC3:return 3;case E0.Type.VEC4:return 4;case E0.Type.MAT2:return 4;case E0.Type.MAT3:return 9;case E0.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+Z)}}static getComponentSize(Z){switch(Z){case E0.ComponentType.BYTE:return 1;case E0.ComponentType.UNSIGNED_BYTE:return 1;case E0.ComponentType.SHORT:return 2;case E0.ComponentType.UNSIGNED_SHORT:return 2;case E0.ComponentType.UNSIGNED_INT:return 4;case E0.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+Z)}}getMinNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMin(Z),J)for(let $=0;$<X;$++)Z[$]=d0.decodeNormalizedInt(Z[$],Y);return Z}getMin(Z){let J=this.getArray(),X=this.getCount(),Y=this.getElementSize();for(let $=0;$<Y;$++)Z[$]=1/0;for(let $=0;$<X*Y;$+=Y)for(let Q=0;Q<Y;Q++){let K=J[$+Q];if(Number.isFinite(K))Z[Q]=Math.min(Z[Q],K)}return Z}getMaxNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMax(Z),J)for(let $=0;$<X;$++)Z[$]=d0.decodeNormalizedInt(Z[$],Y);return Z}getMax(Z){let J=this.get("array"),X=this.getCount(),Y=this.getElementSize();for(let $=0;$<Y;$++)Z[$]=-1/0;for(let $=0;$<X*Y;$+=Y)for(let Q=0;Q<Y;Q++){let K=J[$+Q];if(Number.isFinite(K))Z[Q]=Math.max(Z[Q],K)}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 E0.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(),X=this.getComponentType(),Y=this.getArray();if(this.getNormalized())return d0.decodeNormalizedInt(Y[Z*J],X);return Y[Z*J]}setScalar(Z,J){let X=this.getElementSize(),Y=this.getComponentType(),$=this.getArray();if(this.getNormalized())$[Z*X]=d0.encodeNormalizedInt(J,Y);else $[Z*X]=J;return this}getElement(Z,J){let X=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();for(let K=0;K<Y;K++)if(X)J[K]=d0.decodeNormalizedInt(Q[Z*Y+K],$);else J[K]=Q[Z*Y+K];return J}setElement(Z,J){let X=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();for(let K=0;K<Y;K++)if(X)Q[Z*Y+K]=d0.encodeNormalizedInt(J[K],$);else Q[Z*Y+K]=J[K];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?oV1(Z):E0.ComponentType.FLOAT),this.set("array",Z),this}getByteLength(){let Z=this.get("array");return Z?Z.byteLength:0}}E0.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};E0.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function oV1(Z){switch(Z.constructor){case Float32Array:return E0.ComponentType.FLOAT;case Uint32Array:return E0.ComponentType.UNSIGNED_INT;case Uint16Array:return E0.ComponentType.UNSIGNED_SHORT;case Uint8Array:return E0.ComponentType.UNSIGNED_BYTE;case Int16Array:return E0.ComponentType.SHORT;case Int8Array:return E0.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class TP extends T6{init(){this.propertyType=a.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new N0,samplers:new N0})}addChannel(Z){return this.addRef("channels",Z)}removeChannel(Z){return this.removeRef("channels",Z)}listChannels(){return this.listRefs("channels")}addSampler(Z){return this.addRef("samplers",Z)}removeSampler(Z){return this.removeRef("samplers",Z)}listSamplers(){return this.listRefs("samplers")}}class rX extends T6{init(){this.propertyType=a.ANIMATION_CHANNEL}getDefaults(){return Object.assign(super.getDefaults(),{targetPath:null,targetNode:null,sampler:null})}getTargetPath(){return this.get("targetPath")}setTargetPath(Z){return this.set("targetPath",Z)}getTargetNode(){return this.getRef("targetNode")}setTargetNode(Z){return this.setRef("targetNode",Z)}getSampler(){return this.getRef("sampler")}setSampler(Z){return this.setRef("sampler",Z)}}rX.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class kQ extends T6{init(){this.propertyType=a.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:kQ.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:d5.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:d5.OTHER})}}kQ.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class kP extends T6{init(){this.propertyType=a.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(Z){return this.set("uri",Z)}}class tX extends T6{init(){this.propertyType=a.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:tX.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)}}tX.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class EQ extends cU{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}EQ.EXTENSION_NAME=void 0;class B5 extends T6{init(){this.propertyType=a.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:B5.WrapMode.REPEAT,wrapT:B5.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)}}B5.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};B5.MagFilter={NEAREST:9728,LINEAR:9729};B5.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:_U,G:AU,B:xU,A:rV1}=gU;class t4 extends T6{init(){this.propertyType=a.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:t4.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new B5(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new B5(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new B5(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new B5(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new B5(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:_U|AU|xU|rV1,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:_U|AU|xU,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:_U|AU|xU})}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:_U})}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:AU|xU})}}t4.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class $3 extends T6{init(){this.propertyType=a.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new N0})}addPrimitive(Z){return this.addRef("primitives",Z)}removePrimitive(Z){return this.removeRef("primitives",Z)}listPrimitives(){return this.listRefs("primitives")}getWeights(){return this.get("weights")}setWeights(Z){return this.set("weights",Z)}}class lU extends T6{init(){this.propertyType=a.NODE}getDefaults(){return Object.assign(super.getDefaults(),{translation:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1],weights:[],camera:null,mesh:null,skin:null,children:new N0})}copy(Z,J=WJ){if(J===WJ)throw new Error("Node cannot be copied.");return super.copy(Z,J)}getTranslation(){return this.get("translation")}getRotation(){return this.get("rotation")}getScale(){return this.get("scale")}setTranslation(Z){return this.set("translation",Z)}setRotation(Z){return this.set("rotation",Z)}setScale(Z){return this.set("scale",Z)}getMatrix(){return d0.compose(this.get("translation"),this.get("rotation"),this.get("scale"),[])}setMatrix(Z){let J=this.get("translation").slice(),X=this.get("rotation").slice(),Y=this.get("scale").slice();return d0.decompose(Z,J,X,Y),this.set("translation",J).set("rotation",X).set("scale",Y)}getWorldTranslation(){let Z=[0,0,0];return d0.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return d0.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return d0.decompose(this.getWorldMatrix(),[0,0,0],[0,0,0,1],Z),Z}getWorldMatrix(){let Z=[];for(let Y=this;Y!=null;Y=Y.getParentNode())Z.push(Y);let J,X=Z.pop().getMatrix();while(J=Z.pop())mV1(X,X,J.getMatrix());return X}addChild(Z){let J=Z.getParentNode();if(J)J.removeChild(Z);for(let X of Z.listParents())if(X.propertyType===a.SCENE)X.removeChild(Z);return this.addRef("children",Z)}removeChild(Z){return this.removeRef("children",Z)}listChildren(){return this.listRefs("children")}getParentNode(){for(let Z of this.listParents())if(Z.propertyType===a.NODE)return Z;return null}getMesh(){return this.getRef("mesh")}setMesh(Z){return this.setRef("mesh",Z)}getCamera(){return this.getRef("camera")}setCamera(Z){return this.setRef("camera",Z)}getSkin(){return this.getRef("skin")}setSkin(Z){return this.setRef("skin",Z)}getWeights(){return this.get("weights")}setWeights(Z){return this.set("weights",Z)}traverse(Z){Z(this);for(let J of this.listChildren())J.traverse(Z);return this}}class M8 extends T6{init(){this.propertyType=a.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:M8.Mode.TRIANGLES,material:null,indices:null,attributes:new r1,targets:new N0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:d5.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:d5.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)}}M8.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class EP extends cU{init(){this.propertyType=a.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new r1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:d5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function c6(){return c6=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var X=arguments[J];for(var Y in X)({}).hasOwnProperty.call(X,Y)&&(Z[Y]=X[Y])}return Z},c6.apply(null,arguments)}class IQ extends T6{init(){this.propertyType=a.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new N0})}copy(Z,J=WJ){if(J===WJ)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 IP extends T6{init(){this.propertyType=a.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new N0})}getSkeleton(){return this.getRef("skeleton")}setSkeleton(Z){return this.setRef("skeleton",Z)}getInverseBindMatrices(){return this.getRef("inverseBindMatrices")}setInverseBindMatrices(Z){return this.setRef("inverseBindMatrices",Z,{usage:d5.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class eX extends T6{init(){this.propertyType=a.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||QZ.extensionToMimeType(KZ.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=QZ.extensionToMimeType(KZ.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",n0.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return QZ.getSize(Z,this.getMimeType())}}class ZY extends T6{init(){this.propertyType=a.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${Pc}`,version:"2.0"},defaultScene:null,accessors:new N0,animations:new N0,buffers:new N0,cameras:new N0,materials:new N0,meshes:new N0,nodes:new N0,scenes:new N0,skins:new N0,textures:new N0})}constructor(Z){super(Z);this._extensions=new Set,Z.addEventListener("node:create",(J)=>{this._addChildOfRoot(J.target)})}clone(){throw new Error("Root cannot be cloned.")}copy(Z,J=WJ){if(J===WJ)throw new Error("Root cannot be copied.");this.set("asset",c6({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(c6({},Z.getExtras())),this.setDefaultScene(Z.getDefaultScene()?J(Z.getDefaultScene()):null);for(let X of Z.listRefMapKeys("extensions")){let Y=Z.getExtension(X);this.setExtension(X,J(Y))}return this}_addChildOfRoot(Z){if(Z instanceof IQ)this.addRef("scenes",Z);else if(Z instanceof lU)this.addRef("nodes",Z);else if(Z instanceof tX)this.addRef("cameras",Z);else if(Z instanceof IP)this.addRef("skins",Z);else if(Z instanceof $3)this.addRef("meshes",Z);else if(Z instanceof t4)this.addRef("materials",Z);else if(Z instanceof eX)this.addRef("textures",Z);else if(Z instanceof TP)this.addRef("animations",Z);else if(Z instanceof E0)this.addRef("accessors",Z);else if(Z instanceof kP)this.addRef("buffers",Z);return this}getAsset(){return this.get("asset")}listExtensionsUsed(){return Array.from(this._extensions)}listExtensionsRequired(){return this.listExtensionsUsed().filter((Z)=>Z.isRequired())}_enableExtension(Z){return this._extensions.add(Z),this}_disableExtension(Z){return this._extensions.delete(Z),this}listScenes(){return this.listRefs("scenes")}setDefaultScene(Z){return this.setRef("defaultScene",Z)}getDefaultScene(){return this.getRef("defaultScene")}listNodes(){return this.listRefs("nodes")}listCameras(){return this.listRefs("cameras")}listSkins(){return this.listRefs("skins")}listMeshes(){return this.listRefs("meshes")}listMaterials(){return this.listRefs("materials")}listTextures(){return this.listRefs("textures")}listAnimations(){return this.listRefs("animations")}listAccessors(){return this.listRefs("accessors")}listBuffers(){return this.listRefs("buffers")}}class C6{static fromGraph(Z){return C6._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new CQ,this._root=new ZY(this._graph),this._logger=j5.DEFAULT_INSTANCE,C6._GRAPH_DOCUMENTS.set(this._graph,this)}getRoot(){return this._root}getGraph(){return this._graph}getLogger(){return this._logger}setLogger(Z){return this._logger=Z,this}clone(){throw new Error("Use 'cloneDocument(source)' from '@gltf-transform/functions'.")}merge(Z){throw new Error("Use 'mergeDocuments(target, source)' from '@gltf-transform/functions'.")}async transform(...Z){let J=Z.map((X)=>X.name);for(let X of Z)await X(this,{stack:J});return this}createExtension(Z){let J=Z.EXTENSION_NAME;return this.getRoot().listExtensionsUsed().find((Y)=>Y.extensionName===J)||new Z(this)}createScene(Z=""){return new IQ(this._graph,Z)}createNode(Z=""){return new lU(this._graph,Z)}createCamera(Z=""){return new tX(this._graph,Z)}createSkin(Z=""){return new IP(this._graph,Z)}createMesh(Z=""){return new $3(this._graph,Z)}createPrimitive(){return new M8(this._graph)}createPrimitiveTarget(Z=""){return new EP(this._graph,Z)}createMaterial(Z=""){return new t4(this._graph,Z)}createTexture(Z=""){return new eX(this._graph,Z)}createAnimation(Z=""){return new TP(this._graph,Z)}createAnimationChannel(Z=""){return new rX(this._graph,Z)}createAnimationSampler(Z=""){return new kQ(this._graph,Z)}createAccessor(Z="",J=null){if(!J)J=this.getRoot().listBuffers()[0];return new E0(this._graph,Z).setBuffer(J)}createBuffer(Z=""){return new kP(this._graph,Z)}}C6._GRAPH_DOCUMENTS=new WeakMap;class Ic{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=(X)=>{let Y=X,$=Y.target;if($ instanceof EQ&&$.extensionName===this.extensionName){if(Y.type==="node:create")this._addExtensionProperty($);if(Y.type==="node:dispose")this._removeExtensionProperty($)}};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}}Ic.EXTENSION_NAME=void 0;class vc{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 X=this.jsonDoc.json.textures[J.index];if(X.sampler===void 0)return;let Y=this.jsonDoc.json.samplers[X.sampler];if(Y.magFilter!==void 0)Z.setMagFilter(Y.magFilter);if(Y.minFilter!==void 0)Z.setMinFilter(Y.minFilter);if(Y.wrapS!==void 0)Z.setWrapS(Y.wrapS);if(Y.wrapT!==void 0)Z.setWrapT(Y.wrapT)}}var Rc={logger:j5.DEFAULT_INSTANCE,extensions:[],dependencies:{}},tV1=new Set([a.BUFFER,a.TEXTURE,a.MATERIAL,a.MESH,a.PRIMITIVE,a.NODE,a.SCENE]);class Sc{static read(Z,J=Rc){let X=c6({},Rc,J),{json:Y}=Z,$=new C6().setLogger(X.logger);this.validate(Z,X);let Q=new vc(Z),K=Y.asset,W=$.getRoot().getAsset();if(K.copyright)W.copyright=K.copyright;if(K.extras)W.extras=K.extras;if(Y.extras!==void 0)$.getRoot().setExtras(c6({},Y.extras));let G=Y.extensionsUsed||[],z=Y.extensionsRequired||[];X.extensions.sort((P,C)=>P.EXTENSION_NAME>C.EXTENSION_NAME?1:-1);for(let P of X.extensions)if(G.includes(P.EXTENSION_NAME)){let C=$.createExtension(P).setRequired(z.includes(P.EXTENSION_NAME)),T=C.prereadTypes.filter((k)=>!tV1.has(k));if(T.length)X.logger.warn(`Preread hooks for some types (${T.join()}), requested by extension ${C.extensionName}, are unsupported. Please file an issue or a PR.`);for(let k of C.readDependencies)C.install(k,X.dependencies[k])}let V=Y.buffers||[];$.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.BUFFER)).forEach((P)=>P.preread(Q,a.BUFFER)),Q.buffers=V.map((P)=>{let C=$.createBuffer(P.name);if(P.extras)C.setExtras(P.extras);if(P.uri&&P.uri.indexOf("__")!==0)C.setURI(P.uri);return C});let H=Y.bufferViews||[];Q.bufferViewBuffers=H.map((P,C)=>{if(!Q.bufferViews[C]){let T=Z.json.buffers[P.buffer],k=T.uri?Z.resources[T.uri]:Z.resources[bU],A=P.byteOffset||0;Q.bufferViews[C]=n0.toView(k,A,P.byteLength)}return Q.buffers[P.buffer]});let q=Y.accessors||[];Q.accessors=q.map((P)=>{let C=Q.bufferViewBuffers[P.bufferView],T=$.createAccessor(P.name,C).setType(P.type);if(P.extras)T.setExtras(P.extras);if(P.normalized!==void 0)T.setNormalized(P.normalized);if(P.bufferView===void 0)return T;return T.setArray(fU(P,Q)),T});let F=Y.images||[],U=Y.textures||[];$.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.TEXTURE)).forEach((P)=>P.preread(Q,a.TEXTURE)),Q.textures=F.map((P)=>{let C=$.createTexture(P.name);if(P.extras)C.setExtras(P.extras);if(P.bufferView!==void 0){let T=Y.bufferViews[P.bufferView],k=Z.json.buffers[T.buffer],A=k.uri?Z.resources[k.uri]:Z.resources[bU],S=T.byteOffset||0,x=T.byteLength,I=A.slice(S,S+x);C.setImage(I)}else if(P.uri!==void 0){if(C.setImage(Z.resources[P.uri]),P.uri.indexOf("__")!==0)C.setURI(P.uri)}if(P.mimeType!==void 0)C.setMimeType(P.mimeType);else if(P.uri){let T=KZ.extension(P.uri);C.setMimeType(QZ.extensionToMimeType(T))}return C}),$.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.MATERIAL)).forEach((P)=>P.preread(Q,a.MATERIAL));let w=Y.materials||[];Q.materials=w.map((P)=>{let C=$.createMaterial(P.name);if(P.extras)C.setExtras(P.extras);if(P.alphaMode!==void 0)C.setAlphaMode(P.alphaMode);if(P.alphaCutoff!==void 0)C.setAlphaCutoff(P.alphaCutoff);if(P.doubleSided!==void 0)C.setDoubleSided(P.doubleSided);let T=P.pbrMetallicRoughness||{};if(T.baseColorFactor!==void 0)C.setBaseColorFactor(T.baseColorFactor);if(P.emissiveFactor!==void 0)C.setEmissiveFactor(P.emissiveFactor);if(T.metallicFactor!==void 0)C.setMetallicFactor(T.metallicFactor);if(T.roughnessFactor!==void 0)C.setRoughnessFactor(T.roughnessFactor);if(T.baseColorTexture!==void 0){let k=T.baseColorTexture,A=Q.textures[U[k.index].source];C.setBaseColorTexture(A),Q.setTextureInfo(C.getBaseColorTextureInfo(),k)}if(P.emissiveTexture!==void 0){let k=P.emissiveTexture,A=Q.textures[U[k.index].source];C.setEmissiveTexture(A),Q.setTextureInfo(C.getEmissiveTextureInfo(),k)}if(P.normalTexture!==void 0){let k=P.normalTexture,A=Q.textures[U[k.index].source];if(C.setNormalTexture(A),Q.setTextureInfo(C.getNormalTextureInfo(),k),P.normalTexture.scale!==void 0)C.setNormalScale(P.normalTexture.scale)}if(P.occlusionTexture!==void 0){let k=P.occlusionTexture,A=Q.textures[U[k.index].source];if(C.setOcclusionTexture(A),Q.setTextureInfo(C.getOcclusionTextureInfo(),k),P.occlusionTexture.strength!==void 0)C.setOcclusionStrength(P.occlusionTexture.strength)}if(T.metallicRoughnessTexture!==void 0){let k=T.metallicRoughnessTexture,A=Q.textures[U[k.index].source];C.setMetallicRoughnessTexture(A),Q.setTextureInfo(C.getMetallicRoughnessTextureInfo(),k)}return C}),$.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.MESH)).forEach((P)=>P.preread(Q,a.MESH));let L=Y.meshes||[];$.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.PRIMITIVE)).forEach((P)=>P.preread(Q,a.PRIMITIVE)),Q.meshes=L.map((P)=>{let C=$.createMesh(P.name);if(P.extras)C.setExtras(P.extras);if(P.weights!==void 0)C.setWeights(P.weights);return(P.primitives||[]).forEach((k)=>{let A=$.createPrimitive();if(k.extras)A.setExtras(k.extras);if(k.material!==void 0)A.setMaterial(Q.materials[k.material]);if(k.mode!==void 0)A.setMode(k.mode);for(let[I,v]of Object.entries(k.attributes||{}))A.setAttribute(I,Q.accessors[v]);if(k.indices!==void 0)A.setIndices(Q.accessors[k.indices]);let S=P.extras&&P.extras.targetNames||[];(k.targets||[]).forEach((I,v)=>{let f=S[v]||v.toString(),p=$.createPrimitiveTarget(f);for(let[n,o]of Object.entries(I))p.setAttribute(n,Q.accessors[o]);A.addTarget(p)}),C.addPrimitive(A)}),C});let j=Y.cameras||[];Q.cameras=j.map((P)=>{let C=$.createCamera(P.name).setType(P.type);if(P.extras)C.setExtras(P.extras);if(P.type===tX.Type.PERSPECTIVE){let T=P.perspective;if(C.setYFov(T.yfov),C.setZNear(T.znear),T.zfar!==void 0)C.setZFar(T.zfar);if(T.aspectRatio!==void 0)C.setAspectRatio(T.aspectRatio)}else{let T=P.orthographic;C.setZNear(T.znear).setZFar(T.zfar).setXMag(T.xmag).setYMag(T.ymag)}return C});let R=Y.nodes||[];$.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.NODE)).forEach((P)=>P.preread(Q,a.NODE)),Q.nodes=R.map((P)=>{let C=$.createNode(P.name);if(P.extras)C.setExtras(P.extras);if(P.translation!==void 0)C.setTranslation(P.translation);if(P.rotation!==void 0)C.setRotation(P.rotation);if(P.scale!==void 0)C.setScale(P.scale);if(P.matrix!==void 0){let T=[0,0,0],k=[0,0,0,1],A=[1,1,1];d0.decompose(P.matrix,T,k,A),C.setTranslation(T),C.setRotation(k),C.setScale(A)}if(P.weights!==void 0)C.setWeights(P.weights);return C});let O=Y.skins||[];Q.skins=O.map((P)=>{let C=$.createSkin(P.name);if(P.extras)C.setExtras(P.extras);if(P.inverseBindMatrices!==void 0)C.setInverseBindMatrices(Q.accessors[P.inverseBindMatrices]);if(P.skeleton!==void 0)C.setSkeleton(Q.nodes[P.skeleton]);for(let T of P.joints)C.addJoint(Q.nodes[T]);return C}),R.map((P,C)=>{let T=Q.nodes[C];if((P.children||[]).forEach((A)=>T.addChild(Q.nodes[A])),P.mesh!==void 0)T.setMesh(Q.meshes[P.mesh]);if(P.camera!==void 0)T.setCamera(Q.cameras[P.camera]);if(P.skin!==void 0)T.setSkin(Q.skins[P.skin])});let N=Y.animations||[];Q.animations=N.map((P)=>{let C=$.createAnimation(P.name);if(P.extras)C.setExtras(P.extras);let k=(P.samplers||[]).map((S)=>{let x=$.createAnimationSampler().setInput(Q.accessors[S.input]).setOutput(Q.accessors[S.output]).setInterpolation(S.interpolation||kQ.Interpolation.LINEAR);if(S.extras)x.setExtras(S.extras);return C.addSampler(x),x});return(P.channels||[]).forEach((S)=>{let x=$.createAnimationChannel().setSampler(k[S.sampler]).setTargetPath(S.target.path);if(S.target.node!==void 0)x.setTargetNode(Q.nodes[S.target.node]);if(S.extras)x.setExtras(S.extras);C.addChannel(x)}),C});let D=Y.scenes||[];if($.getRoot().listExtensionsUsed().filter((P)=>P.prereadTypes.includes(a.SCENE)).forEach((P)=>P.preread(Q,a.SCENE)),Q.scenes=D.map((P)=>{let C=$.createScene(P.name);if(P.extras)C.setExtras(P.extras);return(P.nodes||[]).map((k)=>Q.nodes[k]).forEach((k)=>C.addChild(k)),C}),Y.scene!==void 0)$.getRoot().setDefaultScene(Q.scenes[Y.scene]);return $.getRoot().listExtensionsUsed().forEach((P)=>P.read(Q)),q.forEach((P,C)=>{let T=Q.accessors[C],k=!!P.sparse,A=!P.bufferView&&!T.getArray();if(k||A)T.setSparse(!0).setArray(ZH1(P,Q))}),$}static validate(Z,J){let X=Z.json;if(X.asset.version!=="2.0")throw new Error(`Unsupported glTF version, "${X.asset.version}".`);if(X.extensionsRequired){for(let Y of X.extensionsRequired)if(!J.extensions.find(($)=>$.EXTENSION_NAME===Y))throw new Error(`Missing required extension, "${Y}".`)}if(X.extensionsUsed){for(let Y of X.extensionsUsed)if(!J.extensions.find(($)=>$.EXTENSION_NAME===Y))J.logger.warn(`Missing optional extension, "${Y}".`)}}}function eV1(Z,J){let X=J.jsonDoc,Y=J.bufferViews[Z.bufferView],$=X.json.bufferViews[Z.bufferView],Q=GJ[Z.componentType],K=E0.getElementSize(Z.type),W=Q.BYTES_PER_ELEMENT,G=Z.byteOffset||0,z=new Q(Z.count*K),V=new DataView(Y.buffer,Y.byteOffset,Y.byteLength),H=$.byteStride;for(let q=0;q<Z.count;q++)for(let F=0;F<K;F++){let U=G+q*H+F*W,w;switch(Z.componentType){case E0.ComponentType.FLOAT:w=V.getFloat32(U,!0);break;case E0.ComponentType.UNSIGNED_INT:w=V.getUint32(U,!0);break;case E0.ComponentType.UNSIGNED_SHORT:w=V.getUint16(U,!0);break;case E0.ComponentType.UNSIGNED_BYTE:w=V.getUint8(U);break;case E0.ComponentType.SHORT:w=V.getInt16(U,!0);break;case E0.ComponentType.BYTE:w=V.getInt8(U);break;default:throw new Error(`Unexpected componentType "${Z.componentType}".`)}z[q*K+F]=w}return z}function fU(Z,J){let X=J.jsonDoc,Y=J.bufferViews[Z.bufferView],$=X.json.bufferViews[Z.bufferView],Q=GJ[Z.componentType],K=E0.getElementSize(Z.type),W=Q.BYTES_PER_ELEMENT,G=K*W;if($.byteStride!==void 0&&$.byteStride!==G)return eV1(Z,J);let z=Y.byteOffset+(Z.byteOffset||0),V=Z.count*K*W;return new Q(Y.buffer.slice(z,z+V))}function ZH1(Z,J){let X=GJ[Z.componentType],Y=E0.getElementSize(Z.type),$;if(Z.bufferView!==void 0)$=fU(Z,J);else $=new X(Z.count*Y);let Q=Z.sparse;if(!Q)return $;let K=Q.count,W=c6({},Z,Q.indices,{count:K,type:"SCALAR"}),G=c6({},Z,Q.values,{count:K}),z=fU(W,J),V=fU(G,J);for(let H=0;H<W.count;H++)for(let q=0;q<Y;q++)$[z[H]*Y+q]=V[H*Y+q];return $}var Y3;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(Y3||(Y3={}));class KJ{constructor(Z,J,X){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=X;let Y=Z.getRoot(),$=Y.listBuffers().length,Q=Y.listTextures().length;this.bufferURIGenerator=new PP($>1,()=>X.basename||"buffer"),this.imageURIGenerator=new PP(Q>1,(K)=>JH1(Z,K)||X.basename||"texture"),this.logger=Z.getLogger()}createTextureInfoDef(Z,J){let X={magFilter:J.getMagFilter()||void 0,minFilter:J.getMinFilter()||void 0,wrapS:J.getWrapS(),wrapT:J.getWrapT()},Y=JSON.stringify(X);if(!this.samplerDefIndexMap.has(Y))this.samplerDefIndexMap.set(Y,this.jsonDoc.json.samplers.length),this.jsonDoc.json.samplers.push(X);let $={source:this.imageIndexMap.get(Z),sampler:this.samplerDefIndexMap.get(Y)},Q=JSON.stringify($);if(!this.textureDefIndexMap.has(Q))this.textureDefIndexMap.set(Q,this.jsonDoc.json.textures.length),this.jsonDoc.json.textures.push($);let K={index:this.textureDefIndexMap.get(Q)};if(J.getTexCoord()!==0)K.texCoord=J.getTexCoord();if(Object.keys(J.getExtras()).length>0)K.extras=J.getExtras();return this.textureInfoDefMap.set(J,K),K}createPropertyDef(Z){let J={};if(Z.getName())J.name=Z.getName();if(Object.keys(Z.getExtras()).length>0)J.extras=Z.getExtras();return J}createAccessorDef(Z){let J=this.createPropertyDef(Z);if(J.type=Z.getType(),J.componentType=Z.getComponentType(),J.count=Z.getCount(),this._doc.getGraph().listParentEdges(Z).some((Y)=>Y.getName()==="attributes"&&Y.getAttributes().key==="POSITION"||Y.getName()==="input"))J.max=Z.getMax([]).map(Math.fround),J.min=Z.getMin([]).map(Math.fround);if(Z.getNormalized())J.normalized=Z.getNormalized();return J}createImageData(Z,J,X){if(this.options.format===$Z.GLB)this.imageBufferViews.push(J),Z.bufferView=this.jsonDoc.json.bufferViews.length,this.jsonDoc.json.bufferViews.push({buffer:0,byteOffset:-1,byteLength:J.byteLength});else{let Y=QZ.mimeTypeToExtension(X.getMimeType());Z.uri=this.imageURIGenerator.createURI(X,Y),this.assignResourceURI(Z.uri,J,!1)}}assignResourceURI(Z,J,X){let Y=this.jsonDoc.resources;if(!(Z in Y)){Y[Z]=J;return}if(J===Y[Z]){this.logger.warn(`Duplicate resource URI, "${Z}".`);return}let $=`Resource URI "${Z}" already assigned to different data.`;if(!X){this.logger.warn($);return}throw new Error($)}getAccessorUsage(Z){let J=this._accessorUsageMap.get(Z);if(J)return J;if(Z.getSparse())return d5.SPARSE;for(let X of this._doc.getGraph().listParentEdges(Z)){let{usage:Y}=X.getAttributes();if(Y)return Y;if(X.getParent().propertyType!==a.ROOT)this.logger.warn(`Missing attribute ".usage" on edge, "${X.getName()}".`)}return d5.OTHER}addAccessorToUsageGroup(Z,J){let X=this._accessorUsageMap.get(Z);if(X&&X!==J)throw new Error(`Accessor with usage "${X}" cannot be reused as "${J}".`);return this._accessorUsageMap.set(Z,J),this}}KJ.BufferViewTarget=Y3;KJ.BufferViewUsage=d5;KJ.USAGE_TO_TARGET={[d5.ARRAY_BUFFER]:Y3.ARRAY_BUFFER,[d5.ELEMENT_ARRAY_BUFFER]:Y3.ELEMENT_ARRAY_BUFFER};class PP{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 X=this.basename(Z);return this.counter[X]=this.counter[X]||1,`${X}_${this.counter[X]++}.${J}`}}}function JH1(Z,J){let X=Z.getGraph().listParentEdges(J).find((Y)=>Y.getParent()!==Z.getRoot());return X?X.getName().replace(/texture$/i,""):""}var{BufferViewUsage:hU}=KJ,{UNSIGNED_INT:XH1,UNSIGNED_SHORT:YH1,UNSIGNED_BYTE:$H1}=E0.ComponentType,QH1=new Set([a.ACCESSOR,a.BUFFER,a.MATERIAL,a.MESH]);class _c{static write(Z,J){let X=Z.getGraph(),Y=Z.getRoot(),$={asset:c6({generator:`glTF-Transform ${Pc}`},Y.getAsset()),extras:c6({},Y.getExtras())},Q={json:$,resources:{}},K=new KJ(Z,Q,J),W=J.logger||j5.DEFAULT_INSTANCE,G=new Set(J.extensions.map((L)=>L.EXTENSION_NAME)),z=Z.getRoot().listExtensionsUsed().filter((L)=>G.has(L.extensionName)).sort((L,j)=>L.extensionName>j.extensionName?1:-1),V=Z.getRoot().listExtensionsRequired().filter((L)=>G.has(L.extensionName)).sort((L,j)=>L.extensionName>j.extensionName?1:-1);if(z.length<Z.getRoot().listExtensionsUsed().length)W.warn("Some extensions were not registered for I/O, and will not be written.");for(let L of z){let j=L.prewriteTypes.filter((R)=>!QH1.has(R));if(j.length)W.warn(`Prewrite hooks for some types (${j.join()}), requested by extension ${L.extensionName}, are unsupported. Please file an issue or a PR.`);for(let R of L.writeDependencies)L.install(R,J.dependencies[R])}function H(L,j,R,O){let N=[],D=0;for(let T of L){let k=K.createAccessorDef(T);k.bufferView=$.bufferViews.length;let A=T.getArray(),S=n0.pad(n0.toView(A));k.byteOffset=D,D+=S.byteLength,N.push(S),K.accessorIndexMap.set(T,$.accessors.length),$.accessors.push(k)}let P=n0.concat(N),C={buffer:j,byteOffset:R,byteLength:P.byteLength};if(O)C.target=O;return $.bufferViews.push(C),{buffers:N,byteLength:D}}function q(L,j,R){let O=L[0].getCount(),N=0;for(let k of L){let A=K.createAccessorDef(k);A.bufferView=$.bufferViews.length,A.byteOffset=N;let S=k.getElementSize(),x=k.getComponentSize();N+=n0.padNumber(S*x),K.accessorIndexMap.set(k,$.accessors.length),$.accessors.push(A)}let D=O*N,P=new ArrayBuffer(D),C=new DataView(P);for(let k=0;k<O;k++){let A=0;for(let S of L){let x=S.getElementSize(),I=S.getComponentSize(),v=S.getComponentType(),f=S.getArray();for(let p=0;p<x;p++){let n=k*N+A+p*I,o=f[k*x+p];switch(v){case E0.ComponentType.FLOAT:C.setFloat32(n,o,!0);break;case E0.ComponentType.BYTE:C.setInt8(n,o);break;case E0.ComponentType.SHORT:C.setInt16(n,o,!0);break;case E0.ComponentType.UNSIGNED_BYTE:C.setUint8(n,o);break;case E0.ComponentType.UNSIGNED_SHORT:C.setUint16(n,o,!0);break;case E0.ComponentType.UNSIGNED_INT:C.setUint32(n,o,!0);break;default:throw new Error("Unexpected component type: "+v)}}A+=n0.padNumber(x*I)}}let T={buffer:j,byteOffset:R,byteLength:D,byteStride:N,target:KJ.BufferViewTarget.ARRAY_BUFFER};return $.bufferViews.push(T),{byteLength:D,buffers:[new Uint8Array(P)]}}function F(L,j,R){let O=[],N=0,D=new Map,P=-1/0,C=!1;for(let v of L){let f=K.createAccessorDef(v);$.accessors.push(f),K.accessorIndexMap.set(v,$.accessors.length-1);let p=[],n=[],o=[],J0=new Array(v.getElementSize()).fill(0);for(let a0=0,v8=v.getCount();a0<v8;a0++){if(v.getElement(a0,o),d0.eq(o,J0,0))continue;P=Math.max(a0,P),p.push(a0);for(let s1=0;s1<o.length;s1++)n.push(o[s1])}let Q0=p.length,C0={accessorDef:f,count:Q0};if(D.set(v,C0),Q0===0)continue;if(Q0>v.getCount()/2)C=!0;let T0=GJ[v.getComponentType()];C0.indices=p,C0.values=new T0(n)}if(!Number.isFinite(P))return{buffers:O,byteLength:N};if(C)W.warn("Some sparse accessors have >50% non-zero elements, which may increase file size.");let T=P<255?Uint8Array:P<65535?Uint16Array:Uint32Array,k=P<255?$H1:P<65535?YH1:XH1,A={buffer:j,byteOffset:R+N,byteLength:0};for(let v of L){let f=D.get(v);if(f.count===0)continue;f.indicesByteOffset=A.byteLength;let p=n0.pad(n0.toView(new T(f.indices)));O.push(p),N+=p.byteLength,A.byteLength+=p.byteLength}$.bufferViews.push(A);let S=$.bufferViews.length-1,x={buffer:j,byteOffset:R+N,byteLength:0};for(let v of L){let f=D.get(v);if(f.count===0)continue;f.valuesByteOffset=x.byteLength;let p=n0.pad(n0.toView(f.values));O.push(p),N+=p.byteLength,x.byteLength+=p.byteLength}$.bufferViews.push(x);let I=$.bufferViews.length-1;for(let v of L){let f=D.get(v);if(f.count===0)continue;f.accessorDef.sparse={count:f.count,indices:{bufferView:S,byteOffset:f.indicesByteOffset,componentType:k},values:{bufferView:I,byteOffset:f.valuesByteOffset}}}return{buffers:O,byteLength:N}}if($.accessors=[],$.bufferViews=[],$.samplers=[],$.textures=[],$.images=Y.listTextures().map((L,j)=>{let R=K.createPropertyDef(L);if(L.getMimeType())R.mimeType=L.getMimeType();let O=L.getImage();if(O)K.createImageData(R,O,L);return K.imageIndexMap.set(L,j),R}),z.filter((L)=>L.prewriteTypes.includes(a.ACCESSOR)).forEach((L)=>L.prewrite(K,a.ACCESSOR)),Y.listAccessors().forEach((L)=>{let{accessorUsageGroupedByParent:j,accessorParents:R}=K;if(K.accessorIndexMap.has(L))return;let O=K.getAccessorUsage(L);if(K.addAccessorToUsageGroup(L,O),j.has(O)){let N=X.listParents(L).find((D)=>D.propertyType!==a.ROOT);R.set(L,N)}}),z.filter((L)=>L.prewriteTypes.includes(a.BUFFER)).forEach((L)=>L.prewrite(K,a.BUFFER)),(Y.listAccessors().length>0||K.otherBufferViews.size>0||Y.listTextures().length>0&&J.format===$Z.GLB)&&Y.listBuffers().length===0)throw new Error("Buffer required for Document resources, but none was found.");if($.buffers=[],Y.listBuffers().forEach((L,j)=>{let R=K.createPropertyDef(L),O=K.accessorUsageGroupedByParent,N=L.listParents().filter((x)=>x instanceof E0),D=new Set(N.map((x)=>K.accessorParents.get(x))),P=new Map(Array.from(D).map((x,I)=>[x,I])),C={};for(let x of N){var T;if(K.accessorIndexMap.has(x))continue;let I=K.getAccessorUsage(x),v=I;if(O.has(I)){let f=K.accessorParents.get(x);v+=`:${P.get(f)}`}C[T=v]||(C[T]={usage:I,accessors:[]}),C[v].accessors.push(x)}let k=[],A=$.buffers.length,S=0;for(let{usage:x,accessors:I}of Object.values(C))if(x===hU.ARRAY_BUFFER&&J.vertexLayout===yU.INTERLEAVED){let v=q(I,A,S);S+=v.byteLength;for(let f of v.buffers)k.push(f)}else if(x===hU.ARRAY_BUFFER)for(let v of I){let f=q([v],A,S);S+=f.byteLength;for(let p of f.buffers)k.push(p)}else if(x===hU.SPARSE){let v=F(I,A,S);S+=v.byteLength;for(let f of v.buffers)k.push(f)}else if(x===hU.ELEMENT_ARRAY_BUFFER){let v=KJ.BufferViewTarget.ELEMENT_ARRAY_BUFFER,f=H(I,A,S,v);S+=f.byteLength;for(let p of f.buffers)k.push(p)}else{let v=H(I,A,S);S+=v.byteLength;for(let f of v.buffers)k.push(f)}if(K.imageBufferViews.length&&j===0){for(let x=0;x<K.imageBufferViews.length;x++)if($.bufferViews[$.images[x].bufferView].byteOffset=S,S+=K.imageBufferViews[x].byteLength,k.push(K.imageBufferViews[x]),S%8){let I=8-S%8;S+=I,k.push(new Uint8Array(I))}}if(K.otherBufferViews.has(L))for(let x of K.otherBufferViews.get(L))$.bufferViews.push({buffer:A,byteOffset:S,byteLength:x.byteLength}),K.otherBufferViewsIndexMap.set(x,$.bufferViews.length-1),S+=x.byteLength,k.push(x);if(S){let x;if(J.format===$Z.GLB)x=bU;else x=K.bufferURIGenerator.createURI(L,"bin"),R.uri=x;R.byteLength=S,K.assignResourceURI(x,n0.concat(k),!0)}$.buffers.push(R),K.bufferIndexMap.set(L,j)}),Y.listAccessors().find((L)=>!L.getBuffer()))W.warn("Skipped writing one or more Accessors: no Buffer assigned.");z.filter((L)=>L.prewriteTypes.includes(a.MATERIAL)).forEach((L)=>L.prewrite(K,a.MATERIAL)),$.materials=Y.listMaterials().map((L,j)=>{let R=K.createPropertyDef(L);if(L.getAlphaMode()!==t4.AlphaMode.OPAQUE)R.alphaMode=L.getAlphaMode();if(L.getAlphaMode()===t4.AlphaMode.MASK)R.alphaCutoff=L.getAlphaCutoff();if(L.getDoubleSided())R.doubleSided=!0;if(R.pbrMetallicRoughness={},!d0.eq(L.getBaseColorFactor(),[1,1,1,1]))R.pbrMetallicRoughness.baseColorFactor=L.getBaseColorFactor();if(!d0.eq(L.getEmissiveFactor(),[0,0,0]))R.emissiveFactor=L.getEmissiveFactor();if(L.getRoughnessFactor()!==1)R.pbrMetallicRoughness.roughnessFactor=L.getRoughnessFactor();if(L.getMetallicFactor()!==1)R.pbrMetallicRoughness.metallicFactor=L.getMetallicFactor();if(L.getBaseColorTexture()){let O=L.getBaseColorTexture(),N=L.getBaseColorTextureInfo();R.pbrMetallicRoughness.baseColorTexture=K.createTextureInfoDef(O,N)}if(L.getEmissiveTexture()){let O=L.getEmissiveTexture(),N=L.getEmissiveTextureInfo();R.emissiveTexture=K.createTextureInfoDef(O,N)}if(L.getNormalTexture()){let O=L.getNormalTexture(),N=L.getNormalTextureInfo(),D=K.createTextureInfoDef(O,N);if(L.getNormalScale()!==1)D.scale=L.getNormalScale();R.normalTexture=D}if(L.getOcclusionTexture()){let O=L.getOcclusionTexture(),N=L.getOcclusionTextureInfo(),D=K.createTextureInfoDef(O,N);if(L.getOcclusionStrength()!==1)D.strength=L.getOcclusionStrength();R.occlusionTexture=D}if(L.getMetallicRoughnessTexture()){let O=L.getMetallicRoughnessTexture(),N=L.getMetallicRoughnessTextureInfo();R.pbrMetallicRoughness.metallicRoughnessTexture=K.createTextureInfoDef(O,N)}return K.materialIndexMap.set(L,j),R}),z.filter((L)=>L.prewriteTypes.includes(a.MESH)).forEach((L)=>L.prewrite(K,a.MESH)),$.meshes=Y.listMeshes().map((L,j)=>{let R=K.createPropertyDef(L),O=null;if(R.primitives=L.listPrimitives().map((N)=>{let D={attributes:{}};D.mode=N.getMode();let P=N.getMaterial();if(P)D.material=K.materialIndexMap.get(P);if(Object.keys(N.getExtras()).length)D.extras=N.getExtras();let C=N.getIndices();if(C)D.indices=K.accessorIndexMap.get(C);for(let T of N.listSemantics())D.attributes[T]=K.accessorIndexMap.get(N.getAttribute(T));for(let T of N.listTargets()){let k={};for(let A of T.listSemantics())k[A]=K.accessorIndexMap.get(T.getAttribute(A));D.targets=D.targets||[],D.targets.push(k)}if(N.listTargets().length&&!O)O=N.listTargets().map((T)=>T.getName());return D}),L.getWeights().length)R.weights=L.getWeights();if(O)R.extras=R.extras||{},R.extras.targetNames=O;return K.meshIndexMap.set(L,j),R}),$.cameras=Y.listCameras().map((L,j)=>{let R=K.createPropertyDef(L);if(R.type=L.getType(),R.type===tX.Type.PERSPECTIVE){R.perspective={znear:L.getZNear(),zfar:L.getZFar(),yfov:L.getYFov()};let O=L.getAspectRatio();if(O!==null)R.perspective.aspectRatio=O}else R.orthographic={znear:L.getZNear(),zfar:L.getZFar(),xmag:L.getXMag(),ymag:L.getYMag()};return K.cameraIndexMap.set(L,j),R}),$.nodes=Y.listNodes().map((L,j)=>{let R=K.createPropertyDef(L);if(!d0.eq(L.getTranslation(),[0,0,0]))R.translation=L.getTranslation();if(!d0.eq(L.getRotation(),[0,0,0,1]))R.rotation=L.getRotation();if(!d0.eq(L.getScale(),[1,1,1]))R.scale=L.getScale();if(L.getWeights().length)R.weights=L.getWeights();return K.nodeIndexMap.set(L,j),R}),$.skins=Y.listSkins().map((L,j)=>{let R=K.createPropertyDef(L),O=L.getInverseBindMatrices();if(O)R.inverseBindMatrices=K.accessorIndexMap.get(O);let N=L.getSkeleton();if(N)R.skeleton=K.nodeIndexMap.get(N);return R.joints=L.listJoints().map((D)=>K.nodeIndexMap.get(D)),K.skinIndexMap.set(L,j),R}),Y.listNodes().forEach((L,j)=>{let R=$.nodes[j],O=L.getMesh();if(O)R.mesh=K.meshIndexMap.get(O);let N=L.getCamera();if(N)R.camera=K.cameraIndexMap.get(N);let D=L.getSkin();if(D)R.skin=K.skinIndexMap.get(D);if(L.listChildren().length>0)R.children=L.listChildren().map((P)=>K.nodeIndexMap.get(P))}),$.animations=Y.listAnimations().map((L,j)=>{let R=K.createPropertyDef(L),O=new Map;return R.samplers=L.listSamplers().map((N,D)=>{let P=K.createPropertyDef(N);return P.input=K.accessorIndexMap.get(N.getInput()),P.output=K.accessorIndexMap.get(N.getOutput()),P.interpolation=N.getInterpolation(),O.set(N,D),P}),R.channels=L.listChannels().map((N)=>{let D=K.createPropertyDef(N);return D.sampler=O.get(N.getSampler()),D.target={node:K.nodeIndexMap.get(N.getTargetNode()),path:N.getTargetPath()},D}),K.animationIndexMap.set(L,j),R}),$.scenes=Y.listScenes().map((L,j)=>{let R=K.createPropertyDef(L);return R.nodes=L.listChildren().map((O)=>K.nodeIndexMap.get(O)),K.sceneIndexMap.set(L,j),R});let w=Y.getDefaultScene();if(w)$.scene=Y.listScenes().indexOf(w);return $.extensionsUsed=z.map((L)=>L.extensionName),$.extensionsRequired=V.map((L)=>L.extensionName),z.forEach((L)=>L.write(K)),KH1($),Q}}function KH1(Z){let J=[];for(let X in Z){let Y=Z[X];if(Array.isArray(Y)&&Y.length===0)J.push(X);else if(Y===null||Y==="")J.push(X);else if(Y&&typeof Y==="object"&&Object.keys(Y).length===0)J.push(X)}for(let X of J)delete Z[X]}var uU;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(uU||(uU={}));class Ac{constructor(){this._logger=j5.DEFAULT_INSTANCE,this._extensions=new Set,this._dependencies={},this._vertexLayout=yU.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 X=Nc(J)?this._binaryToJSON(J):{json:JSON.parse(n0.decodeText(J)),resources:{}};return await this._readResourcesExternal(X,this.dirname(Z)),this._readResourcesInternal(X),X}async readJSON(Z){return Z=this._copyJSON(Z),this._readResourcesInternal(Z),Sc.read(Z,{extensions:Array.from(this._extensions),dependencies:this._dependencies,logger:this._logger})}async binaryToJSON(Z){let J=this._binaryToJSON(n0.assertView(Z));this._readResourcesInternal(J);let X=J.json;if(X.buffers&&X.buffers.some((Y)=>WH1(J,Y)))throw new Error("Cannot resolve external buffers with binaryToJSON().");else if(X.images&&X.images.some((Y)=>GH1(J,Y)))throw new Error("Cannot resolve external images with binaryToJSON().");return J}async readBinary(Z){return this.readJSON(await this.binaryToJSON(n0.assertView(Z)))}async writeJSON(Z,J={}){if(J.format===$Z.GLB&&Z.getRoot().listBuffers().length>1)throw new Error("GLB must have 0\u20131 buffers.");return _c.write(Z,{format:J.format||$Z.GLTF,basename:J.basename||"",logger:this._logger,vertexLayout:this._vertexLayout,dependencies:c6({},this._dependencies),extensions:Array.from(this._extensions)})}async writeBinary(Z){let{json:J,resources:X}=await this.writeJSON(Z,{format:$Z.GLB}),Y=new Uint32Array([1179937895,2,12]),$=JSON.stringify(J),Q=n0.pad(n0.encodeText($),32),K=n0.toView(new Uint32Array([Q.byteLength,1313821514])),W=n0.concat([K,Q]);Y[Y.length-1]+=W.byteLength;let G=Object.values(X)[0];if(!G||!G.byteLength)return n0.concat([n0.toView(Y),W]);let z=n0.pad(G,0),V=n0.toView(new Uint32Array([z.byteLength,5130562])),H=n0.concat([V,z]);return Y[Y.length-1]+=H.byteLength,n0.concat([n0.toView(Y),W,H])}async _readResourcesExternal(Z,J){var X=this;let Y=Z.json.images||[],$=Z.json.buffers||[],Q=[...Y,...$].map(async function(K){let W=K.uri;if(!W||W.match(/data:/))return Promise.resolve();Z.resources[W]=await X.readURI(X.resolve(J,W),"view"),X.lastReadBytes+=Z.resources[W].byteLength});await Promise.all(Q)}_readResourcesInternal(Z){function J($){if(!$.uri)return;if($.uri in Z.resources){n0.assertView(Z.resources[$.uri]);return}if($.uri.match(/data:/)){let Q=`__${Ec()}.${KZ.extension($.uri)}`;Z.resources[Q]=n0.createBufferFromDataURI($.uri),$.uri=Q}}(Z.json.images||[]).forEach(($)=>{if($.bufferView===void 0&&$.uri===void 0)throw new Error("Missing resource URI or buffer view.");J($)}),(Z.json.buffers||[]).forEach(J)}_copyJSON(Z){let{images:J,buffers:X}=Z.json;if(Z={json:c6({},Z.json),resources:c6({},Z.resources)},J)Z.json.images=J.map((Y)=>c6({},Y));if(X)Z.json.buffers=X.map((Y)=>c6({},Y));return Z}_binaryToJSON(Z){if(!Nc(Z))throw new Error("Invalid glTF 2.0 binary.");let J=new Uint32Array(Z.buffer,Z.byteOffset+12,2);if(J[1]!==uU.JSON)throw new Error("Missing required GLB JSON chunk.");let X=20,Y=J[0],$=n0.decodeText(n0.toView(Z,X,Y)),Q=JSON.parse($),K=X+Y;if(Z.byteLength<=K)return{json:Q,resources:{}};let W=new Uint32Array(Z.buffer,Z.byteOffset+K,2);if(W[1]!==uU.BIN)return{json:Q,resources:{}};let G=W[0],z=n0.toView(Z,K+8,G);return{json:Q,resources:{[bU]:z}}}}function WH1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)}function GH1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)&&J.bufferView===void 0}function Nc(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 vP extends Ac{constructor(Z=null,J=j9.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(),j9.isAbsoluteURL(Z)){if(!this._fetchEnabled||!this._fetch)throw new Error("Network request blocked. Allow HTTP requests explicitly, if needed.");let X=await this._fetch(Z,this._fetchConfig);switch(J){case"view":return new Uint8Array(await X.arrayBuffer());case"text":return X.text()}}else switch(J){case"view":return this._fs.readFile(Z);case"text":return this._fs.readFile(Z,"utf8")}}resolve(Z,J){if(j9.isAbsoluteURL(Z)||j9.isAbsoluteURL(J))return j9.resolve(Z,J);return this._path.resolve(Z,decodeURIComponent(J))}dirname(Z){if(j9.isAbsoluteURL(Z))return j9.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 X=this;this.lastWriteBytes=0;let{json:Y,resources:$}=await this.writeJSON(J,{format:$Z.GLTF,basename:KZ.basename(Z)}),{_fs:Q,_path:K}=this,W=K.dirname(Z),G=JSON.stringify(Y,null,2);await Q.writeFile(Z,G),this.lastWriteBytes+=G.length;for(let z of zH1(Object.keys($),10))await Promise.all(z.map(async function(V){if(j9.isAbsoluteURL(V)){if(j9.extension(V)==="bin")throw new Error(`Cannot write buffer to path "${V}".`);return}let H=K.join(W,decodeURIComponent(V));await Q.mkdir(K.dirname(H),{recursive:!0}),await Q.writeFile(H,$[V]),X.lastWriteBytes+=$[V].byteLength}))}async _writeGLB(Z,J){let X=await this.writeBinary(J);await this._fs.writeFile(Z,X),this.lastWriteBytes=X.byteLength}}function zH1(Z,J){let X=[];for(let Y=0,$=Z.length;Y<$;Y+=J){let Q=[];for(let K=0;K<J&&Y+K<$;K++)Q.push(Z[Y+K]);X.push(Q)}return X}var Ii=t(SP(),1),vi=t(qi(),1),ZL1=t(Ei(),1);async function JL1(Z,J){if(!(Z instanceof Uint8Array))throw new Error("[ndarray-pixels] Input must be Uint8Array or Buffer.");let{data:X,info:Y}=await vi.default(Z).ensureAlpha().raw().toBuffer({resolveWithObject:!0});return Ii.default(new Uint8Array(X),[Y.width,Y.height,4],[4,4*Y.width|0,1],0)}async function Si(Z,J){return JL1(Z)}var XL1="v4.1.3",zD="@glb.bin",s;(function(Z){Z.ACCESSOR="Accessor",Z.ANIMATION="Animation",Z.ANIMATION_CHANNEL="AnimationChannel",Z.ANIMATION_SAMPLER="AnimationSampler",Z.BUFFER="Buffer",Z.CAMERA="Camera",Z.MATERIAL="Material",Z.MESH="Mesh",Z.PRIMITIVE="Primitive",Z.PRIMITIVE_TARGET="PrimitiveTarget",Z.NODE="Node",Z.ROOT="Root",Z.SCENE="Scene",Z.SKIN="Skin",Z.TEXTURE="Texture",Z.TEXTURE_INFO="TextureInfo"})(s||(s={}));var _i;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(_i||(_i={}));var p5;(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"})(p5||(p5={}));var i5;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(i5||(i5={}));var YD;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(YD||(YD={}));var $D=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 YL1(){var Z=new $D(3);if($D!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function XD(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function $L1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=X[3]*Y+X[7]*$+X[11]*Q+X[15];return K=K||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/K,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/K,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/K,Z}(function(){var Z=YL1();return function(J,X,Y,$,Q,K){var W,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(W=Y;W<G;W+=X)Z[0]=J[W],Z[1]=J[W+1],Z[2]=J[W+2],Q(Z,Z,K),J[W]=Z[0],J[W+1]=Z[1],J[W+2]=Z[2];return J}})();function fi(Z){let J=bi(),X=Z.propertyType===s.NODE?[Z]:Z.listChildren();for(let Y of X)Y.traverse(($)=>{let Q=$.getMesh();if(!Q)return;let K=QL1(Q,$.getWorldMatrix());if(K.min.every(isFinite)&&K.max.every(isFinite))QD(K.min,J),QD(K.max,J)});return J}function QL1(Z,J){let X=bi();for(let Y of Z.listPrimitives()){let $=Y.getAttribute("POSITION"),Q=Y.getIndices();if(!$)continue;let K=[0,0,0],W=[0,0,0];for(let G=0,z=Q?Q.getCount():$.getCount();G<z;G++){let V=Q?Q.getScalar(G):G;K=$.getElement(V,K),W=$L1(W,K,J),QD(W,X)}}return X}function QD(Z,J){for(let X=0;X<3;X++)J.min[X]=Math.min(Z[X],J.min[X]),J.max[X]=Math.max(Z[X],J.max[X])}function bi(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class k6{static createBufferFromDataURI(Z){if(typeof Buffer==="undefined"){let J=atob(Z.split(",")[1]),X=new Uint8Array(J.length);for(let Y=0;Y<J.length;Y++)X[Y]=J.charCodeAt(Y);return X}else{let J=Z.split(",")[1],X=Z.indexOf("base64")>=0;return Buffer.from(J,X?"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 $ of Z)J+=$.byteLength;let X=new Uint8Array(J),Y=0;for(let $ of Z)X.set($,Y),Y+=$.byteLength;return X}static pad(Z,J=0){let X=this.padNumber(Z.byteLength);if(X===Z.byteLength)return Z;let Y=new Uint8Array(X);if(Y.set(Z),J!==0)for(let $=Z.byteLength;$<X;$++)Y[$]=J;return Y}static padNumber(Z){return Math.ceil(Z/4)*4}static equals(Z,J){if(Z===J)return!0;if(Z.byteLength!==J.byteLength)return!1;let X=Z.byteLength;while(X--)if(Z[X]!==J[X])return!1;return!0}static toView(Z,J=0,X=1/0){return new Uint8Array(Z.buffer,Z.byteOffset+J,Math.min(Z.byteLength,X))}static assertView(Z){if(Z&&!ArrayBuffer.isView(Z))throw new Error(`Method requires Uint8Array parameter; received "${typeof Z}".`);return Z}}class yi{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),X,Y;while(J.byteLength){if(X=J.getUint16(0,!1),KL1(J,X),Y=J.getUint8(X+1),Y===192||Y===193||Y===194)return[J.getUint16(X+7,!1),J.getUint16(X+5,!1)];J=new DataView(Z.buffer,J.byteOffset+X+2)}throw new TypeError("Invalid JPG, no size found")}getChannels(Z){return 3}}class O2{match(Z){return Z.length>=8&&Z[0]===137&&Z[1]===80&&Z[2]===78&&Z[3]===71&&Z[4]===13&&Z[5]===10&&Z[6]===26&&Z[7]===10}getSize(Z){let J=new DataView(Z.buffer,Z.byteOffset);if(k6.decodeText(Z.slice(12,16))===O2.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}}O2.PNG_FRIED_CHUNK_NAME="CgBI";class V4{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 X=0,Y=4,$=this.getSize(Z,J);if(!$)return null;while($[0]>1||$[1]>1)X+=$[0]*$[1]*Y,$[0]=Math.max(Math.floor($[0]/2),1),$[1]=Math.max(Math.floor($[1]/2),1);return X+=1*Y,X}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}`}}V4.impls={"image/jpeg":new yi,"image/png":new O2};function KL1(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 U3{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 V4.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 Ai(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function $Y(Z){if(Ai(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let X=J.prototype;if(Ai(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}var KD,WD;(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"})(WD||(WD={}));class $7{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=$7.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=$7.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=$7.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=$7.Verbosity.ERROR)console.error(Z)}}KD=$7;$7.Verbosity=WD;$7.DEFAULT_INSTANCE=new KD(KD.Verbosity.INFO);function WL1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],K=Z[5],W=Z[6],G=Z[7],z=Z[8],V=Z[9],H=Z[10],q=Z[11],F=Z[12],U=Z[13],w=Z[14],L=Z[15],j=J*K-X*Q,R=J*W-Y*Q,O=J*G-$*Q,N=X*W-Y*K,D=X*G-$*K,P=Y*G-$*W,C=z*U-V*F,T=z*w-H*F,k=z*L-q*F,A=V*w-H*U,S=V*L-q*U,x=H*L-q*w;return j*x-R*S+O*A+N*k-D*T+P*C}function GL1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=J[8],q=J[9],F=J[10],U=J[11],w=J[12],L=J[13],j=J[14],R=J[15],O=X[0],N=X[1],D=X[2],P=X[3];return Z[0]=O*Y+N*W+D*H+P*w,Z[1]=O*$+N*G+D*q+P*L,Z[2]=O*Q+N*z+D*F+P*j,Z[3]=O*K+N*V+D*U+P*R,O=X[4],N=X[5],D=X[6],P=X[7],Z[4]=O*Y+N*W+D*H+P*w,Z[5]=O*$+N*G+D*q+P*L,Z[6]=O*Q+N*z+D*F+P*j,Z[7]=O*K+N*V+D*U+P*R,O=X[8],N=X[9],D=X[10],P=X[11],Z[8]=O*Y+N*W+D*H+P*w,Z[9]=O*$+N*G+D*q+P*L,Z[10]=O*Q+N*z+D*F+P*j,Z[11]=O*K+N*V+D*U+P*R,O=X[12],N=X[13],D=X[14],P=X[15],Z[12]=O*Y+N*W+D*H+P*w,Z[13]=O*$+N*G+D*q+P*L,Z[14]=O*Q+N*z+D*F+P*j,Z[15]=O*K+N*V+D*U+P*R,Z}function zL1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[4],K=J[5],W=J[6],G=J[8],z=J[9],V=J[10];return Z[0]=Math.hypot(X,Y,$),Z[1]=Math.hypot(Q,K,W),Z[2]=Math.hypot(G,z,V),Z}function VL1(Z,J){var X=new $D(3);zL1(X,J);var Y=1/X[0],$=1/X[1],Q=1/X[2],K=J[0]*Y,W=J[1]*$,G=J[2]*Q,z=J[4]*Y,V=J[5]*$,H=J[6]*Q,q=J[8]*Y,F=J[9]*$,U=J[10]*Q,w=K+V+U,L=0;if(w>0)L=Math.sqrt(w+1)*2,Z[3]=0.25*L,Z[0]=(H-F)/L,Z[1]=(q-G)/L,Z[2]=(W-z)/L;else if(K>V&&K>U)L=Math.sqrt(1+K-V-U)*2,Z[3]=(H-F)/L,Z[0]=0.25*L,Z[1]=(W+z)/L,Z[2]=(q+G)/L;else if(V>U)L=Math.sqrt(1+V-K-U)*2,Z[3]=(q-G)/L,Z[0]=(W+z)/L,Z[1]=0.25*L,Z[2]=(H+F)/L;else L=Math.sqrt(1+U-K-V)*2,Z[3]=(W-z)/L,Z[0]=(q+G)/L,Z[1]=(H+F)/L,Z[2]=0.25*L;return Z}class W8{static identity(Z){return Z}static eq(Z,J,X=0.00001){if(Z.length!==J.length)return!1;for(let Y=0;Y<Z.length;Y++)if(Math.abs(Z[Y]-J[Y])>X)return!1;return!0}static clamp(Z,J,X){if(Z<J)return J;if(Z>X)return X;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(W8.clamp(Z,0,1)*65535);case 5121:return Math.round(W8.clamp(Z,0,1)*255);case 5122:return Math.round(W8.clamp(Z,-1,1)*32767);case 5120:return Math.round(W8.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,X,Y){let $=XD([Z[0],Z[1],Z[2]]),Q=XD([Z[4],Z[5],Z[6]]),K=XD([Z[8],Z[9],Z[10]]);if(WL1(Z)<0)$=-$;J[0]=Z[12],J[1]=Z[13],J[2]=Z[14];let G=Z.slice(),z=1/$,V=1/Q,H=1/K;G[0]*=z,G[1]*=z,G[2]*=z,G[4]*=V,G[5]*=V,G[6]*=V,G[8]*=H,G[9]*=H,G[10]*=H,VL1(X,G),Y[0]=$,Y[1]=Q,Y[2]=K}static compose(Z,J,X,Y){let $=Y,Q=J[0],K=J[1],W=J[2],G=J[3],z=Q+Q,V=K+K,H=W+W,q=Q*z,F=Q*V,U=Q*H,w=K*V,L=K*H,j=W*H,R=G*z,O=G*V,N=G*H,D=X[0],P=X[1],C=X[2];return $[0]=(1-(w+j))*D,$[1]=(F+N)*D,$[2]=(U-O)*D,$[3]=0,$[4]=(F-N)*P,$[5]=(1-(q+j))*P,$[6]=(L+R)*P,$[7]=0,$[8]=(U+O)*C,$[9]=(L-R)*C,$[10]=(1-(q+w))*C,$[11]=0,$[12]=Z[0],$[13]=Z[1],$[14]=Z[2],$[15]=1,$}}function HL1(Z,J){if(!!Z!==!!J)return!1;let X=Z.getChild(),Y=J.getChild();return X===Y||X.equals(Y)}function qL1(Z,J){if(!!Z!==!!J)return!1;let X=Z.values(),Y=J.values();if(X.length!==Y.length)return!1;for(let $=0;$<X.length;$++){let Q=X[$],K=Y[$];if(Q.getChild()===K.getChild())continue;if(!Q.getChild().equals(K.getChild()))return!1}return!0}function FL1(Z,J){if(!!Z!==!!J)return!1;let X=Z.keys(),Y=J.keys();if(X.length!==Y.length)return!1;for(let $ of X){let Q=Z.get($),K=J.get($);if(!!Q!==!!K)return!1;let W=Q.getChild(),G=K.getChild();if(W===G)continue;if(!W.equals(G))return!1}return!0}function gi(Z,J){if(Z===J)return!0;if(!!Z!==!!J||!Z||!J)return!1;if(Z.length!==J.length)return!1;for(let X=0;X<Z.length;X++)if(Z[X]!==J[X])return!1;return!0}function mi(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!$Y(Z)||!$Y(J))return Z===J;let X=Z,Y=J,$=0,Q=0,K;for(K in X)$++;for(K in Y)Q++;if($!==Q)return!1;for(K in X){let W=X[K],G=Y[K];if(w2(W)&&w2(G)){if(!gi(W,G))return!1}else if($Y(W)&&$Y(G)){if(!mi(W,G))return!1}else if(W!==G)return!1}return!0}function w2(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var xi="https://null.example";class VD{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return U3.basename(new URL(Z,xi).pathname)}static extension(Z){return U3.extension(new URL(Z,xi).pathname)}static resolve(Z,J){if(!this.isRelativePath(J))return J;let X=Z.split("/"),Y=J.split("/");X.pop();for(let $=0;$<Y.length;$++){if(Y[$]===".")continue;if(Y[$]==="..")X.pop();else X.push(Y[$])}return X.join("/")}static isAbsoluteURL(Z){return this.PROTOCOL_REGEXP.test(Z)}static isRelativePath(Z){return!/^(?:[a-zA-Z]+:)?\//.test(Z)}}VD.DEFAULT_INIT={};VD.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var UJ=(Z)=>Z,UL1=new Set;class M2 extends TQ{constructor(Z,J=""){super(Z);this[A0].name=J,this.init(),this.dispatchEvent({type:"create"})}getGraph(){return this.graph}getDefaults(){return Object.assign(super.getDefaults(),{name:"",extras:{}})}set(Z,J){if(Array.isArray(J))J=J.slice();return super.set(Z,J)}getName(){return this.get("name")}setName(Z){return this.set("name",Z)}getExtras(){return this.get("extras")}setExtras(Z){return this.set("extras",Z)}clone(){return new this.constructor(this.graph).copy(this,UJ)}copy(Z,J=UJ){for(let X in this[A0]){let Y=this[A0][X];if(Y instanceof w5){if(!this[G4].has(X))Y.dispose()}else if(Y instanceof D6||Y instanceof N0)for(let $ of Y.values())$.dispose();else if(Y instanceof r1)for(let $ of Y.values())$.dispose()}for(let X in Z[A0]){let Y=this[A0][X],$=Z[A0][X];if($ instanceof w5)if(this[G4].has(X))Y.getChild().copy(J($.getChild()),J);else this.setRef(X,J($.getChild()),$.getAttributes());else if($ instanceof N0||$ instanceof D6)for(let Q of $.values())this.addRef(X,J(Q.getChild()),Q.getAttributes());else if($ instanceof r1)for(let Q of $.keys()){let K=$.get(Q);this.setRefMap(X,Q,J(K.getChild()),K.getAttributes())}else if($Y($))this[A0][X]=JSON.parse(JSON.stringify($));else if(Array.isArray($)||$ instanceof ArrayBuffer||ArrayBuffer.isView($))this[A0][X]=$.slice();else this[A0][X]=$}return this}equals(Z,J=UL1){if(this===Z)return!0;if(this.propertyType!==Z.propertyType)return!1;for(let X in this[A0]){if(J.has(X))continue;let Y=this[A0][X],$=Z[A0][X];if(Y instanceof w5||$ instanceof w5){if(!HL1(Y,$))return!1}else if(Y instanceof N0||$ instanceof N0||Y instanceof D6||$ instanceof D6){if(!qL1(Y,$))return!1}else if(Y instanceof r1||$ instanceof r1){if(!FL1(Y,$))return!1}else if($Y(Y)||$Y($)){if(!mi(Y,$))return!1}else if(w2(Y)||w2($)){if(!gi(Y,$))return!1}else if(Y!==$)return!1}return!0}detach(){return this.graph.disconnectParents(this,(Z)=>Z.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}}class E6 extends M2{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new r1})}getExtension(Z){return this.getRefMap("extensions",Z)}setExtension(Z,J){if(J)J._validateParent(this);return this.setRefMap("extensions",Z,J)}listExtensions(){return this.listRefMapValues("extensions")}}class O0 extends E6{init(){this.propertyType=s.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:O0.Type.SCALAR,componentType:O0.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(Z){switch(Z){case O0.Type.SCALAR:return 1;case O0.Type.VEC2:return 2;case O0.Type.VEC3:return 3;case O0.Type.VEC4:return 4;case O0.Type.MAT2:return 4;case O0.Type.MAT3:return 9;case O0.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+Z)}}static getComponentSize(Z){switch(Z){case O0.ComponentType.BYTE:return 1;case O0.ComponentType.UNSIGNED_BYTE:return 1;case O0.ComponentType.SHORT:return 2;case O0.ComponentType.UNSIGNED_SHORT:return 2;case O0.ComponentType.UNSIGNED_INT:return 4;case O0.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+Z)}}getMinNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMin(Z),J)for(let $=0;$<X;$++)Z[$]=W8.decodeNormalizedInt(Z[$],Y);return Z}getMin(Z){let J=this.getArray(),X=this.getCount(),Y=this.getElementSize();for(let $=0;$<Y;$++)Z[$]=1/0;for(let $=0;$<X*Y;$+=Y)for(let Q=0;Q<Y;Q++){let K=J[$+Q];if(Number.isFinite(K))Z[Q]=Math.min(Z[Q],K)}return Z}getMaxNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMax(Z),J)for(let $=0;$<X;$++)Z[$]=W8.decodeNormalizedInt(Z[$],Y);return Z}getMax(Z){let J=this.get("array"),X=this.getCount(),Y=this.getElementSize();for(let $=0;$<Y;$++)Z[$]=-1/0;for(let $=0;$<X*Y;$+=Y)for(let Q=0;Q<Y;Q++){let K=J[$+Q];if(Number.isFinite(K))Z[Q]=Math.max(Z[Q],K)}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 O0.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(),X=this.getComponentType(),Y=this.getArray();if(this.getNormalized())return W8.decodeNormalizedInt(Y[Z*J],X);return Y[Z*J]}setScalar(Z,J){let X=this.getElementSize(),Y=this.getComponentType(),$=this.getArray();if(this.getNormalized())$[Z*X]=W8.encodeNormalizedInt(J,Y);else $[Z*X]=J;return this}getElement(Z,J){let X=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();for(let K=0;K<Y;K++)if(X)J[K]=W8.decodeNormalizedInt(Q[Z*Y+K],$);else J[K]=Q[Z*Y+K];return J}setElement(Z,J){let X=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();for(let K=0;K<Y;K++)if(X)Q[Z*Y+K]=W8.encodeNormalizedInt(J[K],$);else Q[Z*Y+K]=J[K];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?LL1(Z):O0.ComponentType.FLOAT),this.set("array",Z),this}getByteLength(){let Z=this.get("array");return Z?Z.byteLength:0}}O0.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};O0.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function LL1(Z){switch(Z.constructor){case Float32Array:return O0.ComponentType.FLOAT;case Uint32Array:return O0.ComponentType.UNSIGNED_INT;case Uint16Array:return O0.ComponentType.UNSIGNED_SHORT;case Uint8Array:return O0.ComponentType.UNSIGNED_BYTE;case Int16Array:return O0.ComponentType.SHORT;case Int8Array:return O0.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class HD extends E6{init(){this.propertyType=s.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new N0,samplers:new N0})}addChannel(Z){return this.addRef("channels",Z)}removeChannel(Z){return this.removeRef("channels",Z)}listChannels(){return this.listRefs("channels")}addSampler(Z){return this.addRef("samplers",Z)}removeSampler(Z){return this.removeRef("samplers",Z)}listSamplers(){return this.listRefs("samplers")}}class w3 extends E6{init(){this.propertyType=s.ANIMATION_CHANNEL}getDefaults(){return Object.assign(super.getDefaults(),{targetPath:null,targetNode:null,sampler:null})}getTargetPath(){return this.get("targetPath")}setTargetPath(Z){return this.set("targetPath",Z)}getTargetNode(){return this.getRef("targetNode")}setTargetNode(Z){return this.setRef("targetNode",Z)}getSampler(){return this.getRef("sampler")}setSampler(Z){return this.setRef("sampler",Z)}}w3.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class gQ extends E6{init(){this.propertyType=s.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:gQ.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:p5.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:p5.OTHER})}}gQ.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class qD extends E6{init(){this.propertyType=s.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(Z){return this.set("uri",Z)}}class B3 extends E6{init(){this.propertyType=s.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:B3.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)}}B3.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class n1 extends M2{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}n1.EXTENSION_NAME=void 0;class C1 extends E6{init(){this.propertyType=s.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:C1.WrapMode.REPEAT,wrapT:C1.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)}}C1.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};C1.MagFilter={NEAREST:9728,LINEAR:9729};C1.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:F2,G:U2,B:L2,A:wL1}=i5;class j3 extends E6{init(){this.propertyType=s.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:j3.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new C1(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new C1(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new C1(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new C1(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new C1(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:F2|U2|L2|wL1,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:F2|U2|L2,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:F2|U2|L2})}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:F2})}getRoughnessFactor(){return this.get("roughnessFactor")}setRoughnessFactor(Z){return this.set("roughnessFactor",Z)}getMetallicFactor(){return this.get("metallicFactor")}setMetallicFactor(Z){return this.set("metallicFactor",Z)}getMetallicRoughnessTexture(){return this.getRef("metallicRoughnessTexture")}getMetallicRoughnessTextureInfo(){return this.getRef("metallicRoughnessTexture")?this.getRef("metallicRoughnessTextureInfo"):null}setMetallicRoughnessTexture(Z){return this.setRef("metallicRoughnessTexture",Z,{channels:U2|L2})}}j3.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class FD extends E6{init(){this.propertyType=s.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new N0})}addPrimitive(Z){return this.addRef("primitives",Z)}removePrimitive(Z){return this.removeRef("primitives",Z)}listPrimitives(){return this.listRefs("primitives")}getWeights(){return this.get("weights")}setWeights(Z){return this.set("weights",Z)}}class UD extends E6{init(){this.propertyType=s.NODE}getDefaults(){return Object.assign(super.getDefaults(),{translation:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1],weights:[],camera:null,mesh:null,skin:null,children:new N0})}copy(Z,J=UJ){if(J===UJ)throw new Error("Node cannot be copied.");return super.copy(Z,J)}getTranslation(){return this.get("translation")}getRotation(){return this.get("rotation")}getScale(){return this.get("scale")}setTranslation(Z){return this.set("translation",Z)}setRotation(Z){return this.set("rotation",Z)}setScale(Z){return this.set("scale",Z)}getMatrix(){return W8.compose(this.get("translation"),this.get("rotation"),this.get("scale"),[])}setMatrix(Z){let J=this.get("translation").slice(),X=this.get("rotation").slice(),Y=this.get("scale").slice();return W8.decompose(Z,J,X,Y),this.set("translation",J).set("rotation",X).set("scale",Y)}getWorldTranslation(){let Z=[0,0,0];return W8.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return W8.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return W8.decompose(this.getWorldMatrix(),[0,0,0],[0,0,0,1],Z),Z}getWorldMatrix(){let Z=[];for(let Y=this;Y!=null;Y=Y.getParentNode())Z.push(Y);let J,X=Z.pop().getMatrix();while(J=Z.pop())GL1(X,X,J.getMatrix());return X}addChild(Z){let J=Z.getParentNode();if(J)J.removeChild(Z);for(let X of Z.listParents())if(X.propertyType===s.SCENE)X.removeChild(Z);return this.addRef("children",Z)}removeChild(Z){return this.removeRef("children",Z)}listChildren(){return this.listRefs("children")}getParentNode(){for(let Z of this.listParents())if(Z.propertyType===s.NODE)return Z;return null}getMesh(){return this.getRef("mesh")}setMesh(Z){return this.setRef("mesh",Z)}getCamera(){return this.getRef("camera")}setCamera(Z){return this.setRef("camera",Z)}getSkin(){return this.getRef("skin")}setSkin(Z){return this.setRef("skin",Z)}getWeights(){return this.get("weights")}setWeights(Z){return this.set("weights",Z)}traverse(Z){Z(this);for(let J of this.listChildren())J.traverse(Z);return this}}class LJ extends E6{init(){this.propertyType=s.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:LJ.Mode.TRIANGLES,material:null,indices:null,attributes:new r1,targets:new N0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:p5.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:p5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}getMaterial(){return this.getRef("material")}setMaterial(Z){return this.setRef("material",Z)}getMode(){return this.get("mode")}setMode(Z){return this.set("mode",Z)}listTargets(){return this.listRefs("targets")}addTarget(Z){return this.addRef("targets",Z)}removeTarget(Z){return this.removeRef("targets",Z)}}LJ.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class ui extends M2{init(){this.propertyType=s.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new r1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:p5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function B2(){return B2=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var X=arguments[J];for(var Y in X)({}).hasOwnProperty.call(X,Y)&&(Z[Y]=X[Y])}return Z},B2.apply(null,arguments)}class LD extends E6{init(){this.propertyType=s.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new N0})}copy(Z,J=UJ){if(J===UJ)throw new Error("Scene cannot be copied.");return super.copy(Z,J)}addChild(Z){let J=Z.getParentNode();if(J)J.removeChild(Z);return this.addRef("children",Z)}removeChild(Z){return this.removeRef("children",Z)}listChildren(){return this.listRefs("children")}traverse(Z){for(let J of this.listChildren())J.traverse(Z);return this}}class wD extends E6{init(){this.propertyType=s.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new N0})}getSkeleton(){return this.getRef("skeleton")}setSkeleton(Z){return this.setRef("skeleton",Z)}getInverseBindMatrices(){return this.getRef("inverseBindMatrices")}setInverseBindMatrices(Z){return this.setRef("inverseBindMatrices",Z,{usage:p5.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class BD extends E6{init(){this.propertyType=s.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||V4.extensionToMimeType(U3.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=V4.extensionToMimeType(U3.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",k6.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return V4.getSize(Z,this.getMimeType())}}class R2 extends E6{init(){this.propertyType=s.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${XL1}`,version:"2.0"},defaultScene:null,accessors:new N0,animations:new N0,buffers:new N0,cameras:new N0,materials:new N0,meshes:new N0,nodes:new N0,scenes:new N0,skins:new N0,textures:new N0})}constructor(Z){super(Z);this._extensions=new Set,Z.addEventListener("node:create",(J)=>{this._addChildOfRoot(J.target)})}clone(){throw new Error("Root cannot be cloned.")}copy(Z,J=UJ){if(J===UJ)throw new Error("Root cannot be copied.");this.set("asset",B2({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(B2({},Z.getExtras())),this.setDefaultScene(Z.getDefaultScene()?J(Z.getDefaultScene()):null);for(let X of Z.listRefMapKeys("extensions")){let Y=Z.getExtension(X);this.setExtension(X,J(Y))}return this}_addChildOfRoot(Z){if(Z instanceof LD)this.addRef("scenes",Z);else if(Z instanceof UD)this.addRef("nodes",Z);else if(Z instanceof B3)this.addRef("cameras",Z);else if(Z instanceof wD)this.addRef("skins",Z);else if(Z instanceof FD)this.addRef("meshes",Z);else if(Z instanceof j3)this.addRef("materials",Z);else if(Z instanceof BD)this.addRef("textures",Z);else if(Z instanceof HD)this.addRef("animations",Z);else if(Z instanceof O0)this.addRef("accessors",Z);else if(Z instanceof qD)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 j2{static fromGraph(Z){return j2._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new CQ,this._root=new R2(this._graph),this._logger=$7.DEFAULT_INSTANCE,j2._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((X)=>X.name);for(let X of Z)await X(this,{stack:J});return this}createExtension(Z){let J=Z.EXTENSION_NAME;return this.getRoot().listExtensionsUsed().find((Y)=>Y.extensionName===J)||new Z(this)}createScene(Z=""){return new LD(this._graph,Z)}createNode(Z=""){return new UD(this._graph,Z)}createCamera(Z=""){return new B3(this._graph,Z)}createSkin(Z=""){return new wD(this._graph,Z)}createMesh(Z=""){return new FD(this._graph,Z)}createPrimitive(){return new LJ(this._graph)}createPrimitiveTarget(Z=""){return new ui(this._graph,Z)}createMaterial(Z=""){return new j3(this._graph,Z)}createTexture(Z=""){return new BD(this._graph,Z)}createAnimation(Z=""){return new HD(this._graph,Z)}createAnimationChannel(Z=""){return new w3(this._graph,Z)}createAnimationSampler(Z=""){return new gQ(this._graph,Z)}createAccessor(Z="",J=null){if(!J)J=this.getRoot().listBuffers()[0];return new O0(this._graph,Z).setBuffer(J)}createBuffer(Z=""){return new qD(this._graph,Z)}}j2._GRAPH_DOCUMENTS=new WeakMap;class E1{constructor(Z){this.extensionName="",this.prereadTypes=[],this.prewriteTypes=[],this.readDependencies=[],this.writeDependencies=[],this.document=void 0,this.required=!1,this.properties=new Set,this._listener=void 0,this.document=Z,Z.getRoot()._enableExtension(this),this._listener=(X)=>{let Y=X,$=Y.target;if($ instanceof n1&&$.extensionName===this.extensionName){if(Y.type==="node:create")this._addExtensionProperty($);if(Y.type==="node:dispose")this._removeExtensionProperty($)}};let J=Z.getGraph();J.addEventListener("node:create",this._listener),J.addEventListener("node:dispose",this._listener)}dispose(){this.document.getRoot()._disableExtension(this);let Z=this.document.getGraph();Z.removeEventListener("node:create",this._listener),Z.removeEventListener("node:dispose",this._listener);for(let J of this.properties)J.dispose()}static register(){}isRequired(){return this.required}setRequired(Z){return this.required=Z,this}listProperties(){return Array.from(this.properties)}_addExtensionProperty(Z){return this.properties.add(Z),this}_removeExtensionProperty(Z){return this.properties.delete(Z),this}install(Z,J){return this}preread(Z,J){return this}prewrite(Z,J){return this}}E1.EXTENSION_NAME=void 0;var gz6={logger:$7.DEFAULT_INSTANCE,extensions:[],dependencies:{}},mz6=new Set([s.BUFFER,s.TEXTURE,s.MATERIAL,s.MESH,s.PRIMITIVE,s.NODE,s.SCENE]);var L3;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(L3||(L3={}));class wJ{constructor(Z,J,X){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=X;let Y=Z.getRoot(),$=Y.listBuffers().length,Q=Y.listTextures().length;this.bufferURIGenerator=new GD($>1,()=>X.basename||"buffer"),this.imageURIGenerator=new GD(Q>1,(K)=>BL1(Z,K)||X.basename||"texture"),this.logger=Z.getLogger()}createTextureInfoDef(Z,J){let X={magFilter:J.getMagFilter()||void 0,minFilter:J.getMinFilter()||void 0,wrapS:J.getWrapS(),wrapT:J.getWrapT()},Y=JSON.stringify(X);if(!this.samplerDefIndexMap.has(Y))this.samplerDefIndexMap.set(Y,this.jsonDoc.json.samplers.length),this.jsonDoc.json.samplers.push(X);let $={source:this.imageIndexMap.get(Z),sampler:this.samplerDefIndexMap.get(Y)},Q=JSON.stringify($);if(!this.textureDefIndexMap.has(Q))this.textureDefIndexMap.set(Q,this.jsonDoc.json.textures.length),this.jsonDoc.json.textures.push($);let K={index:this.textureDefIndexMap.get(Q)};if(J.getTexCoord()!==0)K.texCoord=J.getTexCoord();if(Object.keys(J.getExtras()).length>0)K.extras=J.getExtras();return this.textureInfoDefMap.set(J,K),K}createPropertyDef(Z){let J={};if(Z.getName())J.name=Z.getName();if(Object.keys(Z.getExtras()).length>0)J.extras=Z.getExtras();return J}createAccessorDef(Z){let J=this.createPropertyDef(Z);if(J.type=Z.getType(),J.componentType=Z.getComponentType(),J.count=Z.getCount(),this._doc.getGraph().listParentEdges(Z).some((Y)=>Y.getName()==="attributes"&&Y.getAttributes().key==="POSITION"||Y.getName()==="input"))J.max=Z.getMax([]).map(Math.fround),J.min=Z.getMin([]).map(Math.fround);if(Z.getNormalized())J.normalized=Z.getNormalized();return J}createImageData(Z,J,X){if(this.options.format===YD.GLB)this.imageBufferViews.push(J),Z.bufferView=this.jsonDoc.json.bufferViews.length,this.jsonDoc.json.bufferViews.push({buffer:0,byteOffset:-1,byteLength:J.byteLength});else{let Y=V4.mimeTypeToExtension(X.getMimeType());Z.uri=this.imageURIGenerator.createURI(X,Y),this.assignResourceURI(Z.uri,J,!1)}}assignResourceURI(Z,J,X){let Y=this.jsonDoc.resources;if(!(Z in Y)){Y[Z]=J;return}if(J===Y[Z]){this.logger.warn(`Duplicate resource URI, "${Z}".`);return}let $=`Resource URI "${Z}" already assigned to different data.`;if(!X){this.logger.warn($);return}throw new Error($)}getAccessorUsage(Z){let J=this._accessorUsageMap.get(Z);if(J)return J;if(Z.getSparse())return p5.SPARSE;for(let X of this._doc.getGraph().listParentEdges(Z)){let{usage:Y}=X.getAttributes();if(Y)return Y;if(X.getParent().propertyType!==s.ROOT)this.logger.warn(`Missing attribute ".usage" on edge, "${X.getName()}".`)}return p5.OTHER}addAccessorToUsageGroup(Z,J){let X=this._accessorUsageMap.get(Z);if(X&&X!==J)throw new Error(`Accessor with usage "${X}" cannot be reused as "${J}".`);return this._accessorUsageMap.set(Z,J),this}}wJ.BufferViewTarget=L3;wJ.BufferViewUsage=p5;wJ.USAGE_TO_TARGET={[p5.ARRAY_BUFFER]:L3.ARRAY_BUFFER,[p5.ELEMENT_ARRAY_BUFFER]:L3.ELEMENT_ARRAY_BUFFER};class GD{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 X=this.basename(Z);return this.counter[X]=this.counter[X]||1,`${X}_${this.counter[X]++}.${J}`}}}function BL1(Z,J){let X=Z.getGraph().listParentEdges(J).find((Y)=>Y.getParent()!==Z.getRoot());return X?X.getName().replace(/texture$/i,""):""}var{UNSIGNED_INT:uz6,UNSIGNED_SHORT:dz6,UNSIGNED_BYTE:cz6}=O0.ComponentType,lz6=new Set([s.ACCESSOR,s.BUFFER,s.MATERIAL,s.MESH]);var hi;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(hi||(hi={}));var ci=163,li=166;function jL1(){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 mQ{constructor(Z,J,X,Y){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(Z.buffer,Z.byteOffset+J,X),this._littleEndian=Y,this._offset=0}_nextUint8(){let Z=this._dataView.getUint8(this._offset);return this._offset+=1,Z}_nextUint16(){let Z=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,Z}_nextUint32(){let Z=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,Z}_nextUint64(){let Z=this._dataView.getUint32(this._offset,this._littleEndian),J=this._dataView.getUint32(this._offset+4,this._littleEndian),X=Z+4294967296*J;return this._offset+=8,X}_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 X=this._offset,Y=0;while(this._dataView.getUint8(this._offset)!==J&&Y<Z)Y++,this._offset++;if(Y<Z)this._offset++;return new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+X,Y)}}var nz6=new Uint8Array([0]),n6=[171,75,84,88,32,50,48,187,13,10,26,10];function di(Z){return new TextDecoder().decode(Z)}function N2(Z){let J=new Uint8Array(Z.buffer,Z.byteOffset,n6.length);if(J[0]!==n6[0]||J[1]!==n6[1]||J[2]!==n6[2]||J[3]!==n6[3]||J[4]!==n6[4]||J[5]!==n6[5]||J[6]!==n6[6]||J[7]!==n6[7]||J[8]!==n6[8]||J[9]!==n6[9]||J[10]!==n6[10]||J[11]!==n6[11])throw new Error("Missing KTX 2.0 identifier.");let X=jL1(),Y=17*Uint32Array.BYTES_PER_ELEMENT,$=new mQ(Z,n6.length,Y,!0);X.vkFormat=$._nextUint32(),X.typeSize=$._nextUint32(),X.pixelWidth=$._nextUint32(),X.pixelHeight=$._nextUint32(),X.pixelDepth=$._nextUint32(),X.layerCount=$._nextUint32(),X.faceCount=$._nextUint32();let Q=$._nextUint32();X.supercompressionScheme=$._nextUint32();let K=$._nextUint32(),W=$._nextUint32(),G=$._nextUint32(),z=$._nextUint32(),V=$._nextUint64(),H=$._nextUint64(),q=Q*3*8,F=new mQ(Z,n6.length+Y,q,!0);for(let H6=0;H6<Q;H6++)X.levels.push({levelData:new Uint8Array(Z.buffer,Z.byteOffset+F._nextUint64(),F._nextUint64()),uncompressedByteLength:F._nextUint64()});let U=new mQ(Z,K,W,!0);U._skip(4);let w=U._nextUint16(),L=U._nextUint16(),j=U._nextUint16(),R=U._nextUint16(),O=U._nextUint8(),N=U._nextUint8(),D=U._nextUint8(),P=U._nextUint8(),C=[U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8()],T=[U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8()],A={vendorId:w,descriptorType:L,versionNumber:j,colorModel:O,colorPrimaries:N,transferFunction:D,flags:P,texelBlockDimension:C,bytesPlane:T,samples:[]},S=6,x=4,I=(R/4-S)/x;for(let H6=0;H6<I;H6++){let i7={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(i7.channelType&64)i7.sampleLower=U._nextInt32(),i7.sampleUpper=U._nextInt32();else i7.sampleLower=U._nextUint32(),i7.sampleUpper=U._nextUint32();A.samples[H6]=i7}X.dataFormatDescriptor.length=0,X.dataFormatDescriptor.push(A);let v=new mQ(Z,G,z,!0);while(v._offset<z){let H6=v._nextUint32(),i7=v._scan(H6),Mq=di(i7);if(X.keyValue[Mq]=v._nextUint8Array(H6-i7.byteLength-1),Mq.match(/^ktx/i)){let Uf=di(X.keyValue[Mq]);X.keyValue[Mq]=Uf.substring(0,Uf.lastIndexOf("\x00"))}let NX1=H6%4?4-H6%4:0;v._skip(NX1)}if(H<=0)return X;let f=new mQ(Z,V,H,!0),p=f._nextUint16(),n=f._nextUint16(),o=f._nextUint32(),J0=f._nextUint32(),Q0=f._nextUint32(),C0=f._nextUint32(),T0=[];for(let H6=0;H6<Q;H6++)T0.push({imageFlags:f._nextUint32(),rgbSliceByteOffset:f._nextUint32(),rgbSliceByteLength:f._nextUint32(),alphaSliceByteOffset:f._nextUint32(),alphaSliceByteLength:f._nextUint32()});let a0=V+f._offset,v8=a0+o,s1=v8+J0,u4=s1+Q0,r9=new Uint8Array(Z.buffer,Z.byteOffset+a0,o),t$=new Uint8Array(Z.buffer,Z.byteOffset+v8,J0),e$=new Uint8Array(Z.buffer,Z.byteOffset+s1,Q0),AX=new Uint8Array(Z.buffer,Z.byteOffset+u4,C0);return X.globalData={endpointCount:p,selectorCount:n,imageDescs:T0,endpointsData:r9,selectorsData:t$,tablesData:e$,extendedData:AX},X}var ND="EXT_mesh_gpu_instancing",OD="EXT_meshopt_compression",OL1="EXT_texture_webp",ML1="EXT_texture_avif",$n="KHR_draco_mesh_compression",PD="KHR_lights_punctual",DD="KHR_materials_anisotropy",CD="KHR_materials_clearcoat",TD="KHR_materials_diffuse_transmission",kD="KHR_materials_dispersion",ED="KHR_materials_emissive_strength",ID="KHR_materials_ior",vD="KHR_materials_iridescence",SD="KHR_materials_pbrSpecularGlossiness",_D="KHR_materials_sheen",AD="KHR_materials_specular",xD="KHR_materials_transmission",hD="KHR_materials_unlit",fD="KHR_materials_volume",OY="KHR_materials_variants",RL1="KHR_mesh_quantization",NL1="KHR_texture_basisu",bD="KHR_texture_transform",P2="KHR_xmp_json_ld",MD="INSTANCE_ATTRIBUTE";class yD extends n1{init(){this.extensionName=ND,this.propertyType="InstancedMesh",this.parentTypes=[s.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new r1})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:MD})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}yD.EXTENSION_NAME=ND;var QY=ND;class T2 extends E1{constructor(...Z){super(...Z);this.extensionName=QY,this.provideTypes=[s.NODE],this.prewriteTypes=[s.ACCESSOR]}createInstancedMesh(){return new yD(this.document.getGraph())}read(Z){return(Z.jsonDoc.json.nodes||[]).forEach((Y,$)=>{if(!Y.extensions||!Y.extensions[QY])return;let Q=Y.extensions[QY],K=this.createInstancedMesh();for(let W in Q.attributes)K.setAttribute(W,Z.accessors[Q.attributes[W]]);Z.nodes[$].setExtension(QY,K)}),this}prewrite(Z){Z.accessorUsageGroupedByParent.add(MD);for(let J of this.properties)for(let X of J.listAttributes())Z.addAccessorToUsageGroup(X,MD);return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listNodes().forEach((X)=>{let Y=X.getExtension(QY);if(Y){let $=Z.nodeIndexMap.get(X),Q=J.json.nodes[$],K={attributes:{}};Y.listSemantics().forEach((W)=>{let G=Y.getAttribute(W);K.attributes[W]=Z.accessorIndexMap.get(G)}),Q.extensions=Q.extensions||{},Q.extensions[QY]=K}}),this}}T2.EXTENSION_NAME=QY;function VZ(){return VZ=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var X=arguments[J];for(var Y in X)({}).hasOwnProperty.call(X,Y)&&(Z[Y]=X[Y])}return Z},VZ.apply(null,arguments)}var N3;(function(Z){Z.QUANTIZE="quantize",Z.FILTER="filter"})(N3||(N3={}));var dQ;(function(Z){Z.ATTRIBUTES="ATTRIBUTES",Z.TRIANGLES="TRIANGLES",Z.INDICES="INDICES"})(dQ||(dQ={}));var G8;(function(Z){Z.NONE="NONE",Z.OCTAHEDRAL="OCTAHEDRAL",Z.QUATERNION="QUATERNION",Z.EXPONENTIAL="EXPONENTIAL"})(G8||(G8={}));var{BYTE:PL1,SHORT:pi,FLOAT:DL1}=O0.ComponentType,{encodeNormalizedInt:ii,decodeNormalizedInt:RD}=W8;function CL1(Z,J,X,Y){let{filter:$,bits:Q}=Y,K={array:Z.getArray(),byteStride:Z.getElementSize()*Z.getComponentSize(),componentType:Z.getComponentType(),normalized:Z.getNormalized()};if(X!==dQ.ATTRIBUTES)return K;if($!==G8.NONE){let W=Z.getNormalized()?TL1(Z):new Float32Array(K.array);switch($){case G8.EXPONENTIAL:K.byteStride=Z.getElementSize()*4,K.componentType=DL1,K.normalized=!1,K.array=J.encodeFilterExp(W,Z.getCount(),K.byteStride,Q);break;case G8.OCTAHEDRAL:K.byteStride=Q>8?8:4,K.componentType=Q>8?pi:PL1,K.normalized=!0,W=Z.getElementSize()===3?EL1(W):W,K.array=J.encodeFilterOct(W,Z.getCount(),K.byteStride,Q);break;case G8.QUATERNION:K.byteStride=8,K.componentType=pi,K.normalized=!0,K.array=J.encodeFilterQuat(W,Z.getCount(),K.byteStride,Q);break;default:throw new Error("Invalid filter.")}if(K.min=Z.getMin([]),K.max=Z.getMax([]),Z.getNormalized())K.min=K.min.map((G)=>RD(G,Z.getComponentType())),K.max=K.max.map((G)=>RD(G,Z.getComponentType()));if(K.normalized)K.min=K.min.map((G)=>ii(G,K.componentType)),K.max=K.max.map((G)=>ii(G,K.componentType))}else if(K.byteStride%4)K.array=kL1(K.array,Z.getElementSize()),K.byteStride=K.array.byteLength/Z.getCount();return K}function TL1(Z){let J=Z.getComponentType(),X=Z.getArray(),Y=new Float32Array(X.length);for(let $=0;$<X.length;$++)Y[$]=RD(X[$],J);return Y}function kL1(Z,J){let Y=k6.padNumber(Z.BYTES_PER_ELEMENT*J)/Z.BYTES_PER_ELEMENT,$=Z.length/J,Q=new Z.constructor($*Y);for(let K=0;K*J<Z.length;K++)for(let W=0;W<J;W++)Q[K*Y+W]=Z[K*J+W];return Q}function EL1(Z){let J=new Float32Array(Z.length*4/3);for(let X=0,Y=Z.length/3;X<Y;X++)J[X*4]=Z[X*3],J[X*4+1]=Z[X*3+1],J[X*4+2]=Z[X*3+2];return J}function IL1(Z,J){if(J===wJ.BufferViewUsage.ELEMENT_ARRAY_BUFFER)return Z.listParents().some((Y)=>{return Y instanceof LJ&&Y.getMode()===LJ.Mode.TRIANGLES})?dQ.TRIANGLES:dQ.INDICES;return dQ.ATTRIBUTES}function vL1(Z,J){let X=J.getGraph().listParentEdges(Z).filter((Y)=>!(Y.getParent()instanceof R2));for(let Y of X){let $=Y.getName(),Q=Y.getAttributes().key||"",K=Y.getParent().propertyType===s.PRIMITIVE_TARGET;if($==="indices")return{filter:G8.NONE};if($==="attributes"){if(Q==="POSITION")return{filter:G8.NONE};if(Q==="TEXCOORD_0")return{filter:G8.NONE};if(Q.startsWith("JOINTS_"))return{filter:G8.NONE};if(Q.startsWith("WEIGHTS_"))return{filter:G8.NONE};if(Q==="NORMAL"||Q==="TANGENT")return K?{filter:G8.NONE}:{filter:G8.OCTAHEDRAL,bits:8}}if($==="output"){let W=Qn(Z);if(W==="rotation")return{filter:G8.QUATERNION,bits:16};if(W==="translation")return{filter:G8.EXPONENTIAL,bits:12};if(W==="scale")return{filter:G8.EXPONENTIAL,bits:12};return{filter:G8.NONE}}if($==="input")return{filter:G8.NONE};if($==="inverseBindMatrices")return{filter:G8.NONE}}return{filter:G8.NONE}}function Qn(Z){for(let J of Z.listParents()){if(!(J instanceof gQ))continue;for(let X of J.listParents()){if(!(X instanceof w3))continue;return X.getTargetPath()}}return null}function SL1(Z){if(!Z.extensions||!Z.extensions[OD])return!1;return!!Z.extensions[OD].fallback}var a6=OD,ni={method:N3.QUANTIZE};class D3 extends E1{constructor(...Z){super(...Z);this.extensionName=a6,this.prereadTypes=[s.BUFFER,s.PRIMITIVE],this.prewriteTypes=[s.BUFFER,s.ACCESSOR],this.readDependencies=["meshopt.decoder"],this.writeDependencies=["meshopt.encoder"],this._decoder=null,this._decoderFallbackBufferMap=new Map,this._encoder=null,this._encoderOptions=ni,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=VZ({},ni,Z),this}preread(Z,J){if(!this._decoder){if(!this.isRequired())return this;throw new Error(`[${a6}] Please install extension dependency, "meshopt.decoder".`)}if(!this._decoder.supported){if(!this.isRequired())return this;throw new Error(`[${a6}]: Missing WASM support.`)}if(J===s.BUFFER)this._prereadBuffers(Z);else if(J===s.PRIMITIVE)this._prereadPrimitives(Z);return this}_prereadBuffers(Z){let J=Z.jsonDoc;(J.json.bufferViews||[]).forEach((Y,$)=>{if(!Y.extensions||!Y.extensions[a6])return;let Q=Y.extensions[a6],K=Q.byteOffset||0,W=Q.byteLength||0,G=Q.count,z=Q.byteStride,V=new Uint8Array(G*z),H=J.json.buffers[Q.buffer],q=H.uri?J.resources[H.uri]:J.resources[zD],F=k6.toView(q,K,W);this._decoder.decodeGltfBuffer(V,G,z,F,Q.mode,Q.filter),Z.bufferViews[$]=V})}_prereadPrimitives(Z){let J=Z.jsonDoc;(J.json.bufferViews||[]).forEach((Y)=>{if(!Y.extensions||!Y.extensions[a6])return;let $=Y.extensions[a6],Q=Z.buffers[$.buffer],K=Z.buffers[Y.buffer],W=J.json.buffers[Y.buffer];if(SL1(W))this._decoderFallbackBufferMap.set(K,Q)})}read(Z){if(!this.isRequired())return this;for(let[J,X]of this._decoderFallbackBufferMap){for(let Y of J.listParents())if(Y instanceof O0)Y.swap(J,X);J.dispose()}return this}prewrite(Z,J){if(J===s.ACCESSOR)this._prewriteAccessors(Z);else if(J===s.BUFFER)this._prewriteBuffers(Z);return this}_prewriteAccessors(Z){let J=Z.jsonDoc.json,X=this._encoder,Y=this._encoderOptions,$=this.document.getGraph(),Q=this.document.createBuffer(),K=this.document.getRoot().listBuffers().indexOf(Q),W=1,G=new Map,z=(V)=>{for(let H of $.listParents(V)){if(H.propertyType===s.ROOT)continue;let q=G.get(V);if(q===void 0)G.set(V,q=W++);return q}return-1};this._encoderFallbackBuffer=Q,this._encoderBufferViews={},this._encoderBufferViewData={},this._encoderBufferViewAccessors={};for(let V of this.document.getRoot().listAccessors()){if(Qn(V)==="weights")continue;if(V.getSparse())continue;let H=Z.getAccessorUsage(V),q=Z.accessorUsageGroupedByParent.has(H)?z(V):null,F=IL1(V,H),U=Y.method===N3.FILTER?vL1(V,this.document):{filter:G8.NONE},w=CL1(V,X,F,U),{array:L,byteStride:j}=w,R=V.getBuffer();if(!R)throw new Error(`${a6}: Missing buffer for accessor.`);let O=this.document.getRoot().listBuffers().indexOf(R),N=[H,q,F,U.filter,j,O].join(":"),D=this._encoderBufferViews[N],P=this._encoderBufferViewData[N],C=this._encoderBufferViewAccessors[N];if(!D||!P)C=this._encoderBufferViewAccessors[N]=[],P=this._encoderBufferViewData[N]=[],D=this._encoderBufferViews[N]={buffer:K,target:wJ.USAGE_TO_TARGET[H],byteOffset:0,byteLength:0,byteStride:H===wJ.BufferViewUsage.ARRAY_BUFFER?j:void 0,extensions:{[a6]:{buffer:O,byteOffset:0,byteLength:0,mode:F,filter:U.filter!==G8.NONE?U.filter:void 0,byteStride:j,count:0}}};let T=Z.createAccessorDef(V);if(T.componentType=w.componentType,T.normalized=w.normalized,T.byteOffset=D.byteLength,T.min&&w.min)T.min=w.min;if(T.max&&w.max)T.max=w.max;Z.accessorIndexMap.set(V,J.accessors.length),J.accessors.push(T),C.push(T),P.push(new Uint8Array(L.buffer,L.byteOffset,L.byteLength)),D.byteLength+=L.byteLength,D.extensions.EXT_meshopt_compression.count+=V.getCount()}}_prewriteBuffers(Z){let J=this._encoder;for(let X in this._encoderBufferViews){let Y=this._encoderBufferViews[X],$=this._encoderBufferViewData[X],Q=this.document.getRoot().listBuffers()[Y.extensions[a6].buffer],K=Z.otherBufferViews.get(Q)||[],{count:W,byteStride:G,mode:z}=Y.extensions[a6],V=k6.concat($),H=J.encodeGltfBuffer(V,W,G,z),q=k6.pad(H);Y.extensions[a6].byteLength=H.byteLength,$.length=0,$.push(q),K.push(q),Z.otherBufferViews.set(Q,K)}}write(Z){let J=0;for(let Q in this._encoderBufferViews){let K=this._encoderBufferViews[Q],W=this._encoderBufferViewData[Q][0],G=Z.otherBufferViewsIndexMap.get(W),z=this._encoderBufferViewAccessors[Q];for(let F of z)F.bufferView=G;let V=Z.jsonDoc.json.bufferViews[G],H=V.byteOffset||0;Object.assign(V,K),V.byteOffset=J;let q=V.extensions[a6];q.byteOffset=H,J+=k6.padNumber(K.byteLength)}let X=this._encoderFallbackBuffer,Y=Z.bufferIndexMap.get(X),$=Z.jsonDoc.json.buffers[Y];return $.byteLength=J,$.extensions={[a6]:{fallback:!0}},X.dispose(),this}}D3.EXTENSION_NAME=a6;D3.EncoderMethod=N3;var O3=ML1;class Kn{match(Z){return Z.length>=12&&k6.decodeText(Z.slice(4,12))==="ftypavif"}getSize(Z){if(!this.match(Z))return null;let J=new DataView(Z.buffer,Z.byteOffset,Z.byteLength),X=ai(J,0);if(!X)return null;let Y=X.end;while(X=ai(J,Y))if(X.type==="meta")Y=X.start+4;else if(X.type==="iprp"||X.type==="ipco")Y=X.start;else if(X.type==="ispe")return[J.getUint32(X.start+4),J.getUint32(X.start+8)];else if(X.type==="mdat")break;else Y=X.end;return null}getChannels(Z){return 4}}class k2 extends E1{constructor(...Z){super(...Z);this.extensionName=O3,this.prereadTypes=[s.TEXTURE]}static register(){V4.registerFormat("image/avif",new Kn)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((X)=>{if(X.extensions&&X.extensions[O3])X.source=X.extensions[O3].source}),this}read(Z){return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listTextures().forEach((X)=>{if(X.getMimeType()==="image/avif"){let Y=Z.imageIndexMap.get(X);(J.json.textures||[]).forEach((Q)=>{if(Q.source===Y)Q.extensions=Q.extensions||{},Q.extensions[O3]={source:Q.source},delete Q.source})}}),this}}k2.EXTENSION_NAME=O3;function ai(Z,J){if(Z.byteLength<4+J)return null;let X=Z.getUint32(J);if(Z.byteLength<X+J||X<8)return null;return{type:k6.decodeText(new Uint8Array(Z.buffer,Z.byteOffset+J+4,4)),start:J+8,end:J+X}}var M3=OL1;class Wn{match(Z){return Z.length>=12&&Z[8]===87&&Z[9]===69&&Z[10]===66&&Z[11]===80}getSize(Z){let J=k6.decodeText(Z.slice(0,4)),X=k6.decodeText(Z.slice(8,12));if(J!=="RIFF"||X!=="WEBP")return null;let Y=new DataView(Z.buffer,Z.byteOffset),$=12;while($<Y.byteLength){let Q=k6.decodeText(new Uint8Array([Y.getUint8($),Y.getUint8($+1),Y.getUint8($+2),Y.getUint8($+3)])),K=Y.getUint32($+4,!0);if(Q==="VP8 "){let W=Y.getInt16($+14,!0)&16383,G=Y.getInt16($+16,!0)&16383;return[W,G]}else if(Q==="VP8L"){let W=Y.getUint8($+9),G=Y.getUint8($+10),z=Y.getUint8($+11),V=Y.getUint8($+12),H=1+((G&63)<<8|W),q=1+((V&15)<<10|z<<2|(G&192)>>6);return[H,q]}$+=8+K+K%2}return null}getChannels(Z){return 4}}class E2 extends E1{constructor(...Z){super(...Z);this.extensionName=M3,this.prereadTypes=[s.TEXTURE]}static register(){V4.registerFormat("image/webp",new Wn)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((X)=>{if(X.extensions&&X.extensions[M3])X.source=X.extensions[M3].source}),this}read(Z){return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listTextures().forEach((X)=>{if(X.getMimeType()==="image/webp"){let Y=Z.imageIndexMap.get(X);(J.json.textures||[]).forEach((Q)=>{if(Q.source===Y)Q.extensions=Q.extensions||{},Q.extensions[M3]={source:Q.source},delete Q.source})}}),this}}E2.EXTENSION_NAME=M3;var si=$n,d8,Gn,zn;function _L1(Z,J){let X=new d8.DecoderBuffer;try{if(X.Init(J,J.length),Z.GetEncodedGeometryType(X)!==d8.TRIANGULAR_MESH)throw new Error(`[${si}] Unknown geometry type.`);let $=new d8.Mesh;if(!Z.DecodeBufferToMesh(X,$).ok()||$.ptr===0)throw new Error(`[${si}] Decoding failure.`);return $}finally{d8.destroy(X)}}function AL1(Z,J){let Y=J.num_faces()*3,$,Q;if(J.num_points()<=65534){let K=Y*Uint16Array.BYTES_PER_ELEMENT;$=d8._malloc(K),Z.GetTrianglesUInt16Array(J,K,$),Q=new Uint16Array(d8.HEAPU16.buffer,$,Y).slice()}else{let K=Y*Uint32Array.BYTES_PER_ELEMENT;$=d8._malloc(K),Z.GetTrianglesUInt32Array(J,K,$),Q=new Uint32Array(d8.HEAPU32.buffer,$,Y).slice()}return d8._free($),Q}function xL1(Z,J,X,Y){let $=zn[Y.componentType],Q=Gn[Y.componentType],K=X.num_components(),G=J.num_points()*K,z=G*Q.BYTES_PER_ELEMENT,V=d8._malloc(z);Z.GetAttributeDataArrayForAllPoints(J,X,$,z,V);let H=new Q(d8.HEAPF32.buffer,V,G).slice();return d8._free(V),H}function hL1(Z){d8=Z,Gn={[O0.ComponentType.FLOAT]:Float32Array,[O0.ComponentType.UNSIGNED_INT]:Uint32Array,[O0.ComponentType.UNSIGNED_SHORT]:Uint16Array,[O0.ComponentType.UNSIGNED_BYTE]:Uint8Array,[O0.ComponentType.SHORT]:Int16Array,[O0.ComponentType.BYTE]:Int8Array},zn={[O0.ComponentType.FLOAT]:d8.DT_FLOAT32,[O0.ComponentType.UNSIGNED_INT]:d8.DT_UINT32,[O0.ComponentType.UNSIGNED_SHORT]:d8.DT_UINT16,[O0.ComponentType.UNSIGNED_BYTE]:d8.DT_UINT8,[O0.ComponentType.SHORT]:d8.DT_INT16,[O0.ComponentType.BYTE]:d8.DT_INT8}}var M9,P3;(function(Z){Z[Z.EDGEBREAKER=1]="EDGEBREAKER",Z[Z.SEQUENTIAL=0]="SEQUENTIAL"})(P3||(P3={}));var R9;(function(Z){Z.POSITION="POSITION",Z.NORMAL="NORMAL",Z.COLOR="COLOR",Z.TEX_COORD="TEX_COORD",Z.GENERIC="GENERIC"})(R9||(R9={}));var Vn={[R9.POSITION]:14,[R9.NORMAL]:10,[R9.COLOR]:8,[R9.TEX_COORD]:12,[R9.GENERIC]:12},oi={decodeSpeed:5,encodeSpeed:5,method:P3.EDGEBREAKER,quantizationBits:Vn,quantizationVolume:"mesh"};function fL1(Z){M9=Z}function bL1(Z,J=oi){let X=VZ({},oi,J);X.quantizationBits=VZ({},Vn,J.quantizationBits);let Y=new M9.MeshBuilder,$=new M9.Mesh,Q=new M9.ExpertEncoder($),K={},W=new M9.DracoInt8Array,G=Z.listTargets().length>0,z=!1;for(let w of Z.listSemantics()){let L=Z.getAttribute(w);if(L.getSparse()){z=!0;continue}let j=yL1(w),R=gL1(Y,L.getComponentType(),$,M9[j],L.getCount(),L.getElementSize(),L.getArray());if(R===-1)throw new Error(`Error compressing "${w}" attribute.`);if(K[w]=R,X.quantizationVolume==="mesh"||w!=="POSITION")Q.SetAttributeQuantization(R,X.quantizationBits[j]);else if(typeof X.quantizationVolume==="object"){let{quantizationVolume:O}=X,N=Math.max(O.max[0]-O.min[0],O.max[1]-O.min[1],O.max[2]-O.min[2]);Q.SetAttributeExplicitQuantization(R,X.quantizationBits[j],L.getElementSize(),O.min,N)}else throw new Error("Invalid quantization volume state.")}let V=Z.getIndices();if(!V)throw new D2("Primitive must have indices.");if(Y.AddFacesToMesh($,V.getCount()/3,V.getArray()),Q.SetSpeedOptions(X.encodeSpeed,X.decodeSpeed),Q.SetTrackEncodedProperties(!0),X.method===P3.SEQUENTIAL||G||z)Q.SetEncodingMethod(M9.MESH_SEQUENTIAL_ENCODING);else Q.SetEncodingMethod(M9.MESH_EDGEBREAKER_ENCODING);let H=Q.EncodeToDracoBuffer(!(G||z),W);if(H<=0)throw new D2("Error applying Draco compression.");let q=new Uint8Array(H);for(let w=0;w<H;++w)q[w]=W.GetValue(w);let F=Q.GetNumberOfEncodedPoints(),U=Q.GetNumberOfEncodedFaces()*3;return M9.destroy(W),M9.destroy($),M9.destroy(Y),M9.destroy(Q),{numVertices:F,numIndices:U,data:q,attributeIDs:K}}function yL1(Z){if(Z==="POSITION")return R9.POSITION;else if(Z==="NORMAL")return R9.NORMAL;else if(Z.startsWith("COLOR_"))return R9.COLOR;else if(Z.startsWith("TEXCOORD_"))return R9.TEX_COORD;return R9.GENERIC}function gL1(Z,J,X,Y,$,Q,K){switch(J){case O0.ComponentType.UNSIGNED_BYTE:return Z.AddUInt8Attribute(X,Y,$,Q,K);case O0.ComponentType.BYTE:return Z.AddInt8Attribute(X,Y,$,Q,K);case O0.ComponentType.UNSIGNED_SHORT:return Z.AddUInt16Attribute(X,Y,$,Q,K);case O0.ComponentType.SHORT:return Z.AddInt16Attribute(X,Y,$,Q,K);case O0.ComponentType.UNSIGNED_INT:return Z.AddUInt32Attribute(X,Y,$,Q,K);case O0.ComponentType.FLOAT:return Z.AddFloatAttribute(X,Y,$,Q,K);default:throw new Error(`Unexpected component type, "${J}".`)}}class D2 extends Error{}var N8=$n;class C3 extends E1{constructor(...Z){super(...Z);this.extensionName=N8,this.prereadTypes=[s.PRIMITIVE],this.prewriteTypes=[s.ACCESSOR],this.readDependencies=["draco3d.decoder"],this.writeDependencies=["draco3d.encoder"],this._decoderModule=null,this._encoderModule=null,this._encoderOptions={}}install(Z,J){if(Z==="draco3d.decoder")this._decoderModule=J,hL1(this._decoderModule);if(Z==="draco3d.encoder")this._encoderModule=J,fL1(this._encoderModule);return this}setEncoderOptions(Z){return this._encoderOptions=Z,this}preread(Z){if(!this._decoderModule)throw new Error(`[${N8}] Please install extension dependency, "draco3d.decoder".`);let J=this.document.getLogger(),X=Z.jsonDoc,Y=new Map;try{let $=X.json.meshes||[];for(let Q of $)for(let K of Q.primitives){if(!K.extensions||!K.extensions[N8])continue;let W=K.extensions[N8],[G,z]=Y.get(W.bufferView)||[];if(!z||!G){let V=X.json.bufferViews[W.bufferView],H=X.json.buffers[V.buffer],q=H.uri?X.resources[H.uri]:X.resources[zD],F=V.byteOffset||0,U=V.byteLength,w=k6.toView(q,F,U);G=new this._decoderModule.Decoder,z=_L1(G,w),Y.set(W.bufferView,[G,z]),J.debug(`[${N8}] Decompressed ${w.byteLength} bytes.`)}for(let V in W.attributes){let H=Z.jsonDoc.json.accessors[K.attributes[V]],q=G.GetAttributeByUniqueId(z,W.attributes[V]),F=xL1(G,z,q,H);Z.accessors[K.attributes[V]].setArray(F)}if(K.indices!==void 0)Z.accessors[K.indices].setArray(AL1(G,z))}}finally{for(let[$,Q]of Array.from(Y.values()))this._decoderModule.destroy($),this._decoderModule.destroy(Q)}return this}read(Z){return this}prewrite(Z,J){if(!this._encoderModule)throw new Error(`[${N8}] Please install extension dependency, "draco3d.encoder".`);let X=this.document.getLogger();X.debug(`[${N8}] Compression options: ${JSON.stringify(this._encoderOptions)}`);let Y=mL1(this.document),$=new Map,Q="mesh";if(this._encoderOptions.quantizationVolume==="scene")if(this.document.getRoot().listScenes().length!==1)X.warn(`[${N8}]: quantizationVolume=scene requires exactly 1 scene.`);else Q=fi(this.document.getRoot().listScenes().pop());for(let K of Array.from(Y.keys())){let W=Y.get(K);if(!W)throw new Error("Unexpected primitive.");if($.has(W)){$.set(W,$.get(W));continue}let G=K.getIndices(),z=Z.jsonDoc.json.accessors,V;try{V=bL1(K,VZ({},this._encoderOptions,{quantizationVolume:Q}))}catch(F){if(F instanceof D2){X.warn(`[${N8}]: ${F.message} Skipping primitive compression.`);continue}throw F}$.set(W,V);let H=Z.createAccessorDef(G);if(H.count=V.numIndices,Z.accessorIndexMap.set(G,z.length),z.push(H),V.numVertices>65534&&O0.getComponentSize(H.componentType)<=2)H.componentType=O0.ComponentType.UNSIGNED_INT;else if(V.numVertices>254&&O0.getComponentSize(H.componentType)<=1)H.componentType=O0.ComponentType.UNSIGNED_SHORT;for(let F of K.listSemantics()){let U=K.getAttribute(F);if(V.attributeIDs[F]===void 0)continue;let w=Z.createAccessorDef(U);w.count=V.numVertices,Z.accessorIndexMap.set(U,z.length),z.push(w)}let q=K.getAttribute("POSITION").getBuffer()||this.document.getRoot().listBuffers()[0];if(!Z.otherBufferViews.has(q))Z.otherBufferViews.set(q,[]);Z.otherBufferViews.get(q).push(V.data)}return X.debug(`[${N8}] Compressed ${Y.size} primitives.`),Z.extensionData[N8]={primitiveHashMap:Y,primitiveEncodingMap:$},this}write(Z){let J=Z.extensionData[N8];for(let X of this.document.getRoot().listMeshes()){let Y=Z.jsonDoc.json.meshes[Z.meshIndexMap.get(X)];for(let $=0;$<X.listPrimitives().length;$++){let Q=X.listPrimitives()[$],K=Y.primitives[$],W=J.primitiveHashMap.get(Q);if(!W)continue;let G=J.primitiveEncodingMap.get(W);if(!G)continue;K.extensions=K.extensions||{},K.extensions[N8]={bufferView:Z.otherBufferViewsIndexMap.get(G.data),attributes:G.attributeIDs}}}if(!J.primitiveHashMap.size){let X=Z.jsonDoc.json;X.extensionsUsed=(X.extensionsUsed||[]).filter((Y)=>Y!==N8),X.extensionsRequired=(X.extensionsRequired||[]).filter((Y)=>Y!==N8)}return this}}C3.EXTENSION_NAME=N8;C3.EncoderMethod=P3;function mL1(Z){let J=Z.getLogger(),X=new Set,Y=new Set,$=0,Q=0;for(let H of Z.getRoot().listMeshes())for(let q of H.listPrimitives())if(!q.getIndices())Y.add(q),$++;else if(q.getMode()!==LJ.Mode.TRIANGLES)Y.add(q),Q++;else X.add(q);if($>0)J.warn(`[${N8}] Skipping Draco compression of ${$} non-indexed primitives.`);if(Q>0)J.warn(`[${N8}] Skipping Draco compression of ${Q} non-TRIANGLES primitives.`);let K=Z.getRoot().listAccessors(),W=new Map;for(let H=0;H<K.length;H++)W.set(K[H],H);let G=new Map,z=new Set,V=new Map;for(let H of Array.from(X)){let q=ri(H,W);if(z.has(q)){V.set(H,q);continue}if(G.has(H.getIndices())){let F=H.getIndices(),U=F.clone();W.set(U,Z.getRoot().listAccessors().length-1),H.swap(F,U)}for(let F of H.listAttributes())if(G.has(F)){let U=F.clone();W.set(U,Z.getRoot().listAccessors().length-1),H.swap(F,U)}q=ri(H,W),z.add(q),V.set(H,q),G.set(H.getIndices(),q);for(let F of H.listAttributes())G.set(F,q)}for(let H of Array.from(G.keys())){let q=new Set(H.listParents().map((F)=>F.propertyType));if(q.size!==2||!q.has(s.PRIMITIVE)||!q.has(s.ROOT))throw new Error(`[${N8}] Compressed accessors must only be used as indices or vertex attributes.`)}for(let H of Array.from(X)){let q=V.get(H),F=H.getIndices();if(G.get(F)!==q||H.listAttributes().some((U)=>G.get(U)!==q))throw new Error(`[${N8}] Draco primitives must share all, or no, accessors.`)}for(let H of Array.from(Y)){let q=H.getIndices();if(G.has(q)||H.listAttributes().some((F)=>G.has(F)))throw new Error(`[${N8}] Accessor cannot be shared by compressed and uncompressed primitives.`)}return V}function ri(Z,J){let X=[],Y=Z.getIndices();X.push(J.get(Y));for(let $ of Z.listAttributes())X.push(J.get($));return X.sort().join("|")}class cQ extends n1{init(){this.extensionName=PD,this.propertyType="Light",this.parentTypes=[s.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{color:[1,1,1],intensity:1,type:cQ.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)}}cQ.EXTENSION_NAME=PD;cQ.Type={POINT:"point",SPOT:"spot",DIRECTIONAL:"directional"};var Q7=PD;class gD extends E1{constructor(...Z){super(...Z);this.extensionName=Q7}createLight(Z=""){return new cQ(this.document.getGraph(),Z)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[Q7])return this;let $=(J.json.extensions[Q7].lights||[]).map((Q)=>{var K,W;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(((K=Q.spot)==null?void 0:K.innerConeAngle)!==void 0)G.setInnerConeAngle(Q.spot.innerConeAngle);if(((W=Q.spot)==null?void 0:W.outerConeAngle)!==void 0)G.setOuterConeAngle(Q.spot.outerConeAngle);return G});return J.json.nodes.forEach((Q,K)=>{if(!Q.extensions||!Q.extensions[Q7])return;let W=Q.extensions[Q7];Z.nodes[K].setExtension(Q7,$[W.light])}),this}write(Z){let J=Z.jsonDoc;if(this.properties.size===0)return this;let X=[],Y=new Map;for(let $ of this.properties){let Q=$,K={type:Q.getType()};if(!W8.eq(Q.getColor(),[1,1,1]))K.color=Q.getColor();if(Q.getIntensity()!==1)K.intensity=Q.getIntensity();if(Q.getRange()!=null)K.range=Q.getRange();if(Q.getName())K.name=Q.getName();if(Q.getType()===cQ.Type.SPOT)K.spot={innerConeAngle:Q.getInnerConeAngle(),outerConeAngle:Q.getOuterConeAngle()};X.push(K),Y.set(Q,X.length-1)}return this.document.getRoot().listNodes().forEach(($)=>{let Q=$.getExtension(Q7);if(Q){let K=Z.nodeIndexMap.get($),W=J.json.nodes[K];W.extensions=W.extensions||{},W.extensions[Q7]={light:Y.get(Q)}}}),J.json.extensions=J.json.extensions||{},J.json.extensions[Q7]={lights:X},this}}gD.EXTENSION_NAME=Q7;var{R:uL1,G:dL1,B:cL1}=i5;class mD extends n1{init(){this.extensionName=DD,this.propertyType="Anisotropy",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{anisotropyStrength:0,anisotropyRotation:0,anisotropyTexture:null,anisotropyTextureInfo:new C1(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:uL1|dL1|cL1})}}mD.EXTENSION_NAME=DD;var KY=DD;class uD extends E1{constructor(...Z){super(...Z);this.extensionName=KY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createAnisotropy(){return new mD(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[KY]){let K=this.createAnisotropy();Z.materials[Q].setExtension(KY,K);let W=$.extensions[KY];if(W.anisotropyStrength!==void 0)K.setAnisotropyStrength(W.anisotropyStrength);if(W.anisotropyRotation!==void 0)K.setAnisotropyRotation(W.anisotropyRotation);if(W.anisotropyTexture!==void 0){let G=W.anisotropyTexture,z=Z.textures[Y[G.index].source];K.setAnisotropyTexture(z),Z.setTextureInfo(K.getAnisotropyTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(KY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[KY]={};if(Y.getAnisotropyStrength()>0)K.anisotropyStrength=Y.getAnisotropyStrength();if(Y.getAnisotropyRotation()!==0)K.anisotropyRotation=Y.getAnisotropyRotation();if(Y.getAnisotropyTexture()){let W=Y.getAnisotropyTexture(),G=Y.getAnisotropyTextureInfo();K.anisotropyTexture=Z.createTextureInfoDef(W,G)}}}),this}}uD.EXTENSION_NAME=KY;var{R:ti,G:ei,B:lL1}=i5;class dD extends n1{init(){this.extensionName=CD,this.propertyType="Clearcoat",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{clearcoatFactor:0,clearcoatTexture:null,clearcoatTextureInfo:new C1(this.graph,"clearcoatTextureInfo"),clearcoatRoughnessFactor:0,clearcoatRoughnessTexture:null,clearcoatRoughnessTextureInfo:new C1(this.graph,"clearcoatRoughnessTextureInfo"),clearcoatNormalScale:1,clearcoatNormalTexture:null,clearcoatNormalTextureInfo:new C1(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:ti})}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:ei})}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:ti|ei|lL1})}}dD.EXTENSION_NAME=CD;var WY=CD;class cD extends E1{constructor(...Z){super(...Z);this.extensionName=WY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createClearcoat(){return new dD(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[WY]){let K=this.createClearcoat();Z.materials[Q].setExtension(WY,K);let W=$.extensions[WY];if(W.clearcoatFactor!==void 0)K.setClearcoatFactor(W.clearcoatFactor);if(W.clearcoatRoughnessFactor!==void 0)K.setClearcoatRoughnessFactor(W.clearcoatRoughnessFactor);if(W.clearcoatTexture!==void 0){let G=W.clearcoatTexture,z=Z.textures[Y[G.index].source];K.setClearcoatTexture(z),Z.setTextureInfo(K.getClearcoatTextureInfo(),G)}if(W.clearcoatRoughnessTexture!==void 0){let G=W.clearcoatRoughnessTexture,z=Z.textures[Y[G.index].source];K.setClearcoatRoughnessTexture(z),Z.setTextureInfo(K.getClearcoatRoughnessTextureInfo(),G)}if(W.clearcoatNormalTexture!==void 0){let G=W.clearcoatNormalTexture,z=Z.textures[Y[G.index].source];if(K.setClearcoatNormalTexture(z),Z.setTextureInfo(K.getClearcoatNormalTextureInfo(),G),G.scale!==void 0)K.setClearcoatNormalScale(G.scale)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(WY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[WY]={clearcoatFactor:Y.getClearcoatFactor(),clearcoatRoughnessFactor:Y.getClearcoatRoughnessFactor()};if(Y.getClearcoatTexture()){let W=Y.getClearcoatTexture(),G=Y.getClearcoatTextureInfo();K.clearcoatTexture=Z.createTextureInfoDef(W,G)}if(Y.getClearcoatRoughnessTexture()){let W=Y.getClearcoatRoughnessTexture(),G=Y.getClearcoatRoughnessTextureInfo();K.clearcoatRoughnessTexture=Z.createTextureInfoDef(W,G)}if(Y.getClearcoatNormalTexture()){let W=Y.getClearcoatNormalTexture(),G=Y.getClearcoatNormalTextureInfo();if(K.clearcoatNormalTexture=Z.createTextureInfoDef(W,G),Y.getClearcoatNormalScale()!==1)K.clearcoatNormalTexture.scale=Y.getClearcoatNormalScale()}}}),this}}cD.EXTENSION_NAME=WY;var{R:pL1,G:iL1,B:nL1,A:aL1}=i5;class lD extends n1{init(){this.extensionName=TD,this.propertyType="DiffuseTransmission",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseTransmissionFactor:0,diffuseTransmissionTexture:null,diffuseTransmissionTextureInfo:new C1(this.graph,"diffuseTransmissionTextureInfo"),diffuseTransmissionColorFactor:[1,1,1],diffuseTransmissionColorTexture:null,diffuseTransmissionColorTextureInfo:new C1(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:aL1})}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:pL1|iL1|nL1})}}lD.EXTENSION_NAME=TD;var GY=TD;class pD extends E1{constructor(...Z){super(...Z);this.extensionName=GY}createDiffuseTransmission(){return new lD(this.document.getGraph())}read(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[GY]){let K=this.createDiffuseTransmission();Z.materials[Q].setExtension(GY,K);let W=$.extensions[GY];if(W.diffuseTransmissionFactor!==void 0)K.setDiffuseTransmissionFactor(W.diffuseTransmissionFactor);if(W.diffuseTransmissionColorFactor!==void 0)K.setDiffuseTransmissionColorFactor(W.diffuseTransmissionColorFactor);if(W.diffuseTransmissionTexture!==void 0){let G=W.diffuseTransmissionTexture,z=Z.textures[Y[G.index].source];K.setDiffuseTransmissionTexture(z),Z.setTextureInfo(K.getDiffuseTransmissionTextureInfo(),G)}if(W.diffuseTransmissionColorTexture!==void 0){let G=W.diffuseTransmissionColorTexture,z=Z.textures[Y[G.index].source];K.setDiffuseTransmissionColorTexture(z),Z.setTextureInfo(K.getDiffuseTransmissionColorTextureInfo(),G)}}}),this}write(Z){let J=Z.jsonDoc;for(let X of this.document.getRoot().listMaterials()){let Y=X.getExtension(GY);if(!Y)continue;let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[GY]={diffuseTransmissionFactor:Y.getDiffuseTransmissionFactor(),diffuseTransmissionColorFactor:Y.getDiffuseTransmissionColorFactor()};if(Y.getDiffuseTransmissionTexture()){let W=Y.getDiffuseTransmissionTexture(),G=Y.getDiffuseTransmissionTextureInfo();K.diffuseTransmissionTexture=Z.createTextureInfoDef(W,G)}if(Y.getDiffuseTransmissionColorTexture()){let W=Y.getDiffuseTransmissionColorTexture(),G=Y.getDiffuseTransmissionColorTextureInfo();K.diffuseTransmissionColorTexture=Z.createTextureInfoDef(W,G)}}return this}}pD.EXTENSION_NAME=GY;class iD extends n1{init(){this.extensionName=kD,this.propertyType="Dispersion",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{dispersion:0})}getDispersion(){return this.get("dispersion")}setDispersion(Z){return this.set("dispersion",Z)}}iD.EXTENSION_NAME=kD;var zY=kD;class nD extends E1{constructor(...Z){super(...Z);this.extensionName=zY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createDispersion(){return new iD(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[zY]){let Q=this.createDispersion();Z.materials[$].setExtension(zY,Q);let K=Y.extensions[zY];if(K.dispersion!==void 0)Q.setDispersion(K.dispersion)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(zY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[zY]={dispersion:Y.getDispersion()}}}),this}}nD.EXTENSION_NAME=zY;class aD extends n1{init(){this.extensionName=ED,this.propertyType="EmissiveStrength",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{emissiveStrength:1})}getEmissiveStrength(){return this.get("emissiveStrength")}setEmissiveStrength(Z){return this.set("emissiveStrength",Z)}}aD.EXTENSION_NAME=ED;var VY=ED;class sD extends E1{constructor(...Z){super(...Z);this.extensionName=VY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createEmissiveStrength(){return new aD(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[VY]){let Q=this.createEmissiveStrength();Z.materials[$].setExtension(VY,Q);let K=Y.extensions[VY];if(K.emissiveStrength!==void 0)Q.setEmissiveStrength(K.emissiveStrength)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(VY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[VY]={emissiveStrength:Y.getEmissiveStrength()}}}),this}}sD.EXTENSION_NAME=VY;class oD extends n1{init(){this.extensionName=ID,this.propertyType="IOR",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{ior:1.5})}getIOR(){return this.get("ior")}setIOR(Z){return this.set("ior",Z)}}oD.EXTENSION_NAME=ID;var HY=ID;class I2 extends E1{constructor(...Z){super(...Z);this.extensionName=HY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createIOR(){return new oD(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[HY]){let Q=this.createIOR();Z.materials[$].setExtension(HY,Q);let K=Y.extensions[HY];if(K.ior!==void 0)Q.setIOR(K.ior)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(HY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[HY]={ior:Y.getIOR()}}}),this}}I2.EXTENSION_NAME=HY;var{R:sL1,G:oL1}=i5;class rD extends n1{init(){this.extensionName=vD,this.propertyType="Iridescence",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{iridescenceFactor:0,iridescenceTexture:null,iridescenceTextureInfo:new C1(this.graph,"iridescenceTextureInfo"),iridescenceIOR:1.3,iridescenceThicknessMinimum:100,iridescenceThicknessMaximum:400,iridescenceThicknessTexture:null,iridescenceThicknessTextureInfo:new C1(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:sL1})}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:oL1})}}rD.EXTENSION_NAME=vD;var qY=vD;class tD extends E1{constructor(...Z){super(...Z);this.extensionName=qY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createIridescence(){return new rD(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[qY]){let K=this.createIridescence();Z.materials[Q].setExtension(qY,K);let W=$.extensions[qY];if(W.iridescenceFactor!==void 0)K.setIridescenceFactor(W.iridescenceFactor);if(W.iridescenceIor!==void 0)K.setIridescenceIOR(W.iridescenceIor);if(W.iridescenceThicknessMinimum!==void 0)K.setIridescenceThicknessMinimum(W.iridescenceThicknessMinimum);if(W.iridescenceThicknessMaximum!==void 0)K.setIridescenceThicknessMaximum(W.iridescenceThicknessMaximum);if(W.iridescenceTexture!==void 0){let G=W.iridescenceTexture,z=Z.textures[Y[G.index].source];K.setIridescenceTexture(z),Z.setTextureInfo(K.getIridescenceTextureInfo(),G)}if(W.iridescenceThicknessTexture!==void 0){let G=W.iridescenceThicknessTexture,z=Z.textures[Y[G.index].source];K.setIridescenceThicknessTexture(z),Z.setTextureInfo(K.getIridescenceThicknessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(qY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[qY]={};if(Y.getIridescenceFactor()>0)K.iridescenceFactor=Y.getIridescenceFactor();if(Y.getIridescenceIOR()!==1.3)K.iridescenceIor=Y.getIridescenceIOR();if(Y.getIridescenceThicknessMinimum()!==100)K.iridescenceThicknessMinimum=Y.getIridescenceThicknessMinimum();if(Y.getIridescenceThicknessMaximum()!==400)K.iridescenceThicknessMaximum=Y.getIridescenceThicknessMaximum();if(Y.getIridescenceTexture()){let W=Y.getIridescenceTexture(),G=Y.getIridescenceTextureInfo();K.iridescenceTexture=Z.createTextureInfoDef(W,G)}if(Y.getIridescenceThicknessTexture()){let W=Y.getIridescenceThicknessTexture(),G=Y.getIridescenceThicknessTextureInfo();K.iridescenceThicknessTexture=Z.createTextureInfoDef(W,G)}}}),this}}tD.EXTENSION_NAME=qY;var{R:Zn,G:Jn,B:Xn,A:Yn}=i5;class eD extends n1{init(){this.extensionName=SD,this.propertyType="PBRSpecularGlossiness",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseFactor:[1,1,1,1],diffuseTexture:null,diffuseTextureInfo:new C1(this.graph,"diffuseTextureInfo"),specularFactor:[1,1,1],glossinessFactor:1,specularGlossinessTexture:null,specularGlossinessTextureInfo:new C1(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:Zn|Jn|Xn|Yn,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:Zn|Jn|Xn|Yn})}}eD.EXTENSION_NAME=SD;var FY=SD;class v2 extends E1{constructor(...Z){super(...Z);this.extensionName=FY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createPBRSpecularGlossiness(){return new eD(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[FY]){let K=this.createPBRSpecularGlossiness();Z.materials[Q].setExtension(FY,K);let W=$.extensions[FY];if(W.diffuseFactor!==void 0)K.setDiffuseFactor(W.diffuseFactor);if(W.specularFactor!==void 0)K.setSpecularFactor(W.specularFactor);if(W.glossinessFactor!==void 0)K.setGlossinessFactor(W.glossinessFactor);if(W.diffuseTexture!==void 0){let G=W.diffuseTexture,z=Z.textures[Y[G.index].source];K.setDiffuseTexture(z),Z.setTextureInfo(K.getDiffuseTextureInfo(),G)}if(W.specularGlossinessTexture!==void 0){let G=W.specularGlossinessTexture,z=Z.textures[Y[G.index].source];K.setSpecularGlossinessTexture(z),Z.setTextureInfo(K.getSpecularGlossinessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(FY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[FY]={diffuseFactor:Y.getDiffuseFactor(),specularFactor:Y.getSpecularFactor(),glossinessFactor:Y.getGlossinessFactor()};if(Y.getDiffuseTexture()){let W=Y.getDiffuseTexture(),G=Y.getDiffuseTextureInfo();K.diffuseTexture=Z.createTextureInfoDef(W,G)}if(Y.getSpecularGlossinessTexture()){let W=Y.getSpecularGlossinessTexture(),G=Y.getSpecularGlossinessTextureInfo();K.specularGlossinessTexture=Z.createTextureInfoDef(W,G)}}}),this}}v2.EXTENSION_NAME=FY;var{R:rL1,G:tL1,B:eL1,A:Zw1}=i5;class ZC extends n1{init(){this.extensionName=_D,this.propertyType="Sheen",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{sheenColorFactor:[0,0,0],sheenColorTexture:null,sheenColorTextureInfo:new C1(this.graph,"sheenColorTextureInfo"),sheenRoughnessFactor:0,sheenRoughnessTexture:null,sheenRoughnessTextureInfo:new C1(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:rL1|tL1|eL1,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:Zw1})}}ZC.EXTENSION_NAME=_D;var UY=_D;class JC extends E1{constructor(...Z){super(...Z);this.extensionName=UY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createSheen(){return new ZC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[UY]){let K=this.createSheen();Z.materials[Q].setExtension(UY,K);let W=$.extensions[UY];if(W.sheenColorFactor!==void 0)K.setSheenColorFactor(W.sheenColorFactor);if(W.sheenRoughnessFactor!==void 0)K.setSheenRoughnessFactor(W.sheenRoughnessFactor);if(W.sheenColorTexture!==void 0){let G=W.sheenColorTexture,z=Z.textures[Y[G.index].source];K.setSheenColorTexture(z),Z.setTextureInfo(K.getSheenColorTextureInfo(),G)}if(W.sheenRoughnessTexture!==void 0){let G=W.sheenRoughnessTexture,z=Z.textures[Y[G.index].source];K.setSheenRoughnessTexture(z),Z.setTextureInfo(K.getSheenRoughnessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(UY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[UY]={sheenColorFactor:Y.getSheenColorFactor(),sheenRoughnessFactor:Y.getSheenRoughnessFactor()};if(Y.getSheenColorTexture()){let W=Y.getSheenColorTexture(),G=Y.getSheenColorTextureInfo();K.sheenColorTexture=Z.createTextureInfoDef(W,G)}if(Y.getSheenRoughnessTexture()){let W=Y.getSheenRoughnessTexture(),G=Y.getSheenRoughnessTextureInfo();K.sheenRoughnessTexture=Z.createTextureInfoDef(W,G)}}}),this}}JC.EXTENSION_NAME=UY;var{R:Jw1,G:Xw1,B:Yw1,A:$w1}=i5;class XC extends n1{init(){this.extensionName=AD,this.propertyType="Specular",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{specularFactor:1,specularTexture:null,specularTextureInfo:new C1(this.graph,"specularTextureInfo"),specularColorFactor:[1,1,1],specularColorTexture:null,specularColorTextureInfo:new C1(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:$w1})}getSpecularColorTexture(){return this.getRef("specularColorTexture")}getSpecularColorTextureInfo(){return this.getRef("specularColorTexture")?this.getRef("specularColorTextureInfo"):null}setSpecularColorTexture(Z){return this.setRef("specularColorTexture",Z,{channels:Jw1|Xw1|Yw1,isColor:!0})}}XC.EXTENSION_NAME=AD;var LY=AD;class S2 extends E1{constructor(...Z){super(...Z);this.extensionName=LY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createSpecular(){return new XC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[LY]){let K=this.createSpecular();Z.materials[Q].setExtension(LY,K);let W=$.extensions[LY];if(W.specularFactor!==void 0)K.setSpecularFactor(W.specularFactor);if(W.specularColorFactor!==void 0)K.setSpecularColorFactor(W.specularColorFactor);if(W.specularTexture!==void 0){let G=W.specularTexture,z=Z.textures[Y[G.index].source];K.setSpecularTexture(z),Z.setTextureInfo(K.getSpecularTextureInfo(),G)}if(W.specularColorTexture!==void 0){let G=W.specularColorTexture,z=Z.textures[Y[G.index].source];K.setSpecularColorTexture(z),Z.setTextureInfo(K.getSpecularColorTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(LY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[LY]={};if(Y.getSpecularFactor()!==1)K.specularFactor=Y.getSpecularFactor();if(!W8.eq(Y.getSpecularColorFactor(),[1,1,1]))K.specularColorFactor=Y.getSpecularColorFactor();if(Y.getSpecularTexture()){let W=Y.getSpecularTexture(),G=Y.getSpecularTextureInfo();K.specularTexture=Z.createTextureInfoDef(W,G)}if(Y.getSpecularColorTexture()){let W=Y.getSpecularColorTexture(),G=Y.getSpecularColorTextureInfo();K.specularColorTexture=Z.createTextureInfoDef(W,G)}}}),this}}S2.EXTENSION_NAME=LY;var{R:Qw1}=i5;class YC extends n1{init(){this.extensionName=xD,this.propertyType="Transmission",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{transmissionFactor:0,transmissionTexture:null,transmissionTextureInfo:new C1(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:Qw1})}}YC.EXTENSION_NAME=xD;var wY=xD;class $C extends E1{constructor(...Z){super(...Z);this.extensionName=wY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createTransmission(){return new YC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[wY]){let K=this.createTransmission();Z.materials[Q].setExtension(wY,K);let W=$.extensions[wY];if(W.transmissionFactor!==void 0)K.setTransmissionFactor(W.transmissionFactor);if(W.transmissionTexture!==void 0){let G=W.transmissionTexture,z=Z.textures[Y[G.index].source];K.setTransmissionTexture(z),Z.setTextureInfo(K.getTransmissionTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(wY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[wY]={transmissionFactor:Y.getTransmissionFactor()};if(Y.getTransmissionTexture()){let W=Y.getTransmissionTexture(),G=Y.getTransmissionTextureInfo();K.transmissionTexture=Z.createTextureInfoDef(W,G)}}}),this}}$C.EXTENSION_NAME=wY;class QC extends n1{init(){this.extensionName=hD,this.propertyType="Unlit",this.parentTypes=[s.MATERIAL]}}QC.EXTENSION_NAME=hD;var uQ=hD;class _2 extends E1{constructor(...Z){super(...Z);this.extensionName=uQ,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createUnlit(){return new QC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){return(Z.jsonDoc.json.materials||[]).forEach((X,Y)=>{if(X.extensions&&X.extensions[uQ])Z.materials[Y].setExtension(uQ,this.createUnlit())}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{if(X.getExtension(uQ)){let Y=Z.materialIndexMap.get(X),$=J.json.materials[Y];$.extensions=$.extensions||{},$.extensions[uQ]={}}}),this}}_2.EXTENSION_NAME=uQ;class KC extends n1{init(){this.extensionName=OY,this.propertyType="Mapping",this.parentTypes=["MappingList"]}getDefaults(){return Object.assign(super.getDefaults(),{material:null,variants:new N0})}getMaterial(){return this.getRef("material")}setMaterial(Z){return this.setRef("material",Z)}addVariant(Z){return this.addRef("variants",Z)}removeVariant(Z){return this.removeRef("variants",Z)}listVariants(){return this.listRefs("variants")}}KC.EXTENSION_NAME=OY;class WC extends n1{init(){this.extensionName=OY,this.propertyType="MappingList",this.parentTypes=[s.PRIMITIVE]}getDefaults(){return Object.assign(super.getDefaults(),{mappings:new N0})}addMapping(Z){return this.addRef("mappings",Z)}removeMapping(Z){return this.removeRef("mappings",Z)}listMappings(){return this.listRefs("mappings")}}WC.EXTENSION_NAME=OY;class C2 extends n1{init(){this.extensionName=OY,this.propertyType="Variant",this.parentTypes=["MappingList"]}}C2.EXTENSION_NAME=OY;var K7=OY;class GC extends E1{constructor(...Z){super(...Z);this.extensionName=K7}createMappingList(){return new WC(this.document.getGraph())}createVariant(Z=""){return new C2(this.document.getGraph(),Z)}createMapping(){return new KC(this.document.getGraph())}listVariants(){return Array.from(this.properties).filter((Z)=>Z instanceof C2)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[K7])return this;let $=(J.json.extensions[K7].variants||[]).map((K)=>this.createVariant().setName(K.name||""));return(J.json.meshes||[]).forEach((K,W)=>{let G=Z.meshes[W];(K.primitives||[]).forEach((V,H)=>{if(!V.extensions||!V.extensions[K7])return;let q=this.createMappingList(),F=V.extensions[K7];for(let U of F.mappings){let w=this.createMapping();if(U.material!==void 0)w.setMaterial(Z.materials[U.material]);for(let L of U.variants||[])w.addVariant($[L]);q.addMapping(w)}G.listPrimitives()[H].setExtension(K7,q)})}),this}write(Z){let J=Z.jsonDoc,X=this.listVariants();if(!X.length)return this;let Y=[],$=new Map;for(let Q of X)$.set(Q,Y.length),Y.push(Z.createPropertyDef(Q));for(let Q of this.document.getRoot().listMeshes()){let K=Z.meshIndexMap.get(Q);Q.listPrimitives().forEach((W,G)=>{let z=W.getExtension(K7);if(!z)return;let V=Z.jsonDoc.json.meshes[K].primitives[G],H=z.listMappings().map((q)=>{let F=Z.createPropertyDef(q),U=q.getMaterial();if(U)F.material=Z.materialIndexMap.get(U);return F.variants=q.listVariants().map((w)=>$.get(w)),F});V.extensions=V.extensions||{},V.extensions[K7]={mappings:H}})}return J.json.extensions=J.json.extensions||{},J.json.extensions[K7]={variants:Y},this}}GC.EXTENSION_NAME=K7;var{G:Kw1}=i5;class zC extends n1{init(){this.extensionName=fD,this.propertyType="Volume",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{thicknessFactor:0,thicknessTexture:null,thicknessTextureInfo:new C1(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:Kw1})}getAttenuationDistance(){return this.get("attenuationDistance")}setAttenuationDistance(Z){return this.set("attenuationDistance",Z)}getAttenuationColor(){return this.get("attenuationColor")}setAttenuationColor(Z){return this.set("attenuationColor",Z)}}zC.EXTENSION_NAME=fD;var BY=fD;class VC extends E1{constructor(...Z){super(...Z);this.extensionName=BY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createVolume(){return new zC(this.document.getGraph())}read(Z){return this}write(Z){return this}preread(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[BY]){let K=this.createVolume();Z.materials[Q].setExtension(BY,K);let W=$.extensions[BY];if(W.thicknessFactor!==void 0)K.setThicknessFactor(W.thicknessFactor);if(W.attenuationDistance!==void 0)K.setAttenuationDistance(W.attenuationDistance);if(W.attenuationColor!==void 0)K.setAttenuationColor(W.attenuationColor);if(W.thicknessTexture!==void 0){let G=W.thicknessTexture,z=Z.textures[Y[G.index].source];K.setThicknessTexture(z),Z.setTextureInfo(K.getThicknessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(BY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let K=Q.extensions[BY]={};if(Y.getThicknessFactor()>0)K.thicknessFactor=Y.getThicknessFactor();if(Number.isFinite(Y.getAttenuationDistance()))K.attenuationDistance=Y.getAttenuationDistance();if(!W8.eq(Y.getAttenuationColor(),[1,1,1]))K.attenuationColor=Y.getAttenuationColor();if(Y.getThicknessTexture()){let W=Y.getThicknessTexture(),G=Y.getThicknessTextureInfo();K.thicknessTexture=Z.createTextureInfoDef(W,G)}}}),this}}VC.EXTENSION_NAME=BY;var Hn=RL1;class T3 extends E1{constructor(...Z){super(...Z);this.extensionName=Hn}read(Z){return this}write(Z){return this}}T3.EXTENSION_NAME=Hn;var R3=NL1;class qn{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=N2(Z);return[J.pixelWidth,J.pixelHeight]}getChannels(Z){let X=N2(Z).dataFormatDescriptor[0];if(X.colorModel===ci)return X.samples.length===2&&(X.samples[1].channelType&15)===15?4:3;else if(X.colorModel===li)return(X.samples[0].channelType&15)===3?4:3;throw new Error(`Unexpected KTX2 colorModel, "${X.colorModel}".`)}getVRAMByteLength(Z){let J=N2(Z),X=this.getChannels(Z)>3,Y=0;for(let $=0;$<J.levels.length;$++){let Q=J.levels[$];if(Q.uncompressedByteLength)Y+=Q.uncompressedByteLength;else{let K=Math.max(1,Math.floor(J.pixelWidth/Math.pow(2,$))),W=Math.max(1,Math.floor(J.pixelHeight/Math.pow(2,$))),G=X?16:8;Y+=K/4*(W/4)*G}}return Y}}class HC extends E1{constructor(...Z){super(...Z);this.extensionName=R3,this.prereadTypes=[s.TEXTURE]}static register(){V4.registerFormat("image/ktx2",new qn)}preread(Z){return Z.jsonDoc.json.textures.forEach((J)=>{if(J.extensions&&J.extensions[R3]){let X=J.extensions[R3];J.source=X.source}}),this}read(Z){return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listTextures().forEach((X)=>{if(X.getMimeType()==="image/ktx2"){let Y=Z.imageIndexMap.get(X);J.json.textures.forEach(($)=>{if($.source===Y)$.extensions=$.extensions||{},$.extensions[R3]={source:$.source},delete $.source})}}),this}}HC.EXTENSION_NAME=R3;class qC extends n1{init(){this.extensionName=bD,this.propertyType="Transform",this.parentTypes=[s.TEXTURE_INFO]}getDefaults(){return Object.assign(super.getDefaults(),{offset:[0,0],rotation:0,scale:[1,1],texCoord:null})}getOffset(){return this.get("offset")}setOffset(Z){return this.set("offset",Z)}getRotation(){return this.get("rotation")}setRotation(Z){return this.set("rotation",Z)}getScale(){return this.get("scale")}setScale(Z){return this.set("scale",Z)}getTexCoord(){return this.get("texCoord")}setTexCoord(Z){return this.set("texCoord",Z)}}qC.EXTENSION_NAME=bD;var jY=bD;class FC extends E1{constructor(...Z){super(...Z);this.extensionName=jY}createTransform(){return new qC(this.document.getGraph())}read(Z){for(let[J,X]of Array.from(Z.textureInfos.entries())){if(!X.extensions||!X.extensions[jY])continue;let Y=this.createTransform(),$=X.extensions[jY];if($.offset!==void 0)Y.setOffset($.offset);if($.rotation!==void 0)Y.setRotation($.rotation);if($.scale!==void 0)Y.setScale($.scale);if($.texCoord!==void 0)Y.setTexCoord($.texCoord);J.setExtension(jY,Y)}return this}write(Z){let J=Array.from(Z.textureInfoDefMap.entries());for(let[X,Y]of J){let $=X.getExtension(jY);if(!$)continue;Y.extensions=Y.extensions||{};let Q={},K=W8.eq;if(!K($.getOffset(),[0,0]))Q.offset=$.getOffset();if($.getRotation()!==0)Q.rotation=$.getRotation();if(!K($.getScale(),[1,1]))Q.scale=$.getScale();if($.getTexCoord()!=null)Q.texCoord=$.getTexCoord();Y.extensions[jY]=Q}return this}}FC.EXTENSION_NAME=jY;var Ww1=[s.ROOT,s.SCENE,s.NODE,s.MESH,s.MATERIAL,s.TEXTURE,s.ANIMATION];class UC extends n1{init(){this.extensionName=P2,this.propertyType="Packet",this.parentTypes=Ww1}getDefaults(){return Object.assign(super.getDefaults(),{context:{},properties:{}})}getContext(){return this.get("context")}setContext(Z){return this.set("context",VZ({},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 X=VZ({},this.get("properties"));if(J)X[Z]=J;else delete X[Z];return this.set("properties",X)}toJSONLD(){let Z=jD(this.get("context")),J=jD(this.get("properties"));return VZ({"@context":Z},J)}fromJSONLD(Z){Z=jD(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(`${P2}: Missing context for term, "${Z}".`)}}UC.EXTENSION_NAME=P2;function jD(Z){return JSON.parse(JSON.stringify(Z))}var zZ=P2;class LC extends E1{constructor(...Z){super(...Z);this.extensionName=zZ}createPacket(){return new UC(this.document.getGraph())}listPackets(){return Array.from(this.properties)}read(Z){var J;let X=(J=Z.jsonDoc.json.extensions)==null?void 0:J[zZ];if(!X||!X.packets)return this;let Y=Z.jsonDoc.json,$=this.document.getRoot(),Q=X.packets.map((G)=>this.createPacket().fromJSONLD(G)),K=[[Y.asset],Y.scenes,Y.nodes,Y.meshes,Y.materials,Y.images,Y.animations],W=[[$],$.listScenes(),$.listNodes(),$.listMeshes(),$.listMaterials(),$.listTextures(),$.listAnimations()];for(let G=0;G<K.length;G++){let z=K[G]||[];for(let V=0;V<z.length;V++){let H=z[V];if(H.extensions&&H.extensions[zZ]){let q=H.extensions[zZ];W[G][V].setExtension(zZ,Q[q.packet])}}}return this}write(Z){let{json:J}=Z.jsonDoc,X=[];for(let Y of this.properties){X.push(Y.toJSONLD());for(let $ of Y.listParents()){let Q;switch($.propertyType){case s.ROOT:Q=J.asset;break;case s.SCENE:Q=J.scenes[Z.sceneIndexMap.get($)];break;case s.NODE:Q=J.nodes[Z.nodeIndexMap.get($)];break;case s.MESH:Q=J.meshes[Z.meshIndexMap.get($)];break;case s.MATERIAL:Q=J.materials[Z.materialIndexMap.get($)];break;case s.TEXTURE:Q=J.images[Z.imageIndexMap.get($)];break;case s.ANIMATION:Q=J.animations[Z.animationIndexMap.get($)];break;default:Q=null,this.document.getLogger().warn(`[${zZ}]: Unsupported parent property, "${$.propertyType}"`);break}if(!Q)continue;Q.extensions=Q.extensions||{},Q.extensions[zZ]={packet:X.length-1}}}if(X.length>0)J.extensions=J.extensions||{},J.extensions[zZ]={packets:X};return this}}LC.EXTENSION_NAME=zZ;var Gw1=[C3,gD,uD,cD,pD,nD,sD,I2,tD,v2,S2,JC,$C,_2,GC,VC,T3,HC,FC,LC],rz6=[T2,D3,k2,E2,...Gw1];var zw1=t(SP(),1);function iQ(){return iQ=Object.assign?Object.assign.bind():function(Z){for(var J=1;J<arguments.length;J++){var X=arguments[J];for(var Y in X)({}).hasOwnProperty.call(X,Y)&&(Z[Y]=X[Y])}return Z},iQ.apply(null,arguments)}var{POINTS:Fn,LINES:A2,LINE_STRIP:Vw1,LINE_LOOP:Hw1,TRIANGLES:x2,TRIANGLE_STRIP:qw1,TRIANGLE_FAN:Fw1}=M8.Mode;function MJ(Z,J){return Object.defineProperty(J,"name",{value:Z}),J}function W7(Z,J){let X=iQ({},Z);for(let Y in J)if(J[Y]!==void 0)X[Y]=J[Y];return X}function An(Z){let J=Z.getIndices(),X=Z.getAttribute("POSITION");switch(Z.getMode()){case M8.Mode.POINTS:return J?J.getCount():X.getCount();case M8.Mode.LINES:return J?J.getCount()/2:X.getCount()/2;case M8.Mode.LINE_LOOP:return J?J.getCount():X.getCount();case M8.Mode.LINE_STRIP:return J?J.getCount()-1:X.getCount()-1;case M8.Mode.TRIANGLES:return J?J.getCount()/3:X.getCount()/3;case M8.Mode.TRIANGLE_STRIP:case M8.Mode.TRIANGLE_FAN:return J?J.getCount()-2:X.getCount()-2;default:throw new Error("Unexpected mode: "+Z.getMode())}}var Uw1=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function OC(Z){return Uw1.format(Z)}function Lw1(Z,J,X=2){let Y=Z>J?"\u2013":"+",$="%";return Y+(Math.abs(Z-J)/Z*100).toFixed(X)+"%"}function g2(Z,J){return`${OC(Z)} \u2192 ${OC(J)} (${Lw1(Z,J)})`}function TC(Z){let J=[];for(let X of Z.listAttributes())J.push(X);for(let X of Z.listTargets())for(let Y of X.listAttributes())J.push(Y);return Array.from(new Set(J))}function ww1(Z,J,X){Z.swap(J,X);for(let Y of Z.listTargets())Y.swap(J,X)}function Bw1(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 X=0;X<Z.length;X++)if(Z[X]!==J[X])return!1;return!0}function HZ(Z,J){return Z.createAccessor(J.getName()).setArray(J.getArray()).setType(J.getType()).setBuffer(J.getBuffer()).setNormalized(J.getNormalized()).setSparse(J.getSparse())}function jw1(Z,J=Z){let X=kC(Z,J);for(let Y=0;Y<X.length;Y++)X[Y]=Y;return X}function kC(Z,J=Z){return J<=65534?new Uint16Array(Z):new Uint32Array(Z)}function Ow1(Z){return Z.listParents().some((J)=>J.propertyType!==a.ROOT)}function xn(Z){for(let J in Z)return!1;return!0}function hn(Z){let J=C6.fromGraph(Z.getGraph()),X=Z.getMaterial(),Y=J.getRoot().listMaterials().indexOf(X),$=Rw1[Z.getMode()],Q=!!Z.getIndices(),K=Z.listSemantics().sort().map((G)=>{let z=Z.getAttribute(G),V=z.getElementSize(),H=z.getComponentType();return`${G}:${V}:${H}`}).join("+"),W=Z.listTargets().map((G)=>{return G.listSemantics().sort().map((z)=>{let V=Z.getAttribute(z),H=V.getElementSize(),q=V.getComponentType();return`${z}:${H}:${q}`}).join("+")}).join("~");return`${Y}|${$}|${Q}|${K}|${W}`}function Mw1(Z){return Math.pow(2,Math.ceil(Math.log(Z)/Math.LN2))}var Rw1={[Fn]:Fn,[A2]:A2,[Vw1]:A2,[Hw1]:A2,[x2]:x2,[qw1]:x2,[Fw1]:x2},lQ="center",Un={pivot:"center"};function fn(Z=Un){let J=W7(Un,Z);return MJ(lQ,(X)=>{let Y=X.getLogger(),$=X.getRoot(),Q=$.listAnimations().length>0||$.listSkins().length>0;X.getRoot().listScenes().forEach((K,W)=>{Y.debug(`${lQ}: Scene ${W+1} / ${$.listScenes().length}.`);let G;if(typeof J.pivot==="string"){let V=DP(K);if(G=[(V.max[0]-V.min[0])/2+V.min[0],(V.max[1]-V.min[1])/2+V.min[1],(V.max[2]-V.min[2])/2+V.min[2]],J.pivot==="above")G[1]=V.max[1];if(J.pivot==="below")G[1]=V.min[1]}else G=J.pivot;Y.debug(`${lQ}: Pivot "${G.join(", ")}".`);let z=[-1*G[0],-1*G[1],-1*G[2]];if(Q){Y.debug(`${lQ}: Model contains animation or skin. Adding a wrapper node.`);let V=X.createNode("Pivot").setTranslation(z);K.listChildren().forEach((H)=>V.addChild(H)),K.addChild(V)}else Y.debug(`${lQ}: Skipping wrapper, offsetting all root nodes.`),K.listChildren().forEach((V)=>{let H=V.getTranslation();V.setTranslation([H[0]+z[0],H[1]+z[1],H[2]+z[2]])})}),Y.debug(`${lQ}: Complete.`)})}function Nw1(Z){let J=new Set,X=Z,Y;while(Y=X.getParentNode()){if(J.has(Y))throw new Error("Circular dependency in scene graph.");J.add(Y),X=Y}return X.listParents().filter(($)=>$ instanceof IQ)}function Pw1(Z){let J=Nw1(Z),X=Z.getParentNode();if(!X)return Z;Z.setMatrix(Z.getWorldMatrix()),X.removeChild(Z);for(let Y of J)Y.addChild(Z);return Z}var nQ=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 Dw1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=J[4],W=J[5],G=J[6],z=J[7],V=J[8],H=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],j=J[15],R=X*W-Y*K,O=X*G-$*K,N=X*z-Q*K,D=Y*G-$*W,P=Y*z-Q*W,C=$*z-Q*G,T=V*w-H*U,k=V*L-q*U,A=V*j-F*U,S=H*L-q*w,x=H*j-F*w,I=q*j-F*L,v=R*I-O*x+N*S+D*A-P*k+C*T;if(!v)return null;return v=1/v,Z[0]=(W*I-G*x+z*S)*v,Z[1]=($*x-Y*I-Q*S)*v,Z[2]=(w*C-L*P+j*D)*v,Z[3]=(q*P-H*C-F*D)*v,Z[4]=(G*A-K*I-z*k)*v,Z[5]=(X*I-$*A+Q*k)*v,Z[6]=(L*N-U*C-j*O)*v,Z[7]=(V*C-q*N+F*O)*v,Z[8]=(K*x-W*A+z*T)*v,Z[9]=(Y*A-X*x-Q*T)*v,Z[10]=(U*P-w*N+j*R)*v,Z[11]=(H*N-V*P-F*R)*v,Z[12]=(W*k-K*S-G*T)*v,Z[13]=(X*S-Y*k+$*T)*v,Z[14]=(w*O-U*D-L*R)*v,Z[15]=(V*D-H*O+q*R)*v,Z}function Cw1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],K=Z[5],W=Z[6],G=Z[7],z=Z[8],V=Z[9],H=Z[10],q=Z[11],F=Z[12],U=Z[13],w=Z[14],L=Z[15],j=J*K-X*Q,R=J*W-Y*Q,O=J*G-$*Q,N=X*W-Y*K,D=X*G-$*K,P=Y*G-$*W,C=z*U-V*F,T=z*w-H*F,k=z*L-q*F,A=V*w-H*U,S=V*L-q*U,x=H*L-q*w;return j*x-R*S+O*A+N*k-D*T+P*C}function bn(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=J[8],q=J[9],F=J[10],U=J[11],w=J[12],L=J[13],j=J[14],R=J[15],O=X[0],N=X[1],D=X[2],P=X[3];return Z[0]=O*Y+N*W+D*H+P*w,Z[1]=O*$+N*G+D*q+P*L,Z[2]=O*Q+N*z+D*F+P*j,Z[3]=O*K+N*V+D*U+P*R,O=X[4],N=X[5],D=X[6],P=X[7],Z[4]=O*Y+N*W+D*H+P*w,Z[5]=O*$+N*G+D*q+P*L,Z[6]=O*Q+N*z+D*F+P*j,Z[7]=O*K+N*V+D*U+P*R,O=X[8],N=X[9],D=X[10],P=X[11],Z[8]=O*Y+N*W+D*H+P*w,Z[9]=O*$+N*G+D*q+P*L,Z[10]=O*Q+N*z+D*F+P*j,Z[11]=O*K+N*V+D*U+P*R,O=X[12],N=X[13],D=X[14],P=X[15],Z[12]=O*Y+N*W+D*H+P*w,Z[13]=O*$+N*G+D*q+P*L,Z[14]=O*Q+N*z+D*F+P*j,Z[15]=O*K+N*V+D*U+P*R,Z}function Tw1(){var Z=new nQ(9);if(nQ!=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 kw1(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 Ew1(Z,J){if(Z===J){var X=J[1],Y=J[2],$=J[5];Z[1]=J[3],Z[2]=J[6],Z[3]=X,Z[5]=J[7],Z[6]=Y,Z[7]=$}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 Iw1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=J[4],W=J[5],G=J[6],z=J[7],V=J[8],H=V*K-W*z,q=-V*Q+W*G,F=z*Q-K*G,U=X*H+Y*q+$*F;if(!U)return null;return U=1/U,Z[0]=H*U,Z[1]=(-V*Y+$*z)*U,Z[2]=(W*Y-$*K)*U,Z[3]=q*U,Z[4]=(V*X-$*G)*U,Z[5]=(-W*X+$*Q)*U,Z[6]=F*U,Z[7]=(-z*X+Y*G)*U,Z[8]=(K*X-Y*Q)*U,Z}function m2(){var Z=new nQ(3);if(nQ!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function vw1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z}function yn(Z,J){var X=J[0],Y=J[1],$=J[2],Q=X*X+Y*Y+$*$;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 Sw1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=X[3]*Y+X[7]*$+X[11]*Q+X[15];return K=K||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/K,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/K,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/K,Z}function _w1(Z,J,X){var Y=J[0],$=J[1],Q=J[2];return Z[0]=Y*X[0]+$*X[3]+Q*X[6],Z[1]=Y*X[1]+$*X[4]+Q*X[7],Z[2]=Y*X[2]+$*X[5]+Q*X[8],Z}var Aw1=vw1;(function(){var Z=m2();return function(J,X,Y,$,Q,K){var W,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(W=Y;W<G;W+=X)Z[0]=J[W],Z[1]=J[W+1],Z[2]=J[W+2],Q(Z,Z,K),J[W]=Z[0],J[W+1]=Z[1],J[W+2]=Z[2];return J}})();var jJ="dedup",wC={keepUniqueNames:!1,propertyTypes:[a.ACCESSOR,a.MESH,a.TEXTURE,a.MATERIAL,a.SKIN]};function gn(Z=wC){let J=W7(wC,Z),X=new Set(J.propertyTypes);for(let Y of J.propertyTypes)if(!wC.propertyTypes.includes(Y))throw new Error(`${jJ}: Unsupported deduplication on type "${Y}".`);return MJ(jJ,(Y)=>{let $=Y.getLogger();if(X.has(a.ACCESSOR))xw1(Y);if(X.has(a.TEXTURE))fw1(Y,J);if(X.has(a.MATERIAL))bw1(Y,J);if(X.has(a.MESH))hw1(Y,J);if(X.has(a.SKIN))yw1(Y,J);$.debug(`${jJ}: Complete.`)})}function xw1(Z){let J=Z.getLogger(),X=new Map,Y=new Map,$=new Map,Q=new Map,K=Z.getRoot().listMeshes();K.forEach((H)=>{H.listPrimitives().forEach((q)=>{q.listAttributes().forEach((F)=>W(F,Y)),W(q.getIndices(),X)})});for(let H of Z.getRoot().listAnimations())for(let q of H.listSamplers())W(q.getInput(),$),W(q.getOutput(),Q);function W(H,q){if(!H)return;let F=[H.getCount(),H.getType(),H.getComponentType(),H.getNormalized(),H.getSparse()].join(":"),U=q.get(F);if(!U)q.set(F,U=new Set);U.add(H)}function G(H,q){for(let F=0;F<H.length;F++){let U=H[F],w=n0.toView(U.getArray());if(q.has(U))continue;for(let L=F+1;L<H.length;L++){let j=H[L];if(q.has(j))continue;if(n0.equals(w,n0.toView(j.getArray())))q.set(j,U)}}}let z=0,V=new Map;for(let H of[Y,X,$,Q])for(let q of H.values())z+=q.size,G(Array.from(q),V);J.debug(`${jJ}: Merged ${V.size} of ${z} accessors.`),K.forEach((H)=>{H.listPrimitives().forEach((q)=>{q.listAttributes().forEach((U)=>{if(V.has(U))q.swap(U,V.get(U))});let F=q.getIndices();if(F&&V.has(F))q.swap(F,V.get(F))})});for(let H of Z.getRoot().listAnimations())for(let q of H.listSamplers()){let F=q.getInput(),U=q.getOutput();if(F&&V.has(F))q.swap(F,V.get(F));if(U&&V.has(U))q.swap(U,V.get(U))}Array.from(V.keys()).forEach((H)=>H.dispose())}function hw1(Z,J){let X=Z.getLogger(),Y=Z.getRoot(),$=new Map;Y.listAccessors().forEach((W,G)=>$.set(W,G)),Y.listMaterials().forEach((W,G)=>$.set(W,G));let Q=Y.listMeshes().length,K=new Map;for(let W of Y.listMeshes()){let G=[];for(let V of W.listPrimitives())G.push(mn(V,$));let z="";if(J.keepUniqueNames)z+=W.getName()+";";if(z+=G.join(";"),K.has(z)){let V=K.get(z);W.listParents().forEach((H)=>{if(H.propertyType!==a.ROOT)H.swap(W,V)}),W.dispose()}else K.set(z,W)}X.debug(`${jJ}: Merged ${Q-K.size} of ${Q} meshes.`)}function fw1(Z,J){let X=Z.getLogger(),Y=Z.getRoot(),$=Y.listTextures(),Q=new Map;for(let K=0;K<$.length;K++){let W=$[K],G=W.getImage();if(Q.has(W))continue;for(let z=K+1;z<$.length;z++){let V=$[z],H=V.getImage();if(Q.has(V))continue;if(W.getMimeType()!==V.getMimeType())continue;if(J.keepUniqueNames&&W.getName()!==V.getName())continue;let q=W.getSize(),F=V.getSize();if(!q||!F)continue;if(q[0]!==F[0])continue;if(q[1]!==F[1])continue;if(!G||!H)continue;if(n0.equals(G,H))Q.set(V,W)}}X.debug(`${jJ}: Merged ${Q.size} of ${Y.listTextures().length} textures.`),Array.from(Q.entries()).forEach(([K,W])=>{K.listParents().forEach((G)=>{if(!(G instanceof ZY))G.swap(K,W)}),K.dispose()})}function bw1(Z,J){let X=Z.getLogger(),$=Z.getRoot().listMaterials(),Q=new Map,K=new Map,W=new Set;if(!J.keepUniqueNames)W.add("name");for(let G=0;G<$.length;G++){let z=$[G];if(Q.has(z))continue;if(Ln(z,K))continue;for(let V=G+1;V<$.length;V++){let H=$[V];if(Q.has(H))continue;if(Ln(H,K))continue;if(z.equals(H,W))Q.set(H,z)}}X.debug(`${jJ}: Merged ${Q.size} of ${$.length} materials.`),Array.from(Q.entries()).forEach(([G,z])=>{G.listParents().forEach((V)=>{if(!(V instanceof ZY))V.swap(G,z)}),G.dispose()})}function yw1(Z,J){let X=Z.getLogger(),$=Z.getRoot().listSkins(),Q=new Map,K=new Set(["joints"]);if(!J.keepUniqueNames)K.add("name");for(let W=0;W<$.length;W++){let G=$[W];if(Q.has(G))continue;for(let z=W+1;z<$.length;z++){let V=$[z];if(Q.has(V))continue;if(G.equals(V,K)&&Bw1(G.listJoints(),V.listJoints()))Q.set(V,G)}}X.debug(`${jJ}: Merged ${Q.size} of ${$.length} skins.`),Array.from(Q.entries()).forEach(([W,G])=>{W.listParents().forEach((z)=>{if(!(z instanceof ZY))z.swap(W,G)}),W.dispose()})}function mn(Z,J){let X=[];for(let Y of Z.listSemantics()){let $=Z.getAttribute(Y);X.push(Y+":"+J.get($))}if(Z instanceof M8){let Y=Z.getIndices();if(Y)X.push("indices:"+J.get(Y));let $=Z.getMaterial();if($)X.push("material:"+J.get($));X.push("mode:"+Z.getMode());for(let Q of Z.listTargets())X.push("target:"+mn(Q,J))}return X.join(",")}function Ln(Z,J){if(J.has(Z))return J.get(Z);let X=Z.getGraph(),Y=new Set,$=X.listParentEdges(Z);while($.length>0){let Q=$.pop();if(Q.getAttributes().modifyChild===!0)return J.set(Z,!0),!0;let K=Q.getChild();if(Y.has(K))continue;for(let W of X.listChildEdges(K))$.push(W)}return J.set(Z,!1),!1}function un(){var Z=new nQ(4);if(nQ!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function gw1(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z}function mw1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z[3]=J[3]-X[3],Z}function uw1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z[3]=J[3]*X[3],Z}function dw1(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z}function cw1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return Math.hypot(J,X,Y,$)}var dn=mw1,lw1=uw1,cn=cw1;(function(){var Z=un();return function(J,X,Y,$,Q,K){var W,G;if(!X)X=4;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(W=Y;W<G;W+=X)Z[0]=J[W],Z[1]=J[W+1],Z[2]=J[W+2],Z[3]=J[W+3],Q(Z,Z,K),J[W]=Z[0],J[W+1]=Z[1],J[W+2]=Z[2],J[W+3]=Z[3];return J}})();var pw1=/color|emissive|diffuse/i;function iw1(Z){return Z.getGraph().listParentEdges(Z).some(($)=>{return $.getAttributes().isColor||pw1.test($.getName())})?"srgb":null}function nw1(Z){let J=Z.getGraph(),X=new Set,Y=new Set;function $(Q){let K=new Set;for(let W of J.listChildEdges(Q))if(W.getChild()instanceof eX)K.add(W.getName()+"Info");for(let W of J.listChildEdges(Q)){let G=W.getChild();if(X.has(G))continue;if(X.add(G),G instanceof B5&&K.has(W.getName()))Y.add(G);else if(G instanceof EQ)$(G)}}return $(Z),Array.from(Y)}function aw1(Z){let X=C6.fromGraph(Z.getGraph()).getRoot(),Y=Z.getGraph().listParentEdges(Z).filter(($)=>$.getParent()!==X).map(($)=>$.getName());return Array.from(new Set(Y))}var pQ="prune",MC=0.011764705882352941,wn={propertyTypes:[a.NODE,a.SKIN,a.MESH,a.CAMERA,a.PRIMITIVE,a.PRIMITIVE_TARGET,a.ANIMATION,a.MATERIAL,a.TEXTURE,a.ACCESSOR,a.BUFFER],keepLeaves:!1,keepAttributes:!1,keepIndices:!1,keepSolidTextures:!1,keepExtras:!1};function u2(Z=wn){let J=W7(wn,Z),X=new Set(J.propertyTypes),Y=J.keepExtras;return MJ(pQ,async($)=>{let Q=$.getLogger(),K=$.getRoot(),W=$.getGraph(),G=new ln,z=(V)=>G.dispose(V.target);if(W.addEventListener("node:dispose",z),X.has(a.MESH))for(let V of K.listMeshes()){if(V.listPrimitives().length>0)continue;V.dispose()}if(X.has(a.NODE)){if(!J.keepLeaves)for(let V of K.listScenes())pn(W,V,Y);for(let V of K.listNodes())N9(V,Y)}if(X.has(a.SKIN))for(let V of K.listSkins())N9(V,Y);if(X.has(a.MESH))for(let V of K.listMeshes())N9(V,Y);if(X.has(a.CAMERA))for(let V of K.listCameras())N9(V,Y);if(X.has(a.PRIMITIVE))Bn(W,a.PRIMITIVE,Y);if(X.has(a.PRIMITIVE_TARGET))Bn(W,a.PRIMITIVE_TARGET,Y);if(!J.keepAttributes&&X.has(a.ACCESSOR)){let V=new Map;for(let H of K.listMeshes())for(let q of H.listPrimitives()){let F=q.getMaterial();if(!F)continue;let U=nn($,q,F),w=ow1(q,U);jn(q,w),q.listTargets().forEach((L)=>jn(L,w)),V.has(F)?V.get(F).add(q):V.set(F,new Set([q]))}for(let[H,q]of V)rw1(H,Array.from(q))}if(!J.keepIndices&&X.has(a.ACCESSOR))for(let V of K.listMeshes())for(let H of V.listPrimitives())sw1(H);if(X.has(a.ANIMATION))for(let V of K.listAnimations()){for(let H of V.listChannels())if(!H.getTargetNode())H.dispose();if(!V.listChannels().length){let H=V.listSamplers();N9(V,Y),H.forEach((q)=>N9(q,Y))}else V.listSamplers().forEach((H)=>N9(H,Y))}if(X.has(a.MATERIAL))K.listMaterials().forEach((V)=>N9(V,Y));if(X.has(a.TEXTURE)){if(K.listTextures().forEach((V)=>N9(V,Y)),!J.keepSolidTextures)await tw1($)}if(X.has(a.ACCESSOR))K.listAccessors().forEach((V)=>N9(V,Y));if(X.has(a.BUFFER))K.listBuffers().forEach((V)=>N9(V,Y));if(W.removeEventListener("node:dispose",z),!G.empty()){let V=G.entries().map(([H,q])=>`${H} (${q})`).join(", ");Q.info(`${pQ}: Removed types... ${V}`)}else Q.debug(`${pQ}: No unused properties found.`);Q.debug(`${pQ}: Complete.`)})}class ln{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 N9(Z,J){let X=Z.listParents().filter(($)=>!($ instanceof ZY||$ instanceof rX)),Y=J&&!xn(Z.getExtras());if(!X.length&&!Y)Z.dispose()}function Bn(Z,J,X){for(let Y of Z.listEdges()){let $=Y.getParent();if($.propertyType===J)N9($,X)}}function pn(Z,J,X){if(J.listChildren().forEach((K)=>pn(Z,K,X)),J instanceof IQ)return;let Y=Z.listParentEdges(J).some((K)=>{let W=K.getParent().propertyType;return W!==a.ROOT&&W!==a.SCENE&&W!==a.NODE}),$=Z.listChildren(J).length===0,Q=X&&!xn(J.getExtras());if($&&!Y&&!Q)J.dispose()}function jn(Z,J){for(let X of J)Z.setAttribute(X,null)}function sw1(Z){let J=Z.getIndices(),X=J&&J.getArray(),Y=Z.listAttributes()[0];if(!X||!Y)return;if(J.getCount()!==Y.getCount())return;for(let $=0,Q=X.length;$<Q;$++)if($!==X[$])return;Z.setIndices(null)}function ow1(Z,J){let X=[];for(let Y of Z.listSemantics())if(Y==="NORMAL"&&!J.has(Y))X.push(Y);else if(Y==="TANGENT"&&!J.has(Y))X.push(Y);else if(Y.startsWith("TEXCOORD_")&&!J.has(Y))X.push(Y);else if(Y.startsWith("COLOR_")&&Y!=="COLOR_0")X.push(Y);return X}function nn(Z,J,X,Y=new Set){let Q=Z.getGraph().listChildEdges(X),K=new Set;for(let z of Q)if(z.getChild()instanceof eX)K.add(z.getName());for(let z of Q){let V=z.getName(),H=z.getChild();if(H instanceof B5){if(K.has(V.replace(/Info$/,"")))Y.add(`TEXCOORD_${H.getTexCoord()}`)}if(H instanceof eX&&V.match(/normalTexture/i))Y.add("TANGENT");if(H instanceof EQ)nn(Z,J,H,Y)}let W=X instanceof t4&&!X.getExtension("KHR_materials_unlit"),G=J.getMode()===M8.Mode.POINTS;if(W&&!G)Y.add("NORMAL");return Y}function rw1(Z,J){let X=nw1(Z),Y=new Set(X.map((G)=>G.getTexCoord())),$=Array.from(Y).sort(),Q=new Map($.map((G,z)=>[G,z])),K=new Map($.map((G,z)=>[`TEXCOORD_${G}`,`TEXCOORD_${z}`]));for(let G of X){let z=G.getTexCoord();G.setTexCoord(Q.get(z))}for(let G of J){let z=G.listSemantics().filter((V)=>V.startsWith("TEXCOORD_")).sort();W(G,z),G.listTargets().forEach((V)=>W(V,z))}function W(G,z){for(let V of z){let H=G.getAttribute(V);if(!H)continue;let q=K.get(V);if(q===V)continue;G.setAttribute(q,H),G.setAttribute(V,null)}}}async function tw1(Z){let J=Z.getRoot(),X=Z.getGraph(),Y=Z.getLogger(),Q=J.listTextures().map(async(K)=>{var W;let G=await ZB1(K);if(!G)return;if(iw1(K)==="srgb")CP.convertSRGBToLinear(G,G);let z=K.getName()||K.getURI(),V=(W=K.getSize())==null?void 0:W.join("x"),H=aw1(K);for(let q of X.listParentEdges(K)){let F=q.getParent();if(F!==J&&ew1(F,G,q.getName(),Y))q.dispose()}if(K.listParents().length===1)K.dispose(),Y.debug(`${pQ}: Removed solid-color texture "${z}" (${V}px ${H.join(", ")})`)});await Promise.all(Q)}function ew1(Z,J,X,Y){if(Z instanceof t4)switch(X){case"baseColorTexture":return Z.setBaseColorFactor(lw1(J,J,Z.getBaseColorFactor())),!0;case"emissiveTexture":return Z.setEmissiveFactor(Aw1([0,0,0],J.slice(0,3),Z.getEmissiveFactor())),!0;case"occlusionTexture":return Math.abs(J[0]-1)<=MC;case"metallicRoughnessTexture":return Z.setRoughnessFactor(J[1]*Z.getRoughnessFactor()),Z.setMetallicFactor(J[2]*Z.getMetallicFactor()),!0;case"normalTexture":return cn(dn(un(),J,[0.5,0.5,1,1]))<=MC}return Y.warn(`${pQ}: Detected single-color ${X} texture. Pruning ${X} not yet supported.`),!1}async function ZB1(Z){let J=await JB1(Z);if(!J)return null;let X=[1/0,1/0,1/0,1/0],Y=[-1/0,-1/0,-1/0,-1/0],$=[0,0,0,0],[Q,K]=J.shape;for(let W=0;W<Q;W++){for(let G=0;G<K;G++)for(let z=0;z<4;z++)X[z]=Math.min(X[z],J.get(W,G,z)),Y[z]=Math.max(Y[z],J.get(W,G,z));if(cn(dn($,Y,X))/255>MC)return null}return dw1($,gw1($,Y,X),0.00196078431372549)}async function JB1(Z){try{return await Si(Z.getImage(),Z.getMimeType())}catch(J){return null}}var BJ=4294967295;class an{constructor(Z){this.attributes=[],this.u8=void 0,this.u32=void 0;let J=0;for(let X of TC(Z))J+=this._initAttribute(X);this.u8=new Uint8Array(J),this.u32=new Uint32Array(this.u8.buffer)}_initAttribute(Z){let J=Z.getArray(),X=new Uint8Array(J.buffer,J.byteOffset,J.byteLength),Y=Z.getElementSize()*Z.getComponentSize(),$=n0.padNumber(Y);return this.attributes.push({u8:X,byteStride:Y,paddedByteStride:$}),$}hash(Z){let J=0;for(let{u8:X,byteStride:Y,paddedByteStride:$}of this.attributes){for(let Q=0;Q<$;Q++)if(Q<Y)this.u8[J+Q]=X[Z*Y+Q];else this.u8[J+Q]=0;J+=$}return XB1(0,this.u32)}equal(Z,J){for(let{u8:X,byteStride:Y}of this.attributes)for(let $=0;$<Y;$++)if(X[Z*Y+$]!==X[J*Y+$])return!1;return!0}}function XB1(Z,J){for(let $=0,Q=J.length;$<Q;$++){let K=J[$];K=Math.imul(K,1540483477)>>>0,K=(K^K>>24)>>>0,K=Math.imul(K,1540483477)>>>0,Z=Math.imul(Z,1540483477)>>>0,Z=(Z^K)>>>0}return Z}function YB1(Z,J,X,Y,$=BJ){let Q=J-1,W=X.hash(Y)&Q;for(let G=0;G<=Q;G++){let z=Z[W];if(z===$||X.equal(z,Y))return W;W=W+G+1&Q}throw new Error("Hash table full.")}var w6;(function(Z){Z.RENDER="render",Z.RENDER_CACHED="render-cached",Z.UPLOAD="upload",Z.UPLOAD_NAIVE="upload-naive",Z.DISTINCT="distinct",Z.DISTINCT_POSITION="distinct-position",Z.UNUSED="unused"})(w6||(w6={}));function OJ(Z,J){let X=Z.getAttribute("POSITION"),Y=Z.getIndices();switch(J){case w6.RENDER:return Y?Y.getCount():X.getCount();case w6.RENDER_CACHED:return Y?new Set(Y.getArray()).size:X.getCount();case w6.UPLOAD_NAIVE:case w6.UPLOAD:return X.getCount();case w6.DISTINCT:case w6.DISTINCT_POSITION:return $B1(J);case w6.UNUSED:return Y?X.getCount()-new Set(Y.getArray()).size:0;default:return QB1(J)}}function $B1(Z){throw new Error(`Not implemented: ${Z}`)}function QB1(Z){throw new Error(`Unexpected value: ${Z}`)}function E3(Z,J,X){let Y=C6.fromGraph(Z.getGraph());if(!J||!X)[J,X]=KB1(Z);let $=Z.getIndices(),Q=$?$.getArray():null,K=OJ(Z,w6.RENDER),W=Y.createAccessor(),G=K,z=kC(G,X);for(let H=0;H<G;H++)z[H]=J[Q?Q[H]:H];Z.setIndices(W.setArray(z));let V=TC(Z);for(let H of Z.listAttributes()){let q=HZ(Y,H);RC(H,$,J,q,X),Z.swap(H,q)}for(let H of Z.listTargets())for(let q of H.listAttributes()){let F=HZ(Y,q);RC(q,$,J,F,X),H.swap(q,F)}if($&&$.listParents().length===1)$.dispose();for(let H of V)if(H.listParents().length===1)H.dispose();return Z}function RC(Z,J,X,Y,$){let Q=Z.getElementSize(),K=Z.getArray(),W=J?J.getArray():null,G=J?J.getCount():Z.getCount(),z=new K.constructor($*Q),V=new Uint8Array($);for(let H=0;H<G;H++){let q=W?W[H]:H,F=X[q];if(V[F])continue;for(let U=0;U<Q;U++)z[F*Q+U]=K[q*Q+U];V[F]=1}return Y.setArray(z)}function KB1(Z){let J=OJ(Z,w6.UPLOAD),X=Z.getIndices(),Y=X?X.getArray():null;if(!X||!Y)return[jw1(J,1e6),J];let $=new Uint32Array(J).fill(BJ),Q=0;for(let K=0;K<Y.length;K++){let W=Y[K];if($[W]===BJ)$[W]=Q++}return[$,Q]}var NC="weld",f2={overwrite:!0,cleanup:!0};function EC(Z=f2){let J=W7(f2,Z);return MJ(NC,async(X)=>{let Y=X.getLogger();for(let $ of X.getRoot().listMeshes()){for(let Q of $.listPrimitives())if(d2(Q,J),OJ(Q,w6.RENDER)===0)Q.dispose();if($.listPrimitives().length===0)$.dispose()}if(J.cleanup)await X.transform(u2({propertyTypes:[a.ACCESSOR,a.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),gn({propertyTypes:[a.ACCESSOR]}));Y.debug(`${NC}: Complete.`)})}function d2(Z,J=f2){let X=Z.getGraph(),$=C6.fromGraph(X).getLogger(),Q=iQ({},f2,J);if(Z.getIndices()&&!Q.overwrite)return;if(Z.getMode()===M8.Mode.POINTS)return;let K=Z.getAttribute("POSITION").getCount(),W=Z.getIndices(),G=W==null?void 0:W.getArray(),z=W?W.getCount():K,V=new an(Z),H=Mw1(K+K/4),q=new Uint32Array(H).fill(BJ),F=new Uint32Array(K).fill(BJ),U=0;for(let w=0;w<z;w++){let L=G?G[w]:w;if(F[L]!==BJ)continue;let j=YB1(q,H,V,L,BJ),R=q[j];if(R===BJ)q[j]=L,F[L]=U++;else F[L]=F[R]}$.debug(`${NC}: ${g2(K,U)} vertices.`),E3(Z,F,U)}var{FLOAT:WB1}=E0.ComponentType;function sn(Z,J){let X=Z.getAttribute("POSITION");if(X)On(J,X);let Y=Z.getAttribute("NORMAL");if(Y)Mn(J,Y);let $=Z.getAttribute("TANGENT");if($)Rn(J,$);for(let Q of Z.listTargets()){let K=Q.getAttribute("POSITION");if(K)On(J,K);let W=Q.getAttribute("NORMAL");if(W)Mn(J,W);let G=Q.getAttribute("TANGENT");if(G)Rn(J,G)}if(Cw1(J)<0)GB1(Z)}function On(Z,J){let X=J.getComponentType(),Y=J.getNormalized(),$=J.getArray(),Q=X===WB1?$:new Float32Array($.length),K=m2();for(let W=0,G=J.getCount();W<G;W++){if(Y)K[0]=d0.decodeNormalizedInt($[W*3],X),K[1]=d0.decodeNormalizedInt($[W*3+1],X),K[2]=d0.decodeNormalizedInt($[W*3+2],X);else K[0]=$[W*3],K[1]=$[W*3+1],K[2]=$[W*3+2];Sw1(K,K,Z),Q[W*3]=K[0],Q[W*3+1]=K[1],Q[W*3+2]=K[2]}J.setArray(Q).setNormalized(!1)}function Mn(Z,J){let X=J.getArray(),Y=J.getNormalized(),$=J.getComponentType(),Q=Tw1();kw1(Q,Z),Iw1(Q,Q),Ew1(Q,Q);let K=m2();for(let W=0,G=J.getCount();W<G;W++){if(Y)K[0]=d0.decodeNormalizedInt(X[W*3],$),K[1]=d0.decodeNormalizedInt(X[W*3+1],$),K[2]=d0.decodeNormalizedInt(X[W*3+2],$);else K[0]=X[W*3],K[1]=X[W*3+1],K[2]=X[W*3+2];if(_w1(K,K,Q),yn(K,K),Y)X[W*3]=d0.decodeNormalizedInt(K[0],$),X[W*3+1]=d0.decodeNormalizedInt(K[1],$),X[W*3+2]=d0.decodeNormalizedInt(K[2],$);else X[W*3]=K[0],X[W*3+1]=K[1],X[W*3+2]=K[2]}}function Rn(Z,J){let X=J.getArray(),Y=J.getNormalized(),$=J.getComponentType(),Q=m2();for(let K=0,W=J.getCount();K<W;K++){if(Y)Q[0]=d0.decodeNormalizedInt(X[K*4],$),Q[1]=d0.decodeNormalizedInt(X[K*4+1],$),Q[2]=d0.decodeNormalizedInt(X[K*4+2],$);else Q[0]=X[K*4],Q[1]=X[K*4+1],Q[2]=X[K*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],yn(Q,Q),Y)X[K*4]=d0.decodeNormalizedInt(Q[0],$),X[K*4+1]=d0.decodeNormalizedInt(Q[1],$),X[K*4+2]=d0.decodeNormalizedInt(Q[2],$);else X[K*4]=Q[0],X[K*4+1]=Q[1],X[K*4+2]=Q[2]}}function GB1(Z){if(Z.getMode()!==M8.Mode.TRIANGLES)return;if(!Z.getIndices())d2(Z);let J=Z.getIndices();for(let X=0,Y=J.getCount();X<Y;X+=3){let $=J.getScalar(X),Q=J.getScalar(X+2);J.setScalar(X,Q),J.setScalar(X+2,$)}}function zB1(Z,J){for(let X of Z.listPrimitives()){let Y=VB1(X,Z);if(X!==Y)Z.removePrimitive(X).addPrimitive(Y)}for(let X of Z.listPrimitives())E3(X),sn(X,J)}function VB1(Z,J){if(Z.listParents().some((Y)=>Y instanceof $3&&Y!==J))Z=Z.clone();for(let Y of Z.listTargets())if(Y.listParents().some((Q)=>Q instanceof M8&&Q!==Z))Z.removeTarget(Y).addTarget(Y.clone());return Z}var Nn=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function on(Z){let J=Z.getMesh(),X=Z.getMatrix();if(J&&!d0.eq(X,Nn))zB1(J,X);for(let Y of Z.listChildren()){let $=Y.getMatrix();bn($,$,X),Y.setMatrix($)}return Z.setMatrix(Nn)}var{LINES:HB1,LINE_STRIP:qB1,LINE_LOOP:FB1,TRIANGLES:UB1,TRIANGLE_STRIP:LB1,TRIANGLE_FAN:wB1}=M8.Mode;function BB1(Z){let J=Z.getGraph(),X=C6.fromGraph(J);if(!Z.getIndices())d2(Z);let Y=Z.getIndices(),$=Y.getArray(),Q=An(Z),W=new GJ[Y.getComponentType()](Q*2),G=Z.getMode();if(G===qB1)for(let V=0;V<Q;V++)W[V*2]=$[V],W[V*2+1]=$[V+1];else if(G===FB1)for(let V=0;V<Q;V++)if(V<Q-1)W[V*2]=$[V],W[V*2+1]=$[V+1];else W[V*2]=$[V],W[V*2+1]=$[0];else throw new Error("Only LINE_STRIP and LINE_LOOP may be converted to LINES.");Z.setMode(HB1);let z=X.getRoot();if(Y.listParents().some((V)=>V!==z&&V!==Z))Z.setIndices(HZ(X,Y).setArray(W));else Y.setArray(W)}function rn(Z){let J=Z.getGraph(),X=C6.fromGraph(J);if(!Z.getIndices())d2(Z);let Y=Z.getIndices(),$=Y.getArray(),Q=An(Z),W=new GJ[Y.getComponentType()](Q*3),G=Z.getMode();if(G===LB1)for(let V=0,H=$.length;V<H-2;V++)if(V%2)W[V*3]=$[V+1],W[V*3+1]=$[V],W[V*3+2]=$[V+2];else W[V*3]=$[V],W[V*3+1]=$[V+1],W[V*3+2]=$[V+2];else if(G===wB1)for(let V=0;V<Q;V++)W[V*3]=$[0],W[V*3+1]=$[V+1],W[V*3+2]=$[V+2];else throw new Error("Only TRIANGLE_STRIP and TRIANGLE_FAN may be converted to TRIANGLES.");Z.setMode(UB1);let z=X.getRoot();if(Y.listParents().some((V)=>V!==z&&V!==Z))Z.setIndices(HZ(X,Y).setArray(W));else Y.setArray(W)}var Pn="dequantize",b2={pattern:/^((?!JOINTS_).)*$/};function tn(Z=b2){let J=W7(b2,Z);return MJ(Pn,(X)=>{let Y=X.getLogger();for(let $ of X.getRoot().listMeshes())for(let Q of $.listPrimitives())jB1(Q,J);X.createExtension(T3).dispose(),Y.debug(`${Pn}: Complete.`)})}function jB1(Z,J=b2){let X=W7(b2,J);for(let Y of Z.listSemantics())if(X.pattern.test(Y))PC(Z.getAttribute(Y));for(let Y of Z.listTargets())for(let $ of Y.listSemantics())if(X.pattern.test($))PC(Y.getAttribute($))}function PC(Z){let J=Z.getArray();if(!J)return;let X=y2(J,Z.getComponentType(),Z.getNormalized());Z.setArray(X).setNormalized(!1)}function y2(Z,J,X){let Y=new Float32Array(Z.length);for(let $=0,Q=Z.length;$<Q;$++)if(X)Y[$]=d0.decodeNormalizedInt(Z[$],J);else Y[$]=Z[$];return Y}var{TEXTURE_INFO:en,ROOT:YV6}=a;function Za(Z){let J=new C6().setLogger(Z.getLogger()),X=IC(J,Z);return OB1(J,Z,X),J.getRoot().copy(Z.getRoot(),X),J}function OB1(Z,J,X){X||(X=IC(Z,J));for(let Y of J.getRoot().listExtensionsUsed()){let $=Z.createExtension(Y.constructor);if(Y.isRequired())$.setRequired(!0)}return MB1(Z,J,RB1(J),X)}function MB1(Z,J,X,Y){Y||(Y=IC(Z,J));let $=new Map;for(let Q of X)if(!$.has(Q)&&Q.propertyType!==en)$.set(Q,Y(Q));for(let[Q,K]of $.entries())K.copy(Q,Y);return $}function IC(Z,J){let X=new Map([[J.getRoot(),Z.getRoot()]]);return(Y)=>{if(Y.propertyType===en)return Y;let $=X.get(Y);if(!$)$=new Y.constructor(Z.getGraph()),X.set(Y,$);return $}}function RB1(Z){let J=new Set;for(let X of Z.getGraph().listEdges())J.add(X.getChild());return Array.from(J)}var BC="flatten",Dn={cleanup:!0};function Ja(Z=Dn){let J=W7(Dn,Z);return MJ(BC,async(X)=>{let Y=X.getRoot(),$=X.getLogger(),Q=new Set;for(let z of Y.listSkins())for(let V of z.listJoints())Q.add(V);let K=new Set;for(let z of Y.listAnimations())for(let V of z.listChannels()){let H=V.getTargetNode();if(H&&V.getTargetPath()!=="weights")K.add(H)}let W=new Set,G=new Set;for(let z of Y.listScenes())z.traverse((V)=>{let H=V.getParentNode();if(!H)return;if(Q.has(H)||W.has(H))W.add(V);if(K.has(H)||G.has(H))G.add(V)});for(let z of Y.listScenes())z.traverse((V)=>{if(K.has(V))return;if(W.has(V))return;if(G.has(V))return;Pw1(V)});if(K.size)$.debug(`${BC}: Flattening node hierarchies with TRS animation not yet supported.`);if(J.cleanup)await X.transform(u2({propertyTypes:[a.NODE],keepLeaves:!1}));$.debug(`${BC}: Complete.`)})}function Xa(Z){return DP(Z)}var NB1={skipValidation:!1},Cn=4294967295,{LINE_STRIP:PB1,LINE_LOOP:DB1,TRIANGLE_STRIP:CB1,TRIANGLE_FAN:TB1}=M8.Mode;function kB1(Z,J={}){let X=W7(NB1,J),Y=Z[0],$=C6.fromGraph(Y.getGraph());if(!X.skipValidation&&new Set(Z.map(hn)).size>1)throw new Error("Requires >=2 Primitives, sharing the same Material and Mode, with compatible vertex attributes and indices.");for(let F of Z)switch(F.getMode()){case PB1:case DB1:BB1(F);break;case CB1:case TB1:rn(F);break}let Q=[],K=new Uint32Array(Z.length),W=0,G=0;for(let F=0;F<Z.length;F++){let U=Z[F],w=U.getIndices(),L=U.getAttribute("POSITION").getCount(),j=w?w.getArray():null,R=w?w.getCount():L,O=new Uint32Array(L).fill(Cn);for(let N=0;N<R;N++){let D=j?j[N]:N;if(O[D]===Cn)O[D]=W++,K[F]++}Q.push(O),G+=R}let z=$.createPrimitive().setMode(Y.getMode()).setMaterial(Y.getMaterial());for(let F of Y.listSemantics()){let U=Y.getAttribute(F),w=GJ[U.getComponentType()],L=HZ($,U).setArray(new w(W*U.getElementSize()));z.setAttribute(F,L)}let V=Y.getIndices(),H=V?HZ($,V).setArray(kC(G,W)):null;z.setIndices(H);let q=0;for(let F=0;F<Q.length;F++){let U=Z[F],w=U.getIndices(),L=w?w.getCount():-1,j=Q[F];if(w&&H)IB1(w,j,H,q),q+=L;for(let R of z.listSemantics()){let O=U.getAttribute(R),N=z.getAttribute(R);EB1(O,w,j,N)}}return z}function EB1(Z,J,X,Y){let $=Z.getElementSize(),Q=J?J.getArray():null,K=Z.getCount(),W=Z.getArray(),G=Y.getArray(),z=new Uint8Array(Z.getCount());for(let V=0,H=J?J.getCount():K;V<H;V++){let q=Q?Q[V]:V,F=X[q];if(z[F])continue;for(let U=0;U<$;U++)G[F*$+U]=W[q*$+U];z[F]=1}}function IB1(Z,J,X,Y){let $=Z.getCount(),Q=Z.getArray(),K=X.getArray();for(let W=0;W<$;W++){let G=Q[W],z=J[G];K[Y+W]=z}}var DC="join",{ROOT:vB1,NODE:SB1,MESH:_B1,PRIMITIVE:AB1,ACCESSOR:xB1}=a,jC=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Tn={keepMeshes:!1,keepNamed:!1,cleanup:!0};function Ya(Z=Tn){let J=W7(Tn,Z);return MJ(DC,async(X)=>{let Y=X.getRoot(),$=X.getLogger();for(let Q of Y.listScenes())kn(X,Q,J),Q.traverse((K)=>kn(X,K,J));if(J.cleanup)await X.transform(u2({propertyTypes:[SB1,_B1,AB1,xB1],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}));$.debug(`${DC}: Complete.`)})}function kn(Z,J,X){let Y=Z.getLogger(),$={},Q=J.listChildren();for(let G=0;G<Q.length;G++){let z=Q[G];if(z.listParents().some((q)=>q instanceof rX))continue;let H=z.getMesh();if(!H)continue;if(z.getExtension("EXT_mesh_gpu_instancing"))continue;if(z.getSkin())continue;for(let q of H.listPrimitives()){if(q.listTargets().length>0)continue;let F=q.getMaterial();if(F&&F.getExtension("KHR_materials_volume"))continue;E3(q),fB1(q);let U=hn(q),w=H.getName()||z.getName();if(X.keepMeshes||X.keepNamed&&w)U+=`|${G}`;if(!(U in $))$[U]={prims:[],primMeshes:[],primNodes:[],dstNode:z,dstMesh:void 0};let L=$[U];L.prims.push(q),L.primNodes.push(z)}}let K=Object.values($).filter(({prims:G})=>G.length>1),W=new Set(K.flatMap((G)=>G.primNodes));for(let G of W){let z=G.getMesh();if(z.listParents().some((H)=>{return H.propertyType!==vB1&&G!==H}))G.setMesh(z.clone())}for(let G of K){let{dstNode:z,primNodes:V}=G;G.dstMesh=z.getMesh(),G.primMeshes=V.map((H)=>H.getMesh())}for(let G of K){let{prims:z,primNodes:V,primMeshes:H,dstNode:q,dstMesh:F}=G,U=q.getMatrix();for(let j=0;j<z.length;j++){let R=V[j],O=H[j],N=z[j];if(O.removePrimitive(N),Ow1(N))N=z[j]=hB1(z[j]);if(R!==q)bn(jC,Dw1(jC,U),R.getMatrix()),sn(N,jC)}let w=kB1(z),L=w.listAttributes()[0].getCount();F.addPrimitive(w),Y.debug(`${DC}: Joined Primitives (${z.length}) containing ${OC(L)} vertices under Node "${q.getName()}".`)}}function hB1(Z){let J=Z.clone();for(let Y of J.listSemantics())J.setAttribute(Y,J.getAttribute(Y).clone());let X=J.getIndices();if(X)J.setIndices(X.clone());return J}function fB1(Z){for(let J of["POSITION","NORMAL","TANGENT"]){let X=Z.getAttribute(J);if(X)PC(X)}}var{TRANSLATION:$V6,ROTATION:QV6,SCALE:KV6,WEIGHTS:WV6}=rX.TargetPath;var bB1={pattern:/.*/,quantizationVolume:"mesh",quantizePosition:14,quantizeNormal:10,quantizeTexcoord:12,quantizeColor:8,quantizeWeight:8,quantizeGeneric:12,normalizeWeights:!0,cleanup:!0};var GV6=iQ({level:"high"},bB1);var yB1="unweld";function gB1(Z,J=new Map){let X=Z.getIndices();if(!X)return;let Y=Z.getGraph(),$=C6.fromGraph(Y),Q=$.getLogger(),K=Z.getAttribute("POSITION").getCount();for(let G of Z.listAttributes())if(Z.swap(G,En($,G,X,J)),G.listParents().length===1)G.dispose();for(let G of Z.listTargets())for(let z of G.listAttributes())if(G.swap(z,En($,z,X,J)),z.listParents().length===1)z.dispose();let W=Z.getAttribute("POSITION").getCount();if(Q.debug(`${yB1}: ${g2(K,W)} vertices.`),Z.setIndices(null),X.listParents().length===1)X.dispose()}function En(Z,J,X,Y){if(Y.has(J)&&Y.get(J).has(X))return Y.get(J).get(X);let $=J.getArray(),K=new $.constructor(X.getCount()*J.getElementSize()),W=X.getArray(),G=J.getElementSize();for(let V=0,H=X.getCount();V<H;V++)for(let q=0;q<G;q++)K[V*G+q]=$[W[V]*G+q];if(!Y.has(J))Y.set(J,new Map);let z=HZ(Z,J).setArray(K);return Y.get(J).set(X,z),z}var In;(function(Z){Z[Z.STEP=0]="STEP",Z[Z.LERP=1]="LERP",Z[Z.SLERP=2]="SLERP"})(In||(In={}));var mB1=0.000001;function uB1(Z,J,X,Y=0.0001){let $=J.length/Z.length,Q=new Array($).fill(0),K=new Array($).fill(0),W=new Array($).fill(0),G=new Array($).fill(0),z=Z.length-1,V=1;for(let H=1;H<z;++H){let q=Z[V-1],F=Z[H],U=Z[H+1],w=(F-q)/(U-q),L=!1;if(F!==U&&(H!==1||F!==Z[0])){if(k3(J,V-1,G),k3(J,H,K),k3(J,H+1,W),X==="slerp"){let j=lB1(Q,G,W,w),R=Sn(G,K)+Sn(K,W);L=!h2(K,j,Y)||R+Number.EPSILON>=Math.PI}else if(X==="lerp"){let j=cB1(Q,G,W,w);L=!h2(K,j,Y)}else if(X==="step")L=!h2(K,G)||!h2(K,W)}if(L){if(H!==V)Z[V]=Z[H],vn(J,V,k3(J,H,Q));V++}}if(z>0)Z[V]=Z[z],vn(J,V,k3(J,z,Q)),V++;return V}function k3(Z,J,X){for(let Y=0,$=X.length;Y<$;Y++)X[Y]=Z[J*$+Y];return X}function vn(Z,J,X){for(let Y=0,$=X.length;Y<$;Y++)Z[J*$+Y]=X[Y]}function h2(Z,J,X=0){if(Z.length!==J.length)return!1;for(let Y=0;Y<Z.length;Y++)if(Math.abs(Z[Y]-J[Y])>X)return!1;return!0}function dB1(Z,J,X){return Z*(1-X)+J*X}function cB1(Z,J,X,Y){for(let $=0;$<J.length;$++)Z[$]=dB1(J[$],X[$],Y);return Z}function lB1(Z,J,X,Y){let $=J[0],Q=J[1],K=J[2],W=J[3],G=X[0],z=X[1],V=X[2],H=X[3],q,F,U,w,L;if(F=$*G+Q*z+K*V+W*H,F<0)F=-F,G=-G,z=-z,V=-V,H=-H;if(1-F>mB1)q=Math.acos(F),U=Math.sin(q),w=Math.sin((1-Y)*q)/U,L=Math.sin(Y*q)/U;else w=1-Y,L=Y;return Z[0]=w*$+L*G,Z[1]=w*Q+L*z,Z[2]=w*K+L*V,Z[3]=w*W+L*H,Z}function Sn(Z,J){let X=pB1(Z,J);return Math.acos(2*X*X-1)}function pB1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}var zV6=new Float32Array(0),VV6={ready:Promise.resolve(),resample:uB1,tolerance:0.0001,cleanup:!0};var MY="simplify",{POINTS:$a,LINES:iB1,LINE_STRIP:nB1,LINE_LOOP:aB1,TRIANGLES:sB1,TRIANGLE_STRIP:Qa,TRIANGLE_FAN:Ka}=M8.Mode,Wa={ratio:0,error:0.0001,lockBorder:!1,cleanup:!0};function Ga(Z){let J=W7(Wa,Z),X=J.simplifier;if(!X)throw new Error(`${MY}: simplifier dependency required \u2014 install "meshoptimizer".`);return MJ(MY,async(Y)=>{let $=Y.getLogger();await X.ready,await Y.transform(EC({overwrite:!1,cleanup:J.cleanup}));let Q=0;for(let K of Y.getRoot().listMeshes()){for(let W of K.listPrimitives()){let G=W.getMode();if(G===sB1||G===Qa||G===Ka){if(_n(W,J),OJ(W,w6.RENDER)===0)W.dispose()}else if(W.getMode()===$a&&!!X.simplifyPoints){if(_n(W,J),OJ(W,w6.RENDER)===0)W.dispose()}else Q++}if(K.listPrimitives().length===0)K.dispose()}if(Q>0)$.warn(`${MY}: Skipping simplification of ${Q} primitives: Unsupported draw mode.`);if(J.cleanup)await Y.transform(u2({propertyTypes:[a.ACCESSOR,a.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),gn({propertyTypes:[a.ACCESSOR]}));$.debug(`${MY}: Complete.`)})}function _n(Z,J){let X=iQ({},Wa,J),Y=X.simplifier,$=Z.getGraph(),Q=C6.fromGraph($),K=Q.getLogger();switch(Z.getMode()){case $a:return oB1(Q,Z,X);case iB1:case nB1:case aB1:return K.warn(`${MY}: Skipping primitive simplification: Unsupported draw mode.`),Z;case Qa:case Ka:rn(Z);break}let W=OJ(Z,w6.UPLOAD),G=OJ(Z,w6.RENDER);if(G<W/2)E3(Z);let z=Z.getAttribute("POSITION"),V=Z.getIndices(),H=z.getArray(),q=V.getArray();if(!(H instanceof Float32Array))H=y2(H,z.getComponentType(),z.getNormalized());if(!(q instanceof Uint32Array))q=new Uint32Array(q);let F=Math.floor(X.ratio*G/3)*3,U=X.lockBorder?["LockBorder"]:[],[w,L]=Y.simplify(q,H,3,F,X.error,U);if(Z.setIndices(HZ(Q,V).setArray(w)),V.listParents().length===1)V.dispose();E3(Z);let j=OJ(Z,w6.UPLOAD);if(j<=65534)Z.getIndices().setArray(new Uint16Array(Z.getIndices().getArray()));return K.debug(`${MY}: ${g2(W,j)} vertices, error: ${L.toFixed(4)}.`),Z}function oB1(Z,J,X){let Y=X.simplifier,$=Z.getLogger();if(J.getIndices())gB1(J);let K=J.getAttribute("POSITION"),W=J.getAttribute("COLOR_0"),G=K.getCount(),z=K.getArray(),V=W?W.getArray():void 0,H=W?W.getComponentSize():void 0;if(!(z instanceof Float32Array))z=y2(z,K.getComponentType(),K.getNormalized());if(V&&!(V instanceof Float32Array))V=y2(V,K.getComponentType(),K.getNormalized());Y.useExperimentalFeatures=!0;let q=Math.floor(X.ratio*G),F=Y.simplifyPoints(z,3,q,V,H);Y.useExperimentalFeatures=!1;let[U,w]=Y.compactMesh(F);$.debug(`${MY}: ${g2(K.getCount(),w)} vertices.`);for(let L of TC(J)){let j=HZ(Z,L);if(RC(L,null,U,j,w),ww1(J,L,j),L.listParents().length===1)L.dispose()}return J}var CC;(function(Z){Z.LANCZOS3="lanczos3",Z.LANCZOS2="lanczos2"})(CC||(CC={}));var HV6={resizeFilter:CC.LANCZOS3,pattern:void 0,formats:void 0,slots:void 0,quality:void 0,effort:void 0,lossless:!1,nearLossless:!1,limitInputPixels:!0};var FV6=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 X,Y=WebAssembly.instantiate($(Z),{}).then(function(F){X=F.instance,X.exports.__wasm_call_ctors(),X.exports.meshopt_encodeVertexVersion(0),X.exports.meshopt_encodeIndexVersion(1)});function $(F){var U=new Uint8Array(F.length);for(var w=0;w<F.length;++w){var L=F.charCodeAt(w);U[w]=L>96?L-97:L>64?L-39:L+4}var j=0;for(var w=0;w<F.length;++w)U[j++]=U[w]<60?J[U[w]]:(U[w]-60)*64+U[++w];return U.buffer.slice(0,j)}function Q(F){if(!F)throw new Error("Assertion failed")}function K(F){return new Uint8Array(F.buffer,F.byteOffset,F.byteLength)}function W(F,U,w,L){var j=X.exports.sbrk,R=j(U.length*4),O=j(w*4),N=new Uint8Array(X.exports.memory.buffer),D=K(U);if(N.set(D,R),L)L(R,R,U.length,w);var P=F(O,R,U.length,w);N=new Uint8Array(X.exports.memory.buffer);var C=new Uint32Array(w);new Uint8Array(C.buffer).set(N.subarray(O,O+w*4)),D.set(N.subarray(R,R+U.length*4)),j(R-j(0));for(var T=0;T<U.length;++T)U[T]=C[U[T]];return[C,P]}function G(F,U,w,L){var j=X.exports.sbrk,R=j(w*4),O=j(w*L),N=new Uint8Array(X.exports.memory.buffer);N.set(K(U),O),F(R,O,w,L),N=new Uint8Array(X.exports.memory.buffer);var D=new Uint32Array(w);return new Uint8Array(D.buffer).set(N.subarray(R,R+w*4)),j(R-j(0)),D}function z(F,U,w,L,j){var R=X.exports.sbrk,O=R(U),N=R(L*j),D=new Uint8Array(X.exports.memory.buffer);D.set(K(w),N);var P=F(O,U,N,L,j),C=new Uint8Array(P);return C.set(D.subarray(O,O+P)),R(O-R(0)),C}function V(F){var U=0;for(var w=0;w<F.length;++w){var L=F[w];U=U<L?L:U}return U}function H(F,U){if(Q(U==2||U==4),U==4)return new Uint32Array(F.buffer,F.byteOffset,F.byteLength/4);else{var w=new Uint16Array(F.buffer,F.byteOffset,F.byteLength/2);return new Uint32Array(w)}}function q(F,U,w,L,j,R,O){var N=X.exports.sbrk,D=N(w*L),P=N(w*R),C=new Uint8Array(X.exports.memory.buffer);C.set(K(U),P),F(D,w,L,j,P,O);var T=new Uint8Array(w*L);return T.set(C.subarray(D,D+w*L)),N(D-N(0)),T}return{ready:Y,supported:!0,reorderMesh:function(F,U,w){var L=U?w?X.exports.meshopt_optimizeVertexCacheStrip:X.exports.meshopt_optimizeVertexCache:void 0;return W(X.exports.meshopt_optimizeVertexFetchRemap,F,V(F)+1,L)},reorderPoints:function(F,U){return Q(F instanceof Float32Array),Q(F.length%U==0),Q(U>=3),G(X.exports.meshopt_spatialSortRemap,F,F.length/U,U*4)},encodeVertexBuffer:function(F,U,w){Q(w>0&&w<=256),Q(w%4==0);var L=X.exports.meshopt_encodeVertexBufferBound(U,w);return z(X.exports.meshopt_encodeVertexBuffer,L,F,U,w)},encodeIndexBuffer:function(F,U,w){Q(w==2||w==4),Q(U%3==0);var L=H(F,w),j=X.exports.meshopt_encodeIndexBufferBound(U,V(L)+1);return z(X.exports.meshopt_encodeIndexBuffer,j,L,U,4)},encodeIndexSequence:function(F,U,w){Q(w==2||w==4);var L=H(F,w),j=X.exports.meshopt_encodeIndexSequenceBound(U,V(L)+1);return z(X.exports.meshopt_encodeIndexSequence,j,L,U,4)},encodeGltfBuffer:function(F,U,w,L){var j={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return Q(j[L]),j[L](F,U,w)},encodeFilterOct:function(F,U,w,L){return Q(w==4||w==8),Q(L>=1&&L<=16),q(X.exports.meshopt_encodeFilterOct,F,U,w,L,16)},encodeFilterQuat:function(F,U,w,L){return Q(w==8),Q(L>=4&&L<=16),q(X.exports.meshopt_encodeFilterQuat,F,U,w,L,16)},encodeFilterExp:function(F,U,w,L,j){Q(w>0&&w%4==0),Q(L>=1&&L<=24);var R={Separate:0,SharedVector:1,SharedComponent:2,Clamped:3};return q(X.exports.meshopt_encodeFilterExp,F,U,w,L,w,j?R[j]:1)}}}();var LV6=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",X=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),Y=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!=="object")return{supported:!1};var $=WebAssembly.validate(X)?W(J):W(Z),Q,K=WebAssembly.instantiate($,{}).then(function(j){Q=j.instance,Q.exports.__wasm_call_ctors()});function W(j){var R=new Uint8Array(j.length);for(var O=0;O<j.length;++O){var N=j.charCodeAt(O);R[O]=N>96?N-97:N>64?N-39:N+4}var D=0;for(var O=0;O<j.length;++O)R[D++]=R[O]<60?Y[R[O]]:(R[O]-60)*64+R[++O];return R.buffer.slice(0,D)}function G(j,R,O,N,D,P,C){var T=j.exports.sbrk,k=N+3&-4,A=T(k*D),S=T(P.length),x=new Uint8Array(j.exports.memory.buffer);x.set(P,S);var I=R(A,N,D,S,P.length);if(I==0&&C)C(A,k,D);if(O.set(x.subarray(A,A+N*D)),T(A-T(0)),I!=0)throw new Error("Malformed buffer data: "+I)}var z={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},V={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},H=[],q=0;function F(j){var R={object:new Worker(j),pending:0,requests:{}};return R.object.onmessage=function(O){var N=O.data;R.pending-=N.count,R.requests[N.id][N.action](N.value),delete R.requests[N.id]},R}function U(j){var R="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array($)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+L.name+";"+G.toString()+L.toString(),O=new Blob([R],{type:"text/javascript"}),N=URL.createObjectURL(O);for(var D=H.length;D<j;++D)H[D]=F(N);for(var D=j;D<H.length;++D)H[D].object.postMessage({});H.length=j,URL.revokeObjectURL(N)}function w(j,R,O,N,D){var P=H[0];for(var C=1;C<H.length;++C)if(H[C].pending<P.pending)P=H[C];return new Promise(function(T,k){var A=new Uint8Array(O),S=++q;P.pending+=j,P.requests[S]={resolve:T,reject:k},P.object.postMessage({id:S,count:j,size:R,source:A,mode:N,filter:D},[A.buffer])})}function L(j){var R=j.data;if(!R.id)return self.close();self.ready.then(function(O){try{var N=new Uint8Array(R.count*R.size);G(O,O.exports[R.mode],N,R.count,R.size,R.source,O.exports[R.filter]),self.postMessage({id:R.id,count:R.count,action:"resolve",value:N},[N.buffer])}catch(D){self.postMessage({id:R.id,count:R.count,action:"reject",value:D})}})}return{ready:K,supported:!0,useWorkers:function(j){U(j)},decodeVertexBuffer:function(j,R,O,N,D){G(Q,Q.exports.meshopt_decodeVertexBuffer,j,R,O,N,Q.exports[z[D]])},decodeIndexBuffer:function(j,R,O,N){G(Q,Q.exports.meshopt_decodeIndexBuffer,j,R,O,N)},decodeIndexSequence:function(j,R,O,N){G(Q,Q.exports.meshopt_decodeIndexSequence,j,R,O,N)},decodeGltfBuffer:function(j,R,O,N,D,P){G(Q,Q.exports[V[D]],j,R,O,N,Q.exports[z[P]])},decodeGltfBufferAsync:function(j,R,O,N,D){if(H.length>0)return w(j,R,O,V[N],z[D]);return K.then(function(){var P=new Uint8Array(j*R);return G(Q,Q.exports[V[N]],P,j,R,O,Q.exports[z[D]]),P})}}}();var za=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 X,Y=WebAssembly.instantiate($(Z),{}).then(function(U){X=U.instance,X.exports.__wasm_call_ctors()});function $(U){var w=new Uint8Array(U.length);for(var L=0;L<U.length;++L){var j=U.charCodeAt(L);w[L]=j>96?j-97:j>64?j-39:j+4}var R=0;for(var L=0;L<U.length;++L)w[R++]=w[L]<60?J[w[L]]:(w[L]-60)*64+w[++L];return w.buffer.slice(0,R)}function Q(U){if(!U)throw new Error("Assertion failed")}function K(U){return new Uint8Array(U.buffer,U.byteOffset,U.byteLength)}function W(U,w,L){var j=X.exports.sbrk,R=j(w.length*4),O=j(L*4),N=new Uint8Array(X.exports.memory.buffer),D=K(w);N.set(D,R);var P=U(O,R,w.length,L);N=new Uint8Array(X.exports.memory.buffer);var C=new Uint32Array(L);new Uint8Array(C.buffer).set(N.subarray(O,O+L*4)),D.set(N.subarray(R,R+w.length*4)),j(R-j(0));for(var T=0;T<w.length;++T)w[T]=C[w[T]];return[C,P]}function G(U){var w=0;for(var L=0;L<U.length;++L){var j=U[L];w=w<j?j:w}return w}function z(U,w,L,j,R,O,N,D,P){var C=X.exports.sbrk,T=C(4),k=C(L*4),A=C(R*O),S=C(L*4),x=new Uint8Array(X.exports.memory.buffer);x.set(K(j),A),x.set(K(w),S);var I=U(k,S,L,A,R,O,N,D,P,T);x=new Uint8Array(X.exports.memory.buffer);var v=new Uint32Array(I);K(v).set(x.subarray(k,k+I*4));var f=new Float32Array(1);return K(f).set(x.subarray(T,T+4)),C(T-C(0)),[v,f[0]]}function V(U,w,L,j,R,O,N,D,P,C,T,k,A){var S=X.exports.sbrk,x=S(4),I=S(L*4),v=S(R*O),f=S(R*D),p=S(P.length*4),n=S(L*4),o=C?S(R):0,J0=new Uint8Array(X.exports.memory.buffer);if(J0.set(K(j),v),J0.set(K(N),f),J0.set(K(P),p),J0.set(K(w),n),C)J0.set(K(C),o);var Q0=U(I,n,L,v,R,O,f,D,p,P.length,o,T,k,A,x);J0=new Uint8Array(X.exports.memory.buffer);var C0=new Uint32Array(Q0);K(C0).set(J0.subarray(I,I+Q0*4));var T0=new Float32Array(1);return K(T0).set(J0.subarray(x,x+4)),S(x-S(0)),[C0,T0[0]]}function H(U,w,L,j){var R=X.exports.sbrk,O=R(L*j),N=new Uint8Array(X.exports.memory.buffer);N.set(K(w),O);var D=U(O,L,j);return R(O-R(0)),D}function q(U,w,L,j,R,O,N,D){var P=X.exports.sbrk,C=P(D*4),T=P(L*j),k=P(L*O),A=new Uint8Array(X.exports.memory.buffer);if(A.set(K(w),T),R)A.set(K(R),k);var S=U(C,T,L,j,k,O,N,D);A=new Uint8Array(X.exports.memory.buffer);var x=new Uint32Array(S);return K(x).set(A.subarray(C,C+S*4)),P(C-P(0)),x}var F={LockBorder:1,Sparse:2,ErrorAbsolute:4,Prune:8,_InternalDebug:1073741824};return{ready:Y,supported:!0,useExperimentalFeatures:!1,compactMesh:function(U){Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0);var w=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return W(X.exports.meshopt_optimizeVertexFetchRemap,w,G(U)+1)},simplify:function(U,w,L,j,R,O){Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0),Q(w instanceof Float32Array),Q(w.length%L==0),Q(L>=3),Q(j>=0&&j<=U.length),Q(j%3==0),Q(R>=0);var N=0;for(var D=0;D<(O?O.length:0);++D)Q(O[D]in F),Q(this.useExperimentalFeatures||O[D]!="Prune"),N|=F[O[D]];var P=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),C=z(X.exports.meshopt_simplify,P,U.length,w,w.length/L,L*4,j,R,N);return C[0]=U instanceof Uint32Array?C[0]:new U.constructor(C[0]),C},simplifyWithAttributes:function(U,w,L,j,R,O,N,D,P,C){Q(this.useExperimentalFeatures),Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0),Q(w instanceof Float32Array),Q(w.length%L==0),Q(L>=3),Q(j instanceof Float32Array),Q(j.length%R==0),Q(R>=0),Q(N==null||N instanceof Uint8Array),Q(N==null||N.length==w.length/L),Q(D>=0&&D<=U.length),Q(D%3==0),Q(P>=0),Q(Array.isArray(O)),Q(R>=O.length),Q(O.length<=32);for(var T=0;T<O.length;++T)Q(O[T]>=0);var k=0;for(var T=0;T<(C?C.length:0);++T)Q(C[T]in F),k|=F[C[T]];var A=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),S=V(X.exports.meshopt_simplifyWithAttributes,A,U.length,w,w.length/L,L*4,j,R*4,new Float32Array(O),N?new Uint8Array(N):null,D,P,k);return S[0]=U instanceof Uint32Array?S[0]:new U.constructor(S[0]),S},getScale:function(U,w){return Q(U instanceof Float32Array),Q(U.length%w==0),Q(w>=3),H(X.exports.meshopt_simplifyScale,U,U.length/w,w*4)},simplifyPoints:function(U,w,L,j,R,O){if(Q(this.useExperimentalFeatures),Q(U instanceof Float32Array),Q(U.length%w==0),Q(w>=3),Q(L>=0&&L<=U.length/w),j)return Q(j instanceof Float32Array),Q(j.length%R==0),Q(R>=3),Q(U.length/w==j.length/R),q(X.exports.meshopt_simplifyPoints,U,U.length/w,w*4,j,R*4,O,L);else return q(X.exports.meshopt_simplifyPoints,U,U.length/w,w*4,void 0,0,0,L)}}}();var jV6=function(){var Z="b9H79Tebbbefx9Geueu9Geub9Gbb9Giuuueu9Gkuuuuuuuuuu99eu9Gvuuuuueu9Gkuuuuuuuuu9999eu9Gruuuuuuub9Gkuuuuuuuuuuueu9Gouuuuuub9Giuuub9GluuuubiOHdilvorwDqrkbiibeilve9Weiiviebeoweuec:q:Odkr:Yewo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9I919P29K9nW79O2Wt79c9V919U9KbeX9TW79O9V9Wt9F9I919P29K9nW79O2Wt7bd39TW79O9V9Wt9F9J9V9T9W91tWJ2917tWV9c9V919U9K7br39TW79O9V9Wt9F9J9V9T9W91tW9nW79O2Wt9c9V919U9K7bDL9TW79O9V9Wt9F9V9Wt9P9T9P96W9nW79O2Wtbql79IV9RbkDwebcekdsPq;L9kHdbkIbabaec9:fgefcufae9Ugeabci9Uadfcufad9Ugbaeab0Ek:oAlPue99eux998Jjjjjbc:We9Rgk8Kjjjjbakc;mbfcbc;Kbz:njjjb8AakcuaocdtgxaocFFFFi0Egmcbyd:e1jjbHjjjjbbgPBd9makceBd:SeakaPBdnakamcbyd:e1jjbHjjjjbbgsBd9qakcdBd:SeakasBd9eakcualcdtalcFFFFi0Ecbyd:e1jjbHjjjjbbgzBd9uakazBd9iakciBd:SeaPcbaxz:njjjbhHalci9UhOdnalTmbaihPalhAinaHaPydbcdtfgCaCydbcefBdbaPclfhPaAcufgAmbkkdnaoTmbcbhPashAaHhCaohXinaAaPBdbaAclfhAaCydbaPfhPaCclfhCaXcufgXmbkkdnalci6mbcbhPaihAinaAcwfydbhCaAclfydbhXasaAydbcdtfgQaQydbgQcefBdbazaQcdtfaPBdbasaXcdtfgXaXydbgXcefBdbazaXcdtfaPBdbasaCcdtfgCaCydbgCcefBdbazaCcdtfaPBdbaAcxfhAaOaPcefgP9hmbkkdnaoTmbaHhAashPaohCinaPaPydbaAydb9RBdbaAclfhAaPclfhPaCcufgCmbkkakamcbyd:e1jjbHjjjjbbgPBd9yakclBd:SeaPaHaxz:mjjjbhmakaOcbyd:e1jjbHjjjjbbgPBd9CakcvBd:SeaPcbaOz:njjjbhLakcuaOcK2alcjjjjd0Ecbyd:e1jjbHjjjjbbgKBd9GakcoBd:SeJbbbbhYdnalci6g8Ambarcd4hxaihAaKhPaOhrJbbbbhEinavaAclfydbax2cdtfgCIdlh3avaAydbax2cdtfgXIdlhYavaAcwfydbax2cdtfgQIdlh5aCIdwh8EaXIdwh8FaQIdwhaaPaCIdbghaXIdbggMaQIdbg8JMJbbnn:vUdbaPclfaXIdlaCIdlMaQIdlMJbbnn:vUdbaQIdwh8KaCIdwh8LaXIdwh8MaPcxfa3aY:tg3aaa8F:tgaNa5aY:tg5a8Ea8F:tg8EN:tgYJbbbbJbbjZahag:tgha5Na8Jag:tgga3N:tg8Fa8FNaYaYNa8EagNaaahN:tgYaYNMM:rgg:vagJbbbb9BEg3NUdbaPczfaYa3NUdbaPcCfa8Fa3NUdbaPcwfa8Ka8Ma8LMMJbbnn:vUdbaEagMhEaAcxfhAaPcKfhParcufgrmbkaEaO:Z:vJbbbZNhYkakcuaOcdtalcFFFF970Ecbyd:e1jjbHjjjjbbgCBd9KakcrBd:SeaYaD:ZN:rhYdna8AmbcbhPaChAinaAaPBdbaAclfhAaOaPcefgP9hmbkkaYJbbbZNh8MakcuaOcltalcFFFFd0Ecbyd:e1jjbHjjjjbbg8ABd9OakcwBd:Secba8AaKaCaOz:djjjb8Aakaocbyd:e1jjbHjjjjbbgPBd2aPcFeaoz:njjjbhrakc8Wfcwf9cb83ibak9cb83i8WcbhPJbbbbhEJbbbbh5Jbbbbh8EJbbbbhYJbbbbh8FJbbbbhgcbhlinJbbbbh3dnaPTmbJbbjZaP:Z:vh3kaka8Ea3NgaUdaaka5a3NghUd3akaEa3Ng8JUdKJbbbbh3dnagagNaYaYNa8Fa8FNMMg8KJbbbb9BmbJbbjZa8K:r:vh3kakaga3NUd8Saka8Fa3NUdyakaYa3NUd8Kdndndnakyd8WgQakydUgAakcKfaeaiakc;abfaKamara8Maqz:ejjjbgCcuSmbdnaPaD9pmbaAaraiaCcx2fgXydbfRbbcFeSfaraXclfydbfRbbcFeSfaraXcwfydbfRbbcFeSfaw9nmdkaQaAcbaeaiakc;abfaKamara8MJbbbbz:ejjjbgCcu9hmekakaaUdCakahUdzaka8JUdxakcuBdwakcFFF;7rBdla8AcbaKaLakcxfakcwfakclfz:fjjjbakydwgCcuSmekdnakc8WfaiaCcx2fgOydbgPaOclfydbgAaOcwfydbgXarabaeadalawaDz:gjjjbTmbalcefhlJbbbbhEJbbbbh5Jbbbbh8EJbbbbhYJbbbbh8FJbbbbhgkamaPcdtfgPaPydbcufBdbamaAcdtfgPaPydbcufBdbamaXcdtfgPaPydbcufBdbcbhXinazasaOaXcdtfydbcdtgAfydbcdtfgxhPaHaAfgvydbgQhAdnaQTmbdninaPydbaCSmeaPclfhPaAcufgATmdxbkkaPaxaQcdtfc98fydbBdbavavydbcufBdbkaXcefgXci9hmbkaKaCcK2fgPIdbh3aPIdlhaaPIdwhhaPIdxh8JaPIdzh8KaPIdCh8LaLaCfce86bbaga8LMhga8Fa8KMh8FaYa8JMhYa8EahMh8Ea5aaMh5aEa3MhEakyd88hPxekkdnaPTmbdnakyd80gAaPci2fgCciGTmbadaCfcbaPaAcu7fciGcefz:njjjb8AkabalcltfgPak8Pi8W83dbaPcwfakc8Wfcwf8Pib83dbalcefhlkcahPdninaPc98Smeakc;mbfaPfydbcbydj1jjbH:bjjjbbaPc98fhPxbkkakc:Wef8Kjjjjbalk;3vivuv99lu8Jjjjjbca9Rgv8Kjjjjbdndnalcw0mbaiydbhoaeabcitfgralcdtcufBdlaraoBdbdnalcd6mbaiclfhoalcufhwarcxfhrinaoydbhDarcuBdbarc98faDBdbarcwfhraoclfhoawcufgwmbkkalabfhrxekcbhDavczfcwfcbBdbav9cb83izavcwfcbBdbav9cb83ibJbbjZhqJbbjZhkinadaiaDcdtfydbcK2fhwcbhrinavczfarfgoawarfIdbgxaoIdbgm:tgPakNamMgmUdbavarfgoaPaxam:tNaoIdbMUdbarclfgrcx9hmbkJbbjZaqJbbjZMgq:vhkaDcefgDal9hmbkcbhoadcbcecdavIdlgxavIdwgm9GEgravIdbgPam9GEaraPax9GEgscdtgrfhzavczfarfIdbhxaihralhwinaiaocdtfgDydbhHaDarydbgOBdbaraHBdbarclfhraoazaOcK2fIdbax9Dfhoawcufgwmbkaeabcitfhrdndnaocv6mbaoalc98f6mekaraiydbBdbaralcdtcufBdlaiclfhoalcufhwarcxfhrinaoydbhDarcuBdbarc98faDBdbarcwfhraoclfhoawcufgwmbkalabfhrxekaraxUdbaeabcitfgrarydlc98GasVBdlabcefaeadaiaoz:djjjbhwararydlciGawabcu7fcdtVBdlawaeadaiaocdtfalao9Rz:djjjbhrkavcaf8Kjjjjbark;Bloeue99vue99Due99dndnaembcuhkxekJbbjZaq:thxaiabcdtfhmavydbhPavydlhsavydwhzcbhHJFFuuhOcvhbcuhkindnaPamaHcdtfydbcdtgvfydbgATmbazasavfydbcdtfhiindndnawalaiydbgCcx2fgvclfydbgXfRbbcFeSawavydbgQfRbbcFeSfawavcwfydbgLfRbbcFeSfgKmbcbhvxekcehvaraQcdtfydbgYceSmbcehvaraXcdtfydbg8AceSmbcehvaraLcdtfydbgEceSmbdna8AcdSaYcdSfaEcdSfcd6mbaKcefhvxekaKcdfhvkdnavab9kmbdndnadTmbaoaCcK2fgQIdwadIdw:tg3a3NaQIdbadIdb:tg3a3NaQIdladIdl:tg3a3NMM:raD:vaxNJbbjZMJ9VO:d86JbbjZaQIdCadIdCNaQIdxadIdxNaQIdzadIdzNMMaqN:tg3a3J9VO:d869DENh3xekaraQcdtfydbaraXcdtfydbfaraLcdtfydbfc99f:Zh3kaCakavab6a3aO9DVgQEhkavabaQEhba3aOaQEhOkaiclfhiaAcufgAmbkkaHcefgHae9hmbkkakk;bddlue99dndndnabaecitfgrydlgwciGgDci9hmbarclfhqxekinabcbawcd4gwalaDcdtfIdbabaecitfIdb:tgkJbbbb9FEgDaecefgefadaialavaoz:fjjjbak:laoIdb9FTmdabaDaw7aefgecitfgrydlgwciGgDci9hmbkarclfhqkabaecitfhecuhbindnaiaeydbgDfRbbmbadaDcK2fgrIdwalIdw:tgkakNarIdbalIdb:tgkakNarIdlalIdl:tgkakNMM:rgkaoIdb9DTmbaoakUdbavaDBdbaqydbhwkaecwfheabcefgbawcd46mbkkk;yleoudnaladfgkRbbcFeSalaefgxRbbgmcFeSfabydwgPfalaifgsRbbcFeSfaD0abydxaq9pVgzce9hmbavawcltfgmab8Pdb83dbamcwfabcwfgm8Pdb83dbdndnamydbmbcbhqxekcbhDaohminalamabydbcdtfydbfcFe86bbamclfhmaDcefgDabydwgq6mbkkdnabydxglci2gDabydlgmfgPciGTmbaraPfcbalamcu7fciGcefz:njjjb8Aabydxci2hDabydlhmabydwhqkab9cb83dwababydbaqfBdbabaDcifc98GamfBdlaxRbbhmcbhPkdnamcFeGcFe9hmbaxaP86bbababydwgmcefBdwaoabydbcdtfamcdtfaeBdbkdnakRbbcFe9hmbakabydw86bbababydwgmcefBdwaoabydbcdtfamcdtfadBdbkdnasRbbcFe9hmbasabydw86bbababydwgmcefBdwaoabydbcdtfamcdtfaiBdbkarabydlfabydxci2faxRbb86bbarabydlfabydxci2fcefakRbb86bbarabydlfabydxci2fcdfasRbb86bbababydxcefBdxazk;Ckovud99euv99eul998Jjjjjbc:G;ae9Rgo8KjjjjbdndnadTmbavcd4hrcbhwcbhDindnaiaeclfydbar2cdtfgvIdbaiaeydbar2cdtfgqIdbgk:tgxaiaecwfydbar2cdtfgmIdlaqIdlgP:tgsNamIdbak:tgzavIdlaP:tgPN:tgkakNaPamIdwaqIdwgH:tgONasavIdwaH:tgHN:tgPaPNaHazNaOaxN:tgxaxNMM:rgsJbbbb9Bmbaoc:G:qefawcx2fgAakas:vUdwaAaxas:vUdlaAaPas:vUdbaocafawc8K2fgAaq8Pdb83dbaAav8Pdb83dxaAam8Pdb83dKaAcwfaqcwfydbBdbaAcCfavcwfydbBdbaAcafamcwfydbBdbawcefhwkaecxfheaDcifgDad6mbkab9cb83dbabcyf9cb83dbabcaf9cb83dbabcKf9cb83dbabczf9cb83dbabcwf9cb83dbawTmeao9cb83iKao9cb83izaoczfaocafawci2z1jjjbaoIdKhCaoIdChXaoIdzhQao9cb83iwao9cb83ibaoaoc:G:qefawz1jjjbJbbjZhkaoIdwgPJbbbbJbbjZaPaPNaoIdbgPaPNaoIdlgsasNMM:rgx:vaxJbbbb9BEgzNhxasazNhsaPazNhzaoc:G:qefheawhvinaecwfIdbaxNaeIdbazNasaeclfIdbNMMgPakaPak9DEhkaecxfheavcufgvmbkabaCUdwabaXUdlabaQUdbabaoId3UdxdndnakJ;n;m;m899FmbJbbbbhPaoc:G:qefheaocafhvinaCavcwfIdb:taecwfIdbgHNaQavIdb:taeIdbgONaXavclfIdb:taeclfIdbgLNMMaxaHNazaONasaLNMM:vgHaPaHaP9EEhPavc8KfhvaecxfheawcufgwmbkabazUd3abc8KfaxUdbabcafasUdbabcKfaCaxaPN:tUdbabcCfaXasaPN:tUdbabaQazaPN:tUdzabJbbjZakakN:t:rgkUdydndnaxJbbj:;axJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;axJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohexekcjjjj94hekabc8Ufae86bbdndnasJbbj:;asJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;asJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkabcRfav86bbdndnazJbbj:;azJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;azJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohqxekcjjjj94hqkabaq86b8SdndnaecKtcK91:YJbb;:9c:vax:t:lavcKtcK91:YJbb;:9c:vas:t:laqcKtcK91:YJbb;:9c:vaz:t:lakMMMJbb;:9cNJbbjZMgk:lJbbb9p9DTmbak:Ohexekcjjjj94hekaecFbaecFb9iEhexekabcjjj;8iBdycFbhekabae86b8Vxekab9cb83dbabcyf9cb83dbabcaf9cb83dbabcKf9cb83dbabczf9cb83dbabcwf9cb83dbkaoc:G;aef8Kjjjjbk:mvdouq99cbhi8Jjjjjbca9RglczfcwfcbBdbal9cb83izalcwfcbBdbal9cb83ibdnadTmbcbhvinaeaifhocbhrinalczfarfgwavawydbgwaoarfIdbgDaearawcx2ffIdb9DEBdbalarfgwavawydbgwaDaearawcx2ffIdb9EEBdbarclfgrcx9hmbkaicxfhiavcefgvad9hmbkkJbbbbhDcbhrcbhicbhvinaealarfydbcx2fgwIdwaealczfarfydbcx2fgoIdw:tgqaqNawIdbaoIdb:tgqaqNawIdlaoIdl:tgqaqNMMgqaDaqaD9EgwEhDavaiawEhiarclfhravcefgvci9hmbkaealczfaicdtgvfydbcx2fgrIdwaealavfydbcx2fglIdwMJbbbZNhqarIdlalIdlMJbbbZNhkarIdbalIdbMJbbbZNhxaD:rJbbbZNhDdnadTmbindnaecwfIdbgmaq:tgPaPNaeIdbgsax:tgPaPNaeclfIdbgzak:tgPaPNMMgPaDaDN9ETmbaqaDaP:rgH:vJbbbZNJbbbZMgPNamJbbjZaP:tgONMhqakaPNazaONMhkaxaPNasaONMhxaDaHMJbbbZNhDkaecxfheadcufgdmbkkabaDUdxabaqUdwabakUdlabaxUdbkjeeiu8Jjjjjbcj8W9Rgr8Kjjjjbaici2hwdnaiTmbawceawce0EhDarhiinaiaeadRbbcdtfydbBdbadcefhdaiclfhiaDcufgDmbkkabarawaladaoz:hjjjbarcj8Wf8Kjjjjbk:Ylequ8Jjjjjbcjx9Rgl8Kjjjjbcbhvalcjqfcbaiz:njjjb8AdndnadTmbcjehoaehrincuhwarhDcuhqavhkdninawakaoalcjqfaDcefRbbfRbb9RcFeGci6aoalcjqfaDRbbfRbb9RcFeGci6faoalcjqfaDcdfRbbfRbb9RcFeGci6fgxaq9mgmEhwdnammbaxce0mdkaxaqaxaq9kEhqaDcifhDadakcefgk9hmbkkaeawci2fgDcdfRbbhqaDcefRbbhxaDRbbhkaeavci2fgDcifaDawav9Rci2z:qjjjb8Aakalcjqffaocefgo86bbaxalcjqffao86bbaDcdfaq86bbaDcefax86bbaDak86bbaqalcjqffao86bbarcifhravcefgvad9hmbkalcFeaiz:njjjbhoadci2gDceaDce0EhqcbhxindnaoaeRbbgkfgwRbbgDcFe9hmbawax86bbaocjdfaxcdtfabakcdtfydbBdbaxhDaxcefhxkaeaD86bbaecefheaqcufgqmbkaxcdthDxekcbhDkabalcjdfaDz:mjjjb8Aalcjxf8Kjjjjbk9teiucbcbyd11jjbgeabcifc98GfgbBd11jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabk9teiucbcbyd11jjbgeabcrfc94GfgbBd11jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik9:eiuZbhedndncbyd11jjbgdaecztgi9nmbcuheadai9RcFFifcz4nbcuSmekadhekcbabae9Rcifc98Gcbyd11jjbfgdBd11jjbdnadZbcztge9nmbadae9RcFFifcz4nb8Akk:;Deludndndnadch9pmbabaeSmdaeabadfgi9Rcbadcet9R0mekabaead;8qbbxekaeab7ciGhldndndnabae9pmbdnalTmbadhvabhixikdnabciGmbadhvabhixdkadTmiabaeRbb86bbadcufhvdnabcefgiciGmbaecefhexdkavTmiabaeRbe86beadc9:fhvdnabcdfgiciGmbaecdfhexdkavTmiabaeRbd86bdadc99fhvdnabcifgiciGmbaecifhexdkavTmiabaeRbi86biabclfhiaeclfheadc98fhvxekdnalmbdnaiciGTmbadTmlabadcufgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc9:fgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc99fgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc98fgdfaeadfRbb86bbkadcl6mbdnadc98fgocd4cefciGgiTmbaec98fhlabc98fhvinavadfaladfydbBdbadc98fhdaicufgimbkkaocx6mbaec9Wfhvabc9WfhoinaoadfgicxfavadfglcxfydbBdbaicwfalcwfydbBdbaiclfalclfydbBdbaialydbBdbadc9Wfgdci0mbkkadTmdadhidnadciGglTmbaecufhvabcufhoadhiinaoaifavaifRbb86bbaicufhialcufglmbkkadcl6mdaec98fhlabc98fhvinavaifgecifalaifgdcifRbb86bbaecdfadcdfRbb86bbaecefadcefRbb86bbaeadRbb86bbaic98fgimbxikkavcl6mbdnavc98fglcd4cefcrGgdTmbavadcdt9RhvinaiaeydbBdbaeclfheaiclfhiadcufgdmbkkalc36mbinaiaeydbBdbaiaeydlBdlaiaeydwBdwaiaeydxBdxaiaeydzBdzaiaeydCBdCaiaeydKBdKaiaeyd3Bd3aecafheaicafhiavc9Gfgvci0mbkkavTmbdndnavcrGgdmbavhlxekavc94GhlinaiaeRbb86bbaicefhiaecefheadcufgdmbkkavcw6mbinaiaeRbb86bbaiaeRbe86beaiaeRbd86bdaiaeRbi86biaiaeRbl86blaiaeRbv86bvaiaeRbo86boaiaeRbr86braicwfhiaecwfhealc94fglmbkkabkkAebcjwkxebbbdbbbzNbb",J=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!=="object")return{supported:!1};var X,Y=WebAssembly.instantiate($(Z),{}).then(function(U){X=U.instance,X.exports.__wasm_call_ctors()});function $(U){var w=new Uint8Array(U.length);for(var L=0;L<U.length;++L){var j=U.charCodeAt(L);w[L]=j>96?j-97:j>64?j-39:j+4}var R=0;for(var L=0;L<U.length;++L)w[R++]=w[L]<60?J[w[L]]:(w[L]-60)*64+w[++L];return w.buffer.slice(0,R)}function Q(U){if(!U)throw new Error("Assertion failed")}function K(U){return new Uint8Array(U.buffer,U.byteOffset,U.byteLength)}var W=48,G=16;function z(U,w){var L=U.meshlets[w*4+0],j=U.meshlets[w*4+1],R=U.meshlets[w*4+2],O=U.meshlets[w*4+3];return{vertices:U.vertices.subarray(L,L+R),triangles:U.triangles.subarray(j,j+O*3)}}function V(U,w,L,j,R,O,N){var D=X.exports.sbrk,P=X.exports.meshopt_buildMeshletsBound(U.length,R,O),C=D(P*G),T=D(P*R*4),k=D(P*O*3),A=D(U.byteLength),S=D(w.byteLength),x=new Uint8Array(X.exports.memory.buffer);x.set(K(U),A),x.set(K(w),S);var I=X.exports.meshopt_buildMeshlets(C,T,k,A,U.length,S,L,j,R,O,N);x=new Uint8Array(X.exports.memory.buffer);var v=x.subarray(C,C+I*G),f=new Uint32Array(v.buffer,v.byteOffset,v.byteLength/4).slice();for(var p=0;p<I;++p){var n=f[p*4+0],o=f[p*4+1],L=f[p*4+2],J0=f[p*4+3];X.exports.meshopt_optimizeMeshlet(T+n*4,k+o,J0,L)}var Q0=f[(I-1)*4+0],C0=f[(I-1)*4+1],T0=f[(I-1)*4+2],a0=f[(I-1)*4+3],v8=Q0+T0,s1=C0+(a0*3+3&-4),u4={meshlets:f,vertices:new Uint32Array(x.buffer,T,v8).slice(),triangles:new Uint8Array(x.buffer,k,s1*3).slice(),meshletCount:I};return D(C-D(0)),u4}function H(U){var w=new Float32Array(X.exports.memory.buffer,U,W/4);return{centerX:w[0],centerY:w[1],centerZ:w[2],radius:w[3],coneApexX:w[4],coneApexY:w[5],coneApexZ:w[6],coneAxisX:w[7],coneAxisY:w[8],coneAxisZ:w[9],coneCutoff:w[10]}}function q(U,w,L,j){var R=X.exports.sbrk,O=[],N=R(w.byteLength),D=R(U.vertices.byteLength),P=R(U.triangles.byteLength),C=R(W),T=new Uint8Array(X.exports.memory.buffer);T.set(K(w),N),T.set(K(U.vertices),D),T.set(K(U.triangles),P);for(var k=0;k<U.meshletCount;++k){var A=U.meshlets[k*4+0],S=U.meshlets[k*4+0+1],x=U.meshlets[k*4+0+3];X.exports.meshopt_computeMeshletBounds(C,D+A*4,P+S,x,N,L,j),O.push(H(C))}return R(N-R(0)),O}function F(U,w,L,j){var R=X.exports.sbrk,O=R(W),N=R(U.byteLength),D=R(w.byteLength),P=new Uint8Array(X.exports.memory.buffer);P.set(K(U),N),P.set(K(w),D),X.exports.meshopt_computeClusterBounds(O,N,U.length,D,L,j);var C=H(O);return R(O-R(0)),C}return{ready:Y,supported:!0,buildMeshlets:function(U,w,L,j,R,O){Q(U.length%3==0),Q(w instanceof Float32Array),Q(w.length%L==0),Q(L>=3),Q(j<=255||j>0),Q(R<=512),Q(R%4==0),O=O||0;var N=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return V(N,w,w.length/L,L*4,j,R,O)},computeClusterBounds:function(U,w,L){Q(U.length%3==0),Q(U.length/3<=512),Q(w instanceof Float32Array),Q(w.length%L==0),Q(L>=3);var j=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return F(j,w,w.length/L,L*4)},computeMeshletBounds:function(U,w,L){return Q(U.meshletCount!=0),Q(w instanceof Float32Array),Q(w.length%L==0),Q(L>=3),q(U,w,w.length/L,L*4)},extractMeshlet:function(U,w){return Q(w>=0&&w<U.meshletCount),z(U,w)}}}();var aQ={OPTIMIZED_DIR:".optimized",CHECKSUM_EXT:".md5",DIRECTORIES:[(()=>{try{return n5.dirname(u.resolve("@hytopia.com/assets"))}catch{return null}})(),n5.resolve(process.cwd(),"assets")].filter(Boolean),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 P9{static instance=new P9;optimize=!0;optimizeEveryStart=!1;_modelUriDocuments=new Map;_modelUriBoundingBoxes=new Map;_modelUriNodeNames=new Map;_modelUriTrimeshes=new Map;constructor(){}async preloadModels(){let Z=await this._getAbsoluteModelPaths();console.log(`ModelRegistry.preloadModels(): Preloading ${Z.length} models...`);for(let J of Z){if(this.optimize)await this._resolveOptimizedModelPath(J);await this._loadModelData(J)}console.log(`ModelRegistry.preloadModels(): Preloaded ${Z.length} models!`)}getAnimationNames(Z){let J=this._modelUriDocuments.get(Z);if(!J)m.fatalError(`ModelRegistry.getAnimationNames(): Model ${Z} not found!`);return J.getRoot().listAnimations().map((Y)=>Y.getName())}getBoundingBox(Z){let J=this._modelUriBoundingBoxes.get(Z);if(!J)m.fatalError(`ModelRegistry.getBoundingBox(): Model ${Z} not found!`);return J}getHeight(Z){let J=this.getBoundingBox(Z);return J.max.y-J.min.y}getNodeNames(Z){let J=this._modelUriNodeNames.get(Z);if(!J)m.fatalError(`ModelRegistry.getNodeNames(): Model ${Z} not found!`);return J}getTrimesh(Z,J=1){let X=this._modelUriTrimeshes.get(Z);if(!X){m.error(`ModelRegistry.getTrimesh(): Model ${Z} not found!`);return}let Y=X.vertices;if(J!==1){Y=new Float32Array(Y.length);for(let $=0;$<Y.length;$++)Y[$]=X.vertices[$]*J}return{vertices:Y,indices:X.indices}}modelHasNode(Z,J){let X=this._modelUriNodeNames.get(Z);if(!X)m.fatalError(`ModelRegistry.modelHasNode(): Model ${Z} not found!`);return X.includes(J)}_absoluteModelPathToModelUri(Z){let J=n5.normalize(Z);for(let X of aQ.DIRECTORIES){let Y=n5.normalize(X);if(J.startsWith(Y))return n5.relative(Y,J).replace(/\\/g,"/")}return n5.basename(J)}async _getAbsoluteModelPaths(){let Z=[];for(let J of aQ.DIRECTORIES){let X=n5.resolve(process.cwd(),J);if(!RJ.existsSync(X))continue;let Y=await IU("**/*.{gltf,glb}",{cwd:X,follow:!0});for(let $ of Y)Z.push(n5.join(X,$))}return Z}async _loadModelData(Z){let J=await new vP().read(Z),X=Xa(J.getRoot().listScenes()[0]),Y=J.getRoot().listNodes().map((Q)=>Q.getName()),$=this._absoluteModelPathToModelUri(Z);this._modelUriDocuments.set($,J),this._modelUriBoundingBoxes.set($,{min:{x:X.min[0],y:X.min[1],z:X.min[2]},max:{x:X.max[0],y:X.max[1],z:X.max[2]}}),this._modelUriNodeNames.set($,Y),this._modelUriTrimeshes.set($,await this._buildTrimesh($))}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)}${aQ.CHECKSUM_EXT}`;if(!RJ.existsSync(J))return!1;let X=this._calculateChecksum(Z),Y=RJ.readFileSync(J,"utf8");return X===Y}_calculateChecksum(Z){if(!RJ.existsSync(Z))return"";let J=RJ.readFileSync(Z);return rB1.createHash("sha256").update(J.toString("base64")).digest("hex")}_buildOptimizedModelPath(Z){let J=n5.basename(Z),X=J.replace(/\.[^/.]+$/,""),Y=n5.dirname(Z),$=n5.join(Y,aQ.OPTIMIZED_DIR,X);return n5.join($,J)}async _buildTrimesh(Z,J=1,X=0.001){let Y=this._modelUriDocuments.get(Z);if(!Y)m.fatalError(`ModelRegistry._buildTrimesh(): Model ${Z} not found!`);let $=Za(Y);$.setLogger(new j5(X3.WARN)),await $.transform(fn({pivot:"center"}),Ja(),Ya(),EC(),Ga({simplifier:za,ratio:J,error:X}),tn());for(let z of $.getRoot().listScenes())for(let V of z.listChildren())on(V);let Q=$.getRoot().listMeshes()[0];if(!Q){m.error(`ModelRegistry._buildTrimesh(): Model ${Z} has no root mesh!`);return}let K=Q.listPrimitives()[0];if(!K){m.error(`ModelRegistry._buildTrimesh(): Model ${Z} has no root primitive!`);return}let W=K.getAttribute("POSITION"),G=K.getIndices();if(!W||!G){m.error(`ModelRegistry._buildTrimesh(): Model ${Z} missing required geometry data!`);return}return{vertices:W.getArray(),indices:G.getArray()}}async _optimizeModel(Z,J){let X=n5.dirname(J);RJ.rmSync(X,{recursive:!0,force:!0}),RJ.mkdirSync(X,{recursive:!0}),console.log(`ModelRegistry: Optimizing model ${this._absoluteModelPathToModelUri(Z)}...`);for(let Y of aQ.OPTIMIZER_RUNS){let $=J.replace(/(\.[^/.]+)$/,`${Y.suffix}$1`),{stderr:Q}=await wd("npx",["gltf-transform","optimize",Z,$,...Y.options]);if(Q)return m.warning(`ModelRegistry._optimizeModel(): Error optimizing model ${this._absoluteModelPathToModelUri(Z)}, defaulting to unoptimized model. Error: ${Q}`),Z}return RJ.writeFileSync(`${J}${aQ.CHECKSUM_EXT}`,this._calculateChecksum(Z)),J}}var I3;(($)=>{$.DYNAMIC="dynamic";$.FIXED="fixed";$.KINEMATIC_POSITION="kinematic_position";$.KINEMATIC_VELOCITY="kinematic_velocity"})(I3||={});var vC=0.001,Va="dynamic";class RY extends g0{_additionalMass=0;_colliders=new Set;_explicitSleep=!1;_enabledPositions={x:!0,y:!0,z:!0};_enabledRotations={x:!0,y:!0,z:!0};_rigidBody;_rigidBodyDesc;_rigidBodyType;_simulation;constructor(Z){super();Z.type??=Va,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:X,w:Y}=this.rotation;return{x:-2*(Z*X+Y*J),y:-2*(J*X-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:X,principalAngularInertia:Y,principalAngularInertiaLocalFrame:$}=Z;this._rigidBody?this._rigidBody.setAdditionalMassProperties(J,X,Y,$,!this._explicitSleep):this._rigidBodyDesc.setAdditionalMassProperties(J,X,Y,$)}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 X={["dynamic"]:$1.RigidBodyType.Dynamic,["fixed"]:$1.RigidBodyType.Fixed,["kinematic_position"]:$1.RigidBodyType.KinematicPositionBased,["kinematic_velocity"]:$1.RigidBodyType.KinematicVelocityBased}[Z];if(X===void 0)return m.error(`Invalid RigidBodyType: ${Z}`);this._rigidBody?this._rigidBody.setBodyType(X,!this._explicitSleep):this._rigidBodyDesc.status=X,this._rigidBodyType=Z}addForce(Z){if(!this._requireNotRemoved("addForce"))return;if(!this._requireCreated("addForce"))return;if(!this._requireDynamic("addForce"))return;if(this._isNegligibleVector(Z))return;this._rigidBody.addForce(Z,!this._explicitSleep)}addTorque(Z){if(!this._requireNotRemoved("addTorque"))return;if(!this._requireCreated("addTorque"))return;if(!this._requireDynamic("addTorque"))return;if(this._isNegligibleVector(Z))return;this._rigidBody.addTorque(Z,!this._explicitSleep)}addChildColliderToSimulation(Z){if(!this._requireNotRemoved("addChildColliderToSimulation"))return;if(!this._requireCreated("addChildColliderToSimulation"))return;Z.addToSimulation(this._simulation,this)}addToSimulation(Z){if(!this._requireNotRemoved("addToSimulation"))return;if(this._rigidBody)return m.error("RigidBody.addToSimulation(): Rigid body already exists in the simulation!");this._simulation=Z,this._rigidBody=this._simulation.createRawRigidBody(this._rigidBodyDesc),this._colliders.forEach((J)=>{if(!J.isSimulated)J.addToSimulation(Z,this)})}applyImpulse(Z){if(!this._requireNotRemoved("applyImpulse"))return;if(!this._requireCreated("applyImpulse"))return;if(!this._requireDynamic("applyImpulse"))return;if(this._isNegligibleVector(Z))return;this._rigidBody.applyImpulse(Z,!this._explicitSleep)}applyImpulseAtPoint(Z,J){if(!this._requireNotRemoved("applyImpulseAtPoint"))return;if(!this._requireCreated("applyImpulseAtPoint"))return;if(!this._requireDynamic("applyImpulseAtPoint"))return;if(this._isNegligibleVector(Z))return;this._rigidBody.applyImpulseAtPoint(Z,J,!this._explicitSleep)}applyTorqueImpulse(Z){if(!this._requireNotRemoved("applyTorqueImpulse"))return;if(!this._requireCreated("applyTorqueImpulse"))return;if(!this._requireDynamic("applyTorqueImpulse"))return;this._rigidBody.applyTorqueImpulse(Z,!this._explicitSleep)}createAndAddChildCollider(Z){if(!this._requireNotRemoved("createAndAddChildCollider"))return null;return this._simulation?new a5({...Z,parentRigidBody:this,simulation:this._simulation}):this._createAndAddPendingChildCollider(Z)}createAndAddChildCollidersToSimulation(Z){let J=[];return Z.forEach((X)=>{let Y=this.createAndAddChildCollider(X);if(Y)J.push(Y)}),J}getCollidersByTag(Z){let J=[];for(let X of this._colliders)if(X.tag===Z)J.push(X);return J}linkCollider(Z){if(!this._requireNotRemoved("linkCollider"))return;if(Z.parentRigidBody!==this)return m.error("RigidBody.linkCollider(): Collider cannot be linked because it is not a child of this rigid body!");this._colliders.add(Z)}lockAllRotations(){if(!this._requireNotRemoved("lockAllRotations"))return;this.setEnabledRotations({x:!1,y:!1,z:!1})}lockAllPositions(){if(!this._requireNotRemoved("lockAllPositions"))return;this.setEnabledPositions({x:!1,y:!1,z:!1})}removeFromSimulation(){if(!this._requireNotRemoved("removeFromSimulation"))return;if(!this._rigidBody)return m.error("RigidBody.removeFromSimulation(): Rigid body does not exist in the simulation!");this._colliders.forEach((Z)=>{Z.removeFromSimulation()}),this._simulation.removeRawRigidBody(this._rigidBody),this._simulation=void 0,this._rigidBody=void 0}unlinkCollider(Z){if(!this._requireNotRemoved("unlinkCollider"))return;if(!Z.isRemoved)return m.error("RigidBody.unlinkCollider(): Collider is still simulated and therefore cannot be unlinked from this rigid body!");this._colliders.delete(Z)}resetAngularVelocity(){if(!this._requireNotRemoved("resetAngularVelocity"))return;if(!this._requireCreated("resetAngularVelocity"))return;this.setAngularVelocity({x:0,y:0,z:0})}resetForces(){if(!this._requireNotRemoved("resetForces"))return;if(!this._requireCreated("resetForces"))return;this._rigidBody.resetForces(!this._explicitSleep)}resetLinearVelocity(){if(!this._requireNotRemoved("resetLinearVelocity"))return;if(!this._requireCreated("resetLinearVelocity"))return;this.setLinearVelocity({x:0,y:0,z:0})}resetTorques(){if(!this._requireNotRemoved("resetTorques"))return;if(!this._requireCreated("resetTorques"))return;this._rigidBody.resetTorques(!this._explicitSleep)}sleep(){if(!this._requireNotRemoved("sleep"))return;this.setSleeping(!0)}wakeUp(){if(!this._requireNotRemoved("wakeUp"))return;this.setSleeping(!1)}_applyRigidBodyOptions(Z){[["additionalMass",this.setAdditionalMass.bind(this)],["additionalMassProperties",this.setAdditionalMassProperties.bind(this)],["additionalSolverIterations",this.setAdditionalSolverIterations.bind(this)],["angularDamping",this.setAngularDamping.bind(this)],["angularVelocity",this.setAngularVelocity.bind(this)],["dominanceGroup",this.setDominanceGroup.bind(this)],["ccdEnabled",this.setCcdEnabled.bind(this)],["enabled",this.setEnabled.bind(this)],["enabledPositions",this.setEnabledPositions.bind(this)],["enabledRotations",this.setEnabledRotations.bind(this)],["gravityScale",this.setGravityScale.bind(this)],["linearDamping",this.setLinearDamping.bind(this)],["linearVelocity",this.setLinearVelocity.bind(this)],["position",this.setPosition.bind(this)],["rotation",this.setRotation.bind(this)],["sleeping",this.setSleeping.bind(this)],["softCcdPrediction",this.setSoftCcdPrediction.bind(this)]].forEach(([X,Y])=>{if(X in Z)Y(Z[X])})}_autoAddToSimulation(Z){if(Z.colliders)this._createAndAddPendingChildColliders(Z.colliders);if(Z.simulation)this.addToSimulation(Z.simulation)}_createAndAddPendingChildCollider(Z){if(!this._requireNotRemoved("createAndAddPendingChildCollider"))return null;if(!this._requireNotSimulated("createAndAddPendingChildCollider"))return null;let J=new a5(Z);return this._colliders.add(J),J}_createAndAddPendingChildColliders(Z){let J=[];return Z.forEach((X)=>{let Y=this._createAndAddPendingChildCollider(X);if(Y)J.push(Y)}),J}_createRigidBodyDesc(Z){let J=Z.type??Va;return{["dynamic"]:()=>$1.RigidBodyDesc.dynamic(),["fixed"]:()=>$1.RigidBodyDesc.fixed(),["kinematic_position"]:()=>$1.RigidBodyDesc.kinematicPositionBased(),["kinematic_velocity"]:()=>$1.RigidBodyDesc.kinematicVelocityBased()}[J]()}_requireCreated(Z){if(!this._rigidBody||!this._simulation)m.error(`RigidBody._requireCreated(): Rigid body has not been created and therefore does not support the invoked method: ${Z}()`);return!!this._rigidBody&&!!this._simulation}_requireDynamic(Z){if(!this.isDynamic)m.error(`RigidBody._requireDynamic(): Rigid body is not dynamic and therefore does not support the invoked method: ${Z}()`);return this.isDynamic}_requireKinematic(Z){if(!this.isKinematic)m.error(`RigidBody._requireKinematic(): Rigid body is not kinematic and therefore does not support the invoked method: ${Z}()`);return this.isKinematic}_requireNotKinematicPositionBased(Z){if(this.isKinematicPositionBased)m.error(`RigidBody._requireNotKinematicPositionBased(): Rigid body is kinematic position based and therefore does not support the invoked method: ${Z}()`);return!this.isKinematicPositionBased}_requireNotRemoved(Z){if(!this._rigidBody&&!this._rigidBodyDesc)m.error(`RigidBody._requireNotRemoved(): Rigid body has been removed and therefore does not support the invoked method: ${Z}()`);return!!this._rigidBody||!!this._rigidBodyDesc}_requireNotSimulated(Z){if(this.isSimulated)m.error(`RigidBody._requireNotSimulated(): Rigid body is simulated and therefore does not support the invoked method: ${Z}()`);return!this.isSimulated}_isNegligibleVector(Z){return Math.abs(Z.x)<vC&&Math.abs(Z.y)<vC&&Math.abs(Z.z)<vC}}var SC;(($)=>{$[$.Average=0]="Average";$[$.Min=1]="Min";$[$.Multiply=2]="Multiply";$[$.Max=3]="Max"})(SC||={});var v3;((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"})(v3||={});class a5 extends g0{_collider;_colliderDesc;_onCollision;_parentRigidBody;_shape;_simulation;_tag;constructor(Z){super();this._colliderDesc=this._createColliderDesc(Z),this._shape=Z.shape,this._applyColliderOptions(Z),this._autoAddToSimulation(Z)}static optionsFromBlockHalfExtents(Z){return{shape:"block",halfExtents:Z}}static optionsFromModelUri(Z,J=1,X){let Y=P9.instance.getBoundingBox(Z),$=Y.max.x-Y.min.x,Q=Y.max.y-Y.min.y,K=Y.max.z-Y.min.z,W=Math.max($,K),G=Math.min($,K),z=W/G,V=W/Q,H=W*J/2,q=(R)=>Math.max(0.01,R),F=()=>({shape:"block",halfExtents:{x:q($*J/2),y:q(Q*J/2),z:q(K*J/2)}}),U=()=>({shape:"round-cylinder",radius:q(H),halfHeight:q(Q*J/2),borderRadius:q(H*0.1)}),w=()=>{let R=P9.instance.getTrimesh(Z,J);if(!R)return;return{shape:"trimesh",vertices:R.vertices,indices:R.indices}},L=()=>({shape:"wedge",extents:{x:$*J,y:Q*J,z:K*J}}),j=()=>({shape:"capsule",radius:q(H),halfHeight:q(Q*J/2-H)});if(X)switch(X){case"block":return F();case"capsule":return j();case"round-cylinder":return U();case"trimesh":{let R=w();if(!R){m.error(`Collider.optionsFromModelUri(): Failed to create trimesh options for model ${Z}, falling back to generic shape!`);break}return R}case"wedge":return L();default:m.warning(`Collider.optionsFromModelUri(): Preferred shape ${X} is not yet supported with Collider.optionsFromModelUri(), defaulting to generic shape!`)}if(z>2)return F();if(V>1.5)return U();return j()}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?J4.decodeRawCollisionGroups(this._collider.collisionGroups()):J4.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=J4.buildRawCollisionGroups(Z);this._collider?this._collider.setCollisionGroups(J):this._colliderDesc.setCollisionGroups(J)}setEnabled(Z){if(!this._requireNotRemoved("setEnabled"))return;this._collider?this._collider.setEnabled(Z):this._colliderDesc.setEnabled(Z)}setFriction(Z){if(!this._requireNotRemoved("setFriction"))return;this._collider?this._collider.setFriction(Z):this._colliderDesc.setFriction(Z)}setFrictionCombineRule(Z){if(!this._requireNotRemoved("setFrictionCombineRule"))return;this._collider?this._collider.setFrictionCombineRule(Z):this._colliderDesc.setFrictionCombineRule(Z)}setMass(Z){if(!this._requireNotRemoved("setMass"))return;this._collider?this._collider.setMass(Z):this._colliderDesc.setMass(Z)}setOnCollision(Z){if(!this._requireNotRemoved("setOnCollision"))return;if(this._onCollision=Z,this.isSimulated)if(this.enableCollisionEvents(!!Z),Z)this._simulation.colliderMap.setColliderCollisionCallback(this,Z);else this._simulation.colliderMap.removeColliderCollisionCallback(this)}setRelativeRotation(Z){if(!this._requireNotRemoved("setRelativeRotation"))return;this._collider?this._collider.setRotation(Z):this._colliderDesc.setRotation(Z)}setRelativePosition(Z){if(!this._requireNotRemoved("setRelativePosition"))return;this._collider?this._collider.setTranslation(Z):this._colliderDesc.setTranslation(Z.x,Z.y,Z.z)}setSensor(Z){if(!this._requireNotRemoved("setSensor"))return;this._collider?this._collider.setSensor(Z):this._colliderDesc.setSensor(Z)}setTag(Z){if(!this._requireNotRemoved("setTag"))return;this._tag=Z}addToSimulation(Z,J){if(!this._requireNotRemoved("addToSimulation"))return;if(!this._requireUnsimulated("addToSimulation"))return;if(J){if(!J.isSimulated)return m.error("Collider.addToSimulation(): Rigid body must be simulated before adding a collider to it!");if(J.type==="dynamic"&&this.shape==="trimesh")m.warning("Collider.addToSimulation(): Trimesh colliders are strongly discouraged to be used with dynamic rigid bodies, they will not contribute any mass!")}if(this._simulation=Z,this._parentRigidBody=J,this._collider=this._simulation.createRawCollider(this._colliderDesc,J?.rawRigidBody),this._colliderDesc=void 0,J)J.linkCollider(this);if(this._onCollision)this.setOnCollision(this._onCollision)}enableCollisionEvents(Z){if(!this._requireNotRemoved("enableCollisionEvents"))return;let J=this._collider?this._collider.activeEvents():this._colliderDesc.activeEvents,X=Z?J|$1.ActiveEvents.COLLISION_EVENTS:J&~$1.ActiveEvents.COLLISION_EVENTS;(this._collider??this._colliderDesc).setActiveEvents(X),this._setActiveCollisionTypes()}enableContactForceEvents(Z){if(!this._requireNotRemoved("enableContactForceEvents"))return;let J=this._collider?this._collider.activeEvents():this._colliderDesc.activeEvents,X=Z?J|$1.ActiveEvents.CONTACT_FORCE_EVENTS:J&~$1.ActiveEvents.CONTACT_FORCE_EVENTS;(this._collider??this._colliderDesc).setActiveEvents(X),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(([X,Y])=>{if(Z[X]!==void 0)Y.call(this,Z[X])})}_autoAddToSimulation(Z){if(Z.simulation)this.addToSimulation(Z.simulation,Z.parentRigidBody)}_buildWedgeConvexHullVertices(Z){let{x:J,y:X,z:Y}=Z,$=J/2,Q=Y/2,K=X/2;return new Float32Array([-$,0-K,-Q,$,0-K,-Q,$,0-K,Q,-$,0-K,Q,-$,X-K,-Q,$,X-K,-Q])}_createColliderDesc(Z){let{shape:J,flags:X}=Z;switch(J){case"ball":{if(!Z.radius)m.fatalError("Ball collider must have a radius!");return $1.ColliderDesc.ball(Z.radius)}case"block":{if(!Z.halfExtents)m.fatalError("Block collider must have halfExtents!");return $1.ColliderDesc.cuboid(Z.halfExtents.x,Z.halfExtents.y,Z.halfExtents.z)}case"capsule":{if(!Z.halfHeight||!Z.radius)m.fatalError("Capsule collider must have halfHeight and radius!");return $1.ColliderDesc.capsule(Z.halfHeight,Z.radius)}case"cone":{if(!Z.radius||!Z.halfHeight)m.fatalError("Cone collider must have radius and halfHeight!");return $1.ColliderDesc.cone(Z.halfHeight,Z.radius)}case"cylinder":{if(!Z.radius||!Z.halfHeight)m.fatalError("Cylinder collider must have radius and halfHeight!");return $1.ColliderDesc.cylinder(Z.halfHeight,Z.radius)}case"round-cylinder":{if(!Z.radius||!Z.halfHeight||!Z.borderRadius)m.fatalError("Round cylinder collider must have radius, halfHeight, and borderRadius!");return $1.ColliderDesc.roundCylinder(Z.halfHeight,Z.radius,Z.borderRadius)}case"trimesh":{if(!Z.indices||!Z.vertices)m.fatalError("Trimesh collider must have vertices and indices!");return $1.ColliderDesc.trimesh(Z.vertices,Z.indices,X)}case"wedge":{if(!Z.extents)m.fatalError("Wedge collider must have extents!");let Y=this._buildWedgeConvexHullVertices(Z.extents),$=$1.ColliderDesc.convexHull(Y);if(!$)throw m.fatalError("Failed to create convex hull for wedge collider!"),new Error("Convex hull creation failed");return $}default:m.fatalError(`Collider._createColliderDesc(): ${J} is not a valid collider shape!`)}}_requireSimulated(Z){if(!this.isSimulated)m.error(`Collider._requireSimulated(): Collider is not simulated, invoked method: ${Z}()`);return this.isSimulated}_requireUnsimulated(Z){if(this.isSimulated)m.error(`Collider._requireUnsimulated(): Collider is already simulated, invoked method: ${Z}()`);return!this.isSimulated}_requireNotRemoved(Z){if(this.isRemoved)m.error(`Collider._requireNotRemoved(): Collider is removed, invoked method: ${Z}()`);return!this.isRemoved}_setActiveCollisionTypes(){(this._collider??this._colliderDesc).setActiveCollisionTypes($1.ActiveCollisionTypes.DYNAMIC_DYNAMIC|$1.ActiveCollisionTypes.DYNAMIC_KINEMATIC|$1.ActiveCollisionTypes.DYNAMIC_FIXED|$1.ActiveCollisionTypes.KINEMATIC_KINEMATIC|$1.ActiveCollisionTypes.KINEMATIC_FIXED)}}var tB1={shape:"trimesh",flags:LG.FIX_INTERNAL_EDGES},eB1=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]),Zj1=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]),_C;((X)=>{X.ENTITY_COLLISION="BLOCK_TYPE.ENTITY_COLLISION";X.ENTITY_CONTACT_FORCE="BLOCK_TYPE.ENTITY_CONTACT_FORCE"})(_C||={});class s5 extends g0{_id;_customColliderOptions;_isLiquid;_name;_textureUri;constructor(Z={id:-1,textureUri:"textures/missing.png",name:"Unknown"}){if(Z.id<0)m.fatalError("BlockType.constructor(): BlockType id not set.");super();this._id=Z.id,this._customColliderOptions=Z.customColliderOptions,this._isLiquid=Z.isLiquid??!1,this._name=Z.name,this._textureUri=Z.textureUri}get id(){return this._id}get colliderOptions(){return{...this._customColliderOptions,...tB1}}get isLiquid(){return this._isLiquid}get isMeshable(){return!this._customColliderOptions}get name(){return this._name}get textureUri(){return this._textureUri}createCollider(Z=eB1,J=Zj1){let X=new a5({...this.colliderOptions,indices:Z,vertices:J});if(this.isLiquid)X.setSensor(!0);if(this.hasListeners("BLOCK_TYPE.ENTITY_COLLISION")||this.isLiquid)X.enableCollisionEvents(!0);if(this.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))X.enableContactForceEvents(!0);if(J4.isDefaultCollisionGroups(X.collisionGroups))X.setCollisionGroups({belongsTo:[1],collidesWith:[65535&~1]});return X}serialize(){return p0.serializeBlockType(this)}}var AC;((J)=>J.REGISTER_BLOCK_TYPE="BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE")(AC||={});class S3 extends g0{_blockTypes=new Map;_world;constructor(Z){super();this._world=Z}get world(){return this._world}getAllBlockTypes(){return Array.from(this._blockTypes.values())}getBlockType(Z){let J=this._blockTypes.get(Z);if(!J)m.fatalError(`BlockTypeRegistry.getBlockType(): BlockType with id ${Z} not found.`);return J}registerGenericBlockType(Z){let X=new class extends s5{constructor(Y=Z){super(Y)}};return this.registerBlockType(X),X}registerBlockType(Z){this._blockTypes.set(Z.id,Z),this.emitWithWorld(this._world,"BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE",{blockTypeRegistry:this,id:Z.id,blockType:Z})}serialize(){return p0.serializeBlockTypeRegistry(this)}}var Gk={};d4(Gk,{worldSchema:()=>Wk,worldPacketDefinition:()=>Ye,vectorSchema:()=>v1,vectorBooleanSchema:()=>tC1,uiSchema:()=>Qk,uiPacketDefinition:()=>Je,uiDatasSchema:()=>Kk,uiDatasPacketDefinition:()=>Xe,uiDataSendPacketDefinition:()=>ut,uiDataSchema:()=>Jz,syncResponseSchema:()=>$k,syncResponsePacketDefinition:()=>Ze,syncRequestSchema:()=>xT,syncRequestPacketDefinition:()=>mt,stateRequestSchema:()=>AT,stateRequestPacketDefinition:()=>gt,sceneUIsSchema:()=>Yk,sceneUIsPacketDefinition:()=>et,sceneUISchema:()=>Xk,rgbColorSchema:()=>V7,registeredPackets:()=>EL,quaternionSchema:()=>iT,playersSchema:()=>Jk,playersPacketDefinition:()=>tt,playerSchema:()=>Zk,physicsDebugRenderSchema:()=>eT,physicsDebugRenderPacketDefinition:()=>ot,physicsDebugRaycastsSchema:()=>tT,physicsDebugRaycastsPacketDefinition:()=>rt,physicsDebugRaycastSchema:()=>rT,outboundPackets:()=>kL,modelNodeOverrideSchema:()=>pT,lightsSchema:()=>oT,lightsPacketDefinition:()=>st,lightSchema:()=>sT,isValidPacket:()=>ZT1,inputSchema:()=>_T,inputPacketDefinition:()=>yt,inboundPackets:()=>TL,hexColorSchema:()=>vT,heartbeatSchema:()=>IT,heartbeatPacketDefinition:()=>ht,entitySchema:()=>nT,entitiesSchema:()=>aT,entitiesPacketDefinition:()=>at,definePacket:()=>k0,debugConfigSchema:()=>ST,debugConfigPacketDefinition:()=>bt,createPacket:()=>dC1,connectionSchema:()=>ET,connectionPacketDefinition:()=>xt,chunksSchema:()=>lT,chunksPacketDefinition:()=>nt,chunkSchema:()=>cT,chatMessagesSchema:()=>dT,chatMessagesPacketDefinition:()=>it,chatMessageSendPacketDefinition:()=>ft,chatMessageSchema:()=>Zz,cameraSchema:()=>uT,cameraPacketDefinition:()=>pt,blocksSchema:()=>yT,blocksPacketDefinition:()=>ct,blockTypesSchema:()=>mT,blockTypesPacketDefinition:()=>lt,blockTypeSchema:()=>gT,blockSchema:()=>bT,bidirectionalPackets:()=>CL,audiosSchema:()=>fT,audiosPacketDefinition:()=>dt,audioSchema:()=>hT,PacketId:()=>x1});var CL={};d4(CL,{heartbeatPacketDefinition:()=>ht,connectionPacketDefinition:()=>xt});var TT=t(_t(),1);class kT extends TT.default{static instance=new TT.default}var x1;((T)=>{T[T.SYNC_REQUEST=0]="SYNC_REQUEST";T[T.INPUT=1]="INPUT";T[T.STATE_REQUEST=2]="STATE_REQUEST";T[T.CHAT_MESSAGE_SEND=3]="CHAT_MESSAGE_SEND";T[T.UI_DATA_SEND=4]="UI_DATA_SEND";T[T.SYNC_RESPONSE=32]="SYNC_RESPONSE";T[T.AUDIOS=33]="AUDIOS";T[T.BLOCKS=34]="BLOCKS";T[T.BLOCK_TYPES=35]="BLOCK_TYPES";T[T.CHAT_MESSAGES=36]="CHAT_MESSAGES";T[T.CHUNKS=37]="CHUNKS";T[T.ENTITIES=38]="ENTITIES";T[T.WORLD=39]="WORLD";T[T.CAMERA=40]="CAMERA";T[T.UI=41]="UI";T[T.UI_DATAS=42]="UI_DATAS";T[T.SCENE_UIS=43]="SCENE_UIS";T[T.LIGHTS=44]="LIGHTS";T[T.PLAYERS=45]="PLAYERS";T[T.CONNECTION=116]="CONNECTION";T[T.HEARTBEAT=117]="HEARTBEAT";T[T.DEBUG_CONFIG=128]="DEBUG_CONFIG";T[T.PHYSICS_DEBUG_RENDER=192]="PHYSICS_DEBUG_RENDER";T[T.PHYSICS_DEBUG_RAYCASTS=193]="PHYSICS_DEBUG_RAYCASTS"})(x1||={});function dC1(Z,J,X){if(!Z.validate(J))throw new Error(`Invalid payload for packet with id ${Z.id}. Error: ${kT.instance.errorsText(Z.validate.errors)}`);let Y=[Z.id,J];if(typeof X==="number")Y.push(X);return Y}function k0(Z,J){return{id:Z,schema:J,validate:kT.instance.compile(J)}}var cC1={type:"object",properties:{i:{type:"string"}},required:["i"],additionalProperties:!1},At={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},lC1={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},pC1={type:"object",properties:{usernameFragment:{type:"string"},password:{type:"string"},iceLite:{type:"boolean",nullable:!0}},required:["usernameFragment","password"],additionalProperties:!1},iC1={type:"object",properties:{i:{type:"string"},l:{type:"string"}},required:["i","l"],additionalProperties:!1},nC1={type:"object",properties:{port:{type:"number"},OS:{type:"number"},MIS:{type:"number"},maxMessageSize:{type:"number"}},required:["port","OS","MIS","maxMessageSize"],additionalProperties:!0},aC1={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},sC1={type:"object",properties:{i:{type:"string"},f:{type:"string",enum:["cs","sc"]},ip:pC1,ic:{type:"array",items:lC1},d:At,s:nC1},required:["i","f","ip","ic","d","s"],additionalProperties:!1},oC1={type:"object",properties:{i:{type:"string"},d:At},required:["i","d"],additionalProperties:!1},rC1={type:"object",properties:{i:{type:"string",nullable:!0},pi:{type:"string",nullable:!0},l:{type:"string"},s:aC1},required:["l","s"],additionalProperties:!1},ET={type:"object",properties:{i:{type:"string",nullable:!0},c:{...oC1,nullable:!0},ca:{...cC1,nullable:!0},d:{type:"array",items:{...rC1},nullable:!0},pa:{...iC1,nullable:!0},t:{type:"array",items:{...sC1},nullable:!0}},additionalProperties:!1};var xt=k0(116,ET);var IT={type:"null",nullable:!0};var ht=k0(117,IT);var TL={};d4(TL,{uiDataSendPacketDefinition:()=>ut,syncRequestPacketDefinition:()=>mt,stateRequestPacketDefinition:()=>gt,inputPacketDefinition:()=>yt,debugConfigPacketDefinition:()=>bt,chatMessageSendPacketDefinition:()=>ft});var vT={type:"string",pattern:"^[0-9A-Fa-f]{6}$"};var Zz={type:"object",properties:{m:{type:"string"},c:{...vT,nullable:!0},p:{type:"string",nullable:!0}},required:["m"],additionalProperties:!1};var ft=k0(3,Zz);var ST={type:"object",properties:{pdr:{type:"boolean",nullable:!0}},additionalProperties:!1};var bt=k0(128,ST);var _T={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 yt=k0(1,_T);var AT={type:"object",properties:{},additionalProperties:!1};var gt=k0(2,AT);var xT={type:"null",nullable:!0};var mt=k0(0,xT);var Jz={type:"object",properties:{},additionalProperties:!0};var ut=k0(4,Jz);var kL={};d4(kL,{worldPacketDefinition:()=>Ye,uiPacketDefinition:()=>Je,uiDatasPacketDefinition:()=>Xe,syncResponsePacketDefinition:()=>Ze,sceneUIsPacketDefinition:()=>et,playersPacketDefinition:()=>tt,physicsDebugRenderPacketDefinition:()=>ot,physicsDebugRaycastsPacketDefinition:()=>rt,lightsPacketDefinition:()=>st,entitiesPacketDefinition:()=>at,chunksPacketDefinition:()=>nt,chatMessagesPacketDefinition:()=>it,cameraPacketDefinition:()=>pt,blocksPacketDefinition:()=>ct,blockTypesPacketDefinition:()=>lt,audiosPacketDefinition:()=>dt});var v1={type:"array",items:[{type:"number"},{type:"number"},{type:"number"}],minItems:3,maxItems:3};var hT={type:"object",properties:{i:{type:"number"},a:{type:"string",nullable:!0},cd:{type:"number",nullable:!0},d:{type:"number",nullable:!0},de:{type:"number",nullable:!0},di:{type:"number",minimum:0,nullable:!0},e:{type:"number",nullable:!0},l:{type:"boolean",nullable:!0},o:{type:"number",nullable:!0},p:{...v1,nullable:!0},pa:{type:"boolean",nullable:!0},pl:{type:"boolean",nullable:!0},pr:{type:"number",minimum:0,nullable:!0},r:{type:"boolean",nullable:!0},rd:{type:"number",nullable:!0},s:{type:"number",nullable:!0},v:{type:"number",minimum:0,maximum:1,nullable:!0}},required:["i"],additionalProperties:!1};var fT={type:"array",items:{...hT}};var dt=k0(33,fT);var bT={type:"object",properties:{i:{type:"number"},c:v1},required:["i","c"],additionalProperties:!1};var yT={type:"array",items:{...bT}};var ct=k0(34,yT);var gT={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 mT={type:"array",items:{...gT}};var lt=k0(35,mT);var uT={type:"object",properties:{m:{type:"number",nullable:!0},e:{type:"number",nullable:!0},et:{type:"number",nullable:!0},fo:{type:"number",nullable:!0},ffo:{type:"number",nullable:!0},fv:{type:"number",nullable:!0},p:{...v1,nullable:!0},pt:{...v1,nullable:!0},pl:{...v1,nullable:!0},h:{type:"array",items:{type:"string"},nullable:!0},o:{...v1,nullable:!0},z:{type:"number",nullable:!0}},additionalProperties:!1};var dT={type:"array",items:{...Zz}};var cT={type:"object",properties:{c:v1,b:{type:"array",items:{type:"number",minimum:0,maximum:255},minItems:4096,maxItems:4096,nullable:!0},rm:{type:"boolean",nullable:!0}},required:["c"],additionalProperties:!1};var lT={type:"array",items:{...cT}};var V7={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 pT={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:{...V7,nullable:!0}},required:["n"],additionalProperties:!1};var iT={type:"array",items:[{type:"number"},{type:"number"},{type:"number"},{type:"number"}],minItems:4,maxItems:4};var nT={type:"object",properties:{i:{type:"number"},al:{type:"array",items:{type:"string"},nullable:!0},ao:{type:"array",items:{type:"string"},nullable:!0},ap:{type:"number",nullable:!0},as:{type:"array",items:{type:"string"},nullable:!0},bh:{...v1,nullable:!0},bt:{type:"string",nullable:!0},h:{type:"array",items:{type:"string"},nullable:!0},m:{type:"string",nullable:!0},mo:{type:"array",items:{...pT},nullable:!0},n:{type:"string",nullable:!0},o:{type:"number",nullable:!0},p:{...v1,nullable:!0},pe:{type:"number",nullable:!0},pn:{type:"string",nullable:!0},r:{...iT,nullable:!0},rm:{type:"boolean",nullable:!0},s:{type:"number",nullable:!0},t:{...V7,nullable:!0}},required:["i"],additionalProperties:!1};var aT={type:"array",items:{...nT}};var sT={type:"object",properties:{i:{type:"number"},a:{type:"number",nullable:!0},e:{type:"number",nullable:!0},c:{...V7,nullable:!0},d:{type:"number",nullable:!0},n:{type:"number",nullable:!0},o:{...v1,nullable:!0},p:{...v1,nullable:!0},pe:{type:"number",minimum:0,maximum:1,nullable:!0},rm:{type:"boolean",nullable:!0},t:{type:"number",nullable:!0},te:{type:"number",nullable:!0},tp:{...v1,nullable:!0}},required:["i"],additionalProperties:!1};var oT={type:"array",items:{...sT}};var rT={type:"object",properties:{o:{...v1},d:{...v1},l:{type:"number"},h:{type:"boolean"}},required:["o","d","l","h"],additionalProperties:!1};var tT={type:"array",items:{...rT}};var eT={type:"object",properties:{v:{type:"array",items:{type:"number"}},c:{type:"array",items:{type:"number"}}},required:["v","c"],additionalProperties:!1};var Zk={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 Jk={type:"array",items:{...Zk}};var Xk={type:"object",properties:{i:{type:"number"},e:{type:"number",nullable:!0},o:{...v1,nullable:!0},p:{...v1,nullable:!0},rm:{type:"boolean",nullable:!0},s:{type:"object",nullable:!0},t:{type:"string",nullable:!0},v:{type:"number",nullable:!0}},required:["i"],additionalProperties:!1};var Yk={type:"array",items:{...Xk}};var $k={type:"object",properties:{r:{type:"number"},s:{type:"number"},p:{type:"number"},n:{type:"number"}},required:["r","s","p","n"],additionalProperties:!1};var Qk={type:"object",properties:{p:{type:"boolean",nullable:!0},u:{type:"string",nullable:!0}},additionalProperties:!1};var Kk={type:"array",items:{...Jz}};var tC1={type:"array",items:[{type:"boolean"},{type:"boolean"},{type:"boolean"}],minItems:3,maxItems:3};var Wk={type:"object",properties:{i:{type:"number"},ac:{...V7,nullable:!0},ai:{type:"number",nullable:!0},dc:{...V7,nullable:!0},di:{type:"number",nullable:!0},dp:{...v1,nullable:!0},n:{type:"string",nullable:!0},s:{type:"string",nullable:!0},si:{type:"number",nullable:!0},t:{type:"number",nullable:!0}},required:["i"],additionalProperties:!1};var pt=k0(40,uT);var it=k0(36,dT);var nt=k0(37,lT);var at=k0(38,aT);var st=k0(44,oT);var ot=k0(192,eT);var rt=k0(193,tT);var tt=k0(45,Jk);var et=k0(43,Yk);var Ze=k0(32,$k);var Je=k0(41,Qk);var Xe=k0(42,Kk);var Ye=k0(39,Wk);var EL=new Map,eC1={...CL,...TL,...kL};for(let Z of Object.values(eC1))if("id"in Z&&"schema"in Z){let J=Z;if(EL.has(J.id))throw new Error(`Packet with id ${J.id} is already registered.`);EL.set(J.id,J)}function ZT1(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=EL.get(Z[0]);return!!J&&J.validate(Z[1])}var X0=Gk;import{WebSocket as O16}from"ws";var r6=t(W00(),1),Ew6=r6.default.v1,Iw6=r6.default.v1ToV6,vw6=r6.default.v3,G00=r6.default.v4,Sw6=r6.default.v5,_w6=r6.default.v6,Aw6=r6.default.v6ToV1,xw6=r6.default.v7,hw6=r6.default.NIL,fw6=r6.default.MAX,bw6=r6.default.version,yw6=r6.default.validate,gw6=r6.default.stringify,mw6=r6.default.parse;var wk;try{wk=new TextDecoder}catch(Z){}var e,r5,y=0;var Mk=[],IY=Mk,$z=0,S1={},X1,jZ,o5=0,T9=0,c8,OZ,T5=[],e0,z00={useRecords:!1,mapsAsObjects:!0};class fL{}var Rk=new fL;Rk.name="MessagePack 0xC1";var EJ=!1,B00=2,Bk,jk,Ok;try{new Function("")}catch(Z){B00=1/0}class MZ{constructor(Z){if(Z){if(Z.useRecords===!1&&Z.mapsAsObjects===void 0)Z.mapsAsObjects=!0;if(Z.sequential&&Z.trusted!==!1){if(Z.trusted=!0,!Z.structures&&Z.useRecords!=!1){if(Z.structures=[],!Z.maxSharedStructures)Z.maxSharedStructures=0}}if(Z.structures)Z.structures.sharedLength=Z.structures.length;else if(Z.getStructures)(Z.structures=[]).uninitialized=!0,Z.structures.sharedLength=0;if(Z.int64AsNumber)Z.int64AsType="number"}Object.assign(this,Z)}unpack(Z,J){if(e)return E00(()=>{return hL(),this?this.unpack(Z,J):MZ.prototype.unpack.call(z00,Z,J)});if(!Z.buffer&&Z.constructor===ArrayBuffer)Z=typeof Buffer!=="undefined"?Buffer.from(Z):new Uint8Array(Z);if(typeof J==="object")r5=J.end||Z.length,y=J.start||0;else y=0,r5=J>-1?J:Z.length;$z=0,T9=0,jZ=null,IY=Mk,c8=null,e=Z;try{e0=Z.dataView||(Z.dataView=new DataView(Z.buffer,Z.byteOffset,Z.byteLength))}catch(X){if(e=null,Z instanceof Uint8Array)throw X;throw new Error("Source must be a Uint8Array or Buffer but was a "+(Z&&typeof Z=="object"?Z.constructor.name:typeof Z))}if(this instanceof MZ){if(S1=this,this.structures)return X1=this.structures,AL(J);else if(!X1||X1.length>0)X1=[]}else if(S1=z00,!X1||X1.length>0)X1=[];return AL(J)}unpackMultiple(Z,J){let X,Y=0;try{EJ=!0;let $=Z.length,Q=this?this.unpack(Z,$):bL.unpack(Z,$);if(J){if(J(Q,Y,y)===!1)return;while(y<$)if(Y=y,J(AL(),Y,y)===!1)return}else{X=[Q];while(y<$)Y=y,X.push(AL());return X}}catch($){throw $.lastPosition=Y,$.values=X,$}finally{EJ=!1,hL()}}_mergeStructures(Z,J){if(jk)Z=jk.call(this,Z);if(Z=Z||[],Object.isFrozen(Z))Z=Z.map((X)=>X.slice(0));for(let X=0,Y=Z.length;X<Y;X++){let $=Z[X];if($){if($.isShared=!0,X>=32)$.highByte=X-32>>5}}Z.sharedLength=Z.length;for(let X in J||[])if(X>=0){let Y=Z[X],$=J[X];if($){if(Y)(Z.restoreStructures||(Z.restoreStructures=[]))[X]=Y;Z[X]=$}}return this.structures=Z}decode(Z,J){return this.unpack(Z,J)}}function AL(Z){try{if(!S1.trusted&&!EJ){let X=X1.sharedLength||0;if(X<X1.length)X1.length=X}let J;if(S1.randomAccessStructure&&e[y]<64&&e[y]>=32&&Bk){if(J=Bk(e,y,r5,S1),e=null,!(Z&&Z.lazy)&&J)J=J.toJSON();y=r5}else J=D8();if(c8)y=c8.postBundlePosition,c8=null;if(EJ)X1.restoreStructures=null;if(y==r5){if(X1&&X1.restoreStructures)V00();if(X1=null,e=null,OZ)OZ=null}else if(y>r5)throw new Error("Unexpected end of MessagePack data");else if(!EJ){let X;try{X=JSON.stringify(J,(Y,$)=>typeof $==="bigint"?`${$}n`:$).slice(0,100)}catch(Y){X="(JSON view not available "+Y+")"}throw new Error("Data read, but end of buffer not reached "+X)}return J}catch(J){if(X1&&X1.restoreStructures)V00();if(hL(),J instanceof RangeError||J.message.startsWith("Unexpected end of buffer")||y>r5)J.incomplete=!0;throw J}}function V00(){for(let Z in X1.restoreStructures)X1[Z]=X1.restoreStructures[Z];X1.restoreStructures=null}function D8(){let Z=e[y++];if(Z<160)if(Z<128)if(Z<64)return Z;else{let J=X1[Z&63]||S1.getStructures&&j00()[Z&63];if(J){if(!J.read)J.read=Nk(J,Z&63);return J.read()}else return Z}else if(Z<144)if(Z-=128,S1.mapsAsObjects){let J={};for(let X=0;X<Z;X++){let Y=T00();if(Y==="__proto__")Y="__proto_";J[Y]=D8()}return J}else{let J=new Map;for(let X=0;X<Z;X++)J.set(D8(),D8());return J}else{Z-=144;let J=new Array(Z);for(let X=0;X<Z;X++)J[X]=D8();if(S1.freezeData)return Object.freeze(J);return J}else if(Z<192){let J=Z-160;if(T9>=y)return jZ.slice(y-o5,(y+=J)-o5);if(T9==0&&r5<140){let X=J<16?Pk(J):C00(J);if(X!=null)return X}return xL(J)}else{let J;switch(Z){case 192:return null;case 193:if(c8)if(J=D8(),J>0)return c8[1].slice(c8.position1,c8.position1+=J);else return c8[0].slice(c8.position0,c8.position0-=J);return Rk;case 194:return!1;case 195:return!0;case 196:if(J=e[y++],J===void 0)throw new Error("Unexpected end of buffer");return Lk(J);case 197:return J=e0.getUint16(y),y+=2,Lk(J);case 198:return J=e0.getUint32(y),y+=4,Lk(J);case 199:return EY(e[y++]);case 200:return J=e0.getUint16(y),y+=2,EY(J);case 201:return J=e0.getUint32(y),y+=4,EY(J);case 202:if(J=e0.getFloat32(y),S1.useFloat32>2){let X=SY[(e[y]&127)<<1|e[y+1]>>7];return y+=4,(X*J+(J>0?0.5:-0.5)>>0)/X}return y+=4,J;case 203:return J=e0.getFloat64(y),y+=8,J;case 204:return e[y++];case 205:return J=e0.getUint16(y),y+=2,J;case 206:return J=e0.getUint32(y),y+=4,J;case 207:if(S1.int64AsType==="number")J=e0.getUint32(y)*4294967296,J+=e0.getUint32(y+4);else if(S1.int64AsType==="string")J=e0.getBigUint64(y).toString();else if(S1.int64AsType==="auto"){if(J=e0.getBigUint64(y),J<=BigInt(2)<<BigInt(52))J=Number(J)}else J=e0.getBigUint64(y);return y+=8,J;case 208:return e0.getInt8(y++);case 209:return J=e0.getInt16(y),y+=2,J;case 210:return J=e0.getInt32(y),y+=4,J;case 211:if(S1.int64AsType==="number")J=e0.getInt32(y)*4294967296,J+=e0.getUint32(y+4);else if(S1.int64AsType==="string")J=e0.getBigInt64(y).toString();else if(S1.int64AsType==="auto"){if(J=e0.getBigInt64(y),J>=BigInt(-2)<<BigInt(52)&&J<=BigInt(2)<<BigInt(52))J=Number(J)}else J=e0.getBigInt64(y);return y+=8,J;case 212:if(J=e[y++],J==114)return w00(e[y++]&63);else{let X=T5[J];if(X)if(X.read)return y++,X.read(D8());else if(X.noBuffer)return y++,X();else return X(e.subarray(y,++y));else throw new Error("Unknown extension "+J)}case 213:if(J=e[y],J==114)return y++,w00(e[y++]&63,e[y++]);else return EY(2);case 214:return EY(4);case 215:return EY(8);case 216:return EY(16);case 217:if(J=e[y++],T9>=y)return jZ.slice(y-o5,(y+=J)-o5);return O00(J);case 218:if(J=e0.getUint16(y),y+=2,T9>=y)return jZ.slice(y-o5,(y+=J)-o5);return M00(J);case 219:if(J=e0.getUint32(y),y+=4,T9>=y)return jZ.slice(y-o5,(y+=J)-o5);return R00(J);case 220:return J=e0.getUint16(y),y+=2,q00(J);case 221:return J=e0.getUint32(y),y+=4,q00(J);case 222:return J=e0.getUint16(y),y+=2,F00(J);case 223:return J=e0.getUint32(y),y+=4,F00(J);default:if(Z>=224)return Z-256;if(Z===void 0){let X=new Error("Unexpected end of MessagePack data");throw X.incomplete=!0,X}throw new Error("Unknown MessagePack token "+Z)}}}var Ik1=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Nk(Z,J){function X(){if(X.count++>B00){let $=Z.read=new Function("r","return function(){return "+(S1.freezeData?"Object.freeze":"")+"({"+Z.map((Q)=>Q==="__proto__"?"__proto_:r()":Ik1.test(Q)?Q+":r()":"["+JSON.stringify(Q)+"]:r()").join(",")+"})}")(D8);if(Z.highByte===0)Z.read=H00(J,Z.read);return $()}let Y={};for(let $=0,Q=Z.length;$<Q;$++){let K=Z[$];if(K==="__proto__")K="__proto_";Y[K]=D8()}if(S1.freezeData)return Object.freeze(Y);return Y}if(X.count=0,Z.highByte===0)return H00(J,X);return X}var H00=(Z,J)=>{return function(){let X=e[y++];if(X===0)return J();let Y=Z<32?-(Z+(X<<5)):Z+(X<<5),$=X1[Y]||j00()[Y];if(!$)throw new Error("Record id is not defined for "+Y);if(!$.read)$.read=Nk($,Z);return $.read()}};function j00(){let Z=E00(()=>{return e=null,S1.getStructures()});return X1=S1._mergeStructures(Z,X1)}var xL=vY,O00=vY,M00=vY,R00=vY,N00=!1;function P00(Z){N00=!0,xL=J(1),O00=J(2),M00=J(3),R00=J(5);function J(X){return function Y($){let Q=IY[$z++];if(Q==null){if(c8)return vY($);let W=e.byteOffset,G=Z(y-X+W,r5+W,e.buffer);if(typeof G=="string")Q=G,IY=Mk;else if(IY=G,$z=1,T9=1,Q=IY[0],Q===void 0)throw new Error("Unexpected end of buffer")}let K=Q.length;if(K<=$)return y+=$,Q;return jZ=Q,o5=y,T9=y+K,y+=$,Q.slice(0,$)}}}function vY(Z){let J;if(Z<16){if(J=Pk(Z))return J}if(Z>64&&wk)return wk.decode(e.subarray(y,y+=Z));let X=y+Z,Y=[];J="";while(y<X){let $=e[y++];if(($&128)===0)Y.push($);else if(($&224)===192){let Q=e[y++]&63;Y.push(($&31)<<6|Q)}else if(($&240)===224){let Q=e[y++]&63,K=e[y++]&63;Y.push(($&31)<<12|Q<<6|K)}else if(($&248)===240){let Q=e[y++]&63,K=e[y++]&63,W=e[y++]&63,G=($&7)<<18|Q<<12|K<<6|W;if(G>65535)G-=65536,Y.push(G>>>10&1023|55296),G=56320|G&1023;Y.push(G)}else Y.push($);if(Y.length>=4096)J+=J6.apply(String,Y),Y.length=0}if(Y.length>0)J+=J6.apply(String,Y);return J}function D00(Z,J,X){let Y=e;e=Z,y=J;try{return vY(X)}finally{e=Y}}function q00(Z){let J=new Array(Z);for(let X=0;X<Z;X++)J[X]=D8();if(S1.freezeData)return Object.freeze(J);return J}function F00(Z){if(S1.mapsAsObjects){let J={};for(let X=0;X<Z;X++){let Y=T00();if(Y==="__proto__")Y="__proto_";J[Y]=D8()}return J}else{let J=new Map;for(let X=0;X<Z;X++)J.set(D8(),D8());return J}}var J6=String.fromCharCode;function C00(Z){let J=y,X=new Array(Z);for(let Y=0;Y<Z;Y++){let $=e[y++];if(($&128)>0){y=J;return}X[Y]=$}return J6.apply(String,X)}function Pk(Z){if(Z<4)if(Z<2)if(Z===0)return"";else{let J=e[y++];if((J&128)>1){y-=1;return}return J6(J)}else{let J=e[y++],X=e[y++];if((J&128)>0||(X&128)>0){y-=2;return}if(Z<3)return J6(J,X);let Y=e[y++];if((Y&128)>0){y-=3;return}return J6(J,X,Y)}else{let J=e[y++],X=e[y++],Y=e[y++],$=e[y++];if((J&128)>0||(X&128)>0||(Y&128)>0||($&128)>0){y-=4;return}if(Z<6)if(Z===4)return J6(J,X,Y,$);else{let Q=e[y++];if((Q&128)>0){y-=5;return}return J6(J,X,Y,$,Q)}else if(Z<8){let Q=e[y++],K=e[y++];if((Q&128)>0||(K&128)>0){y-=6;return}if(Z<7)return J6(J,X,Y,$,Q,K);let W=e[y++];if((W&128)>0){y-=7;return}return J6(J,X,Y,$,Q,K,W)}else{let Q=e[y++],K=e[y++],W=e[y++],G=e[y++];if((Q&128)>0||(K&128)>0||(W&128)>0||(G&128)>0){y-=8;return}if(Z<10)if(Z===8)return J6(J,X,Y,$,Q,K,W,G);else{let z=e[y++];if((z&128)>0){y-=9;return}return J6(J,X,Y,$,Q,K,W,G,z)}else if(Z<12){let z=e[y++],V=e[y++];if((z&128)>0||(V&128)>0){y-=10;return}if(Z<11)return J6(J,X,Y,$,Q,K,W,G,z,V);let H=e[y++];if((H&128)>0){y-=11;return}return J6(J,X,Y,$,Q,K,W,G,z,V,H)}else{let z=e[y++],V=e[y++],H=e[y++],q=e[y++];if((z&128)>0||(V&128)>0||(H&128)>0||(q&128)>0){y-=12;return}if(Z<14)if(Z===12)return J6(J,X,Y,$,Q,K,W,G,z,V,H,q);else{let F=e[y++];if((F&128)>0){y-=13;return}return J6(J,X,Y,$,Q,K,W,G,z,V,H,q,F)}else{let F=e[y++],U=e[y++];if((F&128)>0||(U&128)>0){y-=14;return}if(Z<15)return J6(J,X,Y,$,Q,K,W,G,z,V,H,q,F,U);let w=e[y++];if((w&128)>0){y-=15;return}return J6(J,X,Y,$,Q,K,W,G,z,V,H,q,F,U,w)}}}}}function U00(){let Z=e[y++],J;if(Z<192)J=Z-160;else switch(Z){case 217:J=e[y++];break;case 218:J=e0.getUint16(y),y+=2;break;case 219:J=e0.getUint32(y),y+=4;break;default:throw new Error("Expected string")}return vY(J)}function Lk(Z){return S1.copyBuffers?Uint8Array.prototype.slice.call(e,y,y+=Z):e.subarray(y,y+=Z)}function EY(Z){let J=e[y++];if(T5[J]){let X;return T5[J](e.subarray(y,X=y+=Z),(Y)=>{y=Y;try{return D8()}finally{y=X}})}else throw new Error("Unknown extension type "+J)}var L00=new Array(4096);function T00(){let Z=e[y++];if(Z>=160&&Z<192){if(Z=Z-160,T9>=y)return jZ.slice(y-o5,(y+=Z)-o5);else if(!(T9==0&&r5<180))return xL(Z)}else return y--,k00(D8());let J=(Z<<5^(Z>1?e0.getUint16(y):Z>0?e[y]:0))&4095,X=L00[J],Y=y,$=y+Z-3,Q,K=0;if(X&&X.bytes==Z){while(Y<$){if(Q=e0.getUint32(Y),Q!=X[K++]){Y=1879048192;break}Y+=4}$+=3;while(Y<$)if(Q=e[Y++],Q!=X[K++]){Y=1879048192;break}if(Y===$)return y=Y,X.string;$-=3,Y=y}X=[],L00[J]=X,X.bytes=Z;while(Y<$)Q=e0.getUint32(Y),X.push(Q),Y+=4;$+=3;while(Y<$)Q=e[Y++],X.push(Q);let W=Z<16?Pk(Z):C00(Z);if(W!=null)return X.string=W;return X.string=xL(Z)}function k00(Z){if(typeof Z==="string")return Z;if(typeof Z==="number"||typeof Z==="boolean"||typeof Z==="bigint")return Z.toString();if(Z==null)return Z+"";if(S1.allowArraysInMapKeys&&Array.isArray(Z)&&Z.flat().every((J)=>["string","number","boolean","bigint"].includes(typeof J)))return Z.flat().toString();throw new Error(`Invalid property type for record: ${typeof Z}`)}var w00=(Z,J)=>{let X=D8().map(k00),Y=Z;if(J!==void 0)Z=Z<32?-((J<<5)+Z):(J<<5)+Z,X.highByte=J;let $=X1[Z];if($&&($.isShared||EJ))(X1.restoreStructures||(X1.restoreStructures=[]))[Z]=$;return X1[Z]=X,X.read=Nk(X,Y),X.read()};T5[0]=()=>{};T5[0].noBuffer=!0;T5[66]=(Z)=>{let J=Z.length,X=BigInt(Z[0]&128?Z[0]-256:Z[0]);for(let Y=1;Y<J;Y++)X<<=BigInt(8),X+=BigInt(Z[Y]);return X};var vk1={Error,TypeError,ReferenceError};T5[101]=()=>{let Z=D8();return(vk1[Z[0]]||Error)(Z[1],{cause:Z[2]})};T5[105]=(Z)=>{if(S1.structuredClone===!1)throw new Error("Structured clone extension is disabled");let J=e0.getUint32(y-4);if(!OZ)OZ=new Map;let X=e[y],Y;if(X>=144&&X<160||X==220||X==221)Y=[];else if(X>=128&&X<144||X==222||X==223)Y=new Map;else if((X>=199&&X<=201||X>=212&&X<=216)&&e[y+1]===115)Y=new Set;else Y={};let $={target:Y};OZ.set(J,$);let Q=D8();if(!$.used)return $.target=Q;else Object.assign(Y,Q);if(Y instanceof Map)for(let[K,W]of Q.entries())Y.set(K,W);if(Y instanceof Set)for(let K of Array.from(Q))Y.add(K);return Y};T5[112]=(Z)=>{if(S1.structuredClone===!1)throw new Error("Structured clone extension is disabled");let J=e0.getUint32(y-4),X=OZ.get(J);return X.used=!0,X.target};T5[115]=()=>new Set(D8());var Dk=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map((Z)=>Z+"Array"),Sk1=typeof globalThis==="object"?globalThis:window;T5[116]=(Z)=>{let J=Z[0],X=Uint8Array.prototype.slice.call(Z,1).buffer,Y=Dk[J];if(!Y){if(J===16)return X;if(J===17)return new DataView(X);throw new Error("Could not find typed array for code "+J)}return new Sk1[Y](X)};T5[120]=()=>{let Z=D8();return new RegExp(Z[0],Z[1])};var _k1=[];T5[98]=(Z)=>{let J=(Z[0]<<24)+(Z[1]<<16)+(Z[2]<<8)+Z[3],X=y;return y+=J-Z.length,c8=_k1,c8=[U00(),U00()],c8.position0=0,c8.position1=0,c8.postBundlePosition=y,y=X,D8()};T5[255]=(Z)=>{if(Z.length==4)return new Date((Z[0]*16777216+(Z[1]<<16)+(Z[2]<<8)+Z[3])*1000);else if(Z.length==8)return new Date(((Z[0]<<22)+(Z[1]<<14)+(Z[2]<<6)+(Z[3]>>2))/1e6+((Z[3]&3)*4294967296+Z[4]*16777216+(Z[5]<<16)+(Z[6]<<8)+Z[7])*1000);else if(Z.length==12)return new Date(((Z[0]<<24)+(Z[1]<<16)+(Z[2]<<8)+Z[3])/1e6+((Z[4]&128?-281474976710656:0)+Z[6]*1099511627776+Z[7]*4294967296+Z[8]*16777216+(Z[9]<<16)+(Z[10]<<8)+Z[11])*1000);else return new Date("invalid")};function E00(Z){if(Ok)Ok();let J=r5,X=y,Y=$z,$=o5,Q=T9,K=jZ,W=IY,G=OZ,z=c8,V=new Uint8Array(e.slice(0,r5)),H=X1,q=X1.slice(0,X1.length),F=S1,U=EJ,w=Z();return r5=J,y=X,$z=Y,o5=$,T9=Q,jZ=K,IY=W,OZ=G,c8=z,e=V,EJ=U,X1=H,X1.splice(0,X1.length,...q),S1=F,e0=new DataView(e.buffer,e.byteOffset,e.byteLength),w}function hL(){e=null,OZ=null,X1=null}var SY=new Array(147);for(let Z=0;Z<256;Z++)SY[Z]=+("1e"+Math.floor(45.15-Z*0.30103));var bL=new MZ({useRecords:!1}),Ak1=bL.unpack,xk1=bL.unpackMultiple,hk1=bL.unpack;var fk1=new Float32Array(1),dw6=new Uint8Array(fk1.buffer,0,4);function I00(Z,J,X){Bk=Z,jk=J,Ok=X}var gL;try{gL=new TextEncoder}catch(Z){}var kk,A00,Kz=typeof Buffer!=="undefined",yL=Kz?function(Z){return Buffer.allocUnsafeSlow(Z)}:Uint8Array,x00=Kz?Buffer:Uint8Array,v00=Kz?4294967296:2144337920,c,Qz,h1,g=0,t6,e1=null,h00,bk1=21760,yk1=/[\u0080-\uFFFF]/,H7=Symbol("record-id");class _Y extends MZ{constructor(Z){super(Z);this.offset=0;let J,X,Y,$,Q,K=x00.prototype.utf8Write?function(I,v){return c.utf8Write(I,v,c.byteLength-v)}:gL&&gL.encodeInto?function(I,v){return gL.encodeInto(I,c.subarray(v)).written}:!1,W=this;if(!Z)Z={};let G=Z&&Z.sequential,z=Z.structures||Z.saveStructures,V=Z.maxSharedStructures;if(V==null)V=z?32:0;if(V>8160)throw new Error("Maximum maxSharedStructure is 8160");if(Z.structuredClone&&Z.moreTypes==null)this.moreTypes=!0;let H=Z.maxOwnStructures;if(H==null)H=z?32:64;if(!this.structures&&Z.useRecords!=!1)this.structures=[];let q=V>32||H+V>64,F=V+64,U=V+H+64;if(U>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let w=[],L=0,j=0;this.pack=this.encode=function(I,v){if(!c)c=new yL(8192),h1=c.dataView||(c.dataView=new DataView(c.buffer,0,8192)),g=0;if(t6=c.length-10,t6-g<2048)c=new yL(c.length),h1=c.dataView||(c.dataView=new DataView(c.buffer,0,c.length)),t6=c.length-10,g=0;else g=g+7&2147483640;if(X=g,v&pk1)g+=v&255;if(Q=W.structuredClone?new Map:null,W.bundleStrings&&typeof I!=="string")e1=[],e1.size=1/0;else e1=null;if($=W.structures,$){if($.uninitialized)$=W._mergeStructures(W.getStructures());let p=$.sharedLength||0;if(p>V)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+$.sharedLength);if(!$.transitions){$.transitions=Object.create(null);for(let n=0;n<p;n++){let o=$[n];if(!o)continue;let J0,Q0=$.transitions;for(let C0=0,T0=o.length;C0<T0;C0++){let a0=o[C0];if(J0=Q0[a0],!J0)J0=Q0[a0]=Object.create(null);Q0=J0}Q0[H7]=n+64}this.lastNamedStructuresLength=p}if(!G)$.nextId=p+64}if(Y)Y=!1;let f;try{if(W.randomAccessStructure&&I&&I.constructor&&I.constructor===Object)x(I);else N(I);let p=e1;if(e1)S00(X,N,0);if(Q&&Q.idsToInsert){let n=Q.idsToInsert.sort((C0,T0)=>C0.offset>T0.offset?1:-1),o=n.length,J0=-1;while(p&&o>0){let C0=n[--o].offset+X;if(C0<p.stringsPosition+X&&J0===-1)J0=0;if(C0>p.position+X){if(J0>=0)J0+=6}else{if(J0>=0)h1.setUint32(p.position+X,h1.getUint32(p.position+X)+J0),J0=-1;p=p.previous,o++}}if(J0>=0&&p)h1.setUint32(p.position+X,h1.getUint32(p.position+X)+J0);if(g+=n.length*6,g>t6)k(g);W.offset=g;let Q0=mk1(c.subarray(X,g),n);return Q=null,Q0}if(W.offset=g,v&ck1)return c.start=X,c.end=g,c;return c.subarray(X,g)}catch(p){throw f=p,p}finally{if($){if(R(),Y&&W.saveStructures){let p=$.sharedLength||0,n=c.subarray(X,g),o=f00($,W);if(!f){if(W.saveStructures(o,o.isCompatible)===!1)return W.pack(I,v);if(W.lastNamedStructuresLength=p,c.length>1073741824)c=null;return n}}}if(c.length>1073741824)c=null;if(v&lk1)g=X}};let R=()=>{if(j<10)j++;let I=$.sharedLength||0;if($.length>I&&!G)$.length=I;if(L>1e4){if($.transitions=null,j=0,L=0,w.length>0)w=[]}else if(w.length>0&&!G){for(let v=0,f=w.length;v<f;v++)w[v][H7]=0;w=[]}},O=(I)=>{var v=I.length;if(v<16)c[g++]=144|v;else if(v<65536)c[g++]=220,c[g++]=v>>8,c[g++]=v&255;else c[g++]=221,h1.setUint32(g,v),g+=4;for(let f=0;f<v;f++)N(I[f])},N=(I)=>{if(g>t6)c=k(g);var v=typeof I,f;if(v==="string"){let p=I.length;if(e1&&p>=4&&p<4096){if((e1.size+=p)>bk1){let Q0,C0=(e1[0]?e1[0].length*3+e1[1].length:0)+10;if(g+C0>t6)c=k(g+C0);let T0;if(e1.position)T0=e1,c[g]=200,g+=3,c[g++]=98,Q0=g-X,g+=4,S00(X,N,0),h1.setUint16(Q0+X-3,g-X-Q0);else c[g++]=214,c[g++]=98,Q0=g-X,g+=4;e1=["",""],e1.previous=T0,e1.size=0,e1.position=Q0}let J0=yk1.test(I);e1[J0?0:1]+=I,c[g++]=193,N(J0?-p:p);return}let n;if(p<32)n=1;else if(p<256)n=2;else if(p<65536)n=3;else n=5;let o=p*3;if(g+o>t6)c=k(g+o);if(p<64||!K){let J0,Q0,C0,T0=g+n;for(J0=0;J0<p;J0++)if(Q0=I.charCodeAt(J0),Q0<128)c[T0++]=Q0;else if(Q0<2048)c[T0++]=Q0>>6|192,c[T0++]=Q0&63|128;else if((Q0&64512)===55296&&((C0=I.charCodeAt(J0+1))&64512)===56320)Q0=65536+((Q0&1023)<<10)+(C0&1023),J0++,c[T0++]=Q0>>18|240,c[T0++]=Q0>>12&63|128,c[T0++]=Q0>>6&63|128,c[T0++]=Q0&63|128;else c[T0++]=Q0>>12|224,c[T0++]=Q0>>6&63|128,c[T0++]=Q0&63|128;f=T0-g-n}else f=K(I,g+n);if(f<32)c[g++]=160|f;else if(f<256){if(n<2)c.copyWithin(g+2,g+1,g+1+f);c[g++]=217,c[g++]=f}else if(f<65536){if(n<3)c.copyWithin(g+3,g+2,g+2+f);c[g++]=218,c[g++]=f>>8,c[g++]=f&255}else{if(n<5)c.copyWithin(g+5,g+3,g+3+f);c[g++]=219,h1.setUint32(g,f),g+=4}g+=f}else if(v==="number")if(I>>>0===I)if(I<32||I<128&&this.useRecords===!1||I<64&&!this.randomAccessStructure)c[g++]=I;else if(I<256)c[g++]=204,c[g++]=I;else if(I<65536)c[g++]=205,c[g++]=I>>8,c[g++]=I&255;else c[g++]=206,h1.setUint32(g,I),g+=4;else if(I>>0===I)if(I>=-32)c[g++]=256+I;else if(I>=-128)c[g++]=208,c[g++]=I+256;else if(I>=-32768)c[g++]=209,h1.setInt16(g,I),g+=2;else c[g++]=210,h1.setInt32(g,I),g+=4;else{let p;if((p=this.useFloat32)>0&&I<4294967296&&I>=-2147483648){c[g++]=202,h1.setFloat32(g,I);let n;if(p<4||(n=I*SY[(c[g]&127)<<1|c[g+1]>>7])>>0===n){g+=4;return}else g--}c[g++]=203,h1.setFloat64(g,I),g+=8}else if(v==="object"||v==="function")if(!I)c[g++]=192;else{if(Q){let n=Q.get(I);if(n){if(!n.id){let o=Q.idsToInsert||(Q.idsToInsert=[]);n.id=o.push(n)}c[g++]=214,c[g++]=112,h1.setUint32(g,n.id),g+=4;return}else Q.set(I,{offset:g-X})}let p=I.constructor;if(p===Object)T(I);else if(p===Array)O(I);else if(p===Map)if(this.mapAsEmptyObject)c[g++]=128;else{if(f=I.size,f<16)c[g++]=128|f;else if(f<65536)c[g++]=222,c[g++]=f>>8,c[g++]=f&255;else c[g++]=223,h1.setUint32(g,f),g+=4;for(let[n,o]of I)N(n),N(o)}else{for(let n=0,o=kk.length;n<o;n++){let J0=A00[n];if(I instanceof J0){let Q0=kk[n];if(Q0.write){if(Q0.type)c[g++]=212,c[g++]=Q0.type,c[g++]=0;let s1=Q0.write.call(this,I);if(s1===I)if(Array.isArray(I))O(I);else T(I);else N(s1);return}let C0=c,T0=h1,a0=g;c=null;let v8;try{v8=Q0.pack.call(this,I,(s1)=>{if(c=C0,C0=null,g+=s1,g>t6)k(g);return{target:c,targetView:h1,position:g-s1}},N)}finally{if(C0)c=C0,h1=T0,g=a0,t6=c.length-10}if(v8){if(v8.length+g>t6)k(v8.length+g);g=gk1(v8,c,g,Q0.type)}return}}if(Array.isArray(I))O(I);else{if(I.toJSON){let n=I.toJSON();if(n!==I)return N(n)}if(v==="function")return N(this.writeFunction&&this.writeFunction(I));T(I)}}}else if(v==="boolean")c[g++]=I?195:194;else if(v==="bigint"){if(I<9223372036854776000&&I>=-9223372036854776000)c[g++]=211,h1.setBigInt64(g,I);else if(I<18446744073709552000&&I>0)c[g++]=207,h1.setBigUint64(g,I);else if(this.largeBigIntToFloat)c[g++]=203,h1.setFloat64(g,Number(I));else if(this.largeBigIntToString)return N(I.toString());else if((this.useBigIntExtension||this.moreTypes)&&I<BigInt(2)**BigInt(1023)&&I>-(BigInt(2)**BigInt(1023))){c[g++]=199,g++,c[g++]=66;let p=[],n;do{let o=I&BigInt(255);n=(o&BigInt(128))===(I<BigInt(0)?BigInt(128):BigInt(0)),p.push(o),I>>=BigInt(8)}while(!((I===BigInt(0)||I===BigInt(-1))&&n));c[g-2]=p.length;for(let o=p.length;o>0;)c[g++]=Number(p[--o]);return}else throw new RangeError(I+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string");g+=8}else if(v==="undefined")if(this.encodeUndefinedAsNil)c[g++]=192;else c[g++]=212,c[g++]=0,c[g++]=0;else throw new Error("Unknown type: "+v)},D=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?(I)=>{let v;if(this.skipValues){v=[];for(let n in I)if((typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(n))&&!this.skipValues.includes(I[n]))v.push(n)}else v=Object.keys(I);let f=v.length;if(f<16)c[g++]=128|f;else if(f<65536)c[g++]=222,c[g++]=f>>8,c[g++]=f&255;else c[g++]=223,h1.setUint32(g,f),g+=4;let p;if(this.coercibleKeyAsNumber)for(let n=0;n<f;n++){p=v[n];let o=Number(p);N(isNaN(o)?p:o),N(I[p])}else for(let n=0;n<f;n++)N(p=v[n]),N(I[p])}:(I)=>{c[g++]=222;let v=g-X;g+=2;let f=0;for(let p in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(p))N(p),N(I[p]),f++;if(f>65535)throw new Error('Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object');c[v+++X]=f>>8,c[v+X]=f&255},P=this.useRecords===!1?D:Z.progressiveRecords&&!q?(I)=>{let v,f=$.transitions||($.transitions=Object.create(null)),p=g++-X,n;for(let o in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(o)){if(v=f[o],v)f=v;else{let J0=Object.keys(I),Q0=f;f=$.transitions;let C0=0;for(let T0=0,a0=J0.length;T0<a0;T0++){let v8=J0[T0];if(v=f[v8],!v)v=f[v8]=Object.create(null),C0++;f=v}if(p+X+1==g)g--,A(f,J0,C0);else S(f,J0,p,C0);n=!0,f=Q0[o]}N(I[o])}if(!n){let o=f[H7];if(o)c[p+X]=o;else S(f,Object.keys(I),p,0)}}:(I)=>{let v,f=$.transitions||($.transitions=Object.create(null)),p=0;for(let o in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(o)){if(v=f[o],!v)v=f[o]=Object.create(null),p++;f=v}let n=f[H7];if(n)if(n>=96&&q)c[g++]=((n-=96)&31)+96,c[g++]=n>>5;else c[g++]=n;else A(f,f.__keys__||Object.keys(I),p);for(let o in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(o))N(I[o])},C=typeof this.useRecords=="function"&&this.useRecords,T=C?(I)=>{C(I)?P(I):D(I)}:P,k=(I)=>{let v;if(I>16777216){if(I-X>v00)throw new Error("Packed buffer would be larger than maximum buffer size");v=Math.min(v00,Math.round(Math.max((I-X)*(I>67108864?1.25:2),4194304)/4096)*4096)}else v=(Math.max(I-X<<2,c.length-1)>>12)+1<<12;let f=new yL(v);if(h1=f.dataView||(f.dataView=new DataView(f.buffer,0,v)),I=Math.min(I,c.length),c.copy)c.copy(f,0,X,I);else f.set(c.slice(X,I));return g-=X,X=0,t6=f.length-10,c=f},A=(I,v,f)=>{let p=$.nextId;if(!p)p=64;if(p<F&&this.shouldShareStructure&&!this.shouldShareStructure(v)){if(p=$.nextOwnId,!(p<U))p=F;$.nextOwnId=p+1}else{if(p>=U)p=F;$.nextId=p+1}let n=v.highByte=p>=96&&q?p-96>>5:-1;if(I[H7]=p,I.__keys__=v,$[p-64]=v,p<F)if(v.isShared=!0,$.sharedLength=p-63,Y=!0,n>=0)c[g++]=(p&31)+96,c[g++]=n;else c[g++]=p;else{if(n>=0)c[g++]=213,c[g++]=114,c[g++]=(p&31)+96,c[g++]=n;else c[g++]=212,c[g++]=114,c[g++]=p;if(f)L+=j*f;if(w.length>=H)w.shift()[H7]=0;w.push(I),N(v)}},S=(I,v,f,p)=>{let n=c,o=g,J0=t6,Q0=X;if(c=Qz,g=0,X=0,!c)Qz=c=new yL(8192);t6=c.length-10,A(I,v,p),Qz=c;let C0=g;if(c=n,g=o,t6=J0,X=Q0,C0>1){let T0=g+C0-1;if(T0>t6)k(T0);let a0=f+X;c.copyWithin(a0+C0,a0+1,g),c.set(Qz.slice(0,C0),a0),g=T0}else c[f+X]=Qz[0]},x=(I)=>{let v=h00(I,c,X,g,$,k,(f,p,n)=>{if(n)return Y=!0;g=p;let o=c;if(N(f),R(),o!==c)return{position:g,targetView:h1,target:c};return g},this);if(v===0)return T(I);g=v}}useBuffer(Z){c=Z,c.dataView||(c.dataView=new DataView(c.buffer,c.byteOffset,c.byteLength)),g=0}set position(Z){g=Z}get position(){return g}clearSharedData(){if(this.structures)this.structures=[];if(this.typedStructs)this.typedStructs=[]}}A00=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,fL];kk=[{pack(Z,J,X){let Y=Z.getTime()/1000;if((this.useTimestamp32||Z.getMilliseconds()===0)&&Y>=0&&Y<4294967296){let{target:$,targetView:Q,position:K}=J(6);$[K++]=214,$[K++]=255,Q.setUint32(K,Y)}else if(Y>0&&Y<4294967296){let{target:$,targetView:Q,position:K}=J(10);$[K++]=215,$[K++]=255,Q.setUint32(K,Z.getMilliseconds()*4000000+(Y/1000/4294967296>>0)),Q.setUint32(K+4,Y)}else if(isNaN(Y)){if(this.onInvalidDate)return J(0),X(this.onInvalidDate());let{target:$,targetView:Q,position:K}=J(3);$[K++]=212,$[K++]=255,$[K++]=255}else{let{target:$,targetView:Q,position:K}=J(15);$[K++]=199,$[K++]=12,$[K++]=255,Q.setUint32(K,Z.getMilliseconds()*1e6),Q.setBigInt64(K+4,BigInt(Math.floor(Y)))}}},{pack(Z,J,X){if(this.setAsEmptyObject)return J(0),X({});let Y=Array.from(Z),{target:$,position:Q}=J(this.moreTypes?3:0);if(this.moreTypes)$[Q++]=212,$[Q++]=115,$[Q++]=0;X(Y)}},{pack(Z,J,X){let{target:Y,position:$}=J(this.moreTypes?3:0);if(this.moreTypes)Y[$++]=212,Y[$++]=101,Y[$++]=0;X([Z.name,Z.message,Z.cause])}},{pack(Z,J,X){let{target:Y,position:$}=J(this.moreTypes?3:0);if(this.moreTypes)Y[$++]=212,Y[$++]=120,Y[$++]=0;X([Z.source,Z.flags])}},{pack(Z,J){if(this.moreTypes)Ck(Z,16,J);else Tk(Kz?Buffer.from(Z):new Uint8Array(Z),J)}},{pack(Z,J){let X=Z.constructor;if(X!==x00&&this.moreTypes)Ck(Z,Dk.indexOf(X.name),J);else Tk(Z,J)}},{pack(Z,J){if(this.moreTypes)Ck(Z,17,J);else Tk(Kz?Buffer.from(Z):new Uint8Array(Z),J)}},{pack(Z,J){let{target:X,position:Y}=J(1);X[Y]=193}}];function Ck(Z,J,X,Y){let $=Z.byteLength;if($+1<256){var{target:Q,position:K}=X(4+$);Q[K++]=199,Q[K++]=$+1}else if($+1<65536){var{target:Q,position:K}=X(5+$);Q[K++]=200,Q[K++]=$+1>>8,Q[K++]=$+1&255}else{var{target:Q,position:K,targetView:W}=X(7+$);Q[K++]=201,W.setUint32(K,$+1),K+=4}if(Q[K++]=116,Q[K++]=J,!Z.buffer)Z=new Uint8Array(Z);Q.set(new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength),K)}function Tk(Z,J){let X=Z.byteLength;var Y,$;if(X<256){var{target:Y,position:$}=J(X+2);Y[$++]=196,Y[$++]=X}else if(X<65536){var{target:Y,position:$}=J(X+3);Y[$++]=197,Y[$++]=X>>8,Y[$++]=X&255}else{var{target:Y,position:$,targetView:Q}=J(X+5);Y[$++]=198,Q.setUint32($,X),$+=4}Y.set(Z,$)}function gk1(Z,J,X,Y){let $=Z.length;switch($){case 1:J[X++]=212;break;case 2:J[X++]=213;break;case 4:J[X++]=214;break;case 8:J[X++]=215;break;case 16:J[X++]=216;break;default:if($<256)J[X++]=199,J[X++]=$;else if($<65536)J[X++]=200,J[X++]=$>>8,J[X++]=$&255;else J[X++]=201,J[X++]=$>>24,J[X++]=$>>16&255,J[X++]=$>>8&255,J[X++]=$&255}return J[X++]=Y,J.set(Z,X),X+=$,X}function mk1(Z,J){let X,Y=J.length*6,$=Z.length-Y;while(X=J.pop()){let{offset:Q,id:K}=X;Z.copyWithin(Q+Y,Q,$),Y-=6;let W=Q+Y;Z[W++]=214,Z[W++]=105,Z[W++]=K>>24,Z[W++]=K>>16&255,Z[W++]=K>>8&255,Z[W++]=K&255,$=Q}return Z}function S00(Z,J,X){if(e1.length>0){h1.setUint32(e1.position+Z,g+X-e1.position-Z),e1.stringsPosition=g-Z;let Y=e1;e1=null,J(Y[0]),J(Y[1])}}function f00(Z,J){return Z.isCompatible=(X)=>{let Y=!X||(J.lastNamedStructuresLength||0)===X.length;if(!Y)J._mergeStructures(X);return Y},Z}function b00(Z,J){h00=Z,f00=J}var y00=new _Y({useRecords:!1}),uk1=y00.pack,dk1=y00.pack;var ck1=512,lk1=1024,pk1=2048;var Ek=3,KK=0,Wz=2,mL=1,vk=16,m00=["num","object","string","ascii"];m00[vk]="date";var nk1=[!1,!0,!0,!1,!1,!0,!0,!1],u00;try{new Function(""),u00=!0}catch(Z){}var AY,ak1=typeof Buffer!=="undefined",uL,q7;try{uL=new TextEncoder}catch(Z){}var sk1=ak1?function(Z,J,X){return Z.utf8Write(J,X,Z.byteLength-X)}:uL&&uL.encodeInto?function(Z,J,X){return uL.encodeInto(J,Z.subarray(X)).written}:!1,rw6=Symbol("type"),tw6=Symbol("parent");b00(d00,ZE1);function d00(Z,J,X,Y,$,Q,K,W){let G=W.typedStructs||(W.typedStructs=[]),z=J.dataView,V=(G.lastStringStart||100)+Y,H=J.length-10,q=Y;if(Y>H)J=Q(Y),z=J.dataView,Y-=X,q-=X,V-=X,X=0,H=J.length-10;let F,U=V,w=G.transitions||(G.transitions=Object.create(null)),L=G.nextId||G.length,j=L<15?1:L<240?2:L<61440?3:L<15728640?4:0;if(j===0)return 0;Y+=j;let R=[],O,N=0;for(let P in Z){let C=Z[P],T=w[P];if(!T)w[P]=T={key:P,parent:w,enumerationOffset:0,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null,date64:null};if(Y>H)J=Q(Y),z=J.dataView,Y-=X,q-=X,V-=X,U-=X,X=0,H=J.length-10;switch(typeof C){case"number":let k=C;if(L<200||!T.num64){if(k>>0===k&&k<536870912&&k>-520093696){if(k<246&&k>=0&&(T.num8&&!(L>200&&T.num32)||k<32&&!T.num32))w=T.num8||k5(T,KK,1),J[Y++]=k;else w=T.num32||k5(T,KK,4),z.setUint32(Y,k,!0),Y+=4;break}else if(k<4294967296&&k>=-2147483648){if(z.setFloat32(Y,k,!0),nk1[J[Y+3]>>>5]){let I;if((I=k*SY[(J[Y+3]&127)<<1|J[Y+2]>>7])>>0===I){w=T.num32||k5(T,KK,4),Y+=4;break}}}}w=T.num64||k5(T,KK,8),z.setFloat64(Y,k,!0),Y+=8;break;case"string":let A=C.length;if(F=U-V,(A<<2)+U>H)J=Q((A<<2)+U),z=J.dataView,Y-=X,q-=X,V-=X,U-=X,X=0,H=J.length-10;if(A>65280+F>>2){R.push(P,C,Y-q);break}let S,x=U;if(A<64){let I,v,f;for(I=0;I<A;I++)if(v=C.charCodeAt(I),v<128)J[U++]=v;else if(v<2048)S=!0,J[U++]=v>>6|192,J[U++]=v&63|128;else if((v&64512)===55296&&((f=C.charCodeAt(I+1))&64512)===56320)S=!0,v=65536+((v&1023)<<10)+(f&1023),I++,J[U++]=v>>18|240,J[U++]=v>>12&63|128,J[U++]=v>>6&63|128,J[U++]=v&63|128;else S=!0,J[U++]=v>>12|224,J[U++]=v>>6&63|128,J[U++]=v&63|128}else U+=sk1(J,C,U),S=U-x>A;if(F<160||F<246&&(T.ascii8||T.string8)){if(S){if(!(w=T.string8))if(G.length>10&&(w=T.ascii8))w.__type=Wz,T.ascii8=null,T.string8=w,K(null,0,!0);else w=k5(T,Wz,1)}else if(F===0&&!O){O=!0,w=T.ascii0||k5(T,Ek,0);break}else if(!(w=T.ascii8)&&!(G.length>10&&(w=T.string8)))w=k5(T,Ek,1);J[Y++]=F}else w=T.string16||k5(T,Wz,2),z.setUint16(Y,F,!0),Y+=2;break;case"object":if(C){if(C.constructor===Date)w=T.date64||k5(T,vk,8),z.setFloat64(Y,C.getTime(),!0),Y+=8;else R.push(P,C,N);break}else if(T=g00(T,Y,z,-10),T)w=T,Y=AY;else R.push(P,C,N);break;case"boolean":w=T.num8||T.ascii8||k5(T,KK,1),J[Y++]=C?249:248;break;case"undefined":if(T=g00(T,Y,z,-9),T)w=T,Y=AY;else R.push(P,C,N);break;default:R.push(P,C,N)}N++}for(let P=0,C=R.length;P<C;){let T=R[P++],k=R[P++],A=R[P++],S=w[T];if(!S)w[T]=S={key:T,parent:w,enumerationOffset:A-N,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null};let x;if(k){let I;if(F=U-V,F<65280)if(w=S.object16,w)I=2;else if(w=S.object32)I=4;else w=k5(S,mL,2),I=2;else w=S.object32||k5(S,mL,4),I=4;if(x=K(k,U),typeof x==="object")U=x.position,z=x.targetView,J=x.target,V-=X,Y-=X,q-=X,X=0;else U=x;if(I===2)z.setUint16(Y,F,!0),Y+=2;else z.setUint32(Y,F,!0),Y+=4}else w=S.object16||k5(S,mL,2),z.setInt16(Y,k===null?-10:-9,!0),Y+=2;N++}let D=w[H7];if(D==null){D=W.typedStructs.length;let P=[],C=w,T,k;while((k=C.__type)!==void 0){let A=C.__size;C=C.__parent,T=C.key;let S=[k,A,T];if(C.enumerationOffset)S.push(C.enumerationOffset);P.push(S),C=C.parent}P.reverse(),w[H7]=D,W.typedStructs[D]=P,K(null,0,!0)}switch(j){case 1:if(D>=16)return 0;J[q]=D+32;break;case 2:if(D>=256)return 0;J[q]=56,J[q+1]=D;break;case 3:if(D>=65536)return 0;J[q]=57,z.setUint16(q+1,D,!0);break;case 4:if(D>=16777216)return 0;z.setUint32(q,(D<<8)+58,!0);break}if(Y<V){if(V===U)return Y;J.copyWithin(Y,V,U),U+=Y-V,G.lastStringStart=Y-q}else if(Y>V){if(V===U)return Y;return G.lastStringStart=Y-q,d00(Z,J,X,q,$,Q,K,W)}return U}function g00(Z,J,X,Y){let $;if($=Z.ascii8||Z.num8)return X.setInt8(J,Y,!0),AY=J+1,$;if($=Z.string16||Z.object16)return X.setInt16(J,Y,!0),AY=J+2,$;if($=Z.num32)return X.setUint32(J,3758096640+Y,!0),AY=J+4,$;if($=Z.num64)return X.setFloat64(J,NaN,!0),X.setInt8(J,Y),AY=J+8,$;AY=J;return}function k5(Z,J,X){let Y=m00[J]+(X<<3),$=Z[Y]||(Z[Y]=Object.create(null));return $.__type=J,$.__size=X,$.__parent=Z,$}function ok1(Z){if(!(Z instanceof Map))return Z;let J=Z.get("typed")||[];if(Object.isFrozen(J))J=J.map(($)=>$.slice(0));let X=Z.get("named"),Y=Object.create(null);for(let $=0,Q=J.length;$<Q;$++){let K=J[$],W=Y;for(let[G,z,V]of K){let H=W[V];if(!H)W[V]=H={key:V,parent:W,enumerationOffset:0,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null,date64:null};W=k5(H,G,z)}W[H7]=$}return J.transitions=Y,this.typedStructs=J,this.lastTypedStructuresLength=J.length,X}var Ik=Symbol.for("source");function rk1(Z,J,X,Y){let $=Z[J++]-32;if($>=24)switch($){case 24:$=Z[J++];break;case 25:$=Z[J++]+(Z[J++]<<8);break;case 26:$=Z[J++]+(Z[J++]<<8)+(Z[J++]<<16);break;case 27:$=Z[J++]+(Z[J++]<<8)+(Z[J++]<<16)+(Z[J++]<<24);break}let Q=Y.typedStructs&&Y.typedStructs[$];if(!Q){if(Z=Uint8Array.prototype.slice.call(Z,J,X),X-=J,J=0,!Y.getStructures)throw new Error(`Reference to shared structure ${$} without getStructures method`);if(Y._mergeStructures(Y.getStructures()),!Y.typedStructs)throw new Error("Could not find any shared typed structures");if(Y.lastTypedStructuresLength=Y.typedStructs.length,Q=Y.typedStructs[$],!Q)throw new Error("Could not find typed structure "+$)}var{construct:K,fullConstruct:W}=Q;if(!K){K=Q.construct=function F(){},W=Q.fullConstruct=function F(){},W.prototype=Y.structPrototype??{};var G=K.prototype=Y.structPrototype?Object.create(Y.structPrototype):{};let V=[],H=0,q;for(let F=0,U=Q.length;F<U;F++){let w=Q[F],[L,j,R,O]=w;if(R==="__proto__")R="__proto_";let N={key:R,offset:H};if(O)V.splice(F+O,0,N);else V.push(N);let D;switch(j){case 0:D=()=>0;break;case 1:D=(C,T)=>{let k=C.bytes[T+N.offset];return k>=246?QK(k):k};break;case 2:D=(C,T)=>{let k=C.bytes,S=(k.dataView||(k.dataView=new DataView(k.buffer,k.byteOffset,k.byteLength))).getUint16(T+N.offset,!0);return S>=65280?QK(S&255):S};break;case 4:D=(C,T)=>{let k=C.bytes,S=(k.dataView||(k.dataView=new DataView(k.buffer,k.byteOffset,k.byteLength))).getUint32(T+N.offset,!0);return S>=4294967040?QK(S&255):S};break}N.getRef=D,H+=j;let P;switch(L){case Ek:if(q&&!q.next)q.next=N;q=N,N.multiGetCount=0,P=function(C){let{bytes:T,position:k}=C,A=H+k,S=D(C,k);if(typeof S!=="number")return S;let x,I=N.next;while(I){if(x=I.getRef(C,k),typeof x==="number")break;else x=null;I=I.next}if(x==null)x=C.bytesEnd-A;if(C.srcString)return C.srcString.slice(S,x);return D00(T,S+A,x-S)};break;case Wz:case mL:if(q&&!q.next)q.next=N;q=N,P=function(C){let T=C.position,k=H+T,A=D(C,T);if(typeof A!=="number")return A;let S=C.bytes,x,I=N.next;while(I){if(x=I.getRef(C,T),typeof x==="number")break;else x=null;I=I.next}if(x==null)x=C.bytesEnd-k;if(L===Wz)return S.toString("utf8",A+k,x+k);else{q7=C;try{return Y.unpack(S,{start:A+k,end:x+k})}finally{q7=null}}};break;case KK:switch(j){case 4:P=function(C){let T=C.bytes,k=T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength)),A=C.position+N.offset,S=k.getInt32(A,!0);if(S<536870912){if(S>-520093696)return S;if(S>-536870912)return QK(S&255)}let x=k.getFloat32(A,!0),I=SY[(T[A+3]&127)<<1|T[A+2]>>7];return(I*x+(x>0?0.5:-0.5)>>0)/I};break;case 8:P=function(C){let T=C.bytes,A=(T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength))).getFloat64(C.position+N.offset,!0);if(isNaN(A)){let S=T[C.position+N.offset];if(S>=246)return QK(S)}return A};break;case 1:P=function(C){let k=C.bytes[C.position+N.offset];return k<246?k:QK(k)};break}break;case vk:P=function(C){let T=C.bytes,k=T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength));return new Date(k.getFloat64(C.position+N.offset,!0))};break}N.get=P}if(u00){let F=[],U=[],w=0,L;for(let R of V){if(Y.alwaysLazyProperty&&Y.alwaysLazyProperty(R.key)){L=!0;continue}Object.defineProperty(G,R.key,{get:tk1(R.get),enumerable:!0});let O="v"+w++;U.push(O),F.push("o["+JSON.stringify(R.key)+"]="+O+"(s)")}if(L)F.push("__proto__:this");let j=new Function(...U,"var c=this;return function(s){var o=new c();"+F.join(";")+";return o;}").apply(W,V.map((R)=>R.get));Object.defineProperty(G,"toJSON",{value(R){return j.call(this,this[Ik])}})}else Object.defineProperty(G,"toJSON",{value(F){let U={};for(let w=0,L=V.length;w<L;w++){let j=V[w].key;U[j]=this[j]}return U}})}var z=new K;return z[Ik]={bytes:Z,position:J,srcString:"",bytesEnd:X},z}function QK(Z){switch(Z){case 246:return null;case 247:return;case 248:return!1;case 249:return!0}throw new Error("Unknown constant")}function tk1(Z){return function(){return Z(this[Ik])}}function ek1(){if(q7)q7.bytes=Uint8Array.prototype.slice.call(q7.bytes,q7.position,q7.bytesEnd),q7.position=0,q7.bytesEnd=q7.bytes.length}function ZE1(Z,J){if(J.typedStructs){let Y=new Map;Y.set("named",Z),Y.set("typed",J.typedStructs),Z=Y}let X=J.lastTypedStructuresLength||0;return Z.isCompatible=(Y)=>{let $=!0;if(Y instanceof Map){if((Y.get("named")||[]).length!==(J.lastNamedStructuresLength||0))$=!1;if((Y.get("typed")||[]).length!==X)$=!1}else if(Y instanceof Array||Array.isArray(Y)){if(Y.length!==(J.lastNamedStructuresLength||0))$=!1}if(!$)J._mergeStructures(Y);return $},J.lastTypedStructuresLength=J.typedStructs&&J.typedStructs.length,Z}I00(rk1,ok1,ek1);var YE1=process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED!==void 0&&process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED.toLowerCase()==="true";if(!YE1){let Z;try{if(Z=u("msgpackr-extract"),Z)P00(Z.extractStrings)}catch(J){}}import{WebSocketServer as Dm1}from"ws";import Cm1 from"mediasoup";var sw=t(NZ0(),1);import Mm1 from"http";import Rm1 from"https";import aw from"fs";import Nm1 from"path";import Pm1 from"url";var nZ0=t(pZ0(),1);import oY from"fs";import iZ0 from"path";var WV="./dev/persistence";class M7{static instance=new M7;gameId=process.env.HYTOPIA_GAME_ID;lobbyId=process.env.HYTOPIA_LOBBY_ID;_creativeGateway;constructor(){try{this._creativeGateway=new nZ0.CreativeGateway}catch{console.warn(["\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501","\uD83D\uDEA8 HYTOPIA PLATFORM GATEWAY IS NOT INITIALIZED \uD83D\uDEA8","","\uD83D\uDD27 Local development is still possible, but these features will be disabled:"," \u2022 \uD83D\uDC64 Player Accounts"," \u2022 \uD83C\uDFAD Player Cosmetics"," \u2022 \uD83D\uDC1B Crash Analytics & Debug Logs","","\uD83D\uDCA1 These features will be enabled but modified:"," \u2022 \uD83D\uDCBE Player & Global Persisted Data - Data will be persisted"," locally in the ./dev/persistence directory of your project."," Player ids for data persistence will begin at 1 for the first "," player to join your local server, and increments for each"," additional player. This means that if you restart your"," server, the first player id will be 1 again. This is to ensure"," that data persistence across server restarts can be easily"," tested and debugged in local development.","","To enable the HYTOPIA Platform Gateway locally:"," 1. Set these environment variables:"," HYTOPIA_API_KEY, HYTOPIA_GAME_ID, HYTOPIA_LOBBY_ID"," 2. You can find these values at: https://create.hytopia.com","","Note: In production, these environment variables will be auto-populated ","& the HYTOPIA Platform Gateway will automatically be initialized \uD83D\uDE80","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",""].join(`
407
407
  `))}}get isGatewayAvailable(){return!!this._creativeGateway}async getData(Z){if(!this._creativeGateway&&process.env.NODE_ENV==="production")return m.warning("PlatformGateway.getData(): You are running in production mode, but the Platform Gateway is not initialized! No data will be returned.");return this._creativeGateway?await this._creativeGateway.kv.get(Z):this._readDevDataLocally(Z)}async getPlayerLoadout(Z){if(!this._creativeGateway)return;return await this._creativeGateway.getLoadout(Z)}async getPlayerSession(Z){if(!this._creativeGateway)return;return await this._creativeGateway.getSession(Z)}async setData(Z,J){if(J.error)return m.warning("PlatformGateway.setData(): Cannot set data with an error property.");if(!this._creativeGateway&&process.env.NODE_ENV==="production")return m.warning("PlatformGateway.setData(): You are running in production mode, but the Platform Gateway is not initialized! No data will be set.");return this._creativeGateway?await this._creativeGateway.kv.set(Z,J):this._writeDevDataLocally(Z,J)}_readDevDataLocally(Z){try{if(!oY.existsSync(WV))return;let J=iZ0.join(WV,`${Z}.json`);return JSON.parse(oY.readFileSync(J,"utf8"))}catch(J){m.warning(`PlatformGateway._readDevDataLocally(): Failed to read data for key "${Z}": ${J}`)}}_writeDevDataLocally(Z,J){try{if(!oY.existsSync(WV))oY.mkdirSync(WV,{recursive:!0});let X=iZ0.join(WV,`${Z}.json`),Y={};if(oY.existsSync(X))Y=JSON.parse(oY.readFileSync(X,"utf8"));let $={...Y,...J};oY.writeFileSync(X,JSON.stringify($,null,2),"utf8")}catch(X){m.warning(`PlatformGateway._writeDevDataLocally(): Failed to write data for key "${Z}": ${X}`)}}}var aZ0=`-----BEGIN CERTIFICATE-----
408
408
  MIIDRjCCAi6gAwIBAgIFOTEzNTIwDQYJKoZIhvcNAQELBQAwWDEQMA4GA1UEAxMH
409
409
  SFlUT1BJQTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNV
@@ -449,7 +449,7 @@ qYGMwU/HBVHkLAn5XvT2a9xM0mzZ558d+ahbw8qAgRxg7BZ+2PW/bf7F2WRBUk1f
449
449
  xauhAoGBALEspoxQozwohGQnP7EMF0/0JoKNpdNv0b0qCVvNiMo0+N297lI2mFQp
450
450
  6xYlW/1l9afLokklF/J2IsyBrTCZoY7SaEk/lMMrQSyra+y0z71ogZ8A4ny9fxsj
451
451
  0dDYJZGllL+3E/MQfd7k+KnOM/+A+cPoAnci76+L3vdkUb2P8SJk
452
- -----END RSA PRIVATE KEY-----`;var uI=process.env.PORT??8080,dI="0.6.5",cI;(($)=>{$.READY="WEBSERVER.READY";$.STOPPED="WEBSERVER.STOPPED";$.ERROR="WEBSERVER.ERROR";$.UPGRADE="WEBSERVER.UPGRADE"})(cI||={});class yK extends g0{static instance=new yK;_webserver=sw.default();_internalHttpServer;constructor(){super();this._webserver.use((Z,J,X)=>{J.header("Access-Control-Allow-Origin","*"),X()}),this._webserver.get("/",(Z,J)=>{J.json({status:"OK",version:dI,runtime:typeof Bun!=="undefined"?"bun":"node"})}),this._webserver.use(sw.default.static("assets"));try{this._webserver.use(sw.default.static(Nm1.dirname(u.resolve("@hytopia.com/assets"))))}catch{}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?Mm1.createServer(this._webserver):Rm1.createServer({key:aw.existsSync("assets/certs/localhost.key")?aw.readFileSync("assets/certs/localhost.key"):sZ0,cert:aw.existsSync("assets/certs/localhost.crt")?aw.readFileSync("assets/certs/localhost.crt"):aZ0},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else m.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(uI,this._onStarted),console.info(`WebServer.start(): Server running on port ${uI}.`)}stop(){if(this._internalHttpServer)return new Promise((Z,J)=>{this._internalHttpServer.close((X)=>{if(X)J(X);else Z(!0)})});else return m.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(Z,J,X)=>{let Y=Pm1.parse(Z.url??"",!0).query,$=Y.connectionId?.toString()??void 0,Q=Y.sessionToken?.toString()??"",K=await M7.instance.getPlayerSession(Q);if($)Z.connectionId=$;if(K)if(!K.error)Z.session=K;else{let W=`${K.error.code}: ${K.error.message}`;J.write(`HTTP/1.1 401 Unauthorized\r
452
+ -----END RSA PRIVATE KEY-----`;var uI=process.env.PORT??8080,dI="0.6.6",cI;(($)=>{$.READY="WEBSERVER.READY";$.STOPPED="WEBSERVER.STOPPED";$.ERROR="WEBSERVER.ERROR";$.UPGRADE="WEBSERVER.UPGRADE"})(cI||={});class yK extends g0{static instance=new yK;_webserver=sw.default();_internalHttpServer;constructor(){super();this._webserver.use((Z,J,X)=>{J.header("Access-Control-Allow-Origin","*"),X()}),this._webserver.get("/",(Z,J)=>{J.json({status:"OK",version:dI,runtime:typeof Bun!=="undefined"?"bun":"node"})}),this._webserver.use(sw.default.static("assets"));try{this._webserver.use(sw.default.static(Nm1.dirname(u.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js"))))}catch{}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?Mm1.createServer(this._webserver):Rm1.createServer({key:aw.existsSync("assets/certs/localhost.key")?aw.readFileSync("assets/certs/localhost.key"):sZ0,cert:aw.existsSync("assets/certs/localhost.crt")?aw.readFileSync("assets/certs/localhost.crt"):aZ0},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else m.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(uI,this._onStarted),console.info(`WebServer.start(): Server running on port ${uI}.`)}stop(){if(this._internalHttpServer)return new Promise((Z,J)=>{this._internalHttpServer.close((X)=>{if(X)J(X);else Z(!0)})});else return m.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(Z,J,X)=>{let Y=Pm1.parse(Z.url??"",!0).query,$=Y.connectionId?.toString()??void 0,Q=Y.sessionToken?.toString()??"",K=await M7.instance.getPlayerSession(Q);if($)Z.connectionId=$;if(K)if(!K.error)Z.session=K;else{let W=`${K.error.code}: ${K.error.message}`;J.write(`HTTP/1.1 401 Unauthorized\r
453
453
  `),J.write(`Content-Type: text/plain\r
454
454
  `),J.write(`Content-Length: ${W.length}\r
455
455
  `),J.write(`Connection: close\r
@@ -480,6 +480,6 @@ Event: ${uJ(Z)}`),!0}return!1}function Zd1(Z,J){if(!J?.length)return!1;return CB
480
480
  `),U=F.shift();if(!U)return Z.destroy(),X(new Error("No header received from proxy CONNECT response"));let w=U.split(" "),L=+(w[1]||0),j=w.slice(2).join(" "),R={};for(let O of F){if(!O)continue;let N=O.indexOf(":");if(N===-1)return Z.destroy(),X(new Error(`Invalid header from proxy CONNECT response: "${O}"`));let D=O.slice(0,N).toLowerCase(),P=O.slice(N+1).trimStart(),C=R[D];if(typeof C==="string")R[D]=[C,P];else if(Array.isArray(C))C.push(P);else R[D]=P}QM("got proxy server response: %o %o",U,R),K(),J({connect:{statusCode:L,statusText:j,headers:R},buffered:H})}Z.on("error",G),Z.on("end",W),Q()})}function Jq(...Z){l.log("[https-proxy-agent]",...Z)}class KM extends nh{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??{},Jq("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let X=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),Y=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...J?ZJ1(J,"headers"):null,host:X,port:Y}}async connect(Z,J){let{proxy:X}=this;if(!J.host)throw new TypeError('No "host" provided');let Y;if(X.protocol==="https:"){Jq("Creating `tls.Socket`: %o",this.connectOpts);let H=this.connectOpts.servername||this.connectOpts.host;Y=ah.connect({...this.connectOpts,servername:H&&aZ.isIP(H)?void 0:H})}else Jq("Creating `net.Socket`: %o",this.connectOpts),Y=aZ.connect(this.connectOpts);let $=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},Q=aZ.isIPv6(J.host)?`[${J.host}]`:J.host,K=`CONNECT ${Q}:${J.port} HTTP/1.1\r
481
481
  `;if(X.username||X.password){let H=`${decodeURIComponent(X.username)}:${decodeURIComponent(X.password)}`;$["Proxy-Authorization"]=`Basic ${Buffer.from(H).toString("base64")}`}if($.Host=`${Q}:${J.port}`,!$["Proxy-Connection"])$["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let H of Object.keys($))K+=`${H}: ${$[H]}\r
482
482
  `;let W=eZ1(Y);Y.write(`${K}\r
483
- `);let{connect:G,buffered:z}=await W;if(Z.emit("proxyConnect",G),this.emit("proxyConnect",G,Z),G.statusCode===200){if(Z.once("socket",i06),J.secureEndpoint){Jq("Upgrading socket connection to TLS");let H=J.servername||J.host;return ah.connect({...ZJ1(J,"host","path","port"),socket:Y,servername:aZ.isIP(H)?void 0:H})}return Y}Y.destroy();let V=new aZ.Socket({writable:!1});return V.readable=!0,Z.once("socket",(H)=>{Jq("Replaying proxy buffer for failed request"),H.push(z),H.push(null)}),V}}KM.__initStatic();function i06(Z){Z.resume()}function ZJ1(Z,...J){let X={},Y;for(Y in Z)if(!J.includes(Y))X[Y]=Z[Y];return X}var r06=32768;function t06(Z){return new s06({read(){this.push(Z),this.push(null)}})}function JJ1(Z){let J;try{J=new URL(Z.url)}catch(G){return C8(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),CV(Z,()=>Promise.resolve({}))}let X=J.protocol==="https:",Y=e06(J,Z.proxy||(X?process.env.https_proxy:void 0)||process.env.http_proxy),$=X?a06:n06,Q=Z.keepAlive===void 0?!1:Z.keepAlive,K=Y?new KM(Y):new $.Agent({keepAlive:Q,maxSockets:30,timeout:2000}),W=Z16(Z,Z.httpModule??$,K);return CV(Z,W)}function e06(Z,J){let{no_proxy:X}=process.env;if(X?.split(",").some(($)=>Z.host.endsWith($)||Z.hostname.endsWith($)))return;else return J}function Z16(Z,J,X){let{hostname:Y,pathname:$,port:Q,protocol:K,search:W}=new URL(Z.url);return function G(z){return new Promise((V,H)=>{wB(()=>{let q=t06(z.body),F={...Z.headers};if(z.body.length>r06)F["content-encoding"]="gzip",q=q.pipe(o06());let U=J.request({method:"POST",agent:X,headers:F,hostname:Y,path:`${$}${W}`,port:Q,protocol:K,ca:Z.caCerts},(w)=>{w.on("data",()=>{}),w.on("end",()=>{}),w.setEncoding("utf8");let L=w.headers["retry-after"]??null,j=w.headers["x-sentry-rate-limits"]??null;V({statusCode:w.statusCode,headers:{"retry-after":L,"x-sentry-rate-limits":Array.isArray(j)?j[0]||null:j}})});U.on("error",H),q.pipe(U)})})}}var J16=new Set(["false","f","n","no","off","0"]),X16=new Set(["true","t","y","yes","on","1"]);function WM(Z,J){let X=String(Z).toLowerCase();if(J16.has(X))return!1;if(X16.has(X))return!0;return J?.strict?null:Boolean(Z)}import{posix as Y16,sep as $16}from"path";function XJ1(Z){return Z.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function YJ1(Z=process.argv[1]?gv(process.argv[1]):process.cwd(),J=$16==="\\"){let X=J?XJ1(Z):Z;return(Y)=>{if(!Y)return;let $=J?XJ1(Y):Y,{dir:Q,base:K,ext:W}=Y16.parse($);if(W===".js"||W===".mjs"||W===".cjs")K=K.slice(0,W.length*-1);let G=decodeURIComponent(K);if(!Q)Q=".";let z=Q.lastIndexOf("/node_modules");if(z>-1)return`${Q.slice(z+14).replace(/\//g,".")}:${G}`;if(Q.startsWith(X)){let V=Q.slice(X.length+1).replace(/\//g,".");return V?`${V}:${G}`:G}return G}}function $J1(Z){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(I0.SENTRY_RELEASE?.id)return I0.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,X=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,Y=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return J||X||Y||Z}var QJ1=zB(mv(YJ1()));var WJ1=t(Z0(),1);import*as KJ1 from"os";import{threadId as Q16,isMainThread as K16}from"worker_threads";var W16=60000;class sh extends kB{constructor(Z){let J=Z.serverName||global.process.env.SENTRY_NAME||KJ1.hostname(),X={...Z,platform:"node",runtime:{name:"node",version:global.process.version},serverName:J};if(Z.openTelemetryInstrumentations)MW({instrumentations:Z.openTelemetryInstrumentations});hv(X,"node"),l.log(`Initializing Sentry: process: ${process.pid}, thread: ${K16?"main":`worker-${Q16}`}.`);super(X);if(this.getOptions()._experiments?.enableLogs){if(this._logOnExitFlushListener=()=>{K$(this)},J)this.on("beforeCaptureLog",(Y)=>{Y.attributes={...Y.attributes,"server.address":J}});process.on("beforeExit",this._logOnExitFlushListener)}}get tracer(){if(this._tracer)return this._tracer;let Z="@sentry/node",J=h8,X=WJ1.trace.getTracer(Z,J);return this._tracer=X,X}async flush(Z){let X=this.traceProvider?.activeSpanProcessor;if(X)await X.forceFlush();if(this.getOptions().sendClientReports)this._flushOutcomes();return super.flush(Z)}close(Z){if(this._clientReportInterval)clearInterval(this._clientReportInterval);if(this._clientReportOnExitFlushListener)process.off("beforeExit",this._clientReportOnExitFlushListener);if(this._logOnExitFlushListener)process.off("beforeExit",this._logOnExitFlushListener);return super.close(Z)}startClientReportTracking(){let Z=this.getOptions();if(Z.sendClientReports)this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{m0&&l.log("Flushing client reports based on interval."),this._flushOutcomes()},Z.clientReportFlushInterval??W16).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener)}_getTraceInfoFromScope(Z){if(!Z)return[void 0,void 0];return nt0(this,Z)}}var m4=t(Z0(),1);var sW=t(A1(),1);var GJ1=t(bj(),1);import G16 from"module";var oh=1e6;function zJ1(Z,J={}){if(Z.getOptions().debug)H16();let X=z16(Z,J);Z.traceProvider=X}function VJ1(){let[Z=0,J=0]=process.versions.node.split(".").map(Number);if(Z>=21||Z===20&&J>=6||Z===18&&J>=19){if(!I0._sentryEsmLoaderHookRegistered)try{let{addHookMessagePort:X}=GJ1.createAddHookMessageChannel();G16.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:X,include:[]},transferList:[X]})}catch(X){l.warn("Failed to register ESM hook",X)}}else C8(()=>{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 z16(Z,J={}){let X=new Xx({sampler:new Nx(Z),resource:new vW({[sW.ATTR_SERVICE_NAME]:"node",[sW.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[sW.ATTR_SERVICE_VERSION]:h8}),forceFlushTimeoutMillis:500,spanProcessors:[new Rx({timeout:V16(Z.getOptions().maxSpanWaitDuration)}),...J.spanProcessors||[]]});return m4.trace.setGlobalTracerProvider(X),m4.propagation.setGlobalPropagator(new wx),m4.context.setGlobalContextManager(new oZ1),X}function V16(Z){if(Z==null)return;if(Z>oh)return m0&&l.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${oh}`),oh;else if(Z<=0||Number.isNaN(Z)){m0&&l.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return Z}function H16(){let Z=new Proxy(l,{get(J,X,Y){return Reflect.get(J,X==="verbose"?"debug":X,Y)}});m4.diag.disable(),m4.diag.setLogger(Z,m4.DiagLogLevel.DEBUG)}function q16(){return bW()?[ne0()]:[]}function HJ1(){return[SB(),IB(),_B(),AB(),xB(),Ke0(),ke0(),ae0(),se0(),fe0(),le0(),ve0(),fZ1(),rZ1(),...q16()]}function qJ1(Z){return[...HJ1(),...X9(Z)?tZ1():[]]}function rh(Z={}){return F16(Z,qJ1)}function F16(Z={},J){let X=U16(Z,J);if(X.debug===!0)if(m0)l.enable();else C8(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")});if(!bW()&&X.registerEsmLoaderHooks!==!1)VJ1();if(st0(),O1().update(X.initialScope),X.spotlight&&!X.integrations.some(({name:Q})=>Q===gh))X.integrations.push(E71({sidecarUrl:typeof X.spotlight==="string"?X.spotlight:void 0}));let $=new sh(X);if(O1().setClient($),$.init(),l.log(`Running in ${bW()?"CommonJS":"ESM"} mode.`),$.startClientReportTracking(),B16(),!X.skipOpenTelemetrySetup)zJ1($,{spanProcessors:X.openTelemetrySpanProcessors}),FJ1();return yt0($),at0($),$}function FJ1(){if(!m0)return;let Z=dt0(),J=["SentryContextManager","SentryPropagator"];if(X9())J.push("SentrySpanProcessor");for(let X of J)if(!Z.includes(X))l.error(`You have to set up the ${X}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);if(!Z.includes("SentrySampler"))l.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function U16(Z,J){let X=L16(Z.release),Y=Z.spotlight??WM(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,$=w16(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??JJ1,stackParser:Vv(Z.stackParser||QJ1),release:X,tracesSampleRate:$,spotlight:Y,debug:WM(Z.debug??process.env.SENTRY_DEBUG)},K=Z.integrations,W=Z.defaultIntegrations??J(Q);return{...Q,integrations:kv({defaultIntegrations:W,integrations:K})}}function L16(Z){if(Z!==void 0)return Z;let J=$J1();if(J!==void 0)return J;return}function w16(Z){if(Z!==void 0)return Z;let J=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!J)return;let X=parseFloat(J);return isFinite(X)?X:void 0}function B16(){if(WM(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let Z=process.env.SENTRY_TRACE,J=process.env.SENTRY_BAGGAGE,X=UV(Z,J);O1().setPropagationContext(X)}}if(process.env.NODE_ENV==="production"&&process.env.SENTRY_DSN)rh({dsn:process.env.SENTRY_DSN,release:dI,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=Q8.getProcessStats(),Z},beforeSendTransaction:(Z)=>{if(Z.contexts?.trace?.op==="ticker_tick"){let X=Z?.start_timestamp,Y=Z?.timestamp;if(!X||!Y)return null;if((Y-X)*1000>30)return Z.measurements=Q8.getProcessStats(!0),Z}return null}}),console.log("Telemetry: Sentry.io initialized!");class Q8{static getProcessStats(Z=!1){let J=process.memoryUsage(),X={jsHeapSizeMb:{value:J.heapUsed/1024/1024,unit:"megabyte"},jsHeapCapacityMb:{value:J.heapTotal/1024/1024,unit:"megabyte"},jsHeapUsagePercent:{value:J.heapUsed/J.heapTotal,unit:"percent"},processHeapSizeMb:{value:J.heapUsed/1024/1024,unit:"megabyte"},rssSizeMb:{value:J.rss/1024/1024,unit:"megabyte"}};if(Z)return X;return Object.fromEntries(Object.entries(X).map(([Y,$])=>[Y,$.value]))}static startSpan(Z,J){if(PB())return LB({attributes:Z.attributes,name:Z.operation,op:Z.operation},J);else return J()}}var UJ1=new _Y,M16=5000;class rY extends g0{static _cachedPacketsSerializedBuffer=new Map;_closeTimeout=null;_wrtcDirectTransport=null;_wrtcClientServerTransport=null;_wrtcClientServerDataProducers=[];_wrtcClientServerDataConsumers=[];_wrtcServerClientTransport=null;_wrtcServerClientReliableDataProducer=null;_wrtcServerClientUnreliableDataProducer=null;_wrtcServerClientDataConsumers=[];_ws;id;constructor(Z,J){super();this.id=G00(),this.onPacket(X0.PacketId.CONNECTION,this._onConnectionPacket),this.onPacket(X0.PacketId.HEARTBEAT,this._onHeartbeatPacket),this.bindWs(Z),q6.emit("CONNECTION.OPENED",{connection:this,req:J})}static serializePackets(Z){for(let X of Z)if(!X0.isValidPacket(X))return m.error(`Connection.serializePackets(): Invalid packet payload: ${JSON.stringify(X)}`);let J=rY._cachedPacketsSerializedBuffer.get(Z);if(J)return J;return Q8.startSpan({operation:"serialize_packets",attributes:{packets:Z.length,packetIds:Z.map((X)=>X[0]).join(",")}},(X)=>{let Y=Q8.startSpan({operation:"serialize_packets_encode"},()=>UJ1.pack(Z));return X?.setAttribute("serializedBytes",Y.byteLength),rY._cachedPacketsSerializedBuffer.set(Z,Y),Y})}bindWs(Z){let J=this._closeTimeout!==null;if(J)clearTimeout(this._closeTimeout),this._closeTimeout=null;if(this._ws=Z,this._ws.binaryType="nodebuffer",this._ws.onmessage=(X)=>this._onMessage(X.data),this._ws.onclose=this._onWsClose,this._ws.onerror=this._onWsError,this.send([X0.createPacket(X0.bidirectionalPackets.connectionPacketDefinition,{i:this.id})],!0,!0),J)this.emitWithGlobal("CONNECTION.RECONNECTED",{connection:this});if(bJ.instance.isWrtcEnabled)this._upgradeToWRTC()}closeWrtc(){this._closeWrtcClientServerTransport(),this._closeWrtcServerClientTransport()}disconnect(){try{this._ws.close()}catch(Z){m.error(`Connection.disconnect(): Connection disconnect failed. Error: ${Z}`)}}onPacket(Z,J){this.on("CONNECTION.PACKET_RECEIVED",({packet:X})=>{if(X[0]===Z)J(X)})}send(Z,J=!0,X=!1){if(this._closeTimeout)return;if(this._ws.readyState!==O16.OPEN)return;Q8.startSpan({operation:"send_packets",attributes:{forceWs:X?"true":"false",wrtcConnected:this._wrtcServerClientTransport?.iceState==="completed"?"true":"false"}},()=>{try{let Y=rY.serializePackets(Z);if(!Y)return;if(this._wrtcServerClientTransport?.iceState==="completed"&&Y.length<(this._wrtcServerClientTransport?.sctpParameters?.maxMessageSize??0)&&!X)try{(J?this._wrtcServerClientReliableDataProducer:this._wrtcServerClientUnreliableDataProducer).send(Y)}catch{this._ws.send(Y)}else this._ws.send(Y);this.emitWithGlobal("CONNECTION.PACKETS_SENT",{connection:this,packets:Z})}catch(Y){m.error(`Connection.send(): Packet send failed. Error: ${Y}`)}})}_closeWrtcClientServerTransport(){this._wrtcDirectTransport?.close(),this._wrtcDirectTransport=null,this._wrtcClientServerTransport?.close(),this._wrtcClientServerTransport=null,this._wrtcClientServerDataProducers.forEach((Z)=>Z.close()),this._wrtcClientServerDataProducers=[],this._wrtcClientServerDataConsumers.forEach((Z)=>Z.close()),this._wrtcClientServerDataConsumers=[]}_closeWrtcServerClientTransport(){this._wrtcServerClientTransport?.close(),this._wrtcServerClientTransport=null,this._wrtcServerClientDataConsumers.forEach((Z)=>Z.close()),this._wrtcServerClientDataConsumers=[],this._wrtcServerClientReliableDataProducer?.close(),this._wrtcServerClientReliableDataProducer=null,this._wrtcServerClientUnreliableDataProducer?.close(),this._wrtcServerClientUnreliableDataProducer=null}_onConnectionPacket=async(Z)=>{let J=Z[1],X=J.c,Y=J.d;if(X){let{i:$,d:Q}=X,K=!1;if($==this._wrtcClientServerTransport?.id)await this._wrtcClientServerTransport.connect({dtlsParameters:Q}),K=!0;if($==this._wrtcServerClientTransport?.id)await this._wrtcServerClientTransport.connect({dtlsParameters:Q}),K=!0;if(K)this.send([X0.createPacket(X0.bidirectionalPackets.connectionPacketDefinition,{ca:{i:$}})])}if(Y)for(let $ of Y){let{s:Q,l:K}=$,W=await this._wrtcClientServerTransport.produceData({label:K,sctpStreamParameters:Q}),G=await this._wrtcDirectTransport.consumeData({dataProducerId:W.id});this._wrtcClientServerDataProducers.push(W),this._wrtcClientServerDataConsumers.push(G),G.on("message",(z)=>this._onMessage(z)),this.send([X0.createPacket(X0.bidirectionalPackets.connectionPacketDefinition,{pa:{i:W.id,l:K}})])}};_onHeartbeatPacket=()=>{this.send([X0.createPacket(X0.bidirectionalPackets.heartbeatPacketDefinition,null)],!0,!0)};_onMessage=(Z)=>{try{let J=this._deserialize(Z);if(!J)return;this.emitWithGlobal("CONNECTION.PACKET_RECEIVED",{connection:this,packet:J})}catch(J){m.error(`Connection._ws.onmessage(): Error: ${J}`)}};_onWrtcIceStateChange=(Z,J)=>{if(["disconnected","closed"].includes(J)){if(Z==this._wrtcClientServerTransport)this._closeWrtcClientServerTransport();else if(Z==this._wrtcServerClientTransport)this._closeWrtcServerClientTransport()}};_onWsClose=()=>{this.closeWrtc(),this.emitWithGlobal("CONNECTION.DISCONNECTED",{connection:this}),this._closeTimeout=setTimeout(()=>{this.emitWithGlobal("CONNECTION.CLOSED",{connection:this}),this.offAll()},M16)};_onWsError=(Z)=>{this.emitWithGlobal("CONNECTION.ERROR",{connection:this,error:Z})};_upgradeToWRTC=async()=>{let Z=await bJ.instance.createWrtcTransports();if(!Z)return!1;let{directTransport:J,clientServerTransport:X,serverClientTransport:Y}=Z;this._wrtcDirectTransport=J,this._wrtcClientServerTransport=X,this._wrtcClientServerTransport.on("icestatechange",(K)=>{this._onWrtcIceStateChange(this._wrtcClientServerTransport,K)}),this._wrtcServerClientTransport=Y,this._wrtcServerClientTransport.on("icestatechange",(K)=>{this._onWrtcIceStateChange(this._wrtcServerClientTransport,K)}),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 $=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientReliableDataProducer.id}),Q=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientUnreliableDataProducer.id});return this._wrtcServerClientDataConsumers.push($,Q),this.send([X0.createPacket(X0.bidirectionalPackets.connectionPacketDefinition,{d:[{i:$.id,pi:$.dataProducerId,l:"scr",s:$.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=UJ1.unpack(Z);if(!J||typeof J!=="object"||typeof J[0]!=="number")return m.error(`Connection._deserialize(): Invalid packet format. Packet: ${JSON.stringify(J)}`);if(!X0.isValidPacket(J))return m.error(`Connection._deserialize(): Invalid packet payload. Packet: ${JSON.stringify(J)}`);return J}}var LJ1;((Y)=>{Y.PLAYER_CONNECTED="PLAYER_MANAGER.PLAYER_CONNECTED";Y.PLAYER_DISCONNECTED="PLAYER_MANAGER.PLAYER_DISCONNECTED";Y.PLAYER_RECONNECTED="PLAYER_MANAGER.PLAYER_RECONNECTED"})(LJ1||={});class e5{static instance=new e5;_connectionPlayers=new Map;constructor(){q6.on("CONNECTION.OPENED",({connection:Z,req:J})=>{this._onConnectionOpened(Z,J.session)}),q6.on("CONNECTION.DISCONNECTED",({connection:Z})=>{this._onConnectionDisconnected(Z)}),q6.on("CONNECTION.RECONNECTED",({connection:Z})=>{this._onConnectionReconnected(Z)}),q6.on("CONNECTION.CLOSED",({connection:Z})=>{this._onConnectionClosed(Z)})}get playerCount(){return this._connectionPlayers.size}getConnectedPlayers(){return Array.from(this._connectionPlayers.values())}getConnectedPlayersByWorld(Z){return this.getConnectedPlayers().filter((J)=>J.world===Z)}getConnectedPlayerByUsername(Z){return Array.from(this._connectionPlayers.values()).find((J)=>{return J.username.toLowerCase()===Z.toLowerCase()})}_onConnectionOpened(Z,J){let X=new oW(Z,J);this._connectionPlayers.set(Z,X),q6.emit("PLAYER_MANAGER.PLAYER_CONNECTED",{player:X})}_onConnectionDisconnected(Z){let J=this._connectionPlayers.get(Z);if(J)J.resetInputs(),J.camera.reset()}_onConnectionReconnected(Z){let J=this._connectionPlayers.get(Z);if(J)J.reconnect(),q6.emit("PLAYER_MANAGER.PLAYER_RECONNECTED",{player:J});else m.warning(`PlayerManager._onConnectionReconnected(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}_onConnectionClosed(Z){let J=this._connectionPlayers.get(Z);if(J)J.disconnect(),this._connectionPlayers.delete(Z),q6.emit("PLAYER_MANAGER.PLAYER_DISCONNECTED",{player:J});else m.warning(`PlayerManager._onConnectionClosed(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}}var I8=16,rW=I8-1,wJ1=I8**3,R16=[{neighborOffset:[-1,0,0],generateVertices:(Z,J,X)=>[Z+0,J+0,X+0,Z+0,J+0,X+1,Z+0,J+1,X+0,Z+0,J+1,X+0,Z+0,J+0,X+1,Z+0,J+1,X+1]},{neighborOffset:[1,0,0],generateVertices:(Z,J,X)=>[Z+1,J+0,X+0,Z+1,J+1,X+0,Z+1,J+0,X+1,Z+1,J+1,X+0,Z+1,J+1,X+1,Z+1,J+0,X+1]},{neighborOffset:[0,-1,0],generateVertices:(Z,J,X)=>[Z+0,J+0,X+0,Z+1,J+0,X+0,Z+0,J+0,X+1,Z+1,J+0,X+0,Z+1,J+0,X+1,Z+0,J+0,X+1]},{neighborOffset:[0,1,0],generateVertices:(Z,J,X)=>[Z+0,J+1,X+0,Z+0,J+1,X+1,Z+1,J+1,X+0,Z+1,J+1,X+0,Z+0,J+1,X+1,Z+1,J+1,X+1]},{neighborOffset:[0,0,-1],generateVertices:(Z,J,X)=>[Z+0,J+0,X+0,Z+0,J+1,X+0,Z+1,J+0,X+0,Z+0,J+1,X+0,Z+1,J+1,X+0,Z+1,J+0,X+0]},{neighborOffset:[0,0,1],generateVertices:(Z,J,X)=>[Z+0,J+0,X+1,Z+1,J+0,X+1,Z+0,J+1,X+1,Z+0,J+1,X+1,Z+1,J+0,X+1,Z+1,J+1,X+1]}],th;((Y)=>{Y.DESPAWN="CHUNK.DESPAWN";Y.SET_BLOCK="CHUNK.SET_BLOCK";Y.SPAWN="CHUNK.SPAWN"})(th||={});class b6 extends g0{_blocks;_originCoordinate;_requiresUpdate=!1;_rigidBody;_world;constructor(){super();this._blocks=new Uint8Array(wJ1)}get blocks(){return this._blocks}get requiresUpdate(){return this._requiresUpdate}get isSimulated(){return!!this._rigidBody}get isSpawned(){return!!this._originCoordinate&&!!this._world}get originCoordinate(){return this._originCoordinate}get world(){return this._world}static blockIndexToLocalCoordinate(Z){return{x:Z%I8,y:(Z/I8|0)%I8,z:Z/(I8*I8)|0}}static globalCoordinateToLocalCoordinate(Z){return{x:Z.x&I8-1,y:Z.y&I8-1,z:Z.z&I8-1}}static globalCoordinateToOriginCoordinate(Z){return{x:Z.x&~(I8-1),y:Z.y&~(I8-1),z:Z.z&~(I8-1)}}static isValidOriginCoordinate(Z){return Z.x%I8===0&&Z.y%I8===0&&Z.z%I8===0}spawn(Z,J){if(this.isSpawned){let{x:X,y:Y,z:$}=this.originCoordinate;return m.error(`Chunk.spawn(): Chunk is already spawned at origin ${X}, ${Y}, ${$}!`)}if(!b6.isValidOriginCoordinate(J))return m.error(`Chunk.spawn(): Chunk coordinates must be divisible by ${I8}`);this._originCoordinate=J,this._world=Z,this._world.chunkLattice.registerChunk(this),this._requiresUpdate=!0}despawn(){if(!this.isSpawned)return m.error("Chunk.despawn(): Chunk has not been spawned and cannot be despawned!");this.emitWithWorld(this._world,"CHUNK.DESPAWN",{chunk:this}),this._removeFromSimulation(),this._world.chunkLattice.unregisterChunk(this),this._originCoordinate=void 0,this._world=void 0}getBlockId(Z){return this._blocks[this._getIndex(Z)]}hasBlock(Z){return this._blocks[this._getIndex(Z)]!==0}setBlock(Z,J){if(!this._isValidLocalCoordinate(Z))return m.error("Chunk.setBlock(): Block local coordinate is out of bounds");if(this._blocks[this._getIndex(Z)]===J)return;if(this._blocks[this._getIndex(Z)]=J,this.isSpawned&&this.isSimulated){this.emitWithWorld(this._world,"CHUNK.SET_BLOCK",{chunk:this,globalCoordinate:this._getGlobalCoordinate(Z),localCoordinate:Z,blockTypeId:J});let X=this._getGlobalCoordinate(Z),Y=[];if(Z.x===0)Y.push({x:-1,y:0,z:0});if(Z.y===0)Y.push({x:0,y:-1,z:0});if(Z.z===0)Y.push({x:0,y:0,z:-1});if(Z.x===rW)Y.push({x:1,y:0,z:0});if(Z.y===rW)Y.push({x:0,y:1,z:0});if(Z.z===rW)Y.push({x:0,y:0,z:1});for(let $ of Y){let Q={x:X.x+$.x,y:X.y+$.y,z:X.z+$.z},K=b6.globalCoordinateToOriginCoordinate(Q),W=this._world?.chunkLattice.getChunk(K);if(!W?.hasBlock(b6.globalCoordinateToLocalCoordinate(Q)))continue;W.setRequiresUpdate(!0)}}this._requiresUpdate=!0}setRequiresUpdate(Z){this._requiresUpdate=Z}update(){if(!this._requiresUpdate)return;if(!this.isSpawned)return m.error("Chunk.update(): Chunk is not spawned and cannot be updated.");let Z=!this._rigidBody,J=this._world.simulation;if(this._removeFromSimulation(),this._rigidBody=new RY({type:"fixed",position:this._originCoordinate,simulation:this._world.simulation}),this._meshColliders().map(([X,Y])=>{if(!X.isSimulated)X.addToSimulation(J,this._rigidBody);J.colliderMap.setColliderBlockType(X,Y)}),this._requiresUpdate=!1,Z)this.emitWithWorld(this._world,"CHUNK.SPAWN",{chunk:this})}serialize(){return p0.serializeChunk(this)}_meshColliders(){if(!this._world)return m.error("Chunk._meshColliders(): Chunk is not spawned and cannot be meshed."),[];let Z=new Map,J=[];for(let Y=0;Y<wJ1;Y++){if(this._blocks[Y]===0)continue;let $=this._blocks[Y],Q=this._world.blockTypeRegistry.getBlockType($),{x:K,y:W,z:G}=b6.blockIndexToLocalCoordinate(Y);if(!Q.isMeshable){let V=Q.createCollider();V.setRelativePosition({x:K,y:W,z:G}),J.push([V,Q]);continue}let z=Z.get(Q)??{indices:[],vertices:[]};Z.set(Q,z);for(let V of R16){let[H,q,F]=V.neighborOffset,U={x:K+H,y:W+q,z:G+F},w=this._getGlobalCoordinate(U),L=this._world.chunkLattice.getBlockType(w);if(L&&!L.isLiquid)continue;let j=z.indices.length;z.indices.push(j,j+1,j+2,j+3,j+4,j+5),z.vertices.push(...V.generateVertices(K,W,G))}}let X=[];return Z.forEach((Y,$)=>{if(!Y.indices.length)return;let Q=$.createCollider(new Uint32Array(Y.indices),new Float32Array(Y.vertices));X.push([Q,$])}),[...J,...X]}_removeFromSimulation(){if(!this._rigidBody||!this._world)return;this._rigidBody.removeFromSimulation(),this._rigidBody=void 0}_getGlobalCoordinate(Z){if(!this.originCoordinate)m.fatalError("Chunk._getGlobalCoordinate(): Chunk is not spawned, calculating global coordinate is impossible.");return{x:this.originCoordinate.x+Z.x,y:this.originCoordinate.y+Z.y,z:this.originCoordinate.z+Z.z}}_getIndex(Z){return Z.x+I8*(Z.y+I8*Z.z)}_isValidLocalCoordinate(Z){return Z.x>=0&&Z.x<=rW&&Z.y>=0&&Z.y<=rW&&Z.z>=0&&Z.z<=rW}}class Xq{_chunks=new Map;_world;constructor(Z){this._world=Z}get chunkCount(){return this._chunks.size}registerChunk(Z){if(!Z.isSpawned)return m.error("ChunkLattice.registerChunk(): Chunk is not spawned.");if(this.hasChunk(Z.originCoordinate)){let{x:J,y:X,z:Y}=Z.originCoordinate;return m.error(`ChunkLattice.registerChunk(): Chunk exists at origin (${J}, ${X}, ${Y}), despawn the current chunk before registering another at the same origin.`)}if(Z.world.id!==this._world.id)return m.error("ChunkLattice.registerChunk(): Chunk world does not match lattice world.");this._chunks.set(this._getChunkKey(Z.originCoordinate),Z)}unregisterChunk(Z){if(!Z.isSpawned)return m.error("ChunkLattice.unregisterChunk(): Chunk is not spawned.");if(Z.world.id!==this._world.id)return m.error("ChunkLattice.unregisterChunk(): Chunk world does not match lattice world.");this._chunks.delete(this._getChunkKey(Z.originCoordinate))}clear(){this._chunks.forEach((Z)=>Z.despawn()),this._chunks.clear()}getBlockId(Z){let J=this.getChunk(b6.globalCoordinateToOriginCoordinate(Z));if(!J)return 0;return J.getBlockId(b6.globalCoordinateToLocalCoordinate(Z))}getBlockType(Z){let J=this.getBlockId(Z);return J?this._world.blockTypeRegistry.getBlockType(J):null}getChunk(Z){if(!b6.isValidOriginCoordinate(Z)){m.error(`ChunkLattice.getChunk(): Chunk coordinates must be divisible by CHUNK_SIZE (${I8})`);return}return this._chunks.get(this._getChunkKey(Z))}getAllChunks(){return Array.from(this._chunks.values())}hasBlock(Z){let J=this.getChunk(b6.globalCoordinateToOriginCoordinate(Z));if(!J)return!1;return J.hasBlock(b6.globalCoordinateToLocalCoordinate(Z))}hasChunk(Z){return this._chunks.has(this._getChunkKey(Z))}setBlock(Z,J){let X=b6.globalCoordinateToLocalCoordinate(Z),Y=b6.globalCoordinateToOriginCoordinate(Z),$=this.getChunk(Y);if(!$)$=new b6,$.spawn(this._world,Y);$.setBlock(X,J)}updateChunks(){this._chunks.forEach((Z)=>{if(Z.requiresUpdate)Z.update()})}_getChunkKey(Z){return`${Z.x},${Z.y},${Z.z}`}}var BJ1={type:"dynamic",softCcdPrediction:1},jJ1=0.0025000000000000005,OJ1=Math.cos(0.005),Yq;((j)=>{j.BLOCK_COLLISION="ENTITY.BLOCK_COLLISION";j.BLOCK_CONTACT_FORCE="ENTITY.BLOCK_CONTACT_FORCE";j.DESPAWN="ENTITY.DESPAWN";j.ENTITY_COLLISION="ENTITY.ENTITY_COLLISION";j.ENTITY_CONTACT_FORCE="ENTITY.ENTITY_CONTACT_FORCE";j.SET_MODEL_ANIMATIONS_PLAYBACK_RATE="ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE";j.SET_MODEL_HIDDEN_NODES="ENTITY.SET_MODEL_HIDDEN_NODES";j.SET_OPACITY="ENTITY.SET_OPACITY";j.SET_PARENT="ENTITY.SET_PARENT";j.SET_TINT_COLOR="ENTITY.SET_TINT_COLOR";j.SPAWN="ENTITY.SPAWN";j.START_MODEL_LOOPED_ANIMATIONS="ENTITY.START_MODEL_LOOPED_ANIMATIONS";j.START_MODEL_ONESHOT_ANIMATIONS="ENTITY.START_MODEL_ONESHOT_ANIMATIONS";j.STOP_MODEL_ANIMATIONS="ENTITY.STOP_MODEL_ANIMATIONS";j.TICK="ENTITY.TICK";j.UPDATE_POSITION="ENTITY.UPDATE_POSITION";j.UPDATE_ROTATION="ENTITY.UPDATE_ROTATION"})(Yq||={});class a8 extends RY{_id;_blockHalfExtents;_blockTextureUri;_controller;_modelAnimationsPlaybackRate=1;_modelHiddenNodes=new Set;_modelLoopedAnimations=new Set;_modelOneshotAnimations=new Set;_modelPreferredShape;_modelScale=1;_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,X="modelUri"in Z;if(!J===!X)m.fatalError("Entity.constructor(): Entity data must include a blockTextureUri or modelUri, but not both.");if(J&&!Z.blockHalfExtents)m.fatalError("Entity.constructor(): Block entity must have blockHalfExtents!");if(Z.parent&&!Z.parent.isSpawned)m.fatalError("Entity.constructor(): Parent entity must be spawned before child entity!");if(Z.parent?.modelUri&&Z.parentNodeName&&!P9.instance.modelHasNode(Z.parent.modelUri,Z.parentNodeName))m.fatalError(`Entity.constructor(): Parent node name ${Z.parentNodeName} not found in parent model ${Z.parent.modelUri}!`);super(Z.rigidBodyOptions??BJ1);if(J)this._blockHalfExtents=Z.blockHalfExtents,this._blockTextureUri=Z.blockTextureUri;if(X)this._modelAnimationsPlaybackRate=Z.modelAnimationsPlaybackRate??1,this._modelPreferredShape=Z.modelPreferredShape,this._modelScale=Z.modelScale??1,this._modelUri=Z.modelUri,Z.modelHiddenNodes?.forEach((Y)=>this._modelHiddenNodes.add(Y.toLowerCase())),Z.modelLoopedAnimations?.forEach((Y)=>this._modelLoopedAnimations.add(Y));if(this._name=Z.name??"Nameless",this._opacity=Z.opacity??1,this._parent=Z.parent,this._parentNodeName=Z.parentNodeName,this._tag=Z.tag,this._tintColor=Z.tintColor,Z.controller)this.setController(Z.controller)}get id(){return this._id}get blockHalfExtents(){return this._blockHalfExtents}get blockTextureUri(){return this._blockTextureUri}get controller(){return this._controller}get height(){return this.isModelEntity?P9.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,X){if(this.isSpawned)return m.error(`Entity.spawn(): Entity ${this._name} is already spawned with id ${this._id}!`);if(!this.isSimulated)this.addToSimulation(Z.simulation);if(this._blockTextureUri&&this._blockHalfExtents&&this.numColliders===0)this.addChildColliderToSimulation(new a5(a5.optionsFromBlockHalfExtents(this._blockHalfExtents)));if(this._modelUri&&this.numColliders===0&&this._modelPreferredShape!=="none")this.addChildColliderToSimulation(new a5(a5.optionsFromModelUri(this._modelUri,this._modelScale,this._modelPreferredShape)));if(this.colliders.forEach((Y)=>{if(this.hasListeners("ENTITY.BLOCK_COLLISION")||this.hasListeners("ENTITY.ENTITY_COLLISION"))Y.enableCollisionEvents(!0);if(this.hasListeners("ENTITY.BLOCK_CONTACT_FORCE")||this.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))Y.enableContactForceEvents(!0);if(J4.isDefaultCollisionGroups(Y.collisionGroups))Y.setCollisionGroups({belongsTo:[Y.isSensor?4:2],collidesWith:[65535]})}),this.setPosition(J),X)this.setRotation(X);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,X);this.colliders.forEach((Y)=>{Z.simulation.colliderMap.setColliderEntity(Y,this)}),this.emitWithWorld(Z,"ENTITY.SPAWN",{entity:this})}despawn(){if(!this._requireSpawned("despawn"))return;if(this._world.entityManager.getEntityChildren(this).forEach((Z)=>{Z.despawn()}),this._controller)this._controller.detach(this),this._controller.despawn(this);if(this.emitWithWorld(this._world,"ENTITY.DESPAWN",{entity:this}),this.isSimulated)this.removeFromSimulation();this._world.entityManager.unregisterEntity(this),this._world.audioManager.unregisterEntityAttachedAudios(this),this._world.lightManager.despawnEntityAttachedLights(this),this._world.sceneUIManager.unloadEntityAttachedSceneUIs(this),this._id=void 0,this._world=void 0}setModelAnimationsPlaybackRate(Z){if(!this._requireSpawned("setModelAnimationsPlaybackRate"))return;if(!this.isModelEntity||this._modelAnimationsPlaybackRate===Z)return;this._modelAnimationsPlaybackRate=Z,this.emitWithWorld(this._world,"ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE",{entity:this,playbackRate:Z})}setController(Z){if(this._controller===Z)return;if(this._controller)this._controller.detach(this);if(this._controller=Z,this._controller)this._controller.attach(this)}setModelHiddenNodes(Z){if(!this._requireSpawned("setModelHiddenNodes"))return;this._modelHiddenNodes=new Set(Z.map((J)=>J.toLowerCase())),this.emitWithWorld(this._world,"ENTITY.SET_MODEL_HIDDEN_NODES",{entity:this,modelHiddenNodes:this._modelHiddenNodes})}setOpacity(Z){if(!this._requireSpawned("setOpacity"))return;if(this._opacity===Z)return;this._opacity=Z,this.emitWithWorld(this._world,"ENTITY.SET_OPACITY",{entity:this,opacity:Z})}setParent(Z,J,X,Y){if(!this._requireSpawned("setParent"))return;if(Z&&!Z.isSpawned)return m.error("Entity.setParent(): Parent entity is not spawned, cannot set parent!");if(!this._parent&&Z)this._lastParentlessType=this.type;if(this._parent=Z,this._parentNodeName=J,this.colliders.forEach(($)=>$.setEnabled(!Z)),this.setType(!Z?this._lastParentlessType:"kinematic_velocity"),this.setPosition(X??{x:0,y:0,z:0}),this.setRotation(Y??{x:0,y:0,z:0,w:1}),!this.isKinematicPositionBased)this.resetAngularVelocity(),this.resetForces(),this.resetLinearVelocity(),this.resetTorques();this.emitWithWorld(this._world,"ENTITY.SET_PARENT",{entity:this,parent:Z,parentNodeName:J})}setTintColor(Z){if(!this._requireSpawned("setTintColor"))return;if(!Z&&!this._tintColor||Z&&this._tintColor&&Z.r===this._tintColor.r&&Z.g===this._tintColor.g&&Z.b===this._tintColor.b)return;this._tintColor=Z,this.emitWithWorld(this._world,"ENTITY.SET_TINT_COLOR",{entity:this,tintColor:Z})}startModelLoopedAnimations(Z){if(!this._requireSpawned("startModelLoopedAnimations"))return;if(!this.isModelEntity||!Z.length)return;if(!Z.some((J)=>!this._modelLoopedAnimations.has(J)))return;Z.forEach((J)=>{this._modelLoopedAnimations.add(J)}),this.emitWithWorld(this._world,"ENTITY.START_MODEL_LOOPED_ANIMATIONS",{entity:this,animations:new Set(Z)})}startModelOneshotAnimations(Z){if(!this._requireSpawned("startModelOneshotAnimations"))return;if(!this.isModelEntity||!Z.length)return;Z.forEach((J)=>{this._modelOneshotAnimations.add(J)}),this.emitWithWorld(this._world,"ENTITY.START_MODEL_ONESHOT_ANIMATIONS",{entity:this,animations:new Set(Z)})}stopAllModelAnimations(Z=[]){if(!this._requireSpawned("stopAllModelAnimations"))return;this._stopAnimationsFromSets([this._modelLoopedAnimations,this._modelOneshotAnimations],Z)}stopAllModelLoopedAnimations(Z=[]){if(!this._requireSpawned("stopAllModelLoopedAnimations"))return;this._stopAnimationsFromSets([this._modelLoopedAnimations],Z)}stopAllModelOneshotAnimations(Z=[]){if(!this._requireSpawned("stopAllModelOneshotAnimations"))return;this._stopAnimationsFromSets([this._modelOneshotAnimations],Z)}stopModelAnimations(Z){if(!this._requireSpawned("stopModelAnimations"))return;if(!this.isModelEntity||!Z.length)return;if(!Z.some((J)=>this._modelLoopedAnimations.has(J))&&!Z.some((J)=>this._modelOneshotAnimations.has(J)))return;Z.forEach((J)=>{this._modelLoopedAnimations.delete(J),this._modelOneshotAnimations.delete(J)}),this.emitWithWorld(this._world,"ENTITY.STOP_MODEL_ANIMATIONS",{entity:this,animations:new Set(Z)})}serialize(){return p0.serializeEntity(this)}tick(Z){if(this.emit("ENTITY.TICK",{entity:this,tickDeltaMs:Z}),this._controller)this._controller.tick(this,Z)}checkAndEmitUpdates(){if(!this._requireSpawned("checkAndEmitUpdates"))return;let Z=this.position,J=this.rotation;if(this._rotationExceedsThreshold(J,this._lastUpdatedRotation))this._lastUpdatedRotation=J,this.emitWithWorld(this._world,"ENTITY.UPDATE_ROTATION",{entity:this,rotation:J});if(this._positionExceedsThreshold(Z,this._lastUpdatedPosition))this._lastUpdatedPosition=Z,this.emitWithWorld(this._world,"ENTITY.UPDATE_POSITION",{entity:this,position:Z})}_positionExceedsThreshold(Z,J){let X=Z.x-J.x,Y=Z.y-J.y,$=Z.z-J.z;return X*X+Y*Y+$*$>jJ1}_requireSpawned(Z){if(!this.isSpawned)m.error(`Entity._requireSpawned(): Entity ${this._name} is not spawned, cannot invoke ${Z}()!`);return this.isSpawned}_rotationExceedsThreshold(Z,J){return Math.abs(Z.x*J.x+Z.y*J.y+Z.z*J.z+Z.w*J.w)<OJ1}_stopAnimationsFromSets(Z,J=[]){if(!this.isModelEntity)return;let X=new Set(J),Y=[];for(let $ of Z)for(let Q of $)if(!X.has(Q))Y.push(Q);if(Y.length>0)this.stopModelAnimations(Y)}}var eh;((W)=>{W.LOAD="SCENE_UI.LOAD";W.SET_ATTACHED_TO_ENTITY="SCENE_UI.SET_ATTACHED_TO_ENTITY";W.SET_OFFSET="SCENE_UI.SET_OFFSET";W.SET_POSITION="SCENE_UI.SET_POSITION";W.SET_STATE="SCENE_UI.SET_STATE";W.SET_VIEW_DISTANCE="SCENE_UI.SET_VIEW_DISTANCE";W.UNLOAD="SCENE_UI.UNLOAD"})(eh||={});class $q extends g0{_id;_attachedToEntity;_offset;_position;_state={};_templateId;_viewDistance;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)m.fatalError("Either attachedToEntity or position must be set, but not both");super();this._attachedToEntity=Z.attachedToEntity,this._offset=Z.offset,this._position=Z.position,this._state=Z.state??{},this._templateId=Z.templateId,this._viewDistance=Z.viewDistance}get id(){return this._id}get attachedToEntity(){return this._attachedToEntity}get isLoaded(){return this._id!==void 0}get offset(){return this._offset}get position(){return this._position}get state(){return this._state}get templateId(){return this._templateId}get viewDistance(){return this._viewDistance}get world(){return this._world}load(Z){if(this.isLoaded)return;if(this._attachedToEntity&&!this._attachedToEntity.isSpawned)return m.error(`SceneUI.load(): Attached entity ${this._attachedToEntity.id} must be spawned before loading SceneUI!`);this._id=Z.sceneUIManager.registerSceneUI(this),this._world=Z,this.emitWithWorld(Z,"SCENE_UI.LOAD",{sceneUI:this})}setAttachedToEntity(Z){if(!Z.isSpawned)return m.error(`SceneUI.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);if(this._attachedToEntity===Z)return;if(this._attachedToEntity=Z,this._position=void 0,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_ATTACHED_TO_ENTITY",{sceneUI:this,entity:Z})}setOffset(Z){if(this._offset===Z)return;if(this._offset=Z,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_OFFSET",{sceneUI:this,offset:Z})}setPosition(Z){if(this._position===Z)return;if(this._attachedToEntity=void 0,this._position=Z,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_POSITION",{sceneUI:this,position:Z})}setState(Z){if(this._state={...this._state,...Z},this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_STATE",{sceneUI:this,state:this._state})}setViewDistance(Z){if(this._viewDistance=Z,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_VIEW_DISTANCE",{sceneUI:this,viewDistance:Z})}unload(){if(!this.isLoaded||!this._world)return;this._world.sceneUIManager.unregisterSceneUI(this),this.emitWithWorld(this._world,"SCENE_UI.UNLOAD",{sceneUI:this}),this._id=void 0,this._world=void 0}serialize(){return p0.serializeSceneUI(this)}}class c7 extends a8{player;nametagSceneUI;constructor(Z){super(Z);this.player=Z.player,this.nametagSceneUI=new $q({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,X){super.spawn(Z,J,X),this.nametagSceneUI.load(Z),this.player.on("PLAYER.CHAT_MESSAGE_SEND",({message:Y})=>{this.nametagSceneUI.setState({chat:Y})})}tick(Z){if(!this.isSpawned||!this.world)return;if(!this.controller)return m.error(`PlayerEntity.tick(): PlayerEntity "${this.name}" must have a controller.`);let{input:J,camera:X}=this.player;this.controller.tickWithPlayerInput(this,J,X.orientation,Z),super.tick(Z)}}class Kq{_entities=new Map;_nextEntityId=1;_world;constructor(Z){this._world=Z}get entityCount(){return this._entities.size}get world(){return this._world}registerEntity(Z){if(Z.id!==void 0)m.fatalError(`EntityManager.registerEntity(): Entity ${Z.name} is already assigned the id ${Z.id}!`);let J=this._nextEntityId;return this._entities.set(J,Z),this._nextEntityId++,J}unregisterEntity(Z){if(Z.id===void 0)return m.error(`EntityManager.unregisterEntity(): Entity ${Z.name} is not assigned an id!`);this._entities.delete(Z.id)}getAllEntities(){return Array.from(this._entities.values())}getAllPlayerEntities(){let Z=[];return this._entities.forEach((J)=>{if(J instanceof c7)Z.push(J)}),Z}getPlayerEntitiesByPlayer(Z){let J=[];return this._entities.forEach((X)=>{if(X instanceof c7&&X.player===Z)J.push(X)}),J}getEntity(Z){return this._entities.get(Z)}getEntitiesByTag(Z){let J=[];return this._entities.forEach((X)=>{if(X.tag===Z)J.push(X)}),J}getEntitiesByTagSubstring(Z){let J=[];return this._entities.forEach((X)=>{if(X.tag?.includes(Z))J.push(X)}),J}getEntityChildren(Z){let J=[];return this._entities.forEach((X)=>{if(X.parent===Z)J.push(X)}),J}tickEntities(Z){this._entities.forEach((J)=>{J.tick(Z)})}checkAndEmitUpdates(){this._entities.forEach((Z)=>{if(!Z.isSpawned)return;Z.checkAndEmitUpdates()})}}class Wq{_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 MJ1;((X)=>{X[X.POINTLIGHT=0]="POINTLIGHT";X[X.SPOTLIGHT=1]="SPOTLIGHT"})(MJ1||={});var Zf;((q)=>{q.DESPAWN="LIGHT.DESPAWN";q.SET_ANGLE="LIGHT.SET_ANGLE";q.SET_ATTACHED_TO_ENTITY="LIGHT.SET_ATTACHED_TO_ENTITY";q.SET_COLOR="LIGHT.SET_COLOR";q.SET_DISTANCE="LIGHT.SET_DISTANCE";q.SET_INTENSITY="LIGHT.SET_INTENSITY";q.SET_OFFSET="LIGHT.SET_OFFSET";q.SET_PENUMBRA="LIGHT.SET_PENUMBRA";q.SET_POSITION="LIGHT.SET_POSITION";q.SET_TRACKED_ENTITY="LIGHT.SET_TRACKED_ENTITY";q.SET_TRACKED_POSITION="LIGHT.SET_TRACKED_POSITION";q.SPAWN="LIGHT.SPAWN"})(Zf||={});class Jf extends g0{_id;_angle;_attachedToEntity;_color;_distance;_intensity;_offset;_penumbra;_position;_trackedEntity;_trackedPosition;_type;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)m.fatalError("Either attachedToEntity or position must be set, but not both");super();m.warning("WARNING: Lights are poorly optimized at this time. Using more than a few lights in your game can cause extremely bad performance (FPS) issues. Use lights sparingly!"),this._angle=Z.angle,this._attachedToEntity=Z.attachedToEntity,this._color=Z.color??{r:255,g:255,b:255},this._distance=Z.distance,this._intensity=Z.intensity??1,this._offset=Z.offset,this._penumbra=Z.penumbra,this._position=Z.position,this._trackedEntity=Z.trackedEntity,this._trackedPosition=Z.trackedPosition,this._type=Z.type??0}get id(){return this._id}get angle(){return this._angle}get attachedToEntity(){return this._attachedToEntity}get color(){return this._color}get distance(){return this._distance}get intensity(){return this._intensity}get isSpawned(){return this._id!==void 0}get offset(){return this._offset}get penumbra(){return this._penumbra}get position(){return this._position}get trackedEntity(){return this._trackedEntity}get trackedPosition(){return this._trackedPosition}get type(){return this._type}get world(){return this._world}setAngle(Z){if(this._angle===Z)return;if(this._angle=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_ANGLE",{light:this,angle:Z})}setAttachedToEntity(Z){if(!Z.isSpawned)return m.error(`Light.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);if(this._attachedToEntity===Z)return;if(this._attachedToEntity=Z,this._position=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_ATTACHED_TO_ENTITY",{light:this,entity:Z})}setColor(Z){if(this._color.r===Z.r&&this._color.g===Z.g&&this._color.b===Z.b)return;if(this._color=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_COLOR",{light:this,color:Z})}setDistance(Z){if(this._distance===Z)return;if(this._distance=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_DISTANCE",{light:this,distance:Z})}setIntensity(Z){if(this._intensity===Z)return;if(this._intensity=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_INTENSITY",{light:this,intensity:Z})}setOffset(Z){if(this._offset===Z)return;if(this._offset=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_OFFSET",{light:this,offset:Z})}setPenumbra(Z){if(this._penumbra===Z)return;if(this._penumbra=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_PENUMBRA",{light:this,penumbra:Z})}setPosition(Z){if(this._position===Z)return;if(this._position=Z,this._attachedToEntity=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_POSITION",{light:this,position:Z})}setTrackedEntity(Z){if(!Z.isSpawned)return m.error(`Light.setTrackedEntity(): Entity ${Z.id} is not spawned!`);if(this._trackedEntity===Z)return;if(this._trackedEntity=Z,this._trackedPosition=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_TRACKED_ENTITY",{light:this,entity:Z})}setTrackedPosition(Z){if(this._trackedPosition===Z)return;if(this._trackedPosition=Z,this._trackedEntity=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_TRACKED_POSITION",{light:this,position:Z})}despawn(){if(!this.isSpawned||!this._world)return;this._world.lightManager.unregisterLight(this),this.emitWithWorld(this._world,"LIGHT.DESPAWN",{light:this}),this._id=void 0,this._world=void 0}spawn(Z){if(this.isSpawned)return;if(this._attachedToEntity&&!this._attachedToEntity.isSpawned)return m.error(`Light.spawn(): Attached entity ${this._attachedToEntity.id} must be spawned before spawning Light!`);this._id=Z.lightManager.registerLight(this),this._world=Z,this.emitWithWorld(Z,"LIGHT.SPAWN",{light:this})}serialize(){return p0.serializeLight(this)}}var RJ1;((Y)=>{Y[Y.FIRST_PERSON=0]="FIRST_PERSON";Y[Y.THIRD_PERSON=1]="THIRD_PERSON";Y[Y.SPECTATOR=2]="SPECTATOR"})(RJ1||={});var Xf;((F)=>{F.LOOK_AT_ENTITY="PLAYER_CAMERA.LOOK_AT_ENTITY";F.LOOK_AT_POSITION="PLAYER_CAMERA.LOOK_AT_POSITION";F.SET_ATTACHED_TO_ENTITY="PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY";F.SET_ATTACHED_TO_POSITION="PLAYER_CAMERA.SET_ATTACHED_TO_POSITION";F.SET_FILM_OFFSET="PLAYER_CAMERA.SET_FILM_OFFSET";F.SET_FORWARD_OFFSET="PLAYER_CAMERA.SET_FORWARD_OFFSET";F.SET_FOV="PLAYER_CAMERA.SET_FOV";F.SET_MODEL_HIDDEN_NODES="PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES";F.SET_MODE="PLAYER_CAMERA.SET_MODE";F.SET_OFFSET="PLAYER_CAMERA.SET_OFFSET";F.SET_TRACKED_ENTITY="PLAYER_CAMERA.SET_TRACKED_ENTITY";F.SET_TRACKED_POSITION="PLAYER_CAMERA.SET_TRACKED_POSITION";F.SET_ZOOM="PLAYER_CAMERA.SET_ZOOM"})(Xf||={});class Gq extends g0{player;_attachedToEntity;_attachedToPosition;_filmOffset=0;_forwardOffset=0;_fov=75;_modelHiddenNodes=new Set;_mode=1;_offset={x:0,y:0,z:0};_orientation={pitch:0,yaw:0};_trackedEntity;_trackedPosition;_zoom=1;constructor(Z){super();this.player=Z}get attachedToEntity(){return this._attachedToEntity}get attachedToPosition(){return this._attachedToPosition}get facingDirection(){return{x:-Math.sin(this._orientation.yaw)*Math.cos(this._orientation.pitch),y:Math.sin(this._orientation.pitch),z:-Math.cos(this._orientation.yaw)*Math.cos(this._orientation.pitch)}}get filmOffset(){return this._filmOffset}get forwardOffset(){return this._forwardOffset}get fov(){return this._fov}get modelHiddenNodes(){return this._modelHiddenNodes}get mode(){return this._mode}get offset(){return this._offset}get orientation(){return this._orientation}get trackedEntity(){return this._trackedEntity}get trackedPosition(){return this._trackedPosition}get zoom(){return this._zoom}lookAtEntity(Z){if(!this._requirePlayerWorld())return;this.emitWithWorld(this.player.world,"PLAYER_CAMERA.LOOK_AT_ENTITY",{playerCamera:this,entity:Z})}lookAtPosition(Z){if(!this._requirePlayerWorld())return;this.emitWithWorld(this.player.world,"PLAYER_CAMERA.LOOK_AT_POSITION",{playerCamera:this,position:Z})}reset(){this._attachedToEntity=void 0,this._attachedToPosition=void 0,this._orientation={pitch:0,yaw:0},this._trackedEntity=void 0,this._trackedPosition=void 0}setAttachedToEntity(Z){if(!this._requirePlayerWorld())return;if(!Z.isSpawned)return m.error(`PlayerCamera.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);this._attachedToEntity=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY",{playerCamera:this,entity:Z})}setAttachedToPosition(Z){if(!this._requirePlayerWorld())return;this._attachedToPosition=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_ATTACHED_TO_POSITION",{playerCamera:this,position:Z})}setFilmOffset(Z){if(!this._requirePlayerWorld())return;this._filmOffset=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FILM_OFFSET",{playerCamera:this,filmOffset:Z})}setForwardOffset(Z){if(!this._requirePlayerWorld())return;this._forwardOffset=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FORWARD_OFFSET",{playerCamera:this,forwardOffset:Z})}setFov(Z){if(!this._requirePlayerWorld())return;this._fov=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FOV",{playerCamera:this,fov:Z})}setModelHiddenNodes(Z){if(!this._requirePlayerWorld())return;this._modelHiddenNodes=new Set(Z.map((J)=>J.toLowerCase())),this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES",{playerCamera:this,modelHiddenNodes:this._modelHiddenNodes})}setMode(Z){if(!this._requirePlayerWorld())return;this._mode=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_MODE",{playerCamera:this,mode:Z})}setOffset(Z){if(!this._requirePlayerWorld())return;this._offset=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_OFFSET",{playerCamera:this,offset:Z})}setOrientationPitch(Z){this._orientation.pitch=Z}setOrientationYaw(Z){this._orientation.yaw=Z}setTrackedEntity(Z){if(!this._requirePlayerWorld())return;this._trackedEntity=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_TRACKED_ENTITY",{playerCamera:this,entity:Z})}setTrackedPosition(Z){if(!this._requirePlayerWorld())return;this._trackedPosition=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_TRACKED_POSITION",{playerCamera:this,position:Z})}setZoom(Z){if(!this._requirePlayerWorld())return;this._zoom=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_ZOOM",{playerCamera:this,zoom:Z})}serialize(){return p0.serializePlayerCamera(this)}_requirePlayerWorld(){if(!this.player.world)m.error(`PlayerCamera._requirePlayerWorld(): Player ${this.player.id} is not in a world!`);return!!this.player.world}}var zM;(($)=>{$.DATA="PLAYER_UI.DATA";$.LOAD="PLAYER_UI.LOAD";$.LOCK_POINTER="PLAYER_UI.LOCK_POINTER";$.SEND_DATA="PLAYER_UI.SEND_DATA"})(zM||={});class zq extends g0{player;constructor(Z){super();this.player=Z}load(Z){if(!this.player.world)return;this.emitWithWorld(this.player.world,"PLAYER_UI.LOAD",{playerUI:this,htmlUri:Z})}lockPointer(Z){if(!this.player.world)return;this.emitWithWorld(this.player.world,"PLAYER_UI.LOCK_POINTER",{playerUI:this,lock:Z})}sendData(Z){if(!this.player.world)return;this.emitWithWorld(this.player.world,"PLAYER_UI.SEND_DATA",{playerUI:this,data:Z})}}class Vq{_colliderHandleBlockTypeMap=new Map;_colliderHandleCollisionCallbackMap=new Map;_colliderHandleEntityMap=new Map;_cleanupBlockTypeColliderHandles=new Set;_pendingCleanupBlockTypeColliderHandles=new Set;_cleanupCollisionCallbackColliderHandles=new Set;_pendingCleanupCollisionCallbackColliderHandles=new Set;_cleanupEntityColliderHandles=new Set;_pendingCleanupEntityColliderHandles=new Set;getColliderBlockType(Z){if(!this._requireSimulatedCollider(Z))return;return this._colliderHandleBlockTypeMap.get(Z.rawCollider.handle)}getColliderCollisionCallback(Z){if(!this._requireSimulatedCollider(Z))return;return this._colliderHandleCollisionCallbackMap.get(Z.rawCollider.handle)}getColliderEntity(Z){if(!this._requireSimulatedCollider(Z))return;return this._colliderHandleEntityMap.get(Z.rawCollider.handle)}getColliderHandleBlockType(Z){return this._colliderHandleBlockTypeMap.get(Z)}getColliderHandleCollisionCallback(Z){return this._colliderHandleCollisionCallbackMap.get(Z)}getColliderHandleEntity(Z){return this._colliderHandleEntityMap.get(Z)}removeColliderBlockType(Z){if(!this._requireSimulatedCollider(Z))return;this.removeColliderHandleBlockType(Z.rawCollider.handle)}removeColliderCollisionCallback(Z){if(!this._requireSimulatedCollider(Z))return;this.removeColliderHandleCollisionCallback(Z.rawCollider.handle)}removeColliderEntity(Z){if(!this._requireSimulatedCollider(Z))return;this.removeColliderHandleEntity(Z.rawCollider.handle)}removeColliderHandleBlockType(Z){this._colliderHandleBlockTypeMap.delete(Z)}removeColliderHandleCollisionCallback(Z){this._colliderHandleCollisionCallbackMap.delete(Z)}removeColliderHandleEntity(Z){this._colliderHandleEntityMap.delete(Z)}setColliderBlockType(Z,J){if(!this._requireSimulatedCollider(Z))return;this.setColliderHandleBlockType(Z.rawCollider.handle,J)}setColliderCollisionCallback(Z,J){if(!this._requireSimulatedCollider(Z))return;this.setColliderHandleCollisionCallback(Z.rawCollider.handle,J)}setColliderEntity(Z,J){if(!this._requireSimulatedCollider(Z))return;this.setColliderHandleEntity(Z.rawCollider.handle,J)}setColliderHandleBlockType(Z,J){this._colliderHandleBlockTypeMap.set(Z,J),this._cleanupBlockTypeColliderHandles.delete(Z),this._pendingCleanupBlockTypeColliderHandles.delete(Z)}setColliderHandleCollisionCallback(Z,J){this._colliderHandleCollisionCallbackMap.set(Z,J),this._cleanupCollisionCallbackColliderHandles.delete(Z),this._pendingCleanupCollisionCallbackColliderHandles.delete(Z)}setColliderHandleEntity(Z,J){this._colliderHandleEntityMap.set(Z,J),this._cleanupEntityColliderHandles.delete(Z),this._pendingCleanupEntityColliderHandles.delete(Z)}queueColliderHandleForCleanup(Z){if(this._colliderHandleBlockTypeMap.has(Z))this._pendingCleanupBlockTypeColliderHandles.add(Z);if(this._colliderHandleCollisionCallbackMap.has(Z))this._pendingCleanupCollisionCallbackColliderHandles.add(Z);if(this._colliderHandleEntityMap.has(Z))this._pendingCleanupEntityColliderHandles.add(Z)}cleanup(){for(let Z of this._cleanupBlockTypeColliderHandles)this._colliderHandleBlockTypeMap.delete(Z);if(this._cleanupBlockTypeColliderHandles.size>0)this._cleanupBlockTypeColliderHandles.clear();for(let Z of this._cleanupCollisionCallbackColliderHandles)this._colliderHandleCollisionCallbackMap.delete(Z);if(this._cleanupCollisionCallbackColliderHandles.size>0)this._cleanupCollisionCallbackColliderHandles.clear();for(let Z of this._cleanupEntityColliderHandles)this._colliderHandleEntityMap.delete(Z);if(this._cleanupEntityColliderHandles.size>0)this._cleanupEntityColliderHandles.clear();for(let Z of this._pendingCleanupBlockTypeColliderHandles.keys())this._cleanupBlockTypeColliderHandles.add(Z);if(this._pendingCleanupBlockTypeColliderHandles.size>0)this._pendingCleanupBlockTypeColliderHandles.clear();for(let Z of this._pendingCleanupCollisionCallbackColliderHandles.keys())this._cleanupCollisionCallbackColliderHandles.add(Z);if(this._pendingCleanupCollisionCallbackColliderHandles.size>0)this._pendingCleanupCollisionCallbackColliderHandles.clear();for(let Z of this._pendingCleanupEntityColliderHandles.keys())this._cleanupEntityColliderHandles.add(Z);if(this._pendingCleanupEntityColliderHandles.size>0)this._pendingCleanupEntityColliderHandles.clear()}_requireSimulatedCollider(Z){if(!Z.rawCollider)m.error("ColliderMap._requireSimulatedCollider(): Collider is not in the simulation.");return!!Z.rawCollider}}var N16={x:0,y:-32,z:0},Yf=60,$f;(($)=>{$.STEP_START="SIMULATION.STEP_START";$.STEP_END="SIMULATION.STEP_END";$.DEBUG_RAYCAST="SIMULATION.DEBUG_RAYCAST";$.DEBUG_RENDER="SIMULATION.DEBUG_RENDER"})($f||={});class Hq extends g0{_colliderMap=new Vq;_debugRaycastingEnabled=!1;_debugRenderingEnabled=!1;_debugRenderingFilterFlags;_rapierEventQueue;_rapierSimulation;_world;constructor(Z,J=Yf,X=N16){super();this._rapierEventQueue=new $1.EventQueue(!0),this._rapierSimulation=new $1.World(X),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,X,Y={}){let $=new $1.Ray(Z,J),Q=this._rapierSimulation.castRay($,X,Y.ignoresSensors??!0,Y.filterFlags,Y.filterGroups,Y.filterExcludeCollider,Y.filterExcludeRigidBody,Y.filterPredicate);if(this._debugRaycastingEnabled)this.emitWithWorld(this._world,"SIMULATION.DEBUG_RAYCAST",{simulation:this,origin:Z,direction:J,length:X,hit:!!Q});if(!Q)return null;let K=$.pointAt(Q.timeOfImpact),W=Q.timeOfImpact,G=Q.collider,z=this._colliderMap.getColliderHandleBlockType(G.handle);if(z)return{hitBlock:ZQ.fromGlobalCoordinate({x:Math.floor(K.x-($.dir.x<0?0.0001:-0.0001)),y:Math.floor(K.y-($.dir.y<0?0.0001:-0.0001)),z:Math.floor(K.z-($.dir.z<0?0.0001:-0.0001))},z),hitPoint:K,hitDistance:W};let V=this._colliderMap.getColliderHandleEntity(G.handle);if(V)return{hitEntity:V,hitPoint:K,hitDistance:W};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,J=$1.QueryFilterFlags.EXCLUDE_FIXED){this._debugRenderingEnabled=Z,this._debugRenderingFilterFlags=J}getContactManifolds(Z,J){let X=[];return this._rapierSimulation.narrowPhase.contactPair(Z,J,(Y,$)=>{if(Y.numContacts()===0)return;let Q=Y.normal(),K=[];for(let W=0;W<Y.numSolverContacts();W++)K.push(Y.solverContactPoint(W));X.push({contactPoints:K,localNormalA:!$?Y.localNormal1():Y.localNormal2(),localNormalB:!$?Y.localNormal2():Y.localNormal1(),normal:!$?Q:{x:-Q.x,y:-Q.y,z:-Q.z}})}),X}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(Q8.startSpan({operation:"physics_step"},()=>{this._rapierSimulation.step(this._rapierEventQueue)}),Q8.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(this._debugRenderingFilterFlags)})};_onCollisionEvent=(Z,J,X)=>{let[Y,$]=this._getCollisionObjects(Z,J);if(!Y||!$)return;let Q=(K,W)=>{if(K instanceof s5&&W instanceof a8&&K.hasListeners("BLOCK_TYPE.ENTITY_COLLISION"))K.emit("BLOCK_TYPE.ENTITY_COLLISION",{blockType:K,entity:W,started:X,colliderHandleA:Z,colliderHandleB:J});else if(K instanceof a8&&W instanceof s5&&K.hasListeners("ENTITY.BLOCK_COLLISION"))K.emit("ENTITY.BLOCK_COLLISION",{entity:K,blockType:W,started:X,colliderHandleA:Z,colliderHandleB:J});else if(K instanceof a8&&W instanceof a8&&K.hasListeners("ENTITY.ENTITY_COLLISION"))K.emit("ENTITY.ENTITY_COLLISION",{entity:K,otherEntity:W,started:X,colliderHandleA:Z,colliderHandleB:J});else if(typeof K==="function"&&(W instanceof a8||W instanceof s5))K(W,X,Z,J)};Q(Y,$),Q($,Y)};_onContactForceEvent=(Z)=>{let[J,X]=this._getCollisionObjects(Z.collider1(),Z.collider2());if(!J||typeof J==="function"||!X||typeof X==="function")return;let Y={totalForce:Z.totalForce(),totalForceMagnitude:Z.totalForceMagnitude(),maxForceDirection:Z.maxForceDirection(),maxForceMagnitude:Z.maxForceMagnitude()},$=(Q,K)=>{if(Q instanceof s5&&K instanceof a8&&Q.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))Q.emit("BLOCK_TYPE.ENTITY_CONTACT_FORCE",{blockType:Q,entity:K,contactForceData:Y});else if(Q instanceof a8&&K instanceof s5&&Q.hasListeners("ENTITY.BLOCK_CONTACT_FORCE"))Q.emit("ENTITY.BLOCK_CONTACT_FORCE",{entity:Q,blockType:K,contactForceData:Y});else if(Q instanceof a8&&K instanceof a8&&Q.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))Q.emit("ENTITY.ENTITY_CONTACT_FORCE",{entity:Q,otherEntity:K,contactForceData:Y})};$(J,X),$(X,J)};_getCollisionObjects(Z,J){let X=this._colliderMap.getColliderHandleBlockType(Z)??this._colliderMap.getColliderHandleCollisionCallback(Z)??this._colliderMap.getColliderHandleEntity(Z),Y=this._colliderMap.getColliderHandleBlockType(J)??this._colliderMap.getColliderHandleCollisionCallback(J)??this._colliderMap.getColliderHandleEntity(J);return[X,Y]}}class VM{_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=[],X=this._world.loop.currentTick;this._queuedPerPlayerSynchronizations.forEach((q,F)=>{this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(...q)});let Y=Object.values(this._queuedEntitySynchronizations);if(Y.length>0){let[q,F]=Y.reduce(([U,w],L)=>{for(let j in L)if(j!=="i"&&j!=="p"&&j!=="r")return U.push(L),[U,w];return w.push(L),[U,w]},[[],[]]);if(F.length>0){let U=X0.createPacket(X0.outboundPackets.entitiesPacketDefinition,F,X);J.push(U)}if(q.length>0){let U=X0.createPacket(X0.outboundPackets.entitiesPacketDefinition,q,X);Z.push(U),this._synchronizedPlayerReliablePackets.forEach((w)=>w.push(U))}}let $=Object.values(this._queuedAudioSynchronizations);if($.length>0){let q=X0.createPacket(X0.outboundPackets.audiosPacketDefinition,$,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let Q=Object.values(this._queuedBlockTypeSynchronizations);if(Q.length>0){let q=X0.createPacket(X0.outboundPackets.blockTypesPacketDefinition,Q,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let K=Object.values(this._queuedBlockSynchronizations);if(K.length>0){let q=X0.createPacket(X0.outboundPackets.blocksPacketDefinition,K,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let W=Object.values(this._queuedChunkSynchronizations);if(W.length>0){let q=X0.createPacket(X0.outboundPackets.chunksPacketDefinition,W,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let G=Object.values(this._queuedLightSynchronizations);if(G.length>0){let q=X0.createPacket(X0.outboundPackets.lightsPacketDefinition,G,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}this._queuedPerPlayerUISynchronizations.forEach((q,F)=>{let U=X0.createPacket(X0.outboundPackets.uiPacketDefinition,q,X);this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(U)}),this._queuedPerPlayerUIDatasSynchronizations.forEach((q,F)=>{let U=X0.createPacket(X0.outboundPackets.uiDatasPacketDefinition,q,X);this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(U)});let z=Object.values(this._queuedSceneUISynchronizations);if(z.length>0){let q=X0.createPacket(X0.outboundPackets.sceneUIsPacketDefinition,z,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}if(this._queuedWorldSynchronization){let q=X0.createPacket(X0.outboundPackets.worldPacketDefinition,this._queuedWorldSynchronization,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}this._queuedPerPlayerCameraSynchronizations.forEach((q,F)=>{let U=X0.createPacket(X0.outboundPackets.cameraPacketDefinition,q,X);this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(U)});let V=Object.values(this._queuedPlayerSynchronizations);if(V.length>0){let q=X0.createPacket(X0.outboundPackets.playersPacketDefinition,V,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}this._queuedBroadcasts.forEach((q)=>{Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))});let H=this._queuedDebugRaycastSynchronizations;if(H.length>0){let q=X0.createPacket(X0.outboundPackets.physicsDebugRaycastsPacketDefinition,H,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}Q8.startSpan({operation:"send_all_packets"},()=>{e5.instance.getConnectedPlayersByWorld(this._world).forEach((q)=>{let F=this._synchronizedPlayerReliablePackets.get(q)??Z;if(F.length>0)q.connection.send(F);if(J.length>0)q.connection.send(J,!1)})}),Q8.startSpan({operation:"network_synchronize_cleanup"},()=>{if(this._queuedBroadcasts.length>0)this._queuedBroadcasts=[];if($.length>0)this._queuedAudioSynchronizations={};if(K.length>0)this._queuedBlockSynchronizations={};if(Q.length>0)this._queuedBlockTypeSynchronizations={};if(W.length>0)this._queuedChunkSynchronizations={};if(H.length>0)this._queuedDebugRaycastSynchronizations=[];if(Y.length>0)this._queuedEntitySynchronizations={};if(G.length>0)this._queuedLightSynchronizations={};if(this._queuedPerPlayerSynchronizations.size>0)this._queuedPerPlayerSynchronizations.clear();if(this._queuedPerPlayerCameraSynchronizations.size>0)this._queuedPerPlayerCameraSynchronizations.clear();if(this._queuedPerPlayerUISynchronizations.size>0)this._queuedPerPlayerUISynchronizations.clear();if(this._queuedPerPlayerUIDatasSynchronizations.size>0)this._queuedPerPlayerUIDatasSynchronizations.clear();if(V.length>0)this._queuedPlayerSynchronizations={};if(z.length>0)this._queuedSceneUISynchronizations={};if(this._queuedWorldSynchronization)this._queuedWorldSynchronization=void 0;if(this._loadedSceneUIs.size>0)this._loadedSceneUIs.clear();if(this._spawnedChunks.size>0)this._spawnedChunks.clear();if(this._spawnedEntities.size>0)this._spawnedEntities.clear();if(this._synchronizedPlayerReliablePackets.size>0)this._synchronizedPlayerReliablePackets.clear()})}_subscribeToAudioEvents(){this._world.final("AUDIO.PAUSE",this._onAudioPause),this._world.final("AUDIO.PLAY",this._onAudioPlay),this._world.final("AUDIO.PLAY_RESTART",this._onAudioPlayRestart),this._world.final("AUDIO.SET_ATTACHED_TO_ENTITY",this._onAudioSetAttachedToEntity),this._world.final("AUDIO.SET_CUTOFF_DISTANCE",this._onAudioSetCutoffDistance),this._world.final("AUDIO.SET_DETUNE",this._onAudioSetDetune),this._world.final("AUDIO.SET_DISTORTION",this._onAudioSetDistortion),this._world.final("AUDIO.SET_POSITION",this._onAudioSetPosition),this._world.final("AUDIO.SET_PLAYBACK_RATE",this._onAudioSetPlaybackRate),this._world.final("AUDIO.SET_REFERENCE_DISTANCE",this._onAudioSetReferenceDistance),this._world.final("AUDIO.SET_VOLUME",this._onAudioSetVolume)}_subscribeToBlockTypeRegistryEvents(){this._world.final("BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE",this._onBlockTypeRegistryRegisterBlockType)}_subscribeToChatEvents(){this._world.final("CHAT.BROADCAST_MESSAGE",this._onChatSendBroadcastMessage),this._world.final("CHAT.PLAYER_MESSAGE",this._onChatSendPlayerMessage)}_subscribeToChunkEvents(){this._world.final("CHUNK.SPAWN",this._onChunkSpawn),this._world.final("CHUNK.DESPAWN",this._onChunkDespawn),this._world.final("CHUNK.SET_BLOCK",this._onChunkSetBlock)}_subscribeToEntityEvents(){this._world.final("ENTITY.SPAWN",this._onEntitySpawn),this._world.final("ENTITY.DESPAWN",this._onEntityDespawn),this._world.final("ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE",this._onEntitySetModelAnimationsPlaybackRate),this._world.final("ENTITY.SET_MODEL_HIDDEN_NODES",this._onEntitySetModelHiddenNodes),this._world.final("ENTITY.SET_OPACITY",this._onEntitySetOpacity),this._world.final("ENTITY.SET_PARENT",this._onEntitySetParent),this._world.final("ENTITY.SET_TINT_COLOR",this._onEntitySetTintColor),this._world.final("ENTITY.START_MODEL_LOOPED_ANIMATIONS",this._onEntityStartModelLoopedAnimations),this._world.final("ENTITY.START_MODEL_ONESHOT_ANIMATIONS",this._onEntityStartModelOneshotAnimations),this._world.final("ENTITY.STOP_MODEL_ANIMATIONS",this._onEntityStopModelAnimations),this._world.final("ENTITY.UPDATE_POSITION",this._onEntityUpdatePosition),this._world.final("ENTITY.UPDATE_ROTATION",this._onEntityUpdateRotation)}_subscribeToLightEvents(){this._world.final("LIGHT.DESPAWN",this._onLightDespawn),this._world.final("LIGHT.SET_ANGLE",this._onLightSetAngle),this._world.final("LIGHT.SET_ATTACHED_TO_ENTITY",this._onLightSetAttachedToEntity),this._world.final("LIGHT.SET_COLOR",this._onLightSetColor),this._world.final("LIGHT.SET_DISTANCE",this._onLightSetDistance),this._world.final("LIGHT.SET_INTENSITY",this._onLightSetIntensity),this._world.final("LIGHT.SET_OFFSET",this._onLightSetOffset),this._world.final("LIGHT.SET_PENUMBRA",this._onLightSetPenumbra),this._world.final("LIGHT.SET_POSITION",this._onLightSetPosition),this._world.final("LIGHT.SET_TRACKED_ENTITY",this._onLightSetTrackedEntity),this._world.final("LIGHT.SET_TRACKED_POSITION",this._onLightSetTrackedPosition),this._world.final("LIGHT.SPAWN",this._onLightSpawn)}_subscribeToPlayerEvents(){this._world.final("PLAYER.JOINED_WORLD",this._onPlayerJoinedWorld),this._world.final("PLAYER.LEFT_WORLD",this._onPlayerLeftWorld),this._world.final("PLAYER.RECONNECTED_WORLD",this._onPlayerReconnectedWorld),this._world.final("PLAYER.REQUEST_SYNC",this._onPlayerRequestSync)}_subscribeToPlayerCameraEvents(){this._world.final("PLAYER_CAMERA.LOOK_AT_ENTITY",this._onPlayerCameraLookAtEntity),this._world.final("PLAYER_CAMERA.LOOK_AT_POSITION",this._onPlayerCameraLookAtPosition),this._world.final("PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY",this._onPlayerCameraSetAttachedToEntity),this._world.final("PLAYER_CAMERA.SET_ATTACHED_TO_POSITION",this._onPlayerCameraSetAttachedToPosition),this._world.final("PLAYER_CAMERA.SET_FILM_OFFSET",this._onPlayerCameraSetFilmOffset),this._world.final("PLAYER_CAMERA.SET_FORWARD_OFFSET",this._onPlayerCameraSetForwardOffset),this._world.final("PLAYER_CAMERA.SET_FOV",this._onPlayerCameraSetFov),this._world.final("PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES",this._onPlayerCameraSetModelHiddenNodes),this._world.final("PLAYER_CAMERA.SET_MODE",this._onPlayerCameraSetMode),this._world.final("PLAYER_CAMERA.SET_OFFSET",this._onPlayerCameraSetOffset),this._world.final("PLAYER_CAMERA.SET_TRACKED_ENTITY",this._onPlayerCameraSetTrackedEntity),this._world.final("PLAYER_CAMERA.SET_TRACKED_POSITION",this._onPlayerCameraSetTrackedPosition),this._world.final("PLAYER_CAMERA.SET_ZOOM",this._onPlayerCameraSetZoom)}_subscribeToPlayerUIEvents(){this._world.final("PLAYER_UI.LOAD",this._onPlayerUILoad),this._world.final("PLAYER_UI.LOCK_POINTER",this._onPlayerUILockPointer),this._world.final("PLAYER_UI.SEND_DATA",this._onPlayerUISendData)}_subscribeToSceneUIEvents(){this._world.final("SCENE_UI.LOAD",this._onSceneUILoad),this._world.final("SCENE_UI.SET_ATTACHED_TO_ENTITY",this._onSceneUISetAttachedToEntity),this._world.final("SCENE_UI.SET_OFFSET",this._onSceneUISetOffset),this._world.final("SCENE_UI.SET_POSITION",this._onSceneUISetPosition),this._world.final("SCENE_UI.SET_STATE",this._onSceneUISetState),this._world.final("SCENE_UI.SET_VIEW_DISTANCE",this._onSceneUISetViewDistance),this._world.final("SCENE_UI.UNLOAD",this._onSceneUIUnload)}_subscribeToSimulationEvents(){this._world.final("SIMULATION.DEBUG_RAYCAST",this._onSimulationDebugRaycast),this._world.final("SIMULATION.DEBUG_RENDER",this._onSimulationDebugRender)}_subscribeToWorldEvents(){this._world.final("WORLD.SET_AMBIENT_LIGHT_COLOR",this._onWorldSetAmbientLightColor),this._world.final("WORLD.SET_AMBIENT_LIGHT_INTENSITY",this._onWorldSetAmbientLightIntensity),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_COLOR",this._onWorldSetDirectionalLightColor),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY",this._onWorldSetDirectionalLightIntensity),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_POSITION",this._onWorldSetDirectionalLightPosition),this._world.final("WORLD.SET_SKYBOX_INTENSITY",this._onWorldSetSkyboxIntensity)}_onAudioPause=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.pa=!0,delete J.pl,delete J.r};_onAudioPlay=(Z)=>{let J=Z.audio.serialize();J.pl=!0,delete J.pa,delete J.r,this._queuedAudioSynchronizations[J.i]=J};_onAudioPlayRestart=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.r=!0,delete J.pa,delete J.pl,this._queuedAudioSynchronizations[J.i]=J};_onAudioSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onAudioSetCutoffDistance=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.cd=Z.cutoffDistance};_onAudioSetDetune=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.de=Z.detune};_onAudioSetDistortion=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.di=Z.distortion};_onAudioSetPosition=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.e=Z.position?void 0:J.e,J.p=Z.position?p0.serializeVector(Z.position):void 0};_onAudioSetPlaybackRate=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.pr=Z.playbackRate};_onAudioSetReferenceDistance=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.rd=Z.referenceDistance};_onAudioSetVolume=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.v=Z.volume};_onBlockTypeRegistryRegisterBlockType=(Z)=>{let J=Z.blockType.serialize();this._queuedBlockTypeSynchronizations[Z.blockType.id]=J};_onChatSendBroadcastMessage=(Z)=>{let{player:J,message:X,color:Y}=Z;this._queuedBroadcasts.push(X0.createPacket(X0.outboundPackets.chatMessagesPacketDefinition,[{m:X,c:Y,p:J?.id}],this._world.loop.currentTick))};_onChatSendPlayerMessage=(Z)=>{let{player:J,message:X,color:Y}=Z,$=this._queuedPerPlayerSynchronizations.get(J)??[];$.push(X0.createPacket(X0.outboundPackets.chatMessagesPacketDefinition,[{m:X,c:Y}],this._world.loop.currentTick)),this._queuedPerPlayerSynchronizations.set(J,$)};_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),X=J.c.join(",");if(this._spawnedChunks.has(X))delete this._queuedChunkSynchronizations[X],this._spawnedChunks.delete(X);else J.rm=!0};_onChunkSetBlock=(Z)=>{let J=this._createOrGetQueuedBlockSync(Z.globalCoordinate);J.i=Z.blockTypeId};_onEntitySetModelAnimationsPlaybackRate=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.ap=Z.playbackRate};_onEntitySpawn=(Z)=>{let J=Z.entity.serialize();this._queuedEntitySynchronizations[J.i]=J,this._spawnedEntities.add(J.i)};_onEntityDespawn=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(this._spawnedEntities.has(J.i))delete this._queuedEntitySynchronizations[J.i],this._spawnedEntities.delete(J.i);else J.rm=!0};_onEntitySetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.h=Array.from(Z.modelHiddenNodes)};_onEntitySetOpacity=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.o=Z.opacity};_onEntitySetParent=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.pe=Z.parent?Z.parent.id:void 0,J.pn=Z.parentNodeName};_onEntitySetTintColor=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.t=Z.tintColor?p0.serializeRgbColor(Z.tintColor):void 0};_onEntityStartModelLoopedAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.al=Array.from(new Set([...J.al??[],...Z.animations])),J.as)J.as=J.as.filter((X)=>!Z.animations.has(X)).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((X)=>!Z.animations.has(X)).filter(Boolean)};_onEntityStopModelAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.al)J.al=J.al.filter((X)=>!Z.animations.has(X)).filter(Boolean);if(J.ao)J.ao=J.ao.filter((X)=>!Z.animations.has(X)).filter(Boolean);J.as=Array.from(new Set([...J.as??[],...Z.animations]))};_onEntityUpdateRotation=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.r=[Z.rotation.x,Z.rotation.y,Z.rotation.z,Z.rotation.w]};_onEntityUpdatePosition=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.p=[Z.position.x,Z.position.y,Z.position.z]};_onLightDespawn=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.rm=!0};_onLightSetAngle=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.a=Z.angle};_onLightSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onLightSetColor=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.c=p0.serializeRgbColor(Z.color)};_onLightSetDistance=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.d=Z.distance};_onLightSetIntensity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.n=Z.intensity};_onLightSetOffset=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.o=Z.offset?p0.serializeVector(Z.offset):void 0};_onLightSetPenumbra=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.pe=Z.penumbra};_onLightSetPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.p=Z.position?p0.serializeVector(Z.position):void 0,J.e=Z.position?void 0:J.e};_onLightSetTrackedEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.te=Z.entity?Z.entity.id:void 0,J.tp=Z.entity?void 0:J.tp};_onLightSetTrackedPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.tp=Z.position?p0.serializeVector(Z.position):void 0,J.te=Z.position?void 0:J.te};_onLightSpawn=(Z)=>{let J=Z.light.serialize();this._queuedLightSynchronizations[J.i]=J};_onPlayerCameraLookAtEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=p0.serializeVector(Z.entity.position),delete J.et,delete J.pt};_onPlayerCameraLookAtPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=Z.position?p0.serializeVector(Z.position):void 0,delete J.et,delete J.pt};_onPlayerCameraSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.e=Z.entity.id,delete J.p};_onPlayerCameraSetAttachedToPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.p=Z.position?p0.serializeVector(Z.position):void 0,delete J.e};_onPlayerCameraSetFilmOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fo=Z.filmOffset};_onPlayerCameraSetForwardOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.ffo=Z.forwardOffset};_onPlayerCameraSetFov=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fv=Z.fov};_onPlayerCameraSetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.h=Array.from(Z.modelHiddenNodes)};_onPlayerCameraSetMode=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.m=Z.mode};_onPlayerCameraSetOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.o=Z.offset?p0.serializeVector(Z.offset):void 0};_onPlayerCameraSetTrackedEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.et=Z.entity?Z.entity.id:void 0,delete J.pl,delete J.pt};_onPlayerCameraSetTrackedPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pt=Z.position?p0.serializeVector(Z.position):void 0,delete J.et,delete J.pl};_onPlayerCameraSetZoom=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.z=Z.zoom};_onPlayerJoinedWorld=(Z)=>{let{player:J}=Z,X=this._queuedPerPlayerSynchronizations.get(J)??[];X.push(X0.createPacket(X0.outboundPackets.worldPacketDefinition,this._world.serialize(),this._world.loop.currentTick)),X.push(X0.createPacket(X0.outboundPackets.blockTypesPacketDefinition,this._world.blockTypeRegistry.serialize(),this._world.loop.currentTick)),X.push(X0.createPacket(X0.outboundPackets.chunksPacketDefinition,this._world.chunkLattice.getAllChunks().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(X0.createPacket(X0.outboundPackets.entitiesPacketDefinition,this._world.entityManager.getAllEntities().map(($)=>{if(J.camera.attachedToEntity===void 0&&$ instanceof c7&&$.player===J)J.camera.setAttachedToEntity($);return $.serialize()}),this._world.loop.currentTick)),X.push(X0.createPacket(X0.outboundPackets.audiosPacketDefinition,this._world.audioManager.getAllAudios().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(X0.createPacket(X0.outboundPackets.lightsPacketDefinition,this._world.lightManager.getAllLights().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(X0.createPacket(X0.outboundPackets.sceneUIsPacketDefinition,this._world.sceneUIManager.getAllSceneUIs().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(X0.createPacket(X0.outboundPackets.playersPacketDefinition,e5.instance.getConnectedPlayers().map(($)=>$.serialize()),this._world.loop.currentTick));let Y=this._createOrGetQueuedPlayerCameraSync(J.camera);this._queuedPerPlayerCameraSynchronizations.set(J,{...J.camera.serialize(),...Y}),this._queuedPerPlayerSynchronizations.set(J,X),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([X0.createPacket(X0.outboundPackets.syncResponsePacketDefinition,{r:Z.receivedAt,s:Date.now(),p:performance.now()-Z.receivedAtMs,n:this._world.loop.nextTickMs},this._world.loop.currentTick)])};_onPlayerUILoad=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.u=Z.htmlUri};_onPlayerUILockPointer=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.p=Z.lock};_onPlayerUISendData=(Z)=>{this._createOrGetQueuedPlayerUIDatasSync(Z.playerUI).push(Z.data)};_onSceneUILoad=(Z)=>{let J=Z.sceneUI.serialize();this._queuedSceneUISynchronizations[J.i]=J,this._loadedSceneUIs.add(J.i)};_onSceneUISetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onSceneUISetOffset=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.o=Z.offset?p0.serializeVector(Z.offset):void 0};_onSceneUISetPosition=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.p=Z.position?p0.serializeVector(Z.position):void 0,J.e=Z.position?void 0:J.e};_onSceneUISetState=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.s=Z.state};_onSceneUISetViewDistance=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.v=Z.viewDistance};_onSceneUIUnload=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);if(this._loadedSceneUIs.has(J.i))delete this._queuedSceneUISynchronizations[J.i],this._loadedSceneUIs.delete(J.i);else J.rm=!0};_onSimulationDebugRaycast=(Z)=>{this._queuedDebugRaycastSynchronizations.push(p0.serializePhysicsDebugRaycast(Z))};_onSimulationDebugRender=(Z)=>{this._queuedBroadcasts.push(X0.createPacket(X0.outboundPackets.physicsDebugRenderPacketDefinition,{v:Array.from(Z.vertices),c:Array.from(Z.colors)},this._world.loop.currentTick))};_onWorldSetAmbientLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ac=p0.serializeRgbColor(Z.color)};_onWorldSetAmbientLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ai=Z.intensity};_onWorldSetDirectionalLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dc=p0.serializeRgbColor(Z.color)};_onWorldSetDirectionalLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.di=Z.intensity};_onWorldSetDirectionalLightPosition=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dp=p0.serializeVector(Z.position)};_onWorldSetSkyboxIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.si=Z.intensity};_createOrGetQueuedAudioSync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedAudioSync(): Audio has no id!");return this._queuedAudioSynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedBlockSync(Z){let{x:J,y:X,z:Y}=Z;return this._queuedBlockSynchronizations[`${J},${X},${Y}`]??={i:0,c:[J,X,Y]}}_createOrGetQueuedChunkSync(Z){if(!Z.originCoordinate)m.fatalError("NetworkSynchronizer._createOrGetQueuedChunkSync(): Chunk has no origin coordinate!");let{x:J,y:X,z:Y}=Z.originCoordinate;return this._queuedChunkSynchronizations[`${J},${X},${Y}`]??={c:[J,X,Y]}}_createOrGetQueuedEntitySync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedEntitySync(): Entity has no id!");return this._queuedEntitySynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedLightSync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedLightSync(): Light has no id!");return this._queuedLightSynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedPlayerSync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedPlayerSync(): Player has no id!");return this._queuedPlayerSynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedPlayerCameraSync(Z){let J=this._queuedPerPlayerCameraSynchronizations.get(Z.player);if(!J)J={},this._queuedPerPlayerCameraSynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUISync(Z){let J=this._queuedPerPlayerUISynchronizations.get(Z.player);if(!J)J={},this._queuedPerPlayerUISynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUIDatasSync(Z){let J=this._queuedPerPlayerUIDatasSynchronizations.get(Z.player);if(!J)J=[],this._queuedPerPlayerUIDatasSynchronizations.set(Z.player,J);return J}_createOrGetQueuedSceneUISync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedSceneUISync(): SceneUI has no id!");return this._queuedSceneUISynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedWorldSync(Z){if(Z.id!==this._world.id)m.fatalError("NetworkSynchronizer._createOrGetQueuedWorldSync(): World does not match this network synchronizer world!");return this._queuedWorldSynchronization??={i:Z.id}}_createOrGetSynchronizedPlayerReliablePackets(Z,J){let X=this._synchronizedPlayerReliablePackets.get(Z);if(!X)X=[...J],this._synchronizedPlayerReliablePackets.set(Z,X);return X}}class qq{_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 P16=2,D16=3;class Fq{_accumulatorMs=0;_targetTicksPerSecond;_fixedTimestepMs;_fixedTimestepS;_maxAccumulatorMs;_nextTickMs=0;_lastLoopTimeMs=0;_tickFunction;_tickErrorCallback;_tickHandle=null;constructor(Z,J,X){this._targetTicksPerSecond=Z,this._fixedTimestepS=Math.fround(1/Z),this._fixedTimestepMs=Math.fround(this._fixedTimestepS*1000),this._maxAccumulatorMs=this._fixedTimestepMs*D16,this._tickFunction=J,this._tickErrorCallback=X}get targetTicksPerSecond(){return this._targetTicksPerSecond}get fixedTimestepMs(){return this._fixedTimestepMs}get fixedTimestepS(){return this._fixedTimestepS}get nextTickMs(){return this._nextTickMs}start(){if(this._tickHandle)return m.warning("Ticker.start(): ticker already running.");this._lastLoopTimeMs=performance.now();let Z=()=>{let J=performance.now(),X=J-this._lastLoopTimeMs;if(this._lastLoopTimeMs=J,this._accumulatorMs+=X,this._accumulatorMs>this._maxAccumulatorMs)this._accumulatorMs=this._maxAccumulatorMs;if(this._accumulatorMs>=this._fixedTimestepMs)Q8.startSpan({operation:"ticker_tick"},()=>{let Y=0;while(this._accumulatorMs>=this._fixedTimestepMs&&Y<P16)this._tick(this._fixedTimestepMs),this._accumulatorMs-=this._fixedTimestepMs,Y++;this._nextTickMs=Math.max(0,this._fixedTimestepMs-this._accumulatorMs)});this._tickHandle=setTimeout(Z,this._nextTickMs)};Z()}stop(){if(!this._tickHandle)return m.warning("Ticker.stop(): ticker not running.");clearTimeout(this._tickHandle),this._tickHandle=null}_tick(Z){try{this._tickFunction(Z)}catch(J){if(J instanceof Error&&this._tickErrorCallback)this._tickErrorCallback(J);else m.warning(`Ticker._tick(): tick callback threw an error, but it was not an instance of Error. Error: ${J}`)}}}var NJ1;((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"})(NJ1||={});class Uq extends g0{_currentTick=0;_ticker;_world;constructor(Z,J=Yf){super();this._ticker=new Fq(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();Q8.startSpan({operation:"world_tick",attributes:{serverPlayerCount:e5.instance.playerCount,targetTickRate:this._ticker.targetTicksPerSecond,targetTickRateMs:this._ticker.fixedTimestepMs,worldId:this._world.id,worldName:this._world.name,worldChunkCount:this._world.chunkLattice.chunkCount,worldEntityCount:this._world.entityManager.entityCount,worldLoopTick:this._currentTick}},()=>{Q8.startSpan({operation:"chunks_update"},()=>this._world.chunkLattice.updateChunks()),Q8.startSpan({operation:"entities_tick"},()=>this._world.entityManager.tickEntities(Z)),Q8.startSpan({operation:"simulation_step"},()=>this._world.simulation.step(Z)),Q8.startSpan({operation:"entities_emit_updates"},()=>this._world.entityManager.checkAndEmitUpdates()),Q8.startSpan({operation:"network_synchronize"},()=>this._world.networkSynchronizer.synchronize())}),this._currentTick++,this.emitWithWorld(this._world,"WORLD_LOOP.TICK_END",{worldLoop:this,tickDurationMs:performance.now()-J})};_onTickError=(Z)=>{m.error(`WorldLoop._onTickError(): Error: ${Z}`),this.emitWithWorld(this._world,"WORLD_LOOP.TICK_ERROR",{worldLoop:this,error:Z})}}var Qf;((G)=>{G.SET_AMBIENT_LIGHT_COLOR="WORLD.SET_AMBIENT_LIGHT_COLOR";G.SET_AMBIENT_LIGHT_INTENSITY="WORLD.SET_AMBIENT_LIGHT_INTENSITY";G.SET_DIRECTIONAL_LIGHT_COLOR="WORLD.SET_DIRECTIONAL_LIGHT_COLOR";G.SET_DIRECTIONAL_LIGHT_INTENSITY="WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY";G.SET_DIRECTIONAL_LIGHT_POSITION="WORLD.SET_DIRECTIONAL_LIGHT_POSITION";G.SET_SKYBOX_INTENSITY="WORLD.SET_SKYBOX_INTENSITY";G.START="WORLD.START";G.STOP="WORLD.STOP"})(Qf||={});class Lq extends g0{_id;_ambientLightColor;_ambientLightIntensity;_directionalLightColor;_directionalLightIntensity;_directionalLightPosition;_name;_skyboxIntensity;_skyboxUri;_audioManager;_blockTypeRegistry;_chatManager;_chunkLattice;_entityManager;_lightManager;_loop;_networkSynchronizer;_sceneUIManager;_simulation;_tag;constructor(Z){super();if(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._skyboxIntensity=Z.skyboxIntensity??1,this._skyboxUri=Z.skyboxUri,this._tag=Z.tag,this._audioManager=new $G(this),this._blockTypeRegistry=new S3(this),this._chatManager=new wq(this),this._chunkLattice=new Xq(this),this._entityManager=new Kq(this),this._lightManager=new Wq(this),this._loop=new Uq(this,Z.tickRate),this._networkSynchronizer=new VM(this),this._sceneUIManager=new qq(this),this._simulation=new Hq(this,Z.tickRate,Z.gravity),Z.map)this.loadMap(Z.map)}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 skyboxIntensity(){return this._skyboxIntensity}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,X]of Object.entries(Z.blocks)){let[Y,$,Q]=J.split(",").map(Number);this.chunkLattice.setBlock({x:Y,y:$,z:Q},X)}if(Z.entities)for(let[J,X]of Object.entries(Z.entities)){let[Y,$,Q]=J.split(",").map(Number);new a8(X).spawn(this,{x:Y,y:$,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})}setSkyboxIntensity(Z){this._skyboxIntensity=Z,this.emit("WORLD.SET_SKYBOX_INTENSITY",{world:this,intensity:Z})}start(){this._loop.start(),this.emit("WORLD.START",{world:this,startedAtMs:Date.now()})}stop(){this._loop.stop(),this.emit("WORLD.STOP",{world:this,stoppedAtMs:Date.now()})}serialize(){return p0.serializeWorld(this)}}var PJ1;((J)=>J.WORLD_CREATED="WORLD_MANAGER.WORLD_CREATED")(PJ1||={});class tW{static instance=new tW;_defaultWorld;_nextWorldId=1;_worlds=new Map;createWorld(Z){let J=new Lq({...Z,id:this._nextWorldId++});return J.start(),this._worlds.set(J.id,J),q6.emit("WORLD_MANAGER.WORLD_CREATED",{world:J}),J}getAllWorlds(){return Array.from(this._worlds.values())}getDefaultWorld(){return this._defaultWorld??=this.createWorld({name:"Default World",skyboxUri:"skyboxes/partly-cloudy"}),this._defaultWorld}getWorldsByTag(Z){let J=[];return this._worlds.forEach((X)=>{if(X.tag===Z)J.push(X)}),J}getWorld(Z){return this._worlds.get(Z)}setDefaultWorld(Z){this._defaultWorld=Z}}Buffer.poolSize=67108864;var DJ1;((X)=>{X.START="GAMESERVER.START";X.STOP="GAMESERVER.STOP"})(DJ1||={});function C16(Z){$1.init().then(()=>{return sZ.instance.modelRegistry.preloadModels()}).then(()=>{if(Z.length>0)Z(sZ.instance.worldManager.getDefaultWorld());else Z();sZ.instance.start()}).catch((J)=>{m.fatalError(`Failed to initialize the game engine, exiting. Error: ${J}`)})}class sZ{static _instance;_modelRegistry=P9.instance;_playerManager=e5.instance;_socket=bJ.instance;_worldManager=tW.instance;_webServer=yK.instance;constructor(){}static get instance(){if(!this._instance)this._instance=new sZ;return this._instance}get modelRegistry(){return this._modelRegistry}get playerManager(){return this._playerManager}get socket(){return this._socket}get webServer(){return this._webServer}get worldManager(){return this._worldManager}start(){q6.emit("GAMESERVER.START",{startedAtMs:performance.now()}),this._webServer.start()}}class s${static instance=new s$;constructor(){}async getGlobalData(Z){let J=await M7.instance.getData(Z);if(!J||J.error){if(J?.error)m.warning(`PersistenceManager.getGlobalData(): ${J.error.message}`);return}return J}async getPlayerData(Z){let J=await M7.instance.getData(this._getPlayerKey(Z));if(!J||J.error){if(J?.error)m.warning(`PersistenceManager.getPlayerData(): ${J.error.message}`);return}return J}async setGlobalData(Z,J){let X=await M7.instance.setData(Z,J);if(!X||X.error){if(X?.error)m.warning(`PersistenceManager.setGlobalData(): ${X.error.message}`);return}return X}async setPlayerData(Z,J){let X=await M7.instance.setData(this._getPlayerKey(Z),J);if(!X||X.error){if(X?.error)m.warning(`PersistenceManager.setPlayerData(): ${X.error.message}`);return}return X}_getPlayerKey(Z){return`player-${Z.id}`}}var CJ1=["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"],Qq;((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"})(Qq||={});class oW extends g0{static _devNextPlayerId=1;id;username;profilePictureUrl;camera;connection;ui;_input={};_lastUnreliableInputSequenceNumber=0;_world;constructor(Z,J){super();this.id=J?.user.id??`player-${oW._devNextPlayerId++}`,this.username=J?.user.username??this.id,this.profilePictureUrl=J?.user.profilePictureURL??void 0,this.camera=new Gq(this),this.connection=Z,this.ui=new zq(this),Z.onPacket(X0.PacketId.CHAT_MESSAGE_SEND,this._onChatMessageSendPacket),Z.onPacket(X0.PacketId.DEBUG_CONFIG,this._onDebugConfigPacket),Z.onPacket(X0.PacketId.INPUT,this._onInputPacket),Z.onPacket(X0.PacketId.SYNC_REQUEST,this._onSyncRequestPacket),Z.onPacket(X0.PacketId.UI_DATA_SEND,this._onUIDataSendPacket),this.joinWorld(sZ.instance.worldManager.getDefaultWorld())}get input(){return this._input}get world(){return this._world}disconnect(){this._leaveWorld(),this.connection.disconnect()}async getPersistedData(){return s$.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 s$.instance.setPlayerData(this,Z)}serialize(){return p0.serializePlayer(this)}_leaveWorld(){if(!this._world)return;this.emitWithWorld(this._world,"PLAYER.LEFT_WORLD",{player:this,world:this._world}),this._world=void 0}_onChatMessageSendPacket=(Z)=>{if(this._world)this.emitWithWorld(this._world,"PLAYER.CHAT_MESSAGE_SEND",{player:this,message:Z[1].m})};_onDebugConfigPacket=(Z)=>{console.log(Z)};_onInputPacket=(Z)=>{let J=Z[1];if(J.sq!==void 0){if(J.sq<this._lastUnreliableInputSequenceNumber)return;this._lastUnreliableInputSequenceNumber=J.sq}if(CJ1.forEach((X)=>{let Y=X;if(J[Y]!==void 0)this._input[Y]=Boolean(J[Y])}),J.cp!==void 0)this.camera.setOrientationPitch(J.cp);if(J.cy!==void 0)this.camera.setOrientationYaw(J.cy)};_onSyncRequestPacket=()=>{if(this._world)this.emitWithWorld(this._world,"PLAYER.REQUEST_SYNC",{player:this,receivedAt:Date.now(),receivedAtMs:performance.now()})};_onUIDataSendPacket=(Z)=>{this.ui.emit("PLAYER_UI.DATA",{playerUI:this.ui,data:Z[1]})}}var Kf;((X)=>{X.BROADCAST_MESSAGE="CHAT.BROADCAST_MESSAGE";X.PLAYER_MESSAGE="CHAT.PLAYER_MESSAGE"})(Kf||={});class wq extends g0{_commandCallbacks={};_world;constructor(Z){super();this._world=Z,this._subscribeToPlayerEvents()}registerCommand(Z,J){this._commandCallbacks[Z]=J}unregisterCommand(Z){delete this._commandCallbacks[Z]}sendBroadcastMessage(Z,J){this._sendBroadcastMessage(void 0,Z,J)}sendPlayerMessage(Z,J,X){this.emitWithWorld(this._world,"CHAT.PLAYER_MESSAGE",{player:Z,message:J,color:X})}_subscribeToPlayerEvents(){this._world.on("PLAYER.CHAT_MESSAGE_SEND",(Z)=>{let{player:J,message:X}=Z,[Y,...$]=X.split(" "),Q=this._commandCallbacks[Y];if(Q){Q(J,$,X);return}this._sendBroadcastMessage(J,X)})}_sendBroadcastMessage(Z,J,X){this.emitWithWorld(this._world,"CHAT.BROADCAST_MESSAGE",{player:Z,message:J,color:X})}}class b1 extends xX{static BASE_ENTITY_HEIGHT=1.5;static GROUND_SENSOR_HEIGHT_SCALE=0.125;static GROUND_SENSOR_RADIUS_SCALE=0.23;static JUMP_LAND_HEAVY_VELOCITY_THRESHOLD=-12;static WALL_COLLIDER_HEIGHT_SCALE=0.33;static WALL_COLLIDER_RADIUS_SCALE=0.4;static MOVEMENT_ROTATIONS={wa:Math.PI/4,wd:-Math.PI/4,sa:Math.PI-Math.PI/4,sd:Math.PI+Math.PI/4,s:Math.PI,asd:Math.PI,a:Math.PI/2,d:-Math.PI/2};static EXTERNAL_IMPULSE_DECAY_RATE=0.335;static SWIM_UPWARD_COOLDOWN_MS=600;static SWIMMING_DRAG_FACTOR=0.05;static WATER_ENTRY_SINKING_FACTOR=0.8;static WATER_ENTRY_SINKING_MS=250;applyDirectionalMovementRotations=!0;autoCancelMouseLeftClick=!0;canJump=()=>!0;canRun=()=>!0;canSwim=()=>!0;canWalk=()=>!0;idleLoopedAnimations=["idle-upper","idle-lower"];interactOneshotAnimations=["simple-interact"];jumpLandHeavyOneshotAnimations=["jump-post-heavy"];jumpLandLightOneshotAnimations=["jump-post-light"];jumpOneshotAnimations=["jump-loop"];jumpVelocity=10;runLoopedAnimations=["run-upper","run-lower"];runVelocity=8;sticksToPlatforms=!0;swimFastVelocity=5;swimGravity=0;swimIdleLoopedAnimations=["swim-idle"];swimLoopedAnimations=["swim-forward"];swimMaxGravityVelocity=-1;swimSlowVelocity=3;swimUpwardVelocity=2;walkLoopedAnimations=["walk-upper","walk-lower"];walkVelocity=4;_externalImpulse={x:0,y:0,z:0};_groundContactCount=0;_internalApplyImpulse=()=>{};_isActivelyMoving=!1;_isFullySubmerged=!1;_justSubmergedUntil=0;_liquidContactCount=0;_platform;_reusableImpulse={x:0,y:0,z:0};_reusablePlatformVelocity={x:0,y:0,z:0};_reusableTargetVelocities={x:0,y:0,z:0};_reusableVelocityClamp={x:0,y:0,z:0};_stepAudio;_swimUpwardCooldownAt=0;constructor(Z={}){super();this.applyDirectionalMovementRotations=Z.applyDirectionalMovementRotations??this.applyDirectionalMovementRotations,this.autoCancelMouseLeftClick=Z.autoCancelMouseLeftClick??this.autoCancelMouseLeftClick,this.sticksToPlatforms=Z.sticksToPlatforms??this.sticksToPlatforms,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.jumpVelocity=Z.jumpVelocity??this.jumpVelocity,this.runVelocity=Z.runVelocity??this.runVelocity,this.walkVelocity=Z.walkVelocity??this.walkVelocity,this.swimFastVelocity=Z.swimFastVelocity??this.swimFastVelocity,this.swimSlowVelocity=Z.swimSlowVelocity??this.swimSlowVelocity,this.swimUpwardVelocity=Z.swimUpwardVelocity??this.swimUpwardVelocity,this.swimGravity=Z.swimGravity??this.swimGravity,this.swimMaxGravityVelocity=Z.swimMaxGravityVelocity??this.swimMaxGravityVelocity,this.idleLoopedAnimations=Z.idleLoopedAnimations??this.idleLoopedAnimations,this.interactOneshotAnimations=Z.interactOneshotAnimations??this.interactOneshotAnimations,this.jumpOneshotAnimations=Z.jumpOneshotAnimations??this.jumpOneshotAnimations,this.jumpLandHeavyOneshotAnimations=Z.jumpLandHeavyOneshotAnimations??this.jumpLandHeavyOneshotAnimations,this.jumpLandLightOneshotAnimations=Z.jumpLandLightOneshotAnimations??this.jumpLandLightOneshotAnimations,this.runLoopedAnimations=Z.runLoopedAnimations??this.runLoopedAnimations,this.swimLoopedAnimations=Z.swimLoopedAnimations??this.swimLoopedAnimations,this.swimIdleLoopedAnimations=Z.swimIdleLoopedAnimations??this.swimIdleLoopedAnimations,this.walkLoopedAnimations=Z.walkLoopedAnimations??this.walkLoopedAnimations}get isActivelyMoving(){return this._isActivelyMoving}get isGrounded(){return this._groundContactCount>0}get isOnPlatform(){return!!this._platform}get isSwimming(){return this._liquidContactCount>0}get platform(){return this._platform}attach(Z){super.attach(Z),this._internalApplyImpulse=Z.applyImpulse.bind(Z),Z.applyImpulse=(J)=>{this._externalImpulse.x+=J.x,this._externalImpulse.y+=J.y,this._externalImpulse.z+=J.z},this._stepAudio=new YG({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:X})=>{if(!J.isLiquid||!this.canSwim(this))return;if(this._liquidContactCount<=0&&X){let Y=Z.linearVelocity;Z.setLinearVelocity({x:Y.x*this.swimGravity,y:Y.y*this.swimGravity,z:Y.z*this.swimGravity})}if(this._liquidContactCount+=X?1:-1,this._liquidContactCount>0)Z.setGravityScale(this.swimGravity),Z.stopAllModelLoopedAnimations(this.swimLoopedAnimations),this._swimUpwardCooldownAt=performance.now()+b1.SWIM_UPWARD_COOLDOWN_MS;else Z.setGravityScale(1),Z.stopModelAnimations(this.swimLoopedAnimations)})}spawn(Z){if(!Z.isSpawned)return m.error("DefaultPlayerEntityController.spawn(): Entity is not spawned!");Z.createAndAddChildCollider({shape:"cylinder",radius:b1.GROUND_SENSOR_RADIUS_SCALE*(Z.height/b1.BASE_ENTITY_HEIGHT),halfHeight:b1.GROUND_SENSOR_HEIGHT_SCALE*(Z.height/b1.BASE_ENTITY_HEIGHT),collisionGroups:{belongsTo:[4],collidesWith:[1,2]},isSensor:!0,relativePosition:{x:0,y:-Z.height/2,z:0},tag:"groundSensor",onCollision:(J,X)=>{if(!Z.isSpawned)return;if(!(J instanceof s5)||!J.isLiquid){if(X&&this._groundContactCount===0&&Z.linearVelocity.y<-1)if(Z.linearVelocity.y<b1.JUMP_LAND_HEAVY_VELOCITY_THRESHOLD)Z.startModelOneshotAnimations(this.jumpLandHeavyOneshotAnimations);else Z.startModelOneshotAnimations(this.jumpLandLightOneshotAnimations);this._groundContactCount+=X?1:-1}if(!this._groundContactCount&&!this.isSwimming)Z.startModelOneshotAnimations(this.jumpOneshotAnimations);else Z.stopModelAnimations(this.jumpOneshotAnimations);if(!(J instanceof a8))return;if(X&&this.sticksToPlatforms)this._platform=J;else if(J===this._platform&&!X)this._platform=void 0}}),Z.createAndAddChildCollider({shape:"capsule",halfHeight:b1.WALL_COLLIDER_HEIGHT_SCALE*(Z.height/b1.BASE_ENTITY_HEIGHT),radius:b1.WALL_COLLIDER_RADIUS_SCALE*(Z.height/b1.BASE_ENTITY_HEIGHT),collisionGroups:{belongsTo:[4],collidesWith:[1,2]},friction:0,frictionCombineRule:1,tag:"wallCollider"})}tickWithPlayerInput(Z,J,X,Y){if(!Z.isSpawned||!Z.world)return;if(super.tickWithPlayerInput(Z,J,X,Y),Z.parent)return;let{w:$,a:Q,s:K,d:W,c:G,sp:z,sh:V,ml:H}=J,{yaw:q}=X,F=Z.linearVelocity;this._reusableTargetVelocities.x=0,this._reusableTargetVelocities.y=0,this._reusableTargetVelocities.z=0,this._isActivelyMoving=!!($||Q||K||W);let U=V,w=Q&&W&&!$&&!K||$&&K&&!Q&&!W;if(this.isSwimming&&!this._isFullySubmerged)this._isFullySubmerged=!0,this._justSubmergedUntil=performance.now()+b1.WATER_ENTRY_SINKING_MS;else if(!this.isSwimming)this._isFullySubmerged=!1,this._justSubmergedUntil=0;if(this.isGrounded&&!this.isSwimming&&this._isActivelyMoving&&!w){let D=U?this.runLoopedAnimations:this.walkLoopedAnimations;Z.stopAllModelLoopedAnimations(D),Z.startModelLoopedAnimations(D),this._stepAudio?.setPlaybackRate(U?0.75:0.51),this._stepAudio?.play(Z.world,!this._stepAudio?.isPlaying)}else if(this._isFullySubmerged){this._stepAudio?.pause();let D=this._isActivelyMoving?this.swimLoopedAnimations:this.swimIdleLoopedAnimations;Z.stopAllModelLoopedAnimations(D),Z.startModelLoopedAnimations(D)}else this._stepAudio?.pause(),Z.stopAllModelLoopedAnimations(this.idleLoopedAnimations),Z.startModelLoopedAnimations(this.idleLoopedAnimations);let L;if(this.applyDirectionalMovementRotations){if($&&Q&&!W&&!K)L=b1.MOVEMENT_ROTATIONS.wa;else if($&&W&&!Q&&!K)L=b1.MOVEMENT_ROTATIONS.wd;else if(K&&Q&&!$&&!W)L=b1.MOVEMENT_ROTATIONS.sa;else if(K&&W&&!$&&!Q)L=b1.MOVEMENT_ROTATIONS.sd;else if(K&&!$&&!Q&&!W||Q&&K&&W&&!$)L=b1.MOVEMENT_ROTATIONS.s;else if(Q&&!$&&!K&&!W)L=b1.MOVEMENT_ROTATIONS.a;else if(W&&!$&&!Q&&!K)L=b1.MOVEMENT_ROTATIONS.d}if(H)Z.startModelOneshotAnimations(this.interactOneshotAnimations),J.ml=!this.autoCancelMouseLeftClick;if(U&&this.canRun(this)||!U&&this.canWalk(this)){let D=!this.isSwimming?U?this.runVelocity:this.walkVelocity:U?this.swimFastVelocity:this.swimSlowVelocity,P=Math.sin(q),C=Math.cos(q);if($)this._reusableTargetVelocities.x-=D*P,this._reusableTargetVelocities.z-=D*C;if(K)this._reusableTargetVelocities.x+=D*P,this._reusableTargetVelocities.z+=D*C;if(Q)this._reusableTargetVelocities.x-=D*C,this._reusableTargetVelocities.z+=D*P;if(W)this._reusableTargetVelocities.x+=D*C,this._reusableTargetVelocities.z-=D*P;let T=Math.sqrt(this._reusableTargetVelocities.x*this._reusableTargetVelocities.x+this._reusableTargetVelocities.z*this._reusableTargetVelocities.z);if(T>D){let k=D/T;this._reusableTargetVelocities.x*=k,this._reusableTargetVelocities.z*=k}}if(this.isSwimming){if(F.y<this.swimMaxGravityVelocity)this._reusableVelocityClamp.x=F.x,this._reusableVelocityClamp.y=this.swimMaxGravityVelocity,this._reusableVelocityClamp.z=F.z,Z.setLinearVelocity(this._reusableVelocityClamp);if(F.y>this.swimUpwardVelocity*2)this._reusableVelocityClamp.x=F.x,this._reusableVelocityClamp.y=this.swimUpwardVelocity*2,this._reusableVelocityClamp.z=F.z,Z.setLinearVelocity(this._reusableVelocityClamp);if(G)this._reusableTargetVelocities.y=-this.swimUpwardVelocity;else if(performance.now()<this._justSubmergedUntil)this._reusableTargetVelocities.y=-this.swimUpwardVelocity*b1.WATER_ENTRY_SINKING_FACTOR;else if(!z)this._reusableTargetVelocities.y=-F.y*b1.SWIMMING_DRAG_FACTOR}if(z&&this.canJump(this)){if(this.isGrounded&&!this.isSwimming&&F.y>-0.001&&F.y<=3)this._reusableTargetVelocities.y=this.jumpVelocity;else if(this.isSwimming&&performance.now()>this._swimUpwardCooldownAt)this._reusableTargetVelocities.y=this.swimUpwardVelocity}let j=this._platform?.linearVelocity??this._reusablePlatformVelocity;this._externalImpulse.x=this._applyTargetDecay(this._externalImpulse.x),this._externalImpulse.y=this._applyTargetDecay(this._externalImpulse.y),this._externalImpulse.z=this._applyTargetDecay(this._externalImpulse.z);let R=this._reusableTargetVelocities.x+this._externalImpulse.x-F.x+j.x,O=this._reusableTargetVelocities.y+this._externalImpulse.y+j.y,N=this._reusableTargetVelocities.z+this._externalImpulse.z-F.z+j.z;if(R!==0||O!==0||N!==0){let D=Z.mass;this._reusableImpulse.x=R*D,this._reusableImpulse.y=O*D,this._reusableImpulse.z=N*D,this._internalApplyImpulse(this._reusableImpulse)}if(q!==void 0){let P=(L!==void 0?q+L:q)/2;Z.setRotation({x:0,y:Math.fround(Math.sin(P)),z:0,w:Math.fround(Math.cos(P))})}}_applyTargetDecay(Z){if(Math.abs(Z)<=0.01)return 0;return Z-Math.min(Math.abs(Z),b1.EXTERNAL_IMPULSE_DECAY_RATE)*Math.sign(Z)}}class Wf extends c7{constructor(Z){super({modelUri:"models/players/player.gltf",modelLoopedAnimations:["idle_lower","idle_upper"],...Z});if(!Z.controller)this.setController(new b1)}}var P0=0.000001,Y1=typeof Float32Array!=="undefined"?Float32Array:Array,l7=Math.random;var Ds6=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 g8={};d4(g8,{transpose:()=>_16,subtract:()=>kJ1,sub:()=>s16,str:()=>m16,set:()=>S16,scale:()=>b16,rotate:()=>f16,multiplyScalarAndAdd:()=>n16,multiplyScalar:()=>i16,multiply:()=>TJ1,mul:()=>a16,invert:()=>A16,identity:()=>I16,fromValues:()=>v16,fromScaling:()=>g16,fromRotation:()=>y16,frob:()=>u16,exactEquals:()=>l16,equals:()=>p16,determinant:()=>h16,create:()=>T16,copy:()=>E16,clone:()=>k16,adjoint:()=>x16,add:()=>c16,LDU:()=>d16});function T16(){var Z=new Y1(4);if(Y1!=Float32Array)Z[1]=0,Z[2]=0;return Z[0]=1,Z[3]=1,Z}function k16(Z){var J=new Y1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function E16(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function I16(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=1,Z}function v16(Z,J,X,Y){var $=new Y1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function S16(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function _16(Z,J){if(Z===J){var X=J[1];Z[1]=J[2],Z[2]=X}else Z[0]=J[0],Z[1]=J[2],Z[2]=J[1],Z[3]=J[3];return Z}function A16(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=X*Q-$*Y;if(!K)return null;return K=1/K,Z[0]=Q*K,Z[1]=-Y*K,Z[2]=-$*K,Z[3]=X*K,Z}function x16(Z,J){var X=J[0];return Z[0]=J[3],Z[1]=-J[1],Z[2]=-J[2],Z[3]=X,Z}function h16(Z){return Z[0]*Z[3]-Z[2]*Z[1]}function TJ1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=X[0],G=X[1],z=X[2],V=X[3];return Z[0]=Y*W+Q*G,Z[1]=$*W+K*G,Z[2]=Y*z+Q*V,Z[3]=$*z+K*V,Z}function f16(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+Q*W,Z[1]=$*G+K*W,Z[2]=Y*-W+Q*G,Z[3]=$*-W+K*G,Z}function b16(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=X[0],G=X[1];return Z[0]=Y*W,Z[1]=$*W,Z[2]=Q*G,Z[3]=K*G,Z}function y16(Z,J){var X=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=X,Z[2]=-X,Z[3]=Y,Z}function g16(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=J[1],Z}function m16(Z){return"mat2("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}function u16(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3])}function d16(Z,J,X,Y){return Z[2]=Y[2]/Y[0],X[0]=Y[0],X[1]=Y[1],X[3]=Y[3]-Z[2]*X[1],[Z,J,X]}function c16(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z}function kJ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z[3]=J[3]-X[3],Z}function l16(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function p16(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],K=J[0],W=J[1],G=J[2],z=J[3];return Math.abs(X-K)<=P0*Math.max(1,Math.abs(X),Math.abs(K))&&Math.abs(Y-W)<=P0*Math.max(1,Math.abs(Y),Math.abs(W))&&Math.abs($-G)<=P0*Math.max(1,Math.abs($),Math.abs(G))&&Math.abs(Q-z)<=P0*Math.max(1,Math.abs(Q),Math.abs(z))}function i16(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z}function n16(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z[3]=J[3]+X[3]*Y,Z}var a16=TJ1,s16=kJ1;var i1={};d4(i1,{transpose:()=>X86,translate:()=>K86,subtract:()=>IJ1,sub:()=>D86,str:()=>w86,set:()=>Z86,scale:()=>G86,rotate:()=>W86,projection:()=>L86,normalFromMat4:()=>U86,multiplyScalarAndAdd:()=>M86,multiplyScalar:()=>O86,multiply:()=>EJ1,mul:()=>P86,invert:()=>Y86,identity:()=>J86,fromValues:()=>e16,fromTranslation:()=>z86,fromScaling:()=>H86,fromRotation:()=>V86,fromQuat:()=>F86,fromMat4:()=>o16,fromMat2d:()=>q86,frob:()=>B86,exactEquals:()=>R86,equals:()=>N86,determinant:()=>Q86,create:()=>Gf,copy:()=>t16,clone:()=>r16,adjoint:()=>$86,add:()=>j86});function Gf(){var Z=new Y1(9);if(Y1!=Float32Array)Z[1]=0,Z[2]=0,Z[3]=0,Z[5]=0,Z[6]=0,Z[7]=0;return Z[0]=1,Z[4]=1,Z[8]=1,Z}function o16(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 r16(Z){var J=new Y1(9);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J[4]=Z[4],J[5]=Z[5],J[6]=Z[6],J[7]=Z[7],J[8]=Z[8],J}function t16(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 e16(Z,J,X,Y,$,Q,K,W,G){var z=new Y1(9);return z[0]=Z,z[1]=J,z[2]=X,z[3]=Y,z[4]=$,z[5]=Q,z[6]=K,z[7]=W,z[8]=G,z}function Z86(Z,J,X,Y,$,Q,K,W,G,z){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z[4]=Q,Z[5]=K,Z[6]=W,Z[7]=G,Z[8]=z,Z}function J86(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 X86(Z,J){if(Z===J){var X=J[1],Y=J[2],$=J[5];Z[1]=J[3],Z[2]=J[6],Z[3]=X,Z[5]=J[7],Z[6]=Y,Z[7]=$}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 Y86(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=J[4],W=J[5],G=J[6],z=J[7],V=J[8],H=V*K-W*z,q=-V*Q+W*G,F=z*Q-K*G,U=X*H+Y*q+$*F;if(!U)return null;return U=1/U,Z[0]=H*U,Z[1]=(-V*Y+$*z)*U,Z[2]=(W*Y-$*K)*U,Z[3]=q*U,Z[4]=(V*X-$*G)*U,Z[5]=(-W*X+$*Q)*U,Z[6]=F*U,Z[7]=(-z*X+Y*G)*U,Z[8]=(K*X-Y*Q)*U,Z}function $86(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=J[4],W=J[5],G=J[6],z=J[7],V=J[8];return Z[0]=K*V-W*z,Z[1]=$*z-Y*V,Z[2]=Y*W-$*K,Z[3]=W*G-Q*V,Z[4]=X*V-$*G,Z[5]=$*Q-X*W,Z[6]=Q*z-K*G,Z[7]=Y*G-X*z,Z[8]=X*K-Y*Q,Z}function Q86(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],K=Z[5],W=Z[6],G=Z[7],z=Z[8];return J*(z*Q-K*G)+X*(-z*$+K*W)+Y*(G*$-Q*W)}function EJ1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=J[8],q=X[0],F=X[1],U=X[2],w=X[3],L=X[4],j=X[5],R=X[6],O=X[7],N=X[8];return Z[0]=q*Y+F*K+U*z,Z[1]=q*$+F*W+U*V,Z[2]=q*Q+F*G+U*H,Z[3]=w*Y+L*K+j*z,Z[4]=w*$+L*W+j*V,Z[5]=w*Q+L*G+j*H,Z[6]=R*Y+O*K+N*z,Z[7]=R*$+O*W+N*V,Z[8]=R*Q+O*G+N*H,Z}function K86(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=J[8],q=X[0],F=X[1];return Z[0]=Y,Z[1]=$,Z[2]=Q,Z[3]=K,Z[4]=W,Z[5]=G,Z[6]=q*Y+F*K+z,Z[7]=q*$+F*W+V,Z[8]=q*Q+F*G+H,Z}function W86(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=J[8],q=Math.sin(X),F=Math.cos(X);return Z[0]=F*Y+q*K,Z[1]=F*$+q*W,Z[2]=F*Q+q*G,Z[3]=F*K-q*Y,Z[4]=F*W-q*$,Z[5]=F*G-q*Q,Z[6]=z,Z[7]=V,Z[8]=H,Z}function G86(Z,J,X){var Y=X[0],$=X[1];return Z[0]=Y*J[0],Z[1]=Y*J[1],Z[2]=Y*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 z86(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 V86(Z,J){var X=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=X,Z[2]=0,Z[3]=-X,Z[4]=Y,Z[5]=0,Z[6]=0,Z[7]=0,Z[8]=1,Z}function H86(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 q86(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 F86(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=X+X,W=Y+Y,G=$+$,z=X*K,V=Y*K,H=Y*W,q=$*K,F=$*W,U=$*G,w=Q*K,L=Q*W,j=Q*G;return Z[0]=1-H-U,Z[3]=V-j,Z[6]=q+L,Z[1]=V+j,Z[4]=1-z-U,Z[7]=F-w,Z[2]=q-L,Z[5]=F+w,Z[8]=1-z-H,Z}function U86(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=J[4],W=J[5],G=J[6],z=J[7],V=J[8],H=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],j=J[15],R=X*W-Y*K,O=X*G-$*K,N=X*z-Q*K,D=Y*G-$*W,P=Y*z-Q*W,C=$*z-Q*G,T=V*w-H*U,k=V*L-q*U,A=V*j-F*U,S=H*L-q*w,x=H*j-F*w,I=q*j-F*L,v=R*I-O*x+N*S+D*A-P*k+C*T;if(!v)return null;return v=1/v,Z[0]=(W*I-G*x+z*S)*v,Z[1]=(G*A-K*I-z*k)*v,Z[2]=(K*x-W*A+z*T)*v,Z[3]=($*x-Y*I-Q*S)*v,Z[4]=(X*I-$*A+Q*k)*v,Z[5]=(Y*A-X*x-Q*T)*v,Z[6]=(w*C-L*P+j*D)*v,Z[7]=(L*N-U*C-j*O)*v,Z[8]=(U*P-w*N+j*R)*v,Z}function L86(Z,J,X){return Z[0]=2/J,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=-2/X,Z[5]=0,Z[6]=-1,Z[7]=1,Z[8]=1,Z}function w86(Z){return"mat3("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+")"}function B86(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8])}function j86(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z[4]=J[4]+X[4],Z[5]=J[5]+X[5],Z[6]=J[6]+X[6],Z[7]=J[7]+X[7],Z[8]=J[8]+X[8],Z}function IJ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z[3]=J[3]-X[3],Z[4]=J[4]-X[4],Z[5]=J[5]-X[5],Z[6]=J[6]-X[6],Z[7]=J[7]-X[7],Z[8]=J[8]-X[8],Z}function O86(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z[4]=J[4]*X,Z[5]=J[5]*X,Z[6]=J[6]*X,Z[7]=J[7]*X,Z[8]=J[8]*X,Z}function M86(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z[3]=J[3]+X[3]*Y,Z[4]=J[4]+X[4]*Y,Z[5]=J[5]+X[5]*Y,Z[6]=J[6]+X[6]*Y,Z[7]=J[7]+X[7]*Y,Z[8]=J[8]+X[8]*Y,Z}function R86(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 N86(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],K=Z[4],W=Z[5],G=Z[6],z=Z[7],V=Z[8],H=J[0],q=J[1],F=J[2],U=J[3],w=J[4],L=J[5],j=J[6],R=J[7],O=J[8];return Math.abs(X-H)<=P0*Math.max(1,Math.abs(X),Math.abs(H))&&Math.abs(Y-q)<=P0*Math.max(1,Math.abs(Y),Math.abs(q))&&Math.abs($-F)<=P0*Math.max(1,Math.abs($),Math.abs(F))&&Math.abs(Q-U)<=P0*Math.max(1,Math.abs(Q),Math.abs(U))&&Math.abs(K-w)<=P0*Math.max(1,Math.abs(K),Math.abs(w))&&Math.abs(W-L)<=P0*Math.max(1,Math.abs(W),Math.abs(L))&&Math.abs(G-j)<=P0*Math.max(1,Math.abs(G),Math.abs(j))&&Math.abs(z-R)<=P0*Math.max(1,Math.abs(z),Math.abs(R))&&Math.abs(V-O)<=P0*Math.max(1,Math.abs(V),Math.abs(O))}var P86=EJ1,D86=IJ1;var o0={};d4(o0,{transpose:()=>v86,translate:()=>x86,targetTo:()=>Q66,subtract:()=>fJ1,sub:()=>U66,str:()=>K66,set:()=>I86,scale:()=>h86,rotateZ:()=>g86,rotateY:()=>y86,rotateX:()=>b86,rotate:()=>f86,perspectiveZO:()=>Z66,perspectiveNO:()=>xJ1,perspectiveFromFieldOfView:()=>J66,perspective:()=>e86,orthoZO:()=>Y66,orthoNO:()=>hJ1,ortho:()=>X66,multiplyScalarAndAdd:()=>V66,multiplyScalar:()=>z66,multiply:()=>SJ1,mul:()=>F66,lookAt:()=>$66,invert:()=>S86,identity:()=>vJ1,getTranslation:()=>n86,getScaling:()=>AJ1,getRotation:()=>a86,frustum:()=>t86,fromZRotation:()=>p86,fromYRotation:()=>l86,fromXRotation:()=>c86,fromValues:()=>E86,fromTranslation:()=>m86,fromScaling:()=>u86,fromRotationTranslationScaleOrigin:()=>o86,fromRotationTranslationScale:()=>s86,fromRotationTranslation:()=>_J1,fromRotation:()=>d86,fromQuat2:()=>i86,fromQuat:()=>r86,frob:()=>W66,exactEquals:()=>H66,equals:()=>q66,determinant:()=>A86,create:()=>C86,copy:()=>k86,clone:()=>T86,adjoint:()=>_86,add:()=>G66});function C86(){var Z=new Y1(16);if(Y1!=Float32Array)Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0;return Z[0]=1,Z[5]=1,Z[10]=1,Z[15]=1,Z}function T86(Z){var J=new Y1(16);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J[4]=Z[4],J[5]=Z[5],J[6]=Z[6],J[7]=Z[7],J[8]=Z[8],J[9]=Z[9],J[10]=Z[10],J[11]=Z[11],J[12]=Z[12],J[13]=Z[13],J[14]=Z[14],J[15]=Z[15],J}function k86(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 E86(Z,J,X,Y,$,Q,K,W,G,z,V,H,q,F,U,w){var L=new Y1(16);return L[0]=Z,L[1]=J,L[2]=X,L[3]=Y,L[4]=$,L[5]=Q,L[6]=K,L[7]=W,L[8]=G,L[9]=z,L[10]=V,L[11]=H,L[12]=q,L[13]=F,L[14]=U,L[15]=w,L}function I86(Z,J,X,Y,$,Q,K,W,G,z,V,H,q,F,U,w,L){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z[4]=Q,Z[5]=K,Z[6]=W,Z[7]=G,Z[8]=z,Z[9]=V,Z[10]=H,Z[11]=q,Z[12]=F,Z[13]=U,Z[14]=w,Z[15]=L,Z}function vJ1(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 v86(Z,J){if(Z===J){var X=J[1],Y=J[2],$=J[3],Q=J[6],K=J[7],W=J[11];Z[1]=J[4],Z[2]=J[8],Z[3]=J[12],Z[4]=X,Z[6]=J[9],Z[7]=J[13],Z[8]=Y,Z[9]=Q,Z[11]=J[14],Z[12]=$,Z[13]=K,Z[14]=W}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 S86(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=J[4],W=J[5],G=J[6],z=J[7],V=J[8],H=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],j=J[15],R=X*W-Y*K,O=X*G-$*K,N=X*z-Q*K,D=Y*G-$*W,P=Y*z-Q*W,C=$*z-Q*G,T=V*w-H*U,k=V*L-q*U,A=V*j-F*U,S=H*L-q*w,x=H*j-F*w,I=q*j-F*L,v=R*I-O*x+N*S+D*A-P*k+C*T;if(!v)return null;return v=1/v,Z[0]=(W*I-G*x+z*S)*v,Z[1]=($*x-Y*I-Q*S)*v,Z[2]=(w*C-L*P+j*D)*v,Z[3]=(q*P-H*C-F*D)*v,Z[4]=(G*A-K*I-z*k)*v,Z[5]=(X*I-$*A+Q*k)*v,Z[6]=(L*N-U*C-j*O)*v,Z[7]=(V*C-q*N+F*O)*v,Z[8]=(K*x-W*A+z*T)*v,Z[9]=(Y*A-X*x-Q*T)*v,Z[10]=(U*P-w*N+j*R)*v,Z[11]=(H*N-V*P-F*R)*v,Z[12]=(W*k-K*S-G*T)*v,Z[13]=(X*S-Y*k+$*T)*v,Z[14]=(w*O-U*D-L*R)*v,Z[15]=(V*D-H*O+q*R)*v,Z}function _86(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=J[4],W=J[5],G=J[6],z=J[7],V=J[8],H=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],j=J[15];return Z[0]=W*(q*j-F*L)-H*(G*j-z*L)+w*(G*F-z*q),Z[1]=-(Y*(q*j-F*L)-H*($*j-Q*L)+w*($*F-Q*q)),Z[2]=Y*(G*j-z*L)-W*($*j-Q*L)+w*($*z-Q*G),Z[3]=-(Y*(G*F-z*q)-W*($*F-Q*q)+H*($*z-Q*G)),Z[4]=-(K*(q*j-F*L)-V*(G*j-z*L)+U*(G*F-z*q)),Z[5]=X*(q*j-F*L)-V*($*j-Q*L)+U*($*F-Q*q),Z[6]=-(X*(G*j-z*L)-K*($*j-Q*L)+U*($*z-Q*G)),Z[7]=X*(G*F-z*q)-K*($*F-Q*q)+V*($*z-Q*G),Z[8]=K*(H*j-F*w)-V*(W*j-z*w)+U*(W*F-z*H),Z[9]=-(X*(H*j-F*w)-V*(Y*j-Q*w)+U*(Y*F-Q*H)),Z[10]=X*(W*j-z*w)-K*(Y*j-Q*w)+U*(Y*z-Q*W),Z[11]=-(X*(W*F-z*H)-K*(Y*F-Q*H)+V*(Y*z-Q*W)),Z[12]=-(K*(H*L-q*w)-V*(W*L-G*w)+U*(W*q-G*H)),Z[13]=X*(H*L-q*w)-V*(Y*L-$*w)+U*(Y*q-$*H),Z[14]=-(X*(W*L-G*w)-K*(Y*L-$*w)+U*(Y*G-$*W)),Z[15]=X*(W*q-G*H)-K*(Y*q-$*H)+V*(Y*G-$*W),Z}function A86(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],K=Z[5],W=Z[6],G=Z[7],z=Z[8],V=Z[9],H=Z[10],q=Z[11],F=Z[12],U=Z[13],w=Z[14],L=Z[15],j=J*K-X*Q,R=J*W-Y*Q,O=J*G-$*Q,N=X*W-Y*K,D=X*G-$*K,P=Y*G-$*W,C=z*U-V*F,T=z*w-H*F,k=z*L-q*F,A=V*w-H*U,S=V*L-q*U,x=H*L-q*w;return j*x-R*S+O*A+N*k-D*T+P*C}function SJ1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=J[8],q=J[9],F=J[10],U=J[11],w=J[12],L=J[13],j=J[14],R=J[15],O=X[0],N=X[1],D=X[2],P=X[3];return Z[0]=O*Y+N*W+D*H+P*w,Z[1]=O*$+N*G+D*q+P*L,Z[2]=O*Q+N*z+D*F+P*j,Z[3]=O*K+N*V+D*U+P*R,O=X[4],N=X[5],D=X[6],P=X[7],Z[4]=O*Y+N*W+D*H+P*w,Z[5]=O*$+N*G+D*q+P*L,Z[6]=O*Q+N*z+D*F+P*j,Z[7]=O*K+N*V+D*U+P*R,O=X[8],N=X[9],D=X[10],P=X[11],Z[8]=O*Y+N*W+D*H+P*w,Z[9]=O*$+N*G+D*q+P*L,Z[10]=O*Q+N*z+D*F+P*j,Z[11]=O*K+N*V+D*U+P*R,O=X[12],N=X[13],D=X[14],P=X[15],Z[12]=O*Y+N*W+D*H+P*w,Z[13]=O*$+N*G+D*q+P*L,Z[14]=O*Q+N*z+D*F+P*j,Z[15]=O*K+N*V+D*U+P*R,Z}function x86(Z,J,X){var Y=X[0],$=X[1],Q=X[2],K,W,G,z,V,H,q,F,U,w,L,j;if(J===Z)Z[12]=J[0]*Y+J[4]*$+J[8]*Q+J[12],Z[13]=J[1]*Y+J[5]*$+J[9]*Q+J[13],Z[14]=J[2]*Y+J[6]*$+J[10]*Q+J[14],Z[15]=J[3]*Y+J[7]*$+J[11]*Q+J[15];else K=J[0],W=J[1],G=J[2],z=J[3],V=J[4],H=J[5],q=J[6],F=J[7],U=J[8],w=J[9],L=J[10],j=J[11],Z[0]=K,Z[1]=W,Z[2]=G,Z[3]=z,Z[4]=V,Z[5]=H,Z[6]=q,Z[7]=F,Z[8]=U,Z[9]=w,Z[10]=L,Z[11]=j,Z[12]=K*Y+V*$+U*Q+J[12],Z[13]=W*Y+H*$+w*Q+J[13],Z[14]=G*Y+q*$+L*Q+J[14],Z[15]=z*Y+F*$+j*Q+J[15];return Z}function h86(Z,J,X){var Y=X[0],$=X[1],Q=X[2];return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z[2]=J[2]*Y,Z[3]=J[3]*Y,Z[4]=J[4]*$,Z[5]=J[5]*$,Z[6]=J[6]*$,Z[7]=J[7]*$,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 f86(Z,J,X,Y){var $=Y[0],Q=Y[1],K=Y[2],W=Math.hypot($,Q,K),G,z,V,H,q,F,U,w,L,j,R,O,N,D,P,C,T,k,A,S,x,I,v,f;if(W<P0)return null;if(W=1/W,$*=W,Q*=W,K*=W,G=Math.sin(X),z=Math.cos(X),V=1-z,H=J[0],q=J[1],F=J[2],U=J[3],w=J[4],L=J[5],j=J[6],R=J[7],O=J[8],N=J[9],D=J[10],P=J[11],C=$*$*V+z,T=Q*$*V+K*G,k=K*$*V-Q*G,A=$*Q*V-K*G,S=Q*Q*V+z,x=K*Q*V+$*G,I=$*K*V+Q*G,v=Q*K*V-$*G,f=K*K*V+z,Z[0]=H*C+w*T+O*k,Z[1]=q*C+L*T+N*k,Z[2]=F*C+j*T+D*k,Z[3]=U*C+R*T+P*k,Z[4]=H*A+w*S+O*x,Z[5]=q*A+L*S+N*x,Z[6]=F*A+j*S+D*x,Z[7]=U*A+R*S+P*x,Z[8]=H*I+w*v+O*f,Z[9]=q*I+L*v+N*f,Z[10]=F*I+j*v+D*f,Z[11]=U*I+R*v+P*f,J!==Z)Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z}function b86(Z,J,X){var Y=Math.sin(X),$=Math.cos(X),Q=J[4],K=J[5],W=J[6],G=J[7],z=J[8],V=J[9],H=J[10],q=J[11];if(J!==Z)Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[4]=Q*$+z*Y,Z[5]=K*$+V*Y,Z[6]=W*$+H*Y,Z[7]=G*$+q*Y,Z[8]=z*$-Q*Y,Z[9]=V*$-K*Y,Z[10]=H*$-W*Y,Z[11]=q*$-G*Y,Z}function y86(Z,J,X){var Y=Math.sin(X),$=Math.cos(X),Q=J[0],K=J[1],W=J[2],G=J[3],z=J[8],V=J[9],H=J[10],q=J[11];if(J!==Z)Z[4]=J[4],Z[5]=J[5],Z[6]=J[6],Z[7]=J[7],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[0]=Q*$-z*Y,Z[1]=K*$-V*Y,Z[2]=W*$-H*Y,Z[3]=G*$-q*Y,Z[8]=Q*Y+z*$,Z[9]=K*Y+V*$,Z[10]=W*Y+H*$,Z[11]=G*Y+q*$,Z}function g86(Z,J,X){var Y=Math.sin(X),$=Math.cos(X),Q=J[0],K=J[1],W=J[2],G=J[3],z=J[4],V=J[5],H=J[6],q=J[7];if(J!==Z)Z[8]=J[8],Z[9]=J[9],Z[10]=J[10],Z[11]=J[11],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[0]=Q*$+z*Y,Z[1]=K*$+V*Y,Z[2]=W*$+H*Y,Z[3]=G*$+q*Y,Z[4]=z*$-Q*Y,Z[5]=V*$-K*Y,Z[6]=H*$-W*Y,Z[7]=q*$-G*Y,Z}function m86(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 u86(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 d86(Z,J,X){var Y=X[0],$=X[1],Q=X[2],K=Math.hypot(Y,$,Q),W,G,z;if(K<P0)return null;return K=1/K,Y*=K,$*=K,Q*=K,W=Math.sin(J),G=Math.cos(J),z=1-G,Z[0]=Y*Y*z+G,Z[1]=$*Y*z+Q*W,Z[2]=Q*Y*z-$*W,Z[3]=0,Z[4]=Y*$*z-Q*W,Z[5]=$*$*z+G,Z[6]=Q*$*z+Y*W,Z[7]=0,Z[8]=Y*Q*z+$*W,Z[9]=$*Q*z-Y*W,Z[10]=Q*Q*z+G,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function c86(Z,J){var X=Math.sin(J),Y=Math.cos(J);return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=Y,Z[6]=X,Z[7]=0,Z[8]=0,Z[9]=-X,Z[10]=Y,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function l86(Z,J){var X=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=0,Z[2]=-X,Z[3]=0,Z[4]=0,Z[5]=1,Z[6]=0,Z[7]=0,Z[8]=X,Z[9]=0,Z[10]=Y,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function p86(Z,J){var X=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=X,Z[2]=0,Z[3]=0,Z[4]=-X,Z[5]=Y,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=1,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function _J1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=Y+Y,G=$+$,z=Q+Q,V=Y*W,H=Y*G,q=Y*z,F=$*G,U=$*z,w=Q*z,L=K*W,j=K*G,R=K*z;return Z[0]=1-(F+w),Z[1]=H+R,Z[2]=q-j,Z[3]=0,Z[4]=H-R,Z[5]=1-(V+w),Z[6]=U+L,Z[7]=0,Z[8]=q+j,Z[9]=U-L,Z[10]=1-(V+F),Z[11]=0,Z[12]=X[0],Z[13]=X[1],Z[14]=X[2],Z[15]=1,Z}function i86(Z,J){var X=new Y1(3),Y=-J[0],$=-J[1],Q=-J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=Y*Y+$*$+Q*Q+K*K;if(H>0)X[0]=(W*K+V*Y+G*Q-z*$)*2/H,X[1]=(G*K+V*$+z*Y-W*Q)*2/H,X[2]=(z*K+V*Q+W*$-G*Y)*2/H;else X[0]=(W*K+V*Y+G*Q-z*$)*2,X[1]=(G*K+V*$+z*Y-W*Q)*2,X[2]=(z*K+V*Q+W*$-G*Y)*2;return _J1(Z,J,X),Z}function n86(Z,J){return Z[0]=J[12],Z[1]=J[13],Z[2]=J[14],Z}function AJ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[4],K=J[5],W=J[6],G=J[8],z=J[9],V=J[10];return Z[0]=Math.hypot(X,Y,$),Z[1]=Math.hypot(Q,K,W),Z[2]=Math.hypot(G,z,V),Z}function a86(Z,J){var X=new Y1(3);AJ1(X,J);var Y=1/X[0],$=1/X[1],Q=1/X[2],K=J[0]*Y,W=J[1]*$,G=J[2]*Q,z=J[4]*Y,V=J[5]*$,H=J[6]*Q,q=J[8]*Y,F=J[9]*$,U=J[10]*Q,w=K+V+U,L=0;if(w>0)L=Math.sqrt(w+1)*2,Z[3]=0.25*L,Z[0]=(H-F)/L,Z[1]=(q-G)/L,Z[2]=(W-z)/L;else if(K>V&&K>U)L=Math.sqrt(1+K-V-U)*2,Z[3]=(H-F)/L,Z[0]=0.25*L,Z[1]=(W+z)/L,Z[2]=(q+G)/L;else if(V>U)L=Math.sqrt(1+V-K-U)*2,Z[3]=(q-G)/L,Z[0]=(W+z)/L,Z[1]=0.25*L,Z[2]=(H+F)/L;else L=Math.sqrt(1+U-K-V)*2,Z[3]=(W-z)/L,Z[0]=(q+G)/L,Z[1]=(H+F)/L,Z[2]=0.25*L;return Z}function s86(Z,J,X,Y){var $=J[0],Q=J[1],K=J[2],W=J[3],G=$+$,z=Q+Q,V=K+K,H=$*G,q=$*z,F=$*V,U=Q*z,w=Q*V,L=K*V,j=W*G,R=W*z,O=W*V,N=Y[0],D=Y[1],P=Y[2];return Z[0]=(1-(U+L))*N,Z[1]=(q+O)*N,Z[2]=(F-R)*N,Z[3]=0,Z[4]=(q-O)*D,Z[5]=(1-(H+L))*D,Z[6]=(w+j)*D,Z[7]=0,Z[8]=(F+R)*P,Z[9]=(w-j)*P,Z[10]=(1-(H+U))*P,Z[11]=0,Z[12]=X[0],Z[13]=X[1],Z[14]=X[2],Z[15]=1,Z}function o86(Z,J,X,Y,$){var Q=J[0],K=J[1],W=J[2],G=J[3],z=Q+Q,V=K+K,H=W+W,q=Q*z,F=Q*V,U=Q*H,w=K*V,L=K*H,j=W*H,R=G*z,O=G*V,N=G*H,D=Y[0],P=Y[1],C=Y[2],T=$[0],k=$[1],A=$[2],S=(1-(w+j))*D,x=(F+N)*D,I=(U-O)*D,v=(F-N)*P,f=(1-(q+j))*P,p=(L+R)*P,n=(U+O)*C,o=(L-R)*C,J0=(1-(q+w))*C;return Z[0]=S,Z[1]=x,Z[2]=I,Z[3]=0,Z[4]=v,Z[5]=f,Z[6]=p,Z[7]=0,Z[8]=n,Z[9]=o,Z[10]=J0,Z[11]=0,Z[12]=X[0]+T-(S*T+v*k+n*A),Z[13]=X[1]+k-(x*T+f*k+o*A),Z[14]=X[2]+A-(I*T+p*k+J0*A),Z[15]=1,Z}function r86(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=X+X,W=Y+Y,G=$+$,z=X*K,V=Y*K,H=Y*W,q=$*K,F=$*W,U=$*G,w=Q*K,L=Q*W,j=Q*G;return Z[0]=1-H-U,Z[1]=V+j,Z[2]=q-L,Z[3]=0,Z[4]=V-j,Z[5]=1-z-U,Z[6]=F+w,Z[7]=0,Z[8]=q+L,Z[9]=F-w,Z[10]=1-z-H,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function t86(Z,J,X,Y,$,Q,K){var W=1/(X-J),G=1/($-Y),z=1/(Q-K);return Z[0]=Q*2*W,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]=(X+J)*W,Z[9]=($+Y)*G,Z[10]=(K+Q)*z,Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=K*Q*2*z,Z[15]=0,Z}function xJ1(Z,J,X,Y,$){var Q=1/Math.tan(J/2),K;if(Z[0]=Q/X,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,$!=null&&$!==1/0)K=1/(Y-$),Z[10]=($+Y)*K,Z[14]=2*$*Y*K;else Z[10]=-1,Z[14]=-2*Y;return Z}var e86=xJ1;function Z66(Z,J,X,Y,$){var Q=1/Math.tan(J/2),K;if(Z[0]=Q/X,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,$!=null&&$!==1/0)K=1/(Y-$),Z[10]=$*K,Z[14]=$*Y*K;else Z[10]=-1,Z[14]=-Y;return Z}function J66(Z,J,X,Y){var $=Math.tan(J.upDegrees*Math.PI/180),Q=Math.tan(J.downDegrees*Math.PI/180),K=Math.tan(J.leftDegrees*Math.PI/180),W=Math.tan(J.rightDegrees*Math.PI/180),G=2/(K+W),z=2/($+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]=-((K-W)*G*0.5),Z[9]=($-Q)*z*0.5,Z[10]=Y/(X-Y),Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=Y*X/(X-Y),Z[15]=0,Z}function hJ1(Z,J,X,Y,$,Q,K){var W=1/(J-X),G=1/(Y-$),z=1/(Q-K);return Z[0]=-2*W,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+X)*W,Z[13]=($+Y)*G,Z[14]=(K+Q)*z,Z[15]=1,Z}var X66=hJ1;function Y66(Z,J,X,Y,$,Q,K){var W=1/(J-X),G=1/(Y-$),z=1/(Q-K);return Z[0]=-2*W,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+X)*W,Z[13]=($+Y)*G,Z[14]=Q*z,Z[15]=1,Z}function $66(Z,J,X,Y){var $,Q,K,W,G,z,V,H,q,F,U=J[0],w=J[1],L=J[2],j=Y[0],R=Y[1],O=Y[2],N=X[0],D=X[1],P=X[2];if(Math.abs(U-N)<P0&&Math.abs(w-D)<P0&&Math.abs(L-P)<P0)return vJ1(Z);if(V=U-N,H=w-D,q=L-P,F=1/Math.hypot(V,H,q),V*=F,H*=F,q*=F,$=R*q-O*H,Q=O*V-j*q,K=j*H-R*V,F=Math.hypot($,Q,K),!F)$=0,Q=0,K=0;else F=1/F,$*=F,Q*=F,K*=F;if(W=H*K-q*Q,G=q*$-V*K,z=V*Q-H*$,F=Math.hypot(W,G,z),!F)W=0,G=0,z=0;else F=1/F,W*=F,G*=F,z*=F;return Z[0]=$,Z[1]=W,Z[2]=V,Z[3]=0,Z[4]=Q,Z[5]=G,Z[6]=H,Z[7]=0,Z[8]=K,Z[9]=z,Z[10]=q,Z[11]=0,Z[12]=-($*U+Q*w+K*L),Z[13]=-(W*U+G*w+z*L),Z[14]=-(V*U+H*w+q*L),Z[15]=1,Z}function Q66(Z,J,X,Y){var $=J[0],Q=J[1],K=J[2],W=Y[0],G=Y[1],z=Y[2],V=$-X[0],H=Q-X[1],q=K-X[2],F=V*V+H*H+q*q;if(F>0)F=1/Math.sqrt(F),V*=F,H*=F,q*=F;var U=G*q-z*H,w=z*V-W*q,L=W*H-G*V;if(F=U*U+w*w+L*L,F>0)F=1/Math.sqrt(F),U*=F,w*=F,L*=F;return Z[0]=U,Z[1]=w,Z[2]=L,Z[3]=0,Z[4]=H*L-q*w,Z[5]=q*U-V*L,Z[6]=V*w-H*U,Z[7]=0,Z[8]=V,Z[9]=H,Z[10]=q,Z[11]=0,Z[12]=$,Z[13]=Q,Z[14]=K,Z[15]=1,Z}function K66(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 W66(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 G66(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z[4]=J[4]+X[4],Z[5]=J[5]+X[5],Z[6]=J[6]+X[6],Z[7]=J[7]+X[7],Z[8]=J[8]+X[8],Z[9]=J[9]+X[9],Z[10]=J[10]+X[10],Z[11]=J[11]+X[11],Z[12]=J[12]+X[12],Z[13]=J[13]+X[13],Z[14]=J[14]+X[14],Z[15]=J[15]+X[15],Z}function fJ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z[3]=J[3]-X[3],Z[4]=J[4]-X[4],Z[5]=J[5]-X[5],Z[6]=J[6]-X[6],Z[7]=J[7]-X[7],Z[8]=J[8]-X[8],Z[9]=J[9]-X[9],Z[10]=J[10]-X[10],Z[11]=J[11]-X[11],Z[12]=J[12]-X[12],Z[13]=J[13]-X[13],Z[14]=J[14]-X[14],Z[15]=J[15]-X[15],Z}function z66(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z[4]=J[4]*X,Z[5]=J[5]*X,Z[6]=J[6]*X,Z[7]=J[7]*X,Z[8]=J[8]*X,Z[9]=J[9]*X,Z[10]=J[10]*X,Z[11]=J[11]*X,Z[12]=J[12]*X,Z[13]=J[13]*X,Z[14]=J[14]*X,Z[15]=J[15]*X,Z}function V66(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z[3]=J[3]+X[3]*Y,Z[4]=J[4]+X[4]*Y,Z[5]=J[5]+X[5]*Y,Z[6]=J[6]+X[6]*Y,Z[7]=J[7]+X[7]*Y,Z[8]=J[8]+X[8]*Y,Z[9]=J[9]+X[9]*Y,Z[10]=J[10]+X[10]*Y,Z[11]=J[11]+X[11]*Y,Z[12]=J[12]+X[12]*Y,Z[13]=J[13]+X[13]*Y,Z[14]=J[14]+X[14]*Y,Z[15]=J[15]+X[15]*Y,Z}function H66(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]&&Z[4]===J[4]&&Z[5]===J[5]&&Z[6]===J[6]&&Z[7]===J[7]&&Z[8]===J[8]&&Z[9]===J[9]&&Z[10]===J[10]&&Z[11]===J[11]&&Z[12]===J[12]&&Z[13]===J[13]&&Z[14]===J[14]&&Z[15]===J[15]}function q66(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],K=Z[4],W=Z[5],G=Z[6],z=Z[7],V=Z[8],H=Z[9],q=Z[10],F=Z[11],U=Z[12],w=Z[13],L=Z[14],j=Z[15],R=J[0],O=J[1],N=J[2],D=J[3],P=J[4],C=J[5],T=J[6],k=J[7],A=J[8],S=J[9],x=J[10],I=J[11],v=J[12],f=J[13],p=J[14],n=J[15];return Math.abs(X-R)<=P0*Math.max(1,Math.abs(X),Math.abs(R))&&Math.abs(Y-O)<=P0*Math.max(1,Math.abs(Y),Math.abs(O))&&Math.abs($-N)<=P0*Math.max(1,Math.abs($),Math.abs(N))&&Math.abs(Q-D)<=P0*Math.max(1,Math.abs(Q),Math.abs(D))&&Math.abs(K-P)<=P0*Math.max(1,Math.abs(K),Math.abs(P))&&Math.abs(W-C)<=P0*Math.max(1,Math.abs(W),Math.abs(C))&&Math.abs(G-T)<=P0*Math.max(1,Math.abs(G),Math.abs(T))&&Math.abs(z-k)<=P0*Math.max(1,Math.abs(z),Math.abs(k))&&Math.abs(V-A)<=P0*Math.max(1,Math.abs(V),Math.abs(A))&&Math.abs(H-S)<=P0*Math.max(1,Math.abs(H),Math.abs(S))&&Math.abs(q-x)<=P0*Math.max(1,Math.abs(q),Math.abs(x))&&Math.abs(F-I)<=P0*Math.max(1,Math.abs(F),Math.abs(I))&&Math.abs(U-v)<=P0*Math.max(1,Math.abs(U),Math.abs(v))&&Math.abs(w-f)<=P0*Math.max(1,Math.abs(w),Math.abs(f))&&Math.abs(L-p)<=P0*Math.max(1,Math.abs(L),Math.abs(p))&&Math.abs(j-n)<=P0*Math.max(1,Math.abs(j),Math.abs(n))}var F66=SJ1,U66=fJ1;var R1={};d4(R1,{str:()=>V56,squaredLength:()=>HX1,sqrLen:()=>O56,sqlerp:()=>P56,slerp:()=>UM,setAxisAngle:()=>YX1,setAxes:()=>D56,set:()=>U56,scale:()=>GX1,rotationTo:()=>N56,rotateZ:()=>Y56,rotateY:()=>X56,rotateX:()=>J56,random:()=>K56,pow:()=>Q56,normalize:()=>qf,multiply:()=>$X1,mul:()=>w56,ln:()=>KX1,lerp:()=>B56,length:()=>VX1,len:()=>j56,invert:()=>W56,identity:()=>t66,getAxisAngle:()=>e66,getAngle:()=>Z56,fromValues:()=>q56,fromMat3:()=>WX1,fromEuler:()=>z56,exp:()=>QX1,exactEquals:()=>M56,equals:()=>R56,dot:()=>zX1,create:()=>Hf,copy:()=>F56,conjugate:()=>G56,clone:()=>H56,calculateW:()=>$56,add:()=>L56});var t0={};d4(t0,{zero:()=>g66,transformQuat:()=>x66,transformMat4:()=>_66,transformMat3:()=>A66,subtract:()=>yJ1,sub:()=>c66,str:()=>m66,squaredLength:()=>cJ1,squaredDistance:()=>dJ1,sqrLen:()=>a66,sqrDist:()=>n66,set:()=>B66,scaleAndAdd:()=>C66,scale:()=>D66,round:()=>P66,rotateZ:()=>b66,rotateY:()=>f66,rotateX:()=>h66,random:()=>S66,normalize:()=>zf,negate:()=>T66,multiply:()=>gJ1,mul:()=>l66,min:()=>R66,max:()=>N66,lerp:()=>E66,length:()=>bJ1,len:()=>Vf,inverse:()=>k66,hermite:()=>I66,fromValues:()=>qM,forEach:()=>s66,floor:()=>M66,exactEquals:()=>u66,equals:()=>d66,dot:()=>FM,divide:()=>mJ1,div:()=>p66,distance:()=>uJ1,dist:()=>i66,cross:()=>Bq,create:()=>HM,copy:()=>w66,clone:()=>L66,ceil:()=>O66,bezier:()=>v66,angle:()=>y66,add:()=>j66});function HM(){var Z=new Y1(3);if(Y1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function L66(Z){var J=new Y1(3);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J}function bJ1(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function qM(Z,J,X){var Y=new Y1(3);return Y[0]=Z,Y[1]=J,Y[2]=X,Y}function w66(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z}function B66(Z,J,X,Y){return Z[0]=J,Z[1]=X,Z[2]=Y,Z}function j66(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z}function yJ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z}function gJ1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z}function mJ1(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z[2]=J[2]/X[2],Z}function O66(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z[2]=Math.ceil(J[2]),Z}function M66(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z[2]=Math.floor(J[2]),Z}function R66(Z,J,X){return Z[0]=Math.min(J[0],X[0]),Z[1]=Math.min(J[1],X[1]),Z[2]=Math.min(J[2],X[2]),Z}function N66(Z,J,X){return Z[0]=Math.max(J[0],X[0]),Z[1]=Math.max(J[1],X[1]),Z[2]=Math.max(J[2],X[2]),Z}function P66(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z[2]=Math.round(J[2]),Z}function D66(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z}function C66(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z}function uJ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return Math.hypot(X,Y,$)}function dJ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return X*X+Y*Y+$*$}function cJ1(Z){var J=Z[0],X=Z[1],Y=Z[2];return J*J+X*X+Y*Y}function T66(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z}function k66(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z[2]=1/J[2],Z}function zf(Z,J){var X=J[0],Y=J[1],$=J[2],Q=X*X+Y*Y+$*$;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 FM(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]}function Bq(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=X[0],W=X[1],G=X[2];return Z[0]=$*G-Q*W,Z[1]=Q*K-Y*G,Z[2]=Y*W-$*K,Z}function E66(Z,J,X,Y){var $=J[0],Q=J[1],K=J[2];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z[2]=K+Y*(X[2]-K),Z}function I66(Z,J,X,Y,$,Q){var K=Q*Q,W=K*(2*Q-3)+1,G=K*(Q-2)+Q,z=K*(Q-1),V=K*(3-2*Q);return Z[0]=J[0]*W+X[0]*G+Y[0]*z+$[0]*V,Z[1]=J[1]*W+X[1]*G+Y[1]*z+$[1]*V,Z[2]=J[2]*W+X[2]*G+Y[2]*z+$[2]*V,Z}function v66(Z,J,X,Y,$,Q){var K=1-Q,W=K*K,G=Q*Q,z=W*K,V=3*Q*W,H=3*G*K,q=G*Q;return Z[0]=J[0]*z+X[0]*V+Y[0]*H+$[0]*q,Z[1]=J[1]*z+X[1]*V+Y[1]*H+$[1]*q,Z[2]=J[2]*z+X[2]*V+Y[2]*H+$[2]*q,Z}function S66(Z,J){J=J||1;var X=l7()*2*Math.PI,Y=l7()*2-1,$=Math.sqrt(1-Y*Y)*J;return Z[0]=Math.cos(X)*$,Z[1]=Math.sin(X)*$,Z[2]=Y*J,Z}function _66(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=X[3]*Y+X[7]*$+X[11]*Q+X[15];return K=K||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/K,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/K,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/K,Z}function A66(Z,J,X){var Y=J[0],$=J[1],Q=J[2];return Z[0]=Y*X[0]+$*X[3]+Q*X[6],Z[1]=Y*X[1]+$*X[4]+Q*X[7],Z[2]=Y*X[2]+$*X[5]+Q*X[8],Z}function x66(Z,J,X){var Y=X[0],$=X[1],Q=X[2],K=X[3],W=J[0],G=J[1],z=J[2],V=$*z-Q*G,H=Q*W-Y*z,q=Y*G-$*W,F=$*q-Q*H,U=Q*V-Y*q,w=Y*H-$*V,L=K*2;return V*=L,H*=L,q*=L,F*=2,U*=2,w*=2,Z[0]=W+V+F,Z[1]=G+H+U,Z[2]=z+q+w,Z}function h66(Z,J,X,Y){var $=[],Q=[];return $[0]=J[0]-X[0],$[1]=J[1]-X[1],$[2]=J[2]-X[2],Q[0]=$[0],Q[1]=$[1]*Math.cos(Y)-$[2]*Math.sin(Y),Q[2]=$[1]*Math.sin(Y)+$[2]*Math.cos(Y),Z[0]=Q[0]+X[0],Z[1]=Q[1]+X[1],Z[2]=Q[2]+X[2],Z}function f66(Z,J,X,Y){var $=[],Q=[];return $[0]=J[0]-X[0],$[1]=J[1]-X[1],$[2]=J[2]-X[2],Q[0]=$[2]*Math.sin(Y)+$[0]*Math.cos(Y),Q[1]=$[1],Q[2]=$[2]*Math.cos(Y)-$[0]*Math.sin(Y),Z[0]=Q[0]+X[0],Z[1]=Q[1]+X[1],Z[2]=Q[2]+X[2],Z}function b66(Z,J,X,Y){var $=[],Q=[];return $[0]=J[0]-X[0],$[1]=J[1]-X[1],$[2]=J[2]-X[2],Q[0]=$[0]*Math.cos(Y)-$[1]*Math.sin(Y),Q[1]=$[0]*Math.sin(Y)+$[1]*Math.cos(Y),Q[2]=$[2],Z[0]=Q[0]+X[0],Z[1]=Q[1]+X[1],Z[2]=Q[2]+X[2],Z}function y66(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=J[0],K=J[1],W=J[2],G=Math.sqrt(X*X+Y*Y+$*$),z=Math.sqrt(Q*Q+K*K+W*W),V=G*z,H=V&&FM(Z,J)/V;return Math.acos(Math.min(Math.max(H,-1),1))}function g66(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z}function m66(Z){return"vec3("+Z[0]+", "+Z[1]+", "+Z[2]+")"}function u66(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]}function d66(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=J[0],K=J[1],W=J[2];return Math.abs(X-Q)<=P0*Math.max(1,Math.abs(X),Math.abs(Q))&&Math.abs(Y-K)<=P0*Math.max(1,Math.abs(Y),Math.abs(K))&&Math.abs($-W)<=P0*Math.max(1,Math.abs($),Math.abs(W))}var c66=yJ1,l66=gJ1,p66=mJ1,i66=uJ1,n66=dJ1,Vf=bJ1,a66=cJ1,s66=function(){var Z=HM();return function(J,X,Y,$,Q,K){var W,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(W=Y;W<G;W+=X)Z[0]=J[W],Z[1]=J[W+1],Z[2]=J[W+2],Q(Z,Z,K),J[W]=Z[0],J[W+1]=Z[1],J[W+2]=Z[2];return J}}();function o66(){var Z=new Y1(4);if(Y1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function lJ1(Z){var J=new Y1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function pJ1(Z,J,X,Y){var $=new Y1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function iJ1(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function nJ1(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function aJ1(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z}function sJ1(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z}function oJ1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return Math.hypot(J,X,Y,$)}function rJ1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return J*J+X*X+Y*Y+$*$}function tJ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=X*X+Y*Y+$*$+Q*Q;if(K>0)K=1/Math.sqrt(K);return Z[0]=X*K,Z[1]=Y*K,Z[2]=$*K,Z[3]=Q*K,Z}function eJ1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}function ZX1(Z,J,X,Y){var $=J[0],Q=J[1],K=J[2],W=J[3];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z[2]=K+Y*(X[2]-K),Z[3]=W+Y*(X[3]-W),Z}function JX1(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function XX1(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],K=J[0],W=J[1],G=J[2],z=J[3];return Math.abs(X-K)<=P0*Math.max(1,Math.abs(X),Math.abs(K))&&Math.abs(Y-W)<=P0*Math.max(1,Math.abs(Y),Math.abs(W))&&Math.abs($-G)<=P0*Math.max(1,Math.abs($),Math.abs(G))&&Math.abs(Q-z)<=P0*Math.max(1,Math.abs(Q),Math.abs(z))}var Cs6=function(){var Z=o66();return function(J,X,Y,$,Q,K){var W,G;if(!X)X=4;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(W=Y;W<G;W+=X)Z[0]=J[W],Z[1]=J[W+1],Z[2]=J[W+2],Z[3]=J[W+3],Q(Z,Z,K),J[W]=Z[0],J[W+1]=Z[1],J[W+2]=Z[2],J[W+3]=Z[3];return J}}();function Hf(){var Z=new Y1(4);if(Y1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z[3]=1,Z}function t66(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=1,Z}function YX1(Z,J,X){X=X*0.5;var Y=Math.sin(X);return Z[0]=Y*J[0],Z[1]=Y*J[1],Z[2]=Y*J[2],Z[3]=Math.cos(X),Z}function e66(Z,J){var X=Math.acos(J[3])*2,Y=Math.sin(X/2);if(Y>P0)Z[0]=J[0]/Y,Z[1]=J[1]/Y,Z[2]=J[2]/Y;else Z[0]=1,Z[1]=0,Z[2]=0;return X}function Z56(Z,J){var X=zX1(Z,J);return Math.acos(2*X*X-1)}function $X1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=X[0],G=X[1],z=X[2],V=X[3];return Z[0]=Y*V+K*W+$*z-Q*G,Z[1]=$*V+K*G+Q*W-Y*z,Z[2]=Q*V+K*z+Y*G-$*W,Z[3]=K*V-Y*W-$*G-Q*z,Z}function J56(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],K=J[3],W=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+K*W,Z[1]=$*G+Q*W,Z[2]=Q*G-$*W,Z[3]=K*G-Y*W,Z}function X56(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],K=J[3],W=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G-Q*W,Z[1]=$*G+K*W,Z[2]=Q*G+Y*W,Z[3]=K*G-$*W,Z}function Y56(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],K=J[3],W=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+$*W,Z[1]=$*G-Y*W,Z[2]=Q*G+K*W,Z[3]=K*G-Q*W,Z}function $56(Z,J){var X=J[0],Y=J[1],$=J[2];return Z[0]=X,Z[1]=Y,Z[2]=$,Z[3]=Math.sqrt(Math.abs(1-X*X-Y*Y-$*$)),Z}function QX1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=Math.sqrt(X*X+Y*Y+$*$),W=Math.exp(Q),G=K>0?W*Math.sin(K)/K:0;return Z[0]=X*G,Z[1]=Y*G,Z[2]=$*G,Z[3]=W*Math.cos(K),Z}function KX1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=Math.sqrt(X*X+Y*Y+$*$),W=K>0?Math.atan2(K,Q)/K:0;return Z[0]=X*W,Z[1]=Y*W,Z[2]=$*W,Z[3]=0.5*Math.log(X*X+Y*Y+$*$+Q*Q),Z}function Q56(Z,J,X){return KX1(Z,J),GX1(Z,Z,X),QX1(Z,Z),Z}function UM(Z,J,X,Y){var $=J[0],Q=J[1],K=J[2],W=J[3],G=X[0],z=X[1],V=X[2],H=X[3],q,F,U,w,L;if(F=$*G+Q*z+K*V+W*H,F<0)F=-F,G=-G,z=-z,V=-V,H=-H;if(1-F>P0)q=Math.acos(F),U=Math.sin(q),w=Math.sin((1-Y)*q)/U,L=Math.sin(Y*q)/U;else w=1-Y,L=Y;return Z[0]=w*$+L*G,Z[1]=w*Q+L*z,Z[2]=w*K+L*V,Z[3]=w*W+L*H,Z}function K56(Z){var J=l7(),X=l7(),Y=l7(),$=Math.sqrt(1-J),Q=Math.sqrt(J);return Z[0]=$*Math.sin(2*Math.PI*X),Z[1]=$*Math.cos(2*Math.PI*X),Z[2]=Q*Math.sin(2*Math.PI*Y),Z[3]=Q*Math.cos(2*Math.PI*Y),Z}function W56(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=X*X+Y*Y+$*$+Q*Q,W=K?1/K:0;return Z[0]=-X*W,Z[1]=-Y*W,Z[2]=-$*W,Z[3]=Q*W,Z}function G56(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z[3]=J[3],Z}function WX1(Z,J){var X=J[0]+J[4]+J[8],Y;if(X>0)Y=Math.sqrt(X+1),Z[3]=0.5*Y,Y=0.5/Y,Z[0]=(J[5]-J[7])*Y,Z[1]=(J[6]-J[2])*Y,Z[2]=(J[1]-J[3])*Y;else{var $=0;if(J[4]>J[0])$=1;if(J[8]>J[$*3+$])$=2;var Q=($+1)%3,K=($+2)%3;Y=Math.sqrt(J[$*3+$]-J[Q*3+Q]-J[K*3+K]+1),Z[$]=0.5*Y,Y=0.5/Y,Z[3]=(J[Q*3+K]-J[K*3+Q])*Y,Z[Q]=(J[Q*3+$]+J[$*3+Q])*Y,Z[K]=(J[K*3+$]+J[$*3+K])*Y}return Z}function z56(Z,J,X,Y){var $=0.5*Math.PI/180;J*=$,X*=$,Y*=$;var Q=Math.sin(J),K=Math.cos(J),W=Math.sin(X),G=Math.cos(X),z=Math.sin(Y),V=Math.cos(Y);return Z[0]=Q*G*V-K*W*z,Z[1]=K*W*V+Q*G*z,Z[2]=K*G*z-Q*W*V,Z[3]=K*G*V+Q*W*z,Z}function V56(Z){return"quat("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}var H56=lJ1,q56=pJ1,F56=iJ1,U56=nJ1,L56=aJ1,w56=$X1,GX1=sJ1,zX1=eJ1,B56=ZX1,VX1=oJ1,j56=VX1,HX1=rJ1,O56=HX1,qf=tJ1,M56=JX1,R56=XX1,N56=function(){var Z=HM(),J=qM(1,0,0),X=qM(0,1,0);return function(Y,$,Q){var K=FM($,Q);if(K<-0.999999){if(Bq(Z,J,$),Vf(Z)<0.000001)Bq(Z,X,$);return zf(Z,Z),YX1(Y,Z,Math.PI),Y}else if(K>0.999999)return Y[0]=0,Y[1]=0,Y[2]=0,Y[3]=1,Y;else return Bq(Z,$,Q),Y[0]=Z[0],Y[1]=Z[1],Y[2]=Z[2],Y[3]=1+K,qf(Y,Y)}}(),P56=function(){var Z=Hf(),J=Hf();return function(X,Y,$,Q,K,W){return UM(Z,Y,K,W),UM(J,$,Q,W),UM(X,Z,J,2*W*(1-W)),X}}(),D56=function(){var Z=Gf();return function(J,X,Y,$){return Z[0]=Y[0],Z[3]=Y[1],Z[6]=Y[2],Z[1]=$[0],Z[4]=$[1],Z[7]=$[2],Z[2]=-X[0],Z[5]=-X[1],Z[8]=-X[2],qf(J,WX1(J,Z))}}();var K1={};d4(K1,{zero:()=>o56,transformMat4:()=>n56,transformMat3:()=>i56,transformMat2d:()=>p56,transformMat2:()=>l56,subtract:()=>FX1,sub:()=>J96,str:()=>r56,squaredLength:()=>OX1,squaredDistance:()=>BX1,sqrLen:()=>K96,sqrDist:()=>Q96,set:()=>E56,scaleAndAdd:()=>f56,scale:()=>h56,round:()=>x56,rotate:()=>a56,random:()=>c56,normalize:()=>g56,negate:()=>b56,multiply:()=>UX1,mul:()=>X96,min:()=>_56,max:()=>A56,lerp:()=>d56,length:()=>jX1,len:()=>Z96,inverse:()=>y56,fromValues:()=>T56,forEach:()=>W96,floor:()=>S56,exactEquals:()=>t56,equals:()=>e56,dot:()=>m56,divide:()=>LX1,div:()=>Y96,distance:()=>wX1,dist:()=>$96,cross:()=>u56,create:()=>qX1,copy:()=>k56,clone:()=>C56,ceil:()=>v56,angle:()=>s56,add:()=>I56});function qX1(){var Z=new Y1(2);if(Y1!=Float32Array)Z[0]=0,Z[1]=0;return Z}function C56(Z){var J=new Y1(2);return J[0]=Z[0],J[1]=Z[1],J}function T56(Z,J){var X=new Y1(2);return X[0]=Z,X[1]=J,X}function k56(Z,J){return Z[0]=J[0],Z[1]=J[1],Z}function E56(Z,J,X){return Z[0]=J,Z[1]=X,Z}function I56(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z}function FX1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z}function UX1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z}function LX1(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z}function v56(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z}function S56(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z}function _56(Z,J,X){return Z[0]=Math.min(J[0],X[0]),Z[1]=Math.min(J[1],X[1]),Z}function A56(Z,J,X){return Z[0]=Math.max(J[0],X[0]),Z[1]=Math.max(J[1],X[1]),Z}function x56(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z}function h56(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z}function f56(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z}function wX1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return Math.hypot(X,Y)}function BX1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return X*X+Y*Y}function jX1(Z){var J=Z[0],X=Z[1];return Math.hypot(J,X)}function OX1(Z){var J=Z[0],X=Z[1];return J*J+X*X}function b56(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z}function y56(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z}function g56(Z,J){var X=J[0],Y=J[1],$=X*X+Y*Y;if($>0)$=1/Math.sqrt($);return Z[0]=J[0]*$,Z[1]=J[1]*$,Z}function m56(Z,J){return Z[0]*J[0]+Z[1]*J[1]}function u56(Z,J,X){var Y=J[0]*X[1]-J[1]*X[0];return Z[0]=Z[1]=0,Z[2]=Y,Z}function d56(Z,J,X,Y){var $=J[0],Q=J[1];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z}function c56(Z,J){J=J||1;var X=l7()*2*Math.PI;return Z[0]=Math.cos(X)*J,Z[1]=Math.sin(X)*J,Z}function l56(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[2]*$,Z[1]=X[1]*Y+X[3]*$,Z}function p56(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[2]*$+X[4],Z[1]=X[1]*Y+X[3]*$+X[5],Z}function i56(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[3]*$+X[6],Z[1]=X[1]*Y+X[4]*$+X[7],Z}function n56(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[4]*$+X[12],Z[1]=X[1]*Y+X[5]*$+X[13],Z}function a56(Z,J,X,Y){var $=J[0]-X[0],Q=J[1]-X[1],K=Math.sin(Y),W=Math.cos(Y);return Z[0]=$*W-Q*K+X[0],Z[1]=$*K+Q*W+X[1],Z}function s56(Z,J){var X=Z[0],Y=Z[1],$=J[0],Q=J[1],K=Math.sqrt(X*X+Y*Y)*Math.sqrt($*$+Q*Q),W=K&&(X*$+Y*Q)/K;return Math.acos(Math.min(Math.max(W,-1),1))}function o56(Z){return Z[0]=0,Z[1]=0,Z}function r56(Z){return"vec2("+Z[0]+", "+Z[1]+")"}function t56(Z,J){return Z[0]===J[0]&&Z[1]===J[1]}function e56(Z,J){var X=Z[0],Y=Z[1],$=J[0],Q=J[1];return Math.abs(X-$)<=P0*Math.max(1,Math.abs(X),Math.abs($))&&Math.abs(Y-Q)<=P0*Math.max(1,Math.abs(Y),Math.abs(Q))}var Z96=jX1,J96=FX1,X96=UX1,Y96=LX1,$96=wX1,Q96=BX1,K96=OX1,W96=function(){var Z=qX1();return function(J,X,Y,$,Q,K){var W,G;if(!X)X=2;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(W=Y;W<G;W+=X)Z[0]=J[W],Z[1]=J[W+1],Q(Z,Z,K),J[W]=Z[0],J[W+1]=Z[1];return J}}();class r$ extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get determinant(){return g8.determinant(this)}get frobeniusNorm(){return g8.frob(this)}static create(){let Z=new r$(0,0,0,0);return g8.identity(Z),Z}static fromRotation(Z){let J=r$.create();return g8.fromRotation(J,Z),J}static fromScaling(Z){let J=r$.create();return g8.fromScaling(J,Z),J}add(Z){return g8.add(this,this,Z),this}adjoint(){return g8.adjoint(this,this),this}clone(){return new r$(this[0],this[1],this[2],this[3])}copy(Z){return g8.copy(this,Z),this}equals(Z){return g8.equals(this,Z)}exactEquals(Z){return g8.exactEquals(this,Z)}identity(){return g8.identity(this),this}invert(){return g8.invert(this,this),this}multiply(Z){return g8.mul(this,this,Z),this}multiplyScalar(Z){return g8.multiplyScalar(this,this,Z),this}rotate(Z){return g8.rotate(this,this,Z),this}subtract(Z){return g8.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]}][${this[2]},${this[3]}]`}transpose(){return g8.transpose(this,this),this}}class p7 extends Float32Array{constructor(Z,J,X,Y,$,Q,K,W,G){super([Z,J,X,Y,$,Q,K,W,G])}get determinant(){return i1.determinant(this)}get frobeniusNorm(){return i1.frob(this)}static create(){let Z=new p7(0,0,0,0,0,0,0,0,0);return i1.identity(Z),Z}static fromMatrix4(Z){let J=p7.create();return i1.fromMat4(J,Z),J}static fromQuaternion(Z){let J=p7.create();return i1.fromQuat(J,Z),J}static fromRotation(Z){let J=p7.create();return i1.fromRotation(J,Z),J}static fromScaling(Z){let J=p7.create();return i1.fromScaling(J,Z),J}static fromTranslation(Z){let J=p7.create();return i1.fromTranslation(J,Z),J}add(Z){return i1.add(this,this,Z),this}adjoint(){return i1.adjoint(this,this),this}clone(){return new p7(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8])}copy(Z){return i1.copy(this,Z),this}equals(Z){return i1.equals(this,Z)}exactEquals(Z){return i1.exactEquals(this,Z)}identity(){return i1.identity(this),this}invert(){return i1.invert(this,this),this}multiply(Z){return i1.mul(this,this,Z),this}multiplyScalar(Z){return i1.multiplyScalar(this,this,Z),this}transformVector(Z){return Z.transformMatrix3(this)}projection(Z,J){return i1.projection(this,Z,J),this}rotate(Z){return i1.rotate(this,this,Z),this}subtract(Z){return i1.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 i1.transpose(this,this),this}}class F5 extends Float32Array{constructor(Z,J,X,Y,$,Q,K,W,G,z,V,H,q,F,U,w){super([Z,J,X,Y,$,Q,K,W,G,z,V,H,q,F,U,w])}get determinant(){return o0.determinant(this)}get frobeniusNorm(){return o0.frob(this)}static create(){let Z=new F5(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return o0.identity(Z),Z}static fromQuaternion(Z){let J=F5.create();return o0.fromQuat(J,Z),J}static fromRotation(Z,J){let X=F5.create();return o0.fromRotation(X,Z,J),X}static fromRotationTranslation(Z,J){let X=F5.create();return o0.fromRotationTranslation(X,Z,J),X}static fromRotationTranslationScale(Z,J,X){let Y=F5.create();return o0.fromRotationTranslationScale(Y,Z,J,X),Y}static fromRotationTranslationScaleOrigin(Z,J,X,Y){let $=F5.create();return o0.fromRotationTranslationScaleOrigin($,Z,J,X,Y),$}static fromScaling(Z){let J=F5.create();return o0.fromScaling(J,Z),J}static fromTranslation(Z){let J=F5.create();return o0.fromTranslation(J,Z),J}static fromXRotation(Z){let J=F5.create();return o0.fromXRotation(J,Z),J}static fromYRotation(Z){let J=F5.create();return o0.fromYRotation(J,Z),J}static fromZRotation(Z){let J=F5.create();return o0.fromZRotation(J,Z),J}add(Z){return o0.add(this,this,Z),this}adjoint(){return o0.adjoint(this,this),this}clone(){return new F5(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8],this[9],this[10],this[11],this[12],this[13],this[14],this[15])}copy(Z){return o0.copy(this,Z),this}equals(Z){return o0.equals(this,Z)}exactEquals(Z){return o0.exactEquals(this,Z)}frustrum(Z,J,X,Y,$,Q){return o0.frustum(this,Z,J,X,Y,$,Q),this}identity(){return o0.identity(this),this}invert(){return o0.invert(this,this),this}lookAt(Z,J,X){return o0.lookAt(this,Z,J,X),this}multiply(Z){return o0.mul(this,this,Z),this}multiplyScalar(Z){return o0.multiplyScalar(this,this,Z),this}orthographic(Z,J,X,Y,$,Q){return o0.ortho(this,Z,J,X,Y,$,Q),this}perspective(Z,J,X,Y){return o0.perspective(this,Z,J,X,Y),this}rotate(Z,J){return o0.rotate(this,this,Z,J),this}rotateX(Z){return o0.rotateX(this,this,Z),this}rotateY(Z){return o0.rotateY(this,this,Z),this}rotateZ(Z){return o0.rotateZ(this,this,Z),this}scale(Z){return o0.scale(this,this,Z),this}subtract(Z){return o0.sub(this,this,Z),this}targetTo(Z,J,X){return o0.targetTo(this,Z,J,X),this}toString(){return`[${this[0]},${this[1]},${this[2]},${this[3]}][${this[4]},${this[5]},${this[6]},${this[7]}][${this[8]},${this[9]},${this[10]},${this[11]}][${this[12]},${this[13]},${this[14]},${this[15]}]`}translate(Z){return o0.translate(this,this,Z),this}transpose(){return o0.transpose(this,this),this}}class ZG extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get length(){return R1.length(this)}get squaredLength(){return R1.squaredLength(this)}get magnitude(){return R1.length(this)}get squaredMagnitude(){return R1.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}get z(){return this[2]}set z(Z){this[2]=Z}get w(){return this[3]}set w(Z){this[3]=Z}static fromEuler(Z,J,X){let Y=R1.fromEuler(new Float32Array(4),Z,J,X);return new ZG(Y[0],Y[1],Y[2],Y[3])}static fromQuaternionLike(Z){return new ZG(Z.x,Z.y,Z.z,Z.w)}clone(){return new ZG(this.x,this.y,this.z,this.w)}conjugate(){return R1.conjugate(this,this),this}copy(Z){return R1.copy(this,Z),this}dot(Z){return R1.dot(this,Z)}exponential(){return R1.exp(this,this),this}equals(Z){return R1.equals(this,Z)}exactEquals(Z){return R1.exactEquals(this,Z)}getAngle(Z){return R1.getAngle(this,Z)}identity(){return R1.identity(this),this}invert(){return R1.invert(this,this),this}lerp(Z,J){return R1.lerp(this,this,Z,J),this}logarithm(){return R1.ln(this,this),this}multiply(Z){return R1.multiply(this,this,Z),this}transformVector(Z){return Z.transformQuaternion(this)}normalize(){return R1.normalize(this,this),this}power(Z){return R1.pow(this,this,Z),this}randomize(){return R1.random(this),this}rotateX(Z){return R1.rotateX(this,this,Z),this}rotateY(Z){return R1.rotateY(this,this,Z),this}rotateZ(Z){return R1.rotateZ(this,this,Z),this}scale(Z){return R1.scale(this,this,Z),this}setAxisAngle(Z,J){return R1.setAxisAngle(this,Z,J),this}slerp(Z,J){return R1.slerp(this,this,Z,J),this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}}class jq extends Float32Array{constructor(Z,J){super([Z,J])}get length(){return K1.length(this)}get squaredLength(){return K1.squaredLength(this)}get magnitude(){return K1.length(this)}get squaredMagnitude(){return K1.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 jq(0,0)}add(Z){return K1.add(this,this,Z),this}angle(Z){return K1.angle(this,Z)}ceil(){return K1.ceil(this,this),this}clone(){return new jq(this.x,this.y)}copy(Z){return K1.copy(this,Z),this}distance(Z){return K1.distance(this,Z)}divide(Z){return K1.divide(this,this,Z),this}dot(Z){return K1.dot(this,Z)}equals(Z){return K1.equals(this,Z)}exactEquals(Z){return K1.exactEquals(this,Z)}floor(){return K1.floor(this,this),this}invert(){return K1.inverse(this,this),this}lerp(Z,J){return K1.lerp(this,this,Z,J),this}max(Z){return K1.max(this,this,Z),this}min(Z){return K1.min(this,this,Z),this}multiply(Z){return K1.mul(this,this,Z),this}negate(){return K1.negate(this,this),this}normalize(){return K1.normalize(this,this),this}randomize(Z){return K1.random(this,Z),this}rotate(Z,J){return K1.rotate(this,this,Z,J),this}round(){return K1.round(this,this),this}scale(Z){return K1.scale(this,this,Z),this}scaleAndAdd(Z,J){return K1.scaleAndAdd(this,this,Z,J),this}subtract(Z){return K1.sub(this,this,Z),this}toString(){return`${this.x},${this.y}`}transformMatrix2(Z){return K1.transformMat2(this,this,Z),this}transformMatrix3(Z){return K1.transformMat3(this,this,Z),this}transformMatrix4(Z){return K1.transformMat4(this,this,Z),this}zero(){return K1.zero(this),this}}class JG extends Float32Array{constructor(Z,J,X){super([Z,J,X])}get length(){return t0.length(this)}get squaredLength(){return t0.squaredLength(this)}get magnitude(){return t0.length(this)}get squaredMagnitude(){return t0.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}get z(){return this[2]}set z(Z){this[2]=Z}static create(){return new JG(0,0,0)}static fromVector3Like(Z){return new JG(Z.x,Z.y,Z.z)}add(Z){return t0.add(this,this,Z),this}ceil(){return t0.ceil(this,this),this}clone(){return new JG(this.x,this.y,this.z)}copy(Z){return t0.copy(this,Z),this}cross(Z){return t0.cross(this,this,Z),this}distance(Z){return t0.distance(this,Z)}divide(Z){return t0.div(this,this,Z),this}dot(Z){return t0.dot(this,Z)}equals(Z){return t0.equals(this,Z)}exactEquals(Z){return t0.exactEquals(this,Z)}floor(){return t0.floor(this,this),this}invert(){return t0.inverse(this,this),this}lerp(Z,J){return t0.lerp(this,this,Z,J),this}max(Z){return t0.max(this,this,Z),this}min(Z){return t0.min(this,this,Z),this}multiply(Z){return t0.mul(this,this,Z),this}negate(){return t0.negate(this,this),this}normalize(){return t0.normalize(this,this),this}randomize(Z){return t0.random(this,Z),this}rotateX(Z,J){return t0.rotateX(this,this,Z,J),this}rotateY(Z,J){return t0.rotateY(this,this,Z,J),this}rotateZ(Z,J){return t0.rotateZ(this,this,Z,J),this}round(){return t0.round(this,this),this}scale(Z){return t0.scale(this,this,Z),this}scaleAndAdd(Z,J){return t0.scaleAndAdd(this,this,Z,J),this}subtract(Z){return t0.sub(this,this,Z),this}toString(){return`${this.x},${this.y},${this.z}`}transformMatrix3(Z){return t0.transformMat3(this,this,Z),this}transformMatrix4(Z){return t0.transformMat4(this,this,Z),this}transformQuaternion(Z){return t0.transformQuat(this,this,Z),this}zero(){return t0.zero(this),this}}var N1=function(Z,J,X,Y){function $(Q){return Q instanceof X?Q:new X(function(K){K(Q)})}return new(X||(X=Promise))(function(Q,K){function W(V){try{z(Y.next(V))}catch(H){K(H)}}function G(V){try{z(Y.throw(V))}catch(H){K(H)}}function z(V){V.done?Q(V.value):$(V.value).then(W,G)}z((Y=Y.apply(Z,J||[])).next())})},j1=function(Z,J){var X={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},Y,$,Q,K=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return K.next=W(0),K.throw=W(1),K.return=W(2),typeof Symbol==="function"&&(K[Symbol.iterator]=function(){return this}),K;function W(z){return function(V){return G([z,V])}}function G(z){if(Y)throw new TypeError("Generator is already executing.");while(K&&(K=0,z[0]&&(X=0)),X)try{if(Y=1,$&&(Q=z[0]&2?$.return:z[0]?$.throw||((Q=$.return)&&Q.call($),0):$.next)&&!(Q=Q.call($,z[1])).done)return Q;if($=0,Q)z=[z[0]&2,Q.value];switch(z[0]){case 0:case 1:Q=z;break;case 4:return X.label++,{value:z[1],done:!1};case 5:X.label++,$=z[1],z=[0];continue;case 7:z=X.ops.pop(),X.trys.pop();continue;default:if((Q=X.trys,!(Q=Q.length>0&&Q[Q.length-1]))&&(z[0]===6||z[0]===2)){X=0;continue}if(z[0]===3&&(!Q||z[1]>Q[0]&&z[1]<Q[3])){X.label=z[1];break}if(z[0]===6&&X.label<Q[1]){X.label=Q[1],Q=z;break}if(Q&&X.label<Q[2]){X.label=Q[2],X.ops.push(z);break}if(Q[2])X.ops.pop();X.trys.pop();continue}z=J.call(Z,X)}catch(V){z=[6,V],$=0}finally{Y=Q=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},g5=function(Z,J){var X=typeof Symbol==="function"&&Z[Symbol.iterator];if(!X)return Z;var Y=X.call(Z),$,Q=[],K;try{while((J===void 0||J-- >0)&&!($=Y.next()).done)Q.push($.value)}catch(W){K={error:W}}finally{try{if($&&!$.done&&(X=Y.return))X.call(Y)}finally{if(K)throw K.error}}return Q},o9=function(Z,J,X){if(X||arguments.length===2){for(var Y=0,$=J.length,Q;Y<$;Y++)if(Q||!(Y in J)){if(!Q)Q=Array.prototype.slice.call(J,0,Y);Q[Y]=J[Y]}}return Z.concat(Q||Array.prototype.slice.call(J))},MX1=function(Z){var J=typeof Symbol==="function"&&Symbol.iterator,X=J&&Z[J],Y=0;if(X)return X.call(Z);if(Z&&typeof Z.length==="number")return{next:function(){if(Z&&Y>=Z.length)Z=void 0;return{value:Z&&Z[Y++],done:!Z}}};throw new TypeError(J?"Object is not iterable.":"Symbol.iterator is not defined.")},_s6=function(){function Z(J){if(J===void 0)J=Z.minComparator;var X=this;this.compare=J,this.heapArray=[],this._limit=0,this.offer=this.add,this.element=this.peek,this.poll=this.pop,this._invertedCompare=function(Y,$){return X.compare(Y,$).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 X=J%2?1:2;return Math.floor((J-X)/2)},Z.getSiblingIndexOf=function(J){if(J<=0)return-1;var X=J%2?1:-1;return J+X},Z.minComparator=function(J,X){return N1(this,void 0,void 0,function(){return j1(this,function(Y){if(J>X)return[2,1];else if(J<X)return[2,-1];else return[2,0]})})},Z.maxComparator=function(J,X){return N1(this,void 0,void 0,function(){return j1(this,function(Y){if(X>J)return[2,1];else if(X<J)return[2,-1];else return[2,0]})})},Z.minComparatorNumber=function(J,X){return N1(this,void 0,void 0,function(){return j1(this,function(Y){return[2,J-X]})})},Z.maxComparatorNumber=function(J,X){return N1(this,void 0,void 0,function(){return j1(this,function(Y){return[2,X-J]})})},Z.defaultIsEqual=function(J,X){return N1(this,void 0,void 0,function(){return j1(this,function(Y){return[2,J===X]})})},Z.print=function(J){function X(V){var H=Z.getParentIndexOf(V);return Math.floor(Math.log2(H+1))}function Y(V,H){var q="";for(;H>0;--H)q+=V;return q}var $=0,Q=[],K=X(J.length-1)+2,W=0;while($<J.length){var G=X($)+1;if($===0)G=0;var z=String(J.get($));if(z.length>W)W=z.length;Q[G]=Q[G]||[],Q[G].push(z),$+=1}return Q.map(function(V,H){var q=Math.pow(2,K-H)-1;return Y(" ",Math.floor(q/2)*W)+V.map(function(F){var U=(W-F.length)/2;return Y(" ",Math.ceil(U))+F+Y(" ",Math.floor(U))}).join(Y(" ",q*W))}).join(`
483
+ `);let{connect:G,buffered:z}=await W;if(Z.emit("proxyConnect",G),this.emit("proxyConnect",G,Z),G.statusCode===200){if(Z.once("socket",i06),J.secureEndpoint){Jq("Upgrading socket connection to TLS");let H=J.servername||J.host;return ah.connect({...ZJ1(J,"host","path","port"),socket:Y,servername:aZ.isIP(H)?void 0:H})}return Y}Y.destroy();let V=new aZ.Socket({writable:!1});return V.readable=!0,Z.once("socket",(H)=>{Jq("Replaying proxy buffer for failed request"),H.push(z),H.push(null)}),V}}KM.__initStatic();function i06(Z){Z.resume()}function ZJ1(Z,...J){let X={},Y;for(Y in Z)if(!J.includes(Y))X[Y]=Z[Y];return X}var r06=32768;function t06(Z){return new s06({read(){this.push(Z),this.push(null)}})}function JJ1(Z){let J;try{J=new URL(Z.url)}catch(G){return C8(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),CV(Z,()=>Promise.resolve({}))}let X=J.protocol==="https:",Y=e06(J,Z.proxy||(X?process.env.https_proxy:void 0)||process.env.http_proxy),$=X?a06:n06,Q=Z.keepAlive===void 0?!1:Z.keepAlive,K=Y?new KM(Y):new $.Agent({keepAlive:Q,maxSockets:30,timeout:2000}),W=Z16(Z,Z.httpModule??$,K);return CV(Z,W)}function e06(Z,J){let{no_proxy:X}=process.env;if(X?.split(",").some(($)=>Z.host.endsWith($)||Z.hostname.endsWith($)))return;else return J}function Z16(Z,J,X){let{hostname:Y,pathname:$,port:Q,protocol:K,search:W}=new URL(Z.url);return function G(z){return new Promise((V,H)=>{wB(()=>{let q=t06(z.body),F={...Z.headers};if(z.body.length>r06)F["content-encoding"]="gzip",q=q.pipe(o06());let U=J.request({method:"POST",agent:X,headers:F,hostname:Y,path:`${$}${W}`,port:Q,protocol:K,ca:Z.caCerts},(w)=>{w.on("data",()=>{}),w.on("end",()=>{}),w.setEncoding("utf8");let L=w.headers["retry-after"]??null,j=w.headers["x-sentry-rate-limits"]??null;V({statusCode:w.statusCode,headers:{"retry-after":L,"x-sentry-rate-limits":Array.isArray(j)?j[0]||null:j}})});U.on("error",H),q.pipe(U)})})}}var J16=new Set(["false","f","n","no","off","0"]),X16=new Set(["true","t","y","yes","on","1"]);function WM(Z,J){let X=String(Z).toLowerCase();if(J16.has(X))return!1;if(X16.has(X))return!0;return J?.strict?null:Boolean(Z)}import{posix as Y16,sep as $16}from"path";function XJ1(Z){return Z.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function YJ1(Z=process.argv[1]?gv(process.argv[1]):process.cwd(),J=$16==="\\"){let X=J?XJ1(Z):Z;return(Y)=>{if(!Y)return;let $=J?XJ1(Y):Y,{dir:Q,base:K,ext:W}=Y16.parse($);if(W===".js"||W===".mjs"||W===".cjs")K=K.slice(0,W.length*-1);let G=decodeURIComponent(K);if(!Q)Q=".";let z=Q.lastIndexOf("/node_modules");if(z>-1)return`${Q.slice(z+14).replace(/\//g,".")}:${G}`;if(Q.startsWith(X)){let V=Q.slice(X.length+1).replace(/\//g,".");return V?`${V}:${G}`:G}return G}}function $J1(Z){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(I0.SENTRY_RELEASE?.id)return I0.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,X=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,Y=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return J||X||Y||Z}var QJ1=zB(mv(YJ1()));var WJ1=t(Z0(),1);import*as KJ1 from"os";import{threadId as Q16,isMainThread as K16}from"worker_threads";var W16=60000;class sh extends kB{constructor(Z){let J=Z.serverName||global.process.env.SENTRY_NAME||KJ1.hostname(),X={...Z,platform:"node",runtime:{name:"node",version:global.process.version},serverName:J};if(Z.openTelemetryInstrumentations)MW({instrumentations:Z.openTelemetryInstrumentations});hv(X,"node"),l.log(`Initializing Sentry: process: ${process.pid}, thread: ${K16?"main":`worker-${Q16}`}.`);super(X);if(this.getOptions()._experiments?.enableLogs){if(this._logOnExitFlushListener=()=>{K$(this)},J)this.on("beforeCaptureLog",(Y)=>{Y.attributes={...Y.attributes,"server.address":J}});process.on("beforeExit",this._logOnExitFlushListener)}}get tracer(){if(this._tracer)return this._tracer;let Z="@sentry/node",J=h8,X=WJ1.trace.getTracer(Z,J);return this._tracer=X,X}async flush(Z){let X=this.traceProvider?.activeSpanProcessor;if(X)await X.forceFlush();if(this.getOptions().sendClientReports)this._flushOutcomes();return super.flush(Z)}close(Z){if(this._clientReportInterval)clearInterval(this._clientReportInterval);if(this._clientReportOnExitFlushListener)process.off("beforeExit",this._clientReportOnExitFlushListener);if(this._logOnExitFlushListener)process.off("beforeExit",this._logOnExitFlushListener);return super.close(Z)}startClientReportTracking(){let Z=this.getOptions();if(Z.sendClientReports)this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{m0&&l.log("Flushing client reports based on interval."),this._flushOutcomes()},Z.clientReportFlushInterval??W16).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener)}_getTraceInfoFromScope(Z){if(!Z)return[void 0,void 0];return nt0(this,Z)}}var m4=t(Z0(),1);var sW=t(A1(),1);var GJ1=t(bj(),1);import G16 from"module";var oh=1e6;function zJ1(Z,J={}){if(Z.getOptions().debug)H16();let X=z16(Z,J);Z.traceProvider=X}function VJ1(){let[Z=0,J=0]=process.versions.node.split(".").map(Number);if(Z>=21||Z===20&&J>=6||Z===18&&J>=19){if(!I0._sentryEsmLoaderHookRegistered)try{let{addHookMessagePort:X}=GJ1.createAddHookMessageChannel();G16.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:X,include:[]},transferList:[X]})}catch(X){l.warn("Failed to register ESM hook",X)}}else C8(()=>{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 z16(Z,J={}){let X=new Xx({sampler:new Nx(Z),resource:new vW({[sW.ATTR_SERVICE_NAME]:"node",[sW.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[sW.ATTR_SERVICE_VERSION]:h8}),forceFlushTimeoutMillis:500,spanProcessors:[new Rx({timeout:V16(Z.getOptions().maxSpanWaitDuration)}),...J.spanProcessors||[]]});return m4.trace.setGlobalTracerProvider(X),m4.propagation.setGlobalPropagator(new wx),m4.context.setGlobalContextManager(new oZ1),X}function V16(Z){if(Z==null)return;if(Z>oh)return m0&&l.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${oh}`),oh;else if(Z<=0||Number.isNaN(Z)){m0&&l.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return Z}function H16(){let Z=new Proxy(l,{get(J,X,Y){return Reflect.get(J,X==="verbose"?"debug":X,Y)}});m4.diag.disable(),m4.diag.setLogger(Z,m4.DiagLogLevel.DEBUG)}function q16(){return bW()?[ne0()]:[]}function HJ1(){return[SB(),IB(),_B(),AB(),xB(),Ke0(),ke0(),ae0(),se0(),fe0(),le0(),ve0(),fZ1(),rZ1(),...q16()]}function qJ1(Z){return[...HJ1(),...X9(Z)?tZ1():[]]}function rh(Z={}){return F16(Z,qJ1)}function F16(Z={},J){let X=U16(Z,J);if(X.debug===!0)if(m0)l.enable();else C8(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")});if(!bW()&&X.registerEsmLoaderHooks!==!1)VJ1();if(st0(),O1().update(X.initialScope),X.spotlight&&!X.integrations.some(({name:Q})=>Q===gh))X.integrations.push(E71({sidecarUrl:typeof X.spotlight==="string"?X.spotlight:void 0}));let $=new sh(X);if(O1().setClient($),$.init(),l.log(`Running in ${bW()?"CommonJS":"ESM"} mode.`),$.startClientReportTracking(),B16(),!X.skipOpenTelemetrySetup)zJ1($,{spanProcessors:X.openTelemetrySpanProcessors}),FJ1();return yt0($),at0($),$}function FJ1(){if(!m0)return;let Z=dt0(),J=["SentryContextManager","SentryPropagator"];if(X9())J.push("SentrySpanProcessor");for(let X of J)if(!Z.includes(X))l.error(`You have to set up the ${X}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);if(!Z.includes("SentrySampler"))l.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function U16(Z,J){let X=L16(Z.release),Y=Z.spotlight??WM(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,$=w16(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??JJ1,stackParser:Vv(Z.stackParser||QJ1),release:X,tracesSampleRate:$,spotlight:Y,debug:WM(Z.debug??process.env.SENTRY_DEBUG)},K=Z.integrations,W=Z.defaultIntegrations??J(Q);return{...Q,integrations:kv({defaultIntegrations:W,integrations:K})}}function L16(Z){if(Z!==void 0)return Z;let J=$J1();if(J!==void 0)return J;return}function w16(Z){if(Z!==void 0)return Z;let J=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!J)return;let X=parseFloat(J);return isFinite(X)?X:void 0}function B16(){if(WM(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let Z=process.env.SENTRY_TRACE,J=process.env.SENTRY_BAGGAGE,X=UV(Z,J);O1().setPropagationContext(X)}}if(process.env.NODE_ENV==="production"&&process.env.SENTRY_DSN)rh({dsn:process.env.SENTRY_DSN,release:dI,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=Q8.getProcessStats(),Z},beforeSendTransaction:(Z)=>{if(Z.contexts?.trace?.op==="ticker_tick"){let X=Z?.start_timestamp,Y=Z?.timestamp;if(!X||!Y)return null;if((Y-X)*1000>30)return Z.measurements=Q8.getProcessStats(!0),Z}return null}}),console.log("Telemetry: Sentry.io initialized!");class Q8{static getProcessStats(Z=!1){let J=process.memoryUsage(),X={jsHeapSizeMb:{value:J.heapUsed/1024/1024,unit:"megabyte"},jsHeapCapacityMb:{value:J.heapTotal/1024/1024,unit:"megabyte"},jsHeapUsagePercent:{value:J.heapUsed/J.heapTotal,unit:"percent"},processHeapSizeMb:{value:J.heapUsed/1024/1024,unit:"megabyte"},rssSizeMb:{value:J.rss/1024/1024,unit:"megabyte"}};if(Z)return X;return Object.fromEntries(Object.entries(X).map(([Y,$])=>[Y,$.value]))}static startSpan(Z,J){if(PB())return LB({attributes:Z.attributes,name:Z.operation,op:Z.operation},J);else return J()}}var UJ1=new _Y,M16=5000;class rY extends g0{static _cachedPacketsSerializedBuffer=new Map;_closeTimeout=null;_wrtcDirectTransport=null;_wrtcClientServerTransport=null;_wrtcClientServerDataProducers=[];_wrtcClientServerDataConsumers=[];_wrtcServerClientTransport=null;_wrtcServerClientReliableDataProducer=null;_wrtcServerClientUnreliableDataProducer=null;_wrtcServerClientDataConsumers=[];_ws;id;constructor(Z,J){super();this.id=G00(),this.onPacket(X0.PacketId.CONNECTION,this._onConnectionPacket),this.onPacket(X0.PacketId.HEARTBEAT,this._onHeartbeatPacket),this.bindWs(Z),q6.emit("CONNECTION.OPENED",{connection:this,req:J})}static serializePackets(Z){for(let X of Z)if(!X0.isValidPacket(X))return m.error(`Connection.serializePackets(): Invalid packet payload: ${JSON.stringify(X)}`);let J=rY._cachedPacketsSerializedBuffer.get(Z);if(J)return J;return Q8.startSpan({operation:"serialize_packets",attributes:{packets:Z.length,packetIds:Z.map((X)=>X[0]).join(",")}},(X)=>{let Y=Q8.startSpan({operation:"serialize_packets_encode"},()=>UJ1.pack(Z));return X?.setAttribute("serializedBytes",Y.byteLength),rY._cachedPacketsSerializedBuffer.set(Z,Y),Y})}bindWs(Z){let J=this._closeTimeout!==null;if(J)clearTimeout(this._closeTimeout),this._closeTimeout=null;if(this._ws=Z,this._ws.binaryType="nodebuffer",this._ws.onmessage=(X)=>this._onMessage(X.data),this._ws.onclose=this._onWsClose,this._ws.onerror=this._onWsError,this.send([X0.createPacket(X0.bidirectionalPackets.connectionPacketDefinition,{i:this.id})],!0,!0),J)this.emitWithGlobal("CONNECTION.RECONNECTED",{connection:this});if(bJ.instance.isWrtcEnabled)this._upgradeToWRTC()}closeWrtc(){this._closeWrtcClientServerTransport(),this._closeWrtcServerClientTransport()}disconnect(){try{this._ws.close()}catch(Z){m.error(`Connection.disconnect(): Connection disconnect failed. Error: ${Z}`)}}onPacket(Z,J){this.on("CONNECTION.PACKET_RECEIVED",({packet:X})=>{if(X[0]===Z)J(X)})}send(Z,J=!0,X=!1){if(this._closeTimeout)return;if(this._ws.readyState!==O16.OPEN)return;Q8.startSpan({operation:"send_packets",attributes:{forceWs:X?"true":"false",wrtcConnected:this._wrtcServerClientTransport?.iceState==="completed"?"true":"false"}},()=>{try{let Y=rY.serializePackets(Z);if(!Y)return;if(this._wrtcServerClientTransport?.iceState==="completed"&&Y.length<(this._wrtcServerClientTransport?.sctpParameters?.maxMessageSize??0)&&!X)try{(J?this._wrtcServerClientReliableDataProducer:this._wrtcServerClientUnreliableDataProducer).send(Y)}catch{this._ws.send(Y)}else this._ws.send(Y);this.emitWithGlobal("CONNECTION.PACKETS_SENT",{connection:this,packets:Z})}catch(Y){m.error(`Connection.send(): Packet send failed. Error: ${Y}`)}})}_closeWrtcClientServerTransport(){this._wrtcDirectTransport?.close(),this._wrtcDirectTransport=null,this._wrtcClientServerTransport?.close(),this._wrtcClientServerTransport=null,this._wrtcClientServerDataProducers.forEach((Z)=>Z.close()),this._wrtcClientServerDataProducers=[],this._wrtcClientServerDataConsumers.forEach((Z)=>Z.close()),this._wrtcClientServerDataConsumers=[]}_closeWrtcServerClientTransport(){this._wrtcServerClientTransport?.close(),this._wrtcServerClientTransport=null,this._wrtcServerClientDataConsumers.forEach((Z)=>Z.close()),this._wrtcServerClientDataConsumers=[],this._wrtcServerClientReliableDataProducer?.close(),this._wrtcServerClientReliableDataProducer=null,this._wrtcServerClientUnreliableDataProducer?.close(),this._wrtcServerClientUnreliableDataProducer=null}_onConnectionPacket=async(Z)=>{let J=Z[1],X=J.c,Y=J.d;if(X){let{i:$,d:Q}=X,K=!1;if($==this._wrtcClientServerTransport?.id)await this._wrtcClientServerTransport.connect({dtlsParameters:Q}),K=!0;if($==this._wrtcServerClientTransport?.id)await this._wrtcServerClientTransport.connect({dtlsParameters:Q}),K=!0;if(K)this.send([X0.createPacket(X0.bidirectionalPackets.connectionPacketDefinition,{ca:{i:$}})])}if(Y)for(let $ of Y){let{s:Q,l:K}=$,W=await this._wrtcClientServerTransport.produceData({label:K,sctpStreamParameters:Q}),G=await this._wrtcDirectTransport.consumeData({dataProducerId:W.id});this._wrtcClientServerDataProducers.push(W),this._wrtcClientServerDataConsumers.push(G),G.on("message",(z)=>this._onMessage(z)),this.send([X0.createPacket(X0.bidirectionalPackets.connectionPacketDefinition,{pa:{i:W.id,l:K}})])}};_onHeartbeatPacket=()=>{this.send([X0.createPacket(X0.bidirectionalPackets.heartbeatPacketDefinition,null)],!0,!0)};_onMessage=(Z)=>{try{let J=this._deserialize(Z);if(!J)return;this.emitWithGlobal("CONNECTION.PACKET_RECEIVED",{connection:this,packet:J})}catch(J){m.error(`Connection._ws.onmessage(): Error: ${J}`)}};_onWrtcIceStateChange=(Z,J)=>{if(["disconnected","closed"].includes(J)){if(Z==this._wrtcClientServerTransport)this._closeWrtcClientServerTransport();else if(Z==this._wrtcServerClientTransport)this._closeWrtcServerClientTransport()}};_onWsClose=()=>{this.closeWrtc(),this.emitWithGlobal("CONNECTION.DISCONNECTED",{connection:this}),this._closeTimeout=setTimeout(()=>{this.emitWithGlobal("CONNECTION.CLOSED",{connection:this}),this.offAll()},M16)};_onWsError=(Z)=>{this.emitWithGlobal("CONNECTION.ERROR",{connection:this,error:Z})};_upgradeToWRTC=async()=>{let Z=await bJ.instance.createWrtcTransports();if(!Z)return!1;let{directTransport:J,clientServerTransport:X,serverClientTransport:Y}=Z;this._wrtcDirectTransport=J,this._wrtcClientServerTransport=X,this._wrtcClientServerTransport.on("icestatechange",(K)=>{this._onWrtcIceStateChange(this._wrtcClientServerTransport,K)}),this._wrtcServerClientTransport=Y,this._wrtcServerClientTransport.on("icestatechange",(K)=>{this._onWrtcIceStateChange(this._wrtcServerClientTransport,K)}),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 $=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientReliableDataProducer.id}),Q=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientUnreliableDataProducer.id});return this._wrtcServerClientDataConsumers.push($,Q),this.send([X0.createPacket(X0.bidirectionalPackets.connectionPacketDefinition,{d:[{i:$.id,pi:$.dataProducerId,l:"scr",s:$.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=UJ1.unpack(Z);if(!J||typeof J!=="object"||typeof J[0]!=="number")return m.error(`Connection._deserialize(): Invalid packet format. Packet: ${JSON.stringify(J)}`);if(!X0.isValidPacket(J))return m.error(`Connection._deserialize(): Invalid packet payload. Packet: ${JSON.stringify(J)}`);return J}}var LJ1;((Y)=>{Y.PLAYER_CONNECTED="PLAYER_MANAGER.PLAYER_CONNECTED";Y.PLAYER_DISCONNECTED="PLAYER_MANAGER.PLAYER_DISCONNECTED";Y.PLAYER_RECONNECTED="PLAYER_MANAGER.PLAYER_RECONNECTED"})(LJ1||={});class e5{static instance=new e5;_connectionPlayers=new Map;constructor(){q6.on("CONNECTION.OPENED",({connection:Z,req:J})=>{this._onConnectionOpened(Z,J.session)}),q6.on("CONNECTION.DISCONNECTED",({connection:Z})=>{this._onConnectionDisconnected(Z)}),q6.on("CONNECTION.RECONNECTED",({connection:Z})=>{this._onConnectionReconnected(Z)}),q6.on("CONNECTION.CLOSED",({connection:Z})=>{this._onConnectionClosed(Z)})}get playerCount(){return this._connectionPlayers.size}getConnectedPlayers(){return Array.from(this._connectionPlayers.values())}getConnectedPlayersByWorld(Z){return this.getConnectedPlayers().filter((J)=>J.world===Z)}getConnectedPlayerByUsername(Z){return Array.from(this._connectionPlayers.values()).find((J)=>{return J.username.toLowerCase()===Z.toLowerCase()})}_onConnectionOpened(Z,J){let X=new oW(Z,J);this._connectionPlayers.set(Z,X),q6.emit("PLAYER_MANAGER.PLAYER_CONNECTED",{player:X})}_onConnectionDisconnected(Z){let J=this._connectionPlayers.get(Z);if(J)J.resetInputs(),J.camera.reset()}_onConnectionReconnected(Z){let J=this._connectionPlayers.get(Z);if(J)J.reconnect(),q6.emit("PLAYER_MANAGER.PLAYER_RECONNECTED",{player:J});else m.warning(`PlayerManager._onConnectionReconnected(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}_onConnectionClosed(Z){let J=this._connectionPlayers.get(Z);if(J)J.disconnect(),this._connectionPlayers.delete(Z),q6.emit("PLAYER_MANAGER.PLAYER_DISCONNECTED",{player:J});else m.warning(`PlayerManager._onConnectionClosed(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}}var I8=16,rW=I8-1,wJ1=I8**3,R16=[{neighborOffset:[-1,0,0],generateVertices:(Z,J,X)=>[Z+0,J+0,X+0,Z+0,J+0,X+1,Z+0,J+1,X+0,Z+0,J+1,X+0,Z+0,J+0,X+1,Z+0,J+1,X+1]},{neighborOffset:[1,0,0],generateVertices:(Z,J,X)=>[Z+1,J+0,X+0,Z+1,J+1,X+0,Z+1,J+0,X+1,Z+1,J+1,X+0,Z+1,J+1,X+1,Z+1,J+0,X+1]},{neighborOffset:[0,-1,0],generateVertices:(Z,J,X)=>[Z+0,J+0,X+0,Z+1,J+0,X+0,Z+0,J+0,X+1,Z+1,J+0,X+0,Z+1,J+0,X+1,Z+0,J+0,X+1]},{neighborOffset:[0,1,0],generateVertices:(Z,J,X)=>[Z+0,J+1,X+0,Z+0,J+1,X+1,Z+1,J+1,X+0,Z+1,J+1,X+0,Z+0,J+1,X+1,Z+1,J+1,X+1]},{neighborOffset:[0,0,-1],generateVertices:(Z,J,X)=>[Z+0,J+0,X+0,Z+0,J+1,X+0,Z+1,J+0,X+0,Z+0,J+1,X+0,Z+1,J+1,X+0,Z+1,J+0,X+0]},{neighborOffset:[0,0,1],generateVertices:(Z,J,X)=>[Z+0,J+0,X+1,Z+1,J+0,X+1,Z+0,J+1,X+1,Z+0,J+1,X+1,Z+1,J+0,X+1,Z+1,J+1,X+1]}],th;((Y)=>{Y.DESPAWN="CHUNK.DESPAWN";Y.SET_BLOCK="CHUNK.SET_BLOCK";Y.SPAWN="CHUNK.SPAWN"})(th||={});class b6 extends g0{_blocks;_originCoordinate;_requiresUpdate=!1;_rigidBody;_world;constructor(){super();this._blocks=new Uint8Array(wJ1)}get blocks(){return this._blocks}get requiresUpdate(){return this._requiresUpdate}get isSimulated(){return!!this._rigidBody}get isSpawned(){return!!this._originCoordinate&&!!this._world}get originCoordinate(){return this._originCoordinate}get world(){return this._world}static blockIndexToLocalCoordinate(Z){return{x:Z%I8,y:(Z/I8|0)%I8,z:Z/(I8*I8)|0}}static globalCoordinateToLocalCoordinate(Z){return{x:Z.x&I8-1,y:Z.y&I8-1,z:Z.z&I8-1}}static globalCoordinateToOriginCoordinate(Z){return{x:Z.x&~(I8-1),y:Z.y&~(I8-1),z:Z.z&~(I8-1)}}static isValidOriginCoordinate(Z){return Z.x%I8===0&&Z.y%I8===0&&Z.z%I8===0}spawn(Z,J){if(this.isSpawned){let{x:X,y:Y,z:$}=this.originCoordinate;return m.error(`Chunk.spawn(): Chunk is already spawned at origin ${X}, ${Y}, ${$}!`)}if(!b6.isValidOriginCoordinate(J))return m.error(`Chunk.spawn(): Chunk coordinates must be divisible by ${I8}`);this._originCoordinate=J,this._world=Z,this._world.chunkLattice.registerChunk(this),this._requiresUpdate=!0}despawn(){if(!this.isSpawned)return m.error("Chunk.despawn(): Chunk has not been spawned and cannot be despawned!");this.emitWithWorld(this._world,"CHUNK.DESPAWN",{chunk:this}),this._removeFromSimulation(),this._world.chunkLattice.unregisterChunk(this),this._originCoordinate=void 0,this._world=void 0}getBlockId(Z){return this._blocks[this._getIndex(Z)]}hasBlock(Z){return this._blocks[this._getIndex(Z)]!==0}setBlock(Z,J){if(!this._isValidLocalCoordinate(Z))return m.error("Chunk.setBlock(): Block local coordinate is out of bounds");if(this._blocks[this._getIndex(Z)]===J)return;if(this._blocks[this._getIndex(Z)]=J,this.isSpawned&&this.isSimulated){this.emitWithWorld(this._world,"CHUNK.SET_BLOCK",{chunk:this,globalCoordinate:this._getGlobalCoordinate(Z),localCoordinate:Z,blockTypeId:J});let X=this._getGlobalCoordinate(Z),Y=[];if(Z.x===0)Y.push({x:-1,y:0,z:0});if(Z.y===0)Y.push({x:0,y:-1,z:0});if(Z.z===0)Y.push({x:0,y:0,z:-1});if(Z.x===rW)Y.push({x:1,y:0,z:0});if(Z.y===rW)Y.push({x:0,y:1,z:0});if(Z.z===rW)Y.push({x:0,y:0,z:1});for(let $ of Y){let Q={x:X.x+$.x,y:X.y+$.y,z:X.z+$.z},K=b6.globalCoordinateToOriginCoordinate(Q),W=this._world?.chunkLattice.getChunk(K);if(!W?.hasBlock(b6.globalCoordinateToLocalCoordinate(Q)))continue;W.setRequiresUpdate(!0)}}this._requiresUpdate=!0}setRequiresUpdate(Z){this._requiresUpdate=Z}update(){if(!this._requiresUpdate)return;if(!this.isSpawned)return m.error("Chunk.update(): Chunk is not spawned and cannot be updated.");let Z=!this._rigidBody,J=this._world.simulation;if(this._removeFromSimulation(),this._rigidBody=new RY({type:"fixed",position:this._originCoordinate,simulation:this._world.simulation}),this._meshColliders().map(([X,Y])=>{if(!X.isSimulated)X.addToSimulation(J,this._rigidBody);J.colliderMap.setColliderBlockType(X,Y)}),this._requiresUpdate=!1,Z)this.emitWithWorld(this._world,"CHUNK.SPAWN",{chunk:this})}serialize(){return p0.serializeChunk(this)}_meshColliders(){if(!this._world)return m.error("Chunk._meshColliders(): Chunk is not spawned and cannot be meshed."),[];let Z=new Map,J=[];for(let Y=0;Y<wJ1;Y++){if(this._blocks[Y]===0)continue;let $=this._blocks[Y],Q=this._world.blockTypeRegistry.getBlockType($),{x:K,y:W,z:G}=b6.blockIndexToLocalCoordinate(Y);if(!Q.isMeshable){let V=Q.createCollider();V.setRelativePosition({x:K,y:W,z:G}),J.push([V,Q]);continue}let z=Z.get(Q)??{indices:[],vertices:[]};Z.set(Q,z);for(let V of R16){let[H,q,F]=V.neighborOffset,U={x:K+H,y:W+q,z:G+F},w=this._getGlobalCoordinate(U),L=this._world.chunkLattice.getBlockType(w);if(L&&!L.isLiquid)continue;let j=z.indices.length;z.indices.push(j,j+1,j+2,j+3,j+4,j+5),z.vertices.push(...V.generateVertices(K,W,G))}}let X=[];return Z.forEach((Y,$)=>{if(!Y.indices.length)return;let Q=$.createCollider(new Uint32Array(Y.indices),new Float32Array(Y.vertices));X.push([Q,$])}),[...J,...X]}_removeFromSimulation(){if(!this._rigidBody||!this._world)return;this._rigidBody.removeFromSimulation(),this._rigidBody=void 0}_getGlobalCoordinate(Z){if(!this.originCoordinate)m.fatalError("Chunk._getGlobalCoordinate(): Chunk is not spawned, calculating global coordinate is impossible.");return{x:this.originCoordinate.x+Z.x,y:this.originCoordinate.y+Z.y,z:this.originCoordinate.z+Z.z}}_getIndex(Z){return Z.x+I8*(Z.y+I8*Z.z)}_isValidLocalCoordinate(Z){return Z.x>=0&&Z.x<=rW&&Z.y>=0&&Z.y<=rW&&Z.z>=0&&Z.z<=rW}}class Xq{_chunks=new Map;_world;constructor(Z){this._world=Z}get chunkCount(){return this._chunks.size}registerChunk(Z){if(!Z.isSpawned)return m.error("ChunkLattice.registerChunk(): Chunk is not spawned.");if(this.hasChunk(Z.originCoordinate)){let{x:J,y:X,z:Y}=Z.originCoordinate;return m.error(`ChunkLattice.registerChunk(): Chunk exists at origin (${J}, ${X}, ${Y}), despawn the current chunk before registering another at the same origin.`)}if(Z.world.id!==this._world.id)return m.error("ChunkLattice.registerChunk(): Chunk world does not match lattice world.");this._chunks.set(this._getChunkKey(Z.originCoordinate),Z)}unregisterChunk(Z){if(!Z.isSpawned)return m.error("ChunkLattice.unregisterChunk(): Chunk is not spawned.");if(Z.world.id!==this._world.id)return m.error("ChunkLattice.unregisterChunk(): Chunk world does not match lattice world.");this._chunks.delete(this._getChunkKey(Z.originCoordinate))}clear(){this._chunks.forEach((Z)=>Z.despawn()),this._chunks.clear()}getBlockId(Z){let J=this.getChunk(b6.globalCoordinateToOriginCoordinate(Z));if(!J)return 0;return J.getBlockId(b6.globalCoordinateToLocalCoordinate(Z))}getBlockType(Z){let J=this.getBlockId(Z);return J?this._world.blockTypeRegistry.getBlockType(J):null}getChunk(Z){if(!b6.isValidOriginCoordinate(Z)){m.error(`ChunkLattice.getChunk(): Chunk coordinates must be divisible by CHUNK_SIZE (${I8})`);return}return this._chunks.get(this._getChunkKey(Z))}getAllChunks(){return Array.from(this._chunks.values())}hasBlock(Z){let J=this.getChunk(b6.globalCoordinateToOriginCoordinate(Z));if(!J)return!1;return J.hasBlock(b6.globalCoordinateToLocalCoordinate(Z))}hasChunk(Z){return this._chunks.has(this._getChunkKey(Z))}setBlock(Z,J){let X=b6.globalCoordinateToLocalCoordinate(Z),Y=b6.globalCoordinateToOriginCoordinate(Z),$=this.getChunk(Y);if(!$)$=new b6,$.spawn(this._world,Y);$.setBlock(X,J)}updateChunks(){this._chunks.forEach((Z)=>{if(Z.requiresUpdate)Z.update()})}_getChunkKey(Z){return`${Z.x},${Z.y},${Z.z}`}}var BJ1={type:"dynamic",softCcdPrediction:1},jJ1=0.0025000000000000005,OJ1=Math.cos(0.005),Yq;((j)=>{j.BLOCK_COLLISION="ENTITY.BLOCK_COLLISION";j.BLOCK_CONTACT_FORCE="ENTITY.BLOCK_CONTACT_FORCE";j.DESPAWN="ENTITY.DESPAWN";j.ENTITY_COLLISION="ENTITY.ENTITY_COLLISION";j.ENTITY_CONTACT_FORCE="ENTITY.ENTITY_CONTACT_FORCE";j.SET_MODEL_ANIMATIONS_PLAYBACK_RATE="ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE";j.SET_MODEL_HIDDEN_NODES="ENTITY.SET_MODEL_HIDDEN_NODES";j.SET_OPACITY="ENTITY.SET_OPACITY";j.SET_PARENT="ENTITY.SET_PARENT";j.SET_TINT_COLOR="ENTITY.SET_TINT_COLOR";j.SPAWN="ENTITY.SPAWN";j.START_MODEL_LOOPED_ANIMATIONS="ENTITY.START_MODEL_LOOPED_ANIMATIONS";j.START_MODEL_ONESHOT_ANIMATIONS="ENTITY.START_MODEL_ONESHOT_ANIMATIONS";j.STOP_MODEL_ANIMATIONS="ENTITY.STOP_MODEL_ANIMATIONS";j.TICK="ENTITY.TICK";j.UPDATE_POSITION="ENTITY.UPDATE_POSITION";j.UPDATE_ROTATION="ENTITY.UPDATE_ROTATION"})(Yq||={});class a8 extends RY{_id;_blockHalfExtents;_blockTextureUri;_controller;_modelAnimationsPlaybackRate=1;_modelHiddenNodes=new Set;_modelLoopedAnimations=new Set;_modelOneshotAnimations=new Set;_modelPreferredShape;_modelScale=1;_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,X="modelUri"in Z;if(!J===!X)m.fatalError("Entity.constructor(): Entity data must include a blockTextureUri or modelUri, but not both.");if(J&&!Z.blockHalfExtents)m.fatalError("Entity.constructor(): Block entity must have blockHalfExtents!");if(Z.parent&&!Z.parent.isSpawned)m.fatalError("Entity.constructor(): Parent entity must be spawned before child entity!");if(Z.parent?.modelUri&&Z.parentNodeName&&!P9.instance.modelHasNode(Z.parent.modelUri,Z.parentNodeName))m.fatalError(`Entity.constructor(): Parent node name ${Z.parentNodeName} not found in parent model ${Z.parent.modelUri}!`);super(Z.rigidBodyOptions??BJ1);if(J)this._blockHalfExtents=Z.blockHalfExtents,this._blockTextureUri=Z.blockTextureUri;if(X)this._modelAnimationsPlaybackRate=Z.modelAnimationsPlaybackRate??1,this._modelPreferredShape=Z.modelPreferredShape,this._modelScale=Z.modelScale??1,this._modelUri=Z.modelUri,Z.modelHiddenNodes?.forEach((Y)=>this._modelHiddenNodes.add(Y.toLowerCase())),Z.modelLoopedAnimations?.forEach((Y)=>this._modelLoopedAnimations.add(Y));if(this._name=Z.name??"Nameless",this._opacity=Z.opacity??1,this._parent=Z.parent,this._parentNodeName=Z.parentNodeName,this._tag=Z.tag,this._tintColor=Z.tintColor,Z.controller)this.setController(Z.controller)}get id(){return this._id}get blockHalfExtents(){return this._blockHalfExtents}get blockTextureUri(){return this._blockTextureUri}get controller(){return this._controller}get height(){return this.isModelEntity?P9.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,X){if(this.isSpawned)return m.error(`Entity.spawn(): Entity ${this._name} is already spawned with id ${this._id}!`);if(!this.isSimulated)this.addToSimulation(Z.simulation);if(this._blockTextureUri&&this._blockHalfExtents&&this.numColliders===0)this.addChildColliderToSimulation(new a5(a5.optionsFromBlockHalfExtents(this._blockHalfExtents)));if(this._modelUri&&this.numColliders===0&&this._modelPreferredShape!=="none")this.addChildColliderToSimulation(new a5(a5.optionsFromModelUri(this._modelUri,this._modelScale,this._modelPreferredShape)));if(this.colliders.forEach((Y)=>{if(this.hasListeners("ENTITY.BLOCK_COLLISION")||this.hasListeners("ENTITY.ENTITY_COLLISION"))Y.enableCollisionEvents(!0);if(this.hasListeners("ENTITY.BLOCK_CONTACT_FORCE")||this.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))Y.enableContactForceEvents(!0);if(J4.isDefaultCollisionGroups(Y.collisionGroups))Y.setCollisionGroups({belongsTo:[Y.isSensor?4:2],collidesWith:[65535]})}),this.setPosition(J),X)this.setRotation(X);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,X);this.colliders.forEach((Y)=>{Z.simulation.colliderMap.setColliderEntity(Y,this)}),this.emitWithWorld(Z,"ENTITY.SPAWN",{entity:this})}despawn(){if(!this._requireSpawned("despawn"))return;if(this._world.entityManager.getEntityChildren(this).forEach((Z)=>{Z.despawn()}),this._controller)this._controller.detach(this),this._controller.despawn(this);if(this.emitWithWorld(this._world,"ENTITY.DESPAWN",{entity:this}),this.isSimulated)this.removeFromSimulation();this._world.entityManager.unregisterEntity(this),this._world.audioManager.unregisterEntityAttachedAudios(this),this._world.lightManager.despawnEntityAttachedLights(this),this._world.sceneUIManager.unloadEntityAttachedSceneUIs(this),this._id=void 0,this._world=void 0}setModelAnimationsPlaybackRate(Z){if(!this._requireSpawned("setModelAnimationsPlaybackRate"))return;if(!this.isModelEntity||this._modelAnimationsPlaybackRate===Z)return;this._modelAnimationsPlaybackRate=Z,this.emitWithWorld(this._world,"ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE",{entity:this,playbackRate:Z})}setController(Z){if(this._controller===Z)return;if(this._controller)this._controller.detach(this);if(this._controller=Z,this._controller)this._controller.attach(this)}setModelHiddenNodes(Z){if(!this._requireSpawned("setModelHiddenNodes"))return;this._modelHiddenNodes=new Set(Z.map((J)=>J.toLowerCase())),this.emitWithWorld(this._world,"ENTITY.SET_MODEL_HIDDEN_NODES",{entity:this,modelHiddenNodes:this._modelHiddenNodes})}setOpacity(Z){if(!this._requireSpawned("setOpacity"))return;if(this._opacity===Z)return;this._opacity=Z,this.emitWithWorld(this._world,"ENTITY.SET_OPACITY",{entity:this,opacity:Z})}setParent(Z,J,X,Y){if(!this._requireSpawned("setParent"))return;if(Z&&!Z.isSpawned)return m.error("Entity.setParent(): Parent entity is not spawned, cannot set parent!");if(!this._parent&&Z)this._lastParentlessType=this.type;if(this._parent=Z,this._parentNodeName=J,this.colliders.forEach(($)=>$.setEnabled(!Z)),this.setType(!Z?this._lastParentlessType:"kinematic_velocity"),this.setPosition(X??{x:0,y:0,z:0}),this.setRotation(Y??{x:0,y:0,z:0,w:1}),!this.isKinematicPositionBased)this.resetAngularVelocity(),this.resetForces(),this.resetLinearVelocity(),this.resetTorques();this.emitWithWorld(this._world,"ENTITY.SET_PARENT",{entity:this,parent:Z,parentNodeName:J})}setTintColor(Z){if(!this._requireSpawned("setTintColor"))return;if(!Z&&!this._tintColor||Z&&this._tintColor&&Z.r===this._tintColor.r&&Z.g===this._tintColor.g&&Z.b===this._tintColor.b)return;this._tintColor=Z,this.emitWithWorld(this._world,"ENTITY.SET_TINT_COLOR",{entity:this,tintColor:Z})}startModelLoopedAnimations(Z){if(!this._requireSpawned("startModelLoopedAnimations"))return;if(!this.isModelEntity||!Z.length)return;if(!Z.some((J)=>!this._modelLoopedAnimations.has(J)))return;Z.forEach((J)=>{this._modelLoopedAnimations.add(J)}),this.emitWithWorld(this._world,"ENTITY.START_MODEL_LOOPED_ANIMATIONS",{entity:this,animations:new Set(Z)})}startModelOneshotAnimations(Z){if(!this._requireSpawned("startModelOneshotAnimations"))return;if(!this.isModelEntity||!Z.length)return;Z.forEach((J)=>{this._modelOneshotAnimations.add(J)}),this.emitWithWorld(this._world,"ENTITY.START_MODEL_ONESHOT_ANIMATIONS",{entity:this,animations:new Set(Z)})}stopAllModelAnimations(Z=[]){if(!this._requireSpawned("stopAllModelAnimations"))return;this._stopAnimationsFromSets([this._modelLoopedAnimations,this._modelOneshotAnimations],Z)}stopAllModelLoopedAnimations(Z=[]){if(!this._requireSpawned("stopAllModelLoopedAnimations"))return;this._stopAnimationsFromSets([this._modelLoopedAnimations],Z)}stopAllModelOneshotAnimations(Z=[]){if(!this._requireSpawned("stopAllModelOneshotAnimations"))return;this._stopAnimationsFromSets([this._modelOneshotAnimations],Z)}stopModelAnimations(Z){if(!this._requireSpawned("stopModelAnimations"))return;if(!this.isModelEntity||!Z.length)return;if(!Z.some((J)=>this._modelLoopedAnimations.has(J))&&!Z.some((J)=>this._modelOneshotAnimations.has(J)))return;Z.forEach((J)=>{this._modelLoopedAnimations.delete(J),this._modelOneshotAnimations.delete(J)}),this.emitWithWorld(this._world,"ENTITY.STOP_MODEL_ANIMATIONS",{entity:this,animations:new Set(Z)})}serialize(){return p0.serializeEntity(this)}tick(Z){if(this.emit("ENTITY.TICK",{entity:this,tickDeltaMs:Z}),this._controller)this._controller.tick(this,Z)}checkAndEmitUpdates(){if(!this._requireSpawned("checkAndEmitUpdates"))return;let Z=this.position,J=this.rotation;if(this._rotationExceedsThreshold(J,this._lastUpdatedRotation))this._lastUpdatedRotation=J,this.emitWithWorld(this._world,"ENTITY.UPDATE_ROTATION",{entity:this,rotation:J});if(this._positionExceedsThreshold(Z,this._lastUpdatedPosition))this._lastUpdatedPosition=Z,this.emitWithWorld(this._world,"ENTITY.UPDATE_POSITION",{entity:this,position:Z})}_positionExceedsThreshold(Z,J){let X=Z.x-J.x,Y=Z.y-J.y,$=Z.z-J.z;return X*X+Y*Y+$*$>jJ1}_requireSpawned(Z){if(!this.isSpawned)m.error(`Entity._requireSpawned(): Entity ${this._name} is not spawned, cannot invoke ${Z}()!`);return this.isSpawned}_rotationExceedsThreshold(Z,J){return Math.abs(Z.x*J.x+Z.y*J.y+Z.z*J.z+Z.w*J.w)<OJ1}_stopAnimationsFromSets(Z,J=[]){if(!this.isModelEntity)return;let X=new Set(J),Y=[];for(let $ of Z)for(let Q of $)if(!X.has(Q))Y.push(Q);if(Y.length>0)this.stopModelAnimations(Y)}}var eh;((W)=>{W.LOAD="SCENE_UI.LOAD";W.SET_ATTACHED_TO_ENTITY="SCENE_UI.SET_ATTACHED_TO_ENTITY";W.SET_OFFSET="SCENE_UI.SET_OFFSET";W.SET_POSITION="SCENE_UI.SET_POSITION";W.SET_STATE="SCENE_UI.SET_STATE";W.SET_VIEW_DISTANCE="SCENE_UI.SET_VIEW_DISTANCE";W.UNLOAD="SCENE_UI.UNLOAD"})(eh||={});class $q extends g0{_id;_attachedToEntity;_offset;_position;_state={};_templateId;_viewDistance;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)m.fatalError("Either attachedToEntity or position must be set, but not both");super();this._attachedToEntity=Z.attachedToEntity,this._offset=Z.offset,this._position=Z.position,this._state=Z.state??{},this._templateId=Z.templateId,this._viewDistance=Z.viewDistance}get id(){return this._id}get attachedToEntity(){return this._attachedToEntity}get isLoaded(){return this._id!==void 0}get offset(){return this._offset}get position(){return this._position}get state(){return this._state}get templateId(){return this._templateId}get viewDistance(){return this._viewDistance}get world(){return this._world}load(Z){if(this.isLoaded)return;if(this._attachedToEntity&&!this._attachedToEntity.isSpawned)return m.error(`SceneUI.load(): Attached entity ${this._attachedToEntity.id} must be spawned before loading SceneUI!`);this._id=Z.sceneUIManager.registerSceneUI(this),this._world=Z,this.emitWithWorld(Z,"SCENE_UI.LOAD",{sceneUI:this})}setAttachedToEntity(Z){if(!Z.isSpawned)return m.error(`SceneUI.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);if(this._attachedToEntity===Z)return;if(this._attachedToEntity=Z,this._position=void 0,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_ATTACHED_TO_ENTITY",{sceneUI:this,entity:Z})}setOffset(Z){if(this._offset===Z)return;if(this._offset=Z,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_OFFSET",{sceneUI:this,offset:Z})}setPosition(Z){if(this._position===Z)return;if(this._attachedToEntity=void 0,this._position=Z,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_POSITION",{sceneUI:this,position:Z})}setState(Z){if(this._state={...this._state,...Z},this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_STATE",{sceneUI:this,state:this._state})}setViewDistance(Z){if(this._viewDistance=Z,this.isLoaded)this.emitWithWorld(this._world,"SCENE_UI.SET_VIEW_DISTANCE",{sceneUI:this,viewDistance:Z})}unload(){if(!this.isLoaded||!this._world)return;this._world.sceneUIManager.unregisterSceneUI(this),this.emitWithWorld(this._world,"SCENE_UI.UNLOAD",{sceneUI:this}),this._id=void 0,this._world=void 0}serialize(){return p0.serializeSceneUI(this)}}class c7 extends a8{player;nametagSceneUI;constructor(Z){super(Z);this.player=Z.player,this.nametagSceneUI=new $q({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,X){super.spawn(Z,J,X),this.nametagSceneUI.load(Z),this.player.on("PLAYER.CHAT_MESSAGE_SEND",({message:Y})=>{this.nametagSceneUI.setState({chat:Y})})}tick(Z){if(!this.isSpawned||!this.world)return;if(!this.controller)return m.error(`PlayerEntity.tick(): PlayerEntity "${this.name}" must have a controller.`);let{input:J,camera:X}=this.player;this.controller.tickWithPlayerInput(this,J,X.orientation,Z),super.tick(Z)}}class Kq{_entities=new Map;_nextEntityId=1;_world;constructor(Z){this._world=Z}get entityCount(){return this._entities.size}get world(){return this._world}registerEntity(Z){if(Z.id!==void 0)m.fatalError(`EntityManager.registerEntity(): Entity ${Z.name} is already assigned the id ${Z.id}!`);let J=this._nextEntityId;return this._entities.set(J,Z),this._nextEntityId++,J}unregisterEntity(Z){if(Z.id===void 0)return m.error(`EntityManager.unregisterEntity(): Entity ${Z.name} is not assigned an id!`);this._entities.delete(Z.id)}getAllEntities(){return Array.from(this._entities.values())}getAllPlayerEntities(){let Z=[];return this._entities.forEach((J)=>{if(J instanceof c7)Z.push(J)}),Z}getPlayerEntitiesByPlayer(Z){let J=[];return this._entities.forEach((X)=>{if(X instanceof c7&&X.player===Z)J.push(X)}),J}getEntity(Z){return this._entities.get(Z)}getEntitiesByTag(Z){let J=[];return this._entities.forEach((X)=>{if(X.tag===Z)J.push(X)}),J}getEntitiesByTagSubstring(Z){let J=[];return this._entities.forEach((X)=>{if(X.tag?.includes(Z))J.push(X)}),J}getEntityChildren(Z){let J=[];return this._entities.forEach((X)=>{if(X.parent===Z)J.push(X)}),J}tickEntities(Z){this._entities.forEach((J)=>{J.tick(Z)})}checkAndEmitUpdates(){this._entities.forEach((Z)=>{if(!Z.isSpawned)return;Z.checkAndEmitUpdates()})}}class Wq{_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 MJ1;((X)=>{X[X.POINTLIGHT=0]="POINTLIGHT";X[X.SPOTLIGHT=1]="SPOTLIGHT"})(MJ1||={});var Zf;((q)=>{q.DESPAWN="LIGHT.DESPAWN";q.SET_ANGLE="LIGHT.SET_ANGLE";q.SET_ATTACHED_TO_ENTITY="LIGHT.SET_ATTACHED_TO_ENTITY";q.SET_COLOR="LIGHT.SET_COLOR";q.SET_DISTANCE="LIGHT.SET_DISTANCE";q.SET_INTENSITY="LIGHT.SET_INTENSITY";q.SET_OFFSET="LIGHT.SET_OFFSET";q.SET_PENUMBRA="LIGHT.SET_PENUMBRA";q.SET_POSITION="LIGHT.SET_POSITION";q.SET_TRACKED_ENTITY="LIGHT.SET_TRACKED_ENTITY";q.SET_TRACKED_POSITION="LIGHT.SET_TRACKED_POSITION";q.SPAWN="LIGHT.SPAWN"})(Zf||={});class Jf extends g0{_id;_angle;_attachedToEntity;_color;_distance;_intensity;_offset;_penumbra;_position;_trackedEntity;_trackedPosition;_type;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)m.fatalError("Either attachedToEntity or position must be set, but not both");super();m.warning("WARNING: Lights are poorly optimized at this time. Using more than a few lights in your game can cause extremely bad performance (FPS) issues. Use lights sparingly!"),this._angle=Z.angle,this._attachedToEntity=Z.attachedToEntity,this._color=Z.color??{r:255,g:255,b:255},this._distance=Z.distance,this._intensity=Z.intensity??1,this._offset=Z.offset,this._penumbra=Z.penumbra,this._position=Z.position,this._trackedEntity=Z.trackedEntity,this._trackedPosition=Z.trackedPosition,this._type=Z.type??0}get id(){return this._id}get angle(){return this._angle}get attachedToEntity(){return this._attachedToEntity}get color(){return this._color}get distance(){return this._distance}get intensity(){return this._intensity}get isSpawned(){return this._id!==void 0}get offset(){return this._offset}get penumbra(){return this._penumbra}get position(){return this._position}get trackedEntity(){return this._trackedEntity}get trackedPosition(){return this._trackedPosition}get type(){return this._type}get world(){return this._world}setAngle(Z){if(this._angle===Z)return;if(this._angle=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_ANGLE",{light:this,angle:Z})}setAttachedToEntity(Z){if(!Z.isSpawned)return m.error(`Light.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);if(this._attachedToEntity===Z)return;if(this._attachedToEntity=Z,this._position=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_ATTACHED_TO_ENTITY",{light:this,entity:Z})}setColor(Z){if(this._color.r===Z.r&&this._color.g===Z.g&&this._color.b===Z.b)return;if(this._color=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_COLOR",{light:this,color:Z})}setDistance(Z){if(this._distance===Z)return;if(this._distance=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_DISTANCE",{light:this,distance:Z})}setIntensity(Z){if(this._intensity===Z)return;if(this._intensity=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_INTENSITY",{light:this,intensity:Z})}setOffset(Z){if(this._offset===Z)return;if(this._offset=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_OFFSET",{light:this,offset:Z})}setPenumbra(Z){if(this._penumbra===Z)return;if(this._penumbra=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_PENUMBRA",{light:this,penumbra:Z})}setPosition(Z){if(this._position===Z)return;if(this._position=Z,this._attachedToEntity=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_POSITION",{light:this,position:Z})}setTrackedEntity(Z){if(!Z.isSpawned)return m.error(`Light.setTrackedEntity(): Entity ${Z.id} is not spawned!`);if(this._trackedEntity===Z)return;if(this._trackedEntity=Z,this._trackedPosition=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_TRACKED_ENTITY",{light:this,entity:Z})}setTrackedPosition(Z){if(this._trackedPosition===Z)return;if(this._trackedPosition=Z,this._trackedEntity=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_TRACKED_POSITION",{light:this,position:Z})}despawn(){if(!this.isSpawned||!this._world)return;this._world.lightManager.unregisterLight(this),this.emitWithWorld(this._world,"LIGHT.DESPAWN",{light:this}),this._id=void 0,this._world=void 0}spawn(Z){if(this.isSpawned)return;if(this._attachedToEntity&&!this._attachedToEntity.isSpawned)return m.error(`Light.spawn(): Attached entity ${this._attachedToEntity.id} must be spawned before spawning Light!`);this._id=Z.lightManager.registerLight(this),this._world=Z,this.emitWithWorld(Z,"LIGHT.SPAWN",{light:this})}serialize(){return p0.serializeLight(this)}}var RJ1;((Y)=>{Y[Y.FIRST_PERSON=0]="FIRST_PERSON";Y[Y.THIRD_PERSON=1]="THIRD_PERSON";Y[Y.SPECTATOR=2]="SPECTATOR"})(RJ1||={});var Xf;((F)=>{F.LOOK_AT_ENTITY="PLAYER_CAMERA.LOOK_AT_ENTITY";F.LOOK_AT_POSITION="PLAYER_CAMERA.LOOK_AT_POSITION";F.SET_ATTACHED_TO_ENTITY="PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY";F.SET_ATTACHED_TO_POSITION="PLAYER_CAMERA.SET_ATTACHED_TO_POSITION";F.SET_FILM_OFFSET="PLAYER_CAMERA.SET_FILM_OFFSET";F.SET_FORWARD_OFFSET="PLAYER_CAMERA.SET_FORWARD_OFFSET";F.SET_FOV="PLAYER_CAMERA.SET_FOV";F.SET_MODEL_HIDDEN_NODES="PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES";F.SET_MODE="PLAYER_CAMERA.SET_MODE";F.SET_OFFSET="PLAYER_CAMERA.SET_OFFSET";F.SET_TRACKED_ENTITY="PLAYER_CAMERA.SET_TRACKED_ENTITY";F.SET_TRACKED_POSITION="PLAYER_CAMERA.SET_TRACKED_POSITION";F.SET_ZOOM="PLAYER_CAMERA.SET_ZOOM"})(Xf||={});class Gq extends g0{player;_attachedToEntity;_attachedToPosition;_filmOffset=0;_forwardOffset=0;_fov=75;_modelHiddenNodes=new Set;_mode=1;_offset={x:0,y:0,z:0};_orientation={pitch:0,yaw:0};_trackedEntity;_trackedPosition;_zoom=1;constructor(Z){super();this.player=Z}get attachedToEntity(){return this._attachedToEntity}get attachedToPosition(){return this._attachedToPosition}get facingDirection(){return{x:-Math.sin(this._orientation.yaw)*Math.cos(this._orientation.pitch),y:Math.sin(this._orientation.pitch),z:-Math.cos(this._orientation.yaw)*Math.cos(this._orientation.pitch)}}get filmOffset(){return this._filmOffset}get forwardOffset(){return this._forwardOffset}get fov(){return this._fov}get modelHiddenNodes(){return this._modelHiddenNodes}get mode(){return this._mode}get offset(){return this._offset}get orientation(){return this._orientation}get trackedEntity(){return this._trackedEntity}get trackedPosition(){return this._trackedPosition}get zoom(){return this._zoom}lookAtEntity(Z){if(!this._requirePlayerWorld())return;this.emitWithWorld(this.player.world,"PLAYER_CAMERA.LOOK_AT_ENTITY",{playerCamera:this,entity:Z})}lookAtPosition(Z){if(!this._requirePlayerWorld())return;this.emitWithWorld(this.player.world,"PLAYER_CAMERA.LOOK_AT_POSITION",{playerCamera:this,position:Z})}reset(){this._attachedToEntity=void 0,this._attachedToPosition=void 0,this._orientation={pitch:0,yaw:0},this._trackedEntity=void 0,this._trackedPosition=void 0}setAttachedToEntity(Z){if(!this._requirePlayerWorld())return;if(!Z.isSpawned)return m.error(`PlayerCamera.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);this._attachedToEntity=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY",{playerCamera:this,entity:Z})}setAttachedToPosition(Z){if(!this._requirePlayerWorld())return;this._attachedToPosition=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_ATTACHED_TO_POSITION",{playerCamera:this,position:Z})}setFilmOffset(Z){if(!this._requirePlayerWorld())return;this._filmOffset=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FILM_OFFSET",{playerCamera:this,filmOffset:Z})}setForwardOffset(Z){if(!this._requirePlayerWorld())return;this._forwardOffset=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FORWARD_OFFSET",{playerCamera:this,forwardOffset:Z})}setFov(Z){if(!this._requirePlayerWorld())return;this._fov=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FOV",{playerCamera:this,fov:Z})}setModelHiddenNodes(Z){if(!this._requirePlayerWorld())return;this._modelHiddenNodes=new Set(Z.map((J)=>J.toLowerCase())),this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES",{playerCamera:this,modelHiddenNodes:this._modelHiddenNodes})}setMode(Z){if(!this._requirePlayerWorld())return;this._mode=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_MODE",{playerCamera:this,mode:Z})}setOffset(Z){if(!this._requirePlayerWorld())return;this._offset=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_OFFSET",{playerCamera:this,offset:Z})}setOrientationPitch(Z){this._orientation.pitch=Z}setOrientationYaw(Z){this._orientation.yaw=Z}setTrackedEntity(Z){if(!this._requirePlayerWorld())return;this._trackedEntity=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_TRACKED_ENTITY",{playerCamera:this,entity:Z})}setTrackedPosition(Z){if(!this._requirePlayerWorld())return;this._trackedPosition=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_TRACKED_POSITION",{playerCamera:this,position:Z})}setZoom(Z){if(!this._requirePlayerWorld())return;this._zoom=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_ZOOM",{playerCamera:this,zoom:Z})}serialize(){return p0.serializePlayerCamera(this)}_requirePlayerWorld(){if(!this.player.world)m.error(`PlayerCamera._requirePlayerWorld(): Player ${this.player.id} is not in a world!`);return!!this.player.world}}var zM;(($)=>{$.DATA="PLAYER_UI.DATA";$.LOAD="PLAYER_UI.LOAD";$.LOCK_POINTER="PLAYER_UI.LOCK_POINTER";$.SEND_DATA="PLAYER_UI.SEND_DATA"})(zM||={});class zq extends g0{player;constructor(Z){super();this.player=Z}load(Z){if(!this.player.world)return;this.emitWithWorld(this.player.world,"PLAYER_UI.LOAD",{playerUI:this,htmlUri:Z})}lockPointer(Z){if(!this.player.world)return;this.emitWithWorld(this.player.world,"PLAYER_UI.LOCK_POINTER",{playerUI:this,lock:Z})}sendData(Z){if(!this.player.world)return;this.emitWithWorld(this.player.world,"PLAYER_UI.SEND_DATA",{playerUI:this,data:Z})}}class Vq{_colliderHandleBlockTypeMap=new Map;_colliderHandleCollisionCallbackMap=new Map;_colliderHandleEntityMap=new Map;_cleanupBlockTypeColliderHandles=new Set;_pendingCleanupBlockTypeColliderHandles=new Set;_cleanupCollisionCallbackColliderHandles=new Set;_pendingCleanupCollisionCallbackColliderHandles=new Set;_cleanupEntityColliderHandles=new Set;_pendingCleanupEntityColliderHandles=new Set;getColliderBlockType(Z){if(!this._requireSimulatedCollider(Z))return;return this._colliderHandleBlockTypeMap.get(Z.rawCollider.handle)}getColliderCollisionCallback(Z){if(!this._requireSimulatedCollider(Z))return;return this._colliderHandleCollisionCallbackMap.get(Z.rawCollider.handle)}getColliderEntity(Z){if(!this._requireSimulatedCollider(Z))return;return this._colliderHandleEntityMap.get(Z.rawCollider.handle)}getColliderHandleBlockType(Z){return this._colliderHandleBlockTypeMap.get(Z)}getColliderHandleCollisionCallback(Z){return this._colliderHandleCollisionCallbackMap.get(Z)}getColliderHandleEntity(Z){return this._colliderHandleEntityMap.get(Z)}removeColliderBlockType(Z){if(!this._requireSimulatedCollider(Z))return;this.removeColliderHandleBlockType(Z.rawCollider.handle)}removeColliderCollisionCallback(Z){if(!this._requireSimulatedCollider(Z))return;this.removeColliderHandleCollisionCallback(Z.rawCollider.handle)}removeColliderEntity(Z){if(!this._requireSimulatedCollider(Z))return;this.removeColliderHandleEntity(Z.rawCollider.handle)}removeColliderHandleBlockType(Z){this._colliderHandleBlockTypeMap.delete(Z)}removeColliderHandleCollisionCallback(Z){this._colliderHandleCollisionCallbackMap.delete(Z)}removeColliderHandleEntity(Z){this._colliderHandleEntityMap.delete(Z)}setColliderBlockType(Z,J){if(!this._requireSimulatedCollider(Z))return;this.setColliderHandleBlockType(Z.rawCollider.handle,J)}setColliderCollisionCallback(Z,J){if(!this._requireSimulatedCollider(Z))return;this.setColliderHandleCollisionCallback(Z.rawCollider.handle,J)}setColliderEntity(Z,J){if(!this._requireSimulatedCollider(Z))return;this.setColliderHandleEntity(Z.rawCollider.handle,J)}setColliderHandleBlockType(Z,J){this._colliderHandleBlockTypeMap.set(Z,J),this._cleanupBlockTypeColliderHandles.delete(Z),this._pendingCleanupBlockTypeColliderHandles.delete(Z)}setColliderHandleCollisionCallback(Z,J){this._colliderHandleCollisionCallbackMap.set(Z,J),this._cleanupCollisionCallbackColliderHandles.delete(Z),this._pendingCleanupCollisionCallbackColliderHandles.delete(Z)}setColliderHandleEntity(Z,J){this._colliderHandleEntityMap.set(Z,J),this._cleanupEntityColliderHandles.delete(Z),this._pendingCleanupEntityColliderHandles.delete(Z)}queueColliderHandleForCleanup(Z){if(this._colliderHandleBlockTypeMap.has(Z))this._pendingCleanupBlockTypeColliderHandles.add(Z);if(this._colliderHandleCollisionCallbackMap.has(Z))this._pendingCleanupCollisionCallbackColliderHandles.add(Z);if(this._colliderHandleEntityMap.has(Z))this._pendingCleanupEntityColliderHandles.add(Z)}cleanup(){for(let Z of this._cleanupBlockTypeColliderHandles)this._colliderHandleBlockTypeMap.delete(Z);if(this._cleanupBlockTypeColliderHandles.size>0)this._cleanupBlockTypeColliderHandles.clear();for(let Z of this._cleanupCollisionCallbackColliderHandles)this._colliderHandleCollisionCallbackMap.delete(Z);if(this._cleanupCollisionCallbackColliderHandles.size>0)this._cleanupCollisionCallbackColliderHandles.clear();for(let Z of this._cleanupEntityColliderHandles)this._colliderHandleEntityMap.delete(Z);if(this._cleanupEntityColliderHandles.size>0)this._cleanupEntityColliderHandles.clear();for(let Z of this._pendingCleanupBlockTypeColliderHandles.keys())this._cleanupBlockTypeColliderHandles.add(Z);if(this._pendingCleanupBlockTypeColliderHandles.size>0)this._pendingCleanupBlockTypeColliderHandles.clear();for(let Z of this._pendingCleanupCollisionCallbackColliderHandles.keys())this._cleanupCollisionCallbackColliderHandles.add(Z);if(this._pendingCleanupCollisionCallbackColliderHandles.size>0)this._pendingCleanupCollisionCallbackColliderHandles.clear();for(let Z of this._pendingCleanupEntityColliderHandles.keys())this._cleanupEntityColliderHandles.add(Z);if(this._pendingCleanupEntityColliderHandles.size>0)this._pendingCleanupEntityColliderHandles.clear()}_requireSimulatedCollider(Z){if(!Z.rawCollider)m.error("ColliderMap._requireSimulatedCollider(): Collider is not in the simulation.");return!!Z.rawCollider}}var N16={x:0,y:-32,z:0},Yf=60,$f;(($)=>{$.STEP_START="SIMULATION.STEP_START";$.STEP_END="SIMULATION.STEP_END";$.DEBUG_RAYCAST="SIMULATION.DEBUG_RAYCAST";$.DEBUG_RENDER="SIMULATION.DEBUG_RENDER"})($f||={});class Hq extends g0{_colliderMap=new Vq;_debugRaycastingEnabled=!1;_debugRenderingEnabled=!1;_debugRenderingFilterFlags;_rapierEventQueue;_rapierSimulation;_world;constructor(Z,J=Yf,X=N16){super();this._rapierEventQueue=new $1.EventQueue(!0),this._rapierSimulation=new $1.World(X),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,X,Y={}){let $=new $1.Ray(Z,J),Q=this._rapierSimulation.castRay($,X,Y.ignoresSensors??!0,Y.filterFlags,Y.filterGroups,Y.filterExcludeCollider,Y.filterExcludeRigidBody,Y.filterPredicate);if(this._debugRaycastingEnabled)this.emitWithWorld(this._world,"SIMULATION.DEBUG_RAYCAST",{simulation:this,origin:Z,direction:J,length:X,hit:!!Q});if(!Q)return null;let K=$.pointAt(Q.timeOfImpact),W=Q.timeOfImpact,G=Q.collider,z=this._colliderMap.getColliderHandleBlockType(G.handle);if(z)return{hitBlock:ZQ.fromGlobalCoordinate({x:Math.floor(K.x-($.dir.x<0?0.0001:-0.0001)),y:Math.floor(K.y-($.dir.y<0?0.0001:-0.0001)),z:Math.floor(K.z-($.dir.z<0?0.0001:-0.0001))},z),hitPoint:K,hitDistance:W};let V=this._colliderMap.getColliderHandleEntity(G.handle);if(V)return{hitEntity:V,hitPoint:K,hitDistance:W};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,J=$1.QueryFilterFlags.EXCLUDE_FIXED){this._debugRenderingEnabled=Z,this._debugRenderingFilterFlags=J}getContactManifolds(Z,J){let X=[];return this._rapierSimulation.narrowPhase.contactPair(Z,J,(Y,$)=>{if(Y.numContacts()===0)return;let Q=Y.normal(),K=[];for(let W=0;W<Y.numSolverContacts();W++)K.push(Y.solverContactPoint(W));X.push({contactPoints:K,localNormalA:!$?Y.localNormal1():Y.localNormal2(),localNormalB:!$?Y.localNormal2():Y.localNormal1(),normal:!$?Q:{x:-Q.x,y:-Q.y,z:-Q.z}})}),X}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(Q8.startSpan({operation:"physics_step"},()=>{this._rapierSimulation.step(this._rapierEventQueue)}),Q8.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(this._debugRenderingFilterFlags)})};_onCollisionEvent=(Z,J,X)=>{let[Y,$]=this._getCollisionObjects(Z,J);if(!Y||!$)return;let Q=(K,W)=>{if(K instanceof s5&&W instanceof a8&&K.hasListeners("BLOCK_TYPE.ENTITY_COLLISION"))K.emit("BLOCK_TYPE.ENTITY_COLLISION",{blockType:K,entity:W,started:X,colliderHandleA:Z,colliderHandleB:J});else if(K instanceof a8&&W instanceof s5&&K.hasListeners("ENTITY.BLOCK_COLLISION"))K.emit("ENTITY.BLOCK_COLLISION",{entity:K,blockType:W,started:X,colliderHandleA:Z,colliderHandleB:J});else if(K instanceof a8&&W instanceof a8&&K.hasListeners("ENTITY.ENTITY_COLLISION"))K.emit("ENTITY.ENTITY_COLLISION",{entity:K,otherEntity:W,started:X,colliderHandleA:Z,colliderHandleB:J});else if(typeof K==="function"&&(W instanceof a8||W instanceof s5))K(W,X,Z,J)};Q(Y,$),Q($,Y)};_onContactForceEvent=(Z)=>{let[J,X]=this._getCollisionObjects(Z.collider1(),Z.collider2());if(!J||typeof J==="function"||!X||typeof X==="function")return;let Y={totalForce:Z.totalForce(),totalForceMagnitude:Z.totalForceMagnitude(),maxForceDirection:Z.maxForceDirection(),maxForceMagnitude:Z.maxForceMagnitude()},$=(Q,K)=>{if(Q instanceof s5&&K instanceof a8&&Q.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))Q.emit("BLOCK_TYPE.ENTITY_CONTACT_FORCE",{blockType:Q,entity:K,contactForceData:Y});else if(Q instanceof a8&&K instanceof s5&&Q.hasListeners("ENTITY.BLOCK_CONTACT_FORCE"))Q.emit("ENTITY.BLOCK_CONTACT_FORCE",{entity:Q,blockType:K,contactForceData:Y});else if(Q instanceof a8&&K instanceof a8&&Q.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))Q.emit("ENTITY.ENTITY_CONTACT_FORCE",{entity:Q,otherEntity:K,contactForceData:Y})};$(J,X),$(X,J)};_getCollisionObjects(Z,J){let X=this._colliderMap.getColliderHandleBlockType(Z)??this._colliderMap.getColliderHandleCollisionCallback(Z)??this._colliderMap.getColliderHandleEntity(Z),Y=this._colliderMap.getColliderHandleBlockType(J)??this._colliderMap.getColliderHandleCollisionCallback(J)??this._colliderMap.getColliderHandleEntity(J);return[X,Y]}}class VM{_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=[],X=this._world.loop.currentTick;this._queuedPerPlayerSynchronizations.forEach((q,F)=>{this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(...q)});let Y=Object.values(this._queuedEntitySynchronizations);if(Y.length>0){let[q,F]=Y.reduce(([U,w],L)=>{for(let j in L)if(j!=="i"&&j!=="p"&&j!=="r")return U.push(L),[U,w];return w.push(L),[U,w]},[[],[]]);if(F.length>0){let U=X0.createPacket(X0.outboundPackets.entitiesPacketDefinition,F,X);J.push(U)}if(q.length>0){let U=X0.createPacket(X0.outboundPackets.entitiesPacketDefinition,q,X);Z.push(U),this._synchronizedPlayerReliablePackets.forEach((w)=>w.push(U))}}let $=Object.values(this._queuedAudioSynchronizations);if($.length>0){let q=X0.createPacket(X0.outboundPackets.audiosPacketDefinition,$,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let Q=Object.values(this._queuedBlockTypeSynchronizations);if(Q.length>0){let q=X0.createPacket(X0.outboundPackets.blockTypesPacketDefinition,Q,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let K=Object.values(this._queuedBlockSynchronizations);if(K.length>0){let q=X0.createPacket(X0.outboundPackets.blocksPacketDefinition,K,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let W=Object.values(this._queuedChunkSynchronizations);if(W.length>0){let q=X0.createPacket(X0.outboundPackets.chunksPacketDefinition,W,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}let G=Object.values(this._queuedLightSynchronizations);if(G.length>0){let q=X0.createPacket(X0.outboundPackets.lightsPacketDefinition,G,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}this._queuedPerPlayerUISynchronizations.forEach((q,F)=>{let U=X0.createPacket(X0.outboundPackets.uiPacketDefinition,q,X);this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(U)}),this._queuedPerPlayerUIDatasSynchronizations.forEach((q,F)=>{let U=X0.createPacket(X0.outboundPackets.uiDatasPacketDefinition,q,X);this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(U)});let z=Object.values(this._queuedSceneUISynchronizations);if(z.length>0){let q=X0.createPacket(X0.outboundPackets.sceneUIsPacketDefinition,z,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}if(this._queuedWorldSynchronization){let q=X0.createPacket(X0.outboundPackets.worldPacketDefinition,this._queuedWorldSynchronization,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}this._queuedPerPlayerCameraSynchronizations.forEach((q,F)=>{let U=X0.createPacket(X0.outboundPackets.cameraPacketDefinition,q,X);this._createOrGetSynchronizedPlayerReliablePackets(F,Z).push(U)});let V=Object.values(this._queuedPlayerSynchronizations);if(V.length>0){let q=X0.createPacket(X0.outboundPackets.playersPacketDefinition,V,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}this._queuedBroadcasts.forEach((q)=>{Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))});let H=this._queuedDebugRaycastSynchronizations;if(H.length>0){let q=X0.createPacket(X0.outboundPackets.physicsDebugRaycastsPacketDefinition,H,X);Z.push(q),this._synchronizedPlayerReliablePackets.forEach((F)=>F.push(q))}Q8.startSpan({operation:"send_all_packets"},()=>{e5.instance.getConnectedPlayersByWorld(this._world).forEach((q)=>{let F=this._synchronizedPlayerReliablePackets.get(q)??Z;if(F.length>0)q.connection.send(F);if(J.length>0)q.connection.send(J,!1)})}),Q8.startSpan({operation:"network_synchronize_cleanup"},()=>{if(this._queuedBroadcasts.length>0)this._queuedBroadcasts=[];if($.length>0)this._queuedAudioSynchronizations={};if(K.length>0)this._queuedBlockSynchronizations={};if(Q.length>0)this._queuedBlockTypeSynchronizations={};if(W.length>0)this._queuedChunkSynchronizations={};if(H.length>0)this._queuedDebugRaycastSynchronizations=[];if(Y.length>0)this._queuedEntitySynchronizations={};if(G.length>0)this._queuedLightSynchronizations={};if(this._queuedPerPlayerSynchronizations.size>0)this._queuedPerPlayerSynchronizations.clear();if(this._queuedPerPlayerCameraSynchronizations.size>0)this._queuedPerPlayerCameraSynchronizations.clear();if(this._queuedPerPlayerUISynchronizations.size>0)this._queuedPerPlayerUISynchronizations.clear();if(this._queuedPerPlayerUIDatasSynchronizations.size>0)this._queuedPerPlayerUIDatasSynchronizations.clear();if(V.length>0)this._queuedPlayerSynchronizations={};if(z.length>0)this._queuedSceneUISynchronizations={};if(this._queuedWorldSynchronization)this._queuedWorldSynchronization=void 0;if(this._loadedSceneUIs.size>0)this._loadedSceneUIs.clear();if(this._spawnedChunks.size>0)this._spawnedChunks.clear();if(this._spawnedEntities.size>0)this._spawnedEntities.clear();if(this._synchronizedPlayerReliablePackets.size>0)this._synchronizedPlayerReliablePackets.clear()})}_subscribeToAudioEvents(){this._world.final("AUDIO.PAUSE",this._onAudioPause),this._world.final("AUDIO.PLAY",this._onAudioPlay),this._world.final("AUDIO.PLAY_RESTART",this._onAudioPlayRestart),this._world.final("AUDIO.SET_ATTACHED_TO_ENTITY",this._onAudioSetAttachedToEntity),this._world.final("AUDIO.SET_CUTOFF_DISTANCE",this._onAudioSetCutoffDistance),this._world.final("AUDIO.SET_DETUNE",this._onAudioSetDetune),this._world.final("AUDIO.SET_DISTORTION",this._onAudioSetDistortion),this._world.final("AUDIO.SET_POSITION",this._onAudioSetPosition),this._world.final("AUDIO.SET_PLAYBACK_RATE",this._onAudioSetPlaybackRate),this._world.final("AUDIO.SET_REFERENCE_DISTANCE",this._onAudioSetReferenceDistance),this._world.final("AUDIO.SET_VOLUME",this._onAudioSetVolume)}_subscribeToBlockTypeRegistryEvents(){this._world.final("BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE",this._onBlockTypeRegistryRegisterBlockType)}_subscribeToChatEvents(){this._world.final("CHAT.BROADCAST_MESSAGE",this._onChatSendBroadcastMessage),this._world.final("CHAT.PLAYER_MESSAGE",this._onChatSendPlayerMessage)}_subscribeToChunkEvents(){this._world.final("CHUNK.SPAWN",this._onChunkSpawn),this._world.final("CHUNK.DESPAWN",this._onChunkDespawn),this._world.final("CHUNK.SET_BLOCK",this._onChunkSetBlock)}_subscribeToEntityEvents(){this._world.final("ENTITY.SPAWN",this._onEntitySpawn),this._world.final("ENTITY.DESPAWN",this._onEntityDespawn),this._world.final("ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE",this._onEntitySetModelAnimationsPlaybackRate),this._world.final("ENTITY.SET_MODEL_HIDDEN_NODES",this._onEntitySetModelHiddenNodes),this._world.final("ENTITY.SET_OPACITY",this._onEntitySetOpacity),this._world.final("ENTITY.SET_PARENT",this._onEntitySetParent),this._world.final("ENTITY.SET_TINT_COLOR",this._onEntitySetTintColor),this._world.final("ENTITY.START_MODEL_LOOPED_ANIMATIONS",this._onEntityStartModelLoopedAnimations),this._world.final("ENTITY.START_MODEL_ONESHOT_ANIMATIONS",this._onEntityStartModelOneshotAnimations),this._world.final("ENTITY.STOP_MODEL_ANIMATIONS",this._onEntityStopModelAnimations),this._world.final("ENTITY.UPDATE_POSITION",this._onEntityUpdatePosition),this._world.final("ENTITY.UPDATE_ROTATION",this._onEntityUpdateRotation)}_subscribeToLightEvents(){this._world.final("LIGHT.DESPAWN",this._onLightDespawn),this._world.final("LIGHT.SET_ANGLE",this._onLightSetAngle),this._world.final("LIGHT.SET_ATTACHED_TO_ENTITY",this._onLightSetAttachedToEntity),this._world.final("LIGHT.SET_COLOR",this._onLightSetColor),this._world.final("LIGHT.SET_DISTANCE",this._onLightSetDistance),this._world.final("LIGHT.SET_INTENSITY",this._onLightSetIntensity),this._world.final("LIGHT.SET_OFFSET",this._onLightSetOffset),this._world.final("LIGHT.SET_PENUMBRA",this._onLightSetPenumbra),this._world.final("LIGHT.SET_POSITION",this._onLightSetPosition),this._world.final("LIGHT.SET_TRACKED_ENTITY",this._onLightSetTrackedEntity),this._world.final("LIGHT.SET_TRACKED_POSITION",this._onLightSetTrackedPosition),this._world.final("LIGHT.SPAWN",this._onLightSpawn)}_subscribeToPlayerEvents(){this._world.final("PLAYER.JOINED_WORLD",this._onPlayerJoinedWorld),this._world.final("PLAYER.LEFT_WORLD",this._onPlayerLeftWorld),this._world.final("PLAYER.RECONNECTED_WORLD",this._onPlayerReconnectedWorld),this._world.final("PLAYER.REQUEST_SYNC",this._onPlayerRequestSync)}_subscribeToPlayerCameraEvents(){this._world.final("PLAYER_CAMERA.LOOK_AT_ENTITY",this._onPlayerCameraLookAtEntity),this._world.final("PLAYER_CAMERA.LOOK_AT_POSITION",this._onPlayerCameraLookAtPosition),this._world.final("PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY",this._onPlayerCameraSetAttachedToEntity),this._world.final("PLAYER_CAMERA.SET_ATTACHED_TO_POSITION",this._onPlayerCameraSetAttachedToPosition),this._world.final("PLAYER_CAMERA.SET_FILM_OFFSET",this._onPlayerCameraSetFilmOffset),this._world.final("PLAYER_CAMERA.SET_FORWARD_OFFSET",this._onPlayerCameraSetForwardOffset),this._world.final("PLAYER_CAMERA.SET_FOV",this._onPlayerCameraSetFov),this._world.final("PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES",this._onPlayerCameraSetModelHiddenNodes),this._world.final("PLAYER_CAMERA.SET_MODE",this._onPlayerCameraSetMode),this._world.final("PLAYER_CAMERA.SET_OFFSET",this._onPlayerCameraSetOffset),this._world.final("PLAYER_CAMERA.SET_TRACKED_ENTITY",this._onPlayerCameraSetTrackedEntity),this._world.final("PLAYER_CAMERA.SET_TRACKED_POSITION",this._onPlayerCameraSetTrackedPosition),this._world.final("PLAYER_CAMERA.SET_ZOOM",this._onPlayerCameraSetZoom)}_subscribeToPlayerUIEvents(){this._world.final("PLAYER_UI.LOAD",this._onPlayerUILoad),this._world.final("PLAYER_UI.LOCK_POINTER",this._onPlayerUILockPointer),this._world.final("PLAYER_UI.SEND_DATA",this._onPlayerUISendData)}_subscribeToSceneUIEvents(){this._world.final("SCENE_UI.LOAD",this._onSceneUILoad),this._world.final("SCENE_UI.SET_ATTACHED_TO_ENTITY",this._onSceneUISetAttachedToEntity),this._world.final("SCENE_UI.SET_OFFSET",this._onSceneUISetOffset),this._world.final("SCENE_UI.SET_POSITION",this._onSceneUISetPosition),this._world.final("SCENE_UI.SET_STATE",this._onSceneUISetState),this._world.final("SCENE_UI.SET_VIEW_DISTANCE",this._onSceneUISetViewDistance),this._world.final("SCENE_UI.UNLOAD",this._onSceneUIUnload)}_subscribeToSimulationEvents(){this._world.final("SIMULATION.DEBUG_RAYCAST",this._onSimulationDebugRaycast),this._world.final("SIMULATION.DEBUG_RENDER",this._onSimulationDebugRender)}_subscribeToWorldEvents(){this._world.final("WORLD.SET_AMBIENT_LIGHT_COLOR",this._onWorldSetAmbientLightColor),this._world.final("WORLD.SET_AMBIENT_LIGHT_INTENSITY",this._onWorldSetAmbientLightIntensity),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_COLOR",this._onWorldSetDirectionalLightColor),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY",this._onWorldSetDirectionalLightIntensity),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_POSITION",this._onWorldSetDirectionalLightPosition),this._world.final("WORLD.SET_SKYBOX_INTENSITY",this._onWorldSetSkyboxIntensity)}_onAudioPause=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.pa=!0,delete J.pl,delete J.r};_onAudioPlay=(Z)=>{let J=Z.audio.serialize();J.pl=!0,delete J.pa,delete J.r,this._queuedAudioSynchronizations[J.i]=J};_onAudioPlayRestart=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.r=!0,delete J.pa,delete J.pl,this._queuedAudioSynchronizations[J.i]=J};_onAudioSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onAudioSetCutoffDistance=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.cd=Z.cutoffDistance};_onAudioSetDetune=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.de=Z.detune};_onAudioSetDistortion=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.di=Z.distortion};_onAudioSetPosition=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.e=Z.position?void 0:J.e,J.p=Z.position?p0.serializeVector(Z.position):void 0};_onAudioSetPlaybackRate=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.pr=Z.playbackRate};_onAudioSetReferenceDistance=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.rd=Z.referenceDistance};_onAudioSetVolume=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.v=Z.volume};_onBlockTypeRegistryRegisterBlockType=(Z)=>{let J=Z.blockType.serialize();this._queuedBlockTypeSynchronizations[Z.blockType.id]=J};_onChatSendBroadcastMessage=(Z)=>{let{player:J,message:X,color:Y}=Z;this._queuedBroadcasts.push(X0.createPacket(X0.outboundPackets.chatMessagesPacketDefinition,[{m:X,c:Y,p:J?.id}],this._world.loop.currentTick))};_onChatSendPlayerMessage=(Z)=>{let{player:J,message:X,color:Y}=Z,$=this._queuedPerPlayerSynchronizations.get(J)??[];$.push(X0.createPacket(X0.outboundPackets.chatMessagesPacketDefinition,[{m:X,c:Y}],this._world.loop.currentTick)),this._queuedPerPlayerSynchronizations.set(J,$)};_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),X=J.c.join(",");if(this._spawnedChunks.has(X))delete this._queuedChunkSynchronizations[X],this._spawnedChunks.delete(X);else J.rm=!0};_onChunkSetBlock=(Z)=>{let J=this._createOrGetQueuedBlockSync(Z.globalCoordinate);J.i=Z.blockTypeId};_onEntitySetModelAnimationsPlaybackRate=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.ap=Z.playbackRate};_onEntitySpawn=(Z)=>{let J=Z.entity.serialize();this._queuedEntitySynchronizations[J.i]=J,this._spawnedEntities.add(J.i)};_onEntityDespawn=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(this._spawnedEntities.has(J.i))delete this._queuedEntitySynchronizations[J.i],this._spawnedEntities.delete(J.i);else J.rm=!0};_onEntitySetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.h=Array.from(Z.modelHiddenNodes)};_onEntitySetOpacity=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.o=Z.opacity};_onEntitySetParent=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.pe=Z.parent?Z.parent.id:void 0,J.pn=Z.parentNodeName};_onEntitySetTintColor=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.t=Z.tintColor?p0.serializeRgbColor(Z.tintColor):void 0};_onEntityStartModelLoopedAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.al=Array.from(new Set([...J.al??[],...Z.animations])),J.as)J.as=J.as.filter((X)=>!Z.animations.has(X)).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((X)=>!Z.animations.has(X)).filter(Boolean)};_onEntityStopModelAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.al)J.al=J.al.filter((X)=>!Z.animations.has(X)).filter(Boolean);if(J.ao)J.ao=J.ao.filter((X)=>!Z.animations.has(X)).filter(Boolean);J.as=Array.from(new Set([...J.as??[],...Z.animations]))};_onEntityUpdateRotation=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.r=[Z.rotation.x,Z.rotation.y,Z.rotation.z,Z.rotation.w]};_onEntityUpdatePosition=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.p=[Z.position.x,Z.position.y,Z.position.z]};_onLightDespawn=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.rm=!0};_onLightSetAngle=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.a=Z.angle};_onLightSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onLightSetColor=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.c=p0.serializeRgbColor(Z.color)};_onLightSetDistance=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.d=Z.distance};_onLightSetIntensity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.n=Z.intensity};_onLightSetOffset=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.o=Z.offset?p0.serializeVector(Z.offset):void 0};_onLightSetPenumbra=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.pe=Z.penumbra};_onLightSetPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.p=Z.position?p0.serializeVector(Z.position):void 0,J.e=Z.position?void 0:J.e};_onLightSetTrackedEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.te=Z.entity?Z.entity.id:void 0,J.tp=Z.entity?void 0:J.tp};_onLightSetTrackedPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.tp=Z.position?p0.serializeVector(Z.position):void 0,J.te=Z.position?void 0:J.te};_onLightSpawn=(Z)=>{let J=Z.light.serialize();this._queuedLightSynchronizations[J.i]=J};_onPlayerCameraLookAtEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=p0.serializeVector(Z.entity.position),delete J.et,delete J.pt};_onPlayerCameraLookAtPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=Z.position?p0.serializeVector(Z.position):void 0,delete J.et,delete J.pt};_onPlayerCameraSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.e=Z.entity.id,delete J.p};_onPlayerCameraSetAttachedToPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.p=Z.position?p0.serializeVector(Z.position):void 0,delete J.e};_onPlayerCameraSetFilmOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fo=Z.filmOffset};_onPlayerCameraSetForwardOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.ffo=Z.forwardOffset};_onPlayerCameraSetFov=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fv=Z.fov};_onPlayerCameraSetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.h=Array.from(Z.modelHiddenNodes)};_onPlayerCameraSetMode=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.m=Z.mode};_onPlayerCameraSetOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.o=Z.offset?p0.serializeVector(Z.offset):void 0};_onPlayerCameraSetTrackedEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.et=Z.entity?Z.entity.id:void 0,delete J.pl,delete J.pt};_onPlayerCameraSetTrackedPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pt=Z.position?p0.serializeVector(Z.position):void 0,delete J.et,delete J.pl};_onPlayerCameraSetZoom=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.z=Z.zoom};_onPlayerJoinedWorld=(Z)=>{let{player:J}=Z,X=this._queuedPerPlayerSynchronizations.get(J)??[];X.push(X0.createPacket(X0.outboundPackets.worldPacketDefinition,this._world.serialize(),this._world.loop.currentTick)),X.push(X0.createPacket(X0.outboundPackets.blockTypesPacketDefinition,this._world.blockTypeRegistry.serialize(),this._world.loop.currentTick)),X.push(X0.createPacket(X0.outboundPackets.chunksPacketDefinition,this._world.chunkLattice.getAllChunks().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(X0.createPacket(X0.outboundPackets.entitiesPacketDefinition,this._world.entityManager.getAllEntities().map(($)=>{if(J.camera.attachedToEntity===void 0&&$ instanceof c7&&$.player===J)J.camera.setAttachedToEntity($);return $.serialize()}),this._world.loop.currentTick)),X.push(X0.createPacket(X0.outboundPackets.audiosPacketDefinition,this._world.audioManager.getAllAudios().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(X0.createPacket(X0.outboundPackets.lightsPacketDefinition,this._world.lightManager.getAllLights().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(X0.createPacket(X0.outboundPackets.sceneUIsPacketDefinition,this._world.sceneUIManager.getAllSceneUIs().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(X0.createPacket(X0.outboundPackets.playersPacketDefinition,e5.instance.getConnectedPlayers().map(($)=>$.serialize()),this._world.loop.currentTick));let Y=this._createOrGetQueuedPlayerCameraSync(J.camera);this._queuedPerPlayerCameraSynchronizations.set(J,{...J.camera.serialize(),...Y}),this._queuedPerPlayerSynchronizations.set(J,X),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([X0.createPacket(X0.outboundPackets.syncResponsePacketDefinition,{r:Z.receivedAt,s:Date.now(),p:performance.now()-Z.receivedAtMs,n:this._world.loop.nextTickMs},this._world.loop.currentTick)])};_onPlayerUILoad=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.u=Z.htmlUri};_onPlayerUILockPointer=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.p=Z.lock};_onPlayerUISendData=(Z)=>{this._createOrGetQueuedPlayerUIDatasSync(Z.playerUI).push(Z.data)};_onSceneUILoad=(Z)=>{let J=Z.sceneUI.serialize();this._queuedSceneUISynchronizations[J.i]=J,this._loadedSceneUIs.add(J.i)};_onSceneUISetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onSceneUISetOffset=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.o=Z.offset?p0.serializeVector(Z.offset):void 0};_onSceneUISetPosition=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.p=Z.position?p0.serializeVector(Z.position):void 0,J.e=Z.position?void 0:J.e};_onSceneUISetState=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.s=Z.state};_onSceneUISetViewDistance=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.v=Z.viewDistance};_onSceneUIUnload=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);if(this._loadedSceneUIs.has(J.i))delete this._queuedSceneUISynchronizations[J.i],this._loadedSceneUIs.delete(J.i);else J.rm=!0};_onSimulationDebugRaycast=(Z)=>{this._queuedDebugRaycastSynchronizations.push(p0.serializePhysicsDebugRaycast(Z))};_onSimulationDebugRender=(Z)=>{this._queuedBroadcasts.push(X0.createPacket(X0.outboundPackets.physicsDebugRenderPacketDefinition,{v:Array.from(Z.vertices),c:Array.from(Z.colors)},this._world.loop.currentTick))};_onWorldSetAmbientLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ac=p0.serializeRgbColor(Z.color)};_onWorldSetAmbientLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ai=Z.intensity};_onWorldSetDirectionalLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dc=p0.serializeRgbColor(Z.color)};_onWorldSetDirectionalLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.di=Z.intensity};_onWorldSetDirectionalLightPosition=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dp=p0.serializeVector(Z.position)};_onWorldSetSkyboxIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.si=Z.intensity};_createOrGetQueuedAudioSync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedAudioSync(): Audio has no id!");return this._queuedAudioSynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedBlockSync(Z){let{x:J,y:X,z:Y}=Z;return this._queuedBlockSynchronizations[`${J},${X},${Y}`]??={i:0,c:[J,X,Y]}}_createOrGetQueuedChunkSync(Z){if(!Z.originCoordinate)m.fatalError("NetworkSynchronizer._createOrGetQueuedChunkSync(): Chunk has no origin coordinate!");let{x:J,y:X,z:Y}=Z.originCoordinate;return this._queuedChunkSynchronizations[`${J},${X},${Y}`]??={c:[J,X,Y]}}_createOrGetQueuedEntitySync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedEntitySync(): Entity has no id!");return this._queuedEntitySynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedLightSync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedLightSync(): Light has no id!");return this._queuedLightSynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedPlayerSync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedPlayerSync(): Player has no id!");return this._queuedPlayerSynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedPlayerCameraSync(Z){let J=this._queuedPerPlayerCameraSynchronizations.get(Z.player);if(!J)J={},this._queuedPerPlayerCameraSynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUISync(Z){let J=this._queuedPerPlayerUISynchronizations.get(Z.player);if(!J)J={},this._queuedPerPlayerUISynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUIDatasSync(Z){let J=this._queuedPerPlayerUIDatasSynchronizations.get(Z.player);if(!J)J=[],this._queuedPerPlayerUIDatasSynchronizations.set(Z.player,J);return J}_createOrGetQueuedSceneUISync(Z){if(Z.id===void 0)m.fatalError("NetworkSynchronizer._createOrGetQueuedSceneUISync(): SceneUI has no id!");return this._queuedSceneUISynchronizations[Z.id]??={i:Z.id}}_createOrGetQueuedWorldSync(Z){if(Z.id!==this._world.id)m.fatalError("NetworkSynchronizer._createOrGetQueuedWorldSync(): World does not match this network synchronizer world!");return this._queuedWorldSynchronization??={i:Z.id}}_createOrGetSynchronizedPlayerReliablePackets(Z,J){let X=this._synchronizedPlayerReliablePackets.get(Z);if(!X)X=[...J],this._synchronizedPlayerReliablePackets.set(Z,X);return X}}class qq{_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 P16=2,D16=3;class Fq{_accumulatorMs=0;_targetTicksPerSecond;_fixedTimestepMs;_fixedTimestepS;_maxAccumulatorMs;_nextTickMs=0;_lastLoopTimeMs=0;_tickFunction;_tickErrorCallback;_tickHandle=null;constructor(Z,J,X){this._targetTicksPerSecond=Z,this._fixedTimestepS=Math.fround(1/Z),this._fixedTimestepMs=Math.fround(this._fixedTimestepS*1000),this._maxAccumulatorMs=this._fixedTimestepMs*D16,this._tickFunction=J,this._tickErrorCallback=X}get targetTicksPerSecond(){return this._targetTicksPerSecond}get fixedTimestepMs(){return this._fixedTimestepMs}get fixedTimestepS(){return this._fixedTimestepS}get nextTickMs(){return this._nextTickMs}start(){if(this._tickHandle)return m.warning("Ticker.start(): ticker already running.");this._lastLoopTimeMs=performance.now();let Z=()=>{let J=performance.now(),X=J-this._lastLoopTimeMs;if(this._lastLoopTimeMs=J,this._accumulatorMs+=X,this._accumulatorMs>this._maxAccumulatorMs)this._accumulatorMs=this._maxAccumulatorMs;if(this._accumulatorMs>=this._fixedTimestepMs)Q8.startSpan({operation:"ticker_tick"},()=>{let Y=0;while(this._accumulatorMs>=this._fixedTimestepMs&&Y<P16)this._tick(this._fixedTimestepMs),this._accumulatorMs-=this._fixedTimestepMs,Y++;this._nextTickMs=Math.max(0,this._fixedTimestepMs-this._accumulatorMs)});this._tickHandle=setTimeout(Z,this._nextTickMs)};Z()}stop(){if(!this._tickHandle)return m.warning("Ticker.stop(): ticker not running.");clearTimeout(this._tickHandle),this._tickHandle=null}_tick(Z){try{this._tickFunction(Z)}catch(J){if(J instanceof Error&&this._tickErrorCallback)this._tickErrorCallback(J);else m.warning(`Ticker._tick(): tick callback threw an error, but it was not an instance of Error. Error: ${J}`)}}}var NJ1;((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"})(NJ1||={});class Uq extends g0{_currentTick=0;_ticker;_world;constructor(Z,J=Yf){super();this._ticker=new Fq(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();Q8.startSpan({operation:"world_tick",attributes:{serverPlayerCount:e5.instance.playerCount,targetTickRate:this._ticker.targetTicksPerSecond,targetTickRateMs:this._ticker.fixedTimestepMs,worldId:this._world.id,worldName:this._world.name,worldChunkCount:this._world.chunkLattice.chunkCount,worldEntityCount:this._world.entityManager.entityCount,worldLoopTick:this._currentTick}},()=>{Q8.startSpan({operation:"chunks_update"},()=>this._world.chunkLattice.updateChunks()),Q8.startSpan({operation:"entities_tick"},()=>this._world.entityManager.tickEntities(Z)),Q8.startSpan({operation:"simulation_step"},()=>this._world.simulation.step(Z)),Q8.startSpan({operation:"entities_emit_updates"},()=>this._world.entityManager.checkAndEmitUpdates()),Q8.startSpan({operation:"network_synchronize"},()=>this._world.networkSynchronizer.synchronize())}),this._currentTick++,this.emitWithWorld(this._world,"WORLD_LOOP.TICK_END",{worldLoop:this,tickDurationMs:performance.now()-J})};_onTickError=(Z)=>{m.error(`WorldLoop._onTickError(): Error: ${Z}`),this.emitWithWorld(this._world,"WORLD_LOOP.TICK_ERROR",{worldLoop:this,error:Z})}}var Qf;((G)=>{G.SET_AMBIENT_LIGHT_COLOR="WORLD.SET_AMBIENT_LIGHT_COLOR";G.SET_AMBIENT_LIGHT_INTENSITY="WORLD.SET_AMBIENT_LIGHT_INTENSITY";G.SET_DIRECTIONAL_LIGHT_COLOR="WORLD.SET_DIRECTIONAL_LIGHT_COLOR";G.SET_DIRECTIONAL_LIGHT_INTENSITY="WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY";G.SET_DIRECTIONAL_LIGHT_POSITION="WORLD.SET_DIRECTIONAL_LIGHT_POSITION";G.SET_SKYBOX_INTENSITY="WORLD.SET_SKYBOX_INTENSITY";G.START="WORLD.START";G.STOP="WORLD.STOP"})(Qf||={});class Lq extends g0{_id;_ambientLightColor;_ambientLightIntensity;_directionalLightColor;_directionalLightIntensity;_directionalLightPosition;_name;_skyboxIntensity;_skyboxUri;_audioManager;_blockTypeRegistry;_chatManager;_chunkLattice;_entityManager;_lightManager;_loop;_networkSynchronizer;_sceneUIManager;_simulation;_tag;constructor(Z){super();if(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._skyboxIntensity=Z.skyboxIntensity??1,this._skyboxUri=Z.skyboxUri,this._tag=Z.tag,this._audioManager=new $G(this),this._blockTypeRegistry=new S3(this),this._chatManager=new wq(this),this._chunkLattice=new Xq(this),this._entityManager=new Kq(this),this._lightManager=new Wq(this),this._loop=new Uq(this,Z.tickRate),this._networkSynchronizer=new VM(this),this._sceneUIManager=new qq(this),this._simulation=new Hq(this,Z.tickRate,Z.gravity),Z.map)this.loadMap(Z.map)}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 skyboxIntensity(){return this._skyboxIntensity}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,X]of Object.entries(Z.blocks)){let[Y,$,Q]=J.split(",").map(Number);this.chunkLattice.setBlock({x:Y,y:$,z:Q},X)}if(Z.entities)for(let[J,X]of Object.entries(Z.entities)){let[Y,$,Q]=J.split(",").map(Number);new a8(X).spawn(this,{x:Y,y:$,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})}setSkyboxIntensity(Z){this._skyboxIntensity=Z,this.emit("WORLD.SET_SKYBOX_INTENSITY",{world:this,intensity:Z})}start(){this._loop.start(),this.emit("WORLD.START",{world:this,startedAtMs:Date.now()})}stop(){this._loop.stop(),this.emit("WORLD.STOP",{world:this,stoppedAtMs:Date.now()})}serialize(){return p0.serializeWorld(this)}}var PJ1;((J)=>J.WORLD_CREATED="WORLD_MANAGER.WORLD_CREATED")(PJ1||={});class tW{static instance=new tW;_defaultWorld;_nextWorldId=1;_worlds=new Map;createWorld(Z){let J=new Lq({...Z,id:this._nextWorldId++});return J.start(),this._worlds.set(J.id,J),q6.emit("WORLD_MANAGER.WORLD_CREATED",{world:J}),J}getAllWorlds(){return Array.from(this._worlds.values())}getDefaultWorld(){return this._defaultWorld??=this.createWorld({name:"Default World",skyboxUri:"skyboxes/partly-cloudy"}),this._defaultWorld}getWorldsByTag(Z){let J=[];return this._worlds.forEach((X)=>{if(X.tag===Z)J.push(X)}),J}getWorld(Z){return this._worlds.get(Z)}setDefaultWorld(Z){this._defaultWorld=Z}}Buffer.poolSize=67108864;var DJ1;((X)=>{X.START="GAMESERVER.START";X.STOP="GAMESERVER.STOP"})(DJ1||={});function C16(Z){$1.init().then(()=>{return sZ.instance.modelRegistry.preloadModels()}).then(()=>{if(Z.length>0)Z(sZ.instance.worldManager.getDefaultWorld());else Z();sZ.instance.start()}).catch((J)=>{m.fatalError(`Failed to initialize the game engine, exiting. Error: ${J}`)})}class sZ{static _instance;_modelRegistry=P9.instance;_playerManager=e5.instance;_socket=bJ.instance;_worldManager=tW.instance;_webServer=yK.instance;constructor(){}static get instance(){if(!this._instance)this._instance=new sZ;return this._instance}get modelRegistry(){return this._modelRegistry}get playerManager(){return this._playerManager}get socket(){return this._socket}get webServer(){return this._webServer}get worldManager(){return this._worldManager}start(){q6.emit("GAMESERVER.START",{startedAtMs:performance.now()}),this._webServer.start()}}class s${static instance=new s$;constructor(){}async getGlobalData(Z){let J=await M7.instance.getData(Z);if(!J||J.error){if(J?.error)m.warning(`PersistenceManager.getGlobalData(): ${J.error.message}`);return}return J}async getPlayerData(Z){let J=await M7.instance.getData(this._getPlayerKey(Z));if(!J||J.error){if(J?.error)m.warning(`PersistenceManager.getPlayerData(): ${J.error.message}`);return}return J}async setGlobalData(Z,J){let X=await M7.instance.setData(Z,J);if(!X||X.error){if(X?.error)m.warning(`PersistenceManager.setGlobalData(): ${X.error.message}`);return}return X}async setPlayerData(Z,J){let X=await M7.instance.setData(this._getPlayerKey(Z),J);if(!X||X.error){if(X?.error)m.warning(`PersistenceManager.setPlayerData(): ${X.error.message}`);return}return X}_getPlayerKey(Z){return`player-${Z.id}`}}var CJ1=["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"],Qq;((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"})(Qq||={});class oW extends g0{static _devNextPlayerId=1;id;username;profilePictureUrl;camera;connection;ui;_input={};_lastUnreliableInputSequenceNumber=0;_world;constructor(Z,J){super();this.id=J?.user.id??`player-${oW._devNextPlayerId++}`,this.username=J?.user.username??this.id,this.profilePictureUrl=J?.user.profilePictureURL??void 0,this.camera=new Gq(this),this.connection=Z,this.ui=new zq(this),Z.onPacket(X0.PacketId.CHAT_MESSAGE_SEND,this._onChatMessageSendPacket),Z.onPacket(X0.PacketId.DEBUG_CONFIG,this._onDebugConfigPacket),Z.onPacket(X0.PacketId.INPUT,this._onInputPacket),Z.onPacket(X0.PacketId.SYNC_REQUEST,this._onSyncRequestPacket),Z.onPacket(X0.PacketId.UI_DATA_SEND,this._onUIDataSendPacket),this.joinWorld(sZ.instance.worldManager.getDefaultWorld())}get input(){return this._input}get world(){return this._world}disconnect(){this._leaveWorld(),this.connection.disconnect()}async getPersistedData(){return s$.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 s$.instance.setPlayerData(this,Z)}serialize(){return p0.serializePlayer(this)}_leaveWorld(){if(!this._world)return;this.emitWithWorld(this._world,"PLAYER.LEFT_WORLD",{player:this,world:this._world}),this._world=void 0}_onChatMessageSendPacket=(Z)=>{if(this._world)this.emitWithWorld(this._world,"PLAYER.CHAT_MESSAGE_SEND",{player:this,message:Z[1].m})};_onDebugConfigPacket=(Z)=>{console.log(Z)};_onInputPacket=(Z)=>{let J=Z[1];if(J.sq!==void 0){if(J.sq<this._lastUnreliableInputSequenceNumber)return;this._lastUnreliableInputSequenceNumber=J.sq}if(CJ1.forEach((X)=>{let Y=X;if(J[Y]!==void 0)this._input[Y]=Boolean(J[Y])}),J.cp!==void 0)this.camera.setOrientationPitch(J.cp);if(J.cy!==void 0)this.camera.setOrientationYaw(J.cy)};_onSyncRequestPacket=()=>{if(this._world)this.emitWithWorld(this._world,"PLAYER.REQUEST_SYNC",{player:this,receivedAt:Date.now(),receivedAtMs:performance.now()})};_onUIDataSendPacket=(Z)=>{this.ui.emit("PLAYER_UI.DATA",{playerUI:this.ui,data:Z[1]})}}var Kf;((X)=>{X.BROADCAST_MESSAGE="CHAT.BROADCAST_MESSAGE";X.PLAYER_MESSAGE="CHAT.PLAYER_MESSAGE"})(Kf||={});class wq extends g0{_commandCallbacks={};_world;constructor(Z){super();this._world=Z,this._subscribeToPlayerEvents()}registerCommand(Z,J){this._commandCallbacks[Z]=J}unregisterCommand(Z){delete this._commandCallbacks[Z]}sendBroadcastMessage(Z,J){this._sendBroadcastMessage(void 0,Z,J)}sendPlayerMessage(Z,J,X){this.emitWithWorld(this._world,"CHAT.PLAYER_MESSAGE",{player:Z,message:J,color:X})}_subscribeToPlayerEvents(){this._world.on("PLAYER.CHAT_MESSAGE_SEND",(Z)=>{let{player:J,message:X}=Z,[Y,...$]=X.split(" "),Q=this._commandCallbacks[Y];if(Q){Q(J,$,X);return}this._sendBroadcastMessage(J,X)})}_sendBroadcastMessage(Z,J,X){this.emitWithWorld(this._world,"CHAT.BROADCAST_MESSAGE",{player:Z,message:J,color:X})}}class b1 extends xX{static BASE_ENTITY_HEIGHT=1.5;static GROUND_SENSOR_HEIGHT_SCALE=0.125;static GROUND_SENSOR_RADIUS_SCALE=0.23;static JUMP_LAND_HEAVY_VELOCITY_THRESHOLD=-12;static WALL_COLLIDER_HEIGHT_SCALE=0.33;static WALL_COLLIDER_RADIUS_SCALE=0.4;static MOVEMENT_ROTATIONS={wa:Math.PI/4,wd:-Math.PI/4,sa:Math.PI-Math.PI/4,sd:Math.PI+Math.PI/4,s:Math.PI,asd:Math.PI,a:Math.PI/2,d:-Math.PI/2};static EXTERNAL_IMPULSE_DECAY_RATE=0.253;static SWIM_UPWARD_COOLDOWN_MS=600;static SWIMMING_DRAG_FACTOR=0.05;static WATER_ENTRY_SINKING_FACTOR=0.8;static WATER_ENTRY_SINKING_MS=250;applyDirectionalMovementRotations=!0;autoCancelMouseLeftClick=!0;canJump=()=>!0;canRun=()=>!0;canSwim=()=>!0;canWalk=()=>!0;idleLoopedAnimations=["idle-upper","idle-lower"];interactOneshotAnimations=["simple-interact"];jumpLandHeavyOneshotAnimations=["jump-post-heavy"];jumpLandLightOneshotAnimations=["jump-post-light"];jumpOneshotAnimations=["jump-loop"];jumpVelocity=10;runLoopedAnimations=["run-upper","run-lower"];runVelocity=8;sticksToPlatforms=!0;swimFastVelocity=5;swimGravity=0;swimIdleLoopedAnimations=["swim-idle"];swimLoopedAnimations=["swim-forward"];swimMaxGravityVelocity=-1;swimSlowVelocity=3;swimUpwardVelocity=2;walkLoopedAnimations=["walk-upper","walk-lower"];walkVelocity=4;_externalVelocity={x:0,y:0,z:0};_magnitudeYTracker=0;_groundContactCount=0;_internalApplyImpulse=()=>{};_isActivelyMoving=!1;_isFullySubmerged=!1;_justSubmergedUntil=0;_liquidContactCount=0;_platform;_reusableImpulse={x:0,y:0,z:0};_reusablePlatformVelocity={x:0,y:0,z:0};_reusableTargetVelocities={x:0,y:0,z:0};_reusableVelocityClamp={x:0,y:0,z:0};_stepAudio;_swimUpwardCooldownAt=0;constructor(Z={}){super();this.applyDirectionalMovementRotations=Z.applyDirectionalMovementRotations??this.applyDirectionalMovementRotations,this.autoCancelMouseLeftClick=Z.autoCancelMouseLeftClick??this.autoCancelMouseLeftClick,this.sticksToPlatforms=Z.sticksToPlatforms??this.sticksToPlatforms,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.jumpVelocity=Z.jumpVelocity??this.jumpVelocity,this.runVelocity=Z.runVelocity??this.runVelocity,this.walkVelocity=Z.walkVelocity??this.walkVelocity,this.swimFastVelocity=Z.swimFastVelocity??this.swimFastVelocity,this.swimSlowVelocity=Z.swimSlowVelocity??this.swimSlowVelocity,this.swimUpwardVelocity=Z.swimUpwardVelocity??this.swimUpwardVelocity,this.swimGravity=Z.swimGravity??this.swimGravity,this.swimMaxGravityVelocity=Z.swimMaxGravityVelocity??this.swimMaxGravityVelocity,this.idleLoopedAnimations=Z.idleLoopedAnimations??this.idleLoopedAnimations,this.interactOneshotAnimations=Z.interactOneshotAnimations??this.interactOneshotAnimations,this.jumpOneshotAnimations=Z.jumpOneshotAnimations??this.jumpOneshotAnimations,this.jumpLandHeavyOneshotAnimations=Z.jumpLandHeavyOneshotAnimations??this.jumpLandHeavyOneshotAnimations,this.jumpLandLightOneshotAnimations=Z.jumpLandLightOneshotAnimations??this.jumpLandLightOneshotAnimations,this.runLoopedAnimations=Z.runLoopedAnimations??this.runLoopedAnimations,this.swimLoopedAnimations=Z.swimLoopedAnimations??this.swimLoopedAnimations,this.swimIdleLoopedAnimations=Z.swimIdleLoopedAnimations??this.swimIdleLoopedAnimations,this.walkLoopedAnimations=Z.walkLoopedAnimations??this.walkLoopedAnimations}get isActivelyMoving(){return this._isActivelyMoving}get isGrounded(){return this._groundContactCount>0}get isOnPlatform(){return!!this._platform}get isSwimming(){return this._liquidContactCount>0}get platform(){return this._platform}attach(Z){super.attach(Z),this._internalApplyImpulse=Z.applyImpulse.bind(Z),Z.applyImpulse=(J)=>{let X=Z.mass||1;this._externalVelocity.x+=J.x/X,this._externalVelocity.y+=J.y/X,this._externalVelocity.z+=J.z/X},this._stepAudio=new YG({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:X})=>{if(!J.isLiquid||!this.canSwim(this))return;if(this._liquidContactCount<=0&&X){let Y=Z.linearVelocity;Z.setLinearVelocity({x:Y.x*this.swimGravity,y:Y.y*this.swimGravity,z:Y.z*this.swimGravity})}if(this._liquidContactCount+=X?1:-1,this._liquidContactCount>0)Z.setGravityScale(this.swimGravity),Z.stopAllModelLoopedAnimations(this.swimLoopedAnimations),this._swimUpwardCooldownAt=performance.now()+b1.SWIM_UPWARD_COOLDOWN_MS;else Z.setGravityScale(1),Z.stopModelAnimations(this.swimLoopedAnimations)})}spawn(Z){if(!Z.isSpawned)return m.error("DefaultPlayerEntityController.spawn(): Entity is not spawned!");Z.createAndAddChildCollider({shape:"cylinder",radius:b1.GROUND_SENSOR_RADIUS_SCALE*(Z.height/b1.BASE_ENTITY_HEIGHT),halfHeight:b1.GROUND_SENSOR_HEIGHT_SCALE*(Z.height/b1.BASE_ENTITY_HEIGHT),collisionGroups:{belongsTo:[4],collidesWith:[1,2]},isSensor:!0,relativePosition:{x:0,y:-Z.height/2,z:0},tag:"groundSensor",onCollision:(J,X)=>{if(!Z.isSpawned)return;if(!(J instanceof s5)||!J.isLiquid){if(X&&this._groundContactCount===0&&Z.linearVelocity.y<-1)if(Z.linearVelocity.y<b1.JUMP_LAND_HEAVY_VELOCITY_THRESHOLD)Z.startModelOneshotAnimations(this.jumpLandHeavyOneshotAnimations);else Z.startModelOneshotAnimations(this.jumpLandLightOneshotAnimations);this._groundContactCount+=X?1:-1}if(!this._groundContactCount&&!this.isSwimming)Z.startModelOneshotAnimations(this.jumpOneshotAnimations);else Z.stopModelAnimations(this.jumpOneshotAnimations);if(!(J instanceof a8))return;if(X&&this.sticksToPlatforms)this._platform=J;else if(J===this._platform&&!X)this._platform=void 0}}),Z.createAndAddChildCollider({shape:"capsule",halfHeight:b1.WALL_COLLIDER_HEIGHT_SCALE*(Z.height/b1.BASE_ENTITY_HEIGHT),radius:b1.WALL_COLLIDER_RADIUS_SCALE*(Z.height/b1.BASE_ENTITY_HEIGHT),collisionGroups:{belongsTo:[4],collidesWith:[1,2]},friction:0,frictionCombineRule:1,tag:"wallCollider"})}tickWithPlayerInput(Z,J,X,Y){if(!Z.isSpawned||!Z.world)return;if(super.tickWithPlayerInput(Z,J,X,Y),Z.parent)return;let{w:$,a:Q,s:K,d:W,c:G,sp:z,sh:V,ml:H}=J,{yaw:q}=X,F=Z.linearVelocity;this._reusableTargetVelocities.x=0,this._reusableTargetVelocities.y=0,this._reusableTargetVelocities.z=0,this._isActivelyMoving=!!($||Q||K||W);let U=V,w=Q&&W&&!$&&!K||$&&K&&!Q&&!W;if(this.isSwimming&&!this._isFullySubmerged)this._isFullySubmerged=!0,this._justSubmergedUntil=performance.now()+b1.WATER_ENTRY_SINKING_MS;else if(!this.isSwimming)this._isFullySubmerged=!1,this._justSubmergedUntil=0;if(this.isGrounded&&!this.isSwimming&&this._isActivelyMoving&&!w){let D=U?this.runLoopedAnimations:this.walkLoopedAnimations;Z.stopAllModelLoopedAnimations(D),Z.startModelLoopedAnimations(D),this._stepAudio?.setPlaybackRate(U?0.75:0.51),this._stepAudio?.play(Z.world,!this._stepAudio?.isPlaying)}else if(this._isFullySubmerged){this._stepAudio?.pause();let D=this._isActivelyMoving?this.swimLoopedAnimations:this.swimIdleLoopedAnimations;Z.stopAllModelLoopedAnimations(D),Z.startModelLoopedAnimations(D)}else this._stepAudio?.pause(),Z.stopAllModelLoopedAnimations(this.idleLoopedAnimations),Z.startModelLoopedAnimations(this.idleLoopedAnimations);let L;if(this.applyDirectionalMovementRotations){if($&&Q&&!W&&!K)L=b1.MOVEMENT_ROTATIONS.wa;else if($&&W&&!Q&&!K)L=b1.MOVEMENT_ROTATIONS.wd;else if(K&&Q&&!$&&!W)L=b1.MOVEMENT_ROTATIONS.sa;else if(K&&W&&!$&&!Q)L=b1.MOVEMENT_ROTATIONS.sd;else if(K&&!$&&!Q&&!W||Q&&K&&W&&!$)L=b1.MOVEMENT_ROTATIONS.s;else if(Q&&!$&&!K&&!W)L=b1.MOVEMENT_ROTATIONS.a;else if(W&&!$&&!Q&&!K)L=b1.MOVEMENT_ROTATIONS.d}if(H)Z.startModelOneshotAnimations(this.interactOneshotAnimations),J.ml=!this.autoCancelMouseLeftClick;if(U&&this.canRun(this)||!U&&this.canWalk(this)){let D=!this.isSwimming?U?this.runVelocity:this.walkVelocity:U?this.swimFastVelocity:this.swimSlowVelocity,P=Math.sin(q),C=Math.cos(q);if($)this._reusableTargetVelocities.x-=D*P,this._reusableTargetVelocities.z-=D*C;if(K)this._reusableTargetVelocities.x+=D*P,this._reusableTargetVelocities.z+=D*C;if(Q)this._reusableTargetVelocities.x-=D*C,this._reusableTargetVelocities.z+=D*P;if(W)this._reusableTargetVelocities.x+=D*C,this._reusableTargetVelocities.z-=D*P;let T=Math.sqrt(this._reusableTargetVelocities.x*this._reusableTargetVelocities.x+this._reusableTargetVelocities.z*this._reusableTargetVelocities.z);if(T>D){let k=D/T;this._reusableTargetVelocities.x*=k,this._reusableTargetVelocities.z*=k}}if(this.isSwimming){if(F.y<this.swimMaxGravityVelocity)this._reusableVelocityClamp.x=F.x,this._reusableVelocityClamp.y=this.swimMaxGravityVelocity,this._reusableVelocityClamp.z=F.z,Z.setLinearVelocity(this._reusableVelocityClamp);if(F.y>this.swimUpwardVelocity*2)this._reusableVelocityClamp.x=F.x,this._reusableVelocityClamp.y=this.swimUpwardVelocity*2,this._reusableVelocityClamp.z=F.z,Z.setLinearVelocity(this._reusableVelocityClamp);if(G)this._reusableTargetVelocities.y=-this.swimUpwardVelocity;else if(performance.now()<this._justSubmergedUntil)this._reusableTargetVelocities.y=-this.swimUpwardVelocity*b1.WATER_ENTRY_SINKING_FACTOR;else if(!z)this._reusableTargetVelocities.y=-F.y*b1.SWIMMING_DRAG_FACTOR}if(z&&this.canJump(this)){if(this.isGrounded&&!this.isSwimming&&F.y>-0.001&&F.y<=3)this._reusableTargetVelocities.y=this.jumpVelocity;else if(this.isSwimming&&performance.now()>this._swimUpwardCooldownAt)this._reusableTargetVelocities.y=this.swimUpwardVelocity}let j=this._platform?.linearVelocity??this._reusablePlatformVelocity;if(this._externalVelocity.y!==0)this._magnitudeYTracker+=this._externalVelocity.y;if(this._externalVelocity.x!==0||this._externalVelocity.y!==0||this._externalVelocity.z!==0){if(this.isGrounded){let D=Math.sqrt(this._externalVelocity.x*this._externalVelocity.x+this._magnitudeYTracker*this._magnitudeYTracker+this._externalVelocity.z*this._externalVelocity.z);if(D>0.01){let C=Math.max(0,D-b1.EXTERNAL_IMPULSE_DECAY_RATE)/D;this._externalVelocity.x*=C,this._magnitudeYTracker*=C,this._externalVelocity.z*=C}else this._externalVelocity.x=0,this._externalVelocity.y=0,this._magnitudeYTracker=0,this._externalVelocity.z=0}}let R=this._reusableTargetVelocities.x+this._externalVelocity.x-F.x+j.x,O=this._reusableTargetVelocities.y+this._externalVelocity.y+j.y,N=this._reusableTargetVelocities.z+this._externalVelocity.z-F.z+j.z;if(this._externalVelocity.y=0,R!==0||O!==0||N!==0){let D=Z.mass;this._reusableImpulse.x=R*D,this._reusableImpulse.y=O*D,this._reusableImpulse.z=N*D,this._internalApplyImpulse(this._reusableImpulse)}if(q!==void 0){let P=(L!==void 0?q+L:q)/2;Z.setRotation({x:0,y:Math.fround(Math.sin(P)),z:0,w:Math.fround(Math.cos(P))})}}}class Wf extends c7{constructor(Z){super({modelUri:"models/players/player.gltf",modelLoopedAnimations:["idle_lower","idle_upper"],...Z});if(!Z.controller)this.setController(new b1)}}var P0=0.000001,Y1=typeof Float32Array!=="undefined"?Float32Array:Array,l7=Math.random;var Ds6=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 g8={};d4(g8,{transpose:()=>_16,subtract:()=>kJ1,sub:()=>s16,str:()=>m16,set:()=>S16,scale:()=>b16,rotate:()=>f16,multiplyScalarAndAdd:()=>n16,multiplyScalar:()=>i16,multiply:()=>TJ1,mul:()=>a16,invert:()=>A16,identity:()=>I16,fromValues:()=>v16,fromScaling:()=>g16,fromRotation:()=>y16,frob:()=>u16,exactEquals:()=>l16,equals:()=>p16,determinant:()=>h16,create:()=>T16,copy:()=>E16,clone:()=>k16,adjoint:()=>x16,add:()=>c16,LDU:()=>d16});function T16(){var Z=new Y1(4);if(Y1!=Float32Array)Z[1]=0,Z[2]=0;return Z[0]=1,Z[3]=1,Z}function k16(Z){var J=new Y1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function E16(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function I16(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=1,Z}function v16(Z,J,X,Y){var $=new Y1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function S16(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function _16(Z,J){if(Z===J){var X=J[1];Z[1]=J[2],Z[2]=X}else Z[0]=J[0],Z[1]=J[2],Z[2]=J[1],Z[3]=J[3];return Z}function A16(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=X*Q-$*Y;if(!K)return null;return K=1/K,Z[0]=Q*K,Z[1]=-Y*K,Z[2]=-$*K,Z[3]=X*K,Z}function x16(Z,J){var X=J[0];return Z[0]=J[3],Z[1]=-J[1],Z[2]=-J[2],Z[3]=X,Z}function h16(Z){return Z[0]*Z[3]-Z[2]*Z[1]}function TJ1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=X[0],G=X[1],z=X[2],V=X[3];return Z[0]=Y*W+Q*G,Z[1]=$*W+K*G,Z[2]=Y*z+Q*V,Z[3]=$*z+K*V,Z}function f16(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+Q*W,Z[1]=$*G+K*W,Z[2]=Y*-W+Q*G,Z[3]=$*-W+K*G,Z}function b16(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=X[0],G=X[1];return Z[0]=Y*W,Z[1]=$*W,Z[2]=Q*G,Z[3]=K*G,Z}function y16(Z,J){var X=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=X,Z[2]=-X,Z[3]=Y,Z}function g16(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=J[1],Z}function m16(Z){return"mat2("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}function u16(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3])}function d16(Z,J,X,Y){return Z[2]=Y[2]/Y[0],X[0]=Y[0],X[1]=Y[1],X[3]=Y[3]-Z[2]*X[1],[Z,J,X]}function c16(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z}function kJ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z[3]=J[3]-X[3],Z}function l16(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function p16(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],K=J[0],W=J[1],G=J[2],z=J[3];return Math.abs(X-K)<=P0*Math.max(1,Math.abs(X),Math.abs(K))&&Math.abs(Y-W)<=P0*Math.max(1,Math.abs(Y),Math.abs(W))&&Math.abs($-G)<=P0*Math.max(1,Math.abs($),Math.abs(G))&&Math.abs(Q-z)<=P0*Math.max(1,Math.abs(Q),Math.abs(z))}function i16(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z}function n16(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z[3]=J[3]+X[3]*Y,Z}var a16=TJ1,s16=kJ1;var i1={};d4(i1,{transpose:()=>X86,translate:()=>K86,subtract:()=>IJ1,sub:()=>D86,str:()=>w86,set:()=>Z86,scale:()=>G86,rotate:()=>W86,projection:()=>L86,normalFromMat4:()=>U86,multiplyScalarAndAdd:()=>M86,multiplyScalar:()=>O86,multiply:()=>EJ1,mul:()=>P86,invert:()=>Y86,identity:()=>J86,fromValues:()=>e16,fromTranslation:()=>z86,fromScaling:()=>H86,fromRotation:()=>V86,fromQuat:()=>F86,fromMat4:()=>o16,fromMat2d:()=>q86,frob:()=>B86,exactEquals:()=>R86,equals:()=>N86,determinant:()=>Q86,create:()=>Gf,copy:()=>t16,clone:()=>r16,adjoint:()=>$86,add:()=>j86});function Gf(){var Z=new Y1(9);if(Y1!=Float32Array)Z[1]=0,Z[2]=0,Z[3]=0,Z[5]=0,Z[6]=0,Z[7]=0;return Z[0]=1,Z[4]=1,Z[8]=1,Z}function o16(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 r16(Z){var J=new Y1(9);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J[4]=Z[4],J[5]=Z[5],J[6]=Z[6],J[7]=Z[7],J[8]=Z[8],J}function t16(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 e16(Z,J,X,Y,$,Q,K,W,G){var z=new Y1(9);return z[0]=Z,z[1]=J,z[2]=X,z[3]=Y,z[4]=$,z[5]=Q,z[6]=K,z[7]=W,z[8]=G,z}function Z86(Z,J,X,Y,$,Q,K,W,G,z){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z[4]=Q,Z[5]=K,Z[6]=W,Z[7]=G,Z[8]=z,Z}function J86(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 X86(Z,J){if(Z===J){var X=J[1],Y=J[2],$=J[5];Z[1]=J[3],Z[2]=J[6],Z[3]=X,Z[5]=J[7],Z[6]=Y,Z[7]=$}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 Y86(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=J[4],W=J[5],G=J[6],z=J[7],V=J[8],H=V*K-W*z,q=-V*Q+W*G,F=z*Q-K*G,U=X*H+Y*q+$*F;if(!U)return null;return U=1/U,Z[0]=H*U,Z[1]=(-V*Y+$*z)*U,Z[2]=(W*Y-$*K)*U,Z[3]=q*U,Z[4]=(V*X-$*G)*U,Z[5]=(-W*X+$*Q)*U,Z[6]=F*U,Z[7]=(-z*X+Y*G)*U,Z[8]=(K*X-Y*Q)*U,Z}function $86(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=J[4],W=J[5],G=J[6],z=J[7],V=J[8];return Z[0]=K*V-W*z,Z[1]=$*z-Y*V,Z[2]=Y*W-$*K,Z[3]=W*G-Q*V,Z[4]=X*V-$*G,Z[5]=$*Q-X*W,Z[6]=Q*z-K*G,Z[7]=Y*G-X*z,Z[8]=X*K-Y*Q,Z}function Q86(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],K=Z[5],W=Z[6],G=Z[7],z=Z[8];return J*(z*Q-K*G)+X*(-z*$+K*W)+Y*(G*$-Q*W)}function EJ1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=J[8],q=X[0],F=X[1],U=X[2],w=X[3],L=X[4],j=X[5],R=X[6],O=X[7],N=X[8];return Z[0]=q*Y+F*K+U*z,Z[1]=q*$+F*W+U*V,Z[2]=q*Q+F*G+U*H,Z[3]=w*Y+L*K+j*z,Z[4]=w*$+L*W+j*V,Z[5]=w*Q+L*G+j*H,Z[6]=R*Y+O*K+N*z,Z[7]=R*$+O*W+N*V,Z[8]=R*Q+O*G+N*H,Z}function K86(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=J[8],q=X[0],F=X[1];return Z[0]=Y,Z[1]=$,Z[2]=Q,Z[3]=K,Z[4]=W,Z[5]=G,Z[6]=q*Y+F*K+z,Z[7]=q*$+F*W+V,Z[8]=q*Q+F*G+H,Z}function W86(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=J[8],q=Math.sin(X),F=Math.cos(X);return Z[0]=F*Y+q*K,Z[1]=F*$+q*W,Z[2]=F*Q+q*G,Z[3]=F*K-q*Y,Z[4]=F*W-q*$,Z[5]=F*G-q*Q,Z[6]=z,Z[7]=V,Z[8]=H,Z}function G86(Z,J,X){var Y=X[0],$=X[1];return Z[0]=Y*J[0],Z[1]=Y*J[1],Z[2]=Y*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 z86(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 V86(Z,J){var X=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=X,Z[2]=0,Z[3]=-X,Z[4]=Y,Z[5]=0,Z[6]=0,Z[7]=0,Z[8]=1,Z}function H86(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 q86(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 F86(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=X+X,W=Y+Y,G=$+$,z=X*K,V=Y*K,H=Y*W,q=$*K,F=$*W,U=$*G,w=Q*K,L=Q*W,j=Q*G;return Z[0]=1-H-U,Z[3]=V-j,Z[6]=q+L,Z[1]=V+j,Z[4]=1-z-U,Z[7]=F-w,Z[2]=q-L,Z[5]=F+w,Z[8]=1-z-H,Z}function U86(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=J[4],W=J[5],G=J[6],z=J[7],V=J[8],H=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],j=J[15],R=X*W-Y*K,O=X*G-$*K,N=X*z-Q*K,D=Y*G-$*W,P=Y*z-Q*W,C=$*z-Q*G,T=V*w-H*U,k=V*L-q*U,A=V*j-F*U,S=H*L-q*w,x=H*j-F*w,I=q*j-F*L,v=R*I-O*x+N*S+D*A-P*k+C*T;if(!v)return null;return v=1/v,Z[0]=(W*I-G*x+z*S)*v,Z[1]=(G*A-K*I-z*k)*v,Z[2]=(K*x-W*A+z*T)*v,Z[3]=($*x-Y*I-Q*S)*v,Z[4]=(X*I-$*A+Q*k)*v,Z[5]=(Y*A-X*x-Q*T)*v,Z[6]=(w*C-L*P+j*D)*v,Z[7]=(L*N-U*C-j*O)*v,Z[8]=(U*P-w*N+j*R)*v,Z}function L86(Z,J,X){return Z[0]=2/J,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=-2/X,Z[5]=0,Z[6]=-1,Z[7]=1,Z[8]=1,Z}function w86(Z){return"mat3("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+")"}function B86(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8])}function j86(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z[4]=J[4]+X[4],Z[5]=J[5]+X[5],Z[6]=J[6]+X[6],Z[7]=J[7]+X[7],Z[8]=J[8]+X[8],Z}function IJ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z[3]=J[3]-X[3],Z[4]=J[4]-X[4],Z[5]=J[5]-X[5],Z[6]=J[6]-X[6],Z[7]=J[7]-X[7],Z[8]=J[8]-X[8],Z}function O86(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z[4]=J[4]*X,Z[5]=J[5]*X,Z[6]=J[6]*X,Z[7]=J[7]*X,Z[8]=J[8]*X,Z}function M86(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z[3]=J[3]+X[3]*Y,Z[4]=J[4]+X[4]*Y,Z[5]=J[5]+X[5]*Y,Z[6]=J[6]+X[6]*Y,Z[7]=J[7]+X[7]*Y,Z[8]=J[8]+X[8]*Y,Z}function R86(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 N86(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],K=Z[4],W=Z[5],G=Z[6],z=Z[7],V=Z[8],H=J[0],q=J[1],F=J[2],U=J[3],w=J[4],L=J[5],j=J[6],R=J[7],O=J[8];return Math.abs(X-H)<=P0*Math.max(1,Math.abs(X),Math.abs(H))&&Math.abs(Y-q)<=P0*Math.max(1,Math.abs(Y),Math.abs(q))&&Math.abs($-F)<=P0*Math.max(1,Math.abs($),Math.abs(F))&&Math.abs(Q-U)<=P0*Math.max(1,Math.abs(Q),Math.abs(U))&&Math.abs(K-w)<=P0*Math.max(1,Math.abs(K),Math.abs(w))&&Math.abs(W-L)<=P0*Math.max(1,Math.abs(W),Math.abs(L))&&Math.abs(G-j)<=P0*Math.max(1,Math.abs(G),Math.abs(j))&&Math.abs(z-R)<=P0*Math.max(1,Math.abs(z),Math.abs(R))&&Math.abs(V-O)<=P0*Math.max(1,Math.abs(V),Math.abs(O))}var P86=EJ1,D86=IJ1;var o0={};d4(o0,{transpose:()=>v86,translate:()=>x86,targetTo:()=>Q66,subtract:()=>fJ1,sub:()=>U66,str:()=>K66,set:()=>I86,scale:()=>h86,rotateZ:()=>g86,rotateY:()=>y86,rotateX:()=>b86,rotate:()=>f86,perspectiveZO:()=>Z66,perspectiveNO:()=>xJ1,perspectiveFromFieldOfView:()=>J66,perspective:()=>e86,orthoZO:()=>Y66,orthoNO:()=>hJ1,ortho:()=>X66,multiplyScalarAndAdd:()=>V66,multiplyScalar:()=>z66,multiply:()=>SJ1,mul:()=>F66,lookAt:()=>$66,invert:()=>S86,identity:()=>vJ1,getTranslation:()=>n86,getScaling:()=>AJ1,getRotation:()=>a86,frustum:()=>t86,fromZRotation:()=>p86,fromYRotation:()=>l86,fromXRotation:()=>c86,fromValues:()=>E86,fromTranslation:()=>m86,fromScaling:()=>u86,fromRotationTranslationScaleOrigin:()=>o86,fromRotationTranslationScale:()=>s86,fromRotationTranslation:()=>_J1,fromRotation:()=>d86,fromQuat2:()=>i86,fromQuat:()=>r86,frob:()=>W66,exactEquals:()=>H66,equals:()=>q66,determinant:()=>A86,create:()=>C86,copy:()=>k86,clone:()=>T86,adjoint:()=>_86,add:()=>G66});function C86(){var Z=new Y1(16);if(Y1!=Float32Array)Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0;return Z[0]=1,Z[5]=1,Z[10]=1,Z[15]=1,Z}function T86(Z){var J=new Y1(16);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J[4]=Z[4],J[5]=Z[5],J[6]=Z[6],J[7]=Z[7],J[8]=Z[8],J[9]=Z[9],J[10]=Z[10],J[11]=Z[11],J[12]=Z[12],J[13]=Z[13],J[14]=Z[14],J[15]=Z[15],J}function k86(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 E86(Z,J,X,Y,$,Q,K,W,G,z,V,H,q,F,U,w){var L=new Y1(16);return L[0]=Z,L[1]=J,L[2]=X,L[3]=Y,L[4]=$,L[5]=Q,L[6]=K,L[7]=W,L[8]=G,L[9]=z,L[10]=V,L[11]=H,L[12]=q,L[13]=F,L[14]=U,L[15]=w,L}function I86(Z,J,X,Y,$,Q,K,W,G,z,V,H,q,F,U,w,L){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z[4]=Q,Z[5]=K,Z[6]=W,Z[7]=G,Z[8]=z,Z[9]=V,Z[10]=H,Z[11]=q,Z[12]=F,Z[13]=U,Z[14]=w,Z[15]=L,Z}function vJ1(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 v86(Z,J){if(Z===J){var X=J[1],Y=J[2],$=J[3],Q=J[6],K=J[7],W=J[11];Z[1]=J[4],Z[2]=J[8],Z[3]=J[12],Z[4]=X,Z[6]=J[9],Z[7]=J[13],Z[8]=Y,Z[9]=Q,Z[11]=J[14],Z[12]=$,Z[13]=K,Z[14]=W}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 S86(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=J[4],W=J[5],G=J[6],z=J[7],V=J[8],H=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],j=J[15],R=X*W-Y*K,O=X*G-$*K,N=X*z-Q*K,D=Y*G-$*W,P=Y*z-Q*W,C=$*z-Q*G,T=V*w-H*U,k=V*L-q*U,A=V*j-F*U,S=H*L-q*w,x=H*j-F*w,I=q*j-F*L,v=R*I-O*x+N*S+D*A-P*k+C*T;if(!v)return null;return v=1/v,Z[0]=(W*I-G*x+z*S)*v,Z[1]=($*x-Y*I-Q*S)*v,Z[2]=(w*C-L*P+j*D)*v,Z[3]=(q*P-H*C-F*D)*v,Z[4]=(G*A-K*I-z*k)*v,Z[5]=(X*I-$*A+Q*k)*v,Z[6]=(L*N-U*C-j*O)*v,Z[7]=(V*C-q*N+F*O)*v,Z[8]=(K*x-W*A+z*T)*v,Z[9]=(Y*A-X*x-Q*T)*v,Z[10]=(U*P-w*N+j*R)*v,Z[11]=(H*N-V*P-F*R)*v,Z[12]=(W*k-K*S-G*T)*v,Z[13]=(X*S-Y*k+$*T)*v,Z[14]=(w*O-U*D-L*R)*v,Z[15]=(V*D-H*O+q*R)*v,Z}function _86(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=J[4],W=J[5],G=J[6],z=J[7],V=J[8],H=J[9],q=J[10],F=J[11],U=J[12],w=J[13],L=J[14],j=J[15];return Z[0]=W*(q*j-F*L)-H*(G*j-z*L)+w*(G*F-z*q),Z[1]=-(Y*(q*j-F*L)-H*($*j-Q*L)+w*($*F-Q*q)),Z[2]=Y*(G*j-z*L)-W*($*j-Q*L)+w*($*z-Q*G),Z[3]=-(Y*(G*F-z*q)-W*($*F-Q*q)+H*($*z-Q*G)),Z[4]=-(K*(q*j-F*L)-V*(G*j-z*L)+U*(G*F-z*q)),Z[5]=X*(q*j-F*L)-V*($*j-Q*L)+U*($*F-Q*q),Z[6]=-(X*(G*j-z*L)-K*($*j-Q*L)+U*($*z-Q*G)),Z[7]=X*(G*F-z*q)-K*($*F-Q*q)+V*($*z-Q*G),Z[8]=K*(H*j-F*w)-V*(W*j-z*w)+U*(W*F-z*H),Z[9]=-(X*(H*j-F*w)-V*(Y*j-Q*w)+U*(Y*F-Q*H)),Z[10]=X*(W*j-z*w)-K*(Y*j-Q*w)+U*(Y*z-Q*W),Z[11]=-(X*(W*F-z*H)-K*(Y*F-Q*H)+V*(Y*z-Q*W)),Z[12]=-(K*(H*L-q*w)-V*(W*L-G*w)+U*(W*q-G*H)),Z[13]=X*(H*L-q*w)-V*(Y*L-$*w)+U*(Y*q-$*H),Z[14]=-(X*(W*L-G*w)-K*(Y*L-$*w)+U*(Y*G-$*W)),Z[15]=X*(W*q-G*H)-K*(Y*q-$*H)+V*(Y*G-$*W),Z}function A86(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],K=Z[5],W=Z[6],G=Z[7],z=Z[8],V=Z[9],H=Z[10],q=Z[11],F=Z[12],U=Z[13],w=Z[14],L=Z[15],j=J*K-X*Q,R=J*W-Y*Q,O=J*G-$*Q,N=X*W-Y*K,D=X*G-$*K,P=Y*G-$*W,C=z*U-V*F,T=z*w-H*F,k=z*L-q*F,A=V*w-H*U,S=V*L-q*U,x=H*L-q*w;return j*x-R*S+O*A+N*k-D*T+P*C}function SJ1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=J[8],q=J[9],F=J[10],U=J[11],w=J[12],L=J[13],j=J[14],R=J[15],O=X[0],N=X[1],D=X[2],P=X[3];return Z[0]=O*Y+N*W+D*H+P*w,Z[1]=O*$+N*G+D*q+P*L,Z[2]=O*Q+N*z+D*F+P*j,Z[3]=O*K+N*V+D*U+P*R,O=X[4],N=X[5],D=X[6],P=X[7],Z[4]=O*Y+N*W+D*H+P*w,Z[5]=O*$+N*G+D*q+P*L,Z[6]=O*Q+N*z+D*F+P*j,Z[7]=O*K+N*V+D*U+P*R,O=X[8],N=X[9],D=X[10],P=X[11],Z[8]=O*Y+N*W+D*H+P*w,Z[9]=O*$+N*G+D*q+P*L,Z[10]=O*Q+N*z+D*F+P*j,Z[11]=O*K+N*V+D*U+P*R,O=X[12],N=X[13],D=X[14],P=X[15],Z[12]=O*Y+N*W+D*H+P*w,Z[13]=O*$+N*G+D*q+P*L,Z[14]=O*Q+N*z+D*F+P*j,Z[15]=O*K+N*V+D*U+P*R,Z}function x86(Z,J,X){var Y=X[0],$=X[1],Q=X[2],K,W,G,z,V,H,q,F,U,w,L,j;if(J===Z)Z[12]=J[0]*Y+J[4]*$+J[8]*Q+J[12],Z[13]=J[1]*Y+J[5]*$+J[9]*Q+J[13],Z[14]=J[2]*Y+J[6]*$+J[10]*Q+J[14],Z[15]=J[3]*Y+J[7]*$+J[11]*Q+J[15];else K=J[0],W=J[1],G=J[2],z=J[3],V=J[4],H=J[5],q=J[6],F=J[7],U=J[8],w=J[9],L=J[10],j=J[11],Z[0]=K,Z[1]=W,Z[2]=G,Z[3]=z,Z[4]=V,Z[5]=H,Z[6]=q,Z[7]=F,Z[8]=U,Z[9]=w,Z[10]=L,Z[11]=j,Z[12]=K*Y+V*$+U*Q+J[12],Z[13]=W*Y+H*$+w*Q+J[13],Z[14]=G*Y+q*$+L*Q+J[14],Z[15]=z*Y+F*$+j*Q+J[15];return Z}function h86(Z,J,X){var Y=X[0],$=X[1],Q=X[2];return Z[0]=J[0]*Y,Z[1]=J[1]*Y,Z[2]=J[2]*Y,Z[3]=J[3]*Y,Z[4]=J[4]*$,Z[5]=J[5]*$,Z[6]=J[6]*$,Z[7]=J[7]*$,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 f86(Z,J,X,Y){var $=Y[0],Q=Y[1],K=Y[2],W=Math.hypot($,Q,K),G,z,V,H,q,F,U,w,L,j,R,O,N,D,P,C,T,k,A,S,x,I,v,f;if(W<P0)return null;if(W=1/W,$*=W,Q*=W,K*=W,G=Math.sin(X),z=Math.cos(X),V=1-z,H=J[0],q=J[1],F=J[2],U=J[3],w=J[4],L=J[5],j=J[6],R=J[7],O=J[8],N=J[9],D=J[10],P=J[11],C=$*$*V+z,T=Q*$*V+K*G,k=K*$*V-Q*G,A=$*Q*V-K*G,S=Q*Q*V+z,x=K*Q*V+$*G,I=$*K*V+Q*G,v=Q*K*V-$*G,f=K*K*V+z,Z[0]=H*C+w*T+O*k,Z[1]=q*C+L*T+N*k,Z[2]=F*C+j*T+D*k,Z[3]=U*C+R*T+P*k,Z[4]=H*A+w*S+O*x,Z[5]=q*A+L*S+N*x,Z[6]=F*A+j*S+D*x,Z[7]=U*A+R*S+P*x,Z[8]=H*I+w*v+O*f,Z[9]=q*I+L*v+N*f,Z[10]=F*I+j*v+D*f,Z[11]=U*I+R*v+P*f,J!==Z)Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z}function b86(Z,J,X){var Y=Math.sin(X),$=Math.cos(X),Q=J[4],K=J[5],W=J[6],G=J[7],z=J[8],V=J[9],H=J[10],q=J[11];if(J!==Z)Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[4]=Q*$+z*Y,Z[5]=K*$+V*Y,Z[6]=W*$+H*Y,Z[7]=G*$+q*Y,Z[8]=z*$-Q*Y,Z[9]=V*$-K*Y,Z[10]=H*$-W*Y,Z[11]=q*$-G*Y,Z}function y86(Z,J,X){var Y=Math.sin(X),$=Math.cos(X),Q=J[0],K=J[1],W=J[2],G=J[3],z=J[8],V=J[9],H=J[10],q=J[11];if(J!==Z)Z[4]=J[4],Z[5]=J[5],Z[6]=J[6],Z[7]=J[7],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[0]=Q*$-z*Y,Z[1]=K*$-V*Y,Z[2]=W*$-H*Y,Z[3]=G*$-q*Y,Z[8]=Q*Y+z*$,Z[9]=K*Y+V*$,Z[10]=W*Y+H*$,Z[11]=G*Y+q*$,Z}function g86(Z,J,X){var Y=Math.sin(X),$=Math.cos(X),Q=J[0],K=J[1],W=J[2],G=J[3],z=J[4],V=J[5],H=J[6],q=J[7];if(J!==Z)Z[8]=J[8],Z[9]=J[9],Z[10]=J[10],Z[11]=J[11],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[0]=Q*$+z*Y,Z[1]=K*$+V*Y,Z[2]=W*$+H*Y,Z[3]=G*$+q*Y,Z[4]=z*$-Q*Y,Z[5]=V*$-K*Y,Z[6]=H*$-W*Y,Z[7]=q*$-G*Y,Z}function m86(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 u86(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 d86(Z,J,X){var Y=X[0],$=X[1],Q=X[2],K=Math.hypot(Y,$,Q),W,G,z;if(K<P0)return null;return K=1/K,Y*=K,$*=K,Q*=K,W=Math.sin(J),G=Math.cos(J),z=1-G,Z[0]=Y*Y*z+G,Z[1]=$*Y*z+Q*W,Z[2]=Q*Y*z-$*W,Z[3]=0,Z[4]=Y*$*z-Q*W,Z[5]=$*$*z+G,Z[6]=Q*$*z+Y*W,Z[7]=0,Z[8]=Y*Q*z+$*W,Z[9]=$*Q*z-Y*W,Z[10]=Q*Q*z+G,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function c86(Z,J){var X=Math.sin(J),Y=Math.cos(J);return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=Y,Z[6]=X,Z[7]=0,Z[8]=0,Z[9]=-X,Z[10]=Y,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function l86(Z,J){var X=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=0,Z[2]=-X,Z[3]=0,Z[4]=0,Z[5]=1,Z[6]=0,Z[7]=0,Z[8]=X,Z[9]=0,Z[10]=Y,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function p86(Z,J){var X=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=X,Z[2]=0,Z[3]=0,Z[4]=-X,Z[5]=Y,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=1,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function _J1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=Y+Y,G=$+$,z=Q+Q,V=Y*W,H=Y*G,q=Y*z,F=$*G,U=$*z,w=Q*z,L=K*W,j=K*G,R=K*z;return Z[0]=1-(F+w),Z[1]=H+R,Z[2]=q-j,Z[3]=0,Z[4]=H-R,Z[5]=1-(V+w),Z[6]=U+L,Z[7]=0,Z[8]=q+j,Z[9]=U-L,Z[10]=1-(V+F),Z[11]=0,Z[12]=X[0],Z[13]=X[1],Z[14]=X[2],Z[15]=1,Z}function i86(Z,J){var X=new Y1(3),Y=-J[0],$=-J[1],Q=-J[2],K=J[3],W=J[4],G=J[5],z=J[6],V=J[7],H=Y*Y+$*$+Q*Q+K*K;if(H>0)X[0]=(W*K+V*Y+G*Q-z*$)*2/H,X[1]=(G*K+V*$+z*Y-W*Q)*2/H,X[2]=(z*K+V*Q+W*$-G*Y)*2/H;else X[0]=(W*K+V*Y+G*Q-z*$)*2,X[1]=(G*K+V*$+z*Y-W*Q)*2,X[2]=(z*K+V*Q+W*$-G*Y)*2;return _J1(Z,J,X),Z}function n86(Z,J){return Z[0]=J[12],Z[1]=J[13],Z[2]=J[14],Z}function AJ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[4],K=J[5],W=J[6],G=J[8],z=J[9],V=J[10];return Z[0]=Math.hypot(X,Y,$),Z[1]=Math.hypot(Q,K,W),Z[2]=Math.hypot(G,z,V),Z}function a86(Z,J){var X=new Y1(3);AJ1(X,J);var Y=1/X[0],$=1/X[1],Q=1/X[2],K=J[0]*Y,W=J[1]*$,G=J[2]*Q,z=J[4]*Y,V=J[5]*$,H=J[6]*Q,q=J[8]*Y,F=J[9]*$,U=J[10]*Q,w=K+V+U,L=0;if(w>0)L=Math.sqrt(w+1)*2,Z[3]=0.25*L,Z[0]=(H-F)/L,Z[1]=(q-G)/L,Z[2]=(W-z)/L;else if(K>V&&K>U)L=Math.sqrt(1+K-V-U)*2,Z[3]=(H-F)/L,Z[0]=0.25*L,Z[1]=(W+z)/L,Z[2]=(q+G)/L;else if(V>U)L=Math.sqrt(1+V-K-U)*2,Z[3]=(q-G)/L,Z[0]=(W+z)/L,Z[1]=0.25*L,Z[2]=(H+F)/L;else L=Math.sqrt(1+U-K-V)*2,Z[3]=(W-z)/L,Z[0]=(q+G)/L,Z[1]=(H+F)/L,Z[2]=0.25*L;return Z}function s86(Z,J,X,Y){var $=J[0],Q=J[1],K=J[2],W=J[3],G=$+$,z=Q+Q,V=K+K,H=$*G,q=$*z,F=$*V,U=Q*z,w=Q*V,L=K*V,j=W*G,R=W*z,O=W*V,N=Y[0],D=Y[1],P=Y[2];return Z[0]=(1-(U+L))*N,Z[1]=(q+O)*N,Z[2]=(F-R)*N,Z[3]=0,Z[4]=(q-O)*D,Z[5]=(1-(H+L))*D,Z[6]=(w+j)*D,Z[7]=0,Z[8]=(F+R)*P,Z[9]=(w-j)*P,Z[10]=(1-(H+U))*P,Z[11]=0,Z[12]=X[0],Z[13]=X[1],Z[14]=X[2],Z[15]=1,Z}function o86(Z,J,X,Y,$){var Q=J[0],K=J[1],W=J[2],G=J[3],z=Q+Q,V=K+K,H=W+W,q=Q*z,F=Q*V,U=Q*H,w=K*V,L=K*H,j=W*H,R=G*z,O=G*V,N=G*H,D=Y[0],P=Y[1],C=Y[2],T=$[0],k=$[1],A=$[2],S=(1-(w+j))*D,x=(F+N)*D,I=(U-O)*D,v=(F-N)*P,f=(1-(q+j))*P,p=(L+R)*P,n=(U+O)*C,o=(L-R)*C,J0=(1-(q+w))*C;return Z[0]=S,Z[1]=x,Z[2]=I,Z[3]=0,Z[4]=v,Z[5]=f,Z[6]=p,Z[7]=0,Z[8]=n,Z[9]=o,Z[10]=J0,Z[11]=0,Z[12]=X[0]+T-(S*T+v*k+n*A),Z[13]=X[1]+k-(x*T+f*k+o*A),Z[14]=X[2]+A-(I*T+p*k+J0*A),Z[15]=1,Z}function r86(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=X+X,W=Y+Y,G=$+$,z=X*K,V=Y*K,H=Y*W,q=$*K,F=$*W,U=$*G,w=Q*K,L=Q*W,j=Q*G;return Z[0]=1-H-U,Z[1]=V+j,Z[2]=q-L,Z[3]=0,Z[4]=V-j,Z[5]=1-z-U,Z[6]=F+w,Z[7]=0,Z[8]=q+L,Z[9]=F-w,Z[10]=1-z-H,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function t86(Z,J,X,Y,$,Q,K){var W=1/(X-J),G=1/($-Y),z=1/(Q-K);return Z[0]=Q*2*W,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]=(X+J)*W,Z[9]=($+Y)*G,Z[10]=(K+Q)*z,Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=K*Q*2*z,Z[15]=0,Z}function xJ1(Z,J,X,Y,$){var Q=1/Math.tan(J/2),K;if(Z[0]=Q/X,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,$!=null&&$!==1/0)K=1/(Y-$),Z[10]=($+Y)*K,Z[14]=2*$*Y*K;else Z[10]=-1,Z[14]=-2*Y;return Z}var e86=xJ1;function Z66(Z,J,X,Y,$){var Q=1/Math.tan(J/2),K;if(Z[0]=Q/X,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,$!=null&&$!==1/0)K=1/(Y-$),Z[10]=$*K,Z[14]=$*Y*K;else Z[10]=-1,Z[14]=-Y;return Z}function J66(Z,J,X,Y){var $=Math.tan(J.upDegrees*Math.PI/180),Q=Math.tan(J.downDegrees*Math.PI/180),K=Math.tan(J.leftDegrees*Math.PI/180),W=Math.tan(J.rightDegrees*Math.PI/180),G=2/(K+W),z=2/($+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]=-((K-W)*G*0.5),Z[9]=($-Q)*z*0.5,Z[10]=Y/(X-Y),Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=Y*X/(X-Y),Z[15]=0,Z}function hJ1(Z,J,X,Y,$,Q,K){var W=1/(J-X),G=1/(Y-$),z=1/(Q-K);return Z[0]=-2*W,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+X)*W,Z[13]=($+Y)*G,Z[14]=(K+Q)*z,Z[15]=1,Z}var X66=hJ1;function Y66(Z,J,X,Y,$,Q,K){var W=1/(J-X),G=1/(Y-$),z=1/(Q-K);return Z[0]=-2*W,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+X)*W,Z[13]=($+Y)*G,Z[14]=Q*z,Z[15]=1,Z}function $66(Z,J,X,Y){var $,Q,K,W,G,z,V,H,q,F,U=J[0],w=J[1],L=J[2],j=Y[0],R=Y[1],O=Y[2],N=X[0],D=X[1],P=X[2];if(Math.abs(U-N)<P0&&Math.abs(w-D)<P0&&Math.abs(L-P)<P0)return vJ1(Z);if(V=U-N,H=w-D,q=L-P,F=1/Math.hypot(V,H,q),V*=F,H*=F,q*=F,$=R*q-O*H,Q=O*V-j*q,K=j*H-R*V,F=Math.hypot($,Q,K),!F)$=0,Q=0,K=0;else F=1/F,$*=F,Q*=F,K*=F;if(W=H*K-q*Q,G=q*$-V*K,z=V*Q-H*$,F=Math.hypot(W,G,z),!F)W=0,G=0,z=0;else F=1/F,W*=F,G*=F,z*=F;return Z[0]=$,Z[1]=W,Z[2]=V,Z[3]=0,Z[4]=Q,Z[5]=G,Z[6]=H,Z[7]=0,Z[8]=K,Z[9]=z,Z[10]=q,Z[11]=0,Z[12]=-($*U+Q*w+K*L),Z[13]=-(W*U+G*w+z*L),Z[14]=-(V*U+H*w+q*L),Z[15]=1,Z}function Q66(Z,J,X,Y){var $=J[0],Q=J[1],K=J[2],W=Y[0],G=Y[1],z=Y[2],V=$-X[0],H=Q-X[1],q=K-X[2],F=V*V+H*H+q*q;if(F>0)F=1/Math.sqrt(F),V*=F,H*=F,q*=F;var U=G*q-z*H,w=z*V-W*q,L=W*H-G*V;if(F=U*U+w*w+L*L,F>0)F=1/Math.sqrt(F),U*=F,w*=F,L*=F;return Z[0]=U,Z[1]=w,Z[2]=L,Z[3]=0,Z[4]=H*L-q*w,Z[5]=q*U-V*L,Z[6]=V*w-H*U,Z[7]=0,Z[8]=V,Z[9]=H,Z[10]=q,Z[11]=0,Z[12]=$,Z[13]=Q,Z[14]=K,Z[15]=1,Z}function K66(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 W66(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 G66(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z[4]=J[4]+X[4],Z[5]=J[5]+X[5],Z[6]=J[6]+X[6],Z[7]=J[7]+X[7],Z[8]=J[8]+X[8],Z[9]=J[9]+X[9],Z[10]=J[10]+X[10],Z[11]=J[11]+X[11],Z[12]=J[12]+X[12],Z[13]=J[13]+X[13],Z[14]=J[14]+X[14],Z[15]=J[15]+X[15],Z}function fJ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z[3]=J[3]-X[3],Z[4]=J[4]-X[4],Z[5]=J[5]-X[5],Z[6]=J[6]-X[6],Z[7]=J[7]-X[7],Z[8]=J[8]-X[8],Z[9]=J[9]-X[9],Z[10]=J[10]-X[10],Z[11]=J[11]-X[11],Z[12]=J[12]-X[12],Z[13]=J[13]-X[13],Z[14]=J[14]-X[14],Z[15]=J[15]-X[15],Z}function z66(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z[4]=J[4]*X,Z[5]=J[5]*X,Z[6]=J[6]*X,Z[7]=J[7]*X,Z[8]=J[8]*X,Z[9]=J[9]*X,Z[10]=J[10]*X,Z[11]=J[11]*X,Z[12]=J[12]*X,Z[13]=J[13]*X,Z[14]=J[14]*X,Z[15]=J[15]*X,Z}function V66(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z[3]=J[3]+X[3]*Y,Z[4]=J[4]+X[4]*Y,Z[5]=J[5]+X[5]*Y,Z[6]=J[6]+X[6]*Y,Z[7]=J[7]+X[7]*Y,Z[8]=J[8]+X[8]*Y,Z[9]=J[9]+X[9]*Y,Z[10]=J[10]+X[10]*Y,Z[11]=J[11]+X[11]*Y,Z[12]=J[12]+X[12]*Y,Z[13]=J[13]+X[13]*Y,Z[14]=J[14]+X[14]*Y,Z[15]=J[15]+X[15]*Y,Z}function H66(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]&&Z[4]===J[4]&&Z[5]===J[5]&&Z[6]===J[6]&&Z[7]===J[7]&&Z[8]===J[8]&&Z[9]===J[9]&&Z[10]===J[10]&&Z[11]===J[11]&&Z[12]===J[12]&&Z[13]===J[13]&&Z[14]===J[14]&&Z[15]===J[15]}function q66(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],K=Z[4],W=Z[5],G=Z[6],z=Z[7],V=Z[8],H=Z[9],q=Z[10],F=Z[11],U=Z[12],w=Z[13],L=Z[14],j=Z[15],R=J[0],O=J[1],N=J[2],D=J[3],P=J[4],C=J[5],T=J[6],k=J[7],A=J[8],S=J[9],x=J[10],I=J[11],v=J[12],f=J[13],p=J[14],n=J[15];return Math.abs(X-R)<=P0*Math.max(1,Math.abs(X),Math.abs(R))&&Math.abs(Y-O)<=P0*Math.max(1,Math.abs(Y),Math.abs(O))&&Math.abs($-N)<=P0*Math.max(1,Math.abs($),Math.abs(N))&&Math.abs(Q-D)<=P0*Math.max(1,Math.abs(Q),Math.abs(D))&&Math.abs(K-P)<=P0*Math.max(1,Math.abs(K),Math.abs(P))&&Math.abs(W-C)<=P0*Math.max(1,Math.abs(W),Math.abs(C))&&Math.abs(G-T)<=P0*Math.max(1,Math.abs(G),Math.abs(T))&&Math.abs(z-k)<=P0*Math.max(1,Math.abs(z),Math.abs(k))&&Math.abs(V-A)<=P0*Math.max(1,Math.abs(V),Math.abs(A))&&Math.abs(H-S)<=P0*Math.max(1,Math.abs(H),Math.abs(S))&&Math.abs(q-x)<=P0*Math.max(1,Math.abs(q),Math.abs(x))&&Math.abs(F-I)<=P0*Math.max(1,Math.abs(F),Math.abs(I))&&Math.abs(U-v)<=P0*Math.max(1,Math.abs(U),Math.abs(v))&&Math.abs(w-f)<=P0*Math.max(1,Math.abs(w),Math.abs(f))&&Math.abs(L-p)<=P0*Math.max(1,Math.abs(L),Math.abs(p))&&Math.abs(j-n)<=P0*Math.max(1,Math.abs(j),Math.abs(n))}var F66=SJ1,U66=fJ1;var R1={};d4(R1,{str:()=>V56,squaredLength:()=>HX1,sqrLen:()=>O56,sqlerp:()=>P56,slerp:()=>UM,setAxisAngle:()=>YX1,setAxes:()=>D56,set:()=>U56,scale:()=>GX1,rotationTo:()=>N56,rotateZ:()=>Y56,rotateY:()=>X56,rotateX:()=>J56,random:()=>K56,pow:()=>Q56,normalize:()=>qf,multiply:()=>$X1,mul:()=>w56,ln:()=>KX1,lerp:()=>B56,length:()=>VX1,len:()=>j56,invert:()=>W56,identity:()=>t66,getAxisAngle:()=>e66,getAngle:()=>Z56,fromValues:()=>q56,fromMat3:()=>WX1,fromEuler:()=>z56,exp:()=>QX1,exactEquals:()=>M56,equals:()=>R56,dot:()=>zX1,create:()=>Hf,copy:()=>F56,conjugate:()=>G56,clone:()=>H56,calculateW:()=>$56,add:()=>L56});var t0={};d4(t0,{zero:()=>g66,transformQuat:()=>x66,transformMat4:()=>_66,transformMat3:()=>A66,subtract:()=>yJ1,sub:()=>c66,str:()=>m66,squaredLength:()=>cJ1,squaredDistance:()=>dJ1,sqrLen:()=>a66,sqrDist:()=>n66,set:()=>B66,scaleAndAdd:()=>C66,scale:()=>D66,round:()=>P66,rotateZ:()=>b66,rotateY:()=>f66,rotateX:()=>h66,random:()=>S66,normalize:()=>zf,negate:()=>T66,multiply:()=>gJ1,mul:()=>l66,min:()=>R66,max:()=>N66,lerp:()=>E66,length:()=>bJ1,len:()=>Vf,inverse:()=>k66,hermite:()=>I66,fromValues:()=>qM,forEach:()=>s66,floor:()=>M66,exactEquals:()=>u66,equals:()=>d66,dot:()=>FM,divide:()=>mJ1,div:()=>p66,distance:()=>uJ1,dist:()=>i66,cross:()=>Bq,create:()=>HM,copy:()=>w66,clone:()=>L66,ceil:()=>O66,bezier:()=>v66,angle:()=>y66,add:()=>j66});function HM(){var Z=new Y1(3);if(Y1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function L66(Z){var J=new Y1(3);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J}function bJ1(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function qM(Z,J,X){var Y=new Y1(3);return Y[0]=Z,Y[1]=J,Y[2]=X,Y}function w66(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z}function B66(Z,J,X,Y){return Z[0]=J,Z[1]=X,Z[2]=Y,Z}function j66(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z}function yJ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z}function gJ1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z}function mJ1(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z[2]=J[2]/X[2],Z}function O66(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z[2]=Math.ceil(J[2]),Z}function M66(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z[2]=Math.floor(J[2]),Z}function R66(Z,J,X){return Z[0]=Math.min(J[0],X[0]),Z[1]=Math.min(J[1],X[1]),Z[2]=Math.min(J[2],X[2]),Z}function N66(Z,J,X){return Z[0]=Math.max(J[0],X[0]),Z[1]=Math.max(J[1],X[1]),Z[2]=Math.max(J[2],X[2]),Z}function P66(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z[2]=Math.round(J[2]),Z}function D66(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z}function C66(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z}function uJ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return Math.hypot(X,Y,$)}function dJ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return X*X+Y*Y+$*$}function cJ1(Z){var J=Z[0],X=Z[1],Y=Z[2];return J*J+X*X+Y*Y}function T66(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z}function k66(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z[2]=1/J[2],Z}function zf(Z,J){var X=J[0],Y=J[1],$=J[2],Q=X*X+Y*Y+$*$;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 FM(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]}function Bq(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=X[0],W=X[1],G=X[2];return Z[0]=$*G-Q*W,Z[1]=Q*K-Y*G,Z[2]=Y*W-$*K,Z}function E66(Z,J,X,Y){var $=J[0],Q=J[1],K=J[2];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z[2]=K+Y*(X[2]-K),Z}function I66(Z,J,X,Y,$,Q){var K=Q*Q,W=K*(2*Q-3)+1,G=K*(Q-2)+Q,z=K*(Q-1),V=K*(3-2*Q);return Z[0]=J[0]*W+X[0]*G+Y[0]*z+$[0]*V,Z[1]=J[1]*W+X[1]*G+Y[1]*z+$[1]*V,Z[2]=J[2]*W+X[2]*G+Y[2]*z+$[2]*V,Z}function v66(Z,J,X,Y,$,Q){var K=1-Q,W=K*K,G=Q*Q,z=W*K,V=3*Q*W,H=3*G*K,q=G*Q;return Z[0]=J[0]*z+X[0]*V+Y[0]*H+$[0]*q,Z[1]=J[1]*z+X[1]*V+Y[1]*H+$[1]*q,Z[2]=J[2]*z+X[2]*V+Y[2]*H+$[2]*q,Z}function S66(Z,J){J=J||1;var X=l7()*2*Math.PI,Y=l7()*2-1,$=Math.sqrt(1-Y*Y)*J;return Z[0]=Math.cos(X)*$,Z[1]=Math.sin(X)*$,Z[2]=Y*J,Z}function _66(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=X[3]*Y+X[7]*$+X[11]*Q+X[15];return K=K||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/K,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/K,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/K,Z}function A66(Z,J,X){var Y=J[0],$=J[1],Q=J[2];return Z[0]=Y*X[0]+$*X[3]+Q*X[6],Z[1]=Y*X[1]+$*X[4]+Q*X[7],Z[2]=Y*X[2]+$*X[5]+Q*X[8],Z}function x66(Z,J,X){var Y=X[0],$=X[1],Q=X[2],K=X[3],W=J[0],G=J[1],z=J[2],V=$*z-Q*G,H=Q*W-Y*z,q=Y*G-$*W,F=$*q-Q*H,U=Q*V-Y*q,w=Y*H-$*V,L=K*2;return V*=L,H*=L,q*=L,F*=2,U*=2,w*=2,Z[0]=W+V+F,Z[1]=G+H+U,Z[2]=z+q+w,Z}function h66(Z,J,X,Y){var $=[],Q=[];return $[0]=J[0]-X[0],$[1]=J[1]-X[1],$[2]=J[2]-X[2],Q[0]=$[0],Q[1]=$[1]*Math.cos(Y)-$[2]*Math.sin(Y),Q[2]=$[1]*Math.sin(Y)+$[2]*Math.cos(Y),Z[0]=Q[0]+X[0],Z[1]=Q[1]+X[1],Z[2]=Q[2]+X[2],Z}function f66(Z,J,X,Y){var $=[],Q=[];return $[0]=J[0]-X[0],$[1]=J[1]-X[1],$[2]=J[2]-X[2],Q[0]=$[2]*Math.sin(Y)+$[0]*Math.cos(Y),Q[1]=$[1],Q[2]=$[2]*Math.cos(Y)-$[0]*Math.sin(Y),Z[0]=Q[0]+X[0],Z[1]=Q[1]+X[1],Z[2]=Q[2]+X[2],Z}function b66(Z,J,X,Y){var $=[],Q=[];return $[0]=J[0]-X[0],$[1]=J[1]-X[1],$[2]=J[2]-X[2],Q[0]=$[0]*Math.cos(Y)-$[1]*Math.sin(Y),Q[1]=$[0]*Math.sin(Y)+$[1]*Math.cos(Y),Q[2]=$[2],Z[0]=Q[0]+X[0],Z[1]=Q[1]+X[1],Z[2]=Q[2]+X[2],Z}function y66(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=J[0],K=J[1],W=J[2],G=Math.sqrt(X*X+Y*Y+$*$),z=Math.sqrt(Q*Q+K*K+W*W),V=G*z,H=V&&FM(Z,J)/V;return Math.acos(Math.min(Math.max(H,-1),1))}function g66(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z}function m66(Z){return"vec3("+Z[0]+", "+Z[1]+", "+Z[2]+")"}function u66(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]}function d66(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=J[0],K=J[1],W=J[2];return Math.abs(X-Q)<=P0*Math.max(1,Math.abs(X),Math.abs(Q))&&Math.abs(Y-K)<=P0*Math.max(1,Math.abs(Y),Math.abs(K))&&Math.abs($-W)<=P0*Math.max(1,Math.abs($),Math.abs(W))}var c66=yJ1,l66=gJ1,p66=mJ1,i66=uJ1,n66=dJ1,Vf=bJ1,a66=cJ1,s66=function(){var Z=HM();return function(J,X,Y,$,Q,K){var W,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(W=Y;W<G;W+=X)Z[0]=J[W],Z[1]=J[W+1],Z[2]=J[W+2],Q(Z,Z,K),J[W]=Z[0],J[W+1]=Z[1],J[W+2]=Z[2];return J}}();function o66(){var Z=new Y1(4);if(Y1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function lJ1(Z){var J=new Y1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function pJ1(Z,J,X,Y){var $=new Y1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function iJ1(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function nJ1(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function aJ1(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z}function sJ1(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z}function oJ1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return Math.hypot(J,X,Y,$)}function rJ1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return J*J+X*X+Y*Y+$*$}function tJ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=X*X+Y*Y+$*$+Q*Q;if(K>0)K=1/Math.sqrt(K);return Z[0]=X*K,Z[1]=Y*K,Z[2]=$*K,Z[3]=Q*K,Z}function eJ1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}function ZX1(Z,J,X,Y){var $=J[0],Q=J[1],K=J[2],W=J[3];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z[2]=K+Y*(X[2]-K),Z[3]=W+Y*(X[3]-W),Z}function JX1(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function XX1(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],K=J[0],W=J[1],G=J[2],z=J[3];return Math.abs(X-K)<=P0*Math.max(1,Math.abs(X),Math.abs(K))&&Math.abs(Y-W)<=P0*Math.max(1,Math.abs(Y),Math.abs(W))&&Math.abs($-G)<=P0*Math.max(1,Math.abs($),Math.abs(G))&&Math.abs(Q-z)<=P0*Math.max(1,Math.abs(Q),Math.abs(z))}var Cs6=function(){var Z=o66();return function(J,X,Y,$,Q,K){var W,G;if(!X)X=4;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(W=Y;W<G;W+=X)Z[0]=J[W],Z[1]=J[W+1],Z[2]=J[W+2],Z[3]=J[W+3],Q(Z,Z,K),J[W]=Z[0],J[W+1]=Z[1],J[W+2]=Z[2],J[W+3]=Z[3];return J}}();function Hf(){var Z=new Y1(4);if(Y1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z[3]=1,Z}function t66(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=1,Z}function YX1(Z,J,X){X=X*0.5;var Y=Math.sin(X);return Z[0]=Y*J[0],Z[1]=Y*J[1],Z[2]=Y*J[2],Z[3]=Math.cos(X),Z}function e66(Z,J){var X=Math.acos(J[3])*2,Y=Math.sin(X/2);if(Y>P0)Z[0]=J[0]/Y,Z[1]=J[1]/Y,Z[2]=J[2]/Y;else Z[0]=1,Z[1]=0,Z[2]=0;return X}function Z56(Z,J){var X=zX1(Z,J);return Math.acos(2*X*X-1)}function $X1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],K=J[3],W=X[0],G=X[1],z=X[2],V=X[3];return Z[0]=Y*V+K*W+$*z-Q*G,Z[1]=$*V+K*G+Q*W-Y*z,Z[2]=Q*V+K*z+Y*G-$*W,Z[3]=K*V-Y*W-$*G-Q*z,Z}function J56(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],K=J[3],W=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+K*W,Z[1]=$*G+Q*W,Z[2]=Q*G-$*W,Z[3]=K*G-Y*W,Z}function X56(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],K=J[3],W=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G-Q*W,Z[1]=$*G+K*W,Z[2]=Q*G+Y*W,Z[3]=K*G-$*W,Z}function Y56(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],K=J[3],W=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+$*W,Z[1]=$*G-Y*W,Z[2]=Q*G+K*W,Z[3]=K*G-Q*W,Z}function $56(Z,J){var X=J[0],Y=J[1],$=J[2];return Z[0]=X,Z[1]=Y,Z[2]=$,Z[3]=Math.sqrt(Math.abs(1-X*X-Y*Y-$*$)),Z}function QX1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=Math.sqrt(X*X+Y*Y+$*$),W=Math.exp(Q),G=K>0?W*Math.sin(K)/K:0;return Z[0]=X*G,Z[1]=Y*G,Z[2]=$*G,Z[3]=W*Math.cos(K),Z}function KX1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=Math.sqrt(X*X+Y*Y+$*$),W=K>0?Math.atan2(K,Q)/K:0;return Z[0]=X*W,Z[1]=Y*W,Z[2]=$*W,Z[3]=0.5*Math.log(X*X+Y*Y+$*$+Q*Q),Z}function Q56(Z,J,X){return KX1(Z,J),GX1(Z,Z,X),QX1(Z,Z),Z}function UM(Z,J,X,Y){var $=J[0],Q=J[1],K=J[2],W=J[3],G=X[0],z=X[1],V=X[2],H=X[3],q,F,U,w,L;if(F=$*G+Q*z+K*V+W*H,F<0)F=-F,G=-G,z=-z,V=-V,H=-H;if(1-F>P0)q=Math.acos(F),U=Math.sin(q),w=Math.sin((1-Y)*q)/U,L=Math.sin(Y*q)/U;else w=1-Y,L=Y;return Z[0]=w*$+L*G,Z[1]=w*Q+L*z,Z[2]=w*K+L*V,Z[3]=w*W+L*H,Z}function K56(Z){var J=l7(),X=l7(),Y=l7(),$=Math.sqrt(1-J),Q=Math.sqrt(J);return Z[0]=$*Math.sin(2*Math.PI*X),Z[1]=$*Math.cos(2*Math.PI*X),Z[2]=Q*Math.sin(2*Math.PI*Y),Z[3]=Q*Math.cos(2*Math.PI*Y),Z}function W56(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],K=X*X+Y*Y+$*$+Q*Q,W=K?1/K:0;return Z[0]=-X*W,Z[1]=-Y*W,Z[2]=-$*W,Z[3]=Q*W,Z}function G56(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z[3]=J[3],Z}function WX1(Z,J){var X=J[0]+J[4]+J[8],Y;if(X>0)Y=Math.sqrt(X+1),Z[3]=0.5*Y,Y=0.5/Y,Z[0]=(J[5]-J[7])*Y,Z[1]=(J[6]-J[2])*Y,Z[2]=(J[1]-J[3])*Y;else{var $=0;if(J[4]>J[0])$=1;if(J[8]>J[$*3+$])$=2;var Q=($+1)%3,K=($+2)%3;Y=Math.sqrt(J[$*3+$]-J[Q*3+Q]-J[K*3+K]+1),Z[$]=0.5*Y,Y=0.5/Y,Z[3]=(J[Q*3+K]-J[K*3+Q])*Y,Z[Q]=(J[Q*3+$]+J[$*3+Q])*Y,Z[K]=(J[K*3+$]+J[$*3+K])*Y}return Z}function z56(Z,J,X,Y){var $=0.5*Math.PI/180;J*=$,X*=$,Y*=$;var Q=Math.sin(J),K=Math.cos(J),W=Math.sin(X),G=Math.cos(X),z=Math.sin(Y),V=Math.cos(Y);return Z[0]=Q*G*V-K*W*z,Z[1]=K*W*V+Q*G*z,Z[2]=K*G*z-Q*W*V,Z[3]=K*G*V+Q*W*z,Z}function V56(Z){return"quat("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}var H56=lJ1,q56=pJ1,F56=iJ1,U56=nJ1,L56=aJ1,w56=$X1,GX1=sJ1,zX1=eJ1,B56=ZX1,VX1=oJ1,j56=VX1,HX1=rJ1,O56=HX1,qf=tJ1,M56=JX1,R56=XX1,N56=function(){var Z=HM(),J=qM(1,0,0),X=qM(0,1,0);return function(Y,$,Q){var K=FM($,Q);if(K<-0.999999){if(Bq(Z,J,$),Vf(Z)<0.000001)Bq(Z,X,$);return zf(Z,Z),YX1(Y,Z,Math.PI),Y}else if(K>0.999999)return Y[0]=0,Y[1]=0,Y[2]=0,Y[3]=1,Y;else return Bq(Z,$,Q),Y[0]=Z[0],Y[1]=Z[1],Y[2]=Z[2],Y[3]=1+K,qf(Y,Y)}}(),P56=function(){var Z=Hf(),J=Hf();return function(X,Y,$,Q,K,W){return UM(Z,Y,K,W),UM(J,$,Q,W),UM(X,Z,J,2*W*(1-W)),X}}(),D56=function(){var Z=Gf();return function(J,X,Y,$){return Z[0]=Y[0],Z[3]=Y[1],Z[6]=Y[2],Z[1]=$[0],Z[4]=$[1],Z[7]=$[2],Z[2]=-X[0],Z[5]=-X[1],Z[8]=-X[2],qf(J,WX1(J,Z))}}();var K1={};d4(K1,{zero:()=>o56,transformMat4:()=>n56,transformMat3:()=>i56,transformMat2d:()=>p56,transformMat2:()=>l56,subtract:()=>FX1,sub:()=>J96,str:()=>r56,squaredLength:()=>OX1,squaredDistance:()=>BX1,sqrLen:()=>K96,sqrDist:()=>Q96,set:()=>E56,scaleAndAdd:()=>f56,scale:()=>h56,round:()=>x56,rotate:()=>a56,random:()=>c56,normalize:()=>g56,negate:()=>b56,multiply:()=>UX1,mul:()=>X96,min:()=>_56,max:()=>A56,lerp:()=>d56,length:()=>jX1,len:()=>Z96,inverse:()=>y56,fromValues:()=>T56,forEach:()=>W96,floor:()=>S56,exactEquals:()=>t56,equals:()=>e56,dot:()=>m56,divide:()=>LX1,div:()=>Y96,distance:()=>wX1,dist:()=>$96,cross:()=>u56,create:()=>qX1,copy:()=>k56,clone:()=>C56,ceil:()=>v56,angle:()=>s56,add:()=>I56});function qX1(){var Z=new Y1(2);if(Y1!=Float32Array)Z[0]=0,Z[1]=0;return Z}function C56(Z){var J=new Y1(2);return J[0]=Z[0],J[1]=Z[1],J}function T56(Z,J){var X=new Y1(2);return X[0]=Z,X[1]=J,X}function k56(Z,J){return Z[0]=J[0],Z[1]=J[1],Z}function E56(Z,J,X){return Z[0]=J,Z[1]=X,Z}function I56(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z}function FX1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z}function UX1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z}function LX1(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z}function v56(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z}function S56(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z}function _56(Z,J,X){return Z[0]=Math.min(J[0],X[0]),Z[1]=Math.min(J[1],X[1]),Z}function A56(Z,J,X){return Z[0]=Math.max(J[0],X[0]),Z[1]=Math.max(J[1],X[1]),Z}function x56(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z}function h56(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z}function f56(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z}function wX1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return Math.hypot(X,Y)}function BX1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return X*X+Y*Y}function jX1(Z){var J=Z[0],X=Z[1];return Math.hypot(J,X)}function OX1(Z){var J=Z[0],X=Z[1];return J*J+X*X}function b56(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z}function y56(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z}function g56(Z,J){var X=J[0],Y=J[1],$=X*X+Y*Y;if($>0)$=1/Math.sqrt($);return Z[0]=J[0]*$,Z[1]=J[1]*$,Z}function m56(Z,J){return Z[0]*J[0]+Z[1]*J[1]}function u56(Z,J,X){var Y=J[0]*X[1]-J[1]*X[0];return Z[0]=Z[1]=0,Z[2]=Y,Z}function d56(Z,J,X,Y){var $=J[0],Q=J[1];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z}function c56(Z,J){J=J||1;var X=l7()*2*Math.PI;return Z[0]=Math.cos(X)*J,Z[1]=Math.sin(X)*J,Z}function l56(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[2]*$,Z[1]=X[1]*Y+X[3]*$,Z}function p56(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[2]*$+X[4],Z[1]=X[1]*Y+X[3]*$+X[5],Z}function i56(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[3]*$+X[6],Z[1]=X[1]*Y+X[4]*$+X[7],Z}function n56(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[4]*$+X[12],Z[1]=X[1]*Y+X[5]*$+X[13],Z}function a56(Z,J,X,Y){var $=J[0]-X[0],Q=J[1]-X[1],K=Math.sin(Y),W=Math.cos(Y);return Z[0]=$*W-Q*K+X[0],Z[1]=$*K+Q*W+X[1],Z}function s56(Z,J){var X=Z[0],Y=Z[1],$=J[0],Q=J[1],K=Math.sqrt(X*X+Y*Y)*Math.sqrt($*$+Q*Q),W=K&&(X*$+Y*Q)/K;return Math.acos(Math.min(Math.max(W,-1),1))}function o56(Z){return Z[0]=0,Z[1]=0,Z}function r56(Z){return"vec2("+Z[0]+", "+Z[1]+")"}function t56(Z,J){return Z[0]===J[0]&&Z[1]===J[1]}function e56(Z,J){var X=Z[0],Y=Z[1],$=J[0],Q=J[1];return Math.abs(X-$)<=P0*Math.max(1,Math.abs(X),Math.abs($))&&Math.abs(Y-Q)<=P0*Math.max(1,Math.abs(Y),Math.abs(Q))}var Z96=jX1,J96=FX1,X96=UX1,Y96=LX1,$96=wX1,Q96=BX1,K96=OX1,W96=function(){var Z=qX1();return function(J,X,Y,$,Q,K){var W,G;if(!X)X=2;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(W=Y;W<G;W+=X)Z[0]=J[W],Z[1]=J[W+1],Q(Z,Z,K),J[W]=Z[0],J[W+1]=Z[1];return J}}();class r$ extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get determinant(){return g8.determinant(this)}get frobeniusNorm(){return g8.frob(this)}static create(){let Z=new r$(0,0,0,0);return g8.identity(Z),Z}static fromRotation(Z){let J=r$.create();return g8.fromRotation(J,Z),J}static fromScaling(Z){let J=r$.create();return g8.fromScaling(J,Z),J}add(Z){return g8.add(this,this,Z),this}adjoint(){return g8.adjoint(this,this),this}clone(){return new r$(this[0],this[1],this[2],this[3])}copy(Z){return g8.copy(this,Z),this}equals(Z){return g8.equals(this,Z)}exactEquals(Z){return g8.exactEquals(this,Z)}identity(){return g8.identity(this),this}invert(){return g8.invert(this,this),this}multiply(Z){return g8.mul(this,this,Z),this}multiplyScalar(Z){return g8.multiplyScalar(this,this,Z),this}rotate(Z){return g8.rotate(this,this,Z),this}subtract(Z){return g8.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]}][${this[2]},${this[3]}]`}transpose(){return g8.transpose(this,this),this}}class p7 extends Float32Array{constructor(Z,J,X,Y,$,Q,K,W,G){super([Z,J,X,Y,$,Q,K,W,G])}get determinant(){return i1.determinant(this)}get frobeniusNorm(){return i1.frob(this)}static create(){let Z=new p7(0,0,0,0,0,0,0,0,0);return i1.identity(Z),Z}static fromMatrix4(Z){let J=p7.create();return i1.fromMat4(J,Z),J}static fromQuaternion(Z){let J=p7.create();return i1.fromQuat(J,Z),J}static fromRotation(Z){let J=p7.create();return i1.fromRotation(J,Z),J}static fromScaling(Z){let J=p7.create();return i1.fromScaling(J,Z),J}static fromTranslation(Z){let J=p7.create();return i1.fromTranslation(J,Z),J}add(Z){return i1.add(this,this,Z),this}adjoint(){return i1.adjoint(this,this),this}clone(){return new p7(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8])}copy(Z){return i1.copy(this,Z),this}equals(Z){return i1.equals(this,Z)}exactEquals(Z){return i1.exactEquals(this,Z)}identity(){return i1.identity(this),this}invert(){return i1.invert(this,this),this}multiply(Z){return i1.mul(this,this,Z),this}multiplyScalar(Z){return i1.multiplyScalar(this,this,Z),this}transformVector(Z){return Z.transformMatrix3(this)}projection(Z,J){return i1.projection(this,Z,J),this}rotate(Z){return i1.rotate(this,this,Z),this}subtract(Z){return i1.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 i1.transpose(this,this),this}}class F5 extends Float32Array{constructor(Z,J,X,Y,$,Q,K,W,G,z,V,H,q,F,U,w){super([Z,J,X,Y,$,Q,K,W,G,z,V,H,q,F,U,w])}get determinant(){return o0.determinant(this)}get frobeniusNorm(){return o0.frob(this)}static create(){let Z=new F5(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return o0.identity(Z),Z}static fromQuaternion(Z){let J=F5.create();return o0.fromQuat(J,Z),J}static fromRotation(Z,J){let X=F5.create();return o0.fromRotation(X,Z,J),X}static fromRotationTranslation(Z,J){let X=F5.create();return o0.fromRotationTranslation(X,Z,J),X}static fromRotationTranslationScale(Z,J,X){let Y=F5.create();return o0.fromRotationTranslationScale(Y,Z,J,X),Y}static fromRotationTranslationScaleOrigin(Z,J,X,Y){let $=F5.create();return o0.fromRotationTranslationScaleOrigin($,Z,J,X,Y),$}static fromScaling(Z){let J=F5.create();return o0.fromScaling(J,Z),J}static fromTranslation(Z){let J=F5.create();return o0.fromTranslation(J,Z),J}static fromXRotation(Z){let J=F5.create();return o0.fromXRotation(J,Z),J}static fromYRotation(Z){let J=F5.create();return o0.fromYRotation(J,Z),J}static fromZRotation(Z){let J=F5.create();return o0.fromZRotation(J,Z),J}add(Z){return o0.add(this,this,Z),this}adjoint(){return o0.adjoint(this,this),this}clone(){return new F5(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8],this[9],this[10],this[11],this[12],this[13],this[14],this[15])}copy(Z){return o0.copy(this,Z),this}equals(Z){return o0.equals(this,Z)}exactEquals(Z){return o0.exactEquals(this,Z)}frustrum(Z,J,X,Y,$,Q){return o0.frustum(this,Z,J,X,Y,$,Q),this}identity(){return o0.identity(this),this}invert(){return o0.invert(this,this),this}lookAt(Z,J,X){return o0.lookAt(this,Z,J,X),this}multiply(Z){return o0.mul(this,this,Z),this}multiplyScalar(Z){return o0.multiplyScalar(this,this,Z),this}orthographic(Z,J,X,Y,$,Q){return o0.ortho(this,Z,J,X,Y,$,Q),this}perspective(Z,J,X,Y){return o0.perspective(this,Z,J,X,Y),this}rotate(Z,J){return o0.rotate(this,this,Z,J),this}rotateX(Z){return o0.rotateX(this,this,Z),this}rotateY(Z){return o0.rotateY(this,this,Z),this}rotateZ(Z){return o0.rotateZ(this,this,Z),this}scale(Z){return o0.scale(this,this,Z),this}subtract(Z){return o0.sub(this,this,Z),this}targetTo(Z,J,X){return o0.targetTo(this,Z,J,X),this}toString(){return`[${this[0]},${this[1]},${this[2]},${this[3]}][${this[4]},${this[5]},${this[6]},${this[7]}][${this[8]},${this[9]},${this[10]},${this[11]}][${this[12]},${this[13]},${this[14]},${this[15]}]`}translate(Z){return o0.translate(this,this,Z),this}transpose(){return o0.transpose(this,this),this}}class ZG extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get length(){return R1.length(this)}get squaredLength(){return R1.squaredLength(this)}get magnitude(){return R1.length(this)}get squaredMagnitude(){return R1.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}get z(){return this[2]}set z(Z){this[2]=Z}get w(){return this[3]}set w(Z){this[3]=Z}static fromEuler(Z,J,X){let Y=R1.fromEuler(new Float32Array(4),Z,J,X);return new ZG(Y[0],Y[1],Y[2],Y[3])}static fromQuaternionLike(Z){return new ZG(Z.x,Z.y,Z.z,Z.w)}clone(){return new ZG(this.x,this.y,this.z,this.w)}conjugate(){return R1.conjugate(this,this),this}copy(Z){return R1.copy(this,Z),this}dot(Z){return R1.dot(this,Z)}exponential(){return R1.exp(this,this),this}equals(Z){return R1.equals(this,Z)}exactEquals(Z){return R1.exactEquals(this,Z)}getAngle(Z){return R1.getAngle(this,Z)}identity(){return R1.identity(this),this}invert(){return R1.invert(this,this),this}lerp(Z,J){return R1.lerp(this,this,Z,J),this}logarithm(){return R1.ln(this,this),this}multiply(Z){return R1.multiply(this,this,Z),this}transformVector(Z){return Z.transformQuaternion(this)}normalize(){return R1.normalize(this,this),this}power(Z){return R1.pow(this,this,Z),this}randomize(){return R1.random(this),this}rotateX(Z){return R1.rotateX(this,this,Z),this}rotateY(Z){return R1.rotateY(this,this,Z),this}rotateZ(Z){return R1.rotateZ(this,this,Z),this}scale(Z){return R1.scale(this,this,Z),this}setAxisAngle(Z,J){return R1.setAxisAngle(this,Z,J),this}slerp(Z,J){return R1.slerp(this,this,Z,J),this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}}class jq extends Float32Array{constructor(Z,J){super([Z,J])}get length(){return K1.length(this)}get squaredLength(){return K1.squaredLength(this)}get magnitude(){return K1.length(this)}get squaredMagnitude(){return K1.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 jq(0,0)}add(Z){return K1.add(this,this,Z),this}angle(Z){return K1.angle(this,Z)}ceil(){return K1.ceil(this,this),this}clone(){return new jq(this.x,this.y)}copy(Z){return K1.copy(this,Z),this}distance(Z){return K1.distance(this,Z)}divide(Z){return K1.divide(this,this,Z),this}dot(Z){return K1.dot(this,Z)}equals(Z){return K1.equals(this,Z)}exactEquals(Z){return K1.exactEquals(this,Z)}floor(){return K1.floor(this,this),this}invert(){return K1.inverse(this,this),this}lerp(Z,J){return K1.lerp(this,this,Z,J),this}max(Z){return K1.max(this,this,Z),this}min(Z){return K1.min(this,this,Z),this}multiply(Z){return K1.mul(this,this,Z),this}negate(){return K1.negate(this,this),this}normalize(){return K1.normalize(this,this),this}randomize(Z){return K1.random(this,Z),this}rotate(Z,J){return K1.rotate(this,this,Z,J),this}round(){return K1.round(this,this),this}scale(Z){return K1.scale(this,this,Z),this}scaleAndAdd(Z,J){return K1.scaleAndAdd(this,this,Z,J),this}subtract(Z){return K1.sub(this,this,Z),this}toString(){return`${this.x},${this.y}`}transformMatrix2(Z){return K1.transformMat2(this,this,Z),this}transformMatrix3(Z){return K1.transformMat3(this,this,Z),this}transformMatrix4(Z){return K1.transformMat4(this,this,Z),this}zero(){return K1.zero(this),this}}class JG extends Float32Array{constructor(Z,J,X){super([Z,J,X])}get length(){return t0.length(this)}get squaredLength(){return t0.squaredLength(this)}get magnitude(){return t0.length(this)}get squaredMagnitude(){return t0.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}get z(){return this[2]}set z(Z){this[2]=Z}static create(){return new JG(0,0,0)}static fromVector3Like(Z){return new JG(Z.x,Z.y,Z.z)}add(Z){return t0.add(this,this,Z),this}ceil(){return t0.ceil(this,this),this}clone(){return new JG(this.x,this.y,this.z)}copy(Z){return t0.copy(this,Z),this}cross(Z){return t0.cross(this,this,Z),this}distance(Z){return t0.distance(this,Z)}divide(Z){return t0.div(this,this,Z),this}dot(Z){return t0.dot(this,Z)}equals(Z){return t0.equals(this,Z)}exactEquals(Z){return t0.exactEquals(this,Z)}floor(){return t0.floor(this,this),this}invert(){return t0.inverse(this,this),this}lerp(Z,J){return t0.lerp(this,this,Z,J),this}max(Z){return t0.max(this,this,Z),this}min(Z){return t0.min(this,this,Z),this}multiply(Z){return t0.mul(this,this,Z),this}negate(){return t0.negate(this,this),this}normalize(){return t0.normalize(this,this),this}randomize(Z){return t0.random(this,Z),this}rotateX(Z,J){return t0.rotateX(this,this,Z,J),this}rotateY(Z,J){return t0.rotateY(this,this,Z,J),this}rotateZ(Z,J){return t0.rotateZ(this,this,Z,J),this}round(){return t0.round(this,this),this}scale(Z){return t0.scale(this,this,Z),this}scaleAndAdd(Z,J){return t0.scaleAndAdd(this,this,Z,J),this}subtract(Z){return t0.sub(this,this,Z),this}toString(){return`${this.x},${this.y},${this.z}`}transformMatrix3(Z){return t0.transformMat3(this,this,Z),this}transformMatrix4(Z){return t0.transformMat4(this,this,Z),this}transformQuaternion(Z){return t0.transformQuat(this,this,Z),this}zero(){return t0.zero(this),this}}var N1=function(Z,J,X,Y){function $(Q){return Q instanceof X?Q:new X(function(K){K(Q)})}return new(X||(X=Promise))(function(Q,K){function W(V){try{z(Y.next(V))}catch(H){K(H)}}function G(V){try{z(Y.throw(V))}catch(H){K(H)}}function z(V){V.done?Q(V.value):$(V.value).then(W,G)}z((Y=Y.apply(Z,J||[])).next())})},j1=function(Z,J){var X={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},Y,$,Q,K=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return K.next=W(0),K.throw=W(1),K.return=W(2),typeof Symbol==="function"&&(K[Symbol.iterator]=function(){return this}),K;function W(z){return function(V){return G([z,V])}}function G(z){if(Y)throw new TypeError("Generator is already executing.");while(K&&(K=0,z[0]&&(X=0)),X)try{if(Y=1,$&&(Q=z[0]&2?$.return:z[0]?$.throw||((Q=$.return)&&Q.call($),0):$.next)&&!(Q=Q.call($,z[1])).done)return Q;if($=0,Q)z=[z[0]&2,Q.value];switch(z[0]){case 0:case 1:Q=z;break;case 4:return X.label++,{value:z[1],done:!1};case 5:X.label++,$=z[1],z=[0];continue;case 7:z=X.ops.pop(),X.trys.pop();continue;default:if((Q=X.trys,!(Q=Q.length>0&&Q[Q.length-1]))&&(z[0]===6||z[0]===2)){X=0;continue}if(z[0]===3&&(!Q||z[1]>Q[0]&&z[1]<Q[3])){X.label=z[1];break}if(z[0]===6&&X.label<Q[1]){X.label=Q[1],Q=z;break}if(Q&&X.label<Q[2]){X.label=Q[2],X.ops.push(z);break}if(Q[2])X.ops.pop();X.trys.pop();continue}z=J.call(Z,X)}catch(V){z=[6,V],$=0}finally{Y=Q=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},g5=function(Z,J){var X=typeof Symbol==="function"&&Z[Symbol.iterator];if(!X)return Z;var Y=X.call(Z),$,Q=[],K;try{while((J===void 0||J-- >0)&&!($=Y.next()).done)Q.push($.value)}catch(W){K={error:W}}finally{try{if($&&!$.done&&(X=Y.return))X.call(Y)}finally{if(K)throw K.error}}return Q},o9=function(Z,J,X){if(X||arguments.length===2){for(var Y=0,$=J.length,Q;Y<$;Y++)if(Q||!(Y in J)){if(!Q)Q=Array.prototype.slice.call(J,0,Y);Q[Y]=J[Y]}}return Z.concat(Q||Array.prototype.slice.call(J))},MX1=function(Z){var J=typeof Symbol==="function"&&Symbol.iterator,X=J&&Z[J],Y=0;if(X)return X.call(Z);if(Z&&typeof Z.length==="number")return{next:function(){if(Z&&Y>=Z.length)Z=void 0;return{value:Z&&Z[Y++],done:!Z}}};throw new TypeError(J?"Object is not iterable.":"Symbol.iterator is not defined.")},_s6=function(){function Z(J){if(J===void 0)J=Z.minComparator;var X=this;this.compare=J,this.heapArray=[],this._limit=0,this.offer=this.add,this.element=this.peek,this.poll=this.pop,this._invertedCompare=function(Y,$){return X.compare(Y,$).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 X=J%2?1:2;return Math.floor((J-X)/2)},Z.getSiblingIndexOf=function(J){if(J<=0)return-1;var X=J%2?1:-1;return J+X},Z.minComparator=function(J,X){return N1(this,void 0,void 0,function(){return j1(this,function(Y){if(J>X)return[2,1];else if(J<X)return[2,-1];else return[2,0]})})},Z.maxComparator=function(J,X){return N1(this,void 0,void 0,function(){return j1(this,function(Y){if(X>J)return[2,1];else if(X<J)return[2,-1];else return[2,0]})})},Z.minComparatorNumber=function(J,X){return N1(this,void 0,void 0,function(){return j1(this,function(Y){return[2,J-X]})})},Z.maxComparatorNumber=function(J,X){return N1(this,void 0,void 0,function(){return j1(this,function(Y){return[2,X-J]})})},Z.defaultIsEqual=function(J,X){return N1(this,void 0,void 0,function(){return j1(this,function(Y){return[2,J===X]})})},Z.print=function(J){function X(V){var H=Z.getParentIndexOf(V);return Math.floor(Math.log2(H+1))}function Y(V,H){var q="";for(;H>0;--H)q+=V;return q}var $=0,Q=[],K=X(J.length-1)+2,W=0;while($<J.length){var G=X($)+1;if($===0)G=0;var z=String(J.get($));if(z.length>W)W=z.length;Q[G]=Q[G]||[],Q[G].push(z),$+=1}return Q.map(function(V,H){var q=Math.pow(2,K-H)-1;return Y(" ",Math.floor(q/2)*W)+V.map(function(F){var U=(W-F.length)/2;return Y(" ",Math.ceil(U))+F+Y(" ",Math.floor(U))}).join(Y(" ",q*W))}).join(`
484
484
  `)},Z.heapify=function(J,X){return N1(this,void 0,void 0,function(){var Y;return j1(this,function($){switch($.label){case 0:return Y=new Z(X),Y.heapArray=J,[4,Y.init()];case 1:return $.sent(),[2,Y]}})})},Z.heappop=function(J,X){var Y=new Z(X);return Y.heapArray=J,Y.pop()},Z.heappush=function(J,X,Y){return N1(this,void 0,void 0,function(){var $;return j1(this,function(Q){switch(Q.label){case 0:return $=new Z(Y),$.heapArray=J,[4,$.push(X)];case 1:return Q.sent(),[2]}})})},Z.heappushpop=function(J,X,Y){var $=new Z(Y);return $.heapArray=J,$.pushpop(X)},Z.heapreplace=function(J,X,Y){var $=new Z(Y);return $.heapArray=J,$.replace(X)},Z.heaptop=function(J,X,Y){if(X===void 0)X=1;var $=new Z(Y);return $.heapArray=J,$.top(X)},Z.heapbottom=function(J,X,Y){if(X===void 0)X=1;var $=new Z(Y);return $.heapArray=J,$.bottom(X)},Z.nlargest=function(J,X,Y){return N1(this,void 0,void 0,function(){var $;return j1(this,function(Q){switch(Q.label){case 0:return $=new Z(Y),$.heapArray=o9([],g5(X),!1),[4,$.init()];case 1:return Q.sent(),[2,$.top(J)]}})})},Z.nsmallest=function(J,X,Y){return N1(this,void 0,void 0,function(){var $;return j1(this,function(Q){switch(Q.label){case 0:return $=new Z(Y),$.heapArray=o9([],g5(X),!1),[4,$.init()];case 1:return Q.sent(),[2,$.bottom(J)]}})})},Z.prototype.add=function(J){return N1(this,void 0,void 0,function(){return j1(this,function(X){switch(X.label){case 0:return[4,this._sortNodeUp(this.heapArray.push(J)-1)];case 1:return X.sent(),this._applyLimit(),[2,!0]}})})},Z.prototype.addAll=function(J){return N1(this,void 0,void 0,function(){var X,Y,$;return j1(this,function(Q){switch(Q.label){case 0:X=this.length,($=this.heapArray).push.apply($,o9([],g5(J),!1)),Y=this.length,Q.label=1;case 1:if(!(X<Y))return[3,4];return[4,this._sortNodeUp(X)];case 2:Q.sent(),Q.label=3;case 3:return++X,[3,1];case 4:return this._applyLimit(),[2,!0]}})})},Z.prototype.bottom=function(){return N1(this,arguments,void 0,function(J){if(J===void 0)J=1;return j1(this,function(X){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,o9([],g5(this.heapArray),!1)];else return[2,this._bottomN_push(~~J)]})})},Z.prototype.check=function(){return N1(this,void 0,void 0,function(){var J,X,Y,$,Q,K,W,G,z;return j1(this,function(V){switch(V.label){case 0:J=0,V.label=1;case 1:if(!(J<this.heapArray.length))return[3,10];X=this.heapArray[J],Y=this.getChildrenOf(J),V.label=2;case 2:V.trys.push([2,7,8,9]),$=(G=void 0,MX1(Y)),Q=$.next(),V.label=3;case 3:if(Q.done)return[3,6];return K=Q.value,[4,this.compare(X,K)];case 4:if(V.sent()>0)return[2,X];V.label=5;case 5:return Q=$.next(),[3,3];case 6:return[3,9];case 7:return W=V.sent(),G={error:W},[3,9];case 8:try{if(Q&&!Q.done&&(z=$.return))z.call($)}finally{if(G)throw G.error}return[7];case 9:return++J,[3,1];case 10:return[2]}})})},Z.prototype.clear=function(){this.heapArray=[]},Z.prototype.clone=function(){var J=new Z(this.comparator());return J.heapArray=this.toArray(),J._limit=this._limit,J},Z.prototype.comparator=function(){return this.compare},Z.prototype.contains=function(J){return N1(this,arguments,void 0,function(X,Y){var $,Q,K,W,G,z;if(Y===void 0)Y=Z.defaultIsEqual;return j1(this,function(V){switch(V.label){case 0:V.trys.push([0,5,6,7]),$=MX1(this.heapArray),Q=$.next(),V.label=1;case 1:if(Q.done)return[3,4];return K=Q.value,[4,Y(K,X)];case 2:if(V.sent())return[2,!0];V.label=3;case 3:return Q=$.next(),[3,1];case 4:return[3,7];case 5:return W=V.sent(),G={error:W},[3,7];case 6:try{if(Q&&!Q.done&&(z=$.return))z.call($)}finally{if(G)throw G.error}return[7];case 7:return[2,!1]}})})},Z.prototype.init=function(J){return N1(this,void 0,void 0,function(){var X;return j1(this,function(Y){switch(Y.label){case 0:if(J)this.heapArray=o9([],g5(J),!1);X=Math.floor(this.heapArray.length),Y.label=1;case 1:if(!(X>=0))return[3,4];return[4,this._sortNodeDown(X)];case 2:Y.sent(),Y.label=3;case 3:return--X,[3,1];case 4:return this._applyLimit(),[2]}})})},Z.prototype.isEmpty=function(){return this.length===0},Z.prototype.leafs=function(){if(this.heapArray.length===0)return[];var J=Z.getParentIndexOf(this.heapArray.length-1);return this.heapArray.slice(J+1)},Object.defineProperty(Z.prototype,"length",{get:function(){return this.heapArray.length},enumerable:!1,configurable:!0}),Object.defineProperty(Z.prototype,"limit",{get:function(){return this._limit},set:function(J){this._limit=~~J,this._applyLimit()},enumerable:!1,configurable:!0}),Z.prototype.peek=function(){return this.heapArray[0]},Z.prototype.pop=function(){return N1(this,void 0,void 0,function(){var J;return j1(this,function(X){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 X=0;X<arguments.length;X++)J[X]=arguments[X];return N1(this,void 0,void 0,function(){return j1(this,function(Y){if(J.length<1)return[2,!1];else if(J.length===1)return[2,this.add(J[0])];else return[2,this.addAll(J)]})})},Z.prototype.pushpop=function(J){return N1(this,void 0,void 0,function(){var X;return j1(this,function(Y){switch(Y.label){case 0:return[4,this.compare(this.heapArray[0],J)];case 1:if(!(Y.sent()<0))return[3,3];return X=g5([this.heapArray[0],J],2),J=X[0],this.heapArray[0]=X[1],[4,this._sortNodeDown(0)];case 2:Y.sent(),Y.label=3;case 3:return[2,J]}})})},Z.prototype.remove=function(J){return N1(this,arguments,void 0,function(X,Y){var $,Q,K,W=this;if(Y===void 0)Y=Z.defaultIsEqual;return j1(this,function(G){switch(G.label){case 0:if(!this.heapArray.length)return[2,!1];if(X!==void 0)return[3,2];return[4,this.pop()];case 1:return G.sent(),[2,!0];case 2:$=[0],G.label=3;case 3:if(!$.length)return[3,13];return Q=$.shift(),[4,Y(this.heapArray[Q],X)];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:K=Z.getChildrenIndexOf(Q).filter(function(z){return z<W.heapArray.length}),$.push.apply($,o9([],g5(K),!1)),G.label=12;case 12:return[3,3];case 13:return[2,!1]}})})},Z.prototype.replace=function(J){return N1(this,void 0,void 0,function(){var X;return j1(this,function(Y){switch(Y.label){case 0:return X=this.heapArray[0],this.heapArray[0]=J,[4,this._sortNodeDown(0)];case 1:return Y.sent(),[2,X]}})})},Z.prototype.size=function(){return this.length},Z.prototype.top=function(){return N1(this,arguments,void 0,function(J){if(J===void 0)J=1;return j1(this,function(X){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,o9([],g5(this.heapArray),!1)];else return[2,this._topN_push(~~J)]})})},Z.prototype.toArray=function(){return o9([],g5(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 X=this;return Z.getChildrenIndexOf(J).map(function(Y){return X.heapArray[Y]}).filter(function(Y){return Y!==void 0})},Z.prototype.getParentOf=function(J){var X=Z.getParentIndexOf(J);return this.heapArray[X]},Z.prototype[Symbol.iterator]=function(){return j1(this,function(J){switch(J.label){case 0:if(!this.length)return[3,2];return[4,this.pop()];case 1:return J.sent(),[3,0];case 2:return[2]}})},Z.prototype.iterator=function(){return this},Z.prototype._applyLimit=function(){if(this._limit&&this._limit<this.heapArray.length){var J=this.heapArray.length-this._limit;while(J)this.heapArray.pop(),--J}},Z.prototype._bottomN_push=function(J){return N1(this,void 0,void 0,function(){var X,Y,$,Q,W,K,W;return j1(this,function(G){switch(G.label){case 0:return X=new Z(this.compare),X.limit=J,X.heapArray=this.heapArray.slice(-J),[4,X.init()];case 1:G.sent(),Y=this.heapArray.length-1-J,$=Z.getParentIndexOf(Y),Q=[];for(W=Y;W>$;--W)Q.push(W);K=this.heapArray,G.label=2;case 2:if(!Q.length)return[3,6];return W=Q.shift(),[4,this.compare(K[W],X.peek())];case 3:if(!(G.sent()>0))return[3,5];return[4,X.replace(K[W])];case 4:if(G.sent(),W%2)Q.push(Z.getParentIndexOf(W));G.label=5;case 5:return[3,2];case 6:return[2,X.toArray()]}})})},Z.prototype._moveNode=function(J,X){var Y;Y=g5([this.heapArray[X],this.heapArray[J]],2),this.heapArray[J]=Y[0],this.heapArray[X]=Y[1]},Z.prototype._sortNodeDown=function(J){return N1(this,void 0,void 0,function(){var X,Y,$,Q,K,W;return j1(this,function(G){switch(G.label){case 0:X=this.heapArray.length,G.label=1;case 1:if(Y=2*J+1,$=Y+1,Q=J,K=Y<X,!K)return[3,3];return[4,this.compare(this.heapArray[Y],this.heapArray[Q])];case 2:K=G.sent()<0,G.label=3;case 3:if(K)Q=Y;if(W=$<X,!W)return[3,5];return[4,this.compare(this.heapArray[$],this.heapArray[Q])];case 4:W=G.sent()<0,G.label=5;case 5:if(W)Q=$;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 N1(this,void 0,void 0,function(){var X;return j1(this,function(Y){switch(Y.label){case 0:if(!(J>0))return[3,2];return X=Z.getParentIndexOf(J),[4,this.compare(this.heapArray[J],this.heapArray[X])];case 1:if(Y.sent()<0)this._moveNode(J,X),J=X;else return[3,2];return[3,0];case 2:return[2]}})})},Z.prototype._topN_push=function(J){return N1(this,void 0,void 0,function(){var X,Y,$,Q;return j1(this,function(K){switch(K.label){case 0:X=new Z(this._invertedCompare),X.limit=J,Y=[0],$=this.heapArray,K.label=1;case 1:if(!Y.length)return[3,7];if(Q=Y.shift(),!(Q<$.length))return[3,6];if(!(X.length<J))return[3,3];return[4,X.push($[Q])];case 2:return K.sent(),Y.push.apply(Y,o9([],g5(Z.getChildrenIndexOf(Q)),!1)),[3,6];case 3:return[4,this.compare($[Q],X.peek())];case 4:if(!(K.sent()<0))return[3,6];return[4,X.replace($[Q])];case 5:K.sent(),Y.push.apply(Y,o9([],g5(Z.getChildrenIndexOf(Q)),!1)),K.label=6;case 6:return[3,1];case 7:return[2,X.toArray()]}})})},Z.prototype._topN_fill=function(J){return N1(this,void 0,void 0,function(){var X,Y,$,Q,K,K;return j1(this,function(W){switch(W.label){case 0:return X=this.heapArray,Y=new Z(this._invertedCompare),Y.limit=J,Y.heapArray=X.slice(0,J),[4,Y.init()];case 1:W.sent(),$=Z.getParentIndexOf(J-1)+1,Q=[];for(K=$;K<J;++K)Q.push.apply(Q,o9([],g5(Z.getChildrenIndexOf(K).filter(function(G){return G<X.length})),!1));if((J-1)%2)Q.push(J);W.label=2;case 2:if(!Q.length)return[3,6];if(K=Q.shift(),!(K<X.length))return[3,5];return[4,this.compare(X[K],Y.peek())];case 3:if(!(W.sent()<0))return[3,5];return[4,Y.replace(X[K])];case 4:W.sent(),Q.push.apply(Q,o9([],g5(Z.getChildrenIndexOf(K)),!1)),W.label=5;case 5:return[3,2];case 6:return[2,Y.toArray()]}})})},Z.prototype._topN_heap=function(J){return N1(this,void 0,void 0,function(){var X,Y,$,Q,K;return j1(this,function(W){switch(W.label){case 0:X=this.clone(),Y=[],$=0,W.label=1;case 1:if(!($<J))return[3,4];return K=(Q=Y).push,[4,X.pop()];case 2:K.apply(Q,[W.sent()]),W.label=3;case 3:return++$,[3,1];case 4:return[2,Y]}})})},Z.prototype._topIdxOf=function(J){return N1(this,void 0,void 0,function(){var X,Y,$,Q;return j1(this,function(K){switch(K.label){case 0:if(!J.length)return[2,-1];X=0,Y=J[X],$=1,K.label=1;case 1:if(!($<J.length))return[3,4];return[4,this.compare(J[$],Y)];case 2:if(Q=K.sent(),Q<0)X=$,Y=J[$];K.label=3;case 3:return++$,[3,1];case 4:return[2,X]}})})},Z.prototype._topOf=function(){var J=[];for(var X=0;X<arguments.length;X++)J[X]=arguments[X];return N1(this,void 0,void 0,function(){var Y;return j1(this,function($){switch($.label){case 0:return Y=new Z(this.compare),[4,Y.init(J)];case 1:return $.sent(),[2,Y.peek()]}})})},Z}(),G96=function(Z,J){var X={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},Y,$,Q,K=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return K.next=W(0),K.throw=W(1),K.return=W(2),typeof Symbol==="function"&&(K[Symbol.iterator]=function(){return this}),K;function W(z){return function(V){return G([z,V])}}function G(z){if(Y)throw new TypeError("Generator is already executing.");while(K&&(K=0,z[0]&&(X=0)),X)try{if(Y=1,$&&(Q=z[0]&2?$.return:z[0]?$.throw||((Q=$.return)&&Q.call($),0):$.next)&&!(Q=Q.call($,z[1])).done)return Q;if($=0,Q)z=[z[0]&2,Q.value];switch(z[0]){case 0:case 1:Q=z;break;case 4:return X.label++,{value:z[1],done:!1};case 5:X.label++,$=z[1],z=[0];continue;case 7:z=X.ops.pop(),X.trys.pop();continue;default:if((Q=X.trys,!(Q=Q.length>0&&Q[Q.length-1]))&&(z[0]===6||z[0]===2)){X=0;continue}if(z[0]===3&&(!Q||z[1]>Q[0]&&z[1]<Q[3])){X.label=z[1];break}if(z[0]===6&&X.label<Q[1]){X.label=Q[1],Q=z;break}if(Q&&X.label<Q[2]){X.label=Q[2],X.ops.push(z);break}if(Q[2])X.ops.pop();X.trys.pop();continue}z=J.call(Z,X)}catch(V){z=[6,V],$=0}finally{Y=Q=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},R6=function(Z,J){var X=typeof Symbol==="function"&&Z[Symbol.iterator];if(!X)return Z;var Y=X.call(Z),$,Q=[],K;try{while((J===void 0||J-- >0)&&!($=Y.next()).done)Q.push($.value)}catch(W){K={error:W}}finally{try{if($&&!$.done&&(X=Y.return))X.call(Y)}finally{if(K)throw K.error}}return Q},U5=function(Z,J,X){if(X||arguments.length===2){for(var Y=0,$=J.length,Q;Y<$;Y++)if(Q||!(Y in J)){if(!Q)Q=Array.prototype.slice.call(J,0,Y);Q[Y]=J[Y]}}return Z.concat(Q||Array.prototype.slice.call(J))};var RX1=function(){function Z(J){if(J===void 0)J=Z.minComparator;var X=this;this.compare=J,this.heapArray=[],this._limit=0,this.offer=this.add,this.element=this.peek,this.poll=this.pop,this.removeAll=this.clear,this._invertedCompare=function(Y,$){return-1*X.compare(Y,$)}}return Z.getChildrenIndexOf=function(J){return[J*2+1,J*2+2]},Z.getParentIndexOf=function(J){if(J<=0)return-1;var X=J%2?1:2;return Math.floor((J-X)/2)},Z.getSiblingIndexOf=function(J){if(J<=0)return-1;var X=J%2?1:-1;return J+X},Z.minComparator=function(J,X){if(J>X)return 1;else if(J<X)return-1;else return 0},Z.maxComparator=function(J,X){if(X>J)return 1;else if(X<J)return-1;else return 0},Z.minComparatorNumber=function(J,X){return J-X},Z.maxComparatorNumber=function(J,X){return X-J},Z.defaultIsEqual=function(J,X){return J===X},Z.print=function(J){function X(V){var H=Z.getParentIndexOf(V);return Math.floor(Math.log2(H+1))}function Y(V,H){var q="";for(;H>0;--H)q+=V;return q}var $=0,Q=[],K=X(J.length-1)+2,W=0;while($<J.length){var G=X($)+1;if($===0)G=0;var z=String(J.get($));if(z.length>W)W=z.length;Q[G]=Q[G]||[],Q[G].push(z),$+=1}return Q.map(function(V,H){var q=Math.pow(2,K-H)-1;return Y(" ",Math.floor(q/2)*W)+V.map(function(F){var U=(W-F.length)/2;return Y(" ",Math.ceil(U))+F+Y(" ",Math.floor(U))}).join(Y(" ",q*W))}).join(`
485
485
  `)},Z.heapify=function(J,X){var Y=new Z(X);return Y.heapArray=J,Y.init(),Y},Z.heappop=function(J,X){var Y=new Z(X);return Y.heapArray=J,Y.pop()},Z.heappush=function(J,X,Y){var $=new Z(Y);$.heapArray=J,$.push(X)},Z.heappushpop=function(J,X,Y){var $=new Z(Y);return $.heapArray=J,$.pushpop(X)},Z.heapreplace=function(J,X,Y){var $=new Z(Y);return $.heapArray=J,$.replace(X)},Z.heaptop=function(J,X,Y){if(X===void 0)X=1;var $=new Z(Y);return $.heapArray=J,$.top(X)},Z.heapbottom=function(J,X,Y){if(X===void 0)X=1;var $=new Z(Y);return $.heapArray=J,$.bottom(X)},Z.nlargest=function(J,X,Y){var $=new Z(Y);return $.heapArray=U5([],R6(X),!1),$.init(),$.top(J)},Z.nsmallest=function(J,X,Y){var $=new Z(Y);return $.heapArray=U5([],R6(X),!1),$.init(),$.bottom(J)},Z.prototype.add=function(J){return this._sortNodeUp(this.heapArray.push(J)-1),this._applyLimit(),!0},Z.prototype.addAll=function(J){var X,Y=this.length;(X=this.heapArray).push.apply(X,U5([],R6(J),!1));for(var $=this.length;Y<$;++Y)this._sortNodeUp(Y);return this._applyLimit(),!0},Z.prototype.bottom=function(J){if(J===void 0)J=1;if(this.heapArray.length===0||J<=0)return[];else if(this.heapArray.length===1)return[this.heapArray[0]];else if(J>=this.heapArray.length)return U5([],R6(this.heapArray),!1);else return this._bottomN_push(~~J)},Z.prototype.check=function(){var J=this;return this.heapArray.find(function(X,Y){return!!J.getChildrenOf(Y).find(function($){return J.compare(X,$)>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,X){if(X===void 0)X=Z.defaultIsEqual;return this.indexOf(J,X)!==-1},Z.prototype.init=function(J){if(J)this.heapArray=U5([],R6(J),!1);for(var X=Math.floor(this.heapArray.length);X>=0;--X)this._sortNodeDown(X);this._applyLimit()},Z.prototype.isEmpty=function(){return this.length===0},Z.prototype.indexOf=function(J,X){if(X===void 0)X=Z.defaultIsEqual;if(this.heapArray.length===0)return-1;var Y=[],$=0;while($<this.heapArray.length){var Q=this.heapArray[$];if(X(Q,J))return $;else if(this.compare(Q,J)<=0)Y.push.apply(Y,U5([],R6(Z.getChildrenIndexOf($)),!1));$=Y.shift()||this.heapArray.length}return-1},Z.prototype.indexOfEvery=function(J,X){if(X===void 0)X=Z.defaultIsEqual;if(this.heapArray.length===0)return[];var Y=[],$=[],Q=0;while(Q<this.heapArray.length){var K=this.heapArray[Q];if(X(K,J))$.push(Q),Y.push.apply(Y,U5([],R6(Z.getChildrenIndexOf(Q)),!1));else if(this.compare(K,J)<=0)Y.push.apply(Y,U5([],R6(Z.getChildrenIndexOf(Q)),!1));Q=Y.shift()||this.heapArray.length}return $},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 X=0;X<arguments.length;X++)J[X]=arguments[X];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 X;if(this.compare(this.heapArray[0],J)<0)X=R6([this.heapArray[0],J],2),J=X[0],this.heapArray[0]=X[1],this._sortNodeDown(0);return J},Z.prototype.remove=function(J,X){var Y=this;if(X===void 0)X=Z.defaultIsEqual;if(!this.heapArray.length)return!1;if(J===void 0)return this.pop(),!0;var $=[0];while($.length){var Q=$.shift();if(X(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 K=Z.getChildrenIndexOf(Q).filter(function(W){return W<Y.heapArray.length});$.push.apply($,U5([],R6(K),!1))}}return!1},Z.prototype.replace=function(J){var X=this.heapArray[0];return this.heapArray[0]=J,this._sortNodeDown(0),X},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 U5([],R6(this.heapArray),!1);else return this._topN_push(~~J)},Z.prototype.toArray=function(){return U5([],R6(this.heapArray),!1)},Z.prototype.toString=function(){return this.heapArray.toString()},Z.prototype.get=function(J){return this.heapArray[J]},Z.prototype.getChildrenOf=function(J){var X=this;return Z.getChildrenIndexOf(J).map(function(Y){return X.heapArray[Y]}).filter(function(Y){return Y!==void 0})},Z.prototype.getParentOf=function(J){var X=Z.getParentIndexOf(J);return this.heapArray[X]},Z.prototype[Symbol.iterator]=function(){return G96(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 X=new Z(this.compare);X.limit=J,X.heapArray=this.heapArray.slice(-J),X.init();var Y=this.heapArray.length-1-J,$=Z.getParentIndexOf(Y),Q=[];for(var K=Y;K>$;--K)Q.push(K);var W=this.heapArray;while(Q.length){var K=Q.shift();if(this.compare(W[K],X.peek())>0){if(X.replace(W[K]),K%2)Q.push(Z.getParentIndexOf(K))}}return X.toArray()},Z.prototype._moveNode=function(J,X){var Y;Y=R6([this.heapArray[X],this.heapArray[J]],2),this.heapArray[J]=Y[0],this.heapArray[X]=Y[1]},Z.prototype._sortNodeDown=function(J){var X=this.heapArray.length;while(!0){var Y=2*J+1,$=Y+1,Q=J;if(Y<X&&this.compare(this.heapArray[Y],this.heapArray[Q])<0)Q=Y;if($<X&&this.compare(this.heapArray[$],this.heapArray[Q])<0)Q=$;if(Q===J)break;this._moveNode(J,Q),J=Q}},Z.prototype._sortNodeUp=function(J){while(J>0){var X=Z.getParentIndexOf(J);if(this.compare(this.heapArray[J],this.heapArray[X])<0)this._moveNode(J,X),J=X;else break}},Z.prototype._topN_push=function(J){var X=new Z(this._invertedCompare);X.limit=J;var Y=[0],$=this.heapArray;while(Y.length){var Q=Y.shift();if(Q<$.length){if(X.length<J)X.push($[Q]),Y.push.apply(Y,U5([],R6(Z.getChildrenIndexOf(Q)),!1));else if(this.compare($[Q],X.peek())<0)X.replace($[Q]),Y.push.apply(Y,U5([],R6(Z.getChildrenIndexOf(Q)),!1))}}return X.toArray()},Z.prototype._topN_fill=function(J){var X=this.heapArray,Y=new Z(this._invertedCompare);Y.limit=J,Y.heapArray=X.slice(0,J),Y.init();var $=Z.getParentIndexOf(J-1)+1,Q=[];for(var K=$;K<J;++K)Q.push.apply(Q,U5([],R6(Z.getChildrenIndexOf(K).filter(function(W){return W<X.length})),!1));if((J-1)%2)Q.push(J);while(Q.length){var K=Q.shift();if(K<X.length){if(this.compare(X[K],Y.peek())<0)Y.replace(X[K]),Q.push.apply(Q,U5([],R6(Z.getChildrenIndexOf(K)),!1))}}return Y.toArray()},Z.prototype._topN_heap=function(J){var X=this.clone(),Y=[];for(var $=0;$<J;++$)Y.push(X.pop());return Y},Z.prototype._topIdxOf=function(J){if(!J.length)return-1;var X=0,Y=J[X];for(var $=1;$<J.length;++$){var Q=this.compare(J[$],Y);if(Q<0)X=$,Y=J[$]}return X},Z.prototype._topOf=function(){var J=[];for(var X=0;X<arguments.length;X++)J[X]=arguments[X];var Y=new Z(this.compare);return Y.init(J),Y.peek()},Z}();class Oq extends xX{faceSpeed=0;idleLoopedAnimations=[];idleLoopedAnimationsSpeed;jumpOneshotAnimations=[];moveLoopedAnimations=[];moveLoopedAnimationsSpeed;moveSpeed=0;_faceTarget;_jumpHeight=0;_moveTarget;_moveIgnoreAxes={};_moveStartMoveAnimations=!1;_moveStartIdleAnimationsOnCompletion=!0;_onFace;_onFaceComplete;_onMove;_onMoveComplete;spawn(Z){super.spawn(Z),this._startIdleAnimations(Z)}face(Z,J,X){this._faceTarget=Z,this.faceSpeed=J,this._onFace=X?.faceCallback,this._onFaceComplete=X?.faceCompleteCallback}jump(Z){this._jumpHeight=Z}move(Z,J,X){this.moveSpeed=J,this._moveTarget=Z,this._moveIgnoreAxes=X?.moveIgnoreAxes??{},this._moveStartIdleAnimationsOnCompletion=X?.moveStartIdleAnimationsOnCompletion??!0,this._moveStartMoveAnimations=!0,this._onMove=X?.moveCallback,this._onMoveComplete=X?.moveCompleteCallback}tick(Z,J){if(super.tick(Z,J),!this._moveTarget&&!this._faceTarget&&!this._jumpHeight)return;if(this._moveStartMoveAnimations)this._startMoveAnimations(Z),this._moveStartMoveAnimations=!1;let X=J/1000,Y=Z.position;if(Z.isDynamic&&this._jumpHeight>0){let $=Math.abs(Z.world.simulation.gravity.y),Q=Math.sqrt(2*$*this._jumpHeight);Z.applyImpulse({x:0,y:Q*Z.mass,z:0}),this._jumpHeight=0,this._startJumpAnimations(Z)}if(this._moveTarget){let $={x:this._moveIgnoreAxes.x?0:this._moveTarget.x-Y.x,y:this._moveIgnoreAxes.y?0:this._moveTarget.y-Y.y,z:this._moveIgnoreAxes.z?0:this._moveTarget.z-Y.z},Q=$.x*$.x+$.y*$.y+$.z*$.z;if(Q>0.1){let K=Math.sqrt(Q),W=this.moveSpeed*X,z=Math.min(K,W)/K,V={x:Y.x+$.x*z,y:Y.y+$.y*z,z:Y.z+$.z*z};if(Z.setPosition(V),this._onMove)this._onMove(V,this._moveTarget)}else{if(this._moveTarget=void 0,this._moveStartIdleAnimationsOnCompletion)this._startIdleAnimations(Z);if(this._onMoveComplete){let K=this._onMoveComplete;this._onMove=void 0,this._onMoveComplete=void 0,K(Y)}}}if(this._faceTarget){let $={x:this._faceTarget.x-Y.x,z:this._faceTarget.z-Y.z},Q=Math.atan2(-$.x,-$.z),K=Z.rotation,W=Math.atan2(2*(K.w*K.y),1-2*(K.y*K.y)),G=Q-W;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*X,V=Math.abs(G)<z?G:Math.sign(G)*z,q=(W+V)/2,F={x:0,y:Math.fround(Math.sin(q)),z:0,w:Math.fround(Math.cos(q))};if(Z.setRotation(F),this._onFace)this._onFace(K,F)}else if(this._faceTarget=void 0,this._onFaceComplete){let z=this._onFaceComplete;this._onFaceComplete=void 0,z(Z.rotation)}}}_startIdleAnimations(Z){if(this.idleLoopedAnimationsSpeed)Z.setModelAnimationsPlaybackRate(this.idleLoopedAnimationsSpeed);Z.stopModelAnimations(this.moveLoopedAnimations),Z.stopModelAnimations(this.jumpOneshotAnimations),Z.startModelLoopedAnimations(this.idleLoopedAnimations)}_startJumpAnimations(Z){Z.stopModelAnimations(this.moveLoopedAnimations),Z.stopModelAnimations(this.idleLoopedAnimations),Z.startModelOneshotAnimations(this.jumpOneshotAnimations)}_startMoveAnimations(Z){if(this.moveLoopedAnimationsSpeed)Z.setModelAnimationsPlaybackRate(this.moveLoopedAnimationsSpeed);Z.stopModelAnimations(this.jumpOneshotAnimations),Z.stopModelAnimations(this.idleLoopedAnimations),Z.startModelLoopedAnimations(this.moveLoopedAnimations)}}class Ff extends Oq{_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,X){if(this._target=Z,this._speed=J,this._debug=X?.debug??!1,this._maxFall=X?.maxFall?-Math.abs(X.maxFall):0,this._maxJump=X?.maxJump?Math.abs(X.maxJump):0,this._maxOpenSetIterations=X?.maxOpenSetIterations??200,this._onPathfindAbort=X?.pathfindAbortCallback,this._onPathfindComplete=X?.pathfindCompleteCallback,this._onWaypointMoveComplete=X?.waypointMoveCompleteCallback,this._onWaypointMoveSkipped=X?.waypointMoveSkippedCallback,this._verticalPenalty=X?.verticalPenalty??0,this._waypoints=[],this._waypointNextIndex=0,this._waypointTimeoutMs=X?.waypointTimeoutMs??2000/J,!this._calculatePath())return!1;return this._moveToNextWaypoint(),!0}attach(Z){super.attach(Z),this._entity=Z}detach(Z){super.detach(Z),this._entity=void 0}tick(Z,J){super.tick(Z,J)}_calculatePath(){if(!this._target||!this._entity?.world)return m.error("PathfindingEntityController._calculatePath: No target or world"),!1;let Z=this._entity.height,J=this._findGroundedStart();if(!J){if(this._debug)m.warning(`PathfindingEntityController._calculatePath: No valid grounded start found within maxFall distance, path search aborted. Start: ${this._coordinateToKey(this._target)}, Target: ${this._coordinateToKey(this._target)}`);return!1}let X={x:Math.floor(this._target.x),y:Math.floor(this._target.y),z:Math.floor(this._target.z)},Y=Math.abs(X.x-J.x),$=Math.abs(X.y-J.y),Q=Math.abs(X.z-J.z);if(Y<=2&&$<=2&&Q<=2&&!this._isNeighborCoordinateBlocked(J,X,this._entity.height))return this._waypoints=[{x:J.x+0.5,y:J.y+Z/2,z:J.z+0.5},{x:X.x+0.5,y:X.y+Z/2,z:X.z+0.5}],!0;if(J.x===X.x&&J.y===X.y&&J.z===X.z)return this._waypoints=[{x:J.x+0.5,y:J.y+Z/2,z:J.z+0.5}],!0;let W=this._coordinateToKey(J),G=new Map,z=new Map([[W,0]]),V=new Map([[W,this._pathfindingHeuristic(J,X)]]),H=new Set,q=new RX1((O,N)=>{let D=V.get(O[0])??1/0,P=V.get(N[0])??1/0;return D-P});q.push([W,J]);let F=[{x:0,y:0,z:1},{x:1,y:0,z:0},{x:0,y:0,z:-1},{x:-1,y:0,z:0},{x:1,y:0,z:1},{x:1,y:0,z:-1},{x:-1,y:0,z:1},{x:-1,y:0,z:-1}],U=[];for(let O=this._maxJump;O>=this._maxFall;O--){if(O===0)continue;let N=Math.abs(J.y+O-X.y);U.push({y:O,distanceToTargetY:N})}U.sort((O,N)=>O.distanceToTargetY-N.distanceToTargetY);let w=[...F,...U.flatMap(({y:O})=>F.map((N)=>({...N,y:O})))],L=0,j=Math.abs(X.x-J.x)+Math.abs(X.y-J.y)+Math.abs(X.z-J.z),R=Math.min(this._maxOpenSetIterations,j*20);while(!q.isEmpty()&&L<R){L++;let[O,N]=q.pop();if(N.x===X.x&&N.y===X.y&&N.z===X.z){let C=this._reconstructPath(G,N);if(this._waypoints=C.map((T)=>({x:T.x+0.5,y:T.y+Z/2,z:T.z+0.5})),this._debug)console.log(`PathfindingEntityController._calculatePath: Path found after ${L} open set iterations. Start: ${this._coordinateToKey(J)}, Target: ${this._coordinateToKey(this._target)}`);return!0}H.add(O);let D=z.get(O),P=new Map;for(let C of w){let T=`${C.x},${C.z}`,k=C.y<0;if(k&&P.has(T))continue;let A={x:N.x+C.x,y:N.y+C.y,z:N.z+C.z};if(Math.abs(X.x-A.x)+Math.abs(X.y-A.y)+Math.abs(X.z-A.z)>j*1.5)continue;let x=this._coordinateToKey(A);if(H.has(x))continue;let I=this._isNeighborCoordinateBlocked(N,A,this._entity.height);if(k&&I){P.set(T,!0);continue}if(I)continue;let v=Math.abs(C.x),f=Math.abs(C.y),p=Math.abs(C.z),n=f===0?0:this._verticalPenalty,o=(Math.max(v,f,p)===1&&v+f+p>1?1.4:1)+n,J0=D+o,Q0=z.get(x)??1/0;if(J0>=Q0)continue;G.set(x,N),z.set(x,J0);let C0=J0+this._pathfindingHeuristic(A,X);V.set(x,C0),q.push([x,A])}}if(L>=R){if(this._onPathfindAbort?.(),this._debug)m.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)m.warning(`PathfindingEntityController._calculatePath: No valid path found. Start: ${this._coordinateToKey(J)}, Target: ${this._coordinateToKey(this._target)}`);return this._target=void 0,this._waypoints=[],!1}_reconstructPath(Z,J){let X=[J],Y=J;while(Z.has(this._coordinateToKey(Y)))Y=Z.get(this._coordinateToKey(Y)),X.unshift(Y);return X}_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 X=0;if(this._entity.isDynamic&&Z&&J.y>Z.y){let Y=J.y-Z.y,$=Math.min(Y,this._maxJump)+0.75;this.jump($);let Q=Math.abs(this._entity.world.simulation.gravity.y),K=Math.sqrt(2*Q*$),W=Z.x+0.5,G=Z.z+0.5,z=J.x+0.5,V=J.z+0.5,H=z-W,q=V-G,F=Math.sqrt(H*H+q*q),U=K/Q,w=F/this._speed;X=Math.min(U*0.8,w)*1000}setTimeout(()=>{if(!this._entity)return;let Y=Date.now();this.face(J,this._speed),this.move(J,this._speed,{moveStartIdleAnimationsOnCompletion:this._waypointNextIndex===this._waypoints.length-1,moveIgnoreAxes:{y:this._entity.isDynamic},moveCallback:()=>{if(Date.now()-Y>this._waypointTimeoutMs&&this._waypointNextIndex<this._waypoints.length-1)this._onWaypointMoveSkipped?.(J,this._waypointNextIndex),this._waypointNextIndex++,this._moveToNextWaypoint()},moveCompleteCallback:()=>{if(this._waypointNextIndex<this._waypoints.length-1)this._onWaypointMoveComplete?.(J,this._waypointNextIndex),this._waypointNextIndex++,this._moveToNextWaypoint();else this._onPathfindComplete?.()}})},X)}_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,X){if(!this._entity?.world)return!1;let Y=this._entity.world,$=Math.floor(J.x),Q=Math.floor(J.y),K=Math.floor(J.z),W=Math.floor(Z.x),G=Math.floor(Z.z);if(!Y.chunkLattice.hasBlock({x:$,y:Q-1,z:K}))return!0;for(let z=0;z<X;z++)if(Y.chunkLattice.hasBlock({x:$,y:Q+z,z:K}))return!0;if($!==W&&K!==G)for(let z=0;z<X;z++){let V=Y.chunkLattice.hasBlock({x:$,y:Q+z,z:G}),H=Y.chunkLattice.hasBlock({x:W,y:Q+z,z:K});if(V||H)return!0}return!1}_findGroundedStart(){if(!this._entity?.world)return;let{x:Z,y:J,z:X}=this._entity.position,Y={x:Math.floor(Z),y:Math.floor(J),z:Math.floor(X)};for(let $=0;$<=Math.abs(this._maxFall);$++)if(this._entity.world.chunkLattice.hasBlock({...Y,y:Y.y-$-1}))return{...Y,y:Y.y-$};return}}export{C16 as startServer,PJ1 as WorldManagerEvent,tW as WorldManager,NJ1 as WorldLoopEvent,Uq as WorldLoop,Qf as WorldEvent,Lq as World,cI as WebServerEvent,yK as WebServer,JG as Vector3,jq as Vector2,Fq as Ticker,$f as SimulationEvent,Hq as Simulation,Oq as SimpleEntityController,qq as SceneUIManager,eh as SceneUIEvent,$q as SceneUI,CJ1 as SUPPORTED_INPUT_KEYS,I3 as RigidBodyType,RY as RigidBody,OJ1 as ROTATION_UPDATE_THRESHOLD,ZG as Quaternion,zM as PlayerUIEvent,zq as PlayerUI,LJ1 as PlayerManagerEvent,e5 as PlayerManager,Qq as PlayerEvent,c7 as PlayerEntity,RJ1 as PlayerCameraMode,Xf as PlayerCameraEvent,Gq as PlayerCamera,oW as Player,s$ as PersistenceManager,Ff as PathfindingEntityController,jJ1 as POSITION_UPDATE_THRESHOLD_SQ,uI as PORT,P9 as ModelRegistry,F5 as Matrix4,p7 as Matrix3,r$ as Matrix2,MJ1 as LightType,Wq as LightManager,Zf as LightEvent,Jf as Light,DJ1 as GameServerEvent,sZ as GameServer,g0 as EventRouter,m as ErrorHandler,Kq as EntityManager,Yq as EntityEvent,a8 as Entity,b1 as DefaultPlayerEntityController,Wf as DefaultPlayerEntity,BJ1 as DEFAULT_ENTITY_RIGID_BODY_OPTIONS,J4 as CollisionGroupsBuilder,gX as CollisionGroup,v3 as ColliderShape,Vq as ColliderMap,a5 as Collider,SC as CoefficientCombineRule,Xq as ChunkLattice,th as ChunkEvent,b6 as Chunk,wq as ChatManager,Kf as ChatEvent,AC as BlockTypeRegistryEvent,S3 as BlockTypeRegistry,_C as BlockTypeEvent,s5 as BlockType,ZQ as Block,Mf as BaseEntityControllerEvent,xX as BaseEntityController,$G as AudioManager,BM as AudioEvent,YG as Audio};