babylonjs-editor-cli 5.4.1-rc.4 → 5.4.1-rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -87,7 +87,7 @@ ${t}`,"wrappedToString"),rue=Object.getOwnPropertyDescriptor(Function.prototype,
87
87
  `)),this}return this.isSpinning?this:(this.#e.hideCursor&&TC.hide(this.#c),this.#e.discardStdin&&pl.default.stdin.isTTY&&($C.start(),this.#y=!0),this.#A(),this.render(),this.#l=setInterval(this.render.bind(this),this.interval),this)}stop(){return clearInterval(this.#l),this.#l=void 0,this.#r=-1,this.#n=0,this.#C(),this.#i(),this.#a&&(this.#c.removeListener("drain",this.#a),this.#a=void 0),this.isEnabled&&(this.clear(),this.#e.hideCursor&&TC.show(this.#c)),this.#y&&(this.#y=!1,$C.stop()),this}succeed(t){return this.stopAndPersist({symbol:ec.success,text:t})}fail(t){return this.stopAndPersist({symbol:ec.error,text:t})}warn(t){return this.stopAndPersist({symbol:ec.warning,text:t})}info(t){return this.stopAndPersist({symbol:ec.info,text:t})}stopAndPersist(t={}){if(this.isSilent)return this;let r=t.symbol??" ",n=t.text??this.text,s=t.prefixText??this.#e.prefixText,o=t.suffixText??this.#e.suffixText,a=this.#x(r,n,s,o)+`
88
88
  `;return this.stop(),this.#p(()=>this.#c.write(a)),this}};function qo(e){return new LC(e)}i(qo,"ora");async function GGe(e,t){let r=typeof e=="function",n=typeof e.then=="function";if(!r&&!n)throw new TypeError("Parameter `action` must be a Function or a Promise");let{successText:s,failText:o}=typeof t=="object"?t:{successText:void 0,failText:void 0},a=qo(t).start();try{let l=await(r?e(a):e);return a.succeed(s===void 0?void 0:typeof s=="string"?s:s(l)),l}catch(c){throw a.fail(o===void 0?void 0:typeof o=="string"?o:o(c)),c}}i(GGe,"oraPromise");var FC=i((e,t,r)=>{let n=e instanceof RegExp?ND(e,r):e,s=t instanceof RegExp?ND(t,r):t,o=n!==null&&s!=null&&vue(n,s,r);return o&&{start:o[0],end:o[1],pre:r.slice(0,o[0]),body:r.slice(o[0]+n.length,o[1]),post:r.slice(o[1]+s.length)}},"balanced"),ND=i((e,t)=>{let r=t.match(e);return r?r[0]:null},"maybeMatch"),vue=i((e,t,r)=>{let n,s,o,a,c,l=r.indexOf(e),u=r.indexOf(t,l+1),d=l;if(l>=0&&u>0){if(e===t)return[l,u];for(n=[],o=r.length;d>=0&&!c;){if(d===l)n.push(d),l=r.indexOf(e,d+1);else if(n.length===1){let f=n.pop();f!==void 0&&(c=[f,u])}else s=n.pop(),s!==void 0&&s<o&&(o=s,a=u),u=r.indexOf(t,d+1);d=l<u&&l>=0?l:u}n.length&&a!==void 0&&(c=[o,a])}return c},"range");var DD="\0SLASH"+Math.random()+"\0",BD="\0OPEN"+Math.random()+"\0",jC="\0CLOSE"+Math.random()+"\0",MD="\0COMMA"+Math.random()+"\0",$D="\0PERIOD"+Math.random()+"\0",Aue=new RegExp(DD,"g"),Rue=new RegExp(BD,"g"),Tue=new RegExp(jC,"g"),Pue=new RegExp(MD,"g"),kue=new RegExp($D,"g"),Oue=/\\\\/g,Iue=/\\{/g,Nue=/\\}/g,Due=/\\,/g,Bue=/\\./g;function UC(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}i(UC,"numeric");function Mue(e){return e.replace(Oue,DD).replace(Iue,BD).replace(Nue,jC).replace(Due,MD).replace(Bue,$D)}i(Mue,"escapeBraces");function $ue(e){return e.replace(Aue,"\\").replace(Rue,"{").replace(Tue,"}").replace(Pue,",").replace(kue,".")}i($ue,"unescapeBraces");function LD(e){if(!e)return[""];let t=[],r=FC("{","}",e);if(!r)return e.split(",");let{pre:n,body:s,post:o}=r,a=n.split(",");a[a.length-1]+="{"+s+"}";let c=LD(o);return o.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),t.push.apply(t,a),t}i(LD,"parseCommaParts");function FD(e){return e?(e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),Zd(Mue(e),!0).map($ue)):[]}i(FD,"expand");function Lue(e){return"{"+e+"}"}i(Lue,"embrace");function Fue(e){return/^-?0\d/.test(e)}i(Fue,"isPadded");function jue(e,t){return e<=t}i(jue,"lte");function Uue(e,t){return e>=t}i(Uue,"gte");function Zd(e,t){let r=[],n=FC("{","}",e);if(!n)return[e];let s=n.pre,o=n.post.length?Zd(n.post,!1):[""];if(/\$$/.test(n.pre))for(let a=0;a<o.length;a++){let c=s+"{"+n.body+"}"+o[a];r.push(c)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),l=a||c,u=n.body.indexOf(",")>=0;if(!l&&!u)return n.post.match(/,(?!,).*\}/)?(e=n.pre+"{"+n.body+jC+n.post,Zd(e)):[e];let d;if(l)d=n.body.split(/\.\./);else if(d=LD(n.body),d.length===1&&d[0]!==void 0&&(d=Zd(d[0],!1).map(Lue),d.length===1))return o.map(m=>n.pre+d[0]+m);let f;if(l&&d[0]!==void 0&&d[1]!==void 0){let m=UC(d[0]),g=UC(d[1]),E=Math.max(d[0].length,d[1].length),w=d.length===3&&d[2]!==void 0?Math.abs(UC(d[2])):1,_=jue;g<m&&(w*=-1,_=Uue);let N=d.some(Fue);f=[];for(let $=m;_($,g);$+=w){let j;if(c)j=String.fromCharCode($),j==="\\"&&(j="");else if(j=String($),N){let se=E-j.length;if(se>0){let _e=new Array(se+1).join("0");$<0?j="-"+_e+j.slice(1):j=_e+j}}f.push(j)}}else{f=[];for(let m=0;m<d.length;m++)f.push.apply(f,Zd(d[m],!1))}for(let m=0;m<f.length;m++)for(let g=0;g<o.length;g++){let E=s+f[m]+o[g];(!t||l||E)&&r.push(E)}}return r}i(Zd,"expand_");var ZGe=65536,ef=i(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var que={"[: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]},tf=i(e=>e.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),Hue=i(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),jD=i(e=>e.join(""),"rangesToString"),UD=i((e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],s=[],o=r+1,a=!1,c=!1,l=!1,u=!1,d=r,f="";e:for(;o<e.length;){let w=e.charAt(o);if((w==="!"||w==="^")&&o===r+1){u=!0,o++;continue}if(w==="]"&&a&&!l){d=o+1;break}if(a=!0,w==="\\"&&!l){l=!0,o++;continue}if(w==="["&&!l){for(let[_,[v,N,$]]of Object.entries(que))if(e.startsWith(_,o)){if(f)return["$.",!1,e.length-r,!0];o+=_.length,$?s.push(v):n.push(v),c=c||N;continue e}}if(l=!1,f){w>f?n.push(tf(f)+"-"+tf(w)):w===f&&n.push(tf(w)),f="",o++;continue}if(e.startsWith("-]",o+1)){n.push(tf(w+"-")),o+=2;continue}if(e.startsWith("-",o+1)){f=w,o+=2;continue}n.push(tf(w)),o++}if(d<o)return["",!1,0,!1];if(!n.length&&!s.length)return["$.",!1,e.length-r,!0];if(s.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!u){let w=n[0].length===2?n[0].slice(-1):n[0];return[Hue(w),!1,d-r,!1]}let m="["+(u?"^":"")+jD(n)+"]",g="["+(u?"":"^")+jD(s)+"]";return[n.length&&s.length?"("+m+"|"+g+")":n.length?m:g,c,d-r,!0]},"parseClass");var Us=i((e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!0}={})=>r?t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?e.replace(/\[([^\/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1"),"unescape");var Gue=new Set(["!","?","+","*","@"]),qD=i(e=>Gue.has(e),"isExtglobType"),zue="(?!(?:^|/)\\.\\.?(?:$|/))",xm="(?!\\.)",Vue=new Set(["[","."]),Wue=new Set(["..","."]),Kue=new Set("().*{}+?[]^$\\!"),Yue=i(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),qC="[^/]",HD=qC+"*?",GD=qC+"+?",ml=class e{static{i(this,"AST")}type;#t;#r;#n=!1;#e=[];#o;#c;#l;#d=!1;#u;#a;#s=!1;constructor(t,r,n={}){this.type=t,t&&(this.#r=!0),this.#o=r,this.#t=this.#o?this.#o.#t:this,this.#u=this.#t===this?n:this.#t.#u,this.#l=this.#t===this?[]:this.#t.#l,t==="!"&&!this.#t.#d&&this.#l.push(this),this.#c=this.#o?this.#o.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let t of this.#e)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#e.map(t=>String(t)).join("|")+")":this.#a=this.#e.map(t=>String(t)).join("")}#y(){if(this!==this.#t)throw new Error("should only call on root");if(this.#d)return this;this.toString(),this.#d=!0;let t;for(;t=this.#l.pop();){if(t.type!=="!")continue;let r=t,n=r.#o;for(;n;){for(let s=r.#c+1;!n.type&&s<n.#e.length;s++)for(let o of t.#e){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(n.#e[s])}r=n,n=r.#o}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof e&&r.#o===this))throw new Error("invalid part: "+r);this.#e.push(r)}}toJSON(){let t=this.type===null?this.#e.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#e.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#d&&this.#o?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#o?.isStart())return!1;if(this.#c===0)return!0;let t=this.#o;for(let r=0;r<this.#c;r++){let n=t.#e[r];if(!(n instanceof e&&n.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let t=this.#o?this.#o.#e.length:0;return this.#c===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new e(this.type,t);for(let n of this.#e)r.copyIn(n);return r}static#p(t,r,n,s){let o=!1,a=!1,c=-1,l=!1;if(r.type===null){let g=n,E="";for(;g<t.length;){let w=t.charAt(g++);if(o||w==="\\"){o=!o,E+=w;continue}if(a){g===c+1?(w==="^"||w==="!")&&(l=!0):w==="]"&&!(g===c+2&&l)&&(a=!1),E+=w;continue}else if(w==="["){a=!0,c=g,l=!1,E+=w;continue}if(!s.noext&&qD(w)&&t.charAt(g)==="("){r.push(E),E="";let _=new e(w,r);g=e.#p(t,_,g,s),r.push(_);continue}E+=w}return r.push(E),g}let u=n+1,d=new e(null,r),f=[],m="";for(;u<t.length;){let g=t.charAt(u++);if(o||g==="\\"){o=!o,m+=g;continue}if(a){u===c+1?(g==="^"||g==="!")&&(l=!0):g==="]"&&!(u===c+2&&l)&&(a=!1),m+=g;continue}else if(g==="["){a=!0,c=u,l=!1,m+=g;continue}if(qD(g)&&t.charAt(u)==="("){d.push(m),m="";let E=new e(g,d);d.push(E),u=e.#p(t,E,u,s);continue}if(g==="|"){d.push(m),m="",f.push(d),d=new e(null,r);continue}if(g===")")return m===""&&r.#e.length===0&&(r.#s=!0),d.push(m),m="",r.push(...f,d),u;m+=g}return r.type=null,r.#r=void 0,r.#e=[t.substring(n-1)],u}static fromGlob(t,r={}){let n=new e(null,void 0,r);return e.#p(t,n,0,r),n}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[r,n,s,o]=this.toRegExpSource();if(!(s||this.#r||this.#u.nocase&&!this.#u.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let c=(this.#u.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${r}$`,c),{_src:r,_glob:t})}get options(){return this.#u}toRegExpSource(t){let r=t??!!this.#u.dot;if(this.#t===this&&this.#y(),!this.type){let l=this.isStart()&&this.isEnd()&&!this.#e.some(g=>typeof g!="string"),u=this.#e.map(g=>{let[E,w,_,v]=typeof g=="string"?e.#g(g,this.#r,l):g.toRegExpSource(t);return this.#r=this.#r||_,this.#n=this.#n||v,E}).join(""),d="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&Wue.has(this.#e[0]))){let E=Vue,w=r&&E.has(u.charAt(0))||u.startsWith("\\.")&&E.has(u.charAt(2))||u.startsWith("\\.\\.")&&E.has(u.charAt(4)),_=!r&&!t&&E.has(u.charAt(0));d=w?zue:_?xm:""}let f="";return this.isEnd()&&this.#t.#d&&this.#o?.type==="!"&&(f="(?:$|\\/)"),[d+u+f,Us(u),this.#r=!!this.#r,this.#n]}let n=this.type==="*"||this.type==="+",s=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#m(r);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let l=this.toString();return this.#e=[l],this.type=null,this.#r=void 0,[l,Us(this.toString()),!1,!1]}let a=!n||t||r||!xm?"":this.#m(!0);a===o&&(a=""),a&&(o=`(?:${o})(?:${a})*?`);let c="";if(this.type==="!"&&this.#s)c=(this.isStart()&&!r?xm:"")+GD;else{let l=this.type==="!"?"))"+(this.isStart()&&!r&&!t?xm:"")+HD+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;c=s+o+l}return[c,Us(o),this.#r=!!this.#r,this.#n]}#m(t){return this.#e.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,s,o,a]=r.toRegExpSource(t);return this.#n=this.#n||a,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#g(t,r,n=!1){let s=!1,o="",a=!1;for(let c=0;c<t.length;c++){let l=t.charAt(c);if(s){s=!1,o+=(Kue.has(l)?"\\":"")+l;continue}if(l==="\\"){c===t.length-1?o+="\\\\":s=!0;continue}if(l==="["){let[u,d,f,m]=UD(t,c);if(f){o+=u,a=a||d,c+=f-1,r=r||m;continue}}if(l==="*"){o+=n&&t==="*"?GD:HD,r=!0;continue}if(l==="?"){o+=qC,r=!0;continue}o+=Yue(l)}return[o,Us(t),!!r,a]}};var gl=i((e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!1}={})=>r?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var bn=i((e,t,r={})=>(ef(t),!r.nocomment&&t.charAt(0)==="#"?!1:new Qn(t,r).match(e)),"minimatch"),Xue=/^\*+([^+@!?\*\[\(]*)$/,Jue=i(e=>t=>!t.startsWith(".")&&t.endsWith(e),"starDotExtTest"),Que=i(e=>t=>t.endsWith(e),"starDotExtTestDot"),Zue=i(e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),"starDotExtTestNocase"),ede=i(e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),"starDotExtTestNocaseDot"),tde=/^\*+\.\*+$/,rde=i(e=>!e.startsWith(".")&&e.includes("."),"starDotStarTest"),nde=i(e=>e!=="."&&e!==".."&&e.includes("."),"starDotStarTestDot"),sde=/^\.\*+$/,ide=i(e=>e!=="."&&e!==".."&&e.startsWith("."),"dotStarTest"),ode=/^\*+$/,ade=i(e=>e.length!==0&&!e.startsWith("."),"starTest"),cde=i(e=>e.length!==0&&e!=="."&&e!=="..","starTestDot"),lde=/^\?+([^+@!?\*\[\(]*)?$/,ude=i(([e,t=""])=>{let r=zD([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},"qmarksTestNocase"),dde=i(([e,t=""])=>{let r=VD([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},"qmarksTestNocaseDot"),fde=i(([e,t=""])=>{let r=VD([e]);return t?n=>r(n)&&n.endsWith(t):r},"qmarksTestDot"),hde=i(([e,t=""])=>{let r=zD([e]);return t?n=>r(n)&&n.endsWith(t):r},"qmarksTest"),zD=i(([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},"qmarksTestNoExt"),VD=i(([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},"qmarksTestNoExtDot"),WD=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",KD={win32:{sep:"\\"},posix:{sep:"/"}},pde=WD==="win32"?KD.win32.sep:KD.posix.sep;bn.sep=pde;var Gr=Symbol("globstar **");bn.GLOBSTAR=Gr;var mde="[^/]",gde=mde+"*?",yde="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Ede="(?:(?!(?:\\/|^)\\.).)*?",Sde=i((e,t={})=>r=>bn(r,e,t),"filter");bn.filter=Sde;var Es=i((e,t={})=>Object.assign({},e,t),"ext"),bde=i(e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return bn;let t=bn;return Object.assign(i((n,s,o={})=>t(n,s,Es(e,o)),"m"),{Minimatch:class extends t.Minimatch{static{i(this,"Minimatch")}constructor(s,o={}){super(s,Es(e,o))}static defaults(s){return t.defaults(Es(e,s)).Minimatch}},AST:class extends t.AST{static{i(this,"AST")}constructor(s,o,a={}){super(s,o,Es(e,a))}static fromGlob(s,o={}){return t.AST.fromGlob(s,Es(e,o))}},unescape:i((n,s={})=>t.unescape(n,Es(e,s)),"unescape"),escape:i((n,s={})=>t.escape(n,Es(e,s)),"escape"),filter:i((n,s={})=>t.filter(n,Es(e,s)),"filter"),defaults:i(n=>t.defaults(Es(e,n)),"defaults"),makeRe:i((n,s={})=>t.makeRe(n,Es(e,s)),"makeRe"),braceExpand:i((n,s={})=>t.braceExpand(n,Es(e,s)),"braceExpand"),match:i((n,s,o={})=>t.match(n,s,Es(e,o)),"match"),sep:t.sep,GLOBSTAR:Gr})},"defaults");bn.defaults=bde;var YD=i((e,t={})=>(ef(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:FD(e)),"braceExpand");bn.braceExpand=YD;var wde=i((e,t={})=>new Qn(e,t).makeRe(),"makeRe");bn.makeRe=wde;var _de=i((e,t,r={})=>{let n=new Qn(t,r);return e=e.filter(s=>n.match(s)),n.options.nonull&&!e.length&&e.push(t),e},"match");bn.match=_de;var XD=/[?*]|[+@!]\(.*?\)|\[|\]/,Cde=i(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Qn=class{static{i(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,r={}){ef(t),r=r||{},this.options=r,this.pattern=t,this.platform=r.platform||WD,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.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 t of this.set)for(let r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...o)=>console.error(...o)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(o=>this.slashSplit(o));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let s=this.globParts.map((o,a,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=o[0]===""&&o[1]===""&&(o[2]==="?"||!XD.test(o[2]))&&!XD.test(o[3]),u=/^[a-z]:/i.test(o[0]);if(l)return[...o.slice(0,4),...o.slice(4).map(d=>this.parse(d))];if(u)return[o[0],...o.slice(1).map(d=>this.parse(d))]}return o.map(l=>this.parse(l))});if(this.debug(this.pattern,s),this.set=s.filter(o=>o.indexOf(!1)===-1),this.isWindows)for(let o=0;o<this.set.length;o++){let a=this.set[o];a[0]===""&&a[1]===""&&this.globParts[o][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n=0;n<t.length;n++)for(let s=0;s<t[n].length;s++)t[n][s]==="**"&&(t[n][s]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let s=n;for(;r[s+1]==="**";)s++;s!==n&&r.splice(n,s-n)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((n,s)=>{let o=n[n.length-1];return s==="**"&&o==="**"?n:s===".."&&o&&o!==".."&&o!=="."&&o!=="**"?(n.pop(),n):(n.push(s),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let s=1;s<t.length-1;s++){let o=t[s];s===1&&o===""&&t[0]===""||(o==="."||o==="")&&(r=!0,t.splice(s,1),s--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let s=t[n-1];s&&s!=="."&&s!==".."&&s!=="**"&&(r=!0,t.splice(n-1,2),n-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let n of t){let s=-1;for(;(s=n.indexOf("**",s+1))!==-1;){let a=s;for(;n[a+1]==="**";)a++;a>s&&n.splice(s+1,a-s);let c=n[s+1],l=n[s+2],u=n[s+3];if(c!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;r=!0,n.splice(s,1);let d=n.slice(0);d[s]="**",t.push(d),s--}if(!this.preserveMultipleSlashes){for(let a=1;a<n.length-1;a++){let c=n[a];a===1&&c===""&&n[0]===""||(c==="."||c==="")&&(r=!0,n.splice(a,1),a--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let o=0;for(;(o=n.indexOf("..",o+1))!==-1;){let a=n[o-1];if(a&&a!=="."&&a!==".."&&a!=="**"){r=!0;let l=o===1&&n[o+1]==="**"?["."]:[];n.splice(o-1,2,...l),n.length===0&&n.push(""),o-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let n=r+1;n<t.length;n++){let s=this.partsMatch(t[r],t[n],!this.preserveMultipleSlashes);if(s){t[r]=[],t[n]=s;break}}return t.filter(r=>r.length)}partsMatch(t,r,n=!1){let s=0,o=0,a=[],c="";for(;s<t.length&&o<r.length;)if(t[s]===r[o])a.push(c==="b"?r[o]:t[s]),s++,o++;else if(n&&t[s]==="**"&&r[o]===t[s+1])a.push(t[s]),s++;else if(n&&r[o]==="**"&&t[s]===r[o+1])a.push(r[o]),o++;else if(t[s]==="*"&&r[o]&&(this.options.dot||!r[o].startsWith("."))&&r[o]!=="**"){if(c==="b")return!1;c="a",a.push(t[s]),s++,o++}else if(r[o]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(c==="a")return!1;c="b",a.push(r[o]),s++,o++}else return!1;return t.length===r.length&&a}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,n=0;for(let s=0;s<t.length&&t.charAt(s)==="!";s++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n=!1){let s=this.options;if(this.isWindows){let w=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),_=!w&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),v=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),N=!v&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),$=_?3:w?0:void 0,j=N?3:v?0:void 0;if(typeof $=="number"&&typeof j=="number"){let[se,_e]=[t[$],r[j]];se.toLowerCase()===_e.toLowerCase()&&(r[j]=se,j>$?r=r.slice(j):$>j&&(t=t.slice($)))}}let{optimizationLevel:o=1}=this.options;o>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:r}),this.debug("matchOne",t.length,r.length);for(var a=0,c=0,l=t.length,u=r.length;a<l&&c<u;a++,c++){this.debug("matchOne loop");var d=r[c],f=t[a];if(this.debug(r,d,f),d===!1)return!1;if(d===Gr){this.debug("GLOBSTAR",[r,d,f]);var m=a,g=c+1;if(g===u){for(this.debug("** at the end");a<l;a++)if(t[a]==="."||t[a]===".."||!s.dot&&t[a].charAt(0)===".")return!1;return!0}for(;m<l;){var E=t[m];if(this.debug(`
89
89
  globstar while`,t,m,r,g,E),this.matchOne(t.slice(m),r.slice(g),n))return this.debug("globstar found match!",m,l,E),!0;if(E==="."||E===".."||!s.dot&&E.charAt(0)==="."){this.debug("dot detected!",t,m,r,g);break}this.debug("globstar swallow a segment, and continue"),m++}return!!(n&&(this.debug(`
90
- >>> no match, partial?`,t,m,r,g),m===l))}let w;if(typeof d=="string"?(w=f===d,this.debug("string match",d,f,w)):(w=d.test(f),this.debug("pattern match",d,f,w)),!w)return!1}if(a===l&&c===u)return!0;if(a===l)return n;if(c===u)return a===l-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return YD(this.pattern,this.options)}parse(t){ef(t);let r=this.options;if(t==="**")return Gr;if(t==="")return"";let n,s=null;(n=t.match(ode))?s=r.dot?cde:ade:(n=t.match(Xue))?s=(r.nocase?r.dot?ede:Zue:r.dot?Que:Jue)(n[1]):(n=t.match(lde))?s=(r.nocase?r.dot?dde:ude:r.dot?fde:hde)(n):(n=t.match(tde))?s=r.dot?nde:rde:(n=t.match(sde))&&(s=ide);let o=ml.fromGlob(t,this.options).toMMPattern();return s&&typeof o=="object"&&Reflect.defineProperty(o,"test",{value:s}),o}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?gde:r.dot?yde:Ede,s=new Set(r.nocase?["i"]:[]),o=t.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let m of f.flags.split(""))s.add(m);return typeof f=="string"?Cde(f):f===Gr?Gr:f._src});u.forEach((f,m)=>{let g=u[m+1],E=u[m-1];f!==Gr||E===Gr||(E===void 0?g!==void 0&&g!==Gr?u[m+1]="(?:\\/|"+n+"\\/)?"+g:u[m]=n:g===void 0?u[m-1]=E+"(?:\\/|\\/"+n+")?":g!==Gr&&(u[m-1]=E+"(?:\\/|\\/"+n+"\\/)"+g,u[m+1]=Gr))});let d=u.filter(f=>f!==Gr);if(this.partial&&d.length>=1){let f=[];for(let m=1;m<=d.length;m++)f.push(d.slice(0,m).join("/"));return"(?:"+f.join("|")+")"}return d.join("/")}).join("|"),[a,c]=t.length>1?["(?:",")"]:["",""];o="^"+a+o+c+"$",this.partial&&(o="^(?:\\/|"+a+o.slice(1,-1)+c+")$"),this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...s].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let s=this.slashSplit(t);this.debug(this.pattern,"split",s);let o=this.set;this.debug(this.pattern,"set",o);let a=s[s.length-1];if(!a)for(let c=s.length-2;!a&&c>=0;c--)a=s[c];for(let c=0;c<o.length;c++){let l=o[c],u=s;if(n.matchBase&&l.length===1&&(u=[a]),this.matchOne(u,l,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return bn.defaults(t).Minimatch}};bn.AST=ml,bn.Minimatch=Qn,bn.escape=gl,bn.unescape=Us;var yl=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,JD=new Set,HC=typeof process=="object"&&process?process:{},QD=i((e,t,r,n)=>{typeof HC.emitWarning=="function"?HC.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},"emitWarning"),vm=globalThis.AbortController,ZD=globalThis.AbortSignal;if(typeof vm>"u"){ZD=class{static{i(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(n,s){this._onabort.push(s)}},vm=class{static{i(this,"AbortController")}constructor(){t()}signal=new ZD;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let s of this.signal._onabort)s(n);this.signal.onabort?.(n)}}};let e=HC.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=i(()=>{e&&(e=!1,QD("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",t))},"warnACPolyfill")}var xde=i(e=>!JD.has(e),"shouldWarn"),Aze=Symbol("type"),Ho=i(e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),"isPosInt"),eB=i(e=>Ho(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?El:null:null,"getUintArray"),El=class extends Array{static{i(this,"ZeroArray")}constructor(t){super(t),this.fill(0)}},GC=class e{static{i(this,"Stack")}heap;length;static#t=!1;static create(t){let r=eB(t);if(!r)return[];e.#t=!0;let n=new e(t,r);return e.#t=!1,n}constructor(t,r){if(!e.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},rf=class e{static{i(this,"LRUCache")}#t;#r;#n;#e;#o;#c;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#l;#d;#u;#a;#s;#y;#p;#m;#g;#v;#E;#C;#x;#S;#w;#_;#h;static unsafeExposeInternals(t){return{starts:t.#x,ttls:t.#S,sizes:t.#C,keyMap:t.#u,keyList:t.#a,valList:t.#s,next:t.#y,prev:t.#p,get head(){return t.#m},get tail(){return t.#g},free:t.#v,isBackgroundFetch:i(r=>t.#f(r),"isBackgroundFetch"),backgroundFetch:i((r,n,s,o)=>t.#L(r,n,s,o),"backgroundFetch"),moveToTail:i(r=>t.#j(r),"moveToTail"),indexes:i(r=>t.#T(r),"indexes"),rindexes:i(r=>t.#P(r),"rindexes"),isStale:i(r=>t.#b(r),"isStale")}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#d}get size(){return this.#l}get fetchMethod(){return this.#o}get memoMethod(){return this.#c}get dispose(){return this.#n}get disposeAfter(){return this.#e}constructor(t){let{max:r=0,ttl:n,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:c,allowStale:l,dispose:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:m,maxSize:g=0,maxEntrySize:E=0,sizeCalculation:w,fetchMethod:_,memoMethod:v,noDeleteOnFetchRejection:N,noDeleteOnStaleGet:$,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:se,ignoreFetchAbort:_e}=t;if(r!==0&&!Ho(r))throw new TypeError("max option must be a nonnegative integer");let Be=r?eB(r):Array;if(!Be)throw new Error("invalid max value: "+r);if(this.#t=r,this.#r=g,this.maxEntrySize=E||this.#r,this.sizeCalculation=w,this.sizeCalculation){if(!this.#r&&!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(v!==void 0&&typeof v!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#c=v,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=_,this.#_=!!_,this.#u=new Map,this.#a=new Array(r).fill(void 0),this.#s=new Array(r).fill(void 0),this.#y=new Be(r),this.#p=new Be(r),this.#m=0,this.#g=0,this.#v=GC.create(r),this.#l=0,this.#d=0,typeof u=="function"&&(this.#n=u),typeof d=="function"?(this.#e=d,this.#E=[]):(this.#e=void 0,this.#E=void 0),this.#w=!!this.#n,this.#h=!!this.#e,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!N,this.allowStaleOnFetchRejection=!!j,this.allowStaleOnFetchAbort=!!se,this.ignoreFetchAbort=!!_e,this.maxEntrySize!==0){if(this.#r!==0&&!Ho(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Ho(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#O()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!$,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=Ho(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!Ho(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#R()}if(this.#t===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){let fe="LRU_CACHE_UNBOUNDED";xde(fe)&&(JD.add(fe),QD("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",fe,e))}}getRemainingTTL(t){return this.#u.has(t)?1/0:0}#R(){let t=new El(this.#t),r=new El(this.#t);this.#S=t,this.#x=r,this.#k=(o,a,c=yl.now())=>{if(r[o]=a!==0?c:0,t[o]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#b(o)&&this.#I(this.#a[o],"expire")},a+1);l.unref&&l.unref()}},this.#A=o=>{r[o]=t[o]!==0?yl.now():0},this.#i=(o,a)=>{if(t[a]){let c=t[a],l=r[a];if(!c||!l)return;o.ttl=c,o.start=l,o.now=n||s();let u=o.now-l;o.remainingTTL=c-u}};let n=0,s=i(()=>{let o=yl.now();if(this.ttlResolution>0){n=o;let a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref()}return o},"getNow");this.getRemainingTTL=o=>{let a=this.#u.get(o);if(a===void 0)return 0;let c=t[a],l=r[a];if(!c||!l)return 1/0;let u=(n||s())-l;return c-u},this.#b=o=>{let a=r[o],c=t[o];return!!c&&!!a&&(n||s())-a>c}}#A=i(()=>{},"#updateItemAge");#i=i(()=>{},"#statusTTL");#k=i(()=>{},"#setItemTTL");#b=i(()=>!1,"#isStale");#O(){let t=new El(this.#t);this.#d=0,this.#C=t,this.#N=r=>{this.#d-=t[r],t[r]=0},this.#B=(r,n,s,o)=>{if(this.#f(n))return 0;if(!Ho(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(n,r),!Ho(s))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 s},this.#D=(r,n,s)=>{if(t[r]=n,this.#r){let o=this.#r-t[r];for(;this.#d>o;)this.#$(!0)}this.#d+=t[r],s&&(s.entrySize=n,s.totalCalculatedSize=this.#d)}}#N=i(t=>{},"#removeItemSize");#D=i((t,r,n)=>{},"#addItemSize");#B=i((t,r,n,s)=>{if(n||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#T({allowStale:t=this.allowStale}={}){if(this.#l)for(let r=this.#g;!(!this.#M(r)||((t||!this.#b(r))&&(yield r),r===this.#m));)r=this.#p[r]}*#P({allowStale:t=this.allowStale}={}){if(this.#l)for(let r=this.#m;!(!this.#M(r)||((t||!this.#b(r))&&(yield r),r===this.#g));)r=this.#y[r]}#M(t){return t!==void 0&&this.#u.get(this.#a[t])===t}*entries(){for(let t of this.#T())this.#s[t]!==void 0&&this.#a[t]!==void 0&&!this.#f(this.#s[t])&&(yield[this.#a[t],this.#s[t]])}*rentries(){for(let t of this.#P())this.#s[t]!==void 0&&this.#a[t]!==void 0&&!this.#f(this.#s[t])&&(yield[this.#a[t],this.#s[t]])}*keys(){for(let t of this.#T()){let r=this.#a[t];r!==void 0&&!this.#f(this.#s[t])&&(yield r)}}*rkeys(){for(let t of this.#P()){let r=this.#a[t];r!==void 0&&!this.#f(this.#s[t])&&(yield r)}}*values(){for(let t of this.#T())this.#s[t]!==void 0&&!this.#f(this.#s[t])&&(yield this.#s[t])}*rvalues(){for(let t of this.#P())this.#s[t]!==void 0&&!this.#f(this.#s[t])&&(yield this.#s[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,r={}){for(let n of this.#T()){let s=this.#s[n],o=this.#f(s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,this.#a[n],this))return this.get(this.#a[n],r)}}forEach(t,r=this){for(let n of this.#T()){let s=this.#s[n],o=this.#f(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(r,o,this.#a[n],this)}}rforEach(t,r=this){for(let n of this.#P()){let s=this.#s[n],o=this.#f(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(r,o,this.#a[n],this)}}purgeStale(){let t=!1;for(let r of this.#P({allowStale:!0}))this.#b(r)&&(this.#I(this.#a[r],"expire"),t=!0);return t}info(t){let r=this.#u.get(t);if(r===void 0)return;let n=this.#s[r],s=this.#f(n)?n.__staleWhileFetching:n;if(s===void 0)return;let o={value:s};if(this.#S&&this.#x){let a=this.#S[r],c=this.#x[r];if(a&&c){let l=a-(yl.now()-c);o.ttl=l,o.start=Date.now()}}return this.#C&&(o.size=this.#C[r]),o}dump(){let t=[];for(let r of this.#T({allowStale:!0})){let n=this.#a[r],s=this.#s[r],o=this.#f(s)?s.__staleWhileFetching:s;if(o===void 0||n===void 0)continue;let a={value:o};if(this.#S&&this.#x){a.ttl=this.#S[r];let c=yl.now()-this.#x[r];a.start=Math.floor(Date.now()-c)}this.#C&&(a.size=this.#C[r]),t.unshift([n,a])}return t}load(t){this.clear();for(let[r,n]of t){if(n.start){let s=Date.now()-n.start;n.start=yl.now()-s}this.set(r,n.value,n)}}set(t,r,n={}){if(r===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:l}=n,{noUpdateTTL:u=this.noUpdateTTL}=n,d=this.#B(t,r,n.size||0,c);if(this.maxEntrySize&&d>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#I(t,"set"),this;let f=this.#l===0?void 0:this.#u.get(t);if(f===void 0)f=this.#l===0?this.#g:this.#v.length!==0?this.#v.pop():this.#l===this.#t?this.#$(!1):this.#l,this.#a[f]=t,this.#s[f]=r,this.#u.set(t,f),this.#y[this.#g]=f,this.#p[f]=this.#g,this.#g=f,this.#l++,this.#D(f,d,l),l&&(l.set="add"),u=!1;else{this.#j(f);let m=this.#s[f];if(r!==m){if(this.#_&&this.#f(m)){m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:g}=m;g!==void 0&&!a&&(this.#w&&this.#n?.(g,t,"set"),this.#h&&this.#E?.push([g,t,"set"]))}else a||(this.#w&&this.#n?.(m,t,"set"),this.#h&&this.#E?.push([m,t,"set"]));if(this.#N(f),this.#D(f,d,l),this.#s[f]=r,l){l.set="replace";let g=m&&this.#f(m)?m.__staleWhileFetching:m;g!==void 0&&(l.oldValue=g)}}else l&&(l.set="update")}if(s!==0&&!this.#S&&this.#R(),this.#S&&(u||this.#k(f,s,o),l&&this.#i(l,f)),!a&&this.#h&&this.#E){let m=this.#E,g;for(;g=m?.shift();)this.#e?.(...g)}return this}pop(){try{for(;this.#l;){let t=this.#s[this.#m];if(this.#$(!0),this.#f(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#h&&this.#E){let t=this.#E,r;for(;r=t?.shift();)this.#e?.(...r)}}}#$(t){let r=this.#m,n=this.#a[r],s=this.#s[r];return this.#_&&this.#f(s)?s.__abortController.abort(new Error("evicted")):(this.#w||this.#h)&&(this.#w&&this.#n?.(s,n,"evict"),this.#h&&this.#E?.push([s,n,"evict"])),this.#N(r),t&&(this.#a[r]=void 0,this.#s[r]=void 0,this.#v.push(r)),this.#l===1?(this.#m=this.#g=0,this.#v.length=0):this.#m=this.#y[r],this.#u.delete(n),this.#l--,r}has(t,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:s}=r,o=this.#u.get(t);if(o!==void 0){let a=this.#s[o];if(this.#f(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#b(o))s&&(s.has="stale",this.#i(s,o));else return n&&this.#A(o),s&&(s.has="hit",this.#i(s,o)),!0}else s&&(s.has="miss");return!1}peek(t,r={}){let{allowStale:n=this.allowStale}=r,s=this.#u.get(t);if(s===void 0||!n&&this.#b(s))return;let o=this.#s[s];return this.#f(o)?o.__staleWhileFetching:o}#L(t,r,n,s){let o=r===void 0?void 0:this.#s[r];if(this.#f(o))return o;let a=new vm,{signal:c}=n;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:n,context:s},u=i((w,_=!1)=>{let{aborted:v}=a.signal,N=n.ignoreFetchAbort&&w!==void 0;if(n.status&&(v&&!_?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,N&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),v&&!N&&!_)return f(a.signal.reason);let $=g;return this.#s[r]===g&&(w===void 0?$.__staleWhileFetching?this.#s[r]=$.__staleWhileFetching:this.#I(t,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(t,w,l.options))),w},"cb"),d=i(w=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=w),f(w)),"eb"),f=i(w=>{let{aborted:_}=a.signal,v=_&&n.allowStaleOnFetchAbort,N=v||n.allowStaleOnFetchRejection,$=N||n.noDeleteOnFetchRejection,j=g;if(this.#s[r]===g&&(!$||j.__staleWhileFetching===void 0?this.#I(t,"fetch"):v||(this.#s[r]=j.__staleWhileFetching)),N)return n.status&&j.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),j.__staleWhileFetching;if(j.__returned===j)throw w},"fetchFail"),m=i((w,_)=>{let v=this.#o?.(t,o,l);v&&v instanceof Promise&&v.then(N=>w(N===void 0?void 0:N),_),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(w(void 0),n.allowStaleOnFetchAbort&&(w=i(N=>u(N,!0),"res")))})},"pcall");n.status&&(n.status.fetchDispatched=!0);let g=new Promise(m).then(u,d),E=Object.assign(g,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(t,E,{...l.options,status:void 0}),r=this.#u.get(t)):this.#s[r]=E,E}#f(t){if(!this.#_)return!1;let r=t;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof vm}async fetch(t,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:g=this.ignoreFetchAbort,allowStaleOnFetchAbort:E=this.allowStaleOnFetchAbort,context:w,forceRefresh:_=!1,status:v,signal:N}=r;if(!this.#_)return v&&(v.fetch="get"),this.get(t,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:v});let $={allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:d,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:E,ignoreFetchAbort:g,status:v,signal:N},j=this.#u.get(t);if(j===void 0){v&&(v.fetch="miss");let se=this.#L(t,j,$,w);return se.__returned=se}else{let se=this.#s[j];if(this.#f(se)){let ye=n&&se.__staleWhileFetching!==void 0;return v&&(v.fetch="inflight",ye&&(v.returnedStale=!0)),ye?se.__staleWhileFetching:se.__returned=se}let _e=this.#b(j);if(!_&&!_e)return v&&(v.fetch="hit"),this.#j(j),s&&this.#A(j),v&&this.#i(v,j),se;let Be=this.#L(t,j,$,w),ie=Be.__staleWhileFetching!==void 0&&n;return v&&(v.fetch=_e?"stale":"refresh",ie&&_e&&(v.returnedStale=!0)),ie?Be.__staleWhileFetching:Be.__returned=Be}}async forceFetch(t,r={}){let n=await this.fetch(t,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(t,r={}){let n=this.#c;if(!n)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...a}=r,c=this.get(t,a);if(!o&&c!==void 0)return c;let l=n(t,c,{options:a,context:s});return this.set(t,l,a),l}get(t,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=r,c=this.#u.get(t);if(c!==void 0){let l=this.#s[c],u=this.#f(l);return a&&this.#i(a,c),this.#b(c)?(a&&(a.get="stale"),u?(a&&n&&l.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?l.__staleWhileFetching:void 0):(o||this.#I(t,"expire"),a&&n&&(a.returnedStale=!0),n?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(this.#j(c),s&&this.#A(c),l))}else a&&(a.get="miss")}#F(t,r){this.#p[r]=t,this.#y[t]=r}#j(t){t!==this.#g&&(t===this.#m?this.#m=this.#y[t]:this.#F(this.#p[t],this.#y[t]),this.#F(this.#g,t),this.#g=t)}delete(t){return this.#I(t,"delete")}#I(t,r){let n=!1;if(this.#l!==0){let s=this.#u.get(t);if(s!==void 0)if(n=!0,this.#l===1)this.#U(r);else{this.#N(s);let o=this.#s[s];if(this.#f(o)?o.__abortController.abort(new Error("deleted")):(this.#w||this.#h)&&(this.#w&&this.#n?.(o,t,r),this.#h&&this.#E?.push([o,t,r])),this.#u.delete(t),this.#a[s]=void 0,this.#s[s]=void 0,s===this.#g)this.#g=this.#p[s];else if(s===this.#m)this.#m=this.#y[s];else{let a=this.#p[s];this.#y[a]=this.#y[s];let c=this.#y[s];this.#p[c]=this.#p[s]}this.#l--,this.#v.push(s)}}if(this.#h&&this.#E?.length){let s=this.#E,o;for(;o=s?.shift();)this.#e?.(...o)}return n}clear(){return this.#U("delete")}#U(t){for(let r of this.#P({allowStale:!0})){let n=this.#s[r];if(this.#f(n))n.__abortController.abort(new Error("deleted"));else{let s=this.#a[r];this.#w&&this.#n?.(n,s,t),this.#h&&this.#E?.push([n,s,t])}}if(this.#u.clear(),this.#s.fill(void 0),this.#a.fill(void 0),this.#S&&this.#x&&(this.#S.fill(0),this.#x.fill(0)),this.#C&&this.#C.fill(0),this.#m=0,this.#g=0,this.#v.length=0,this.#d=0,this.#l=0,this.#h&&this.#E){let r=this.#E,n;for(;n=r?.shift();)this.#e?.(...n)}}};var Im=require("node:events"),JC=k(require("node:stream"),1),iB=require("node:string_decoder"),tB=typeof process=="object"&&process?process:{stdout:null,stderr:null},vde=i(e=>!!e&&typeof e=="object"&&(e instanceof zo||e instanceof JC.default||Ade(e)||Rde(e)),"isStream"),Ade=i(e=>!!e&&typeof e=="object"&&e instanceof Im.EventEmitter&&typeof e.pipe=="function"&&e.pipe!==JC.default.Writable.prototype.pipe,"isReadable"),Rde=i(e=>!!e&&typeof e=="object"&&e instanceof Im.EventEmitter&&typeof e.write=="function"&&typeof e.end=="function","isWritable"),ro=Symbol("EOF"),no=Symbol("maybeEmitEnd"),Go=Symbol("emittedEnd"),Am=Symbol("emittingEnd"),nf=Symbol("emittedError"),Rm=Symbol("closed"),rB=Symbol("read"),Tm=Symbol("flush"),nB=Symbol("flushChunk"),qs=Symbol("encoding"),Sl=Symbol("decoder"),Ar=Symbol("flowing"),sf=Symbol("paused"),bl=Symbol("resume"),Rr=Symbol("buffer"),wn=Symbol("pipes"),Tr=Symbol("bufferLength"),zC=Symbol("bufferPush"),Pm=Symbol("bufferShift"),Zr=Symbol("objectMode"),Jt=Symbol("destroyed"),VC=Symbol("error"),WC=Symbol("emitData"),sB=Symbol("emitEnd"),KC=Symbol("emitEnd2"),gi=Symbol("async"),YC=Symbol("abort"),km=Symbol("aborted"),of=Symbol("signal"),tc=Symbol("dataListeners"),Zn=Symbol("discarded"),af=i(e=>Promise.resolve().then(e),"defer"),Tde=i(e=>e(),"nodefer"),Pde=i(e=>e==="end"||e==="finish"||e==="prefinish","isEndish"),kde=i(e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,"isArrayBufferLike"),Ode=i(e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),"isArrayBufferView"),Om=class{static{i(this,"Pipe")}src;dest;opts;ondrain;constructor(t,r,n){this.src=t,this.dest=r,this.opts=n,this.ondrain=()=>t[bl](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},XC=class extends Om{static{i(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,r,n){super(t,r,n),this.proxyErrors=s=>r.emit("error",s),t.on("error",this.proxyErrors)}},Ide=i(e=>!!e.objectMode,"isObjectModeOptions"),Nde=i(e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer","isEncodingOptions"),zo=class extends Im.EventEmitter{static{i(this,"Minipass")}[Ar]=!1;[sf]=!1;[wn]=[];[Rr]=[];[Zr];[qs];[gi];[Sl];[ro]=!1;[Go]=!1;[Am]=!1;[Rm]=!1;[nf]=null;[Tr]=0;[Jt]=!1;[of];[km]=!1;[tc]=0;[Zn]=!1;writable=!0;readable=!0;constructor(...t){let r=t[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Ide(r)?(this[Zr]=!0,this[qs]=null):Nde(r)?(this[qs]=r.encoding,this[Zr]=!1):(this[Zr]=!1,this[qs]=null),this[gi]=!!r.async,this[Sl]=this[qs]?new iB.StringDecoder(this[qs]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:i(()=>this[Rr],"get")}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:i(()=>this[wn],"get")});let{signal:n}=r;n&&(this[of]=n,n.aborted?this[YC]():n.addEventListener("abort",()=>this[YC]()))}get bufferLength(){return this[Tr]}get encoding(){return this[qs]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Zr]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[gi]}set async(t){this[gi]=this[gi]||!!t}[YC](){this[km]=!0,this.emit("abort",this[of]?.reason),this.destroy(this[of]?.reason)}get aborted(){return this[km]}set aborted(t){}write(t,r,n){if(this[km])return!1;if(this[ro])throw new Error("write after end");if(this[Jt])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(n=r,r="utf8"),r||(r="utf8");let s=this[gi]?af:Tde;if(!this[Zr]&&!Buffer.isBuffer(t)){if(Ode(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(kde(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Zr]?(this[Ar]&&this[Tr]!==0&&this[Tm](!0),this[Ar]?this.emit("data",t):this[zC](t),this[Tr]!==0&&this.emit("readable"),n&&s(n),this[Ar]):t.length?(typeof t=="string"&&!(r===this[qs]&&!this[Sl]?.lastNeed)&&(t=Buffer.from(t,r)),Buffer.isBuffer(t)&&this[qs]&&(t=this[Sl].write(t)),this[Ar]&&this[Tr]!==0&&this[Tm](!0),this[Ar]?this.emit("data",t):this[zC](t),this[Tr]!==0&&this.emit("readable"),n&&s(n),this[Ar]):(this[Tr]!==0&&this.emit("readable"),n&&s(n),this[Ar])}read(t){if(this[Jt])return null;if(this[Zn]=!1,this[Tr]===0||t===0||t&&t>this[Tr])return this[no](),null;this[Zr]&&(t=null),this[Rr].length>1&&!this[Zr]&&(this[Rr]=[this[qs]?this[Rr].join(""):Buffer.concat(this[Rr],this[Tr])]);let r=this[rB](t||null,this[Rr][0]);return this[no](),r}[rB](t,r){if(this[Zr])this[Pm]();else{let n=r;t===n.length||t===null?this[Pm]():typeof n=="string"?(this[Rr][0]=n.slice(t),r=n.slice(0,t),this[Tr]-=t):(this[Rr][0]=n.subarray(t),r=n.subarray(0,t),this[Tr]-=t)}return this.emit("data",r),!this[Rr].length&&!this[ro]&&this.emit("drain"),r}end(t,r,n){return typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r="utf8"),t!==void 0&&this.write(t,r),n&&this.once("end",n),this[ro]=!0,this.writable=!1,(this[Ar]||!this[sf])&&this[no](),this}[bl](){this[Jt]||(!this[tc]&&!this[wn].length&&(this[Zn]=!0),this[sf]=!1,this[Ar]=!0,this.emit("resume"),this[Rr].length?this[Tm]():this[ro]?this[no]():this.emit("drain"))}resume(){return this[bl]()}pause(){this[Ar]=!1,this[sf]=!0,this[Zn]=!1}get destroyed(){return this[Jt]}get flowing(){return this[Ar]}get paused(){return this[sf]}[zC](t){this[Zr]?this[Tr]+=1:this[Tr]+=t.length,this[Rr].push(t)}[Pm](){return this[Zr]?this[Tr]-=1:this[Tr]-=this[Rr][0].length,this[Rr].shift()}[Tm](t=!1){do;while(this[nB](this[Pm]())&&this[Rr].length);!t&&!this[Rr].length&&!this[ro]&&this.emit("drain")}[nB](t){return this.emit("data",t),this[Ar]}pipe(t,r){if(this[Jt])return t;this[Zn]=!1;let n=this[Go];return r=r||{},t===tB.stdout||t===tB.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,n?r.end&&t.end():(this[wn].push(r.proxyErrors?new XC(this,t,r):new Om(this,t,r)),this[gi]?af(()=>this[bl]()):this[bl]()),t}unpipe(t){let r=this[wn].find(n=>n.dest===t);r&&(this[wn].length===1?(this[Ar]&&this[tc]===0&&(this[Ar]=!1),this[wn]=[]):this[wn].splice(this[wn].indexOf(r),1),r.unpipe())}addListener(t,r){return this.on(t,r)}on(t,r){let n=super.on(t,r);if(t==="data")this[Zn]=!1,this[tc]++,!this[wn].length&&!this[Ar]&&this[bl]();else if(t==="readable"&&this[Tr]!==0)super.emit("readable");else if(Pde(t)&&this[Go])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[nf]){let s=r;this[gi]?af(()=>s.call(this,this[nf])):s.call(this,this[nf])}return n}removeListener(t,r){return this.off(t,r)}off(t,r){let n=super.off(t,r);return t==="data"&&(this[tc]=this.listeners("data").length,this[tc]===0&&!this[Zn]&&!this[wn].length&&(this[Ar]=!1)),n}removeAllListeners(t){let r=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[tc]=0,!this[Zn]&&!this[wn].length&&(this[Ar]=!1)),r}get emittedEnd(){return this[Go]}[no](){!this[Am]&&!this[Go]&&!this[Jt]&&this[Rr].length===0&&this[ro]&&(this[Am]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Rm]&&this.emit("close"),this[Am]=!1)}emit(t,...r){let n=r[0];if(t!=="error"&&t!=="close"&&t!==Jt&&this[Jt])return!1;if(t==="data")return!this[Zr]&&!n?!1:this[gi]?(af(()=>this[WC](n)),!0):this[WC](n);if(t==="end")return this[sB]();if(t==="close"){if(this[Rm]=!0,!this[Go]&&!this[Jt])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(t==="error"){this[nf]=n,super.emit(VC,n);let o=!this[of]||this.listeners("error").length?super.emit("error",n):!1;return this[no](),o}else if(t==="resume"){let o=super.emit("resume");return this[no](),o}else if(t==="finish"||t==="prefinish"){let o=super.emit(t);return this.removeAllListeners(t),o}let s=super.emit(t,...r);return this[no](),s}[WC](t){for(let n of this[wn])n.dest.write(t)===!1&&this.pause();let r=this[Zn]?!1:super.emit("data",t);return this[no](),r}[sB](){return this[Go]?!1:(this[Go]=!0,this.readable=!1,this[gi]?(af(()=>this[KC]()),!0):this[KC]())}[KC](){if(this[Sl]){let r=this[Sl].end();if(r){for(let n of this[wn])n.dest.write(r);this[Zn]||super.emit("data",r)}}for(let r of this[wn])r.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[Zr]||(t.dataLength=0);let r=this.promise();return this.on("data",n=>{t.push(n),this[Zr]||(t.dataLength+=n.length)}),await r,t}async concat(){if(this[Zr])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[qs]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,r)=>{this.on(Jt,()=>r(new Error("stream destroyed"))),this.on("error",n=>r(n)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[Zn]=!1;let t=!1,r=i(async()=>(this.pause(),t=!0,{value:void 0,done:!0}),"stop");return{next:i(()=>{if(t)return r();let s=this.read();if(s!==null)return Promise.resolve({done:!1,value:s});if(this[ro])return r();let o,a,c=i(f=>{this.off("data",l),this.off("end",u),this.off(Jt,d),r(),a(f)},"onerr"),l=i(f=>{this.off("error",c),this.off("end",u),this.off(Jt,d),this.pause(),o({value:f,done:!!this[ro]})},"ondata"),u=i(()=>{this.off("error",c),this.off("data",l),this.off(Jt,d),r(),o({done:!0,value:void 0})},"onend"),d=i(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((f,m)=>{a=m,o=f,this.once(Jt,d),this.once("error",c),this.once("end",u),this.once("data",l)})},"next"),throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Zn]=!1;let t=!1,r=i(()=>(this.pause(),this.off(VC,r),this.off(Jt,r),this.off("end",r),t=!0,{done:!0,value:void 0}),"stop"),n=i(()=>{if(t)return r();let s=this.read();return s===null?r():{done:!1,value:s}},"next");return this.once("end",r),this.once(VC,r),this.once(Jt,r),{next:n,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(t){if(this[Jt])return t?this.emit("error",t):this.emit(Jt),this;this[Jt]=!0,this[Zn]=!0,this[Rr].length=0,this[Tr]=0;let r=this;return typeof r.close=="function"&&!this[Rm]&&r.close(),t?this.emit("error",t):this.emit(Jt),this}static get isStream(){return vde}};var Cl=require("node:path"),EB=require("node:url"),Ei=require("fs"),Dde=k(require("node:fs"),1),Vo=require("node:fs/promises"),Bde=Ei.realpathSync.native,cf={lstatSync:Ei.lstatSync,readdir:Ei.readdir,readdirSync:Ei.readdirSync,readlinkSync:Ei.readlinkSync,realpathSync:Bde,promises:{lstat:Vo.lstat,readdir:Vo.readdir,readlink:Vo.readlink,realpath:Vo.realpath}},oB=i(e=>!e||e===cf||e===Dde?cf:{...cf,...e,promises:{...cf.promises,...e.promises||{}}},"fsFromOption"),aB=/^\\\\\?\\([a-z]:)\\?$/i,Mde=i(e=>e.replace(/\//g,"\\").replace(aB,"$1\\"),"uncToDrive"),$de=/[\\\/]/,Ss=0,cB=1,lB=2,yi=4,uB=6,dB=8,rc=10,fB=12,bs=15,lf=~bs,QC=16,hB=32,uf=64,Hs=128,Nm=256,Dm=512,pB=uf|Hs|Dm,Lde=1023,ZC=i(e=>e.isFile()?dB:e.isDirectory()?yi:e.isSymbolicLink()?rc:e.isCharacterDevice()?lB:e.isBlockDevice()?uB:e.isSocket()?fB:e.isFIFO()?cB:Ss,"entToType"),mB=new Map,df=i(e=>{let t=mB.get(e);if(t)return t;let r=e.normalize("NFKD");return mB.set(e,r),r},"normalize"),gB=new Map,Bm=i(e=>{let t=gB.get(e);if(t)return t;let r=df(e.toLowerCase());return gB.set(e,r),r},"normalizeNocase"),Mm=class extends rf{static{i(this,"ResolveCache")}constructor(){super({max:256})}},ex=class extends rf{static{i(this,"ChildrenCache")}constructor(t=16*1024){super({maxSize:t,sizeCalculation:i(r=>r.length+1,"sizeCalculation")})}},yB=Symbol("PathScurry setAsCwd"),en=class{static{i(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#t;#r;get dev(){return this.#r}#n;get mode(){return this.#n}#e;get nlink(){return this.#e}#o;get uid(){return this.#o}#c;get gid(){return this.#c}#l;get rdev(){return this.#l}#d;get blksize(){return this.#d}#u;get ino(){return this.#u}#a;get size(){return this.#a}#s;get blocks(){return this.#s}#y;get atimeMs(){return this.#y}#p;get mtimeMs(){return this.#p}#m;get ctimeMs(){return this.#m}#g;get birthtimeMs(){return this.#g}#v;get atime(){return this.#v}#E;get mtime(){return this.#E}#C;get ctime(){return this.#C}#x;get birthtime(){return this.#x}#S;#w;#_;#h;#R;#A;#i;#k;#b;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,r=Ss,n,s,o,a,c){this.name=t,this.#S=o?Bm(t):df(t),this.#i=r&Lde,this.nocase=o,this.roots=s,this.root=n||this,this.#k=a,this.#_=c.fullpath,this.#R=c.relative,this.#A=c.relativePosix,this.parent=c.parent,this.parent?this.#t=this.parent.#t:this.#t=oB(c.fs)}depth(){return this.#w!==void 0?this.#w:this.parent?this.#w=this.parent.depth()+1:this.#w=0}childrenCache(){return this.#k}resolve(t){if(!t)return this;let r=this.getRootString(t),s=t.substring(r.length).split(this.splitSep);return r?this.getRoot(r).#N(s):this.#N(s)}#N(t){let r=this;for(let n of t)r=r.child(n);return r}children(){let t=this.#k.get(this);if(t)return t;let r=Object.assign([],{provisional:0});return this.#k.set(this,r),this.#i&=~QC,r}child(t,r){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let n=this.children(),s=this.nocase?Bm(t):df(t);for(let l of n)if(l.#S===s)return l;let o=this.parent?this.sep:"",a=this.#_?this.#_+o+t:void 0,c=this.newChild(t,Ss,{...r,parent:this,fullpath:a});return this.canReaddir()||(c.#i|=Hs),n.push(c),c}relative(){if(this.isCWD)return"";if(this.#R!==void 0)return this.#R;let t=this.name,r=this.parent;if(!r)return this.#R=this.name;let n=r.relative();return n+(!n||!r.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let t=this.name,r=this.parent;if(!r)return this.#A=this.fullpathPosix();let n=r.relativePosix();return n+(!n||!r.parent?"":"/")+t}fullpath(){if(this.#_!==void 0)return this.#_;let t=this.name,r=this.parent;if(!r)return this.#_=this.name;let s=r.fullpath()+(r.parent?this.sep:"")+t;return this.#_=s}fullpathPosix(){if(this.#h!==void 0)return this.#h;if(this.sep==="/")return this.#h=this.fullpath();if(!this.parent){let s=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(s)?this.#h=`//?/${s}`:this.#h=s}let t=this.parent,r=t.fullpathPosix(),n=r+(!r||!t.parent?"":"/")+this.name;return this.#h=n}isUnknown(){return(this.#i&bs)===Ss}isType(t){return this[`is${t}`]()}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.#i&bs)===dB}isDirectory(){return(this.#i&bs)===yi}isCharacterDevice(){return(this.#i&bs)===lB}isBlockDevice(){return(this.#i&bs)===uB}isFIFO(){return(this.#i&bs)===cB}isSocket(){return(this.#i&bs)===fB}isSymbolicLink(){return(this.#i&rc)===rc}lstatCached(){return this.#i&hB?this:void 0}readlinkCached(){return this.#b}realpathCached(){return this.#O}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#b)return!0;if(!this.parent)return!1;let t=this.#i&bs;return!(t!==Ss&&t!==rc||this.#i&Nm||this.#i&Hs)}calledReaddir(){return!!(this.#i&QC)}isENOENT(){return!!(this.#i&Hs)}isNamed(t){return this.nocase?this.#S===Bm(t):this.#S===df(t)}async readlink(){let t=this.#b;if(t)return t;if(this.canReadlink()&&this.parent)try{let r=await this.#t.promises.readlink(this.fullpath()),n=(await this.parent.realpath())?.resolve(r);if(n)return this.#b=n}catch(r){this.#f(r.code);return}}readlinkSync(){let t=this.#b;if(t)return t;if(this.canReadlink()&&this.parent)try{let r=this.#t.readlinkSync(this.fullpath()),n=this.parent.realpathSync()?.resolve(r);if(n)return this.#b=n}catch(r){this.#f(r.code);return}}#D(t){this.#i|=QC;for(let r=t.provisional;r<t.length;r++){let n=t[r];n&&n.#B()}}#B(){this.#i&Hs||(this.#i=(this.#i|Hs)&lf,this.#T())}#T(){let t=this.children();t.provisional=0;for(let r of t)r.#B()}#P(){this.#i|=Dm,this.#M()}#M(){if(this.#i&uf)return;let t=this.#i;(t&bs)===yi&&(t&=lf),this.#i=t|uf,this.#T()}#$(t=""){t==="ENOTDIR"||t==="EPERM"?this.#M():t==="ENOENT"?this.#B():this.children().provisional=0}#L(t=""){t==="ENOTDIR"?this.parent.#M():t==="ENOENT"&&this.#B()}#f(t=""){let r=this.#i;r|=Nm,t==="ENOENT"&&(r|=Hs),(t==="EINVAL"||t==="UNKNOWN")&&(r&=lf),this.#i=r,t==="ENOTDIR"&&this.parent&&this.parent.#M()}#F(t,r){return this.#I(t,r)||this.#j(t,r)}#j(t,r){let n=ZC(t),s=this.newChild(t.name,n,{parent:this}),o=s.#i&bs;return o!==yi&&o!==rc&&o!==Ss&&(s.#i|=uf),r.unshift(s),r.provisional++,s}#I(t,r){for(let n=r.provisional;n<r.length;n++){let s=r[n];if((this.nocase?Bm(t.name):df(t.name))===s.#S)return this.#U(t,s,n,r)}}#U(t,r,n,s){let o=r.name;return r.#i=r.#i&lf|ZC(t),o!==t.name&&(r.name=t.name),n!==s.provisional&&(n===s.length-1?s.pop():s.splice(n,1),s.unshift(r)),s.provisional++,r}async lstat(){if((this.#i&Hs)===0)try{return this.#z(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#L(t.code)}}lstatSync(){if((this.#i&Hs)===0)try{return this.#z(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#L(t.code)}}#z(t){let{atime:r,atimeMs:n,birthtime:s,birthtimeMs:o,blksize:a,blocks:c,ctime:l,ctimeMs:u,dev:d,gid:f,ino:m,mode:g,mtime:E,mtimeMs:w,nlink:_,rdev:v,size:N,uid:$}=t;this.#v=r,this.#y=n,this.#x=s,this.#g=o,this.#d=a,this.#s=c,this.#C=l,this.#m=u,this.#r=d,this.#c=f,this.#u=m,this.#n=g,this.#E=E,this.#p=w,this.#e=_,this.#l=v,this.#a=N,this.#o=$;let j=ZC(t);this.#i=this.#i&lf|j|hB,j!==Ss&&j!==yi&&j!==rc&&(this.#i|=uf)}#H=[];#G=!1;#V(t){this.#G=!1;let r=this.#H.slice();this.#H.length=0,r.forEach(n=>n(null,t))}readdirCB(t,r=!1){if(!this.canReaddir()){r?t(null,[]):queueMicrotask(()=>t(null,[]));return}let n=this.children();if(this.calledReaddir()){let o=n.slice(0,n.provisional);r?t(null,o):queueMicrotask(()=>t(null,o));return}if(this.#H.push(t),this.#G)return;this.#G=!0;let s=this.fullpath();this.#t.readdir(s,{withFileTypes:!0},(o,a)=>{if(o)this.#$(o.code),n.provisional=0;else{for(let c of a)this.#F(c,n);this.#D(n)}this.#V(n.slice(0,n.provisional))})}#q;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let r=this.fullpath();if(this.#q)await this.#q;else{let n=i(()=>{},"resolve");this.#q=new Promise(s=>n=s);try{for(let s of await this.#t.promises.readdir(r,{withFileTypes:!0}))this.#F(s,t);this.#D(t)}catch(s){this.#$(s.code),t.provisional=0}this.#q=void 0,n()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let r=this.fullpath();try{for(let n of this.#t.readdirSync(r,{withFileTypes:!0}))this.#F(n,t);this.#D(t)}catch(n){this.#$(n.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#i&pB)return!1;let t=bs&this.#i;return t===Ss||t===yi||t===rc}shouldWalk(t,r){return(this.#i&yi)===yi&&!(this.#i&pB)&&!t.has(this)&&(!r||r(this))}async realpath(){if(this.#O)return this.#O;if(!((Dm|Nm|Hs)&this.#i))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#O=this.resolve(t)}catch{this.#P()}}realpathSync(){if(this.#O)return this.#O;if(!((Dm|Nm|Hs)&this.#i))try{let t=this.#t.realpathSync(this.fullpath());return this.#O=this.resolve(t)}catch{this.#P()}}[yB](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let r=new Set([]),n=[],s=this;for(;s&&s.parent;)r.add(s),s.#R=n.join(this.sep),s.#A=n.join("/"),s=s.parent,n.push("..");for(s=t;s&&s.parent&&!r.has(s);)s.#R=void 0,s.#A=void 0,s=s.parent}},$m=class e extends en{static{i(this,"PathWin32")}sep="\\";splitSep=$de;constructor(t,r=Ss,n,s,o,a,c){super(t,r,n,s,o,a,c)}newChild(t,r=Ss,n={}){return new e(t,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(t){return Cl.win32.parse(t).root}getRoot(t){if(t=Mde(t.toUpperCase()),t===this.root.name)return this.root;for(let[r,n]of Object.entries(this.roots))if(this.sameRoot(t,r))return this.roots[t]=n;return this.roots[t]=new wl(t,this).root}sameRoot(t,r=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(aB,"$1\\"),t===r}},Lm=class e extends en{static{i(this,"PathPosix")}splitSep="/";sep="/";constructor(t,r=Ss,n,s,o,a,c){super(t,r,n,s,o,a,c)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,r=Ss,n={}){return new e(t,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}},Fm=class{static{i(this,"PathScurryBase")}root;rootPath;roots;cwd;#t;#r;#n;nocase;#e;constructor(t=process.cwd(),r,n,{nocase:s,childrenCacheSize:o=16*1024,fs:a=cf}={}){this.#e=oB(a),(t instanceof URL||t.startsWith("file://"))&&(t=(0,EB.fileURLToPath)(t));let c=r.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#t=new Mm,this.#r=new Mm,this.#n=new ex(o);let l=c.substring(this.rootPath.length).split(n);if(l.length===1&&!l[0]&&l.pop(),s===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=s,this.root=this.newRoot(this.#e),this.roots[this.rootPath]=this.root;let u=this.root,d=l.length-1,f=r.sep,m=this.rootPath,g=!1;for(let E of l){let w=d--;u=u.child(E,{relative:new Array(w).fill("..").join(f),relativePosix:new Array(w).fill("..").join("/"),fullpath:m+=(g?"":f)+E}),g=!0}this.cwd=u}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#n}resolve(...t){let r="";for(let o=t.length-1;o>=0;o--){let a=t[o];if(!(!a||a===".")&&(r=r?`${a}/${r}`:a,this.isAbsolute(a)))break}let n=this.#t.get(r);if(n!==void 0)return n;let s=this.cwd.resolve(r).fullpath();return this.#t.set(r,s),s}resolvePosix(...t){let r="";for(let o=t.length-1;o>=0;o--){let a=t[o];if(!(!a||a===".")&&(r=r?`${a}/${r}`:a,this.isAbsolute(a)))break}let n=this.#r.get(r);if(n!==void 0)return n;let s=this.cwd.resolve(r).fullpathPosix();return this.#r.set(r,s),s}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,r={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd);let{withFileTypes:n}=r;if(t.canReaddir()){let s=await t.readdir();return n?s:s.map(o=>o.name)}else return[]}readdirSync(t=this.cwd,r={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd);let{withFileTypes:n=!0}=r;return t.canReaddir()?n?t.readdirSync():t.readdirSync().map(s=>s.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t.withFileTypes,t=this.cwd);let n=await t.readlink();return r?n:n?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t.withFileTypes,t=this.cwd);let n=t.readlinkSync();return r?n:n?.fullpath()}async realpath(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t.withFileTypes,t=this.cwd);let n=await t.realpath();return r?n:n?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t.withFileTypes,t=this.cwd);let n=t.realpathSync();return r?n:n?.fullpath()}async walk(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:a}=r,c=[];(!o||o(t))&&c.push(n?t:t.fullpath());let l=new Set,u=i((f,m)=>{l.add(f),f.readdirCB((g,E)=>{if(g)return m(g);let w=E.length;if(!w)return m();let _=i(()=>{--w===0&&m()},"next");for(let v of E)(!o||o(v))&&c.push(n?v:v.fullpath()),s&&v.isSymbolicLink()?v.realpath().then(N=>N?.isUnknown()?N.lstat():N).then(N=>N?.shouldWalk(l,a)?u(N,_):_()):v.shouldWalk(l,a)?u(v,_):_()},!0)},"walk"),d=t;return new Promise((f,m)=>{u(d,g=>{if(g)return m(g);f(c)})})}walkSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:a}=r,c=[];(!o||o(t))&&c.push(n?t:t.fullpath());let l=new Set([t]);for(let u of l){let d=u.readdirSync();for(let f of d){(!o||o(f))&&c.push(n?f:f.fullpath());let m=f;if(f.isSymbolicLink()){if(!(s&&(m=f.realpathSync())))continue;m.isUnknown()&&m.lstatSync()}m.shouldWalk(l,a)&&l.add(m)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,r={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd),this.stream(t,r)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:a}=r;(!o||o(t))&&(yield n?t:t.fullpath());let c=new Set([t]);for(let l of c){let u=l.readdirSync();for(let d of u){(!o||o(d))&&(yield n?d:d.fullpath());let f=d;if(d.isSymbolicLink()){if(!(s&&(f=d.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(c,a)&&c.add(f)}}}stream(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:a}=r,c=new zo({objectMode:!0});(!o||o(t))&&c.write(n?t:t.fullpath());let l=new Set,u=[t],d=0,f=i(()=>{let m=!1;for(;!m;){let g=u.shift();if(!g){d===0&&c.end();return}d++,l.add(g);let E=i((_,v,N=!1)=>{if(_)return c.emit("error",_);if(s&&!N){let $=[];for(let j of v)j.isSymbolicLink()&&$.push(j.realpath().then(se=>se?.isUnknown()?se.lstat():se));if($.length){Promise.all($).then(()=>E(null,v,!0));return}}for(let $ of v)$&&(!o||o($))&&(c.write(n?$:$.fullpath())||(m=!0));d--;for(let $ of v){let j=$.realpathCached()||$;j.shouldWalk(l,a)&&u.push(j)}m&&!c.flowing?c.once("drain",f):w||f()},"onReaddir"),w=!0;g.readdirCB(E,!0),w=!1}},"process");return f(),c}streamSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:a}=r,c=new zo({objectMode:!0}),l=new Set;(!o||o(t))&&c.write(n?t:t.fullpath());let u=[t],d=0,f=i(()=>{let m=!1;for(;!m;){let g=u.shift();if(!g){d===0&&c.end();return}d++,l.add(g);let E=g.readdirSync();for(let w of E)(!o||o(w))&&(c.write(n?w:w.fullpath())||(m=!0));d--;for(let w of E){let _=w;if(w.isSymbolicLink()){if(!(s&&(_=w.realpathSync())))continue;_.isUnknown()&&_.lstatSync()}_.shouldWalk(l,a)&&u.push(_)}}m&&!c.flowing&&c.once("drain",f)},"process");return f(),c}chdir(t=this.cwd){let r=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[yB](r)}},wl=class extends Fm{static{i(this,"PathScurryWin32")}sep="\\";constructor(t=process.cwd(),r={}){let{nocase:n=!0}=r;super(t,Cl.win32,"\\",{...r,nocase:n}),this.nocase=n;for(let s=this.cwd;s;s=s.parent)s.nocase=this.nocase}parseRootPath(t){return Cl.win32.parse(t).root.toUpperCase()}newRoot(t){return new $m(this.rootPath,yi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},_l=class extends Fm{static{i(this,"PathScurryPosix")}sep="/";constructor(t=process.cwd(),r={}){let{nocase:n=!1}=r;super(t,Cl.posix,"/",{...r,nocase:n}),this.nocase=n}parseRootPath(t){return"/"}newRoot(t){return new Lm(this.rootPath,yi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},ff=class extends _l{static{i(this,"PathScurryDarwin")}constructor(t=process.cwd(),r={}){let{nocase:n=!0}=r;super(t,{...r,nocase:n})}},Nze=process.platform==="win32"?$m:Lm,SB=process.platform==="win32"?wl:process.platform==="darwin"?ff:_l;var Fde=i(e=>e.length>=1,"isPatternList"),jde=i(e=>e.length>=1,"isGlobList"),xl=class e{static{i(this,"Pattern")}#t;#r;#n;length;#e;#o;#c;#l;#d;#u;#a=!0;constructor(t,r,n,s){if(!Fde(t))throw new TypeError("empty pattern list");if(!jde(r))throw new TypeError("empty glob list");if(r.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,n<0||n>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#r=r,this.#n=n,this.#e=s,this.#n===0){if(this.isUNC()){let[o,a,c,l,...u]=this.#t,[d,f,m,g,...E]=this.#r;u[0]===""&&(u.shift(),E.shift());let w=[o,a,c,l,""].join("/"),_=[d,f,m,g,""].join("/");this.#t=[w,...u],this.#r=[_,...E],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[o,...a]=this.#t,[c,...l]=this.#r;a[0]===""&&(a.shift(),l.shift());let u=o+"/",d=c+"/";this.#t=[u,...a],this.#r=[d,...l],this.length=this.#t.length}}}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===Gr}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#c=this.#c||(this.#n===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new e(this.#t,this.#r,this.#n+1,this.#e),this.#o.#u=this.#u,this.#o.#d=this.#d,this.#o.#l=this.#l,this.#o):this.#o=null}isUNC(){let t=this.#t;return this.#d!==void 0?this.#d:this.#d=this.#e==="win32"&&this.#n===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#l!==void 0?this.#l:this.#l=this.#e==="win32"&&this.#n===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#u!==void 0?this.#u:this.#u=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#n===0?t:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#a)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#a?!1:(this.#a=!1,!0)}};var Ude=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",vl=class{static{i(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:r,nocase:n,noext:s,noglobstar:o,platform:a=Ude}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:r,nocase:n,noext:s,noglobstar:o,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let c of t)this.add(c)}add(t){let r=new Qn(t,this.mmopts);for(let n=0;n<r.set.length;n++){let s=r.set[n],o=r.globParts[n];if(!s||!o)throw new Error("invalid pattern object");for(;s[0]==="."&&o[0]===".";)s.shift(),o.shift();let a=new xl(s,o,0,this.platform),c=new Qn(a.globString(),this.mmopts),l=o[o.length-1]==="**",u=a.isAbsolute();u?this.absolute.push(c):this.relative.push(c),l&&(u?this.absoluteChildren.push(c):this.relativeChildren.push(c))}}ignored(t){let r=t.fullpath(),n=`${r}/`,s=t.relative()||".",o=`${s}/`;for(let a of this.relative)if(a.match(s)||a.match(o))return!0;for(let a of this.absolute)if(a.match(r)||a.match(n))return!0;return!1}childrenIgnored(t){let r=t.fullpath()+"/",n=(t.relative()||".")+"/";for(let s of this.relativeChildren)if(s.match(n))return!0;for(let s of this.absoluteChildren)if(s.match(r))return!0;return!1}};var tx=class e{static{i(this,"HasWalkedCache")}store;constructor(t=new Map){this.store=t}copy(){return new e(new Map(this.store))}hasWalked(t,r){return this.store.get(t.fullpath())?.has(r.globString())}storeWalked(t,r){let n=t.fullpath(),s=this.store.get(n);s?s.add(r.globString()):this.store.set(n,new Set([r.globString()]))}},rx=class{static{i(this,"MatchRecord")}store=new Map;add(t,r,n){let s=(r?2:0)|(n?1:0),o=this.store.get(t);this.store.set(t,o===void 0?s:s&o)}entries(){return[...this.store.entries()].map(([t,r])=>[t,!!(r&2),!!(r&1)])}},nx=class{static{i(this,"SubWalks")}store=new Map;add(t,r){if(!t.canReaddir())return;let n=this.store.get(t);n?n.find(s=>s.globString()===r.globString())||n.push(r):this.store.set(t,[r])}get(t){let r=this.store.get(t);if(!r)throw new Error("attempting to walk unknown path");return r}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},hf=class e{static{i(this,"Processor")}hasWalkedCache;matches=new rx;subwalks=new nx;patterns;follow;dot;opts;constructor(t,r){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=r?r.copy():new tx}processPatterns(t,r){this.patterns=r;let n=r.map(s=>[t,s]);for(let[s,o]of n){this.hasWalkedCache.storeWalked(s,o);let a=o.root(),c=o.isAbsolute()&&this.opts.absolute!==!1;if(a){s=s.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let f=o.rest();if(f)o=f;else{this.matches.add(s,!0,!1);continue}}if(s.isENOENT())continue;let l,u,d=!1;for(;typeof(l=o.pattern())=="string"&&(u=o.rest());)s=s.resolve(l),o=u,d=!0;if(l=o.pattern(),u=o.rest(),d){if(this.hasWalkedCache.hasWalked(s,o))continue;this.hasWalkedCache.storeWalked(s,o)}if(typeof l=="string"){let f=l===".."||l===""||l===".";this.matches.add(s.resolve(l),c,f);continue}else if(l===Gr){(!s.isSymbolicLink()||this.follow||o.checkFollowGlobstar())&&this.subwalks.add(s,o);let f=u?.pattern(),m=u?.rest();if(!u||(f===""||f===".")&&!m)this.matches.add(s,c,f===""||f===".");else if(f===".."){let g=s.parent||s;m?this.hasWalkedCache.hasWalked(g,m)||this.subwalks.add(g,m):this.matches.add(g,c,!0)}}else l instanceof RegExp&&this.subwalks.add(s,o)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new e(this.opts,this.hasWalkedCache)}filterEntries(t,r){let n=this.subwalks.get(t),s=this.child();for(let o of r)for(let a of n){let c=a.isAbsolute(),l=a.pattern(),u=a.rest();l===Gr?s.testGlobstar(o,a,u,c):l instanceof RegExp?s.testRegExp(o,l,u,c):s.testString(o,l,u,c)}return s}testGlobstar(t,r,n,s){if((this.dot||!t.name.startsWith("."))&&(r.hasMore()||this.matches.add(t,s,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,r):t.isSymbolicLink()&&(n&&r.checkFollowGlobstar()?this.subwalks.add(t,n):r.markFollowGlobstar()&&this.subwalks.add(t,r)))),n){let o=n.pattern();if(typeof o=="string"&&o!==".."&&o!==""&&o!==".")this.testString(t,o,n.rest(),s);else if(o===".."){let a=t.parent||t;this.subwalks.add(a,n)}else o instanceof RegExp&&this.testRegExp(t,o,n.rest(),s)}}testRegExp(t,r,n,s){r.test(t.name)&&(n?this.subwalks.add(t,n):this.matches.add(t,s,!1))}testString(t,r,n,s){t.isNamed(r)&&(n?this.subwalks.add(t,n):this.matches.add(t,s,!1))}};var qde=i((e,t)=>typeof e=="string"?new vl([e],t):Array.isArray(e)?new vl(e,t):e,"makeIgnore"),jm=class{static{i(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#r;#n;signal;maxDepth;includeChildMatches;constructor(t,r,n){if(this.patterns=t,this.path=r,this.opts=n,this.#n=!n.posix&&n.platform==="win32"?"\\":"/",this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#r=qde(n.ignore??[],n),!this.includeChildMatches&&typeof this.#r.add!="function")){let s="cannot ignore child matches, ignore lacks add() method.";throw new Error(s)}this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#e(t){return this.seen.has(t)||!!this.#r?.ignored?.(t)}#o(t){return!!this.#r?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=t.realpathCached()||await t.realpath(),!n)return;t=n}let o=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&o?.isSymbolicLink()){let a=await o.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.lstat()}return this.matchCheckTest(o,r)}matchCheckTest(t,r){return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!r||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#e(t)?t:void 0}matchCheckSync(t,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=t.realpathCached()||t.realpathSync(),!n)return;t=n}let o=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&o?.isSymbolicLink()){let a=o.realpathSync();a&&(a?.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(o,r)}matchFinish(t,r){if(this.#e(t))return;if(!this.includeChildMatches&&this.#r?.add){let o=`${t.relativePosix()}/**`;this.#r.add(o)}let n=this.opts.absolute===void 0?r:this.opts.absolute;this.seen.add(t);let s=this.opts.mark&&t.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(n){let o=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(o+s)}else{let o=this.opts.posix?t.relativePosix():t.relative(),a=this.opts.dotRelative&&!o.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(o?a+o+s:"."+s)}}async match(t,r,n){let s=await this.matchCheck(t,n);s&&this.matchFinish(s,r)}matchSync(t,r,n){let s=this.matchCheckSync(t,n);s&&this.matchFinish(s,r)}walkCB(t,r,n){this.signal?.aborted&&n(),this.walkCB2(t,r,new hf(this.opts),n)}walkCB2(t,r,n,s){if(this.#o(t))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2(t,r,n,s));return}n.processPatterns(t,r);let o=1,a=i(()=>{--o===0&&s()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||(o++,this.match(c,l,u).then(()=>a()));for(let c of n.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;o++;let l=c.readdirCached();c.calledReaddir()?this.walkCB3(c,l,n,a):c.readdirCB((u,d)=>this.walkCB3(c,d,n,a),!0)}a()}walkCB3(t,r,n,s){n=n.filterEntries(t,r);let o=1,a=i(()=>{--o===0&&s()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||(o++,this.match(c,l,u).then(()=>a()));for(let[c,l]of n.subwalks.entries())o++,this.walkCB2(c,l,n.child(),a);a()}walkCBSync(t,r,n){this.signal?.aborted&&n(),this.walkCB2Sync(t,r,new hf(this.opts),n)}walkCB2Sync(t,r,n,s){if(this.#o(t))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2Sync(t,r,n,s));return}n.processPatterns(t,r);let o=1,a=i(()=>{--o===0&&s()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||this.matchSync(c,l,u);for(let c of n.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;o++;let l=c.readdirSync();this.walkCB3Sync(c,l,n,a)}a()}walkCB3Sync(t,r,n,s){n=n.filterEntries(t,r);let o=1,a=i(()=>{--o===0&&s()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||this.matchSync(c,l,u);for(let[c,l]of n.subwalks.entries())o++,this.walkCB2Sync(c,l,n.child(),a);a()}},pf=class extends jm{static{i(this,"GlobWalker")}matches=new Set;constructor(t,r,n){super(t,r,n)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,r)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?r(this.signal.reason):t(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},mf=class extends jm{static{i(this,"GlobStream")}results;constructor(t,r,n){super(t,r,n),this.results=new zo({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end())}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var bB=require("node:url"),Hde=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Gs=class{static{i(this,"Glob")}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(t,r){if(!r)throw new TypeError("glob options required");if(this.withFileTypes=!!r.withFileTypes,this.signal=r.signal,this.follow=!!r.follow,this.dot=!!r.dot,this.dotRelative=!!r.dotRelative,this.nodir=!!r.nodir,this.mark=!!r.mark,r.cwd?(r.cwd instanceof URL||r.cwd.startsWith("file://"))&&(r.cwd=(0,bB.fileURLToPath)(r.cwd)):this.cwd="",this.cwd=r.cwd||"",this.root=r.root,this.magicalBraces=!!r.magicalBraces,this.nobrace=!!r.nobrace,this.noext=!!r.noext,this.realpath=!!r.realpath,this.absolute=r.absolute,this.includeChildMatches=r.includeChildMatches!==!1,this.noglobstar=!!r.noglobstar,this.matchBase=!!r.matchBase,this.maxDepth=typeof r.maxDepth=="number"?r.maxDepth:1/0,this.stat=!!r.stat,this.ignore=r.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(r.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=t,this.platform=r.platform||Hde,this.opts={...r,platform:this.platform},r.scurry){if(this.scurry=r.scurry,r.nocase!==void 0&&r.nocase!==r.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=r.platform==="win32"?wl:r.platform==="darwin"?ff:r.platform?_l:SB;this.scurry=new l(this.cwd,{nocase:r.nocase,fs:r.fs})}this.nocase=this.scurry.nocase;let n=this.platform==="darwin"||this.platform==="win32",s={...r,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},o=this.pattern.map(l=>new Qn(l,s)),[a,c]=o.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=a.map((l,u)=>{let d=c[u];if(!d)throw new Error("invalid pattern object");return new xl(l,d,0,this.platform)})}async walk(){return[...await new pf(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 pf(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 mf(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 mf(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 sx=i((e,t={})=>{Array.isArray(e)||(e=[e]);for(let r of e)if(new Qn(r,t).hasMagic())return!0;return!1},"hasMagic");function Um(e,t={}){return new Gs(e,t).streamSync()}i(Um,"globStreamSync");function wB(e,t={}){return new Gs(e,t).stream()}i(wB,"globStream");function _B(e,t={}){return new Gs(e,t).walkSync()}i(_B,"globSync");async function CB(e,t={}){return new Gs(e,t).walk()}i(CB,"glob_");function qm(e,t={}){return new Gs(e,t).iterateSync()}i(qm,"globIterateSync");function xB(e,t={}){return new Gs(e,t).iterate()}i(xB,"globIterate");var Gde=Um,zde=Object.assign(wB,{sync:Um}),Vde=qm,Wde=Object.assign(xB,{sync:qm}),Kde=Object.assign(_B,{stream:Um,iterate:qm}),Hm=Object.assign(CB,{glob:CB,globSync:_B,sync:Kde,globStream:wB,stream:zde,globStreamSync:Um,streamSync:Gde,globIterate:xB,iterate:Wde,globIterateSync:qm,iterateSync:Vde,Glob:Gs,hasMagic:sx,escape:gl,unescape:Us});Hm.glob=Hm;var vB=require("node:path"),ix=k(Hn(),1);async function zs(...e){let t=await Hm(...e);return t.forEach((r,n)=>{t[n]=t[n].toString().replace(/\\/g,"/")}),t}i(zs,"normalizedGlob");function Gm(e){let t=process.cwd();return e!==t&&(e=(0,vB.resolve)(t,e)),e=e.replace(/\\/g,"/"),e}i(Gm,"getProjectDir");async function nc(e){return await ix.default.pathExists(e)?ix.default.readdir(e):[]}i(nc,"tryReadDir");var AB=k(require("node:os"),1),RB=require("node:path/posix"),Vs;function TB(e){Vs=e}i(TB,"setPVRTexToolAbsolutePath");async function PB(){if(process.env.PVRTexToolCLI)return Vs=process.env.PVRTexToolCLI;let e=AB.default.platform(),t=null;switch(e){case"darwin":t="/Applications/Imagination/";break;case"win32":t="C:/Imagination Technologies/";break;default:break}if(!t)return;let r=await zs((0,RB.join)(t,"**"),{nodir:!0});switch(e){case"darwin":return Vs=r.find(n=>n.endsWith("macOS/PVRTexToolCLI"));case"win32":return Vs=r.find(n=>n.endsWith("Windows_x86_64/PVRTexToolCLI.exe"))}}i(PB,"locatePVRTexTool");var Ve=require("node:path/posix"),ir=require("node:fs/promises"),or=k(Hn(),1);async function kB(e){await Promise.all([or.default.ensureDir((0,Ve.join)(e,"nodes")),or.default.ensureDir((0,Ve.join)(e,"meshes")),or.default.ensureDir((0,Ve.join)(e,"lods")),or.default.ensureDir((0,Ve.join)(e,"lights")),or.default.ensureDir((0,Ve.join)(e,"cameras")),or.default.ensureDir((0,Ve.join)(e,"geometries")),or.default.ensureDir((0,Ve.join)(e,"skeletons")),or.default.ensureDir((0,Ve.join)(e,"shadowGenerators")),or.default.ensureDir((0,Ve.join)(e,"sceneLinks")),or.default.ensureDir((0,Ve.join)(e,"gui")),or.default.ensureDir((0,Ve.join)(e,"sounds")),or.default.ensureDir((0,Ve.join)(e,"soundNodes")),or.default.ensureDir((0,Ve.join)(e,"particleSystems")),or.default.ensureDir((0,Ve.join)(e,"morphTargetManagers")),or.default.ensureDir((0,Ve.join)(e,"morphTargets")),or.default.ensureDir((0,Ve.join)(e,"animationGroups")),or.default.ensureDir((0,Ve.join)(e,"sprite-maps")),or.default.ensureDir((0,Ve.join)(e,"sprite-managers")),or.default.ensureDir((0,Ve.join)(e,"nodeParticleSystemSets"))])}i(kB,"ensureSceneDirectories");async function OB(e){let[t,r,n,s,o,a,c,l,u,d,f,m,g,E,w,_,v,N,$]=await Promise.all([(0,ir.readdir)((0,Ve.join)(e,"nodes")),(0,ir.readdir)((0,Ve.join)(e,"meshes")),(0,ir.readdir)((0,Ve.join)(e,"lods")),(0,ir.readdir)((0,Ve.join)(e,"lights")),(0,ir.readdir)((0,Ve.join)(e,"cameras")),(0,ir.readdir)((0,Ve.join)(e,"skeletons")),(0,ir.readdir)((0,Ve.join)(e,"shadowGenerators")),(0,ir.readdir)((0,Ve.join)(e,"sceneLinks")),(0,ir.readdir)((0,Ve.join)(e,"gui")),(0,ir.readdir)((0,Ve.join)(e,"sounds")),(0,ir.readdir)((0,Ve.join)(e,"soundNodes")),(0,ir.readdir)((0,Ve.join)(e,"particleSystems")),(0,ir.readdir)((0,Ve.join)(e,"morphTargetManagers")),(0,ir.readdir)((0,Ve.join)(e,"morphTargets")),(0,ir.readdir)((0,Ve.join)(e,"animationGroups")),(0,ir.readdir)((0,Ve.join)(e,"sprite-maps")),(0,ir.readdir)((0,Ve.join)(e,"sprite-managers")),(0,ir.readdir)((0,Ve.join)(e,"geometries")),(0,ir.readdir)((0,Ve.join)(e,"nodeParticleSystemSets"))]);return{nodesFiles:t,meshesFiles:r,lodsFiles:n,lightsFiles:s,cameraFiles:o,skeletonFiles:a,shadowGeneratorFiles:c,sceneLinkFiles:l,guiFiles:u,soundFiles:d,soundNodeFiles:f,particleSystemFiles:m,morphTargetManagerFiles:g,morphTargetFiles:E,animationGroupFiles:w,spriteMapFiles:_,spriteManagerFiles:v,geometryFiles:N,nodeParticleSystemSetFiles:$}}i(OB,"readSceneDirectories");var R2=require("node:child_process");function T2(e){return new Promise((t,r)=>{(0,R2.exec)(e,(n,s,o)=>{n?(console.error(mi.red(e),mi.red(o)),r(n)):(console.log(mi.gray(e),mi.gray(s)),t())})})}i(T2,"executeAsync");var Yo=require("node:path/posix"),k2=k(Hn(),1),O2=k(A2(),1),I2=require("node:fs"),Zfe=["-astc.ktx","-dxt.ktx","-pvrtc.ktx","-etc1.ktx","-etc2.ktx"],ehe=[".png",".jpg",".jpeg",".bmp"];function the(e,t){return`${e.substring(0,e.lastIndexOf("."))}${t}`}i(the,"getCompressedTextureFilename");async function _s(e,t){t.format?await P2(e,t):await Promise.all(Zfe.map(r=>P2(e,{...t,format:r})))}i(_s,"compressFileToKtx");async function P2(e,t){let r=(0,Yo.basename)(e),n=(0,Yo.extname)(r).toLocaleLowerCase();if(!ehe.includes(n))return null;let s=the(r,t.format);if(t.destinationFolder??=(0,Yo.dirname)(e),t.destinationFolder=(0,Yo.join)(t.destinationFolder,s),!t.compressedTexturesEnabled)return t.exportedAssets?.push(t.destinationFolder),null;if(await k2.default.pathExists(t.destinationFolder)&&!t.force)return t.exportedAssets?.push(t.destinationFolder),t.destinationFolder;let o=await new Promise(c=>{let l=(0,I2.createReadStream)(e);l.pipe(new O2.PNG).on("metadata",u=>{c(u.alpha),l.close()}).on("error",()=>{c(!1),l.close()})});if(!Vs)return null;let a=null;switch(t.format){case"-astc.ktx":a=`"${Vs}" -i "${e}" -flip y -pot + -m -dither -ics lRGB -f ASTC_8x8,UBN,lRGB -q astcveryfast -o "${t.destinationFolder}"`;break;case"-dxt.ktx":a=`"${Vs}" -i "${e}" -flip y -pot + -m -dither -ics lRGB ${o?"-l":""} -f ${o?"BC2":"BC1"},UBN,lRGB -o "${t.destinationFolder}"`;break;case"-pvrtc.ktx":a=`"${Vs}" -i "${e}" -flip y -pot + -square + -m -dither -ics lRGB ${o?"-l":""} -f ${o?"PVRTCI_2BPP_RGBA":"PVRTCI_2BPP_RGB"},UBN,lRGB -q pvrtcfastest -o "${t.destinationFolder}"`;break;case"-etc1.ktx":a=`"${Vs}" -i "${e}" -flip y -pot + -m -dither -ics lRGB -f ETC1,UBN,lRGB -q etcfast -o "${t.destinationFolder}"`;break;case"-etc2.ktx":a=`"${Vs}" -i "${e}" -flip y -pot + -m -dither -ics lRGB -f ${o?"ETC2_RGBA":"ETC2_RGB"},UBN,lRGB -q etcfast -o "${t.destinationFolder}"`;break}if(!a)return null;console.log(`Compressing image "${s}"`);try{return await T2(a),console.log(`Compressed image "${s}"`),t.exportedAssets?.push(t.destinationFolder),t.destinationFolder}catch{console.error(`Failed to compress image "${s}"`)}return null}i(P2,"compressFileToKtxFormat");var a$=require("node:path/posix"),c$=require("node:worker_threads"),o$=i((e,t)=>(e=(0,a$.join)(__dirname.replace(/\\/g,"/"),e),new c$.Worker(e,{workerData:t})),"loadWorker"),vf=i(async(e,t)=>{let r=o$(e,t);return new Promise(n=>{r.on("message",s=>{t.id&&s.id!==t.id||(t.id||r.terminate(),n(s))})})},"executeSimpleWorker");function l$(e,t){o$=e,vf=t}i(l$,"overrideWorkerMethods");var Xx=require("node:path/posix"),Jx=k(Hn(),1),u$=k(Yx(),1);async function Ll(e,t){let r=e.split(","),o=r[0].split(";")[1],a=r[1];if(o==="base64"){let c=Buffer.from(a,"base64"),l=(0,u$.default)(c),[u,d]=await Promise.all([l.metadata(),vf("workers/md5.js",c)]),f;switch(u.format){case"png":f=`${d}.png`;break;case"jpg":case"jpeg":f=`${d}.jpg`;break;default:return console.error(`Unsupported embedded texture format while extracting texture: ${u.format}`),null}let m=(0,Xx.join)(t.extractedTexturesOutputPath,f);return await Jx.default.pathExists(m)||await Jx.default.writeFile(m,c),(0,Xx.join)("assets","editor-generated_extracted-textures",f).replace(/\\/g,"/")}return null}i(Ll,"extractTextureAssetFromDataString");async function Af(e,t){try{let r=await fetch(e),n=await r.arrayBuffer(),s=Buffer.from(n).toString("base64"),o=`data:${r.headers.get("content-type")??"image/unknown"};base64,${s}`;return Ll(o,{...t})}catch(r){console.error(`Failed to extract texture from url "${e}": ${r.message}`)}return null}i(Af,"extractTextureAssetFromUrl");function q9e(e=4096,t){let r=t??1,n=[];for(;r<=e;)n.push(r),r<<=1;return n}i(q9e,"getPowerOfTwoSizesUntil");function cc(e){let t=1;for(;t<=e;)t<<=1;return t>>1}i(cc,"getPowerOfTwoUntil");var oo=require("node:path/posix"),Qx=k(Yx(),1),Zx=k(Hn(),1);function Fl(e){return(0,oo.join)(e,"assets","editor-generated_extracted-textures")}i(Fl,"getExtractedTextureOutputPath");async function d$(e,t){let r=(0,oo.extname)(e),n=await(0,Qx.default)(e).metadata();if(!n.width||!n.height)return console.error(`Failed to compute exported image "${e}". Image metadata is invalid.`);let s=n.width,o=n.height,a=s===cc(s)||o===cc(o),c=[],l=s*.66>>0,u=o*.66>>0;a&&(l=cc(l),u=cc(u)),c.push({width:l,height:u});let d=s*.33>>0,f=o*.33>>0;a&&(d=cc(d),f=cc(f)),c.push({width:d,height:f});for(let m of c){let E=`${(0,oo.basename)(e).replace(r,"")}_${m.width}_${m.height}${r}`,w=(0,oo.join)((0,oo.dirname)(e),E);if(t.exportedAssets.push(w),t.force||!await Zx.default.pathExists(w))try{let _=await(0,Qx.default)(e).resize(m.width,m.height).toBuffer();await Zx.default.writeFile(w,_),console.log(`Exported scaled texture "${E}"`),t.onStepChanged?.("assets",{message:`Exported scaled texture "${E}"`})}catch{console.error(`Failed to export image scaled image "${E}"`)}await _s(w,{...t})}}i(d$,"processExportedTexture");var f$=require("node:path/posix"),ug=k(Hn(),1);async function h$(e,t){let r=await ug.default.readJSON(e);if(r.customType!=="BABYLON.NodeMaterial")return;let n=Fl(t.publicDir);await ug.default.ensureDir(n);let s=await ev(r,{extractedTexturesOutputPath:n});await ug.default.writeJSON(e,r,{encoding:"utf-8"}),await Promise.all(s.map(async o=>{let a=(0,f$.join)(t.publicDir,o);t.exportedAssets.push(a),await _s(a,{force:t.force,exportedAssets:t.exportedAssets})}))}i(h$,"processExportedMaterial");async function ev(e,t){let r=e.blocks.filter(s=>(s.customType==="BABYLON.TextureBlock"||s.customType==="BABYLON.ImageSourceBlock")&&s.texture?.name),n=[];return await Promise.all(r.map(async s=>{if(s.texture?.name?.startsWith("http://")||s.texture.name.startsWith("https://")){let o=await Af(s.texture.name,{...t});o&&(n.push(o),s.texture.name=s.texture.url=o)}if(s.texture.name?.startsWith("data:")){let o=await Ll(s.texture.name,{...t});o&&(n.push(o),s.texture.name=s.texture.url=o)}})),n}i(ev,"extractNodeMaterialTextures");var p$=require("node:path/posix"),dg=k(Hn(),1);async function m$(e,t){let r=await dg.default.readJSON(e);if(r.customType!=="BABYLON.NodeParticleSystemSet")return;let n=Fl(t.publicDir);await dg.default.ensureDir(n);let s=await tv(r,{extractedTexturesOutputPath:n});await dg.default.writeJSON(e,r,{encoding:"utf-8"}),await Promise.all(s.map(async o=>{let a=(0,p$.join)(t.publicDir,o);t.exportedAssets.push(a),t.optimize&&await _s(a,{force:t.force,exportedAssets:t.exportedAssets})}))}i(m$,"processExportedNodeParticleSystemSet");async function g$(e,t){let r=null;return e.texture?.name.startsWith("http://")||e.texture?.name.startsWith("https://")?r=await Af(e.texture.name,{...t}):e.texture?.name.startsWith("data:")&&(r=await Ll(e.texture.name,{...t})),r&&(e.texture.name=r,e.texture.url=e.texture.name),r}i(g$,"extractParticleSystemTextures");async function tv(e,t){let r=e.blocks.filter(s=>s.customType==="BABYLON.ParticleTextureSourceBlock"),n=[];return await Promise.all(r.map(async s=>{if(s.url?.startsWith("http://")||s.url?.startsWith("https://")){let o=await Af(s.url,{...t});o&&(n.push(o),s.url=o)}if(s.textureDataUrl?.startsWith("data:")){let o=await Ll(s.textureDataUrl,{...t});o&&(n.push(o),delete s.textureDataUrl,s.url=o,s.serializedCachedData=!1)}})),n}i(tv,"extractNodeParticleSystemSetTextures");var ct=require("node:path/posix"),zt=k(Hn(),1);async function y$(e){let t=[],r=[],n=[],s=[],o=[],a=[],c=[],l=[],u=[],d=[];(await Promise.all(e.directories.meshesFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"meshes",z)),oe=X.meshes[0];if(oe.metadata?.doNotSerialize)return null;oe.delayLoadingFile&&(oe.delayLoadingFile=(0,ct.join)(e.sceneName,(0,ct.basename)(oe.delayLoadingFile))),oe.metadata?.parentId&&(oe.parentId=oe.metadata.parentId),oe.instances?.forEach(Ue=>{Ue.metadata?.parentId&&(Ue.parentId=Ue.metadata.parentId)}),oe.instances=oe.instances?.filter(Ue=>Ue.metadata?.doNotSerialize?null:Ue),X.basePoseMatrix&&(oe.basePoseMatrix=X.basePoseMatrix);let Pe=[];X.materials?.forEach(Ue=>{(s.find(bt=>bt.id===Ue.id)??Pe.find(bt=>bt.id===Ue.id))||Pe.push(Ue)}),X.multiMaterials?.forEach(Ue=>{delete Ue.materialsUniqueIds,a.find(bt=>bt.id===Ue.id)||a.push(Ue)});let ze=[];return X.lods&&(oe.lodMeshIds=[],oe.lodDistances=[],(await Promise.all(X.lods?.map(async Je=>{let bt=await zt.default.readJSON((0,ct.join)(e.sceneFile,"lods",Je)),ot=bt.meshes[0];return ot.delayLoadingFile&&(ot.delayLoadingFile=(0,ct.join)(e.sceneName,(0,ct.basename)(ot.delayLoadingFile))),X.basePoseMatrix&&(ot.basePoseMatrix=X.basePoseMatrix),{lodMesh:ot,distanceOrScreenCoverage:bt.distanceOrScreenCoverage}}))).forEach(Je=>{ze.push(Je.lodMesh),oe.lodMeshIds.push(Je.lodMesh.id),oe.lodDistances.push(Je.distanceOrScreenCoverage)})),{mesh:oe,lodMeshes:ze,effectiveMaterials:Pe}}))).forEach(z=>{z&&(r.push(z.mesh),z.lodMeshes.forEach(X=>{r.push(X)}),z.effectiveMaterials.length&&s.push(...z.effectiveMaterials))});let m=await Promise.all(e.directories.morphTargetManagerFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"morphTargetManagers",z));return e.babylonjsEditorToolsVersion>="5.2.6"?X.targets.forEach(oe=>{oe.delayLoadingFile&&(oe.delayLoadingFile=(0,ct.join)(e.sceneName,"morphTargets",(0,ct.basename)(oe.delayLoadingFile)))}):await Promise.all(X.targets.map(async oe=>{let Pe=(0,ct.join)(e.sceneFile,"morphTargets",(0,ct.basename)(oe.delayLoadingFile)),ze=(await zt.default.readFile(Pe)).buffer;oe.positionsCount&&(oe.positions=Array.prototype.slice.call(new Float32Array(ze,oe.positionsOffset,oe.positionsCount))),oe.normalsCount&&(oe.normals=Array.prototype.slice.call(new Float32Array(ze,oe.normalsOffset,oe.normalsCount))),oe.tangentsCount&&(oe.tangents=Array.prototype.slice.call(new Float32Array(ze,oe.tangentsOffset,oe.tangentsCount))),oe.uvsCount&&(oe.uvs=Array.prototype.slice.call(new Float32Array(ze,oe.uvsOffset,oe.uvsCount))),oe.uv2sCount&&(oe.uv2s=Array.prototype.slice.call(new Float32Array(ze,oe.uv2sOffset,oe.uv2sCount))),delete oe.delayLoadingFile,delete oe.positionsCount,delete oe.normalsCount,delete oe.tangentsCount,delete oe.uvsCount,delete oe.uv2sCount,delete oe.positionsOffset,delete oe.normalsOffset,delete oe.tangentsOffset,delete oe.uvsOffset,delete oe.uv2sOffset})),X}));d.push(...m);let g=await Promise.all(e.directories.nodesFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"nodes",z));return X.metadata?.doNotSerialize?null:(X.metadata?.parentId&&(X.parentId=X.metadata.parentId),X)}));c.push(...g.filter(z=>z!==null));let E=await Promise.all(e.directories.spriteManagerFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"sprite-managers",z));return X.metadata?.doNotSerialize?null:(X.metadata?.parentId&&(X.parentId=X.metadata.parentId),X)}));c.push(...E.filter(z=>z!==null));let w=await Promise.all(e.directories.spriteMapFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"sprite-maps",z));return X.metadata?.doNotSerialize?null:(X.metadata?.parentId&&(X.parentId=X.metadata.parentId),X)}));c.push(...w.filter(z=>z!==null));let _=await Promise.all(e.directories.soundNodeFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"soundNodes",z));return X.metadata?.doNotSerialize?null:(X.metadata?.parentId&&(X.parentId=X.metadata.parentId),X)}));c.push(..._.filter(z=>z!==null));let v=await Promise.all(e.directories.lightsFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"lights",z));return X.metadata?.doNotSerialize?null:(X.metadata?.parentId&&(X.parentId=X.metadata.parentId),X)}));t.push(...v.filter(z=>z!==null));let N=await Promise.all(e.directories.cameraFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"cameras",z));return X.metadata?.doNotSerialize?null:(X.metadata?.parentId&&(X.parentId=X.metadata.parentId),X)}));n.push(...N.filter(z=>z!==null));let $=Fl(e.publicDir);await zt.default.ensureDir($),await Promise.all(s.map(async z=>{if(z.customType==="BABYLON.NodeMaterial"){let X=await ev(z,{extractedTexturesOutputPath:$});await Promise.all(X.map(async oe=>{let Pe=(0,ct.join)(e.publicDir,oe);e.exportedAssets.push(Pe),e.optimize&&e.compressedTexturesEnabled&&await _s(Pe,{...e,force:!1,exportedAssets:e.exportedAssets})}))}}));let j=await Promise.all(e.directories.particleSystemFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"particleSystems",z));if(X.metadata?.doNotSerialize)return null;let oe=await g$(X,{extractedTexturesOutputPath:$});if(oe){let Pe=(0,ct.join)(e.publicDir,oe);e.exportedAssets.push(Pe),e.optimize&&e.compressedTexturesEnabled&&await _s(Pe,{...e,force:!1,exportedAssets:e.exportedAssets})}return X}));l.push(...j.filter(z=>z!==null));let se=await Promise.all(e.directories.nodeParticleSystemSetFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"nodeParticleSystemSets",z));if(X.metadata?.doNotSerialize)return null;if(X.metadata?.parentId&&(X.parentId=X.metadata.parentId),X.nodeParticleSystemSet){let oe=await tv(X.nodeParticleSystemSet,{extractedTexturesOutputPath:$});await Promise.all(oe.map(async Pe=>{let ze=(0,ct.join)(e.publicDir,Pe);e.exportedAssets.push(ze),e.optimize&&e.compressedTexturesEnabled&&await _s(ze,{...e,force:!1,exportedAssets:e.exportedAssets})}))}return X}));r.push(...se.filter(z=>z!==null));let _e=await Promise.all(e.directories.shadowGeneratorFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"shadowGenerators",z));return t.find(Pe=>Pe.id===X.lightId)?X:null}));u.push(..._e.filter(z=>z!==null));let Be=await Promise.all(e.directories.skeletonFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"skeletons",z));return r.find(Pe=>Pe.skeletonId===X.id)?X:null}));o.push(...Be.filter(z=>z!==null));let fe={autoClear:!0,clearColor:e.config.clearColor,ambientColor:e.config.ambientColor,gravity:e.config.gravity??[0,-9.81,0],collisionsEnabled:!0,useRightHandedSystem:!1,fogMode:e.config.fog.fogMode,fogColor:e.config.fog.fogColor,fogStart:e.config.fog.fogStart,fogEnd:e.config.fog.fogEnd,fogDensity:e.config.fog.fogDensity,physicsEnabled:!0,physicsGravity:e.config.physics.gravity,physicsEngine:"HavokPlugin",metadata:{...e.config.metadata,rendering:e.config.rendering,clusteredLight:e.config.clusteredLight},morphTargetManagers:d,lights:t,cameras:n,animations:e.config.animations,materials:s,multiMaterials:a,environmentTexture:e.config.environment.environmentTexture,environmentIntensity:e.config.environment.environmentIntensity,iblIntensity:e.config.environment.iblIntensity??1,skeletons:o,transformNodes:c,geometries:{boxes:[],spheres:[],cylinders:[],toruses:[],grounds:[],planes:[],torusKnots:[],vertexData:[]},meshes:r,particleSystems:l,sounds:await Promise.all(e.directories.soundFiles.map(async z=>zt.default.readJSON((0,ct.join)(e.sceneFile,"sounds",z)))),shadowGenerators:u,animationGroups:await Promise.all(e.directories.animationGroupFiles.map(async z=>zt.default.readJSON((0,ct.join)(e.sceneFile,"animationGroups",z)))),postProcesses:[],spriteManagers:[],reflectionProbes:[]};[...fe.meshes,...fe.cameras,...fe.lights,...fe.transformNodes,...fe.meshes.map(z=>z.instances??[]).flat()].forEach(z=>{if(z.parentId!==void 0&&z.parentInstanceIndex!==void 0){let X=fe.meshes.find(oe=>oe.instances?.find(Pe=>Pe.uniqueId===z.parentId));X&&(z.parentId=X.uniqueId)}}),fe.environmentTexture?.name&&fe.environmentTexture.customType==="BABYLON.HDRCubeTexture"&&(fe.environmentTextureSize=512,fe.environmentTextureType="BABYLON.HDRCubeTexture",fe.environmentTextureRotationY=fe.environmentTexture.rotationY,fe.environmentTexture=fe.environmentTexture.name);let ye=(0,ct.join)(e.publicDir,`${e.sceneName}.babylon`);if(await zt.default.writeJSON(ye,fe,{encoding:"utf-8"}),e.exportedAssets.push(ye),e.optimize){let z=(0,ct.join)(e.publicDir,`${e.sceneName}.babylon.manifest`),X={version:0,enableSceneOffline:!0,enableTexturesOffline:!0};await zt.default.pathExists(z)&&(X=await zt.default.readJSON(z)),++X.version,await zt.default.writeJSON(z,X,{encoding:"utf-8"}),e.exportedAssets.push(z)}}i(y$,"createBabylonScene");var ao=require("node:path/posix"),lc=k(Hn(),1),E$=[".jpg",".jpeg",".webp",".png",".bmp"],f0e=[".env",".dds",".hdr"],h0e=[".mp3",".wav",".wave",".ogg"],S$=[".material",".gui",".cinematic",".npss",".ragdoll",".json"],p0e=[".3dl",".exr",".hdr"],m0e=[...E$,...f0e,...h0e,...S$,...p0e];async function b$(e,t){let r=e.includes(".navmesh"),n=(0,ao.extname)(e).toLocaleLowerCase();if(!r&&!m0e.includes(n)||(0,ao.basename)(e).startsWith("editor_preview"))return;let s=e.replace((0,ao.join)(t.projectDir,"/"),""),o=s.split("/"),a="";for(let m=0;m<o.length-1;++m){try{await lc.default.ensureDir((0,ao.join)(t.publicDir,a,o[m]))}catch{}a=(0,ao.join)(a,o[m])}let c=!1,u=(await lc.default.stat(e)).mtimeMs.toString();c=!t.cache[s]||t.cache[s]!==u,t.cache[s]=u;let d=(0,ao.join)(t.publicDir,s),f=await lc.default.pathExists(d);(c||!f)&&(S$.includes(n)?await lc.default.writeJSON(d,await lc.default.readJSON(e),{encoding:"utf-8"}):await lc.default.copyFile(e,d)),t.onStepChanged?.("assets",{message:`Processed asset: ${s}`}),t.exportedAssets.push(d),t.optimize&&await _s(d,{force:c,...t}),t.optimize&&(E$.includes(n)?await d$(d,{...t,force:c}):n===".material"?await h$(d,{...t,force:c}):n===".npss"&&await m$(d,{...t,force:c}))}i(b$,"processAssetFile");var w$=require("node:os"),fg=require("node:path/posix");async function _$(e){let t=await zs((0,fg.join)(e.baseAssetsDir,"**/*"),{nodir:!0,ignore:{childrenIgnored:i(a=>(0,fg.extname)(a.name)===".scene","childrenIgnored")}}),r=[],n=(0,w$.cpus)().length;console.log(`Using ${n} cpus to process assets...`);let s=100/t.length,o=0;for(let a of t){if(r.length>=n&&(await Promise.all(r),r.length=0),e.cancellationToken?.isCanceled)break;r.push(new Promise(async c=>{await b$(a,{...e}),e.onProgress?.(o+=s),c()}))}await Promise.all(r)}i(_$,"createAssets");var jl=k(Hn(),1),Pt=require("node:path/posix"),g0e=`
90
+ >>> no match, partial?`,t,m,r,g),m===l))}let w;if(typeof d=="string"?(w=f===d,this.debug("string match",d,f,w)):(w=d.test(f),this.debug("pattern match",d,f,w)),!w)return!1}if(a===l&&c===u)return!0;if(a===l)return n;if(c===u)return a===l-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return YD(this.pattern,this.options)}parse(t){ef(t);let r=this.options;if(t==="**")return Gr;if(t==="")return"";let n,s=null;(n=t.match(ode))?s=r.dot?cde:ade:(n=t.match(Xue))?s=(r.nocase?r.dot?ede:Zue:r.dot?Que:Jue)(n[1]):(n=t.match(lde))?s=(r.nocase?r.dot?dde:ude:r.dot?fde:hde)(n):(n=t.match(tde))?s=r.dot?nde:rde:(n=t.match(sde))&&(s=ide);let o=ml.fromGlob(t,this.options).toMMPattern();return s&&typeof o=="object"&&Reflect.defineProperty(o,"test",{value:s}),o}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?gde:r.dot?yde:Ede,s=new Set(r.nocase?["i"]:[]),o=t.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let m of f.flags.split(""))s.add(m);return typeof f=="string"?Cde(f):f===Gr?Gr:f._src});u.forEach((f,m)=>{let g=u[m+1],E=u[m-1];f!==Gr||E===Gr||(E===void 0?g!==void 0&&g!==Gr?u[m+1]="(?:\\/|"+n+"\\/)?"+g:u[m]=n:g===void 0?u[m-1]=E+"(?:\\/|\\/"+n+")?":g!==Gr&&(u[m-1]=E+"(?:\\/|\\/"+n+"\\/)"+g,u[m+1]=Gr))});let d=u.filter(f=>f!==Gr);if(this.partial&&d.length>=1){let f=[];for(let m=1;m<=d.length;m++)f.push(d.slice(0,m).join("/"));return"(?:"+f.join("|")+")"}return d.join("/")}).join("|"),[a,c]=t.length>1?["(?:",")"]:["",""];o="^"+a+o+c+"$",this.partial&&(o="^(?:\\/|"+a+o.slice(1,-1)+c+")$"),this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...s].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let s=this.slashSplit(t);this.debug(this.pattern,"split",s);let o=this.set;this.debug(this.pattern,"set",o);let a=s[s.length-1];if(!a)for(let c=s.length-2;!a&&c>=0;c--)a=s[c];for(let c=0;c<o.length;c++){let l=o[c],u=s;if(n.matchBase&&l.length===1&&(u=[a]),this.matchOne(u,l,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return bn.defaults(t).Minimatch}};bn.AST=ml,bn.Minimatch=Qn,bn.escape=gl,bn.unescape=Us;var yl=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,JD=new Set,HC=typeof process=="object"&&process?process:{},QD=i((e,t,r,n)=>{typeof HC.emitWarning=="function"?HC.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},"emitWarning"),vm=globalThis.AbortController,ZD=globalThis.AbortSignal;if(typeof vm>"u"){ZD=class{static{i(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(n,s){this._onabort.push(s)}},vm=class{static{i(this,"AbortController")}constructor(){t()}signal=new ZD;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let s of this.signal._onabort)s(n);this.signal.onabort?.(n)}}};let e=HC.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=i(()=>{e&&(e=!1,QD("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",t))},"warnACPolyfill")}var xde=i(e=>!JD.has(e),"shouldWarn"),Aze=Symbol("type"),Ho=i(e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),"isPosInt"),eB=i(e=>Ho(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?El:null:null,"getUintArray"),El=class extends Array{static{i(this,"ZeroArray")}constructor(t){super(t),this.fill(0)}},GC=class e{static{i(this,"Stack")}heap;length;static#t=!1;static create(t){let r=eB(t);if(!r)return[];e.#t=!0;let n=new e(t,r);return e.#t=!1,n}constructor(t,r){if(!e.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},rf=class e{static{i(this,"LRUCache")}#t;#r;#n;#e;#o;#c;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#l;#d;#u;#a;#s;#y;#p;#m;#g;#v;#E;#C;#x;#S;#w;#_;#h;static unsafeExposeInternals(t){return{starts:t.#x,ttls:t.#S,sizes:t.#C,keyMap:t.#u,keyList:t.#a,valList:t.#s,next:t.#y,prev:t.#p,get head(){return t.#m},get tail(){return t.#g},free:t.#v,isBackgroundFetch:i(r=>t.#f(r),"isBackgroundFetch"),backgroundFetch:i((r,n,s,o)=>t.#L(r,n,s,o),"backgroundFetch"),moveToTail:i(r=>t.#j(r),"moveToTail"),indexes:i(r=>t.#T(r),"indexes"),rindexes:i(r=>t.#P(r),"rindexes"),isStale:i(r=>t.#b(r),"isStale")}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#d}get size(){return this.#l}get fetchMethod(){return this.#o}get memoMethod(){return this.#c}get dispose(){return this.#n}get disposeAfter(){return this.#e}constructor(t){let{max:r=0,ttl:n,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:c,allowStale:l,dispose:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:m,maxSize:g=0,maxEntrySize:E=0,sizeCalculation:w,fetchMethod:_,memoMethod:v,noDeleteOnFetchRejection:N,noDeleteOnStaleGet:$,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:se,ignoreFetchAbort:_e}=t;if(r!==0&&!Ho(r))throw new TypeError("max option must be a nonnegative integer");let Be=r?eB(r):Array;if(!Be)throw new Error("invalid max value: "+r);if(this.#t=r,this.#r=g,this.maxEntrySize=E||this.#r,this.sizeCalculation=w,this.sizeCalculation){if(!this.#r&&!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(v!==void 0&&typeof v!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#c=v,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=_,this.#_=!!_,this.#u=new Map,this.#a=new Array(r).fill(void 0),this.#s=new Array(r).fill(void 0),this.#y=new Be(r),this.#p=new Be(r),this.#m=0,this.#g=0,this.#v=GC.create(r),this.#l=0,this.#d=0,typeof u=="function"&&(this.#n=u),typeof d=="function"?(this.#e=d,this.#E=[]):(this.#e=void 0,this.#E=void 0),this.#w=!!this.#n,this.#h=!!this.#e,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!N,this.allowStaleOnFetchRejection=!!j,this.allowStaleOnFetchAbort=!!se,this.ignoreFetchAbort=!!_e,this.maxEntrySize!==0){if(this.#r!==0&&!Ho(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Ho(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#O()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!$,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=Ho(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!Ho(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#R()}if(this.#t===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){let fe="LRU_CACHE_UNBOUNDED";xde(fe)&&(JD.add(fe),QD("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",fe,e))}}getRemainingTTL(t){return this.#u.has(t)?1/0:0}#R(){let t=new El(this.#t),r=new El(this.#t);this.#S=t,this.#x=r,this.#k=(o,a,c=yl.now())=>{if(r[o]=a!==0?c:0,t[o]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#b(o)&&this.#I(this.#a[o],"expire")},a+1);l.unref&&l.unref()}},this.#A=o=>{r[o]=t[o]!==0?yl.now():0},this.#i=(o,a)=>{if(t[a]){let c=t[a],l=r[a];if(!c||!l)return;o.ttl=c,o.start=l,o.now=n||s();let u=o.now-l;o.remainingTTL=c-u}};let n=0,s=i(()=>{let o=yl.now();if(this.ttlResolution>0){n=o;let a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref()}return o},"getNow");this.getRemainingTTL=o=>{let a=this.#u.get(o);if(a===void 0)return 0;let c=t[a],l=r[a];if(!c||!l)return 1/0;let u=(n||s())-l;return c-u},this.#b=o=>{let a=r[o],c=t[o];return!!c&&!!a&&(n||s())-a>c}}#A=i(()=>{},"#updateItemAge");#i=i(()=>{},"#statusTTL");#k=i(()=>{},"#setItemTTL");#b=i(()=>!1,"#isStale");#O(){let t=new El(this.#t);this.#d=0,this.#C=t,this.#N=r=>{this.#d-=t[r],t[r]=0},this.#B=(r,n,s,o)=>{if(this.#f(n))return 0;if(!Ho(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(n,r),!Ho(s))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 s},this.#D=(r,n,s)=>{if(t[r]=n,this.#r){let o=this.#r-t[r];for(;this.#d>o;)this.#$(!0)}this.#d+=t[r],s&&(s.entrySize=n,s.totalCalculatedSize=this.#d)}}#N=i(t=>{},"#removeItemSize");#D=i((t,r,n)=>{},"#addItemSize");#B=i((t,r,n,s)=>{if(n||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#T({allowStale:t=this.allowStale}={}){if(this.#l)for(let r=this.#g;!(!this.#M(r)||((t||!this.#b(r))&&(yield r),r===this.#m));)r=this.#p[r]}*#P({allowStale:t=this.allowStale}={}){if(this.#l)for(let r=this.#m;!(!this.#M(r)||((t||!this.#b(r))&&(yield r),r===this.#g));)r=this.#y[r]}#M(t){return t!==void 0&&this.#u.get(this.#a[t])===t}*entries(){for(let t of this.#T())this.#s[t]!==void 0&&this.#a[t]!==void 0&&!this.#f(this.#s[t])&&(yield[this.#a[t],this.#s[t]])}*rentries(){for(let t of this.#P())this.#s[t]!==void 0&&this.#a[t]!==void 0&&!this.#f(this.#s[t])&&(yield[this.#a[t],this.#s[t]])}*keys(){for(let t of this.#T()){let r=this.#a[t];r!==void 0&&!this.#f(this.#s[t])&&(yield r)}}*rkeys(){for(let t of this.#P()){let r=this.#a[t];r!==void 0&&!this.#f(this.#s[t])&&(yield r)}}*values(){for(let t of this.#T())this.#s[t]!==void 0&&!this.#f(this.#s[t])&&(yield this.#s[t])}*rvalues(){for(let t of this.#P())this.#s[t]!==void 0&&!this.#f(this.#s[t])&&(yield this.#s[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,r={}){for(let n of this.#T()){let s=this.#s[n],o=this.#f(s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,this.#a[n],this))return this.get(this.#a[n],r)}}forEach(t,r=this){for(let n of this.#T()){let s=this.#s[n],o=this.#f(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(r,o,this.#a[n],this)}}rforEach(t,r=this){for(let n of this.#P()){let s=this.#s[n],o=this.#f(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(r,o,this.#a[n],this)}}purgeStale(){let t=!1;for(let r of this.#P({allowStale:!0}))this.#b(r)&&(this.#I(this.#a[r],"expire"),t=!0);return t}info(t){let r=this.#u.get(t);if(r===void 0)return;let n=this.#s[r],s=this.#f(n)?n.__staleWhileFetching:n;if(s===void 0)return;let o={value:s};if(this.#S&&this.#x){let a=this.#S[r],c=this.#x[r];if(a&&c){let l=a-(yl.now()-c);o.ttl=l,o.start=Date.now()}}return this.#C&&(o.size=this.#C[r]),o}dump(){let t=[];for(let r of this.#T({allowStale:!0})){let n=this.#a[r],s=this.#s[r],o=this.#f(s)?s.__staleWhileFetching:s;if(o===void 0||n===void 0)continue;let a={value:o};if(this.#S&&this.#x){a.ttl=this.#S[r];let c=yl.now()-this.#x[r];a.start=Math.floor(Date.now()-c)}this.#C&&(a.size=this.#C[r]),t.unshift([n,a])}return t}load(t){this.clear();for(let[r,n]of t){if(n.start){let s=Date.now()-n.start;n.start=yl.now()-s}this.set(r,n.value,n)}}set(t,r,n={}){if(r===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:l}=n,{noUpdateTTL:u=this.noUpdateTTL}=n,d=this.#B(t,r,n.size||0,c);if(this.maxEntrySize&&d>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#I(t,"set"),this;let f=this.#l===0?void 0:this.#u.get(t);if(f===void 0)f=this.#l===0?this.#g:this.#v.length!==0?this.#v.pop():this.#l===this.#t?this.#$(!1):this.#l,this.#a[f]=t,this.#s[f]=r,this.#u.set(t,f),this.#y[this.#g]=f,this.#p[f]=this.#g,this.#g=f,this.#l++,this.#D(f,d,l),l&&(l.set="add"),u=!1;else{this.#j(f);let m=this.#s[f];if(r!==m){if(this.#_&&this.#f(m)){m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:g}=m;g!==void 0&&!a&&(this.#w&&this.#n?.(g,t,"set"),this.#h&&this.#E?.push([g,t,"set"]))}else a||(this.#w&&this.#n?.(m,t,"set"),this.#h&&this.#E?.push([m,t,"set"]));if(this.#N(f),this.#D(f,d,l),this.#s[f]=r,l){l.set="replace";let g=m&&this.#f(m)?m.__staleWhileFetching:m;g!==void 0&&(l.oldValue=g)}}else l&&(l.set="update")}if(s!==0&&!this.#S&&this.#R(),this.#S&&(u||this.#k(f,s,o),l&&this.#i(l,f)),!a&&this.#h&&this.#E){let m=this.#E,g;for(;g=m?.shift();)this.#e?.(...g)}return this}pop(){try{for(;this.#l;){let t=this.#s[this.#m];if(this.#$(!0),this.#f(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#h&&this.#E){let t=this.#E,r;for(;r=t?.shift();)this.#e?.(...r)}}}#$(t){let r=this.#m,n=this.#a[r],s=this.#s[r];return this.#_&&this.#f(s)?s.__abortController.abort(new Error("evicted")):(this.#w||this.#h)&&(this.#w&&this.#n?.(s,n,"evict"),this.#h&&this.#E?.push([s,n,"evict"])),this.#N(r),t&&(this.#a[r]=void 0,this.#s[r]=void 0,this.#v.push(r)),this.#l===1?(this.#m=this.#g=0,this.#v.length=0):this.#m=this.#y[r],this.#u.delete(n),this.#l--,r}has(t,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:s}=r,o=this.#u.get(t);if(o!==void 0){let a=this.#s[o];if(this.#f(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#b(o))s&&(s.has="stale",this.#i(s,o));else return n&&this.#A(o),s&&(s.has="hit",this.#i(s,o)),!0}else s&&(s.has="miss");return!1}peek(t,r={}){let{allowStale:n=this.allowStale}=r,s=this.#u.get(t);if(s===void 0||!n&&this.#b(s))return;let o=this.#s[s];return this.#f(o)?o.__staleWhileFetching:o}#L(t,r,n,s){let o=r===void 0?void 0:this.#s[r];if(this.#f(o))return o;let a=new vm,{signal:c}=n;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:n,context:s},u=i((w,_=!1)=>{let{aborted:v}=a.signal,N=n.ignoreFetchAbort&&w!==void 0;if(n.status&&(v&&!_?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,N&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),v&&!N&&!_)return f(a.signal.reason);let $=g;return this.#s[r]===g&&(w===void 0?$.__staleWhileFetching?this.#s[r]=$.__staleWhileFetching:this.#I(t,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(t,w,l.options))),w},"cb"),d=i(w=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=w),f(w)),"eb"),f=i(w=>{let{aborted:_}=a.signal,v=_&&n.allowStaleOnFetchAbort,N=v||n.allowStaleOnFetchRejection,$=N||n.noDeleteOnFetchRejection,j=g;if(this.#s[r]===g&&(!$||j.__staleWhileFetching===void 0?this.#I(t,"fetch"):v||(this.#s[r]=j.__staleWhileFetching)),N)return n.status&&j.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),j.__staleWhileFetching;if(j.__returned===j)throw w},"fetchFail"),m=i((w,_)=>{let v=this.#o?.(t,o,l);v&&v instanceof Promise&&v.then(N=>w(N===void 0?void 0:N),_),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(w(void 0),n.allowStaleOnFetchAbort&&(w=i(N=>u(N,!0),"res")))})},"pcall");n.status&&(n.status.fetchDispatched=!0);let g=new Promise(m).then(u,d),E=Object.assign(g,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(t,E,{...l.options,status:void 0}),r=this.#u.get(t)):this.#s[r]=E,E}#f(t){if(!this.#_)return!1;let r=t;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof vm}async fetch(t,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:g=this.ignoreFetchAbort,allowStaleOnFetchAbort:E=this.allowStaleOnFetchAbort,context:w,forceRefresh:_=!1,status:v,signal:N}=r;if(!this.#_)return v&&(v.fetch="get"),this.get(t,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:v});let $={allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:d,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:E,ignoreFetchAbort:g,status:v,signal:N},j=this.#u.get(t);if(j===void 0){v&&(v.fetch="miss");let se=this.#L(t,j,$,w);return se.__returned=se}else{let se=this.#s[j];if(this.#f(se)){let ye=n&&se.__staleWhileFetching!==void 0;return v&&(v.fetch="inflight",ye&&(v.returnedStale=!0)),ye?se.__staleWhileFetching:se.__returned=se}let _e=this.#b(j);if(!_&&!_e)return v&&(v.fetch="hit"),this.#j(j),s&&this.#A(j),v&&this.#i(v,j),se;let Be=this.#L(t,j,$,w),ie=Be.__staleWhileFetching!==void 0&&n;return v&&(v.fetch=_e?"stale":"refresh",ie&&_e&&(v.returnedStale=!0)),ie?Be.__staleWhileFetching:Be.__returned=Be}}async forceFetch(t,r={}){let n=await this.fetch(t,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(t,r={}){let n=this.#c;if(!n)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...a}=r,c=this.get(t,a);if(!o&&c!==void 0)return c;let l=n(t,c,{options:a,context:s});return this.set(t,l,a),l}get(t,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=r,c=this.#u.get(t);if(c!==void 0){let l=this.#s[c],u=this.#f(l);return a&&this.#i(a,c),this.#b(c)?(a&&(a.get="stale"),u?(a&&n&&l.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?l.__staleWhileFetching:void 0):(o||this.#I(t,"expire"),a&&n&&(a.returnedStale=!0),n?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(this.#j(c),s&&this.#A(c),l))}else a&&(a.get="miss")}#F(t,r){this.#p[r]=t,this.#y[t]=r}#j(t){t!==this.#g&&(t===this.#m?this.#m=this.#y[t]:this.#F(this.#p[t],this.#y[t]),this.#F(this.#g,t),this.#g=t)}delete(t){return this.#I(t,"delete")}#I(t,r){let n=!1;if(this.#l!==0){let s=this.#u.get(t);if(s!==void 0)if(n=!0,this.#l===1)this.#U(r);else{this.#N(s);let o=this.#s[s];if(this.#f(o)?o.__abortController.abort(new Error("deleted")):(this.#w||this.#h)&&(this.#w&&this.#n?.(o,t,r),this.#h&&this.#E?.push([o,t,r])),this.#u.delete(t),this.#a[s]=void 0,this.#s[s]=void 0,s===this.#g)this.#g=this.#p[s];else if(s===this.#m)this.#m=this.#y[s];else{let a=this.#p[s];this.#y[a]=this.#y[s];let c=this.#y[s];this.#p[c]=this.#p[s]}this.#l--,this.#v.push(s)}}if(this.#h&&this.#E?.length){let s=this.#E,o;for(;o=s?.shift();)this.#e?.(...o)}return n}clear(){return this.#U("delete")}#U(t){for(let r of this.#P({allowStale:!0})){let n=this.#s[r];if(this.#f(n))n.__abortController.abort(new Error("deleted"));else{let s=this.#a[r];this.#w&&this.#n?.(n,s,t),this.#h&&this.#E?.push([n,s,t])}}if(this.#u.clear(),this.#s.fill(void 0),this.#a.fill(void 0),this.#S&&this.#x&&(this.#S.fill(0),this.#x.fill(0)),this.#C&&this.#C.fill(0),this.#m=0,this.#g=0,this.#v.length=0,this.#d=0,this.#l=0,this.#h&&this.#E){let r=this.#E,n;for(;n=r?.shift();)this.#e?.(...n)}}};var Im=require("node:events"),JC=k(require("node:stream"),1),iB=require("node:string_decoder"),tB=typeof process=="object"&&process?process:{stdout:null,stderr:null},vde=i(e=>!!e&&typeof e=="object"&&(e instanceof zo||e instanceof JC.default||Ade(e)||Rde(e)),"isStream"),Ade=i(e=>!!e&&typeof e=="object"&&e instanceof Im.EventEmitter&&typeof e.pipe=="function"&&e.pipe!==JC.default.Writable.prototype.pipe,"isReadable"),Rde=i(e=>!!e&&typeof e=="object"&&e instanceof Im.EventEmitter&&typeof e.write=="function"&&typeof e.end=="function","isWritable"),ro=Symbol("EOF"),no=Symbol("maybeEmitEnd"),Go=Symbol("emittedEnd"),Am=Symbol("emittingEnd"),nf=Symbol("emittedError"),Rm=Symbol("closed"),rB=Symbol("read"),Tm=Symbol("flush"),nB=Symbol("flushChunk"),qs=Symbol("encoding"),Sl=Symbol("decoder"),Ar=Symbol("flowing"),sf=Symbol("paused"),bl=Symbol("resume"),Rr=Symbol("buffer"),wn=Symbol("pipes"),Tr=Symbol("bufferLength"),zC=Symbol("bufferPush"),Pm=Symbol("bufferShift"),Zr=Symbol("objectMode"),Jt=Symbol("destroyed"),VC=Symbol("error"),WC=Symbol("emitData"),sB=Symbol("emitEnd"),KC=Symbol("emitEnd2"),gi=Symbol("async"),YC=Symbol("abort"),km=Symbol("aborted"),of=Symbol("signal"),tc=Symbol("dataListeners"),Zn=Symbol("discarded"),af=i(e=>Promise.resolve().then(e),"defer"),Tde=i(e=>e(),"nodefer"),Pde=i(e=>e==="end"||e==="finish"||e==="prefinish","isEndish"),kde=i(e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,"isArrayBufferLike"),Ode=i(e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),"isArrayBufferView"),Om=class{static{i(this,"Pipe")}src;dest;opts;ondrain;constructor(t,r,n){this.src=t,this.dest=r,this.opts=n,this.ondrain=()=>t[bl](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},XC=class extends Om{static{i(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,r,n){super(t,r,n),this.proxyErrors=s=>r.emit("error",s),t.on("error",this.proxyErrors)}},Ide=i(e=>!!e.objectMode,"isObjectModeOptions"),Nde=i(e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer","isEncodingOptions"),zo=class extends Im.EventEmitter{static{i(this,"Minipass")}[Ar]=!1;[sf]=!1;[wn]=[];[Rr]=[];[Zr];[qs];[gi];[Sl];[ro]=!1;[Go]=!1;[Am]=!1;[Rm]=!1;[nf]=null;[Tr]=0;[Jt]=!1;[of];[km]=!1;[tc]=0;[Zn]=!1;writable=!0;readable=!0;constructor(...t){let r=t[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Ide(r)?(this[Zr]=!0,this[qs]=null):Nde(r)?(this[qs]=r.encoding,this[Zr]=!1):(this[Zr]=!1,this[qs]=null),this[gi]=!!r.async,this[Sl]=this[qs]?new iB.StringDecoder(this[qs]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:i(()=>this[Rr],"get")}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:i(()=>this[wn],"get")});let{signal:n}=r;n&&(this[of]=n,n.aborted?this[YC]():n.addEventListener("abort",()=>this[YC]()))}get bufferLength(){return this[Tr]}get encoding(){return this[qs]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Zr]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[gi]}set async(t){this[gi]=this[gi]||!!t}[YC](){this[km]=!0,this.emit("abort",this[of]?.reason),this.destroy(this[of]?.reason)}get aborted(){return this[km]}set aborted(t){}write(t,r,n){if(this[km])return!1;if(this[ro])throw new Error("write after end");if(this[Jt])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(n=r,r="utf8"),r||(r="utf8");let s=this[gi]?af:Tde;if(!this[Zr]&&!Buffer.isBuffer(t)){if(Ode(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(kde(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Zr]?(this[Ar]&&this[Tr]!==0&&this[Tm](!0),this[Ar]?this.emit("data",t):this[zC](t),this[Tr]!==0&&this.emit("readable"),n&&s(n),this[Ar]):t.length?(typeof t=="string"&&!(r===this[qs]&&!this[Sl]?.lastNeed)&&(t=Buffer.from(t,r)),Buffer.isBuffer(t)&&this[qs]&&(t=this[Sl].write(t)),this[Ar]&&this[Tr]!==0&&this[Tm](!0),this[Ar]?this.emit("data",t):this[zC](t),this[Tr]!==0&&this.emit("readable"),n&&s(n),this[Ar]):(this[Tr]!==0&&this.emit("readable"),n&&s(n),this[Ar])}read(t){if(this[Jt])return null;if(this[Zn]=!1,this[Tr]===0||t===0||t&&t>this[Tr])return this[no](),null;this[Zr]&&(t=null),this[Rr].length>1&&!this[Zr]&&(this[Rr]=[this[qs]?this[Rr].join(""):Buffer.concat(this[Rr],this[Tr])]);let r=this[rB](t||null,this[Rr][0]);return this[no](),r}[rB](t,r){if(this[Zr])this[Pm]();else{let n=r;t===n.length||t===null?this[Pm]():typeof n=="string"?(this[Rr][0]=n.slice(t),r=n.slice(0,t),this[Tr]-=t):(this[Rr][0]=n.subarray(t),r=n.subarray(0,t),this[Tr]-=t)}return this.emit("data",r),!this[Rr].length&&!this[ro]&&this.emit("drain"),r}end(t,r,n){return typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r="utf8"),t!==void 0&&this.write(t,r),n&&this.once("end",n),this[ro]=!0,this.writable=!1,(this[Ar]||!this[sf])&&this[no](),this}[bl](){this[Jt]||(!this[tc]&&!this[wn].length&&(this[Zn]=!0),this[sf]=!1,this[Ar]=!0,this.emit("resume"),this[Rr].length?this[Tm]():this[ro]?this[no]():this.emit("drain"))}resume(){return this[bl]()}pause(){this[Ar]=!1,this[sf]=!0,this[Zn]=!1}get destroyed(){return this[Jt]}get flowing(){return this[Ar]}get paused(){return this[sf]}[zC](t){this[Zr]?this[Tr]+=1:this[Tr]+=t.length,this[Rr].push(t)}[Pm](){return this[Zr]?this[Tr]-=1:this[Tr]-=this[Rr][0].length,this[Rr].shift()}[Tm](t=!1){do;while(this[nB](this[Pm]())&&this[Rr].length);!t&&!this[Rr].length&&!this[ro]&&this.emit("drain")}[nB](t){return this.emit("data",t),this[Ar]}pipe(t,r){if(this[Jt])return t;this[Zn]=!1;let n=this[Go];return r=r||{},t===tB.stdout||t===tB.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,n?r.end&&t.end():(this[wn].push(r.proxyErrors?new XC(this,t,r):new Om(this,t,r)),this[gi]?af(()=>this[bl]()):this[bl]()),t}unpipe(t){let r=this[wn].find(n=>n.dest===t);r&&(this[wn].length===1?(this[Ar]&&this[tc]===0&&(this[Ar]=!1),this[wn]=[]):this[wn].splice(this[wn].indexOf(r),1),r.unpipe())}addListener(t,r){return this.on(t,r)}on(t,r){let n=super.on(t,r);if(t==="data")this[Zn]=!1,this[tc]++,!this[wn].length&&!this[Ar]&&this[bl]();else if(t==="readable"&&this[Tr]!==0)super.emit("readable");else if(Pde(t)&&this[Go])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[nf]){let s=r;this[gi]?af(()=>s.call(this,this[nf])):s.call(this,this[nf])}return n}removeListener(t,r){return this.off(t,r)}off(t,r){let n=super.off(t,r);return t==="data"&&(this[tc]=this.listeners("data").length,this[tc]===0&&!this[Zn]&&!this[wn].length&&(this[Ar]=!1)),n}removeAllListeners(t){let r=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[tc]=0,!this[Zn]&&!this[wn].length&&(this[Ar]=!1)),r}get emittedEnd(){return this[Go]}[no](){!this[Am]&&!this[Go]&&!this[Jt]&&this[Rr].length===0&&this[ro]&&(this[Am]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Rm]&&this.emit("close"),this[Am]=!1)}emit(t,...r){let n=r[0];if(t!=="error"&&t!=="close"&&t!==Jt&&this[Jt])return!1;if(t==="data")return!this[Zr]&&!n?!1:this[gi]?(af(()=>this[WC](n)),!0):this[WC](n);if(t==="end")return this[sB]();if(t==="close"){if(this[Rm]=!0,!this[Go]&&!this[Jt])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(t==="error"){this[nf]=n,super.emit(VC,n);let o=!this[of]||this.listeners("error").length?super.emit("error",n):!1;return this[no](),o}else if(t==="resume"){let o=super.emit("resume");return this[no](),o}else if(t==="finish"||t==="prefinish"){let o=super.emit(t);return this.removeAllListeners(t),o}let s=super.emit(t,...r);return this[no](),s}[WC](t){for(let n of this[wn])n.dest.write(t)===!1&&this.pause();let r=this[Zn]?!1:super.emit("data",t);return this[no](),r}[sB](){return this[Go]?!1:(this[Go]=!0,this.readable=!1,this[gi]?(af(()=>this[KC]()),!0):this[KC]())}[KC](){if(this[Sl]){let r=this[Sl].end();if(r){for(let n of this[wn])n.dest.write(r);this[Zn]||super.emit("data",r)}}for(let r of this[wn])r.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[Zr]||(t.dataLength=0);let r=this.promise();return this.on("data",n=>{t.push(n),this[Zr]||(t.dataLength+=n.length)}),await r,t}async concat(){if(this[Zr])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[qs]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,r)=>{this.on(Jt,()=>r(new Error("stream destroyed"))),this.on("error",n=>r(n)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[Zn]=!1;let t=!1,r=i(async()=>(this.pause(),t=!0,{value:void 0,done:!0}),"stop");return{next:i(()=>{if(t)return r();let s=this.read();if(s!==null)return Promise.resolve({done:!1,value:s});if(this[ro])return r();let o,a,c=i(f=>{this.off("data",l),this.off("end",u),this.off(Jt,d),r(),a(f)},"onerr"),l=i(f=>{this.off("error",c),this.off("end",u),this.off(Jt,d),this.pause(),o({value:f,done:!!this[ro]})},"ondata"),u=i(()=>{this.off("error",c),this.off("data",l),this.off(Jt,d),r(),o({done:!0,value:void 0})},"onend"),d=i(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((f,m)=>{a=m,o=f,this.once(Jt,d),this.once("error",c),this.once("end",u),this.once("data",l)})},"next"),throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Zn]=!1;let t=!1,r=i(()=>(this.pause(),this.off(VC,r),this.off(Jt,r),this.off("end",r),t=!0,{done:!0,value:void 0}),"stop"),n=i(()=>{if(t)return r();let s=this.read();return s===null?r():{done:!1,value:s}},"next");return this.once("end",r),this.once(VC,r),this.once(Jt,r),{next:n,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(t){if(this[Jt])return t?this.emit("error",t):this.emit(Jt),this;this[Jt]=!0,this[Zn]=!0,this[Rr].length=0,this[Tr]=0;let r=this;return typeof r.close=="function"&&!this[Rm]&&r.close(),t?this.emit("error",t):this.emit(Jt),this}static get isStream(){return vde}};var Cl=require("node:path"),EB=require("node:url"),Ei=require("fs"),Dde=k(require("node:fs"),1),Vo=require("node:fs/promises"),Bde=Ei.realpathSync.native,cf={lstatSync:Ei.lstatSync,readdir:Ei.readdir,readdirSync:Ei.readdirSync,readlinkSync:Ei.readlinkSync,realpathSync:Bde,promises:{lstat:Vo.lstat,readdir:Vo.readdir,readlink:Vo.readlink,realpath:Vo.realpath}},oB=i(e=>!e||e===cf||e===Dde?cf:{...cf,...e,promises:{...cf.promises,...e.promises||{}}},"fsFromOption"),aB=/^\\\\\?\\([a-z]:)\\?$/i,Mde=i(e=>e.replace(/\//g,"\\").replace(aB,"$1\\"),"uncToDrive"),$de=/[\\\/]/,Ss=0,cB=1,lB=2,yi=4,uB=6,dB=8,rc=10,fB=12,bs=15,lf=~bs,QC=16,hB=32,uf=64,Hs=128,Nm=256,Dm=512,pB=uf|Hs|Dm,Lde=1023,ZC=i(e=>e.isFile()?dB:e.isDirectory()?yi:e.isSymbolicLink()?rc:e.isCharacterDevice()?lB:e.isBlockDevice()?uB:e.isSocket()?fB:e.isFIFO()?cB:Ss,"entToType"),mB=new Map,df=i(e=>{let t=mB.get(e);if(t)return t;let r=e.normalize("NFKD");return mB.set(e,r),r},"normalize"),gB=new Map,Bm=i(e=>{let t=gB.get(e);if(t)return t;let r=df(e.toLowerCase());return gB.set(e,r),r},"normalizeNocase"),Mm=class extends rf{static{i(this,"ResolveCache")}constructor(){super({max:256})}},ex=class extends rf{static{i(this,"ChildrenCache")}constructor(t=16*1024){super({maxSize:t,sizeCalculation:i(r=>r.length+1,"sizeCalculation")})}},yB=Symbol("PathScurry setAsCwd"),en=class{static{i(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#t;#r;get dev(){return this.#r}#n;get mode(){return this.#n}#e;get nlink(){return this.#e}#o;get uid(){return this.#o}#c;get gid(){return this.#c}#l;get rdev(){return this.#l}#d;get blksize(){return this.#d}#u;get ino(){return this.#u}#a;get size(){return this.#a}#s;get blocks(){return this.#s}#y;get atimeMs(){return this.#y}#p;get mtimeMs(){return this.#p}#m;get ctimeMs(){return this.#m}#g;get birthtimeMs(){return this.#g}#v;get atime(){return this.#v}#E;get mtime(){return this.#E}#C;get ctime(){return this.#C}#x;get birthtime(){return this.#x}#S;#w;#_;#h;#R;#A;#i;#k;#b;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,r=Ss,n,s,o,a,c){this.name=t,this.#S=o?Bm(t):df(t),this.#i=r&Lde,this.nocase=o,this.roots=s,this.root=n||this,this.#k=a,this.#_=c.fullpath,this.#R=c.relative,this.#A=c.relativePosix,this.parent=c.parent,this.parent?this.#t=this.parent.#t:this.#t=oB(c.fs)}depth(){return this.#w!==void 0?this.#w:this.parent?this.#w=this.parent.depth()+1:this.#w=0}childrenCache(){return this.#k}resolve(t){if(!t)return this;let r=this.getRootString(t),s=t.substring(r.length).split(this.splitSep);return r?this.getRoot(r).#N(s):this.#N(s)}#N(t){let r=this;for(let n of t)r=r.child(n);return r}children(){let t=this.#k.get(this);if(t)return t;let r=Object.assign([],{provisional:0});return this.#k.set(this,r),this.#i&=~QC,r}child(t,r){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let n=this.children(),s=this.nocase?Bm(t):df(t);for(let l of n)if(l.#S===s)return l;let o=this.parent?this.sep:"",a=this.#_?this.#_+o+t:void 0,c=this.newChild(t,Ss,{...r,parent:this,fullpath:a});return this.canReaddir()||(c.#i|=Hs),n.push(c),c}relative(){if(this.isCWD)return"";if(this.#R!==void 0)return this.#R;let t=this.name,r=this.parent;if(!r)return this.#R=this.name;let n=r.relative();return n+(!n||!r.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let t=this.name,r=this.parent;if(!r)return this.#A=this.fullpathPosix();let n=r.relativePosix();return n+(!n||!r.parent?"":"/")+t}fullpath(){if(this.#_!==void 0)return this.#_;let t=this.name,r=this.parent;if(!r)return this.#_=this.name;let s=r.fullpath()+(r.parent?this.sep:"")+t;return this.#_=s}fullpathPosix(){if(this.#h!==void 0)return this.#h;if(this.sep==="/")return this.#h=this.fullpath();if(!this.parent){let s=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(s)?this.#h=`//?/${s}`:this.#h=s}let t=this.parent,r=t.fullpathPosix(),n=r+(!r||!t.parent?"":"/")+this.name;return this.#h=n}isUnknown(){return(this.#i&bs)===Ss}isType(t){return this[`is${t}`]()}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.#i&bs)===dB}isDirectory(){return(this.#i&bs)===yi}isCharacterDevice(){return(this.#i&bs)===lB}isBlockDevice(){return(this.#i&bs)===uB}isFIFO(){return(this.#i&bs)===cB}isSocket(){return(this.#i&bs)===fB}isSymbolicLink(){return(this.#i&rc)===rc}lstatCached(){return this.#i&hB?this:void 0}readlinkCached(){return this.#b}realpathCached(){return this.#O}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#b)return!0;if(!this.parent)return!1;let t=this.#i&bs;return!(t!==Ss&&t!==rc||this.#i&Nm||this.#i&Hs)}calledReaddir(){return!!(this.#i&QC)}isENOENT(){return!!(this.#i&Hs)}isNamed(t){return this.nocase?this.#S===Bm(t):this.#S===df(t)}async readlink(){let t=this.#b;if(t)return t;if(this.canReadlink()&&this.parent)try{let r=await this.#t.promises.readlink(this.fullpath()),n=(await this.parent.realpath())?.resolve(r);if(n)return this.#b=n}catch(r){this.#f(r.code);return}}readlinkSync(){let t=this.#b;if(t)return t;if(this.canReadlink()&&this.parent)try{let r=this.#t.readlinkSync(this.fullpath()),n=this.parent.realpathSync()?.resolve(r);if(n)return this.#b=n}catch(r){this.#f(r.code);return}}#D(t){this.#i|=QC;for(let r=t.provisional;r<t.length;r++){let n=t[r];n&&n.#B()}}#B(){this.#i&Hs||(this.#i=(this.#i|Hs)&lf,this.#T())}#T(){let t=this.children();t.provisional=0;for(let r of t)r.#B()}#P(){this.#i|=Dm,this.#M()}#M(){if(this.#i&uf)return;let t=this.#i;(t&bs)===yi&&(t&=lf),this.#i=t|uf,this.#T()}#$(t=""){t==="ENOTDIR"||t==="EPERM"?this.#M():t==="ENOENT"?this.#B():this.children().provisional=0}#L(t=""){t==="ENOTDIR"?this.parent.#M():t==="ENOENT"&&this.#B()}#f(t=""){let r=this.#i;r|=Nm,t==="ENOENT"&&(r|=Hs),(t==="EINVAL"||t==="UNKNOWN")&&(r&=lf),this.#i=r,t==="ENOTDIR"&&this.parent&&this.parent.#M()}#F(t,r){return this.#I(t,r)||this.#j(t,r)}#j(t,r){let n=ZC(t),s=this.newChild(t.name,n,{parent:this}),o=s.#i&bs;return o!==yi&&o!==rc&&o!==Ss&&(s.#i|=uf),r.unshift(s),r.provisional++,s}#I(t,r){for(let n=r.provisional;n<r.length;n++){let s=r[n];if((this.nocase?Bm(t.name):df(t.name))===s.#S)return this.#U(t,s,n,r)}}#U(t,r,n,s){let o=r.name;return r.#i=r.#i&lf|ZC(t),o!==t.name&&(r.name=t.name),n!==s.provisional&&(n===s.length-1?s.pop():s.splice(n,1),s.unshift(r)),s.provisional++,r}async lstat(){if((this.#i&Hs)===0)try{return this.#z(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#L(t.code)}}lstatSync(){if((this.#i&Hs)===0)try{return this.#z(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#L(t.code)}}#z(t){let{atime:r,atimeMs:n,birthtime:s,birthtimeMs:o,blksize:a,blocks:c,ctime:l,ctimeMs:u,dev:d,gid:f,ino:m,mode:g,mtime:E,mtimeMs:w,nlink:_,rdev:v,size:N,uid:$}=t;this.#v=r,this.#y=n,this.#x=s,this.#g=o,this.#d=a,this.#s=c,this.#C=l,this.#m=u,this.#r=d,this.#c=f,this.#u=m,this.#n=g,this.#E=E,this.#p=w,this.#e=_,this.#l=v,this.#a=N,this.#o=$;let j=ZC(t);this.#i=this.#i&lf|j|hB,j!==Ss&&j!==yi&&j!==rc&&(this.#i|=uf)}#H=[];#G=!1;#V(t){this.#G=!1;let r=this.#H.slice();this.#H.length=0,r.forEach(n=>n(null,t))}readdirCB(t,r=!1){if(!this.canReaddir()){r?t(null,[]):queueMicrotask(()=>t(null,[]));return}let n=this.children();if(this.calledReaddir()){let o=n.slice(0,n.provisional);r?t(null,o):queueMicrotask(()=>t(null,o));return}if(this.#H.push(t),this.#G)return;this.#G=!0;let s=this.fullpath();this.#t.readdir(s,{withFileTypes:!0},(o,a)=>{if(o)this.#$(o.code),n.provisional=0;else{for(let c of a)this.#F(c,n);this.#D(n)}this.#V(n.slice(0,n.provisional))})}#q;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let r=this.fullpath();if(this.#q)await this.#q;else{let n=i(()=>{},"resolve");this.#q=new Promise(s=>n=s);try{for(let s of await this.#t.promises.readdir(r,{withFileTypes:!0}))this.#F(s,t);this.#D(t)}catch(s){this.#$(s.code),t.provisional=0}this.#q=void 0,n()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let r=this.fullpath();try{for(let n of this.#t.readdirSync(r,{withFileTypes:!0}))this.#F(n,t);this.#D(t)}catch(n){this.#$(n.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#i&pB)return!1;let t=bs&this.#i;return t===Ss||t===yi||t===rc}shouldWalk(t,r){return(this.#i&yi)===yi&&!(this.#i&pB)&&!t.has(this)&&(!r||r(this))}async realpath(){if(this.#O)return this.#O;if(!((Dm|Nm|Hs)&this.#i))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#O=this.resolve(t)}catch{this.#P()}}realpathSync(){if(this.#O)return this.#O;if(!((Dm|Nm|Hs)&this.#i))try{let t=this.#t.realpathSync(this.fullpath());return this.#O=this.resolve(t)}catch{this.#P()}}[yB](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let r=new Set([]),n=[],s=this;for(;s&&s.parent;)r.add(s),s.#R=n.join(this.sep),s.#A=n.join("/"),s=s.parent,n.push("..");for(s=t;s&&s.parent&&!r.has(s);)s.#R=void 0,s.#A=void 0,s=s.parent}},$m=class e extends en{static{i(this,"PathWin32")}sep="\\";splitSep=$de;constructor(t,r=Ss,n,s,o,a,c){super(t,r,n,s,o,a,c)}newChild(t,r=Ss,n={}){return new e(t,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(t){return Cl.win32.parse(t).root}getRoot(t){if(t=Mde(t.toUpperCase()),t===this.root.name)return this.root;for(let[r,n]of Object.entries(this.roots))if(this.sameRoot(t,r))return this.roots[t]=n;return this.roots[t]=new wl(t,this).root}sameRoot(t,r=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(aB,"$1\\"),t===r}},Lm=class e extends en{static{i(this,"PathPosix")}splitSep="/";sep="/";constructor(t,r=Ss,n,s,o,a,c){super(t,r,n,s,o,a,c)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,r=Ss,n={}){return new e(t,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}},Fm=class{static{i(this,"PathScurryBase")}root;rootPath;roots;cwd;#t;#r;#n;nocase;#e;constructor(t=process.cwd(),r,n,{nocase:s,childrenCacheSize:o=16*1024,fs:a=cf}={}){this.#e=oB(a),(t instanceof URL||t.startsWith("file://"))&&(t=(0,EB.fileURLToPath)(t));let c=r.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#t=new Mm,this.#r=new Mm,this.#n=new ex(o);let l=c.substring(this.rootPath.length).split(n);if(l.length===1&&!l[0]&&l.pop(),s===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=s,this.root=this.newRoot(this.#e),this.roots[this.rootPath]=this.root;let u=this.root,d=l.length-1,f=r.sep,m=this.rootPath,g=!1;for(let E of l){let w=d--;u=u.child(E,{relative:new Array(w).fill("..").join(f),relativePosix:new Array(w).fill("..").join("/"),fullpath:m+=(g?"":f)+E}),g=!0}this.cwd=u}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#n}resolve(...t){let r="";for(let o=t.length-1;o>=0;o--){let a=t[o];if(!(!a||a===".")&&(r=r?`${a}/${r}`:a,this.isAbsolute(a)))break}let n=this.#t.get(r);if(n!==void 0)return n;let s=this.cwd.resolve(r).fullpath();return this.#t.set(r,s),s}resolvePosix(...t){let r="";for(let o=t.length-1;o>=0;o--){let a=t[o];if(!(!a||a===".")&&(r=r?`${a}/${r}`:a,this.isAbsolute(a)))break}let n=this.#r.get(r);if(n!==void 0)return n;let s=this.cwd.resolve(r).fullpathPosix();return this.#r.set(r,s),s}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,r={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd);let{withFileTypes:n}=r;if(t.canReaddir()){let s=await t.readdir();return n?s:s.map(o=>o.name)}else return[]}readdirSync(t=this.cwd,r={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd);let{withFileTypes:n=!0}=r;return t.canReaddir()?n?t.readdirSync():t.readdirSync().map(s=>s.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t.withFileTypes,t=this.cwd);let n=await t.readlink();return r?n:n?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t.withFileTypes,t=this.cwd);let n=t.readlinkSync();return r?n:n?.fullpath()}async realpath(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t.withFileTypes,t=this.cwd);let n=await t.realpath();return r?n:n?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t.withFileTypes,t=this.cwd);let n=t.realpathSync();return r?n:n?.fullpath()}async walk(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:a}=r,c=[];(!o||o(t))&&c.push(n?t:t.fullpath());let l=new Set,u=i((f,m)=>{l.add(f),f.readdirCB((g,E)=>{if(g)return m(g);let w=E.length;if(!w)return m();let _=i(()=>{--w===0&&m()},"next");for(let v of E)(!o||o(v))&&c.push(n?v:v.fullpath()),s&&v.isSymbolicLink()?v.realpath().then(N=>N?.isUnknown()?N.lstat():N).then(N=>N?.shouldWalk(l,a)?u(N,_):_()):v.shouldWalk(l,a)?u(v,_):_()},!0)},"walk"),d=t;return new Promise((f,m)=>{u(d,g=>{if(g)return m(g);f(c)})})}walkSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:a}=r,c=[];(!o||o(t))&&c.push(n?t:t.fullpath());let l=new Set([t]);for(let u of l){let d=u.readdirSync();for(let f of d){(!o||o(f))&&c.push(n?f:f.fullpath());let m=f;if(f.isSymbolicLink()){if(!(s&&(m=f.realpathSync())))continue;m.isUnknown()&&m.lstatSync()}m.shouldWalk(l,a)&&l.add(m)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,r={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd),this.stream(t,r)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:a}=r;(!o||o(t))&&(yield n?t:t.fullpath());let c=new Set([t]);for(let l of c){let u=l.readdirSync();for(let d of u){(!o||o(d))&&(yield n?d:d.fullpath());let f=d;if(d.isSymbolicLink()){if(!(s&&(f=d.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(c,a)&&c.add(f)}}}stream(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:a}=r,c=new zo({objectMode:!0});(!o||o(t))&&c.write(n?t:t.fullpath());let l=new Set,u=[t],d=0,f=i(()=>{let m=!1;for(;!m;){let g=u.shift();if(!g){d===0&&c.end();return}d++,l.add(g);let E=i((_,v,N=!1)=>{if(_)return c.emit("error",_);if(s&&!N){let $=[];for(let j of v)j.isSymbolicLink()&&$.push(j.realpath().then(se=>se?.isUnknown()?se.lstat():se));if($.length){Promise.all($).then(()=>E(null,v,!0));return}}for(let $ of v)$&&(!o||o($))&&(c.write(n?$:$.fullpath())||(m=!0));d--;for(let $ of v){let j=$.realpathCached()||$;j.shouldWalk(l,a)&&u.push(j)}m&&!c.flowing?c.once("drain",f):w||f()},"onReaddir"),w=!0;g.readdirCB(E,!0),w=!1}},"process");return f(),c}streamSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof en||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:a}=r,c=new zo({objectMode:!0}),l=new Set;(!o||o(t))&&c.write(n?t:t.fullpath());let u=[t],d=0,f=i(()=>{let m=!1;for(;!m;){let g=u.shift();if(!g){d===0&&c.end();return}d++,l.add(g);let E=g.readdirSync();for(let w of E)(!o||o(w))&&(c.write(n?w:w.fullpath())||(m=!0));d--;for(let w of E){let _=w;if(w.isSymbolicLink()){if(!(s&&(_=w.realpathSync())))continue;_.isUnknown()&&_.lstatSync()}_.shouldWalk(l,a)&&u.push(_)}}m&&!c.flowing&&c.once("drain",f)},"process");return f(),c}chdir(t=this.cwd){let r=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[yB](r)}},wl=class extends Fm{static{i(this,"PathScurryWin32")}sep="\\";constructor(t=process.cwd(),r={}){let{nocase:n=!0}=r;super(t,Cl.win32,"\\",{...r,nocase:n}),this.nocase=n;for(let s=this.cwd;s;s=s.parent)s.nocase=this.nocase}parseRootPath(t){return Cl.win32.parse(t).root.toUpperCase()}newRoot(t){return new $m(this.rootPath,yi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},_l=class extends Fm{static{i(this,"PathScurryPosix")}sep="/";constructor(t=process.cwd(),r={}){let{nocase:n=!1}=r;super(t,Cl.posix,"/",{...r,nocase:n}),this.nocase=n}parseRootPath(t){return"/"}newRoot(t){return new Lm(this.rootPath,yi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},ff=class extends _l{static{i(this,"PathScurryDarwin")}constructor(t=process.cwd(),r={}){let{nocase:n=!0}=r;super(t,{...r,nocase:n})}},Nze=process.platform==="win32"?$m:Lm,SB=process.platform==="win32"?wl:process.platform==="darwin"?ff:_l;var Fde=i(e=>e.length>=1,"isPatternList"),jde=i(e=>e.length>=1,"isGlobList"),xl=class e{static{i(this,"Pattern")}#t;#r;#n;length;#e;#o;#c;#l;#d;#u;#a=!0;constructor(t,r,n,s){if(!Fde(t))throw new TypeError("empty pattern list");if(!jde(r))throw new TypeError("empty glob list");if(r.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,n<0||n>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#r=r,this.#n=n,this.#e=s,this.#n===0){if(this.isUNC()){let[o,a,c,l,...u]=this.#t,[d,f,m,g,...E]=this.#r;u[0]===""&&(u.shift(),E.shift());let w=[o,a,c,l,""].join("/"),_=[d,f,m,g,""].join("/");this.#t=[w,...u],this.#r=[_,...E],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[o,...a]=this.#t,[c,...l]=this.#r;a[0]===""&&(a.shift(),l.shift());let u=o+"/",d=c+"/";this.#t=[u,...a],this.#r=[d,...l],this.length=this.#t.length}}}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===Gr}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#c=this.#c||(this.#n===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new e(this.#t,this.#r,this.#n+1,this.#e),this.#o.#u=this.#u,this.#o.#d=this.#d,this.#o.#l=this.#l,this.#o):this.#o=null}isUNC(){let t=this.#t;return this.#d!==void 0?this.#d:this.#d=this.#e==="win32"&&this.#n===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#l!==void 0?this.#l:this.#l=this.#e==="win32"&&this.#n===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#u!==void 0?this.#u:this.#u=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#n===0?t:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#a)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#a?!1:(this.#a=!1,!0)}};var Ude=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",vl=class{static{i(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:r,nocase:n,noext:s,noglobstar:o,platform:a=Ude}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:r,nocase:n,noext:s,noglobstar:o,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let c of t)this.add(c)}add(t){let r=new Qn(t,this.mmopts);for(let n=0;n<r.set.length;n++){let s=r.set[n],o=r.globParts[n];if(!s||!o)throw new Error("invalid pattern object");for(;s[0]==="."&&o[0]===".";)s.shift(),o.shift();let a=new xl(s,o,0,this.platform),c=new Qn(a.globString(),this.mmopts),l=o[o.length-1]==="**",u=a.isAbsolute();u?this.absolute.push(c):this.relative.push(c),l&&(u?this.absoluteChildren.push(c):this.relativeChildren.push(c))}}ignored(t){let r=t.fullpath(),n=`${r}/`,s=t.relative()||".",o=`${s}/`;for(let a of this.relative)if(a.match(s)||a.match(o))return!0;for(let a of this.absolute)if(a.match(r)||a.match(n))return!0;return!1}childrenIgnored(t){let r=t.fullpath()+"/",n=(t.relative()||".")+"/";for(let s of this.relativeChildren)if(s.match(n))return!0;for(let s of this.absoluteChildren)if(s.match(r))return!0;return!1}};var tx=class e{static{i(this,"HasWalkedCache")}store;constructor(t=new Map){this.store=t}copy(){return new e(new Map(this.store))}hasWalked(t,r){return this.store.get(t.fullpath())?.has(r.globString())}storeWalked(t,r){let n=t.fullpath(),s=this.store.get(n);s?s.add(r.globString()):this.store.set(n,new Set([r.globString()]))}},rx=class{static{i(this,"MatchRecord")}store=new Map;add(t,r,n){let s=(r?2:0)|(n?1:0),o=this.store.get(t);this.store.set(t,o===void 0?s:s&o)}entries(){return[...this.store.entries()].map(([t,r])=>[t,!!(r&2),!!(r&1)])}},nx=class{static{i(this,"SubWalks")}store=new Map;add(t,r){if(!t.canReaddir())return;let n=this.store.get(t);n?n.find(s=>s.globString()===r.globString())||n.push(r):this.store.set(t,[r])}get(t){let r=this.store.get(t);if(!r)throw new Error("attempting to walk unknown path");return r}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},hf=class e{static{i(this,"Processor")}hasWalkedCache;matches=new rx;subwalks=new nx;patterns;follow;dot;opts;constructor(t,r){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=r?r.copy():new tx}processPatterns(t,r){this.patterns=r;let n=r.map(s=>[t,s]);for(let[s,o]of n){this.hasWalkedCache.storeWalked(s,o);let a=o.root(),c=o.isAbsolute()&&this.opts.absolute!==!1;if(a){s=s.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let f=o.rest();if(f)o=f;else{this.matches.add(s,!0,!1);continue}}if(s.isENOENT())continue;let l,u,d=!1;for(;typeof(l=o.pattern())=="string"&&(u=o.rest());)s=s.resolve(l),o=u,d=!0;if(l=o.pattern(),u=o.rest(),d){if(this.hasWalkedCache.hasWalked(s,o))continue;this.hasWalkedCache.storeWalked(s,o)}if(typeof l=="string"){let f=l===".."||l===""||l===".";this.matches.add(s.resolve(l),c,f);continue}else if(l===Gr){(!s.isSymbolicLink()||this.follow||o.checkFollowGlobstar())&&this.subwalks.add(s,o);let f=u?.pattern(),m=u?.rest();if(!u||(f===""||f===".")&&!m)this.matches.add(s,c,f===""||f===".");else if(f===".."){let g=s.parent||s;m?this.hasWalkedCache.hasWalked(g,m)||this.subwalks.add(g,m):this.matches.add(g,c,!0)}}else l instanceof RegExp&&this.subwalks.add(s,o)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new e(this.opts,this.hasWalkedCache)}filterEntries(t,r){let n=this.subwalks.get(t),s=this.child();for(let o of r)for(let a of n){let c=a.isAbsolute(),l=a.pattern(),u=a.rest();l===Gr?s.testGlobstar(o,a,u,c):l instanceof RegExp?s.testRegExp(o,l,u,c):s.testString(o,l,u,c)}return s}testGlobstar(t,r,n,s){if((this.dot||!t.name.startsWith("."))&&(r.hasMore()||this.matches.add(t,s,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,r):t.isSymbolicLink()&&(n&&r.checkFollowGlobstar()?this.subwalks.add(t,n):r.markFollowGlobstar()&&this.subwalks.add(t,r)))),n){let o=n.pattern();if(typeof o=="string"&&o!==".."&&o!==""&&o!==".")this.testString(t,o,n.rest(),s);else if(o===".."){let a=t.parent||t;this.subwalks.add(a,n)}else o instanceof RegExp&&this.testRegExp(t,o,n.rest(),s)}}testRegExp(t,r,n,s){r.test(t.name)&&(n?this.subwalks.add(t,n):this.matches.add(t,s,!1))}testString(t,r,n,s){t.isNamed(r)&&(n?this.subwalks.add(t,n):this.matches.add(t,s,!1))}};var qde=i((e,t)=>typeof e=="string"?new vl([e],t):Array.isArray(e)?new vl(e,t):e,"makeIgnore"),jm=class{static{i(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#r;#n;signal;maxDepth;includeChildMatches;constructor(t,r,n){if(this.patterns=t,this.path=r,this.opts=n,this.#n=!n.posix&&n.platform==="win32"?"\\":"/",this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#r=qde(n.ignore??[],n),!this.includeChildMatches&&typeof this.#r.add!="function")){let s="cannot ignore child matches, ignore lacks add() method.";throw new Error(s)}this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#e(t){return this.seen.has(t)||!!this.#r?.ignored?.(t)}#o(t){return!!this.#r?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=t.realpathCached()||await t.realpath(),!n)return;t=n}let o=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&o?.isSymbolicLink()){let a=await o.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.lstat()}return this.matchCheckTest(o,r)}matchCheckTest(t,r){return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!r||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#e(t)?t:void 0}matchCheckSync(t,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=t.realpathCached()||t.realpathSync(),!n)return;t=n}let o=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&o?.isSymbolicLink()){let a=o.realpathSync();a&&(a?.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(o,r)}matchFinish(t,r){if(this.#e(t))return;if(!this.includeChildMatches&&this.#r?.add){let o=`${t.relativePosix()}/**`;this.#r.add(o)}let n=this.opts.absolute===void 0?r:this.opts.absolute;this.seen.add(t);let s=this.opts.mark&&t.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(n){let o=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(o+s)}else{let o=this.opts.posix?t.relativePosix():t.relative(),a=this.opts.dotRelative&&!o.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(o?a+o+s:"."+s)}}async match(t,r,n){let s=await this.matchCheck(t,n);s&&this.matchFinish(s,r)}matchSync(t,r,n){let s=this.matchCheckSync(t,n);s&&this.matchFinish(s,r)}walkCB(t,r,n){this.signal?.aborted&&n(),this.walkCB2(t,r,new hf(this.opts),n)}walkCB2(t,r,n,s){if(this.#o(t))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2(t,r,n,s));return}n.processPatterns(t,r);let o=1,a=i(()=>{--o===0&&s()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||(o++,this.match(c,l,u).then(()=>a()));for(let c of n.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;o++;let l=c.readdirCached();c.calledReaddir()?this.walkCB3(c,l,n,a):c.readdirCB((u,d)=>this.walkCB3(c,d,n,a),!0)}a()}walkCB3(t,r,n,s){n=n.filterEntries(t,r);let o=1,a=i(()=>{--o===0&&s()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||(o++,this.match(c,l,u).then(()=>a()));for(let[c,l]of n.subwalks.entries())o++,this.walkCB2(c,l,n.child(),a);a()}walkCBSync(t,r,n){this.signal?.aborted&&n(),this.walkCB2Sync(t,r,new hf(this.opts),n)}walkCB2Sync(t,r,n,s){if(this.#o(t))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2Sync(t,r,n,s));return}n.processPatterns(t,r);let o=1,a=i(()=>{--o===0&&s()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||this.matchSync(c,l,u);for(let c of n.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;o++;let l=c.readdirSync();this.walkCB3Sync(c,l,n,a)}a()}walkCB3Sync(t,r,n,s){n=n.filterEntries(t,r);let o=1,a=i(()=>{--o===0&&s()},"next");for(let[c,l,u]of n.matches.entries())this.#e(c)||this.matchSync(c,l,u);for(let[c,l]of n.subwalks.entries())o++,this.walkCB2Sync(c,l,n.child(),a);a()}},pf=class extends jm{static{i(this,"GlobWalker")}matches=new Set;constructor(t,r,n){super(t,r,n)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,r)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?r(this.signal.reason):t(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},mf=class extends jm{static{i(this,"GlobStream")}results;constructor(t,r,n){super(t,r,n),this.results=new zo({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end())}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var bB=require("node:url"),Hde=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Gs=class{static{i(this,"Glob")}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(t,r){if(!r)throw new TypeError("glob options required");if(this.withFileTypes=!!r.withFileTypes,this.signal=r.signal,this.follow=!!r.follow,this.dot=!!r.dot,this.dotRelative=!!r.dotRelative,this.nodir=!!r.nodir,this.mark=!!r.mark,r.cwd?(r.cwd instanceof URL||r.cwd.startsWith("file://"))&&(r.cwd=(0,bB.fileURLToPath)(r.cwd)):this.cwd="",this.cwd=r.cwd||"",this.root=r.root,this.magicalBraces=!!r.magicalBraces,this.nobrace=!!r.nobrace,this.noext=!!r.noext,this.realpath=!!r.realpath,this.absolute=r.absolute,this.includeChildMatches=r.includeChildMatches!==!1,this.noglobstar=!!r.noglobstar,this.matchBase=!!r.matchBase,this.maxDepth=typeof r.maxDepth=="number"?r.maxDepth:1/0,this.stat=!!r.stat,this.ignore=r.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(r.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=t,this.platform=r.platform||Hde,this.opts={...r,platform:this.platform},r.scurry){if(this.scurry=r.scurry,r.nocase!==void 0&&r.nocase!==r.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=r.platform==="win32"?wl:r.platform==="darwin"?ff:r.platform?_l:SB;this.scurry=new l(this.cwd,{nocase:r.nocase,fs:r.fs})}this.nocase=this.scurry.nocase;let n=this.platform==="darwin"||this.platform==="win32",s={...r,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},o=this.pattern.map(l=>new Qn(l,s)),[a,c]=o.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=a.map((l,u)=>{let d=c[u];if(!d)throw new Error("invalid pattern object");return new xl(l,d,0,this.platform)})}async walk(){return[...await new pf(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 pf(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 mf(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 mf(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 sx=i((e,t={})=>{Array.isArray(e)||(e=[e]);for(let r of e)if(new Qn(r,t).hasMagic())return!0;return!1},"hasMagic");function Um(e,t={}){return new Gs(e,t).streamSync()}i(Um,"globStreamSync");function wB(e,t={}){return new Gs(e,t).stream()}i(wB,"globStream");function _B(e,t={}){return new Gs(e,t).walkSync()}i(_B,"globSync");async function CB(e,t={}){return new Gs(e,t).walk()}i(CB,"glob_");function qm(e,t={}){return new Gs(e,t).iterateSync()}i(qm,"globIterateSync");function xB(e,t={}){return new Gs(e,t).iterate()}i(xB,"globIterate");var Gde=Um,zde=Object.assign(wB,{sync:Um}),Vde=qm,Wde=Object.assign(xB,{sync:qm}),Kde=Object.assign(_B,{stream:Um,iterate:qm}),Hm=Object.assign(CB,{glob:CB,globSync:_B,sync:Kde,globStream:wB,stream:zde,globStreamSync:Um,streamSync:Gde,globIterate:xB,iterate:Wde,globIterateSync:qm,iterateSync:Vde,Glob:Gs,hasMagic:sx,escape:gl,unescape:Us});Hm.glob=Hm;var vB=require("node:path"),ix=k(Hn(),1);async function zs(...e){let t=await Hm(...e);return t.forEach((r,n)=>{t[n]=t[n].toString().replace(/\\/g,"/")}),t}i(zs,"normalizedGlob");function Gm(e){let t=process.cwd();return e!==t&&(e=(0,vB.resolve)(t,e)),e=e.replace(/\\/g,"/"),e}i(Gm,"getProjectDir");async function nc(e){return await ix.default.pathExists(e)?ix.default.readdir(e):[]}i(nc,"tryReadDir");var AB=k(require("node:os"),1),RB=require("node:path/posix"),Vs;function TB(e){Vs=e}i(TB,"setPVRTexToolAbsolutePath");async function PB(){if(process.env.PVRTexToolCLI)return Vs=process.env.PVRTexToolCLI;let e=AB.default.platform(),t=null;switch(e){case"darwin":t="/Applications/Imagination/";break;case"win32":t="C:/Imagination Technologies/";break;default:break}if(!t)return;let r=await zs((0,RB.join)(t,"**"),{nodir:!0});switch(e){case"darwin":return Vs=r.find(n=>n.endsWith("macOS/PVRTexToolCLI"));case"win32":return Vs=r.find(n=>n.endsWith("Windows_x86_64/PVRTexToolCLI.exe"))}}i(PB,"locatePVRTexTool");var Ve=require("node:path/posix"),ir=require("node:fs/promises"),or=k(Hn(),1);async function kB(e){await Promise.all([or.default.ensureDir((0,Ve.join)(e,"nodes")),or.default.ensureDir((0,Ve.join)(e,"meshes")),or.default.ensureDir((0,Ve.join)(e,"lods")),or.default.ensureDir((0,Ve.join)(e,"lights")),or.default.ensureDir((0,Ve.join)(e,"cameras")),or.default.ensureDir((0,Ve.join)(e,"geometries")),or.default.ensureDir((0,Ve.join)(e,"skeletons")),or.default.ensureDir((0,Ve.join)(e,"shadowGenerators")),or.default.ensureDir((0,Ve.join)(e,"sceneLinks")),or.default.ensureDir((0,Ve.join)(e,"gui")),or.default.ensureDir((0,Ve.join)(e,"sounds")),or.default.ensureDir((0,Ve.join)(e,"soundNodes")),or.default.ensureDir((0,Ve.join)(e,"particleSystems")),or.default.ensureDir((0,Ve.join)(e,"morphTargetManagers")),or.default.ensureDir((0,Ve.join)(e,"morphTargets")),or.default.ensureDir((0,Ve.join)(e,"animationGroups")),or.default.ensureDir((0,Ve.join)(e,"sprite-maps")),or.default.ensureDir((0,Ve.join)(e,"sprite-managers")),or.default.ensureDir((0,Ve.join)(e,"nodeParticleSystemSets"))])}i(kB,"ensureSceneDirectories");async function OB(e){let[t,r,n,s,o,a,c,l,u,d,f,m,g,E,w,_,v,N,$]=await Promise.all([(0,ir.readdir)((0,Ve.join)(e,"nodes")),(0,ir.readdir)((0,Ve.join)(e,"meshes")),(0,ir.readdir)((0,Ve.join)(e,"lods")),(0,ir.readdir)((0,Ve.join)(e,"lights")),(0,ir.readdir)((0,Ve.join)(e,"cameras")),(0,ir.readdir)((0,Ve.join)(e,"skeletons")),(0,ir.readdir)((0,Ve.join)(e,"shadowGenerators")),(0,ir.readdir)((0,Ve.join)(e,"sceneLinks")),(0,ir.readdir)((0,Ve.join)(e,"gui")),(0,ir.readdir)((0,Ve.join)(e,"sounds")),(0,ir.readdir)((0,Ve.join)(e,"soundNodes")),(0,ir.readdir)((0,Ve.join)(e,"particleSystems")),(0,ir.readdir)((0,Ve.join)(e,"morphTargetManagers")),(0,ir.readdir)((0,Ve.join)(e,"morphTargets")),(0,ir.readdir)((0,Ve.join)(e,"animationGroups")),(0,ir.readdir)((0,Ve.join)(e,"sprite-maps")),(0,ir.readdir)((0,Ve.join)(e,"sprite-managers")),(0,ir.readdir)((0,Ve.join)(e,"geometries")),(0,ir.readdir)((0,Ve.join)(e,"nodeParticleSystemSets"))]);return{nodesFiles:t,meshesFiles:r,lodsFiles:n,lightsFiles:s,cameraFiles:o,skeletonFiles:a,shadowGeneratorFiles:c,sceneLinkFiles:l,guiFiles:u,soundFiles:d,soundNodeFiles:f,particleSystemFiles:m,morphTargetManagerFiles:g,morphTargetFiles:E,animationGroupFiles:w,spriteMapFiles:_,spriteManagerFiles:v,geometryFiles:N,nodeParticleSystemSetFiles:$}}i(OB,"readSceneDirectories");var R2=require("node:child_process");function T2(e){return new Promise((t,r)=>{(0,R2.exec)(e,(n,s,o)=>{n?(console.error(mi.red(e),mi.red(o)),r(n)):(console.log(mi.gray(e),mi.gray(s)),t())})})}i(T2,"executeAsync");var Yo=require("node:path/posix"),k2=k(Hn(),1),O2=k(A2(),1),I2=require("node:fs"),Zfe=["-astc.ktx","-dxt.ktx","-pvrtc.ktx","-etc1.ktx","-etc2.ktx"],ehe=[".png",".jpg",".jpeg",".bmp"];function the(e,t){return`${e.substring(0,e.lastIndexOf("."))}${t}`}i(the,"getCompressedTextureFilename");async function _s(e,t){t.format?await P2(e,t):await Promise.all(Zfe.map(r=>P2(e,{...t,format:r})))}i(_s,"compressFileToKtx");async function P2(e,t){let r=(0,Yo.basename)(e),n=(0,Yo.extname)(r).toLocaleLowerCase();if(!ehe.includes(n))return null;let s=the(r,t.format);if(t.destinationFolder??=(0,Yo.dirname)(e),t.destinationFolder=(0,Yo.join)(t.destinationFolder,s),!t.compressedTexturesEnabled)return t.exportedAssets?.push(t.destinationFolder),null;if(await k2.default.pathExists(t.destinationFolder)&&!t.force)return t.exportedAssets?.push(t.destinationFolder),t.destinationFolder;let o=await new Promise(c=>{let l=(0,I2.createReadStream)(e);l.pipe(new O2.PNG).on("metadata",u=>{c(u.alpha),l.close()}).on("error",()=>{c(!1),l.close()})});if(!Vs)return null;let a=null;switch(t.format){case"-astc.ktx":a=`"${Vs}" -i "${e}" -flip y -pot + -m -dither -ics lRGB -f ASTC_8x8,UBN,lRGB -q astcveryfast -o "${t.destinationFolder}"`;break;case"-dxt.ktx":a=`"${Vs}" -i "${e}" -flip y -pot + -m -dither -ics lRGB ${o?"-l":""} -f ${o?"BC3":"BC1"},UBN,lRGB -o "${t.destinationFolder}"`;break;case"-pvrtc.ktx":a=`"${Vs}" -i "${e}" -flip y -pot + -square + -m -dither -ics lRGB ${o?"-l":""} -f ${o?"PVRTCI_2BPP_RGBA":"PVRTCI_2BPP_RGB"},UBN,lRGB -q pvrtcfastest -o "${t.destinationFolder}"`;break;case"-etc1.ktx":a=`"${Vs}" -i "${e}" -flip y -pot + -m -dither -ics lRGB -f ETC1,UBN,lRGB -q etcfast -o "${t.destinationFolder}"`;break;case"-etc2.ktx":a=`"${Vs}" -i "${e}" -flip y -pot + -m -dither -ics lRGB -f ${o?"ETC2_RGBA":"ETC2_RGB"},UBN,lRGB -q etcfast -o "${t.destinationFolder}"`;break}if(!a)return null;console.log(`Compressing image "${s}"`);try{return await T2(a),console.log(`Compressed image "${s}"`),t.exportedAssets?.push(t.destinationFolder),t.destinationFolder}catch{console.error(`Failed to compress image "${s}"`)}return null}i(P2,"compressFileToKtxFormat");var a$=require("node:path/posix"),c$=require("node:worker_threads"),o$=i((e,t)=>(e=(0,a$.join)(__dirname.replace(/\\/g,"/"),e),new c$.Worker(e,{workerData:t})),"loadWorker"),vf=i(async(e,t)=>{let r=o$(e,t);return new Promise(n=>{r.on("message",s=>{t.id&&s.id!==t.id||(t.id||r.terminate(),n(s))})})},"executeSimpleWorker");function l$(e,t){o$=e,vf=t}i(l$,"overrideWorkerMethods");var Xx=require("node:path/posix"),Jx=k(Hn(),1),u$=k(Yx(),1);async function Ll(e,t){let r=e.split(","),o=r[0].split(";")[1],a=r[1];if(o==="base64"){let c=Buffer.from(a,"base64"),l=(0,u$.default)(c),[u,d]=await Promise.all([l.metadata(),vf("workers/md5.js",c)]),f;switch(u.format){case"png":f=`${d}.png`;break;case"jpg":case"jpeg":f=`${d}.jpg`;break;default:return console.error(`Unsupported embedded texture format while extracting texture: ${u.format}`),null}let m=(0,Xx.join)(t.extractedTexturesOutputPath,f);return await Jx.default.pathExists(m)||await Jx.default.writeFile(m,c),(0,Xx.join)("assets","editor-generated_extracted-textures",f).replace(/\\/g,"/")}return null}i(Ll,"extractTextureAssetFromDataString");async function Af(e,t){try{let r=await fetch(e),n=await r.arrayBuffer(),s=Buffer.from(n).toString("base64"),o=`data:${r.headers.get("content-type")??"image/unknown"};base64,${s}`;return Ll(o,{...t})}catch(r){console.error(`Failed to extract texture from url "${e}": ${r.message}`)}return null}i(Af,"extractTextureAssetFromUrl");function q9e(e=4096,t){let r=t??1,n=[];for(;r<=e;)n.push(r),r<<=1;return n}i(q9e,"getPowerOfTwoSizesUntil");function cc(e){let t=1;for(;t<=e;)t<<=1;return t>>1}i(cc,"getPowerOfTwoUntil");var oo=require("node:path/posix"),Qx=k(Yx(),1),Zx=k(Hn(),1);function Fl(e){return(0,oo.join)(e,"assets","editor-generated_extracted-textures")}i(Fl,"getExtractedTextureOutputPath");async function d$(e,t){let r=(0,oo.extname)(e),n=await(0,Qx.default)(e).metadata();if(!n.width||!n.height)return console.error(`Failed to compute exported image "${e}". Image metadata is invalid.`);let s=n.width,o=n.height,a=s===cc(s)||o===cc(o),c=[],l=s*.66>>0,u=o*.66>>0;a&&(l=cc(l),u=cc(u)),c.push({width:l,height:u});let d=s*.33>>0,f=o*.33>>0;a&&(d=cc(d),f=cc(f)),c.push({width:d,height:f});for(let m of c){let E=`${(0,oo.basename)(e).replace(r,"")}_${m.width}_${m.height}${r}`,w=(0,oo.join)((0,oo.dirname)(e),E);if(t.exportedAssets.push(w),t.force||!await Zx.default.pathExists(w))try{let _=await(0,Qx.default)(e).resize(m.width,m.height).toBuffer();await Zx.default.writeFile(w,_),console.log(`Exported scaled texture "${E}"`),t.onStepChanged?.("assets",{message:`Exported scaled texture "${E}"`})}catch{console.error(`Failed to export image scaled image "${E}"`)}await _s(w,{...t})}}i(d$,"processExportedTexture");var f$=require("node:path/posix"),ug=k(Hn(),1);async function h$(e,t){let r=await ug.default.readJSON(e);if(r.customType!=="BABYLON.NodeMaterial")return;let n=Fl(t.publicDir);await ug.default.ensureDir(n);let s=await ev(r,{extractedTexturesOutputPath:n});await ug.default.writeJSON(e,r,{encoding:"utf-8"}),await Promise.all(s.map(async o=>{let a=(0,f$.join)(t.publicDir,o);t.exportedAssets.push(a),await _s(a,{force:t.force,exportedAssets:t.exportedAssets})}))}i(h$,"processExportedMaterial");async function ev(e,t){let r=e.blocks.filter(s=>(s.customType==="BABYLON.TextureBlock"||s.customType==="BABYLON.ImageSourceBlock")&&s.texture?.name),n=[];return await Promise.all(r.map(async s=>{if(s.texture?.name?.startsWith("http://")||s.texture.name.startsWith("https://")){let o=await Af(s.texture.name,{...t});o&&(n.push(o),s.texture.name=s.texture.url=o)}if(s.texture.name?.startsWith("data:")){let o=await Ll(s.texture.name,{...t});o&&(n.push(o),s.texture.name=s.texture.url=o)}})),n}i(ev,"extractNodeMaterialTextures");var p$=require("node:path/posix"),dg=k(Hn(),1);async function m$(e,t){let r=await dg.default.readJSON(e);if(r.customType!=="BABYLON.NodeParticleSystemSet")return;let n=Fl(t.publicDir);await dg.default.ensureDir(n);let s=await tv(r,{extractedTexturesOutputPath:n});await dg.default.writeJSON(e,r,{encoding:"utf-8"}),await Promise.all(s.map(async o=>{let a=(0,p$.join)(t.publicDir,o);t.exportedAssets.push(a),t.optimize&&await _s(a,{force:t.force,exportedAssets:t.exportedAssets})}))}i(m$,"processExportedNodeParticleSystemSet");async function g$(e,t){let r=null;return e.texture?.name.startsWith("http://")||e.texture?.name.startsWith("https://")?r=await Af(e.texture.name,{...t}):e.texture?.name.startsWith("data:")&&(r=await Ll(e.texture.name,{...t})),r&&(e.texture.name=r,e.texture.url=e.texture.name),r}i(g$,"extractParticleSystemTextures");async function tv(e,t){let r=e.blocks.filter(s=>s.customType==="BABYLON.ParticleTextureSourceBlock"),n=[];return await Promise.all(r.map(async s=>{if(s.url?.startsWith("http://")||s.url?.startsWith("https://")){let o=await Af(s.url,{...t});o&&(n.push(o),s.url=o)}if(s.textureDataUrl?.startsWith("data:")){let o=await Ll(s.textureDataUrl,{...t});o&&(n.push(o),delete s.textureDataUrl,s.url=o,s.serializedCachedData=!1)}})),n}i(tv,"extractNodeParticleSystemSetTextures");var ct=require("node:path/posix"),zt=k(Hn(),1);async function y$(e){let t=[],r=[],n=[],s=[],o=[],a=[],c=[],l=[],u=[],d=[];(await Promise.all(e.directories.meshesFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"meshes",z)),oe=X.meshes[0];if(oe.metadata?.doNotSerialize)return null;oe.delayLoadingFile&&(oe.delayLoadingFile=(0,ct.join)(e.sceneName,(0,ct.basename)(oe.delayLoadingFile))),oe.metadata?.parentId&&(oe.parentId=oe.metadata.parentId),oe.instances?.forEach(Ue=>{Ue.metadata?.parentId&&(Ue.parentId=Ue.metadata.parentId)}),oe.instances=oe.instances?.filter(Ue=>Ue.metadata?.doNotSerialize?null:Ue),X.basePoseMatrix&&(oe.basePoseMatrix=X.basePoseMatrix);let Pe=[];X.materials?.forEach(Ue=>{(s.find(bt=>bt.id===Ue.id)??Pe.find(bt=>bt.id===Ue.id))||Pe.push(Ue)}),X.multiMaterials?.forEach(Ue=>{delete Ue.materialsUniqueIds,a.find(bt=>bt.id===Ue.id)||a.push(Ue)});let ze=[];return X.lods&&(oe.lodMeshIds=[],oe.lodDistances=[],(await Promise.all(X.lods?.map(async Je=>{let bt=await zt.default.readJSON((0,ct.join)(e.sceneFile,"lods",Je)),ot=bt.meshes[0];return ot.delayLoadingFile&&(ot.delayLoadingFile=(0,ct.join)(e.sceneName,(0,ct.basename)(ot.delayLoadingFile))),X.basePoseMatrix&&(ot.basePoseMatrix=X.basePoseMatrix),{lodMesh:ot,distanceOrScreenCoverage:bt.distanceOrScreenCoverage}}))).forEach(Je=>{ze.push(Je.lodMesh),oe.lodMeshIds.push(Je.lodMesh.id),oe.lodDistances.push(Je.distanceOrScreenCoverage)})),{mesh:oe,lodMeshes:ze,effectiveMaterials:Pe}}))).forEach(z=>{z&&(r.push(z.mesh),z.lodMeshes.forEach(X=>{r.push(X)}),z.effectiveMaterials.length&&s.push(...z.effectiveMaterials))});let m=await Promise.all(e.directories.morphTargetManagerFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"morphTargetManagers",z));return e.babylonjsEditorToolsVersion>="5.2.6"?X.targets.forEach(oe=>{oe.delayLoadingFile&&(oe.delayLoadingFile=(0,ct.join)(e.sceneName,"morphTargets",(0,ct.basename)(oe.delayLoadingFile)))}):await Promise.all(X.targets.map(async oe=>{let Pe=(0,ct.join)(e.sceneFile,"morphTargets",(0,ct.basename)(oe.delayLoadingFile)),ze=(await zt.default.readFile(Pe)).buffer;oe.positionsCount&&(oe.positions=Array.prototype.slice.call(new Float32Array(ze,oe.positionsOffset,oe.positionsCount))),oe.normalsCount&&(oe.normals=Array.prototype.slice.call(new Float32Array(ze,oe.normalsOffset,oe.normalsCount))),oe.tangentsCount&&(oe.tangents=Array.prototype.slice.call(new Float32Array(ze,oe.tangentsOffset,oe.tangentsCount))),oe.uvsCount&&(oe.uvs=Array.prototype.slice.call(new Float32Array(ze,oe.uvsOffset,oe.uvsCount))),oe.uv2sCount&&(oe.uv2s=Array.prototype.slice.call(new Float32Array(ze,oe.uv2sOffset,oe.uv2sCount))),delete oe.delayLoadingFile,delete oe.positionsCount,delete oe.normalsCount,delete oe.tangentsCount,delete oe.uvsCount,delete oe.uv2sCount,delete oe.positionsOffset,delete oe.normalsOffset,delete oe.tangentsOffset,delete oe.uvsOffset,delete oe.uv2sOffset})),X}));d.push(...m);let g=await Promise.all(e.directories.nodesFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"nodes",z));return X.metadata?.doNotSerialize?null:(X.metadata?.parentId&&(X.parentId=X.metadata.parentId),X)}));c.push(...g.filter(z=>z!==null));let E=await Promise.all(e.directories.spriteManagerFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"sprite-managers",z));return X.metadata?.doNotSerialize?null:(X.metadata?.parentId&&(X.parentId=X.metadata.parentId),X)}));c.push(...E.filter(z=>z!==null));let w=await Promise.all(e.directories.spriteMapFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"sprite-maps",z));return X.metadata?.doNotSerialize?null:(X.metadata?.parentId&&(X.parentId=X.metadata.parentId),X)}));c.push(...w.filter(z=>z!==null));let _=await Promise.all(e.directories.soundNodeFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"soundNodes",z));return X.metadata?.doNotSerialize?null:(X.metadata?.parentId&&(X.parentId=X.metadata.parentId),X)}));c.push(..._.filter(z=>z!==null));let v=await Promise.all(e.directories.lightsFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"lights",z));return X.metadata?.doNotSerialize?null:(X.metadata?.parentId&&(X.parentId=X.metadata.parentId),X)}));t.push(...v.filter(z=>z!==null));let N=await Promise.all(e.directories.cameraFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"cameras",z));return X.metadata?.doNotSerialize?null:(X.metadata?.parentId&&(X.parentId=X.metadata.parentId),X)}));n.push(...N.filter(z=>z!==null));let $=Fl(e.publicDir);await zt.default.ensureDir($),await Promise.all(s.map(async z=>{if(z.customType==="BABYLON.NodeMaterial"){let X=await ev(z,{extractedTexturesOutputPath:$});await Promise.all(X.map(async oe=>{let Pe=(0,ct.join)(e.publicDir,oe);e.exportedAssets.push(Pe),e.optimize&&e.compressedTexturesEnabled&&await _s(Pe,{...e,force:!1,exportedAssets:e.exportedAssets})}))}}));let j=await Promise.all(e.directories.particleSystemFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"particleSystems",z));if(X.metadata?.doNotSerialize)return null;let oe=await g$(X,{extractedTexturesOutputPath:$});if(oe){let Pe=(0,ct.join)(e.publicDir,oe);e.exportedAssets.push(Pe),e.optimize&&e.compressedTexturesEnabled&&await _s(Pe,{...e,force:!1,exportedAssets:e.exportedAssets})}return X}));l.push(...j.filter(z=>z!==null));let se=await Promise.all(e.directories.nodeParticleSystemSetFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"nodeParticleSystemSets",z));if(X.metadata?.doNotSerialize)return null;if(X.metadata?.parentId&&(X.parentId=X.metadata.parentId),X.nodeParticleSystemSet){let oe=await tv(X.nodeParticleSystemSet,{extractedTexturesOutputPath:$});await Promise.all(oe.map(async Pe=>{let ze=(0,ct.join)(e.publicDir,Pe);e.exportedAssets.push(ze),e.optimize&&e.compressedTexturesEnabled&&await _s(ze,{...e,force:!1,exportedAssets:e.exportedAssets})}))}return X}));r.push(...se.filter(z=>z!==null));let _e=await Promise.all(e.directories.shadowGeneratorFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"shadowGenerators",z));return t.find(Pe=>Pe.id===X.lightId)?X:null}));u.push(..._e.filter(z=>z!==null));let Be=await Promise.all(e.directories.skeletonFiles.map(async z=>{let X=await zt.default.readJSON((0,ct.join)(e.sceneFile,"skeletons",z));return r.find(Pe=>Pe.skeletonId===X.id)?X:null}));o.push(...Be.filter(z=>z!==null));let fe={autoClear:!0,clearColor:e.config.clearColor,ambientColor:e.config.ambientColor,gravity:e.config.gravity??[0,-9.81,0],collisionsEnabled:!0,useRightHandedSystem:!1,fogMode:e.config.fog.fogMode,fogColor:e.config.fog.fogColor,fogStart:e.config.fog.fogStart,fogEnd:e.config.fog.fogEnd,fogDensity:e.config.fog.fogDensity,physicsEnabled:!0,physicsGravity:e.config.physics.gravity,physicsEngine:"HavokPlugin",metadata:{...e.config.metadata,rendering:e.config.rendering,clusteredLight:e.config.clusteredLight},morphTargetManagers:d,lights:t,cameras:n,animations:e.config.animations,materials:s,multiMaterials:a,environmentTexture:e.config.environment.environmentTexture,environmentIntensity:e.config.environment.environmentIntensity,iblIntensity:e.config.environment.iblIntensity??1,skeletons:o,transformNodes:c,geometries:{boxes:[],spheres:[],cylinders:[],toruses:[],grounds:[],planes:[],torusKnots:[],vertexData:[]},meshes:r,particleSystems:l,sounds:await Promise.all(e.directories.soundFiles.map(async z=>zt.default.readJSON((0,ct.join)(e.sceneFile,"sounds",z)))),shadowGenerators:u,animationGroups:await Promise.all(e.directories.animationGroupFiles.map(async z=>zt.default.readJSON((0,ct.join)(e.sceneFile,"animationGroups",z)))),postProcesses:[],spriteManagers:[],reflectionProbes:[]};[...fe.meshes,...fe.cameras,...fe.lights,...fe.transformNodes,...fe.meshes.map(z=>z.instances??[]).flat()].forEach(z=>{if(z.parentId!==void 0&&z.parentInstanceIndex!==void 0){let X=fe.meshes.find(oe=>oe.instances?.find(Pe=>Pe.uniqueId===z.parentId));X&&(z.parentId=X.uniqueId)}}),fe.environmentTexture?.name&&fe.environmentTexture.customType==="BABYLON.HDRCubeTexture"&&(fe.environmentTextureSize=512,fe.environmentTextureType="BABYLON.HDRCubeTexture",fe.environmentTextureRotationY=fe.environmentTexture.rotationY,fe.environmentTexture=fe.environmentTexture.name);let ye=(0,ct.join)(e.publicDir,`${e.sceneName}.babylon`);if(await zt.default.writeJSON(ye,fe,{encoding:"utf-8"}),e.exportedAssets.push(ye),e.optimize){let z=(0,ct.join)(e.publicDir,`${e.sceneName}.babylon.manifest`),X={version:0,enableSceneOffline:!0,enableTexturesOffline:!0};await zt.default.pathExists(z)&&(X=await zt.default.readJSON(z)),++X.version,await zt.default.writeJSON(z,X,{encoding:"utf-8"}),e.exportedAssets.push(z)}}i(y$,"createBabylonScene");var ao=require("node:path/posix"),lc=k(Hn(),1),E$=[".jpg",".jpeg",".webp",".png",".bmp"],f0e=[".env",".dds",".hdr"],h0e=[".mp3",".wav",".wave",".ogg"],S$=[".material",".gui",".cinematic",".npss",".ragdoll",".json"],p0e=[".3dl",".exr",".hdr"],m0e=[...E$,...f0e,...h0e,...S$,...p0e];async function b$(e,t){let r=e.includes(".navmesh"),n=(0,ao.extname)(e).toLocaleLowerCase();if(!r&&!m0e.includes(n)||(0,ao.basename)(e).startsWith("editor_preview"))return;let s=e.replace((0,ao.join)(t.projectDir,"/"),""),o=s.split("/"),a="";for(let m=0;m<o.length-1;++m){try{await lc.default.ensureDir((0,ao.join)(t.publicDir,a,o[m]))}catch{}a=(0,ao.join)(a,o[m])}let c=!1,u=(await lc.default.stat(e)).mtimeMs.toString();c=!t.cache[s]||t.cache[s]!==u,t.cache[s]=u;let d=(0,ao.join)(t.publicDir,s),f=await lc.default.pathExists(d);(c||!f)&&(S$.includes(n)?await lc.default.writeJSON(d,await lc.default.readJSON(e),{encoding:"utf-8"}):await lc.default.copyFile(e,d)),t.onStepChanged?.("assets",{message:`Processed asset: ${s}`}),t.exportedAssets.push(d),t.optimize&&await _s(d,{force:c,...t}),t.optimize&&(E$.includes(n)?await d$(d,{...t,force:c}):n===".material"?await h$(d,{...t,force:c}):n===".npss"&&await m$(d,{...t,force:c}))}i(b$,"processAssetFile");var w$=require("node:os"),fg=require("node:path/posix");async function _$(e){let t=await zs((0,fg.join)(e.baseAssetsDir,"**/*"),{nodir:!0,ignore:{childrenIgnored:i(a=>(0,fg.extname)(a.name)===".scene","childrenIgnored")}}),r=[],n=(0,w$.cpus)().length;console.log(`Using ${n} cpus to process assets...`);let s=100/t.length,o=0;for(let a of t){if(r.length>=n&&(await Promise.all(r),r.length=0),e.cancellationToken?.isCanceled)break;r.push(new Promise(async c=>{await b$(a,{...e}),e.onProgress?.(o+=s),c()}))}await Promise.all(r)}i(_$,"createAssets");var jl=k(Hn(),1),Pt=require("node:path/posix"),g0e=`
91
91
  /**
92
92
  * Generated by Babylon.js Editor
93
93
  */
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-editor-cli",
3
- "version": "5.4.1-rc.4",
3
+ "version": "5.4.1-rc.6",
4
4
  "description": "Babylon.js Editor CLI is a command line interface to help you package your scenes made using the Babylon.js Editor",
5
5
  "productName": "Babylon.js Editor CLI",
6
6
  "scripts": {
@@ -65,7 +65,7 @@ export async function compressFileToKtxFormat(absolutePath, options) {
65
65
  command = `"${pvrTexToolAbsolutePath}" -i "${absolutePath}" -flip y -pot + -m -dither -ics lRGB -f ASTC_8x8,UBN,lRGB -q astcveryfast -o "${options.destinationFolder}"`;
66
66
  break;
67
67
  case "-dxt.ktx":
68
- command = `"${pvrTexToolAbsolutePath}" -i "${absolutePath}" -flip y -pot + -m -dither -ics lRGB ${hasAlpha ? "-l" : ""} -f ${hasAlpha ? "BC2" : "BC1"},UBN,lRGB -o "${options.destinationFolder}"`;
68
+ command = `"${pvrTexToolAbsolutePath}" -i "${absolutePath}" -flip y -pot + -m -dither -ics lRGB ${hasAlpha ? "-l" : ""} -f ${hasAlpha ? "BC3" : "BC1"},UBN,lRGB -o "${options.destinationFolder}"`;
69
69
  break;
70
70
  case "-pvrtc.ktx":
71
71
  command = `"${pvrTexToolAbsolutePath}" -i "${absolutePath}" -flip y -pot + -square + -m -dither -ics lRGB ${hasAlpha ? "-l" : ""} -f ${hasAlpha ? "PVRTCI_2BPP_RGBA" : "PVRTCI_2BPP_RGB"},UBN,lRGB -q pvrtcfastest -o "${options.destinationFolder}"`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-editor-cli",
3
- "version": "5.4.1-rc.4",
3
+ "version": "5.4.1-rc.6",
4
4
  "description": "Babylon.js Editor CLI is a command line interface to help you package your scenes made using the Babylon.js Editor",
5
5
  "productName": "Babylon.js Editor CLI",
6
6
  "scripts": {