hytopia 0.8.6-devtrace-34d95d5 → 0.8.6-devtrace-6d51c5e

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
@@ -401,7 +401,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
401
401
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
402
402
  if (condition) { yield value; }`)};import{Buffer as Tq1}from"buffer";import{StringDecoder as kq1}from"string_decoder";var y2=(Z,J,X)=>{if(X)return;if(Z)return{transform:Eq1.bind(void 0,new TextEncoder)};let Y=new kq1(J);return{transform:Iq1.bind(void 0,Y),final:vq1.bind(void 0,Y)}},Eq1=function*(Z,J){if(Tq1.isBuffer(J))yield TZ(J);else if(typeof J==="string")yield Z.encode(J);else yield J},Iq1=function*(Z,J){yield n8(J)?Z.write(J):J},vq1=function*(Z){let J=Z.end();if(J!=="")yield J};import{callbackify as Rl}from"util";var _P=Rl(async(Z,J,X,Y)=>{J.currentIterable=Z(...X);try{for await(let $ of J.currentIterable)Y.push($)}finally{delete J.currentIterable}}),g2=async function*(Z,J,X){if(X===J.length){yield Z;return}let{transform:Y=_q1}=J[X];for await(let $ of Y(Z))yield*g2($,J,X+1)},Nl=async function*(Z){for(let[J,{final:X}]of Object.entries(Z))yield*Sq1(X,Number(J),Z)},Sq1=async function*(Z,J,X){if(Z===void 0)return;for await(let Y of Z())yield*g2(Y,X,J+1)},Dl=Rl(async({currentIterable:Z},J)=>{if(Z!==void 0){await(J?Z.throw(J):Z.return());return}if(J)throw J}),_q1=function*(Z){yield Z};var AP=(Z,J,X,Y)=>{try{for(let $ of Z(...J))X.push($);Y()}catch($){Y($)}},Pl=(Z,J)=>[...J.flatMap((X)=>[...Z$(X,Z,0)]),...fG(Z)],Z$=function*(Z,J,X){if(X===J.length){yield Z;return}let{transform:Y=xq1}=J[X];for(let $ of Y(Z))yield*Z$($,J,X+1)},fG=function*(Z){for(let[J,{final:X}]of Object.entries(Z))yield*Aq1(X,Number(J),Z)},Aq1=function*(Z,J,X){if(Z===void 0)return;for(let Y of Z())yield*Z$(Y,X,J+1)},xq1=function*(Z){yield Z};var xP=({value:Z,value:{transform:J,final:X,writableObjectMode:Y,readableObjectMode:$},optionName:Q},{encoding:W})=>{let K={},G=Tl(Z,W,Q),z=eY(J),H=eY(X),V=z?_P.bind(void 0,g2,K):AP.bind(void 0,Z$),q=z||H?_P.bind(void 0,Nl,K):AP.bind(void 0,fG),F=z||H?Dl.bind(void 0,K):void 0;return{stream:new hq1({writableObjectMode:Y,writableHighWaterMark:Cl(Y),readableObjectMode:$,readableHighWaterMark:Cl($),transform(B,w,j){V([B,G,0],this,j)},flush(B){q([G],this,B)},destroy:F})}},m2=(Z,J,X,Y)=>{let $=J.filter(({type:W})=>W==="generator"),Q=Y?$.reverse():$;for(let{value:W,optionName:K}of Q){let G=Tl(W,X,K);Z=Pl(G,Z)}return Z},Tl=({transform:Z,final:J,binary:X,writableObjectMode:Y,readableObjectMode:$,preserveNewlines:Q},W,K)=>{let G={};return[{transform:jl(Y,K)},y2(X,W,Y),b2(X,Q,Y,G),{transform:Z,final:J},{transform:Ol($,K)},Ll({binary:X,preserveNewlines:Q,readableObjectMode:$,state:G})].filter(Boolean)};var kl=(Z,J)=>{for(let X of fq1(Z))bq1(Z,X,J)},fq1=(Z)=>new Set(Object.entries(Z).filter(([,{direction:J}])=>J==="input").map(([J])=>Number(J))),bq1=(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 ${tJ[K]} with synchronous methods.`)}let W=$.map(({contents:K})=>K).map((K)=>yq1(K,Y));X.input=EG(W)},yq1=(Z,J)=>{let X=m2(Z,J,"utf8",!0);return gq1(X),EG(X)},gq1=(Z)=>{let J=Z.find((X)=>typeof X!=="string"&&!n8(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 cq1,appendFileSync as lq1}from"fs";var u2=({stdioItems:Z,encoding:J,verboseInfo:X,fdNumber:Y})=>Y!=="all"&&KW(X,Y)&&!Y9.has(J)&&mq1(Y)&&(Z.some(({type:$,value:Q})=>$==="native"&&uq1.has(Q))||Z.every(({type:$})=>h9.has($))),mq1=(Z)=>Z===1||Z===2,uq1=new Set(["pipe","overlapped"]),El=async(Z,J,X,Y)=>{for await(let $ of Z)if(!dq1(J))vl($,X,Y)},Il=(Z,J,X)=>{for(let Y of Z)vl(Y,J,X)},dq1=(Z)=>Z._readableState.pipes.length>0,vl=(Z,J,X)=>{let Y=rU(Z);O7({type:"output",verboseMessage:Y,fdNumber:J,verboseInfo:X})};var Sl=({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)=>pq1({result:G,fileDescriptors:Z,fdNumber:z,state:Q,outputFiles:W,isMaxBuffer:Y,verboseInfo:$},X)),...Q}},pq1=({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=_c(Z,Q,V),F=TZ(q),{stdioItems:U,objectMode:B}=J[X],w=iq1([F],U,G,Y),{serializedResult:j,finalResult:N=j}=nq1({chunks:w,objectMode:B,encoding:G,lines:z,stripFinalNewline:H,fdNumber:X});aq1({serializedResult:j,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)sq1(j,U,$);return R}catch(O){return Y.error=O,R}},iq1=(Z,J,X,Y)=>{try{return m2(Z,J,X,!1)}catch($){return Y.error=$,Z}},nq1=({chunks:Z,objectMode:J,encoding:X,lines:Y,stripFinalNewline:$,fdNumber:Q})=>{if(J)return{serializedResult:Z};if(X==="buffer")return{serializedResult:EG(Z)};let W=im(Z,X);if(Y[Q])return{serializedResult:W,finalResult:SP(W,!$[Q],J)};return{serializedResult:W}},aq1=({serializedResult:Z,fdNumber:J,state:X,verboseInfo:Y,encoding:$,stdioItems:Q,objectMode:W})=>{if(!u2({stdioItems:Q,encoding:$,verboseInfo:Y,fdNumber:J}))return;let K=SP(Z,!1,W);try{Il(K,J,Y)}catch(G){X.error??=G}},sq1=(Z,J,X)=>{for(let{path:Y,append:$}of J.filter(({type:Q})=>h2.has(Q))){let Q=typeof Y==="string"?Y:Y.toString();if($||X.has(Q))lq1(Y,Z);else X.add(Q),cq1(Y,Z)}};var _l=([,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,vZ(J,X,"all")];if(Array.isArray(J))return[vZ(Z,X,"all"),...J];if(n8(Z)&&n8(J))return mD([Z,J]);return`${Z}${J}`};import{once as hP}from"events";var Al=async(Z,J)=>{let[X,Y]=await oq1(Z);return J.isForcefullyTerminated??=!1,[X,Y]},oq1=async(Z)=>{let[J,X]=await Promise.allSettled([hP(Z,"spawn"),hP(Z,"exit")]);if(J.status==="rejected")return[];return X.status==="rejected"?xl(Z):X.value},xl=async(Z)=>{try{return await hP(Z,"exit")}catch{return xl(Z)}},hl=async(Z)=>{let[J,X]=await Z;if(!rq1(J,X)&&fP(J,X))throw new M7;return[J,X]},rq1=(Z,J)=>Z===void 0&&J===void 0,fP=(Z,J)=>Z!==0||J!==null;var fl=({error:Z,status:J,signal:X,output:Y},{maxBuffer:$})=>{let Q=tq1(Z,J,X),W=Q?.code==="ETIMEDOUT",K=Sc(Q,Y,$);return{resultError:Q,exitCode:J,signal:X,timedOut:W,isMaxBuffer:K}},tq1=(Z,J,X)=>{if(Z!==void 0)return Z;return fP(J,X)?new M7:void 0};var bl=(Z,J,X)=>{let{file:Y,commandArguments:$,command:Q,escapedCommand:W,startTime:K,verboseInfo:G,options:z,fileDescriptors:H}=ZF1(Z,J,X),V=YF1({file:Y,commandArguments:$,options:z,command:Q,escapedCommand:W,verboseInfo:G,fileDescriptors:H,startTime:K});return BW(V,G,z)},ZF1=(Z,J,X)=>{let{command:Y,escapedCommand:$,startTime:Q,verboseInfo:W}=eU(Z,J,X),K=JF1(X),{file:G,commandArguments:z,options:H}=N2(Z,J,K);XF1(H);let V=Fl(H,W);return{file:G,commandArguments:z,command:Y,escapedCommand:$,startTime:Q,verboseInfo:W,options:H,fileDescriptors:V}},JF1=(Z)=>Z.node&&!Z.ipc?{...Z,ipc:!1}:Z,XF1=({ipc:Z,ipcInput:J,detached:X,cancelSignal:Y})=>{if(J)d2("ipcInput");if(Z)d2("ipc: true");if(X)d2("detached: true");if(Y)d2("cancelSignal")},d2=(Z)=>{throw new TypeError(`The "${Z}" option cannot be used with synchronous methods.`)},YF1=({file:Z,commandArguments:J,options:X,command:Y,escapedCommand:$,verboseInfo:Q,fileDescriptors:W,startTime:K})=>{let G=$F1({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}=fl(G,X),{output:U,error:B=z}=Sl({fileDescriptors:W,syncResult:G,options:X,isMaxBuffer:F,verboseInfo:Q}),w=U.map((N,R)=>vZ(N,X,R)),j=vZ(_l(U,X),X,"all");return WF1({error:B,exitCode:H,signal:V,timedOut:q,isMaxBuffer:F,stdio:w,all:j,options:X,command:Y,escapedCommand:$,startTime:K})},$F1=({file:Z,commandArguments:J,options:X,command:Y,escapedCommand:$,fileDescriptors:Q,startTime:W})=>{try{kl(Q,X);let K=QF1(X);return eq1(...D2(Z,J,K))}catch(K){return wW({error:K,command:Y,escapedCommand:$,fileDescriptors:Q,options:X,startTime:W,isSync:!0})}},QF1=({encoding:Z,maxBuffer:J,...X})=>({...X,encoding:"buffer",maxBuffer:S2(J)}),WF1=({error:Z,exitCode:J,signal:X,timedOut:Y,isMaxBuffer:$,stdio:Q,all:W,options:K,command:G,escapedCommand:z,startTime:H})=>Z===void 0?_2({command:G,escapedCommand:z,stdio:Q,all:W,ipcOutput:[],options:K,startTime:H}):hG({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 nU1}from"events";import{spawn as aU1}from"child_process";import dl from"process";import{once as bP,on as KF1}from"events";var yl=({anyProcess:Z,channel:J,isSubprocess:X,ipc:Y},{reference:$=!0,filter:Q}={})=>{return HW({methodName:"getOneMessage",isSubprocess:X,ipc:Y,isConnected:B2(Z)}),GF1({anyProcess:Z,channel:J,isSubprocess:X,filter:Q,reference:$})},GF1=async({anyProcess:Z,channel:J,isSubprocess:X,filter:Y,reference:$})=>{q2(J,$);let Q=rJ(Z,J,X),W=new AbortController;try{return await Promise.race([zF1(Q,Y,W),HF1(Q,X,W),VF1(Q,X,W)])}catch(K){throw VW(Z),K}finally{W.abort(),F2(J,$)}},zF1=async(Z,J,{signal:X})=>{if(J===void 0){let[Y]=await bP(Z,"message",{signal:X});return Y}for await(let[Y]of KF1(Z,"message",{signal:X}))if(J(Y))return Y},HF1=async(Z,J,{signal:X})=>{await bP(Z,"disconnect",{signal:X}),Dd(J)},VF1=async(Z,J,{signal:X})=>{let[Y]=await bP(Z,"strict:error",{signal:X});throw z2(Y,J)};import{once as ml,on as qF1}from"events";var ul=({anyProcess:Z,channel:J,isSubprocess:X,ipc:Y},{reference:$=!0}={})=>yP({anyProcess:Z,channel:J,isSubprocess:X,ipc:Y,shouldAwait:!X,reference:$}),yP=({anyProcess:Z,channel:J,isSubprocess:X,ipc:Y,shouldAwait:$,reference:Q})=>{HW({methodName:"getEachMessage",isSubprocess:X,ipc:Y,isConnected:B2(Z)}),q2(J,Q);let W=rJ(Z,J,X),K=new AbortController,G={};return FF1(Z,W,K),UF1({ipcEmitter:W,isSubprocess:X,controller:K,state:G}),wF1({anyProcess:Z,channel:J,ipcEmitter:W,isSubprocess:X,shouldAwait:$,controller:K,state:G,reference:Q})},FF1=async(Z,J,X)=>{try{await ml(J,"disconnect",{signal:X.signal}),X.abort()}catch{}},UF1=async({ipcEmitter:Z,isSubprocess:J,controller:X,state:Y})=>{try{let[$]=await ml(Z,"strict:error",{signal:X.signal});Y.error=z2($,J),X.abort()}catch{}},wF1=async function*({anyProcess:Z,channel:J,ipcEmitter:X,isSubprocess:Y,shouldAwait:$,controller:Q,state:W,reference:K}){try{for await(let[G]of qF1(X,"message",{signal:Q.signal}))gl(W),yield G}catch{gl(W)}finally{if(Q.abort(),F2(J,K),!Y)VW(Z);if($)await Z}},gl=({error:Z})=>{if(Z)throw Z};var cl=(Z,{ipc:J})=>{Object.assign(Z,pl(Z,!1,J))},ll=()=>{let Z=dl,J=!0,X=dl.channel!==void 0;return{...pl(Z,!0,X),getCancelSignal:od.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:!0,ipc:X})}},pl=(Z,J,X)=>({sendMessage:M2.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:X}),getOneMessage:yl.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:X}),getEachMessage:ul.bind(void 0,{anyProcess:Z,channel:Z.channel,isSubprocess:J,ipc:X})});import{ChildProcess as BF1}from"child_process";import{PassThrough as LF1,Readable as jF1,Writable as OF1,Duplex as MF1}from"stream";var il=({error:Z,command:J,escapedCommand:X,fileDescriptors:Y,options:$,startTime:Q,verboseInfo:W})=>{EP(Y);let K=new BF1;RF1(K,Y),Object.assign(K,{readable:NF1,writable:DF1,duplex:PF1});let G=wW({error:Z,command:J,escapedCommand:X,fileDescriptors:Y,options:$,startTime:Q,isSync:!1}),z=CF1(G,W,$);return{subprocess:K,promise:z}},RF1=(Z,J)=>{let X=bG(),Y=bG(),$=bG(),Q=Array.from({length:J.length-3},bG),W=bG(),K=[X,Y,$,...Q];Object.assign(Z,{stdin:X,stdout:Y,stderr:$,all:W,stdio:K})},bG=()=>{let Z=new LF1;return Z.end(),Z},NF1=()=>new jF1({read(){}}),DF1=()=>new OF1({write(){}}),PF1=()=>new MF1({read(){},write(){}}),CF1=async(Z,J,X)=>BW(Z,J,X);import{createReadStream as nl,createWriteStream as al}from"fs";import{Buffer as TF1}from"buffer";import{Readable as yG,Writable as kF1,Duplex as EF1}from"stream";var ol=(Z,J)=>f2(IF1,Z,J,!1),gG=({type:Z,optionName:J})=>{throw new TypeError(`The \`${J}\` option cannot be ${tJ[Z]}.`)},sl={fileNumber:gG,generator:xP,asyncGenerator:xP,nodeStream:({value:Z})=>({stream:Z}),webTransform({value:{transform:Z,writableObjectMode:J,readableObjectMode:X}}){let Y=J||X;return{stream:EF1.fromWeb(Z,{objectMode:Y})}},duplex:({value:{transform:Z}})=>({stream:Z}),native(){}},IF1={input:{...sl,fileUrl:({value:Z})=>({stream:nl(Z)}),filePath:({value:{file:Z}})=>({stream:nl(Z)}),webStream:({value:Z})=>({stream:yG.fromWeb(Z)}),iterable:({value:Z})=>({stream:yG.from(Z)}),asyncIterable:({value:Z})=>({stream:yG.from(Z)}),string:({value:Z})=>({stream:yG.from(Z)}),uint8Array:({value:Z})=>({stream:yG.from(TF1.from(Z))})},output:{...sl,fileUrl:({value:Z})=>({stream:al(Z)}),filePath:({value:{file:Z,append:J}})=>({stream:al(Z,J?{flags:"a"}:{})}),webStream:({value:Z})=>({stream:kF1.fromWeb(Z)}),iterable:gG,asyncIterable:gG,string:gG,uint8Array:gG}};import{on as vF1,once as rl}from"events";import{PassThrough as SF1,getDefaultHighWaterMark as _F1}from"stream";import{finished as Zp}from"stream/promises";function J$(Z){if(!Array.isArray(Z))throw new TypeError(`Expected an array, got \`${typeof Z}\`.`);for(let $ of Z)gP($);let J=Z.some(({readableObjectMode:$})=>$),X=AF1(Z,J),Y=new Jp({objectMode:J,writableHighWaterMark:X,readableHighWaterMark:X});for(let $ of Z)Y.add($);return Y}var AF1=(Z,J)=>{if(Z.length===0)return _F1(J);let X=Z.filter(({readableObjectMode:Y})=>Y===J).map(({readableHighWaterMark:Y})=>Y);return Math.max(...X)};class Jp extends SF1{#Z=new Set([]);#J=new Set([]);#Y=new Set([]);#X;#$=Symbol("unpipe");#H=new WeakMap;add(Z){if(gP(Z),this.#Z.has(Z))return;this.#Z.add(Z),this.#X??=xF1(this,this.#Z,this.#$);let J=bF1({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(gP(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 xF1=async(Z,J,X)=>{c2(Z,tl);let Y=new AbortController;try{await Promise.race([hF1(Z,Y),fF1(Z,J,X,Y)])}finally{Y.abort(),c2(Z,-tl)}},hF1=async(Z,{signal:J})=>{try{await Zp(Z,{signal:J,cleanup:!0})}catch(X){throw Xp(Z,X),X}},fF1=async(Z,J,X,{signal:Y})=>{for await(let[$]of vF1(Z,"unpipe",{signal:Y}))if(J.has($))$.emit(X)},gP=(Z)=>{if(typeof Z?.pipe!=="function")throw new TypeError(`Expected a readable stream, got: \`${typeof Z}\`.`)},bF1=async({passThroughStream:Z,stream:J,streams:X,ended:Y,aborted:$,onFinished:Q,unpipeEvent:W})=>{c2(Z,el);let K=new AbortController;try{await Promise.race([yF1(Q,J,K),gF1({passThroughStream:Z,stream:J,streams:X,ended:Y,aborted:$,controller:K}),mF1({stream:J,streams:X,ended:Y,aborted:$,unpipeEvent:W,controller:K})])}finally{K.abort(),c2(Z,-el)}if(X.size>0&&X.size===Y.size+$.size)if(Y.size===0&&$.size>0)mP(Z);else uF1(Z)},yF1=async(Z,J,{signal:X})=>{try{if(await Z,!X.aborted)mP(J)}catch(Y){if(!X.aborted)Xp(J,Y)}},gF1=async({passThroughStream:Z,stream:J,streams:X,ended:Y,aborted:$,controller:{signal:Q}})=>{try{if(await Zp(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(Yp(W))$.add(J);else $p(Z,W)}},mF1=async({stream:Z,streams:J,ended:X,aborted:Y,unpipeEvent:$,controller:{signal:Q}})=>{if(await rl(Z,$,{signal:Q}),!Z.readable)return rl(Q,"abort",{signal:Q});J.delete(Z),X.delete(Z),Y.delete(Z)},uF1=(Z)=>{if(Z.writable)Z.end()},Xp=(Z,J)=>{if(Yp(J))mP(Z);else $p(Z,J)},Yp=(Z)=>Z?.code==="ERR_STREAM_PREMATURE_CLOSE",mP=(Z)=>{if(Z.readable||Z.writable)Z.destroy()},$p=(Z,J)=>{if(!Z.destroyed)Z.once("error",dF1),Z.destroy(J)},dF1=()=>{},c2=(Z,J)=>{let X=Z.getMaxListeners();if(X!==0&&X!==Number.POSITIVE_INFINITY)Z.setMaxListeners(X+J)},tl=2,el=1;import{finished as Qp}from"stream/promises";var jW=(Z,J)=>{Z.pipe(J),cF1(Z,J),lF1(Z,J)},cF1=async(Z,J)=>{if(_4(Z)||_4(J))return;try{await Qp(Z,{cleanup:!0,readable:!0,writable:!1})}catch{}uP(J)},uP=(Z)=>{if(Z.writable)Z.end()},lF1=async(Z,J)=>{if(_4(Z)||_4(J))return;try{await Qp(J,{cleanup:!0,readable:!1,writable:!0})}catch{}dP(Z)},dP=(Z)=>{if(Z.readable)Z.destroy()};var Wp=(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})=>h9.has(G)))pF1(Z,K,W,$);for(let{stream:K}of Q.filter(({type:G})=>!h9.has(G)))nF1({subprocess:Z,stream:K,direction:W,fdNumber:$,pipeGroups:Y,controller:X})}for(let[$,Q]of Y.entries()){let W=Q.length===1?Q[0]:J$(Q);jW(W,$)}},pF1=(Z,J,X,Y)=>{if(X==="output")jW(Z.stdio[Y],J);else jW(J,Z.stdio[Y]);let $=iF1[Y];if($!==void 0)Z[$]=J;Z.stdio[Y]=J},iF1=["stdin","stdout","stderr"],nF1=({subprocess:Z,stream:J,direction:X,fdNumber:Y,pipeGroups:$,controller:Q})=>{if(J===void 0)return;aF1(J,Q);let[W,K]=X==="output"?[J,Z.stdio[Y]]:[Z.stdio[Y],J],G=$.get(W)??[];$.set(W,[...G,K])},aF1=(Z,{signal:J})=>{if(_4(Z))rY(Z,sF1,J)},sF1=2;import{addAbortListener as tF1}from"events";var X$=[];X$.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")X$.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")X$.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var l2=(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",cP=Symbol.for("signal-exit emitter"),lP=globalThis,oF1=Object.defineProperty.bind(Object);class Kp{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(lP[cP])return lP[cP];oF1(lP,cP,{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 iP{}var rF1=(Z)=>{return{onExit(J,X){return Z.onExit(J,X)},load(){return Z.load()},unload(){return Z.unload()}}};class Gp extends iP{onExit(){return()=>{}}load(){}unload(){}}class zp extends iP{#Z=pP.platform==="win32"?"SIGINT":"SIGHUP";#J=new Kp;#Y;#X;#$;#H={};#q=!1;constructor(Z){super();this.#Y=Z,this.#H={};for(let J of X$)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(!l2(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 X$)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,X$.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(!l2(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"&&l2(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 pP=globalThis.process,{onExit:Hp,load:gq6,unload:mq6}=rF1(l2(pP)?new zp(pP):new Gp);var Vp=(Z,{cleanup:J,detached:X},{signal:Y})=>{if(!J||X)return;let $=Hp(()=>{Z.kill()});tF1(Y,()=>{$()})};var Fp=({source:Z,sourcePromise:J,boundOptions:X,createNested:Y},...$)=>{let Q=tU(),{destination:W,destinationStream:K,destinationError:G,from:z,unpipeSignal:H}=eF1(X,Y,$),{sourceStream:V,sourceError:q}=JU1(Z,z),{options:F,fileDescriptors:U}=N7.get(Z);return{sourcePromise:J,sourceStream:V,sourceOptions:F,sourceError:q,destination:W,destinationStream:K,destinationError:G,unpipeSignal:H,fileDescriptors:U,startTime:Q}},eF1=(Z,J,X)=>{try{let{destination:Y,pipeOptions:{from:$,to:Q,unpipeSignal:W}={}}=ZU1(Z,J,...X),K=V2(Y,Q);return{destination:Y,destinationStream:K,from:$,unpipeSignal:W}}catch(Y){return{destinationError:Y}}},ZU1=(Z,J,X,...Y)=>{if(Array.isArray(X))return{destination:J(qp,Z)(X,...Y),pipeOptions:Z};if(typeof X==="string"||X instanceof URL||yD(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]=dU(X,...Y);return{destination:J(qp)($,Q,W),pipeOptions:W}}if(N7.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}`)},qp=({options:Z})=>({options:{...Z,stdin:"pipe",piped:!0}}),JU1=(Z,J)=>{try{return{sourceStream:qW(Z,J)}}catch(X){return{sourceError:X}}};var wp=({sourceStream:Z,sourceError:J,destinationStream:X,destinationError:Y,fileDescriptors:$,sourceOptions:Q,startTime:W})=>{let K=XU1({sourceStream:Z,sourceError:J,destinationStream:X,destinationError:Y});if(K!==void 0)throw nP({error:K,fileDescriptors:$,sourceOptions:Q,startTime:W})},XU1=({sourceStream:Z,sourceError:J,destinationStream:X,destinationError:Y})=>{if(J!==void 0&&Y!==void 0)return Y;if(Y!==void 0)return dP(Z),Y;if(J!==void 0)return uP(X),J},nP=({error:Z,fileDescriptors:J,sourceOptions:X,startTime:Y})=>wW({error:Z,command:Up,escapedCommand:Up,fileDescriptors:J,options:X,startTime:Y,isSync:!1}),Up="source.pipe(destination)";var Bp=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 YU1}from"stream/promises";var Lp=(Z,J,X)=>{let Y=p2.has(J)?QU1(Z,J):$U1(Z,J);return rY(Z,KU1,X.signal),rY(J,GU1,X.signal),WU1(J),Y},$U1=(Z,J)=>{let X=J$([Z]);return jW(X,J),p2.set(J,X),X},QU1=(Z,J)=>{let X=p2.get(J);return X.add(Z),X},WU1=async(Z)=>{try{await YU1(Z,{cleanup:!0,readable:!1,writable:!0})}catch{}p2.delete(Z)},p2=new WeakMap,KU1=2,GU1=1;import{aborted as zU1}from"util";var jp=(Z,J)=>Z===void 0?[]:[HU1(Z,J)],HU1=async(Z,{sourceStream:J,mergedStream:X,fileDescriptors:Y,sourceOptions:$,startTime:Q})=>{await zU1(Z,J),await X.remove(J);let W=new Error("Pipe canceled by `unpipeSignal` option.");throw nP({error:W,fileDescriptors:Y,sourceOptions:$,startTime:Q})};var i2=(Z,...J)=>{if(T8(J[0]))return i2.bind(void 0,{...Z,boundOptions:{...Z.boundOptions,...J[0]}});let{destination:X,...Y}=Fp(Z,...J),$=VU1({...Y,destination:X});return $.pipe=i2.bind(void 0,{...Z,source:X,sourcePromise:$,boundOptions:{}}),$},VU1=async({sourcePromise:Z,sourceStream:J,sourceOptions:X,sourceError:Y,destination:$,destinationStream:Q,destinationError:W,unpipeSignal:K,fileDescriptors:G,startTime:z})=>{let H=qU1(Z,$);wp({sourceStream:J,sourceError:Y,destinationStream:Q,destinationError:W,fileDescriptors:G,sourceOptions:X,startTime:z});let V=new AbortController;try{let q=Lp(J,Q,V);return await Promise.race([Bp(H),...jp(K,{sourceStream:J,mergedStream:q,sourceOptions:X,fileDescriptors:G,startTime:z})])}finally{V.abort()}},qU1=(Z,J)=>Promise.allSettled([Z,J]);import{setImmediate as OU1}from"timers/promises";import{on as FU1}from"events";import{getDefaultHighWaterMark as UU1}from"stream";var n2=({subprocessStdout:Z,subprocess:J,binary:X,shouldEncode:Y,encoding:$,preserveNewlines:Q})=>{let W=new AbortController;return wU1(J,W),Mp({stream:Z,controller:W,binary:X,shouldEncode:!Z.readableObjectMode&&Y,encoding:$,shouldSplit:!Z.readableObjectMode,preserveNewlines:Q})},wU1=async(Z,J)=>{try{await Z}catch{}finally{J.abort()}},aP=({stream:Z,onStreamEnd:J,lines:X,encoding:Y,stripFinalNewline:$,allMixed:Q})=>{let W=new AbortController;BU1(J,W,Z);let K=Z.readableObjectMode&&!Q;return Mp({stream:Z,controller:W,binary:Y==="buffer",shouldEncode:!K,encoding:Y,shouldSplit:!K&&X,preserveNewlines:!$})},BU1=async(Z,J,X)=>{try{await Z}catch{X.destroy()}finally{J.abort()}},Mp=({stream:Z,controller:J,binary:X,shouldEncode:Y,encoding:$,shouldSplit:Q,preserveNewlines:W})=>{let K=FU1(Z,"data",{signal:J.signal,highWaterMark:Op,highWatermark:Op});return LU1({onStdoutChunk:K,controller:J,binary:X,shouldEncode:Y,encoding:$,shouldSplit:Q,preserveNewlines:W})},sP=UU1(!0),Op=sP,LU1=async function*({onStdoutChunk:Z,controller:J,binary:X,shouldEncode:Y,encoding:$,shouldSplit:Q,preserveNewlines:W}){let K=jU1({binary:X,shouldEncode:Y,encoding:$,shouldSplit:Q,preserveNewlines:W});try{for await(let[G]of Z)yield*Z$(G,K,0)}catch(G){if(!J.signal.aborted)throw G}finally{yield*fG(K)}},jU1=({binary:Z,shouldEncode:J,encoding:X,shouldSplit:Y,preserveNewlines:$})=>[y2(Z,X,!J),b2(Z,$,!Y,{})].filter(Boolean);var Rp=async({stream:Z,onStreamEnd:J,fdNumber:X,encoding:Y,buffer:$,maxBuffer:Q,lines:W,allMixed:K,stripFinalNewline:G,verboseInfo:z,streamInfo:H})=>{let V=MU1({stream:Z,onStreamEnd:J,fdNumber:X,encoding:Y,allMixed:K,verboseInfo:z,streamInfo:H});if(!$){await Promise.all([RU1(Z),V]);return}let q=IP(G,X),F=aP({stream:Z,onStreamEnd:J,lines:W,encoding:Y,stripFinalNewline:q,allMixed:K}),[U]=await Promise.all([NU1({stream:Z,iterable:F,fdNumber:X,encoding:Y,maxBuffer:Q,lines:W}),V]);return U},MU1=async({stream:Z,onStreamEnd:J,fdNumber:X,encoding:Y,allMixed:$,verboseInfo:Q,streamInfo:{fileDescriptors:W}})=>{if(!u2({stdioItems:W[X]?.stdioItems,encoding:Y,verboseInfo:Q,fdNumber:X}))return;let K=aP({stream:Z,onStreamEnd:J,lines:!0,encoding:Y,stripFinalNewline:!0,allMixed:$});await El(K,Z,X,Q)},RU1=async(Z)=>{if(await OU1(),Z.readableFlowing===null)Z.resume()},NU1=async({stream:Z,stream:{readableObjectMode:J},iterable:X,fdNumber:Y,encoding:$,maxBuffer:Q,lines:W})=>{try{if(J||W)return await k2(X,{maxBuffer:Q});if($==="buffer")return new Uint8Array(await E2(X,{maxBuffer:Q}));return await v2(X,{maxBuffer:Q})}catch(K){return Np(Ec({error:K,stream:Z,readableObjectMode:J,lines:W,encoding:$,fdNumber:Y}))}},oP=async(Z)=>{try{return await Z}catch(J){return Np(J)}},Np=({bufferedData:Z})=>lm(Z)?new Uint8Array(Z):Z;import{finished as DU1}from"stream/promises";var mG=async(Z,J,X,{isSameDirection:Y,stopOnExit:$=!1}={})=>{let Q=PU1(Z,X),W=new AbortController;try{await Promise.race([...$?[X.exitPromise]:[],DU1(Z,{cleanup:!0,signal:W.signal})])}catch(K){if(!Q.stdinCleanedUp)kU1(K,J,X,Y)}finally{W.abort()}},PU1=(Z,{originalStreams:[J],subprocess:X})=>{let Y={stdinCleanedUp:!1};if(Z===J)CU1(Z,X,Y);return Y},CU1=(Z,J,X)=>{let{_destroy:Y}=Z;Z._destroy=(...$)=>{TU1(J,X),Y.call(Z,...$)}},TU1=({exitCode:Z,signalCode:J},X)=>{if(Z!==null||J!==null)X.stdinCleanedUp=!0},kU1=(Z,J,X,Y)=>{if(!EU1(Z,J,X,Y))throw Z},EU1=(Z,J,X,Y=!0)=>{if(X.propagating)return Dp(Z)||a2(Z);return X.propagating=!0,rP(X,J)===Y?Dp(Z):a2(Z)},rP=({fileDescriptors:Z},J)=>J!=="all"&&Z[J].direction==="input",a2=(Z)=>Z?.code==="ERR_STREAM_PREMATURE_CLOSE",Dp=(Z)=>Z?.code==="EPIPE";var Pp=({subprocess:Z,encoding:J,buffer:X,maxBuffer:Y,lines:$,stripFinalNewline:Q,verboseInfo:W,streamInfo:K})=>Z.stdio.map((G,z)=>tP({stream:G,fdNumber:z,encoding:J,buffer:X[z],maxBuffer:Y[z],lines:$[z],allMixed:!1,stripFinalNewline:Q,verboseInfo:W,streamInfo:K})),tP=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=mG(Z,J,z);if(rP(z,J)){await H;return}let[V]=await Promise.all([Rp({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 Cp=({stdout:Z,stderr:J},{all:X})=>X&&(Z||J)?J$([Z,J].filter(Boolean)):void 0,Tp=({subprocess:Z,encoding:J,buffer:X,maxBuffer:Y,lines:$,stripFinalNewline:Q,verboseInfo:W,streamInfo:K})=>tP({...IU1(Z,X),fdNumber:"all",encoding:J,maxBuffer:Y[1]+Y[2],lines:$[1]||$[2],allMixed:vU1(Z),stripFinalNewline:Q,verboseInfo:W,streamInfo:K}),IU1=({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}},vU1=({all:Z,stdout:J,stderr:X})=>Z&&J&&X&&J.readableObjectMode!==X.readableObjectMode;import{once as SU1}from"events";var kp=(Z)=>KW(Z,"ipc"),Ep=(Z,J)=>{let X=rU(Z);O7({type:"ipc",verboseMessage:X,fdNumber:"ipc",verboseInfo:J})};var Ip=async({subprocess:Z,buffer:J,maxBuffer:X,ipc:Y,ipcOutput:$,verboseInfo:Q})=>{if(!Y)return $;let W=kp(Q),K=kZ(J,"ipc"),G=kZ(X,"ipc");for await(let z of yP({anyProcess:Z,channel:Z.channel,isSubprocess:!1,ipc:Y,shouldAwait:!1,reference:!0})){if(K)Ic(Z,$,G),$.push(z);if(W)Ep(z,Q)}return $},vp=async(Z,J)=>{return await Promise.allSettled([Z]),J};var Sp=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:j})=>{let N=Al(Z,q),R={originalStreams:B,fileDescriptors:U,subprocess:Z,exitPromise:N,propagating:!1},O=Pp({subprocess:Z,encoding:J,buffer:X,maxBuffer:Y,lines:$,stripFinalNewline:z,verboseInfo:F,streamInfo:R}),P=Tp({subprocess:Z,encoding:J,buffer:X,maxBuffer:Y,lines:$,stripFinalNewline:z,verboseInfo:F,streamInfo:R}),D=[],C=Ip({subprocess:Z,buffer:X,maxBuffer:Y,ipc:H,ipcOutput:D,verboseInfo:F}),T=_U1(B,Z,R),k=AU1(U,R);try{return await Promise.race([Promise.all([{},hl(N),Promise.all(O),P,C,Wc(Z,V),...T,...k]),w,xU1(Z,j),...Jc(Z,Q,q,j),...Nd({subprocess:Z,cancelSignal:W,gracefulCancel:K,context:q,controller:j}),...ed({subprocess:Z,cancelSignal:W,gracefulCancel:K,forceKillAfterDelay:G,context:q,controller:j})])}catch(A){return q.terminationReason??="other",Promise.all([{error:A},N,Promise.all(O.map((v)=>oP(v))),oP(P),vp(C,D),Promise.allSettled(T),Promise.allSettled(k)])}},_U1=(Z,J,X)=>Z.map((Y,$)=>Y===J.stdio[$]?void 0:mG(Y,$,X)),AU1=(Z,J)=>Z.flatMap(({stdioItems:X},Y)=>X.filter(({value:$,stream:Q=$})=>x4(Q,{checkOpen:!1})&&!_4(Q)).map(({type:$,value:Q,stream:W=Q})=>mG(W,Y,J,{isSameDirection:h9.has($),stopOnExit:$==="native"}))),xU1=async(Z,{signal:J})=>{let[X]=await SU1(Z,"error",{signal:J});throw X};var _p=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),uG=(Z,J,X)=>{let Y=Z[X];if(!Y.has(J))Y.set(J,[]);let $=Y.get(J),Q=R7();return $.push(Q),{resolve:Q.resolve.bind(Q),promises:$}},OW=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 hU1}from"stream";import{callbackify as fU1}from"util";import{finished as Ap}from"stream/promises";var eP=async(Z)=>{if(Z===void 0)return;try{await ZC(Z)}catch{}},xp=async(Z)=>{if(Z===void 0)return;try{await JC(Z)}catch{}},ZC=async(Z)=>{await Ap(Z,{cleanup:!0,readable:!1,writable:!0})},JC=async(Z)=>{await Ap(Z,{cleanup:!0,readable:!0,writable:!1})},s2=async(Z,J)=>{if(await Z,J)throw J},o2=(Z,J,X)=>{if(X&&!a2(X))Z.destroy(X);else if(J)Z.destroy()};var hp=({subprocess:Z,concurrentStreams:J,encoding:X},{from:Y,binary:$=!0,preserveNewlines:Q=!0}={})=>{let W=$||Y9.has(X),{subprocessStdout:K,waitReadableDestroy:G}=XC(Z,Y,J),{readableEncoding:z,readableObjectMode:H,readableHighWaterMark:V}=YC(K,W),{read:q,onStdoutDataDone:F}=$C({subprocessStdout:K,subprocess:Z,binary:W,encoding:X,preserveNewlines:Q}),U=new hU1({read:q,destroy:fU1(WC.bind(void 0,{subprocessStdout:K,subprocess:Z,waitReadableDestroy:G})),highWaterMark:V,objectMode:H,encoding:z});return QC({subprocessStdout:K,onStdoutDataDone:F,readable:U,subprocess:Z}),U},XC=(Z,J,X)=>{let Y=qW(Z,J),$=uG(X,Y,"readableDestroy");return{subprocessStdout:Y,waitReadableDestroy:$}},YC=({readableEncoding:Z,readableObjectMode:J,readableHighWaterMark:X},Y)=>Y?{readableEncoding:Z,readableObjectMode:J,readableHighWaterMark:X}:{readableEncoding:Z,readableObjectMode:!0,readableHighWaterMark:sP},$C=({subprocessStdout:Z,subprocess:J,binary:X,encoding:Y,preserveNewlines:$})=>{let Q=R7(),W=n2({subprocessStdout:Z,subprocess:J,binary:X,shouldEncode:!X,encoding:Y,preserveNewlines:$});return{read(){bU1(this,W,Q)},onStdoutDataDone:Q}},bU1=async(Z,J,X)=>{try{let{value:Y,done:$}=await J.next();if($)X.resolve();else Z.push(Y)}catch{}},QC=async({subprocessStdout:Z,onStdoutDataDone:J,readable:X,subprocess:Y,subprocessStdin:$})=>{try{if(await JC(Z),await Y,await eP($),await J,X.readable)X.push(null)}catch(Q){await eP($),fp(X,Q)}},WC=async({subprocessStdout:Z,subprocess:J,waitReadableDestroy:X},Y)=>{if(await OW(X,J))fp(Z,Y),await s2(J,Y)},fp=(Z,J)=>{o2(Z,Z.readable,J)};import{Writable as yU1}from"stream";import{callbackify as bp}from"util";var yp=({subprocess:Z,concurrentStreams:J},{to:X}={})=>{let{subprocessStdin:Y,waitWritableFinal:$,waitWritableDestroy:Q}=KC(Z,X,J),W=new yU1({...GC(Y,Z,$),destroy:bp(HC.bind(void 0,{subprocessStdin:Y,subprocess:Z,waitWritableFinal:$,waitWritableDestroy:Q})),highWaterMark:Y.writableHighWaterMark,objectMode:Y.writableObjectMode});return zC(Y,W),W},KC=(Z,J,X)=>{let Y=V2(Z,J),$=uG(X,Y,"writableFinal"),Q=uG(X,Y,"writableDestroy");return{subprocessStdin:Y,waitWritableFinal:$,waitWritableDestroy:Q}},GC=(Z,J,X)=>({write:gU1.bind(void 0,Z),final:bp(mU1.bind(void 0,Z,J,X))}),gU1=(Z,J,X,Y)=>{if(Z.write(J,X))Y();else Z.once("drain",Y)},mU1=async(Z,J,X)=>{if(await OW(X,J)){if(Z.writable)Z.end();await J}},zC=async(Z,J,X)=>{try{if(await ZC(Z),J.writable)J.end()}catch(Y){await xp(X),gp(J,Y)}},HC=async({subprocessStdin:Z,subprocess:J,waitWritableFinal:X,waitWritableDestroy:Y},$)=>{if(await OW(X,J),await OW(Y,J))gp(Z,$),await s2(J,$)},gp=(Z,J)=>{o2(Z,Z.writable,J)};import{Duplex as uU1}from"stream";import{callbackify as dU1}from"util";var mp=({subprocess:Z,concurrentStreams:J,encoding:X},{from:Y,to:$,binary:Q=!0,preserveNewlines:W=!0}={})=>{let K=Q||Y9.has(X),{subprocessStdout:G,waitReadableDestroy:z}=XC(Z,Y,J),{subprocessStdin:H,waitWritableFinal:V,waitWritableDestroy:q}=KC(Z,$,J),{readableEncoding:F,readableObjectMode:U,readableHighWaterMark:B}=YC(G,K),{read:w,onStdoutDataDone:j}=$C({subprocessStdout:G,subprocess:Z,binary:K,encoding:X,preserveNewlines:W}),N=new uU1({read:w,...GC(H,Z,V),destroy:dU1(cU1.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 QC({subprocessStdout:G,onStdoutDataDone:j,readable:N,subprocess:Z,subprocessStdin:H}),zC(H,N,G),N},cU1=async({subprocessStdout:Z,subprocessStdin:J,subprocess:X,waitReadableDestroy:Y,waitWritableFinal:$,waitWritableDestroy:Q},W)=>{await Promise.all([WC({subprocessStdout:Z,subprocess:X,waitReadableDestroy:Y},W),HC({subprocessStdin:J,subprocess:X,waitWritableFinal:$,waitWritableDestroy:Q},W)])};var VC=(Z,J,{from:X,binary:Y=!1,preserveNewlines:$=!1}={})=>{let Q=Y||Y9.has(J),W=qW(Z,X),K=n2({subprocessStdout:W,subprocess:Z,binary:Q,shouldEncode:!0,encoding:J,preserveNewlines:$});return lU1(K,W,Z)},lU1=async function*(Z,J,X){try{yield*Z}finally{if(J.readable)J.destroy();await X}};var up=(Z,{encoding:J})=>{let X=_p();Z.readable=hp.bind(void 0,{subprocess:Z,concurrentStreams:X,encoding:J}),Z.writable=yp.bind(void 0,{subprocess:Z,concurrentStreams:X}),Z.duplex=mp.bind(void 0,{subprocess:Z,concurrentStreams:X,encoding:J}),Z.iterable=VC.bind(void 0,Z,J),Z[Symbol.asyncIterator]=VC.bind(void 0,Z,J,{})};var dp=(Z,J)=>{for(let[X,Y]of iU1){let $=Y.value.bind(J);Reflect.defineProperty(Z,X,{...Y,value:$})}},pU1=(async()=>{})().constructor.prototype,iU1=["then","catch","finally"].map((Z)=>[Z,Reflect.getOwnPropertyDescriptor(pU1,Z)]);var cp=(Z,J,X,Y)=>{let{file:$,commandArguments:Q,command:W,escapedCommand:K,startTime:G,verboseInfo:z,options:H,fileDescriptors:V}=sU1(Z,J,X),{subprocess:q,promise:F}=rU1({file:$,commandArguments:Q,options:H,startTime:G,verboseInfo:z,command:W,escapedCommand:K,fileDescriptors:V});return q.pipe=i2.bind(void 0,{source:q,sourcePromise:F,boundOptions:{},createNested:Y}),dp(q,F),N7.set(q,{options:H,fileDescriptors:V}),q},sU1=(Z,J,X)=>{let{command:Y,escapedCommand:$,startTime:Q,verboseInfo:W}=eU(Z,J,X),{file:K,commandArguments:G,options:z}=N2(Z,J,X),H=oU1(z),V=ol(H,W);return{file:K,commandArguments:G,command:Y,escapedCommand:$,startTime:Q,verboseInfo:W,options:H,fileDescriptors:V}},oU1=({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}},rU1=({file:Z,commandArguments:J,options:X,startTime:Y,verboseInfo:$,command:Q,escapedCommand:W,fileDescriptors:K})=>{let G;try{G=aU1(...D2(Z,J,X))}catch(U){return il({error:U,command:Q,escapedCommand:W,fileDescriptors:K,options:X,startTime:Y,verboseInfo:$})}let z=new AbortController;nU1(Number.POSITIVE_INFINITY,z.signal);let H=[...G.stdio];Wp(G,K,z),Vp(G,X,z);let V={},q=R7();G.kill=Md.bind(void 0,{kill:G.kill.bind(G),options:X,onInternalError:q,context:V,controller:z}),G.all=Cp(G,X),up(G,X),cl(G,X);let F=tU1({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}},tU1=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 Sp({subprocess:Z,options:J,context:G,verboseInfo:Y,fileDescriptors:$,originalStreams:Q,onInternalError:z,controller:H});H.abort(),z.resolve();let j=U.map((O,P)=>vZ(O,J,P)),N=vZ(B,J,"all"),R=eU1({errorInfo:V,exitCode:q,signal:F,stdio:j,all:N,ipcOutput:w,context:G,options:J,command:W,escapedCommand:K,startTime:X});return BW(R,Y,J)},eU1=({errorInfo:Z,exitCode:J,signal:X,stdio:Y,all:$,ipcOutput:Q,context:W,options:K,command:G,escapedCommand:z,startTime:H})=>("error"in Z)?hG({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 EZ,isForcefullyTerminated:W.isForcefullyTerminated,exitCode:J,signal:X,stdio:Y,all:$,ipcOutput:Q,options:K,startTime:H,isSync:!1}):_2({command:G,escapedCommand:z,stdio:Y,all:$,ipcOutput:Q,options:K,startTime:H});var r2=(Z,J)=>{let X=Object.fromEntries(Object.entries(J).map(([Y,$])=>[Y,Z21(Y,Z[Y],$)]));return{...Z,...X}},Z21=(Z,J,X)=>{if(J21.has(Z)&&T8(J)&&T8(X))return{...J,...X};return X},J21=new Set(["env",...lD]);var eJ=(Z,J,X,Y)=>{let $=(W,K,G)=>eJ(W,K,X,G),Q=(...W)=>X21({mapArguments:Z,deepOptions:X,boundOptions:J,setBoundExeca:Y,createNested:$},...W);if(Y!==void 0)Y(Q,$,J);return Q},X21=({mapArguments:Z,deepOptions:J={},boundOptions:X={},setBoundExeca:Y,createNested:$},Q,...W)=>{if(T8(Q))return $(Z,r2(X,Q),Y);let{file:K,commandArguments:G,options:z,isSync:H}=Y21({mapArguments:Z,firstArgument:Q,nextArguments:W,deepOptions:J,boundOptions:X});return H?bl(K,G,z):cp(K,G,z,$)},Y21=({mapArguments:Z,firstArgument:J,nextArguments:X,deepOptions:Y,boundOptions:$})=>{let Q=om(J)?rm(J,X):[J,...X],[W,K,G]=dU(...Q),z=r2(r2(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 lp=({file:Z,commandArguments:J})=>ip(Z,J),pp=({file:Z,commandArguments:J})=>({...ip(Z,J),isSync:!0}),ip=(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]=$21(Z);return{file:X,commandArguments:Y}},$21=(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(Q21)){let $=X.at(-1);if($&&$.endsWith("\\"))X[X.length-1]=`${$.slice(0,-1)} ${Y}`;else X.push(Y)}return X},Q21=/ +/g;var np=(Z,J,X)=>{Z.sync=J(W21,X),Z.s=Z.sync},ap=({options:Z})=>sp(Z),W21=({options:Z})=>({...sp(Z),isSync:!0}),sp=(Z)=>({options:{...K21(Z),...Z}}),K21=({input:Z,inputFile:J,stdio:X})=>Z===void 0&&J===void 0&&X===void 0?{stdin:"inherit"}:{},op={preferLocal:!0};var rp=eJ(()=>({})),I26=eJ(()=>({isSync:!0})),v26=eJ(lp),S26=eJ(pp),_26=eJ(Yc),A26=eJ(ap,{},op,np),{sendMessage:x26,getOneMessage:h26,getEachMessage:f26,getCancelSignal:b26}=ll();var qC=(Z,J,X)=>{let Y=Z instanceof RegExp?tp(Z,X):Z,$=J instanceof RegExp?tp(J,X):J,Q=Y!==null&&$!=null&&G21(Y,$,X);return Q&&{start:Q[0],end:Q[1],pre:X.slice(0,Q[0]),body:X.slice(Q[0]+Y.length,Q[1]),post:X.slice(Q[1]+$.length)}},tp=(Z,J)=>{let X=J.match(Z);return X?X[0]:null},G21=(Z,J,X)=>{let Y,$,Q,W=void 0,K,G=X.indexOf(Z),z=X.indexOf(J,G+1),H=G;if(G>=0&&z>0){if(Z===J)return[G,z];Y=[],Q=X.length;while(H>=0&&!K){if(H===G)Y.push(H),G=X.indexOf(Z,H+1);else if(Y.length===1){let V=Y.pop();if(V!==void 0)K=[V,z]}else{if($=Y.pop(),$!==void 0&&$<Q)Q=$,W=z;z=X.indexOf(J,H+1)}H=G<z&&G>=0?G:z}if(Y.length&&W!==void 0)K=[Q,W]}return K};var ep="\x00SLASH"+Math.random()+"\x00",Zi="\x00OPEN"+Math.random()+"\x00",UC="\x00CLOSE"+Math.random()+"\x00",Ji="\x00COMMA"+Math.random()+"\x00",Xi="\x00PERIOD"+Math.random()+"\x00",z21=new RegExp(ep,"g"),H21=new RegExp(Zi,"g"),V21=new RegExp(UC,"g"),q21=new RegExp(Ji,"g"),F21=new RegExp(Xi,"g"),U21=/\\\\/g,w21=/\\{/g,B21=/\\}/g,L21=/\\,/g,j21=/\\./g;function FC(Z){return!isNaN(Z)?parseInt(Z,10):Z.charCodeAt(0)}function O21(Z){return Z.replace(U21,ep).replace(w21,Zi).replace(B21,UC).replace(L21,Ji).replace(j21,Xi)}function M21(Z){return Z.replace(z21,"\\").replace(H21,"{").replace(V21,"}").replace(q21,",").replace(F21,".")}function Yi(Z){if(!Z)return[""];let J=[],X=qC("{","}",Z);if(!X)return Z.split(",");let{pre:Y,body:$,post:Q}=X,W=Y.split(",");W[W.length-1]+="{"+$+"}";let K=Yi(Q);if(Q.length)W[W.length-1]+=K.shift(),W.push.apply(W,K);return J.push.apply(J,W),J}function $i(Z){if(!Z)return[];if(Z.slice(0,2)==="{}")Z="\\{\\}"+Z.slice(2);return dG(O21(Z),!0).map(M21)}function R21(Z){return"{"+Z+"}"}function N21(Z){return/^-?0\d/.test(Z)}function D21(Z,J){return Z<=J}function P21(Z,J){return Z>=J}function dG(Z,J){let X=[],Y=qC("{","}",Z);if(!Y)return[Z];let $=Y.pre,Q=Y.post.length?dG(Y.post,!1):[""];if(/\$$/.test(Y.pre))for(let W=0;W<Q.length;W++){let K=$+"{"+Y.body+"}"+Q[W];X.push(K)}else{let W=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(Y.body),K=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(Y.body),G=W||K,z=Y.body.indexOf(",")>=0;if(!G&&!z){if(Y.post.match(/,(?!,).*\}/))return Z=Y.pre+"{"+Y.body+UC+Y.post,dG(Z);return[Z]}let H;if(G)H=Y.body.split(/\.\./);else if(H=Yi(Y.body),H.length===1&&H[0]!==void 0){if(H=dG(H[0],!1).map(R21),H.length===1)return Q.map((q)=>Y.pre+H[0]+q)}let V;if(G&&H[0]!==void 0&&H[1]!==void 0){let q=FC(H[0]),F=FC(H[1]),U=Math.max(H[0].length,H[1].length),B=H.length===3&&H[2]!==void 0?Math.abs(FC(H[2])):1,w=D21;if(F<q)B*=-1,w=P21;let N=H.some(N21);V=[];for(let R=q;w(R,F);R+=B){let O;if(K){if(O=String.fromCharCode(R),O==="\\")O=""}else if(O=String(R),N){let P=U-O.length;if(P>0){let D=new Array(P+1).join("0");if(R<0)O="-"+D+O.slice(1);else O=D+O}}V.push(O)}}else{V=[];for(let q=0;q<H.length;q++)V.push.apply(V,dG(H[q],!1))}for(let q=0;q<V.length;q++)for(let F=0;F<Q.length;F++){let U=$+V[q]+Q[F];if(!J||G||U)X.push(U)}}return X}var cG=(Z)=>{if(typeof Z!=="string")throw new TypeError("invalid pattern");if(Z.length>65536)throw new TypeError("pattern is too long")};var C21={"[: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]},lG=(Z)=>Z.replace(/[[\]\\-]/g,"\\$&"),T21=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Qi=(Z)=>Z.join(""),Wi=(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,[j,N,R]]of Object.entries(C21))if(Z.startsWith(w,Q)){if(V)return["$.",!1,Z.length-X,!0];if(Q+=w.length,R)$.push(j);else Y.push(j);K=K||N;continue Z}}if(G=!1,V){if(B>V)Y.push(lG(V)+"-"+lG(B));else if(B===V)Y.push(lG(B));V="",Q++;continue}if(Z.startsWith("-]",Q+1)){Y.push(lG(B+"-")),Q+=2;continue}if(Z.startsWith("-",Q+1)){V=B,Q+=2;continue}Y.push(lG(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[T21(B),!1,H-X,!1]}let q="["+(z?"^":"")+Qi(Y)+"]",F="["+(z?"":"^")+Qi($)+"]";return[Y.length&&$.length?"("+q+"|"+F+")":Y.length?q:F,K,H-X,!0]};var h4=(Z,{windowsPathsNoEscape:J=!1}={})=>{return J?Z.replace(/\[([^\/\\])\]/g,"$1"):Z.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var k21=new Set(["!","?","+","*","@"]),Ki=(Z)=>k21.has(Z),E21="(?!(?:^|/)\\.\\.?(?:$|/))",t2="(?!\\.)",I21=new Set(["[","."]),v21=new Set(["..","."]),S21=new Set("().*{}+?[]^$\\!"),_21=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),wC="[^/]",Gi=wC+"*?",zi=wC+"+?";class O6{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 O6&&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 O6&&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 O6(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&&Ki(U)&&Z.charAt(q)==="("){J.push(F),F="";let B=new O6(U,J);q=O6.#U(Z,B,q,Y),J.push(B);continue}F+=U}return J.push(F),q}let G=X+1,z=new O6(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(Ki(q)&&Z.charAt(G)==="("){z.push(V),V="";let F=new O6(q,z);z.push(F),G=O6.#U(Z,F,G,Y);continue}if(q==="|"){z.push(V),V="",H.push(z),z=new O6(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 O6(null,void 0,J);return O6.#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"?O6.#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&&v21.has(this.#X[0]))){let F=I21,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?E21:B?t2:""}}}let H="";if(this.isEnd()&&this.#Z.#K&&this.#$?.type==="!")H="(?:$|\\/)";return[z+G+H,h4(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,h4(this.toString()),!1,!1]}let Q=!X||Z||J||!t2?"":this.#B(!0);if(Q===$)Q="";if(Q)$=`(?:${$})(?:${Q})*?`;let W="";if(this.type==="!"&&this.#V)W=(this.isStart()&&!J?t2:"")+zi;else{let K=this.type==="!"?"))"+(this.isStart()&&!J&&!Z?t2:"")+Gi+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&Q?")":this.type==="*"&&Q?")?":`)${this.type}`;W=Y+$+K}return[W,h4($),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,$+=(S21.has(K)?"\\":"")+K;continue}if(K==="\\"){if(W===Z.length-1)$+="\\\\";else Y=!0;continue}if(K==="["){let[G,z,H,V]=Wi(Z,W);if(H){$+=G,Q=Q||z,W+=H-1,J=J||V;continue}}if(K==="*"){if(X&&Z==="*")$+=zi;else $+=Gi;J=!0;continue}if(K==="?"){$+=wC,J=!0;continue}$+=_21(K)}return[$,h4(Z),!!J,Q]}}var MW=(Z,{windowsPathsNoEscape:J=!1}={})=>{return J?Z.replace(/[?*()[\]]/g,"[$&]"):Z.replace(/[?*()[\]\\]/g,"\\$&")};var Z5=(Z,J,X={})=>{if(cG(J),!X.nocomment&&J.charAt(0)==="#")return!1;return new b9(J,X).match(Z)},A21=/^\*+([^+@!?\*\[\(]*)$/,x21=(Z)=>(J)=>!J.startsWith(".")&&J.endsWith(Z),h21=(Z)=>(J)=>J.endsWith(Z),f21=(Z)=>{return Z=Z.toLowerCase(),(J)=>!J.startsWith(".")&&J.toLowerCase().endsWith(Z)},b21=(Z)=>{return Z=Z.toLowerCase(),(J)=>J.toLowerCase().endsWith(Z)},y21=/^\*+\.\*+$/,g21=(Z)=>!Z.startsWith(".")&&Z.includes("."),m21=(Z)=>Z!=="."&&Z!==".."&&Z.includes("."),u21=/^\.\*+$/,d21=(Z)=>Z!=="."&&Z!==".."&&Z.startsWith("."),c21=/^\*+$/,l21=(Z)=>Z.length!==0&&!Z.startsWith("."),p21=(Z)=>Z.length!==0&&Z!=="."&&Z!=="..",i21=/^\?+([^+@!?\*\[\(]*)?$/,n21=([Z,J=""])=>{let X=qi([Z]);if(!J)return X;return J=J.toLowerCase(),(Y)=>X(Y)&&Y.toLowerCase().endsWith(J)},a21=([Z,J=""])=>{let X=Fi([Z]);if(!J)return X;return J=J.toLowerCase(),(Y)=>X(Y)&&Y.toLowerCase().endsWith(J)},s21=([Z,J=""])=>{let X=Fi([Z]);return!J?X:(Y)=>X(Y)&&Y.endsWith(J)},o21=([Z,J=""])=>{let X=qi([Z]);return!J?X:(Y)=>X(Y)&&Y.endsWith(J)},qi=([Z])=>{let J=Z.length;return(X)=>X.length===J&&!X.startsWith(".")},Fi=([Z])=>{let J=Z.length;return(X)=>X.length===J&&X!=="."&&X!==".."},Ui=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Hi={win32:{sep:"\\"},posix:{sep:"/"}},r21=Ui==="win32"?Hi.win32.sep:Hi.posix.sep;Z5.sep=r21;var M6=Symbol("globstar **");Z5.GLOBSTAR=M6;var t21="[^/]",e21=t21+"*?",Zw1="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Jw1="(?:(?!(?:\\/|^)\\.).)*?",Xw1=(Z,J={})=>(X)=>Z5(X,Z,J);Z5.filter=Xw1;var f9=(Z,J={})=>Object.assign({},Z,J),Yw1=(Z)=>{if(!Z||typeof Z!=="object"||!Object.keys(Z).length)return Z5;let J=Z5;return Object.assign((Y,$,Q={})=>J(Y,$,f9(Z,Q)),{Minimatch:class Y extends J.Minimatch{constructor($,Q={}){super($,f9(Z,Q))}static defaults($){return J.defaults(f9(Z,$)).Minimatch}},AST:class Y extends J.AST{constructor($,Q,W={}){super($,Q,f9(Z,W))}static fromGlob($,Q={}){return J.AST.fromGlob($,f9(Z,Q))}},unescape:(Y,$={})=>J.unescape(Y,f9(Z,$)),escape:(Y,$={})=>J.escape(Y,f9(Z,$)),filter:(Y,$={})=>J.filter(Y,f9(Z,$)),defaults:(Y)=>J.defaults(f9(Z,Y)),makeRe:(Y,$={})=>J.makeRe(Y,f9(Z,$)),braceExpand:(Y,$={})=>J.braceExpand(Y,f9(Z,$)),match:(Y,$,Q={})=>J.match(Y,$,f9(Z,Q)),sep:J.sep,GLOBSTAR:M6})};Z5.defaults=Yw1;var wi=(Z,J={})=>{if(cG(Z),J.nobrace||!/\{(?:(?!\{).)*\}/.test(Z))return[Z];return $i(Z)};Z5.braceExpand=wi;var $w1=(Z,J={})=>new b9(Z,J).makeRe();Z5.makeRe=$w1;var Qw1=(Z,J,X={})=>{let Y=new b9(J,X);if(Z=Z.filter(($)=>Y.match($)),Y.options.nonull&&!Z.length)Z.push(J);return Z};Z5.match=Qw1;var Vi=/[?*]|[+@!]\(.*?\)|\[|\]/,Ww1=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class b9{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(Z,J={}){if(cG(Z),J=J||{},this.options=J,this.pattern=Z,this.platform=J.platform||Ui,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]==="?"||!Vi.test($[2]))&&!Vi.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]),j=!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=j?3:w?0:void 0;if(typeof N==="number"&&typeof R==="number"){let[O,P]=[Z[N],J[R]];if(O.toLowerCase()===P.toLowerCase()){if(J[R]=O,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===M6){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(`
403
403
  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(`
404
- >>> 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 wi(this.pattern,this.options)}parse(Z){cG(Z);let J=this.options;if(Z==="**")return M6;if(Z==="")return"";let X,Y=null;if(X=Z.match(c21))Y=J.dot?p21:l21;else if(X=Z.match(A21))Y=(J.nocase?J.dot?b21:f21:J.dot?h21:x21)(X[1]);else if(X=Z.match(i21))Y=(J.nocase?J.dot?a21:n21:J.dot?s21:o21)(X);else if(X=Z.match(y21))Y=J.dot?m21:g21;else if(X=Z.match(u21))Y=d21;let $=O6.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?e21:J.dot?Zw1:Jw1,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"?Ww1(z):z===M6?M6:z._src});return G.forEach((z,H)=>{let V=G[H+1],q=G[H-1];if(z!==M6||q===M6)return;if(q===void 0)if(V!==void 0&&V!==M6)G[H+1]="(?:\\/|"+X+"\\/)?"+V;else G[H]=X;else if(V===void 0)G[H-1]=q+"(?:\\/|"+X+")?";else if(V!==M6)G[H-1]=q+"(?:\\/|\\/"+X+"\\/)"+V,G[H+1]=M6}),G.filter((z)=>z!==M6).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 Z5.defaults(Z).Minimatch}}Z5.AST=O6;Z5.Minimatch=b9;Z5.escape=MW;Z5.unescape=h4;import{fileURLToPath as yw1}from"url";var RW=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,Li=new Set,BC=typeof process==="object"&&!!process?process:{},ji=(Z,J,X,Y)=>{typeof BC.emitWarning==="function"?BC.emitWarning(Z,J,X,Y):console.error(`[${X}] ${J}: ${Z}`)},e2=globalThis.AbortController,Bi=globalThis.AbortSignal;if(typeof e2==="undefined"){Bi=class X{onabort;_onabort=[];reason;aborted=!1;addEventListener(Y,$){this._onabort.push($)}},e2=class X{constructor(){J()}signal=new Bi;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=BC.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",J=()=>{if(!Z)return;Z=!1,ji("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 Kw1=(Z)=>!Li.has(Z),$w6=Symbol("type"),ZX=(Z)=>Z&&Z===Math.floor(Z)&&Z>0&&isFinite(Z),Oi=(Z)=>!ZX(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?pG:null;class pG extends Array{constructor(Z){super(Z);this.fill(0)}}class NW{heap;length;static#Z=!1;static create(Z){let J=Oi(Z);if(!J)return[];NW.#Z=!0;let X=new NW(Z,J);return NW.#Z=!1,X}constructor(Z,J){if(!NW.#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 iG{#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;#j;#k;#O;#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.#j},free:Z.#k,isBackgroundFetch:(J)=>Z.#F(J),backgroundFetch:(J,X,Y,$)=>Z.#h(J,X,Y,$),moveToTail:(J)=>Z.#y(J),indexes:(J)=>Z.#T(J),rindexes:(J)=>Z.#I(J),isStale:(J)=>Z.#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:j,noDeleteOnFetchRejection:N,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:P,ignoreFetchAbort:D}=Z;if(J!==0&&!ZX(J))throw new TypeError("max option must be a nonnegative integer");let C=J?Oi(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(j!==void 0&&typeof j!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#q=j,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.#j=0,this.#k=NW.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.#O=[];else this.#$=void 0,this.#O=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=!!O,this.allowStaleOnFetchAbort=!!P,this.ignoreFetchAbort=!!D,this.maxEntrySize!==0){if(this.#J!==0){if(!ZX(this.#J))throw new TypeError("maxSize must be a positive integer if specified")}if(!ZX(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=ZX(Y)||Y===0?Y:1,this.ttlAutopurge=!!$,this.ttl=X||0,this.ttl){if(!ZX(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(Kw1("LRU_CACHE_UNBOUNDED"))Li.add("LRU_CACHE_UNBOUNDED"),ji("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",iG)}}getRemainingTTL(Z){return this.#z.has(Z)?1/0:0}#W(){let Z=new pG(this.#Z),J=new pG(this.#Z);this.#R=Z,this.#N=J,this.#S=($,Q,W=RW.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.#A=($)=>{J[$]=Z[$]!==0?RW.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 $=RW.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}}#A=()=>{};#D=()=>{};#S=()=>{};#P=()=>!1;#m(){let Z=new pG(this.#Z);this.#G=0,this.#E=Z,this.#x=(J)=>{this.#G-=Z[J],Z[J]=0},this.#u=(J,X,Y,$)=>{if(this.#F(X))return 0;if(!ZX(Y))if($){if(typeof $!=="function")throw new TypeError("sizeCalculation must be a function");if(Y=$(X,J),!ZX(Y))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return Y},this.#f=(J,X,Y)=>{if(Z[J]=X,this.#J){let $=this.#J-Z[J];while(this.#G>$)this.#b(!0)}if(this.#G+=Z[J],Y)Y.entrySize=X,Y.totalCalculatedSize=this.#G}}#x=(Z)=>{};#f=(Z,J,X)=>{};#u=(Z,J,X,Y)=>{if(X||Y)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:Z=this.allowStale}={}){if(this.#K)for(let J=this.#j;;){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.#j)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-(RW.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=RW.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=RW.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.#j: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.#j]=H,this.#B[H]=this.#j,this.#j=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.#O?.push([q,Z,"set"])}}else if(!Q){if(this.#M)this.#Y?.(V,Z,"set");if(this.#L)this.#O?.push([V,Z,"set"])}if(this.#x(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.#O){let V=this.#O,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.#O){let Z=this.#O,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.#O?.push([Y,X,"evict"])}if(this.#x(J),Z)this.#V[J]=void 0,this.#Q[J]=void 0,this.#k.push(J);if(this.#K===1)this.#w=this.#j=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.#A($);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 e2,{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,j=X.ignoreFetchAbort&&U!==void 0;if(X.status)if(w&&!B){if(X.status.fetchAborted=!0,X.status.fetchError=Q.signal.reason,j)X.status.fetchAbortIgnored=!0}else X.status.fetchResolved=!0;if(w&&!j&&!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,j=w||X.allowStaleOnFetchRejection,N=j||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(j){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((j)=>U(j===void 0?void 0:j),B);Q.signal.addEventListener("abort",()=>{if(!X.ignoreFetchAbort||X.allowStaleOnFetchAbort){if(U(void 0),X.allowStaleOnFetchAbort)U=(j)=>G(j,!0)}})};if(X.status)X.status.fetchDispatched=!0;let q=new Promise(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 e2}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:j}=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:j},R=this.#z.get(Z);if(R===void 0){if(w)w.fetch="miss";let O=this.#h(Z,R,N,U);return O.__returned=O}else{let O=this.#Q[R];if(this.#F(O)){let k=X&&O.__staleWhileFetching!==void 0;if(w){if(w.fetch="inflight",k)w.returnedStale=!0}return k?O.__staleWhileFetching:O.__returned=O}let P=this.#P(R);if(!B&&!P){if(w)w.fetch="hit";if(this.#y(R),Y)this.#A(R);if(w)this.#D(w,R);return O}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.#A(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.#j){if(Z===this.#w)this.#w=this.#U[Z];else this.#c(this.#B[Z],this.#U[Z]);this.#c(this.#j,Z),this.#j=Z}}delete(Z){return this.#_(Z,"delete")}#_(Z,J){let X=!1;if(this.#K!==0){let Y=this.#z.get(Z);if(Y!==void 0)if(X=!0,this.#K===1)this.#g(J);else{this.#x(Y);let $=this.#Q[Y];if(this.#F($))$.__abortController.abort(new Error("deleted"));else if(this.#M||this.#L){if(this.#M)this.#Y?.($,Z,J);if(this.#L)this.#O?.push([$,Z,J])}if(this.#z.delete(Z),this.#V[Y]=void 0,this.#Q[Y]=void 0,Y===this.#j)this.#j=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.#O?.length){let Y=this.#O,$;while($=Y?.shift())this.#$?.(...$)}return X}clear(){return this.#g("delete")}#g(Z){for(let J of this.#I({allowStale:!0})){let X=this.#Q[J];if(this.#F(X))X.__abortController.abort(new Error("deleted"));else{let Y=this.#V[J];if(this.#M)this.#Y?.(X,Y,Z);if(this.#L)this.#O?.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.#j=0,this.#k.length=0,this.#G=0,this.#K=0,this.#L&&this.#O){let J=this.#O,X;while(X=J?.shift())this.#$?.(...X)}}}import{posix as jw1,win32 as TC}from"path";import{fileURLToPath as Ow1}from"url";import{lstatSync as Mw1,readdir as Rw1,readdirSync as Nw1,readlinkSync as Dw1,realpathSync as Pw1}from"fs";import*as Cw1 from"fs";import{lstat as kw1,readdir as Ew1,readlink as Iw1,realpath as vw1}from"fs/promises";import{EventEmitter as NC}from"events";import Pi from"stream";import{StringDecoder as Gw1}from"string_decoder";var Mi=typeof process==="object"&&process?process:{stdout:null,stderr:null},zw1=(Z)=>!!Z&&typeof Z==="object"&&(Z instanceof $$||Z instanceof Pi||Hw1(Z)||Vw1(Z)),Hw1=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof NC&&typeof Z.pipe==="function"&&Z.pipe!==Pi.Writable.prototype.pipe,Vw1=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof NC&&typeof Z.write==="function"&&typeof Z.end==="function",SZ=Symbol("EOF"),_Z=Symbol("maybeEmitEnd"),JX=Symbol("emittedEnd"),Zw=Symbol("emittingEnd"),nG=Symbol("emittedError"),Jw=Symbol("closed"),Ri=Symbol("read"),Xw=Symbol("flush"),Ni=Symbol("flushChunk"),f4=Symbol("encoding"),DW=Symbol("decoder"),X6=Symbol("flowing"),aG=Symbol("paused"),PW=Symbol("resume"),Y6=Symbol("buffer"),J5=Symbol("pipes"),$6=Symbol("bufferLength"),LC=Symbol("bufferPush"),Yw=Symbol("bufferShift"),_6=Symbol("objectMode"),k8=Symbol("destroyed"),jC=Symbol("error"),OC=Symbol("emitData"),Di=Symbol("emitEnd"),MC=Symbol("emitEnd2"),P7=Symbol("async"),RC=Symbol("abort"),$w=Symbol("aborted"),sG=Symbol("signal"),Y$=Symbol("dataListeners"),$9=Symbol("discarded"),oG=(Z)=>Promise.resolve().then(Z),qw1=(Z)=>Z(),Fw1=(Z)=>Z==="end"||Z==="finish"||Z==="prefinish",Uw1=(Z)=>Z instanceof ArrayBuffer||!!Z&&typeof Z==="object"&&Z.constructor&&Z.constructor.name==="ArrayBuffer"&&Z.byteLength>=0,ww1=(Z)=>!Buffer.isBuffer(Z)&&ArrayBuffer.isView(Z);class DC{src;dest;opts;ondrain;constructor(Z,J,X){this.src=Z,this.dest=J,this.opts=X,this.ondrain=()=>Z[PW](),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 Ci extends DC{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 Bw1=(Z)=>!!Z.objectMode,Lw1=(Z)=>!Z.objectMode&&!!Z.encoding&&Z.encoding!=="buffer";class $$ extends NC{[X6]=!1;[aG]=!1;[J5]=[];[Y6]=[];[_6];[f4];[P7];[DW];[SZ]=!1;[JX]=!1;[Zw]=!1;[Jw]=!1;[nG]=null;[$6]=0;[k8]=!1;[sG];[$w]=!1;[Y$]=0;[$9]=!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(Bw1(J))this[_6]=!0,this[f4]=null;else if(Lw1(J))this[f4]=J.encoding,this[_6]=!1;else this[_6]=!1,this[f4]=null;if(this[P7]=!!J.async,this[DW]=this[f4]?new Gw1(this[f4]):null,J&&J.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[Y6]});if(J&&J.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[J5]});let{signal:X}=J;if(X)if(this[sG]=X,X.aborted)this[RC]();else X.addEventListener("abort",()=>this[RC]())}get bufferLength(){return this[$6]}get encoding(){return this[f4]}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[_6]}set objectMode(Z){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[P7]}set["async"](Z){this[P7]=this[P7]||!!Z}[RC](){this[$w]=!0,this.emit("abort",this[sG]?.reason),this.destroy(this[sG]?.reason)}get aborted(){return this[$w]}set aborted(Z){}write(Z,J,X){if(this[$w])return!1;if(this[SZ])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[P7]?oG:qw1;if(!this[_6]&&!Buffer.isBuffer(Z)){if(ww1(Z))Z=Buffer.from(Z.buffer,Z.byteOffset,Z.byteLength);else if(Uw1(Z))Z=Buffer.from(Z);else if(typeof Z!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[_6]){if(this[X6]&&this[$6]!==0)this[Xw](!0);if(this[X6])this.emit("data",Z);else this[LC](Z);if(this[$6]!==0)this.emit("readable");if(X)Y(X);return this[X6]}if(!Z.length){if(this[$6]!==0)this.emit("readable");if(X)Y(X);return this[X6]}if(typeof Z==="string"&&!(J===this[f4]&&!this[DW]?.lastNeed))Z=Buffer.from(Z,J);if(Buffer.isBuffer(Z)&&this[f4])Z=this[DW].write(Z);if(this[X6]&&this[$6]!==0)this[Xw](!0);if(this[X6])this.emit("data",Z);else this[LC](Z);if(this[$6]!==0)this.emit("readable");if(X)Y(X);return this[X6]}read(Z){if(this[k8])return null;if(this[$9]=!1,this[$6]===0||Z===0||Z&&Z>this[$6])return this[_Z](),null;if(this[_6])Z=null;if(this[Y6].length>1&&!this[_6])this[Y6]=[this[f4]?this[Y6].join(""):Buffer.concat(this[Y6],this[$6])];let J=this[Ri](Z||null,this[Y6][0]);return this[_Z](),J}[Ri](Z,J){if(this[_6])this[Yw]();else{let X=J;if(Z===X.length||Z===null)this[Yw]();else if(typeof X==="string")this[Y6][0]=X.slice(Z),J=X.slice(0,Z),this[$6]-=Z;else this[Y6][0]=X.subarray(Z),J=X.subarray(0,Z),this[$6]-=Z}if(this.emit("data",J),!this[Y6].length&&!this[SZ])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[SZ]=!0,this.writable=!1,this[X6]||!this[aG])this[_Z]();return this}[PW](){if(this[k8])return;if(!this[Y$]&&!this[J5].length)this[$9]=!0;if(this[aG]=!1,this[X6]=!0,this.emit("resume"),this[Y6].length)this[Xw]();else if(this[SZ])this[_Z]();else this.emit("drain")}resume(){return this[PW]()}pause(){this[X6]=!1,this[aG]=!0,this[$9]=!1}get destroyed(){return this[k8]}get flowing(){return this[X6]}get paused(){return this[aG]}[LC](Z){if(this[_6])this[$6]+=1;else this[$6]+=Z.length;this[Y6].push(Z)}[Yw](){if(this[_6])this[$6]-=1;else this[$6]-=this[Y6][0].length;return this[Y6].shift()}[Xw](Z=!1){do;while(this[Ni](this[Yw]())&&this[Y6].length);if(!Z&&!this[Y6].length&&!this[SZ])this.emit("drain")}[Ni](Z){return this.emit("data",Z),this[X6]}pipe(Z,J){if(this[k8])return Z;this[$9]=!1;let X=this[JX];if(J=J||{},Z===Mi.stdout||Z===Mi.stderr)J.end=!1;else J.end=J.end!==!1;if(J.proxyErrors=!!J.proxyErrors,X){if(J.end)Z.end()}else if(this[J5].push(!J.proxyErrors?new DC(this,Z,J):new Ci(this,Z,J)),this[P7])oG(()=>this[PW]());else this[PW]();return Z}unpipe(Z){let J=this[J5].find((X)=>X.dest===Z);if(J){if(this[J5].length===1){if(this[X6]&&this[Y$]===0)this[X6]=!1;this[J5]=[]}else this[J5].splice(this[J5].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[$9]=!1,this[Y$]++,!this[J5].length&&!this[X6])this[PW]()}else if(Z==="readable"&&this[$6]!==0)super.emit("readable");else if(Fw1(Z)&&this[JX])super.emit(Z),this.removeAllListeners(Z);else if(Z==="error"&&this[nG]){let Y=J;if(this[P7])oG(()=>Y.call(this,this[nG]));else Y.call(this,this[nG])}return X}removeListener(Z,J){return this.off(Z,J)}off(Z,J){let X=super.off(Z,J);if(Z==="data"){if(this[Y$]=this.listeners("data").length,this[Y$]===0&&!this[$9]&&!this[J5].length)this[X6]=!1}return X}removeAllListeners(Z){let J=super.removeAllListeners(Z);if(Z==="data"||Z===void 0){if(this[Y$]=0,!this[$9]&&!this[J5].length)this[X6]=!1}return J}get emittedEnd(){return this[JX]}[_Z](){if(!this[Zw]&&!this[JX]&&!this[k8]&&this[Y6].length===0&&this[SZ]){if(this[Zw]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Jw])this.emit("close");this[Zw]=!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[_6]&&!X?!1:this[P7]?(oG(()=>this[OC](X)),!0):this[OC](X);else if(Z==="end")return this[Di]();else if(Z==="close"){if(this[Jw]=!0,!this[JX]&&!this[k8])return!1;let $=super.emit("close");return this.removeAllListeners("close"),$}else if(Z==="error"){this[nG]=X,super.emit(jC,X);let $=!this[sG]||this.listeners("error").length?super.emit("error",X):!1;return this[_Z](),$}else if(Z==="resume"){let $=super.emit("resume");return this[_Z](),$}else if(Z==="finish"||Z==="prefinish"){let $=super.emit(Z);return this.removeAllListeners(Z),$}let Y=super.emit(Z,...J);return this[_Z](),Y}[OC](Z){for(let X of this[J5])if(X.dest.write(Z)===!1)this.pause();let J=this[$9]?!1:super.emit("data",Z);return this[_Z](),J}[Di](){if(this[JX])return!1;return this[JX]=!0,this.readable=!1,this[P7]?(oG(()=>this[MC]()),!0):this[MC]()}[MC](){if(this[DW]){let J=this[DW].end();if(J){for(let X of this[J5])X.dest.write(J);if(!this[$9])super.emit("data",J)}}for(let J of this[J5])J.end();let Z=super.emit("end");return this.removeAllListeners("end"),Z}async collect(){let Z=Object.assign([],{dataLength:0});if(!this[_6])Z.dataLength=0;let J=this.promise();return this.on("data",(X)=>{if(Z.push(X),!this[_6])Z.dataLength+=X.length}),await J,Z}async concat(){if(this[_6])throw new Error("cannot concat in objectMode");let Z=await this.collect();return this[f4]?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[$9]=!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[SZ])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[SZ]})},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[$9]=!1;let Z=!1,J=()=>{return this.pause(),this.off(jC,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(jC,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[$9]=!0,this[Y6].length=0,this[$6]=0;let J=this;if(typeof J.close==="function"&&!this[Jw])J.close();if(Z)this.emit("error",Z);else this.emit(k8);return this}static get isStream(){return zw1}}var Tw1=Pw1.native,tG={lstatSync:Mw1,readdir:Rw1,readdirSync:Nw1,readlinkSync:Dw1,realpathSync:Tw1,promises:{lstat:kw1,readdir:Ew1,readlink:Iw1,realpath:vw1}},vi=(Z)=>!Z||Z===tG||Z===Cw1?tG:{...tG,...Z,promises:{...tG.promises,...Z.promises||{}}},Si=/^\\\\\?\\([a-z]:)\\?$/i,Sw1=(Z)=>Z.replace(/\//g,"\\").replace(Si,"$1\\"),_w1=/[\\\/]/,g9=0,_i=1,Ai=2,C7=4,xi=6,hi=8,Q$=10,fi=12,y9=15,rG=~y9,PC=16,Ti=32,eG=64,b4=128,Qw=256,Kw=512,ki=eG|b4|Kw,Aw1=1023,CC=(Z)=>Z.isFile()?hi:Z.isDirectory()?C7:Z.isSymbolicLink()?Q$:Z.isCharacterDevice()?Ai:Z.isBlockDevice()?xi:Z.isSocket()?fi:Z.isFIFO()?_i:g9,Ei=new Map,Zz=(Z)=>{let J=Ei.get(Z);if(J)return J;let X=Z.normalize("NFKD");return Ei.set(Z,X),X},Ii=new Map,Ww=(Z)=>{let J=Ii.get(Z);if(J)return J;let X=Zz(Z.toLowerCase());return Ii.set(Z,X),X};class kC extends iG{constructor(){super({max:256})}}class bi extends iG{constructor(Z=16384){super({maxSize:Z,sizeCalculation:(J)=>J.length+1})}}var yi=Symbol("PathScurry setAsCwd");class X5{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}#j;get atime(){return this.#j}#k;get mtime(){return this.#k}#O;get ctime(){return this.#O}#E;get birthtime(){return this.#E}#N;#R;#M;#C;#L;#v;#W;#A;#D;#S;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Z,J=g9,X,Y,$,Q,W){if(this.name=Z,this.#N=$?Ww(Z):Zz(Z),this.#W=J&Aw1,this.nocase=$,this.roots=Y,this.root=X||this,this.#A=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=vi(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.#A}resolve(Z){if(!Z)return this;let J=this.getRootString(Z),Y=Z.substring(J.length).split(this.splitSep);return J?this.getRoot(J).#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.#A.get(this);if(Z)return Z;let J=Object.assign([],{provisional:0});return this.#A.set(this,J),this.#W&=~PC,J}child(Z,J){if(Z===""||Z===".")return this;if(Z==="..")return this.parent||this;let X=this.children(),Y=this.nocase?Ww(Z):Zz(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,g9,{...J,parent:this,fullpath:Q});if(!this.canReaddir())W.#W|=b4;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&y9)===g9}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&y9)===hi}isDirectory(){return(this.#W&y9)===C7}isCharacterDevice(){return(this.#W&y9)===Ai}isBlockDevice(){return(this.#W&y9)===xi}isFIFO(){return(this.#W&y9)===_i}isSocket(){return(this.#W&y9)===fi}isSymbolicLink(){return(this.#W&Q$)===Q$}lstatCached(){return this.#W&Ti?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&y9;return!(Z!==g9&&Z!==Q$||this.#W&Qw||this.#W&b4)}calledReaddir(){return!!(this.#W&PC)}isENOENT(){return!!(this.#W&b4)}isNamed(Z){return!this.nocase?this.#N===Zz(Z):this.#N===Ww(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|=PC;for(let J=Z.provisional;J<Z.length;J++){let X=Z[J];if(X)X.#x()}}#x(){if(this.#W&b4)return;this.#W=(this.#W|b4)&rG,this.#f()}#f(){let Z=this.children();Z.provisional=0;for(let J of Z)J.#x()}#u(){this.#W|=Kw,this.#T()}#T(){if(this.#W&eG)return;let Z=this.#W;if((Z&y9)===C7)Z&=rG;this.#W=Z|eG,this.#f()}#I(Z=""){if(Z==="ENOTDIR"||Z==="EPERM")this.#T();else if(Z==="ENOENT")this.#x();else this.children().provisional=0}#d(Z=""){if(Z==="ENOTDIR")this.parent.#T();else if(Z==="ENOENT")this.#x()}#b(Z=""){let J=this.#W;if(J|=Qw,Z==="ENOENT")J|=b4;if(Z==="EINVAL"||Z==="UNKNOWN")J&=rG;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=CC(Z),Y=this.newChild(Z.name,X,{parent:this}),$=Y.#W&y9;if($!==C7&&$!==Q$&&$!==g9)Y.#W|=eG;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?Ww(Z.name):Zz(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&rG|CC(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&b4)===0)try{return this.#_(await this.#Z.promises.lstat(this.fullpath())),this}catch(Z){this.#d(Z.code)}}lstatSync(){if((this.#W&b4)===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:j,uid:N}=Z;this.#j=J,this.#Q=X,this.#E=Y,this.#w=$,this.#K=Q,this.#V=W,this.#O=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=j,this.#$=N;let R=CC(Z);if(this.#W=this.#W&rG|R|Ti,R!==g9&&R!==C7&&R!==Q$)this.#W|=eG}#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&ki)return!1;let Z=y9&this.#W;if(!(Z===g9||Z===C7||Z===Q$))return!1;return!0}shouldWalk(Z,J){return(this.#W&C7)===C7&&!(this.#W&ki)&&!Z.has(this)&&(!J||J(this))}async realpath(){if(this.#S)return this.#S;if((Kw|Qw|b4)&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((Kw|Qw|b4)&this.#W)return;try{let Z=this.#Z.realpathSync(this.fullpath());return this.#S=this.resolve(Z)}catch(Z){this.#u()}}[yi](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 Gw extends X5{sep="\\";splitSep=_w1;constructor(Z,J=g9,X,Y,$,Q,W){super(Z,J,X,Y,$,Q,W)}newChild(Z,J=g9,X={}){return new Gw(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),X)}getRootString(Z){return TC.parse(Z).root}getRoot(Z){if(Z=Sw1(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 Jz(Z,this).root}sameRoot(Z,J=this.root.name){return Z=Z.toUpperCase().replace(/\//g,"\\").replace(Si,"$1\\"),Z===J}}class zw extends X5{splitSep="/";sep="/";constructor(Z,J=g9,X,Y,$,Q,W){super(Z,J,X,Y,$,Q,W)}getRootString(Z){return Z.startsWith("/")?"/":""}getRoot(Z){return this.root}newChild(Z,J=g9,X={}){return new zw(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),X)}}class EC{root;rootPath;roots;cwd;#Z;#J;#Y;nocase;#X;constructor(Z=process.cwd(),J,X,{nocase:Y,childrenCacheSize:$=16384,fs:Q=tG}={}){if(this.#X=vi(Q),Z instanceof URL||Z.startsWith("file://"))Z=Ow1(Z);let W=J.resolve(Z);this.roots=Object.create(null),this.rootPath=this.parseRootPath(W),this.#Z=new kC,this.#J=new kC,this.#Y=new bi($);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 X5))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 X5))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 X5))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 X5))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 X5))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 X5))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 X5))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((j)=>j?.isUnknown()?j.lstat():j).then((j)=>j?.shouldWalk(K,Q)?G(j,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 X5))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 X5))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 X5))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 X5))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,W=new $$({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,j=!1)=>{if(B)return W.emit("error",B);if(Y&&!j){let N=[];for(let R of w)if(R.isSymbolicLink())N.push(R.realpath().then((O)=>O?.isUnknown()?O.lstat():O));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 X5))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,W=new $$({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[yi](J)}}class Jz extends EC{sep="\\";constructor(Z=process.cwd(),J={}){let{nocase:X=!0}=J;super(Z,TC,"\\",{...J,nocase:X});this.nocase=X;for(let Y=this.cwd;Y;Y=Y.parent)Y.nocase=this.nocase}parseRootPath(Z){return TC.parse(Z).root.toUpperCase()}newRoot(Z){return new Gw(this.rootPath,C7,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")||Z.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Z)}}class Xz extends EC{sep="/";constructor(Z=process.cwd(),J={}){let{nocase:X=!1}=J;super(Z,jw1,"/",{...J,nocase:X});this.nocase=X}parseRootPath(Z){return"/"}newRoot(Z){return new zw(this.rootPath,C7,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")}}class Hw extends Xz{constructor(Z=process.cwd(),J={}){let{nocase:X=!0}=J;super(Z,{...J,nocase:X})}}var Bw6=process.platform==="win32"?Gw:zw,gi=process.platform==="win32"?Jz:process.platform==="darwin"?Hw:Xz;var xw1=(Z)=>Z.length>=1,hw1=(Z)=>Z.length>=1;class CW{#Z;#J;#Y;length;#X;#$;#H;#q;#K;#G;#z=!0;constructor(Z,J,X,Y){if(!xw1(Z))throw new TypeError("empty pattern list");if(!hw1(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]===M6}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 CW(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 fw1=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class Yz{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Z,{nobrace:J,nocase:X,noext:Y,noglobstar:$,platform:Q=fw1}){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 b9(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 CW(Y,$,0,this.platform),W=new b9(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 IC{store;constructor(Z=new Map){this.store=Z}copy(){return new IC(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 mi{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 ui{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 $z{hasWalkedCache;matches=new mi;subwalks=new ui;patterns;follow;dot;opts;constructor(Z,J){this.opts=Z,this.follow=!!Z.follow,this.dot=!!Z.dot,this.hasWalkedCache=J?J.copy():new IC}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===M6){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 $z(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===M6)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 bw1=(Z,J)=>typeof Z==="string"?new Yz([Z],J):Array.isArray(Z)?new Yz(Z,J):Z;class vC{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=bw1(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 $z(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 $z(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 Vw extends vC{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 qw extends vC{results;constructor(Z,J,X){super(Z,J,X);this.results=new $$({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 gw1=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class T7{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=yw1(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||gw1,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"?Jz:J.platform==="darwin"?Hw:J.platform?Xz:gi;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 b9(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 CW(K,z,0,this.platform)})}async walk(){return[...await new Vw(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 Vw(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 qw(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 qw(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 SC=(Z,J={})=>{if(!Array.isArray(Z))Z=[Z];for(let X of Z)if(new b9(X,J).hasMagic())return!0;return!1};function Uw(Z,J={}){return new T7(Z,J).streamSync()}function ci(Z,J={}){return new T7(Z,J).stream()}function li(Z,J={}){return new T7(Z,J).walkSync()}async function di(Z,J={}){return new T7(Z,J).walk()}function ww(Z,J={}){return new T7(Z,J).iterateSync()}function pi(Z,J={}){return new T7(Z,J).iterate()}var mw1=Uw,uw1=Object.assign(ci,{sync:Uw}),dw1=ww,cw1=Object.assign(pi,{sync:ww}),lw1=Object.assign(li,{stream:Uw,iterate:ww}),Fw=Object.assign(di,{glob:di,globSync:li,sync:lw1,globStream:ci,stream:uw1,globStreamSync:Uw,streamSync:mw1,globIterate:pi,iterate:cw1,globIterateSync:ww,iterateSync:dw1,Glob:T7,hasMagic:SC,escape:MW,unescape:h4});Fw.glob=Fw;class _C{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 v5{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 TW extends _C{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 v5(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 Qz(){return Qz=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},Qz.apply(this,arguments)}class A6{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 I0{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 W8{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"),y4=Symbol("immutableKeys");class kW extends _C{constructor(Z){super();this._disposed=!1,this.graph=void 0,this[y0]=void 0,this[y4]=void 0,this.graph=Z,this[y4]=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 kW){let $=this.graph._createEdge(X,this,Y);this[y4].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 v5){let $=Y;if($.getChild()===Z)this.setRef(X,J,$.getAttributes())}else if(Y instanceof A6)for(let $ of Y.listRefsByChild(Z)){let Q=$.getAttributes();this.removeRef(X,Z),this.addRef(X,J,Q)}else if(Y instanceof I0){let $=Y.getRefByChild(Z);if($){let Q=$.getAttributes();this.removeRef(X,Z),this.addRef(X,J,Q)}}else if(Y instanceof W8)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[y4].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 A6)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 A6||J instanceof I0)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,Qz({},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 W8)return J;throw new Error(`Expected RefMap for attribute "${Z}"`)}dispatchEvent(Z){return super.dispatchEvent(Qz({},Z,{target:this})),this.graph.dispatchEvent(Qz({},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[y4].has(J))Z.getChild().dispose()}else if(this[y0][J]instanceof A6)this[y0][J].remove(Z);else if(this[y0][J]instanceof I0)this[y0][J].remove(Z);else if(this[y0][J]instanceof W8){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 ti="v4.1.1",Rw="@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 Nw;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(Nw||(Nw={}));var Q9;(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"})(Q9||(Q9={}));var Dw;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(Dw||(Dw={}));var AZ;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(AZ||(AZ={}));var $X={"5120":Int8Array,"5121":Uint8Array,"5122":Int16Array,"5123":Uint16Array,"5125":Uint32Array,"5126":Float32Array},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 pw1(){var Z=new xC(3);if(xC!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function AC(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function iw1(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=pw1();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 yC(Z){let J=ei(),X=Z.propertyType===s.NODE?[Z]:Z.listChildren();for(let Y of X)Y.traverse(($)=>{let Q=$.getMesh();if(!Q)return;let W=nw1(Q,$.getWorldMatrix());if(W.min.every(isFinite)&&W.max.every(isFinite))hC(W.min,J),hC(W.max,J)});return J}function nw1(Z,J){let X=ei();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=iw1(K,W,J),hC(K,X)}}return X}function hC(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 ei(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class a0{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 gC{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 Zn{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),aw1(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 Tw{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(a0.decodeText(Z.slice(12,16))===Tw.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}}Tw.PNG_FRIED_CHUNK_NAME="CgBI";class xZ{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}`}}xZ.impls={"image/jpeg":new Zn,"image/png":new Tw};function aw1(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 hZ{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 xZ.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 ii(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function W$(Z){if(ii(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let X=J.prototype;if(ii(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}var fC,Wz;(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"})(Wz||(Wz={}));class _5{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=_5.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=_5.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=_5.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=_5.Verbosity.ERROR)console.error(Z)}}fC=_5;_5.Verbosity=Wz;_5.DEFAULT_INSTANCE=new fC(fC.Verbosity.INFO);function sw1(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],j=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,O=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,A=H*B-V*U,v=H*w-q*U,x=V*w-q*B;return j*x-N*v+R*A+O*k-P*T+D*C}function ow1(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],j=J[14],N=J[15],R=X[0],O=X[1],P=X[2],D=X[3];return Z[0]=R*Y+O*K+P*V+D*B,Z[1]=R*$+O*G+P*q+D*w,Z[2]=R*Q+O*z+P*F+D*j,Z[3]=R*W+O*H+P*U+D*N,R=X[4],O=X[5],P=X[6],D=X[7],Z[4]=R*Y+O*K+P*V+D*B,Z[5]=R*$+O*G+P*q+D*w,Z[6]=R*Q+O*z+P*F+D*j,Z[7]=R*W+O*H+P*U+D*N,R=X[8],O=X[9],P=X[10],D=X[11],Z[8]=R*Y+O*K+P*V+D*B,Z[9]=R*$+O*G+P*q+D*w,Z[10]=R*Q+O*z+P*F+D*j,Z[11]=R*W+O*H+P*U+D*N,R=X[12],O=X[13],P=X[14],D=X[15],Z[12]=R*Y+O*K+P*V+D*B,Z[13]=R*$+O*G+P*q+D*w,Z[14]=R*Q+O*z+P*F+D*j,Z[15]=R*W+O*H+P*U+D*N,Z}function rw1(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 tw1(Z,J){var X=new xC(3);rw1(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 l0{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(l0.clamp(Z,0,1)*65535);case 5121:return Math.round(l0.clamp(Z,0,1)*255);case 5122:return Math.round(l0.clamp(Z,-1,1)*32767);case 5120:return Math.round(l0.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,X,Y){let $=AC([Z[0],Z[1],Z[2]]),Q=AC([Z[4],Z[5],Z[6]]),W=AC([Z[8],Z[9],Z[10]]);if(sw1(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,tw1(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,j=K*V,N=G*z,R=G*H,O=G*V,P=X[0],D=X[1],C=X[2];return $[0]=(1-(B+j))*P,$[1]=(F+O)*P,$[2]=(U-R)*P,$[3]=0,$[4]=(F-O)*D,$[5]=(1-(q+j))*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 ew1(Z,J){if(!!Z!==!!J)return!1;let X=Z.getChild(),Y=J.getChild();return X===Y||X.equals(Y)}function ZB1(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 JB1(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 Jn(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 Xn(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!W$(Z)||!W$(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(Pw(K)&&Pw(G)){if(!Jn(K,G))return!1}else if(W$(K)&&W$(G)){if(!Xn(K,G))return!1}else if(K!==G)return!1}return!0}function Pw(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var ni="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ",XB1=999,YB1=6,ai=new Set,$B1=function Z(){let J="";for(let X=0;X<YB1;X++)J+=ni.charAt(Math.floor(Math.random()*ni.length));return J},Yn=function Z(){for(let J=0;J<XB1;J++){let X=$B1();if(!ai.has(X))return ai.add(X),X}return""},si="https://null.example";class m9{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return hZ.basename(new URL(Z,si).pathname)}static extension(Z){return hZ.extension(new URL(Z,si).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)}}m9.DEFAULT_INIT={};m9.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var YX=(Z)=>Z,QB1=new Set;class kw extends kW{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,YX)}copy(Z,J=YX){for(let X in this[y0]){let Y=this[y0][X];if(Y instanceof v5){if(!this[y4].has(X))Y.dispose()}else if(Y instanceof A6||Y instanceof I0)for(let $ of Y.values())$.dispose();else if(Y instanceof W8)for(let $ of Y.values())$.dispose()}for(let X in Z[y0]){let Y=this[y0][X],$=Z[y0][X];if($ instanceof v5)if(this[y4].has(X))Y.getChild().copy(J($.getChild()),J);else this.setRef(X,J($.getChild()),$.getAttributes());else if($ instanceof I0||$ instanceof A6)for(let Q of $.values())this.addRef(X,J(Q.getChild()),Q.getAttributes());else if($ instanceof W8)for(let Q of $.keys()){let W=$.get(Q);this.setRefMap(X,Q,J(W.getChild()),W.getAttributes())}else if(W$($))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=QB1){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 v5||$ instanceof v5){if(!ew1(Y,$))return!1}else if(Y instanceof I0||$ instanceof I0||Y instanceof A6||$ instanceof A6){if(!ZB1(Y,$))return!1}else if(Y instanceof W8||$ instanceof W8){if(!JB1(Y,$))return!1}else if(W$(Y)||W$($)){if(!Xn(Y,$))return!1}else if(Pw(Y)||Pw($)){if(!Jn(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 h6 extends kw{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new W8})}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 h6{init(){this.propertyType=s.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[$]=l0.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[$]=l0.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 l0.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]=l0.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]=l0.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]=l0.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?WB1(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 WB1(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 mC extends h6{init(){this.propertyType=s.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new I0,samplers:new I0})}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 K$ extends h6{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)}}K$.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class EW extends h6{init(){this.propertyType=s.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:EW.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:Q9.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:Q9.OTHER})}}EW.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class uC extends h6{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 G$ extends h6{init(){this.propertyType=s.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:G$.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)}}G$.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class IW extends kw{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}IW.EXTENSION_NAME=void 0;class S5 extends h6{init(){this.propertyType=s.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:S5.WrapMode.REPEAT,wrapT:S5.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)}}S5.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};S5.MagFilter={NEAREST:9728,LINEAR:9729};S5.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:Bw,G:Lw,B:jw,A:KB1}=Dw;class k7 extends h6{init(){this.propertyType=s.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:k7.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new S5(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new S5(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new S5(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new S5(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new S5(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:Bw|Lw|jw|KB1,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:Bw|Lw|jw,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:Bw|Lw|jw})}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:Bw})}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:Lw|jw})}}k7.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class Gz extends h6{init(){this.propertyType=s.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new I0})}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 Ew extends h6{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 I0})}copy(Z,J=YX){if(J===YX)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 l0.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 l0.decompose(Z,J,X,Y),this.set("translation",J).set("rotation",X).set("scale",Y)}getWorldTranslation(){let Z=[0,0,0];return l0.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return l0.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return l0.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())ow1(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 E8 extends h6{init(){this.propertyType=s.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:E8.Mode.TRIANGLES,material:null,indices:null,attributes:new W8,targets:new I0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:Q9.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:Q9.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 dC extends kw{init(){this.propertyType=s.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new W8})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:Q9.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function Y5(){return Y5=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},Y5.apply(null,arguments)}class vW extends h6{init(){this.propertyType=s.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new I0})}copy(Z,J=YX){if(J===YX)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 cC extends h6{init(){this.propertyType=s.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new I0})}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:Q9.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class z$ extends h6{init(){this.propertyType=s.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||xZ.extensionToMimeType(hZ.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=xZ.extensionToMimeType(hZ.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",a0.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return xZ.getSize(Z,this.getMimeType())}}class H$ extends h6{init(){this.propertyType=s.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${ti}`,version:"2.0"},defaultScene:null,accessors:new I0,animations:new I0,buffers:new I0,cameras:new I0,materials:new I0,meshes:new I0,nodes:new I0,scenes:new I0,skins:new I0,textures:new I0})}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=YX){if(J===YX)throw new Error("Root cannot be copied.");this.set("asset",Y5({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(Y5({},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 vW)this.addRef("scenes",Z);else if(Z instanceof Ew)this.addRef("nodes",Z);else if(Z instanceof G$)this.addRef("cameras",Z);else if(Z instanceof cC)this.addRef("skins",Z);else if(Z instanceof Gz)this.addRef("meshes",Z);else if(Z instanceof k7)this.addRef("materials",Z);else if(Z instanceof z$)this.addRef("textures",Z);else if(Z instanceof mC)this.addRef("animations",Z);else if(Z instanceof h0)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 x6{static fromGraph(Z){return x6._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new TW,this._root=new H$(this._graph),this._logger=_5.DEFAULT_INSTANCE,x6._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 vW(this._graph,Z)}createNode(Z=""){return new Ew(this._graph,Z)}createCamera(Z=""){return new G$(this._graph,Z)}createSkin(Z=""){return new cC(this._graph,Z)}createMesh(Z=""){return new Gz(this._graph,Z)}createPrimitive(){return new E8(this._graph)}createPrimitiveTarget(Z=""){return new dC(this._graph,Z)}createMaterial(Z=""){return new k7(this._graph,Z)}createTexture(Z=""){return new z$(this._graph,Z)}createAnimation(Z=""){return new mC(this._graph,Z)}createAnimationChannel(Z=""){return new K$(this._graph,Z)}createAnimationSampler(Z=""){return new EW(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 uC(this._graph,Z)}}x6._GRAPH_DOCUMENTS=new WeakMap;class $n{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 IW&&$.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}}$n.EXTENSION_NAME=void 0;class Qn{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 oi={logger:_5.DEFAULT_INSTANCE,extensions:[],dependencies:{}},GB1=new Set([s.BUFFER,s.TEXTURE,s.MATERIAL,s.MESH,s.PRIMITIVE,s.NODE,s.SCENE]);class Wn{static read(Z,J=oi){let X=Y5({},oi,J),{json:Y}=Z,$=new x6().setLogger(X.logger);this.validate(Z,X);let Q=new Qn(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(Y5({},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)=>!GB1.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(s.BUFFER)).forEach((D)=>D.preread(Q,s.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[Rw],A=D.byteOffset||0;Q.bufferViews[C]=a0.toView(k,A,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(Mw(D,Q)),T});let F=Y.images||[],U=Y.textures||[];$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(s.TEXTURE)).forEach((D)=>D.preread(Q,s.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],A=k.uri?Z.resources[k.uri]:Z.resources[Rw],v=T.byteOffset||0,x=T.byteLength,I=A.slice(v,v+x);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=hZ.extension(D.uri);C.setMimeType(xZ.extensionToMimeType(T))}return C}),$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(s.MATERIAL)).forEach((D)=>D.preread(Q,s.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,A=Q.textures[U[k.index].source];C.setBaseColorTexture(A),Q.setTextureInfo(C.getBaseColorTextureInfo(),k)}if(D.emissiveTexture!==void 0){let k=D.emissiveTexture,A=Q.textures[U[k.index].source];C.setEmissiveTexture(A),Q.setTextureInfo(C.getEmissiveTextureInfo(),k)}if(D.normalTexture!==void 0){let k=D.normalTexture,A=Q.textures[U[k.index].source];if(C.setNormalTexture(A),Q.setTextureInfo(C.getNormalTextureInfo(),k),D.normalTexture.scale!==void 0)C.setNormalScale(D.normalTexture.scale)}if(D.occlusionTexture!==void 0){let k=D.occlusionTexture,A=Q.textures[U[k.index].source];if(C.setOcclusionTexture(A),Q.setTextureInfo(C.getOcclusionTextureInfo(),k),D.occlusionTexture.strength!==void 0)C.setOcclusionStrength(D.occlusionTexture.strength)}if(T.metallicRoughnessTexture!==void 0){let k=T.metallicRoughnessTexture,A=Q.textures[U[k.index].source];C.setMetallicRoughnessTexture(A),Q.setTextureInfo(C.getMetallicRoughnessTextureInfo(),k)}return C}),$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(s.MESH)).forEach((D)=>D.preread(Q,s.MESH));let w=Y.meshes||[];$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(s.PRIMITIVE)).forEach((D)=>D.preread(Q,s.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 A=$.createPrimitive();if(k.extras)A.setExtras(k.extras);if(k.material!==void 0)A.setMaterial(Q.materials[k.material]);if(k.mode!==void 0)A.setMode(k.mode);for(let[I,S]of Object.entries(k.attributes||{}))A.setAttribute(I,Q.accessors[S]);if(k.indices!==void 0)A.setIndices(Q.accessors[k.indices]);let v=D.extras&&D.extras.targetNames||[];(k.targets||[]).forEach((I,S)=>{let y=v[S]||S.toString(),m=$.createPrimitiveTarget(y);for(let[i,t]of Object.entries(I))m.setAttribute(i,Q.accessors[t]);A.addTarget(m)}),C.addPrimitive(A)}),C});let j=Y.cameras||[];Q.cameras=j.map((D)=>{let C=$.createCamera(D.name).setType(D.type);if(D.extras)C.setExtras(D.extras);if(D.type===G$.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(s.NODE)).forEach((D)=>D.preread(Q,s.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],A=[1,1,1];l0.decompose(D.matrix,T,k,A),C.setTranslation(T),C.setRotation(k),C.setScale(A)}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((A)=>T.addChild(Q.nodes[A])),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 O=Y.animations||[];Q.animations=O.map((D)=>{let C=$.createAnimation(D.name);if(D.extras)C.setExtras(D.extras);let k=(D.samplers||[]).map((v)=>{let x=$.createAnimationSampler().setInput(Q.accessors[v.input]).setOutput(Q.accessors[v.output]).setInterpolation(v.interpolation||EW.Interpolation.LINEAR);if(v.extras)x.setExtras(v.extras);return C.addSampler(x),x});return(D.channels||[]).forEach((v)=>{let x=$.createAnimationChannel().setSampler(k[v.sampler]).setTargetPath(v.target.path);if(v.target.node!==void 0)x.setTargetNode(Q.nodes[v.target.node]);if(v.extras)x.setExtras(v.extras);C.addChannel(x)}),C});let P=Y.scenes||[];if($.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(s.SCENE)).forEach((D)=>D.preread(Q,s.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,A=!D.bufferView&&!T.getArray();if(k||A)T.setSparse(!0).setArray(HB1(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 zB1(Z,J){let X=J.jsonDoc,Y=J.bufferViews[Z.bufferView],$=X.json.bufferViews[Z.bufferView],Q=$X[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 Mw(Z,J){let X=J.jsonDoc,Y=J.bufferViews[Z.bufferView],$=X.json.bufferViews[Z.bufferView],Q=$X[Z.componentType],W=h0.getElementSize(Z.type),K=Q.BYTES_PER_ELEMENT,G=W*K;if($.byteStride!==void 0&&$.byteStride!==G)return zB1(Z,J);let z=Y.byteOffset+(Z.byteOffset||0),H=Z.count*W*K;return new Q(Y.buffer.slice(z,z+H))}function HB1(Z,J){let X=$X[Z.componentType],Y=h0.getElementSize(Z.type),$;if(Z.bufferView!==void 0)$=Mw(Z,J);else $=new X(Z.count*Y);let Q=Z.sparse;if(!Q)return $;let W=Q.count,K=Y5({},Z,Q.indices,{count:W,type:"SCALAR"}),G=Y5({},Z,Q.values,{count:W}),z=Mw(K,J),H=Mw(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 Kz;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(Kz||(Kz={}));class XX{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)=>VB1(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===AZ.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=xZ.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 Q9.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 Q9.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}}XX.BufferViewTarget=Kz;XX.BufferViewUsage=Q9;XX.USAGE_TO_TARGET={[Q9.ARRAY_BUFFER]:Kz.ARRAY_BUFFER,[Q9.ELEMENT_ARRAY_BUFFER]:Kz.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 VB1(Z,J){let X=Z.getGraph().listParentEdges(J).find((Y)=>Y.getParent()!==Z.getRoot());return X?X.getName().replace(/texture$/i,""):""}var{BufferViewUsage:Ow}=XX,{UNSIGNED_INT:qB1,UNSIGNED_SHORT:FB1,UNSIGNED_BYTE:UB1}=h0.ComponentType,wB1=new Set([s.ACCESSOR,s.BUFFER,s.MATERIAL,s.MESH]);class Kn{static write(Z,J){let X=Z.getGraph(),Y=Z.getRoot(),$={asset:Y5({generator:`glTF-Transform ${ti}`},Y.getAsset()),extras:Y5({},Y.getExtras())},Q={json:$,resources:{}},W=new XX(Z,Q,J),K=J.logger||_5.DEFAULT_INSTANCE,G=new Set(J.extensions.map((w)=>w.EXTENSION_NAME)),z=Z.getRoot().listExtensionsUsed().filter((w)=>G.has(w.extensionName)).sort((w,j)=>w.extensionName>j.extensionName?1:-1),H=Z.getRoot().listExtensionsRequired().filter((w)=>G.has(w.extensionName)).sort((w,j)=>w.extensionName>j.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 j=w.prewriteTypes.filter((N)=>!wB1.has(N));if(j.length)K.warn(`Prewrite hooks for some types (${j.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,j,N,R){let O=[],P=0;for(let T of w){let k=W.createAccessorDef(T);k.bufferView=$.bufferViews.length;let A=T.getArray(),v=a0.pad(a0.toView(A));k.byteOffset=P,P+=v.byteLength,O.push(v),W.accessorIndexMap.set(T,$.accessors.length),$.accessors.push(k)}let D=a0.concat(O),C={buffer:j,byteOffset:N,byteLength:D.byteLength};if(R)C.target=R;return $.bufferViews.push(C),{buffers:O,byteLength:P}}function q(w,j,N){let R=w[0].getCount(),O=0;for(let k of w){let A=W.createAccessorDef(k);A.bufferView=$.bufferViews.length,A.byteOffset=O;let v=k.getElementSize(),x=k.getComponentSize();O+=a0.padNumber(v*x),W.accessorIndexMap.set(k,$.accessors.length),$.accessors.push(A)}let P=R*O,D=new ArrayBuffer(P),C=new DataView(D);for(let k=0;k<R;k++){let A=0;for(let v of w){let x=v.getElementSize(),I=v.getComponentSize(),S=v.getComponentType(),y=v.getArray();for(let m=0;m<x;m++){let i=k*O+A+m*I,t=y[k*x+m];switch(S){case h0.ComponentType.FLOAT:C.setFloat32(i,t,!0);break;case h0.ComponentType.BYTE:C.setInt8(i,t);break;case h0.ComponentType.SHORT:C.setInt16(i,t,!0);break;case h0.ComponentType.UNSIGNED_BYTE:C.setUint8(i,t);break;case h0.ComponentType.UNSIGNED_SHORT:C.setUint16(i,t,!0);break;case h0.ComponentType.UNSIGNED_INT:C.setUint32(i,t,!0);break;default:throw new Error("Unexpected component type: "+S)}}A+=a0.padNumber(x*I)}}let T={buffer:j,byteOffset:N,byteLength:P,byteStride:O,target:XX.BufferViewTarget.ARRAY_BUFFER};return $.bufferViews.push(T),{byteLength:P,buffers:[new Uint8Array(D)]}}function F(w,j,N){let R=[],O=0,P=new Map,D=-1/0,C=!1;for(let S of w){let y=W.createAccessorDef(S);$.accessors.push(y),W.accessorIndexMap.set(S,$.accessors.length-1);let m=[],i=[],t=[],Z0=new Array(S.getElementSize()).fill(0);for(let s0=0,b8=S.getCount();s0<b8;s0++){if(S.getElement(s0,t),l0.eq(t,Z0,0))continue;D=Math.max(s0,D),m.push(s0);for(let $8=0;$8<t.length;$8++)i.push(t[$8])}let W0=m.length,A0={accessorDef:y,count:W0};if(P.set(S,A0),W0===0)continue;if(W0>S.getCount()/2)C=!0;let x0=$X[S.getComponentType()];A0.indices=m,A0.values=new x0(i)}if(!Number.isFinite(D))return{buffers:R,byteLength:O};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?UB1:D<65535?FB1:qB1,A={buffer:j,byteOffset:N+O,byteLength:0};for(let S of w){let y=P.get(S);if(y.count===0)continue;y.indicesByteOffset=A.byteLength;let m=a0.pad(a0.toView(new T(y.indices)));R.push(m),O+=m.byteLength,A.byteLength+=m.byteLength}$.bufferViews.push(A);let v=$.bufferViews.length-1,x={buffer:j,byteOffset:N+O,byteLength:0};for(let S of w){let y=P.get(S);if(y.count===0)continue;y.valuesByteOffset=x.byteLength;let m=a0.pad(a0.toView(y.values));R.push(m),O+=m.byteLength,x.byteLength+=m.byteLength}$.bufferViews.push(x);let I=$.bufferViews.length-1;for(let S of w){let y=P.get(S);if(y.count===0)continue;y.accessorDef.sparse={count:y.count,indices:{bufferView:v,byteOffset:y.indicesByteOffset,componentType:k},values:{bufferView:I,byteOffset:y.valuesByteOffset}}}return{buffers:R,byteLength:O}}if($.accessors=[],$.bufferViews=[],$.samplers=[],$.textures=[],$.images=Y.listTextures().map((w,j)=>{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,j),N}),z.filter((w)=>w.prewriteTypes.includes(s.ACCESSOR)).forEach((w)=>w.prewrite(W,s.ACCESSOR)),Y.listAccessors().forEach((w)=>{let{accessorUsageGroupedByParent:j,accessorParents:N}=W;if(W.accessorIndexMap.has(w))return;let R=W.getAccessorUsage(w);if(W.addAccessorToUsageGroup(w,R),j.has(R)){let O=X.listParents(w).find((P)=>P.propertyType!==s.ROOT);N.set(w,O)}}),z.filter((w)=>w.prewriteTypes.includes(s.BUFFER)).forEach((w)=>w.prewrite(W,s.BUFFER)),(Y.listAccessors().length>0||W.otherBufferViews.size>0||Y.listTextures().length>0&&J.format===AZ.GLB)&&Y.listBuffers().length===0)throw new Error("Buffer required for Document resources, but none was found.");if($.buffers=[],Y.listBuffers().forEach((w,j)=>{let N=W.createPropertyDef(w),R=W.accessorUsageGroupedByParent,O=w.listParents().filter((x)=>x instanceof h0),P=new Set(O.map((x)=>W.accessorParents.get(x))),D=new Map(Array.from(P).map((x,I)=>[x,I])),C={};for(let x of O){var T;if(W.accessorIndexMap.has(x))continue;let I=W.getAccessorUsage(x),S=I;if(R.has(I)){let y=W.accessorParents.get(x);S+=`:${D.get(y)}`}C[T=S]||(C[T]={usage:I,accessors:[]}),C[S].accessors.push(x)}let k=[],A=$.buffers.length,v=0;for(let{usage:x,accessors:I}of Object.values(C))if(x===Ow.ARRAY_BUFFER&&J.vertexLayout===Nw.INTERLEAVED){let S=q(I,A,v);v+=S.byteLength;for(let y of S.buffers)k.push(y)}else if(x===Ow.ARRAY_BUFFER)for(let S of I){let y=q([S],A,v);v+=y.byteLength;for(let m of y.buffers)k.push(m)}else if(x===Ow.SPARSE){let S=F(I,A,v);v+=S.byteLength;for(let y of S.buffers)k.push(y)}else if(x===Ow.ELEMENT_ARRAY_BUFFER){let S=XX.BufferViewTarget.ELEMENT_ARRAY_BUFFER,y=V(I,A,v,S);v+=y.byteLength;for(let m of y.buffers)k.push(m)}else{let S=V(I,A,v);v+=S.byteLength;for(let y of S.buffers)k.push(y)}if(W.imageBufferViews.length&&j===0){for(let x=0;x<W.imageBufferViews.length;x++)if($.bufferViews[$.images[x].bufferView].byteOffset=v,v+=W.imageBufferViews[x].byteLength,k.push(W.imageBufferViews[x]),v%8){let I=8-v%8;v+=I,k.push(new Uint8Array(I))}}if(W.otherBufferViews.has(w))for(let x of W.otherBufferViews.get(w))$.bufferViews.push({buffer:A,byteOffset:v,byteLength:x.byteLength}),W.otherBufferViewsIndexMap.set(x,$.bufferViews.length-1),v+=x.byteLength,k.push(x);if(v){let x;if(J.format===AZ.GLB)x=Rw;else x=W.bufferURIGenerator.createURI(w,"bin"),N.uri=x;N.byteLength=v,W.assignResourceURI(x,a0.concat(k),!0)}$.buffers.push(N),W.bufferIndexMap.set(w,j)}),Y.listAccessors().find((w)=>!w.getBuffer()))K.warn("Skipped writing one or more Accessors: no Buffer assigned.");z.filter((w)=>w.prewriteTypes.includes(s.MATERIAL)).forEach((w)=>w.prewrite(W,s.MATERIAL)),$.materials=Y.listMaterials().map((w,j)=>{let N=W.createPropertyDef(w);if(w.getAlphaMode()!==k7.AlphaMode.OPAQUE)N.alphaMode=w.getAlphaMode();if(w.getAlphaMode()===k7.AlphaMode.MASK)N.alphaCutoff=w.getAlphaCutoff();if(w.getDoubleSided())N.doubleSided=!0;if(N.pbrMetallicRoughness={},!l0.eq(w.getBaseColorFactor(),[1,1,1,1]))N.pbrMetallicRoughness.baseColorFactor=w.getBaseColorFactor();if(!l0.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(),O=w.getBaseColorTextureInfo();N.pbrMetallicRoughness.baseColorTexture=W.createTextureInfoDef(R,O)}if(w.getEmissiveTexture()){let R=w.getEmissiveTexture(),O=w.getEmissiveTextureInfo();N.emissiveTexture=W.createTextureInfoDef(R,O)}if(w.getNormalTexture()){let R=w.getNormalTexture(),O=w.getNormalTextureInfo(),P=W.createTextureInfoDef(R,O);if(w.getNormalScale()!==1)P.scale=w.getNormalScale();N.normalTexture=P}if(w.getOcclusionTexture()){let R=w.getOcclusionTexture(),O=w.getOcclusionTextureInfo(),P=W.createTextureInfoDef(R,O);if(w.getOcclusionStrength()!==1)P.strength=w.getOcclusionStrength();N.occlusionTexture=P}if(w.getMetallicRoughnessTexture()){let R=w.getMetallicRoughnessTexture(),O=w.getMetallicRoughnessTextureInfo();N.pbrMetallicRoughness.metallicRoughnessTexture=W.createTextureInfoDef(R,O)}return W.materialIndexMap.set(w,j),N}),z.filter((w)=>w.prewriteTypes.includes(s.MESH)).forEach((w)=>w.prewrite(W,s.MESH)),$.meshes=Y.listMeshes().map((w,j)=>{let N=W.createPropertyDef(w),R=null;if(N.primitives=w.listPrimitives().map((O)=>{let P={attributes:{}};P.mode=O.getMode();let D=O.getMaterial();if(D)P.material=W.materialIndexMap.get(D);if(Object.keys(O.getExtras()).length)P.extras=O.getExtras();let C=O.getIndices();if(C)P.indices=W.accessorIndexMap.get(C);for(let T of O.listSemantics())P.attributes[T]=W.accessorIndexMap.get(O.getAttribute(T));for(let T of O.listTargets()){let k={};for(let A of T.listSemantics())k[A]=W.accessorIndexMap.get(T.getAttribute(A));P.targets=P.targets||[],P.targets.push(k)}if(O.listTargets().length&&!R)R=O.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,j),N}),$.cameras=Y.listCameras().map((w,j)=>{let N=W.createPropertyDef(w);if(N.type=w.getType(),N.type===G$.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,j),N}),$.nodes=Y.listNodes().map((w,j)=>{let N=W.createPropertyDef(w);if(!l0.eq(w.getTranslation(),[0,0,0]))N.translation=w.getTranslation();if(!l0.eq(w.getRotation(),[0,0,0,1]))N.rotation=w.getRotation();if(!l0.eq(w.getScale(),[1,1,1]))N.scale=w.getScale();if(w.getWeights().length)N.weights=w.getWeights();return W.nodeIndexMap.set(w,j),N}),$.skins=Y.listSkins().map((w,j)=>{let N=W.createPropertyDef(w),R=w.getInverseBindMatrices();if(R)N.inverseBindMatrices=W.accessorIndexMap.get(R);let O=w.getSkeleton();if(O)N.skeleton=W.nodeIndexMap.get(O);return N.joints=w.listJoints().map((P)=>W.nodeIndexMap.get(P)),W.skinIndexMap.set(w,j),N}),Y.listNodes().forEach((w,j)=>{let N=$.nodes[j],R=w.getMesh();if(R)N.mesh=W.meshIndexMap.get(R);let O=w.getCamera();if(O)N.camera=W.cameraIndexMap.get(O);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,j)=>{let N=W.createPropertyDef(w),R=new Map;return N.samplers=w.listSamplers().map((O,P)=>{let D=W.createPropertyDef(O);return D.input=W.accessorIndexMap.get(O.getInput()),D.output=W.accessorIndexMap.get(O.getOutput()),D.interpolation=O.getInterpolation(),R.set(O,P),D}),N.channels=w.listChannels().map((O)=>{let P=W.createPropertyDef(O);return P.sampler=R.get(O.getSampler()),P.target={node:W.nodeIndexMap.get(O.getTargetNode()),path:O.getTargetPath()},P}),W.animationIndexMap.set(w,j),N}),$.scenes=Y.listScenes().map((w,j)=>{let N=W.createPropertyDef(w);return N.nodes=w.listChildren().map((R)=>W.nodeIndexMap.get(R)),W.sceneIndexMap.set(w,j),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)),BB1($),Q}}function BB1(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 Cw;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(Cw||(Cw={}));class Gn{constructor(){this._logger=_5.DEFAULT_INSTANCE,this._extensions=new Set,this._dependencies={},this._vertexLayout=Nw.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=ri(J)?this._binaryToJSON(J):{json:JSON.parse(a0.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),Wn.read(Z,{extensions:Array.from(this._extensions),dependencies:this._dependencies,logger:this._logger})}async binaryToJSON(Z){let J=this._binaryToJSON(a0.assertView(Z));this._readResourcesInternal(J);let X=J.json;if(X.buffers&&X.buffers.some((Y)=>LB1(J,Y)))throw new Error("Cannot resolve external buffers with binaryToJSON().");else if(X.images&&X.images.some((Y)=>jB1(J,Y)))throw new Error("Cannot resolve external images with binaryToJSON().");return J}async readBinary(Z){return this.readJSON(await this.binaryToJSON(a0.assertView(Z)))}async writeJSON(Z,J={}){if(J.format===AZ.GLB&&Z.getRoot().listBuffers().length>1)throw new Error("GLB must have 0\u20131 buffers.");return Kn.write(Z,{format:J.format||AZ.GLTF,basename:J.basename||"",logger:this._logger,vertexLayout:this._vertexLayout,dependencies:Y5({},this._dependencies),extensions:Array.from(this._extensions)})}async writeBinary(Z){let{json:J,resources:X}=await this.writeJSON(Z,{format:AZ.GLB}),Y=new Uint32Array([1179937895,2,12]),$=JSON.stringify(J),Q=a0.pad(a0.encodeText($),32),W=a0.toView(new Uint32Array([Q.byteLength,1313821514])),K=a0.concat([W,Q]);Y[Y.length-1]+=K.byteLength;let G=Object.values(X)[0];if(!G||!G.byteLength)return a0.concat([a0.toView(Y),K]);let z=a0.pad(G,0),H=a0.toView(new Uint32Array([z.byteLength,5130562])),V=a0.concat([H,z]);return Y[Y.length-1]+=V.byteLength,a0.concat([a0.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){a0.assertView(Z.resources[$.uri]);return}if($.uri.match(/data:/)){let Q=`__${Yn()}.${hZ.extension($.uri)}`;Z.resources[Q]=a0.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:Y5({},Z.json),resources:Y5({},Z.resources)},J)Z.json.images=J.map((Y)=>Y5({},Y));if(X)Z.json.buffers=X.map((Y)=>Y5({},Y));return Z}_binaryToJSON(Z){if(!ri(Z))throw new Error("Invalid glTF 2.0 binary.");let J=new Uint32Array(Z.buffer,Z.byteOffset+12,2);if(J[1]!==Cw.JSON)throw new Error("Missing required GLB JSON chunk.");let X=20,Y=J[0],$=a0.decodeText(a0.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]!==Cw.BIN)return{json:Q,resources:{}};let G=K[0],z=a0.toView(Z,W+8,G);return{json:Q,resources:{[Rw]:z}}}}function LB1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)}function jB1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)&&J.bufferView===void 0}function ri(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 lC extends Gn{constructor(Z=null,J=m9.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(),m9.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(m9.isAbsoluteURL(Z)||m9.isAbsoluteURL(J))return m9.resolve(Z,J);return this._path.resolve(Z,decodeURIComponent(J))}dirname(Z){if(m9.isAbsoluteURL(Z))return m9.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:AZ.GLTF,basename:hZ.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 OB1(Object.keys($),10))await Promise.all(z.map(async function(H){if(m9.isAbsoluteURL(H)){if(m9.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 OB1(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 Yo=e(pC(),1),$o=e(ms(),1),HR1=e(Xo(),1);async function VR1(Z,J){if(!(Z instanceof Uint8Array))throw new Error("[ndarray-pixels] Input must be Uint8Array or Buffer.");let{data:X,info:Y}=await $o.default(Z).ensureAlpha().raw().toBuffer({resolveWithObject:!0});return Yo.default(new Uint8Array(X),[Y.width,Y.height,4],[4,4*Y.width|0,1],0)}async function Qo(Z,J){return VR1(Z)}var qR1="v4.2.1",DT="@glb.bin",o;(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"})(o||(o={}));var Wo;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(Wo||(Wo={}));var G9;(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"})(G9||(G9={}));var z9;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(z9||(z9={}));var LT;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(LT||(LT={}));class f6{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 Ho{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),FR1(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 $B{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(f6.decodeText(Z.slice(12,16))===$B.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}}$B.PNG_FRIED_CHUNK_NAME="CgBI";class m4{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}`}}m4.impls={"image/jpeg":new Ho,"image/png":new $B};function FR1(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 jz{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 m4.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()}}var jT=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 UR1(){var Z=new jT(3);if(jT!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function BT(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function wR1(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=UR1();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 Vo(Z){let J=qo(),X=Z.propertyType===o.NODE?[Z]:Z.listChildren();for(let Y of X)Y.traverse(($)=>{let Q=$.getMesh();if(!Q)return;let W=BR1(Q,$.getWorldMatrix());if(W.min.every(isFinite)&&W.max.every(isFinite))OT(W.min,J),OT(W.max,J)});return J}function BR1(Z,J){let X=qo();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=wR1(K,W,J),OT(K,X)}}return X}function OT(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 qo(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}var Ko="https://null.example";class PT{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return jz.basename(new URL(Z,Ko).pathname)}static extension(Z){return jz.extension(new URL(Z,Ko).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)}}PT.DEFAULT_INIT={};PT.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;function Go(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function U$(Z){if(Go(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let X=J.prototype;if(Go(X)===!1)return!1;if(Object.hasOwn(X,"isPrototypeOf")===!1)return!1;return!0}var MT,RT;(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"})(RT||(RT={}));class A7{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=A7.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=A7.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=A7.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=A7.Verbosity.ERROR)console.error(Z)}}MT=A7;A7.Verbosity=RT;A7.DEFAULT_INSTANCE=new MT(MT.Verbosity.INFO);function LR1(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],j=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,O=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,A=H*B-V*U,v=H*w-q*U,x=V*w-q*B;return j*x-N*v+R*A+O*k-P*T+D*C}function jR1(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],j=J[14],N=J[15],R=X[0],O=X[1],P=X[2],D=X[3];return Z[0]=R*Y+O*K+P*V+D*B,Z[1]=R*$+O*G+P*q+D*w,Z[2]=R*Q+O*z+P*F+D*j,Z[3]=R*W+O*H+P*U+D*N,R=X[4],O=X[5],P=X[6],D=X[7],Z[4]=R*Y+O*K+P*V+D*B,Z[5]=R*$+O*G+P*q+D*w,Z[6]=R*Q+O*z+P*F+D*j,Z[7]=R*W+O*H+P*U+D*N,R=X[8],O=X[9],P=X[10],D=X[11],Z[8]=R*Y+O*K+P*V+D*B,Z[9]=R*$+O*G+P*q+D*w,Z[10]=R*Q+O*z+P*F+D*j,Z[11]=R*W+O*H+P*U+D*N,R=X[12],O=X[13],P=X[14],D=X[15],Z[12]=R*Y+O*K+P*V+D*B,Z[13]=R*$+O*G+P*q+D*w,Z[14]=R*Q+O*z+P*F+D*j,Z[15]=R*W+O*H+P*U+D*N,Z}function OR1(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 MR1(Z,J){var X=new jT(3);OR1(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 w8{static identity(Z){return Z}static eq(Z,J,X=0.00001){if(Z.length!==J.length)return!1;for(let Y=0;Y<Z.length;Y++)if(Math.abs(Z[Y]-J[Y])>X)return!1;return!0}static clamp(Z,J,X){if(Z<J)return J;if(Z>X)return X;return Z}static decodeNormalizedInt(Z,J){switch(J){case 5126:return Z;case 5123:return Z/65535;case 5121:return Z/255;case 5122:return Math.max(Z/32767,-1);case 5120:return Math.max(Z/127,-1);default:throw new Error("Invalid component type.")}}static encodeNormalizedInt(Z,J){switch(J){case 5126:return Z;case 5123:return Math.round(w8.clamp(Z,0,1)*65535);case 5121:return Math.round(w8.clamp(Z,0,1)*255);case 5122:return Math.round(w8.clamp(Z,-1,1)*32767);case 5120:return Math.round(w8.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,X,Y){let $=BT([Z[0],Z[1],Z[2]]),Q=BT([Z[4],Z[5],Z[6]]),W=BT([Z[8],Z[9],Z[10]]);if(LR1(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,MR1(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,j=K*V,N=G*z,R=G*H,O=G*V,P=X[0],D=X[1],C=X[2];return $[0]=(1-(B+j))*P,$[1]=(F+O)*P,$[2]=(U-R)*P,$[3]=0,$[4]=(F-O)*D,$[5]=(1-(q+j))*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 RR1(Z,J){if(!!Z!==!!J)return!1;let X=Z.getChild(),Y=J.getChild();return X===Y||X.equals(Y)}function NR1(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 DR1(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 Fo(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 Uo(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!U$(Z)||!U$(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(JB(K)&&JB(G)){if(!Fo(K,G))return!1}else if(U$(K)&&U$(G)){if(!Uo(K,G))return!1}else if(K!==G)return!1}return!0}function JB(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var HX=(Z)=>Z,PR1=new Set;class QB extends kW{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,HX)}copy(Z,J=HX){for(let X in this[y0]){let Y=this[y0][X];if(Y instanceof v5){if(!this[y4].has(X))Y.dispose()}else if(Y instanceof A6||Y instanceof I0)for(let $ of Y.values())$.dispose();else if(Y instanceof W8)for(let $ of Y.values())$.dispose()}for(let X in Z[y0]){let Y=this[y0][X],$=Z[y0][X];if($ instanceof v5)if(this[y4].has(X))Y.getChild().copy(J($.getChild()),J);else this.setRef(X,J($.getChild()),$.getAttributes());else if($ instanceof I0||$ instanceof A6)for(let Q of $.values())this.addRef(X,J(Q.getChild()),Q.getAttributes());else if($ instanceof W8)for(let Q of $.keys()){let W=$.get(Q);this.setRefMap(X,Q,J(W.getChild()),W.getAttributes())}else if(U$($))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=PR1){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 v5||$ instanceof v5){if(!RR1(Y,$))return!1}else if(Y instanceof I0||$ instanceof I0||Y instanceof A6||$ instanceof A6){if(!NR1(Y,$))return!1}else if(Y instanceof W8||$ instanceof W8){if(!DR1(Y,$))return!1}else if(U$(Y)||U$($)){if(!Uo(Y,$))return!1}else if(JB(Y)||JB($)){if(!Fo(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 b6 extends QB{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new W8})}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 C0 extends b6{init(){this.propertyType=o.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:C0.Type.SCALAR,componentType:C0.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(Z){switch(Z){case C0.Type.SCALAR:return 1;case C0.Type.VEC2:return 2;case C0.Type.VEC3:return 3;case C0.Type.VEC4:return 4;case C0.Type.MAT2:return 4;case C0.Type.MAT3:return 9;case C0.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+Z)}}static getComponentSize(Z){switch(Z){case C0.ComponentType.BYTE:return 1;case C0.ComponentType.UNSIGNED_BYTE:return 1;case C0.ComponentType.SHORT:return 2;case C0.ComponentType.UNSIGNED_SHORT:return 2;case C0.ComponentType.UNSIGNED_INT:return 4;case C0.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+Z)}}getMinNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMin(Z),J)for(let $=0;$<X;$++)Z[$]=w8.decodeNormalizedInt(Z[$],Y);return Z}getMin(Z){let J=this.getArray(),X=this.getCount(),Y=this.getElementSize();for(let $=0;$<Y;$++)Z[$]=1/0;for(let $=0;$<X*Y;$+=Y)for(let Q=0;Q<Y;Q++){let 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[$]=w8.decodeNormalizedInt(Z[$],Y);return Z}getMax(Z){let J=this.get("array"),X=this.getCount(),Y=this.getElementSize();for(let $=0;$<Y;$++)Z[$]=-1/0;for(let $=0;$<X*Y;$+=Y)for(let Q=0;Q<Y;Q++){let 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 C0.getElementSize(this.get("type"))}getComponentSize(){return this.get("array").BYTES_PER_ELEMENT}getComponentType(){return this.get("componentType")}getNormalized(){return this.get("normalized")}setNormalized(Z){return this.set("normalized",Z)}getScalar(Z){let J=this.getElementSize(),X=this.getComponentType(),Y=this.getArray();if(this.getNormalized())return w8.decodeNormalizedInt(Y[Z*J],X);return Y[Z*J]}setScalar(Z,J){let X=this.getElementSize(),Y=this.getComponentType(),$=this.getArray();if(this.getNormalized())$[Z*X]=w8.encodeNormalizedInt(J,Y);else $[Z*X]=J;return this}getElement(Z,J){let X=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();for(let W=0;W<Y;W++)if(X)J[W]=w8.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]=w8.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?CR1(Z):C0.ComponentType.FLOAT),this.set("array",Z),this}getByteLength(){let Z=this.get("array");return Z?Z.byteLength:0}}C0.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};C0.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function CR1(Z){switch(Z.constructor){case Float32Array:return C0.ComponentType.FLOAT;case Uint32Array:return C0.ComponentType.UNSIGNED_INT;case Uint16Array:return C0.ComponentType.UNSIGNED_SHORT;case Uint8Array:return C0.ComponentType.UNSIGNED_BYTE;case Int16Array:return C0.ComponentType.SHORT;case Int8Array:return C0.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class CT extends b6{init(){this.propertyType=o.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new I0,samplers:new I0})}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 Mz extends b6{init(){this.propertyType=o.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)}}Mz.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class mW extends b6{init(){this.propertyType=o.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:mW.Interpolation.LINEAR,input:null,output:null})}getInterpolation(){return this.get("interpolation")}setInterpolation(Z){return this.set("interpolation",Z)}getInput(){return this.getRef("input")}setInput(Z){return this.setRef("input",Z,{usage:G9.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:G9.OTHER})}}mW.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class TT extends b6{init(){this.propertyType=o.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(Z){return this.set("uri",Z)}}class Rz extends b6{init(){this.propertyType=o.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:Rz.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)}}Rz.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class Z8 extends QB{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}Z8.EXTENSION_NAME=void 0;class v1 extends b6{init(){this.propertyType=o.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:v1.WrapMode.REPEAT,wrapT:v1.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)}}v1.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};v1.MagFilter={NEAREST:9728,LINEAR:9729};v1.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:tw,G:ew,B:ZB,A:TR1}=z9;class Nz extends b6{init(){this.propertyType=o.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:Nz.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new v1(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new v1(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new v1(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new v1(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new v1(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:tw|ew|ZB|TR1,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:tw|ew|ZB,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:tw|ew|ZB})}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:tw})}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:ew|ZB})}}Nz.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class kT extends b6{init(){this.propertyType=o.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new I0})}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 ET extends b6{init(){this.propertyType=o.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 I0})}copy(Z,J=HX){if(J===HX)throw new Error("Node cannot be copied.");return super.copy(Z,J)}getTranslation(){return this.get("translation")}getRotation(){return this.get("rotation")}getScale(){return this.get("scale")}setTranslation(Z){return this.set("translation",Z)}setRotation(Z){return this.set("rotation",Z)}setScale(Z){return this.set("scale",Z)}getMatrix(){return w8.compose(this.get("translation"),this.get("rotation"),this.get("scale"),[])}setMatrix(Z){let J=this.get("translation").slice(),X=this.get("rotation").slice(),Y=this.get("scale").slice();return w8.decompose(Z,J,X,Y),this.set("translation",J).set("rotation",X).set("scale",Y)}getWorldTranslation(){let Z=[0,0,0];return w8.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return w8.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return w8.decompose(this.getWorldMatrix(),[0,0,0],[0,0,0,1],Z),Z}getWorldMatrix(){let Z=[];for(let Y=this;Y!=null;Y=Y.getParentNode())Z.push(Y);let J,X=Z.pop().getMatrix();while(J=Z.pop())jR1(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===o.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===o.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 VX extends b6{init(){this.propertyType=o.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:VX.Mode.TRIANGLES,material:null,indices:null,attributes:new W8,targets:new I0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:G9.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:G9.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)}}VX.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class wo extends QB{init(){this.propertyType=o.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new W8})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:G9.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function XB(){return XB=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},XB.apply(null,arguments)}class IT extends b6{init(){this.propertyType=o.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new I0})}copy(Z,J=HX){if(J===HX)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 vT extends b6{init(){this.propertyType=o.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new I0})}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:G9.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class ST extends b6{init(){this.propertyType=o.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||m4.extensionToMimeType(jz.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=m4.extensionToMimeType(jz.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",f6.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return m4.getSize(Z,this.getMimeType())}}class WB extends b6{init(){this.propertyType=o.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${qR1}`,version:"2.0"},defaultScene:null,accessors:new I0,animations:new I0,buffers:new I0,cameras:new I0,materials:new I0,meshes:new I0,nodes:new I0,scenes:new I0,skins:new I0,textures:new I0})}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=HX){if(J===HX)throw new Error("Root cannot be copied.");this.set("asset",XB({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(XB({},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 IT)this.addRef("scenes",Z);else if(Z instanceof ET)this.addRef("nodes",Z);else if(Z instanceof Rz)this.addRef("cameras",Z);else if(Z instanceof vT)this.addRef("skins",Z);else if(Z instanceof kT)this.addRef("meshes",Z);else if(Z instanceof Nz)this.addRef("materials",Z);else if(Z instanceof ST)this.addRef("textures",Z);else if(Z instanceof CT)this.addRef("animations",Z);else if(Z instanceof C0)this.addRef("accessors",Z);else if(Z instanceof TT)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 YB{static fromGraph(Z){return YB._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new TW,this._root=new WB(this._graph),this._logger=A7.DEFAULT_INSTANCE,YB._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 IT(this._graph,Z)}createNode(Z=""){return new ET(this._graph,Z)}createCamera(Z=""){return new Rz(this._graph,Z)}createSkin(Z=""){return new vT(this._graph,Z)}createMesh(Z=""){return new kT(this._graph,Z)}createPrimitive(){return new VX(this._graph)}createPrimitiveTarget(Z=""){return new wo(this._graph,Z)}createMaterial(Z=""){return new Nz(this._graph,Z)}createTexture(Z=""){return new ST(this._graph,Z)}createAnimation(Z=""){return new CT(this._graph,Z)}createAnimationChannel(Z=""){return new Mz(this._graph,Z)}createAnimationSampler(Z=""){return new mW(this._graph,Z)}createAccessor(Z="",J=null){if(!J)J=this.getRoot().listBuffers()[0];return new C0(this._graph,Z).setBuffer(J)}createBuffer(Z=""){return new TT(this._graph,Z)}}YB._GRAPH_DOCUMENTS=new WeakMap;class A1{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 Z8&&$.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}}A1.EXTENSION_NAME=void 0;var rB6={logger:A7.DEFAULT_INSTANCE,extensions:[],dependencies:{}},tB6=new Set([o.BUFFER,o.TEXTURE,o.MATERIAL,o.MESH,o.PRIMITIVE,o.NODE,o.SCENE]);var Oz;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(Oz||(Oz={}));class qX{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 NT($>1,()=>X.basename||"buffer"),this.imageURIGenerator=new NT(Q>1,(W)=>kR1(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===LT.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=m4.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 G9.SPARSE;for(let X of this._doc.getGraph().listParentEdges(Z)){let{usage:Y}=X.getAttributes();if(Y)return Y;if(X.getParent().propertyType!==o.ROOT)this.logger.warn(`Missing attribute ".usage" on edge, "${X.getName()}".`)}return G9.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}}qX.BufferViewTarget=Oz;qX.BufferViewUsage=G9;qX.USAGE_TO_TARGET={[G9.ARRAY_BUFFER]:Oz.ARRAY_BUFFER,[G9.ELEMENT_ARRAY_BUFFER]:Oz.ELEMENT_ARRAY_BUFFER};class NT{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 kR1(Z,J){let X=Z.getGraph().listParentEdges(J).find((Y)=>Y.getParent()!==Z.getRoot());return X?X.getName().replace(/texture$/i,""):""}var{UNSIGNED_INT:eB6,UNSIGNED_SHORT:ZL6,UNSIGNED_BYTE:JL6}=C0.ComponentType,XL6=new Set([o.ACCESSOR,o.BUFFER,o.MATERIAL,o.MESH]);var zo;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(zo||(zo={}));var Lo=163,jo=166;function ER1(){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 uW{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 QL6=new Uint8Array([0]),K5=[171,75,84,88,32,50,48,187,13,10,26,10];function Bo(Z){return new TextDecoder().decode(Z)}function KB(Z){let J=new Uint8Array(Z.buffer,Z.byteOffset,K5.length);if(J[0]!==K5[0]||J[1]!==K5[1]||J[2]!==K5[2]||J[3]!==K5[3]||J[4]!==K5[4]||J[5]!==K5[5]||J[6]!==K5[6]||J[7]!==K5[7]||J[8]!==K5[8]||J[9]!==K5[9]||J[10]!==K5[10]||J[11]!==K5[11])throw new Error("Missing KTX 2.0 identifier.");let X=ER1(),Y=17*Uint32Array.BYTES_PER_ELEMENT,$=new uW(Z,K5.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 uW(Z,K5.length+Y,q,!0);for(let L6=0;L6<Q;L6++)X.levels.push({levelData:new Uint8Array(Z.buffer,Z.byteOffset+F._nextUint64(),F._nextUint64()),uncompressedByteLength:F._nextUint64()});let U=new uW(Z,W,K,!0);U._skip(4);let B=U._nextUint16(),w=U._nextUint16(),j=U._nextUint16(),N=U._nextUint16(),R=U._nextUint8(),O=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()],A={vendorId:B,descriptorType:w,versionNumber:j,colorModel:R,colorPrimaries:O,transferFunction:P,flags:D,texelBlockDimension:C,bytesPlane:T,samples:[]},v=6,x=4,I=(N/4-v)/x;for(let L6=0;L6<I;L6++){let MZ={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(MZ.channelType&64)MZ.sampleLower=U._nextInt32(),MZ.sampleUpper=U._nextInt32();else MZ.sampleLower=U._nextUint32(),MZ.sampleUpper=U._nextUint32();A.samples[L6]=MZ}X.dataFormatDescriptor.length=0,X.dataFormatDescriptor.push(A);let S=new uW(Z,G,z,!0);while(S._offset<z){let L6=S._nextUint32(),MZ=S._scan(L6),YU=Bo(MZ);if(X.keyValue[YU]=S._nextUint8Array(L6-MZ.byteLength-1),YU.match(/^ktx/i)){let tg=Bo(X.keyValue[YU]);X.keyValue[YU]=tg.substring(0,tg.lastIndexOf("\x00"))}let R31=L6%4?4-L6%4:0;S._skip(R31)}if(V<=0)return X;let y=new uW(Z,H,V,!0),m=y._nextUint16(),i=y._nextUint16(),t=y._nextUint32(),Z0=y._nextUint32(),W0=y._nextUint32(),A0=y._nextUint32(),x0=[];for(let L6=0;L6<Q;L6++)x0.push({imageFlags:y._nextUint32(),rgbSliceByteOffset:y._nextUint32(),rgbSliceByteLength:y._nextUint32(),alphaSliceByteOffset:y._nextUint32(),alphaSliceByteLength:y._nextUint32()});let s0=H+y._offset,b8=s0+t,$8=b8+Z0,L7=$8+W0,k4=new Uint8Array(Z.buffer,Z.byteOffset+s0,t),eQ=new Uint8Array(Z.buffer,Z.byteOffset+b8,Z0),ZW=new Uint8Array(Z.buffer,Z.byteOffset+$8,W0),lY=new Uint8Array(Z.buffer,Z.byteOffset+L7,A0);return X.globalData={endpointCount:m,selectorCount:i,imageDescs:x0,endpointsData:k4,selectorsData:eQ,tablesData:ZW,extendedData:lY},X}var yZ="EXT_mesh_gpu_instancing",R6="EXT_meshopt_compression",Dz="EXT_texture_webp",Pz="EXT_texture_avif",G8="KHR_draco_mesh_compression",c9="KHR_lights_punctual",gZ="KHR_materials_anisotropy",mZ="KHR_materials_clearcoat",uZ="KHR_materials_diffuse_transmission",dZ="KHR_materials_dispersion",cZ="KHR_materials_emissive_strength",lZ="KHR_materials_ior",pZ="KHR_materials_iridescence",iZ="KHR_materials_pbrSpecularGlossiness",nZ="KHR_materials_sheen",aZ="KHR_materials_specular",sZ="KHR_materials_transmission",FX="KHR_materials_unlit",oZ="KHR_materials_volume",y6="KHR_materials_variants",So="KHR_mesh_quantization",Cz="KHR_texture_basisu",rZ="KHR_texture_transform",l9="KHR_xmp_json_ld",AT="INSTANCE_ATTRIBUTE";class hT extends Z8{init(){this.extensionName=yZ,this.propertyType="InstancedMesh",this.parentTypes=[o.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new W8})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:AT})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}hT.EXTENSION_NAME=yZ;class HB extends A1{constructor(...Z){super(...Z);this.extensionName=yZ,this.provideTypes=[o.NODE],this.prewriteTypes=[o.ACCESSOR]}createInstancedMesh(){return new hT(this.document.getGraph())}read(Z){return(Z.jsonDoc.json.nodes||[]).forEach((Y,$)=>{if(!Y.extensions||!Y.extensions[yZ])return;let Q=Y.extensions[yZ],W=this.createInstancedMesh();for(let K in Q.attributes)W.setAttribute(K,Z.accessors[Q.attributes[K]]);Z.nodes[$].setExtension(yZ,W)}),this}prewrite(Z){Z.accessorUsageGroupedByParent.add(AT);for(let J of this.properties)for(let X of J.listAttributes())Z.addAccessorToUsageGroup(X,AT);return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listNodes().forEach((X)=>{let Y=X.getExtension(yZ);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[yZ]=W}}),this}}HB.EXTENSION_NAME=yZ;function tZ(){return tZ=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},tZ.apply(null,arguments)}var Tz;(function(Z){Z.QUANTIZE="quantize",Z.FILTER="filter"})(Tz||(Tz={}));var dW;(function(Z){Z.ATTRIBUTES="ATTRIBUTES",Z.TRIANGLES="TRIANGLES",Z.INDICES="INDICES"})(dW||(dW={}));var B8;(function(Z){Z.NONE="NONE",Z.OCTAHEDRAL="OCTAHEDRAL",Z.QUATERNION="QUATERNION",Z.EXPONENTIAL="EXPONENTIAL"})(B8||(B8={}));function IR1(Z){if(!Z.extensions||!Z.extensions[R6])return!1;return!!Z.extensions[R6].fallback}var{BYTE:vR1,SHORT:Oo,FLOAT:SR1}=C0.ComponentType,{encodeNormalizedInt:Mo,decodeNormalizedInt:xT}=w8;function _R1(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!==dW.ATTRIBUTES)return W;if($!==B8.NONE){let K=Z.getNormalized()?AR1(Z):new Float32Array(W.array);switch($){case B8.EXPONENTIAL:W.byteStride=Z.getElementSize()*4,W.componentType=SR1,W.normalized=!1,W.array=J.encodeFilterExp(K,Z.getCount(),W.byteStride,Q);break;case B8.OCTAHEDRAL:W.byteStride=Q>8?8:4,W.componentType=Q>8?Oo:vR1,W.normalized=!0,K=Z.getElementSize()===3?hR1(K):K,W.array=J.encodeFilterOct(K,Z.getCount(),W.byteStride,Q);break;case B8.QUATERNION:W.byteStride=8,W.componentType=Oo,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)=>xT(G,Z.getComponentType())),W.max=W.max.map((G)=>xT(G,Z.getComponentType()));if(W.normalized)W.min=W.min.map((G)=>Mo(G,W.componentType)),W.max=W.max.map((G)=>Mo(G,W.componentType))}else if(W.byteStride%4)W.array=xR1(W.array,Z.getElementSize()),W.byteStride=W.array.byteLength/Z.getCount();return W}function AR1(Z){let J=Z.getComponentType(),X=Z.getArray(),Y=new Float32Array(X.length);for(let $=0;$<X.length;$++)Y[$]=xT(X[$],J);return Y}function xR1(Z,J){let Y=f6.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 hR1(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 fR1(Z,J){if(J===qX.BufferViewUsage.ELEMENT_ARRAY_BUFFER)return Z.listParents().some((Y)=>{return Y instanceof VX&&Y.getMode()===VX.Mode.TRIANGLES})?dW.TRIANGLES:dW.INDICES;return dW.ATTRIBUTES}function bR1(Z,J){let X=J.getGraph().listParentEdges(Z).filter((Y)=>!(Y.getParent()instanceof WB));for(let Y of X){let $=Y.getName(),Q=Y.getAttributes().key||"",W=Y.getParent().propertyType===o.PRIMITIVE_TARGET;if($==="indices")return{filter:B8.NONE};if($==="attributes"){if(Q==="POSITION")return{filter:B8.NONE};if(Q==="TEXCOORD_0")return{filter:B8.NONE};if(Q.startsWith("JOINTS_"))return{filter:B8.NONE};if(Q.startsWith("WEIGHTS_"))return{filter:B8.NONE};if(Q==="NORMAL"||Q==="TANGENT")return W?{filter:B8.NONE}:{filter:B8.OCTAHEDRAL,bits:8}}if($==="output"){let K=_o(Z);if(K==="rotation")return{filter:B8.QUATERNION,bits:16};if(K==="translation")return{filter:B8.EXPONENTIAL,bits:12};if(K==="scale")return{filter:B8.EXPONENTIAL,bits:12};return{filter:B8.NONE}}if($==="input")return{filter:B8.NONE};if($==="inverseBindMatrices")return{filter:B8.NONE}}return{filter:B8.NONE}}function _o(Z){for(let J of Z.listParents()){if(!(J instanceof mW))continue;for(let X of J.listParents()){if(!(X instanceof Mz))continue;return X.getTargetPath()}}return null}var Ro={method:Tz.QUANTIZE};class Ez extends A1{constructor(...Z){super(...Z);this.extensionName=R6,this.prereadTypes=[o.BUFFER,o.PRIMITIVE],this.prewriteTypes=[o.BUFFER,o.ACCESSOR],this.readDependencies=["meshopt.decoder"],this.writeDependencies=["meshopt.encoder"],this._decoder=null,this._decoderFallbackBufferMap=new Map,this._encoder=null,this._encoderOptions=Ro,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=tZ({},Ro,Z),this}preread(Z,J){if(!this._decoder){if(!this.isRequired())return this;throw new Error(`[${R6}] Please install extension dependency, "meshopt.decoder".`)}if(!this._decoder.supported){if(!this.isRequired())return this;throw new Error(`[${R6}]: Missing WASM support.`)}if(J===o.BUFFER)this._prereadBuffers(Z);else if(J===o.PRIMITIVE)this._prereadPrimitives(Z);return this}_prereadBuffers(Z){let J=Z.jsonDoc;(J.json.bufferViews||[]).forEach((Y,$)=>{if(!Y.extensions||!Y.extensions[R6])return;let Q=Y.extensions[R6],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[DT],F=f6.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[R6])return;let $=Y.extensions[R6],Q=Z.buffers[$.buffer],W=Z.buffers[Y.buffer],K=J.json.buffers[Y.buffer];if(IR1(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 C0)Y.swap(J,X);J.dispose()}return this}prewrite(Z,J){if(J===o.ACCESSOR)this._prewriteAccessors(Z);else if(J===o.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===o.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(_o(H)==="weights")continue;if(H.getSparse())continue;let V=Z.getAccessorUsage(H),q=Z.accessorUsageGroupedByParent.has(V)?z(H):null,F=fR1(H,V),U=Y.method===Tz.FILTER?bR1(H,this.document):{filter:B8.NONE},B=_R1(H,X,F,U),{array:w,byteStride:j}=B,N=H.getBuffer();if(!N)throw new Error(`${R6}: Missing buffer for accessor.`);let R=this.document.getRoot().listBuffers().indexOf(N),O=[V,q,F,U.filter,j,R].join(":"),P=this._encoderBufferViews[O],D=this._encoderBufferViewData[O],C=this._encoderBufferViewAccessors[O];if(!P||!D)C=this._encoderBufferViewAccessors[O]=[],D=this._encoderBufferViewData[O]=[],P=this._encoderBufferViews[O]={buffer:W,target:qX.USAGE_TO_TARGET[V],byteOffset:0,byteLength:0,byteStride:V===qX.BufferViewUsage.ARRAY_BUFFER?j:void 0,extensions:{[R6]:{buffer:R,byteOffset:0,byteLength:0,mode:F,filter:U.filter!==B8.NONE?U.filter:void 0,byteStride:j,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[R6].buffer],W=Z.otherBufferViews.get(Q)||[],{count:K,byteStride:G,mode:z}=Y.extensions[R6],H=f6.concat($),V=J.encodeGltfBuffer(H,K,G,z),q=f6.pad(V);Y.extensions[R6].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[R6];q.byteOffset=V,J+=f6.padNumber(W.byteLength)}let X=this._encoderFallbackBuffer,Y=Z.bufferIndexMap.get(X),$=Z.jsonDoc.json.buffers[Y];return $.byteLength=J,$.extensions={[R6]:{fallback:!0}},X.dispose(),this}}Ez.EXTENSION_NAME=R6;Ez.EncoderMethod=Tz;class Ao{match(Z){return Z.length>=12&&f6.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=No(J,0);if(!X)return null;let Y=X.end;while(X=No(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 VB extends A1{constructor(...Z){super(...Z);this.extensionName=Pz,this.prereadTypes=[o.TEXTURE]}static register(){m4.registerFormat("image/avif",new Ao)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((X)=>{if(X.extensions&&X.extensions[Pz])X.source=X.extensions[Pz].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[Pz]={source:Q.source},delete Q.source})}}),this}}VB.EXTENSION_NAME=Pz;function No(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:f6.decodeText(new Uint8Array(Z.buffer,Z.byteOffset+J+4,4)),start:J+8,end:J+X}}class xo{match(Z){return Z.length>=12&&Z[8]===87&&Z[9]===69&&Z[10]===66&&Z[11]===80}getSize(Z){let J=f6.decodeText(Z.slice(0,4)),X=f6.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=f6.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 qB extends A1{constructor(...Z){super(...Z);this.extensionName=Dz,this.prereadTypes=[o.TEXTURE]}static register(){m4.registerFormat("image/webp",new xo)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((X)=>{if(X.extensions&&X.extensions[Dz])X.source=X.extensions[Dz].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[Dz]={source:Q.source},delete Q.source})}}),this}}qB.EXTENSION_NAME=Dz;var s8,ho,fo;function yR1(Z,J){let X=new s8.DecoderBuffer;try{if(X.Init(J,J.length),Z.GetEncodedGeometryType(X)!==s8.TRIANGULAR_MESH)throw new Error(`[${G8}] Unknown geometry type.`);let $=new s8.Mesh;if(!Z.DecodeBufferToMesh(X,$).ok()||$.ptr===0)throw new Error(`[${G8}] Decoding failure.`);return $}finally{s8.destroy(X)}}function gR1(Z,J){let Y=J.num_faces()*3,$,Q;if(J.num_points()<=65534){let W=Y*Uint16Array.BYTES_PER_ELEMENT;$=s8._malloc(W),Z.GetTrianglesUInt16Array(J,W,$),Q=new Uint16Array(s8.HEAPU16.buffer,$,Y).slice()}else{let W=Y*Uint32Array.BYTES_PER_ELEMENT;$=s8._malloc(W),Z.GetTrianglesUInt32Array(J,W,$),Q=new Uint32Array(s8.HEAPU32.buffer,$,Y).slice()}return s8._free($),Q}function mR1(Z,J,X,Y){let $=fo[Y.componentType],Q=ho[Y.componentType],W=X.num_components(),G=J.num_points()*W,z=G*Q.BYTES_PER_ELEMENT,H=s8._malloc(z);Z.GetAttributeDataArrayForAllPoints(J,X,$,z,H);let V=new Q(s8.HEAPF32.buffer,H,G).slice();return s8._free(H),V}function uR1(Z){s8=Z,ho={[C0.ComponentType.FLOAT]:Float32Array,[C0.ComponentType.UNSIGNED_INT]:Uint32Array,[C0.ComponentType.UNSIGNED_SHORT]:Uint16Array,[C0.ComponentType.UNSIGNED_BYTE]:Uint8Array,[C0.ComponentType.SHORT]:Int16Array,[C0.ComponentType.BYTE]:Int8Array},fo={[C0.ComponentType.FLOAT]:s8.DT_FLOAT32,[C0.ComponentType.UNSIGNED_INT]:s8.DT_UINT32,[C0.ComponentType.UNSIGNED_SHORT]:s8.DT_UINT16,[C0.ComponentType.UNSIGNED_BYTE]:s8.DT_UINT8,[C0.ComponentType.SHORT]:s8.DT_INT16,[C0.ComponentType.BYTE]:s8.DT_INT8}}var d9,kz;(function(Z){Z[Z.EDGEBREAKER=1]="EDGEBREAKER",Z[Z.SEQUENTIAL=0]="SEQUENTIAL"})(kz||(kz={}));var p9;(function(Z){Z.POSITION="POSITION",Z.NORMAL="NORMAL",Z.COLOR="COLOR",Z.TEX_COORD="TEX_COORD",Z.GENERIC="GENERIC"})(p9||(p9={}));var bo={[p9.POSITION]:14,[p9.NORMAL]:10,[p9.COLOR]:8,[p9.TEX_COORD]:12,[p9.GENERIC]:12},Do={decodeSpeed:5,encodeSpeed:5,method:kz.EDGEBREAKER,quantizationBits:bo,quantizationVolume:"mesh"};function dR1(Z){d9=Z}function cR1(Z,J=Do){let X=tZ({},Do,J);X.quantizationBits=tZ({},bo,J.quantizationBits);let Y=new d9.MeshBuilder,$=new d9.Mesh,Q=new d9.ExpertEncoder($),W={},K=new d9.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 j=lR1(B),N=pR1(Y,w.getComponentType(),$,d9[j],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[j]);else if(typeof X.quantizationVolume==="object"){let{quantizationVolume:R}=X,O=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[j],w.getElementSize(),R.min,O)}else throw new Error("Invalid quantization volume state.")}let H=Z.getIndices();if(!H)throw new GB("Primitive must have indices.");if(Y.AddFacesToMesh($,H.getCount()/3,H.getArray()),Q.SetSpeedOptions(X.encodeSpeed,X.decodeSpeed),Q.SetTrackEncodedProperties(!0),X.method===kz.SEQUENTIAL||G||z)Q.SetEncodingMethod(d9.MESH_SEQUENTIAL_ENCODING);else Q.SetEncodingMethod(d9.MESH_EDGEBREAKER_ENCODING);let V=Q.EncodeToDracoBuffer(!(G||z),K);if(V<=0)throw new GB("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 d9.destroy(K),d9.destroy($),d9.destroy(Y),d9.destroy(Q),{numVertices:F,numIndices:U,data:q,attributeIDs:W}}function lR1(Z){if(Z==="POSITION")return p9.POSITION;else if(Z==="NORMAL")return p9.NORMAL;else if(Z.startsWith("COLOR_"))return p9.COLOR;else if(Z.startsWith("TEXCOORD_"))return p9.TEX_COORD;return p9.GENERIC}function pR1(Z,J,X,Y,$,Q,W){switch(J){case C0.ComponentType.UNSIGNED_BYTE:return Z.AddUInt8Attribute(X,Y,$,Q,W);case C0.ComponentType.BYTE:return Z.AddInt8Attribute(X,Y,$,Q,W);case C0.ComponentType.UNSIGNED_SHORT:return Z.AddUInt16Attribute(X,Y,$,Q,W);case C0.ComponentType.SHORT:return Z.AddInt16Attribute(X,Y,$,Q,W);case C0.ComponentType.UNSIGNED_INT:return Z.AddUInt32Attribute(X,Y,$,Q,W);case C0.ComponentType.FLOAT:return Z.AddFloatAttribute(X,Y,$,Q,W);default:throw new Error(`Unexpected component type, "${J}".`)}}class GB extends Error{}class Iz extends A1{constructor(...Z){super(...Z);this.extensionName=G8,this.prereadTypes=[o.PRIMITIVE],this.prewriteTypes=[o.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,uR1(this._decoderModule);if(Z==="draco3d.encoder")this._encoderModule=J,dR1(this._encoderModule);return this}setEncoderOptions(Z){return this._encoderOptions=Z,this}preread(Z){if(!this._decoderModule)throw new Error(`[${G8}] 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[G8])continue;let K=W.extensions[G8],[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[DT],F=H.byteOffset||0,U=H.byteLength,B=f6.toView(q,F,U);G=new this._decoderModule.Decoder,z=yR1(G,B),Y.set(K.bufferView,[G,z]),J.debug(`[${G8}] 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=mR1(G,z,q,V);Z.accessors[W.attributes[H]].setArray(F)}if(W.indices!==void 0)Z.accessors[W.indices].setArray(gR1(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(`[${G8}] Please install extension dependency, "draco3d.encoder".`);let X=this.document.getLogger();X.debug(`[${G8}] Compression options: ${JSON.stringify(this._encoderOptions)}`);let Y=iR1(this.document),$=new Map,Q="mesh";if(this._encoderOptions.quantizationVolume==="scene")if(this.document.getRoot().listScenes().length!==1)X.warn(`[${G8}]: quantizationVolume=scene requires exactly 1 scene.`);else Q=Vo(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=cR1(W,tZ({},this._encoderOptions,{quantizationVolume:Q}))}catch(F){if(F instanceof GB){X.warn(`[${G8}]: ${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&&C0.getComponentSize(V.componentType)<=2)V.componentType=C0.ComponentType.UNSIGNED_INT;else if(H.numVertices>254&&C0.getComponentSize(V.componentType)<=1)V.componentType=C0.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(`[${G8}] Compressed ${Y.size} primitives.`),Z.extensionData[G8]={primitiveHashMap:Y,primitiveEncodingMap:$},this}write(Z){let J=Z.extensionData[G8];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[G8]={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!==G8),X.extensionsRequired=(X.extensionsRequired||[]).filter((Y)=>Y!==G8)}return this}}Iz.EXTENSION_NAME=G8;Iz.EncoderMethod=kz;function iR1(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()!==VX.Mode.TRIANGLES)Y.add(q),Q++;else X.add(q);if($>0)J.warn(`[${G8}] Skipping Draco compression of ${$} non-indexed primitives.`);if(Q>0)J.warn(`[${G8}] 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=Po(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=Po(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(o.PRIMITIVE)||!q.has(o.ROOT))throw new Error(`[${G8}] 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(`[${G8}] 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(`[${G8}] Accessor cannot be shared by compressed and uncompressed primitives.`)}return H}function Po(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 cW extends Z8{init(){this.extensionName=c9,this.propertyType="Light",this.parentTypes=[o.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{color:[1,1,1],intensity:1,type:cW.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)}}cW.EXTENSION_NAME=c9;cW.Type={POINT:"point",SPOT:"spot",DIRECTIONAL:"directional"};class fT extends A1{constructor(...Z){super(...Z);this.extensionName=c9}createLight(Z=""){return new cW(this.document.getGraph(),Z)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[c9])return this;let $=(J.json.extensions[c9].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[c9])return;let K=Q.extensions[c9];Z.nodes[W].setExtension(c9,$[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(!w8.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()===cW.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(c9);if(Q){let W=Z.nodeIndexMap.get($),K=J.json.nodes[W];K.extensions=K.extensions||{},K.extensions[c9]={light:Y.get(Q)}}}),J.json.extensions=J.json.extensions||{},J.json.extensions[c9]={lights:X},this}}fT.EXTENSION_NAME=c9;var{R:nR1,G:aR1,B:sR1}=z9;class bT extends Z8{init(){this.extensionName=gZ,this.propertyType="Anisotropy",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{anisotropyStrength:0,anisotropyRotation:0,anisotropyTexture:null,anisotropyTextureInfo:new v1(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:nR1|aR1|sR1})}}bT.EXTENSION_NAME=gZ;class yT extends A1{constructor(...Z){super(...Z);this.extensionName=gZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createAnisotropy(){return new bT(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[gZ]){let W=this.createAnisotropy();Z.materials[Q].setExtension(gZ,W);let K=$.extensions[gZ];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(gZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[gZ]={};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}}yT.EXTENSION_NAME=gZ;var{R:Co,G:To,B:oR1}=z9;class gT extends Z8{init(){this.extensionName=mZ,this.propertyType="Clearcoat",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{clearcoatFactor:0,clearcoatTexture:null,clearcoatTextureInfo:new v1(this.graph,"clearcoatTextureInfo"),clearcoatRoughnessFactor:0,clearcoatRoughnessTexture:null,clearcoatRoughnessTextureInfo:new v1(this.graph,"clearcoatRoughnessTextureInfo"),clearcoatNormalScale:1,clearcoatNormalTexture:null,clearcoatNormalTextureInfo:new v1(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:Co})}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:To})}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:Co|To|oR1})}}gT.EXTENSION_NAME=mZ;class mT extends A1{constructor(...Z){super(...Z);this.extensionName=mZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createClearcoat(){return new gT(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[mZ]){let W=this.createClearcoat();Z.materials[Q].setExtension(mZ,W);let K=$.extensions[mZ];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(mZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[mZ]={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}}mT.EXTENSION_NAME=mZ;var{R:rR1,G:tR1,B:eR1,A:ZN1}=z9;class uT extends Z8{init(){this.extensionName=uZ,this.propertyType="DiffuseTransmission",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseTransmissionFactor:0,diffuseTransmissionTexture:null,diffuseTransmissionTextureInfo:new v1(this.graph,"diffuseTransmissionTextureInfo"),diffuseTransmissionColorFactor:[1,1,1],diffuseTransmissionColorTexture:null,diffuseTransmissionColorTextureInfo:new v1(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:ZN1})}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:rR1|tR1|eR1})}}uT.EXTENSION_NAME=uZ;class dT extends A1{constructor(...Z){super(...Z);this.extensionName=uZ}createDiffuseTransmission(){return new uT(this.document.getGraph())}read(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[uZ]){let W=this.createDiffuseTransmission();Z.materials[Q].setExtension(uZ,W);let K=$.extensions[uZ];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(uZ);if(!Y)continue;let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[uZ]={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}}dT.EXTENSION_NAME=uZ;class cT extends Z8{init(){this.extensionName=dZ,this.propertyType="Dispersion",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{dispersion:0})}getDispersion(){return this.get("dispersion")}setDispersion(Z){return this.set("dispersion",Z)}}cT.EXTENSION_NAME=dZ;class lT extends A1{constructor(...Z){super(...Z);this.extensionName=dZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createDispersion(){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[dZ]){let Q=this.createDispersion();Z.materials[$].setExtension(dZ,Q);let W=Y.extensions[dZ];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(dZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[dZ]={dispersion:Y.getDispersion()}}}),this}}lT.EXTENSION_NAME=dZ;class pT extends Z8{init(){this.extensionName=cZ,this.propertyType="EmissiveStrength",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{emissiveStrength:1})}getEmissiveStrength(){return this.get("emissiveStrength")}setEmissiveStrength(Z){return this.set("emissiveStrength",Z)}}pT.EXTENSION_NAME=cZ;class iT extends A1{constructor(...Z){super(...Z);this.extensionName=cZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createEmissiveStrength(){return new pT(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[cZ]){let Q=this.createEmissiveStrength();Z.materials[$].setExtension(cZ,Q);let W=Y.extensions[cZ];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(cZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[cZ]={emissiveStrength:Y.getEmissiveStrength()}}}),this}}iT.EXTENSION_NAME=cZ;class nT extends Z8{init(){this.extensionName=lZ,this.propertyType="IOR",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{ior:1.5})}getIOR(){return this.get("ior")}setIOR(Z){return this.set("ior",Z)}}nT.EXTENSION_NAME=lZ;class FB extends A1{constructor(...Z){super(...Z);this.extensionName=lZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createIOR(){return new nT(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[lZ]){let Q=this.createIOR();Z.materials[$].setExtension(lZ,Q);let W=Y.extensions[lZ];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(lZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[lZ]={ior:Y.getIOR()}}}),this}}FB.EXTENSION_NAME=lZ;var{R:JN1,G:XN1}=z9;class aT extends Z8{init(){this.extensionName=pZ,this.propertyType="Iridescence",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{iridescenceFactor:0,iridescenceTexture:null,iridescenceTextureInfo:new v1(this.graph,"iridescenceTextureInfo"),iridescenceIOR:1.3,iridescenceThicknessMinimum:100,iridescenceThicknessMaximum:400,iridescenceThicknessTexture:null,iridescenceThicknessTextureInfo:new v1(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:JN1})}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:XN1})}}aT.EXTENSION_NAME=pZ;class sT extends A1{constructor(...Z){super(...Z);this.extensionName=pZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createIridescence(){return new aT(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[pZ]){let W=this.createIridescence();Z.materials[Q].setExtension(pZ,W);let K=$.extensions[pZ];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(pZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[pZ]={};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}}sT.EXTENSION_NAME=pZ;var{R:ko,G:Eo,B:Io,A:vo}=z9;class oT extends Z8{init(){this.extensionName=iZ,this.propertyType="PBRSpecularGlossiness",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseFactor:[1,1,1,1],diffuseTexture:null,diffuseTextureInfo:new v1(this.graph,"diffuseTextureInfo"),specularFactor:[1,1,1],glossinessFactor:1,specularGlossinessTexture:null,specularGlossinessTextureInfo:new v1(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:ko|Eo|Io|vo,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:ko|Eo|Io|vo})}}oT.EXTENSION_NAME=iZ;class UB extends A1{constructor(...Z){super(...Z);this.extensionName=iZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createPBRSpecularGlossiness(){return new oT(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[iZ]){let W=this.createPBRSpecularGlossiness();Z.materials[Q].setExtension(iZ,W);let K=$.extensions[iZ];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(iZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[iZ]={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}}UB.EXTENSION_NAME=iZ;var{R:YN1,G:$N1,B:QN1,A:WN1}=z9;class rT extends Z8{init(){this.extensionName=nZ,this.propertyType="Sheen",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{sheenColorFactor:[0,0,0],sheenColorTexture:null,sheenColorTextureInfo:new v1(this.graph,"sheenColorTextureInfo"),sheenRoughnessFactor:0,sheenRoughnessTexture:null,sheenRoughnessTextureInfo:new v1(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:YN1|$N1|QN1,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:WN1})}}rT.EXTENSION_NAME=nZ;class tT extends A1{constructor(...Z){super(...Z);this.extensionName=nZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createSheen(){return new rT(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[nZ]){let W=this.createSheen();Z.materials[Q].setExtension(nZ,W);let K=$.extensions[nZ];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(nZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[nZ]={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}}tT.EXTENSION_NAME=nZ;var{R:KN1,G:GN1,B:zN1,A:HN1}=z9;class eT extends Z8{init(){this.extensionName=aZ,this.propertyType="Specular",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{specularFactor:1,specularTexture:null,specularTextureInfo:new v1(this.graph,"specularTextureInfo"),specularColorFactor:[1,1,1],specularColorTexture:null,specularColorTextureInfo:new v1(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:HN1})}getSpecularColorTexture(){return this.getRef("specularColorTexture")}getSpecularColorTextureInfo(){return this.getRef("specularColorTexture")?this.getRef("specularColorTextureInfo"):null}setSpecularColorTexture(Z){return this.setRef("specularColorTexture",Z,{channels:KN1|GN1|zN1,isColor:!0})}}eT.EXTENSION_NAME=aZ;class wB extends A1{constructor(...Z){super(...Z);this.extensionName=aZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createSpecular(){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[aZ]){let W=this.createSpecular();Z.materials[Q].setExtension(aZ,W);let K=$.extensions[aZ];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(aZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[aZ]={};if(Y.getSpecularFactor()!==1)W.specularFactor=Y.getSpecularFactor();if(!w8.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}}wB.EXTENSION_NAME=aZ;var{R:VN1}=z9;class Zk extends Z8{init(){this.extensionName=sZ,this.propertyType="Transmission",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{transmissionFactor:0,transmissionTexture:null,transmissionTextureInfo:new v1(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:VN1})}}Zk.EXTENSION_NAME=sZ;class Jk extends A1{constructor(...Z){super(...Z);this.extensionName=sZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createTransmission(){return new Zk(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[sZ]){let W=this.createTransmission();Z.materials[Q].setExtension(sZ,W);let K=$.extensions[sZ];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(sZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[sZ]={transmissionFactor:Y.getTransmissionFactor()};if(Y.getTransmissionTexture()){let K=Y.getTransmissionTexture(),G=Y.getTransmissionTextureInfo();W.transmissionTexture=Z.createTextureInfoDef(K,G)}}}),this}}Jk.EXTENSION_NAME=sZ;class Xk extends Z8{init(){this.extensionName=FX,this.propertyType="Unlit",this.parentTypes=[o.MATERIAL]}}Xk.EXTENSION_NAME=FX;class BB extends A1{constructor(...Z){super(...Z);this.extensionName=FX,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createUnlit(){return new Xk(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[FX])Z.materials[Y].setExtension(FX,this.createUnlit())}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{if(X.getExtension(FX)){let Y=Z.materialIndexMap.get(X),$=J.json.materials[Y];$.extensions=$.extensions||{},$.extensions[FX]={}}}),this}}BB.EXTENSION_NAME=FX;class Yk extends Z8{init(){this.extensionName=y6,this.propertyType="Mapping",this.parentTypes=["MappingList"]}getDefaults(){return Object.assign(super.getDefaults(),{material:null,variants:new I0})}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")}}Yk.EXTENSION_NAME=y6;class $k extends Z8{init(){this.extensionName=y6,this.propertyType="MappingList",this.parentTypes=[o.PRIMITIVE]}getDefaults(){return Object.assign(super.getDefaults(),{mappings:new I0})}addMapping(Z){return this.addRef("mappings",Z)}removeMapping(Z){return this.removeRef("mappings",Z)}listMappings(){return this.listRefs("mappings")}}$k.EXTENSION_NAME=y6;class zB extends Z8{init(){this.extensionName=y6,this.propertyType="Variant",this.parentTypes=["MappingList"]}}zB.EXTENSION_NAME=y6;class Qk extends A1{constructor(...Z){super(...Z);this.extensionName=y6}createMappingList(){return new $k(this.document.getGraph())}createVariant(Z=""){return new zB(this.document.getGraph(),Z)}createMapping(){return new Yk(this.document.getGraph())}listVariants(){return Array.from(this.properties).filter((Z)=>Z instanceof zB)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[y6])return this;let $=(J.json.extensions[y6].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[y6])return;let q=this.createMappingList(),F=H.extensions[y6];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(y6,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(y6);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[y6]={mappings:V}})}return J.json.extensions=J.json.extensions||{},J.json.extensions[y6]={variants:Y},this}}Qk.EXTENSION_NAME=y6;var{G:qN1}=z9;class Wk extends Z8{init(){this.extensionName=oZ,this.propertyType="Volume",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{thicknessFactor:0,thicknessTexture:null,thicknessTextureInfo:new v1(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:qN1})}getAttenuationDistance(){return this.get("attenuationDistance")}setAttenuationDistance(Z){return this.set("attenuationDistance",Z)}getAttenuationColor(){return this.get("attenuationColor")}setAttenuationColor(Z){return this.set("attenuationColor",Z)}}Wk.EXTENSION_NAME=oZ;class Kk extends A1{constructor(...Z){super(...Z);this.extensionName=oZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createVolume(){return new Wk(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[oZ]){let W=this.createVolume();Z.materials[Q].setExtension(oZ,W);let K=$.extensions[oZ];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(oZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[oZ]={};if(Y.getThicknessFactor()>0)W.thicknessFactor=Y.getThicknessFactor();if(Number.isFinite(Y.getAttenuationDistance()))W.attenuationDistance=Y.getAttenuationDistance();if(!w8.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}}Kk.EXTENSION_NAME=oZ;class vz extends A1{constructor(...Z){super(...Z);this.extensionName=So}read(Z){return this}write(Z){return this}}vz.EXTENSION_NAME=So;class yo{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=KB(Z);return[J.pixelWidth,J.pixelHeight]}getChannels(Z){let X=KB(Z).dataFormatDescriptor[0];if(X.colorModel===Lo)return X.samples.length===2&&(X.samples[1].channelType&15)===15?4:3;else if(X.colorModel===jo)return(X.samples[0].channelType&15)===3?4:3;throw new Error(`Unexpected KTX2 colorModel, "${X.colorModel}".`)}getVRAMByteLength(Z){let J=KB(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 Gk extends A1{constructor(...Z){super(...Z);this.extensionName=Cz,this.prereadTypes=[o.TEXTURE]}static register(){m4.registerFormat("image/ktx2",new yo)}preread(Z){return Z.jsonDoc.json.textures.forEach((J)=>{if(J.extensions&&J.extensions[Cz]){let X=J.extensions[Cz];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[Cz]={source:$.source},delete $.source})}}),this}}Gk.EXTENSION_NAME=Cz;class zk extends Z8{init(){this.extensionName=rZ,this.propertyType="Transform",this.parentTypes=[o.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)}}zk.EXTENSION_NAME=rZ;class Hk extends A1{constructor(...Z){super(...Z);this.extensionName=rZ}createTransform(){return new zk(this.document.getGraph())}read(Z){for(let[J,X]of Array.from(Z.textureInfos.entries())){if(!X.extensions||!X.extensions[rZ])continue;let Y=this.createTransform(),$=X.extensions[rZ];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(rZ,Y)}return this}write(Z){let J=Array.from(Z.textureInfoDefMap.entries());for(let[X,Y]of J){let $=X.getExtension(rZ);if(!$)continue;Y.extensions=Y.extensions||{};let Q={},W=w8.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[rZ]=Q}return this}}Hk.EXTENSION_NAME=rZ;var FN1=[o.ROOT,o.SCENE,o.NODE,o.MESH,o.MATERIAL,o.TEXTURE,o.ANIMATION];class Vk extends Z8{init(){this.extensionName=l9,this.propertyType="Packet",this.parentTypes=FN1}getDefaults(){return Object.assign(super.getDefaults(),{context:{},properties:{}})}getContext(){return this.get("context")}setContext(Z){return this.set("context",tZ({},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=tZ({},this.get("properties"));if(J)X[Z]=J;else delete X[Z];return this.set("properties",X)}toJSONLD(){let Z=_T(this.get("context")),J=_T(this.get("properties"));return tZ({"@context":Z},J)}fromJSONLD(Z){Z=_T(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(`${l9}: Missing context for term, "${Z}".`)}}Vk.EXTENSION_NAME=l9;function _T(Z){return JSON.parse(JSON.stringify(Z))}class qk extends A1{constructor(...Z){super(...Z);this.extensionName=l9}createPacket(){return new Vk(this.document.getGraph())}listPackets(){return Array.from(this.properties)}read(Z){var J;let X=(J=Z.jsonDoc.json.extensions)==null?void 0:J[l9];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[l9]){let q=V.extensions[l9];K[G][H].setExtension(l9,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 o.ROOT:Q=J.asset;break;case o.SCENE:Q=J.scenes[Z.sceneIndexMap.get($)];break;case o.NODE:Q=J.nodes[Z.nodeIndexMap.get($)];break;case o.MESH:Q=J.meshes[Z.meshIndexMap.get($)];break;case o.MATERIAL:Q=J.materials[Z.materialIndexMap.get($)];break;case o.TEXTURE:Q=J.images[Z.imageIndexMap.get($)];break;case o.ANIMATION:Q=J.animations[Z.animationIndexMap.get($)];break;default:Q=null,this.document.getLogger().warn(`[${l9}]: Unsupported parent property, "${$.propertyType}"`);break}if(!Q)continue;Q.extensions=Q.extensions||{},Q.extensions[l9]={packet:X.length-1}}}if(X.length>0)J.extensions=J.extensions||{},J.extensions[l9]={packets:X};return this}}qk.EXTENSION_NAME=l9;var UN1=[Iz,fT,yT,mT,dT,lT,iT,FB,sT,UB,wB,tT,Jk,BB,Qk,Kk,vz,Gk,Hk,qk],zL6=[HB,Ez,VB,qB,...UN1];var wN1=e(pC(),1);function iW(){return iW=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},iW.apply(null,arguments)}var{POINTS:go,LINES:LB,LINE_STRIP:BN1,LINE_LOOP:LN1,TRIANGLES:jB,TRIANGLE_STRIP:jN1,TRIANGLE_FAN:ON1}=E8.Mode;function LX(Z,J){return Object.defineProperty(J,"name",{value:Z}),J}function x7(Z,J){let X=iW({},Z);for(let Y in J)if(J[Y]!==void 0)X[Y]=J[Y];return X}function Wr(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 MN1=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function Bk(Z){return MN1.format(Z)}function RN1(Z,J,X=2){let Y=Z>J?"\u2013":"+",$="%";return Y+(Math.abs(Z-J)/Z*100).toFixed(X)+"%"}function DB(Z,J){return`${Bk(Z)} \u2192 ${Bk(J)} (${RN1(Z,J)})`}function Dk(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 NN1(Z,J,X){Z.swap(J,X);for(let Y of Z.listTargets())Y.swap(J,X)}function DN1(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 PN1(Z,J=Z){let X=Pk(Z,J);for(let Y=0;Y<X.length;Y++)X[Y]=Y;return X}function Pk(Z,J=Z){return J<=65534?new Uint16Array(Z):new Uint32Array(Z)}function CN1(Z){return Z.listParents().some((J)=>J.propertyType!==s.ROOT)}function Kr(Z){for(let J in Z)return!1;return!0}function Gr(Z){let J=x6.fromGraph(Z.getGraph()),X=Z.getMaterial(),Y=J.getRoot().listMaterials().indexOf(X),$=kN1[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 TN1(Z){return Math.pow(2,Math.ceil(Math.log(Z)/Math.LN2))}var kN1={[go]:go,[LB]:LB,[BN1]:LB,[LN1]:LB,[jB]:jB,[jN1]:jB,[ON1]:jB},lW="center",mo={pivot:"center"};function zr(Z=mo){let J=x7(mo,Z);return LX(lW,(X)=>{let Y=X.getLogger(),$=X.getRoot(),Q=$.listAnimations().length>0||$.listSkins().length>0;X.getRoot().listScenes().forEach((W,K)=>{Y.debug(`${lW}: Scene ${K+1} / ${$.listScenes().length}.`);let G;if(typeof J.pivot==="string"){let H=yC(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(`${lW}: Pivot "${G.join(", ")}".`);let z=[-1*G[0],-1*G[1],-1*G[2]];if(Q){Y.debug(`${lW}: 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(`${lW}: 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(`${lW}: Complete.`)})}function EN1(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 vW)}function IN1(Z){let J=EN1(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 nW=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 vN1(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],j=J[15],N=X*K-Y*W,R=X*G-$*W,O=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,A=H*j-F*U,v=V*w-q*B,x=V*j-F*B,I=q*j-F*w,S=N*I-R*x+O*v+P*A-D*k+C*T;if(!S)return null;return S=1/S,Z[0]=(K*I-G*x+z*v)*S,Z[1]=($*x-Y*I-Q*v)*S,Z[2]=(B*C-w*D+j*P)*S,Z[3]=(q*D-V*C-F*P)*S,Z[4]=(G*A-W*I-z*k)*S,Z[5]=(X*I-$*A+Q*k)*S,Z[6]=(w*O-U*C-j*R)*S,Z[7]=(H*C-q*O+F*R)*S,Z[8]=(W*x-K*A+z*T)*S,Z[9]=(Y*A-X*x-Q*T)*S,Z[10]=(U*D-B*O+j*N)*S,Z[11]=(V*O-H*D-F*N)*S,Z[12]=(K*k-W*v-G*T)*S,Z[13]=(X*v-Y*k+$*T)*S,Z[14]=(B*R-U*P-w*N)*S,Z[15]=(H*P-V*R+q*N)*S,Z}function SN1(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],j=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,O=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,A=H*B-V*U,v=H*w-q*U,x=V*w-q*B;return j*x-N*v+R*A+O*k-P*T+D*C}function Hr(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],j=J[14],N=J[15],R=X[0],O=X[1],P=X[2],D=X[3];return Z[0]=R*Y+O*K+P*V+D*B,Z[1]=R*$+O*G+P*q+D*w,Z[2]=R*Q+O*z+P*F+D*j,Z[3]=R*W+O*H+P*U+D*N,R=X[4],O=X[5],P=X[6],D=X[7],Z[4]=R*Y+O*K+P*V+D*B,Z[5]=R*$+O*G+P*q+D*w,Z[6]=R*Q+O*z+P*F+D*j,Z[7]=R*W+O*H+P*U+D*N,R=X[8],O=X[9],P=X[10],D=X[11],Z[8]=R*Y+O*K+P*V+D*B,Z[9]=R*$+O*G+P*q+D*w,Z[10]=R*Q+O*z+P*F+D*j,Z[11]=R*W+O*H+P*U+D*N,R=X[12],O=X[13],P=X[14],D=X[15],Z[12]=R*Y+O*K+P*V+D*B,Z[13]=R*$+O*G+P*q+D*w,Z[14]=R*Q+O*z+P*F+D*j,Z[15]=R*W+O*H+P*U+D*N,Z}function _N1(){var Z=new nW(9);if(nW!=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 AN1(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 xN1(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 hN1(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 PB(){var Z=new nW(3);if(nW!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function fN1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z}function Vr(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 bN1(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 yN1(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 gN1=fN1;(function(){var Z=PB();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 wX="dedup",Fk={keepUniqueNames:!1,propertyTypes:[s.ACCESSOR,s.MESH,s.TEXTURE,s.MATERIAL,s.SKIN]};function qr(Z=Fk){let J=x7(Fk,Z),X=new Set(J.propertyTypes);for(let Y of J.propertyTypes)if(!Fk.propertyTypes.includes(Y))throw new Error(`${wX}: Unsupported deduplication on type "${Y}".`);return LX(wX,(Y)=>{let $=Y.getLogger();if(X.has(s.ACCESSOR))mN1(Y);if(X.has(s.TEXTURE))dN1(Y,J);if(X.has(s.MATERIAL))cN1(Y,J);if(X.has(s.MESH))uN1(Y,J);if(X.has(s.SKIN))lN1(Y,J);$.debug(`${wX}: Complete.`)})}function mN1(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=a0.toView(U.getArray());if(q.has(U))continue;for(let w=F+1;w<V.length;w++){let j=V[w];if(q.has(j))continue;if(a0.equals(B,a0.toView(j.getArray())))q.set(j,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(`${wX}: 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 uN1(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(Fr(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!==s.ROOT)V.swap(K,H)}),K.dispose()}else W.set(z,K)}X.debug(`${wX}: Merged ${Q-W.size} of ${Q} meshes.`)}function dN1(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(a0.equals(G,V))Q.set(H,K)}}X.debug(`${wX}: Merged ${Q.size} of ${Y.listTextures().length} textures.`),Array.from(Q.entries()).forEach(([W,K])=>{W.listParents().forEach((G)=>{if(!(G instanceof H$))G.swap(W,K)}),W.dispose()})}function cN1(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(uo(z,W))continue;for(let H=G+1;H<$.length;H++){let V=$[H];if(Q.has(V))continue;if(uo(V,W))continue;if(z.equals(V,K))Q.set(V,z)}}X.debug(`${wX}: Merged ${Q.size} of ${$.length} materials.`),Array.from(Q.entries()).forEach(([G,z])=>{G.listParents().forEach((H)=>{if(!(H instanceof H$))H.swap(G,z)}),G.dispose()})}function lN1(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)&&DN1(G.listJoints(),H.listJoints()))Q.set(H,G)}}X.debug(`${wX}: Merged ${Q.size} of ${$.length} skins.`),Array.from(Q.entries()).forEach(([K,G])=>{K.listParents().forEach((z)=>{if(!(z instanceof H$))z.swap(K,G)}),K.dispose()})}function Fr(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:"+Fr(Q,J))}return X.join(",")}function uo(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 Ur(){var Z=new nW(4);if(nW!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function pN1(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 iN1(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 nN1(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 aN1(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 sN1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return Math.hypot(J,X,Y,$)}var wr=iN1,oN1=nN1,Br=sN1;(function(){var Z=Ur();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 rN1=/color|emissive|diffuse/i;function tN1(Z){return Z.getGraph().listParentEdges(Z).some(($)=>{return $.getAttributes().isColor||rN1.test($.getName())})?"srgb":null}function eN1(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 z$)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 S5&&W.has(K.getName()))Y.add(G);else if(G instanceof IW)$(G)}}return $(Z),Array.from(Y)}function ZD1(Z){let X=x6.fromGraph(Z.getGraph()).getRoot(),Y=Z.getGraph().listParentEdges(Z).filter(($)=>$.getParent()!==X).map(($)=>$.getName());return Array.from(new Set(Y))}var pW="prune",Lk=0.011764705882352941,co={propertyTypes:[s.NODE,s.SKIN,s.MESH,s.CAMERA,s.PRIMITIVE,s.PRIMITIVE_TARGET,s.ANIMATION,s.MATERIAL,s.TEXTURE,s.ACCESSOR,s.BUFFER],keepLeaves:!1,keepAttributes:!1,keepIndices:!1,keepSolidTextures:!1,keepExtras:!1};function CB(Z=co){let J=x7(co,Z),X=new Set(J.propertyTypes),Y=J.keepExtras;return LX(pW,async($)=>{let Q=$.getLogger(),W=$.getRoot(),K=$.getGraph(),G=new Lr,z=(H)=>G.dispose(H.target);if(K.addEventListener("node:dispose",z),X.has(s.MESH))for(let H of W.listMeshes()){if(H.listPrimitives().length>0)continue;H.dispose()}if(X.has(s.NODE)){if(!J.keepLeaves)for(let H of W.listScenes())jr(K,H,Y);for(let H of W.listNodes())i9(H,Y)}if(X.has(s.SKIN))for(let H of W.listSkins())i9(H,Y);if(X.has(s.MESH))for(let H of W.listMeshes())i9(H,Y);if(X.has(s.CAMERA))for(let H of W.listCameras())i9(H,Y);if(X.has(s.PRIMITIVE))lo(K,s.PRIMITIVE,Y);if(X.has(s.PRIMITIVE_TARGET))lo(K,s.PRIMITIVE_TARGET,Y);if(!J.keepAttributes&&X.has(s.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=Or($,q,F),B=XD1(q,U);po(q,B),q.listTargets().forEach((w)=>po(w,B)),H.has(F)?H.get(F).add(q):H.set(F,new Set([q]))}for(let[V,q]of H)YD1(V,Array.from(q))}if(!J.keepIndices&&X.has(s.ACCESSOR))for(let H of W.listMeshes())for(let V of H.listPrimitives())JD1(V);if(X.has(s.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();i9(H,Y),V.forEach((q)=>i9(q,Y))}else H.listSamplers().forEach((V)=>i9(V,Y))}if(X.has(s.MATERIAL))W.listMaterials().forEach((H)=>i9(H,Y));if(X.has(s.TEXTURE)){if(W.listTextures().forEach((H)=>i9(H,Y)),!J.keepSolidTextures)await $D1($)}if(X.has(s.ACCESSOR))W.listAccessors().forEach((H)=>i9(H,Y));if(X.has(s.BUFFER))W.listBuffers().forEach((H)=>i9(H,Y));if(K.removeEventListener("node:dispose",z),!G.empty()){let H=G.entries().map(([V,q])=>`${V} (${q})`).join(", ");Q.info(`${pW}: Removed types... ${H}`)}else Q.debug(`${pW}: No unused properties found.`);Q.debug(`${pW}: Complete.`)})}class Lr{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 i9(Z,J){let X=Z.listParents().filter(($)=>!($ instanceof H$||$ instanceof K$)),Y=J&&!Kr(Z.getExtras());if(!X.length&&!Y)Z.dispose()}function lo(Z,J,X){for(let Y of Z.listEdges()){let $=Y.getParent();if($.propertyType===J)i9($,X)}}function jr(Z,J,X){if(J.listChildren().forEach((W)=>jr(Z,W,X)),J instanceof vW)return;let Y=Z.listParentEdges(J).some((W)=>{let K=W.getParent().propertyType;return K!==s.ROOT&&K!==s.SCENE&&K!==s.NODE}),$=Z.listChildren(J).length===0,Q=X&&!Kr(J.getExtras());if($&&!Y&&!Q)J.dispose()}function po(Z,J){for(let X of J)Z.setAttribute(X,null)}function JD1(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 XD1(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 Or(Z,J,X,Y=new Set){let Q=Z.getGraph().listChildEdges(X),W=new Set;for(let z of Q)if(z.getChild()instanceof z$)W.add(z.getName());for(let z of Q){let H=z.getName(),V=z.getChild();if(V instanceof S5){if(W.has(H.replace(/Info$/,"")))Y.add(`TEXCOORD_${V.getTexCoord()}`)}if(V instanceof z$&&H.match(/normalTexture/i))Y.add("TANGENT");if(V instanceof IW)Or(Z,J,V,Y)}let K=X instanceof k7&&!X.getExtension("KHR_materials_unlit"),G=J.getMode()===E8.Mode.POINTS;if(K&&!G)Y.add("NORMAL");return Y}function YD1(Z,J){let X=eN1(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 $D1(Z){let J=Z.getRoot(),X=Z.getGraph(),Y=Z.getLogger(),Q=J.listTextures().map(async(W)=>{var K;let G=await WD1(W);if(!G)return;if(tN1(W)==="srgb")gC.convertSRGBToLinear(G,G);let z=W.getName()||W.getURI(),H=(K=W.getSize())==null?void 0:K.join("x"),V=ZD1(W);for(let q of X.listParentEdges(W)){let F=q.getParent();if(F!==J&&QD1(F,G,q.getName(),Y))q.dispose()}if(W.listParents().length===1)W.dispose(),Y.debug(`${pW}: Removed solid-color texture "${z}" (${H}px ${V.join(", ")})`)});await Promise.all(Q)}function QD1(Z,J,X,Y){if(Z instanceof k7)switch(X){case"baseColorTexture":return Z.setBaseColorFactor(oN1(J,J,Z.getBaseColorFactor())),!0;case"emissiveTexture":return Z.setEmissiveFactor(gN1([0,0,0],J.slice(0,3),Z.getEmissiveFactor())),!0;case"occlusionTexture":return Math.abs(J[0]-1)<=Lk;case"metallicRoughnessTexture":return Z.setRoughnessFactor(J[1]*Z.getRoughnessFactor()),Z.setMetallicFactor(J[2]*Z.getMetallicFactor()),!0;case"normalTexture":return Br(wr(Ur(),J,[0.5,0.5,1,1]))<=Lk}return Y.warn(`${pW}: Detected single-color ${X} texture. Pruning ${X} not yet supported.`),!1}async function WD1(Z){let J=await KD1(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(Br(wr($,Y,X))/255>Lk)return null}return aN1($,pN1($,Y,X),0.00196078431372549)}async function KD1(Z){try{return await Qo(Z.getImage(),Z.getMimeType())}catch(J){return null}}var UX=4294967295;class Mr{constructor(Z){this.attributes=[],this.u8=void 0,this.u32=void 0;let J=0;for(let X of Dk(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(),$=a0.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 GD1(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 GD1(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 zD1(Z,J,X,Y,$=UX){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 N6;(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"})(N6||(N6={}));function BX(Z,J){let X=Z.getAttribute("POSITION"),Y=Z.getIndices();switch(J){case N6.RENDER:return Y?Y.getCount():X.getCount();case N6.RENDER_CACHED:return Y?new Set(Y.getArray()).size:X.getCount();case N6.UPLOAD_NAIVE:case N6.UPLOAD:return X.getCount();case N6.DISTINCT:case N6.DISTINCT_POSITION:return HD1(J);case N6.UNUSED:return Y?X.getCount()-new Set(Y.getArray()).size:0;default:return VD1(J)}}function HD1(Z){throw new Error(`Not implemented: ${Z}`)}function VD1(Z){throw new Error(`Unexpected value: ${Z}`)}function _z(Z,J,X){let Y=x6.fromGraph(Z.getGraph());if(!J||!X)[J,X]=qD1(Z);let $=Z.getIndices(),Q=$?$.getArray():null,W=BX(Z,N6.RENDER),K=Y.createAccessor(),G=W,z=Pk(G,X);for(let V=0;V<G;V++)z[V]=J[Q?Q[V]:V];Z.setIndices(K.setArray(z));let H=Dk(Z);for(let V of Z.listAttributes()){let q=eZ(Y,V);jk(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);jk(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 jk(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 qD1(Z){let J=BX(Z,N6.UPLOAD),X=Z.getIndices(),Y=X?X.getArray():null;if(!X||!Y)return[PN1(J,1e6),J];let $=new Uint32Array(J).fill(UX),Q=0;for(let W=0;W<Y.length;W++){let K=Y[W];if($[K]===UX)$[K]=Q++}return[$,Q]}var Ok="weld",MB={overwrite:!0,cleanup:!0};function Ck(Z=MB){let J=x7(MB,Z);return LX(Ok,async(X)=>{let Y=X.getLogger();for(let $ of X.getRoot().listMeshes()){for(let Q of $.listPrimitives())if(TB(Q,J),BX(Q,N6.RENDER)===0)Q.dispose();if($.listPrimitives().length===0)$.dispose()}if(J.cleanup)await X.transform(CB({propertyTypes:[s.ACCESSOR,s.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),qr({propertyTypes:[s.ACCESSOR]}));Y.debug(`${Ok}: Complete.`)})}function TB(Z,J=MB){let X=Z.getGraph(),$=x6.fromGraph(X).getLogger(),Q=iW({},MB,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 Mr(Z),V=TN1(W+W/4),q=new Uint32Array(V).fill(UX),F=new Uint32Array(W).fill(UX),U=0;for(let B=0;B<z;B++){let w=G?G[B]:B;if(F[w]!==UX)continue;let j=zD1(q,V,H,w,UX),N=q[j];if(N===UX)q[j]=w,F[w]=U++;else F[w]=F[N]}$.debug(`${Ok}: ${DB(W,U)} vertices.`),_z(Z,F,U)}var{FLOAT:FD1}=h0.ComponentType;function Rr(Z,J){let X=Z.getAttribute("POSITION");if(X)io(J,X);let Y=Z.getAttribute("NORMAL");if(Y)no(J,Y);let $=Z.getAttribute("TANGENT");if($)ao(J,$);for(let Q of Z.listTargets()){let W=Q.getAttribute("POSITION");if(W)io(J,W);let K=Q.getAttribute("NORMAL");if(K)no(J,K);let G=Q.getAttribute("TANGENT");if(G)ao(J,G)}if(SN1(J)<0)UD1(Z)}function io(Z,J){let X=J.getComponentType(),Y=J.getNormalized(),$=J.getArray(),Q=X===FD1?$:new Float32Array($.length),W=PB();for(let K=0,G=J.getCount();K<G;K++){if(Y)W[0]=l0.decodeNormalizedInt($[K*3],X),W[1]=l0.decodeNormalizedInt($[K*3+1],X),W[2]=l0.decodeNormalizedInt($[K*3+2],X);else W[0]=$[K*3],W[1]=$[K*3+1],W[2]=$[K*3+2];bN1(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 no(Z,J){let X=J.getArray(),Y=J.getNormalized(),$=J.getComponentType(),Q=_N1();AN1(Q,Z),hN1(Q,Q),xN1(Q,Q);let W=PB();for(let K=0,G=J.getCount();K<G;K++){if(Y)W[0]=l0.decodeNormalizedInt(X[K*3],$),W[1]=l0.decodeNormalizedInt(X[K*3+1],$),W[2]=l0.decodeNormalizedInt(X[K*3+2],$);else W[0]=X[K*3],W[1]=X[K*3+1],W[2]=X[K*3+2];if(yN1(W,W,Q),Vr(W,W),Y)X[K*3]=l0.decodeNormalizedInt(W[0],$),X[K*3+1]=l0.decodeNormalizedInt(W[1],$),X[K*3+2]=l0.decodeNormalizedInt(W[2],$);else X[K*3]=W[0],X[K*3+1]=W[1],X[K*3+2]=W[2]}}function ao(Z,J){let X=J.getArray(),Y=J.getNormalized(),$=J.getComponentType(),Q=PB();for(let W=0,K=J.getCount();W<K;W++){if(Y)Q[0]=l0.decodeNormalizedInt(X[W*4],$),Q[1]=l0.decodeNormalizedInt(X[W*4+1],$),Q[2]=l0.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],Vr(Q,Q),Y)X[W*4]=l0.decodeNormalizedInt(Q[0],$),X[W*4+1]=l0.decodeNormalizedInt(Q[1],$),X[W*4+2]=l0.decodeNormalizedInt(Q[2],$);else X[W*4]=Q[0],X[W*4+1]=Q[1],X[W*4+2]=Q[2]}}function UD1(Z){if(Z.getMode()!==E8.Mode.TRIANGLES)return;if(!Z.getIndices())TB(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 wD1(Z,J){for(let X of Z.listPrimitives()){let Y=BD1(X,Z);if(X!==Y)Z.removePrimitive(X).addPrimitive(Y)}for(let X of Z.listPrimitives())_z(X),Rr(X,J)}function BD1(Z,J){if(Z.listParents().some((Y)=>Y instanceof Gz&&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 so=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function Nr(Z){let J=Z.getMesh(),X=Z.getMatrix();if(J&&!l0.eq(X,so))wD1(J,X);for(let Y of Z.listChildren()){let $=Y.getMatrix();Hr($,$,X),Y.setMatrix($)}return Z.setMatrix(so)}var{LINES:LD1,LINE_STRIP:jD1,LINE_LOOP:OD1,TRIANGLES:MD1,TRIANGLE_STRIP:RD1,TRIANGLE_FAN:ND1}=E8.Mode;function DD1(Z){let J=Z.getGraph(),X=x6.fromGraph(J);if(!Z.getIndices())TB(Z);let Y=Z.getIndices(),$=Y.getArray(),Q=Wr(Z),K=new $X[Y.getComponentType()](Q*2),G=Z.getMode();if(G===jD1)for(let H=0;H<Q;H++)K[H*2]=$[H],K[H*2+1]=$[H+1];else if(G===OD1)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(LD1);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 Dr(Z){let J=Z.getGraph(),X=x6.fromGraph(J);if(!Z.getIndices())TB(Z);let Y=Z.getIndices(),$=Y.getArray(),Q=Wr(Z),K=new $X[Y.getComponentType()](Q*3),G=Z.getMode();if(G===RD1)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===ND1)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(MD1);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 oo="dequantize",RB={pattern:/^((?!JOINTS_).)*$/};function Pr(Z=RB){let J=x7(RB,Z);return LX(oo,(X)=>{let Y=X.getLogger();for(let $ of X.getRoot().listMeshes())for(let Q of $.listPrimitives())PD1(Q,J);X.createExtension(vz).dispose(),Y.debug(`${oo}: Complete.`)})}function PD1(Z,J=RB){let X=x7(RB,J);for(let Y of Z.listSemantics())if(X.pattern.test(Y))Mk(Z.getAttribute(Y));for(let Y of Z.listTargets())for(let $ of Y.listSemantics())if(X.pattern.test($))Mk(Y.getAttribute($))}function Mk(Z){let J=Z.getArray();if(!J)return;let X=NB(J,Z.getComponentType(),Z.getNormalized());Z.setArray(X).setNormalized(!1)}function NB(Z,J,X){let Y=new Float32Array(Z.length);for(let $=0,Q=Z.length;$<Q;$++)if(X)Y[$]=l0.decodeNormalizedInt(Z[$],J);else Y[$]=Z[$];return Y}var{TEXTURE_INFO:Cr,ROOT:wL6}=s;function Tr(Z){let J=new x6().setLogger(Z.getLogger()),X=Tk(J,Z);return CD1(J,Z,X),J.getRoot().copy(Z.getRoot(),X),J}function CD1(Z,J,X){X||(X=Tk(Z,J));for(let Y of J.getRoot().listExtensionsUsed()){let $=Z.createExtension(Y.constructor);if(Y.isRequired())$.setRequired(!0)}return TD1(Z,J,kD1(J),X)}function TD1(Z,J,X,Y){Y||(Y=Tk(Z,J));let $=new Map;for(let Q of X)if(!$.has(Q)&&Q.propertyType!==Cr)$.set(Q,Y(Q));for(let[Q,W]of $.entries())W.copy(Q,Y);return $}function Tk(Z,J){let X=new Map([[J.getRoot(),Z.getRoot()]]);return(Y)=>{if(Y.propertyType===Cr)return Y;let $=X.get(Y);if(!$)$=new Y.constructor(Z.getGraph()),X.set(Y,$);return $}}function kD1(Z){let J=new Set;for(let X of Z.getGraph().listEdges())J.add(X.getChild());return Array.from(J)}var Uk="flatten",ro={cleanup:!0};function kr(Z=ro){let J=x7(ro,Z);return LX(Uk,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;IN1(H)});if(W.size)$.debug(`${Uk}: Flattening node hierarchies with TRS animation not yet supported.`);if(J.cleanup)await X.transform(CB({propertyTypes:[s.NODE],keepLeaves:!1}));$.debug(`${Uk}: Complete.`)})}function Er(Z){return yC(Z)}var ED1={skipValidation:!1},to=4294967295,{LINE_STRIP:ID1,LINE_LOOP:vD1,TRIANGLE_STRIP:SD1,TRIANGLE_FAN:_D1}=E8.Mode;function AD1(Z,J={}){let X=x7(ED1,J),Y=Z[0],$=x6.fromGraph(Y.getGraph());if(!X.skipValidation&&new Set(Z.map(Gr)).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 ID1:case vD1:DD1(F);break;case SD1:case _D1:Dr(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(),j=B?B.getArray():null,N=B?B.getCount():w,R=new Uint32Array(w).fill(to);for(let O=0;O<N;O++){let P=j?j[O]:O;if(R[P]===to)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=$X[U.getComponentType()],w=eZ($,U).setArray(new B(K*U.getElementSize()));z.setAttribute(F,w)}let H=Y.getIndices(),V=H?eZ($,H).setArray(Pk(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,j=Q[F];if(B&&V)hD1(B,j,V,q),q+=w;for(let N of z.listSemantics()){let R=U.getAttribute(N),O=z.getAttribute(N);xD1(R,B,j,O)}}return z}function xD1(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 hD1(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 Rk="join",{ROOT:fD1,NODE:bD1,MESH:yD1,PRIMITIVE:gD1,ACCESSOR:mD1}=s,wk=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],eo={keepMeshes:!1,keepNamed:!1,cleanup:!0};function Ir(Z=eo){let J=x7(eo,Z);return LX(Rk,async(X)=>{let Y=X.getRoot(),$=X.getLogger();for(let Q of Y.listScenes())Zr(X,Q,J),Q.traverse((W)=>Zr(X,W,J));if(J.cleanup)await X.transform(CB({propertyTypes:[bD1,yD1,gD1,mD1],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}));$.debug(`${Rk}: Complete.`)})}function Zr(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 K$))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;_z(q),dD1(q);let U=Gr(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!==fD1&&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 j=0;j<z.length;j++){let N=H[j],R=V[j],O=z[j];if(R.removePrimitive(O),CN1(O))O=z[j]=uD1(z[j]);if(N!==q)Hr(wk,vN1(wk,U),N.getMatrix()),Rr(O,wk)}let B=AD1(z),w=B.listAttributes()[0].getCount();F.addPrimitive(B),Y.debug(`${Rk}: Joined Primitives (${z.length}) containing ${Bk(w)} vertices under Node "${q.getName()}".`)}}function uD1(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 dD1(Z){for(let J of["POSITION","NORMAL","TANGENT"]){let X=Z.getAttribute(J);if(X)Mk(X)}}var{TRANSLATION:BL6,ROTATION:LL6,SCALE:jL6,WEIGHTS:OL6}=K$.TargetPath;var cD1={pattern:/.*/,quantizationVolume:"mesh",quantizePosition:14,quantizeNormal:10,quantizeTexcoord:12,quantizeColor:8,quantizeWeight:8,quantizeGeneric:12,normalizeWeights:!0,cleanup:!0};var ML6=iW({level:"high"},cD1);var lD1="unweld";function pD1(Z,J=new Map){let X=Z.getIndices();if(!X)return;let Y=Z.getGraph(),$=x6.fromGraph(Y),Q=$.getLogger(),W=Z.getAttribute("POSITION").getCount();for(let G of Z.listAttributes())if(Z.swap(G,Jr($,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,Jr($,z,X,J)),z.listParents().length===1)z.dispose();let K=Z.getAttribute("POSITION").getCount();if(Q.debug(`${lD1}: ${DB(W,K)} vertices.`),Z.setIndices(null),X.listParents().length===1)X.dispose()}function Jr(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 Xr;(function(Z){Z[Z.STEP=0]="STEP",Z[Z.LERP=1]="LERP",Z[Z.SLERP=2]="SLERP"})(Xr||(Xr={}));var iD1=0.000001;function nD1(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(Sz(J,H-1,G),Sz(J,V,W),Sz(J,V+1,K),X==="slerp"){let j=oD1(Q,G,K,B),N=$r(G,W)+$r(W,K);w=!OB(W,j,Y)||N+Number.EPSILON>=Math.PI}else if(X==="lerp"){let j=sD1(Q,G,K,B);w=!OB(W,j,Y)}else if(X==="step")w=!OB(W,G)||!OB(W,K)}if(w){if(V!==H)Z[H]=Z[V],Yr(J,H,Sz(J,V,Q));H++}}if(z>0)Z[H]=Z[z],Yr(J,H,Sz(J,z,Q)),H++;return H}function Sz(Z,J,X){for(let Y=0,$=X.length;Y<$;Y++)X[Y]=Z[J*$+Y];return X}function Yr(Z,J,X){for(let Y=0,$=X.length;Y<$;Y++)Z[J*$+Y]=X[Y]}function OB(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 aD1(Z,J,X){return Z*(1-X)+J*X}function sD1(Z,J,X,Y){for(let $=0;$<J.length;$++)Z[$]=aD1(J[$],X[$],Y);return Z}function oD1(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>iD1)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 $r(Z,J){let X=rD1(Z,J);return Math.acos(2*X*X-1)}function rD1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}var RL6=new Float32Array(0),NL6={ready:Promise.resolve(),resample:nD1,tolerance:0.0001,cleanup:!0};var w$="simplify",{POINTS:vr,LINES:tD1,LINE_STRIP:eD1,LINE_LOOP:ZP1,TRIANGLES:JP1,TRIANGLE_STRIP:Sr,TRIANGLE_FAN:_r}=E8.Mode,Ar={ratio:0,error:0.0001,lockBorder:!1,cleanup:!0};function xr(Z){let J=x7(Ar,Z),X=J.simplifier;if(!X)throw new Error(`${w$}: simplifier dependency required \u2014 install "meshoptimizer".`);return LX(w$,async(Y)=>{let $=Y.getLogger();await X.ready,await Y.transform(Ck({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===JP1||G===Sr||G===_r){if(Qr(K,J),BX(K,N6.RENDER)===0)K.dispose()}else if(K.getMode()===vr&&!!X.simplifyPoints){if(Qr(K,J),BX(K,N6.RENDER)===0)K.dispose()}else Q++}if(W.listPrimitives().length===0)W.dispose()}if(Q>0)$.warn(`${w$}: Skipping simplification of ${Q} primitives: Unsupported draw mode.`);if(J.cleanup)await Y.transform(CB({propertyTypes:[s.ACCESSOR,s.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),qr({propertyTypes:[s.ACCESSOR]}));$.debug(`${w$}: Complete.`)})}function Qr(Z,J){let X=iW({},Ar,J),Y=X.simplifier,$=Z.getGraph(),Q=x6.fromGraph($),W=Q.getLogger();switch(Z.getMode()){case vr:return XP1(Q,Z,X);case tD1:case eD1:case ZP1:return W.warn(`${w$}: Skipping primitive simplification: Unsupported draw mode.`),Z;case Sr:case _r:Dr(Z);break}let K=BX(Z,N6.UPLOAD),G=BX(Z,N6.RENDER);if(G<K/2)_z(Z);let z=Z.getAttribute("POSITION"),H=Z.getIndices(),V=z.getArray(),q=H.getArray();if(!(V instanceof Float32Array))V=NB(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();_z(Z);let j=BX(Z,N6.UPLOAD);if(j<=65534)Z.getIndices().setArray(new Uint16Array(Z.getIndices().getArray()));return W.debug(`${w$}: ${DB(K,j)} vertices, error: ${w.toFixed(4)}.`),Z}function XP1(Z,J,X){let Y=X.simplifier,$=Z.getLogger();if(J.getIndices())pD1(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=NB(z,W.getComponentType(),W.getNormalized());if(H&&!(H instanceof Float32Array))H=NB(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(`${w$}: ${DB(W.getCount(),B)} vertices.`);for(let w of Dk(J)){let j=eZ(Z,w);if(jk(w,null,U,j,B),NN1(J,w,j),w.listParents().length===1)w.dispose()}return J}var Nk;(function(Z){Z.LANCZOS3="lanczos3",Z.LANCZOS2="lanczos2"})(Nk||(Nk={}));var DL6={resizeFilter:Nk.LANCZOS3,pattern:void 0,formats:void 0,slots:void 0,quality:void 0,effort:void 0,lossless:!1,nearLossless:!1,limitInputPixels:!0};var CL6=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 j=0;for(var B=0;B<F.length;++B)U[j++]=U[B]<60?J[U[B]]:(U[B]-60)*64+U[++B];return U.buffer.slice(0,j)}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 j=X.exports.sbrk,N=j(U.length*4),R=j(B*4),O=new Uint8Array(X.exports.memory.buffer),P=W(U);if(O.set(P,N),w)w(N,N,U.length,B);var D=F(R,N,U.length,B);O=new Uint8Array(X.exports.memory.buffer);var C=new Uint32Array(B);new Uint8Array(C.buffer).set(O.subarray(R,R+B*4)),P.set(O.subarray(N,N+U.length*4)),j(N-j(0));for(var T=0;T<U.length;++T)U[T]=C[U[T]];return[C,D]}function G(F,U,B,w){var j=X.exports.sbrk,N=j(B*4),R=j(B*w),O=new Uint8Array(X.exports.memory.buffer);O.set(W(U),R),F(N,R,B,w),O=new Uint8Array(X.exports.memory.buffer);var P=new Uint32Array(B);return new Uint8Array(P.buffer).set(O.subarray(N,N+B*4)),j(N-j(0)),P}function z(F,U,B,w,j){var N=X.exports.sbrk,R=N(U),O=N(w*j),P=new Uint8Array(X.exports.memory.buffer);P.set(W(B),O);var D=F(R,U,O,w,j),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,j,N,R){var O=X.exports.sbrk,P=O(B*w),D=O(B*N),C=new Uint8Array(X.exports.memory.buffer);C.set(W(U),D),F(P,B,w,j,D,R);var T=new Uint8Array(B*w);return T.set(C.subarray(P,P+B*w)),O(P-O(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),j=X.exports.meshopt_encodeIndexBufferBound(U,H(w)+1);return z(X.exports.meshopt_encodeIndexBuffer,j,w,U,4)},encodeIndexSequence:function(F,U,B){Q(B==2||B==4);var w=V(F,B),j=X.exports.meshopt_encodeIndexSequenceBound(U,H(w)+1);return z(X.exports.meshopt_encodeIndexSequence,j,w,U,4)},encodeGltfBuffer:function(F,U,B,w){var j={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return Q(j[w]),j[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,j){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,j?N[j]:1)}}}();var kL6=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(j){Q=j.instance,Q.exports.__wasm_call_ctors()});function K(j){var N=new Uint8Array(j.length);for(var R=0;R<j.length;++R){var O=j.charCodeAt(R);N[R]=O>96?O-97:O>64?O-39:O+4}var P=0;for(var R=0;R<j.length;++R)N[P++]=N[R]<60?Y[N[R]]:(N[R]-60)*64+N[++R];return N.buffer.slice(0,P)}function G(j,N,R,O,P,D,C){var T=j.exports.sbrk,k=O+3&-4,A=T(k*P),v=T(D.length),x=new Uint8Array(j.exports.memory.buffer);x.set(D,v);var I=N(A,O,P,v,D.length);if(I==0&&C)C(A,k,P);if(R.set(x.subarray(A,A+O*P)),T(A-T(0)),I!=0)throw new Error("Malformed buffer data: "+I)}var z={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},H={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},V=[],q=0;function F(j){var N={object:new Worker(j),pending:0,requests:{}};return N.object.onmessage=function(R){var O=R.data;N.pending-=O.count,N.requests[O.id][O.action](O.value),delete N.requests[O.id]},N}function U(j){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"}),O=URL.createObjectURL(R);for(var P=V.length;P<j;++P)V[P]=F(O);for(var P=j;P<V.length;++P)V[P].object.postMessage({});V.length=j,URL.revokeObjectURL(O)}function B(j,N,R,O,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 A=new Uint8Array(R),v=++q;D.pending+=j,D.requests[v]={resolve:T,reject:k},D.object.postMessage({id:v,count:j,size:N,source:A,mode:O,filter:P},[A.buffer])})}function w(j){var N=j.data;if(!N.id)return self.close();self.ready.then(function(R){try{var O=new Uint8Array(N.count*N.size);G(R,R.exports[N.mode],O,N.count,N.size,N.source,R.exports[N.filter]),self.postMessage({id:N.id,count:N.count,action:"resolve",value:O},[O.buffer])}catch(P){self.postMessage({id:N.id,count:N.count,action:"reject",value:P})}})}return{ready:W,supported:!0,useWorkers:function(j){U(j)},decodeVertexBuffer:function(j,N,R,O,P){G(Q,Q.exports.meshopt_decodeVertexBuffer,j,N,R,O,Q.exports[z[P]])},decodeIndexBuffer:function(j,N,R,O){G(Q,Q.exports.meshopt_decodeIndexBuffer,j,N,R,O)},decodeIndexSequence:function(j,N,R,O){G(Q,Q.exports.meshopt_decodeIndexSequence,j,N,R,O)},decodeGltfBuffer:function(j,N,R,O,P,D){G(Q,Q.exports[H[P]],j,N,R,O,Q.exports[z[D]])},decodeGltfBufferAsync:function(j,N,R,O,P){if(V.length>0)return B(j,N,R,H[O],z[P]);return W.then(function(){var D=new Uint8Array(j*N);return G(Q,Q.exports[H[O]],D,j,N,R,Q.exports[z[P]]),D})}}}();var hr=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 j=U.charCodeAt(w);B[w]=j>96?j-97:j>64?j-39:j+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 j=X.exports.sbrk,N=j(B.length*4),R=j(w*4),O=new Uint8Array(X.exports.memory.buffer),P=W(B);O.set(P,N);var D=U(R,N,B.length,w);O=new Uint8Array(X.exports.memory.buffer);var C=new Uint32Array(w);new Uint8Array(C.buffer).set(O.subarray(R,R+w*4)),P.set(O.subarray(N,N+B.length*4)),j(N-j(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 j=U[w];B=B<j?j:B}return B}function z(U,B,w,j,N,R,O,P,D){var C=X.exports.sbrk,T=C(4),k=C(w*4),A=C(N*R),v=C(w*4),x=new Uint8Array(X.exports.memory.buffer);x.set(W(j),A),x.set(W(B),v);var I=U(k,v,w,A,N,R,O,P,D,T);x=new Uint8Array(X.exports.memory.buffer);var S=new Uint32Array(I);W(S).set(x.subarray(k,k+I*4));var y=new Float32Array(1);return W(y).set(x.subarray(T,T+4)),C(T-C(0)),[S,y[0]]}function H(U,B,w,j,N,R,O,P,D,C,T,k,A){var v=X.exports.sbrk,x=v(4),I=v(w*4),S=v(N*R),y=v(N*P),m=v(D.length*4),i=v(w*4),t=C?v(N):0,Z0=new Uint8Array(X.exports.memory.buffer);if(Z0.set(W(j),S),Z0.set(W(O),y),Z0.set(W(D),m),Z0.set(W(B),i),C)Z0.set(W(C),t);var W0=U(I,i,w,S,N,R,y,P,m,D.length,t,T,k,A,x);Z0=new Uint8Array(X.exports.memory.buffer);var A0=new Uint32Array(W0);W(A0).set(Z0.subarray(I,I+W0*4));var x0=new Float32Array(1);return W(x0).set(Z0.subarray(x,x+4)),v(x-v(0)),[A0,x0[0]]}function V(U,B,w,j){var N=X.exports.sbrk,R=N(w*j),O=new Uint8Array(X.exports.memory.buffer);O.set(W(B),R);var P=U(R,w,j);return N(R-N(0)),P}function q(U,B,w,j,N,R,O,P){var D=X.exports.sbrk,C=D(P*4),T=D(w*j),k=D(w*R),A=new Uint8Array(X.exports.memory.buffer);if(A.set(W(B),T),N)A.set(W(N),k);var v=U(C,T,w,j,k,R,O,P);A=new Uint8Array(X.exports.memory.buffer);var x=new Uint32Array(v);return W(x).set(A.subarray(C,C+v*4)),D(C-D(0)),x}var F={LockBorder:1,Sparse:2,ErrorAbsolute:4,Prune:8,_InternalDebug:1073741824};return{ready:Y,supported:!0,useExperimentalFeatures:!1,compactMesh:function(U){Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0);var 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,j,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(j>=0&&j<=U.length),Q(j%3==0),Q(N>=0);var O=0;for(var P=0;P<(R?R.length:0);++P)Q(R[P]in F),Q(this.useExperimentalFeatures||R[P]!="Prune"),O|=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,j,N,O);return C[0]=U instanceof Uint32Array?C[0]:new U.constructor(C[0]),C},simplifyWithAttributes:function(U,B,w,j,N,R,O,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(j instanceof Float32Array),Q(j.length%N==0),Q(N>=0),Q(O==null||O instanceof Uint8Array),Q(O==null||O.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 A=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),v=H(X.exports.meshopt_simplifyWithAttributes,A,U.length,B,B.length/w,w*4,j,N*4,new Float32Array(R),O?new Uint8Array(O):null,P,D,k);return v[0]=U instanceof Uint32Array?v[0]:new U.constructor(v[0]),v},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,j,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),j)return Q(j instanceof Float32Array),Q(j.length%N==0),Q(N>=3),Q(U.length/B==j.length/N),q(X.exports.meshopt_simplifyPoints,U,U.length/B,B*4,j,N*4,R,w);else return q(X.exports.meshopt_simplifyPoints,U,U.length/B,B*4,void 0,0,0,w)}}}();var vL6=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 j=U.charCodeAt(w);B[w]=j>96?j-97:j>64?j-39:j+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],j=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(j,j+R*3)}}function H(U,B,w,j,N,R,O){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),A=P(U.byteLength),v=P(B.byteLength),x=new Uint8Array(X.exports.memory.buffer);x.set(W(U),A),x.set(W(B),v);var I=X.exports.meshopt_buildMeshlets(C,T,k,A,U.length,v,w,j,N,R,O);x=new Uint8Array(X.exports.memory.buffer);var S=x.subarray(C,C+I*G),y=new Uint32Array(S.buffer,S.byteOffset,S.byteLength/4).slice();for(var m=0;m<I;++m){var i=y[m*4+0],t=y[m*4+1],w=y[m*4+2],Z0=y[m*4+3];X.exports.meshopt_optimizeMeshlet(T+i*4,k+t,Z0,w)}var W0=y[(I-1)*4+0],A0=y[(I-1)*4+1],x0=y[(I-1)*4+2],s0=y[(I-1)*4+3],b8=W0+x0,$8=A0+(s0*3+3&-4),L7={meshlets:y,vertices:new Uint32Array(x.buffer,T,b8).slice(),triangles:new Uint8Array(x.buffer,k,$8*3).slice(),meshletCount:I};return P(C-P(0)),L7}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,j){var N=X.exports.sbrk,R=[],O=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),O),T.set(W(U.vertices),P),T.set(W(U.triangles),D);for(var k=0;k<U.meshletCount;++k){var A=U.meshlets[k*4+0],v=U.meshlets[k*4+0+1],x=U.meshlets[k*4+0+3];X.exports.meshopt_computeMeshletBounds(C,P+A*4,D+v,x,O,w,j),R.push(V(C))}return N(O-N(0)),R}function F(U,B,w,j){var N=X.exports.sbrk,R=N(K),O=N(U.byteLength),P=N(B.byteLength),D=new Uint8Array(X.exports.memory.buffer);D.set(W(U),O),D.set(W(B),P),X.exports.meshopt_computeClusterBounds(R,O,U.length,P,w,j);var C=V(R);return N(R-N(0)),C}return{ready:Y,supported:!0,buildMeshlets:function(U,B,w,j,N,R){Q(U.length%3==0),Q(B instanceof Float32Array),Q(B.length%w==0),Q(w>=3),Q(j<=255||j>0),Q(N<=512),Q(N%4==0),R=R||0;var O=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return H(O,B,B.length/w,w*4,j,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 j=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return F(j,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 aW={OPTIMIZED_DIR:".optimized",CHECKSUM_EXT:".md5",DIRECTORIES:[(()=>{try{return H9.dirname(c.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js"))}catch{return null}})(),H9.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 h5{static instance=new h5;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=H9.normalize(Z);for(let X of aW.DIRECTORIES){let Y=H9.normalize(X);if(J.startsWith(Y))return H9.relative(Y,J).replace(/\\/g,"/")}return H9.basename(J)}async _getAbsoluteModelPaths(){let Z=[];for(let J of aW.DIRECTORIES){let X=H9.resolve(process.cwd(),J);if(!jX.existsSync(X))continue;let Y=await Fw("**/*.{gltf,glb}",{cwd:X,follow:!0});for(let $ of Y)Z.push(H9.join(X,$))}return Z}async _loadModelData(Z){let J=await new lC().read(Z),X=Er(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)}${aW.CHECKSUM_EXT}`;if(!jX.existsSync(J))return!1;let X=this._calculateChecksum(Z),Y=jX.readFileSync(J,"utf8");return X===Y}_calculateChecksum(Z){if(!jX.existsSync(Z))return"";let J=jX.readFileSync(Z);return YP1.createHash("sha256").update(J.toString("base64")).digest("hex")}_buildOptimizedModelPath(Z){let J=H9.basename(Z),X=J.replace(/\.[^/.]+$/,""),Y=H9.dirname(Z),$=H9.join(Y,aW.OPTIMIZED_DIR,X);return H9.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 $=Tr(Y);$.setLogger(new _5(Wz.WARN)),await $.transform(zr({pivot:"center"}),kr(),Ir(),Ck(),xr({simplifier:hr,ratio:J,error:X}),Pr());for(let z of $.getRoot().listScenes())for(let H of z.listChildren())Nr(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=H9.dirname(J);jX.rmSync(X,{recursive:!0,force:!0}),jX.mkdirSync(X,{recursive:!0}),console.log(`ModelRegistry: Optimizing model ${this._absoluteModelPathToModelUri(Z)}...`);for(let Y of aW.OPTIMIZER_RUNS){let $=J.replace(/(\.[^/.]+)$/,`${Y.suffix}$1`),{stderr:Q}=await rp("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 jX.writeFileSync(`${J}${aW.CHECKSUM_EXT}`,this._calculateChecksum(Z)),J}}var Az;(($)=>{$.DYNAMIC="dynamic";$.FIXED="fixed";$.KINEMATIC_POSITION="kinematic_position";$.KINEMATIC_VELOCITY="kinematic_velocity"})(Az||={});var kk=0.001,fr="dynamic";class B$ 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??=fr,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 V9({...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 V9(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??fr;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)<kk&&Math.abs(Z.y)<kk&&Math.abs(Z.z)<kk}}var Ek;(($)=>{$[$.Average=0]="Average";$[$.Min=1]="Min";$[$.Multiply=2]="Multiply";$[$.Max=3]="Max"})(Ek||={});var xz;((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"})(xz||={});class V9 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=h5.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=h5.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}}),j=()=>({shape:"capsule",radius:q(V),halfHeight:q(Q*J/2-V)});if(X)switch(X){case"block":return F();case"capsule":return j();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 j()}get bounciness(){if(!this._requireNotRemoved("bounciness"))return 0;return this._collider?this._collider.restitution():this._colliderDesc.restitution}get bouncinessCombineRule(){if(!this._requireNotRemoved("bouncinessCombineRule"))return 0;return this._collider?this._collider.restitutionCombineRule():this._colliderDesc.restitutionCombineRule}get collisionGroups(){if(!this._requireNotRemoved("collisionGroups"))return{belongsTo:[],collidesWith:[]};return this._collider?S4.decodeRawCollisionGroups(this._collider.collisionGroups()):S4.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=S4.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 $P1={shape:"voxels"},Ik;((X)=>{X.ENTITY_COLLISION="BLOCK_TYPE.ENTITY_COLLISION";X.ENTITY_CONTACT_FORCE="BLOCK_TYPE.ENTITY_CONTACT_FORCE"})(Ik||={});class q9 extends j0{_id;_customColliderOptions;_halfExtents;_isLiquid;_name;_textureUri;constructor(Z={id:-1,textureUri:"textures/missing.png",name:"Unknown"}){if(Z.id<0)d.fatalError("BlockType.constructor(): BlockType id not set.");super();this._id=Z.id,this._customColliderOptions=Z.customColliderOptions,this._halfExtents=Z.halfExtents??{x:0.5,y:0.5,z:0.5},this._isLiquid=Z.isLiquid??!1,this._name=Z.name,this._textureUri=Z.textureUri}get id(){return this._id}get colliderOptions(){return{...this._customColliderOptions,...$P1}}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 V9({...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(S4.isDefaultCollisionGroups(J.collisionGroups))J.setCollisionGroups({belongsTo:[1],collidesWith:[65535&~1]});return J}serialize(){return k0.serializeBlockType(this)}}var vk;((J)=>J.REGISTER_BLOCK_TYPE="BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE")(vk||={});class hz extends j0{_blockTypes=new Map;_world;constructor(Z){super();this._world=Z}get world(){return this._world}getAllBlockTypes(){return Array.from(this._blockTypes.values())}getBlockType(Z){let J=this._blockTypes.get(Z);if(!J)d.fatalError(`BlockTypeRegistry.getBlockType(): BlockType with id ${Z} not found.`);return J}registerGenericBlockType(Z){let X=new class extends q9{constructor(Y=Z){super(Y)}};return this.registerBlockType(X),X}registerBlockType(Z){this._blockTypes.set(Z.id,Z),this.emitWithWorld(this._world,"BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE",{blockTypeRegistry:this,id:Z.id,blockType:Z})}serialize(){return k0.serializeBlockTypeRegistry(this)}}var KI={};_9(KI,{worldSchema:()=>WI,worldPacketDefinition:()=>I80,vectorSchema:()=>V1,vectorBooleanSchema:()=>X_1,uiSchema:()=>$I,uiPacketDefinition:()=>k80,uiDatasSchema:()=>QI,uiDatasPacketDefinition:()=>E80,uiDataSendPacketDefinition:()=>q80,uiDataSchema:()=>QH,syncResponseSchema:()=>YI,syncResponsePacketDefinition:()=>T80,syncRequestSchema:()=>SE,syncRequestPacketDefinition:()=>V80,stateRequestSchema:()=>vE,stateRequestPacketDefinition:()=>H80,sceneUIsSchema:()=>XI,sceneUIsPacketDefinition:()=>C80,sceneUISchema:()=>JI,rgbColorSchema:()=>m6,registeredPackets:()=>qL,quaternionSchema:()=>cE,playersSchema:()=>ZI,playersPacketDefinition:()=>P80,playerSchema:()=>eE,physicsDebugRenderSchema:()=>tE,physicsDebugRenderPacketDefinition:()=>N80,physicsDebugRaycastsSchema:()=>rE,physicsDebugRaycastsPacketDefinition:()=>D80,physicsDebugRaycastSchema:()=>oE,particleEmittersSchema:()=>sE,particleEmittersPacketDefinition:()=>R80,particleEmitterSchema:()=>aE,outboundPackets:()=>VL,modelNodeOverrideSchema:()=>dE,lightsSchema:()=>nE,lightsPacketDefinition:()=>M80,lightSchema:()=>iE,isValidPacket:()=>$_1,inputSchema:()=>IE,inputPacketDefinition:()=>z80,inboundPackets:()=>HL,hexColorSchema:()=>kE,heartbeatSchema:()=>TE,heartbeatPacketDefinition:()=>W80,entitySchema:()=>lE,entitiesSchema:()=>pE,entitiesPacketDefinition:()=>O80,definePacket:()=>S0,debugConfigSchema:()=>EE,debugConfigPacketDefinition:()=>G80,createPacket:()=>iS1,connectionSchema:()=>CE,connectionPacketDefinition:()=>Q80,chunksSchema:()=>uE,chunksPacketDefinition:()=>j80,chunkSchema:()=>mE,chatMessagesSchema:()=>gE,chatMessagesPacketDefinition:()=>L80,chatMessageSendPacketDefinition:()=>K80,chatMessageSchema:()=>$H,cameraSchema:()=>yE,cameraPacketDefinition:()=>B80,blocksSchema:()=>hE,blocksPacketDefinition:()=>U80,blockTypesSchema:()=>bE,blockTypesPacketDefinition:()=>w80,blockTypeSchema:()=>fE,blockSchema:()=>xE,bidirectionalPackets:()=>zL,audiosSchema:()=>AE,audiosPacketDefinition:()=>F80,audioSchema:()=>_E,PacketId:()=>h1});var zL={};_9(zL,{heartbeatPacketDefinition:()=>W80,connectionPacketDefinition:()=>Q80});var DE=e(Y80(),1);class PE extends DE.default{static instance=new DE.default}var h1;((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"})(h1||={});function iS1(Z,J,X,Y){if(!Z.validate(J))throw new Error(`Invalid payload for packet with id ${Z.id}. Error: ${PE.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:PE.instance.compile(J)}}var nS1={type:"object",properties:{i:{type:"string"}},required:["i"],additionalProperties:!1},$80={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},aS1={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},sS1={type:"object",properties:{usernameFragment:{type:"string"},password:{type:"string"},iceLite:{type:"boolean",nullable:!0}},required:["usernameFragment","password"],additionalProperties:!1},oS1={type:"object",properties:{i:{type:"string"},l:{type:"string"}},required:["i","l"],additionalProperties:!1},rS1={type:"object",properties:{port:{type:"number"},OS:{type:"number"},MIS:{type:"number"},maxMessageSize:{type:"number"}},required:["port","OS","MIS","maxMessageSize"],additionalProperties:!0},tS1={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},eS1={type:"object",properties:{i:{type:"string"},f:{type:"string",enum:["cs","sc"]},ip:sS1,ic:{type:"array",items:aS1},d:$80,s:rS1},required:["i","f","ip","ic","d","s"],additionalProperties:!1},Z_1={type:"object",properties:{i:{type:"string"},d:$80},required:["i","d"],additionalProperties:!1},J_1={type:"object",properties:{i:{type:"string",nullable:!0},pi:{type:"string",nullable:!0},l:{type:"string"},s:tS1},required:["l","s"],additionalProperties:!1},CE={type:"object",properties:{i:{type:"string",nullable:!0},k:{type:"boolean",nullable:!0},c:{...Z_1,nullable:!0},ca:{...nS1,nullable:!0},d:{type:"array",items:{...J_1},nullable:!0},pa:{...oS1,nullable:!0},t:{type:"array",items:{...eS1},nullable:!0}},additionalProperties:!1};var Q80=S0(116,CE);var TE={type:"null",nullable:!0};var W80=S0(117,TE);var HL={};_9(HL,{uiDataSendPacketDefinition:()=>q80,syncRequestPacketDefinition:()=>V80,stateRequestPacketDefinition:()=>H80,inputPacketDefinition:()=>z80,debugConfigPacketDefinition:()=>G80,chatMessageSendPacketDefinition:()=>K80});var kE={type:"string",pattern:"^[0-9A-Fa-f]{6}$"};var $H={type:"object",properties:{m:{type:"string"},c:{...kE,nullable:!0},p:{type:"string",nullable:!0}},required:["m"],additionalProperties:!1};var K80=S0(3,$H);var EE={type:"object",properties:{pdr:{type:"boolean",nullable:!0}},additionalProperties:!1};var G80=S0(128,EE);var IE={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 z80=S0(1,IE);var vE={type:"object",properties:{},additionalProperties:!1};var H80=S0(2,vE);var SE={type:"null",nullable:!0};var V80=S0(0,SE);var QH={type:"object",properties:{},additionalProperties:!0};var q80=S0(4,QH);var VL={};_9(VL,{worldPacketDefinition:()=>I80,uiPacketDefinition:()=>k80,uiDatasPacketDefinition:()=>E80,syncResponsePacketDefinition:()=>T80,sceneUIsPacketDefinition:()=>C80,playersPacketDefinition:()=>P80,physicsDebugRenderPacketDefinition:()=>N80,physicsDebugRaycastsPacketDefinition:()=>D80,particleEmittersPacketDefinition:()=>R80,lightsPacketDefinition:()=>M80,entitiesPacketDefinition:()=>O80,chunksPacketDefinition:()=>j80,chatMessagesPacketDefinition:()=>L80,cameraPacketDefinition:()=>B80,blocksPacketDefinition:()=>U80,blockTypesPacketDefinition:()=>w80,audiosPacketDefinition:()=>F80});var V1={type:"array",items:[{type:"number"},{type:"number"},{type:"number"}],minItems:3,maxItems:3};var _E={type:"object",properties:{i:{type:"number"},a:{type:"string",nullable:!0},cd:{type:"number",nullable:!0},d:{type:"number",nullable:!0},de:{type:"number",nullable:!0},di:{type:"number",minimum:0,nullable:!0},e:{type:"number",nullable:!0},l:{type:"boolean",nullable:!0},o:{type:"number",nullable:!0},p:{...V1,nullable:!0},pa:{type:"boolean",nullable:!0},pl:{type:"boolean",nullable:!0},pr:{type:"number",minimum:0,nullable:!0},r:{type:"boolean",nullable:!0},rd:{type:"number",nullable:!0},s:{type:"number",nullable:!0},v:{type:"number",minimum:0,maximum:1,nullable:!0}},required:["i"],additionalProperties:!1};var AE={type:"array",items:{..._E}};var F80=S0(33,AE);var xE={type:"object",properties:{i:{type:"number"},c:V1},required:["i","c"],additionalProperties:!1};var hE={type:"array",items:{...xE}};var U80=S0(34,hE);var fE={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 bE={type:"array",items:{...fE}};var w80=S0(35,bE);var yE={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:{...V1,nullable:!0},p:{...V1,nullable:!0},pt:{...V1,nullable:!0},pl:{...V1,nullable:!0},s:{type:"array",items:{type:"string"},nullable:!0},sa:{type:"number",nullable:!0},z:{type:"number",nullable:!0}},additionalProperties:!1};var gE={type:"array",items:{...$H}};var mE={type:"object",properties:{c:V1,b:{type:"array",items:{type:"number",minimum:0,maximum:255},minItems:4096,maxItems:4096,nullable:!0},rm:{type:"boolean",nullable:!0}},required:["c"],additionalProperties:!1};var uE={type:"array",items:{...mE}};var m6={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 dE={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:{...m6,nullable:!0}},required:["n"],additionalProperties:!1};var cE={type:"array",items:[{type:"number"},{type:"number"},{type:"number"},{type:"number"}],minItems:4,maxItems:4};var lE={type:"object",properties:{i:{type:"number"},al:{type:"array",items:{type:"string"},nullable:!0},ao:{type:"array",items:{type:"string"},nullable:!0},ap:{type:"number",nullable:!0},as:{type:"array",items:{type:"string"},nullable:!0},bh:{...V1,nullable:!0},bt:{type:"string",nullable:!0},h:{type:"array",items:{type:"string"},nullable:!0},m:{type:"string",nullable:!0},mo:{type:"array",items:{...dE},nullable:!0},mt:{type:"string",nullable:!0},n:{type:"string",nullable:!0},o:{type:"number",nullable:!0},p:{...V1,nullable:!0},pe:{type:"number",nullable:!0},pn:{type:"string",nullable:!0},r:{...cE,nullable:!0},rm:{type:"boolean",nullable:!0},s:{type:"number",nullable:!0},sn:{type:"array",items:{type:"string"},nullable:!0},t:{...m6,nullable:!0}},required:["i"],additionalProperties:!1};var pE={type:"array",items:{...lE}};var iE={type:"object",properties:{i:{type:"number"},a:{type:"number",nullable:!0},e:{type:"number",nullable:!0},c:{...m6,nullable:!0},d:{type:"number",nullable:!0},n:{type:"number",nullable:!0},o:{...V1,nullable:!0},p:{...V1,nullable:!0},pe:{type:"number",minimum:0,maximum:1,nullable:!0},rm:{type:"boolean",nullable:!0},t:{type:"number",nullable:!0},te:{type:"number",nullable:!0},tp:{...V1,nullable:!0}},required:["i"],additionalProperties:!1};var nE={type:"array",items:{...iE}};var aE={type:"object",properties:{i:{type:"number"},at:{type:"number",nullable:!0},b:{type:"number",nullable:!0},ce:{...m6,nullable:!0},cev:{...m6,nullable:!0},cs:{...m6,nullable:!0},csv:{...m6,nullable:!0},e:{type:"number",nullable:!0},en:{type:"string",nullable:!0},g:{...V1,nullable:!0},l:{type:"number",nullable:!0},lv:{type:"number",nullable:!0},mp:{type:"number",nullable:!0},o:{...V1,nullable:!0},oe:{type:"number",nullable:!0},oev:{type:"number",nullable:!0},os:{type:"number",nullable:!0},osv:{type:"number",nullable:!0},p:{...V1,nullable:!0},pa:{type:"boolean",nullable:!0},pv:{...V1,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:{...V1,nullable:!0},vv:{...V1,nullable:!0}},required:["i"],additionalProperties:!1};var sE={type:"array",items:{...aE}};var oE={type:"object",properties:{o:{...V1},d:{...V1},l:{type:"number"},h:{type:"boolean"}},required:["o","d","l","h"],additionalProperties:!1};var rE={type:"array",items:{...oE}};var tE={type:"object",properties:{v:{type:"array",items:{type:"number"}},c:{type:"array",items:{type:"number"}}},required:["v","c"],additionalProperties:!1};var eE={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 ZI={type:"array",items:{...eE}};var JI={type:"object",properties:{i:{type:"number"},e:{type:"number",nullable:!0},o:{...V1,nullable:!0},p:{...V1,nullable:!0},rm:{type:"boolean",nullable:!0},s:{type:"object",nullable:!0},t:{type:"string",nullable:!0},v:{type:"number",nullable:!0}},required:["i"],additionalProperties:!1};var XI={type:"array",items:{...JI}};var YI={type:"object",properties:{r:{type:"number"},s:{type:"number"},p:{type:"number"},n:{type:"number"}},required:["r","s","p","n"],additionalProperties:!1};var $I={type:"object",properties:{p:{type:"boolean",nullable:!0},u:{type:"string",nullable:!0}},additionalProperties:!1};var QI={type:"array",items:{...QH}};var X_1={type:"array",items:[{type:"boolean"},{type:"boolean"},{type:"boolean"}],minItems:3,maxItems:3};var WI={type:"object",properties:{i:{type:"number"},ac:{...m6,nullable:!0},ai:{type:"number",nullable:!0},dc:{...m6,nullable:!0},di:{type:"number",nullable:!0},dp:{...V1,nullable:!0},fc:{...m6,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 B80=S0(40,yE);var L80=S0(36,gE);var j80=S0(37,uE);var O80=S0(38,pE);var M80=S0(44,nE);var R80=S0(46,sE);var N80=S0(192,tE);var D80=S0(193,rE);var P80=S0(45,ZI);var C80=S0(43,XI);var T80=S0(32,YI);var k80=S0(41,$I);var E80=S0(42,QI);var I80=S0(39,WI);var qL=new Map,Y_1={...zL,...HL,...VL};for(let Z of Object.values(Y_1))if("id"in Z&&"schema"in Z){let J=Z;if(qL.has(J.id))throw new Error(`Packet with id ${J.id} is already registered.`);qL.set(J.id,J)}function $_1(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=qL.get(Z[0]);return!!J&&J.validate(Z[1])}var Q0=KI;var Z60=e(t80(),1);import D$ from"fs";import e80 from"path";var KH="./dev/persistence";class b7{static instance=new b7;gameId=process.env.HYTOPIA_GAME_ID;lobbyId=process.env.HYTOPIA_LOBBY_ID;_creativeGateway;constructor(){try{this._creativeGateway=new Z60.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(`
404
+ >>> 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 wi(this.pattern,this.options)}parse(Z){cG(Z);let J=this.options;if(Z==="**")return M6;if(Z==="")return"";let X,Y=null;if(X=Z.match(c21))Y=J.dot?p21:l21;else if(X=Z.match(A21))Y=(J.nocase?J.dot?b21:f21:J.dot?h21:x21)(X[1]);else if(X=Z.match(i21))Y=(J.nocase?J.dot?a21:n21:J.dot?s21:o21)(X);else if(X=Z.match(y21))Y=J.dot?m21:g21;else if(X=Z.match(u21))Y=d21;let $=O6.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?e21:J.dot?Zw1:Jw1,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"?Ww1(z):z===M6?M6:z._src});return G.forEach((z,H)=>{let V=G[H+1],q=G[H-1];if(z!==M6||q===M6)return;if(q===void 0)if(V!==void 0&&V!==M6)G[H+1]="(?:\\/|"+X+"\\/)?"+V;else G[H]=X;else if(V===void 0)G[H-1]=q+"(?:\\/|"+X+")?";else if(V!==M6)G[H-1]=q+"(?:\\/|\\/"+X+"\\/)"+V,G[H+1]=M6}),G.filter((z)=>z!==M6).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 Z5.defaults(Z).Minimatch}}Z5.AST=O6;Z5.Minimatch=b9;Z5.escape=MW;Z5.unescape=h4;import{fileURLToPath as yw1}from"url";var RW=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,Li=new Set,BC=typeof process==="object"&&!!process?process:{},ji=(Z,J,X,Y)=>{typeof BC.emitWarning==="function"?BC.emitWarning(Z,J,X,Y):console.error(`[${X}] ${J}: ${Z}`)},e2=globalThis.AbortController,Bi=globalThis.AbortSignal;if(typeof e2==="undefined"){Bi=class X{onabort;_onabort=[];reason;aborted=!1;addEventListener(Y,$){this._onabort.push($)}},e2=class X{constructor(){J()}signal=new Bi;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=BC.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",J=()=>{if(!Z)return;Z=!1,ji("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 Kw1=(Z)=>!Li.has(Z),$w6=Symbol("type"),ZX=(Z)=>Z&&Z===Math.floor(Z)&&Z>0&&isFinite(Z),Oi=(Z)=>!ZX(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?pG:null;class pG extends Array{constructor(Z){super(Z);this.fill(0)}}class NW{heap;length;static#Z=!1;static create(Z){let J=Oi(Z);if(!J)return[];NW.#Z=!0;let X=new NW(Z,J);return NW.#Z=!1,X}constructor(Z,J){if(!NW.#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 iG{#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;#j;#k;#O;#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.#j},free:Z.#k,isBackgroundFetch:(J)=>Z.#F(J),backgroundFetch:(J,X,Y,$)=>Z.#h(J,X,Y,$),moveToTail:(J)=>Z.#y(J),indexes:(J)=>Z.#T(J),rindexes:(J)=>Z.#I(J),isStale:(J)=>Z.#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:j,noDeleteOnFetchRejection:N,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:P,ignoreFetchAbort:D}=Z;if(J!==0&&!ZX(J))throw new TypeError("max option must be a nonnegative integer");let C=J?Oi(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(j!==void 0&&typeof j!=="function")throw new TypeError("memoMethod must be a function if defined");if(this.#q=j,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.#j=0,this.#k=NW.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.#O=[];else this.#$=void 0,this.#O=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=!!O,this.allowStaleOnFetchAbort=!!P,this.ignoreFetchAbort=!!D,this.maxEntrySize!==0){if(this.#J!==0){if(!ZX(this.#J))throw new TypeError("maxSize must be a positive integer if specified")}if(!ZX(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=ZX(Y)||Y===0?Y:1,this.ttlAutopurge=!!$,this.ttl=X||0,this.ttl){if(!ZX(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(Kw1("LRU_CACHE_UNBOUNDED"))Li.add("LRU_CACHE_UNBOUNDED"),ji("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",iG)}}getRemainingTTL(Z){return this.#z.has(Z)?1/0:0}#W(){let Z=new pG(this.#Z),J=new pG(this.#Z);this.#R=Z,this.#N=J,this.#S=($,Q,W=RW.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.#A=($)=>{J[$]=Z[$]!==0?RW.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 $=RW.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}}#A=()=>{};#D=()=>{};#S=()=>{};#P=()=>!1;#m(){let Z=new pG(this.#Z);this.#G=0,this.#E=Z,this.#x=(J)=>{this.#G-=Z[J],Z[J]=0},this.#u=(J,X,Y,$)=>{if(this.#F(X))return 0;if(!ZX(Y))if($){if(typeof $!=="function")throw new TypeError("sizeCalculation must be a function");if(Y=$(X,J),!ZX(Y))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return Y},this.#f=(J,X,Y)=>{if(Z[J]=X,this.#J){let $=this.#J-Z[J];while(this.#G>$)this.#b(!0)}if(this.#G+=Z[J],Y)Y.entrySize=X,Y.totalCalculatedSize=this.#G}}#x=(Z)=>{};#f=(Z,J,X)=>{};#u=(Z,J,X,Y)=>{if(X||Y)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:Z=this.allowStale}={}){if(this.#K)for(let J=this.#j;;){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.#j)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-(RW.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=RW.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=RW.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.#j: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.#j]=H,this.#B[H]=this.#j,this.#j=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.#O?.push([q,Z,"set"])}}else if(!Q){if(this.#M)this.#Y?.(V,Z,"set");if(this.#L)this.#O?.push([V,Z,"set"])}if(this.#x(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.#O){let V=this.#O,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.#O){let Z=this.#O,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.#O?.push([Y,X,"evict"])}if(this.#x(J),Z)this.#V[J]=void 0,this.#Q[J]=void 0,this.#k.push(J);if(this.#K===1)this.#w=this.#j=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.#A($);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 e2,{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,j=X.ignoreFetchAbort&&U!==void 0;if(X.status)if(w&&!B){if(X.status.fetchAborted=!0,X.status.fetchError=Q.signal.reason,j)X.status.fetchAbortIgnored=!0}else X.status.fetchResolved=!0;if(w&&!j&&!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,j=w||X.allowStaleOnFetchRejection,N=j||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(j){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((j)=>U(j===void 0?void 0:j),B);Q.signal.addEventListener("abort",()=>{if(!X.ignoreFetchAbort||X.allowStaleOnFetchAbort){if(U(void 0),X.allowStaleOnFetchAbort)U=(j)=>G(j,!0)}})};if(X.status)X.status.fetchDispatched=!0;let q=new Promise(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 e2}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:j}=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:j},R=this.#z.get(Z);if(R===void 0){if(w)w.fetch="miss";let O=this.#h(Z,R,N,U);return O.__returned=O}else{let O=this.#Q[R];if(this.#F(O)){let k=X&&O.__staleWhileFetching!==void 0;if(w){if(w.fetch="inflight",k)w.returnedStale=!0}return k?O.__staleWhileFetching:O.__returned=O}let P=this.#P(R);if(!B&&!P){if(w)w.fetch="hit";if(this.#y(R),Y)this.#A(R);if(w)this.#D(w,R);return O}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.#A(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.#j){if(Z===this.#w)this.#w=this.#U[Z];else this.#c(this.#B[Z],this.#U[Z]);this.#c(this.#j,Z),this.#j=Z}}delete(Z){return this.#_(Z,"delete")}#_(Z,J){let X=!1;if(this.#K!==0){let Y=this.#z.get(Z);if(Y!==void 0)if(X=!0,this.#K===1)this.#g(J);else{this.#x(Y);let $=this.#Q[Y];if(this.#F($))$.__abortController.abort(new Error("deleted"));else if(this.#M||this.#L){if(this.#M)this.#Y?.($,Z,J);if(this.#L)this.#O?.push([$,Z,J])}if(this.#z.delete(Z),this.#V[Y]=void 0,this.#Q[Y]=void 0,Y===this.#j)this.#j=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.#O?.length){let Y=this.#O,$;while($=Y?.shift())this.#$?.(...$)}return X}clear(){return this.#g("delete")}#g(Z){for(let J of this.#I({allowStale:!0})){let X=this.#Q[J];if(this.#F(X))X.__abortController.abort(new Error("deleted"));else{let Y=this.#V[J];if(this.#M)this.#Y?.(X,Y,Z);if(this.#L)this.#O?.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.#j=0,this.#k.length=0,this.#G=0,this.#K=0,this.#L&&this.#O){let J=this.#O,X;while(X=J?.shift())this.#$?.(...X)}}}import{posix as jw1,win32 as TC}from"path";import{fileURLToPath as Ow1}from"url";import{lstatSync as Mw1,readdir as Rw1,readdirSync as Nw1,readlinkSync as Dw1,realpathSync as Pw1}from"fs";import*as Cw1 from"fs";import{lstat as kw1,readdir as Ew1,readlink as Iw1,realpath as vw1}from"fs/promises";import{EventEmitter as NC}from"events";import Pi from"stream";import{StringDecoder as Gw1}from"string_decoder";var Mi=typeof process==="object"&&process?process:{stdout:null,stderr:null},zw1=(Z)=>!!Z&&typeof Z==="object"&&(Z instanceof $$||Z instanceof Pi||Hw1(Z)||Vw1(Z)),Hw1=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof NC&&typeof Z.pipe==="function"&&Z.pipe!==Pi.Writable.prototype.pipe,Vw1=(Z)=>!!Z&&typeof Z==="object"&&Z instanceof NC&&typeof Z.write==="function"&&typeof Z.end==="function",SZ=Symbol("EOF"),_Z=Symbol("maybeEmitEnd"),JX=Symbol("emittedEnd"),Zw=Symbol("emittingEnd"),nG=Symbol("emittedError"),Jw=Symbol("closed"),Ri=Symbol("read"),Xw=Symbol("flush"),Ni=Symbol("flushChunk"),f4=Symbol("encoding"),DW=Symbol("decoder"),X6=Symbol("flowing"),aG=Symbol("paused"),PW=Symbol("resume"),Y6=Symbol("buffer"),J5=Symbol("pipes"),$6=Symbol("bufferLength"),LC=Symbol("bufferPush"),Yw=Symbol("bufferShift"),_6=Symbol("objectMode"),k8=Symbol("destroyed"),jC=Symbol("error"),OC=Symbol("emitData"),Di=Symbol("emitEnd"),MC=Symbol("emitEnd2"),P7=Symbol("async"),RC=Symbol("abort"),$w=Symbol("aborted"),sG=Symbol("signal"),Y$=Symbol("dataListeners"),$9=Symbol("discarded"),oG=(Z)=>Promise.resolve().then(Z),qw1=(Z)=>Z(),Fw1=(Z)=>Z==="end"||Z==="finish"||Z==="prefinish",Uw1=(Z)=>Z instanceof ArrayBuffer||!!Z&&typeof Z==="object"&&Z.constructor&&Z.constructor.name==="ArrayBuffer"&&Z.byteLength>=0,ww1=(Z)=>!Buffer.isBuffer(Z)&&ArrayBuffer.isView(Z);class DC{src;dest;opts;ondrain;constructor(Z,J,X){this.src=Z,this.dest=J,this.opts=X,this.ondrain=()=>Z[PW](),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 Ci extends DC{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 Bw1=(Z)=>!!Z.objectMode,Lw1=(Z)=>!Z.objectMode&&!!Z.encoding&&Z.encoding!=="buffer";class $$ extends NC{[X6]=!1;[aG]=!1;[J5]=[];[Y6]=[];[_6];[f4];[P7];[DW];[SZ]=!1;[JX]=!1;[Zw]=!1;[Jw]=!1;[nG]=null;[$6]=0;[k8]=!1;[sG];[$w]=!1;[Y$]=0;[$9]=!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(Bw1(J))this[_6]=!0,this[f4]=null;else if(Lw1(J))this[f4]=J.encoding,this[_6]=!1;else this[_6]=!1,this[f4]=null;if(this[P7]=!!J.async,this[DW]=this[f4]?new Gw1(this[f4]):null,J&&J.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[Y6]});if(J&&J.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[J5]});let{signal:X}=J;if(X)if(this[sG]=X,X.aborted)this[RC]();else X.addEventListener("abort",()=>this[RC]())}get bufferLength(){return this[$6]}get encoding(){return this[f4]}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[_6]}set objectMode(Z){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[P7]}set["async"](Z){this[P7]=this[P7]||!!Z}[RC](){this[$w]=!0,this.emit("abort",this[sG]?.reason),this.destroy(this[sG]?.reason)}get aborted(){return this[$w]}set aborted(Z){}write(Z,J,X){if(this[$w])return!1;if(this[SZ])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[P7]?oG:qw1;if(!this[_6]&&!Buffer.isBuffer(Z)){if(ww1(Z))Z=Buffer.from(Z.buffer,Z.byteOffset,Z.byteLength);else if(Uw1(Z))Z=Buffer.from(Z);else if(typeof Z!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[_6]){if(this[X6]&&this[$6]!==0)this[Xw](!0);if(this[X6])this.emit("data",Z);else this[LC](Z);if(this[$6]!==0)this.emit("readable");if(X)Y(X);return this[X6]}if(!Z.length){if(this[$6]!==0)this.emit("readable");if(X)Y(X);return this[X6]}if(typeof Z==="string"&&!(J===this[f4]&&!this[DW]?.lastNeed))Z=Buffer.from(Z,J);if(Buffer.isBuffer(Z)&&this[f4])Z=this[DW].write(Z);if(this[X6]&&this[$6]!==0)this[Xw](!0);if(this[X6])this.emit("data",Z);else this[LC](Z);if(this[$6]!==0)this.emit("readable");if(X)Y(X);return this[X6]}read(Z){if(this[k8])return null;if(this[$9]=!1,this[$6]===0||Z===0||Z&&Z>this[$6])return this[_Z](),null;if(this[_6])Z=null;if(this[Y6].length>1&&!this[_6])this[Y6]=[this[f4]?this[Y6].join(""):Buffer.concat(this[Y6],this[$6])];let J=this[Ri](Z||null,this[Y6][0]);return this[_Z](),J}[Ri](Z,J){if(this[_6])this[Yw]();else{let X=J;if(Z===X.length||Z===null)this[Yw]();else if(typeof X==="string")this[Y6][0]=X.slice(Z),J=X.slice(0,Z),this[$6]-=Z;else this[Y6][0]=X.subarray(Z),J=X.subarray(0,Z),this[$6]-=Z}if(this.emit("data",J),!this[Y6].length&&!this[SZ])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[SZ]=!0,this.writable=!1,this[X6]||!this[aG])this[_Z]();return this}[PW](){if(this[k8])return;if(!this[Y$]&&!this[J5].length)this[$9]=!0;if(this[aG]=!1,this[X6]=!0,this.emit("resume"),this[Y6].length)this[Xw]();else if(this[SZ])this[_Z]();else this.emit("drain")}resume(){return this[PW]()}pause(){this[X6]=!1,this[aG]=!0,this[$9]=!1}get destroyed(){return this[k8]}get flowing(){return this[X6]}get paused(){return this[aG]}[LC](Z){if(this[_6])this[$6]+=1;else this[$6]+=Z.length;this[Y6].push(Z)}[Yw](){if(this[_6])this[$6]-=1;else this[$6]-=this[Y6][0].length;return this[Y6].shift()}[Xw](Z=!1){do;while(this[Ni](this[Yw]())&&this[Y6].length);if(!Z&&!this[Y6].length&&!this[SZ])this.emit("drain")}[Ni](Z){return this.emit("data",Z),this[X6]}pipe(Z,J){if(this[k8])return Z;this[$9]=!1;let X=this[JX];if(J=J||{},Z===Mi.stdout||Z===Mi.stderr)J.end=!1;else J.end=J.end!==!1;if(J.proxyErrors=!!J.proxyErrors,X){if(J.end)Z.end()}else if(this[J5].push(!J.proxyErrors?new DC(this,Z,J):new Ci(this,Z,J)),this[P7])oG(()=>this[PW]());else this[PW]();return Z}unpipe(Z){let J=this[J5].find((X)=>X.dest===Z);if(J){if(this[J5].length===1){if(this[X6]&&this[Y$]===0)this[X6]=!1;this[J5]=[]}else this[J5].splice(this[J5].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[$9]=!1,this[Y$]++,!this[J5].length&&!this[X6])this[PW]()}else if(Z==="readable"&&this[$6]!==0)super.emit("readable");else if(Fw1(Z)&&this[JX])super.emit(Z),this.removeAllListeners(Z);else if(Z==="error"&&this[nG]){let Y=J;if(this[P7])oG(()=>Y.call(this,this[nG]));else Y.call(this,this[nG])}return X}removeListener(Z,J){return this.off(Z,J)}off(Z,J){let X=super.off(Z,J);if(Z==="data"){if(this[Y$]=this.listeners("data").length,this[Y$]===0&&!this[$9]&&!this[J5].length)this[X6]=!1}return X}removeAllListeners(Z){let J=super.removeAllListeners(Z);if(Z==="data"||Z===void 0){if(this[Y$]=0,!this[$9]&&!this[J5].length)this[X6]=!1}return J}get emittedEnd(){return this[JX]}[_Z](){if(!this[Zw]&&!this[JX]&&!this[k8]&&this[Y6].length===0&&this[SZ]){if(this[Zw]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Jw])this.emit("close");this[Zw]=!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[_6]&&!X?!1:this[P7]?(oG(()=>this[OC](X)),!0):this[OC](X);else if(Z==="end")return this[Di]();else if(Z==="close"){if(this[Jw]=!0,!this[JX]&&!this[k8])return!1;let $=super.emit("close");return this.removeAllListeners("close"),$}else if(Z==="error"){this[nG]=X,super.emit(jC,X);let $=!this[sG]||this.listeners("error").length?super.emit("error",X):!1;return this[_Z](),$}else if(Z==="resume"){let $=super.emit("resume");return this[_Z](),$}else if(Z==="finish"||Z==="prefinish"){let $=super.emit(Z);return this.removeAllListeners(Z),$}let Y=super.emit(Z,...J);return this[_Z](),Y}[OC](Z){for(let X of this[J5])if(X.dest.write(Z)===!1)this.pause();let J=this[$9]?!1:super.emit("data",Z);return this[_Z](),J}[Di](){if(this[JX])return!1;return this[JX]=!0,this.readable=!1,this[P7]?(oG(()=>this[MC]()),!0):this[MC]()}[MC](){if(this[DW]){let J=this[DW].end();if(J){for(let X of this[J5])X.dest.write(J);if(!this[$9])super.emit("data",J)}}for(let J of this[J5])J.end();let Z=super.emit("end");return this.removeAllListeners("end"),Z}async collect(){let Z=Object.assign([],{dataLength:0});if(!this[_6])Z.dataLength=0;let J=this.promise();return this.on("data",(X)=>{if(Z.push(X),!this[_6])Z.dataLength+=X.length}),await J,Z}async concat(){if(this[_6])throw new Error("cannot concat in objectMode");let Z=await this.collect();return this[f4]?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[$9]=!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[SZ])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[SZ]})},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[$9]=!1;let Z=!1,J=()=>{return this.pause(),this.off(jC,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(jC,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[$9]=!0,this[Y6].length=0,this[$6]=0;let J=this;if(typeof J.close==="function"&&!this[Jw])J.close();if(Z)this.emit("error",Z);else this.emit(k8);return this}static get isStream(){return zw1}}var Tw1=Pw1.native,tG={lstatSync:Mw1,readdir:Rw1,readdirSync:Nw1,readlinkSync:Dw1,realpathSync:Tw1,promises:{lstat:kw1,readdir:Ew1,readlink:Iw1,realpath:vw1}},vi=(Z)=>!Z||Z===tG||Z===Cw1?tG:{...tG,...Z,promises:{...tG.promises,...Z.promises||{}}},Si=/^\\\\\?\\([a-z]:)\\?$/i,Sw1=(Z)=>Z.replace(/\//g,"\\").replace(Si,"$1\\"),_w1=/[\\\/]/,g9=0,_i=1,Ai=2,C7=4,xi=6,hi=8,Q$=10,fi=12,y9=15,rG=~y9,PC=16,Ti=32,eG=64,b4=128,Qw=256,Kw=512,ki=eG|b4|Kw,Aw1=1023,CC=(Z)=>Z.isFile()?hi:Z.isDirectory()?C7:Z.isSymbolicLink()?Q$:Z.isCharacterDevice()?Ai:Z.isBlockDevice()?xi:Z.isSocket()?fi:Z.isFIFO()?_i:g9,Ei=new Map,Zz=(Z)=>{let J=Ei.get(Z);if(J)return J;let X=Z.normalize("NFKD");return Ei.set(Z,X),X},Ii=new Map,Ww=(Z)=>{let J=Ii.get(Z);if(J)return J;let X=Zz(Z.toLowerCase());return Ii.set(Z,X),X};class kC extends iG{constructor(){super({max:256})}}class bi extends iG{constructor(Z=16384){super({maxSize:Z,sizeCalculation:(J)=>J.length+1})}}var yi=Symbol("PathScurry setAsCwd");class X5{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}#j;get atime(){return this.#j}#k;get mtime(){return this.#k}#O;get ctime(){return this.#O}#E;get birthtime(){return this.#E}#N;#R;#M;#C;#L;#v;#W;#A;#D;#S;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Z,J=g9,X,Y,$,Q,W){if(this.name=Z,this.#N=$?Ww(Z):Zz(Z),this.#W=J&Aw1,this.nocase=$,this.roots=Y,this.root=X||this,this.#A=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=vi(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.#A}resolve(Z){if(!Z)return this;let J=this.getRootString(Z),Y=Z.substring(J.length).split(this.splitSep);return J?this.getRoot(J).#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.#A.get(this);if(Z)return Z;let J=Object.assign([],{provisional:0});return this.#A.set(this,J),this.#W&=~PC,J}child(Z,J){if(Z===""||Z===".")return this;if(Z==="..")return this.parent||this;let X=this.children(),Y=this.nocase?Ww(Z):Zz(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,g9,{...J,parent:this,fullpath:Q});if(!this.canReaddir())W.#W|=b4;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&y9)===g9}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&y9)===hi}isDirectory(){return(this.#W&y9)===C7}isCharacterDevice(){return(this.#W&y9)===Ai}isBlockDevice(){return(this.#W&y9)===xi}isFIFO(){return(this.#W&y9)===_i}isSocket(){return(this.#W&y9)===fi}isSymbolicLink(){return(this.#W&Q$)===Q$}lstatCached(){return this.#W&Ti?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&y9;return!(Z!==g9&&Z!==Q$||this.#W&Qw||this.#W&b4)}calledReaddir(){return!!(this.#W&PC)}isENOENT(){return!!(this.#W&b4)}isNamed(Z){return!this.nocase?this.#N===Zz(Z):this.#N===Ww(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|=PC;for(let J=Z.provisional;J<Z.length;J++){let X=Z[J];if(X)X.#x()}}#x(){if(this.#W&b4)return;this.#W=(this.#W|b4)&rG,this.#f()}#f(){let Z=this.children();Z.provisional=0;for(let J of Z)J.#x()}#u(){this.#W|=Kw,this.#T()}#T(){if(this.#W&eG)return;let Z=this.#W;if((Z&y9)===C7)Z&=rG;this.#W=Z|eG,this.#f()}#I(Z=""){if(Z==="ENOTDIR"||Z==="EPERM")this.#T();else if(Z==="ENOENT")this.#x();else this.children().provisional=0}#d(Z=""){if(Z==="ENOTDIR")this.parent.#T();else if(Z==="ENOENT")this.#x()}#b(Z=""){let J=this.#W;if(J|=Qw,Z==="ENOENT")J|=b4;if(Z==="EINVAL"||Z==="UNKNOWN")J&=rG;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=CC(Z),Y=this.newChild(Z.name,X,{parent:this}),$=Y.#W&y9;if($!==C7&&$!==Q$&&$!==g9)Y.#W|=eG;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?Ww(Z.name):Zz(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&rG|CC(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&b4)===0)try{return this.#_(await this.#Z.promises.lstat(this.fullpath())),this}catch(Z){this.#d(Z.code)}}lstatSync(){if((this.#W&b4)===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:j,uid:N}=Z;this.#j=J,this.#Q=X,this.#E=Y,this.#w=$,this.#K=Q,this.#V=W,this.#O=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=j,this.#$=N;let R=CC(Z);if(this.#W=this.#W&rG|R|Ti,R!==g9&&R!==C7&&R!==Q$)this.#W|=eG}#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&ki)return!1;let Z=y9&this.#W;if(!(Z===g9||Z===C7||Z===Q$))return!1;return!0}shouldWalk(Z,J){return(this.#W&C7)===C7&&!(this.#W&ki)&&!Z.has(this)&&(!J||J(this))}async realpath(){if(this.#S)return this.#S;if((Kw|Qw|b4)&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((Kw|Qw|b4)&this.#W)return;try{let Z=this.#Z.realpathSync(this.fullpath());return this.#S=this.resolve(Z)}catch(Z){this.#u()}}[yi](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 Gw extends X5{sep="\\";splitSep=_w1;constructor(Z,J=g9,X,Y,$,Q,W){super(Z,J,X,Y,$,Q,W)}newChild(Z,J=g9,X={}){return new Gw(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),X)}getRootString(Z){return TC.parse(Z).root}getRoot(Z){if(Z=Sw1(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 Jz(Z,this).root}sameRoot(Z,J=this.root.name){return Z=Z.toUpperCase().replace(/\//g,"\\").replace(Si,"$1\\"),Z===J}}class zw extends X5{splitSep="/";sep="/";constructor(Z,J=g9,X,Y,$,Q,W){super(Z,J,X,Y,$,Q,W)}getRootString(Z){return Z.startsWith("/")?"/":""}getRoot(Z){return this.root}newChild(Z,J=g9,X={}){return new zw(Z,J,this.root,this.roots,this.nocase,this.childrenCache(),X)}}class EC{root;rootPath;roots;cwd;#Z;#J;#Y;nocase;#X;constructor(Z=process.cwd(),J,X,{nocase:Y,childrenCacheSize:$=16384,fs:Q=tG}={}){if(this.#X=vi(Q),Z instanceof URL||Z.startsWith("file://"))Z=Ow1(Z);let W=J.resolve(Z);this.roots=Object.create(null),this.rootPath=this.parseRootPath(W),this.#Z=new kC,this.#J=new kC,this.#Y=new bi($);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 X5))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 X5))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 X5))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 X5))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 X5))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 X5))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 X5))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((j)=>j?.isUnknown()?j.lstat():j).then((j)=>j?.shouldWalk(K,Q)?G(j,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 X5))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 X5))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 X5))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 X5))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,W=new $$({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,j=!1)=>{if(B)return W.emit("error",B);if(Y&&!j){let N=[];for(let R of w)if(R.isSymbolicLink())N.push(R.realpath().then((O)=>O?.isUnknown()?O.lstat():O));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 X5))J=Z,Z=this.cwd;let{withFileTypes:X=!0,follow:Y=!1,filter:$,walkFilter:Q}=J,W=new $$({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[yi](J)}}class Jz extends EC{sep="\\";constructor(Z=process.cwd(),J={}){let{nocase:X=!0}=J;super(Z,TC,"\\",{...J,nocase:X});this.nocase=X;for(let Y=this.cwd;Y;Y=Y.parent)Y.nocase=this.nocase}parseRootPath(Z){return TC.parse(Z).root.toUpperCase()}newRoot(Z){return new Gw(this.rootPath,C7,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")||Z.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Z)}}class Xz extends EC{sep="/";constructor(Z=process.cwd(),J={}){let{nocase:X=!1}=J;super(Z,jw1,"/",{...J,nocase:X});this.nocase=X}parseRootPath(Z){return"/"}newRoot(Z){return new zw(this.rootPath,C7,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Z})}isAbsolute(Z){return Z.startsWith("/")}}class Hw extends Xz{constructor(Z=process.cwd(),J={}){let{nocase:X=!0}=J;super(Z,{...J,nocase:X})}}var Bw6=process.platform==="win32"?Gw:zw,gi=process.platform==="win32"?Jz:process.platform==="darwin"?Hw:Xz;var xw1=(Z)=>Z.length>=1,hw1=(Z)=>Z.length>=1;class CW{#Z;#J;#Y;length;#X;#$;#H;#q;#K;#G;#z=!0;constructor(Z,J,X,Y){if(!xw1(Z))throw new TypeError("empty pattern list");if(!hw1(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]===M6}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 CW(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 fw1=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class Yz{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Z,{nobrace:J,nocase:X,noext:Y,noglobstar:$,platform:Q=fw1}){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 b9(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 CW(Y,$,0,this.platform),W=new b9(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 IC{store;constructor(Z=new Map){this.store=Z}copy(){return new IC(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 mi{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 ui{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 $z{hasWalkedCache;matches=new mi;subwalks=new ui;patterns;follow;dot;opts;constructor(Z,J){this.opts=Z,this.follow=!!Z.follow,this.dot=!!Z.dot,this.hasWalkedCache=J?J.copy():new IC}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===M6){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 $z(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===M6)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 bw1=(Z,J)=>typeof Z==="string"?new Yz([Z],J):Array.isArray(Z)?new Yz(Z,J):Z;class vC{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=bw1(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 $z(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 $z(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 Vw extends vC{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 qw extends vC{results;constructor(Z,J,X){super(Z,J,X);this.results=new $$({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 gw1=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class T7{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=yw1(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||gw1,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"?Jz:J.platform==="darwin"?Hw:J.platform?Xz:gi;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 b9(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 CW(K,z,0,this.platform)})}async walk(){return[...await new Vw(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 Vw(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 qw(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 qw(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 SC=(Z,J={})=>{if(!Array.isArray(Z))Z=[Z];for(let X of Z)if(new b9(X,J).hasMagic())return!0;return!1};function Uw(Z,J={}){return new T7(Z,J).streamSync()}function ci(Z,J={}){return new T7(Z,J).stream()}function li(Z,J={}){return new T7(Z,J).walkSync()}async function di(Z,J={}){return new T7(Z,J).walk()}function ww(Z,J={}){return new T7(Z,J).iterateSync()}function pi(Z,J={}){return new T7(Z,J).iterate()}var mw1=Uw,uw1=Object.assign(ci,{sync:Uw}),dw1=ww,cw1=Object.assign(pi,{sync:ww}),lw1=Object.assign(li,{stream:Uw,iterate:ww}),Fw=Object.assign(di,{glob:di,globSync:li,sync:lw1,globStream:ci,stream:uw1,globStreamSync:Uw,streamSync:mw1,globIterate:pi,iterate:cw1,globIterateSync:ww,iterateSync:dw1,Glob:T7,hasMagic:SC,escape:MW,unescape:h4});Fw.glob=Fw;class _C{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 v5{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 TW extends _C{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 v5(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 Qz(){return Qz=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},Qz.apply(this,arguments)}class A6{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 I0{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 W8{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"),y4=Symbol("immutableKeys");class kW extends _C{constructor(Z){super();this._disposed=!1,this.graph=void 0,this[y0]=void 0,this[y4]=void 0,this.graph=Z,this[y4]=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 kW){let $=this.graph._createEdge(X,this,Y);this[y4].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 v5){let $=Y;if($.getChild()===Z)this.setRef(X,J,$.getAttributes())}else if(Y instanceof A6)for(let $ of Y.listRefsByChild(Z)){let Q=$.getAttributes();this.removeRef(X,Z),this.addRef(X,J,Q)}else if(Y instanceof I0){let $=Y.getRefByChild(Z);if($){let Q=$.getAttributes();this.removeRef(X,Z),this.addRef(X,J,Q)}}else if(Y instanceof W8)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[y4].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 A6)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 A6||J instanceof I0)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,Qz({},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 W8)return J;throw new Error(`Expected RefMap for attribute "${Z}"`)}dispatchEvent(Z){return super.dispatchEvent(Qz({},Z,{target:this})),this.graph.dispatchEvent(Qz({},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[y4].has(J))Z.getChild().dispose()}else if(this[y0][J]instanceof A6)this[y0][J].remove(Z);else if(this[y0][J]instanceof I0)this[y0][J].remove(Z);else if(this[y0][J]instanceof W8){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 ti="v4.1.1",Rw="@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 Nw;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(Nw||(Nw={}));var Q9;(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"})(Q9||(Q9={}));var Dw;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(Dw||(Dw={}));var AZ;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(AZ||(AZ={}));var $X={"5120":Int8Array,"5121":Uint8Array,"5122":Int16Array,"5123":Uint16Array,"5125":Uint32Array,"5126":Float32Array},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 pw1(){var Z=new xC(3);if(xC!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function AC(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function iw1(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=pw1();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 yC(Z){let J=ei(),X=Z.propertyType===s.NODE?[Z]:Z.listChildren();for(let Y of X)Y.traverse(($)=>{let Q=$.getMesh();if(!Q)return;let W=nw1(Q,$.getWorldMatrix());if(W.min.every(isFinite)&&W.max.every(isFinite))hC(W.min,J),hC(W.max,J)});return J}function nw1(Z,J){let X=ei();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=iw1(K,W,J),hC(K,X)}}return X}function hC(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 ei(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class a0{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 gC{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 Zn{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),aw1(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 Tw{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(a0.decodeText(Z.slice(12,16))===Tw.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}}Tw.PNG_FRIED_CHUNK_NAME="CgBI";class xZ{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}`}}xZ.impls={"image/jpeg":new Zn,"image/png":new Tw};function aw1(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 hZ{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 xZ.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 ii(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function W$(Z){if(ii(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let X=J.prototype;if(ii(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}var fC,Wz;(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"})(Wz||(Wz={}));class _5{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=_5.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=_5.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=_5.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=_5.Verbosity.ERROR)console.error(Z)}}fC=_5;_5.Verbosity=Wz;_5.DEFAULT_INSTANCE=new fC(fC.Verbosity.INFO);function sw1(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],j=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,O=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,A=H*B-V*U,v=H*w-q*U,x=V*w-q*B;return j*x-N*v+R*A+O*k-P*T+D*C}function ow1(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],j=J[14],N=J[15],R=X[0],O=X[1],P=X[2],D=X[3];return Z[0]=R*Y+O*K+P*V+D*B,Z[1]=R*$+O*G+P*q+D*w,Z[2]=R*Q+O*z+P*F+D*j,Z[3]=R*W+O*H+P*U+D*N,R=X[4],O=X[5],P=X[6],D=X[7],Z[4]=R*Y+O*K+P*V+D*B,Z[5]=R*$+O*G+P*q+D*w,Z[6]=R*Q+O*z+P*F+D*j,Z[7]=R*W+O*H+P*U+D*N,R=X[8],O=X[9],P=X[10],D=X[11],Z[8]=R*Y+O*K+P*V+D*B,Z[9]=R*$+O*G+P*q+D*w,Z[10]=R*Q+O*z+P*F+D*j,Z[11]=R*W+O*H+P*U+D*N,R=X[12],O=X[13],P=X[14],D=X[15],Z[12]=R*Y+O*K+P*V+D*B,Z[13]=R*$+O*G+P*q+D*w,Z[14]=R*Q+O*z+P*F+D*j,Z[15]=R*W+O*H+P*U+D*N,Z}function rw1(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 tw1(Z,J){var X=new xC(3);rw1(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 l0{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(l0.clamp(Z,0,1)*65535);case 5121:return Math.round(l0.clamp(Z,0,1)*255);case 5122:return Math.round(l0.clamp(Z,-1,1)*32767);case 5120:return Math.round(l0.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,X,Y){let $=AC([Z[0],Z[1],Z[2]]),Q=AC([Z[4],Z[5],Z[6]]),W=AC([Z[8],Z[9],Z[10]]);if(sw1(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,tw1(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,j=K*V,N=G*z,R=G*H,O=G*V,P=X[0],D=X[1],C=X[2];return $[0]=(1-(B+j))*P,$[1]=(F+O)*P,$[2]=(U-R)*P,$[3]=0,$[4]=(F-O)*D,$[5]=(1-(q+j))*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 ew1(Z,J){if(!!Z!==!!J)return!1;let X=Z.getChild(),Y=J.getChild();return X===Y||X.equals(Y)}function ZB1(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 JB1(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 Jn(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 Xn(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!W$(Z)||!W$(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(Pw(K)&&Pw(G)){if(!Jn(K,G))return!1}else if(W$(K)&&W$(G)){if(!Xn(K,G))return!1}else if(K!==G)return!1}return!0}function Pw(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var ni="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ",XB1=999,YB1=6,ai=new Set,$B1=function Z(){let J="";for(let X=0;X<YB1;X++)J+=ni.charAt(Math.floor(Math.random()*ni.length));return J},Yn=function Z(){for(let J=0;J<XB1;J++){let X=$B1();if(!ai.has(X))return ai.add(X),X}return""},si="https://null.example";class m9{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return hZ.basename(new URL(Z,si).pathname)}static extension(Z){return hZ.extension(new URL(Z,si).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)}}m9.DEFAULT_INIT={};m9.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;var YX=(Z)=>Z,QB1=new Set;class kw extends kW{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,YX)}copy(Z,J=YX){for(let X in this[y0]){let Y=this[y0][X];if(Y instanceof v5){if(!this[y4].has(X))Y.dispose()}else if(Y instanceof A6||Y instanceof I0)for(let $ of Y.values())$.dispose();else if(Y instanceof W8)for(let $ of Y.values())$.dispose()}for(let X in Z[y0]){let Y=this[y0][X],$=Z[y0][X];if($ instanceof v5)if(this[y4].has(X))Y.getChild().copy(J($.getChild()),J);else this.setRef(X,J($.getChild()),$.getAttributes());else if($ instanceof I0||$ instanceof A6)for(let Q of $.values())this.addRef(X,J(Q.getChild()),Q.getAttributes());else if($ instanceof W8)for(let Q of $.keys()){let W=$.get(Q);this.setRefMap(X,Q,J(W.getChild()),W.getAttributes())}else if(W$($))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=QB1){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 v5||$ instanceof v5){if(!ew1(Y,$))return!1}else if(Y instanceof I0||$ instanceof I0||Y instanceof A6||$ instanceof A6){if(!ZB1(Y,$))return!1}else if(Y instanceof W8||$ instanceof W8){if(!JB1(Y,$))return!1}else if(W$(Y)||W$($)){if(!Xn(Y,$))return!1}else if(Pw(Y)||Pw($)){if(!Jn(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 h6 extends kw{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new W8})}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 h6{init(){this.propertyType=s.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[$]=l0.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[$]=l0.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 l0.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]=l0.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]=l0.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]=l0.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?WB1(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 WB1(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 mC extends h6{init(){this.propertyType=s.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new I0,samplers:new I0})}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 K$ extends h6{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)}}K$.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class EW extends h6{init(){this.propertyType=s.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:EW.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:Q9.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:Q9.OTHER})}}EW.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class uC extends h6{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 G$ extends h6{init(){this.propertyType=s.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:G$.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)}}G$.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class IW extends kw{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}IW.EXTENSION_NAME=void 0;class S5 extends h6{init(){this.propertyType=s.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:S5.WrapMode.REPEAT,wrapT:S5.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)}}S5.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};S5.MagFilter={NEAREST:9728,LINEAR:9729};S5.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:Bw,G:Lw,B:jw,A:KB1}=Dw;class k7 extends h6{init(){this.propertyType=s.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:k7.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new S5(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new S5(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new S5(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new S5(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new S5(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:Bw|Lw|jw|KB1,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:Bw|Lw|jw,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:Bw|Lw|jw})}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:Bw})}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:Lw|jw})}}k7.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class Gz extends h6{init(){this.propertyType=s.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new I0})}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 Ew extends h6{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 I0})}copy(Z,J=YX){if(J===YX)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 l0.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 l0.decompose(Z,J,X,Y),this.set("translation",J).set("rotation",X).set("scale",Y)}getWorldTranslation(){let Z=[0,0,0];return l0.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return l0.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return l0.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())ow1(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 E8 extends h6{init(){this.propertyType=s.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:E8.Mode.TRIANGLES,material:null,indices:null,attributes:new W8,targets:new I0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:Q9.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:Q9.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 dC extends kw{init(){this.propertyType=s.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new W8})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:Q9.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function Y5(){return Y5=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},Y5.apply(null,arguments)}class vW extends h6{init(){this.propertyType=s.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new I0})}copy(Z,J=YX){if(J===YX)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 cC extends h6{init(){this.propertyType=s.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new I0})}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:Q9.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class z$ extends h6{init(){this.propertyType=s.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||xZ.extensionToMimeType(hZ.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=xZ.extensionToMimeType(hZ.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",a0.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return xZ.getSize(Z,this.getMimeType())}}class H$ extends h6{init(){this.propertyType=s.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${ti}`,version:"2.0"},defaultScene:null,accessors:new I0,animations:new I0,buffers:new I0,cameras:new I0,materials:new I0,meshes:new I0,nodes:new I0,scenes:new I0,skins:new I0,textures:new I0})}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=YX){if(J===YX)throw new Error("Root cannot be copied.");this.set("asset",Y5({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(Y5({},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 vW)this.addRef("scenes",Z);else if(Z instanceof Ew)this.addRef("nodes",Z);else if(Z instanceof G$)this.addRef("cameras",Z);else if(Z instanceof cC)this.addRef("skins",Z);else if(Z instanceof Gz)this.addRef("meshes",Z);else if(Z instanceof k7)this.addRef("materials",Z);else if(Z instanceof z$)this.addRef("textures",Z);else if(Z instanceof mC)this.addRef("animations",Z);else if(Z instanceof h0)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 x6{static fromGraph(Z){return x6._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new TW,this._root=new H$(this._graph),this._logger=_5.DEFAULT_INSTANCE,x6._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 vW(this._graph,Z)}createNode(Z=""){return new Ew(this._graph,Z)}createCamera(Z=""){return new G$(this._graph,Z)}createSkin(Z=""){return new cC(this._graph,Z)}createMesh(Z=""){return new Gz(this._graph,Z)}createPrimitive(){return new E8(this._graph)}createPrimitiveTarget(Z=""){return new dC(this._graph,Z)}createMaterial(Z=""){return new k7(this._graph,Z)}createTexture(Z=""){return new z$(this._graph,Z)}createAnimation(Z=""){return new mC(this._graph,Z)}createAnimationChannel(Z=""){return new K$(this._graph,Z)}createAnimationSampler(Z=""){return new EW(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 uC(this._graph,Z)}}x6._GRAPH_DOCUMENTS=new WeakMap;class $n{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 IW&&$.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}}$n.EXTENSION_NAME=void 0;class Qn{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 oi={logger:_5.DEFAULT_INSTANCE,extensions:[],dependencies:{}},GB1=new Set([s.BUFFER,s.TEXTURE,s.MATERIAL,s.MESH,s.PRIMITIVE,s.NODE,s.SCENE]);class Wn{static read(Z,J=oi){let X=Y5({},oi,J),{json:Y}=Z,$=new x6().setLogger(X.logger);this.validate(Z,X);let Q=new Qn(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(Y5({},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)=>!GB1.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(s.BUFFER)).forEach((D)=>D.preread(Q,s.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[Rw],A=D.byteOffset||0;Q.bufferViews[C]=a0.toView(k,A,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(Mw(D,Q)),T});let F=Y.images||[],U=Y.textures||[];$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(s.TEXTURE)).forEach((D)=>D.preread(Q,s.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],A=k.uri?Z.resources[k.uri]:Z.resources[Rw],v=T.byteOffset||0,x=T.byteLength,I=A.slice(v,v+x);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=hZ.extension(D.uri);C.setMimeType(xZ.extensionToMimeType(T))}return C}),$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(s.MATERIAL)).forEach((D)=>D.preread(Q,s.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,A=Q.textures[U[k.index].source];C.setBaseColorTexture(A),Q.setTextureInfo(C.getBaseColorTextureInfo(),k)}if(D.emissiveTexture!==void 0){let k=D.emissiveTexture,A=Q.textures[U[k.index].source];C.setEmissiveTexture(A),Q.setTextureInfo(C.getEmissiveTextureInfo(),k)}if(D.normalTexture!==void 0){let k=D.normalTexture,A=Q.textures[U[k.index].source];if(C.setNormalTexture(A),Q.setTextureInfo(C.getNormalTextureInfo(),k),D.normalTexture.scale!==void 0)C.setNormalScale(D.normalTexture.scale)}if(D.occlusionTexture!==void 0){let k=D.occlusionTexture,A=Q.textures[U[k.index].source];if(C.setOcclusionTexture(A),Q.setTextureInfo(C.getOcclusionTextureInfo(),k),D.occlusionTexture.strength!==void 0)C.setOcclusionStrength(D.occlusionTexture.strength)}if(T.metallicRoughnessTexture!==void 0){let k=T.metallicRoughnessTexture,A=Q.textures[U[k.index].source];C.setMetallicRoughnessTexture(A),Q.setTextureInfo(C.getMetallicRoughnessTextureInfo(),k)}return C}),$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(s.MESH)).forEach((D)=>D.preread(Q,s.MESH));let w=Y.meshes||[];$.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(s.PRIMITIVE)).forEach((D)=>D.preread(Q,s.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 A=$.createPrimitive();if(k.extras)A.setExtras(k.extras);if(k.material!==void 0)A.setMaterial(Q.materials[k.material]);if(k.mode!==void 0)A.setMode(k.mode);for(let[I,S]of Object.entries(k.attributes||{}))A.setAttribute(I,Q.accessors[S]);if(k.indices!==void 0)A.setIndices(Q.accessors[k.indices]);let v=D.extras&&D.extras.targetNames||[];(k.targets||[]).forEach((I,S)=>{let y=v[S]||S.toString(),m=$.createPrimitiveTarget(y);for(let[i,t]of Object.entries(I))m.setAttribute(i,Q.accessors[t]);A.addTarget(m)}),C.addPrimitive(A)}),C});let j=Y.cameras||[];Q.cameras=j.map((D)=>{let C=$.createCamera(D.name).setType(D.type);if(D.extras)C.setExtras(D.extras);if(D.type===G$.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(s.NODE)).forEach((D)=>D.preread(Q,s.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],A=[1,1,1];l0.decompose(D.matrix,T,k,A),C.setTranslation(T),C.setRotation(k),C.setScale(A)}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((A)=>T.addChild(Q.nodes[A])),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 O=Y.animations||[];Q.animations=O.map((D)=>{let C=$.createAnimation(D.name);if(D.extras)C.setExtras(D.extras);let k=(D.samplers||[]).map((v)=>{let x=$.createAnimationSampler().setInput(Q.accessors[v.input]).setOutput(Q.accessors[v.output]).setInterpolation(v.interpolation||EW.Interpolation.LINEAR);if(v.extras)x.setExtras(v.extras);return C.addSampler(x),x});return(D.channels||[]).forEach((v)=>{let x=$.createAnimationChannel().setSampler(k[v.sampler]).setTargetPath(v.target.path);if(v.target.node!==void 0)x.setTargetNode(Q.nodes[v.target.node]);if(v.extras)x.setExtras(v.extras);C.addChannel(x)}),C});let P=Y.scenes||[];if($.getRoot().listExtensionsUsed().filter((D)=>D.prereadTypes.includes(s.SCENE)).forEach((D)=>D.preread(Q,s.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,A=!D.bufferView&&!T.getArray();if(k||A)T.setSparse(!0).setArray(HB1(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 zB1(Z,J){let X=J.jsonDoc,Y=J.bufferViews[Z.bufferView],$=X.json.bufferViews[Z.bufferView],Q=$X[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 Mw(Z,J){let X=J.jsonDoc,Y=J.bufferViews[Z.bufferView],$=X.json.bufferViews[Z.bufferView],Q=$X[Z.componentType],W=h0.getElementSize(Z.type),K=Q.BYTES_PER_ELEMENT,G=W*K;if($.byteStride!==void 0&&$.byteStride!==G)return zB1(Z,J);let z=Y.byteOffset+(Z.byteOffset||0),H=Z.count*W*K;return new Q(Y.buffer.slice(z,z+H))}function HB1(Z,J){let X=$X[Z.componentType],Y=h0.getElementSize(Z.type),$;if(Z.bufferView!==void 0)$=Mw(Z,J);else $=new X(Z.count*Y);let Q=Z.sparse;if(!Q)return $;let W=Q.count,K=Y5({},Z,Q.indices,{count:W,type:"SCALAR"}),G=Y5({},Z,Q.values,{count:W}),z=Mw(K,J),H=Mw(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 Kz;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(Kz||(Kz={}));class XX{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)=>VB1(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===AZ.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=xZ.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 Q9.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 Q9.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}}XX.BufferViewTarget=Kz;XX.BufferViewUsage=Q9;XX.USAGE_TO_TARGET={[Q9.ARRAY_BUFFER]:Kz.ARRAY_BUFFER,[Q9.ELEMENT_ARRAY_BUFFER]:Kz.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 VB1(Z,J){let X=Z.getGraph().listParentEdges(J).find((Y)=>Y.getParent()!==Z.getRoot());return X?X.getName().replace(/texture$/i,""):""}var{BufferViewUsage:Ow}=XX,{UNSIGNED_INT:qB1,UNSIGNED_SHORT:FB1,UNSIGNED_BYTE:UB1}=h0.ComponentType,wB1=new Set([s.ACCESSOR,s.BUFFER,s.MATERIAL,s.MESH]);class Kn{static write(Z,J){let X=Z.getGraph(),Y=Z.getRoot(),$={asset:Y5({generator:`glTF-Transform ${ti}`},Y.getAsset()),extras:Y5({},Y.getExtras())},Q={json:$,resources:{}},W=new XX(Z,Q,J),K=J.logger||_5.DEFAULT_INSTANCE,G=new Set(J.extensions.map((w)=>w.EXTENSION_NAME)),z=Z.getRoot().listExtensionsUsed().filter((w)=>G.has(w.extensionName)).sort((w,j)=>w.extensionName>j.extensionName?1:-1),H=Z.getRoot().listExtensionsRequired().filter((w)=>G.has(w.extensionName)).sort((w,j)=>w.extensionName>j.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 j=w.prewriteTypes.filter((N)=>!wB1.has(N));if(j.length)K.warn(`Prewrite hooks for some types (${j.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,j,N,R){let O=[],P=0;for(let T of w){let k=W.createAccessorDef(T);k.bufferView=$.bufferViews.length;let A=T.getArray(),v=a0.pad(a0.toView(A));k.byteOffset=P,P+=v.byteLength,O.push(v),W.accessorIndexMap.set(T,$.accessors.length),$.accessors.push(k)}let D=a0.concat(O),C={buffer:j,byteOffset:N,byteLength:D.byteLength};if(R)C.target=R;return $.bufferViews.push(C),{buffers:O,byteLength:P}}function q(w,j,N){let R=w[0].getCount(),O=0;for(let k of w){let A=W.createAccessorDef(k);A.bufferView=$.bufferViews.length,A.byteOffset=O;let v=k.getElementSize(),x=k.getComponentSize();O+=a0.padNumber(v*x),W.accessorIndexMap.set(k,$.accessors.length),$.accessors.push(A)}let P=R*O,D=new ArrayBuffer(P),C=new DataView(D);for(let k=0;k<R;k++){let A=0;for(let v of w){let x=v.getElementSize(),I=v.getComponentSize(),S=v.getComponentType(),y=v.getArray();for(let m=0;m<x;m++){let i=k*O+A+m*I,t=y[k*x+m];switch(S){case h0.ComponentType.FLOAT:C.setFloat32(i,t,!0);break;case h0.ComponentType.BYTE:C.setInt8(i,t);break;case h0.ComponentType.SHORT:C.setInt16(i,t,!0);break;case h0.ComponentType.UNSIGNED_BYTE:C.setUint8(i,t);break;case h0.ComponentType.UNSIGNED_SHORT:C.setUint16(i,t,!0);break;case h0.ComponentType.UNSIGNED_INT:C.setUint32(i,t,!0);break;default:throw new Error("Unexpected component type: "+S)}}A+=a0.padNumber(x*I)}}let T={buffer:j,byteOffset:N,byteLength:P,byteStride:O,target:XX.BufferViewTarget.ARRAY_BUFFER};return $.bufferViews.push(T),{byteLength:P,buffers:[new Uint8Array(D)]}}function F(w,j,N){let R=[],O=0,P=new Map,D=-1/0,C=!1;for(let S of w){let y=W.createAccessorDef(S);$.accessors.push(y),W.accessorIndexMap.set(S,$.accessors.length-1);let m=[],i=[],t=[],Z0=new Array(S.getElementSize()).fill(0);for(let s0=0,b8=S.getCount();s0<b8;s0++){if(S.getElement(s0,t),l0.eq(t,Z0,0))continue;D=Math.max(s0,D),m.push(s0);for(let $8=0;$8<t.length;$8++)i.push(t[$8])}let W0=m.length,A0={accessorDef:y,count:W0};if(P.set(S,A0),W0===0)continue;if(W0>S.getCount()/2)C=!0;let x0=$X[S.getComponentType()];A0.indices=m,A0.values=new x0(i)}if(!Number.isFinite(D))return{buffers:R,byteLength:O};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?UB1:D<65535?FB1:qB1,A={buffer:j,byteOffset:N+O,byteLength:0};for(let S of w){let y=P.get(S);if(y.count===0)continue;y.indicesByteOffset=A.byteLength;let m=a0.pad(a0.toView(new T(y.indices)));R.push(m),O+=m.byteLength,A.byteLength+=m.byteLength}$.bufferViews.push(A);let v=$.bufferViews.length-1,x={buffer:j,byteOffset:N+O,byteLength:0};for(let S of w){let y=P.get(S);if(y.count===0)continue;y.valuesByteOffset=x.byteLength;let m=a0.pad(a0.toView(y.values));R.push(m),O+=m.byteLength,x.byteLength+=m.byteLength}$.bufferViews.push(x);let I=$.bufferViews.length-1;for(let S of w){let y=P.get(S);if(y.count===0)continue;y.accessorDef.sparse={count:y.count,indices:{bufferView:v,byteOffset:y.indicesByteOffset,componentType:k},values:{bufferView:I,byteOffset:y.valuesByteOffset}}}return{buffers:R,byteLength:O}}if($.accessors=[],$.bufferViews=[],$.samplers=[],$.textures=[],$.images=Y.listTextures().map((w,j)=>{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,j),N}),z.filter((w)=>w.prewriteTypes.includes(s.ACCESSOR)).forEach((w)=>w.prewrite(W,s.ACCESSOR)),Y.listAccessors().forEach((w)=>{let{accessorUsageGroupedByParent:j,accessorParents:N}=W;if(W.accessorIndexMap.has(w))return;let R=W.getAccessorUsage(w);if(W.addAccessorToUsageGroup(w,R),j.has(R)){let O=X.listParents(w).find((P)=>P.propertyType!==s.ROOT);N.set(w,O)}}),z.filter((w)=>w.prewriteTypes.includes(s.BUFFER)).forEach((w)=>w.prewrite(W,s.BUFFER)),(Y.listAccessors().length>0||W.otherBufferViews.size>0||Y.listTextures().length>0&&J.format===AZ.GLB)&&Y.listBuffers().length===0)throw new Error("Buffer required for Document resources, but none was found.");if($.buffers=[],Y.listBuffers().forEach((w,j)=>{let N=W.createPropertyDef(w),R=W.accessorUsageGroupedByParent,O=w.listParents().filter((x)=>x instanceof h0),P=new Set(O.map((x)=>W.accessorParents.get(x))),D=new Map(Array.from(P).map((x,I)=>[x,I])),C={};for(let x of O){var T;if(W.accessorIndexMap.has(x))continue;let I=W.getAccessorUsage(x),S=I;if(R.has(I)){let y=W.accessorParents.get(x);S+=`:${D.get(y)}`}C[T=S]||(C[T]={usage:I,accessors:[]}),C[S].accessors.push(x)}let k=[],A=$.buffers.length,v=0;for(let{usage:x,accessors:I}of Object.values(C))if(x===Ow.ARRAY_BUFFER&&J.vertexLayout===Nw.INTERLEAVED){let S=q(I,A,v);v+=S.byteLength;for(let y of S.buffers)k.push(y)}else if(x===Ow.ARRAY_BUFFER)for(let S of I){let y=q([S],A,v);v+=y.byteLength;for(let m of y.buffers)k.push(m)}else if(x===Ow.SPARSE){let S=F(I,A,v);v+=S.byteLength;for(let y of S.buffers)k.push(y)}else if(x===Ow.ELEMENT_ARRAY_BUFFER){let S=XX.BufferViewTarget.ELEMENT_ARRAY_BUFFER,y=V(I,A,v,S);v+=y.byteLength;for(let m of y.buffers)k.push(m)}else{let S=V(I,A,v);v+=S.byteLength;for(let y of S.buffers)k.push(y)}if(W.imageBufferViews.length&&j===0){for(let x=0;x<W.imageBufferViews.length;x++)if($.bufferViews[$.images[x].bufferView].byteOffset=v,v+=W.imageBufferViews[x].byteLength,k.push(W.imageBufferViews[x]),v%8){let I=8-v%8;v+=I,k.push(new Uint8Array(I))}}if(W.otherBufferViews.has(w))for(let x of W.otherBufferViews.get(w))$.bufferViews.push({buffer:A,byteOffset:v,byteLength:x.byteLength}),W.otherBufferViewsIndexMap.set(x,$.bufferViews.length-1),v+=x.byteLength,k.push(x);if(v){let x;if(J.format===AZ.GLB)x=Rw;else x=W.bufferURIGenerator.createURI(w,"bin"),N.uri=x;N.byteLength=v,W.assignResourceURI(x,a0.concat(k),!0)}$.buffers.push(N),W.bufferIndexMap.set(w,j)}),Y.listAccessors().find((w)=>!w.getBuffer()))K.warn("Skipped writing one or more Accessors: no Buffer assigned.");z.filter((w)=>w.prewriteTypes.includes(s.MATERIAL)).forEach((w)=>w.prewrite(W,s.MATERIAL)),$.materials=Y.listMaterials().map((w,j)=>{let N=W.createPropertyDef(w);if(w.getAlphaMode()!==k7.AlphaMode.OPAQUE)N.alphaMode=w.getAlphaMode();if(w.getAlphaMode()===k7.AlphaMode.MASK)N.alphaCutoff=w.getAlphaCutoff();if(w.getDoubleSided())N.doubleSided=!0;if(N.pbrMetallicRoughness={},!l0.eq(w.getBaseColorFactor(),[1,1,1,1]))N.pbrMetallicRoughness.baseColorFactor=w.getBaseColorFactor();if(!l0.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(),O=w.getBaseColorTextureInfo();N.pbrMetallicRoughness.baseColorTexture=W.createTextureInfoDef(R,O)}if(w.getEmissiveTexture()){let R=w.getEmissiveTexture(),O=w.getEmissiveTextureInfo();N.emissiveTexture=W.createTextureInfoDef(R,O)}if(w.getNormalTexture()){let R=w.getNormalTexture(),O=w.getNormalTextureInfo(),P=W.createTextureInfoDef(R,O);if(w.getNormalScale()!==1)P.scale=w.getNormalScale();N.normalTexture=P}if(w.getOcclusionTexture()){let R=w.getOcclusionTexture(),O=w.getOcclusionTextureInfo(),P=W.createTextureInfoDef(R,O);if(w.getOcclusionStrength()!==1)P.strength=w.getOcclusionStrength();N.occlusionTexture=P}if(w.getMetallicRoughnessTexture()){let R=w.getMetallicRoughnessTexture(),O=w.getMetallicRoughnessTextureInfo();N.pbrMetallicRoughness.metallicRoughnessTexture=W.createTextureInfoDef(R,O)}return W.materialIndexMap.set(w,j),N}),z.filter((w)=>w.prewriteTypes.includes(s.MESH)).forEach((w)=>w.prewrite(W,s.MESH)),$.meshes=Y.listMeshes().map((w,j)=>{let N=W.createPropertyDef(w),R=null;if(N.primitives=w.listPrimitives().map((O)=>{let P={attributes:{}};P.mode=O.getMode();let D=O.getMaterial();if(D)P.material=W.materialIndexMap.get(D);if(Object.keys(O.getExtras()).length)P.extras=O.getExtras();let C=O.getIndices();if(C)P.indices=W.accessorIndexMap.get(C);for(let T of O.listSemantics())P.attributes[T]=W.accessorIndexMap.get(O.getAttribute(T));for(let T of O.listTargets()){let k={};for(let A of T.listSemantics())k[A]=W.accessorIndexMap.get(T.getAttribute(A));P.targets=P.targets||[],P.targets.push(k)}if(O.listTargets().length&&!R)R=O.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,j),N}),$.cameras=Y.listCameras().map((w,j)=>{let N=W.createPropertyDef(w);if(N.type=w.getType(),N.type===G$.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,j),N}),$.nodes=Y.listNodes().map((w,j)=>{let N=W.createPropertyDef(w);if(!l0.eq(w.getTranslation(),[0,0,0]))N.translation=w.getTranslation();if(!l0.eq(w.getRotation(),[0,0,0,1]))N.rotation=w.getRotation();if(!l0.eq(w.getScale(),[1,1,1]))N.scale=w.getScale();if(w.getWeights().length)N.weights=w.getWeights();return W.nodeIndexMap.set(w,j),N}),$.skins=Y.listSkins().map((w,j)=>{let N=W.createPropertyDef(w),R=w.getInverseBindMatrices();if(R)N.inverseBindMatrices=W.accessorIndexMap.get(R);let O=w.getSkeleton();if(O)N.skeleton=W.nodeIndexMap.get(O);return N.joints=w.listJoints().map((P)=>W.nodeIndexMap.get(P)),W.skinIndexMap.set(w,j),N}),Y.listNodes().forEach((w,j)=>{let N=$.nodes[j],R=w.getMesh();if(R)N.mesh=W.meshIndexMap.get(R);let O=w.getCamera();if(O)N.camera=W.cameraIndexMap.get(O);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,j)=>{let N=W.createPropertyDef(w),R=new Map;return N.samplers=w.listSamplers().map((O,P)=>{let D=W.createPropertyDef(O);return D.input=W.accessorIndexMap.get(O.getInput()),D.output=W.accessorIndexMap.get(O.getOutput()),D.interpolation=O.getInterpolation(),R.set(O,P),D}),N.channels=w.listChannels().map((O)=>{let P=W.createPropertyDef(O);return P.sampler=R.get(O.getSampler()),P.target={node:W.nodeIndexMap.get(O.getTargetNode()),path:O.getTargetPath()},P}),W.animationIndexMap.set(w,j),N}),$.scenes=Y.listScenes().map((w,j)=>{let N=W.createPropertyDef(w);return N.nodes=w.listChildren().map((R)=>W.nodeIndexMap.get(R)),W.sceneIndexMap.set(w,j),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)),BB1($),Q}}function BB1(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 Cw;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(Cw||(Cw={}));class Gn{constructor(){this._logger=_5.DEFAULT_INSTANCE,this._extensions=new Set,this._dependencies={},this._vertexLayout=Nw.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=ri(J)?this._binaryToJSON(J):{json:JSON.parse(a0.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),Wn.read(Z,{extensions:Array.from(this._extensions),dependencies:this._dependencies,logger:this._logger})}async binaryToJSON(Z){let J=this._binaryToJSON(a0.assertView(Z));this._readResourcesInternal(J);let X=J.json;if(X.buffers&&X.buffers.some((Y)=>LB1(J,Y)))throw new Error("Cannot resolve external buffers with binaryToJSON().");else if(X.images&&X.images.some((Y)=>jB1(J,Y)))throw new Error("Cannot resolve external images with binaryToJSON().");return J}async readBinary(Z){return this.readJSON(await this.binaryToJSON(a0.assertView(Z)))}async writeJSON(Z,J={}){if(J.format===AZ.GLB&&Z.getRoot().listBuffers().length>1)throw new Error("GLB must have 0\u20131 buffers.");return Kn.write(Z,{format:J.format||AZ.GLTF,basename:J.basename||"",logger:this._logger,vertexLayout:this._vertexLayout,dependencies:Y5({},this._dependencies),extensions:Array.from(this._extensions)})}async writeBinary(Z){let{json:J,resources:X}=await this.writeJSON(Z,{format:AZ.GLB}),Y=new Uint32Array([1179937895,2,12]),$=JSON.stringify(J),Q=a0.pad(a0.encodeText($),32),W=a0.toView(new Uint32Array([Q.byteLength,1313821514])),K=a0.concat([W,Q]);Y[Y.length-1]+=K.byteLength;let G=Object.values(X)[0];if(!G||!G.byteLength)return a0.concat([a0.toView(Y),K]);let z=a0.pad(G,0),H=a0.toView(new Uint32Array([z.byteLength,5130562])),V=a0.concat([H,z]);return Y[Y.length-1]+=V.byteLength,a0.concat([a0.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){a0.assertView(Z.resources[$.uri]);return}if($.uri.match(/data:/)){let Q=`__${Yn()}.${hZ.extension($.uri)}`;Z.resources[Q]=a0.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:Y5({},Z.json),resources:Y5({},Z.resources)},J)Z.json.images=J.map((Y)=>Y5({},Y));if(X)Z.json.buffers=X.map((Y)=>Y5({},Y));return Z}_binaryToJSON(Z){if(!ri(Z))throw new Error("Invalid glTF 2.0 binary.");let J=new Uint32Array(Z.buffer,Z.byteOffset+12,2);if(J[1]!==Cw.JSON)throw new Error("Missing required GLB JSON chunk.");let X=20,Y=J[0],$=a0.decodeText(a0.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]!==Cw.BIN)return{json:Q,resources:{}};let G=K[0],z=a0.toView(Z,W+8,G);return{json:Q,resources:{[Rw]:z}}}}function LB1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)}function jB1(Z,J){return J.uri!==void 0&&!(J.uri in Z.resources)&&J.bufferView===void 0}function ri(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 lC extends Gn{constructor(Z=null,J=m9.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(),m9.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(m9.isAbsoluteURL(Z)||m9.isAbsoluteURL(J))return m9.resolve(Z,J);return this._path.resolve(Z,decodeURIComponent(J))}dirname(Z){if(m9.isAbsoluteURL(Z))return m9.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:AZ.GLTF,basename:hZ.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 OB1(Object.keys($),10))await Promise.all(z.map(async function(H){if(m9.isAbsoluteURL(H)){if(m9.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 OB1(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 Yo=e(pC(),1),$o=e(ms(),1),HR1=e(Xo(),1);async function VR1(Z,J){if(!(Z instanceof Uint8Array))throw new Error("[ndarray-pixels] Input must be Uint8Array or Buffer.");let{data:X,info:Y}=await $o.default(Z).ensureAlpha().raw().toBuffer({resolveWithObject:!0});return Yo.default(new Uint8Array(X),[Y.width,Y.height,4],[4,4*Y.width|0,1],0)}async function Qo(Z,J){return VR1(Z)}var qR1="v4.2.1",DT="@glb.bin",o;(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"})(o||(o={}));var Wo;(function(Z){Z.INTERLEAVED="interleaved",Z.SEPARATE="separate"})(Wo||(Wo={}));var G9;(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"})(G9||(G9={}));var z9;(function(Z){Z[Z.R=4096]="R",Z[Z.G=256]="G",Z[Z.B=16]="B",Z[Z.A=1]="A"})(z9||(z9={}));var LT;(function(Z){Z.GLTF="GLTF",Z.GLB="GLB"})(LT||(LT={}));class f6{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 Ho{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),FR1(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 $B{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(f6.decodeText(Z.slice(12,16))===$B.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}}$B.PNG_FRIED_CHUNK_NAME="CgBI";class m4{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}`}}m4.impls={"image/jpeg":new Ho,"image/png":new $B};function FR1(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 jz{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 m4.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()}}var jT=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 UR1(){var Z=new jT(3);if(jT!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function BT(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function wR1(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=UR1();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 Vo(Z){let J=qo(),X=Z.propertyType===o.NODE?[Z]:Z.listChildren();for(let Y of X)Y.traverse(($)=>{let Q=$.getMesh();if(!Q)return;let W=BR1(Q,$.getWorldMatrix());if(W.min.every(isFinite)&&W.max.every(isFinite))OT(W.min,J),OT(W.max,J)});return J}function BR1(Z,J){let X=qo();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=wR1(K,W,J),OT(K,X)}}return X}function OT(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 qo(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}var Ko="https://null.example";class PT{static dirname(Z){let J=Z.lastIndexOf("/");if(J===-1)return"./";return Z.substring(0,J+1)}static basename(Z){return jz.basename(new URL(Z,Ko).pathname)}static extension(Z){return jz.extension(new URL(Z,Ko).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)}}PT.DEFAULT_INIT={};PT.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;function Go(Z){return Object.prototype.toString.call(Z)==="[object Object]"}function U$(Z){if(Go(Z)===!1)return!1;let J=Z.constructor;if(J===void 0)return!0;let X=J.prototype;if(Go(X)===!1)return!1;if(Object.hasOwn(X,"isPrototypeOf")===!1)return!1;return!0}var MT,RT;(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"})(RT||(RT={}));class A7{constructor(Z){this.verbosity=void 0,this.verbosity=Z}debug(Z){if(this.verbosity<=A7.Verbosity.DEBUG)console.debug(Z)}info(Z){if(this.verbosity<=A7.Verbosity.INFO)console.info(Z)}warn(Z){if(this.verbosity<=A7.Verbosity.WARN)console.warn(Z)}error(Z){if(this.verbosity<=A7.Verbosity.ERROR)console.error(Z)}}MT=A7;A7.Verbosity=RT;A7.DEFAULT_INSTANCE=new MT(MT.Verbosity.INFO);function LR1(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],j=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,O=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,A=H*B-V*U,v=H*w-q*U,x=V*w-q*B;return j*x-N*v+R*A+O*k-P*T+D*C}function jR1(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],j=J[14],N=J[15],R=X[0],O=X[1],P=X[2],D=X[3];return Z[0]=R*Y+O*K+P*V+D*B,Z[1]=R*$+O*G+P*q+D*w,Z[2]=R*Q+O*z+P*F+D*j,Z[3]=R*W+O*H+P*U+D*N,R=X[4],O=X[5],P=X[6],D=X[7],Z[4]=R*Y+O*K+P*V+D*B,Z[5]=R*$+O*G+P*q+D*w,Z[6]=R*Q+O*z+P*F+D*j,Z[7]=R*W+O*H+P*U+D*N,R=X[8],O=X[9],P=X[10],D=X[11],Z[8]=R*Y+O*K+P*V+D*B,Z[9]=R*$+O*G+P*q+D*w,Z[10]=R*Q+O*z+P*F+D*j,Z[11]=R*W+O*H+P*U+D*N,R=X[12],O=X[13],P=X[14],D=X[15],Z[12]=R*Y+O*K+P*V+D*B,Z[13]=R*$+O*G+P*q+D*w,Z[14]=R*Q+O*z+P*F+D*j,Z[15]=R*W+O*H+P*U+D*N,Z}function OR1(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 MR1(Z,J){var X=new jT(3);OR1(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 w8{static identity(Z){return Z}static eq(Z,J,X=0.00001){if(Z.length!==J.length)return!1;for(let Y=0;Y<Z.length;Y++)if(Math.abs(Z[Y]-J[Y])>X)return!1;return!0}static clamp(Z,J,X){if(Z<J)return J;if(Z>X)return X;return Z}static decodeNormalizedInt(Z,J){switch(J){case 5126:return Z;case 5123:return Z/65535;case 5121:return Z/255;case 5122:return Math.max(Z/32767,-1);case 5120:return Math.max(Z/127,-1);default:throw new Error("Invalid component type.")}}static encodeNormalizedInt(Z,J){switch(J){case 5126:return Z;case 5123:return Math.round(w8.clamp(Z,0,1)*65535);case 5121:return Math.round(w8.clamp(Z,0,1)*255);case 5122:return Math.round(w8.clamp(Z,-1,1)*32767);case 5120:return Math.round(w8.clamp(Z,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(Z,J,X,Y){let $=BT([Z[0],Z[1],Z[2]]),Q=BT([Z[4],Z[5],Z[6]]),W=BT([Z[8],Z[9],Z[10]]);if(LR1(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,MR1(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,j=K*V,N=G*z,R=G*H,O=G*V,P=X[0],D=X[1],C=X[2];return $[0]=(1-(B+j))*P,$[1]=(F+O)*P,$[2]=(U-R)*P,$[3]=0,$[4]=(F-O)*D,$[5]=(1-(q+j))*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 RR1(Z,J){if(!!Z!==!!J)return!1;let X=Z.getChild(),Y=J.getChild();return X===Y||X.equals(Y)}function NR1(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 DR1(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 Fo(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 Uo(Z,J){if(Z===J)return!0;if(!!Z!==!!J)return!1;if(!U$(Z)||!U$(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(JB(K)&&JB(G)){if(!Fo(K,G))return!1}else if(U$(K)&&U$(G)){if(!Uo(K,G))return!1}else if(K!==G)return!1}return!0}function JB(Z){return Array.isArray(Z)||ArrayBuffer.isView(Z)}var HX=(Z)=>Z,PR1=new Set;class QB extends kW{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,HX)}copy(Z,J=HX){for(let X in this[y0]){let Y=this[y0][X];if(Y instanceof v5){if(!this[y4].has(X))Y.dispose()}else if(Y instanceof A6||Y instanceof I0)for(let $ of Y.values())$.dispose();else if(Y instanceof W8)for(let $ of Y.values())$.dispose()}for(let X in Z[y0]){let Y=this[y0][X],$=Z[y0][X];if($ instanceof v5)if(this[y4].has(X))Y.getChild().copy(J($.getChild()),J);else this.setRef(X,J($.getChild()),$.getAttributes());else if($ instanceof I0||$ instanceof A6)for(let Q of $.values())this.addRef(X,J(Q.getChild()),Q.getAttributes());else if($ instanceof W8)for(let Q of $.keys()){let W=$.get(Q);this.setRefMap(X,Q,J(W.getChild()),W.getAttributes())}else if(U$($))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=PR1){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 v5||$ instanceof v5){if(!RR1(Y,$))return!1}else if(Y instanceof I0||$ instanceof I0||Y instanceof A6||$ instanceof A6){if(!NR1(Y,$))return!1}else if(Y instanceof W8||$ instanceof W8){if(!DR1(Y,$))return!1}else if(U$(Y)||U$($)){if(!Uo(Y,$))return!1}else if(JB(Y)||JB($)){if(!Fo(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 b6 extends QB{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new W8})}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 C0 extends b6{init(){this.propertyType=o.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:C0.Type.SCALAR,componentType:C0.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(Z){switch(Z){case C0.Type.SCALAR:return 1;case C0.Type.VEC2:return 2;case C0.Type.VEC3:return 3;case C0.Type.VEC4:return 4;case C0.Type.MAT2:return 4;case C0.Type.MAT3:return 9;case C0.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+Z)}}static getComponentSize(Z){switch(Z){case C0.ComponentType.BYTE:return 1;case C0.ComponentType.UNSIGNED_BYTE:return 1;case C0.ComponentType.SHORT:return 2;case C0.ComponentType.UNSIGNED_SHORT:return 2;case C0.ComponentType.UNSIGNED_INT:return 4;case C0.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+Z)}}getMinNormalized(Z){let J=this.getNormalized(),X=this.getElementSize(),Y=this.getComponentType();if(this.getMin(Z),J)for(let $=0;$<X;$++)Z[$]=w8.decodeNormalizedInt(Z[$],Y);return Z}getMin(Z){let J=this.getArray(),X=this.getCount(),Y=this.getElementSize();for(let $=0;$<Y;$++)Z[$]=1/0;for(let $=0;$<X*Y;$+=Y)for(let Q=0;Q<Y;Q++){let 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[$]=w8.decodeNormalizedInt(Z[$],Y);return Z}getMax(Z){let J=this.get("array"),X=this.getCount(),Y=this.getElementSize();for(let $=0;$<Y;$++)Z[$]=-1/0;for(let $=0;$<X*Y;$+=Y)for(let Q=0;Q<Y;Q++){let 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 C0.getElementSize(this.get("type"))}getComponentSize(){return this.get("array").BYTES_PER_ELEMENT}getComponentType(){return this.get("componentType")}getNormalized(){return this.get("normalized")}setNormalized(Z){return this.set("normalized",Z)}getScalar(Z){let J=this.getElementSize(),X=this.getComponentType(),Y=this.getArray();if(this.getNormalized())return w8.decodeNormalizedInt(Y[Z*J],X);return Y[Z*J]}setScalar(Z,J){let X=this.getElementSize(),Y=this.getComponentType(),$=this.getArray();if(this.getNormalized())$[Z*X]=w8.encodeNormalizedInt(J,Y);else $[Z*X]=J;return this}getElement(Z,J){let X=this.getNormalized(),Y=this.getElementSize(),$=this.getComponentType(),Q=this.getArray();for(let W=0;W<Y;W++)if(X)J[W]=w8.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]=w8.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?CR1(Z):C0.ComponentType.FLOAT),this.set("array",Z),this}getByteLength(){let Z=this.get("array");return Z?Z.byteLength:0}}C0.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};C0.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function CR1(Z){switch(Z.constructor){case Float32Array:return C0.ComponentType.FLOAT;case Uint32Array:return C0.ComponentType.UNSIGNED_INT;case Uint16Array:return C0.ComponentType.UNSIGNED_SHORT;case Uint8Array:return C0.ComponentType.UNSIGNED_BYTE;case Int16Array:return C0.ComponentType.SHORT;case Int8Array:return C0.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class CT extends b6{init(){this.propertyType=o.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new I0,samplers:new I0})}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 Mz extends b6{init(){this.propertyType=o.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)}}Mz.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class mW extends b6{init(){this.propertyType=o.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:mW.Interpolation.LINEAR,input:null,output:null})}getInterpolation(){return this.get("interpolation")}setInterpolation(Z){return this.set("interpolation",Z)}getInput(){return this.getRef("input")}setInput(Z){return this.setRef("input",Z,{usage:G9.OTHER})}getOutput(){return this.getRef("output")}setOutput(Z){return this.setRef("output",Z,{usage:G9.OTHER})}}mW.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class TT extends b6{init(){this.propertyType=o.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(Z){return this.set("uri",Z)}}class Rz extends b6{init(){this.propertyType=o.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:Rz.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)}}Rz.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class Z8 extends QB{_validateParent(Z){if(!this.parentTypes.includes(Z.propertyType))throw new Error(`Parent "${Z.propertyType}" invalid for child "${this.propertyType}".`)}}Z8.EXTENSION_NAME=void 0;class v1 extends b6{init(){this.propertyType=o.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:v1.WrapMode.REPEAT,wrapT:v1.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)}}v1.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};v1.MagFilter={NEAREST:9728,LINEAR:9729};v1.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};var{R:tw,G:ew,B:ZB,A:TR1}=z9;class Nz extends b6{init(){this.propertyType=o.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:Nz.AlphaMode.OPAQUE,alphaCutoff:0.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new v1(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new v1(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new v1(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new v1(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new v1(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:tw|ew|ZB|TR1,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:tw|ew|ZB,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:tw|ew|ZB})}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:tw})}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:ew|ZB})}}Nz.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class kT extends b6{init(){this.propertyType=o.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new I0})}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 ET extends b6{init(){this.propertyType=o.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 I0})}copy(Z,J=HX){if(J===HX)throw new Error("Node cannot be copied.");return super.copy(Z,J)}getTranslation(){return this.get("translation")}getRotation(){return this.get("rotation")}getScale(){return this.get("scale")}setTranslation(Z){return this.set("translation",Z)}setRotation(Z){return this.set("rotation",Z)}setScale(Z){return this.set("scale",Z)}getMatrix(){return w8.compose(this.get("translation"),this.get("rotation"),this.get("scale"),[])}setMatrix(Z){let J=this.get("translation").slice(),X=this.get("rotation").slice(),Y=this.get("scale").slice();return w8.decompose(Z,J,X,Y),this.set("translation",J).set("rotation",X).set("scale",Y)}getWorldTranslation(){let Z=[0,0,0];return w8.decompose(this.getWorldMatrix(),Z,[0,0,0,1],[1,1,1]),Z}getWorldRotation(){let Z=[0,0,0,1];return w8.decompose(this.getWorldMatrix(),[0,0,0],Z,[1,1,1]),Z}getWorldScale(){let Z=[1,1,1];return w8.decompose(this.getWorldMatrix(),[0,0,0],[0,0,0,1],Z),Z}getWorldMatrix(){let Z=[];for(let Y=this;Y!=null;Y=Y.getParentNode())Z.push(Y);let J,X=Z.pop().getMatrix();while(J=Z.pop())jR1(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===o.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===o.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 VX extends b6{init(){this.propertyType=o.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:VX.Mode.TRIANGLES,material:null,indices:null,attributes:new W8,targets:new I0})}getIndices(){return this.getRef("indices")}setIndices(Z){return this.setRef("indices",Z,{usage:G9.ELEMENT_ARRAY_BUFFER})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:G9.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)}}VX.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class wo extends QB{init(){this.propertyType=o.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new W8})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:G9.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function XB(){return XB=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},XB.apply(null,arguments)}class IT extends b6{init(){this.propertyType=o.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new I0})}copy(Z,J=HX){if(J===HX)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 vT extends b6{init(){this.propertyType=o.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new I0})}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:G9.INVERSE_BIND_MATRICES})}addJoint(Z){return this.addRef("joints",Z)}removeJoint(Z){return this.removeRef("joints",Z)}listJoints(){return this.listRefs("joints")}}class ST extends b6{init(){this.propertyType=o.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||m4.extensionToMimeType(jz.extension(this.get("uri")))}setMimeType(Z){return this.set("mimeType",Z)}getURI(){return this.get("uri")}setURI(Z){this.set("uri",Z);let J=m4.extensionToMimeType(jz.extension(Z));if(J)this.set("mimeType",J);return this}getImage(){return this.get("image")}setImage(Z){return this.set("image",f6.assertView(Z))}getSize(){let Z=this.get("image");if(!Z)return null;return m4.getSize(Z,this.getMimeType())}}class WB extends b6{init(){this.propertyType=o.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${qR1}`,version:"2.0"},defaultScene:null,accessors:new I0,animations:new I0,buffers:new I0,cameras:new I0,materials:new I0,meshes:new I0,nodes:new I0,scenes:new I0,skins:new I0,textures:new I0})}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=HX){if(J===HX)throw new Error("Root cannot be copied.");this.set("asset",XB({},Z.get("asset"))),this.setName(Z.getName()),this.setExtras(XB({},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 IT)this.addRef("scenes",Z);else if(Z instanceof ET)this.addRef("nodes",Z);else if(Z instanceof Rz)this.addRef("cameras",Z);else if(Z instanceof vT)this.addRef("skins",Z);else if(Z instanceof kT)this.addRef("meshes",Z);else if(Z instanceof Nz)this.addRef("materials",Z);else if(Z instanceof ST)this.addRef("textures",Z);else if(Z instanceof CT)this.addRef("animations",Z);else if(Z instanceof C0)this.addRef("accessors",Z);else if(Z instanceof TT)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 YB{static fromGraph(Z){return YB._GRAPH_DOCUMENTS.get(Z)||null}constructor(){this._graph=new TW,this._root=new WB(this._graph),this._logger=A7.DEFAULT_INSTANCE,YB._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 IT(this._graph,Z)}createNode(Z=""){return new ET(this._graph,Z)}createCamera(Z=""){return new Rz(this._graph,Z)}createSkin(Z=""){return new vT(this._graph,Z)}createMesh(Z=""){return new kT(this._graph,Z)}createPrimitive(){return new VX(this._graph)}createPrimitiveTarget(Z=""){return new wo(this._graph,Z)}createMaterial(Z=""){return new Nz(this._graph,Z)}createTexture(Z=""){return new ST(this._graph,Z)}createAnimation(Z=""){return new CT(this._graph,Z)}createAnimationChannel(Z=""){return new Mz(this._graph,Z)}createAnimationSampler(Z=""){return new mW(this._graph,Z)}createAccessor(Z="",J=null){if(!J)J=this.getRoot().listBuffers()[0];return new C0(this._graph,Z).setBuffer(J)}createBuffer(Z=""){return new TT(this._graph,Z)}}YB._GRAPH_DOCUMENTS=new WeakMap;class A1{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 Z8&&$.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}}A1.EXTENSION_NAME=void 0;var rB6={logger:A7.DEFAULT_INSTANCE,extensions:[],dependencies:{}},tB6=new Set([o.BUFFER,o.TEXTURE,o.MATERIAL,o.MESH,o.PRIMITIVE,o.NODE,o.SCENE]);var Oz;(function(Z){Z[Z.ARRAY_BUFFER=34962]="ARRAY_BUFFER",Z[Z.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(Oz||(Oz={}));class qX{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 NT($>1,()=>X.basename||"buffer"),this.imageURIGenerator=new NT(Q>1,(W)=>kR1(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===LT.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=m4.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 G9.SPARSE;for(let X of this._doc.getGraph().listParentEdges(Z)){let{usage:Y}=X.getAttributes();if(Y)return Y;if(X.getParent().propertyType!==o.ROOT)this.logger.warn(`Missing attribute ".usage" on edge, "${X.getName()}".`)}return G9.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}}qX.BufferViewTarget=Oz;qX.BufferViewUsage=G9;qX.USAGE_TO_TARGET={[G9.ARRAY_BUFFER]:Oz.ARRAY_BUFFER,[G9.ELEMENT_ARRAY_BUFFER]:Oz.ELEMENT_ARRAY_BUFFER};class NT{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 kR1(Z,J){let X=Z.getGraph().listParentEdges(J).find((Y)=>Y.getParent()!==Z.getRoot());return X?X.getName().replace(/texture$/i,""):""}var{UNSIGNED_INT:eB6,UNSIGNED_SHORT:ZL6,UNSIGNED_BYTE:JL6}=C0.ComponentType,XL6=new Set([o.ACCESSOR,o.BUFFER,o.MATERIAL,o.MESH]);var zo;(function(Z){Z[Z.JSON=1313821514]="JSON",Z[Z.BIN=5130562]="BIN"})(zo||(zo={}));var Lo=163,jo=166;function ER1(){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 uW{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 QL6=new Uint8Array([0]),K5=[171,75,84,88,32,50,48,187,13,10,26,10];function Bo(Z){return new TextDecoder().decode(Z)}function KB(Z){let J=new Uint8Array(Z.buffer,Z.byteOffset,K5.length);if(J[0]!==K5[0]||J[1]!==K5[1]||J[2]!==K5[2]||J[3]!==K5[3]||J[4]!==K5[4]||J[5]!==K5[5]||J[6]!==K5[6]||J[7]!==K5[7]||J[8]!==K5[8]||J[9]!==K5[9]||J[10]!==K5[10]||J[11]!==K5[11])throw new Error("Missing KTX 2.0 identifier.");let X=ER1(),Y=17*Uint32Array.BYTES_PER_ELEMENT,$=new uW(Z,K5.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 uW(Z,K5.length+Y,q,!0);for(let L6=0;L6<Q;L6++)X.levels.push({levelData:new Uint8Array(Z.buffer,Z.byteOffset+F._nextUint64(),F._nextUint64()),uncompressedByteLength:F._nextUint64()});let U=new uW(Z,W,K,!0);U._skip(4);let B=U._nextUint16(),w=U._nextUint16(),j=U._nextUint16(),N=U._nextUint16(),R=U._nextUint8(),O=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()],A={vendorId:B,descriptorType:w,versionNumber:j,colorModel:R,colorPrimaries:O,transferFunction:P,flags:D,texelBlockDimension:C,bytesPlane:T,samples:[]},v=6,x=4,I=(N/4-v)/x;for(let L6=0;L6<I;L6++){let MZ={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(MZ.channelType&64)MZ.sampleLower=U._nextInt32(),MZ.sampleUpper=U._nextInt32();else MZ.sampleLower=U._nextUint32(),MZ.sampleUpper=U._nextUint32();A.samples[L6]=MZ}X.dataFormatDescriptor.length=0,X.dataFormatDescriptor.push(A);let S=new uW(Z,G,z,!0);while(S._offset<z){let L6=S._nextUint32(),MZ=S._scan(L6),YU=Bo(MZ);if(X.keyValue[YU]=S._nextUint8Array(L6-MZ.byteLength-1),YU.match(/^ktx/i)){let tg=Bo(X.keyValue[YU]);X.keyValue[YU]=tg.substring(0,tg.lastIndexOf("\x00"))}let R31=L6%4?4-L6%4:0;S._skip(R31)}if(V<=0)return X;let y=new uW(Z,H,V,!0),m=y._nextUint16(),i=y._nextUint16(),t=y._nextUint32(),Z0=y._nextUint32(),W0=y._nextUint32(),A0=y._nextUint32(),x0=[];for(let L6=0;L6<Q;L6++)x0.push({imageFlags:y._nextUint32(),rgbSliceByteOffset:y._nextUint32(),rgbSliceByteLength:y._nextUint32(),alphaSliceByteOffset:y._nextUint32(),alphaSliceByteLength:y._nextUint32()});let s0=H+y._offset,b8=s0+t,$8=b8+Z0,L7=$8+W0,k4=new Uint8Array(Z.buffer,Z.byteOffset+s0,t),eQ=new Uint8Array(Z.buffer,Z.byteOffset+b8,Z0),ZW=new Uint8Array(Z.buffer,Z.byteOffset+$8,W0),lY=new Uint8Array(Z.buffer,Z.byteOffset+L7,A0);return X.globalData={endpointCount:m,selectorCount:i,imageDescs:x0,endpointsData:k4,selectorsData:eQ,tablesData:ZW,extendedData:lY},X}var yZ="EXT_mesh_gpu_instancing",R6="EXT_meshopt_compression",Dz="EXT_texture_webp",Pz="EXT_texture_avif",G8="KHR_draco_mesh_compression",c9="KHR_lights_punctual",gZ="KHR_materials_anisotropy",mZ="KHR_materials_clearcoat",uZ="KHR_materials_diffuse_transmission",dZ="KHR_materials_dispersion",cZ="KHR_materials_emissive_strength",lZ="KHR_materials_ior",pZ="KHR_materials_iridescence",iZ="KHR_materials_pbrSpecularGlossiness",nZ="KHR_materials_sheen",aZ="KHR_materials_specular",sZ="KHR_materials_transmission",FX="KHR_materials_unlit",oZ="KHR_materials_volume",y6="KHR_materials_variants",So="KHR_mesh_quantization",Cz="KHR_texture_basisu",rZ="KHR_texture_transform",l9="KHR_xmp_json_ld",AT="INSTANCE_ATTRIBUTE";class hT extends Z8{init(){this.extensionName=yZ,this.propertyType="InstancedMesh",this.parentTypes=[o.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new W8})}getAttribute(Z){return this.getRefMap("attributes",Z)}setAttribute(Z,J){return this.setRefMap("attributes",Z,J,{usage:AT})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}hT.EXTENSION_NAME=yZ;class HB extends A1{constructor(...Z){super(...Z);this.extensionName=yZ,this.provideTypes=[o.NODE],this.prewriteTypes=[o.ACCESSOR]}createInstancedMesh(){return new hT(this.document.getGraph())}read(Z){return(Z.jsonDoc.json.nodes||[]).forEach((Y,$)=>{if(!Y.extensions||!Y.extensions[yZ])return;let Q=Y.extensions[yZ],W=this.createInstancedMesh();for(let K in Q.attributes)W.setAttribute(K,Z.accessors[Q.attributes[K]]);Z.nodes[$].setExtension(yZ,W)}),this}prewrite(Z){Z.accessorUsageGroupedByParent.add(AT);for(let J of this.properties)for(let X of J.listAttributes())Z.addAccessorToUsageGroup(X,AT);return this}write(Z){let J=Z.jsonDoc;return this.document.getRoot().listNodes().forEach((X)=>{let Y=X.getExtension(yZ);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[yZ]=W}}),this}}HB.EXTENSION_NAME=yZ;function tZ(){return tZ=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},tZ.apply(null,arguments)}var Tz;(function(Z){Z.QUANTIZE="quantize",Z.FILTER="filter"})(Tz||(Tz={}));var dW;(function(Z){Z.ATTRIBUTES="ATTRIBUTES",Z.TRIANGLES="TRIANGLES",Z.INDICES="INDICES"})(dW||(dW={}));var B8;(function(Z){Z.NONE="NONE",Z.OCTAHEDRAL="OCTAHEDRAL",Z.QUATERNION="QUATERNION",Z.EXPONENTIAL="EXPONENTIAL"})(B8||(B8={}));function IR1(Z){if(!Z.extensions||!Z.extensions[R6])return!1;return!!Z.extensions[R6].fallback}var{BYTE:vR1,SHORT:Oo,FLOAT:SR1}=C0.ComponentType,{encodeNormalizedInt:Mo,decodeNormalizedInt:xT}=w8;function _R1(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!==dW.ATTRIBUTES)return W;if($!==B8.NONE){let K=Z.getNormalized()?AR1(Z):new Float32Array(W.array);switch($){case B8.EXPONENTIAL:W.byteStride=Z.getElementSize()*4,W.componentType=SR1,W.normalized=!1,W.array=J.encodeFilterExp(K,Z.getCount(),W.byteStride,Q);break;case B8.OCTAHEDRAL:W.byteStride=Q>8?8:4,W.componentType=Q>8?Oo:vR1,W.normalized=!0,K=Z.getElementSize()===3?hR1(K):K,W.array=J.encodeFilterOct(K,Z.getCount(),W.byteStride,Q);break;case B8.QUATERNION:W.byteStride=8,W.componentType=Oo,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)=>xT(G,Z.getComponentType())),W.max=W.max.map((G)=>xT(G,Z.getComponentType()));if(W.normalized)W.min=W.min.map((G)=>Mo(G,W.componentType)),W.max=W.max.map((G)=>Mo(G,W.componentType))}else if(W.byteStride%4)W.array=xR1(W.array,Z.getElementSize()),W.byteStride=W.array.byteLength/Z.getCount();return W}function AR1(Z){let J=Z.getComponentType(),X=Z.getArray(),Y=new Float32Array(X.length);for(let $=0;$<X.length;$++)Y[$]=xT(X[$],J);return Y}function xR1(Z,J){let Y=f6.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 hR1(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 fR1(Z,J){if(J===qX.BufferViewUsage.ELEMENT_ARRAY_BUFFER)return Z.listParents().some((Y)=>{return Y instanceof VX&&Y.getMode()===VX.Mode.TRIANGLES})?dW.TRIANGLES:dW.INDICES;return dW.ATTRIBUTES}function bR1(Z,J){let X=J.getGraph().listParentEdges(Z).filter((Y)=>!(Y.getParent()instanceof WB));for(let Y of X){let $=Y.getName(),Q=Y.getAttributes().key||"",W=Y.getParent().propertyType===o.PRIMITIVE_TARGET;if($==="indices")return{filter:B8.NONE};if($==="attributes"){if(Q==="POSITION")return{filter:B8.NONE};if(Q==="TEXCOORD_0")return{filter:B8.NONE};if(Q.startsWith("JOINTS_"))return{filter:B8.NONE};if(Q.startsWith("WEIGHTS_"))return{filter:B8.NONE};if(Q==="NORMAL"||Q==="TANGENT")return W?{filter:B8.NONE}:{filter:B8.OCTAHEDRAL,bits:8}}if($==="output"){let K=_o(Z);if(K==="rotation")return{filter:B8.QUATERNION,bits:16};if(K==="translation")return{filter:B8.EXPONENTIAL,bits:12};if(K==="scale")return{filter:B8.EXPONENTIAL,bits:12};return{filter:B8.NONE}}if($==="input")return{filter:B8.NONE};if($==="inverseBindMatrices")return{filter:B8.NONE}}return{filter:B8.NONE}}function _o(Z){for(let J of Z.listParents()){if(!(J instanceof mW))continue;for(let X of J.listParents()){if(!(X instanceof Mz))continue;return X.getTargetPath()}}return null}var Ro={method:Tz.QUANTIZE};class Ez extends A1{constructor(...Z){super(...Z);this.extensionName=R6,this.prereadTypes=[o.BUFFER,o.PRIMITIVE],this.prewriteTypes=[o.BUFFER,o.ACCESSOR],this.readDependencies=["meshopt.decoder"],this.writeDependencies=["meshopt.encoder"],this._decoder=null,this._decoderFallbackBufferMap=new Map,this._encoder=null,this._encoderOptions=Ro,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=tZ({},Ro,Z),this}preread(Z,J){if(!this._decoder){if(!this.isRequired())return this;throw new Error(`[${R6}] Please install extension dependency, "meshopt.decoder".`)}if(!this._decoder.supported){if(!this.isRequired())return this;throw new Error(`[${R6}]: Missing WASM support.`)}if(J===o.BUFFER)this._prereadBuffers(Z);else if(J===o.PRIMITIVE)this._prereadPrimitives(Z);return this}_prereadBuffers(Z){let J=Z.jsonDoc;(J.json.bufferViews||[]).forEach((Y,$)=>{if(!Y.extensions||!Y.extensions[R6])return;let Q=Y.extensions[R6],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[DT],F=f6.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[R6])return;let $=Y.extensions[R6],Q=Z.buffers[$.buffer],W=Z.buffers[Y.buffer],K=J.json.buffers[Y.buffer];if(IR1(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 C0)Y.swap(J,X);J.dispose()}return this}prewrite(Z,J){if(J===o.ACCESSOR)this._prewriteAccessors(Z);else if(J===o.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===o.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(_o(H)==="weights")continue;if(H.getSparse())continue;let V=Z.getAccessorUsage(H),q=Z.accessorUsageGroupedByParent.has(V)?z(H):null,F=fR1(H,V),U=Y.method===Tz.FILTER?bR1(H,this.document):{filter:B8.NONE},B=_R1(H,X,F,U),{array:w,byteStride:j}=B,N=H.getBuffer();if(!N)throw new Error(`${R6}: Missing buffer for accessor.`);let R=this.document.getRoot().listBuffers().indexOf(N),O=[V,q,F,U.filter,j,R].join(":"),P=this._encoderBufferViews[O],D=this._encoderBufferViewData[O],C=this._encoderBufferViewAccessors[O];if(!P||!D)C=this._encoderBufferViewAccessors[O]=[],D=this._encoderBufferViewData[O]=[],P=this._encoderBufferViews[O]={buffer:W,target:qX.USAGE_TO_TARGET[V],byteOffset:0,byteLength:0,byteStride:V===qX.BufferViewUsage.ARRAY_BUFFER?j:void 0,extensions:{[R6]:{buffer:R,byteOffset:0,byteLength:0,mode:F,filter:U.filter!==B8.NONE?U.filter:void 0,byteStride:j,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[R6].buffer],W=Z.otherBufferViews.get(Q)||[],{count:K,byteStride:G,mode:z}=Y.extensions[R6],H=f6.concat($),V=J.encodeGltfBuffer(H,K,G,z),q=f6.pad(V);Y.extensions[R6].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[R6];q.byteOffset=V,J+=f6.padNumber(W.byteLength)}let X=this._encoderFallbackBuffer,Y=Z.bufferIndexMap.get(X),$=Z.jsonDoc.json.buffers[Y];return $.byteLength=J,$.extensions={[R6]:{fallback:!0}},X.dispose(),this}}Ez.EXTENSION_NAME=R6;Ez.EncoderMethod=Tz;class Ao{match(Z){return Z.length>=12&&f6.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=No(J,0);if(!X)return null;let Y=X.end;while(X=No(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 VB extends A1{constructor(...Z){super(...Z);this.extensionName=Pz,this.prereadTypes=[o.TEXTURE]}static register(){m4.registerFormat("image/avif",new Ao)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((X)=>{if(X.extensions&&X.extensions[Pz])X.source=X.extensions[Pz].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[Pz]={source:Q.source},delete Q.source})}}),this}}VB.EXTENSION_NAME=Pz;function No(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:f6.decodeText(new Uint8Array(Z.buffer,Z.byteOffset+J+4,4)),start:J+8,end:J+X}}class xo{match(Z){return Z.length>=12&&Z[8]===87&&Z[9]===69&&Z[10]===66&&Z[11]===80}getSize(Z){let J=f6.decodeText(Z.slice(0,4)),X=f6.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=f6.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 qB extends A1{constructor(...Z){super(...Z);this.extensionName=Dz,this.prereadTypes=[o.TEXTURE]}static register(){m4.registerFormat("image/webp",new xo)}preread(Z){return(Z.jsonDoc.json.textures||[]).forEach((X)=>{if(X.extensions&&X.extensions[Dz])X.source=X.extensions[Dz].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[Dz]={source:Q.source},delete Q.source})}}),this}}qB.EXTENSION_NAME=Dz;var s8,ho,fo;function yR1(Z,J){let X=new s8.DecoderBuffer;try{if(X.Init(J,J.length),Z.GetEncodedGeometryType(X)!==s8.TRIANGULAR_MESH)throw new Error(`[${G8}] Unknown geometry type.`);let $=new s8.Mesh;if(!Z.DecodeBufferToMesh(X,$).ok()||$.ptr===0)throw new Error(`[${G8}] Decoding failure.`);return $}finally{s8.destroy(X)}}function gR1(Z,J){let Y=J.num_faces()*3,$,Q;if(J.num_points()<=65534){let W=Y*Uint16Array.BYTES_PER_ELEMENT;$=s8._malloc(W),Z.GetTrianglesUInt16Array(J,W,$),Q=new Uint16Array(s8.HEAPU16.buffer,$,Y).slice()}else{let W=Y*Uint32Array.BYTES_PER_ELEMENT;$=s8._malloc(W),Z.GetTrianglesUInt32Array(J,W,$),Q=new Uint32Array(s8.HEAPU32.buffer,$,Y).slice()}return s8._free($),Q}function mR1(Z,J,X,Y){let $=fo[Y.componentType],Q=ho[Y.componentType],W=X.num_components(),G=J.num_points()*W,z=G*Q.BYTES_PER_ELEMENT,H=s8._malloc(z);Z.GetAttributeDataArrayForAllPoints(J,X,$,z,H);let V=new Q(s8.HEAPF32.buffer,H,G).slice();return s8._free(H),V}function uR1(Z){s8=Z,ho={[C0.ComponentType.FLOAT]:Float32Array,[C0.ComponentType.UNSIGNED_INT]:Uint32Array,[C0.ComponentType.UNSIGNED_SHORT]:Uint16Array,[C0.ComponentType.UNSIGNED_BYTE]:Uint8Array,[C0.ComponentType.SHORT]:Int16Array,[C0.ComponentType.BYTE]:Int8Array},fo={[C0.ComponentType.FLOAT]:s8.DT_FLOAT32,[C0.ComponentType.UNSIGNED_INT]:s8.DT_UINT32,[C0.ComponentType.UNSIGNED_SHORT]:s8.DT_UINT16,[C0.ComponentType.UNSIGNED_BYTE]:s8.DT_UINT8,[C0.ComponentType.SHORT]:s8.DT_INT16,[C0.ComponentType.BYTE]:s8.DT_INT8}}var d9,kz;(function(Z){Z[Z.EDGEBREAKER=1]="EDGEBREAKER",Z[Z.SEQUENTIAL=0]="SEQUENTIAL"})(kz||(kz={}));var p9;(function(Z){Z.POSITION="POSITION",Z.NORMAL="NORMAL",Z.COLOR="COLOR",Z.TEX_COORD="TEX_COORD",Z.GENERIC="GENERIC"})(p9||(p9={}));var bo={[p9.POSITION]:14,[p9.NORMAL]:10,[p9.COLOR]:8,[p9.TEX_COORD]:12,[p9.GENERIC]:12},Do={decodeSpeed:5,encodeSpeed:5,method:kz.EDGEBREAKER,quantizationBits:bo,quantizationVolume:"mesh"};function dR1(Z){d9=Z}function cR1(Z,J=Do){let X=tZ({},Do,J);X.quantizationBits=tZ({},bo,J.quantizationBits);let Y=new d9.MeshBuilder,$=new d9.Mesh,Q=new d9.ExpertEncoder($),W={},K=new d9.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 j=lR1(B),N=pR1(Y,w.getComponentType(),$,d9[j],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[j]);else if(typeof X.quantizationVolume==="object"){let{quantizationVolume:R}=X,O=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[j],w.getElementSize(),R.min,O)}else throw new Error("Invalid quantization volume state.")}let H=Z.getIndices();if(!H)throw new GB("Primitive must have indices.");if(Y.AddFacesToMesh($,H.getCount()/3,H.getArray()),Q.SetSpeedOptions(X.encodeSpeed,X.decodeSpeed),Q.SetTrackEncodedProperties(!0),X.method===kz.SEQUENTIAL||G||z)Q.SetEncodingMethod(d9.MESH_SEQUENTIAL_ENCODING);else Q.SetEncodingMethod(d9.MESH_EDGEBREAKER_ENCODING);let V=Q.EncodeToDracoBuffer(!(G||z),K);if(V<=0)throw new GB("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 d9.destroy(K),d9.destroy($),d9.destroy(Y),d9.destroy(Q),{numVertices:F,numIndices:U,data:q,attributeIDs:W}}function lR1(Z){if(Z==="POSITION")return p9.POSITION;else if(Z==="NORMAL")return p9.NORMAL;else if(Z.startsWith("COLOR_"))return p9.COLOR;else if(Z.startsWith("TEXCOORD_"))return p9.TEX_COORD;return p9.GENERIC}function pR1(Z,J,X,Y,$,Q,W){switch(J){case C0.ComponentType.UNSIGNED_BYTE:return Z.AddUInt8Attribute(X,Y,$,Q,W);case C0.ComponentType.BYTE:return Z.AddInt8Attribute(X,Y,$,Q,W);case C0.ComponentType.UNSIGNED_SHORT:return Z.AddUInt16Attribute(X,Y,$,Q,W);case C0.ComponentType.SHORT:return Z.AddInt16Attribute(X,Y,$,Q,W);case C0.ComponentType.UNSIGNED_INT:return Z.AddUInt32Attribute(X,Y,$,Q,W);case C0.ComponentType.FLOAT:return Z.AddFloatAttribute(X,Y,$,Q,W);default:throw new Error(`Unexpected component type, "${J}".`)}}class GB extends Error{}class Iz extends A1{constructor(...Z){super(...Z);this.extensionName=G8,this.prereadTypes=[o.PRIMITIVE],this.prewriteTypes=[o.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,uR1(this._decoderModule);if(Z==="draco3d.encoder")this._encoderModule=J,dR1(this._encoderModule);return this}setEncoderOptions(Z){return this._encoderOptions=Z,this}preread(Z){if(!this._decoderModule)throw new Error(`[${G8}] 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[G8])continue;let K=W.extensions[G8],[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[DT],F=H.byteOffset||0,U=H.byteLength,B=f6.toView(q,F,U);G=new this._decoderModule.Decoder,z=yR1(G,B),Y.set(K.bufferView,[G,z]),J.debug(`[${G8}] 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=mR1(G,z,q,V);Z.accessors[W.attributes[H]].setArray(F)}if(W.indices!==void 0)Z.accessors[W.indices].setArray(gR1(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(`[${G8}] Please install extension dependency, "draco3d.encoder".`);let X=this.document.getLogger();X.debug(`[${G8}] Compression options: ${JSON.stringify(this._encoderOptions)}`);let Y=iR1(this.document),$=new Map,Q="mesh";if(this._encoderOptions.quantizationVolume==="scene")if(this.document.getRoot().listScenes().length!==1)X.warn(`[${G8}]: quantizationVolume=scene requires exactly 1 scene.`);else Q=Vo(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=cR1(W,tZ({},this._encoderOptions,{quantizationVolume:Q}))}catch(F){if(F instanceof GB){X.warn(`[${G8}]: ${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&&C0.getComponentSize(V.componentType)<=2)V.componentType=C0.ComponentType.UNSIGNED_INT;else if(H.numVertices>254&&C0.getComponentSize(V.componentType)<=1)V.componentType=C0.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(`[${G8}] Compressed ${Y.size} primitives.`),Z.extensionData[G8]={primitiveHashMap:Y,primitiveEncodingMap:$},this}write(Z){let J=Z.extensionData[G8];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[G8]={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!==G8),X.extensionsRequired=(X.extensionsRequired||[]).filter((Y)=>Y!==G8)}return this}}Iz.EXTENSION_NAME=G8;Iz.EncoderMethod=kz;function iR1(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()!==VX.Mode.TRIANGLES)Y.add(q),Q++;else X.add(q);if($>0)J.warn(`[${G8}] Skipping Draco compression of ${$} non-indexed primitives.`);if(Q>0)J.warn(`[${G8}] 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=Po(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=Po(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(o.PRIMITIVE)||!q.has(o.ROOT))throw new Error(`[${G8}] 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(`[${G8}] 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(`[${G8}] Accessor cannot be shared by compressed and uncompressed primitives.`)}return H}function Po(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 cW extends Z8{init(){this.extensionName=c9,this.propertyType="Light",this.parentTypes=[o.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{color:[1,1,1],intensity:1,type:cW.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)}}cW.EXTENSION_NAME=c9;cW.Type={POINT:"point",SPOT:"spot",DIRECTIONAL:"directional"};class fT extends A1{constructor(...Z){super(...Z);this.extensionName=c9}createLight(Z=""){return new cW(this.document.getGraph(),Z)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[c9])return this;let $=(J.json.extensions[c9].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[c9])return;let K=Q.extensions[c9];Z.nodes[W].setExtension(c9,$[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(!w8.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()===cW.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(c9);if(Q){let W=Z.nodeIndexMap.get($),K=J.json.nodes[W];K.extensions=K.extensions||{},K.extensions[c9]={light:Y.get(Q)}}}),J.json.extensions=J.json.extensions||{},J.json.extensions[c9]={lights:X},this}}fT.EXTENSION_NAME=c9;var{R:nR1,G:aR1,B:sR1}=z9;class bT extends Z8{init(){this.extensionName=gZ,this.propertyType="Anisotropy",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{anisotropyStrength:0,anisotropyRotation:0,anisotropyTexture:null,anisotropyTextureInfo:new v1(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:nR1|aR1|sR1})}}bT.EXTENSION_NAME=gZ;class yT extends A1{constructor(...Z){super(...Z);this.extensionName=gZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createAnisotropy(){return new bT(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[gZ]){let W=this.createAnisotropy();Z.materials[Q].setExtension(gZ,W);let K=$.extensions[gZ];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(gZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[gZ]={};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}}yT.EXTENSION_NAME=gZ;var{R:Co,G:To,B:oR1}=z9;class gT extends Z8{init(){this.extensionName=mZ,this.propertyType="Clearcoat",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{clearcoatFactor:0,clearcoatTexture:null,clearcoatTextureInfo:new v1(this.graph,"clearcoatTextureInfo"),clearcoatRoughnessFactor:0,clearcoatRoughnessTexture:null,clearcoatRoughnessTextureInfo:new v1(this.graph,"clearcoatRoughnessTextureInfo"),clearcoatNormalScale:1,clearcoatNormalTexture:null,clearcoatNormalTextureInfo:new v1(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:Co})}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:To})}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:Co|To|oR1})}}gT.EXTENSION_NAME=mZ;class mT extends A1{constructor(...Z){super(...Z);this.extensionName=mZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createClearcoat(){return new gT(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[mZ]){let W=this.createClearcoat();Z.materials[Q].setExtension(mZ,W);let K=$.extensions[mZ];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(mZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[mZ]={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}}mT.EXTENSION_NAME=mZ;var{R:rR1,G:tR1,B:eR1,A:ZN1}=z9;class uT extends Z8{init(){this.extensionName=uZ,this.propertyType="DiffuseTransmission",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseTransmissionFactor:0,diffuseTransmissionTexture:null,diffuseTransmissionTextureInfo:new v1(this.graph,"diffuseTransmissionTextureInfo"),diffuseTransmissionColorFactor:[1,1,1],diffuseTransmissionColorTexture:null,diffuseTransmissionColorTextureInfo:new v1(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:ZN1})}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:rR1|tR1|eR1})}}uT.EXTENSION_NAME=uZ;class dT extends A1{constructor(...Z){super(...Z);this.extensionName=uZ}createDiffuseTransmission(){return new uT(this.document.getGraph())}read(Z){let J=Z.jsonDoc,X=J.json.materials||[],Y=J.json.textures||[];return X.forEach(($,Q)=>{if($.extensions&&$.extensions[uZ]){let W=this.createDiffuseTransmission();Z.materials[Q].setExtension(uZ,W);let K=$.extensions[uZ];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(uZ);if(!Y)continue;let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[uZ]={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}}dT.EXTENSION_NAME=uZ;class cT extends Z8{init(){this.extensionName=dZ,this.propertyType="Dispersion",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{dispersion:0})}getDispersion(){return this.get("dispersion")}setDispersion(Z){return this.set("dispersion",Z)}}cT.EXTENSION_NAME=dZ;class lT extends A1{constructor(...Z){super(...Z);this.extensionName=dZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createDispersion(){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[dZ]){let Q=this.createDispersion();Z.materials[$].setExtension(dZ,Q);let W=Y.extensions[dZ];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(dZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[dZ]={dispersion:Y.getDispersion()}}}),this}}lT.EXTENSION_NAME=dZ;class pT extends Z8{init(){this.extensionName=cZ,this.propertyType="EmissiveStrength",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{emissiveStrength:1})}getEmissiveStrength(){return this.get("emissiveStrength")}setEmissiveStrength(Z){return this.set("emissiveStrength",Z)}}pT.EXTENSION_NAME=cZ;class iT extends A1{constructor(...Z){super(...Z);this.extensionName=cZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createEmissiveStrength(){return new pT(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[cZ]){let Q=this.createEmissiveStrength();Z.materials[$].setExtension(cZ,Q);let W=Y.extensions[cZ];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(cZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[cZ]={emissiveStrength:Y.getEmissiveStrength()}}}),this}}iT.EXTENSION_NAME=cZ;class nT extends Z8{init(){this.extensionName=lZ,this.propertyType="IOR",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{ior:1.5})}getIOR(){return this.get("ior")}setIOR(Z){return this.set("ior",Z)}}nT.EXTENSION_NAME=lZ;class FB extends A1{constructor(...Z){super(...Z);this.extensionName=lZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createIOR(){return new nT(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[lZ]){let Q=this.createIOR();Z.materials[$].setExtension(lZ,Q);let W=Y.extensions[lZ];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(lZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{},Q.extensions[lZ]={ior:Y.getIOR()}}}),this}}FB.EXTENSION_NAME=lZ;var{R:JN1,G:XN1}=z9;class aT extends Z8{init(){this.extensionName=pZ,this.propertyType="Iridescence",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{iridescenceFactor:0,iridescenceTexture:null,iridescenceTextureInfo:new v1(this.graph,"iridescenceTextureInfo"),iridescenceIOR:1.3,iridescenceThicknessMinimum:100,iridescenceThicknessMaximum:400,iridescenceThicknessTexture:null,iridescenceThicknessTextureInfo:new v1(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:JN1})}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:XN1})}}aT.EXTENSION_NAME=pZ;class sT extends A1{constructor(...Z){super(...Z);this.extensionName=pZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createIridescence(){return new aT(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[pZ]){let W=this.createIridescence();Z.materials[Q].setExtension(pZ,W);let K=$.extensions[pZ];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(pZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[pZ]={};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}}sT.EXTENSION_NAME=pZ;var{R:ko,G:Eo,B:Io,A:vo}=z9;class oT extends Z8{init(){this.extensionName=iZ,this.propertyType="PBRSpecularGlossiness",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseFactor:[1,1,1,1],diffuseTexture:null,diffuseTextureInfo:new v1(this.graph,"diffuseTextureInfo"),specularFactor:[1,1,1],glossinessFactor:1,specularGlossinessTexture:null,specularGlossinessTextureInfo:new v1(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:ko|Eo|Io|vo,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:ko|Eo|Io|vo})}}oT.EXTENSION_NAME=iZ;class UB extends A1{constructor(...Z){super(...Z);this.extensionName=iZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createPBRSpecularGlossiness(){return new oT(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[iZ]){let W=this.createPBRSpecularGlossiness();Z.materials[Q].setExtension(iZ,W);let K=$.extensions[iZ];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(iZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[iZ]={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}}UB.EXTENSION_NAME=iZ;var{R:YN1,G:$N1,B:QN1,A:WN1}=z9;class rT extends Z8{init(){this.extensionName=nZ,this.propertyType="Sheen",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{sheenColorFactor:[0,0,0],sheenColorTexture:null,sheenColorTextureInfo:new v1(this.graph,"sheenColorTextureInfo"),sheenRoughnessFactor:0,sheenRoughnessTexture:null,sheenRoughnessTextureInfo:new v1(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:YN1|$N1|QN1,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:WN1})}}rT.EXTENSION_NAME=nZ;class tT extends A1{constructor(...Z){super(...Z);this.extensionName=nZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createSheen(){return new rT(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[nZ]){let W=this.createSheen();Z.materials[Q].setExtension(nZ,W);let K=$.extensions[nZ];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(nZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[nZ]={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}}tT.EXTENSION_NAME=nZ;var{R:KN1,G:GN1,B:zN1,A:HN1}=z9;class eT extends Z8{init(){this.extensionName=aZ,this.propertyType="Specular",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{specularFactor:1,specularTexture:null,specularTextureInfo:new v1(this.graph,"specularTextureInfo"),specularColorFactor:[1,1,1],specularColorTexture:null,specularColorTextureInfo:new v1(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:HN1})}getSpecularColorTexture(){return this.getRef("specularColorTexture")}getSpecularColorTextureInfo(){return this.getRef("specularColorTexture")?this.getRef("specularColorTextureInfo"):null}setSpecularColorTexture(Z){return this.setRef("specularColorTexture",Z,{channels:KN1|GN1|zN1,isColor:!0})}}eT.EXTENSION_NAME=aZ;class wB extends A1{constructor(...Z){super(...Z);this.extensionName=aZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createSpecular(){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[aZ]){let W=this.createSpecular();Z.materials[Q].setExtension(aZ,W);let K=$.extensions[aZ];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(aZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[aZ]={};if(Y.getSpecularFactor()!==1)W.specularFactor=Y.getSpecularFactor();if(!w8.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}}wB.EXTENSION_NAME=aZ;var{R:VN1}=z9;class Zk extends Z8{init(){this.extensionName=sZ,this.propertyType="Transmission",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{transmissionFactor:0,transmissionTexture:null,transmissionTextureInfo:new v1(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:VN1})}}Zk.EXTENSION_NAME=sZ;class Jk extends A1{constructor(...Z){super(...Z);this.extensionName=sZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createTransmission(){return new Zk(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[sZ]){let W=this.createTransmission();Z.materials[Q].setExtension(sZ,W);let K=$.extensions[sZ];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(sZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[sZ]={transmissionFactor:Y.getTransmissionFactor()};if(Y.getTransmissionTexture()){let K=Y.getTransmissionTexture(),G=Y.getTransmissionTextureInfo();W.transmissionTexture=Z.createTextureInfoDef(K,G)}}}),this}}Jk.EXTENSION_NAME=sZ;class Xk extends Z8{init(){this.extensionName=FX,this.propertyType="Unlit",this.parentTypes=[o.MATERIAL]}}Xk.EXTENSION_NAME=FX;class BB extends A1{constructor(...Z){super(...Z);this.extensionName=FX,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createUnlit(){return new Xk(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[FX])Z.materials[Y].setExtension(FX,this.createUnlit())}),this}prewrite(Z){let J=Z.jsonDoc;return this.document.getRoot().listMaterials().forEach((X)=>{if(X.getExtension(FX)){let Y=Z.materialIndexMap.get(X),$=J.json.materials[Y];$.extensions=$.extensions||{},$.extensions[FX]={}}}),this}}BB.EXTENSION_NAME=FX;class Yk extends Z8{init(){this.extensionName=y6,this.propertyType="Mapping",this.parentTypes=["MappingList"]}getDefaults(){return Object.assign(super.getDefaults(),{material:null,variants:new I0})}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")}}Yk.EXTENSION_NAME=y6;class $k extends Z8{init(){this.extensionName=y6,this.propertyType="MappingList",this.parentTypes=[o.PRIMITIVE]}getDefaults(){return Object.assign(super.getDefaults(),{mappings:new I0})}addMapping(Z){return this.addRef("mappings",Z)}removeMapping(Z){return this.removeRef("mappings",Z)}listMappings(){return this.listRefs("mappings")}}$k.EXTENSION_NAME=y6;class zB extends Z8{init(){this.extensionName=y6,this.propertyType="Variant",this.parentTypes=["MappingList"]}}zB.EXTENSION_NAME=y6;class Qk extends A1{constructor(...Z){super(...Z);this.extensionName=y6}createMappingList(){return new $k(this.document.getGraph())}createVariant(Z=""){return new zB(this.document.getGraph(),Z)}createMapping(){return new Yk(this.document.getGraph())}listVariants(){return Array.from(this.properties).filter((Z)=>Z instanceof zB)}read(Z){let J=Z.jsonDoc;if(!J.json.extensions||!J.json.extensions[y6])return this;let $=(J.json.extensions[y6].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[y6])return;let q=this.createMappingList(),F=H.extensions[y6];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(y6,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(y6);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[y6]={mappings:V}})}return J.json.extensions=J.json.extensions||{},J.json.extensions[y6]={variants:Y},this}}Qk.EXTENSION_NAME=y6;var{G:qN1}=z9;class Wk extends Z8{init(){this.extensionName=oZ,this.propertyType="Volume",this.parentTypes=[o.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{thicknessFactor:0,thicknessTexture:null,thicknessTextureInfo:new v1(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:qN1})}getAttenuationDistance(){return this.get("attenuationDistance")}setAttenuationDistance(Z){return this.set("attenuationDistance",Z)}getAttenuationColor(){return this.get("attenuationColor")}setAttenuationColor(Z){return this.set("attenuationColor",Z)}}Wk.EXTENSION_NAME=oZ;class Kk extends A1{constructor(...Z){super(...Z);this.extensionName=oZ,this.prereadTypes=[o.MESH],this.prewriteTypes=[o.MESH]}createVolume(){return new Wk(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[oZ]){let W=this.createVolume();Z.materials[Q].setExtension(oZ,W);let K=$.extensions[oZ];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(oZ);if(Y){let $=Z.materialIndexMap.get(X),Q=J.json.materials[$];Q.extensions=Q.extensions||{};let W=Q.extensions[oZ]={};if(Y.getThicknessFactor()>0)W.thicknessFactor=Y.getThicknessFactor();if(Number.isFinite(Y.getAttenuationDistance()))W.attenuationDistance=Y.getAttenuationDistance();if(!w8.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}}Kk.EXTENSION_NAME=oZ;class vz extends A1{constructor(...Z){super(...Z);this.extensionName=So}read(Z){return this}write(Z){return this}}vz.EXTENSION_NAME=So;class yo{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=KB(Z);return[J.pixelWidth,J.pixelHeight]}getChannels(Z){let X=KB(Z).dataFormatDescriptor[0];if(X.colorModel===Lo)return X.samples.length===2&&(X.samples[1].channelType&15)===15?4:3;else if(X.colorModel===jo)return(X.samples[0].channelType&15)===3?4:3;throw new Error(`Unexpected KTX2 colorModel, "${X.colorModel}".`)}getVRAMByteLength(Z){let J=KB(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 Gk extends A1{constructor(...Z){super(...Z);this.extensionName=Cz,this.prereadTypes=[o.TEXTURE]}static register(){m4.registerFormat("image/ktx2",new yo)}preread(Z){return Z.jsonDoc.json.textures.forEach((J)=>{if(J.extensions&&J.extensions[Cz]){let X=J.extensions[Cz];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[Cz]={source:$.source},delete $.source})}}),this}}Gk.EXTENSION_NAME=Cz;class zk extends Z8{init(){this.extensionName=rZ,this.propertyType="Transform",this.parentTypes=[o.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)}}zk.EXTENSION_NAME=rZ;class Hk extends A1{constructor(...Z){super(...Z);this.extensionName=rZ}createTransform(){return new zk(this.document.getGraph())}read(Z){for(let[J,X]of Array.from(Z.textureInfos.entries())){if(!X.extensions||!X.extensions[rZ])continue;let Y=this.createTransform(),$=X.extensions[rZ];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(rZ,Y)}return this}write(Z){let J=Array.from(Z.textureInfoDefMap.entries());for(let[X,Y]of J){let $=X.getExtension(rZ);if(!$)continue;Y.extensions=Y.extensions||{};let Q={},W=w8.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[rZ]=Q}return this}}Hk.EXTENSION_NAME=rZ;var FN1=[o.ROOT,o.SCENE,o.NODE,o.MESH,o.MATERIAL,o.TEXTURE,o.ANIMATION];class Vk extends Z8{init(){this.extensionName=l9,this.propertyType="Packet",this.parentTypes=FN1}getDefaults(){return Object.assign(super.getDefaults(),{context:{},properties:{}})}getContext(){return this.get("context")}setContext(Z){return this.set("context",tZ({},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=tZ({},this.get("properties"));if(J)X[Z]=J;else delete X[Z];return this.set("properties",X)}toJSONLD(){let Z=_T(this.get("context")),J=_T(this.get("properties"));return tZ({"@context":Z},J)}fromJSONLD(Z){Z=_T(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(`${l9}: Missing context for term, "${Z}".`)}}Vk.EXTENSION_NAME=l9;function _T(Z){return JSON.parse(JSON.stringify(Z))}class qk extends A1{constructor(...Z){super(...Z);this.extensionName=l9}createPacket(){return new Vk(this.document.getGraph())}listPackets(){return Array.from(this.properties)}read(Z){var J;let X=(J=Z.jsonDoc.json.extensions)==null?void 0:J[l9];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[l9]){let q=V.extensions[l9];K[G][H].setExtension(l9,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 o.ROOT:Q=J.asset;break;case o.SCENE:Q=J.scenes[Z.sceneIndexMap.get($)];break;case o.NODE:Q=J.nodes[Z.nodeIndexMap.get($)];break;case o.MESH:Q=J.meshes[Z.meshIndexMap.get($)];break;case o.MATERIAL:Q=J.materials[Z.materialIndexMap.get($)];break;case o.TEXTURE:Q=J.images[Z.imageIndexMap.get($)];break;case o.ANIMATION:Q=J.animations[Z.animationIndexMap.get($)];break;default:Q=null,this.document.getLogger().warn(`[${l9}]: Unsupported parent property, "${$.propertyType}"`);break}if(!Q)continue;Q.extensions=Q.extensions||{},Q.extensions[l9]={packet:X.length-1}}}if(X.length>0)J.extensions=J.extensions||{},J.extensions[l9]={packets:X};return this}}qk.EXTENSION_NAME=l9;var UN1=[Iz,fT,yT,mT,dT,lT,iT,FB,sT,UB,wB,tT,Jk,BB,Qk,Kk,vz,Gk,Hk,qk],zL6=[HB,Ez,VB,qB,...UN1];var wN1=e(pC(),1);function iW(){return iW=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},iW.apply(null,arguments)}var{POINTS:go,LINES:LB,LINE_STRIP:BN1,LINE_LOOP:LN1,TRIANGLES:jB,TRIANGLE_STRIP:jN1,TRIANGLE_FAN:ON1}=E8.Mode;function LX(Z,J){return Object.defineProperty(J,"name",{value:Z}),J}function x7(Z,J){let X=iW({},Z);for(let Y in J)if(J[Y]!==void 0)X[Y]=J[Y];return X}function Wr(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 MN1=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function Bk(Z){return MN1.format(Z)}function RN1(Z,J,X=2){let Y=Z>J?"\u2013":"+",$="%";return Y+(Math.abs(Z-J)/Z*100).toFixed(X)+"%"}function DB(Z,J){return`${Bk(Z)} \u2192 ${Bk(J)} (${RN1(Z,J)})`}function Dk(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 NN1(Z,J,X){Z.swap(J,X);for(let Y of Z.listTargets())Y.swap(J,X)}function DN1(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 PN1(Z,J=Z){let X=Pk(Z,J);for(let Y=0;Y<X.length;Y++)X[Y]=Y;return X}function Pk(Z,J=Z){return J<=65534?new Uint16Array(Z):new Uint32Array(Z)}function CN1(Z){return Z.listParents().some((J)=>J.propertyType!==s.ROOT)}function Kr(Z){for(let J in Z)return!1;return!0}function Gr(Z){let J=x6.fromGraph(Z.getGraph()),X=Z.getMaterial(),Y=J.getRoot().listMaterials().indexOf(X),$=kN1[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 TN1(Z){return Math.pow(2,Math.ceil(Math.log(Z)/Math.LN2))}var kN1={[go]:go,[LB]:LB,[BN1]:LB,[LN1]:LB,[jB]:jB,[jN1]:jB,[ON1]:jB},lW="center",mo={pivot:"center"};function zr(Z=mo){let J=x7(mo,Z);return LX(lW,(X)=>{let Y=X.getLogger(),$=X.getRoot(),Q=$.listAnimations().length>0||$.listSkins().length>0;X.getRoot().listScenes().forEach((W,K)=>{Y.debug(`${lW}: Scene ${K+1} / ${$.listScenes().length}.`);let G;if(typeof J.pivot==="string"){let H=yC(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(`${lW}: Pivot "${G.join(", ")}".`);let z=[-1*G[0],-1*G[1],-1*G[2]];if(Q){Y.debug(`${lW}: 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(`${lW}: 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(`${lW}: Complete.`)})}function EN1(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 vW)}function IN1(Z){let J=EN1(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 nW=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 vN1(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],j=J[15],N=X*K-Y*W,R=X*G-$*W,O=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,A=H*j-F*U,v=V*w-q*B,x=V*j-F*B,I=q*j-F*w,S=N*I-R*x+O*v+P*A-D*k+C*T;if(!S)return null;return S=1/S,Z[0]=(K*I-G*x+z*v)*S,Z[1]=($*x-Y*I-Q*v)*S,Z[2]=(B*C-w*D+j*P)*S,Z[3]=(q*D-V*C-F*P)*S,Z[4]=(G*A-W*I-z*k)*S,Z[5]=(X*I-$*A+Q*k)*S,Z[6]=(w*O-U*C-j*R)*S,Z[7]=(H*C-q*O+F*R)*S,Z[8]=(W*x-K*A+z*T)*S,Z[9]=(Y*A-X*x-Q*T)*S,Z[10]=(U*D-B*O+j*N)*S,Z[11]=(V*O-H*D-F*N)*S,Z[12]=(K*k-W*v-G*T)*S,Z[13]=(X*v-Y*k+$*T)*S,Z[14]=(B*R-U*P-w*N)*S,Z[15]=(H*P-V*R+q*N)*S,Z}function SN1(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],j=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,O=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,A=H*B-V*U,v=H*w-q*U,x=V*w-q*B;return j*x-N*v+R*A+O*k-P*T+D*C}function Hr(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],j=J[14],N=J[15],R=X[0],O=X[1],P=X[2],D=X[3];return Z[0]=R*Y+O*K+P*V+D*B,Z[1]=R*$+O*G+P*q+D*w,Z[2]=R*Q+O*z+P*F+D*j,Z[3]=R*W+O*H+P*U+D*N,R=X[4],O=X[5],P=X[6],D=X[7],Z[4]=R*Y+O*K+P*V+D*B,Z[5]=R*$+O*G+P*q+D*w,Z[6]=R*Q+O*z+P*F+D*j,Z[7]=R*W+O*H+P*U+D*N,R=X[8],O=X[9],P=X[10],D=X[11],Z[8]=R*Y+O*K+P*V+D*B,Z[9]=R*$+O*G+P*q+D*w,Z[10]=R*Q+O*z+P*F+D*j,Z[11]=R*W+O*H+P*U+D*N,R=X[12],O=X[13],P=X[14],D=X[15],Z[12]=R*Y+O*K+P*V+D*B,Z[13]=R*$+O*G+P*q+D*w,Z[14]=R*Q+O*z+P*F+D*j,Z[15]=R*W+O*H+P*U+D*N,Z}function _N1(){var Z=new nW(9);if(nW!=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 AN1(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 xN1(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 hN1(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 PB(){var Z=new nW(3);if(nW!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function fN1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z}function Vr(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 bN1(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 yN1(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 gN1=fN1;(function(){var Z=PB();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 wX="dedup",Fk={keepUniqueNames:!1,propertyTypes:[s.ACCESSOR,s.MESH,s.TEXTURE,s.MATERIAL,s.SKIN]};function qr(Z=Fk){let J=x7(Fk,Z),X=new Set(J.propertyTypes);for(let Y of J.propertyTypes)if(!Fk.propertyTypes.includes(Y))throw new Error(`${wX}: Unsupported deduplication on type "${Y}".`);return LX(wX,(Y)=>{let $=Y.getLogger();if(X.has(s.ACCESSOR))mN1(Y);if(X.has(s.TEXTURE))dN1(Y,J);if(X.has(s.MATERIAL))cN1(Y,J);if(X.has(s.MESH))uN1(Y,J);if(X.has(s.SKIN))lN1(Y,J);$.debug(`${wX}: Complete.`)})}function mN1(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=a0.toView(U.getArray());if(q.has(U))continue;for(let w=F+1;w<V.length;w++){let j=V[w];if(q.has(j))continue;if(a0.equals(B,a0.toView(j.getArray())))q.set(j,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(`${wX}: 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 uN1(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(Fr(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!==s.ROOT)V.swap(K,H)}),K.dispose()}else W.set(z,K)}X.debug(`${wX}: Merged ${Q-W.size} of ${Q} meshes.`)}function dN1(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(a0.equals(G,V))Q.set(H,K)}}X.debug(`${wX}: Merged ${Q.size} of ${Y.listTextures().length} textures.`),Array.from(Q.entries()).forEach(([W,K])=>{W.listParents().forEach((G)=>{if(!(G instanceof H$))G.swap(W,K)}),W.dispose()})}function cN1(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(uo(z,W))continue;for(let H=G+1;H<$.length;H++){let V=$[H];if(Q.has(V))continue;if(uo(V,W))continue;if(z.equals(V,K))Q.set(V,z)}}X.debug(`${wX}: Merged ${Q.size} of ${$.length} materials.`),Array.from(Q.entries()).forEach(([G,z])=>{G.listParents().forEach((H)=>{if(!(H instanceof H$))H.swap(G,z)}),G.dispose()})}function lN1(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)&&DN1(G.listJoints(),H.listJoints()))Q.set(H,G)}}X.debug(`${wX}: Merged ${Q.size} of ${$.length} skins.`),Array.from(Q.entries()).forEach(([K,G])=>{K.listParents().forEach((z)=>{if(!(z instanceof H$))z.swap(K,G)}),K.dispose()})}function Fr(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:"+Fr(Q,J))}return X.join(",")}function uo(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 Ur(){var Z=new nW(4);if(nW!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function pN1(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 iN1(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 nN1(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 aN1(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 sN1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return Math.hypot(J,X,Y,$)}var wr=iN1,oN1=nN1,Br=sN1;(function(){var Z=Ur();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 rN1=/color|emissive|diffuse/i;function tN1(Z){return Z.getGraph().listParentEdges(Z).some(($)=>{return $.getAttributes().isColor||rN1.test($.getName())})?"srgb":null}function eN1(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 z$)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 S5&&W.has(K.getName()))Y.add(G);else if(G instanceof IW)$(G)}}return $(Z),Array.from(Y)}function ZD1(Z){let X=x6.fromGraph(Z.getGraph()).getRoot(),Y=Z.getGraph().listParentEdges(Z).filter(($)=>$.getParent()!==X).map(($)=>$.getName());return Array.from(new Set(Y))}var pW="prune",Lk=0.011764705882352941,co={propertyTypes:[s.NODE,s.SKIN,s.MESH,s.CAMERA,s.PRIMITIVE,s.PRIMITIVE_TARGET,s.ANIMATION,s.MATERIAL,s.TEXTURE,s.ACCESSOR,s.BUFFER],keepLeaves:!1,keepAttributes:!1,keepIndices:!1,keepSolidTextures:!1,keepExtras:!1};function CB(Z=co){let J=x7(co,Z),X=new Set(J.propertyTypes),Y=J.keepExtras;return LX(pW,async($)=>{let Q=$.getLogger(),W=$.getRoot(),K=$.getGraph(),G=new Lr,z=(H)=>G.dispose(H.target);if(K.addEventListener("node:dispose",z),X.has(s.MESH))for(let H of W.listMeshes()){if(H.listPrimitives().length>0)continue;H.dispose()}if(X.has(s.NODE)){if(!J.keepLeaves)for(let H of W.listScenes())jr(K,H,Y);for(let H of W.listNodes())i9(H,Y)}if(X.has(s.SKIN))for(let H of W.listSkins())i9(H,Y);if(X.has(s.MESH))for(let H of W.listMeshes())i9(H,Y);if(X.has(s.CAMERA))for(let H of W.listCameras())i9(H,Y);if(X.has(s.PRIMITIVE))lo(K,s.PRIMITIVE,Y);if(X.has(s.PRIMITIVE_TARGET))lo(K,s.PRIMITIVE_TARGET,Y);if(!J.keepAttributes&&X.has(s.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=Or($,q,F),B=XD1(q,U);po(q,B),q.listTargets().forEach((w)=>po(w,B)),H.has(F)?H.get(F).add(q):H.set(F,new Set([q]))}for(let[V,q]of H)YD1(V,Array.from(q))}if(!J.keepIndices&&X.has(s.ACCESSOR))for(let H of W.listMeshes())for(let V of H.listPrimitives())JD1(V);if(X.has(s.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();i9(H,Y),V.forEach((q)=>i9(q,Y))}else H.listSamplers().forEach((V)=>i9(V,Y))}if(X.has(s.MATERIAL))W.listMaterials().forEach((H)=>i9(H,Y));if(X.has(s.TEXTURE)){if(W.listTextures().forEach((H)=>i9(H,Y)),!J.keepSolidTextures)await $D1($)}if(X.has(s.ACCESSOR))W.listAccessors().forEach((H)=>i9(H,Y));if(X.has(s.BUFFER))W.listBuffers().forEach((H)=>i9(H,Y));if(K.removeEventListener("node:dispose",z),!G.empty()){let H=G.entries().map(([V,q])=>`${V} (${q})`).join(", ");Q.info(`${pW}: Removed types... ${H}`)}else Q.debug(`${pW}: No unused properties found.`);Q.debug(`${pW}: Complete.`)})}class Lr{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 i9(Z,J){let X=Z.listParents().filter(($)=>!($ instanceof H$||$ instanceof K$)),Y=J&&!Kr(Z.getExtras());if(!X.length&&!Y)Z.dispose()}function lo(Z,J,X){for(let Y of Z.listEdges()){let $=Y.getParent();if($.propertyType===J)i9($,X)}}function jr(Z,J,X){if(J.listChildren().forEach((W)=>jr(Z,W,X)),J instanceof vW)return;let Y=Z.listParentEdges(J).some((W)=>{let K=W.getParent().propertyType;return K!==s.ROOT&&K!==s.SCENE&&K!==s.NODE}),$=Z.listChildren(J).length===0,Q=X&&!Kr(J.getExtras());if($&&!Y&&!Q)J.dispose()}function po(Z,J){for(let X of J)Z.setAttribute(X,null)}function JD1(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 XD1(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 Or(Z,J,X,Y=new Set){let Q=Z.getGraph().listChildEdges(X),W=new Set;for(let z of Q)if(z.getChild()instanceof z$)W.add(z.getName());for(let z of Q){let H=z.getName(),V=z.getChild();if(V instanceof S5){if(W.has(H.replace(/Info$/,"")))Y.add(`TEXCOORD_${V.getTexCoord()}`)}if(V instanceof z$&&H.match(/normalTexture/i))Y.add("TANGENT");if(V instanceof IW)Or(Z,J,V,Y)}let K=X instanceof k7&&!X.getExtension("KHR_materials_unlit"),G=J.getMode()===E8.Mode.POINTS;if(K&&!G)Y.add("NORMAL");return Y}function YD1(Z,J){let X=eN1(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 $D1(Z){let J=Z.getRoot(),X=Z.getGraph(),Y=Z.getLogger(),Q=J.listTextures().map(async(W)=>{var K;let G=await WD1(W);if(!G)return;if(tN1(W)==="srgb")gC.convertSRGBToLinear(G,G);let z=W.getName()||W.getURI(),H=(K=W.getSize())==null?void 0:K.join("x"),V=ZD1(W);for(let q of X.listParentEdges(W)){let F=q.getParent();if(F!==J&&QD1(F,G,q.getName(),Y))q.dispose()}if(W.listParents().length===1)W.dispose(),Y.debug(`${pW}: Removed solid-color texture "${z}" (${H}px ${V.join(", ")})`)});await Promise.all(Q)}function QD1(Z,J,X,Y){if(Z instanceof k7)switch(X){case"baseColorTexture":return Z.setBaseColorFactor(oN1(J,J,Z.getBaseColorFactor())),!0;case"emissiveTexture":return Z.setEmissiveFactor(gN1([0,0,0],J.slice(0,3),Z.getEmissiveFactor())),!0;case"occlusionTexture":return Math.abs(J[0]-1)<=Lk;case"metallicRoughnessTexture":return Z.setRoughnessFactor(J[1]*Z.getRoughnessFactor()),Z.setMetallicFactor(J[2]*Z.getMetallicFactor()),!0;case"normalTexture":return Br(wr(Ur(),J,[0.5,0.5,1,1]))<=Lk}return Y.warn(`${pW}: Detected single-color ${X} texture. Pruning ${X} not yet supported.`),!1}async function WD1(Z){let J=await KD1(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(Br(wr($,Y,X))/255>Lk)return null}return aN1($,pN1($,Y,X),0.00196078431372549)}async function KD1(Z){try{return await Qo(Z.getImage(),Z.getMimeType())}catch(J){return null}}var UX=4294967295;class Mr{constructor(Z){this.attributes=[],this.u8=void 0,this.u32=void 0;let J=0;for(let X of Dk(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(),$=a0.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 GD1(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 GD1(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 zD1(Z,J,X,Y,$=UX){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 N6;(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"})(N6||(N6={}));function BX(Z,J){let X=Z.getAttribute("POSITION"),Y=Z.getIndices();switch(J){case N6.RENDER:return Y?Y.getCount():X.getCount();case N6.RENDER_CACHED:return Y?new Set(Y.getArray()).size:X.getCount();case N6.UPLOAD_NAIVE:case N6.UPLOAD:return X.getCount();case N6.DISTINCT:case N6.DISTINCT_POSITION:return HD1(J);case N6.UNUSED:return Y?X.getCount()-new Set(Y.getArray()).size:0;default:return VD1(J)}}function HD1(Z){throw new Error(`Not implemented: ${Z}`)}function VD1(Z){throw new Error(`Unexpected value: ${Z}`)}function _z(Z,J,X){let Y=x6.fromGraph(Z.getGraph());if(!J||!X)[J,X]=qD1(Z);let $=Z.getIndices(),Q=$?$.getArray():null,W=BX(Z,N6.RENDER),K=Y.createAccessor(),G=W,z=Pk(G,X);for(let V=0;V<G;V++)z[V]=J[Q?Q[V]:V];Z.setIndices(K.setArray(z));let H=Dk(Z);for(let V of Z.listAttributes()){let q=eZ(Y,V);jk(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);jk(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 jk(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 qD1(Z){let J=BX(Z,N6.UPLOAD),X=Z.getIndices(),Y=X?X.getArray():null;if(!X||!Y)return[PN1(J,1e6),J];let $=new Uint32Array(J).fill(UX),Q=0;for(let W=0;W<Y.length;W++){let K=Y[W];if($[K]===UX)$[K]=Q++}return[$,Q]}var Ok="weld",MB={overwrite:!0,cleanup:!0};function Ck(Z=MB){let J=x7(MB,Z);return LX(Ok,async(X)=>{let Y=X.getLogger();for(let $ of X.getRoot().listMeshes()){for(let Q of $.listPrimitives())if(TB(Q,J),BX(Q,N6.RENDER)===0)Q.dispose();if($.listPrimitives().length===0)$.dispose()}if(J.cleanup)await X.transform(CB({propertyTypes:[s.ACCESSOR,s.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),qr({propertyTypes:[s.ACCESSOR]}));Y.debug(`${Ok}: Complete.`)})}function TB(Z,J=MB){let X=Z.getGraph(),$=x6.fromGraph(X).getLogger(),Q=iW({},MB,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 Mr(Z),V=TN1(W+W/4),q=new Uint32Array(V).fill(UX),F=new Uint32Array(W).fill(UX),U=0;for(let B=0;B<z;B++){let w=G?G[B]:B;if(F[w]!==UX)continue;let j=zD1(q,V,H,w,UX),N=q[j];if(N===UX)q[j]=w,F[w]=U++;else F[w]=F[N]}$.debug(`${Ok}: ${DB(W,U)} vertices.`),_z(Z,F,U)}var{FLOAT:FD1}=h0.ComponentType;function Rr(Z,J){let X=Z.getAttribute("POSITION");if(X)io(J,X);let Y=Z.getAttribute("NORMAL");if(Y)no(J,Y);let $=Z.getAttribute("TANGENT");if($)ao(J,$);for(let Q of Z.listTargets()){let W=Q.getAttribute("POSITION");if(W)io(J,W);let K=Q.getAttribute("NORMAL");if(K)no(J,K);let G=Q.getAttribute("TANGENT");if(G)ao(J,G)}if(SN1(J)<0)UD1(Z)}function io(Z,J){let X=J.getComponentType(),Y=J.getNormalized(),$=J.getArray(),Q=X===FD1?$:new Float32Array($.length),W=PB();for(let K=0,G=J.getCount();K<G;K++){if(Y)W[0]=l0.decodeNormalizedInt($[K*3],X),W[1]=l0.decodeNormalizedInt($[K*3+1],X),W[2]=l0.decodeNormalizedInt($[K*3+2],X);else W[0]=$[K*3],W[1]=$[K*3+1],W[2]=$[K*3+2];bN1(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 no(Z,J){let X=J.getArray(),Y=J.getNormalized(),$=J.getComponentType(),Q=_N1();AN1(Q,Z),hN1(Q,Q),xN1(Q,Q);let W=PB();for(let K=0,G=J.getCount();K<G;K++){if(Y)W[0]=l0.decodeNormalizedInt(X[K*3],$),W[1]=l0.decodeNormalizedInt(X[K*3+1],$),W[2]=l0.decodeNormalizedInt(X[K*3+2],$);else W[0]=X[K*3],W[1]=X[K*3+1],W[2]=X[K*3+2];if(yN1(W,W,Q),Vr(W,W),Y)X[K*3]=l0.decodeNormalizedInt(W[0],$),X[K*3+1]=l0.decodeNormalizedInt(W[1],$),X[K*3+2]=l0.decodeNormalizedInt(W[2],$);else X[K*3]=W[0],X[K*3+1]=W[1],X[K*3+2]=W[2]}}function ao(Z,J){let X=J.getArray(),Y=J.getNormalized(),$=J.getComponentType(),Q=PB();for(let W=0,K=J.getCount();W<K;W++){if(Y)Q[0]=l0.decodeNormalizedInt(X[W*4],$),Q[1]=l0.decodeNormalizedInt(X[W*4+1],$),Q[2]=l0.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],Vr(Q,Q),Y)X[W*4]=l0.decodeNormalizedInt(Q[0],$),X[W*4+1]=l0.decodeNormalizedInt(Q[1],$),X[W*4+2]=l0.decodeNormalizedInt(Q[2],$);else X[W*4]=Q[0],X[W*4+1]=Q[1],X[W*4+2]=Q[2]}}function UD1(Z){if(Z.getMode()!==E8.Mode.TRIANGLES)return;if(!Z.getIndices())TB(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 wD1(Z,J){for(let X of Z.listPrimitives()){let Y=BD1(X,Z);if(X!==Y)Z.removePrimitive(X).addPrimitive(Y)}for(let X of Z.listPrimitives())_z(X),Rr(X,J)}function BD1(Z,J){if(Z.listParents().some((Y)=>Y instanceof Gz&&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 so=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function Nr(Z){let J=Z.getMesh(),X=Z.getMatrix();if(J&&!l0.eq(X,so))wD1(J,X);for(let Y of Z.listChildren()){let $=Y.getMatrix();Hr($,$,X),Y.setMatrix($)}return Z.setMatrix(so)}var{LINES:LD1,LINE_STRIP:jD1,LINE_LOOP:OD1,TRIANGLES:MD1,TRIANGLE_STRIP:RD1,TRIANGLE_FAN:ND1}=E8.Mode;function DD1(Z){let J=Z.getGraph(),X=x6.fromGraph(J);if(!Z.getIndices())TB(Z);let Y=Z.getIndices(),$=Y.getArray(),Q=Wr(Z),K=new $X[Y.getComponentType()](Q*2),G=Z.getMode();if(G===jD1)for(let H=0;H<Q;H++)K[H*2]=$[H],K[H*2+1]=$[H+1];else if(G===OD1)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(LD1);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 Dr(Z){let J=Z.getGraph(),X=x6.fromGraph(J);if(!Z.getIndices())TB(Z);let Y=Z.getIndices(),$=Y.getArray(),Q=Wr(Z),K=new $X[Y.getComponentType()](Q*3),G=Z.getMode();if(G===RD1)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===ND1)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(MD1);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 oo="dequantize",RB={pattern:/^((?!JOINTS_).)*$/};function Pr(Z=RB){let J=x7(RB,Z);return LX(oo,(X)=>{let Y=X.getLogger();for(let $ of X.getRoot().listMeshes())for(let Q of $.listPrimitives())PD1(Q,J);X.createExtension(vz).dispose(),Y.debug(`${oo}: Complete.`)})}function PD1(Z,J=RB){let X=x7(RB,J);for(let Y of Z.listSemantics())if(X.pattern.test(Y))Mk(Z.getAttribute(Y));for(let Y of Z.listTargets())for(let $ of Y.listSemantics())if(X.pattern.test($))Mk(Y.getAttribute($))}function Mk(Z){let J=Z.getArray();if(!J)return;let X=NB(J,Z.getComponentType(),Z.getNormalized());Z.setArray(X).setNormalized(!1)}function NB(Z,J,X){let Y=new Float32Array(Z.length);for(let $=0,Q=Z.length;$<Q;$++)if(X)Y[$]=l0.decodeNormalizedInt(Z[$],J);else Y[$]=Z[$];return Y}var{TEXTURE_INFO:Cr,ROOT:wL6}=s;function Tr(Z){let J=new x6().setLogger(Z.getLogger()),X=Tk(J,Z);return CD1(J,Z,X),J.getRoot().copy(Z.getRoot(),X),J}function CD1(Z,J,X){X||(X=Tk(Z,J));for(let Y of J.getRoot().listExtensionsUsed()){let $=Z.createExtension(Y.constructor);if(Y.isRequired())$.setRequired(!0)}return TD1(Z,J,kD1(J),X)}function TD1(Z,J,X,Y){Y||(Y=Tk(Z,J));let $=new Map;for(let Q of X)if(!$.has(Q)&&Q.propertyType!==Cr)$.set(Q,Y(Q));for(let[Q,W]of $.entries())W.copy(Q,Y);return $}function Tk(Z,J){let X=new Map([[J.getRoot(),Z.getRoot()]]);return(Y)=>{if(Y.propertyType===Cr)return Y;let $=X.get(Y);if(!$)$=new Y.constructor(Z.getGraph()),X.set(Y,$);return $}}function kD1(Z){let J=new Set;for(let X of Z.getGraph().listEdges())J.add(X.getChild());return Array.from(J)}var Uk="flatten",ro={cleanup:!0};function kr(Z=ro){let J=x7(ro,Z);return LX(Uk,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;IN1(H)});if(W.size)$.debug(`${Uk}: Flattening node hierarchies with TRS animation not yet supported.`);if(J.cleanup)await X.transform(CB({propertyTypes:[s.NODE],keepLeaves:!1}));$.debug(`${Uk}: Complete.`)})}function Er(Z){return yC(Z)}var ED1={skipValidation:!1},to=4294967295,{LINE_STRIP:ID1,LINE_LOOP:vD1,TRIANGLE_STRIP:SD1,TRIANGLE_FAN:_D1}=E8.Mode;function AD1(Z,J={}){let X=x7(ED1,J),Y=Z[0],$=x6.fromGraph(Y.getGraph());if(!X.skipValidation&&new Set(Z.map(Gr)).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 ID1:case vD1:DD1(F);break;case SD1:case _D1:Dr(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(),j=B?B.getArray():null,N=B?B.getCount():w,R=new Uint32Array(w).fill(to);for(let O=0;O<N;O++){let P=j?j[O]:O;if(R[P]===to)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=$X[U.getComponentType()],w=eZ($,U).setArray(new B(K*U.getElementSize()));z.setAttribute(F,w)}let H=Y.getIndices(),V=H?eZ($,H).setArray(Pk(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,j=Q[F];if(B&&V)hD1(B,j,V,q),q+=w;for(let N of z.listSemantics()){let R=U.getAttribute(N),O=z.getAttribute(N);xD1(R,B,j,O)}}return z}function xD1(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 hD1(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 Rk="join",{ROOT:fD1,NODE:bD1,MESH:yD1,PRIMITIVE:gD1,ACCESSOR:mD1}=s,wk=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],eo={keepMeshes:!1,keepNamed:!1,cleanup:!0};function Ir(Z=eo){let J=x7(eo,Z);return LX(Rk,async(X)=>{let Y=X.getRoot(),$=X.getLogger();for(let Q of Y.listScenes())Zr(X,Q,J),Q.traverse((W)=>Zr(X,W,J));if(J.cleanup)await X.transform(CB({propertyTypes:[bD1,yD1,gD1,mD1],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}));$.debug(`${Rk}: Complete.`)})}function Zr(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 K$))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;_z(q),dD1(q);let U=Gr(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!==fD1&&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 j=0;j<z.length;j++){let N=H[j],R=V[j],O=z[j];if(R.removePrimitive(O),CN1(O))O=z[j]=uD1(z[j]);if(N!==q)Hr(wk,vN1(wk,U),N.getMatrix()),Rr(O,wk)}let B=AD1(z),w=B.listAttributes()[0].getCount();F.addPrimitive(B),Y.debug(`${Rk}: Joined Primitives (${z.length}) containing ${Bk(w)} vertices under Node "${q.getName()}".`)}}function uD1(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 dD1(Z){for(let J of["POSITION","NORMAL","TANGENT"]){let X=Z.getAttribute(J);if(X)Mk(X)}}var{TRANSLATION:BL6,ROTATION:LL6,SCALE:jL6,WEIGHTS:OL6}=K$.TargetPath;var cD1={pattern:/.*/,quantizationVolume:"mesh",quantizePosition:14,quantizeNormal:10,quantizeTexcoord:12,quantizeColor:8,quantizeWeight:8,quantizeGeneric:12,normalizeWeights:!0,cleanup:!0};var ML6=iW({level:"high"},cD1);var lD1="unweld";function pD1(Z,J=new Map){let X=Z.getIndices();if(!X)return;let Y=Z.getGraph(),$=x6.fromGraph(Y),Q=$.getLogger(),W=Z.getAttribute("POSITION").getCount();for(let G of Z.listAttributes())if(Z.swap(G,Jr($,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,Jr($,z,X,J)),z.listParents().length===1)z.dispose();let K=Z.getAttribute("POSITION").getCount();if(Q.debug(`${lD1}: ${DB(W,K)} vertices.`),Z.setIndices(null),X.listParents().length===1)X.dispose()}function Jr(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 Xr;(function(Z){Z[Z.STEP=0]="STEP",Z[Z.LERP=1]="LERP",Z[Z.SLERP=2]="SLERP"})(Xr||(Xr={}));var iD1=0.000001;function nD1(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(Sz(J,H-1,G),Sz(J,V,W),Sz(J,V+1,K),X==="slerp"){let j=oD1(Q,G,K,B),N=$r(G,W)+$r(W,K);w=!OB(W,j,Y)||N+Number.EPSILON>=Math.PI}else if(X==="lerp"){let j=sD1(Q,G,K,B);w=!OB(W,j,Y)}else if(X==="step")w=!OB(W,G)||!OB(W,K)}if(w){if(V!==H)Z[H]=Z[V],Yr(J,H,Sz(J,V,Q));H++}}if(z>0)Z[H]=Z[z],Yr(J,H,Sz(J,z,Q)),H++;return H}function Sz(Z,J,X){for(let Y=0,$=X.length;Y<$;Y++)X[Y]=Z[J*$+Y];return X}function Yr(Z,J,X){for(let Y=0,$=X.length;Y<$;Y++)Z[J*$+Y]=X[Y]}function OB(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 aD1(Z,J,X){return Z*(1-X)+J*X}function sD1(Z,J,X,Y){for(let $=0;$<J.length;$++)Z[$]=aD1(J[$],X[$],Y);return Z}function oD1(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>iD1)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 $r(Z,J){let X=rD1(Z,J);return Math.acos(2*X*X-1)}function rD1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}var RL6=new Float32Array(0),NL6={ready:Promise.resolve(),resample:nD1,tolerance:0.0001,cleanup:!0};var w$="simplify",{POINTS:vr,LINES:tD1,LINE_STRIP:eD1,LINE_LOOP:ZP1,TRIANGLES:JP1,TRIANGLE_STRIP:Sr,TRIANGLE_FAN:_r}=E8.Mode,Ar={ratio:0,error:0.0001,lockBorder:!1,cleanup:!0};function xr(Z){let J=x7(Ar,Z),X=J.simplifier;if(!X)throw new Error(`${w$}: simplifier dependency required \u2014 install "meshoptimizer".`);return LX(w$,async(Y)=>{let $=Y.getLogger();await X.ready,await Y.transform(Ck({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===JP1||G===Sr||G===_r){if(Qr(K,J),BX(K,N6.RENDER)===0)K.dispose()}else if(K.getMode()===vr&&!!X.simplifyPoints){if(Qr(K,J),BX(K,N6.RENDER)===0)K.dispose()}else Q++}if(W.listPrimitives().length===0)W.dispose()}if(Q>0)$.warn(`${w$}: Skipping simplification of ${Q} primitives: Unsupported draw mode.`);if(J.cleanup)await Y.transform(CB({propertyTypes:[s.ACCESSOR,s.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),qr({propertyTypes:[s.ACCESSOR]}));$.debug(`${w$}: Complete.`)})}function Qr(Z,J){let X=iW({},Ar,J),Y=X.simplifier,$=Z.getGraph(),Q=x6.fromGraph($),W=Q.getLogger();switch(Z.getMode()){case vr:return XP1(Q,Z,X);case tD1:case eD1:case ZP1:return W.warn(`${w$}: Skipping primitive simplification: Unsupported draw mode.`),Z;case Sr:case _r:Dr(Z);break}let K=BX(Z,N6.UPLOAD),G=BX(Z,N6.RENDER);if(G<K/2)_z(Z);let z=Z.getAttribute("POSITION"),H=Z.getIndices(),V=z.getArray(),q=H.getArray();if(!(V instanceof Float32Array))V=NB(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();_z(Z);let j=BX(Z,N6.UPLOAD);if(j<=65534)Z.getIndices().setArray(new Uint16Array(Z.getIndices().getArray()));return W.debug(`${w$}: ${DB(K,j)} vertices, error: ${w.toFixed(4)}.`),Z}function XP1(Z,J,X){let Y=X.simplifier,$=Z.getLogger();if(J.getIndices())pD1(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=NB(z,W.getComponentType(),W.getNormalized());if(H&&!(H instanceof Float32Array))H=NB(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(`${w$}: ${DB(W.getCount(),B)} vertices.`);for(let w of Dk(J)){let j=eZ(Z,w);if(jk(w,null,U,j,B),NN1(J,w,j),w.listParents().length===1)w.dispose()}return J}var Nk;(function(Z){Z.LANCZOS3="lanczos3",Z.LANCZOS2="lanczos2"})(Nk||(Nk={}));var DL6={resizeFilter:Nk.LANCZOS3,pattern:void 0,formats:void 0,slots:void 0,quality:void 0,effort:void 0,lossless:!1,nearLossless:!1,limitInputPixels:!0};var CL6=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 j=0;for(var B=0;B<F.length;++B)U[j++]=U[B]<60?J[U[B]]:(U[B]-60)*64+U[++B];return U.buffer.slice(0,j)}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 j=X.exports.sbrk,N=j(U.length*4),R=j(B*4),O=new Uint8Array(X.exports.memory.buffer),P=W(U);if(O.set(P,N),w)w(N,N,U.length,B);var D=F(R,N,U.length,B);O=new Uint8Array(X.exports.memory.buffer);var C=new Uint32Array(B);new Uint8Array(C.buffer).set(O.subarray(R,R+B*4)),P.set(O.subarray(N,N+U.length*4)),j(N-j(0));for(var T=0;T<U.length;++T)U[T]=C[U[T]];return[C,D]}function G(F,U,B,w){var j=X.exports.sbrk,N=j(B*4),R=j(B*w),O=new Uint8Array(X.exports.memory.buffer);O.set(W(U),R),F(N,R,B,w),O=new Uint8Array(X.exports.memory.buffer);var P=new Uint32Array(B);return new Uint8Array(P.buffer).set(O.subarray(N,N+B*4)),j(N-j(0)),P}function z(F,U,B,w,j){var N=X.exports.sbrk,R=N(U),O=N(w*j),P=new Uint8Array(X.exports.memory.buffer);P.set(W(B),O);var D=F(R,U,O,w,j),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,j,N,R){var O=X.exports.sbrk,P=O(B*w),D=O(B*N),C=new Uint8Array(X.exports.memory.buffer);C.set(W(U),D),F(P,B,w,j,D,R);var T=new Uint8Array(B*w);return T.set(C.subarray(P,P+B*w)),O(P-O(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),j=X.exports.meshopt_encodeIndexBufferBound(U,H(w)+1);return z(X.exports.meshopt_encodeIndexBuffer,j,w,U,4)},encodeIndexSequence:function(F,U,B){Q(B==2||B==4);var w=V(F,B),j=X.exports.meshopt_encodeIndexSequenceBound(U,H(w)+1);return z(X.exports.meshopt_encodeIndexSequence,j,w,U,4)},encodeGltfBuffer:function(F,U,B,w){var j={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return Q(j[w]),j[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,j){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,j?N[j]:1)}}}();var kL6=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(j){Q=j.instance,Q.exports.__wasm_call_ctors()});function K(j){var N=new Uint8Array(j.length);for(var R=0;R<j.length;++R){var O=j.charCodeAt(R);N[R]=O>96?O-97:O>64?O-39:O+4}var P=0;for(var R=0;R<j.length;++R)N[P++]=N[R]<60?Y[N[R]]:(N[R]-60)*64+N[++R];return N.buffer.slice(0,P)}function G(j,N,R,O,P,D,C){var T=j.exports.sbrk,k=O+3&-4,A=T(k*P),v=T(D.length),x=new Uint8Array(j.exports.memory.buffer);x.set(D,v);var I=N(A,O,P,v,D.length);if(I==0&&C)C(A,k,P);if(R.set(x.subarray(A,A+O*P)),T(A-T(0)),I!=0)throw new Error("Malformed buffer data: "+I)}var z={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},H={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},V=[],q=0;function F(j){var N={object:new Worker(j),pending:0,requests:{}};return N.object.onmessage=function(R){var O=R.data;N.pending-=O.count,N.requests[O.id][O.action](O.value),delete N.requests[O.id]},N}function U(j){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"}),O=URL.createObjectURL(R);for(var P=V.length;P<j;++P)V[P]=F(O);for(var P=j;P<V.length;++P)V[P].object.postMessage({});V.length=j,URL.revokeObjectURL(O)}function B(j,N,R,O,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 A=new Uint8Array(R),v=++q;D.pending+=j,D.requests[v]={resolve:T,reject:k},D.object.postMessage({id:v,count:j,size:N,source:A,mode:O,filter:P},[A.buffer])})}function w(j){var N=j.data;if(!N.id)return self.close();self.ready.then(function(R){try{var O=new Uint8Array(N.count*N.size);G(R,R.exports[N.mode],O,N.count,N.size,N.source,R.exports[N.filter]),self.postMessage({id:N.id,count:N.count,action:"resolve",value:O},[O.buffer])}catch(P){self.postMessage({id:N.id,count:N.count,action:"reject",value:P})}})}return{ready:W,supported:!0,useWorkers:function(j){U(j)},decodeVertexBuffer:function(j,N,R,O,P){G(Q,Q.exports.meshopt_decodeVertexBuffer,j,N,R,O,Q.exports[z[P]])},decodeIndexBuffer:function(j,N,R,O){G(Q,Q.exports.meshopt_decodeIndexBuffer,j,N,R,O)},decodeIndexSequence:function(j,N,R,O){G(Q,Q.exports.meshopt_decodeIndexSequence,j,N,R,O)},decodeGltfBuffer:function(j,N,R,O,P,D){G(Q,Q.exports[H[P]],j,N,R,O,Q.exports[z[D]])},decodeGltfBufferAsync:function(j,N,R,O,P){if(V.length>0)return B(j,N,R,H[O],z[P]);return W.then(function(){var D=new Uint8Array(j*N);return G(Q,Q.exports[H[O]],D,j,N,R,Q.exports[z[P]]),D})}}}();var hr=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 j=U.charCodeAt(w);B[w]=j>96?j-97:j>64?j-39:j+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 j=X.exports.sbrk,N=j(B.length*4),R=j(w*4),O=new Uint8Array(X.exports.memory.buffer),P=W(B);O.set(P,N);var D=U(R,N,B.length,w);O=new Uint8Array(X.exports.memory.buffer);var C=new Uint32Array(w);new Uint8Array(C.buffer).set(O.subarray(R,R+w*4)),P.set(O.subarray(N,N+B.length*4)),j(N-j(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 j=U[w];B=B<j?j:B}return B}function z(U,B,w,j,N,R,O,P,D){var C=X.exports.sbrk,T=C(4),k=C(w*4),A=C(N*R),v=C(w*4),x=new Uint8Array(X.exports.memory.buffer);x.set(W(j),A),x.set(W(B),v);var I=U(k,v,w,A,N,R,O,P,D,T);x=new Uint8Array(X.exports.memory.buffer);var S=new Uint32Array(I);W(S).set(x.subarray(k,k+I*4));var y=new Float32Array(1);return W(y).set(x.subarray(T,T+4)),C(T-C(0)),[S,y[0]]}function H(U,B,w,j,N,R,O,P,D,C,T,k,A){var v=X.exports.sbrk,x=v(4),I=v(w*4),S=v(N*R),y=v(N*P),m=v(D.length*4),i=v(w*4),t=C?v(N):0,Z0=new Uint8Array(X.exports.memory.buffer);if(Z0.set(W(j),S),Z0.set(W(O),y),Z0.set(W(D),m),Z0.set(W(B),i),C)Z0.set(W(C),t);var W0=U(I,i,w,S,N,R,y,P,m,D.length,t,T,k,A,x);Z0=new Uint8Array(X.exports.memory.buffer);var A0=new Uint32Array(W0);W(A0).set(Z0.subarray(I,I+W0*4));var x0=new Float32Array(1);return W(x0).set(Z0.subarray(x,x+4)),v(x-v(0)),[A0,x0[0]]}function V(U,B,w,j){var N=X.exports.sbrk,R=N(w*j),O=new Uint8Array(X.exports.memory.buffer);O.set(W(B),R);var P=U(R,w,j);return N(R-N(0)),P}function q(U,B,w,j,N,R,O,P){var D=X.exports.sbrk,C=D(P*4),T=D(w*j),k=D(w*R),A=new Uint8Array(X.exports.memory.buffer);if(A.set(W(B),T),N)A.set(W(N),k);var v=U(C,T,w,j,k,R,O,P);A=new Uint8Array(X.exports.memory.buffer);var x=new Uint32Array(v);return W(x).set(A.subarray(C,C+v*4)),D(C-D(0)),x}var F={LockBorder:1,Sparse:2,ErrorAbsolute:4,Prune:8,_InternalDebug:1073741824};return{ready:Y,supported:!0,useExperimentalFeatures:!1,compactMesh:function(U){Q(U instanceof Uint32Array||U instanceof Int32Array||U instanceof Uint16Array||U instanceof Int16Array),Q(U.length%3==0);var 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,j,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(j>=0&&j<=U.length),Q(j%3==0),Q(N>=0);var O=0;for(var P=0;P<(R?R.length:0);++P)Q(R[P]in F),Q(this.useExperimentalFeatures||R[P]!="Prune"),O|=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,j,N,O);return C[0]=U instanceof Uint32Array?C[0]:new U.constructor(C[0]),C},simplifyWithAttributes:function(U,B,w,j,N,R,O,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(j instanceof Float32Array),Q(j.length%N==0),Q(N>=0),Q(O==null||O instanceof Uint8Array),Q(O==null||O.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 A=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U),v=H(X.exports.meshopt_simplifyWithAttributes,A,U.length,B,B.length/w,w*4,j,N*4,new Float32Array(R),O?new Uint8Array(O):null,P,D,k);return v[0]=U instanceof Uint32Array?v[0]:new U.constructor(v[0]),v},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,j,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),j)return Q(j instanceof Float32Array),Q(j.length%N==0),Q(N>=3),Q(U.length/B==j.length/N),q(X.exports.meshopt_simplifyPoints,U,U.length/B,B*4,j,N*4,R,w);else return q(X.exports.meshopt_simplifyPoints,U,U.length/B,B*4,void 0,0,0,w)}}}();var vL6=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 j=U.charCodeAt(w);B[w]=j>96?j-97:j>64?j-39:j+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],j=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(j,j+R*3)}}function H(U,B,w,j,N,R,O){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),A=P(U.byteLength),v=P(B.byteLength),x=new Uint8Array(X.exports.memory.buffer);x.set(W(U),A),x.set(W(B),v);var I=X.exports.meshopt_buildMeshlets(C,T,k,A,U.length,v,w,j,N,R,O);x=new Uint8Array(X.exports.memory.buffer);var S=x.subarray(C,C+I*G),y=new Uint32Array(S.buffer,S.byteOffset,S.byteLength/4).slice();for(var m=0;m<I;++m){var i=y[m*4+0],t=y[m*4+1],w=y[m*4+2],Z0=y[m*4+3];X.exports.meshopt_optimizeMeshlet(T+i*4,k+t,Z0,w)}var W0=y[(I-1)*4+0],A0=y[(I-1)*4+1],x0=y[(I-1)*4+2],s0=y[(I-1)*4+3],b8=W0+x0,$8=A0+(s0*3+3&-4),L7={meshlets:y,vertices:new Uint32Array(x.buffer,T,b8).slice(),triangles:new Uint8Array(x.buffer,k,$8*3).slice(),meshletCount:I};return P(C-P(0)),L7}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,j){var N=X.exports.sbrk,R=[],O=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),O),T.set(W(U.vertices),P),T.set(W(U.triangles),D);for(var k=0;k<U.meshletCount;++k){var A=U.meshlets[k*4+0],v=U.meshlets[k*4+0+1],x=U.meshlets[k*4+0+3];X.exports.meshopt_computeMeshletBounds(C,P+A*4,D+v,x,O,w,j),R.push(V(C))}return N(O-N(0)),R}function F(U,B,w,j){var N=X.exports.sbrk,R=N(K),O=N(U.byteLength),P=N(B.byteLength),D=new Uint8Array(X.exports.memory.buffer);D.set(W(U),O),D.set(W(B),P),X.exports.meshopt_computeClusterBounds(R,O,U.length,P,w,j);var C=V(R);return N(R-N(0)),C}return{ready:Y,supported:!0,buildMeshlets:function(U,B,w,j,N,R){Q(U.length%3==0),Q(B instanceof Float32Array),Q(B.length%w==0),Q(w>=3),Q(j<=255||j>0),Q(N<=512),Q(N%4==0),R=R||0;var O=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return H(O,B,B.length/w,w*4,j,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 j=U.BYTES_PER_ELEMENT==4?U:new Uint32Array(U);return F(j,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 aW={OPTIMIZED_DIR:".optimized",CHECKSUM_EXT:".md5",DIRECTORIES:[(()=>{try{return H9.dirname(c.resolve("@hytopia.com/assets"))}catch{return null}})(),H9.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 h5{static instance=new h5;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=H9.normalize(Z);for(let X of aW.DIRECTORIES){let Y=H9.normalize(X);if(J.startsWith(Y))return H9.relative(Y,J).replace(/\\/g,"/")}return H9.basename(J)}async _getAbsoluteModelPaths(){let Z=[];for(let J of aW.DIRECTORIES){let X=H9.resolve(process.cwd(),J);if(!jX.existsSync(X))continue;let Y=await Fw("**/*.{gltf,glb}",{cwd:X,follow:!0});for(let $ of Y)Z.push(H9.join(X,$))}return Z}async _loadModelData(Z){let J=await new lC().read(Z),X=Er(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)}${aW.CHECKSUM_EXT}`;if(!jX.existsSync(J))return!1;let X=this._calculateChecksum(Z),Y=jX.readFileSync(J,"utf8");return X===Y}_calculateChecksum(Z){if(!jX.existsSync(Z))return"";let J=jX.readFileSync(Z);return YP1.createHash("sha256").update(J.toString("base64")).digest("hex")}_buildOptimizedModelPath(Z){let J=H9.basename(Z),X=J.replace(/\.[^/.]+$/,""),Y=H9.dirname(Z),$=H9.join(Y,aW.OPTIMIZED_DIR,X);return H9.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 $=Tr(Y);$.setLogger(new _5(Wz.WARN)),await $.transform(zr({pivot:"center"}),kr(),Ir(),Ck(),xr({simplifier:hr,ratio:J,error:X}),Pr());for(let z of $.getRoot().listScenes())for(let H of z.listChildren())Nr(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=H9.dirname(J);jX.rmSync(X,{recursive:!0,force:!0}),jX.mkdirSync(X,{recursive:!0}),console.log(`ModelRegistry: Optimizing model ${this._absoluteModelPathToModelUri(Z)}...`);for(let Y of aW.OPTIMIZER_RUNS){let $=J.replace(/(\.[^/.]+)$/,`${Y.suffix}$1`),{stderr:Q}=await rp("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 jX.writeFileSync(`${J}${aW.CHECKSUM_EXT}`,this._calculateChecksum(Z)),J}}var Az;(($)=>{$.DYNAMIC="dynamic";$.FIXED="fixed";$.KINEMATIC_POSITION="kinematic_position";$.KINEMATIC_VELOCITY="kinematic_velocity"})(Az||={});var kk=0.001,fr="dynamic";class B$ 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??=fr,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 V9({...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 V9(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??fr;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)<kk&&Math.abs(Z.y)<kk&&Math.abs(Z.z)<kk}}var Ek;(($)=>{$[$.Average=0]="Average";$[$.Min=1]="Min";$[$.Multiply=2]="Multiply";$[$.Max=3]="Max"})(Ek||={});var xz;((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"})(xz||={});class V9 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=h5.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=h5.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}}),j=()=>({shape:"capsule",radius:q(V),halfHeight:q(Q*J/2-V)});if(X)switch(X){case"block":return F();case"capsule":return j();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 j()}get bounciness(){if(!this._requireNotRemoved("bounciness"))return 0;return this._collider?this._collider.restitution():this._colliderDesc.restitution}get bouncinessCombineRule(){if(!this._requireNotRemoved("bouncinessCombineRule"))return 0;return this._collider?this._collider.restitutionCombineRule():this._colliderDesc.restitutionCombineRule}get collisionGroups(){if(!this._requireNotRemoved("collisionGroups"))return{belongsTo:[],collidesWith:[]};return this._collider?S4.decodeRawCollisionGroups(this._collider.collisionGroups()):S4.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=S4.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 $P1={shape:"voxels"},Ik;((X)=>{X.ENTITY_COLLISION="BLOCK_TYPE.ENTITY_COLLISION";X.ENTITY_CONTACT_FORCE="BLOCK_TYPE.ENTITY_CONTACT_FORCE"})(Ik||={});class q9 extends j0{_id;_customColliderOptions;_halfExtents;_isLiquid;_name;_textureUri;constructor(Z={id:-1,textureUri:"textures/missing.png",name:"Unknown"}){if(Z.id<0)d.fatalError("BlockType.constructor(): BlockType id not set.");super();this._id=Z.id,this._customColliderOptions=Z.customColliderOptions,this._halfExtents=Z.halfExtents??{x:0.5,y:0.5,z:0.5},this._isLiquid=Z.isLiquid??!1,this._name=Z.name,this._textureUri=Z.textureUri}get id(){return this._id}get colliderOptions(){return{...this._customColliderOptions,...$P1}}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 V9({...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(S4.isDefaultCollisionGroups(J.collisionGroups))J.setCollisionGroups({belongsTo:[1],collidesWith:[65535&~1]});return J}serialize(){return k0.serializeBlockType(this)}}var vk;((J)=>J.REGISTER_BLOCK_TYPE="BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE")(vk||={});class hz extends j0{_blockTypes=new Map;_world;constructor(Z){super();this._world=Z}get world(){return this._world}getAllBlockTypes(){return Array.from(this._blockTypes.values())}getBlockType(Z){let J=this._blockTypes.get(Z);if(!J)d.fatalError(`BlockTypeRegistry.getBlockType(): BlockType with id ${Z} not found.`);return J}registerGenericBlockType(Z){let X=new class extends q9{constructor(Y=Z){super(Y)}};return this.registerBlockType(X),X}registerBlockType(Z){this._blockTypes.set(Z.id,Z),this.emitWithWorld(this._world,"BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE",{blockTypeRegistry:this,id:Z.id,blockType:Z})}serialize(){return k0.serializeBlockTypeRegistry(this)}}var KI={};_9(KI,{worldSchema:()=>WI,worldPacketDefinition:()=>I80,vectorSchema:()=>V1,vectorBooleanSchema:()=>X_1,uiSchema:()=>$I,uiPacketDefinition:()=>k80,uiDatasSchema:()=>QI,uiDatasPacketDefinition:()=>E80,uiDataSendPacketDefinition:()=>q80,uiDataSchema:()=>QH,syncResponseSchema:()=>YI,syncResponsePacketDefinition:()=>T80,syncRequestSchema:()=>SE,syncRequestPacketDefinition:()=>V80,stateRequestSchema:()=>vE,stateRequestPacketDefinition:()=>H80,sceneUIsSchema:()=>XI,sceneUIsPacketDefinition:()=>C80,sceneUISchema:()=>JI,rgbColorSchema:()=>m6,registeredPackets:()=>qL,quaternionSchema:()=>cE,playersSchema:()=>ZI,playersPacketDefinition:()=>P80,playerSchema:()=>eE,physicsDebugRenderSchema:()=>tE,physicsDebugRenderPacketDefinition:()=>N80,physicsDebugRaycastsSchema:()=>rE,physicsDebugRaycastsPacketDefinition:()=>D80,physicsDebugRaycastSchema:()=>oE,particleEmittersSchema:()=>sE,particleEmittersPacketDefinition:()=>R80,particleEmitterSchema:()=>aE,outboundPackets:()=>VL,modelNodeOverrideSchema:()=>dE,lightsSchema:()=>nE,lightsPacketDefinition:()=>M80,lightSchema:()=>iE,isValidPacket:()=>$_1,inputSchema:()=>IE,inputPacketDefinition:()=>z80,inboundPackets:()=>HL,hexColorSchema:()=>kE,heartbeatSchema:()=>TE,heartbeatPacketDefinition:()=>W80,entitySchema:()=>lE,entitiesSchema:()=>pE,entitiesPacketDefinition:()=>O80,definePacket:()=>S0,debugConfigSchema:()=>EE,debugConfigPacketDefinition:()=>G80,createPacket:()=>iS1,connectionSchema:()=>CE,connectionPacketDefinition:()=>Q80,chunksSchema:()=>uE,chunksPacketDefinition:()=>j80,chunkSchema:()=>mE,chatMessagesSchema:()=>gE,chatMessagesPacketDefinition:()=>L80,chatMessageSendPacketDefinition:()=>K80,chatMessageSchema:()=>$H,cameraSchema:()=>yE,cameraPacketDefinition:()=>B80,blocksSchema:()=>hE,blocksPacketDefinition:()=>U80,blockTypesSchema:()=>bE,blockTypesPacketDefinition:()=>w80,blockTypeSchema:()=>fE,blockSchema:()=>xE,bidirectionalPackets:()=>zL,audiosSchema:()=>AE,audiosPacketDefinition:()=>F80,audioSchema:()=>_E,PacketId:()=>h1});var zL={};_9(zL,{heartbeatPacketDefinition:()=>W80,connectionPacketDefinition:()=>Q80});var DE=e(Y80(),1);class PE extends DE.default{static instance=new DE.default}var h1;((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"})(h1||={});function iS1(Z,J,X,Y){if(!Z.validate(J))throw new Error(`Invalid payload for packet with id ${Z.id}. Error: ${PE.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:PE.instance.compile(J)}}var nS1={type:"object",properties:{i:{type:"string"}},required:["i"],additionalProperties:!1},$80={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},aS1={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},sS1={type:"object",properties:{usernameFragment:{type:"string"},password:{type:"string"},iceLite:{type:"boolean",nullable:!0}},required:["usernameFragment","password"],additionalProperties:!1},oS1={type:"object",properties:{i:{type:"string"},l:{type:"string"}},required:["i","l"],additionalProperties:!1},rS1={type:"object",properties:{port:{type:"number"},OS:{type:"number"},MIS:{type:"number"},maxMessageSize:{type:"number"}},required:["port","OS","MIS","maxMessageSize"],additionalProperties:!0},tS1={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},eS1={type:"object",properties:{i:{type:"string"},f:{type:"string",enum:["cs","sc"]},ip:sS1,ic:{type:"array",items:aS1},d:$80,s:rS1},required:["i","f","ip","ic","d","s"],additionalProperties:!1},Z_1={type:"object",properties:{i:{type:"string"},d:$80},required:["i","d"],additionalProperties:!1},J_1={type:"object",properties:{i:{type:"string",nullable:!0},pi:{type:"string",nullable:!0},l:{type:"string"},s:tS1},required:["l","s"],additionalProperties:!1},CE={type:"object",properties:{i:{type:"string",nullable:!0},k:{type:"boolean",nullable:!0},c:{...Z_1,nullable:!0},ca:{...nS1,nullable:!0},d:{type:"array",items:{...J_1},nullable:!0},pa:{...oS1,nullable:!0},t:{type:"array",items:{...eS1},nullable:!0}},additionalProperties:!1};var Q80=S0(116,CE);var TE={type:"null",nullable:!0};var W80=S0(117,TE);var HL={};_9(HL,{uiDataSendPacketDefinition:()=>q80,syncRequestPacketDefinition:()=>V80,stateRequestPacketDefinition:()=>H80,inputPacketDefinition:()=>z80,debugConfigPacketDefinition:()=>G80,chatMessageSendPacketDefinition:()=>K80});var kE={type:"string",pattern:"^[0-9A-Fa-f]{6}$"};var $H={type:"object",properties:{m:{type:"string"},c:{...kE,nullable:!0},p:{type:"string",nullable:!0}},required:["m"],additionalProperties:!1};var K80=S0(3,$H);var EE={type:"object",properties:{pdr:{type:"boolean",nullable:!0}},additionalProperties:!1};var G80=S0(128,EE);var IE={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 z80=S0(1,IE);var vE={type:"object",properties:{},additionalProperties:!1};var H80=S0(2,vE);var SE={type:"null",nullable:!0};var V80=S0(0,SE);var QH={type:"object",properties:{},additionalProperties:!0};var q80=S0(4,QH);var VL={};_9(VL,{worldPacketDefinition:()=>I80,uiPacketDefinition:()=>k80,uiDatasPacketDefinition:()=>E80,syncResponsePacketDefinition:()=>T80,sceneUIsPacketDefinition:()=>C80,playersPacketDefinition:()=>P80,physicsDebugRenderPacketDefinition:()=>N80,physicsDebugRaycastsPacketDefinition:()=>D80,particleEmittersPacketDefinition:()=>R80,lightsPacketDefinition:()=>M80,entitiesPacketDefinition:()=>O80,chunksPacketDefinition:()=>j80,chatMessagesPacketDefinition:()=>L80,cameraPacketDefinition:()=>B80,blocksPacketDefinition:()=>U80,blockTypesPacketDefinition:()=>w80,audiosPacketDefinition:()=>F80});var V1={type:"array",items:[{type:"number"},{type:"number"},{type:"number"}],minItems:3,maxItems:3};var _E={type:"object",properties:{i:{type:"number"},a:{type:"string",nullable:!0},cd:{type:"number",nullable:!0},d:{type:"number",nullable:!0},de:{type:"number",nullable:!0},di:{type:"number",minimum:0,nullable:!0},e:{type:"number",nullable:!0},l:{type:"boolean",nullable:!0},o:{type:"number",nullable:!0},p:{...V1,nullable:!0},pa:{type:"boolean",nullable:!0},pl:{type:"boolean",nullable:!0},pr:{type:"number",minimum:0,nullable:!0},r:{type:"boolean",nullable:!0},rd:{type:"number",nullable:!0},s:{type:"number",nullable:!0},v:{type:"number",minimum:0,maximum:1,nullable:!0}},required:["i"],additionalProperties:!1};var AE={type:"array",items:{..._E}};var F80=S0(33,AE);var xE={type:"object",properties:{i:{type:"number"},c:V1},required:["i","c"],additionalProperties:!1};var hE={type:"array",items:{...xE}};var U80=S0(34,hE);var fE={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 bE={type:"array",items:{...fE}};var w80=S0(35,bE);var yE={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:{...V1,nullable:!0},p:{...V1,nullable:!0},pt:{...V1,nullable:!0},pl:{...V1,nullable:!0},s:{type:"array",items:{type:"string"},nullable:!0},sa:{type:"number",nullable:!0},z:{type:"number",nullable:!0}},additionalProperties:!1};var gE={type:"array",items:{...$H}};var mE={type:"object",properties:{c:V1,b:{type:"array",items:{type:"number",minimum:0,maximum:255},minItems:4096,maxItems:4096,nullable:!0},rm:{type:"boolean",nullable:!0}},required:["c"],additionalProperties:!1};var uE={type:"array",items:{...mE}};var m6={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 dE={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:{...m6,nullable:!0}},required:["n"],additionalProperties:!1};var cE={type:"array",items:[{type:"number"},{type:"number"},{type:"number"},{type:"number"}],minItems:4,maxItems:4};var lE={type:"object",properties:{i:{type:"number"},al:{type:"array",items:{type:"string"},nullable:!0},ao:{type:"array",items:{type:"string"},nullable:!0},ap:{type:"number",nullable:!0},as:{type:"array",items:{type:"string"},nullable:!0},bh:{...V1,nullable:!0},bt:{type:"string",nullable:!0},h:{type:"array",items:{type:"string"},nullable:!0},m:{type:"string",nullable:!0},mo:{type:"array",items:{...dE},nullable:!0},mt:{type:"string",nullable:!0},n:{type:"string",nullable:!0},o:{type:"number",nullable:!0},p:{...V1,nullable:!0},pe:{type:"number",nullable:!0},pn:{type:"string",nullable:!0},r:{...cE,nullable:!0},rm:{type:"boolean",nullable:!0},s:{type:"number",nullable:!0},sn:{type:"array",items:{type:"string"},nullable:!0},t:{...m6,nullable:!0}},required:["i"],additionalProperties:!1};var pE={type:"array",items:{...lE}};var iE={type:"object",properties:{i:{type:"number"},a:{type:"number",nullable:!0},e:{type:"number",nullable:!0},c:{...m6,nullable:!0},d:{type:"number",nullable:!0},n:{type:"number",nullable:!0},o:{...V1,nullable:!0},p:{...V1,nullable:!0},pe:{type:"number",minimum:0,maximum:1,nullable:!0},rm:{type:"boolean",nullable:!0},t:{type:"number",nullable:!0},te:{type:"number",nullable:!0},tp:{...V1,nullable:!0}},required:["i"],additionalProperties:!1};var nE={type:"array",items:{...iE}};var aE={type:"object",properties:{i:{type:"number"},at:{type:"number",nullable:!0},b:{type:"number",nullable:!0},ce:{...m6,nullable:!0},cev:{...m6,nullable:!0},cs:{...m6,nullable:!0},csv:{...m6,nullable:!0},e:{type:"number",nullable:!0},en:{type:"string",nullable:!0},g:{...V1,nullable:!0},l:{type:"number",nullable:!0},lv:{type:"number",nullable:!0},mp:{type:"number",nullable:!0},o:{...V1,nullable:!0},oe:{type:"number",nullable:!0},oev:{type:"number",nullable:!0},os:{type:"number",nullable:!0},osv:{type:"number",nullable:!0},p:{...V1,nullable:!0},pa:{type:"boolean",nullable:!0},pv:{...V1,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:{...V1,nullable:!0},vv:{...V1,nullable:!0}},required:["i"],additionalProperties:!1};var sE={type:"array",items:{...aE}};var oE={type:"object",properties:{o:{...V1},d:{...V1},l:{type:"number"},h:{type:"boolean"}},required:["o","d","l","h"],additionalProperties:!1};var rE={type:"array",items:{...oE}};var tE={type:"object",properties:{v:{type:"array",items:{type:"number"}},c:{type:"array",items:{type:"number"}}},required:["v","c"],additionalProperties:!1};var eE={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 ZI={type:"array",items:{...eE}};var JI={type:"object",properties:{i:{type:"number"},e:{type:"number",nullable:!0},o:{...V1,nullable:!0},p:{...V1,nullable:!0},rm:{type:"boolean",nullable:!0},s:{type:"object",nullable:!0},t:{type:"string",nullable:!0},v:{type:"number",nullable:!0}},required:["i"],additionalProperties:!1};var XI={type:"array",items:{...JI}};var YI={type:"object",properties:{r:{type:"number"},s:{type:"number"},p:{type:"number"},n:{type:"number"}},required:["r","s","p","n"],additionalProperties:!1};var $I={type:"object",properties:{p:{type:"boolean",nullable:!0},u:{type:"string",nullable:!0}},additionalProperties:!1};var QI={type:"array",items:{...QH}};var X_1={type:"array",items:[{type:"boolean"},{type:"boolean"},{type:"boolean"}],minItems:3,maxItems:3};var WI={type:"object",properties:{i:{type:"number"},ac:{...m6,nullable:!0},ai:{type:"number",nullable:!0},dc:{...m6,nullable:!0},di:{type:"number",nullable:!0},dp:{...V1,nullable:!0},fc:{...m6,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 B80=S0(40,yE);var L80=S0(36,gE);var j80=S0(37,uE);var O80=S0(38,pE);var M80=S0(44,nE);var R80=S0(46,sE);var N80=S0(192,tE);var D80=S0(193,rE);var P80=S0(45,ZI);var C80=S0(43,XI);var T80=S0(32,YI);var k80=S0(41,$I);var E80=S0(42,QI);var I80=S0(39,WI);var qL=new Map,Y_1={...zL,...HL,...VL};for(let Z of Object.values(Y_1))if("id"in Z&&"schema"in Z){let J=Z;if(qL.has(J.id))throw new Error(`Packet with id ${J.id} is already registered.`);qL.set(J.id,J)}function $_1(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=qL.get(Z[0]);return!!J&&J.validate(Z[1])}var Q0=KI;var Z60=e(t80(),1);import D$ from"fs";import e80 from"path";var KH="./dev/persistence";class b7{static instance=new b7;gameId=process.env.HYTOPIA_GAME_ID;lobbyId=process.env.HYTOPIA_LOBBY_ID;_creativeGateway;constructor(){try{this._creativeGateway=new Z60.CreativeGateway}catch{console.warn(["\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501","\uD83D\uDEA8 HYTOPIA PLATFORM GATEWAY IS NOT INITIALIZED \uD83D\uDEA8","","\uD83D\uDD27 Local development is still possible, but these features will be disabled:"," \u2022 \uD83D\uDC64 Player Accounts"," \u2022 \uD83C\uDFAD Player Cosmetics"," \u2022 \uD83D\uDC1B Crash Analytics & Debug Logs","","\uD83D\uDCA1 These features will be enabled but modified:"," \u2022 \uD83D\uDCBE Player & Global Persisted Data - Data will be persisted"," locally in the ./dev/persistence directory of your project."," Player ids for data persistence will begin at 1 for the first "," player to join your local server, and increments for each"," additional player. This means that if you restart your"," server, the first player id will be 1 again. This is to ensure"," that data persistence across server restarts can be easily"," tested and debugged in local development.","","To enable the HYTOPIA Platform Gateway locally:"," 1. Set these environment variables:"," HYTOPIA_API_KEY, HYTOPIA_GAME_ID, HYTOPIA_LOBBY_ID"," 2. You can find these values at: https://create.hytopia.com","","Note: In production, these environment variables will be auto-populated ","& the HYTOPIA Platform Gateway will automatically be initialized \uD83D\uDE80","\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501",""].join(`
405
405
  `))}}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(!D$.existsSync(KH))return;let J=e80.join(KH,`${Z}.json`);return JSON.parse(D$.readFileSync(J,"utf8"))}catch(J){d.warning(`PlatformGateway._readDevDataLocally(): Failed to read data for key "${Z}": ${J}`)}}_writeDevDataLocally(Z,J){try{if(!D$.existsSync(KH))D$.mkdirSync(KH,{recursive:!0});let X=e80.join(KH,`${Z}.json`),Y={};if(D$.existsSync(X))Y=JSON.parse(D$.readFileSync(X,"utf8"));let $={...Y,...J};D$.writeFileSync(X,JSON.stringify($,null,2),"utf8")}catch(X){d.warning(`PlatformGateway._writeDevDataLocally(): Failed to write data for key "${Z}": ${X}`)}}}class P${static instance=new P$;constructor(){}async getGlobalData(Z){let J=await b7.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 b7.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 b7.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 b7.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 J60;((Y)=>{Y[Y.FIRST_PERSON=0]="FIRST_PERSON";Y[Y.THIRD_PERSON=1]="THIRD_PERSON";Y[Y.SPECTATOR=2]="SPECTATOR"})(J60||={});var zI;((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"})(zI||={});class GH 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(){return k0.serializePlayerCamera(this)}_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 UL;(($)=>{$.DATA="PLAYER_UI.DATA";$.LOAD="PLAYER_UI.LOAD";$.LOCK_POINTER="PLAYER_UI.LOCK_POINTER";$.SEND_DATA="PLAYER_UI.SEND_DATA"})(UL||={});class zH 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 X60=["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"],HH;((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"})(HH||={});class QK 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-${QK._devNextPlayerId++}`,this.username=J?.user.username??this.id,this.profilePictureUrl=J?.user.profilePictureURL??void 0,this.camera=new GH(this),this.connection=Z,this.ui=new zH(this),Z.onPacket(Q0.PacketId.CHAT_MESSAGE_SEND,this._onChatMessageSendPacket),Z.onPacket(Q0.PacketId.DEBUG_CONFIG,this._onDebugConfigPacket),Z.onPacket(Q0.PacketId.INPUT,this._onInputPacket),Z.onPacket(Q0.PacketId.SYNC_REQUEST,this._onSyncRequestPacket),Z.onPacket(Q0.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 P$.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},P$.instance.setPlayerData(this,Z).catch((J)=>{}),this._persistedData}serialize(){return k0.serializePlayer(this)}_leaveWorld(){if(!this._world)return;this.emitWithWorld(this._world,"PLAYER.LEFT_WORLD",{player:this,world:this._world}),this._world=void 0}_onChatMessageSendPacket=(Z)=>{if(this._world)this.emitWithWorld(this._world,"PLAYER.CHAT_MESSAGE_SEND",{player:this,message:Z[1].m})};_onDebugConfigPacket=(Z)=>{console.log(Z)};_onInputPacket=(Z)=>{let J=Z[1];if(J.sq!==void 0){if(J.sq<this._lastUnreliableInputSequenceNumber)return;this._lastUnreliableInputSequenceNumber=J.sq}if(X60.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 HI;((X)=>{X.BROADCAST_MESSAGE="CHAT.BROADCAST_MESSAGE";X.PLAYER_MESSAGE="CHAT.PLAYER_MESSAGE"})(HI||={});class VH 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 F9=16,VI=F9-1,I_1=F9**3;class U9{_blocks;_originCoordinate;constructor(Z){this._blocks=new Uint8Array(I_1),this._originCoordinate=Z}get blocks(){return this._blocks}get originCoordinate(){return this._originCoordinate}static blockIndexToLocalCoordinate(Z){return{x:Z%F9,y:(Z/F9|0)%F9,z:Z/(F9*F9)|0}}static globalCoordinateToLocalCoordinate(Z){return{x:Z.x&F9-1,y:Z.y&F9-1,z:Z.z&F9-1}}static globalCoordinateToOriginCoordinate(Z){return{x:Z.x&~(F9-1),y:Z.y&~(F9-1),z:Z.z&~(F9-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 k0.serializeChunk(this)}_getIndex(Z){return Z.x+(Z.y<<4)+(Z.z<<8)}_isValidLocalCoordinate(Z){return Z.x>=0&&Z.x<=VI&&Z.y>=0&&Z.y<=VI&&Z.z>=0&&Z.z<=VI}}var qI;((Y)=>{Y.ADD_CHUNK="CHUNK_LATTICE.ADD_CHUNK";Y.REMOVE_CHUNK="CHUNK_LATTICE.REMOVE_CHUNK";Y.SET_BLOCK="CHUNK_LATTICE.SET_BLOCK"})(qI||={});class qH 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}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(U9.globalCoordinateToOriginCoordinate(Z));if(!J)return 0;return J.getBlockId(U9.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(U9.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=U9.globalCoordinateToOriginCoordinate(Z),X=this._chunks.get(this._getChunkKey(J));if(X)return X;return X=new U9(J),this._chunks.set(this._getChunkKey(J),X),this.emitWithWorld(this._world,"CHUNK_LATTICE.ADD_CHUNK",{chunkLattice:this,chunk:X}),X}getAllChunks(){return Array.from(this._chunks.values())}hasBlock(Z){let J=this.getChunk(U9.globalCoordinateToOriginCoordinate(Z));if(!J)return!1;return J.hasBlock(U9.globalCoordinateToLocalCoordinate(Z))}hasChunk(Z){let J=U9.globalCoordinateToOriginCoordinate(Z);return this._chunks.has(this._getChunkKey(J))}setBlock(Z,J){let X=U9.globalCoordinateToLocalCoordinate(Z),Y=this.getOrCreateChunk(Z),$=Y.getBlockId(X);if($===J)return;if(Y.setBlock(X,J),!this._rigidBody)this._rigidBody=new B$({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 FH{_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 Y60={type:"dynamic",softCcdPrediction:1},$60=0.015625,Q60=Math.cos(0.026),UH;((O)=>{O.BLOCK_COLLISION="ENTITY.BLOCK_COLLISION";O.BLOCK_CONTACT_FORCE="ENTITY.BLOCK_CONTACT_FORCE";O.DESPAWN="ENTITY.DESPAWN";O.ENTITY_COLLISION="ENTITY.ENTITY_COLLISION";O.ENTITY_CONTACT_FORCE="ENTITY.ENTITY_CONTACT_FORCE";O.SET_MODEL_ANIMATIONS_PLAYBACK_RATE="ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE";O.SET_MODEL_HIDDEN_NODES="ENTITY.SET_MODEL_HIDDEN_NODES";O.SET_MODEL_SCALE="ENTITY.SET_MODEL_SCALE";O.SET_MODEL_SHOWN_NODES="ENTITY.SET_MODEL_SHOWN_NODES";O.SET_MODEL_TEXTURE_URI="ENTITY.SET_MODEL_TEXTURE_URI";O.SET_OPACITY="ENTITY.SET_OPACITY";O.SET_PARENT="ENTITY.SET_PARENT";O.SET_TINT_COLOR="ENTITY.SET_TINT_COLOR";O.SPAWN="ENTITY.SPAWN";O.START_MODEL_LOOPED_ANIMATIONS="ENTITY.START_MODEL_LOOPED_ANIMATIONS";O.START_MODEL_ONESHOT_ANIMATIONS="ENTITY.START_MODEL_ONESHOT_ANIMATIONS";O.STOP_MODEL_ANIMATIONS="ENTITY.STOP_MODEL_ANIMATIONS";O.TICK="ENTITY.TICK";O.UPDATE_POSITION="ENTITY.UPDATE_POSITION";O.UPDATE_ROTATION="ENTITY.UPDATE_ROTATION"})(UH||={});class o8 extends B${_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&&!h5.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??Y60);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=$60,this._rotationUpdateThreshold=Q60,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?h5.instance.getDepth(this._modelUri)*(this._modelScale??1):this._blockHalfExtents.z*2}get height(){return this.isModelEntity?h5.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?h5.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 V9(V9.optionsFromBlockHalfExtents(this._blockHalfExtents)));if(this._modelUri&&this.numColliders===0&&this._modelPreferredShape!=="none")this.addChildColliderToSimulation(new V9(V9.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(S4.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(){return k0.serializeEntity(this)}tick(Z){if(this.emit("ENTITY.TICK",{entity:this,tickDeltaMs:Z}),this._controller)this._controller.tick(this,Z)}checkAndEmitUpdates(){if(!this._requireSpawned("checkAndEmitUpdates"))return;let Z=this.position,J=this.rotation;if(this._rotationExceedsThreshold(J,this._lastUpdatedRotation))this._lastUpdatedRotation=J,this.emitWithWorld(this._world,"ENTITY.UPDATE_ROTATION",{entity:this,rotation:J});if(this._positionExceedsThreshold(Z,this._lastUpdatedPosition))this._lastUpdatedPosition=Z,this.emitWithWorld(this._world,"ENTITY.UPDATE_POSITION",{entity:this,position:Z})}_positionExceedsThreshold(Z,J){let X=Z.x-J.x,Y=Z.y-J.y,$=Z.z-J.z;return X*X+Y*Y+$*$>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 m1 extends pY{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 GG({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()+m1.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:m1.GROUND_SENSOR_RADIUS_SCALE*(Z.height/m1.BASE_ENTITY_HEIGHT),halfHeight:m1.GROUND_SENSOR_HEIGHT_SCALE*(Z.height/m1.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<m1.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 o8))return;if(X&&this.sticksToPlatforms)this._platform=J;else if(J===this._platform&&!X)this._platform=void 0}}),Z.createAndAddChildCollider({shape:"capsule",halfHeight:m1.WALL_COLLIDER_HEIGHT_SCALE*(Z.height/m1.BASE_ENTITY_HEIGHT),radius:m1.WALL_COLLIDER_RADIUS_SCALE*(Z.height/m1.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()+m1.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 j;if(this.applyDirectionalMovementRotations&&w){if($&&Q&&!K&&!W)j=m1.MOVEMENT_ROTATIONS.wa;else if($&&K&&!Q&&!W)j=m1.MOVEMENT_ROTATIONS.wd;else if(W&&Q&&!$&&!K)j=m1.MOVEMENT_ROTATIONS.sa;else if(W&&K&&!$&&!Q)j=m1.MOVEMENT_ROTATIONS.sd;else if(W&&!$&&!Q&&!K||Q&&W&&K&&!$)j=m1.MOVEMENT_ROTATIONS.s;else if(Q&&!$&&!W&&!K)j=m1.MOVEMENT_ROTATIONS.a;else if(K&&!$&&!Q&&!W)j=m1.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 A=D/k;this._reusableTargetVelocities.x*=A,this._reusableTargetVelocities.z*=A}}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*m1.WATER_ENTRY_SINKING_FACTOR;else if(!z)this._reusableTargetVelocities.y=-F.y*m1.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-m1.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,O=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||O!==0||P!==0){let D=Z.mass;this._reusableImpulse.x=R*D,this._reusableImpulse.y=O*D,this._reusableImpulse.z=P*D,this._internalApplyImpulse(this._reusableImpulse)}if(q!==void 0&&(this.faceForwardOnStop||this.isActivelyMoving)){let C=(j!==void 0?q+j:q)*0.5;Z.setRotation({x:0,y:Math.sin(C),z:0,w:Math.cos(C)})}}}var FI;((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"})(FI||={});class wH 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(){return k0.serializeSceneUI(this)}}var W60=0.010000000000000002,K60=Math.cos(0.026);class y7 extends o8{player;nametagSceneUI;constructor(Z){super(Z);this._positionUpdateThresholdSq=W60,this._rotationUpdateThreshold=K60,this.player=Z.player,this.nametagSceneUI=new wH({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 UI extends y7{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 m1)}}class BH{_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(){return Array.from(this._entities.values())}getAllPlayerEntities(){let Z=[];return this._entities.forEach((J)=>{if(J instanceof y7)Z.push(J)}),Z}getPlayerEntitiesByPlayer(Z){let J=[];return this._entities.forEach((X)=>{if(X instanceof y7&&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{gzipSync as TJ6}from"zlib";import{WebSocket as kJ6}from"ws";var H5=e(V50(),1),BT6=H5.default.v1,LT6=H5.default.v1ToV6,jT6=H5.default.v3,q50=H5.default.v4,OT6=H5.default.v5,MT6=H5.default.v6,RT6=H5.default.v6ToV1,NT6=H5.default.v7,DT6=H5.default.NIL,PT6=H5.default.MAX,CT6=H5.default.version,TT6=H5.default.validate,kT6=H5.default.stringify,ET6=H5.default.parse;var NI;try{NI=new TextDecoder}catch(Z){}var $0,B9,g=0;var TI=[],T$=TI,OH=0,f1={},K1,WJ,w9=0,s9=0,r8,KJ,u5=[],Y1,F50={useRecords:!1,mapsAsObjects:!0};class NL{}var kI=new NL;kI.name="MessagePack 0xC1";var CX=!1,N50=2,DI,PI,CI;try{new Function("")}catch(Z){N50=1/0}class GJ{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($0)return A50(()=>{return RL(),this?this.unpack(Z,J):GJ.prototype.unpack.call(F50,Z,J)});if(!Z.buffer&&Z.constructor===ArrayBuffer)Z=typeof Buffer!=="undefined"?Buffer.from(Z):new Uint8Array(Z);if(typeof J==="object")B9=J.end||Z.length,g=J.start||0;else g=0,B9=J>-1?J:Z.length;OH=0,s9=0,WJ=null,T$=TI,r8=null,$0=Z;try{Y1=Z.dataView||(Z.dataView=new DataView(Z.buffer,Z.byteOffset,Z.byteLength))}catch(X){if($0=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 GJ){if(f1=this,this.structures)return K1=this.structures,OL(J);else if(!K1||K1.length>0)K1=[]}else if(f1=F50,!K1||K1.length>0)K1=[];return OL(J)}unpackMultiple(Z,J){let X,Y=0;try{CX=!0;let $=Z.length,Q=this?this.unpack(Z,$):DL.unpack(Z,$);if(J){if(J(Q,Y,g)===!1)return;while(g<$)if(Y=g,J(OL(),Y,g)===!1)return}else{X=[Q];while(g<$)Y=g,X.push(OL());return X}}catch($){throw $.lastPosition=Y,$.values=X,$}finally{CX=!1,RL()}}_mergeStructures(Z,J){if(PI)Z=PI.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 OL(Z){try{if(!f1.trusted&&!CX){let X=K1.sharedLength||0;if(X<K1.length)K1.length=X}let J;if(f1.randomAccessStructure&&$0[g]<64&&$0[g]>=32&&DI){if(J=DI($0,g,B9,f1),$0=null,!(Z&&Z.lazy)&&J)J=J.toJSON();g=B9}else J=S8();if(r8)g=r8.postBundlePosition,r8=null;if(CX)K1.restoreStructures=null;if(g==B9){if(K1&&K1.restoreStructures)U50();if(K1=null,$0=null,KJ)KJ=null}else if(g>B9)throw new Error("Unexpected end of MessagePack data");else if(!CX){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)U50();if(RL(),J instanceof RangeError||J.message.startsWith("Unexpected end of buffer")||g>B9)J.incomplete=!0;throw J}}function U50(){for(let Z in K1.restoreStructures)K1[Z]=K1.restoreStructures[Z];K1.restoreStructures=null}function S8(){let Z=$0[g++];if(Z<160)if(Z<128)if(Z<64)return Z;else{let J=K1[Z&63]||f1.getStructures&&D50()[Z&63];if(J){if(!J.read)J.read=EI(J,Z&63);return J.read()}else return Z}else if(Z<144)if(Z-=128,f1.mapsAsObjects){let J={};for(let X=0;X<Z;X++){let Y=S50();if(Y==="__proto__")Y="__proto_";J[Y]=S8()}return J}else{let J=new Map;for(let X=0;X<Z;X++)J.set(S8(),S8());return J}else{Z-=144;let J=new Array(Z);for(let X=0;X<Z;X++)J[X]=S8();if(f1.freezeData)return Object.freeze(J);return J}else if(Z<192){let J=Z-160;if(s9>=g)return WJ.slice(g-w9,(g+=J)-w9);if(s9==0&&B9<140){let X=J<16?II(J):v50(J);if(X!=null)return X}return ML(J)}else{let J;switch(Z){case 192:return null;case 193:if(r8)if(J=S8(),J>0)return r8[1].slice(r8.position1,r8.position1+=J);else return r8[0].slice(r8.position0,r8.position0-=J);return kI;case 194:return!1;case 195:return!0;case 196:if(J=$0[g++],J===void 0)throw new Error("Unexpected end of buffer");return RI(J);case 197:return J=Y1.getUint16(g),g+=2,RI(J);case 198:return J=Y1.getUint32(g),g+=4,RI(J);case 199:return C$($0[g++]);case 200:return J=Y1.getUint16(g),g+=2,C$(J);case 201:return J=Y1.getUint32(g),g+=4,C$(J);case 202:if(J=Y1.getFloat32(g),f1.useFloat32>2){let X=E$[($0[g]&127)<<1|$0[g+1]>>7];return g+=4,(X*J+(J>0?0.5:-0.5)>>0)/X}return g+=4,J;case 203:return J=Y1.getFloat64(g),g+=8,J;case 204:return $0[g++];case 205:return J=Y1.getUint16(g),g+=2,J;case 206:return J=Y1.getUint32(g),g+=4,J;case 207:if(f1.int64AsType==="number")J=Y1.getUint32(g)*4294967296,J+=Y1.getUint32(g+4);else if(f1.int64AsType==="string")J=Y1.getBigUint64(g).toString();else if(f1.int64AsType==="auto"){if(J=Y1.getBigUint64(g),J<=BigInt(2)<<BigInt(52))J=Number(J)}else J=Y1.getBigUint64(g);return g+=8,J;case 208:return Y1.getInt8(g++);case 209:return J=Y1.getInt16(g),g+=2,J;case 210:return J=Y1.getInt32(g),g+=4,J;case 211:if(f1.int64AsType==="number")J=Y1.getInt32(g)*4294967296,J+=Y1.getUint32(g+4);else if(f1.int64AsType==="string")J=Y1.getBigInt64(g).toString();else if(f1.int64AsType==="auto"){if(J=Y1.getBigInt64(g),J>=BigInt(-2)<<BigInt(52)&&J<=BigInt(2)<<BigInt(52))J=Number(J)}else J=Y1.getBigInt64(g);return g+=8,J;case 212:if(J=$0[g++],J==114)return M50($0[g++]&63);else{let X=u5[J];if(X)if(X.read)return g++,X.read(S8());else if(X.noBuffer)return g++,X();else return X($0.subarray(g,++g));else throw new Error("Unknown extension "+J)}case 213:if(J=$0[g],J==114)return g++,M50($0[g++]&63,$0[g++]);else return C$(2);case 214:return C$(4);case 215:return C$(8);case 216:return C$(16);case 217:if(J=$0[g++],s9>=g)return WJ.slice(g-w9,(g+=J)-w9);return P50(J);case 218:if(J=Y1.getUint16(g),g+=2,s9>=g)return WJ.slice(g-w9,(g+=J)-w9);return C50(J);case 219:if(J=Y1.getUint32(g),g+=4,s9>=g)return WJ.slice(g-w9,(g+=J)-w9);return T50(J);case 220:return J=Y1.getUint16(g),g+=2,B50(J);case 221:return J=Y1.getUint32(g),g+=4,B50(J);case 222:return J=Y1.getUint16(g),g+=2,L50(J);case 223:return J=Y1.getUint32(g),g+=4,L50(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 $x1=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function EI(Z,J){function X(){if(X.count++>N50){let $=Z.read=new Function("r","return function(){return "+(f1.freezeData?"Object.freeze":"")+"({"+Z.map((Q)=>Q==="__proto__"?"__proto_:r()":$x1.test(Q)?Q+":r()":"["+JSON.stringify(Q)+"]:r()").join(",")+"})}")(S8);if(Z.highByte===0)Z.read=w50(J,Z.read);return $()}let Y={};for(let $=0,Q=Z.length;$<Q;$++){let W=Z[$];if(W==="__proto__")W="__proto_";Y[W]=S8()}if(f1.freezeData)return Object.freeze(Y);return Y}if(X.count=0,Z.highByte===0)return w50(J,X);return X}var w50=(Z,J)=>{return function(){let X=$0[g++];if(X===0)return J();let Y=Z<32?-(Z+(X<<5)):Z+(X<<5),$=K1[Y]||D50()[Y];if(!$)throw new Error("Record id is not defined for "+Y);if(!$.read)$.read=EI($,Z);return $.read()}};function D50(){let Z=A50(()=>{return $0=null,f1.getStructures()});return K1=f1._mergeStructures(Z,K1)}var ML=k$,P50=k$,C50=k$,T50=k$,k50=!1;function E50(Z){k50=!0,ML=J(1),P50=J(2),C50=J(3),T50=J(5);function J(X){return function Y($){let Q=T$[OH++];if(Q==null){if(r8)return k$($);let K=$0.byteOffset,G=Z(g-X+K,B9+K,$0.buffer);if(typeof G=="string")Q=G,T$=TI;else if(T$=G,OH=1,s9=1,Q=T$[0],Q===void 0)throw new Error("Unexpected end of buffer")}let W=Q.length;if(W<=$)return g+=$,Q;return WJ=Q,w9=g,s9=g+W,g+=$,Q.slice(0,$)}}}function k$(Z){let J;if(Z<16){if(J=II(Z))return J}if(Z>64&&NI)return NI.decode($0.subarray(g,g+=Z));let X=g+Z,Y=[];J="";while(g<X){let $=$0[g++];if(($&128)===0)Y.push($);else if(($&224)===192){let Q=$0[g++]&63;Y.push(($&31)<<6|Q)}else if(($&240)===224){let Q=$0[g++]&63,W=$0[g++]&63;Y.push(($&31)<<12|Q<<6|W)}else if(($&248)===240){let Q=$0[g++]&63,W=$0[g++]&63,K=$0[g++]&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+=W6.apply(String,Y),Y.length=0}if(Y.length>0)J+=W6.apply(String,Y);return J}function I50(Z,J,X){let Y=$0;$0=Z,g=J;try{return k$(X)}finally{$0=Y}}function B50(Z){let J=new Array(Z);for(let X=0;X<Z;X++)J[X]=S8();if(f1.freezeData)return Object.freeze(J);return J}function L50(Z){if(f1.mapsAsObjects){let J={};for(let X=0;X<Z;X++){let Y=S50();if(Y==="__proto__")Y="__proto_";J[Y]=S8()}return J}else{let J=new Map;for(let X=0;X<Z;X++)J.set(S8(),S8());return J}}var W6=String.fromCharCode;function v50(Z){let J=g,X=new Array(Z);for(let Y=0;Y<Z;Y++){let $=$0[g++];if(($&128)>0){g=J;return}X[Y]=$}return W6.apply(String,X)}function II(Z){if(Z<4)if(Z<2)if(Z===0)return"";else{let J=$0[g++];if((J&128)>1){g-=1;return}return W6(J)}else{let J=$0[g++],X=$0[g++];if((J&128)>0||(X&128)>0){g-=2;return}if(Z<3)return W6(J,X);let Y=$0[g++];if((Y&128)>0){g-=3;return}return W6(J,X,Y)}else{let J=$0[g++],X=$0[g++],Y=$0[g++],$=$0[g++];if((J&128)>0||(X&128)>0||(Y&128)>0||($&128)>0){g-=4;return}if(Z<6)if(Z===4)return W6(J,X,Y,$);else{let Q=$0[g++];if((Q&128)>0){g-=5;return}return W6(J,X,Y,$,Q)}else if(Z<8){let Q=$0[g++],W=$0[g++];if((Q&128)>0||(W&128)>0){g-=6;return}if(Z<7)return W6(J,X,Y,$,Q,W);let K=$0[g++];if((K&128)>0){g-=7;return}return W6(J,X,Y,$,Q,W,K)}else{let Q=$0[g++],W=$0[g++],K=$0[g++],G=$0[g++];if((Q&128)>0||(W&128)>0||(K&128)>0||(G&128)>0){g-=8;return}if(Z<10)if(Z===8)return W6(J,X,Y,$,Q,W,K,G);else{let z=$0[g++];if((z&128)>0){g-=9;return}return W6(J,X,Y,$,Q,W,K,G,z)}else if(Z<12){let z=$0[g++],H=$0[g++];if((z&128)>0||(H&128)>0){g-=10;return}if(Z<11)return W6(J,X,Y,$,Q,W,K,G,z,H);let V=$0[g++];if((V&128)>0){g-=11;return}return W6(J,X,Y,$,Q,W,K,G,z,H,V)}else{let z=$0[g++],H=$0[g++],V=$0[g++],q=$0[g++];if((z&128)>0||(H&128)>0||(V&128)>0||(q&128)>0){g-=12;return}if(Z<14)if(Z===12)return W6(J,X,Y,$,Q,W,K,G,z,H,V,q);else{let F=$0[g++];if((F&128)>0){g-=13;return}return W6(J,X,Y,$,Q,W,K,G,z,H,V,q,F)}else{let F=$0[g++],U=$0[g++];if((F&128)>0||(U&128)>0){g-=14;return}if(Z<15)return W6(J,X,Y,$,Q,W,K,G,z,H,V,q,F,U);let B=$0[g++];if((B&128)>0){g-=15;return}return W6(J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B)}}}}}function j50(){let Z=$0[g++],J;if(Z<192)J=Z-160;else switch(Z){case 217:J=$0[g++];break;case 218:J=Y1.getUint16(g),g+=2;break;case 219:J=Y1.getUint32(g),g+=4;break;default:throw new Error("Expected string")}return k$(J)}function RI(Z){return f1.copyBuffers?Uint8Array.prototype.slice.call($0,g,g+=Z):$0.subarray(g,g+=Z)}function C$(Z){let J=$0[g++];if(u5[J]){let X;return u5[J]($0.subarray(g,X=g+=Z),(Y)=>{g=Y;try{return S8()}finally{g=X}})}else throw new Error("Unknown extension type "+J)}var O50=new Array(4096);function S50(){let Z=$0[g++];if(Z>=160&&Z<192){if(Z=Z-160,s9>=g)return WJ.slice(g-w9,(g+=Z)-w9);else if(!(s9==0&&B9<180))return ML(Z)}else return g--,_50(S8());let J=(Z<<5^(Z>1?Y1.getUint16(g):Z>0?$0[g]:0))&4095,X=O50[J],Y=g,$=g+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=$0[Y++],Q!=X[W++]){Y=1879048192;break}if(Y===$)return g=Y,X.string;$-=3,Y=g}X=[],O50[J]=X,X.bytes=Z;while(Y<$)Q=Y1.getUint32(Y),X.push(Q),Y+=4;$+=3;while(Y<$)Q=$0[Y++],X.push(Q);let K=Z<16?II(Z):v50(Z);if(K!=null)return X.string=K;return X.string=ML(Z)}function _50(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(f1.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 M50=(Z,J)=>{let X=S8().map(_50),Y=Z;if(J!==void 0)Z=Z<32?-((J<<5)+Z):(J<<5)+Z,X.highByte=J;let $=K1[Z];if($&&($.isShared||CX))(K1.restoreStructures||(K1.restoreStructures=[]))[Z]=$;return K1[Z]=X,X.read=EI(X,Y),X.read()};u5[0]=()=>{};u5[0].noBuffer=!0;u5[66]=(Z)=>{let J=Z.byteLength%8||8,X=BigInt(Z[0]&128?Z[0]-256:Z[0]);for(let Y=1;Y<J;Y++)X<<=BigInt(8),X+=BigInt(Z[Y]);if(Z.byteLength!==J){let Y=new DataView(Z.buffer,Z.byteOffset,Z.byteLength),$=(Q,W)=>{let K=W-Q;if(K<=40){let V=Y.getBigUint64(Q);for(let q=Q+8;q<W;q+=8)V<<=BigInt(64n),V|=Y.getBigUint64(q);return V}let G=Q+(K>>4<<3),z=$(Q,G),H=$(G,W);return z<<BigInt((W-G)*8)|H};X=X<<BigInt((Y.byteLength-J)*8)|$(J,Y.byteLength)}return X};var R50={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError==="function"?AggregateError:null};u5[101]=()=>{let Z=S8();if(!R50[Z[0]]){let J=Error(Z[1],{cause:Z[2]});return J.name=Z[0],J}return R50[Z[0]](Z[1],{cause:Z[2]})};u5[105]=(Z)=>{if(f1.structuredClone===!1)throw new Error("Structured clone extension is disabled");let J=Y1.getUint32(g-4);if(!KJ)KJ=new Map;let X=$0[g],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)&&$0[g+1]===115)Y=new Set;else Y={};let $={target:Y};KJ.set(J,$);let Q=S8();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};u5[112]=(Z)=>{if(f1.structuredClone===!1)throw new Error("Structured clone extension is disabled");let J=Y1.getUint32(g-4),X=KJ.get(J);return X.used=!0,X.target};u5[115]=()=>new Set(S8());var vI=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map((Z)=>Z+"Array"),Qx1=typeof globalThis==="object"?globalThis:window;u5[116]=(Z)=>{let J=Z[0],X=Uint8Array.prototype.slice.call(Z,1).buffer,Y=vI[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 Qx1[Y](X)};u5[120]=()=>{let Z=S8();return new RegExp(Z[0],Z[1])};var Wx1=[];u5[98]=(Z)=>{let J=(Z[0]<<24)+(Z[1]<<16)+(Z[2]<<8)+Z[3],X=g;return g+=J-Z.length,r8=Wx1,r8=[j50(),j50()],r8.position0=0,r8.position1=0,r8.postBundlePosition=g,g=X,S8()};u5[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 A50(Z){if(CI)CI();let J=B9,X=g,Y=OH,$=w9,Q=s9,W=WJ,K=T$,G=KJ,z=r8,H=new Uint8Array($0.slice(0,B9)),V=K1,q=K1.slice(0,K1.length),F=f1,U=CX,B=Z();return B9=J,g=X,OH=Y,w9=$,s9=Q,WJ=W,T$=K,KJ=G,r8=z,$0=H,CX=U,K1=V,K1.splice(0,K1.length,...q),f1=F,Y1=new DataView($0.buffer,$0.byteOffset,$0.byteLength),B}function RL(){$0=null,KJ=null,K1=null}var E$=new Array(147);for(let Z=0;Z<256;Z++)E$[Z]=+("1e"+Math.floor(45.15-Z*0.30103));var DL=new GJ({useRecords:!1}),Kx1=DL.unpack,Gx1=DL.unpackMultiple,zx1=DL.unpack;var Hx1=new Float32Array(1),vT6=new Uint8Array(Hx1.buffer,0,4);function x50(Z,J,X){DI=Z,PI=J,CI=X}var CL;try{CL=new TextEncoder}catch(Z){}var AI,g50,WK=typeof Buffer!=="undefined",PL=WK?function(Z){return Buffer.allocUnsafeSlow(Z)}:Uint8Array,m50=WK?Buffer:Uint8Array,h50=WK?4294967296:2144337920,p,MH,b1,u=0,d6,z8=null,u50,Vx1=21760,qx1=/[\u0080-\uFFFF]/,g7=Symbol("record-id");class I$ extends GJ{constructor(Z){super(Z);this.offset=0;let J,X,Y,$,Q,W=m50.prototype.utf8Write?function(I,S){return p.utf8Write(I,S,p.byteLength-S)}:CL&&CL.encodeInto?function(I,S){return CL.encodeInto(I,p.subarray(S)).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,j=0;this.pack=this.encode=function(I,S){if(!p)p=new PL(8192),b1=p.dataView||(p.dataView=new DataView(p.buffer,0,8192)),u=0;if(d6=p.length-10,d6-u<2048)p=new PL(p.length),b1=p.dataView||(p.dataView=new DataView(p.buffer,0,p.length)),d6=p.length-10,u=0;else u=u+7&2147483640;if(X=u,S&jx1)u+=S&255;if(Q=K.structuredClone?new Map:null,K.bundleStrings&&typeof I!=="string")z8=[],z8.size=1/0;else z8=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 i=0;i<m;i++){let t=$[i];if(!t)continue;let Z0,W0=$.transitions;for(let A0=0,x0=t.length;A0<x0;A0++){let s0=t[A0];if(Z0=W0[s0],!Z0)Z0=W0[s0]=Object.create(null);W0=Z0}W0[g7]=i+64}this.lastNamedStructuresLength=m}if(!G)$.nextId=m+64}if(Y)Y=!1;let y;try{if(K.randomAccessStructure&&I&&I.constructor&&I.constructor===Object)x(I);else O(I);let m=z8;if(z8)b50(X,O,0);if(Q&&Q.idsToInsert){let i=Q.idsToInsert.sort((A0,x0)=>A0.offset>x0.offset?1:-1),t=i.length,Z0=-1;while(m&&t>0){let A0=i[--t].offset+X;if(A0<m.stringsPosition+X&&Z0===-1)Z0=0;if(A0>m.position+X){if(Z0>=0)Z0+=6}else{if(Z0>=0)b1.setUint32(m.position+X,b1.getUint32(m.position+X)+Z0),Z0=-1;m=m.previous,t++}}if(Z0>=0&&m)b1.setUint32(m.position+X,b1.getUint32(m.position+X)+Z0);if(u+=i.length*6,u>d6)k(u);K.offset=u;let W0=Fx1(p.subarray(X,u),i);return Q=null,W0}if(K.offset=u,S&Bx1)return p.start=X,p.end=u,p;return p.subarray(X,u)}catch(m){throw y=m,m}finally{if($){if(N(),Y&&K.saveStructures){let m=$.sharedLength||0,i=p.subarray(X,u),t=d50($,K);if(!y){if(K.saveStructures(t,t.isCompatible)===!1)return K.pack(I,S);if(K.lastNamedStructuresLength=m,p.length>1073741824)p=null;return i}}}if(p.length>1073741824)p=null;if(S&Lx1)u=X}};let N=()=>{if(j<10)j++;let I=$.sharedLength||0;if($.length>I&&!G)$.length=I;if(w>1e4){if($.transitions=null,j=0,w=0,B.length>0)B=[]}else if(B.length>0&&!G){for(let S=0,y=B.length;S<y;S++)B[S][g7]=0;B=[]}},R=(I)=>{var S=I.length;if(S<16)p[u++]=144|S;else if(S<65536)p[u++]=220,p[u++]=S>>8,p[u++]=S&255;else p[u++]=221,b1.setUint32(u,S),u+=4;for(let y=0;y<S;y++)O(I[y])},O=(I)=>{if(u>d6)p=k(u);var S=typeof I,y;if(S==="string"){let m=I.length;if(z8&&m>=4&&m<4096){if((z8.size+=m)>Vx1){let W0,A0=(z8[0]?z8[0].length*3+z8[1].length:0)+10;if(u+A0>d6)p=k(u+A0);let x0;if(z8.position)x0=z8,p[u]=200,u+=3,p[u++]=98,W0=u-X,u+=4,b50(X,O,0),b1.setUint16(W0+X-3,u-X-W0);else p[u++]=214,p[u++]=98,W0=u-X,u+=4;z8=["",""],z8.previous=x0,z8.size=0,z8.position=W0}let Z0=qx1.test(I);z8[Z0?0:1]+=I,p[u++]=193,O(Z0?-m:m);return}let i;if(m<32)i=1;else if(m<256)i=2;else if(m<65536)i=3;else i=5;let t=m*3;if(u+t>d6)p=k(u+t);if(m<64||!W){let Z0,W0,A0,x0=u+i;for(Z0=0;Z0<m;Z0++)if(W0=I.charCodeAt(Z0),W0<128)p[x0++]=W0;else if(W0<2048)p[x0++]=W0>>6|192,p[x0++]=W0&63|128;else if((W0&64512)===55296&&((A0=I.charCodeAt(Z0+1))&64512)===56320)W0=65536+((W0&1023)<<10)+(A0&1023),Z0++,p[x0++]=W0>>18|240,p[x0++]=W0>>12&63|128,p[x0++]=W0>>6&63|128,p[x0++]=W0&63|128;else p[x0++]=W0>>12|224,p[x0++]=W0>>6&63|128,p[x0++]=W0&63|128;y=x0-u-i}else y=W(I,u+i);if(y<32)p[u++]=160|y;else if(y<256){if(i<2)p.copyWithin(u+2,u+1,u+1+y);p[u++]=217,p[u++]=y}else if(y<65536){if(i<3)p.copyWithin(u+3,u+2,u+2+y);p[u++]=218,p[u++]=y>>8,p[u++]=y&255}else{if(i<5)p.copyWithin(u+5,u+3,u+3+y);p[u++]=219,b1.setUint32(u,y),u+=4}u+=y}else if(S==="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,b1.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,b1.setInt16(u,I),u+=2;else p[u++]=210,b1.setInt32(u,I),u+=4;else{let m;if((m=this.useFloat32)>0&&I<4294967296&&I>=-2147483648){p[u++]=202,b1.setFloat32(u,I);let i;if(m<4||(i=I*E$[(p[u]&127)<<1|p[u+1]>>7])>>0===i){u+=4;return}else u--}p[u++]=203,b1.setFloat64(u,I),u+=8}else if(S==="object"||S==="function")if(!I)p[u++]=192;else{if(Q){let i=Q.get(I);if(i){if(!i.id){let t=Q.idsToInsert||(Q.idsToInsert=[]);i.id=t.push(i)}p[u++]=214,p[u++]=112,b1.setUint32(u,i.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(y=I.size,y<16)p[u++]=128|y;else if(y<65536)p[u++]=222,p[u++]=y>>8,p[u++]=y&255;else p[u++]=223,b1.setUint32(u,y),u+=4;for(let[i,t]of I)O(i),O(t)}else{for(let i=0,t=AI.length;i<t;i++){let Z0=g50[i];if(I instanceof Z0){let W0=AI[i];if(W0.write){if(W0.type)p[u++]=212,p[u++]=W0.type,p[u++]=0;let $8=W0.write.call(this,I);if($8===I)if(Array.isArray(I))R(I);else T(I);else O($8);return}let A0=p,x0=b1,s0=u;p=null;let b8;try{b8=W0.pack.call(this,I,($8)=>{if(p=A0,A0=null,u+=$8,u>d6)k(u);return{target:p,targetView:b1,position:u-$8}},O)}finally{if(A0)p=A0,b1=x0,u=s0,d6=p.length-10}if(b8){if(b8.length+u>d6)k(b8.length+u);u=f50(b8,p,u,W0.type)}return}}if(Array.isArray(I))R(I);else{if(I.toJSON){let i=I.toJSON();if(i!==I)return O(i)}if(S==="function")return O(this.writeFunction&&this.writeFunction(I));T(I)}}}else if(S==="boolean")p[u++]=I?195:194;else if(S==="bigint"){if(I<9223372036854776000&&I>=-9223372036854776000)p[u++]=211,b1.setBigInt64(u,I);else if(I<18446744073709552000&&I>0)p[u++]=207,b1.setBigUint64(u,I);else if(this.largeBigIntToFloat)p[u++]=203,b1.setFloat64(u,Number(I));else if(this.largeBigIntToString)return O(I.toString());else if(this.useBigIntExtension||this.moreTypes){let m=I<0?BigInt(-1):BigInt(0),i;if(I>>BigInt(65536)===m){let t=BigInt(18446744073709552000)-BigInt(1),Z0=[];while(!0){if(Z0.push(I&t),I>>BigInt(63)===m)break;I>>=BigInt(64)}i=new Uint8Array(new BigUint64Array(Z0).buffer),i.reverse()}else{let t=I<0,Z0=(t?~I:I).toString(16);if(Z0.length%2)Z0="0"+Z0;else if(parseInt(Z0.charAt(0),16)>=8)Z0="00"+Z0;if(WK)i=Buffer.from(Z0,"hex");else{i=new Uint8Array(Z0.length/2);for(let W0=0;W0<i.length;W0++)i[W0]=parseInt(Z0.slice(W0*2,W0*2+2),16)}if(t)for(let W0=0;W0<i.length;W0++)i[W0]=~i[W0]}if(i.length+u>d6)k(i.length+u);u=f50(i,p,u,66);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(S==="undefined")if(this.encodeUndefinedAsNil)p[u++]=192;else p[u++]=212,p[u++]=0,p[u++]=0;else throw new Error("Unknown type: "+S)},P=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?(I)=>{let S;if(this.skipValues){S=[];for(let i in I)if((typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(i))&&!this.skipValues.includes(I[i]))S.push(i)}else S=Object.keys(I);let y=S.length;if(y<16)p[u++]=128|y;else if(y<65536)p[u++]=222,p[u++]=y>>8,p[u++]=y&255;else p[u++]=223,b1.setUint32(u,y),u+=4;let m;if(this.coercibleKeyAsNumber)for(let i=0;i<y;i++){m=S[i];let t=Number(m);O(isNaN(t)?m:t),O(I[m])}else for(let i=0;i<y;i++)O(m=S[i]),O(I[m])}:(I)=>{p[u++]=222;let S=u-X;u+=2;let y=0;for(let m in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(m))O(m),O(I[m]),y++;if(y>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[S+++X]=y>>8,p[S+X]=y&255},D=this.useRecords===!1?P:Z.progressiveRecords&&!q?(I)=>{let S,y=$.transitions||($.transitions=Object.create(null)),m=u++-X,i;for(let t in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(t)){if(S=y[t],S)y=S;else{let Z0=Object.keys(I),W0=y;y=$.transitions;let A0=0;for(let x0=0,s0=Z0.length;x0<s0;x0++){let b8=Z0[x0];if(S=y[b8],!S)S=y[b8]=Object.create(null),A0++;y=S}if(m+X+1==u)u--,A(y,Z0,A0);else v(y,Z0,m,A0);i=!0,y=W0[t]}O(I[t])}if(!i){let t=y[g7];if(t)p[m+X]=t;else v(y,Object.keys(I),m,0)}}:(I)=>{let S,y=$.transitions||($.transitions=Object.create(null)),m=0;for(let t in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(t)){if(S=y[t],!S)S=y[t]=Object.create(null),m++;y=S}let i=y[g7];if(i)if(i>=96&&q)p[u++]=((i-=96)&31)+96,p[u++]=i>>5;else p[u++]=i;else A(y,y.__keys__||Object.keys(I),m);for(let t in I)if(typeof I.hasOwnProperty!=="function"||I.hasOwnProperty(t))O(I[t])},C=typeof this.useRecords=="function"&&this.useRecords,T=C?(I)=>{C(I)?D(I):P(I)}:D,k=(I)=>{let S;if(I>16777216){if(I-X>h50)throw new Error("Packed buffer would be larger than maximum buffer size");S=Math.min(h50,Math.round(Math.max((I-X)*(I>67108864?1.25:2),4194304)/4096)*4096)}else S=(Math.max(I-X<<2,p.length-1)>>12)+1<<12;let y=new PL(S);if(b1=y.dataView||(y.dataView=new DataView(y.buffer,0,S)),I=Math.min(I,p.length),p.copy)p.copy(y,0,X,I);else y.set(p.slice(X,I));return u-=X,X=0,d6=y.length-10,p=y},A=(I,S,y)=>{let m=$.nextId;if(!m)m=64;if(m<F&&this.shouldShareStructure&&!this.shouldShareStructure(S)){if(m=$.nextOwnId,!(m<U))m=F;$.nextOwnId=m+1}else{if(m>=U)m=F;$.nextId=m+1}let i=S.highByte=m>=96&&q?m-96>>5:-1;if(I[g7]=m,I.__keys__=S,$[m-64]=S,m<F)if(S.isShared=!0,$.sharedLength=m-63,Y=!0,i>=0)p[u++]=(m&31)+96,p[u++]=i;else p[u++]=m;else{if(i>=0)p[u++]=213,p[u++]=114,p[u++]=(m&31)+96,p[u++]=i;else p[u++]=212,p[u++]=114,p[u++]=m;if(y)w+=j*y;if(B.length>=V)B.shift()[g7]=0;B.push(I),O(S)}},v=(I,S,y,m)=>{let i=p,t=u,Z0=d6,W0=X;if(p=MH,u=0,X=0,!p)MH=p=new PL(8192);d6=p.length-10,A(I,S,m),MH=p;let A0=u;if(p=i,u=t,d6=Z0,X=W0,A0>1){let x0=u+A0-1;if(x0>d6)k(x0);let s0=y+X;p.copyWithin(s0+A0,s0+1,u),p.set(MH.slice(0,A0),s0),u=x0}else p[y+X]=MH[0]},x=(I)=>{let S=u50(I,p,X,u,$,k,(y,m,i)=>{if(i)return Y=!0;u=m;let t=p;if(O(y),N(),t!==p)return{position:u,targetView:b1,target:p};return u},this);if(S===0)return T(I);u=S}}useBuffer(Z){p=Z,p.dataView||(p.dataView=new DataView(p.buffer,p.byteOffset,p.byteLength)),b1=p.dataView,u=0}set position(Z){u=Z}get position(){return u}clearSharedData(){if(this.structures)this.structures=[];if(this.typedStructs)this.typedStructs=[]}}g50=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,NL];AI=[{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)SI(Z,16,J);else _I(WK?Buffer.from(Z):new Uint8Array(Z),J)}},{pack(Z,J){let X=Z.constructor;if(X!==m50&&this.moreTypes)SI(Z,vI.indexOf(X.name),J);else _I(Z,J)}},{pack(Z,J){if(this.moreTypes)SI(Z,17,J);else _I(WK?Buffer.from(Z):new Uint8Array(Z),J)}},{pack(Z,J){let{target:X,position:Y}=J(1);X[Y]=193}}];function SI(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 _I(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 f50(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 Fx1(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 b50(Z,J,X){if(z8.length>0){b1.setUint32(z8.position+Z,u+X-z8.position-Z),z8.stringsPosition=u-Z;let Y=z8;z8=null,J(Y[0]),J(Y[1])}}function d50(Z,J){return Z.isCompatible=(X)=>{let Y=!X||(J.lastNamedStructuresLength||0)===X.length;if(!Y)J._mergeStructures(X);return Y},Z}function c50(Z,J){u50=Z,d50=J}var l50=new I$({useRecords:!1}),Ux1=l50.pack,wx1=l50.pack;var Bx1=512,Lx1=1024,jx1=2048;var xI=3,GK=0,RH=2,TL=1,fI=16,i50=["num","object","string","ascii"];i50[fI]="date";var Mx1=[!1,!0,!0,!1,!1,!0,!0,!1],n50;try{new Function(""),n50=!0}catch(Z){}var v$,Rx1=typeof Buffer!=="undefined",kL,m7;try{kL=new TextEncoder}catch(Z){}var Nx1=Rx1?function(Z,J,X){return Z.utf8Write(J,X,Z.byteLength-X)}:kL&&kL.encodeInto?function(Z,J,X){return kL.encodeInto(J,Z.subarray(X)).written}:!1,gT6=Symbol("type"),mT6=Symbol("parent");c50(a50,kx1);function a50(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,j=w<15?1:w<240?2:w<61440?3:w<15728640?4:0;if(j===0)return 0;Y+=j;let N=[],R,O=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||d5(T,GK,1),J[Y++]=k;else B=T.num32||d5(T,GK,4),z.setUint32(Y,k,!0),Y+=4;break}else if(k<4294967296&&k>=-2147483648){if(z.setFloat32(Y,k,!0),Mx1[J[Y+3]>>>5]){let I;if((I=k*E$[(J[Y+3]&127)<<1|J[Y+2]>>7])>>0===I){B=T.num32||d5(T,GK,4),Y+=4;break}}}}B=T.num64||d5(T,GK,8),z.setFloat64(Y,k,!0),Y+=8;break;case"string":let A=C.length;if(F=U-H,(A<<2)+U>V)J=Q((A<<2)+U),z=J.dataView,Y-=X,q-=X,H-=X,U-=X,X=0,V=J.length-10;if(A>65280+F>>2){N.push(D,C,Y-q);break}let v,x=U;if(A<64){let I,S,y;for(I=0;I<A;I++)if(S=C.charCodeAt(I),S<128)J[U++]=S;else if(S<2048)v=!0,J[U++]=S>>6|192,J[U++]=S&63|128;else if((S&64512)===55296&&((y=C.charCodeAt(I+1))&64512)===56320)v=!0,S=65536+((S&1023)<<10)+(y&1023),I++,J[U++]=S>>18|240,J[U++]=S>>12&63|128,J[U++]=S>>6&63|128,J[U++]=S&63|128;else v=!0,J[U++]=S>>12|224,J[U++]=S>>6&63|128,J[U++]=S&63|128}else U+=Nx1(J,C,U),v=U-x>A;if(F<160||F<246&&(T.ascii8||T.string8)){if(v){if(!(B=T.string8))if(G.length>10&&(B=T.ascii8))B.__type=RH,T.ascii8=null,T.string8=B,W(null,0,!0);else B=d5(T,RH,1)}else if(F===0&&!R){R=!0,B=T.ascii0||d5(T,xI,0);break}else if(!(B=T.ascii8)&&!(G.length>10&&(B=T.string8)))B=d5(T,xI,1);J[Y++]=F}else B=T.string16||d5(T,RH,2),z.setUint16(Y,F,!0),Y+=2;break;case"object":if(C){if(C.constructor===Date)B=T.date64||d5(T,fI,8),z.setFloat64(Y,C.getTime(),!0),Y+=8;else N.push(D,C,O);break}else if(T=p50(T,Y,z,-10),T)B=T,Y=v$;else N.push(D,C,O);break;case"boolean":B=T.num8||T.ascii8||d5(T,GK,1),J[Y++]=C?249:248;break;case"undefined":if(T=p50(T,Y,z,-9),T)B=T,Y=v$;else N.push(D,C,O);break;default:N.push(D,C,O)}O++}for(let D=0,C=N.length;D<C;){let T=N[D++],k=N[D++],A=N[D++],v=B[T];if(!v)B[T]=v={key:T,parent:B,enumerationOffset:A-O,ascii0:null,ascii8:null,num8:null,string16:null,object16:null,num32:null,float64:null};let x;if(k){let I;if(F=U-H,F<65280)if(B=v.object16,B)I=2;else if(B=v.object32)I=4;else B=d5(v,TL,2),I=2;else B=v.object32||d5(v,TL,4),I=4;if(x=W(k,U),typeof x==="object")U=x.position,z=x.targetView,J=x.target,H-=X,Y-=X,q-=X,X=0;else U=x;if(I===2)z.setUint16(Y,F,!0),Y+=2;else z.setUint32(Y,F,!0),Y+=4}else B=v.object16||d5(v,TL,2),z.setInt16(Y,k===null?-10:-9,!0),Y+=2;O++}let P=B[g7];if(P==null){P=K.typedStructs.length;let D=[],C=B,T,k;while((k=C.__type)!==void 0){let A=C.__size;C=C.__parent,T=C.key;let v=[k,A,T];if(C.enumerationOffset)v.push(C.enumerationOffset);D.push(v),C=C.parent}D.reverse(),B[g7]=P,K.typedStructs[P]=D,W(null,0,!0)}switch(j){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,a50(Z,J,X,q,$,Q,W,K)}return U}function p50(Z,J,X,Y){let $;if($=Z.ascii8||Z.num8)return X.setInt8(J,Y,!0),v$=J+1,$;if($=Z.string16||Z.object16)return X.setInt16(J,Y,!0),v$=J+2,$;if($=Z.num32)return X.setUint32(J,3758096640+Y,!0),v$=J+4,$;if($=Z.num64)return X.setFloat64(J,NaN,!0),X.setInt8(J,Y),v$=J+8,$;v$=J;return}function d5(Z,J,X){let Y=i50[J]+(X<<3),$=Z[Y]||(Z[Y]=Object.create(null));return $.__type=J,$.__size=X,$.__parent=Z,$}function Dx1(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=d5(V,G,z)}K[g7]=$}return J.transitions=Y,this.typedStructs=J,this.lastTypedStructuresLength=J.length,X}var hI=Symbol.for("source");function Px1(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,j,N,R]=B;if(N==="__proto__")N="__proto_";let O={key:N,offset:V};if(R)H.splice(F+R,0,O);else H.push(O);let P;switch(j){case 0:P=()=>0;break;case 1:P=(C,T)=>{let k=C.bytes[T+O.offset];return k>=246?KK(k):k};break;case 2:P=(C,T)=>{let k=C.bytes,v=(k.dataView||(k.dataView=new DataView(k.buffer,k.byteOffset,k.byteLength))).getUint16(T+O.offset,!0);return v>=65280?KK(v&255):v};break;case 4:P=(C,T)=>{let k=C.bytes,v=(k.dataView||(k.dataView=new DataView(k.buffer,k.byteOffset,k.byteLength))).getUint32(T+O.offset,!0);return v>=4294967040?KK(v&255):v};break}O.getRef=P,V+=j;let D;switch(w){case xI:if(q&&!q.next)q.next=O;q=O,O.multiGetCount=0,D=function(C){let{bytes:T,position:k}=C,A=V+k,v=P(C,k);if(typeof v!=="number")return v;let x,I=O.next;while(I){if(x=I.getRef(C,k),typeof x==="number")break;else x=null;I=I.next}if(x==null)x=C.bytesEnd-A;if(C.srcString)return C.srcString.slice(v,x);return I50(T,v+A,x-v)};break;case RH:case TL:if(q&&!q.next)q.next=O;q=O,D=function(C){let T=C.position,k=V+T,A=P(C,T);if(typeof A!=="number")return A;let v=C.bytes,x,I=O.next;while(I){if(x=I.getRef(C,T),typeof x==="number")break;else x=null;I=I.next}if(x==null)x=C.bytesEnd-k;if(w===RH)return v.toString("utf8",A+k,x+k);else{m7=C;try{return Y.unpack(v,{start:A+k,end:x+k})}finally{m7=null}}};break;case GK:switch(j){case 4:D=function(C){let T=C.bytes,k=T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength)),A=C.position+O.offset,v=k.getInt32(A,!0);if(v<536870912){if(v>-520093696)return v;if(v>-536870912)return KK(v&255)}let x=k.getFloat32(A,!0),I=E$[(T[A+3]&127)<<1|T[A+2]>>7];return(I*x+(x>0?0.5:-0.5)>>0)/I};break;case 8:D=function(C){let T=C.bytes,A=(T.dataView||(T.dataView=new DataView(T.buffer,T.byteOffset,T.byteLength))).getFloat64(C.position+O.offset,!0);if(isNaN(A)){let v=T[C.position+O.offset];if(v>=246)return KK(v)}return A};break;case 1:D=function(C){let k=C.bytes[C.position+O.offset];return k<246?k:KK(k)};break}break;case fI: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+O.offset,!0))};break}O.get=D}if(n50){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:Cx1(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 j=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 j.call(this,this[hI])}})}else Object.defineProperty(G,"toJSON",{value(F){let U={};for(let B=0,w=H.length;B<w;B++){let j=H[B].key;U[j]=this[j]}return U}})}var z=new W;return z[hI]={bytes:Z,position:J,srcString:"",bytesEnd:X},z}function KK(Z){switch(Z){case 246:return null;case 247:return;case 248:return!1;case 249:return!0}throw new Error("Unknown constant")}function Cx1(Z){return function(){return Z(this[hI])}}function Tx1(){if(m7)m7.bytes=Uint8Array.prototype.slice.call(m7.bytes,m7.position,m7.bytesEnd),m7.position=0,m7.bytesEnd=m7.bytes.length}function kx1(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}x50(Px1,Dx1,Tx1);var vx1=process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED!==void 0&&process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED.toLowerCase()==="true";if(!vx1){let Z;try{if(Z=c("msgpackr-extract"),Z)E50(Z.extractStrings)}catch(J){}}import{WebSocketServer as ki1}from"ws";var xj=e(E$0(),1);import Di1 from"http";import Pi1 from"https";import Aj from"fs";import Ci1 from"path";import Ti1 from"url";var I$0=`-----BEGIN CERTIFICATE-----
406
406
  MIIDRjCCAi6gAwIBAgIFOTEzNTIwDQYJKoZIhvcNAQELBQAwWDEQMA4GA1UEAxMH
407
407
  SFlUT1BJQTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNV
@@ -447,7 +447,7 @@ qYGMwU/HBVHkLAn5XvT2a9xM0mzZ558d+ahbw8qAgRxg7BZ+2PW/bf7F2WRBUk1f
447
447
  xauhAoGBALEspoxQozwohGQnP7EMF0/0JoKNpdNv0b0qCVvNiMo0+N297lI2mFQp
448
448
  6xYlW/1l9afLokklF/J2IsyBrTCZoY7SaEk/lMMrQSyra+y0z71ogZ8A4ny9fxsj
449
449
  0dDYJZGllL+3E/MQfd7k+KnOM/+A+cPoAnci76+L3vdkUb2P8SJk
450
- -----END RSA PRIVATE KEY-----`;var iS=process.env.PORT??8080,nS="0.8.6-devtrace-34d95d5",aS;(($)=>{$.READY="WEBSERVER.READY";$.STOPPED="WEBSERVER.STOPPED";$.ERROR="WEBSERVER.ERROR";$.UPGRADE="WEBSERVER.UPGRADE"})(aS||={});class mK extends j0{static instance=new mK;_webserver=xj.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:nS,runtime:typeof Bun!=="undefined"?"bun":"node"})}),this._webserver.use(xj.default.static("assets"));try{this._webserver.use(xj.default.static(Ci1.dirname(c.resolve("@hytopia.com/assets"))))}catch{}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?Di1.createServer(this._webserver):Pi1.createServer({key:Aj.existsSync("assets/certs/localhost.key")?Aj.readFileSync("assets/certs/localhost.key"):v$0,cert:Aj.existsSync("assets/certs/localhost.crt")?Aj.readFileSync("assets/certs/localhost.crt"):I$0},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(iS,this._onStarted),console.info(`WebServer.start(): Server running on port ${iS}.`)}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=Ti1.parse(Z.url??"",!0).query,$=Y.connectionId?.toString(),Q=Y.sessionToken?.toString()??"";if($&&a7.instance.isValidConnectionId($))Z.connectionId=$;else{let W=await b7.instance.getPlayerSession(Q);if(W?.error){let K=`${W.error.code}: ${W.error.message}`;J.write(`HTTP/1.1 401 Unauthorized\r
450
+ -----END RSA PRIVATE KEY-----`;var iS=process.env.PORT??8080,nS="0.8.6-devtrace-6d51c5e",aS;(($)=>{$.READY="WEBSERVER.READY";$.STOPPED="WEBSERVER.STOPPED";$.ERROR="WEBSERVER.ERROR";$.UPGRADE="WEBSERVER.UPGRADE"})(aS||={});class mK extends j0{static instance=new mK;_webserver=xj.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:nS,runtime:typeof Bun!=="undefined"?"bun":"node"})}),this._webserver.use(xj.default.static("assets"));try{this._webserver.use(xj.default.static(Ci1.dirname(c.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js"))))}catch{}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?Di1.createServer(this._webserver):Pi1.createServer({key:Aj.existsSync("assets/certs/localhost.key")?Aj.readFileSync("assets/certs/localhost.key"):v$0,cert:Aj.existsSync("assets/certs/localhost.crt")?Aj.readFileSync("assets/certs/localhost.crt"):I$0},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(iS,this._onStarted),console.info(`WebServer.start(): Server running on port ${iS}.`)}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=Ti1.parse(Z.url??"",!0).query,$=Y.connectionId?.toString(),Q=Y.sessionToken?.toString()??"";if($&&a7.instance.isValidConnectionId($))Z.connectionId=$;else{let W=await b7.instance.getPlayerSession(Q);if(W?.error){let K=`${W.error.code}: ${W.error.message}`;J.write(`HTTP/1.1 401 Unauthorized\r
451
451
  Content-Type: text/plain\r
452
452
  Content-Length: ${K.length}\r
453
453
  Connection: close\r
@@ -482,6 +482,6 @@ ${$.stack}`:"unknown"}}}}}var eO8=(Z={})=>{let J=Z.limit??iO8;return{name:nO8,pr
482
482
  `;let K=R91(Y);Y.write(`${W}\r
483
483
  `);let{connect:G,buffered:z}=await K;if(Z.emit("proxyConnect",G),this.emit("proxyConnect",G,Z),G.statusCode===200){if(Z.once("socket",X86),J.secureEndpoint){UF("Upgrading socket connection to TLS");let V=J.servername||J.host;return ib.connect({...N91(J,"host","path","port"),socket:Y,servername:vJ.isIP(V)?void 0:V})}return Y}Y.destroy();let H=new vJ.Socket({writable:!1});return H.readable=!0,Z.once("socket",(V)=>{UF("Replaying proxy buffer for failed request"),V.push(z),V.push(null)}),H}}BR.__initStatic();function X86(Z){Z.resume()}function N91(Z,...J){let X={},Y;for(Y in Z)if(!J.includes(Y))X[Y]=Z[Y];return X}var K86=32768;function G86(Z){return new Q86({read(){this.push(Z),this.push(null)}})}function wF(Z){let J;try{J=new URL(Z.url)}catch(G){return e0(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),L3(Z,()=>Promise.resolve({}))}let X=J.protocol==="https:",Y=z86(J,Z.proxy||(X?process.env.https_proxy:void 0)||process.env.http_proxy),$=X?$86:Y86,Q=Z.keepAlive===void 0?!1:Z.keepAlive,W=Y?new BR(Y):new $.Agent({keepAlive:Q,maxSockets:30,timeout:2000}),K=H86(Z,Z.httpModule??$,W);return L3(Z,K)}function z86(Z,J){let{no_proxy:X}=process.env;if(X?.split(",").some(($)=>Z.host.endsWith($)||Z.hostname.endsWith($)))return;else return J}function H86(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)=>{OQ(()=>{let q=G86(z.body),F={...Z.headers};if(z.body.length>K86)F["content-encoding"]="gzip",q=q.pipe(W86());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,j=B.headers["x-sentry-rate-limits"]??null;H({statusCode:B.statusCode,headers:{"retry-after":w,"x-sentry-rate-limits":Array.isArray(j)?j[0]||null:j}})});U.on("error",V),q.pipe(U)})})}}var V86=new Set(["false","f","n","no","off","0"]),q86=new Set(["true","t","y","yes","on","1"]);function LR(Z,J){let X=String(Z).toLowerCase();if(V86.has(X))return!1;if(q86.has(X))return!0;return J?.strict?null:Boolean(Z)}import{posix as F86,sep as U86}from"path";function D91(Z){return Z.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function BF(Z=process.argv[1]?Kf(process.argv[1]):process.cwd(),J=U86==="\\"){let X=J?D91(Z):Z;return(Y)=>{if(!Y)return;let $=J?D91(Y):Y,{dir:Q,base:W,ext:K}=F86.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 LF(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 jF=lO(bf(BF()));var C91=e(Y0(),1);import*as P91 from"os";import{threadId as w86,isMainThread as B86}from"worker_threads";var L86=60000;class c3 extends UM{constructor(Z){let J=Z.includeServerName===!1?void 0:Z.serverName||global.process.env.SENTRY_NAME||P91.hostname(),X={...Z,platform:"node",runtime:{name:"node",version:global.process.version},serverName:J};if(Z.openTelemetryInstrumentations)D3({instrumentations:Z.openTelemetryInstrumentations});DQ(X,"node"),h.log(`Initializing Sentry: process: ${process.pid}, thread: ${B86?"main":`worker-${w86}`}.`);super(X);let{enableLogs:Y,_experiments:$}=this.getOptions();if(Y??$?.enableLogs){if(this._logOnExitFlushListener=()=>{tX(this)},J)this.on("beforeCaptureLog",(W)=>{W.attributes={...W.attributes,"server.address":J}});process.on("beforeExit",this._logOnExitFlushListener)}}get tracer(){if(this._tracer)return this._tracer;let Z="@sentry/node",J=M1,X=C91.trace.getTracer(Z,J);return this._tracer=X,X}async flush(Z){if(await this.traceProvider?.forceFlush(),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(()=>{G1&&h.log("Flushing client reports based on interval."),this._flushOutcomes()},Z.clientReportFlushInterval??L86).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener)}_getTraceInfoFromScope(Z){if(!Z)return[void 0,void 0];return C51(this,Z)}}var T91=e($q(),1);import j86 from"module";function k91(){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}=T91.createAddHookMessageChannel();j86.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:X,include:[]},transferList:[X]})}catch(X){h.warn("Failed to register ESM hook",X)}}else e0(()=>{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 jR(){return[Sq(),vq(),_q(),Aq(),xq(),h51(),g51(),GF(),zF(),YF(),QF(),XF(),VF(),M91(),WF()]}function nb(Z={}){return O86(Z,jR)}function O86(Z={},J){let X=M86(Z,J);if(X.debug===!0)if(G1)h.enable();else e0(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")});if(!L4()&&X.registerEsmLoaderHooks!==!1)k91();if(GR(),T0().update(X.initialScope),X.spotlight&&!X.integrations.some(({name:Q})=>Q===gb))X.integrations.push(HF({sidecarUrl:typeof X.spotlight==="string"?X.spotlight:void 0}));DQ(X,"node-core");let $=new c3(X);return T0().setClient($),$.init(),h.log(`Running in ${L4()?"CommonJS":"ESM"} mode.`),$.startClientReportTracking(),D86(),B51($),T51($),$}function OF(){if(!G1)return;let Z=M51(),J=["SentryContextManager","SentryPropagator"];if(c8())J.push("SentrySpanProcessor");for(let X of J)if(!Z.includes(X))h.error(`You have to set up the ${X}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);if(!Z.includes("SentrySampler"))h.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 M86(Z,J){let X=R86(Z.release),Y=Z.spotlight??LR(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,$=N86(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??wF,stackParser:cx(Z.stackParser||jF),release:X,tracesSampleRate:$,spotlight:Y,debug:LR(Z.debug??process.env.SENTRY_DEBUG)},W=Z.integrations,K=Z.defaultIntegrations??J(Q);return{...Q,integrations:mh({defaultIntegrations:K,integrations:W})}}function R86(Z){if(Z!==void 0)return Z;let J=LF();if(J!==void 0)return J;return}function N86(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 D86(){if(LR(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let Z=process.env.SENTRY_TRACE,J=process.env.SENTRY_BAGGAGE,X=FQ(Z,J);T0().setPropagationContext(X)}}function o1(Z,J){Z.setAttribute(_0,J)}var E91=(Z)=>({package:Z,"javascript.is_cjs":L4()});function SJ(Z,J){let X=X0()?.getOptions();if(!X?.disableInstrumentationWarnings&&!PJ(Z)&&MQ()&&c8(X))e0(()=>{if(L4())console.warn(`[Sentry] ${J} is not instrumented. This is likely because you required/imported ${J} before calling \`Sentry.init()\`.`);else console.warn(`[Sentry] ${J} is not instrumented. Please make sure to initialize Sentry in a separate file that you \`--import\` when running node, see: https://docs.sentry.io/platforms/javascript/guides/${J}/install/esm/.`)}),J7().setContext("missing_instrumentation",E91(J))}var P86=[["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 mQ(Z){return P86.reduce((J,[X,Y])=>J.replace(new RegExp(X,"gi"),Y),Z)}var I91="Automatic instrumentation of CronJob only supports crontab string";function v91(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(I91);if(X)throw new Error(`A job named '${J}' has already been scheduled`);X=!0;let V=mQ(Q);async function q(F,U){return QZ(J,async()=>{try{await W(F,U)}catch(B){throw Z1(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(I91);if(X)throw new Error(`A job named '${J}' has already been scheduled`);X=!0;let z=mQ(W);return Q.onTick=async(H,V)=>{return QZ(J,async()=>{try{await K(H,V)}catch(q){throw Z1(q),q}},{schedule:{type:"crontab",value:z},timezone:G||void 0})},Y.from(Q)};else return Y[$]}})}function S91(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 QZ(z,async()=>{try{return await K()}catch(q){throw Z1(q),q}},{schedule:{type:"crontab",value:mQ(W)},timezone:H})};return Y.apply($,[W,V,G])}});else return J[X]}})}function _91(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 QZ(z,async()=>{await G?.()},{schedule:{type:"crontab",value:mQ(H)}})}return Y.apply($,[z,H,V])}});return J[X]}})}var ab={instrumentCron:v91,instrumentNodeCron:S91,instrumentNodeSchedule:_91};var sb="Http",A91="@opentelemetry_sentry-patched/instrumentation-http",C86=w0(`${sb}.sentry`,(Z)=>{return new g3(Z)}),ob=w0(sb,(Z)=>{let J=new h91.HttpInstrumentation(Z);try{J._diag=x91.diag.createComponentLogger({namespace:A91}),J.instrumentationName=A91}catch{}return J});function T86(Z,J={}){if(typeof Z.spans==="boolean")return Z.spans;if(J.skipOpenTelemetrySetup)return!1;if(!c8(J)&&I9.major>=22)return!1;return!0}var OR=a((Z={})=>{let J=Z.dropSpansForIncomingRequestStatusCodes??[[401,404],[300,399]];return{name:sb,setupOnce(){let X=T86(Z,X0()?.getOptions());if(C86({...Z,extractIncomingTraceFromHeader:!X,propagateTraceInOutgoingRequests:!X}),X){let Y=I86(Z);ob(Y)}},processEvent(X){if(X.type==="transaction"){let Y=X.contexts?.trace?.data?.["http.response.status_code"];if(typeof Y==="number"&&J.some(($)=>{if(typeof $==="number")return $===Y;let[Q,W]=$;return Y>=Q&&Y<=W}))return null}return X}}});function k86(Z){return"outputData"in Z&&"outputSize"in Z&&!("client"in Z)&&!("statusCode"in Z)}function E86(Z){return Z.headers["next-router-prefetch"]==="1"}function I86(Z={}){return{...Z.instrumentation?._experimentalConfig,disableIncomingRequestInstrumentation:Z.disableIncomingRequestSpans,ignoreOutgoingRequestHook:(X)=>{let Y=b3(X);if(!Y)return!1;let $=Z.ignoreOutgoingRequests;if($?.(Y,X))return!0;return!1},ignoreIncomingRequestHook:(X)=>{let Y=X.url,$=X.method?.toUpperCase();if($==="OPTIONS"||$==="HEAD")return!0;let Q=Z.ignoreIncomingRequests;if(Y&&Q?.(Y,X))return!0;return!1},requireParentforOutgoingSpans:!1,requireParentforIncomingSpans:!1,requestHook:(X,Y)=>{if(o1(X,"auto.http.otel.http"),!k86(Y)&&E86(Y))X.setAttribute("sentry.http.prefetch",!0);Z.instrumentation?.requestHook?.(X,Y)},responseHook:(X,Y)=>{Z.instrumentation?.responseHook?.(X,Y)},applyCustomAttributesOnSpan:(X,Y,$)=>{Z.instrumentation?.applyCustomAttributesOnSpan?.(X,Y,$)}}}var r91=e(o91(),1);var t91="NodeFetch",A86=w0(t91,r91.UndiciInstrumentation,(Z)=>{return y86(Z)}),x86=w0(`${t91}.sentry`,u3,(Z)=>{return Z}),h86=(Z={})=>{return{name:"NodeFetch",setupOnce(){if(b86(Z,X0()?.getOptions()))A86(Z);x86(Z)}}},RR=a(h86);function f86(Z,J="/"){let X=`${Z}`;if(X.endsWith("/")&&J.startsWith("/"))return`${X}${J.slice(1)}`;if(!X.endsWith("/")&&!J.startsWith("/"))return`${X}/${J.slice(1)}`;return`${X}${J}`}function b86(Z,J={}){return typeof Z.spans==="boolean"?Z.spans:!J.skipOpenTelemetrySetup&&c8(J)}function y86(Z={}){return{requireParentforSpans:!1,ignoreRequestHook:(X)=>{let Y=f86(X.origin,X.path),$=Z.ignoreOutgoingRequests;return!!($&&Y&&$(Y))},startSpanHook:()=>{return{[_0]:"auto.http.otel.node_fetch"}}}}var O41=e(L41(),1);var j41="FileSystem",M41=a((Z={})=>{return{name:j41,setupOnce(){w0(j41,()=>new O41.FsInstrumentation({requireParentSpan:!0,endHook(J,{args:X,span:Y,error:$}){if(Y.updateName(`fs.${J}`),Y.setAttributes({[N0]:"file",[_0]:"auto.file.fs"}),Z.recordErrorMessagesAsSpanAttributes){if(typeof X[0]==="string"&&r86.includes(J))Y.setAttribute("path_argument",X[0]);else if(typeof X[0]==="string"&&typeof X[1]==="string"&&o86.includes(J))Y.setAttribute("target_argument",X[0]),Y.setAttribute("path_argument",X[1]);else if(typeof X[0]==="string"&&s86.includes(J))Y.setAttribute("prefix_argument",X[0]);else if(typeof X[0]==="string"&&typeof X[1]==="string"&&a86.includes(J))Y.setAttribute("existing_path_argument",X[0]),Y.setAttribute("new_path_argument",X[1]);else if(typeof X[0]==="string"&&typeof X[1]==="string"&&n86.includes(J))Y.setAttribute("src_argument",X[0]),Y.setAttribute("dest_argument",X[1]);else if(typeof X[0]==="string"&&typeof X[1]==="string"&&i86.includes(J))Y.setAttribute("old_path_argument",X[0]),Y.setAttribute("new_path_argument",X[1])}if($&&Z.recordErrorMessagesAsSpanAttributes)Y.setAttribute("fs_error",$.message)}}))()}}}),i86=["rename","renameSync"],n86=["copyFile","cp","copyFileSync","cpSync"],a86=["link","linkSync"],s86=["mkdtemp","mkdtempSync"],o86=["symlink","symlinkSync"],r86=["access","appendFile","chmod","chown","exists","mkdir","lchown","lstat","lutimes","open","opendir","readdir","readFile","readlink","realpath","realpath.native","rm","rmdir","stat","truncate","unlink","utimes","writeFile","accessSync","appendFileSync","chmodSync","chownSync","existsSync","lchownSync","lstatSync","lutimesSync","opendirSync","mkdirSync","openSync","readdirSync","readFileSync","readlinkSync","realpathSync","realpathSync.native","rmdirSync","rmSync","statSync","truncateSync","unlinkSync","utimesSync","writeFileSync"];var s41=e(d41(),1);var j4=typeof __SENTRY_DEBUG__==="undefined"||__SENTRY_DEBUG__;var U7=e(Y0(),1);var a41=e(R1(),1);var O4;(function(Z){Z.EXPRESS_TYPE="express.type";let X="express.name";Z.EXPRESS_NAME=X})(O4||(O4={}));var AJ;(function(Z){Z.ROUTER="router";let X="middleware";Z.MIDDLEWARE=X;let Y="request_handler";Z.REQUEST_HANDLER=Y})(AJ||(AJ={}));var Yy=Symbol("express-layer-patched"),wY="__ot_middlewares";var l41=(Z,J)=>{if(Array.isArray(Z[wY])===!1)Object.defineProperty(Z,wY,{enumerable:!1,value:[]});if(J===void 0)return;Z[wY].push(J)},p41=(Z,J)=>{let X=J.handle?.stack?.[0];if(X?.route?.path)return`${Z}${X.route.path}`;if(X?.handle?.stack)return p41(Z,X);return Z},i41=(Z,J,X)=>{if(J.name==="router"){let Y=p41("",J),$=Y?Y:X||Z||"/";return{attributes:{[O4.EXPRESS_NAME]:$,[O4.EXPRESS_TYPE]:AJ.ROUTER},name:`router - ${$}`}}else if(J.name==="bound dispatch"||J.name==="handle")return{attributes:{[O4.EXPRESS_NAME]:(Z||X)??"request handler",[O4.EXPRESS_TYPE]:AJ.REQUEST_HANDLER},name:`request handler${J.path?` - ${Z||X}`:""}`};else return{attributes:{[O4.EXPRESS_NAME]:J.name,[O4.EXPRESS_TYPE]:AJ.MIDDLEWARE},name:`middleware - ${J.name}`}},w66=(Z,J)=>{if(typeof J==="string")return J===Z;else if(J instanceof RegExp)return J.test(Z);else if(typeof J==="function")return J(Z);else throw new TypeError("Pattern is in unsupported datatype")},n41=(Z,J,X)=>{if(Array.isArray(X?.ignoreLayersType)&&X?.ignoreLayersType?.includes(J))return!0;if(Array.isArray(X?.ignoreLayers)===!1)return!1;try{for(let Y of X.ignoreLayers)if(w66(Z,Y))return!0}catch{}return!1},$y=(Z)=>Z instanceof Error?[Z,Z.message]:[String(Z),String(Z)],kR=(Z)=>{let J=Z[0];if(Array.isArray(J))return J.map((X)=>c41(X)||"").join(",");return c41(J)},c41=(Z)=>{if(typeof Z==="string")return Z;if(Z instanceof RegExp||typeof Z==="number")return Z.toString();return};var B66="0.1.0",L66="@sentry/instrumentation-express-v5";class Qy extends h8{constructor(Z={}){super(L66,B66,Z)}init(){return[new a6("express",[">=5.0.0"],(Z)=>this._setup(Z),(Z)=>this._tearDown(Z))]}_setup(Z){let J=Z.Router.prototype;if(PJ(J.route))this._unwrap(J,"route");if(this._wrap(J,"route",this._getRoutePatch()),PJ(J.use))this._unwrap(J,"use");if(this._wrap(J,"use",this._getRouterUsePatch()),PJ(Z.application.use))this._unwrap(Z.application,"use");return this._wrap(Z.application,"use",this._getAppUsePatch()),Z}_tearDown(Z){if(Z===void 0)return;let J=Z.Router.prototype;this._unwrap(J,"route"),this._unwrap(J,"use"),this._unwrap(Z.application,"use")}_getRoutePatch(){let Z=this;return function(J){return function X(...Y){let $=J.apply(this,Y),Q=this.stack[this.stack.length-1];return Z._applyPatch(Q,kR(Y)),$}}}_getRouterUsePatch(){let Z=this;return function(J){return function X(...Y){let $=J.apply(this,Y),Q=this.stack[this.stack.length-1];return Z._applyPatch(Q,kR(Y)),$}}}_getAppUsePatch(){let Z=this;return function(J){return function X(...Y){let $=this.router,Q=J.apply(this,Y);if($){let W=$.stack[$.stack.length-1];Z._applyPatch(W,kR(Y))}return Q}}}_applyPatch(Z,J){let X=this;if(Z[Yy]===!0)return;Z[Yy]=!0,this._wrap(Z,"handle",(Y)=>{if(Y.length===4)return Y;let $=function(Q,W){l41(Q,J);let K=Q[wY].filter((O)=>O!=="/"&&O!=="/*").join("").replace(/\/{2,}/g,"/"),G=K.length>0?K:void 0,z={[a41.SEMATTRS_HTTP_ROUTE]:G},H=i41(K,Z,J),V=H.attributes[O4.EXPRESS_TYPE],q=EQ(U7.context.active());if(q?.type===EJ.HTTP)q.route=G;if(n41(H.name,V,X.getConfig())){if(V===AJ.MIDDLEWARE)Q[wY].pop();return Y.apply(this,arguments)}if(U7.trace.getSpan(U7.context.active())===void 0)return Y.apply(this,arguments);let F=X._getSpanName({request:Q,layerType:V,route:K},H.name),U=X.tracer.startSpan(F,{attributes:Object.assign(z,H.attributes)}),{requestHook:B}=X.getConfig();if(B)$Y(()=>B(U,{request:Q,layerType:V,route:K}),(O)=>{if(O)U7.diag.error("express instrumentation: request hook failed",O)},!0);let w=!1;if(H.attributes[O4.EXPRESS_TYPE]!==AJ.MIDDLEWARE)U.end(),w=!0;let j=()=>{if(w===!1)w=!0,U.end()},N=Array.from(arguments),R=N.findIndex((O)=>typeof O==="function");if(R>=0)arguments[R]=function(){let O=arguments[0],P=![void 0,null,"route","router"].includes(O);if(!w&&P){let[C,T]=$y(O);U.recordException(C),U.setStatus({code:U7.SpanStatusCode.ERROR,message:T})}if(w===!1)w=!0,Q.res?.removeListener("finish",j),U.end();if(!(Q.route&&P))Q[wY].pop();return N[R].apply(this,arguments)};try{return Y.apply(this,arguments)}catch(O){let[P,D]=$y(O);throw U.recordException(P),U.setStatus({code:U7.SpanStatusCode.ERROR,message:D}),O}finally{if(!w)W.once("finish",j)}};for(let Q in Y)Object.defineProperty($,Q,{get(){return Y[Q]},set(W){Y[Q]=W}});return $})}_getSpanName(Z,J){let{spanNameHook:X}=this.getConfig();if(!(X instanceof Function))return J;try{return X(Z,J)??J}catch(Y){return U7.diag.error("express instrumentation: error calling span name rewrite hook",Y),J}}}var o41="Express",j66="Express-V5";function r41(Z){o1(Z,"auto.http.otel.express");let J=B0(Z).data,X=J["express.type"];if(X)Z.setAttribute(N0,`${X}.express`);let Y=J["express.name"];if(typeof Y==="string")Z.updateName(Y)}function t41(Z,J){if(E0()===z4())return j4&&h.warn("Isolation scope is still default isolation scope - skipping setting transactionName"),J;if(Z.layerType==="request_handler"){let X=Z.request,Y=X.method?X.method.toUpperCase():"GET";E0().setTransactionName(`${Y} ${Z.route}`)}return J}var Wy=w0(o41,()=>new s41.ExpressInstrumentation({requestHook:(Z)=>r41(Z),spanNameHook:(Z,J)=>t41(Z,J)})),Ky=w0(j66,()=>new Qy({requestHook:(Z)=>r41(Z),spanNameHook:(Z,J)=>t41(Z,J)})),O66=()=>{return{name:o41,setupOnce(){Wy(),Ky()}}},ER=a(O66);function Gy(Z){return function J(X,Y,$,Q){let W=j3(Y);if(E0().setSDKProcessingMetadata({normalizedRequest:W}),(Z?.shouldHandleError||N66)(X)){let G=Z1(X,{mechanism:{type:"middleware",handled:!1}});$.sentry=G}Q(X)}}function M66(){return function Z(J,X,Y){let $=j3(J);E0().setSDKProcessingMetadata({normalizedRequest:$}),Y()}}function e41(Z,J){Z.use(M66()),Z.use(Gy(J)),SJ(Z.use,"express")}function R66(Z){let J=Z.status||Z.statusCode||Z.status_code||Z.output?.statusCode;return J?parseInt(J,10):500}function N66(Z){return R66(Z)>=500}import*as By from"diagnostics_channel";var f8=e(Y0(),1);import C71 from"diagnostics_channel";var l8=e(R1(),1);var M71=e(q71(),1);var PF=(Z)=>{if(typeof Z!=="string")throw new TypeError("invalid pattern");if(Z.length>65536)throw new TypeError("pattern is too long")};var v66={"[: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]},CF=(Z)=>Z.replace(/[[\]\\-]/g,"\\$&"),S66=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),F71=(Z)=>Z.join(""),U71=(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,[j,N,R]]of Object.entries(v66))if(Z.startsWith(w,Q)){if(V)return["$.",!1,Z.length-X,!0];if(Q+=w.length,R)$.push(j);else Y.push(j);K=K||N;continue Z}}if(G=!1,V){if(B>V)Y.push(CF(V)+"-"+CF(B));else if(B===V)Y.push(CF(B));V="",Q++;continue}if(Z.startsWith("-]",Q+1)){Y.push(CF(B+"-")),Q+=2;continue}if(Z.startsWith("-",Q+1)){V=B,Q+=2;continue}Y.push(CF(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[S66(B),!1,H-X,!1]}let q="["+(z?"^":"")+F71(Y)+"]",F="["+(z?"":"^")+F71($)+"]";return[Y.length&&$.length?"("+q+"|"+F+")":Y.length?q:F,K,H-X,!0]};var BY=(Z,{windowsPathsNoEscape:J=!1}={})=>{return J?Z.replace(/\[([^\/\\])\]/g,"$1"):Z.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var _66=new Set(["!","?","+","*","@"]),w71=(Z)=>_66.has(Z),A66="(?!(?:^|/)\\.\\.?(?:$|/))",IR="(?!\\.)",x66=new Set(["[","."]),h66=new Set(["..","."]),f66=new Set("().*{}+?[]^$\\!"),b66=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Vy="[^/]",B71=Vy+"*?",L71=Vy+"+?";class k6{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 k6&&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 k6&&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 k6(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&&w71(U)&&Z.charAt(q)==="("){J.push(F),F="";let B=new k6(U,J);q=k6.#U(Z,B,q,Y),J.push(B);continue}F+=U}return J.push(F),q}let G=X+1,z=new k6(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(w71(q)&&Z.charAt(G)==="("){z.push(V),V="";let F=new k6(q,z);z.push(F),G=k6.#U(Z,F,G,Y);continue}if(q==="|"){z.push(V),V="",H.push(z),z=new k6(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 k6(null,void 0,J);return k6.#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"?k6.#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&&h66.has(this.#X[0]))){let F=x66,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?A66:B?IR:""}}}let H="";if(this.isEnd()&&this.#Z.#K&&this.#$?.type==="!")H="(?:$|\\/)";return[z+G+H,BY(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,BY(this.toString()),!1,!1]}let Q=!X||Z||J||!IR?"":this.#B(!0);if(Q===$)Q="";if(Q)$=`(?:${$})(?:${Q})*?`;let W="";if(this.type==="!"&&this.#V)W=(this.isStart()&&!J?IR:"")+L71;else{let K=this.type==="!"?"))"+(this.isStart()&&!J&&!Z?IR:"")+B71+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&Q?")":this.type==="*"&&Q?")?":`)${this.type}`;W=Y+$+K}return[W,BY($),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,$+=(f66.has(K)?"\\":"")+K;continue}if(K==="\\"){if(W===Z.length-1)$+="\\\\";else Y=!0;continue}if(K==="["){let[G,z,H,V]=U71(Z,W);if(H){$+=G,Q=Q||z,W+=H-1,J=J||V;continue}}if(K==="*"){if(X&&Z==="*")$+=L71;else $+=B71;J=!0;continue}if(K==="?"){$+=Vy,J=!0;continue}$+=b66(K)}return[$,BY(Z),!!J,Q]}}var qy=(Z,{windowsPathsNoEscape:J=!1}={})=>{return J?Z.replace(/[?*()[\]]/g,"[$&]"):Z.replace(/[?*()[\]\\]/g,"\\$&")};var E6=(Z,J,X={})=>{if(PF(J),!X.nocomment&&J.charAt(0)==="#")return!1;return new TF(J,X).match(Z)},y66=/^\*+([^+@!?\*\[\(]*)$/,g66=(Z)=>(J)=>!J.startsWith(".")&&J.endsWith(Z),m66=(Z)=>(J)=>J.endsWith(Z),u66=(Z)=>{return Z=Z.toLowerCase(),(J)=>!J.startsWith(".")&&J.toLowerCase().endsWith(Z)},d66=(Z)=>{return Z=Z.toLowerCase(),(J)=>J.toLowerCase().endsWith(Z)},c66=/^\*+\.\*+$/,l66=(Z)=>!Z.startsWith(".")&&Z.includes("."),p66=(Z)=>Z!=="."&&Z!==".."&&Z.includes("."),i66=/^\.\*+$/,n66=(Z)=>Z!=="."&&Z!==".."&&Z.startsWith("."),a66=/^\*+$/,s66=(Z)=>Z.length!==0&&!Z.startsWith("."),o66=(Z)=>Z.length!==0&&Z!=="."&&Z!=="..",r66=/^\?+([^+@!?\*\[\(]*)?$/,t66=([Z,J=""])=>{let X=R71([Z]);if(!J)return X;return J=J.toLowerCase(),(Y)=>X(Y)&&Y.toLowerCase().endsWith(J)},e66=([Z,J=""])=>{let X=N71([Z]);if(!J)return X;return J=J.toLowerCase(),(Y)=>X(Y)&&Y.toLowerCase().endsWith(J)},Z56=([Z,J=""])=>{let X=N71([Z]);return!J?X:(Y)=>X(Y)&&Y.endsWith(J)},J56=([Z,J=""])=>{let X=R71([Z]);return!J?X:(Y)=>X(Y)&&Y.endsWith(J)},R71=([Z])=>{let J=Z.length;return(X)=>X.length===J&&!X.startsWith(".")},N71=([Z])=>{let J=Z.length;return(X)=>X.length===J&&X!=="."&&X!==".."},D71=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",j71={win32:{sep:"\\"},posix:{sep:"/"}},X56=D71==="win32"?j71.win32.sep:j71.posix.sep;E6.sep=X56;var R4=Symbol("globstar **");E6.GLOBSTAR=R4;var Y56="[^/]",$56=Y56+"*?",Q56="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",W56="(?:(?!(?:\\/|^)\\.).)*?",K56=(Z,J={})=>(X)=>E6(X,Z,J);E6.filter=K56;var M4=(Z,J={})=>Object.assign({},Z,J),G56=(Z)=>{if(!Z||typeof Z!=="object"||!Object.keys(Z).length)return E6;let J=E6;return Object.assign((Y,$,Q={})=>J(Y,$,M4(Z,Q)),{Minimatch:class Y extends J.Minimatch{constructor($,Q={}){super($,M4(Z,Q))}static defaults($){return J.defaults(M4(Z,$)).Minimatch}},AST:class Y extends J.AST{constructor($,Q,W={}){super($,Q,M4(Z,W))}static fromGlob($,Q={}){return J.AST.fromGlob($,M4(Z,Q))}},unescape:(Y,$={})=>J.unescape(Y,M4(Z,$)),escape:(Y,$={})=>J.escape(Y,M4(Z,$)),filter:(Y,$={})=>J.filter(Y,M4(Z,$)),defaults:(Y)=>J.defaults(M4(Z,Y)),makeRe:(Y,$={})=>J.makeRe(Y,M4(Z,$)),braceExpand:(Y,$={})=>J.braceExpand(Y,M4(Z,$)),match:(Y,$,Q={})=>J.match(Y,$,M4(Z,Q)),sep:J.sep,GLOBSTAR:R4})};E6.defaults=G56;var P71=(Z,J={})=>{if(PF(Z),J.nobrace||!/\{(?:(?!\{).)*\}/.test(Z))return[Z];return M71.default(Z)};E6.braceExpand=P71;var z56=(Z,J={})=>new TF(Z,J).makeRe();E6.makeRe=z56;var H56=(Z,J,X={})=>{let Y=new TF(J,X);if(Z=Z.filter(($)=>Y.match($)),Y.options.nonull&&!Z.length)Z.push(J);return Z};E6.match=H56;var O71=/[?*]|[+@!]\(.*?\)|\[|\]/,V56=(Z)=>Z.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class TF{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(Z,J={}){if(PF(Z),J=J||{},this.options=J,this.pattern=Z,this.platform=J.platform||D71,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]==="?"||!O71.test($[2]))&&!O71.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]),j=!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=j?3:w?0:void 0;if(typeof N==="number"&&typeof R==="number"){let[O,P]=[Z[N],J[R]];if(O.toLowerCase()===P.toLowerCase()){if(J[R]=O,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===R4){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(`
484
484
  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(`
485
- >>> 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 P71(this.pattern,this.options)}parse(Z){PF(Z);let J=this.options;if(Z==="**")return R4;if(Z==="")return"";let X,Y=null;if(X=Z.match(a66))Y=J.dot?o66:s66;else if(X=Z.match(y66))Y=(J.nocase?J.dot?d66:u66:J.dot?m66:g66)(X[1]);else if(X=Z.match(r66))Y=(J.nocase?J.dot?e66:t66:J.dot?Z56:J56)(X);else if(X=Z.match(c66))Y=J.dot?p66:l66;else if(X=Z.match(i66))Y=n66;let $=k6.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?$56:J.dot?Q56:W56,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"?V56(z):z===R4?R4:z._src});return G.forEach((z,H)=>{let V=G[H+1],q=G[H-1];if(z!==R4||q===R4)return;if(q===void 0)if(V!==void 0&&V!==R4)G[H+1]="(?:\\/|"+X+"\\/)?"+V;else G[H]=X;else if(V===void 0)G[H-1]=q+"(?:\\/|"+X+")?";else if(V!==R4)G[H-1]=q+"(?:\\/|\\/"+X+"\\/)"+V,G[H+1]=R4}),G.filter((z)=>z!==R4).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 E6.defaults(Z).Minimatch}}E6.AST=k6;E6.Minimatch=TF;E6.escape=qy;E6.unescape=BY;var T71="@fastify/otel",F56="0.8.0",U56=">=4.0.0 <6",k71=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],r1={HOOK_NAME:"hook.name",FASTIFY_TYPE:"fastify.type",HOOK_CALLBACK_NAME:"hook.callback.name",ROOT:"fastify.root"},LY={ROUTE:"route-hook",INSTANCE:"hook",HANDLER:"request-handler"},xJ="anonymous",D5=Symbol("fastify otel instance"),jY=Symbol("fastify otel request spans"),kF=Symbol("fastify otel request context"),E71=Symbol("fastify otel addhook original"),I71=Symbol("fastify otel setnotfound original"),vR=Symbol("fastify otel ignore path");class Fy extends h8{constructor(Z){super(T71,F56,Z);if(this.servername=Z?.servername??process.env.OTEL_SERVICE_NAME??"fastify",this[vR]=null,this._logger=f8.diag.createComponentLogger({namespace:T71}),Z?.ignorePaths!=null||process.env.OTEL_FASTIFY_IGNORE_PATHS!=null){let J=Z?.ignorePaths??process.env.OTEL_FASTIFY_IGNORE_PATHS;if((typeof J!=="string"||J.length===0)&&typeof J!=="function")throw new TypeError("ignorePaths must be a string or a function");let X=E6;this[vR]=(Y)=>{if(typeof J==="function")return J(Y);else return X(Y.url,J)}}}enable(){if(this._handleInitialization===void 0&&this.getConfig().registerOnInitialization){let Z=this.plugin();this._handleInitialization=(J)=>{J.fastify.register(Z)},C71.subscribe("fastify.initialization",this._handleInitialization)}return super.enable()}disable(){if(this._handleInitialization)C71.unsubscribe("fastify.initialization",this._handleInitialization),this._handleInitialization=void 0;return super.disable()}init(){return[]}plugin(){let Z=this;return J[Symbol.for("skip-override")]=!0,J[Symbol.for("fastify.display-name")]="@fastify/otel",J[Symbol.for("plugin-meta")]={fastify:U56,name:"@fastify/otel"},J;function J(X,Y,$){X.decorate(D5,Z),X.decorate(E71,X.addHook),X.decorate(I71,X.setNotFoundHandler),X.decorateRequest("opentelemetry",function H(){let V=this[kF];return{span:this[jY],tracer:Z.tracer,context:V,inject:(F,U)=>{return f8.propagation.inject(V,F,U)},extract:(F,U)=>{return f8.propagation.extract(V,F,U)}}}),X.decorateRequest(jY,null),X.decorateRequest(kF,null),X.addHook("onRoute",function(H){if(Z[vR]?.(H)===!0){Z._logger.debug(`Ignoring route instrumentation ${H.method} ${H.url} because it matches the ignore path`);return}for(let V of k71)if(H[V]!=null){let q=H[V];if(typeof q==="function")H[V]=z(q,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - route -> ${V}`,[r1.FASTIFY_TYPE]:LY.ROUTE,[l8.ATTR_HTTP_ROUTE]:H.url,[r1.HOOK_CALLBACK_NAME]:q.name?.length>0?q.name:xJ});else if(Array.isArray(q)){let F=[];for(let U of q)F.push(z(U,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - route -> ${V}`,[r1.FASTIFY_TYPE]:LY.ROUTE,[l8.ATTR_HTTP_ROUTE]:H.url,[r1.HOOK_CALLBACK_NAME]:U.name?.length>0?U.name:xJ}));H[V]=F}}if(H.onSend!=null)H.onSend=Array.isArray(H.onSend)?[...H.onSend,Q]:[H.onSend,Q];else H.onSend=Q;if(H.onError!=null)H.onError=Array.isArray(H.onError)?[...H.onError,W]:[H.onError,W];else H.onError=W;H.handler=z(H.handler,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - route-handler`,[r1.FASTIFY_TYPE]:LY.HANDLER,[l8.ATTR_HTTP_ROUTE]:H.url,[r1.HOOK_CALLBACK_NAME]:H.handler.name.length>0?H.handler.name:xJ})}),X.addHook("onRequest",function(H,V,q){if(this[D5].isEnabled()===!1)return q();else if(this[D5][vR]?.({url:H.url,method:H.method})===!0)return this[D5]._logger.debug(`Ignoring request ${H.method} ${H.url} because it matches the ignore path`),q();let F=f8.context.active();if(f8.trace.getSpan(F)==null)F=f8.propagation.extract(F,H.headers);let U=EQ(F);if(H.routeOptions.url!=null&&U?.type===EJ.HTTP)U.route=H.routeOptions.url;let B=this[D5].tracer.startSpan("request",{attributes:{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.ROOT]:"@fastify/otel",[l8.ATTR_HTTP_ROUTE]:H.url,[l8.ATTR_HTTP_REQUEST_METHOD]:H.method}},F);H[kF]=f8.trace.setSpan(F,B),H[jY]=B,f8.context.with(H[kF],()=>{q()})}),X.addHook("onResponse",function(H,V,q){let F=H[jY];if(F!=null)F.setStatus({code:f8.SpanStatusCode.OK,message:"OK"}),F.setAttributes({[l8.ATTR_HTTP_RESPONSE_STATUS_CODE]:404}),F.end();H[jY]=null,q()}),X.addHook=K,X.setNotFoundHandler=G,$();function Q(H,V,q,F){let U=H[jY];if(U!=null){if(V.statusCode<500)U.setStatus({code:f8.SpanStatusCode.OK,message:"OK"});U.setAttributes({[l8.ATTR_HTTP_RESPONSE_STATUS_CODE]:V.statusCode}),U.end()}H[jY]=null,F(null,q)}function W(H,V,q,F){let U=H[jY];if(U!=null)U.setStatus({code:f8.SpanStatusCode.ERROR,message:q.message}),U.recordException(q);F()}function K(H,V){let q=this[E71];if(k71.includes(H))return q.call(this,H,z(V,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - ${H}`,[r1.FASTIFY_TYPE]:LY.INSTANCE,[r1.HOOK_CALLBACK_NAME]:V.name?.length>0?V.name:xJ}));else return q.call(this,H,V)}function G(H,V){let q=this[I71];if(typeof H==="function")V=z(H,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[r1.FASTIFY_TYPE]:LY.INSTANCE,[r1.HOOK_CALLBACK_NAME]:H.name?.length>0?H.name:xJ}),q.call(this,V);else{if(H.preValidation!=null)H.preValidation=z(H.preValidation,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[r1.FASTIFY_TYPE]:LY.INSTANCE,[r1.HOOK_CALLBACK_NAME]:H.preValidation.name?.length>0?H.preValidation.name:xJ});if(H.preHandler!=null)H.preHandler=z(H.preHandler,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[r1.FASTIFY_TYPE]:LY.INSTANCE,[r1.HOOK_CALLBACK_NAME]:H.preHandler.name?.length>0?H.preHandler.name:xJ});V=z(V,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[r1.FASTIFY_TYPE]:LY.INSTANCE,[r1.HOOK_CALLBACK_NAME]:V.name?.length>0?V.name:xJ}),q.call(this,H,V)}}function z(H,V={}){return function q(...F){let U=this[D5],[B]=F;if(U.isEnabled()===!1)return H.call(this,...F);let w=B[kF]??f8.context.active(),j=U.tracer.startSpan(`handler - ${H.name?.length>0?H.name:this.pluginName??xJ}`,{attributes:V},w);return f8.context.with(f8.trace.setSpan(w,j),function(){try{let N=H.call(this,...F);if(typeof N?.then==="function")return N.then((R)=>{return j.end(),R},(R)=>{return j.setStatus({code:f8.SpanStatusCode.ERROR,message:R.message}),j.recordException(R),j.end(),Promise.reject(R)});return j.end(),N}catch(N){throw j.setStatus({code:f8.SpanStatusCode.ERROR,message:N.message}),j.recordException(N),j.end(),N}},this)}}}}}var w7=e(Y0(),1);var x71=e(R1(),1);var hJ;(function(Z){Z.FASTIFY_NAME="fastify.name";let X="fastify.type";Z.FASTIFY_TYPE=X;let Y="hook.name";Z.HOOK_NAME=Y;let $="plugin.name";Z.PLUGIN_NAME=$})(hJ||(hJ={}));var EF;(function(Z){Z.MIDDLEWARE="middleware";let X="request_handler";Z.REQUEST_HANDLER=X})(EF||(EF={}));var IF;(function(Z){Z.MIDDLEWARE="middleware";let X="request handler";Z.REQUEST_HANDLER=X})(IF||(IF={}));var S71=e(Y0(),1);var vF=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function Uy(Z,J,X,Y={}){let $=J.startSpan(X,{attributes:Y}),Q=Z[vF]||[];return Q.push($),Object.defineProperty(Z,vF,{enumerable:!1,configurable:!0,value:Q}),$}function SR(Z,J){let X=Z[vF]||[];if(!X.length)return;X.forEach((Y)=>{if(J)Y.setStatus({code:S71.SpanStatusCode.ERROR,message:J.message}),Y.recordException(J);Y.end()}),delete Z[vF]}function _71(Z,J,X){let Y,$=void 0;try{if($=Z(),v71($))$.then((Q)=>J(void 0,Q),(Q)=>J(Q))}catch(Q){Y=Q}finally{if(!v71($)){if(J(Y,$),Y)throw Y}return $}}function v71(Z){return typeof Z==="object"&&Z&&typeof Object.getOwnPropertyDescriptor(Z,"then")?.value==="function"||!1}var w56="0.1.0",B56="@sentry/instrumentation-fastify-v3",A71="anonymous",L56=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]);class wy extends h8{constructor(Z={}){super(B56,w56,Z)}init(){return[new a6("fastify",[">=3.0.0 <4"],(Z)=>{return this._patchConstructor(Z)})]}_hookOnRequest(){let Z=this;return function J(X,Y,$){if(!Z.isEnabled())return $();Z._wrap(Y,"send",Z._patchSend());let Q=X,W=EQ(w7.context.active()),K=Q.routeOptions?Q.routeOptions.url:X.routerPath;if(K&&W?.type===EJ.HTTP)W.route=K;let G=X.method||"GET";E0().setTransactionName(`${G} ${K}`),$()}}_wrapHandler(Z,J,X,Y){let $=this;return this._diag.debug("Patching fastify route.handler function"),function(...Q){if(!$.isEnabled())return X.apply(this,Q);let W=X.name||Z||A71,K=`${IF.MIDDLEWARE} - ${W}`,G=Q[1],z=Uy(G,$.tracer,K,{[hJ.FASTIFY_TYPE]:EF.MIDDLEWARE,[hJ.PLUGIN_NAME]:Z,[hJ.HOOK_NAME]:J}),H=Y&&Q[Q.length-1];if(H)Q[Q.length-1]=function(...V){SR(G),H.apply(this,V)};return w7.context.with(w7.trace.setSpan(w7.context.active(),z),()=>{return _71(()=>{return X.apply(this,Q)},(V)=>{if(V instanceof Error)z.setStatus({code:w7.SpanStatusCode.ERROR,message:V.message}),z.recordException(V);if(!Y)SR(G)})})}}_wrapAddHook(){let Z=this;return this._diag.debug("Patching fastify server.addHook function"),function(J){return function X(...Y){let $=Y[0],Q=Y[1],W=this.pluginName;if(!L56.has($))return J.apply(this,Y);let K=typeof Y[Y.length-1]==="function"&&Q.constructor.name!=="AsyncFunction";return J.apply(this,[$,Z._wrapHandler(W,$,Q,K)])}}}_patchConstructor(Z){let J=this;function X(...Y){let $=Z.fastify.apply(this,Y);return $.addHook("onRequest",J._hookOnRequest()),$.addHook("preHandler",J._hookPreHandler()),j56(),J._wrap($,"addHook",J._wrapAddHook()),$}if(Z.errorCodes!==void 0)X.errorCodes=Z.errorCodes;return X.fastify=X,X.default=X,X}_patchSend(){let Z=this;return this._diag.debug("Patching fastify reply.send function"),function J(X){return function Y(...$){let Q=$[0];if(!Z.isEnabled())return X.apply(this,$);return $Y(()=>{return X.apply(this,$)},(W)=>{if(!W&&Q instanceof Error)W=Q;SR(this,W)})}}}_hookPreHandler(){let Z=this;return this._diag.debug("Patching fastify preHandler function"),function J(X,Y,$){if(!Z.isEnabled())return $();let Q=X,W=Q.routeOptions?.handler||Q.context?.handler,K=W?.name.startsWith("bound ")?W.name.substring(6):W?.name,G=`${IF.REQUEST_HANDLER} - ${K||this.pluginName||A71}`,z={[hJ.PLUGIN_NAME]:this.pluginName,[hJ.FASTIFY_TYPE]:EF.REQUEST_HANDLER,[x71.SEMATTRS_HTTP_ROUTE]:Q.routeOptions?Q.routeOptions.url:X.routerPath};if(K)z[hJ.FASTIFY_NAME]=K;let H=Uy(Y,Z.tracer,G,z);h71(H);let{requestHook:V}=Z.getConfig();if(V)$Y(()=>V(H,{request:X}),(q)=>{if(q)Z._diag.error("request hook failed",q)},!0);return w7.context.with(w7.trace.setSpan(w7.context.active(),H),()=>{$()})}}}function j56(){let Z=X0();if(Z)Z.on("spanStart",(J)=>{h71(J)})}function h71(Z){let J=B0(Z).data,X=J["fastify.type"];if(J[N0]||!X)return;Z.setAttributes({[_0]:"auto.http.otel.fastify",[N0]:`${X}.fastify`});let Y=J["fastify.name"]||J["plugin.name"]||J["hook.name"];if(typeof Y==="string"){let $=Y.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");Z.updateName($)}}var f71="Fastify",O56="Fastify-V5",M56="Fastify-V3",Ly=w0(M56,()=>new wy);function b71(){let Z=X0();if(!Z)return;else return Z.getIntegrationByName(f71)}function _R(Z,J,X,Y){let $=b71()?.getShouldHandleError()||y71;if(Y==="diagnostics-channel")this.diagnosticsChannelExists=!0;if(this.diagnosticsChannelExists&&Y==="onError-hook"){j4&&h.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}if($(Z,J,X))Z1(Z,{mechanism:{handled:!1,type:"fastify"}})}var jy=w0(O56,()=>{let Z=new Fy,J=Z.plugin();return By.subscribe("fastify.initialization",(X)=>{let Y=X.fastify;Y?.register(J).after(($)=>{if($)j4&&h.error("Failed to setup Fastify instrumentation",$);else if(N56(),Y)D56(Y)})}),By.subscribe("tracing:fastify.request.handler:error",(X)=>{let{error:Y,request:$,reply:Q}=X;_R.call(_R,Y,$,Q,"diagnostics-channel")}),Z}),R56=({shouldHandleError:Z})=>{let J;return{name:f71,setupOnce(){J=Z||y71,Ly(),jy()},getShouldHandleError(){return J},setShouldHandleError(X){J=X}}},AR=a((Z={})=>R56(Z));function y71(Z,J,X){let Y=X.statusCode;return Y>=500||Y<=299}function g71(Z,J){if(J?.shouldHandleError)b71()?.setShouldHandleError(J.shouldHandleError);let X=Object.assign(function(Y,$,Q){Y.addHook("onError",async(W,K,G)=>{_R.call(_R,G,W,K,"onError-hook")}),Q()},{[Symbol.for("skip-override")]:!0,[Symbol.for("fastify.display-name")]:"sentry-fastify-error-handler"});Z.register(X)}function m71(Z){let J=B0(Z),X=J.description,Y=J.data,$=Y["fastify.type"],Q=$==="hook",W=$===X?.startsWith("handler -"),K=X==="request"||$==="request-handler";if(Y[N0]||!W&&!K&&!Q)return;let G=Q?"hook":W?"middleware":K?"request-handler":"<unknown>";Z.setAttributes({[_0]:"auto.http.otel.fastify",[N0]:`${G}.fastify`});let z=Y["fastify.name"]||Y["plugin.name"]||Y["hook.name"];if(typeof z==="string"){let H=z.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");Z.updateName(H)}}function N56(){let Z=X0();if(Z)Z.on("spanStart",(J)=>{m71(J)})}function D56(Z){Z.addHook("onRequest",async(J,X)=>{if(J.opentelemetry){let{span:Q}=J.opentelemetry();if(Q)m71(Q)}let Y=J.routeOptions?.url,$=J.method||"GET";E0().setTransactionName(`${$} ${Y}`)})}var PZ1=e(Y0(),1),CZ1=e(DZ1(),1);var TZ1="Graphql",Cy=w0(TZ1,CZ1.GraphQLInstrumentation,(Z)=>{let J=kZ1(Z);return{...J,responseHook(X,Y){if(o1(X,"auto.graphql.otel.graphql"),Y.errors?.length&&!B0(X).status)X.setStatus({code:PZ1.SpanStatusCode.ERROR});let Q=B0(X).data,W=Q["graphql.operation.type"],K=Q["graphql.operation.name"];if(J.useOperationNameForRootSpan&&W){let G=s1(X),H=B0(G).data[h3]||[],V=K?`${W} ${K}`:`${W}`;if(Array.isArray(H))H.push(V),G.setAttribute(h3,H);else if(typeof H==="string")G.setAttribute(h3,[H,V]);else G.setAttribute(h3,V);if(!B0(G).data["original-description"])G.setAttribute("original-description",B0(G).description);G.updateName(`${B0(G).data["original-description"]} (${o56(H)})`)}}}}),s56=(Z={})=>{return{name:TZ1,setupOnce(){Cy(kZ1(Z))}}},bR=a(s56);function kZ1(Z){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...Z}}function o56(Z){if(Array.isArray(Z)){let J=Z.slice().sort();if(J.length<=5)return J.join(", ");else return`${J.slice(0,5).join(", ")}, +${J.length-5}`}return`${Z}`}var lZ1=e(cZ1(),1);var pZ1="Kafka",Ty=w0(pZ1,()=>new lZ1.KafkaJsInstrumentation({consumerHook(Z){o1(Z,"auto.kafkajs.otel.consumer")},producerHook(Z){o1(Z,"auto.kafkajs.otel.producer")}})),e56=()=>{return{name:pZ1,setupOnce(){Ty()}}},yR=a(e56);var YJ1=e(XJ1(),1);var $J1="LruMemoizer",ky=w0($J1,()=>new YJ1.LruMemoizerInstrumentation),Y96=()=>{return{name:$J1,setupOnce(){ky()}}},gR=a(Y96);var OJ1=e(jJ1(),1);var MJ1="Mongo",_y=w0(MJ1,()=>new OJ1.MongoDBInstrumentation({dbStatementSerializer:G96,responseHook(Z){o1(Z,"auto.db.otel.mongo")}}));function G96(Z){let J=Sy(Z);return JSON.stringify(J)}function Sy(Z){if(Array.isArray(Z))return Z.map((J)=>Sy(J));if(z96(Z)){let J={};return Object.entries(Z).map(([X,Y])=>[X,Sy(Y)]).reduce((X,Y)=>{if(V96(Y))X[Y[0]]=Y[1];return X},J)}return"?"}function z96(Z){return typeof Z==="object"&&Z!==null&&!H96(Z)}function H96(Z){let J=!1;if(typeof Buffer!=="undefined")J=Buffer.isBuffer(Z);return J}function V96(Z){return Array.isArray(Z)}var q96=()=>{return{name:MJ1,setupOnce(){_y()}}},mR=a(q96);var uJ1=e(mJ1(),1);var dJ1="Mongoose",hy=w0(dJ1,()=>new uJ1.MongooseInstrumentation({responseHook(Z){o1(Z,"auto.db.otel.mongoose")}})),C96=()=>{return{name:dJ1,setupOnce(){hy()}}},dR=a(C96);var WX1=e(QX1(),1);var KX1="Mysql",gy=w0(KX1,()=>new WX1.MySQLInstrumentation({})),u96=()=>{return{name:KX1,setupOnce(){gy()}}},lR=a(u96);var kX1=e(TX1(),1);var EX1="Mysql2",ly=w0(EX1,()=>new kX1.MySQL2Instrumentation({responseHook(Z){o1(Z,"auto.db.otel.mysql2")}})),$46=()=>{return{name:EX1,setupOnce(){ly()}}},iR=a($46);var wY1=e(nX1(),1),BY1=e(HY1(),1);var j46=["get","set","setex"],iy=["get","mget"],O46=["set","setex"];function gF(Z,J){return Z.includes(J.toLowerCase())}function ny(Z){if(gF(iy,Z))return"cache.get";else if(gF(O46,Z))return"cache.put";else return}function M46(Z,J){return J.some((X)=>Z.startsWith(X))}function qY1(Z,J){try{if(J.length===0)return;let X=($)=>{if(typeof $==="string"||typeof $==="number"||Buffer.isBuffer($))return[$.toString()];else if(Array.isArray($))return VY1($.map((Q)=>X(Q)));else return["<unknown>"]},Y=J[0];if(gF(j46,Z)&&Y!=null)return X(Y);return VY1(J.map(($)=>X($)))}catch{return}}function FY1(Z,J,X){if(!ny(Z))return!1;for(let Y of J)if(M46(Y,X))return!0;return!1}function UY1(Z){let J=(X)=>{try{if(Buffer.isBuffer(X))return X.byteLength;else if(typeof X==="string")return X.length;else if(typeof X==="number")return X.toString().length;else if(X===null||X===void 0)return 0;return JSON.stringify(X).length}catch{return}};return Array.isArray(Z)?Z.reduce((X,Y)=>{let $=J(Y);return typeof $==="number"?X!==void 0?X+$:$:X},0):J(Z)}function VY1(Z){let J=[],X=(Y)=>{Y.forEach(($)=>{if(Array.isArray($))X($);else J.push($)})};return X(Z),J}var LY1="Redis",ay={},jY1=(Z,J,X,Y)=>{Z.setAttribute(_0,"auto.db.otel.redis");let $=qY1(J,X),Q=ny(J);if(!$||!Q||!ay.cachePrefixes||!FY1(J,$,ay.cachePrefixes))return;let W=B0(Z).data["net.peer.name"],K=B0(Z).data["net.peer.port"];if(K&&W)Z.setAttributes({"network.peer.address":W,"network.peer.port":K});let G=UY1(Y);if(G)Z.setAttribute(Gh,G);if(gF(iy,J)&&G!==void 0)Z.setAttribute(Wh,G>0);Z.setAttributes({[N0]:Q,[Kh]:$});let z=$.join(", ");Z.updateName(s5(z,1024))},R46=w0("IORedis",()=>{return new wY1.IORedisInstrumentation({responseHook:jY1})}),N46=w0("Redis-4",()=>{return new BY1.RedisInstrumentation({responseHook:jY1})}),sy=Object.assign(()=>{R46(),N46()},{id:LY1}),D46=(Z={})=>{return{name:LY1,setupOnce(){ay=Z,sy()}}},aR=a(D46);var oY1=e(sY1(),1);var rY1="Postgres",Yg=w0(rY1,()=>new oY1.PgInstrumentation({requireParentSpan:!0,requestHook(Z){o1(Z,"auto.db.otel.postgres")}})),K76=()=>{return{name:rY1,setupOnce(){Yg()}}},tR=a(K76);var r3=e(Y0(),1);var r6=e(R1(),1);var $g="PostgresJs",tY1=[">=3.0.0 <4"],Qg=w0($g,(Z)=>new eY1({requireParentSpan:Z?.requireParentSpan??!0,requestHook:Z?.requestHook}));class eY1 extends h8{constructor(Z){super("sentry-postgres-js",M1,Z)}init(){let Z=new a6("postgres",tY1);return["src","cf/src","cjs/src"].forEach((J)=>{Z.files.push(new fM(`postgres/${J}/connection.js`,["*"],this._patchConnection.bind(this),this._unwrap.bind(this))),Z.files.push(new fM(`postgres/${J}/query.js`,tY1,this._patchQuery.bind(this),this._unwrap.bind(this)))}),[Z]}_shouldCreateSpans(){let Z=this.getConfig();return r3.trace.getSpan(r3.context.active())!==void 0||!Z.requireParentSpan}_patchReject(Z,J){return new Proxy(Z,{apply:(X,Y,$)=>{J.setStatus({code:x8,message:$?.[0]?.message||"unknown_error"});let Q=Reflect.apply(X,Y,$);return J.setAttribute(r6.ATTR_DB_RESPONSE_STATUS_CODE,$?.[0]?.code||"Unknown error"),J.setAttribute(r6.ATTR_ERROR_TYPE,$?.[0]?.name||"Unknown error"),J.end(),Q}})}_patchResolve(Z,J){return new Proxy(Z,{apply:(X,Y,$)=>{let Q=Reflect.apply(X,Y,$),W=$?.[0]?.command;if(W)J.setAttribute(r6.ATTR_DB_OPERATION_NAME,W);return J.end(),Q}})}_patchQuery(Z){return Z.Query.prototype.handle=new Proxy(Z.Query.prototype.handle,{apply:async(J,X,Y)=>{if(!this._shouldCreateSpans())return Reflect.apply(J,X,Y);let $=this._sanitizeSqlQuery(X.strings?.[0]);return jQ({name:$||"postgresjs.query",op:"db"},(Q)=>{let K=T0().getScopeData().contexts.postgresjsConnection;o1(Q,"auto.db.otel.postgres");let{requestHook:G}=this.getConfig();if(G)$Y(()=>G(Q,$,K),(q)=>{if(q)h.error(`Error in requestHook for ${$g} integration:`,q)});let z=K?.ATTR_DB_NAMESPACE||"<unknown database>",H=K?.ATTR_SERVER_ADDRESS||"<unknown host>",V=K?.ATTR_SERVER_PORT||"<unknown port>";Q.setAttribute(r6.ATTR_DB_SYSTEM_NAME,"postgres"),Q.setAttribute(r6.ATTR_DB_NAMESPACE,z),Q.setAttribute(r6.ATTR_SERVER_ADDRESS,H),Q.setAttribute(r6.ATTR_SERVER_PORT,V),Q.setAttribute(r6.ATTR_DB_QUERY_TEXT,$),X.resolve=this._patchResolve(X.resolve,Q),X.reject=this._patchReject(X.reject,Q);try{return Reflect.apply(J,X,Y)}catch(q){throw Q.setStatus({code:x8}),Q.end(),q}})}}),Z}_patchConnection(Z){return new Proxy(Z,{apply:(J,X,Y)=>{let $=Y[0]?.database||"<unknown database>",Q=Y[0]?.host?.[0]||"<unknown host>",W=Y[0]?.port?.[0]||"<unknown port>";return T0().setContext("postgresjsConnection",{ATTR_DB_NAMESPACE:$,ATTR_SERVER_ADDRESS:Q,ATTR_SERVER_PORT:W}),Reflect.apply(J,X,Y)}})}_sanitizeSqlQuery(Z){if(!Z)return"Unknown SQL Query";return Z.replace(/\s+/g," ").trim().substring(0,1024).replace(/--.*?(\r?\n|$)/g,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/;\s*$/,"").replace(/\b\d+\b/g,"?").replace(/\s+/g," ").replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/g,"IN (?)")}}var G76=()=>{return{name:$g,setupOnce(){Qg()}}},eR=a(G76);var X$1=e(Y0(),1);var AY=e(Y0(),1);var z76=process.env.PRISMA_SHOW_ALL_TRACES==="true",H76="00-10-10-00";function V76(Z){switch(Z){case"client":return AY.SpanKind.CLIENT;case"internal":default:return AY.SpanKind.INTERNAL}}var q76=class{traceMiddleware;tracerProvider;ignoreSpanTypes;constructor({traceMiddleware:Z,tracerProvider:J,ignoreSpanTypes:X}){this.traceMiddleware=Z,this.tracerProvider=J,this.ignoreSpanTypes=X}isEnabled(){return!0}getTraceParent(Z){let J=AY.trace.getSpanContext(Z??AY.context.active());if(J)return`00-${J.traceId}-${J.spanId}-0${J.traceFlags}`;return H76}dispatchEngineSpans(Z){let J=this.tracerProvider.getTracer("prisma"),X=new Map,Y=Z.filter(($)=>$.parentId===null);for(let $ of Y)Y$1(J,$,Z,X,this.ignoreSpanTypes)}getActiveContext(){return AY.context.active()}runInChildSpan(Z,J){if(typeof Z==="string")Z={name:Z};if(Z.internal&&!z76)return J();if(Z.middleware&&!this.traceMiddleware)return J();let X=this.tracerProvider.getTracer("prisma"),Y=Z.context??this.getActiveContext(),$=`prisma:client:${Z.name}`;if($$1($,this.ignoreSpanTypes))return J();if(Z.active===!1){let Q=X.startSpan($,Z,Y);return Z$1(Q,J(Q,Y))}return X.startActiveSpan($,Z,(Q)=>Z$1(Q,J(Q,Y)))}};function Y$1(Z,J,X,Y,$){if($$1(J.name,$))return;let Q={attributes:J.attributes,kind:V76(J.kind),startTime:J.startTime};Z.startActiveSpan(J.name,Q,(W)=>{if(Y.set(J.id,W.spanContext().spanId),J.links)W.addLinks(J.links.flatMap((G)=>{let z=Y.get(G);if(!z)return[];return{context:{spanId:z,traceId:W.spanContext().traceId,traceFlags:W.spanContext().traceFlags}}}));let K=X.filter((G)=>G.parentId===J.id);for(let G of K)Y$1(Z,G,X,Y,$);W.end(J.endTime)})}function Z$1(Z,J){if(F76(J))return J.then((X)=>{return Z.end(),X},(X)=>{throw Z.end(),X});return Z.end(),J}function F76(Z){return Z!=null&&typeof Z.then==="function"}function $$1(Z,J){return J.some((X)=>typeof X==="string"?X===Z:X.test(Z))}var Q$1={name:"@prisma/instrumentation",version:"6.11.1",description:"OpenTelemetry compliant instrumentation for Prisma Client",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.ts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation"},bugs:"https://github.com/prisma/prisma/issues",devDependencies:{"@prisma/internals":"workspace:*","@swc/core":"1.11.5","@types/jest":"29.5.14","@types/node":"18.19.76","@opentelemetry/api":"1.9.0",jest:"29.7.0","jest-junit":"16.0.0",typescript:"5.4.5"},dependencies:{"@opentelemetry/instrumentation":"^0.52.0 || ^0.53.0 || ^0.54.0 || ^0.55.0 || ^0.56.0 || ^0.57.0"},peerDependencies:{"@opentelemetry/api":"^1.8"},files:["dist"],keywords:["prisma","instrumentation","opentelemetry","otel"],scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"jest"},sideEffects:!1},Kg=Q$1.version,U76=Kg.split(".")[0],J$1="PRISMA_INSTRUMENTATION",Wg=`V${U76}_PRISMA_INSTRUMENTATION`,w76=Q$1.name,B76="@prisma/client",W$1=class extends h8{tracerProvider;constructor(Z={}){super(w76,Kg,Z)}setTracerProvider(Z){this.tracerProvider=Z}init(){return[new a6(B76,[Kg])]}enable(){let Z=this._config,J={helper:new q76({traceMiddleware:Z.middleware??!1,tracerProvider:this.tracerProvider??X$1.trace.getTracerProvider(),ignoreSpanTypes:Z.ignoreSpanTypes??[]})};global[J$1]=J,global[Wg]=J}disable(){delete global[J$1],delete global[Wg]}isEnabled(){return Boolean(global[Wg])}};var K$1="Prisma";function L76(Z){return!!Z&&typeof Z==="object"&&"dispatchEngineSpans"in Z}function G$1(){let Z=globalThis.PRISMA_INSTRUMENTATION;return Z&&typeof Z==="object"&&"helper"in Z?Z.helper:void 0}class z$1 extends W$1{constructor(){super()}enable(){super.enable();let Z=G$1(),J=!1;if(L76(Z))Z.createEngineSpan=()=>{e0(()=>{if(!J)J=!0,console.warn("[Sentry] The Sentry SDK supports tracing with Prisma version 5 only with limited capabilities. For full tracing capabilities pass `prismaInstrumentation` for version 5 to the Sentry `prismaIntegration`. Read more: https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/")})}}}var j76=w0(K$1,(Z)=>{if(Z?.prismaInstrumentation)return Z.prismaInstrumentation;return new z$1}),ZN=a(({prismaInstrumentation:Z}={})=>{return{name:K$1,setupOnce(){j76({prismaInstrumentation:Z})},setup(J){if(!G$1())return;J.on("spanStart",(X)=>{let Y=B0(X);if(Y.description?.startsWith("prisma:"))X.setAttribute(_0,"auto.db.otel.prisma");if(Y.description==="prisma:engine:db_query"&&Y.data["db.query.text"])X.updateName(Y.data["db.query.text"]);if(Y.description==="prisma:engine:db_query"&&!Y.data["db.system"])X.setAttribute("db.system","prisma")})}}});var k$1=e(T$1(),1);var E$1="Hapi",YN=w0(E$1,()=>new k$1.HapiInstrumentation),g76=()=>{return{name:E$1,setupOnce(){YN()}}},$N=a(g76);function m76(Z){return!!(Z&&typeof Z==="object"&&("error"in Z)&&Z.error)}function u76(Z){Z1(Z,{mechanism:{type:"hapi",handled:!1,data:{function:"hapiErrorPlugin"}}})}var d76={name:"SentryHapiErrorPlugin",version:M1,register:async function(Z){Z.events.on({name:"request",channels:["error"]},(X,Y)=>{if(E0()!==z4()){let $=X.route;if($.path)E0().setTransactionName(`${$.method.toUpperCase()} ${$.path}`)}else j4&&h.warn("Isolation scope is still the default isolation scope - skipping setting transactionName");if(m76(Y))u76(Y.error)})}};async function I$1(Z){await Z.register(d76);let J=X0();if(J)J.on("spanStart",(X)=>{c76(X)});SJ(Z.register,"hapi")}function c76(Z){let J=B0(Z).data,X=J["hapi.type"];if(J[N0]||!X)return;Z.setAttributes({[_0]:"auto.http.otel.hapi",[N0]:`${X}.hapi`})}var t$1=e(r$1(),1),e$1=e(R1(),1);var ZQ1="Koa",Bg=w0(ZQ1,t$1.KoaInstrumentation,(Z={})=>{return{ignoreLayersType:Z.ignoreLayersType,requestHook(J,X){o1(J,"auto.http.otel.koa");let Y=B0(J).data,$=Y["koa.type"];if($)J.setAttribute(N0,`${$}.koa`);let Q=Y["koa.name"];if(typeof Q==="string")J.updateName(Q||"< unknown >");if(E0()===z4()){j4&&h.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let W=Y[e$1.ATTR_HTTP_ROUTE],K=X.context?.request?.method?.toUpperCase()||"GET";if(W)E0().setTransactionName(`${K} ${W}`)}}}),t76=(Z={})=>{return{name:ZQ1,setupOnce(){Bg(Z)}}},KN=a(t76),JQ1=(Z)=>{Z.use(async(J,X)=>{try{await X()}catch(Y){throw Z1(Y),Y}}),SJ(Z.use,"koa")};var NQ1=e(RQ1(),1);var DQ1="Connect",Rg=w0(DQ1,()=>new NQ1.ConnectInstrumentation),qZ6=()=>{return{name:DQ1,setupOnce(){Rg()}}},zN=a(qZ6);function FZ6(Z,J,X,Y){Z1(Z),Y(Z)}var PQ1=(Z)=>{Z.use(FZ6);let J=X0();if(J)J.on("spanStart",(X)=>{UZ6(X)});SJ(Z.use,"connect")};function UZ6(Z){let J=B0(Z).data,X=J["connect.type"];if(J[N0]||!X)return;Z.setAttributes({[_0]:"auto.http.otel.connect",[N0]:`${X}.connect`});let Y=J["connect.name"];if(typeof Y==="string")Z.updateName(Y)}var pQ1=e(lQ1(),1);var iQ1="Knex",vZ6=w0(iQ1,()=>new pQ1.KnexInstrumentation({requireParentSpan:!0})),SZ6=()=>{let Z;return{name:iQ1,setupOnce(){let J=vZ6();Z=TJ(J)},setup(J){Z?.(()=>J.on("spanStart",(X)=>{let{data:Y}=B0(X);if("knex.version"in Y)X.setAttribute(_0,"auto.db.otel.knex")}))}}},nQ1=a(SZ6);var VW1=e(HW1(),1);var yZ6=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),qW1="Tedious",Dg=w0(qW1,()=>new VW1.TediousInstrumentation({})),gZ6=()=>{let Z;return{name:qW1,setupOnce(){let J=Dg();Z=TJ(J)},setup(J){Z?.(()=>J.on("spanStart",(X)=>{let{description:Y,data:$}=B0(X);if(!Y||$["db.system"]!=="mssql")return;let Q=Y.split(" ")[0]||"";if(yZ6.has(Q))X.setAttribute(_0,"auto.db.otel.tedious")}))}}},UN=a(gZ6);var NW1=e(RW1(),1);var DW1="GenericPool",Cg=w0(DW1,()=>new NW1.GenericPoolInstrumentation({})),cZ6=()=>{let Z;return{name:DW1,setupOnce(){let J=Cg();Z=TJ(J)},setup(J){Z?.(()=>J.on("spanStart",(X)=>{let $=B0(X).description;if($==="generic-pool.aquire"||$==="generic-pool.acquire")X.setAttribute(_0,"auto.db.otel.generic_pool")}))}}},wN=a(cZ6);var fW1=e(hW1(),1);var bW1="Dataloader",iZ6=w0(bW1,()=>new fW1.DataloaderInstrumentation({requireParentSpan:!0})),nZ6=()=>{let Z;return{name:bW1,setupOnce(){let J=iZ6();Z=TJ(J)},setup(J){Z?.(()=>{J.on("spanStart",(X)=>{let Y=B0(X);if(Y.description?.startsWith("dataloader"))X.setAttribute(_0,"auto.db.otel.dataloader");if(Y.description==="dataloader.load"||Y.description==="dataloader.loadMany"||Y.description==="dataloader.batch")X.setAttribute(N0,"cache.get")})})}}},yW1=a(nZ6);var $K1=e(YK1(),1);var QK1="Amqplib",FJ6={consumeEndHook:(Z)=>{o1(Z,"auto.amqplib.otel.consumer")},publishHook:(Z)=>{o1(Z,"auto.amqplib.otel.publisher")}},vg=w0(QK1,()=>new $K1.AmqplibInstrumentation(FJ6)),UJ6=()=>{return{name:QK1,setupOnce(){vg()}}},jN=a(UJ6);var pF="VercelAI";var WK1=["generateText","streamText","generateObject","streamObject","embed","embedMany"];function wJ6(Z,J,X,Y){let $=Z?.recordInputs!==void 0?Z.recordInputs:J.recordInputs!==void 0?J.recordInputs:X===!0?!0:Y,Q=Z?.recordOutputs!==void 0?Z.recordOutputs:J.recordOutputs!==void 0?J.recordOutputs:X===!0?!0:Y;return{recordInputs:$,recordOutputs:Q}}class iF extends h8{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(Z={}){super("@sentry/instrumentation-vercel-ai",M1,Z);iF.prototype.__init.call(this),iF.prototype.__init2.call(this)}init(){return new a6("ai",[">=3.0.0 <5"],this._patch.bind(this))}callWhenPatched(Z){if(this._isPatched)Z();else this._callbacks.push(Z)}_patch(Z){this._isPatched=!0,this._callbacks.forEach((X)=>X()),this._callbacks=[];function J(X){return(...Y)=>{let $=Y[0].experimental_telemetry||{},Q=$.isEnabled,W=T0().getClient(),K=W?.getIntegrationByName(pF),G=K?.options,z=K?Boolean(W?.getOptions().sendDefaultPii):!1,{recordInputs:H,recordOutputs:V}=wJ6(G,$,Q,z);return Y[0].experimental_telemetry={...$,isEnabled:Q!==void 0?Q:!0,recordInputs:H,recordOutputs:V},MJ(()=>{return X.apply(this,Y)},(q)=>{if(q&&typeof q==="object")J8(q,"_sentry_active_span",T6())})}}if(Object.prototype.toString.call(Z)==="[object Module]"){for(let X of WK1)Z[X]=J(Z[X]);return Z}else{let X=WK1.reduce((Y,$)=>{return Y[$]=J(Z[$]),Y},{});return{...Z,...X}}}}var Sg=w0(pF,()=>new iF({}));function BJ6(Z){return!!Z.getIntegrationByName("Modules")?.getModules?.()?.ai}var LJ6=(Z={})=>{let J;return{name:pF,options:Z,setupOnce(){J=Sg()},afterAllSetup(X){if(Z.force??BJ6(X))kM(X);else J?.callWhenPatched(()=>kM(X))}}},ON=a(LJ6);var jJ6=[">=4.0.0 <6"];function OJ6(Z,J){let X=Z?.recordInputs??J,Y=Z?.recordOutputs??J;return{recordInputs:X,recordOutputs:Y}}class _g extends h8{constructor(Z={}){super("@sentry/instrumentation-openai",M1,Z)}init(){return new a6("openai",jJ6,this._patch.bind(this))}_patch(Z){let J=Z.OpenAI,X=function(...Y){let $=Reflect.construct(J,Y),Q=T0().getClient(),K=Q?.getIntegrationByName(XY)?.options,G=Boolean(Q?.getOptions().sendDefaultPii),{recordInputs:z,recordOutputs:H}=OJ6(K,G);return ff($,{recordInputs:z,recordOutputs:H})};Object.setPrototypeOf(X,J),Object.setPrototypeOf(X.prototype,J.prototype);for(let Y of Object.getOwnPropertyNames(J))if(!["length","name","prototype"].includes(Y)){let $=Object.getOwnPropertyDescriptor(J,Y);if($)Object.defineProperty(X,Y,$)}try{Z.OpenAI=X}catch(Y){Object.defineProperty(Z,"OpenAI",{value:X,writable:!0,configurable:!0,enumerable:!0})}return Z}}var Ag=w0(XY,()=>new _g({})),MJ6=(Z={})=>{return{name:XY,options:Z,setupOnce(){Ag()}}},MN=a(MJ6);var KK1=a((Z)=>{if(!z7())e0(()=>{console.warn("The launchDarklyIntegration() can only be used in the browser.")});return{name:"LaunchDarkly"}});function GK1(){if(!z7())e0(()=>{console.warn("The buildLaunchDarklyFlagUsedHandler() can only be used in the browser.")});return{name:"sentry-flag-auditor",type:"flag-used",synchronous:!0,method:()=>null}}var zK1=a((Z)=>{if(!z7())e0(()=>{console.warn("The openFeatureIntegration() can only be used in the browser.")});return{name:"OpenFeature"}});class xg{constructor(){if(!z7())e0(()=>{console.warn("The OpenFeatureIntegrationHook can only be used in the browser.")})}after(){}error(){}}var HK1=a((Z)=>{if(!z7())e0(()=>{console.warn("The statsigIntegration() can only be used in the browser.")});return{name:"Statsig"}});var VK1=a((Z)=>{if(!z7())e0(()=>{console.warn("The unleashIntegration() can only be used in the browser.")});return{name:"Unleash"}});function RN(){return[ER(),AR(),bR(),mR(),dR(),lR(),iR(),aR(),tR(),ZN(),$N(),KN(),zN(),UN(),wN(),yR(),jN(),gR(),ON(),MN(),eR()]}function qK1(){return[ob,Wy,Ky,Rg,jy,Ly,YN,Ty,Bg,ky,_y,hy,gy,ly,Yg,YN,Cy,sy,Dg,Cg,vg,Sg,Ag,Qg]}var XG=e(Y0(),1);var YG=e(R1(),1);var FK1=e($q(),1);import RJ6 from"module";var hg=1e6;function NN(Z,J={}){if(Z.getOptions().debug)cb();let X=PJ6(Z,J);Z.traceProvider=X}function NJ6(){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}=FK1.createAddHookMessageChannel();RJ6.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:X,include:[]},transferList:[X]})}catch(X){h.warn("Failed to register ESM hook",X)}}else e0(()=>{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 UK1(Z={}){let{debug:J}=Z;if(J)h.enable();if(!L4())NJ6();DJ6(Z.integrations).forEach((X)=>{if(X(),J)h.log(`[Sentry] Preloaded ${X.id} instrumentation`)})}function DJ6(Z){let J=qK1();if(!Z)return J;return J.filter((X)=>Z.includes(X.id))}function PJ6(Z,J={}){let X=new Hb({sampler:new Ib(Z),resource:new _3({[YG.ATTR_SERVICE_NAME]:"node",[YG.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[YG.ATTR_SERVICE_VERSION]:M1}),forceFlushTimeoutMillis:500,spanProcessors:[new Eb({timeout:CJ6(Z.getOptions().maxSpanWaitDuration)}),...J.spanProcessors||[]]});return XG.trace.setGlobalTracerProvider(X),XG.propagation.setGlobalPropagator(new Db),XG.context.setGlobalContextManager(new qF),X}function CJ6(Z){if(Z==null)return;if(Z>hg)return j4&&h.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${hg}`),hg;else if(Z<=0||Number.isNaN(Z)){j4&&h.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return Z}function fg(){return jR().filter((J)=>J.name!=="Http"&&J.name!=="NodeFetch").concat(OR(),RR())}function bg(Z){return[...fg(),...c8(Z)?RN():[]]}function DN(Z={}){return wK1(Z,bg)}function wK1(Z={},J){DQ(Z,"node");let X=nb({...Z,defaultIntegrations:Z.defaultIntegrations??J(Z)});if(X&&!Z.skipOpenTelemetrySetup)NN(X,{spanProcessors:Z.openTelemetrySpanProcessors}),OF();return X}function BK1(Z={}){return wK1(Z,()=>[])}var sQ;((B)=>{B.BUILD_PACKETS="build_packets";B.ENTITIES_EMIT_UPDATES="entities_emit_updates";B.ENTITIES_TICK="entities_tick";B.NETWORK_SYNCHRONIZE="network_synchronize";B.NETWORK_SYNCHRONIZE_CLEANUP="network_synchronize_cleanup";B.PHYSICS_CLEANUP="physics_cleanup";B.PHYSICS_STEP="physics_step";B.SEND_ALL_PACKETS="send_all_packets";B.SEND_PACKETS="send_packets";B.SERIALIZE_FREE_BUFFERS="serialize_free_buffers";B.SERIALIZE_PACKETS="serialize_packets";B.SERIALIZE_PACKETS_ENCODE="serialize_packets_encode";B.SIMULATION_STEP="simulation_step";B.TICKER_TICK="ticker_tick";B.WORLD_TICK="world_tick"})(sQ||={});class N8{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){DN({dsn:Z,release:nS,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=N8.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=N8.getProcessStats(!0),X}return null}})}static startSpan(Z,J){if(Eq())return q4({attributes:Z.attributes,name:Z.operation,op:Z.operation},J);else return J()}static sentry(){return yg}}var LK1=new I$,EJ6=5000,jK1={RAW:0,GZIP:1};class o4 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=q50(),this.onPacket(Q0.PacketId.CONNECTION,this._onConnectionPacket),this.onPacket(Q0.PacketId.HEARTBEAT,this._onHeartbeatPacket),this.bindWs(Z),j0.globalInstance.emit("CONNECTION.OPENED",{connection:this,req:J})}static clearCachedPacketsSerializedBuffers(){if(o4._cachedPacketsSerializedBuffer.size>0)o4._cachedPacketsSerializedBuffer.clear()}static serializePackets(Z){for(let X of Z)if(!Q0.isValidPacket(X))return d.error(`Connection.serializePackets(): Invalid packet payload: ${JSON.stringify(X)}`);let J=o4._cachedPacketsSerializedBuffer.get(Z);if(J)return J;return N8.startSpan({operation:"serialize_packets",attributes:{packets:Z.length,packetIds:Z.map((X)=>X[0]).join(",")}},(X)=>{let Y=LK1.pack(Z),$=Y.byteLength>128,Q=$?TJ6(Y,{level:1}):Y,W=$?jK1.GZIP:jK1.RAW;return Y=Buffer.allocUnsafe(Q.length+1),Y[0]=W,Q.copy(Y,1),X?.setAttribute("serializedBytes",Y.byteLength),o4._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([Q0.createPacket(Q0.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([Q0.createPacket(Q0.bidirectionalPackets.connectionPacketDefinition,{i:this.id})],!0,!0),J)this.emitWithGlobal("CONNECTION.RECONNECTED",{connection:this});if(a7.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!==kJ6.OPEN)return;N8.startSpan({operation:"send_packets",attributes:{forceWs:X?"true":"false",wrtcConnected:this._wrtcServerClientTransport?.iceState==="completed"?"true":"false"}},()=>{try{let Y=o4.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([Q0.createPacket(Q0.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([Q0.createPacket(Q0.bidirectionalPackets.connectionPacketDefinition,{pa:{i:K.id,l:W}})])}};_onHeartbeatPacket=()=>{this.send([Q0.createPacket(Q0.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()},EJ6)};_onWsError=(Z)=>{this.emitWithGlobal("CONNECTION.ERROR",{connection:this,error:Z})};_upgradeToWRTC=async()=>{let Z=await a7.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([Q0.createPacket(Q0.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=LK1.unpack(Z);if(!J||typeof J!=="object"||typeof J[0]!=="number")return d.error(`Connection._deserialize(): Invalid packet format. Packet: ${JSON.stringify(J)}`);if(!Q0.isValidPacket(J))return d.error(`Connection._deserialize(): Invalid packet payload. Packet: ${JSON.stringify(J)}`);return J}}class nF{_lights=new Map;_nextLightId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}despawnEntityAttachedLights(Z){this.getAllEntityAttachedLights(Z).forEach((J)=>{J.despawn()})}getAllLights(){return Array.from(this._lights.values())}getAllEntityAttachedLights(Z){return this.getAllLights().filter((J)=>J.attachedToEntity===Z)}registerLight(Z){if(Z.id!==void 0)return Z.id;let J=this._nextLightId;return this._lights.set(J,Z),this._nextLightId++,J}unregisterLight(Z){if(Z.id===void 0)return;this._lights.delete(Z.id)}}class B6{_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 OK1;((X)=>{X[X.POINTLIGHT=0]="POINTLIGHT";X[X.SPOTLIGHT=1]="SPOTLIGHT"})(OK1||={});var gg;((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"})(gg||={});class mg 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(){return k0.serializeLight(this)}}var ug;((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"})(ug||={});class dg 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(){return k0.serializeParticleEmitter(this)}}var IJ6={x:0,y:-32,z:0},cg=60,lg;(($)=>{$.STEP_START="SIMULATION.STEP_START";$.STEP_END="SIMULATION.STEP_END";$.DEBUG_RAYCAST="SIMULATION.DEBUG_RAYCAST";$.DEBUG_RENDER="SIMULATION.DEBUG_RENDER"})(lg||={});class aF extends j0{_colliderMap=new FH;_debugRaycastingEnabled=!1;_debugRenderingEnabled=!1;_debugRenderingFilterFlags;_rapierEventQueue;_rapierSimulation;_world;constructor(Z,J=cg,X=IJ6){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:JW.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(N8.startSpan({operation:"physics_step"},()=>{this._rapierSimulation.step(this._rapierEventQueue)}),N8.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 o8&&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 o8&&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 o8&&K instanceof o8&&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 o8||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 o8&&Q.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))Q.emit("BLOCK_TYPE.ENTITY_CONTACT_FORCE",{blockType:Q,entity:W,contactForceData:Y});else if(Q instanceof o8&&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 o8&&W instanceof o8&&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 PN{_synchronizedPlayerReliablePackets=new B6;_queuedBroadcasts=[];_queuedAudioSynchronizations=new B6;_queuedBlockSynchronizations=new B6;_queuedBlockTypeSynchronizations=new B6;_queuedChunkSynchronizations=new B6;_queuedDebugRaycastSynchronizations=[];_queuedEntitySynchronizations=new B6;_queuedLightSynchronizations=new B6;_queuedParticleEmitterSynchronizations=new B6;_queuedPerPlayerSynchronizations=new B6;_queuedPerPlayerCameraSynchronizations=new B6;_queuedPerPlayerUISynchronizations=new B6;_queuedPerPlayerUIDatasSynchronizations=new B6;_queuedPlayerSynchronizations=new B6;_queuedSceneUISynchronizations=new B6;_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=[],J=[],X=this._world.loop.currentTick;if(this._queuedPerPlayerSynchronizations.size>0)for(let[Y,$]of this._queuedPerPlayerSynchronizations)this._createOrGetSynchronizedPlayerReliablePackets(Y,Z).push(...$);if(this._queuedEntitySynchronizations.size>0){let Y=[],$=[];for(let Q of this._queuedEntitySynchronizations.valuesArray){let W=!1;for(let K in Q)if(K!=="i"&&K!=="p"&&K!=="r"){W=!0;break}if(W)Y.push(Q);else $.push(Q)}if($.length>0){let Q=Q0.createPacket(Q0.outboundPackets.entitiesPacketDefinition,$,X);J.push(Q)}if(Y.length>0){let Q=Q0.createPacket(Q0.outboundPackets.entitiesPacketDefinition,Y,X);Z.push(Q);for(let W of this._synchronizedPlayerReliablePackets.valuesArray)W.push(Q)}}if(this._queuedAudioSynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.audiosPacketDefinition,this._queuedAudioSynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedBlockTypeSynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.blockTypesPacketDefinition,this._queuedBlockTypeSynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedChunkSynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.chunksPacketDefinition,this._queuedChunkSynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedBlockSynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.blocksPacketDefinition,this._queuedBlockSynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedLightSynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.lightsPacketDefinition,this._queuedLightSynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedParticleEmitterSynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.particleEmittersPacketDefinition,this._queuedParticleEmitterSynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedPerPlayerUISynchronizations.size>0)for(let[Y,$]of this._queuedPerPlayerUISynchronizations){let Q=Q0.createPacket(Q0.outboundPackets.uiPacketDefinition,$,X);this._createOrGetSynchronizedPlayerReliablePackets(Y,Z).push(Q)}if(this._queuedPerPlayerUIDatasSynchronizations.size>0)for(let[Y,$]of this._queuedPerPlayerUIDatasSynchronizations){let Q=Q0.createPacket(Q0.outboundPackets.uiDatasPacketDefinition,$,X);this._createOrGetSynchronizedPlayerReliablePackets(Y,Z).push(Q)}if(this._queuedSceneUISynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.sceneUIsPacketDefinition,this._queuedSceneUISynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedWorldSynchronization){let Y=Q0.createPacket(Q0.outboundPackets.worldPacketDefinition,this._queuedWorldSynchronization,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedPerPlayerCameraSynchronizations.size>0)for(let[Y,$]of this._queuedPerPlayerCameraSynchronizations){let Q=Q0.createPacket(Q0.outboundPackets.cameraPacketDefinition,$,X);this._createOrGetSynchronizedPlayerReliablePackets(Y,Z).push(Q)}if(this._queuedPlayerSynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.playersPacketDefinition,this._queuedPlayerSynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedBroadcasts.length>0)for(let Y of this._queuedBroadcasts){Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedDebugRaycastSynchronizations.length>0){let Y=Q0.createPacket(Q0.outboundPackets.physicsDebugRaycastsPacketDefinition,this._queuedDebugRaycastSynchronizations,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}N8.startSpan({operation:"send_all_packets"},()=>{for(let Y of j9.instance.getConnectedPlayersByWorld(this._world)){let $=this._synchronizedPlayerReliablePackets.get(Y)??Z;if($.length>0)Y.connection.send($);if(J.length>0)Y.connection.send(J,!1)}}),N8.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();o4.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=this._createOrGetQueuedAudioSync(Z.audio);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?k0.serializeVector(Z.position):void 0};_onAudioSetPlaybackRate=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.pr=Z.playbackRate};_onAudioSetReferenceDistance=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.rd=Z.referenceDistance};_onAudioSetVolume=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.v=Z.volume};_onBlockTypeRegistryRegisterBlockType=(Z)=>{let J=Z.blockType.serialize();this._queuedBlockTypeSynchronizations.set(Z.blockType.id,J)};_onChatSendBroadcastMessage=(Z)=>{let{player:J,message:X,color:Y}=Z;this._queuedBroadcasts.push(Q0.createPacket(Q0.outboundPackets.chatMessagesPacketDefinition,[{m:X,c:Y,p:J?.id}],this._world.loop.currentTick))};_onChatSendPlayerMessage=(Z)=>{let{player:J,message:X,color:Y}=Z,$=this._queuedPerPlayerSynchronizations.get(J)??[];$.push(Q0.createPacket(Q0.outboundPackets.chatMessagesPacketDefinition,[{m:X,c:Y}],this._world.loop.currentTick)),this._queuedPerPlayerSynchronizations.set(J,$)};_onChunkLatticeAddChunk=(Z)=>{let J=this._createOrGetQueuedChunkSync(Z.chunk);J.b=Array.from(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=Array.from(Z.modelHiddenNodes)};_onEntitySetModelScale=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.s=Z.modelScale};_onEntitySetModelShownNodes=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.sn=Array.from(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?k0.serializeRgbColor(Z.tintColor):void 0};_onEntityStartModelLoopedAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.al=Array.from(new Set([...J.al??[],...Z.animations])),J.as)J.as=J.as.filter((X)=>!Z.animations.has(X)).filter(Boolean)};_onEntityStartModelOneshotAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.ao=Array.from(new Set([...J.ao??[],...Z.animations])),J.as)J.as=J.as.filter((X)=>!Z.animations.has(X)).filter(Boolean)};_onEntityStopModelAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.al)J.al=J.al.filter((X)=>!Z.animations.has(X)).filter(Boolean);if(J.ao)J.ao=J.ao.filter((X)=>!Z.animations.has(X)).filter(Boolean);J.as=Array.from(new Set([...J.as??[],...Z.animations]))};_onEntityUpdateRotation=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.r=[Z.rotation.x,Z.rotation.y,Z.rotation.z,Z.rotation.w]};_onEntityUpdatePosition=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.p=[Z.position.x,Z.position.y,Z.position.z]};_onLightDespawn=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.rm=!0};_onLightSetAngle=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.a=Z.angle};_onLightSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onLightSetColor=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.c=k0.serializeRgbColor(Z.color)};_onLightSetDistance=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.d=Z.distance};_onLightSetIntensity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.n=Z.intensity};_onLightSetOffset=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.o=Z.offset?k0.serializeVector(Z.offset):void 0};_onLightSetPenumbra=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.pe=Z.penumbra};_onLightSetPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.p=Z.position?k0.serializeVector(Z.position):void 0,J.e=Z.position?void 0:J.e};_onLightSetTrackedEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.te=Z.entity?Z.entity.id:void 0,J.tp=Z.entity?void 0:J.tp};_onLightSetTrackedPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.tp=Z.position?k0.serializeVector(Z.position):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?k0.serializeRgbColor(Z.colorEnd):void 0};_onParticleEmitterSetColorEndVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.cev=Z.colorEndVariance?k0.serializeRgbColor(Z.colorEndVariance):void 0};_onParticleEmitterSetColorStart=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.cs=Z.colorStart?k0.serializeRgbColor(Z.colorStart):void 0};_onParticleEmitterSetColorStartVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.csv=Z.colorStartVariance?k0.serializeRgbColor(Z.colorStartVariance):void 0};_onParticleEmitterSetGravity=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.g=Z.gravity?k0.serializeVector(Z.gravity):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?k0.serializeVector(Z.offset):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?k0.serializeVector(Z.position):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?k0.serializeVector(Z.positionVariance):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?k0.serializeVector(Z.velocity):void 0};_onParticleEmitterSetVelocityVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.vv=Z.velocityVariance?k0.serializeVector(Z.velocityVariance):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=k0.serializeVector(Z.entity.position),delete J.et,delete J.pt};_onPlayerCameraLookAtPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=Z.position?k0.serializeVector(Z.position):void 0,delete J.et,delete J.pt};_onPlayerCameraSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.e=Z.entity.id,delete J.p};_onPlayerCameraSetAttachedToPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.p=Z.position?k0.serializeVector(Z.position):void 0,delete J.e};_onPlayerCameraSetFilmOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fo=Z.filmOffset};_onPlayerCameraSetForwardOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.ffo=Z.forwardOffset};_onPlayerCameraSetFov=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fv=Z.fov};_onPlayerCameraSetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.h=Array.from(Z.modelHiddenNodes)};_onPlayerCameraSetModelShownNodes=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.s=Array.from(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?k0.serializeVector(Z.offset):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?k0.serializeVector(Z.position):void 0,delete J.et,delete J.pl};_onPlayerCameraSetZoom=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.z=Z.zoom};_onPlayerJoinedWorld=(Z)=>{let{player:J}=Z,X=this._queuedPerPlayerSynchronizations.get(J)??[];X.push(Q0.createPacket(Q0.outboundPackets.worldPacketDefinition,this._world.serialize(),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.blockTypesPacketDefinition,this._world.blockTypeRegistry.serialize(),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.chunksPacketDefinition,this._world.chunkLattice.getAllChunks().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.entitiesPacketDefinition,this._world.entityManager.getAllEntities().map(($)=>{if(J.camera.attachedToEntity===void 0&&$ instanceof y7&&$.player===J)J.camera.setAttachedToEntity($);return $.serialize()}),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.audiosPacketDefinition,this._world.audioManager.getAllAudios().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.lightsPacketDefinition,this._world.lightManager.getAllLights().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.particleEmittersPacketDefinition,this._world.particleEmitterManager.getAllParticleEmitters().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.sceneUIsPacketDefinition,this._world.sceneUIManager.getAllSceneUIs().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.playersPacketDefinition,j9.instance.getConnectedPlayers().map(($)=>$.serialize()),this._world.loop.currentTick));let Y=this._createOrGetQueuedPlayerCameraSync(J.camera);this._queuedPerPlayerCameraSynchronizations.set(J,{...J.camera.serialize(),...Y}),this._queuedPerPlayerSynchronizations.set(J,X),this._queuedPlayerSynchronizations.set(J.id,J.serialize())};_onPlayerLeftWorld=(Z)=>{let J=this._createOrGetQueuedPlayerSync(Z.player);J.rm=!0};_onPlayerReconnectedWorld=(Z)=>{this._onPlayerJoinedWorld(Z)};_onPlayerRequestSync=(Z)=>{Z.player.connection.send([Q0.createPacket(Q0.outboundPackets.syncResponsePacketDefinition,{r:Z.receivedAt,s:Date.now(),p:performance.now()-Z.receivedAtMs,n:this._world.loop.nextTickMs},this._world.loop.currentTick)])};_onPlayerUILoad=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.u=Z.htmlUri};_onPlayerUILockPointer=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.p=Z.lock};_onPlayerUISendData=(Z)=>{this._createOrGetQueuedPlayerUIDatasSync(Z.playerUI).push(Z.data)};_onSceneUILoad=(Z)=>{let J=Z.sceneUI.serialize();this._queuedSceneUISynchronizations.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?k0.serializeVector(Z.offset):void 0};_onSceneUISetPosition=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.p=Z.position?k0.serializeVector(Z.position):void 0,J.e=Z.position?void 0:J.e};_onSceneUISetState=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.s=Z.state};_onSceneUISetViewDistance=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.v=Z.viewDistance};_onSceneUIUnload=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);if(this._loadedSceneUIs.has(J.i))this._queuedSceneUISynchronizations.delete(J.i),this._loadedSceneUIs.delete(J.i);else J.rm=!0};_onSimulationDebugRaycast=(Z)=>{this._queuedDebugRaycastSynchronizations.push(k0.serializePhysicsDebugRaycast(Z))};_onSimulationDebugRender=(Z)=>{this._queuedBroadcasts.push(Q0.createPacket(Q0.outboundPackets.physicsDebugRenderPacketDefinition,{v:Array.from(Z.vertices),c:Array.from(Z.colors)},this._world.loop.currentTick))};_onWorldSetAmbientLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ac=k0.serializeRgbColor(Z.color)};_onWorldSetAmbientLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ai=Z.intensity};_onWorldSetDirectionalLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dc=k0.serializeRgbColor(Z.color)};_onWorldSetDirectionalLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.di=Z.intensity};_onWorldSetDirectionalLightPosition=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dp=k0.serializeVector(Z.position)};_onWorldSetFogColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.fc=k0.serializeRgbColor(Z.color)};_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={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={i:0,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={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={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={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={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={i:Z.id},this._queuedPlayerSynchronizations.set(Z.id,J);return J}_createOrGetQueuedPlayerCameraSync(Z){let J=this._queuedPerPlayerCameraSynchronizations.get(Z.player);if(!J)J={},this._queuedPerPlayerCameraSynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUISync(Z){let J=this._queuedPerPlayerUISynchronizations.get(Z.player);if(!J)J={},this._queuedPerPlayerUISynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUIDatasSync(Z){let J=this._queuedPerPlayerUIDatasSynchronizations.get(Z.player);if(!J)J=[],this._queuedPerPlayerUIDatasSynchronizations.set(Z.player,J);return J}_createOrGetQueuedSceneUISync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedSceneUISync(): SceneUI has no id!");let J=this._queuedSceneUISynchronizations.get(Z.id);if(!J)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??={i:Z.id}}_createOrGetSynchronizedPlayerReliablePackets(Z,J){let X=this._synchronizedPlayerReliablePackets.get(Z);if(!X)X=[...J],this._synchronizedPlayerReliablePackets.set(Z,X);return X}}class sF{_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(){return 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 oF{_sceneUIs=new Map;_nextSceneUIId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}getAllSceneUIs(){return Array.from(this._sceneUIs.values())}getAllEntityAttachedSceneUIs(Z){return this.getAllSceneUIs().filter((J)=>J.attachedToEntity===Z)}getSceneUIById(Z){return this._sceneUIs.get(Z)}registerSceneUI(Z){if(Z.id!==void 0)return Z.id;let J=this._nextSceneUIId;return this._sceneUIs.set(J,Z),this._nextSceneUIId++,J}unloadEntityAttachedSceneUIs(Z){this.getAllEntityAttachedSceneUIs(Z).forEach((J)=>{J.unload()})}unregisterSceneUI(Z){if(Z.id===void 0)return;this._sceneUIs.delete(Z.id)}}var vJ6=2,SJ6=3;class rF{_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*SJ6,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)N8.startSpan({operation:"ticker_tick"},()=>{let Y=0;while(this._accumulatorMs>=this._fixedTimestepMs&&Y<vJ6)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 MK1;((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"})(MK1||={});class tF extends j0{_currentTick=0;_ticker;_world;constructor(Z,J=cg){super();this._ticker=new rF(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();N8.startSpan({operation:"world_tick",attributes:{serverPlayerCount:j9.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}},()=>{N8.startSpan({operation:"entities_tick"},()=>this._world.entityManager.tickEntities(Z)),N8.startSpan({operation:"simulation_step"},()=>this._world.simulation.step(Z)),N8.startSpan({operation:"entities_emit_updates"},()=>this._world.entityManager.checkAndEmitUpdates()),N8.startSpan({operation:"network_synchronize"},()=>this._world.networkSynchronizer.synchronize())}),this._currentTick++,this.emitWithWorld(this._world,"WORLD_LOOP.TICK_END",{worldLoop:this,tickDurationMs:performance.now()-J})};_onTickError=(Z)=>{d.error(`WorldLoop._onTickError(): Error: ${Z}`),this.emitWithWorld(this._world,"WORLD_LOOP.TICK_ERROR",{worldLoop:this,error:Z})}}var pg;((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"})(pg||={});class eF extends j0{_id;_ambientLightColor;_ambientLightIntensity;_directionalLightColor;_directionalLightIntensity;_directionalLightPosition;_fogColor;_fogFar;_fogNear;_name;_skyboxIntensity;_skyboxUri;_audioManager;_blockTypeRegistry;_chatManager;_chunkLattice;_entityManager;_lightManager;_loop;_networkSynchronizer;_particleEmitterManager;_sceneUIManager;_simulation;_tag;constructor(Z){super();if(this._id=Z.id,this._ambientLightColor=Z.ambientLightColor??{r:255,g:255,b:255},this._ambientLightIntensity=Z.ambientLightIntensity??1,this._directionalLightColor=Z.directionalLightColor??{r:255,g:255,b:255},this._directionalLightIntensity=Z.directionalLightIntensity??3,this._directionalLightPosition=Z.directionalLightPosition??{x:100,y:150,z:100},this._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 zG(this),this._blockTypeRegistry=new hz(this),this._chatManager=new VH(this),this._chunkLattice=new qH(this),this._entityManager=new BH(this),this._lightManager=new nF(this),this._loop=new tF(this,Z.tickRate),this._networkSynchronizer=new PN(this),this._particleEmitterManager=new sF(this),this._sceneUIManager=new oF(this),this._simulation=new aF(this,Z.tickRate,Z.gravity),Z.map)this.loadMap(Z.map)}get id(){return this._id}get ambientLightColor(){return this._ambientLightColor}get ambientLightIntensity(){return this._ambientLightIntensity}get directionalLightColor(){return this._directionalLightColor}get directionalLightIntensity(){return this._directionalLightIntensity}get directionalLightPosition(){return this._directionalLightPosition}get fogColor(){return this._fogColor}get fogFar(){return this._fogFar}get fogNear(){return this._fogNear}get name(){return this._name}get skyboxIntensity(){return this._skyboxIntensity}get skyboxUri(){return this._skyboxUri}get audioManager(){return this._audioManager}get tag(){return this._tag}get blockTypeRegistry(){return this._blockTypeRegistry}get chatManager(){return this._chatManager}get chunkLattice(){return this._chunkLattice}get entityManager(){return this._entityManager}get lightManager(){return this._lightManager}get loop(){return this._loop}get networkSynchronizer(){return this._networkSynchronizer}get particleEmitterManager(){return this._particleEmitterManager}get sceneUIManager(){return this._sceneUIManager}get simulation(){return this._simulation}loadMap(Z){if(this.chunkLattice.clear(),Z.blockTypes)for(let J of Z.blockTypes)this.blockTypeRegistry.registerGenericBlockType({id:J.id,isLiquid:J.isLiquid,name:J.name,textureUri:J.textureUri});if(Z.blocks)for(let[J,X]of Object.entries(Z.blocks)){let[Y,$,Q]=J.split(",").map(Number);this.chunkLattice.setBlock({x:Y,y:$,z:Q},X)}if(Z.entities)for(let[J,X]of Object.entries(Z.entities)){let[Y,$,Q]=J.split(",").map(Number);new o8({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 k0.serializeWorld(this)}}var RK1;((J)=>J.WORLD_CREATED="WORLD_MANAGER.WORLD_CREATED")(RK1||={});class cY{static instance=new cY;_defaultWorld;_nextWorldId=1;_worlds=new Map;createWorld(Z){let J=new eF({...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 NK1;((Y)=>{Y.PLAYER_CONNECTED="PLAYER_MANAGER.PLAYER_CONNECTED";Y.PLAYER_DISCONNECTED="PLAYER_MANAGER.PLAYER_DISCONNECTED";Y.PLAYER_RECONNECTED="PLAYER_MANAGER.PLAYER_RECONNECTED"})(NK1||={});class j9{static instance=new j9;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 QK(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??cY.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 DK1;((X)=>{X.START="GAMESERVER.START";X.STOP="GAMESERVER.STOP"})(DK1||={});function _J6(Z){Q1.init().then(()=>{return oQ.instance.modelRegistry.preloadModels()}).then(()=>{if(Z.length>0)Z(oQ.instance.worldManager.getDefaultWorld());else Z();oQ.instance.start()}).catch((J)=>{d.fatalError(`Failed to initialize the game engine, exiting. Error: ${J}`)})}class oQ{static _instance;_modelRegistry=h5.instance;_playerManager=j9.instance;_socket=a7.instance;_worldManager=cY.instance;_webServer=mK.instance;constructor(){}static get instance(){if(!this._instance)this._instance=new oQ;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,z1=typeof Float32Array!=="undefined"?Float32Array:Array,jZ=Math.random;var TX5=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 i8={};_9(i8,{transpose:()=>gJ6,subtract:()=>CK1,sub:()=>XX6,str:()=>nJ6,set:()=>yJ6,scale:()=>lJ6,rotate:()=>cJ6,multiplyScalarAndAdd:()=>ZX6,multiplyScalar:()=>eJ6,multiply:()=>PK1,mul:()=>JX6,invert:()=>mJ6,identity:()=>fJ6,fromValues:()=>bJ6,fromScaling:()=>iJ6,fromRotation:()=>pJ6,frob:()=>aJ6,exactEquals:()=>rJ6,equals:()=>tJ6,determinant:()=>dJ6,create:()=>AJ6,copy:()=>hJ6,clone:()=>xJ6,adjoint:()=>uJ6,add:()=>oJ6,LDU:()=>sJ6});function AJ6(){var Z=new z1(4);if(z1!=Float32Array)Z[1]=0,Z[2]=0;return Z[0]=1,Z[3]=1,Z}function xJ6(Z){var J=new z1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function hJ6(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function fJ6(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=1,Z}function bJ6(Z,J,X,Y){var $=new z1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function yJ6(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function gJ6(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 mJ6(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 uJ6(Z,J){var X=J[0];return Z[0]=J[3],Z[1]=-J[1],Z[2]=-J[2],Z[3]=X,Z}function dJ6(Z){return Z[0]*Z[3]-Z[2]*Z[1]}function PK1(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 cJ6(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 lJ6(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 pJ6(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 iJ6(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=J[1],Z}function nJ6(Z){return"mat2("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}function aJ6(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3])}function sJ6(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 oJ6(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 CK1(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 rJ6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function tJ6(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 eJ6(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 ZX6(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 JX6=PK1,XX6=CK1;var e1={};_9(e1,{transpose:()=>zX6,translate:()=>FX6,subtract:()=>kK1,sub:()=>SX6,str:()=>DX6,set:()=>KX6,scale:()=>wX6,rotate:()=>UX6,projection:()=>NX6,normalFromMat4:()=>RX6,multiplyScalarAndAdd:()=>kX6,multiplyScalar:()=>TX6,multiply:()=>TK1,mul:()=>vX6,invert:()=>HX6,identity:()=>GX6,fromValues:()=>WX6,fromTranslation:()=>BX6,fromScaling:()=>jX6,fromRotation:()=>LX6,fromQuat:()=>MX6,fromMat4:()=>YX6,fromMat2d:()=>OX6,frob:()=>PX6,exactEquals:()=>EX6,equals:()=>IX6,determinant:()=>qX6,create:()=>ig,copy:()=>QX6,clone:()=>$X6,adjoint:()=>VX6,add:()=>CX6});function ig(){var Z=new z1(9);if(z1!=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 YX6(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 $X6(Z){var J=new z1(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 QX6(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 WX6(Z,J,X,Y,$,Q,W,K,G){var z=new z1(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 KX6(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 GX6(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 zX6(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 HX6(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 VX6(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 qX6(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 TK1(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],j=X[5],N=X[6],R=X[7],O=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+j*z,Z[4]=B*$+w*K+j*H,Z[5]=B*Q+w*G+j*V,Z[6]=N*Y+R*W+O*z,Z[7]=N*$+R*K+O*H,Z[8]=N*Q+R*G+O*V,Z}function FX6(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 UX6(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 wX6(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 BX6(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 LX6(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 jX6(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 OX6(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 MX6(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,j=Q*G;return Z[0]=1-V-U,Z[3]=H-j,Z[6]=q+w,Z[1]=H+j,Z[4]=1-z-U,Z[7]=F-B,Z[2]=q-w,Z[5]=F+B,Z[8]=1-z-V,Z}function RX6(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],j=J[15],N=X*K-Y*W,R=X*G-$*W,O=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,A=H*j-F*U,v=V*w-q*B,x=V*j-F*B,I=q*j-F*w,S=N*I-R*x+O*v+P*A-D*k+C*T;if(!S)return null;return S=1/S,Z[0]=(K*I-G*x+z*v)*S,Z[1]=(G*A-W*I-z*k)*S,Z[2]=(W*x-K*A+z*T)*S,Z[3]=($*x-Y*I-Q*v)*S,Z[4]=(X*I-$*A+Q*k)*S,Z[5]=(Y*A-X*x-Q*T)*S,Z[6]=(B*C-w*D+j*P)*S,Z[7]=(w*O-U*C-j*R)*S,Z[8]=(U*D-B*O+j*N)*S,Z}function NX6(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 DX6(Z){return"mat3("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+")"}function PX6(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8])}function CX6(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 kK1(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 TX6(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 kX6(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 EX6(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 IX6(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],j=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-j)<=v0*Math.max(1,Math.abs(G),Math.abs(j))&&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 vX6=TK1,SX6=kK1;var r0={};_9(r0,{transpose:()=>bX6,translate:()=>uX6,targetTo:()=>qY6,subtract:()=>xK1,sub:()=>RY6,str:()=>FY6,set:()=>fX6,scale:()=>dX6,rotateZ:()=>iX6,rotateY:()=>pX6,rotateX:()=>lX6,rotate:()=>cX6,perspectiveZO:()=>KY6,perspectiveNO:()=>_K1,perspectiveFromFieldOfView:()=>GY6,perspective:()=>WY6,orthoZO:()=>HY6,orthoNO:()=>AK1,ortho:()=>zY6,multiplyScalarAndAdd:()=>LY6,multiplyScalar:()=>BY6,multiply:()=>IK1,mul:()=>MY6,lookAt:()=>VY6,invert:()=>yX6,identity:()=>EK1,getTranslation:()=>ZY6,getScaling:()=>SK1,getRotation:()=>JY6,frustum:()=>QY6,fromZRotation:()=>tX6,fromYRotation:()=>rX6,fromXRotation:()=>oX6,fromValues:()=>hX6,fromTranslation:()=>nX6,fromScaling:()=>aX6,fromRotationTranslationScaleOrigin:()=>YY6,fromRotationTranslationScale:()=>XY6,fromRotationTranslation:()=>vK1,fromRotation:()=>sX6,fromQuat2:()=>eX6,fromQuat:()=>$Y6,frob:()=>UY6,exactEquals:()=>jY6,equals:()=>OY6,determinant:()=>mX6,create:()=>_X6,copy:()=>xX6,clone:()=>AX6,adjoint:()=>gX6,add:()=>wY6});function _X6(){var Z=new z1(16);if(z1!=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 AX6(Z){var J=new z1(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 xX6(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 hX6(Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B){var w=new z1(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 fX6(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 EK1(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 bX6(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 yX6(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],j=J[15],N=X*K-Y*W,R=X*G-$*W,O=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,A=H*j-F*U,v=V*w-q*B,x=V*j-F*B,I=q*j-F*w,S=N*I-R*x+O*v+P*A-D*k+C*T;if(!S)return null;return S=1/S,Z[0]=(K*I-G*x+z*v)*S,Z[1]=($*x-Y*I-Q*v)*S,Z[2]=(B*C-w*D+j*P)*S,Z[3]=(q*D-V*C-F*P)*S,Z[4]=(G*A-W*I-z*k)*S,Z[5]=(X*I-$*A+Q*k)*S,Z[6]=(w*O-U*C-j*R)*S,Z[7]=(H*C-q*O+F*R)*S,Z[8]=(W*x-K*A+z*T)*S,Z[9]=(Y*A-X*x-Q*T)*S,Z[10]=(U*D-B*O+j*N)*S,Z[11]=(V*O-H*D-F*N)*S,Z[12]=(K*k-W*v-G*T)*S,Z[13]=(X*v-Y*k+$*T)*S,Z[14]=(B*R-U*P-w*N)*S,Z[15]=(H*P-V*R+q*N)*S,Z}function gX6(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],j=J[15];return Z[0]=K*(q*j-F*w)-V*(G*j-z*w)+B*(G*F-z*q),Z[1]=-(Y*(q*j-F*w)-V*($*j-Q*w)+B*($*F-Q*q)),Z[2]=Y*(G*j-z*w)-K*($*j-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*j-F*w)-H*(G*j-z*w)+U*(G*F-z*q)),Z[5]=X*(q*j-F*w)-H*($*j-Q*w)+U*($*F-Q*q),Z[6]=-(X*(G*j-z*w)-W*($*j-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*j-F*B)-H*(K*j-z*B)+U*(K*F-z*V),Z[9]=-(X*(V*j-F*B)-H*(Y*j-Q*B)+U*(Y*F-Q*V)),Z[10]=X*(K*j-z*B)-W*(Y*j-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 mX6(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],j=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,O=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,A=H*B-V*U,v=H*w-q*U,x=V*w-q*B;return j*x-N*v+R*A+O*k-P*T+D*C}function IK1(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],j=J[14],N=J[15],R=X[0],O=X[1],P=X[2],D=X[3];return Z[0]=R*Y+O*K+P*V+D*B,Z[1]=R*$+O*G+P*q+D*w,Z[2]=R*Q+O*z+P*F+D*j,Z[3]=R*W+O*H+P*U+D*N,R=X[4],O=X[5],P=X[6],D=X[7],Z[4]=R*Y+O*K+P*V+D*B,Z[5]=R*$+O*G+P*q+D*w,Z[6]=R*Q+O*z+P*F+D*j,Z[7]=R*W+O*H+P*U+D*N,R=X[8],O=X[9],P=X[10],D=X[11],Z[8]=R*Y+O*K+P*V+D*B,Z[9]=R*$+O*G+P*q+D*w,Z[10]=R*Q+O*z+P*F+D*j,Z[11]=R*W+O*H+P*U+D*N,R=X[12],O=X[13],P=X[14],D=X[15],Z[12]=R*Y+O*K+P*V+D*B,Z[13]=R*$+O*G+P*q+D*w,Z[14]=R*Q+O*z+P*F+D*j,Z[15]=R*W+O*H+P*U+D*N,Z}function uX6(Z,J,X){var Y=X[0],$=X[1],Q=X[2],W,K,G,z,H,V,q,F,U,B,w,j;if(J===Z)Z[12]=J[0]*Y+J[4]*$+J[8]*Q+J[12],Z[13]=J[1]*Y+J[5]*$+J[9]*Q+J[13],Z[14]=J[2]*Y+J[6]*$+J[10]*Q+J[14],Z[15]=J[3]*Y+J[7]*$+J[11]*Q+J[15];else 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],j=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]=j,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*$+j*Q+J[15];return Z}function dX6(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 cX6(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,j,N,R,O,P,D,C,T,k,A,v,x,I,S,y;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],j=J[6],N=J[7],R=J[8],O=J[9],P=J[10],D=J[11],C=$*$*H+z,T=Q*$*H+W*G,k=W*$*H-Q*G,A=$*Q*H-W*G,v=Q*Q*H+z,x=W*Q*H+$*G,I=$*W*H+Q*G,S=Q*W*H-$*G,y=W*W*H+z,Z[0]=V*C+B*T+R*k,Z[1]=q*C+w*T+O*k,Z[2]=F*C+j*T+P*k,Z[3]=U*C+N*T+D*k,Z[4]=V*A+B*v+R*x,Z[5]=q*A+w*v+O*x,Z[6]=F*A+j*v+P*x,Z[7]=U*A+N*v+D*x,Z[8]=V*I+B*S+R*y,Z[9]=q*I+w*S+O*y,Z[10]=F*I+j*S+P*y,Z[11]=U*I+N*S+D*y,J!==Z)Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z}function lX6(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 pX6(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 iX6(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 nX6(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 aX6(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 sX6(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 oX6(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 rX6(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 tX6(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 vK1(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,j=W*G,N=W*z;return Z[0]=1-(F+B),Z[1]=V+N,Z[2]=q-j,Z[3]=0,Z[4]=V-N,Z[5]=1-(H+B),Z[6]=U+w,Z[7]=0,Z[8]=q+j,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 eX6(Z,J){var X=new z1(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 vK1(Z,J,X),Z}function ZY6(Z,J){return Z[0]=J[12],Z[1]=J[13],Z[2]=J[14],Z}function SK1(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 JY6(Z,J){var X=new z1(3);SK1(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 XY6(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,j=K*G,N=K*z,R=K*H,O=Y[0],P=Y[1],D=Y[2];return Z[0]=(1-(U+w))*O,Z[1]=(q+R)*O,Z[2]=(F-N)*O,Z[3]=0,Z[4]=(q-R)*P,Z[5]=(1-(V+w))*P,Z[6]=(B+j)*P,Z[7]=0,Z[8]=(F+N)*D,Z[9]=(B-j)*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 YY6(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,j=K*V,N=G*z,R=G*H,O=G*V,P=Y[0],D=Y[1],C=Y[2],T=$[0],k=$[1],A=$[2],v=(1-(B+j))*P,x=(F+O)*P,I=(U-R)*P,S=(F-O)*D,y=(1-(q+j))*D,m=(w+N)*D,i=(U+R)*C,t=(w-N)*C,Z0=(1-(q+B))*C;return Z[0]=v,Z[1]=x,Z[2]=I,Z[3]=0,Z[4]=S,Z[5]=y,Z[6]=m,Z[7]=0,Z[8]=i,Z[9]=t,Z[10]=Z0,Z[11]=0,Z[12]=X[0]+T-(v*T+S*k+i*A),Z[13]=X[1]+k-(x*T+y*k+t*A),Z[14]=X[2]+A-(I*T+m*k+Z0*A),Z[15]=1,Z}function $Y6(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,j=Q*G;return Z[0]=1-V-U,Z[1]=H+j,Z[2]=q-w,Z[3]=0,Z[4]=H-j,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 QY6(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 _K1(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 WY6=_K1;function KY6(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 GY6(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 AK1(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 zY6=AK1;function HY6(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 VY6(Z,J,X,Y){var $,Q,W,K,G,z,H,V,q,F,U=J[0],B=J[1],w=J[2],j=Y[0],N=Y[1],R=Y[2],O=X[0],P=X[1],D=X[2];if(Math.abs(U-O)<v0&&Math.abs(B-P)<v0&&Math.abs(w-D)<v0)return EK1(Z);if(H=U-O,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-j*q,W=j*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 qY6(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 FY6(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 UY6(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 wY6(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 xK1(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 BY6(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 LY6(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 jY6(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 OY6(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],j=Z[15],N=J[0],R=J[1],O=J[2],P=J[3],D=J[4],C=J[5],T=J[6],k=J[7],A=J[8],v=J[9],x=J[10],I=J[11],S=J[12],y=J[13],m=J[14],i=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($-O)<=v0*Math.max(1,Math.abs($),Math.abs(O))&&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-A)<=v0*Math.max(1,Math.abs(H),Math.abs(A))&&Math.abs(V-v)<=v0*Math.max(1,Math.abs(V),Math.abs(v))&&Math.abs(q-x)<=v0*Math.max(1,Math.abs(q),Math.abs(x))&&Math.abs(F-I)<=v0*Math.max(1,Math.abs(F),Math.abs(I))&&Math.abs(U-S)<=v0*Math.max(1,Math.abs(U),Math.abs(S))&&Math.abs(B-y)<=v0*Math.max(1,Math.abs(B),Math.abs(y))&&Math.abs(w-m)<=v0*Math.max(1,Math.abs(w),Math.abs(m))&&Math.abs(j-i)<=v0*Math.max(1,Math.abs(j),Math.abs(i))}var MY6=IK1,RY6=xK1;var C1={};_9(C1,{str:()=>L$6,squaredLength:()=>z31,sqrLen:()=>T$6,sqlerp:()=>v$6,slerp:()=>EN,setAxisAngle:()=>J31,setAxes:()=>S$6,set:()=>R$6,scale:()=>W31,rotationTo:()=>I$6,rotateZ:()=>H$6,rotateY:()=>z$6,rotateX:()=>G$6,random:()=>F$6,pow:()=>q$6,normalize:()=>og,multiply:()=>X31,mul:()=>D$6,ln:()=>$31,lerp:()=>P$6,length:()=>G31,len:()=>C$6,invert:()=>U$6,identity:()=>Q$6,getAxisAngle:()=>W$6,getAngle:()=>K$6,fromValues:()=>O$6,fromMat3:()=>Q31,fromEuler:()=>B$6,exp:()=>Y31,exactEquals:()=>k$6,equals:()=>E$6,dot:()=>K31,create:()=>sg,copy:()=>M$6,conjugate:()=>w$6,clone:()=>j$6,calculateW:()=>V$6,add:()=>N$6});var J1={};_9(J1,{zero:()=>iY6,transformQuat:()=>uY6,transformMat4:()=>gY6,transformMat3:()=>mY6,subtract:()=>fK1,sub:()=>oY6,str:()=>nY6,squaredLength:()=>uK1,squaredDistance:()=>mK1,sqrLen:()=>J$6,sqrDist:()=>Z$6,set:()=>PY6,scaleAndAdd:()=>_Y6,scale:()=>SY6,round:()=>vY6,rotateZ:()=>lY6,rotateY:()=>cY6,rotateX:()=>dY6,random:()=>yY6,normalize:()=>ng,negate:()=>AY6,multiply:()=>bK1,mul:()=>rY6,min:()=>EY6,max:()=>IY6,lerp:()=>hY6,length:()=>hK1,len:()=>ag,inverse:()=>xY6,hermite:()=>fY6,fromValues:()=>TN,forEach:()=>X$6,floor:()=>kY6,exactEquals:()=>aY6,equals:()=>sY6,dot:()=>kN,divide:()=>yK1,div:()=>tY6,distance:()=>gK1,dist:()=>eY6,cross:()=>ZU,create:()=>CN,copy:()=>DY6,clone:()=>NY6,ceil:()=>TY6,bezier:()=>bY6,angle:()=>pY6,add:()=>CY6});function CN(){var Z=new z1(3);if(z1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function NY6(Z){var J=new z1(3);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J}function hK1(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function TN(Z,J,X){var Y=new z1(3);return Y[0]=Z,Y[1]=J,Y[2]=X,Y}function DY6(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z}function PY6(Z,J,X,Y){return Z[0]=J,Z[1]=X,Z[2]=Y,Z}function CY6(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z}function fK1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z}function bK1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z}function yK1(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z[2]=J[2]/X[2],Z}function TY6(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z[2]=Math.ceil(J[2]),Z}function kY6(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z[2]=Math.floor(J[2]),Z}function EY6(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 IY6(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 vY6(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z[2]=Math.round(J[2]),Z}function SY6(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z}function _Y6(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 gK1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return Math.hypot(X,Y,$)}function mK1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return X*X+Y*Y+$*$}function uK1(Z){var J=Z[0],X=Z[1],Y=Z[2];return J*J+X*X+Y*Y}function AY6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z}function xY6(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z[2]=1/J[2],Z}function ng(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 kN(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]}function ZU(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 hY6(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 fY6(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 bY6(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 yY6(Z,J){J=J||1;var X=jZ()*2*Math.PI,Y=jZ()*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 gY6(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 mY6(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 uY6(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 dY6(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 cY6(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 lY6(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 pY6(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&&kN(Z,J)/H;return Math.acos(Math.min(Math.max(V,-1),1))}function iY6(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z}function nY6(Z){return"vec3("+Z[0]+", "+Z[1]+", "+Z[2]+")"}function aY6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]}function sY6(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 oY6=fK1,rY6=bK1,tY6=yK1,eY6=gK1,Z$6=mK1,ag=hK1,J$6=uK1,X$6=function(){var Z=CN();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 Y$6(){var Z=new z1(4);if(z1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function dK1(Z){var J=new z1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function cK1(Z,J,X,Y){var $=new z1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function lK1(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function pK1(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function iK1(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 nK1(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 aK1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return Math.hypot(J,X,Y,$)}function sK1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return J*J+X*X+Y*Y+$*$}function oK1(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 rK1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}function tK1(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 eK1(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function Z31(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 kX5=function(){var Z=Y$6();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 sg(){var Z=new z1(4);if(z1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z[3]=1,Z}function Q$6(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=1,Z}function J31(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 W$6(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 K$6(Z,J){var X=K31(Z,J);return Math.acos(2*X*X-1)}function X31(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 G$6(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 z$6(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 H$6(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 V$6(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 Y31(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 $31(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 q$6(Z,J,X){return $31(Z,J),W31(Z,Z,X),Y31(Z,Z),Z}function EN(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 F$6(Z){var J=jZ(),X=jZ(),Y=jZ(),$=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 U$6(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 w$6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z[3]=J[3],Z}function Q31(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 B$6(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 L$6(Z){return"quat("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}var j$6=dK1,O$6=cK1,M$6=lK1,R$6=pK1,N$6=iK1,D$6=X31,W31=nK1,K31=rK1,P$6=tK1,G31=aK1,C$6=G31,z31=sK1,T$6=z31,og=oK1,k$6=eK1,E$6=Z31,I$6=function(){var Z=CN(),J=TN(1,0,0),X=TN(0,1,0);return function(Y,$,Q){var W=kN($,Q);if(W<-0.999999){if(ZU(Z,J,$),ag(Z)<0.000001)ZU(Z,X,$);return ng(Z,Z),J31(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 ZU(Z,$,Q),Y[0]=Z[0],Y[1]=Z[1],Y[2]=Z[2],Y[3]=1+W,og(Y,Y)}}(),v$6=function(){var Z=sg(),J=sg();return function(X,Y,$,Q,W,K){return EN(Z,Y,W,K),EN(J,$,Q,K),EN(X,Z,J,2*K*(1-K)),X}}(),S$6=function(){var Z=ig();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],og(J,Q31(J,Z))}}();var q1={};_9(q1,{zero:()=>YQ6,transformMat4:()=>ZQ6,transformMat3:()=>e$6,transformMat2d:()=>t$6,transformMat2:()=>r$6,subtract:()=>V31,sub:()=>GQ6,str:()=>$Q6,squaredLength:()=>L31,squaredDistance:()=>w31,sqrLen:()=>FQ6,sqrDist:()=>qQ6,set:()=>h$6,scaleAndAdd:()=>c$6,scale:()=>d$6,round:()=>u$6,rotate:()=>JQ6,random:()=>o$6,normalize:()=>i$6,negate:()=>l$6,multiply:()=>q31,mul:()=>zQ6,min:()=>g$6,max:()=>m$6,lerp:()=>s$6,length:()=>B31,len:()=>KQ6,inverse:()=>p$6,fromValues:()=>A$6,forEach:()=>UQ6,floor:()=>y$6,exactEquals:()=>QQ6,equals:()=>WQ6,dot:()=>n$6,divide:()=>F31,div:()=>HQ6,distance:()=>U31,dist:()=>VQ6,cross:()=>a$6,create:()=>H31,copy:()=>x$6,clone:()=>_$6,ceil:()=>b$6,angle:()=>XQ6,add:()=>f$6});function H31(){var Z=new z1(2);if(z1!=Float32Array)Z[0]=0,Z[1]=0;return Z}function _$6(Z){var J=new z1(2);return J[0]=Z[0],J[1]=Z[1],J}function A$6(Z,J){var X=new z1(2);return X[0]=Z,X[1]=J,X}function x$6(Z,J){return Z[0]=J[0],Z[1]=J[1],Z}function h$6(Z,J,X){return Z[0]=J,Z[1]=X,Z}function f$6(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z}function V31(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z}function q31(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z}function F31(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z}function b$6(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z}function y$6(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z}function g$6(Z,J,X){return Z[0]=Math.min(J[0],X[0]),Z[1]=Math.min(J[1],X[1]),Z}function m$6(Z,J,X){return Z[0]=Math.max(J[0],X[0]),Z[1]=Math.max(J[1],X[1]),Z}function u$6(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z}function d$6(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z}function c$6(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z}function U31(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return Math.hypot(X,Y)}function w31(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return X*X+Y*Y}function B31(Z){var J=Z[0],X=Z[1];return Math.hypot(J,X)}function L31(Z){var J=Z[0],X=Z[1];return J*J+X*X}function l$6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z}function p$6(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z}function i$6(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 n$6(Z,J){return Z[0]*J[0]+Z[1]*J[1]}function a$6(Z,J,X){var Y=J[0]*X[1]-J[1]*X[0];return Z[0]=Z[1]=0,Z[2]=Y,Z}function s$6(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 o$6(Z,J){J=J||1;var X=jZ()*2*Math.PI;return Z[0]=Math.cos(X)*J,Z[1]=Math.sin(X)*J,Z}function r$6(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 t$6(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 e$6(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 ZQ6(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 JQ6(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 XQ6(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 YQ6(Z){return Z[0]=0,Z[1]=0,Z}function $Q6(Z){return"vec2("+Z[0]+", "+Z[1]+")"}function QQ6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]}function WQ6(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 KQ6=B31,GQ6=V31,zQ6=q31,HQ6=F31,VQ6=U31,qQ6=w31,FQ6=L31,UQ6=function(){var Z=H31();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 tQ extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get determinant(){return i8.determinant(this)}get frobeniusNorm(){return i8.frob(this)}static create(){let Z=new tQ(0,0,0,0);return i8.identity(Z),Z}static fromRotation(Z){let J=tQ.create();return i8.fromRotation(J,Z),J}static fromScaling(Z){let J=tQ.create();return i8.fromScaling(J,Z),J}add(Z){return i8.add(this,this,Z),this}adjoint(){return i8.adjoint(this,this),this}clone(){return new tQ(this[0],this[1],this[2],this[3])}copy(Z){return i8.copy(this,Z),this}equals(Z){return i8.equals(this,Z)}exactEquals(Z){return i8.exactEquals(this,Z)}identity(){return i8.identity(this),this}invert(){return i8.invert(this,this),this}multiply(Z){return i8.mul(this,this,Z),this}multiplyScalar(Z){return i8.multiplyScalar(this,this,Z),this}rotate(Z){return i8.rotate(this,this,Z),this}subtract(Z){return i8.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]}][${this[2]},${this[3]}]`}transpose(){return i8.transpose(this,this),this}}class OZ extends Float32Array{constructor(Z,J,X,Y,$,Q,W,K,G){super([Z,J,X,Y,$,Q,W,K,G])}get determinant(){return e1.determinant(this)}get frobeniusNorm(){return e1.frob(this)}static create(){let Z=new OZ(0,0,0,0,0,0,0,0,0);return e1.identity(Z),Z}static fromMatrix4(Z){let J=OZ.create();return e1.fromMat4(J,Z),J}static fromQuaternion(Z){let J=OZ.create();return e1.fromQuat(J,Z),J}static fromRotation(Z){let J=OZ.create();return e1.fromRotation(J,Z),J}static fromScaling(Z){let J=OZ.create();return e1.fromScaling(J,Z),J}static fromTranslation(Z){let J=OZ.create();return e1.fromTranslation(J,Z),J}add(Z){return e1.add(this,this,Z),this}adjoint(){return e1.adjoint(this,this),this}clone(){return new OZ(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8])}copy(Z){return e1.copy(this,Z),this}equals(Z){return e1.equals(this,Z)}exactEquals(Z){return e1.exactEquals(this,Z)}identity(){return e1.identity(this),this}invert(){return e1.invert(this,this),this}multiply(Z){return e1.mul(this,this,Z),this}multiplyScalar(Z){return e1.multiplyScalar(this,this,Z),this}transformVector(Z){return Z.transformMatrix3(this)}projection(Z,J){return e1.projection(this,Z,J),this}rotate(Z){return e1.rotate(this,this,Z),this}subtract(Z){return e1.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 e1.transpose(this,this),this}}class k5 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 r0.determinant(this)}get frobeniusNorm(){return r0.frob(this)}static create(){let Z=new k5(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return r0.identity(Z),Z}static fromQuaternion(Z){let J=k5.create();return r0.fromQuat(J,Z),J}static fromRotation(Z,J){let X=k5.create();return r0.fromRotation(X,Z,J),X}static fromRotationTranslation(Z,J){let X=k5.create();return r0.fromRotationTranslation(X,Z,J),X}static fromRotationTranslationScale(Z,J,X){let Y=k5.create();return r0.fromRotationTranslationScale(Y,Z,J,X),Y}static fromRotationTranslationScaleOrigin(Z,J,X,Y){let $=k5.create();return r0.fromRotationTranslationScaleOrigin($,Z,J,X,Y),$}static fromScaling(Z){let J=k5.create();return r0.fromScaling(J,Z),J}static fromTranslation(Z){let J=k5.create();return r0.fromTranslation(J,Z),J}static fromXRotation(Z){let J=k5.create();return r0.fromXRotation(J,Z),J}static fromYRotation(Z){let J=k5.create();return r0.fromYRotation(J,Z),J}static fromZRotation(Z){let J=k5.create();return r0.fromZRotation(J,Z),J}add(Z){return r0.add(this,this,Z),this}adjoint(){return r0.adjoint(this,this),this}clone(){return new k5(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 r0.copy(this,Z),this}equals(Z){return r0.equals(this,Z)}exactEquals(Z){return r0.exactEquals(this,Z)}frustrum(Z,J,X,Y,$,Q){return r0.frustum(this,Z,J,X,Y,$,Q),this}identity(){return r0.identity(this),this}invert(){return r0.invert(this,this),this}lookAt(Z,J,X){return r0.lookAt(this,Z,J,X),this}multiply(Z){return r0.mul(this,this,Z),this}multiplyScalar(Z){return r0.multiplyScalar(this,this,Z),this}orthographic(Z,J,X,Y,$,Q){return r0.ortho(this,Z,J,X,Y,$,Q),this}perspective(Z,J,X,Y){return r0.perspective(this,Z,J,X,Y),this}rotate(Z,J){return r0.rotate(this,this,Z,J),this}rotateX(Z){return r0.rotateX(this,this,Z),this}rotateY(Z){return r0.rotateY(this,this,Z),this}rotateZ(Z){return r0.rotateZ(this,this,Z),this}scale(Z){return r0.scale(this,this,Z),this}subtract(Z){return r0.sub(this,this,Z),this}targetTo(Z,J,X){return r0.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 r0.translate(this,this,Z),this}transpose(){return r0.transpose(this,this),this}}class QG extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get length(){return C1.length(this)}get squaredLength(){return C1.squaredLength(this)}get magnitude(){return C1.length(this)}get squaredMagnitude(){return C1.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=C1.fromEuler(new Float32Array(4),Z,J,X);return new QG(Y[0],Y[1],Y[2],Y[3])}static fromQuaternionLike(Z){return new QG(Z.x,Z.y,Z.z,Z.w)}clone(){return new QG(this.x,this.y,this.z,this.w)}conjugate(){return C1.conjugate(this,this),this}copy(Z){return C1.copy(this,Z),this}dot(Z){return C1.dot(this,Z)}exponential(){return C1.exp(this,this),this}equals(Z){return C1.equals(this,Z)}exactEquals(Z){return C1.exactEquals(this,Z)}getAngle(Z){return C1.getAngle(this,Z)}identity(){return C1.identity(this),this}invert(){return C1.invert(this,this),this}lerp(Z,J){return C1.lerp(this,this,Z,J),this}logarithm(){return C1.ln(this,this),this}multiply(Z){return C1.multiply(this,this,Z),this}transformVector(Z){return Z.transformQuaternion(this)}normalize(){return C1.normalize(this,this),this}power(Z){return C1.pow(this,this,Z),this}randomize(){return C1.random(this),this}rotateX(Z){return C1.rotateX(this,this,Z),this}rotateY(Z){return C1.rotateY(this,this,Z),this}rotateZ(Z){return C1.rotateZ(this,this,Z),this}scale(Z){return C1.scale(this,this,Z),this}setAxisAngle(Z,J){return C1.setAxisAngle(this,Z,J),this}slerp(Z,J){return C1.slerp(this,this,Z,J),this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}}class JU extends Float32Array{constructor(Z,J){super([Z,J])}get length(){return q1.length(this)}get squaredLength(){return q1.squaredLength(this)}get magnitude(){return q1.length(this)}get squaredMagnitude(){return q1.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 JU(0,0)}add(Z){return q1.add(this,this,Z),this}angle(Z){return q1.angle(this,Z)}ceil(){return q1.ceil(this,this),this}clone(){return new JU(this.x,this.y)}copy(Z){return q1.copy(this,Z),this}distance(Z){return q1.distance(this,Z)}divide(Z){return q1.divide(this,this,Z),this}dot(Z){return q1.dot(this,Z)}equals(Z){return q1.equals(this,Z)}exactEquals(Z){return q1.exactEquals(this,Z)}floor(){return q1.floor(this,this),this}invert(){return q1.inverse(this,this),this}lerp(Z,J){return q1.lerp(this,this,Z,J),this}max(Z){return q1.max(this,this,Z),this}min(Z){return q1.min(this,this,Z),this}multiply(Z){return q1.mul(this,this,Z),this}negate(){return q1.negate(this,this),this}normalize(){return q1.normalize(this,this),this}randomize(Z){return q1.random(this,Z),this}rotate(Z,J){return q1.rotate(this,this,Z,J),this}round(){return q1.round(this,this),this}scale(Z){return q1.scale(this,this,Z),this}scaleAndAdd(Z,J){return q1.scaleAndAdd(this,this,Z,J),this}subtract(Z){return q1.sub(this,this,Z),this}toString(){return`${this.x},${this.y}`}transformMatrix2(Z){return q1.transformMat2(this,this,Z),this}transformMatrix3(Z){return q1.transformMat3(this,this,Z),this}transformMatrix4(Z){return q1.transformMat4(this,this,Z),this}zero(){return q1.zero(this),this}}class WG 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 WG(0,0,0)}static fromVector3Like(Z){return new WG(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 WG(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 T1=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())})},D1=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}}},X9=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},T4=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))},j31=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.")},xX5=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 T1(this,void 0,void 0,function(){return D1(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 T1(this,void 0,void 0,function(){return D1(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 T1(this,void 0,void 0,function(){return D1(this,function(Y){return[2,J-X]})})},Z.maxComparatorNumber=function(J,X){return T1(this,void 0,void 0,function(){return D1(this,function(Y){return[2,X-J]})})},Z.defaultIsEqual=function(J,X){return T1(this,void 0,void 0,function(){return D1(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
+ >>> 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 P71(this.pattern,this.options)}parse(Z){PF(Z);let J=this.options;if(Z==="**")return R4;if(Z==="")return"";let X,Y=null;if(X=Z.match(a66))Y=J.dot?o66:s66;else if(X=Z.match(y66))Y=(J.nocase?J.dot?d66:u66:J.dot?m66:g66)(X[1]);else if(X=Z.match(r66))Y=(J.nocase?J.dot?e66:t66:J.dot?Z56:J56)(X);else if(X=Z.match(c66))Y=J.dot?p66:l66;else if(X=Z.match(i66))Y=n66;let $=k6.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?$56:J.dot?Q56:W56,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"?V56(z):z===R4?R4:z._src});return G.forEach((z,H)=>{let V=G[H+1],q=G[H-1];if(z!==R4||q===R4)return;if(q===void 0)if(V!==void 0&&V!==R4)G[H+1]="(?:\\/|"+X+"\\/)?"+V;else G[H]=X;else if(V===void 0)G[H-1]=q+"(?:\\/|"+X+")?";else if(V!==R4)G[H-1]=q+"(?:\\/|\\/"+X+"\\/)"+V,G[H+1]=R4}),G.filter((z)=>z!==R4).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 E6.defaults(Z).Minimatch}}E6.AST=k6;E6.Minimatch=TF;E6.escape=qy;E6.unescape=BY;var T71="@fastify/otel",F56="0.8.0",U56=">=4.0.0 <6",k71=["onRequest","preParsing","preValidation","preHandler","preSerialization","onSend","onResponse","onError"],r1={HOOK_NAME:"hook.name",FASTIFY_TYPE:"fastify.type",HOOK_CALLBACK_NAME:"hook.callback.name",ROOT:"fastify.root"},LY={ROUTE:"route-hook",INSTANCE:"hook",HANDLER:"request-handler"},xJ="anonymous",D5=Symbol("fastify otel instance"),jY=Symbol("fastify otel request spans"),kF=Symbol("fastify otel request context"),E71=Symbol("fastify otel addhook original"),I71=Symbol("fastify otel setnotfound original"),vR=Symbol("fastify otel ignore path");class Fy extends h8{constructor(Z){super(T71,F56,Z);if(this.servername=Z?.servername??process.env.OTEL_SERVICE_NAME??"fastify",this[vR]=null,this._logger=f8.diag.createComponentLogger({namespace:T71}),Z?.ignorePaths!=null||process.env.OTEL_FASTIFY_IGNORE_PATHS!=null){let J=Z?.ignorePaths??process.env.OTEL_FASTIFY_IGNORE_PATHS;if((typeof J!=="string"||J.length===0)&&typeof J!=="function")throw new TypeError("ignorePaths must be a string or a function");let X=E6;this[vR]=(Y)=>{if(typeof J==="function")return J(Y);else return X(Y.url,J)}}}enable(){if(this._handleInitialization===void 0&&this.getConfig().registerOnInitialization){let Z=this.plugin();this._handleInitialization=(J)=>{J.fastify.register(Z)},C71.subscribe("fastify.initialization",this._handleInitialization)}return super.enable()}disable(){if(this._handleInitialization)C71.unsubscribe("fastify.initialization",this._handleInitialization),this._handleInitialization=void 0;return super.disable()}init(){return[]}plugin(){let Z=this;return J[Symbol.for("skip-override")]=!0,J[Symbol.for("fastify.display-name")]="@fastify/otel",J[Symbol.for("plugin-meta")]={fastify:U56,name:"@fastify/otel"},J;function J(X,Y,$){X.decorate(D5,Z),X.decorate(E71,X.addHook),X.decorate(I71,X.setNotFoundHandler),X.decorateRequest("opentelemetry",function H(){let V=this[kF];return{span:this[jY],tracer:Z.tracer,context:V,inject:(F,U)=>{return f8.propagation.inject(V,F,U)},extract:(F,U)=>{return f8.propagation.extract(V,F,U)}}}),X.decorateRequest(jY,null),X.decorateRequest(kF,null),X.addHook("onRoute",function(H){if(Z[vR]?.(H)===!0){Z._logger.debug(`Ignoring route instrumentation ${H.method} ${H.url} because it matches the ignore path`);return}for(let V of k71)if(H[V]!=null){let q=H[V];if(typeof q==="function")H[V]=z(q,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - route -> ${V}`,[r1.FASTIFY_TYPE]:LY.ROUTE,[l8.ATTR_HTTP_ROUTE]:H.url,[r1.HOOK_CALLBACK_NAME]:q.name?.length>0?q.name:xJ});else if(Array.isArray(q)){let F=[];for(let U of q)F.push(z(U,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - route -> ${V}`,[r1.FASTIFY_TYPE]:LY.ROUTE,[l8.ATTR_HTTP_ROUTE]:H.url,[r1.HOOK_CALLBACK_NAME]:U.name?.length>0?U.name:xJ}));H[V]=F}}if(H.onSend!=null)H.onSend=Array.isArray(H.onSend)?[...H.onSend,Q]:[H.onSend,Q];else H.onSend=Q;if(H.onError!=null)H.onError=Array.isArray(H.onError)?[...H.onError,W]:[H.onError,W];else H.onError=W;H.handler=z(H.handler,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - route-handler`,[r1.FASTIFY_TYPE]:LY.HANDLER,[l8.ATTR_HTTP_ROUTE]:H.url,[r1.HOOK_CALLBACK_NAME]:H.handler.name.length>0?H.handler.name:xJ})}),X.addHook("onRequest",function(H,V,q){if(this[D5].isEnabled()===!1)return q();else if(this[D5][vR]?.({url:H.url,method:H.method})===!0)return this[D5]._logger.debug(`Ignoring request ${H.method} ${H.url} because it matches the ignore path`),q();let F=f8.context.active();if(f8.trace.getSpan(F)==null)F=f8.propagation.extract(F,H.headers);let U=EQ(F);if(H.routeOptions.url!=null&&U?.type===EJ.HTTP)U.route=H.routeOptions.url;let B=this[D5].tracer.startSpan("request",{attributes:{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.ROOT]:"@fastify/otel",[l8.ATTR_HTTP_ROUTE]:H.url,[l8.ATTR_HTTP_REQUEST_METHOD]:H.method}},F);H[kF]=f8.trace.setSpan(F,B),H[jY]=B,f8.context.with(H[kF],()=>{q()})}),X.addHook("onResponse",function(H,V,q){let F=H[jY];if(F!=null)F.setStatus({code:f8.SpanStatusCode.OK,message:"OK"}),F.setAttributes({[l8.ATTR_HTTP_RESPONSE_STATUS_CODE]:404}),F.end();H[jY]=null,q()}),X.addHook=K,X.setNotFoundHandler=G,$();function Q(H,V,q,F){let U=H[jY];if(U!=null){if(V.statusCode<500)U.setStatus({code:f8.SpanStatusCode.OK,message:"OK"});U.setAttributes({[l8.ATTR_HTTP_RESPONSE_STATUS_CODE]:V.statusCode}),U.end()}H[jY]=null,F(null,q)}function W(H,V,q,F){let U=H[jY];if(U!=null)U.setStatus({code:f8.SpanStatusCode.ERROR,message:q.message}),U.recordException(q);F()}function K(H,V){let q=this[E71];if(k71.includes(H))return q.call(this,H,z(V,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - ${H}`,[r1.FASTIFY_TYPE]:LY.INSTANCE,[r1.HOOK_CALLBACK_NAME]:V.name?.length>0?V.name:xJ}));else return q.call(this,H,V)}function G(H,V){let q=this[I71];if(typeof H==="function")V=z(H,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[r1.FASTIFY_TYPE]:LY.INSTANCE,[r1.HOOK_CALLBACK_NAME]:H.name?.length>0?H.name:xJ}),q.call(this,V);else{if(H.preValidation!=null)H.preValidation=z(H.preValidation,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - not-found-handler - preValidation`,[r1.FASTIFY_TYPE]:LY.INSTANCE,[r1.HOOK_CALLBACK_NAME]:H.preValidation.name?.length>0?H.preValidation.name:xJ});if(H.preHandler!=null)H.preHandler=z(H.preHandler,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - not-found-handler - preHandler`,[r1.FASTIFY_TYPE]:LY.INSTANCE,[r1.HOOK_CALLBACK_NAME]:H.preHandler.name?.length>0?H.preHandler.name:xJ});V=z(V,{[l8.ATTR_SERVICE_NAME]:X[D5].servername,[r1.HOOK_NAME]:`${this.pluginName} - not-found-handler`,[r1.FASTIFY_TYPE]:LY.INSTANCE,[r1.HOOK_CALLBACK_NAME]:V.name?.length>0?V.name:xJ}),q.call(this,H,V)}}function z(H,V={}){return function q(...F){let U=this[D5],[B]=F;if(U.isEnabled()===!1)return H.call(this,...F);let w=B[kF]??f8.context.active(),j=U.tracer.startSpan(`handler - ${H.name?.length>0?H.name:this.pluginName??xJ}`,{attributes:V},w);return f8.context.with(f8.trace.setSpan(w,j),function(){try{let N=H.call(this,...F);if(typeof N?.then==="function")return N.then((R)=>{return j.end(),R},(R)=>{return j.setStatus({code:f8.SpanStatusCode.ERROR,message:R.message}),j.recordException(R),j.end(),Promise.reject(R)});return j.end(),N}catch(N){throw j.setStatus({code:f8.SpanStatusCode.ERROR,message:N.message}),j.recordException(N),j.end(),N}},this)}}}}}var w7=e(Y0(),1);var x71=e(R1(),1);var hJ;(function(Z){Z.FASTIFY_NAME="fastify.name";let X="fastify.type";Z.FASTIFY_TYPE=X;let Y="hook.name";Z.HOOK_NAME=Y;let $="plugin.name";Z.PLUGIN_NAME=$})(hJ||(hJ={}));var EF;(function(Z){Z.MIDDLEWARE="middleware";let X="request_handler";Z.REQUEST_HANDLER=X})(EF||(EF={}));var IF;(function(Z){Z.MIDDLEWARE="middleware";let X="request handler";Z.REQUEST_HANDLER=X})(IF||(IF={}));var S71=e(Y0(),1);var vF=Symbol("opentelemetry.instrumentation.fastify.request_active_span");function Uy(Z,J,X,Y={}){let $=J.startSpan(X,{attributes:Y}),Q=Z[vF]||[];return Q.push($),Object.defineProperty(Z,vF,{enumerable:!1,configurable:!0,value:Q}),$}function SR(Z,J){let X=Z[vF]||[];if(!X.length)return;X.forEach((Y)=>{if(J)Y.setStatus({code:S71.SpanStatusCode.ERROR,message:J.message}),Y.recordException(J);Y.end()}),delete Z[vF]}function _71(Z,J,X){let Y,$=void 0;try{if($=Z(),v71($))$.then((Q)=>J(void 0,Q),(Q)=>J(Q))}catch(Q){Y=Q}finally{if(!v71($)){if(J(Y,$),Y)throw Y}return $}}function v71(Z){return typeof Z==="object"&&Z&&typeof Object.getOwnPropertyDescriptor(Z,"then")?.value==="function"||!1}var w56="0.1.0",B56="@sentry/instrumentation-fastify-v3",A71="anonymous",L56=new Set(["onTimeout","onRequest","preParsing","preValidation","preSerialization","preHandler","onSend","onResponse","onError"]);class wy extends h8{constructor(Z={}){super(B56,w56,Z)}init(){return[new a6("fastify",[">=3.0.0 <4"],(Z)=>{return this._patchConstructor(Z)})]}_hookOnRequest(){let Z=this;return function J(X,Y,$){if(!Z.isEnabled())return $();Z._wrap(Y,"send",Z._patchSend());let Q=X,W=EQ(w7.context.active()),K=Q.routeOptions?Q.routeOptions.url:X.routerPath;if(K&&W?.type===EJ.HTTP)W.route=K;let G=X.method||"GET";E0().setTransactionName(`${G} ${K}`),$()}}_wrapHandler(Z,J,X,Y){let $=this;return this._diag.debug("Patching fastify route.handler function"),function(...Q){if(!$.isEnabled())return X.apply(this,Q);let W=X.name||Z||A71,K=`${IF.MIDDLEWARE} - ${W}`,G=Q[1],z=Uy(G,$.tracer,K,{[hJ.FASTIFY_TYPE]:EF.MIDDLEWARE,[hJ.PLUGIN_NAME]:Z,[hJ.HOOK_NAME]:J}),H=Y&&Q[Q.length-1];if(H)Q[Q.length-1]=function(...V){SR(G),H.apply(this,V)};return w7.context.with(w7.trace.setSpan(w7.context.active(),z),()=>{return _71(()=>{return X.apply(this,Q)},(V)=>{if(V instanceof Error)z.setStatus({code:w7.SpanStatusCode.ERROR,message:V.message}),z.recordException(V);if(!Y)SR(G)})})}}_wrapAddHook(){let Z=this;return this._diag.debug("Patching fastify server.addHook function"),function(J){return function X(...Y){let $=Y[0],Q=Y[1],W=this.pluginName;if(!L56.has($))return J.apply(this,Y);let K=typeof Y[Y.length-1]==="function"&&Q.constructor.name!=="AsyncFunction";return J.apply(this,[$,Z._wrapHandler(W,$,Q,K)])}}}_patchConstructor(Z){let J=this;function X(...Y){let $=Z.fastify.apply(this,Y);return $.addHook("onRequest",J._hookOnRequest()),$.addHook("preHandler",J._hookPreHandler()),j56(),J._wrap($,"addHook",J._wrapAddHook()),$}if(Z.errorCodes!==void 0)X.errorCodes=Z.errorCodes;return X.fastify=X,X.default=X,X}_patchSend(){let Z=this;return this._diag.debug("Patching fastify reply.send function"),function J(X){return function Y(...$){let Q=$[0];if(!Z.isEnabled())return X.apply(this,$);return $Y(()=>{return X.apply(this,$)},(W)=>{if(!W&&Q instanceof Error)W=Q;SR(this,W)})}}}_hookPreHandler(){let Z=this;return this._diag.debug("Patching fastify preHandler function"),function J(X,Y,$){if(!Z.isEnabled())return $();let Q=X,W=Q.routeOptions?.handler||Q.context?.handler,K=W?.name.startsWith("bound ")?W.name.substring(6):W?.name,G=`${IF.REQUEST_HANDLER} - ${K||this.pluginName||A71}`,z={[hJ.PLUGIN_NAME]:this.pluginName,[hJ.FASTIFY_TYPE]:EF.REQUEST_HANDLER,[x71.SEMATTRS_HTTP_ROUTE]:Q.routeOptions?Q.routeOptions.url:X.routerPath};if(K)z[hJ.FASTIFY_NAME]=K;let H=Uy(Y,Z.tracer,G,z);h71(H);let{requestHook:V}=Z.getConfig();if(V)$Y(()=>V(H,{request:X}),(q)=>{if(q)Z._diag.error("request hook failed",q)},!0);return w7.context.with(w7.trace.setSpan(w7.context.active(),H),()=>{$()})}}}function j56(){let Z=X0();if(Z)Z.on("spanStart",(J)=>{h71(J)})}function h71(Z){let J=B0(Z).data,X=J["fastify.type"];if(J[N0]||!X)return;Z.setAttributes({[_0]:"auto.http.otel.fastify",[N0]:`${X}.fastify`});let Y=J["fastify.name"]||J["plugin.name"]||J["hook.name"];if(typeof Y==="string"){let $=Y.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");Z.updateName($)}}var f71="Fastify",O56="Fastify-V5",M56="Fastify-V3",Ly=w0(M56,()=>new wy);function b71(){let Z=X0();if(!Z)return;else return Z.getIntegrationByName(f71)}function _R(Z,J,X,Y){let $=b71()?.getShouldHandleError()||y71;if(Y==="diagnostics-channel")this.diagnosticsChannelExists=!0;if(this.diagnosticsChannelExists&&Y==="onError-hook"){j4&&h.warn("Fastify error handler was already registered via diagnostics channel.","You can safely remove `setupFastifyErrorHandler` call and set `shouldHandleError` on the integration options.");return}if($(Z,J,X))Z1(Z,{mechanism:{handled:!1,type:"fastify"}})}var jy=w0(O56,()=>{let Z=new Fy,J=Z.plugin();return By.subscribe("fastify.initialization",(X)=>{let Y=X.fastify;Y?.register(J).after(($)=>{if($)j4&&h.error("Failed to setup Fastify instrumentation",$);else if(N56(),Y)D56(Y)})}),By.subscribe("tracing:fastify.request.handler:error",(X)=>{let{error:Y,request:$,reply:Q}=X;_R.call(_R,Y,$,Q,"diagnostics-channel")}),Z}),R56=({shouldHandleError:Z})=>{let J;return{name:f71,setupOnce(){J=Z||y71,Ly(),jy()},getShouldHandleError(){return J},setShouldHandleError(X){J=X}}},AR=a((Z={})=>R56(Z));function y71(Z,J,X){let Y=X.statusCode;return Y>=500||Y<=299}function g71(Z,J){if(J?.shouldHandleError)b71()?.setShouldHandleError(J.shouldHandleError);let X=Object.assign(function(Y,$,Q){Y.addHook("onError",async(W,K,G)=>{_R.call(_R,G,W,K,"onError-hook")}),Q()},{[Symbol.for("skip-override")]:!0,[Symbol.for("fastify.display-name")]:"sentry-fastify-error-handler"});Z.register(X)}function m71(Z){let J=B0(Z),X=J.description,Y=J.data,$=Y["fastify.type"],Q=$==="hook",W=$===X?.startsWith("handler -"),K=X==="request"||$==="request-handler";if(Y[N0]||!W&&!K&&!Q)return;let G=Q?"hook":W?"middleware":K?"request-handler":"<unknown>";Z.setAttributes({[_0]:"auto.http.otel.fastify",[N0]:`${G}.fastify`});let z=Y["fastify.name"]||Y["plugin.name"]||Y["hook.name"];if(typeof z==="string"){let H=z.replace(/^fastify -> /,"").replace(/^@fastify\/otel -> /,"");Z.updateName(H)}}function N56(){let Z=X0();if(Z)Z.on("spanStart",(J)=>{m71(J)})}function D56(Z){Z.addHook("onRequest",async(J,X)=>{if(J.opentelemetry){let{span:Q}=J.opentelemetry();if(Q)m71(Q)}let Y=J.routeOptions?.url,$=J.method||"GET";E0().setTransactionName(`${$} ${Y}`)})}var PZ1=e(Y0(),1),CZ1=e(DZ1(),1);var TZ1="Graphql",Cy=w0(TZ1,CZ1.GraphQLInstrumentation,(Z)=>{let J=kZ1(Z);return{...J,responseHook(X,Y){if(o1(X,"auto.graphql.otel.graphql"),Y.errors?.length&&!B0(X).status)X.setStatus({code:PZ1.SpanStatusCode.ERROR});let Q=B0(X).data,W=Q["graphql.operation.type"],K=Q["graphql.operation.name"];if(J.useOperationNameForRootSpan&&W){let G=s1(X),H=B0(G).data[h3]||[],V=K?`${W} ${K}`:`${W}`;if(Array.isArray(H))H.push(V),G.setAttribute(h3,H);else if(typeof H==="string")G.setAttribute(h3,[H,V]);else G.setAttribute(h3,V);if(!B0(G).data["original-description"])G.setAttribute("original-description",B0(G).description);G.updateName(`${B0(G).data["original-description"]} (${o56(H)})`)}}}}),s56=(Z={})=>{return{name:TZ1,setupOnce(){Cy(kZ1(Z))}}},bR=a(s56);function kZ1(Z){return{ignoreResolveSpans:!0,ignoreTrivialResolveSpans:!0,useOperationNameForRootSpan:!0,...Z}}function o56(Z){if(Array.isArray(Z)){let J=Z.slice().sort();if(J.length<=5)return J.join(", ");else return`${J.slice(0,5).join(", ")}, +${J.length-5}`}return`${Z}`}var lZ1=e(cZ1(),1);var pZ1="Kafka",Ty=w0(pZ1,()=>new lZ1.KafkaJsInstrumentation({consumerHook(Z){o1(Z,"auto.kafkajs.otel.consumer")},producerHook(Z){o1(Z,"auto.kafkajs.otel.producer")}})),e56=()=>{return{name:pZ1,setupOnce(){Ty()}}},yR=a(e56);var YJ1=e(XJ1(),1);var $J1="LruMemoizer",ky=w0($J1,()=>new YJ1.LruMemoizerInstrumentation),Y96=()=>{return{name:$J1,setupOnce(){ky()}}},gR=a(Y96);var OJ1=e(jJ1(),1);var MJ1="Mongo",_y=w0(MJ1,()=>new OJ1.MongoDBInstrumentation({dbStatementSerializer:G96,responseHook(Z){o1(Z,"auto.db.otel.mongo")}}));function G96(Z){let J=Sy(Z);return JSON.stringify(J)}function Sy(Z){if(Array.isArray(Z))return Z.map((J)=>Sy(J));if(z96(Z)){let J={};return Object.entries(Z).map(([X,Y])=>[X,Sy(Y)]).reduce((X,Y)=>{if(V96(Y))X[Y[0]]=Y[1];return X},J)}return"?"}function z96(Z){return typeof Z==="object"&&Z!==null&&!H96(Z)}function H96(Z){let J=!1;if(typeof Buffer!=="undefined")J=Buffer.isBuffer(Z);return J}function V96(Z){return Array.isArray(Z)}var q96=()=>{return{name:MJ1,setupOnce(){_y()}}},mR=a(q96);var uJ1=e(mJ1(),1);var dJ1="Mongoose",hy=w0(dJ1,()=>new uJ1.MongooseInstrumentation({responseHook(Z){o1(Z,"auto.db.otel.mongoose")}})),C96=()=>{return{name:dJ1,setupOnce(){hy()}}},dR=a(C96);var WX1=e(QX1(),1);var KX1="Mysql",gy=w0(KX1,()=>new WX1.MySQLInstrumentation({})),u96=()=>{return{name:KX1,setupOnce(){gy()}}},lR=a(u96);var kX1=e(TX1(),1);var EX1="Mysql2",ly=w0(EX1,()=>new kX1.MySQL2Instrumentation({responseHook(Z){o1(Z,"auto.db.otel.mysql2")}})),$46=()=>{return{name:EX1,setupOnce(){ly()}}},iR=a($46);var wY1=e(nX1(),1),BY1=e(HY1(),1);var j46=["get","set","setex"],iy=["get","mget"],O46=["set","setex"];function gF(Z,J){return Z.includes(J.toLowerCase())}function ny(Z){if(gF(iy,Z))return"cache.get";else if(gF(O46,Z))return"cache.put";else return}function M46(Z,J){return J.some((X)=>Z.startsWith(X))}function qY1(Z,J){try{if(J.length===0)return;let X=($)=>{if(typeof $==="string"||typeof $==="number"||Buffer.isBuffer($))return[$.toString()];else if(Array.isArray($))return VY1($.map((Q)=>X(Q)));else return["<unknown>"]},Y=J[0];if(gF(j46,Z)&&Y!=null)return X(Y);return VY1(J.map(($)=>X($)))}catch{return}}function FY1(Z,J,X){if(!ny(Z))return!1;for(let Y of J)if(M46(Y,X))return!0;return!1}function UY1(Z){let J=(X)=>{try{if(Buffer.isBuffer(X))return X.byteLength;else if(typeof X==="string")return X.length;else if(typeof X==="number")return X.toString().length;else if(X===null||X===void 0)return 0;return JSON.stringify(X).length}catch{return}};return Array.isArray(Z)?Z.reduce((X,Y)=>{let $=J(Y);return typeof $==="number"?X!==void 0?X+$:$:X},0):J(Z)}function VY1(Z){let J=[],X=(Y)=>{Y.forEach(($)=>{if(Array.isArray($))X($);else J.push($)})};return X(Z),J}var LY1="Redis",ay={},jY1=(Z,J,X,Y)=>{Z.setAttribute(_0,"auto.db.otel.redis");let $=qY1(J,X),Q=ny(J);if(!$||!Q||!ay.cachePrefixes||!FY1(J,$,ay.cachePrefixes))return;let W=B0(Z).data["net.peer.name"],K=B0(Z).data["net.peer.port"];if(K&&W)Z.setAttributes({"network.peer.address":W,"network.peer.port":K});let G=UY1(Y);if(G)Z.setAttribute(Gh,G);if(gF(iy,J)&&G!==void 0)Z.setAttribute(Wh,G>0);Z.setAttributes({[N0]:Q,[Kh]:$});let z=$.join(", ");Z.updateName(s5(z,1024))},R46=w0("IORedis",()=>{return new wY1.IORedisInstrumentation({responseHook:jY1})}),N46=w0("Redis-4",()=>{return new BY1.RedisInstrumentation({responseHook:jY1})}),sy=Object.assign(()=>{R46(),N46()},{id:LY1}),D46=(Z={})=>{return{name:LY1,setupOnce(){ay=Z,sy()}}},aR=a(D46);var oY1=e(sY1(),1);var rY1="Postgres",Yg=w0(rY1,()=>new oY1.PgInstrumentation({requireParentSpan:!0,requestHook(Z){o1(Z,"auto.db.otel.postgres")}})),K76=()=>{return{name:rY1,setupOnce(){Yg()}}},tR=a(K76);var r3=e(Y0(),1);var r6=e(R1(),1);var $g="PostgresJs",tY1=[">=3.0.0 <4"],Qg=w0($g,(Z)=>new eY1({requireParentSpan:Z?.requireParentSpan??!0,requestHook:Z?.requestHook}));class eY1 extends h8{constructor(Z){super("sentry-postgres-js",M1,Z)}init(){let Z=new a6("postgres",tY1);return["src","cf/src","cjs/src"].forEach((J)=>{Z.files.push(new fM(`postgres/${J}/connection.js`,["*"],this._patchConnection.bind(this),this._unwrap.bind(this))),Z.files.push(new fM(`postgres/${J}/query.js`,tY1,this._patchQuery.bind(this),this._unwrap.bind(this)))}),[Z]}_shouldCreateSpans(){let Z=this.getConfig();return r3.trace.getSpan(r3.context.active())!==void 0||!Z.requireParentSpan}_patchReject(Z,J){return new Proxy(Z,{apply:(X,Y,$)=>{J.setStatus({code:x8,message:$?.[0]?.message||"unknown_error"});let Q=Reflect.apply(X,Y,$);return J.setAttribute(r6.ATTR_DB_RESPONSE_STATUS_CODE,$?.[0]?.code||"Unknown error"),J.setAttribute(r6.ATTR_ERROR_TYPE,$?.[0]?.name||"Unknown error"),J.end(),Q}})}_patchResolve(Z,J){return new Proxy(Z,{apply:(X,Y,$)=>{let Q=Reflect.apply(X,Y,$),W=$?.[0]?.command;if(W)J.setAttribute(r6.ATTR_DB_OPERATION_NAME,W);return J.end(),Q}})}_patchQuery(Z){return Z.Query.prototype.handle=new Proxy(Z.Query.prototype.handle,{apply:async(J,X,Y)=>{if(!this._shouldCreateSpans())return Reflect.apply(J,X,Y);let $=this._sanitizeSqlQuery(X.strings?.[0]);return jQ({name:$||"postgresjs.query",op:"db"},(Q)=>{let K=T0().getScopeData().contexts.postgresjsConnection;o1(Q,"auto.db.otel.postgres");let{requestHook:G}=this.getConfig();if(G)$Y(()=>G(Q,$,K),(q)=>{if(q)h.error(`Error in requestHook for ${$g} integration:`,q)});let z=K?.ATTR_DB_NAMESPACE||"<unknown database>",H=K?.ATTR_SERVER_ADDRESS||"<unknown host>",V=K?.ATTR_SERVER_PORT||"<unknown port>";Q.setAttribute(r6.ATTR_DB_SYSTEM_NAME,"postgres"),Q.setAttribute(r6.ATTR_DB_NAMESPACE,z),Q.setAttribute(r6.ATTR_SERVER_ADDRESS,H),Q.setAttribute(r6.ATTR_SERVER_PORT,V),Q.setAttribute(r6.ATTR_DB_QUERY_TEXT,$),X.resolve=this._patchResolve(X.resolve,Q),X.reject=this._patchReject(X.reject,Q);try{return Reflect.apply(J,X,Y)}catch(q){throw Q.setStatus({code:x8}),Q.end(),q}})}}),Z}_patchConnection(Z){return new Proxy(Z,{apply:(J,X,Y)=>{let $=Y[0]?.database||"<unknown database>",Q=Y[0]?.host?.[0]||"<unknown host>",W=Y[0]?.port?.[0]||"<unknown port>";return T0().setContext("postgresjsConnection",{ATTR_DB_NAMESPACE:$,ATTR_SERVER_ADDRESS:Q,ATTR_SERVER_PORT:W}),Reflect.apply(J,X,Y)}})}_sanitizeSqlQuery(Z){if(!Z)return"Unknown SQL Query";return Z.replace(/\s+/g," ").trim().substring(0,1024).replace(/--.*?(\r?\n|$)/g,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/;\s*$/,"").replace(/\b\d+\b/g,"?").replace(/\s+/g," ").replace(/\bIN\b\s*\(\s*\?(?:\s*,\s*\?)*\s*\)/g,"IN (?)")}}var G76=()=>{return{name:$g,setupOnce(){Qg()}}},eR=a(G76);var X$1=e(Y0(),1);var AY=e(Y0(),1);var z76=process.env.PRISMA_SHOW_ALL_TRACES==="true",H76="00-10-10-00";function V76(Z){switch(Z){case"client":return AY.SpanKind.CLIENT;case"internal":default:return AY.SpanKind.INTERNAL}}var q76=class{traceMiddleware;tracerProvider;ignoreSpanTypes;constructor({traceMiddleware:Z,tracerProvider:J,ignoreSpanTypes:X}){this.traceMiddleware=Z,this.tracerProvider=J,this.ignoreSpanTypes=X}isEnabled(){return!0}getTraceParent(Z){let J=AY.trace.getSpanContext(Z??AY.context.active());if(J)return`00-${J.traceId}-${J.spanId}-0${J.traceFlags}`;return H76}dispatchEngineSpans(Z){let J=this.tracerProvider.getTracer("prisma"),X=new Map,Y=Z.filter(($)=>$.parentId===null);for(let $ of Y)Y$1(J,$,Z,X,this.ignoreSpanTypes)}getActiveContext(){return AY.context.active()}runInChildSpan(Z,J){if(typeof Z==="string")Z={name:Z};if(Z.internal&&!z76)return J();if(Z.middleware&&!this.traceMiddleware)return J();let X=this.tracerProvider.getTracer("prisma"),Y=Z.context??this.getActiveContext(),$=`prisma:client:${Z.name}`;if($$1($,this.ignoreSpanTypes))return J();if(Z.active===!1){let Q=X.startSpan($,Z,Y);return Z$1(Q,J(Q,Y))}return X.startActiveSpan($,Z,(Q)=>Z$1(Q,J(Q,Y)))}};function Y$1(Z,J,X,Y,$){if($$1(J.name,$))return;let Q={attributes:J.attributes,kind:V76(J.kind),startTime:J.startTime};Z.startActiveSpan(J.name,Q,(W)=>{if(Y.set(J.id,W.spanContext().spanId),J.links)W.addLinks(J.links.flatMap((G)=>{let z=Y.get(G);if(!z)return[];return{context:{spanId:z,traceId:W.spanContext().traceId,traceFlags:W.spanContext().traceFlags}}}));let K=X.filter((G)=>G.parentId===J.id);for(let G of K)Y$1(Z,G,X,Y,$);W.end(J.endTime)})}function Z$1(Z,J){if(F76(J))return J.then((X)=>{return Z.end(),X},(X)=>{throw Z.end(),X});return Z.end(),J}function F76(Z){return Z!=null&&typeof Z.then==="function"}function $$1(Z,J){return J.some((X)=>typeof X==="string"?X===Z:X.test(Z))}var Q$1={name:"@prisma/instrumentation",version:"6.11.1",description:"OpenTelemetry compliant instrumentation for Prisma Client",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.ts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation"},bugs:"https://github.com/prisma/prisma/issues",devDependencies:{"@prisma/internals":"workspace:*","@swc/core":"1.11.5","@types/jest":"29.5.14","@types/node":"18.19.76","@opentelemetry/api":"1.9.0",jest:"29.7.0","jest-junit":"16.0.0",typescript:"5.4.5"},dependencies:{"@opentelemetry/instrumentation":"^0.52.0 || ^0.53.0 || ^0.54.0 || ^0.55.0 || ^0.56.0 || ^0.57.0"},peerDependencies:{"@opentelemetry/api":"^1.8"},files:["dist"],keywords:["prisma","instrumentation","opentelemetry","otel"],scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"jest"},sideEffects:!1},Kg=Q$1.version,U76=Kg.split(".")[0],J$1="PRISMA_INSTRUMENTATION",Wg=`V${U76}_PRISMA_INSTRUMENTATION`,w76=Q$1.name,B76="@prisma/client",W$1=class extends h8{tracerProvider;constructor(Z={}){super(w76,Kg,Z)}setTracerProvider(Z){this.tracerProvider=Z}init(){return[new a6(B76,[Kg])]}enable(){let Z=this._config,J={helper:new q76({traceMiddleware:Z.middleware??!1,tracerProvider:this.tracerProvider??X$1.trace.getTracerProvider(),ignoreSpanTypes:Z.ignoreSpanTypes??[]})};global[J$1]=J,global[Wg]=J}disable(){delete global[J$1],delete global[Wg]}isEnabled(){return Boolean(global[Wg])}};var K$1="Prisma";function L76(Z){return!!Z&&typeof Z==="object"&&"dispatchEngineSpans"in Z}function G$1(){let Z=globalThis.PRISMA_INSTRUMENTATION;return Z&&typeof Z==="object"&&"helper"in Z?Z.helper:void 0}class z$1 extends W$1{constructor(){super()}enable(){super.enable();let Z=G$1(),J=!1;if(L76(Z))Z.createEngineSpan=()=>{e0(()=>{if(!J)J=!0,console.warn("[Sentry] The Sentry SDK supports tracing with Prisma version 5 only with limited capabilities. For full tracing capabilities pass `prismaInstrumentation` for version 5 to the Sentry `prismaIntegration`. Read more: https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/")})}}}var j76=w0(K$1,(Z)=>{if(Z?.prismaInstrumentation)return Z.prismaInstrumentation;return new z$1}),ZN=a(({prismaInstrumentation:Z}={})=>{return{name:K$1,setupOnce(){j76({prismaInstrumentation:Z})},setup(J){if(!G$1())return;J.on("spanStart",(X)=>{let Y=B0(X);if(Y.description?.startsWith("prisma:"))X.setAttribute(_0,"auto.db.otel.prisma");if(Y.description==="prisma:engine:db_query"&&Y.data["db.query.text"])X.updateName(Y.data["db.query.text"]);if(Y.description==="prisma:engine:db_query"&&!Y.data["db.system"])X.setAttribute("db.system","prisma")})}}});var k$1=e(T$1(),1);var E$1="Hapi",YN=w0(E$1,()=>new k$1.HapiInstrumentation),g76=()=>{return{name:E$1,setupOnce(){YN()}}},$N=a(g76);function m76(Z){return!!(Z&&typeof Z==="object"&&("error"in Z)&&Z.error)}function u76(Z){Z1(Z,{mechanism:{type:"hapi",handled:!1,data:{function:"hapiErrorPlugin"}}})}var d76={name:"SentryHapiErrorPlugin",version:M1,register:async function(Z){Z.events.on({name:"request",channels:["error"]},(X,Y)=>{if(E0()!==z4()){let $=X.route;if($.path)E0().setTransactionName(`${$.method.toUpperCase()} ${$.path}`)}else j4&&h.warn("Isolation scope is still the default isolation scope - skipping setting transactionName");if(m76(Y))u76(Y.error)})}};async function I$1(Z){await Z.register(d76);let J=X0();if(J)J.on("spanStart",(X)=>{c76(X)});SJ(Z.register,"hapi")}function c76(Z){let J=B0(Z).data,X=J["hapi.type"];if(J[N0]||!X)return;Z.setAttributes({[_0]:"auto.http.otel.hapi",[N0]:`${X}.hapi`})}var t$1=e(r$1(),1),e$1=e(R1(),1);var ZQ1="Koa",Bg=w0(ZQ1,t$1.KoaInstrumentation,(Z={})=>{return{ignoreLayersType:Z.ignoreLayersType,requestHook(J,X){o1(J,"auto.http.otel.koa");let Y=B0(J).data,$=Y["koa.type"];if($)J.setAttribute(N0,`${$}.koa`);let Q=Y["koa.name"];if(typeof Q==="string")J.updateName(Q||"< unknown >");if(E0()===z4()){j4&&h.warn("Isolation scope is default isolation scope - skipping setting transactionName");return}let W=Y[e$1.ATTR_HTTP_ROUTE],K=X.context?.request?.method?.toUpperCase()||"GET";if(W)E0().setTransactionName(`${K} ${W}`)}}}),t76=(Z={})=>{return{name:ZQ1,setupOnce(){Bg(Z)}}},KN=a(t76),JQ1=(Z)=>{Z.use(async(J,X)=>{try{await X()}catch(Y){throw Z1(Y),Y}}),SJ(Z.use,"koa")};var NQ1=e(RQ1(),1);var DQ1="Connect",Rg=w0(DQ1,()=>new NQ1.ConnectInstrumentation),qZ6=()=>{return{name:DQ1,setupOnce(){Rg()}}},zN=a(qZ6);function FZ6(Z,J,X,Y){Z1(Z),Y(Z)}var PQ1=(Z)=>{Z.use(FZ6);let J=X0();if(J)J.on("spanStart",(X)=>{UZ6(X)});SJ(Z.use,"connect")};function UZ6(Z){let J=B0(Z).data,X=J["connect.type"];if(J[N0]||!X)return;Z.setAttributes({[_0]:"auto.http.otel.connect",[N0]:`${X}.connect`});let Y=J["connect.name"];if(typeof Y==="string")Z.updateName(Y)}var pQ1=e(lQ1(),1);var iQ1="Knex",vZ6=w0(iQ1,()=>new pQ1.KnexInstrumentation({requireParentSpan:!0})),SZ6=()=>{let Z;return{name:iQ1,setupOnce(){let J=vZ6();Z=TJ(J)},setup(J){Z?.(()=>J.on("spanStart",(X)=>{let{data:Y}=B0(X);if("knex.version"in Y)X.setAttribute(_0,"auto.db.otel.knex")}))}}},nQ1=a(SZ6);var VW1=e(HW1(),1);var yZ6=new Set(["callProcedure","execSql","execSqlBatch","execBulkLoad","prepare","execute"]),qW1="Tedious",Dg=w0(qW1,()=>new VW1.TediousInstrumentation({})),gZ6=()=>{let Z;return{name:qW1,setupOnce(){let J=Dg();Z=TJ(J)},setup(J){Z?.(()=>J.on("spanStart",(X)=>{let{description:Y,data:$}=B0(X);if(!Y||$["db.system"]!=="mssql")return;let Q=Y.split(" ")[0]||"";if(yZ6.has(Q))X.setAttribute(_0,"auto.db.otel.tedious")}))}}},UN=a(gZ6);var NW1=e(RW1(),1);var DW1="GenericPool",Cg=w0(DW1,()=>new NW1.GenericPoolInstrumentation({})),cZ6=()=>{let Z;return{name:DW1,setupOnce(){let J=Cg();Z=TJ(J)},setup(J){Z?.(()=>J.on("spanStart",(X)=>{let $=B0(X).description;if($==="generic-pool.aquire"||$==="generic-pool.acquire")X.setAttribute(_0,"auto.db.otel.generic_pool")}))}}},wN=a(cZ6);var fW1=e(hW1(),1);var bW1="Dataloader",iZ6=w0(bW1,()=>new fW1.DataloaderInstrumentation({requireParentSpan:!0})),nZ6=()=>{let Z;return{name:bW1,setupOnce(){let J=iZ6();Z=TJ(J)},setup(J){Z?.(()=>{J.on("spanStart",(X)=>{let Y=B0(X);if(Y.description?.startsWith("dataloader"))X.setAttribute(_0,"auto.db.otel.dataloader");if(Y.description==="dataloader.load"||Y.description==="dataloader.loadMany"||Y.description==="dataloader.batch")X.setAttribute(N0,"cache.get")})})}}},yW1=a(nZ6);var $K1=e(YK1(),1);var QK1="Amqplib",FJ6={consumeEndHook:(Z)=>{o1(Z,"auto.amqplib.otel.consumer")},publishHook:(Z)=>{o1(Z,"auto.amqplib.otel.publisher")}},vg=w0(QK1,()=>new $K1.AmqplibInstrumentation(FJ6)),UJ6=()=>{return{name:QK1,setupOnce(){vg()}}},jN=a(UJ6);var pF="VercelAI";var WK1=["generateText","streamText","generateObject","streamObject","embed","embedMany"];function wJ6(Z,J,X,Y){let $=Z?.recordInputs!==void 0?Z.recordInputs:J.recordInputs!==void 0?J.recordInputs:X===!0?!0:Y,Q=Z?.recordOutputs!==void 0?Z.recordOutputs:J.recordOutputs!==void 0?J.recordOutputs:X===!0?!0:Y;return{recordInputs:$,recordOutputs:Q}}class iF extends h8{__init(){this._isPatched=!1}__init2(){this._callbacks=[]}constructor(Z={}){super("@sentry/instrumentation-vercel-ai",M1,Z);iF.prototype.__init.call(this),iF.prototype.__init2.call(this)}init(){return new a6("ai",[">=3.0.0 <5"],this._patch.bind(this))}callWhenPatched(Z){if(this._isPatched)Z();else this._callbacks.push(Z)}_patch(Z){this._isPatched=!0,this._callbacks.forEach((X)=>X()),this._callbacks=[];function J(X){return(...Y)=>{let $=Y[0].experimental_telemetry||{},Q=$.isEnabled,W=T0().getClient(),K=W?.getIntegrationByName(pF),G=K?.options,z=K?Boolean(W?.getOptions().sendDefaultPii):!1,{recordInputs:H,recordOutputs:V}=wJ6(G,$,Q,z);return Y[0].experimental_telemetry={...$,isEnabled:Q!==void 0?Q:!0,recordInputs:H,recordOutputs:V},MJ(()=>{return X.apply(this,Y)},(q)=>{if(q&&typeof q==="object")J8(q,"_sentry_active_span",T6())})}}if(Object.prototype.toString.call(Z)==="[object Module]"){for(let X of WK1)Z[X]=J(Z[X]);return Z}else{let X=WK1.reduce((Y,$)=>{return Y[$]=J(Z[$]),Y},{});return{...Z,...X}}}}var Sg=w0(pF,()=>new iF({}));function BJ6(Z){return!!Z.getIntegrationByName("Modules")?.getModules?.()?.ai}var LJ6=(Z={})=>{let J;return{name:pF,options:Z,setupOnce(){J=Sg()},afterAllSetup(X){if(Z.force??BJ6(X))kM(X);else J?.callWhenPatched(()=>kM(X))}}},ON=a(LJ6);var jJ6=[">=4.0.0 <6"];function OJ6(Z,J){let X=Z?.recordInputs??J,Y=Z?.recordOutputs??J;return{recordInputs:X,recordOutputs:Y}}class _g extends h8{constructor(Z={}){super("@sentry/instrumentation-openai",M1,Z)}init(){return new a6("openai",jJ6,this._patch.bind(this))}_patch(Z){let J=Z.OpenAI,X=function(...Y){let $=Reflect.construct(J,Y),Q=T0().getClient(),K=Q?.getIntegrationByName(XY)?.options,G=Boolean(Q?.getOptions().sendDefaultPii),{recordInputs:z,recordOutputs:H}=OJ6(K,G);return ff($,{recordInputs:z,recordOutputs:H})};Object.setPrototypeOf(X,J),Object.setPrototypeOf(X.prototype,J.prototype);for(let Y of Object.getOwnPropertyNames(J))if(!["length","name","prototype"].includes(Y)){let $=Object.getOwnPropertyDescriptor(J,Y);if($)Object.defineProperty(X,Y,$)}try{Z.OpenAI=X}catch(Y){Object.defineProperty(Z,"OpenAI",{value:X,writable:!0,configurable:!0,enumerable:!0})}return Z}}var Ag=w0(XY,()=>new _g({})),MJ6=(Z={})=>{return{name:XY,options:Z,setupOnce(){Ag()}}},MN=a(MJ6);var KK1=a((Z)=>{if(!z7())e0(()=>{console.warn("The launchDarklyIntegration() can only be used in the browser.")});return{name:"LaunchDarkly"}});function GK1(){if(!z7())e0(()=>{console.warn("The buildLaunchDarklyFlagUsedHandler() can only be used in the browser.")});return{name:"sentry-flag-auditor",type:"flag-used",synchronous:!0,method:()=>null}}var zK1=a((Z)=>{if(!z7())e0(()=>{console.warn("The openFeatureIntegration() can only be used in the browser.")});return{name:"OpenFeature"}});class xg{constructor(){if(!z7())e0(()=>{console.warn("The OpenFeatureIntegrationHook can only be used in the browser.")})}after(){}error(){}}var HK1=a((Z)=>{if(!z7())e0(()=>{console.warn("The statsigIntegration() can only be used in the browser.")});return{name:"Statsig"}});var VK1=a((Z)=>{if(!z7())e0(()=>{console.warn("The unleashIntegration() can only be used in the browser.")});return{name:"Unleash"}});function RN(){return[ER(),AR(),bR(),mR(),dR(),lR(),iR(),aR(),tR(),ZN(),$N(),KN(),zN(),UN(),wN(),yR(),jN(),gR(),ON(),MN(),eR()]}function qK1(){return[ob,Wy,Ky,Rg,jy,Ly,YN,Ty,Bg,ky,_y,hy,gy,ly,Yg,YN,Cy,sy,Dg,Cg,vg,Sg,Ag,Qg]}var XG=e(Y0(),1);var YG=e(R1(),1);var FK1=e($q(),1);import RJ6 from"module";var hg=1e6;function NN(Z,J={}){if(Z.getOptions().debug)cb();let X=PJ6(Z,J);Z.traceProvider=X}function NJ6(){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}=FK1.createAddHookMessageChannel();RJ6.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:X,include:[]},transferList:[X]})}catch(X){h.warn("Failed to register ESM hook",X)}}else e0(()=>{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 UK1(Z={}){let{debug:J}=Z;if(J)h.enable();if(!L4())NJ6();DJ6(Z.integrations).forEach((X)=>{if(X(),J)h.log(`[Sentry] Preloaded ${X.id} instrumentation`)})}function DJ6(Z){let J=qK1();if(!Z)return J;return J.filter((X)=>Z.includes(X.id))}function PJ6(Z,J={}){let X=new Hb({sampler:new Ib(Z),resource:new _3({[YG.ATTR_SERVICE_NAME]:"node",[YG.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[YG.ATTR_SERVICE_VERSION]:M1}),forceFlushTimeoutMillis:500,spanProcessors:[new Eb({timeout:CJ6(Z.getOptions().maxSpanWaitDuration)}),...J.spanProcessors||[]]});return XG.trace.setGlobalTracerProvider(X),XG.propagation.setGlobalPropagator(new Db),XG.context.setGlobalContextManager(new qF),X}function CJ6(Z){if(Z==null)return;if(Z>hg)return j4&&h.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${hg}`),hg;else if(Z<=0||Number.isNaN(Z)){j4&&h.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return Z}function fg(){return jR().filter((J)=>J.name!=="Http"&&J.name!=="NodeFetch").concat(OR(),RR())}function bg(Z){return[...fg(),...c8(Z)?RN():[]]}function DN(Z={}){return wK1(Z,bg)}function wK1(Z={},J){DQ(Z,"node");let X=nb({...Z,defaultIntegrations:Z.defaultIntegrations??J(Z)});if(X&&!Z.skipOpenTelemetrySetup)NN(X,{spanProcessors:Z.openTelemetrySpanProcessors}),OF();return X}function BK1(Z={}){return wK1(Z,()=>[])}var sQ;((B)=>{B.BUILD_PACKETS="build_packets";B.ENTITIES_EMIT_UPDATES="entities_emit_updates";B.ENTITIES_TICK="entities_tick";B.NETWORK_SYNCHRONIZE="network_synchronize";B.NETWORK_SYNCHRONIZE_CLEANUP="network_synchronize_cleanup";B.PHYSICS_CLEANUP="physics_cleanup";B.PHYSICS_STEP="physics_step";B.SEND_ALL_PACKETS="send_all_packets";B.SEND_PACKETS="send_packets";B.SERIALIZE_FREE_BUFFERS="serialize_free_buffers";B.SERIALIZE_PACKETS="serialize_packets";B.SERIALIZE_PACKETS_ENCODE="serialize_packets_encode";B.SIMULATION_STEP="simulation_step";B.TICKER_TICK="ticker_tick";B.WORLD_TICK="world_tick"})(sQ||={});class N8{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){DN({dsn:Z,release:nS,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=N8.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=N8.getProcessStats(!0),X}return null}})}static startSpan(Z,J){if(Eq())return q4({attributes:Z.attributes,name:Z.operation,op:Z.operation},J);else return J()}static sentry(){return yg}}var LK1=new I$,EJ6=5000,jK1={RAW:0,GZIP:1};class o4 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=q50(),this.onPacket(Q0.PacketId.CONNECTION,this._onConnectionPacket),this.onPacket(Q0.PacketId.HEARTBEAT,this._onHeartbeatPacket),this.bindWs(Z),j0.globalInstance.emit("CONNECTION.OPENED",{connection:this,req:J})}static clearCachedPacketsSerializedBuffers(){if(o4._cachedPacketsSerializedBuffer.size>0)o4._cachedPacketsSerializedBuffer.clear()}static serializePackets(Z){for(let X of Z)if(!Q0.isValidPacket(X))return d.error(`Connection.serializePackets(): Invalid packet payload: ${JSON.stringify(X)}`);let J=o4._cachedPacketsSerializedBuffer.get(Z);if(J)return J;return N8.startSpan({operation:"serialize_packets",attributes:{packets:Z.length,packetIds:Z.map((X)=>X[0]).join(",")}},(X)=>{let Y=LK1.pack(Z),$=Y.byteLength>16384,Q=$?TJ6(Y,{level:1}):Y,W=$?jK1.GZIP:jK1.RAW;return Y=Buffer.allocUnsafe(Q.length+1),Y[0]=W,Q.copy(Y,1),X?.setAttribute("serializedBytes",Y.byteLength),o4._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([Q0.createPacket(Q0.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([Q0.createPacket(Q0.bidirectionalPackets.connectionPacketDefinition,{i:this.id})],!0,!0),J)this.emitWithGlobal("CONNECTION.RECONNECTED",{connection:this});if(a7.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!==kJ6.OPEN)return;N8.startSpan({operation:"send_packets",attributes:{forceWs:X?"true":"false",wrtcConnected:this._wrtcServerClientTransport?.iceState==="completed"?"true":"false"}},()=>{try{let Y=o4.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([Q0.createPacket(Q0.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([Q0.createPacket(Q0.bidirectionalPackets.connectionPacketDefinition,{pa:{i:K.id,l:W}})])}};_onHeartbeatPacket=()=>{this.send([Q0.createPacket(Q0.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()},EJ6)};_onWsError=(Z)=>{this.emitWithGlobal("CONNECTION.ERROR",{connection:this,error:Z})};_upgradeToWRTC=async()=>{let Z=await a7.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([Q0.createPacket(Q0.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=LK1.unpack(Z);if(!J||typeof J!=="object"||typeof J[0]!=="number")return d.error(`Connection._deserialize(): Invalid packet format. Packet: ${JSON.stringify(J)}`);if(!Q0.isValidPacket(J))return d.error(`Connection._deserialize(): Invalid packet payload. Packet: ${JSON.stringify(J)}`);return J}}class nF{_lights=new Map;_nextLightId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}despawnEntityAttachedLights(Z){this.getAllEntityAttachedLights(Z).forEach((J)=>{J.despawn()})}getAllLights(){return Array.from(this._lights.values())}getAllEntityAttachedLights(Z){return this.getAllLights().filter((J)=>J.attachedToEntity===Z)}registerLight(Z){if(Z.id!==void 0)return Z.id;let J=this._nextLightId;return this._lights.set(J,Z),this._nextLightId++,J}unregisterLight(Z){if(Z.id===void 0)return;this._lights.delete(Z.id)}}class B6{_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 OK1;((X)=>{X[X.POINTLIGHT=0]="POINTLIGHT";X[X.SPOTLIGHT=1]="SPOTLIGHT"})(OK1||={});var gg;((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"})(gg||={});class mg 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(){return k0.serializeLight(this)}}var ug;((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"})(ug||={});class dg 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(){return k0.serializeParticleEmitter(this)}}var IJ6={x:0,y:-32,z:0},cg=60,lg;(($)=>{$.STEP_START="SIMULATION.STEP_START";$.STEP_END="SIMULATION.STEP_END";$.DEBUG_RAYCAST="SIMULATION.DEBUG_RAYCAST";$.DEBUG_RENDER="SIMULATION.DEBUG_RENDER"})(lg||={});class aF extends j0{_colliderMap=new FH;_debugRaycastingEnabled=!1;_debugRenderingEnabled=!1;_debugRenderingFilterFlags;_rapierEventQueue;_rapierSimulation;_world;constructor(Z,J=cg,X=IJ6){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:JW.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(N8.startSpan({operation:"physics_step"},()=>{this._rapierSimulation.step(this._rapierEventQueue)}),N8.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 o8&&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 o8&&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 o8&&K instanceof o8&&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 o8||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 o8&&Q.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))Q.emit("BLOCK_TYPE.ENTITY_CONTACT_FORCE",{blockType:Q,entity:W,contactForceData:Y});else if(Q instanceof o8&&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 o8&&W instanceof o8&&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 PN{_synchronizedPlayerReliablePackets=new B6;_queuedBroadcasts=[];_queuedAudioSynchronizations=new B6;_queuedBlockSynchronizations=new B6;_queuedBlockTypeSynchronizations=new B6;_queuedChunkSynchronizations=new B6;_queuedDebugRaycastSynchronizations=[];_queuedEntitySynchronizations=new B6;_queuedLightSynchronizations=new B6;_queuedParticleEmitterSynchronizations=new B6;_queuedPerPlayerSynchronizations=new B6;_queuedPerPlayerCameraSynchronizations=new B6;_queuedPerPlayerUISynchronizations=new B6;_queuedPerPlayerUIDatasSynchronizations=new B6;_queuedPlayerSynchronizations=new B6;_queuedSceneUISynchronizations=new B6;_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=[],J=[],X=this._world.loop.currentTick;if(this._queuedPerPlayerSynchronizations.size>0)for(let[Y,$]of this._queuedPerPlayerSynchronizations)this._createOrGetSynchronizedPlayerReliablePackets(Y,Z).push(...$);if(this._queuedEntitySynchronizations.size>0){let Y=[],$=[];for(let Q of this._queuedEntitySynchronizations.valuesArray){let W=!1;for(let K in Q)if(K!=="i"&&K!=="p"&&K!=="r"){W=!0;break}if(W)Y.push(Q);else $.push(Q)}if($.length>0){let Q=Q0.createPacket(Q0.outboundPackets.entitiesPacketDefinition,$,X);J.push(Q)}if(Y.length>0){let Q=Q0.createPacket(Q0.outboundPackets.entitiesPacketDefinition,Y,X);Z.push(Q);for(let W of this._synchronizedPlayerReliablePackets.valuesArray)W.push(Q)}}if(this._queuedAudioSynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.audiosPacketDefinition,this._queuedAudioSynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedBlockTypeSynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.blockTypesPacketDefinition,this._queuedBlockTypeSynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedChunkSynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.chunksPacketDefinition,this._queuedChunkSynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedBlockSynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.blocksPacketDefinition,this._queuedBlockSynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedLightSynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.lightsPacketDefinition,this._queuedLightSynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedParticleEmitterSynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.particleEmittersPacketDefinition,this._queuedParticleEmitterSynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedPerPlayerUISynchronizations.size>0)for(let[Y,$]of this._queuedPerPlayerUISynchronizations){let Q=Q0.createPacket(Q0.outboundPackets.uiPacketDefinition,$,X);this._createOrGetSynchronizedPlayerReliablePackets(Y,Z).push(Q)}if(this._queuedPerPlayerUIDatasSynchronizations.size>0)for(let[Y,$]of this._queuedPerPlayerUIDatasSynchronizations){let Q=Q0.createPacket(Q0.outboundPackets.uiDatasPacketDefinition,$,X);this._createOrGetSynchronizedPlayerReliablePackets(Y,Z).push(Q)}if(this._queuedSceneUISynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.sceneUIsPacketDefinition,this._queuedSceneUISynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedWorldSynchronization){let Y=Q0.createPacket(Q0.outboundPackets.worldPacketDefinition,this._queuedWorldSynchronization,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedPerPlayerCameraSynchronizations.size>0)for(let[Y,$]of this._queuedPerPlayerCameraSynchronizations){let Q=Q0.createPacket(Q0.outboundPackets.cameraPacketDefinition,$,X);this._createOrGetSynchronizedPlayerReliablePackets(Y,Z).push(Q)}if(this._queuedPlayerSynchronizations.size>0){let Y=Q0.createPacket(Q0.outboundPackets.playersPacketDefinition,this._queuedPlayerSynchronizations.valuesArray,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedBroadcasts.length>0)for(let Y of this._queuedBroadcasts){Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}if(this._queuedDebugRaycastSynchronizations.length>0){let Y=Q0.createPacket(Q0.outboundPackets.physicsDebugRaycastsPacketDefinition,this._queuedDebugRaycastSynchronizations,X);Z.push(Y);for(let $ of this._synchronizedPlayerReliablePackets.valuesArray)$.push(Y)}N8.startSpan({operation:"send_all_packets"},()=>{for(let Y of j9.instance.getConnectedPlayersByWorld(this._world)){let $=this._synchronizedPlayerReliablePackets.get(Y)??Z;if($.length>0)Y.connection.send($);if(J.length>0)Y.connection.send(J,!1)}}),N8.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();o4.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=this._createOrGetQueuedAudioSync(Z.audio);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?k0.serializeVector(Z.position):void 0};_onAudioSetPlaybackRate=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.pr=Z.playbackRate};_onAudioSetReferenceDistance=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.rd=Z.referenceDistance};_onAudioSetVolume=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.v=Z.volume};_onBlockTypeRegistryRegisterBlockType=(Z)=>{let J=Z.blockType.serialize();this._queuedBlockTypeSynchronizations.set(Z.blockType.id,J)};_onChatSendBroadcastMessage=(Z)=>{let{player:J,message:X,color:Y}=Z;this._queuedBroadcasts.push(Q0.createPacket(Q0.outboundPackets.chatMessagesPacketDefinition,[{m:X,c:Y,p:J?.id}],this._world.loop.currentTick))};_onChatSendPlayerMessage=(Z)=>{let{player:J,message:X,color:Y}=Z,$=this._queuedPerPlayerSynchronizations.get(J)??[];$.push(Q0.createPacket(Q0.outboundPackets.chatMessagesPacketDefinition,[{m:X,c:Y}],this._world.loop.currentTick)),this._queuedPerPlayerSynchronizations.set(J,$)};_onChunkLatticeAddChunk=(Z)=>{let J=this._createOrGetQueuedChunkSync(Z.chunk);J.b=Array.from(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=Array.from(Z.modelHiddenNodes)};_onEntitySetModelScale=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.s=Z.modelScale};_onEntitySetModelShownNodes=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.sn=Array.from(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?k0.serializeRgbColor(Z.tintColor):void 0};_onEntityStartModelLoopedAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.al=Array.from(new Set([...J.al??[],...Z.animations])),J.as)J.as=J.as.filter((X)=>!Z.animations.has(X)).filter(Boolean)};_onEntityStartModelOneshotAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.ao=Array.from(new Set([...J.ao??[],...Z.animations])),J.as)J.as=J.as.filter((X)=>!Z.animations.has(X)).filter(Boolean)};_onEntityStopModelAnimations=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(J.al)J.al=J.al.filter((X)=>!Z.animations.has(X)).filter(Boolean);if(J.ao)J.ao=J.ao.filter((X)=>!Z.animations.has(X)).filter(Boolean);J.as=Array.from(new Set([...J.as??[],...Z.animations]))};_onEntityUpdateRotation=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.r=[Z.rotation.x,Z.rotation.y,Z.rotation.z,Z.rotation.w]};_onEntityUpdatePosition=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.p=[Z.position.x,Z.position.y,Z.position.z]};_onLightDespawn=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.rm=!0};_onLightSetAngle=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.a=Z.angle};_onLightSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onLightSetColor=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.c=k0.serializeRgbColor(Z.color)};_onLightSetDistance=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.d=Z.distance};_onLightSetIntensity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.n=Z.intensity};_onLightSetOffset=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.o=Z.offset?k0.serializeVector(Z.offset):void 0};_onLightSetPenumbra=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.pe=Z.penumbra};_onLightSetPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.p=Z.position?k0.serializeVector(Z.position):void 0,J.e=Z.position?void 0:J.e};_onLightSetTrackedEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.te=Z.entity?Z.entity.id:void 0,J.tp=Z.entity?void 0:J.tp};_onLightSetTrackedPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.tp=Z.position?k0.serializeVector(Z.position):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?k0.serializeRgbColor(Z.colorEnd):void 0};_onParticleEmitterSetColorEndVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.cev=Z.colorEndVariance?k0.serializeRgbColor(Z.colorEndVariance):void 0};_onParticleEmitterSetColorStart=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.cs=Z.colorStart?k0.serializeRgbColor(Z.colorStart):void 0};_onParticleEmitterSetColorStartVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.csv=Z.colorStartVariance?k0.serializeRgbColor(Z.colorStartVariance):void 0};_onParticleEmitterSetGravity=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.g=Z.gravity?k0.serializeVector(Z.gravity):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?k0.serializeVector(Z.offset):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?k0.serializeVector(Z.position):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?k0.serializeVector(Z.positionVariance):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?k0.serializeVector(Z.velocity):void 0};_onParticleEmitterSetVelocityVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.vv=Z.velocityVariance?k0.serializeVector(Z.velocityVariance):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=k0.serializeVector(Z.entity.position),delete J.et,delete J.pt};_onPlayerCameraLookAtPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=Z.position?k0.serializeVector(Z.position):void 0,delete J.et,delete J.pt};_onPlayerCameraSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.e=Z.entity.id,delete J.p};_onPlayerCameraSetAttachedToPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.p=Z.position?k0.serializeVector(Z.position):void 0,delete J.e};_onPlayerCameraSetFilmOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fo=Z.filmOffset};_onPlayerCameraSetForwardOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.ffo=Z.forwardOffset};_onPlayerCameraSetFov=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fv=Z.fov};_onPlayerCameraSetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.h=Array.from(Z.modelHiddenNodes)};_onPlayerCameraSetModelShownNodes=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.s=Array.from(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?k0.serializeVector(Z.offset):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?k0.serializeVector(Z.position):void 0,delete J.et,delete J.pl};_onPlayerCameraSetZoom=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.z=Z.zoom};_onPlayerJoinedWorld=(Z)=>{let{player:J}=Z,X=this._queuedPerPlayerSynchronizations.get(J)??[];X.push(Q0.createPacket(Q0.outboundPackets.worldPacketDefinition,this._world.serialize(),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.blockTypesPacketDefinition,this._world.blockTypeRegistry.serialize(),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.chunksPacketDefinition,this._world.chunkLattice.getAllChunks().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.entitiesPacketDefinition,this._world.entityManager.getAllEntities().map(($)=>{if(J.camera.attachedToEntity===void 0&&$ instanceof y7&&$.player===J)J.camera.setAttachedToEntity($);return $.serialize()}),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.audiosPacketDefinition,this._world.audioManager.getAllAudios().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.lightsPacketDefinition,this._world.lightManager.getAllLights().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.particleEmittersPacketDefinition,this._world.particleEmitterManager.getAllParticleEmitters().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.sceneUIsPacketDefinition,this._world.sceneUIManager.getAllSceneUIs().map(($)=>$.serialize()),this._world.loop.currentTick)),X.push(Q0.createPacket(Q0.outboundPackets.playersPacketDefinition,j9.instance.getConnectedPlayers().map(($)=>$.serialize()),this._world.loop.currentTick));let Y=this._createOrGetQueuedPlayerCameraSync(J.camera);this._queuedPerPlayerCameraSynchronizations.set(J,{...J.camera.serialize(),...Y}),this._queuedPerPlayerSynchronizations.set(J,X),this._queuedPlayerSynchronizations.set(J.id,J.serialize())};_onPlayerLeftWorld=(Z)=>{let J=this._createOrGetQueuedPlayerSync(Z.player);J.rm=!0};_onPlayerReconnectedWorld=(Z)=>{this._onPlayerJoinedWorld(Z)};_onPlayerRequestSync=(Z)=>{Z.player.connection.send([Q0.createPacket(Q0.outboundPackets.syncResponsePacketDefinition,{r:Z.receivedAt,s:Date.now(),p:performance.now()-Z.receivedAtMs,n:this._world.loop.nextTickMs},this._world.loop.currentTick)])};_onPlayerUILoad=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.u=Z.htmlUri};_onPlayerUILockPointer=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.p=Z.lock};_onPlayerUISendData=(Z)=>{this._createOrGetQueuedPlayerUIDatasSync(Z.playerUI).push(Z.data)};_onSceneUILoad=(Z)=>{let J=Z.sceneUI.serialize();this._queuedSceneUISynchronizations.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?k0.serializeVector(Z.offset):void 0};_onSceneUISetPosition=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.p=Z.position?k0.serializeVector(Z.position):void 0,J.e=Z.position?void 0:J.e};_onSceneUISetState=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.s=Z.state};_onSceneUISetViewDistance=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.v=Z.viewDistance};_onSceneUIUnload=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);if(this._loadedSceneUIs.has(J.i))this._queuedSceneUISynchronizations.delete(J.i),this._loadedSceneUIs.delete(J.i);else J.rm=!0};_onSimulationDebugRaycast=(Z)=>{this._queuedDebugRaycastSynchronizations.push(k0.serializePhysicsDebugRaycast(Z))};_onSimulationDebugRender=(Z)=>{this._queuedBroadcasts.push(Q0.createPacket(Q0.outboundPackets.physicsDebugRenderPacketDefinition,{v:Array.from(Z.vertices),c:Array.from(Z.colors)},this._world.loop.currentTick))};_onWorldSetAmbientLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ac=k0.serializeRgbColor(Z.color)};_onWorldSetAmbientLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ai=Z.intensity};_onWorldSetDirectionalLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dc=k0.serializeRgbColor(Z.color)};_onWorldSetDirectionalLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.di=Z.intensity};_onWorldSetDirectionalLightPosition=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dp=k0.serializeVector(Z.position)};_onWorldSetFogColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.fc=k0.serializeRgbColor(Z.color)};_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={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={i:0,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={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={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={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={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={i:Z.id},this._queuedPlayerSynchronizations.set(Z.id,J);return J}_createOrGetQueuedPlayerCameraSync(Z){let J=this._queuedPerPlayerCameraSynchronizations.get(Z.player);if(!J)J={},this._queuedPerPlayerCameraSynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUISync(Z){let J=this._queuedPerPlayerUISynchronizations.get(Z.player);if(!J)J={},this._queuedPerPlayerUISynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUIDatasSync(Z){let J=this._queuedPerPlayerUIDatasSynchronizations.get(Z.player);if(!J)J=[],this._queuedPerPlayerUIDatasSynchronizations.set(Z.player,J);return J}_createOrGetQueuedSceneUISync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedSceneUISync(): SceneUI has no id!");let J=this._queuedSceneUISynchronizations.get(Z.id);if(!J)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??={i:Z.id}}_createOrGetSynchronizedPlayerReliablePackets(Z,J){let X=this._synchronizedPlayerReliablePackets.get(Z);if(!X)X=[...J],this._synchronizedPlayerReliablePackets.set(Z,X);return X}}class sF{_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(){return 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 oF{_sceneUIs=new Map;_nextSceneUIId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}getAllSceneUIs(){return Array.from(this._sceneUIs.values())}getAllEntityAttachedSceneUIs(Z){return this.getAllSceneUIs().filter((J)=>J.attachedToEntity===Z)}getSceneUIById(Z){return this._sceneUIs.get(Z)}registerSceneUI(Z){if(Z.id!==void 0)return Z.id;let J=this._nextSceneUIId;return this._sceneUIs.set(J,Z),this._nextSceneUIId++,J}unloadEntityAttachedSceneUIs(Z){this.getAllEntityAttachedSceneUIs(Z).forEach((J)=>{J.unload()})}unregisterSceneUI(Z){if(Z.id===void 0)return;this._sceneUIs.delete(Z.id)}}var vJ6=2,SJ6=3;class rF{_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*SJ6,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)N8.startSpan({operation:"ticker_tick"},()=>{let Y=0;while(this._accumulatorMs>=this._fixedTimestepMs&&Y<vJ6)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 MK1;((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"})(MK1||={});class tF extends j0{_currentTick=0;_ticker;_world;constructor(Z,J=cg){super();this._ticker=new rF(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();N8.startSpan({operation:"world_tick",attributes:{serverPlayerCount:j9.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}},()=>{N8.startSpan({operation:"entities_tick"},()=>this._world.entityManager.tickEntities(Z)),N8.startSpan({operation:"simulation_step"},()=>this._world.simulation.step(Z)),N8.startSpan({operation:"entities_emit_updates"},()=>this._world.entityManager.checkAndEmitUpdates()),N8.startSpan({operation:"network_synchronize"},()=>this._world.networkSynchronizer.synchronize())}),this._currentTick++,this.emitWithWorld(this._world,"WORLD_LOOP.TICK_END",{worldLoop:this,tickDurationMs:performance.now()-J})};_onTickError=(Z)=>{d.error(`WorldLoop._onTickError(): Error: ${Z}`),this.emitWithWorld(this._world,"WORLD_LOOP.TICK_ERROR",{worldLoop:this,error:Z})}}var pg;((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"})(pg||={});class eF extends j0{_id;_ambientLightColor;_ambientLightIntensity;_directionalLightColor;_directionalLightIntensity;_directionalLightPosition;_fogColor;_fogFar;_fogNear;_name;_skyboxIntensity;_skyboxUri;_audioManager;_blockTypeRegistry;_chatManager;_chunkLattice;_entityManager;_lightManager;_loop;_networkSynchronizer;_particleEmitterManager;_sceneUIManager;_simulation;_tag;constructor(Z){super();if(this._id=Z.id,this._ambientLightColor=Z.ambientLightColor??{r:255,g:255,b:255},this._ambientLightIntensity=Z.ambientLightIntensity??1,this._directionalLightColor=Z.directionalLightColor??{r:255,g:255,b:255},this._directionalLightIntensity=Z.directionalLightIntensity??3,this._directionalLightPosition=Z.directionalLightPosition??{x:100,y:150,z:100},this._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 zG(this),this._blockTypeRegistry=new hz(this),this._chatManager=new VH(this),this._chunkLattice=new qH(this),this._entityManager=new BH(this),this._lightManager=new nF(this),this._loop=new tF(this,Z.tickRate),this._networkSynchronizer=new PN(this),this._particleEmitterManager=new sF(this),this._sceneUIManager=new oF(this),this._simulation=new aF(this,Z.tickRate,Z.gravity),Z.map)this.loadMap(Z.map)}get id(){return this._id}get ambientLightColor(){return this._ambientLightColor}get ambientLightIntensity(){return this._ambientLightIntensity}get directionalLightColor(){return this._directionalLightColor}get directionalLightIntensity(){return this._directionalLightIntensity}get directionalLightPosition(){return this._directionalLightPosition}get fogColor(){return this._fogColor}get fogFar(){return this._fogFar}get fogNear(){return this._fogNear}get name(){return this._name}get skyboxIntensity(){return this._skyboxIntensity}get skyboxUri(){return this._skyboxUri}get audioManager(){return this._audioManager}get tag(){return this._tag}get blockTypeRegistry(){return this._blockTypeRegistry}get chatManager(){return this._chatManager}get chunkLattice(){return this._chunkLattice}get entityManager(){return this._entityManager}get lightManager(){return this._lightManager}get loop(){return this._loop}get networkSynchronizer(){return this._networkSynchronizer}get particleEmitterManager(){return this._particleEmitterManager}get sceneUIManager(){return this._sceneUIManager}get simulation(){return this._simulation}loadMap(Z){if(this.chunkLattice.clear(),Z.blockTypes)for(let J of Z.blockTypes)this.blockTypeRegistry.registerGenericBlockType({id:J.id,isLiquid:J.isLiquid,name:J.name,textureUri:J.textureUri});if(Z.blocks)for(let[J,X]of Object.entries(Z.blocks)){let[Y,$,Q]=J.split(",").map(Number);this.chunkLattice.setBlock({x:Y,y:$,z:Q},X)}if(Z.entities)for(let[J,X]of Object.entries(Z.entities)){let[Y,$,Q]=J.split(",").map(Number);new o8({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 k0.serializeWorld(this)}}var RK1;((J)=>J.WORLD_CREATED="WORLD_MANAGER.WORLD_CREATED")(RK1||={});class cY{static instance=new cY;_defaultWorld;_nextWorldId=1;_worlds=new Map;createWorld(Z){let J=new eF({...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 NK1;((Y)=>{Y.PLAYER_CONNECTED="PLAYER_MANAGER.PLAYER_CONNECTED";Y.PLAYER_DISCONNECTED="PLAYER_MANAGER.PLAYER_DISCONNECTED";Y.PLAYER_RECONNECTED="PLAYER_MANAGER.PLAYER_RECONNECTED"})(NK1||={});class j9{static instance=new j9;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 QK(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??cY.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 DK1;((X)=>{X.START="GAMESERVER.START";X.STOP="GAMESERVER.STOP"})(DK1||={});function _J6(Z){Q1.init().then(()=>{return oQ.instance.modelRegistry.preloadModels()}).then(()=>{if(Z.length>0)Z(oQ.instance.worldManager.getDefaultWorld());else Z();oQ.instance.start()}).catch((J)=>{d.fatalError(`Failed to initialize the game engine, exiting. Error: ${J}`)})}class oQ{static _instance;_modelRegistry=h5.instance;_playerManager=j9.instance;_socket=a7.instance;_worldManager=cY.instance;_webServer=mK.instance;constructor(){}static get instance(){if(!this._instance)this._instance=new oQ;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,z1=typeof Float32Array!=="undefined"?Float32Array:Array,jZ=Math.random;var TX5=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 i8={};_9(i8,{transpose:()=>gJ6,subtract:()=>CK1,sub:()=>XX6,str:()=>nJ6,set:()=>yJ6,scale:()=>lJ6,rotate:()=>cJ6,multiplyScalarAndAdd:()=>ZX6,multiplyScalar:()=>eJ6,multiply:()=>PK1,mul:()=>JX6,invert:()=>mJ6,identity:()=>fJ6,fromValues:()=>bJ6,fromScaling:()=>iJ6,fromRotation:()=>pJ6,frob:()=>aJ6,exactEquals:()=>rJ6,equals:()=>tJ6,determinant:()=>dJ6,create:()=>AJ6,copy:()=>hJ6,clone:()=>xJ6,adjoint:()=>uJ6,add:()=>oJ6,LDU:()=>sJ6});function AJ6(){var Z=new z1(4);if(z1!=Float32Array)Z[1]=0,Z[2]=0;return Z[0]=1,Z[3]=1,Z}function xJ6(Z){var J=new z1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function hJ6(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function fJ6(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=1,Z}function bJ6(Z,J,X,Y){var $=new z1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function yJ6(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function gJ6(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 mJ6(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 uJ6(Z,J){var X=J[0];return Z[0]=J[3],Z[1]=-J[1],Z[2]=-J[2],Z[3]=X,Z}function dJ6(Z){return Z[0]*Z[3]-Z[2]*Z[1]}function PK1(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 cJ6(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 lJ6(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 pJ6(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 iJ6(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=J[1],Z}function nJ6(Z){return"mat2("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}function aJ6(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3])}function sJ6(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 oJ6(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 CK1(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 rJ6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function tJ6(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 eJ6(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 ZX6(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 JX6=PK1,XX6=CK1;var e1={};_9(e1,{transpose:()=>zX6,translate:()=>FX6,subtract:()=>kK1,sub:()=>SX6,str:()=>DX6,set:()=>KX6,scale:()=>wX6,rotate:()=>UX6,projection:()=>NX6,normalFromMat4:()=>RX6,multiplyScalarAndAdd:()=>kX6,multiplyScalar:()=>TX6,multiply:()=>TK1,mul:()=>vX6,invert:()=>HX6,identity:()=>GX6,fromValues:()=>WX6,fromTranslation:()=>BX6,fromScaling:()=>jX6,fromRotation:()=>LX6,fromQuat:()=>MX6,fromMat4:()=>YX6,fromMat2d:()=>OX6,frob:()=>PX6,exactEquals:()=>EX6,equals:()=>IX6,determinant:()=>qX6,create:()=>ig,copy:()=>QX6,clone:()=>$X6,adjoint:()=>VX6,add:()=>CX6});function ig(){var Z=new z1(9);if(z1!=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 YX6(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 $X6(Z){var J=new z1(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 QX6(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 WX6(Z,J,X,Y,$,Q,W,K,G){var z=new z1(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 KX6(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 GX6(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 zX6(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 HX6(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 VX6(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 qX6(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 TK1(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],j=X[5],N=X[6],R=X[7],O=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+j*z,Z[4]=B*$+w*K+j*H,Z[5]=B*Q+w*G+j*V,Z[6]=N*Y+R*W+O*z,Z[7]=N*$+R*K+O*H,Z[8]=N*Q+R*G+O*V,Z}function FX6(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 UX6(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 wX6(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 BX6(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 LX6(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 jX6(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 OX6(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 MX6(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,j=Q*G;return Z[0]=1-V-U,Z[3]=H-j,Z[6]=q+w,Z[1]=H+j,Z[4]=1-z-U,Z[7]=F-B,Z[2]=q-w,Z[5]=F+B,Z[8]=1-z-V,Z}function RX6(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],j=J[15],N=X*K-Y*W,R=X*G-$*W,O=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,A=H*j-F*U,v=V*w-q*B,x=V*j-F*B,I=q*j-F*w,S=N*I-R*x+O*v+P*A-D*k+C*T;if(!S)return null;return S=1/S,Z[0]=(K*I-G*x+z*v)*S,Z[1]=(G*A-W*I-z*k)*S,Z[2]=(W*x-K*A+z*T)*S,Z[3]=($*x-Y*I-Q*v)*S,Z[4]=(X*I-$*A+Q*k)*S,Z[5]=(Y*A-X*x-Q*T)*S,Z[6]=(B*C-w*D+j*P)*S,Z[7]=(w*O-U*C-j*R)*S,Z[8]=(U*D-B*O+j*N)*S,Z}function NX6(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 DX6(Z){return"mat3("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+")"}function PX6(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8])}function CX6(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 kK1(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 TX6(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 kX6(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 EX6(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 IX6(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],j=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-j)<=v0*Math.max(1,Math.abs(G),Math.abs(j))&&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 vX6=TK1,SX6=kK1;var r0={};_9(r0,{transpose:()=>bX6,translate:()=>uX6,targetTo:()=>qY6,subtract:()=>xK1,sub:()=>RY6,str:()=>FY6,set:()=>fX6,scale:()=>dX6,rotateZ:()=>iX6,rotateY:()=>pX6,rotateX:()=>lX6,rotate:()=>cX6,perspectiveZO:()=>KY6,perspectiveNO:()=>_K1,perspectiveFromFieldOfView:()=>GY6,perspective:()=>WY6,orthoZO:()=>HY6,orthoNO:()=>AK1,ortho:()=>zY6,multiplyScalarAndAdd:()=>LY6,multiplyScalar:()=>BY6,multiply:()=>IK1,mul:()=>MY6,lookAt:()=>VY6,invert:()=>yX6,identity:()=>EK1,getTranslation:()=>ZY6,getScaling:()=>SK1,getRotation:()=>JY6,frustum:()=>QY6,fromZRotation:()=>tX6,fromYRotation:()=>rX6,fromXRotation:()=>oX6,fromValues:()=>hX6,fromTranslation:()=>nX6,fromScaling:()=>aX6,fromRotationTranslationScaleOrigin:()=>YY6,fromRotationTranslationScale:()=>XY6,fromRotationTranslation:()=>vK1,fromRotation:()=>sX6,fromQuat2:()=>eX6,fromQuat:()=>$Y6,frob:()=>UY6,exactEquals:()=>jY6,equals:()=>OY6,determinant:()=>mX6,create:()=>_X6,copy:()=>xX6,clone:()=>AX6,adjoint:()=>gX6,add:()=>wY6});function _X6(){var Z=new z1(16);if(z1!=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 AX6(Z){var J=new z1(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 xX6(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 hX6(Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B){var w=new z1(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 fX6(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 EK1(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 bX6(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 yX6(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],j=J[15],N=X*K-Y*W,R=X*G-$*W,O=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,A=H*j-F*U,v=V*w-q*B,x=V*j-F*B,I=q*j-F*w,S=N*I-R*x+O*v+P*A-D*k+C*T;if(!S)return null;return S=1/S,Z[0]=(K*I-G*x+z*v)*S,Z[1]=($*x-Y*I-Q*v)*S,Z[2]=(B*C-w*D+j*P)*S,Z[3]=(q*D-V*C-F*P)*S,Z[4]=(G*A-W*I-z*k)*S,Z[5]=(X*I-$*A+Q*k)*S,Z[6]=(w*O-U*C-j*R)*S,Z[7]=(H*C-q*O+F*R)*S,Z[8]=(W*x-K*A+z*T)*S,Z[9]=(Y*A-X*x-Q*T)*S,Z[10]=(U*D-B*O+j*N)*S,Z[11]=(V*O-H*D-F*N)*S,Z[12]=(K*k-W*v-G*T)*S,Z[13]=(X*v-Y*k+$*T)*S,Z[14]=(B*R-U*P-w*N)*S,Z[15]=(H*P-V*R+q*N)*S,Z}function gX6(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],j=J[15];return Z[0]=K*(q*j-F*w)-V*(G*j-z*w)+B*(G*F-z*q),Z[1]=-(Y*(q*j-F*w)-V*($*j-Q*w)+B*($*F-Q*q)),Z[2]=Y*(G*j-z*w)-K*($*j-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*j-F*w)-H*(G*j-z*w)+U*(G*F-z*q)),Z[5]=X*(q*j-F*w)-H*($*j-Q*w)+U*($*F-Q*q),Z[6]=-(X*(G*j-z*w)-W*($*j-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*j-F*B)-H*(K*j-z*B)+U*(K*F-z*V),Z[9]=-(X*(V*j-F*B)-H*(Y*j-Q*B)+U*(Y*F-Q*V)),Z[10]=X*(K*j-z*B)-W*(Y*j-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 mX6(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],j=J*W-X*Q,N=J*K-Y*Q,R=J*G-$*Q,O=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,A=H*B-V*U,v=H*w-q*U,x=V*w-q*B;return j*x-N*v+R*A+O*k-P*T+D*C}function IK1(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],j=J[14],N=J[15],R=X[0],O=X[1],P=X[2],D=X[3];return Z[0]=R*Y+O*K+P*V+D*B,Z[1]=R*$+O*G+P*q+D*w,Z[2]=R*Q+O*z+P*F+D*j,Z[3]=R*W+O*H+P*U+D*N,R=X[4],O=X[5],P=X[6],D=X[7],Z[4]=R*Y+O*K+P*V+D*B,Z[5]=R*$+O*G+P*q+D*w,Z[6]=R*Q+O*z+P*F+D*j,Z[7]=R*W+O*H+P*U+D*N,R=X[8],O=X[9],P=X[10],D=X[11],Z[8]=R*Y+O*K+P*V+D*B,Z[9]=R*$+O*G+P*q+D*w,Z[10]=R*Q+O*z+P*F+D*j,Z[11]=R*W+O*H+P*U+D*N,R=X[12],O=X[13],P=X[14],D=X[15],Z[12]=R*Y+O*K+P*V+D*B,Z[13]=R*$+O*G+P*q+D*w,Z[14]=R*Q+O*z+P*F+D*j,Z[15]=R*W+O*H+P*U+D*N,Z}function uX6(Z,J,X){var Y=X[0],$=X[1],Q=X[2],W,K,G,z,H,V,q,F,U,B,w,j;if(J===Z)Z[12]=J[0]*Y+J[4]*$+J[8]*Q+J[12],Z[13]=J[1]*Y+J[5]*$+J[9]*Q+J[13],Z[14]=J[2]*Y+J[6]*$+J[10]*Q+J[14],Z[15]=J[3]*Y+J[7]*$+J[11]*Q+J[15];else 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],j=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]=j,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*$+j*Q+J[15];return Z}function dX6(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 cX6(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,j,N,R,O,P,D,C,T,k,A,v,x,I,S,y;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],j=J[6],N=J[7],R=J[8],O=J[9],P=J[10],D=J[11],C=$*$*H+z,T=Q*$*H+W*G,k=W*$*H-Q*G,A=$*Q*H-W*G,v=Q*Q*H+z,x=W*Q*H+$*G,I=$*W*H+Q*G,S=Q*W*H-$*G,y=W*W*H+z,Z[0]=V*C+B*T+R*k,Z[1]=q*C+w*T+O*k,Z[2]=F*C+j*T+P*k,Z[3]=U*C+N*T+D*k,Z[4]=V*A+B*v+R*x,Z[5]=q*A+w*v+O*x,Z[6]=F*A+j*v+P*x,Z[7]=U*A+N*v+D*x,Z[8]=V*I+B*S+R*y,Z[9]=q*I+w*S+O*y,Z[10]=F*I+j*S+P*y,Z[11]=U*I+N*S+D*y,J!==Z)Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15];return Z}function lX6(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 pX6(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 iX6(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 nX6(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 aX6(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 sX6(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 oX6(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 rX6(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 tX6(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 vK1(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,j=W*G,N=W*z;return Z[0]=1-(F+B),Z[1]=V+N,Z[2]=q-j,Z[3]=0,Z[4]=V-N,Z[5]=1-(H+B),Z[6]=U+w,Z[7]=0,Z[8]=q+j,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 eX6(Z,J){var X=new z1(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 vK1(Z,J,X),Z}function ZY6(Z,J){return Z[0]=J[12],Z[1]=J[13],Z[2]=J[14],Z}function SK1(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 JY6(Z,J){var X=new z1(3);SK1(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 XY6(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,j=K*G,N=K*z,R=K*H,O=Y[0],P=Y[1],D=Y[2];return Z[0]=(1-(U+w))*O,Z[1]=(q+R)*O,Z[2]=(F-N)*O,Z[3]=0,Z[4]=(q-R)*P,Z[5]=(1-(V+w))*P,Z[6]=(B+j)*P,Z[7]=0,Z[8]=(F+N)*D,Z[9]=(B-j)*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 YY6(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,j=K*V,N=G*z,R=G*H,O=G*V,P=Y[0],D=Y[1],C=Y[2],T=$[0],k=$[1],A=$[2],v=(1-(B+j))*P,x=(F+O)*P,I=(U-R)*P,S=(F-O)*D,y=(1-(q+j))*D,m=(w+N)*D,i=(U+R)*C,t=(w-N)*C,Z0=(1-(q+B))*C;return Z[0]=v,Z[1]=x,Z[2]=I,Z[3]=0,Z[4]=S,Z[5]=y,Z[6]=m,Z[7]=0,Z[8]=i,Z[9]=t,Z[10]=Z0,Z[11]=0,Z[12]=X[0]+T-(v*T+S*k+i*A),Z[13]=X[1]+k-(x*T+y*k+t*A),Z[14]=X[2]+A-(I*T+m*k+Z0*A),Z[15]=1,Z}function $Y6(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,j=Q*G;return Z[0]=1-V-U,Z[1]=H+j,Z[2]=q-w,Z[3]=0,Z[4]=H-j,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 QY6(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 _K1(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 WY6=_K1;function KY6(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 GY6(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 AK1(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 zY6=AK1;function HY6(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 VY6(Z,J,X,Y){var $,Q,W,K,G,z,H,V,q,F,U=J[0],B=J[1],w=J[2],j=Y[0],N=Y[1],R=Y[2],O=X[0],P=X[1],D=X[2];if(Math.abs(U-O)<v0&&Math.abs(B-P)<v0&&Math.abs(w-D)<v0)return EK1(Z);if(H=U-O,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-j*q,W=j*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 qY6(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 FY6(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 UY6(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 wY6(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 xK1(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 BY6(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 LY6(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 jY6(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 OY6(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],j=Z[15],N=J[0],R=J[1],O=J[2],P=J[3],D=J[4],C=J[5],T=J[6],k=J[7],A=J[8],v=J[9],x=J[10],I=J[11],S=J[12],y=J[13],m=J[14],i=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($-O)<=v0*Math.max(1,Math.abs($),Math.abs(O))&&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-A)<=v0*Math.max(1,Math.abs(H),Math.abs(A))&&Math.abs(V-v)<=v0*Math.max(1,Math.abs(V),Math.abs(v))&&Math.abs(q-x)<=v0*Math.max(1,Math.abs(q),Math.abs(x))&&Math.abs(F-I)<=v0*Math.max(1,Math.abs(F),Math.abs(I))&&Math.abs(U-S)<=v0*Math.max(1,Math.abs(U),Math.abs(S))&&Math.abs(B-y)<=v0*Math.max(1,Math.abs(B),Math.abs(y))&&Math.abs(w-m)<=v0*Math.max(1,Math.abs(w),Math.abs(m))&&Math.abs(j-i)<=v0*Math.max(1,Math.abs(j),Math.abs(i))}var MY6=IK1,RY6=xK1;var C1={};_9(C1,{str:()=>L$6,squaredLength:()=>z31,sqrLen:()=>T$6,sqlerp:()=>v$6,slerp:()=>EN,setAxisAngle:()=>J31,setAxes:()=>S$6,set:()=>R$6,scale:()=>W31,rotationTo:()=>I$6,rotateZ:()=>H$6,rotateY:()=>z$6,rotateX:()=>G$6,random:()=>F$6,pow:()=>q$6,normalize:()=>og,multiply:()=>X31,mul:()=>D$6,ln:()=>$31,lerp:()=>P$6,length:()=>G31,len:()=>C$6,invert:()=>U$6,identity:()=>Q$6,getAxisAngle:()=>W$6,getAngle:()=>K$6,fromValues:()=>O$6,fromMat3:()=>Q31,fromEuler:()=>B$6,exp:()=>Y31,exactEquals:()=>k$6,equals:()=>E$6,dot:()=>K31,create:()=>sg,copy:()=>M$6,conjugate:()=>w$6,clone:()=>j$6,calculateW:()=>V$6,add:()=>N$6});var J1={};_9(J1,{zero:()=>iY6,transformQuat:()=>uY6,transformMat4:()=>gY6,transformMat3:()=>mY6,subtract:()=>fK1,sub:()=>oY6,str:()=>nY6,squaredLength:()=>uK1,squaredDistance:()=>mK1,sqrLen:()=>J$6,sqrDist:()=>Z$6,set:()=>PY6,scaleAndAdd:()=>_Y6,scale:()=>SY6,round:()=>vY6,rotateZ:()=>lY6,rotateY:()=>cY6,rotateX:()=>dY6,random:()=>yY6,normalize:()=>ng,negate:()=>AY6,multiply:()=>bK1,mul:()=>rY6,min:()=>EY6,max:()=>IY6,lerp:()=>hY6,length:()=>hK1,len:()=>ag,inverse:()=>xY6,hermite:()=>fY6,fromValues:()=>TN,forEach:()=>X$6,floor:()=>kY6,exactEquals:()=>aY6,equals:()=>sY6,dot:()=>kN,divide:()=>yK1,div:()=>tY6,distance:()=>gK1,dist:()=>eY6,cross:()=>ZU,create:()=>CN,copy:()=>DY6,clone:()=>NY6,ceil:()=>TY6,bezier:()=>bY6,angle:()=>pY6,add:()=>CY6});function CN(){var Z=new z1(3);if(z1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function NY6(Z){var J=new z1(3);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J}function hK1(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function TN(Z,J,X){var Y=new z1(3);return Y[0]=Z,Y[1]=J,Y[2]=X,Y}function DY6(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z}function PY6(Z,J,X,Y){return Z[0]=J,Z[1]=X,Z[2]=Y,Z}function CY6(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z}function fK1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z}function bK1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z}function yK1(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z[2]=J[2]/X[2],Z}function TY6(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z[2]=Math.ceil(J[2]),Z}function kY6(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z[2]=Math.floor(J[2]),Z}function EY6(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 IY6(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 vY6(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z[2]=Math.round(J[2]),Z}function SY6(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z}function _Y6(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 gK1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return Math.hypot(X,Y,$)}function mK1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return X*X+Y*Y+$*$}function uK1(Z){var J=Z[0],X=Z[1],Y=Z[2];return J*J+X*X+Y*Y}function AY6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z}function xY6(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z[2]=1/J[2],Z}function ng(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 kN(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]}function ZU(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 hY6(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 fY6(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 bY6(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 yY6(Z,J){J=J||1;var X=jZ()*2*Math.PI,Y=jZ()*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 gY6(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 mY6(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 uY6(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 dY6(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 cY6(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 lY6(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 pY6(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&&kN(Z,J)/H;return Math.acos(Math.min(Math.max(V,-1),1))}function iY6(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z}function nY6(Z){return"vec3("+Z[0]+", "+Z[1]+", "+Z[2]+")"}function aY6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]}function sY6(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 oY6=fK1,rY6=bK1,tY6=yK1,eY6=gK1,Z$6=mK1,ag=hK1,J$6=uK1,X$6=function(){var Z=CN();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 Y$6(){var Z=new z1(4);if(z1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function dK1(Z){var J=new z1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function cK1(Z,J,X,Y){var $=new z1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function lK1(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function pK1(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function iK1(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 nK1(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 aK1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return Math.hypot(J,X,Y,$)}function sK1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return J*J+X*X+Y*Y+$*$}function oK1(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 rK1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}function tK1(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 eK1(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function Z31(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 kX5=function(){var Z=Y$6();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 sg(){var Z=new z1(4);if(z1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z[3]=1,Z}function Q$6(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=1,Z}function J31(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 W$6(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 K$6(Z,J){var X=K31(Z,J);return Math.acos(2*X*X-1)}function X31(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 G$6(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 z$6(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 H$6(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 V$6(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 Y31(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 $31(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 q$6(Z,J,X){return $31(Z,J),W31(Z,Z,X),Y31(Z,Z),Z}function EN(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 F$6(Z){var J=jZ(),X=jZ(),Y=jZ(),$=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 U$6(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 w$6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z[3]=J[3],Z}function Q31(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 B$6(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 L$6(Z){return"quat("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}var j$6=dK1,O$6=cK1,M$6=lK1,R$6=pK1,N$6=iK1,D$6=X31,W31=nK1,K31=rK1,P$6=tK1,G31=aK1,C$6=G31,z31=sK1,T$6=z31,og=oK1,k$6=eK1,E$6=Z31,I$6=function(){var Z=CN(),J=TN(1,0,0),X=TN(0,1,0);return function(Y,$,Q){var W=kN($,Q);if(W<-0.999999){if(ZU(Z,J,$),ag(Z)<0.000001)ZU(Z,X,$);return ng(Z,Z),J31(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 ZU(Z,$,Q),Y[0]=Z[0],Y[1]=Z[1],Y[2]=Z[2],Y[3]=1+W,og(Y,Y)}}(),v$6=function(){var Z=sg(),J=sg();return function(X,Y,$,Q,W,K){return EN(Z,Y,W,K),EN(J,$,Q,K),EN(X,Z,J,2*K*(1-K)),X}}(),S$6=function(){var Z=ig();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],og(J,Q31(J,Z))}}();var q1={};_9(q1,{zero:()=>YQ6,transformMat4:()=>ZQ6,transformMat3:()=>e$6,transformMat2d:()=>t$6,transformMat2:()=>r$6,subtract:()=>V31,sub:()=>GQ6,str:()=>$Q6,squaredLength:()=>L31,squaredDistance:()=>w31,sqrLen:()=>FQ6,sqrDist:()=>qQ6,set:()=>h$6,scaleAndAdd:()=>c$6,scale:()=>d$6,round:()=>u$6,rotate:()=>JQ6,random:()=>o$6,normalize:()=>i$6,negate:()=>l$6,multiply:()=>q31,mul:()=>zQ6,min:()=>g$6,max:()=>m$6,lerp:()=>s$6,length:()=>B31,len:()=>KQ6,inverse:()=>p$6,fromValues:()=>A$6,forEach:()=>UQ6,floor:()=>y$6,exactEquals:()=>QQ6,equals:()=>WQ6,dot:()=>n$6,divide:()=>F31,div:()=>HQ6,distance:()=>U31,dist:()=>VQ6,cross:()=>a$6,create:()=>H31,copy:()=>x$6,clone:()=>_$6,ceil:()=>b$6,angle:()=>XQ6,add:()=>f$6});function H31(){var Z=new z1(2);if(z1!=Float32Array)Z[0]=0,Z[1]=0;return Z}function _$6(Z){var J=new z1(2);return J[0]=Z[0],J[1]=Z[1],J}function A$6(Z,J){var X=new z1(2);return X[0]=Z,X[1]=J,X}function x$6(Z,J){return Z[0]=J[0],Z[1]=J[1],Z}function h$6(Z,J,X){return Z[0]=J,Z[1]=X,Z}function f$6(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z}function V31(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z}function q31(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z}function F31(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z}function b$6(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z}function y$6(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z}function g$6(Z,J,X){return Z[0]=Math.min(J[0],X[0]),Z[1]=Math.min(J[1],X[1]),Z}function m$6(Z,J,X){return Z[0]=Math.max(J[0],X[0]),Z[1]=Math.max(J[1],X[1]),Z}function u$6(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z}function d$6(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z}function c$6(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z}function U31(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return Math.hypot(X,Y)}function w31(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return X*X+Y*Y}function B31(Z){var J=Z[0],X=Z[1];return Math.hypot(J,X)}function L31(Z){var J=Z[0],X=Z[1];return J*J+X*X}function l$6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z}function p$6(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z}function i$6(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 n$6(Z,J){return Z[0]*J[0]+Z[1]*J[1]}function a$6(Z,J,X){var Y=J[0]*X[1]-J[1]*X[0];return Z[0]=Z[1]=0,Z[2]=Y,Z}function s$6(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 o$6(Z,J){J=J||1;var X=jZ()*2*Math.PI;return Z[0]=Math.cos(X)*J,Z[1]=Math.sin(X)*J,Z}function r$6(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 t$6(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 e$6(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 ZQ6(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 JQ6(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 XQ6(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 YQ6(Z){return Z[0]=0,Z[1]=0,Z}function $Q6(Z){return"vec2("+Z[0]+", "+Z[1]+")"}function QQ6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]}function WQ6(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 KQ6=B31,GQ6=V31,zQ6=q31,HQ6=F31,VQ6=U31,qQ6=w31,FQ6=L31,UQ6=function(){var Z=H31();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 tQ extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get determinant(){return i8.determinant(this)}get frobeniusNorm(){return i8.frob(this)}static create(){let Z=new tQ(0,0,0,0);return i8.identity(Z),Z}static fromRotation(Z){let J=tQ.create();return i8.fromRotation(J,Z),J}static fromScaling(Z){let J=tQ.create();return i8.fromScaling(J,Z),J}add(Z){return i8.add(this,this,Z),this}adjoint(){return i8.adjoint(this,this),this}clone(){return new tQ(this[0],this[1],this[2],this[3])}copy(Z){return i8.copy(this,Z),this}equals(Z){return i8.equals(this,Z)}exactEquals(Z){return i8.exactEquals(this,Z)}identity(){return i8.identity(this),this}invert(){return i8.invert(this,this),this}multiply(Z){return i8.mul(this,this,Z),this}multiplyScalar(Z){return i8.multiplyScalar(this,this,Z),this}rotate(Z){return i8.rotate(this,this,Z),this}subtract(Z){return i8.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]}][${this[2]},${this[3]}]`}transpose(){return i8.transpose(this,this),this}}class OZ extends Float32Array{constructor(Z,J,X,Y,$,Q,W,K,G){super([Z,J,X,Y,$,Q,W,K,G])}get determinant(){return e1.determinant(this)}get frobeniusNorm(){return e1.frob(this)}static create(){let Z=new OZ(0,0,0,0,0,0,0,0,0);return e1.identity(Z),Z}static fromMatrix4(Z){let J=OZ.create();return e1.fromMat4(J,Z),J}static fromQuaternion(Z){let J=OZ.create();return e1.fromQuat(J,Z),J}static fromRotation(Z){let J=OZ.create();return e1.fromRotation(J,Z),J}static fromScaling(Z){let J=OZ.create();return e1.fromScaling(J,Z),J}static fromTranslation(Z){let J=OZ.create();return e1.fromTranslation(J,Z),J}add(Z){return e1.add(this,this,Z),this}adjoint(){return e1.adjoint(this,this),this}clone(){return new OZ(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8])}copy(Z){return e1.copy(this,Z),this}equals(Z){return e1.equals(this,Z)}exactEquals(Z){return e1.exactEquals(this,Z)}identity(){return e1.identity(this),this}invert(){return e1.invert(this,this),this}multiply(Z){return e1.mul(this,this,Z),this}multiplyScalar(Z){return e1.multiplyScalar(this,this,Z),this}transformVector(Z){return Z.transformMatrix3(this)}projection(Z,J){return e1.projection(this,Z,J),this}rotate(Z){return e1.rotate(this,this,Z),this}subtract(Z){return e1.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 e1.transpose(this,this),this}}class k5 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 r0.determinant(this)}get frobeniusNorm(){return r0.frob(this)}static create(){let Z=new k5(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return r0.identity(Z),Z}static fromQuaternion(Z){let J=k5.create();return r0.fromQuat(J,Z),J}static fromRotation(Z,J){let X=k5.create();return r0.fromRotation(X,Z,J),X}static fromRotationTranslation(Z,J){let X=k5.create();return r0.fromRotationTranslation(X,Z,J),X}static fromRotationTranslationScale(Z,J,X){let Y=k5.create();return r0.fromRotationTranslationScale(Y,Z,J,X),Y}static fromRotationTranslationScaleOrigin(Z,J,X,Y){let $=k5.create();return r0.fromRotationTranslationScaleOrigin($,Z,J,X,Y),$}static fromScaling(Z){let J=k5.create();return r0.fromScaling(J,Z),J}static fromTranslation(Z){let J=k5.create();return r0.fromTranslation(J,Z),J}static fromXRotation(Z){let J=k5.create();return r0.fromXRotation(J,Z),J}static fromYRotation(Z){let J=k5.create();return r0.fromYRotation(J,Z),J}static fromZRotation(Z){let J=k5.create();return r0.fromZRotation(J,Z),J}add(Z){return r0.add(this,this,Z),this}adjoint(){return r0.adjoint(this,this),this}clone(){return new k5(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 r0.copy(this,Z),this}equals(Z){return r0.equals(this,Z)}exactEquals(Z){return r0.exactEquals(this,Z)}frustrum(Z,J,X,Y,$,Q){return r0.frustum(this,Z,J,X,Y,$,Q),this}identity(){return r0.identity(this),this}invert(){return r0.invert(this,this),this}lookAt(Z,J,X){return r0.lookAt(this,Z,J,X),this}multiply(Z){return r0.mul(this,this,Z),this}multiplyScalar(Z){return r0.multiplyScalar(this,this,Z),this}orthographic(Z,J,X,Y,$,Q){return r0.ortho(this,Z,J,X,Y,$,Q),this}perspective(Z,J,X,Y){return r0.perspective(this,Z,J,X,Y),this}rotate(Z,J){return r0.rotate(this,this,Z,J),this}rotateX(Z){return r0.rotateX(this,this,Z),this}rotateY(Z){return r0.rotateY(this,this,Z),this}rotateZ(Z){return r0.rotateZ(this,this,Z),this}scale(Z){return r0.scale(this,this,Z),this}subtract(Z){return r0.sub(this,this,Z),this}targetTo(Z,J,X){return r0.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 r0.translate(this,this,Z),this}transpose(){return r0.transpose(this,this),this}}class QG extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get length(){return C1.length(this)}get squaredLength(){return C1.squaredLength(this)}get magnitude(){return C1.length(this)}get squaredMagnitude(){return C1.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=C1.fromEuler(new Float32Array(4),Z,J,X);return new QG(Y[0],Y[1],Y[2],Y[3])}static fromQuaternionLike(Z){return new QG(Z.x,Z.y,Z.z,Z.w)}clone(){return new QG(this.x,this.y,this.z,this.w)}conjugate(){return C1.conjugate(this,this),this}copy(Z){return C1.copy(this,Z),this}dot(Z){return C1.dot(this,Z)}exponential(){return C1.exp(this,this),this}equals(Z){return C1.equals(this,Z)}exactEquals(Z){return C1.exactEquals(this,Z)}getAngle(Z){return C1.getAngle(this,Z)}identity(){return C1.identity(this),this}invert(){return C1.invert(this,this),this}lerp(Z,J){return C1.lerp(this,this,Z,J),this}logarithm(){return C1.ln(this,this),this}multiply(Z){return C1.multiply(this,this,Z),this}transformVector(Z){return Z.transformQuaternion(this)}normalize(){return C1.normalize(this,this),this}power(Z){return C1.pow(this,this,Z),this}randomize(){return C1.random(this),this}rotateX(Z){return C1.rotateX(this,this,Z),this}rotateY(Z){return C1.rotateY(this,this,Z),this}rotateZ(Z){return C1.rotateZ(this,this,Z),this}scale(Z){return C1.scale(this,this,Z),this}setAxisAngle(Z,J){return C1.setAxisAngle(this,Z,J),this}slerp(Z,J){return C1.slerp(this,this,Z,J),this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}}class JU extends Float32Array{constructor(Z,J){super([Z,J])}get length(){return q1.length(this)}get squaredLength(){return q1.squaredLength(this)}get magnitude(){return q1.length(this)}get squaredMagnitude(){return q1.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 JU(0,0)}add(Z){return q1.add(this,this,Z),this}angle(Z){return q1.angle(this,Z)}ceil(){return q1.ceil(this,this),this}clone(){return new JU(this.x,this.y)}copy(Z){return q1.copy(this,Z),this}distance(Z){return q1.distance(this,Z)}divide(Z){return q1.divide(this,this,Z),this}dot(Z){return q1.dot(this,Z)}equals(Z){return q1.equals(this,Z)}exactEquals(Z){return q1.exactEquals(this,Z)}floor(){return q1.floor(this,this),this}invert(){return q1.inverse(this,this),this}lerp(Z,J){return q1.lerp(this,this,Z,J),this}max(Z){return q1.max(this,this,Z),this}min(Z){return q1.min(this,this,Z),this}multiply(Z){return q1.mul(this,this,Z),this}negate(){return q1.negate(this,this),this}normalize(){return q1.normalize(this,this),this}randomize(Z){return q1.random(this,Z),this}rotate(Z,J){return q1.rotate(this,this,Z,J),this}round(){return q1.round(this,this),this}scale(Z){return q1.scale(this,this,Z),this}scaleAndAdd(Z,J){return q1.scaleAndAdd(this,this,Z,J),this}subtract(Z){return q1.sub(this,this,Z),this}toString(){return`${this.x},${this.y}`}transformMatrix2(Z){return q1.transformMat2(this,this,Z),this}transformMatrix3(Z){return q1.transformMat3(this,this,Z),this}transformMatrix4(Z){return q1.transformMat4(this,this,Z),this}zero(){return q1.zero(this),this}}class WG 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 WG(0,0,0)}static fromVector3Like(Z){return new WG(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 WG(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 T1=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())})},D1=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}}},X9=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},T4=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))},j31=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.")},xX5=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 T1(this,void 0,void 0,function(){return D1(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 T1(this,void 0,void 0,function(){return D1(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 T1(this,void 0,void 0,function(){return D1(this,function(Y){return[2,J-X]})})},Z.maxComparatorNumber=function(J,X){return T1(this,void 0,void 0,function(){return D1(this,function(Y){return[2,X-J]})})},Z.defaultIsEqual=function(J,X){return T1(this,void 0,void 0,function(){return D1(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 T1(this,void 0,void 0,function(){var Y;return D1(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 T1(this,void 0,void 0,function(){var $;return D1(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 T1(this,void 0,void 0,function(){var $;return D1(this,function(Q){switch(Q.label){case 0:return $=new Z(Y),$.heapArray=T4([],X9(X),!1),[4,$.init()];case 1:return Q.sent(),[2,$.top(J)]}})})},Z.nsmallest=function(J,X,Y){return T1(this,void 0,void 0,function(){var $;return D1(this,function(Q){switch(Q.label){case 0:return $=new Z(Y),$.heapArray=T4([],X9(X),!1),[4,$.init()];case 1:return Q.sent(),[2,$.bottom(J)]}})})},Z.prototype.add=function(J){return T1(this,void 0,void 0,function(){return D1(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 T1(this,void 0,void 0,function(){var X,Y,$;return D1(this,function(Q){switch(Q.label){case 0:X=this.length,($=this.heapArray).push.apply($,T4([],X9(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 T1(this,arguments,void 0,function(J){if(J===void 0)J=1;return D1(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,T4([],X9(this.heapArray),!1)];else return[2,this._bottomN_push(~~J)]})})},Z.prototype.check=function(){return T1(this,void 0,void 0,function(){var J,X,Y,$,Q,W,K,G,z;return D1(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,j31(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 T1(this,arguments,void 0,function(X,Y){var $,Q,W,K,G,z;if(Y===void 0)Y=Z.defaultIsEqual;return D1(this,function(H){switch(H.label){case 0:H.trys.push([0,5,6,7]),$=j31(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 T1(this,void 0,void 0,function(){var X;return D1(this,function(Y){switch(Y.label){case 0:if(J)this.heapArray=T4([],X9(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 T1(this,void 0,void 0,function(){var J;return D1(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 T1(this,void 0,void 0,function(){return D1(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 T1(this,void 0,void 0,function(){var X;return D1(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=X9([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 T1(this,arguments,void 0,function(X,Y){var $,Q,W,K=this;if(Y===void 0)Y=Z.defaultIsEqual;return D1(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($,T4([],X9(W),!1)),G.label=12;case 12:return[3,3];case 13:return[2,!1]}})})},Z.prototype.replace=function(J){return T1(this,void 0,void 0,function(){var X;return D1(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 T1(this,arguments,void 0,function(J){if(J===void 0)J=1;return D1(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,T4([],X9(this.heapArray),!1)];else return[2,this._topN_push(~~J)]})})},Z.prototype.toArray=function(){return T4([],X9(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 D1(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 T1(this,void 0,void 0,function(){var X,Y,$,Q,K,W,K;return D1(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=X9([this.heapArray[X],this.heapArray[J]],2),this.heapArray[J]=Y[0],this.heapArray[X]=Y[1]},Z.prototype._sortNodeDown=function(J){return T1(this,void 0,void 0,function(){var X,Y,$,Q,W,K;return D1(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 T1(this,void 0,void 0,function(){var X;return D1(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 T1(this,void 0,void 0,function(){var X,Y,$,Q;return D1(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,T4([],X9(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,T4([],X9(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 T1(this,void 0,void 0,function(){var X,Y,$,Q,W,W;return D1(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,T4([],X9(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,T4([],X9(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 T1(this,void 0,void 0,function(){var X,Y,$,Q,W;return D1(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 T1(this,void 0,void 0,function(){var X,Y,$,Q;return D1(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 T1(this,void 0,void 0,function(){var Y;return D1(this,function($){switch($.label){case 0:return Y=new Z(this.compare),[4,Y.init(J)];case 1:return $.sent(),[2,Y.peek()]}})})},Z}(),wQ6=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}}},v6=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},E5=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 O31=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=E5([],v6(X),!1),$.init(),$.top(J)},Z.nsmallest=function(J,X,Y){var $=new Z(Y);return $.heapArray=E5([],v6(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,E5([],v6(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 E5([],v6(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=E5([],v6(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,E5([],v6(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,E5([],v6(Z.getChildrenIndexOf(Q)),!1));else if(this.compare(W,J)<=0)Y.push.apply(Y,E5([],v6(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=v6([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($,E5([],v6(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 E5([],v6(this.heapArray),!1);else return this._topN_push(~~J)},Z.prototype.toArray=function(){return E5([],v6(this.heapArray),!1)},Z.prototype.toString=function(){return this.heapArray.toString()},Z.prototype.get=function(J){return this.heapArray[J]},Z.prototype.getChildrenOf=function(J){var 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 wQ6(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=v6([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,E5([],v6(Z.getChildrenIndexOf(Q)),!1));else if(this.compare($[Q],X.peek())<0)X.replace($[Q]),Y.push.apply(Y,E5([],v6(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,E5([],v6(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,E5([],v6(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 M31=0.099856;class XU extends pY{faceSpeed=0;idleLoopedAnimations=[];idleLoopedAnimationsSpeed;jumpOneshotAnimations=[];moveLoopedAnimations=[];moveLoopedAnimationsSpeed;moveSpeed=0;_faceTarget;_jumpHeight=0;_moveCompletesWhenStuck=!1;_moveIgnoreAxes={};_moveStartMoveAnimations=!1;_moveStartIdleAnimationsOnCompletion=!0;_moveStoppingDistanceSquared=M31;_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:M31,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 rg extends XU{_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 O31((R,O)=>{let P=H.get(R[0])??1/0,D=H.get(O[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 O=Math.abs(J.y+R-X.y);U.push({y:R,distanceToTargetY:O})}U.sort((R,O)=>R.distanceToTargetY-O.distanceToTargetY);let B=[...F,...U.flatMap(({y:R})=>F.map((O)=>({...O,y:R})))],w=0,j=Math.abs(X.x-J.x)+Math.abs(X.y-J.y)+Math.abs(X.z-J.z),N=Math.min(this._maxOpenSetIterations,j*20);while(!q.isEmpty()&&w<N){w++;let[R,O]=q.pop();if(O.x===X.x&&O.y===X.y&&O.z===X.z){let C=this._reconstructPath(G,O);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 A={x:O.x+C.x,y:O.y+C.y,z:O.z+C.z};if(Math.abs(X.x-A.x)+Math.abs(X.y-A.y)+Math.abs(X.z-A.z)>j*1.5)continue;let x=this._coordinateToKey(A);if(V.has(x))continue;let I=this._isNeighborCoordinateBlocked(O,A,this._entity.height);if(k&&I){D.set(T,!0);continue}if(I)continue;let S=Math.abs(C.x),y=Math.abs(C.y),m=Math.abs(C.z),i=y===0?0:this._verticalPenalty,t=(Math.max(S,y,m)===1&&S+y+m>1?1.4:1)+i,Z0=P+t,W0=z.get(x)??1/0;if(Z0>=W0)continue;G.set(x,O),z.set(x,Z0);let A0=Z0+this._pathfindingHeuristic(A,X);H.set(x,A0),q.push([x,A])}}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{_J6 as startServer,RK1 as WorldManagerEvent,cY as WorldManager,MK1 as WorldLoopEvent,tF as WorldLoop,pg as WorldEvent,eF as World,aS as WebServerEvent,mK as WebServer,WG as Vector3,JU as Vector2,rF as Ticker,sQ as TelemetrySpanOperation,N8 as Telemetry,lg as SimulationEvent,aF as Simulation,XU as SimpleEntityController,oF as SceneUIManager,FI as SceneUIEvent,wH as SceneUI,X60 as SUPPORTED_INPUT_KEYS,Az as RigidBodyType,B$ as RigidBody,QG as Quaternion,UL as PlayerUIEvent,zH as PlayerUI,NK1 as PlayerManagerEvent,j9 as PlayerManager,HH as PlayerEvent,y7 as PlayerEntity,J60 as PlayerCameraMode,zI as PlayerCameraEvent,GH as PlayerCamera,QK as Player,P$ as PersistenceManager,rg as PathfindingEntityController,sF as ParticleEmitterManager,ug as ParticleEmitterEvent,dg as ParticleEmitter,iS as PORT,K60 as PLAYER_ROTATION_UPDATE_THRESHOLD,W60 as PLAYER_POSITION_UPDATE_THRESHOLD_SQ,h5 as ModelRegistry,k5 as Matrix4,OZ as Matrix3,tQ as Matrix2,OK1 as LightType,nF as LightManager,gg as LightEvent,mg as Light,B6 as IterationMap,DK1 as GameServerEvent,oQ as GameServer,j0 as EventRouter,d as ErrorHandler,BH as EntityManager,UH as EntityEvent,o8 as Entity,Q60 as ENTITY_ROTATION_UPDATE_THRESHOLD,$60 as ENTITY_POSITION_UPDATE_THRESHOLD_SQ,m1 as DefaultPlayerEntityController,UI as DefaultPlayerEntity,Y60 as DEFAULT_ENTITY_RIGID_BODY_OPTIONS,S4 as CollisionGroupsBuilder,sY as CollisionGroup,xz as ColliderShape,FH as ColliderMap,V9 as Collider,Ek as CoefficientCombineRule,qI as ChunkLatticeEvent,qH as ChunkLattice,U9 as Chunk,VH as ChatManager,HI as ChatEvent,vk as BlockTypeRegistryEvent,hz as BlockTypeRegistry,Ik as BlockTypeEvent,q9 as BlockType,JW as Block,$m as BaseEntityControllerEvent,pY as BaseEntityController,zG as AudioManager,SN as AudioEvent,GG as Audio};