@expo/repack-app 0.2.11 → 0.2.12

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ ${i}`),Object.assign(O,p),c(O)}else a(p)},f=k=>{u?r.removeListener("exit",w):r.r
31
31
  `;s=s.replace(r,n)}}await vo.default.writeFile(e,s)}async function Tg(t,o){let e=Fo.default.join(t,"res/values/public.xml"),s=await vo.default.readFile(e,"utf8"),i=new Ws.Parser,r=new Set,n=await i.parseStringPromise(s),a=0,c=0,u=0;for(let k of n.resources.public){let W=parseInt(k.$.id,16);k.$.type==="drawable"?(a=Math.max(a,W),r.add(k.$.name)):k.$.type==="raw"&&(c=Math.max(c,W),r.add(k.$.name)),u=Math.max(u,W)}(0,zt.default)(a!==0,"Drawable resources must be defined."),c===0&&(c=(u&4294901760)+65536);let d=(a&4294901760)+65536,x=(c&4294901760)+65536,m=new Set([...o.keys()].filter(k=>!r.has(k)));for(let k of m){let W=o.get(k);W!=null&&(W.type==="drawable"?(a+=1,(0,zt.default)(a<d,"Drawable resource ID boundary exceeded."),n.resources.public.push({$:{type:"drawable",name:W.name,id:`0x${a.toString(16)}`}})):W.type==="raw"&&(c+=1,(0,zt.default)(c<x,"Raw resource ID boundary exceeded."),n.resources.public.push({$:{type:"raw",name:W.name,id:`0x${c.toString(16)}`}})))}let f=new Ws.Builder().buildObject(n);await vo.default.writeFile(e,f)}function Ug(t){if(t.startsWith("drawable"))return"drawable";if(t==="raw")return"raw";throw new Error(`Unsupported asset type for ${t}`)}async function Wc(t,o,e=0,s=2,i=void 0,r=new Map){await vo.default.mkdir(o,{recursive:!0});let n=await vo.default.readdir(t,{withFileTypes:!0});return await Promise.all(n.map(async a=>{let c=Fo.default.join(t,a.name),u=Fo.default.join(o,a.name);if(a.isDirectory()){let d=i??Ug(a.name);e<s-1?await Wc(c,u,e+1,s,d,r):await vo.default.mkdir(u,{recursive:!0})}else{await vo.default.copyFile(c,u);let{name:d}=Fo.default.parse(a.name);(0,zt.default)(i,"Asset type must be defined."),r.set(d,{name:d,type:i})}})),r}var Rc=P(Zc(),1);var Ke=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};var $g={"[: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]},Ge=t=>t.replace(/[[\]\\-]/g,"\\$&"),Hg=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Pc=t=>t.join(""),Lc=(t,o)=>{let e=o;if(t.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],i=[],r=e+1,n=!1,a=!1,c=!1,u=!1,d=e,x="";o:for(;r<t.length;){let k=t.charAt(r);if((k==="!"||k==="^")&&r===e+1){u=!0,r++;continue}if(k==="]"&&n&&!c){d=r+1;break}if(n=!0,k==="\\"&&!c){c=!0,r++;continue}if(k==="["&&!c){for(let[W,[p,q,O]]of Object.entries($g))if(t.startsWith(W,r)){if(x)return["$.",!1,t.length-e,!0];r+=W.length,O?i.push(p):s.push(p),a=a||q;continue o}}if(c=!1,x){k>x?s.push(Ge(x)+"-"+Ge(k)):k===x&&s.push(Ge(k)),x="",r++;continue}if(t.startsWith("-]",r+1)){s.push(Ge(k+"-")),r+=2;continue}if(t.startsWith("-",r+1)){x=k,r+=2;continue}s.push(Ge(k)),r++}if(d<r)return["",!1,0,!1];if(!s.length&&!i.length)return["$.",!1,t.length-e,!0];if(i.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!u){let k=s[0].length===2?s[0].slice(-1):s[0];return[Hg(k),!1,d-e,!1]}let m="["+(u?"^":"")+Pc(s)+"]",w="["+(u?"":"^")+Pc(i)+"]";return[s.length&&i.length?"("+m+"|"+w+")":s.length?m:w,a,d-e,!0]};var Mo=(t,{windowsPathsNoEscape:o=!1}={})=>o?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var oO=new Set(["!","?","+","*","@"]),Tc=t=>oO.has(t),tO="(?!(?:^|/)\\.\\.?(?:$|/))",ps="(?!\\.)",eO=new Set(["[","."]),sO=new Set(["..","."]),iO=new Set("().*{}+?[]^$\\!"),rO=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),mr="[^/]",Uc=mr+"*?",Ac=mr+"+?",Ft=class t{type;#o;#t;#r=!1;#s=[];#n;#f;#l;#_=!1;#a;#c;#i=!1;constructor(o,e,s={}){this.type=o,o&&(this.#t=!0),this.#n=e,this.#o=this.#n?this.#n.#o:this,this.#a=this.#o===this?s:this.#o.#a,this.#l=this.#o===this?[]:this.#o.#l,o==="!"&&!this.#o.#_&&this.#l.push(this),this.#f=this.#n?this.#n.#s.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let o of this.#s)if(typeof o!="string"&&(o.type||o.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#c!==void 0?this.#c:this.type?this.#c=this.type+"("+this.#s.map(o=>String(o)).join("|")+")":this.#c=this.#s.map(o=>String(o)).join("")}#d(){if(this!==this.#o)throw new Error("should only call on root");if(this.#_)return this;this.toString(),this.#_=!0;let o;for(;o=this.#l.pop();){if(o.type!=="!")continue;let e=o,s=e.#n;for(;s;){for(let i=e.#f+1;!s.type&&i<s.#s.length;i++)for(let r of o.#s){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(s.#s[i])}e=s,s=e.#n}}return this}push(...o){for(let e of o)if(e!==""){if(typeof e!="string"&&!(e instanceof t&&e.#n===this))throw new Error("invalid part: "+e);this.#s.push(e)}}toJSON(){let o=this.type===null?this.#s.slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...this.#s.map(e=>e.toJSON())];return this.isStart()&&!this.type&&o.unshift([]),this.isEnd()&&(this===this.#o||this.#o.#_&&this.#n?.type==="!")&&o.push({}),o}isStart(){if(this.#o===this)return!0;if(!this.#n?.isStart())return!1;if(this.#f===0)return!0;let o=this.#n;for(let e=0;e<this.#f;e++){let s=o.#s[e];if(!(s instanceof t&&s.type==="!"))return!1}return!0}isEnd(){if(this.#o===this||this.#n?.type==="!")return!0;if(!this.#n?.isEnd())return!1;if(!this.type)return this.#n?.isEnd();let o=this.#n?this.#n.#s.length:0;return this.#f===o-1}copyIn(o){typeof o=="string"?this.push(o):this.push(o.clone(this))}clone(o){let e=new t(this.type,o);for(let s of this.#s)e.copyIn(s);return e}static#w(o,e,s,i){let r=!1,n=!1,a=-1,c=!1;if(e.type===null){let w=s,f="";for(;w<o.length;){let k=o.charAt(w++);if(r||k==="\\"){r=!r,f+=k;continue}if(n){w===a+1?(k==="^"||k==="!")&&(c=!0):k==="]"&&!(w===a+2&&c)&&(n=!1),f+=k;continue}else if(k==="["){n=!0,a=w,c=!1,f+=k;continue}if(!i.noext&&Tc(k)&&o.charAt(w)==="("){e.push(f),f="";let W=new t(k,e);w=t.#w(o,W,w,i),e.push(W);continue}f+=k}return e.push(f),w}let u=s+1,d=new t(null,e),x=[],m="";for(;u<o.length;){let w=o.charAt(u++);if(r||w==="\\"){r=!r,m+=w;continue}if(n){u===a+1?(w==="^"||w==="!")&&(c=!0):w==="]"&&!(u===a+2&&c)&&(n=!1),m+=w;continue}else if(w==="["){n=!0,a=u,c=!1,m+=w;continue}if(Tc(w)&&o.charAt(u)==="("){d.push(m),m="";let f=new t(w,d);d.push(f),u=t.#w(o,f,u,i);continue}if(w==="|"){d.push(m),m="",x.push(d),d=new t(null,e);continue}if(w===")")return m===""&&e.#s.length===0&&(e.#i=!0),d.push(m),m="",e.push(...x,d),u;m+=w}return e.type=null,e.#t=void 0,e.#s=[o.substring(s-1)],u}static fromGlob(o,e={}){let s=new t(null,void 0,e);return t.#w(o,s,0,e),s}toMMPattern(){if(this!==this.#o)return this.#o.toMMPattern();let o=this.toString(),[e,s,i,r]=this.toRegExpSource();if(!(i||this.#t||this.#a.nocase&&!this.#a.nocaseMagicOnly&&o.toUpperCase()!==o.toLowerCase()))return s;let a=(this.#a.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,a),{_src:e,_glob:o})}get options(){return this.#a}toRegExpSource(o){let e=o??!!this.#a.dot;if(this.#o===this&&this.#d(),!this.type){let c=this.isStart()&&this.isEnd(),u=this.#s.map(w=>{let[f,k,W,p]=typeof w=="string"?t.#x(w,this.#t,c):w.toRegExpSource(o);return this.#t=this.#t||W,this.#r=this.#r||p,f}).join(""),d="";if(this.isStart()&&typeof this.#s[0]=="string"&&!(this.#s.length===1&&sO.has(this.#s[0]))){let f=eO,k=e&&f.has(u.charAt(0))||u.startsWith("\\.")&&f.has(u.charAt(2))||u.startsWith("\\.\\.")&&f.has(u.charAt(4)),W=!e&&!o&&f.has(u.charAt(0));d=k?tO:W?ps:""}let x="";return this.isEnd()&&this.#o.#_&&this.#n?.type==="!"&&(x="(?:$|\\/)"),[d+u+x,Mo(u),this.#t=!!this.#t,this.#r]}let s=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#m(e);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let c=this.toString();return this.#s=[c],this.type=null,this.#t=void 0,[c,Mo(this.toString()),!1,!1]}let n=!s||o||e||!ps?"":this.#m(!0);n===r&&(n=""),n&&(r=`(?:${r})(?:${n})*?`);let a="";if(this.type==="!"&&this.#i)a=(this.isStart()&&!e?ps:"")+Ac;else{let c=this.type==="!"?"))"+(this.isStart()&&!e&&!o?ps:"")+Uc+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&n?")":this.type==="*"&&n?")?":`)${this.type}`;a=i+r+c}return[a,Mo(r),this.#t=!!this.#t,this.#r]}#m(o){return this.#s.map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,i,r,n]=e.toRegExpSource(o);return this.#r=this.#r||n,s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#x(o,e,s=!1){let i=!1,r="",n=!1;for(let a=0;a<o.length;a++){let c=o.charAt(a);if(i){i=!1,r+=(iO.has(c)?"\\":"")+c;continue}if(c==="\\"){a===o.length-1?r+="\\\\":i=!0;continue}if(c==="["){let[u,d,x,m]=Lc(o,a);if(x){r+=u,n=n||d,a+=x-1,e=e||m;continue}}if(c==="*"){s&&o==="*"?r+=Ac:r+=Uc,e=!0;continue}if(c==="?"){r+=mr,e=!0;continue}r+=rO(c)}return[r,Mo(o),!!e,n]}};var Mt=(t,{windowsPathsNoEscape:o=!1}={})=>o?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var uo=(t,o,e={})=>(Ke(o),!e.nocomment&&o.charAt(0)==="#"?!1:new fo(o,e).match(t)),nO=/^\*+([^+@!?\*\[\(]*)$/,aO=t=>o=>!o.startsWith(".")&&o.endsWith(t),cO=t=>o=>o.endsWith(t),lO=t=>(t=t.toLowerCase(),o=>!o.startsWith(".")&&o.toLowerCase().endsWith(t)),uO=t=>(t=t.toLowerCase(),o=>o.toLowerCase().endsWith(t)),_O=/^\*+\.\*+$/,xO=t=>!t.startsWith(".")&&t.includes("."),mO=t=>t!=="."&&t!==".."&&t.includes("."),gO=/^\.\*+$/,OO=t=>t!=="."&&t!==".."&&t.startsWith("."),dO=/^\*+$/,wO=t=>t.length!==0&&!t.startsWith("."),yO=t=>t.length!==0&&t!=="."&&t!=="..",hO=/^\?+([^+@!?\*\[\(]*)?$/,fO=([t,o=""])=>{let e=Jc([t]);return o?(o=o.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(o)):e},zO=([t,o=""])=>{let e=Bc([t]);return o?(o=o.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(o)):e},kO=([t,o=""])=>{let e=Bc([t]);return o?s=>e(s)&&s.endsWith(o):e},KO=([t,o=""])=>{let e=Jc([t]);return o?s=>e(s)&&s.endsWith(o):e},Jc=([t])=>{let o=t.length;return e=>e.length===o&&!e.startsWith(".")},Bc=([t])=>{let o=t.length;return e=>e.length===o&&e!=="."&&e!==".."},Dc=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Qc={win32:{sep:"\\"},posix:{sep:"/"}},GO=Dc==="win32"?Qc.win32.sep:Qc.posix.sep;uo.sep=GO;var io=Symbol("globstar **");uo.GLOBSTAR=io;var bO="[^/]",vO=bO+"*?",WO="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",pO="(?:(?!(?:\\/|^)\\.).)*?",qO=(t,o={})=>e=>uo(e,t,o);uo.filter=qO;var Wo=(t,o={})=>Object.assign({},t,o),CO=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return uo;let o=uo;return Object.assign((s,i,r={})=>o(s,i,Wo(t,r)),{Minimatch:class extends o.Minimatch{constructor(i,r={}){super(i,Wo(t,r))}static defaults(i){return o.defaults(Wo(t,i)).Minimatch}},AST:class extends o.AST{constructor(i,r,n={}){super(i,r,Wo(t,n))}static fromGlob(i,r={}){return o.AST.fromGlob(i,Wo(t,r))}},unescape:(s,i={})=>o.unescape(s,Wo(t,i)),escape:(s,i={})=>o.escape(s,Wo(t,i)),filter:(s,i={})=>o.filter(s,Wo(t,i)),defaults:s=>o.defaults(Wo(t,s)),makeRe:(s,i={})=>o.makeRe(s,Wo(t,i)),braceExpand:(s,i={})=>o.braceExpand(s,Wo(t,i)),match:(s,i,r={})=>o.match(s,i,Wo(t,r)),sep:o.sep,GLOBSTAR:io})};uo.defaults=CO;var $c=(t,o={})=>(Ke(t),o.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,Rc.default)(t));uo.braceExpand=$c;var NO=(t,o={})=>new fo(t,o).makeRe();uo.makeRe=NO;var SO=(t,o,e={})=>{let s=new fo(o,e);return t=t.filter(i=>s.match(i)),s.options.nonull&&!t.length&&t.push(o),t};uo.match=SO;var jc=/[?*]|[+@!]\(.*?\)|\[|\]/,FO=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),fo=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(o,e={}){Ke(o),e=e||{},this.options=e,this.pattern=o,this.platform=e.platform||Dc,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.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 o of this.set)for(let e of o)if(typeof e!="string")return!0;return!1}debug(...o){}make(){let o=this.pattern,e=this.options;if(!e.nocomment&&o.charAt(0)==="#"){this.comment=!0;return}if(!o){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let i=this.globParts.map((r,n,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=r[0]===""&&r[1]===""&&(r[2]==="?"||!jc.test(r[2]))&&!jc.test(r[3]),u=/^[a-z]:/i.test(r[0]);if(c)return[...r.slice(0,4),...r.slice(4).map(d=>this.parse(d))];if(u)return[r[0],...r.slice(1).map(d=>this.parse(d))]}return r.map(c=>this.parse(c))});if(this.debug(this.pattern,i),this.set=i.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let n=this.set[r];n[0]===""&&n[1]===""&&this.globParts[r][2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3])&&(n[2]="?")}this.debug(this.pattern,this.set)}preprocess(o){if(this.options.noglobstar)for(let s=0;s<o.length;s++)for(let i=0;i<o[s].length;i++)o[s][i]==="**"&&(o[s][i]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(o=this.firstPhasePreProcess(o),o=this.secondPhasePreProcess(o)):e>=1?o=this.levelOneOptimize(o):o=this.adjascentGlobstarOptimize(o),o}adjascentGlobstarOptimize(o){return o.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let i=s;for(;e[i+1]==="**";)i++;i!==s&&e.splice(s,i-s)}return e})}levelOneOptimize(o){return o.map(e=>(e=e.reduce((s,i)=>{let r=s[s.length-1];return i==="**"&&r==="**"?s:i===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(i),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(o){Array.isArray(o)||(o=this.slashSplit(o));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let i=1;i<o.length-1;i++){let r=o[i];i===1&&r===""&&o[0]===""||(r==="."||r==="")&&(e=!0,o.splice(i,1),i--)}o[0]==="."&&o.length===2&&(o[1]==="."||o[1]==="")&&(e=!0,o.pop())}let s=0;for(;(s=o.indexOf("..",s+1))!==-1;){let i=o[s-1];i&&i!=="."&&i!==".."&&i!=="**"&&(e=!0,o.splice(s-1,2),s-=2)}}while(e);return o.length===0?[""]:o}firstPhasePreProcess(o){let e=!1;do{e=!1;for(let s of o){let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let n=i;for(;s[n+1]==="**";)n++;n>i&&s.splice(i+1,n-i);let a=s[i+1],c=s[i+2],u=s[i+3];if(a!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;e=!0,s.splice(i,1);let d=s.slice(0);d[i]="**",o.push(d),i--}if(!this.preserveMultipleSlashes){for(let n=1;n<s.length-1;n++){let a=s[n];n===1&&a===""&&s[0]===""||(a==="."||a==="")&&(e=!0,s.splice(n,1),n--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let n=s[r-1];if(n&&n!=="."&&n!==".."&&n!=="**"){e=!0;let c=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...c),s.length===0&&s.push(""),r-=2}}}}while(e);return o}secondPhasePreProcess(o){for(let e=0;e<o.length-1;e++)for(let s=e+1;s<o.length;s++){let i=this.partsMatch(o[e],o[s],!this.preserveMultipleSlashes);if(i){o[e]=[],o[s]=i;break}}return o.filter(e=>e.length)}partsMatch(o,e,s=!1){let i=0,r=0,n=[],a="";for(;i<o.length&&r<e.length;)if(o[i]===e[r])n.push(a==="b"?e[r]:o[i]),i++,r++;else if(s&&o[i]==="**"&&e[r]===o[i+1])n.push(o[i]),i++;else if(s&&e[r]==="**"&&o[i]===e[r+1])n.push(e[r]),r++;else if(o[i]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(a==="b")return!1;a="a",n.push(o[i]),i++,r++}else if(e[r]==="*"&&o[i]&&(this.options.dot||!o[i].startsWith("."))&&o[i]!=="**"){if(a==="a")return!1;a="b",n.push(e[r]),i++,r++}else return!1;return o.length===e.length&&n}parseNegate(){if(this.nonegate)return;let o=this.pattern,e=!1,s=0;for(let i=0;i<o.length&&o.charAt(i)==="!";i++)e=!e,s++;s&&(this.pattern=o.slice(s)),this.negate=e}matchOne(o,e,s=!1){let i=this.options;if(this.isWindows){let k=typeof o[0]=="string"&&/^[a-z]:$/i.test(o[0]),W=!k&&o[0]===""&&o[1]===""&&o[2]==="?"&&/^[a-z]:$/i.test(o[3]),p=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),q=!p&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),O=W?3:k?0:void 0,l=q?3:p?0:void 0;if(typeof O=="number"&&typeof l=="number"){let[g,_]=[o[O],e[l]];g.toLowerCase()===_.toLowerCase()&&(e[l]=g,l>O?e=e.slice(l):O>l&&(o=o.slice(O)))}}let{optimizationLevel:r=1}=this.options;r>=2&&(o=this.levelTwoFileOptimize(o)),this.debug("matchOne",this,{file:o,pattern:e}),this.debug("matchOne",o.length,e.length);for(var n=0,a=0,c=o.length,u=e.length;n<c&&a<u;n++,a++){this.debug("matchOne loop");var d=e[a],x=o[n];if(this.debug(e,d,x),d===!1)return!1;if(d===io){this.debug("GLOBSTAR",[e,d,x]);var m=n,w=a+1;if(w===u){for(this.debug("** at the end");n<c;n++)if(o[n]==="."||o[n]===".."||!i.dot&&o[n].charAt(0)===".")return!1;return!0}for(;m<c;){var f=o[m];if(this.debug(`
32
32
  globstar while`,o,m,e,w,f),this.matchOne(o.slice(m),e.slice(w),s))return this.debug("globstar found match!",m,c,f),!0;if(f==="."||f===".."||!i.dot&&f.charAt(0)==="."){this.debug("dot detected!",o,m,e,w);break}this.debug("globstar swallow a segment, and continue"),m++}return!!(s&&(this.debug(`
33
33
  >>> no match, partial?`,o,m,e,w),m===c))}let k;if(typeof d=="string"?(k=x===d,this.debug("string match",d,x,k)):(k=d.test(x),this.debug("pattern match",d,x,k)),!k)return!1}if(n===c&&a===u)return!0;if(n===c)return s;if(a===u)return n===c-1&&o[n]==="";throw new Error("wtf?")}braceExpand(){return $c(this.pattern,this.options)}parse(o){Ke(o);let e=this.options;if(o==="**")return io;if(o==="")return"";let s,i=null;(s=o.match(dO))?i=e.dot?yO:wO:(s=o.match(nO))?i=(e.nocase?e.dot?uO:lO:e.dot?cO:aO)(s[1]):(s=o.match(hO))?i=(e.nocase?e.dot?zO:fO:e.dot?kO:KO)(s):(s=o.match(_O))?i=e.dot?mO:xO:(s=o.match(gO))&&(i=OO);let r=Ft.fromGlob(o,this.options).toMMPattern();return i&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:i}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let o=this.set;if(!o.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?vO:e.dot?WO:pO,i=new Set(e.nocase?["i"]:[]),r=o.map(c=>{let u=c.map(d=>{if(d instanceof RegExp)for(let x of d.flags.split(""))i.add(x);return typeof d=="string"?FO(d):d===io?io:d._src});return u.forEach((d,x)=>{let m=u[x+1],w=u[x-1];d!==io||w===io||(w===void 0?m!==void 0&&m!==io?u[x+1]="(?:\\/|"+s+"\\/)?"+m:u[x]=s:m===void 0?u[x-1]=w+"(?:\\/|"+s+")?":m!==io&&(u[x-1]=w+"(?:\\/|\\/"+s+"\\/)"+m,u[x+1]=io))}),u.filter(d=>d!==io).join("/")}).join("|"),[n,a]=o.length>1?["(?:",")"]:["",""];r="^"+n+r+a+"$",this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(o){return this.preserveMultipleSlashes?o.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(o)?["",...o.split(/\/+/)]:o.split(/\/+/)}match(o,e=this.partial){if(this.debug("match",o,this.pattern),this.comment)return!1;if(this.empty)return o==="";if(o==="/"&&e)return!0;let s=this.options;this.isWindows&&(o=o.split("\\").join("/"));let i=this.slashSplit(o);this.debug(this.pattern,"split",i);let r=this.set;this.debug(this.pattern,"set",r);let n=i[i.length-1];if(!n)for(let a=i.length-2;!n&&a>=0;a--)n=i[a];for(let a=0;a<r.length;a++){let c=r[a],u=i;if(s.matchBase&&c.length===1&&(u=[n]),this.matchOne(u,c,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(o){return uo.defaults(o).Minimatch}};uo.AST=Ft;uo.Minimatch=fo;uo.escape=Mt;uo.unescape=Mo;var kl=require("node:url");var Et=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ol=new Set,gr=typeof process=="object"&&process?process:{},tl=(t,o,e,s)=>{typeof gr.emitWarning=="function"?gr.emitWarning(t,o,e,s):console.error(`[${e}] ${o}: ${t}`)},qs=globalThis.AbortController,Hc=globalThis.AbortSignal;if(typeof qs>"u"){Hc=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,i){this._onabort.push(i)}},qs=class{constructor(){o()}signal=new Hc;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let i of this.signal._onabort)i(s);this.signal.onabort?.(s)}}};let t=gr.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",o=()=>{t&&(t=!1,tl("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",o))}}var MO=t=>!ol.has(t),Fh=Symbol("type"),lt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),el=t=>lt(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Vt:null:null,Vt=class extends Array{constructor(o){super(o),this.fill(0)}},Or=class t{heap;length;static#o=!1;static create(o){let e=el(o);if(!e)return[];t.#o=!0;let s=new t(o,e);return t.#o=!1,s}constructor(o,e){if(!t.#o)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(o),this.length=0}push(o){this.heap[this.length++]=o}pop(){return this.heap[--this.length]}},be=class t{#o;#t;#r;#s;#n;#f;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#l;#_;#a;#c;#i;#d;#w;#m;#x;#K;#O;#G;#b;#h;#z;#k;#g;static unsafeExposeInternals(o){return{starts:o.#b,ttls:o.#h,sizes:o.#G,keyMap:o.#a,keyList:o.#c,valList:o.#i,next:o.#d,prev:o.#w,get head(){return o.#m},get tail(){return o.#x},free:o.#K,isBackgroundFetch:e=>o.#u(e),backgroundFetch:(e,s,i,r)=>o.#Y(e,s,i,r),moveToTail:e=>o.#Z(e),indexes:e=>o.#W(e),rindexes:e=>o.#p(e),isStale:e=>o.#y(e)}}get max(){return this.#o}get maxSize(){return this.#t}get calculatedSize(){return this.#_}get size(){return this.#l}get fetchMethod(){return this.#n}get memoMethod(){return this.#f}get dispose(){return this.#r}get disposeAfter(){return this.#s}constructor(o){let{max:e=0,ttl:s,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:c,dispose:u,disposeAfter:d,noDisposeOnSet:x,noUpdateTTL:m,maxSize:w=0,maxEntrySize:f=0,sizeCalculation:k,fetchMethod:W,memoMethod:p,noDeleteOnFetchRejection:q,noDeleteOnStaleGet:O,allowStaleOnFetchRejection:l,allowStaleOnFetchAbort:g,ignoreFetchAbort:_}=o;if(e!==0&&!lt(e))throw new TypeError("max option must be a nonnegative integer");let G=e?el(e):Array;if(!G)throw new Error("invalid max value: "+e);if(this.#o=e,this.#t=w,this.maxEntrySize=f||this.#t,this.sizeCalculation=k,this.sizeCalculation){if(!this.#t&&!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(p!==void 0&&typeof p!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#f=p,W!==void 0&&typeof W!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#n=W,this.#k=!!W,this.#a=new Map,this.#c=new Array(e).fill(void 0),this.#i=new Array(e).fill(void 0),this.#d=new G(e),this.#w=new G(e),this.#m=0,this.#x=0,this.#K=Or.create(e),this.#l=0,this.#_=0,typeof u=="function"&&(this.#r=u),typeof d=="function"?(this.#s=d,this.#O=[]):(this.#s=void 0,this.#O=void 0),this.#z=!!this.#r,this.#g=!!this.#s,this.noDisposeOnSet=!!x,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!q,this.allowStaleOnFetchRejection=!!l,this.allowStaleOnFetchAbort=!!g,this.ignoreFetchAbort=!!_,this.maxEntrySize!==0){if(this.#t!==0&&!lt(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!lt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#C()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!O,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=lt(i)||i===0?i:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!lt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#q()}if(this.#o===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#o&&!this.#t){let y="LRU_CACHE_UNBOUNDED";MO(y)&&(ol.add(y),tl("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",y,t))}}getRemainingTTL(o){return this.#a.has(o)?1/0:0}#q(){let o=new Vt(this.#o),e=new Vt(this.#o);this.#h=o,this.#b=e,this.#S=(r,n,a=Et.now())=>{if(e[r]=n!==0?a:0,o[r]=n,n!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#y(r)&&this.#N(this.#c[r],"expire")},n+1);c.unref&&c.unref()}},this.#v=r=>{e[r]=o[r]!==0?Et.now():0},this.#e=(r,n)=>{if(o[n]){let a=o[n],c=e[n];if(!a||!c)return;r.ttl=a,r.start=c,r.now=s||i();let u=r.now-c;r.remainingTTL=a-u}};let s=0,i=()=>{let r=Et.now();if(this.ttlResolution>0){s=r;let n=setTimeout(()=>s=0,this.ttlResolution);n.unref&&n.unref()}return r};this.getRemainingTTL=r=>{let n=this.#a.get(r);if(n===void 0)return 0;let a=o[n],c=e[n];if(!a||!c)return 1/0;let u=(s||i())-c;return a-u},this.#y=r=>{let n=e[r],a=o[r];return!!a&&!!n&&(s||i())-n>a}}#v=()=>{};#e=()=>{};#S=()=>{};#y=()=>!1;#C(){let o=new Vt(this.#o);this.#_=0,this.#G=o,this.#F=e=>{this.#_-=o[e],o[e]=0},this.#E=(e,s,i,r)=>{if(this.#u(s))return 0;if(!lt(i))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(i=r(s,e),!lt(i))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 i},this.#M=(e,s,i)=>{if(o[e]=s,this.#t){let r=this.#t-o[e];for(;this.#_>r;)this.#X(!0)}this.#_+=o[e],i&&(i.entrySize=s,i.totalCalculatedSize=this.#_)}}#F=o=>{};#M=(o,e,s)=>{};#E=(o,e,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#W({allowStale:o=this.allowStale}={}){if(this.#l)for(let e=this.#x;!(!this.#V(e)||((o||!this.#y(e))&&(yield e),e===this.#m));)e=this.#w[e]}*#p({allowStale:o=this.allowStale}={}){if(this.#l)for(let e=this.#m;!(!this.#V(e)||((o||!this.#y(e))&&(yield e),e===this.#x));)e=this.#d[e]}#V(o){return o!==void 0&&this.#a.get(this.#c[o])===o}*entries(){for(let o of this.#W())this.#i[o]!==void 0&&this.#c[o]!==void 0&&!this.#u(this.#i[o])&&(yield[this.#c[o],this.#i[o]])}*rentries(){for(let o of this.#p())this.#i[o]!==void 0&&this.#c[o]!==void 0&&!this.#u(this.#i[o])&&(yield[this.#c[o],this.#i[o]])}*keys(){for(let o of this.#W()){let e=this.#c[o];e!==void 0&&!this.#u(this.#i[o])&&(yield e)}}*rkeys(){for(let o of this.#p()){let e=this.#c[o];e!==void 0&&!this.#u(this.#i[o])&&(yield e)}}*values(){for(let o of this.#W())this.#i[o]!==void 0&&!this.#u(this.#i[o])&&(yield this.#i[o])}*rvalues(){for(let o of this.#p())this.#i[o]!==void 0&&!this.#u(this.#i[o])&&(yield this.#i[o])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(o,e={}){for(let s of this.#W()){let i=this.#i[s],r=this.#u(i)?i.__staleWhileFetching:i;if(r!==void 0&&o(r,this.#c[s],this))return this.get(this.#c[s],e)}}forEach(o,e=this){for(let s of this.#W()){let i=this.#i[s],r=this.#u(i)?i.__staleWhileFetching:i;r!==void 0&&o.call(e,r,this.#c[s],this)}}rforEach(o,e=this){for(let s of this.#p()){let i=this.#i[s],r=this.#u(i)?i.__staleWhileFetching:i;r!==void 0&&o.call(e,r,this.#c[s],this)}}purgeStale(){let o=!1;for(let e of this.#p({allowStale:!0}))this.#y(e)&&(this.#N(this.#c[e],"expire"),o=!0);return o}info(o){let e=this.#a.get(o);if(e===void 0)return;let s=this.#i[e],i=this.#u(s)?s.__staleWhileFetching:s;if(i===void 0)return;let r={value:i};if(this.#h&&this.#b){let n=this.#h[e],a=this.#b[e];if(n&&a){let c=n-(Et.now()-a);r.ttl=c,r.start=Date.now()}}return this.#G&&(r.size=this.#G[e]),r}dump(){let o=[];for(let e of this.#W({allowStale:!0})){let s=this.#c[e],i=this.#i[e],r=this.#u(i)?i.__staleWhileFetching:i;if(r===void 0||s===void 0)continue;let n={value:r};if(this.#h&&this.#b){n.ttl=this.#h[e];let a=Et.now()-this.#b[e];n.start=Math.floor(Date.now()-a)}this.#G&&(n.size=this.#G[e]),o.unshift([s,n])}return o}load(o){this.clear();for(let[e,s]of o){if(s.start){let i=Date.now()-s.start;s.start=Et.now()-i}this.set(e,s.value,s)}}set(o,e,s={}){if(e===void 0)return this.delete(o),this;let{ttl:i=this.ttl,start:r,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=s,{noUpdateTTL:u=this.noUpdateTTL}=s,d=this.#E(o,e,s.size||0,a);if(this.maxEntrySize&&d>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.#N(o,"set"),this;let x=this.#l===0?void 0:this.#a.get(o);if(x===void 0)x=this.#l===0?this.#x:this.#K.length!==0?this.#K.pop():this.#l===this.#o?this.#X(!1):this.#l,this.#c[x]=o,this.#i[x]=e,this.#a.set(o,x),this.#d[this.#x]=x,this.#w[x]=this.#x,this.#x=x,this.#l++,this.#M(x,d,c),c&&(c.set="add"),u=!1;else{this.#Z(x);let m=this.#i[x];if(e!==m){if(this.#k&&this.#u(m)){m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:w}=m;w!==void 0&&!n&&(this.#z&&this.#r?.(w,o,"set"),this.#g&&this.#O?.push([w,o,"set"]))}else n||(this.#z&&this.#r?.(m,o,"set"),this.#g&&this.#O?.push([m,o,"set"]));if(this.#F(x),this.#M(x,d,c),this.#i[x]=e,c){c.set="replace";let w=m&&this.#u(m)?m.__staleWhileFetching:m;w!==void 0&&(c.oldValue=w)}}else c&&(c.set="update")}if(i!==0&&!this.#h&&this.#q(),this.#h&&(u||this.#S(x,i,r),c&&this.#e(c,x)),!n&&this.#g&&this.#O){let m=this.#O,w;for(;w=m?.shift();)this.#s?.(...w)}return this}pop(){try{for(;this.#l;){let o=this.#i[this.#m];if(this.#X(!0),this.#u(o)){if(o.__staleWhileFetching)return o.__staleWhileFetching}else if(o!==void 0)return o}}finally{if(this.#g&&this.#O){let o=this.#O,e;for(;e=o?.shift();)this.#s?.(...e)}}}#X(o){let e=this.#m,s=this.#c[e],i=this.#i[e];return this.#k&&this.#u(i)?i.__abortController.abort(new Error("evicted")):(this.#z||this.#g)&&(this.#z&&this.#r?.(i,s,"evict"),this.#g&&this.#O?.push([i,s,"evict"])),this.#F(e),o&&(this.#c[e]=void 0,this.#i[e]=void 0,this.#K.push(e)),this.#l===1?(this.#m=this.#x=0,this.#K.length=0):this.#m=this.#d[e],this.#a.delete(s),this.#l--,e}has(o,e={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=e,r=this.#a.get(o);if(r!==void 0){let n=this.#i[r];if(this.#u(n)&&n.__staleWhileFetching===void 0)return!1;if(this.#y(r))i&&(i.has="stale",this.#e(i,r));else return s&&this.#v(r),i&&(i.has="hit",this.#e(i,r)),!0}else i&&(i.has="miss");return!1}peek(o,e={}){let{allowStale:s=this.allowStale}=e,i=this.#a.get(o);if(i===void 0||!s&&this.#y(i))return;let r=this.#i[i];return this.#u(r)?r.__staleWhileFetching:r}#Y(o,e,s,i){let r=e===void 0?void 0:this.#i[e];if(this.#u(r))return r;let n=new qs,{signal:a}=s;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let c={signal:n.signal,options:s,context:i},u=(k,W=!1)=>{let{aborted:p}=n.signal,q=s.ignoreFetchAbort&&k!==void 0;if(s.status&&(p&&!W?(s.status.fetchAborted=!0,s.status.fetchError=n.signal.reason,q&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),p&&!q&&!W)return x(n.signal.reason);let O=w;return this.#i[e]===w&&(k===void 0?O.__staleWhileFetching?this.#i[e]=O.__staleWhileFetching:this.#N(o,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(o,k,c.options))),k},d=k=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=k),x(k)),x=k=>{let{aborted:W}=n.signal,p=W&&s.allowStaleOnFetchAbort,q=p||s.allowStaleOnFetchRejection,O=q||s.noDeleteOnFetchRejection,l=w;if(this.#i[e]===w&&(!O||l.__staleWhileFetching===void 0?this.#N(o,"fetch"):p||(this.#i[e]=l.__staleWhileFetching)),q)return s.status&&l.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),l.__staleWhileFetching;if(l.__returned===l)throw k},m=(k,W)=>{let p=this.#n?.(o,r,c);p&&p instanceof Promise&&p.then(q=>k(q===void 0?void 0:q),W),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(k(void 0),s.allowStaleOnFetchAbort&&(k=q=>u(q,!0)))})};s.status&&(s.status.fetchDispatched=!0);let w=new Promise(m).then(u,d),f=Object.assign(w,{__abortController:n,__staleWhileFetching:r,__returned:void 0});return e===void 0?(this.set(o,f,{...c.options,status:void 0}),e=this.#a.get(o)):this.#i[e]=f,f}#u(o){if(!this.#k)return!1;let e=o;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof qs}async fetch(o,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:x=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:w=this.ignoreFetchAbort,allowStaleOnFetchAbort:f=this.allowStaleOnFetchAbort,context:k,forceRefresh:W=!1,status:p,signal:q}=e;if(!this.#k)return p&&(p.fetch="get"),this.get(o,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:p});let O={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:n,noDisposeOnSet:a,size:c,sizeCalculation:u,noUpdateTTL:d,noDeleteOnFetchRejection:x,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:f,ignoreFetchAbort:w,status:p,signal:q},l=this.#a.get(o);if(l===void 0){p&&(p.fetch="miss");let g=this.#Y(o,l,O,k);return g.__returned=g}else{let g=this.#i[l];if(this.#u(g)){let z=s&&g.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",z&&(p.returnedStale=!0)),z?g.__staleWhileFetching:g.__returned=g}let _=this.#y(l);if(!W&&!_)return p&&(p.fetch="hit"),this.#Z(l),i&&this.#v(l),p&&this.#e(p,l),g;let G=this.#Y(o,l,O,k),h=G.__staleWhileFetching!==void 0&&s;return p&&(p.fetch=_?"stale":"refresh",h&&_&&(p.returnedStale=!0)),h?G.__staleWhileFetching:G.__returned=G}}async forceFetch(o,e={}){let s=await this.fetch(o,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(o,e={}){let s=this.#f;if(!s)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:r,...n}=e,a=this.get(o,n);if(!r&&a!==void 0)return a;let c=s(o,a,{options:n,context:i});return this.set(o,c,n),c}get(o,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:n}=e,a=this.#a.get(o);if(a!==void 0){let c=this.#i[a],u=this.#u(c);return n&&this.#e(n,a),this.#y(a)?(n&&(n.get="stale"),u?(n&&s&&c.__staleWhileFetching!==void 0&&(n.returnedStale=!0),s?c.__staleWhileFetching:void 0):(r||this.#N(o,"expire"),n&&s&&(n.returnedStale=!0),s?c:void 0)):(n&&(n.get="hit"),u?c.__staleWhileFetching:(this.#Z(a),i&&this.#v(a),c))}else n&&(n.get="miss")}#I(o,e){this.#w[e]=o,this.#d[o]=e}#Z(o){o!==this.#x&&(o===this.#m?this.#m=this.#d[o]:this.#I(this.#w[o],this.#d[o]),this.#I(this.#x,o),this.#x=o)}delete(o){return this.#N(o,"delete")}#N(o,e){let s=!1;if(this.#l!==0){let i=this.#a.get(o);if(i!==void 0)if(s=!0,this.#l===1)this.#P(e);else{this.#F(i);let r=this.#i[i];if(this.#u(r)?r.__abortController.abort(new Error("deleted")):(this.#z||this.#g)&&(this.#z&&this.#r?.(r,o,e),this.#g&&this.#O?.push([r,o,e])),this.#a.delete(o),this.#c[i]=void 0,this.#i[i]=void 0,i===this.#x)this.#x=this.#w[i];else if(i===this.#m)this.#m=this.#d[i];else{let n=this.#w[i];this.#d[n]=this.#d[i];let a=this.#d[i];this.#w[a]=this.#w[i]}this.#l--,this.#K.push(i)}}if(this.#g&&this.#O?.length){let i=this.#O,r;for(;r=i?.shift();)this.#s?.(...r)}return s}clear(){return this.#P("delete")}#P(o){for(let e of this.#p({allowStale:!0})){let s=this.#i[e];if(this.#u(s))s.__abortController.abort(new Error("deleted"));else{let i=this.#c[e];this.#z&&this.#r?.(s,i,o),this.#g&&this.#O?.push([s,i,o])}}if(this.#a.clear(),this.#i.fill(void 0),this.#c.fill(void 0),this.#h&&this.#b&&(this.#h.fill(0),this.#b.fill(0)),this.#G&&this.#G.fill(0),this.#m=0,this.#x=0,this.#K.length=0,this.#_=0,this.#l=0,this.#g&&this.#O){let e=this.#O,s;for(;s=e?.shift();)this.#s?.(...s)}}};var It=require("node:path"),xl=require("node:url"),To=require("fs"),UO=P(require("node:fs"),1),xt=require("node:fs/promises");var Vs=require("node:events"),kr=P(require("node:stream"),1),al=require("node:string_decoder"),sl=typeof process=="object"&&process?process:{stdout:null,stderr:null},EO=t=>!!t&&typeof t=="object"&&(t instanceof _t||t instanceof kr.default||VO(t)||XO(t)),VO=t=>!!t&&typeof t=="object"&&t instanceof Vs.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==kr.default.Writable.prototype.pipe,XO=t=>!!t&&typeof t=="object"&&t instanceof Vs.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",Ho=Symbol("EOF"),ot=Symbol("maybeEmitEnd"),ut=Symbol("emittedEnd"),Cs=Symbol("emittingEnd"),ve=Symbol("emittedError"),Ns=Symbol("closed"),il=Symbol("read"),Ss=Symbol("flush"),rl=Symbol("flushChunk"),Eo=Symbol("encoding"),Xt=Symbol("decoder"),D=Symbol("flowing"),We=Symbol("paused"),Yt=Symbol("resume"),$=Symbol("buffer"),_o=Symbol("pipes"),H=Symbol("bufferLength"),dr=Symbol("bufferPush"),Fs=Symbol("bufferShift"),no=Symbol("objectMode"),A=Symbol("destroyed"),wr=Symbol("error"),yr=Symbol("emitData"),nl=Symbol("emitEnd"),hr=Symbol("emitEnd2"),Po=Symbol("async"),fr=Symbol("abort"),Ms=Symbol("aborted"),pe=Symbol("signal"),kt=Symbol("dataListeners"),zo=Symbol("discarded"),qe=t=>Promise.resolve().then(t),YO=t=>t(),IO=t=>t==="end"||t==="finish"||t==="prefinish",ZO=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,PO=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Es=class{src;dest;opts;ondrain;constructor(o,e,s){this.src=o,this.dest=e,this.opts=s,this.ondrain=()=>o[Yt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(o){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},zr=class extends Es{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(o,e,s){super(o,e,s),this.proxyErrors=i=>e.emit("error",i),o.on("error",this.proxyErrors)}},LO=t=>!!t.objectMode,TO=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",_t=class extends Vs.EventEmitter{[D]=!1;[We]=!1;[_o]=[];[$]=[];[no];[Eo];[Po];[Xt];[Ho]=!1;[ut]=!1;[Cs]=!1;[Ns]=!1;[ve]=null;[H]=0;[A]=!1;[pe];[Ms]=!1;[kt]=0;[zo]=!1;writable=!0;readable=!0;constructor(...o){let e=o[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");LO(e)?(this[no]=!0,this[Eo]=null):TO(e)?(this[Eo]=e.encoding,this[no]=!1):(this[no]=!1,this[Eo]=null),this[Po]=!!e.async,this[Xt]=this[Eo]?new al.StringDecoder(this[Eo]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[$]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[_o]});let{signal:s}=e;s&&(this[pe]=s,s.aborted?this[fr]():s.addEventListener("abort",()=>this[fr]()))}get bufferLength(){return this[H]}get encoding(){return this[Eo]}set encoding(o){throw new Error("Encoding must be set at instantiation time")}setEncoding(o){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[no]}set objectMode(o){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Po]}set async(o){this[Po]=this[Po]||!!o}[fr](){this[Ms]=!0,this.emit("abort",this[pe]?.reason),this.destroy(this[pe]?.reason)}get aborted(){return this[Ms]}set aborted(o){}write(o,e,s){if(this[Ms])return!1;if(this[Ho])throw new Error("write after end");if(this[A])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(s=e,e="utf8"),e||(e="utf8");let i=this[Po]?qe:YO;if(!this[no]&&!Buffer.isBuffer(o)){if(PO(o))o=Buffer.from(o.buffer,o.byteOffset,o.byteLength);else if(ZO(o))o=Buffer.from(o);else if(typeof o!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[no]?(this[D]&&this[H]!==0&&this[Ss](!0),this[D]?this.emit("data",o):this[dr](o),this[H]!==0&&this.emit("readable"),s&&i(s),this[D]):o.length?(typeof o=="string"&&!(e===this[Eo]&&!this[Xt]?.lastNeed)&&(o=Buffer.from(o,e)),Buffer.isBuffer(o)&&this[Eo]&&(o=this[Xt].write(o)),this[D]&&this[H]!==0&&this[Ss](!0),this[D]?this.emit("data",o):this[dr](o),this[H]!==0&&this.emit("readable"),s&&i(s),this[D]):(this[H]!==0&&this.emit("readable"),s&&i(s),this[D])}read(o){if(this[A])return null;if(this[zo]=!1,this[H]===0||o===0||o&&o>this[H])return this[ot](),null;this[no]&&(o=null),this[$].length>1&&!this[no]&&(this[$]=[this[Eo]?this[$].join(""):Buffer.concat(this[$],this[H])]);let e=this[il](o||null,this[$][0]);return this[ot](),e}[il](o,e){if(this[no])this[Fs]();else{let s=e;o===s.length||o===null?this[Fs]():typeof s=="string"?(this[$][0]=s.slice(o),e=s.slice(0,o),this[H]-=o):(this[$][0]=s.subarray(o),e=s.subarray(0,o),this[H]-=o)}return this.emit("data",e),!this[$].length&&!this[Ho]&&this.emit("drain"),e}end(o,e,s){return typeof o=="function"&&(s=o,o=void 0),typeof e=="function"&&(s=e,e="utf8"),o!==void 0&&this.write(o,e),s&&this.once("end",s),this[Ho]=!0,this.writable=!1,(this[D]||!this[We])&&this[ot](),this}[Yt](){this[A]||(!this[kt]&&!this[_o].length&&(this[zo]=!0),this[We]=!1,this[D]=!0,this.emit("resume"),this[$].length?this[Ss]():this[Ho]?this[ot]():this.emit("drain"))}resume(){return this[Yt]()}pause(){this[D]=!1,this[We]=!0,this[zo]=!1}get destroyed(){return this[A]}get flowing(){return this[D]}get paused(){return this[We]}[dr](o){this[no]?this[H]+=1:this[H]+=o.length,this[$].push(o)}[Fs](){return this[no]?this[H]-=1:this[H]-=this[$][0].length,this[$].shift()}[Ss](o=!1){do;while(this[rl](this[Fs]())&&this[$].length);!o&&!this[$].length&&!this[Ho]&&this.emit("drain")}[rl](o){return this.emit("data",o),this[D]}pipe(o,e){if(this[A])return o;this[zo]=!1;let s=this[ut];return e=e||{},o===sl.stdout||o===sl.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,s?e.end&&o.end():(this[_o].push(e.proxyErrors?new zr(this,o,e):new Es(this,o,e)),this[Po]?qe(()=>this[Yt]()):this[Yt]()),o}unpipe(o){let e=this[_o].find(s=>s.dest===o);e&&(this[_o].length===1?(this[D]&&this[kt]===0&&(this[D]=!1),this[_o]=[]):this[_o].splice(this[_o].indexOf(e),1),e.unpipe())}addListener(o,e){return this.on(o,e)}on(o,e){let s=super.on(o,e);if(o==="data")this[zo]=!1,this[kt]++,!this[_o].length&&!this[D]&&this[Yt]();else if(o==="readable"&&this[H]!==0)super.emit("readable");else if(IO(o)&&this[ut])super.emit(o),this.removeAllListeners(o);else if(o==="error"&&this[ve]){let i=e;this[Po]?qe(()=>i.call(this,this[ve])):i.call(this,this[ve])}return s}removeListener(o,e){return this.off(o,e)}off(o,e){let s=super.off(o,e);return o==="data"&&(this[kt]=this.listeners("data").length,this[kt]===0&&!this[zo]&&!this[_o].length&&(this[D]=!1)),s}removeAllListeners(o){let e=super.removeAllListeners(o);return(o==="data"||o===void 0)&&(this[kt]=0,!this[zo]&&!this[_o].length&&(this[D]=!1)),e}get emittedEnd(){return this[ut]}[ot](){!this[Cs]&&!this[ut]&&!this[A]&&this[$].length===0&&this[Ho]&&(this[Cs]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Ns]&&this.emit("close"),this[Cs]=!1)}emit(o,...e){let s=e[0];if(o!=="error"&&o!=="close"&&o!==A&&this[A])return!1;if(o==="data")return!this[no]&&!s?!1:this[Po]?(qe(()=>this[yr](s)),!0):this[yr](s);if(o==="end")return this[nl]();if(o==="close"){if(this[Ns]=!0,!this[ut]&&!this[A])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(o==="error"){this[ve]=s,super.emit(wr,s);let r=!this[pe]||this.listeners("error").length?super.emit("error",s):!1;return this[ot](),r}else if(o==="resume"){let r=super.emit("resume");return this[ot](),r}else if(o==="finish"||o==="prefinish"){let r=super.emit(o);return this.removeAllListeners(o),r}let i=super.emit(o,...e);return this[ot](),i}[yr](o){for(let s of this[_o])s.dest.write(o)===!1&&this.pause();let e=this[zo]?!1:super.emit("data",o);return this[ot](),e}[nl](){return this[ut]?!1:(this[ut]=!0,this.readable=!1,this[Po]?(qe(()=>this[hr]()),!0):this[hr]())}[hr](){if(this[Xt]){let e=this[Xt].end();if(e){for(let s of this[_o])s.dest.write(e);this[zo]||super.emit("data",e)}}for(let e of this[_o])e.end();let o=super.emit("end");return this.removeAllListeners("end"),o}async collect(){let o=Object.assign([],{dataLength:0});this[no]||(o.dataLength=0);let e=this.promise();return this.on("data",s=>{o.push(s),this[no]||(o.dataLength+=s.length)}),await e,o}async concat(){if(this[no])throw new Error("cannot concat in objectMode");let o=await this.collect();return this[Eo]?o.join(""):Buffer.concat(o,o.dataLength)}async promise(){return new Promise((o,e)=>{this.on(A,()=>e(new Error("stream destroyed"))),this.on("error",s=>e(s)),this.on("end",()=>o())})}[Symbol.asyncIterator](){this[zo]=!1;let o=!1,e=async()=>(this.pause(),o=!0,{value:void 0,done:!0});return{next:()=>{if(o)return e();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[Ho])return e();let r,n,a=x=>{this.off("data",c),this.off("end",u),this.off(A,d),e(),n(x)},c=x=>{this.off("error",a),this.off("end",u),this.off(A,d),this.pause(),r({value:x,done:!!this[Ho]})},u=()=>{this.off("error",a),this.off("data",c),this.off(A,d),e(),r({done:!0,value:void 0})},d=()=>a(new Error("stream destroyed"));return new Promise((x,m)=>{n=m,r=x,this.once(A,d),this.once("error",a),this.once("end",u),this.once("data",c)})},throw:e,return:e,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[zo]=!1;let o=!1,e=()=>(this.pause(),this.off(wr,e),this.off(A,e),this.off("end",e),o=!0,{done:!0,value:void 0}),s=()=>{if(o)return e();let i=this.read();return i===null?e():{done:!1,value:i}};return this.once("end",e),this.once(wr,e),this.once(A,e),{next:s,throw:e,return:e,[Symbol.iterator](){return this}}}destroy(o){if(this[A])return o?this.emit("error",o):this.emit(A),this;this[A]=!0,this[zo]=!0,this[$].length=0,this[H]=0;let e=this;return typeof e.close=="function"&&!this[Ns]&&e.close(),o?this.emit("error",o):this.emit(A),this}static get isStream(){return EO}};var AO=To.realpathSync.native,Ne={lstatSync:To.lstatSync,readdir:To.readdir,readdirSync:To.readdirSync,readlinkSync:To.readlinkSync,realpathSync:AO,promises:{lstat:xt.lstat,readdir:xt.readdir,readlink:xt.readlink,realpath:xt.realpath}},ml=t=>!t||t===Ne||t===UO?Ne:{...Ne,...t,promises:{...Ne.promises,...t.promises||{}}},gl=/^\\\\\?\\([a-z]:)\\?$/i,QO=t=>t.replace(/\//g,"\\").replace(gl,"$1\\"),jO=/[\\\/]/,qo=0,Ol=1,dl=2,Lo=4,wl=6,yl=8,Kt=10,hl=12,po=15,Ce=~po,Kr=16,cl=32,Se=64,Vo=128,Xs=256,Is=512,ll=Se|Vo|Is,RO=1023,Gr=t=>t.isFile()?yl:t.isDirectory()?Lo:t.isSymbolicLink()?Kt:t.isCharacterDevice()?dl:t.isBlockDevice()?wl:t.isSocket()?hl:t.isFIFO()?Ol:qo,ul=new Map,Fe=t=>{let o=ul.get(t);if(o)return o;let e=t.normalize("NFKD");return ul.set(t,e),e},_l=new Map,Ys=t=>{let o=_l.get(t);if(o)return o;let e=Fe(t.toLowerCase());return _l.set(t,e),e},Zs=class extends be{constructor(){super({max:256})}},br=class extends be{constructor(o=16*1024){super({maxSize:o,sizeCalculation:e=>e.length+1})}},fl=Symbol("PathScurry setAsCwd"),ao=class{name;root;roots;parent;nocase;isCWD=!1;#o;#t;get dev(){return this.#t}#r;get mode(){return this.#r}#s;get nlink(){return this.#s}#n;get uid(){return this.#n}#f;get gid(){return this.#f}#l;get rdev(){return this.#l}#_;get blksize(){return this.#_}#a;get ino(){return this.#a}#c;get size(){return this.#c}#i;get blocks(){return this.#i}#d;get atimeMs(){return this.#d}#w;get mtimeMs(){return this.#w}#m;get ctimeMs(){return this.#m}#x;get birthtimeMs(){return this.#x}#K;get atime(){return this.#K}#O;get mtime(){return this.#O}#G;get ctime(){return this.#G}#b;get birthtime(){return this.#b}#h;#z;#k;#g;#q;#v;#e;#S;#y;#C;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(o,e=qo,s,i,r,n,a){this.name=o,this.#h=r?Ys(o):Fe(o),this.#e=e&RO,this.nocase=r,this.roots=i,this.root=s||this,this.#S=n,this.#k=a.fullpath,this.#q=a.relative,this.#v=a.relativePosix,this.parent=a.parent,this.parent?this.#o=this.parent.#o:this.#o=ml(a.fs)}depth(){return this.#z!==void 0?this.#z:this.parent?this.#z=this.parent.depth()+1:this.#z=0}childrenCache(){return this.#S}resolve(o){if(!o)return this;let e=this.getRootString(o),i=o.substring(e.length).split(this.splitSep);return e?this.getRoot(e).#F(i):this.#F(i)}#F(o){let e=this;for(let s of o)e=e.child(s);return e}children(){let o=this.#S.get(this);if(o)return o;let e=Object.assign([],{provisional:0});return this.#S.set(this,e),this.#e&=~Kr,e}child(o,e){if(o===""||o===".")return this;if(o==="..")return this.parent||this;let s=this.children(),i=this.nocase?Ys(o):Fe(o);for(let c of s)if(c.#h===i)return c;let r=this.parent?this.sep:"",n=this.#k?this.#k+r+o:void 0,a=this.newChild(o,qo,{...e,parent:this,fullpath:n});return this.canReaddir()||(a.#e|=Vo),s.push(a),a}relative(){if(this.isCWD)return"";if(this.#q!==void 0)return this.#q;let o=this.name,e=this.parent;if(!e)return this.#q=this.name;let s=e.relative();return s+(!s||!e.parent?"":this.sep)+o}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#v!==void 0)return this.#v;let o=this.name,e=this.parent;if(!e)return this.#v=this.fullpathPosix();let s=e.relativePosix();return s+(!s||!e.parent?"":"/")+o}fullpath(){if(this.#k!==void 0)return this.#k;let o=this.name,e=this.parent;if(!e)return this.#k=this.name;let i=e.fullpath()+(e.parent?this.sep:"")+o;return this.#k=i}fullpathPosix(){if(this.#g!==void 0)return this.#g;if(this.sep==="/")return this.#g=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#g=`//?/${i}`:this.#g=i}let o=this.parent,e=o.fullpathPosix(),s=e+(!e||!o.parent?"":"/")+this.name;return this.#g=s}isUnknown(){return(this.#e&po)===qo}isType(o){return this[`is${o}`]()}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.#e&po)===yl}isDirectory(){return(this.#e&po)===Lo}isCharacterDevice(){return(this.#e&po)===dl}isBlockDevice(){return(this.#e&po)===wl}isFIFO(){return(this.#e&po)===Ol}isSocket(){return(this.#e&po)===hl}isSymbolicLink(){return(this.#e&Kt)===Kt}lstatCached(){return this.#e&cl?this:void 0}readlinkCached(){return this.#y}realpathCached(){return this.#C}readdirCached(){let o=this.children();return o.slice(0,o.provisional)}canReadlink(){if(this.#y)return!0;if(!this.parent)return!1;let o=this.#e&po;return!(o!==qo&&o!==Kt||this.#e&Xs||this.#e&Vo)}calledReaddir(){return!!(this.#e&Kr)}isENOENT(){return!!(this.#e&Vo)}isNamed(o){return this.nocase?this.#h===Ys(o):this.#h===Fe(o)}async readlink(){let o=this.#y;if(o)return o;if(this.canReadlink()&&this.parent)try{let e=await this.#o.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(e);if(s)return this.#y=s}catch(e){this.#u(e.code);return}}readlinkSync(){let o=this.#y;if(o)return o;if(this.canReadlink()&&this.parent)try{let e=this.#o.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(e);if(s)return this.#y=s}catch(e){this.#u(e.code);return}}#M(o){this.#e|=Kr;for(let e=o.provisional;e<o.length;e++){let s=o[e];s&&s.#E()}}#E(){this.#e&Vo||(this.#e=(this.#e|Vo)&Ce,this.#W())}#W(){let o=this.children();o.provisional=0;for(let e of o)e.#E()}#p(){this.#e|=Is,this.#V()}#V(){if(this.#e&Se)return;let o=this.#e;(o&po)===Lo&&(o&=Ce),this.#e=o|Se,this.#W()}#X(o=""){o==="ENOTDIR"||o==="EPERM"?this.#V():o==="ENOENT"?this.#E():this.children().provisional=0}#Y(o=""){o==="ENOTDIR"?this.parent.#V():o==="ENOENT"&&this.#E()}#u(o=""){let e=this.#e;e|=Xs,o==="ENOENT"&&(e|=Vo),(o==="EINVAL"||o==="UNKNOWN")&&(e&=Ce),this.#e=e,o==="ENOTDIR"&&this.parent&&this.parent.#V()}#I(o,e){return this.#N(o,e)||this.#Z(o,e)}#Z(o,e){let s=Gr(o),i=this.newChild(o.name,s,{parent:this}),r=i.#e&po;return r!==Lo&&r!==Kt&&r!==qo&&(i.#e|=Se),e.unshift(i),e.provisional++,i}#N(o,e){for(let s=e.provisional;s<e.length;s++){let i=e[s];if((this.nocase?Ys(o.name):Fe(o.name))===i.#h)return this.#P(o,i,s,e)}}#P(o,e,s,i){let r=e.name;return e.#e=e.#e&Ce|Gr(o),r!==o.name&&(e.name=o.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(e)),i.provisional++,e}async lstat(){if((this.#e&Vo)===0)try{return this.#A(await this.#o.promises.lstat(this.fullpath())),this}catch(o){this.#Y(o.code)}}lstatSync(){if((this.#e&Vo)===0)try{return this.#A(this.#o.lstatSync(this.fullpath())),this}catch(o){this.#Y(o.code)}}#A(o){let{atime:e,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:n,blocks:a,ctime:c,ctimeMs:u,dev:d,gid:x,ino:m,mode:w,mtime:f,mtimeMs:k,nlink:W,rdev:p,size:q,uid:O}=o;this.#K=e,this.#d=s,this.#b=i,this.#x=r,this.#_=n,this.#i=a,this.#G=c,this.#m=u,this.#t=d,this.#f=x,this.#a=m,this.#r=w,this.#O=f,this.#w=k,this.#s=W,this.#l=p,this.#c=q,this.#n=O;let l=Gr(o);this.#e=this.#e&Ce|l|cl,l!==qo&&l!==Lo&&l!==Kt&&(this.#e|=Se)}#T=[];#U=!1;#Q(o){this.#U=!1;let e=this.#T.slice();this.#T.length=0,e.forEach(s=>s(null,o))}readdirCB(o,e=!1){if(!this.canReaddir()){e?o(null,[]):queueMicrotask(()=>o(null,[]));return}let s=this.children();if(this.calledReaddir()){let r=s.slice(0,s.provisional);e?o(null,r):queueMicrotask(()=>o(null,r));return}if(this.#T.push(o),this.#U)return;this.#U=!0;let i=this.fullpath();this.#o.readdir(i,{withFileTypes:!0},(r,n)=>{if(r)this.#X(r.code),s.provisional=0;else{for(let a of n)this.#I(a,s);this.#M(s)}this.#Q(s.slice(0,s.provisional))})}#L;async readdir(){if(!this.canReaddir())return[];let o=this.children();if(this.calledReaddir())return o.slice(0,o.provisional);let e=this.fullpath();if(this.#L)await this.#L;else{let s=()=>{};this.#L=new Promise(i=>s=i);try{for(let i of await this.#o.promises.readdir(e,{withFileTypes:!0}))this.#I(i,o);this.#M(o)}catch(i){this.#X(i.code),o.provisional=0}this.#L=void 0,s()}return o.slice(0,o.provisional)}readdirSync(){if(!this.canReaddir())return[];let o=this.children();if(this.calledReaddir())return o.slice(0,o.provisional);let e=this.fullpath();try{for(let s of this.#o.readdirSync(e,{withFileTypes:!0}))this.#I(s,o);this.#M(o)}catch(s){this.#X(s.code),o.provisional=0}return o.slice(0,o.provisional)}canReaddir(){if(this.#e&ll)return!1;let o=po&this.#e;return o===qo||o===Lo||o===Kt}shouldWalk(o,e){return(this.#e&Lo)===Lo&&!(this.#e&ll)&&!o.has(this)&&(!e||e(this))}async realpath(){if(this.#C)return this.#C;if(!((Is|Xs|Vo)&this.#e))try{let o=await this.#o.promises.realpath(this.fullpath());return this.#C=this.resolve(o)}catch{this.#p()}}realpathSync(){if(this.#C)return this.#C;if(!((Is|Xs|Vo)&this.#e))try{let o=this.#o.realpathSync(this.fullpath());return this.#C=this.resolve(o)}catch{this.#p()}}[fl](o){if(o===this)return;o.isCWD=!1,this.isCWD=!0;let e=new Set([]),s=[],i=this;for(;i&&i.parent;)e.add(i),i.#q=s.join(this.sep),i.#v=s.join("/"),i=i.parent,s.push("..");for(i=o;i&&i.parent&&!e.has(i);)i.#q=void 0,i.#v=void 0,i=i.parent}},Ps=class t extends ao{sep="\\";splitSep=jO;constructor(o,e=qo,s,i,r,n,a){super(o,e,s,i,r,n,a)}newChild(o,e=qo,s={}){return new t(o,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(o){return It.win32.parse(o).root}getRoot(o){if(o=QO(o.toUpperCase()),o===this.root.name)return this.root;for(let[e,s]of Object.entries(this.roots))if(this.sameRoot(o,e))return this.roots[o]=s;return this.roots[o]=new Zt(o,this).root}sameRoot(o,e=this.root.name){return o=o.toUpperCase().replace(/\//g,"\\").replace(gl,"$1\\"),o===e}},Ls=class t extends ao{splitSep="/";sep="/";constructor(o,e=qo,s,i,r,n,a){super(o,e,s,i,r,n,a)}getRootString(o){return o.startsWith("/")?"/":""}getRoot(o){return this.root}newChild(o,e=qo,s={}){return new t(o,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}},Ts=class{root;rootPath;roots;cwd;#o;#t;#r;nocase;#s;constructor(o=process.cwd(),e,s,{nocase:i,childrenCacheSize:r=16*1024,fs:n=Ne}={}){this.#s=ml(n),(o instanceof URL||o.startsWith("file://"))&&(o=(0,xl.fileURLToPath)(o));let a=e.resolve(o);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#o=new Zs,this.#t=new Zs,this.#r=new br(r);let c=a.substring(this.rootPath.length).split(s);if(c.length===1&&!c[0]&&c.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#s),this.roots[this.rootPath]=this.root;let u=this.root,d=c.length-1,x=e.sep,m=this.rootPath,w=!1;for(let f of c){let k=d--;u=u.child(f,{relative:new Array(k).fill("..").join(x),relativePosix:new Array(k).fill("..").join("/"),fullpath:m+=(w?"":x)+f}),w=!0}this.cwd=u}depth(o=this.cwd){return typeof o=="string"&&(o=this.cwd.resolve(o)),o.depth()}childrenCache(){return this.#r}resolve(...o){let e="";for(let r=o.length-1;r>=0;r--){let n=o[r];if(!(!n||n===".")&&(e=e?`${n}/${e}`:n,this.isAbsolute(n)))break}let s=this.#o.get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpath();return this.#o.set(e,i),i}resolvePosix(...o){let e="";for(let r=o.length-1;r>=0;r--){let n=o[r];if(!(!n||n===".")&&(e=e?`${n}/${e}`:n,this.isAbsolute(n)))break}let s=this.#t.get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpathPosix();return this.#t.set(e,i),i}relative(o=this.cwd){return typeof o=="string"&&(o=this.cwd.resolve(o)),o.relative()}relativePosix(o=this.cwd){return typeof o=="string"&&(o=this.cwd.resolve(o)),o.relativePosix()}basename(o=this.cwd){return typeof o=="string"&&(o=this.cwd.resolve(o)),o.name}dirname(o=this.cwd){return typeof o=="string"&&(o=this.cwd.resolve(o)),(o.parent||o).fullpath()}async readdir(o=this.cwd,e={withFileTypes:!0}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof ao||(e=o,o=this.cwd);let{withFileTypes:s}=e;if(o.canReaddir()){let i=await o.readdir();return s?i:i.map(r=>r.name)}else return[]}readdirSync(o=this.cwd,e={withFileTypes:!0}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof ao||(e=o,o=this.cwd);let{withFileTypes:s=!0}=e;return o.canReaddir()?s?o.readdirSync():o.readdirSync().map(i=>i.name):[]}async lstat(o=this.cwd){return typeof o=="string"&&(o=this.cwd.resolve(o)),o.lstat()}lstatSync(o=this.cwd){return typeof o=="string"&&(o=this.cwd.resolve(o)),o.lstatSync()}async readlink(o=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof ao||(e=o.withFileTypes,o=this.cwd);let s=await o.readlink();return e?s:s?.fullpath()}readlinkSync(o=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof ao||(e=o.withFileTypes,o=this.cwd);let s=o.readlinkSync();return e?s:s?.fullpath()}async realpath(o=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof ao||(e=o.withFileTypes,o=this.cwd);let s=await o.realpath();return e?s:s?.fullpath()}realpathSync(o=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof ao||(e=o.withFileTypes,o=this.cwd);let s=o.realpathSync();return e?s:s?.fullpath()}async walk(o=this.cwd,e={}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof ao||(e=o,o=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e,a=[];(!r||r(o))&&a.push(s?o:o.fullpath());let c=new Set,u=(x,m)=>{c.add(x),x.readdirCB((w,f)=>{if(w)return m(w);let k=f.length;if(!k)return m();let W=()=>{--k===0&&m()};for(let p of f)(!r||r(p))&&a.push(s?p:p.fullpath()),i&&p.isSymbolicLink()?p.realpath().then(q=>q?.isUnknown()?q.lstat():q).then(q=>q?.shouldWalk(c,n)?u(q,W):W()):p.shouldWalk(c,n)?u(p,W):W()},!0)},d=o;return new Promise((x,m)=>{u(d,w=>{if(w)return m(w);x(a)})})}walkSync(o=this.cwd,e={}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof ao||(e=o,o=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e,a=[];(!r||r(o))&&a.push(s?o:o.fullpath());let c=new Set([o]);for(let u of c){let d=u.readdirSync();for(let x of d){(!r||r(x))&&a.push(s?x:x.fullpath());let m=x;if(x.isSymbolicLink()){if(!(i&&(m=x.realpathSync())))continue;m.isUnknown()&&m.lstatSync()}m.shouldWalk(c,n)&&c.add(m)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(o=this.cwd,e={}){return typeof o=="string"?o=this.cwd.resolve(o):o instanceof ao||(e=o,o=this.cwd),this.stream(o,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(o=this.cwd,e={}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof ao||(e=o,o=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e;(!r||r(o))&&(yield s?o:o.fullpath());let a=new Set([o]);for(let c of a){let u=c.readdirSync();for(let d of u){(!r||r(d))&&(yield s?d:d.fullpath());let x=d;if(d.isSymbolicLink()){if(!(i&&(x=d.realpathSync())))continue;x.isUnknown()&&x.lstatSync()}x.shouldWalk(a,n)&&a.add(x)}}}stream(o=this.cwd,e={}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof ao||(e=o,o=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e,a=new _t({objectMode:!0});(!r||r(o))&&a.write(s?o:o.fullpath());let c=new Set,u=[o],d=0,x=()=>{let m=!1;for(;!m;){let w=u.shift();if(!w){d===0&&a.end();return}d++,c.add(w);let f=(W,p,q=!1)=>{if(W)return a.emit("error",W);if(i&&!q){let O=[];for(let l of p)l.isSymbolicLink()&&O.push(l.realpath().then(g=>g?.isUnknown()?g.lstat():g));if(O.length){Promise.all(O).then(()=>f(null,p,!0));return}}for(let O of p)O&&(!r||r(O))&&(a.write(s?O:O.fullpath())||(m=!0));d--;for(let O of p){let l=O.realpathCached()||O;l.shouldWalk(c,n)&&u.push(l)}m&&!a.flowing?a.once("drain",x):k||x()},k=!0;w.readdirCB(f,!0),k=!1}};return x(),a}streamSync(o=this.cwd,e={}){typeof o=="string"?o=this.cwd.resolve(o):o instanceof ao||(e=o,o=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e,a=new _t({objectMode:!0}),c=new Set;(!r||r(o))&&a.write(s?o:o.fullpath());let u=[o],d=0,x=()=>{let m=!1;for(;!m;){let w=u.shift();if(!w){d===0&&a.end();return}d++,c.add(w);let f=w.readdirSync();for(let k of f)(!r||r(k))&&(a.write(s?k:k.fullpath())||(m=!0));d--;for(let k of f){let W=k;if(k.isSymbolicLink()){if(!(i&&(W=k.realpathSync())))continue;W.isUnknown()&&W.lstatSync()}W.shouldWalk(c,n)&&u.push(W)}}m&&!a.flowing&&a.once("drain",x)};return x(),a}chdir(o=this.cwd){let e=this.cwd;this.cwd=typeof o=="string"?this.cwd.resolve(o):o,this.cwd[fl](e)}},Zt=class extends Ts{sep="\\";constructor(o=process.cwd(),e={}){let{nocase:s=!0}=e;super(o,It.win32,"\\",{...e,nocase:s}),this.nocase=s;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(o){return It.win32.parse(o).root.toUpperCase()}newRoot(o){return new Ps(this.rootPath,Lo,void 0,this.roots,this.nocase,this.childrenCache(),{fs:o})}isAbsolute(o){return o.startsWith("/")||o.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(o)}},Pt=class extends Ts{sep="/";constructor(o=process.cwd(),e={}){let{nocase:s=!1}=e;super(o,It.posix,"/",{...e,nocase:s}),this.nocase=s}parseRootPath(o){return"/"}newRoot(o){return new Ls(this.rootPath,Lo,void 0,this.roots,this.nocase,this.childrenCache(),{fs:o})}isAbsolute(o){return o.startsWith("/")}},Me=class extends Pt{constructor(o=process.cwd(),e={}){let{nocase:s=!0}=e;super(o,{...e,nocase:s})}},Yh=process.platform==="win32"?Ps:Ls,zl=process.platform==="win32"?Zt:process.platform==="darwin"?Me:Pt;var JO=t=>t.length>=1,BO=t=>t.length>=1,Lt=class t{#o;#t;#r;length;#s;#n;#f;#l;#_;#a;#c=!0;constructor(o,e,s,i){if(!JO(o))throw new TypeError("empty pattern list");if(!BO(e))throw new TypeError("empty glob list");if(e.length!==o.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=o.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#o=o,this.#t=e,this.#r=s,this.#s=i,this.#r===0){if(this.isUNC()){let[r,n,a,c,...u]=this.#o,[d,x,m,w,...f]=this.#t;u[0]===""&&(u.shift(),f.shift());let k=[r,n,a,c,""].join("/"),W=[d,x,m,w,""].join("/");this.#o=[k,...u],this.#t=[W,...f],this.length=this.#o.length}else if(this.isDrive()||this.isAbsolute()){let[r,...n]=this.#o,[a,...c]=this.#t;n[0]===""&&(n.shift(),c.shift());let u=r+"/",d=a+"/";this.#o=[u,...n],this.#t=[d,...c],this.length=this.#o.length}}}pattern(){return this.#o[this.#r]}isString(){return typeof this.#o[this.#r]=="string"}isGlobstar(){return this.#o[this.#r]===io}isRegExp(){return this.#o[this.#r]instanceof RegExp}globString(){return this.#f=this.#f||(this.#r===0?this.isAbsolute()?this.#t[0]+this.#t.slice(1).join("/"):this.#t.join("/"):this.#t.slice(this.#r).join("/"))}hasMore(){return this.length>this.#r+1}rest(){return this.#n!==void 0?this.#n:this.hasMore()?(this.#n=new t(this.#o,this.#t,this.#r+1,this.#s),this.#n.#a=this.#a,this.#n.#_=this.#_,this.#n.#l=this.#l,this.#n):this.#n=null}isUNC(){let o=this.#o;return this.#_!==void 0?this.#_:this.#_=this.#s==="win32"&&this.#r===0&&o[0]===""&&o[1]===""&&typeof o[2]=="string"&&!!o[2]&&typeof o[3]=="string"&&!!o[3]}isDrive(){let o=this.#o;return this.#l!==void 0?this.#l:this.#l=this.#s==="win32"&&this.#r===0&&this.length>1&&typeof o[0]=="string"&&/^[a-z]:$/i.test(o[0])}isAbsolute(){let o=this.#o;return this.#a!==void 0?this.#a:this.#a=o[0]===""&&o.length>1||this.isDrive()||this.isUNC()}root(){let o=this.#o[0];return typeof o=="string"&&this.isAbsolute()&&this.#r===0?o:""}checkFollowGlobstar(){return!(this.#r===0||!this.isGlobstar()||!this.#c)}markFollowGlobstar(){return this.#r===0||!this.isGlobstar()||!this.#c?!1:(this.#c=!1,!0)}};var DO=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Tt=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(o,{nobrace:e,nocase:s,noext:i,noglobstar:r,platform:n=DO}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=n,this.mmopts={dot:!0,nobrace:e,nocase:s,noext:i,noglobstar:r,optimizationLevel:2,platform:n,nocomment:!0,nonegate:!0};for(let a of o)this.add(a)}add(o){let e=new fo(o,this.mmopts);for(let s=0;s<e.set.length;s++){let i=e.set[s],r=e.globParts[s];if(!i||!r)throw new Error("invalid pattern object");for(;i[0]==="."&&r[0]===".";)i.shift(),r.shift();let n=new Lt(i,r,0,this.platform),a=new fo(n.globString(),this.mmopts),c=r[r.length-1]==="**",u=n.isAbsolute();u?this.absolute.push(a):this.relative.push(a),c&&(u?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(o){let e=o.fullpath(),s=`${e}/`,i=o.relative()||".",r=`${i}/`;for(let n of this.relative)if(n.match(i)||n.match(r))return!0;for(let n of this.absolute)if(n.match(e)||n.match(s))return!0;return!1}childrenIgnored(o){let e=o.fullpath()+"/",s=(o.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(e))return!0;return!1}};var vr=class t{store;constructor(o=new Map){this.store=o}copy(){return new t(new Map(this.store))}hasWalked(o,e){return this.store.get(o.fullpath())?.has(e.globString())}storeWalked(o,e){let s=o.fullpath(),i=this.store.get(s);i?i.add(e.globString()):this.store.set(s,new Set([e.globString()]))}},Wr=class{store=new Map;add(o,e,s){let i=(e?2:0)|(s?1:0),r=this.store.get(o);this.store.set(o,r===void 0?i:i&r)}entries(){return[...this.store.entries()].map(([o,e])=>[o,!!(e&2),!!(e&1)])}},pr=class{store=new Map;add(o,e){if(!o.canReaddir())return;let s=this.store.get(o);s?s.find(i=>i.globString()===e.globString())||s.push(e):this.store.set(o,[e])}get(o){let e=this.store.get(o);if(!e)throw new Error("attempting to walk unknown path");return e}entries(){return this.keys().map(o=>[o,this.store.get(o)])}keys(){return[...this.store.keys()].filter(o=>o.canReaddir())}},Ee=class t{hasWalkedCache;matches=new Wr;subwalks=new pr;patterns;follow;dot;opts;constructor(o,e){this.opts=o,this.follow=!!o.follow,this.dot=!!o.dot,this.hasWalkedCache=e?e.copy():new vr}processPatterns(o,e){this.patterns=e;let s=e.map(i=>[o,i]);for(let[i,r]of s){this.hasWalkedCache.storeWalked(i,r);let n=r.root(),a=r.isAbsolute()&&this.opts.absolute!==!1;if(n){i=i.resolve(n==="/"&&this.opts.root!==void 0?this.opts.root:n);let x=r.rest();if(x)r=x;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let c,u,d=!1;for(;typeof(c=r.pattern())=="string"&&(u=r.rest());)i=i.resolve(c),r=u,d=!0;if(c=r.pattern(),u=r.rest(),d){if(this.hasWalkedCache.hasWalked(i,r))continue;this.hasWalkedCache.storeWalked(i,r)}if(typeof c=="string"){let x=c===".."||c===""||c===".";this.matches.add(i.resolve(c),a,x);continue}else if(c===io){(!i.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(i,r);let x=u?.pattern(),m=u?.rest();if(!u||(x===""||x===".")&&!m)this.matches.add(i,a,x===""||x===".");else if(x===".."){let w=i.parent||i;m?this.hasWalkedCache.hasWalked(w,m)||this.subwalks.add(w,m):this.matches.add(w,a,!0)}}else c instanceof RegExp&&this.subwalks.add(i,r)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new t(this.opts,this.hasWalkedCache)}filterEntries(o,e){let s=this.subwalks.get(o),i=this.child();for(let r of e)for(let n of s){let a=n.isAbsolute(),c=n.pattern(),u=n.rest();c===io?i.testGlobstar(r,n,u,a):c instanceof RegExp?i.testRegExp(r,c,u,a):i.testString(r,c,u,a)}return i}testGlobstar(o,e,s,i){if((this.dot||!o.name.startsWith("."))&&(e.hasMore()||this.matches.add(o,i,!1),o.canReaddir()&&(this.follow||!o.isSymbolicLink()?this.subwalks.add(o,e):o.isSymbolicLink()&&(s&&e.checkFollowGlobstar()?this.subwalks.add(o,s):e.markFollowGlobstar()&&this.subwalks.add(o,e)))),s){let r=s.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(o,r,s.rest(),i);else if(r===".."){let n=o.parent||o;this.subwalks.add(n,s)}else r instanceof RegExp&&this.testRegExp(o,r,s.rest(),i)}}testRegExp(o,e,s,i){e.test(o.name)&&(s?this.subwalks.add(o,s):this.matches.add(o,i,!1))}testString(o,e,s,i){o.isNamed(e)&&(s?this.subwalks.add(o,s):this.matches.add(o,i,!1))}};var $O=(t,o)=>typeof t=="string"?new Tt([t],o):Array.isArray(t)?new Tt(t,o):t,Us=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#o=[];#t;#r;signal;maxDepth;includeChildMatches;constructor(o,e,s){if(this.patterns=o,this.path=e,this.opts=s,this.#r=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#t=$O(s.ignore??[],s),!this.includeChildMatches&&typeof this.#t.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#o.length=0}))}#s(o){return this.seen.has(o)||!!this.#t?.ignored?.(o)}#n(o){return!!this.#t?.childrenIgnored?.(o)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let o;for(;!this.paused&&(o=this.#o.shift());)o()}onResume(o){this.signal?.aborted||(this.paused?this.#o.push(o):o())}async matchCheck(o,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=o.realpathCached()||await o.realpath(),!s)return;o=s}let r=o.isUnknown()||this.opts.stat?await o.lstat():o;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let n=await r.realpath();n&&(n.isUnknown()||this.opts.stat)&&await n.lstat()}return this.matchCheckTest(r,e)}matchCheckTest(o,e){return o&&(this.maxDepth===1/0||o.depth()<=this.maxDepth)&&(!e||o.canReaddir())&&(!this.opts.nodir||!o.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!o.isSymbolicLink()||!o.realpathCached()?.isDirectory())&&!this.#s(o)?o:void 0}matchCheckSync(o,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=o.realpathCached()||o.realpathSync(),!s)return;o=s}let r=o.isUnknown()||this.opts.stat?o.lstatSync():o;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let n=r.realpathSync();n&&(n?.isUnknown()||this.opts.stat)&&n.lstatSync()}return this.matchCheckTest(r,e)}matchFinish(o,e){if(this.#s(o))return;if(!this.includeChildMatches&&this.#t?.add){let r=`${o.relativePosix()}/**`;this.#t.add(r)}let s=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(o);let i=this.opts.mark&&o.isDirectory()?this.#r:"";if(this.opts.withFileTypes)this.matchEmit(o);else if(s){let r=this.opts.posix?o.fullpathPosix():o.fullpath();this.matchEmit(r+i)}else{let r=this.opts.posix?o.relativePosix():o.relative(),n=this.opts.dotRelative&&!r.startsWith(".."+this.#r)?"."+this.#r:"";this.matchEmit(r?n+r+i:"."+i)}}async match(o,e,s){let i=await this.matchCheck(o,s);i&&this.matchFinish(i,e)}matchSync(o,e,s){let i=this.matchCheckSync(o,s);i&&this.matchFinish(i,e)}walkCB(o,e,s){this.signal?.aborted&&s(),this.walkCB2(o,e,new Ee(this.opts),s)}walkCB2(o,e,s,i){if(this.#n(o))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(o,e,s,i));return}s.processPatterns(o,e);let r=1,n=()=>{--r===0&&i()};for(let[a,c,u]of s.matches.entries())this.#s(a)||(r++,this.match(a,c,u).then(()=>n()));for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let c=a.readdirCached();a.calledReaddir()?this.walkCB3(a,c,s,n):a.readdirCB((u,d)=>this.walkCB3(a,d,s,n),!0)}n()}walkCB3(o,e,s,i){s=s.filterEntries(o,e);let r=1,n=()=>{--r===0&&i()};for(let[a,c,u]of s.matches.entries())this.#s(a)||(r++,this.match(a,c,u).then(()=>n()));for(let[a,c]of s.subwalks.entries())r++,this.walkCB2(a,c,s.child(),n);n()}walkCBSync(o,e,s){this.signal?.aborted&&s(),this.walkCB2Sync(o,e,new Ee(this.opts),s)}walkCB2Sync(o,e,s,i){if(this.#n(o))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(o,e,s,i));return}s.processPatterns(o,e);let r=1,n=()=>{--r===0&&i()};for(let[a,c,u]of s.matches.entries())this.#s(a)||this.matchSync(a,c,u);for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let c=a.readdirSync();this.walkCB3Sync(a,c,s,n)}n()}walkCB3Sync(o,e,s,i){s=s.filterEntries(o,e);let r=1,n=()=>{--r===0&&i()};for(let[a,c,u]of s.matches.entries())this.#s(a)||this.matchSync(a,c,u);for(let[a,c]of s.subwalks.entries())r++,this.walkCB2Sync(a,c,s.child(),n);n()}},Ve=class extends Us{matches=new Set;constructor(o,e,s){super(o,e,s)}matchEmit(o){this.matches.add(o)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((o,e)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?e(this.signal.reason):o(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}},Xe=class extends Us{results;constructor(o,e,s){super(o,e,s),this.results=new _t({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(o){this.results.write(o),this.results.flowing||this.pause()}stream(){let o=this.path;return o.isUnknown()?o.lstat().then(()=>{this.walkCB(o,this.patterns,()=>this.results.end())}):this.walkCB(o,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 HO=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Xo=class{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(o,e){if(!e)throw new TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=(0,kl.fileURLToPath)(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=e.includeChildMatches!==!1,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof o=="string"&&(o=[o]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(o=o.map(c=>c.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");o=o.map(c=>c.includes("/")?c:`./**/${c}`)}if(this.pattern=o,this.platform=e.platform||HO,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,e.nocase!==void 0&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let c=e.platform==="win32"?Zt:e.platform==="darwin"?Me:e.platform?Pt:zl;this.scurry=new c(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",i={...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},r=this.pattern.map(c=>new fo(c,i)),[n,a]=r.reduce((c,u)=>(c[0].push(...u.set),c[1].push(...u.globParts),c),[[],[]]);this.patterns=n.map((c,u)=>{let d=a[u];if(!d)throw new Error("invalid pattern object");return new Lt(c,d,0,this.platform)})}async walk(){return[...await new Ve(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 Ve(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 Xe(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 Xe(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 qr=(t,o={})=>{Array.isArray(t)||(t=[t]);for(let e of t)if(new fo(e,o).hasMagic())return!0;return!1};function As(t,o={}){return new Xo(t,o).streamSync()}function Gl(t,o={}){return new Xo(t,o).stream()}function bl(t,o={}){return new Xo(t,o).walkSync()}async function Kl(t,o={}){return new Xo(t,o).walk()}function Qs(t,o={}){return new Xo(t,o).iterateSync()}function vl(t,o={}){return new Xo(t,o).iterate()}var od=As,td=Object.assign(Gl,{sync:As}),ed=Qs,sd=Object.assign(vl,{sync:Qs}),id=Object.assign(bl,{stream:As,iterate:Qs}),Ut=Object.assign(Kl,{glob:Kl,globSync:bl,sync:id,globStream:Gl,stream:td,globStreamSync:As,streamSync:od,globIterate:vl,iterate:sd,globIterateSync:Qs,iterateSync:ed,Glob:Xo,hasMagic:qr,escape:Mt,unescape:Mo});Ut.glob=Ut;var Nr=P(require("node:assert")),Sr=P(require("node:fs/promises")),Gt=P(require("node:path")),Cr=null;async function Wl(t){if(Cr==null){let o=t?.androidBuildToolsDir??await rd(t);(0,Nr.default)(o!=null,"Unable to find the Android build-tools directory."),Cr={aapt2Path:Gt.default.join(o,"aapt2"),apksignerPath:Gt.default.join(o,"apksigner"),dexdumpPath:Gt.default.join(o,"dexdump")}}return Cr}async function pl(t,o,e){let{spawnAsync:s,workingDirectory:i}=o,{apksignerPath:r}=await Wl(o),n=Gt.default.join(i,"resigned.apk");await Sr.default.copyFile(t,n);let a=["sign","--ks",e.keyStorePath,"--ks-pass",e.keyStorePassword];return e.keyAlias&&a.push("--ks-key-alias",e.keyAlias),e.keyPassword&&a.push("--key-pass",e.keyPassword),a.push(n),await s(r,a),n}async function rd(t){let{logger:o}=t,e=process.env.ANDROID_SDK_ROOT;(0,Nr.default)(e!=null,"ANDROID_SDK_ROOT environment variable is not set");let s=Gt.default.join(e,"build-tools");try{let r=(await Sr.default.readdir(s,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name).sort((n,a)=>{let c=n.split(".").map(Number),u=a.split(".").map(Number);for(let d=0;d<Math.min(c.length,u.length);d++)if(c[d]!==u[d])return u[d]-c[d];return u.length-c.length});return r.length>0?Gt.default.join(s,r[0]):(o.error("No build-tools directories found."),null)}catch(i){return o.error(`Failed to read the build-tools directory: ${i}`),null}}async function ql(t,o,e){let{spawnAsync:s}=e,{dexdumpPath:i}=await Wl(e),r=o.replace(/\./g,"/"),n=new RegExp(`^ Class descriptor : 'L(${r}\\/.*);`,"gm"),a=new Set,c=await Ut("classes*.dex",{cwd:t}),u=s(i,c,{cwd:t});return u.child.stdout?.on("data",d=>{let x=String(d).split(`
34
- `);for(let m of x){let w=n.exec(m);w&&a.add(w[1].replace(/\//g,"."))}}),await u,a}var Jt=P(require("node:assert")),Pe=P(require("node:fs/promises")),bu=P(require("node:path")),Bs=P(ur());var ku=P(hu()),Ku=P(require("node:assert")),bt=P(require("node:fs/promises")),jt=P(require("node:path"));async function Gu(t){return(await bt.default.stat(t).catch(()=>null))?.isFile()??!1}async function Js(t){return(await bt.default.stat(t).catch(()=>null))?.isDirectory()??!1}function Ie(t){return(0,Ku.default)(t!=null,"Expected value to be non-null"),t}async function Ze(t){let o=t.platform==="android"?".apk":".ipa";return{...t,projectRoot:jt.default.resolve(t.projectRoot),workingDirectory:t.workingDirectory??await bt.default.mkdtemp(jt.default.join(zu(),"repack-app-")),outputPath:t.outputPath??jt.default.join(t.projectRoot,`repacked${o}`),logger:Xd(t.logger),spawnAsync:t.spawnAsync??Yd(!!t.verbose)}}function Xd(t){return t!=null?Rs.isBunyanLikeLogger(t)?new Rs(t):t:new Ye}var Ye=class{debug(...o){console.debug(...o)}info(...o){console.log(...o)}warn(...o){console.warn(...o)}error(...o){console.error(...o)}time(o){console.time(o)}timeEnd(o){console.timeEnd(o)}},Rs=class{constructor(o){this.logger=o}timerMap={};static isBunyanLikeLogger(o){return o.info&&o.time===void 0}debug(...o){this.logger.debug(o.join(""))}info(...o){this.logger.info(o.join(""))}warn(...o){this.logger.warn(o.join(""))}error(...o){this.logger.error(o.join(""))}time(o){this.timerMap[o]=Date.now()}timeEnd(o){if(this.timerMap[o]==null){this.logger.warn(`Timer '${o}' does not exist`);return}let e=Date.now()-this.timerMap[o];this.logger.info(`${o}: ${e} ms`),delete this.timerMap[o]}};function Yd(t){return function(e,s,i){return(0,ku.default)(e,s,{stdio:t?"inherit":"pipe",...i})}}async function Rt(t,o){await bt.default.mkdir(o,{recursive:!0});let e=await bt.default.readdir(t,{withFileTypes:!0});for(let s of e){let i=jt.default.join(t,s.name),r=jt.default.join(o,s.name);s.isDirectory()?await Rt(i,r):s.isFile()&&await bt.default.copyFile(i,r)}}async function vu({config:t,decodedApkRoot:o}){let e=bu.default.join(o,"res","values","strings.xml"),s=await Pe.default.readFile(e,"utf8");s=s.replace(/(<string name="app_name">)(.+)(<\/string>)/,`$1${t.name}$3`),await Pe.default.writeFile(e,s)}async function Wu({config:t,androidManiestXml:o,dexClasses:e,originalAppIdSet:s,updatesRuntimeVersion:i}){let r=Ie(t.android?.package),n=o.manifest.$.package!==r;Ar(o,m=>{for(let w of s)if(m.startsWith(w)&&!e.has(m))return m.replace(new RegExp(`^${w}`),r);return m});let a=Ur("manifest",o.manifest,(m,w)=>m==="intent-filter"&&Ur(m,w,(f,k)=>f==="action"&&k[0].$?.["android:name"]==="android.intent.action.VIEW").length>0),c=Array.isArray(t.scheme)?t.scheme[0]:t.scheme;for(let m of a)Ar(m,w=>{let f=w;for(let k of s)f=f.replace(new RegExp(`^${k}`),r);return f=f.replace(/^exp\+.+$/g,`exp+${Ie(t.slug)}`),c&&(f=f.replace(/^myapp$/g,c)),f});let u=o.manifest.application[0];(0,Jt.default)(u.$?.["android:name"]?.endsWith(".MainApplication"),"Expected application node to be named as MainApplication"),Id(u,t,i),o.manifest.$.package=r;let d=t.android?.version||t.version||"1.0.0",x=Number(t.android?.versionCode||1);return o.manifest.$["android:versionName"]=d,o.manifest.$["android:versionCode"]=x,{isPackageNameChanged:n}}async function pu(t){let o=await Pe.default.readFile(t,"utf8");return await new Bs.Parser().parseStringPromise(o)}async function qu(t,o){let s=new Bs.Builder().buildObject(t);await Pe.default.writeFile(o,s)}function Cu(t){let o=t.manifest.$.package;return(0,Jt.default)(o!=null,"Expected package attribute to be present in AndroidManifest.xml"),o}function Nu(t,o){let e=t.manifest.application?.[0]?.$?.["android:name"];if(e){let s=e.replace(/\.[^.]+$/,"");if(s!==e&&s!==o)return s}return null}function Id(t,o,e){let s=t["meta-data"]??[],i=o.updates?.enabled??!0,r=s.find(u=>u.$?.["android:name"]==="expo.modules.updates.ENABLED");r!=null?((0,Jt.default)(r.$!=null),r.$["android:value"]=i?"true":"false"):s.push({$:{"android:name":"expo.modules.updates.ENABLED","android:value":i?"true":"false"}});let n=s.find(u=>u.$?.["android:name"]==="expo.modules.updates.EXPO_RUNTIME_VERSION");e!=null&&(n!=null?((0,Jt.default)(n.$!=null),n.$["android:value"]=e):s.push({$:{"android:name":"expo.modules.updates.EXPO_RUNTIME_VERSION","android:value":e}}));let a=s.find(u=>u.$?.["android:name"]==="expo.modules.updates.EXPO_UPDATE_URL"),c=o.updates?.url;c&&(a!=null?((0,Jt.default)(a.$!=null),a.$["android:value"]=c):s.push({$:{"android:name":"expo.modules.updates.EXPO_UPDATE_URL","android:value":c}}))}function Ur(t,o,e){return o==null?[]:e(t,o)?[o]:Object.keys(o).filter(s=>s!=="$"&&s!=="_").flatMap(s=>{let i=o[s];return Ur(s,i,e)})}function Ar(t,o){if(t==null)return;let e=t.$??{};for(let[s,i]of Object.entries(e))e[s]=o(i);for(let[s,i]of Object.entries(t))s==="$"||s==="_"||Ar(i,o)}var Su="./debug.keystore";var I_=P(Y_());function _i(t,o){let e=process.env;for(let[s,i]of Object.entries(o??{})){if(e[s]!==void 0)continue;let r;i==null?r="":typeof i=="string"?r=i:r=JSON.stringify(i),e[s]=r}sy("development"),(0,I_.loadProjectEnv)(t)}function sy(t){process.env.NODE_ENV=process.env.NODE_ENV||t,process.env.BABEL_ENV=process.env.BABEL_ENV||process.env.NODE_ENV,globalThis.__DEV__=process.env.NODE_ENV!=="production"}var mi=P(require("node:assert")),xi=P(require("node:fs/promises")),Yo=P(require("node:path")),re=P(T_());async function gi(t,o){let{workingDirectory:e}=t,s=Yo.default.join(e,"app.config");return await xi.default.writeFile(s,JSON.stringify(o)),s}async function Oi(t){let{platform:o,projectRoot:e,spawnAsync:s,workingDirectory:i}=t,{stdout:r}=await s("node",["-e","require('expo/scripts/resolveAppEntry')",e,o,"absolute"],{cwd:e,stdio:"pipe"}),n=re.default.silent(t.projectRoot,"expo-updates/utils/build/createUpdatesResources.js");return(0,mi.default)(n,"Failed to resolve `createUpdatesResources.js` within expo-updates package"),await s("node",[n,o,e,i,"all",r.trim()],{cwd:e}),Yo.default.join(i,"app.manifest")}function di(t){let o=U_(t);(0,mi.default)(o,"Failed to resolve '@expo/config' package in the project");let{getPackageJson:e}=require(o),s=e(t);return!!(s.dependencies&&"expo-updates"in s.dependencies)}async function wi(t,o){let{projectRoot:e,spawnAsync:s}=t,i=re.default.silent(e,"expo-updates/bin/cli")??(0,re.default)(e,"expo-updates/bin/cli.js"),{stdout:r}=await s(i,["runtimeversion:resolve","--platform","android","--workflow","managed"],{cwd:e,stdio:"pipe"});return JSON.parse(r).runtimeVersion??null}function U_(t){let o=re.default.silent(t,"expo/package.json");return o?re.default.silent(Yo.default.dirname(o),"@expo/config")??null:null}function yi(t,o){let e=U_(t);(0,mi.default)(e,"Failed to resolve '@expo/config' package in the project");let{getConfig:s}=require(e);return s(t,o)}async function hi(t,o){let{projectRoot:e,platform:s,spawnAsync:i,workingDirectory:r}=o,n=Yo.default.resolve(r,"bundles");await xi.default.mkdir(n,{recursive:!0});let a=Yo.default.join(n,"assets");await xi.default.mkdir(a,{recursive:!0});let{stdout:c}=await i("node",["-e","require('expo/scripts/resolveAppEntry')",e,s,"absolute"],{cwd:e,stdio:"pipe"}),u=ry(t,s),d=s==="android"?"index.android.bundle":"main.bundle",x=Yo.default.join(n,d),m=["expo","export:embed","--platform",s,"--entry-file",c.trim(),"--bundle-output",Yo.default.join(n,d),"--assets-dest",Yo.default.join(n,"assets"),"--dev","false","--reset-cache"];return u?(m.push("--minify","false"),m.push("--bytecode","true"),m.push("--unstable-transform-profile","hermes")):m.push("--minify","true"),o.exportEmbedOptions?.sourcemapOutput&&m.push("--sourcemap-output",o.exportEmbedOptions.sourcemapOutput),await i("npx",m,{cwd:e}),{bundleOutputPath:x,assetRoot:a}}async function fi({appWorkingDirectory:t,options:o}){if(o.exportEmbedOptions!=null)return!0;let e;return o.platform==="android"?e=Yo.default.join(t,"assets","index.android.bundle"):e=Yo.default.join(t,"main.jsbundle"),await Gu(e)}function ry(t,o){switch(o){case"android":return(t.android?.jsEngine??t.jsEngine)!=="jsc";case"ios":return(t.ios?.jsEngine??t.jsEngine)!=="jsc";default:return!1}}var ny=gt.default.resolve(__dirname,Su);async function Q_(t){let o=await Ze(t),{logger:e,workingDirectory:s}=o;await ne.default.mkdir(s,{recursive:!0}),_i(o.projectRoot,o.env);let{exp:i}=yi(o.projectRoot,{isPublicConfig:!0,skipSDKVersionRequirement:!0}),r=await Kc(gt.default.resolve(o.sourceAppPath),o);(0,dn.default)(i.android?.package,"Expected app ID (`android.package`) to be defined in app.json");let n=di(o.projectRoot),a=n?await wi(o,i):null;if(e.info(A_.default.dim(`Resolved runtime version: ${a}`)),await fi({appWorkingDirectory:r,options:o})){e.time("Generating bundle");let{assetRoot:O,bundleOutputPath:l}=await hi(i,o);if(e.timeEnd("Generating bundle"),e.time("Adding bundled resources"),await bc({decodedApkRoot:r,assetRoot:O,bundleOutputPath:l}),e.timeEnd("Adding bundled resources"),n){e.time("Generating 'app.manifest' for expo-updates");let g=await Oi(o),_=gt.default.join(r,"assets");await ne.default.copyFile(g,gt.default.join(_,gt.default.basename(g))),e.timeEnd("Generating 'app.manifest' for expo-updates")}}e.time("Updating AndroidManifest.xml");let u=gt.default.join(r,"AndroidManifest.xml"),d=await pu(u),x=Cu(d),m=new Set([x]),w=Nu(d,x);w!=null&&m.add(w);let f=new Set;for(let O of m){let l=await ql(r,O,o);for(let g of l)f.add(g)}(0,dn.default)(f!=null,"Failed to search for dex classes with appId in the APK");let{isPackageNameChanged:k}=await Wu({config:i,androidManiestXml:d,dexClasses:f,originalAppIdSet:m,options:o,updatesRuntimeVersion:a});k&&await vc(r,i.android?.package),await qu(d,u),e.timeEnd("Updating AndroidManifest.xml"),e.time("Updating resources"),await vu({config:i,decodedApkRoot:r}),e.timeEnd("Updating resources"),e.time("Generating app config");let W=await gi(o,i);await ne.default.copyFile(W,gt.default.join(r,"assets","app.config")),e.timeEnd("Generating app config"),e.time("Creating updated apk");let p=await Gc(r,o),q=await pl(p,o,{keyStorePath:o.androidSigningOptions?.keyStorePath??ny,keyStorePassword:o.androidSigningOptions?.keyStorePassword??"pass:android",keyAlias:o.androidSigningOptions?.keyAlias,keyPassword:o.androidSigningOptions?.keyPassword});if(e.timeEnd("Creating updated apk"),await ne.default.rename(q,o.outputPath),!o.skipWorkingDirCleanup)try{await ne.default.rm(s,{recursive:!0})}catch{}return o.outputPath}var Bi=P(require("node:assert")),ht=P(require("node:fs/promises")),Ro=P(require("node:path")),pg=P(Hi());var B_=P(require("node:assert")),ae=P(require("node:fs/promises")),mo=P(require("node:path"));var J_=P(j_());function zi(t){return R_(t)||R_((0,J_.default)(t))||"app"}function R_(t){return t.replace(/[\W_]+/g,"").normalize("NFD").replace(/[\u0300-\u036f]/g,"")}async function D_(t){let{spawnAsync:o,sourceAppPath:e}=t,s=mo.default.join(t.workingDirectory,"extracted");if(await ae.default.mkdir(s,{recursive:!0}),e.endsWith(".zip")||e.endsWith(".ipa"))await o("unzip",[e,"-d",s]);else if(e.endsWith(".tar.gz"))await o("tar",["-xzf",e,"-C",s]);else if(e.endsWith(".app")){let n=mo.default.basename(e);await Rt(e,mo.default.join(s,n))}else throw new Error("Unsupported file type. Please provide a .zip, .tar.gz, or .app file.");let r=(await Ut("{Payload/*.app,*.app}",{cwd:s,absolute:!0}))[0];return(0,B_.default)(r,`Failed to find the .app directory in the extracted artifact: ${s}`),r}async function $_({config:t,appWorkingDirectory:o,executableName:e}){let{dir:s,name:i}=mo.default.parse(o),r=zi(t.name),n=mo.default.join(s,`${r}.app`);return await ae.default.rename(mo.default.join(s,`${i}.app`),n),await ae.default.rename(mo.default.join(n,e),mo.default.join(n,r)),n}async function H_(t,o){let e=mo.default.resolve(t.workingDirectory,mo.default.basename(o));return await Rt(o,e),e}async function ox(t,o){let{spawnAsync:e,workingDirectory:s}=t;await ae.default.mkdir(mo.default.join(s,"Payload"),{recursive:!0}),await ae.default.rename(o,mo.default.join(s,"Payload",mo.default.basename(o)));let i=mo.default.resolve(s,"repacked.ipa");return await e("zip",["-r",i,"Payload"],{cwd:s}),i}function tx(t,o,e){let s=e.keychainPath?`keychain_path: "${e.keychainPath}",`:"",i;if(typeof e.provisioningProfile=="string")i=`provisioning_profile: "${e.provisioningProfile}",`;else if(typeof e.provisioningProfile=="object"&&!Array.isArray(e.provisioningProfile)){let n="";for(let[a,c]of Object.entries(e.provisioningProfile))n+=` "${a}" => "${c}",
34
+ `);for(let m of x){let w=n.exec(m);w&&a.add(w[1].replace(/\//g,"."))}}),await u,a}var Jt=P(require("node:assert")),Pe=P(require("node:fs/promises")),bu=P(require("node:path")),Bs=P(ur());var ku=P(hu()),Ku=P(require("node:assert")),bt=P(require("node:fs/promises")),jt=P(require("node:path"));async function Gu(t){return(await bt.default.stat(t).catch(()=>null))?.isFile()??!1}async function Js(t){return(await bt.default.stat(t).catch(()=>null))?.isDirectory()??!1}function Ie(t){return(0,Ku.default)(t!=null,"Expected value to be non-null"),t}async function Ze(t){let o=t.platform==="android"?".apk":".ipa";return{...t,projectRoot:jt.default.resolve(t.projectRoot),workingDirectory:t.workingDirectory??await bt.default.mkdtemp(jt.default.join(zu(),"repack-app-")),outputPath:t.outputPath??jt.default.join(t.projectRoot,`repacked${o}`),logger:Xd(t.logger),spawnAsync:t.spawnAsync??Yd(!!t.verbose)}}function Xd(t){return t!=null?Rs.isBunyanLikeLogger(t)?new Rs(t):t:new Ye}var Ye=class{debug(...o){console.debug(...o)}info(...o){console.log(...o)}warn(...o){console.warn(...o)}error(...o){console.error(...o)}time(o){console.time(o)}timeEnd(o){console.timeEnd(o)}},Rs=class{constructor(o){this.logger=o}timerMap={};static isBunyanLikeLogger(o){return o.info&&o.time===void 0}debug(...o){this.logger.debug(o.join(""))}info(...o){this.logger.info(o.join(""))}warn(...o){this.logger.warn(o.join(""))}error(...o){this.logger.error(o.join(""))}time(o){this.timerMap[o]=Date.now()}timeEnd(o){if(this.timerMap[o]==null){this.logger.warn(`Timer '${o}' does not exist`);return}let e=Date.now()-this.timerMap[o];this.logger.info(`${o}: ${e} ms`),delete this.timerMap[o]}};function Yd(t){return function(e,s,i){return(0,ku.default)(e,s,{stdio:t?"inherit":"pipe",...i})}}async function Rt(t,o){await bt.default.mkdir(o,{recursive:!0});let e=await bt.default.readdir(t,{withFileTypes:!0});for(let s of e){let i=jt.default.join(t,s.name),r=jt.default.join(o,s.name);s.isDirectory()?await Rt(i,r):s.isFile()&&await bt.default.copyFile(i,r)}}async function vu({config:t,decodedApkRoot:o}){let e=bu.default.join(o,"res","values","strings.xml"),s=await Pe.default.readFile(e,"utf8");s=s.replace(/(<string name="app_name">)(.+)(<\/string>)/,`$1${t.name}$3`),await Pe.default.writeFile(e,s)}async function Wu({config:t,androidManiestXml:o,dexClasses:e,originalAppIdSet:s,updatesRuntimeVersion:i}){let r=Ie(t.android?.package),n=o.manifest.$.package!==r;Ar(o,m=>{for(let w of s)if(m.startsWith(w)&&!e.has(m))return m.replace(new RegExp(`^${w}`),r);return m});let a=Ur("manifest",o.manifest,(m,w)=>m==="intent-filter"&&Ur(m,w,(f,k)=>f==="action"&&k[0].$?.["android:name"]==="android.intent.action.VIEW").length>0),c=Array.isArray(t.scheme)?t.scheme[0]:t.scheme;for(let m of a)Ar(m,w=>{let f=w;for(let k of s)f=f.replace(new RegExp(`^${k}`),r);return f=f.replace(/^exp\+.+$/g,`exp+${Ie(t.slug)}`),c&&(f=f.replace(/^myapp$/g,c)),f});let u=o.manifest.application[0];(0,Jt.default)(u.$?.["android:name"]?.endsWith(".MainApplication"),"Expected application node to be named as MainApplication"),Id(u,t,i),o.manifest.$.package=r;let d=t.android?.version||t.version||"1.0.0",x=Number(t.android?.versionCode??1);return o.manifest.$["android:versionName"]=d,o.manifest.$["android:versionCode"]=x,{isPackageNameChanged:n}}async function pu(t){let o=await Pe.default.readFile(t,"utf8");return await new Bs.Parser().parseStringPromise(o)}async function qu(t,o){let s=new Bs.Builder().buildObject(t);await Pe.default.writeFile(o,s)}function Cu(t){let o=t.manifest.$.package;return(0,Jt.default)(o!=null,"Expected package attribute to be present in AndroidManifest.xml"),o}function Nu(t,o){let e=t.manifest.application?.[0]?.$?.["android:name"];if(e){let s=e.replace(/\.[^.]+$/,"");if(s!==e&&s!==o)return s}return null}function Id(t,o,e){let s=t["meta-data"]??[],i=o.updates?.enabled??!0,r=s.find(u=>u.$?.["android:name"]==="expo.modules.updates.ENABLED");r!=null?((0,Jt.default)(r.$!=null),r.$["android:value"]=i?"true":"false"):s.push({$:{"android:name":"expo.modules.updates.ENABLED","android:value":i?"true":"false"}});let n=s.find(u=>u.$?.["android:name"]==="expo.modules.updates.EXPO_RUNTIME_VERSION");e!=null&&(n!=null?((0,Jt.default)(n.$!=null),n.$["android:value"]=e):s.push({$:{"android:name":"expo.modules.updates.EXPO_RUNTIME_VERSION","android:value":e}}));let a=s.find(u=>u.$?.["android:name"]==="expo.modules.updates.EXPO_UPDATE_URL"),c=o.updates?.url;c&&(a!=null?((0,Jt.default)(a.$!=null),a.$["android:value"]=c):s.push({$:{"android:name":"expo.modules.updates.EXPO_UPDATE_URL","android:value":c}}))}function Ur(t,o,e){return o==null?[]:e(t,o)?[o]:Object.keys(o).filter(s=>s!=="$"&&s!=="_").flatMap(s=>{let i=o[s];return Ur(s,i,e)})}function Ar(t,o){if(t==null)return;let e=t.$??{};for(let[s,i]of Object.entries(e))e[s]=o(i);for(let[s,i]of Object.entries(t))s==="$"||s==="_"||Ar(i,o)}var Su="./debug.keystore";var I_=P(Y_());function _i(t,o){let e=process.env;for(let[s,i]of Object.entries(o??{})){if(e[s]!==void 0)continue;let r;i==null?r="":typeof i=="string"?r=i:r=JSON.stringify(i),e[s]=r}sy("development"),(0,I_.loadProjectEnv)(t)}function sy(t){process.env.NODE_ENV=process.env.NODE_ENV||t,process.env.BABEL_ENV=process.env.BABEL_ENV||process.env.NODE_ENV,globalThis.__DEV__=process.env.NODE_ENV!=="production"}var mi=P(require("node:assert")),xi=P(require("node:fs/promises")),Yo=P(require("node:path")),re=P(T_());async function gi(t,o){let{workingDirectory:e}=t,s=Yo.default.join(e,"app.config");return await xi.default.writeFile(s,JSON.stringify(o)),s}async function Oi(t){let{platform:o,projectRoot:e,spawnAsync:s,workingDirectory:i}=t,{stdout:r}=await s("node",["-e","require('expo/scripts/resolveAppEntry')",e,o,"absolute"],{cwd:e,stdio:"pipe"}),n=re.default.silent(t.projectRoot,"expo-updates/utils/build/createUpdatesResources.js");return(0,mi.default)(n,"Failed to resolve `createUpdatesResources.js` within expo-updates package"),await s("node",[n,o,e,i,"all",r.trim()],{cwd:e}),Yo.default.join(i,"app.manifest")}function di(t){let o=U_(t);(0,mi.default)(o,"Failed to resolve '@expo/config' package in the project");let{getPackageJson:e}=require(o),s=e(t);return!!(s.dependencies&&"expo-updates"in s.dependencies)}async function wi(t,o){let{projectRoot:e,spawnAsync:s}=t,i=re.default.silent(e,"expo-updates/bin/cli")??(0,re.default)(e,"expo-updates/bin/cli.js"),{stdout:r}=await s(i,["runtimeversion:resolve","--platform","android","--workflow","managed"],{cwd:e,stdio:"pipe"});return JSON.parse(r).runtimeVersion??null}function U_(t){let o=re.default.silent(t,"expo/package.json");return o?re.default.silent(Yo.default.dirname(o),"@expo/config")??null:null}function yi(t,o){let e=U_(t);(0,mi.default)(e,"Failed to resolve '@expo/config' package in the project");let{getConfig:s}=require(e);return s(t,o)}async function hi(t,o){let{projectRoot:e,platform:s,spawnAsync:i,workingDirectory:r}=o,n=Yo.default.resolve(r,"bundles");await xi.default.mkdir(n,{recursive:!0});let a=Yo.default.join(n,"assets");await xi.default.mkdir(a,{recursive:!0});let{stdout:c}=await i("node",["-e","require('expo/scripts/resolveAppEntry')",e,s,"absolute"],{cwd:e,stdio:"pipe"}),u=ry(t,s),d=s==="android"?"index.android.bundle":"main.bundle",x=Yo.default.join(n,d),m=["expo","export:embed","--platform",s,"--entry-file",c.trim(),"--bundle-output",Yo.default.join(n,d),"--assets-dest",Yo.default.join(n,"assets"),"--dev","false","--reset-cache"];return u?(m.push("--minify","false"),m.push("--bytecode","true"),m.push("--unstable-transform-profile","hermes")):m.push("--minify","true"),o.exportEmbedOptions?.sourcemapOutput&&m.push("--sourcemap-output",o.exportEmbedOptions.sourcemapOutput),await i("npx",m,{cwd:e}),{bundleOutputPath:x,assetRoot:a}}async function fi({appWorkingDirectory:t,options:o}){if(o.exportEmbedOptions!=null)return!0;let e;return o.platform==="android"?e=Yo.default.join(t,"assets","index.android.bundle"):e=Yo.default.join(t,"main.jsbundle"),await Gu(e)}function ry(t,o){switch(o){case"android":return(t.android?.jsEngine??t.jsEngine)!=="jsc";case"ios":return(t.ios?.jsEngine??t.jsEngine)!=="jsc";default:return!1}}var ny=gt.default.resolve(__dirname,Su);async function Q_(t){let o=await Ze(t),{logger:e,workingDirectory:s}=o;await ne.default.mkdir(s,{recursive:!0}),_i(o.projectRoot,o.env);let{exp:i}=yi(o.projectRoot,{isPublicConfig:!0,skipSDKVersionRequirement:!0}),r=await Kc(gt.default.resolve(o.sourceAppPath),o);(0,dn.default)(i.android?.package,"Expected app ID (`android.package`) to be defined in app.json");let n=di(o.projectRoot),a=n?await wi(o,i):null;if(e.info(A_.default.dim(`Resolved runtime version: ${a}`)),await fi({appWorkingDirectory:r,options:o})){e.time("Generating bundle");let{assetRoot:O,bundleOutputPath:l}=await hi(i,o);if(e.timeEnd("Generating bundle"),e.time("Adding bundled resources"),await bc({decodedApkRoot:r,assetRoot:O,bundleOutputPath:l}),e.timeEnd("Adding bundled resources"),n){e.time("Generating 'app.manifest' for expo-updates");let g=await Oi(o),_=gt.default.join(r,"assets");await ne.default.copyFile(g,gt.default.join(_,gt.default.basename(g))),e.timeEnd("Generating 'app.manifest' for expo-updates")}}e.time("Updating AndroidManifest.xml");let u=gt.default.join(r,"AndroidManifest.xml"),d=await pu(u),x=Cu(d),m=new Set([x]),w=Nu(d,x);w!=null&&m.add(w);let f=new Set;for(let O of m){let l=await ql(r,O,o);for(let g of l)f.add(g)}(0,dn.default)(f!=null,"Failed to search for dex classes with appId in the APK");let{isPackageNameChanged:k}=await Wu({config:i,androidManiestXml:d,dexClasses:f,originalAppIdSet:m,options:o,updatesRuntimeVersion:a});k&&await vc(r,i.android?.package),await qu(d,u),e.timeEnd("Updating AndroidManifest.xml"),e.time("Updating resources"),await vu({config:i,decodedApkRoot:r}),e.timeEnd("Updating resources"),e.time("Generating app config");let W=await gi(o,i);await ne.default.copyFile(W,gt.default.join(r,"assets","app.config")),e.timeEnd("Generating app config"),e.time("Creating updated apk");let p=await Gc(r,o),q=await pl(p,o,{keyStorePath:o.androidSigningOptions?.keyStorePath??ny,keyStorePassword:o.androidSigningOptions?.keyStorePassword??"pass:android",keyAlias:o.androidSigningOptions?.keyAlias,keyPassword:o.androidSigningOptions?.keyPassword});if(e.timeEnd("Creating updated apk"),await ne.default.rename(q,o.outputPath),!o.skipWorkingDirCleanup)try{await ne.default.rm(s,{recursive:!0})}catch{}return o.outputPath}var Bi=P(require("node:assert")),ht=P(require("node:fs/promises")),Ro=P(require("node:path")),pg=P(Hi());var B_=P(require("node:assert")),ae=P(require("node:fs/promises")),mo=P(require("node:path"));var J_=P(j_());function zi(t){return R_(t)||R_((0,J_.default)(t))||"app"}function R_(t){return t.replace(/[\W_]+/g,"").normalize("NFD").replace(/[\u0300-\u036f]/g,"")}async function D_(t){let{spawnAsync:o,sourceAppPath:e}=t,s=mo.default.join(t.workingDirectory,"extracted");if(await ae.default.mkdir(s,{recursive:!0}),e.endsWith(".zip")||e.endsWith(".ipa"))await o("unzip",[e,"-d",s]);else if(e.endsWith(".tar.gz"))await o("tar",["-xzf",e,"-C",s]);else if(e.endsWith(".app")){let n=mo.default.basename(e);await Rt(e,mo.default.join(s,n))}else throw new Error("Unsupported file type. Please provide a .zip, .tar.gz, or .app file.");let r=(await Ut("{Payload/*.app,*.app}",{cwd:s,absolute:!0}))[0];return(0,B_.default)(r,`Failed to find the .app directory in the extracted artifact: ${s}`),r}async function $_({config:t,appWorkingDirectory:o,executableName:e}){let{dir:s,name:i}=mo.default.parse(o),r=zi(t.name),n=mo.default.join(s,`${r}.app`);return await ae.default.rename(mo.default.join(s,`${i}.app`),n),await ae.default.rename(mo.default.join(n,e),mo.default.join(n,r)),n}async function H_(t,o){let e=mo.default.resolve(t.workingDirectory,mo.default.basename(o));return await Rt(o,e),e}async function ox(t,o){let{spawnAsync:e,workingDirectory:s}=t;await ae.default.mkdir(mo.default.join(s,"Payload"),{recursive:!0}),await ae.default.rename(o,mo.default.join(s,"Payload",mo.default.basename(o)));let i=mo.default.resolve(s,"repacked.ipa");return await e("zip",["-r",i,"Payload"],{cwd:s}),i}function tx(t,o,e){let s=e.keychainPath?`keychain_path: "${e.keychainPath}",`:"",i;if(typeof e.provisioningProfile=="string")i=`provisioning_profile: "${e.provisioningProfile}",`;else if(typeof e.provisioningProfile=="object"&&!Array.isArray(e.provisioningProfile)){let n="";for(let[a,c]of Object.entries(e.provisioningProfile))n+=` "${a}" => "${c}",
35
35
  `;i=`provisioning_profile: {
36
36
  ${n}
37
37
  },`}else i="";return`lane :${t} do
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/repack-app",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "Repacking tool for Expo apps",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",