hytopia 0.7.13-dev1v → 0.7.14

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 oz1}from"buffer";import{StringDecoder as rz1}from"string_decoder";var oU=(Z,J,X)=>{if(X)return;if(Z)return{transform:tz1.bind(void 0,new TextEncoder)};let Y=new rz1(J);return{transform:ez1.bind(void 0,Y),final:ZH1.bind(void 0,Y)}},tz1=function*(Z,J){if(oz1.isBuffer(J))yield UZ(J);else if(typeof J==="string")yield Z.encode(J);else yield J},ez1=function*(Z,J){yield p8(J)?Z.write(J):J},ZH1=function*(Z){let J=Z.end();if(J!=="")yield J};import{callbackify as Tc}from"util";var nD=Tc(async(Z,J,X,Y)=>{J.currentIterable=Z(...X);try{for await(let $ of J.currentIterable)Y.push($)}finally{delete J.currentIterable}}),rU=async function*(Z,J,X){if(X===J.length){yield Z;return}let{transform:Y=XH1}=J[X];for await(let $ of Y(Z))yield*rU($,J,X+1)},kc=async function*(Z){for(let[J,{final:X}]of Object.entries(Z))yield*JH1(X,Number(J),Z)},JH1=async function*(Z,J,X){if(Z===void 0)return;for await(let Y of Z())yield*rU(Y,X,J+1)},Ec=Tc(async({currentIterable:Z},J)=>{if(Z!==void 0){await(J?Z.throw(J):Z.return());return}if(J)throw J}),XH1=function*(Z){yield Z};var aD=(Z,J,X,Y)=>{try{for(let $ of Z(...J))X.push($);Y()}catch($){Y($)}},Ic=(Z,J)=>[...J.flatMap((X)=>[...RY(X,Z,0)]),...UG(Z)],RY=function*(Z,J,X){if(X===J.length){yield Z;return}let{transform:Y=$H1}=J[X];for(let $ of Y(Z))yield*RY($,J,X+1)},UG=function*(Z){for(let[J,{final:X}]of Object.entries(Z))yield*YH1(X,Number(J),Z)},YH1=function*(Z,J,X){if(Z===void 0)return;for(let Y of Z())yield*RY(Y,X,J+1)},$H1=function*(Z){yield Z};var sD=({value:Z,value:{transform:J,final:X,writableObjectMode:Y,readableObjectMode:$},optionName:Q},{encoding:W})=>{let K={},G=Sc(Z,W,Q),z=MY(J),H=MY(X),V=z?nD.bind(void 0,rU,K):aD.bind(void 0,RY),q=z||H?nD.bind(void 0,kc,K):aD.bind(void 0,UG),F=z||H?Ec.bind(void 0,K):void 0;return{stream:new QH1({writableObjectMode:Y,writableHighWaterMark:vc(Y),readableObjectMode:$,readableHighWaterMark:vc($),transform(B,w,O){V([B,G,0],this,O)},flush(B){q([G],this,B)},destroy:F})}},tU=(Z,J,X,Y)=>{let $=J.filter(({type:W})=>W==="generator"),Q=Y?$.reverse():$;for(let{value:W,optionName:K}of Q){let G=Sc(W,X,K);Z=Ic(G,Z)}return Z},Sc=({transform:Z,final:J,binary:X,writableObjectMode:Y,readableObjectMode:$,preserveNewlines:Q},W,K)=>{let G={};return[{transform:Dc(Y,K)},oU(X,W,Y),sU(X,Q,Y,G),{transform:Z,final:J},{transform:Pc($,K)},Nc({binary:X,preserveNewlines:Q,readableObjectMode:$,state:G})].filter(Boolean)};var _c=(Z,J)=>{for(let X of WH1(Z))KH1(Z,X,J)},WH1=(Z)=>new Set(Object.entries(Z).filter(([,{direction:J}])=>J==="input").map(([J])=>Number(J))),KH1=(Z,J,X)=>{let{stdioItems:Y}=Z[J],$=Y.filter(({contents:K})=>K!==void 0);if($.length===0)return;if(J!==0){let[{type:K,optionName:G}]=$;throw new TypeError(`Only the \`stdin\` option, not \`${G}\`, can be ${DJ[K]} with synchronous methods.`)}let W=$.map(({contents:K})=>K).map((K)=>GH1(K,Y));X.input=WG(W)},GH1=(Z,J)=>{let X=tU(Z,J,"utf8",!0);return zH1(X),WG(X)},zH1=(Z)=>{let J=Z.find((X)=>typeof X!=="string"&&!p8(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 FH1,appendFileSync as UH1}from"fs";var eU=({stdioItems:Z,encoding:J,verboseInfo:X,fdNumber:Y})=>Y!=="all"&&pQ(X,Y)&&!o5.has(J)&&HH1(Y)&&(Z.some(({type:$,value:Q})=>$==="native"&&VH1.has(Q))||Z.every(({type:$})=>T9.has($))),HH1=(Z)=>Z===1||Z===2,VH1=new Set(["pipe","overlapped"]),xc=async(Z,J,X,Y)=>{for await(let $ of Z)if(!qH1(J))hc($,X,Y)},Ac=(Z,J,X)=>{for(let Y of Z)hc(Y,J,X)},qH1=(Z)=>Z._readableState.pipes.length>0,hc=(Z,J,X)=>{let Y=HU(Z);z7({type:"output",verboseMessage:Y,fdNumber:J,verboseInfo:X})};var fc=({fileDescriptors:Z,syncResult:{output:J},options:X,isMaxBuffer:Y,verboseInfo:$})=>{if(J===null)return{output:Array.from({length:3})};let Q={},W=new Set([]);return{output:J.map((G,z)=>wH1({result:G,fileDescriptors:Z,fdNumber:z,state:Q,outputFiles:W,isMaxBuffer:Y,verboseInfo:$},X)),...Q}},wH1=({result:Z,fileDescriptors:J,fdNumber:X,state:Y,outputFiles:$,isMaxBuffer:Q,verboseInfo:W},{buffer:K,encoding:G,lines:z,stripFinalNewline:H,maxBuffer:V})=>{if(Z===null)return;let q=bd(Z,Q,V),F=UZ(q),{stdioItems:U,objectMode:B}=J[X],w=BH1([F],U,G,Y),{serializedResult:O,finalResult:N=O}=LH1({chunks:w,objectMode:B,encoding:G,lines:z,stripFinalNewline:H,fdNumber:X});OH1({serializedResult:O,fdNumber:X,state:Y,verboseInfo:W,encoding:G,stdioItems:U,objectMode:B});let R=K[X]?N:void 0;try{if(Y.error===void 0)jH1(O,U,$);return R}catch(j){return Y.error=j,R}},BH1=(Z,J,X,Y)=>{try{return tU(Z,J,X,!1)}catch($){return Y.error=$,Z}},LH1=({chunks:Z,objectMode:J,encoding:X,lines:Y,stripFinalNewline:$,fdNumber:Q})=>{if(J)return{serializedResult:Z};if(X==="buffer")return{serializedResult:WG(Z)};let W=rg(Z,X);if(Y[Q])return{serializedResult:W,finalResult:iD(W,!$[Q],J)};return{serializedResult:W}},OH1=({serializedResult:Z,fdNumber:J,state:X,verboseInfo:Y,encoding:$,stdioItems:Q,objectMode:W})=>{if(!eU({stdioItems:Q,encoding:$,verboseInfo:Y,fdNumber:J}))return;let K=iD(Z,!1,W);try{Ac(K,J,Y)}catch(G){X.error??=G}},jH1=(Z,J,X)=>{for(let{path:Y,append:$}of J.filter(({type:Q})=>nU.has(Q))){let Q=typeof Y==="string"?Y:Y.toString();if($||X.has(Q))UH1(Y,Z);else X.add(Q),FH1(Y,Z)}};var bc=([,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,OZ(J,X,"all")];if(Array.isArray(J))return[OZ(Z,X,"all"),...J];if(p8(Z)&&p8(J))return JD([Z,J]);return`${Z}${J}`};import{once as oD}from"events";var yc=async(Z,J)=>{let[X,Y]=await MH1(Z);return J.isForcefullyTerminated??=!1,[X,Y]},MH1=async(Z)=>{let[J,X]=await Promise.allSettled([oD(Z,"spawn"),oD(Z,"exit")]);if(J.status==="rejected")return[];return X.status==="rejected"?gc(Z):X.value},gc=async(Z)=>{try{return await oD(Z,"exit")}catch{return gc(Z)}},mc=async(Z)=>{let[J,X]=await Z;if(!RH1(J,X)&&rD(J,X))throw new H7;return[J,X]},RH1=(Z,J)=>Z===void 0&&J===void 0,rD=(Z,J)=>Z!==0||J!==null;var uc=({error:Z,status:J,signal:X,output:Y},{maxBuffer:$})=>{let Q=NH1(Z,J,X),W=Q?.code==="ETIMEDOUT",K=fd(Q,Y,$);return{resultError:Q,exitCode:J,signal:X,timedOut:W,isMaxBuffer:K}},NH1=(Z,J,X)=>{if(Z!==void 0)return Z;return rD(J,X)?new H7:void 0};var dc=(Z,J,X)=>{let{file:Y,commandArguments:$,command:Q,escapedCommand:W,startTime:K,verboseInfo:G,options:z,fileDescriptors:H}=PH1(Z,J,X),V=kH1({file:Y,commandArguments:$,options:z,command:Q,escapedCommand:W,verboseInfo:G,fileDescriptors:H,startTime:K});return ZW(V,G,z)},PH1=(Z,J,X)=>{let{command:Y,escapedCommand:$,startTime:Q,verboseInfo:W}=qU(Z,J,X),K=CH1(X),{file:G,commandArguments:z,options:H}=hU(Z,J,K);TH1(H);let V=Oc(H,W);return{file:G,commandArguments:z,command:Y,escapedCommand:$,startTime:Q,verboseInfo:W,options:H,fileDescriptors:V}},CH1=(Z)=>Z.node&&!Z.ipc?{...Z,ipc:!1}:Z,TH1=({ipc:Z,ipcInput:J,detached:X,cancelSignal:Y})=>{if(J)Z2("ipcInput");if(Z)Z2("ipc: true");if(X)Z2("detached: true");if(Y)Z2("cancelSignal")},Z2=(Z)=>{throw new TypeError(`The "${Z}" option cannot be used with synchronous methods.`)},kH1=({file:Z,commandArguments:J,options:X,command:Y,escapedCommand:$,verboseInfo:Q,fileDescriptors:W,startTime:K})=>{let G=EH1({file:Z,commandArguments:J,options:X,command:Y,escapedCommand:$,fileDescriptors:W,startTime:K});if(G.failed)return G;let{resultError:z,exitCode:H,signal:V,timedOut:q,isMaxBuffer:F}=uc(G,X),{output:U,error:B=z}=fc({fileDescriptors:W,syncResult:G,options:X,isMaxBuffer:F,verboseInfo:Q}),w=U.map((N,R)=>OZ(N,X,R)),O=OZ(bc(U,X),X,"all");return vH1({error:B,exitCode:H,signal:V,timedOut:q,isMaxBuffer:F,stdio:w,all:O,options:X,command:Y,escapedCommand:$,startTime:K})},EH1=({file:Z,commandArguments:J,options:X,command:Y,escapedCommand:$,fileDescriptors:Q,startTime:W})=>{try{_c(Q,X);let K=IH1(X);return DH1(Z,J,K)}catch(K){return eQ({error:K,command:Y,escapedCommand:$,fileDescriptors:Q,options:X,startTime:W,isSync:!0})}},IH1=({encoding:Z,maxBuffer:J,...X})=>({...X,encoding:"buffer",maxBuffer:cU(J)}),vH1=({error:Z,exitCode:J,signal:X,timedOut:Y,isMaxBuffer:$,stdio:Q,all:W,options:K,command:G,escapedCommand:z,startTime:H})=>Z===void 0?lU({command:G,escapedCommand:z,stdio:Q,all:W,ipcOutput:[],options:K,startTime:H}):FG({error:Z,command:G,escapedCommand:z,timedOut:Y,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:$,isForcefullyTerminated:!1,exitCode:J,signal:X,stdio:Q,all:W,ipcOutput:[],options:K,startTime:H,isSync:!0});import{setMaxListeners as Lq1}from"events";import{spawn as Oq1}from"child_process";import nc from"process";import{once as tD,on as SH1}from"events";var cc=({anyProcess:Z,channel:J,isSubprocess:X,ipc:Y},{reference:$=!0,filter:Q}={})=>{return aQ({methodName:"getOneMessage",isSubprocess:X,ipc:Y,isConnected:IU(Z)}),_H1({anyProcess:Z,channel:J,isSubprocess:X,filter:Q,reference:$})},_H1=async({anyProcess:Z,channel:J,isSubprocess:X,filter:Y,reference:$})=>{CU(J,$);let Q=NJ(Z,J,X),W=new AbortController;try{return await Promise.race([xH1(Q,Y,W),AH1(Q,X,W),hH1(Q,X,W)])}catch(K){throw sQ(Z),K}finally{W.abort(),TU(J,$)}},xH1=async(Z,J,{signal:X})=>{if(J===void 0){let[Y]=await tD(Z,"message",{signal:X});return Y}for await(let[Y]of SH1(Z,"message",{signal:X}))if(J(Y))return Y},AH1=async(Z,J,{signal:X})=>{await tD(Z,"disconnect",{signal:X}),Eu(J)},hH1=async(Z,J,{signal:X})=>{let[Y]=await tD(Z,"strict:error",{signal:X});throw NU(Y,J)};import{once as pc,on as fH1}from"events";var ic=({anyProcess:Z,channel:J,isSubprocess:X,ipc:Y},{reference:$=!0}={})=>eD({anyProcess:Z,channel:J,isSubprocess:X,ipc:Y,shouldAwait:!X,reference:$}),eD=({anyProcess:Z,channel:J,isSubprocess:X,ipc:Y,shouldAwait:$,reference:Q})=>{aQ({methodName:"getEachMessage",isSubprocess:X,ipc:Y,isConnected:IU(Z)}),CU(J,Q);let W=NJ(Z,J,X),K=new AbortController,G={};return bH1(Z,W,K),yH1({ipcEmitter:W,isSubprocess:X,controller:K,state:G}),gH1({anyProcess:Z,channel:J,ipcEmitter:W,isSubprocess:X,shouldAwait:$,controller:K,state:G,reference:Q})},bH1=async(Z,J,X)=>{try{await pc(J,"disconnect",{signal:X.signal}),X.abort()}catch{}},yH1=async({ipcEmitter:Z,isSubprocess:J,controller:X,state:Y})=>{try{let[$]=await pc(Z,"strict:error",{signal:X.signal});Y.error=NU($,J),X.abort()}catch{}},gH1=async function*({anyProcess:Z,channel:J,ipcEmitter:X,isSubprocess:Y,shouldAwait:$,controller:Q,state:W,reference:K}){try{for await(let[G]of fH1(X,"message",{signal:Q.signal}))lc(W),yield G}catch{lc(W)}finally{if(Q.abort(),TU(J,K),!Y)sQ(Z);if($)await Z}},lc=({error:Z})=>{if(Z)throw Z};var ac=(Z,{ipc:J})=>{Object.assign(Z,oc(Z,!1,J))},sc=()=>{let Z=nc,J=!0,X=nc.channel!==void 0;return{...oc(Z,!0,X),getCancelSignal:Jd.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:!0,ipc:X})}},oc=(Z,J,X)=>({sendMessage:xU.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:X}),getOneMessage:cc.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:X}),getEachMessage:ic.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:X})});import{ChildProcess as mH1}from"child_process";import{PassThrough as uH1,Readable as dH1,Writable as cH1,Duplex as lH1}from"stream";var rc=({error:Z,command:J,escapedCommand:X,fileDescriptors:Y,options:$,startTime:Q,verboseInfo:W})=>{cD(Y);let K=new mH1;pH1(K,Y),Object.assign(K,{readable:iH1,writable:nH1,duplex:aH1});let G=eQ({error:Z,command:J,escapedCommand:X,fileDescriptors:Y,options:$,startTime:Q,isSync:!1}),z=sH1(G,W,$);return{subprocess:K,promise:z}},pH1=(Z,J)=>{let X=wG(),Y=wG(),$=wG(),Q=Array.from({length:J.length-3},wG),W=wG(),K=[X,Y,$,...Q];Object.assign(Z,{stdin:X,stdout:Y,stderr:$,all:W,stdio:K})},wG=()=>{let Z=new uH1;return Z.end(),Z},iH1=()=>new dH1({read(){}}),nH1=()=>new cH1({write(){}}),aH1=()=>new lH1({read(){},write(){}}),sH1=async(Z,J,X)=>ZW(Z,J,X);import{createReadStream as tc,createWriteStream as ec}from"fs";import{Buffer as oH1}from"buffer";import{Readable as BG,Writable as rH1,Duplex as tH1}from"stream";var Jl=(Z,J)=>aU(eH1,Z,J,!1),LG=({type:Z,optionName:J})=>{throw new TypeError(`The \`${J}\` option cannot be ${DJ[Z]}.`)},Zl={fileNumber:LG,generator:sD,asyncGenerator:sD,nodeStream:({value:Z})=>({stream:Z}),webTransform({value:{transform:Z,writableObjectMode:J,readableObjectMode:X}}){let Y=J||X;return{stream:tH1.fromWeb(Z,{objectMode:Y})}},duplex:({value:{transform:Z}})=>({stream:Z}),native(){}},eH1={input:{...Zl,fileUrl:({value:Z})=>({stream:tc(Z)}),filePath:({value:{file:Z}})=>({stream:tc(Z)}),webStream:({value:Z})=>({stream:BG.fromWeb(Z)}),iterable:({value:Z})=>({stream:BG.from(Z)}),asyncIterable:({value:Z})=>({stream:BG.from(Z)}),string:({value:Z})=>({stream:BG.from(Z)}),uint8Array:({value:Z})=>({stream:BG.from(oH1.from(Z))})},output:{...Zl,fileUrl:({value:Z})=>({stream:ec(Z)}),filePath:({value:{file:Z,append:J}})=>({stream:ec(Z,J?{flags:"a"}:{})}),webStream:({value:Z})=>({stream:rH1.fromWeb(Z)}),iterable:LG,asyncIterable:LG,string:LG,uint8Array:LG}};import{on as ZV1,once as Xl}from"events";import{PassThrough as JV1,getDefaultHighWaterMark as XV1}from"stream";import{finished as Ql}from"stream/promises";function NY(Z){if(!Array.isArray(Z))throw new TypeError(`Expected an array, got \`${typeof Z}\`.`);for(let $ of Z)ZP($);let J=Z.some(({readableObjectMode:$})=>$),X=YV1(Z,J),Y=new Wl({objectMode:J,writableHighWaterMark:X,readableHighWaterMark:X});for(let $ of Z)Y.add($);return Y}var YV1=(Z,J)=>{if(Z.length===0)return XV1(J);let X=Z.filter(({readableObjectMode:Y})=>Y===J).map(({readableHighWaterMark:Y})=>Y);return Math.max(...X)};class Wl extends JV1{#Z=new Set([]);#J=new Set([]);#Y=new Set([]);#X;#$=Symbol("unpipe");#H=new WeakMap;add(Z){if(ZP(Z),this.#Z.has(Z))return;this.#Z.add(Z),this.#X??=$V1(this,this.#Z,this.#$);let J=KV1({passThroughStream:this,stream:Z,streams:this.#Z,ended:this.#J,aborted:this.#Y,onFinished:this.#X,unpipeEvent:this.#$});this.#H.set(Z,J),Z.pipe(this,{end:!1})}async remove(Z){if(ZP(Z),!this.#Z.has(Z))return!1;let J=this.#H.get(Z);if(J===void 0)return!1;return this.#H.delete(Z),Z.unpipe(this),await J,!0}}var $V1=async(Z,J,X)=>{J2(Z,Yl);let Y=new AbortController;try{await Promise.race([QV1(Z,Y),WV1(Z,J,X,Y)])}finally{Y.abort(),J2(Z,-Yl)}},QV1=async(Z,{signal:J})=>{try{await Ql(Z,{signal:J,cleanup:!0})}catch(X){throw Kl(Z,X),X}},WV1=async(Z,J,X,{signal:Y})=>{for await(let[$]of ZV1(Z,"unpipe",{signal:Y}))if(J.has($))$.emit(X)},ZP=(Z)=>{if(typeof Z?.pipe!=="function")throw new TypeError(`Expected a readable stream, got: \`${typeof Z}\`.`)},KV1=async({passThroughStream:Z,stream:J,streams:X,ended:Y,aborted:$,onFinished:Q,unpipeEvent:W})=>{J2(Z,$l);let K=new AbortController;try{await Promise.race([GV1(Q,J,K),zV1({passThroughStream:Z,stream:J,streams:X,ended:Y,aborted:$,controller:K}),HV1({stream:J,streams:X,ended:Y,aborted:$,unpipeEvent:W,controller:K})])}finally{K.abort(),J2(Z,-$l)}if(X.size>0&&X.size===Y.size+$.size)if(Y.size===0&&$.size>0)JP(Z);else VV1(Z)},GV1=async(Z,J,{signal:X})=>{try{if(await Z,!X.aborted)JP(J)}catch(Y){if(!X.aborted)Kl(J,Y)}},zV1=async({passThroughStream:Z,stream:J,streams:X,ended:Y,aborted:$,controller:{signal:Q}})=>{try{if(await Ql(J,{signal:Q,cleanup:!0,readable:!0,writable:!1}),X.has(J))Y.add(J)}catch(W){if(Q.aborted||!X.has(J))return;if(Gl(W))$.add(J);else zl(Z,W)}},HV1=async({stream:Z,streams:J,ended:X,aborted:Y,unpipeEvent:$,controller:{signal:Q}})=>{if(await Xl(Z,$,{signal:Q}),!Z.readable)return Xl(Q,"abort",{signal:Q});J.delete(Z),X.delete(Z),Y.delete(Z)},VV1=(Z)=>{if(Z.writable)Z.end()},Kl=(Z,J)=>{if(Gl(J))JP(Z);else zl(Z,J)},Gl=(Z)=>Z?.code==="ERR_STREAM_PREMATURE_CLOSE",JP=(Z)=>{if(Z.readable||Z.writable)Z.destroy()},zl=(Z,J)=>{if(!Z.destroyed)Z.once("error",qV1),Z.destroy(J)},qV1=()=>{},J2=(Z,J)=>{let X=Z.getMaxListeners();if(X!==0&&X!==Number.POSITIVE_INFINITY)Z.setMaxListeners(X+J)},Yl=2,$l=1;import{finished as Hl}from"stream/promises";var XW=(Z,J)=>{Z.pipe(J),FV1(Z,J),UV1(Z,J)},FV1=async(Z,J)=>{if(M4(Z)||M4(J))return;try{await Hl(Z,{cleanup:!0,readable:!0,writable:!1})}catch{}XP(J)},XP=(Z)=>{if(Z.writable)Z.end()},UV1=async(Z,J)=>{if(M4(Z)||M4(J))return;try{await Hl(J,{cleanup:!0,readable:!1,writable:!0})}catch{}YP(Z)},YP=(Z)=>{if(Z.readable)Z.destroy()};var Vl=(Z,J,X)=>{let Y=new Map;for(let[$,{stdioItems:Q,direction:W}]of Object.entries(J)){for(let{stream:K}of Q.filter(({type:G})=>T9.has(G)))wV1(Z,K,W,$);for(let{stream:K}of Q.filter(({type:G})=>!T9.has(G)))LV1({subprocess:Z,stream:K,direction:W,fdNumber:$,pipeGroups:Y,controller:X})}for(let[$,Q]of Y.entries()){let W=Q.length===1?Q[0]:NY(Q);XW(W,$)}},wV1=(Z,J,X,Y)=>{if(X==="output")XW(Z.stdio[Y],J);else XW(J,Z.stdio[Y]);let $=BV1[Y];if($!==void 0)Z[$]=J;Z.stdio[Y]=J},BV1=["stdin","stdout","stderr"],LV1=({subprocess:Z,stream:J,direction:X,fdNumber:Y,pipeGroups:$,controller:Q})=>{if(J===void 0)return;OV1(J,Q);let[W,K]=X==="output"?[J,Z.stdio[Y]]:[Z.stdio[Y],J],G=$.get(W)??[];$.set(W,[...G,K])},OV1=(Z,{signal:J})=>{if(M4(Z))OY(Z,jV1,J)},jV1=2;import{addAbortListener as NV1}from"events";var DY=[];DY.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")DY.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")DY.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var X2=(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",$P=Symbol.for("signal-exit emitter"),QP=globalThis,MV1=Object.defineProperty.bind(Object);class ql{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(QP[$P])return QP[$P];MV1(QP,$P,{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 KP{}var RV1=(Z)=>{return{onExit(J,X){return Z.onExit(J,X)},load(){return Z.load()},unload(){return Z.unload()}}};class Fl extends KP{onExit(){return()=>{}}load(){}unload(){}}class Ul extends KP{#Z=WP.platform==="win32"?"SIGINT":"SIGHUP";#J=new ql;#Y;#X;#$;#H={};#q=!1;constructor(Z){super();this.#Y=Z,this.#H={};for(let J of DY)this.#H[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),W=J==="SIGHUP"?this.#Z:J;if(!Q)Z.kill(Z.pid,W)}};this.#$=Z.reallyExit,this.#X=Z.emit}onExit(Z,J){if(!X2(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 DY)try{let J=this.#H[Z];if(J)this.#Y.on(Z,J)}catch(J){}this.#Y.emit=(Z,...J)=>{return this.#G(Z,...J)},this.#Y.reallyExit=(Z)=>{return this.#K(Z)}}unload(){if(!this.#q)return;this.#q=!1,DY.forEach((Z)=>{let J=this.#H[Z];if(!J)throw new Error("Listener not defined for signal: "+Z);try{this.#Y.removeListener(Z,J)}catch(X){}}),this.#Y.emit=this.#X,this.#Y.reallyExit=this.#$,this.#J.count-=1}#K(Z){if(!X2(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"&&X2(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 WP=globalThis.process,{onExit:wl,load:Mz6,unload:Rz6}=RV1(X2(WP)?new Ul(WP):new Fl);var Bl=(Z,{cleanup:J,detached:X},{signal:Y})=>{if(!J||X)return;let $=wl(()=>{Z.kill()});NV1(Y,()=>{$()})};var Ol=({source:Z,sourcePromise:J,boundOptions:X,createNested:Y},...$)=>{let Q=VU(),{destination:W,destinationStream:K,destinationError:G,from:z,unpipeSignal:H}=DV1(X,Y,$),{sourceStream:V,sourceError:q}=CV1(Z,z),{options:F,fileDescriptors:U}=q7.get(Z);return{sourcePromise:J,sourceStream:V,sourceOptions:F,sourceError:q,destination:W,destinationStream:K,destinationError:G,unpipeSignal:H,fileDescriptors:U,startTime:Q}},DV1=(Z,J,X)=>{try{let{destination:Y,pipeOptions:{from:$,to:Q,unpipeSignal:W}={}}=PV1(Z,J,...X),K=PU(Y,Q);return{destination:Y,destinationStream:K,from:$,unpipeSignal:W}}catch(Y){return{destinationError:Y}}},PV1=(Z,J,X,...Y)=>{if(Array.isArray(X))return{destination:J(Ll,Z)(X,...Y),pipeOptions:Z};if(typeof X==="string"||X instanceof URL||eN(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,W]=JU(X,...Y);return{destination:J(Ll)($,Q,W),pipeOptions:W}}if(q7.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}`)},Ll=({options:Z})=>({options:{...Z,stdin:"pipe",piped:!0}}),CV1=(Z,J)=>{try{return{sourceStream:oQ(Z,J)}}catch(X){return{sourceError:X}}};var Ml=({sourceStream:Z,sourceError:J,destinationStream:X,destinationError:Y,fileDescriptors:$,sourceOptions:Q,startTime:W})=>{let K=TV1({sourceStream:Z,sourceError:J,destinationStream:X,destinationError:Y});if(K!==void 0)throw GP({error:K,fileDescriptors:$,sourceOptions:Q,startTime:W})},TV1=({sourceStream:Z,sourceError:J,destinationStream:X,destinationError:Y})=>{if(J!==void 0&&Y!==void 0)return Y;if(Y!==void 0)return YP(Z),Y;if(J!==void 0)return XP(X),J},GP=({error:Z,fileDescriptors:J,sourceOptions:X,startTime:Y})=>eQ({error:Z,command:jl,escapedCommand:jl,fileDescriptors:J,options:X,startTime:Y,isSync:!1}),jl="source.pipe(destination)";var Rl=async(Z)=>{let[{status:J,reason:X,value:Y=X},{status:$,reason:Q,value:W=Q}]=await Z;if(!W.pipedFrom.includes(Y))W.pipedFrom.push(Y);if($==="rejected")throw W;if(J==="rejected")throw Y;return W};import{finished as kV1}from"stream/promises";var Nl=(Z,J,X)=>{let Y=Y2.has(J)?IV1(Z,J):EV1(Z,J);return OY(Z,SV1,X.signal),OY(J,_V1,X.signal),vV1(J),Y},EV1=(Z,J)=>{let X=NY([Z]);return XW(X,J),Y2.set(J,X),X},IV1=(Z,J)=>{let X=Y2.get(J);return X.add(Z),X},vV1=async(Z)=>{try{await kV1(Z,{cleanup:!0,readable:!1,writable:!0})}catch{}Y2.delete(Z)},Y2=new WeakMap,SV1=2,_V1=1;import{aborted as xV1}from"util";var Dl=(Z,J)=>Z===void 0?[]:[AV1(Z,J)],AV1=async(Z,{sourceStream:J,mergedStream:X,fileDescriptors:Y,sourceOptions:$,startTime:Q})=>{await xV1(Z,J),await X.remove(J);let W=new Error("Pipe canceled by `unpipeSignal` option.");throw GP({error:W,fileDescriptors:Y,sourceOptions:$,startTime:Q})};var $2=(Z,...J)=>{if(T8(J[0]))return $2.bind(void 0,{...Z,boundOptions:{...Z.boundOptions,...J[0]}});let{destination:X,...Y}=Ol(Z,...J),$=hV1({...Y,destination:X});return $.pipe=$2.bind(void 0,{...Z,source:X,sourcePromise:$,boundOptions:{}}),$},hV1=async({sourcePromise:Z,sourceStream:J,sourceOptions:X,sourceError:Y,destination:$,destinationStream:Q,destinationError:W,unpipeSignal:K,fileDescriptors:G,startTime:z})=>{let H=fV1(Z,$);Ml({sourceStream:J,sourceError:Y,destinationStream:Q,destinationError:W,fileDescriptors:G,sourceOptions:X,startTime:z});let V=new AbortController;try{let q=Nl(J,Q,V);return await Promise.race([Rl(H),...Dl(K,{sourceStream:J,mergedStream:q,sourceOptions:X,fileDescriptors:G,startTime:z})])}finally{V.abort()}},fV1=(Z,J)=>Promise.allSettled([Z,J]);import{setImmediate as cV1}from"timers/promises";import{on as bV1}from"events";import{getDefaultHighWaterMark as yV1}from"stream";var Q2=({subprocessStdout:Z,subprocess:J,binary:X,shouldEncode:Y,encoding:$,preserveNewlines:Q})=>{let W=new AbortController;return gV1(J,W),Cl({stream:Z,controller:W,binary:X,shouldEncode:!Z.readableObjectMode&&Y,encoding:$,shouldSplit:!Z.readableObjectMode,preserveNewlines:Q})},gV1=async(Z,J)=>{try{await Z}catch{}finally{J.abort()}},zP=({stream:Z,onStreamEnd:J,lines:X,encoding:Y,stripFinalNewline:$,allMixed:Q})=>{let W=new AbortController;mV1(J,W,Z);let K=Z.readableObjectMode&&!Q;return Cl({stream:Z,controller:W,binary:Y==="buffer",shouldEncode:!K,encoding:Y,shouldSplit:!K&&X,preserveNewlines:!$})},mV1=async(Z,J,X)=>{try{await Z}catch{X.destroy()}finally{J.abort()}},Cl=({stream:Z,controller:J,binary:X,shouldEncode:Y,encoding:$,shouldSplit:Q,preserveNewlines:W})=>{let K=bV1(Z,"data",{signal:J.signal,highWaterMark:Pl,highWatermark:Pl});return uV1({onStdoutChunk:K,controller:J,binary:X,shouldEncode:Y,encoding:$,shouldSplit:Q,preserveNewlines:W})},HP=yV1(!0),Pl=HP,uV1=async function*({onStdoutChunk:Z,controller:J,binary:X,shouldEncode:Y,encoding:$,shouldSplit:Q,preserveNewlines:W}){let K=dV1({binary:X,shouldEncode:Y,encoding:$,shouldSplit:Q,preserveNewlines:W});try{for await(let[G]of Z)yield*RY(G,K,0)}catch(G){if(!J.signal.aborted)throw G}finally{yield*UG(K)}},dV1=({binary:Z,shouldEncode:J,encoding:X,shouldSplit:Y,preserveNewlines:$})=>[oU(Z,X,!J),sU(Z,$,!Y,{})].filter(Boolean);var Tl=async({stream:Z,onStreamEnd:J,fdNumber:X,encoding:Y,buffer:$,maxBuffer:Q,lines:W,allMixed:K,stripFinalNewline:G,verboseInfo:z,streamInfo:H})=>{let V=lV1({stream:Z,onStreamEnd:J,fdNumber:X,encoding:Y,allMixed:K,verboseInfo:z,streamInfo:H});if(!$){await Promise.all([pV1(Z),V]);return}let q=lD(G,X),F=zP({stream:Z,onStreamEnd:J,lines:W,encoding:Y,stripFinalNewline:q,allMixed:K}),[U]=await Promise.all([iV1({stream:Z,iterable:F,fdNumber:X,encoding:Y,maxBuffer:Q,lines:W}),V]);return U},lV1=async({stream:Z,onStreamEnd:J,fdNumber:X,encoding:Y,allMixed:$,verboseInfo:Q,streamInfo:{fileDescriptors:W}})=>{if(!eU({stdioItems:W[X]?.stdioItems,encoding:Y,verboseInfo:Q,fdNumber:X}))return;let K=zP({stream:Z,onStreamEnd:J,lines:!0,encoding:Y,stripFinalNewline:!0,allMixed:$});await xc(K,Z,X,Q)},pV1=async(Z)=>{if(await cV1(),Z.readableFlowing===null)Z.resume()},iV1=async({stream:Z,stream:{readableObjectMode:J},iterable:X,fdNumber:Y,encoding:$,maxBuffer:Q,lines:W})=>{try{if(J||W)return await gU(X,{maxBuffer:Q});if($==="buffer")return new Uint8Array(await mU(X,{maxBuffer:Q}));return await dU(X,{maxBuffer:Q})}catch(K){return kl(xd({error:K,stream:Z,readableObjectMode:J,lines:W,encoding:$,fdNumber:Y}))}},VP=async(Z)=>{try{return await Z}catch(J){return kl(J)}},kl=({bufferedData:Z})=>sg(Z)?new Uint8Array(Z):Z;import{finished as nV1}from"stream/promises";var OG=async(Z,J,X,{isSameDirection:Y,stopOnExit:$=!1}={})=>{let Q=aV1(Z,X),W=new AbortController;try{await Promise.race([...$?[X.exitPromise]:[],nV1(Z,{cleanup:!0,signal:W.signal})])}catch(K){if(!Q.stdinCleanedUp)rV1(K,J,X,Y)}finally{W.abort()}},aV1=(Z,{originalStreams:[J],subprocess:X})=>{let Y={stdinCleanedUp:!1};if(Z===J)sV1(Z,X,Y);return Y},sV1=(Z,J,X)=>{let{_destroy:Y}=Z;Z._destroy=(...$)=>{oV1(J,X),Y.call(Z,...$)}},oV1=({exitCode:Z,signalCode:J},X)=>{if(Z!==null||J!==null)X.stdinCleanedUp=!0},rV1=(Z,J,X,Y)=>{if(!tV1(Z,J,X,Y))throw Z},tV1=(Z,J,X,Y=!0)=>{if(X.propagating)return El(Z)||W2(Z);return X.propagating=!0,qP(X,J)===Y?El(Z):W2(Z)},qP=({fileDescriptors:Z},J)=>J!=="all"&&Z[J].direction==="input",W2=(Z)=>Z?.code==="ERR_STREAM_PREMATURE_CLOSE",El=(Z)=>Z?.code==="EPIPE";var Il=({subprocess:Z,encoding:J,buffer:X,maxBuffer:Y,lines:$,stripFinalNewline:Q,verboseInfo:W,streamInfo:K})=>Z.stdio.map((G,z)=>FP({stream:G,fdNumber:z,encoding:J,buffer:X[z],maxBuffer:Y[z],lines:$[z],allMixed:!1,stripFinalNewline:Q,verboseInfo:W,streamInfo:K})),FP=async({stream:Z,fdNumber:J,encoding:X,buffer:Y,maxBuffer:$,lines:Q,allMixed:W,stripFinalNewline:K,verboseInfo:G,streamInfo:z})=>{if(!Z)return;let H=OG(Z,J,z);if(qP(z,J)){await H;return}let[V]=await Promise.all([Tl({stream:Z,onStreamEnd:H,fdNumber:J,encoding:X,buffer:Y,maxBuffer:$,lines:Q,allMixed:W,stripFinalNewline:K,verboseInfo:G,streamInfo:z}),H]);return V};var vl=({stdout:Z,stderr:J},{all:X})=>X&&(Z||J)?NY([Z,J].filter(Boolean)):void 0,Sl=({subprocess:Z,encoding:J,buffer:X,maxBuffer:Y,lines:$,stripFinalNewline:Q,verboseInfo:W,streamInfo:K})=>FP({...eV1(Z,X),fdNumber:"all",encoding:J,maxBuffer:Y[1]+Y[2],lines:$[1]||$[2],allMixed:Zq1(Z),stripFinalNewline:Q,verboseInfo:W,streamInfo:K}),eV1=({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}},Zq1=({all:Z,stdout:J,stderr:X})=>Z&&J&&X&&J.readableObjectMode!==X.readableObjectMode;import{once as Jq1}from"events";var _l=(Z)=>pQ(Z,"ipc"),xl=(Z,J)=>{let X=HU(Z);z7({type:"ipc",verboseMessage:X,fdNumber:"ipc",verboseInfo:J})};var Al=async({subprocess:Z,buffer:J,maxBuffer:X,ipc:Y,ipcOutput:$,verboseInfo:Q})=>{if(!Y)return $;let W=_l(Q),K=wZ(J,"ipc"),G=wZ(X,"ipc");for await(let z of eD({anyProcess:Z,channel:Z.channel,isSubprocess:!1,ipc:Y,shouldAwait:!1,reference:!0})){if(K)Ad(Z,$,G),$.push(z);if(W)xl(z,Q)}return $},hl=async(Z,J)=>{return await Promise.allSettled([Z]),J};var fl=async({subprocess:Z,options:{encoding:J,buffer:X,maxBuffer:Y,lines:$,timeoutDuration:Q,cancelSignal:W,gracefulCancel:K,forceKillAfterDelay:G,stripFinalNewline:z,ipc:H,ipcInput:V},context:q,verboseInfo:F,fileDescriptors:U,originalStreams:B,onInternalError:w,controller:O})=>{let N=yc(Z,q),R={originalStreams:B,fileDescriptors:U,subprocess:Z,exitPromise:N,propagating:!1},j=Il({subprocess:Z,encoding:J,buffer:X,maxBuffer:Y,lines:$,stripFinalNewline:z,verboseInfo:F,streamInfo:R}),P=Sl({subprocess:Z,encoding:J,buffer:X,maxBuffer:Y,lines:$,stripFinalNewline:z,verboseInfo:F,streamInfo:R}),D=[],C=Al({subprocess:Z,buffer:X,maxBuffer:Y,ipc:H,ipcOutput:D,verboseInfo:F}),T=Xq1(B,Z,R),k=Yq1(U,R);try{return await Promise.race([Promise.all([{},mc(N),Promise.all(j),P,C,Vd(Z,V),...T,...k]),w,$q1(Z,O),...Wd(Z,Q,q,O),...ku({subprocess:Z,cancelSignal:W,gracefulCancel:K,context:q,controller:O}),...$d({subprocess:Z,cancelSignal:W,gracefulCancel:K,forceKillAfterDelay:G,context:q,controller:O})])}catch(x){return q.terminationReason??="other",Promise.all([{error:x},N,Promise.all(j.map((S)=>VP(S))),VP(P),hl(C,D),Promise.allSettled(T),Promise.allSettled(k)])}},Xq1=(Z,J,X)=>Z.map((Y,$)=>Y===J.stdio[$]?void 0:OG(Y,$,X)),Yq1=(Z,J)=>Z.flatMap(({stdioItems:X},Y)=>X.filter(({value:$,stream:Q=$})=>N4(Q,{checkOpen:!1})&&!M4(Q)).map(({type:$,value:Q,stream:W=Q})=>OG(W,Y,J,{isSameDirection:T9.has($),stopOnExit:$==="native"}))),$q1=async(Z,{signal:J})=>{let[X]=await Jq1(Z,"error",{signal:J});throw X};var bl=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),jG=(Z,J,X)=>{let Y=Z[X];if(!Y.has(J))Y.set(J,[]);let $=Y.get(J),Q=V7();return $.push(Q),{resolve:Q.resolve.bind(Q),promises:$}},YW=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 Qq1}from"stream";import{callbackify as Wq1}from"util";import{finished as yl}from"stream/promises";var UP=async(Z)=>{if(Z===void 0)return;try{await wP(Z)}catch{}},gl=async(Z)=>{if(Z===void 0)return;try{await BP(Z)}catch{}},wP=async(Z)=>{await yl(Z,{cleanup:!0,readable:!1,writable:!0})},BP=async(Z)=>{await yl(Z,{cleanup:!0,readable:!0,writable:!1})},K2=async(Z,J)=>{if(await Z,J)throw J},G2=(Z,J,X)=>{if(X&&!W2(X))Z.destroy(X);else if(J)Z.destroy()};var ml=({subprocess:Z,concurrentStreams:J,encoding:X},{from:Y,binary:$=!0,preserveNewlines:Q=!0}={})=>{let W=$||o5.has(X),{subprocessStdout:K,waitReadableDestroy:G}=LP(Z,Y,J),{readableEncoding:z,readableObjectMode:H,readableHighWaterMark:V}=OP(K,W),{read:q,onStdoutDataDone:F}=jP({subprocessStdout:K,subprocess:Z,binary:W,encoding:X,preserveNewlines:Q}),U=new Qq1({read:q,destroy:Wq1(RP.bind(void 0,{subprocessStdout:K,subprocess:Z,waitReadableDestroy:G})),highWaterMark:V,objectMode:H,encoding:z});return MP({subprocessStdout:K,onStdoutDataDone:F,readable:U,subprocess:Z}),U},LP=(Z,J,X)=>{let Y=oQ(Z,J),$=jG(X,Y,"readableDestroy");return{subprocessStdout:Y,waitReadableDestroy:$}},OP=({readableEncoding:Z,readableObjectMode:J,readableHighWaterMark:X},Y)=>Y?{readableEncoding:Z,readableObjectMode:J,readableHighWaterMark:X}:{readableEncoding:Z,readableObjectMode:!0,readableHighWaterMark:HP},jP=({subprocessStdout:Z,subprocess:J,binary:X,encoding:Y,preserveNewlines:$})=>{let Q=V7(),W=Q2({subprocessStdout:Z,subprocess:J,binary:X,shouldEncode:!X,encoding:Y,preserveNewlines:$});return{read(){Kq1(this,W,Q)},onStdoutDataDone:Q}},Kq1=async(Z,J,X)=>{try{let{value:Y,done:$}=await J.next();if($)X.resolve();else Z.push(Y)}catch{}},MP=async({subprocessStdout:Z,onStdoutDataDone:J,readable:X,subprocess:Y,subprocessStdin:$})=>{try{if(await BP(Z),await Y,await UP($),await J,X.readable)X.push(null)}catch(Q){await UP($),ul(X,Q)}},RP=async({subprocessStdout:Z,subprocess:J,waitReadableDestroy:X},Y)=>{if(await YW(X,J))ul(Z,Y),await K2(J,Y)},ul=(Z,J)=>{G2(Z,Z.readable,J)};import{Writable as Gq1}from"stream";import{callbackify as dl}from"util";var cl=({subprocess:Z,concurrentStreams:J},{to:X}={})=>{let{subprocessStdin:Y,waitWritableFinal:$,waitWritableDestroy:Q}=NP(Z,X,J),W=new Gq1({...DP(Y,Z,$),destroy:dl(CP.bind(void 0,{subprocessStdin:Y,subprocess:Z,waitWritableFinal:$,waitWritableDestroy:Q})),highWaterMark:Y.writableHighWaterMark,objectMode:Y.writableObjectMode});return PP(Y,W),W},NP=(Z,J,X)=>{let Y=PU(Z,J),$=jG(X,Y,"writableFinal"),Q=jG(X,Y,"writableDestroy");return{subprocessStdin:Y,waitWritableFinal:$,waitWritableDestroy:Q}},DP=(Z,J,X)=>({write:zq1.bind(void 0,Z),final:dl(Hq1.bind(void 0,Z,J,X))}),zq1=(Z,J,X,Y)=>{if(Z.write(J,X))Y();else Z.once("drain",Y)},Hq1=async(Z,J,X)=>{if(await YW(X,J)){if(Z.writable)Z.end();await J}},PP=async(Z,J,X)=>{try{if(await wP(Z),J.writable)J.end()}catch(Y){await gl(X),ll(J,Y)}},CP=async({subprocessStdin:Z,subprocess:J,waitWritableFinal:X,waitWritableDestroy:Y},$)=>{if(await YW(X,J),await YW(Y,J))ll(Z,$),await K2(J,$)},ll=(Z,J)=>{G2(Z,Z.writable,J)};import{Duplex as Vq1}from"stream";import{callbackify as qq1}from"util";var pl=({subprocess:Z,concurrentStreams:J,encoding:X},{from:Y,to:$,binary:Q=!0,preserveNewlines:W=!0}={})=>{let K=Q||o5.has(X),{subprocessStdout:G,waitReadableDestroy:z}=LP(Z,Y,J),{subprocessStdin:H,waitWritableFinal:V,waitWritableDestroy:q}=NP(Z,$,J),{readableEncoding:F,readableObjectMode:U,readableHighWaterMark:B}=OP(G,K),{read:w,onStdoutDataDone:O}=jP({subprocessStdout:G,subprocess:Z,binary:K,encoding:X,preserveNewlines:W}),N=new Vq1({read:w,...DP(H,Z,V),destroy:qq1(Fq1.bind(void 0,{subprocessStdout:G,subprocessStdin:H,subprocess:Z,waitReadableDestroy:z,waitWritableFinal:V,waitWritableDestroy:q})),readableHighWaterMark:B,writableHighWaterMark:H.writableHighWaterMark,readableObjectMode:U,writableObjectMode:H.writableObjectMode,encoding:F});return MP({subprocessStdout:G,onStdoutDataDone:O,readable:N,subprocess:Z,subprocessStdin:H}),PP(H,N,G),N},Fq1=async({subprocessStdout:Z,subprocessStdin:J,subprocess:X,waitReadableDestroy:Y,waitWritableFinal:$,waitWritableDestroy:Q},W)=>{await Promise.all([RP({subprocessStdout:Z,subprocess:X,waitReadableDestroy:Y},W),CP({subprocessStdin:J,subprocess:X,waitWritableFinal:$,waitWritableDestroy:Q},W)])};var TP=(Z,J,{from:X,binary:Y=!1,preserveNewlines:$=!1}={})=>{let Q=Y||o5.has(J),W=oQ(Z,X),K=Q2({subprocessStdout:W,subprocess:Z,binary:Q,shouldEncode:!0,encoding:J,preserveNewlines:$});return Uq1(K,W,Z)},Uq1=async function*(Z,J,X){try{yield*Z}finally{if(J.readable)J.destroy();await X}};var il=(Z,{encoding:J})=>{let X=bl();Z.readable=ml.bind(void 0,{subprocess:Z,concurrentStreams:X,encoding:J}),Z.writable=cl.bind(void 0,{subprocess:Z,concurrentStreams:X}),Z.duplex=pl.bind(void 0,{subprocess:Z,concurrentStreams:X,encoding:J}),Z.iterable=TP.bind(void 0,Z,J),Z[Symbol.asyncIterator]=TP.bind(void 0,Z,J,{})};var nl=(Z,J)=>{for(let[X,Y]of Bq1){let $=Y.value.bind(J);Reflect.defineProperty(Z,X,{...Y,value:$})}},wq1=(async()=>{})().constructor.prototype,Bq1=["then","catch","finally"].map((Z)=>[Z,Reflect.getOwnPropertyDescriptor(wq1,Z)]);var al=(Z,J,X,Y)=>{let{file:$,commandArguments:Q,command:W,escapedCommand:K,startTime:G,verboseInfo:z,options:H,fileDescriptors:V}=jq1(Z,J,X),{subprocess:q,promise:F}=Rq1({file:$,commandArguments:Q,options:H,startTime:G,verboseInfo:z,command:W,escapedCommand:K,fileDescriptors:V});return q.pipe=$2.bind(void 0,{source:q,sourcePromise:F,boundOptions:{},createNested:Y}),nl(q,F),q7.set(q,{options:H,fileDescriptors:V}),q},jq1=(Z,J,X)=>{let{command:Y,escapedCommand:$,startTime:Q,verboseInfo:W}=qU(Z,J,X),{file:K,commandArguments:G,options:z}=hU(Z,J,X),H=Mq1(z),V=Jl(H,W);return{file:K,commandArguments:G,command:Y,escapedCommand:$,startTime:Q,verboseInfo:W,options:H,fileDescriptors:V}},Mq1=({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}},Rq1=({file:Z,commandArguments:J,options:X,startTime:Y,verboseInfo:$,command:Q,escapedCommand:W,fileDescriptors:K})=>{let G;try{G=Oq1(Z,J,X)}catch(U){return rc({error:U,command:Q,escapedCommand:W,fileDescriptors:K,options:X,startTime:Y,verboseInfo:$})}let z=new AbortController;Lq1(Number.POSITIVE_INFINITY,z.signal);let H=[...G.stdio];Vl(G,K,z),Bl(G,X,z);let V={},q=V7();G.kill=Cu.bind(void 0,{kill:G.kill.bind(G),options:X,onInternalError:q,context:V,controller:z}),G.all=vl(G,X),il(G,X),ac(G,X);let F=Nq1({subprocess:G,options:X,startTime:Y,verboseInfo:$,fileDescriptors:K,originalStreams:H,command:Q,escapedCommand:W,context:V,onInternalError:q,controller:z});return{subprocess:G,promise:F}},Nq1=async({subprocess:Z,options:J,startTime:X,verboseInfo:Y,fileDescriptors:$,originalStreams:Q,command:W,escapedCommand:K,context:G,onInternalError:z,controller:H})=>{let[V,[q,F],U,B,w]=await fl({subprocess:Z,options:J,context:G,verboseInfo:Y,fileDescriptors:$,originalStreams:Q,onInternalError:z,controller:H});H.abort(),z.resolve();let O=U.map((j,P)=>OZ(j,J,P)),N=OZ(B,J,"all"),R=Dq1({errorInfo:V,exitCode:q,signal:F,stdio:O,all:N,ipcOutput:w,context:G,options:J,command:W,escapedCommand:K,startTime:X});return ZW(R,Y,J)},Dq1=({errorInfo:Z,exitCode:J,signal:X,stdio:Y,all:$,ipcOutput:Q,context:W,options:K,command:G,escapedCommand:z,startTime:H})=>("error"in Z)?FG({error:Z.error,command:G,escapedCommand:z,timedOut:W.terminationReason==="timeout",isCanceled:W.terminationReason==="cancel"||W.terminationReason==="gracefulCancel",isGracefullyCanceled:W.terminationReason==="gracefulCancel",isMaxBuffer:Z.error instanceof BZ,isForcefullyTerminated:W.isForcefullyTerminated,exitCode:J,signal:X,stdio:Y,all:$,ipcOutput:Q,options:K,startTime:H,isSync:!1}):lU({command:G,escapedCommand:z,stdio:Y,all:$,ipcOutput:Q,options:K,startTime:H});var z2=(Z,J)=>{let X=Object.fromEntries(Object.entries(J).map(([Y,$])=>[Y,Pq1(Y,Z[Y],$)]));return{...Z,...X}},Pq1=(Z,J,X)=>{if(Cq1.has(Z)&&T8(J)&&T8(X))return{...J,...X};return X},Cq1=new Set(["env",...QD]);var PJ=(Z,J,X,Y)=>{let $=(W,K,G)=>PJ(W,K,X,G),Q=(...W)=>Tq1({mapArguments:Z,deepOptions:X,boundOptions:J,setBoundExeca:Y,createNested:$},...W);if(Y!==void 0)Y(Q,$,J);return Q},Tq1=({mapArguments:Z,deepOptions:J={},boundOptions:X={},setBoundExeca:Y,createNested:$},Q,...W)=>{if(T8(Q))return $(Z,z2(X,Q),Y);let{file:K,commandArguments:G,options:z,isSync:H}=kq1({mapArguments:Z,firstArgument:Q,nextArguments:W,deepOptions:J,boundOptions:X});return H?dc(K,G,z):al(K,G,z,$)},kq1=({mapArguments:Z,firstArgument:J,nextArguments:X,deepOptions:Y,boundOptions:$})=>{let Q=Jm(J)?Xm(J,X):[J,...X],[W,K,G]=JU(...Q),z=z2(z2(Y,$),G),{file:H=W,commandArguments:V=K,options:q=z,isSync:F=!1}=Z({file:W,commandArguments:K,options:z});return{file:H,commandArguments:V,options:q,isSync:F}};var sl=({file:Z,commandArguments:J})=>rl(Z,J),ol=({file:Z,commandArguments:J})=>({...rl(Z,J),isSync:!0}),rl=(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]=Eq1(Z);return{file:X,commandArguments:Y}},Eq1=(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(Iq1)){let $=X.at(-1);if($&&$.endsWith("\\"))X[X.length-1]=`${$.slice(0,-1)} ${Y}`;else X.push(Y)}return X},Iq1=/ +/g;var tl=(Z,J,X)=>{Z.sync=J(vq1,X),Z.s=Z.sync},el=({options:Z})=>Zp(Z),vq1=({options:Z})=>({...Zp(Z),isSync:!0}),Zp=(Z)=>({options:{...Sq1(Z),...Z}}),Sq1=({input:Z,inputFile:J,stdio:X})=>Z===void 0&&J===void 0&&X===void 0?{stdin:"inherit"}:{},Jp={preferLocal:!0};var Xp=PJ(()=>({})),zq6=PJ(()=>({isSync:!0})),Hq6=PJ(sl),Vq6=PJ(ol),qq6=PJ(Gd),Fq6=PJ(el,{},Jp,tl),{sendMessage:Uq6,getOneMessage:wq6,getEachMessage:Bq6,getCancelSignal:Lq6}=sc();var Np=e(Up(),1);var RG=(Z)=>{if(typeof Z!=="string")throw new TypeError("invalid pattern");if(Z.length>65536)throw new TypeError("pattern is too long")};var gq1={"[: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]},NG=(Z)=>Z.replace(/[[\]\\-]/g,"\\$&"),mq1=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),wp=(Z)=>Z.join(""),Bp=(Z,J)=>{let X=J;if(Z.charAt(X)!=="[")throw new Error("not in a brace expression");let Y=[],$=[],Q=X+1,W=!1,K=!1,G=!1,z=!1,H=X,V="";Z:while(Q<Z.length){let B=Z.charAt(Q);if((B==="!"||B==="^")&&Q===X+1){z=!0,Q++;continue}if(B==="]"&&W&&!G){H=Q+1;break}if(W=!0,B==="\\"){if(!G){G=!0,Q++;continue}}if(B==="["&&!G){for(let[w,[O,N,R]]of Object.entries(gq1))if(Z.startsWith(w,Q)){if(V)return["$.",!1,Z.length-X,!0];if(Q+=w.length,R)$.push(O);else Y.push(O);K=K||N;continue Z}}if(G=!1,V){if(B>V)Y.push(NG(V)+"-"+NG(B));else if(B===V)Y.push(NG(B));V="",Q++;continue}if(Z.startsWith("-]",Q+1)){Y.push(NG(B+"-")),Q+=2;continue}if(Z.startsWith("-",Q+1)){V=B,Q+=2;continue}Y.push(NG(B)),Q++}if(H<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 B=Y[0].length===2?Y[0].slice(-1):Y[0];return[mq1(B),!1,H-X,!1]}let q="["+(z?"^":"")+wp(Y)+"]",F="["+(z?"":"^")+wp($)+"]";return[Y.length&&$.length?"("+q+"|"+F+")":Y.length?q:F,K,H-X,!0]};var D4=(Z,{windowsPathsNoEscape:J=!1}={})=>{return J?Z.replace(/\[([^\/\\])\]/g,"$1"):Z.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var uq1=new Set(["!","?","+","*","@"]),Lp=(Z)=>uq1.has(Z),dq1="(?!(?:^|/)\\.\\.?(?:$|/))",H2="(?!\\.)",cq1=new Set(["[","."]),lq1=new Set(["..","."]),pq1=new Set("().*{}+?[]^$\\!"),iq1=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),vP="[^/]",Op=vP+"*?",jp=vP+"+?";class B6{type;#Z;#J;#Y=!1;#X=[];#$;#H;#q;#K=!1;#G;#z;#V=!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.#K)this.#q.push(this);this.#H=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.#K)return this;this.toString(),this.#K=!0;let Z;while(Z=this.#q.pop()){if(Z.type!=="!")continue;let J=Z,X=J.#$;while(X){for(let Y=J.#H+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 B6&&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.#K&&this.#$?.type==="!"))Z.push({});return Z}isStart(){if(this.#Z===this)return!0;if(!this.#$?.isStart())return!1;if(this.#H===0)return!0;let Z=this.#$;for(let J=0;J<this.#H;J++){let X=Z.#X[J];if(!(X instanceof B6&&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.#H===Z-1}copyIn(Z){if(typeof Z==="string")this.push(Z);else this.push(Z.clone(this))}clone(Z){let J=new B6(this.type,Z);for(let X of this.#X)J.copyIn(X);return J}static#U(Z,J,X,Y){let $=!1,Q=!1,W=-1,K=!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===W+1){if(U==="^"||U==="!")K=!0}else if(U==="]"&&!(q===W+2&&K))Q=!1;F+=U;continue}else if(U==="["){Q=!0,W=q,K=!1,F+=U;continue}if(!Y.noext&&Lp(U)&&Z.charAt(q)==="("){J.push(F),F="";let B=new B6(U,J);q=B6.#U(Z,B,q,Y),J.push(B);continue}F+=U}return J.push(F),q}let G=X+1,z=new B6(null,J),H=[],V="";while(G<Z.length){let q=Z.charAt(G++);if($||q==="\\"){$=!$,V+=q;continue}if(Q){if(G===W+1){if(q==="^"||q==="!")K=!0}else if(q==="]"&&!(G===W+2&&K))Q=!1;V+=q;continue}else if(q==="["){Q=!0,W=G,K=!1,V+=q;continue}if(Lp(q)&&Z.charAt(G)==="("){z.push(V),V="";let F=new B6(q,z);z.push(F),G=B6.#U(Z,F,G,Y);continue}if(q==="|"){z.push(V),V="",H.push(z),z=new B6(null,J);continue}if(q===")"){if(V===""&&J.#X.length===0)J.#V=!0;return z.push(V),V="",J.push(...H,z),G}V+=q}return J.type=null,J.#J=void 0,J.#X=[Z.substring(X-1)],G}static fromGlob(Z,J={}){let X=new B6(null,void 0,J);return B6.#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 W=(this.#G.nocase?"i":"")+($?"u":"");return Object.assign(new RegExp(`^${J}$`,W),{_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 K=this.isStart()&&this.isEnd(),G=this.#X.map((q)=>{let[F,U,B,w]=typeof q==="string"?B6.#w(q,this.#J,K):q.toRegExpSource(Z);return this.#J=this.#J||B,this.#Y=this.#Y||w,F}).join(""),z="";if(this.isStart()){if(typeof this.#X[0]==="string"){if(!(this.#X.length===1&&lq1.has(this.#X[0]))){let F=cq1,U=J&&F.has(G.charAt(0))||G.startsWith("\\.")&&F.has(G.charAt(2))||G.startsWith("\\.\\.")&&F.has(G.charAt(4)),B=!J&&!Z&&F.has(G.charAt(0));z=U?dq1:B?H2:""}}}let H="";if(this.isEnd()&&this.#Z.#K&&this.#$?.type==="!")H="(?:$|\\/)";return[z+G+H,D4(G),this.#J=!!this.#J,this.#Y]}let X=this.type==="*"||this.type==="+",Y=this.type==="!"?"(?:(?!(?:":"(?:",$=this.#B(J);if(this.isStart()&&this.isEnd()&&!$&&this.type!=="!"){let K=this.toString();return this.#X=[K],this.type=null,this.#J=void 0,[K,D4(this.toString()),!1,!1]}let Q=!X||Z||J||!H2?"":this.#B(!0);if(Q===$)Q="";if(Q)$=`(?:${$})(?:${Q})*?`;let W="";if(this.type==="!"&&this.#V)W=(this.isStart()&&!J?H2:"")+jp;else{let K=this.type==="!"?"))"+(this.isStart()&&!J&&!Z?H2:"")+Op+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&Q?")":this.type==="*"&&Q?")?":`)${this.type}`;W=Y+$+K}return[W,D4($),this.#J=!!this.#J,this.#Y]}#B(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#w(Z,J,X=!1){let Y=!1,$="",Q=!1;for(let W=0;W<Z.length;W++){let K=Z.charAt(W);if(Y){Y=!1,$+=(pq1.has(K)?"\\":"")+K;continue}if(K==="\\"){if(W===Z.length-1)$+="\\\\";else Y=!0;continue}if(K==="["){let[G,z,H,V]=Bp(Z,W);if(H){$+=G,Q=Q||z,W+=H-1,J=J||V;continue}}if(K==="*"){if(X&&Z==="*")$+=jp;else $+=Op;J=!0;continue}if(K==="?"){$+=vP,J=!0;continue}$+=iq1(K)}return[$,D4(Z),!!J,Q]}}var $W=(Z,{windowsPathsNoEscape:J=!1}={})=>{return J?Z.replace(/[?*()[\]]/g,"[$&]"):Z.replace(/[?*()[\]\\]/g,"\\$&")};var p6=(Z,J,X={})=>{if(RG(J),!X.nocomment&&J.charAt(0)==="#")return!1;return new E9(J,X).match(Z)},nq1=/^\*+([^+@!?\*\[\(]*)$/,aq1=(Z)=>(J)=>!J.startsWith(".")&&J.endsWith(Z),sq1=(Z)=>(J)=>J.endsWith(Z),oq1=(Z)=>{return Z=Z.toLowerCase(),(J)=>!J.startsWith(".")&&J.toLowerCase().endsWith(Z)},rq1=(Z)=>{return Z=Z.toLowerCase(),(J)=>J.toLowerCase().endsWith(Z)},tq1=/^\*+\.\*+$/,eq1=(Z)=>!Z.startsWith(".")&&Z.includes("."),ZF1=(Z)=>Z!=="."&&Z!==".."&&Z.includes("."),JF1=/^\.\*+$/,XF1=(Z)=>Z!=="."&&Z!==".."&&Z.startsWith("."),YF1=/^\*+$/,$F1=(Z)=>Z.length!==0&&!Z.startsWith("."),QF1=(Z)=>Z.length!==0&&Z!=="."&&Z!=="..",WF1=/^\?+([^+@!?\*\[\(]*)?$/,KF1=([Z,J=""])=>{let X=Dp([Z]);if(!J)return X;return J=J.toLowerCase(),(Y)=>X(Y)&&Y.toLowerCase().endsWith(J)},GF1=([Z,J=""])=>{let X=Pp([Z]);if(!J)return X;return J=J.toLowerCase(),(Y)=>X(Y)&&Y.toLowerCase().endsWith(J)},zF1=([Z,J=""])=>{let X=Pp([Z]);return!J?X:(Y)=>X(Y)&&Y.endsWith(J)},HF1=([Z,J=""])=>{let X=Dp([Z]);return!J?X:(Y)=>X(Y)&&Y.endsWith(J)},Dp=([Z])=>{let J=Z.length;return(X)=>X.length===J&&!X.startsWith(".")},Pp=([Z])=>{let J=Z.length;return(X)=>X.length===J&&X!=="."&&X!==".."},Cp=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Mp={win32:{sep:"\\"},posix:{sep:"/"}},VF1=Cp==="win32"?Mp.win32.sep:Mp.posix.sep;p6.sep=VF1;var L6=Symbol("globstar **");p6.GLOBSTAR=L6;var qF1="[^/]",FF1=qF1+"*?",UF1="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",wF1="(?:(?!(?:\\/|^)\\.).)*?",BF1=(Z,J={})=>(X)=>p6(X,Z,J);p6.filter=BF1;var k9=(Z,J={})=>Object.assign({},Z,J),LF1=(Z)=>{if(!Z||typeof Z!=="object"||!Object.keys(Z).length)return p6;let J=p6;return Object.assign((Y,$,Q={})=>J(Y,$,k9(Z,Q)),{Minimatch:class Y extends J.Minimatch{constructor($,Q={}){super($,k9(Z,Q))}static defaults($){return J.defaults(k9(Z,$)).Minimatch}},AST:class Y extends J.AST{constructor($,Q,W={}){super($,Q,k9(Z,W))}static fromGlob($,Q={}){return J.AST.fromGlob($,k9(Z,Q))}},unescape:(Y,$={})=>J.unescape(Y,k9(Z,$)),escape:(Y,$={})=>J.escape(Y,k9(Z,$)),filter:(Y,$={})=>J.filter(Y,k9(Z,$)),defaults:(Y)=>J.defaults(k9(Z,Y)),makeRe:(Y,$={})=>J.makeRe(Y,k9(Z,$)),braceExpand:(Y,$={})=>J.braceExpand(Y,k9(Z,$)),match:(Y,$,Q={})=>J.match(Y,$,k9(Z,Q)),sep:J.sep,GLOBSTAR:L6})};p6.defaults=LF1;var Tp=(Z,J={})=>{if(RG(Z),J.nobrace||!/\{(?:(?!\{).)*\}/.test(Z))return[Z];return Np.default(Z)};p6.braceExpand=Tp;var OF1=(Z,J={})=>new E9(Z,J).makeRe();p6.makeRe=OF1;var jF1=(Z,J,X={})=>{let Y=new E9(J,X);if(Z=Z.filter(($)=>Y.match($)),Y.options.nonull&&!Z.length)Z.push(J);return Z};p6.match=jF1;var Rp=/[?*]|[+@!]\(.*?\)|\[|\]/,MF1=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class E9{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(Z,J={}){if(RG(Z),J=J||{},this.options=J,this.pattern=Z,this.platform=J.platform||Cp,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,W)=>{if(this.isWindows&&this.windowsNoMagicRoot){let K=$[0]===""&&$[1]===""&&($[2]==="?"||!Rp.test($[2]))&&!Rp.test($[3]),G=/^[a-z]:/i.test($[0]);if(K)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((K)=>this.parse(K))});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 W=X[Y+1],K=X[Y+2],G=X[Y+3];if(W!=="..")continue;if(!K||K==="."||K===".."||!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 W=X[Q];if(Q===1&&W===""&&X[0]==="")continue;if(W==="."||W==="")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 K=$===1&&X[$+1]==="**"?["."]:[];if(X.splice($-1,2,...K),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=[],W="";while(Y<Z.length&&$<J.length)if(Z[Y]===J[$])Q.push(W==="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(W==="b")return!1;W="a",Q.push(Z[Y]),Y++,$++}else if(J[$]==="*"&&Z[Y]&&(this.options.dot||!Z[Y].startsWith("."))&&Z[Y]!=="**"){if(W==="a")return!1;W="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]),B=!U&&Z[0]===""&&Z[1]===""&&Z[2]==="?"&&/^[a-z]:$/i.test(Z[3]),w=typeof J[0]==="string"&&/^[a-z]:$/i.test(J[0]),O=!w&&J[0]===""&&J[1]===""&&J[2]==="?"&&typeof J[3]==="string"&&/^[a-z]:$/i.test(J[3]),N=B?3:U?0:void 0,R=O?3:w?0:void 0;if(typeof N==="number"&&typeof R==="number"){let[j,P]=[Z[N],J[R]];if(j.toLowerCase()===P.toLowerCase()){if(J[R]=j,R>N)J=J.slice(R);else if(N>R)Z=Z.slice(N)}}}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,W=0,K=Z.length,G=J.length;Q<K&&W<G;Q++,W++){this.debug("matchOne loop");var z=J[W],H=Z[Q];if(this.debug(J,z,H),z===!1)return!1;if(z===L6){this.debug("GLOBSTAR",[J,z,H]);var V=Q,q=W+1;if(q===G){this.debug("** at the end");for(;Q<K;Q++)if(Z[Q]==="."||Z[Q]===".."||!Y.dot&&Z[Q].charAt(0)===".")return!1;return!0}while(V<K){var F=Z[V];if(this.debug(`
405
405
  globstar while`,Z,V,J,q,F),this.matchOne(Z.slice(V),J.slice(q),X))return this.debug("globstar found match!",V,K,F),!0;else{if(F==="."||F===".."||!Y.dot&&F.charAt(0)==="."){this.debug("dot detected!",Z,V,J,q);break}this.debug("globstar swallow a segment, and continue"),V++}}if(X){if(this.debug(`
406
- >>> no match, partial?`,Z,V,J,q),V===K)return!0}return!1}let U;if(typeof z==="string")U=H===z,this.debug("string match",z,H,U);else U=z.test(H),this.debug("pattern match",z,H,U);if(!U)return!1}if(Q===K&&W===G)return!0;else if(Q===K)return X;else if(W===G)return Q===K-1&&Z[Q]==="";else throw new Error("wtf?")}braceExpand(){return Tp(this.pattern,this.options)}parse(Z){RG(Z);let J=this.options;if(Z==="**")return L6;if(Z==="")return"";let X,Y=null;if(X=Z.match(YF1))Y=J.dot?QF1:$F1;else if(X=Z.match(nq1))Y=(J.nocase?J.dot?rq1:oq1:J.dot?sq1:aq1)(X[1]);else if(X=Z.match(WF1))Y=(J.nocase?J.dot?GF1:KF1:J.dot?zF1:HF1)(X);else if(X=Z.match(tq1))Y=J.dot?ZF1:eq1;else if(X=Z.match(JF1))Y=XF1;let $=B6.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?FF1:J.dot?UF1:wF1,Y=new Set(J.nocase?["i"]:[]),$=Z.map((K)=>{let G=K.map((z)=>{if(z instanceof RegExp)for(let H of z.flags.split(""))Y.add(H);return typeof z==="string"?MF1(z):z===L6?L6:z._src});return G.forEach((z,H)=>{let V=G[H+1],q=G[H-1];if(z!==L6||q===L6)return;if(q===void 0)if(V!==void 0&&V!==L6)G[H+1]="(?:\\/|"+X+"\\/)?"+V;else G[H]=X;else if(V===void 0)G[H-1]=q+"(?:\\/|"+X+")?";else if(V!==L6)G[H-1]=q+"(?:\\/|\\/"+X+"\\/)"+V,G[H+1]=L6}),G.filter((z)=>z!==L6).join("/")}).join("|"),[Q,W]=Z.length>1?["(?:",")"]:["",""];if($="^"+Q+$+W+"$",this.negate)$="^(?!"+$+").+$";try{this.regexp=new RegExp($,[...Y].join(""))}catch(K){this.regexp=!1}return this.regexp}slashSplit(Z){if(this.preserveMultipleSlashes)return Z.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(Z))return["",...Z.split(/\/+/)];else return Z.split(/\/+/)}match(Z,J=this.partial){if(this.debug("match",Z,this.pattern),this.comment)return!1;if(this.empty)return Z==="";if(Z==="/"&&J)return!0;let 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 W=Y.length-2;!Q&&W>=0;W--)Q=Y[W];for(let W=0;W<$.length;W++){let K=$[W],G=Y;if(X.matchBase&&K.length===1)G=[Q];if(this.matchOne(G,K,J)){if(X.flipNegate)return!0;return!this.negate}}if(X.flipNegate)return!1;return this.negate}static defaults(Z){return p6.defaults(Z).Minimatch}}p6.AST=B6;p6.Minimatch=E9;p6.escape=$W;p6.unescape=D4;import{fileURLToPath as tF1}from"url";var QW=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,Ep=new Set,SP=typeof process==="object"&&!!process?process:{},Ip=(Z,J,X,Y)=>{typeof SP.emitWarning==="function"?SP.emitWarning(Z,J,X,Y):console.error(`[${X}] ${J}: ${Z}`)},V2=globalThis.AbortController,kp=globalThis.AbortSignal;if(typeof V2==="undefined"){kp=class X{onabort;_onabort=[];reason;aborted=!1;addEventListener(Y,$){this._onabort.push($)}},V2=class X{constructor(){J()}signal=new kp;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=SP.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",J=()=>{if(!Z)return;Z=!1,Ip("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 RF1=(Z)=>!Ep.has(Z),fq6=Symbol("type"),CJ=(Z)=>Z&&Z===Math.floor(Z)&&Z>0&&isFinite(Z),vp=(Z)=>!CJ(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?DG:null;class DG extends Array{constructor(Z){super(Z);this.fill(0)}}class WW{heap;length;static#Z=!1;static create(Z){let J=vp(Z);if(!J)return[];WW.#Z=!0;let X=new WW(Z,J);return WW.#Z=!1,X}constructor(Z,J){if(!WW.#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 PG{#Z;#J;#Y;#X;#$;#H;#q;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#K;#G;#z;#V;#Q;#U;#B;#w;#O;#k;#j;#E;#N;#R;#M;#C;#L;#v;static unsafeExposeInternals(Z){return{starts:Z.#N,ttls:Z.#R,sizes:Z.#E,keyMap:Z.#z,keyList:Z.#V,valList:Z.#Q,next:Z.#U,prev:Z.#B,get head(){return Z.#w},get tail(){return Z.#O},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.#P(J)}}get max(){return this.#Z}get maxSize(){return this.#J}get calculatedSize(){return this.#G}get size(){return this.#K}get fetchMethod(){return this.#H}get memoMethod(){return this.#q}get dispose(){return this.#Y}get onInsert(){return this.#X}get disposeAfter(){return this.#$}constructor(Z){let{max:J=0,ttl:X,ttlResolution:Y=1,ttlAutopurge:$,updateAgeOnGet:Q,updateAgeOnHas:W,allowStale:K,dispose:G,onInsert:z,disposeAfter:H,noDisposeOnSet:V,noUpdateTTL:q,maxSize:F=0,maxEntrySize:U=0,sizeCalculation:B,fetchMethod:w,memoMethod:O,noDeleteOnFetchRejection:N,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:P,ignoreFetchAbort:D}=Z;if(J!==0&&!CJ(J))throw new TypeError("max option must be a nonnegative integer");let C=J?vp(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=B,this.sizeCalculation){if(!this.#J&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw new TypeError("sizeCalculation set to non-function")}if(O!==void 0&&typeof O!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#q=O,w!==void 0&&typeof w!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#H=w,this.#C=!!w,this.#z=new Map,this.#V=new Array(J).fill(void 0),this.#Q=new Array(J).fill(void 0),this.#U=new C(J),this.#B=new C(J),this.#w=0,this.#O=0,this.#k=WW.create(J),this.#K=0,this.#G=0,typeof G==="function")this.#Y=G;if(typeof z==="function")this.#X=z;if(typeof H==="function")this.#$=H,this.#j=[];else this.#$=void 0,this.#j=void 0;if(this.#M=!!this.#Y,this.#v=!!this.#X,this.#L=!!this.#$,this.noDisposeOnSet=!!V,this.noUpdateTTL=!!q,this.noDeleteOnFetchRejection=!!N,this.allowStaleOnFetchRejection=!!j,this.allowStaleOnFetchAbort=!!P,this.ignoreFetchAbort=!!D,this.maxEntrySize!==0){if(this.#J!==0){if(!CJ(this.#J))throw new TypeError("maxSize must be a positive integer if specified")}if(!CJ(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#m()}if(this.allowStale=!!K,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!Q,this.updateAgeOnHas=!!W,this.ttlResolution=CJ(Y)||Y===0?Y:1,this.ttlAutopurge=!!$,this.ttl=X||0,this.ttl){if(!CJ(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#W()}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(RF1("LRU_CACHE_UNBOUNDED"))Ep.add("LRU_CACHE_UNBOUNDED"),Ip("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",PG)}}getRemainingTTL(Z){return this.#z.has(Z)?1/0:0}#W(){let Z=new DG(this.#Z),J=new DG(this.#Z);this.#R=Z,this.#N=J,this.#S=($,Q,W=QW.now())=>{if(J[$]=Q!==0?W:0,Z[$]=Q,Q!==0&&this.ttlAutopurge){let K=setTimeout(()=>{if(this.#P($))this.#_(this.#V[$],"expire")},Q+1);if(K.unref)K.unref()}},this.#x=($)=>{J[$]=Z[$]!==0?QW.now():0},this.#D=($,Q)=>{if(Z[Q]){let W=Z[Q],K=J[Q];if(!W||!K)return;$.ttl=W,$.start=K,$.now=X||Y();let G=$.now-K;$.remainingTTL=W-G}};let X=0,Y=()=>{let $=QW.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 W=Z[Q],K=J[Q];if(!W||!K)return 1/0;let G=(X||Y())-K;return W-G},this.#P=($)=>{let Q=J[$],W=Z[$];return!!W&&!!Q&&(X||Y())-Q>W}}#x=()=>{};#D=()=>{};#S=()=>{};#P=()=>!1;#m(){let Z=new DG(this.#Z);this.#G=0,this.#E=Z,this.#A=(J)=>{this.#G-=Z[J],Z[J]=0},this.#u=(J,X,Y,$)=>{if(this.#F(X))return 0;if(!CJ(Y))if($){if(typeof $!=="function")throw new TypeError("sizeCalculation must be a function");if(Y=$(X,J),!CJ(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}}#A=(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.#K)for(let J=this.#O;;){if(!this.#d(J))break;if(Z||!this.#P(J))yield J;if(J===this.#w)break;else J=this.#B[J]}}*#I({allowStale:Z=this.allowStale}={}){if(this.#K)for(let J=this.#w;;){if(!this.#d(J))break;if(Z||!this.#P(J))yield J;if(J===this.#O)break;else J=this.#U[J]}}#d(Z){return Z!==void 0&&this.#z.get(this.#V[Z])===Z}*entries(){for(let Z of this.#T())if(this.#Q[Z]!==void 0&&this.#V[Z]!==void 0&&!this.#F(this.#Q[Z]))yield[this.#V[Z],this.#Q[Z]]}*rentries(){for(let Z of this.#I())if(this.#Q[Z]!==void 0&&this.#V[Z]!==void 0&&!this.#F(this.#Q[Z]))yield[this.#V[Z],this.#Q[Z]]}*keys(){for(let Z of this.#T()){let J=this.#V[Z];if(J!==void 0&&!this.#F(this.#Q[Z]))yield J}}*rkeys(){for(let Z of this.#I()){let J=this.#V[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.#V[X],this))return this.get(this.#V[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.#V[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.#V[X],this)}}purgeStale(){let Z=!1;for(let J of this.#I({allowStale:!0}))if(this.#P(J))this.#_(this.#V[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],W=this.#N[J];if(Q&&W){let K=Q-(QW.now()-W);$.ttl=K,$.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.#V[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 W=QW.now()-this.#N[J];Q.start=Math.floor(Date.now()-W)}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=QW.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:W=this.sizeCalculation,status:K}=X,{noUpdateTTL:G=this.noUpdateTTL}=X,z=this.#u(Z,J,X.size||0,W);if(this.maxEntrySize&&z>this.maxEntrySize){if(K)K.set="miss",K.maxEntrySizeExceeded=!0;return this.#_(Z,"set"),this}let H=this.#K===0?void 0:this.#z.get(Z);if(H===void 0){if(H=this.#K===0?this.#O:this.#k.length!==0?this.#k.pop():this.#K===this.#Z?this.#b(!1):this.#K,this.#V[H]=Z,this.#Q[H]=J,this.#z.set(Z,H),this.#U[this.#O]=H,this.#B[H]=this.#O,this.#O=H,this.#K++,this.#f(H,z,K),K)K.set="add";if(G=!1,this.#v)this.#X?.(J,Z,"add")}else{this.#y(H);let V=this.#Q[H];if(J!==V){if(this.#C&&this.#F(V)){V.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:q}=V;if(q!==void 0&&!Q){if(this.#M)this.#Y?.(q,Z,"set");if(this.#L)this.#j?.push([q,Z,"set"])}}else if(!Q){if(this.#M)this.#Y?.(V,Z,"set");if(this.#L)this.#j?.push([V,Z,"set"])}if(this.#A(H),this.#f(H,z,K),this.#Q[H]=J,K){K.set="replace";let q=V&&this.#F(V)?V.__staleWhileFetching:V;if(q!==void 0)K.oldValue=q}}else if(K)K.set="update";if(this.#v)this.onInsert?.(J,Z,J===V?"update":"replace")}if(Y!==0&&!this.#R)this.#W();if(this.#R){if(!G)this.#S(H,Y,$);if(K)this.#D(K,H)}if(!Q&&this.#L&&this.#j){let V=this.#j,q;while(q=V?.shift())this.#$?.(...q)}return this}pop(){try{while(this.#K){let Z=this.#Q[this.#w];if(this.#b(!0),this.#F(Z)){if(Z.__staleWhileFetching)return Z.__staleWhileFetching}else if(Z!==void 0)return Z}}finally{if(this.#L&&this.#j){let Z=this.#j,J;while(J=Z?.shift())this.#$?.(...J)}}}#b(Z){let J=this.#w,X=this.#V[J],Y=this.#Q[J];if(this.#C&&this.#F(Y))Y.__abortController.abort(new Error("evicted"));else if(this.#M||this.#L){if(this.#M)this.#Y?.(Y,X,"evict");if(this.#L)this.#j?.push([Y,X,"evict"])}if(this.#A(J),Z)this.#V[J]=void 0,this.#Q[J]=void 0,this.#k.push(J);if(this.#K===1)this.#w=this.#O=0,this.#k.length=0;else this.#w=this.#U[J];return this.#z.delete(X),this.#K--,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.#P($)){if(X)this.#x($);if(Y)Y.has="hit",this.#D(Y,$);return!0}else if(Y)Y.has="stale",this.#D(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.#P(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 V2,{signal:W}=X;W?.addEventListener("abort",()=>Q.abort(W.reason),{signal:Q.signal});let K={signal:Q.signal,options:X,context:Y},G=(U,B=!1)=>{let{aborted:w}=Q.signal,O=X.ignoreFetchAbort&&U!==void 0;if(X.status)if(w&&!B){if(X.status.fetchAborted=!0,X.status.fetchError=Q.signal.reason,O)X.status.fetchAbortIgnored=!0}else X.status.fetchResolved=!0;if(w&&!O&&!B)return H(Q.signal.reason);let N=q;if(this.#Q[J]===q)if(U===void 0)if(N.__staleWhileFetching)this.#Q[J]=N.__staleWhileFetching;else this.#_(Z,"fetch");else{if(X.status)X.status.fetchUpdated=!0;this.set(Z,U,K.options)}return U},z=(U)=>{if(X.status)X.status.fetchRejected=!0,X.status.fetchError=U;return H(U)},H=(U)=>{let{aborted:B}=Q.signal,w=B&&X.allowStaleOnFetchAbort,O=w||X.allowStaleOnFetchRejection,N=O||X.noDeleteOnFetchRejection,R=q;if(this.#Q[J]===q){if(!N||R.__staleWhileFetching===void 0)this.#_(Z,"fetch");else if(!w)this.#Q[J]=R.__staleWhileFetching}if(O){if(X.status&&R.__staleWhileFetching!==void 0)X.status.returnedStale=!0;return R.__staleWhileFetching}else if(R.__returned===R)throw U},V=(U,B)=>{let w=this.#H?.(Z,$,K);if(w&&w instanceof Promise)w.then((O)=>U(O===void 0?void 0:O),B);Q.signal.addEventListener("abort",()=>{if(!X.ignoreFetchAbort||X.allowStaleOnFetchAbort){if(U(void 0),X.allowStaleOnFetchAbort)U=(O)=>G(O,!0)}})};if(X.status)X.status.fetchDispatched=!0;let q=new Promise(V).then(G,z),F=Object.assign(q,{__abortController:Q,__staleWhileFetching:$,__returned:void 0});if(J===void 0)this.set(Z,F,{...K.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 V2}async fetch(Z,J={}){let{allowStale:X=this.allowStale,updateAgeOnGet:Y=this.updateAgeOnGet,noDeleteOnStaleGet:$=this.noDeleteOnStaleGet,ttl:Q=this.ttl,noDisposeOnSet:W=this.noDisposeOnSet,size:K=0,sizeCalculation:G=this.sizeCalculation,noUpdateTTL:z=this.noUpdateTTL,noDeleteOnFetchRejection:H=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:V=this.allowStaleOnFetchRejection,ignoreFetchAbort:q=this.ignoreFetchAbort,allowStaleOnFetchAbort:F=this.allowStaleOnFetchAbort,context:U,forceRefresh:B=!1,status:w,signal:O}=J;if(!this.#C){if(w)w.fetch="get";return this.get(Z,{allowStale:X,updateAgeOnGet:Y,noDeleteOnStaleGet:$,status:w})}let N={allowStale:X,updateAgeOnGet:Y,noDeleteOnStaleGet:$,ttl:Q,noDisposeOnSet:W,size:K,sizeCalculation:G,noUpdateTTL:z,noDeleteOnFetchRejection:H,allowStaleOnFetchRejection:V,allowStaleOnFetchAbort:F,ignoreFetchAbort:q,status:w,signal:O},R=this.#z.get(Z);if(R===void 0){if(w)w.fetch="miss";let j=this.#h(Z,R,N,U);return j.__returned=j}else{let j=this.#Q[R];if(this.#F(j)){let k=X&&j.__staleWhileFetching!==void 0;if(w){if(w.fetch="inflight",k)w.returnedStale=!0}return k?j.__staleWhileFetching:j.__returned=j}let P=this.#P(R);if(!B&&!P){if(w)w.fetch="hit";if(this.#y(R),Y)this.#x(R);if(w)this.#D(w,R);return j}let D=this.#h(Z,R,N,U),T=D.__staleWhileFetching!==void 0&&X;if(w){if(w.fetch=P?"stale":"refresh",T&&P)w.returnedStale=!0}return T?D.__staleWhileFetching:D.__returned=D}}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,W=this.get(Z,Q);if(!$&&W!==void 0)return W;let K=X(Z,W,{options:Q,context:Y});return this.set(Z,K,Q),K}get(Z,J={}){let{allowStale:X=this.allowStale,updateAgeOnGet:Y=this.updateAgeOnGet,noDeleteOnStaleGet:$=this.noDeleteOnStaleGet,status:Q}=J,W=this.#z.get(Z);if(W!==void 0){let K=this.#Q[W],G=this.#F(K);if(Q)this.#D(Q,W);if(this.#P(W)){if(Q)Q.get="stale";if(!G){if(!$)this.#_(Z,"expire");if(Q&&X)Q.returnedStale=!0;return X?K:void 0}else{if(Q&&X&&K.__staleWhileFetching!==void 0)Q.returnedStale=!0;return X?K.__staleWhileFetching:void 0}}else{if(Q)Q.get="hit";if(G)return K.__staleWhileFetching;if(this.#y(W),Y)this.#x(W);return K}}else if(Q)Q.get="miss"}#c(Z,J){this.#B[J]=Z,this.#U[Z]=J}#y(Z){if(Z!==this.#O){if(Z===this.#w)this.#w=this.#U[Z];else this.#c(this.#B[Z],this.#U[Z]);this.#c(this.#O,Z),this.#O=Z}}delete(Z){return this.#_(Z,"delete")}#_(Z,J){let X=!1;if(this.#K!==0){let Y=this.#z.get(Z);if(Y!==void 0)if(X=!0,this.#K===1)this.#g(J);else{this.#A(Y);let $=this.#Q[Y];if(this.#F($))$.__abortController.abort(new Error("deleted"));else if(this.#M||this.#L){if(this.#M)this.#Y?.($,Z,J);if(this.#L)this.#j?.push([$,Z,J])}if(this.#z.delete(Z),this.#V[Y]=void 0,this.#Q[Y]=void 0,Y===this.#O)this.#O=this.#B[Y];else if(Y===this.#w)this.#w=this.#U[Y];else{let Q=this.#B[Y];this.#U[Q]=this.#U[Y];let W=this.#U[Y];this.#B[W]=this.#B[Y]}this.#K--,this.#k.push(Y)}}if(this.#L&&this.#j?.length){let Y=this.#j,$;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.#V[J];if(this.#M)this.#Y?.(X,Y,Z);if(this.#L)this.#j?.push([X,Y,Z])}}if(this.#z.clear(),this.#Q.fill(void 0),this.#V.fill(void 0),this.#R&&this.#N)this.#R.fill(0),this.#N.fill(0);if(this.#E)this.#E.fill(0);if(this.#w=0,this.#O=0,this.#k.length=0,this.#G=0,this.#K=0,this.#L&&this.#j){let J=this.#j,X;while(X=J?.shift())this.#$?.(...X)}}}import{posix as _F1,win32 as uP}from"path";import{fileURLToPath as xF1}from"url";import{lstatSync as AF1,readdir as hF1,readdirSync as fF1,readlinkSync as bF1,realpathSync as yF1}from"fs";import*as gF1 from"fs";import{lstat as uF1,readdir as dF1,readlink as cF1,realpath as lF1}from"fs/promises";import{EventEmitter as bP}from"events";import hp from"stream";import{StringDecoder as NF1}from"string_decoder";var Sp=typeof process==="object"&&process?process:{stdout:null,stderr:null},DF1=(Z)=>!!Z&&typeof Z==="object"&&(Z instanceof CY||Z instanceof hp||PF1(Z)||CF1(Z)),PF1=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof bP&&typeof Z.pipe==="function"&&Z.pipe!==hp.Writable.prototype.pipe,CF1=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof bP&&typeof Z.write==="function"&&typeof Z.end==="function",jZ=Symbol("EOF"),MZ=Symbol("maybeEmitEnd"),TJ=Symbol("emittedEnd"),q2=Symbol("emittingEnd"),CG=Symbol("emittedError"),F2=Symbol("closed"),_p=Symbol("read"),U2=Symbol("flush"),xp=Symbol("flushChunk"),P4=Symbol("encoding"),KW=Symbol("decoder"),Z6=Symbol("flowing"),TG=Symbol("paused"),GW=Symbol("resume"),J6=Symbol("buffer"),i6=Symbol("pipes"),X6=Symbol("bufferLength"),_P=Symbol("bufferPush"),w2=Symbol("bufferShift"),T6=Symbol("objectMode"),k8=Symbol("destroyed"),xP=Symbol("error"),AP=Symbol("emitData"),Ap=Symbol("emitEnd"),hP=Symbol("emitEnd2"),U7=Symbol("async"),fP=Symbol("abort"),B2=Symbol("aborted"),kG=Symbol("signal"),PY=Symbol("dataListeners"),r5=Symbol("discarded"),EG=(Z)=>Promise.resolve().then(Z),TF1=(Z)=>Z(),kF1=(Z)=>Z==="end"||Z==="finish"||Z==="prefinish",EF1=(Z)=>Z instanceof ArrayBuffer||!!Z&&typeof Z==="object"&&Z.constructor&&Z.constructor.name==="ArrayBuffer"&&Z.byteLength>=0,IF1=(Z)=>!Buffer.isBuffer(Z)&&ArrayBuffer.isView(Z);class yP{src;dest;opts;ondrain;constructor(Z,J,X){this.src=Z,this.dest=J,this.opts=X,this.ondrain=()=>Z[GW](),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 fp extends yP{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 vF1=(Z)=>!!Z.objectMode,SF1=(Z)=>!Z.objectMode&&!!Z.encoding&&Z.encoding!=="buffer";class CY extends bP{[Z6]=!1;[TG]=!1;[i6]=[];[J6]=[];[T6];[P4];[U7];[KW];[jZ]=!1;[TJ]=!1;[q2]=!1;[F2]=!1;[CG]=null;[X6]=0;[k8]=!1;[kG];[B2]=!1;[PY]=0;[r5]=!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(vF1(J))this[T6]=!0,this[P4]=null;else if(SF1(J))this[P4]=J.encoding,this[T6]=!1;else this[T6]=!1,this[P4]=null;if(this[U7]=!!J.async,this[KW]=this[P4]?new NF1(this[P4]):null,J&&J.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[J6]});if(J&&J.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[i6]});let{signal:X}=J;if(X)if(this[kG]=X,X.aborted)this[fP]();else X.addEventListener("abort",()=>this[fP]())}get bufferLength(){return this[X6]}get encoding(){return this[P4]}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[T6]}set objectMode(Z){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[U7]}set["async"](Z){this[U7]=this[U7]||!!Z}[fP](){this[B2]=!0,this.emit("abort",this[kG]?.reason),this.destroy(this[kG]?.reason)}get aborted(){return this[B2]}set aborted(Z){}write(Z,J,X){if(this[B2])return!1;if(this[jZ])throw new Error("write after end");if(this[k8])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[U7]?EG:TF1;if(!this[T6]&&!Buffer.isBuffer(Z)){if(IF1(Z))Z=Buffer.from(Z.buffer,Z.byteOffset,Z.byteLength);else if(EF1(Z))Z=Buffer.from(Z);else if(typeof Z!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[T6]){if(this[Z6]&&this[X6]!==0)this[U2](!0);if(this[Z6])this.emit("data",Z);else this[_P](Z);if(this[X6]!==0)this.emit("readable");if(X)Y(X);return this[Z6]}if(!Z.length){if(this[X6]!==0)this.emit("readable");if(X)Y(X);return this[Z6]}if(typeof Z==="string"&&!(J===this[P4]&&!this[KW]?.lastNeed))Z=Buffer.from(Z,J);if(Buffer.isBuffer(Z)&&this[P4])Z=this[KW].write(Z);if(this[Z6]&&this[X6]!==0)this[U2](!0);if(this[Z6])this.emit("data",Z);else this[_P](Z);if(this[X6]!==0)this.emit("readable");if(X)Y(X);return this[Z6]}read(Z){if(this[k8])return null;if(this[r5]=!1,this[X6]===0||Z===0||Z&&Z>this[X6])return this[MZ](),null;if(this[T6])Z=null;if(this[J6].length>1&&!this[T6])this[J6]=[this[P4]?this[J6].join(""):Buffer.concat(this[J6],this[X6])];let J=this[_p](Z||null,this[J6][0]);return this[MZ](),J}[_p](Z,J){if(this[T6])this[w2]();else{let X=J;if(Z===X.length||Z===null)this[w2]();else if(typeof X==="string")this[J6][0]=X.slice(Z),J=X.slice(0,Z),this[X6]-=Z;else this[J6][0]=X.subarray(Z),J=X.subarray(0,Z),this[X6]-=Z}if(this.emit("data",J),!this[J6].length&&!this[jZ])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[jZ]=!0,this.writable=!1,this[Z6]||!this[TG])this[MZ]();return this}[GW](){if(this[k8])return;if(!this[PY]&&!this[i6].length)this[r5]=!0;if(this[TG]=!1,this[Z6]=!0,this.emit("resume"),this[J6].length)this[U2]();else if(this[jZ])this[MZ]();else this.emit("drain")}resume(){return this[GW]()}pause(){this[Z6]=!1,this[TG]=!0,this[r5]=!1}get destroyed(){return this[k8]}get flowing(){return this[Z6]}get paused(){return this[TG]}[_P](Z){if(this[T6])this[X6]+=1;else this[X6]+=Z.length;this[J6].push(Z)}[w2](){if(this[T6])this[X6]-=1;else this[X6]-=this[J6][0].length;return this[J6].shift()}[U2](Z=!1){do;while(this[xp](this[w2]())&&this[J6].length);if(!Z&&!this[J6].length&&!this[jZ])this.emit("drain")}[xp](Z){return this.emit("data",Z),this[Z6]}pipe(Z,J){if(this[k8])return Z;this[r5]=!1;let X=this[TJ];if(J=J||{},Z===Sp.stdout||Z===Sp.stderr)J.end=!1;else J.end=J.end!==!1;if(J.proxyErrors=!!J.proxyErrors,X){if(J.end)Z.end()}else if(this[i6].push(!J.proxyErrors?new yP(this,Z,J):new fp(this,Z,J)),this[U7])EG(()=>this[GW]());else this[GW]();return Z}unpipe(Z){let J=this[i6].find((X)=>X.dest===Z);if(J){if(this[i6].length===1){if(this[Z6]&&this[PY]===0)this[Z6]=!1;this[i6]=[]}else this[i6].splice(this[i6].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[r5]=!1,this[PY]++,!this[i6].length&&!this[Z6])this[GW]()}else if(Z==="readable"&&this[X6]!==0)super.emit("readable");else if(kF1(Z)&&this[TJ])super.emit(Z),this.removeAllListeners(Z);else if(Z==="error"&&this[CG]){let Y=J;if(this[U7])EG(()=>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[PY]=this.listeners("data").length,this[PY]===0&&!this[r5]&&!this[i6].length)this[Z6]=!1}return X}removeAllListeners(Z){let J=super.removeAllListeners(Z);if(Z==="data"||Z===void 0){if(this[PY]=0,!this[r5]&&!this[i6].length)this[Z6]=!1}return J}get emittedEnd(){return this[TJ]}[MZ](){if(!this[q2]&&!this[TJ]&&!this[k8]&&this[J6].length===0&&this[jZ]){if(this[q2]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[F2])this.emit("close");this[q2]=!1}}emit(Z,...J){let X=J[0];if(Z!=="error"&&Z!=="close"&&Z!==k8&&this[k8])return!1;else if(Z==="data")return!this[T6]&&!X?!1:this[U7]?(EG(()=>this[AP](X)),!0):this[AP](X);else if(Z==="end")return this[Ap]();else if(Z==="close"){if(this[F2]=!0,!this[TJ]&&!this[k8])return!1;let $=super.emit("close");return this.removeAllListeners("close"),$}else if(Z==="error"){this[CG]=X,super.emit(xP,X);let $=!this[kG]||this.listeners("error").length?super.emit("error",X):!1;return this[MZ](),$}else if(Z==="resume"){let $=super.emit("resume");return this[MZ](),$}else if(Z==="finish"||Z==="prefinish"){let $=super.emit(Z);return this.removeAllListeners(Z),$}let Y=super.emit(Z,...J);return this[MZ](),Y}[AP](Z){for(let X of this[i6])if(X.dest.write(Z)===!1)this.pause();let J=this[r5]?!1:super.emit("data",Z);return this[MZ](),J}[Ap](){if(this[TJ])return!1;return this[TJ]=!0,this.readable=!1,this[U7]?(EG(()=>this[hP]()),!0):this[hP]()}[hP](){if(this[KW]){let J=this[KW].end();if(J){for(let X of this[i6])X.dest.write(J);if(!this[r5])super.emit("data",J)}}for(let J of this[i6])J.end();let Z=super.emit("end");return this.removeAllListeners("end"),Z}async collect(){let Z=Object.assign([],{dataLength:0});if(!this[T6])Z.dataLength=0;let J=this.promise();return this.on("data",(X)=>{if(Z.push(X),!this[T6])Z.dataLength+=X.length}),await J,Z}async concat(){if(this[T6])throw new Error("cannot concat in objectMode");let Z=await this.collect();return this[P4]?Z.join(""):Buffer.concat(Z,Z.dataLength)}async promise(){return new Promise((Z,J)=>{this.on(k8,()=>J(new Error("stream destroyed"))),this.on("error",(X)=>J(X)),this.on("end",()=>Z())})}[Symbol.asyncIterator](){this[r5]=!1;let Z=!1,J=async()=>{return this.pause(),Z=!0,{value:void 0,done:!0}};return{next:()=>{if(Z)return J();let Y=this.read();if(Y!==null)return Promise.resolve({done:!1,value:Y});if(this[jZ])return J();let $,Q,W=(H)=>{this.off("data",K),this.off("end",G),this.off(k8,z),J(),Q(H)},K=(H)=>{this.off("error",W),this.off("end",G),this.off(k8,z),this.pause(),$({value:H,done:!!this[jZ]})},G=()=>{this.off("error",W),this.off("data",K),this.off(k8,z),J(),$({done:!0,value:void 0})},z=()=>W(new Error("stream destroyed"));return new Promise((H,V)=>{Q=V,$=H,this.once(k8,z),this.once("error",W),this.once("end",G),this.once("data",K)})},throw:J,return:J,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[r5]=!1;let Z=!1,J=()=>{return this.pause(),this.off(xP,J),this.off(k8,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(xP,J),this.once(k8,J),{next:X,throw:J,return:J,[Symbol.iterator](){return this}}}destroy(Z){if(this[k8]){if(Z)this.emit("error",Z);else this.emit(k8);return this}this[k8]=!0,this[r5]=!0,this[J6].length=0,this[X6]=0;let J=this;if(typeof J.close==="function"&&!this[F2])J.close();if(Z)this.emit("error",Z);else this.emit(k8);return this}static get isStream(){return DF1}}var mF1=yF1.native,vG={lstatSync:AF1,readdir:hF1,readdirSync:fF1,readlinkSync:bF1,realpathSync:mF1,promises:{lstat:uF1,readdir:dF1,readlink:cF1,realpath:lF1}},up=(Z)=>!Z||Z===vG||Z===gF1?vG:{...vG,...Z,promises:{...vG.promises,...Z.promises||{}}},dp=/^\\\\\?\\([a-z]:)\\?$/i,pF1=(Z)=>Z.replace(/\//g,"\\").replace(dp,"$1\\"),iF1=/[\\\/]/,v9=0,cp=1,lp=2,w7=4,pp=6,ip=8,TY=10,np=12,I9=15,IG=~I9,gP=16,bp=32,SG=64,C4=128,L2=256,j2=512,yp=SG|C4|j2,nF1=1023,mP=(Z)=>Z.isFile()?ip:Z.isDirectory()?w7:Z.isSymbolicLink()?TY:Z.isCharacterDevice()?lp:Z.isBlockDevice()?pp:Z.isSocket()?np:Z.isFIFO()?cp:v9,gp=new Map,_G=(Z)=>{let J=gp.get(Z);if(J)return J;let X=Z.normalize("NFKD");return gp.set(Z,X),X},mp=new Map,O2=(Z)=>{let J=mp.get(Z);if(J)return J;let X=_G(Z.toLowerCase());return mp.set(Z,X),X};class dP extends PG{constructor(){super({max:256})}}class ap extends PG{constructor(Z=16384){super({maxSize:Z,sizeCalculation:(J)=>J.length+1})}}var sp=Symbol("PathScurry setAsCwd");class n6{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.#$}#H;get gid(){return this.#H}#q;get rdev(){return this.#q}#K;get blksize(){return this.#K}#G;get ino(){return this.#G}#z;get size(){return this.#z}#V;get blocks(){return this.#V}#Q;get atimeMs(){return this.#Q}#U;get mtimeMs(){return this.#U}#B;get ctimeMs(){return this.#B}#w;get birthtimeMs(){return this.#w}#O;get atime(){return this.#O}#k;get mtime(){return this.#k}#j;get ctime(){return this.#j}#E;get birthtime(){return this.#E}#N;#R;#M;#C;#L;#v;#W;#x;#D;#S;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Z,J=v9,X,Y,$,Q,W){if(this.name=Z,this.#N=$?O2(Z):_G(Z),this.#W=J&nF1,this.nocase=$,this.roots=Y,this.root=X||this,this.#x=Q,this.#M=W.fullpath,this.#L=W.relative,this.#v=W.relativePosix,this.parent=W.parent,this.parent)this.#Z=this.parent.#Z;else this.#Z=up(W.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.#x}resolve(Z){if(!Z)return this;let J=this.getRootString(Z),Y=Z.substring(J.length).split(this.splitSep);return J?this.getRoot(J).#P(Y):this.#P(Y)}#P(Z){let J=this;for(let X of Z)J=J.child(X);return J}children(){let Z=this.#x.get(this);if(Z)return Z;let J=Object.assign([],{provisional:0});return this.#x.set(this,J),this.#W&=~gP,J}child(Z,J){if(Z===""||Z===".")return this;if(Z==="..")return this.parent||this;let X=this.children(),Y=this.nocase?O2(Z):_G(Z);for(let K of X)if(K.#N===Y)return K;let $=this.parent?this.sep:"",Q=this.#M?this.#M+$+Z:void 0,W=this.newChild(Z,v9,{...J,parent:this,fullpath:Q});if(!this.canReaddir())W.#W|=C4;return X.push(W),W}relative(){if(this.isCWD)return"";if(this.#L!==void 0)return this.#L;let Z=this.name,J=this.parent;if(!J)return this.#L=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.#W&I9)===v9}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.#W&I9)===ip}isDirectory(){return(this.#W&I9)===w7}isCharacterDevice(){return(this.#W&I9)===lp}isBlockDevice(){return(this.#W&I9)===pp}isFIFO(){return(this.#W&I9)===cp}isSocket(){return(this.#W&I9)===np}isSymbolicLink(){return(this.#W&TY)===TY}lstatCached(){return this.#W&bp?this:void 0}readlinkCached(){return this.#D}realpathCached(){return this.#S}readdirCached(){let Z=this.children();return Z.slice(0,Z.provisional)}canReadlink(){if(this.#D)return!0;if(!this.parent)return!1;let Z=this.#W&I9;return!(Z!==v9&&Z!==TY||this.#W&L2||this.#W&C4)}calledReaddir(){return!!(this.#W&gP)}isENOENT(){return!!(this.#W&C4)}isNamed(Z){return!this.nocase?this.#N===_G(Z):this.#N===O2(Z)}async readlink(){let Z=this.#D;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.#D=X}catch(J){this.#b(J.code);return}}readlinkSync(){let Z=this.#D;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.#D=X}catch(J){this.#b(J.code);return}}#m(Z){this.#W|=gP;for(let J=Z.provisional;J<Z.length;J++){let X=Z[J];if(X)X.#A()}}#A(){if(this.#W&C4)return;this.#W=(this.#W|C4)&IG,this.#f()}#f(){let Z=this.children();Z.provisional=0;for(let J of Z)J.#A()}#u(){this.#W|=j2,this.#T()}#T(){if(this.#W&SG)return;let Z=this.#W;if((Z&I9)===w7)Z&=IG;this.#W=Z|SG,this.#f()}#I(Z=""){if(Z==="ENOTDIR"||Z==="EPERM")this.#T();else if(Z==="ENOENT")this.#A();else this.children().provisional=0}#d(Z=""){if(Z==="ENOTDIR")this.parent.#T();else if(Z==="ENOENT")this.#A()}#b(Z=""){let J=this.#W;if(J|=L2,Z==="ENOENT")J|=C4;if(Z==="EINVAL"||Z==="UNKNOWN")J&=IG;if(this.#W=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=mP(Z),Y=this.newChild(Z.name,X,{parent:this}),$=Y.#W&I9;if($!==w7&&$!==TY&&$!==v9)Y.#W|=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?O2(Z.name):_G(Z.name))!==Y.#N)continue;return this.#y(Z,Y,X,J)}}#y(Z,J,X,Y){let $=J.name;if(J.#W=J.#W&IG|mP(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.#W&C4)===0)try{return this.#_(await this.#Z.promises.lstat(this.fullpath())),this}catch(Z){this.#d(Z.code)}}lstatSync(){if((this.#W&C4)===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:W,ctime:K,ctimeMs:G,dev:z,gid:H,ino:V,mode:q,mtime:F,mtimeMs:U,nlink:B,rdev:w,size:O,uid:N}=Z;this.#O=J,this.#Q=X,this.#E=Y,this.#w=$,this.#K=Q,this.#V=W,this.#j=K,this.#B=G,this.#J=z,this.#H=H,this.#G=V,this.#Y=q,this.#k=F,this.#U=U,this.#X=B,this.#q=w,this.#z=O,this.#$=N;let R=mP(Z);if(this.#W=this.#W&IG|R|bp,R!==v9&&R!==w7&&R!==TY)this.#W|=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 W of Q)this.#h(W,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.#W&yp)return!1;let Z=I9&this.#W;if(!(Z===v9||Z===w7||Z===TY))return!1;return!0}shouldWalk(Z,J){return(this.#W&w7)===w7&&!(this.#W&yp)&&!Z.has(this)&&(!J||J(this))}async realpath(){if(this.#S)return this.#S;if((j2|L2|C4)&this.#W)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((j2|L2|C4)&this.#W)return;try{let Z=this.#Z.realpathSync(this.fullpath());return this.#S=this.resolve(Z)}catch(Z){this.#u()}}[sp](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.#L=X.join(this.sep),Y.#v=X.join("/"),Y=Y.parent,X.push("..");Y=Z;while(Y&&Y.parent&&!J.has(Y))Y.#L=void 0,Y.#v=void 0,Y=Y.parent}}class M2 extends n6{sep="\\";splitSep=iF1;constructor(Z,J=v9,X,Y,$,Q,W){super(Z,J,X,Y,$,Q,W)}newChild(Z,J=v9,X={}){return new M2(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),X)}getRootString(Z){return uP.parse(Z).root}getRoot(Z){if(Z=pF1(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 xG(Z,this).root}sameRoot(Z,J=this.root.name){return Z=Z.toUpperCase().replace(/\//g,"\\").replace(dp,"$1\\"),Z===J}}class R2 extends n6{splitSep="/";sep="/";constructor(Z,J=v9,X,Y,$,Q,W){super(Z,J,X,Y,$,Q,W)}getRootString(Z){return Z.startsWith("/")?"/":""}getRoot(Z){return this.root}newChild(Z,J=v9,X={}){return new R2(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),X)}}class cP{root;rootPath;roots;cwd;#Z;#J;#Y;nocase;#X;constructor(Z=process.cwd(),J,X,{nocase:Y,childrenCacheSize:$=16384,fs:Q=vG}={}){if(this.#X=up(Q),Z instanceof URL||Z.startsWith("file://"))Z=xF1(Z);let W=J.resolve(Z);this.roots=Object.create(null),this.rootPath=this.parseRootPath(W),this.#Z=new dP,this.#J=new dP,this.#Y=new ap($);let K=W.substring(this.rootPath.length).split(X);if(K.length===1&&!K[0])K.pop();if(Y===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=Y,this.root=this.newRoot(this.#X),this.roots[this.rootPath]=this.root;let G=this.root,z=K.length-1,H=J.sep,V=this.rootPath,q=!1;for(let F of K){let U=z--;G=G.child(F,{relative:new Array(U).fill("..").join(H),relativePosix:new Array(U).fill("..").join("/"),fullpath:V+=(q?"":H)+F}),q=!0}this.cwd=G}depth(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.depth()}childrenCache(){return this.#Y}resolve(...Z){let J="";for(let $=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 n6))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 n6))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 n6))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 n6))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 n6))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 n6))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 n6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,W=[];if(!$||$(Z))W.push(X?Z:Z.fullpath());let K=new Set,G=(H,V)=>{K.add(H),H.readdirCB((q,F)=>{if(q)return V(q);let U=F.length;if(!U)return V();let B=()=>{if(--U===0)V()};for(let w of F){if(!$||$(w))W.push(X?w:w.fullpath());if(Y&&w.isSymbolicLink())w.realpath().then((O)=>O?.isUnknown()?O.lstat():O).then((O)=>O?.shouldWalk(K,Q)?G(O,B):B());else if(w.shouldWalk(K,Q))G(w,B);else B()}},!0)},z=Z;return new Promise((H,V)=>{G(z,(q)=>{if(q)return V(q);H(W)})})}walkSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof n6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,W=[];if(!$||$(Z))W.push(X?Z:Z.fullpath());let K=new Set([Z]);for(let G of K){let z=G.readdirSync();for(let H of z){if(!$||$(H))W.push(X?H:H.fullpath());let V=H;if(H.isSymbolicLink()){if(!(Y&&(V=H.realpathSync())))continue;if(V.isUnknown())V.lstatSync()}if(V.shouldWalk(K,Q))K.add(V)}}return W}[Symbol.asyncIterator](){return this.iterate()}iterate(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof n6))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 n6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J;if(!$||$(Z))yield X?Z:Z.fullpath();let W=new Set([Z]);for(let K of W){let G=K.readdirSync();for(let z of G){if(!$||$(z))yield X?z:z.fullpath();let H=z;if(z.isSymbolicLink()){if(!(Y&&(H=z.realpathSync())))continue;if(H.isUnknown())H.lstatSync()}if(H.shouldWalk(W,Q))W.add(H)}}}stream(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof n6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,W=new CY({objectMode:!0});if(!$||$(Z))W.write(X?Z:Z.fullpath());let K=new Set,G=[Z],z=0,H=()=>{let V=!1;while(!V){let q=G.shift();if(!q){if(z===0)W.end();return}z++,K.add(q);let F=(B,w,O=!1)=>{if(B)return W.emit("error",B);if(Y&&!O){let N=[];for(let R of w)if(R.isSymbolicLink())N.push(R.realpath().then((j)=>j?.isUnknown()?j.lstat():j));if(N.length){Promise.all(N).then(()=>F(null,w,!0));return}}for(let N of w)if(N&&(!$||$(N))){if(!W.write(X?N:N.fullpath()))V=!0}z--;for(let N of w){let R=N.realpathCached()||N;if(R.shouldWalk(K,Q))G.push(R)}if(V&&!W.flowing)W.once("drain",H);else if(!U)H()},U=!0;q.readdirCB(F,!0),U=!1}};return H(),W}streamSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof n6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,W=new CY({objectMode:!0}),K=new Set;if(!$||$(Z))W.write(X?Z:Z.fullpath());let G=[Z],z=0,H=()=>{let V=!1;while(!V){let q=G.shift();if(!q){if(z===0)W.end();return}z++,K.add(q);let F=q.readdirSync();for(let U of F)if(!$||$(U)){if(!W.write(X?U:U.fullpath()))V=!0}z--;for(let U of F){let B=U;if(U.isSymbolicLink()){if(!(Y&&(B=U.realpathSync())))continue;if(B.isUnknown())B.lstatSync()}if(B.shouldWalk(K,Q))G.push(B)}}if(V&&!W.flowing)W.once("drain",H)};return H(),W}chdir(Z=this.cwd){let J=this.cwd;this.cwd=typeof Z==="string"?this.cwd.resolve(Z):Z,this.cwd[sp](J)}}class xG extends cP{sep="\\";constructor(Z=process.cwd(),J={}){let{nocase:X=!0}=J;super(Z,uP,"\\",{...J,nocase:X});this.nocase=X;for(let Y=this.cwd;Y;Y=Y.parent)Y.nocase=this.nocase}parseRootPath(Z){return uP.parse(Z).root.toUpperCase()}newRoot(Z){return new M2(this.rootPath,w7,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")||Z.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Z)}}class AG extends cP{sep="/";constructor(Z=process.cwd(),J={}){let{nocase:X=!1}=J;super(Z,_F1,"/",{...J,nocase:X});this.nocase=X}parseRootPath(Z){return"/"}newRoot(Z){return new R2(this.rootPath,w7,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")}}class N2 extends AG{constructor(Z=process.cwd(),J={}){let{nocase:X=!0}=J;super(Z,{...J,nocase:X})}}var aq6=process.platform==="win32"?M2:R2,op=process.platform==="win32"?xG:process.platform==="darwin"?N2:AG;var aF1=(Z)=>Z.length>=1,sF1=(Z)=>Z.length>=1;class zW{#Z;#J;#Y;length;#X;#$;#H;#q;#K;#G;#z=!0;constructor(Z,J,X,Y){if(!aF1(Z))throw new TypeError("empty pattern list");if(!sF1(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,W,K,...G]=this.#Z,[z,H,V,q,...F]=this.#J;if(G[0]==="")G.shift(),F.shift();let U=[$,Q,W,K,""].join("/"),B=[z,H,V,q,""].join("/");this.#Z=[U,...G],this.#J=[B,...F],this.length=this.#Z.length}else if(this.isDrive()||this.isAbsolute()){let[$,...Q]=this.#Z,[W,...K]=this.#J;if(Q[0]==="")Q.shift(),K.shift();let G=$+"/",z=W+"/";this.#Z=[G,...Q],this.#J=[z,...K],this.length=this.#Z.length}}}pattern(){return this.#Z[this.#Y]}isString(){return typeof this.#Z[this.#Y]==="string"}isGlobstar(){return this.#Z[this.#Y]===L6}isRegExp(){return this.#Z[this.#Y]instanceof RegExp}globString(){return this.#H=this.#H||(this.#Y===0?this.isAbsolute()?this.#J[0]+this.#J.slice(1).join("/"):this.#J.join("/"):this.#J.slice(this.#Y).join("/"))}hasMore(){return this.length>this.#Y+1}rest(){if(this.#$!==void 0)return this.#$;if(!this.hasMore())return this.#$=null;return this.#$=new zW(this.#Z,this.#J,this.#Y+1,this.#X),this.#$.#G=this.#G,this.#$.#K=this.#K,this.#$.#q=this.#q,this.#$}isUNC(){let Z=this.#Z;return this.#K!==void 0?this.#K:this.#K=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 oF1=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class hG{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Z,{nobrace:J,nocase:X,noext:Y,noglobstar:$,platform:Q=oF1}){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 W of Z)this.add(W)}add(Z){let J=new E9(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 zW(Y,$,0,this.platform),W=new E9(Q.globString(),this.mmopts),K=$[$.length-1]==="**",G=Q.isAbsolute();if(G)this.absolute.push(W);else this.relative.push(W);if(K)if(G)this.absoluteChildren.push(W);else this.relativeChildren.push(W)}}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 rp{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 tp{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 fG{hasWalkedCache;matches=new rp;subwalks=new tp;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(),W=$.isAbsolute()&&this.opts.absolute!==!1;if(Q){Y=Y.resolve(Q==="/"&&this.opts.root!==void 0?this.opts.root:Q);let H=$.rest();if(!H){this.matches.add(Y,!0,!1);continue}else $=H}if(Y.isENOENT())continue;let K,G,z=!1;while(typeof(K=$.pattern())==="string"&&(G=$.rest()))Y=Y.resolve(K),$=G,z=!0;if(K=$.pattern(),G=$.rest(),z){if(this.hasWalkedCache.hasWalked(Y,$))continue;this.hasWalkedCache.storeWalked(Y,$)}if(typeof K==="string"){let H=K===".."||K===""||K===".";this.matches.add(Y.resolve(K),W,H);continue}else if(K===L6){if(!Y.isSymbolicLink()||this.follow||$.checkFollowGlobstar())this.subwalks.add(Y,$);let H=G?.pattern(),V=G?.rest();if(!G||(H===""||H===".")&&!V)this.matches.add(Y,W,H===""||H===".");else if(H===".."){let q=Y.parent||Y;if(!V)this.matches.add(q,W,!0);else if(!this.hasWalkedCache.hasWalked(q,V))this.subwalks.add(q,V)}}else if(K instanceof RegExp)this.subwalks.add(Y,$)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new fG(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 W=Q.isAbsolute(),K=Q.pattern(),G=Q.rest();if(K===L6)Y.testGlobstar($,Q,G,W);else if(K instanceof RegExp)Y.testRegExp($,K,G,W);else Y.testString($,K,G,W)}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 rF1=(Z,J)=>typeof Z==="string"?new hG([Z],J):Array.isArray(Z)?new hG(Z,J):Z;class pP{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=rF1(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 fG(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[W,K,G]of X.matches.entries()){if(this.#X(W))continue;$++,this.match(W,K,G).then(()=>Q())}for(let W of X.subwalkTargets()){if(this.maxDepth!==1/0&&W.depth()>=this.maxDepth)continue;$++;let K=W.readdirCached();if(W.calledReaddir())this.walkCB3(W,K,X,Q);else W.readdirCB((G,z)=>this.walkCB3(W,z,X,Q),!0)}Q()}walkCB3(Z,J,X,Y){X=X.filterEntries(Z,J);let $=1,Q=()=>{if(--$===0)Y()};for(let[W,K,G]of X.matches.entries()){if(this.#X(W))continue;$++,this.match(W,K,G).then(()=>Q())}for(let[W,K]of X.subwalks.entries())$++,this.walkCB2(W,K,X.child(),Q);Q()}walkCBSync(Z,J,X){if(this.signal?.aborted)X();this.walkCB2Sync(Z,J,new fG(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[W,K,G]of X.matches.entries()){if(this.#X(W))continue;this.matchSync(W,K,G)}for(let W of X.subwalkTargets()){if(this.maxDepth!==1/0&&W.depth()>=this.maxDepth)continue;$++;let K=W.readdirSync();this.walkCB3Sync(W,K,X,Q)}Q()}walkCB3Sync(Z,J,X,Y){X=X.filterEntries(Z,J);let $=1,Q=()=>{if(--$===0)Y()};for(let[W,K,G]of X.matches.entries()){if(this.#X(W))continue;this.matchSync(W,K,G)}for(let[W,K]of X.subwalks.entries())$++,this.walkCB2Sync(W,K,X.child(),Q);Q()}}class D2 extends pP{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 P2 extends pP{results;constructor(Z,J,X){super(Z,J,X);this.results=new CY({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 eF1=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class B7{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=tF1(J.cwd);if(this.cwd=J.cwd||"",this.root=J.root,this.magicalBraces=!!J.magicalBraces,this.nobrace=!!J.nobrace,this.noext=!!J.noext,this.realpath=!!J.realpath,this.absolute=J.absolute,this.includeChildMatches=J.includeChildMatches!==!1,this.noglobstar=!!J.noglobstar,this.matchBase=!!J.matchBase,this.maxDepth=typeof J.maxDepth==="number"?J.maxDepth:1/0,this.stat=!!J.stat,this.ignore=J.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof Z==="string")Z=[Z];if(this.windowsPathsNoEscape=!!J.windowsPathsNoEscape||J.allowWindowsEscape===!1,this.windowsPathsNoEscape)Z=Z.map((K)=>K.replace(/\\/g,"/"));if(this.matchBase){if(J.noglobstar)throw new TypeError("base matching requires globstar");Z=Z.map((K)=>K.includes("/")?K:`./**/${K}`)}if(this.pattern=Z,this.platform=J.platform||eF1,this.opts={...J,platform:this.platform},J.scurry){if(this.scurry=J.scurry,J.nocase!==void 0&&J.nocase!==J.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let K=J.platform==="win32"?xG:J.platform==="darwin"?N2:J.platform?AG:op;this.scurry=new K(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((K)=>new E9(K,Y)),[Q,W]=$.reduce((K,G)=>{return K[0].push(...G.set),K[1].push(...G.globParts),K},[[],[]]);this.patterns=Q.map((K,G)=>{let z=W[G];if(!z)throw new Error("invalid pattern object");return new zW(K,z,0,this.platform)})}async walk(){return[...await new D2(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 D2(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 P2(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 P2(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 iP=(Z,J={})=>{if(!Array.isArray(Z))Z=[Z];for(let X of Z)if(new E9(X,J).hasMagic())return!0;return!1};function T2(Z,J={}){return new B7(Z,J).streamSync()}function Zi(Z,J={}){return new B7(Z,J).stream()}function Ji(Z,J={}){return new B7(Z,J).walkSync()}async function ep(Z,J={}){return new B7(Z,J).walk()}function k2(Z,J={}){return new B7(Z,J).iterateSync()}function Xi(Z,J={}){return new B7(Z,J).iterate()}var ZU1=T2,JU1=Object.assign(Zi,{sync:T2}),XU1=k2,YU1=Object.assign(Xi,{sync:k2}),$U1=Object.assign(Ji,{stream:T2,iterate:k2}),C2=Object.assign(ep,{glob:ep,globSync:Ji,sync:$U1,globStream:Zi,stream:JU1,globStreamSync:T2,streamSync:ZU1,globIterate:Xi,iterate:YU1,globIterateSync:k2,iterateSync:XU1,Glob:B7,hasMagic:iP,escape:$W,unescape:D4});C2.glob=C2;class nP{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 N5{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 HW extends nP{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 N5(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 W=$.getChild();if(!this._childEdges.has(W))this._childEdges.set(W,new Set);return this._childEdges.get(W).add($),$}_destroyEdge(Z){return this._edges.delete(Z),this._parentEdges.get(Z.getParent()).delete(Z),this._childEdges.get(Z.getChild()).delete(Z),this}}function bG(){return bG=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},bG.apply(this,arguments)}class k6{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 E0{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 $8{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 y0=Symbol("attributes"),T4=Symbol("immutableKeys");class VW extends nP{constructor(Z){super();this._disposed=!1,this.graph=void 0,this[y0]=void 0,this[T4]=void 0,this.graph=Z,this[T4]=new Set,this[y0]=this._createAttributes()}getDefaults(){return{}}_createAttributes(){let Z=this.getDefaults(),J={};for(let X in Z){let Y=Z[X];if(Y instanceof VW){let $=this.graph._createEdge(X,this,Y);this[T4].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[y0]){let Y=this[y0][X];if(Y instanceof N5){let $=Y;if($.getChild()===Z)this.setRef(X,J,$.getAttributes())}else if(Y instanceof k6)for(let $ of Y.listRefsByChild(Z)){let Q=$.getAttributes();this.removeRef(X,Z),this.addRef(X,J,Q)}else if(Y instanceof E0){let $=Y.getRefByChild(Z);if($){let Q=$.getAttributes();this.removeRef(X,Z),this.addRef(X,J,Q)}}else if(Y instanceof $8)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[y0][Z]}set(Z,J){return this[y0][Z]=J,this.dispatchEvent({type:"change",attribute:Z})}getRef(Z){let J=this[y0][Z];return J?J.getChild():null}setRef(Z,J,X){if(this[T4].has(Z))throw new Error(`Cannot overwrite immutable attribute, "${Z}".`);let Y=this[y0][Z];if(Y)Y.dispose();if(!J)return this;let $=this.graph._createEdge(Z,this,J,X);return this[y0][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 k6)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[y0][Z];if(J instanceof k6||J instanceof E0)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 W=this.graph._createEdge(Z,this,X,bG({},Y,{key:J}));return $.set(J,W),this.dispatchEvent({type:"change",attribute:Z,key:J})}assertRefMap(Z){let J=this[y0][Z];if(J instanceof $8)return J;throw new Error(`Expected RefMap for attribute "${Z}"`)}dispatchEvent(Z){return super.dispatchEvent(bG({},Z,{target:this})),this.graph.dispatchEvent(bG({},Z,{target:this,type:`node:${Z.type}`})),this}_destroyRef(Z){let J=Z.getName();if(this[y0][J]===Z){if(this[y0][J]=null,this[T4].has(J))Z.getChild().dispose()}else if(this[y0][J]instanceof k6)this[y0][J].remove(Z);else if(this[y0][J]instanceof E0)this[y0][J].remove(Z);else if(this[y0][J]instanceof $8){let X=this[y0][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 zi="v4.1.1",x2="@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 A2;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(A2||(A2={}));var t5;(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"})(t5||(t5={}));var h2;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(h2||(h2={}));var RZ;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(RZ||(RZ={}));var IJ={"5120":Int8Array,"5121":Uint8Array,"5122":Int16Array,"5123":Uint16Array,"5125":Uint32Array,"5126":Float32Array},sP=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 QU1(){var Z=new sP(3);if(sP!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function aP(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function WU1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=X[3]*Y+X[7]*$+X[11]*Q+X[15];return W=W||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/W,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/W,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/W,Z}(function(){var Z=QU1();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}})();function eP(Z){let J=Hi(),X=Z.propertyType===a.NODE?[Z]:Z.listChildren();for(let Y of X)Y.traverse(($)=>{let Q=$.getMesh();if(!Q)return;let W=KU1(Q,$.getWorldMatrix());if(W.min.every(isFinite)&&W.max.every(isFinite))oP(W.min,J),oP(W.max,J)});return J}function KU1(Z,J){let X=Hi();for(let Y of Z.listPrimitives()){let $=Y.getAttribute("POSITION"),Q=Y.getIndices();if(!$)continue;let W=[0,0,0],K=[0,0,0];for(let G=0,z=Q?Q.getCount():$.getCount();G<z;G++){let H=Q?Q.getScalar(G):G;W=$.getElement(H,W),K=WU1(K,W,J),oP(K,X)}}return X}function oP(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 Hi(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class o0{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 ZC{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 Vi{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),GU1(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 y2{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(o0.decodeText(Z.slice(12,16))===y2.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}}y2.PNG_FRIED_CHUNK_NAME="CgBI";class NZ{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}`}}NZ.impls={"image/jpeg":new Vi,"image/png":new y2};function GU1(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 DZ{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 NZ.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 Yi(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function kY(Z){if(Yi(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let X=J.prototype;if(Yi(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}var rP,yG;(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"})(yG||(yG={}));class P5{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=P5.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=P5.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=P5.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=P5.Verbosity.ERROR)console.error(Z)}}rP=P5;P5.Verbosity=yG;P5.DEFAULT_INSTANCE=new rP(rP.Verbosity.INFO);function zU1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],W=Z[5],K=Z[6],G=Z[7],z=Z[8],H=Z[9],V=Z[10],q=Z[11],F=Z[12],U=Z[13],B=Z[14],w=Z[15],O=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,j=X*K-Y*W,P=X*G-$*W,D=Y*G-$*K,C=z*U-H*F,T=z*B-V*F,k=z*w-q*F,x=H*B-V*U,S=H*w-q*U,A=V*w-q*B;return O*A-N*S+R*x+j*k-P*T+D*C}function HU1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=J[9],F=J[10],U=J[11],B=J[12],w=J[13],O=J[14],N=J[15],R=X[0],j=X[1],P=X[2],D=X[3];return Z[0]=R*Y+j*K+P*V+D*B,Z[1]=R*$+j*G+P*q+D*w,Z[2]=R*Q+j*z+P*F+D*O,Z[3]=R*W+j*H+P*U+D*N,R=X[4],j=X[5],P=X[6],D=X[7],Z[4]=R*Y+j*K+P*V+D*B,Z[5]=R*$+j*G+P*q+D*w,Z[6]=R*Q+j*z+P*F+D*O,Z[7]=R*W+j*H+P*U+D*N,R=X[8],j=X[9],P=X[10],D=X[11],Z[8]=R*Y+j*K+P*V+D*B,Z[9]=R*$+j*G+P*q+D*w,Z[10]=R*Q+j*z+P*F+D*O,Z[11]=R*W+j*H+P*U+D*N,R=X[12],j=X[13],P=X[14],D=X[15],Z[12]=R*Y+j*K+P*V+D*B,Z[13]=R*$+j*G+P*q+D*w,Z[14]=R*Q+j*z+P*F+D*O,Z[15]=R*W+j*H+P*U+D*N,Z}function VU1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[4],W=J[5],K=J[6],G=J[8],z=J[9],H=J[10];return Z[0]=Math.hypot(X,Y,$),Z[1]=Math.hypot(Q,W,K),Z[2]=Math.hypot(G,z,H),Z}function qU1(Z,J){var X=new sP(3);VU1(X,J);var Y=1/X[0],$=1/X[1],Q=1/X[2],W=J[0]*Y,K=J[1]*$,G=J[2]*Q,z=J[4]*Y,H=J[5]*$,V=J[6]*Q,q=J[8]*Y,F=J[9]*$,U=J[10]*Q,B=W+H+U,w=0;if(B>0)w=Math.sqrt(B+1)*2,Z[3]=0.25*w,Z[0]=(V-F)/w,Z[1]=(q-G)/w,Z[2]=(K-z)/w;else if(W>H&&W>U)w=Math.sqrt(1+W-H-U)*2,Z[3]=(V-F)/w,Z[0]=0.25*w,Z[1]=(K+z)/w,Z[2]=(q+G)/w;else if(H>U)w=Math.sqrt(1+H-W-U)*2,Z[3]=(q-G)/w,Z[0]=(K+z)/w,Z[1]=0.25*w,Z[2]=(V+F)/w;else w=Math.sqrt(1+U-W-H)*2,Z[3]=(K-z)/w,Z[0]=(q+G)/w,Z[1]=(V+F)/w,Z[2]=0.25*w;return Z}class i0{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(i0.clamp(Z,0,1)*65535);case 5121:return Math.round(i0.clamp(Z,0,1)*255);case 5122:return Math.round(i0.clamp(Z,-1,1)*32767);case 5120:return Math.round(i0.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,X,Y){let $=aP([Z[0],Z[1],Z[2]]),Q=aP([Z[4],Z[5],Z[6]]),W=aP([Z[8],Z[9],Z[10]]);if(zU1(Z)<0)$=-$;J[0]=Z[12],J[1]=Z[13],J[2]=Z[14];let G=Z.slice(),z=1/$,H=1/Q,V=1/W;G[0]*=z,G[1]*=z,G[2]*=z,G[4]*=H,G[5]*=H,G[6]*=H,G[8]*=V,G[9]*=V,G[10]*=V,qU1(X,G),Y[0]=$,Y[1]=Q,Y[2]=W}static compose(Z,J,X,Y){let $=Y,Q=J[0],W=J[1],K=J[2],G=J[3],z=Q+Q,H=W+W,V=K+K,q=Q*z,F=Q*H,U=Q*V,B=W*H,w=W*V,O=K*V,N=G*z,R=G*H,j=G*V,P=X[0],D=X[1],C=X[2];return $[0]=(1-(B+O))*P,$[1]=(F+j)*P,$[2]=(U-R)*P,$[3]=0,$[4]=(F-j)*D,$[5]=(1-(q+O))*D,$[6]=(w+N)*D,$[7]=0,$[8]=(U+R)*C,$[9]=(w-N)*C,$[10]=(1-(q+B))*C,$[11]=0,$[12]=Z[0],$[13]=Z[1],$[14]=Z[2],$[15]=1,$}}function FU1(Z,J){if(!!Z!==!!J)return!1;let X=Z.getChild(),Y=J.getChild();return X===Y||X.equals(Y)}function UU1(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[$],W=Y[$];if(Q.getChild()===W.getChild())continue;if(!Q.getChild().equals(W.getChild()))return!1}return!0}function wU1(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($),W=J.get($);if(!!Q!==!!W)return!1;let K=Q.getChild(),G=W.getChild();if(K===G)continue;if(!K.equals(G))return!1}return!0}function qi(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 Fi(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!kY(Z)||!kY(J))return Z===J;let X=Z,Y=J,$=0,Q=0,W;for(W in X)$++;for(W in Y)Q++;if($!==Q)return!1;for(W in X){let K=X[W],G=Y[W];if(f2(K)&&f2(G)){if(!qi(K,G))return!1}else if(kY(K)&&kY(G)){if(!Fi(K,G))return!1}else if(K!==G)return!1}return!0}function f2(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var $i="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ",BU1=999,LU1=6,Qi=new Set,OU1=function Z(){let J="";for(let X=0;X<LU1;X++)J+=$i.charAt(Math.floor(Math.random()*$i.length));return J},Ui=function Z(){for(let J=0;J<BU1;J++){let X=OU1();if(!Qi.has(X))return Qi.add(X),X}return""},Wi="https://null.example";class S9{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return DZ.basename(new URL(Z,Wi).pathname)}static extension(Z){return DZ.extension(new URL(Z,Wi).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)}}S9.DEFAULT_INIT={};S9.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var EJ=(Z)=>Z,jU1=new Set;class g2 extends VW{constructor(Z,J=""){super(Z);this[y0].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,EJ)}copy(Z,J=EJ){for(let X in this[y0]){let Y=this[y0][X];if(Y instanceof N5){if(!this[T4].has(X))Y.dispose()}else if(Y instanceof k6||Y instanceof E0)for(let $ of Y.values())$.dispose();else if(Y instanceof $8)for(let $ of Y.values())$.dispose()}for(let X in Z[y0]){let Y=this[y0][X],$=Z[y0][X];if($ instanceof N5)if(this[T4].has(X))Y.getChild().copy(J($.getChild()),J);else this.setRef(X,J($.getChild()),$.getAttributes());else if($ instanceof E0||$ instanceof k6)for(let Q of $.values())this.addRef(X,J(Q.getChild()),Q.getAttributes());else if($ instanceof $8)for(let Q of $.keys()){let W=$.get(Q);this.setRefMap(X,Q,J(W.getChild()),W.getAttributes())}else if(kY($))this[y0][X]=JSON.parse(JSON.stringify($));else if(Array.isArray($)||$ instanceof ArrayBuffer||ArrayBuffer.isView($))this[y0][X]=$.slice();else this[y0][X]=$}return this}equals(Z,J=jU1){if(this===Z)return!0;if(this.propertyType!==Z.propertyType)return!1;for(let X in this[y0]){if(J.has(X))continue;let Y=this[y0][X],$=Z[y0][X];if(Y instanceof N5||$ instanceof N5){if(!FU1(Y,$))return!1}else if(Y instanceof E0||$ instanceof E0||Y instanceof k6||$ instanceof k6){if(!UU1(Y,$))return!1}else if(Y instanceof $8||$ instanceof $8){if(!wU1(Y,$))return!1}else if(kY(Y)||kY($)){if(!Fi(Y,$))return!1}else if(f2(Y)||f2($)){if(!qi(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 I6 extends g2{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new $8})}getExtension(Z){return this.getRefMap("extensions",Z)}setExtension(Z,J){if(J)J._validateParent(this);return this.setRefMap("extensions",Z,J)}listExtensions(){return this.listRefMapValues("extensions")}}class h0 extends I6{init(){this.propertyType=a.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:h0.Type.SCALAR,componentType:h0.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(Z){switch(Z){case h0.Type.SCALAR:return 1;case h0.Type.VEC2:return 2;case h0.Type.VEC3:return 3;case h0.Type.VEC4:return 4;case h0.Type.MAT2:return 4;case h0.Type.MAT3:return 9;case h0.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+Z)}}static getComponentSize(Z){switch(Z){case h0.ComponentType.BYTE:return 1;case h0.ComponentType.UNSIGNED_BYTE:return 1;case h0.ComponentType.SHORT:return 2;case h0.ComponentType.UNSIGNED_SHORT:return 2;case h0.ComponentType.UNSIGNED_INT:return 4;case h0.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+Z)}}getMinNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMin(Z),J)for(let $=0;$<X;$++)Z[$]=i0.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 W=J[$+Q];if(Number.isFinite(W))Z[Q]=Math.min(Z[Q],W)}return Z}getMaxNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMax(Z),J)for(let $=0;$<X;$++)Z[$]=i0.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 W=J[$+Q];if(Number.isFinite(W))Z[Q]=Math.max(Z[Q],W)}return Z}getCount(){let Z=this.get("array");return Z?Z.length/this.getElementSize():0}getType(){return this.get("type")}setType(Z){return this.set("type",Z)}getElementSize(){return h0.getElementSize(this.get("type"))}getComponentSize(){return this.get("array").BYTES_PER_ELEMENT}getComponentType(){return this.get("componentType")}getNormalized(){return this.get("normalized")}setNormalized(Z){return this.set("normalized",Z)}getScalar(Z){let J=this.getElementSize(),X=this.getComponentType(),Y=this.getArray();if(this.getNormalized())return i0.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]=i0.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 W=0;W<Y;W++)if(X)J[W]=i0.decodeNormalizedInt(Q[Z*Y+W],$);else J[W]=Q[Z*Y+W];return J}setElement(Z,J){let X=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();for(let W=0;W<Y;W++)if(X)Q[Z*Y+W]=i0.encodeNormalizedInt(J[W],$);else Q[Z*Y+W]=J[W];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?MU1(Z):h0.ComponentType.FLOAT),this.set("array",Z),this}getByteLength(){let Z=this.get("array");return Z?Z.byteLength:0}}h0.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};h0.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function MU1(Z){switch(Z.constructor){case Float32Array:return h0.ComponentType.FLOAT;case Uint32Array:return h0.ComponentType.UNSIGNED_INT;case Uint16Array:return h0.ComponentType.UNSIGNED_SHORT;case Uint8Array:return h0.ComponentType.UNSIGNED_BYTE;case Int16Array:return h0.ComponentType.SHORT;case Int8Array:return h0.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class JC extends I6{init(){this.propertyType=a.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new E0,samplers:new E0})}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 EY extends I6{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)}}EY.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class qW extends I6{init(){this.propertyType=a.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:qW.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:t5.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:t5.OTHER})}}qW.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class XC extends I6{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 IY extends I6{init(){this.propertyType=a.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:IY.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)}}IY.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class FW extends g2{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}FW.EXTENSION_NAME=void 0;class D5 extends I6{init(){this.propertyType=a.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:D5.WrapMode.REPEAT,wrapT:D5.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)}}D5.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};D5.MagFilter={NEAREST:9728,LINEAR:9729};D5.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:E2,G:I2,B:v2,A:RU1}=h2;class L7 extends I6{init(){this.propertyType=a.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:L7.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new D5(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new D5(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new D5(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new D5(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new D5(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:E2|I2|v2|RU1,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:E2|I2|v2,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:E2|I2|v2})}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:E2})}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:I2|v2})}}L7.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class mG extends I6{init(){this.propertyType=a.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new E0})}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 m2 extends I6{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 E0})}copy(Z,J=EJ){if(J===EJ)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 i0.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 i0.decompose(Z,J,X,Y),this.set("translation",J).set("rotation",X).set("scale",Y)}getWorldTranslation(){let Z=[0,0,0];return i0.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return i0.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return i0.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())HU1(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 E8 extends I6{init(){this.propertyType=a.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:E8.Mode.TRIANGLES,material:null,indices:null,attributes:new $8,targets:new E0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:t5.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:t5.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)}}E8.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class YC extends g2{init(){this.propertyType=a.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new $8})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:t5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function a6(){return a6=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},a6.apply(null,arguments)}class UW extends I6{init(){this.propertyType=a.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new E0})}copy(Z,J=EJ){if(J===EJ)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 $C extends I6{init(){this.propertyType=a.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new E0})}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:t5.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class vY extends I6{init(){this.propertyType=a.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||NZ.extensionToMimeType(DZ.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=NZ.extensionToMimeType(DZ.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",o0.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return NZ.getSize(Z,this.getMimeType())}}class SY extends I6{init(){this.propertyType=a.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${zi}`,version:"2.0"},defaultScene:null,accessors:new E0,animations:new E0,buffers:new E0,cameras:new E0,materials:new E0,meshes:new E0,nodes:new E0,scenes:new E0,skins:new E0,textures:new E0})}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=EJ){if(J===EJ)throw new Error("Root cannot be copied.");this.set("asset",a6({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(a6({},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 UW)this.addRef("scenes",Z);else if(Z instanceof m2)this.addRef("nodes",Z);else if(Z instanceof IY)this.addRef("cameras",Z);else if(Z instanceof $C)this.addRef("skins",Z);else if(Z instanceof mG)this.addRef("meshes",Z);else if(Z instanceof L7)this.addRef("materials",Z);else if(Z instanceof vY)this.addRef("textures",Z);else if(Z instanceof JC)this.addRef("animations",Z);else if(Z instanceof h0)this.addRef("accessors",Z);else if(Z instanceof XC)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 E6{static fromGraph(Z){return E6._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new HW,this._root=new SY(this._graph),this._logger=P5.DEFAULT_INSTANCE,E6._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 UW(this._graph,Z)}createNode(Z=""){return new m2(this._graph,Z)}createCamera(Z=""){return new IY(this._graph,Z)}createSkin(Z=""){return new $C(this._graph,Z)}createMesh(Z=""){return new mG(this._graph,Z)}createPrimitive(){return new E8(this._graph)}createPrimitiveTarget(Z=""){return new YC(this._graph,Z)}createMaterial(Z=""){return new L7(this._graph,Z)}createTexture(Z=""){return new vY(this._graph,Z)}createAnimation(Z=""){return new JC(this._graph,Z)}createAnimationChannel(Z=""){return new EY(this._graph,Z)}createAnimationSampler(Z=""){return new qW(this._graph,Z)}createAccessor(Z="",J=null){if(!J)J=this.getRoot().listBuffers()[0];return new h0(this._graph,Z).setBuffer(J)}createBuffer(Z=""){return new XC(this._graph,Z)}}E6._GRAPH_DOCUMENTS=new WeakMap;class wi{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 FW&&$.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}}wi.EXTENSION_NAME=void 0;class Bi{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 Ki={logger:P5.DEFAULT_INSTANCE,extensions:[],dependencies:{}},NU1=new Set([a.BUFFER,a.TEXTURE,a.MATERIAL,a.MESH,a.PRIMITIVE,a.NODE,a.SCENE]);class Li{static read(Z,J=Ki){let X=a6({},Ki,J),{json:Y}=Z,$=new E6().setLogger(X.logger);this.validate(Z,X);let Q=new Bi(Z),W=Y.asset,K=$.getRoot().getAsset();if(W.copyright)K.copyright=W.copyright;if(W.extras)K.extras=W.extras;if(Y.extras!==void 0)$.getRoot().setExtras(a6({},Y.extras));let G=Y.extensionsUsed||[],z=Y.extensionsRequired||[];X.extensions.sort((D,C)=>D.EXTENSION_NAME>C.EXTENSION_NAME?1:-1);for(let D of X.extensions)if(G.includes(D.EXTENSION_NAME)){let C=$.createExtension(D).setRequired(z.includes(D.EXTENSION_NAME)),T=C.prereadTypes.filter((k)=>!NU1.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 H=Y.buffers||[];$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(a.BUFFER)).forEach((D)=>D.preread(Q,a.BUFFER)),Q.buffers=H.map((D)=>{let C=$.createBuffer(D.name);if(D.extras)C.setExtras(D.extras);if(D.uri&&D.uri.indexOf("__")!==0)C.setURI(D.uri);return C});let V=Y.bufferViews||[];Q.bufferViewBuffers=V.map((D,C)=>{if(!Q.bufferViews[C]){let T=Z.json.buffers[D.buffer],k=T.uri?Z.resources[T.uri]:Z.resources[x2],x=D.byteOffset||0;Q.bufferViews[C]=o0.toView(k,x,D.byteLength)}return Q.buffers[D.buffer]});let q=Y.accessors||[];Q.accessors=q.map((D)=>{let C=Q.bufferViewBuffers[D.bufferView],T=$.createAccessor(D.name,C).setType(D.type);if(D.extras)T.setExtras(D.extras);if(D.normalized!==void 0)T.setNormalized(D.normalized);if(D.bufferView===void 0)return T;return T.setArray(_2(D,Q)),T});let F=Y.images||[],U=Y.textures||[];$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(a.TEXTURE)).forEach((D)=>D.preread(Q,a.TEXTURE)),Q.textures=F.map((D)=>{let C=$.createTexture(D.name);if(D.extras)C.setExtras(D.extras);if(D.bufferView!==void 0){let T=Y.bufferViews[D.bufferView],k=Z.json.buffers[T.buffer],x=k.uri?Z.resources[k.uri]:Z.resources[x2],S=T.byteOffset||0,A=T.byteLength,I=x.slice(S,S+A);C.setImage(I)}else if(D.uri!==void 0){if(C.setImage(Z.resources[D.uri]),D.uri.indexOf("__")!==0)C.setURI(D.uri)}if(D.mimeType!==void 0)C.setMimeType(D.mimeType);else if(D.uri){let T=DZ.extension(D.uri);C.setMimeType(NZ.extensionToMimeType(T))}return C}),$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(a.MATERIAL)).forEach((D)=>D.preread(Q,a.MATERIAL));let B=Y.materials||[];Q.materials=B.map((D)=>{let C=$.createMaterial(D.name);if(D.extras)C.setExtras(D.extras);if(D.alphaMode!==void 0)C.setAlphaMode(D.alphaMode);if(D.alphaCutoff!==void 0)C.setAlphaCutoff(D.alphaCutoff);if(D.doubleSided!==void 0)C.setDoubleSided(D.doubleSided);let T=D.pbrMetallicRoughness||{};if(T.baseColorFactor!==void 0)C.setBaseColorFactor(T.baseColorFactor);if(D.emissiveFactor!==void 0)C.setEmissiveFactor(D.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,x=Q.textures[U[k.index].source];C.setBaseColorTexture(x),Q.setTextureInfo(C.getBaseColorTextureInfo(),k)}if(D.emissiveTexture!==void 0){let k=D.emissiveTexture,x=Q.textures[U[k.index].source];C.setEmissiveTexture(x),Q.setTextureInfo(C.getEmissiveTextureInfo(),k)}if(D.normalTexture!==void 0){let k=D.normalTexture,x=Q.textures[U[k.index].source];if(C.setNormalTexture(x),Q.setTextureInfo(C.getNormalTextureInfo(),k),D.normalTexture.scale!==void 0)C.setNormalScale(D.normalTexture.scale)}if(D.occlusionTexture!==void 0){let k=D.occlusionTexture,x=Q.textures[U[k.index].source];if(C.setOcclusionTexture(x),Q.setTextureInfo(C.getOcclusionTextureInfo(),k),D.occlusionTexture.strength!==void 0)C.setOcclusionStrength(D.occlusionTexture.strength)}if(T.metallicRoughnessTexture!==void 0){let k=T.metallicRoughnessTexture,x=Q.textures[U[k.index].source];C.setMetallicRoughnessTexture(x),Q.setTextureInfo(C.getMetallicRoughnessTextureInfo(),k)}return C}),$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(a.MESH)).forEach((D)=>D.preread(Q,a.MESH));let w=Y.meshes||[];$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(a.PRIMITIVE)).forEach((D)=>D.preread(Q,a.PRIMITIVE)),Q.meshes=w.map((D)=>{let C=$.createMesh(D.name);if(D.extras)C.setExtras(D.extras);if(D.weights!==void 0)C.setWeights(D.weights);return(D.primitives||[]).forEach((k)=>{let x=$.createPrimitive();if(k.extras)x.setExtras(k.extras);if(k.material!==void 0)x.setMaterial(Q.materials[k.material]);if(k.mode!==void 0)x.setMode(k.mode);for(let[I,v]of Object.entries(k.attributes||{}))x.setAttribute(I,Q.accessors[v]);if(k.indices!==void 0)x.setIndices(Q.accessors[k.indices]);let S=D.extras&&D.extras.targetNames||[];(k.targets||[]).forEach((I,v)=>{let b=S[v]||v.toString(),m=$.createPrimitiveTarget(b);for(let[n,o]of Object.entries(I))m.setAttribute(n,Q.accessors[o]);x.addTarget(m)}),C.addPrimitive(x)}),C});let O=Y.cameras||[];Q.cameras=O.map((D)=>{let C=$.createCamera(D.name).setType(D.type);if(D.extras)C.setExtras(D.extras);if(D.type===IY.Type.PERSPECTIVE){let T=D.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=D.orthographic;C.setZNear(T.znear).setZFar(T.zfar).setXMag(T.xmag).setYMag(T.ymag)}return C});let N=Y.nodes||[];$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(a.NODE)).forEach((D)=>D.preread(Q,a.NODE)),Q.nodes=N.map((D)=>{let C=$.createNode(D.name);if(D.extras)C.setExtras(D.extras);if(D.translation!==void 0)C.setTranslation(D.translation);if(D.rotation!==void 0)C.setRotation(D.rotation);if(D.scale!==void 0)C.setScale(D.scale);if(D.matrix!==void 0){let T=[0,0,0],k=[0,0,0,1],x=[1,1,1];i0.decompose(D.matrix,T,k,x),C.setTranslation(T),C.setRotation(k),C.setScale(x)}if(D.weights!==void 0)C.setWeights(D.weights);return C});let R=Y.skins||[];Q.skins=R.map((D)=>{let C=$.createSkin(D.name);if(D.extras)C.setExtras(D.extras);if(D.inverseBindMatrices!==void 0)C.setInverseBindMatrices(Q.accessors[D.inverseBindMatrices]);if(D.skeleton!==void 0)C.setSkeleton(Q.nodes[D.skeleton]);for(let T of D.joints)C.addJoint(Q.nodes[T]);return C}),N.map((D,C)=>{let T=Q.nodes[C];if((D.children||[]).forEach((x)=>T.addChild(Q.nodes[x])),D.mesh!==void 0)T.setMesh(Q.meshes[D.mesh]);if(D.camera!==void 0)T.setCamera(Q.cameras[D.camera]);if(D.skin!==void 0)T.setSkin(Q.skins[D.skin])});let j=Y.animations||[];Q.animations=j.map((D)=>{let C=$.createAnimation(D.name);if(D.extras)C.setExtras(D.extras);let k=(D.samplers||[]).map((S)=>{let A=$.createAnimationSampler().setInput(Q.accessors[S.input]).setOutput(Q.accessors[S.output]).setInterpolation(S.interpolation||qW.Interpolation.LINEAR);if(S.extras)A.setExtras(S.extras);return C.addSampler(A),A});return(D.channels||[]).forEach((S)=>{let A=$.createAnimationChannel().setSampler(k[S.sampler]).setTargetPath(S.target.path);if(S.target.node!==void 0)A.setTargetNode(Q.nodes[S.target.node]);if(S.extras)A.setExtras(S.extras);C.addChannel(A)}),C});let P=Y.scenes||[];if($.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(a.SCENE)).forEach((D)=>D.preread(Q,a.SCENE)),Q.scenes=P.map((D)=>{let C=$.createScene(D.name);if(D.extras)C.setExtras(D.extras);return(D.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((D)=>D.read(Q)),q.forEach((D,C)=>{let T=Q.accessors[C],k=!!D.sparse,x=!D.bufferView&&!T.getArray();if(k||x)T.setSparse(!0).setArray(PU1(D,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 DU1(Z,J){let X=J.jsonDoc,Y=J.bufferViews[Z.bufferView],$=X.json.bufferViews[Z.bufferView],Q=IJ[Z.componentType],W=h0.getElementSize(Z.type),K=Q.BYTES_PER_ELEMENT,G=Z.byteOffset||0,z=new Q(Z.count*W),H=new DataView(Y.buffer,Y.byteOffset,Y.byteLength),V=$.byteStride;for(let q=0;q<Z.count;q++)for(let F=0;F<W;F++){let U=G+q*V+F*K,B;switch(Z.componentType){case h0.ComponentType.FLOAT:B=H.getFloat32(U,!0);break;case h0.ComponentType.UNSIGNED_INT:B=H.getUint32(U,!0);break;case h0.ComponentType.UNSIGNED_SHORT:B=H.getUint16(U,!0);break;case h0.ComponentType.UNSIGNED_BYTE:B=H.getUint8(U);break;case h0.ComponentType.SHORT:B=H.getInt16(U,!0);break;case h0.ComponentType.BYTE:B=H.getInt8(U);break;default:throw new Error(`Unexpected componentType "${Z.componentType}".`)}z[q*W+F]=B}return z}function _2(Z,J){let X=J.jsonDoc,Y=J.bufferViews[Z.bufferView],$=X.json.bufferViews[Z.bufferView],Q=IJ[Z.componentType],W=h0.getElementSize(Z.type),K=Q.BYTES_PER_ELEMENT,G=W*K;if($.byteStride!==void 0&&$.byteStride!==G)return DU1(Z,J);let z=Y.byteOffset+(Z.byteOffset||0),H=Z.count*W*K;return new Q(Y.buffer.slice(z,z+H))}function PU1(Z,J){let X=IJ[Z.componentType],Y=h0.getElementSize(Z.type),$;if(Z.bufferView!==void 0)$=_2(Z,J);else $=new X(Z.count*Y);let Q=Z.sparse;if(!Q)return $;let W=Q.count,K=a6({},Z,Q.indices,{count:W,type:"SCALAR"}),G=a6({},Z,Q.values,{count:W}),z=_2(K,J),H=_2(G,J);for(let V=0;V<K.count;V++)for(let q=0;q<Y;q++)$[z[V]*Y+q]=H[V*Y+q];return $}var gG;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(gG||(gG={}));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 tP($>1,()=>X.basename||"buffer"),this.imageURIGenerator=new tP(Q>1,(W)=>CU1(Z,W)||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 W={index:this.textureDefIndexMap.get(Q)};if(J.getTexCoord()!==0)W.texCoord=J.getTexCoord();if(Object.keys(J.getExtras()).length>0)W.extras=J.getExtras();return this.textureInfoDefMap.set(J,W),W}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===RZ.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=NZ.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 t5.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 t5.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=gG;kJ.BufferViewUsage=t5;kJ.USAGE_TO_TARGET={[t5.ARRAY_BUFFER]:gG.ARRAY_BUFFER,[t5.ELEMENT_ARRAY_BUFFER]:gG.ELEMENT_ARRAY_BUFFER};class tP{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 CU1(Z,J){let X=Z.getGraph().listParentEdges(J).find((Y)=>Y.getParent()!==Z.getRoot());return X?X.getName().replace(/texture$/i,""):""}var{BufferViewUsage:S2}=kJ,{UNSIGNED_INT:TU1,UNSIGNED_SHORT:kU1,UNSIGNED_BYTE:EU1}=h0.ComponentType,IU1=new Set([a.ACCESSOR,a.BUFFER,a.MATERIAL,a.MESH]);class Oi{static write(Z,J){let X=Z.getGraph(),Y=Z.getRoot(),$={asset:a6({generator:`glTF-Transform ${zi}`},Y.getAsset()),extras:a6({},Y.getExtras())},Q={json:$,resources:{}},W=new kJ(Z,Q,J),K=J.logger||P5.DEFAULT_INSTANCE,G=new Set(J.extensions.map((w)=>w.EXTENSION_NAME)),z=Z.getRoot().listExtensionsUsed().filter((w)=>G.has(w.extensionName)).sort((w,O)=>w.extensionName>O.extensionName?1:-1),H=Z.getRoot().listExtensionsRequired().filter((w)=>G.has(w.extensionName)).sort((w,O)=>w.extensionName>O.extensionName?1:-1);if(z.length<Z.getRoot().listExtensionsUsed().length)K.warn("Some extensions were not registered for I/O, and will not be written.");for(let w of z){let O=w.prewriteTypes.filter((N)=>!IU1.has(N));if(O.length)K.warn(`Prewrite hooks for some types (${O.join()}), requested by extension ${w.extensionName}, are unsupported. Please file an issue or a PR.`);for(let N of w.writeDependencies)w.install(N,J.dependencies[N])}function V(w,O,N,R){let j=[],P=0;for(let T of w){let k=W.createAccessorDef(T);k.bufferView=$.bufferViews.length;let x=T.getArray(),S=o0.pad(o0.toView(x));k.byteOffset=P,P+=S.byteLength,j.push(S),W.accessorIndexMap.set(T,$.accessors.length),$.accessors.push(k)}let D=o0.concat(j),C={buffer:O,byteOffset:N,byteLength:D.byteLength};if(R)C.target=R;return $.bufferViews.push(C),{buffers:j,byteLength:P}}function q(w,O,N){let R=w[0].getCount(),j=0;for(let k of w){let x=W.createAccessorDef(k);x.bufferView=$.bufferViews.length,x.byteOffset=j;let S=k.getElementSize(),A=k.getComponentSize();j+=o0.padNumber(S*A),W.accessorIndexMap.set(k,$.accessors.length),$.accessors.push(x)}let P=R*j,D=new ArrayBuffer(P),C=new DataView(D);for(let k=0;k<R;k++){let x=0;for(let S of w){let A=S.getElementSize(),I=S.getComponentSize(),v=S.getComponentType(),b=S.getArray();for(let m=0;m<A;m++){let n=k*j+x+m*I,o=b[k*A+m];switch(v){case h0.ComponentType.FLOAT:C.setFloat32(n,o,!0);break;case h0.ComponentType.BYTE:C.setInt8(n,o);break;case h0.ComponentType.SHORT:C.setInt16(n,o,!0);break;case h0.ComponentType.UNSIGNED_BYTE:C.setUint8(n,o);break;case h0.ComponentType.UNSIGNED_SHORT:C.setUint16(n,o,!0);break;case h0.ComponentType.UNSIGNED_INT:C.setUint32(n,o,!0);break;default:throw new Error("Unexpected component type: "+v)}}x+=o0.padNumber(A*I)}}let T={buffer:O,byteOffset:N,byteLength:P,byteStride:j,target:kJ.BufferViewTarget.ARRAY_BUFFER};return $.bufferViews.push(T),{byteLength:P,buffers:[new Uint8Array(D)]}}function F(w,O,N){let R=[],j=0,P=new Map,D=-1/0,C=!1;for(let v of w){let b=W.createAccessorDef(v);$.accessors.push(b),W.accessorIndexMap.set(v,$.accessors.length-1);let m=[],n=[],o=[],Q0=new Array(v.getElementSize()).fill(0);for(let r0=0,f8=v.getCount();r0<f8;r0++){if(v.getElement(r0,o),i0.eq(o,Q0,0))continue;D=Math.max(r0,D),m.push(r0);for(let X8=0;X8<o.length;X8++)n.push(o[X8])}let K0=m.length,_0={accessorDef:b,count:K0};if(P.set(v,_0),K0===0)continue;if(K0>v.getCount()/2)C=!0;let x0=IJ[v.getComponentType()];_0.indices=m,_0.values=new x0(n)}if(!Number.isFinite(D))return{buffers:R,byteLength:j};if(C)K.warn("Some sparse accessors have >50% non-zero elements, which may increase file size.");let T=D<255?Uint8Array:D<65535?Uint16Array:Uint32Array,k=D<255?EU1:D<65535?kU1:TU1,x={buffer:O,byteOffset:N+j,byteLength:0};for(let v of w){let b=P.get(v);if(b.count===0)continue;b.indicesByteOffset=x.byteLength;let m=o0.pad(o0.toView(new T(b.indices)));R.push(m),j+=m.byteLength,x.byteLength+=m.byteLength}$.bufferViews.push(x);let S=$.bufferViews.length-1,A={buffer:O,byteOffset:N+j,byteLength:0};for(let v of w){let b=P.get(v);if(b.count===0)continue;b.valuesByteOffset=A.byteLength;let m=o0.pad(o0.toView(b.values));R.push(m),j+=m.byteLength,A.byteLength+=m.byteLength}$.bufferViews.push(A);let I=$.bufferViews.length-1;for(let v of w){let b=P.get(v);if(b.count===0)continue;b.accessorDef.sparse={count:b.count,indices:{bufferView:S,byteOffset:b.indicesByteOffset,componentType:k},values:{bufferView:I,byteOffset:b.valuesByteOffset}}}return{buffers:R,byteLength:j}}if($.accessors=[],$.bufferViews=[],$.samplers=[],$.textures=[],$.images=Y.listTextures().map((w,O)=>{let N=W.createPropertyDef(w);if(w.getMimeType())N.mimeType=w.getMimeType();let R=w.getImage();if(R)W.createImageData(N,R,w);return W.imageIndexMap.set(w,O),N}),z.filter((w)=>w.prewriteTypes.includes(a.ACCESSOR)).forEach((w)=>w.prewrite(W,a.ACCESSOR)),Y.listAccessors().forEach((w)=>{let{accessorUsageGroupedByParent:O,accessorParents:N}=W;if(W.accessorIndexMap.has(w))return;let R=W.getAccessorUsage(w);if(W.addAccessorToUsageGroup(w,R),O.has(R)){let j=X.listParents(w).find((P)=>P.propertyType!==a.ROOT);N.set(w,j)}}),z.filter((w)=>w.prewriteTypes.includes(a.BUFFER)).forEach((w)=>w.prewrite(W,a.BUFFER)),(Y.listAccessors().length>0||W.otherBufferViews.size>0||Y.listTextures().length>0&&J.format===RZ.GLB)&&Y.listBuffers().length===0)throw new Error("Buffer required for Document resources, but none was found.");if($.buffers=[],Y.listBuffers().forEach((w,O)=>{let N=W.createPropertyDef(w),R=W.accessorUsageGroupedByParent,j=w.listParents().filter((A)=>A instanceof h0),P=new Set(j.map((A)=>W.accessorParents.get(A))),D=new Map(Array.from(P).map((A,I)=>[A,I])),C={};for(let A of j){var T;if(W.accessorIndexMap.has(A))continue;let I=W.getAccessorUsage(A),v=I;if(R.has(I)){let b=W.accessorParents.get(A);v+=`:${D.get(b)}`}C[T=v]||(C[T]={usage:I,accessors:[]}),C[v].accessors.push(A)}let k=[],x=$.buffers.length,S=0;for(let{usage:A,accessors:I}of Object.values(C))if(A===S2.ARRAY_BUFFER&&J.vertexLayout===A2.INTERLEAVED){let v=q(I,x,S);S+=v.byteLength;for(let b of v.buffers)k.push(b)}else if(A===S2.ARRAY_BUFFER)for(let v of I){let b=q([v],x,S);S+=b.byteLength;for(let m of b.buffers)k.push(m)}else if(A===S2.SPARSE){let v=F(I,x,S);S+=v.byteLength;for(let b of v.buffers)k.push(b)}else if(A===S2.ELEMENT_ARRAY_BUFFER){let v=kJ.BufferViewTarget.ELEMENT_ARRAY_BUFFER,b=V(I,x,S,v);S+=b.byteLength;for(let m of b.buffers)k.push(m)}else{let v=V(I,x,S);S+=v.byteLength;for(let b of v.buffers)k.push(b)}if(W.imageBufferViews.length&&O===0){for(let A=0;A<W.imageBufferViews.length;A++)if($.bufferViews[$.images[A].bufferView].byteOffset=S,S+=W.imageBufferViews[A].byteLength,k.push(W.imageBufferViews[A]),S%8){let I=8-S%8;S+=I,k.push(new Uint8Array(I))}}if(W.otherBufferViews.has(w))for(let A of W.otherBufferViews.get(w))$.bufferViews.push({buffer:x,byteOffset:S,byteLength:A.byteLength}),W.otherBufferViewsIndexMap.set(A,$.bufferViews.length-1),S+=A.byteLength,k.push(A);if(S){let A;if(J.format===RZ.GLB)A=x2;else A=W.bufferURIGenerator.createURI(w,"bin"),N.uri=A;N.byteLength=S,W.assignResourceURI(A,o0.concat(k),!0)}$.buffers.push(N),W.bufferIndexMap.set(w,O)}),Y.listAccessors().find((w)=>!w.getBuffer()))K.warn("Skipped writing one or more Accessors: no Buffer assigned.");z.filter((w)=>w.prewriteTypes.includes(a.MATERIAL)).forEach((w)=>w.prewrite(W,a.MATERIAL)),$.materials=Y.listMaterials().map((w,O)=>{let N=W.createPropertyDef(w);if(w.getAlphaMode()!==L7.AlphaMode.OPAQUE)N.alphaMode=w.getAlphaMode();if(w.getAlphaMode()===L7.AlphaMode.MASK)N.alphaCutoff=w.getAlphaCutoff();if(w.getDoubleSided())N.doubleSided=!0;if(N.pbrMetallicRoughness={},!i0.eq(w.getBaseColorFactor(),[1,1,1,1]))N.pbrMetallicRoughness.baseColorFactor=w.getBaseColorFactor();if(!i0.eq(w.getEmissiveFactor(),[0,0,0]))N.emissiveFactor=w.getEmissiveFactor();if(w.getRoughnessFactor()!==1)N.pbrMetallicRoughness.roughnessFactor=w.getRoughnessFactor();if(w.getMetallicFactor()!==1)N.pbrMetallicRoughness.metallicFactor=w.getMetallicFactor();if(w.getBaseColorTexture()){let R=w.getBaseColorTexture(),j=w.getBaseColorTextureInfo();N.pbrMetallicRoughness.baseColorTexture=W.createTextureInfoDef(R,j)}if(w.getEmissiveTexture()){let R=w.getEmissiveTexture(),j=w.getEmissiveTextureInfo();N.emissiveTexture=W.createTextureInfoDef(R,j)}if(w.getNormalTexture()){let R=w.getNormalTexture(),j=w.getNormalTextureInfo(),P=W.createTextureInfoDef(R,j);if(w.getNormalScale()!==1)P.scale=w.getNormalScale();N.normalTexture=P}if(w.getOcclusionTexture()){let R=w.getOcclusionTexture(),j=w.getOcclusionTextureInfo(),P=W.createTextureInfoDef(R,j);if(w.getOcclusionStrength()!==1)P.strength=w.getOcclusionStrength();N.occlusionTexture=P}if(w.getMetallicRoughnessTexture()){let R=w.getMetallicRoughnessTexture(),j=w.getMetallicRoughnessTextureInfo();N.pbrMetallicRoughness.metallicRoughnessTexture=W.createTextureInfoDef(R,j)}return W.materialIndexMap.set(w,O),N}),z.filter((w)=>w.prewriteTypes.includes(a.MESH)).forEach((w)=>w.prewrite(W,a.MESH)),$.meshes=Y.listMeshes().map((w,O)=>{let N=W.createPropertyDef(w),R=null;if(N.primitives=w.listPrimitives().map((j)=>{let P={attributes:{}};P.mode=j.getMode();let D=j.getMaterial();if(D)P.material=W.materialIndexMap.get(D);if(Object.keys(j.getExtras()).length)P.extras=j.getExtras();let C=j.getIndices();if(C)P.indices=W.accessorIndexMap.get(C);for(let T of j.listSemantics())P.attributes[T]=W.accessorIndexMap.get(j.getAttribute(T));for(let T of j.listTargets()){let k={};for(let x of T.listSemantics())k[x]=W.accessorIndexMap.get(T.getAttribute(x));P.targets=P.targets||[],P.targets.push(k)}if(j.listTargets().length&&!R)R=j.listTargets().map((T)=>T.getName());return P}),w.getWeights().length)N.weights=w.getWeights();if(R)N.extras=N.extras||{},N.extras.targetNames=R;return W.meshIndexMap.set(w,O),N}),$.cameras=Y.listCameras().map((w,O)=>{let N=W.createPropertyDef(w);if(N.type=w.getType(),N.type===IY.Type.PERSPECTIVE){N.perspective={znear:w.getZNear(),zfar:w.getZFar(),yfov:w.getYFov()};let R=w.getAspectRatio();if(R!==null)N.perspective.aspectRatio=R}else N.orthographic={znear:w.getZNear(),zfar:w.getZFar(),xmag:w.getXMag(),ymag:w.getYMag()};return W.cameraIndexMap.set(w,O),N}),$.nodes=Y.listNodes().map((w,O)=>{let N=W.createPropertyDef(w);if(!i0.eq(w.getTranslation(),[0,0,0]))N.translation=w.getTranslation();if(!i0.eq(w.getRotation(),[0,0,0,1]))N.rotation=w.getRotation();if(!i0.eq(w.getScale(),[1,1,1]))N.scale=w.getScale();if(w.getWeights().length)N.weights=w.getWeights();return W.nodeIndexMap.set(w,O),N}),$.skins=Y.listSkins().map((w,O)=>{let N=W.createPropertyDef(w),R=w.getInverseBindMatrices();if(R)N.inverseBindMatrices=W.accessorIndexMap.get(R);let j=w.getSkeleton();if(j)N.skeleton=W.nodeIndexMap.get(j);return N.joints=w.listJoints().map((P)=>W.nodeIndexMap.get(P)),W.skinIndexMap.set(w,O),N}),Y.listNodes().forEach((w,O)=>{let N=$.nodes[O],R=w.getMesh();if(R)N.mesh=W.meshIndexMap.get(R);let j=w.getCamera();if(j)N.camera=W.cameraIndexMap.get(j);let P=w.getSkin();if(P)N.skin=W.skinIndexMap.get(P);if(w.listChildren().length>0)N.children=w.listChildren().map((D)=>W.nodeIndexMap.get(D))}),$.animations=Y.listAnimations().map((w,O)=>{let N=W.createPropertyDef(w),R=new Map;return N.samplers=w.listSamplers().map((j,P)=>{let D=W.createPropertyDef(j);return D.input=W.accessorIndexMap.get(j.getInput()),D.output=W.accessorIndexMap.get(j.getOutput()),D.interpolation=j.getInterpolation(),R.set(j,P),D}),N.channels=w.listChannels().map((j)=>{let P=W.createPropertyDef(j);return P.sampler=R.get(j.getSampler()),P.target={node:W.nodeIndexMap.get(j.getTargetNode()),path:j.getTargetPath()},P}),W.animationIndexMap.set(w,O),N}),$.scenes=Y.listScenes().map((w,O)=>{let N=W.createPropertyDef(w);return N.nodes=w.listChildren().map((R)=>W.nodeIndexMap.get(R)),W.sceneIndexMap.set(w,O),N});let B=Y.getDefaultScene();if(B)$.scene=Y.listScenes().indexOf(B);return $.extensionsUsed=z.map((w)=>w.extensionName),$.extensionsRequired=H.map((w)=>w.extensionName),z.forEach((w)=>w.write(W)),vU1($),Q}}function vU1(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 b2;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(b2||(b2={}));class ji{constructor(){this._logger=P5.DEFAULT_INSTANCE,this._extensions=new Set,this._dependencies={},this._vertexLayout=A2.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=Gi(J)?this._binaryToJSON(J):{json:JSON.parse(o0.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),Li.read(Z,{extensions:Array.from(this._extensions),dependencies:this._dependencies,logger:this._logger})}async binaryToJSON(Z){let J=this._binaryToJSON(o0.assertView(Z));this._readResourcesInternal(J);let X=J.json;if(X.buffers&&X.buffers.some((Y)=>SU1(J,Y)))throw new Error("Cannot resolve external buffers with binaryToJSON().");else if(X.images&&X.images.some((Y)=>_U1(J,Y)))throw new Error("Cannot resolve external images with binaryToJSON().");return J}async readBinary(Z){return this.readJSON(await this.binaryToJSON(o0.assertView(Z)))}async writeJSON(Z,J={}){if(J.format===RZ.GLB&&Z.getRoot().listBuffers().length>1)throw new Error("GLB must have 0\u20131 buffers.");return Oi.write(Z,{format:J.format||RZ.GLTF,basename:J.basename||"",logger:this._logger,vertexLayout:this._vertexLayout,dependencies:a6({},this._dependencies),extensions:Array.from(this._extensions)})}async writeBinary(Z){let{json:J,resources:X}=await this.writeJSON(Z,{format:RZ.GLB}),Y=new Uint32Array([1179937895,2,12]),$=JSON.stringify(J),Q=o0.pad(o0.encodeText($),32),W=o0.toView(new Uint32Array([Q.byteLength,1313821514])),K=o0.concat([W,Q]);Y[Y.length-1]+=K.byteLength;let G=Object.values(X)[0];if(!G||!G.byteLength)return o0.concat([o0.toView(Y),K]);let z=o0.pad(G,0),H=o0.toView(new Uint32Array([z.byteLength,5130562])),V=o0.concat([H,z]);return Y[Y.length-1]+=V.byteLength,o0.concat([o0.toView(Y),K,V])}async _readResourcesExternal(Z,J){var X=this;let Y=Z.json.images||[],$=Z.json.buffers||[],Q=[...Y,...$].map(async function(W){let K=W.uri;if(!K||K.match(/data:/))return Promise.resolve();Z.resources[K]=await X.readURI(X.resolve(J,K),"view"),X.lastReadBytes+=Z.resources[K].byteLength});await Promise.all(Q)}_readResourcesInternal(Z){function J($){if(!$.uri)return;if($.uri in Z.resources){o0.assertView(Z.resources[$.uri]);return}if($.uri.match(/data:/)){let Q=`__${Ui()}.${DZ.extension($.uri)}`;Z.resources[Q]=o0.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:a6({},Z.json),resources:a6({},Z.resources)},J)Z.json.images=J.map((Y)=>a6({},Y));if(X)Z.json.buffers=X.map((Y)=>a6({},Y));return Z}_binaryToJSON(Z){if(!Gi(Z))throw new Error("Invalid glTF 2.0 binary.");let J=new Uint32Array(Z.buffer,Z.byteOffset+12,2);if(J[1]!==b2.JSON)throw new Error("Missing required GLB JSON chunk.");let X=20,Y=J[0],$=o0.decodeText(o0.toView(Z,X,Y)),Q=JSON.parse($),W=X+Y;if(Z.byteLength<=W)return{json:Q,resources:{}};let K=new Uint32Array(Z.buffer,Z.byteOffset+W,2);if(K[1]!==b2.BIN)return{json:Q,resources:{}};let G=K[0],z=o0.toView(Z,W+8,G);return{json:Q,resources:{[x2]:z}}}}function SU1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)}function _U1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)&&J.bufferView===void 0}function Gi(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 QC extends ji{constructor(Z=null,J=S9.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(),S9.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(S9.isAbsoluteURL(Z)||S9.isAbsoluteURL(J))return S9.resolve(Z,J);return this._path.resolve(Z,decodeURIComponent(J))}dirname(Z){if(S9.isAbsoluteURL(Z))return S9.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:RZ.GLTF,basename:DZ.basename(Z)}),{_fs:Q,_path:W}=this,K=W.dirname(Z),G=JSON.stringify(Y,null,2);await Q.writeFile(Z,G),this.lastWriteBytes+=G.length;for(let z of xU1(Object.keys($),10))await Promise.all(z.map(async function(H){if(S9.isAbsoluteURL(H)){if(S9.extension(H)==="bin")throw new Error(`Cannot write buffer to path "${H}".`);return}let V=W.join(K,decodeURIComponent(H));await Q.mkdir(W.dirname(V),{recursive:!0}),await Q.writeFile(V,$[H]),X.lastWriteBytes+=$[H].byteLength}))}async _writeGLB(Z,J){let X=await this.writeBinary(J);await this._fs.writeFile(Z,X),this.lastWriteBytes=X.byteLength}}function xU1(Z,J){let X=[];for(let Y=0,$=Z.length;Y<$;Y+=J){let Q=[];for(let W=0;W<J&&Y+W<$;W++)Q.push(Z[Y+W]);X.push(Q)}return X}var Bs=e(WC(),1),Ls=e(ea(),1),PO1=e(ws(),1);async function CO1(Z,J){if(!(Z instanceof Uint8Array))throw new Error("[ndarray-pixels] Input must be Uint8Array or Buffer.");let{data:X,info:Y}=await Ls.default(Z).ensureAlpha().raw().toBuffer({resolveWithObject:!0});return Bs.default(new Uint8Array(X),[Y.width,Y.height,4],[4,4*Y.width|0,1],0)}async function Os(Z,J){return CO1(Z)}var TO1="v4.1.3",yC="@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 js;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(js||(js={}));var J9;(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"})(J9||(J9={}));var X9;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(X9||(X9={}));var _C;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(_C||(_C={}));var xC=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 kO1(){var Z=new xC(3);if(xC!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function SC(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function EO1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=X[3]*Y+X[7]*$+X[11]*Q+X[15];return W=W||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/W,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/W,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/W,Z}(function(){var Z=kO1();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}})();function Ds(Z){let J=Ps(),X=Z.propertyType===s.NODE?[Z]:Z.listChildren();for(let Y of X)Y.traverse(($)=>{let Q=$.getMesh();if(!Q)return;let W=IO1(Q,$.getWorldMatrix());if(W.min.every(isFinite)&&W.max.every(isFinite))AC(W.min,J),AC(W.max,J)});return J}function IO1(Z,J){let X=Ps();for(let Y of Z.listPrimitives()){let $=Y.getAttribute("POSITION"),Q=Y.getIndices();if(!$)continue;let W=[0,0,0],K=[0,0,0];for(let G=0,z=Q?Q.getCount():$.getCount();G<z;G++){let H=Q?Q.getScalar(G):G;W=$.getElement(H,W),K=EO1(K,W,J),AC(K,X)}}return X}function AC(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 Ps(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class v6{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 Cs{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),vO1(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 ww{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(v6.decodeText(Z.slice(12,16))===ww.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}}ww.PNG_FRIED_CHUNK_NAME="CgBI";class E4{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}`}}E4.impls={"image/jpeg":new Cs,"image/png":new ww};function vO1(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 oG{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 E4.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 Ms(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function hY(Z){if(Ms(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let X=J.prototype;if(Ms(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}var hC,fC;(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"})(fC||(fC={}));class D7{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=D7.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=D7.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=D7.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=D7.Verbosity.ERROR)console.error(Z)}}hC=D7;D7.Verbosity=fC;D7.DEFAULT_INSTANCE=new hC(hC.Verbosity.INFO);function SO1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],W=Z[5],K=Z[6],G=Z[7],z=Z[8],H=Z[9],V=Z[10],q=Z[11],F=Z[12],U=Z[13],B=Z[14],w=Z[15],O=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,j=X*K-Y*W,P=X*G-$*W,D=Y*G-$*K,C=z*U-H*F,T=z*B-V*F,k=z*w-q*F,x=H*B-V*U,S=H*w-q*U,A=V*w-q*B;return O*A-N*S+R*x+j*k-P*T+D*C}function _O1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=J[9],F=J[10],U=J[11],B=J[12],w=J[13],O=J[14],N=J[15],R=X[0],j=X[1],P=X[2],D=X[3];return Z[0]=R*Y+j*K+P*V+D*B,Z[1]=R*$+j*G+P*q+D*w,Z[2]=R*Q+j*z+P*F+D*O,Z[3]=R*W+j*H+P*U+D*N,R=X[4],j=X[5],P=X[6],D=X[7],Z[4]=R*Y+j*K+P*V+D*B,Z[5]=R*$+j*G+P*q+D*w,Z[6]=R*Q+j*z+P*F+D*O,Z[7]=R*W+j*H+P*U+D*N,R=X[8],j=X[9],P=X[10],D=X[11],Z[8]=R*Y+j*K+P*V+D*B,Z[9]=R*$+j*G+P*q+D*w,Z[10]=R*Q+j*z+P*F+D*O,Z[11]=R*W+j*H+P*U+D*N,R=X[12],j=X[13],P=X[14],D=X[15],Z[12]=R*Y+j*K+P*V+D*B,Z[13]=R*$+j*G+P*q+D*w,Z[14]=R*Q+j*z+P*F+D*O,Z[15]=R*W+j*H+P*U+D*N,Z}function xO1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[4],W=J[5],K=J[6],G=J[8],z=J[9],H=J[10];return Z[0]=Math.hypot(X,Y,$),Z[1]=Math.hypot(Q,W,K),Z[2]=Math.hypot(G,z,H),Z}function AO1(Z,J){var X=new xC(3);xO1(X,J);var Y=1/X[0],$=1/X[1],Q=1/X[2],W=J[0]*Y,K=J[1]*$,G=J[2]*Q,z=J[4]*Y,H=J[5]*$,V=J[6]*Q,q=J[8]*Y,F=J[9]*$,U=J[10]*Q,B=W+H+U,w=0;if(B>0)w=Math.sqrt(B+1)*2,Z[3]=0.25*w,Z[0]=(V-F)/w,Z[1]=(q-G)/w,Z[2]=(K-z)/w;else if(W>H&&W>U)w=Math.sqrt(1+W-H-U)*2,Z[3]=(V-F)/w,Z[0]=0.25*w,Z[1]=(K+z)/w,Z[2]=(q+G)/w;else if(H>U)w=Math.sqrt(1+H-W-U)*2,Z[3]=(q-G)/w,Z[0]=(K+z)/w,Z[1]=0.25*w,Z[2]=(V+F)/w;else w=Math.sqrt(1+U-W-H)*2,Z[3]=(K-z)/w,Z[0]=(q+G)/w,Z[1]=(V+F)/w,Z[2]=0.25*w;return Z}class F8{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(F8.clamp(Z,0,1)*65535);case 5121:return Math.round(F8.clamp(Z,0,1)*255);case 5122:return Math.round(F8.clamp(Z,-1,1)*32767);case 5120:return Math.round(F8.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,X,Y){let $=SC([Z[0],Z[1],Z[2]]),Q=SC([Z[4],Z[5],Z[6]]),W=SC([Z[8],Z[9],Z[10]]);if(SO1(Z)<0)$=-$;J[0]=Z[12],J[1]=Z[13],J[2]=Z[14];let G=Z.slice(),z=1/$,H=1/Q,V=1/W;G[0]*=z,G[1]*=z,G[2]*=z,G[4]*=H,G[5]*=H,G[6]*=H,G[8]*=V,G[9]*=V,G[10]*=V,AO1(X,G),Y[0]=$,Y[1]=Q,Y[2]=W}static compose(Z,J,X,Y){let $=Y,Q=J[0],W=J[1],K=J[2],G=J[3],z=Q+Q,H=W+W,V=K+K,q=Q*z,F=Q*H,U=Q*V,B=W*H,w=W*V,O=K*V,N=G*z,R=G*H,j=G*V,P=X[0],D=X[1],C=X[2];return $[0]=(1-(B+O))*P,$[1]=(F+j)*P,$[2]=(U-R)*P,$[3]=0,$[4]=(F-j)*D,$[5]=(1-(q+O))*D,$[6]=(w+N)*D,$[7]=0,$[8]=(U+R)*C,$[9]=(w-N)*C,$[10]=(1-(q+B))*C,$[11]=0,$[12]=Z[0],$[13]=Z[1],$[14]=Z[2],$[15]=1,$}}function hO1(Z,J){if(!!Z!==!!J)return!1;let X=Z.getChild(),Y=J.getChild();return X===Y||X.equals(Y)}function fO1(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[$],W=Y[$];if(Q.getChild()===W.getChild())continue;if(!Q.getChild().equals(W.getChild()))return!1}return!0}function bO1(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($),W=J.get($);if(!!Q!==!!W)return!1;let K=Q.getChild(),G=W.getChild();if(K===G)continue;if(!K.equals(G))return!1}return!0}function Ts(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 ks(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!hY(Z)||!hY(J))return Z===J;let X=Z,Y=J,$=0,Q=0,W;for(W in X)$++;for(W in Y)Q++;if($!==Q)return!1;for(W in X){let K=X[W],G=Y[W];if(qw(K)&&qw(G)){if(!Ts(K,G))return!1}else if(hY(K)&&hY(G)){if(!ks(K,G))return!1}else if(K!==G)return!1}return!0}function qw(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var Rs="https://null.example";class gC{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return oG.basename(new URL(Z,Rs).pathname)}static extension(Z){return oG.extension(new URL(Z,Rs).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)}}gC.DEFAULT_INIT={};gC.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var hJ=(Z)=>Z,yO1=new Set;class Bw extends VW{constructor(Z,J=""){super(Z);this[y0].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,hJ)}copy(Z,J=hJ){for(let X in this[y0]){let Y=this[y0][X];if(Y instanceof N5){if(!this[T4].has(X))Y.dispose()}else if(Y instanceof k6||Y instanceof E0)for(let $ of Y.values())$.dispose();else if(Y instanceof $8)for(let $ of Y.values())$.dispose()}for(let X in Z[y0]){let Y=this[y0][X],$=Z[y0][X];if($ instanceof N5)if(this[T4].has(X))Y.getChild().copy(J($.getChild()),J);else this.setRef(X,J($.getChild()),$.getAttributes());else if($ instanceof E0||$ instanceof k6)for(let Q of $.values())this.addRef(X,J(Q.getChild()),Q.getAttributes());else if($ instanceof $8)for(let Q of $.keys()){let W=$.get(Q);this.setRefMap(X,Q,J(W.getChild()),W.getAttributes())}else if(hY($))this[y0][X]=JSON.parse(JSON.stringify($));else if(Array.isArray($)||$ instanceof ArrayBuffer||ArrayBuffer.isView($))this[y0][X]=$.slice();else this[y0][X]=$}return this}equals(Z,J=yO1){if(this===Z)return!0;if(this.propertyType!==Z.propertyType)return!1;for(let X in this[y0]){if(J.has(X))continue;let Y=this[y0][X],$=Z[y0][X];if(Y instanceof N5||$ instanceof N5){if(!hO1(Y,$))return!1}else if(Y instanceof E0||$ instanceof E0||Y instanceof k6||$ instanceof k6){if(!fO1(Y,$))return!1}else if(Y instanceof $8||$ instanceof $8){if(!bO1(Y,$))return!1}else if(hY(Y)||hY($)){if(!ks(Y,$))return!1}else if(qw(Y)||qw($)){if(!Ts(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 S6 extends Bw{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new $8})}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 k0 extends S6{init(){this.propertyType=s.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:k0.Type.SCALAR,componentType:k0.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(Z){switch(Z){case k0.Type.SCALAR:return 1;case k0.Type.VEC2:return 2;case k0.Type.VEC3:return 3;case k0.Type.VEC4:return 4;case k0.Type.MAT2:return 4;case k0.Type.MAT3:return 9;case k0.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+Z)}}static getComponentSize(Z){switch(Z){case k0.ComponentType.BYTE:return 1;case k0.ComponentType.UNSIGNED_BYTE:return 1;case k0.ComponentType.SHORT:return 2;case k0.ComponentType.UNSIGNED_SHORT:return 2;case k0.ComponentType.UNSIGNED_INT:return 4;case k0.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[$]=F8.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 W=J[$+Q];if(Number.isFinite(W))Z[Q]=Math.min(Z[Q],W)}return Z}getMaxNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMax(Z),J)for(let $=0;$<X;$++)Z[$]=F8.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 W=J[$+Q];if(Number.isFinite(W))Z[Q]=Math.max(Z[Q],W)}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 k0.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 F8.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]=F8.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 W=0;W<Y;W++)if(X)J[W]=F8.decodeNormalizedInt(Q[Z*Y+W],$);else J[W]=Q[Z*Y+W];return J}setElement(Z,J){let X=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();for(let W=0;W<Y;W++)if(X)Q[Z*Y+W]=F8.encodeNormalizedInt(J[W],$);else Q[Z*Y+W]=J[W];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?gO1(Z):k0.ComponentType.FLOAT),this.set("array",Z),this}getByteLength(){let Z=this.get("array");return Z?Z.byteLength:0}}k0.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};k0.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function gO1(Z){switch(Z.constructor){case Float32Array:return k0.ComponentType.FLOAT;case Uint32Array:return k0.ComponentType.UNSIGNED_INT;case Uint16Array:return k0.ComponentType.UNSIGNED_SHORT;case Uint8Array:return k0.ComponentType.UNSIGNED_BYTE;case Int16Array:return k0.ComponentType.SHORT;case Int8Array:return k0.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class mC extends S6{init(){this.propertyType=s.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new E0,samplers:new E0})}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 tG extends S6{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)}}tG.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class PW extends S6{init(){this.propertyType=s.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:PW.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:J9.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:J9.OTHER})}}PW.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class uC extends S6{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 eG extends S6{init(){this.propertyType=s.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:eG.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)}}eG.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class t1 extends Bw{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}t1.EXTENSION_NAME=void 0;class I1 extends S6{init(){this.propertyType=s.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:I1.WrapMode.REPEAT,wrapT:I1.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)}}I1.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};I1.MagFilter={NEAREST:9728,LINEAR:9729};I1.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:zw,G:Hw,B:Vw,A:mO1}=X9;class Zz extends S6{init(){this.propertyType=s.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:Zz.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new I1(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new I1(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new I1(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new I1(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new I1(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:zw|Hw|Vw|mO1,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:zw|Hw|Vw,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:zw|Hw|Vw})}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:zw})}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:Hw|Vw})}}Zz.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class dC extends S6{init(){this.propertyType=s.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new E0})}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 cC extends S6{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 E0})}copy(Z,J=hJ){if(J===hJ)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 F8.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 F8.decompose(Z,J,X,Y),this.set("translation",J).set("rotation",X).set("scale",Y)}getWorldTranslation(){let Z=[0,0,0];return F8.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return F8.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return F8.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())_O1(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 fJ extends S6{init(){this.propertyType=s.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:fJ.Mode.TRIANGLES,material:null,indices:null,attributes:new $8,targets:new E0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:J9.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:J9.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)}}fJ.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class Es extends Bw{init(){this.propertyType=s.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new $8})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:J9.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function Fw(){return Fw=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},Fw.apply(null,arguments)}class lC extends S6{init(){this.propertyType=s.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new E0})}copy(Z,J=hJ){if(J===hJ)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 pC extends S6{init(){this.propertyType=s.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new E0})}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:J9.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class iC extends S6{init(){this.propertyType=s.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||E4.extensionToMimeType(oG.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=E4.extensionToMimeType(oG.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",v6.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return E4.getSize(Z,this.getMimeType())}}class Lw extends S6{init(){this.propertyType=s.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${TO1}`,version:"2.0"},defaultScene:null,accessors:new E0,animations:new E0,buffers:new E0,cameras:new E0,materials:new E0,meshes:new E0,nodes:new E0,scenes:new E0,skins:new E0,textures:new E0})}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=hJ){if(J===hJ)throw new Error("Root cannot be copied.");this.set("asset",Fw({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(Fw({},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 lC)this.addRef("scenes",Z);else if(Z instanceof cC)this.addRef("nodes",Z);else if(Z instanceof eG)this.addRef("cameras",Z);else if(Z instanceof pC)this.addRef("skins",Z);else if(Z instanceof dC)this.addRef("meshes",Z);else if(Z instanceof Zz)this.addRef("materials",Z);else if(Z instanceof iC)this.addRef("textures",Z);else if(Z instanceof mC)this.addRef("animations",Z);else if(Z instanceof k0)this.addRef("accessors",Z);else if(Z instanceof uC)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 Uw{static fromGraph(Z){return Uw._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new HW,this._root=new Lw(this._graph),this._logger=D7.DEFAULT_INSTANCE,Uw._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 lC(this._graph,Z)}createNode(Z=""){return new cC(this._graph,Z)}createCamera(Z=""){return new eG(this._graph,Z)}createSkin(Z=""){return new pC(this._graph,Z)}createMesh(Z=""){return new dC(this._graph,Z)}createPrimitive(){return new fJ(this._graph)}createPrimitiveTarget(Z=""){return new Es(this._graph,Z)}createMaterial(Z=""){return new Zz(this._graph,Z)}createTexture(Z=""){return new iC(this._graph,Z)}createAnimation(Z=""){return new mC(this._graph,Z)}createAnimationChannel(Z=""){return new tG(this._graph,Z)}createAnimationSampler(Z=""){return new PW(this._graph,Z)}createAccessor(Z="",J=null){if(!J)J=this.getRoot().listBuffers()[0];return new k0(this._graph,Z).setBuffer(J)}createBuffer(Z=""){return new uC(this._graph,Z)}}Uw._GRAPH_DOCUMENTS=new WeakMap;class _1{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 t1&&$.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}}_1.EXTENSION_NAME=void 0;var IU6={logger:D7.DEFAULT_INSTANCE,extensions:[],dependencies:{}},vU6=new Set([s.BUFFER,s.TEXTURE,s.MATERIAL,s.MESH,s.PRIMITIVE,s.NODE,s.SCENE]);var rG;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(rG||(rG={}));class bJ{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 bC($>1,()=>X.basename||"buffer"),this.imageURIGenerator=new bC(Q>1,(W)=>uO1(Z,W)||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 W={index:this.textureDefIndexMap.get(Q)};if(J.getTexCoord()!==0)W.texCoord=J.getTexCoord();if(Object.keys(J.getExtras()).length>0)W.extras=J.getExtras();return this.textureInfoDefMap.set(J,W),W}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===_C.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=E4.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 J9.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 J9.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}}bJ.BufferViewTarget=rG;bJ.BufferViewUsage=J9;bJ.USAGE_TO_TARGET={[J9.ARRAY_BUFFER]:rG.ARRAY_BUFFER,[J9.ELEMENT_ARRAY_BUFFER]:rG.ELEMENT_ARRAY_BUFFER};class bC{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 uO1(Z,J){let X=Z.getGraph().listParentEdges(J).find((Y)=>Y.getParent()!==Z.getRoot());return X?X.getName().replace(/texture$/i,""):""}var{UNSIGNED_INT:SU6,UNSIGNED_SHORT:_U6,UNSIGNED_BYTE:xU6}=k0.ComponentType,AU6=new Set([s.ACCESSOR,s.BUFFER,s.MATERIAL,s.MESH]);var Ns;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(Ns||(Ns={}));var vs=163,Ss=166;function dO1(){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 CW{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 bU6=new Uint8Array([0]),t6=[171,75,84,88,32,50,48,187,13,10,26,10];function Is(Z){return new TextDecoder().decode(Z)}function Ow(Z){let J=new Uint8Array(Z.buffer,Z.byteOffset,t6.length);if(J[0]!==t6[0]||J[1]!==t6[1]||J[2]!==t6[2]||J[3]!==t6[3]||J[4]!==t6[4]||J[5]!==t6[5]||J[6]!==t6[6]||J[7]!==t6[7]||J[8]!==t6[8]||J[9]!==t6[9]||J[10]!==t6[10]||J[11]!==t6[11])throw new Error("Missing KTX 2.0 identifier.");let X=dO1(),Y=17*Uint32Array.BYTES_PER_ELEMENT,$=new CW(Z,t6.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 W=$._nextUint32(),K=$._nextUint32(),G=$._nextUint32(),z=$._nextUint32(),H=$._nextUint64(),V=$._nextUint64(),q=Q*3*8,F=new CW(Z,t6.length+Y,q,!0);for(let U6=0;U6<Q;U6++)X.levels.push({levelData:new Uint8Array(Z.buffer,Z.byteOffset+F._nextUint64(),F._nextUint64()),uncompressedByteLength:F._nextUint64()});let U=new CW(Z,W,K,!0);U._skip(4);let B=U._nextUint16(),w=U._nextUint16(),O=U._nextUint16(),N=U._nextUint16(),R=U._nextUint8(),j=U._nextUint8(),P=U._nextUint8(),D=U._nextUint8(),C=[U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8()],T=[U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8()],x={vendorId:B,descriptorType:w,versionNumber:O,colorModel:R,colorPrimaries:j,transferFunction:P,flags:D,texelBlockDimension:C,bytesPlane:T,samples:[]},S=6,A=4,I=(N/4-S)/A;for(let U6=0;U6<I;U6++){let GZ={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(GZ.channelType&64)GZ.sampleLower=U._nextInt32(),GZ.sampleUpper=U._nextInt32();else GZ.sampleLower=U._nextUint32(),GZ.sampleUpper=U._nextUint32();x.samples[U6]=GZ}X.dataFormatDescriptor.length=0,X.dataFormatDescriptor.push(x);let v=new CW(Z,G,z,!0);while(v._offset<z){let U6=v._nextUint32(),GZ=v._scan(U6),BF=Is(GZ);if(X.keyValue[BF]=v._nextUint8Array(U6-GZ.byteLength-1),BF.match(/^ktx/i)){let Yg=Is(X.keyValue[BF]);X.keyValue[BF]=Yg.substring(0,Yg.lastIndexOf("\x00"))}let pQ1=U6%4?4-U6%4:0;v._skip(pQ1)}if(V<=0)return X;let b=new CW(Z,H,V,!0),m=b._nextUint16(),n=b._nextUint16(),o=b._nextUint32(),Q0=b._nextUint32(),K0=b._nextUint32(),_0=b._nextUint32(),x0=[];for(let U6=0;U6<Q;U6++)x0.push({imageFlags:b._nextUint32(),rgbSliceByteOffset:b._nextUint32(),rgbSliceByteLength:b._nextUint32(),alphaSliceByteOffset:b._nextUint32(),alphaSliceByteLength:b._nextUint32()});let r0=H+b._offset,f8=r0+o,X8=f8+Q0,K7=X8+K0,w4=new Uint8Array(Z.buffer,Z.byteOffset+r0,o),bQ=new Uint8Array(Z.buffer,Z.byteOffset+f8,Q0),yQ=new Uint8Array(Z.buffer,Z.byteOffset+X8,K0),VY=new Uint8Array(Z.buffer,Z.byteOffset+K7,_0);return X.globalData={endpointCount:m,selectorCount:n,imageDescs:x0,endpointsData:w4,selectorsData:bQ,tablesData:yQ,extendedData:VY},X}var rC="EXT_mesh_gpu_instancing",aC="EXT_meshopt_compression",cO1="EXT_texture_webp",lO1="EXT_texture_avif",ps="KHR_draco_mesh_compression",tC="KHR_lights_punctual",eC="KHR_materials_anisotropy",ZT="KHR_materials_clearcoat",JT="KHR_materials_diffuse_transmission",XT="KHR_materials_dispersion",YT="KHR_materials_emissive_strength",$T="KHR_materials_ior",QT="KHR_materials_iridescence",WT="KHR_materials_pbrSpecularGlossiness",KT="KHR_materials_sheen",GT="KHR_materials_specular",zT="KHR_materials_transmission",HT="KHR_materials_unlit",VT="KHR_materials_volume",oY="KHR_materials_variants",pO1="KHR_mesh_quantization",iO1="KHR_texture_basisu",qT="KHR_texture_transform",jw="KHR_xmp_json_ld",sC="INSTANCE_ATTRIBUTE";class FT extends t1{init(){this.extensionName=rC,this.propertyType="InstancedMesh",this.parentTypes=[s.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new $8})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:sC})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}FT.EXTENSION_NAME=rC;var fY=rC;class Nw extends _1{constructor(...Z){super(...Z);this.extensionName=fY,this.provideTypes=[s.NODE],this.prewriteTypes=[s.ACCESSOR]}createInstancedMesh(){return new FT(this.document.getGraph())}read(Z){return(Z.jsonDoc.json.nodes||[]).forEach((Y,$)=>{if(!Y.extensions||!Y.extensions[fY])return;let Q=Y.extensions[fY],W=this.createInstancedMesh();for(let K in Q.attributes)W.setAttribute(K,Z.accessors[Q.attributes[K]]);Z.nodes[$].setExtension(fY,W)}),this}prewrite(Z){Z.accessorUsageGroupedByParent.add(sC);for(let J of this.properties)for(let X of J.listAttributes())Z.addAccessorToUsageGroup(X,sC);return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listNodes().forEach((X)=>{let Y=X.getExtension(fY);if(Y){let $=Z.nodeIndexMap.get(X),Q=J.json.nodes[$],W={attributes:{}};Y.listSemantics().forEach((K)=>{let G=Y.getAttribute(K);W.attributes[K]=Z.accessorIndexMap.get(G)}),Q.extensions=Q.extensions||{},Q.extensions[fY]=W}}),this}}Nw.EXTENSION_NAME=fY;function kZ(){return kZ=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},kZ.apply(null,arguments)}var $z;(function(Z){Z.QUANTIZE="quantize",Z.FILTER="filter"})($z||($z={}));var kW;(function(Z){Z.ATTRIBUTES="ATTRIBUTES",Z.TRIANGLES="TRIANGLES",Z.INDICES="INDICES"})(kW||(kW={}));var U8;(function(Z){Z.NONE="NONE",Z.OCTAHEDRAL="OCTAHEDRAL",Z.QUATERNION="QUATERNION",Z.EXPONENTIAL="EXPONENTIAL"})(U8||(U8={}));var{BYTE:nO1,SHORT:_s,FLOAT:aO1}=k0.ComponentType,{encodeNormalizedInt:xs,decodeNormalizedInt:oC}=F8;function sO1(Z,J,X,Y){let{filter:$,bits:Q}=Y,W={array:Z.getArray(),byteStride:Z.getElementSize()*Z.getComponentSize(),componentType:Z.getComponentType(),normalized:Z.getNormalized()};if(X!==kW.ATTRIBUTES)return W;if($!==U8.NONE){let K=Z.getNormalized()?oO1(Z):new Float32Array(W.array);switch($){case U8.EXPONENTIAL:W.byteStride=Z.getElementSize()*4,W.componentType=aO1,W.normalized=!1,W.array=J.encodeFilterExp(K,Z.getCount(),W.byteStride,Q);break;case U8.OCTAHEDRAL:W.byteStride=Q>8?8:4,W.componentType=Q>8?_s:nO1,W.normalized=!0,K=Z.getElementSize()===3?tO1(K):K,W.array=J.encodeFilterOct(K,Z.getCount(),W.byteStride,Q);break;case U8.QUATERNION:W.byteStride=8,W.componentType=_s,W.normalized=!0,W.array=J.encodeFilterQuat(K,Z.getCount(),W.byteStride,Q);break;default:throw new Error("Invalid filter.")}if(W.min=Z.getMin([]),W.max=Z.getMax([]),Z.getNormalized())W.min=W.min.map((G)=>oC(G,Z.getComponentType())),W.max=W.max.map((G)=>oC(G,Z.getComponentType()));if(W.normalized)W.min=W.min.map((G)=>xs(G,W.componentType)),W.max=W.max.map((G)=>xs(G,W.componentType))}else if(W.byteStride%4)W.array=rO1(W.array,Z.getElementSize()),W.byteStride=W.array.byteLength/Z.getCount();return W}function oO1(Z){let J=Z.getComponentType(),X=Z.getArray(),Y=new Float32Array(X.length);for(let $=0;$<X.length;$++)Y[$]=oC(X[$],J);return Y}function rO1(Z,J){let Y=v6.padNumber(Z.BYTES_PER_ELEMENT*J)/Z.BYTES_PER_ELEMENT,$=Z.length/J,Q=new Z.constructor($*Y);for(let W=0;W*J<Z.length;W++)for(let K=0;K<J;K++)Q[W*Y+K]=Z[W*J+K];return Q}function tO1(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 eO1(Z,J){if(J===bJ.BufferViewUsage.ELEMENT_ARRAY_BUFFER)return Z.listParents().some((Y)=>{return Y instanceof fJ&&Y.getMode()===fJ.Mode.TRIANGLES})?kW.TRIANGLES:kW.INDICES;return kW.ATTRIBUTES}function Zj1(Z,J){let X=J.getGraph().listParentEdges(Z).filter((Y)=>!(Y.getParent()instanceof Lw));for(let Y of X){let $=Y.getName(),Q=Y.getAttributes().key||"",W=Y.getParent().propertyType===s.PRIMITIVE_TARGET;if($==="indices")return{filter:U8.NONE};if($==="attributes"){if(Q==="POSITION")return{filter:U8.NONE};if(Q==="TEXCOORD_0")return{filter:U8.NONE};if(Q.startsWith("JOINTS_"))return{filter:U8.NONE};if(Q.startsWith("WEIGHTS_"))return{filter:U8.NONE};if(Q==="NORMAL"||Q==="TANGENT")return W?{filter:U8.NONE}:{filter:U8.OCTAHEDRAL,bits:8}}if($==="output"){let K=is(Z);if(K==="rotation")return{filter:U8.QUATERNION,bits:16};if(K==="translation")return{filter:U8.EXPONENTIAL,bits:12};if(K==="scale")return{filter:U8.EXPONENTIAL,bits:12};return{filter:U8.NONE}}if($==="input")return{filter:U8.NONE};if($==="inverseBindMatrices")return{filter:U8.NONE}}return{filter:U8.NONE}}function is(Z){for(let J of Z.listParents()){if(!(J instanceof PW))continue;for(let X of J.listParents()){if(!(X instanceof tG))continue;return X.getTargetPath()}}return null}function Jj1(Z){if(!Z.extensions||!Z.extensions[aC])return!1;return!!Z.extensions[aC].fallback}var e6=aC,As={method:$z.QUANTIZE};class Wz extends _1{constructor(...Z){super(...Z);this.extensionName=e6,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=As,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=kZ({},As,Z),this}preread(Z,J){if(!this._decoder){if(!this.isRequired())return this;throw new Error(`[${e6}] Please install extension dependency, "meshopt.decoder".`)}if(!this._decoder.supported){if(!this.isRequired())return this;throw new Error(`[${e6}]: 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[e6])return;let Q=Y.extensions[e6],W=Q.byteOffset||0,K=Q.byteLength||0,G=Q.count,z=Q.byteStride,H=new Uint8Array(G*z),V=J.json.buffers[Q.buffer],q=V.uri?J.resources[V.uri]:J.resources[yC],F=v6.toView(q,W,K);this._decoder.decodeGltfBuffer(H,G,z,F,Q.mode,Q.filter),Z.bufferViews[$]=H})}_prereadPrimitives(Z){let J=Z.jsonDoc;(J.json.bufferViews||[]).forEach((Y)=>{if(!Y.extensions||!Y.extensions[e6])return;let $=Y.extensions[e6],Q=Z.buffers[$.buffer],W=Z.buffers[Y.buffer],K=J.json.buffers[Y.buffer];if(Jj1(K))this._decoderFallbackBufferMap.set(W,Q)})}read(Z){if(!this.isRequired())return this;for(let[J,X]of this._decoderFallbackBufferMap){for(let Y of J.listParents())if(Y instanceof k0)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(),W=this.document.getRoot().listBuffers().indexOf(Q),K=1,G=new Map,z=(H)=>{for(let V of $.listParents(H)){if(V.propertyType===s.ROOT)continue;let q=G.get(H);if(q===void 0)G.set(H,q=K++);return q}return-1};this._encoderFallbackBuffer=Q,this._encoderBufferViews={},this._encoderBufferViewData={},this._encoderBufferViewAccessors={};for(let H of this.document.getRoot().listAccessors()){if(is(H)==="weights")continue;if(H.getSparse())continue;let V=Z.getAccessorUsage(H),q=Z.accessorUsageGroupedByParent.has(V)?z(H):null,F=eO1(H,V),U=Y.method===$z.FILTER?Zj1(H,this.document):{filter:U8.NONE},B=sO1(H,X,F,U),{array:w,byteStride:O}=B,N=H.getBuffer();if(!N)throw new Error(`${e6}: Missing buffer for accessor.`);let R=this.document.getRoot().listBuffers().indexOf(N),j=[V,q,F,U.filter,O,R].join(":"),P=this._encoderBufferViews[j],D=this._encoderBufferViewData[j],C=this._encoderBufferViewAccessors[j];if(!P||!D)C=this._encoderBufferViewAccessors[j]=[],D=this._encoderBufferViewData[j]=[],P=this._encoderBufferViews[j]={buffer:W,target:bJ.USAGE_TO_TARGET[V],byteOffset:0,byteLength:0,byteStride:V===bJ.BufferViewUsage.ARRAY_BUFFER?O:void 0,extensions:{[e6]:{buffer:R,byteOffset:0,byteLength:0,mode:F,filter:U.filter!==U8.NONE?U.filter:void 0,byteStride:O,count:0}}};let T=Z.createAccessorDef(H);if(T.componentType=B.componentType,T.normalized=B.normalized,T.byteOffset=P.byteLength,T.min&&B.min)T.min=B.min;if(T.max&&B.max)T.max=B.max;Z.accessorIndexMap.set(H,J.accessors.length),J.accessors.push(T),C.push(T),D.push(new Uint8Array(w.buffer,w.byteOffset,w.byteLength)),P.byteLength+=w.byteLength,P.extensions.EXT_meshopt_compression.count+=H.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[e6].buffer],W=Z.otherBufferViews.get(Q)||[],{count:K,byteStride:G,mode:z}=Y.extensions[e6],H=v6.concat($),V=J.encodeGltfBuffer(H,K,G,z),q=v6.pad(V);Y.extensions[e6].byteLength=V.byteLength,$.length=0,$.push(q),W.push(q),Z.otherBufferViews.set(Q,W)}}write(Z){let J=0;for(let Q in this._encoderBufferViews){let W=this._encoderBufferViews[Q],K=this._encoderBufferViewData[Q][0],G=Z.otherBufferViewsIndexMap.get(K),z=this._encoderBufferViewAccessors[Q];for(let F of z)F.bufferView=G;let H=Z.jsonDoc.json.bufferViews[G],V=H.byteOffset||0;Object.assign(H,W),H.byteOffset=J;let q=H.extensions[e6];q.byteOffset=V,J+=v6.padNumber(W.byteLength)}let X=this._encoderFallbackBuffer,Y=Z.bufferIndexMap.get(X),$=Z.jsonDoc.json.buffers[Y];return $.byteLength=J,$.extensions={[e6]:{fallback:!0}},X.dispose(),this}}Wz.EXTENSION_NAME=e6;Wz.EncoderMethod=$z;var Jz=lO1;class ns{match(Z){return Z.length>=12&&v6.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=hs(J,0);if(!X)return null;let Y=X.end;while(X=hs(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 Dw extends _1{constructor(...Z){super(...Z);this.extensionName=Jz,this.prereadTypes=[s.TEXTURE]}static register(){E4.registerFormat("image/avif",new ns)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((X)=>{if(X.extensions&&X.extensions[Jz])X.source=X.extensions[Jz].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[Jz]={source:Q.source},delete Q.source})}}),this}}Dw.EXTENSION_NAME=Jz;function hs(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:v6.decodeText(new Uint8Array(Z.buffer,Z.byteOffset+J+4,4)),start:J+8,end:J+X}}var Xz=cO1;class as{match(Z){return Z.length>=12&&Z[8]===87&&Z[9]===69&&Z[10]===66&&Z[11]===80}getSize(Z){let J=v6.decodeText(Z.slice(0,4)),X=v6.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=v6.decodeText(new Uint8Array([Y.getUint8($),Y.getUint8($+1),Y.getUint8($+2),Y.getUint8($+3)])),W=Y.getUint32($+4,!0);if(Q==="VP8 "){let K=Y.getInt16($+14,!0)&16383,G=Y.getInt16($+16,!0)&16383;return[K,G]}else if(Q==="VP8L"){let K=Y.getUint8($+9),G=Y.getUint8($+10),z=Y.getUint8($+11),H=Y.getUint8($+12),V=1+((G&63)<<8|K),q=1+((H&15)<<10|z<<2|(G&192)>>6);return[V,q]}$+=8+W+W%2}return null}getChannels(Z){return 4}}class Pw extends _1{constructor(...Z){super(...Z);this.extensionName=Xz,this.prereadTypes=[s.TEXTURE]}static register(){E4.registerFormat("image/webp",new as)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((X)=>{if(X.extensions&&X.extensions[Xz])X.source=X.extensions[Xz].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[Xz]={source:Q.source},delete Q.source})}}),this}}Pw.EXTENSION_NAME=Xz;var fs=ps,n8,ss,os;function Xj1(Z,J){let X=new n8.DecoderBuffer;try{if(X.Init(J,J.length),Z.GetEncodedGeometryType(X)!==n8.TRIANGULAR_MESH)throw new Error(`[${fs}] Unknown geometry type.`);let $=new n8.Mesh;if(!Z.DecodeBufferToMesh(X,$).ok()||$.ptr===0)throw new Error(`[${fs}] Decoding failure.`);return $}finally{n8.destroy(X)}}function Yj1(Z,J){let Y=J.num_faces()*3,$,Q;if(J.num_points()<=65534){let W=Y*Uint16Array.BYTES_PER_ELEMENT;$=n8._malloc(W),Z.GetTrianglesUInt16Array(J,W,$),Q=new Uint16Array(n8.HEAPU16.buffer,$,Y).slice()}else{let W=Y*Uint32Array.BYTES_PER_ELEMENT;$=n8._malloc(W),Z.GetTrianglesUInt32Array(J,W,$),Q=new Uint32Array(n8.HEAPU32.buffer,$,Y).slice()}return n8._free($),Q}function $j1(Z,J,X,Y){let $=os[Y.componentType],Q=ss[Y.componentType],W=X.num_components(),G=J.num_points()*W,z=G*Q.BYTES_PER_ELEMENT,H=n8._malloc(z);Z.GetAttributeDataArrayForAllPoints(J,X,$,z,H);let V=new Q(n8.HEAPF32.buffer,H,G).slice();return n8._free(H),V}function Qj1(Z){n8=Z,ss={[k0.ComponentType.FLOAT]:Float32Array,[k0.ComponentType.UNSIGNED_INT]:Uint32Array,[k0.ComponentType.UNSIGNED_SHORT]:Uint16Array,[k0.ComponentType.UNSIGNED_BYTE]:Uint8Array,[k0.ComponentType.SHORT]:Int16Array,[k0.ComponentType.BYTE]:Int8Array},os={[k0.ComponentType.FLOAT]:n8.DT_FLOAT32,[k0.ComponentType.UNSIGNED_INT]:n8.DT_UINT32,[k0.ComponentType.UNSIGNED_SHORT]:n8.DT_UINT16,[k0.ComponentType.UNSIGNED_BYTE]:n8.DT_UINT8,[k0.ComponentType.SHORT]:n8.DT_INT16,[k0.ComponentType.BYTE]:n8.DT_INT8}}var x9,Qz;(function(Z){Z[Z.EDGEBREAKER=1]="EDGEBREAKER",Z[Z.SEQUENTIAL=0]="SEQUENTIAL"})(Qz||(Qz={}));var A9;(function(Z){Z.POSITION="POSITION",Z.NORMAL="NORMAL",Z.COLOR="COLOR",Z.TEX_COORD="TEX_COORD",Z.GENERIC="GENERIC"})(A9||(A9={}));var rs={[A9.POSITION]:14,[A9.NORMAL]:10,[A9.COLOR]:8,[A9.TEX_COORD]:12,[A9.GENERIC]:12},bs={decodeSpeed:5,encodeSpeed:5,method:Qz.EDGEBREAKER,quantizationBits:rs,quantizationVolume:"mesh"};function Wj1(Z){x9=Z}function Kj1(Z,J=bs){let X=kZ({},bs,J);X.quantizationBits=kZ({},rs,J.quantizationBits);let Y=new x9.MeshBuilder,$=new x9.Mesh,Q=new x9.ExpertEncoder($),W={},K=new x9.DracoInt8Array,G=Z.listTargets().length>0,z=!1;for(let B of Z.listSemantics()){let w=Z.getAttribute(B);if(w.getSparse()){z=!0;continue}let O=Gj1(B),N=zj1(Y,w.getComponentType(),$,x9[O],w.getCount(),w.getElementSize(),w.getArray());if(N===-1)throw new Error(`Error compressing "${B}" attribute.`);if(W[B]=N,X.quantizationVolume==="mesh"||B!=="POSITION")Q.SetAttributeQuantization(N,X.quantizationBits[O]);else if(typeof X.quantizationVolume==="object"){let{quantizationVolume:R}=X,j=Math.max(R.max[0]-R.min[0],R.max[1]-R.min[1],R.max[2]-R.min[2]);Q.SetAttributeExplicitQuantization(N,X.quantizationBits[O],w.getElementSize(),R.min,j)}else throw new Error("Invalid quantization volume state.")}let H=Z.getIndices();if(!H)throw new Mw("Primitive must have indices.");if(Y.AddFacesToMesh($,H.getCount()/3,H.getArray()),Q.SetSpeedOptions(X.encodeSpeed,X.decodeSpeed),Q.SetTrackEncodedProperties(!0),X.method===Qz.SEQUENTIAL||G||z)Q.SetEncodingMethod(x9.MESH_SEQUENTIAL_ENCODING);else Q.SetEncodingMethod(x9.MESH_EDGEBREAKER_ENCODING);let V=Q.EncodeToDracoBuffer(!(G||z),K);if(V<=0)throw new Mw("Error applying Draco compression.");let q=new Uint8Array(V);for(let B=0;B<V;++B)q[B]=K.GetValue(B);let F=Q.GetNumberOfEncodedPoints(),U=Q.GetNumberOfEncodedFaces()*3;return x9.destroy(K),x9.destroy($),x9.destroy(Y),x9.destroy(Q),{numVertices:F,numIndices:U,data:q,attributeIDs:W}}function Gj1(Z){if(Z==="POSITION")return A9.POSITION;else if(Z==="NORMAL")return A9.NORMAL;else if(Z.startsWith("COLOR_"))return A9.COLOR;else if(Z.startsWith("TEXCOORD_"))return A9.TEX_COORD;return A9.GENERIC}function zj1(Z,J,X,Y,$,Q,W){switch(J){case k0.ComponentType.UNSIGNED_BYTE:return Z.AddUInt8Attribute(X,Y,$,Q,W);case k0.ComponentType.BYTE:return Z.AddInt8Attribute(X,Y,$,Q,W);case k0.ComponentType.UNSIGNED_SHORT:return Z.AddUInt16Attribute(X,Y,$,Q,W);case k0.ComponentType.SHORT:return Z.AddInt16Attribute(X,Y,$,Q,W);case k0.ComponentType.UNSIGNED_INT:return Z.AddUInt32Attribute(X,Y,$,Q,W);case k0.ComponentType.FLOAT:return Z.AddFloatAttribute(X,Y,$,Q,W);default:throw new Error(`Unexpected component type, "${J}".`)}}class Mw extends Error{}var v8=ps;class Kz extends _1{constructor(...Z){super(...Z);this.extensionName=v8,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,Qj1(this._decoderModule);if(Z==="draco3d.encoder")this._encoderModule=J,Wj1(this._encoderModule);return this}setEncoderOptions(Z){return this._encoderOptions=Z,this}preread(Z){if(!this._decoderModule)throw new Error(`[${v8}] 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 W of Q.primitives){if(!W.extensions||!W.extensions[v8])continue;let K=W.extensions[v8],[G,z]=Y.get(K.bufferView)||[];if(!z||!G){let H=X.json.bufferViews[K.bufferView],V=X.json.buffers[H.buffer],q=V.uri?X.resources[V.uri]:X.resources[yC],F=H.byteOffset||0,U=H.byteLength,B=v6.toView(q,F,U);G=new this._decoderModule.Decoder,z=Xj1(G,B),Y.set(K.bufferView,[G,z]),J.debug(`[${v8}] Decompressed ${B.byteLength} bytes.`)}for(let H in K.attributes){let V=Z.jsonDoc.json.accessors[W.attributes[H]],q=G.GetAttributeByUniqueId(z,K.attributes[H]),F=$j1(G,z,q,V);Z.accessors[W.attributes[H]].setArray(F)}if(W.indices!==void 0)Z.accessors[W.indices].setArray(Yj1(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(`[${v8}] Please install extension dependency, "draco3d.encoder".`);let X=this.document.getLogger();X.debug(`[${v8}] Compression options: ${JSON.stringify(this._encoderOptions)}`);let Y=Hj1(this.document),$=new Map,Q="mesh";if(this._encoderOptions.quantizationVolume==="scene")if(this.document.getRoot().listScenes().length!==1)X.warn(`[${v8}]: quantizationVolume=scene requires exactly 1 scene.`);else Q=Ds(this.document.getRoot().listScenes().pop());for(let W of Array.from(Y.keys())){let K=Y.get(W);if(!K)throw new Error("Unexpected primitive.");if($.has(K)){$.set(K,$.get(K));continue}let G=W.getIndices(),z=Z.jsonDoc.json.accessors,H;try{H=Kj1(W,kZ({},this._encoderOptions,{quantizationVolume:Q}))}catch(F){if(F instanceof Mw){X.warn(`[${v8}]: ${F.message} Skipping primitive compression.`);continue}throw F}$.set(K,H);let V=Z.createAccessorDef(G);if(V.count=H.numIndices,Z.accessorIndexMap.set(G,z.length),z.push(V),H.numVertices>65534&&k0.getComponentSize(V.componentType)<=2)V.componentType=k0.ComponentType.UNSIGNED_INT;else if(H.numVertices>254&&k0.getComponentSize(V.componentType)<=1)V.componentType=k0.ComponentType.UNSIGNED_SHORT;for(let F of W.listSemantics()){let U=W.getAttribute(F);if(H.attributeIDs[F]===void 0)continue;let B=Z.createAccessorDef(U);B.count=H.numVertices,Z.accessorIndexMap.set(U,z.length),z.push(B)}let q=W.getAttribute("POSITION").getBuffer()||this.document.getRoot().listBuffers()[0];if(!Z.otherBufferViews.has(q))Z.otherBufferViews.set(q,[]);Z.otherBufferViews.get(q).push(H.data)}return X.debug(`[${v8}] Compressed ${Y.size} primitives.`),Z.extensionData[v8]={primitiveHashMap:Y,primitiveEncodingMap:$},this}write(Z){let J=Z.extensionData[v8];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()[$],W=Y.primitives[$],K=J.primitiveHashMap.get(Q);if(!K)continue;let G=J.primitiveEncodingMap.get(K);if(!G)continue;W.extensions=W.extensions||{},W.extensions[v8]={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!==v8),X.extensionsRequired=(X.extensionsRequired||[]).filter((Y)=>Y!==v8)}return this}}Kz.EXTENSION_NAME=v8;Kz.EncoderMethod=Qz;function Hj1(Z){let J=Z.getLogger(),X=new Set,Y=new Set,$=0,Q=0;for(let V of Z.getRoot().listMeshes())for(let q of V.listPrimitives())if(!q.getIndices())Y.add(q),$++;else if(q.getMode()!==fJ.Mode.TRIANGLES)Y.add(q),Q++;else X.add(q);if($>0)J.warn(`[${v8}] Skipping Draco compression of ${$} non-indexed primitives.`);if(Q>0)J.warn(`[${v8}] Skipping Draco compression of ${Q} non-TRIANGLES primitives.`);let W=Z.getRoot().listAccessors(),K=new Map;for(let V=0;V<W.length;V++)K.set(W[V],V);let G=new Map,z=new Set,H=new Map;for(let V of Array.from(X)){let q=ys(V,K);if(z.has(q)){H.set(V,q);continue}if(G.has(V.getIndices())){let F=V.getIndices(),U=F.clone();K.set(U,Z.getRoot().listAccessors().length-1),V.swap(F,U)}for(let F of V.listAttributes())if(G.has(F)){let U=F.clone();K.set(U,Z.getRoot().listAccessors().length-1),V.swap(F,U)}q=ys(V,K),z.add(q),H.set(V,q),G.set(V.getIndices(),q);for(let F of V.listAttributes())G.set(F,q)}for(let V of Array.from(G.keys())){let q=new Set(V.listParents().map((F)=>F.propertyType));if(q.size!==2||!q.has(s.PRIMITIVE)||!q.has(s.ROOT))throw new Error(`[${v8}] Compressed accessors must only be used as indices or vertex attributes.`)}for(let V of Array.from(X)){let q=H.get(V),F=V.getIndices();if(G.get(F)!==q||V.listAttributes().some((U)=>G.get(U)!==q))throw new Error(`[${v8}] Draco primitives must share all, or no, accessors.`)}for(let V of Array.from(Y)){let q=V.getIndices();if(G.has(q)||V.listAttributes().some((F)=>G.has(F)))throw new Error(`[${v8}] Accessor cannot be shared by compressed and uncompressed primitives.`)}return H}function ys(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 EW extends t1{init(){this.extensionName=tC,this.propertyType="Light",this.parentTypes=[s.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{color:[1,1,1],intensity:1,type:EW.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)}}EW.EXTENSION_NAME=tC;EW.Type={POINT:"point",SPOT:"spot",DIRECTIONAL:"directional"};var P7=tC;class UT extends _1{constructor(...Z){super(...Z);this.extensionName=P7}createLight(Z=""){return new EW(this.document.getGraph(),Z)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[P7])return this;let $=(J.json.extensions[P7].lights||[]).map((Q)=>{var W,K;let G=this.createLight().setName(Q.name||"").setType(Q.type);if(Q.color!==void 0)G.setColor(Q.color);if(Q.intensity!==void 0)G.setIntensity(Q.intensity);if(Q.range!==void 0)G.setRange(Q.range);if(((W=Q.spot)==null?void 0:W.innerConeAngle)!==void 0)G.setInnerConeAngle(Q.spot.innerConeAngle);if(((K=Q.spot)==null?void 0:K.outerConeAngle)!==void 0)G.setOuterConeAngle(Q.spot.outerConeAngle);return G});return J.json.nodes.forEach((Q,W)=>{if(!Q.extensions||!Q.extensions[P7])return;let K=Q.extensions[P7];Z.nodes[W].setExtension(P7,$[K.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=$,W={type:Q.getType()};if(!F8.eq(Q.getColor(),[1,1,1]))W.color=Q.getColor();if(Q.getIntensity()!==1)W.intensity=Q.getIntensity();if(Q.getRange()!=null)W.range=Q.getRange();if(Q.getName())W.name=Q.getName();if(Q.getType()===EW.Type.SPOT)W.spot={innerConeAngle:Q.getInnerConeAngle(),outerConeAngle:Q.getOuterConeAngle()};X.push(W),Y.set(Q,X.length-1)}return this.document.getRoot().listNodes().forEach(($)=>{let Q=$.getExtension(P7);if(Q){let W=Z.nodeIndexMap.get($),K=J.json.nodes[W];K.extensions=K.extensions||{},K.extensions[P7]={light:Y.get(Q)}}}),J.json.extensions=J.json.extensions||{},J.json.extensions[P7]={lights:X},this}}UT.EXTENSION_NAME=P7;var{R:Vj1,G:qj1,B:Fj1}=X9;class wT extends t1{init(){this.extensionName=eC,this.propertyType="Anisotropy",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{anisotropyStrength:0,anisotropyRotation:0,anisotropyTexture:null,anisotropyTextureInfo:new I1(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:Vj1|qj1|Fj1})}}wT.EXTENSION_NAME=eC;var bY=eC;class BT extends _1{constructor(...Z){super(...Z);this.extensionName=bY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createAnisotropy(){return new wT(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 W=this.createAnisotropy();Z.materials[Q].setExtension(bY,W);let K=$.extensions[bY];if(K.anisotropyStrength!==void 0)W.setAnisotropyStrength(K.anisotropyStrength);if(K.anisotropyRotation!==void 0)W.setAnisotropyRotation(K.anisotropyRotation);if(K.anisotropyTexture!==void 0){let G=K.anisotropyTexture,z=Z.textures[Y[G.index].source];W.setAnisotropyTexture(z),Z.setTextureInfo(W.getAnisotropyTextureInfo(),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 W=Q.extensions[bY]={};if(Y.getAnisotropyStrength()>0)W.anisotropyStrength=Y.getAnisotropyStrength();if(Y.getAnisotropyRotation()!==0)W.anisotropyRotation=Y.getAnisotropyRotation();if(Y.getAnisotropyTexture()){let K=Y.getAnisotropyTexture(),G=Y.getAnisotropyTextureInfo();W.anisotropyTexture=Z.createTextureInfoDef(K,G)}}}),this}}BT.EXTENSION_NAME=bY;var{R:gs,G:ms,B:Uj1}=X9;class LT extends t1{init(){this.extensionName=ZT,this.propertyType="Clearcoat",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{clearcoatFactor:0,clearcoatTexture:null,clearcoatTextureInfo:new I1(this.graph,"clearcoatTextureInfo"),clearcoatRoughnessFactor:0,clearcoatRoughnessTexture:null,clearcoatRoughnessTextureInfo:new I1(this.graph,"clearcoatRoughnessTextureInfo"),clearcoatNormalScale:1,clearcoatNormalTexture:null,clearcoatNormalTextureInfo:new I1(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:gs})}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:ms})}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:gs|ms|Uj1})}}LT.EXTENSION_NAME=ZT;var yY=ZT;class OT extends _1{constructor(...Z){super(...Z);this.extensionName=yY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createClearcoat(){return new LT(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[yY]){let W=this.createClearcoat();Z.materials[Q].setExtension(yY,W);let K=$.extensions[yY];if(K.clearcoatFactor!==void 0)W.setClearcoatFactor(K.clearcoatFactor);if(K.clearcoatRoughnessFactor!==void 0)W.setClearcoatRoughnessFactor(K.clearcoatRoughnessFactor);if(K.clearcoatTexture!==void 0){let G=K.clearcoatTexture,z=Z.textures[Y[G.index].source];W.setClearcoatTexture(z),Z.setTextureInfo(W.getClearcoatTextureInfo(),G)}if(K.clearcoatRoughnessTexture!==void 0){let G=K.clearcoatRoughnessTexture,z=Z.textures[Y[G.index].source];W.setClearcoatRoughnessTexture(z),Z.setTextureInfo(W.getClearcoatRoughnessTextureInfo(),G)}if(K.clearcoatNormalTexture!==void 0){let G=K.clearcoatNormalTexture,z=Z.textures[Y[G.index].source];if(W.setClearcoatNormalTexture(z),Z.setTextureInfo(W.getClearcoatNormalTextureInfo(),G),G.scale!==void 0)W.setClearcoatNormalScale(G.scale)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(yY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[yY]={clearcoatFactor:Y.getClearcoatFactor(),clearcoatRoughnessFactor:Y.getClearcoatRoughnessFactor()};if(Y.getClearcoatTexture()){let K=Y.getClearcoatTexture(),G=Y.getClearcoatTextureInfo();W.clearcoatTexture=Z.createTextureInfoDef(K,G)}if(Y.getClearcoatRoughnessTexture()){let K=Y.getClearcoatRoughnessTexture(),G=Y.getClearcoatRoughnessTextureInfo();W.clearcoatRoughnessTexture=Z.createTextureInfoDef(K,G)}if(Y.getClearcoatNormalTexture()){let K=Y.getClearcoatNormalTexture(),G=Y.getClearcoatNormalTextureInfo();if(W.clearcoatNormalTexture=Z.createTextureInfoDef(K,G),Y.getClearcoatNormalScale()!==1)W.clearcoatNormalTexture.scale=Y.getClearcoatNormalScale()}}}),this}}OT.EXTENSION_NAME=yY;var{R:wj1,G:Bj1,B:Lj1,A:Oj1}=X9;class jT extends t1{init(){this.extensionName=JT,this.propertyType="DiffuseTransmission",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseTransmissionFactor:0,diffuseTransmissionTexture:null,diffuseTransmissionTextureInfo:new I1(this.graph,"diffuseTransmissionTextureInfo"),diffuseTransmissionColorFactor:[1,1,1],diffuseTransmissionColorTexture:null,diffuseTransmissionColorTextureInfo:new I1(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:Oj1})}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:wj1|Bj1|Lj1})}}jT.EXTENSION_NAME=JT;var gY=JT;class MT extends _1{constructor(...Z){super(...Z);this.extensionName=gY}createDiffuseTransmission(){return new jT(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 W=this.createDiffuseTransmission();Z.materials[Q].setExtension(gY,W);let K=$.extensions[gY];if(K.diffuseTransmissionFactor!==void 0)W.setDiffuseTransmissionFactor(K.diffuseTransmissionFactor);if(K.diffuseTransmissionColorFactor!==void 0)W.setDiffuseTransmissionColorFactor(K.diffuseTransmissionColorFactor);if(K.diffuseTransmissionTexture!==void 0){let G=K.diffuseTransmissionTexture,z=Z.textures[Y[G.index].source];W.setDiffuseTransmissionTexture(z),Z.setTextureInfo(W.getDiffuseTransmissionTextureInfo(),G)}if(K.diffuseTransmissionColorTexture!==void 0){let G=K.diffuseTransmissionColorTexture,z=Z.textures[Y[G.index].source];W.setDiffuseTransmissionColorTexture(z),Z.setTextureInfo(W.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 W=Q.extensions[gY]={diffuseTransmissionFactor:Y.getDiffuseTransmissionFactor(),diffuseTransmissionColorFactor:Y.getDiffuseTransmissionColorFactor()};if(Y.getDiffuseTransmissionTexture()){let K=Y.getDiffuseTransmissionTexture(),G=Y.getDiffuseTransmissionTextureInfo();W.diffuseTransmissionTexture=Z.createTextureInfoDef(K,G)}if(Y.getDiffuseTransmissionColorTexture()){let K=Y.getDiffuseTransmissionColorTexture(),G=Y.getDiffuseTransmissionColorTextureInfo();W.diffuseTransmissionColorTexture=Z.createTextureInfoDef(K,G)}}return this}}MT.EXTENSION_NAME=gY;class RT extends t1{init(){this.extensionName=XT,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)}}RT.EXTENSION_NAME=XT;var mY=XT;class NT extends _1{constructor(...Z){super(...Z);this.extensionName=mY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createDispersion(){return new RT(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[mY]){let Q=this.createDispersion();Z.materials[$].setExtension(mY,Q);let W=Y.extensions[mY];if(W.dispersion!==void 0)Q.setDispersion(W.dispersion)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(mY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[mY]={dispersion:Y.getDispersion()}}}),this}}NT.EXTENSION_NAME=mY;class DT extends t1{init(){this.extensionName=YT,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)}}DT.EXTENSION_NAME=YT;var uY=YT;class PT extends _1{constructor(...Z){super(...Z);this.extensionName=uY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createEmissiveStrength(){return new DT(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[uY]){let Q=this.createEmissiveStrength();Z.materials[$].setExtension(uY,Q);let W=Y.extensions[uY];if(W.emissiveStrength!==void 0)Q.setEmissiveStrength(W.emissiveStrength)}}),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||{},Q.extensions[uY]={emissiveStrength:Y.getEmissiveStrength()}}}),this}}PT.EXTENSION_NAME=uY;class CT extends t1{init(){this.extensionName=$T,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)}}CT.EXTENSION_NAME=$T;var dY=$T;class Cw extends _1{constructor(...Z){super(...Z);this.extensionName=dY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createIOR(){return new CT(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[dY]){let Q=this.createIOR();Z.materials[$].setExtension(dY,Q);let W=Y.extensions[dY];if(W.ior!==void 0)Q.setIOR(W.ior)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(dY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[dY]={ior:Y.getIOR()}}}),this}}Cw.EXTENSION_NAME=dY;var{R:jj1,G:Mj1}=X9;class TT extends t1{init(){this.extensionName=QT,this.propertyType="Iridescence",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{iridescenceFactor:0,iridescenceTexture:null,iridescenceTextureInfo:new I1(this.graph,"iridescenceTextureInfo"),iridescenceIOR:1.3,iridescenceThicknessMinimum:100,iridescenceThicknessMaximum:400,iridescenceThicknessTexture:null,iridescenceThicknessTextureInfo:new I1(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:jj1})}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:Mj1})}}TT.EXTENSION_NAME=QT;var cY=QT;class kT extends _1{constructor(...Z){super(...Z);this.extensionName=cY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createIridescence(){return new TT(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[cY]){let W=this.createIridescence();Z.materials[Q].setExtension(cY,W);let K=$.extensions[cY];if(K.iridescenceFactor!==void 0)W.setIridescenceFactor(K.iridescenceFactor);if(K.iridescenceIor!==void 0)W.setIridescenceIOR(K.iridescenceIor);if(K.iridescenceThicknessMinimum!==void 0)W.setIridescenceThicknessMinimum(K.iridescenceThicknessMinimum);if(K.iridescenceThicknessMaximum!==void 0)W.setIridescenceThicknessMaximum(K.iridescenceThicknessMaximum);if(K.iridescenceTexture!==void 0){let G=K.iridescenceTexture,z=Z.textures[Y[G.index].source];W.setIridescenceTexture(z),Z.setTextureInfo(W.getIridescenceTextureInfo(),G)}if(K.iridescenceThicknessTexture!==void 0){let G=K.iridescenceThicknessTexture,z=Z.textures[Y[G.index].source];W.setIridescenceThicknessTexture(z),Z.setTextureInfo(W.getIridescenceThicknessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(cY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[cY]={};if(Y.getIridescenceFactor()>0)W.iridescenceFactor=Y.getIridescenceFactor();if(Y.getIridescenceIOR()!==1.3)W.iridescenceIor=Y.getIridescenceIOR();if(Y.getIridescenceThicknessMinimum()!==100)W.iridescenceThicknessMinimum=Y.getIridescenceThicknessMinimum();if(Y.getIridescenceThicknessMaximum()!==400)W.iridescenceThicknessMaximum=Y.getIridescenceThicknessMaximum();if(Y.getIridescenceTexture()){let K=Y.getIridescenceTexture(),G=Y.getIridescenceTextureInfo();W.iridescenceTexture=Z.createTextureInfoDef(K,G)}if(Y.getIridescenceThicknessTexture()){let K=Y.getIridescenceThicknessTexture(),G=Y.getIridescenceThicknessTextureInfo();W.iridescenceThicknessTexture=Z.createTextureInfoDef(K,G)}}}),this}}kT.EXTENSION_NAME=cY;var{R:us,G:ds,B:cs,A:ls}=X9;class ET extends t1{init(){this.extensionName=WT,this.propertyType="PBRSpecularGlossiness",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseFactor:[1,1,1,1],diffuseTexture:null,diffuseTextureInfo:new I1(this.graph,"diffuseTextureInfo"),specularFactor:[1,1,1],glossinessFactor:1,specularGlossinessTexture:null,specularGlossinessTextureInfo:new I1(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:us|ds|cs|ls,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:us|ds|cs|ls})}}ET.EXTENSION_NAME=WT;var lY=WT;class Tw extends _1{constructor(...Z){super(...Z);this.extensionName=lY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createPBRSpecularGlossiness(){return new ET(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 W=this.createPBRSpecularGlossiness();Z.materials[Q].setExtension(lY,W);let K=$.extensions[lY];if(K.diffuseFactor!==void 0)W.setDiffuseFactor(K.diffuseFactor);if(K.specularFactor!==void 0)W.setSpecularFactor(K.specularFactor);if(K.glossinessFactor!==void 0)W.setGlossinessFactor(K.glossinessFactor);if(K.diffuseTexture!==void 0){let G=K.diffuseTexture,z=Z.textures[Y[G.index].source];W.setDiffuseTexture(z),Z.setTextureInfo(W.getDiffuseTextureInfo(),G)}if(K.specularGlossinessTexture!==void 0){let G=K.specularGlossinessTexture,z=Z.textures[Y[G.index].source];W.setSpecularGlossinessTexture(z),Z.setTextureInfo(W.getSpecularGlossinessTextureInfo(),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 W=Q.extensions[lY]={diffuseFactor:Y.getDiffuseFactor(),specularFactor:Y.getSpecularFactor(),glossinessFactor:Y.getGlossinessFactor()};if(Y.getDiffuseTexture()){let K=Y.getDiffuseTexture(),G=Y.getDiffuseTextureInfo();W.diffuseTexture=Z.createTextureInfoDef(K,G)}if(Y.getSpecularGlossinessTexture()){let K=Y.getSpecularGlossinessTexture(),G=Y.getSpecularGlossinessTextureInfo();W.specularGlossinessTexture=Z.createTextureInfoDef(K,G)}}}),this}}Tw.EXTENSION_NAME=lY;var{R:Rj1,G:Nj1,B:Dj1,A:Pj1}=X9;class IT extends t1{init(){this.extensionName=KT,this.propertyType="Sheen",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{sheenColorFactor:[0,0,0],sheenColorTexture:null,sheenColorTextureInfo:new I1(this.graph,"sheenColorTextureInfo"),sheenRoughnessFactor:0,sheenRoughnessTexture:null,sheenRoughnessTextureInfo:new I1(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:Rj1|Nj1|Dj1,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:Pj1})}}IT.EXTENSION_NAME=KT;var pY=KT;class vT extends _1{constructor(...Z){super(...Z);this.extensionName=pY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createSheen(){return new IT(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[pY]){let W=this.createSheen();Z.materials[Q].setExtension(pY,W);let K=$.extensions[pY];if(K.sheenColorFactor!==void 0)W.setSheenColorFactor(K.sheenColorFactor);if(K.sheenRoughnessFactor!==void 0)W.setSheenRoughnessFactor(K.sheenRoughnessFactor);if(K.sheenColorTexture!==void 0){let G=K.sheenColorTexture,z=Z.textures[Y[G.index].source];W.setSheenColorTexture(z),Z.setTextureInfo(W.getSheenColorTextureInfo(),G)}if(K.sheenRoughnessTexture!==void 0){let G=K.sheenRoughnessTexture,z=Z.textures[Y[G.index].source];W.setSheenRoughnessTexture(z),Z.setTextureInfo(W.getSheenRoughnessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(pY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[pY]={sheenColorFactor:Y.getSheenColorFactor(),sheenRoughnessFactor:Y.getSheenRoughnessFactor()};if(Y.getSheenColorTexture()){let K=Y.getSheenColorTexture(),G=Y.getSheenColorTextureInfo();W.sheenColorTexture=Z.createTextureInfoDef(K,G)}if(Y.getSheenRoughnessTexture()){let K=Y.getSheenRoughnessTexture(),G=Y.getSheenRoughnessTextureInfo();W.sheenRoughnessTexture=Z.createTextureInfoDef(K,G)}}}),this}}vT.EXTENSION_NAME=pY;var{R:Cj1,G:Tj1,B:kj1,A:Ej1}=X9;class ST extends t1{init(){this.extensionName=GT,this.propertyType="Specular",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{specularFactor:1,specularTexture:null,specularTextureInfo:new I1(this.graph,"specularTextureInfo"),specularColorFactor:[1,1,1],specularColorTexture:null,specularColorTextureInfo:new I1(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:Ej1})}getSpecularColorTexture(){return this.getRef("specularColorTexture")}getSpecularColorTextureInfo(){return this.getRef("specularColorTexture")?this.getRef("specularColorTextureInfo"):null}setSpecularColorTexture(Z){return this.setRef("specularColorTexture",Z,{channels:Cj1|Tj1|kj1,isColor:!0})}}ST.EXTENSION_NAME=GT;var iY=GT;class kw extends _1{constructor(...Z){super(...Z);this.extensionName=iY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createSpecular(){return new ST(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[iY]){let W=this.createSpecular();Z.materials[Q].setExtension(iY,W);let K=$.extensions[iY];if(K.specularFactor!==void 0)W.setSpecularFactor(K.specularFactor);if(K.specularColorFactor!==void 0)W.setSpecularColorFactor(K.specularColorFactor);if(K.specularTexture!==void 0){let G=K.specularTexture,z=Z.textures[Y[G.index].source];W.setSpecularTexture(z),Z.setTextureInfo(W.getSpecularTextureInfo(),G)}if(K.specularColorTexture!==void 0){let G=K.specularColorTexture,z=Z.textures[Y[G.index].source];W.setSpecularColorTexture(z),Z.setTextureInfo(W.getSpecularColorTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(iY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[iY]={};if(Y.getSpecularFactor()!==1)W.specularFactor=Y.getSpecularFactor();if(!F8.eq(Y.getSpecularColorFactor(),[1,1,1]))W.specularColorFactor=Y.getSpecularColorFactor();if(Y.getSpecularTexture()){let K=Y.getSpecularTexture(),G=Y.getSpecularTextureInfo();W.specularTexture=Z.createTextureInfoDef(K,G)}if(Y.getSpecularColorTexture()){let K=Y.getSpecularColorTexture(),G=Y.getSpecularColorTextureInfo();W.specularColorTexture=Z.createTextureInfoDef(K,G)}}}),this}}kw.EXTENSION_NAME=iY;var{R:Ij1}=X9;class _T extends t1{init(){this.extensionName=zT,this.propertyType="Transmission",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{transmissionFactor:0,transmissionTexture:null,transmissionTextureInfo:new I1(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:Ij1})}}_T.EXTENSION_NAME=zT;var nY=zT;class xT extends _1{constructor(...Z){super(...Z);this.extensionName=nY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createTransmission(){return new _T(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[nY]){let W=this.createTransmission();Z.materials[Q].setExtension(nY,W);let K=$.extensions[nY];if(K.transmissionFactor!==void 0)W.setTransmissionFactor(K.transmissionFactor);if(K.transmissionTexture!==void 0){let G=K.transmissionTexture,z=Z.textures[Y[G.index].source];W.setTransmissionTexture(z),Z.setTextureInfo(W.getTransmissionTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(nY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[nY]={transmissionFactor:Y.getTransmissionFactor()};if(Y.getTransmissionTexture()){let K=Y.getTransmissionTexture(),G=Y.getTransmissionTextureInfo();W.transmissionTexture=Z.createTextureInfoDef(K,G)}}}),this}}xT.EXTENSION_NAME=nY;class AT extends t1{init(){this.extensionName=HT,this.propertyType="Unlit",this.parentTypes=[s.MATERIAL]}}AT.EXTENSION_NAME=HT;var TW=HT;class Ew extends _1{constructor(...Z){super(...Z);this.extensionName=TW,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createUnlit(){return new AT(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[TW])Z.materials[Y].setExtension(TW,this.createUnlit())}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{if(X.getExtension(TW)){let Y=Z.materialIndexMap.get(X),$=J.json.materials[Y];$.extensions=$.extensions||{},$.extensions[TW]={}}}),this}}Ew.EXTENSION_NAME=TW;class hT extends t1{init(){this.extensionName=oY,this.propertyType="Mapping",this.parentTypes=["MappingList"]}getDefaults(){return Object.assign(super.getDefaults(),{material:null,variants:new E0})}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")}}hT.EXTENSION_NAME=oY;class fT extends t1{init(){this.extensionName=oY,this.propertyType="MappingList",this.parentTypes=[s.PRIMITIVE]}getDefaults(){return Object.assign(super.getDefaults(),{mappings:new E0})}addMapping(Z){return this.addRef("mappings",Z)}removeMapping(Z){return this.removeRef("mappings",Z)}listMappings(){return this.listRefs("mappings")}}fT.EXTENSION_NAME=oY;class Rw extends t1{init(){this.extensionName=oY,this.propertyType="Variant",this.parentTypes=["MappingList"]}}Rw.EXTENSION_NAME=oY;var C7=oY;class bT extends _1{constructor(...Z){super(...Z);this.extensionName=C7}createMappingList(){return new fT(this.document.getGraph())}createVariant(Z=""){return new Rw(this.document.getGraph(),Z)}createMapping(){return new hT(this.document.getGraph())}listVariants(){return Array.from(this.properties).filter((Z)=>Z instanceof Rw)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[C7])return this;let $=(J.json.extensions[C7].variants||[]).map((W)=>this.createVariant().setName(W.name||""));return(J.json.meshes||[]).forEach((W,K)=>{let G=Z.meshes[K];(W.primitives||[]).forEach((H,V)=>{if(!H.extensions||!H.extensions[C7])return;let q=this.createMappingList(),F=H.extensions[C7];for(let U of F.mappings){let B=this.createMapping();if(U.material!==void 0)B.setMaterial(Z.materials[U.material]);for(let w of U.variants||[])B.addVariant($[w]);q.addMapping(B)}G.listPrimitives()[V].setExtension(C7,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 W=Z.meshIndexMap.get(Q);Q.listPrimitives().forEach((K,G)=>{let z=K.getExtension(C7);if(!z)return;let H=Z.jsonDoc.json.meshes[W].primitives[G],V=z.listMappings().map((q)=>{let F=Z.createPropertyDef(q),U=q.getMaterial();if(U)F.material=Z.materialIndexMap.get(U);return F.variants=q.listVariants().map((B)=>$.get(B)),F});H.extensions=H.extensions||{},H.extensions[C7]={mappings:V}})}return J.json.extensions=J.json.extensions||{},J.json.extensions[C7]={variants:Y},this}}bT.EXTENSION_NAME=C7;var{G:vj1}=X9;class yT extends t1{init(){this.extensionName=VT,this.propertyType="Volume",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{thicknessFactor:0,thicknessTexture:null,thicknessTextureInfo:new I1(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:vj1})}getAttenuationDistance(){return this.get("attenuationDistance")}setAttenuationDistance(Z){return this.set("attenuationDistance",Z)}getAttenuationColor(){return this.get("attenuationColor")}setAttenuationColor(Z){return this.set("attenuationColor",Z)}}yT.EXTENSION_NAME=VT;var aY=VT;class gT extends _1{constructor(...Z){super(...Z);this.extensionName=aY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createVolume(){return new yT(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[aY]){let W=this.createVolume();Z.materials[Q].setExtension(aY,W);let K=$.extensions[aY];if(K.thicknessFactor!==void 0)W.setThicknessFactor(K.thicknessFactor);if(K.attenuationDistance!==void 0)W.setAttenuationDistance(K.attenuationDistance);if(K.attenuationColor!==void 0)W.setAttenuationColor(K.attenuationColor);if(K.thicknessTexture!==void 0){let G=K.thicknessTexture,z=Z.textures[Y[G.index].source];W.setThicknessTexture(z),Z.setTextureInfo(W.getThicknessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(aY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[aY]={};if(Y.getThicknessFactor()>0)W.thicknessFactor=Y.getThicknessFactor();if(Number.isFinite(Y.getAttenuationDistance()))W.attenuationDistance=Y.getAttenuationDistance();if(!F8.eq(Y.getAttenuationColor(),[1,1,1]))W.attenuationColor=Y.getAttenuationColor();if(Y.getThicknessTexture()){let K=Y.getThicknessTexture(),G=Y.getThicknessTextureInfo();W.thicknessTexture=Z.createTextureInfoDef(K,G)}}}),this}}gT.EXTENSION_NAME=aY;var ts=pO1;class Gz extends _1{constructor(...Z){super(...Z);this.extensionName=ts}read(Z){return this}write(Z){return this}}Gz.EXTENSION_NAME=ts;var Yz=iO1;class es{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=Ow(Z);return[J.pixelWidth,J.pixelHeight]}getChannels(Z){let X=Ow(Z).dataFormatDescriptor[0];if(X.colorModel===vs)return X.samples.length===2&&(X.samples[1].channelType&15)===15?4:3;else if(X.colorModel===Ss)return(X.samples[0].channelType&15)===3?4:3;throw new Error(`Unexpected KTX2 colorModel, "${X.colorModel}".`)}getVRAMByteLength(Z){let J=Ow(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 W=Math.max(1,Math.floor(J.pixelWidth/Math.pow(2,$))),K=Math.max(1,Math.floor(J.pixelHeight/Math.pow(2,$))),G=X?16:8;Y+=W/4*(K/4)*G}}return Y}}class mT extends _1{constructor(...Z){super(...Z);this.extensionName=Yz,this.prereadTypes=[s.TEXTURE]}static register(){E4.registerFormat("image/ktx2",new es)}preread(Z){return Z.jsonDoc.json.textures.forEach((J)=>{if(J.extensions&&J.extensions[Yz]){let X=J.extensions[Yz];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[Yz]={source:$.source},delete $.source})}}),this}}mT.EXTENSION_NAME=Yz;class uT extends t1{init(){this.extensionName=qT,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)}}uT.EXTENSION_NAME=qT;var sY=qT;class dT extends _1{constructor(...Z){super(...Z);this.extensionName=sY}createTransform(){return new uT(this.document.getGraph())}read(Z){for(let[J,X]of Array.from(Z.textureInfos.entries())){if(!X.extensions||!X.extensions[sY])continue;let Y=this.createTransform(),$=X.extensions[sY];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(sY,Y)}return this}write(Z){let J=Array.from(Z.textureInfoDefMap.entries());for(let[X,Y]of J){let $=X.getExtension(sY);if(!$)continue;Y.extensions=Y.extensions||{};let Q={},W=F8.eq;if(!W($.getOffset(),[0,0]))Q.offset=$.getOffset();if($.getRotation()!==0)Q.rotation=$.getRotation();if(!W($.getScale(),[1,1]))Q.scale=$.getScale();if($.getTexCoord()!=null)Q.texCoord=$.getTexCoord();Y.extensions[sY]=Q}return this}}dT.EXTENSION_NAME=sY;var Sj1=[s.ROOT,s.SCENE,s.NODE,s.MESH,s.MATERIAL,s.TEXTURE,s.ANIMATION];class cT extends t1{init(){this.extensionName=jw,this.propertyType="Packet",this.parentTypes=Sj1}getDefaults(){return Object.assign(super.getDefaults(),{context:{},properties:{}})}getContext(){return this.get("context")}setContext(Z){return this.set("context",kZ({},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=kZ({},this.get("properties"));if(J)X[Z]=J;else delete X[Z];return this.set("properties",X)}toJSONLD(){let Z=nC(this.get("context")),J=nC(this.get("properties"));return kZ({"@context":Z},J)}fromJSONLD(Z){Z=nC(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(`${jw}: Missing context for term, "${Z}".`)}}cT.EXTENSION_NAME=jw;function nC(Z){return JSON.parse(JSON.stringify(Z))}var TZ=jw;class lT extends _1{constructor(...Z){super(...Z);this.extensionName=TZ}createPacket(){return new cT(this.document.getGraph())}listPackets(){return Array.from(this.properties)}read(Z){var J;let X=(J=Z.jsonDoc.json.extensions)==null?void 0:J[TZ];if(!X||!X.packets)return this;let Y=Z.jsonDoc.json,$=this.document.getRoot(),Q=X.packets.map((G)=>this.createPacket().fromJSONLD(G)),W=[[Y.asset],Y.scenes,Y.nodes,Y.meshes,Y.materials,Y.images,Y.animations],K=[[$],$.listScenes(),$.listNodes(),$.listMeshes(),$.listMaterials(),$.listTextures(),$.listAnimations()];for(let G=0;G<W.length;G++){let z=W[G]||[];for(let H=0;H<z.length;H++){let V=z[H];if(V.extensions&&V.extensions[TZ]){let q=V.extensions[TZ];K[G][H].setExtension(TZ,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(`[${TZ}]: Unsupported parent property, "${$.propertyType}"`);break}if(!Q)continue;Q.extensions=Q.extensions||{},Q.extensions[TZ]={packet:X.length-1}}}if(X.length>0)J.extensions=J.extensions||{},J.extensions[TZ]={packets:X};return this}}lT.EXTENSION_NAME=TZ;var _j1=[Kz,UT,BT,OT,MT,NT,PT,Cw,kT,Tw,kw,vT,xT,Ew,bT,gT,Gz,mT,dT,lT],uU6=[Nw,Wz,Dw,Pw,..._j1];var xj1=e(WC(),1);function SW(){return SW=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},SW.apply(null,arguments)}var{POINTS:Zo,LINES:Iw,LINE_STRIP:Aj1,LINE_LOOP:hj1,TRIANGLES:vw,TRIANGLE_STRIP:fj1,TRIANGLE_FAN:bj1}=E8.Mode;function uJ(Z,J){return Object.defineProperty(J,"name",{value:Z}),J}function T7(Z,J){let X=SW({},Z);for(let Y in J)if(J[Y]!==void 0)X[Y]=J[Y];return X}function Mo(Z){let J=Z.getIndices(),X=Z.getAttribute("POSITION");switch(Z.getMode()){case E8.Mode.POINTS:return J?J.getCount():X.getCount();case E8.Mode.LINES:return J?J.getCount()/2:X.getCount()/2;case E8.Mode.LINE_LOOP:return J?J.getCount():X.getCount();case E8.Mode.LINE_STRIP:return J?J.getCount()-1:X.getCount()-1;case E8.Mode.TRIANGLES:return J?J.getCount()/3:X.getCount()/3;case E8.Mode.TRIANGLE_STRIP:case E8.Mode.TRIANGLE_FAN:return J?J.getCount()-2:X.getCount()-2;default:throw new Error("Unexpected mode: "+Z.getMode())}}var yj1=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function aT(Z){return yj1.format(Z)}function gj1(Z,J,X=2){let Y=Z>J?"\u2013":"+",$="%";return Y+(Math.abs(Z-J)/Z*100).toFixed(X)+"%"}function hw(Z,J){return`${aT(Z)} \u2192 ${aT(J)} (${gj1(Z,J)})`}function Jk(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 mj1(Z,J,X){Z.swap(J,X);for(let Y of Z.listTargets())Y.swap(J,X)}function uj1(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 EZ(Z,J){return Z.createAccessor(J.getName()).setArray(J.getArray()).setType(J.getType()).setBuffer(J.getBuffer()).setNormalized(J.getNormalized()).setSparse(J.getSparse())}function dj1(Z,J=Z){let X=Xk(Z,J);for(let Y=0;Y<X.length;Y++)X[Y]=Y;return X}function Xk(Z,J=Z){return J<=65534?new Uint16Array(Z):new Uint32Array(Z)}function cj1(Z){return Z.listParents().some((J)=>J.propertyType!==a.ROOT)}function Ro(Z){for(let J in Z)return!1;return!0}function No(Z){let J=E6.fromGraph(Z.getGraph()),X=Z.getMaterial(),Y=J.getRoot().listMaterials().indexOf(X),$=pj1[Z.getMode()],Q=!!Z.getIndices(),W=Z.listSemantics().sort().map((G)=>{let z=Z.getAttribute(G),H=z.getElementSize(),V=z.getComponentType();return`${G}:${H}:${V}`}).join("+"),K=Z.listTargets().map((G)=>{return G.listSemantics().sort().map((z)=>{let H=Z.getAttribute(z),V=H.getElementSize(),q=H.getComponentType();return`${z}:${V}:${q}`}).join("+")}).join("~");return`${Y}|${$}|${Q}|${W}|${K}`}function lj1(Z){return Math.pow(2,Math.ceil(Math.log(Z)/Math.LN2))}var pj1={[Zo]:Zo,[Iw]:Iw,[Aj1]:Iw,[hj1]:Iw,[vw]:vw,[fj1]:vw,[bj1]:vw},IW="center",Jo={pivot:"center"};function Do(Z=Jo){let J=T7(Jo,Z);return uJ(IW,(X)=>{let Y=X.getLogger(),$=X.getRoot(),Q=$.listAnimations().length>0||$.listSkins().length>0;X.getRoot().listScenes().forEach((W,K)=>{Y.debug(`${IW}: Scene ${K+1} / ${$.listScenes().length}.`);let G;if(typeof J.pivot==="string"){let H=eP(W);if(G=[(H.max[0]-H.min[0])/2+H.min[0],(H.max[1]-H.min[1])/2+H.min[1],(H.max[2]-H.min[2])/2+H.min[2]],J.pivot==="above")G[1]=H.max[1];if(J.pivot==="below")G[1]=H.min[1]}else G=J.pivot;Y.debug(`${IW}: Pivot "${G.join(", ")}".`);let z=[-1*G[0],-1*G[1],-1*G[2]];if(Q){Y.debug(`${IW}: Model contains animation or skin. Adding a wrapper node.`);let H=X.createNode("Pivot").setTranslation(z);W.listChildren().forEach((V)=>H.addChild(V)),W.addChild(H)}else Y.debug(`${IW}: Skipping wrapper, offsetting all root nodes.`),W.listChildren().forEach((H)=>{let V=H.getTranslation();H.setTranslation([V[0]+z[0],V[1]+z[1],V[2]+z[2]])})}),Y.debug(`${IW}: Complete.`)})}function ij1(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 UW)}function nj1(Z){let J=ij1(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 _W=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 aj1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],B=J[13],w=J[14],O=J[15],N=X*K-Y*W,R=X*G-$*W,j=X*z-Q*W,P=Y*G-$*K,D=Y*z-Q*K,C=$*z-Q*G,T=H*B-V*U,k=H*w-q*U,x=H*O-F*U,S=V*w-q*B,A=V*O-F*B,I=q*O-F*w,v=N*I-R*A+j*S+P*x-D*k+C*T;if(!v)return null;return v=1/v,Z[0]=(K*I-G*A+z*S)*v,Z[1]=($*A-Y*I-Q*S)*v,Z[2]=(B*C-w*D+O*P)*v,Z[3]=(q*D-V*C-F*P)*v,Z[4]=(G*x-W*I-z*k)*v,Z[5]=(X*I-$*x+Q*k)*v,Z[6]=(w*j-U*C-O*R)*v,Z[7]=(H*C-q*j+F*R)*v,Z[8]=(W*A-K*x+z*T)*v,Z[9]=(Y*x-X*A-Q*T)*v,Z[10]=(U*D-B*j+O*N)*v,Z[11]=(V*j-H*D-F*N)*v,Z[12]=(K*k-W*S-G*T)*v,Z[13]=(X*S-Y*k+$*T)*v,Z[14]=(B*R-U*P-w*N)*v,Z[15]=(H*P-V*R+q*N)*v,Z}function sj1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],W=Z[5],K=Z[6],G=Z[7],z=Z[8],H=Z[9],V=Z[10],q=Z[11],F=Z[12],U=Z[13],B=Z[14],w=Z[15],O=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,j=X*K-Y*W,P=X*G-$*W,D=Y*G-$*K,C=z*U-H*F,T=z*B-V*F,k=z*w-q*F,x=H*B-V*U,S=H*w-q*U,A=V*w-q*B;return O*A-N*S+R*x+j*k-P*T+D*C}function Po(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=J[9],F=J[10],U=J[11],B=J[12],w=J[13],O=J[14],N=J[15],R=X[0],j=X[1],P=X[2],D=X[3];return Z[0]=R*Y+j*K+P*V+D*B,Z[1]=R*$+j*G+P*q+D*w,Z[2]=R*Q+j*z+P*F+D*O,Z[3]=R*W+j*H+P*U+D*N,R=X[4],j=X[5],P=X[6],D=X[7],Z[4]=R*Y+j*K+P*V+D*B,Z[5]=R*$+j*G+P*q+D*w,Z[6]=R*Q+j*z+P*F+D*O,Z[7]=R*W+j*H+P*U+D*N,R=X[8],j=X[9],P=X[10],D=X[11],Z[8]=R*Y+j*K+P*V+D*B,Z[9]=R*$+j*G+P*q+D*w,Z[10]=R*Q+j*z+P*F+D*O,Z[11]=R*W+j*H+P*U+D*N,R=X[12],j=X[13],P=X[14],D=X[15],Z[12]=R*Y+j*K+P*V+D*B,Z[13]=R*$+j*G+P*q+D*w,Z[14]=R*Q+j*z+P*F+D*O,Z[15]=R*W+j*H+P*U+D*N,Z}function oj1(){var Z=new _W(9);if(_W!=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 rj1(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 tj1(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 ej1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=H*W-K*z,q=-H*Q+K*G,F=z*Q-W*G,U=X*V+Y*q+$*F;if(!U)return null;return U=1/U,Z[0]=V*U,Z[1]=(-H*Y+$*z)*U,Z[2]=(K*Y-$*W)*U,Z[3]=q*U,Z[4]=(H*X-$*G)*U,Z[5]=(-K*X+$*Q)*U,Z[6]=F*U,Z[7]=(-z*X+Y*G)*U,Z[8]=(W*X-Y*Q)*U,Z}function fw(){var Z=new _W(3);if(_W!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function ZM1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z}function Co(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 JM1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=X[3]*Y+X[7]*$+X[11]*Q+X[15];return W=W||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/W,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/W,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/W,Z}function XM1(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 YM1=ZM1;(function(){var Z=fw();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}})();var gJ="dedup",pT={keepUniqueNames:!1,propertyTypes:[a.ACCESSOR,a.MESH,a.TEXTURE,a.MATERIAL,a.SKIN]};function To(Z=pT){let J=T7(pT,Z),X=new Set(J.propertyTypes);for(let Y of J.propertyTypes)if(!pT.propertyTypes.includes(Y))throw new Error(`${gJ}: Unsupported deduplication on type "${Y}".`);return uJ(gJ,(Y)=>{let $=Y.getLogger();if(X.has(a.ACCESSOR))$M1(Y);if(X.has(a.TEXTURE))WM1(Y,J);if(X.has(a.MATERIAL))KM1(Y,J);if(X.has(a.MESH))QM1(Y,J);if(X.has(a.SKIN))GM1(Y,J);$.debug(`${gJ}: Complete.`)})}function $M1(Z){let J=Z.getLogger(),X=new Map,Y=new Map,$=new Map,Q=new Map,W=Z.getRoot().listMeshes();W.forEach((V)=>{V.listPrimitives().forEach((q)=>{q.listAttributes().forEach((F)=>K(F,Y)),K(q.getIndices(),X)})});for(let V of Z.getRoot().listAnimations())for(let q of V.listSamplers())K(q.getInput(),$),K(q.getOutput(),Q);function K(V,q){if(!V)return;let F=[V.getCount(),V.getType(),V.getComponentType(),V.getNormalized(),V.getSparse()].join(":"),U=q.get(F);if(!U)q.set(F,U=new Set);U.add(V)}function G(V,q){for(let F=0;F<V.length;F++){let U=V[F],B=o0.toView(U.getArray());if(q.has(U))continue;for(let w=F+1;w<V.length;w++){let O=V[w];if(q.has(O))continue;if(o0.equals(B,o0.toView(O.getArray())))q.set(O,U)}}}let z=0,H=new Map;for(let V of[Y,X,$,Q])for(let q of V.values())z+=q.size,G(Array.from(q),H);J.debug(`${gJ}: Merged ${H.size} of ${z} accessors.`),W.forEach((V)=>{V.listPrimitives().forEach((q)=>{q.listAttributes().forEach((U)=>{if(H.has(U))q.swap(U,H.get(U))});let F=q.getIndices();if(F&&H.has(F))q.swap(F,H.get(F))})});for(let V of Z.getRoot().listAnimations())for(let q of V.listSamplers()){let F=q.getInput(),U=q.getOutput();if(F&&H.has(F))q.swap(F,H.get(F));if(U&&H.has(U))q.swap(U,H.get(U))}Array.from(H.keys()).forEach((V)=>V.dispose())}function QM1(Z,J){let X=Z.getLogger(),Y=Z.getRoot(),$=new Map;Y.listAccessors().forEach((K,G)=>$.set(K,G)),Y.listMaterials().forEach((K,G)=>$.set(K,G));let Q=Y.listMeshes().length,W=new Map;for(let K of Y.listMeshes()){let G=[];for(let H of K.listPrimitives())G.push(ko(H,$));let z="";if(J.keepUniqueNames)z+=K.getName()+";";if(z+=G.join(";"),W.has(z)){let H=W.get(z);K.listParents().forEach((V)=>{if(V.propertyType!==a.ROOT)V.swap(K,H)}),K.dispose()}else W.set(z,K)}X.debug(`${gJ}: Merged ${Q-W.size} of ${Q} meshes.`)}function WM1(Z,J){let X=Z.getLogger(),Y=Z.getRoot(),$=Y.listTextures(),Q=new Map;for(let W=0;W<$.length;W++){let K=$[W],G=K.getImage();if(Q.has(K))continue;for(let z=W+1;z<$.length;z++){let H=$[z],V=H.getImage();if(Q.has(H))continue;if(K.getMimeType()!==H.getMimeType())continue;if(J.keepUniqueNames&&K.getName()!==H.getName())continue;let q=K.getSize(),F=H.getSize();if(!q||!F)continue;if(q[0]!==F[0])continue;if(q[1]!==F[1])continue;if(!G||!V)continue;if(o0.equals(G,V))Q.set(H,K)}}X.debug(`${gJ}: Merged ${Q.size} of ${Y.listTextures().length} textures.`),Array.from(Q.entries()).forEach(([W,K])=>{W.listParents().forEach((G)=>{if(!(G instanceof SY))G.swap(W,K)}),W.dispose()})}function KM1(Z,J){let X=Z.getLogger(),$=Z.getRoot().listMaterials(),Q=new Map,W=new Map,K=new Set;if(!J.keepUniqueNames)K.add("name");for(let G=0;G<$.length;G++){let z=$[G];if(Q.has(z))continue;if(Xo(z,W))continue;for(let H=G+1;H<$.length;H++){let V=$[H];if(Q.has(V))continue;if(Xo(V,W))continue;if(z.equals(V,K))Q.set(V,z)}}X.debug(`${gJ}: Merged ${Q.size} of ${$.length} materials.`),Array.from(Q.entries()).forEach(([G,z])=>{G.listParents().forEach((H)=>{if(!(H instanceof SY))H.swap(G,z)}),G.dispose()})}function GM1(Z,J){let X=Z.getLogger(),$=Z.getRoot().listSkins(),Q=new Map,W=new Set(["joints"]);if(!J.keepUniqueNames)W.add("name");for(let K=0;K<$.length;K++){let G=$[K];if(Q.has(G))continue;for(let z=K+1;z<$.length;z++){let H=$[z];if(Q.has(H))continue;if(G.equals(H,W)&&uj1(G.listJoints(),H.listJoints()))Q.set(H,G)}}X.debug(`${gJ}: Merged ${Q.size} of ${$.length} skins.`),Array.from(Q.entries()).forEach(([K,G])=>{K.listParents().forEach((z)=>{if(!(z instanceof SY))z.swap(K,G)}),K.dispose()})}function ko(Z,J){let X=[];for(let Y of Z.listSemantics()){let $=Z.getAttribute(Y);X.push(Y+":"+J.get($))}if(Z instanceof E8){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:"+ko(Q,J))}return X.join(",")}function Xo(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 W=Q.getChild();if(Y.has(W))continue;for(let K of X.listChildEdges(W))$.push(K)}return J.set(Z,!1),!1}function Eo(){var Z=new _W(4);if(_W!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function zM1(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 HM1(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 VM1(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 qM1(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 FM1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return Math.hypot(J,X,Y,$)}var Io=HM1,UM1=VM1,vo=FM1;(function(){var Z=Eo();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=4;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Z[3]=J[K+3],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2],J[K+3]=Z[3];return J}})();var wM1=/color|emissive|diffuse/i;function BM1(Z){return Z.getGraph().listParentEdges(Z).some(($)=>{return $.getAttributes().isColor||wM1.test($.getName())})?"srgb":null}function LM1(Z){let J=Z.getGraph(),X=new Set,Y=new Set;function $(Q){let W=new Set;for(let K of J.listChildEdges(Q))if(K.getChild()instanceof vY)W.add(K.getName()+"Info");for(let K of J.listChildEdges(Q)){let G=K.getChild();if(X.has(G))continue;if(X.add(G),G instanceof D5&&W.has(K.getName()))Y.add(G);else if(G instanceof FW)$(G)}}return $(Z),Array.from(Y)}function OM1(Z){let X=E6.fromGraph(Z.getGraph()).getRoot(),Y=Z.getGraph().listParentEdges(Z).filter(($)=>$.getParent()!==X).map(($)=>$.getName());return Array.from(new Set(Y))}var vW="prune",sT=0.011764705882352941,Yo={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 bw(Z=Yo){let J=T7(Yo,Z),X=new Set(J.propertyTypes),Y=J.keepExtras;return uJ(vW,async($)=>{let Q=$.getLogger(),W=$.getRoot(),K=$.getGraph(),G=new So,z=(H)=>G.dispose(H.target);if(K.addEventListener("node:dispose",z),X.has(a.MESH))for(let H of W.listMeshes()){if(H.listPrimitives().length>0)continue;H.dispose()}if(X.has(a.NODE)){if(!J.keepLeaves)for(let H of W.listScenes())_o(K,H,Y);for(let H of W.listNodes())h9(H,Y)}if(X.has(a.SKIN))for(let H of W.listSkins())h9(H,Y);if(X.has(a.MESH))for(let H of W.listMeshes())h9(H,Y);if(X.has(a.CAMERA))for(let H of W.listCameras())h9(H,Y);if(X.has(a.PRIMITIVE))$o(K,a.PRIMITIVE,Y);if(X.has(a.PRIMITIVE_TARGET))$o(K,a.PRIMITIVE_TARGET,Y);if(!J.keepAttributes&&X.has(a.ACCESSOR)){let H=new Map;for(let V of W.listMeshes())for(let q of V.listPrimitives()){let F=q.getMaterial();if(!F)continue;let U=xo($,q,F),B=MM1(q,U);Qo(q,B),q.listTargets().forEach((w)=>Qo(w,B)),H.has(F)?H.get(F).add(q):H.set(F,new Set([q]))}for(let[V,q]of H)RM1(V,Array.from(q))}if(!J.keepIndices&&X.has(a.ACCESSOR))for(let H of W.listMeshes())for(let V of H.listPrimitives())jM1(V);if(X.has(a.ANIMATION))for(let H of W.listAnimations()){for(let V of H.listChannels())if(!V.getTargetNode())V.dispose();if(!H.listChannels().length){let V=H.listSamplers();h9(H,Y),V.forEach((q)=>h9(q,Y))}else H.listSamplers().forEach((V)=>h9(V,Y))}if(X.has(a.MATERIAL))W.listMaterials().forEach((H)=>h9(H,Y));if(X.has(a.TEXTURE)){if(W.listTextures().forEach((H)=>h9(H,Y)),!J.keepSolidTextures)await NM1($)}if(X.has(a.ACCESSOR))W.listAccessors().forEach((H)=>h9(H,Y));if(X.has(a.BUFFER))W.listBuffers().forEach((H)=>h9(H,Y));if(K.removeEventListener("node:dispose",z),!G.empty()){let H=G.entries().map(([V,q])=>`${V} (${q})`).join(", ");Q.info(`${vW}: Removed types... ${H}`)}else Q.debug(`${vW}: No unused properties found.`);Q.debug(`${vW}: Complete.`)})}class So{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 h9(Z,J){let X=Z.listParents().filter(($)=>!($ instanceof SY||$ instanceof EY)),Y=J&&!Ro(Z.getExtras());if(!X.length&&!Y)Z.dispose()}function $o(Z,J,X){for(let Y of Z.listEdges()){let $=Y.getParent();if($.propertyType===J)h9($,X)}}function _o(Z,J,X){if(J.listChildren().forEach((W)=>_o(Z,W,X)),J instanceof UW)return;let Y=Z.listParentEdges(J).some((W)=>{let K=W.getParent().propertyType;return K!==a.ROOT&&K!==a.SCENE&&K!==a.NODE}),$=Z.listChildren(J).length===0,Q=X&&!Ro(J.getExtras());if($&&!Y&&!Q)J.dispose()}function Qo(Z,J){for(let X of J)Z.setAttribute(X,null)}function jM1(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 MM1(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 xo(Z,J,X,Y=new Set){let Q=Z.getGraph().listChildEdges(X),W=new Set;for(let z of Q)if(z.getChild()instanceof vY)W.add(z.getName());for(let z of Q){let H=z.getName(),V=z.getChild();if(V instanceof D5){if(W.has(H.replace(/Info$/,"")))Y.add(`TEXCOORD_${V.getTexCoord()}`)}if(V instanceof vY&&H.match(/normalTexture/i))Y.add("TANGENT");if(V instanceof FW)xo(Z,J,V,Y)}let K=X instanceof L7&&!X.getExtension("KHR_materials_unlit"),G=J.getMode()===E8.Mode.POINTS;if(K&&!G)Y.add("NORMAL");return Y}function RM1(Z,J){let X=LM1(Z),Y=new Set(X.map((G)=>G.getTexCoord())),$=Array.from(Y).sort(),Q=new Map($.map((G,z)=>[G,z])),W=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((H)=>H.startsWith("TEXCOORD_")).sort();K(G,z),G.listTargets().forEach((H)=>K(H,z))}function K(G,z){for(let H of z){let V=G.getAttribute(H);if(!V)continue;let q=W.get(H);if(q===H)continue;G.setAttribute(q,V),G.setAttribute(H,null)}}}async function NM1(Z){let J=Z.getRoot(),X=Z.getGraph(),Y=Z.getLogger(),Q=J.listTextures().map(async(W)=>{var K;let G=await PM1(W);if(!G)return;if(BM1(W)==="srgb")ZC.convertSRGBToLinear(G,G);let z=W.getName()||W.getURI(),H=(K=W.getSize())==null?void 0:K.join("x"),V=OM1(W);for(let q of X.listParentEdges(W)){let F=q.getParent();if(F!==J&&DM1(F,G,q.getName(),Y))q.dispose()}if(W.listParents().length===1)W.dispose(),Y.debug(`${vW}: Removed solid-color texture "${z}" (${H}px ${V.join(", ")})`)});await Promise.all(Q)}function DM1(Z,J,X,Y){if(Z instanceof L7)switch(X){case"baseColorTexture":return Z.setBaseColorFactor(UM1(J,J,Z.getBaseColorFactor())),!0;case"emissiveTexture":return Z.setEmissiveFactor(YM1([0,0,0],J.slice(0,3),Z.getEmissiveFactor())),!0;case"occlusionTexture":return Math.abs(J[0]-1)<=sT;case"metallicRoughnessTexture":return Z.setRoughnessFactor(J[1]*Z.getRoughnessFactor()),Z.setMetallicFactor(J[2]*Z.getMetallicFactor()),!0;case"normalTexture":return vo(Io(Eo(),J,[0.5,0.5,1,1]))<=sT}return Y.warn(`${vW}: Detected single-color ${X} texture. Pruning ${X} not yet supported.`),!1}async function PM1(Z){let J=await CM1(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,W]=J.shape;for(let K=0;K<Q;K++){for(let G=0;G<W;G++)for(let z=0;z<4;z++)X[z]=Math.min(X[z],J.get(K,G,z)),Y[z]=Math.max(Y[z],J.get(K,G,z));if(vo(Io($,Y,X))/255>sT)return null}return qM1($,zM1($,Y,X),0.00196078431372549)}async function CM1(Z){try{return await Os(Z.getImage(),Z.getMimeType())}catch(J){return null}}var yJ=4294967295;class Ao{constructor(Z){this.attributes=[],this.u8=void 0,this.u32=void 0;let J=0;for(let X of Jk(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(),$=o0.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 TM1(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 TM1(Z,J){for(let $=0,Q=J.length;$<Q;$++){let W=J[$];W=Math.imul(W,1540483477)>>>0,W=(W^W>>24)>>>0,W=Math.imul(W,1540483477)>>>0,Z=Math.imul(Z,1540483477)>>>0,Z=(Z^W)>>>0}return Z}function kM1(Z,J,X,Y,$=yJ){let Q=J-1,K=X.hash(Y)&Q;for(let G=0;G<=Q;G++){let z=Z[K];if(z===$||X.equal(z,Y))return K;K=K+G+1&Q}throw new Error("Hash table full.")}var O6;(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"})(O6||(O6={}));function mJ(Z,J){let X=Z.getAttribute("POSITION"),Y=Z.getIndices();switch(J){case O6.RENDER:return Y?Y.getCount():X.getCount();case O6.RENDER_CACHED:return Y?new Set(Y.getArray()).size:X.getCount();case O6.UPLOAD_NAIVE:case O6.UPLOAD:return X.getCount();case O6.DISTINCT:case O6.DISTINCT_POSITION:return EM1(J);case O6.UNUSED:return Y?X.getCount()-new Set(Y.getArray()).size:0;default:return IM1(J)}}function EM1(Z){throw new Error(`Not implemented: ${Z}`)}function IM1(Z){throw new Error(`Unexpected value: ${Z}`)}function Hz(Z,J,X){let Y=E6.fromGraph(Z.getGraph());if(!J||!X)[J,X]=vM1(Z);let $=Z.getIndices(),Q=$?$.getArray():null,W=mJ(Z,O6.RENDER),K=Y.createAccessor(),G=W,z=Xk(G,X);for(let V=0;V<G;V++)z[V]=J[Q?Q[V]:V];Z.setIndices(K.setArray(z));let H=Jk(Z);for(let V of Z.listAttributes()){let q=EZ(Y,V);oT(V,$,J,q,X),Z.swap(V,q)}for(let V of Z.listTargets())for(let q of V.listAttributes()){let F=EZ(Y,q);oT(q,$,J,F,X),V.swap(q,F)}if($&&$.listParents().length===1)$.dispose();for(let V of H)if(V.listParents().length===1)V.dispose();return Z}function oT(Z,J,X,Y,$){let Q=Z.getElementSize(),W=Z.getArray(),K=J?J.getArray():null,G=J?J.getCount():Z.getCount(),z=new W.constructor($*Q),H=new Uint8Array($);for(let V=0;V<G;V++){let q=K?K[V]:V,F=X[q];if(H[F])continue;for(let U=0;U<Q;U++)z[F*Q+U]=W[q*Q+U];H[F]=1}return Y.setArray(z)}function vM1(Z){let J=mJ(Z,O6.UPLOAD),X=Z.getIndices(),Y=X?X.getArray():null;if(!X||!Y)return[dj1(J,1e6),J];let $=new Uint32Array(J).fill(yJ),Q=0;for(let W=0;W<Y.length;W++){let K=Y[W];if($[K]===yJ)$[K]=Q++}return[$,Q]}var rT="weld",_w={overwrite:!0,cleanup:!0};function Yk(Z=_w){let J=T7(_w,Z);return uJ(rT,async(X)=>{let Y=X.getLogger();for(let $ of X.getRoot().listMeshes()){for(let Q of $.listPrimitives())if(yw(Q,J),mJ(Q,O6.RENDER)===0)Q.dispose();if($.listPrimitives().length===0)$.dispose()}if(J.cleanup)await X.transform(bw({propertyTypes:[a.ACCESSOR,a.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),To({propertyTypes:[a.ACCESSOR]}));Y.debug(`${rT}: Complete.`)})}function yw(Z,J=_w){let X=Z.getGraph(),$=E6.fromGraph(X).getLogger(),Q=SW({},_w,J);if(Z.getIndices()&&!Q.overwrite)return;if(Z.getMode()===E8.Mode.POINTS)return;let W=Z.getAttribute("POSITION").getCount(),K=Z.getIndices(),G=K==null?void 0:K.getArray(),z=K?K.getCount():W,H=new Ao(Z),V=lj1(W+W/4),q=new Uint32Array(V).fill(yJ),F=new Uint32Array(W).fill(yJ),U=0;for(let B=0;B<z;B++){let w=G?G[B]:B;if(F[w]!==yJ)continue;let O=kM1(q,V,H,w,yJ),N=q[O];if(N===yJ)q[O]=w,F[w]=U++;else F[w]=F[N]}$.debug(`${rT}: ${hw(W,U)} vertices.`),Hz(Z,F,U)}var{FLOAT:SM1}=h0.ComponentType;function ho(Z,J){let X=Z.getAttribute("POSITION");if(X)Wo(J,X);let Y=Z.getAttribute("NORMAL");if(Y)Ko(J,Y);let $=Z.getAttribute("TANGENT");if($)Go(J,$);for(let Q of Z.listTargets()){let W=Q.getAttribute("POSITION");if(W)Wo(J,W);let K=Q.getAttribute("NORMAL");if(K)Ko(J,K);let G=Q.getAttribute("TANGENT");if(G)Go(J,G)}if(sj1(J)<0)_M1(Z)}function Wo(Z,J){let X=J.getComponentType(),Y=J.getNormalized(),$=J.getArray(),Q=X===SM1?$:new Float32Array($.length),W=fw();for(let K=0,G=J.getCount();K<G;K++){if(Y)W[0]=i0.decodeNormalizedInt($[K*3],X),W[1]=i0.decodeNormalizedInt($[K*3+1],X),W[2]=i0.decodeNormalizedInt($[K*3+2],X);else W[0]=$[K*3],W[1]=$[K*3+1],W[2]=$[K*3+2];JM1(W,W,Z),Q[K*3]=W[0],Q[K*3+1]=W[1],Q[K*3+2]=W[2]}J.setArray(Q).setNormalized(!1)}function Ko(Z,J){let X=J.getArray(),Y=J.getNormalized(),$=J.getComponentType(),Q=oj1();rj1(Q,Z),ej1(Q,Q),tj1(Q,Q);let W=fw();for(let K=0,G=J.getCount();K<G;K++){if(Y)W[0]=i0.decodeNormalizedInt(X[K*3],$),W[1]=i0.decodeNormalizedInt(X[K*3+1],$),W[2]=i0.decodeNormalizedInt(X[K*3+2],$);else W[0]=X[K*3],W[1]=X[K*3+1],W[2]=X[K*3+2];if(XM1(W,W,Q),Co(W,W),Y)X[K*3]=i0.decodeNormalizedInt(W[0],$),X[K*3+1]=i0.decodeNormalizedInt(W[1],$),X[K*3+2]=i0.decodeNormalizedInt(W[2],$);else X[K*3]=W[0],X[K*3+1]=W[1],X[K*3+2]=W[2]}}function Go(Z,J){let X=J.getArray(),Y=J.getNormalized(),$=J.getComponentType(),Q=fw();for(let W=0,K=J.getCount();W<K;W++){if(Y)Q[0]=i0.decodeNormalizedInt(X[W*4],$),Q[1]=i0.decodeNormalizedInt(X[W*4+1],$),Q[2]=i0.decodeNormalizedInt(X[W*4+2],$);else Q[0]=X[W*4],Q[1]=X[W*4+1],Q[2]=X[W*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],Co(Q,Q),Y)X[W*4]=i0.decodeNormalizedInt(Q[0],$),X[W*4+1]=i0.decodeNormalizedInt(Q[1],$),X[W*4+2]=i0.decodeNormalizedInt(Q[2],$);else X[W*4]=Q[0],X[W*4+1]=Q[1],X[W*4+2]=Q[2]}}function _M1(Z){if(Z.getMode()!==E8.Mode.TRIANGLES)return;if(!Z.getIndices())yw(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 xM1(Z,J){for(let X of Z.listPrimitives()){let Y=AM1(X,Z);if(X!==Y)Z.removePrimitive(X).addPrimitive(Y)}for(let X of Z.listPrimitives())Hz(X),ho(X,J)}function AM1(Z,J){if(Z.listParents().some((Y)=>Y instanceof mG&&Y!==J))Z=Z.clone();for(let Y of Z.listTargets())if(Y.listParents().some((Q)=>Q instanceof E8&&Q!==Z))Z.removeTarget(Y).addTarget(Y.clone());return Z}var zo=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function fo(Z){let J=Z.getMesh(),X=Z.getMatrix();if(J&&!i0.eq(X,zo))xM1(J,X);for(let Y of Z.listChildren()){let $=Y.getMatrix();Po($,$,X),Y.setMatrix($)}return Z.setMatrix(zo)}var{LINES:hM1,LINE_STRIP:fM1,LINE_LOOP:bM1,TRIANGLES:yM1,TRIANGLE_STRIP:gM1,TRIANGLE_FAN:mM1}=E8.Mode;function uM1(Z){let J=Z.getGraph(),X=E6.fromGraph(J);if(!Z.getIndices())yw(Z);let Y=Z.getIndices(),$=Y.getArray(),Q=Mo(Z),K=new IJ[Y.getComponentType()](Q*2),G=Z.getMode();if(G===fM1)for(let H=0;H<Q;H++)K[H*2]=$[H],K[H*2+1]=$[H+1];else if(G===bM1)for(let H=0;H<Q;H++)if(H<Q-1)K[H*2]=$[H],K[H*2+1]=$[H+1];else K[H*2]=$[H],K[H*2+1]=$[0];else throw new Error("Only LINE_STRIP and LINE_LOOP may be converted to LINES.");Z.setMode(hM1);let z=X.getRoot();if(Y.listParents().some((H)=>H!==z&&H!==Z))Z.setIndices(EZ(X,Y).setArray(K));else Y.setArray(K)}function bo(Z){let J=Z.getGraph(),X=E6.fromGraph(J);if(!Z.getIndices())yw(Z);let Y=Z.getIndices(),$=Y.getArray(),Q=Mo(Z),K=new IJ[Y.getComponentType()](Q*3),G=Z.getMode();if(G===gM1)for(let H=0,V=$.length;H<V-2;H++)if(H%2)K[H*3]=$[H+1],K[H*3+1]=$[H],K[H*3+2]=$[H+2];else K[H*3]=$[H],K[H*3+1]=$[H+1],K[H*3+2]=$[H+2];else if(G===mM1)for(let H=0;H<Q;H++)K[H*3]=$[0],K[H*3+1]=$[H+1],K[H*3+2]=$[H+2];else throw new Error("Only TRIANGLE_STRIP and TRIANGLE_FAN may be converted to TRIANGLES.");Z.setMode(yM1);let z=X.getRoot();if(Y.listParents().some((H)=>H!==z&&H!==Z))Z.setIndices(EZ(X,Y).setArray(K));else Y.setArray(K)}var Ho="dequantize",xw={pattern:/^((?!JOINTS_).)*$/};function yo(Z=xw){let J=T7(xw,Z);return uJ(Ho,(X)=>{let Y=X.getLogger();for(let $ of X.getRoot().listMeshes())for(let Q of $.listPrimitives())dM1(Q,J);X.createExtension(Gz).dispose(),Y.debug(`${Ho}: Complete.`)})}function dM1(Z,J=xw){let X=T7(xw,J);for(let Y of Z.listSemantics())if(X.pattern.test(Y))tT(Z.getAttribute(Y));for(let Y of Z.listTargets())for(let $ of Y.listSemantics())if(X.pattern.test($))tT(Y.getAttribute($))}function tT(Z){let J=Z.getArray();if(!J)return;let X=Aw(J,Z.getComponentType(),Z.getNormalized());Z.setArray(X).setNormalized(!1)}function Aw(Z,J,X){let Y=new Float32Array(Z.length);for(let $=0,Q=Z.length;$<Q;$++)if(X)Y[$]=i0.decodeNormalizedInt(Z[$],J);else Y[$]=Z[$];return Y}var{TEXTURE_INFO:go,ROOT:nU6}=a;function mo(Z){let J=new E6().setLogger(Z.getLogger()),X=$k(J,Z);return cM1(J,Z,X),J.getRoot().copy(Z.getRoot(),X),J}function cM1(Z,J,X){X||(X=$k(Z,J));for(let Y of J.getRoot().listExtensionsUsed()){let $=Z.createExtension(Y.constructor);if(Y.isRequired())$.setRequired(!0)}return lM1(Z,J,pM1(J),X)}function lM1(Z,J,X,Y){Y||(Y=$k(Z,J));let $=new Map;for(let Q of X)if(!$.has(Q)&&Q.propertyType!==go)$.set(Q,Y(Q));for(let[Q,W]of $.entries())W.copy(Q,Y);return $}function $k(Z,J){let X=new Map([[J.getRoot(),Z.getRoot()]]);return(Y)=>{if(Y.propertyType===go)return Y;let $=X.get(Y);if(!$)$=new Y.constructor(Z.getGraph()),X.set(Y,$);return $}}function pM1(Z){let J=new Set;for(let X of Z.getGraph().listEdges())J.add(X.getChild());return Array.from(J)}var iT="flatten",Vo={cleanup:!0};function uo(Z=Vo){let J=T7(Vo,Z);return uJ(iT,async(X)=>{let Y=X.getRoot(),$=X.getLogger(),Q=new Set;for(let z of Y.listSkins())for(let H of z.listJoints())Q.add(H);let W=new Set;for(let z of Y.listAnimations())for(let H of z.listChannels()){let V=H.getTargetNode();if(V&&H.getTargetPath()!=="weights")W.add(V)}let K=new Set,G=new Set;for(let z of Y.listScenes())z.traverse((H)=>{let V=H.getParentNode();if(!V)return;if(Q.has(V)||K.has(V))K.add(H);if(W.has(V)||G.has(V))G.add(H)});for(let z of Y.listScenes())z.traverse((H)=>{if(W.has(H))return;if(K.has(H))return;if(G.has(H))return;nj1(H)});if(W.size)$.debug(`${iT}: Flattening node hierarchies with TRS animation not yet supported.`);if(J.cleanup)await X.transform(bw({propertyTypes:[a.NODE],keepLeaves:!1}));$.debug(`${iT}: Complete.`)})}function co(Z){return eP(Z)}var iM1={skipValidation:!1},qo=4294967295,{LINE_STRIP:nM1,LINE_LOOP:aM1,TRIANGLE_STRIP:sM1,TRIANGLE_FAN:oM1}=E8.Mode;function rM1(Z,J={}){let X=T7(iM1,J),Y=Z[0],$=E6.fromGraph(Y.getGraph());if(!X.skipValidation&&new Set(Z.map(No)).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 nM1:case aM1:uM1(F);break;case sM1:case oM1:bo(F);break}let Q=[],W=new Uint32Array(Z.length),K=0,G=0;for(let F=0;F<Z.length;F++){let U=Z[F],B=U.getIndices(),w=U.getAttribute("POSITION").getCount(),O=B?B.getArray():null,N=B?B.getCount():w,R=new Uint32Array(w).fill(qo);for(let j=0;j<N;j++){let P=O?O[j]:j;if(R[P]===qo)R[P]=K++,W[F]++}Q.push(R),G+=N}let z=$.createPrimitive().setMode(Y.getMode()).setMaterial(Y.getMaterial());for(let F of Y.listSemantics()){let U=Y.getAttribute(F),B=IJ[U.getComponentType()],w=EZ($,U).setArray(new B(K*U.getElementSize()));z.setAttribute(F,w)}let H=Y.getIndices(),V=H?EZ($,H).setArray(Xk(G,K)):null;z.setIndices(V);let q=0;for(let F=0;F<Q.length;F++){let U=Z[F],B=U.getIndices(),w=B?B.getCount():-1,O=Q[F];if(B&&V)eM1(B,O,V,q),q+=w;for(let N of z.listSemantics()){let R=U.getAttribute(N),j=z.getAttribute(N);tM1(R,B,O,j)}}return z}function tM1(Z,J,X,Y){let $=Z.getElementSize(),Q=J?J.getArray():null,W=Z.getCount(),K=Z.getArray(),G=Y.getArray(),z=new Uint8Array(Z.getCount());for(let H=0,V=J?J.getCount():W;H<V;H++){let q=Q?Q[H]:H,F=X[q];if(z[F])continue;for(let U=0;U<$;U++)G[F*$+U]=K[q*$+U];z[F]=1}}function eM1(Z,J,X,Y){let $=Z.getCount(),Q=Z.getArray(),W=X.getArray();for(let K=0;K<$;K++){let G=Q[K],z=J[G];W[Y+K]=z}}var eT="join",{ROOT:ZR1,NODE:JR1,MESH:XR1,PRIMITIVE:YR1,ACCESSOR:$R1}=a,nT=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Fo={keepMeshes:!1,keepNamed:!1,cleanup:!0};function lo(Z=Fo){let J=T7(Fo,Z);return uJ(eT,async(X)=>{let Y=X.getRoot(),$=X.getLogger();for(let Q of Y.listScenes())Uo(X,Q,J),Q.traverse((W)=>Uo(X,W,J));if(J.cleanup)await X.transform(bw({propertyTypes:[JR1,XR1,YR1,$R1],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}));$.debug(`${eT}: Complete.`)})}function Uo(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 EY))continue;let V=z.getMesh();if(!V)continue;if(z.getExtension("EXT_mesh_gpu_instancing"))continue;if(z.getSkin())continue;for(let q of V.listPrimitives()){if(q.listTargets().length>0)continue;let F=q.getMaterial();if(F&&F.getExtension("KHR_materials_volume"))continue;Hz(q),WR1(q);let U=No(q),B=V.getName()||z.getName();if(X.keepMeshes||X.keepNamed&&B)U+=`|${G}`;if(!(U in $))$[U]={prims:[],primMeshes:[],primNodes:[],dstNode:z,dstMesh:void 0};let w=$[U];w.prims.push(q),w.primNodes.push(z)}}let W=Object.values($).filter(({prims:G})=>G.length>1),K=new Set(W.flatMap((G)=>G.primNodes));for(let G of K){let z=G.getMesh();if(z.listParents().some((V)=>{return V.propertyType!==ZR1&&G!==V}))G.setMesh(z.clone())}for(let G of W){let{dstNode:z,primNodes:H}=G;G.dstMesh=z.getMesh(),G.primMeshes=H.map((V)=>V.getMesh())}for(let G of W){let{prims:z,primNodes:H,primMeshes:V,dstNode:q,dstMesh:F}=G,U=q.getMatrix();for(let O=0;O<z.length;O++){let N=H[O],R=V[O],j=z[O];if(R.removePrimitive(j),cj1(j))j=z[O]=QR1(z[O]);if(N!==q)Po(nT,aj1(nT,U),N.getMatrix()),ho(j,nT)}let B=rM1(z),w=B.listAttributes()[0].getCount();F.addPrimitive(B),Y.debug(`${eT}: Joined Primitives (${z.length}) containing ${aT(w)} vertices under Node "${q.getName()}".`)}}function QR1(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 WR1(Z){for(let J of["POSITION","NORMAL","TANGENT"]){let X=Z.getAttribute(J);if(X)tT(X)}}var{TRANSLATION:aU6,ROTATION:sU6,SCALE:oU6,WEIGHTS:rU6}=EY.TargetPath;var KR1={pattern:/.*/,quantizationVolume:"mesh",quantizePosition:14,quantizeNormal:10,quantizeTexcoord:12,quantizeColor:8,quantizeWeight:8,quantizeGeneric:12,normalizeWeights:!0,cleanup:!0};var tU6=SW({level:"high"},KR1);var GR1="unweld";function zR1(Z,J=new Map){let X=Z.getIndices();if(!X)return;let Y=Z.getGraph(),$=E6.fromGraph(Y),Q=$.getLogger(),W=Z.getAttribute("POSITION").getCount();for(let G of Z.listAttributes())if(Z.swap(G,wo($,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,wo($,z,X,J)),z.listParents().length===1)z.dispose();let K=Z.getAttribute("POSITION").getCount();if(Q.debug(`${GR1}: ${hw(W,K)} vertices.`),Z.setIndices(null),X.listParents().length===1)X.dispose()}function wo(Z,J,X,Y){if(Y.has(J)&&Y.get(J).has(X))return Y.get(J).get(X);let $=J.getArray(),W=new $.constructor(X.getCount()*J.getElementSize()),K=X.getArray(),G=J.getElementSize();for(let H=0,V=X.getCount();H<V;H++)for(let q=0;q<G;q++)W[H*G+q]=$[K[H]*G+q];if(!Y.has(J))Y.set(J,new Map);let z=EZ(Z,J).setArray(W);return Y.get(J).set(X,z),z}var Bo;(function(Z){Z[Z.STEP=0]="STEP",Z[Z.LERP=1]="LERP",Z[Z.SLERP=2]="SLERP"})(Bo||(Bo={}));var HR1=0.000001;function VR1(Z,J,X,Y=0.0001){let $=J.length/Z.length,Q=new Array($).fill(0),W=new Array($).fill(0),K=new Array($).fill(0),G=new Array($).fill(0),z=Z.length-1,H=1;for(let V=1;V<z;++V){let q=Z[H-1],F=Z[V],U=Z[V+1],B=(F-q)/(U-q),w=!1;if(F!==U&&(V!==1||F!==Z[0])){if(zz(J,H-1,G),zz(J,V,W),zz(J,V+1,K),X==="slerp"){let O=UR1(Q,G,K,B),N=Oo(G,W)+Oo(W,K);w=!Sw(W,O,Y)||N+Number.EPSILON>=Math.PI}else if(X==="lerp"){let O=FR1(Q,G,K,B);w=!Sw(W,O,Y)}else if(X==="step")w=!Sw(W,G)||!Sw(W,K)}if(w){if(V!==H)Z[H]=Z[V],Lo(J,H,zz(J,V,Q));H++}}if(z>0)Z[H]=Z[z],Lo(J,H,zz(J,z,Q)),H++;return H}function zz(Z,J,X){for(let Y=0,$=X.length;Y<$;Y++)X[Y]=Z[J*$+Y];return X}function Lo(Z,J,X){for(let Y=0,$=X.length;Y<$;Y++)Z[J*$+Y]=X[Y]}function Sw(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 qR1(Z,J,X){return Z*(1-X)+J*X}function FR1(Z,J,X,Y){for(let $=0;$<J.length;$++)Z[$]=qR1(J[$],X[$],Y);return Z}function UR1(Z,J,X,Y){let $=J[0],Q=J[1],W=J[2],K=J[3],G=X[0],z=X[1],H=X[2],V=X[3],q,F,U,B,w;if(F=$*G+Q*z+W*H+K*V,F<0)F=-F,G=-G,z=-z,H=-H,V=-V;if(1-F>HR1)q=Math.acos(F),U=Math.sin(q),B=Math.sin((1-Y)*q)/U,w=Math.sin(Y*q)/U;else B=1-Y,w=Y;return Z[0]=B*$+w*G,Z[1]=B*Q+w*z,Z[2]=B*W+w*H,Z[3]=B*K+w*V,Z}function Oo(Z,J){let X=wR1(Z,J);return Math.acos(2*X*X-1)}function wR1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}var eU6=new Float32Array(0),Z26={ready:Promise.resolve(),resample:VR1,tolerance:0.0001,cleanup:!0};var rY="simplify",{POINTS:po,LINES:BR1,LINE_STRIP:LR1,LINE_LOOP:OR1,TRIANGLES:jR1,TRIANGLE_STRIP:io,TRIANGLE_FAN:no}=E8.Mode,ao={ratio:0,error:0.0001,lockBorder:!1,cleanup:!0};function so(Z){let J=T7(ao,Z),X=J.simplifier;if(!X)throw new Error(`${rY}: simplifier dependency required \u2014 install "meshoptimizer".`);return uJ(rY,async(Y)=>{let $=Y.getLogger();await X.ready,await Y.transform(Yk({overwrite:!1,cleanup:J.cleanup}));let Q=0;for(let W of Y.getRoot().listMeshes()){for(let K of W.listPrimitives()){let G=K.getMode();if(G===jR1||G===io||G===no){if(jo(K,J),mJ(K,O6.RENDER)===0)K.dispose()}else if(K.getMode()===po&&!!X.simplifyPoints){if(jo(K,J),mJ(K,O6.RENDER)===0)K.dispose()}else Q++}if(W.listPrimitives().length===0)W.dispose()}if(Q>0)$.warn(`${rY}: Skipping simplification of ${Q} primitives: Unsupported draw mode.`);if(J.cleanup)await Y.transform(bw({propertyTypes:[a.ACCESSOR,a.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),To({propertyTypes:[a.ACCESSOR]}));$.debug(`${rY}: Complete.`)})}function jo(Z,J){let X=SW({},ao,J),Y=X.simplifier,$=Z.getGraph(),Q=E6.fromGraph($),W=Q.getLogger();switch(Z.getMode()){case po:return MR1(Q,Z,X);case BR1:case LR1:case OR1:return W.warn(`${rY}: Skipping primitive simplification: Unsupported draw mode.`),Z;case io:case no:bo(Z);break}let K=mJ(Z,O6.UPLOAD),G=mJ(Z,O6.RENDER);if(G<K/2)Hz(Z);let z=Z.getAttribute("POSITION"),H=Z.getIndices(),V=z.getArray(),q=H.getArray();if(!(V instanceof Float32Array))V=Aw(V,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"]:[],[B,w]=Y.simplify(q,V,3,F,X.error,U);if(Z.setIndices(EZ(Q,H).setArray(B)),H.listParents().length===1)H.dispose();Hz(Z);let O=mJ(Z,O6.UPLOAD);if(O<=65534)Z.getIndices().setArray(new Uint16Array(Z.getIndices().getArray()));return W.debug(`${rY}: ${hw(K,O)} vertices, error: ${w.toFixed(4)}.`),Z}function MR1(Z,J,X){let Y=X.simplifier,$=Z.getLogger();if(J.getIndices())zR1(J);let W=J.getAttribute("POSITION"),K=J.getAttribute("COLOR_0"),G=W.getCount(),z=W.getArray(),H=K?K.getArray():void 0,V=K?K.getComponentSize():void 0;if(!(z instanceof Float32Array))z=Aw(z,W.getComponentType(),W.getNormalized());if(H&&!(H instanceof Float32Array))H=Aw(H,W.getComponentType(),W.getNormalized());Y.useExperimentalFeatures=!0;let q=Math.floor(X.ratio*G),F=Y.simplifyPoints(z,3,q,H,V);Y.useExperimentalFeatures=!1;let[U,B]=Y.compactMesh(F);$.debug(`${rY}: ${hw(W.getCount(),B)} vertices.`);for(let w of Jk(J)){let O=EZ(Z,w);if(oT(w,null,U,O,B),mj1(J,w,O),w.listParents().length===1)w.dispose()}return J}var Zk;(function(Z){Z.LANCZOS3="lanczos3",Z.LANCZOS2="lanczos2"})(Zk||(Zk={}));var J26={resizeFilter:Zk.LANCZOS3,pattern:void 0,formats:void 0,slots:void 0,quality:void 0,effort:void 0,lossless:!1,nearLossless:!1,limitInputPixels:!0};var Y26=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 B=0;B<F.length;++B){var w=F.charCodeAt(B);U[B]=w>96?w-97:w>64?w-39:w+4}var O=0;for(var B=0;B<F.length;++B)U[O++]=U[B]<60?J[U[B]]:(U[B]-60)*64+U[++B];return U.buffer.slice(0,O)}function Q(F){if(!F)throw new Error("Assertion failed")}function W(F){return new Uint8Array(F.buffer,F.byteOffset,F.byteLength)}function K(F,U,B,w){var O=X.exports.sbrk,N=O(U.length*4),R=O(B*4),j=new Uint8Array(X.exports.memory.buffer),P=W(U);if(j.set(P,N),w)w(N,N,U.length,B);var D=F(R,N,U.length,B);j=new Uint8Array(X.exports.memory.buffer);var C=new Uint32Array(B);new Uint8Array(C.buffer).set(j.subarray(R,R+B*4)),P.set(j.subarray(N,N+U.length*4)),O(N-O(0));for(var T=0;T<U.length;++T)U[T]=C[U[T]];return[C,D]}function G(F,U,B,w){var O=X.exports.sbrk,N=O(B*4),R=O(B*w),j=new Uint8Array(X.exports.memory.buffer);j.set(W(U),R),F(N,R,B,w),j=new Uint8Array(X.exports.memory.buffer);var P=new Uint32Array(B);return new Uint8Array(P.buffer).set(j.subarray(N,N+B*4)),O(N-O(0)),P}function z(F,U,B,w,O){var N=X.exports.sbrk,R=N(U),j=N(w*O),P=new Uint8Array(X.exports.memory.buffer);P.set(W(B),j);var D=F(R,U,j,w,O),C=new Uint8Array(D);return C.set(P.subarray(R,R+D)),N(R-N(0)),C}function H(F){var U=0;for(var B=0;B<F.length;++B){var w=F[B];U=U<w?w:U}return U}function V(F,U){if(Q(U==2||U==4),U==4)return new Uint32Array(F.buffer,F.byteOffset,F.byteLength/4);else{var B=new Uint16Array(F.buffer,F.byteOffset,F.byteLength/2);return new Uint32Array(B)}}function q(F,U,B,w,O,N,R){var j=X.exports.sbrk,P=j(B*w),D=j(B*N),C=new Uint8Array(X.exports.memory.buffer);C.set(W(U),D),F(P,B,w,O,D,R);var T=new Uint8Array(B*w);return T.set(C.subarray(P,P+B*w)),j(P-j(0)),T}return{ready:Y,supported:!0,reorderMesh:function(F,U,B){var w=U?B?X.exports.meshopt_optimizeVertexCacheStrip:X.exports.meshopt_optimizeVertexCache:void 0;return K(X.exports.meshopt_optimizeVertexFetchRemap,F,H(F)+1,w)},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,B){Q(B>0&&B<=256),Q(B%4==0);var w=X.exports.meshopt_encodeVertexBufferBound(U,B);return z(X.exports.meshopt_encodeVertexBuffer,w,F,U,B)},encodeIndexBuffer:function(F,U,B){Q(B==2||B==4),Q(U%3==0);var w=V(F,B),O=X.exports.meshopt_encodeIndexBufferBound(U,H(w)+1);return z(X.exports.meshopt_encodeIndexBuffer,O,w,U,4)},encodeIndexSequence:function(F,U,B){Q(B==2||B==4);var w=V(F,B),O=X.exports.meshopt_encodeIndexSequenceBound(U,H(w)+1);return z(X.exports.meshopt_encodeIndexSequence,O,w,U,4)},encodeGltfBuffer:function(F,U,B,w){var O={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return Q(O[w]),O[w](F,U,B)},encodeFilterOct:function(F,U,B,w){return Q(B==4||B==8),Q(w>=1&&w<=16),q(X.exports.meshopt_encodeFilterOct,F,U,B,w,16)},encodeFilterQuat:function(F,U,B,w){return Q(B==8),Q(w>=4&&w<=16),q(X.exports.meshopt_encodeFilterQuat,F,U,B,w,16)},encodeFilterExp:function(F,U,B,w,O){Q(B>0&&B%4==0),Q(w>=1&&w<=24);var N={Separate:0,SharedVector:1,SharedComponent:2,Clamped:3};return q(X.exports.meshopt_encodeFilterExp,F,U,B,w,B,O?N[O]:1)}}}();var Q26=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)?K(J):K(Z),Q,W=WebAssembly.instantiate($,{}).then(function(O){Q=O.instance,Q.exports.__wasm_call_ctors()});function K(O){var N=new Uint8Array(O.length);for(var R=0;R<O.length;++R){var j=O.charCodeAt(R);N[R]=j>96?j-97:j>64?j-39:j+4}var P=0;for(var R=0;R<O.length;++R)N[P++]=N[R]<60?Y[N[R]]:(N[R]-60)*64+N[++R];return N.buffer.slice(0,P)}function G(O,N,R,j,P,D,C){var T=O.exports.sbrk,k=j+3&-4,x=T(k*P),S=T(D.length),A=new Uint8Array(O.exports.memory.buffer);A.set(D,S);var I=N(x,j,P,S,D.length);if(I==0&&C)C(x,k,P);if(R.set(A.subarray(x,x+j*P)),T(x-T(0)),I!=0)throw new Error("Malformed buffer data: "+I)}var z={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},H={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},V=[],q=0;function F(O){var N={object:new Worker(O),pending:0,requests:{}};return N.object.onmessage=function(R){var j=R.data;N.pending-=j.count,N.requests[j.id][j.action](j.value),delete N.requests[j.id]},N}function U(O){var N="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array($)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+w.name+";"+G.toString()+w.toString(),R=new Blob([N],{type:"text/javascript"}),j=URL.createObjectURL(R);for(var P=V.length;P<O;++P)V[P]=F(j);for(var P=O;P<V.length;++P)V[P].object.postMessage({});V.length=O,URL.revokeObjectURL(j)}function B(O,N,R,j,P){var D=V[0];for(var C=1;C<V.length;++C)if(V[C].pending<D.pending)D=V[C];return new Promise(function(T,k){var x=new Uint8Array(R),S=++q;D.pending+=O,D.requests[S]={resolve:T,reject:k},D.object.postMessage({id:S,count:O,size:N,source:x,mode:j,filter:P},[x.buffer])})}function w(O){var N=O.data;if(!N.id)return self.close();self.ready.then(function(R){try{var j=new Uint8Array(N.count*N.size);G(R,R.exports[N.mode],j,N.count,N.size,N.source,R.exports[N.filter]),self.postMessage({id:N.id,count:N.count,action:"resolve",value:j},[j.buffer])}catch(P){self.postMessage({id:N.id,count:N.count,action:"reject",value:P})}})}return{ready:W,supported:!0,useWorkers:function(O){U(O)},decodeVertexBuffer:function(O,N,R,j,P){G(Q,Q.exports.meshopt_decodeVertexBuffer,O,N,R,j,Q.exports[z[P]])},decodeIndexBuffer:function(O,N,R,j){G(Q,Q.exports.meshopt_decodeIndexBuffer,O,N,R,j)},decodeIndexSequence:function(O,N,R,j){G(Q,Q.exports.meshopt_decodeIndexSequence,O,N,R,j)},decodeGltfBuffer:function(O,N,R,j,P,D){G(Q,Q.exports[H[P]],O,N,R,j,Q.exports[z[D]])},decodeGltfBufferAsync:function(O,N,R,j,P){if(V.length>0)return B(O,N,R,H[j],z[P]);return W.then(function(){var D=new Uint8Array(O*N);return G(Q,Q.exports[H[j]],D,O,N,R,Q.exports[z[P]]),D})}}}();var oo=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 B=new Uint8Array(U.length);for(var w=0;w<U.length;++w){var O=U.charCodeAt(w);B[w]=O>96?O-97:O>64?O-39:O+4}var N=0;for(var w=0;w<U.length;++w)B[N++]=B[w]<60?J[B[w]]:(B[w]-60)*64+B[++w];return B.buffer.slice(0,N)}function Q(U){if(!U)throw new Error("Assertion failed")}function W(U){return new Uint8Array(U.buffer,U.byteOffset,U.byteLength)}function K(U,B,w){var O=X.exports.sbrk,N=O(B.length*4),R=O(w*4),j=new Uint8Array(X.exports.memory.buffer),P=W(B);j.set(P,N);var D=U(R,N,B.length,w);j=new Uint8Array(X.exports.memory.buffer);var C=new Uint32Array(w);new Uint8Array(C.buffer).set(j.subarray(R,R+w*4)),P.set(j.subarray(N,N+B.length*4)),O(N-O(0));for(var T=0;T<B.length;++T)B[T]=C[B[T]];return[C,D]}function G(U){var B=0;for(var w=0;w<U.length;++w){var O=U[w];B=B<O?O:B}return B}function z(U,B,w,O,N,R,j,P,D){var C=X.exports.sbrk,T=C(4),k=C(w*4),x=C(N*R),S=C(w*4),A=new Uint8Array(X.exports.memory.buffer);A.set(W(O),x),A.set(W(B),S);var I=U(k,S,w,x,N,R,j,P,D,T);A=new Uint8Array(X.exports.memory.buffer);var v=new Uint32Array(I);W(v).set(A.subarray(k,k+I*4));var b=new Float32Array(1);return W(b).set(A.subarray(T,T+4)),C(T-C(0)),[v,b[0]]}function H(U,B,w,O,N,R,j,P,D,C,T,k,x){var S=X.exports.sbrk,A=S(4),I=S(w*4),v=S(N*R),b=S(N*P),m=S(D.length*4),n=S(w*4),o=C?S(N):0,Q0=new Uint8Array(X.exports.memory.buffer);if(Q0.set(W(O),v),Q0.set(W(j),b),Q0.set(W(D),m),Q0.set(W(B),n),C)Q0.set(W(C),o);var K0=U(I,n,w,v,N,R,b,P,m,D.length,o,T,k,x,A);Q0=new Uint8Array(X.exports.memory.buffer);var _0=new Uint32Array(K0);W(_0).set(Q0.subarray(I,I+K0*4));var x0=new Float32Array(1);return W(x0).set(Q0.subarray(A,A+4)),S(A-S(0)),[_0,x0[0]]}function V(U,B,w,O){var N=X.exports.sbrk,R=N(w*O),j=new Uint8Array(X.exports.memory.buffer);j.set(W(B),R);var P=U(R,w,O);return N(R-N(0)),P}function q(U,B,w,O,N,R,j,P){var D=X.exports.sbrk,C=D(P*4),T=D(w*O),k=D(w*R),x=new Uint8Array(X.exports.memory.buffer);if(x.set(W(B),T),N)x.set(W(N),k);var S=U(C,T,w,O,k,R,j,P);x=new Uint8Array(X.exports.memory.buffer);var A=new Uint32Array(S);return W(A).set(x.subarray(C,C+S*4)),D(C-D(0)),A}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 B=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return K(X.exports.meshopt_optimizeVertexFetchRemap,B,G(U)+1)},simplify:function(U,B,w,O,N,R){Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0),Q(B instanceof Float32Array),Q(B.length%w==0),Q(w>=3),Q(O>=0&&O<=U.length),Q(O%3==0),Q(N>=0);var j=0;for(var P=0;P<(R?R.length:0);++P)Q(R[P]in F),Q(this.useExperimentalFeatures||R[P]!="Prune"),j|=F[R[P]];var D=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),C=z(X.exports.meshopt_simplify,D,U.length,B,B.length/w,w*4,O,N,j);return C[0]=U instanceof Uint32Array?C[0]:new U.constructor(C[0]),C},simplifyWithAttributes:function(U,B,w,O,N,R,j,P,D,C){Q(this.useExperimentalFeatures),Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0),Q(B instanceof Float32Array),Q(B.length%w==0),Q(w>=3),Q(O instanceof Float32Array),Q(O.length%N==0),Q(N>=0),Q(j==null||j instanceof Uint8Array),Q(j==null||j.length==B.length/w),Q(P>=0&&P<=U.length),Q(P%3==0),Q(D>=0),Q(Array.isArray(R)),Q(N>=R.length),Q(R.length<=32);for(var T=0;T<R.length;++T)Q(R[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 x=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),S=H(X.exports.meshopt_simplifyWithAttributes,x,U.length,B,B.length/w,w*4,O,N*4,new Float32Array(R),j?new Uint8Array(j):null,P,D,k);return S[0]=U instanceof Uint32Array?S[0]:new U.constructor(S[0]),S},getScale:function(U,B){return Q(U instanceof Float32Array),Q(U.length%B==0),Q(B>=3),V(X.exports.meshopt_simplifyScale,U,U.length/B,B*4)},simplifyPoints:function(U,B,w,O,N,R){if(Q(this.useExperimentalFeatures),Q(U instanceof Float32Array),Q(U.length%B==0),Q(B>=3),Q(w>=0&&w<=U.length/B),O)return Q(O instanceof Float32Array),Q(O.length%N==0),Q(N>=3),Q(U.length/B==O.length/N),q(X.exports.meshopt_simplifyPoints,U,U.length/B,B*4,O,N*4,R,w);else return q(X.exports.meshopt_simplifyPoints,U,U.length/B,B*4,void 0,0,0,w)}}}();var G26=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 B=new Uint8Array(U.length);for(var w=0;w<U.length;++w){var O=U.charCodeAt(w);B[w]=O>96?O-97:O>64?O-39:O+4}var N=0;for(var w=0;w<U.length;++w)B[N++]=B[w]<60?J[B[w]]:(B[w]-60)*64+B[++w];return B.buffer.slice(0,N)}function Q(U){if(!U)throw new Error("Assertion failed")}function W(U){return new Uint8Array(U.buffer,U.byteOffset,U.byteLength)}var K=48,G=16;function z(U,B){var w=U.meshlets[B*4+0],O=U.meshlets[B*4+1],N=U.meshlets[B*4+2],R=U.meshlets[B*4+3];return{vertices:U.vertices.subarray(w,w+N),triangles:U.triangles.subarray(O,O+R*3)}}function H(U,B,w,O,N,R,j){var P=X.exports.sbrk,D=X.exports.meshopt_buildMeshletsBound(U.length,N,R),C=P(D*G),T=P(D*N*4),k=P(D*R*3),x=P(U.byteLength),S=P(B.byteLength),A=new Uint8Array(X.exports.memory.buffer);A.set(W(U),x),A.set(W(B),S);var I=X.exports.meshopt_buildMeshlets(C,T,k,x,U.length,S,w,O,N,R,j);A=new Uint8Array(X.exports.memory.buffer);var v=A.subarray(C,C+I*G),b=new Uint32Array(v.buffer,v.byteOffset,v.byteLength/4).slice();for(var m=0;m<I;++m){var n=b[m*4+0],o=b[m*4+1],w=b[m*4+2],Q0=b[m*4+3];X.exports.meshopt_optimizeMeshlet(T+n*4,k+o,Q0,w)}var K0=b[(I-1)*4+0],_0=b[(I-1)*4+1],x0=b[(I-1)*4+2],r0=b[(I-1)*4+3],f8=K0+x0,X8=_0+(r0*3+3&-4),K7={meshlets:b,vertices:new Uint32Array(A.buffer,T,f8).slice(),triangles:new Uint8Array(A.buffer,k,X8*3).slice(),meshletCount:I};return P(C-P(0)),K7}function V(U){var B=new Float32Array(X.exports.memory.buffer,U,K/4);return{centerX:B[0],centerY:B[1],centerZ:B[2],radius:B[3],coneApexX:B[4],coneApexY:B[5],coneApexZ:B[6],coneAxisX:B[7],coneAxisY:B[8],coneAxisZ:B[9],coneCutoff:B[10]}}function q(U,B,w,O){var N=X.exports.sbrk,R=[],j=N(B.byteLength),P=N(U.vertices.byteLength),D=N(U.triangles.byteLength),C=N(K),T=new Uint8Array(X.exports.memory.buffer);T.set(W(B),j),T.set(W(U.vertices),P),T.set(W(U.triangles),D);for(var k=0;k<U.meshletCount;++k){var x=U.meshlets[k*4+0],S=U.meshlets[k*4+0+1],A=U.meshlets[k*4+0+3];X.exports.meshopt_computeMeshletBounds(C,P+x*4,D+S,A,j,w,O),R.push(V(C))}return N(j-N(0)),R}function F(U,B,w,O){var N=X.exports.sbrk,R=N(K),j=N(U.byteLength),P=N(B.byteLength),D=new Uint8Array(X.exports.memory.buffer);D.set(W(U),j),D.set(W(B),P),X.exports.meshopt_computeClusterBounds(R,j,U.length,P,w,O);var C=V(R);return N(R-N(0)),C}return{ready:Y,supported:!0,buildMeshlets:function(U,B,w,O,N,R){Q(U.length%3==0),Q(B instanceof Float32Array),Q(B.length%w==0),Q(w>=3),Q(O<=255||O>0),Q(N<=512),Q(N%4==0),R=R||0;var j=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return H(j,B,B.length/w,w*4,O,N,R)},computeClusterBounds:function(U,B,w){Q(U.length%3==0),Q(U.length/3<=512),Q(B instanceof Float32Array),Q(B.length%w==0),Q(w>=3);var O=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return F(O,B,B.length/w,w*4)},computeMeshletBounds:function(U,B,w){return Q(U.meshletCount!=0),Q(B instanceof Float32Array),Q(B.length%w==0),Q(w>=3),q(U,B,B.length/w,w*4)},extractMeshlet:function(U,B){return Q(B>=0&&B<U.meshletCount),z(U,B)}}}();var xW={OPTIMIZED_DIR:".optimized",CHECKSUM_EXT:".md5",DIRECTORIES:[(()=>{try{return Y9.dirname(c.resolve("@hytopia.com/assets"))}catch{return null}})(),Y9.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 k5{static instance=new k5;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)d.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)d.fatalError(`ModelRegistry.getBoundingBox(): Model ${Z} not found!`);return J}getDepth(Z){let J=this.getBoundingBox(Z);return J.max.z-J.min.z}getHeight(Z){let J=this.getBoundingBox(Z);return J.max.y-J.min.y}getNodeNames(Z){let J=this._modelUriNodeNames.get(Z);if(!J)d.fatalError(`ModelRegistry.getNodeNames(): Model ${Z} not found!`);return J}getTrimesh(Z,J=1){let X=this._modelUriTrimeshes.get(Z);if(!X){d.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}}getWidth(Z){let J=this.getBoundingBox(Z);return J.max.x-J.min.x}modelHasNode(Z,J){let X=this._modelUriNodeNames.get(Z);if(!X)d.fatalError(`ModelRegistry.modelHasNode(): Model ${Z} not found!`);return X.includes(J)}_absoluteModelPathToModelUri(Z){let J=Y9.normalize(Z);for(let X of xW.DIRECTORIES){let Y=Y9.normalize(X);if(J.startsWith(Y))return Y9.relative(Y,J).replace(/\\/g,"/")}return Y9.basename(J)}async _getAbsoluteModelPaths(){let Z=[];for(let J of xW.DIRECTORIES){let X=Y9.resolve(process.cwd(),J);if(!dJ.existsSync(X))continue;let Y=await C2("**/*.{gltf,glb}",{cwd:X,follow:!0});for(let $ of Y)Z.push(Y9.join(X,$))}return Z}async _loadModelData(Z){let J=await new QC().read(Z),X=co(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)}${xW.CHECKSUM_EXT}`;if(!dJ.existsSync(J))return!1;let X=this._calculateChecksum(Z),Y=dJ.readFileSync(J,"utf8");return X===Y}_calculateChecksum(Z){if(!dJ.existsSync(Z))return"";let J=dJ.readFileSync(Z);return RR1.createHash("sha256").update(J.toString("base64")).digest("hex")}_buildOptimizedModelPath(Z){let J=Y9.basename(Z),X=J.replace(/\.[^/.]+$/,""),Y=Y9.dirname(Z),$=Y9.join(Y,xW.OPTIMIZED_DIR,X);return Y9.join($,J)}async _buildTrimesh(Z,J=1,X=0.001){let Y=this._modelUriDocuments.get(Z);if(!Y)d.fatalError(`ModelRegistry._buildTrimesh(): Model ${Z} not found!`);let $=mo(Y);$.setLogger(new P5(yG.WARN)),await $.transform(Do({pivot:"center"}),uo(),lo(),Yk(),so({simplifier:oo,ratio:J,error:X}),yo());for(let z of $.getRoot().listScenes())for(let H of z.listChildren())fo(H);let Q=$.getRoot().listMeshes()[0];if(!Q){d.error(`ModelRegistry._buildTrimesh(): Model ${Z} has no root mesh!`);return}let W=Q.listPrimitives()[0];if(!W){d.error(`ModelRegistry._buildTrimesh(): Model ${Z} has no root primitive!`);return}let K=W.getAttribute("POSITION"),G=W.getIndices();if(!K||!G){d.error(`ModelRegistry._buildTrimesh(): Model ${Z} missing required geometry data!`);return}return{vertices:K.getArray(),indices:G.getArray()}}async _optimizeModel(Z,J){let X=Y9.dirname(J);dJ.rmSync(X,{recursive:!0,force:!0}),dJ.mkdirSync(X,{recursive:!0}),console.log(`ModelRegistry: Optimizing model ${this._absoluteModelPathToModelUri(Z)}...`);for(let Y of xW.OPTIMIZER_RUNS){let $=J.replace(/(\.[^/.]+)$/,`${Y.suffix}$1`),{stderr:Q}=await Xp("npx",["@gltf-transform/cli","optimize",Z,$,...Y.options]);if(Q)return d.warning(`ModelRegistry._optimizeModel(): Error optimizing model ${this._absoluteModelPathToModelUri(Z)}, defaulting to unoptimized model. Error: ${Q}`),Z}return dJ.writeFileSync(`${J}${xW.CHECKSUM_EXT}`,this._calculateChecksum(Z)),J}}var Vz;(($)=>{$.DYNAMIC="dynamic";$.FIXED="fixed";$.KINEMATIC_POSITION="kinematic_position";$.KINEMATIC_VELOCITY="kinematic_velocity"})(Vz||={});var Qk=0.001,ro="dynamic";class tY extends j0{_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??=ro,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"]:Q1.RigidBodyType.Dynamic,["fixed"]:Q1.RigidBodyType.Fixed,["kinematic_position"]:Q1.RigidBodyType.KinematicPositionBased,["kinematic_velocity"]:Q1.RigidBodyType.KinematicVelocityBased}[Z];if(X===void 0)return d.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 d.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 $9({...Z,parentRigidBody:this,simulation:this._simulation}):this._createAndAddPendingChildCollider(Z)}createAndAddChildColliders(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 d.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 d.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 d.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 $9(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??ro;return{["dynamic"]:()=>Q1.RigidBodyDesc.dynamic(),["fixed"]:()=>Q1.RigidBodyDesc.fixed(),["kinematic_position"]:()=>Q1.RigidBodyDesc.kinematicPositionBased(),["kinematic_velocity"]:()=>Q1.RigidBodyDesc.kinematicVelocityBased()}[J]()}_requireCreated(Z){if(!this._rigidBody||!this._simulation)d.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)d.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)d.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)d.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)d.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)d.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)<Qk&&Math.abs(Z.y)<Qk&&Math.abs(Z.z)<Qk}}var Wk;(($)=>{$[$.Average=0]="Average";$[$.Min=1]="Min";$[$.Multiply=2]="Multiply";$[$.Max=3]="Max"})(Wk||={});var qz;((H)=>{H.NONE="none";H.BALL="ball";H.BLOCK="block";H.CAPSULE="capsule";H.CONE="cone";H.CYLINDER="cylinder";H.ROUND_CYLINDER="round-cylinder";H.TRIMESH="trimesh";H.VOXELS="voxels";H.WEDGE="wedge"})(qz||={});class $9 extends j0{_collider;_colliderDesc;_onCollision;_parentRigidBody;_relativePosition={x:0,y:0,z:0};_relativeRotation={x:0,y:0,z:0,w:1};_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=k5.instance.getBoundingBox(Z),$=Y.max.x-Y.min.x,Q=Y.max.y-Y.min.y,W=Y.max.z-Y.min.z,K=Math.max($,W),G=Math.min($,W),z=K/G,H=K/Q,V=K*J/2,q=(N)=>Math.max(0.01,N),F=()=>({shape:"block",halfExtents:{x:q($*J/2),y:q(Q*J/2),z:q(W*J/2)}}),U=()=>({shape:"round-cylinder",radius:q(V),halfHeight:q(Q*J/2),borderRadius:q(V*0.1)}),B=()=>{let N=k5.instance.getTrimesh(Z,J);if(!N)return;return{shape:"trimesh",vertices:N.vertices,indices:N.indices}},w=()=>({shape:"wedge",extents:{x:$*J,y:Q*J,z:W*J}}),O=()=>({shape:"capsule",radius:q(V),halfHeight:q(Q*J/2-V)});if(X)switch(X){case"block":return F();case"capsule":return O();case"round-cylinder":return U();case"trimesh":{let N=B();if(!N){d.error(`Collider.optionsFromModelUri(): Failed to create trimesh options for model ${Z}, falling back to generic shape!`);break}return N}case"wedge":return w();default:d.warning(`Collider.optionsFromModelUri(): Preferred shape ${X} is not yet supported with Collider.optionsFromModelUri(), defaulting to generic shape!`)}if(z>2)return F();if(H>1.5)return U();return O()}get bounciness(){if(!this._requireNotRemoved("bounciness"))return 0;return this._collider?this._collider.restitution():this._colliderDesc.restitution}get bouncinessCombineRule(){if(!this._requireNotRemoved("bouncinessCombineRule"))return 0;return this._collider?this._collider.restitutionCombineRule():this._colliderDesc.restitutionCombineRule}get collisionGroups(){if(!this._requireNotRemoved("collisionGroups"))return{belongsTo:[],collidesWith:[]};return this._collider?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 rawShape(){if(!this._requireNotRemoved("rawShape"))return;return this._collider?this._collider.shape:this._colliderDesc.shape}get relativePosition(){if(!this._requireNotRemoved("relativePosition"))return{x:0,y:0,z:0};return this._relativePosition}get relativeRotation(){if(!this._requireNotRemoved("relativeRotation"))return{x:0,y:0,z:0,w:1};return this._relativeRotation}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._relativeRotation=Z,this._collider?this._collider.parent()?this._collider.setRotationWrtParent(Z):this._collider.setRotation(Z):this._colliderDesc.setRotation(Z)}setRelativePosition(Z){if(!this._requireNotRemoved("setRelativePosition"))return;this._relativePosition=Z,this._collider?this._collider.parent()?this._collider.setTranslationWrtParent(Z):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}setVoxel(Z,J){if(!this._requireNotRemoved("setVoxel"))return;if(!this._requireSimulated("setVoxel"))return;if(this.shape!=="voxels")return d.error("Collider.setVoxel(): Collider is not a voxels collider!");this._collider.setVoxel(Z.x,Z.y,Z.z,J)}addToSimulation(Z,J){if(!this._requireNotRemoved("addToSimulation"))return;if(!this._requireUnsimulated("addToSimulation"))return;if(J){if(!J.isSimulated)return d.error("Collider.addToSimulation(): Rigid body must be simulated before adding a collider to it!");if(J.type==="dynamic"&&this.shape==="trimesh")d.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)}combineVoxelStates(Z){if(!this._requireNotRemoved("combineVoxelStates"))return;if(!this._requireSimulated("combineVoxelStates"))return;if(!Z.isSimulated)return d.error("Collider.combineVoxelStates(): Other collider is not simulated!");if(this.shape!=="voxels")return d.error("Collider.combineVoxelStates(): Collider is not a voxels collider!");if(Z.shape!=="voxels")return d.error("Collider.combineVoxelStates(): Other collider is not a voxels collider!");this._collider.combineVoxelStates(Z.rawCollider,0,0,0)}enableCollisionEvents(Z){if(!this._requireNotRemoved("enableCollisionEvents"))return;let J=this._collider?this._collider.activeEvents():this._colliderDesc.activeEvents,X=Z?J|Q1.ActiveEvents.COLLISION_EVENTS:J&~Q1.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|Q1.ActiveEvents.CONTACT_FORCE_EVENTS:J&~Q1.ActiveEvents.CONTACT_FORCE_EVENTS;(this._collider??this._colliderDesc).setActiveEvents(X),this._setActiveCollisionTypes()}propagateVoxelChange(Z,J){if(!this._requireNotRemoved("propagateVoxelChange"))return;if(!this._requireSimulated("propagateVoxelChange"))return;if(!Z.isSimulated)return d.error("Collider.propagateVoxelChange(): Other collider is not simulated!");if(this.shape!=="voxels")return d.error("Collider.propagateVoxelChange(): Collider is not a voxels collider!");if(Z.shape!=="voxels")return d.error("Collider.propagateVoxelChange(): Other collider is not a voxels collider!");this._collider.propagateVoxelChange(Z.rawCollider,J.x,J.y,J.z,0,0,0)}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}scale(Z){if(!this._requireNotRemoved("scale"))return;switch(this.setRelativePosition({x:this.relativePosition.x*Z,y:this.relativePosition.y*Z,z:this.relativePosition.z*Z}),this._shape){case"ball":{if(this._collider)this._collider.setRadius(this._collider.radius()*Z);else this._colliderDesc.shape.radius*=Z;return}case"block":{if(this._collider){let J=this._collider.halfExtents();this._collider.setHalfExtents({x:J.x*Z,y:J.y*Z,z:J.z*Z})}else this._colliderDesc.shape.halfExtents.x*=Z,this._colliderDesc.shape.halfExtents.y*=Z,this._colliderDesc.shape.halfExtents.z*=Z;return}case"capsule":{if(this._collider)this._collider.setHalfHeight(this._collider.halfHeight()*Z),this._collider.setRadius(this._collider.radius()*Z);else this._colliderDesc.shape.halfHeight*=Z,this._colliderDesc.shape.radius*=Z;return}case"cone":{if(this._collider)this._collider.setHalfHeight(this._collider.halfHeight()*Z),this._collider.setRadius(this._collider.radius()*Z);else this._colliderDesc.shape.halfHeight*=Z,this._colliderDesc.shape.radius*=Z;return}case"cylinder":{if(this._collider)this._collider.setHalfHeight(this._collider.halfHeight()*Z),this._collider.setRadius(this._collider.radius()*Z);else this._colliderDesc.shape.halfHeight*=Z,this._colliderDesc.shape.radius*=Z;return}case"round-cylinder":{if(this._collider)this._collider.setHalfHeight(this._collider.halfHeight()*Z),this._collider.setRoundRadius(this._collider.roundRadius()*Z),this._collider.setRadius(this._collider.radius()*Z);else this._colliderDesc.shape.halfHeight=this._colliderDesc.shape.halfHeight*Z,this._colliderDesc.shape.borderRadius=this._colliderDesc.shape.borderRadius*Z,this._colliderDesc.shape.radius=this._colliderDesc.shape.radius*Z;return}case"trimesh":{d.error("Collider.setScale(): Trimesh colliders cannot be scaled!");return}case"voxels":{d.error("Collider.setScale(): Voxels colliders cannot be scaled!");return}case"wedge":{d.error("Collider.setScale(): Wedge colliders cannot be scaled!");return}default:d.fatalError(`Collider.setScale(): ${this._shape} is not a valid collider shape!`)}}_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,W=X/2;return new Float32Array([-$,0-W,-Q,$,0-W,-Q,$,0-W,Q,-$,0-W,Q,-$,X-W,-Q,$,X-W,-Q])}_createColliderDesc(Z){let{shape:J,flags:X}=Z;switch(J){case"ball":{if(!Z.radius)d.fatalError("Ball collider must have a radius!");return Q1.ColliderDesc.ball(Z.radius)}case"block":{if(!Z.halfExtents)d.fatalError("Block collider must have halfExtents!");return Q1.ColliderDesc.cuboid(Z.halfExtents.x,Z.halfExtents.y,Z.halfExtents.z)}case"capsule":{if(!Z.halfHeight||!Z.radius)d.fatalError("Capsule collider must have halfHeight and radius!");return Q1.ColliderDesc.capsule(Z.halfHeight,Z.radius)}case"cone":{if(!Z.radius||!Z.halfHeight)d.fatalError("Cone collider must have radius and halfHeight!");return Q1.ColliderDesc.cone(Z.halfHeight,Z.radius)}case"cylinder":{if(!Z.radius||!Z.halfHeight)d.fatalError("Cylinder collider must have radius and halfHeight!");return Q1.ColliderDesc.cylinder(Z.halfHeight,Z.radius)}case"round-cylinder":{if(!Z.radius||!Z.halfHeight||!Z.borderRadius)d.fatalError("Round cylinder collider must have radius, halfHeight, and borderRadius!");return Q1.ColliderDesc.roundCylinder(Z.halfHeight,Z.radius,Z.borderRadius)}case"trimesh":{if(!Z.indices||!Z.vertices)d.fatalError("Trimesh collider must have vertices and indices!");return Q1.ColliderDesc.trimesh(Z.vertices,Z.indices,X)}case"voxels":{if(!Z.coordinates||!Z.size)d.fatalError("Voxels collider must have coordinates and size!");return Q1.ColliderDesc.voxels(this._coordinatesToInt32Array(Z.coordinates),Z.size)}case"wedge":{if(!Z.extents)d.fatalError("Wedge collider must have extents!");let Y=this._buildWedgeConvexHullVertices(Z.extents),$=Q1.ColliderDesc.convexHull(Y);if(!$)throw d.fatalError("Failed to create convex hull for wedge collider!"),new Error("Convex hull creation failed");return $}default:d.fatalError(`Collider._createColliderDesc(): ${J} is not a valid collider shape!`)}}_requireSimulated(Z){if(!this.isSimulated)d.error(`Collider._requireSimulated(): Collider is not simulated, invoked method: ${Z}()`);return this.isSimulated}_requireUnsimulated(Z){if(this.isSimulated)d.error(`Collider._requireUnsimulated(): Collider is already simulated, invoked method: ${Z}()`);return!this.isSimulated}_requireNotRemoved(Z){if(this.isRemoved)d.error(`Collider._requireNotRemoved(): Collider is removed, invoked method: ${Z}()`);return!this.isRemoved}_setActiveCollisionTypes(){(this._collider??this._colliderDesc).setActiveCollisionTypes(Q1.ActiveCollisionTypes.DYNAMIC_DYNAMIC|Q1.ActiveCollisionTypes.DYNAMIC_KINEMATIC|Q1.ActiveCollisionTypes.DYNAMIC_FIXED|Q1.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Q1.ActiveCollisionTypes.KINEMATIC_FIXED)}_coordinatesToInt32Array(Z){let J=new Int32Array(Z.length*3);for(let X=0;X<Z.length;X++){let Y=Z[X],$=X*3;J[$]=Math.floor(Y.x),J[$+1]=Math.floor(Y.y),J[$+2]=Math.floor(Y.z)}return J}}var NR1={shape:"voxels"},Kk;((X)=>{X.ENTITY_COLLISION="BLOCK_TYPE.ENTITY_COLLISION";X.ENTITY_CONTACT_FORCE="BLOCK_TYPE.ENTITY_CONTACT_FORCE"})(Kk||={});class Q9 extends j0{_id;_blockTypeRegistry;_customColliderOptions;_halfExtents;_isLiquid;_name;_textureUri;constructor(Z,J={id:-1,textureUri:"textures/missing.png",name:"Unknown"}){if(J.id<0)d.fatalError("BlockType.constructor(): BlockType id not set.");super();this._id=J.id,this._blockTypeRegistry=Z,this._customColliderOptions=J.customColliderOptions,this._halfExtents=J.halfExtents??{x:0.5,y:0.5,z:0.5},this._isLiquid=J.isLiquid??!1,this._name=J.name,this._textureUri=J.textureUri}get id(){return this._id}get blockTypeRegistry(){return this._blockTypeRegistry}get colliderOptions(){return{...this._customColliderOptions,...NR1}}get halfExtents(){return this._halfExtents}get isLiquid(){return this._isLiquid}get isMeshable(){return!this._customColliderOptions}get name(){return this._name}get size(){return{x:this._halfExtents.x*2,y:this._halfExtents.y*2,z:this._halfExtents.z*2}}get textureUri(){return this._textureUri}createCollider(Z){let J=new $9({...this.colliderOptions,coordinates:Z,size:this.size});if(this.isLiquid)J.setSensor(!0);if(this.hasListeners("BLOCK_TYPE.ENTITY_COLLISION")||this.isLiquid)J.enableCollisionEvents(!0);if(this.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))J.enableContactForceEvents(!0);if(j4.isDefaultCollisionGroups(J.collisionGroups))J.setCollisionGroups({belongsTo:[1],collidesWith:[65535&~1]});return J}serialize(){return D0.serializeBlockType(this,this._blockTypeRegistry.world.tickAllocator)}}var Gk;((J)=>J.REGISTER_BLOCK_TYPE="BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE")(Gk||={});class Fz extends j0{_blockTypes=new Map;_world;constructor(Z){super();this._world=Z}get world(){return this._world}getAllBlockTypes(Z=!1){return Z?this._world.tickAllocator.getArray(this._blockTypes.values()):Array.from(this._blockTypes.values())}getBlockType(Z){let J=this._blockTypes.get(Z);if(!J)d.fatalError(`BlockTypeRegistry.getBlockType(): BlockType with id ${Z} not found.`);return J}registerGenericBlockType(Z){let X=new class extends Q9{constructor(Y,$){super(Y,$)}}(this,Z);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 D0.serializeBlockTypeRegistry(this,this._world.tickAllocator)}}var gE={};D9(gE,{worldSchema:()=>yE,worldPacketDefinition:()=>l10,vectorSchema:()=>H1,vectorBooleanSchema:()=>MI1,uiSchema:()=>fE,uiPacketDefinition:()=>d10,uiDatasSchema:()=>bE,uiDatasPacketDefinition:()=>c10,uiDataSendPacketDefinition:()=>k10,uiDataSchema:()=>bz,syncResponseSchema:()=>hE,syncResponsePacketDefinition:()=>u10,syncRequestSchema:()=>zE,syncRequestPacketDefinition:()=>T10,stateRequestSchema:()=>GE,stateRequestPacketDefinition:()=>C10,sceneUIsSchema:()=>AE,sceneUIsPacketDefinition:()=>m10,sceneUISchema:()=>xE,rgbColorSchema:()=>x6,registeredPackets:()=>PB,quaternionSchema:()=>RE,playersSchema:()=>_E,playersPacketDefinition:()=>g10,playerSchema:()=>SE,physicsDebugRenderSchema:()=>vE,physicsDebugRenderPacketDefinition:()=>b10,physicsDebugRaycastsSchema:()=>IE,physicsDebugRaycastsPacketDefinition:()=>y10,physicsDebugRaycastSchema:()=>EE,particleEmittersSchema:()=>kE,particleEmittersPacketDefinition:()=>f10,particleEmitterSchema:()=>TE,outboundPackets:()=>DB,modelNodeOverrideSchema:()=>ME,lightsSchema:()=>CE,lightsPacketDefinition:()=>h10,lightSchema:()=>PE,isValidPacket:()=>NI1,inputSchema:()=>KE,inputPacketDefinition:()=>P10,inboundPackets:()=>NB,hexColorSchema:()=>QE,heartbeatSchema:()=>$E,heartbeatPacketDefinition:()=>R10,entitySchema:()=>NE,entitiesSchema:()=>DE,entitiesPacketDefinition:()=>A10,definePacket:()=>S0,debugConfigSchema:()=>WE,debugConfigPacketDefinition:()=>D10,createPacket:()=>HI1,connectionSchema:()=>YE,connectionPacketDefinition:()=>M10,chunksSchema:()=>jE,chunksPacketDefinition:()=>x10,chunkSchema:()=>OE,chatMessagesSchema:()=>LE,chatMessagesPacketDefinition:()=>_10,chatMessageSendPacketDefinition:()=>N10,chatMessageSchema:()=>fz,cameraSchema:()=>BE,cameraPacketDefinition:()=>S10,blocksSchema:()=>FE,blocksPacketDefinition:()=>I10,blockTypesSchema:()=>wE,blockTypesPacketDefinition:()=>v10,blockTypeSchema:()=>UE,blockSchema:()=>qE,bidirectionalPackets:()=>RB,audiosSchema:()=>VE,audiosPacketDefinition:()=>E10,audioSchema:()=>HE,PacketId:()=>A1});var RB={};D9(RB,{heartbeatPacketDefinition:()=>R10,connectionPacketDefinition:()=>M10});var JE=e(O10(),1);class XE extends JE.default{static instance=new JE.default}var A1;((k)=>{k[k.SYNC_REQUEST=0]="SYNC_REQUEST";k[k.INPUT=1]="INPUT";k[k.STATE_REQUEST=2]="STATE_REQUEST";k[k.CHAT_MESSAGE_SEND=3]="CHAT_MESSAGE_SEND";k[k.UI_DATA_SEND=4]="UI_DATA_SEND";k[k.SYNC_RESPONSE=32]="SYNC_RESPONSE";k[k.AUDIOS=33]="AUDIOS";k[k.BLOCKS=34]="BLOCKS";k[k.BLOCK_TYPES=35]="BLOCK_TYPES";k[k.CHAT_MESSAGES=36]="CHAT_MESSAGES";k[k.CHUNKS=37]="CHUNKS";k[k.ENTITIES=38]="ENTITIES";k[k.WORLD=39]="WORLD";k[k.CAMERA=40]="CAMERA";k[k.UI=41]="UI";k[k.UI_DATAS=42]="UI_DATAS";k[k.SCENE_UIS=43]="SCENE_UIS";k[k.LIGHTS=44]="LIGHTS";k[k.PLAYERS=45]="PLAYERS";k[k.PARTICLE_EMITTERS=46]="PARTICLE_EMITTERS";k[k.CONNECTION=116]="CONNECTION";k[k.HEARTBEAT=117]="HEARTBEAT";k[k.DEBUG_CONFIG=128]="DEBUG_CONFIG";k[k.PHYSICS_DEBUG_RENDER=192]="PHYSICS_DEBUG_RENDER";k[k.PHYSICS_DEBUG_RAYCASTS=193]="PHYSICS_DEBUG_RAYCASTS"})(A1||={});function HI1(Z,J,X,Y){if(!Z.validate(J))throw new Error(`Invalid payload for packet with id ${Z.id}. Error: ${XE.instance.errorsText(Z.validate.errors)}`);let $=Y??[];if($[0]=Z.id,$[1]=J,typeof X==="number")$.push(X);return $}function S0(Z,J){return{id:Z,schema:J,validate:XE.instance.compile(J)}}var VI1={type:"object",properties:{i:{type:"string"}},required:["i"],additionalProperties:!1},j10={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},qI1={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},FI1={type:"object",properties:{usernameFragment:{type:"string"},password:{type:"string"},iceLite:{type:"boolean",nullable:!0}},required:["usernameFragment","password"],additionalProperties:!1},UI1={type:"object",properties:{i:{type:"string"},l:{type:"string"}},required:["i","l"],additionalProperties:!1},wI1={type:"object",properties:{port:{type:"number"},OS:{type:"number"},MIS:{type:"number"},maxMessageSize:{type:"number"}},required:["port","OS","MIS","maxMessageSize"],additionalProperties:!0},BI1={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},LI1={type:"object",properties:{i:{type:"string"},f:{type:"string",enum:["cs","sc"]},ip:FI1,ic:{type:"array",items:qI1},d:j10,s:wI1},required:["i","f","ip","ic","d","s"],additionalProperties:!1},OI1={type:"object",properties:{i:{type:"string"},d:j10},required:["i","d"],additionalProperties:!1},jI1={type:"object",properties:{i:{type:"string",nullable:!0},pi:{type:"string",nullable:!0},l:{type:"string"},s:BI1},required:["l","s"],additionalProperties:!1},YE={type:"object",properties:{i:{type:"string",nullable:!0},k:{type:"boolean",nullable:!0},c:{...OI1,nullable:!0},ca:{...VI1,nullable:!0},d:{type:"array",items:{...jI1},nullable:!0},pa:{...UI1,nullable:!0},t:{type:"array",items:{...LI1},nullable:!0}},additionalProperties:!1};var M10=S0(116,YE);var $E={type:"null",nullable:!0};var R10=S0(117,$E);var NB={};D9(NB,{uiDataSendPacketDefinition:()=>k10,syncRequestPacketDefinition:()=>T10,stateRequestPacketDefinition:()=>C10,inputPacketDefinition:()=>P10,debugConfigPacketDefinition:()=>D10,chatMessageSendPacketDefinition:()=>N10});var QE={type:"string",pattern:"^[0-9A-Fa-f]{6}$"};var fz={type:"object",properties:{m:{type:"string"},c:{...QE,nullable:!0},p:{type:"string",nullable:!0}},required:["m"],additionalProperties:!1};var N10=S0(3,fz);var WE={type:"object",properties:{pdr:{type:"boolean",nullable:!0}},additionalProperties:!1};var D10=S0(128,WE);var KE={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},u:{type:"boolean",nullable:!0},i:{type:"boolean",nullable:!0},o:{type:"boolean",nullable:!0},j:{type:"boolean",nullable:!0},k:{type:"boolean",nullable:!0},l:{type:"boolean",nullable:!0},n:{type:"boolean",nullable:!0},m:{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 P10=S0(1,KE);var GE={type:"object",properties:{},additionalProperties:!1};var C10=S0(2,GE);var zE={type:"null",nullable:!0};var T10=S0(0,zE);var bz={type:"object",properties:{},additionalProperties:!0};var k10=S0(4,bz);var DB={};D9(DB,{worldPacketDefinition:()=>l10,uiPacketDefinition:()=>d10,uiDatasPacketDefinition:()=>c10,syncResponsePacketDefinition:()=>u10,sceneUIsPacketDefinition:()=>m10,playersPacketDefinition:()=>g10,physicsDebugRenderPacketDefinition:()=>b10,physicsDebugRaycastsPacketDefinition:()=>y10,particleEmittersPacketDefinition:()=>f10,lightsPacketDefinition:()=>h10,entitiesPacketDefinition:()=>A10,chunksPacketDefinition:()=>x10,chatMessagesPacketDefinition:()=>_10,cameraPacketDefinition:()=>S10,blocksPacketDefinition:()=>I10,blockTypesPacketDefinition:()=>v10,audiosPacketDefinition:()=>E10});var H1={type:"array",items:[{type:"number"},{type:"number"},{type:"number"}],minItems:3,maxItems:3};var HE={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:{...H1,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 VE={type:"array",items:{...HE}};var E10=S0(33,VE);var qE={type:"object",properties:{i:{type:"number"},c:H1},required:["i","c"],additionalProperties:!1};var FE={type:"array",items:{...qE}};var I10=S0(34,FE);var UE={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 wE={type:"array",items:{...UE}};var v10=S0(35,wE);var BE={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},h:{type:"array",items:{type:"string"},nullable:!0},o:{...H1,nullable:!0},p:{...H1,nullable:!0},pt:{...H1,nullable:!0},pl:{...H1,nullable:!0},s:{type:"array",items:{type:"string"},nullable:!0},sa:{type:"number",nullable:!0},z:{type:"number",nullable:!0}},additionalProperties:!1};var LE={type:"array",items:{...fz}};var OE={type:"object",properties:{c:H1,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 jE={type:"array",items:{...OE}};var x6={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 ME={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:{...x6,nullable:!0}},required:["n"],additionalProperties:!1};var RE={type:"array",items:[{type:"number"},{type:"number"},{type:"number"},{type:"number"}],minItems:4,maxItems:4};var NE={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:{...H1,nullable:!0},bt:{type:"string",nullable:!0},h:{type:"array",items:{type:"string"},nullable:!0},m:{type:"string",nullable:!0},mo:{type:"array",items:{...ME},nullable:!0},mt:{type:"string",nullable:!0},n:{type:"string",nullable:!0},o:{type:"number",nullable:!0},p:{...H1,nullable:!0},pe:{type:"number",nullable:!0},pn:{type:"string",nullable:!0},r:{...RE,nullable:!0},rm:{type:"boolean",nullable:!0},s:{type:"number",nullable:!0},sn:{type:"array",items:{type:"string"},nullable:!0},t:{...x6,nullable:!0}},required:["i"],additionalProperties:!1};var DE={type:"array",items:{...NE}};var PE={type:"object",properties:{i:{type:"number"},a:{type:"number",nullable:!0},e:{type:"number",nullable:!0},c:{...x6,nullable:!0},d:{type:"number",nullable:!0},n:{type:"number",nullable:!0},o:{...H1,nullable:!0},p:{...H1,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:{...H1,nullable:!0}},required:["i"],additionalProperties:!1};var CE={type:"array",items:{...PE}};var TE={type:"object",properties:{i:{type:"number"},at:{type:"number",nullable:!0},b:{type:"number",nullable:!0},ce:{...x6,nullable:!0},cev:{...x6,nullable:!0},cs:{...x6,nullable:!0},csv:{...x6,nullable:!0},e:{type:"number",nullable:!0},en:{type:"string",nullable:!0},g:{...H1,nullable:!0},l:{type:"number",nullable:!0},lv:{type:"number",nullable:!0},mp:{type:"number",nullable:!0},o:{...H1,nullable:!0},oe:{type:"number",nullable:!0},oev:{type:"number",nullable:!0},os:{type:"number",nullable:!0},osv:{type:"number",nullable:!0},p:{...H1,nullable:!0},pa:{type:"boolean",nullable:!0},pv:{...H1,nullable:!0},r:{type:"number",nullable:!0},rv:{type:"number",nullable:!0},rm:{type:"boolean",nullable:!0},se:{type:"number",nullable:!0},sev:{type:"number",nullable:!0},ss:{type:"number",nullable:!0},ssv:{type:"number",nullable:!0},t:{type:"boolean",nullable:!0},tu:{type:"string",nullable:!0},v:{...H1,nullable:!0},vv:{...H1,nullable:!0}},required:["i"],additionalProperties:!1};var kE={type:"array",items:{...TE}};var EE={type:"object",properties:{o:{...H1},d:{...H1},l:{type:"number"},h:{type:"boolean"}},required:["o","d","l","h"],additionalProperties:!1};var IE={type:"array",items:{...EE}};var vE={type:"object",properties:{v:{type:"array",items:{type:"number"}},c:{type:"array",items:{type:"number"}}},required:["v","c"],additionalProperties:!1};var SE={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 _E={type:"array",items:{...SE}};var xE={type:"object",properties:{i:{type:"number"},e:{type:"number",nullable:!0},o:{...H1,nullable:!0},p:{...H1,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 AE={type:"array",items:{...xE}};var hE={type:"object",properties:{r:{type:"number"},s:{type:"number"},p:{type:"number"},n:{type:"number"}},required:["r","s","p","n"],additionalProperties:!1};var fE={type:"object",properties:{p:{type:"boolean",nullable:!0},u:{type:"string",nullable:!0}},additionalProperties:!1};var bE={type:"array",items:{...bz}};var MI1={type:"array",items:[{type:"boolean"},{type:"boolean"},{type:"boolean"}],minItems:3,maxItems:3};var yE={type:"object",properties:{i:{type:"number"},ac:{...x6,nullable:!0},ai:{type:"number",nullable:!0},dc:{...x6,nullable:!0},di:{type:"number",nullable:!0},dp:{...H1,nullable:!0},fc:{...x6,nullable:!0},ff:{type:"number",nullable:!0},fn:{type:"number",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 S10=S0(40,BE);var _10=S0(36,LE);var x10=S0(37,jE);var A10=S0(38,DE);var h10=S0(44,CE);var f10=S0(46,kE);var b10=S0(192,vE);var y10=S0(193,IE);var g10=S0(45,_E);var m10=S0(43,AE);var u10=S0(32,hE);var d10=S0(41,fE);var c10=S0(42,bE);var l10=S0(39,yE);var PB=new Map,RI1={...RB,...NB,...DB};for(let Z of Object.values(RI1))if("id"in Z&&"schema"in Z){let J=Z;if(PB.has(J.id))throw new Error(`Packet with id ${J.id} is already registered.`);PB.set(J.id,J)}function NI1(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=PB.get(Z[0]);return!!J&&J.validate(Z[1])}var Y0=gE;var w80=e(F80(),1);import Q$ from"fs";import U80 from"path";var gz="./dev/persistence";class I7{static instance=new I7;gameId=process.env.HYTOPIA_GAME_ID;lobbyId=process.env.HYTOPIA_LOBBY_ID;_creativeGateway;constructor(){try{this._creativeGateway=new w80.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,V,J,q),V===K)return!0}return!1}let U;if(typeof z==="string")U=H===z,this.debug("string match",z,H,U);else U=z.test(H),this.debug("pattern match",z,H,U);if(!U)return!1}if(Q===K&&W===G)return!0;else if(Q===K)return X;else if(W===G)return Q===K-1&&Z[Q]==="";else throw new Error("wtf?")}braceExpand(){return Tp(this.pattern,this.options)}parse(Z){RG(Z);let J=this.options;if(Z==="**")return L6;if(Z==="")return"";let X,Y=null;if(X=Z.match(YF1))Y=J.dot?QF1:$F1;else if(X=Z.match(nq1))Y=(J.nocase?J.dot?rq1:oq1:J.dot?sq1:aq1)(X[1]);else if(X=Z.match(WF1))Y=(J.nocase?J.dot?GF1:KF1:J.dot?zF1:HF1)(X);else if(X=Z.match(tq1))Y=J.dot?ZF1:eq1;else if(X=Z.match(JF1))Y=XF1;let $=B6.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?FF1:J.dot?UF1:wF1,Y=new Set(J.nocase?["i"]:[]),$=Z.map((K)=>{let G=K.map((z)=>{if(z instanceof RegExp)for(let H of z.flags.split(""))Y.add(H);return typeof z==="string"?MF1(z):z===L6?L6:z._src});return G.forEach((z,H)=>{let V=G[H+1],q=G[H-1];if(z!==L6||q===L6)return;if(q===void 0)if(V!==void 0&&V!==L6)G[H+1]="(?:\\/|"+X+"\\/)?"+V;else G[H]=X;else if(V===void 0)G[H-1]=q+"(?:\\/|"+X+")?";else if(V!==L6)G[H-1]=q+"(?:\\/|\\/"+X+"\\/)"+V,G[H+1]=L6}),G.filter((z)=>z!==L6).join("/")}).join("|"),[Q,W]=Z.length>1?["(?:",")"]:["",""];if($="^"+Q+$+W+"$",this.negate)$="^(?!"+$+").+$";try{this.regexp=new RegExp($,[...Y].join(""))}catch(K){this.regexp=!1}return this.regexp}slashSplit(Z){if(this.preserveMultipleSlashes)return Z.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(Z))return["",...Z.split(/\/+/)];else return Z.split(/\/+/)}match(Z,J=this.partial){if(this.debug("match",Z,this.pattern),this.comment)return!1;if(this.empty)return Z==="";if(Z==="/"&&J)return!0;let 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 W=Y.length-2;!Q&&W>=0;W--)Q=Y[W];for(let W=0;W<$.length;W++){let K=$[W],G=Y;if(X.matchBase&&K.length===1)G=[Q];if(this.matchOne(G,K,J)){if(X.flipNegate)return!0;return!this.negate}}if(X.flipNegate)return!1;return this.negate}static defaults(Z){return p6.defaults(Z).Minimatch}}p6.AST=B6;p6.Minimatch=E9;p6.escape=$W;p6.unescape=D4;import{fileURLToPath as tF1}from"url";var QW=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,Ep=new Set,SP=typeof process==="object"&&!!process?process:{},Ip=(Z,J,X,Y)=>{typeof SP.emitWarning==="function"?SP.emitWarning(Z,J,X,Y):console.error(`[${X}] ${J}: ${Z}`)},V2=globalThis.AbortController,kp=globalThis.AbortSignal;if(typeof V2==="undefined"){kp=class X{onabort;_onabort=[];reason;aborted=!1;addEventListener(Y,$){this._onabort.push($)}},V2=class X{constructor(){J()}signal=new kp;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=SP.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",J=()=>{if(!Z)return;Z=!1,Ip("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 RF1=(Z)=>!Ep.has(Z),fq6=Symbol("type"),CJ=(Z)=>Z&&Z===Math.floor(Z)&&Z>0&&isFinite(Z),vp=(Z)=>!CJ(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?DG:null;class DG extends Array{constructor(Z){super(Z);this.fill(0)}}class WW{heap;length;static#Z=!1;static create(Z){let J=vp(Z);if(!J)return[];WW.#Z=!0;let X=new WW(Z,J);return WW.#Z=!1,X}constructor(Z,J){if(!WW.#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 PG{#Z;#J;#Y;#X;#$;#H;#q;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#K;#G;#z;#V;#Q;#U;#B;#w;#O;#k;#j;#E;#N;#R;#M;#C;#L;#v;static unsafeExposeInternals(Z){return{starts:Z.#N,ttls:Z.#R,sizes:Z.#E,keyMap:Z.#z,keyList:Z.#V,valList:Z.#Q,next:Z.#U,prev:Z.#B,get head(){return Z.#w},get tail(){return Z.#O},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.#P(J)}}get max(){return this.#Z}get maxSize(){return this.#J}get calculatedSize(){return this.#G}get size(){return this.#K}get fetchMethod(){return this.#H}get memoMethod(){return this.#q}get dispose(){return this.#Y}get onInsert(){return this.#X}get disposeAfter(){return this.#$}constructor(Z){let{max:J=0,ttl:X,ttlResolution:Y=1,ttlAutopurge:$,updateAgeOnGet:Q,updateAgeOnHas:W,allowStale:K,dispose:G,onInsert:z,disposeAfter:H,noDisposeOnSet:V,noUpdateTTL:q,maxSize:F=0,maxEntrySize:U=0,sizeCalculation:B,fetchMethod:w,memoMethod:O,noDeleteOnFetchRejection:N,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:P,ignoreFetchAbort:D}=Z;if(J!==0&&!CJ(J))throw new TypeError("max option must be a nonnegative integer");let C=J?vp(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=B,this.sizeCalculation){if(!this.#J&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw new TypeError("sizeCalculation set to non-function")}if(O!==void 0&&typeof O!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#q=O,w!==void 0&&typeof w!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#H=w,this.#C=!!w,this.#z=new Map,this.#V=new Array(J).fill(void 0),this.#Q=new Array(J).fill(void 0),this.#U=new C(J),this.#B=new C(J),this.#w=0,this.#O=0,this.#k=WW.create(J),this.#K=0,this.#G=0,typeof G==="function")this.#Y=G;if(typeof z==="function")this.#X=z;if(typeof H==="function")this.#$=H,this.#j=[];else this.#$=void 0,this.#j=void 0;if(this.#M=!!this.#Y,this.#v=!!this.#X,this.#L=!!this.#$,this.noDisposeOnSet=!!V,this.noUpdateTTL=!!q,this.noDeleteOnFetchRejection=!!N,this.allowStaleOnFetchRejection=!!j,this.allowStaleOnFetchAbort=!!P,this.ignoreFetchAbort=!!D,this.maxEntrySize!==0){if(this.#J!==0){if(!CJ(this.#J))throw new TypeError("maxSize must be a positive integer if specified")}if(!CJ(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#m()}if(this.allowStale=!!K,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!Q,this.updateAgeOnHas=!!W,this.ttlResolution=CJ(Y)||Y===0?Y:1,this.ttlAutopurge=!!$,this.ttl=X||0,this.ttl){if(!CJ(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#W()}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(RF1("LRU_CACHE_UNBOUNDED"))Ep.add("LRU_CACHE_UNBOUNDED"),Ip("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",PG)}}getRemainingTTL(Z){return this.#z.has(Z)?1/0:0}#W(){let Z=new DG(this.#Z),J=new DG(this.#Z);this.#R=Z,this.#N=J,this.#S=($,Q,W=QW.now())=>{if(J[$]=Q!==0?W:0,Z[$]=Q,Q!==0&&this.ttlAutopurge){let K=setTimeout(()=>{if(this.#P($))this.#_(this.#V[$],"expire")},Q+1);if(K.unref)K.unref()}},this.#x=($)=>{J[$]=Z[$]!==0?QW.now():0},this.#D=($,Q)=>{if(Z[Q]){let W=Z[Q],K=J[Q];if(!W||!K)return;$.ttl=W,$.start=K,$.now=X||Y();let G=$.now-K;$.remainingTTL=W-G}};let X=0,Y=()=>{let $=QW.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 W=Z[Q],K=J[Q];if(!W||!K)return 1/0;let G=(X||Y())-K;return W-G},this.#P=($)=>{let Q=J[$],W=Z[$];return!!W&&!!Q&&(X||Y())-Q>W}}#x=()=>{};#D=()=>{};#S=()=>{};#P=()=>!1;#m(){let Z=new DG(this.#Z);this.#G=0,this.#E=Z,this.#A=(J)=>{this.#G-=Z[J],Z[J]=0},this.#u=(J,X,Y,$)=>{if(this.#F(X))return 0;if(!CJ(Y))if($){if(typeof $!=="function")throw new TypeError("sizeCalculation must be a function");if(Y=$(X,J),!CJ(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}}#A=(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.#K)for(let J=this.#O;;){if(!this.#d(J))break;if(Z||!this.#P(J))yield J;if(J===this.#w)break;else J=this.#B[J]}}*#I({allowStale:Z=this.allowStale}={}){if(this.#K)for(let J=this.#w;;){if(!this.#d(J))break;if(Z||!this.#P(J))yield J;if(J===this.#O)break;else J=this.#U[J]}}#d(Z){return Z!==void 0&&this.#z.get(this.#V[Z])===Z}*entries(){for(let Z of this.#T())if(this.#Q[Z]!==void 0&&this.#V[Z]!==void 0&&!this.#F(this.#Q[Z]))yield[this.#V[Z],this.#Q[Z]]}*rentries(){for(let Z of this.#I())if(this.#Q[Z]!==void 0&&this.#V[Z]!==void 0&&!this.#F(this.#Q[Z]))yield[this.#V[Z],this.#Q[Z]]}*keys(){for(let Z of this.#T()){let J=this.#V[Z];if(J!==void 0&&!this.#F(this.#Q[Z]))yield J}}*rkeys(){for(let Z of this.#I()){let J=this.#V[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.#V[X],this))return this.get(this.#V[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.#V[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.#V[X],this)}}purgeStale(){let Z=!1;for(let J of this.#I({allowStale:!0}))if(this.#P(J))this.#_(this.#V[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],W=this.#N[J];if(Q&&W){let K=Q-(QW.now()-W);$.ttl=K,$.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.#V[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 W=QW.now()-this.#N[J];Q.start=Math.floor(Date.now()-W)}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=QW.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:W=this.sizeCalculation,status:K}=X,{noUpdateTTL:G=this.noUpdateTTL}=X,z=this.#u(Z,J,X.size||0,W);if(this.maxEntrySize&&z>this.maxEntrySize){if(K)K.set="miss",K.maxEntrySizeExceeded=!0;return this.#_(Z,"set"),this}let H=this.#K===0?void 0:this.#z.get(Z);if(H===void 0){if(H=this.#K===0?this.#O:this.#k.length!==0?this.#k.pop():this.#K===this.#Z?this.#b(!1):this.#K,this.#V[H]=Z,this.#Q[H]=J,this.#z.set(Z,H),this.#U[this.#O]=H,this.#B[H]=this.#O,this.#O=H,this.#K++,this.#f(H,z,K),K)K.set="add";if(G=!1,this.#v)this.#X?.(J,Z,"add")}else{this.#y(H);let V=this.#Q[H];if(J!==V){if(this.#C&&this.#F(V)){V.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:q}=V;if(q!==void 0&&!Q){if(this.#M)this.#Y?.(q,Z,"set");if(this.#L)this.#j?.push([q,Z,"set"])}}else if(!Q){if(this.#M)this.#Y?.(V,Z,"set");if(this.#L)this.#j?.push([V,Z,"set"])}if(this.#A(H),this.#f(H,z,K),this.#Q[H]=J,K){K.set="replace";let q=V&&this.#F(V)?V.__staleWhileFetching:V;if(q!==void 0)K.oldValue=q}}else if(K)K.set="update";if(this.#v)this.onInsert?.(J,Z,J===V?"update":"replace")}if(Y!==0&&!this.#R)this.#W();if(this.#R){if(!G)this.#S(H,Y,$);if(K)this.#D(K,H)}if(!Q&&this.#L&&this.#j){let V=this.#j,q;while(q=V?.shift())this.#$?.(...q)}return this}pop(){try{while(this.#K){let Z=this.#Q[this.#w];if(this.#b(!0),this.#F(Z)){if(Z.__staleWhileFetching)return Z.__staleWhileFetching}else if(Z!==void 0)return Z}}finally{if(this.#L&&this.#j){let Z=this.#j,J;while(J=Z?.shift())this.#$?.(...J)}}}#b(Z){let J=this.#w,X=this.#V[J],Y=this.#Q[J];if(this.#C&&this.#F(Y))Y.__abortController.abort(new Error("evicted"));else if(this.#M||this.#L){if(this.#M)this.#Y?.(Y,X,"evict");if(this.#L)this.#j?.push([Y,X,"evict"])}if(this.#A(J),Z)this.#V[J]=void 0,this.#Q[J]=void 0,this.#k.push(J);if(this.#K===1)this.#w=this.#O=0,this.#k.length=0;else this.#w=this.#U[J];return this.#z.delete(X),this.#K--,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.#P($)){if(X)this.#x($);if(Y)Y.has="hit",this.#D(Y,$);return!0}else if(Y)Y.has="stale",this.#D(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.#P(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 V2,{signal:W}=X;W?.addEventListener("abort",()=>Q.abort(W.reason),{signal:Q.signal});let K={signal:Q.signal,options:X,context:Y},G=(U,B=!1)=>{let{aborted:w}=Q.signal,O=X.ignoreFetchAbort&&U!==void 0;if(X.status)if(w&&!B){if(X.status.fetchAborted=!0,X.status.fetchError=Q.signal.reason,O)X.status.fetchAbortIgnored=!0}else X.status.fetchResolved=!0;if(w&&!O&&!B)return H(Q.signal.reason);let N=q;if(this.#Q[J]===q)if(U===void 0)if(N.__staleWhileFetching)this.#Q[J]=N.__staleWhileFetching;else this.#_(Z,"fetch");else{if(X.status)X.status.fetchUpdated=!0;this.set(Z,U,K.options)}return U},z=(U)=>{if(X.status)X.status.fetchRejected=!0,X.status.fetchError=U;return H(U)},H=(U)=>{let{aborted:B}=Q.signal,w=B&&X.allowStaleOnFetchAbort,O=w||X.allowStaleOnFetchRejection,N=O||X.noDeleteOnFetchRejection,R=q;if(this.#Q[J]===q){if(!N||R.__staleWhileFetching===void 0)this.#_(Z,"fetch");else if(!w)this.#Q[J]=R.__staleWhileFetching}if(O){if(X.status&&R.__staleWhileFetching!==void 0)X.status.returnedStale=!0;return R.__staleWhileFetching}else if(R.__returned===R)throw U},V=(U,B)=>{let w=this.#H?.(Z,$,K);if(w&&w instanceof Promise)w.then((O)=>U(O===void 0?void 0:O),B);Q.signal.addEventListener("abort",()=>{if(!X.ignoreFetchAbort||X.allowStaleOnFetchAbort){if(U(void 0),X.allowStaleOnFetchAbort)U=(O)=>G(O,!0)}})};if(X.status)X.status.fetchDispatched=!0;let q=new Promise(V).then(G,z),F=Object.assign(q,{__abortController:Q,__staleWhileFetching:$,__returned:void 0});if(J===void 0)this.set(Z,F,{...K.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 V2}async fetch(Z,J={}){let{allowStale:X=this.allowStale,updateAgeOnGet:Y=this.updateAgeOnGet,noDeleteOnStaleGet:$=this.noDeleteOnStaleGet,ttl:Q=this.ttl,noDisposeOnSet:W=this.noDisposeOnSet,size:K=0,sizeCalculation:G=this.sizeCalculation,noUpdateTTL:z=this.noUpdateTTL,noDeleteOnFetchRejection:H=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:V=this.allowStaleOnFetchRejection,ignoreFetchAbort:q=this.ignoreFetchAbort,allowStaleOnFetchAbort:F=this.allowStaleOnFetchAbort,context:U,forceRefresh:B=!1,status:w,signal:O}=J;if(!this.#C){if(w)w.fetch="get";return this.get(Z,{allowStale:X,updateAgeOnGet:Y,noDeleteOnStaleGet:$,status:w})}let N={allowStale:X,updateAgeOnGet:Y,noDeleteOnStaleGet:$,ttl:Q,noDisposeOnSet:W,size:K,sizeCalculation:G,noUpdateTTL:z,noDeleteOnFetchRejection:H,allowStaleOnFetchRejection:V,allowStaleOnFetchAbort:F,ignoreFetchAbort:q,status:w,signal:O},R=this.#z.get(Z);if(R===void 0){if(w)w.fetch="miss";let j=this.#h(Z,R,N,U);return j.__returned=j}else{let j=this.#Q[R];if(this.#F(j)){let k=X&&j.__staleWhileFetching!==void 0;if(w){if(w.fetch="inflight",k)w.returnedStale=!0}return k?j.__staleWhileFetching:j.__returned=j}let P=this.#P(R);if(!B&&!P){if(w)w.fetch="hit";if(this.#y(R),Y)this.#x(R);if(w)this.#D(w,R);return j}let D=this.#h(Z,R,N,U),T=D.__staleWhileFetching!==void 0&&X;if(w){if(w.fetch=P?"stale":"refresh",T&&P)w.returnedStale=!0}return T?D.__staleWhileFetching:D.__returned=D}}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,W=this.get(Z,Q);if(!$&&W!==void 0)return W;let K=X(Z,W,{options:Q,context:Y});return this.set(Z,K,Q),K}get(Z,J={}){let{allowStale:X=this.allowStale,updateAgeOnGet:Y=this.updateAgeOnGet,noDeleteOnStaleGet:$=this.noDeleteOnStaleGet,status:Q}=J,W=this.#z.get(Z);if(W!==void 0){let K=this.#Q[W],G=this.#F(K);if(Q)this.#D(Q,W);if(this.#P(W)){if(Q)Q.get="stale";if(!G){if(!$)this.#_(Z,"expire");if(Q&&X)Q.returnedStale=!0;return X?K:void 0}else{if(Q&&X&&K.__staleWhileFetching!==void 0)Q.returnedStale=!0;return X?K.__staleWhileFetching:void 0}}else{if(Q)Q.get="hit";if(G)return K.__staleWhileFetching;if(this.#y(W),Y)this.#x(W);return K}}else if(Q)Q.get="miss"}#c(Z,J){this.#B[J]=Z,this.#U[Z]=J}#y(Z){if(Z!==this.#O){if(Z===this.#w)this.#w=this.#U[Z];else this.#c(this.#B[Z],this.#U[Z]);this.#c(this.#O,Z),this.#O=Z}}delete(Z){return this.#_(Z,"delete")}#_(Z,J){let X=!1;if(this.#K!==0){let Y=this.#z.get(Z);if(Y!==void 0)if(X=!0,this.#K===1)this.#g(J);else{this.#A(Y);let $=this.#Q[Y];if(this.#F($))$.__abortController.abort(new Error("deleted"));else if(this.#M||this.#L){if(this.#M)this.#Y?.($,Z,J);if(this.#L)this.#j?.push([$,Z,J])}if(this.#z.delete(Z),this.#V[Y]=void 0,this.#Q[Y]=void 0,Y===this.#O)this.#O=this.#B[Y];else if(Y===this.#w)this.#w=this.#U[Y];else{let Q=this.#B[Y];this.#U[Q]=this.#U[Y];let W=this.#U[Y];this.#B[W]=this.#B[Y]}this.#K--,this.#k.push(Y)}}if(this.#L&&this.#j?.length){let Y=this.#j,$;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.#V[J];if(this.#M)this.#Y?.(X,Y,Z);if(this.#L)this.#j?.push([X,Y,Z])}}if(this.#z.clear(),this.#Q.fill(void 0),this.#V.fill(void 0),this.#R&&this.#N)this.#R.fill(0),this.#N.fill(0);if(this.#E)this.#E.fill(0);if(this.#w=0,this.#O=0,this.#k.length=0,this.#G=0,this.#K=0,this.#L&&this.#j){let J=this.#j,X;while(X=J?.shift())this.#$?.(...X)}}}import{posix as _F1,win32 as uP}from"path";import{fileURLToPath as xF1}from"url";import{lstatSync as AF1,readdir as hF1,readdirSync as fF1,readlinkSync as bF1,realpathSync as yF1}from"fs";import*as gF1 from"fs";import{lstat as uF1,readdir as dF1,readlink as cF1,realpath as lF1}from"fs/promises";import{EventEmitter as bP}from"events";import hp from"stream";import{StringDecoder as NF1}from"string_decoder";var Sp=typeof process==="object"&&process?process:{stdout:null,stderr:null},DF1=(Z)=>!!Z&&typeof Z==="object"&&(Z instanceof CY||Z instanceof hp||PF1(Z)||CF1(Z)),PF1=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof bP&&typeof Z.pipe==="function"&&Z.pipe!==hp.Writable.prototype.pipe,CF1=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof bP&&typeof Z.write==="function"&&typeof Z.end==="function",jZ=Symbol("EOF"),MZ=Symbol("maybeEmitEnd"),TJ=Symbol("emittedEnd"),q2=Symbol("emittingEnd"),CG=Symbol("emittedError"),F2=Symbol("closed"),_p=Symbol("read"),U2=Symbol("flush"),xp=Symbol("flushChunk"),P4=Symbol("encoding"),KW=Symbol("decoder"),Z6=Symbol("flowing"),TG=Symbol("paused"),GW=Symbol("resume"),J6=Symbol("buffer"),i6=Symbol("pipes"),X6=Symbol("bufferLength"),_P=Symbol("bufferPush"),w2=Symbol("bufferShift"),T6=Symbol("objectMode"),k8=Symbol("destroyed"),xP=Symbol("error"),AP=Symbol("emitData"),Ap=Symbol("emitEnd"),hP=Symbol("emitEnd2"),U7=Symbol("async"),fP=Symbol("abort"),B2=Symbol("aborted"),kG=Symbol("signal"),PY=Symbol("dataListeners"),r5=Symbol("discarded"),EG=(Z)=>Promise.resolve().then(Z),TF1=(Z)=>Z(),kF1=(Z)=>Z==="end"||Z==="finish"||Z==="prefinish",EF1=(Z)=>Z instanceof ArrayBuffer||!!Z&&typeof Z==="object"&&Z.constructor&&Z.constructor.name==="ArrayBuffer"&&Z.byteLength>=0,IF1=(Z)=>!Buffer.isBuffer(Z)&&ArrayBuffer.isView(Z);class yP{src;dest;opts;ondrain;constructor(Z,J,X){this.src=Z,this.dest=J,this.opts=X,this.ondrain=()=>Z[GW](),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 fp extends yP{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 vF1=(Z)=>!!Z.objectMode,SF1=(Z)=>!Z.objectMode&&!!Z.encoding&&Z.encoding!=="buffer";class CY extends bP{[Z6]=!1;[TG]=!1;[i6]=[];[J6]=[];[T6];[P4];[U7];[KW];[jZ]=!1;[TJ]=!1;[q2]=!1;[F2]=!1;[CG]=null;[X6]=0;[k8]=!1;[kG];[B2]=!1;[PY]=0;[r5]=!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(vF1(J))this[T6]=!0,this[P4]=null;else if(SF1(J))this[P4]=J.encoding,this[T6]=!1;else this[T6]=!1,this[P4]=null;if(this[U7]=!!J.async,this[KW]=this[P4]?new NF1(this[P4]):null,J&&J.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[J6]});if(J&&J.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[i6]});let{signal:X}=J;if(X)if(this[kG]=X,X.aborted)this[fP]();else X.addEventListener("abort",()=>this[fP]())}get bufferLength(){return this[X6]}get encoding(){return this[P4]}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[T6]}set objectMode(Z){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[U7]}set["async"](Z){this[U7]=this[U7]||!!Z}[fP](){this[B2]=!0,this.emit("abort",this[kG]?.reason),this.destroy(this[kG]?.reason)}get aborted(){return this[B2]}set aborted(Z){}write(Z,J,X){if(this[B2])return!1;if(this[jZ])throw new Error("write after end");if(this[k8])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[U7]?EG:TF1;if(!this[T6]&&!Buffer.isBuffer(Z)){if(IF1(Z))Z=Buffer.from(Z.buffer,Z.byteOffset,Z.byteLength);else if(EF1(Z))Z=Buffer.from(Z);else if(typeof Z!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[T6]){if(this[Z6]&&this[X6]!==0)this[U2](!0);if(this[Z6])this.emit("data",Z);else this[_P](Z);if(this[X6]!==0)this.emit("readable");if(X)Y(X);return this[Z6]}if(!Z.length){if(this[X6]!==0)this.emit("readable");if(X)Y(X);return this[Z6]}if(typeof Z==="string"&&!(J===this[P4]&&!this[KW]?.lastNeed))Z=Buffer.from(Z,J);if(Buffer.isBuffer(Z)&&this[P4])Z=this[KW].write(Z);if(this[Z6]&&this[X6]!==0)this[U2](!0);if(this[Z6])this.emit("data",Z);else this[_P](Z);if(this[X6]!==0)this.emit("readable");if(X)Y(X);return this[Z6]}read(Z){if(this[k8])return null;if(this[r5]=!1,this[X6]===0||Z===0||Z&&Z>this[X6])return this[MZ](),null;if(this[T6])Z=null;if(this[J6].length>1&&!this[T6])this[J6]=[this[P4]?this[J6].join(""):Buffer.concat(this[J6],this[X6])];let J=this[_p](Z||null,this[J6][0]);return this[MZ](),J}[_p](Z,J){if(this[T6])this[w2]();else{let X=J;if(Z===X.length||Z===null)this[w2]();else if(typeof X==="string")this[J6][0]=X.slice(Z),J=X.slice(0,Z),this[X6]-=Z;else this[J6][0]=X.subarray(Z),J=X.subarray(0,Z),this[X6]-=Z}if(this.emit("data",J),!this[J6].length&&!this[jZ])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[jZ]=!0,this.writable=!1,this[Z6]||!this[TG])this[MZ]();return this}[GW](){if(this[k8])return;if(!this[PY]&&!this[i6].length)this[r5]=!0;if(this[TG]=!1,this[Z6]=!0,this.emit("resume"),this[J6].length)this[U2]();else if(this[jZ])this[MZ]();else this.emit("drain")}resume(){return this[GW]()}pause(){this[Z6]=!1,this[TG]=!0,this[r5]=!1}get destroyed(){return this[k8]}get flowing(){return this[Z6]}get paused(){return this[TG]}[_P](Z){if(this[T6])this[X6]+=1;else this[X6]+=Z.length;this[J6].push(Z)}[w2](){if(this[T6])this[X6]-=1;else this[X6]-=this[J6][0].length;return this[J6].shift()}[U2](Z=!1){do;while(this[xp](this[w2]())&&this[J6].length);if(!Z&&!this[J6].length&&!this[jZ])this.emit("drain")}[xp](Z){return this.emit("data",Z),this[Z6]}pipe(Z,J){if(this[k8])return Z;this[r5]=!1;let X=this[TJ];if(J=J||{},Z===Sp.stdout||Z===Sp.stderr)J.end=!1;else J.end=J.end!==!1;if(J.proxyErrors=!!J.proxyErrors,X){if(J.end)Z.end()}else if(this[i6].push(!J.proxyErrors?new yP(this,Z,J):new fp(this,Z,J)),this[U7])EG(()=>this[GW]());else this[GW]();return Z}unpipe(Z){let J=this[i6].find((X)=>X.dest===Z);if(J){if(this[i6].length===1){if(this[Z6]&&this[PY]===0)this[Z6]=!1;this[i6]=[]}else this[i6].splice(this[i6].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[r5]=!1,this[PY]++,!this[i6].length&&!this[Z6])this[GW]()}else if(Z==="readable"&&this[X6]!==0)super.emit("readable");else if(kF1(Z)&&this[TJ])super.emit(Z),this.removeAllListeners(Z);else if(Z==="error"&&this[CG]){let Y=J;if(this[U7])EG(()=>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[PY]=this.listeners("data").length,this[PY]===0&&!this[r5]&&!this[i6].length)this[Z6]=!1}return X}removeAllListeners(Z){let J=super.removeAllListeners(Z);if(Z==="data"||Z===void 0){if(this[PY]=0,!this[r5]&&!this[i6].length)this[Z6]=!1}return J}get emittedEnd(){return this[TJ]}[MZ](){if(!this[q2]&&!this[TJ]&&!this[k8]&&this[J6].length===0&&this[jZ]){if(this[q2]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[F2])this.emit("close");this[q2]=!1}}emit(Z,...J){let X=J[0];if(Z!=="error"&&Z!=="close"&&Z!==k8&&this[k8])return!1;else if(Z==="data")return!this[T6]&&!X?!1:this[U7]?(EG(()=>this[AP](X)),!0):this[AP](X);else if(Z==="end")return this[Ap]();else if(Z==="close"){if(this[F2]=!0,!this[TJ]&&!this[k8])return!1;let $=super.emit("close");return this.removeAllListeners("close"),$}else if(Z==="error"){this[CG]=X,super.emit(xP,X);let $=!this[kG]||this.listeners("error").length?super.emit("error",X):!1;return this[MZ](),$}else if(Z==="resume"){let $=super.emit("resume");return this[MZ](),$}else if(Z==="finish"||Z==="prefinish"){let $=super.emit(Z);return this.removeAllListeners(Z),$}let Y=super.emit(Z,...J);return this[MZ](),Y}[AP](Z){for(let X of this[i6])if(X.dest.write(Z)===!1)this.pause();let J=this[r5]?!1:super.emit("data",Z);return this[MZ](),J}[Ap](){if(this[TJ])return!1;return this[TJ]=!0,this.readable=!1,this[U7]?(EG(()=>this[hP]()),!0):this[hP]()}[hP](){if(this[KW]){let J=this[KW].end();if(J){for(let X of this[i6])X.dest.write(J);if(!this[r5])super.emit("data",J)}}for(let J of this[i6])J.end();let Z=super.emit("end");return this.removeAllListeners("end"),Z}async collect(){let Z=Object.assign([],{dataLength:0});if(!this[T6])Z.dataLength=0;let J=this.promise();return this.on("data",(X)=>{if(Z.push(X),!this[T6])Z.dataLength+=X.length}),await J,Z}async concat(){if(this[T6])throw new Error("cannot concat in objectMode");let Z=await this.collect();return this[P4]?Z.join(""):Buffer.concat(Z,Z.dataLength)}async promise(){return new Promise((Z,J)=>{this.on(k8,()=>J(new Error("stream destroyed"))),this.on("error",(X)=>J(X)),this.on("end",()=>Z())})}[Symbol.asyncIterator](){this[r5]=!1;let Z=!1,J=async()=>{return this.pause(),Z=!0,{value:void 0,done:!0}};return{next:()=>{if(Z)return J();let Y=this.read();if(Y!==null)return Promise.resolve({done:!1,value:Y});if(this[jZ])return J();let $,Q,W=(H)=>{this.off("data",K),this.off("end",G),this.off(k8,z),J(),Q(H)},K=(H)=>{this.off("error",W),this.off("end",G),this.off(k8,z),this.pause(),$({value:H,done:!!this[jZ]})},G=()=>{this.off("error",W),this.off("data",K),this.off(k8,z),J(),$({done:!0,value:void 0})},z=()=>W(new Error("stream destroyed"));return new Promise((H,V)=>{Q=V,$=H,this.once(k8,z),this.once("error",W),this.once("end",G),this.once("data",K)})},throw:J,return:J,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[r5]=!1;let Z=!1,J=()=>{return this.pause(),this.off(xP,J),this.off(k8,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(xP,J),this.once(k8,J),{next:X,throw:J,return:J,[Symbol.iterator](){return this}}}destroy(Z){if(this[k8]){if(Z)this.emit("error",Z);else this.emit(k8);return this}this[k8]=!0,this[r5]=!0,this[J6].length=0,this[X6]=0;let J=this;if(typeof J.close==="function"&&!this[F2])J.close();if(Z)this.emit("error",Z);else this.emit(k8);return this}static get isStream(){return DF1}}var mF1=yF1.native,vG={lstatSync:AF1,readdir:hF1,readdirSync:fF1,readlinkSync:bF1,realpathSync:mF1,promises:{lstat:uF1,readdir:dF1,readlink:cF1,realpath:lF1}},up=(Z)=>!Z||Z===vG||Z===gF1?vG:{...vG,...Z,promises:{...vG.promises,...Z.promises||{}}},dp=/^\\\\\?\\([a-z]:)\\?$/i,pF1=(Z)=>Z.replace(/\//g,"\\").replace(dp,"$1\\"),iF1=/[\\\/]/,v9=0,cp=1,lp=2,w7=4,pp=6,ip=8,TY=10,np=12,I9=15,IG=~I9,gP=16,bp=32,SG=64,C4=128,L2=256,j2=512,yp=SG|C4|j2,nF1=1023,mP=(Z)=>Z.isFile()?ip:Z.isDirectory()?w7:Z.isSymbolicLink()?TY:Z.isCharacterDevice()?lp:Z.isBlockDevice()?pp:Z.isSocket()?np:Z.isFIFO()?cp:v9,gp=new Map,_G=(Z)=>{let J=gp.get(Z);if(J)return J;let X=Z.normalize("NFKD");return gp.set(Z,X),X},mp=new Map,O2=(Z)=>{let J=mp.get(Z);if(J)return J;let X=_G(Z.toLowerCase());return mp.set(Z,X),X};class dP extends PG{constructor(){super({max:256})}}class ap extends PG{constructor(Z=16384){super({maxSize:Z,sizeCalculation:(J)=>J.length+1})}}var sp=Symbol("PathScurry setAsCwd");class n6{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.#$}#H;get gid(){return this.#H}#q;get rdev(){return this.#q}#K;get blksize(){return this.#K}#G;get ino(){return this.#G}#z;get size(){return this.#z}#V;get blocks(){return this.#V}#Q;get atimeMs(){return this.#Q}#U;get mtimeMs(){return this.#U}#B;get ctimeMs(){return this.#B}#w;get birthtimeMs(){return this.#w}#O;get atime(){return this.#O}#k;get mtime(){return this.#k}#j;get ctime(){return this.#j}#E;get birthtime(){return this.#E}#N;#R;#M;#C;#L;#v;#W;#x;#D;#S;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Z,J=v9,X,Y,$,Q,W){if(this.name=Z,this.#N=$?O2(Z):_G(Z),this.#W=J&nF1,this.nocase=$,this.roots=Y,this.root=X||this,this.#x=Q,this.#M=W.fullpath,this.#L=W.relative,this.#v=W.relativePosix,this.parent=W.parent,this.parent)this.#Z=this.parent.#Z;else this.#Z=up(W.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.#x}resolve(Z){if(!Z)return this;let J=this.getRootString(Z),Y=Z.substring(J.length).split(this.splitSep);return J?this.getRoot(J).#P(Y):this.#P(Y)}#P(Z){let J=this;for(let X of Z)J=J.child(X);return J}children(){let Z=this.#x.get(this);if(Z)return Z;let J=Object.assign([],{provisional:0});return this.#x.set(this,J),this.#W&=~gP,J}child(Z,J){if(Z===""||Z===".")return this;if(Z==="..")return this.parent||this;let X=this.children(),Y=this.nocase?O2(Z):_G(Z);for(let K of X)if(K.#N===Y)return K;let $=this.parent?this.sep:"",Q=this.#M?this.#M+$+Z:void 0,W=this.newChild(Z,v9,{...J,parent:this,fullpath:Q});if(!this.canReaddir())W.#W|=C4;return X.push(W),W}relative(){if(this.isCWD)return"";if(this.#L!==void 0)return this.#L;let Z=this.name,J=this.parent;if(!J)return this.#L=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.#W&I9)===v9}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.#W&I9)===ip}isDirectory(){return(this.#W&I9)===w7}isCharacterDevice(){return(this.#W&I9)===lp}isBlockDevice(){return(this.#W&I9)===pp}isFIFO(){return(this.#W&I9)===cp}isSocket(){return(this.#W&I9)===np}isSymbolicLink(){return(this.#W&TY)===TY}lstatCached(){return this.#W&bp?this:void 0}readlinkCached(){return this.#D}realpathCached(){return this.#S}readdirCached(){let Z=this.children();return Z.slice(0,Z.provisional)}canReadlink(){if(this.#D)return!0;if(!this.parent)return!1;let Z=this.#W&I9;return!(Z!==v9&&Z!==TY||this.#W&L2||this.#W&C4)}calledReaddir(){return!!(this.#W&gP)}isENOENT(){return!!(this.#W&C4)}isNamed(Z){return!this.nocase?this.#N===_G(Z):this.#N===O2(Z)}async readlink(){let Z=this.#D;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.#D=X}catch(J){this.#b(J.code);return}}readlinkSync(){let Z=this.#D;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.#D=X}catch(J){this.#b(J.code);return}}#m(Z){this.#W|=gP;for(let J=Z.provisional;J<Z.length;J++){let X=Z[J];if(X)X.#A()}}#A(){if(this.#W&C4)return;this.#W=(this.#W|C4)&IG,this.#f()}#f(){let Z=this.children();Z.provisional=0;for(let J of Z)J.#A()}#u(){this.#W|=j2,this.#T()}#T(){if(this.#W&SG)return;let Z=this.#W;if((Z&I9)===w7)Z&=IG;this.#W=Z|SG,this.#f()}#I(Z=""){if(Z==="ENOTDIR"||Z==="EPERM")this.#T();else if(Z==="ENOENT")this.#A();else this.children().provisional=0}#d(Z=""){if(Z==="ENOTDIR")this.parent.#T();else if(Z==="ENOENT")this.#A()}#b(Z=""){let J=this.#W;if(J|=L2,Z==="ENOENT")J|=C4;if(Z==="EINVAL"||Z==="UNKNOWN")J&=IG;if(this.#W=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=mP(Z),Y=this.newChild(Z.name,X,{parent:this}),$=Y.#W&I9;if($!==w7&&$!==TY&&$!==v9)Y.#W|=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?O2(Z.name):_G(Z.name))!==Y.#N)continue;return this.#y(Z,Y,X,J)}}#y(Z,J,X,Y){let $=J.name;if(J.#W=J.#W&IG|mP(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.#W&C4)===0)try{return this.#_(await this.#Z.promises.lstat(this.fullpath())),this}catch(Z){this.#d(Z.code)}}lstatSync(){if((this.#W&C4)===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:W,ctime:K,ctimeMs:G,dev:z,gid:H,ino:V,mode:q,mtime:F,mtimeMs:U,nlink:B,rdev:w,size:O,uid:N}=Z;this.#O=J,this.#Q=X,this.#E=Y,this.#w=$,this.#K=Q,this.#V=W,this.#j=K,this.#B=G,this.#J=z,this.#H=H,this.#G=V,this.#Y=q,this.#k=F,this.#U=U,this.#X=B,this.#q=w,this.#z=O,this.#$=N;let R=mP(Z);if(this.#W=this.#W&IG|R|bp,R!==v9&&R!==w7&&R!==TY)this.#W|=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 W of Q)this.#h(W,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.#W&yp)return!1;let Z=I9&this.#W;if(!(Z===v9||Z===w7||Z===TY))return!1;return!0}shouldWalk(Z,J){return(this.#W&w7)===w7&&!(this.#W&yp)&&!Z.has(this)&&(!J||J(this))}async realpath(){if(this.#S)return this.#S;if((j2|L2|C4)&this.#W)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((j2|L2|C4)&this.#W)return;try{let Z=this.#Z.realpathSync(this.fullpath());return this.#S=this.resolve(Z)}catch(Z){this.#u()}}[sp](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.#L=X.join(this.sep),Y.#v=X.join("/"),Y=Y.parent,X.push("..");Y=Z;while(Y&&Y.parent&&!J.has(Y))Y.#L=void 0,Y.#v=void 0,Y=Y.parent}}class M2 extends n6{sep="\\";splitSep=iF1;constructor(Z,J=v9,X,Y,$,Q,W){super(Z,J,X,Y,$,Q,W)}newChild(Z,J=v9,X={}){return new M2(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),X)}getRootString(Z){return uP.parse(Z).root}getRoot(Z){if(Z=pF1(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 xG(Z,this).root}sameRoot(Z,J=this.root.name){return Z=Z.toUpperCase().replace(/\//g,"\\").replace(dp,"$1\\"),Z===J}}class R2 extends n6{splitSep="/";sep="/";constructor(Z,J=v9,X,Y,$,Q,W){super(Z,J,X,Y,$,Q,W)}getRootString(Z){return Z.startsWith("/")?"/":""}getRoot(Z){return this.root}newChild(Z,J=v9,X={}){return new R2(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),X)}}class cP{root;rootPath;roots;cwd;#Z;#J;#Y;nocase;#X;constructor(Z=process.cwd(),J,X,{nocase:Y,childrenCacheSize:$=16384,fs:Q=vG}={}){if(this.#X=up(Q),Z instanceof URL||Z.startsWith("file://"))Z=xF1(Z);let W=J.resolve(Z);this.roots=Object.create(null),this.rootPath=this.parseRootPath(W),this.#Z=new dP,this.#J=new dP,this.#Y=new ap($);let K=W.substring(this.rootPath.length).split(X);if(K.length===1&&!K[0])K.pop();if(Y===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=Y,this.root=this.newRoot(this.#X),this.roots[this.rootPath]=this.root;let G=this.root,z=K.length-1,H=J.sep,V=this.rootPath,q=!1;for(let F of K){let U=z--;G=G.child(F,{relative:new Array(U).fill("..").join(H),relativePosix:new Array(U).fill("..").join("/"),fullpath:V+=(q?"":H)+F}),q=!0}this.cwd=G}depth(Z=this.cwd){if(typeof Z==="string")Z=this.cwd.resolve(Z);return Z.depth()}childrenCache(){return this.#Y}resolve(...Z){let J="";for(let $=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 n6))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 n6))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 n6))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 n6))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 n6))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 n6))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 n6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,W=[];if(!$||$(Z))W.push(X?Z:Z.fullpath());let K=new Set,G=(H,V)=>{K.add(H),H.readdirCB((q,F)=>{if(q)return V(q);let U=F.length;if(!U)return V();let B=()=>{if(--U===0)V()};for(let w of F){if(!$||$(w))W.push(X?w:w.fullpath());if(Y&&w.isSymbolicLink())w.realpath().then((O)=>O?.isUnknown()?O.lstat():O).then((O)=>O?.shouldWalk(K,Q)?G(O,B):B());else if(w.shouldWalk(K,Q))G(w,B);else B()}},!0)},z=Z;return new Promise((H,V)=>{G(z,(q)=>{if(q)return V(q);H(W)})})}walkSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof n6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,W=[];if(!$||$(Z))W.push(X?Z:Z.fullpath());let K=new Set([Z]);for(let G of K){let z=G.readdirSync();for(let H of z){if(!$||$(H))W.push(X?H:H.fullpath());let V=H;if(H.isSymbolicLink()){if(!(Y&&(V=H.realpathSync())))continue;if(V.isUnknown())V.lstatSync()}if(V.shouldWalk(K,Q))K.add(V)}}return W}[Symbol.asyncIterator](){return this.iterate()}iterate(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof n6))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 n6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J;if(!$||$(Z))yield X?Z:Z.fullpath();let W=new Set([Z]);for(let K of W){let G=K.readdirSync();for(let z of G){if(!$||$(z))yield X?z:z.fullpath();let H=z;if(z.isSymbolicLink()){if(!(Y&&(H=z.realpathSync())))continue;if(H.isUnknown())H.lstatSync()}if(H.shouldWalk(W,Q))W.add(H)}}}stream(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof n6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,W=new CY({objectMode:!0});if(!$||$(Z))W.write(X?Z:Z.fullpath());let K=new Set,G=[Z],z=0,H=()=>{let V=!1;while(!V){let q=G.shift();if(!q){if(z===0)W.end();return}z++,K.add(q);let F=(B,w,O=!1)=>{if(B)return W.emit("error",B);if(Y&&!O){let N=[];for(let R of w)if(R.isSymbolicLink())N.push(R.realpath().then((j)=>j?.isUnknown()?j.lstat():j));if(N.length){Promise.all(N).then(()=>F(null,w,!0));return}}for(let N of w)if(N&&(!$||$(N))){if(!W.write(X?N:N.fullpath()))V=!0}z--;for(let N of w){let R=N.realpathCached()||N;if(R.shouldWalk(K,Q))G.push(R)}if(V&&!W.flowing)W.once("drain",H);else if(!U)H()},U=!0;q.readdirCB(F,!0),U=!1}};return H(),W}streamSync(Z=this.cwd,J={}){if(typeof Z==="string")Z=this.cwd.resolve(Z);else if(!(Z instanceof n6))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,W=new CY({objectMode:!0}),K=new Set;if(!$||$(Z))W.write(X?Z:Z.fullpath());let G=[Z],z=0,H=()=>{let V=!1;while(!V){let q=G.shift();if(!q){if(z===0)W.end();return}z++,K.add(q);let F=q.readdirSync();for(let U of F)if(!$||$(U)){if(!W.write(X?U:U.fullpath()))V=!0}z--;for(let U of F){let B=U;if(U.isSymbolicLink()){if(!(Y&&(B=U.realpathSync())))continue;if(B.isUnknown())B.lstatSync()}if(B.shouldWalk(K,Q))G.push(B)}}if(V&&!W.flowing)W.once("drain",H)};return H(),W}chdir(Z=this.cwd){let J=this.cwd;this.cwd=typeof Z==="string"?this.cwd.resolve(Z):Z,this.cwd[sp](J)}}class xG extends cP{sep="\\";constructor(Z=process.cwd(),J={}){let{nocase:X=!0}=J;super(Z,uP,"\\",{...J,nocase:X});this.nocase=X;for(let Y=this.cwd;Y;Y=Y.parent)Y.nocase=this.nocase}parseRootPath(Z){return uP.parse(Z).root.toUpperCase()}newRoot(Z){return new M2(this.rootPath,w7,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")||Z.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Z)}}class AG extends cP{sep="/";constructor(Z=process.cwd(),J={}){let{nocase:X=!1}=J;super(Z,_F1,"/",{...J,nocase:X});this.nocase=X}parseRootPath(Z){return"/"}newRoot(Z){return new R2(this.rootPath,w7,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")}}class N2 extends AG{constructor(Z=process.cwd(),J={}){let{nocase:X=!0}=J;super(Z,{...J,nocase:X})}}var aq6=process.platform==="win32"?M2:R2,op=process.platform==="win32"?xG:process.platform==="darwin"?N2:AG;var aF1=(Z)=>Z.length>=1,sF1=(Z)=>Z.length>=1;class zW{#Z;#J;#Y;length;#X;#$;#H;#q;#K;#G;#z=!0;constructor(Z,J,X,Y){if(!aF1(Z))throw new TypeError("empty pattern list");if(!sF1(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,W,K,...G]=this.#Z,[z,H,V,q,...F]=this.#J;if(G[0]==="")G.shift(),F.shift();let U=[$,Q,W,K,""].join("/"),B=[z,H,V,q,""].join("/");this.#Z=[U,...G],this.#J=[B,...F],this.length=this.#Z.length}else if(this.isDrive()||this.isAbsolute()){let[$,...Q]=this.#Z,[W,...K]=this.#J;if(Q[0]==="")Q.shift(),K.shift();let G=$+"/",z=W+"/";this.#Z=[G,...Q],this.#J=[z,...K],this.length=this.#Z.length}}}pattern(){return this.#Z[this.#Y]}isString(){return typeof this.#Z[this.#Y]==="string"}isGlobstar(){return this.#Z[this.#Y]===L6}isRegExp(){return this.#Z[this.#Y]instanceof RegExp}globString(){return this.#H=this.#H||(this.#Y===0?this.isAbsolute()?this.#J[0]+this.#J.slice(1).join("/"):this.#J.join("/"):this.#J.slice(this.#Y).join("/"))}hasMore(){return this.length>this.#Y+1}rest(){if(this.#$!==void 0)return this.#$;if(!this.hasMore())return this.#$=null;return this.#$=new zW(this.#Z,this.#J,this.#Y+1,this.#X),this.#$.#G=this.#G,this.#$.#K=this.#K,this.#$.#q=this.#q,this.#$}isUNC(){let Z=this.#Z;return this.#K!==void 0?this.#K:this.#K=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 oF1=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class hG{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Z,{nobrace:J,nocase:X,noext:Y,noglobstar:$,platform:Q=oF1}){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 W of Z)this.add(W)}add(Z){let J=new E9(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 zW(Y,$,0,this.platform),W=new E9(Q.globString(),this.mmopts),K=$[$.length-1]==="**",G=Q.isAbsolute();if(G)this.absolute.push(W);else this.relative.push(W);if(K)if(G)this.absoluteChildren.push(W);else this.relativeChildren.push(W)}}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 rp{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 tp{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 fG{hasWalkedCache;matches=new rp;subwalks=new tp;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(),W=$.isAbsolute()&&this.opts.absolute!==!1;if(Q){Y=Y.resolve(Q==="/"&&this.opts.root!==void 0?this.opts.root:Q);let H=$.rest();if(!H){this.matches.add(Y,!0,!1);continue}else $=H}if(Y.isENOENT())continue;let K,G,z=!1;while(typeof(K=$.pattern())==="string"&&(G=$.rest()))Y=Y.resolve(K),$=G,z=!0;if(K=$.pattern(),G=$.rest(),z){if(this.hasWalkedCache.hasWalked(Y,$))continue;this.hasWalkedCache.storeWalked(Y,$)}if(typeof K==="string"){let H=K===".."||K===""||K===".";this.matches.add(Y.resolve(K),W,H);continue}else if(K===L6){if(!Y.isSymbolicLink()||this.follow||$.checkFollowGlobstar())this.subwalks.add(Y,$);let H=G?.pattern(),V=G?.rest();if(!G||(H===""||H===".")&&!V)this.matches.add(Y,W,H===""||H===".");else if(H===".."){let q=Y.parent||Y;if(!V)this.matches.add(q,W,!0);else if(!this.hasWalkedCache.hasWalked(q,V))this.subwalks.add(q,V)}}else if(K instanceof RegExp)this.subwalks.add(Y,$)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new fG(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 W=Q.isAbsolute(),K=Q.pattern(),G=Q.rest();if(K===L6)Y.testGlobstar($,Q,G,W);else if(K instanceof RegExp)Y.testRegExp($,K,G,W);else Y.testString($,K,G,W)}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 rF1=(Z,J)=>typeof Z==="string"?new hG([Z],J):Array.isArray(Z)?new hG(Z,J):Z;class pP{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=rF1(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 fG(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[W,K,G]of X.matches.entries()){if(this.#X(W))continue;$++,this.match(W,K,G).then(()=>Q())}for(let W of X.subwalkTargets()){if(this.maxDepth!==1/0&&W.depth()>=this.maxDepth)continue;$++;let K=W.readdirCached();if(W.calledReaddir())this.walkCB3(W,K,X,Q);else W.readdirCB((G,z)=>this.walkCB3(W,z,X,Q),!0)}Q()}walkCB3(Z,J,X,Y){X=X.filterEntries(Z,J);let $=1,Q=()=>{if(--$===0)Y()};for(let[W,K,G]of X.matches.entries()){if(this.#X(W))continue;$++,this.match(W,K,G).then(()=>Q())}for(let[W,K]of X.subwalks.entries())$++,this.walkCB2(W,K,X.child(),Q);Q()}walkCBSync(Z,J,X){if(this.signal?.aborted)X();this.walkCB2Sync(Z,J,new fG(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[W,K,G]of X.matches.entries()){if(this.#X(W))continue;this.matchSync(W,K,G)}for(let W of X.subwalkTargets()){if(this.maxDepth!==1/0&&W.depth()>=this.maxDepth)continue;$++;let K=W.readdirSync();this.walkCB3Sync(W,K,X,Q)}Q()}walkCB3Sync(Z,J,X,Y){X=X.filterEntries(Z,J);let $=1,Q=()=>{if(--$===0)Y()};for(let[W,K,G]of X.matches.entries()){if(this.#X(W))continue;this.matchSync(W,K,G)}for(let[W,K]of X.subwalks.entries())$++,this.walkCB2Sync(W,K,X.child(),Q);Q()}}class D2 extends pP{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 P2 extends pP{results;constructor(Z,J,X){super(Z,J,X);this.results=new CY({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 eF1=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class B7{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=tF1(J.cwd);if(this.cwd=J.cwd||"",this.root=J.root,this.magicalBraces=!!J.magicalBraces,this.nobrace=!!J.nobrace,this.noext=!!J.noext,this.realpath=!!J.realpath,this.absolute=J.absolute,this.includeChildMatches=J.includeChildMatches!==!1,this.noglobstar=!!J.noglobstar,this.matchBase=!!J.matchBase,this.maxDepth=typeof J.maxDepth==="number"?J.maxDepth:1/0,this.stat=!!J.stat,this.ignore=J.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof Z==="string")Z=[Z];if(this.windowsPathsNoEscape=!!J.windowsPathsNoEscape||J.allowWindowsEscape===!1,this.windowsPathsNoEscape)Z=Z.map((K)=>K.replace(/\\/g,"/"));if(this.matchBase){if(J.noglobstar)throw new TypeError("base matching requires globstar");Z=Z.map((K)=>K.includes("/")?K:`./**/${K}`)}if(this.pattern=Z,this.platform=J.platform||eF1,this.opts={...J,platform:this.platform},J.scurry){if(this.scurry=J.scurry,J.nocase!==void 0&&J.nocase!==J.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let K=J.platform==="win32"?xG:J.platform==="darwin"?N2:J.platform?AG:op;this.scurry=new K(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((K)=>new E9(K,Y)),[Q,W]=$.reduce((K,G)=>{return K[0].push(...G.set),K[1].push(...G.globParts),K},[[],[]]);this.patterns=Q.map((K,G)=>{let z=W[G];if(!z)throw new Error("invalid pattern object");return new zW(K,z,0,this.platform)})}async walk(){return[...await new D2(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 D2(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 P2(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 P2(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 iP=(Z,J={})=>{if(!Array.isArray(Z))Z=[Z];for(let X of Z)if(new E9(X,J).hasMagic())return!0;return!1};function T2(Z,J={}){return new B7(Z,J).streamSync()}function Zi(Z,J={}){return new B7(Z,J).stream()}function Ji(Z,J={}){return new B7(Z,J).walkSync()}async function ep(Z,J={}){return new B7(Z,J).walk()}function k2(Z,J={}){return new B7(Z,J).iterateSync()}function Xi(Z,J={}){return new B7(Z,J).iterate()}var ZU1=T2,JU1=Object.assign(Zi,{sync:T2}),XU1=k2,YU1=Object.assign(Xi,{sync:k2}),$U1=Object.assign(Ji,{stream:T2,iterate:k2}),C2=Object.assign(ep,{glob:ep,globSync:Ji,sync:$U1,globStream:Zi,stream:JU1,globStreamSync:T2,streamSync:ZU1,globIterate:Xi,iterate:YU1,globIterateSync:k2,iterateSync:XU1,Glob:B7,hasMagic:iP,escape:$W,unescape:D4});C2.glob=C2;class nP{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 N5{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 HW extends nP{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 N5(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 W=$.getChild();if(!this._childEdges.has(W))this._childEdges.set(W,new Set);return this._childEdges.get(W).add($),$}_destroyEdge(Z){return this._edges.delete(Z),this._parentEdges.get(Z.getParent()).delete(Z),this._childEdges.get(Z.getChild()).delete(Z),this}}function bG(){return bG=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},bG.apply(this,arguments)}class k6{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 E0{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 $8{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 y0=Symbol("attributes"),T4=Symbol("immutableKeys");class VW extends nP{constructor(Z){super();this._disposed=!1,this.graph=void 0,this[y0]=void 0,this[T4]=void 0,this.graph=Z,this[T4]=new Set,this[y0]=this._createAttributes()}getDefaults(){return{}}_createAttributes(){let Z=this.getDefaults(),J={};for(let X in Z){let Y=Z[X];if(Y instanceof VW){let $=this.graph._createEdge(X,this,Y);this[T4].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[y0]){let Y=this[y0][X];if(Y instanceof N5){let $=Y;if($.getChild()===Z)this.setRef(X,J,$.getAttributes())}else if(Y instanceof k6)for(let $ of Y.listRefsByChild(Z)){let Q=$.getAttributes();this.removeRef(X,Z),this.addRef(X,J,Q)}else if(Y instanceof E0){let $=Y.getRefByChild(Z);if($){let Q=$.getAttributes();this.removeRef(X,Z),this.addRef(X,J,Q)}}else if(Y instanceof $8)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[y0][Z]}set(Z,J){return this[y0][Z]=J,this.dispatchEvent({type:"change",attribute:Z})}getRef(Z){let J=this[y0][Z];return J?J.getChild():null}setRef(Z,J,X){if(this[T4].has(Z))throw new Error(`Cannot overwrite immutable attribute, "${Z}".`);let Y=this[y0][Z];if(Y)Y.dispose();if(!J)return this;let $=this.graph._createEdge(Z,this,J,X);return this[y0][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 k6)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[y0][Z];if(J instanceof k6||J instanceof E0)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 W=this.graph._createEdge(Z,this,X,bG({},Y,{key:J}));return $.set(J,W),this.dispatchEvent({type:"change",attribute:Z,key:J})}assertRefMap(Z){let J=this[y0][Z];if(J instanceof $8)return J;throw new Error(`Expected RefMap for attribute "${Z}"`)}dispatchEvent(Z){return super.dispatchEvent(bG({},Z,{target:this})),this.graph.dispatchEvent(bG({},Z,{target:this,type:`node:${Z.type}`})),this}_destroyRef(Z){let J=Z.getName();if(this[y0][J]===Z){if(this[y0][J]=null,this[T4].has(J))Z.getChild().dispose()}else if(this[y0][J]instanceof k6)this[y0][J].remove(Z);else if(this[y0][J]instanceof E0)this[y0][J].remove(Z);else if(this[y0][J]instanceof $8){let X=this[y0][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 zi="v4.1.1",x2="@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 A2;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(A2||(A2={}));var t5;(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"})(t5||(t5={}));var h2;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(h2||(h2={}));var RZ;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(RZ||(RZ={}));var IJ={"5120":Int8Array,"5121":Uint8Array,"5122":Int16Array,"5123":Uint16Array,"5125":Uint32Array,"5126":Float32Array},sP=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 QU1(){var Z=new sP(3);if(sP!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function aP(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function WU1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=X[3]*Y+X[7]*$+X[11]*Q+X[15];return W=W||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/W,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/W,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/W,Z}(function(){var Z=QU1();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}})();function eP(Z){let J=Hi(),X=Z.propertyType===a.NODE?[Z]:Z.listChildren();for(let Y of X)Y.traverse(($)=>{let Q=$.getMesh();if(!Q)return;let W=KU1(Q,$.getWorldMatrix());if(W.min.every(isFinite)&&W.max.every(isFinite))oP(W.min,J),oP(W.max,J)});return J}function KU1(Z,J){let X=Hi();for(let Y of Z.listPrimitives()){let $=Y.getAttribute("POSITION"),Q=Y.getIndices();if(!$)continue;let W=[0,0,0],K=[0,0,0];for(let G=0,z=Q?Q.getCount():$.getCount();G<z;G++){let H=Q?Q.getScalar(G):G;W=$.getElement(H,W),K=WU1(K,W,J),oP(K,X)}}return X}function oP(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 Hi(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class o0{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 ZC{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 Vi{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),GU1(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 y2{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(o0.decodeText(Z.slice(12,16))===y2.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}}y2.PNG_FRIED_CHUNK_NAME="CgBI";class NZ{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}`}}NZ.impls={"image/jpeg":new Vi,"image/png":new y2};function GU1(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 DZ{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 NZ.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 Yi(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function kY(Z){if(Yi(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let X=J.prototype;if(Yi(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}var rP,yG;(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"})(yG||(yG={}));class P5{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=P5.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=P5.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=P5.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=P5.Verbosity.ERROR)console.error(Z)}}rP=P5;P5.Verbosity=yG;P5.DEFAULT_INSTANCE=new rP(rP.Verbosity.INFO);function zU1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],W=Z[5],K=Z[6],G=Z[7],z=Z[8],H=Z[9],V=Z[10],q=Z[11],F=Z[12],U=Z[13],B=Z[14],w=Z[15],O=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,j=X*K-Y*W,P=X*G-$*W,D=Y*G-$*K,C=z*U-H*F,T=z*B-V*F,k=z*w-q*F,x=H*B-V*U,S=H*w-q*U,A=V*w-q*B;return O*A-N*S+R*x+j*k-P*T+D*C}function HU1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=J[9],F=J[10],U=J[11],B=J[12],w=J[13],O=J[14],N=J[15],R=X[0],j=X[1],P=X[2],D=X[3];return Z[0]=R*Y+j*K+P*V+D*B,Z[1]=R*$+j*G+P*q+D*w,Z[2]=R*Q+j*z+P*F+D*O,Z[3]=R*W+j*H+P*U+D*N,R=X[4],j=X[5],P=X[6],D=X[7],Z[4]=R*Y+j*K+P*V+D*B,Z[5]=R*$+j*G+P*q+D*w,Z[6]=R*Q+j*z+P*F+D*O,Z[7]=R*W+j*H+P*U+D*N,R=X[8],j=X[9],P=X[10],D=X[11],Z[8]=R*Y+j*K+P*V+D*B,Z[9]=R*$+j*G+P*q+D*w,Z[10]=R*Q+j*z+P*F+D*O,Z[11]=R*W+j*H+P*U+D*N,R=X[12],j=X[13],P=X[14],D=X[15],Z[12]=R*Y+j*K+P*V+D*B,Z[13]=R*$+j*G+P*q+D*w,Z[14]=R*Q+j*z+P*F+D*O,Z[15]=R*W+j*H+P*U+D*N,Z}function VU1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[4],W=J[5],K=J[6],G=J[8],z=J[9],H=J[10];return Z[0]=Math.hypot(X,Y,$),Z[1]=Math.hypot(Q,W,K),Z[2]=Math.hypot(G,z,H),Z}function qU1(Z,J){var X=new sP(3);VU1(X,J);var Y=1/X[0],$=1/X[1],Q=1/X[2],W=J[0]*Y,K=J[1]*$,G=J[2]*Q,z=J[4]*Y,H=J[5]*$,V=J[6]*Q,q=J[8]*Y,F=J[9]*$,U=J[10]*Q,B=W+H+U,w=0;if(B>0)w=Math.sqrt(B+1)*2,Z[3]=0.25*w,Z[0]=(V-F)/w,Z[1]=(q-G)/w,Z[2]=(K-z)/w;else if(W>H&&W>U)w=Math.sqrt(1+W-H-U)*2,Z[3]=(V-F)/w,Z[0]=0.25*w,Z[1]=(K+z)/w,Z[2]=(q+G)/w;else if(H>U)w=Math.sqrt(1+H-W-U)*2,Z[3]=(q-G)/w,Z[0]=(K+z)/w,Z[1]=0.25*w,Z[2]=(V+F)/w;else w=Math.sqrt(1+U-W-H)*2,Z[3]=(K-z)/w,Z[0]=(q+G)/w,Z[1]=(V+F)/w,Z[2]=0.25*w;return Z}class i0{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(i0.clamp(Z,0,1)*65535);case 5121:return Math.round(i0.clamp(Z,0,1)*255);case 5122:return Math.round(i0.clamp(Z,-1,1)*32767);case 5120:return Math.round(i0.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,X,Y){let $=aP([Z[0],Z[1],Z[2]]),Q=aP([Z[4],Z[5],Z[6]]),W=aP([Z[8],Z[9],Z[10]]);if(zU1(Z)<0)$=-$;J[0]=Z[12],J[1]=Z[13],J[2]=Z[14];let G=Z.slice(),z=1/$,H=1/Q,V=1/W;G[0]*=z,G[1]*=z,G[2]*=z,G[4]*=H,G[5]*=H,G[6]*=H,G[8]*=V,G[9]*=V,G[10]*=V,qU1(X,G),Y[0]=$,Y[1]=Q,Y[2]=W}static compose(Z,J,X,Y){let $=Y,Q=J[0],W=J[1],K=J[2],G=J[3],z=Q+Q,H=W+W,V=K+K,q=Q*z,F=Q*H,U=Q*V,B=W*H,w=W*V,O=K*V,N=G*z,R=G*H,j=G*V,P=X[0],D=X[1],C=X[2];return $[0]=(1-(B+O))*P,$[1]=(F+j)*P,$[2]=(U-R)*P,$[3]=0,$[4]=(F-j)*D,$[5]=(1-(q+O))*D,$[6]=(w+N)*D,$[7]=0,$[8]=(U+R)*C,$[9]=(w-N)*C,$[10]=(1-(q+B))*C,$[11]=0,$[12]=Z[0],$[13]=Z[1],$[14]=Z[2],$[15]=1,$}}function FU1(Z,J){if(!!Z!==!!J)return!1;let X=Z.getChild(),Y=J.getChild();return X===Y||X.equals(Y)}function UU1(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[$],W=Y[$];if(Q.getChild()===W.getChild())continue;if(!Q.getChild().equals(W.getChild()))return!1}return!0}function wU1(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($),W=J.get($);if(!!Q!==!!W)return!1;let K=Q.getChild(),G=W.getChild();if(K===G)continue;if(!K.equals(G))return!1}return!0}function qi(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 Fi(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!kY(Z)||!kY(J))return Z===J;let X=Z,Y=J,$=0,Q=0,W;for(W in X)$++;for(W in Y)Q++;if($!==Q)return!1;for(W in X){let K=X[W],G=Y[W];if(f2(K)&&f2(G)){if(!qi(K,G))return!1}else if(kY(K)&&kY(G)){if(!Fi(K,G))return!1}else if(K!==G)return!1}return!0}function f2(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var $i="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ",BU1=999,LU1=6,Qi=new Set,OU1=function Z(){let J="";for(let X=0;X<LU1;X++)J+=$i.charAt(Math.floor(Math.random()*$i.length));return J},Ui=function Z(){for(let J=0;J<BU1;J++){let X=OU1();if(!Qi.has(X))return Qi.add(X),X}return""},Wi="https://null.example";class S9{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return DZ.basename(new URL(Z,Wi).pathname)}static extension(Z){return DZ.extension(new URL(Z,Wi).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)}}S9.DEFAULT_INIT={};S9.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var EJ=(Z)=>Z,jU1=new Set;class g2 extends VW{constructor(Z,J=""){super(Z);this[y0].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,EJ)}copy(Z,J=EJ){for(let X in this[y0]){let Y=this[y0][X];if(Y instanceof N5){if(!this[T4].has(X))Y.dispose()}else if(Y instanceof k6||Y instanceof E0)for(let $ of Y.values())$.dispose();else if(Y instanceof $8)for(let $ of Y.values())$.dispose()}for(let X in Z[y0]){let Y=this[y0][X],$=Z[y0][X];if($ instanceof N5)if(this[T4].has(X))Y.getChild().copy(J($.getChild()),J);else this.setRef(X,J($.getChild()),$.getAttributes());else if($ instanceof E0||$ instanceof k6)for(let Q of $.values())this.addRef(X,J(Q.getChild()),Q.getAttributes());else if($ instanceof $8)for(let Q of $.keys()){let W=$.get(Q);this.setRefMap(X,Q,J(W.getChild()),W.getAttributes())}else if(kY($))this[y0][X]=JSON.parse(JSON.stringify($));else if(Array.isArray($)||$ instanceof ArrayBuffer||ArrayBuffer.isView($))this[y0][X]=$.slice();else this[y0][X]=$}return this}equals(Z,J=jU1){if(this===Z)return!0;if(this.propertyType!==Z.propertyType)return!1;for(let X in this[y0]){if(J.has(X))continue;let Y=this[y0][X],$=Z[y0][X];if(Y instanceof N5||$ instanceof N5){if(!FU1(Y,$))return!1}else if(Y instanceof E0||$ instanceof E0||Y instanceof k6||$ instanceof k6){if(!UU1(Y,$))return!1}else if(Y instanceof $8||$ instanceof $8){if(!wU1(Y,$))return!1}else if(kY(Y)||kY($)){if(!Fi(Y,$))return!1}else if(f2(Y)||f2($)){if(!qi(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 I6 extends g2{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new $8})}getExtension(Z){return this.getRefMap("extensions",Z)}setExtension(Z,J){if(J)J._validateParent(this);return this.setRefMap("extensions",Z,J)}listExtensions(){return this.listRefMapValues("extensions")}}class h0 extends I6{init(){this.propertyType=a.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:h0.Type.SCALAR,componentType:h0.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(Z){switch(Z){case h0.Type.SCALAR:return 1;case h0.Type.VEC2:return 2;case h0.Type.VEC3:return 3;case h0.Type.VEC4:return 4;case h0.Type.MAT2:return 4;case h0.Type.MAT3:return 9;case h0.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+Z)}}static getComponentSize(Z){switch(Z){case h0.ComponentType.BYTE:return 1;case h0.ComponentType.UNSIGNED_BYTE:return 1;case h0.ComponentType.SHORT:return 2;case h0.ComponentType.UNSIGNED_SHORT:return 2;case h0.ComponentType.UNSIGNED_INT:return 4;case h0.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+Z)}}getMinNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMin(Z),J)for(let $=0;$<X;$++)Z[$]=i0.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 W=J[$+Q];if(Number.isFinite(W))Z[Q]=Math.min(Z[Q],W)}return Z}getMaxNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMax(Z),J)for(let $=0;$<X;$++)Z[$]=i0.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 W=J[$+Q];if(Number.isFinite(W))Z[Q]=Math.max(Z[Q],W)}return Z}getCount(){let Z=this.get("array");return Z?Z.length/this.getElementSize():0}getType(){return this.get("type")}setType(Z){return this.set("type",Z)}getElementSize(){return h0.getElementSize(this.get("type"))}getComponentSize(){return this.get("array").BYTES_PER_ELEMENT}getComponentType(){return this.get("componentType")}getNormalized(){return this.get("normalized")}setNormalized(Z){return this.set("normalized",Z)}getScalar(Z){let J=this.getElementSize(),X=this.getComponentType(),Y=this.getArray();if(this.getNormalized())return i0.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]=i0.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 W=0;W<Y;W++)if(X)J[W]=i0.decodeNormalizedInt(Q[Z*Y+W],$);else J[W]=Q[Z*Y+W];return J}setElement(Z,J){let X=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();for(let W=0;W<Y;W++)if(X)Q[Z*Y+W]=i0.encodeNormalizedInt(J[W],$);else Q[Z*Y+W]=J[W];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?MU1(Z):h0.ComponentType.FLOAT),this.set("array",Z),this}getByteLength(){let Z=this.get("array");return Z?Z.byteLength:0}}h0.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};h0.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function MU1(Z){switch(Z.constructor){case Float32Array:return h0.ComponentType.FLOAT;case Uint32Array:return h0.ComponentType.UNSIGNED_INT;case Uint16Array:return h0.ComponentType.UNSIGNED_SHORT;case Uint8Array:return h0.ComponentType.UNSIGNED_BYTE;case Int16Array:return h0.ComponentType.SHORT;case Int8Array:return h0.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class JC extends I6{init(){this.propertyType=a.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new E0,samplers:new E0})}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 EY extends I6{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)}}EY.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class qW extends I6{init(){this.propertyType=a.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:qW.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:t5.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:t5.OTHER})}}qW.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class XC extends I6{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 IY extends I6{init(){this.propertyType=a.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:IY.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)}}IY.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class FW extends g2{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}FW.EXTENSION_NAME=void 0;class D5 extends I6{init(){this.propertyType=a.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:D5.WrapMode.REPEAT,wrapT:D5.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)}}D5.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};D5.MagFilter={NEAREST:9728,LINEAR:9729};D5.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:E2,G:I2,B:v2,A:RU1}=h2;class L7 extends I6{init(){this.propertyType=a.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:L7.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new D5(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new D5(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new D5(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new D5(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new D5(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:E2|I2|v2|RU1,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:E2|I2|v2,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:E2|I2|v2})}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:E2})}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:I2|v2})}}L7.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class mG extends I6{init(){this.propertyType=a.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new E0})}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 m2 extends I6{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 E0})}copy(Z,J=EJ){if(J===EJ)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 i0.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 i0.decompose(Z,J,X,Y),this.set("translation",J).set("rotation",X).set("scale",Y)}getWorldTranslation(){let Z=[0,0,0];return i0.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return i0.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return i0.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())HU1(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 E8 extends I6{init(){this.propertyType=a.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:E8.Mode.TRIANGLES,material:null,indices:null,attributes:new $8,targets:new E0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:t5.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:t5.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)}}E8.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class YC extends g2{init(){this.propertyType=a.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new $8})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:t5.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function a6(){return a6=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},a6.apply(null,arguments)}class UW extends I6{init(){this.propertyType=a.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new E0})}copy(Z,J=EJ){if(J===EJ)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 $C extends I6{init(){this.propertyType=a.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new E0})}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:t5.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class vY extends I6{init(){this.propertyType=a.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||NZ.extensionToMimeType(DZ.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=NZ.extensionToMimeType(DZ.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",o0.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return NZ.getSize(Z,this.getMimeType())}}class SY extends I6{init(){this.propertyType=a.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${zi}`,version:"2.0"},defaultScene:null,accessors:new E0,animations:new E0,buffers:new E0,cameras:new E0,materials:new E0,meshes:new E0,nodes:new E0,scenes:new E0,skins:new E0,textures:new E0})}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=EJ){if(J===EJ)throw new Error("Root cannot be copied.");this.set("asset",a6({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(a6({},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 UW)this.addRef("scenes",Z);else if(Z instanceof m2)this.addRef("nodes",Z);else if(Z instanceof IY)this.addRef("cameras",Z);else if(Z instanceof $C)this.addRef("skins",Z);else if(Z instanceof mG)this.addRef("meshes",Z);else if(Z instanceof L7)this.addRef("materials",Z);else if(Z instanceof vY)this.addRef("textures",Z);else if(Z instanceof JC)this.addRef("animations",Z);else if(Z instanceof h0)this.addRef("accessors",Z);else if(Z instanceof XC)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 E6{static fromGraph(Z){return E6._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new HW,this._root=new SY(this._graph),this._logger=P5.DEFAULT_INSTANCE,E6._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 UW(this._graph,Z)}createNode(Z=""){return new m2(this._graph,Z)}createCamera(Z=""){return new IY(this._graph,Z)}createSkin(Z=""){return new $C(this._graph,Z)}createMesh(Z=""){return new mG(this._graph,Z)}createPrimitive(){return new E8(this._graph)}createPrimitiveTarget(Z=""){return new YC(this._graph,Z)}createMaterial(Z=""){return new L7(this._graph,Z)}createTexture(Z=""){return new vY(this._graph,Z)}createAnimation(Z=""){return new JC(this._graph,Z)}createAnimationChannel(Z=""){return new EY(this._graph,Z)}createAnimationSampler(Z=""){return new qW(this._graph,Z)}createAccessor(Z="",J=null){if(!J)J=this.getRoot().listBuffers()[0];return new h0(this._graph,Z).setBuffer(J)}createBuffer(Z=""){return new XC(this._graph,Z)}}E6._GRAPH_DOCUMENTS=new WeakMap;class wi{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 FW&&$.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}}wi.EXTENSION_NAME=void 0;class Bi{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 Ki={logger:P5.DEFAULT_INSTANCE,extensions:[],dependencies:{}},NU1=new Set([a.BUFFER,a.TEXTURE,a.MATERIAL,a.MESH,a.PRIMITIVE,a.NODE,a.SCENE]);class Li{static read(Z,J=Ki){let X=a6({},Ki,J),{json:Y}=Z,$=new E6().setLogger(X.logger);this.validate(Z,X);let Q=new Bi(Z),W=Y.asset,K=$.getRoot().getAsset();if(W.copyright)K.copyright=W.copyright;if(W.extras)K.extras=W.extras;if(Y.extras!==void 0)$.getRoot().setExtras(a6({},Y.extras));let G=Y.extensionsUsed||[],z=Y.extensionsRequired||[];X.extensions.sort((D,C)=>D.EXTENSION_NAME>C.EXTENSION_NAME?1:-1);for(let D of X.extensions)if(G.includes(D.EXTENSION_NAME)){let C=$.createExtension(D).setRequired(z.includes(D.EXTENSION_NAME)),T=C.prereadTypes.filter((k)=>!NU1.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 H=Y.buffers||[];$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(a.BUFFER)).forEach((D)=>D.preread(Q,a.BUFFER)),Q.buffers=H.map((D)=>{let C=$.createBuffer(D.name);if(D.extras)C.setExtras(D.extras);if(D.uri&&D.uri.indexOf("__")!==0)C.setURI(D.uri);return C});let V=Y.bufferViews||[];Q.bufferViewBuffers=V.map((D,C)=>{if(!Q.bufferViews[C]){let T=Z.json.buffers[D.buffer],k=T.uri?Z.resources[T.uri]:Z.resources[x2],x=D.byteOffset||0;Q.bufferViews[C]=o0.toView(k,x,D.byteLength)}return Q.buffers[D.buffer]});let q=Y.accessors||[];Q.accessors=q.map((D)=>{let C=Q.bufferViewBuffers[D.bufferView],T=$.createAccessor(D.name,C).setType(D.type);if(D.extras)T.setExtras(D.extras);if(D.normalized!==void 0)T.setNormalized(D.normalized);if(D.bufferView===void 0)return T;return T.setArray(_2(D,Q)),T});let F=Y.images||[],U=Y.textures||[];$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(a.TEXTURE)).forEach((D)=>D.preread(Q,a.TEXTURE)),Q.textures=F.map((D)=>{let C=$.createTexture(D.name);if(D.extras)C.setExtras(D.extras);if(D.bufferView!==void 0){let T=Y.bufferViews[D.bufferView],k=Z.json.buffers[T.buffer],x=k.uri?Z.resources[k.uri]:Z.resources[x2],S=T.byteOffset||0,A=T.byteLength,I=x.slice(S,S+A);C.setImage(I)}else if(D.uri!==void 0){if(C.setImage(Z.resources[D.uri]),D.uri.indexOf("__")!==0)C.setURI(D.uri)}if(D.mimeType!==void 0)C.setMimeType(D.mimeType);else if(D.uri){let T=DZ.extension(D.uri);C.setMimeType(NZ.extensionToMimeType(T))}return C}),$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(a.MATERIAL)).forEach((D)=>D.preread(Q,a.MATERIAL));let B=Y.materials||[];Q.materials=B.map((D)=>{let C=$.createMaterial(D.name);if(D.extras)C.setExtras(D.extras);if(D.alphaMode!==void 0)C.setAlphaMode(D.alphaMode);if(D.alphaCutoff!==void 0)C.setAlphaCutoff(D.alphaCutoff);if(D.doubleSided!==void 0)C.setDoubleSided(D.doubleSided);let T=D.pbrMetallicRoughness||{};if(T.baseColorFactor!==void 0)C.setBaseColorFactor(T.baseColorFactor);if(D.emissiveFactor!==void 0)C.setEmissiveFactor(D.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,x=Q.textures[U[k.index].source];C.setBaseColorTexture(x),Q.setTextureInfo(C.getBaseColorTextureInfo(),k)}if(D.emissiveTexture!==void 0){let k=D.emissiveTexture,x=Q.textures[U[k.index].source];C.setEmissiveTexture(x),Q.setTextureInfo(C.getEmissiveTextureInfo(),k)}if(D.normalTexture!==void 0){let k=D.normalTexture,x=Q.textures[U[k.index].source];if(C.setNormalTexture(x),Q.setTextureInfo(C.getNormalTextureInfo(),k),D.normalTexture.scale!==void 0)C.setNormalScale(D.normalTexture.scale)}if(D.occlusionTexture!==void 0){let k=D.occlusionTexture,x=Q.textures[U[k.index].source];if(C.setOcclusionTexture(x),Q.setTextureInfo(C.getOcclusionTextureInfo(),k),D.occlusionTexture.strength!==void 0)C.setOcclusionStrength(D.occlusionTexture.strength)}if(T.metallicRoughnessTexture!==void 0){let k=T.metallicRoughnessTexture,x=Q.textures[U[k.index].source];C.setMetallicRoughnessTexture(x),Q.setTextureInfo(C.getMetallicRoughnessTextureInfo(),k)}return C}),$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(a.MESH)).forEach((D)=>D.preread(Q,a.MESH));let w=Y.meshes||[];$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(a.PRIMITIVE)).forEach((D)=>D.preread(Q,a.PRIMITIVE)),Q.meshes=w.map((D)=>{let C=$.createMesh(D.name);if(D.extras)C.setExtras(D.extras);if(D.weights!==void 0)C.setWeights(D.weights);return(D.primitives||[]).forEach((k)=>{let x=$.createPrimitive();if(k.extras)x.setExtras(k.extras);if(k.material!==void 0)x.setMaterial(Q.materials[k.material]);if(k.mode!==void 0)x.setMode(k.mode);for(let[I,v]of Object.entries(k.attributes||{}))x.setAttribute(I,Q.accessors[v]);if(k.indices!==void 0)x.setIndices(Q.accessors[k.indices]);let S=D.extras&&D.extras.targetNames||[];(k.targets||[]).forEach((I,v)=>{let b=S[v]||v.toString(),m=$.createPrimitiveTarget(b);for(let[n,o]of Object.entries(I))m.setAttribute(n,Q.accessors[o]);x.addTarget(m)}),C.addPrimitive(x)}),C});let O=Y.cameras||[];Q.cameras=O.map((D)=>{let C=$.createCamera(D.name).setType(D.type);if(D.extras)C.setExtras(D.extras);if(D.type===IY.Type.PERSPECTIVE){let T=D.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=D.orthographic;C.setZNear(T.znear).setZFar(T.zfar).setXMag(T.xmag).setYMag(T.ymag)}return C});let N=Y.nodes||[];$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(a.NODE)).forEach((D)=>D.preread(Q,a.NODE)),Q.nodes=N.map((D)=>{let C=$.createNode(D.name);if(D.extras)C.setExtras(D.extras);if(D.translation!==void 0)C.setTranslation(D.translation);if(D.rotation!==void 0)C.setRotation(D.rotation);if(D.scale!==void 0)C.setScale(D.scale);if(D.matrix!==void 0){let T=[0,0,0],k=[0,0,0,1],x=[1,1,1];i0.decompose(D.matrix,T,k,x),C.setTranslation(T),C.setRotation(k),C.setScale(x)}if(D.weights!==void 0)C.setWeights(D.weights);return C});let R=Y.skins||[];Q.skins=R.map((D)=>{let C=$.createSkin(D.name);if(D.extras)C.setExtras(D.extras);if(D.inverseBindMatrices!==void 0)C.setInverseBindMatrices(Q.accessors[D.inverseBindMatrices]);if(D.skeleton!==void 0)C.setSkeleton(Q.nodes[D.skeleton]);for(let T of D.joints)C.addJoint(Q.nodes[T]);return C}),N.map((D,C)=>{let T=Q.nodes[C];if((D.children||[]).forEach((x)=>T.addChild(Q.nodes[x])),D.mesh!==void 0)T.setMesh(Q.meshes[D.mesh]);if(D.camera!==void 0)T.setCamera(Q.cameras[D.camera]);if(D.skin!==void 0)T.setSkin(Q.skins[D.skin])});let j=Y.animations||[];Q.animations=j.map((D)=>{let C=$.createAnimation(D.name);if(D.extras)C.setExtras(D.extras);let k=(D.samplers||[]).map((S)=>{let A=$.createAnimationSampler().setInput(Q.accessors[S.input]).setOutput(Q.accessors[S.output]).setInterpolation(S.interpolation||qW.Interpolation.LINEAR);if(S.extras)A.setExtras(S.extras);return C.addSampler(A),A});return(D.channels||[]).forEach((S)=>{let A=$.createAnimationChannel().setSampler(k[S.sampler]).setTargetPath(S.target.path);if(S.target.node!==void 0)A.setTargetNode(Q.nodes[S.target.node]);if(S.extras)A.setExtras(S.extras);C.addChannel(A)}),C});let P=Y.scenes||[];if($.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(a.SCENE)).forEach((D)=>D.preread(Q,a.SCENE)),Q.scenes=P.map((D)=>{let C=$.createScene(D.name);if(D.extras)C.setExtras(D.extras);return(D.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((D)=>D.read(Q)),q.forEach((D,C)=>{let T=Q.accessors[C],k=!!D.sparse,x=!D.bufferView&&!T.getArray();if(k||x)T.setSparse(!0).setArray(PU1(D,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 DU1(Z,J){let X=J.jsonDoc,Y=J.bufferViews[Z.bufferView],$=X.json.bufferViews[Z.bufferView],Q=IJ[Z.componentType],W=h0.getElementSize(Z.type),K=Q.BYTES_PER_ELEMENT,G=Z.byteOffset||0,z=new Q(Z.count*W),H=new DataView(Y.buffer,Y.byteOffset,Y.byteLength),V=$.byteStride;for(let q=0;q<Z.count;q++)for(let F=0;F<W;F++){let U=G+q*V+F*K,B;switch(Z.componentType){case h0.ComponentType.FLOAT:B=H.getFloat32(U,!0);break;case h0.ComponentType.UNSIGNED_INT:B=H.getUint32(U,!0);break;case h0.ComponentType.UNSIGNED_SHORT:B=H.getUint16(U,!0);break;case h0.ComponentType.UNSIGNED_BYTE:B=H.getUint8(U);break;case h0.ComponentType.SHORT:B=H.getInt16(U,!0);break;case h0.ComponentType.BYTE:B=H.getInt8(U);break;default:throw new Error(`Unexpected componentType "${Z.componentType}".`)}z[q*W+F]=B}return z}function _2(Z,J){let X=J.jsonDoc,Y=J.bufferViews[Z.bufferView],$=X.json.bufferViews[Z.bufferView],Q=IJ[Z.componentType],W=h0.getElementSize(Z.type),K=Q.BYTES_PER_ELEMENT,G=W*K;if($.byteStride!==void 0&&$.byteStride!==G)return DU1(Z,J);let z=Y.byteOffset+(Z.byteOffset||0),H=Z.count*W*K;return new Q(Y.buffer.slice(z,z+H))}function PU1(Z,J){let X=IJ[Z.componentType],Y=h0.getElementSize(Z.type),$;if(Z.bufferView!==void 0)$=_2(Z,J);else $=new X(Z.count*Y);let Q=Z.sparse;if(!Q)return $;let W=Q.count,K=a6({},Z,Q.indices,{count:W,type:"SCALAR"}),G=a6({},Z,Q.values,{count:W}),z=_2(K,J),H=_2(G,J);for(let V=0;V<K.count;V++)for(let q=0;q<Y;q++)$[z[V]*Y+q]=H[V*Y+q];return $}var gG;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(gG||(gG={}));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 tP($>1,()=>X.basename||"buffer"),this.imageURIGenerator=new tP(Q>1,(W)=>CU1(Z,W)||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 W={index:this.textureDefIndexMap.get(Q)};if(J.getTexCoord()!==0)W.texCoord=J.getTexCoord();if(Object.keys(J.getExtras()).length>0)W.extras=J.getExtras();return this.textureInfoDefMap.set(J,W),W}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===RZ.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=NZ.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 t5.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 t5.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=gG;kJ.BufferViewUsage=t5;kJ.USAGE_TO_TARGET={[t5.ARRAY_BUFFER]:gG.ARRAY_BUFFER,[t5.ELEMENT_ARRAY_BUFFER]:gG.ELEMENT_ARRAY_BUFFER};class tP{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 CU1(Z,J){let X=Z.getGraph().listParentEdges(J).find((Y)=>Y.getParent()!==Z.getRoot());return X?X.getName().replace(/texture$/i,""):""}var{BufferViewUsage:S2}=kJ,{UNSIGNED_INT:TU1,UNSIGNED_SHORT:kU1,UNSIGNED_BYTE:EU1}=h0.ComponentType,IU1=new Set([a.ACCESSOR,a.BUFFER,a.MATERIAL,a.MESH]);class Oi{static write(Z,J){let X=Z.getGraph(),Y=Z.getRoot(),$={asset:a6({generator:`glTF-Transform ${zi}`},Y.getAsset()),extras:a6({},Y.getExtras())},Q={json:$,resources:{}},W=new kJ(Z,Q,J),K=J.logger||P5.DEFAULT_INSTANCE,G=new Set(J.extensions.map((w)=>w.EXTENSION_NAME)),z=Z.getRoot().listExtensionsUsed().filter((w)=>G.has(w.extensionName)).sort((w,O)=>w.extensionName>O.extensionName?1:-1),H=Z.getRoot().listExtensionsRequired().filter((w)=>G.has(w.extensionName)).sort((w,O)=>w.extensionName>O.extensionName?1:-1);if(z.length<Z.getRoot().listExtensionsUsed().length)K.warn("Some extensions were not registered for I/O, and will not be written.");for(let w of z){let O=w.prewriteTypes.filter((N)=>!IU1.has(N));if(O.length)K.warn(`Prewrite hooks for some types (${O.join()}), requested by extension ${w.extensionName}, are unsupported. Please file an issue or a PR.`);for(let N of w.writeDependencies)w.install(N,J.dependencies[N])}function V(w,O,N,R){let j=[],P=0;for(let T of w){let k=W.createAccessorDef(T);k.bufferView=$.bufferViews.length;let x=T.getArray(),S=o0.pad(o0.toView(x));k.byteOffset=P,P+=S.byteLength,j.push(S),W.accessorIndexMap.set(T,$.accessors.length),$.accessors.push(k)}let D=o0.concat(j),C={buffer:O,byteOffset:N,byteLength:D.byteLength};if(R)C.target=R;return $.bufferViews.push(C),{buffers:j,byteLength:P}}function q(w,O,N){let R=w[0].getCount(),j=0;for(let k of w){let x=W.createAccessorDef(k);x.bufferView=$.bufferViews.length,x.byteOffset=j;let S=k.getElementSize(),A=k.getComponentSize();j+=o0.padNumber(S*A),W.accessorIndexMap.set(k,$.accessors.length),$.accessors.push(x)}let P=R*j,D=new ArrayBuffer(P),C=new DataView(D);for(let k=0;k<R;k++){let x=0;for(let S of w){let A=S.getElementSize(),I=S.getComponentSize(),v=S.getComponentType(),b=S.getArray();for(let m=0;m<A;m++){let n=k*j+x+m*I,o=b[k*A+m];switch(v){case h0.ComponentType.FLOAT:C.setFloat32(n,o,!0);break;case h0.ComponentType.BYTE:C.setInt8(n,o);break;case h0.ComponentType.SHORT:C.setInt16(n,o,!0);break;case h0.ComponentType.UNSIGNED_BYTE:C.setUint8(n,o);break;case h0.ComponentType.UNSIGNED_SHORT:C.setUint16(n,o,!0);break;case h0.ComponentType.UNSIGNED_INT:C.setUint32(n,o,!0);break;default:throw new Error("Unexpected component type: "+v)}}x+=o0.padNumber(A*I)}}let T={buffer:O,byteOffset:N,byteLength:P,byteStride:j,target:kJ.BufferViewTarget.ARRAY_BUFFER};return $.bufferViews.push(T),{byteLength:P,buffers:[new Uint8Array(D)]}}function F(w,O,N){let R=[],j=0,P=new Map,D=-1/0,C=!1;for(let v of w){let b=W.createAccessorDef(v);$.accessors.push(b),W.accessorIndexMap.set(v,$.accessors.length-1);let m=[],n=[],o=[],Q0=new Array(v.getElementSize()).fill(0);for(let r0=0,f8=v.getCount();r0<f8;r0++){if(v.getElement(r0,o),i0.eq(o,Q0,0))continue;D=Math.max(r0,D),m.push(r0);for(let X8=0;X8<o.length;X8++)n.push(o[X8])}let K0=m.length,_0={accessorDef:b,count:K0};if(P.set(v,_0),K0===0)continue;if(K0>v.getCount()/2)C=!0;let x0=IJ[v.getComponentType()];_0.indices=m,_0.values=new x0(n)}if(!Number.isFinite(D))return{buffers:R,byteLength:j};if(C)K.warn("Some sparse accessors have >50% non-zero elements, which may increase file size.");let T=D<255?Uint8Array:D<65535?Uint16Array:Uint32Array,k=D<255?EU1:D<65535?kU1:TU1,x={buffer:O,byteOffset:N+j,byteLength:0};for(let v of w){let b=P.get(v);if(b.count===0)continue;b.indicesByteOffset=x.byteLength;let m=o0.pad(o0.toView(new T(b.indices)));R.push(m),j+=m.byteLength,x.byteLength+=m.byteLength}$.bufferViews.push(x);let S=$.bufferViews.length-1,A={buffer:O,byteOffset:N+j,byteLength:0};for(let v of w){let b=P.get(v);if(b.count===0)continue;b.valuesByteOffset=A.byteLength;let m=o0.pad(o0.toView(b.values));R.push(m),j+=m.byteLength,A.byteLength+=m.byteLength}$.bufferViews.push(A);let I=$.bufferViews.length-1;for(let v of w){let b=P.get(v);if(b.count===0)continue;b.accessorDef.sparse={count:b.count,indices:{bufferView:S,byteOffset:b.indicesByteOffset,componentType:k},values:{bufferView:I,byteOffset:b.valuesByteOffset}}}return{buffers:R,byteLength:j}}if($.accessors=[],$.bufferViews=[],$.samplers=[],$.textures=[],$.images=Y.listTextures().map((w,O)=>{let N=W.createPropertyDef(w);if(w.getMimeType())N.mimeType=w.getMimeType();let R=w.getImage();if(R)W.createImageData(N,R,w);return W.imageIndexMap.set(w,O),N}),z.filter((w)=>w.prewriteTypes.includes(a.ACCESSOR)).forEach((w)=>w.prewrite(W,a.ACCESSOR)),Y.listAccessors().forEach((w)=>{let{accessorUsageGroupedByParent:O,accessorParents:N}=W;if(W.accessorIndexMap.has(w))return;let R=W.getAccessorUsage(w);if(W.addAccessorToUsageGroup(w,R),O.has(R)){let j=X.listParents(w).find((P)=>P.propertyType!==a.ROOT);N.set(w,j)}}),z.filter((w)=>w.prewriteTypes.includes(a.BUFFER)).forEach((w)=>w.prewrite(W,a.BUFFER)),(Y.listAccessors().length>0||W.otherBufferViews.size>0||Y.listTextures().length>0&&J.format===RZ.GLB)&&Y.listBuffers().length===0)throw new Error("Buffer required for Document resources, but none was found.");if($.buffers=[],Y.listBuffers().forEach((w,O)=>{let N=W.createPropertyDef(w),R=W.accessorUsageGroupedByParent,j=w.listParents().filter((A)=>A instanceof h0),P=new Set(j.map((A)=>W.accessorParents.get(A))),D=new Map(Array.from(P).map((A,I)=>[A,I])),C={};for(let A of j){var T;if(W.accessorIndexMap.has(A))continue;let I=W.getAccessorUsage(A),v=I;if(R.has(I)){let b=W.accessorParents.get(A);v+=`:${D.get(b)}`}C[T=v]||(C[T]={usage:I,accessors:[]}),C[v].accessors.push(A)}let k=[],x=$.buffers.length,S=0;for(let{usage:A,accessors:I}of Object.values(C))if(A===S2.ARRAY_BUFFER&&J.vertexLayout===A2.INTERLEAVED){let v=q(I,x,S);S+=v.byteLength;for(let b of v.buffers)k.push(b)}else if(A===S2.ARRAY_BUFFER)for(let v of I){let b=q([v],x,S);S+=b.byteLength;for(let m of b.buffers)k.push(m)}else if(A===S2.SPARSE){let v=F(I,x,S);S+=v.byteLength;for(let b of v.buffers)k.push(b)}else if(A===S2.ELEMENT_ARRAY_BUFFER){let v=kJ.BufferViewTarget.ELEMENT_ARRAY_BUFFER,b=V(I,x,S,v);S+=b.byteLength;for(let m of b.buffers)k.push(m)}else{let v=V(I,x,S);S+=v.byteLength;for(let b of v.buffers)k.push(b)}if(W.imageBufferViews.length&&O===0){for(let A=0;A<W.imageBufferViews.length;A++)if($.bufferViews[$.images[A].bufferView].byteOffset=S,S+=W.imageBufferViews[A].byteLength,k.push(W.imageBufferViews[A]),S%8){let I=8-S%8;S+=I,k.push(new Uint8Array(I))}}if(W.otherBufferViews.has(w))for(let A of W.otherBufferViews.get(w))$.bufferViews.push({buffer:x,byteOffset:S,byteLength:A.byteLength}),W.otherBufferViewsIndexMap.set(A,$.bufferViews.length-1),S+=A.byteLength,k.push(A);if(S){let A;if(J.format===RZ.GLB)A=x2;else A=W.bufferURIGenerator.createURI(w,"bin"),N.uri=A;N.byteLength=S,W.assignResourceURI(A,o0.concat(k),!0)}$.buffers.push(N),W.bufferIndexMap.set(w,O)}),Y.listAccessors().find((w)=>!w.getBuffer()))K.warn("Skipped writing one or more Accessors: no Buffer assigned.");z.filter((w)=>w.prewriteTypes.includes(a.MATERIAL)).forEach((w)=>w.prewrite(W,a.MATERIAL)),$.materials=Y.listMaterials().map((w,O)=>{let N=W.createPropertyDef(w);if(w.getAlphaMode()!==L7.AlphaMode.OPAQUE)N.alphaMode=w.getAlphaMode();if(w.getAlphaMode()===L7.AlphaMode.MASK)N.alphaCutoff=w.getAlphaCutoff();if(w.getDoubleSided())N.doubleSided=!0;if(N.pbrMetallicRoughness={},!i0.eq(w.getBaseColorFactor(),[1,1,1,1]))N.pbrMetallicRoughness.baseColorFactor=w.getBaseColorFactor();if(!i0.eq(w.getEmissiveFactor(),[0,0,0]))N.emissiveFactor=w.getEmissiveFactor();if(w.getRoughnessFactor()!==1)N.pbrMetallicRoughness.roughnessFactor=w.getRoughnessFactor();if(w.getMetallicFactor()!==1)N.pbrMetallicRoughness.metallicFactor=w.getMetallicFactor();if(w.getBaseColorTexture()){let R=w.getBaseColorTexture(),j=w.getBaseColorTextureInfo();N.pbrMetallicRoughness.baseColorTexture=W.createTextureInfoDef(R,j)}if(w.getEmissiveTexture()){let R=w.getEmissiveTexture(),j=w.getEmissiveTextureInfo();N.emissiveTexture=W.createTextureInfoDef(R,j)}if(w.getNormalTexture()){let R=w.getNormalTexture(),j=w.getNormalTextureInfo(),P=W.createTextureInfoDef(R,j);if(w.getNormalScale()!==1)P.scale=w.getNormalScale();N.normalTexture=P}if(w.getOcclusionTexture()){let R=w.getOcclusionTexture(),j=w.getOcclusionTextureInfo(),P=W.createTextureInfoDef(R,j);if(w.getOcclusionStrength()!==1)P.strength=w.getOcclusionStrength();N.occlusionTexture=P}if(w.getMetallicRoughnessTexture()){let R=w.getMetallicRoughnessTexture(),j=w.getMetallicRoughnessTextureInfo();N.pbrMetallicRoughness.metallicRoughnessTexture=W.createTextureInfoDef(R,j)}return W.materialIndexMap.set(w,O),N}),z.filter((w)=>w.prewriteTypes.includes(a.MESH)).forEach((w)=>w.prewrite(W,a.MESH)),$.meshes=Y.listMeshes().map((w,O)=>{let N=W.createPropertyDef(w),R=null;if(N.primitives=w.listPrimitives().map((j)=>{let P={attributes:{}};P.mode=j.getMode();let D=j.getMaterial();if(D)P.material=W.materialIndexMap.get(D);if(Object.keys(j.getExtras()).length)P.extras=j.getExtras();let C=j.getIndices();if(C)P.indices=W.accessorIndexMap.get(C);for(let T of j.listSemantics())P.attributes[T]=W.accessorIndexMap.get(j.getAttribute(T));for(let T of j.listTargets()){let k={};for(let x of T.listSemantics())k[x]=W.accessorIndexMap.get(T.getAttribute(x));P.targets=P.targets||[],P.targets.push(k)}if(j.listTargets().length&&!R)R=j.listTargets().map((T)=>T.getName());return P}),w.getWeights().length)N.weights=w.getWeights();if(R)N.extras=N.extras||{},N.extras.targetNames=R;return W.meshIndexMap.set(w,O),N}),$.cameras=Y.listCameras().map((w,O)=>{let N=W.createPropertyDef(w);if(N.type=w.getType(),N.type===IY.Type.PERSPECTIVE){N.perspective={znear:w.getZNear(),zfar:w.getZFar(),yfov:w.getYFov()};let R=w.getAspectRatio();if(R!==null)N.perspective.aspectRatio=R}else N.orthographic={znear:w.getZNear(),zfar:w.getZFar(),xmag:w.getXMag(),ymag:w.getYMag()};return W.cameraIndexMap.set(w,O),N}),$.nodes=Y.listNodes().map((w,O)=>{let N=W.createPropertyDef(w);if(!i0.eq(w.getTranslation(),[0,0,0]))N.translation=w.getTranslation();if(!i0.eq(w.getRotation(),[0,0,0,1]))N.rotation=w.getRotation();if(!i0.eq(w.getScale(),[1,1,1]))N.scale=w.getScale();if(w.getWeights().length)N.weights=w.getWeights();return W.nodeIndexMap.set(w,O),N}),$.skins=Y.listSkins().map((w,O)=>{let N=W.createPropertyDef(w),R=w.getInverseBindMatrices();if(R)N.inverseBindMatrices=W.accessorIndexMap.get(R);let j=w.getSkeleton();if(j)N.skeleton=W.nodeIndexMap.get(j);return N.joints=w.listJoints().map((P)=>W.nodeIndexMap.get(P)),W.skinIndexMap.set(w,O),N}),Y.listNodes().forEach((w,O)=>{let N=$.nodes[O],R=w.getMesh();if(R)N.mesh=W.meshIndexMap.get(R);let j=w.getCamera();if(j)N.camera=W.cameraIndexMap.get(j);let P=w.getSkin();if(P)N.skin=W.skinIndexMap.get(P);if(w.listChildren().length>0)N.children=w.listChildren().map((D)=>W.nodeIndexMap.get(D))}),$.animations=Y.listAnimations().map((w,O)=>{let N=W.createPropertyDef(w),R=new Map;return N.samplers=w.listSamplers().map((j,P)=>{let D=W.createPropertyDef(j);return D.input=W.accessorIndexMap.get(j.getInput()),D.output=W.accessorIndexMap.get(j.getOutput()),D.interpolation=j.getInterpolation(),R.set(j,P),D}),N.channels=w.listChannels().map((j)=>{let P=W.createPropertyDef(j);return P.sampler=R.get(j.getSampler()),P.target={node:W.nodeIndexMap.get(j.getTargetNode()),path:j.getTargetPath()},P}),W.animationIndexMap.set(w,O),N}),$.scenes=Y.listScenes().map((w,O)=>{let N=W.createPropertyDef(w);return N.nodes=w.listChildren().map((R)=>W.nodeIndexMap.get(R)),W.sceneIndexMap.set(w,O),N});let B=Y.getDefaultScene();if(B)$.scene=Y.listScenes().indexOf(B);return $.extensionsUsed=z.map((w)=>w.extensionName),$.extensionsRequired=H.map((w)=>w.extensionName),z.forEach((w)=>w.write(W)),vU1($),Q}}function vU1(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 b2;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(b2||(b2={}));class ji{constructor(){this._logger=P5.DEFAULT_INSTANCE,this._extensions=new Set,this._dependencies={},this._vertexLayout=A2.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=Gi(J)?this._binaryToJSON(J):{json:JSON.parse(o0.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),Li.read(Z,{extensions:Array.from(this._extensions),dependencies:this._dependencies,logger:this._logger})}async binaryToJSON(Z){let J=this._binaryToJSON(o0.assertView(Z));this._readResourcesInternal(J);let X=J.json;if(X.buffers&&X.buffers.some((Y)=>SU1(J,Y)))throw new Error("Cannot resolve external buffers with binaryToJSON().");else if(X.images&&X.images.some((Y)=>_U1(J,Y)))throw new Error("Cannot resolve external images with binaryToJSON().");return J}async readBinary(Z){return this.readJSON(await this.binaryToJSON(o0.assertView(Z)))}async writeJSON(Z,J={}){if(J.format===RZ.GLB&&Z.getRoot().listBuffers().length>1)throw new Error("GLB must have 0\u20131 buffers.");return Oi.write(Z,{format:J.format||RZ.GLTF,basename:J.basename||"",logger:this._logger,vertexLayout:this._vertexLayout,dependencies:a6({},this._dependencies),extensions:Array.from(this._extensions)})}async writeBinary(Z){let{json:J,resources:X}=await this.writeJSON(Z,{format:RZ.GLB}),Y=new Uint32Array([1179937895,2,12]),$=JSON.stringify(J),Q=o0.pad(o0.encodeText($),32),W=o0.toView(new Uint32Array([Q.byteLength,1313821514])),K=o0.concat([W,Q]);Y[Y.length-1]+=K.byteLength;let G=Object.values(X)[0];if(!G||!G.byteLength)return o0.concat([o0.toView(Y),K]);let z=o0.pad(G,0),H=o0.toView(new Uint32Array([z.byteLength,5130562])),V=o0.concat([H,z]);return Y[Y.length-1]+=V.byteLength,o0.concat([o0.toView(Y),K,V])}async _readResourcesExternal(Z,J){var X=this;let Y=Z.json.images||[],$=Z.json.buffers||[],Q=[...Y,...$].map(async function(W){let K=W.uri;if(!K||K.match(/data:/))return Promise.resolve();Z.resources[K]=await X.readURI(X.resolve(J,K),"view"),X.lastReadBytes+=Z.resources[K].byteLength});await Promise.all(Q)}_readResourcesInternal(Z){function J($){if(!$.uri)return;if($.uri in Z.resources){o0.assertView(Z.resources[$.uri]);return}if($.uri.match(/data:/)){let Q=`__${Ui()}.${DZ.extension($.uri)}`;Z.resources[Q]=o0.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:a6({},Z.json),resources:a6({},Z.resources)},J)Z.json.images=J.map((Y)=>a6({},Y));if(X)Z.json.buffers=X.map((Y)=>a6({},Y));return Z}_binaryToJSON(Z){if(!Gi(Z))throw new Error("Invalid glTF 2.0 binary.");let J=new Uint32Array(Z.buffer,Z.byteOffset+12,2);if(J[1]!==b2.JSON)throw new Error("Missing required GLB JSON chunk.");let X=20,Y=J[0],$=o0.decodeText(o0.toView(Z,X,Y)),Q=JSON.parse($),W=X+Y;if(Z.byteLength<=W)return{json:Q,resources:{}};let K=new Uint32Array(Z.buffer,Z.byteOffset+W,2);if(K[1]!==b2.BIN)return{json:Q,resources:{}};let G=K[0],z=o0.toView(Z,W+8,G);return{json:Q,resources:{[x2]:z}}}}function SU1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)}function _U1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)&&J.bufferView===void 0}function Gi(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 QC extends ji{constructor(Z=null,J=S9.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(),S9.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(S9.isAbsoluteURL(Z)||S9.isAbsoluteURL(J))return S9.resolve(Z,J);return this._path.resolve(Z,decodeURIComponent(J))}dirname(Z){if(S9.isAbsoluteURL(Z))return S9.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:RZ.GLTF,basename:DZ.basename(Z)}),{_fs:Q,_path:W}=this,K=W.dirname(Z),G=JSON.stringify(Y,null,2);await Q.writeFile(Z,G),this.lastWriteBytes+=G.length;for(let z of xU1(Object.keys($),10))await Promise.all(z.map(async function(H){if(S9.isAbsoluteURL(H)){if(S9.extension(H)==="bin")throw new Error(`Cannot write buffer to path "${H}".`);return}let V=W.join(K,decodeURIComponent(H));await Q.mkdir(W.dirname(V),{recursive:!0}),await Q.writeFile(V,$[H]),X.lastWriteBytes+=$[H].byteLength}))}async _writeGLB(Z,J){let X=await this.writeBinary(J);await this._fs.writeFile(Z,X),this.lastWriteBytes=X.byteLength}}function xU1(Z,J){let X=[];for(let Y=0,$=Z.length;Y<$;Y+=J){let Q=[];for(let W=0;W<J&&Y+W<$;W++)Q.push(Z[Y+W]);X.push(Q)}return X}var Bs=e(WC(),1),Ls=e(ea(),1),PO1=e(ws(),1);async function CO1(Z,J){if(!(Z instanceof Uint8Array))throw new Error("[ndarray-pixels] Input must be Uint8Array or Buffer.");let{data:X,info:Y}=await Ls.default(Z).ensureAlpha().raw().toBuffer({resolveWithObject:!0});return Bs.default(new Uint8Array(X),[Y.width,Y.height,4],[4,4*Y.width|0,1],0)}async function Os(Z,J){return CO1(Z)}var TO1="v4.1.3",yC="@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 js;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(js||(js={}));var J9;(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"})(J9||(J9={}));var X9;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(X9||(X9={}));var _C;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(_C||(_C={}));var xC=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 kO1(){var Z=new xC(3);if(xC!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function SC(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function EO1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=X[3]*Y+X[7]*$+X[11]*Q+X[15];return W=W||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/W,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/W,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/W,Z}(function(){var Z=kO1();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}})();function Ds(Z){let J=Ps(),X=Z.propertyType===s.NODE?[Z]:Z.listChildren();for(let Y of X)Y.traverse(($)=>{let Q=$.getMesh();if(!Q)return;let W=IO1(Q,$.getWorldMatrix());if(W.min.every(isFinite)&&W.max.every(isFinite))AC(W.min,J),AC(W.max,J)});return J}function IO1(Z,J){let X=Ps();for(let Y of Z.listPrimitives()){let $=Y.getAttribute("POSITION"),Q=Y.getIndices();if(!$)continue;let W=[0,0,0],K=[0,0,0];for(let G=0,z=Q?Q.getCount():$.getCount();G<z;G++){let H=Q?Q.getScalar(G):G;W=$.getElement(H,W),K=EO1(K,W,J),AC(K,X)}}return X}function AC(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 Ps(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class v6{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 Cs{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),vO1(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 ww{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(v6.decodeText(Z.slice(12,16))===ww.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}}ww.PNG_FRIED_CHUNK_NAME="CgBI";class E4{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}`}}E4.impls={"image/jpeg":new Cs,"image/png":new ww};function vO1(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 oG{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 E4.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 Ms(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function hY(Z){if(Ms(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let X=J.prototype;if(Ms(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}var hC,fC;(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"})(fC||(fC={}));class D7{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=D7.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=D7.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=D7.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=D7.Verbosity.ERROR)console.error(Z)}}hC=D7;D7.Verbosity=fC;D7.DEFAULT_INSTANCE=new hC(hC.Verbosity.INFO);function SO1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],W=Z[5],K=Z[6],G=Z[7],z=Z[8],H=Z[9],V=Z[10],q=Z[11],F=Z[12],U=Z[13],B=Z[14],w=Z[15],O=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,j=X*K-Y*W,P=X*G-$*W,D=Y*G-$*K,C=z*U-H*F,T=z*B-V*F,k=z*w-q*F,x=H*B-V*U,S=H*w-q*U,A=V*w-q*B;return O*A-N*S+R*x+j*k-P*T+D*C}function _O1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=J[9],F=J[10],U=J[11],B=J[12],w=J[13],O=J[14],N=J[15],R=X[0],j=X[1],P=X[2],D=X[3];return Z[0]=R*Y+j*K+P*V+D*B,Z[1]=R*$+j*G+P*q+D*w,Z[2]=R*Q+j*z+P*F+D*O,Z[3]=R*W+j*H+P*U+D*N,R=X[4],j=X[5],P=X[6],D=X[7],Z[4]=R*Y+j*K+P*V+D*B,Z[5]=R*$+j*G+P*q+D*w,Z[6]=R*Q+j*z+P*F+D*O,Z[7]=R*W+j*H+P*U+D*N,R=X[8],j=X[9],P=X[10],D=X[11],Z[8]=R*Y+j*K+P*V+D*B,Z[9]=R*$+j*G+P*q+D*w,Z[10]=R*Q+j*z+P*F+D*O,Z[11]=R*W+j*H+P*U+D*N,R=X[12],j=X[13],P=X[14],D=X[15],Z[12]=R*Y+j*K+P*V+D*B,Z[13]=R*$+j*G+P*q+D*w,Z[14]=R*Q+j*z+P*F+D*O,Z[15]=R*W+j*H+P*U+D*N,Z}function xO1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[4],W=J[5],K=J[6],G=J[8],z=J[9],H=J[10];return Z[0]=Math.hypot(X,Y,$),Z[1]=Math.hypot(Q,W,K),Z[2]=Math.hypot(G,z,H),Z}function AO1(Z,J){var X=new xC(3);xO1(X,J);var Y=1/X[0],$=1/X[1],Q=1/X[2],W=J[0]*Y,K=J[1]*$,G=J[2]*Q,z=J[4]*Y,H=J[5]*$,V=J[6]*Q,q=J[8]*Y,F=J[9]*$,U=J[10]*Q,B=W+H+U,w=0;if(B>0)w=Math.sqrt(B+1)*2,Z[3]=0.25*w,Z[0]=(V-F)/w,Z[1]=(q-G)/w,Z[2]=(K-z)/w;else if(W>H&&W>U)w=Math.sqrt(1+W-H-U)*2,Z[3]=(V-F)/w,Z[0]=0.25*w,Z[1]=(K+z)/w,Z[2]=(q+G)/w;else if(H>U)w=Math.sqrt(1+H-W-U)*2,Z[3]=(q-G)/w,Z[0]=(K+z)/w,Z[1]=0.25*w,Z[2]=(V+F)/w;else w=Math.sqrt(1+U-W-H)*2,Z[3]=(K-z)/w,Z[0]=(q+G)/w,Z[1]=(V+F)/w,Z[2]=0.25*w;return Z}class F8{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(F8.clamp(Z,0,1)*65535);case 5121:return Math.round(F8.clamp(Z,0,1)*255);case 5122:return Math.round(F8.clamp(Z,-1,1)*32767);case 5120:return Math.round(F8.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,X,Y){let $=SC([Z[0],Z[1],Z[2]]),Q=SC([Z[4],Z[5],Z[6]]),W=SC([Z[8],Z[9],Z[10]]);if(SO1(Z)<0)$=-$;J[0]=Z[12],J[1]=Z[13],J[2]=Z[14];let G=Z.slice(),z=1/$,H=1/Q,V=1/W;G[0]*=z,G[1]*=z,G[2]*=z,G[4]*=H,G[5]*=H,G[6]*=H,G[8]*=V,G[9]*=V,G[10]*=V,AO1(X,G),Y[0]=$,Y[1]=Q,Y[2]=W}static compose(Z,J,X,Y){let $=Y,Q=J[0],W=J[1],K=J[2],G=J[3],z=Q+Q,H=W+W,V=K+K,q=Q*z,F=Q*H,U=Q*V,B=W*H,w=W*V,O=K*V,N=G*z,R=G*H,j=G*V,P=X[0],D=X[1],C=X[2];return $[0]=(1-(B+O))*P,$[1]=(F+j)*P,$[2]=(U-R)*P,$[3]=0,$[4]=(F-j)*D,$[5]=(1-(q+O))*D,$[6]=(w+N)*D,$[7]=0,$[8]=(U+R)*C,$[9]=(w-N)*C,$[10]=(1-(q+B))*C,$[11]=0,$[12]=Z[0],$[13]=Z[1],$[14]=Z[2],$[15]=1,$}}function hO1(Z,J){if(!!Z!==!!J)return!1;let X=Z.getChild(),Y=J.getChild();return X===Y||X.equals(Y)}function fO1(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[$],W=Y[$];if(Q.getChild()===W.getChild())continue;if(!Q.getChild().equals(W.getChild()))return!1}return!0}function bO1(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($),W=J.get($);if(!!Q!==!!W)return!1;let K=Q.getChild(),G=W.getChild();if(K===G)continue;if(!K.equals(G))return!1}return!0}function Ts(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 ks(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!hY(Z)||!hY(J))return Z===J;let X=Z,Y=J,$=0,Q=0,W;for(W in X)$++;for(W in Y)Q++;if($!==Q)return!1;for(W in X){let K=X[W],G=Y[W];if(qw(K)&&qw(G)){if(!Ts(K,G))return!1}else if(hY(K)&&hY(G)){if(!ks(K,G))return!1}else if(K!==G)return!1}return!0}function qw(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var Rs="https://null.example";class gC{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return oG.basename(new URL(Z,Rs).pathname)}static extension(Z){return oG.extension(new URL(Z,Rs).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)}}gC.DEFAULT_INIT={};gC.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var hJ=(Z)=>Z,yO1=new Set;class Bw extends VW{constructor(Z,J=""){super(Z);this[y0].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,hJ)}copy(Z,J=hJ){for(let X in this[y0]){let Y=this[y0][X];if(Y instanceof N5){if(!this[T4].has(X))Y.dispose()}else if(Y instanceof k6||Y instanceof E0)for(let $ of Y.values())$.dispose();else if(Y instanceof $8)for(let $ of Y.values())$.dispose()}for(let X in Z[y0]){let Y=this[y0][X],$=Z[y0][X];if($ instanceof N5)if(this[T4].has(X))Y.getChild().copy(J($.getChild()),J);else this.setRef(X,J($.getChild()),$.getAttributes());else if($ instanceof E0||$ instanceof k6)for(let Q of $.values())this.addRef(X,J(Q.getChild()),Q.getAttributes());else if($ instanceof $8)for(let Q of $.keys()){let W=$.get(Q);this.setRefMap(X,Q,J(W.getChild()),W.getAttributes())}else if(hY($))this[y0][X]=JSON.parse(JSON.stringify($));else if(Array.isArray($)||$ instanceof ArrayBuffer||ArrayBuffer.isView($))this[y0][X]=$.slice();else this[y0][X]=$}return this}equals(Z,J=yO1){if(this===Z)return!0;if(this.propertyType!==Z.propertyType)return!1;for(let X in this[y0]){if(J.has(X))continue;let Y=this[y0][X],$=Z[y0][X];if(Y instanceof N5||$ instanceof N5){if(!hO1(Y,$))return!1}else if(Y instanceof E0||$ instanceof E0||Y instanceof k6||$ instanceof k6){if(!fO1(Y,$))return!1}else if(Y instanceof $8||$ instanceof $8){if(!bO1(Y,$))return!1}else if(hY(Y)||hY($)){if(!ks(Y,$))return!1}else if(qw(Y)||qw($)){if(!Ts(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 S6 extends Bw{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new $8})}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 k0 extends S6{init(){this.propertyType=s.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:k0.Type.SCALAR,componentType:k0.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(Z){switch(Z){case k0.Type.SCALAR:return 1;case k0.Type.VEC2:return 2;case k0.Type.VEC3:return 3;case k0.Type.VEC4:return 4;case k0.Type.MAT2:return 4;case k0.Type.MAT3:return 9;case k0.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+Z)}}static getComponentSize(Z){switch(Z){case k0.ComponentType.BYTE:return 1;case k0.ComponentType.UNSIGNED_BYTE:return 1;case k0.ComponentType.SHORT:return 2;case k0.ComponentType.UNSIGNED_SHORT:return 2;case k0.ComponentType.UNSIGNED_INT:return 4;case k0.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[$]=F8.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 W=J[$+Q];if(Number.isFinite(W))Z[Q]=Math.min(Z[Q],W)}return Z}getMaxNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMax(Z),J)for(let $=0;$<X;$++)Z[$]=F8.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 W=J[$+Q];if(Number.isFinite(W))Z[Q]=Math.max(Z[Q],W)}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 k0.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 F8.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]=F8.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 W=0;W<Y;W++)if(X)J[W]=F8.decodeNormalizedInt(Q[Z*Y+W],$);else J[W]=Q[Z*Y+W];return J}setElement(Z,J){let X=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();for(let W=0;W<Y;W++)if(X)Q[Z*Y+W]=F8.encodeNormalizedInt(J[W],$);else Q[Z*Y+W]=J[W];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?gO1(Z):k0.ComponentType.FLOAT),this.set("array",Z),this}getByteLength(){let Z=this.get("array");return Z?Z.byteLength:0}}k0.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};k0.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function gO1(Z){switch(Z.constructor){case Float32Array:return k0.ComponentType.FLOAT;case Uint32Array:return k0.ComponentType.UNSIGNED_INT;case Uint16Array:return k0.ComponentType.UNSIGNED_SHORT;case Uint8Array:return k0.ComponentType.UNSIGNED_BYTE;case Int16Array:return k0.ComponentType.SHORT;case Int8Array:return k0.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class mC extends S6{init(){this.propertyType=s.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new E0,samplers:new E0})}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 tG extends S6{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)}}tG.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class PW extends S6{init(){this.propertyType=s.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:PW.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:J9.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:J9.OTHER})}}PW.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class uC extends S6{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 eG extends S6{init(){this.propertyType=s.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:eG.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)}}eG.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class t1 extends Bw{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}t1.EXTENSION_NAME=void 0;class I1 extends S6{init(){this.propertyType=s.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:I1.WrapMode.REPEAT,wrapT:I1.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)}}I1.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};I1.MagFilter={NEAREST:9728,LINEAR:9729};I1.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:zw,G:Hw,B:Vw,A:mO1}=X9;class Zz extends S6{init(){this.propertyType=s.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:Zz.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new I1(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new I1(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new I1(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new I1(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new I1(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:zw|Hw|Vw|mO1,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:zw|Hw|Vw,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:zw|Hw|Vw})}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:zw})}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:Hw|Vw})}}Zz.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class dC extends S6{init(){this.propertyType=s.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new E0})}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 cC extends S6{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 E0})}copy(Z,J=hJ){if(J===hJ)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 F8.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 F8.decompose(Z,J,X,Y),this.set("translation",J).set("rotation",X).set("scale",Y)}getWorldTranslation(){let Z=[0,0,0];return F8.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return F8.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return F8.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())_O1(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 fJ extends S6{init(){this.propertyType=s.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:fJ.Mode.TRIANGLES,material:null,indices:null,attributes:new $8,targets:new E0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:J9.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:J9.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)}}fJ.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class Es extends Bw{init(){this.propertyType=s.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new $8})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:J9.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function Fw(){return Fw=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},Fw.apply(null,arguments)}class lC extends S6{init(){this.propertyType=s.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new E0})}copy(Z,J=hJ){if(J===hJ)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 pC extends S6{init(){this.propertyType=s.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new E0})}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:J9.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class iC extends S6{init(){this.propertyType=s.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||E4.extensionToMimeType(oG.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=E4.extensionToMimeType(oG.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",v6.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return E4.getSize(Z,this.getMimeType())}}class Lw extends S6{init(){this.propertyType=s.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${TO1}`,version:"2.0"},defaultScene:null,accessors:new E0,animations:new E0,buffers:new E0,cameras:new E0,materials:new E0,meshes:new E0,nodes:new E0,scenes:new E0,skins:new E0,textures:new E0})}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=hJ){if(J===hJ)throw new Error("Root cannot be copied.");this.set("asset",Fw({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(Fw({},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 lC)this.addRef("scenes",Z);else if(Z instanceof cC)this.addRef("nodes",Z);else if(Z instanceof eG)this.addRef("cameras",Z);else if(Z instanceof pC)this.addRef("skins",Z);else if(Z instanceof dC)this.addRef("meshes",Z);else if(Z instanceof Zz)this.addRef("materials",Z);else if(Z instanceof iC)this.addRef("textures",Z);else if(Z instanceof mC)this.addRef("animations",Z);else if(Z instanceof k0)this.addRef("accessors",Z);else if(Z instanceof uC)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 Uw{static fromGraph(Z){return Uw._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new HW,this._root=new Lw(this._graph),this._logger=D7.DEFAULT_INSTANCE,Uw._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 lC(this._graph,Z)}createNode(Z=""){return new cC(this._graph,Z)}createCamera(Z=""){return new eG(this._graph,Z)}createSkin(Z=""){return new pC(this._graph,Z)}createMesh(Z=""){return new dC(this._graph,Z)}createPrimitive(){return new fJ(this._graph)}createPrimitiveTarget(Z=""){return new Es(this._graph,Z)}createMaterial(Z=""){return new Zz(this._graph,Z)}createTexture(Z=""){return new iC(this._graph,Z)}createAnimation(Z=""){return new mC(this._graph,Z)}createAnimationChannel(Z=""){return new tG(this._graph,Z)}createAnimationSampler(Z=""){return new PW(this._graph,Z)}createAccessor(Z="",J=null){if(!J)J=this.getRoot().listBuffers()[0];return new k0(this._graph,Z).setBuffer(J)}createBuffer(Z=""){return new uC(this._graph,Z)}}Uw._GRAPH_DOCUMENTS=new WeakMap;class _1{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 t1&&$.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}}_1.EXTENSION_NAME=void 0;var IU6={logger:D7.DEFAULT_INSTANCE,extensions:[],dependencies:{}},vU6=new Set([s.BUFFER,s.TEXTURE,s.MATERIAL,s.MESH,s.PRIMITIVE,s.NODE,s.SCENE]);var rG;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(rG||(rG={}));class bJ{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 bC($>1,()=>X.basename||"buffer"),this.imageURIGenerator=new bC(Q>1,(W)=>uO1(Z,W)||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 W={index:this.textureDefIndexMap.get(Q)};if(J.getTexCoord()!==0)W.texCoord=J.getTexCoord();if(Object.keys(J.getExtras()).length>0)W.extras=J.getExtras();return this.textureInfoDefMap.set(J,W),W}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===_C.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=E4.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 J9.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 J9.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}}bJ.BufferViewTarget=rG;bJ.BufferViewUsage=J9;bJ.USAGE_TO_TARGET={[J9.ARRAY_BUFFER]:rG.ARRAY_BUFFER,[J9.ELEMENT_ARRAY_BUFFER]:rG.ELEMENT_ARRAY_BUFFER};class bC{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 uO1(Z,J){let X=Z.getGraph().listParentEdges(J).find((Y)=>Y.getParent()!==Z.getRoot());return X?X.getName().replace(/texture$/i,""):""}var{UNSIGNED_INT:SU6,UNSIGNED_SHORT:_U6,UNSIGNED_BYTE:xU6}=k0.ComponentType,AU6=new Set([s.ACCESSOR,s.BUFFER,s.MATERIAL,s.MESH]);var Ns;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(Ns||(Ns={}));var vs=163,Ss=166;function dO1(){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 CW{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 bU6=new Uint8Array([0]),t6=[171,75,84,88,32,50,48,187,13,10,26,10];function Is(Z){return new TextDecoder().decode(Z)}function Ow(Z){let J=new Uint8Array(Z.buffer,Z.byteOffset,t6.length);if(J[0]!==t6[0]||J[1]!==t6[1]||J[2]!==t6[2]||J[3]!==t6[3]||J[4]!==t6[4]||J[5]!==t6[5]||J[6]!==t6[6]||J[7]!==t6[7]||J[8]!==t6[8]||J[9]!==t6[9]||J[10]!==t6[10]||J[11]!==t6[11])throw new Error("Missing KTX 2.0 identifier.");let X=dO1(),Y=17*Uint32Array.BYTES_PER_ELEMENT,$=new CW(Z,t6.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 W=$._nextUint32(),K=$._nextUint32(),G=$._nextUint32(),z=$._nextUint32(),H=$._nextUint64(),V=$._nextUint64(),q=Q*3*8,F=new CW(Z,t6.length+Y,q,!0);for(let U6=0;U6<Q;U6++)X.levels.push({levelData:new Uint8Array(Z.buffer,Z.byteOffset+F._nextUint64(),F._nextUint64()),uncompressedByteLength:F._nextUint64()});let U=new CW(Z,W,K,!0);U._skip(4);let B=U._nextUint16(),w=U._nextUint16(),O=U._nextUint16(),N=U._nextUint16(),R=U._nextUint8(),j=U._nextUint8(),P=U._nextUint8(),D=U._nextUint8(),C=[U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8()],T=[U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8(),U._nextUint8()],x={vendorId:B,descriptorType:w,versionNumber:O,colorModel:R,colorPrimaries:j,transferFunction:P,flags:D,texelBlockDimension:C,bytesPlane:T,samples:[]},S=6,A=4,I=(N/4-S)/A;for(let U6=0;U6<I;U6++){let GZ={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(GZ.channelType&64)GZ.sampleLower=U._nextInt32(),GZ.sampleUpper=U._nextInt32();else GZ.sampleLower=U._nextUint32(),GZ.sampleUpper=U._nextUint32();x.samples[U6]=GZ}X.dataFormatDescriptor.length=0,X.dataFormatDescriptor.push(x);let v=new CW(Z,G,z,!0);while(v._offset<z){let U6=v._nextUint32(),GZ=v._scan(U6),BF=Is(GZ);if(X.keyValue[BF]=v._nextUint8Array(U6-GZ.byteLength-1),BF.match(/^ktx/i)){let Yg=Is(X.keyValue[BF]);X.keyValue[BF]=Yg.substring(0,Yg.lastIndexOf("\x00"))}let pQ1=U6%4?4-U6%4:0;v._skip(pQ1)}if(V<=0)return X;let b=new CW(Z,H,V,!0),m=b._nextUint16(),n=b._nextUint16(),o=b._nextUint32(),Q0=b._nextUint32(),K0=b._nextUint32(),_0=b._nextUint32(),x0=[];for(let U6=0;U6<Q;U6++)x0.push({imageFlags:b._nextUint32(),rgbSliceByteOffset:b._nextUint32(),rgbSliceByteLength:b._nextUint32(),alphaSliceByteOffset:b._nextUint32(),alphaSliceByteLength:b._nextUint32()});let r0=H+b._offset,f8=r0+o,X8=f8+Q0,K7=X8+K0,w4=new Uint8Array(Z.buffer,Z.byteOffset+r0,o),bQ=new Uint8Array(Z.buffer,Z.byteOffset+f8,Q0),yQ=new Uint8Array(Z.buffer,Z.byteOffset+X8,K0),VY=new Uint8Array(Z.buffer,Z.byteOffset+K7,_0);return X.globalData={endpointCount:m,selectorCount:n,imageDescs:x0,endpointsData:w4,selectorsData:bQ,tablesData:yQ,extendedData:VY},X}var rC="EXT_mesh_gpu_instancing",aC="EXT_meshopt_compression",cO1="EXT_texture_webp",lO1="EXT_texture_avif",ps="KHR_draco_mesh_compression",tC="KHR_lights_punctual",eC="KHR_materials_anisotropy",ZT="KHR_materials_clearcoat",JT="KHR_materials_diffuse_transmission",XT="KHR_materials_dispersion",YT="KHR_materials_emissive_strength",$T="KHR_materials_ior",QT="KHR_materials_iridescence",WT="KHR_materials_pbrSpecularGlossiness",KT="KHR_materials_sheen",GT="KHR_materials_specular",zT="KHR_materials_transmission",HT="KHR_materials_unlit",VT="KHR_materials_volume",oY="KHR_materials_variants",pO1="KHR_mesh_quantization",iO1="KHR_texture_basisu",qT="KHR_texture_transform",jw="KHR_xmp_json_ld",sC="INSTANCE_ATTRIBUTE";class FT extends t1{init(){this.extensionName=rC,this.propertyType="InstancedMesh",this.parentTypes=[s.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new $8})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:sC})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}FT.EXTENSION_NAME=rC;var fY=rC;class Nw extends _1{constructor(...Z){super(...Z);this.extensionName=fY,this.provideTypes=[s.NODE],this.prewriteTypes=[s.ACCESSOR]}createInstancedMesh(){return new FT(this.document.getGraph())}read(Z){return(Z.jsonDoc.json.nodes||[]).forEach((Y,$)=>{if(!Y.extensions||!Y.extensions[fY])return;let Q=Y.extensions[fY],W=this.createInstancedMesh();for(let K in Q.attributes)W.setAttribute(K,Z.accessors[Q.attributes[K]]);Z.nodes[$].setExtension(fY,W)}),this}prewrite(Z){Z.accessorUsageGroupedByParent.add(sC);for(let J of this.properties)for(let X of J.listAttributes())Z.addAccessorToUsageGroup(X,sC);return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listNodes().forEach((X)=>{let Y=X.getExtension(fY);if(Y){let $=Z.nodeIndexMap.get(X),Q=J.json.nodes[$],W={attributes:{}};Y.listSemantics().forEach((K)=>{let G=Y.getAttribute(K);W.attributes[K]=Z.accessorIndexMap.get(G)}),Q.extensions=Q.extensions||{},Q.extensions[fY]=W}}),this}}Nw.EXTENSION_NAME=fY;function kZ(){return kZ=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},kZ.apply(null,arguments)}var $z;(function(Z){Z.QUANTIZE="quantize",Z.FILTER="filter"})($z||($z={}));var kW;(function(Z){Z.ATTRIBUTES="ATTRIBUTES",Z.TRIANGLES="TRIANGLES",Z.INDICES="INDICES"})(kW||(kW={}));var U8;(function(Z){Z.NONE="NONE",Z.OCTAHEDRAL="OCTAHEDRAL",Z.QUATERNION="QUATERNION",Z.EXPONENTIAL="EXPONENTIAL"})(U8||(U8={}));var{BYTE:nO1,SHORT:_s,FLOAT:aO1}=k0.ComponentType,{encodeNormalizedInt:xs,decodeNormalizedInt:oC}=F8;function sO1(Z,J,X,Y){let{filter:$,bits:Q}=Y,W={array:Z.getArray(),byteStride:Z.getElementSize()*Z.getComponentSize(),componentType:Z.getComponentType(),normalized:Z.getNormalized()};if(X!==kW.ATTRIBUTES)return W;if($!==U8.NONE){let K=Z.getNormalized()?oO1(Z):new Float32Array(W.array);switch($){case U8.EXPONENTIAL:W.byteStride=Z.getElementSize()*4,W.componentType=aO1,W.normalized=!1,W.array=J.encodeFilterExp(K,Z.getCount(),W.byteStride,Q);break;case U8.OCTAHEDRAL:W.byteStride=Q>8?8:4,W.componentType=Q>8?_s:nO1,W.normalized=!0,K=Z.getElementSize()===3?tO1(K):K,W.array=J.encodeFilterOct(K,Z.getCount(),W.byteStride,Q);break;case U8.QUATERNION:W.byteStride=8,W.componentType=_s,W.normalized=!0,W.array=J.encodeFilterQuat(K,Z.getCount(),W.byteStride,Q);break;default:throw new Error("Invalid filter.")}if(W.min=Z.getMin([]),W.max=Z.getMax([]),Z.getNormalized())W.min=W.min.map((G)=>oC(G,Z.getComponentType())),W.max=W.max.map((G)=>oC(G,Z.getComponentType()));if(W.normalized)W.min=W.min.map((G)=>xs(G,W.componentType)),W.max=W.max.map((G)=>xs(G,W.componentType))}else if(W.byteStride%4)W.array=rO1(W.array,Z.getElementSize()),W.byteStride=W.array.byteLength/Z.getCount();return W}function oO1(Z){let J=Z.getComponentType(),X=Z.getArray(),Y=new Float32Array(X.length);for(let $=0;$<X.length;$++)Y[$]=oC(X[$],J);return Y}function rO1(Z,J){let Y=v6.padNumber(Z.BYTES_PER_ELEMENT*J)/Z.BYTES_PER_ELEMENT,$=Z.length/J,Q=new Z.constructor($*Y);for(let W=0;W*J<Z.length;W++)for(let K=0;K<J;K++)Q[W*Y+K]=Z[W*J+K];return Q}function tO1(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 eO1(Z,J){if(J===bJ.BufferViewUsage.ELEMENT_ARRAY_BUFFER)return Z.listParents().some((Y)=>{return Y instanceof fJ&&Y.getMode()===fJ.Mode.TRIANGLES})?kW.TRIANGLES:kW.INDICES;return kW.ATTRIBUTES}function Zj1(Z,J){let X=J.getGraph().listParentEdges(Z).filter((Y)=>!(Y.getParent()instanceof Lw));for(let Y of X){let $=Y.getName(),Q=Y.getAttributes().key||"",W=Y.getParent().propertyType===s.PRIMITIVE_TARGET;if($==="indices")return{filter:U8.NONE};if($==="attributes"){if(Q==="POSITION")return{filter:U8.NONE};if(Q==="TEXCOORD_0")return{filter:U8.NONE};if(Q.startsWith("JOINTS_"))return{filter:U8.NONE};if(Q.startsWith("WEIGHTS_"))return{filter:U8.NONE};if(Q==="NORMAL"||Q==="TANGENT")return W?{filter:U8.NONE}:{filter:U8.OCTAHEDRAL,bits:8}}if($==="output"){let K=is(Z);if(K==="rotation")return{filter:U8.QUATERNION,bits:16};if(K==="translation")return{filter:U8.EXPONENTIAL,bits:12};if(K==="scale")return{filter:U8.EXPONENTIAL,bits:12};return{filter:U8.NONE}}if($==="input")return{filter:U8.NONE};if($==="inverseBindMatrices")return{filter:U8.NONE}}return{filter:U8.NONE}}function is(Z){for(let J of Z.listParents()){if(!(J instanceof PW))continue;for(let X of J.listParents()){if(!(X instanceof tG))continue;return X.getTargetPath()}}return null}function Jj1(Z){if(!Z.extensions||!Z.extensions[aC])return!1;return!!Z.extensions[aC].fallback}var e6=aC,As={method:$z.QUANTIZE};class Wz extends _1{constructor(...Z){super(...Z);this.extensionName=e6,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=As,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=kZ({},As,Z),this}preread(Z,J){if(!this._decoder){if(!this.isRequired())return this;throw new Error(`[${e6}] Please install extension dependency, "meshopt.decoder".`)}if(!this._decoder.supported){if(!this.isRequired())return this;throw new Error(`[${e6}]: 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[e6])return;let Q=Y.extensions[e6],W=Q.byteOffset||0,K=Q.byteLength||0,G=Q.count,z=Q.byteStride,H=new Uint8Array(G*z),V=J.json.buffers[Q.buffer],q=V.uri?J.resources[V.uri]:J.resources[yC],F=v6.toView(q,W,K);this._decoder.decodeGltfBuffer(H,G,z,F,Q.mode,Q.filter),Z.bufferViews[$]=H})}_prereadPrimitives(Z){let J=Z.jsonDoc;(J.json.bufferViews||[]).forEach((Y)=>{if(!Y.extensions||!Y.extensions[e6])return;let $=Y.extensions[e6],Q=Z.buffers[$.buffer],W=Z.buffers[Y.buffer],K=J.json.buffers[Y.buffer];if(Jj1(K))this._decoderFallbackBufferMap.set(W,Q)})}read(Z){if(!this.isRequired())return this;for(let[J,X]of this._decoderFallbackBufferMap){for(let Y of J.listParents())if(Y instanceof k0)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(),W=this.document.getRoot().listBuffers().indexOf(Q),K=1,G=new Map,z=(H)=>{for(let V of $.listParents(H)){if(V.propertyType===s.ROOT)continue;let q=G.get(H);if(q===void 0)G.set(H,q=K++);return q}return-1};this._encoderFallbackBuffer=Q,this._encoderBufferViews={},this._encoderBufferViewData={},this._encoderBufferViewAccessors={};for(let H of this.document.getRoot().listAccessors()){if(is(H)==="weights")continue;if(H.getSparse())continue;let V=Z.getAccessorUsage(H),q=Z.accessorUsageGroupedByParent.has(V)?z(H):null,F=eO1(H,V),U=Y.method===$z.FILTER?Zj1(H,this.document):{filter:U8.NONE},B=sO1(H,X,F,U),{array:w,byteStride:O}=B,N=H.getBuffer();if(!N)throw new Error(`${e6}: Missing buffer for accessor.`);let R=this.document.getRoot().listBuffers().indexOf(N),j=[V,q,F,U.filter,O,R].join(":"),P=this._encoderBufferViews[j],D=this._encoderBufferViewData[j],C=this._encoderBufferViewAccessors[j];if(!P||!D)C=this._encoderBufferViewAccessors[j]=[],D=this._encoderBufferViewData[j]=[],P=this._encoderBufferViews[j]={buffer:W,target:bJ.USAGE_TO_TARGET[V],byteOffset:0,byteLength:0,byteStride:V===bJ.BufferViewUsage.ARRAY_BUFFER?O:void 0,extensions:{[e6]:{buffer:R,byteOffset:0,byteLength:0,mode:F,filter:U.filter!==U8.NONE?U.filter:void 0,byteStride:O,count:0}}};let T=Z.createAccessorDef(H);if(T.componentType=B.componentType,T.normalized=B.normalized,T.byteOffset=P.byteLength,T.min&&B.min)T.min=B.min;if(T.max&&B.max)T.max=B.max;Z.accessorIndexMap.set(H,J.accessors.length),J.accessors.push(T),C.push(T),D.push(new Uint8Array(w.buffer,w.byteOffset,w.byteLength)),P.byteLength+=w.byteLength,P.extensions.EXT_meshopt_compression.count+=H.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[e6].buffer],W=Z.otherBufferViews.get(Q)||[],{count:K,byteStride:G,mode:z}=Y.extensions[e6],H=v6.concat($),V=J.encodeGltfBuffer(H,K,G,z),q=v6.pad(V);Y.extensions[e6].byteLength=V.byteLength,$.length=0,$.push(q),W.push(q),Z.otherBufferViews.set(Q,W)}}write(Z){let J=0;for(let Q in this._encoderBufferViews){let W=this._encoderBufferViews[Q],K=this._encoderBufferViewData[Q][0],G=Z.otherBufferViewsIndexMap.get(K),z=this._encoderBufferViewAccessors[Q];for(let F of z)F.bufferView=G;let H=Z.jsonDoc.json.bufferViews[G],V=H.byteOffset||0;Object.assign(H,W),H.byteOffset=J;let q=H.extensions[e6];q.byteOffset=V,J+=v6.padNumber(W.byteLength)}let X=this._encoderFallbackBuffer,Y=Z.bufferIndexMap.get(X),$=Z.jsonDoc.json.buffers[Y];return $.byteLength=J,$.extensions={[e6]:{fallback:!0}},X.dispose(),this}}Wz.EXTENSION_NAME=e6;Wz.EncoderMethod=$z;var Jz=lO1;class ns{match(Z){return Z.length>=12&&v6.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=hs(J,0);if(!X)return null;let Y=X.end;while(X=hs(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 Dw extends _1{constructor(...Z){super(...Z);this.extensionName=Jz,this.prereadTypes=[s.TEXTURE]}static register(){E4.registerFormat("image/avif",new ns)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((X)=>{if(X.extensions&&X.extensions[Jz])X.source=X.extensions[Jz].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[Jz]={source:Q.source},delete Q.source})}}),this}}Dw.EXTENSION_NAME=Jz;function hs(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:v6.decodeText(new Uint8Array(Z.buffer,Z.byteOffset+J+4,4)),start:J+8,end:J+X}}var Xz=cO1;class as{match(Z){return Z.length>=12&&Z[8]===87&&Z[9]===69&&Z[10]===66&&Z[11]===80}getSize(Z){let J=v6.decodeText(Z.slice(0,4)),X=v6.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=v6.decodeText(new Uint8Array([Y.getUint8($),Y.getUint8($+1),Y.getUint8($+2),Y.getUint8($+3)])),W=Y.getUint32($+4,!0);if(Q==="VP8 "){let K=Y.getInt16($+14,!0)&16383,G=Y.getInt16($+16,!0)&16383;return[K,G]}else if(Q==="VP8L"){let K=Y.getUint8($+9),G=Y.getUint8($+10),z=Y.getUint8($+11),H=Y.getUint8($+12),V=1+((G&63)<<8|K),q=1+((H&15)<<10|z<<2|(G&192)>>6);return[V,q]}$+=8+W+W%2}return null}getChannels(Z){return 4}}class Pw extends _1{constructor(...Z){super(...Z);this.extensionName=Xz,this.prereadTypes=[s.TEXTURE]}static register(){E4.registerFormat("image/webp",new as)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((X)=>{if(X.extensions&&X.extensions[Xz])X.source=X.extensions[Xz].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[Xz]={source:Q.source},delete Q.source})}}),this}}Pw.EXTENSION_NAME=Xz;var fs=ps,n8,ss,os;function Xj1(Z,J){let X=new n8.DecoderBuffer;try{if(X.Init(J,J.length),Z.GetEncodedGeometryType(X)!==n8.TRIANGULAR_MESH)throw new Error(`[${fs}] Unknown geometry type.`);let $=new n8.Mesh;if(!Z.DecodeBufferToMesh(X,$).ok()||$.ptr===0)throw new Error(`[${fs}] Decoding failure.`);return $}finally{n8.destroy(X)}}function Yj1(Z,J){let Y=J.num_faces()*3,$,Q;if(J.num_points()<=65534){let W=Y*Uint16Array.BYTES_PER_ELEMENT;$=n8._malloc(W),Z.GetTrianglesUInt16Array(J,W,$),Q=new Uint16Array(n8.HEAPU16.buffer,$,Y).slice()}else{let W=Y*Uint32Array.BYTES_PER_ELEMENT;$=n8._malloc(W),Z.GetTrianglesUInt32Array(J,W,$),Q=new Uint32Array(n8.HEAPU32.buffer,$,Y).slice()}return n8._free($),Q}function $j1(Z,J,X,Y){let $=os[Y.componentType],Q=ss[Y.componentType],W=X.num_components(),G=J.num_points()*W,z=G*Q.BYTES_PER_ELEMENT,H=n8._malloc(z);Z.GetAttributeDataArrayForAllPoints(J,X,$,z,H);let V=new Q(n8.HEAPF32.buffer,H,G).slice();return n8._free(H),V}function Qj1(Z){n8=Z,ss={[k0.ComponentType.FLOAT]:Float32Array,[k0.ComponentType.UNSIGNED_INT]:Uint32Array,[k0.ComponentType.UNSIGNED_SHORT]:Uint16Array,[k0.ComponentType.UNSIGNED_BYTE]:Uint8Array,[k0.ComponentType.SHORT]:Int16Array,[k0.ComponentType.BYTE]:Int8Array},os={[k0.ComponentType.FLOAT]:n8.DT_FLOAT32,[k0.ComponentType.UNSIGNED_INT]:n8.DT_UINT32,[k0.ComponentType.UNSIGNED_SHORT]:n8.DT_UINT16,[k0.ComponentType.UNSIGNED_BYTE]:n8.DT_UINT8,[k0.ComponentType.SHORT]:n8.DT_INT16,[k0.ComponentType.BYTE]:n8.DT_INT8}}var x9,Qz;(function(Z){Z[Z.EDGEBREAKER=1]="EDGEBREAKER",Z[Z.SEQUENTIAL=0]="SEQUENTIAL"})(Qz||(Qz={}));var A9;(function(Z){Z.POSITION="POSITION",Z.NORMAL="NORMAL",Z.COLOR="COLOR",Z.TEX_COORD="TEX_COORD",Z.GENERIC="GENERIC"})(A9||(A9={}));var rs={[A9.POSITION]:14,[A9.NORMAL]:10,[A9.COLOR]:8,[A9.TEX_COORD]:12,[A9.GENERIC]:12},bs={decodeSpeed:5,encodeSpeed:5,method:Qz.EDGEBREAKER,quantizationBits:rs,quantizationVolume:"mesh"};function Wj1(Z){x9=Z}function Kj1(Z,J=bs){let X=kZ({},bs,J);X.quantizationBits=kZ({},rs,J.quantizationBits);let Y=new x9.MeshBuilder,$=new x9.Mesh,Q=new x9.ExpertEncoder($),W={},K=new x9.DracoInt8Array,G=Z.listTargets().length>0,z=!1;for(let B of Z.listSemantics()){let w=Z.getAttribute(B);if(w.getSparse()){z=!0;continue}let O=Gj1(B),N=zj1(Y,w.getComponentType(),$,x9[O],w.getCount(),w.getElementSize(),w.getArray());if(N===-1)throw new Error(`Error compressing "${B}" attribute.`);if(W[B]=N,X.quantizationVolume==="mesh"||B!=="POSITION")Q.SetAttributeQuantization(N,X.quantizationBits[O]);else if(typeof X.quantizationVolume==="object"){let{quantizationVolume:R}=X,j=Math.max(R.max[0]-R.min[0],R.max[1]-R.min[1],R.max[2]-R.min[2]);Q.SetAttributeExplicitQuantization(N,X.quantizationBits[O],w.getElementSize(),R.min,j)}else throw new Error("Invalid quantization volume state.")}let H=Z.getIndices();if(!H)throw new Mw("Primitive must have indices.");if(Y.AddFacesToMesh($,H.getCount()/3,H.getArray()),Q.SetSpeedOptions(X.encodeSpeed,X.decodeSpeed),Q.SetTrackEncodedProperties(!0),X.method===Qz.SEQUENTIAL||G||z)Q.SetEncodingMethod(x9.MESH_SEQUENTIAL_ENCODING);else Q.SetEncodingMethod(x9.MESH_EDGEBREAKER_ENCODING);let V=Q.EncodeToDracoBuffer(!(G||z),K);if(V<=0)throw new Mw("Error applying Draco compression.");let q=new Uint8Array(V);for(let B=0;B<V;++B)q[B]=K.GetValue(B);let F=Q.GetNumberOfEncodedPoints(),U=Q.GetNumberOfEncodedFaces()*3;return x9.destroy(K),x9.destroy($),x9.destroy(Y),x9.destroy(Q),{numVertices:F,numIndices:U,data:q,attributeIDs:W}}function Gj1(Z){if(Z==="POSITION")return A9.POSITION;else if(Z==="NORMAL")return A9.NORMAL;else if(Z.startsWith("COLOR_"))return A9.COLOR;else if(Z.startsWith("TEXCOORD_"))return A9.TEX_COORD;return A9.GENERIC}function zj1(Z,J,X,Y,$,Q,W){switch(J){case k0.ComponentType.UNSIGNED_BYTE:return Z.AddUInt8Attribute(X,Y,$,Q,W);case k0.ComponentType.BYTE:return Z.AddInt8Attribute(X,Y,$,Q,W);case k0.ComponentType.UNSIGNED_SHORT:return Z.AddUInt16Attribute(X,Y,$,Q,W);case k0.ComponentType.SHORT:return Z.AddInt16Attribute(X,Y,$,Q,W);case k0.ComponentType.UNSIGNED_INT:return Z.AddUInt32Attribute(X,Y,$,Q,W);case k0.ComponentType.FLOAT:return Z.AddFloatAttribute(X,Y,$,Q,W);default:throw new Error(`Unexpected component type, "${J}".`)}}class Mw extends Error{}var v8=ps;class Kz extends _1{constructor(...Z){super(...Z);this.extensionName=v8,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,Qj1(this._decoderModule);if(Z==="draco3d.encoder")this._encoderModule=J,Wj1(this._encoderModule);return this}setEncoderOptions(Z){return this._encoderOptions=Z,this}preread(Z){if(!this._decoderModule)throw new Error(`[${v8}] 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 W of Q.primitives){if(!W.extensions||!W.extensions[v8])continue;let K=W.extensions[v8],[G,z]=Y.get(K.bufferView)||[];if(!z||!G){let H=X.json.bufferViews[K.bufferView],V=X.json.buffers[H.buffer],q=V.uri?X.resources[V.uri]:X.resources[yC],F=H.byteOffset||0,U=H.byteLength,B=v6.toView(q,F,U);G=new this._decoderModule.Decoder,z=Xj1(G,B),Y.set(K.bufferView,[G,z]),J.debug(`[${v8}] Decompressed ${B.byteLength} bytes.`)}for(let H in K.attributes){let V=Z.jsonDoc.json.accessors[W.attributes[H]],q=G.GetAttributeByUniqueId(z,K.attributes[H]),F=$j1(G,z,q,V);Z.accessors[W.attributes[H]].setArray(F)}if(W.indices!==void 0)Z.accessors[W.indices].setArray(Yj1(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(`[${v8}] Please install extension dependency, "draco3d.encoder".`);let X=this.document.getLogger();X.debug(`[${v8}] Compression options: ${JSON.stringify(this._encoderOptions)}`);let Y=Hj1(this.document),$=new Map,Q="mesh";if(this._encoderOptions.quantizationVolume==="scene")if(this.document.getRoot().listScenes().length!==1)X.warn(`[${v8}]: quantizationVolume=scene requires exactly 1 scene.`);else Q=Ds(this.document.getRoot().listScenes().pop());for(let W of Array.from(Y.keys())){let K=Y.get(W);if(!K)throw new Error("Unexpected primitive.");if($.has(K)){$.set(K,$.get(K));continue}let G=W.getIndices(),z=Z.jsonDoc.json.accessors,H;try{H=Kj1(W,kZ({},this._encoderOptions,{quantizationVolume:Q}))}catch(F){if(F instanceof Mw){X.warn(`[${v8}]: ${F.message} Skipping primitive compression.`);continue}throw F}$.set(K,H);let V=Z.createAccessorDef(G);if(V.count=H.numIndices,Z.accessorIndexMap.set(G,z.length),z.push(V),H.numVertices>65534&&k0.getComponentSize(V.componentType)<=2)V.componentType=k0.ComponentType.UNSIGNED_INT;else if(H.numVertices>254&&k0.getComponentSize(V.componentType)<=1)V.componentType=k0.ComponentType.UNSIGNED_SHORT;for(let F of W.listSemantics()){let U=W.getAttribute(F);if(H.attributeIDs[F]===void 0)continue;let B=Z.createAccessorDef(U);B.count=H.numVertices,Z.accessorIndexMap.set(U,z.length),z.push(B)}let q=W.getAttribute("POSITION").getBuffer()||this.document.getRoot().listBuffers()[0];if(!Z.otherBufferViews.has(q))Z.otherBufferViews.set(q,[]);Z.otherBufferViews.get(q).push(H.data)}return X.debug(`[${v8}] Compressed ${Y.size} primitives.`),Z.extensionData[v8]={primitiveHashMap:Y,primitiveEncodingMap:$},this}write(Z){let J=Z.extensionData[v8];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()[$],W=Y.primitives[$],K=J.primitiveHashMap.get(Q);if(!K)continue;let G=J.primitiveEncodingMap.get(K);if(!G)continue;W.extensions=W.extensions||{},W.extensions[v8]={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!==v8),X.extensionsRequired=(X.extensionsRequired||[]).filter((Y)=>Y!==v8)}return this}}Kz.EXTENSION_NAME=v8;Kz.EncoderMethod=Qz;function Hj1(Z){let J=Z.getLogger(),X=new Set,Y=new Set,$=0,Q=0;for(let V of Z.getRoot().listMeshes())for(let q of V.listPrimitives())if(!q.getIndices())Y.add(q),$++;else if(q.getMode()!==fJ.Mode.TRIANGLES)Y.add(q),Q++;else X.add(q);if($>0)J.warn(`[${v8}] Skipping Draco compression of ${$} non-indexed primitives.`);if(Q>0)J.warn(`[${v8}] Skipping Draco compression of ${Q} non-TRIANGLES primitives.`);let W=Z.getRoot().listAccessors(),K=new Map;for(let V=0;V<W.length;V++)K.set(W[V],V);let G=new Map,z=new Set,H=new Map;for(let V of Array.from(X)){let q=ys(V,K);if(z.has(q)){H.set(V,q);continue}if(G.has(V.getIndices())){let F=V.getIndices(),U=F.clone();K.set(U,Z.getRoot().listAccessors().length-1),V.swap(F,U)}for(let F of V.listAttributes())if(G.has(F)){let U=F.clone();K.set(U,Z.getRoot().listAccessors().length-1),V.swap(F,U)}q=ys(V,K),z.add(q),H.set(V,q),G.set(V.getIndices(),q);for(let F of V.listAttributes())G.set(F,q)}for(let V of Array.from(G.keys())){let q=new Set(V.listParents().map((F)=>F.propertyType));if(q.size!==2||!q.has(s.PRIMITIVE)||!q.has(s.ROOT))throw new Error(`[${v8}] Compressed accessors must only be used as indices or vertex attributes.`)}for(let V of Array.from(X)){let q=H.get(V),F=V.getIndices();if(G.get(F)!==q||V.listAttributes().some((U)=>G.get(U)!==q))throw new Error(`[${v8}] Draco primitives must share all, or no, accessors.`)}for(let V of Array.from(Y)){let q=V.getIndices();if(G.has(q)||V.listAttributes().some((F)=>G.has(F)))throw new Error(`[${v8}] Accessor cannot be shared by compressed and uncompressed primitives.`)}return H}function ys(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 EW extends t1{init(){this.extensionName=tC,this.propertyType="Light",this.parentTypes=[s.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{color:[1,1,1],intensity:1,type:EW.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)}}EW.EXTENSION_NAME=tC;EW.Type={POINT:"point",SPOT:"spot",DIRECTIONAL:"directional"};var P7=tC;class UT extends _1{constructor(...Z){super(...Z);this.extensionName=P7}createLight(Z=""){return new EW(this.document.getGraph(),Z)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[P7])return this;let $=(J.json.extensions[P7].lights||[]).map((Q)=>{var W,K;let G=this.createLight().setName(Q.name||"").setType(Q.type);if(Q.color!==void 0)G.setColor(Q.color);if(Q.intensity!==void 0)G.setIntensity(Q.intensity);if(Q.range!==void 0)G.setRange(Q.range);if(((W=Q.spot)==null?void 0:W.innerConeAngle)!==void 0)G.setInnerConeAngle(Q.spot.innerConeAngle);if(((K=Q.spot)==null?void 0:K.outerConeAngle)!==void 0)G.setOuterConeAngle(Q.spot.outerConeAngle);return G});return J.json.nodes.forEach((Q,W)=>{if(!Q.extensions||!Q.extensions[P7])return;let K=Q.extensions[P7];Z.nodes[W].setExtension(P7,$[K.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=$,W={type:Q.getType()};if(!F8.eq(Q.getColor(),[1,1,1]))W.color=Q.getColor();if(Q.getIntensity()!==1)W.intensity=Q.getIntensity();if(Q.getRange()!=null)W.range=Q.getRange();if(Q.getName())W.name=Q.getName();if(Q.getType()===EW.Type.SPOT)W.spot={innerConeAngle:Q.getInnerConeAngle(),outerConeAngle:Q.getOuterConeAngle()};X.push(W),Y.set(Q,X.length-1)}return this.document.getRoot().listNodes().forEach(($)=>{let Q=$.getExtension(P7);if(Q){let W=Z.nodeIndexMap.get($),K=J.json.nodes[W];K.extensions=K.extensions||{},K.extensions[P7]={light:Y.get(Q)}}}),J.json.extensions=J.json.extensions||{},J.json.extensions[P7]={lights:X},this}}UT.EXTENSION_NAME=P7;var{R:Vj1,G:qj1,B:Fj1}=X9;class wT extends t1{init(){this.extensionName=eC,this.propertyType="Anisotropy",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{anisotropyStrength:0,anisotropyRotation:0,anisotropyTexture:null,anisotropyTextureInfo:new I1(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:Vj1|qj1|Fj1})}}wT.EXTENSION_NAME=eC;var bY=eC;class BT extends _1{constructor(...Z){super(...Z);this.extensionName=bY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createAnisotropy(){return new wT(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 W=this.createAnisotropy();Z.materials[Q].setExtension(bY,W);let K=$.extensions[bY];if(K.anisotropyStrength!==void 0)W.setAnisotropyStrength(K.anisotropyStrength);if(K.anisotropyRotation!==void 0)W.setAnisotropyRotation(K.anisotropyRotation);if(K.anisotropyTexture!==void 0){let G=K.anisotropyTexture,z=Z.textures[Y[G.index].source];W.setAnisotropyTexture(z),Z.setTextureInfo(W.getAnisotropyTextureInfo(),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 W=Q.extensions[bY]={};if(Y.getAnisotropyStrength()>0)W.anisotropyStrength=Y.getAnisotropyStrength();if(Y.getAnisotropyRotation()!==0)W.anisotropyRotation=Y.getAnisotropyRotation();if(Y.getAnisotropyTexture()){let K=Y.getAnisotropyTexture(),G=Y.getAnisotropyTextureInfo();W.anisotropyTexture=Z.createTextureInfoDef(K,G)}}}),this}}BT.EXTENSION_NAME=bY;var{R:gs,G:ms,B:Uj1}=X9;class LT extends t1{init(){this.extensionName=ZT,this.propertyType="Clearcoat",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{clearcoatFactor:0,clearcoatTexture:null,clearcoatTextureInfo:new I1(this.graph,"clearcoatTextureInfo"),clearcoatRoughnessFactor:0,clearcoatRoughnessTexture:null,clearcoatRoughnessTextureInfo:new I1(this.graph,"clearcoatRoughnessTextureInfo"),clearcoatNormalScale:1,clearcoatNormalTexture:null,clearcoatNormalTextureInfo:new I1(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:gs})}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:ms})}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:gs|ms|Uj1})}}LT.EXTENSION_NAME=ZT;var yY=ZT;class OT extends _1{constructor(...Z){super(...Z);this.extensionName=yY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createClearcoat(){return new LT(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[yY]){let W=this.createClearcoat();Z.materials[Q].setExtension(yY,W);let K=$.extensions[yY];if(K.clearcoatFactor!==void 0)W.setClearcoatFactor(K.clearcoatFactor);if(K.clearcoatRoughnessFactor!==void 0)W.setClearcoatRoughnessFactor(K.clearcoatRoughnessFactor);if(K.clearcoatTexture!==void 0){let G=K.clearcoatTexture,z=Z.textures[Y[G.index].source];W.setClearcoatTexture(z),Z.setTextureInfo(W.getClearcoatTextureInfo(),G)}if(K.clearcoatRoughnessTexture!==void 0){let G=K.clearcoatRoughnessTexture,z=Z.textures[Y[G.index].source];W.setClearcoatRoughnessTexture(z),Z.setTextureInfo(W.getClearcoatRoughnessTextureInfo(),G)}if(K.clearcoatNormalTexture!==void 0){let G=K.clearcoatNormalTexture,z=Z.textures[Y[G.index].source];if(W.setClearcoatNormalTexture(z),Z.setTextureInfo(W.getClearcoatNormalTextureInfo(),G),G.scale!==void 0)W.setClearcoatNormalScale(G.scale)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(yY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[yY]={clearcoatFactor:Y.getClearcoatFactor(),clearcoatRoughnessFactor:Y.getClearcoatRoughnessFactor()};if(Y.getClearcoatTexture()){let K=Y.getClearcoatTexture(),G=Y.getClearcoatTextureInfo();W.clearcoatTexture=Z.createTextureInfoDef(K,G)}if(Y.getClearcoatRoughnessTexture()){let K=Y.getClearcoatRoughnessTexture(),G=Y.getClearcoatRoughnessTextureInfo();W.clearcoatRoughnessTexture=Z.createTextureInfoDef(K,G)}if(Y.getClearcoatNormalTexture()){let K=Y.getClearcoatNormalTexture(),G=Y.getClearcoatNormalTextureInfo();if(W.clearcoatNormalTexture=Z.createTextureInfoDef(K,G),Y.getClearcoatNormalScale()!==1)W.clearcoatNormalTexture.scale=Y.getClearcoatNormalScale()}}}),this}}OT.EXTENSION_NAME=yY;var{R:wj1,G:Bj1,B:Lj1,A:Oj1}=X9;class jT extends t1{init(){this.extensionName=JT,this.propertyType="DiffuseTransmission",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseTransmissionFactor:0,diffuseTransmissionTexture:null,diffuseTransmissionTextureInfo:new I1(this.graph,"diffuseTransmissionTextureInfo"),diffuseTransmissionColorFactor:[1,1,1],diffuseTransmissionColorTexture:null,diffuseTransmissionColorTextureInfo:new I1(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:Oj1})}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:wj1|Bj1|Lj1})}}jT.EXTENSION_NAME=JT;var gY=JT;class MT extends _1{constructor(...Z){super(...Z);this.extensionName=gY}createDiffuseTransmission(){return new jT(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 W=this.createDiffuseTransmission();Z.materials[Q].setExtension(gY,W);let K=$.extensions[gY];if(K.diffuseTransmissionFactor!==void 0)W.setDiffuseTransmissionFactor(K.diffuseTransmissionFactor);if(K.diffuseTransmissionColorFactor!==void 0)W.setDiffuseTransmissionColorFactor(K.diffuseTransmissionColorFactor);if(K.diffuseTransmissionTexture!==void 0){let G=K.diffuseTransmissionTexture,z=Z.textures[Y[G.index].source];W.setDiffuseTransmissionTexture(z),Z.setTextureInfo(W.getDiffuseTransmissionTextureInfo(),G)}if(K.diffuseTransmissionColorTexture!==void 0){let G=K.diffuseTransmissionColorTexture,z=Z.textures[Y[G.index].source];W.setDiffuseTransmissionColorTexture(z),Z.setTextureInfo(W.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 W=Q.extensions[gY]={diffuseTransmissionFactor:Y.getDiffuseTransmissionFactor(),diffuseTransmissionColorFactor:Y.getDiffuseTransmissionColorFactor()};if(Y.getDiffuseTransmissionTexture()){let K=Y.getDiffuseTransmissionTexture(),G=Y.getDiffuseTransmissionTextureInfo();W.diffuseTransmissionTexture=Z.createTextureInfoDef(K,G)}if(Y.getDiffuseTransmissionColorTexture()){let K=Y.getDiffuseTransmissionColorTexture(),G=Y.getDiffuseTransmissionColorTextureInfo();W.diffuseTransmissionColorTexture=Z.createTextureInfoDef(K,G)}}return this}}MT.EXTENSION_NAME=gY;class RT extends t1{init(){this.extensionName=XT,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)}}RT.EXTENSION_NAME=XT;var mY=XT;class NT extends _1{constructor(...Z){super(...Z);this.extensionName=mY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createDispersion(){return new RT(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[mY]){let Q=this.createDispersion();Z.materials[$].setExtension(mY,Q);let W=Y.extensions[mY];if(W.dispersion!==void 0)Q.setDispersion(W.dispersion)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(mY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[mY]={dispersion:Y.getDispersion()}}}),this}}NT.EXTENSION_NAME=mY;class DT extends t1{init(){this.extensionName=YT,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)}}DT.EXTENSION_NAME=YT;var uY=YT;class PT extends _1{constructor(...Z){super(...Z);this.extensionName=uY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createEmissiveStrength(){return new DT(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[uY]){let Q=this.createEmissiveStrength();Z.materials[$].setExtension(uY,Q);let W=Y.extensions[uY];if(W.emissiveStrength!==void 0)Q.setEmissiveStrength(W.emissiveStrength)}}),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||{},Q.extensions[uY]={emissiveStrength:Y.getEmissiveStrength()}}}),this}}PT.EXTENSION_NAME=uY;class CT extends t1{init(){this.extensionName=$T,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)}}CT.EXTENSION_NAME=$T;var dY=$T;class Cw extends _1{constructor(...Z){super(...Z);this.extensionName=dY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createIOR(){return new CT(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[dY]){let Q=this.createIOR();Z.materials[$].setExtension(dY,Q);let W=Y.extensions[dY];if(W.ior!==void 0)Q.setIOR(W.ior)}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(dY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[dY]={ior:Y.getIOR()}}}),this}}Cw.EXTENSION_NAME=dY;var{R:jj1,G:Mj1}=X9;class TT extends t1{init(){this.extensionName=QT,this.propertyType="Iridescence",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{iridescenceFactor:0,iridescenceTexture:null,iridescenceTextureInfo:new I1(this.graph,"iridescenceTextureInfo"),iridescenceIOR:1.3,iridescenceThicknessMinimum:100,iridescenceThicknessMaximum:400,iridescenceThicknessTexture:null,iridescenceThicknessTextureInfo:new I1(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:jj1})}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:Mj1})}}TT.EXTENSION_NAME=QT;var cY=QT;class kT extends _1{constructor(...Z){super(...Z);this.extensionName=cY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createIridescence(){return new TT(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[cY]){let W=this.createIridescence();Z.materials[Q].setExtension(cY,W);let K=$.extensions[cY];if(K.iridescenceFactor!==void 0)W.setIridescenceFactor(K.iridescenceFactor);if(K.iridescenceIor!==void 0)W.setIridescenceIOR(K.iridescenceIor);if(K.iridescenceThicknessMinimum!==void 0)W.setIridescenceThicknessMinimum(K.iridescenceThicknessMinimum);if(K.iridescenceThicknessMaximum!==void 0)W.setIridescenceThicknessMaximum(K.iridescenceThicknessMaximum);if(K.iridescenceTexture!==void 0){let G=K.iridescenceTexture,z=Z.textures[Y[G.index].source];W.setIridescenceTexture(z),Z.setTextureInfo(W.getIridescenceTextureInfo(),G)}if(K.iridescenceThicknessTexture!==void 0){let G=K.iridescenceThicknessTexture,z=Z.textures[Y[G.index].source];W.setIridescenceThicknessTexture(z),Z.setTextureInfo(W.getIridescenceThicknessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(cY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[cY]={};if(Y.getIridescenceFactor()>0)W.iridescenceFactor=Y.getIridescenceFactor();if(Y.getIridescenceIOR()!==1.3)W.iridescenceIor=Y.getIridescenceIOR();if(Y.getIridescenceThicknessMinimum()!==100)W.iridescenceThicknessMinimum=Y.getIridescenceThicknessMinimum();if(Y.getIridescenceThicknessMaximum()!==400)W.iridescenceThicknessMaximum=Y.getIridescenceThicknessMaximum();if(Y.getIridescenceTexture()){let K=Y.getIridescenceTexture(),G=Y.getIridescenceTextureInfo();W.iridescenceTexture=Z.createTextureInfoDef(K,G)}if(Y.getIridescenceThicknessTexture()){let K=Y.getIridescenceThicknessTexture(),G=Y.getIridescenceThicknessTextureInfo();W.iridescenceThicknessTexture=Z.createTextureInfoDef(K,G)}}}),this}}kT.EXTENSION_NAME=cY;var{R:us,G:ds,B:cs,A:ls}=X9;class ET extends t1{init(){this.extensionName=WT,this.propertyType="PBRSpecularGlossiness",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseFactor:[1,1,1,1],diffuseTexture:null,diffuseTextureInfo:new I1(this.graph,"diffuseTextureInfo"),specularFactor:[1,1,1],glossinessFactor:1,specularGlossinessTexture:null,specularGlossinessTextureInfo:new I1(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:us|ds|cs|ls,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:us|ds|cs|ls})}}ET.EXTENSION_NAME=WT;var lY=WT;class Tw extends _1{constructor(...Z){super(...Z);this.extensionName=lY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createPBRSpecularGlossiness(){return new ET(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 W=this.createPBRSpecularGlossiness();Z.materials[Q].setExtension(lY,W);let K=$.extensions[lY];if(K.diffuseFactor!==void 0)W.setDiffuseFactor(K.diffuseFactor);if(K.specularFactor!==void 0)W.setSpecularFactor(K.specularFactor);if(K.glossinessFactor!==void 0)W.setGlossinessFactor(K.glossinessFactor);if(K.diffuseTexture!==void 0){let G=K.diffuseTexture,z=Z.textures[Y[G.index].source];W.setDiffuseTexture(z),Z.setTextureInfo(W.getDiffuseTextureInfo(),G)}if(K.specularGlossinessTexture!==void 0){let G=K.specularGlossinessTexture,z=Z.textures[Y[G.index].source];W.setSpecularGlossinessTexture(z),Z.setTextureInfo(W.getSpecularGlossinessTextureInfo(),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 W=Q.extensions[lY]={diffuseFactor:Y.getDiffuseFactor(),specularFactor:Y.getSpecularFactor(),glossinessFactor:Y.getGlossinessFactor()};if(Y.getDiffuseTexture()){let K=Y.getDiffuseTexture(),G=Y.getDiffuseTextureInfo();W.diffuseTexture=Z.createTextureInfoDef(K,G)}if(Y.getSpecularGlossinessTexture()){let K=Y.getSpecularGlossinessTexture(),G=Y.getSpecularGlossinessTextureInfo();W.specularGlossinessTexture=Z.createTextureInfoDef(K,G)}}}),this}}Tw.EXTENSION_NAME=lY;var{R:Rj1,G:Nj1,B:Dj1,A:Pj1}=X9;class IT extends t1{init(){this.extensionName=KT,this.propertyType="Sheen",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{sheenColorFactor:[0,0,0],sheenColorTexture:null,sheenColorTextureInfo:new I1(this.graph,"sheenColorTextureInfo"),sheenRoughnessFactor:0,sheenRoughnessTexture:null,sheenRoughnessTextureInfo:new I1(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:Rj1|Nj1|Dj1,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:Pj1})}}IT.EXTENSION_NAME=KT;var pY=KT;class vT extends _1{constructor(...Z){super(...Z);this.extensionName=pY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createSheen(){return new IT(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[pY]){let W=this.createSheen();Z.materials[Q].setExtension(pY,W);let K=$.extensions[pY];if(K.sheenColorFactor!==void 0)W.setSheenColorFactor(K.sheenColorFactor);if(K.sheenRoughnessFactor!==void 0)W.setSheenRoughnessFactor(K.sheenRoughnessFactor);if(K.sheenColorTexture!==void 0){let G=K.sheenColorTexture,z=Z.textures[Y[G.index].source];W.setSheenColorTexture(z),Z.setTextureInfo(W.getSheenColorTextureInfo(),G)}if(K.sheenRoughnessTexture!==void 0){let G=K.sheenRoughnessTexture,z=Z.textures[Y[G.index].source];W.setSheenRoughnessTexture(z),Z.setTextureInfo(W.getSheenRoughnessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(pY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[pY]={sheenColorFactor:Y.getSheenColorFactor(),sheenRoughnessFactor:Y.getSheenRoughnessFactor()};if(Y.getSheenColorTexture()){let K=Y.getSheenColorTexture(),G=Y.getSheenColorTextureInfo();W.sheenColorTexture=Z.createTextureInfoDef(K,G)}if(Y.getSheenRoughnessTexture()){let K=Y.getSheenRoughnessTexture(),G=Y.getSheenRoughnessTextureInfo();W.sheenRoughnessTexture=Z.createTextureInfoDef(K,G)}}}),this}}vT.EXTENSION_NAME=pY;var{R:Cj1,G:Tj1,B:kj1,A:Ej1}=X9;class ST extends t1{init(){this.extensionName=GT,this.propertyType="Specular",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{specularFactor:1,specularTexture:null,specularTextureInfo:new I1(this.graph,"specularTextureInfo"),specularColorFactor:[1,1,1],specularColorTexture:null,specularColorTextureInfo:new I1(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:Ej1})}getSpecularColorTexture(){return this.getRef("specularColorTexture")}getSpecularColorTextureInfo(){return this.getRef("specularColorTexture")?this.getRef("specularColorTextureInfo"):null}setSpecularColorTexture(Z){return this.setRef("specularColorTexture",Z,{channels:Cj1|Tj1|kj1,isColor:!0})}}ST.EXTENSION_NAME=GT;var iY=GT;class kw extends _1{constructor(...Z){super(...Z);this.extensionName=iY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createSpecular(){return new ST(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[iY]){let W=this.createSpecular();Z.materials[Q].setExtension(iY,W);let K=$.extensions[iY];if(K.specularFactor!==void 0)W.setSpecularFactor(K.specularFactor);if(K.specularColorFactor!==void 0)W.setSpecularColorFactor(K.specularColorFactor);if(K.specularTexture!==void 0){let G=K.specularTexture,z=Z.textures[Y[G.index].source];W.setSpecularTexture(z),Z.setTextureInfo(W.getSpecularTextureInfo(),G)}if(K.specularColorTexture!==void 0){let G=K.specularColorTexture,z=Z.textures[Y[G.index].source];W.setSpecularColorTexture(z),Z.setTextureInfo(W.getSpecularColorTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(iY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[iY]={};if(Y.getSpecularFactor()!==1)W.specularFactor=Y.getSpecularFactor();if(!F8.eq(Y.getSpecularColorFactor(),[1,1,1]))W.specularColorFactor=Y.getSpecularColorFactor();if(Y.getSpecularTexture()){let K=Y.getSpecularTexture(),G=Y.getSpecularTextureInfo();W.specularTexture=Z.createTextureInfoDef(K,G)}if(Y.getSpecularColorTexture()){let K=Y.getSpecularColorTexture(),G=Y.getSpecularColorTextureInfo();W.specularColorTexture=Z.createTextureInfoDef(K,G)}}}),this}}kw.EXTENSION_NAME=iY;var{R:Ij1}=X9;class _T extends t1{init(){this.extensionName=zT,this.propertyType="Transmission",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{transmissionFactor:0,transmissionTexture:null,transmissionTextureInfo:new I1(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:Ij1})}}_T.EXTENSION_NAME=zT;var nY=zT;class xT extends _1{constructor(...Z){super(...Z);this.extensionName=nY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createTransmission(){return new _T(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[nY]){let W=this.createTransmission();Z.materials[Q].setExtension(nY,W);let K=$.extensions[nY];if(K.transmissionFactor!==void 0)W.setTransmissionFactor(K.transmissionFactor);if(K.transmissionTexture!==void 0){let G=K.transmissionTexture,z=Z.textures[Y[G.index].source];W.setTransmissionTexture(z),Z.setTextureInfo(W.getTransmissionTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(nY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[nY]={transmissionFactor:Y.getTransmissionFactor()};if(Y.getTransmissionTexture()){let K=Y.getTransmissionTexture(),G=Y.getTransmissionTextureInfo();W.transmissionTexture=Z.createTextureInfoDef(K,G)}}}),this}}xT.EXTENSION_NAME=nY;class AT extends t1{init(){this.extensionName=HT,this.propertyType="Unlit",this.parentTypes=[s.MATERIAL]}}AT.EXTENSION_NAME=HT;var TW=HT;class Ew extends _1{constructor(...Z){super(...Z);this.extensionName=TW,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createUnlit(){return new AT(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[TW])Z.materials[Y].setExtension(TW,this.createUnlit())}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{if(X.getExtension(TW)){let Y=Z.materialIndexMap.get(X),$=J.json.materials[Y];$.extensions=$.extensions||{},$.extensions[TW]={}}}),this}}Ew.EXTENSION_NAME=TW;class hT extends t1{init(){this.extensionName=oY,this.propertyType="Mapping",this.parentTypes=["MappingList"]}getDefaults(){return Object.assign(super.getDefaults(),{material:null,variants:new E0})}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")}}hT.EXTENSION_NAME=oY;class fT extends t1{init(){this.extensionName=oY,this.propertyType="MappingList",this.parentTypes=[s.PRIMITIVE]}getDefaults(){return Object.assign(super.getDefaults(),{mappings:new E0})}addMapping(Z){return this.addRef("mappings",Z)}removeMapping(Z){return this.removeRef("mappings",Z)}listMappings(){return this.listRefs("mappings")}}fT.EXTENSION_NAME=oY;class Rw extends t1{init(){this.extensionName=oY,this.propertyType="Variant",this.parentTypes=["MappingList"]}}Rw.EXTENSION_NAME=oY;var C7=oY;class bT extends _1{constructor(...Z){super(...Z);this.extensionName=C7}createMappingList(){return new fT(this.document.getGraph())}createVariant(Z=""){return new Rw(this.document.getGraph(),Z)}createMapping(){return new hT(this.document.getGraph())}listVariants(){return Array.from(this.properties).filter((Z)=>Z instanceof Rw)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[C7])return this;let $=(J.json.extensions[C7].variants||[]).map((W)=>this.createVariant().setName(W.name||""));return(J.json.meshes||[]).forEach((W,K)=>{let G=Z.meshes[K];(W.primitives||[]).forEach((H,V)=>{if(!H.extensions||!H.extensions[C7])return;let q=this.createMappingList(),F=H.extensions[C7];for(let U of F.mappings){let B=this.createMapping();if(U.material!==void 0)B.setMaterial(Z.materials[U.material]);for(let w of U.variants||[])B.addVariant($[w]);q.addMapping(B)}G.listPrimitives()[V].setExtension(C7,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 W=Z.meshIndexMap.get(Q);Q.listPrimitives().forEach((K,G)=>{let z=K.getExtension(C7);if(!z)return;let H=Z.jsonDoc.json.meshes[W].primitives[G],V=z.listMappings().map((q)=>{let F=Z.createPropertyDef(q),U=q.getMaterial();if(U)F.material=Z.materialIndexMap.get(U);return F.variants=q.listVariants().map((B)=>$.get(B)),F});H.extensions=H.extensions||{},H.extensions[C7]={mappings:V}})}return J.json.extensions=J.json.extensions||{},J.json.extensions[C7]={variants:Y},this}}bT.EXTENSION_NAME=C7;var{G:vj1}=X9;class yT extends t1{init(){this.extensionName=VT,this.propertyType="Volume",this.parentTypes=[s.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{thicknessFactor:0,thicknessTexture:null,thicknessTextureInfo:new I1(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:vj1})}getAttenuationDistance(){return this.get("attenuationDistance")}setAttenuationDistance(Z){return this.set("attenuationDistance",Z)}getAttenuationColor(){return this.get("attenuationColor")}setAttenuationColor(Z){return this.set("attenuationColor",Z)}}yT.EXTENSION_NAME=VT;var aY=VT;class gT extends _1{constructor(...Z){super(...Z);this.extensionName=aY,this.prereadTypes=[s.MESH],this.prewriteTypes=[s.MESH]}createVolume(){return new yT(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[aY]){let W=this.createVolume();Z.materials[Q].setExtension(aY,W);let K=$.extensions[aY];if(K.thicknessFactor!==void 0)W.setThicknessFactor(K.thicknessFactor);if(K.attenuationDistance!==void 0)W.setAttenuationDistance(K.attenuationDistance);if(K.attenuationColor!==void 0)W.setAttenuationColor(K.attenuationColor);if(K.thicknessTexture!==void 0){let G=K.thicknessTexture,z=Z.textures[Y[G.index].source];W.setThicknessTexture(z),Z.setTextureInfo(W.getThicknessTextureInfo(),G)}}}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{let Y=X.getExtension(aY);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[aY]={};if(Y.getThicknessFactor()>0)W.thicknessFactor=Y.getThicknessFactor();if(Number.isFinite(Y.getAttenuationDistance()))W.attenuationDistance=Y.getAttenuationDistance();if(!F8.eq(Y.getAttenuationColor(),[1,1,1]))W.attenuationColor=Y.getAttenuationColor();if(Y.getThicknessTexture()){let K=Y.getThicknessTexture(),G=Y.getThicknessTextureInfo();W.thicknessTexture=Z.createTextureInfoDef(K,G)}}}),this}}gT.EXTENSION_NAME=aY;var ts=pO1;class Gz extends _1{constructor(...Z){super(...Z);this.extensionName=ts}read(Z){return this}write(Z){return this}}Gz.EXTENSION_NAME=ts;var Yz=iO1;class es{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=Ow(Z);return[J.pixelWidth,J.pixelHeight]}getChannels(Z){let X=Ow(Z).dataFormatDescriptor[0];if(X.colorModel===vs)return X.samples.length===2&&(X.samples[1].channelType&15)===15?4:3;else if(X.colorModel===Ss)return(X.samples[0].channelType&15)===3?4:3;throw new Error(`Unexpected KTX2 colorModel, "${X.colorModel}".`)}getVRAMByteLength(Z){let J=Ow(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 W=Math.max(1,Math.floor(J.pixelWidth/Math.pow(2,$))),K=Math.max(1,Math.floor(J.pixelHeight/Math.pow(2,$))),G=X?16:8;Y+=W/4*(K/4)*G}}return Y}}class mT extends _1{constructor(...Z){super(...Z);this.extensionName=Yz,this.prereadTypes=[s.TEXTURE]}static register(){E4.registerFormat("image/ktx2",new es)}preread(Z){return Z.jsonDoc.json.textures.forEach((J)=>{if(J.extensions&&J.extensions[Yz]){let X=J.extensions[Yz];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[Yz]={source:$.source},delete $.source})}}),this}}mT.EXTENSION_NAME=Yz;class uT extends t1{init(){this.extensionName=qT,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)}}uT.EXTENSION_NAME=qT;var sY=qT;class dT extends _1{constructor(...Z){super(...Z);this.extensionName=sY}createTransform(){return new uT(this.document.getGraph())}read(Z){for(let[J,X]of Array.from(Z.textureInfos.entries())){if(!X.extensions||!X.extensions[sY])continue;let Y=this.createTransform(),$=X.extensions[sY];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(sY,Y)}return this}write(Z){let J=Array.from(Z.textureInfoDefMap.entries());for(let[X,Y]of J){let $=X.getExtension(sY);if(!$)continue;Y.extensions=Y.extensions||{};let Q={},W=F8.eq;if(!W($.getOffset(),[0,0]))Q.offset=$.getOffset();if($.getRotation()!==0)Q.rotation=$.getRotation();if(!W($.getScale(),[1,1]))Q.scale=$.getScale();if($.getTexCoord()!=null)Q.texCoord=$.getTexCoord();Y.extensions[sY]=Q}return this}}dT.EXTENSION_NAME=sY;var Sj1=[s.ROOT,s.SCENE,s.NODE,s.MESH,s.MATERIAL,s.TEXTURE,s.ANIMATION];class cT extends t1{init(){this.extensionName=jw,this.propertyType="Packet",this.parentTypes=Sj1}getDefaults(){return Object.assign(super.getDefaults(),{context:{},properties:{}})}getContext(){return this.get("context")}setContext(Z){return this.set("context",kZ({},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=kZ({},this.get("properties"));if(J)X[Z]=J;else delete X[Z];return this.set("properties",X)}toJSONLD(){let Z=nC(this.get("context")),J=nC(this.get("properties"));return kZ({"@context":Z},J)}fromJSONLD(Z){Z=nC(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(`${jw}: Missing context for term, "${Z}".`)}}cT.EXTENSION_NAME=jw;function nC(Z){return JSON.parse(JSON.stringify(Z))}var TZ=jw;class lT extends _1{constructor(...Z){super(...Z);this.extensionName=TZ}createPacket(){return new cT(this.document.getGraph())}listPackets(){return Array.from(this.properties)}read(Z){var J;let X=(J=Z.jsonDoc.json.extensions)==null?void 0:J[TZ];if(!X||!X.packets)return this;let Y=Z.jsonDoc.json,$=this.document.getRoot(),Q=X.packets.map((G)=>this.createPacket().fromJSONLD(G)),W=[[Y.asset],Y.scenes,Y.nodes,Y.meshes,Y.materials,Y.images,Y.animations],K=[[$],$.listScenes(),$.listNodes(),$.listMeshes(),$.listMaterials(),$.listTextures(),$.listAnimations()];for(let G=0;G<W.length;G++){let z=W[G]||[];for(let H=0;H<z.length;H++){let V=z[H];if(V.extensions&&V.extensions[TZ]){let q=V.extensions[TZ];K[G][H].setExtension(TZ,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(`[${TZ}]: Unsupported parent property, "${$.propertyType}"`);break}if(!Q)continue;Q.extensions=Q.extensions||{},Q.extensions[TZ]={packet:X.length-1}}}if(X.length>0)J.extensions=J.extensions||{},J.extensions[TZ]={packets:X};return this}}lT.EXTENSION_NAME=TZ;var _j1=[Kz,UT,BT,OT,MT,NT,PT,Cw,kT,Tw,kw,vT,xT,Ew,bT,gT,Gz,mT,dT,lT],uU6=[Nw,Wz,Dw,Pw,..._j1];var xj1=e(WC(),1);function SW(){return SW=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},SW.apply(null,arguments)}var{POINTS:Zo,LINES:Iw,LINE_STRIP:Aj1,LINE_LOOP:hj1,TRIANGLES:vw,TRIANGLE_STRIP:fj1,TRIANGLE_FAN:bj1}=E8.Mode;function uJ(Z,J){return Object.defineProperty(J,"name",{value:Z}),J}function T7(Z,J){let X=SW({},Z);for(let Y in J)if(J[Y]!==void 0)X[Y]=J[Y];return X}function Mo(Z){let J=Z.getIndices(),X=Z.getAttribute("POSITION");switch(Z.getMode()){case E8.Mode.POINTS:return J?J.getCount():X.getCount();case E8.Mode.LINES:return J?J.getCount()/2:X.getCount()/2;case E8.Mode.LINE_LOOP:return J?J.getCount():X.getCount();case E8.Mode.LINE_STRIP:return J?J.getCount()-1:X.getCount()-1;case E8.Mode.TRIANGLES:return J?J.getCount()/3:X.getCount()/3;case E8.Mode.TRIANGLE_STRIP:case E8.Mode.TRIANGLE_FAN:return J?J.getCount()-2:X.getCount()-2;default:throw new Error("Unexpected mode: "+Z.getMode())}}var yj1=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function aT(Z){return yj1.format(Z)}function gj1(Z,J,X=2){let Y=Z>J?"\u2013":"+",$="%";return Y+(Math.abs(Z-J)/Z*100).toFixed(X)+"%"}function hw(Z,J){return`${aT(Z)} \u2192 ${aT(J)} (${gj1(Z,J)})`}function Jk(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 mj1(Z,J,X){Z.swap(J,X);for(let Y of Z.listTargets())Y.swap(J,X)}function uj1(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 EZ(Z,J){return Z.createAccessor(J.getName()).setArray(J.getArray()).setType(J.getType()).setBuffer(J.getBuffer()).setNormalized(J.getNormalized()).setSparse(J.getSparse())}function dj1(Z,J=Z){let X=Xk(Z,J);for(let Y=0;Y<X.length;Y++)X[Y]=Y;return X}function Xk(Z,J=Z){return J<=65534?new Uint16Array(Z):new Uint32Array(Z)}function cj1(Z){return Z.listParents().some((J)=>J.propertyType!==a.ROOT)}function Ro(Z){for(let J in Z)return!1;return!0}function No(Z){let J=E6.fromGraph(Z.getGraph()),X=Z.getMaterial(),Y=J.getRoot().listMaterials().indexOf(X),$=pj1[Z.getMode()],Q=!!Z.getIndices(),W=Z.listSemantics().sort().map((G)=>{let z=Z.getAttribute(G),H=z.getElementSize(),V=z.getComponentType();return`${G}:${H}:${V}`}).join("+"),K=Z.listTargets().map((G)=>{return G.listSemantics().sort().map((z)=>{let H=Z.getAttribute(z),V=H.getElementSize(),q=H.getComponentType();return`${z}:${V}:${q}`}).join("+")}).join("~");return`${Y}|${$}|${Q}|${W}|${K}`}function lj1(Z){return Math.pow(2,Math.ceil(Math.log(Z)/Math.LN2))}var pj1={[Zo]:Zo,[Iw]:Iw,[Aj1]:Iw,[hj1]:Iw,[vw]:vw,[fj1]:vw,[bj1]:vw},IW="center",Jo={pivot:"center"};function Do(Z=Jo){let J=T7(Jo,Z);return uJ(IW,(X)=>{let Y=X.getLogger(),$=X.getRoot(),Q=$.listAnimations().length>0||$.listSkins().length>0;X.getRoot().listScenes().forEach((W,K)=>{Y.debug(`${IW}: Scene ${K+1} / ${$.listScenes().length}.`);let G;if(typeof J.pivot==="string"){let H=eP(W);if(G=[(H.max[0]-H.min[0])/2+H.min[0],(H.max[1]-H.min[1])/2+H.min[1],(H.max[2]-H.min[2])/2+H.min[2]],J.pivot==="above")G[1]=H.max[1];if(J.pivot==="below")G[1]=H.min[1]}else G=J.pivot;Y.debug(`${IW}: Pivot "${G.join(", ")}".`);let z=[-1*G[0],-1*G[1],-1*G[2]];if(Q){Y.debug(`${IW}: Model contains animation or skin. Adding a wrapper node.`);let H=X.createNode("Pivot").setTranslation(z);W.listChildren().forEach((V)=>H.addChild(V)),W.addChild(H)}else Y.debug(`${IW}: Skipping wrapper, offsetting all root nodes.`),W.listChildren().forEach((H)=>{let V=H.getTranslation();H.setTranslation([V[0]+z[0],V[1]+z[1],V[2]+z[2]])})}),Y.debug(`${IW}: Complete.`)})}function ij1(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 UW)}function nj1(Z){let J=ij1(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 _W=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 aj1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],B=J[13],w=J[14],O=J[15],N=X*K-Y*W,R=X*G-$*W,j=X*z-Q*W,P=Y*G-$*K,D=Y*z-Q*K,C=$*z-Q*G,T=H*B-V*U,k=H*w-q*U,x=H*O-F*U,S=V*w-q*B,A=V*O-F*B,I=q*O-F*w,v=N*I-R*A+j*S+P*x-D*k+C*T;if(!v)return null;return v=1/v,Z[0]=(K*I-G*A+z*S)*v,Z[1]=($*A-Y*I-Q*S)*v,Z[2]=(B*C-w*D+O*P)*v,Z[3]=(q*D-V*C-F*P)*v,Z[4]=(G*x-W*I-z*k)*v,Z[5]=(X*I-$*x+Q*k)*v,Z[6]=(w*j-U*C-O*R)*v,Z[7]=(H*C-q*j+F*R)*v,Z[8]=(W*A-K*x+z*T)*v,Z[9]=(Y*x-X*A-Q*T)*v,Z[10]=(U*D-B*j+O*N)*v,Z[11]=(V*j-H*D-F*N)*v,Z[12]=(K*k-W*S-G*T)*v,Z[13]=(X*S-Y*k+$*T)*v,Z[14]=(B*R-U*P-w*N)*v,Z[15]=(H*P-V*R+q*N)*v,Z}function sj1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],W=Z[5],K=Z[6],G=Z[7],z=Z[8],H=Z[9],V=Z[10],q=Z[11],F=Z[12],U=Z[13],B=Z[14],w=Z[15],O=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,j=X*K-Y*W,P=X*G-$*W,D=Y*G-$*K,C=z*U-H*F,T=z*B-V*F,k=z*w-q*F,x=H*B-V*U,S=H*w-q*U,A=V*w-q*B;return O*A-N*S+R*x+j*k-P*T+D*C}function Po(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=J[9],F=J[10],U=J[11],B=J[12],w=J[13],O=J[14],N=J[15],R=X[0],j=X[1],P=X[2],D=X[3];return Z[0]=R*Y+j*K+P*V+D*B,Z[1]=R*$+j*G+P*q+D*w,Z[2]=R*Q+j*z+P*F+D*O,Z[3]=R*W+j*H+P*U+D*N,R=X[4],j=X[5],P=X[6],D=X[7],Z[4]=R*Y+j*K+P*V+D*B,Z[5]=R*$+j*G+P*q+D*w,Z[6]=R*Q+j*z+P*F+D*O,Z[7]=R*W+j*H+P*U+D*N,R=X[8],j=X[9],P=X[10],D=X[11],Z[8]=R*Y+j*K+P*V+D*B,Z[9]=R*$+j*G+P*q+D*w,Z[10]=R*Q+j*z+P*F+D*O,Z[11]=R*W+j*H+P*U+D*N,R=X[12],j=X[13],P=X[14],D=X[15],Z[12]=R*Y+j*K+P*V+D*B,Z[13]=R*$+j*G+P*q+D*w,Z[14]=R*Q+j*z+P*F+D*O,Z[15]=R*W+j*H+P*U+D*N,Z}function oj1(){var Z=new _W(9);if(_W!=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 rj1(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 tj1(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 ej1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=H*W-K*z,q=-H*Q+K*G,F=z*Q-W*G,U=X*V+Y*q+$*F;if(!U)return null;return U=1/U,Z[0]=V*U,Z[1]=(-H*Y+$*z)*U,Z[2]=(K*Y-$*W)*U,Z[3]=q*U,Z[4]=(H*X-$*G)*U,Z[5]=(-K*X+$*Q)*U,Z[6]=F*U,Z[7]=(-z*X+Y*G)*U,Z[8]=(W*X-Y*Q)*U,Z}function fw(){var Z=new _W(3);if(_W!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function ZM1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z}function Co(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 JM1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=X[3]*Y+X[7]*$+X[11]*Q+X[15];return W=W||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/W,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/W,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/W,Z}function XM1(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 YM1=ZM1;(function(){var Z=fw();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}})();var gJ="dedup",pT={keepUniqueNames:!1,propertyTypes:[a.ACCESSOR,a.MESH,a.TEXTURE,a.MATERIAL,a.SKIN]};function To(Z=pT){let J=T7(pT,Z),X=new Set(J.propertyTypes);for(let Y of J.propertyTypes)if(!pT.propertyTypes.includes(Y))throw new Error(`${gJ}: Unsupported deduplication on type "${Y}".`);return uJ(gJ,(Y)=>{let $=Y.getLogger();if(X.has(a.ACCESSOR))$M1(Y);if(X.has(a.TEXTURE))WM1(Y,J);if(X.has(a.MATERIAL))KM1(Y,J);if(X.has(a.MESH))QM1(Y,J);if(X.has(a.SKIN))GM1(Y,J);$.debug(`${gJ}: Complete.`)})}function $M1(Z){let J=Z.getLogger(),X=new Map,Y=new Map,$=new Map,Q=new Map,W=Z.getRoot().listMeshes();W.forEach((V)=>{V.listPrimitives().forEach((q)=>{q.listAttributes().forEach((F)=>K(F,Y)),K(q.getIndices(),X)})});for(let V of Z.getRoot().listAnimations())for(let q of V.listSamplers())K(q.getInput(),$),K(q.getOutput(),Q);function K(V,q){if(!V)return;let F=[V.getCount(),V.getType(),V.getComponentType(),V.getNormalized(),V.getSparse()].join(":"),U=q.get(F);if(!U)q.set(F,U=new Set);U.add(V)}function G(V,q){for(let F=0;F<V.length;F++){let U=V[F],B=o0.toView(U.getArray());if(q.has(U))continue;for(let w=F+1;w<V.length;w++){let O=V[w];if(q.has(O))continue;if(o0.equals(B,o0.toView(O.getArray())))q.set(O,U)}}}let z=0,H=new Map;for(let V of[Y,X,$,Q])for(let q of V.values())z+=q.size,G(Array.from(q),H);J.debug(`${gJ}: Merged ${H.size} of ${z} accessors.`),W.forEach((V)=>{V.listPrimitives().forEach((q)=>{q.listAttributes().forEach((U)=>{if(H.has(U))q.swap(U,H.get(U))});let F=q.getIndices();if(F&&H.has(F))q.swap(F,H.get(F))})});for(let V of Z.getRoot().listAnimations())for(let q of V.listSamplers()){let F=q.getInput(),U=q.getOutput();if(F&&H.has(F))q.swap(F,H.get(F));if(U&&H.has(U))q.swap(U,H.get(U))}Array.from(H.keys()).forEach((V)=>V.dispose())}function QM1(Z,J){let X=Z.getLogger(),Y=Z.getRoot(),$=new Map;Y.listAccessors().forEach((K,G)=>$.set(K,G)),Y.listMaterials().forEach((K,G)=>$.set(K,G));let Q=Y.listMeshes().length,W=new Map;for(let K of Y.listMeshes()){let G=[];for(let H of K.listPrimitives())G.push(ko(H,$));let z="";if(J.keepUniqueNames)z+=K.getName()+";";if(z+=G.join(";"),W.has(z)){let H=W.get(z);K.listParents().forEach((V)=>{if(V.propertyType!==a.ROOT)V.swap(K,H)}),K.dispose()}else W.set(z,K)}X.debug(`${gJ}: Merged ${Q-W.size} of ${Q} meshes.`)}function WM1(Z,J){let X=Z.getLogger(),Y=Z.getRoot(),$=Y.listTextures(),Q=new Map;for(let W=0;W<$.length;W++){let K=$[W],G=K.getImage();if(Q.has(K))continue;for(let z=W+1;z<$.length;z++){let H=$[z],V=H.getImage();if(Q.has(H))continue;if(K.getMimeType()!==H.getMimeType())continue;if(J.keepUniqueNames&&K.getName()!==H.getName())continue;let q=K.getSize(),F=H.getSize();if(!q||!F)continue;if(q[0]!==F[0])continue;if(q[1]!==F[1])continue;if(!G||!V)continue;if(o0.equals(G,V))Q.set(H,K)}}X.debug(`${gJ}: Merged ${Q.size} of ${Y.listTextures().length} textures.`),Array.from(Q.entries()).forEach(([W,K])=>{W.listParents().forEach((G)=>{if(!(G instanceof SY))G.swap(W,K)}),W.dispose()})}function KM1(Z,J){let X=Z.getLogger(),$=Z.getRoot().listMaterials(),Q=new Map,W=new Map,K=new Set;if(!J.keepUniqueNames)K.add("name");for(let G=0;G<$.length;G++){let z=$[G];if(Q.has(z))continue;if(Xo(z,W))continue;for(let H=G+1;H<$.length;H++){let V=$[H];if(Q.has(V))continue;if(Xo(V,W))continue;if(z.equals(V,K))Q.set(V,z)}}X.debug(`${gJ}: Merged ${Q.size} of ${$.length} materials.`),Array.from(Q.entries()).forEach(([G,z])=>{G.listParents().forEach((H)=>{if(!(H instanceof SY))H.swap(G,z)}),G.dispose()})}function GM1(Z,J){let X=Z.getLogger(),$=Z.getRoot().listSkins(),Q=new Map,W=new Set(["joints"]);if(!J.keepUniqueNames)W.add("name");for(let K=0;K<$.length;K++){let G=$[K];if(Q.has(G))continue;for(let z=K+1;z<$.length;z++){let H=$[z];if(Q.has(H))continue;if(G.equals(H,W)&&uj1(G.listJoints(),H.listJoints()))Q.set(H,G)}}X.debug(`${gJ}: Merged ${Q.size} of ${$.length} skins.`),Array.from(Q.entries()).forEach(([K,G])=>{K.listParents().forEach((z)=>{if(!(z instanceof SY))z.swap(K,G)}),K.dispose()})}function ko(Z,J){let X=[];for(let Y of Z.listSemantics()){let $=Z.getAttribute(Y);X.push(Y+":"+J.get($))}if(Z instanceof E8){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:"+ko(Q,J))}return X.join(",")}function Xo(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 W=Q.getChild();if(Y.has(W))continue;for(let K of X.listChildEdges(W))$.push(K)}return J.set(Z,!1),!1}function Eo(){var Z=new _W(4);if(_W!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function zM1(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 HM1(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 VM1(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 qM1(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 FM1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return Math.hypot(J,X,Y,$)}var Io=HM1,UM1=VM1,vo=FM1;(function(){var Z=Eo();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=4;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Z[3]=J[K+3],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2],J[K+3]=Z[3];return J}})();var wM1=/color|emissive|diffuse/i;function BM1(Z){return Z.getGraph().listParentEdges(Z).some(($)=>{return $.getAttributes().isColor||wM1.test($.getName())})?"srgb":null}function LM1(Z){let J=Z.getGraph(),X=new Set,Y=new Set;function $(Q){let W=new Set;for(let K of J.listChildEdges(Q))if(K.getChild()instanceof vY)W.add(K.getName()+"Info");for(let K of J.listChildEdges(Q)){let G=K.getChild();if(X.has(G))continue;if(X.add(G),G instanceof D5&&W.has(K.getName()))Y.add(G);else if(G instanceof FW)$(G)}}return $(Z),Array.from(Y)}function OM1(Z){let X=E6.fromGraph(Z.getGraph()).getRoot(),Y=Z.getGraph().listParentEdges(Z).filter(($)=>$.getParent()!==X).map(($)=>$.getName());return Array.from(new Set(Y))}var vW="prune",sT=0.011764705882352941,Yo={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 bw(Z=Yo){let J=T7(Yo,Z),X=new Set(J.propertyTypes),Y=J.keepExtras;return uJ(vW,async($)=>{let Q=$.getLogger(),W=$.getRoot(),K=$.getGraph(),G=new So,z=(H)=>G.dispose(H.target);if(K.addEventListener("node:dispose",z),X.has(a.MESH))for(let H of W.listMeshes()){if(H.listPrimitives().length>0)continue;H.dispose()}if(X.has(a.NODE)){if(!J.keepLeaves)for(let H of W.listScenes())_o(K,H,Y);for(let H of W.listNodes())h9(H,Y)}if(X.has(a.SKIN))for(let H of W.listSkins())h9(H,Y);if(X.has(a.MESH))for(let H of W.listMeshes())h9(H,Y);if(X.has(a.CAMERA))for(let H of W.listCameras())h9(H,Y);if(X.has(a.PRIMITIVE))$o(K,a.PRIMITIVE,Y);if(X.has(a.PRIMITIVE_TARGET))$o(K,a.PRIMITIVE_TARGET,Y);if(!J.keepAttributes&&X.has(a.ACCESSOR)){let H=new Map;for(let V of W.listMeshes())for(let q of V.listPrimitives()){let F=q.getMaterial();if(!F)continue;let U=xo($,q,F),B=MM1(q,U);Qo(q,B),q.listTargets().forEach((w)=>Qo(w,B)),H.has(F)?H.get(F).add(q):H.set(F,new Set([q]))}for(let[V,q]of H)RM1(V,Array.from(q))}if(!J.keepIndices&&X.has(a.ACCESSOR))for(let H of W.listMeshes())for(let V of H.listPrimitives())jM1(V);if(X.has(a.ANIMATION))for(let H of W.listAnimations()){for(let V of H.listChannels())if(!V.getTargetNode())V.dispose();if(!H.listChannels().length){let V=H.listSamplers();h9(H,Y),V.forEach((q)=>h9(q,Y))}else H.listSamplers().forEach((V)=>h9(V,Y))}if(X.has(a.MATERIAL))W.listMaterials().forEach((H)=>h9(H,Y));if(X.has(a.TEXTURE)){if(W.listTextures().forEach((H)=>h9(H,Y)),!J.keepSolidTextures)await NM1($)}if(X.has(a.ACCESSOR))W.listAccessors().forEach((H)=>h9(H,Y));if(X.has(a.BUFFER))W.listBuffers().forEach((H)=>h9(H,Y));if(K.removeEventListener("node:dispose",z),!G.empty()){let H=G.entries().map(([V,q])=>`${V} (${q})`).join(", ");Q.info(`${vW}: Removed types... ${H}`)}else Q.debug(`${vW}: No unused properties found.`);Q.debug(`${vW}: Complete.`)})}class So{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 h9(Z,J){let X=Z.listParents().filter(($)=>!($ instanceof SY||$ instanceof EY)),Y=J&&!Ro(Z.getExtras());if(!X.length&&!Y)Z.dispose()}function $o(Z,J,X){for(let Y of Z.listEdges()){let $=Y.getParent();if($.propertyType===J)h9($,X)}}function _o(Z,J,X){if(J.listChildren().forEach((W)=>_o(Z,W,X)),J instanceof UW)return;let Y=Z.listParentEdges(J).some((W)=>{let K=W.getParent().propertyType;return K!==a.ROOT&&K!==a.SCENE&&K!==a.NODE}),$=Z.listChildren(J).length===0,Q=X&&!Ro(J.getExtras());if($&&!Y&&!Q)J.dispose()}function Qo(Z,J){for(let X of J)Z.setAttribute(X,null)}function jM1(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 MM1(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 xo(Z,J,X,Y=new Set){let Q=Z.getGraph().listChildEdges(X),W=new Set;for(let z of Q)if(z.getChild()instanceof vY)W.add(z.getName());for(let z of Q){let H=z.getName(),V=z.getChild();if(V instanceof D5){if(W.has(H.replace(/Info$/,"")))Y.add(`TEXCOORD_${V.getTexCoord()}`)}if(V instanceof vY&&H.match(/normalTexture/i))Y.add("TANGENT");if(V instanceof FW)xo(Z,J,V,Y)}let K=X instanceof L7&&!X.getExtension("KHR_materials_unlit"),G=J.getMode()===E8.Mode.POINTS;if(K&&!G)Y.add("NORMAL");return Y}function RM1(Z,J){let X=LM1(Z),Y=new Set(X.map((G)=>G.getTexCoord())),$=Array.from(Y).sort(),Q=new Map($.map((G,z)=>[G,z])),W=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((H)=>H.startsWith("TEXCOORD_")).sort();K(G,z),G.listTargets().forEach((H)=>K(H,z))}function K(G,z){for(let H of z){let V=G.getAttribute(H);if(!V)continue;let q=W.get(H);if(q===H)continue;G.setAttribute(q,V),G.setAttribute(H,null)}}}async function NM1(Z){let J=Z.getRoot(),X=Z.getGraph(),Y=Z.getLogger(),Q=J.listTextures().map(async(W)=>{var K;let G=await PM1(W);if(!G)return;if(BM1(W)==="srgb")ZC.convertSRGBToLinear(G,G);let z=W.getName()||W.getURI(),H=(K=W.getSize())==null?void 0:K.join("x"),V=OM1(W);for(let q of X.listParentEdges(W)){let F=q.getParent();if(F!==J&&DM1(F,G,q.getName(),Y))q.dispose()}if(W.listParents().length===1)W.dispose(),Y.debug(`${vW}: Removed solid-color texture "${z}" (${H}px ${V.join(", ")})`)});await Promise.all(Q)}function DM1(Z,J,X,Y){if(Z instanceof L7)switch(X){case"baseColorTexture":return Z.setBaseColorFactor(UM1(J,J,Z.getBaseColorFactor())),!0;case"emissiveTexture":return Z.setEmissiveFactor(YM1([0,0,0],J.slice(0,3),Z.getEmissiveFactor())),!0;case"occlusionTexture":return Math.abs(J[0]-1)<=sT;case"metallicRoughnessTexture":return Z.setRoughnessFactor(J[1]*Z.getRoughnessFactor()),Z.setMetallicFactor(J[2]*Z.getMetallicFactor()),!0;case"normalTexture":return vo(Io(Eo(),J,[0.5,0.5,1,1]))<=sT}return Y.warn(`${vW}: Detected single-color ${X} texture. Pruning ${X} not yet supported.`),!1}async function PM1(Z){let J=await CM1(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,W]=J.shape;for(let K=0;K<Q;K++){for(let G=0;G<W;G++)for(let z=0;z<4;z++)X[z]=Math.min(X[z],J.get(K,G,z)),Y[z]=Math.max(Y[z],J.get(K,G,z));if(vo(Io($,Y,X))/255>sT)return null}return qM1($,zM1($,Y,X),0.00196078431372549)}async function CM1(Z){try{return await Os(Z.getImage(),Z.getMimeType())}catch(J){return null}}var yJ=4294967295;class Ao{constructor(Z){this.attributes=[],this.u8=void 0,this.u32=void 0;let J=0;for(let X of Jk(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(),$=o0.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 TM1(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 TM1(Z,J){for(let $=0,Q=J.length;$<Q;$++){let W=J[$];W=Math.imul(W,1540483477)>>>0,W=(W^W>>24)>>>0,W=Math.imul(W,1540483477)>>>0,Z=Math.imul(Z,1540483477)>>>0,Z=(Z^W)>>>0}return Z}function kM1(Z,J,X,Y,$=yJ){let Q=J-1,K=X.hash(Y)&Q;for(let G=0;G<=Q;G++){let z=Z[K];if(z===$||X.equal(z,Y))return K;K=K+G+1&Q}throw new Error("Hash table full.")}var O6;(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"})(O6||(O6={}));function mJ(Z,J){let X=Z.getAttribute("POSITION"),Y=Z.getIndices();switch(J){case O6.RENDER:return Y?Y.getCount():X.getCount();case O6.RENDER_CACHED:return Y?new Set(Y.getArray()).size:X.getCount();case O6.UPLOAD_NAIVE:case O6.UPLOAD:return X.getCount();case O6.DISTINCT:case O6.DISTINCT_POSITION:return EM1(J);case O6.UNUSED:return Y?X.getCount()-new Set(Y.getArray()).size:0;default:return IM1(J)}}function EM1(Z){throw new Error(`Not implemented: ${Z}`)}function IM1(Z){throw new Error(`Unexpected value: ${Z}`)}function Hz(Z,J,X){let Y=E6.fromGraph(Z.getGraph());if(!J||!X)[J,X]=vM1(Z);let $=Z.getIndices(),Q=$?$.getArray():null,W=mJ(Z,O6.RENDER),K=Y.createAccessor(),G=W,z=Xk(G,X);for(let V=0;V<G;V++)z[V]=J[Q?Q[V]:V];Z.setIndices(K.setArray(z));let H=Jk(Z);for(let V of Z.listAttributes()){let q=EZ(Y,V);oT(V,$,J,q,X),Z.swap(V,q)}for(let V of Z.listTargets())for(let q of V.listAttributes()){let F=EZ(Y,q);oT(q,$,J,F,X),V.swap(q,F)}if($&&$.listParents().length===1)$.dispose();for(let V of H)if(V.listParents().length===1)V.dispose();return Z}function oT(Z,J,X,Y,$){let Q=Z.getElementSize(),W=Z.getArray(),K=J?J.getArray():null,G=J?J.getCount():Z.getCount(),z=new W.constructor($*Q),H=new Uint8Array($);for(let V=0;V<G;V++){let q=K?K[V]:V,F=X[q];if(H[F])continue;for(let U=0;U<Q;U++)z[F*Q+U]=W[q*Q+U];H[F]=1}return Y.setArray(z)}function vM1(Z){let J=mJ(Z,O6.UPLOAD),X=Z.getIndices(),Y=X?X.getArray():null;if(!X||!Y)return[dj1(J,1e6),J];let $=new Uint32Array(J).fill(yJ),Q=0;for(let W=0;W<Y.length;W++){let K=Y[W];if($[K]===yJ)$[K]=Q++}return[$,Q]}var rT="weld",_w={overwrite:!0,cleanup:!0};function Yk(Z=_w){let J=T7(_w,Z);return uJ(rT,async(X)=>{let Y=X.getLogger();for(let $ of X.getRoot().listMeshes()){for(let Q of $.listPrimitives())if(yw(Q,J),mJ(Q,O6.RENDER)===0)Q.dispose();if($.listPrimitives().length===0)$.dispose()}if(J.cleanup)await X.transform(bw({propertyTypes:[a.ACCESSOR,a.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),To({propertyTypes:[a.ACCESSOR]}));Y.debug(`${rT}: Complete.`)})}function yw(Z,J=_w){let X=Z.getGraph(),$=E6.fromGraph(X).getLogger(),Q=SW({},_w,J);if(Z.getIndices()&&!Q.overwrite)return;if(Z.getMode()===E8.Mode.POINTS)return;let W=Z.getAttribute("POSITION").getCount(),K=Z.getIndices(),G=K==null?void 0:K.getArray(),z=K?K.getCount():W,H=new Ao(Z),V=lj1(W+W/4),q=new Uint32Array(V).fill(yJ),F=new Uint32Array(W).fill(yJ),U=0;for(let B=0;B<z;B++){let w=G?G[B]:B;if(F[w]!==yJ)continue;let O=kM1(q,V,H,w,yJ),N=q[O];if(N===yJ)q[O]=w,F[w]=U++;else F[w]=F[N]}$.debug(`${rT}: ${hw(W,U)} vertices.`),Hz(Z,F,U)}var{FLOAT:SM1}=h0.ComponentType;function ho(Z,J){let X=Z.getAttribute("POSITION");if(X)Wo(J,X);let Y=Z.getAttribute("NORMAL");if(Y)Ko(J,Y);let $=Z.getAttribute("TANGENT");if($)Go(J,$);for(let Q of Z.listTargets()){let W=Q.getAttribute("POSITION");if(W)Wo(J,W);let K=Q.getAttribute("NORMAL");if(K)Ko(J,K);let G=Q.getAttribute("TANGENT");if(G)Go(J,G)}if(sj1(J)<0)_M1(Z)}function Wo(Z,J){let X=J.getComponentType(),Y=J.getNormalized(),$=J.getArray(),Q=X===SM1?$:new Float32Array($.length),W=fw();for(let K=0,G=J.getCount();K<G;K++){if(Y)W[0]=i0.decodeNormalizedInt($[K*3],X),W[1]=i0.decodeNormalizedInt($[K*3+1],X),W[2]=i0.decodeNormalizedInt($[K*3+2],X);else W[0]=$[K*3],W[1]=$[K*3+1],W[2]=$[K*3+2];JM1(W,W,Z),Q[K*3]=W[0],Q[K*3+1]=W[1],Q[K*3+2]=W[2]}J.setArray(Q).setNormalized(!1)}function Ko(Z,J){let X=J.getArray(),Y=J.getNormalized(),$=J.getComponentType(),Q=oj1();rj1(Q,Z),ej1(Q,Q),tj1(Q,Q);let W=fw();for(let K=0,G=J.getCount();K<G;K++){if(Y)W[0]=i0.decodeNormalizedInt(X[K*3],$),W[1]=i0.decodeNormalizedInt(X[K*3+1],$),W[2]=i0.decodeNormalizedInt(X[K*3+2],$);else W[0]=X[K*3],W[1]=X[K*3+1],W[2]=X[K*3+2];if(XM1(W,W,Q),Co(W,W),Y)X[K*3]=i0.decodeNormalizedInt(W[0],$),X[K*3+1]=i0.decodeNormalizedInt(W[1],$),X[K*3+2]=i0.decodeNormalizedInt(W[2],$);else X[K*3]=W[0],X[K*3+1]=W[1],X[K*3+2]=W[2]}}function Go(Z,J){let X=J.getArray(),Y=J.getNormalized(),$=J.getComponentType(),Q=fw();for(let W=0,K=J.getCount();W<K;W++){if(Y)Q[0]=i0.decodeNormalizedInt(X[W*4],$),Q[1]=i0.decodeNormalizedInt(X[W*4+1],$),Q[2]=i0.decodeNormalizedInt(X[W*4+2],$);else Q[0]=X[W*4],Q[1]=X[W*4+1],Q[2]=X[W*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],Co(Q,Q),Y)X[W*4]=i0.decodeNormalizedInt(Q[0],$),X[W*4+1]=i0.decodeNormalizedInt(Q[1],$),X[W*4+2]=i0.decodeNormalizedInt(Q[2],$);else X[W*4]=Q[0],X[W*4+1]=Q[1],X[W*4+2]=Q[2]}}function _M1(Z){if(Z.getMode()!==E8.Mode.TRIANGLES)return;if(!Z.getIndices())yw(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 xM1(Z,J){for(let X of Z.listPrimitives()){let Y=AM1(X,Z);if(X!==Y)Z.removePrimitive(X).addPrimitive(Y)}for(let X of Z.listPrimitives())Hz(X),ho(X,J)}function AM1(Z,J){if(Z.listParents().some((Y)=>Y instanceof mG&&Y!==J))Z=Z.clone();for(let Y of Z.listTargets())if(Y.listParents().some((Q)=>Q instanceof E8&&Q!==Z))Z.removeTarget(Y).addTarget(Y.clone());return Z}var zo=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function fo(Z){let J=Z.getMesh(),X=Z.getMatrix();if(J&&!i0.eq(X,zo))xM1(J,X);for(let Y of Z.listChildren()){let $=Y.getMatrix();Po($,$,X),Y.setMatrix($)}return Z.setMatrix(zo)}var{LINES:hM1,LINE_STRIP:fM1,LINE_LOOP:bM1,TRIANGLES:yM1,TRIANGLE_STRIP:gM1,TRIANGLE_FAN:mM1}=E8.Mode;function uM1(Z){let J=Z.getGraph(),X=E6.fromGraph(J);if(!Z.getIndices())yw(Z);let Y=Z.getIndices(),$=Y.getArray(),Q=Mo(Z),K=new IJ[Y.getComponentType()](Q*2),G=Z.getMode();if(G===fM1)for(let H=0;H<Q;H++)K[H*2]=$[H],K[H*2+1]=$[H+1];else if(G===bM1)for(let H=0;H<Q;H++)if(H<Q-1)K[H*2]=$[H],K[H*2+1]=$[H+1];else K[H*2]=$[H],K[H*2+1]=$[0];else throw new Error("Only LINE_STRIP and LINE_LOOP may be converted to LINES.");Z.setMode(hM1);let z=X.getRoot();if(Y.listParents().some((H)=>H!==z&&H!==Z))Z.setIndices(EZ(X,Y).setArray(K));else Y.setArray(K)}function bo(Z){let J=Z.getGraph(),X=E6.fromGraph(J);if(!Z.getIndices())yw(Z);let Y=Z.getIndices(),$=Y.getArray(),Q=Mo(Z),K=new IJ[Y.getComponentType()](Q*3),G=Z.getMode();if(G===gM1)for(let H=0,V=$.length;H<V-2;H++)if(H%2)K[H*3]=$[H+1],K[H*3+1]=$[H],K[H*3+2]=$[H+2];else K[H*3]=$[H],K[H*3+1]=$[H+1],K[H*3+2]=$[H+2];else if(G===mM1)for(let H=0;H<Q;H++)K[H*3]=$[0],K[H*3+1]=$[H+1],K[H*3+2]=$[H+2];else throw new Error("Only TRIANGLE_STRIP and TRIANGLE_FAN may be converted to TRIANGLES.");Z.setMode(yM1);let z=X.getRoot();if(Y.listParents().some((H)=>H!==z&&H!==Z))Z.setIndices(EZ(X,Y).setArray(K));else Y.setArray(K)}var Ho="dequantize",xw={pattern:/^((?!JOINTS_).)*$/};function yo(Z=xw){let J=T7(xw,Z);return uJ(Ho,(X)=>{let Y=X.getLogger();for(let $ of X.getRoot().listMeshes())for(let Q of $.listPrimitives())dM1(Q,J);X.createExtension(Gz).dispose(),Y.debug(`${Ho}: Complete.`)})}function dM1(Z,J=xw){let X=T7(xw,J);for(let Y of Z.listSemantics())if(X.pattern.test(Y))tT(Z.getAttribute(Y));for(let Y of Z.listTargets())for(let $ of Y.listSemantics())if(X.pattern.test($))tT(Y.getAttribute($))}function tT(Z){let J=Z.getArray();if(!J)return;let X=Aw(J,Z.getComponentType(),Z.getNormalized());Z.setArray(X).setNormalized(!1)}function Aw(Z,J,X){let Y=new Float32Array(Z.length);for(let $=0,Q=Z.length;$<Q;$++)if(X)Y[$]=i0.decodeNormalizedInt(Z[$],J);else Y[$]=Z[$];return Y}var{TEXTURE_INFO:go,ROOT:nU6}=a;function mo(Z){let J=new E6().setLogger(Z.getLogger()),X=$k(J,Z);return cM1(J,Z,X),J.getRoot().copy(Z.getRoot(),X),J}function cM1(Z,J,X){X||(X=$k(Z,J));for(let Y of J.getRoot().listExtensionsUsed()){let $=Z.createExtension(Y.constructor);if(Y.isRequired())$.setRequired(!0)}return lM1(Z,J,pM1(J),X)}function lM1(Z,J,X,Y){Y||(Y=$k(Z,J));let $=new Map;for(let Q of X)if(!$.has(Q)&&Q.propertyType!==go)$.set(Q,Y(Q));for(let[Q,W]of $.entries())W.copy(Q,Y);return $}function $k(Z,J){let X=new Map([[J.getRoot(),Z.getRoot()]]);return(Y)=>{if(Y.propertyType===go)return Y;let $=X.get(Y);if(!$)$=new Y.constructor(Z.getGraph()),X.set(Y,$);return $}}function pM1(Z){let J=new Set;for(let X of Z.getGraph().listEdges())J.add(X.getChild());return Array.from(J)}var iT="flatten",Vo={cleanup:!0};function uo(Z=Vo){let J=T7(Vo,Z);return uJ(iT,async(X)=>{let Y=X.getRoot(),$=X.getLogger(),Q=new Set;for(let z of Y.listSkins())for(let H of z.listJoints())Q.add(H);let W=new Set;for(let z of Y.listAnimations())for(let H of z.listChannels()){let V=H.getTargetNode();if(V&&H.getTargetPath()!=="weights")W.add(V)}let K=new Set,G=new Set;for(let z of Y.listScenes())z.traverse((H)=>{let V=H.getParentNode();if(!V)return;if(Q.has(V)||K.has(V))K.add(H);if(W.has(V)||G.has(V))G.add(H)});for(let z of Y.listScenes())z.traverse((H)=>{if(W.has(H))return;if(K.has(H))return;if(G.has(H))return;nj1(H)});if(W.size)$.debug(`${iT}: Flattening node hierarchies with TRS animation not yet supported.`);if(J.cleanup)await X.transform(bw({propertyTypes:[a.NODE],keepLeaves:!1}));$.debug(`${iT}: Complete.`)})}function co(Z){return eP(Z)}var iM1={skipValidation:!1},qo=4294967295,{LINE_STRIP:nM1,LINE_LOOP:aM1,TRIANGLE_STRIP:sM1,TRIANGLE_FAN:oM1}=E8.Mode;function rM1(Z,J={}){let X=T7(iM1,J),Y=Z[0],$=E6.fromGraph(Y.getGraph());if(!X.skipValidation&&new Set(Z.map(No)).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 nM1:case aM1:uM1(F);break;case sM1:case oM1:bo(F);break}let Q=[],W=new Uint32Array(Z.length),K=0,G=0;for(let F=0;F<Z.length;F++){let U=Z[F],B=U.getIndices(),w=U.getAttribute("POSITION").getCount(),O=B?B.getArray():null,N=B?B.getCount():w,R=new Uint32Array(w).fill(qo);for(let j=0;j<N;j++){let P=O?O[j]:j;if(R[P]===qo)R[P]=K++,W[F]++}Q.push(R),G+=N}let z=$.createPrimitive().setMode(Y.getMode()).setMaterial(Y.getMaterial());for(let F of Y.listSemantics()){let U=Y.getAttribute(F),B=IJ[U.getComponentType()],w=EZ($,U).setArray(new B(K*U.getElementSize()));z.setAttribute(F,w)}let H=Y.getIndices(),V=H?EZ($,H).setArray(Xk(G,K)):null;z.setIndices(V);let q=0;for(let F=0;F<Q.length;F++){let U=Z[F],B=U.getIndices(),w=B?B.getCount():-1,O=Q[F];if(B&&V)eM1(B,O,V,q),q+=w;for(let N of z.listSemantics()){let R=U.getAttribute(N),j=z.getAttribute(N);tM1(R,B,O,j)}}return z}function tM1(Z,J,X,Y){let $=Z.getElementSize(),Q=J?J.getArray():null,W=Z.getCount(),K=Z.getArray(),G=Y.getArray(),z=new Uint8Array(Z.getCount());for(let H=0,V=J?J.getCount():W;H<V;H++){let q=Q?Q[H]:H,F=X[q];if(z[F])continue;for(let U=0;U<$;U++)G[F*$+U]=K[q*$+U];z[F]=1}}function eM1(Z,J,X,Y){let $=Z.getCount(),Q=Z.getArray(),W=X.getArray();for(let K=0;K<$;K++){let G=Q[K],z=J[G];W[Y+K]=z}}var eT="join",{ROOT:ZR1,NODE:JR1,MESH:XR1,PRIMITIVE:YR1,ACCESSOR:$R1}=a,nT=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Fo={keepMeshes:!1,keepNamed:!1,cleanup:!0};function lo(Z=Fo){let J=T7(Fo,Z);return uJ(eT,async(X)=>{let Y=X.getRoot(),$=X.getLogger();for(let Q of Y.listScenes())Uo(X,Q,J),Q.traverse((W)=>Uo(X,W,J));if(J.cleanup)await X.transform(bw({propertyTypes:[JR1,XR1,YR1,$R1],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}));$.debug(`${eT}: Complete.`)})}function Uo(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 EY))continue;let V=z.getMesh();if(!V)continue;if(z.getExtension("EXT_mesh_gpu_instancing"))continue;if(z.getSkin())continue;for(let q of V.listPrimitives()){if(q.listTargets().length>0)continue;let F=q.getMaterial();if(F&&F.getExtension("KHR_materials_volume"))continue;Hz(q),WR1(q);let U=No(q),B=V.getName()||z.getName();if(X.keepMeshes||X.keepNamed&&B)U+=`|${G}`;if(!(U in $))$[U]={prims:[],primMeshes:[],primNodes:[],dstNode:z,dstMesh:void 0};let w=$[U];w.prims.push(q),w.primNodes.push(z)}}let W=Object.values($).filter(({prims:G})=>G.length>1),K=new Set(W.flatMap((G)=>G.primNodes));for(let G of K){let z=G.getMesh();if(z.listParents().some((V)=>{return V.propertyType!==ZR1&&G!==V}))G.setMesh(z.clone())}for(let G of W){let{dstNode:z,primNodes:H}=G;G.dstMesh=z.getMesh(),G.primMeshes=H.map((V)=>V.getMesh())}for(let G of W){let{prims:z,primNodes:H,primMeshes:V,dstNode:q,dstMesh:F}=G,U=q.getMatrix();for(let O=0;O<z.length;O++){let N=H[O],R=V[O],j=z[O];if(R.removePrimitive(j),cj1(j))j=z[O]=QR1(z[O]);if(N!==q)Po(nT,aj1(nT,U),N.getMatrix()),ho(j,nT)}let B=rM1(z),w=B.listAttributes()[0].getCount();F.addPrimitive(B),Y.debug(`${eT}: Joined Primitives (${z.length}) containing ${aT(w)} vertices under Node "${q.getName()}".`)}}function QR1(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 WR1(Z){for(let J of["POSITION","NORMAL","TANGENT"]){let X=Z.getAttribute(J);if(X)tT(X)}}var{TRANSLATION:aU6,ROTATION:sU6,SCALE:oU6,WEIGHTS:rU6}=EY.TargetPath;var KR1={pattern:/.*/,quantizationVolume:"mesh",quantizePosition:14,quantizeNormal:10,quantizeTexcoord:12,quantizeColor:8,quantizeWeight:8,quantizeGeneric:12,normalizeWeights:!0,cleanup:!0};var tU6=SW({level:"high"},KR1);var GR1="unweld";function zR1(Z,J=new Map){let X=Z.getIndices();if(!X)return;let Y=Z.getGraph(),$=E6.fromGraph(Y),Q=$.getLogger(),W=Z.getAttribute("POSITION").getCount();for(let G of Z.listAttributes())if(Z.swap(G,wo($,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,wo($,z,X,J)),z.listParents().length===1)z.dispose();let K=Z.getAttribute("POSITION").getCount();if(Q.debug(`${GR1}: ${hw(W,K)} vertices.`),Z.setIndices(null),X.listParents().length===1)X.dispose()}function wo(Z,J,X,Y){if(Y.has(J)&&Y.get(J).has(X))return Y.get(J).get(X);let $=J.getArray(),W=new $.constructor(X.getCount()*J.getElementSize()),K=X.getArray(),G=J.getElementSize();for(let H=0,V=X.getCount();H<V;H++)for(let q=0;q<G;q++)W[H*G+q]=$[K[H]*G+q];if(!Y.has(J))Y.set(J,new Map);let z=EZ(Z,J).setArray(W);return Y.get(J).set(X,z),z}var Bo;(function(Z){Z[Z.STEP=0]="STEP",Z[Z.LERP=1]="LERP",Z[Z.SLERP=2]="SLERP"})(Bo||(Bo={}));var HR1=0.000001;function VR1(Z,J,X,Y=0.0001){let $=J.length/Z.length,Q=new Array($).fill(0),W=new Array($).fill(0),K=new Array($).fill(0),G=new Array($).fill(0),z=Z.length-1,H=1;for(let V=1;V<z;++V){let q=Z[H-1],F=Z[V],U=Z[V+1],B=(F-q)/(U-q),w=!1;if(F!==U&&(V!==1||F!==Z[0])){if(zz(J,H-1,G),zz(J,V,W),zz(J,V+1,K),X==="slerp"){let O=UR1(Q,G,K,B),N=Oo(G,W)+Oo(W,K);w=!Sw(W,O,Y)||N+Number.EPSILON>=Math.PI}else if(X==="lerp"){let O=FR1(Q,G,K,B);w=!Sw(W,O,Y)}else if(X==="step")w=!Sw(W,G)||!Sw(W,K)}if(w){if(V!==H)Z[H]=Z[V],Lo(J,H,zz(J,V,Q));H++}}if(z>0)Z[H]=Z[z],Lo(J,H,zz(J,z,Q)),H++;return H}function zz(Z,J,X){for(let Y=0,$=X.length;Y<$;Y++)X[Y]=Z[J*$+Y];return X}function Lo(Z,J,X){for(let Y=0,$=X.length;Y<$;Y++)Z[J*$+Y]=X[Y]}function Sw(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 qR1(Z,J,X){return Z*(1-X)+J*X}function FR1(Z,J,X,Y){for(let $=0;$<J.length;$++)Z[$]=qR1(J[$],X[$],Y);return Z}function UR1(Z,J,X,Y){let $=J[0],Q=J[1],W=J[2],K=J[3],G=X[0],z=X[1],H=X[2],V=X[3],q,F,U,B,w;if(F=$*G+Q*z+W*H+K*V,F<0)F=-F,G=-G,z=-z,H=-H,V=-V;if(1-F>HR1)q=Math.acos(F),U=Math.sin(q),B=Math.sin((1-Y)*q)/U,w=Math.sin(Y*q)/U;else B=1-Y,w=Y;return Z[0]=B*$+w*G,Z[1]=B*Q+w*z,Z[2]=B*W+w*H,Z[3]=B*K+w*V,Z}function Oo(Z,J){let X=wR1(Z,J);return Math.acos(2*X*X-1)}function wR1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}var eU6=new Float32Array(0),Z26={ready:Promise.resolve(),resample:VR1,tolerance:0.0001,cleanup:!0};var rY="simplify",{POINTS:po,LINES:BR1,LINE_STRIP:LR1,LINE_LOOP:OR1,TRIANGLES:jR1,TRIANGLE_STRIP:io,TRIANGLE_FAN:no}=E8.Mode,ao={ratio:0,error:0.0001,lockBorder:!1,cleanup:!0};function so(Z){let J=T7(ao,Z),X=J.simplifier;if(!X)throw new Error(`${rY}: simplifier dependency required \u2014 install "meshoptimizer".`);return uJ(rY,async(Y)=>{let $=Y.getLogger();await X.ready,await Y.transform(Yk({overwrite:!1,cleanup:J.cleanup}));let Q=0;for(let W of Y.getRoot().listMeshes()){for(let K of W.listPrimitives()){let G=K.getMode();if(G===jR1||G===io||G===no){if(jo(K,J),mJ(K,O6.RENDER)===0)K.dispose()}else if(K.getMode()===po&&!!X.simplifyPoints){if(jo(K,J),mJ(K,O6.RENDER)===0)K.dispose()}else Q++}if(W.listPrimitives().length===0)W.dispose()}if(Q>0)$.warn(`${rY}: Skipping simplification of ${Q} primitives: Unsupported draw mode.`);if(J.cleanup)await Y.transform(bw({propertyTypes:[a.ACCESSOR,a.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),To({propertyTypes:[a.ACCESSOR]}));$.debug(`${rY}: Complete.`)})}function jo(Z,J){let X=SW({},ao,J),Y=X.simplifier,$=Z.getGraph(),Q=E6.fromGraph($),W=Q.getLogger();switch(Z.getMode()){case po:return MR1(Q,Z,X);case BR1:case LR1:case OR1:return W.warn(`${rY}: Skipping primitive simplification: Unsupported draw mode.`),Z;case io:case no:bo(Z);break}let K=mJ(Z,O6.UPLOAD),G=mJ(Z,O6.RENDER);if(G<K/2)Hz(Z);let z=Z.getAttribute("POSITION"),H=Z.getIndices(),V=z.getArray(),q=H.getArray();if(!(V instanceof Float32Array))V=Aw(V,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"]:[],[B,w]=Y.simplify(q,V,3,F,X.error,U);if(Z.setIndices(EZ(Q,H).setArray(B)),H.listParents().length===1)H.dispose();Hz(Z);let O=mJ(Z,O6.UPLOAD);if(O<=65534)Z.getIndices().setArray(new Uint16Array(Z.getIndices().getArray()));return W.debug(`${rY}: ${hw(K,O)} vertices, error: ${w.toFixed(4)}.`),Z}function MR1(Z,J,X){let Y=X.simplifier,$=Z.getLogger();if(J.getIndices())zR1(J);let W=J.getAttribute("POSITION"),K=J.getAttribute("COLOR_0"),G=W.getCount(),z=W.getArray(),H=K?K.getArray():void 0,V=K?K.getComponentSize():void 0;if(!(z instanceof Float32Array))z=Aw(z,W.getComponentType(),W.getNormalized());if(H&&!(H instanceof Float32Array))H=Aw(H,W.getComponentType(),W.getNormalized());Y.useExperimentalFeatures=!0;let q=Math.floor(X.ratio*G),F=Y.simplifyPoints(z,3,q,H,V);Y.useExperimentalFeatures=!1;let[U,B]=Y.compactMesh(F);$.debug(`${rY}: ${hw(W.getCount(),B)} vertices.`);for(let w of Jk(J)){let O=EZ(Z,w);if(oT(w,null,U,O,B),mj1(J,w,O),w.listParents().length===1)w.dispose()}return J}var Zk;(function(Z){Z.LANCZOS3="lanczos3",Z.LANCZOS2="lanczos2"})(Zk||(Zk={}));var J26={resizeFilter:Zk.LANCZOS3,pattern:void 0,formats:void 0,slots:void 0,quality:void 0,effort:void 0,lossless:!1,nearLossless:!1,limitInputPixels:!0};var Y26=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 B=0;B<F.length;++B){var w=F.charCodeAt(B);U[B]=w>96?w-97:w>64?w-39:w+4}var O=0;for(var B=0;B<F.length;++B)U[O++]=U[B]<60?J[U[B]]:(U[B]-60)*64+U[++B];return U.buffer.slice(0,O)}function Q(F){if(!F)throw new Error("Assertion failed")}function W(F){return new Uint8Array(F.buffer,F.byteOffset,F.byteLength)}function K(F,U,B,w){var O=X.exports.sbrk,N=O(U.length*4),R=O(B*4),j=new Uint8Array(X.exports.memory.buffer),P=W(U);if(j.set(P,N),w)w(N,N,U.length,B);var D=F(R,N,U.length,B);j=new Uint8Array(X.exports.memory.buffer);var C=new Uint32Array(B);new Uint8Array(C.buffer).set(j.subarray(R,R+B*4)),P.set(j.subarray(N,N+U.length*4)),O(N-O(0));for(var T=0;T<U.length;++T)U[T]=C[U[T]];return[C,D]}function G(F,U,B,w){var O=X.exports.sbrk,N=O(B*4),R=O(B*w),j=new Uint8Array(X.exports.memory.buffer);j.set(W(U),R),F(N,R,B,w),j=new Uint8Array(X.exports.memory.buffer);var P=new Uint32Array(B);return new Uint8Array(P.buffer).set(j.subarray(N,N+B*4)),O(N-O(0)),P}function z(F,U,B,w,O){var N=X.exports.sbrk,R=N(U),j=N(w*O),P=new Uint8Array(X.exports.memory.buffer);P.set(W(B),j);var D=F(R,U,j,w,O),C=new Uint8Array(D);return C.set(P.subarray(R,R+D)),N(R-N(0)),C}function H(F){var U=0;for(var B=0;B<F.length;++B){var w=F[B];U=U<w?w:U}return U}function V(F,U){if(Q(U==2||U==4),U==4)return new Uint32Array(F.buffer,F.byteOffset,F.byteLength/4);else{var B=new Uint16Array(F.buffer,F.byteOffset,F.byteLength/2);return new Uint32Array(B)}}function q(F,U,B,w,O,N,R){var j=X.exports.sbrk,P=j(B*w),D=j(B*N),C=new Uint8Array(X.exports.memory.buffer);C.set(W(U),D),F(P,B,w,O,D,R);var T=new Uint8Array(B*w);return T.set(C.subarray(P,P+B*w)),j(P-j(0)),T}return{ready:Y,supported:!0,reorderMesh:function(F,U,B){var w=U?B?X.exports.meshopt_optimizeVertexCacheStrip:X.exports.meshopt_optimizeVertexCache:void 0;return K(X.exports.meshopt_optimizeVertexFetchRemap,F,H(F)+1,w)},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,B){Q(B>0&&B<=256),Q(B%4==0);var w=X.exports.meshopt_encodeVertexBufferBound(U,B);return z(X.exports.meshopt_encodeVertexBuffer,w,F,U,B)},encodeIndexBuffer:function(F,U,B){Q(B==2||B==4),Q(U%3==0);var w=V(F,B),O=X.exports.meshopt_encodeIndexBufferBound(U,H(w)+1);return z(X.exports.meshopt_encodeIndexBuffer,O,w,U,4)},encodeIndexSequence:function(F,U,B){Q(B==2||B==4);var w=V(F,B),O=X.exports.meshopt_encodeIndexSequenceBound(U,H(w)+1);return z(X.exports.meshopt_encodeIndexSequence,O,w,U,4)},encodeGltfBuffer:function(F,U,B,w){var O={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return Q(O[w]),O[w](F,U,B)},encodeFilterOct:function(F,U,B,w){return Q(B==4||B==8),Q(w>=1&&w<=16),q(X.exports.meshopt_encodeFilterOct,F,U,B,w,16)},encodeFilterQuat:function(F,U,B,w){return Q(B==8),Q(w>=4&&w<=16),q(X.exports.meshopt_encodeFilterQuat,F,U,B,w,16)},encodeFilterExp:function(F,U,B,w,O){Q(B>0&&B%4==0),Q(w>=1&&w<=24);var N={Separate:0,SharedVector:1,SharedComponent:2,Clamped:3};return q(X.exports.meshopt_encodeFilterExp,F,U,B,w,B,O?N[O]:1)}}}();var Q26=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)?K(J):K(Z),Q,W=WebAssembly.instantiate($,{}).then(function(O){Q=O.instance,Q.exports.__wasm_call_ctors()});function K(O){var N=new Uint8Array(O.length);for(var R=0;R<O.length;++R){var j=O.charCodeAt(R);N[R]=j>96?j-97:j>64?j-39:j+4}var P=0;for(var R=0;R<O.length;++R)N[P++]=N[R]<60?Y[N[R]]:(N[R]-60)*64+N[++R];return N.buffer.slice(0,P)}function G(O,N,R,j,P,D,C){var T=O.exports.sbrk,k=j+3&-4,x=T(k*P),S=T(D.length),A=new Uint8Array(O.exports.memory.buffer);A.set(D,S);var I=N(x,j,P,S,D.length);if(I==0&&C)C(x,k,P);if(R.set(A.subarray(x,x+j*P)),T(x-T(0)),I!=0)throw new Error("Malformed buffer data: "+I)}var z={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},H={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},V=[],q=0;function F(O){var N={object:new Worker(O),pending:0,requests:{}};return N.object.onmessage=function(R){var j=R.data;N.pending-=j.count,N.requests[j.id][j.action](j.value),delete N.requests[j.id]},N}function U(O){var N="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array($)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+w.name+";"+G.toString()+w.toString(),R=new Blob([N],{type:"text/javascript"}),j=URL.createObjectURL(R);for(var P=V.length;P<O;++P)V[P]=F(j);for(var P=O;P<V.length;++P)V[P].object.postMessage({});V.length=O,URL.revokeObjectURL(j)}function B(O,N,R,j,P){var D=V[0];for(var C=1;C<V.length;++C)if(V[C].pending<D.pending)D=V[C];return new Promise(function(T,k){var x=new Uint8Array(R),S=++q;D.pending+=O,D.requests[S]={resolve:T,reject:k},D.object.postMessage({id:S,count:O,size:N,source:x,mode:j,filter:P},[x.buffer])})}function w(O){var N=O.data;if(!N.id)return self.close();self.ready.then(function(R){try{var j=new Uint8Array(N.count*N.size);G(R,R.exports[N.mode],j,N.count,N.size,N.source,R.exports[N.filter]),self.postMessage({id:N.id,count:N.count,action:"resolve",value:j},[j.buffer])}catch(P){self.postMessage({id:N.id,count:N.count,action:"reject",value:P})}})}return{ready:W,supported:!0,useWorkers:function(O){U(O)},decodeVertexBuffer:function(O,N,R,j,P){G(Q,Q.exports.meshopt_decodeVertexBuffer,O,N,R,j,Q.exports[z[P]])},decodeIndexBuffer:function(O,N,R,j){G(Q,Q.exports.meshopt_decodeIndexBuffer,O,N,R,j)},decodeIndexSequence:function(O,N,R,j){G(Q,Q.exports.meshopt_decodeIndexSequence,O,N,R,j)},decodeGltfBuffer:function(O,N,R,j,P,D){G(Q,Q.exports[H[P]],O,N,R,j,Q.exports[z[D]])},decodeGltfBufferAsync:function(O,N,R,j,P){if(V.length>0)return B(O,N,R,H[j],z[P]);return W.then(function(){var D=new Uint8Array(O*N);return G(Q,Q.exports[H[j]],D,O,N,R,Q.exports[z[P]]),D})}}}();var oo=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 B=new Uint8Array(U.length);for(var w=0;w<U.length;++w){var O=U.charCodeAt(w);B[w]=O>96?O-97:O>64?O-39:O+4}var N=0;for(var w=0;w<U.length;++w)B[N++]=B[w]<60?J[B[w]]:(B[w]-60)*64+B[++w];return B.buffer.slice(0,N)}function Q(U){if(!U)throw new Error("Assertion failed")}function W(U){return new Uint8Array(U.buffer,U.byteOffset,U.byteLength)}function K(U,B,w){var O=X.exports.sbrk,N=O(B.length*4),R=O(w*4),j=new Uint8Array(X.exports.memory.buffer),P=W(B);j.set(P,N);var D=U(R,N,B.length,w);j=new Uint8Array(X.exports.memory.buffer);var C=new Uint32Array(w);new Uint8Array(C.buffer).set(j.subarray(R,R+w*4)),P.set(j.subarray(N,N+B.length*4)),O(N-O(0));for(var T=0;T<B.length;++T)B[T]=C[B[T]];return[C,D]}function G(U){var B=0;for(var w=0;w<U.length;++w){var O=U[w];B=B<O?O:B}return B}function z(U,B,w,O,N,R,j,P,D){var C=X.exports.sbrk,T=C(4),k=C(w*4),x=C(N*R),S=C(w*4),A=new Uint8Array(X.exports.memory.buffer);A.set(W(O),x),A.set(W(B),S);var I=U(k,S,w,x,N,R,j,P,D,T);A=new Uint8Array(X.exports.memory.buffer);var v=new Uint32Array(I);W(v).set(A.subarray(k,k+I*4));var b=new Float32Array(1);return W(b).set(A.subarray(T,T+4)),C(T-C(0)),[v,b[0]]}function H(U,B,w,O,N,R,j,P,D,C,T,k,x){var S=X.exports.sbrk,A=S(4),I=S(w*4),v=S(N*R),b=S(N*P),m=S(D.length*4),n=S(w*4),o=C?S(N):0,Q0=new Uint8Array(X.exports.memory.buffer);if(Q0.set(W(O),v),Q0.set(W(j),b),Q0.set(W(D),m),Q0.set(W(B),n),C)Q0.set(W(C),o);var K0=U(I,n,w,v,N,R,b,P,m,D.length,o,T,k,x,A);Q0=new Uint8Array(X.exports.memory.buffer);var _0=new Uint32Array(K0);W(_0).set(Q0.subarray(I,I+K0*4));var x0=new Float32Array(1);return W(x0).set(Q0.subarray(A,A+4)),S(A-S(0)),[_0,x0[0]]}function V(U,B,w,O){var N=X.exports.sbrk,R=N(w*O),j=new Uint8Array(X.exports.memory.buffer);j.set(W(B),R);var P=U(R,w,O);return N(R-N(0)),P}function q(U,B,w,O,N,R,j,P){var D=X.exports.sbrk,C=D(P*4),T=D(w*O),k=D(w*R),x=new Uint8Array(X.exports.memory.buffer);if(x.set(W(B),T),N)x.set(W(N),k);var S=U(C,T,w,O,k,R,j,P);x=new Uint8Array(X.exports.memory.buffer);var A=new Uint32Array(S);return W(A).set(x.subarray(C,C+S*4)),D(C-D(0)),A}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 B=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return K(X.exports.meshopt_optimizeVertexFetchRemap,B,G(U)+1)},simplify:function(U,B,w,O,N,R){Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0),Q(B instanceof Float32Array),Q(B.length%w==0),Q(w>=3),Q(O>=0&&O<=U.length),Q(O%3==0),Q(N>=0);var j=0;for(var P=0;P<(R?R.length:0);++P)Q(R[P]in F),Q(this.useExperimentalFeatures||R[P]!="Prune"),j|=F[R[P]];var D=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),C=z(X.exports.meshopt_simplify,D,U.length,B,B.length/w,w*4,O,N,j);return C[0]=U instanceof Uint32Array?C[0]:new U.constructor(C[0]),C},simplifyWithAttributes:function(U,B,w,O,N,R,j,P,D,C){Q(this.useExperimentalFeatures),Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0),Q(B instanceof Float32Array),Q(B.length%w==0),Q(w>=3),Q(O instanceof Float32Array),Q(O.length%N==0),Q(N>=0),Q(j==null||j instanceof Uint8Array),Q(j==null||j.length==B.length/w),Q(P>=0&&P<=U.length),Q(P%3==0),Q(D>=0),Q(Array.isArray(R)),Q(N>=R.length),Q(R.length<=32);for(var T=0;T<R.length;++T)Q(R[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 x=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),S=H(X.exports.meshopt_simplifyWithAttributes,x,U.length,B,B.length/w,w*4,O,N*4,new Float32Array(R),j?new Uint8Array(j):null,P,D,k);return S[0]=U instanceof Uint32Array?S[0]:new U.constructor(S[0]),S},getScale:function(U,B){return Q(U instanceof Float32Array),Q(U.length%B==0),Q(B>=3),V(X.exports.meshopt_simplifyScale,U,U.length/B,B*4)},simplifyPoints:function(U,B,w,O,N,R){if(Q(this.useExperimentalFeatures),Q(U instanceof Float32Array),Q(U.length%B==0),Q(B>=3),Q(w>=0&&w<=U.length/B),O)return Q(O instanceof Float32Array),Q(O.length%N==0),Q(N>=3),Q(U.length/B==O.length/N),q(X.exports.meshopt_simplifyPoints,U,U.length/B,B*4,O,N*4,R,w);else return q(X.exports.meshopt_simplifyPoints,U,U.length/B,B*4,void 0,0,0,w)}}}();var G26=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 B=new Uint8Array(U.length);for(var w=0;w<U.length;++w){var O=U.charCodeAt(w);B[w]=O>96?O-97:O>64?O-39:O+4}var N=0;for(var w=0;w<U.length;++w)B[N++]=B[w]<60?J[B[w]]:(B[w]-60)*64+B[++w];return B.buffer.slice(0,N)}function Q(U){if(!U)throw new Error("Assertion failed")}function W(U){return new Uint8Array(U.buffer,U.byteOffset,U.byteLength)}var K=48,G=16;function z(U,B){var w=U.meshlets[B*4+0],O=U.meshlets[B*4+1],N=U.meshlets[B*4+2],R=U.meshlets[B*4+3];return{vertices:U.vertices.subarray(w,w+N),triangles:U.triangles.subarray(O,O+R*3)}}function H(U,B,w,O,N,R,j){var P=X.exports.sbrk,D=X.exports.meshopt_buildMeshletsBound(U.length,N,R),C=P(D*G),T=P(D*N*4),k=P(D*R*3),x=P(U.byteLength),S=P(B.byteLength),A=new Uint8Array(X.exports.memory.buffer);A.set(W(U),x),A.set(W(B),S);var I=X.exports.meshopt_buildMeshlets(C,T,k,x,U.length,S,w,O,N,R,j);A=new Uint8Array(X.exports.memory.buffer);var v=A.subarray(C,C+I*G),b=new Uint32Array(v.buffer,v.byteOffset,v.byteLength/4).slice();for(var m=0;m<I;++m){var n=b[m*4+0],o=b[m*4+1],w=b[m*4+2],Q0=b[m*4+3];X.exports.meshopt_optimizeMeshlet(T+n*4,k+o,Q0,w)}var K0=b[(I-1)*4+0],_0=b[(I-1)*4+1],x0=b[(I-1)*4+2],r0=b[(I-1)*4+3],f8=K0+x0,X8=_0+(r0*3+3&-4),K7={meshlets:b,vertices:new Uint32Array(A.buffer,T,f8).slice(),triangles:new Uint8Array(A.buffer,k,X8*3).slice(),meshletCount:I};return P(C-P(0)),K7}function V(U){var B=new Float32Array(X.exports.memory.buffer,U,K/4);return{centerX:B[0],centerY:B[1],centerZ:B[2],radius:B[3],coneApexX:B[4],coneApexY:B[5],coneApexZ:B[6],coneAxisX:B[7],coneAxisY:B[8],coneAxisZ:B[9],coneCutoff:B[10]}}function q(U,B,w,O){var N=X.exports.sbrk,R=[],j=N(B.byteLength),P=N(U.vertices.byteLength),D=N(U.triangles.byteLength),C=N(K),T=new Uint8Array(X.exports.memory.buffer);T.set(W(B),j),T.set(W(U.vertices),P),T.set(W(U.triangles),D);for(var k=0;k<U.meshletCount;++k){var x=U.meshlets[k*4+0],S=U.meshlets[k*4+0+1],A=U.meshlets[k*4+0+3];X.exports.meshopt_computeMeshletBounds(C,P+x*4,D+S,A,j,w,O),R.push(V(C))}return N(j-N(0)),R}function F(U,B,w,O){var N=X.exports.sbrk,R=N(K),j=N(U.byteLength),P=N(B.byteLength),D=new Uint8Array(X.exports.memory.buffer);D.set(W(U),j),D.set(W(B),P),X.exports.meshopt_computeClusterBounds(R,j,U.length,P,w,O);var C=V(R);return N(R-N(0)),C}return{ready:Y,supported:!0,buildMeshlets:function(U,B,w,O,N,R){Q(U.length%3==0),Q(B instanceof Float32Array),Q(B.length%w==0),Q(w>=3),Q(O<=255||O>0),Q(N<=512),Q(N%4==0),R=R||0;var j=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return H(j,B,B.length/w,w*4,O,N,R)},computeClusterBounds:function(U,B,w){Q(U.length%3==0),Q(U.length/3<=512),Q(B instanceof Float32Array),Q(B.length%w==0),Q(w>=3);var O=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return F(O,B,B.length/w,w*4)},computeMeshletBounds:function(U,B,w){return Q(U.meshletCount!=0),Q(B instanceof Float32Array),Q(B.length%w==0),Q(w>=3),q(U,B,B.length/w,w*4)},extractMeshlet:function(U,B){return Q(B>=0&&B<U.meshletCount),z(U,B)}}}();var xW={OPTIMIZED_DIR:".optimized",CHECKSUM_EXT:".md5",DIRECTORIES:[(()=>{try{return Y9.dirname(c.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js"))}catch{return null}})(),Y9.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 k5{static instance=new k5;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)d.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)d.fatalError(`ModelRegistry.getBoundingBox(): Model ${Z} not found!`);return J}getDepth(Z){let J=this.getBoundingBox(Z);return J.max.z-J.min.z}getHeight(Z){let J=this.getBoundingBox(Z);return J.max.y-J.min.y}getNodeNames(Z){let J=this._modelUriNodeNames.get(Z);if(!J)d.fatalError(`ModelRegistry.getNodeNames(): Model ${Z} not found!`);return J}getTrimesh(Z,J=1){let X=this._modelUriTrimeshes.get(Z);if(!X){d.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}}getWidth(Z){let J=this.getBoundingBox(Z);return J.max.x-J.min.x}modelHasNode(Z,J){let X=this._modelUriNodeNames.get(Z);if(!X)d.fatalError(`ModelRegistry.modelHasNode(): Model ${Z} not found!`);return X.includes(J)}_absoluteModelPathToModelUri(Z){let J=Y9.normalize(Z);for(let X of xW.DIRECTORIES){let Y=Y9.normalize(X);if(J.startsWith(Y))return Y9.relative(Y,J).replace(/\\/g,"/")}return Y9.basename(J)}async _getAbsoluteModelPaths(){let Z=[];for(let J of xW.DIRECTORIES){let X=Y9.resolve(process.cwd(),J);if(!dJ.existsSync(X))continue;let Y=await C2("**/*.{gltf,glb}",{cwd:X,follow:!0});for(let $ of Y)Z.push(Y9.join(X,$))}return Z}async _loadModelData(Z){let J=await new QC().read(Z),X=co(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)}${xW.CHECKSUM_EXT}`;if(!dJ.existsSync(J))return!1;let X=this._calculateChecksum(Z),Y=dJ.readFileSync(J,"utf8");return X===Y}_calculateChecksum(Z){if(!dJ.existsSync(Z))return"";let J=dJ.readFileSync(Z);return RR1.createHash("sha256").update(J.toString("base64")).digest("hex")}_buildOptimizedModelPath(Z){let J=Y9.basename(Z),X=J.replace(/\.[^/.]+$/,""),Y=Y9.dirname(Z),$=Y9.join(Y,xW.OPTIMIZED_DIR,X);return Y9.join($,J)}async _buildTrimesh(Z,J=1,X=0.001){let Y=this._modelUriDocuments.get(Z);if(!Y)d.fatalError(`ModelRegistry._buildTrimesh(): Model ${Z} not found!`);let $=mo(Y);$.setLogger(new P5(yG.WARN)),await $.transform(Do({pivot:"center"}),uo(),lo(),Yk(),so({simplifier:oo,ratio:J,error:X}),yo());for(let z of $.getRoot().listScenes())for(let H of z.listChildren())fo(H);let Q=$.getRoot().listMeshes()[0];if(!Q){d.error(`ModelRegistry._buildTrimesh(): Model ${Z} has no root mesh!`);return}let W=Q.listPrimitives()[0];if(!W){d.error(`ModelRegistry._buildTrimesh(): Model ${Z} has no root primitive!`);return}let K=W.getAttribute("POSITION"),G=W.getIndices();if(!K||!G){d.error(`ModelRegistry._buildTrimesh(): Model ${Z} missing required geometry data!`);return}return{vertices:K.getArray(),indices:G.getArray()}}async _optimizeModel(Z,J){let X=Y9.dirname(J);dJ.rmSync(X,{recursive:!0,force:!0}),dJ.mkdirSync(X,{recursive:!0}),console.log(`ModelRegistry: Optimizing model ${this._absoluteModelPathToModelUri(Z)}...`);for(let Y of xW.OPTIMIZER_RUNS){let $=J.replace(/(\.[^/.]+)$/,`${Y.suffix}$1`),{stderr:Q}=await Xp("npx",["@gltf-transform/cli","optimize",Z,$,...Y.options]);if(Q)return d.warning(`ModelRegistry._optimizeModel(): Error optimizing model ${this._absoluteModelPathToModelUri(Z)}, defaulting to unoptimized model. Error: ${Q}`),Z}return dJ.writeFileSync(`${J}${xW.CHECKSUM_EXT}`,this._calculateChecksum(Z)),J}}var Vz;(($)=>{$.DYNAMIC="dynamic";$.FIXED="fixed";$.KINEMATIC_POSITION="kinematic_position";$.KINEMATIC_VELOCITY="kinematic_velocity"})(Vz||={});var Qk=0.001,ro="dynamic";class tY extends j0{_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??=ro,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"]:Q1.RigidBodyType.Dynamic,["fixed"]:Q1.RigidBodyType.Fixed,["kinematic_position"]:Q1.RigidBodyType.KinematicPositionBased,["kinematic_velocity"]:Q1.RigidBodyType.KinematicVelocityBased}[Z];if(X===void 0)return d.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 d.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 $9({...Z,parentRigidBody:this,simulation:this._simulation}):this._createAndAddPendingChildCollider(Z)}createAndAddChildColliders(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 d.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 d.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 d.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 $9(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??ro;return{["dynamic"]:()=>Q1.RigidBodyDesc.dynamic(),["fixed"]:()=>Q1.RigidBodyDesc.fixed(),["kinematic_position"]:()=>Q1.RigidBodyDesc.kinematicPositionBased(),["kinematic_velocity"]:()=>Q1.RigidBodyDesc.kinematicVelocityBased()}[J]()}_requireCreated(Z){if(!this._rigidBody||!this._simulation)d.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)d.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)d.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)d.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)d.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)d.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)<Qk&&Math.abs(Z.y)<Qk&&Math.abs(Z.z)<Qk}}var Wk;(($)=>{$[$.Average=0]="Average";$[$.Min=1]="Min";$[$.Multiply=2]="Multiply";$[$.Max=3]="Max"})(Wk||={});var qz;((H)=>{H.NONE="none";H.BALL="ball";H.BLOCK="block";H.CAPSULE="capsule";H.CONE="cone";H.CYLINDER="cylinder";H.ROUND_CYLINDER="round-cylinder";H.TRIMESH="trimesh";H.VOXELS="voxels";H.WEDGE="wedge"})(qz||={});class $9 extends j0{_collider;_colliderDesc;_onCollision;_parentRigidBody;_relativePosition={x:0,y:0,z:0};_relativeRotation={x:0,y:0,z:0,w:1};_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=k5.instance.getBoundingBox(Z),$=Y.max.x-Y.min.x,Q=Y.max.y-Y.min.y,W=Y.max.z-Y.min.z,K=Math.max($,W),G=Math.min($,W),z=K/G,H=K/Q,V=K*J/2,q=(N)=>Math.max(0.01,N),F=()=>({shape:"block",halfExtents:{x:q($*J/2),y:q(Q*J/2),z:q(W*J/2)}}),U=()=>({shape:"round-cylinder",radius:q(V),halfHeight:q(Q*J/2),borderRadius:q(V*0.1)}),B=()=>{let N=k5.instance.getTrimesh(Z,J);if(!N)return;return{shape:"trimesh",vertices:N.vertices,indices:N.indices}},w=()=>({shape:"wedge",extents:{x:$*J,y:Q*J,z:W*J}}),O=()=>({shape:"capsule",radius:q(V),halfHeight:q(Q*J/2-V)});if(X)switch(X){case"block":return F();case"capsule":return O();case"round-cylinder":return U();case"trimesh":{let N=B();if(!N){d.error(`Collider.optionsFromModelUri(): Failed to create trimesh options for model ${Z}, falling back to generic shape!`);break}return N}case"wedge":return w();default:d.warning(`Collider.optionsFromModelUri(): Preferred shape ${X} is not yet supported with Collider.optionsFromModelUri(), defaulting to generic shape!`)}if(z>2)return F();if(H>1.5)return U();return O()}get bounciness(){if(!this._requireNotRemoved("bounciness"))return 0;return this._collider?this._collider.restitution():this._colliderDesc.restitution}get bouncinessCombineRule(){if(!this._requireNotRemoved("bouncinessCombineRule"))return 0;return this._collider?this._collider.restitutionCombineRule():this._colliderDesc.restitutionCombineRule}get collisionGroups(){if(!this._requireNotRemoved("collisionGroups"))return{belongsTo:[],collidesWith:[]};return this._collider?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 rawShape(){if(!this._requireNotRemoved("rawShape"))return;return this._collider?this._collider.shape:this._colliderDesc.shape}get relativePosition(){if(!this._requireNotRemoved("relativePosition"))return{x:0,y:0,z:0};return this._relativePosition}get relativeRotation(){if(!this._requireNotRemoved("relativeRotation"))return{x:0,y:0,z:0,w:1};return this._relativeRotation}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._relativeRotation=Z,this._collider?this._collider.parent()?this._collider.setRotationWrtParent(Z):this._collider.setRotation(Z):this._colliderDesc.setRotation(Z)}setRelativePosition(Z){if(!this._requireNotRemoved("setRelativePosition"))return;this._relativePosition=Z,this._collider?this._collider.parent()?this._collider.setTranslationWrtParent(Z):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}setVoxel(Z,J){if(!this._requireNotRemoved("setVoxel"))return;if(!this._requireSimulated("setVoxel"))return;if(this.shape!=="voxels")return d.error("Collider.setVoxel(): Collider is not a voxels collider!");this._collider.setVoxel(Z.x,Z.y,Z.z,J)}addToSimulation(Z,J){if(!this._requireNotRemoved("addToSimulation"))return;if(!this._requireUnsimulated("addToSimulation"))return;if(J){if(!J.isSimulated)return d.error("Collider.addToSimulation(): Rigid body must be simulated before adding a collider to it!");if(J.type==="dynamic"&&this.shape==="trimesh")d.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)}combineVoxelStates(Z){if(!this._requireNotRemoved("combineVoxelStates"))return;if(!this._requireSimulated("combineVoxelStates"))return;if(!Z.isSimulated)return d.error("Collider.combineVoxelStates(): Other collider is not simulated!");if(this.shape!=="voxels")return d.error("Collider.combineVoxelStates(): Collider is not a voxels collider!");if(Z.shape!=="voxels")return d.error("Collider.combineVoxelStates(): Other collider is not a voxels collider!");this._collider.combineVoxelStates(Z.rawCollider,0,0,0)}enableCollisionEvents(Z){if(!this._requireNotRemoved("enableCollisionEvents"))return;let J=this._collider?this._collider.activeEvents():this._colliderDesc.activeEvents,X=Z?J|Q1.ActiveEvents.COLLISION_EVENTS:J&~Q1.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|Q1.ActiveEvents.CONTACT_FORCE_EVENTS:J&~Q1.ActiveEvents.CONTACT_FORCE_EVENTS;(this._collider??this._colliderDesc).setActiveEvents(X),this._setActiveCollisionTypes()}propagateVoxelChange(Z,J){if(!this._requireNotRemoved("propagateVoxelChange"))return;if(!this._requireSimulated("propagateVoxelChange"))return;if(!Z.isSimulated)return d.error("Collider.propagateVoxelChange(): Other collider is not simulated!");if(this.shape!=="voxels")return d.error("Collider.propagateVoxelChange(): Collider is not a voxels collider!");if(Z.shape!=="voxels")return d.error("Collider.propagateVoxelChange(): Other collider is not a voxels collider!");this._collider.propagateVoxelChange(Z.rawCollider,J.x,J.y,J.z,0,0,0)}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}scale(Z){if(!this._requireNotRemoved("scale"))return;switch(this.setRelativePosition({x:this.relativePosition.x*Z,y:this.relativePosition.y*Z,z:this.relativePosition.z*Z}),this._shape){case"ball":{if(this._collider)this._collider.setRadius(this._collider.radius()*Z);else this._colliderDesc.shape.radius*=Z;return}case"block":{if(this._collider){let J=this._collider.halfExtents();this._collider.setHalfExtents({x:J.x*Z,y:J.y*Z,z:J.z*Z})}else this._colliderDesc.shape.halfExtents.x*=Z,this._colliderDesc.shape.halfExtents.y*=Z,this._colliderDesc.shape.halfExtents.z*=Z;return}case"capsule":{if(this._collider)this._collider.setHalfHeight(this._collider.halfHeight()*Z),this._collider.setRadius(this._collider.radius()*Z);else this._colliderDesc.shape.halfHeight*=Z,this._colliderDesc.shape.radius*=Z;return}case"cone":{if(this._collider)this._collider.setHalfHeight(this._collider.halfHeight()*Z),this._collider.setRadius(this._collider.radius()*Z);else this._colliderDesc.shape.halfHeight*=Z,this._colliderDesc.shape.radius*=Z;return}case"cylinder":{if(this._collider)this._collider.setHalfHeight(this._collider.halfHeight()*Z),this._collider.setRadius(this._collider.radius()*Z);else this._colliderDesc.shape.halfHeight*=Z,this._colliderDesc.shape.radius*=Z;return}case"round-cylinder":{if(this._collider)this._collider.setHalfHeight(this._collider.halfHeight()*Z),this._collider.setRoundRadius(this._collider.roundRadius()*Z),this._collider.setRadius(this._collider.radius()*Z);else this._colliderDesc.shape.halfHeight=this._colliderDesc.shape.halfHeight*Z,this._colliderDesc.shape.borderRadius=this._colliderDesc.shape.borderRadius*Z,this._colliderDesc.shape.radius=this._colliderDesc.shape.radius*Z;return}case"trimesh":{d.error("Collider.setScale(): Trimesh colliders cannot be scaled!");return}case"voxels":{d.error("Collider.setScale(): Voxels colliders cannot be scaled!");return}case"wedge":{d.error("Collider.setScale(): Wedge colliders cannot be scaled!");return}default:d.fatalError(`Collider.setScale(): ${this._shape} is not a valid collider shape!`)}}_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,W=X/2;return new Float32Array([-$,0-W,-Q,$,0-W,-Q,$,0-W,Q,-$,0-W,Q,-$,X-W,-Q,$,X-W,-Q])}_createColliderDesc(Z){let{shape:J,flags:X}=Z;switch(J){case"ball":{if(!Z.radius)d.fatalError("Ball collider must have a radius!");return Q1.ColliderDesc.ball(Z.radius)}case"block":{if(!Z.halfExtents)d.fatalError("Block collider must have halfExtents!");return Q1.ColliderDesc.cuboid(Z.halfExtents.x,Z.halfExtents.y,Z.halfExtents.z)}case"capsule":{if(!Z.halfHeight||!Z.radius)d.fatalError("Capsule collider must have halfHeight and radius!");return Q1.ColliderDesc.capsule(Z.halfHeight,Z.radius)}case"cone":{if(!Z.radius||!Z.halfHeight)d.fatalError("Cone collider must have radius and halfHeight!");return Q1.ColliderDesc.cone(Z.halfHeight,Z.radius)}case"cylinder":{if(!Z.radius||!Z.halfHeight)d.fatalError("Cylinder collider must have radius and halfHeight!");return Q1.ColliderDesc.cylinder(Z.halfHeight,Z.radius)}case"round-cylinder":{if(!Z.radius||!Z.halfHeight||!Z.borderRadius)d.fatalError("Round cylinder collider must have radius, halfHeight, and borderRadius!");return Q1.ColliderDesc.roundCylinder(Z.halfHeight,Z.radius,Z.borderRadius)}case"trimesh":{if(!Z.indices||!Z.vertices)d.fatalError("Trimesh collider must have vertices and indices!");return Q1.ColliderDesc.trimesh(Z.vertices,Z.indices,X)}case"voxels":{if(!Z.coordinates||!Z.size)d.fatalError("Voxels collider must have coordinates and size!");return Q1.ColliderDesc.voxels(this._coordinatesToInt32Array(Z.coordinates),Z.size)}case"wedge":{if(!Z.extents)d.fatalError("Wedge collider must have extents!");let Y=this._buildWedgeConvexHullVertices(Z.extents),$=Q1.ColliderDesc.convexHull(Y);if(!$)throw d.fatalError("Failed to create convex hull for wedge collider!"),new Error("Convex hull creation failed");return $}default:d.fatalError(`Collider._createColliderDesc(): ${J} is not a valid collider shape!`)}}_requireSimulated(Z){if(!this.isSimulated)d.error(`Collider._requireSimulated(): Collider is not simulated, invoked method: ${Z}()`);return this.isSimulated}_requireUnsimulated(Z){if(this.isSimulated)d.error(`Collider._requireUnsimulated(): Collider is already simulated, invoked method: ${Z}()`);return!this.isSimulated}_requireNotRemoved(Z){if(this.isRemoved)d.error(`Collider._requireNotRemoved(): Collider is removed, invoked method: ${Z}()`);return!this.isRemoved}_setActiveCollisionTypes(){(this._collider??this._colliderDesc).setActiveCollisionTypes(Q1.ActiveCollisionTypes.DYNAMIC_DYNAMIC|Q1.ActiveCollisionTypes.DYNAMIC_KINEMATIC|Q1.ActiveCollisionTypes.DYNAMIC_FIXED|Q1.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Q1.ActiveCollisionTypes.KINEMATIC_FIXED)}_coordinatesToInt32Array(Z){let J=new Int32Array(Z.length*3);for(let X=0;X<Z.length;X++){let Y=Z[X],$=X*3;J[$]=Math.floor(Y.x),J[$+1]=Math.floor(Y.y),J[$+2]=Math.floor(Y.z)}return J}}var NR1={shape:"voxels"},Kk;((X)=>{X.ENTITY_COLLISION="BLOCK_TYPE.ENTITY_COLLISION";X.ENTITY_CONTACT_FORCE="BLOCK_TYPE.ENTITY_CONTACT_FORCE"})(Kk||={});class Q9 extends j0{_id;_blockTypeRegistry;_customColliderOptions;_halfExtents;_isLiquid;_name;_textureUri;constructor(Z,J={id:-1,textureUri:"textures/missing.png",name:"Unknown"}){if(J.id<0)d.fatalError("BlockType.constructor(): BlockType id not set.");super();this._id=J.id,this._blockTypeRegistry=Z,this._customColliderOptions=J.customColliderOptions,this._halfExtents=J.halfExtents??{x:0.5,y:0.5,z:0.5},this._isLiquid=J.isLiquid??!1,this._name=J.name,this._textureUri=J.textureUri}get id(){return this._id}get blockTypeRegistry(){return this._blockTypeRegistry}get colliderOptions(){return{...this._customColliderOptions,...NR1}}get halfExtents(){return this._halfExtents}get isLiquid(){return this._isLiquid}get isMeshable(){return!this._customColliderOptions}get name(){return this._name}get size(){return{x:this._halfExtents.x*2,y:this._halfExtents.y*2,z:this._halfExtents.z*2}}get textureUri(){return this._textureUri}createCollider(Z){let J=new $9({...this.colliderOptions,coordinates:Z,size:this.size});if(this.isLiquid)J.setSensor(!0);if(this.hasListeners("BLOCK_TYPE.ENTITY_COLLISION")||this.isLiquid)J.enableCollisionEvents(!0);if(this.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))J.enableContactForceEvents(!0);if(j4.isDefaultCollisionGroups(J.collisionGroups))J.setCollisionGroups({belongsTo:[1],collidesWith:[65535&~1]});return J}serialize(){return D0.serializeBlockType(this,this._blockTypeRegistry.world.tickAllocator)}}var Gk;((J)=>J.REGISTER_BLOCK_TYPE="BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE")(Gk||={});class Fz extends j0{_blockTypes=new Map;_world;constructor(Z){super();this._world=Z}get world(){return this._world}getAllBlockTypes(Z=!1){return Z?this._world.tickAllocator.getArray(this._blockTypes.values()):Array.from(this._blockTypes.values())}getBlockType(Z){let J=this._blockTypes.get(Z);if(!J)d.fatalError(`BlockTypeRegistry.getBlockType(): BlockType with id ${Z} not found.`);return J}registerGenericBlockType(Z){let X=new class extends Q9{constructor(Y,$){super(Y,$)}}(this,Z);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 D0.serializeBlockTypeRegistry(this,this._world.tickAllocator)}}var gE={};D9(gE,{worldSchema:()=>yE,worldPacketDefinition:()=>l10,vectorSchema:()=>H1,vectorBooleanSchema:()=>MI1,uiSchema:()=>fE,uiPacketDefinition:()=>d10,uiDatasSchema:()=>bE,uiDatasPacketDefinition:()=>c10,uiDataSendPacketDefinition:()=>k10,uiDataSchema:()=>bz,syncResponseSchema:()=>hE,syncResponsePacketDefinition:()=>u10,syncRequestSchema:()=>zE,syncRequestPacketDefinition:()=>T10,stateRequestSchema:()=>GE,stateRequestPacketDefinition:()=>C10,sceneUIsSchema:()=>AE,sceneUIsPacketDefinition:()=>m10,sceneUISchema:()=>xE,rgbColorSchema:()=>x6,registeredPackets:()=>PB,quaternionSchema:()=>RE,playersSchema:()=>_E,playersPacketDefinition:()=>g10,playerSchema:()=>SE,physicsDebugRenderSchema:()=>vE,physicsDebugRenderPacketDefinition:()=>b10,physicsDebugRaycastsSchema:()=>IE,physicsDebugRaycastsPacketDefinition:()=>y10,physicsDebugRaycastSchema:()=>EE,particleEmittersSchema:()=>kE,particleEmittersPacketDefinition:()=>f10,particleEmitterSchema:()=>TE,outboundPackets:()=>DB,modelNodeOverrideSchema:()=>ME,lightsSchema:()=>CE,lightsPacketDefinition:()=>h10,lightSchema:()=>PE,isValidPacket:()=>NI1,inputSchema:()=>KE,inputPacketDefinition:()=>P10,inboundPackets:()=>NB,hexColorSchema:()=>QE,heartbeatSchema:()=>$E,heartbeatPacketDefinition:()=>R10,entitySchema:()=>NE,entitiesSchema:()=>DE,entitiesPacketDefinition:()=>A10,definePacket:()=>S0,debugConfigSchema:()=>WE,debugConfigPacketDefinition:()=>D10,createPacket:()=>HI1,connectionSchema:()=>YE,connectionPacketDefinition:()=>M10,chunksSchema:()=>jE,chunksPacketDefinition:()=>x10,chunkSchema:()=>OE,chatMessagesSchema:()=>LE,chatMessagesPacketDefinition:()=>_10,chatMessageSendPacketDefinition:()=>N10,chatMessageSchema:()=>fz,cameraSchema:()=>BE,cameraPacketDefinition:()=>S10,blocksSchema:()=>FE,blocksPacketDefinition:()=>I10,blockTypesSchema:()=>wE,blockTypesPacketDefinition:()=>v10,blockTypeSchema:()=>UE,blockSchema:()=>qE,bidirectionalPackets:()=>RB,audiosSchema:()=>VE,audiosPacketDefinition:()=>E10,audioSchema:()=>HE,PacketId:()=>A1});var RB={};D9(RB,{heartbeatPacketDefinition:()=>R10,connectionPacketDefinition:()=>M10});var JE=e(O10(),1);class XE extends JE.default{static instance=new JE.default}var A1;((k)=>{k[k.SYNC_REQUEST=0]="SYNC_REQUEST";k[k.INPUT=1]="INPUT";k[k.STATE_REQUEST=2]="STATE_REQUEST";k[k.CHAT_MESSAGE_SEND=3]="CHAT_MESSAGE_SEND";k[k.UI_DATA_SEND=4]="UI_DATA_SEND";k[k.SYNC_RESPONSE=32]="SYNC_RESPONSE";k[k.AUDIOS=33]="AUDIOS";k[k.BLOCKS=34]="BLOCKS";k[k.BLOCK_TYPES=35]="BLOCK_TYPES";k[k.CHAT_MESSAGES=36]="CHAT_MESSAGES";k[k.CHUNKS=37]="CHUNKS";k[k.ENTITIES=38]="ENTITIES";k[k.WORLD=39]="WORLD";k[k.CAMERA=40]="CAMERA";k[k.UI=41]="UI";k[k.UI_DATAS=42]="UI_DATAS";k[k.SCENE_UIS=43]="SCENE_UIS";k[k.LIGHTS=44]="LIGHTS";k[k.PLAYERS=45]="PLAYERS";k[k.PARTICLE_EMITTERS=46]="PARTICLE_EMITTERS";k[k.CONNECTION=116]="CONNECTION";k[k.HEARTBEAT=117]="HEARTBEAT";k[k.DEBUG_CONFIG=128]="DEBUG_CONFIG";k[k.PHYSICS_DEBUG_RENDER=192]="PHYSICS_DEBUG_RENDER";k[k.PHYSICS_DEBUG_RAYCASTS=193]="PHYSICS_DEBUG_RAYCASTS"})(A1||={});function HI1(Z,J,X,Y){if(!Z.validate(J))throw new Error(`Invalid payload for packet with id ${Z.id}. Error: ${XE.instance.errorsText(Z.validate.errors)}`);let $=Y??[];if($[0]=Z.id,$[1]=J,typeof X==="number")$.push(X);return $}function S0(Z,J){return{id:Z,schema:J,validate:XE.instance.compile(J)}}var VI1={type:"object",properties:{i:{type:"string"}},required:["i"],additionalProperties:!1},j10={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},qI1={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},FI1={type:"object",properties:{usernameFragment:{type:"string"},password:{type:"string"},iceLite:{type:"boolean",nullable:!0}},required:["usernameFragment","password"],additionalProperties:!1},UI1={type:"object",properties:{i:{type:"string"},l:{type:"string"}},required:["i","l"],additionalProperties:!1},wI1={type:"object",properties:{port:{type:"number"},OS:{type:"number"},MIS:{type:"number"},maxMessageSize:{type:"number"}},required:["port","OS","MIS","maxMessageSize"],additionalProperties:!0},BI1={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},LI1={type:"object",properties:{i:{type:"string"},f:{type:"string",enum:["cs","sc"]},ip:FI1,ic:{type:"array",items:qI1},d:j10,s:wI1},required:["i","f","ip","ic","d","s"],additionalProperties:!1},OI1={type:"object",properties:{i:{type:"string"},d:j10},required:["i","d"],additionalProperties:!1},jI1={type:"object",properties:{i:{type:"string",nullable:!0},pi:{type:"string",nullable:!0},l:{type:"string"},s:BI1},required:["l","s"],additionalProperties:!1},YE={type:"object",properties:{i:{type:"string",nullable:!0},k:{type:"boolean",nullable:!0},c:{...OI1,nullable:!0},ca:{...VI1,nullable:!0},d:{type:"array",items:{...jI1},nullable:!0},pa:{...UI1,nullable:!0},t:{type:"array",items:{...LI1},nullable:!0}},additionalProperties:!1};var M10=S0(116,YE);var $E={type:"null",nullable:!0};var R10=S0(117,$E);var NB={};D9(NB,{uiDataSendPacketDefinition:()=>k10,syncRequestPacketDefinition:()=>T10,stateRequestPacketDefinition:()=>C10,inputPacketDefinition:()=>P10,debugConfigPacketDefinition:()=>D10,chatMessageSendPacketDefinition:()=>N10});var QE={type:"string",pattern:"^[0-9A-Fa-f]{6}$"};var fz={type:"object",properties:{m:{type:"string"},c:{...QE,nullable:!0},p:{type:"string",nullable:!0}},required:["m"],additionalProperties:!1};var N10=S0(3,fz);var WE={type:"object",properties:{pdr:{type:"boolean",nullable:!0}},additionalProperties:!1};var D10=S0(128,WE);var KE={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},u:{type:"boolean",nullable:!0},i:{type:"boolean",nullable:!0},o:{type:"boolean",nullable:!0},j:{type:"boolean",nullable:!0},k:{type:"boolean",nullable:!0},l:{type:"boolean",nullable:!0},n:{type:"boolean",nullable:!0},m:{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 P10=S0(1,KE);var GE={type:"object",properties:{},additionalProperties:!1};var C10=S0(2,GE);var zE={type:"null",nullable:!0};var T10=S0(0,zE);var bz={type:"object",properties:{},additionalProperties:!0};var k10=S0(4,bz);var DB={};D9(DB,{worldPacketDefinition:()=>l10,uiPacketDefinition:()=>d10,uiDatasPacketDefinition:()=>c10,syncResponsePacketDefinition:()=>u10,sceneUIsPacketDefinition:()=>m10,playersPacketDefinition:()=>g10,physicsDebugRenderPacketDefinition:()=>b10,physicsDebugRaycastsPacketDefinition:()=>y10,particleEmittersPacketDefinition:()=>f10,lightsPacketDefinition:()=>h10,entitiesPacketDefinition:()=>A10,chunksPacketDefinition:()=>x10,chatMessagesPacketDefinition:()=>_10,cameraPacketDefinition:()=>S10,blocksPacketDefinition:()=>I10,blockTypesPacketDefinition:()=>v10,audiosPacketDefinition:()=>E10});var H1={type:"array",items:[{type:"number"},{type:"number"},{type:"number"}],minItems:3,maxItems:3};var HE={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:{...H1,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 VE={type:"array",items:{...HE}};var E10=S0(33,VE);var qE={type:"object",properties:{i:{type:"number"},c:H1},required:["i","c"],additionalProperties:!1};var FE={type:"array",items:{...qE}};var I10=S0(34,FE);var UE={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 wE={type:"array",items:{...UE}};var v10=S0(35,wE);var BE={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},h:{type:"array",items:{type:"string"},nullable:!0},o:{...H1,nullable:!0},p:{...H1,nullable:!0},pt:{...H1,nullable:!0},pl:{...H1,nullable:!0},s:{type:"array",items:{type:"string"},nullable:!0},sa:{type:"number",nullable:!0},z:{type:"number",nullable:!0}},additionalProperties:!1};var LE={type:"array",items:{...fz}};var OE={type:"object",properties:{c:H1,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 jE={type:"array",items:{...OE}};var x6={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 ME={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:{...x6,nullable:!0}},required:["n"],additionalProperties:!1};var RE={type:"array",items:[{type:"number"},{type:"number"},{type:"number"},{type:"number"}],minItems:4,maxItems:4};var NE={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:{...H1,nullable:!0},bt:{type:"string",nullable:!0},h:{type:"array",items:{type:"string"},nullable:!0},m:{type:"string",nullable:!0},mo:{type:"array",items:{...ME},nullable:!0},mt:{type:"string",nullable:!0},n:{type:"string",nullable:!0},o:{type:"number",nullable:!0},p:{...H1,nullable:!0},pe:{type:"number",nullable:!0},pn:{type:"string",nullable:!0},r:{...RE,nullable:!0},rm:{type:"boolean",nullable:!0},s:{type:"number",nullable:!0},sn:{type:"array",items:{type:"string"},nullable:!0},t:{...x6,nullable:!0}},required:["i"],additionalProperties:!1};var DE={type:"array",items:{...NE}};var PE={type:"object",properties:{i:{type:"number"},a:{type:"number",nullable:!0},e:{type:"number",nullable:!0},c:{...x6,nullable:!0},d:{type:"number",nullable:!0},n:{type:"number",nullable:!0},o:{...H1,nullable:!0},p:{...H1,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:{...H1,nullable:!0}},required:["i"],additionalProperties:!1};var CE={type:"array",items:{...PE}};var TE={type:"object",properties:{i:{type:"number"},at:{type:"number",nullable:!0},b:{type:"number",nullable:!0},ce:{...x6,nullable:!0},cev:{...x6,nullable:!0},cs:{...x6,nullable:!0},csv:{...x6,nullable:!0},e:{type:"number",nullable:!0},en:{type:"string",nullable:!0},g:{...H1,nullable:!0},l:{type:"number",nullable:!0},lv:{type:"number",nullable:!0},mp:{type:"number",nullable:!0},o:{...H1,nullable:!0},oe:{type:"number",nullable:!0},oev:{type:"number",nullable:!0},os:{type:"number",nullable:!0},osv:{type:"number",nullable:!0},p:{...H1,nullable:!0},pa:{type:"boolean",nullable:!0},pv:{...H1,nullable:!0},r:{type:"number",nullable:!0},rv:{type:"number",nullable:!0},rm:{type:"boolean",nullable:!0},se:{type:"number",nullable:!0},sev:{type:"number",nullable:!0},ss:{type:"number",nullable:!0},ssv:{type:"number",nullable:!0},t:{type:"boolean",nullable:!0},tu:{type:"string",nullable:!0},v:{...H1,nullable:!0},vv:{...H1,nullable:!0}},required:["i"],additionalProperties:!1};var kE={type:"array",items:{...TE}};var EE={type:"object",properties:{o:{...H1},d:{...H1},l:{type:"number"},h:{type:"boolean"}},required:["o","d","l","h"],additionalProperties:!1};var IE={type:"array",items:{...EE}};var vE={type:"object",properties:{v:{type:"array",items:{type:"number"}},c:{type:"array",items:{type:"number"}}},required:["v","c"],additionalProperties:!1};var SE={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 _E={type:"array",items:{...SE}};var xE={type:"object",properties:{i:{type:"number"},e:{type:"number",nullable:!0},o:{...H1,nullable:!0},p:{...H1,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 AE={type:"array",items:{...xE}};var hE={type:"object",properties:{r:{type:"number"},s:{type:"number"},p:{type:"number"},n:{type:"number"}},required:["r","s","p","n"],additionalProperties:!1};var fE={type:"object",properties:{p:{type:"boolean",nullable:!0},u:{type:"string",nullable:!0}},additionalProperties:!1};var bE={type:"array",items:{...bz}};var MI1={type:"array",items:[{type:"boolean"},{type:"boolean"},{type:"boolean"}],minItems:3,maxItems:3};var yE={type:"object",properties:{i:{type:"number"},ac:{...x6,nullable:!0},ai:{type:"number",nullable:!0},dc:{...x6,nullable:!0},di:{type:"number",nullable:!0},dp:{...H1,nullable:!0},fc:{...x6,nullable:!0},ff:{type:"number",nullable:!0},fn:{type:"number",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 S10=S0(40,BE);var _10=S0(36,LE);var x10=S0(37,jE);var A10=S0(38,DE);var h10=S0(44,CE);var f10=S0(46,kE);var b10=S0(192,vE);var y10=S0(193,IE);var g10=S0(45,_E);var m10=S0(43,AE);var u10=S0(32,hE);var d10=S0(41,fE);var c10=S0(42,bE);var l10=S0(39,yE);var PB=new Map,RI1={...RB,...NB,...DB};for(let Z of Object.values(RI1))if("id"in Z&&"schema"in Z){let J=Z;if(PB.has(J.id))throw new Error(`Packet with id ${J.id} is already registered.`);PB.set(J.id,J)}function NI1(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=PB.get(Z[0]);return!!J&&J.validate(Z[1])}var Y0=gE;var w80=e(F80(),1);import Q$ from"fs";import U80 from"path";var gz="./dev/persistence";class I7{static instance=new I7;gameId=process.env.HYTOPIA_GAME_ID;lobbyId=process.env.HYTOPIA_LOBBY_ID;_creativeGateway;constructor(){try{this._creativeGateway=new w80.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 d.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 d.warning("PlatformGateway.setData(): Cannot set data with an error property.");if(!this._creativeGateway&&process.env.NODE_ENV==="production")return d.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(!Q$.existsSync(gz))return;let J=U80.join(gz,`${Z}.json`);return JSON.parse(Q$.readFileSync(J,"utf8"))}catch(J){d.warning(`PlatformGateway._readDevDataLocally(): Failed to read data for key "${Z}": ${J}`)}}_writeDevDataLocally(Z,J){try{if(!Q$.existsSync(gz))Q$.mkdirSync(gz,{recursive:!0});let X=U80.join(gz,`${Z}.json`),Y={};if(Q$.existsSync(X))Y=JSON.parse(Q$.readFileSync(X,"utf8"));let $={...Y,...J};Q$.writeFileSync(X,JSON.stringify($,null,2),"utf8")}catch(X){d.warning(`PlatformGateway._writeDevDataLocally(): Failed to write data for key "${Z}": ${X}`)}}}class W${static instance=new W$;constructor(){}async getGlobalData(Z){let J=await I7.instance.getData(Z);if(!J||J.error){if(J?.error)d.warning(`PersistenceManager.getGlobalData(): ${J.error.message}`);return}return J}async getPlayerData(Z){let J=await I7.instance.getData(this._getPlayerKey(Z));if(!J||J.error){if(J?.error)d.warning(`PersistenceManager.getPlayerData(): ${J.error.message}`);return}return J}async setGlobalData(Z,J){let X=await I7.instance.setData(Z,J);if(!X||X.error){if(X?.error)d.warning(`PersistenceManager.setGlobalData(): ${X.error.message}`);return}return X}async setPlayerData(Z,J){let X=await I7.instance.setData(this._getPlayerKey(Z),J);if(!X||X.error){if(X?.error)d.warning(`PersistenceManager.setPlayerData(): ${X.error.message}`);return}return X}_getPlayerKey(Z){return`player-${Z.id}`}}var B80;((Y)=>{Y[Y.FIRST_PERSON=0]="FIRST_PERSON";Y[Y.THIRD_PERSON=1]="THIRD_PERSON";Y[Y.SPECTATOR=2]="SPECTATOR"})(B80||={});var uE;((B)=>{B.LOOK_AT_ENTITY="PLAYER_CAMERA.LOOK_AT_ENTITY";B.LOOK_AT_POSITION="PLAYER_CAMERA.LOOK_AT_POSITION";B.SET_ATTACHED_TO_ENTITY="PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY";B.SET_ATTACHED_TO_POSITION="PLAYER_CAMERA.SET_ATTACHED_TO_POSITION";B.SET_FILM_OFFSET="PLAYER_CAMERA.SET_FILM_OFFSET";B.SET_FORWARD_OFFSET="PLAYER_CAMERA.SET_FORWARD_OFFSET";B.SET_FOV="PLAYER_CAMERA.SET_FOV";B.SET_MODEL_HIDDEN_NODES="PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES";B.SET_MODEL_SHOWN_NODES="PLAYER_CAMERA.SET_MODEL_SHOWN_NODES";B.SET_MODE="PLAYER_CAMERA.SET_MODE";B.SET_OFFSET="PLAYER_CAMERA.SET_OFFSET";B.SET_SHOULDER_ANGLE="PLAYER_CAMERA.SET_SHOULDER_ANGLE";B.SET_TRACKED_ENTITY="PLAYER_CAMERA.SET_TRACKED_ENTITY";B.SET_TRACKED_POSITION="PLAYER_CAMERA.SET_TRACKED_POSITION";B.SET_ZOOM="PLAYER_CAMERA.SET_ZOOM"})(uE||={});class mz extends j0{player;_attachedToEntity;_attachedToPosition;_filmOffset=0;_forwardOffset=0;_fov=75;_modelHiddenNodes=new Set;_modelShownNodes=new Set;_mode=1;_offset={x:0,y:0,z:0};_orientation={pitch:0,yaw:0};_shoulderAngle=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 facingQuaternion(){let Z=this._orientation.pitch*0.5,J=this._orientation.yaw*0.5,X=Math.cos(Z),Y=Math.sin(Z),$=Math.cos(J),Q=Math.sin(J);return{x:Y*$,y:X*Q,z:-Y*Q,w:X*$}}get filmOffset(){return this._filmOffset}get forwardOffset(){return this._forwardOffset}get fov(){return this._fov}get modelHiddenNodes(){return this._modelHiddenNodes}get modelShownNodes(){return this._modelShownNodes}get mode(){return this._mode}get offset(){return this._offset}get orientation(){return this._orientation}get shoulderAngle(){return this._shoulderAngle}get trackedEntity(){return this._trackedEntity}get trackedPosition(){return this._trackedPosition}get zoom(){return this._zoom}lookAtEntity(Z){if(!this._requirePlayerWorld("lookAtEntity"))return;this.emitWithWorld(this.player.world,"PLAYER_CAMERA.LOOK_AT_ENTITY",{playerCamera:this,entity:Z})}lookAtPosition(Z){if(!this._requirePlayerWorld("lookAtPosition"))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("setAttachedToEntity"))return;if(!Z.isSpawned)return d.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("setAttachedToPosition"))return;this._attachedToPosition=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_ATTACHED_TO_POSITION",{playerCamera:this,position:Z})}setFilmOffset(Z){if(!this._requirePlayerWorld("setFilmOffset"))return;this._filmOffset=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FILM_OFFSET",{playerCamera:this,filmOffset:Z})}setForwardOffset(Z){if(!this._requirePlayerWorld("setForwardOffset"))return;this._forwardOffset=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FORWARD_OFFSET",{playerCamera:this,forwardOffset:Z})}setFov(Z){if(!this._requirePlayerWorld("setFov"))return;this._fov=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_FOV",{playerCamera:this,fov:Z})}setModelHiddenNodes(Z){if(!this._requirePlayerWorld("setModelHiddenNodes"))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})}setModelShownNodes(Z){if(!this._requirePlayerWorld("setModelShownNodes"))return;this._modelShownNodes=new Set(Z.map((J)=>J.toLowerCase())),this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_MODEL_SHOWN_NODES",{playerCamera:this,modelShownNodes:this._modelShownNodes})}setMode(Z){if(!this._requirePlayerWorld("setMode"))return;this._mode=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_MODE",{playerCamera:this,mode:Z})}setOffset(Z){if(!this._requirePlayerWorld("setOffset"))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}setShoulderAngle(Z){if(!this._requirePlayerWorld("setShoulderAngle"))return;this._shoulderAngle=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_SHOULDER_ANGLE",{playerCamera:this,shoulderAngle:Z})}setTrackedEntity(Z){if(!this._requirePlayerWorld("setTrackedEntity"))return;this._trackedEntity=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_TRACKED_ENTITY",{playerCamera:this,entity:Z})}setTrackedPosition(Z){if(!this._requirePlayerWorld("setTrackedPosition"))return;this._trackedPosition=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_TRACKED_POSITION",{playerCamera:this,position:Z})}setZoom(Z){if(!this._requirePlayerWorld("setZoom"))return;this._zoom=Z,this.emitWithWorld(this.player.world,"PLAYER_CAMERA.SET_ZOOM",{playerCamera:this,zoom:Z})}serialize(){if(!this.player.world)d.fatalError("PlayerCamera.serialize(): PlayerCamera player is not in a world and cannot be serialized!");return D0.serializePlayerCamera(this,this.player.world.tickAllocator)}_requirePlayerWorld(Z){if(!this.player.world)d.error(`PlayerCamera._requirePlayerWorld(): Player ${this.player.id} is not in a world, invoked method: ${Z}()`);return!!this.player.world}}var TB;(($)=>{$.DATA="PLAYER_UI.DATA";$.LOAD="PLAYER_UI.LOAD";$.LOCK_POINTER="PLAYER_UI.LOCK_POINTER";$.SEND_DATA="PLAYER_UI.SEND_DATA"})(TB||={});class uz extends j0{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})}}var L80=["w","a","s","d","sp","sh","tb","ml","mr","q","e","r","f","z","x","c","v","u","i","o","j","k","l","n","m","1","2","3","4","5","6","7","8","9","0"],dz;((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"})(dz||={});class lW extends j0{static _devNextPlayerId=1;id;username;profilePictureUrl;camera;connection;ui;_input={};_lastUnreliableInputSequenceNumber=0;_persistedData;_world;_worldSwitched=!1;constructor(Z,J){super();this.id=J?.user.id??`player-${lW._devNextPlayerId++}`,this.username=J?.user.username??this.id,this.profilePictureUrl=J?.user.profilePictureURL??void 0,this.camera=new mz(this),this.connection=Z,this.ui=new uz(this),Z.onPacket(Y0.PacketId.CHAT_MESSAGE_SEND,this._onChatMessageSendPacket),Z.onPacket(Y0.PacketId.DEBUG_CONFIG,this._onDebugConfigPacket),Z.onPacket(Y0.PacketId.INPUT,this._onInputPacket),Z.onPacket(Y0.PacketId.SYNC_REQUEST,this._onSyncRequestPacket),Z.onPacket(Y0.PacketId.UI_DATA_SEND,this._onUIDataSendPacket)}get input(){return this._input}get world(){return this._world}disconnect(){this._leaveWorld(),this.connection.disconnect()}getPersistedData(){return this._persistedData}joinWorld(Z){if(this._world===Z)return;if(!this._world)this._world=Z,this.emitWithWorld(this._world,"PLAYER.JOINED_WORLD",{player:this,world:this._world});else{for(let J of this._world.entityManager.getPlayerEntitiesByPlayer(this))if(J.isSpawned)J.despawn();this.disconnect(),this._world=Z,this._worldSwitched=!0}}async loadInitialPersistedData(){if(this._persistedData)return;this._persistedData=await W$.instance.getPlayerData(this)??void 0}reconnected(){if(!this._world)return;if(this._lastUnreliableInputSequenceNumber=0,!this._worldSwitched)this.emitWithWorld(this._world,"PLAYER.RECONNECTED_WORLD",{player:this,world:this._world});else this._worldSwitched=!1,this.emitWithWorld(this._world,"PLAYER.JOINED_WORLD",{player:this,world:this._world})}resetInputs(){this._input={}}setPersistedData(Z){return this._persistedData={...this._persistedData,...Z},W$.instance.setPlayerData(this,Z).catch((J)=>{}),this._persistedData}serialize(){if(!this._world)d.fatalError("Player.serialize(): Player is not in a world and cannot be serialized!");return D0.serializePlayer(this,this._world.tickAllocator)}_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(L80.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 dE;((X)=>{X.BROADCAST_MESSAGE="CHAT.BROADCAST_MESSAGE";X.PLAYER_MESSAGE="CHAT.PLAYER_MESSAGE"})(dE||={});class cz extends j0{_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})}}var W9=16,cE=W9-1,nI1=W9**3;class K9{_blocks;_chunkLattice;_originCoordinate;constructor(Z,J){this._blocks=new Uint8Array(nI1),this._chunkLattice=Z,this._originCoordinate=J}get blocks(){return this._blocks}get chunkLattice(){return this._chunkLattice}get originCoordinate(){return this._originCoordinate}static blockIndexToLocalCoordinate(Z){return{x:Z%W9,y:(Z/W9|0)%W9,z:Z/(W9*W9)|0}}static globalCoordinateToLocalCoordinate(Z){return{x:Z.x&W9-1,y:Z.y&W9-1,z:Z.z&W9-1}}static globalCoordinateToOriginCoordinate(Z){return{x:Z.x&~(W9-1),y:Z.y&~(W9-1),z:Z.z&~(W9-1)}}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 d.error("Chunk.setBlock(): Block local coordinate is out of bounds");let X=this._getIndex(Z);this._blocks[X]=J}serialize(){return D0.serializeChunk(this,this._chunkLattice.world.tickAllocator)}_getIndex(Z){return Z.x+(Z.y<<4)+(Z.z<<8)}_isValidLocalCoordinate(Z){return Z.x>=0&&Z.x<=cE&&Z.y>=0&&Z.y<=cE&&Z.z>=0&&Z.z<=cE}}var lE;((Y)=>{Y.ADD_CHUNK="CHUNK_LATTICE.ADD_CHUNK";Y.REMOVE_CHUNK="CHUNK_LATTICE.REMOVE_CHUNK";Y.SET_BLOCK="CHUNK_LATTICE.SET_BLOCK"})(lE||={});class lz extends j0{_blockTypeColliders=new Map;_blockTypeCounts=new Map;_chunks=new Map;_rigidBody;_world;constructor(Z){super();this._world=Z}get chunkCount(){return this._chunks.size}get world(){return this._world}clear(){for(let Z of this._blockTypeColliders.values())this._world.simulation.colliderMap.removeColliderBlockType(Z),Z.removeFromSimulation();this._chunks.forEach((Z)=>{this.emitWithWorld(this._world,"CHUNK_LATTICE.REMOVE_CHUNK",{chunkLattice:this,chunk:Z})}),this._blockTypeColliders.clear(),this._blockTypeCounts.clear(),this._chunks.clear()}getBlockId(Z){let J=this.getChunk(K9.globalCoordinateToOriginCoordinate(Z));if(!J)return 0;return J.getBlockId(K9.globalCoordinateToLocalCoordinate(Z))}getBlockTypeCollider(Z){return this._blockTypeColliders.get(Z)}getBlockType(Z){let J=this.getBlockId(Z);return J?this._world.blockTypeRegistry.getBlockType(J):null}getBlockTypeCount(Z){return this._blockTypeCounts.get(Z)??0}getChunk(Z){return this._chunks.get(this._getChunkKey(K9.globalCoordinateToOriginCoordinate(Z)))}getOrCreateBlockTypeCollider(Z,J){let X=this._blockTypeColliders.get(Z);if(X)return X;let $=this._world.blockTypeRegistry.getBlockType(Z).createCollider(J);return this._blockTypeColliders.set(Z,$),$}getOrCreateChunk(Z){let J=K9.globalCoordinateToOriginCoordinate(Z),X=this._chunks.get(this._getChunkKey(J));if(X)return X;return X=new K9(this,J),this._chunks.set(this._getChunkKey(J),X),this.emitWithWorld(this._world,"CHUNK_LATTICE.ADD_CHUNK",{chunkLattice:this,chunk:X}),X}getAllChunks(Z=!1){return Z?this._world.tickAllocator.getArray(this._chunks.values()):Array.from(this._chunks.values())}hasBlock(Z){let J=this.getChunk(K9.globalCoordinateToOriginCoordinate(Z));if(!J)return!1;return J.hasBlock(K9.globalCoordinateToLocalCoordinate(Z))}hasChunk(Z){let J=K9.globalCoordinateToOriginCoordinate(Z);return this._chunks.has(this._getChunkKey(J))}setBlock(Z,J){let X=K9.globalCoordinateToLocalCoordinate(Z),Y=this.getOrCreateChunk(Z),$=Y.getBlockId(X);if($===J)return;if(Y.setBlock(X,J),!this._rigidBody)this._rigidBody=new tY({type:"fixed"}),this._rigidBody.addToSimulation(this._world.simulation);if($!==0){let Q=Math.max(0,(this._blockTypeCounts.get($)??0)-1),W=this.getBlockTypeCollider($);if(W)if(Q===0)this._world.simulation.colliderMap.removeColliderBlockType(W),W.removeFromSimulation(),this._blockTypeColliders.delete($);else W.setVoxel(Z,!1),this._propagateVoxelChange(W,Z);this._blockTypeCounts.set($,Q)}if(J!==0){let Q=(this._blockTypeCounts.get(J)??0)+1,W=this.getOrCreateBlockTypeCollider(J,[Z]);if(Q===1){let K=this._world.blockTypeRegistry.getBlockType(J);W.addToSimulation(this._world.simulation,this._rigidBody),this._world.simulation.colliderMap.setColliderBlockType(W,K),this._combineVoxelStates(W)}else W.setVoxel(Z,!0),this._propagateVoxelChange(W,Z);this._blockTypeCounts.set(J,Q)}this.emitWithWorld(this._world,"CHUNK_LATTICE.SET_BLOCK",{chunkLattice:this,chunk:Y,globalCoordinate:Z,localCoordinate:X,blockTypeId:J})}_combineVoxelStates(Z){if(Z.isSensor)return;for(let J of this._blockTypeColliders.values()){if(J===Z||J.isSensor)continue;Z.combineVoxelStates(J)}}_getChunkKey(Z){return`${Z.x},${Z.y},${Z.z}`}_propagateVoxelChange(Z,J){if(Z.isSensor)return;for(let X of this._blockTypeColliders.values()){if(X===Z||X.isSensor)continue;Z.propagateVoxelChange(X,J)}}}class pz{_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)this._cleanupBlockTypeColliderHandles.add(Z);if(this._pendingCleanupBlockTypeColliderHandles.size>0)this._pendingCleanupBlockTypeColliderHandles.clear();for(let Z of this._pendingCleanupCollisionCallbackColliderHandles)this._cleanupCollisionCallbackColliderHandles.add(Z);if(this._pendingCleanupCollisionCallbackColliderHandles.size>0)this._pendingCleanupCollisionCallbackColliderHandles.clear();for(let Z of this._pendingCleanupEntityColliderHandles)this._cleanupEntityColliderHandles.add(Z);if(this._pendingCleanupEntityColliderHandles.size>0)this._pendingCleanupEntityColliderHandles.clear()}_requireSimulatedCollider(Z){if(!Z.rawCollider)d.error("ColliderMap._requireSimulatedCollider(): Collider is not in the simulation.");return!!Z.rawCollider}}var O80={type:"dynamic",softCcdPrediction:1},j80=0.015625,M80=Math.cos(0.026),iz;((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_MODEL_SCALE="ENTITY.SET_MODEL_SCALE";j.SET_MODEL_SHOWN_NODES="ENTITY.SET_MODEL_SHOWN_NODES";j.SET_MODEL_TEXTURE_URI="ENTITY.SET_MODEL_TEXTURE_URI";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"})(iz||={});class a8 extends tY{_id;_blockHalfExtents;_blockTextureUri;_controller;_isEnvironmental=!1;_modelAnimationsPlaybackRate=1;_modelHiddenNodes=new Set;_modelLoopedAnimations=new Set;_modelOneshotAnimations=new Set;_modelPreferredShape;_modelScale=1;_modelShownNodes=new Set;_modelTextureUri;_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;_positionUpdateThresholdSq;_rotationUpdateThreshold;constructor(Z){let J="blockTextureUri"in Z,X="modelUri"in Z;if(!J===!X)d.fatalError("Entity.constructor(): Entity data must include a blockTextureUri or modelUri, but not both.");if(J&&!Z.blockHalfExtents)d.fatalError("Entity.constructor(): Block entity must have blockHalfExtents!");if(Z.parent&&!Z.parent.isSpawned)d.fatalError("Entity.constructor(): Parent entity must be spawned before child entity!");if(Z.parent?.modelUri&&Z.parentNodeName&&!k5.instance.modelHasNode(Z.parent.modelUri,Z.parentNodeName))d.fatalError(`Entity.constructor(): Parent node name ${Z.parentNodeName} not found in parent model ${Z.parent.modelUri}!`);super(Z.rigidBodyOptions??O80);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._modelTextureUri=Z.modelTextureUri,this._modelUri=Z.modelUri,Z.modelHiddenNodes?.forEach((Y)=>this._modelHiddenNodes.add(Y.toLowerCase())),Z.modelLoopedAnimations?.forEach((Y)=>this._modelLoopedAnimations.add(Y)),Z.modelShownNodes?.forEach((Y)=>this._modelShownNodes.add(Y.toLowerCase()));if(this._isEnvironmental=Z.isEnvironmental??!1,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,this._positionUpdateThresholdSq=j80,this._rotationUpdateThreshold=M80,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 depth(){return this.isModelEntity?k5.instance.getDepth(this._modelUri)*(this._modelScale??1):this._blockHalfExtents.z*2}get height(){return this.isModelEntity?k5.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 modelShownNodes(){return this._modelShownNodes}get modelTextureUri(){return this._modelTextureUri}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 isEnvironmental(){return this._isEnvironmental}get isModelEntity(){return!!this._modelUri}get isSpawned(){return!!this._world}get width(){return this.isModelEntity?k5.instance.getWidth(this._modelUri)*(this._modelScale??1):this._blockHalfExtents.x*2}get world(){return this._world}spawn(Z,J,X){if(this.isSpawned)return d.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 $9($9.optionsFromBlockHalfExtents(this._blockHalfExtents)));if(this._modelUri&&this.numColliders===0&&this._modelPreferredShape!=="none")this.addChildColliderToSimulation(new $9($9.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)){let $=this.isEnvironmental?[8]:[Y.isSensor?4:2],Q=this.isEnvironmental?[65535&~8&~1]:[65535];Y.setCollisionGroups({belongsTo:$,collidesWith:Q})}}),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.particleEmitterManager.despawnEntityAttachedParticleEmitters(this),this._world.sceneUIManager.unloadEntityAttachedSceneUIs(this),this._id=void 0,this._world=void 0}setController(Z){if(this._controller===Z)return;if(this._controller)this._controller.detach(this);if(this._controller=Z,this._controller)this._controller.attach(this)}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})}setModelHiddenNodes(Z){if(!this._requireSpawned("setModelHiddenNodes"))return;if(!this.isModelEntity)return;this._modelHiddenNodes=new Set(Z.map((J)=>J.toLowerCase())),this.emitWithWorld(this._world,"ENTITY.SET_MODEL_HIDDEN_NODES",{entity:this,modelHiddenNodes:this._modelHiddenNodes})}setModelScale(Z){if(!this._requireSpawned("setModelScale"))return;if(!this.isModelEntity||this._modelScale===Z)return;let J=Z/this._modelScale;this._modelScale=Z,this.colliders.forEach((X)=>X.scale(J)),this.emitWithWorld(this._world,"ENTITY.SET_MODEL_SCALE",{entity:this,modelScale:Z})}setModelShownNodes(Z){if(!this._requireSpawned("setModelShownNodes"))return;if(!this.isModelEntity)return;this._modelShownNodes=new Set(Z.map((J)=>J.toLowerCase())),this.emitWithWorld(this._world,"ENTITY.SET_MODEL_SHOWN_NODES",{entity:this,modelShownNodes:this._modelShownNodes})}setModelTextureUri(Z){if(!this._requireSpawned("setModelTextureUri"))return;if(!this.isModelEntity||this._modelTextureUri===Z)return;this._modelTextureUri=Z,this.emitWithWorld(this._world,"ENTITY.SET_MODEL_TEXTURE_URI",{entity:this,modelTextureUri:Z})}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 d.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(){if(!this._world)d.fatalError("Entity.serialize(): Entity is not in a world and cannot be serialized!");return D0.serializeEntity(this,this._world.tickAllocator)}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;let X=this._world.tickAllocator.getObject();X.entity=this,X.rotation=J,this.emitWithWorld(this._world,"ENTITY.UPDATE_ROTATION",X)}if(this._positionExceedsThreshold(Z,this._lastUpdatedPosition)){this._lastUpdatedPosition=Z;let X=this._world.tickAllocator.getObject();X.entity=this,X.position=Z,this.emitWithWorld(this._world,"ENTITY.UPDATE_POSITION",X)}}_positionExceedsThreshold(Z,J){let X=Z.x-J.x,Y=Z.y-J.y,$=Z.z-J.z;return X*X+Y*Y+$*$>this._positionUpdateThresholdSq}_requireSpawned(Z){if(!this.isSpawned)d.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)<this._rotationUpdateThreshold}_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)}}class g1 extends qY{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;faceForwardOnStop=!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.faceForwardOnStop=Z.faceForwardOnStop??this.faceForwardOnStop,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 m3({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()+g1.SWIM_UPWARD_COOLDOWN_MS;else Z.setGravityScale(1),Z.stopModelAnimations(this.swimLoopedAnimations)})}spawn(Z){if(!Z.isSpawned)return d.error("DefaultPlayerEntityController.spawn(): Entity is not spawned!");Z.createAndAddChildCollider({shape:"cylinder",radius:g1.GROUND_SENSOR_RADIUS_SCALE*(Z.height/g1.BASE_ENTITY_HEIGHT),halfHeight:g1.GROUND_SENSOR_HEIGHT_SCALE*(Z.height/g1.BASE_ENTITY_HEIGHT),collisionGroups:{belongsTo:[4],collidesWith:[1,2,8]},isSensor:!0,relativePosition:{x:0,y:-Z.height/2,z:0},tag:"groundSensor",onCollision:(J,X)=>{if(!Z.isSpawned)return;if(!(J instanceof Q9)||!J.isLiquid){if(X&&this._groundContactCount===0&&Z.linearVelocity.y<-1)if(Z.linearVelocity.y<g1.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:g1.WALL_COLLIDER_HEIGHT_SCALE*(Z.height/g1.BASE_ENTITY_HEIGHT),radius:g1.WALL_COLLIDER_RADIUS_SCALE*(Z.height/g1.BASE_ENTITY_HEIGHT),collisionGroups:{belongsTo:[4],collidesWith:[1,2,8]},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:W,d:K,c:G,sp:z,sh:H,ml:V}=J,{yaw:q}=X,F=Z.linearVelocity;this._reusableTargetVelocities.x=0,this._reusableTargetVelocities.y=0,this._reusableTargetVelocities.z=0,this._isActivelyMoving=!!($||Q||W||K);let U=H,B=Q&&K&&!$&&!W||$&&W&&!Q&&!K,w=U&&this.canRun(this)||!U&&this.canWalk(this);if(this.isSwimming&&!this._isFullySubmerged)this._isFullySubmerged=!0,this._justSubmergedUntil=performance.now()+g1.WATER_ENTRY_SINKING_MS;else if(!this.isSwimming)this._isFullySubmerged=!1,this._justSubmergedUntil=0;if(this.isGrounded&&!this.isSwimming&&this._isActivelyMoving&&!B&&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.canSwim(this))if(this._stepAudio?.pause(),this._isActivelyMoving)Z.stopAllModelLoopedAnimations(this.swimLoopedAnimations),Z.startModelLoopedAnimations(this.swimLoopedAnimations);else Z.stopAllModelLoopedAnimations(this.swimIdleLoopedAnimations),Z.startModelLoopedAnimations(this.swimIdleLoopedAnimations);else this._stepAudio?.pause(),Z.stopAllModelLoopedAnimations(this.idleLoopedAnimations),Z.startModelLoopedAnimations(this.idleLoopedAnimations);let O;if(this.applyDirectionalMovementRotations&&w){if($&&Q&&!K&&!W)O=g1.MOVEMENT_ROTATIONS.wa;else if($&&K&&!Q&&!W)O=g1.MOVEMENT_ROTATIONS.wd;else if(W&&Q&&!$&&!K)O=g1.MOVEMENT_ROTATIONS.sa;else if(W&&K&&!$&&!Q)O=g1.MOVEMENT_ROTATIONS.sd;else if(W&&!$&&!Q&&!K||Q&&W&&K&&!$)O=g1.MOVEMENT_ROTATIONS.s;else if(Q&&!$&&!W&&!K)O=g1.MOVEMENT_ROTATIONS.a;else if(K&&!$&&!Q&&!W)O=g1.MOVEMENT_ROTATIONS.d}if(V)Z.startModelOneshotAnimations(this.interactOneshotAnimations),J.ml=!this.autoCancelMouseLeftClick;if(w){let D=!this.isSwimming?U?this.runVelocity:this.walkVelocity:U?this.swimFastVelocity:this.swimSlowVelocity,C=Math.sin(q),T=Math.cos(q);if($)this._reusableTargetVelocities.x-=D*C,this._reusableTargetVelocities.z-=D*T;if(W)this._reusableTargetVelocities.x+=D*C,this._reusableTargetVelocities.z+=D*T;if(Q)this._reusableTargetVelocities.x-=D*T,this._reusableTargetVelocities.z+=D*C;if(K)this._reusableTargetVelocities.x+=D*T,this._reusableTargetVelocities.z-=D*C;let k=Math.sqrt(this._reusableTargetVelocities.x*this._reusableTargetVelocities.x+this._reusableTargetVelocities.z*this._reusableTargetVelocities.z);if(k>D){let x=D/k;this._reusableTargetVelocities.x*=x,this._reusableTargetVelocities.z*=x}}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*g1.WATER_ENTRY_SINKING_FACTOR;else if(!z)this._reusableTargetVelocities.y=-F.y*g1.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 N=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 T=Math.max(0,D-g1.EXTERNAL_IMPULSE_DECAY_RATE)/D;this._externalVelocity.x*=T,this._magnitudeYTracker*=T,this._externalVelocity.z*=T}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+N.x,j=this._reusableTargetVelocities.y+this._externalVelocity.y+N.y,P=this._reusableTargetVelocities.z+this._externalVelocity.z-F.z+N.z;if(this._externalVelocity.y=0,R!==0||j!==0||P!==0){let D=Z.mass;this._reusableImpulse.x=R*D,this._reusableImpulse.y=j*D,this._reusableImpulse.z=P*D,this._internalApplyImpulse(this._reusableImpulse)}if(q!==void 0&&(this.faceForwardOnStop||this.isActivelyMoving)){let C=(O!==void 0?q+O:q)*0.5;Z.setRotation({x:0,y:Math.sin(C),z:0,w:Math.cos(C)})}}}var pE;((K)=>{K.LOAD="SCENE_UI.LOAD";K.SET_ATTACHED_TO_ENTITY="SCENE_UI.SET_ATTACHED_TO_ENTITY";K.SET_OFFSET="SCENE_UI.SET_OFFSET";K.SET_POSITION="SCENE_UI.SET_POSITION";K.SET_STATE="SCENE_UI.SET_STATE";K.SET_VIEW_DISTANCE="SCENE_UI.SET_VIEW_DISTANCE";K.UNLOAD="SCENE_UI.UNLOAD"})(pE||={});class nz extends j0{_id;_attachedToEntity;_offset;_position;_state={};_templateId;_viewDistance;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)d.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 d.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 d.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(){if(!this._world)d.fatalError("SceneUI.serialize(): SceneUI is not in a world and cannot be serialized!");return D0.serializeSceneUI(this,this._world.tickAllocator)}}var R80=0.010000000000000002,N80=Math.cos(0.026);class v7 extends a8{player;nametagSceneUI;constructor(Z){super(Z);this._positionUpdateThresholdSq=R80,this._rotationUpdateThreshold=N80,this.player=Z.player,this.nametagSceneUI=new nz({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 d.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 iE extends v7{constructor(Z){super({modelUri:"models/players/player.gltf",modelLoopedAnimations:["idle_lower","idle_upper"],modelHiddenNodes:["hair-"],modelShownNodes:["hair-0003"],...Z});if(!Z.controller)this.setController(new g1)}}class az{_activeEntities=new Set;_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)d.fatalError(`EntityManager.registerEntity(): Entity ${Z.name} is already assigned the id ${Z.id}!`);let J=this._nextEntityId;if(this._entities.set(J,Z),this._nextEntityId++,!Z.isEnvironmental)this._activeEntities.add(Z);return J}unregisterEntity(Z){if(Z.id===void 0)return d.error(`EntityManager.unregisterEntity(): Entity ${Z.name} is not assigned an id!`);if(this._entities.delete(Z.id),!Z.isEnvironmental)this._activeEntities.delete(Z)}getAllEntities(Z=!1){return Z?this._world.tickAllocator.getArray(this._entities.values()):Array.from(this._entities.values())}getAllPlayerEntities(){let Z=[];return this._entities.forEach((J)=>{if(J instanceof v7)Z.push(J)}),Z}getPlayerEntitiesByPlayer(Z){let J=[];return this._entities.forEach((X)=>{if(X instanceof v7&&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){for(let J of this._activeEntities)J.tick(Z)}checkAndEmitUpdates(){for(let Z of this._activeEntities)Z.checkAndEmitUpdates()}}import{WebSocket as H46}from"ws";var X5=e(T60(),1),sN6=X5.default.v1,oN6=X5.default.v1ToV6,rN6=X5.default.v3,k60=X5.default.v4,tN6=X5.default.v5,eN6=X5.default.v6,ZD6=X5.default.v6ToV1,JD6=X5.default.v7,XD6=X5.default.NIL,YD6=X5.default.MAX,$D6=X5.default.version,QD6=X5.default.validate,WD6=X5.default.stringify,KD6=X5.default.parse;var ZI;try{ZI=new TextDecoder}catch(Z){}var J0,z9,y=0;var $I=[],G$=$I,rz=0,h1={},K1,hZ,G9=0,y9=0,s8,fZ,x5=[],Y1,E60={useRecords:!1,mapsAsObjects:!0};class AB{}var QI=new AB;QI.name="MessagePack 0xC1";var sJ=!1,f60=2,JI,XI,YI;try{new Function("")}catch(Z){f60=1/0}class bZ{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(J0)return n60(()=>{return xB(),this?this.unpack(Z,J):bZ.prototype.unpack.call(E60,Z,J)});if(!Z.buffer&&Z.constructor===ArrayBuffer)Z=typeof Buffer!=="undefined"?Buffer.from(Z):new Uint8Array(Z);if(typeof J==="object")z9=J.end||Z.length,y=J.start||0;else y=0,z9=J>-1?J:Z.length;rz=0,y9=0,hZ=null,G$=$I,s8=null,J0=Z;try{Y1=Z.dataView||(Z.dataView=new DataView(Z.buffer,Z.byteOffset,Z.byteLength))}catch(X){if(J0=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 bZ){if(h1=this,this.structures)return K1=this.structures,SB(J);else if(!K1||K1.length>0)K1=[]}else if(h1=E60,!K1||K1.length>0)K1=[];return SB(J)}unpackMultiple(Z,J){let X,Y=0;try{sJ=!0;let $=Z.length,Q=this?this.unpack(Z,$):hB.unpack(Z,$);if(J){if(J(Q,Y,y)===!1)return;while(y<$)if(Y=y,J(SB(),Y,y)===!1)return}else{X=[Q];while(y<$)Y=y,X.push(SB());return X}}catch($){throw $.lastPosition=Y,$.values=X,$}finally{sJ=!1,xB()}}_mergeStructures(Z,J){if(XI)Z=XI.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 SB(Z){try{if(!h1.trusted&&!sJ){let X=K1.sharedLength||0;if(X<K1.length)K1.length=X}let J;if(h1.randomAccessStructure&&J0[y]<64&&J0[y]>=32&&JI){if(J=JI(J0,y,z9,h1),J0=null,!(Z&&Z.lazy)&&J)J=J.toJSON();y=z9}else J=_8();if(s8)y=s8.postBundlePosition,s8=null;if(sJ)K1.restoreStructures=null;if(y==z9){if(K1&&K1.restoreStructures)I60();if(K1=null,J0=null,fZ)fZ=null}else if(y>z9)throw new Error("Unexpected end of MessagePack data");else if(!sJ){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(K1&&K1.restoreStructures)I60();if(xB(),J instanceof RangeError||J.message.startsWith("Unexpected end of buffer")||y>z9)J.incomplete=!0;throw J}}function I60(){for(let Z in K1.restoreStructures)K1[Z]=K1.restoreStructures[Z];K1.restoreStructures=null}function _8(){let Z=J0[y++];if(Z<160)if(Z<128)if(Z<64)return Z;else{let J=K1[Z&63]||h1.getStructures&&b60()[Z&63];if(J){if(!J.read)J.read=WI(J,Z&63);return J.read()}else return Z}else if(Z<144)if(Z-=128,h1.mapsAsObjects){let J={};for(let X=0;X<Z;X++){let Y=p60();if(Y==="__proto__")Y="__proto_";J[Y]=_8()}return J}else{let J=new Map;for(let X=0;X<Z;X++)J.set(_8(),_8());return J}else{Z-=144;let J=new Array(Z);for(let X=0;X<Z;X++)J[X]=_8();if(h1.freezeData)return Object.freeze(J);return J}else if(Z<192){let J=Z-160;if(y9>=y)return hZ.slice(y-G9,(y+=J)-G9);if(y9==0&&z9<140){let X=J<16?KI(J):l60(J);if(X!=null)return X}return _B(J)}else{let J;switch(Z){case 192:return null;case 193:if(s8)if(J=_8(),J>0)return s8[1].slice(s8.position1,s8.position1+=J);else return s8[0].slice(s8.position0,s8.position0-=J);return QI;case 194:return!1;case 195:return!0;case 196:if(J=J0[y++],J===void 0)throw new Error("Unexpected end of buffer");return eE(J);case 197:return J=Y1.getUint16(y),y+=2,eE(J);case 198:return J=Y1.getUint32(y),y+=4,eE(J);case 199:return K$(J0[y++]);case 200:return J=Y1.getUint16(y),y+=2,K$(J);case 201:return J=Y1.getUint32(y),y+=4,K$(J);case 202:if(J=Y1.getFloat32(y),h1.useFloat32>2){let X=H$[(J0[y]&127)<<1|J0[y+1]>>7];return y+=4,(X*J+(J>0?0.5:-0.5)>>0)/X}return y+=4,J;case 203:return J=Y1.getFloat64(y),y+=8,J;case 204:return J0[y++];case 205:return J=Y1.getUint16(y),y+=2,J;case 206:return J=Y1.getUint32(y),y+=4,J;case 207:if(h1.int64AsType==="number")J=Y1.getUint32(y)*4294967296,J+=Y1.getUint32(y+4);else if(h1.int64AsType==="string")J=Y1.getBigUint64(y).toString();else if(h1.int64AsType==="auto"){if(J=Y1.getBigUint64(y),J<=BigInt(2)<<BigInt(52))J=Number(J)}else J=Y1.getBigUint64(y);return y+=8,J;case 208:return Y1.getInt8(y++);case 209:return J=Y1.getInt16(y),y+=2,J;case 210:return J=Y1.getInt32(y),y+=4,J;case 211:if(h1.int64AsType==="number")J=Y1.getInt32(y)*4294967296,J+=Y1.getUint32(y+4);else if(h1.int64AsType==="string")J=Y1.getBigInt64(y).toString();else if(h1.int64AsType==="auto"){if(J=Y1.getBigInt64(y),J>=BigInt(-2)<<BigInt(52)&&J<=BigInt(2)<<BigInt(52))J=Number(J)}else J=Y1.getBigInt64(y);return y+=8,J;case 212:if(J=J0[y++],J==114)return h60(J0[y++]&63);else{let X=x5[J];if(X)if(X.read)return y++,X.read(_8());else if(X.noBuffer)return y++,X();else return X(J0.subarray(y,++y));else throw new Error("Unknown extension "+J)}case 213:if(J=J0[y],J==114)return y++,h60(J0[y++]&63,J0[y++]);else return K$(2);case 214:return K$(4);case 215:return K$(8);case 216:return K$(16);case 217:if(J=J0[y++],y9>=y)return hZ.slice(y-G9,(y+=J)-G9);return y60(J);case 218:if(J=Y1.getUint16(y),y+=2,y9>=y)return hZ.slice(y-G9,(y+=J)-G9);return g60(J);case 219:if(J=Y1.getUint32(y),y+=4,y9>=y)return hZ.slice(y-G9,(y+=J)-G9);return m60(J);case 220:return J=Y1.getUint16(y),y+=2,S60(J);case 221:return J=Y1.getUint32(y),y+=4,S60(J);case 222:return J=Y1.getUint16(y),y+=2,_60(J);case 223:return J=Y1.getUint32(y),y+=4,_60(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 NS1=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function WI(Z,J){function X(){if(X.count++>f60){let $=Z.read=new Function("r","return function(){return "+(h1.freezeData?"Object.freeze":"")+"({"+Z.map((Q)=>Q==="__proto__"?"__proto_:r()":NS1.test(Q)?Q+":r()":"["+JSON.stringify(Q)+"]:r()").join(",")+"})}")(_8);if(Z.highByte===0)Z.read=v60(J,Z.read);return $()}let Y={};for(let $=0,Q=Z.length;$<Q;$++){let W=Z[$];if(W==="__proto__")W="__proto_";Y[W]=_8()}if(h1.freezeData)return Object.freeze(Y);return Y}if(X.count=0,Z.highByte===0)return v60(J,X);return X}var v60=(Z,J)=>{return function(){let X=J0[y++];if(X===0)return J();let Y=Z<32?-(Z+(X<<5)):Z+(X<<5),$=K1[Y]||b60()[Y];if(!$)throw new Error("Record id is not defined for "+Y);if(!$.read)$.read=WI($,Z);return $.read()}};function b60(){let Z=n60(()=>{return J0=null,h1.getStructures()});return K1=h1._mergeStructures(Z,K1)}var _B=z$,y60=z$,g60=z$,m60=z$,u60=!1;function d60(Z){u60=!0,_B=J(1),y60=J(2),g60=J(3),m60=J(5);function J(X){return function Y($){let Q=G$[rz++];if(Q==null){if(s8)return z$($);let K=J0.byteOffset,G=Z(y-X+K,z9+K,J0.buffer);if(typeof G=="string")Q=G,G$=$I;else if(G$=G,rz=1,y9=1,Q=G$[0],Q===void 0)throw new Error("Unexpected end of buffer")}let W=Q.length;if(W<=$)return y+=$,Q;return hZ=Q,G9=y,y9=y+W,y+=$,Q.slice(0,$)}}}function z$(Z){let J;if(Z<16){if(J=KI(Z))return J}if(Z>64&&ZI)return ZI.decode(J0.subarray(y,y+=Z));let X=y+Z,Y=[];J="";while(y<X){let $=J0[y++];if(($&128)===0)Y.push($);else if(($&224)===192){let Q=J0[y++]&63;Y.push(($&31)<<6|Q)}else if(($&240)===224){let Q=J0[y++]&63,W=J0[y++]&63;Y.push(($&31)<<12|Q<<6|W)}else if(($&248)===240){let Q=J0[y++]&63,W=J0[y++]&63,K=J0[y++]&63,G=($&7)<<18|Q<<12|W<<6|K;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+=$6.apply(String,Y),Y.length=0}if(Y.length>0)J+=$6.apply(String,Y);return J}function c60(Z,J,X){let Y=J0;J0=Z,y=J;try{return z$(X)}finally{J0=Y}}function S60(Z){let J=new Array(Z);for(let X=0;X<Z;X++)J[X]=_8();if(h1.freezeData)return Object.freeze(J);return J}function _60(Z){if(h1.mapsAsObjects){let J={};for(let X=0;X<Z;X++){let Y=p60();if(Y==="__proto__")Y="__proto_";J[Y]=_8()}return J}else{let J=new Map;for(let X=0;X<Z;X++)J.set(_8(),_8());return J}}var $6=String.fromCharCode;function l60(Z){let J=y,X=new Array(Z);for(let Y=0;Y<Z;Y++){let $=J0[y++];if(($&128)>0){y=J;return}X[Y]=$}return $6.apply(String,X)}function KI(Z){if(Z<4)if(Z<2)if(Z===0)return"";else{let J=J0[y++];if((J&128)>1){y-=1;return}return $6(J)}else{let J=J0[y++],X=J0[y++];if((J&128)>0||(X&128)>0){y-=2;return}if(Z<3)return $6(J,X);let Y=J0[y++];if((Y&128)>0){y-=3;return}return $6(J,X,Y)}else{let J=J0[y++],X=J0[y++],Y=J0[y++],$=J0[y++];if((J&128)>0||(X&128)>0||(Y&128)>0||($&128)>0){y-=4;return}if(Z<6)if(Z===4)return $6(J,X,Y,$);else{let Q=J0[y++];if((Q&128)>0){y-=5;return}return $6(J,X,Y,$,Q)}else if(Z<8){let Q=J0[y++],W=J0[y++];if((Q&128)>0||(W&128)>0){y-=6;return}if(Z<7)return $6(J,X,Y,$,Q,W);let K=J0[y++];if((K&128)>0){y-=7;return}return $6(J,X,Y,$,Q,W,K)}else{let Q=J0[y++],W=J0[y++],K=J0[y++],G=J0[y++];if((Q&128)>0||(W&128)>0||(K&128)>0||(G&128)>0){y-=8;return}if(Z<10)if(Z===8)return $6(J,X,Y,$,Q,W,K,G);else{let z=J0[y++];if((z&128)>0){y-=9;return}return $6(J,X,Y,$,Q,W,K,G,z)}else if(Z<12){let z=J0[y++],H=J0[y++];if((z&128)>0||(H&128)>0){y-=10;return}if(Z<11)return $6(J,X,Y,$,Q,W,K,G,z,H);let V=J0[y++];if((V&128)>0){y-=11;return}return $6(J,X,Y,$,Q,W,K,G,z,H,V)}else{let z=J0[y++],H=J0[y++],V=J0[y++],q=J0[y++];if((z&128)>0||(H&128)>0||(V&128)>0||(q&128)>0){y-=12;return}if(Z<14)if(Z===12)return $6(J,X,Y,$,Q,W,K,G,z,H,V,q);else{let F=J0[y++];if((F&128)>0){y-=13;return}return $6(J,X,Y,$,Q,W,K,G,z,H,V,q,F)}else{let F=J0[y++],U=J0[y++];if((F&128)>0||(U&128)>0){y-=14;return}if(Z<15)return $6(J,X,Y,$,Q,W,K,G,z,H,V,q,F,U);let B=J0[y++];if((B&128)>0){y-=15;return}return $6(J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B)}}}}}function x60(){let Z=J0[y++],J;if(Z<192)J=Z-160;else switch(Z){case 217:J=J0[y++];break;case 218:J=Y1.getUint16(y),y+=2;break;case 219:J=Y1.getUint32(y),y+=4;break;default:throw new Error("Expected string")}return z$(J)}function eE(Z){return h1.copyBuffers?Uint8Array.prototype.slice.call(J0,y,y+=Z):J0.subarray(y,y+=Z)}function K$(Z){let J=J0[y++];if(x5[J]){let X;return x5[J](J0.subarray(y,X=y+=Z),(Y)=>{y=Y;try{return _8()}finally{y=X}})}else throw new Error("Unknown extension type "+J)}var A60=new Array(4096);function p60(){let Z=J0[y++];if(Z>=160&&Z<192){if(Z=Z-160,y9>=y)return hZ.slice(y-G9,(y+=Z)-G9);else if(!(y9==0&&z9<180))return _B(Z)}else return y--,i60(_8());let J=(Z<<5^(Z>1?Y1.getUint16(y):Z>0?J0[y]:0))&4095,X=A60[J],Y=y,$=y+Z-3,Q,W=0;if(X&&X.bytes==Z){while(Y<$){if(Q=Y1.getUint32(Y),Q!=X[W++]){Y=1879048192;break}Y+=4}$+=3;while(Y<$)if(Q=J0[Y++],Q!=X[W++]){Y=1879048192;break}if(Y===$)return y=Y,X.string;$-=3,Y=y}X=[],A60[J]=X,X.bytes=Z;while(Y<$)Q=Y1.getUint32(Y),X.push(Q),Y+=4;$+=3;while(Y<$)Q=J0[Y++],X.push(Q);let K=Z<16?KI(Z):l60(Z);if(K!=null)return X.string=K;return X.string=_B(Z)}function i60(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(h1.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 h60=(Z,J)=>{let X=_8().map(i60),Y=Z;if(J!==void 0)Z=Z<32?-((J<<5)+Z):(J<<5)+Z,X.highByte=J;let $=K1[Z];if($&&($.isShared||sJ))(K1.restoreStructures||(K1.restoreStructures=[]))[Z]=$;return K1[Z]=X,X.read=WI(X,Y),X.read()};x5[0]=()=>{};x5[0].noBuffer=!0;x5[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 DS1={Error,TypeError,ReferenceError};x5[101]=()=>{let Z=_8();return(DS1[Z[0]]||Error)(Z[1],{cause:Z[2]})};x5[105]=(Z)=>{if(h1.structuredClone===!1)throw new Error("Structured clone extension is disabled");let J=Y1.getUint32(y-4);if(!fZ)fZ=new Map;let X=J0[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)&&J0[y+1]===115)Y=new Set;else Y={};let $={target:Y};fZ.set(J,$);let Q=_8();if(!$.used)return $.target=Q;else Object.assign(Y,Q);if(Y instanceof Map)for(let[W,K]of Q.entries())Y.set(W,K);if(Y instanceof Set)for(let W of Array.from(Q))Y.add(W);return Y};x5[112]=(Z)=>{if(h1.structuredClone===!1)throw new Error("Structured clone extension is disabled");let J=Y1.getUint32(y-4),X=fZ.get(J);return X.used=!0,X.target};x5[115]=()=>new Set(_8());var GI=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map((Z)=>Z+"Array"),PS1=typeof globalThis==="object"?globalThis:window;x5[116]=(Z)=>{let J=Z[0],X=Uint8Array.prototype.slice.call(Z,1).buffer,Y=GI[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 PS1[Y](X)};x5[120]=()=>{let Z=_8();return new RegExp(Z[0],Z[1])};var CS1=[];x5[98]=(Z)=>{let J=(Z[0]<<24)+(Z[1]<<16)+(Z[2]<<8)+Z[3],X=y;return y+=J-Z.length,s8=CS1,s8=[x60(),x60()],s8.position0=0,s8.position1=0,s8.postBundlePosition=y,y=X,_8()};x5[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 n60(Z){if(YI)YI();let J=z9,X=y,Y=rz,$=G9,Q=y9,W=hZ,K=G$,G=fZ,z=s8,H=new Uint8Array(J0.slice(0,z9)),V=K1,q=K1.slice(0,K1.length),F=h1,U=sJ,B=Z();return z9=J,y=X,rz=Y,G9=$,y9=Q,hZ=W,G$=K,fZ=G,s8=z,J0=H,sJ=U,K1=V,K1.splice(0,K1.length,...q),h1=F,Y1=new DataView(J0.buffer,J0.byteOffset,J0.byteLength),B}function xB(){J0=null,fZ=null,K1=null}var H$=new Array(147);for(let Z=0;Z<256;Z++)H$[Z]=+("1e"+Math.floor(45.15-Z*0.30103));var hB=new bZ({useRecords:!1}),TS1=hB.unpack,kS1=hB.unpackMultiple,ES1=hB.unpack;var IS1=new Float32Array(1),zD6=new Uint8Array(IS1.buffer,0,4);function a60(Z,J,X){JI=Z,XI=J,YI=X}var bB;try{bB=new TextEncoder}catch(Z){}var VI,t60,ez=typeof Buffer!=="undefined",fB=ez?function(Z){return Buffer.allocUnsafeSlow(Z)}:Uint8Array,e60=ez?Buffer:Uint8Array,s60=ez?4294967296:2144337920,p,tz,m1,u=0,Y5,W8=null,Z50,vS1=21760,SS1=/[\u0080-\uFFFF]/,S7=Symbol("record-id");class V$ extends bZ{constructor(Z){super(Z);this.offset=0;let J,X,Y,$,Q,W=e60.prototype.utf8Write?function(I,v){return p.utf8Write(I,v,p.byteLength-v)}:bB&&bB.encodeInto?function(I,v){return bB.encodeInto(I,p.subarray(v)).written}:!1,K=this;if(!Z)Z={};let G=Z&&Z.sequential,z=Z.structures||Z.saveStructures,H=Z.maxSharedStructures;if(H==null)H=z?32:0;if(H>8160)throw new Error("Maximum maxSharedStructure is 8160");if(Z.structuredClone&&Z.moreTypes==null)this.moreTypes=!0;let V=Z.maxOwnStructures;if(V==null)V=z?32:64;if(!this.structures&&Z.useRecords!=!1)this.structures=[];let q=H>32||V+H>64,F=H+64,U=H+V+64;if(U>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let B=[],w=0,O=0;this.pack=this.encode=function(I,v){if(!p)p=new fB(8192),m1=p.dataView||(p.dataView=new DataView(p.buffer,0,8192)),u=0;if(Y5=p.length-10,Y5-u<2048)p=new fB(p.length),m1=p.dataView||(p.dataView=new DataView(p.buffer,0,p.length)),Y5=p.length-10,u=0;else u=u+7&2147483640;if(X=u,v&yS1)u+=v&255;if(Q=K.structuredClone?new Map:null,K.bundleStrings&&typeof I!=="string")W8=[],W8.size=1/0;else W8=null;if($=K.structures,$){if($.uninitialized)$=K._mergeStructures(K.getStructures());let m=$.sharedLength||0;if(m>H)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<m;n++){let o=$[n];if(!o)continue;let Q0,K0=$.transitions;for(let _0=0,x0=o.length;_0<x0;_0++){let r0=o[_0];if(Q0=K0[r0],!Q0)Q0=K0[r0]=Object.create(null);K0=Q0}K0[S7]=n+64}this.lastNamedStructuresLength=m}if(!G)$.nextId=m+64}if(Y)Y=!1;let b;try{if(K.randomAccessStructure&&I&&I.constructor&&I.constructor===Object)A(I);else j(I);let m=W8;if(W8)o60(X,j,0);if(Q&&Q.idsToInsert){let n=Q.idsToInsert.sort((_0,x0)=>_0.offset>x0.offset?1:-1),o=n.length,Q0=-1;while(m&&o>0){let _0=n[--o].offset+X;if(_0<m.stringsPosition+X&&Q0===-1)Q0=0;if(_0>m.position+X){if(Q0>=0)Q0+=6}else{if(Q0>=0)m1.setUint32(m.position+X,m1.getUint32(m.position+X)+Q0),Q0=-1;m=m.previous,o++}}if(Q0>=0&&m)m1.setUint32(m.position+X,m1.getUint32(m.position+X)+Q0);if(u+=n.length*6,u>Y5)k(u);K.offset=u;let K0=xS1(p.subarray(X,u),n);return Q=null,K0}if(K.offset=u,v&fS1)return p.start=X,p.end=u,p;return p.subarray(X,u)}catch(m){throw b=m,m}finally{if($){if(N(),Y&&K.saveStructures){let m=$.sharedLength||0,n=p.subarray(X,u),o=J50($,K);if(!b){if(K.saveStructures(o,o.isCompatible)===!1)return K.pack(I,v);if(K.lastNamedStructuresLength=m,p.length>1073741824)p=null;return n}}}if(p.length>1073741824)p=null;if(v&bS1)u=X}};let N=()=>{if(O<10)O++;let I=$.sharedLength||0;if($.length>I&&!G)$.length=I;if(w>1e4){if($.transitions=null,O=0,w=0,B.length>0)B=[]}else if(B.length>0&&!G){for(let v=0,b=B.length;v<b;v++)B[v][S7]=0;B=[]}},R=(I)=>{var v=I.length;if(v<16)p[u++]=144|v;else if(v<65536)p[u++]=220,p[u++]=v>>8,p[u++]=v&255;else p[u++]=221,m1.setUint32(u,v),u+=4;for(let b=0;b<v;b++)j(I[b])},j=(I)=>{if(u>Y5)p=k(u);var v=typeof I,b;if(v==="string"){let m=I.length;if(W8&&m>=4&&m<4096){if((W8.size+=m)>vS1){let K0,_0=(W8[0]?W8[0].length*3+W8[1].length:0)+10;if(u+_0>Y5)p=k(u+_0);let x0;if(W8.position)x0=W8,p[u]=200,u+=3,p[u++]=98,K0=u-X,u+=4,o60(X,j,0),m1.setUint16(K0+X-3,u-X-K0);else p[u++]=214,p[u++]=98,K0=u-X,u+=4;W8=["",""],W8.previous=x0,W8.size=0,W8.position=K0}let Q0=SS1.test(I);W8[Q0?0:1]+=I,p[u++]=193,j(Q0?-m:m);return}let n;if(m<32)n=1;else if(m<256)n=2;else if(m<65536)n=3;else n=5;let o=m*3;if(u+o>Y5)p=k(u+o);if(m<64||!W){let Q0,K0,_0,x0=u+n;for(Q0=0;Q0<m;Q0++)if(K0=I.charCodeAt(Q0),K0<128)p[x0++]=K0;else if(K0<2048)p[x0++]=K0>>6|192,p[x0++]=K0&63|128;else if((K0&64512)===55296&&((_0=I.charCodeAt(Q0+1))&64512)===56320)K0=65536+((K0&1023)<<10)+(_0&1023),Q0++,p[x0++]=K0>>18|240,p[x0++]=K0>>12&63|128,p[x0++]=K0>>6&63|128,p[x0++]=K0&63|128;else p[x0++]=K0>>12|224,p[x0++]=K0>>6&63|128,p[x0++]=K0&63|128;b=x0-u-n}else b=W(I,u+n);if(b<32)p[u++]=160|b;else if(b<256){if(n<2)p.copyWithin(u+2,u+1,u+1+b);p[u++]=217,p[u++]=b}else if(b<65536){if(n<3)p.copyWithin(u+3,u+2,u+2+b);p[u++]=218,p[u++]=b>>8,p[u++]=b&255}else{if(n<5)p.copyWithin(u+5,u+3,u+3+b);p[u++]=219,m1.setUint32(u,b),u+=4}u+=b}else if(v==="number")if(I>>>0===I)if(I<32||I<128&&this.useRecords===!1||I<64&&!this.randomAccessStructure)p[u++]=I;else if(I<256)p[u++]=204,p[u++]=I;else if(I<65536)p[u++]=205,p[u++]=I>>8,p[u++]=I&255;else p[u++]=206,m1.setUint32(u,I),u+=4;else if(I>>0===I)if(I>=-32)p[u++]=256+I;else if(I>=-128)p[u++]=208,p[u++]=I+256;else if(I>=-32768)p[u++]=209,m1.setInt16(u,I),u+=2;else p[u++]=210,m1.setInt32(u,I),u+=4;else{let m;if((m=this.useFloat32)>0&&I<4294967296&&I>=-2147483648){p[u++]=202,m1.setFloat32(u,I);let n;if(m<4||(n=I*H$[(p[u]&127)<<1|p[u+1]>>7])>>0===n){u+=4;return}else u--}p[u++]=203,m1.setFloat64(u,I),u+=8}else if(v==="object"||v==="function")if(!I)p[u++]=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)}p[u++]=214,p[u++]=112,m1.setUint32(u,n.id),u+=4;return}else Q.set(I,{offset:u-X})}let m=I.constructor;if(m===Object)T(I);else if(m===Array)R(I);else if(m===Map)if(this.mapAsEmptyObject)p[u++]=128;else{if(b=I.size,b<16)p[u++]=128|b;else if(b<65536)p[u++]=222,p[u++]=b>>8,p[u++]=b&255;else p[u++]=223,m1.setUint32(u,b),u+=4;for(let[n,o]of I)j(n),j(o)}else{for(let n=0,o=VI.length;n<o;n++){let Q0=t60[n];if(I instanceof Q0){let K0=VI[n];if(K0.write){if(K0.type)p[u++]=212,p[u++]=K0.type,p[u++]=0;let X8=K0.write.call(this,I);if(X8===I)if(Array.isArray(I))R(I);else T(I);else j(X8);return}let _0=p,x0=m1,r0=u;p=null;let f8;try{f8=K0.pack.call(this,I,(X8)=>{if(p=_0,_0=null,u+=X8,u>Y5)k(u);return{target:p,targetView:m1,position:u-X8}},j)}finally{if(_0)p=_0,m1=x0,u=r0,Y5=p.length-10}if(f8){if(f8.length+u>Y5)k(f8.length+u);u=_S1(f8,p,u,K0.type)}return}}if(Array.isArray(I))R(I);else{if(I.toJSON){let n=I.toJSON();if(n!==I)return j(n)}if(v==="function")return j(this.writeFunction&&this.writeFunction(I));T(I)}}}else if(v==="boolean")p[u++]=I?195:194;else if(v==="bigint"){if(I<9223372036854776000&&I>=-9223372036854776000)p[u++]=211,m1.setBigInt64(u,I);else if(I<18446744073709552000&&I>0)p[u++]=207,m1.setBigUint64(u,I);else if(this.largeBigIntToFloat)p[u++]=203,m1.setFloat64(u,Number(I));else if(this.largeBigIntToString)return j(I.toString());else if((this.useBigIntExtension||this.moreTypes)&&I<BigInt(2)**BigInt(1023)&&I>-(BigInt(2)**BigInt(1023))){p[u++]=199,u++,p[u++]=66;let m=[],n;do{let o=I&BigInt(255);n=(o&BigInt(128))===(I<BigInt(0)?BigInt(128):BigInt(0)),m.push(o),I>>=BigInt(8)}while(!((I===BigInt(0)||I===BigInt(-1))&&n));p[u-2]=m.length;for(let o=m.length;o>0;)p[u++]=Number(m[--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");u+=8}else if(v==="undefined")if(this.encodeUndefinedAsNil)p[u++]=192;else p[u++]=212,p[u++]=0,p[u++]=0;else throw new Error("Unknown type: "+v)},P=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 b=v.length;if(b<16)p[u++]=128|b;else if(b<65536)p[u++]=222,p[u++]=b>>8,p[u++]=b&255;else p[u++]=223,m1.setUint32(u,b),u+=4;let m;if(this.coercibleKeyAsNumber)for(let n=0;n<b;n++){m=v[n];let o=Number(m);j(isNaN(o)?m:o),j(I[m])}else for(let n=0;n<b;n++)j(m=v[n]),j(I[m])}:(I)=>{p[u++]=222;let v=u-X;u+=2;let b=0;for(let m in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(m))j(m),j(I[m]),b++;if(b>65535)throw new Error('Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object');p[v+++X]=b>>8,p[v+X]=b&255},D=this.useRecords===!1?P:Z.progressiveRecords&&!q?(I)=>{let v,b=$.transitions||($.transitions=Object.create(null)),m=u++-X,n;for(let o in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(o)){if(v=b[o],v)b=v;else{let Q0=Object.keys(I),K0=b;b=$.transitions;let _0=0;for(let x0=0,r0=Q0.length;x0<r0;x0++){let f8=Q0[x0];if(v=b[f8],!v)v=b[f8]=Object.create(null),_0++;b=v}if(m+X+1==u)u--,x(b,Q0,_0);else S(b,Q0,m,_0);n=!0,b=K0[o]}j(I[o])}if(!n){let o=b[S7];if(o)p[m+X]=o;else S(b,Object.keys(I),m,0)}}:(I)=>{let v,b=$.transitions||($.transitions=Object.create(null)),m=0;for(let o in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(o)){if(v=b[o],!v)v=b[o]=Object.create(null),m++;b=v}let n=b[S7];if(n)if(n>=96&&q)p[u++]=((n-=96)&31)+96,p[u++]=n>>5;else p[u++]=n;else x(b,b.__keys__||Object.keys(I),m);for(let o in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(o))j(I[o])},C=typeof this.useRecords=="function"&&this.useRecords,T=C?(I)=>{C(I)?D(I):P(I)}:D,k=(I)=>{let v;if(I>16777216){if(I-X>s60)throw new Error("Packed buffer would be larger than maximum buffer size");v=Math.min(s60,Math.round(Math.max((I-X)*(I>67108864?1.25:2),4194304)/4096)*4096)}else v=(Math.max(I-X<<2,p.length-1)>>12)+1<<12;let b=new fB(v);if(m1=b.dataView||(b.dataView=new DataView(b.buffer,0,v)),I=Math.min(I,p.length),p.copy)p.copy(b,0,X,I);else b.set(p.slice(X,I));return u-=X,X=0,Y5=b.length-10,p=b},x=(I,v,b)=>{let m=$.nextId;if(!m)m=64;if(m<F&&this.shouldShareStructure&&!this.shouldShareStructure(v)){if(m=$.nextOwnId,!(m<U))m=F;$.nextOwnId=m+1}else{if(m>=U)m=F;$.nextId=m+1}let n=v.highByte=m>=96&&q?m-96>>5:-1;if(I[S7]=m,I.__keys__=v,$[m-64]=v,m<F)if(v.isShared=!0,$.sharedLength=m-63,Y=!0,n>=0)p[u++]=(m&31)+96,p[u++]=n;else p[u++]=m;else{if(n>=0)p[u++]=213,p[u++]=114,p[u++]=(m&31)+96,p[u++]=n;else p[u++]=212,p[u++]=114,p[u++]=m;if(b)w+=O*b;if(B.length>=V)B.shift()[S7]=0;B.push(I),j(v)}},S=(I,v,b,m)=>{let n=p,o=u,Q0=Y5,K0=X;if(p=tz,u=0,X=0,!p)tz=p=new fB(8192);Y5=p.length-10,x(I,v,m),tz=p;let _0=u;if(p=n,u=o,Y5=Q0,X=K0,_0>1){let x0=u+_0-1;if(x0>Y5)k(x0);let r0=b+X;p.copyWithin(r0+_0,r0+1,u),p.set(tz.slice(0,_0),r0),u=x0}else p[b+X]=tz[0]},A=(I)=>{let v=Z50(I,p,X,u,$,k,(b,m,n)=>{if(n)return Y=!0;u=m;let o=p;if(j(b),N(),o!==p)return{position:u,targetView:m1,target:p};return u},this);if(v===0)return T(I);u=v}}useBuffer(Z){p=Z,p.dataView||(p.dataView=new DataView(p.buffer,p.byteOffset,p.byteLength)),u=0}set position(Z){u=Z}get position(){return u}clearSharedData(){if(this.structures)this.structures=[];if(this.typedStructs)this.typedStructs=[]}}t60=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,AB];VI=[{pack(Z,J,X){let Y=Z.getTime()/1000;if((this.useTimestamp32||Z.getMilliseconds()===0)&&Y>=0&&Y<4294967296){let{target:$,targetView:Q,position:W}=J(6);$[W++]=214,$[W++]=255,Q.setUint32(W,Y)}else if(Y>0&&Y<4294967296){let{target:$,targetView:Q,position:W}=J(10);$[W++]=215,$[W++]=255,Q.setUint32(W,Z.getMilliseconds()*4000000+(Y/1000/4294967296>>0)),Q.setUint32(W+4,Y)}else if(isNaN(Y)){if(this.onInvalidDate)return J(0),X(this.onInvalidDate());let{target:$,targetView:Q,position:W}=J(3);$[W++]=212,$[W++]=255,$[W++]=255}else{let{target:$,targetView:Q,position:W}=J(15);$[W++]=199,$[W++]=12,$[W++]=255,Q.setUint32(W,Z.getMilliseconds()*1e6),Q.setBigInt64(W+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)zI(Z,16,J);else HI(ez?Buffer.from(Z):new Uint8Array(Z),J)}},{pack(Z,J){let X=Z.constructor;if(X!==e60&&this.moreTypes)zI(Z,GI.indexOf(X.name),J);else HI(Z,J)}},{pack(Z,J){if(this.moreTypes)zI(Z,17,J);else HI(ez?Buffer.from(Z):new Uint8Array(Z),J)}},{pack(Z,J){let{target:X,position:Y}=J(1);X[Y]=193}}];function zI(Z,J,X,Y){let $=Z.byteLength;if($+1<256){var{target:Q,position:W}=X(4+$);Q[W++]=199,Q[W++]=$+1}else if($+1<65536){var{target:Q,position:W}=X(5+$);Q[W++]=200,Q[W++]=$+1>>8,Q[W++]=$+1&255}else{var{target:Q,position:W,targetView:K}=X(7+$);Q[W++]=201,K.setUint32(W,$+1),W+=4}if(Q[W++]=116,Q[W++]=J,!Z.buffer)Z=new Uint8Array(Z);Q.set(new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength),W)}function HI(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 _S1(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 xS1(Z,J){let X,Y=J.length*6,$=Z.length-Y;while(X=J.pop()){let{offset:Q,id:W}=X;Z.copyWithin(Q+Y,Q,$),Y-=6;let K=Q+Y;Z[K++]=214,Z[K++]=105,Z[K++]=W>>24,Z[K++]=W>>16&255,Z[K++]=W>>8&255,Z[K++]=W&255,$=Q}return Z}function o60(Z,J,X){if(W8.length>0){m1.setUint32(W8.position+Z,u+X-W8.position-Z),W8.stringsPosition=u-Z;let Y=W8;W8=null,J(Y[0]),J(Y[1])}}function J50(Z,J){return Z.isCompatible=(X)=>{let Y=!X||(J.lastNamedStructuresLength||0)===X.length;if(!Y)J._mergeStructures(X);return Y},Z}function X50(Z,J){Z50=Z,J50=J}var Y50=new V$({useRecords:!1}),AS1=Y50.pack,hS1=Y50.pack;var fS1=512,bS1=1024,yS1=2048;var qI=3,iW=0,ZH=2,yB=1,UI=16,Q50=["num","object","string","ascii"];Q50[UI]="date";var mS1=[!1,!0,!0,!1,!1,!0,!0,!1],W50;try{new Function(""),W50=!0}catch(Z){}var q$,uS1=typeof Buffer!=="undefined",gB,_7;try{gB=new TextEncoder}catch(Z){}var dS1=uS1?function(Z,J,X){return Z.utf8Write(J,X,Z.byteLength-X)}:gB&&gB.encodeInto?function(Z,J,X){return gB.encodeInto(J,Z.subarray(X)).written}:!1,OD6=Symbol("type"),jD6=Symbol("parent");X50(K50,nS1);function K50(Z,J,X,Y,$,Q,W,K){let G=K.typedStructs||(K.typedStructs=[]),z=J.dataView,H=(G.lastStringStart||100)+Y,V=J.length-10,q=Y;if(Y>V)J=Q(Y),z=J.dataView,Y-=X,q-=X,H-=X,X=0,V=J.length-10;let F,U=H,B=G.transitions||(G.transitions=Object.create(null)),w=G.nextId||G.length,O=w<15?1:w<240?2:w<61440?3:w<15728640?4:0;if(O===0)return 0;Y+=O;let N=[],R,j=0;for(let D in Z){let C=Z[D],T=B[D];if(!T)B[D]=T={key:D,parent:B,enumerationOffset:0,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null,date64:null};if(Y>V)J=Q(Y),z=J.dataView,Y-=X,q-=X,H-=X,U-=X,X=0,V=J.length-10;switch(typeof C){case"number":let k=C;if(w<200||!T.num64){if(k>>0===k&&k<536870912&&k>-520093696){if(k<246&&k>=0&&(T.num8&&!(w>200&&T.num32)||k<32&&!T.num32))B=T.num8||A5(T,iW,1),J[Y++]=k;else B=T.num32||A5(T,iW,4),z.setUint32(Y,k,!0),Y+=4;break}else if(k<4294967296&&k>=-2147483648){if(z.setFloat32(Y,k,!0),mS1[J[Y+3]>>>5]){let I;if((I=k*H$[(J[Y+3]&127)<<1|J[Y+2]>>7])>>0===I){B=T.num32||A5(T,iW,4),Y+=4;break}}}}B=T.num64||A5(T,iW,8),z.setFloat64(Y,k,!0),Y+=8;break;case"string":let x=C.length;if(F=U-H,(x<<2)+U>V)J=Q((x<<2)+U),z=J.dataView,Y-=X,q-=X,H-=X,U-=X,X=0,V=J.length-10;if(x>65280+F>>2){N.push(D,C,Y-q);break}let S,A=U;if(x<64){let I,v,b;for(I=0;I<x;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&&((b=C.charCodeAt(I+1))&64512)===56320)S=!0,v=65536+((v&1023)<<10)+(b&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+=dS1(J,C,U),S=U-A>x;if(F<160||F<246&&(T.ascii8||T.string8)){if(S){if(!(B=T.string8))if(G.length>10&&(B=T.ascii8))B.__type=ZH,T.ascii8=null,T.string8=B,W(null,0,!0);else B=A5(T,ZH,1)}else if(F===0&&!R){R=!0,B=T.ascii0||A5(T,qI,0);break}else if(!(B=T.ascii8)&&!(G.length>10&&(B=T.string8)))B=A5(T,qI,1);J[Y++]=F}else B=T.string16||A5(T,ZH,2),z.setUint16(Y,F,!0),Y+=2;break;case"object":if(C){if(C.constructor===Date)B=T.date64||A5(T,UI,8),z.setFloat64(Y,C.getTime(),!0),Y+=8;else N.push(D,C,j);break}else if(T=$50(T,Y,z,-10),T)B=T,Y=q$;else N.push(D,C,j);break;case"boolean":B=T.num8||T.ascii8||A5(T,iW,1),J[Y++]=C?249:248;break;case"undefined":if(T=$50(T,Y,z,-9),T)B=T,Y=q$;else N.push(D,C,j);break;default:N.push(D,C,j)}j++}for(let D=0,C=N.length;D<C;){let T=N[D++],k=N[D++],x=N[D++],S=B[T];if(!S)B[T]=S={key:T,parent:B,enumerationOffset:x-j,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null};let A;if(k){let I;if(F=U-H,F<65280)if(B=S.object16,B)I=2;else if(B=S.object32)I=4;else B=A5(S,yB,2),I=2;else B=S.object32||A5(S,yB,4),I=4;if(A=W(k,U),typeof A==="object")U=A.position,z=A.targetView,J=A.target,H-=X,Y-=X,q-=X,X=0;else U=A;if(I===2)z.setUint16(Y,F,!0),Y+=2;else z.setUint32(Y,F,!0),Y+=4}else B=S.object16||A5(S,yB,2),z.setInt16(Y,k===null?-10:-9,!0),Y+=2;j++}let P=B[S7];if(P==null){P=K.typedStructs.length;let D=[],C=B,T,k;while((k=C.__type)!==void 0){let x=C.__size;C=C.__parent,T=C.key;let S=[k,x,T];if(C.enumerationOffset)S.push(C.enumerationOffset);D.push(S),C=C.parent}D.reverse(),B[S7]=P,K.typedStructs[P]=D,W(null,0,!0)}switch(O){case 1:if(P>=16)return 0;J[q]=P+32;break;case 2:if(P>=256)return 0;J[q]=56,J[q+1]=P;break;case 3:if(P>=65536)return 0;J[q]=57,z.setUint16(q+1,P,!0);break;case 4:if(P>=16777216)return 0;z.setUint32(q,(P<<8)+58,!0);break}if(Y<H){if(H===U)return Y;J.copyWithin(Y,H,U),U+=Y-H,G.lastStringStart=Y-q}else if(Y>H){if(H===U)return Y;return G.lastStringStart=Y-q,K50(Z,J,X,q,$,Q,W,K)}return U}function $50(Z,J,X,Y){let $;if($=Z.ascii8||Z.num8)return X.setInt8(J,Y,!0),q$=J+1,$;if($=Z.string16||Z.object16)return X.setInt16(J,Y,!0),q$=J+2,$;if($=Z.num32)return X.setUint32(J,3758096640+Y,!0),q$=J+4,$;if($=Z.num64)return X.setFloat64(J,NaN,!0),X.setInt8(J,Y),q$=J+8,$;q$=J;return}function A5(Z,J,X){let Y=Q50[J]+(X<<3),$=Z[Y]||(Z[Y]=Object.create(null));return $.__type=J,$.__size=X,$.__parent=Z,$}function cS1(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 W=J[$],K=Y;for(let[G,z,H]of W){let V=K[H];if(!V)K[H]=V={key:H,parent:K,enumerationOffset:0,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null,date64:null};K=A5(V,G,z)}K[S7]=$}return J.transitions=Y,this.typedStructs=J,this.lastTypedStructuresLength=J.length,X}var FI=Symbol.for("source");function lS1(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:W,fullConstruct:K}=Q;if(!W){W=Q.construct=function F(){},K=Q.fullConstruct=function F(){},K.prototype=Y.structPrototype??{};var G=W.prototype=Y.structPrototype?Object.create(Y.structPrototype):{};let H=[],V=0,q;for(let F=0,U=Q.length;F<U;F++){let B=Q[F],[w,O,N,R]=B;if(N==="__proto__")N="__proto_";let j={key:N,offset:V};if(R)H.splice(F+R,0,j);else H.push(j);let P;switch(O){case 0:P=()=>0;break;case 1:P=(C,T)=>{let k=C.bytes[T+j.offset];return k>=246?pW(k):k};break;case 2:P=(C,T)=>{let k=C.bytes,S=(k.dataView||(k.dataView=new DataView(k.buffer,k.byteOffset,k.byteLength))).getUint16(T+j.offset,!0);return S>=65280?pW(S&255):S};break;case 4:P=(C,T)=>{let k=C.bytes,S=(k.dataView||(k.dataView=new DataView(k.buffer,k.byteOffset,k.byteLength))).getUint32(T+j.offset,!0);return S>=4294967040?pW(S&255):S};break}j.getRef=P,V+=O;let D;switch(w){case qI:if(q&&!q.next)q.next=j;q=j,j.multiGetCount=0,D=function(C){let{bytes:T,position:k}=C,x=V+k,S=P(C,k);if(typeof S!=="number")return S;let A,I=j.next;while(I){if(A=I.getRef(C,k),typeof A==="number")break;else A=null;I=I.next}if(A==null)A=C.bytesEnd-x;if(C.srcString)return C.srcString.slice(S,A);return c60(T,S+x,A-S)};break;case ZH:case yB:if(q&&!q.next)q.next=j;q=j,D=function(C){let T=C.position,k=V+T,x=P(C,T);if(typeof x!=="number")return x;let S=C.bytes,A,I=j.next;while(I){if(A=I.getRef(C,T),typeof A==="number")break;else A=null;I=I.next}if(A==null)A=C.bytesEnd-k;if(w===ZH)return S.toString("utf8",x+k,A+k);else{_7=C;try{return Y.unpack(S,{start:x+k,end:A+k})}finally{_7=null}}};break;case iW:switch(O){case 4:D=function(C){let T=C.bytes,k=T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength)),x=C.position+j.offset,S=k.getInt32(x,!0);if(S<536870912){if(S>-520093696)return S;if(S>-536870912)return pW(S&255)}let A=k.getFloat32(x,!0),I=H$[(T[x+3]&127)<<1|T[x+2]>>7];return(I*A+(A>0?0.5:-0.5)>>0)/I};break;case 8:D=function(C){let T=C.bytes,x=(T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength))).getFloat64(C.position+j.offset,!0);if(isNaN(x)){let S=T[C.position+j.offset];if(S>=246)return pW(S)}return x};break;case 1:D=function(C){let k=C.bytes[C.position+j.offset];return k<246?k:pW(k)};break}break;case UI:D=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+j.offset,!0))};break}j.get=D}if(W50){let F=[],U=[],B=0,w;for(let N of H){if(Y.alwaysLazyProperty&&Y.alwaysLazyProperty(N.key)){w=!0;continue}Object.defineProperty(G,N.key,{get:pS1(N.get),enumerable:!0});let R="v"+B++;U.push(R),F.push("o["+JSON.stringify(N.key)+"]="+R+"(s)")}if(w)F.push("__proto__:this");let O=new Function(...U,"var c=this;return function(s){var o=new c();"+F.join(";")+";return o;}").apply(K,H.map((N)=>N.get));Object.defineProperty(G,"toJSON",{value(N){return O.call(this,this[FI])}})}else Object.defineProperty(G,"toJSON",{value(F){let U={};for(let B=0,w=H.length;B<w;B++){let O=H[B].key;U[O]=this[O]}return U}})}var z=new W;return z[FI]={bytes:Z,position:J,srcString:"",bytesEnd:X},z}function pW(Z){switch(Z){case 246:return null;case 247:return;case 248:return!1;case 249:return!0}throw new Error("Unknown constant")}function pS1(Z){return function(){return Z(this[FI])}}function iS1(){if(_7)_7.bytes=Uint8Array.prototype.slice.call(_7.bytes,_7.position,_7.bytesEnd),_7.position=0,_7.bytesEnd=_7.bytes.length}function nS1(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}a60(lS1,cS1,iS1);var oS1=process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED!==void 0&&process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED.toLowerCase()==="true";if(!oS1){let Z;try{if(Z=c("msgpackr-extract"),Z)d60(Z.extractStrings)}catch(J){}}import{WebSocketServer as nc1}from"ws";var iL=e(uY0(),1);import cc1 from"http";import lc1 from"https";import pL from"fs";import pc1 from"path";import ic1 from"url";var dY0=`-----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 PS=process.env.PORT??8080,CS="0.7.13-dev1v",TS;(($)=>{$.READY="WEBSERVER.READY";$.STOPPED="WEBSERVER.STOPPED";$.ERROR="WEBSERVER.ERROR";$.UPGRADE="WEBSERVER.UPGRADE"})(TS||={});class PK extends j0{static instance=new PK;_webserver=iL.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:CS,runtime:typeof Bun!=="undefined"?"bun":"node"})}),this._webserver.use(iL.default.static("assets"));try{this._webserver.use(iL.default.static(pc1.dirname(c.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js"))))}catch{}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?cc1.createServer(this._webserver):lc1.createServer({key:pL.existsSync("assets/certs/localhost.key")?pL.readFileSync("assets/certs/localhost.key"):cY0,cert:pL.existsSync("assets/certs/localhost.crt")?pL.readFileSync("assets/certs/localhost.crt"):dY0},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else d.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(PS,this._onStarted),console.info(`WebServer.start(): Server running on port ${PS}.`)}stop(){if(this._internalHttpServer)return new Promise((Z,J)=>{this._internalHttpServer.close((X)=>{if(X)J(X);else Z(!0)})});else return d.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(Z,J,X)=>{let Y=ic1.parse(Z.url??"",!0).query,$=Y.connectionId?.toString(),Q=Y.sessionToken?.toString()??"";if($&&m7.instance.isValidConnectionId($))Z.connectionId=$;else{let W=await I7.instance.getPlayerSession(Q);if(W?.error){let K=`${W.error.code}: ${W.error.message}`;J.write(`HTTP/1.1 401 Unauthorized\r
452
+ -----END RSA PRIVATE KEY-----`;var PS=process.env.PORT??8080,CS="0.7.14",TS;(($)=>{$.READY="WEBSERVER.READY";$.STOPPED="WEBSERVER.STOPPED";$.ERROR="WEBSERVER.ERROR";$.UPGRADE="WEBSERVER.UPGRADE"})(TS||={});class PK extends j0{static instance=new PK;_webserver=iL.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:CS,runtime:typeof Bun!=="undefined"?"bun":"node"})}),this._webserver.use(iL.default.static("assets"));try{this._webserver.use(iL.default.static(pc1.dirname(c.resolve("@hytopia.com/assets"))))}catch{}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?cc1.createServer(this._webserver):lc1.createServer({key:pL.existsSync("assets/certs/localhost.key")?pL.readFileSync("assets/certs/localhost.key"):cY0,cert:pL.existsSync("assets/certs/localhost.crt")?pL.readFileSync("assets/certs/localhost.crt"):dY0},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else d.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(PS,this._onStarted),console.info(`WebServer.start(): Server running on port ${PS}.`)}stop(){if(this._internalHttpServer)return new Promise((Z,J)=>{this._internalHttpServer.close((X)=>{if(X)J(X);else Z(!0)})});else return d.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(Z,J,X)=>{let Y=ic1.parse(Z.url??"",!0).query,$=Y.connectionId?.toString(),Q=Y.sessionToken?.toString()??"";if($&&m7.instance.isValidConnectionId($))Z.connectionId=$;else{let W=await I7.instance.getPlayerSession(Q);if(W?.error){let K=`${W.error.code}: ${W.error.message}`;J.write(`HTTP/1.1 401 Unauthorized\r
453
453
  Content-Type: text/plain\r
454
454
  Content-Length: ${K.length}\r
455
455
  Connection: close\r
@@ -482,6 +482,6 @@ ${$.stack}`:"unknown"}}}}}var Bi1=(Z={})=>{let J=Z.limit??zi1;return{name:Hi1,pr
482
482
  `),U=F.shift();if(!U)return Z.destroy(),X(new Error("No header received from proxy CONNECT response"));let B=U.split(" "),w=+(B[1]||0),O=B.slice(2).join(" "),N={};for(let R of F){if(!R)continue;let j=R.indexOf(":");if(j===-1)return Z.destroy(),X(new Error(`Invalid header from proxy CONNECT response: "${R}"`));let P=R.slice(0,j).toLowerCase(),D=R.slice(j+1).trimStart(),C=N[P];if(typeof C==="string")N[P]=[C,D];else if(Array.isArray(C))C.push(D);else N[P]=D}vR("got proxy server response: %o %o",U,N),W(),J({connect:{statusCode:w,statusText:O,headers:N},buffered:V})}Z.on("error",G),Z.on("end",K),Q()})}function YF(...Z){g.log("[https-proxy-agent]",...Z)}class SR extends fy{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??{},YF("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?E$1(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:"){YF("Creating `tls.Socket`: %o",this.connectOpts);let V=this.connectOpts.servername||this.connectOpts.host;Y=by.connect({...this.connectOpts,servername:V&&LJ.isIP(V)?void 0:V})}else YF("Creating `net.Socket`: %o",this.connectOpts),Y=LJ.connect(this.connectOpts);let $=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},Q=LJ.isIPv6(J.host)?`[${J.host}]`:J.host,W=`CONNECT ${Q}:${J.port} HTTP/1.1\r
483
483
  `;if(X.username||X.password){let V=`${decodeURIComponent(X.username)}:${decodeURIComponent(X.password)}`;$["Proxy-Authorization"]=`Basic ${Buffer.from(V).toString("base64")}`}if($.Host=`${Q}:${J.port}`,!$["Proxy-Connection"])$["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let V of Object.keys($))W+=`${V}: ${$[V]}\r
484
484
  `;let K=k$1(Y);Y.write(`${W}\r
485
- `);let{connect:G,buffered:z}=await K;if(Z.emit("proxyConnect",G),this.emit("proxyConnect",G,Z),G.statusCode===200){if(Z.once("socket",y96),J.secureEndpoint){YF("Upgrading socket connection to TLS");let V=J.servername||J.host;return by.connect({...E$1(J,"host","path","port"),socket:Y,servername:LJ.isIP(V)?void 0:V})}return Y}Y.destroy();let H=new LJ.Socket({writable:!1});return H.readable=!0,Z.once("socket",(V)=>{YF("Replaying proxy buffer for failed request"),V.push(z),V.push(null)}),H}}SR.__initStatic();function y96(Z){Z.resume()}function E$1(Z,...J){let X={},Y;for(Y in Z)if(!J.includes(Y))X[Y]=Z[Y];return X}var c96=32768;function l96(Z){return new u96({read(){this.push(Z),this.push(null)}})}function _R(Z){let J;try{J=new URL(Z.url)}catch(G){return G8(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),gK(Z,()=>Promise.resolve({}))}let X=J.protocol==="https:",Y=p96(J,Z.proxy||(X?process.env.https_proxy:void 0)||process.env.http_proxy),$=X?m96:g96,Q=Z.keepAlive===void 0?!1:Z.keepAlive,W=Y?new SR(Y):new $.Agent({keepAlive:Q,maxSockets:30,timeout:2000}),K=i96(Z,Z.httpModule??$,W);return gK(Z,K)}function p96(Z,J){let{no_proxy:X}=process.env;if(X?.split(",").some(($)=>Z.host.endsWith($)||Z.hostname.endsWith($)))return;else return J}function i96(Z,J,X){let{hostname:Y,pathname:$,port:Q,protocol:W,search:K}=new URL(Z.url);return function G(z){return new Promise((H,V)=>{UV(()=>{let q=l96(z.body),F={...Z.headers};if(z.body.length>c96)F["content-encoding"]="gzip",q=q.pipe(d96());let U=J.request({method:"POST",agent:X,headers:F,hostname:Y,path:`${$}${K}`,port:Q,protocol:W,ca:Z.caCerts},(B)=>{B.on("data",()=>{}),B.on("end",()=>{}),B.setEncoding("utf8");let w=B.headers["retry-after"]??null,O=B.headers["x-sentry-rate-limits"]??null;H({statusCode:B.statusCode,headers:{"retry-after":w,"x-sentry-rate-limits":Array.isArray(O)?O[0]||null:O}})});U.on("error",V),q.pipe(U)})})}}var n96=new Set(["false","f","n","no","off","0"]),a96=new Set(["true","t","y","yes","on","1"]);function xR(Z,J){let X=String(Z).toLowerCase();if(n96.has(X))return!1;if(a96.has(X))return!0;return J?.strict?null:Boolean(Z)}import{posix as s96,sep as o96}from"path";function I$1(Z){return Z.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function AR(Z=process.argv[1]?l_(process.argv[1]):process.cwd(),J=o96==="\\"){let X=J?I$1(Z):Z;return(Y)=>{if(!Y)return;let $=J?I$1(Y):Y,{dir:Q,base:W,ext:K}=s96.parse($);if(K===".js"||K===".mjs"||K===".cjs")W=W.slice(0,K.length*-1);let G=decodeURIComponent(W);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 H=Q.slice(X.length+1).replace(/\//g,".");return H?`${H}:${G}`:G}return G}}function hR(Z){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(O0.SENTRY_RELEASE?.id)return O0.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 fR=YO(Xx(AR()));var S$1=e(X0(),1);import*as v$1 from"os";import{threadId as r96,isMainThread as t96}from"worker_threads";var e96=60000;class $F extends OO{constructor(Z){let J=Z.serverName||global.process.env.SENTRY_NAME||v$1.hostname(),X={...Z,platform:"node",runtime:{name:"node",version:global.process.version},serverName:J};if(Z.openTelemetryInstrumentations)Q3({instrumentations:Z.openTelemetryInstrumentations});h_(X,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${t96?"main":`worker-${r96}`}.`);super(X);if(this.getOptions()._experiments?.enableLogs){if(this._logOnExitFlushListener=()=>{BX(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=L8,X=S$1.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&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},Z.clientReportFlushInterval??e96).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener)}_getTraceInfoFromScope(Z){if(!Z)return[void 0,void 0];return J81(this,Z)}}var W7=e(X0(),1);var h3=e(D1(),1);var _$1=e(Ij(),1);import Z46 from"module";var yy=1e6;function bR(Z,J={}){if(Z.getOptions().debug)A$1();let X=X46(Z,J);Z.traceProvider=X}function gy(){let[Z=0,J=0]=process.versions.node.split(".").map(Number);if(Z>=21||Z===20&&J>=6||Z===18&&J>=19){if(!O0._sentryEsmLoaderHookRegistered)try{let{addHookMessagePort:X}=_$1.createAddHookMessageChannel();Z46.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:X,include:[]},transferList:[X]})}catch(X){g.warn("Failed to register ESM hook",X)}}else G8(()=>{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 x$1(Z={}){let{debug:J}=Z;if(J)g.enable(),A$1();if(!K4())gy();J46(Z.integrations).forEach((X)=>{if(X(),J)g.log(`[Sentry] Preloaded ${X.id} instrumentation`)})}function J46(Z){let J=T$1();if(!Z)return J;return J.filter((X)=>Z.includes(X.id))}function X46(Z,J={}){let X=new Mf({sampler:new mf(Z),resource:new w3({[h3.ATTR_SERVICE_NAME]:"node",[h3.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[h3.ATTR_SERVICE_VERSION]:L8}),forceFlushTimeoutMillis:500,spanProcessors:[new gf({timeout:Y46(Z.getOptions().maxSpanWaitDuration)}),...J.spanProcessors||[]]});return W7.trace.setGlobalTracerProvider(X),W7.propagation.setGlobalPropagator(new Af),W7.context.setGlobalContextManager(new ER),X}function Y46(Z){if(Z==null)return;if(Z>yy)return m0&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${yy}`),yy;else if(Z<=0||Number.isNaN(Z)){m0&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return Z}function A$1(){let Z=new Proxy(g,{get(J,X,Y){return Reflect.get(J,X==="verbose"?"debug":X,Y)}});W7.diag.disable(),W7.diag.setLogger(Z,W7.DiagLogLevel.DEBUG)}function $46(){return K4()?[CM()]:[]}function my(){return[DV(),NV(),PV(),CV(),TV(),UM(),LM(),TM(),kM(),RM(),PM(),MM(),TR(),C$1(),...$46()]}function uy(Z){return[...my(),...G5(Z)?IR():[]]}function yR(Z={}){return f$1(Z,uy)}function h$1(Z={}){return f$1(Z,()=>[])}function f$1(Z={},J){let X=Q46(Z,J);if(X.debug===!0)if(m0)g.enable();else G8(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")});if(!K4()&&X.registerEsmLoaderHooks!==!1)gy();if(VM(),l0().update(X.initialScope),X.spotlight&&!X.integrations.some(({name:Q})=>Q===Ny))X.integrations.push(wR({sidecarUrl:typeof X.spotlight==="string"?X.spotlight:void 0}));let $=new $F(X);if(l0().setClient($),$.init(),g.log(`Running in ${K4()?"CommonJS":"ESM"} mode.`),$.startClientReportTracking(),G46(),!X.skipOpenTelemetrySetup)bR($,{spanProcessors:X.openTelemetrySpanProcessors}),dy();return i11($),X81($),$}function dy(){if(!m0)return;let Z=o11(),J=["SentryContextManager","SentryPropagator"];if(G5())J.push("SentrySpanProcessor");for(let X of J)if(!Z.includes(X))g.error(`You have to set up the ${X}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);if(!Z.includes("SentrySampler"))g.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function Q46(Z,J){let X=W46(Z.release),Y=Z.spotlight??xR(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,$=K46(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??_R,stackParser:pS(Z.stackParser||fR),release:X,tracesSampleRate:$,spotlight:Y,debug:xR(Z.debug??process.env.SENTRY_DEBUG)},W=Z.integrations,K=Z.defaultIntegrations??J(Q);return{...Q,integrations:P_({defaultIntegrations:K,integrations:W})}}function W46(Z){if(Z!==void 0)return Z;let J=hR();if(J!==void 0)return J;return}function K46(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 G46(){if(xR(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let Z=process.env.SENTRY_TRACE,J=process.env.SENTRY_BAGGAGE,X=A$(Z,J);l0().setPropagationContext(X)}}var z46=[["january","1"],["february","2"],["march","3"],["april","4"],["may","5"],["june","6"],["july","7"],["august","8"],["september","9"],["october","10"],["november","11"],["december","12"],["jan","1"],["feb","2"],["mar","3"],["apr","4"],["may","5"],["jun","6"],["jul","7"],["aug","8"],["sep","9"],["oct","10"],["nov","11"],["dec","12"],["sunday","0"],["monday","1"],["tuesday","2"],["wednesday","3"],["thursday","4"],["friday","5"],["saturday","6"],["sun","0"],["mon","1"],["tue","2"],["wed","3"],["thu","4"],["fri","5"],["sat","6"]];function _Q(Z){return z46.reduce((J,[X,Y])=>J.replace(new RegExp(X,"gi"),Y),Z)}var b$1="Automatic instrumentation of CronJob only supports crontab string";function y$1(Z,J){let X=!1;return new Proxy(Z,{construct(Y,$){let[Q,W,K,G,z,...H]=$;if(typeof Q!=="string")throw new Error(b$1);if(X)throw new Error(`A job named '${J}' has already been scheduled`);X=!0;let V=_Q(Q);async function q(F,U){return d7(J,async()=>{try{await W(F,U)}catch(B){throw F1(B),B}},{schedule:{type:"crontab",value:V},timezone:z||void 0})}return new Y(Q,q,K,G,z,...H)},get(Y,$){if($==="from")return(Q)=>{let{cronTime:W,onTick:K,timeZone:G}=Q;if(typeof W!=="string")throw new Error(b$1);if(X)throw new Error(`A job named '${J}' has already been scheduled`);X=!0;let z=_Q(W);return Q.onTick=async(H,V)=>{return d7(J,async()=>{try{await K(H,V)}catch(q){throw F1(q),q}},{schedule:{type:"crontab",value:z},timezone:G||void 0})},Y.from(Q)};else return Y[$]}})}function g$1(Z){return new Proxy(Z,{get(J,X){if(X==="schedule"&&J.schedule)return new Proxy(J.schedule,{apply(Y,$,Q){let[W,K,G]=Q,z=G?.name,H=G?.timezone;if(!z)throw new Error('Missing "name" for scheduled job. A name is required for Sentry check-in monitoring.');let V=async()=>{return d7(z,async()=>{try{return await K()}catch(q){throw F1(q),q}},{schedule:{type:"crontab",value:_Q(W)},timezone:H})};return Y.apply($,[W,V,G])}});else return J[X]}})}function m$1(Z){return new Proxy(Z,{get(J,X){if(X==="scheduleJob")return new Proxy(J.scheduleJob,{apply(Y,$,Q){let[W,K,G]=Q;if(typeof W!=="string"||typeof K!=="string"||typeof G!=="function")throw new Error("Automatic instrumentation of 'node-schedule' requires the first parameter of 'scheduleJob' to be a job name string and the second parameter to be a crontab string");let z=W,H=K;async function V(){return d7(z,async()=>{await G?.()},{schedule:{type:"crontab",value:_Q(H)}})}return Y.apply($,[z,H,V])}});return J[X]}})}var u$1={instrumentCron:y$1,instrumentNodeCron:g$1,instrumentNodeSchedule:m$1};var xQ;((w)=>{w.BUILD_PACKETS="build_packets";w.ENTITIES_EMIT_UPDATES="entities_emit_updates";w.ENTITIES_TICK="entities_tick";w.NETWORK_SYNCHRONIZE="network_synchronize";w.NETWORK_SYNCHRONIZE_CLEANUP="network_synchronize_cleanup";w.PHYSICS_CLEANUP="physics_cleanup";w.PHYSICS_STEP="physics_step";w.RELEASE_TICK_ALLOCATION="release_tick_allocation";w.SEND_ALL_PACKETS="send_all_packets";w.SEND_PACKETS="send_packets";w.SERIALIZE_FREE_BUFFERS="serialize_free_buffers";w.SERIALIZE_PACKETS="serialize_packets";w.SERIALIZE_PACKETS_ENCODE="serialize_packets_encode";w.SIMULATION_STEP="simulation_step";w.TICKER_TICK="ticker_tick";w.WORLD_TICK="world_tick"})(xQ||={});class J8{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 initializeSentry(Z,J=50){yR({dsn:Z,release:CS,environment:process.env.NODE_ENV||"development",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:(X)=>{return X.extra=J8.getProcessStats(),X},beforeSendTransaction:(X)=>{if(X.contexts?.trace?.op==="ticker_tick"){let $=X?.start_timestamp,Q=X?.timestamp;if(!$||!Q)return null;if((Q-$)*1000>J)return X.measurements=J8.getProcessStats(!0),X}return null}})}static startSpan(Z,J){if(jV())return n9({attributes:Z.attributes,name:Z.operation,op:Z.operation},J);else return J()}static sentry(){return cy}}var d$1=new V$,V46=5000;class y4 extends j0{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=k60(),this.onPacket(Y0.PacketId.CONNECTION,this._onConnectionPacket),this.onPacket(Y0.PacketId.HEARTBEAT,this._onHeartbeatPacket),this.bindWs(Z),j0.globalInstance.emit("CONNECTION.OPENED",{connection:this,req:J})}static clearCachedPacketsSerializedBuffers(){if(y4._cachedPacketsSerializedBuffer.size>0)y4._cachedPacketsSerializedBuffer.clear()}static serializePackets(Z){for(let X of Z)if(!Y0.isValidPacket(X))return d.error(`Connection.serializePackets(): Invalid packet payload: ${JSON.stringify(X)}`);let J=y4._cachedPacketsSerializedBuffer.get(Z);if(J)return J;return J8.startSpan({operation:"serialize_packets",attributes:{packets:Z.length,packetIds:Z.map((X)=>X[0]).join(",")}},(X)=>{let Y=J8.startSpan({operation:"serialize_packets_encode"},()=>d$1.pack(Z));return X?.setAttribute("serializedBytes",Y.byteLength),y4._cachedPacketsSerializedBuffer.set(Z,Y),Y})}bindWs(Z){let J=!!this._ws;if(J&&this._closeTimeout)clearTimeout(this._closeTimeout),this._closeTimeout=null;if(this._ws)this._ws.onmessage=()=>{},this._ws.onclose=()=>{},this._ws.onerror=()=>{},this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{k:!0})]);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([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{i:this.id})],!0,!0),J)this.emitWithGlobal("CONNECTION.RECONNECTED",{connection:this});if(m7.instance.isWrtcEnabled)this._upgradeToWRTC()}closeWrtc(){this._closeWrtcClientServerTransport(),this._closeWrtcServerClientTransport()}disconnect(){try{this._ws.close()}catch(Z){d.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!==H46.OPEN)return;J8.startSpan({operation:"send_packets",attributes:{forceWs:X?"true":"false",wrtcConnected:this._wrtcServerClientTransport?.iceState==="completed"?"true":"false"}},()=>{try{let Y=y4.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){d.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,W=!1;if($==this._wrtcClientServerTransport?.id)await this._wrtcClientServerTransport.connect({dtlsParameters:Q}),W=!0;if($==this._wrtcServerClientTransport?.id)await this._wrtcServerClientTransport.connect({dtlsParameters:Q}),W=!0;if(W)this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{ca:{i:$}})])}if(Y)for(let $ of Y){let{s:Q,l:W}=$,K=await this._wrtcClientServerTransport.produceData({label:W,sctpStreamParameters:Q}),G=await this._wrtcDirectTransport.consumeData({dataProducerId:K.id});this._wrtcClientServerDataProducers.push(K),this._wrtcClientServerDataConsumers.push(G),G.on("message",(z)=>this._onMessage(z)),this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{pa:{i:K.id,l:W}})])}};_onHeartbeatPacket=()=>{this.send([Y0.createPacket(Y0.bidirectionalPackets.heartbeatPacketDefinition,null)],!0,!0)};_onMessage=(Z)=>{try{let J=this._deserialize(Z);if(!J)return;this.emitWithGlobal("CONNECTION.PACKET_RECEIVED",{connection:this,packet:J})}catch(J){d.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()},V46)};_onWsError=(Z)=>{this.emitWithGlobal("CONNECTION.ERROR",{connection:this,error:Z})};_upgradeToWRTC=async()=>{let Z=await m7.instance.createWrtcTransports();if(!Z)return!1;let{directTransport:J,clientServerTransport:X,serverClientTransport:Y}=Z;this._wrtcDirectTransport=J,this._wrtcClientServerTransport=X,this._wrtcClientServerTransport.on("icestatechange",(W)=>{this._onWrtcIceStateChange(this._wrtcClientServerTransport,W)}),this._wrtcServerClientTransport=Y,this._wrtcServerClientTransport.on("icestatechange",(W)=>{this._onWrtcIceStateChange(this._wrtcServerClientTransport,W)}),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([Y0.createPacket(Y0.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=d$1.unpack(Z);if(!J||typeof J!=="object"||typeof J[0]!=="number")return d.error(`Connection._deserialize(): Invalid packet format. Packet: ${JSON.stringify(J)}`);if(!Y0.isValidPacket(J))return d.error(`Connection._deserialize(): Invalid packet payload. Packet: ${JSON.stringify(J)}`);return J}}class QF{_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(Z=!1){return Z?this._world.tickAllocator.getArray(this._lights.values()):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)}}class F6{_map=new Map;_values=[];_isDirty=!1;get size(){return this._map.size}get valuesArray(){if(this._isDirty)this._syncArray();return this._values}get(Z){return this._map.get(Z)}set(Z,J){let X=this._map.has(Z);if(this._map.set(Z,J),!X)this._values.push(J);else this._isDirty=!0;return this}has(Z){return this._map.has(Z)}delete(Z){let J=this._map.delete(Z);if(J)this._isDirty=!0;return J}clear(){this._map.clear(),this._values.length=0,this._isDirty=!1}forEach(Z,J){this._map.forEach((X,Y)=>{Z.call(J,X,Y,this)})}keys(){return this._map.keys()}values(){return this._map.values()}entries(){return this._map.entries()}[Symbol.iterator](){return this._map[Symbol.iterator]()}_syncArray(){this._values.length=0;for(let Z of this._map.values())this._values.push(Z);this._isDirty=!1}}var c$1;((X)=>{X[X.POINTLIGHT=0]="POINTLIGHT";X[X.SPOTLIGHT=1]="SPOTLIGHT"})(c$1||={});var ly;((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"})(ly||={});class py extends j0{_id;_angle;_attachedToEntity;_color;_distance;_intensity;_offset;_penumbra;_position;_trackedEntity;_trackedPosition;_type;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)d.fatalError("Either attachedToEntity or position must be set, but not both.");super();d.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 d.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&&this._offset.x===Z.x&&this._offset.y===Z.y&&this._offset.z===Z.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&&this._position.x===Z.x&&this._position.y===Z.y&&this._position.z===Z.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 d.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 d.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(){if(!this._world)d.fatalError("Light.serialize(): Light is not in a world and cannot be serialized!");return D0.serializeLight(this,this._world.tickAllocator)}}var iy;((m)=>{m.BURST="PARTICLE_EMITTER.BURST";m.DESPAWN="PARTICLE_EMITTER.DESPAWN";m.SET_ALPHA_TEST="PARTICLE_EMITTER.SET_ALPHA_TEST";m.SET_ATTACHED_TO_ENTITY="PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY";m.SET_ATTACHED_TO_ENTITY_NODE_NAME="PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY_NODE_NAME";m.SET_COLOR_END="PARTICLE_EMITTER.SET_COLOR_END";m.SET_COLOR_END_VARIANCE="PARTICLE_EMITTER.SET_COLOR_END_VARIANCE";m.SET_COLOR_START="PARTICLE_EMITTER.SET_COLOR_START";m.SET_COLOR_START_VARIANCE="PARTICLE_EMITTER.SET_COLOR_START_VARIANCE";m.SET_GRAVITY="PARTICLE_EMITTER.SET_GRAVITY";m.SET_LIFETIME="PARTICLE_EMITTER.SET_LIFETIME";m.SET_LIFETIME_VARIANCE="PARTICLE_EMITTER.SET_LIFETIME_VARIANCE";m.SET_MAX_PARTICLES="PARTICLE_EMITTER.SET_MAX_PARTICLES";m.SET_OFFSET="PARTICLE_EMITTER.SET_OFFSET";m.SET_OPACITY_END="PARTICLE_EMITTER.SET_OPACITY_END";m.SET_OPACITY_END_VARIANCE="PARTICLE_EMITTER.SET_OPACITY_END_VARIANCE";m.SET_OPACITY_START="PARTICLE_EMITTER.SET_OPACITY_START";m.SET_OPACITY_START_VARIANCE="PARTICLE_EMITTER.SET_OPACITY_START_VARIANCE";m.SET_PAUSED="PARTICLE_EMITTER.SET_PAUSED";m.SET_POSITION="PARTICLE_EMITTER.SET_POSITION";m.SET_POSITION_VARIANCE="PARTICLE_EMITTER.SET_POSITION_VARIANCE";m.SET_RATE="PARTICLE_EMITTER.SET_RATE";m.SET_RATE_VARIANCE="PARTICLE_EMITTER.SET_RATE_VARIANCE";m.SET_SIZE_END="PARTICLE_EMITTER.SET_SIZE_END";m.SET_SIZE_END_VARIANCE="PARTICLE_EMITTER.SET_SIZE_END_VARIANCE";m.SET_SIZE_START="PARTICLE_EMITTER.SET_SIZE_START";m.SET_SIZE_START_VARIANCE="PARTICLE_EMITTER.SET_SIZE_START_VARIANCE";m.SET_TEXTURE_URI="PARTICLE_EMITTER.SET_TEXTURE_URI";m.SET_TRANSPARENT="PARTICLE_EMITTER.SET_TRANSPARENT";m.SET_VELOCITY="PARTICLE_EMITTER.SET_VELOCITY";m.SET_VELOCITY_VARIANCE="PARTICLE_EMITTER.SET_VELOCITY_VARIANCE";m.SPAWN="PARTICLE_EMITTER.SPAWN"})(iy||={});class ny extends j0{_id;_alphaTest;_attachedToEntity;_attachedToEntityNodeName;_colorEnd;_colorEndVariance;_colorStart;_colorStartVariance;_gravity;_lifetime;_lifetimeVariance;_maxParticles;_offset;_opacityEnd;_opacityEndVariance;_opacityStart;_opacityStartVariance;_paused;_position;_positionVariance;_rate;_rateVariance;_sizeEnd;_sizeEndVariance;_sizeStart;_sizeStartVariance;_sizeVariance;_textureUri;_transparent;_velocity;_velocityVariance;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)d.fatalError("Either attachedToEntity or position must be set, but not both.");if(!Z.textureUri)d.fatalError("ParticleEmitter.constructor(): textureUri must be provided.");super();this._alphaTest=Z.alphaTest??0.5,this._attachedToEntity=Z.attachedToEntity,this._attachedToEntityNodeName=Z.attachedToEntityNodeName,this._colorEnd=Z.colorEnd,this._colorEndVariance=Z.colorEndVariance,this._colorStart=Z.colorStart,this._colorStartVariance=Z.colorStartVariance,this._gravity=Z.gravity,this._lifetime=Z.lifetime,this._lifetimeVariance=Z.lifetimeVariance,this._maxParticles=Z.maxParticles,this._offset=Z.offset,this._opacityEnd=Z.opacityEnd,this._opacityEndVariance=Z.opacityEndVariance,this._opacityStart=Z.opacityStart,this._opacityStartVariance=Z.opacityStartVariance,this._paused=!1,this._position=Z.position,this._positionVariance=Z.positionVariance,this._rate=Z.rate,this._rateVariance=Z.rateVariance,this._sizeEnd=Z.sizeEnd,this._sizeEndVariance=Z.sizeEndVariance,this._sizeStart=Z.sizeStart,this._sizeStartVariance=Z.sizeStartVariance,this._textureUri=Z.textureUri,this._transparent=Z.transparent,this._velocity=Z.velocity,this._velocityVariance=Z.velocityVariance}get id(){return this._id}get alphaTest(){return this._alphaTest}get attachedToEntity(){return this._attachedToEntity}get attachedToEntityNodeName(){return this._attachedToEntityNodeName}get colorEnd(){return this._colorEnd}get colorEndVariance(){return this._colorEndVariance}get colorStart(){return this._colorStart}get colorStartVariance(){return this._colorStartVariance}get gravity(){return this._gravity}get isSpawned(){return this._id!==void 0}get lifetime(){return this._lifetime}get lifetimeVariance(){return this._lifetimeVariance}get maxParticles(){return this._maxParticles}get offset(){return this._offset}get opacityEnd(){return this._opacityEnd}get opacityEndVariance(){return this._opacityEndVariance}get opacityStart(){return this._opacityStart}get opacityStartVariance(){return this._opacityStartVariance}get paused(){return this._paused}get position(){return this._position}get positionVariance(){return this._positionVariance}get rate(){return this._rate}get rateVariance(){return this._rateVariance}get sizeEnd(){return this._sizeEnd}get sizeEndVariance(){return this._sizeEndVariance}get sizeStart(){return this._sizeStart}get sizeStartVariance(){return this._sizeStartVariance}get sizeVariance(){return this._sizeVariance}get textureUri(){return this._textureUri}get transparent(){return this._transparent}get velocity(){return this._velocity}get velocityVariance(){return this._velocityVariance}get world(){return this._world}setAlphaTest(Z){if(this._alphaTest===Z)return;if(this._alphaTest=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_ALPHA_TEST",{particleEmitter:this,alphaTest:Z})}setAttachedToEntity(Z){if(!Z.isSpawned)return d.error(`ParticleEmitter.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,"PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY",{particleEmitter:this,entity:Z})}setAttachedToEntityNodeName(Z){if(this._attachedToEntityNodeName===Z)return;if(this._attachedToEntityNodeName=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY_NODE_NAME",{particleEmitter:this,attachedToEntityNodeName:Z})}setColorEnd(Z){if(this._colorEnd&&this._colorEnd.r===Z.r&&this._colorEnd.g===Z.g&&this._colorEnd.b===Z.b)return;if(this._colorEnd=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_END",{particleEmitter:this,colorEnd:Z})}setColorEndVariance(Z){if(this._colorEndVariance&&this._colorEndVariance.r===Z.r&&this._colorEndVariance.g===Z.g&&this._colorEndVariance.b===Z.b)return;if(this._colorEndVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_END_VARIANCE",{particleEmitter:this,colorEndVariance:Z})}setColorStart(Z){if(this._colorStart&&this._colorStart.r===Z.r&&this._colorStart.g===Z.g&&this._colorStart.b===Z.b)return;if(this._colorStart=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_START",{particleEmitter:this,colorStart:Z})}setColorStartVariance(Z){if(this._colorStartVariance&&this._colorStartVariance.r===Z.r&&this._colorStartVariance.g===Z.g&&this._colorStartVariance.b===Z.b)return;if(this._colorStartVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_START_VARIANCE",{particleEmitter:this,colorStartVariance:Z})}setGravity(Z){if(this._gravity&&this._gravity.x===Z.x&&this._gravity.y===Z.y&&this._gravity.z===Z.z)return;if(this._gravity=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_GRAVITY",{particleEmitter:this,gravity:Z})}setLifetime(Z){if(this._lifetime===Z)return;if(this._lifetime=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_LIFETIME",{particleEmitter:this,lifetime:Z})}setLifetimeVariance(Z){if(this._lifetimeVariance===Z)return;if(this._lifetimeVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_LIFETIME_VARIANCE",{particleEmitter:this,lifetimeVariance:Z})}setMaxParticles(Z){if(this._maxParticles===Z)return;if(this._maxParticles=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_MAX_PARTICLES",{particleEmitter:this,maxParticles:Z})}setOffset(Z){if(this._offset&&this._offset.x===Z.x&&this._offset.y===Z.y&&this._offset.z===Z.z)return;if(this._offset=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OFFSET",{particleEmitter:this,offset:Z})}setOpacityEnd(Z){if(this._opacityEnd===Z)return;if(this._opacityEnd=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_END",{particleEmitter:this,opacityEnd:Z})}setOpacityEndVariance(Z){if(this._opacityEndVariance===Z)return;if(this._opacityEndVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_END_VARIANCE",{particleEmitter:this,opacityEndVariance:Z})}setOpacityStart(Z){if(this._opacityStart===Z)return;if(this._opacityStart=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_START",{particleEmitter:this,opacityStart:Z})}setOpacityStartVariance(Z){if(this._opacityStartVariance===Z)return;if(this._opacityStartVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_START_VARIANCE",{particleEmitter:this,opacityStartVariance:Z})}setPosition(Z){if(this._position&&this._position.x===Z.x&&this._position.y===Z.y&&this._position.z===Z.z)return;if(this._position=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_POSITION",{particleEmitter:this,position:Z})}setPositionVariance(Z){if(this._positionVariance&&this._positionVariance.x===Z.x&&this._positionVariance.y===Z.y&&this._positionVariance.z===Z.z)return;if(this._positionVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_POSITION_VARIANCE",{particleEmitter:this,positionVariance:Z})}setRate(Z){if(this._rate===Z)return;if(this._rate=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_RATE",{particleEmitter:this,rate:Z})}setRateVariance(Z){if(this._rateVariance===Z)return;if(this._rateVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_RATE_VARIANCE",{particleEmitter:this,rateVariance:Z})}setSizeEnd(Z){if(this._sizeEnd===Z)return;if(this._sizeEnd=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_END",{particleEmitter:this,sizeEnd:Z})}setSizeEndVariance(Z){if(this._sizeEndVariance===Z)return;if(this._sizeEndVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_END_VARIANCE",{particleEmitter:this,sizeEndVariance:Z})}setSizeStart(Z){if(this._sizeStart===Z)return;if(this._sizeStart=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_START",{particleEmitter:this,sizeStart:Z})}setSizeStartVariance(Z){if(this._sizeStartVariance===Z)return;if(this._sizeStartVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_START_VARIANCE",{particleEmitter:this,sizeStartVariance:Z})}setTextureUri(Z){if(this._textureUri===Z)return;if(this._textureUri=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_TEXTURE_URI",{particleEmitter:this,textureUri:Z})}setTransparent(Z){if(this._transparent===Z)return;if(this._transparent=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_TRANSPARENT",{particleEmitter:this,transparent:Z})}setVelocity(Z){if(this._velocity&&this._velocity.x===Z.x&&this._velocity.y===Z.y&&this._velocity.z===Z.z)return;if(this._velocity=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_VELOCITY",{particleEmitter:this,velocity:Z})}setVelocityVariance(Z){if(this._velocityVariance&&this._velocityVariance.x===Z.x&&this._velocityVariance.y===Z.y&&this._velocityVariance.z===Z.z)return;if(this._velocityVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_VELOCITY_VARIANCE",{particleEmitter:this,velocityVariance:Z})}burst(Z){if(this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.BURST",{particleEmitter:this,count:Z})}despawn(){if(!this.isSpawned||!this._world)return;this._world.particleEmitterManager.unregisterParticleEmitter(this),this.emitWithWorld(this._world,"PARTICLE_EMITTER.DESPAWN",{particleEmitter:this}),this._id=void 0,this._world=void 0}restart(){if(!this._paused)return;if(this._paused=!1,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_PAUSED",{particleEmitter:this,paused:this._paused})}stop(){if(this._paused)return;if(this._paused=!0,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_PAUSED",{particleEmitter:this,paused:this._paused})}spawn(Z){if(this.isSpawned)return;if(this._attachedToEntity&&!this._attachedToEntity.isSpawned)return d.error(`ParticleEmitter.spawn(): Attached entity ${this._attachedToEntity.id} must be spawned before spawning ParticleEmitter!`);this._id=Z.particleEmitterManager.registerParticleEmitter(this),this._world=Z,this.emitWithWorld(Z,"PARTICLE_EMITTER.SPAWN",{particleEmitter:this})}serialize(){if(!this._world)d.fatalError("ParticleEmitter.serialize(): ParticleEmitter is not in a world and cannot be serialized!");return D0.serializeParticleEmitter(this,this._world.tickAllocator)}}var q46={x:0,y:-32,z:0},ay=60,sy;(($)=>{$.STEP_START="SIMULATION.STEP_START";$.STEP_END="SIMULATION.STEP_END";$.DEBUG_RAYCAST="SIMULATION.DEBUG_RAYCAST";$.DEBUG_RENDER="SIMULATION.DEBUG_RENDER"})(sy||={});class WF extends j0{_colliderMap=new pz;_debugRaycastingEnabled=!1;_debugRenderingEnabled=!1;_debugRenderingFilterFlags;_rapierEventQueue;_rapierSimulation;_world;constructor(Z,J=ay,X=q46){super();this._rapierEventQueue=new Q1.EventQueue(!0),this._rapierSimulation=new Q1.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}createRawCollider(Z,J){return this._rapierSimulation.createCollider(Z,J)}createRawRigidBody(Z){return this._rapierSimulation.createRigidBody(Z)}enableDebugRaycasting(Z){this._debugRaycastingEnabled=Z}enableDebugRendering(Z,J=Q1.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(),W=[];for(let K=0;K<Y.numSolverContacts();K++)W.push(Y.solverContactPoint(K));X.push({contactPoints:W,localNormalA:!$?Y.localNormal1():Y.localNormal2(),localNormalB:!$?Y.localNormal2():Y.localNormal1(),normal:!$?Q:{x:-Q.x,y:-Q.y,z:-Q.z}})}),X}intersectionsWithRawShape(Z,J,X,Y={}){let $=new Set,Q=[];return this._rapierSimulation.intersectionsWithShape(J,X,Z,(W)=>{let K=this._colliderMap.getColliderHandleBlockType(W.handle);if(K&&!$.has(K))return $.add(K),Q.push({intersectedBlockType:K}),!0;let G=this._colliderMap.getColliderHandleEntity(W.handle);if(G&&!$.has(G))return $.add(G),Q.push({intersectedEntity:G}),!0;return!0},Y.filterFlags,Y.filterGroups,Y.filterExcludeCollider,Y.filterExcludeRigidBody,Y.filterPredicate),Q}raycast(Z,J,X,Y={}){let $=new Q1.Ray(Z,J),Q=this._rapierSimulation.castRay($,X,Y.solidMode??!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 W=$.pointAt(Q.timeOfImpact),K=Q.timeOfImpact,G=Q.collider,z=this._colliderMap.getColliderHandleBlockType(G.handle);if(z)return{hitBlock:gQ.fromGlobalCoordinate({x:Math.floor(W.x-($.dir.x<0?0.0001:-0.0001)),y:Math.floor(W.y-($.dir.y<0?0.0001:-0.0001)),z:Math.floor(W.z-($.dir.z<0?0.0001:-0.0001))},z),hitPoint:W,hitDistance:K};let H=this._colliderMap.getColliderHandleEntity(G.handle);if(H)return{hitEntity:H,hitPoint:W,hitDistance:K};return null}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(J8.startSpan({operation:"physics_step"},()=>{this._rapierSimulation.step(this._rapierEventQueue)}),J8.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=(W,K)=>{if(W instanceof Q9&&K instanceof a8&&W.hasListeners("BLOCK_TYPE.ENTITY_COLLISION"))W.emit("BLOCK_TYPE.ENTITY_COLLISION",{blockType:W,entity:K,started:X,colliderHandleA:Z,colliderHandleB:J});else if(W instanceof a8&&K instanceof Q9&&W.hasListeners("ENTITY.BLOCK_COLLISION"))W.emit("ENTITY.BLOCK_COLLISION",{entity:W,blockType:K,started:X,colliderHandleA:Z,colliderHandleB:J});else if(W instanceof a8&&K instanceof a8&&W.hasListeners("ENTITY.ENTITY_COLLISION"))W.emit("ENTITY.ENTITY_COLLISION",{entity:W,otherEntity:K,started:X,colliderHandleA:Z,colliderHandleB:J});else if(typeof W==="function"&&(K instanceof a8||K instanceof Q9))W(K,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,W)=>{if(Q instanceof Q9&&W instanceof a8&&Q.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))Q.emit("BLOCK_TYPE.ENTITY_CONTACT_FORCE",{blockType:Q,entity:W,contactForceData:Y});else if(Q instanceof a8&&W instanceof Q9&&Q.hasListeners("ENTITY.BLOCK_CONTACT_FORCE"))Q.emit("ENTITY.BLOCK_CONTACT_FORCE",{entity:Q,blockType:W,contactForceData:Y});else if(Q instanceof a8&&W instanceof a8&&Q.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))Q.emit("ENTITY.ENTITY_CONTACT_FORCE",{entity:Q,otherEntity:W,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 gR{_synchronizedPlayerReliablePackets=new F6;_queuedBroadcasts=[];_queuedAudioSynchronizations=new F6;_queuedBlockSynchronizations=new F6;_queuedBlockTypeSynchronizations=new F6;_queuedChunkSynchronizations=new F6;_queuedDebugRaycastSynchronizations=[];_queuedEntitySynchronizations=new F6;_queuedLightSynchronizations=new F6;_queuedParticleEmitterSynchronizations=new F6;_queuedPerPlayerSynchronizations=new F6;_queuedPerPlayerCameraSynchronizations=new F6;_queuedPerPlayerUISynchronizations=new F6;_queuedPerPlayerUIDatasSynchronizations=new F6;_queuedPlayerSynchronizations=new F6;_queuedSceneUISynchronizations=new F6;_queuedWorldSynchronization;_loadedSceneUIs=new Set;_spawnedChunks=new Set;_spawnedEntities=new Set;_world;constructor(Z){this._world=Z,this._subscribeToAudioEvents(),this._subscribeToBlockTypeRegistryEvents(),this._subscribeToChatEvents(),this._subscribeToChunkLatticeEvents(),this._subscribeToEntityEvents(),this._subscribeToLightEvents(),this._subscribeToParticleEmitterEvents(),this._subscribeToPlayerEvents(),this._subscribeToPlayerCameraEvents(),this._subscribeToPlayerUIEvents(),this._subscribeToSceneUIEvents(),this._subscribeToSimulationEvents(),this._subscribeToWorldEvents()}synchronize(){let Z=this._world.tickAllocator,J=this._world.tickAllocator.getArray(),X=this._world.tickAllocator.getArray(),Y=this._world.loop.currentTick;if(this._queuedPerPlayerSynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerSynchronizations)this._createOrGetSynchronizedPlayerReliablePackets($,J).push(...Q);if(this._queuedEntitySynchronizations.size>0){let $=this._world.tickAllocator.getArray(),Q=this._world.tickAllocator.getArray();for(let W of this._queuedEntitySynchronizations.valuesArray){let K=!1;for(let G in W)if(G!=="i"&&G!=="p"&&G!=="r"){K=!0;break}if(K)$.push(W);else Q.push(W)}if(Q.length>0){let W=Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,Q,Y,Z.getArray());X.push(W)}if($.length>0){let W=Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,$,Y,Z.getArray());J.push(W);for(let K of this._synchronizedPlayerReliablePackets.valuesArray)K.push(W)}}if(this._queuedAudioSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.audiosPacketDefinition,this._queuedAudioSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedBlockTypeSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.blockTypesPacketDefinition,this._queuedBlockTypeSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedChunkSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.chunksPacketDefinition,this._queuedChunkSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedBlockSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.blocksPacketDefinition,this._queuedBlockSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedLightSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.lightsPacketDefinition,this._queuedLightSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedParticleEmitterSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.particleEmittersPacketDefinition,this._queuedParticleEmitterSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedPerPlayerUISynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerUISynchronizations){let W=Y0.createPacket(Y0.outboundPackets.uiPacketDefinition,Q,Y,Z.getArray());this._createOrGetSynchronizedPlayerReliablePackets($,J).push(W)}if(this._queuedPerPlayerUIDatasSynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerUIDatasSynchronizations){let W=Y0.createPacket(Y0.outboundPackets.uiDatasPacketDefinition,Q,Y,Z.getArray());this._createOrGetSynchronizedPlayerReliablePackets($,J).push(W)}if(this._queuedSceneUISynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.sceneUIsPacketDefinition,this._queuedSceneUISynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedWorldSynchronization){let $=Y0.createPacket(Y0.outboundPackets.worldPacketDefinition,this._queuedWorldSynchronization,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedPerPlayerCameraSynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerCameraSynchronizations){let W=Y0.createPacket(Y0.outboundPackets.cameraPacketDefinition,Q,Y,Z.getArray());this._createOrGetSynchronizedPlayerReliablePackets($,J).push(W)}if(this._queuedPlayerSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.playersPacketDefinition,this._queuedPlayerSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedBroadcasts.length>0)for(let $ of this._queuedBroadcasts){J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedDebugRaycastSynchronizations.length>0){let $=Y0.createPacket(Y0.outboundPackets.physicsDebugRaycastsPacketDefinition,this._queuedDebugRaycastSynchronizations,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}J8.startSpan({operation:"send_all_packets"},()=>{for(let $ of V9.instance.getConnectedPlayersByWorld(this._world)){let Q=this._synchronizedPlayerReliablePackets.get($)??J;if(Q.length>0)$.connection.send(Q);if(X.length>0)$.connection.send(X,!1)}}),J8.startSpan({operation:"network_synchronize_cleanup"},()=>{if(this._queuedBroadcasts.length>0)this._queuedBroadcasts.length=0;if(this._queuedAudioSynchronizations.size>0)this._queuedAudioSynchronizations.clear();if(this._queuedBlockSynchronizations.size>0)this._queuedBlockSynchronizations.clear();if(this._queuedBlockTypeSynchronizations.size>0)this._queuedBlockTypeSynchronizations.clear();if(this._queuedChunkSynchronizations.size>0)this._queuedChunkSynchronizations.clear();if(this._queuedDebugRaycastSynchronizations.length>0)this._queuedDebugRaycastSynchronizations.length=0;if(this._queuedEntitySynchronizations.size>0)this._queuedEntitySynchronizations.clear();if(this._queuedLightSynchronizations.size>0)this._queuedLightSynchronizations.clear();if(this._queuedParticleEmitterSynchronizations.size>0)this._queuedParticleEmitterSynchronizations.clear();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(this._queuedPlayerSynchronizations.size>0)this._queuedPlayerSynchronizations.clear();if(this._queuedSceneUISynchronizations.size>0)this._queuedSceneUISynchronizations.clear();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();y4.clearCachedPacketsSerializedBuffers()})}_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)}_subscribeToChunkLatticeEvents(){this._world.final("CHUNK_LATTICE.ADD_CHUNK",this._onChunkLatticeAddChunk),this._world.final("CHUNK_LATTICE.REMOVE_CHUNK",this._onChunkLatticeRemoveChunk),this._world.final("CHUNK_LATTICE.SET_BLOCK",this._onChunkLatticeSetBlock)}_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_MODEL_SCALE",this._onEntitySetModelScale),this._world.final("ENTITY.SET_MODEL_SHOWN_NODES",this._onEntitySetModelShownNodes),this._world.final("ENTITY.SET_MODEL_TEXTURE_URI",this._onEntitySetModelTextureUri),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)}_subscribeToParticleEmitterEvents(){this._world.final("PARTICLE_EMITTER.DESPAWN",this._onParticleEmitterDespawn),this._world.final("PARTICLE_EMITTER.BURST",this._onParticleEmitterBurst),this._world.final("PARTICLE_EMITTER.SET_ALPHA_TEST",this._onParticleEmitterSetAlphaTest),this._world.final("PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY",this._onParticleEmitterSetAttachedToEntity),this._world.final("PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY_NODE_NAME",this._onParticleEmitterSetAttachedToEntityNodeName),this._world.final("PARTICLE_EMITTER.SET_COLOR_END",this._onParticleEmitterSetColorEnd),this._world.final("PARTICLE_EMITTER.SET_COLOR_END_VARIANCE",this._onParticleEmitterSetColorEndVariance),this._world.final("PARTICLE_EMITTER.SET_COLOR_START",this._onParticleEmitterSetColorStart),this._world.final("PARTICLE_EMITTER.SET_COLOR_START_VARIANCE",this._onParticleEmitterSetColorStartVariance),this._world.final("PARTICLE_EMITTER.SET_GRAVITY",this._onParticleEmitterSetGravity),this._world.final("PARTICLE_EMITTER.SET_LIFETIME",this._onParticleEmitterSetLifetime),this._world.final("PARTICLE_EMITTER.SET_LIFETIME_VARIANCE",this._onParticleEmitterSetLifetimeVariance),this._world.final("PARTICLE_EMITTER.SET_MAX_PARTICLES",this._onParticleEmitterSetMaxParticles),this._world.final("PARTICLE_EMITTER.SET_OFFSET",this._onParticleEmitterSetOffset),this._world.final("PARTICLE_EMITTER.SET_OPACITY_END",this._onParticleEmitterSetOpacityEnd),this._world.final("PARTICLE_EMITTER.SET_OPACITY_END_VARIANCE",this._onParticleEmitterSetOpacityEndVariance),this._world.final("PARTICLE_EMITTER.SET_OPACITY_START",this._onParticleEmitterSetOpacityStart),this._world.final("PARTICLE_EMITTER.SET_OPACITY_START_VARIANCE",this._onParticleEmitterSetOpacityStartVariance),this._world.final("PARTICLE_EMITTER.SET_PAUSED",this._onParticleEmitterSetPaused),this._world.final("PARTICLE_EMITTER.SET_POSITION",this._onParticleEmitterSetPosition),this._world.final("PARTICLE_EMITTER.SET_POSITION_VARIANCE",this._onParticleEmitterSetPositionVariance),this._world.final("PARTICLE_EMITTER.SET_RATE",this._onParticleEmitterSetRate),this._world.final("PARTICLE_EMITTER.SET_RATE_VARIANCE",this._onParticleEmitterSetRateVariance),this._world.final("PARTICLE_EMITTER.SET_SIZE_END",this._onParticleEmitterSetSizeEnd),this._world.final("PARTICLE_EMITTER.SET_SIZE_END_VARIANCE",this._onParticleEmitterSetSizeEndVariance),this._world.final("PARTICLE_EMITTER.SET_SIZE_START",this._onParticleEmitterSetSizeStart),this._world.final("PARTICLE_EMITTER.SET_SIZE_START_VARIANCE",this._onParticleEmitterSetSizeStartVariance),this._world.final("PARTICLE_EMITTER.SET_TEXTURE_URI",this._onParticleEmitterSetTextureUri),this._world.final("PARTICLE_EMITTER.SET_TRANSPARENT",this._onParticleEmitterSetTransparent),this._world.final("PARTICLE_EMITTER.SET_VELOCITY",this._onParticleEmitterSetVelocity),this._world.final("PARTICLE_EMITTER.SET_VELOCITY_VARIANCE",this._onParticleEmitterSetVelocityVariance),this._world.final("PARTICLE_EMITTER.SPAWN",this._onParticleEmitterSpawn)}_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_MODEL_SHOWN_NODES",this._onPlayerCameraSetModelShownNodes),this._world.final("PLAYER_CAMERA.SET_MODE",this._onPlayerCameraSetMode),this._world.final("PLAYER_CAMERA.SET_OFFSET",this._onPlayerCameraSetOffset),this._world.final("PLAYER_CAMERA.SET_SHOULDER_ANGLE",this._onPlayerCameraSetShoulderAngle),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_FOG_COLOR",this._onWorldSetFogColor),this._world.final("WORLD.SET_FOG_FAR",this._onWorldSetFogFar),this._world.final("WORLD.SET_FOG_NEAR",this._onWorldSetFogNear),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.set(J.i,J)};_onAudioPlayRestart=(Z)=>{let J=Z.audio.serialize();J.r=!0,delete J.pa,delete J.pl,this._queuedAudioSynchronizations.set(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?D0.serializeVector(Z.position,this._world.tickAllocator):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.set(Z.blockType.id,J)};_onChatSendBroadcastMessage=(Z)=>{let J=this._world.tickAllocator,{player:X,message:Y,color:$}=Z,Q=J.getObject();Q.m=Y,Q.c=$,Q.p=X?.id;let W=J.getArray();W.push(Q),this._queuedBroadcasts.push(Y0.createPacket(Y0.outboundPackets.chatMessagesPacketDefinition,W,this._world.loop.currentTick,J.getArray()))};_onChatSendPlayerMessage=(Z)=>{let J=this._world.tickAllocator,{player:X,message:Y,color:$}=Z,Q=this._queuedPerPlayerSynchronizations.get(X)??[],W=J.getObject();W.m=Y,W.c=$;let K=J.getArray();K.push(W),Q.push(Y0.createPacket(Y0.outboundPackets.chatMessagesPacketDefinition,K,this._world.loop.currentTick,this._world.tickAllocator.getArray())),this._queuedPerPlayerSynchronizations.set(X,Q)};_onChunkLatticeAddChunk=(Z)=>{let J=this._createOrGetQueuedChunkSync(Z.chunk);J.b=this._world.tickAllocator.getArray(Z.chunk.blocks),J.rm=void 0,this._spawnedChunks.add(J.c.join(","))};_onChunkLatticeRemoveChunk=(Z)=>{let J=this._createOrGetQueuedChunkSync(Z.chunk),X=J.c.join(",");if(this._spawnedChunks.has(X))this._queuedChunkSynchronizations.delete(X),this._spawnedChunks.delete(X);else J.rm=!0};_onChunkLatticeSetBlock=(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.set(J.i,J),this._spawnedEntities.add(J.i)};_onEntityDespawn=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(this._spawnedEntities.has(J.i))this._queuedEntitySynchronizations.delete(J.i),this._spawnedEntities.delete(J.i);else J.rm=!0};_onEntitySetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.h=this._world.tickAllocator.getArray(Z.modelHiddenNodes)};_onEntitySetModelScale=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.s=Z.modelScale};_onEntitySetModelShownNodes=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.sn=this._world.tickAllocator.getArray(Z.modelShownNodes)};_onEntitySetModelTextureUri=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.mt=Z.modelTextureUri};_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?D0.serializeRgbColor(Z.tintColor,this._world.tickAllocator):void 0};_onEntityStartModelLoopedAnimations=(Z)=>{let J=this._world.tickAllocator,X=this._createOrGetQueuedEntitySync(Z.entity),Y=J.getSet(X.al,Z.animations);if(X.al=J.getArray(Y),X.as){let $=J.getArray();for(let Q of X.as)!Y.has(Q)&&$.push(Q);X.as=$}};_onEntityStartModelOneshotAnimations=(Z)=>{let J=this._world.tickAllocator,X=this._createOrGetQueuedEntitySync(Z.entity),Y=J.getSet(X.ao,Z.animations);if(X.ao=J.getArray(Y),X.as){let $=J.getArray();for(let Q of X.as)!Y.has(Q)&&$.push(Q);X.as=$}};_onEntityStopModelAnimations=(Z)=>{let J=this._world.tickAllocator,X=this._createOrGetQueuedEntitySync(Z.entity);if(X.al){let Y=J.getSet(X.al);for(let $ of Z.animations)Y.delete($);X.al=J.getArray(Y)}if(X.ao){let Y=J.getSet(X.ao);for(let $ of Z.animations)Y.delete($);X.ao=J.getArray(Y)}X.as=J.getArray(J.getSet(X.as,Z.animations))};_onEntityUpdateRotation=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.r=D0.serializeQuaternion(Z.rotation,this._world.tickAllocator)};_onEntityUpdatePosition=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.p=D0.serializeVector(Z.position,this._world.tickAllocator)};_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=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_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?D0.serializeVector(Z.offset,this._world.tickAllocator):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?D0.serializeVector(Z.position,this._world.tickAllocator):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?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,J.te=Z.position?void 0:J.te};_onLightSpawn=(Z)=>{let J=Z.light.serialize();this._queuedLightSynchronizations.set(J.i,J)};_onParticleEmitterBurst=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.b=Z.count};_onParticleEmitterDespawn=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.rm=!0};_onParticleEmitterSetAlphaTest=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.at=Z.alphaTest};_onParticleEmitterSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onParticleEmitterSetAttachedToEntityNodeName=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.en=Z.attachedToEntityNodeName};_onParticleEmitterSetColorEnd=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.ce=Z.colorEnd?D0.serializeRgbColor(Z.colorEnd,this._world.tickAllocator):void 0};_onParticleEmitterSetColorEndVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.cev=Z.colorEndVariance?D0.serializeRgbColor(Z.colorEndVariance,this._world.tickAllocator):void 0};_onParticleEmitterSetColorStart=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.cs=Z.colorStart?D0.serializeRgbColor(Z.colorStart,this._world.tickAllocator):void 0};_onParticleEmitterSetColorStartVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.csv=Z.colorStartVariance?D0.serializeRgbColor(Z.colorStartVariance,this._world.tickAllocator):void 0};_onParticleEmitterSetGravity=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.g=Z.gravity?D0.serializeVector(Z.gravity,this._world.tickAllocator):void 0};_onParticleEmitterSetLifetime=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.l=Z.lifetime};_onParticleEmitterSetLifetimeVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.lv=Z.lifetimeVariance};_onParticleEmitterSetMaxParticles=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.mp=Z.maxParticles};_onParticleEmitterSetOffset=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.o=Z.offset?D0.serializeVector(Z.offset,this._world.tickAllocator):void 0};_onParticleEmitterSetOpacityEnd=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.oe=Z.opacityEnd};_onParticleEmitterSetOpacityEndVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.oev=Z.opacityEndVariance};_onParticleEmitterSetOpacityStart=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.os=Z.opacityStart};_onParticleEmitterSetOpacityStartVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.osv=Z.opacityStartVariance};_onParticleEmitterSetPaused=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.pa=Z.paused};_onParticleEmitterSetPosition=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.p=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,J.e=Z.position?void 0:J.e,J.en=Z.position?void 0:J.en};_onParticleEmitterSetPositionVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.pv=Z.positionVariance?D0.serializeVector(Z.positionVariance,this._world.tickAllocator):void 0};_onParticleEmitterSetRate=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.r=Z.rate};_onParticleEmitterSetRateVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.rv=Z.rateVariance};_onParticleEmitterSetSizeEnd=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.se=Z.sizeEnd};_onParticleEmitterSetSizeEndVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.sev=Z.sizeEndVariance};_onParticleEmitterSetSizeStart=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.ss=Z.sizeStart};_onParticleEmitterSetSizeStartVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.ssv=Z.sizeStartVariance};_onParticleEmitterSetTextureUri=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.tu=Z.textureUri};_onParticleEmitterSetTransparent=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.t=Z.transparent};_onParticleEmitterSetVelocity=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.v=Z.velocity?D0.serializeVector(Z.velocity,this._world.tickAllocator):void 0};_onParticleEmitterSetVelocityVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.vv=Z.velocityVariance?D0.serializeVector(Z.velocityVariance,this._world.tickAllocator):void 0};_onParticleEmitterSpawn=(Z)=>{let J=Z.particleEmitter.serialize();this._queuedParticleEmitterSynchronizations.set(J.i,J)};_onPlayerCameraLookAtEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=D0.serializeVector(Z.entity.position,this._world.tickAllocator),delete J.et,delete J.pt};_onPlayerCameraLookAtPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):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?D0.serializeVector(Z.position,this._world.tickAllocator):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=this._world.tickAllocator.getArray(Z.modelHiddenNodes)};_onPlayerCameraSetModelShownNodes=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.s=this._world.tickAllocator.getArray(Z.modelShownNodes)};_onPlayerCameraSetMode=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.m=Z.mode};_onPlayerCameraSetOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.o=Z.offset?D0.serializeVector(Z.offset,this._world.tickAllocator):void 0};_onPlayerCameraSetShoulderAngle=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.sa=Z.shoulderAngle};_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?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,delete J.et,delete J.pl};_onPlayerCameraSetZoom=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.z=Z.zoom};_onPlayerJoinedWorld=(Z)=>{let J=this._world.tickAllocator,{player:X}=Z,Y=this._queuedPerPlayerSynchronizations.get(X)??J.getArray();Y.push(Y0.createPacket(Y0.outboundPackets.worldPacketDefinition,this._world.serialize(),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.blockTypesPacketDefinition,this._world.blockTypeRegistry.serialize(),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.chunksPacketDefinition,J.map(this._world.chunkLattice.getAllChunks(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,J.map(this._world.entityManager.getAllEntities(!0),(Q)=>{if(X.camera.attachedToEntity===void 0&&Q instanceof v7&&Q.player===X)X.camera.setAttachedToEntity(Q);return Q.serialize()}),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.audiosPacketDefinition,J.map(this._world.audioManager.getAllLoopedAudios(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.lightsPacketDefinition,J.map(this._world.lightManager.getAllLights(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.particleEmittersPacketDefinition,J.map(this._world.particleEmitterManager.getAllParticleEmitters(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.sceneUIsPacketDefinition,J.map(this._world.sceneUIManager.getAllSceneUIs(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.playersPacketDefinition,J.map(V9.instance.getConnectedPlayers(),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray()));let $=this._createOrGetQueuedPlayerCameraSync(X.camera);this._queuedPerPlayerCameraSynchronizations.set(X,J.getObject(X.camera.serialize(),$)),this._queuedPerPlayerSynchronizations.set(X,Y),this._queuedPlayerSynchronizations.set(X.id,X.serialize())};_onPlayerLeftWorld=(Z)=>{let J=this._createOrGetQueuedPlayerSync(Z.player);J.rm=!0};_onPlayerReconnectedWorld=(Z)=>{this._onPlayerJoinedWorld(Z)};_onPlayerRequestSync=(Z)=>{let J=this._world.tickAllocator,X=J.getObject();X.r=Z.receivedAt,X.s=Date.now(),X.p=performance.now()-Z.receivedAtMs,X.n=this._world.loop.nextTickMs,Z.player.connection.send([Y0.createPacket(Y0.outboundPackets.syncResponsePacketDefinition,X,this._world.loop.currentTick,J.getArray())])};_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.set(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?D0.serializeVector(Z.offset,this._world.tickAllocator):void 0};_onSceneUISetPosition=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.p=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):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))this._queuedSceneUISynchronizations.delete(J.i),this._loadedSceneUIs.delete(J.i);else J.rm=!0};_onSimulationDebugRaycast=(Z)=>{this._queuedDebugRaycastSynchronizations.push(D0.serializePhysicsDebugRaycast(Z,this._world.tickAllocator))};_onSimulationDebugRender=(Z)=>{this._queuedBroadcasts.push(Y0.createPacket(Y0.outboundPackets.physicsDebugRenderPacketDefinition,{v:Array.from(Z.vertices),c:Array.from(Z.colors)},this._world.loop.currentTick,this._world.tickAllocator.getArray()))};_onWorldSetAmbientLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ac=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_onWorldSetAmbientLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ai=Z.intensity};_onWorldSetDirectionalLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dc=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_onWorldSetDirectionalLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.di=Z.intensity};_onWorldSetDirectionalLightPosition=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dp=D0.serializeVector(Z.position,this._world.tickAllocator)};_onWorldSetFogColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.fc=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_onWorldSetFogFar=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ff=Z.far};_onWorldSetFogNear=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.fn=Z.near};_onWorldSetSkyboxIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.si=Z.intensity};_createOrGetQueuedAudioSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedAudioSync(): Audio has no id!");let J=this._queuedAudioSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedAudioSynchronizations.set(Z.id,J);return J}_createOrGetQueuedBlockSync(Z){let{x:J,y:X,z:Y}=Z,$=`${J},${X},${Y}`,Q=this._queuedBlockSynchronizations.get($);if(!Q)Q=this._world.tickAllocator.getObject(),Q.i=0,Q.c=[J,X,Y],this._queuedBlockSynchronizations.set($,Q);return Q}_createOrGetQueuedChunkSync(Z){if(!Z.originCoordinate)d.fatalError("NetworkSynchronizer._createOrGetQueuedChunkSync(): Chunk has no origin coordinate!");let{x:J,y:X,z:Y}=Z.originCoordinate,$=`${J},${X},${Y}`,Q=this._queuedChunkSynchronizations.get($);if(!Q)Q=this._world.tickAllocator.getObject(),Q.c=[J,X,Y],this._queuedChunkSynchronizations.set($,Q);return Q}_createOrGetQueuedEntitySync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedEntitySync(): Entity has no id!");let J=this._queuedEntitySynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedEntitySynchronizations.set(Z.id,J);return J}_createOrGetQueuedLightSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedLightSync(): Light has no id!");let J=this._queuedLightSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedLightSynchronizations.set(Z.id,J);return J}_createOrGetQueuedParticleEmitterSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedParticleEmitterSync(): ParticleEmitter has no id!");let J=this._queuedParticleEmitterSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedParticleEmitterSynchronizations.set(Z.id,J);return J}_createOrGetQueuedPlayerSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedPlayerSync(): Player has no id!");let J=this._queuedPlayerSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedPlayerSynchronizations.set(Z.id,J);return J}_createOrGetQueuedPlayerCameraSync(Z){let J=this._queuedPerPlayerCameraSynchronizations.get(Z.player);if(!J)J=this._world.tickAllocator.getObject(),this._queuedPerPlayerCameraSynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUISync(Z){let J=this._queuedPerPlayerUISynchronizations.get(Z.player);if(!J)J=this._world.tickAllocator.getObject(),this._queuedPerPlayerUISynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUIDatasSync(Z){let J=this._queuedPerPlayerUIDatasSynchronizations.get(Z.player);if(!J)J=this._world.tickAllocator.getArray(),this._queuedPerPlayerUIDatasSynchronizations.set(Z.player,J);return J}_createOrGetQueuedSceneUISync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedSceneUISync(): SceneUI has no id!");let J=this._queuedSceneUISynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedSceneUISynchronizations.set(Z.id,J);return J}_createOrGetQueuedWorldSync(Z){if(Z.id!==this._world.id)d.fatalError("NetworkSynchronizer._createOrGetQueuedWorldSync(): World does not match this network synchronizer world!");return this._queuedWorldSynchronization??=this._world.tickAllocator.getObject(),this._queuedWorldSynchronization.i=Z.id,this._queuedWorldSynchronization}_createOrGetSynchronizedPlayerReliablePackets(Z,J){let X=this._synchronizedPlayerReliablePackets.get(Z);if(!X)X=this._world.tickAllocator.getArray(J),this._synchronizedPlayerReliablePackets.set(Z,X);return X}}class KF{_particleEmitters=new Map;_nextParticleEmitterId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}despawnEntityAttachedParticleEmitters(Z){this.getAllEntityAttachedParticleEmitters(Z).forEach((J)=>{J.despawn()})}getAllParticleEmitters(Z=!1){return Z?this._world.tickAllocator.getArray(this._particleEmitters.values()):Array.from(this._particleEmitters.values())}getAllEntityAttachedParticleEmitters(Z){return this.getAllParticleEmitters().filter((J)=>J.attachedToEntity===Z)}registerParticleEmitter(Z){if(Z.id!==void 0)return Z.id;let J=this._nextParticleEmitterId;return this._particleEmitters.set(J,Z),this._nextParticleEmitterId++,J}unregisterParticleEmitter(Z){if(Z.id===void 0)return;this._particleEmitters.delete(Z.id)}}class GF{_sceneUIs=new Map;_nextSceneUIId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}getAllSceneUIs(Z=!1){return Z?this._world.tickAllocator.getArray(this._sceneUIs.values()):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)}}class zF{_allocatedArrays=[];_allocatedArray3Numbers=[];_allocatedArray4Numbers=[];_allocatedObjects=[];_allocatedSets=[];_arrayPool=[];_array3NumberPool=[];_array4NumberPool=[];_objectPool=[];_setPool=[];filter(Z,J){let X=this.getArray();for(let Y=0;Y<Z.length;Y++)if(J(Z[Y],Y,Z))X.push(Z[Y]);return X}getArray(Z,J){let X=this._arrayPool.pop()??[];X.length=0;let Y=0;if(Z)for(let $ of Z)X[Y++]=$;if(J)for(let $ of J)X[Y++]=$;return this._allocatedArrays.push(X),X}getArray3Number(Z){let J=this._array3NumberPool.pop()??[0,0,0];if(J[0]=J[1]=J[2]=0,Z){let X=0;for(let Y of Z){if(X>=3)break;J[X++]=Y}}return this._allocatedArray3Numbers.push(J),J}getArray4Number(Z){let J=this._array4NumberPool.pop()??[0,0,0,0];if(J[0]=J[1]=J[2]=J[3]=0,Z){let X=0;for(let Y of Z){if(X>=4)break;J[X++]=Y}}return this._allocatedArray4Numbers.push(J),J}getObject(Z,J){let X=this._objectPool.pop()??Object.create(null);for(let Y in X)delete X[Y];if(Z)Object.assign(X,Z);if(J)Object.assign(X,J);return this._allocatedObjects.push(X),X}getSet(Z,J){let X=this._setPool.pop()??new Set;if(X.clear(),Z)for(let Y of Z)X.add(Y);if(J)for(let Y of J)X.add(Y);return this._allocatedSets.push(X),X}map(Z,J){let X=this.getArray();X.length=Z.length;for(let Y=0;Y<Z.length;Y++)X[Y]=J(Z[Y],Y,Z);return X}reset(){for(let Z=0;Z<this._allocatedArrays.length;Z++)if(this._arrayPool.length<4096)this._arrayPool.push(this._allocatedArrays[Z]);for(let Z=0;Z<this._allocatedArray3Numbers.length;Z++)if(this._array3NumberPool.length<4096)this._array3NumberPool.push(this._allocatedArray3Numbers[Z]);for(let Z=0;Z<this._allocatedArray4Numbers.length;Z++)if(this._array4NumberPool.length<4096)this._array4NumberPool.push(this._allocatedArray4Numbers[Z]);for(let Z=0;Z<this._allocatedObjects.length;Z++)if(this._objectPool.length<4096)this._objectPool.push(this._allocatedObjects[Z]);for(let Z=0;Z<this._allocatedSets.length;Z++)if(this._setPool.length<1024)this._setPool.push(this._allocatedSets[Z]);this._allocatedArrays.length=0,this._allocatedArray3Numbers.length=0,this._allocatedArray4Numbers.length=0,this._allocatedObjects.length=0,this._allocatedSets.length=0}}var F46=2,U46=3;class HF{_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*U46,this._tickFunction=J,this._tickErrorCallback=X}get targetTicksPerSecond(){return this._targetTicksPerSecond}get fixedTimestepMs(){return this._fixedTimestepMs}get fixedTimestepS(){return this._fixedTimestepS}get isStarted(){return!!this._tickHandle}get nextTickMs(){return this._nextTickMs}start(){if(this._tickHandle)return;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)J8.startSpan({operation:"ticker_tick"},()=>{let Y=0;while(this._accumulatorMs>=this._fixedTimestepMs&&Y<F46)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;clearTimeout(this._tickHandle),this._tickHandle=null}_tick(Z){try{this._tickFunction(Z)}catch(J){if(J instanceof Error&&this._tickErrorCallback)this._tickErrorCallback(J);else d.warning(`Ticker._tick(): tick callback threw an error, but it was not an instance of Error. Error: ${J}`)}}}var l$1;((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"})(l$1||={});class VF extends j0{_currentTick=0;_ticker;_world;constructor(Z,J=ay){super();this._ticker=new HF(J,this._tick,this._onTickError),this._world=Z}get currentTick(){return this._currentTick}get isStarted(){return this._ticker.isStarted}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();J8.startSpan({operation:"world_tick",attributes:{serverPlayerCount:V9.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}},()=>{J8.startSpan({operation:"entities_tick"},()=>this._world.entityManager.tickEntities(Z)),J8.startSpan({operation:"simulation_step"},()=>this._world.simulation.step(Z)),J8.startSpan({operation:"entities_emit_updates"},()=>this._world.entityManager.checkAndEmitUpdates()),J8.startSpan({operation:"network_synchronize"},()=>this._world.networkSynchronizer.synchronize()),J8.startSpan({operation:"release_tick_allocation"},()=>this._world.tickAllocator.reset())}),this._currentTick++,this.emitWithWorld(this._world,"WORLD_LOOP.TICK_END",{worldLoop:this,tickDurationMs:performance.now()-J})};_onTickError=(Z)=>{d.error(`WorldLoop._onTickError(): Error: ${Z}`),this.emitWithWorld(this._world,"WORLD_LOOP.TICK_ERROR",{worldLoop:this,error:Z})}}var oy;((V)=>{V.SET_AMBIENT_LIGHT_COLOR="WORLD.SET_AMBIENT_LIGHT_COLOR";V.SET_AMBIENT_LIGHT_INTENSITY="WORLD.SET_AMBIENT_LIGHT_INTENSITY";V.SET_DIRECTIONAL_LIGHT_COLOR="WORLD.SET_DIRECTIONAL_LIGHT_COLOR";V.SET_DIRECTIONAL_LIGHT_INTENSITY="WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY";V.SET_DIRECTIONAL_LIGHT_POSITION="WORLD.SET_DIRECTIONAL_LIGHT_POSITION";V.SET_FOG_COLOR="WORLD.SET_FOG_COLOR";V.SET_FOG_FAR="WORLD.SET_FOG_FAR";V.SET_FOG_NEAR="WORLD.SET_FOG_NEAR";V.SET_SKYBOX_INTENSITY="WORLD.SET_SKYBOX_INTENSITY";V.START="WORLD.START";V.STOP="WORLD.STOP"})(oy||={});class qF extends j0{_id;_ambientLightColor;_ambientLightIntensity;_audioManager;_blockTypeRegistry;_chatManager;_chunkLattice;_directionalLightColor;_directionalLightIntensity;_directionalLightPosition;_entityManager;_fogColor;_fogFar;_fogNear;_lightManager;_loop;_name;_networkSynchronizer;_particleEmitterManager;_sceneUIManager;_simulation;_skyboxIntensity;_skyboxUri;_tag;_tickAllocator;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._fogColor=Z.fogColor,this._fogFar=Z.fogFar??550,this._fogNear=Z.fogNear??500,this._name=Z.name,this._skyboxIntensity=Z.skyboxIntensity??1,this._skyboxUri=Z.skyboxUri,this._tag=Z.tag,this._audioManager=new u3(this),this._blockTypeRegistry=new Fz(this),this._chatManager=new cz(this),this._chunkLattice=new lz(this),this._entityManager=new az(this),this._lightManager=new QF(this),this._loop=new VF(this,Z.tickRate),this._networkSynchronizer=new gR(this),this._particleEmitterManager=new KF(this),this._sceneUIManager=new GF(this),this._simulation=new WF(this,Z.tickRate,Z.gravity),this._tickAllocator=new zF,Z.map)this.loadMap(Z.map)}get id(){return this._id}get ambientLightColor(){return this._ambientLightColor}get ambientLightIntensity(){return this._ambientLightIntensity}get blockTypeRegistry(){return this._blockTypeRegistry}get chatManager(){return this._chatManager}get chunkLattice(){return this._chunkLattice}get directionalLightColor(){return this._directionalLightColor}get directionalLightIntensity(){return this._directionalLightIntensity}get directionalLightPosition(){return this._directionalLightPosition}get entityManager(){return this._entityManager}get fogColor(){return this._fogColor}get fogFar(){return this._fogFar}get fogNear(){return this._fogNear}get lightManager(){return this._lightManager}get loop(){return this._loop}get name(){return this._name}get networkSynchronizer(){return this._networkSynchronizer}get particleEmitterManager(){return this._particleEmitterManager}get sceneUIManager(){return this._sceneUIManager}get simulation(){return this._simulation}get skyboxIntensity(){return this._skyboxIntensity}get skyboxUri(){return this._skyboxUri}get audioManager(){return this._audioManager}get tag(){return this._tag}get tickAllocator(){return this._tickAllocator}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({isEnvironmental:!0,...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})}setFogColor(Z){this._fogColor=Z,this.emit("WORLD.SET_FOG_COLOR",{world:this,color:Z})}setFogFar(Z){this._fogFar=Z,this.emit("WORLD.SET_FOG_FAR",{world:this,far:Z})}setFogNear(Z){this._fogNear=Z,this.emit("WORLD.SET_FOG_NEAR",{world:this,near:Z})}setSkyboxIntensity(Z){this._skyboxIntensity=Z,this.emit("WORLD.SET_SKYBOX_INTENSITY",{world:this,intensity:Z})}start(){if(this._loop.isStarted)return;this._loop.start(),this.emit("WORLD.START",{world:this,startedAtMs:Date.now()})}stop(){if(!this._loop.isStarted)return;this._loop.stop(),this.emit("WORLD.STOP",{world:this,stoppedAtMs:Date.now()})}serialize(){return D0.serializeWorld(this,this._tickAllocator)}}var p$1;((J)=>J.WORLD_CREATED="WORLD_MANAGER.WORLD_CREATED")(p$1||={});class HY{static instance=new HY;_defaultWorld;_nextWorldId=1;_worlds=new Map;createWorld(Z){let J=new qF({...Z,id:this._nextWorldId++});return J.start(),this._worlds.set(J.id,J),j0.globalInstance.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}}var i$1;((Y)=>{Y.PLAYER_CONNECTED="PLAYER_MANAGER.PLAYER_CONNECTED";Y.PLAYER_DISCONNECTED="PLAYER_MANAGER.PLAYER_DISCONNECTED";Y.PLAYER_RECONNECTED="PLAYER_MANAGER.PLAYER_RECONNECTED"})(i$1||={});class V9{static instance=new V9;worldSelectionHandler;_connectionPlayers=new Map;constructor(){j0.globalInstance.on("CONNECTION.OPENED",({connection:Z,req:J})=>{this._onConnectionOpened(Z,J.session)}),j0.globalInstance.on("CONNECTION.DISCONNECTED",({connection:Z})=>{this._onConnectionDisconnected(Z)}),j0.globalInstance.on("CONNECTION.RECONNECTED",({connection:Z})=>{this._onConnectionReconnected(Z)}),j0.globalInstance.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()})}async _onConnectionOpened(Z,J){let X=new lW(Z,J);await X.loadInitialPersistedData(),this._connectionPlayers.set(Z,X),j0.globalInstance.emit("PLAYER_MANAGER.PLAYER_CONNECTED",{player:X});let Y=await this.worldSelectionHandler?.(X);X.joinWorld(Y??HY.instance.getDefaultWorld())}_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.reconnected(),j0.globalInstance.emit("PLAYER_MANAGER.PLAYER_RECONNECTED",{player:J});else d.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),j0.globalInstance.emit("PLAYER_MANAGER.PLAYER_DISCONNECTED",{player:J});else d.warning(`PlayerManager._onConnectionClosed(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}}Buffer.poolSize=134217728;var n$1;((X)=>{X.START="GAMESERVER.START";X.STOP="GAMESERVER.STOP"})(n$1||={});function w46(Z){Q1.init().then(()=>{return AQ.instance.modelRegistry.preloadModels()}).then(()=>{if(Z.length>0)Z(AQ.instance.worldManager.getDefaultWorld());else Z();AQ.instance.start()}).catch((J)=>{d.fatalError(`Failed to initialize the game engine, exiting. Error: ${J}`)})}class AQ{static _instance;_modelRegistry=k5.instance;_playerManager=V9.instance;_socket=m7.instance;_worldManager=HY.instance;_webServer=PK.instance;constructor(){}static get instance(){if(!this._instance)this._instance=new AQ;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(){j0.globalInstance.emit("GAMESERVER.START",{startedAtMs:performance.now()}),this._webServer.start()}}var v0=0.000001,G1=typeof Float32Array!=="undefined"?Float32Array:Array,WZ=Math.random;var T55=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 l8={};D9(l8,{transpose:()=>N46,subtract:()=>s$1,sub:()=>g46,str:()=>v46,set:()=>R46,scale:()=>k46,rotate:()=>T46,multiplyScalarAndAdd:()=>b46,multiplyScalar:()=>f46,multiply:()=>a$1,mul:()=>y46,invert:()=>D46,identity:()=>j46,fromValues:()=>M46,fromScaling:()=>I46,fromRotation:()=>E46,frob:()=>S46,exactEquals:()=>A46,equals:()=>h46,determinant:()=>C46,create:()=>B46,copy:()=>O46,clone:()=>L46,adjoint:()=>P46,add:()=>x46,LDU:()=>_46});function B46(){var Z=new G1(4);if(G1!=Float32Array)Z[1]=0,Z[2]=0;return Z[0]=1,Z[3]=1,Z}function L46(Z){var J=new G1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function O46(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function j46(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=1,Z}function M46(Z,J,X,Y){var $=new G1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function R46(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function N46(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 D46(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X*Q-$*Y;if(!W)return null;return W=1/W,Z[0]=Q*W,Z[1]=-Y*W,Z[2]=-$*W,Z[3]=X*W,Z}function P46(Z,J){var X=J[0];return Z[0]=J[3],Z[1]=-J[1],Z[2]=-J[2],Z[3]=X,Z}function C46(Z){return Z[0]*Z[3]-Z[2]*Z[1]}function a$1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=X[0],G=X[1],z=X[2],H=X[3];return Z[0]=Y*K+Q*G,Z[1]=$*K+W*G,Z[2]=Y*z+Q*H,Z[3]=$*z+W*H,Z}function T46(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+Q*K,Z[1]=$*G+W*K,Z[2]=Y*-K+Q*G,Z[3]=$*-K+W*G,Z}function k46(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=X[0],G=X[1];return Z[0]=Y*K,Z[1]=$*K,Z[2]=Q*G,Z[3]=W*G,Z}function E46(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 I46(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=J[1],Z}function v46(Z){return"mat2("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}function S46(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3])}function _46(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 x46(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 s$1(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 A46(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function h46(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(X-W)<=v0*Math.max(1,Math.abs(X),Math.abs(W))&&Math.abs(Y-K)<=v0*Math.max(1,Math.abs(Y),Math.abs(K))&&Math.abs($-G)<=v0*Math.max(1,Math.abs($),Math.abs(G))&&Math.abs(Q-z)<=v0*Math.max(1,Math.abs(Q),Math.abs(z))}function f46(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 b46(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 y46=a$1,g46=s$1;var r1={};D9(r1,{transpose:()=>i46,translate:()=>o46,subtract:()=>r$1,sub:()=>U76,str:()=>W76,set:()=>l46,scale:()=>t46,rotate:()=>r46,projection:()=>Q76,normalFromMat4:()=>$76,multiplyScalarAndAdd:()=>H76,multiplyScalar:()=>z76,multiply:()=>o$1,mul:()=>F76,invert:()=>n46,identity:()=>p46,fromValues:()=>c46,fromTranslation:()=>e46,fromScaling:()=>J76,fromRotation:()=>Z76,fromQuat:()=>Y76,fromMat4:()=>m46,fromMat2d:()=>X76,frob:()=>K76,exactEquals:()=>V76,equals:()=>q76,determinant:()=>s46,create:()=>ry,copy:()=>d46,clone:()=>u46,adjoint:()=>a46,add:()=>G76});function ry(){var Z=new G1(9);if(G1!=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 m46(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 u46(Z){var J=new G1(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 d46(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 c46(Z,J,X,Y,$,Q,W,K,G){var z=new G1(9);return z[0]=Z,z[1]=J,z[2]=X,z[3]=Y,z[4]=$,z[5]=Q,z[6]=W,z[7]=K,z[8]=G,z}function l46(Z,J,X,Y,$,Q,W,K,G,z){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z[4]=Q,Z[5]=W,Z[6]=K,Z[7]=G,Z[8]=z,Z}function p46(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 i46(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 n46(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=H*W-K*z,q=-H*Q+K*G,F=z*Q-W*G,U=X*V+Y*q+$*F;if(!U)return null;return U=1/U,Z[0]=V*U,Z[1]=(-H*Y+$*z)*U,Z[2]=(K*Y-$*W)*U,Z[3]=q*U,Z[4]=(H*X-$*G)*U,Z[5]=(-K*X+$*Q)*U,Z[6]=F*U,Z[7]=(-z*X+Y*G)*U,Z[8]=(W*X-Y*Q)*U,Z}function a46(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=J[4],K=J[5],G=J[6],z=J[7],H=J[8];return Z[0]=W*H-K*z,Z[1]=$*z-Y*H,Z[2]=Y*K-$*W,Z[3]=K*G-Q*H,Z[4]=X*H-$*G,Z[5]=$*Q-X*K,Z[6]=Q*z-W*G,Z[7]=Y*G-X*z,Z[8]=X*W-Y*Q,Z}function s46(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],W=Z[5],K=Z[6],G=Z[7],z=Z[8];return J*(z*Q-W*G)+X*(-z*$+W*K)+Y*(G*$-Q*K)}function o$1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=X[0],F=X[1],U=X[2],B=X[3],w=X[4],O=X[5],N=X[6],R=X[7],j=X[8];return Z[0]=q*Y+F*W+U*z,Z[1]=q*$+F*K+U*H,Z[2]=q*Q+F*G+U*V,Z[3]=B*Y+w*W+O*z,Z[4]=B*$+w*K+O*H,Z[5]=B*Q+w*G+O*V,Z[6]=N*Y+R*W+j*z,Z[7]=N*$+R*K+j*H,Z[8]=N*Q+R*G+j*V,Z}function o46(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=X[0],F=X[1];return Z[0]=Y,Z[1]=$,Z[2]=Q,Z[3]=W,Z[4]=K,Z[5]=G,Z[6]=q*Y+F*W+z,Z[7]=q*$+F*K+H,Z[8]=q*Q+F*G+V,Z}function r46(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=Math.sin(X),F=Math.cos(X);return Z[0]=F*Y+q*W,Z[1]=F*$+q*K,Z[2]=F*Q+q*G,Z[3]=F*W-q*Y,Z[4]=F*K-q*$,Z[5]=F*G-q*Q,Z[6]=z,Z[7]=H,Z[8]=V,Z}function t46(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 e46(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 Z76(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 J76(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 X76(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 Y76(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X+X,K=Y+Y,G=$+$,z=X*W,H=Y*W,V=Y*K,q=$*W,F=$*K,U=$*G,B=Q*W,w=Q*K,O=Q*G;return Z[0]=1-V-U,Z[3]=H-O,Z[6]=q+w,Z[1]=H+O,Z[4]=1-z-U,Z[7]=F-B,Z[2]=q-w,Z[5]=F+B,Z[8]=1-z-V,Z}function $76(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],B=J[13],w=J[14],O=J[15],N=X*K-Y*W,R=X*G-$*W,j=X*z-Q*W,P=Y*G-$*K,D=Y*z-Q*K,C=$*z-Q*G,T=H*B-V*U,k=H*w-q*U,x=H*O-F*U,S=V*w-q*B,A=V*O-F*B,I=q*O-F*w,v=N*I-R*A+j*S+P*x-D*k+C*T;if(!v)return null;return v=1/v,Z[0]=(K*I-G*A+z*S)*v,Z[1]=(G*x-W*I-z*k)*v,Z[2]=(W*A-K*x+z*T)*v,Z[3]=($*A-Y*I-Q*S)*v,Z[4]=(X*I-$*x+Q*k)*v,Z[5]=(Y*x-X*A-Q*T)*v,Z[6]=(B*C-w*D+O*P)*v,Z[7]=(w*j-U*C-O*R)*v,Z[8]=(U*D-B*j+O*N)*v,Z}function Q76(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 W76(Z){return"mat3("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+")"}function K76(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8])}function G76(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 r$1(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 z76(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 H76(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 V76(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 q76(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=Z[4],K=Z[5],G=Z[6],z=Z[7],H=Z[8],V=J[0],q=J[1],F=J[2],U=J[3],B=J[4],w=J[5],O=J[6],N=J[7],R=J[8];return Math.abs(X-V)<=v0*Math.max(1,Math.abs(X),Math.abs(V))&&Math.abs(Y-q)<=v0*Math.max(1,Math.abs(Y),Math.abs(q))&&Math.abs($-F)<=v0*Math.max(1,Math.abs($),Math.abs(F))&&Math.abs(Q-U)<=v0*Math.max(1,Math.abs(Q),Math.abs(U))&&Math.abs(W-B)<=v0*Math.max(1,Math.abs(W),Math.abs(B))&&Math.abs(K-w)<=v0*Math.max(1,Math.abs(K),Math.abs(w))&&Math.abs(G-O)<=v0*Math.max(1,Math.abs(G),Math.abs(O))&&Math.abs(z-N)<=v0*Math.max(1,Math.abs(z),Math.abs(N))&&Math.abs(H-R)<=v0*Math.max(1,Math.abs(H),Math.abs(R))}var F76=o$1,U76=r$1;var e0={};D9(e0,{transpose:()=>M76,translate:()=>P76,targetTo:()=>s76,subtract:()=>$Q1,sub:()=>$Z6,str:()=>o76,set:()=>j76,scale:()=>C76,rotateZ:()=>I76,rotateY:()=>E76,rotateX:()=>k76,rotate:()=>T76,perspectiveZO:()=>l76,perspectiveNO:()=>XQ1,perspectiveFromFieldOfView:()=>p76,perspective:()=>c76,orthoZO:()=>n76,orthoNO:()=>YQ1,ortho:()=>i76,multiplyScalarAndAdd:()=>ZZ6,multiplyScalar:()=>e76,multiply:()=>e$1,mul:()=>YZ6,lookAt:()=>a76,invert:()=>R76,identity:()=>t$1,getTranslation:()=>b76,getScaling:()=>JQ1,getRotation:()=>y76,frustum:()=>d76,fromZRotation:()=>h76,fromYRotation:()=>A76,fromXRotation:()=>x76,fromValues:()=>O76,fromTranslation:()=>v76,fromScaling:()=>S76,fromRotationTranslationScaleOrigin:()=>m76,fromRotationTranslationScale:()=>g76,fromRotationTranslation:()=>ZQ1,fromRotation:()=>_76,fromQuat2:()=>f76,fromQuat:()=>u76,frob:()=>r76,exactEquals:()=>JZ6,equals:()=>XZ6,determinant:()=>D76,create:()=>w76,copy:()=>L76,clone:()=>B76,adjoint:()=>N76,add:()=>t76});function w76(){var Z=new G1(16);if(G1!=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 B76(Z){var J=new G1(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 L76(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 O76(Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B){var w=new G1(16);return w[0]=Z,w[1]=J,w[2]=X,w[3]=Y,w[4]=$,w[5]=Q,w[6]=W,w[7]=K,w[8]=G,w[9]=z,w[10]=H,w[11]=V,w[12]=q,w[13]=F,w[14]=U,w[15]=B,w}function j76(Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B,w){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z[4]=Q,Z[5]=W,Z[6]=K,Z[7]=G,Z[8]=z,Z[9]=H,Z[10]=V,Z[11]=q,Z[12]=F,Z[13]=U,Z[14]=B,Z[15]=w,Z}function t$1(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=1,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=1,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function M76(Z,J){if(Z===J){var X=J[1],Y=J[2],$=J[3],Q=J[6],W=J[7],K=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]=W,Z[14]=K}else Z[0]=J[0],Z[1]=J[4],Z[2]=J[8],Z[3]=J[12],Z[4]=J[1],Z[5]=J[5],Z[6]=J[9],Z[7]=J[13],Z[8]=J[2],Z[9]=J[6],Z[10]=J[10],Z[11]=J[14],Z[12]=J[3],Z[13]=J[7],Z[14]=J[11],Z[15]=J[15];return Z}function R76(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],B=J[13],w=J[14],O=J[15],N=X*K-Y*W,R=X*G-$*W,j=X*z-Q*W,P=Y*G-$*K,D=Y*z-Q*K,C=$*z-Q*G,T=H*B-V*U,k=H*w-q*U,x=H*O-F*U,S=V*w-q*B,A=V*O-F*B,I=q*O-F*w,v=N*I-R*A+j*S+P*x-D*k+C*T;if(!v)return null;return v=1/v,Z[0]=(K*I-G*A+z*S)*v,Z[1]=($*A-Y*I-Q*S)*v,Z[2]=(B*C-w*D+O*P)*v,Z[3]=(q*D-V*C-F*P)*v,Z[4]=(G*x-W*I-z*k)*v,Z[5]=(X*I-$*x+Q*k)*v,Z[6]=(w*j-U*C-O*R)*v,Z[7]=(H*C-q*j+F*R)*v,Z[8]=(W*A-K*x+z*T)*v,Z[9]=(Y*x-X*A-Q*T)*v,Z[10]=(U*D-B*j+O*N)*v,Z[11]=(V*j-H*D-F*N)*v,Z[12]=(K*k-W*S-G*T)*v,Z[13]=(X*S-Y*k+$*T)*v,Z[14]=(B*R-U*P-w*N)*v,Z[15]=(H*P-V*R+q*N)*v,Z}function N76(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],B=J[13],w=J[14],O=J[15];return Z[0]=K*(q*O-F*w)-V*(G*O-z*w)+B*(G*F-z*q),Z[1]=-(Y*(q*O-F*w)-V*($*O-Q*w)+B*($*F-Q*q)),Z[2]=Y*(G*O-z*w)-K*($*O-Q*w)+B*($*z-Q*G),Z[3]=-(Y*(G*F-z*q)-K*($*F-Q*q)+V*($*z-Q*G)),Z[4]=-(W*(q*O-F*w)-H*(G*O-z*w)+U*(G*F-z*q)),Z[5]=X*(q*O-F*w)-H*($*O-Q*w)+U*($*F-Q*q),Z[6]=-(X*(G*O-z*w)-W*($*O-Q*w)+U*($*z-Q*G)),Z[7]=X*(G*F-z*q)-W*($*F-Q*q)+H*($*z-Q*G),Z[8]=W*(V*O-F*B)-H*(K*O-z*B)+U*(K*F-z*V),Z[9]=-(X*(V*O-F*B)-H*(Y*O-Q*B)+U*(Y*F-Q*V)),Z[10]=X*(K*O-z*B)-W*(Y*O-Q*B)+U*(Y*z-Q*K),Z[11]=-(X*(K*F-z*V)-W*(Y*F-Q*V)+H*(Y*z-Q*K)),Z[12]=-(W*(V*w-q*B)-H*(K*w-G*B)+U*(K*q-G*V)),Z[13]=X*(V*w-q*B)-H*(Y*w-$*B)+U*(Y*q-$*V),Z[14]=-(X*(K*w-G*B)-W*(Y*w-$*B)+U*(Y*G-$*K)),Z[15]=X*(K*q-G*V)-W*(Y*q-$*V)+H*(Y*G-$*K),Z}function D76(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],W=Z[5],K=Z[6],G=Z[7],z=Z[8],H=Z[9],V=Z[10],q=Z[11],F=Z[12],U=Z[13],B=Z[14],w=Z[15],O=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,j=X*K-Y*W,P=X*G-$*W,D=Y*G-$*K,C=z*U-H*F,T=z*B-V*F,k=z*w-q*F,x=H*B-V*U,S=H*w-q*U,A=V*w-q*B;return O*A-N*S+R*x+j*k-P*T+D*C}function e$1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=J[9],F=J[10],U=J[11],B=J[12],w=J[13],O=J[14],N=J[15],R=X[0],j=X[1],P=X[2],D=X[3];return Z[0]=R*Y+j*K+P*V+D*B,Z[1]=R*$+j*G+P*q+D*w,Z[2]=R*Q+j*z+P*F+D*O,Z[3]=R*W+j*H+P*U+D*N,R=X[4],j=X[5],P=X[6],D=X[7],Z[4]=R*Y+j*K+P*V+D*B,Z[5]=R*$+j*G+P*q+D*w,Z[6]=R*Q+j*z+P*F+D*O,Z[7]=R*W+j*H+P*U+D*N,R=X[8],j=X[9],P=X[10],D=X[11],Z[8]=R*Y+j*K+P*V+D*B,Z[9]=R*$+j*G+P*q+D*w,Z[10]=R*Q+j*z+P*F+D*O,Z[11]=R*W+j*H+P*U+D*N,R=X[12],j=X[13],P=X[14],D=X[15],Z[12]=R*Y+j*K+P*V+D*B,Z[13]=R*$+j*G+P*q+D*w,Z[14]=R*Q+j*z+P*F+D*O,Z[15]=R*W+j*H+P*U+D*N,Z}function P76(Z,J,X){var Y=X[0],$=X[1],Q=X[2],W,K,G,z,H,V,q,F,U,B,w,O;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 W=J[0],K=J[1],G=J[2],z=J[3],H=J[4],V=J[5],q=J[6],F=J[7],U=J[8],B=J[9],w=J[10],O=J[11],Z[0]=W,Z[1]=K,Z[2]=G,Z[3]=z,Z[4]=H,Z[5]=V,Z[6]=q,Z[7]=F,Z[8]=U,Z[9]=B,Z[10]=w,Z[11]=O,Z[12]=W*Y+H*$+U*Q+J[12],Z[13]=K*Y+V*$+B*Q+J[13],Z[14]=G*Y+q*$+w*Q+J[14],Z[15]=z*Y+F*$+O*Q+J[15];return Z}function C76(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 T76(Z,J,X,Y){var $=Y[0],Q=Y[1],W=Y[2],K=Math.hypot($,Q,W),G,z,H,V,q,F,U,B,w,O,N,R,j,P,D,C,T,k,x,S,A,I,v,b;if(K<v0)return null;if(K=1/K,$*=K,Q*=K,W*=K,G=Math.sin(X),z=Math.cos(X),H=1-z,V=J[0],q=J[1],F=J[2],U=J[3],B=J[4],w=J[5],O=J[6],N=J[7],R=J[8],j=J[9],P=J[10],D=J[11],C=$*$*H+z,T=Q*$*H+W*G,k=W*$*H-Q*G,x=$*Q*H-W*G,S=Q*Q*H+z,A=W*Q*H+$*G,I=$*W*H+Q*G,v=Q*W*H-$*G,b=W*W*H+z,Z[0]=V*C+B*T+R*k,Z[1]=q*C+w*T+j*k,Z[2]=F*C+O*T+P*k,Z[3]=U*C+N*T+D*k,Z[4]=V*x+B*S+R*A,Z[5]=q*x+w*S+j*A,Z[6]=F*x+O*S+P*A,Z[7]=U*x+N*S+D*A,Z[8]=V*I+B*v+R*b,Z[9]=q*I+w*v+j*b,Z[10]=F*I+O*v+P*b,Z[11]=U*I+N*v+D*b,J!==Z)Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z}function k76(Z,J,X){var Y=Math.sin(X),$=Math.cos(X),Q=J[4],W=J[5],K=J[6],G=J[7],z=J[8],H=J[9],V=J[10],q=J[11];if(J!==Z)Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[4]=Q*$+z*Y,Z[5]=W*$+H*Y,Z[6]=K*$+V*Y,Z[7]=G*$+q*Y,Z[8]=z*$-Q*Y,Z[9]=H*$-W*Y,Z[10]=V*$-K*Y,Z[11]=q*$-G*Y,Z}function E76(Z,J,X){var Y=Math.sin(X),$=Math.cos(X),Q=J[0],W=J[1],K=J[2],G=J[3],z=J[8],H=J[9],V=J[10],q=J[11];if(J!==Z)Z[4]=J[4],Z[5]=J[5],Z[6]=J[6],Z[7]=J[7],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[0]=Q*$-z*Y,Z[1]=W*$-H*Y,Z[2]=K*$-V*Y,Z[3]=G*$-q*Y,Z[8]=Q*Y+z*$,Z[9]=W*Y+H*$,Z[10]=K*Y+V*$,Z[11]=G*Y+q*$,Z}function I76(Z,J,X){var Y=Math.sin(X),$=Math.cos(X),Q=J[0],W=J[1],K=J[2],G=J[3],z=J[4],H=J[5],V=J[6],q=J[7];if(J!==Z)Z[8]=J[8],Z[9]=J[9],Z[10]=J[10],Z[11]=J[11],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[0]=Q*$+z*Y,Z[1]=W*$+H*Y,Z[2]=K*$+V*Y,Z[3]=G*$+q*Y,Z[4]=z*$-Q*Y,Z[5]=H*$-W*Y,Z[6]=V*$-K*Y,Z[7]=q*$-G*Y,Z}function v76(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 S76(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 _76(Z,J,X){var Y=X[0],$=X[1],Q=X[2],W=Math.hypot(Y,$,Q),K,G,z;if(W<v0)return null;return W=1/W,Y*=W,$*=W,Q*=W,K=Math.sin(J),G=Math.cos(J),z=1-G,Z[0]=Y*Y*z+G,Z[1]=$*Y*z+Q*K,Z[2]=Q*Y*z-$*K,Z[3]=0,Z[4]=Y*$*z-Q*K,Z[5]=$*$*z+G,Z[6]=Q*$*z+Y*K,Z[7]=0,Z[8]=Y*Q*z+$*K,Z[9]=$*Q*z-Y*K,Z[10]=Q*Q*z+G,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function x76(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 A76(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 h76(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 ZQ1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Y+Y,G=$+$,z=Q+Q,H=Y*K,V=Y*G,q=Y*z,F=$*G,U=$*z,B=Q*z,w=W*K,O=W*G,N=W*z;return Z[0]=1-(F+B),Z[1]=V+N,Z[2]=q-O,Z[3]=0,Z[4]=V-N,Z[5]=1-(H+B),Z[6]=U+w,Z[7]=0,Z[8]=q+O,Z[9]=U-w,Z[10]=1-(H+F),Z[11]=0,Z[12]=X[0],Z[13]=X[1],Z[14]=X[2],Z[15]=1,Z}function f76(Z,J){var X=new G1(3),Y=-J[0],$=-J[1],Q=-J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=Y*Y+$*$+Q*Q+W*W;if(V>0)X[0]=(K*W+H*Y+G*Q-z*$)*2/V,X[1]=(G*W+H*$+z*Y-K*Q)*2/V,X[2]=(z*W+H*Q+K*$-G*Y)*2/V;else X[0]=(K*W+H*Y+G*Q-z*$)*2,X[1]=(G*W+H*$+z*Y-K*Q)*2,X[2]=(z*W+H*Q+K*$-G*Y)*2;return ZQ1(Z,J,X),Z}function b76(Z,J){return Z[0]=J[12],Z[1]=J[13],Z[2]=J[14],Z}function JQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[4],W=J[5],K=J[6],G=J[8],z=J[9],H=J[10];return Z[0]=Math.hypot(X,Y,$),Z[1]=Math.hypot(Q,W,K),Z[2]=Math.hypot(G,z,H),Z}function y76(Z,J){var X=new G1(3);JQ1(X,J);var Y=1/X[0],$=1/X[1],Q=1/X[2],W=J[0]*Y,K=J[1]*$,G=J[2]*Q,z=J[4]*Y,H=J[5]*$,V=J[6]*Q,q=J[8]*Y,F=J[9]*$,U=J[10]*Q,B=W+H+U,w=0;if(B>0)w=Math.sqrt(B+1)*2,Z[3]=0.25*w,Z[0]=(V-F)/w,Z[1]=(q-G)/w,Z[2]=(K-z)/w;else if(W>H&&W>U)w=Math.sqrt(1+W-H-U)*2,Z[3]=(V-F)/w,Z[0]=0.25*w,Z[1]=(K+z)/w,Z[2]=(q+G)/w;else if(H>U)w=Math.sqrt(1+H-W-U)*2,Z[3]=(q-G)/w,Z[0]=(K+z)/w,Z[1]=0.25*w,Z[2]=(V+F)/w;else w=Math.sqrt(1+U-W-H)*2,Z[3]=(K-z)/w,Z[0]=(q+G)/w,Z[1]=(V+F)/w,Z[2]=0.25*w;return Z}function g76(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2],K=J[3],G=$+$,z=Q+Q,H=W+W,V=$*G,q=$*z,F=$*H,U=Q*z,B=Q*H,w=W*H,O=K*G,N=K*z,R=K*H,j=Y[0],P=Y[1],D=Y[2];return Z[0]=(1-(U+w))*j,Z[1]=(q+R)*j,Z[2]=(F-N)*j,Z[3]=0,Z[4]=(q-R)*P,Z[5]=(1-(V+w))*P,Z[6]=(B+O)*P,Z[7]=0,Z[8]=(F+N)*D,Z[9]=(B-O)*D,Z[10]=(1-(V+U))*D,Z[11]=0,Z[12]=X[0],Z[13]=X[1],Z[14]=X[2],Z[15]=1,Z}function m76(Z,J,X,Y,$){var Q=J[0],W=J[1],K=J[2],G=J[3],z=Q+Q,H=W+W,V=K+K,q=Q*z,F=Q*H,U=Q*V,B=W*H,w=W*V,O=K*V,N=G*z,R=G*H,j=G*V,P=Y[0],D=Y[1],C=Y[2],T=$[0],k=$[1],x=$[2],S=(1-(B+O))*P,A=(F+j)*P,I=(U-R)*P,v=(F-j)*D,b=(1-(q+O))*D,m=(w+N)*D,n=(U+R)*C,o=(w-N)*C,Q0=(1-(q+B))*C;return Z[0]=S,Z[1]=A,Z[2]=I,Z[3]=0,Z[4]=v,Z[5]=b,Z[6]=m,Z[7]=0,Z[8]=n,Z[9]=o,Z[10]=Q0,Z[11]=0,Z[12]=X[0]+T-(S*T+v*k+n*x),Z[13]=X[1]+k-(A*T+b*k+o*x),Z[14]=X[2]+x-(I*T+m*k+Q0*x),Z[15]=1,Z}function u76(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X+X,K=Y+Y,G=$+$,z=X*W,H=Y*W,V=Y*K,q=$*W,F=$*K,U=$*G,B=Q*W,w=Q*K,O=Q*G;return Z[0]=1-V-U,Z[1]=H+O,Z[2]=q-w,Z[3]=0,Z[4]=H-O,Z[5]=1-z-U,Z[6]=F+B,Z[7]=0,Z[8]=q+w,Z[9]=F-B,Z[10]=1-z-V,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function d76(Z,J,X,Y,$,Q,W){var K=1/(X-J),G=1/($-Y),z=1/(Q-W);return Z[0]=Q*2*K,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=Q*2*G,Z[6]=0,Z[7]=0,Z[8]=(X+J)*K,Z[9]=($+Y)*G,Z[10]=(W+Q)*z,Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=W*Q*2*z,Z[15]=0,Z}function XQ1(Z,J,X,Y,$){var Q=1/Math.tan(J/2),W;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)W=1/(Y-$),Z[10]=($+Y)*W,Z[14]=2*$*Y*W;else Z[10]=-1,Z[14]=-2*Y;return Z}var c76=XQ1;function l76(Z,J,X,Y,$){var Q=1/Math.tan(J/2),W;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)W=1/(Y-$),Z[10]=$*W,Z[14]=$*Y*W;else Z[10]=-1,Z[14]=-Y;return Z}function p76(Z,J,X,Y){var $=Math.tan(J.upDegrees*Math.PI/180),Q=Math.tan(J.downDegrees*Math.PI/180),W=Math.tan(J.leftDegrees*Math.PI/180),K=Math.tan(J.rightDegrees*Math.PI/180),G=2/(W+K),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]=-((W-K)*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 YQ1(Z,J,X,Y,$,Q,W){var K=1/(J-X),G=1/(Y-$),z=1/(Q-W);return Z[0]=-2*K,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=-2*G,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=2*z,Z[11]=0,Z[12]=(J+X)*K,Z[13]=($+Y)*G,Z[14]=(W+Q)*z,Z[15]=1,Z}var i76=YQ1;function n76(Z,J,X,Y,$,Q,W){var K=1/(J-X),G=1/(Y-$),z=1/(Q-W);return Z[0]=-2*K,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=-2*G,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=z,Z[11]=0,Z[12]=(J+X)*K,Z[13]=($+Y)*G,Z[14]=Q*z,Z[15]=1,Z}function a76(Z,J,X,Y){var $,Q,W,K,G,z,H,V,q,F,U=J[0],B=J[1],w=J[2],O=Y[0],N=Y[1],R=Y[2],j=X[0],P=X[1],D=X[2];if(Math.abs(U-j)<v0&&Math.abs(B-P)<v0&&Math.abs(w-D)<v0)return t$1(Z);if(H=U-j,V=B-P,q=w-D,F=1/Math.hypot(H,V,q),H*=F,V*=F,q*=F,$=N*q-R*V,Q=R*H-O*q,W=O*V-N*H,F=Math.hypot($,Q,W),!F)$=0,Q=0,W=0;else F=1/F,$*=F,Q*=F,W*=F;if(K=V*W-q*Q,G=q*$-H*W,z=H*Q-V*$,F=Math.hypot(K,G,z),!F)K=0,G=0,z=0;else F=1/F,K*=F,G*=F,z*=F;return Z[0]=$,Z[1]=K,Z[2]=H,Z[3]=0,Z[4]=Q,Z[5]=G,Z[6]=V,Z[7]=0,Z[8]=W,Z[9]=z,Z[10]=q,Z[11]=0,Z[12]=-($*U+Q*B+W*w),Z[13]=-(K*U+G*B+z*w),Z[14]=-(H*U+V*B+q*w),Z[15]=1,Z}function s76(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2],K=Y[0],G=Y[1],z=Y[2],H=$-X[0],V=Q-X[1],q=W-X[2],F=H*H+V*V+q*q;if(F>0)F=1/Math.sqrt(F),H*=F,V*=F,q*=F;var U=G*q-z*V,B=z*H-K*q,w=K*V-G*H;if(F=U*U+B*B+w*w,F>0)F=1/Math.sqrt(F),U*=F,B*=F,w*=F;return Z[0]=U,Z[1]=B,Z[2]=w,Z[3]=0,Z[4]=V*w-q*B,Z[5]=q*U-H*w,Z[6]=H*B-V*U,Z[7]=0,Z[8]=H,Z[9]=V,Z[10]=q,Z[11]=0,Z[12]=$,Z[13]=Q,Z[14]=W,Z[15]=1,Z}function o76(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 r76(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 t76(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 $Q1(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 e76(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 ZZ6(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 JZ6(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 XZ6(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=Z[4],K=Z[5],G=Z[6],z=Z[7],H=Z[8],V=Z[9],q=Z[10],F=Z[11],U=Z[12],B=Z[13],w=Z[14],O=Z[15],N=J[0],R=J[1],j=J[2],P=J[3],D=J[4],C=J[5],T=J[6],k=J[7],x=J[8],S=J[9],A=J[10],I=J[11],v=J[12],b=J[13],m=J[14],n=J[15];return Math.abs(X-N)<=v0*Math.max(1,Math.abs(X),Math.abs(N))&&Math.abs(Y-R)<=v0*Math.max(1,Math.abs(Y),Math.abs(R))&&Math.abs($-j)<=v0*Math.max(1,Math.abs($),Math.abs(j))&&Math.abs(Q-P)<=v0*Math.max(1,Math.abs(Q),Math.abs(P))&&Math.abs(W-D)<=v0*Math.max(1,Math.abs(W),Math.abs(D))&&Math.abs(K-C)<=v0*Math.max(1,Math.abs(K),Math.abs(C))&&Math.abs(G-T)<=v0*Math.max(1,Math.abs(G),Math.abs(T))&&Math.abs(z-k)<=v0*Math.max(1,Math.abs(z),Math.abs(k))&&Math.abs(H-x)<=v0*Math.max(1,Math.abs(H),Math.abs(x))&&Math.abs(V-S)<=v0*Math.max(1,Math.abs(V),Math.abs(S))&&Math.abs(q-A)<=v0*Math.max(1,Math.abs(q),Math.abs(A))&&Math.abs(F-I)<=v0*Math.max(1,Math.abs(F),Math.abs(I))&&Math.abs(U-v)<=v0*Math.max(1,Math.abs(U),Math.abs(v))&&Math.abs(B-b)<=v0*Math.max(1,Math.abs(B),Math.abs(b))&&Math.abs(w-m)<=v0*Math.max(1,Math.abs(w),Math.abs(m))&&Math.abs(O-n)<=v0*Math.max(1,Math.abs(O),Math.abs(n))}var YZ6=e$1,$Z6=$Q1;var P1={};D9(P1,{str:()=>ZJ6,squaredLength:()=>xQ1,sqrLen:()=>zJ6,sqlerp:()=>FJ6,slerp:()=>cR,setAxisAngle:()=>CQ1,setAxes:()=>UJ6,set:()=>$J6,scale:()=>vQ1,rotationTo:()=>qJ6,rotateZ:()=>nZ6,rotateY:()=>iZ6,rotateX:()=>pZ6,random:()=>oZ6,pow:()=>sZ6,normalize:()=>Jg,multiply:()=>TQ1,mul:()=>WJ6,ln:()=>EQ1,lerp:()=>KJ6,length:()=>_Q1,len:()=>GJ6,invert:()=>rZ6,identity:()=>dZ6,getAxisAngle:()=>cZ6,getAngle:()=>lZ6,fromValues:()=>XJ6,fromMat3:()=>IQ1,fromEuler:()=>eZ6,exp:()=>kQ1,exactEquals:()=>HJ6,equals:()=>VJ6,dot:()=>SQ1,create:()=>Zg,copy:()=>YJ6,conjugate:()=>tZ6,clone:()=>JJ6,calculateW:()=>aZ6,add:()=>QJ6});var J1={};D9(J1,{zero:()=>IZ6,transformQuat:()=>PZ6,transformMat4:()=>NZ6,transformMat3:()=>DZ6,subtract:()=>WQ1,sub:()=>xZ6,str:()=>vZ6,squaredLength:()=>VQ1,squaredDistance:()=>HQ1,sqrLen:()=>yZ6,sqrDist:()=>bZ6,set:()=>KZ6,scaleAndAdd:()=>wZ6,scale:()=>UZ6,round:()=>FZ6,rotateZ:()=>kZ6,rotateY:()=>TZ6,rotateX:()=>CZ6,random:()=>RZ6,normalize:()=>ty,negate:()=>BZ6,multiply:()=>KQ1,mul:()=>AZ6,min:()=>VZ6,max:()=>qZ6,lerp:()=>OZ6,length:()=>QQ1,len:()=>ey,inverse:()=>LZ6,hermite:()=>jZ6,fromValues:()=>uR,forEach:()=>gZ6,floor:()=>HZ6,exactEquals:()=>SZ6,equals:()=>_Z6,dot:()=>dR,divide:()=>GQ1,div:()=>hZ6,distance:()=>zQ1,dist:()=>fZ6,cross:()=>FF,create:()=>mR,copy:()=>WZ6,clone:()=>QZ6,ceil:()=>zZ6,bezier:()=>MZ6,angle:()=>EZ6,add:()=>GZ6});function mR(){var Z=new G1(3);if(G1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function QZ6(Z){var J=new G1(3);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J}function QQ1(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function uR(Z,J,X){var Y=new G1(3);return Y[0]=Z,Y[1]=J,Y[2]=X,Y}function WZ6(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z}function KZ6(Z,J,X,Y){return Z[0]=J,Z[1]=X,Z[2]=Y,Z}function GZ6(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z}function WQ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z}function KQ1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z}function GQ1(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z[2]=J[2]/X[2],Z}function zZ6(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z[2]=Math.ceil(J[2]),Z}function HZ6(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z[2]=Math.floor(J[2]),Z}function VZ6(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 qZ6(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 FZ6(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z[2]=Math.round(J[2]),Z}function UZ6(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z}function wZ6(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 zQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return Math.hypot(X,Y,$)}function HQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return X*X+Y*Y+$*$}function VQ1(Z){var J=Z[0],X=Z[1],Y=Z[2];return J*J+X*X+Y*Y}function BZ6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z}function LZ6(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z[2]=1/J[2],Z}function ty(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 dR(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]}function FF(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=X[0],K=X[1],G=X[2];return Z[0]=$*G-Q*K,Z[1]=Q*W-Y*G,Z[2]=Y*K-$*W,Z}function OZ6(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z[2]=W+Y*(X[2]-W),Z}function jZ6(Z,J,X,Y,$,Q){var W=Q*Q,K=W*(2*Q-3)+1,G=W*(Q-2)+Q,z=W*(Q-1),H=W*(3-2*Q);return Z[0]=J[0]*K+X[0]*G+Y[0]*z+$[0]*H,Z[1]=J[1]*K+X[1]*G+Y[1]*z+$[1]*H,Z[2]=J[2]*K+X[2]*G+Y[2]*z+$[2]*H,Z}function MZ6(Z,J,X,Y,$,Q){var W=1-Q,K=W*W,G=Q*Q,z=K*W,H=3*Q*K,V=3*G*W,q=G*Q;return Z[0]=J[0]*z+X[0]*H+Y[0]*V+$[0]*q,Z[1]=J[1]*z+X[1]*H+Y[1]*V+$[1]*q,Z[2]=J[2]*z+X[2]*H+Y[2]*V+$[2]*q,Z}function RZ6(Z,J){J=J||1;var X=WZ()*2*Math.PI,Y=WZ()*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 NZ6(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=X[3]*Y+X[7]*$+X[11]*Q+X[15];return W=W||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/W,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/W,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/W,Z}function DZ6(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 PZ6(Z,J,X){var Y=X[0],$=X[1],Q=X[2],W=X[3],K=J[0],G=J[1],z=J[2],H=$*z-Q*G,V=Q*K-Y*z,q=Y*G-$*K,F=$*q-Q*V,U=Q*H-Y*q,B=Y*V-$*H,w=W*2;return H*=w,V*=w,q*=w,F*=2,U*=2,B*=2,Z[0]=K+H+F,Z[1]=G+V+U,Z[2]=z+q+B,Z}function CZ6(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 TZ6(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 kZ6(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 EZ6(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=J[0],W=J[1],K=J[2],G=Math.sqrt(X*X+Y*Y+$*$),z=Math.sqrt(Q*Q+W*W+K*K),H=G*z,V=H&&dR(Z,J)/H;return Math.acos(Math.min(Math.max(V,-1),1))}function IZ6(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z}function vZ6(Z){return"vec3("+Z[0]+", "+Z[1]+", "+Z[2]+")"}function SZ6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]}function _Z6(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=J[0],W=J[1],K=J[2];return Math.abs(X-Q)<=v0*Math.max(1,Math.abs(X),Math.abs(Q))&&Math.abs(Y-W)<=v0*Math.max(1,Math.abs(Y),Math.abs(W))&&Math.abs($-K)<=v0*Math.max(1,Math.abs($),Math.abs(K))}var xZ6=WQ1,AZ6=KQ1,hZ6=GQ1,fZ6=zQ1,bZ6=HQ1,ey=QQ1,yZ6=VQ1,gZ6=function(){var Z=mR();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}}();function mZ6(){var Z=new G1(4);if(G1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function qQ1(Z){var J=new G1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function FQ1(Z,J,X,Y){var $=new G1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function UQ1(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function wQ1(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function BQ1(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 LQ1(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 OQ1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return Math.hypot(J,X,Y,$)}function jQ1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return J*J+X*X+Y*Y+$*$}function MQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X*X+Y*Y+$*$+Q*Q;if(W>0)W=1/Math.sqrt(W);return Z[0]=X*W,Z[1]=Y*W,Z[2]=$*W,Z[3]=Q*W,Z}function RQ1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}function NQ1(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2],K=J[3];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z[2]=W+Y*(X[2]-W),Z[3]=K+Y*(X[3]-K),Z}function DQ1(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function PQ1(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(X-W)<=v0*Math.max(1,Math.abs(X),Math.abs(W))&&Math.abs(Y-K)<=v0*Math.max(1,Math.abs(Y),Math.abs(K))&&Math.abs($-G)<=v0*Math.max(1,Math.abs($),Math.abs(G))&&Math.abs(Q-z)<=v0*Math.max(1,Math.abs(Q),Math.abs(z))}var k55=function(){var Z=mZ6();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=4;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Z[3]=J[K+3],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2],J[K+3]=Z[3];return J}}();function Zg(){var Z=new G1(4);if(G1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z[3]=1,Z}function dZ6(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=1,Z}function CQ1(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 cZ6(Z,J){var X=Math.acos(J[3])*2,Y=Math.sin(X/2);if(Y>v0)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 lZ6(Z,J){var X=SQ1(Z,J);return Math.acos(2*X*X-1)}function TQ1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=X[0],G=X[1],z=X[2],H=X[3];return Z[0]=Y*H+W*K+$*z-Q*G,Z[1]=$*H+W*G+Q*K-Y*z,Z[2]=Q*H+W*z+Y*G-$*K,Z[3]=W*H-Y*K-$*G-Q*z,Z}function pZ6(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+W*K,Z[1]=$*G+Q*K,Z[2]=Q*G-$*K,Z[3]=W*G-Y*K,Z}function iZ6(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G-Q*K,Z[1]=$*G+W*K,Z[2]=Q*G+Y*K,Z[3]=W*G-$*K,Z}function nZ6(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+$*K,Z[1]=$*G-Y*K,Z[2]=Q*G+W*K,Z[3]=W*G-Q*K,Z}function aZ6(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 kQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=Math.sqrt(X*X+Y*Y+$*$),K=Math.exp(Q),G=W>0?K*Math.sin(W)/W:0;return Z[0]=X*G,Z[1]=Y*G,Z[2]=$*G,Z[3]=K*Math.cos(W),Z}function EQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=Math.sqrt(X*X+Y*Y+$*$),K=W>0?Math.atan2(W,Q)/W:0;return Z[0]=X*K,Z[1]=Y*K,Z[2]=$*K,Z[3]=0.5*Math.log(X*X+Y*Y+$*$+Q*Q),Z}function sZ6(Z,J,X){return EQ1(Z,J),vQ1(Z,Z,X),kQ1(Z,Z),Z}function cR(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2],K=J[3],G=X[0],z=X[1],H=X[2],V=X[3],q,F,U,B,w;if(F=$*G+Q*z+W*H+K*V,F<0)F=-F,G=-G,z=-z,H=-H,V=-V;if(1-F>v0)q=Math.acos(F),U=Math.sin(q),B=Math.sin((1-Y)*q)/U,w=Math.sin(Y*q)/U;else B=1-Y,w=Y;return Z[0]=B*$+w*G,Z[1]=B*Q+w*z,Z[2]=B*W+w*H,Z[3]=B*K+w*V,Z}function oZ6(Z){var J=WZ(),X=WZ(),Y=WZ(),$=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 rZ6(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X*X+Y*Y+$*$+Q*Q,K=W?1/W:0;return Z[0]=-X*K,Z[1]=-Y*K,Z[2]=-$*K,Z[3]=Q*K,Z}function tZ6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z[3]=J[3],Z}function IQ1(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,W=($+2)%3;Y=Math.sqrt(J[$*3+$]-J[Q*3+Q]-J[W*3+W]+1),Z[$]=0.5*Y,Y=0.5/Y,Z[3]=(J[Q*3+W]-J[W*3+Q])*Y,Z[Q]=(J[Q*3+$]+J[$*3+Q])*Y,Z[W]=(J[W*3+$]+J[$*3+W])*Y}return Z}function eZ6(Z,J,X,Y){var $=0.5*Math.PI/180;J*=$,X*=$,Y*=$;var Q=Math.sin(J),W=Math.cos(J),K=Math.sin(X),G=Math.cos(X),z=Math.sin(Y),H=Math.cos(Y);return Z[0]=Q*G*H-W*K*z,Z[1]=W*K*H+Q*G*z,Z[2]=W*G*z-Q*K*H,Z[3]=W*G*H+Q*K*z,Z}function ZJ6(Z){return"quat("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}var JJ6=qQ1,XJ6=FQ1,YJ6=UQ1,$J6=wQ1,QJ6=BQ1,WJ6=TQ1,vQ1=LQ1,SQ1=RQ1,KJ6=NQ1,_Q1=OQ1,GJ6=_Q1,xQ1=jQ1,zJ6=xQ1,Jg=MQ1,HJ6=DQ1,VJ6=PQ1,qJ6=function(){var Z=mR(),J=uR(1,0,0),X=uR(0,1,0);return function(Y,$,Q){var W=dR($,Q);if(W<-0.999999){if(FF(Z,J,$),ey(Z)<0.000001)FF(Z,X,$);return ty(Z,Z),CQ1(Y,Z,Math.PI),Y}else if(W>0.999999)return Y[0]=0,Y[1]=0,Y[2]=0,Y[3]=1,Y;else return FF(Z,$,Q),Y[0]=Z[0],Y[1]=Z[1],Y[2]=Z[2],Y[3]=1+W,Jg(Y,Y)}}(),FJ6=function(){var Z=Zg(),J=Zg();return function(X,Y,$,Q,W,K){return cR(Z,Y,W,K),cR(J,$,Q,K),cR(X,Z,J,2*K*(1-K)),X}}(),UJ6=function(){var Z=ry();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],Jg(J,IQ1(J,Z))}}();var V1={};D9(V1,{zero:()=>mJ6,transformMat4:()=>bJ6,transformMat3:()=>fJ6,transformMat2d:()=>hJ6,transformMat2:()=>AJ6,subtract:()=>hQ1,sub:()=>pJ6,str:()=>uJ6,squaredLength:()=>uQ1,squaredDistance:()=>gQ1,sqrLen:()=>oJ6,sqrDist:()=>sJ6,set:()=>OJ6,scaleAndAdd:()=>TJ6,scale:()=>CJ6,round:()=>PJ6,rotate:()=>yJ6,random:()=>xJ6,normalize:()=>IJ6,negate:()=>kJ6,multiply:()=>fQ1,mul:()=>iJ6,min:()=>NJ6,max:()=>DJ6,lerp:()=>_J6,length:()=>mQ1,len:()=>lJ6,inverse:()=>EJ6,fromValues:()=>BJ6,forEach:()=>rJ6,floor:()=>RJ6,exactEquals:()=>dJ6,equals:()=>cJ6,dot:()=>vJ6,divide:()=>bQ1,div:()=>nJ6,distance:()=>yQ1,dist:()=>aJ6,cross:()=>SJ6,create:()=>AQ1,copy:()=>LJ6,clone:()=>wJ6,ceil:()=>MJ6,angle:()=>gJ6,add:()=>jJ6});function AQ1(){var Z=new G1(2);if(G1!=Float32Array)Z[0]=0,Z[1]=0;return Z}function wJ6(Z){var J=new G1(2);return J[0]=Z[0],J[1]=Z[1],J}function BJ6(Z,J){var X=new G1(2);return X[0]=Z,X[1]=J,X}function LJ6(Z,J){return Z[0]=J[0],Z[1]=J[1],Z}function OJ6(Z,J,X){return Z[0]=J,Z[1]=X,Z}function jJ6(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z}function hQ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z}function fQ1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z}function bQ1(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z}function MJ6(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z}function RJ6(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z}function NJ6(Z,J,X){return Z[0]=Math.min(J[0],X[0]),Z[1]=Math.min(J[1],X[1]),Z}function DJ6(Z,J,X){return Z[0]=Math.max(J[0],X[0]),Z[1]=Math.max(J[1],X[1]),Z}function PJ6(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z}function CJ6(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z}function TJ6(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z}function yQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return Math.hypot(X,Y)}function gQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return X*X+Y*Y}function mQ1(Z){var J=Z[0],X=Z[1];return Math.hypot(J,X)}function uQ1(Z){var J=Z[0],X=Z[1];return J*J+X*X}function kJ6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z}function EJ6(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z}function IJ6(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 vJ6(Z,J){return Z[0]*J[0]+Z[1]*J[1]}function SJ6(Z,J,X){var Y=J[0]*X[1]-J[1]*X[0];return Z[0]=Z[1]=0,Z[2]=Y,Z}function _J6(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 xJ6(Z,J){J=J||1;var X=WZ()*2*Math.PI;return Z[0]=Math.cos(X)*J,Z[1]=Math.sin(X)*J,Z}function AJ6(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 hJ6(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 fJ6(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 bJ6(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 yJ6(Z,J,X,Y){var $=J[0]-X[0],Q=J[1]-X[1],W=Math.sin(Y),K=Math.cos(Y);return Z[0]=$*K-Q*W+X[0],Z[1]=$*W+Q*K+X[1],Z}function gJ6(Z,J){var X=Z[0],Y=Z[1],$=J[0],Q=J[1],W=Math.sqrt(X*X+Y*Y)*Math.sqrt($*$+Q*Q),K=W&&(X*$+Y*Q)/W;return Math.acos(Math.min(Math.max(K,-1),1))}function mJ6(Z){return Z[0]=0,Z[1]=0,Z}function uJ6(Z){return"vec2("+Z[0]+", "+Z[1]+")"}function dJ6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]}function cJ6(Z,J){var X=Z[0],Y=Z[1],$=J[0],Q=J[1];return Math.abs(X-$)<=v0*Math.max(1,Math.abs(X),Math.abs($))&&Math.abs(Y-Q)<=v0*Math.max(1,Math.abs(Y),Math.abs(Q))}var lJ6=mQ1,pJ6=hQ1,iJ6=fQ1,nJ6=bQ1,aJ6=yQ1,sJ6=gQ1,oJ6=uQ1,rJ6=function(){var Z=AQ1();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=2;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1];return J}}();class fQ extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get determinant(){return l8.determinant(this)}get frobeniusNorm(){return l8.frob(this)}static create(){let Z=new fQ(0,0,0,0);return l8.identity(Z),Z}static fromRotation(Z){let J=fQ.create();return l8.fromRotation(J,Z),J}static fromScaling(Z){let J=fQ.create();return l8.fromScaling(J,Z),J}add(Z){return l8.add(this,this,Z),this}adjoint(){return l8.adjoint(this,this),this}clone(){return new fQ(this[0],this[1],this[2],this[3])}copy(Z){return l8.copy(this,Z),this}equals(Z){return l8.equals(this,Z)}exactEquals(Z){return l8.exactEquals(this,Z)}identity(){return l8.identity(this),this}invert(){return l8.invert(this,this),this}multiply(Z){return l8.mul(this,this,Z),this}multiplyScalar(Z){return l8.multiplyScalar(this,this,Z),this}rotate(Z){return l8.rotate(this,this,Z),this}subtract(Z){return l8.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]}][${this[2]},${this[3]}]`}transpose(){return l8.transpose(this,this),this}}class KZ extends Float32Array{constructor(Z,J,X,Y,$,Q,W,K,G){super([Z,J,X,Y,$,Q,W,K,G])}get determinant(){return r1.determinant(this)}get frobeniusNorm(){return r1.frob(this)}static create(){let Z=new KZ(0,0,0,0,0,0,0,0,0);return r1.identity(Z),Z}static fromMatrix4(Z){let J=KZ.create();return r1.fromMat4(J,Z),J}static fromQuaternion(Z){let J=KZ.create();return r1.fromQuat(J,Z),J}static fromRotation(Z){let J=KZ.create();return r1.fromRotation(J,Z),J}static fromScaling(Z){let J=KZ.create();return r1.fromScaling(J,Z),J}static fromTranslation(Z){let J=KZ.create();return r1.fromTranslation(J,Z),J}add(Z){return r1.add(this,this,Z),this}adjoint(){return r1.adjoint(this,this),this}clone(){return new KZ(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8])}copy(Z){return r1.copy(this,Z),this}equals(Z){return r1.equals(this,Z)}exactEquals(Z){return r1.exactEquals(this,Z)}identity(){return r1.identity(this),this}invert(){return r1.invert(this,this),this}multiply(Z){return r1.mul(this,this,Z),this}multiplyScalar(Z){return r1.multiplyScalar(this,this,Z),this}transformVector(Z){return Z.transformMatrix3(this)}projection(Z,J){return r1.projection(this,Z,J),this}rotate(Z){return r1.rotate(this,this,Z),this}subtract(Z){return r1.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 r1.transpose(this,this),this}}class j5 extends Float32Array{constructor(Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B){super([Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B])}get determinant(){return e0.determinant(this)}get frobeniusNorm(){return e0.frob(this)}static create(){let Z=new j5(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return e0.identity(Z),Z}static fromQuaternion(Z){let J=j5.create();return e0.fromQuat(J,Z),J}static fromRotation(Z,J){let X=j5.create();return e0.fromRotation(X,Z,J),X}static fromRotationTranslation(Z,J){let X=j5.create();return e0.fromRotationTranslation(X,Z,J),X}static fromRotationTranslationScale(Z,J,X){let Y=j5.create();return e0.fromRotationTranslationScale(Y,Z,J,X),Y}static fromRotationTranslationScaleOrigin(Z,J,X,Y){let $=j5.create();return e0.fromRotationTranslationScaleOrigin($,Z,J,X,Y),$}static fromScaling(Z){let J=j5.create();return e0.fromScaling(J,Z),J}static fromTranslation(Z){let J=j5.create();return e0.fromTranslation(J,Z),J}static fromXRotation(Z){let J=j5.create();return e0.fromXRotation(J,Z),J}static fromYRotation(Z){let J=j5.create();return e0.fromYRotation(J,Z),J}static fromZRotation(Z){let J=j5.create();return e0.fromZRotation(J,Z),J}add(Z){return e0.add(this,this,Z),this}adjoint(){return e0.adjoint(this,this),this}clone(){return new j5(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 e0.copy(this,Z),this}equals(Z){return e0.equals(this,Z)}exactEquals(Z){return e0.exactEquals(this,Z)}frustrum(Z,J,X,Y,$,Q){return e0.frustum(this,Z,J,X,Y,$,Q),this}identity(){return e0.identity(this),this}invert(){return e0.invert(this,this),this}lookAt(Z,J,X){return e0.lookAt(this,Z,J,X),this}multiply(Z){return e0.mul(this,this,Z),this}multiplyScalar(Z){return e0.multiplyScalar(this,this,Z),this}orthographic(Z,J,X,Y,$,Q){return e0.ortho(this,Z,J,X,Y,$,Q),this}perspective(Z,J,X,Y){return e0.perspective(this,Z,J,X,Y),this}rotate(Z,J){return e0.rotate(this,this,Z,J),this}rotateX(Z){return e0.rotateX(this,this,Z),this}rotateY(Z){return e0.rotateY(this,this,Z),this}rotateZ(Z){return e0.rotateZ(this,this,Z),this}scale(Z){return e0.scale(this,this,Z),this}subtract(Z){return e0.sub(this,this,Z),this}targetTo(Z,J,X){return e0.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 e0.translate(this,this,Z),this}transpose(){return e0.transpose(this,this),this}}class b3 extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get length(){return P1.length(this)}get squaredLength(){return P1.squaredLength(this)}get magnitude(){return P1.length(this)}get squaredMagnitude(){return P1.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=P1.fromEuler(new Float32Array(4),Z,J,X);return new b3(Y[0],Y[1],Y[2],Y[3])}static fromQuaternionLike(Z){return new b3(Z.x,Z.y,Z.z,Z.w)}clone(){return new b3(this.x,this.y,this.z,this.w)}conjugate(){return P1.conjugate(this,this),this}copy(Z){return P1.copy(this,Z),this}dot(Z){return P1.dot(this,Z)}exponential(){return P1.exp(this,this),this}equals(Z){return P1.equals(this,Z)}exactEquals(Z){return P1.exactEquals(this,Z)}getAngle(Z){return P1.getAngle(this,Z)}identity(){return P1.identity(this),this}invert(){return P1.invert(this,this),this}lerp(Z,J){return P1.lerp(this,this,Z,J),this}logarithm(){return P1.ln(this,this),this}multiply(Z){return P1.multiply(this,this,Z),this}transformVector(Z){return Z.transformQuaternion(this)}normalize(){return P1.normalize(this,this),this}power(Z){return P1.pow(this,this,Z),this}randomize(){return P1.random(this),this}rotateX(Z){return P1.rotateX(this,this,Z),this}rotateY(Z){return P1.rotateY(this,this,Z),this}rotateZ(Z){return P1.rotateZ(this,this,Z),this}scale(Z){return P1.scale(this,this,Z),this}setAxisAngle(Z,J){return P1.setAxisAngle(this,Z,J),this}slerp(Z,J){return P1.slerp(this,this,Z,J),this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}}class UF extends Float32Array{constructor(Z,J){super([Z,J])}get length(){return V1.length(this)}get squaredLength(){return V1.squaredLength(this)}get magnitude(){return V1.length(this)}get squaredMagnitude(){return V1.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}static create(){return new UF(0,0)}add(Z){return V1.add(this,this,Z),this}angle(Z){return V1.angle(this,Z)}ceil(){return V1.ceil(this,this),this}clone(){return new UF(this.x,this.y)}copy(Z){return V1.copy(this,Z),this}distance(Z){return V1.distance(this,Z)}divide(Z){return V1.divide(this,this,Z),this}dot(Z){return V1.dot(this,Z)}equals(Z){return V1.equals(this,Z)}exactEquals(Z){return V1.exactEquals(this,Z)}floor(){return V1.floor(this,this),this}invert(){return V1.inverse(this,this),this}lerp(Z,J){return V1.lerp(this,this,Z,J),this}max(Z){return V1.max(this,this,Z),this}min(Z){return V1.min(this,this,Z),this}multiply(Z){return V1.mul(this,this,Z),this}negate(){return V1.negate(this,this),this}normalize(){return V1.normalize(this,this),this}randomize(Z){return V1.random(this,Z),this}rotate(Z,J){return V1.rotate(this,this,Z,J),this}round(){return V1.round(this,this),this}scale(Z){return V1.scale(this,this,Z),this}scaleAndAdd(Z,J){return V1.scaleAndAdd(this,this,Z,J),this}subtract(Z){return V1.sub(this,this,Z),this}toString(){return`${this.x},${this.y}`}transformMatrix2(Z){return V1.transformMat2(this,this,Z),this}transformMatrix3(Z){return V1.transformMat3(this,this,Z),this}transformMatrix4(Z){return V1.transformMat4(this,this,Z),this}zero(){return V1.zero(this),this}}class y3 extends Float32Array{constructor(Z,J,X){super([Z,J,X])}get length(){return J1.length(this)}get squaredLength(){return J1.squaredLength(this)}get magnitude(){return J1.length(this)}get squaredMagnitude(){return J1.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 y3(0,0,0)}static fromVector3Like(Z){return new y3(Z.x,Z.y,Z.z)}add(Z){return J1.add(this,this,Z),this}ceil(){return J1.ceil(this,this),this}clone(){return new y3(this.x,this.y,this.z)}copy(Z){return J1.copy(this,Z),this}cross(Z){return J1.cross(this,this,Z),this}distance(Z){return J1.distance(this,Z)}divide(Z){return J1.div(this,this,Z),this}dot(Z){return J1.dot(this,Z)}equals(Z){return J1.equals(this,Z)}exactEquals(Z){return J1.exactEquals(this,Z)}floor(){return J1.floor(this,this),this}invert(){return J1.inverse(this,this),this}lerp(Z,J){return J1.lerp(this,this,Z,J),this}max(Z){return J1.max(this,this,Z),this}min(Z){return J1.min(this,this,Z),this}multiply(Z){return J1.mul(this,this,Z),this}negate(){return J1.negate(this,this),this}normalize(){return J1.normalize(this,this),this}randomize(Z){return J1.random(this,Z),this}rotateX(Z,J){return J1.rotateX(this,this,Z,J),this}rotateY(Z,J){return J1.rotateY(this,this,Z,J),this}rotateZ(Z,J){return J1.rotateZ(this,this,Z,J),this}round(){return J1.round(this,this),this}scale(Z){return J1.scale(this,this,Z),this}scaleAndAdd(Z,J){return J1.scaleAndAdd(this,this,Z,J),this}subtract(Z){return J1.sub(this,this,Z),this}toString(){return`${this.x},${this.y},${this.z}`}transformMatrix3(Z){return J1.transformMat3(this,this,Z),this}transformMatrix4(Z){return J1.transformMat4(this,this,Z),this}transformQuaternion(Z){return J1.transformQuat(this,this,Z),this}zero(){return J1.zero(this),this}}var C1=function(Z,J,X,Y){function $(Q){return Q instanceof X?Q:new X(function(W){W(Q)})}return new(X||(X=Promise))(function(Q,W){function K(H){try{z(Y.next(H))}catch(V){W(V)}}function G(H){try{z(Y.throw(H))}catch(V){W(V)}}function z(H){H.done?Q(H.value):$(H.value).then(K,G)}z((Y=Y.apply(Z,J||[])).next())})},R1=function(Z,J){var X={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},Y,$,Q,W=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return W.next=K(0),W.throw=K(1),W.return=K(2),typeof Symbol==="function"&&(W[Symbol.iterator]=function(){return this}),W;function K(z){return function(H){return G([z,H])}}function G(z){if(Y)throw new TypeError("Generator is already executing.");while(W&&(W=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(H){z=[6,H],$=0}finally{Y=Q=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},s5=function(Z,J){var X=typeof Symbol==="function"&&Z[Symbol.iterator];if(!X)return Z;var Y=X.call(Z),$,Q=[],W;try{while((J===void 0||J-- >0)&&!($=Y.next()).done)Q.push($.value)}catch(K){W={error:K}}finally{try{if($&&!$.done&&(X=Y.return))X.call(Y)}finally{if(W)throw W.error}}return Q},U4=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))},dQ1=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.")},A55=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 C1(this,void 0,void 0,function(){return R1(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 C1(this,void 0,void 0,function(){return R1(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 C1(this,void 0,void 0,function(){return R1(this,function(Y){return[2,J-X]})})},Z.maxComparatorNumber=function(J,X){return C1(this,void 0,void 0,function(){return R1(this,function(Y){return[2,X-J]})})},Z.defaultIsEqual=function(J,X){return C1(this,void 0,void 0,function(){return R1(this,function(Y){return[2,J===X]})})},Z.print=function(J){function X(H){var V=Z.getParentIndexOf(H);return Math.floor(Math.log2(V+1))}function Y(H,V){var q="";for(;V>0;--V)q+=H;return q}var $=0,Q=[],W=X(J.length-1)+2,K=0;while($<J.length){var G=X($)+1;if($===0)G=0;var z=String(J.get($));if(z.length>K)K=z.length;Q[G]=Q[G]||[],Q[G].push(z),$+=1}return Q.map(function(H,V){var q=Math.pow(2,W-V)-1;return Y(" ",Math.floor(q/2)*K)+H.map(function(F){var U=(K-F.length)/2;return Y(" ",Math.ceil(U))+F+Y(" ",Math.floor(U))}).join(Y(" ",q*K))}).join(`
485
+ `);let{connect:G,buffered:z}=await K;if(Z.emit("proxyConnect",G),this.emit("proxyConnect",G,Z),G.statusCode===200){if(Z.once("socket",y96),J.secureEndpoint){YF("Upgrading socket connection to TLS");let V=J.servername||J.host;return by.connect({...E$1(J,"host","path","port"),socket:Y,servername:LJ.isIP(V)?void 0:V})}return Y}Y.destroy();let H=new LJ.Socket({writable:!1});return H.readable=!0,Z.once("socket",(V)=>{YF("Replaying proxy buffer for failed request"),V.push(z),V.push(null)}),H}}SR.__initStatic();function y96(Z){Z.resume()}function E$1(Z,...J){let X={},Y;for(Y in Z)if(!J.includes(Y))X[Y]=Z[Y];return X}var c96=32768;function l96(Z){return new u96({read(){this.push(Z),this.push(null)}})}function _R(Z){let J;try{J=new URL(Z.url)}catch(G){return G8(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),gK(Z,()=>Promise.resolve({}))}let X=J.protocol==="https:",Y=p96(J,Z.proxy||(X?process.env.https_proxy:void 0)||process.env.http_proxy),$=X?m96:g96,Q=Z.keepAlive===void 0?!1:Z.keepAlive,W=Y?new SR(Y):new $.Agent({keepAlive:Q,maxSockets:30,timeout:2000}),K=i96(Z,Z.httpModule??$,W);return gK(Z,K)}function p96(Z,J){let{no_proxy:X}=process.env;if(X?.split(",").some(($)=>Z.host.endsWith($)||Z.hostname.endsWith($)))return;else return J}function i96(Z,J,X){let{hostname:Y,pathname:$,port:Q,protocol:W,search:K}=new URL(Z.url);return function G(z){return new Promise((H,V)=>{UV(()=>{let q=l96(z.body),F={...Z.headers};if(z.body.length>c96)F["content-encoding"]="gzip",q=q.pipe(d96());let U=J.request({method:"POST",agent:X,headers:F,hostname:Y,path:`${$}${K}`,port:Q,protocol:W,ca:Z.caCerts},(B)=>{B.on("data",()=>{}),B.on("end",()=>{}),B.setEncoding("utf8");let w=B.headers["retry-after"]??null,O=B.headers["x-sentry-rate-limits"]??null;H({statusCode:B.statusCode,headers:{"retry-after":w,"x-sentry-rate-limits":Array.isArray(O)?O[0]||null:O}})});U.on("error",V),q.pipe(U)})})}}var n96=new Set(["false","f","n","no","off","0"]),a96=new Set(["true","t","y","yes","on","1"]);function xR(Z,J){let X=String(Z).toLowerCase();if(n96.has(X))return!1;if(a96.has(X))return!0;return J?.strict?null:Boolean(Z)}import{posix as s96,sep as o96}from"path";function I$1(Z){return Z.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function AR(Z=process.argv[1]?l_(process.argv[1]):process.cwd(),J=o96==="\\"){let X=J?I$1(Z):Z;return(Y)=>{if(!Y)return;let $=J?I$1(Y):Y,{dir:Q,base:W,ext:K}=s96.parse($);if(K===".js"||K===".mjs"||K===".cjs")W=W.slice(0,K.length*-1);let G=decodeURIComponent(W);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 H=Q.slice(X.length+1).replace(/\//g,".");return H?`${H}:${G}`:G}return G}}function hR(Z){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(O0.SENTRY_RELEASE?.id)return O0.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 fR=YO(Xx(AR()));var S$1=e(X0(),1);import*as v$1 from"os";import{threadId as r96,isMainThread as t96}from"worker_threads";var e96=60000;class $F extends OO{constructor(Z){let J=Z.serverName||global.process.env.SENTRY_NAME||v$1.hostname(),X={...Z,platform:"node",runtime:{name:"node",version:global.process.version},serverName:J};if(Z.openTelemetryInstrumentations)Q3({instrumentations:Z.openTelemetryInstrumentations});h_(X,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${t96?"main":`worker-${r96}`}.`);super(X);if(this.getOptions()._experiments?.enableLogs){if(this._logOnExitFlushListener=()=>{BX(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=L8,X=S$1.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&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},Z.clientReportFlushInterval??e96).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener)}_getTraceInfoFromScope(Z){if(!Z)return[void 0,void 0];return J81(this,Z)}}var W7=e(X0(),1);var h3=e(D1(),1);var _$1=e(Ij(),1);import Z46 from"module";var yy=1e6;function bR(Z,J={}){if(Z.getOptions().debug)A$1();let X=X46(Z,J);Z.traceProvider=X}function gy(){let[Z=0,J=0]=process.versions.node.split(".").map(Number);if(Z>=21||Z===20&&J>=6||Z===18&&J>=19){if(!O0._sentryEsmLoaderHookRegistered)try{let{addHookMessagePort:X}=_$1.createAddHookMessageChannel();Z46.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:X,include:[]},transferList:[X]})}catch(X){g.warn("Failed to register ESM hook",X)}}else G8(()=>{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 x$1(Z={}){let{debug:J}=Z;if(J)g.enable(),A$1();if(!K4())gy();J46(Z.integrations).forEach((X)=>{if(X(),J)g.log(`[Sentry] Preloaded ${X.id} instrumentation`)})}function J46(Z){let J=T$1();if(!Z)return J;return J.filter((X)=>Z.includes(X.id))}function X46(Z,J={}){let X=new Mf({sampler:new mf(Z),resource:new w3({[h3.ATTR_SERVICE_NAME]:"node",[h3.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[h3.ATTR_SERVICE_VERSION]:L8}),forceFlushTimeoutMillis:500,spanProcessors:[new gf({timeout:Y46(Z.getOptions().maxSpanWaitDuration)}),...J.spanProcessors||[]]});return W7.trace.setGlobalTracerProvider(X),W7.propagation.setGlobalPropagator(new Af),W7.context.setGlobalContextManager(new ER),X}function Y46(Z){if(Z==null)return;if(Z>yy)return m0&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${yy}`),yy;else if(Z<=0||Number.isNaN(Z)){m0&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return Z}function A$1(){let Z=new Proxy(g,{get(J,X,Y){return Reflect.get(J,X==="verbose"?"debug":X,Y)}});W7.diag.disable(),W7.diag.setLogger(Z,W7.DiagLogLevel.DEBUG)}function $46(){return K4()?[CM()]:[]}function my(){return[DV(),NV(),PV(),CV(),TV(),UM(),LM(),TM(),kM(),RM(),PM(),MM(),TR(),C$1(),...$46()]}function uy(Z){return[...my(),...G5(Z)?IR():[]]}function yR(Z={}){return f$1(Z,uy)}function h$1(Z={}){return f$1(Z,()=>[])}function f$1(Z={},J){let X=Q46(Z,J);if(X.debug===!0)if(m0)g.enable();else G8(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")});if(!K4()&&X.registerEsmLoaderHooks!==!1)gy();if(VM(),l0().update(X.initialScope),X.spotlight&&!X.integrations.some(({name:Q})=>Q===Ny))X.integrations.push(wR({sidecarUrl:typeof X.spotlight==="string"?X.spotlight:void 0}));let $=new $F(X);if(l0().setClient($),$.init(),g.log(`Running in ${K4()?"CommonJS":"ESM"} mode.`),$.startClientReportTracking(),G46(),!X.skipOpenTelemetrySetup)bR($,{spanProcessors:X.openTelemetrySpanProcessors}),dy();return i11($),X81($),$}function dy(){if(!m0)return;let Z=o11(),J=["SentryContextManager","SentryPropagator"];if(G5())J.push("SentrySpanProcessor");for(let X of J)if(!Z.includes(X))g.error(`You have to set up the ${X}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);if(!Z.includes("SentrySampler"))g.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function Q46(Z,J){let X=W46(Z.release),Y=Z.spotlight??xR(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,$=K46(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??_R,stackParser:pS(Z.stackParser||fR),release:X,tracesSampleRate:$,spotlight:Y,debug:xR(Z.debug??process.env.SENTRY_DEBUG)},W=Z.integrations,K=Z.defaultIntegrations??J(Q);return{...Q,integrations:P_({defaultIntegrations:K,integrations:W})}}function W46(Z){if(Z!==void 0)return Z;let J=hR();if(J!==void 0)return J;return}function K46(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 G46(){if(xR(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let Z=process.env.SENTRY_TRACE,J=process.env.SENTRY_BAGGAGE,X=A$(Z,J);l0().setPropagationContext(X)}}var z46=[["january","1"],["february","2"],["march","3"],["april","4"],["may","5"],["june","6"],["july","7"],["august","8"],["september","9"],["october","10"],["november","11"],["december","12"],["jan","1"],["feb","2"],["mar","3"],["apr","4"],["may","5"],["jun","6"],["jul","7"],["aug","8"],["sep","9"],["oct","10"],["nov","11"],["dec","12"],["sunday","0"],["monday","1"],["tuesday","2"],["wednesday","3"],["thursday","4"],["friday","5"],["saturday","6"],["sun","0"],["mon","1"],["tue","2"],["wed","3"],["thu","4"],["fri","5"],["sat","6"]];function _Q(Z){return z46.reduce((J,[X,Y])=>J.replace(new RegExp(X,"gi"),Y),Z)}var b$1="Automatic instrumentation of CronJob only supports crontab string";function y$1(Z,J){let X=!1;return new Proxy(Z,{construct(Y,$){let[Q,W,K,G,z,...H]=$;if(typeof Q!=="string")throw new Error(b$1);if(X)throw new Error(`A job named '${J}' has already been scheduled`);X=!0;let V=_Q(Q);async function q(F,U){return d7(J,async()=>{try{await W(F,U)}catch(B){throw F1(B),B}},{schedule:{type:"crontab",value:V},timezone:z||void 0})}return new Y(Q,q,K,G,z,...H)},get(Y,$){if($==="from")return(Q)=>{let{cronTime:W,onTick:K,timeZone:G}=Q;if(typeof W!=="string")throw new Error(b$1);if(X)throw new Error(`A job named '${J}' has already been scheduled`);X=!0;let z=_Q(W);return Q.onTick=async(H,V)=>{return d7(J,async()=>{try{await K(H,V)}catch(q){throw F1(q),q}},{schedule:{type:"crontab",value:z},timezone:G||void 0})},Y.from(Q)};else return Y[$]}})}function g$1(Z){return new Proxy(Z,{get(J,X){if(X==="schedule"&&J.schedule)return new Proxy(J.schedule,{apply(Y,$,Q){let[W,K,G]=Q,z=G?.name,H=G?.timezone;if(!z)throw new Error('Missing "name" for scheduled job. A name is required for Sentry check-in monitoring.');let V=async()=>{return d7(z,async()=>{try{return await K()}catch(q){throw F1(q),q}},{schedule:{type:"crontab",value:_Q(W)},timezone:H})};return Y.apply($,[W,V,G])}});else return J[X]}})}function m$1(Z){return new Proxy(Z,{get(J,X){if(X==="scheduleJob")return new Proxy(J.scheduleJob,{apply(Y,$,Q){let[W,K,G]=Q;if(typeof W!=="string"||typeof K!=="string"||typeof G!=="function")throw new Error("Automatic instrumentation of 'node-schedule' requires the first parameter of 'scheduleJob' to be a job name string and the second parameter to be a crontab string");let z=W,H=K;async function V(){return d7(z,async()=>{await G?.()},{schedule:{type:"crontab",value:_Q(H)}})}return Y.apply($,[z,H,V])}});return J[X]}})}var u$1={instrumentCron:y$1,instrumentNodeCron:g$1,instrumentNodeSchedule:m$1};var xQ;((w)=>{w.BUILD_PACKETS="build_packets";w.ENTITIES_EMIT_UPDATES="entities_emit_updates";w.ENTITIES_TICK="entities_tick";w.NETWORK_SYNCHRONIZE="network_synchronize";w.NETWORK_SYNCHRONIZE_CLEANUP="network_synchronize_cleanup";w.PHYSICS_CLEANUP="physics_cleanup";w.PHYSICS_STEP="physics_step";w.RELEASE_TICK_ALLOCATION="release_tick_allocation";w.SEND_ALL_PACKETS="send_all_packets";w.SEND_PACKETS="send_packets";w.SERIALIZE_FREE_BUFFERS="serialize_free_buffers";w.SERIALIZE_PACKETS="serialize_packets";w.SERIALIZE_PACKETS_ENCODE="serialize_packets_encode";w.SIMULATION_STEP="simulation_step";w.TICKER_TICK="ticker_tick";w.WORLD_TICK="world_tick"})(xQ||={});class J8{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 initializeSentry(Z,J=50){yR({dsn:Z,release:CS,environment:process.env.NODE_ENV||"development",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:(X)=>{return X.extra=J8.getProcessStats(),X},beforeSendTransaction:(X)=>{if(X.contexts?.trace?.op==="ticker_tick"){let $=X?.start_timestamp,Q=X?.timestamp;if(!$||!Q)return null;if((Q-$)*1000>J)return X.measurements=J8.getProcessStats(!0),X}return null}})}static startSpan(Z,J){if(jV())return n9({attributes:Z.attributes,name:Z.operation,op:Z.operation},J);else return J()}static sentry(){return cy}}var d$1=new V$,V46=5000;class y4 extends j0{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=k60(),this.onPacket(Y0.PacketId.CONNECTION,this._onConnectionPacket),this.onPacket(Y0.PacketId.HEARTBEAT,this._onHeartbeatPacket),this.bindWs(Z),j0.globalInstance.emit("CONNECTION.OPENED",{connection:this,req:J})}static clearCachedPacketsSerializedBuffers(){if(y4._cachedPacketsSerializedBuffer.size>0)y4._cachedPacketsSerializedBuffer.clear()}static serializePackets(Z){for(let X of Z)if(!Y0.isValidPacket(X))return d.error(`Connection.serializePackets(): Invalid packet payload: ${JSON.stringify(X)}`);let J=y4._cachedPacketsSerializedBuffer.get(Z);if(J)return J;return J8.startSpan({operation:"serialize_packets",attributes:{packets:Z.length,packetIds:Z.map((X)=>X[0]).join(",")}},(X)=>{let Y=J8.startSpan({operation:"serialize_packets_encode"},()=>d$1.pack(Z));return X?.setAttribute("serializedBytes",Y.byteLength),y4._cachedPacketsSerializedBuffer.set(Z,Y),Y})}bindWs(Z){let J=!!this._ws;if(J&&this._closeTimeout)clearTimeout(this._closeTimeout),this._closeTimeout=null;if(this._ws)this._ws.onmessage=()=>{},this._ws.onclose=()=>{},this._ws.onerror=()=>{},this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{k:!0})]);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([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{i:this.id})],!0,!0),J)this.emitWithGlobal("CONNECTION.RECONNECTED",{connection:this});if(m7.instance.isWrtcEnabled)this._upgradeToWRTC()}closeWrtc(){this._closeWrtcClientServerTransport(),this._closeWrtcServerClientTransport()}disconnect(){try{this._ws.close()}catch(Z){d.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!==H46.OPEN)return;J8.startSpan({operation:"send_packets",attributes:{forceWs:X?"true":"false",wrtcConnected:this._wrtcServerClientTransport?.iceState==="completed"?"true":"false"}},()=>{try{let Y=y4.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){d.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,W=!1;if($==this._wrtcClientServerTransport?.id)await this._wrtcClientServerTransport.connect({dtlsParameters:Q}),W=!0;if($==this._wrtcServerClientTransport?.id)await this._wrtcServerClientTransport.connect({dtlsParameters:Q}),W=!0;if(W)this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{ca:{i:$}})])}if(Y)for(let $ of Y){let{s:Q,l:W}=$,K=await this._wrtcClientServerTransport.produceData({label:W,sctpStreamParameters:Q}),G=await this._wrtcDirectTransport.consumeData({dataProducerId:K.id});this._wrtcClientServerDataProducers.push(K),this._wrtcClientServerDataConsumers.push(G),G.on("message",(z)=>this._onMessage(z)),this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{pa:{i:K.id,l:W}})])}};_onHeartbeatPacket=()=>{this.send([Y0.createPacket(Y0.bidirectionalPackets.heartbeatPacketDefinition,null)],!0,!0)};_onMessage=(Z)=>{try{let J=this._deserialize(Z);if(!J)return;this.emitWithGlobal("CONNECTION.PACKET_RECEIVED",{connection:this,packet:J})}catch(J){d.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()},V46)};_onWsError=(Z)=>{this.emitWithGlobal("CONNECTION.ERROR",{connection:this,error:Z})};_upgradeToWRTC=async()=>{let Z=await m7.instance.createWrtcTransports();if(!Z)return!1;let{directTransport:J,clientServerTransport:X,serverClientTransport:Y}=Z;this._wrtcDirectTransport=J,this._wrtcClientServerTransport=X,this._wrtcClientServerTransport.on("icestatechange",(W)=>{this._onWrtcIceStateChange(this._wrtcClientServerTransport,W)}),this._wrtcServerClientTransport=Y,this._wrtcServerClientTransport.on("icestatechange",(W)=>{this._onWrtcIceStateChange(this._wrtcServerClientTransport,W)}),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([Y0.createPacket(Y0.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=d$1.unpack(Z);if(!J||typeof J!=="object"||typeof J[0]!=="number")return d.error(`Connection._deserialize(): Invalid packet format. Packet: ${JSON.stringify(J)}`);if(!Y0.isValidPacket(J))return d.error(`Connection._deserialize(): Invalid packet payload. Packet: ${JSON.stringify(J)}`);return J}}class QF{_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(Z=!1){return Z?this._world.tickAllocator.getArray(this._lights.values()):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)}}class F6{_map=new Map;_values=[];_isDirty=!1;get size(){return this._map.size}get valuesArray(){if(this._isDirty)this._syncArray();return this._values}get(Z){return this._map.get(Z)}set(Z,J){let X=this._map.has(Z);if(this._map.set(Z,J),!X)this._values.push(J);else this._isDirty=!0;return this}has(Z){return this._map.has(Z)}delete(Z){let J=this._map.delete(Z);if(J)this._isDirty=!0;return J}clear(){this._map.clear(),this._values.length=0,this._isDirty=!1}forEach(Z,J){this._map.forEach((X,Y)=>{Z.call(J,X,Y,this)})}keys(){return this._map.keys()}values(){return this._map.values()}entries(){return this._map.entries()}[Symbol.iterator](){return this._map[Symbol.iterator]()}_syncArray(){this._values.length=0;for(let Z of this._map.values())this._values.push(Z);this._isDirty=!1}}var c$1;((X)=>{X[X.POINTLIGHT=0]="POINTLIGHT";X[X.SPOTLIGHT=1]="SPOTLIGHT"})(c$1||={});var ly;((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"})(ly||={});class py extends j0{_id;_angle;_attachedToEntity;_color;_distance;_intensity;_offset;_penumbra;_position;_trackedEntity;_trackedPosition;_type;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)d.fatalError("Either attachedToEntity or position must be set, but not both.");super();d.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 d.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&&this._offset.x===Z.x&&this._offset.y===Z.y&&this._offset.z===Z.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&&this._position.x===Z.x&&this._position.y===Z.y&&this._position.z===Z.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 d.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 d.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(){if(!this._world)d.fatalError("Light.serialize(): Light is not in a world and cannot be serialized!");return D0.serializeLight(this,this._world.tickAllocator)}}var iy;((m)=>{m.BURST="PARTICLE_EMITTER.BURST";m.DESPAWN="PARTICLE_EMITTER.DESPAWN";m.SET_ALPHA_TEST="PARTICLE_EMITTER.SET_ALPHA_TEST";m.SET_ATTACHED_TO_ENTITY="PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY";m.SET_ATTACHED_TO_ENTITY_NODE_NAME="PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY_NODE_NAME";m.SET_COLOR_END="PARTICLE_EMITTER.SET_COLOR_END";m.SET_COLOR_END_VARIANCE="PARTICLE_EMITTER.SET_COLOR_END_VARIANCE";m.SET_COLOR_START="PARTICLE_EMITTER.SET_COLOR_START";m.SET_COLOR_START_VARIANCE="PARTICLE_EMITTER.SET_COLOR_START_VARIANCE";m.SET_GRAVITY="PARTICLE_EMITTER.SET_GRAVITY";m.SET_LIFETIME="PARTICLE_EMITTER.SET_LIFETIME";m.SET_LIFETIME_VARIANCE="PARTICLE_EMITTER.SET_LIFETIME_VARIANCE";m.SET_MAX_PARTICLES="PARTICLE_EMITTER.SET_MAX_PARTICLES";m.SET_OFFSET="PARTICLE_EMITTER.SET_OFFSET";m.SET_OPACITY_END="PARTICLE_EMITTER.SET_OPACITY_END";m.SET_OPACITY_END_VARIANCE="PARTICLE_EMITTER.SET_OPACITY_END_VARIANCE";m.SET_OPACITY_START="PARTICLE_EMITTER.SET_OPACITY_START";m.SET_OPACITY_START_VARIANCE="PARTICLE_EMITTER.SET_OPACITY_START_VARIANCE";m.SET_PAUSED="PARTICLE_EMITTER.SET_PAUSED";m.SET_POSITION="PARTICLE_EMITTER.SET_POSITION";m.SET_POSITION_VARIANCE="PARTICLE_EMITTER.SET_POSITION_VARIANCE";m.SET_RATE="PARTICLE_EMITTER.SET_RATE";m.SET_RATE_VARIANCE="PARTICLE_EMITTER.SET_RATE_VARIANCE";m.SET_SIZE_END="PARTICLE_EMITTER.SET_SIZE_END";m.SET_SIZE_END_VARIANCE="PARTICLE_EMITTER.SET_SIZE_END_VARIANCE";m.SET_SIZE_START="PARTICLE_EMITTER.SET_SIZE_START";m.SET_SIZE_START_VARIANCE="PARTICLE_EMITTER.SET_SIZE_START_VARIANCE";m.SET_TEXTURE_URI="PARTICLE_EMITTER.SET_TEXTURE_URI";m.SET_TRANSPARENT="PARTICLE_EMITTER.SET_TRANSPARENT";m.SET_VELOCITY="PARTICLE_EMITTER.SET_VELOCITY";m.SET_VELOCITY_VARIANCE="PARTICLE_EMITTER.SET_VELOCITY_VARIANCE";m.SPAWN="PARTICLE_EMITTER.SPAWN"})(iy||={});class ny extends j0{_id;_alphaTest;_attachedToEntity;_attachedToEntityNodeName;_colorEnd;_colorEndVariance;_colorStart;_colorStartVariance;_gravity;_lifetime;_lifetimeVariance;_maxParticles;_offset;_opacityEnd;_opacityEndVariance;_opacityStart;_opacityStartVariance;_paused;_position;_positionVariance;_rate;_rateVariance;_sizeEnd;_sizeEndVariance;_sizeStart;_sizeStartVariance;_sizeVariance;_textureUri;_transparent;_velocity;_velocityVariance;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)d.fatalError("Either attachedToEntity or position must be set, but not both.");if(!Z.textureUri)d.fatalError("ParticleEmitter.constructor(): textureUri must be provided.");super();this._alphaTest=Z.alphaTest??0.5,this._attachedToEntity=Z.attachedToEntity,this._attachedToEntityNodeName=Z.attachedToEntityNodeName,this._colorEnd=Z.colorEnd,this._colorEndVariance=Z.colorEndVariance,this._colorStart=Z.colorStart,this._colorStartVariance=Z.colorStartVariance,this._gravity=Z.gravity,this._lifetime=Z.lifetime,this._lifetimeVariance=Z.lifetimeVariance,this._maxParticles=Z.maxParticles,this._offset=Z.offset,this._opacityEnd=Z.opacityEnd,this._opacityEndVariance=Z.opacityEndVariance,this._opacityStart=Z.opacityStart,this._opacityStartVariance=Z.opacityStartVariance,this._paused=!1,this._position=Z.position,this._positionVariance=Z.positionVariance,this._rate=Z.rate,this._rateVariance=Z.rateVariance,this._sizeEnd=Z.sizeEnd,this._sizeEndVariance=Z.sizeEndVariance,this._sizeStart=Z.sizeStart,this._sizeStartVariance=Z.sizeStartVariance,this._textureUri=Z.textureUri,this._transparent=Z.transparent,this._velocity=Z.velocity,this._velocityVariance=Z.velocityVariance}get id(){return this._id}get alphaTest(){return this._alphaTest}get attachedToEntity(){return this._attachedToEntity}get attachedToEntityNodeName(){return this._attachedToEntityNodeName}get colorEnd(){return this._colorEnd}get colorEndVariance(){return this._colorEndVariance}get colorStart(){return this._colorStart}get colorStartVariance(){return this._colorStartVariance}get gravity(){return this._gravity}get isSpawned(){return this._id!==void 0}get lifetime(){return this._lifetime}get lifetimeVariance(){return this._lifetimeVariance}get maxParticles(){return this._maxParticles}get offset(){return this._offset}get opacityEnd(){return this._opacityEnd}get opacityEndVariance(){return this._opacityEndVariance}get opacityStart(){return this._opacityStart}get opacityStartVariance(){return this._opacityStartVariance}get paused(){return this._paused}get position(){return this._position}get positionVariance(){return this._positionVariance}get rate(){return this._rate}get rateVariance(){return this._rateVariance}get sizeEnd(){return this._sizeEnd}get sizeEndVariance(){return this._sizeEndVariance}get sizeStart(){return this._sizeStart}get sizeStartVariance(){return this._sizeStartVariance}get sizeVariance(){return this._sizeVariance}get textureUri(){return this._textureUri}get transparent(){return this._transparent}get velocity(){return this._velocity}get velocityVariance(){return this._velocityVariance}get world(){return this._world}setAlphaTest(Z){if(this._alphaTest===Z)return;if(this._alphaTest=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_ALPHA_TEST",{particleEmitter:this,alphaTest:Z})}setAttachedToEntity(Z){if(!Z.isSpawned)return d.error(`ParticleEmitter.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,"PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY",{particleEmitter:this,entity:Z})}setAttachedToEntityNodeName(Z){if(this._attachedToEntityNodeName===Z)return;if(this._attachedToEntityNodeName=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY_NODE_NAME",{particleEmitter:this,attachedToEntityNodeName:Z})}setColorEnd(Z){if(this._colorEnd&&this._colorEnd.r===Z.r&&this._colorEnd.g===Z.g&&this._colorEnd.b===Z.b)return;if(this._colorEnd=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_END",{particleEmitter:this,colorEnd:Z})}setColorEndVariance(Z){if(this._colorEndVariance&&this._colorEndVariance.r===Z.r&&this._colorEndVariance.g===Z.g&&this._colorEndVariance.b===Z.b)return;if(this._colorEndVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_END_VARIANCE",{particleEmitter:this,colorEndVariance:Z})}setColorStart(Z){if(this._colorStart&&this._colorStart.r===Z.r&&this._colorStart.g===Z.g&&this._colorStart.b===Z.b)return;if(this._colorStart=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_START",{particleEmitter:this,colorStart:Z})}setColorStartVariance(Z){if(this._colorStartVariance&&this._colorStartVariance.r===Z.r&&this._colorStartVariance.g===Z.g&&this._colorStartVariance.b===Z.b)return;if(this._colorStartVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_START_VARIANCE",{particleEmitter:this,colorStartVariance:Z})}setGravity(Z){if(this._gravity&&this._gravity.x===Z.x&&this._gravity.y===Z.y&&this._gravity.z===Z.z)return;if(this._gravity=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_GRAVITY",{particleEmitter:this,gravity:Z})}setLifetime(Z){if(this._lifetime===Z)return;if(this._lifetime=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_LIFETIME",{particleEmitter:this,lifetime:Z})}setLifetimeVariance(Z){if(this._lifetimeVariance===Z)return;if(this._lifetimeVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_LIFETIME_VARIANCE",{particleEmitter:this,lifetimeVariance:Z})}setMaxParticles(Z){if(this._maxParticles===Z)return;if(this._maxParticles=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_MAX_PARTICLES",{particleEmitter:this,maxParticles:Z})}setOffset(Z){if(this._offset&&this._offset.x===Z.x&&this._offset.y===Z.y&&this._offset.z===Z.z)return;if(this._offset=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OFFSET",{particleEmitter:this,offset:Z})}setOpacityEnd(Z){if(this._opacityEnd===Z)return;if(this._opacityEnd=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_END",{particleEmitter:this,opacityEnd:Z})}setOpacityEndVariance(Z){if(this._opacityEndVariance===Z)return;if(this._opacityEndVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_END_VARIANCE",{particleEmitter:this,opacityEndVariance:Z})}setOpacityStart(Z){if(this._opacityStart===Z)return;if(this._opacityStart=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_START",{particleEmitter:this,opacityStart:Z})}setOpacityStartVariance(Z){if(this._opacityStartVariance===Z)return;if(this._opacityStartVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_START_VARIANCE",{particleEmitter:this,opacityStartVariance:Z})}setPosition(Z){if(this._position&&this._position.x===Z.x&&this._position.y===Z.y&&this._position.z===Z.z)return;if(this._position=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_POSITION",{particleEmitter:this,position:Z})}setPositionVariance(Z){if(this._positionVariance&&this._positionVariance.x===Z.x&&this._positionVariance.y===Z.y&&this._positionVariance.z===Z.z)return;if(this._positionVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_POSITION_VARIANCE",{particleEmitter:this,positionVariance:Z})}setRate(Z){if(this._rate===Z)return;if(this._rate=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_RATE",{particleEmitter:this,rate:Z})}setRateVariance(Z){if(this._rateVariance===Z)return;if(this._rateVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_RATE_VARIANCE",{particleEmitter:this,rateVariance:Z})}setSizeEnd(Z){if(this._sizeEnd===Z)return;if(this._sizeEnd=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_END",{particleEmitter:this,sizeEnd:Z})}setSizeEndVariance(Z){if(this._sizeEndVariance===Z)return;if(this._sizeEndVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_END_VARIANCE",{particleEmitter:this,sizeEndVariance:Z})}setSizeStart(Z){if(this._sizeStart===Z)return;if(this._sizeStart=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_START",{particleEmitter:this,sizeStart:Z})}setSizeStartVariance(Z){if(this._sizeStartVariance===Z)return;if(this._sizeStartVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_START_VARIANCE",{particleEmitter:this,sizeStartVariance:Z})}setTextureUri(Z){if(this._textureUri===Z)return;if(this._textureUri=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_TEXTURE_URI",{particleEmitter:this,textureUri:Z})}setTransparent(Z){if(this._transparent===Z)return;if(this._transparent=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_TRANSPARENT",{particleEmitter:this,transparent:Z})}setVelocity(Z){if(this._velocity&&this._velocity.x===Z.x&&this._velocity.y===Z.y&&this._velocity.z===Z.z)return;if(this._velocity=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_VELOCITY",{particleEmitter:this,velocity:Z})}setVelocityVariance(Z){if(this._velocityVariance&&this._velocityVariance.x===Z.x&&this._velocityVariance.y===Z.y&&this._velocityVariance.z===Z.z)return;if(this._velocityVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_VELOCITY_VARIANCE",{particleEmitter:this,velocityVariance:Z})}burst(Z){if(this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.BURST",{particleEmitter:this,count:Z})}despawn(){if(!this.isSpawned||!this._world)return;this._world.particleEmitterManager.unregisterParticleEmitter(this),this.emitWithWorld(this._world,"PARTICLE_EMITTER.DESPAWN",{particleEmitter:this}),this._id=void 0,this._world=void 0}restart(){if(!this._paused)return;if(this._paused=!1,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_PAUSED",{particleEmitter:this,paused:this._paused})}stop(){if(this._paused)return;if(this._paused=!0,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_PAUSED",{particleEmitter:this,paused:this._paused})}spawn(Z){if(this.isSpawned)return;if(this._attachedToEntity&&!this._attachedToEntity.isSpawned)return d.error(`ParticleEmitter.spawn(): Attached entity ${this._attachedToEntity.id} must be spawned before spawning ParticleEmitter!`);this._id=Z.particleEmitterManager.registerParticleEmitter(this),this._world=Z,this.emitWithWorld(Z,"PARTICLE_EMITTER.SPAWN",{particleEmitter:this})}serialize(){if(!this._world)d.fatalError("ParticleEmitter.serialize(): ParticleEmitter is not in a world and cannot be serialized!");return D0.serializeParticleEmitter(this,this._world.tickAllocator)}}var q46={x:0,y:-32,z:0},ay=60,sy;(($)=>{$.STEP_START="SIMULATION.STEP_START";$.STEP_END="SIMULATION.STEP_END";$.DEBUG_RAYCAST="SIMULATION.DEBUG_RAYCAST";$.DEBUG_RENDER="SIMULATION.DEBUG_RENDER"})(sy||={});class WF extends j0{_colliderMap=new pz;_debugRaycastingEnabled=!1;_debugRenderingEnabled=!1;_debugRenderingFilterFlags;_rapierEventQueue;_rapierSimulation;_world;constructor(Z,J=ay,X=q46){super();this._rapierEventQueue=new Q1.EventQueue(!0),this._rapierSimulation=new Q1.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}createRawCollider(Z,J){return this._rapierSimulation.createCollider(Z,J)}createRawRigidBody(Z){return this._rapierSimulation.createRigidBody(Z)}enableDebugRaycasting(Z){this._debugRaycastingEnabled=Z}enableDebugRendering(Z,J=Q1.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(),W=[];for(let K=0;K<Y.numSolverContacts();K++)W.push(Y.solverContactPoint(K));X.push({contactPoints:W,localNormalA:!$?Y.localNormal1():Y.localNormal2(),localNormalB:!$?Y.localNormal2():Y.localNormal1(),normal:!$?Q:{x:-Q.x,y:-Q.y,z:-Q.z}})}),X}intersectionsWithRawShape(Z,J,X,Y={}){let $=new Set,Q=[];return this._rapierSimulation.intersectionsWithShape(J,X,Z,(W)=>{let K=this._colliderMap.getColliderHandleBlockType(W.handle);if(K&&!$.has(K))return $.add(K),Q.push({intersectedBlockType:K}),!0;let G=this._colliderMap.getColliderHandleEntity(W.handle);if(G&&!$.has(G))return $.add(G),Q.push({intersectedEntity:G}),!0;return!0},Y.filterFlags,Y.filterGroups,Y.filterExcludeCollider,Y.filterExcludeRigidBody,Y.filterPredicate),Q}raycast(Z,J,X,Y={}){let $=new Q1.Ray(Z,J),Q=this._rapierSimulation.castRay($,X,Y.solidMode??!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 W=$.pointAt(Q.timeOfImpact),K=Q.timeOfImpact,G=Q.collider,z=this._colliderMap.getColliderHandleBlockType(G.handle);if(z)return{hitBlock:gQ.fromGlobalCoordinate({x:Math.floor(W.x-($.dir.x<0?0.0001:-0.0001)),y:Math.floor(W.y-($.dir.y<0?0.0001:-0.0001)),z:Math.floor(W.z-($.dir.z<0?0.0001:-0.0001))},z),hitPoint:W,hitDistance:K};let H=this._colliderMap.getColliderHandleEntity(G.handle);if(H)return{hitEntity:H,hitPoint:W,hitDistance:K};return null}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(J8.startSpan({operation:"physics_step"},()=>{this._rapierSimulation.step(this._rapierEventQueue)}),J8.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=(W,K)=>{if(W instanceof Q9&&K instanceof a8&&W.hasListeners("BLOCK_TYPE.ENTITY_COLLISION"))W.emit("BLOCK_TYPE.ENTITY_COLLISION",{blockType:W,entity:K,started:X,colliderHandleA:Z,colliderHandleB:J});else if(W instanceof a8&&K instanceof Q9&&W.hasListeners("ENTITY.BLOCK_COLLISION"))W.emit("ENTITY.BLOCK_COLLISION",{entity:W,blockType:K,started:X,colliderHandleA:Z,colliderHandleB:J});else if(W instanceof a8&&K instanceof a8&&W.hasListeners("ENTITY.ENTITY_COLLISION"))W.emit("ENTITY.ENTITY_COLLISION",{entity:W,otherEntity:K,started:X,colliderHandleA:Z,colliderHandleB:J});else if(typeof W==="function"&&(K instanceof a8||K instanceof Q9))W(K,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,W)=>{if(Q instanceof Q9&&W instanceof a8&&Q.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))Q.emit("BLOCK_TYPE.ENTITY_CONTACT_FORCE",{blockType:Q,entity:W,contactForceData:Y});else if(Q instanceof a8&&W instanceof Q9&&Q.hasListeners("ENTITY.BLOCK_CONTACT_FORCE"))Q.emit("ENTITY.BLOCK_CONTACT_FORCE",{entity:Q,blockType:W,contactForceData:Y});else if(Q instanceof a8&&W instanceof a8&&Q.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))Q.emit("ENTITY.ENTITY_CONTACT_FORCE",{entity:Q,otherEntity:W,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 gR{_synchronizedPlayerReliablePackets=new F6;_queuedBroadcasts=[];_queuedAudioSynchronizations=new F6;_queuedBlockSynchronizations=new F6;_queuedBlockTypeSynchronizations=new F6;_queuedChunkSynchronizations=new F6;_queuedDebugRaycastSynchronizations=[];_queuedEntitySynchronizations=new F6;_queuedLightSynchronizations=new F6;_queuedParticleEmitterSynchronizations=new F6;_queuedPerPlayerSynchronizations=new F6;_queuedPerPlayerCameraSynchronizations=new F6;_queuedPerPlayerUISynchronizations=new F6;_queuedPerPlayerUIDatasSynchronizations=new F6;_queuedPlayerSynchronizations=new F6;_queuedSceneUISynchronizations=new F6;_queuedWorldSynchronization;_loadedSceneUIs=new Set;_spawnedChunks=new Set;_spawnedEntities=new Set;_world;constructor(Z){this._world=Z,this._subscribeToAudioEvents(),this._subscribeToBlockTypeRegistryEvents(),this._subscribeToChatEvents(),this._subscribeToChunkLatticeEvents(),this._subscribeToEntityEvents(),this._subscribeToLightEvents(),this._subscribeToParticleEmitterEvents(),this._subscribeToPlayerEvents(),this._subscribeToPlayerCameraEvents(),this._subscribeToPlayerUIEvents(),this._subscribeToSceneUIEvents(),this._subscribeToSimulationEvents(),this._subscribeToWorldEvents()}synchronize(){let Z=this._world.tickAllocator,J=this._world.tickAllocator.getArray(),X=this._world.tickAllocator.getArray(),Y=this._world.loop.currentTick;if(this._queuedPerPlayerSynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerSynchronizations)this._createOrGetSynchronizedPlayerReliablePackets($,J).push(...Q);if(this._queuedEntitySynchronizations.size>0){let $=this._world.tickAllocator.getArray(),Q=this._world.tickAllocator.getArray();for(let W of this._queuedEntitySynchronizations.valuesArray){let K=!1;for(let G in W)if(G!=="i"&&G!=="p"&&G!=="r"){K=!0;break}if(K)$.push(W);else Q.push(W)}if(Q.length>0){let W=Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,Q,Y,Z.getArray());X.push(W)}if($.length>0){let W=Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,$,Y,Z.getArray());J.push(W);for(let K of this._synchronizedPlayerReliablePackets.valuesArray)K.push(W)}}if(this._queuedAudioSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.audiosPacketDefinition,this._queuedAudioSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedBlockTypeSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.blockTypesPacketDefinition,this._queuedBlockTypeSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedChunkSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.chunksPacketDefinition,this._queuedChunkSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedBlockSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.blocksPacketDefinition,this._queuedBlockSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedLightSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.lightsPacketDefinition,this._queuedLightSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedParticleEmitterSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.particleEmittersPacketDefinition,this._queuedParticleEmitterSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedPerPlayerUISynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerUISynchronizations){let W=Y0.createPacket(Y0.outboundPackets.uiPacketDefinition,Q,Y,Z.getArray());this._createOrGetSynchronizedPlayerReliablePackets($,J).push(W)}if(this._queuedPerPlayerUIDatasSynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerUIDatasSynchronizations){let W=Y0.createPacket(Y0.outboundPackets.uiDatasPacketDefinition,Q,Y,Z.getArray());this._createOrGetSynchronizedPlayerReliablePackets($,J).push(W)}if(this._queuedSceneUISynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.sceneUIsPacketDefinition,this._queuedSceneUISynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedWorldSynchronization){let $=Y0.createPacket(Y0.outboundPackets.worldPacketDefinition,this._queuedWorldSynchronization,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedPerPlayerCameraSynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerCameraSynchronizations){let W=Y0.createPacket(Y0.outboundPackets.cameraPacketDefinition,Q,Y,Z.getArray());this._createOrGetSynchronizedPlayerReliablePackets($,J).push(W)}if(this._queuedPlayerSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.playersPacketDefinition,this._queuedPlayerSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedBroadcasts.length>0)for(let $ of this._queuedBroadcasts){J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedDebugRaycastSynchronizations.length>0){let $=Y0.createPacket(Y0.outboundPackets.physicsDebugRaycastsPacketDefinition,this._queuedDebugRaycastSynchronizations,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}J8.startSpan({operation:"send_all_packets"},()=>{for(let $ of V9.instance.getConnectedPlayersByWorld(this._world)){let Q=this._synchronizedPlayerReliablePackets.get($)??J;if(Q.length>0)$.connection.send(Q);if(X.length>0)$.connection.send(X,!1)}}),J8.startSpan({operation:"network_synchronize_cleanup"},()=>{if(this._queuedBroadcasts.length>0)this._queuedBroadcasts.length=0;if(this._queuedAudioSynchronizations.size>0)this._queuedAudioSynchronizations.clear();if(this._queuedBlockSynchronizations.size>0)this._queuedBlockSynchronizations.clear();if(this._queuedBlockTypeSynchronizations.size>0)this._queuedBlockTypeSynchronizations.clear();if(this._queuedChunkSynchronizations.size>0)this._queuedChunkSynchronizations.clear();if(this._queuedDebugRaycastSynchronizations.length>0)this._queuedDebugRaycastSynchronizations.length=0;if(this._queuedEntitySynchronizations.size>0)this._queuedEntitySynchronizations.clear();if(this._queuedLightSynchronizations.size>0)this._queuedLightSynchronizations.clear();if(this._queuedParticleEmitterSynchronizations.size>0)this._queuedParticleEmitterSynchronizations.clear();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(this._queuedPlayerSynchronizations.size>0)this._queuedPlayerSynchronizations.clear();if(this._queuedSceneUISynchronizations.size>0)this._queuedSceneUISynchronizations.clear();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();y4.clearCachedPacketsSerializedBuffers()})}_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)}_subscribeToChunkLatticeEvents(){this._world.final("CHUNK_LATTICE.ADD_CHUNK",this._onChunkLatticeAddChunk),this._world.final("CHUNK_LATTICE.REMOVE_CHUNK",this._onChunkLatticeRemoveChunk),this._world.final("CHUNK_LATTICE.SET_BLOCK",this._onChunkLatticeSetBlock)}_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_MODEL_SCALE",this._onEntitySetModelScale),this._world.final("ENTITY.SET_MODEL_SHOWN_NODES",this._onEntitySetModelShownNodes),this._world.final("ENTITY.SET_MODEL_TEXTURE_URI",this._onEntitySetModelTextureUri),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)}_subscribeToParticleEmitterEvents(){this._world.final("PARTICLE_EMITTER.DESPAWN",this._onParticleEmitterDespawn),this._world.final("PARTICLE_EMITTER.BURST",this._onParticleEmitterBurst),this._world.final("PARTICLE_EMITTER.SET_ALPHA_TEST",this._onParticleEmitterSetAlphaTest),this._world.final("PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY",this._onParticleEmitterSetAttachedToEntity),this._world.final("PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY_NODE_NAME",this._onParticleEmitterSetAttachedToEntityNodeName),this._world.final("PARTICLE_EMITTER.SET_COLOR_END",this._onParticleEmitterSetColorEnd),this._world.final("PARTICLE_EMITTER.SET_COLOR_END_VARIANCE",this._onParticleEmitterSetColorEndVariance),this._world.final("PARTICLE_EMITTER.SET_COLOR_START",this._onParticleEmitterSetColorStart),this._world.final("PARTICLE_EMITTER.SET_COLOR_START_VARIANCE",this._onParticleEmitterSetColorStartVariance),this._world.final("PARTICLE_EMITTER.SET_GRAVITY",this._onParticleEmitterSetGravity),this._world.final("PARTICLE_EMITTER.SET_LIFETIME",this._onParticleEmitterSetLifetime),this._world.final("PARTICLE_EMITTER.SET_LIFETIME_VARIANCE",this._onParticleEmitterSetLifetimeVariance),this._world.final("PARTICLE_EMITTER.SET_MAX_PARTICLES",this._onParticleEmitterSetMaxParticles),this._world.final("PARTICLE_EMITTER.SET_OFFSET",this._onParticleEmitterSetOffset),this._world.final("PARTICLE_EMITTER.SET_OPACITY_END",this._onParticleEmitterSetOpacityEnd),this._world.final("PARTICLE_EMITTER.SET_OPACITY_END_VARIANCE",this._onParticleEmitterSetOpacityEndVariance),this._world.final("PARTICLE_EMITTER.SET_OPACITY_START",this._onParticleEmitterSetOpacityStart),this._world.final("PARTICLE_EMITTER.SET_OPACITY_START_VARIANCE",this._onParticleEmitterSetOpacityStartVariance),this._world.final("PARTICLE_EMITTER.SET_PAUSED",this._onParticleEmitterSetPaused),this._world.final("PARTICLE_EMITTER.SET_POSITION",this._onParticleEmitterSetPosition),this._world.final("PARTICLE_EMITTER.SET_POSITION_VARIANCE",this._onParticleEmitterSetPositionVariance),this._world.final("PARTICLE_EMITTER.SET_RATE",this._onParticleEmitterSetRate),this._world.final("PARTICLE_EMITTER.SET_RATE_VARIANCE",this._onParticleEmitterSetRateVariance),this._world.final("PARTICLE_EMITTER.SET_SIZE_END",this._onParticleEmitterSetSizeEnd),this._world.final("PARTICLE_EMITTER.SET_SIZE_END_VARIANCE",this._onParticleEmitterSetSizeEndVariance),this._world.final("PARTICLE_EMITTER.SET_SIZE_START",this._onParticleEmitterSetSizeStart),this._world.final("PARTICLE_EMITTER.SET_SIZE_START_VARIANCE",this._onParticleEmitterSetSizeStartVariance),this._world.final("PARTICLE_EMITTER.SET_TEXTURE_URI",this._onParticleEmitterSetTextureUri),this._world.final("PARTICLE_EMITTER.SET_TRANSPARENT",this._onParticleEmitterSetTransparent),this._world.final("PARTICLE_EMITTER.SET_VELOCITY",this._onParticleEmitterSetVelocity),this._world.final("PARTICLE_EMITTER.SET_VELOCITY_VARIANCE",this._onParticleEmitterSetVelocityVariance),this._world.final("PARTICLE_EMITTER.SPAWN",this._onParticleEmitterSpawn)}_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_MODEL_SHOWN_NODES",this._onPlayerCameraSetModelShownNodes),this._world.final("PLAYER_CAMERA.SET_MODE",this._onPlayerCameraSetMode),this._world.final("PLAYER_CAMERA.SET_OFFSET",this._onPlayerCameraSetOffset),this._world.final("PLAYER_CAMERA.SET_SHOULDER_ANGLE",this._onPlayerCameraSetShoulderAngle),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_FOG_COLOR",this._onWorldSetFogColor),this._world.final("WORLD.SET_FOG_FAR",this._onWorldSetFogFar),this._world.final("WORLD.SET_FOG_NEAR",this._onWorldSetFogNear),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.set(J.i,J)};_onAudioPlayRestart=(Z)=>{let J=Z.audio.serialize();J.r=!0,delete J.pa,delete J.pl,this._queuedAudioSynchronizations.set(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?D0.serializeVector(Z.position,this._world.tickAllocator):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.set(Z.blockType.id,J)};_onChatSendBroadcastMessage=(Z)=>{let J=this._world.tickAllocator,{player:X,message:Y,color:$}=Z,Q=J.getObject();Q.m=Y,Q.c=$,Q.p=X?.id;let W=J.getArray();W.push(Q),this._queuedBroadcasts.push(Y0.createPacket(Y0.outboundPackets.chatMessagesPacketDefinition,W,this._world.loop.currentTick,J.getArray()))};_onChatSendPlayerMessage=(Z)=>{let J=this._world.tickAllocator,{player:X,message:Y,color:$}=Z,Q=this._queuedPerPlayerSynchronizations.get(X)??[],W=J.getObject();W.m=Y,W.c=$;let K=J.getArray();K.push(W),Q.push(Y0.createPacket(Y0.outboundPackets.chatMessagesPacketDefinition,K,this._world.loop.currentTick,this._world.tickAllocator.getArray())),this._queuedPerPlayerSynchronizations.set(X,Q)};_onChunkLatticeAddChunk=(Z)=>{let J=this._createOrGetQueuedChunkSync(Z.chunk);J.b=this._world.tickAllocator.getArray(Z.chunk.blocks),J.rm=void 0,this._spawnedChunks.add(J.c.join(","))};_onChunkLatticeRemoveChunk=(Z)=>{let J=this._createOrGetQueuedChunkSync(Z.chunk),X=J.c.join(",");if(this._spawnedChunks.has(X))this._queuedChunkSynchronizations.delete(X),this._spawnedChunks.delete(X);else J.rm=!0};_onChunkLatticeSetBlock=(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.set(J.i,J),this._spawnedEntities.add(J.i)};_onEntityDespawn=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(this._spawnedEntities.has(J.i))this._queuedEntitySynchronizations.delete(J.i),this._spawnedEntities.delete(J.i);else J.rm=!0};_onEntitySetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.h=this._world.tickAllocator.getArray(Z.modelHiddenNodes)};_onEntitySetModelScale=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.s=Z.modelScale};_onEntitySetModelShownNodes=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.sn=this._world.tickAllocator.getArray(Z.modelShownNodes)};_onEntitySetModelTextureUri=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.mt=Z.modelTextureUri};_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?D0.serializeRgbColor(Z.tintColor,this._world.tickAllocator):void 0};_onEntityStartModelLoopedAnimations=(Z)=>{let J=this._world.tickAllocator,X=this._createOrGetQueuedEntitySync(Z.entity),Y=J.getSet(X.al,Z.animations);if(X.al=J.getArray(Y),X.as){let $=J.getArray();for(let Q of X.as)!Y.has(Q)&&$.push(Q);X.as=$}};_onEntityStartModelOneshotAnimations=(Z)=>{let J=this._world.tickAllocator,X=this._createOrGetQueuedEntitySync(Z.entity),Y=J.getSet(X.ao,Z.animations);if(X.ao=J.getArray(Y),X.as){let $=J.getArray();for(let Q of X.as)!Y.has(Q)&&$.push(Q);X.as=$}};_onEntityStopModelAnimations=(Z)=>{let J=this._world.tickAllocator,X=this._createOrGetQueuedEntitySync(Z.entity);if(X.al){let Y=J.getSet(X.al);for(let $ of Z.animations)Y.delete($);X.al=J.getArray(Y)}if(X.ao){let Y=J.getSet(X.ao);for(let $ of Z.animations)Y.delete($);X.ao=J.getArray(Y)}X.as=J.getArray(J.getSet(X.as,Z.animations))};_onEntityUpdateRotation=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.r=D0.serializeQuaternion(Z.rotation,this._world.tickAllocator)};_onEntityUpdatePosition=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.p=D0.serializeVector(Z.position,this._world.tickAllocator)};_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=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_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?D0.serializeVector(Z.offset,this._world.tickAllocator):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?D0.serializeVector(Z.position,this._world.tickAllocator):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?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,J.te=Z.position?void 0:J.te};_onLightSpawn=(Z)=>{let J=Z.light.serialize();this._queuedLightSynchronizations.set(J.i,J)};_onParticleEmitterBurst=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.b=Z.count};_onParticleEmitterDespawn=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.rm=!0};_onParticleEmitterSetAlphaTest=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.at=Z.alphaTest};_onParticleEmitterSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onParticleEmitterSetAttachedToEntityNodeName=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.en=Z.attachedToEntityNodeName};_onParticleEmitterSetColorEnd=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.ce=Z.colorEnd?D0.serializeRgbColor(Z.colorEnd,this._world.tickAllocator):void 0};_onParticleEmitterSetColorEndVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.cev=Z.colorEndVariance?D0.serializeRgbColor(Z.colorEndVariance,this._world.tickAllocator):void 0};_onParticleEmitterSetColorStart=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.cs=Z.colorStart?D0.serializeRgbColor(Z.colorStart,this._world.tickAllocator):void 0};_onParticleEmitterSetColorStartVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.csv=Z.colorStartVariance?D0.serializeRgbColor(Z.colorStartVariance,this._world.tickAllocator):void 0};_onParticleEmitterSetGravity=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.g=Z.gravity?D0.serializeVector(Z.gravity,this._world.tickAllocator):void 0};_onParticleEmitterSetLifetime=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.l=Z.lifetime};_onParticleEmitterSetLifetimeVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.lv=Z.lifetimeVariance};_onParticleEmitterSetMaxParticles=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.mp=Z.maxParticles};_onParticleEmitterSetOffset=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.o=Z.offset?D0.serializeVector(Z.offset,this._world.tickAllocator):void 0};_onParticleEmitterSetOpacityEnd=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.oe=Z.opacityEnd};_onParticleEmitterSetOpacityEndVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.oev=Z.opacityEndVariance};_onParticleEmitterSetOpacityStart=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.os=Z.opacityStart};_onParticleEmitterSetOpacityStartVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.osv=Z.opacityStartVariance};_onParticleEmitterSetPaused=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.pa=Z.paused};_onParticleEmitterSetPosition=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.p=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,J.e=Z.position?void 0:J.e,J.en=Z.position?void 0:J.en};_onParticleEmitterSetPositionVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.pv=Z.positionVariance?D0.serializeVector(Z.positionVariance,this._world.tickAllocator):void 0};_onParticleEmitterSetRate=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.r=Z.rate};_onParticleEmitterSetRateVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.rv=Z.rateVariance};_onParticleEmitterSetSizeEnd=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.se=Z.sizeEnd};_onParticleEmitterSetSizeEndVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.sev=Z.sizeEndVariance};_onParticleEmitterSetSizeStart=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.ss=Z.sizeStart};_onParticleEmitterSetSizeStartVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.ssv=Z.sizeStartVariance};_onParticleEmitterSetTextureUri=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.tu=Z.textureUri};_onParticleEmitterSetTransparent=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.t=Z.transparent};_onParticleEmitterSetVelocity=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.v=Z.velocity?D0.serializeVector(Z.velocity,this._world.tickAllocator):void 0};_onParticleEmitterSetVelocityVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.vv=Z.velocityVariance?D0.serializeVector(Z.velocityVariance,this._world.tickAllocator):void 0};_onParticleEmitterSpawn=(Z)=>{let J=Z.particleEmitter.serialize();this._queuedParticleEmitterSynchronizations.set(J.i,J)};_onPlayerCameraLookAtEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=D0.serializeVector(Z.entity.position,this._world.tickAllocator),delete J.et,delete J.pt};_onPlayerCameraLookAtPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):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?D0.serializeVector(Z.position,this._world.tickAllocator):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=this._world.tickAllocator.getArray(Z.modelHiddenNodes)};_onPlayerCameraSetModelShownNodes=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.s=this._world.tickAllocator.getArray(Z.modelShownNodes)};_onPlayerCameraSetMode=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.m=Z.mode};_onPlayerCameraSetOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.o=Z.offset?D0.serializeVector(Z.offset,this._world.tickAllocator):void 0};_onPlayerCameraSetShoulderAngle=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.sa=Z.shoulderAngle};_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?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,delete J.et,delete J.pl};_onPlayerCameraSetZoom=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.z=Z.zoom};_onPlayerJoinedWorld=(Z)=>{let J=this._world.tickAllocator,{player:X}=Z,Y=this._queuedPerPlayerSynchronizations.get(X)??J.getArray();Y.push(Y0.createPacket(Y0.outboundPackets.worldPacketDefinition,this._world.serialize(),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.blockTypesPacketDefinition,this._world.blockTypeRegistry.serialize(),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.chunksPacketDefinition,J.map(this._world.chunkLattice.getAllChunks(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,J.map(this._world.entityManager.getAllEntities(!0),(Q)=>{if(X.camera.attachedToEntity===void 0&&Q instanceof v7&&Q.player===X)X.camera.setAttachedToEntity(Q);return Q.serialize()}),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.audiosPacketDefinition,J.map(this._world.audioManager.getAllLoopedAudios(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.lightsPacketDefinition,J.map(this._world.lightManager.getAllLights(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.particleEmittersPacketDefinition,J.map(this._world.particleEmitterManager.getAllParticleEmitters(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.sceneUIsPacketDefinition,J.map(this._world.sceneUIManager.getAllSceneUIs(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.playersPacketDefinition,J.map(V9.instance.getConnectedPlayers(),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray()));let $=this._createOrGetQueuedPlayerCameraSync(X.camera);this._queuedPerPlayerCameraSynchronizations.set(X,J.getObject(X.camera.serialize(),$)),this._queuedPerPlayerSynchronizations.set(X,Y),this._queuedPlayerSynchronizations.set(X.id,X.serialize())};_onPlayerLeftWorld=(Z)=>{let J=this._createOrGetQueuedPlayerSync(Z.player);J.rm=!0};_onPlayerReconnectedWorld=(Z)=>{this._onPlayerJoinedWorld(Z)};_onPlayerRequestSync=(Z)=>{let J=this._world.tickAllocator,X=J.getObject();X.r=Z.receivedAt,X.s=Date.now(),X.p=performance.now()-Z.receivedAtMs,X.n=this._world.loop.nextTickMs,Z.player.connection.send([Y0.createPacket(Y0.outboundPackets.syncResponsePacketDefinition,X,this._world.loop.currentTick,J.getArray())])};_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.set(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?D0.serializeVector(Z.offset,this._world.tickAllocator):void 0};_onSceneUISetPosition=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.p=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):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))this._queuedSceneUISynchronizations.delete(J.i),this._loadedSceneUIs.delete(J.i);else J.rm=!0};_onSimulationDebugRaycast=(Z)=>{this._queuedDebugRaycastSynchronizations.push(D0.serializePhysicsDebugRaycast(Z,this._world.tickAllocator))};_onSimulationDebugRender=(Z)=>{this._queuedBroadcasts.push(Y0.createPacket(Y0.outboundPackets.physicsDebugRenderPacketDefinition,{v:Array.from(Z.vertices),c:Array.from(Z.colors)},this._world.loop.currentTick,this._world.tickAllocator.getArray()))};_onWorldSetAmbientLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ac=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_onWorldSetAmbientLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ai=Z.intensity};_onWorldSetDirectionalLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dc=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_onWorldSetDirectionalLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.di=Z.intensity};_onWorldSetDirectionalLightPosition=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dp=D0.serializeVector(Z.position,this._world.tickAllocator)};_onWorldSetFogColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.fc=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_onWorldSetFogFar=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ff=Z.far};_onWorldSetFogNear=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.fn=Z.near};_onWorldSetSkyboxIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.si=Z.intensity};_createOrGetQueuedAudioSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedAudioSync(): Audio has no id!");let J=this._queuedAudioSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedAudioSynchronizations.set(Z.id,J);return J}_createOrGetQueuedBlockSync(Z){let{x:J,y:X,z:Y}=Z,$=`${J},${X},${Y}`,Q=this._queuedBlockSynchronizations.get($);if(!Q)Q=this._world.tickAllocator.getObject(),Q.i=0,Q.c=[J,X,Y],this._queuedBlockSynchronizations.set($,Q);return Q}_createOrGetQueuedChunkSync(Z){if(!Z.originCoordinate)d.fatalError("NetworkSynchronizer._createOrGetQueuedChunkSync(): Chunk has no origin coordinate!");let{x:J,y:X,z:Y}=Z.originCoordinate,$=`${J},${X},${Y}`,Q=this._queuedChunkSynchronizations.get($);if(!Q)Q=this._world.tickAllocator.getObject(),Q.c=[J,X,Y],this._queuedChunkSynchronizations.set($,Q);return Q}_createOrGetQueuedEntitySync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedEntitySync(): Entity has no id!");let J=this._queuedEntitySynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedEntitySynchronizations.set(Z.id,J);return J}_createOrGetQueuedLightSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedLightSync(): Light has no id!");let J=this._queuedLightSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedLightSynchronizations.set(Z.id,J);return J}_createOrGetQueuedParticleEmitterSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedParticleEmitterSync(): ParticleEmitter has no id!");let J=this._queuedParticleEmitterSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedParticleEmitterSynchronizations.set(Z.id,J);return J}_createOrGetQueuedPlayerSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedPlayerSync(): Player has no id!");let J=this._queuedPlayerSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedPlayerSynchronizations.set(Z.id,J);return J}_createOrGetQueuedPlayerCameraSync(Z){let J=this._queuedPerPlayerCameraSynchronizations.get(Z.player);if(!J)J=this._world.tickAllocator.getObject(),this._queuedPerPlayerCameraSynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUISync(Z){let J=this._queuedPerPlayerUISynchronizations.get(Z.player);if(!J)J=this._world.tickAllocator.getObject(),this._queuedPerPlayerUISynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUIDatasSync(Z){let J=this._queuedPerPlayerUIDatasSynchronizations.get(Z.player);if(!J)J=this._world.tickAllocator.getArray(),this._queuedPerPlayerUIDatasSynchronizations.set(Z.player,J);return J}_createOrGetQueuedSceneUISync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedSceneUISync(): SceneUI has no id!");let J=this._queuedSceneUISynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedSceneUISynchronizations.set(Z.id,J);return J}_createOrGetQueuedWorldSync(Z){if(Z.id!==this._world.id)d.fatalError("NetworkSynchronizer._createOrGetQueuedWorldSync(): World does not match this network synchronizer world!");return this._queuedWorldSynchronization??=this._world.tickAllocator.getObject(),this._queuedWorldSynchronization.i=Z.id,this._queuedWorldSynchronization}_createOrGetSynchronizedPlayerReliablePackets(Z,J){let X=this._synchronizedPlayerReliablePackets.get(Z);if(!X)X=this._world.tickAllocator.getArray(J),this._synchronizedPlayerReliablePackets.set(Z,X);return X}}class KF{_particleEmitters=new Map;_nextParticleEmitterId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}despawnEntityAttachedParticleEmitters(Z){this.getAllEntityAttachedParticleEmitters(Z).forEach((J)=>{J.despawn()})}getAllParticleEmitters(Z=!1){return Z?this._world.tickAllocator.getArray(this._particleEmitters.values()):Array.from(this._particleEmitters.values())}getAllEntityAttachedParticleEmitters(Z){return this.getAllParticleEmitters().filter((J)=>J.attachedToEntity===Z)}registerParticleEmitter(Z){if(Z.id!==void 0)return Z.id;let J=this._nextParticleEmitterId;return this._particleEmitters.set(J,Z),this._nextParticleEmitterId++,J}unregisterParticleEmitter(Z){if(Z.id===void 0)return;this._particleEmitters.delete(Z.id)}}class GF{_sceneUIs=new Map;_nextSceneUIId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}getAllSceneUIs(Z=!1){return Z?this._world.tickAllocator.getArray(this._sceneUIs.values()):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)}}class zF{_allocatedArrays=[];_allocatedArray3Numbers=[];_allocatedArray4Numbers=[];_allocatedObjects=[];_allocatedSets=[];_arrayPool=[];_array3NumberPool=[];_array4NumberPool=[];_objectPool=[];_setPool=[];filter(Z,J){let X=this.getArray();for(let Y=0;Y<Z.length;Y++)if(J(Z[Y],Y,Z))X.push(Z[Y]);return X}getArray(Z,J){let X=this._arrayPool.pop()??[];X.length=0;let Y=0;if(Z)for(let $ of Z)X[Y++]=$;if(J)for(let $ of J)X[Y++]=$;return this._allocatedArrays.push(X),X}getArray3Number(Z){let J=this._array3NumberPool.pop()??[0,0,0];if(J[0]=J[1]=J[2]=0,Z){let X=0;for(let Y of Z){if(X>=3)break;J[X++]=Y}}return this._allocatedArray3Numbers.push(J),J}getArray4Number(Z){let J=this._array4NumberPool.pop()??[0,0,0,0];if(J[0]=J[1]=J[2]=J[3]=0,Z){let X=0;for(let Y of Z){if(X>=4)break;J[X++]=Y}}return this._allocatedArray4Numbers.push(J),J}getObject(Z,J){let X=this._objectPool.pop()??Object.create(null);for(let Y in X)delete X[Y];if(Z)Object.assign(X,Z);if(J)Object.assign(X,J);return this._allocatedObjects.push(X),X}getSet(Z,J){let X=this._setPool.pop()??new Set;if(X.clear(),Z)for(let Y of Z)X.add(Y);if(J)for(let Y of J)X.add(Y);return this._allocatedSets.push(X),X}map(Z,J){let X=this.getArray();X.length=Z.length;for(let Y=0;Y<Z.length;Y++)X[Y]=J(Z[Y],Y,Z);return X}reset(){for(let Z=0;Z<this._allocatedArrays.length;Z++)if(this._arrayPool.length<4096)this._arrayPool.push(this._allocatedArrays[Z]);for(let Z=0;Z<this._allocatedArray3Numbers.length;Z++)if(this._array3NumberPool.length<4096)this._array3NumberPool.push(this._allocatedArray3Numbers[Z]);for(let Z=0;Z<this._allocatedArray4Numbers.length;Z++)if(this._array4NumberPool.length<4096)this._array4NumberPool.push(this._allocatedArray4Numbers[Z]);for(let Z=0;Z<this._allocatedObjects.length;Z++)if(this._objectPool.length<4096)this._objectPool.push(this._allocatedObjects[Z]);for(let Z=0;Z<this._allocatedSets.length;Z++)if(this._setPool.length<1024)this._setPool.push(this._allocatedSets[Z]);this._allocatedArrays.length=0,this._allocatedArray3Numbers.length=0,this._allocatedArray4Numbers.length=0,this._allocatedObjects.length=0,this._allocatedSets.length=0}}var F46=2,U46=3;class HF{_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*U46,this._tickFunction=J,this._tickErrorCallback=X}get targetTicksPerSecond(){return this._targetTicksPerSecond}get fixedTimestepMs(){return this._fixedTimestepMs}get fixedTimestepS(){return this._fixedTimestepS}get isStarted(){return!!this._tickHandle}get nextTickMs(){return this._nextTickMs}start(){if(this._tickHandle)return;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)J8.startSpan({operation:"ticker_tick"},()=>{let Y=0;while(this._accumulatorMs>=this._fixedTimestepMs&&Y<F46)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;clearTimeout(this._tickHandle),this._tickHandle=null}_tick(Z){try{this._tickFunction(Z)}catch(J){if(J instanceof Error&&this._tickErrorCallback)this._tickErrorCallback(J);else d.warning(`Ticker._tick(): tick callback threw an error, but it was not an instance of Error. Error: ${J}`)}}}var l$1;((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"})(l$1||={});class VF extends j0{_currentTick=0;_ticker;_world;constructor(Z,J=ay){super();this._ticker=new HF(J,this._tick,this._onTickError),this._world=Z}get currentTick(){return this._currentTick}get isStarted(){return this._ticker.isStarted}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();J8.startSpan({operation:"world_tick",attributes:{serverPlayerCount:V9.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}},()=>{J8.startSpan({operation:"entities_tick"},()=>this._world.entityManager.tickEntities(Z)),J8.startSpan({operation:"simulation_step"},()=>this._world.simulation.step(Z)),J8.startSpan({operation:"entities_emit_updates"},()=>this._world.entityManager.checkAndEmitUpdates()),J8.startSpan({operation:"network_synchronize"},()=>this._world.networkSynchronizer.synchronize()),J8.startSpan({operation:"release_tick_allocation"},()=>this._world.tickAllocator.reset())}),this._currentTick++,this.emitWithWorld(this._world,"WORLD_LOOP.TICK_END",{worldLoop:this,tickDurationMs:performance.now()-J})};_onTickError=(Z)=>{d.error(`WorldLoop._onTickError(): Error: ${Z}`),this.emitWithWorld(this._world,"WORLD_LOOP.TICK_ERROR",{worldLoop:this,error:Z})}}var oy;((V)=>{V.SET_AMBIENT_LIGHT_COLOR="WORLD.SET_AMBIENT_LIGHT_COLOR";V.SET_AMBIENT_LIGHT_INTENSITY="WORLD.SET_AMBIENT_LIGHT_INTENSITY";V.SET_DIRECTIONAL_LIGHT_COLOR="WORLD.SET_DIRECTIONAL_LIGHT_COLOR";V.SET_DIRECTIONAL_LIGHT_INTENSITY="WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY";V.SET_DIRECTIONAL_LIGHT_POSITION="WORLD.SET_DIRECTIONAL_LIGHT_POSITION";V.SET_FOG_COLOR="WORLD.SET_FOG_COLOR";V.SET_FOG_FAR="WORLD.SET_FOG_FAR";V.SET_FOG_NEAR="WORLD.SET_FOG_NEAR";V.SET_SKYBOX_INTENSITY="WORLD.SET_SKYBOX_INTENSITY";V.START="WORLD.START";V.STOP="WORLD.STOP"})(oy||={});class qF extends j0{_id;_ambientLightColor;_ambientLightIntensity;_audioManager;_blockTypeRegistry;_chatManager;_chunkLattice;_directionalLightColor;_directionalLightIntensity;_directionalLightPosition;_entityManager;_fogColor;_fogFar;_fogNear;_lightManager;_loop;_name;_networkSynchronizer;_particleEmitterManager;_sceneUIManager;_simulation;_skyboxIntensity;_skyboxUri;_tag;_tickAllocator;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._fogColor=Z.fogColor,this._fogFar=Z.fogFar??550,this._fogNear=Z.fogNear??500,this._name=Z.name,this._skyboxIntensity=Z.skyboxIntensity??1,this._skyboxUri=Z.skyboxUri,this._tag=Z.tag,this._audioManager=new u3(this),this._blockTypeRegistry=new Fz(this),this._chatManager=new cz(this),this._chunkLattice=new lz(this),this._entityManager=new az(this),this._lightManager=new QF(this),this._loop=new VF(this,Z.tickRate),this._networkSynchronizer=new gR(this),this._particleEmitterManager=new KF(this),this._sceneUIManager=new GF(this),this._simulation=new WF(this,Z.tickRate,Z.gravity),this._tickAllocator=new zF,Z.map)this.loadMap(Z.map)}get id(){return this._id}get ambientLightColor(){return this._ambientLightColor}get ambientLightIntensity(){return this._ambientLightIntensity}get blockTypeRegistry(){return this._blockTypeRegistry}get chatManager(){return this._chatManager}get chunkLattice(){return this._chunkLattice}get directionalLightColor(){return this._directionalLightColor}get directionalLightIntensity(){return this._directionalLightIntensity}get directionalLightPosition(){return this._directionalLightPosition}get entityManager(){return this._entityManager}get fogColor(){return this._fogColor}get fogFar(){return this._fogFar}get fogNear(){return this._fogNear}get lightManager(){return this._lightManager}get loop(){return this._loop}get name(){return this._name}get networkSynchronizer(){return this._networkSynchronizer}get particleEmitterManager(){return this._particleEmitterManager}get sceneUIManager(){return this._sceneUIManager}get simulation(){return this._simulation}get skyboxIntensity(){return this._skyboxIntensity}get skyboxUri(){return this._skyboxUri}get audioManager(){return this._audioManager}get tag(){return this._tag}get tickAllocator(){return this._tickAllocator}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({isEnvironmental:!0,...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})}setFogColor(Z){this._fogColor=Z,this.emit("WORLD.SET_FOG_COLOR",{world:this,color:Z})}setFogFar(Z){this._fogFar=Z,this.emit("WORLD.SET_FOG_FAR",{world:this,far:Z})}setFogNear(Z){this._fogNear=Z,this.emit("WORLD.SET_FOG_NEAR",{world:this,near:Z})}setSkyboxIntensity(Z){this._skyboxIntensity=Z,this.emit("WORLD.SET_SKYBOX_INTENSITY",{world:this,intensity:Z})}start(){if(this._loop.isStarted)return;this._loop.start(),this.emit("WORLD.START",{world:this,startedAtMs:Date.now()})}stop(){if(!this._loop.isStarted)return;this._loop.stop(),this.emit("WORLD.STOP",{world:this,stoppedAtMs:Date.now()})}serialize(){return D0.serializeWorld(this,this._tickAllocator)}}var p$1;((J)=>J.WORLD_CREATED="WORLD_MANAGER.WORLD_CREATED")(p$1||={});class HY{static instance=new HY;_defaultWorld;_nextWorldId=1;_worlds=new Map;createWorld(Z){let J=new qF({...Z,id:this._nextWorldId++});return J.start(),this._worlds.set(J.id,J),j0.globalInstance.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}}var i$1;((Y)=>{Y.PLAYER_CONNECTED="PLAYER_MANAGER.PLAYER_CONNECTED";Y.PLAYER_DISCONNECTED="PLAYER_MANAGER.PLAYER_DISCONNECTED";Y.PLAYER_RECONNECTED="PLAYER_MANAGER.PLAYER_RECONNECTED"})(i$1||={});class V9{static instance=new V9;worldSelectionHandler;_connectionPlayers=new Map;constructor(){j0.globalInstance.on("CONNECTION.OPENED",({connection:Z,req:J})=>{this._onConnectionOpened(Z,J.session)}),j0.globalInstance.on("CONNECTION.DISCONNECTED",({connection:Z})=>{this._onConnectionDisconnected(Z)}),j0.globalInstance.on("CONNECTION.RECONNECTED",({connection:Z})=>{this._onConnectionReconnected(Z)}),j0.globalInstance.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()})}async _onConnectionOpened(Z,J){let X=new lW(Z,J);await X.loadInitialPersistedData(),this._connectionPlayers.set(Z,X),j0.globalInstance.emit("PLAYER_MANAGER.PLAYER_CONNECTED",{player:X});let Y=await this.worldSelectionHandler?.(X);X.joinWorld(Y??HY.instance.getDefaultWorld())}_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.reconnected(),j0.globalInstance.emit("PLAYER_MANAGER.PLAYER_RECONNECTED",{player:J});else d.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),j0.globalInstance.emit("PLAYER_MANAGER.PLAYER_DISCONNECTED",{player:J});else d.warning(`PlayerManager._onConnectionClosed(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}}Buffer.poolSize=134217728;var n$1;((X)=>{X.START="GAMESERVER.START";X.STOP="GAMESERVER.STOP"})(n$1||={});function w46(Z){Q1.init().then(()=>{return AQ.instance.modelRegistry.preloadModels()}).then(()=>{if(Z.length>0)Z(AQ.instance.worldManager.getDefaultWorld());else Z();AQ.instance.start()}).catch((J)=>{d.fatalError(`Failed to initialize the game engine, exiting. Error: ${J}`)})}class AQ{static _instance;_modelRegistry=k5.instance;_playerManager=V9.instance;_socket=m7.instance;_worldManager=HY.instance;_webServer=PK.instance;constructor(){}static get instance(){if(!this._instance)this._instance=new AQ;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(){j0.globalInstance.emit("GAMESERVER.START",{startedAtMs:performance.now()}),this._webServer.start()}}var v0=0.000001,G1=typeof Float32Array!=="undefined"?Float32Array:Array,WZ=Math.random;var T55=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 l8={};D9(l8,{transpose:()=>N46,subtract:()=>s$1,sub:()=>g46,str:()=>v46,set:()=>R46,scale:()=>k46,rotate:()=>T46,multiplyScalarAndAdd:()=>b46,multiplyScalar:()=>f46,multiply:()=>a$1,mul:()=>y46,invert:()=>D46,identity:()=>j46,fromValues:()=>M46,fromScaling:()=>I46,fromRotation:()=>E46,frob:()=>S46,exactEquals:()=>A46,equals:()=>h46,determinant:()=>C46,create:()=>B46,copy:()=>O46,clone:()=>L46,adjoint:()=>P46,add:()=>x46,LDU:()=>_46});function B46(){var Z=new G1(4);if(G1!=Float32Array)Z[1]=0,Z[2]=0;return Z[0]=1,Z[3]=1,Z}function L46(Z){var J=new G1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function O46(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function j46(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=1,Z}function M46(Z,J,X,Y){var $=new G1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function R46(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function N46(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 D46(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X*Q-$*Y;if(!W)return null;return W=1/W,Z[0]=Q*W,Z[1]=-Y*W,Z[2]=-$*W,Z[3]=X*W,Z}function P46(Z,J){var X=J[0];return Z[0]=J[3],Z[1]=-J[1],Z[2]=-J[2],Z[3]=X,Z}function C46(Z){return Z[0]*Z[3]-Z[2]*Z[1]}function a$1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=X[0],G=X[1],z=X[2],H=X[3];return Z[0]=Y*K+Q*G,Z[1]=$*K+W*G,Z[2]=Y*z+Q*H,Z[3]=$*z+W*H,Z}function T46(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+Q*K,Z[1]=$*G+W*K,Z[2]=Y*-K+Q*G,Z[3]=$*-K+W*G,Z}function k46(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=X[0],G=X[1];return Z[0]=Y*K,Z[1]=$*K,Z[2]=Q*G,Z[3]=W*G,Z}function E46(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 I46(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=J[1],Z}function v46(Z){return"mat2("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}function S46(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3])}function _46(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 x46(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 s$1(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 A46(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function h46(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(X-W)<=v0*Math.max(1,Math.abs(X),Math.abs(W))&&Math.abs(Y-K)<=v0*Math.max(1,Math.abs(Y),Math.abs(K))&&Math.abs($-G)<=v0*Math.max(1,Math.abs($),Math.abs(G))&&Math.abs(Q-z)<=v0*Math.max(1,Math.abs(Q),Math.abs(z))}function f46(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 b46(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 y46=a$1,g46=s$1;var r1={};D9(r1,{transpose:()=>i46,translate:()=>o46,subtract:()=>r$1,sub:()=>U76,str:()=>W76,set:()=>l46,scale:()=>t46,rotate:()=>r46,projection:()=>Q76,normalFromMat4:()=>$76,multiplyScalarAndAdd:()=>H76,multiplyScalar:()=>z76,multiply:()=>o$1,mul:()=>F76,invert:()=>n46,identity:()=>p46,fromValues:()=>c46,fromTranslation:()=>e46,fromScaling:()=>J76,fromRotation:()=>Z76,fromQuat:()=>Y76,fromMat4:()=>m46,fromMat2d:()=>X76,frob:()=>K76,exactEquals:()=>V76,equals:()=>q76,determinant:()=>s46,create:()=>ry,copy:()=>d46,clone:()=>u46,adjoint:()=>a46,add:()=>G76});function ry(){var Z=new G1(9);if(G1!=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 m46(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 u46(Z){var J=new G1(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 d46(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 c46(Z,J,X,Y,$,Q,W,K,G){var z=new G1(9);return z[0]=Z,z[1]=J,z[2]=X,z[3]=Y,z[4]=$,z[5]=Q,z[6]=W,z[7]=K,z[8]=G,z}function l46(Z,J,X,Y,$,Q,W,K,G,z){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z[4]=Q,Z[5]=W,Z[6]=K,Z[7]=G,Z[8]=z,Z}function p46(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 i46(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 n46(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=H*W-K*z,q=-H*Q+K*G,F=z*Q-W*G,U=X*V+Y*q+$*F;if(!U)return null;return U=1/U,Z[0]=V*U,Z[1]=(-H*Y+$*z)*U,Z[2]=(K*Y-$*W)*U,Z[3]=q*U,Z[4]=(H*X-$*G)*U,Z[5]=(-K*X+$*Q)*U,Z[6]=F*U,Z[7]=(-z*X+Y*G)*U,Z[8]=(W*X-Y*Q)*U,Z}function a46(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=J[4],K=J[5],G=J[6],z=J[7],H=J[8];return Z[0]=W*H-K*z,Z[1]=$*z-Y*H,Z[2]=Y*K-$*W,Z[3]=K*G-Q*H,Z[4]=X*H-$*G,Z[5]=$*Q-X*K,Z[6]=Q*z-W*G,Z[7]=Y*G-X*z,Z[8]=X*W-Y*Q,Z}function s46(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],W=Z[5],K=Z[6],G=Z[7],z=Z[8];return J*(z*Q-W*G)+X*(-z*$+W*K)+Y*(G*$-Q*K)}function o$1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=X[0],F=X[1],U=X[2],B=X[3],w=X[4],O=X[5],N=X[6],R=X[7],j=X[8];return Z[0]=q*Y+F*W+U*z,Z[1]=q*$+F*K+U*H,Z[2]=q*Q+F*G+U*V,Z[3]=B*Y+w*W+O*z,Z[4]=B*$+w*K+O*H,Z[5]=B*Q+w*G+O*V,Z[6]=N*Y+R*W+j*z,Z[7]=N*$+R*K+j*H,Z[8]=N*Q+R*G+j*V,Z}function o46(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=X[0],F=X[1];return Z[0]=Y,Z[1]=$,Z[2]=Q,Z[3]=W,Z[4]=K,Z[5]=G,Z[6]=q*Y+F*W+z,Z[7]=q*$+F*K+H,Z[8]=q*Q+F*G+V,Z}function r46(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=Math.sin(X),F=Math.cos(X);return Z[0]=F*Y+q*W,Z[1]=F*$+q*K,Z[2]=F*Q+q*G,Z[3]=F*W-q*Y,Z[4]=F*K-q*$,Z[5]=F*G-q*Q,Z[6]=z,Z[7]=H,Z[8]=V,Z}function t46(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 e46(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 Z76(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 J76(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 X76(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 Y76(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X+X,K=Y+Y,G=$+$,z=X*W,H=Y*W,V=Y*K,q=$*W,F=$*K,U=$*G,B=Q*W,w=Q*K,O=Q*G;return Z[0]=1-V-U,Z[3]=H-O,Z[6]=q+w,Z[1]=H+O,Z[4]=1-z-U,Z[7]=F-B,Z[2]=q-w,Z[5]=F+B,Z[8]=1-z-V,Z}function $76(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],B=J[13],w=J[14],O=J[15],N=X*K-Y*W,R=X*G-$*W,j=X*z-Q*W,P=Y*G-$*K,D=Y*z-Q*K,C=$*z-Q*G,T=H*B-V*U,k=H*w-q*U,x=H*O-F*U,S=V*w-q*B,A=V*O-F*B,I=q*O-F*w,v=N*I-R*A+j*S+P*x-D*k+C*T;if(!v)return null;return v=1/v,Z[0]=(K*I-G*A+z*S)*v,Z[1]=(G*x-W*I-z*k)*v,Z[2]=(W*A-K*x+z*T)*v,Z[3]=($*A-Y*I-Q*S)*v,Z[4]=(X*I-$*x+Q*k)*v,Z[5]=(Y*x-X*A-Q*T)*v,Z[6]=(B*C-w*D+O*P)*v,Z[7]=(w*j-U*C-O*R)*v,Z[8]=(U*D-B*j+O*N)*v,Z}function Q76(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 W76(Z){return"mat3("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+")"}function K76(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8])}function G76(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 r$1(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 z76(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 H76(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 V76(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 q76(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=Z[4],K=Z[5],G=Z[6],z=Z[7],H=Z[8],V=J[0],q=J[1],F=J[2],U=J[3],B=J[4],w=J[5],O=J[6],N=J[7],R=J[8];return Math.abs(X-V)<=v0*Math.max(1,Math.abs(X),Math.abs(V))&&Math.abs(Y-q)<=v0*Math.max(1,Math.abs(Y),Math.abs(q))&&Math.abs($-F)<=v0*Math.max(1,Math.abs($),Math.abs(F))&&Math.abs(Q-U)<=v0*Math.max(1,Math.abs(Q),Math.abs(U))&&Math.abs(W-B)<=v0*Math.max(1,Math.abs(W),Math.abs(B))&&Math.abs(K-w)<=v0*Math.max(1,Math.abs(K),Math.abs(w))&&Math.abs(G-O)<=v0*Math.max(1,Math.abs(G),Math.abs(O))&&Math.abs(z-N)<=v0*Math.max(1,Math.abs(z),Math.abs(N))&&Math.abs(H-R)<=v0*Math.max(1,Math.abs(H),Math.abs(R))}var F76=o$1,U76=r$1;var e0={};D9(e0,{transpose:()=>M76,translate:()=>P76,targetTo:()=>s76,subtract:()=>$Q1,sub:()=>$Z6,str:()=>o76,set:()=>j76,scale:()=>C76,rotateZ:()=>I76,rotateY:()=>E76,rotateX:()=>k76,rotate:()=>T76,perspectiveZO:()=>l76,perspectiveNO:()=>XQ1,perspectiveFromFieldOfView:()=>p76,perspective:()=>c76,orthoZO:()=>n76,orthoNO:()=>YQ1,ortho:()=>i76,multiplyScalarAndAdd:()=>ZZ6,multiplyScalar:()=>e76,multiply:()=>e$1,mul:()=>YZ6,lookAt:()=>a76,invert:()=>R76,identity:()=>t$1,getTranslation:()=>b76,getScaling:()=>JQ1,getRotation:()=>y76,frustum:()=>d76,fromZRotation:()=>h76,fromYRotation:()=>A76,fromXRotation:()=>x76,fromValues:()=>O76,fromTranslation:()=>v76,fromScaling:()=>S76,fromRotationTranslationScaleOrigin:()=>m76,fromRotationTranslationScale:()=>g76,fromRotationTranslation:()=>ZQ1,fromRotation:()=>_76,fromQuat2:()=>f76,fromQuat:()=>u76,frob:()=>r76,exactEquals:()=>JZ6,equals:()=>XZ6,determinant:()=>D76,create:()=>w76,copy:()=>L76,clone:()=>B76,adjoint:()=>N76,add:()=>t76});function w76(){var Z=new G1(16);if(G1!=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 B76(Z){var J=new G1(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 L76(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 O76(Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B){var w=new G1(16);return w[0]=Z,w[1]=J,w[2]=X,w[3]=Y,w[4]=$,w[5]=Q,w[6]=W,w[7]=K,w[8]=G,w[9]=z,w[10]=H,w[11]=V,w[12]=q,w[13]=F,w[14]=U,w[15]=B,w}function j76(Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B,w){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z[4]=Q,Z[5]=W,Z[6]=K,Z[7]=G,Z[8]=z,Z[9]=H,Z[10]=V,Z[11]=q,Z[12]=F,Z[13]=U,Z[14]=B,Z[15]=w,Z}function t$1(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=1,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=1,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function M76(Z,J){if(Z===J){var X=J[1],Y=J[2],$=J[3],Q=J[6],W=J[7],K=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]=W,Z[14]=K}else Z[0]=J[0],Z[1]=J[4],Z[2]=J[8],Z[3]=J[12],Z[4]=J[1],Z[5]=J[5],Z[6]=J[9],Z[7]=J[13],Z[8]=J[2],Z[9]=J[6],Z[10]=J[10],Z[11]=J[14],Z[12]=J[3],Z[13]=J[7],Z[14]=J[11],Z[15]=J[15];return Z}function R76(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],B=J[13],w=J[14],O=J[15],N=X*K-Y*W,R=X*G-$*W,j=X*z-Q*W,P=Y*G-$*K,D=Y*z-Q*K,C=$*z-Q*G,T=H*B-V*U,k=H*w-q*U,x=H*O-F*U,S=V*w-q*B,A=V*O-F*B,I=q*O-F*w,v=N*I-R*A+j*S+P*x-D*k+C*T;if(!v)return null;return v=1/v,Z[0]=(K*I-G*A+z*S)*v,Z[1]=($*A-Y*I-Q*S)*v,Z[2]=(B*C-w*D+O*P)*v,Z[3]=(q*D-V*C-F*P)*v,Z[4]=(G*x-W*I-z*k)*v,Z[5]=(X*I-$*x+Q*k)*v,Z[6]=(w*j-U*C-O*R)*v,Z[7]=(H*C-q*j+F*R)*v,Z[8]=(W*A-K*x+z*T)*v,Z[9]=(Y*x-X*A-Q*T)*v,Z[10]=(U*D-B*j+O*N)*v,Z[11]=(V*j-H*D-F*N)*v,Z[12]=(K*k-W*S-G*T)*v,Z[13]=(X*S-Y*k+$*T)*v,Z[14]=(B*R-U*P-w*N)*v,Z[15]=(H*P-V*R+q*N)*v,Z}function N76(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=J[4],K=J[5],G=J[6],z=J[7],H=J[8],V=J[9],q=J[10],F=J[11],U=J[12],B=J[13],w=J[14],O=J[15];return Z[0]=K*(q*O-F*w)-V*(G*O-z*w)+B*(G*F-z*q),Z[1]=-(Y*(q*O-F*w)-V*($*O-Q*w)+B*($*F-Q*q)),Z[2]=Y*(G*O-z*w)-K*($*O-Q*w)+B*($*z-Q*G),Z[3]=-(Y*(G*F-z*q)-K*($*F-Q*q)+V*($*z-Q*G)),Z[4]=-(W*(q*O-F*w)-H*(G*O-z*w)+U*(G*F-z*q)),Z[5]=X*(q*O-F*w)-H*($*O-Q*w)+U*($*F-Q*q),Z[6]=-(X*(G*O-z*w)-W*($*O-Q*w)+U*($*z-Q*G)),Z[7]=X*(G*F-z*q)-W*($*F-Q*q)+H*($*z-Q*G),Z[8]=W*(V*O-F*B)-H*(K*O-z*B)+U*(K*F-z*V),Z[9]=-(X*(V*O-F*B)-H*(Y*O-Q*B)+U*(Y*F-Q*V)),Z[10]=X*(K*O-z*B)-W*(Y*O-Q*B)+U*(Y*z-Q*K),Z[11]=-(X*(K*F-z*V)-W*(Y*F-Q*V)+H*(Y*z-Q*K)),Z[12]=-(W*(V*w-q*B)-H*(K*w-G*B)+U*(K*q-G*V)),Z[13]=X*(V*w-q*B)-H*(Y*w-$*B)+U*(Y*q-$*V),Z[14]=-(X*(K*w-G*B)-W*(Y*w-$*B)+U*(Y*G-$*K)),Z[15]=X*(K*q-G*V)-W*(Y*q-$*V)+H*(Y*G-$*K),Z}function D76(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3],Q=Z[4],W=Z[5],K=Z[6],G=Z[7],z=Z[8],H=Z[9],V=Z[10],q=Z[11],F=Z[12],U=Z[13],B=Z[14],w=Z[15],O=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,j=X*K-Y*W,P=X*G-$*W,D=Y*G-$*K,C=z*U-H*F,T=z*B-V*F,k=z*w-q*F,x=H*B-V*U,S=H*w-q*U,A=V*w-q*B;return O*A-N*S+R*x+j*k-P*T+D*C}function e$1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=J[8],q=J[9],F=J[10],U=J[11],B=J[12],w=J[13],O=J[14],N=J[15],R=X[0],j=X[1],P=X[2],D=X[3];return Z[0]=R*Y+j*K+P*V+D*B,Z[1]=R*$+j*G+P*q+D*w,Z[2]=R*Q+j*z+P*F+D*O,Z[3]=R*W+j*H+P*U+D*N,R=X[4],j=X[5],P=X[6],D=X[7],Z[4]=R*Y+j*K+P*V+D*B,Z[5]=R*$+j*G+P*q+D*w,Z[6]=R*Q+j*z+P*F+D*O,Z[7]=R*W+j*H+P*U+D*N,R=X[8],j=X[9],P=X[10],D=X[11],Z[8]=R*Y+j*K+P*V+D*B,Z[9]=R*$+j*G+P*q+D*w,Z[10]=R*Q+j*z+P*F+D*O,Z[11]=R*W+j*H+P*U+D*N,R=X[12],j=X[13],P=X[14],D=X[15],Z[12]=R*Y+j*K+P*V+D*B,Z[13]=R*$+j*G+P*q+D*w,Z[14]=R*Q+j*z+P*F+D*O,Z[15]=R*W+j*H+P*U+D*N,Z}function P76(Z,J,X){var Y=X[0],$=X[1],Q=X[2],W,K,G,z,H,V,q,F,U,B,w,O;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 W=J[0],K=J[1],G=J[2],z=J[3],H=J[4],V=J[5],q=J[6],F=J[7],U=J[8],B=J[9],w=J[10],O=J[11],Z[0]=W,Z[1]=K,Z[2]=G,Z[3]=z,Z[4]=H,Z[5]=V,Z[6]=q,Z[7]=F,Z[8]=U,Z[9]=B,Z[10]=w,Z[11]=O,Z[12]=W*Y+H*$+U*Q+J[12],Z[13]=K*Y+V*$+B*Q+J[13],Z[14]=G*Y+q*$+w*Q+J[14],Z[15]=z*Y+F*$+O*Q+J[15];return Z}function C76(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 T76(Z,J,X,Y){var $=Y[0],Q=Y[1],W=Y[2],K=Math.hypot($,Q,W),G,z,H,V,q,F,U,B,w,O,N,R,j,P,D,C,T,k,x,S,A,I,v,b;if(K<v0)return null;if(K=1/K,$*=K,Q*=K,W*=K,G=Math.sin(X),z=Math.cos(X),H=1-z,V=J[0],q=J[1],F=J[2],U=J[3],B=J[4],w=J[5],O=J[6],N=J[7],R=J[8],j=J[9],P=J[10],D=J[11],C=$*$*H+z,T=Q*$*H+W*G,k=W*$*H-Q*G,x=$*Q*H-W*G,S=Q*Q*H+z,A=W*Q*H+$*G,I=$*W*H+Q*G,v=Q*W*H-$*G,b=W*W*H+z,Z[0]=V*C+B*T+R*k,Z[1]=q*C+w*T+j*k,Z[2]=F*C+O*T+P*k,Z[3]=U*C+N*T+D*k,Z[4]=V*x+B*S+R*A,Z[5]=q*x+w*S+j*A,Z[6]=F*x+O*S+P*A,Z[7]=U*x+N*S+D*A,Z[8]=V*I+B*v+R*b,Z[9]=q*I+w*v+j*b,Z[10]=F*I+O*v+P*b,Z[11]=U*I+N*v+D*b,J!==Z)Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z}function k76(Z,J,X){var Y=Math.sin(X),$=Math.cos(X),Q=J[4],W=J[5],K=J[6],G=J[7],z=J[8],H=J[9],V=J[10],q=J[11];if(J!==Z)Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[4]=Q*$+z*Y,Z[5]=W*$+H*Y,Z[6]=K*$+V*Y,Z[7]=G*$+q*Y,Z[8]=z*$-Q*Y,Z[9]=H*$-W*Y,Z[10]=V*$-K*Y,Z[11]=q*$-G*Y,Z}function E76(Z,J,X){var Y=Math.sin(X),$=Math.cos(X),Q=J[0],W=J[1],K=J[2],G=J[3],z=J[8],H=J[9],V=J[10],q=J[11];if(J!==Z)Z[4]=J[4],Z[5]=J[5],Z[6]=J[6],Z[7]=J[7],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[0]=Q*$-z*Y,Z[1]=W*$-H*Y,Z[2]=K*$-V*Y,Z[3]=G*$-q*Y,Z[8]=Q*Y+z*$,Z[9]=W*Y+H*$,Z[10]=K*Y+V*$,Z[11]=G*Y+q*$,Z}function I76(Z,J,X){var Y=Math.sin(X),$=Math.cos(X),Q=J[0],W=J[1],K=J[2],G=J[3],z=J[4],H=J[5],V=J[6],q=J[7];if(J!==Z)Z[8]=J[8],Z[9]=J[9],Z[10]=J[10],Z[11]=J[11],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z[0]=Q*$+z*Y,Z[1]=W*$+H*Y,Z[2]=K*$+V*Y,Z[3]=G*$+q*Y,Z[4]=z*$-Q*Y,Z[5]=H*$-W*Y,Z[6]=V*$-K*Y,Z[7]=q*$-G*Y,Z}function v76(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 S76(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 _76(Z,J,X){var Y=X[0],$=X[1],Q=X[2],W=Math.hypot(Y,$,Q),K,G,z;if(W<v0)return null;return W=1/W,Y*=W,$*=W,Q*=W,K=Math.sin(J),G=Math.cos(J),z=1-G,Z[0]=Y*Y*z+G,Z[1]=$*Y*z+Q*K,Z[2]=Q*Y*z-$*K,Z[3]=0,Z[4]=Y*$*z-Q*K,Z[5]=$*$*z+G,Z[6]=Q*$*z+Y*K,Z[7]=0,Z[8]=Y*Q*z+$*K,Z[9]=$*Q*z-Y*K,Z[10]=Q*Q*z+G,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function x76(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 A76(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 h76(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 ZQ1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Y+Y,G=$+$,z=Q+Q,H=Y*K,V=Y*G,q=Y*z,F=$*G,U=$*z,B=Q*z,w=W*K,O=W*G,N=W*z;return Z[0]=1-(F+B),Z[1]=V+N,Z[2]=q-O,Z[3]=0,Z[4]=V-N,Z[5]=1-(H+B),Z[6]=U+w,Z[7]=0,Z[8]=q+O,Z[9]=U-w,Z[10]=1-(H+F),Z[11]=0,Z[12]=X[0],Z[13]=X[1],Z[14]=X[2],Z[15]=1,Z}function f76(Z,J){var X=new G1(3),Y=-J[0],$=-J[1],Q=-J[2],W=J[3],K=J[4],G=J[5],z=J[6],H=J[7],V=Y*Y+$*$+Q*Q+W*W;if(V>0)X[0]=(K*W+H*Y+G*Q-z*$)*2/V,X[1]=(G*W+H*$+z*Y-K*Q)*2/V,X[2]=(z*W+H*Q+K*$-G*Y)*2/V;else X[0]=(K*W+H*Y+G*Q-z*$)*2,X[1]=(G*W+H*$+z*Y-K*Q)*2,X[2]=(z*W+H*Q+K*$-G*Y)*2;return ZQ1(Z,J,X),Z}function b76(Z,J){return Z[0]=J[12],Z[1]=J[13],Z[2]=J[14],Z}function JQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[4],W=J[5],K=J[6],G=J[8],z=J[9],H=J[10];return Z[0]=Math.hypot(X,Y,$),Z[1]=Math.hypot(Q,W,K),Z[2]=Math.hypot(G,z,H),Z}function y76(Z,J){var X=new G1(3);JQ1(X,J);var Y=1/X[0],$=1/X[1],Q=1/X[2],W=J[0]*Y,K=J[1]*$,G=J[2]*Q,z=J[4]*Y,H=J[5]*$,V=J[6]*Q,q=J[8]*Y,F=J[9]*$,U=J[10]*Q,B=W+H+U,w=0;if(B>0)w=Math.sqrt(B+1)*2,Z[3]=0.25*w,Z[0]=(V-F)/w,Z[1]=(q-G)/w,Z[2]=(K-z)/w;else if(W>H&&W>U)w=Math.sqrt(1+W-H-U)*2,Z[3]=(V-F)/w,Z[0]=0.25*w,Z[1]=(K+z)/w,Z[2]=(q+G)/w;else if(H>U)w=Math.sqrt(1+H-W-U)*2,Z[3]=(q-G)/w,Z[0]=(K+z)/w,Z[1]=0.25*w,Z[2]=(V+F)/w;else w=Math.sqrt(1+U-W-H)*2,Z[3]=(K-z)/w,Z[0]=(q+G)/w,Z[1]=(V+F)/w,Z[2]=0.25*w;return Z}function g76(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2],K=J[3],G=$+$,z=Q+Q,H=W+W,V=$*G,q=$*z,F=$*H,U=Q*z,B=Q*H,w=W*H,O=K*G,N=K*z,R=K*H,j=Y[0],P=Y[1],D=Y[2];return Z[0]=(1-(U+w))*j,Z[1]=(q+R)*j,Z[2]=(F-N)*j,Z[3]=0,Z[4]=(q-R)*P,Z[5]=(1-(V+w))*P,Z[6]=(B+O)*P,Z[7]=0,Z[8]=(F+N)*D,Z[9]=(B-O)*D,Z[10]=(1-(V+U))*D,Z[11]=0,Z[12]=X[0],Z[13]=X[1],Z[14]=X[2],Z[15]=1,Z}function m76(Z,J,X,Y,$){var Q=J[0],W=J[1],K=J[2],G=J[3],z=Q+Q,H=W+W,V=K+K,q=Q*z,F=Q*H,U=Q*V,B=W*H,w=W*V,O=K*V,N=G*z,R=G*H,j=G*V,P=Y[0],D=Y[1],C=Y[2],T=$[0],k=$[1],x=$[2],S=(1-(B+O))*P,A=(F+j)*P,I=(U-R)*P,v=(F-j)*D,b=(1-(q+O))*D,m=(w+N)*D,n=(U+R)*C,o=(w-N)*C,Q0=(1-(q+B))*C;return Z[0]=S,Z[1]=A,Z[2]=I,Z[3]=0,Z[4]=v,Z[5]=b,Z[6]=m,Z[7]=0,Z[8]=n,Z[9]=o,Z[10]=Q0,Z[11]=0,Z[12]=X[0]+T-(S*T+v*k+n*x),Z[13]=X[1]+k-(A*T+b*k+o*x),Z[14]=X[2]+x-(I*T+m*k+Q0*x),Z[15]=1,Z}function u76(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X+X,K=Y+Y,G=$+$,z=X*W,H=Y*W,V=Y*K,q=$*W,F=$*K,U=$*G,B=Q*W,w=Q*K,O=Q*G;return Z[0]=1-V-U,Z[1]=H+O,Z[2]=q-w,Z[3]=0,Z[4]=H-O,Z[5]=1-z-U,Z[6]=F+B,Z[7]=0,Z[8]=q+w,Z[9]=F-B,Z[10]=1-z-V,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function d76(Z,J,X,Y,$,Q,W){var K=1/(X-J),G=1/($-Y),z=1/(Q-W);return Z[0]=Q*2*K,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=Q*2*G,Z[6]=0,Z[7]=0,Z[8]=(X+J)*K,Z[9]=($+Y)*G,Z[10]=(W+Q)*z,Z[11]=-1,Z[12]=0,Z[13]=0,Z[14]=W*Q*2*z,Z[15]=0,Z}function XQ1(Z,J,X,Y,$){var Q=1/Math.tan(J/2),W;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)W=1/(Y-$),Z[10]=($+Y)*W,Z[14]=2*$*Y*W;else Z[10]=-1,Z[14]=-2*Y;return Z}var c76=XQ1;function l76(Z,J,X,Y,$){var Q=1/Math.tan(J/2),W;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)W=1/(Y-$),Z[10]=$*W,Z[14]=$*Y*W;else Z[10]=-1,Z[14]=-Y;return Z}function p76(Z,J,X,Y){var $=Math.tan(J.upDegrees*Math.PI/180),Q=Math.tan(J.downDegrees*Math.PI/180),W=Math.tan(J.leftDegrees*Math.PI/180),K=Math.tan(J.rightDegrees*Math.PI/180),G=2/(W+K),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]=-((W-K)*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 YQ1(Z,J,X,Y,$,Q,W){var K=1/(J-X),G=1/(Y-$),z=1/(Q-W);return Z[0]=-2*K,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=-2*G,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=2*z,Z[11]=0,Z[12]=(J+X)*K,Z[13]=($+Y)*G,Z[14]=(W+Q)*z,Z[15]=1,Z}var i76=YQ1;function n76(Z,J,X,Y,$,Q,W){var K=1/(J-X),G=1/(Y-$),z=1/(Q-W);return Z[0]=-2*K,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=-2*G,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=z,Z[11]=0,Z[12]=(J+X)*K,Z[13]=($+Y)*G,Z[14]=Q*z,Z[15]=1,Z}function a76(Z,J,X,Y){var $,Q,W,K,G,z,H,V,q,F,U=J[0],B=J[1],w=J[2],O=Y[0],N=Y[1],R=Y[2],j=X[0],P=X[1],D=X[2];if(Math.abs(U-j)<v0&&Math.abs(B-P)<v0&&Math.abs(w-D)<v0)return t$1(Z);if(H=U-j,V=B-P,q=w-D,F=1/Math.hypot(H,V,q),H*=F,V*=F,q*=F,$=N*q-R*V,Q=R*H-O*q,W=O*V-N*H,F=Math.hypot($,Q,W),!F)$=0,Q=0,W=0;else F=1/F,$*=F,Q*=F,W*=F;if(K=V*W-q*Q,G=q*$-H*W,z=H*Q-V*$,F=Math.hypot(K,G,z),!F)K=0,G=0,z=0;else F=1/F,K*=F,G*=F,z*=F;return Z[0]=$,Z[1]=K,Z[2]=H,Z[3]=0,Z[4]=Q,Z[5]=G,Z[6]=V,Z[7]=0,Z[8]=W,Z[9]=z,Z[10]=q,Z[11]=0,Z[12]=-($*U+Q*B+W*w),Z[13]=-(K*U+G*B+z*w),Z[14]=-(H*U+V*B+q*w),Z[15]=1,Z}function s76(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2],K=Y[0],G=Y[1],z=Y[2],H=$-X[0],V=Q-X[1],q=W-X[2],F=H*H+V*V+q*q;if(F>0)F=1/Math.sqrt(F),H*=F,V*=F,q*=F;var U=G*q-z*V,B=z*H-K*q,w=K*V-G*H;if(F=U*U+B*B+w*w,F>0)F=1/Math.sqrt(F),U*=F,B*=F,w*=F;return Z[0]=U,Z[1]=B,Z[2]=w,Z[3]=0,Z[4]=V*w-q*B,Z[5]=q*U-H*w,Z[6]=H*B-V*U,Z[7]=0,Z[8]=H,Z[9]=V,Z[10]=q,Z[11]=0,Z[12]=$,Z[13]=Q,Z[14]=W,Z[15]=1,Z}function o76(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 r76(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 t76(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 $Q1(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 e76(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 ZZ6(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 JZ6(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 XZ6(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=Z[4],K=Z[5],G=Z[6],z=Z[7],H=Z[8],V=Z[9],q=Z[10],F=Z[11],U=Z[12],B=Z[13],w=Z[14],O=Z[15],N=J[0],R=J[1],j=J[2],P=J[3],D=J[4],C=J[5],T=J[6],k=J[7],x=J[8],S=J[9],A=J[10],I=J[11],v=J[12],b=J[13],m=J[14],n=J[15];return Math.abs(X-N)<=v0*Math.max(1,Math.abs(X),Math.abs(N))&&Math.abs(Y-R)<=v0*Math.max(1,Math.abs(Y),Math.abs(R))&&Math.abs($-j)<=v0*Math.max(1,Math.abs($),Math.abs(j))&&Math.abs(Q-P)<=v0*Math.max(1,Math.abs(Q),Math.abs(P))&&Math.abs(W-D)<=v0*Math.max(1,Math.abs(W),Math.abs(D))&&Math.abs(K-C)<=v0*Math.max(1,Math.abs(K),Math.abs(C))&&Math.abs(G-T)<=v0*Math.max(1,Math.abs(G),Math.abs(T))&&Math.abs(z-k)<=v0*Math.max(1,Math.abs(z),Math.abs(k))&&Math.abs(H-x)<=v0*Math.max(1,Math.abs(H),Math.abs(x))&&Math.abs(V-S)<=v0*Math.max(1,Math.abs(V),Math.abs(S))&&Math.abs(q-A)<=v0*Math.max(1,Math.abs(q),Math.abs(A))&&Math.abs(F-I)<=v0*Math.max(1,Math.abs(F),Math.abs(I))&&Math.abs(U-v)<=v0*Math.max(1,Math.abs(U),Math.abs(v))&&Math.abs(B-b)<=v0*Math.max(1,Math.abs(B),Math.abs(b))&&Math.abs(w-m)<=v0*Math.max(1,Math.abs(w),Math.abs(m))&&Math.abs(O-n)<=v0*Math.max(1,Math.abs(O),Math.abs(n))}var YZ6=e$1,$Z6=$Q1;var P1={};D9(P1,{str:()=>ZJ6,squaredLength:()=>xQ1,sqrLen:()=>zJ6,sqlerp:()=>FJ6,slerp:()=>cR,setAxisAngle:()=>CQ1,setAxes:()=>UJ6,set:()=>$J6,scale:()=>vQ1,rotationTo:()=>qJ6,rotateZ:()=>nZ6,rotateY:()=>iZ6,rotateX:()=>pZ6,random:()=>oZ6,pow:()=>sZ6,normalize:()=>Jg,multiply:()=>TQ1,mul:()=>WJ6,ln:()=>EQ1,lerp:()=>KJ6,length:()=>_Q1,len:()=>GJ6,invert:()=>rZ6,identity:()=>dZ6,getAxisAngle:()=>cZ6,getAngle:()=>lZ6,fromValues:()=>XJ6,fromMat3:()=>IQ1,fromEuler:()=>eZ6,exp:()=>kQ1,exactEquals:()=>HJ6,equals:()=>VJ6,dot:()=>SQ1,create:()=>Zg,copy:()=>YJ6,conjugate:()=>tZ6,clone:()=>JJ6,calculateW:()=>aZ6,add:()=>QJ6});var J1={};D9(J1,{zero:()=>IZ6,transformQuat:()=>PZ6,transformMat4:()=>NZ6,transformMat3:()=>DZ6,subtract:()=>WQ1,sub:()=>xZ6,str:()=>vZ6,squaredLength:()=>VQ1,squaredDistance:()=>HQ1,sqrLen:()=>yZ6,sqrDist:()=>bZ6,set:()=>KZ6,scaleAndAdd:()=>wZ6,scale:()=>UZ6,round:()=>FZ6,rotateZ:()=>kZ6,rotateY:()=>TZ6,rotateX:()=>CZ6,random:()=>RZ6,normalize:()=>ty,negate:()=>BZ6,multiply:()=>KQ1,mul:()=>AZ6,min:()=>VZ6,max:()=>qZ6,lerp:()=>OZ6,length:()=>QQ1,len:()=>ey,inverse:()=>LZ6,hermite:()=>jZ6,fromValues:()=>uR,forEach:()=>gZ6,floor:()=>HZ6,exactEquals:()=>SZ6,equals:()=>_Z6,dot:()=>dR,divide:()=>GQ1,div:()=>hZ6,distance:()=>zQ1,dist:()=>fZ6,cross:()=>FF,create:()=>mR,copy:()=>WZ6,clone:()=>QZ6,ceil:()=>zZ6,bezier:()=>MZ6,angle:()=>EZ6,add:()=>GZ6});function mR(){var Z=new G1(3);if(G1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function QZ6(Z){var J=new G1(3);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J}function QQ1(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function uR(Z,J,X){var Y=new G1(3);return Y[0]=Z,Y[1]=J,Y[2]=X,Y}function WZ6(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z}function KZ6(Z,J,X,Y){return Z[0]=J,Z[1]=X,Z[2]=Y,Z}function GZ6(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z}function WQ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z}function KQ1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z}function GQ1(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z[2]=J[2]/X[2],Z}function zZ6(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z[2]=Math.ceil(J[2]),Z}function HZ6(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z[2]=Math.floor(J[2]),Z}function VZ6(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 qZ6(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 FZ6(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z[2]=Math.round(J[2]),Z}function UZ6(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z}function wZ6(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 zQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return Math.hypot(X,Y,$)}function HQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return X*X+Y*Y+$*$}function VQ1(Z){var J=Z[0],X=Z[1],Y=Z[2];return J*J+X*X+Y*Y}function BZ6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z}function LZ6(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z[2]=1/J[2],Z}function ty(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 dR(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]}function FF(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=X[0],K=X[1],G=X[2];return Z[0]=$*G-Q*K,Z[1]=Q*W-Y*G,Z[2]=Y*K-$*W,Z}function OZ6(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z[2]=W+Y*(X[2]-W),Z}function jZ6(Z,J,X,Y,$,Q){var W=Q*Q,K=W*(2*Q-3)+1,G=W*(Q-2)+Q,z=W*(Q-1),H=W*(3-2*Q);return Z[0]=J[0]*K+X[0]*G+Y[0]*z+$[0]*H,Z[1]=J[1]*K+X[1]*G+Y[1]*z+$[1]*H,Z[2]=J[2]*K+X[2]*G+Y[2]*z+$[2]*H,Z}function MZ6(Z,J,X,Y,$,Q){var W=1-Q,K=W*W,G=Q*Q,z=K*W,H=3*Q*K,V=3*G*W,q=G*Q;return Z[0]=J[0]*z+X[0]*H+Y[0]*V+$[0]*q,Z[1]=J[1]*z+X[1]*H+Y[1]*V+$[1]*q,Z[2]=J[2]*z+X[2]*H+Y[2]*V+$[2]*q,Z}function RZ6(Z,J){J=J||1;var X=WZ()*2*Math.PI,Y=WZ()*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 NZ6(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=X[3]*Y+X[7]*$+X[11]*Q+X[15];return W=W||1,Z[0]=(X[0]*Y+X[4]*$+X[8]*Q+X[12])/W,Z[1]=(X[1]*Y+X[5]*$+X[9]*Q+X[13])/W,Z[2]=(X[2]*Y+X[6]*$+X[10]*Q+X[14])/W,Z}function DZ6(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 PZ6(Z,J,X){var Y=X[0],$=X[1],Q=X[2],W=X[3],K=J[0],G=J[1],z=J[2],H=$*z-Q*G,V=Q*K-Y*z,q=Y*G-$*K,F=$*q-Q*V,U=Q*H-Y*q,B=Y*V-$*H,w=W*2;return H*=w,V*=w,q*=w,F*=2,U*=2,B*=2,Z[0]=K+H+F,Z[1]=G+V+U,Z[2]=z+q+B,Z}function CZ6(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 TZ6(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 kZ6(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 EZ6(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=J[0],W=J[1],K=J[2],G=Math.sqrt(X*X+Y*Y+$*$),z=Math.sqrt(Q*Q+W*W+K*K),H=G*z,V=H&&dR(Z,J)/H;return Math.acos(Math.min(Math.max(V,-1),1))}function IZ6(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z}function vZ6(Z){return"vec3("+Z[0]+", "+Z[1]+", "+Z[2]+")"}function SZ6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]}function _Z6(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=J[0],W=J[1],K=J[2];return Math.abs(X-Q)<=v0*Math.max(1,Math.abs(X),Math.abs(Q))&&Math.abs(Y-W)<=v0*Math.max(1,Math.abs(Y),Math.abs(W))&&Math.abs($-K)<=v0*Math.max(1,Math.abs($),Math.abs(K))}var xZ6=WQ1,AZ6=KQ1,hZ6=GQ1,fZ6=zQ1,bZ6=HQ1,ey=QQ1,yZ6=VQ1,gZ6=function(){var Z=mR();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}}();function mZ6(){var Z=new G1(4);if(G1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function qQ1(Z){var J=new G1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function FQ1(Z,J,X,Y){var $=new G1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function UQ1(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function wQ1(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function BQ1(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 LQ1(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 OQ1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return Math.hypot(J,X,Y,$)}function jQ1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return J*J+X*X+Y*Y+$*$}function MQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X*X+Y*Y+$*$+Q*Q;if(W>0)W=1/Math.sqrt(W);return Z[0]=X*W,Z[1]=Y*W,Z[2]=$*W,Z[3]=Q*W,Z}function RQ1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}function NQ1(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2],K=J[3];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z[2]=W+Y*(X[2]-W),Z[3]=K+Y*(X[3]-K),Z}function DQ1(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function PQ1(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(X-W)<=v0*Math.max(1,Math.abs(X),Math.abs(W))&&Math.abs(Y-K)<=v0*Math.max(1,Math.abs(Y),Math.abs(K))&&Math.abs($-G)<=v0*Math.max(1,Math.abs($),Math.abs(G))&&Math.abs(Q-z)<=v0*Math.max(1,Math.abs(Q),Math.abs(z))}var k55=function(){var Z=mZ6();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=4;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Z[3]=J[K+3],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2],J[K+3]=Z[3];return J}}();function Zg(){var Z=new G1(4);if(G1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z[3]=1,Z}function dZ6(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=1,Z}function CQ1(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 cZ6(Z,J){var X=Math.acos(J[3])*2,Y=Math.sin(X/2);if(Y>v0)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 lZ6(Z,J){var X=SQ1(Z,J);return Math.acos(2*X*X-1)}function TQ1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=X[0],G=X[1],z=X[2],H=X[3];return Z[0]=Y*H+W*K+$*z-Q*G,Z[1]=$*H+W*G+Q*K-Y*z,Z[2]=Q*H+W*z+Y*G-$*K,Z[3]=W*H-Y*K-$*G-Q*z,Z}function pZ6(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+W*K,Z[1]=$*G+Q*K,Z[2]=Q*G-$*K,Z[3]=W*G-Y*K,Z}function iZ6(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G-Q*K,Z[1]=$*G+W*K,Z[2]=Q*G+Y*K,Z[3]=W*G-$*K,Z}function nZ6(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+$*K,Z[1]=$*G-Y*K,Z[2]=Q*G+W*K,Z[3]=W*G-Q*K,Z}function aZ6(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 kQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=Math.sqrt(X*X+Y*Y+$*$),K=Math.exp(Q),G=W>0?K*Math.sin(W)/W:0;return Z[0]=X*G,Z[1]=Y*G,Z[2]=$*G,Z[3]=K*Math.cos(W),Z}function EQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=Math.sqrt(X*X+Y*Y+$*$),K=W>0?Math.atan2(W,Q)/W:0;return Z[0]=X*K,Z[1]=Y*K,Z[2]=$*K,Z[3]=0.5*Math.log(X*X+Y*Y+$*$+Q*Q),Z}function sZ6(Z,J,X){return EQ1(Z,J),vQ1(Z,Z,X),kQ1(Z,Z),Z}function cR(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2],K=J[3],G=X[0],z=X[1],H=X[2],V=X[3],q,F,U,B,w;if(F=$*G+Q*z+W*H+K*V,F<0)F=-F,G=-G,z=-z,H=-H,V=-V;if(1-F>v0)q=Math.acos(F),U=Math.sin(q),B=Math.sin((1-Y)*q)/U,w=Math.sin(Y*q)/U;else B=1-Y,w=Y;return Z[0]=B*$+w*G,Z[1]=B*Q+w*z,Z[2]=B*W+w*H,Z[3]=B*K+w*V,Z}function oZ6(Z){var J=WZ(),X=WZ(),Y=WZ(),$=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 rZ6(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X*X+Y*Y+$*$+Q*Q,K=W?1/W:0;return Z[0]=-X*K,Z[1]=-Y*K,Z[2]=-$*K,Z[3]=Q*K,Z}function tZ6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z[3]=J[3],Z}function IQ1(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,W=($+2)%3;Y=Math.sqrt(J[$*3+$]-J[Q*3+Q]-J[W*3+W]+1),Z[$]=0.5*Y,Y=0.5/Y,Z[3]=(J[Q*3+W]-J[W*3+Q])*Y,Z[Q]=(J[Q*3+$]+J[$*3+Q])*Y,Z[W]=(J[W*3+$]+J[$*3+W])*Y}return Z}function eZ6(Z,J,X,Y){var $=0.5*Math.PI/180;J*=$,X*=$,Y*=$;var Q=Math.sin(J),W=Math.cos(J),K=Math.sin(X),G=Math.cos(X),z=Math.sin(Y),H=Math.cos(Y);return Z[0]=Q*G*H-W*K*z,Z[1]=W*K*H+Q*G*z,Z[2]=W*G*z-Q*K*H,Z[3]=W*G*H+Q*K*z,Z}function ZJ6(Z){return"quat("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}var JJ6=qQ1,XJ6=FQ1,YJ6=UQ1,$J6=wQ1,QJ6=BQ1,WJ6=TQ1,vQ1=LQ1,SQ1=RQ1,KJ6=NQ1,_Q1=OQ1,GJ6=_Q1,xQ1=jQ1,zJ6=xQ1,Jg=MQ1,HJ6=DQ1,VJ6=PQ1,qJ6=function(){var Z=mR(),J=uR(1,0,0),X=uR(0,1,0);return function(Y,$,Q){var W=dR($,Q);if(W<-0.999999){if(FF(Z,J,$),ey(Z)<0.000001)FF(Z,X,$);return ty(Z,Z),CQ1(Y,Z,Math.PI),Y}else if(W>0.999999)return Y[0]=0,Y[1]=0,Y[2]=0,Y[3]=1,Y;else return FF(Z,$,Q),Y[0]=Z[0],Y[1]=Z[1],Y[2]=Z[2],Y[3]=1+W,Jg(Y,Y)}}(),FJ6=function(){var Z=Zg(),J=Zg();return function(X,Y,$,Q,W,K){return cR(Z,Y,W,K),cR(J,$,Q,K),cR(X,Z,J,2*K*(1-K)),X}}(),UJ6=function(){var Z=ry();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],Jg(J,IQ1(J,Z))}}();var V1={};D9(V1,{zero:()=>mJ6,transformMat4:()=>bJ6,transformMat3:()=>fJ6,transformMat2d:()=>hJ6,transformMat2:()=>AJ6,subtract:()=>hQ1,sub:()=>pJ6,str:()=>uJ6,squaredLength:()=>uQ1,squaredDistance:()=>gQ1,sqrLen:()=>oJ6,sqrDist:()=>sJ6,set:()=>OJ6,scaleAndAdd:()=>TJ6,scale:()=>CJ6,round:()=>PJ6,rotate:()=>yJ6,random:()=>xJ6,normalize:()=>IJ6,negate:()=>kJ6,multiply:()=>fQ1,mul:()=>iJ6,min:()=>NJ6,max:()=>DJ6,lerp:()=>_J6,length:()=>mQ1,len:()=>lJ6,inverse:()=>EJ6,fromValues:()=>BJ6,forEach:()=>rJ6,floor:()=>RJ6,exactEquals:()=>dJ6,equals:()=>cJ6,dot:()=>vJ6,divide:()=>bQ1,div:()=>nJ6,distance:()=>yQ1,dist:()=>aJ6,cross:()=>SJ6,create:()=>AQ1,copy:()=>LJ6,clone:()=>wJ6,ceil:()=>MJ6,angle:()=>gJ6,add:()=>jJ6});function AQ1(){var Z=new G1(2);if(G1!=Float32Array)Z[0]=0,Z[1]=0;return Z}function wJ6(Z){var J=new G1(2);return J[0]=Z[0],J[1]=Z[1],J}function BJ6(Z,J){var X=new G1(2);return X[0]=Z,X[1]=J,X}function LJ6(Z,J){return Z[0]=J[0],Z[1]=J[1],Z}function OJ6(Z,J,X){return Z[0]=J,Z[1]=X,Z}function jJ6(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z}function hQ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z}function fQ1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z}function bQ1(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z}function MJ6(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z}function RJ6(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z}function NJ6(Z,J,X){return Z[0]=Math.min(J[0],X[0]),Z[1]=Math.min(J[1],X[1]),Z}function DJ6(Z,J,X){return Z[0]=Math.max(J[0],X[0]),Z[1]=Math.max(J[1],X[1]),Z}function PJ6(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z}function CJ6(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z}function TJ6(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z}function yQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return Math.hypot(X,Y)}function gQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return X*X+Y*Y}function mQ1(Z){var J=Z[0],X=Z[1];return Math.hypot(J,X)}function uQ1(Z){var J=Z[0],X=Z[1];return J*J+X*X}function kJ6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z}function EJ6(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z}function IJ6(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 vJ6(Z,J){return Z[0]*J[0]+Z[1]*J[1]}function SJ6(Z,J,X){var Y=J[0]*X[1]-J[1]*X[0];return Z[0]=Z[1]=0,Z[2]=Y,Z}function _J6(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 xJ6(Z,J){J=J||1;var X=WZ()*2*Math.PI;return Z[0]=Math.cos(X)*J,Z[1]=Math.sin(X)*J,Z}function AJ6(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 hJ6(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 fJ6(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 bJ6(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 yJ6(Z,J,X,Y){var $=J[0]-X[0],Q=J[1]-X[1],W=Math.sin(Y),K=Math.cos(Y);return Z[0]=$*K-Q*W+X[0],Z[1]=$*W+Q*K+X[1],Z}function gJ6(Z,J){var X=Z[0],Y=Z[1],$=J[0],Q=J[1],W=Math.sqrt(X*X+Y*Y)*Math.sqrt($*$+Q*Q),K=W&&(X*$+Y*Q)/W;return Math.acos(Math.min(Math.max(K,-1),1))}function mJ6(Z){return Z[0]=0,Z[1]=0,Z}function uJ6(Z){return"vec2("+Z[0]+", "+Z[1]+")"}function dJ6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]}function cJ6(Z,J){var X=Z[0],Y=Z[1],$=J[0],Q=J[1];return Math.abs(X-$)<=v0*Math.max(1,Math.abs(X),Math.abs($))&&Math.abs(Y-Q)<=v0*Math.max(1,Math.abs(Y),Math.abs(Q))}var lJ6=mQ1,pJ6=hQ1,iJ6=fQ1,nJ6=bQ1,aJ6=yQ1,sJ6=gQ1,oJ6=uQ1,rJ6=function(){var Z=AQ1();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=2;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1];return J}}();class fQ extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get determinant(){return l8.determinant(this)}get frobeniusNorm(){return l8.frob(this)}static create(){let Z=new fQ(0,0,0,0);return l8.identity(Z),Z}static fromRotation(Z){let J=fQ.create();return l8.fromRotation(J,Z),J}static fromScaling(Z){let J=fQ.create();return l8.fromScaling(J,Z),J}add(Z){return l8.add(this,this,Z),this}adjoint(){return l8.adjoint(this,this),this}clone(){return new fQ(this[0],this[1],this[2],this[3])}copy(Z){return l8.copy(this,Z),this}equals(Z){return l8.equals(this,Z)}exactEquals(Z){return l8.exactEquals(this,Z)}identity(){return l8.identity(this),this}invert(){return l8.invert(this,this),this}multiply(Z){return l8.mul(this,this,Z),this}multiplyScalar(Z){return l8.multiplyScalar(this,this,Z),this}rotate(Z){return l8.rotate(this,this,Z),this}subtract(Z){return l8.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]}][${this[2]},${this[3]}]`}transpose(){return l8.transpose(this,this),this}}class KZ extends Float32Array{constructor(Z,J,X,Y,$,Q,W,K,G){super([Z,J,X,Y,$,Q,W,K,G])}get determinant(){return r1.determinant(this)}get frobeniusNorm(){return r1.frob(this)}static create(){let Z=new KZ(0,0,0,0,0,0,0,0,0);return r1.identity(Z),Z}static fromMatrix4(Z){let J=KZ.create();return r1.fromMat4(J,Z),J}static fromQuaternion(Z){let J=KZ.create();return r1.fromQuat(J,Z),J}static fromRotation(Z){let J=KZ.create();return r1.fromRotation(J,Z),J}static fromScaling(Z){let J=KZ.create();return r1.fromScaling(J,Z),J}static fromTranslation(Z){let J=KZ.create();return r1.fromTranslation(J,Z),J}add(Z){return r1.add(this,this,Z),this}adjoint(){return r1.adjoint(this,this),this}clone(){return new KZ(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8])}copy(Z){return r1.copy(this,Z),this}equals(Z){return r1.equals(this,Z)}exactEquals(Z){return r1.exactEquals(this,Z)}identity(){return r1.identity(this),this}invert(){return r1.invert(this,this),this}multiply(Z){return r1.mul(this,this,Z),this}multiplyScalar(Z){return r1.multiplyScalar(this,this,Z),this}transformVector(Z){return Z.transformMatrix3(this)}projection(Z,J){return r1.projection(this,Z,J),this}rotate(Z){return r1.rotate(this,this,Z),this}subtract(Z){return r1.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 r1.transpose(this,this),this}}class j5 extends Float32Array{constructor(Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B){super([Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B])}get determinant(){return e0.determinant(this)}get frobeniusNorm(){return e0.frob(this)}static create(){let Z=new j5(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return e0.identity(Z),Z}static fromQuaternion(Z){let J=j5.create();return e0.fromQuat(J,Z),J}static fromRotation(Z,J){let X=j5.create();return e0.fromRotation(X,Z,J),X}static fromRotationTranslation(Z,J){let X=j5.create();return e0.fromRotationTranslation(X,Z,J),X}static fromRotationTranslationScale(Z,J,X){let Y=j5.create();return e0.fromRotationTranslationScale(Y,Z,J,X),Y}static fromRotationTranslationScaleOrigin(Z,J,X,Y){let $=j5.create();return e0.fromRotationTranslationScaleOrigin($,Z,J,X,Y),$}static fromScaling(Z){let J=j5.create();return e0.fromScaling(J,Z),J}static fromTranslation(Z){let J=j5.create();return e0.fromTranslation(J,Z),J}static fromXRotation(Z){let J=j5.create();return e0.fromXRotation(J,Z),J}static fromYRotation(Z){let J=j5.create();return e0.fromYRotation(J,Z),J}static fromZRotation(Z){let J=j5.create();return e0.fromZRotation(J,Z),J}add(Z){return e0.add(this,this,Z),this}adjoint(){return e0.adjoint(this,this),this}clone(){return new j5(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 e0.copy(this,Z),this}equals(Z){return e0.equals(this,Z)}exactEquals(Z){return e0.exactEquals(this,Z)}frustrum(Z,J,X,Y,$,Q){return e0.frustum(this,Z,J,X,Y,$,Q),this}identity(){return e0.identity(this),this}invert(){return e0.invert(this,this),this}lookAt(Z,J,X){return e0.lookAt(this,Z,J,X),this}multiply(Z){return e0.mul(this,this,Z),this}multiplyScalar(Z){return e0.multiplyScalar(this,this,Z),this}orthographic(Z,J,X,Y,$,Q){return e0.ortho(this,Z,J,X,Y,$,Q),this}perspective(Z,J,X,Y){return e0.perspective(this,Z,J,X,Y),this}rotate(Z,J){return e0.rotate(this,this,Z,J),this}rotateX(Z){return e0.rotateX(this,this,Z),this}rotateY(Z){return e0.rotateY(this,this,Z),this}rotateZ(Z){return e0.rotateZ(this,this,Z),this}scale(Z){return e0.scale(this,this,Z),this}subtract(Z){return e0.sub(this,this,Z),this}targetTo(Z,J,X){return e0.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 e0.translate(this,this,Z),this}transpose(){return e0.transpose(this,this),this}}class b3 extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get length(){return P1.length(this)}get squaredLength(){return P1.squaredLength(this)}get magnitude(){return P1.length(this)}get squaredMagnitude(){return P1.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=P1.fromEuler(new Float32Array(4),Z,J,X);return new b3(Y[0],Y[1],Y[2],Y[3])}static fromQuaternionLike(Z){return new b3(Z.x,Z.y,Z.z,Z.w)}clone(){return new b3(this.x,this.y,this.z,this.w)}conjugate(){return P1.conjugate(this,this),this}copy(Z){return P1.copy(this,Z),this}dot(Z){return P1.dot(this,Z)}exponential(){return P1.exp(this,this),this}equals(Z){return P1.equals(this,Z)}exactEquals(Z){return P1.exactEquals(this,Z)}getAngle(Z){return P1.getAngle(this,Z)}identity(){return P1.identity(this),this}invert(){return P1.invert(this,this),this}lerp(Z,J){return P1.lerp(this,this,Z,J),this}logarithm(){return P1.ln(this,this),this}multiply(Z){return P1.multiply(this,this,Z),this}transformVector(Z){return Z.transformQuaternion(this)}normalize(){return P1.normalize(this,this),this}power(Z){return P1.pow(this,this,Z),this}randomize(){return P1.random(this),this}rotateX(Z){return P1.rotateX(this,this,Z),this}rotateY(Z){return P1.rotateY(this,this,Z),this}rotateZ(Z){return P1.rotateZ(this,this,Z),this}scale(Z){return P1.scale(this,this,Z),this}setAxisAngle(Z,J){return P1.setAxisAngle(this,Z,J),this}slerp(Z,J){return P1.slerp(this,this,Z,J),this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}}class UF extends Float32Array{constructor(Z,J){super([Z,J])}get length(){return V1.length(this)}get squaredLength(){return V1.squaredLength(this)}get magnitude(){return V1.length(this)}get squaredMagnitude(){return V1.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}static create(){return new UF(0,0)}add(Z){return V1.add(this,this,Z),this}angle(Z){return V1.angle(this,Z)}ceil(){return V1.ceil(this,this),this}clone(){return new UF(this.x,this.y)}copy(Z){return V1.copy(this,Z),this}distance(Z){return V1.distance(this,Z)}divide(Z){return V1.divide(this,this,Z),this}dot(Z){return V1.dot(this,Z)}equals(Z){return V1.equals(this,Z)}exactEquals(Z){return V1.exactEquals(this,Z)}floor(){return V1.floor(this,this),this}invert(){return V1.inverse(this,this),this}lerp(Z,J){return V1.lerp(this,this,Z,J),this}max(Z){return V1.max(this,this,Z),this}min(Z){return V1.min(this,this,Z),this}multiply(Z){return V1.mul(this,this,Z),this}negate(){return V1.negate(this,this),this}normalize(){return V1.normalize(this,this),this}randomize(Z){return V1.random(this,Z),this}rotate(Z,J){return V1.rotate(this,this,Z,J),this}round(){return V1.round(this,this),this}scale(Z){return V1.scale(this,this,Z),this}scaleAndAdd(Z,J){return V1.scaleAndAdd(this,this,Z,J),this}subtract(Z){return V1.sub(this,this,Z),this}toString(){return`${this.x},${this.y}`}transformMatrix2(Z){return V1.transformMat2(this,this,Z),this}transformMatrix3(Z){return V1.transformMat3(this,this,Z),this}transformMatrix4(Z){return V1.transformMat4(this,this,Z),this}zero(){return V1.zero(this),this}}class y3 extends Float32Array{constructor(Z,J,X){super([Z,J,X])}get length(){return J1.length(this)}get squaredLength(){return J1.squaredLength(this)}get magnitude(){return J1.length(this)}get squaredMagnitude(){return J1.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 y3(0,0,0)}static fromVector3Like(Z){return new y3(Z.x,Z.y,Z.z)}add(Z){return J1.add(this,this,Z),this}ceil(){return J1.ceil(this,this),this}clone(){return new y3(this.x,this.y,this.z)}copy(Z){return J1.copy(this,Z),this}cross(Z){return J1.cross(this,this,Z),this}distance(Z){return J1.distance(this,Z)}divide(Z){return J1.div(this,this,Z),this}dot(Z){return J1.dot(this,Z)}equals(Z){return J1.equals(this,Z)}exactEquals(Z){return J1.exactEquals(this,Z)}floor(){return J1.floor(this,this),this}invert(){return J1.inverse(this,this),this}lerp(Z,J){return J1.lerp(this,this,Z,J),this}max(Z){return J1.max(this,this,Z),this}min(Z){return J1.min(this,this,Z),this}multiply(Z){return J1.mul(this,this,Z),this}negate(){return J1.negate(this,this),this}normalize(){return J1.normalize(this,this),this}randomize(Z){return J1.random(this,Z),this}rotateX(Z,J){return J1.rotateX(this,this,Z,J),this}rotateY(Z,J){return J1.rotateY(this,this,Z,J),this}rotateZ(Z,J){return J1.rotateZ(this,this,Z,J),this}round(){return J1.round(this,this),this}scale(Z){return J1.scale(this,this,Z),this}scaleAndAdd(Z,J){return J1.scaleAndAdd(this,this,Z,J),this}subtract(Z){return J1.sub(this,this,Z),this}toString(){return`${this.x},${this.y},${this.z}`}transformMatrix3(Z){return J1.transformMat3(this,this,Z),this}transformMatrix4(Z){return J1.transformMat4(this,this,Z),this}transformQuaternion(Z){return J1.transformQuat(this,this,Z),this}zero(){return J1.zero(this),this}}var C1=function(Z,J,X,Y){function $(Q){return Q instanceof X?Q:new X(function(W){W(Q)})}return new(X||(X=Promise))(function(Q,W){function K(H){try{z(Y.next(H))}catch(V){W(V)}}function G(H){try{z(Y.throw(H))}catch(V){W(V)}}function z(H){H.done?Q(H.value):$(H.value).then(K,G)}z((Y=Y.apply(Z,J||[])).next())})},R1=function(Z,J){var X={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},Y,$,Q,W=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return W.next=K(0),W.throw=K(1),W.return=K(2),typeof Symbol==="function"&&(W[Symbol.iterator]=function(){return this}),W;function K(z){return function(H){return G([z,H])}}function G(z){if(Y)throw new TypeError("Generator is already executing.");while(W&&(W=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(H){z=[6,H],$=0}finally{Y=Q=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},s5=function(Z,J){var X=typeof Symbol==="function"&&Z[Symbol.iterator];if(!X)return Z;var Y=X.call(Z),$,Q=[],W;try{while((J===void 0||J-- >0)&&!($=Y.next()).done)Q.push($.value)}catch(K){W={error:K}}finally{try{if($&&!$.done&&(X=Y.return))X.call(Y)}finally{if(W)throw W.error}}return Q},U4=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))},dQ1=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.")},A55=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 C1(this,void 0,void 0,function(){return R1(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 C1(this,void 0,void 0,function(){return R1(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 C1(this,void 0,void 0,function(){return R1(this,function(Y){return[2,J-X]})})},Z.maxComparatorNumber=function(J,X){return C1(this,void 0,void 0,function(){return R1(this,function(Y){return[2,X-J]})})},Z.defaultIsEqual=function(J,X){return C1(this,void 0,void 0,function(){return R1(this,function(Y){return[2,J===X]})})},Z.print=function(J){function X(H){var V=Z.getParentIndexOf(H);return Math.floor(Math.log2(V+1))}function Y(H,V){var q="";for(;V>0;--V)q+=H;return q}var $=0,Q=[],W=X(J.length-1)+2,K=0;while($<J.length){var G=X($)+1;if($===0)G=0;var z=String(J.get($));if(z.length>K)K=z.length;Q[G]=Q[G]||[],Q[G].push(z),$+=1}return Q.map(function(H,V){var q=Math.pow(2,W-V)-1;return Y(" ",Math.floor(q/2)*K)+H.map(function(F){var U=(K-F.length)/2;return Y(" ",Math.ceil(U))+F+Y(" ",Math.floor(U))}).join(Y(" ",q*K))}).join(`
486
486
  `)},Z.heapify=function(J,X){return C1(this,void 0,void 0,function(){var Y;return R1(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 C1(this,void 0,void 0,function(){var $;return R1(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 C1(this,void 0,void 0,function(){var $;return R1(this,function(Q){switch(Q.label){case 0:return $=new Z(Y),$.heapArray=U4([],s5(X),!1),[4,$.init()];case 1:return Q.sent(),[2,$.top(J)]}})})},Z.nsmallest=function(J,X,Y){return C1(this,void 0,void 0,function(){var $;return R1(this,function(Q){switch(Q.label){case 0:return $=new Z(Y),$.heapArray=U4([],s5(X),!1),[4,$.init()];case 1:return Q.sent(),[2,$.bottom(J)]}})})},Z.prototype.add=function(J){return C1(this,void 0,void 0,function(){return R1(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 C1(this,void 0,void 0,function(){var X,Y,$;return R1(this,function(Q){switch(Q.label){case 0:X=this.length,($=this.heapArray).push.apply($,U4([],s5(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 C1(this,arguments,void 0,function(J){if(J===void 0)J=1;return R1(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,U4([],s5(this.heapArray),!1)];else return[2,this._bottomN_push(~~J)]})})},Z.prototype.check=function(){return C1(this,void 0,void 0,function(){var J,X,Y,$,Q,W,K,G,z;return R1(this,function(H){switch(H.label){case 0:J=0,H.label=1;case 1:if(!(J<this.heapArray.length))return[3,10];X=this.heapArray[J],Y=this.getChildrenOf(J),H.label=2;case 2:H.trys.push([2,7,8,9]),$=(G=void 0,dQ1(Y)),Q=$.next(),H.label=3;case 3:if(Q.done)return[3,6];return W=Q.value,[4,this.compare(X,W)];case 4:if(H.sent()>0)return[2,X];H.label=5;case 5:return Q=$.next(),[3,3];case 6:return[3,9];case 7:return K=H.sent(),G={error:K},[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 C1(this,arguments,void 0,function(X,Y){var $,Q,W,K,G,z;if(Y===void 0)Y=Z.defaultIsEqual;return R1(this,function(H){switch(H.label){case 0:H.trys.push([0,5,6,7]),$=dQ1(this.heapArray),Q=$.next(),H.label=1;case 1:if(Q.done)return[3,4];return W=Q.value,[4,Y(W,X)];case 2:if(H.sent())return[2,!0];H.label=3;case 3:return Q=$.next(),[3,1];case 4:return[3,7];case 5:return K=H.sent(),G={error:K},[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 C1(this,void 0,void 0,function(){var X;return R1(this,function(Y){switch(Y.label){case 0:if(J)this.heapArray=U4([],s5(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 C1(this,void 0,void 0,function(){var J;return R1(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 C1(this,void 0,void 0,function(){return R1(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 C1(this,void 0,void 0,function(){var X;return R1(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=s5([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 C1(this,arguments,void 0,function(X,Y){var $,Q,W,K=this;if(Y===void 0)Y=Z.defaultIsEqual;return R1(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:W=Z.getChildrenIndexOf(Q).filter(function(z){return z<K.heapArray.length}),$.push.apply($,U4([],s5(W),!1)),G.label=12;case 12:return[3,3];case 13:return[2,!1]}})})},Z.prototype.replace=function(J){return C1(this,void 0,void 0,function(){var X;return R1(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 C1(this,arguments,void 0,function(J){if(J===void 0)J=1;return R1(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,U4([],s5(this.heapArray),!1)];else return[2,this._topN_push(~~J)]})})},Z.prototype.toArray=function(){return U4([],s5(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 R1(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 C1(this,void 0,void 0,function(){var X,Y,$,Q,K,W,K;return R1(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(K=Y;K>$;--K)Q.push(K);W=this.heapArray,G.label=2;case 2:if(!Q.length)return[3,6];return K=Q.shift(),[4,this.compare(W[K],X.peek())];case 3:if(!(G.sent()>0))return[3,5];return[4,X.replace(W[K])];case 4:if(G.sent(),K%2)Q.push(Z.getParentIndexOf(K));G.label=5;case 5:return[3,2];case 6:return[2,X.toArray()]}})})},Z.prototype._moveNode=function(J,X){var Y;Y=s5([this.heapArray[X],this.heapArray[J]],2),this.heapArray[J]=Y[0],this.heapArray[X]=Y[1]},Z.prototype._sortNodeDown=function(J){return C1(this,void 0,void 0,function(){var X,Y,$,Q,W,K;return R1(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,W=Y<X,!W)return[3,3];return[4,this.compare(this.heapArray[Y],this.heapArray[Q])];case 2:W=G.sent()<0,G.label=3;case 3:if(W)Q=Y;if(K=$<X,!K)return[3,5];return[4,this.compare(this.heapArray[$],this.heapArray[Q])];case 4:K=G.sent()<0,G.label=5;case 5:if(K)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 C1(this,void 0,void 0,function(){var X;return R1(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 C1(this,void 0,void 0,function(){var X,Y,$,Q;return R1(this,function(W){switch(W.label){case 0:X=new Z(this._invertedCompare),X.limit=J,Y=[0],$=this.heapArray,W.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 W.sent(),Y.push.apply(Y,U4([],s5(Z.getChildrenIndexOf(Q)),!1)),[3,6];case 3:return[4,this.compare($[Q],X.peek())];case 4:if(!(W.sent()<0))return[3,6];return[4,X.replace($[Q])];case 5:W.sent(),Y.push.apply(Y,U4([],s5(Z.getChildrenIndexOf(Q)),!1)),W.label=6;case 6:return[3,1];case 7:return[2,X.toArray()]}})})},Z.prototype._topN_fill=function(J){return C1(this,void 0,void 0,function(){var X,Y,$,Q,W,W;return R1(this,function(K){switch(K.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:K.sent(),$=Z.getParentIndexOf(J-1)+1,Q=[];for(W=$;W<J;++W)Q.push.apply(Q,U4([],s5(Z.getChildrenIndexOf(W).filter(function(G){return G<X.length})),!1));if((J-1)%2)Q.push(J);K.label=2;case 2:if(!Q.length)return[3,6];if(W=Q.shift(),!(W<X.length))return[3,5];return[4,this.compare(X[W],Y.peek())];case 3:if(!(K.sent()<0))return[3,5];return[4,Y.replace(X[W])];case 4:K.sent(),Q.push.apply(Q,U4([],s5(Z.getChildrenIndexOf(W)),!1)),K.label=5;case 5:return[3,2];case 6:return[2,Y.toArray()]}})})},Z.prototype._topN_heap=function(J){return C1(this,void 0,void 0,function(){var X,Y,$,Q,W;return R1(this,function(K){switch(K.label){case 0:X=this.clone(),Y=[],$=0,K.label=1;case 1:if(!($<J))return[3,4];return W=(Q=Y).push,[4,X.pop()];case 2:W.apply(Q,[K.sent()]),K.label=3;case 3:return++$,[3,1];case 4:return[2,Y]}})})},Z.prototype._topIdxOf=function(J){return C1(this,void 0,void 0,function(){var X,Y,$,Q;return R1(this,function(W){switch(W.label){case 0:if(!J.length)return[2,-1];X=0,Y=J[X],$=1,W.label=1;case 1:if(!($<J.length))return[3,4];return[4,this.compare(J[$],Y)];case 2:if(Q=W.sent(),Q<0)X=$,Y=J[$];W.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 C1(this,void 0,void 0,function(){var Y;return R1(this,function($){switch($.label){case 0:return Y=new Z(this.compare),[4,Y.init(J)];case 1:return $.sent(),[2,Y.peek()]}})})},Z}(),tJ6=function(Z,J){var X={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},Y,$,Q,W=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return W.next=K(0),W.throw=K(1),W.return=K(2),typeof Symbol==="function"&&(W[Symbol.iterator]=function(){return this}),W;function K(z){return function(H){return G([z,H])}}function G(z){if(Y)throw new TypeError("Generator is already executing.");while(W&&(W=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(H){z=[6,H],$=0}finally{Y=Q=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},P6=function(Z,J){var X=typeof Symbol==="function"&&Z[Symbol.iterator];if(!X)return Z;var Y=X.call(Z),$,Q=[],W;try{while((J===void 0||J-- >0)&&!($=Y.next()).done)Q.push($.value)}catch(K){W={error:K}}finally{try{if($&&!$.done&&(X=Y.return))X.call(Y)}finally{if(W)throw W.error}}return Q},M5=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 cQ1=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(H){var V=Z.getParentIndexOf(H);return Math.floor(Math.log2(V+1))}function Y(H,V){var q="";for(;V>0;--V)q+=H;return q}var $=0,Q=[],W=X(J.length-1)+2,K=0;while($<J.length){var G=X($)+1;if($===0)G=0;var z=String(J.get($));if(z.length>K)K=z.length;Q[G]=Q[G]||[],Q[G].push(z),$+=1}return Q.map(function(H,V){var q=Math.pow(2,W-V)-1;return Y(" ",Math.floor(q/2)*K)+H.map(function(F){var U=(K-F.length)/2;return Y(" ",Math.ceil(U))+F+Y(" ",Math.floor(U))}).join(Y(" ",q*K))}).join(`
487
487
  `)},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=M5([],P6(X),!1),$.init(),$.top(J)},Z.nsmallest=function(J,X,Y){var $=new Z(Y);return $.heapArray=M5([],P6(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,M5([],P6(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 M5([],P6(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=M5([],P6(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,M5([],P6(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 W=this.heapArray[Q];if(X(W,J))$.push(Q),Y.push.apply(Y,M5([],P6(Z.getChildrenIndexOf(Q)),!1));else if(this.compare(W,J)<=0)Y.push.apply(Y,M5([],P6(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=P6([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 W=Z.getChildrenIndexOf(Q).filter(function(K){return K<Y.heapArray.length});$.push.apply($,M5([],P6(W),!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 M5([],P6(this.heapArray),!1);else return this._topN_push(~~J)},Z.prototype.toArray=function(){return M5([],P6(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 tJ6(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 W=Y;W>$;--W)Q.push(W);var K=this.heapArray;while(Q.length){var W=Q.shift();if(this.compare(K[W],X.peek())>0){if(X.replace(K[W]),W%2)Q.push(Z.getParentIndexOf(W))}}return X.toArray()},Z.prototype._moveNode=function(J,X){var Y;Y=P6([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,M5([],P6(Z.getChildrenIndexOf(Q)),!1));else if(this.compare($[Q],X.peek())<0)X.replace($[Q]),Y.push.apply(Y,M5([],P6(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 W=$;W<J;++W)Q.push.apply(Q,M5([],P6(Z.getChildrenIndexOf(W).filter(function(K){return K<X.length})),!1));if((J-1)%2)Q.push(J);while(Q.length){var W=Q.shift();if(W<X.length){if(this.compare(X[W],Y.peek())<0)Y.replace(X[W]),Q.push.apply(Q,M5([],P6(Z.getChildrenIndexOf(W)),!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}();var lQ1=0.099856;class wF extends qY{faceSpeed=0;idleLoopedAnimations=[];idleLoopedAnimationsSpeed;jumpOneshotAnimations=[];moveLoopedAnimations=[];moveLoopedAnimationsSpeed;moveSpeed=0;_faceTarget;_jumpHeight=0;_moveCompletesWhenStuck=!1;_moveIgnoreAxes={};_moveStartMoveAnimations=!1;_moveStartIdleAnimationsOnCompletion=!0;_moveStoppingDistanceSquared=lQ1;_moveStuckAccumulatorMs=0;_moveStuckLastPosition;_moveTarget;_onFace;_onFaceComplete;_onMove;_onMoveComplete;_stopFaceRequested=!1;_stopMoveRequested=!1;constructor(Z={}){super();this.idleLoopedAnimations=Z.idleLoopedAnimations??this.idleLoopedAnimations,this.idleLoopedAnimationsSpeed=Z.idleLoopedAnimationsSpeed??this.idleLoopedAnimationsSpeed,this.jumpOneshotAnimations=Z.jumpOneshotAnimations??this.jumpOneshotAnimations,this.moveLoopedAnimations=Z.moveLoopedAnimations??this.moveLoopedAnimations,this.moveLoopedAnimationsSpeed=Z.moveLoopedAnimationsSpeed??this.moveLoopedAnimationsSpeed}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._moveCompletesWhenStuck=X?.moveCompletesWhenStuck??!1,this._moveIgnoreAxes=X?.moveIgnoreAxes??{},this._moveStartIdleAnimationsOnCompletion=X?.moveStartIdleAnimationsOnCompletion??!0,this._moveStartMoveAnimations=!0,this._moveStoppingDistanceSquared=X?.moveStoppingDistance?X.moveStoppingDistance**2:lQ1,this._moveTarget=Z,this._onMove=X?.moveCallback,this._onMoveComplete=X?.moveCompleteCallback,this._moveStuckAccumulatorMs=0,this._moveStuckLastPosition=void 0}stopFace(){this._stopFaceRequested=!0}stopMove(){this._stopMoveRequested=!0}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,W=!1;if(this._moveCompletesWhenStuck){if(this._moveStuckAccumulatorMs+=J,this._moveStuckAccumulatorMs>=500){if(this._moveStuckLastPosition){let K=Y.x-this._moveStuckLastPosition.x,G=Y.y-this._moveStuckLastPosition.y,z=Y.z-this._moveStuckLastPosition.z;W=Math.sqrt(K*K+G*G+z*z)<this.moveSpeed*0.1}this._moveStuckLastPosition=Y,this._moveStuckAccumulatorMs=0}}if(Q>this._moveStoppingDistanceSquared&&!this._stopMoveRequested&&!W){let K=Math.sqrt(Q),G=this.moveSpeed*X,H=Math.min(K,G)/K,V={x:Y.x+$.x*H,y:Y.y+$.y*H,z:Y.z+$.z*H};if(Z.setPosition(V),this._onMove)this._onMove(V,this._moveTarget)}else{if(this._moveStuckAccumulatorMs=0,this._moveStuckLastPosition=void 0,this._moveTarget=void 0,this._stopMoveRequested=!1,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),W=Z.rotation,K=Math.atan2(2*(W.w*W.y),1-2*(W.y*W.y)),G=Q-K;while(G>Math.PI)G-=2*Math.PI;while(G<-Math.PI)G+=2*Math.PI;if(Math.abs(G)>0.01&&!this._stopFaceRequested){let z=this.faceSpeed*X,H=Math.abs(G)<z?G:Math.sign(G)*z,q=(K+H)/2,F={x:0,y:Math.fround(Math.sin(q)),z:0,w:Math.fround(Math.cos(q))};if(Z.setRotation(F),this._onFace)this._onFace(W,F)}else if(this._faceTarget=void 0,this._stopFaceRequested=!1,this._onFaceComplete){let z=this._onFaceComplete;this._onFace=void 0,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 Xg extends wF{_debug=!1;_entity;_maxFall=0;_maxJump=0;_maxOpenSetIterations=200;_onPathfindAbort;_onPathfindComplete;_onWaypointMoveComplete;_onWaypointMoveSkipped;_speed=0;_target;_verticalPenalty=0;_waypoints=[];_waypointNextIndex=0;_waypointStoppingDistance;_waypointTimeoutMs=2000;constructor(Z={}){super(Z)}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._waypointStoppingDistance=X?.waypointStoppingDistance,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}_calculatePath(){if(!this._target||!this._entity?.world)return d.error("PathfindingEntityController._calculatePath: No target or world"),!1;let Z=this._entity.height,J=this._findGroundedStart();if(!J){if(this._debug)d.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 K=this._coordinateToKey(J),G=new Map,z=new Map([[K,0]]),H=new Map([[K,this._pathfindingHeuristic(J,X)]]),V=new Set,q=new cQ1((R,j)=>{let P=H.get(R[0])??1/0,D=H.get(j[0])??1/0;return P-D});q.push([K,J]);let F=[{x:0,y:0,z:1},{x:1,y:0,z:0},{x:0,y:0,z:-1},{x:-1,y:0,z:0},{x:1,y:0,z:1},{x:1,y:0,z:-1},{x:-1,y:0,z:1},{x:-1,y:0,z:-1}],U=[];for(let R=this._maxJump;R>=this._maxFall;R--){if(R===0)continue;let j=Math.abs(J.y+R-X.y);U.push({y:R,distanceToTargetY:j})}U.sort((R,j)=>R.distanceToTargetY-j.distanceToTargetY);let B=[...F,...U.flatMap(({y:R})=>F.map((j)=>({...j,y:R})))],w=0,O=Math.abs(X.x-J.x)+Math.abs(X.y-J.y)+Math.abs(X.z-J.z),N=Math.min(this._maxOpenSetIterations,O*20);while(!q.isEmpty()&&w<N){w++;let[R,j]=q.pop();if(j.x===X.x&&j.y===X.y&&j.z===X.z){let C=this._reconstructPath(G,j);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 ${w} open set iterations. Start: ${this._coordinateToKey(J)}, Target: ${this._coordinateToKey(this._target)}`);return!0}V.add(R);let P=z.get(R),D=new Map;for(let C of B){let T=`${C.x},${C.z}`,k=C.y<0;if(k&&D.has(T))continue;let x={x:j.x+C.x,y:j.y+C.y,z:j.z+C.z};if(Math.abs(X.x-x.x)+Math.abs(X.y-x.y)+Math.abs(X.z-x.z)>O*1.5)continue;let A=this._coordinateToKey(x);if(V.has(A))continue;let I=this._isNeighborCoordinateBlocked(j,x,this._entity.height);if(k&&I){D.set(T,!0);continue}if(I)continue;let v=Math.abs(C.x),b=Math.abs(C.y),m=Math.abs(C.z),n=b===0?0:this._verticalPenalty,o=(Math.max(v,b,m)===1&&v+b+m>1?1.4:1)+n,Q0=P+o,K0=z.get(A)??1/0;if(Q0>=K0)continue;G.set(A,j),z.set(A,Q0);let _0=Q0+this._pathfindingHeuristic(x,X);H.set(A,_0),q.push([A,x])}}if(w>=N){if(this._onPathfindAbort?.(),this._debug)d.warning(`PathfindingEntityController._calculatePath: Maximum open set iterations reached (${N}), path search aborted. Start: ${this._coordinateToKey(J)}, Target: ${this._coordinateToKey(this._target)}`)}else if(this._debug)d.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),W=Math.sqrt(2*Q*$),K=Z.x+0.5,G=Z.z+0.5,z=J.x+0.5,H=J.z+0.5,V=z-K,q=H-G,F=Math.sqrt(V*V+q*q),U=W/Q,B=F/this._speed;X=Math.min(U*0.8,B)*1000}setTimeout(()=>{if(!this._entity)return;let Y=Date.now();this.face(J,this._speed),this.move(J,this._speed,{moveCompletesWhenStuck:!0,moveIgnoreAxes:{y:this._entity.isDynamic},moveStartIdleAnimationsOnCompletion:this._waypointNextIndex===this._waypoints.length-1,moveStoppingDistance:this._waypointStoppingDistance,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),W=Math.floor(J.z),K=Math.floor(Z.x),G=Math.floor(Z.z);if(!Y.chunkLattice.hasBlock({x:$,y:Q-1,z:W}))return!0;for(let z=0;z<X;z++)if(Y.chunkLattice.hasBlock({x:$,y:Q+z,z:W}))return!0;if($!==K&&W!==G)for(let z=0;z<X;z++){let H=Y.chunkLattice.hasBlock({x:$,y:Q+z,z:G}),V=Y.chunkLattice.hasBlock({x:K,y:Q+z,z:W});if(H||V)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{w46 as startServer,p$1 as WorldManagerEvent,HY as WorldManager,l$1 as WorldLoopEvent,VF as WorldLoop,oy as WorldEvent,qF as World,TS as WebServerEvent,PK as WebServer,y3 as Vector3,UF as Vector2,HF as Ticker,zF as TickAllocator,xQ as TelemetrySpanOperation,J8 as Telemetry,sy as SimulationEvent,WF as Simulation,wF as SimpleEntityController,GF as SceneUIManager,pE as SceneUIEvent,nz as SceneUI,L80 as SUPPORTED_INPUT_KEYS,Vz as RigidBodyType,tY as RigidBody,b3 as Quaternion,TB as PlayerUIEvent,uz as PlayerUI,i$1 as PlayerManagerEvent,V9 as PlayerManager,dz as PlayerEvent,v7 as PlayerEntity,B80 as PlayerCameraMode,uE as PlayerCameraEvent,mz as PlayerCamera,lW as Player,W$ as PersistenceManager,Xg as PathfindingEntityController,KF as ParticleEmitterManager,iy as ParticleEmitterEvent,ny as ParticleEmitter,PS as PORT,N80 as PLAYER_ROTATION_UPDATE_THRESHOLD,R80 as PLAYER_POSITION_UPDATE_THRESHOLD_SQ,k5 as ModelRegistry,j5 as Matrix4,KZ as Matrix3,fQ as Matrix2,c$1 as LightType,QF as LightManager,ly as LightEvent,py as Light,F6 as IterationMap,n$1 as GameServerEvent,AQ as GameServer,j0 as EventRouter,d as ErrorHandler,az as EntityManager,iz as EntityEvent,a8 as Entity,M80 as ENTITY_ROTATION_UPDATE_THRESHOLD,j80 as ENTITY_POSITION_UPDATE_THRESHOLD_SQ,g1 as DefaultPlayerEntityController,iE as DefaultPlayerEntity,O80 as DEFAULT_ENTITY_RIGID_BODY_OPTIONS,j4 as CollisionGroupsBuilder,BY as CollisionGroup,qz as ColliderShape,pz as ColliderMap,$9 as Collider,Wk as CoefficientCombineRule,lE as ChunkLatticeEvent,lz as ChunkLattice,K9 as Chunk,cz as ChatManager,dE as ChatEvent,Gk as BlockTypeRegistryEvent,Fz as BlockTypeRegistry,Kk as BlockTypeEvent,Q9 as BlockType,gQ as Block,zg as BaseEntityControllerEvent,qY as BaseEntityController,u3 as AudioManager,iR as AudioEvent,m3 as Audio};