just-bash 2.5.4 → 2.5.5

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.
@@ -8,7 +8,7 @@ Gid: ${r} ${r} ${r} ${r}
8
8
  `}function qn(t){let e=t;return typeof e.mkdirSync=="function"&&typeof e.writeFileSync=="function"}function Zn(t,e){t.mkdirSync("/bin",{recursive:!0}),t.mkdirSync("/usr/bin",{recursive:!0}),e&&(t.mkdirSync("/home/user",{recursive:!0}),t.mkdirSync("/tmp",{recursive:!0}))}function Qn(t){t.mkdirSync("/dev",{recursive:!0}),t.writeFileSync("/dev/null",""),t.writeFileSync("/dev/zero",new Uint8Array(0)),t.writeFileSync("/dev/stdin",""),t.writeFileSync("/dev/stdout",""),t.writeFileSync("/dev/stderr","")}function Kn(t){t.mkdirSync("/proc/self/fd",{recursive:!0}),t.writeFileSync("/proc/version",`${xr}
9
9
  `),t.writeFileSync("/proc/self/exe","/bin/bash"),t.writeFileSync("/proc/self/cmdline","bash\0"),t.writeFileSync("/proc/self/comm",`bash
10
10
  `),t.writeFileSync("/proc/self/status",br()),t.writeFileSync("/proc/self/fd/0","/dev/stdin"),t.writeFileSync("/proc/self/fd/1","/dev/stdout"),t.writeFileSync("/proc/self/fd/2","/dev/stderr")}function Cr(t,e){qn(t)&&(Zn(t,e),Qn(t),Kn(t))}var Xn=["tar","yq","xan","sqlite3"];function $r(t){return Xn.includes(t)}function L(t,e){return{type:"ArithmeticExpression",expression:te(t,e,0).expr}}function te(t,e,n){return Yn(t,e,n)}function Yn(t,e,n){let{expr:r,pos:s}=je(t,e,n);for(s=D(e,s);e[s]===",";){s++;let{expr:o,pos:i}=je(t,e,s);r={type:"ArithBinary",operator:",",left:r,right:o},s=D(e,i)}return{expr:r,pos:s}}function je(t,e,n){let{expr:r,pos:s}=Jn(t,e,n);if(s=D(e,s),e[s]==="?"){s++;let{expr:o,pos:i}=te(t,e,s);if(s=D(e,i),e[s]===":"){s++;let{expr:a,pos:c}=te(t,e,s);return{expr:{type:"ArithTernary",condition:r,consequent:o,alternate:a},pos:c}}}return{expr:r,pos:s}}function Jn(t,e,n){let{expr:r,pos:s}=Nr(t,e,n);for(;s=D(e,s),e.slice(s,s+2)==="||";){s+=2;let{expr:o,pos:i}=Nr(t,e,s);r={type:"ArithBinary",operator:"||",left:r,right:o},s=i}return{expr:r,pos:s}}function Nr(t,e,n){let{expr:r,pos:s}=vr(t,e,n);for(;s=D(e,s),e.slice(s,s+2)==="&&";){s+=2;let{expr:o,pos:i}=vr(t,e,s);r={type:"ArithBinary",operator:"&&",left:r,right:o},s=i}return{expr:r,pos:s}}function vr(t,e,n){let{expr:r,pos:s}=Pr(t,e,n);for(;s=D(e,s),e[s]==="|"&&e[s+1]!=="|";){s++;let{expr:o,pos:i}=Pr(t,e,s);r={type:"ArithBinary",operator:"|",left:r,right:o},s=i}return{expr:r,pos:s}}function Pr(t,e,n){let{expr:r,pos:s}=Ir(t,e,n);for(;s=D(e,s),e[s]==="^";){s++;let{expr:o,pos:i}=Ir(t,e,s);r={type:"ArithBinary",operator:"^",left:r,right:o},s=i}return{expr:r,pos:s}}function Ir(t,e,n){let{expr:r,pos:s}=kr(t,e,n);for(;s=D(e,s),e[s]==="&"&&e[s+1]!=="&";){s++;let{expr:o,pos:i}=kr(t,e,s);r={type:"ArithBinary",operator:"&",left:r,right:o},s=i}return{expr:r,pos:s}}function kr(t,e,n){let{expr:r,pos:s}=Rr(t,e,n);for(;s=D(e,s),e.slice(s,s+2)==="=="||e.slice(s,s+2)==="!=";){let o=e.slice(s,s+2);s+=2;let{expr:i,pos:a}=Rr(t,e,s);r={type:"ArithBinary",operator:o,left:r,right:i},s=a}return{expr:r,pos:s}}function Rr(t,e,n){let{expr:r,pos:s}=At(t,e,n);for(;;)if(s=D(e,s),e.slice(s,s+2)==="<="||e.slice(s,s+2)===">="){let o=e.slice(s,s+2);s+=2;let{expr:i,pos:a}=At(t,e,s);r={type:"ArithBinary",operator:o,left:r,right:i},s=a}else if(e[s]==="<"||e[s]===">"){let o=e[s];s++;let{expr:i,pos:a}=At(t,e,s);r={type:"ArithBinary",operator:o,left:r,right:i},s=a}else break;return{expr:r,pos:s}}function At(t,e,n){let{expr:r,pos:s}=Dr(t,e,n);for(;s=D(e,s),e.slice(s,s+2)==="<<"||e.slice(s,s+2)===">>";){let o=e.slice(s,s+2);s+=2;let{expr:i,pos:a}=Dr(t,e,s);r={type:"ArithBinary",operator:o,left:r,right:i},s=a}return{expr:r,pos:s}}function Dr(t,e,n){let{expr:r,pos:s}=Or(t,e,n);for(;s=D(e,s),(e[s]==="+"||e[s]==="-")&&e[s+1]!==e[s];){let o=e[s];s++;let{expr:i,pos:a}=Or(t,e,s);r={type:"ArithBinary",operator:o,left:r,right:i},s=a}return{expr:r,pos:s}}function Or(t,e,n){let{expr:r,pos:s}=Ve(t,e,n);for(;;)if(s=D(e,s),e[s]==="*"&&e[s+1]!=="*"){s++;let{expr:o,pos:i}=Ve(t,e,s);r={type:"ArithBinary",operator:"*",left:r,right:o},s=i}else if(e[s]==="/"||e[s]==="%"){let o=e[s];s++;let{expr:i,pos:a}=Ve(t,e,s);r={type:"ArithBinary",operator:o,left:r,right:i},s=a}else break;return{expr:r,pos:s}}function Ve(t,e,n){let{expr:r,pos:s}=St(t,e,n),o=D(e,s);if(e.slice(o,o+2)==="**"){o+=2;let{expr:i,pos:a}=Ve(t,e,o);return{expr:{type:"ArithBinary",operator:"**",left:r,right:i},pos:a}}return{expr:r,pos:s}}function St(t,e,n){let r=D(e,n);if(e.slice(r,r+2)==="++"||e.slice(r,r+2)==="--"){let s=e.slice(r,r+2);r+=2;let{expr:o,pos:i}=St(t,e,r);return{expr:{type:"ArithUnary",operator:s,operand:o,prefix:!0},pos:i}}if(e[r]==="+"||e[r]==="-"||e[r]==="!"||e[r]==="~"){let s=e[r];r++;let{expr:o,pos:i}=St(t,e,r);return{expr:{type:"ArithUnary",operator:s,operand:o,prefix:!0},pos:i}}return ts(t,e,r)}function es(t,e){let n=t[e];return n==="$"||n==="`"}function ts(t,e,n){let{expr:r,pos:s}=_r(t,e,n),o=[r];for(;es(e,s);){let{expr:i,pos:a}=_r(t,e,s);o.push(i),s=a}if(o.length>1&&(r={type:"ArithConcat",parts:o}),s=D(e,s),e.slice(s,s+2)==="++"||e.slice(s,s+2)==="--"){let i=e.slice(s,s+2);return s+=2,{expr:{type:"ArithUnary",operator:i,operand:r,prefix:!1},pos:s}}return{expr:r,pos:s}}function _r(t,e,n){let r=D(e,n);if(e.slice(r,r+3)==="$(("){r+=3;let s=1,o=r;for(;r<e.length-1&&s>0;)e[r]==="("&&e[r+1]==="("?(s++,r+=2):e[r]===")"&&e[r+1]===")"?(s--,s>0&&(r+=2)):r++;let i=e.slice(o,r),{expr:a}=te(t,i,0);return r+=2,{expr:{type:"ArithNested",expression:a},pos:r}}if(e.slice(r,r+2)==="$("&&e[r+2]!=="("){r+=2;let s=1,o=r;for(;r<e.length&&s>0;)e[r]==="("?s++:e[r]===")"&&s--,s>0&&r++;let i=e.slice(o,r);return r++,{expr:{type:"ArithCommandSubst",command:i},pos:r}}if(e[r]==="`"){r++;let s=r;for(;r<e.length&&e[r]!=="`";)r++;let o=e.slice(s,r);return e[r]==="`"&&r++,{expr:{type:"ArithCommandSubst",command:o},pos:r}}if(e[r]==="("){r++;let{expr:s,pos:o}=te(t,e,r);return r=D(e,o),e[r]===")"&&r++,{expr:{type:"ArithGroup",expression:s},pos:r}}if(/[0-9]/.test(e[r])){let s="",o=!1;for(;r<e.length;){let a=e[r];if(o)if(/[0-9a-zA-Z@_]/.test(a))s+=a,r++;else break;else if(a==="#")o=!0,s+=a,r++;else if(/[0-9a-fA-FxX]/.test(a))s+=a,r++;else break}if(e[r]==="."&&/[0-9]/.test(e[r+1]))throw new F(`${s}.${e[r+1]}...: syntax error: invalid arithmetic operator`);if(e[r]==="["){let a=e.slice(r).trim();return{expr:{type:"ArithNumberSubscript",number:s,errorToken:a},pos:e.length}}return{expr:{type:"ArithNumber",value:xe(s)},pos:r}}if(e[r]==="$"&&e[r+1]==="{"){let s=r+2,o=1,i=s;for(;i<e.length&&o>0;)e[i]==="{"?o++:e[i]==="}"&&o--,o>0&&i++;let a=e.slice(s,i),c=i+1;if(e[c]==="#"){let l=c+1;for(;l<e.length&&/[0-9a-zA-Z@_]/.test(e[l]);)l++;let u=e.slice(c+1,l);return{expr:{type:"ArithDynamicBase",baseExpr:a,value:u},pos:l}}if(/[0-9]/.test(e[c])||e[c]==="x"||e[c]==="X"){let l=c;if(e[c]==="x"||e[c]==="X")for(l++;l<e.length&&/[0-9a-fA-F]/.test(e[l]);)l++;else for(;l<e.length&&/[0-9]/.test(e[l]);)l++;let u=e.slice(c,l);return{expr:{type:"ArithDynamicNumber",prefix:a,suffix:u},pos:l}}return r=c,{expr:{type:"ArithBracedExpansion",content:a},pos:r}}if(e[r]==="$"&&r+1<e.length&&/[0-9]/.test(e[r+1])){r++;let s="";for(;r<e.length&&/[0-9]/.test(e[r]);)s+=e[r],r++;return{expr:{type:"ArithVariable",name:s},pos:r}}if(e[r]==="$"&&r+1<e.length&&/[a-zA-Z_]/.test(e[r+1])&&r++,/[a-zA-Z_]/.test(e[r])){let s="";for(;r<e.length&&/[a-zA-Z0-9_]/.test(e[r]);)s+=e[r],r++;if(e[r]==="["){r++;let i;if(e[r]==="'"||e[r]==='"'){let l=e[r];for(r++,i="";r<e.length&&e[r]!==l;)i+=e[r],r++;e[r]===l&&r++,r=D(e,r),e[r]==="]"&&r++}let a;if(i===void 0){let{expr:l,pos:u}=te(t,e,r);a=l,r=u,e[r]==="]"&&r++}if(r=D(e,r),e[r]==="["&&a)return{expr:{type:"ArithDoubleSubscript",array:s,index:a},pos:r};let c=["=","+=","-=","*=","/=","%=","<<=",">>=","&=","|=","^="];for(let l of c)if(e.slice(r,r+l.length)===l&&e.slice(r,r+l.length+1)!=="=="){r+=l.length;let{expr:u,pos:d}=je(t,e,r);return{expr:{type:"ArithAssignment",operator:l,variable:s,subscript:a,stringKey:i,value:u},pos:d}}return{expr:{type:"ArithArrayElement",array:s,index:a,stringKey:i},pos:r}}r=D(e,r);let o=["=","+=","-=","*=","/=","%=","<<=",">>=","&=","|=","^="];for(let i of o)if(e.slice(r,r+i.length)===i&&e.slice(r,r+i.length+1)!=="=="){r+=i.length;let{expr:a,pos:c}=je(t,e,r);return{expr:{type:"ArithAssignment",operator:i,variable:s,value:a},pos:c}}return{expr:{type:"ArithVariable",name:s},pos:r}}return{expr:{type:"ArithNumber",value:0},pos:r}}function xe(t){if(t.includes("#")){let[e,n]=t.split("#"),r=Number.parseInt(e,10);if(r<2||r>64)return Number.NaN;if(r<=36)return Number.parseInt(n,r);let s=0;for(let o of n){let i;if(o>="0"&&o<="9")i=o.charCodeAt(0)-48;else if(o>="a"&&o<="z")i=o.charCodeAt(0)-97+10;else if(o>="A"&&o<="Z")i=o.charCodeAt(0)-65+36;else if(o==="@")i=62;else if(o==="_")i=63;else return Number.NaN;if(i>=r)return Number.NaN;s=s*r+i}return s}return t.startsWith("0x")||t.startsWith("0X")?Number.parseInt(t.slice(2),16):t.startsWith("0")&&t.length>1&&/^[0-9]+$/.test(t)?/[89]/.test(t)?Number.NaN:Number.parseInt(t,8):Number.parseInt(t,10)}function D(t,e){for(;e<t.length;){if(t[e]==="\\"&&t[e+1]===`
11
- `){e+=2;continue}if(/\s/.test(t[e])){e++;continue}break}return e}var A={script(t){return{type:"Script",statements:t}},statement(t,e=[],n=!1){return{type:"Statement",pipelines:t,operators:e,background:n}},pipeline(t,e=!1){return{type:"Pipeline",commands:t,negated:e}},simpleCommand(t,e=[],n=[],r=[]){return{type:"SimpleCommand",name:t,args:e,assignments:n,redirections:r}},word(t){return{type:"Word",parts:t}},literal(t){return{type:"Literal",value:t}},singleQuoted(t){return{type:"SingleQuoted",value:t}},doubleQuoted(t){return{type:"DoubleQuoted",parts:t}},escaped(t){return{type:"Escaped",value:t}},parameterExpansion(t,e=null){return{type:"ParameterExpansion",parameter:t,operation:e}},commandSubstitution(t,e=!1){return{type:"CommandSubstitution",body:t,legacy:e}},arithmeticExpansion(t){return{type:"ArithmeticExpansion",expression:t}},assignment(t,e,n=!1,r=null){return{type:"Assignment",name:t,value:e,append:n,array:r}},redirection(t,e,n=null){return{type:"Redirection",fd:n,operator:t,target:e}},hereDoc(t,e,n=!1,r=!1){return{type:"HereDoc",delimiter:t,content:e,stripTabs:n,quoted:r}},ifNode(t,e=null,n=[]){return{type:"If",clauses:t,elseBody:e,redirections:n}},forNode(t,e,n,r=[]){return{type:"For",variable:t,words:e,body:n,redirections:r}},whileNode(t,e,n=[]){return{type:"While",condition:t,body:e,redirections:n}},untilNode(t,e,n=[]){return{type:"Until",condition:t,body:e,redirections:n}},caseNode(t,e,n=[]){return{type:"Case",word:t,items:e,redirections:n}},caseItem(t,e,n=";;"){return{type:"CaseItem",patterns:t,body:e,terminator:n}},subshell(t,e=[]){return{type:"Subshell",body:t,redirections:e}},group(t,e=[]){return{type:"Group",body:t,redirections:e}},functionDef(t,e,n=[]){return{type:"FunctionDef",name:t,body:e,redirections:n}},conditionalCommand(t,e=[]){return{type:"ConditionalCommand",expression:t,redirections:e}},arithmeticCommand(t,e=[]){return{type:"ArithmeticCommand",expression:t,redirections:e}}};var f;(function(t){t.EOF="EOF",t.NEWLINE="NEWLINE",t.SEMICOLON="SEMICOLON",t.AMP="AMP",t.PIPE="PIPE",t.PIPE_AMP="PIPE_AMP",t.AND_AND="AND_AND",t.OR_OR="OR_OR",t.BANG="BANG",t.LESS="LESS",t.GREAT="GREAT",t.DLESS="DLESS",t.DGREAT="DGREAT",t.LESSAND="LESSAND",t.GREATAND="GREATAND",t.LESSGREAT="LESSGREAT",t.DLESSDASH="DLESSDASH",t.CLOBBER="CLOBBER",t.TLESS="TLESS",t.AND_GREAT="AND_GREAT",t.AND_DGREAT="AND_DGREAT",t.LPAREN="LPAREN",t.RPAREN="RPAREN",t.LBRACE="LBRACE",t.RBRACE="RBRACE",t.DSEMI="DSEMI",t.SEMI_AND="SEMI_AND",t.SEMI_SEMI_AND="SEMI_SEMI_AND",t.DBRACK_START="DBRACK_START",t.DBRACK_END="DBRACK_END",t.DPAREN_START="DPAREN_START",t.DPAREN_END="DPAREN_END",t.IF="IF",t.THEN="THEN",t.ELSE="ELSE",t.ELIF="ELIF",t.FI="FI",t.FOR="FOR",t.WHILE="WHILE",t.UNTIL="UNTIL",t.DO="DO",t.DONE="DONE",t.CASE="CASE",t.ESAC="ESAC",t.IN="IN",t.FUNCTION="FUNCTION",t.SELECT="SELECT",t.TIME="TIME",t.COPROC="COPROC",t.WORD="WORD",t.NAME="NAME",t.NUMBER="NUMBER",t.ASSIGNMENT_WORD="ASSIGNMENT_WORD",t.COMMENT="COMMENT",t.HEREDOC_CONTENT="HEREDOC_CONTENT"})(f||(f={}));var qe={if:f.IF,then:f.THEN,else:f.ELSE,elif:f.ELIF,fi:f.FI,for:f.FOR,while:f.WHILE,until:f.UNTIL,do:f.DO,done:f.DONE,case:f.CASE,esac:f.ESAC,in:f.IN,function:f.FUNCTION,select:f.SELECT,time:f.TIME,coproc:f.COPROC};function Tr(t){let e=t.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!e)return!1;let n=t.slice(e[0].length);if(n===""||n==="+")return!0;if(n[0]==="["){let r=0,s=0;for(;s<n.length;s++)if(n[s]==="[")r++;else if(n[s]==="]"&&(r--,r===0))break;if(r!==0||s>=n.length)return!1;let o=n.slice(s+1);return o===""||o==="+"}return!1}var rs=[[";",";","&",f.SEMI_SEMI_AND],["<","<","<",f.TLESS],["&",">",">",f.AND_DGREAT]],ns=[["[","[",f.DBRACK_START],["]","]",f.DBRACK_END],["(","(",f.DPAREN_START],[")",")",f.DPAREN_END],["&","&",f.AND_AND],["|","|",f.OR_OR],[";",";",f.DSEMI],[";","&",f.SEMI_AND],["|","&",f.PIPE_AMP],[">",">",f.DGREAT],["<","&",f.LESSAND],[">","&",f.GREATAND],["<",">",f.LESSGREAT],[">","|",f.CLOBBER],["&",">",f.AND_GREAT]],ss={"|":f.PIPE,"&":f.AMP,";":f.SEMICOLON,"(":f.LPAREN,")":f.RPAREN,"<":f.LESS,">":f.GREAT};function is(t){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)}var Ze=class{input;pos=0;line=1;column=1;tokens=[];pendingHeredocs=[];constructor(e){this.input=e}tokenize(){let n=this.input.length,r=this.tokens,s=this.pendingHeredocs;for(;this.pos<n&&(this.skipWhitespace(),!(this.pos>=n));){if(s.length>0&&r.length>0&&r[r.length-1].type===f.NEWLINE){this.readHeredocContent();continue}let o=this.nextToken();o&&r.push(o)}return r.push({type:f.EOF,value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),r}skipWhitespace(){let e=this.input,n=e.length,r=this.pos,s=this.column,o=this.line;for(;r<n;){let i=e[r];if(i===" "||i===" ")r++,s++;else if(i==="\\"&&e[r+1]===`
11
+ `){e+=2;continue}if(/\s/.test(t[e])){e++;continue}break}return e}var A={script(t){return{type:"Script",statements:t}},statement(t,e=[],n=!1){return{type:"Statement",pipelines:t,operators:e,background:n}},pipeline(t,e=!1){return{type:"Pipeline",commands:t,negated:e}},simpleCommand(t,e=[],n=[],r=[]){return{type:"SimpleCommand",name:t,args:e,assignments:n,redirections:r}},word(t){return{type:"Word",parts:t}},literal(t){return{type:"Literal",value:t}},singleQuoted(t){return{type:"SingleQuoted",value:t}},doubleQuoted(t){return{type:"DoubleQuoted",parts:t}},escaped(t){return{type:"Escaped",value:t}},parameterExpansion(t,e=null){return{type:"ParameterExpansion",parameter:t,operation:e}},commandSubstitution(t,e=!1){return{type:"CommandSubstitution",body:t,legacy:e}},arithmeticExpansion(t){return{type:"ArithmeticExpansion",expression:t}},assignment(t,e,n=!1,r=null){return{type:"Assignment",name:t,value:e,append:n,array:r}},redirection(t,e,n=null){return{type:"Redirection",fd:n,operator:t,target:e}},hereDoc(t,e,n=!1,r=!1){return{type:"HereDoc",delimiter:t,content:e,stripTabs:n,quoted:r}},ifNode(t,e=null,n=[]){return{type:"If",clauses:t,elseBody:e,redirections:n}},forNode(t,e,n,r=[]){return{type:"For",variable:t,words:e,body:n,redirections:r}},whileNode(t,e,n=[]){return{type:"While",condition:t,body:e,redirections:n}},untilNode(t,e,n=[]){return{type:"Until",condition:t,body:e,redirections:n}},caseNode(t,e,n=[]){return{type:"Case",word:t,items:e,redirections:n}},caseItem(t,e,n=";;"){return{type:"CaseItem",patterns:t,body:e,terminator:n}},subshell(t,e=[]){return{type:"Subshell",body:t,redirections:e}},group(t,e=[]){return{type:"Group",body:t,redirections:e}},functionDef(t,e,n=[]){return{type:"FunctionDef",name:t,body:e,redirections:n}},conditionalCommand(t,e=[]){return{type:"ConditionalCommand",expression:t,redirections:e}},arithmeticCommand(t,e=[]){return{type:"ArithmeticCommand",expression:t,redirections:e}}};var f;(function(t){t.EOF="EOF",t.NEWLINE="NEWLINE",t.SEMICOLON="SEMICOLON",t.AMP="AMP",t.PIPE="PIPE",t.PIPE_AMP="PIPE_AMP",t.AND_AND="AND_AND",t.OR_OR="OR_OR",t.BANG="BANG",t.LESS="LESS",t.GREAT="GREAT",t.DLESS="DLESS",t.DGREAT="DGREAT",t.LESSAND="LESSAND",t.GREATAND="GREATAND",t.LESSGREAT="LESSGREAT",t.DLESSDASH="DLESSDASH",t.CLOBBER="CLOBBER",t.TLESS="TLESS",t.AND_GREAT="AND_GREAT",t.AND_DGREAT="AND_DGREAT",t.LPAREN="LPAREN",t.RPAREN="RPAREN",t.LBRACE="LBRACE",t.RBRACE="RBRACE",t.DSEMI="DSEMI",t.SEMI_AND="SEMI_AND",t.SEMI_SEMI_AND="SEMI_SEMI_AND",t.DBRACK_START="DBRACK_START",t.DBRACK_END="DBRACK_END",t.DPAREN_START="DPAREN_START",t.DPAREN_END="DPAREN_END",t.IF="IF",t.THEN="THEN",t.ELSE="ELSE",t.ELIF="ELIF",t.FI="FI",t.FOR="FOR",t.WHILE="WHILE",t.UNTIL="UNTIL",t.DO="DO",t.DONE="DONE",t.CASE="CASE",t.ESAC="ESAC",t.IN="IN",t.FUNCTION="FUNCTION",t.SELECT="SELECT",t.TIME="TIME",t.COPROC="COPROC",t.WORD="WORD",t.NAME="NAME",t.NUMBER="NUMBER",t.ASSIGNMENT_WORD="ASSIGNMENT_WORD",t.COMMENT="COMMENT",t.HEREDOC_CONTENT="HEREDOC_CONTENT"})(f||(f={}));var qe={if:f.IF,then:f.THEN,else:f.ELSE,elif:f.ELIF,fi:f.FI,for:f.FOR,while:f.WHILE,until:f.UNTIL,do:f.DO,done:f.DONE,case:f.CASE,esac:f.ESAC,in:f.IN,function:f.FUNCTION,select:f.SELECT,time:f.TIME,coproc:f.COPROC};function Tr(t){let e=t.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!e)return!1;let n=t.slice(e[0].length);if(n===""||n==="+")return!0;if(n[0]==="["){let r=0,s=0;for(;s<n.length;s++)if(n[s]==="[")r++;else if(n[s]==="]"&&(r--,r===0))break;if(r!==0||s>=n.length)return!1;let o=n.slice(s+1);return o===""||o==="+"}return!1}var rs=[[";",";","&",f.SEMI_SEMI_AND],["<","<","<",f.TLESS],["&",">",">",f.AND_DGREAT]],ns=[["[","[",f.DBRACK_START],["]","]",f.DBRACK_END],["(","(",f.DPAREN_START],[")",")",f.DPAREN_END],["&","&",f.AND_AND],["|","|",f.OR_OR],[";",";",f.DSEMI],[";","&",f.SEMI_AND],["|","&",f.PIPE_AMP],[">",">",f.DGREAT],["<","&",f.LESSAND],[">","&",f.GREATAND],["<",">",f.LESSGREAT],[">","|",f.CLOBBER],["&",">",f.AND_GREAT]],ss={"|":f.PIPE,"&":f.AMP,";":f.SEMICOLON,"(":f.LPAREN,")":f.RPAREN,"<":f.LESS,">":f.GREAT};function is(t){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)}var Ze=class{input;pos=0;line=1;column=1;tokens=[];pendingHeredocs=[];constructor(e){this.input=e}tokenize(){let n=this.input.length,r=this.tokens,s=this.pendingHeredocs;for(;this.pos<n;){if(s.length>0&&r.length>0&&r[r.length-1].type===f.NEWLINE){this.readHeredocContent();continue}if(this.skipWhitespace(),this.pos>=n)break;let o=this.nextToken();o&&r.push(o)}return r.push({type:f.EOF,value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),r}skipWhitespace(){let e=this.input,n=e.length,r=this.pos,s=this.column,o=this.line;for(;r<n;){let i=e[r];if(i===" "||i===" ")r++,s++;else if(i==="\\"&&e[r+1]===`
12
12
  `)r+=2,o++,s=1;else break}this.pos=r,this.column=s,this.line=o}nextToken(){let e=this.input,n=this.pos,r=this.line,s=this.column,o=e[n],i=e[n+1],a=e[n+2];if(o==="#")return this.readComment(n,r,s);if(o===`
13
13
  `)return this.pos=n+1,this.line++,this.column=1,{type:f.NEWLINE,value:`
14
14
  `,start:n,end:n+1,line:r,column:s};if(o==="<"&&i==="<"&&a==="-")return this.pos=n+3,this.column=s+3,this.registerHeredocFromLookahead(!0),this.makeToken(f.DLESSDASH,"<<-",n,r,s);for(let[l,u,d,h]of rs)if(o===l&&i===u&&a===d)return this.pos=n+3,this.column=s+3,this.makeToken(h,l+u+d,n,r,s);if(o==="<"&&i==="<")return this.pos=n+2,this.column=s+2,this.registerHeredocFromLookahead(!1),this.makeToken(f.DLESS,"<<",n,r,s);for(let[l,u,d]of ns)if(o===l&&i===u)return this.pos=n+2,this.column=s+2,this.makeToken(d,l+u,n,r,s);let c=ss[o];return c?(this.pos=n+1,this.column=s+1,this.makeToken(c,o,n,r,s)):o==="{"?i==="}"?(this.pos=n+2,this.column=s+2,{type:f.WORD,value:"{}",start:n,end:n+2,line:r,column:s,quoted:!1,singleQuoted:!1}):this.scanBraceExpansion(n)!==null?this.readWordWithBraceExpansion(n,r,s):this.scanLiteralBraceWord(n)!==null?this.readWordWithBraceExpansion(n,r,s):i!==void 0&&i!==" "&&i!==" "&&i!==`
@@ -146,11 +146,11 @@ ${rt}`):(nr(t,e.slice(n)),$)}return $}function nr(t,e){let n=1;for(;t.state.env[
146
146
  `,OSTYPE:"linux-gnu",MACHTYPE:"x86_64-pc-linux-gnu",HOSTTYPE:"x86_64",PWD:r,OLDPWD:r,...e.env};if(this.limits=Fn({...e.executionLimits,...e.maxCallDepth!==void 0&&{maxCallDepth:e.maxCallDepth},...e.maxCommandCount!==void 0&&{maxCommandCount:e.maxCommandCount},...e.maxLoopIterations!==void 0&&{maxLoopIterations:e.maxLoopIterations}}),e.network&&(this.secureFetch=hr(e.network)),this.sleepFn=e.sleep,this.traceFn=e.trace,this.logger=e.logger,this.state={env:s,cwd:r,previousDir:"/home/user",functions:new Map,localScopes:[],callDepth:0,sourceDepth:0,commandCount:0,lastExitCode:0,lastArg:"",startTime:Date.now(),lastBackgroundPid:0,currentLine:1,options:{errexit:!1,pipefail:!1,nounset:!1,xtrace:!1,verbose:!1},inCondition:!1,loopDepth:0},Cr(n,this.useDefaultLayout),r!=="/"&&n instanceof ke)try{n.mkdirSync(r,{recursive:!0})}catch{}for(let o of wr(e.commands))this.registerCommand(o);if(e.network)for(let o of Er())this.registerCommand(o);if(e.customCommands)for(let o of e.customCommands)gr(o)?this.registerCommand(Ar(o)):this.registerCommand(o)}registerCommand(e){this.commands.set(e.name,e);let n=this.fs;if(typeof n.writeFileSync=="function")try{n.writeFileSync(`/bin/${e.name}`,`#!/bin/bash
147
147
  # Built-in command: ${e.name}
148
148
  `)}catch{}}logResult(e){return this.logger&&(e.stdout&&this.logger.debug("stdout",{output:e.stdout}),e.stderr&&this.logger.info("stderr",{output:e.stderr}),this.logger.info("exit",{exitCode:e.exitCode})),e}async exec(e,n){if(this.state.callDepth===0&&(this.state.commandCount=0),this.state.commandCount++,this.state.commandCount>this.limits.maxCommandCount)return{stdout:"",stderr:`bash: maximum command count (${this.limits.maxCommandCount}) exceeded (possible infinite loop). Increase with executionLimits.maxCommandCount option.
149
- `,exitCode:1,env:{...this.state.env,...n?.env}};if(!e.trim())return{stdout:"",stderr:"",exitCode:0,env:{...this.state.env,...n?.env}};this.logger?.info("exec",{command:e});let r=n?.cwd??this.state.cwd,s={...this.state,env:{...this.state.env,...n?.env,...n?.cwd?{PWD:n.cwd}:{}},cwd:r,functions:new Map(this.state.functions),localScopes:[...this.state.localScopes],options:{...this.state.options}},o=e;n?.rawScript||(o=e.split(`
150
- `).map(a=>a.trimStart()).join(`
151
- `));try{let i=le(o),a={fs:this.fs,commands:this.commands,limits:this.limits,exec:this.exec.bind(this),fetch:this.secureFetch,sleep:this.sleepFn,trace:this.traceFn},l=await new Fe(a,s).executeScript(i);return this.logResult(l)}catch(i){if(i instanceof k)return this.logResult({stdout:i.stdout,stderr:i.stderr,exitCode:i.exitCode,env:{...this.state.env,...n?.env}});if(i instanceof F)return this.logResult({stdout:i.stdout,stderr:i.stderr,exitCode:1,env:{...this.state.env,...n?.env}});if(i instanceof z)return this.logResult({stdout:i.stdout,stderr:i.stderr,exitCode:z.EXIT_CODE,env:{...this.state.env,...n?.env}});if(i.name==="ParseException")return this.logResult({stdout:"",stderr:`bash: syntax error: ${i.message}
149
+ `,exitCode:1,env:{...this.state.env,...n?.env}};if(!e.trim())return{stdout:"",stderr:"",exitCode:0,env:{...this.state.env,...n?.env}};this.logger?.info("exec",{command:e});let r=n?.cwd??this.state.cwd,s={...this.state,env:{...this.state.env,...n?.env,...n?.cwd?{PWD:n.cwd}:{}},cwd:r,functions:new Map(this.state.functions),localScopes:[...this.state.localScopes],options:{...this.state.options}},o=e;n?.rawScript||(o=ii(e));try{let i=le(o),a={fs:this.fs,commands:this.commands,limits:this.limits,exec:this.exec.bind(this),fetch:this.secureFetch,sleep:this.sleepFn,trace:this.traceFn},l=await new Fe(a,s).executeScript(i);return this.logResult(l)}catch(i){if(i instanceof k)return this.logResult({stdout:i.stdout,stderr:i.stderr,exitCode:i.exitCode,env:{...this.state.env,...n?.env}});if(i instanceof F)return this.logResult({stdout:i.stdout,stderr:i.stderr,exitCode:1,env:{...this.state.env,...n?.env}});if(i instanceof z)return this.logResult({stdout:i.stdout,stderr:i.stderr,exitCode:z.EXIT_CODE,env:{...this.state.env,...n?.env}});if(i.name==="ParseException")return this.logResult({stdout:"",stderr:`bash: syntax error: ${i.message}
152
150
  `,exitCode:2,env:{...this.state.env,...n?.env}});if(i instanceof RangeError)return this.logResult({stdout:"",stderr:`bash: ${i.message}
153
- `,exitCode:1,env:{...this.state.env,...n?.env}});throw i}}async readFile(e){return this.fs.readFile(this.fs.resolvePath(this.state.cwd,e))}async writeFile(e,n){return this.fs.writeFile(this.fs.resolvePath(this.state.cwd,e),n)}getCwd(){return this.state.cwd}getEnv(){return{...this.state.env}}};import*as M from"node:fs";import*as Ie from"node:path";var ii="/home/user/project",gt=class{root;mountPoint;readOnly;memory=new Map;deleted=new Set;constructor(e){this.root=Ie.resolve(e.root);let n=e.mountPoint??ii;if(this.mountPoint=n==="/"?"/":n.replace(/\/+$/,""),!this.mountPoint.startsWith("/"))throw new Error(`Mount point must be an absolute path: ${n}`);if(this.readOnly=e.readOnly??!1,!M.existsSync(this.root))throw new Error(`OverlayFs root does not exist: ${this.root}`);if(!M.statSync(this.root).isDirectory())throw new Error(`OverlayFs root is not a directory: ${this.root}`);this.createMountPointDirs()}assertWritable(e){if(this.readOnly)throw new Error(`EROFS: read-only file system, ${e}`)}createMountPointDirs(){let e=this.mountPoint.split("/").filter(Boolean),n="";for(let r of e)n+=`/${r}`,this.memory.has(n)||this.memory.set(n,{type:"directory",mode:493,mtime:new Date});this.memory.has("/")||this.memory.set("/",{type:"directory",mode:493,mtime:new Date})}getMountPoint(){return this.mountPoint}mkdirSync(e,n){let s=this.normalizePath(e).split("/").filter(Boolean),o="";for(let i of s)o+=`/${i}`,this.memory.has(o)||this.memory.set(o,{type:"directory",mode:493,mtime:new Date})}writeFileSync(e,n){let r=this.normalizePath(e),s=this.getDirname(r);s!=="/"&&this.mkdirSync(s);let o=n instanceof Uint8Array?n:new TextEncoder().encode(n);this.memory.set(r,{type:"file",content:o,mode:420,mtime:new Date})}getDirname(e){let n=e.lastIndexOf("/");return n===0?"/":e.slice(0,n)}normalizePath(e){if(!e||e==="/")return"/";let n=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;n.startsWith("/")||(n=`/${n}`);let r=n.split("/").filter(o=>o&&o!=="."),s=[];for(let o of r)o===".."?s.pop():s.push(o);return`/${s.join("/")}`||"/"}getRelativeToMount(e){return this.mountPoint==="/"?e:e===this.mountPoint?"/":e.startsWith(`${this.mountPoint}/`)?e.slice(this.mountPoint.length):null}toRealPath(e){let n=this.normalizePath(e),r=this.getRelativeToMount(n);if(r===null)return null;let s=Ie.join(this.root,r),o=Ie.resolve(s);return!o.startsWith(this.root)&&o!==this.root.replace(/\/$/,"")?null:o}dirname(e){let n=this.normalizePath(e);if(n==="/")return"/";let r=n.lastIndexOf("/");return r===0?"/":n.slice(0,r)}ensureParentDirs(e){let n=this.dirname(e);n!=="/"&&(this.memory.has(n)||(this.ensureParentDirs(n),this.memory.set(n,{type:"directory",mode:493,mtime:new Date})),this.deleted.delete(n))}async existsInOverlay(e){let n=this.normalizePath(e);if(this.deleted.has(n))return!1;if(this.memory.has(n))return!0;let r=this.toRealPath(n);if(!r)return!1;try{return await M.promises.access(r),!0}catch{return!1}}async readFile(e,n){let r=await this.readFileBuffer(e),s=ae(n);return Ge(r,s)}async readFileBuffer(e,n=new Set){let r=this.normalizePath(e);if(n.has(r))throw new Error(`ELOOP: too many levels of symbolic links, open '${e}'`);if(n.add(r),this.deleted.has(r))throw new Error(`ENOENT: no such file or directory, open '${e}'`);let s=this.memory.get(r);if(s){if(s.type==="symlink"){let i=this.resolveSymlink(r,s.target);return this.readFileBuffer(i,n)}if(s.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${e}'`);return s.content}let o=this.toRealPath(r);if(!o)throw new Error(`ENOENT: no such file or directory, open '${e}'`);try{let i=await M.promises.lstat(o);if(i.isSymbolicLink()){let c=await M.promises.readlink(o),l=this.resolveSymlink(r,c);return this.readFileBuffer(l,n)}if(i.isDirectory())throw new Error(`EISDIR: illegal operation on a directory, read '${e}'`);let a=await M.promises.readFile(o);return new Uint8Array(a)}catch(i){throw i.code==="ENOENT"?new Error(`ENOENT: no such file or directory, open '${e}'`):i}}async writeFile(e,n,r){this.assertWritable(`write '${e}'`);let s=this.normalizePath(e);this.ensureParentDirs(s);let o=ae(r),i=Se(n,o);this.memory.set(s,{type:"file",content:i,mode:420,mtime:new Date}),this.deleted.delete(s)}async appendFile(e,n,r){this.assertWritable(`append '${e}'`);let s=this.normalizePath(e),o=ae(r),i=Se(n,o),a;try{a=await this.readFileBuffer(s)}catch{a=new Uint8Array(0)}let c=new Uint8Array(a.length+i.length);c.set(a),c.set(i,a.length),this.ensureParentDirs(s),this.memory.set(s,{type:"file",content:c,mode:420,mtime:new Date}),this.deleted.delete(s)}async exists(e){return this.existsInOverlay(e)}async stat(e,n=new Set){let r=this.normalizePath(e);if(n.has(r))throw new Error(`ELOOP: too many levels of symbolic links, stat '${e}'`);if(n.add(r),this.deleted.has(r))throw new Error(`ENOENT: no such file or directory, stat '${e}'`);let s=this.memory.get(r);if(s){if(s.type==="symlink"){let a=this.resolveSymlink(r,s.target);return this.stat(a,n)}let i=0;return s.type==="file"&&(i=s.content.length),{isFile:s.type==="file",isDirectory:s.type==="directory",isSymbolicLink:!1,mode:s.mode,size:i,mtime:s.mtime}}let o=this.toRealPath(r);if(!o)throw new Error(`ENOENT: no such file or directory, stat '${e}'`);try{let i=await M.promises.stat(o);return{isFile:i.isFile(),isDirectory:i.isDirectory(),isSymbolicLink:!1,mode:i.mode,size:i.size,mtime:i.mtime}}catch(i){throw i.code==="ENOENT"?new Error(`ENOENT: no such file or directory, stat '${e}'`):i}}async lstat(e){let n=this.normalizePath(e);if(this.deleted.has(n))throw new Error(`ENOENT: no such file or directory, lstat '${e}'`);let r=this.memory.get(n);if(r){if(r.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:r.mode,size:r.target.length,mtime:r.mtime};let o=0;return r.type==="file"&&(o=r.content.length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:o,mtime:r.mtime}}let s=this.toRealPath(n);if(!s)throw new Error(`ENOENT: no such file or directory, lstat '${e}'`);try{let o=await M.promises.lstat(s);return{isFile:o.isFile(),isDirectory:o.isDirectory(),isSymbolicLink:o.isSymbolicLink(),mode:o.mode,size:o.size,mtime:o.mtime}}catch(o){throw o.code==="ENOENT"?new Error(`ENOENT: no such file or directory, lstat '${e}'`):o}}resolveSymlink(e,n){if(n.startsWith("/"))return this.normalizePath(n);let r=this.dirname(e);return this.normalizePath(r==="/"?`/${n}`:`${r}/${n}`)}async mkdir(e,n){this.assertWritable(`mkdir '${e}'`);let r=this.normalizePath(e);if(await this.existsInOverlay(r)){if(!n?.recursive)throw new Error(`EEXIST: file already exists, mkdir '${e}'`);return}let o=this.dirname(r);if(o!=="/"&&!await this.existsInOverlay(o))if(n?.recursive)await this.mkdir(o,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${e}'`);this.memory.set(r,{type:"directory",mode:493,mtime:new Date}),this.deleted.delete(r)}async readdirCore(e,n){if(this.deleted.has(n))throw new Error(`ENOENT: no such file or directory, scandir '${e}'`);let r=new Map,s=new Set,o=n==="/"?"/":`${n}/`;for(let a of this.deleted)if(a.startsWith(o)){let c=a.slice(o.length),l=c.split("/")[0];l&&!c.includes("/",l.length)&&s.add(l)}for(let[a,c]of this.memory)if(a!==n&&a.startsWith(o)){let l=a.slice(o.length),u=l.split("/")[0];u&&!s.has(u)&&!l.includes("/",1)&&r.set(u,{name:u,isFile:c.type==="file",isDirectory:c.type==="directory",isSymbolicLink:c.type==="symlink"})}let i=this.toRealPath(n);if(i)try{let a=await M.promises.readdir(i,{withFileTypes:!0});for(let c of a)!s.has(c.name)&&!r.has(c.name)&&r.set(c.name,{name:c.name,isFile:c.isFile(),isDirectory:c.isDirectory(),isSymbolicLink:c.isSymbolicLink()})}catch(a){if(a.code==="ENOENT"){if(!this.memory.has(n))throw new Error(`ENOENT: no such file or directory, scandir '${e}'`)}else if(a.code!=="ENOTDIR")throw a}return r}async resolveForReaddir(e,n=!1){let r=this.normalizePath(e),s=new Set,o=n,i=this.memory.get(r);for(;i&&i.type==="symlink";){if(s.has(r))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${e}'`);s.add(r),o=!0,r=this.resolveSymlink(r,i.target),i=this.memory.get(r)}if(i)return{normalized:r,outsideOverlay:!1};if(this.getRelativeToMount(r)===null)return{normalized:r,outsideOverlay:!0};let c=this.toRealPath(r);if(!c)return{normalized:r,outsideOverlay:!0};try{if((await M.promises.lstat(c)).isSymbolicLink()){let u=await M.promises.readlink(c),d=this.resolveSymlink(r,u);return this.resolveForReaddir(d,!0)}return{normalized:r,outsideOverlay:!1}}catch{return o?{normalized:r,outsideOverlay:!0}:{normalized:r,outsideOverlay:!1}}}async readdir(e){let{normalized:n,outsideOverlay:r}=await this.resolveForReaddir(e);if(r)return[];let s=await this.readdirCore(e,n);return Array.from(s.keys()).sort((o,i)=>o<i?-1:o>i?1:0)}async readdirWithFileTypes(e){let{normalized:n,outsideOverlay:r}=await this.resolveForReaddir(e);if(r)return[];let s=await this.readdirCore(e,n);return Array.from(s.values()).sort((o,i)=>o.name<i.name?-1:o.name>i.name?1:0)}async rm(e,n){this.assertWritable(`rm '${e}'`);let r=this.normalizePath(e);if(!await this.existsInOverlay(r)){if(n?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${e}'`)}try{if((await this.stat(r)).isDirectory){let i=await this.readdir(r);if(i.length>0){if(!n?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${e}'`);for(let a of i){let c=r==="/"?`/${a}`:`${r}/${a}`;await this.rm(c,n)}}}}catch{}this.deleted.add(r),this.memory.delete(r)}async cp(e,n,r){this.assertWritable(`cp '${n}'`);let s=this.normalizePath(e),o=this.normalizePath(n);if(!await this.existsInOverlay(s))throw new Error(`ENOENT: no such file or directory, cp '${e}'`);let a=await this.stat(s);if(a.isFile){let c=await this.readFileBuffer(s);await this.writeFile(o,c)}else if(a.isDirectory){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${e}'`);await this.mkdir(o,{recursive:!0});let c=await this.readdir(s);for(let l of c){let u=s==="/"?`/${l}`:`${s}/${l}`,d=o==="/"?`/${l}`:`${o}/${l}`;await this.cp(u,d,r)}}}async mv(e,n){this.assertWritable(`mv '${n}'`),await this.cp(e,n,{recursive:!0}),await this.rm(e,{recursive:!0})}resolvePath(e,n){if(n.startsWith("/"))return this.normalizePath(n);let r=e==="/"?`/${n}`:`${e}/${n}`;return this.normalizePath(r)}getAllPaths(){let e=new Set(this.memory.keys());for(let n of this.deleted)e.delete(n);return this.scanRealFs("/",e),Array.from(e)}scanRealFs(e,n){if(this.deleted.has(e))return;let r=this.toRealPath(e);if(r)try{let s=M.readdirSync(r);for(let o of s){let i=e==="/"?`/${o}`:`${e}/${o}`;if(this.deleted.has(i))continue;n.add(i);let a=Ie.join(r,o);M.statSync(a).isDirectory()&&this.scanRealFs(i,n)}}catch{}}async chmod(e,n){this.assertWritable(`chmod '${e}'`);let r=this.normalizePath(e);if(!await this.existsInOverlay(r))throw new Error(`ENOENT: no such file or directory, chmod '${e}'`);let o=this.memory.get(r);if(o){o.mode=n;return}let i=await this.stat(r);if(i.isFile){let a=await this.readFileBuffer(r);this.memory.set(r,{type:"file",content:a,mode:n,mtime:new Date})}else i.isDirectory&&this.memory.set(r,{type:"directory",mode:n,mtime:new Date})}async symlink(e,n){this.assertWritable(`symlink '${n}'`);let r=this.normalizePath(n);if(await this.existsInOverlay(r))throw new Error(`EEXIST: file already exists, symlink '${n}'`);this.ensureParentDirs(r),this.memory.set(r,{type:"symlink",target:e,mode:511,mtime:new Date}),this.deleted.delete(r)}async link(e,n){this.assertWritable(`link '${n}'`);let r=this.normalizePath(e),s=this.normalizePath(n);if(!await this.existsInOverlay(r))throw new Error(`ENOENT: no such file or directory, link '${e}'`);let i=await this.stat(r);if(!i.isFile)throw new Error(`EPERM: operation not permitted, link '${e}'`);if(await this.existsInOverlay(s))throw new Error(`EEXIST: file already exists, link '${n}'`);let c=await this.readFileBuffer(r);this.ensureParentDirs(s),this.memory.set(s,{type:"file",content:c,mode:i.mode,mtime:new Date}),this.deleted.delete(s)}async readlink(e){let n=this.normalizePath(e);if(this.deleted.has(n))throw new Error(`ENOENT: no such file or directory, readlink '${e}'`);let r=this.memory.get(n);if(r){if(r.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${e}'`);return r.target}let s=this.toRealPath(n);if(!s)throw new Error(`ENOENT: no such file or directory, readlink '${e}'`);try{return await M.promises.readlink(s)}catch(o){throw o.code==="ENOENT"?new Error(`ENOENT: no such file or directory, readlink '${e}'`):o.code==="EINVAL"?new Error(`EINVAL: invalid argument, readlink '${e}'`):o}}};var W={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m"},mr=class{env;rl;running=!0;history=[];isInteractive;constructor(e={}){let n=process.cwd(),r=new gt({root:n,mountPoint:"/"});this.env=new Et({fs:r,cwd:e.cwd||"/",env:{HOME:"/",USER:"user",SHELL:"/bin/bash",TERM:"xterm-256color",...e.env},network:e.network!==!1?{dangerouslyAllowFullInternetAccess:!0}:void 0}),this.isInteractive=process.stdin.isTTY===!0,this.rl=Un.createInterface({input:process.stdin,output:process.stdout,terminal:this.isInteractive}),this.rl.on("SIGINT",()=>{process.stdout.write(`^C
151
+ `,exitCode:1,env:{...this.state.env,...n?.env}});throw i}}async readFile(e){return this.fs.readFile(this.fs.resolvePath(this.state.cwd,e))}async writeFile(e,n){return this.fs.writeFile(this.fs.resolvePath(this.state.cwd,e),n)}getCwd(){return this.state.cwd}getEnv(){return{...this.state.env}}};function ii(t){let e=t.split(`
152
+ `),n=[],r=[];for(let s=0;s<e.length;s++){let o=e[s];if(r.length>0){let c=r[r.length-1];if((c.stripTabs?o.replace(/^\t+/,""):o)===c.delimiter){n.push(o.trimStart()),r.pop();continue}n.push(o);continue}let i=o.trimStart();n.push(i);let a=/<<(-?)\s*(['"]?)([\w-]+)\2/g;for(let c of i.matchAll(a)){let l=c[1]==="-",u=c[3];r.push({delimiter:u,stripTabs:l})}}return n.join(`
153
+ `)}import*as M from"node:fs";import*as Ie from"node:path";var oi="/home/user/project",gt=class{root;mountPoint;readOnly;memory=new Map;deleted=new Set;constructor(e){this.root=Ie.resolve(e.root);let n=e.mountPoint??oi;if(this.mountPoint=n==="/"?"/":n.replace(/\/+$/,""),!this.mountPoint.startsWith("/"))throw new Error(`Mount point must be an absolute path: ${n}`);if(this.readOnly=e.readOnly??!1,!M.existsSync(this.root))throw new Error(`OverlayFs root does not exist: ${this.root}`);if(!M.statSync(this.root).isDirectory())throw new Error(`OverlayFs root is not a directory: ${this.root}`);this.createMountPointDirs()}assertWritable(e){if(this.readOnly)throw new Error(`EROFS: read-only file system, ${e}`)}createMountPointDirs(){let e=this.mountPoint.split("/").filter(Boolean),n="";for(let r of e)n+=`/${r}`,this.memory.has(n)||this.memory.set(n,{type:"directory",mode:493,mtime:new Date});this.memory.has("/")||this.memory.set("/",{type:"directory",mode:493,mtime:new Date})}getMountPoint(){return this.mountPoint}mkdirSync(e,n){let s=this.normalizePath(e).split("/").filter(Boolean),o="";for(let i of s)o+=`/${i}`,this.memory.has(o)||this.memory.set(o,{type:"directory",mode:493,mtime:new Date})}writeFileSync(e,n){let r=this.normalizePath(e),s=this.getDirname(r);s!=="/"&&this.mkdirSync(s);let o=n instanceof Uint8Array?n:new TextEncoder().encode(n);this.memory.set(r,{type:"file",content:o,mode:420,mtime:new Date})}getDirname(e){let n=e.lastIndexOf("/");return n===0?"/":e.slice(0,n)}normalizePath(e){if(!e||e==="/")return"/";let n=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;n.startsWith("/")||(n=`/${n}`);let r=n.split("/").filter(o=>o&&o!=="."),s=[];for(let o of r)o===".."?s.pop():s.push(o);return`/${s.join("/")}`||"/"}getRelativeToMount(e){return this.mountPoint==="/"?e:e===this.mountPoint?"/":e.startsWith(`${this.mountPoint}/`)?e.slice(this.mountPoint.length):null}toRealPath(e){let n=this.normalizePath(e),r=this.getRelativeToMount(n);if(r===null)return null;let s=Ie.join(this.root,r),o=Ie.resolve(s);return!o.startsWith(this.root)&&o!==this.root.replace(/\/$/,"")?null:o}dirname(e){let n=this.normalizePath(e);if(n==="/")return"/";let r=n.lastIndexOf("/");return r===0?"/":n.slice(0,r)}ensureParentDirs(e){let n=this.dirname(e);n!=="/"&&(this.memory.has(n)||(this.ensureParentDirs(n),this.memory.set(n,{type:"directory",mode:493,mtime:new Date})),this.deleted.delete(n))}async existsInOverlay(e){let n=this.normalizePath(e);if(this.deleted.has(n))return!1;if(this.memory.has(n))return!0;let r=this.toRealPath(n);if(!r)return!1;try{return await M.promises.access(r),!0}catch{return!1}}async readFile(e,n){let r=await this.readFileBuffer(e),s=ae(n);return Ge(r,s)}async readFileBuffer(e,n=new Set){let r=this.normalizePath(e);if(n.has(r))throw new Error(`ELOOP: too many levels of symbolic links, open '${e}'`);if(n.add(r),this.deleted.has(r))throw new Error(`ENOENT: no such file or directory, open '${e}'`);let s=this.memory.get(r);if(s){if(s.type==="symlink"){let i=this.resolveSymlink(r,s.target);return this.readFileBuffer(i,n)}if(s.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${e}'`);return s.content}let o=this.toRealPath(r);if(!o)throw new Error(`ENOENT: no such file or directory, open '${e}'`);try{let i=await M.promises.lstat(o);if(i.isSymbolicLink()){let c=await M.promises.readlink(o),l=this.resolveSymlink(r,c);return this.readFileBuffer(l,n)}if(i.isDirectory())throw new Error(`EISDIR: illegal operation on a directory, read '${e}'`);let a=await M.promises.readFile(o);return new Uint8Array(a)}catch(i){throw i.code==="ENOENT"?new Error(`ENOENT: no such file or directory, open '${e}'`):i}}async writeFile(e,n,r){this.assertWritable(`write '${e}'`);let s=this.normalizePath(e);this.ensureParentDirs(s);let o=ae(r),i=Se(n,o);this.memory.set(s,{type:"file",content:i,mode:420,mtime:new Date}),this.deleted.delete(s)}async appendFile(e,n,r){this.assertWritable(`append '${e}'`);let s=this.normalizePath(e),o=ae(r),i=Se(n,o),a;try{a=await this.readFileBuffer(s)}catch{a=new Uint8Array(0)}let c=new Uint8Array(a.length+i.length);c.set(a),c.set(i,a.length),this.ensureParentDirs(s),this.memory.set(s,{type:"file",content:c,mode:420,mtime:new Date}),this.deleted.delete(s)}async exists(e){return this.existsInOverlay(e)}async stat(e,n=new Set){let r=this.normalizePath(e);if(n.has(r))throw new Error(`ELOOP: too many levels of symbolic links, stat '${e}'`);if(n.add(r),this.deleted.has(r))throw new Error(`ENOENT: no such file or directory, stat '${e}'`);let s=this.memory.get(r);if(s){if(s.type==="symlink"){let a=this.resolveSymlink(r,s.target);return this.stat(a,n)}let i=0;return s.type==="file"&&(i=s.content.length),{isFile:s.type==="file",isDirectory:s.type==="directory",isSymbolicLink:!1,mode:s.mode,size:i,mtime:s.mtime}}let o=this.toRealPath(r);if(!o)throw new Error(`ENOENT: no such file or directory, stat '${e}'`);try{let i=await M.promises.stat(o);return{isFile:i.isFile(),isDirectory:i.isDirectory(),isSymbolicLink:!1,mode:i.mode,size:i.size,mtime:i.mtime}}catch(i){throw i.code==="ENOENT"?new Error(`ENOENT: no such file or directory, stat '${e}'`):i}}async lstat(e){let n=this.normalizePath(e);if(this.deleted.has(n))throw new Error(`ENOENT: no such file or directory, lstat '${e}'`);let r=this.memory.get(n);if(r){if(r.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:r.mode,size:r.target.length,mtime:r.mtime};let o=0;return r.type==="file"&&(o=r.content.length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:o,mtime:r.mtime}}let s=this.toRealPath(n);if(!s)throw new Error(`ENOENT: no such file or directory, lstat '${e}'`);try{let o=await M.promises.lstat(s);return{isFile:o.isFile(),isDirectory:o.isDirectory(),isSymbolicLink:o.isSymbolicLink(),mode:o.mode,size:o.size,mtime:o.mtime}}catch(o){throw o.code==="ENOENT"?new Error(`ENOENT: no such file or directory, lstat '${e}'`):o}}resolveSymlink(e,n){if(n.startsWith("/"))return this.normalizePath(n);let r=this.dirname(e);return this.normalizePath(r==="/"?`/${n}`:`${r}/${n}`)}async mkdir(e,n){this.assertWritable(`mkdir '${e}'`);let r=this.normalizePath(e);if(await this.existsInOverlay(r)){if(!n?.recursive)throw new Error(`EEXIST: file already exists, mkdir '${e}'`);return}let o=this.dirname(r);if(o!=="/"&&!await this.existsInOverlay(o))if(n?.recursive)await this.mkdir(o,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${e}'`);this.memory.set(r,{type:"directory",mode:493,mtime:new Date}),this.deleted.delete(r)}async readdirCore(e,n){if(this.deleted.has(n))throw new Error(`ENOENT: no such file or directory, scandir '${e}'`);let r=new Map,s=new Set,o=n==="/"?"/":`${n}/`;for(let a of this.deleted)if(a.startsWith(o)){let c=a.slice(o.length),l=c.split("/")[0];l&&!c.includes("/",l.length)&&s.add(l)}for(let[a,c]of this.memory)if(a!==n&&a.startsWith(o)){let l=a.slice(o.length),u=l.split("/")[0];u&&!s.has(u)&&!l.includes("/",1)&&r.set(u,{name:u,isFile:c.type==="file",isDirectory:c.type==="directory",isSymbolicLink:c.type==="symlink"})}let i=this.toRealPath(n);if(i)try{let a=await M.promises.readdir(i,{withFileTypes:!0});for(let c of a)!s.has(c.name)&&!r.has(c.name)&&r.set(c.name,{name:c.name,isFile:c.isFile(),isDirectory:c.isDirectory(),isSymbolicLink:c.isSymbolicLink()})}catch(a){if(a.code==="ENOENT"){if(!this.memory.has(n))throw new Error(`ENOENT: no such file or directory, scandir '${e}'`)}else if(a.code!=="ENOTDIR")throw a}return r}async resolveForReaddir(e,n=!1){let r=this.normalizePath(e),s=new Set,o=n,i=this.memory.get(r);for(;i&&i.type==="symlink";){if(s.has(r))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${e}'`);s.add(r),o=!0,r=this.resolveSymlink(r,i.target),i=this.memory.get(r)}if(i)return{normalized:r,outsideOverlay:!1};if(this.getRelativeToMount(r)===null)return{normalized:r,outsideOverlay:!0};let c=this.toRealPath(r);if(!c)return{normalized:r,outsideOverlay:!0};try{if((await M.promises.lstat(c)).isSymbolicLink()){let u=await M.promises.readlink(c),d=this.resolveSymlink(r,u);return this.resolveForReaddir(d,!0)}return{normalized:r,outsideOverlay:!1}}catch{return o?{normalized:r,outsideOverlay:!0}:{normalized:r,outsideOverlay:!1}}}async readdir(e){let{normalized:n,outsideOverlay:r}=await this.resolveForReaddir(e);if(r)return[];let s=await this.readdirCore(e,n);return Array.from(s.keys()).sort((o,i)=>o<i?-1:o>i?1:0)}async readdirWithFileTypes(e){let{normalized:n,outsideOverlay:r}=await this.resolveForReaddir(e);if(r)return[];let s=await this.readdirCore(e,n);return Array.from(s.values()).sort((o,i)=>o.name<i.name?-1:o.name>i.name?1:0)}async rm(e,n){this.assertWritable(`rm '${e}'`);let r=this.normalizePath(e);if(!await this.existsInOverlay(r)){if(n?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${e}'`)}try{if((await this.stat(r)).isDirectory){let i=await this.readdir(r);if(i.length>0){if(!n?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${e}'`);for(let a of i){let c=r==="/"?`/${a}`:`${r}/${a}`;await this.rm(c,n)}}}}catch{}this.deleted.add(r),this.memory.delete(r)}async cp(e,n,r){this.assertWritable(`cp '${n}'`);let s=this.normalizePath(e),o=this.normalizePath(n);if(!await this.existsInOverlay(s))throw new Error(`ENOENT: no such file or directory, cp '${e}'`);let a=await this.stat(s);if(a.isFile){let c=await this.readFileBuffer(s);await this.writeFile(o,c)}else if(a.isDirectory){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${e}'`);await this.mkdir(o,{recursive:!0});let c=await this.readdir(s);for(let l of c){let u=s==="/"?`/${l}`:`${s}/${l}`,d=o==="/"?`/${l}`:`${o}/${l}`;await this.cp(u,d,r)}}}async mv(e,n){this.assertWritable(`mv '${n}'`),await this.cp(e,n,{recursive:!0}),await this.rm(e,{recursive:!0})}resolvePath(e,n){if(n.startsWith("/"))return this.normalizePath(n);let r=e==="/"?`/${n}`:`${e}/${n}`;return this.normalizePath(r)}getAllPaths(){let e=new Set(this.memory.keys());for(let n of this.deleted)e.delete(n);return this.scanRealFs("/",e),Array.from(e)}scanRealFs(e,n){if(this.deleted.has(e))return;let r=this.toRealPath(e);if(r)try{let s=M.readdirSync(r);for(let o of s){let i=e==="/"?`/${o}`:`${e}/${o}`;if(this.deleted.has(i))continue;n.add(i);let a=Ie.join(r,o);M.statSync(a).isDirectory()&&this.scanRealFs(i,n)}}catch{}}async chmod(e,n){this.assertWritable(`chmod '${e}'`);let r=this.normalizePath(e);if(!await this.existsInOverlay(r))throw new Error(`ENOENT: no such file or directory, chmod '${e}'`);let o=this.memory.get(r);if(o){o.mode=n;return}let i=await this.stat(r);if(i.isFile){let a=await this.readFileBuffer(r);this.memory.set(r,{type:"file",content:a,mode:n,mtime:new Date})}else i.isDirectory&&this.memory.set(r,{type:"directory",mode:n,mtime:new Date})}async symlink(e,n){this.assertWritable(`symlink '${n}'`);let r=this.normalizePath(n);if(await this.existsInOverlay(r))throw new Error(`EEXIST: file already exists, symlink '${n}'`);this.ensureParentDirs(r),this.memory.set(r,{type:"symlink",target:e,mode:511,mtime:new Date}),this.deleted.delete(r)}async link(e,n){this.assertWritable(`link '${n}'`);let r=this.normalizePath(e),s=this.normalizePath(n);if(!await this.existsInOverlay(r))throw new Error(`ENOENT: no such file or directory, link '${e}'`);let i=await this.stat(r);if(!i.isFile)throw new Error(`EPERM: operation not permitted, link '${e}'`);if(await this.existsInOverlay(s))throw new Error(`EEXIST: file already exists, link '${n}'`);let c=await this.readFileBuffer(r);this.ensureParentDirs(s),this.memory.set(s,{type:"file",content:c,mode:i.mode,mtime:new Date}),this.deleted.delete(s)}async readlink(e){let n=this.normalizePath(e);if(this.deleted.has(n))throw new Error(`ENOENT: no such file or directory, readlink '${e}'`);let r=this.memory.get(n);if(r){if(r.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${e}'`);return r.target}let s=this.toRealPath(n);if(!s)throw new Error(`ENOENT: no such file or directory, readlink '${e}'`);try{return await M.promises.readlink(s)}catch(o){throw o.code==="ENOENT"?new Error(`ENOENT: no such file or directory, readlink '${e}'`):o.code==="EINVAL"?new Error(`EINVAL: invalid argument, readlink '${e}'`):o}}};var W={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m"},mr=class{env;rl;running=!0;history=[];isInteractive;constructor(e={}){let n=process.cwd(),r=new gt({root:n,mountPoint:"/"});this.env=new Et({fs:r,cwd:e.cwd||"/",env:{HOME:"/",USER:"user",SHELL:"/bin/bash",TERM:"xterm-256color",...e.env},network:e.network!==!1?{dangerouslyAllowFullInternetAccess:!0}:void 0}),this.isInteractive=process.stdin.isTTY===!0,this.rl=Un.createInterface({input:process.stdin,output:process.stdout,terminal:this.isInteractive}),this.rl.on("SIGINT",()=>{process.stdout.write(`^C
154
154
  `),this.prompt()}),process.stdin.isTTY&&this.rl.on("close",()=>{this.running=!1,console.log(`
155
155
  Goodbye!`),process.exit(0)})}syncHistory(){let e=this.env.getEnv();e.BASH_HISTORY=JSON.stringify(this.history)}getPrompt(){let e=this.env.getCwd(),n=this.env.getEnv().HOME||"/home/user",r=e;return e===n?r="~":e.startsWith(`${n}/`)&&(r=`~${e.slice(n.length)}`),`${W.green}${W.bold}user@virtual${W.reset}:${W.blue}${W.bold}${r}${W.reset}$ `}async executeCommand(e){let n=e.trim();if(n){if(this.history.push(n),n==="exit"||n.startsWith("exit ")){let r=n.split(/\s+/),s=r[1]?parseInt(r[1],10):0;console.log("exit"),process.exit(s)}this.syncHistory();try{let r=await this.env.exec(n);r.stdout&&process.stdout.write(r.stdout),r.stderr&&process.stderr.write(`${W.red}${r.stderr}${W.reset}`)}catch(r){console.error(`${W.red}Error: ${Y(r)}${W.reset}`)}}}printWelcome(){console.log(`
156
156
  ${W.cyan}${W.bold}\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
@@ -162,7 +162,7 @@ ${W.dim}Exploring: ${process.cwd()}${W.reset}
162
162
 
163
163
  Type ${W.green}help${W.reset} for available commands, ${W.green}exit${W.reset} to quit.
164
164
  Reads from real filesystem, writes stay in memory (OverlayFs).
165
- `)}prompt(){this.rl.question(this.getPrompt(),async e=>{this.running&&(await this.executeCommand(e),this.prompt())})}async run(){if(this.isInteractive)this.printWelcome(),this.prompt();else{let e=[];this.rl.on("line",n=>{e.push(n)}),await new Promise(n=>{this.rl.on("close",n)});for(let n of e)await this.executeCommand(n)}}};function oi(){let t=process.argv.slice(2),e={network:!0};for(let n=0;n<t.length;n++)if(t[n]==="--cwd"&&t[n+1])e.cwd=t[++n];else if(t[n]==="--files"&&t[n+1]){let r=t[++n];try{let s=zn.readFileSync(r,"utf-8");e.files=JSON.parse(s)}catch(s){console.error(`Error reading files from ${r}:`,s),process.exit(1)}}else t[n]==="--no-network"?e.network=!1:(t[n]==="--help"||t[n]==="-h")&&(console.log(`
165
+ `)}prompt(){this.rl.question(this.getPrompt(),async e=>{this.running&&(await this.executeCommand(e),this.prompt())})}async run(){if(this.isInteractive)this.printWelcome(),this.prompt();else{let e=[];this.rl.on("line",n=>{e.push(n)}),await new Promise(n=>{this.rl.on("close",n)});for(let n of e)await this.executeCommand(n)}}};function ai(){let t=process.argv.slice(2),e={network:!0};for(let n=0;n<t.length;n++)if(t[n]==="--cwd"&&t[n+1])e.cwd=t[++n];else if(t[n]==="--files"&&t[n+1]){let r=t[++n];try{let s=zn.readFileSync(r,"utf-8");e.files=JSON.parse(s)}catch(s){console.error(`Error reading files from ${r}:`,s),process.exit(1)}}else t[n]==="--no-network"?e.network=!1:(t[n]==="--help"||t[n]==="-h")&&(console.log(`
166
166
  Usage: pnpm shell [options]
167
167
 
168
168
  Interactive shell using OverlayFs - reads from the current directory,
@@ -176,4 +176,4 @@ Options:
176
176
  Example:
177
177
  pnpm shell
178
178
  pnpm shell --no-network
179
- `),process.exit(0));return e}var ai=oi(),ci=new mr(ai);ci.run();
179
+ `),process.exit(0));return e}var ci=ai(),li=new mr(ci);li.run();
@@ -548,10 +548,10 @@ DURATION is a number with optional suffix:
548
548
  `,S||f++}}return f>0&&(d+=`${t}: WARNING: ${f} computed checksum${f>1?"s":""} did NOT match
549
549
  `),{stdout:d,stderr:"",exitCode:f>0?1:0}}let c="",u=0;for(let f of a){let d=await l(f);if(d===null){c+=`${t}: ${f}: No such file or directory
550
550
  `,u=1;continue}c+=`${await Zc(e,d)} ${f}
551
- `}return{stdout:c,stderr:"",exitCode:u}}}}var cy,wr=C(()=>{"use strict";j();cy={sha1:"SHA-1",sha256:"SHA-256"}});var Kc={};M(Kc,{md5sumCommand:()=>fy});var fy,Qc=C(()=>{"use strict";wr();fy=rn("md5sum","md5","compute MD5 message digest")});var Xc={};M(Xc,{sha1sumCommand:()=>dy});var dy,Jc=C(()=>{"use strict";wr();dy=rn("sha1sum","sha1","compute SHA1 message digest")});var Yc={};M(Yc,{sha256sumCommand:()=>py});var py,eu=C(()=>{"use strict";wr();py=rn("sha256sum","sha256","compute SHA256 message digest")});var tu=Zn(qs=>{qs.read=function(t,e,n,r,s){var i,o,a=s*8-r-1,l=(1<<a)-1,c=l>>1,u=-7,f=n?s-1:0,d=n?-1:1,p=t[e+f];for(f+=d,i=p&(1<<-u)-1,p>>=-u,u+=a;u>0;i=i*256+t[e+f],f+=d,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=r;u>0;o=o*256+t[e+f],f+=d,u-=8);if(i===0)i=1-c;else{if(i===l)return o?NaN:(p?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-c}return(p?-1:1)*o*Math.pow(2,i-r)};qs.write=function(t,e,n,r,s,i){var o,a,l,c=i*8-s-1,u=(1<<c)-1,f=u>>1,d=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,h=r?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(o++,l/=2),o+f>=u?(a=0,o=u):o+f>=1?(a=(e*l-1)*Math.pow(2,s),o=o+f):(a=e*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;t[n+p]=a&255,p+=h,a/=256,s-=8);for(o=o<<s|a,c+=s;c>0;t[n+p]=o&255,p+=h,o/=256,c-=8);t[n+p-h]|=g*128}});function nu(t,e="utf-8"){switch(e.toLowerCase()){case"utf-8":case"utf8":return typeof globalThis.TextDecoder<"u"?new globalThis.TextDecoder("utf-8").decode(t):my(t);case"utf-16le":return gy(t);case"ascii":return yy(t);case"latin1":case"iso-8859-1":return xy(t);case"windows-1252":return wy(t);default:throw new RangeError(`Encoding '${e}' not supported`)}}function my(t){let e="",n=0;for(;n<t.length;){let r=t[n++];if(r<128)e+=String.fromCharCode(r);else if(r<224){let s=t[n++]&63;e+=String.fromCharCode((r&31)<<6|s)}else if(r<240){let s=t[n++]&63,i=t[n++]&63;e+=String.fromCharCode((r&15)<<12|s<<6|i)}else{let s=t[n++]&63,i=t[n++]&63,o=t[n++]&63,a=(r&7)<<18|s<<12|i<<6|o;a-=65536,e+=String.fromCharCode(55296+(a>>10&1023),56320+(a&1023))}}return e}function gy(t){let e="";for(let n=0;n<t.length;n+=2)e+=String.fromCharCode(t[n]|t[n+1]<<8);return e}function yy(t){return String.fromCharCode(...t.map(e=>e&127))}function xy(t){return String.fromCharCode(...t)}function wy(t){let e="";for(let n of t)n>=128&&n<=159&&Vs[n]?e+=Vs[n]:e+=String.fromCharCode(n);return e}var Vs,hy,ru=C(()=>{Vs={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},hy={};for(let[t,e]of Object.entries(Vs))hy[e]=Number.parseInt(t)});function Be(t){return new DataView(t.buffer,t.byteOffset)}var su,iu,ge,sn,be,ou,au,lu,We,Tn=C(()=>{su=lo(tu(),1);ru();iu={len:1,get(t,e){return Be(t).getUint8(e)},put(t,e,n){return Be(t).setUint8(e,n),e+1}},ge={len:2,get(t,e){return Be(t).getUint16(e,!0)},put(t,e,n){return Be(t).setUint16(e,n,!0),e+2}},sn={len:2,get(t,e){return Be(t).getUint16(e)},put(t,e,n){return Be(t).setUint16(e,n),e+2}},be={len:4,get(t,e){return Be(t).getUint32(e,!0)},put(t,e,n){return Be(t).setUint32(e,n,!0),e+4}},ou={len:4,get(t,e){return Be(t).getUint32(e)},put(t,e,n){return Be(t).setUint32(e,n),e+4}},au={len:4,get(t,e){return Be(t).getInt32(e)},put(t,e,n){return Be(t).setInt32(e,n),e+4}},lu={len:8,get(t,e){return Be(t).getBigUint64(e,!0)},put(t,e,n){return Be(t).setBigUint64(e,n,!0),e+8}},We=class{constructor(e,n){this.len=e,this.encoding=n}get(e,n=0){let r=e.subarray(n,n+this.len);return nu(r,this.encoding)}}});var Ey,pe,Ot,On=C(()=>{Ey="End-Of-Stream",pe=class extends Error{constructor(){super(Ey),this.name="EndOfStreamError"}},Ot=class extends Error{constructor(e="The operation was aborted"){super(e),this.name="AbortError"}}});var cu=C(()=>{});var Dt,br=C(()=>{On();Dt=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,n=!1){let r=await this.read(e,n);return this.peekQueue.push(e.subarray(0,r)),r}async read(e,n=!1){if(e.length===0)return 0;let r=this.readFromPeekBuffer(e);if(this.endOfStream||(r+=await this.readRemainderFromStream(e.subarray(r),n)),r===0&&!n)throw new pe;return r}readFromPeekBuffer(e){let n=e.length,r=0;for(;this.peekQueue.length>0&&n>0;){let s=this.peekQueue.pop();if(!s)throw new Error("peekData should be defined");let i=Math.min(s.length,n);e.set(s.subarray(0,i),r),r+=i,n-=i,i<s.length&&this.peekQueue.push(s.subarray(i))}return r}async readRemainderFromStream(e,n){let r=0;for(;r<e.length&&!this.endOfStream;){if(this.interrupted)throw new Ot;let s=await this.readFromStream(e.subarray(r),n);if(s===0)break;r+=s}if(!n&&r<e.length)throw new pe;return r}}});var uu=C(()=>{On();cu();br()});var Er,fu=C(()=>{br();Er=class extends Dt{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var Dn,Zs=C(()=>{fu();Dn=class extends Er{async readFromStream(e,n){if(e.length===0)return 0;let r=await this.reader.read(new Uint8Array(e.length),{min:n?void 0:e.length});return r.done&&(this.endOfStream=r.done),r.value?(e.set(r.value),r.value.length):0}}});var on,Ks=C(()=>{On();br();on=class extends Dt{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,n){let r=Math.min(n.length,e.length);return e.set(n.subarray(0,r)),r<n.length?this.buffer=n.subarray(r):this.buffer=null,r}async readFromStream(e,n){if(e.length===0)return 0;let r=0;for(this.buffer&&(r+=this.writeChunk(e,this.buffer));r<e.length&&!this.endOfStream;){let s=await this.reader.read();if(s.done){this.endOfStream=!0;break}s.value&&(r+=this.writeChunk(e.subarray(r),s.value))}if(!n&&r===0&&this.endOfStream)throw new pe;return r}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}});function Qs(t){try{let e=t.getReader({mode:"byob"});return e instanceof ReadableStreamDefaultReader?new on(e):new Dn(e)}catch(e){if(e instanceof TypeError)return new on(t.getReader());throw e}}var du=C(()=>{Zs();Ks()});var Lt=C(()=>{On();uu();Zs();Ks();du()});var ft,Ln=C(()=>{Lt();ft=class{constructor(e){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=e?.onClose,e?.abortSignal&&e.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(e,n=this.position){let r=new Uint8Array(e.len);if(await this.readBuffer(r,{position:n})<e.len)throw new pe;return e.get(r,0)}async peekToken(e,n=this.position){let r=new Uint8Array(e.len);if(await this.peekBuffer(r,{position:n})<e.len)throw new pe;return e.get(r,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new pe;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new pe;return e.get(this.numBuffer,0)}async ignore(e){if(this.fileInfo.size!==void 0){let n=this.fileInfo.size-this.position;if(e>n)return this.position+=n,n}return this.position+=e,e}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(e,n){if(!this.supportsRandomAccess()&&n&&n.position!==void 0&&n.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:e.length,position:this.position,...n}}abort(){return Promise.resolve()}}});var Cy,Sr,pu=C(()=>{Ln();Lt();Cy=256e3,Sr=class extends ft{constructor(e,n){super(n),this.streamReader=e,this.fileInfo=n?.fileInfo??{}}async readBuffer(e,n){let r=this.normalizeOptions(e,n),s=r.position-this.position;if(s>0)return await this.ignore(s),this.readBuffer(e,n);if(s<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(r.length===0)return 0;let i=await this.streamReader.read(e.subarray(0,r.length),r.mayBeLess);if(this.position+=i,(!n||!n.mayBeLess)&&i<r.length)throw new pe;return i}async peekBuffer(e,n){let r=this.normalizeOptions(e,n),s=0;if(r.position){let i=r.position-this.position;if(i>0){let o=new Uint8Array(r.length+i);return s=await this.peekBuffer(o,{mayBeLess:r.mayBeLess}),e.set(o.subarray(i)),s-i}if(i<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{s=await this.streamReader.peek(e.subarray(0,r.length),r.mayBeLess)}catch(i){if(n?.mayBeLess&&i instanceof pe)return 0;throw i}if(!r.mayBeLess&&s<r.length)throw new pe}return s}async ignore(e){let n=Math.min(Cy,e),r=new Uint8Array(n),s=0;for(;s<e;){let i=e-s,o=await this.readBuffer(r,{length:Math.min(n,i)});if(o<0)return o;s+=o}return s}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}});var Cr,hu=C(()=>{Lt();Ln();Cr=class extends ft{constructor(e,n){super(n),this.uint8Array=e,this.fileInfo={...n?.fileInfo??{},size:e.length}}async readBuffer(e,n){n?.position&&(this.position=n.position);let r=await this.peekBuffer(e,n);return this.position+=r,r}async peekBuffer(e,n){let r=this.normalizeOptions(e,n),s=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&s<r.length)throw new pe;return e.set(this.uint8Array.subarray(r.position,r.position+s)),s}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}}});var Ar,mu=C(()=>{Lt();Ln();Ar=class extends ft{constructor(e,n){super(n),this.blob=e,this.fileInfo={...n?.fileInfo??{},size:e.size,mimeType:e.type}}async readBuffer(e,n){n?.position&&(this.position=n.position);let r=await this.peekBuffer(e,n);return this.position+=r,r}async peekBuffer(e,n){let r=this.normalizeOptions(e,n),s=Math.min(this.blob.size-r.position,r.length);if(!r.mayBeLess&&s<r.length)throw new pe;let i=await this.blob.slice(r.position,r.position+s).arrayBuffer();return e.set(new Uint8Array(i)),s}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}}});function gu(t,e){let n=Qs(t),r=e??{},s=r.onClose;return r.onClose=async()=>{if(await n.close(),s)return s()},new Sr(n,r)}function yu(t,e){return new Cr(t,e)}function xu(t,e){return new Ar(t,e)}var wu=C(()=>{Lt();pu();hu();mu();Lt();Ln()});var Eu=Zn((rC,bu)=>{var an=1e3,ln=an*60,cn=ln*60,Mt=cn*24,ky=Mt*7,Ny=Mt*365.25;bu.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return Iy(t);if(n==="number"&&isFinite(t))return e.long?$y(t):vy(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Iy(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*Ny;case"weeks":case"week":case"w":return n*ky;case"days":case"day":case"d":return n*Mt;case"hours":case"hour":case"hrs":case"hr":case"h":return n*cn;case"minutes":case"minute":case"mins":case"min":case"m":return n*ln;case"seconds":case"second":case"secs":case"sec":case"s":return n*an;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function vy(t){var e=Math.abs(t);return e>=Mt?Math.round(t/Mt)+"d":e>=cn?Math.round(t/cn)+"h":e>=ln?Math.round(t/ln)+"m":e>=an?Math.round(t/an)+"s":t+"ms"}function $y(t){var e=Math.abs(t);return e>=Mt?kr(t,e,Mt,"day"):e>=cn?kr(t,e,cn,"hour"):e>=ln?kr(t,e,ln,"minute"):e>=an?kr(t,e,an,"second"):t+" ms"}function kr(t,e,n,r){var s=e>=n*1.5;return Math.round(t/n)+" "+r+(s?"s":"")}});var Cu=Zn((sC,Su)=>{function Ry(t){n.debug=n,n.default=n,n.coerce=l,n.disable=o,n.enable=s,n.enabled=a,n.humanize=Eu(),n.destroy=c,Object.keys(t).forEach(u=>{n[u]=t[u]}),n.names=[],n.skips=[],n.formatters={};function e(u){let f=0;for(let d=0;d<u.length;d++)f=(f<<5)-f+u.charCodeAt(d),f|=0;return n.colors[Math.abs(f)%n.colors.length]}n.selectColor=e;function n(u){let f,d=null,p,h;function g(...m){if(!g.enabled)return;let w=g,b=Number(new Date),E=b-(f||b);w.diff=E,w.prev=f,w.curr=b,f=b,m[0]=n.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let S=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(F,W)=>{if(F==="%%")return"%";S++;let z=n.formatters[W];if(typeof z=="function"){let X=m[S];F=z.call(w,X),m.splice(S,1),S--}return F}),n.formatArgs.call(w,m),(w.log||n.log).apply(w,m)}return g.namespace=u,g.useColors=n.useColors(),g.color=n.selectColor(u),g.extend=r,g.destroy=n.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(p!==n.namespaces&&(p=n.namespaces,h=n.enabled(u)),h),set:m=>{d=m}}),typeof n.init=="function"&&n.init(g),g}function r(u,f){let d=n(this.namespace+(typeof f>"u"?":":f)+u);return d.log=this.log,d}function s(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let f=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of f)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}function i(u,f){let d=0,p=0,h=-1,g=0;for(;d<u.length;)if(p<f.length&&(f[p]===u[d]||f[p]==="*"))f[p]==="*"?(h=p,g=d,p++):(d++,p++);else if(h!==-1)p=h+1,g++,d=g;else return!1;for(;p<f.length&&f[p]==="*";)p++;return p===f.length}function o(){let u=[...n.names,...n.skips.map(f=>"-"+f)].join(",");return n.enable(""),u}function a(u){for(let f of n.skips)if(i(u,f))return!1;for(let f of n.names)if(i(u,f))return!0;return!1}function l(u){return u instanceof Error?u.stack||u.message:u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}Su.exports=Ry});var Au=Zn((Ue,Nr)=>{Ue.formatArgs=Py;Ue.save=Ty;Ue.load=Oy;Ue.useColors=Fy;Ue.storage=Dy();Ue.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Ue.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Fy(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Py(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Nr.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let n=0,r=0;t[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(n++,s==="%c"&&(r=n))}),t.splice(r,0,e)}Ue.log=console.debug||console.log||(()=>{});function Ty(t){try{t?Ue.storage.setItem("debug",t):Ue.storage.removeItem("debug")}catch{}}function Oy(){let t;try{t=Ue.storage.getItem("debug")||Ue.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function Dy(){try{return localStorage}catch{}}Nr.exports=Cu()(Ue);var{formatters:Ly}=Nr.exports;Ly.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var _t,Xs,ku,Nu,Iu,vu=C(()=>{Tn();_t={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Xs={get(t){return{signature:be.get(t,0),compressedSize:be.get(t,8),uncompressedSize:be.get(t,12)}},len:16},ku={get(t){let e=ge.get(t,6);return{signature:be.get(t,0),minVersion:ge.get(t,4),dataDescriptor:!!(e&8),compressedMethod:ge.get(t,8),compressedSize:be.get(t,18),uncompressedSize:be.get(t,22),filenameLength:ge.get(t,26),extraFieldLength:ge.get(t,28),filename:null}},len:30},Nu={get(t){return{signature:be.get(t,0),nrOfThisDisk:ge.get(t,4),nrOfThisDiskWithTheStart:ge.get(t,6),nrOfEntriesOnThisDisk:ge.get(t,8),nrOfEntriesOfSize:ge.get(t,10),sizeOfCd:be.get(t,12),offsetOfStartOfCd:be.get(t,16),zipFileCommentLength:ge.get(t,20)}},len:22},Iu={get(t){let e=ge.get(t,8);return{signature:be.get(t,0),minVersion:ge.get(t,6),dataDescriptor:!!(e&8),compressedMethod:ge.get(t,10),compressedSize:be.get(t,20),uncompressedSize:be.get(t,24),filenameLength:ge.get(t,28),extraFieldLength:ge.get(t,30),fileCommentLength:ge.get(t,32),relativeOffsetOfLocalHeader:be.get(t,42),filename:null}},len:46}});function Ru(t){let e=new Uint8Array(be.len);return be.put(e,0,t),e}function _y(t,e){let n=t.length,r=e.length;if(r>n)return-1;for(let s=0;s<=n-r;s++){let i=!0;for(let o=0;o<r;o++)if(t[s+o]!==e[o]){i=!1;break}if(i)return s}return-1}function By(t){let e=t.reduce((s,i)=>s+i.length,0),n=new Uint8Array(e),r=0;for(let s of t)n.set(s,r),r+=s.length;return n}var $u,lt,Js,My,Ir,Mn,Fu=C(()=>{Tn();$u=lo(Au(),1);vu();lt=(0,$u.default)("tokenizer:inflate"),Js=256*1024,My=Ru(_t.DataDescriptor),Ir=Ru(_t.EndOfCentralDirectory),Mn=class t{constructor(e){this.tokenizer=e,this.syncBuffer=new Uint8Array(Js)}async isZip(){return await this.peekSignature()===_t.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(be)}async findEndOfCentralDirectoryLocator(){let e=this.tokenizer,n=Math.min(16*1024,e.fileInfo.size),r=this.syncBuffer.subarray(0,n);await this.tokenizer.readBuffer(r,{position:e.fileInfo.size-n});for(let s=r.length-4;s>=0;s--)if(r[s]===Ir[0]&&r[s+1]===Ir[1]&&r[s+2]===Ir[2]&&r[s+3]===Ir[3])return e.fileInfo.size-n+s;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){lt("Cannot reading central-directory without random-read support");return}lt("Reading central-directory...");let e=this.tokenizer.position,n=await this.findEndOfCentralDirectoryLocator();if(n>0){lt("Central-directory 32-bit signature found");let r=await this.tokenizer.readToken(Nu,n),s=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let i=0;i<r.nrOfEntriesOfSize;++i){let o=await this.tokenizer.readToken(Iu);if(o.signature!==_t.CentralFileHeader)throw new Error("Expected Central-File-Header signature");o.filename=await this.tokenizer.readToken(new We(o.filenameLength,"utf-8")),await this.tokenizer.ignore(o.extraFieldLength),await this.tokenizer.ignore(o.fileCommentLength),s.push(o),lt(`Add central-directory file-entry: n=${i+1}/${s.length}: filename=${s[i].filename}`)}return this.tokenizer.setPosition(e),s}this.tokenizer.setPosition(e)}async unzip(e){let n=await this.readCentralDirectory();if(n)return this.iterateOverCentralDirectory(n,e);let r=!1;do{let s=await this.readLocalFileHeader();if(!s)break;let i=e(s);r=!!i.stop;let o;if(await this.tokenizer.ignore(s.extraFieldLength),s.dataDescriptor&&s.compressedSize===0){let a=[],l=Js;lt("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let c=-1;for(;c<0&&l===Js;){l=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),c=_y(this.syncBuffer.subarray(0,l),My);let u=c>=0?c:l;if(i.handler){let f=new Uint8Array(u);await this.tokenizer.readBuffer(f),a.push(f)}else await this.tokenizer.ignore(u)}lt(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),i.handler&&await this.inflate(s,By(a),i.handler)}else i.handler?(lt(`Reading compressed-file-data: ${s.compressedSize} bytes`),o=new Uint8Array(s.compressedSize),await this.tokenizer.readBuffer(o),await this.inflate(s,o,i.handler)):(lt(`Ignoring compressed-file-data: ${s.compressedSize} bytes`),await this.tokenizer.ignore(s.compressedSize));if(lt(`Reading data-descriptor at pos=${this.tokenizer.position}`),s.dataDescriptor&&(await this.tokenizer.readToken(Xs)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Xs.len}`)}while(!r)}async iterateOverCentralDirectory(e,n){for(let r of e){let s=n(r);if(s.handler){this.tokenizer.setPosition(r.relativeOffsetOfLocalHeader);let i=await this.readLocalFileHeader();if(i){await this.tokenizer.ignore(i.extraFieldLength);let o=new Uint8Array(r.compressedSize);await this.tokenizer.readBuffer(o),await this.inflate(i,o,s.handler)}}if(s.stop)break}}async inflate(e,n,r){if(e.compressedMethod===0)return r(n);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);lt(`Decompress filename=${e.filename}, compressed-size=${n.length}`);let s=await t.decompressDeflateRaw(n);return r(s)}static async decompressDeflateRaw(e){let n=new ReadableStream({start(i){i.enqueue(e),i.close()}}),r=new DecompressionStream("deflate-raw"),s=n.pipeThrough(r);try{let o=await new Response(s).arrayBuffer();return new Uint8Array(o)}catch(i){let o=i instanceof Error?`Failed to deflate ZIP entry: ${i.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(o)}}async readLocalFileHeader(){let e=await this.tokenizer.peekToken(be);if(e===_t.LocalFileHeader){let n=await this.tokenizer.readToken(ku);return n.filename=await this.tokenizer.readToken(new We(n.filenameLength,"utf-8")),n}if(e===_t.CentralFileHeader)return!1;throw e===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var _n,Pu=C(()=>{_n=class{constructor(e){this.tokenizer=e}inflate(){let e=this.tokenizer;return new ReadableStream({async pull(n){let r=new Uint8Array(1024),s=await e.readBuffer(r,{mayBeLess:!0});if(s===0){n.close();return}n.enqueue(r.subarray(0,s))}}).pipeThrough(new DecompressionStream("gzip"))}}});var Tu=C(()=>{Fu();Pu()});function Ys(t){let{byteLength:e}=t;if(e===6)return t.getUint16(0)*2**32+t.getUint32(2);if(e===5)return t.getUint8(0)*2**32+t.getUint32(1);if(e===4)return t.getUint32(0);if(e===3)return t.getUint8(0)*2**16+t.getUint16(1);if(e===2)return t.getUint16(0);if(e===1)return t.getUint8(0)}var hC,mC,gC,Ou=C(()=>{hC={utf8:new globalThis.TextDecoder("utf8")},mC=new globalThis.TextEncoder,gC=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"))});function Du(t,e){if(e==="utf-16le"){let n=[];for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);n.push(s&255,s>>8&255)}return n}if(e==="utf-16be"){let n=[];for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);n.push(s>>8&255,s&255)}return n}return[...t].map(n=>n.charCodeAt(0))}function Lu(t,e=0){let n=Number.parseInt(new We(6).get(t,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(n))return!1;let r=256;for(let s=e;s<e+148;s++)r+=t[s];for(let s=e+156;s<e+512;s++)r+=t[s];return n===r}var Mu,_u=C(()=>{Tn();Mu={get:(t,e)=>t[e+3]&127|t[e+2]<<7|t[e+1]<<14|t[e]<<21,len:4}});var Bu,Wu,Uu=C(()=>{Bu=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],Wu=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"]});async function ju(t,e){return new ni(e).fromBuffer(t)}function ti(t){switch(t=t.toLowerCase(),t){case"application/epub+zip":return{ext:"epub",mime:t};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:t};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:t};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:t};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:t};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:t};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:t};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:t};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:t};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:t};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:t};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:t};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:t};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:t};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:t};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:t};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function ct(t,e,n){n={offset:0,...n};for(let[r,s]of e.entries())if(n.mask){if(s!==(n.mask[r]&t[r+n.offset]))return!1}else if(s!==t[r+n.offset])return!1;return!0}var ei,ni,kC,NC,zu=C(()=>{Tn();wu();Tu();Ou();_u();Uu();ei=4100;ni=class{constructor(e){this.options={mpegOffsetTolerance:0,...e},this.detectors=[...e?.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:e?.signal}}async fromTokenizer(e){let n=e.position;for(let r of this.detectors){let s=await r.detect(e);if(s)return s;if(n!==e.position)return}}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);let n=e instanceof Uint8Array?e:new Uint8Array(e);if(n?.length>1)return this.fromTokenizer(yu(n,this.tokenizerOptions))}async fromBlob(e){let n=xu(e,this.tokenizerOptions);try{return await this.fromTokenizer(n)}finally{await n.close()}}async fromStream(e){let n=gu(e,this.tokenizerOptions);try{return await this.fromTokenizer(n)}finally{await n.close()}}async toDetectionStream(e,n){let{sampleSize:r=ei}=n,s,i,o=e.getReader({mode:"byob"});try{let{value:c,done:u}=await o.read(new Uint8Array(r));if(i=c,!u&&c)try{s=await this.fromBuffer(c.subarray(0,r))}catch(f){if(!(f instanceof pe))throw f;s=void 0}i=c}finally{o.releaseLock()}let a=new TransformStream({async start(c){c.enqueue(i)},transform(c,u){u.enqueue(c)}}),l=e.pipeThrough(a);return l.fileType=s,l}check(e,n){return ct(this.buffer,e,n)}checkString(e,n){return this.check(Du(e,n?.encoding),n)}detectConfident=async e=>{if(this.buffer=new Uint8Array(ei),e.fileInfo.size===void 0&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.detectConfident(e);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8])){let r=new _n(e).inflate(),s=!0;try{let i;try{i=await this.fromStream(r)}catch{s=!1}if(i&&i.ext==="tar")return{ext:"tar.gz",mime:"application/gzip"}}finally{s&&await r.cancel()}return{ext:"gz",mime:"application/gzip"}}if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);let n=await e.readToken(Mu);return e.position+n>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(n),this.fromTokenizer(e))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let n;return await new Mn(e).unzip(r=>{switch(r.filename){case"META-INF/mozilla.rsa":return n={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return n={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return{async handler(s){let i=new TextDecoder("utf-8").decode(s).trim();n=ti(i)},stop:!0};case"[Content_Types].xml":return{async handler(s){let i=new TextDecoder("utf-8").decode(s),o=i.indexOf('.main+xml"');if(o===-1){let a="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";i.includes(`ContentType="${a}"`)&&(n=ti(a))}else{i=i.slice(0,Math.max(0,o));let a=i.lastIndexOf('"'),l=i.slice(Math.max(0,a+1));n=ti(l)}},stop:!0};default:return/classes\d*\.dex/.test(r.filename)?(n={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}}).catch(r=>{if(!(r instanceof pe))throw r}),n??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);let n=new Uint8Array(8);return await e.readBuffer(n),ct(n,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:ct(n,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:ct(n,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:ct(n,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:ct(n,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:ct(n,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let n=await this.readTiffHeader(!1);if(n)return n}if(this.check([77,77])){let n=await this.readTiffHeader(!0);if(n)return n}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function n(){let a=await e.peekNumber(iu),l=128,c=0;for(;(a&l)===0&&l!==0;)++c,l>>=1;let u=new Uint8Array(c+1);return await e.readBuffer(u),u}async function r(){let a=await n(),l=await n();l[0]^=128>>l.length-1;let c=Math.min(6,l.length),u=new DataView(a.buffer),f=new DataView(l.buffer,l.length-c,c);return{id:Ys(u),len:Ys(f)}}async function s(a){for(;a>0;){let l=await r();if(l.id===17026)return(await e.readToken(new We(l.len))).replaceAll(/\00.*$/g,"");await e.ignore(l.len),--a}}let i=await r();switch(await s(i.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let n=new We(4,"latin1").get(this.buffer,2);if(n.match("^d*")&&n>=1e3&&n<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await e.ignore(8),await e.readToken(new We(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
551
+ `}return{stdout:c,stderr:"",exitCode:u}}}}var cy,wr=C(()=>{"use strict";j();cy={sha1:"SHA-1",sha256:"SHA-256"}});var Kc={};M(Kc,{md5sumCommand:()=>fy});var fy,Qc=C(()=>{"use strict";wr();fy=rn("md5sum","md5","compute MD5 message digest")});var Xc={};M(Xc,{sha1sumCommand:()=>dy});var dy,Jc=C(()=>{"use strict";wr();dy=rn("sha1sum","sha1","compute SHA1 message digest")});var Yc={};M(Yc,{sha256sumCommand:()=>py});var py,eu=C(()=>{"use strict";wr();py=rn("sha256sum","sha256","compute SHA256 message digest")});var tu=Zn(qs=>{qs.read=function(t,e,n,r,s){var i,o,a=s*8-r-1,l=(1<<a)-1,c=l>>1,u=-7,f=n?s-1:0,d=n?-1:1,p=t[e+f];for(f+=d,i=p&(1<<-u)-1,p>>=-u,u+=a;u>0;i=i*256+t[e+f],f+=d,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=r;u>0;o=o*256+t[e+f],f+=d,u-=8);if(i===0)i=1-c;else{if(i===l)return o?NaN:(p?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-c}return(p?-1:1)*o*Math.pow(2,i-r)};qs.write=function(t,e,n,r,s,i){var o,a,l,c=i*8-s-1,u=(1<<c)-1,f=u>>1,d=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,h=r?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(o++,l/=2),o+f>=u?(a=0,o=u):o+f>=1?(a=(e*l-1)*Math.pow(2,s),o=o+f):(a=e*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;t[n+p]=a&255,p+=h,a/=256,s-=8);for(o=o<<s|a,c+=s;c>0;t[n+p]=o&255,p+=h,o/=256,c-=8);t[n+p-h]|=g*128}});function nu(t,e="utf-8"){switch(e.toLowerCase()){case"utf-8":case"utf8":return typeof globalThis.TextDecoder<"u"?new globalThis.TextDecoder("utf-8").decode(t):my(t);case"utf-16le":return gy(t);case"ascii":return yy(t);case"latin1":case"iso-8859-1":return xy(t);case"windows-1252":return wy(t);default:throw new RangeError(`Encoding '${e}' not supported`)}}function my(t){let e="",n=0;for(;n<t.length;){let r=t[n++];if(r<128)e+=String.fromCharCode(r);else if(r<224){let s=t[n++]&63;e+=String.fromCharCode((r&31)<<6|s)}else if(r<240){let s=t[n++]&63,i=t[n++]&63;e+=String.fromCharCode((r&15)<<12|s<<6|i)}else{let s=t[n++]&63,i=t[n++]&63,o=t[n++]&63,a=(r&7)<<18|s<<12|i<<6|o;a-=65536,e+=String.fromCharCode(55296+(a>>10&1023),56320+(a&1023))}}return e}function gy(t){let e="";for(let n=0;n<t.length;n+=2)e+=String.fromCharCode(t[n]|t[n+1]<<8);return e}function yy(t){return String.fromCharCode(...t.map(e=>e&127))}function xy(t){return String.fromCharCode(...t)}function wy(t){let e="";for(let n of t)n>=128&&n<=159&&Vs[n]?e+=Vs[n]:e+=String.fromCharCode(n);return e}var Vs,hy,ru=C(()=>{Vs={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},hy={};for(let[t,e]of Object.entries(Vs))hy[e]=Number.parseInt(t)});function Be(t){return new DataView(t.buffer,t.byteOffset)}var su,iu,ge,sn,be,ou,au,lu,We,Tn=C(()=>{su=lo(tu(),1);ru();iu={len:1,get(t,e){return Be(t).getUint8(e)},put(t,e,n){return Be(t).setUint8(e,n),e+1}},ge={len:2,get(t,e){return Be(t).getUint16(e,!0)},put(t,e,n){return Be(t).setUint16(e,n,!0),e+2}},sn={len:2,get(t,e){return Be(t).getUint16(e)},put(t,e,n){return Be(t).setUint16(e,n),e+2}},be={len:4,get(t,e){return Be(t).getUint32(e,!0)},put(t,e,n){return Be(t).setUint32(e,n,!0),e+4}},ou={len:4,get(t,e){return Be(t).getUint32(e)},put(t,e,n){return Be(t).setUint32(e,n),e+4}},au={len:4,get(t,e){return Be(t).getInt32(e)},put(t,e,n){return Be(t).setInt32(e,n),e+4}},lu={len:8,get(t,e){return Be(t).getBigUint64(e,!0)},put(t,e,n){return Be(t).setBigUint64(e,n,!0),e+8}},We=class{constructor(e,n){this.len=e,this.encoding=n}get(e,n=0){let r=e.subarray(n,n+this.len);return nu(r,this.encoding)}}});var Ey,pe,Ot,On=C(()=>{Ey="End-Of-Stream",pe=class extends Error{constructor(){super(Ey),this.name="EndOfStreamError"}},Ot=class extends Error{constructor(e="The operation was aborted"){super(e),this.name="AbortError"}}});var cu=C(()=>{});var Dt,br=C(()=>{On();Dt=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,n=!1){let r=await this.read(e,n);return this.peekQueue.push(e.subarray(0,r)),r}async read(e,n=!1){if(e.length===0)return 0;let r=this.readFromPeekBuffer(e);if(this.endOfStream||(r+=await this.readRemainderFromStream(e.subarray(r),n)),r===0&&!n)throw new pe;return r}readFromPeekBuffer(e){let n=e.length,r=0;for(;this.peekQueue.length>0&&n>0;){let s=this.peekQueue.pop();if(!s)throw new Error("peekData should be defined");let i=Math.min(s.length,n);e.set(s.subarray(0,i),r),r+=i,n-=i,i<s.length&&this.peekQueue.push(s.subarray(i))}return r}async readRemainderFromStream(e,n){let r=0;for(;r<e.length&&!this.endOfStream;){if(this.interrupted)throw new Ot;let s=await this.readFromStream(e.subarray(r),n);if(s===0)break;r+=s}if(!n&&r<e.length)throw new pe;return r}}});var uu=C(()=>{On();cu();br()});var Er,fu=C(()=>{br();Er=class extends Dt{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var Dn,Zs=C(()=>{fu();Dn=class extends Er{async readFromStream(e,n){if(e.length===0)return 0;let r=await this.reader.read(new Uint8Array(e.length),{min:n?void 0:e.length});return r.done&&(this.endOfStream=r.done),r.value?(e.set(r.value),r.value.length):0}}});var on,Ks=C(()=>{On();br();on=class extends Dt{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,n){let r=Math.min(n.length,e.length);return e.set(n.subarray(0,r)),r<n.length?this.buffer=n.subarray(r):this.buffer=null,r}async readFromStream(e,n){if(e.length===0)return 0;let r=0;for(this.buffer&&(r+=this.writeChunk(e,this.buffer));r<e.length&&!this.endOfStream;){let s=await this.reader.read();if(s.done){this.endOfStream=!0;break}s.value&&(r+=this.writeChunk(e.subarray(r),s.value))}if(!n&&r===0&&this.endOfStream)throw new pe;return r}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}});function Qs(t){try{let e=t.getReader({mode:"byob"});return e instanceof ReadableStreamDefaultReader?new on(e):new Dn(e)}catch(e){if(e instanceof TypeError)return new on(t.getReader());throw e}}var du=C(()=>{Zs();Ks()});var Lt=C(()=>{On();uu();Zs();Ks();du()});var ft,Ln=C(()=>{Lt();ft=class{constructor(e){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=e?.onClose,e?.abortSignal&&e.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(e,n=this.position){let r=new Uint8Array(e.len);if(await this.readBuffer(r,{position:n})<e.len)throw new pe;return e.get(r,0)}async peekToken(e,n=this.position){let r=new Uint8Array(e.len);if(await this.peekBuffer(r,{position:n})<e.len)throw new pe;return e.get(r,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new pe;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new pe;return e.get(this.numBuffer,0)}async ignore(e){if(this.fileInfo.size!==void 0){let n=this.fileInfo.size-this.position;if(e>n)return this.position+=n,n}return this.position+=e,e}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(e,n){if(!this.supportsRandomAccess()&&n&&n.position!==void 0&&n.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:e.length,position:this.position,...n}}abort(){return Promise.resolve()}}});var Cy,Sr,pu=C(()=>{Ln();Lt();Cy=256e3,Sr=class extends ft{constructor(e,n){super(n),this.streamReader=e,this.fileInfo=n?.fileInfo??{}}async readBuffer(e,n){let r=this.normalizeOptions(e,n),s=r.position-this.position;if(s>0)return await this.ignore(s),this.readBuffer(e,n);if(s<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(r.length===0)return 0;let i=await this.streamReader.read(e.subarray(0,r.length),r.mayBeLess);if(this.position+=i,(!n||!n.mayBeLess)&&i<r.length)throw new pe;return i}async peekBuffer(e,n){let r=this.normalizeOptions(e,n),s=0;if(r.position){let i=r.position-this.position;if(i>0){let o=new Uint8Array(r.length+i);return s=await this.peekBuffer(o,{mayBeLess:r.mayBeLess}),e.set(o.subarray(i)),s-i}if(i<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{s=await this.streamReader.peek(e.subarray(0,r.length),r.mayBeLess)}catch(i){if(n?.mayBeLess&&i instanceof pe)return 0;throw i}if(!r.mayBeLess&&s<r.length)throw new pe}return s}async ignore(e){let n=Math.min(Cy,e),r=new Uint8Array(n),s=0;for(;s<e;){let i=e-s,o=await this.readBuffer(r,{length:Math.min(n,i)});if(o<0)return o;s+=o}return s}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}});var Cr,hu=C(()=>{Lt();Ln();Cr=class extends ft{constructor(e,n){super(n),this.uint8Array=e,this.fileInfo={...n?.fileInfo??{},size:e.length}}async readBuffer(e,n){n?.position&&(this.position=n.position);let r=await this.peekBuffer(e,n);return this.position+=r,r}async peekBuffer(e,n){let r=this.normalizeOptions(e,n),s=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&s<r.length)throw new pe;return e.set(this.uint8Array.subarray(r.position,r.position+s)),s}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}}});var Ar,mu=C(()=>{Lt();Ln();Ar=class extends ft{constructor(e,n){super(n),this.blob=e,this.fileInfo={...n?.fileInfo??{},size:e.size,mimeType:e.type}}async readBuffer(e,n){n?.position&&(this.position=n.position);let r=await this.peekBuffer(e,n);return this.position+=r,r}async peekBuffer(e,n){let r=this.normalizeOptions(e,n),s=Math.min(this.blob.size-r.position,r.length);if(!r.mayBeLess&&s<r.length)throw new pe;let i=await this.blob.slice(r.position,r.position+s).arrayBuffer();return e.set(new Uint8Array(i)),s}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}}});function gu(t,e){let n=Qs(t),r=e??{},s=r.onClose;return r.onClose=async()=>{if(await n.close(),s)return s()},new Sr(n,r)}function yu(t,e){return new Cr(t,e)}function xu(t,e){return new Ar(t,e)}var wu=C(()=>{Lt();pu();hu();mu();Lt();Ln()});var Eu=Zn((sC,bu)=>{var an=1e3,ln=an*60,cn=ln*60,Mt=cn*24,ky=Mt*7,Ny=Mt*365.25;bu.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return Iy(t);if(n==="number"&&isFinite(t))return e.long?$y(t):vy(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Iy(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*Ny;case"weeks":case"week":case"w":return n*ky;case"days":case"day":case"d":return n*Mt;case"hours":case"hour":case"hrs":case"hr":case"h":return n*cn;case"minutes":case"minute":case"mins":case"min":case"m":return n*ln;case"seconds":case"second":case"secs":case"sec":case"s":return n*an;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function vy(t){var e=Math.abs(t);return e>=Mt?Math.round(t/Mt)+"d":e>=cn?Math.round(t/cn)+"h":e>=ln?Math.round(t/ln)+"m":e>=an?Math.round(t/an)+"s":t+"ms"}function $y(t){var e=Math.abs(t);return e>=Mt?kr(t,e,Mt,"day"):e>=cn?kr(t,e,cn,"hour"):e>=ln?kr(t,e,ln,"minute"):e>=an?kr(t,e,an,"second"):t+" ms"}function kr(t,e,n,r){var s=e>=n*1.5;return Math.round(t/n)+" "+r+(s?"s":"")}});var Cu=Zn((iC,Su)=>{function Ry(t){n.debug=n,n.default=n,n.coerce=l,n.disable=o,n.enable=s,n.enabled=a,n.humanize=Eu(),n.destroy=c,Object.keys(t).forEach(u=>{n[u]=t[u]}),n.names=[],n.skips=[],n.formatters={};function e(u){let f=0;for(let d=0;d<u.length;d++)f=(f<<5)-f+u.charCodeAt(d),f|=0;return n.colors[Math.abs(f)%n.colors.length]}n.selectColor=e;function n(u){let f,d=null,p,h;function g(...m){if(!g.enabled)return;let w=g,b=Number(new Date),E=b-(f||b);w.diff=E,w.prev=f,w.curr=b,f=b,m[0]=n.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let S=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(F,W)=>{if(F==="%%")return"%";S++;let z=n.formatters[W];if(typeof z=="function"){let X=m[S];F=z.call(w,X),m.splice(S,1),S--}return F}),n.formatArgs.call(w,m),(w.log||n.log).apply(w,m)}return g.namespace=u,g.useColors=n.useColors(),g.color=n.selectColor(u),g.extend=r,g.destroy=n.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(p!==n.namespaces&&(p=n.namespaces,h=n.enabled(u)),h),set:m=>{d=m}}),typeof n.init=="function"&&n.init(g),g}function r(u,f){let d=n(this.namespace+(typeof f>"u"?":":f)+u);return d.log=this.log,d}function s(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let f=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of f)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}function i(u,f){let d=0,p=0,h=-1,g=0;for(;d<u.length;)if(p<f.length&&(f[p]===u[d]||f[p]==="*"))f[p]==="*"?(h=p,g=d,p++):(d++,p++);else if(h!==-1)p=h+1,g++,d=g;else return!1;for(;p<f.length&&f[p]==="*";)p++;return p===f.length}function o(){let u=[...n.names,...n.skips.map(f=>"-"+f)].join(",");return n.enable(""),u}function a(u){for(let f of n.skips)if(i(u,f))return!1;for(let f of n.names)if(i(u,f))return!0;return!1}function l(u){return u instanceof Error?u.stack||u.message:u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}Su.exports=Ry});var Au=Zn((Ue,Nr)=>{Ue.formatArgs=Py;Ue.save=Ty;Ue.load=Oy;Ue.useColors=Fy;Ue.storage=Dy();Ue.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Ue.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Fy(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Py(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Nr.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let n=0,r=0;t[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(n++,s==="%c"&&(r=n))}),t.splice(r,0,e)}Ue.log=console.debug||console.log||(()=>{});function Ty(t){try{t?Ue.storage.setItem("debug",t):Ue.storage.removeItem("debug")}catch{}}function Oy(){let t;try{t=Ue.storage.getItem("debug")||Ue.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function Dy(){try{return localStorage}catch{}}Nr.exports=Cu()(Ue);var{formatters:Ly}=Nr.exports;Ly.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var _t,Xs,ku,Nu,Iu,vu=C(()=>{Tn();_t={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Xs={get(t){return{signature:be.get(t,0),compressedSize:be.get(t,8),uncompressedSize:be.get(t,12)}},len:16},ku={get(t){let e=ge.get(t,6);return{signature:be.get(t,0),minVersion:ge.get(t,4),dataDescriptor:!!(e&8),compressedMethod:ge.get(t,8),compressedSize:be.get(t,18),uncompressedSize:be.get(t,22),filenameLength:ge.get(t,26),extraFieldLength:ge.get(t,28),filename:null}},len:30},Nu={get(t){return{signature:be.get(t,0),nrOfThisDisk:ge.get(t,4),nrOfThisDiskWithTheStart:ge.get(t,6),nrOfEntriesOnThisDisk:ge.get(t,8),nrOfEntriesOfSize:ge.get(t,10),sizeOfCd:be.get(t,12),offsetOfStartOfCd:be.get(t,16),zipFileCommentLength:ge.get(t,20)}},len:22},Iu={get(t){let e=ge.get(t,8);return{signature:be.get(t,0),minVersion:ge.get(t,6),dataDescriptor:!!(e&8),compressedMethod:ge.get(t,10),compressedSize:be.get(t,20),uncompressedSize:be.get(t,24),filenameLength:ge.get(t,28),extraFieldLength:ge.get(t,30),fileCommentLength:ge.get(t,32),relativeOffsetOfLocalHeader:be.get(t,42),filename:null}},len:46}});function Ru(t){let e=new Uint8Array(be.len);return be.put(e,0,t),e}function _y(t,e){let n=t.length,r=e.length;if(r>n)return-1;for(let s=0;s<=n-r;s++){let i=!0;for(let o=0;o<r;o++)if(t[s+o]!==e[o]){i=!1;break}if(i)return s}return-1}function By(t){let e=t.reduce((s,i)=>s+i.length,0),n=new Uint8Array(e),r=0;for(let s of t)n.set(s,r),r+=s.length;return n}var $u,lt,Js,My,Ir,Mn,Fu=C(()=>{Tn();$u=lo(Au(),1);vu();lt=(0,$u.default)("tokenizer:inflate"),Js=256*1024,My=Ru(_t.DataDescriptor),Ir=Ru(_t.EndOfCentralDirectory),Mn=class t{constructor(e){this.tokenizer=e,this.syncBuffer=new Uint8Array(Js)}async isZip(){return await this.peekSignature()===_t.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(be)}async findEndOfCentralDirectoryLocator(){let e=this.tokenizer,n=Math.min(16*1024,e.fileInfo.size),r=this.syncBuffer.subarray(0,n);await this.tokenizer.readBuffer(r,{position:e.fileInfo.size-n});for(let s=r.length-4;s>=0;s--)if(r[s]===Ir[0]&&r[s+1]===Ir[1]&&r[s+2]===Ir[2]&&r[s+3]===Ir[3])return e.fileInfo.size-n+s;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){lt("Cannot reading central-directory without random-read support");return}lt("Reading central-directory...");let e=this.tokenizer.position,n=await this.findEndOfCentralDirectoryLocator();if(n>0){lt("Central-directory 32-bit signature found");let r=await this.tokenizer.readToken(Nu,n),s=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let i=0;i<r.nrOfEntriesOfSize;++i){let o=await this.tokenizer.readToken(Iu);if(o.signature!==_t.CentralFileHeader)throw new Error("Expected Central-File-Header signature");o.filename=await this.tokenizer.readToken(new We(o.filenameLength,"utf-8")),await this.tokenizer.ignore(o.extraFieldLength),await this.tokenizer.ignore(o.fileCommentLength),s.push(o),lt(`Add central-directory file-entry: n=${i+1}/${s.length}: filename=${s[i].filename}`)}return this.tokenizer.setPosition(e),s}this.tokenizer.setPosition(e)}async unzip(e){let n=await this.readCentralDirectory();if(n)return this.iterateOverCentralDirectory(n,e);let r=!1;do{let s=await this.readLocalFileHeader();if(!s)break;let i=e(s);r=!!i.stop;let o;if(await this.tokenizer.ignore(s.extraFieldLength),s.dataDescriptor&&s.compressedSize===0){let a=[],l=Js;lt("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let c=-1;for(;c<0&&l===Js;){l=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),c=_y(this.syncBuffer.subarray(0,l),My);let u=c>=0?c:l;if(i.handler){let f=new Uint8Array(u);await this.tokenizer.readBuffer(f),a.push(f)}else await this.tokenizer.ignore(u)}lt(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),i.handler&&await this.inflate(s,By(a),i.handler)}else i.handler?(lt(`Reading compressed-file-data: ${s.compressedSize} bytes`),o=new Uint8Array(s.compressedSize),await this.tokenizer.readBuffer(o),await this.inflate(s,o,i.handler)):(lt(`Ignoring compressed-file-data: ${s.compressedSize} bytes`),await this.tokenizer.ignore(s.compressedSize));if(lt(`Reading data-descriptor at pos=${this.tokenizer.position}`),s.dataDescriptor&&(await this.tokenizer.readToken(Xs)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Xs.len}`)}while(!r)}async iterateOverCentralDirectory(e,n){for(let r of e){let s=n(r);if(s.handler){this.tokenizer.setPosition(r.relativeOffsetOfLocalHeader);let i=await this.readLocalFileHeader();if(i){await this.tokenizer.ignore(i.extraFieldLength);let o=new Uint8Array(r.compressedSize);await this.tokenizer.readBuffer(o),await this.inflate(i,o,s.handler)}}if(s.stop)break}}async inflate(e,n,r){if(e.compressedMethod===0)return r(n);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);lt(`Decompress filename=${e.filename}, compressed-size=${n.length}`);let s=await t.decompressDeflateRaw(n);return r(s)}static async decompressDeflateRaw(e){let n=new ReadableStream({start(i){i.enqueue(e),i.close()}}),r=new DecompressionStream("deflate-raw"),s=n.pipeThrough(r);try{let o=await new Response(s).arrayBuffer();return new Uint8Array(o)}catch(i){let o=i instanceof Error?`Failed to deflate ZIP entry: ${i.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(o)}}async readLocalFileHeader(){let e=await this.tokenizer.peekToken(be);if(e===_t.LocalFileHeader){let n=await this.tokenizer.readToken(ku);return n.filename=await this.tokenizer.readToken(new We(n.filenameLength,"utf-8")),n}if(e===_t.CentralFileHeader)return!1;throw e===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var _n,Pu=C(()=>{_n=class{constructor(e){this.tokenizer=e}inflate(){let e=this.tokenizer;return new ReadableStream({async pull(n){let r=new Uint8Array(1024),s=await e.readBuffer(r,{mayBeLess:!0});if(s===0){n.close();return}n.enqueue(r.subarray(0,s))}}).pipeThrough(new DecompressionStream("gzip"))}}});var Tu=C(()=>{Fu();Pu()});function Ys(t){let{byteLength:e}=t;if(e===6)return t.getUint16(0)*2**32+t.getUint32(2);if(e===5)return t.getUint8(0)*2**32+t.getUint32(1);if(e===4)return t.getUint32(0);if(e===3)return t.getUint8(0)*2**16+t.getUint16(1);if(e===2)return t.getUint16(0);if(e===1)return t.getUint8(0)}var mC,gC,yC,Ou=C(()=>{mC={utf8:new globalThis.TextDecoder("utf8")},gC=new globalThis.TextEncoder,yC=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"))});function Du(t,e){if(e==="utf-16le"){let n=[];for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);n.push(s&255,s>>8&255)}return n}if(e==="utf-16be"){let n=[];for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);n.push(s>>8&255,s&255)}return n}return[...t].map(n=>n.charCodeAt(0))}function Lu(t,e=0){let n=Number.parseInt(new We(6).get(t,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(n))return!1;let r=256;for(let s=e;s<e+148;s++)r+=t[s];for(let s=e+156;s<e+512;s++)r+=t[s];return n===r}var Mu,_u=C(()=>{Tn();Mu={get:(t,e)=>t[e+3]&127|t[e+2]<<7|t[e+1]<<14|t[e]<<21,len:4}});var Bu,Wu,Uu=C(()=>{Bu=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],Wu=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"]});async function ju(t,e){return new ni(e).fromBuffer(t)}function ti(t){switch(t=t.toLowerCase(),t){case"application/epub+zip":return{ext:"epub",mime:t};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:t};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:t};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:t};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:t};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:t};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:t};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:t};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:t};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:t};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:t};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:t};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:t};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:t};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:t};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:t};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function ct(t,e,n){n={offset:0,...n};for(let[r,s]of e.entries())if(n.mask){if(s!==(n.mask[r]&t[r+n.offset]))return!1}else if(s!==t[r+n.offset])return!1;return!0}var ei,ni,NC,IC,zu=C(()=>{Tn();wu();Tu();Ou();_u();Uu();ei=4100;ni=class{constructor(e){this.options={mpegOffsetTolerance:0,...e},this.detectors=[...e?.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:e?.signal}}async fromTokenizer(e){let n=e.position;for(let r of this.detectors){let s=await r.detect(e);if(s)return s;if(n!==e.position)return}}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);let n=e instanceof Uint8Array?e:new Uint8Array(e);if(n?.length>1)return this.fromTokenizer(yu(n,this.tokenizerOptions))}async fromBlob(e){let n=xu(e,this.tokenizerOptions);try{return await this.fromTokenizer(n)}finally{await n.close()}}async fromStream(e){let n=gu(e,this.tokenizerOptions);try{return await this.fromTokenizer(n)}finally{await n.close()}}async toDetectionStream(e,n){let{sampleSize:r=ei}=n,s,i,o=e.getReader({mode:"byob"});try{let{value:c,done:u}=await o.read(new Uint8Array(r));if(i=c,!u&&c)try{s=await this.fromBuffer(c.subarray(0,r))}catch(f){if(!(f instanceof pe))throw f;s=void 0}i=c}finally{o.releaseLock()}let a=new TransformStream({async start(c){c.enqueue(i)},transform(c,u){u.enqueue(c)}}),l=e.pipeThrough(a);return l.fileType=s,l}check(e,n){return ct(this.buffer,e,n)}checkString(e,n){return this.check(Du(e,n?.encoding),n)}detectConfident=async e=>{if(this.buffer=new Uint8Array(ei),e.fileInfo.size===void 0&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.detectConfident(e);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8])){let r=new _n(e).inflate(),s=!0;try{let i;try{i=await this.fromStream(r)}catch{s=!1}if(i&&i.ext==="tar")return{ext:"tar.gz",mime:"application/gzip"}}finally{s&&await r.cancel()}return{ext:"gz",mime:"application/gzip"}}if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);let n=await e.readToken(Mu);return e.position+n>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(n),this.fromTokenizer(e))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let n;return await new Mn(e).unzip(r=>{switch(r.filename){case"META-INF/mozilla.rsa":return n={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return n={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return{async handler(s){let i=new TextDecoder("utf-8").decode(s).trim();n=ti(i)},stop:!0};case"[Content_Types].xml":return{async handler(s){let i=new TextDecoder("utf-8").decode(s),o=i.indexOf('.main+xml"');if(o===-1){let a="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";i.includes(`ContentType="${a}"`)&&(n=ti(a))}else{i=i.slice(0,Math.max(0,o));let a=i.lastIndexOf('"'),l=i.slice(Math.max(0,a+1));n=ti(l)}},stop:!0};default:return/classes\d*\.dex/.test(r.filename)?(n={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}}).catch(r=>{if(!(r instanceof pe))throw r}),n??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);let n=new Uint8Array(8);return await e.readBuffer(n),ct(n,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:ct(n,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:ct(n,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:ct(n,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:ct(n,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:ct(n,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let n=await this.readTiffHeader(!1);if(n)return n}if(this.check([77,77])){let n=await this.readTiffHeader(!0);if(n)return n}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function n(){let a=await e.peekNumber(iu),l=128,c=0;for(;(a&l)===0&&l!==0;)++c,l>>=1;let u=new Uint8Array(c+1);return await e.readBuffer(u),u}async function r(){let a=await n(),l=await n();l[0]^=128>>l.length-1;let c=Math.min(6,l.length),u=new DataView(a.buffer),f=new DataView(l.buffer,l.length-c,c);return{id:Ys(u),len:Ys(f)}}async function s(a){for(;a>0;){let l=await r();if(l.id===17026)return(await e.readToken(new We(l.len))).replaceAll(/\00.*$/g,"");await e.ignore(l.len),--a}}let i=await r();switch(await s(i.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let n=new We(4,"latin1").get(this.buffer,2);if(n.match("^d*")&&n>=1e3&&n<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await e.ignore(8),await e.readToken(new We(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
552
552
  `,"\r"," "," ","\0"].some(n=>this.checkString(n,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){await e.ignore(8);async function n(){return{length:await e.readToken(au),type:await e.readToken(new We(4,"latin1"))}}do{let r=await n();if(r.length<0)return;switch(r.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(r.length+4)}}while(e.position+8<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&(this.buffer[8]&96)!==0){let n=new We(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(n){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return n.startsWith("3g")?n.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
553
553
  `))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function n(){let r=new Uint8Array(16);return await e.readBuffer(r),{id:r,size:Number(await e.readToken(lu))}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){let r=await n(),s=r.size-24;if(ct(r.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let i=new Uint8Array(16);if(s-=await e.readBuffer(i),ct(i,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(ct(i,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await e.ignore(s)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await e.ignore(20),await e.readToken(new We(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let n=new DataView(this.buffer.buffer).getUint32(12,!0);if(n>12&&this.buffer.length>=n+16)try{let r=new TextDecoder().decode(this.buffer.subarray(16,n+16));if(JSON.parse(r).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&Lu(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){let n="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:n})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:n})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
554
- `,{offset:2,encoding:n})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}};detectImprecise=async e=>{if(this.buffer=new Uint8Array(ei),await e.peekBuffer(this.buffer,{length:Math.min(8,e.fileInfo.size),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await e.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,e.fileInfo.size),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let n=0;n<=this.options.mpegOffsetTolerance;++n){let r=this.scanMpeg(n);if(r)return r}};async readTiffTag(e){let n=await this.tokenizer.readToken(e?sn:ge);switch(this.tokenizer.ignore(10),n){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(e){let n=await this.tokenizer.readToken(e?sn:ge);for(let r=0;r<n;++r){let s=await this.readTiffTag(e);if(s)return s}}async readTiffHeader(e){let n=(e?sn:ge).get(this.buffer,2),r=(e?ou:be).get(this.buffer,4);if(n===42){if(r>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(r>=8){let i=(e?sn:ge).get(this.buffer,8),o=(e?sn:ge).get(this.buffer,10);if(i===28&&o===254||i===31&&o===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}return await this.tokenizer.ignore(r),await this.readTiffIFD(e)??{ext:"tif",mime:"image/tiff"}}if(n===43)return{ext:"tif",mime:"image/tiff"}}scanMpeg(e){if(this.check([255,224],{offset:e,mask:[255,224]})){if(this.check([16],{offset:e+1,mask:[22]}))return this.check([8],{offset:e+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:e+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:e+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:e+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},kC=new Set(Bu),NC=new Set(Wu)});var qu={};M(qu,{fileCommand:()=>Gy});function Uy(t,e){if(Gu[t])return Gu[t];let[n,r]=e.split("/"),s=r?.split("+")[0]?.replace(/-/g," ")||t;switch(n){case"image":return`${s.toUpperCase()} image data`;case"audio":return`${s.toUpperCase()} audio`;case"video":return`${s.toUpperCase()} video`;case"font":return`${s} font`;case"model":return`${s} 3D model`;case"application":return r?.includes("zip")||r?.includes("compressed")?`${s} archive data`:r?.includes("executable")?`${s} executable`:`${t.toUpperCase()} data`;default:return`${t.toUpperCase()} data`}}function jy(t){let e=t.split("/").pop()||t;if(e.startsWith(".")&&!e.includes(".",1))return e;let n=e.lastIndexOf(".");return n===-1||n===0?"":e.slice(n).toLowerCase()}function zy(t,e){if(t.startsWith("#!")){let l=t.split(`
554
+ `,{offset:2,encoding:n})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}};detectImprecise=async e=>{if(this.buffer=new Uint8Array(ei),await e.peekBuffer(this.buffer,{length:Math.min(8,e.fileInfo.size),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await e.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,e.fileInfo.size),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let n=0;n<=this.options.mpegOffsetTolerance;++n){let r=this.scanMpeg(n);if(r)return r}};async readTiffTag(e){let n=await this.tokenizer.readToken(e?sn:ge);switch(this.tokenizer.ignore(10),n){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(e){let n=await this.tokenizer.readToken(e?sn:ge);for(let r=0;r<n;++r){let s=await this.readTiffTag(e);if(s)return s}}async readTiffHeader(e){let n=(e?sn:ge).get(this.buffer,2),r=(e?ou:be).get(this.buffer,4);if(n===42){if(r>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(r>=8){let i=(e?sn:ge).get(this.buffer,8),o=(e?sn:ge).get(this.buffer,10);if(i===28&&o===254||i===31&&o===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}return await this.tokenizer.ignore(r),await this.readTiffIFD(e)??{ext:"tif",mime:"image/tiff"}}if(n===43)return{ext:"tif",mime:"image/tiff"}}scanMpeg(e){if(this.check([255,224],{offset:e,mask:[255,224]})){if(this.check([16],{offset:e+1,mask:[22]}))return this.check([8],{offset:e+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:e+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:e+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:e+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},NC=new Set(Bu),IC=new Set(Wu)});var qu={};M(qu,{fileCommand:()=>Gy});function Uy(t,e){if(Gu[t])return Gu[t];let[n,r]=e.split("/"),s=r?.split("+")[0]?.replace(/-/g," ")||t;switch(n){case"image":return`${s.toUpperCase()} image data`;case"audio":return`${s.toUpperCase()} audio`;case"video":return`${s.toUpperCase()} video`;case"font":return`${s} font`;case"model":return`${s} 3D model`;case"application":return r?.includes("zip")||r?.includes("compressed")?`${s} archive data`:r?.includes("executable")?`${s} executable`:`${t.toUpperCase()} data`;default:return`${t.toUpperCase()} data`}}function jy(t){let e=t.split("/").pop()||t;if(e.startsWith(".")&&!e.includes(".",1))return e;let n=e.lastIndexOf(".");return n===-1||n===0?"":e.slice(n).toLowerCase()}function zy(t,e){if(t.startsWith("#!")){let l=t.split(`
555
555
  `)[0];return l.includes("python")?{description:"Python script, ASCII text executable",mime:"text/x-python"}:l.includes("node")||l.includes("bun")||l.includes("deno")?{description:"JavaScript script, ASCII text executable",mime:"text/javascript"}:l.includes("bash")?{description:"Bourne-Again shell script, ASCII text executable",mime:"text/x-shellscript"}:l.includes("sh")?{description:"POSIX shell script, ASCII text executable",mime:"text/x-shellscript"}:l.includes("ruby")?{description:"Ruby script, ASCII text executable",mime:"text/x-ruby"}:l.includes("perl")?{description:"Perl script, ASCII text executable",mime:"text/x-perl"}:{description:"script, ASCII text executable",mime:"text/plain"}}let n=t.trimStart();if(n.startsWith("<?xml"))return{description:"XML document",mime:"application/xml"};if(n.startsWith("<!DOCTYPE html")||n.toLowerCase().startsWith("<html"))return{description:"HTML document",mime:"text/html"};let r=t.includes(`\r
556
556
  `),s=t.includes("\r")&&!r,i="";r?i=", with CRLF line terminators":s&&(i=", with CR line terminators");let o=jy(e);if(o&&Hu[o]){let l=Hu[o];return l.mime.startsWith("text/")&&i?{description:`${l.description}${i}`,mime:l.mime}:l}let a=!1;for(let l=0;l<Math.min(t.length,8192);l++)if(t.charCodeAt(l)>127){a=!0;break}return a?{description:`UTF-8 Unicode text${i}`,mime:"text/plain; charset=utf-8"}:{description:`ASCII text${i}`,mime:"text/plain"}}async function Hy(t,e){if(e.length===0)return{description:"empty",mime:"inode/x-empty"};let n=await ju(e);if(n)return{description:Uy(n.ext,n.mime),mime:n.mime};let r=new TextDecoder("utf-8",{fatal:!1}).decode(e);return zy(r,t)}var Wy,Hu,Gu,Gy,Vu=C(()=>{"use strict";zu();j();Wy={name:"file",summary:"determine file type",usage:"file [OPTION]... FILE...",options:["-b, --brief do not prepend filenames to output","-i, --mime output MIME type strings","-L, --dereference follow symlinks"," --help display this help and exit"]},Hu={".js":{description:"JavaScript source",mime:"text/javascript"},".mjs":{description:"JavaScript module",mime:"text/javascript"},".cjs":{description:"CommonJS module",mime:"text/javascript"},".ts":{description:"TypeScript source",mime:"text/typescript"},".tsx":{description:"TypeScript JSX source",mime:"text/typescript"},".jsx":{description:"JavaScript JSX source",mime:"text/javascript"},".py":{description:"Python script",mime:"text/x-python"},".rb":{description:"Ruby script",mime:"text/x-ruby"},".go":{description:"Go source",mime:"text/x-go"},".rs":{description:"Rust source",mime:"text/x-rust"},".c":{description:"C source",mime:"text/x-c"},".h":{description:"C header",mime:"text/x-c"},".cpp":{description:"C++ source",mime:"text/x-c++"},".hpp":{description:"C++ header",mime:"text/x-c++"},".java":{description:"Java source",mime:"text/x-java"},".sh":{description:"Bourne-Again shell script",mime:"text/x-shellscript"},".bash":{description:"Bourne-Again shell script",mime:"text/x-shellscript"},".zsh":{description:"Zsh shell script",mime:"text/x-shellscript"},".json":{description:"JSON data",mime:"application/json"},".yaml":{description:"YAML data",mime:"text/yaml"},".yml":{description:"YAML data",mime:"text/yaml"},".xml":{description:"XML document",mime:"application/xml"},".csv":{description:"CSV text",mime:"text/csv"},".toml":{description:"TOML data",mime:"text/toml"},".html":{description:"HTML document",mime:"text/html"},".htm":{description:"HTML document",mime:"text/html"},".css":{description:"CSS stylesheet",mime:"text/css"},".svg":{description:"SVG image",mime:"image/svg+xml"},".md":{description:"Markdown document",mime:"text/markdown"},".markdown":{description:"Markdown document",mime:"text/markdown"},".txt":{description:"ASCII text",mime:"text/plain"},".rst":{description:"reStructuredText",mime:"text/x-rst"},".env":{description:"ASCII text",mime:"text/plain"},".gitignore":{description:"ASCII text",mime:"text/plain"},".dockerignore":{description:"ASCII text",mime:"text/plain"}},Gu={jpg:"JPEG image data",jpeg:"JPEG image data",png:"PNG image data",gif:"GIF image data",webp:"WebP image data",bmp:"PC bitmap",ico:"MS Windows icon resource",tif:"TIFF image data",tiff:"TIFF image data",psd:"Adobe Photoshop Document",avif:"AVIF image",heic:"HEIC image",heif:"HEIF image",jxl:"JPEG XL image",icns:"Mac OS X icon",svg:"SVG Scalable Vector Graphics image",pdf:"PDF document",epub:"EPUB document",mobi:"Mobipocket E-book",djvu:"DjVu document",zip:"Zip archive data",gz:"gzip compressed data",gzip:"gzip compressed data",bz2:"bzip2 compressed data",xz:"XZ compressed data",tar:"POSIX tar archive",rar:"RAR archive data","7z":"7-zip archive data",lz:"lzip compressed data",lzma:"LZMA compressed data",zst:"Zstandard compressed data",cab:"Microsoft Cabinet archive",ar:"Unix ar archive",rpm:"RPM package",deb:"Debian binary package",apk:"Android Package",dmg:"Apple disk image",iso:"ISO 9660 CD-ROM filesystem data",vhd:"Microsoft Virtual Hard Disk",vhdx:"Microsoft Virtual Hard Disk (new format)",qcow2:"QEMU QCOW Image",mp3:"Audio file with ID3",m4a:"MPEG-4 audio",aac:"AAC audio",wav:"RIFF (little-endian) data, WAVE audio",flac:"FLAC audio bitstream data",ogg:"Ogg data",oga:"Ogg audio",opus:"Ogg Opus audio",aiff:"AIFF audio",wma:"Windows Media Audio",amr:"AMR audio",mid:"MIDI audio",midi:"MIDI audio",ape:"Monkey's Audio",mp4:"ISO Media, MPEG-4",m4v:"MPEG-4 video",webm:"WebM",avi:"RIFF (little-endian) data, AVI",mov:"ISO Media, Apple QuickTime movie",mkv:"Matroska data",wmv:"Windows Media Video",flv:"Flash Video","3gp":"3GPP multimedia","3g2":"3GPP2 multimedia",ogv:"Ogg video",mts:"MPEG transport stream",m2ts:"MPEG transport stream",ts:"MPEG transport stream",mpg:"MPEG video",mpeg:"MPEG video",exe:"PE32 executable",dll:"PE32 DLL",elf:"ELF executable",mach:"Mach-O executable",wasm:"WebAssembly (wasm) binary module",dex:"Android Dalvik executable",class:"Java class file",swf:"Adobe Flash",doc:"Microsoft Word Document",docx:"Microsoft Word 2007+ Document",xls:"Microsoft Excel Spreadsheet",xlsx:"Microsoft Excel 2007+ Spreadsheet",ppt:"Microsoft PowerPoint Presentation",pptx:"Microsoft PowerPoint 2007+ Presentation",odt:"OpenDocument Text",ods:"OpenDocument Spreadsheet",odp:"OpenDocument Presentation",ttf:"TrueType Font",otf:"OpenType Font",woff:"Web Open Font Format",woff2:"Web Open Font Format 2",eot:"Embedded OpenType font",stl:"Stereolithography CAD",obj:"Wavefront 3D Object",gltf:"GL Transmission Format",glb:"GL Transmission Format (binary)",sqlite:"SQLite 3.x database",mdb:"Microsoft Access Database",xml:"XML document",json:"JSON data",macho:"Mach-O binary",ics:"iCalendar data",vcf:"vCard data",msi:"Microsoft Installer",ps:"PostScript",ai:"Adobe Illustrator",indd:"Adobe InDesign",sketch:"Sketch design file",fig:"Figma design file",xd:"Adobe XD",blend:"Blender",fbx:"Autodesk FBX",lnk:"MS Windows shortcut",alias:"Mac OS alias",torrent:"BitTorrent file",pcap:"pcap capture file",arrow:"Apache Arrow",parquet:"Apache Parquet"};Gy={name:"file",async execute(t,e){if(I(t))return N(Wy);let n=!1,r=!1,s=[];for(let a of t)if(a.startsWith("--")){if(a==="--brief")n=!0;else if(a==="--mime"||a==="--mime-type")r=!0;else if(a!=="--dereference")return L("file",a)}else if(a.startsWith("-")&&a!=="-"){for(let l of a.slice(1))if(l==="b")n=!0;else if(l==="i")r=!0;else if(l!=="L")return L("file",`-${l}`)}else s.push(a);if(s.length===0)return{stdout:"",stderr:`Usage: file [-bLi] FILE...
557
557
  `,exitCode:1};let i="",o=0;for(let a of s)try{let l=e.fs.resolvePath(e.cwd,a);if((await e.fs.stat(l)).isDirectory){let p=r?"inode/directory":"directory";i+=n?`${p}
@@ -654,7 +654,7 @@ Gid: ${r} ${r} ${r} ${r}
654
654
  `}function vx(t){let e=t;return typeof e.mkdirSync=="function"&&typeof e.writeFileSync=="function"}function $x(t,e){t.mkdirSync("/bin",{recursive:!0}),t.mkdirSync("/usr/bin",{recursive:!0}),e&&(t.mkdirSync("/home/user",{recursive:!0}),t.mkdirSync("/tmp",{recursive:!0}))}function Rx(t){t.mkdirSync("/dev",{recursive:!0}),t.writeFileSync("/dev/null",""),t.writeFileSync("/dev/zero",new Uint8Array(0)),t.writeFileSync("/dev/stdin",""),t.writeFileSync("/dev/stdout",""),t.writeFileSync("/dev/stderr","")}function Fx(t){t.mkdirSync("/proc/self/fd",{recursive:!0}),t.writeFileSync("/proc/version",`${Rf}
655
655
  `),t.writeFileSync("/proc/self/exe","/bin/bash"),t.writeFileSync("/proc/self/cmdline","bash\0"),t.writeFileSync("/proc/self/comm",`bash
656
656
  `),t.writeFileSync("/proc/self/status",Ff()),t.writeFileSync("/proc/self/fd/0","/dev/stdin"),t.writeFileSync("/proc/self/fd/1","/dev/stdout"),t.writeFileSync("/proc/self/fd/2","/dev/stderr")}function Pf(t,e){vx(t)&&($x(t,e),Rx(t),Fx(t))}de();var Px=["tar","yq","xan","sqlite3"];function Tf(t){return Px.includes(t)}de();function ve(t,e){return{type:"ArithmeticExpression",expression:dt(t,e,0).expr}}function dt(t,e,n){return Tx(t,e,n)}function Tx(t,e,n){let{expr:r,pos:s}=Or(t,e,n);for(s=xe(e,s);e[s]===",";){s++;let{expr:i,pos:o}=Or(t,e,s);r={type:"ArithBinary",operator:",",left:r,right:i},s=xe(e,o)}return{expr:r,pos:s}}function Or(t,e,n){let{expr:r,pos:s}=Ox(t,e,n);if(s=xe(e,s),e[s]==="?"){s++;let{expr:i,pos:o}=dt(t,e,s);if(s=xe(e,o),e[s]===":"){s++;let{expr:a,pos:l}=dt(t,e,s);return{expr:{type:"ArithTernary",condition:r,consequent:i,alternate:a},pos:l}}}return{expr:r,pos:s}}function Ox(t,e,n){let{expr:r,pos:s}=Of(t,e,n);for(;s=xe(e,s),e.slice(s,s+2)==="||";){s+=2;let{expr:i,pos:o}=Of(t,e,s);r={type:"ArithBinary",operator:"||",left:r,right:i},s=o}return{expr:r,pos:s}}function Of(t,e,n){let{expr:r,pos:s}=Df(t,e,n);for(;s=xe(e,s),e.slice(s,s+2)==="&&";){s+=2;let{expr:i,pos:o}=Df(t,e,s);r={type:"ArithBinary",operator:"&&",left:r,right:i},s=o}return{expr:r,pos:s}}function Df(t,e,n){let{expr:r,pos:s}=Lf(t,e,n);for(;s=xe(e,s),e[s]==="|"&&e[s+1]!=="|";){s++;let{expr:i,pos:o}=Lf(t,e,s);r={type:"ArithBinary",operator:"|",left:r,right:i},s=o}return{expr:r,pos:s}}function Lf(t,e,n){let{expr:r,pos:s}=Mf(t,e,n);for(;s=xe(e,s),e[s]==="^";){s++;let{expr:i,pos:o}=Mf(t,e,s);r={type:"ArithBinary",operator:"^",left:r,right:i},s=o}return{expr:r,pos:s}}function Mf(t,e,n){let{expr:r,pos:s}=_f(t,e,n);for(;s=xe(e,s),e[s]==="&"&&e[s+1]!=="&";){s++;let{expr:i,pos:o}=_f(t,e,s);r={type:"ArithBinary",operator:"&",left:r,right:i},s=o}return{expr:r,pos:s}}function _f(t,e,n){let{expr:r,pos:s}=Bf(t,e,n);for(;s=xe(e,s),e.slice(s,s+2)==="=="||e.slice(s,s+2)==="!=";){let i=e.slice(s,s+2);s+=2;let{expr:o,pos:a}=Bf(t,e,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function Bf(t,e,n){let{expr:r,pos:s}=pi(t,e,n);for(;;)if(s=xe(e,s),e.slice(s,s+2)==="<="||e.slice(s,s+2)===">="){let i=e.slice(s,s+2);s+=2;let{expr:o,pos:a}=pi(t,e,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else if(e[s]==="<"||e[s]===">"){let i=e[s];s++;let{expr:o,pos:a}=pi(t,e,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function pi(t,e,n){let{expr:r,pos:s}=Wf(t,e,n);for(;s=xe(e,s),e.slice(s,s+2)==="<<"||e.slice(s,s+2)===">>";){let i=e.slice(s,s+2);s+=2;let{expr:o,pos:a}=Wf(t,e,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function Wf(t,e,n){let{expr:r,pos:s}=Uf(t,e,n);for(;s=xe(e,s),(e[s]==="+"||e[s]==="-")&&e[s+1]!==e[s];){let i=e[s];s++;let{expr:o,pos:a}=Uf(t,e,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function Uf(t,e,n){let{expr:r,pos:s}=Tr(t,e,n);for(;;)if(s=xe(e,s),e[s]==="*"&&e[s+1]!=="*"){s++;let{expr:i,pos:o}=Tr(t,e,s);r={type:"ArithBinary",operator:"*",left:r,right:i},s=o}else if(e[s]==="/"||e[s]==="%"){let i=e[s];s++;let{expr:o,pos:a}=Tr(t,e,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Tr(t,e,n){let{expr:r,pos:s}=hi(t,e,n),i=xe(e,s);if(e.slice(i,i+2)==="**"){i+=2;let{expr:o,pos:a}=Tr(t,e,i);return{expr:{type:"ArithBinary",operator:"**",left:r,right:o},pos:a}}return{expr:r,pos:s}}function hi(t,e,n){let r=xe(e,n);if(e.slice(r,r+2)==="++"||e.slice(r,r+2)==="--"){let s=e.slice(r,r+2);r+=2;let{expr:i,pos:o}=hi(t,e,r);return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}if(e[r]==="+"||e[r]==="-"||e[r]==="!"||e[r]==="~"){let s=e[r];r++;let{expr:i,pos:o}=hi(t,e,r);return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}return Lx(t,e,r)}function Dx(t,e){let n=t[e];return n==="$"||n==="`"}function Lx(t,e,n){let{expr:r,pos:s}=jf(t,e,n),i=[r];for(;Dx(e,s);){let{expr:o,pos:a}=jf(t,e,s);i.push(o),s=a}if(i.length>1&&(r={type:"ArithConcat",parts:i}),s=xe(e,s),e.slice(s,s+2)==="++"||e.slice(s,s+2)==="--"){let o=e.slice(s,s+2);return s+=2,{expr:{type:"ArithUnary",operator:o,operand:r,prefix:!1},pos:s}}return{expr:r,pos:s}}function jf(t,e,n){let r=xe(e,n);if(e.slice(r,r+3)==="$(("){r+=3;let s=1,i=r;for(;r<e.length-1&&s>0;)e[r]==="("&&e[r+1]==="("?(s++,r+=2):e[r]===")"&&e[r+1]===")"?(s--,s>0&&(r+=2)):r++;let o=e.slice(i,r),{expr:a}=dt(t,o,0);return r+=2,{expr:{type:"ArithNested",expression:a},pos:r}}if(e.slice(r,r+2)==="$("&&e[r+2]!=="("){r+=2;let s=1,i=r;for(;r<e.length&&s>0;)e[r]==="("?s++:e[r]===")"&&s--,s>0&&r++;let o=e.slice(i,r);return r++,{expr:{type:"ArithCommandSubst",command:o},pos:r}}if(e[r]==="`"){r++;let s=r;for(;r<e.length&&e[r]!=="`";)r++;let i=e.slice(s,r);return e[r]==="`"&&r++,{expr:{type:"ArithCommandSubst",command:i},pos:r}}if(e[r]==="("){r++;let{expr:s,pos:i}=dt(t,e,r);return r=xe(e,i),e[r]===")"&&r++,{expr:{type:"ArithGroup",expression:s},pos:r}}if(/[0-9]/.test(e[r])){let s="",i=!1;for(;r<e.length;){let a=e[r];if(i)if(/[0-9a-zA-Z@_]/.test(a))s+=a,r++;else break;else if(a==="#")i=!0,s+=a,r++;else if(/[0-9a-fA-FxX]/.test(a))s+=a,r++;else break}if(e[r]==="."&&/[0-9]/.test(e[r+1]))throw new ke(`${s}.${e[r+1]}...: syntax error: invalid arithmetic operator`);if(e[r]==="["){let a=e.slice(r).trim();return{expr:{type:"ArithNumberSubscript",number:s,errorToken:a},pos:e.length}}return{expr:{type:"ArithNumber",value:un(s)},pos:r}}if(e[r]==="$"&&e[r+1]==="{"){let s=r+2,i=1,o=s;for(;o<e.length&&i>0;)e[o]==="{"?i++:e[o]==="}"&&i--,i>0&&o++;let a=e.slice(s,o),l=o+1;if(e[l]==="#"){let c=l+1;for(;c<e.length&&/[0-9a-zA-Z@_]/.test(e[c]);)c++;let u=e.slice(l+1,c);return{expr:{type:"ArithDynamicBase",baseExpr:a,value:u},pos:c}}if(/[0-9]/.test(e[l])||e[l]==="x"||e[l]==="X"){let c=l;if(e[l]==="x"||e[l]==="X")for(c++;c<e.length&&/[0-9a-fA-F]/.test(e[c]);)c++;else for(;c<e.length&&/[0-9]/.test(e[c]);)c++;let u=e.slice(l,c);return{expr:{type:"ArithDynamicNumber",prefix:a,suffix:u},pos:c}}return r=l,{expr:{type:"ArithBracedExpansion",content:a},pos:r}}if(e[r]==="$"&&r+1<e.length&&/[0-9]/.test(e[r+1])){r++;let s="";for(;r<e.length&&/[0-9]/.test(e[r]);)s+=e[r],r++;return{expr:{type:"ArithVariable",name:s},pos:r}}if(e[r]==="$"&&r+1<e.length&&/[a-zA-Z_]/.test(e[r+1])&&r++,/[a-zA-Z_]/.test(e[r])){let s="";for(;r<e.length&&/[a-zA-Z0-9_]/.test(e[r]);)s+=e[r],r++;if(e[r]==="["){r++;let o;if(e[r]==="'"||e[r]==='"'){let c=e[r];for(r++,o="";r<e.length&&e[r]!==c;)o+=e[r],r++;e[r]===c&&r++,r=xe(e,r),e[r]==="]"&&r++}let a;if(o===void 0){let{expr:c,pos:u}=dt(t,e,r);a=c,r=u,e[r]==="]"&&r++}if(r=xe(e,r),e[r]==="["&&a)return{expr:{type:"ArithDoubleSubscript",array:s,index:a},pos:r};let l=["=","+=","-=","*=","/=","%=","<<=",">>=","&=","|=","^="];for(let c of l)if(e.slice(r,r+c.length)===c&&e.slice(r,r+c.length+1)!=="=="){r+=c.length;let{expr:u,pos:f}=Or(t,e,r);return{expr:{type:"ArithAssignment",operator:c,variable:s,subscript:a,stringKey:o,value:u},pos:f}}return{expr:{type:"ArithArrayElement",array:s,index:a,stringKey:o},pos:r}}r=xe(e,r);let i=["=","+=","-=","*=","/=","%=","<<=",">>=","&=","|=","^="];for(let o of i)if(e.slice(r,r+o.length)===o&&e.slice(r,r+o.length+1)!=="=="){r+=o.length;let{expr:a,pos:l}=Or(t,e,r);return{expr:{type:"ArithAssignment",operator:o,variable:s,value:a},pos:l}}return{expr:{type:"ArithVariable",name:s},pos:r}}return{expr:{type:"ArithNumber",value:0},pos:r}}function un(t){if(t.includes("#")){let[e,n]=t.split("#"),r=Number.parseInt(e,10);if(r<2||r>64)return Number.NaN;if(r<=36)return Number.parseInt(n,r);let s=0;for(let i of n){let o;if(i>="0"&&i<="9")o=i.charCodeAt(0)-48;else if(i>="a"&&i<="z")o=i.charCodeAt(0)-97+10;else if(i>="A"&&i<="Z")o=i.charCodeAt(0)-65+36;else if(i==="@")o=62;else if(i==="_")o=63;else return Number.NaN;if(o>=r)return Number.NaN;s=s*r+o}return s}return t.startsWith("0x")||t.startsWith("0X")?Number.parseInt(t.slice(2),16):t.startsWith("0")&&t.length>1&&/^[0-9]+$/.test(t)?/[89]/.test(t)?Number.NaN:Number.parseInt(t,8):Number.parseInt(t,10)}function xe(t,e){for(;e<t.length;){if(t[e]==="\\"&&t[e+1]===`
657
- `){e+=2;continue}if(/\s/.test(t[e])){e++;continue}break}return e}var B={script(t){return{type:"Script",statements:t}},statement(t,e=[],n=!1){return{type:"Statement",pipelines:t,operators:e,background:n}},pipeline(t,e=!1){return{type:"Pipeline",commands:t,negated:e}},simpleCommand(t,e=[],n=[],r=[]){return{type:"SimpleCommand",name:t,args:e,assignments:n,redirections:r}},word(t){return{type:"Word",parts:t}},literal(t){return{type:"Literal",value:t}},singleQuoted(t){return{type:"SingleQuoted",value:t}},doubleQuoted(t){return{type:"DoubleQuoted",parts:t}},escaped(t){return{type:"Escaped",value:t}},parameterExpansion(t,e=null){return{type:"ParameterExpansion",parameter:t,operation:e}},commandSubstitution(t,e=!1){return{type:"CommandSubstitution",body:t,legacy:e}},arithmeticExpansion(t){return{type:"ArithmeticExpansion",expression:t}},assignment(t,e,n=!1,r=null){return{type:"Assignment",name:t,value:e,append:n,array:r}},redirection(t,e,n=null){return{type:"Redirection",fd:n,operator:t,target:e}},hereDoc(t,e,n=!1,r=!1){return{type:"HereDoc",delimiter:t,content:e,stripTabs:n,quoted:r}},ifNode(t,e=null,n=[]){return{type:"If",clauses:t,elseBody:e,redirections:n}},forNode(t,e,n,r=[]){return{type:"For",variable:t,words:e,body:n,redirections:r}},whileNode(t,e,n=[]){return{type:"While",condition:t,body:e,redirections:n}},untilNode(t,e,n=[]){return{type:"Until",condition:t,body:e,redirections:n}},caseNode(t,e,n=[]){return{type:"Case",word:t,items:e,redirections:n}},caseItem(t,e,n=";;"){return{type:"CaseItem",patterns:t,body:e,terminator:n}},subshell(t,e=[]){return{type:"Subshell",body:t,redirections:e}},group(t,e=[]){return{type:"Group",body:t,redirections:e}},functionDef(t,e,n=[]){return{type:"FunctionDef",name:t,body:e,redirections:n}},conditionalCommand(t,e=[]){return{type:"ConditionalCommand",expression:t,redirections:e}},arithmeticCommand(t,e=[]){return{type:"ArithmeticCommand",expression:t,redirections:e}}};var y;(function(t){t.EOF="EOF",t.NEWLINE="NEWLINE",t.SEMICOLON="SEMICOLON",t.AMP="AMP",t.PIPE="PIPE",t.PIPE_AMP="PIPE_AMP",t.AND_AND="AND_AND",t.OR_OR="OR_OR",t.BANG="BANG",t.LESS="LESS",t.GREAT="GREAT",t.DLESS="DLESS",t.DGREAT="DGREAT",t.LESSAND="LESSAND",t.GREATAND="GREATAND",t.LESSGREAT="LESSGREAT",t.DLESSDASH="DLESSDASH",t.CLOBBER="CLOBBER",t.TLESS="TLESS",t.AND_GREAT="AND_GREAT",t.AND_DGREAT="AND_DGREAT",t.LPAREN="LPAREN",t.RPAREN="RPAREN",t.LBRACE="LBRACE",t.RBRACE="RBRACE",t.DSEMI="DSEMI",t.SEMI_AND="SEMI_AND",t.SEMI_SEMI_AND="SEMI_SEMI_AND",t.DBRACK_START="DBRACK_START",t.DBRACK_END="DBRACK_END",t.DPAREN_START="DPAREN_START",t.DPAREN_END="DPAREN_END",t.IF="IF",t.THEN="THEN",t.ELSE="ELSE",t.ELIF="ELIF",t.FI="FI",t.FOR="FOR",t.WHILE="WHILE",t.UNTIL="UNTIL",t.DO="DO",t.DONE="DONE",t.CASE="CASE",t.ESAC="ESAC",t.IN="IN",t.FUNCTION="FUNCTION",t.SELECT="SELECT",t.TIME="TIME",t.COPROC="COPROC",t.WORD="WORD",t.NAME="NAME",t.NUMBER="NUMBER",t.ASSIGNMENT_WORD="ASSIGNMENT_WORD",t.COMMENT="COMMENT",t.HEREDOC_CONTENT="HEREDOC_CONTENT"})(y||(y={}));var Dr={if:y.IF,then:y.THEN,else:y.ELSE,elif:y.ELIF,fi:y.FI,for:y.FOR,while:y.WHILE,until:y.UNTIL,do:y.DO,done:y.DONE,case:y.CASE,esac:y.ESAC,in:y.IN,function:y.FUNCTION,select:y.SELECT,time:y.TIME,coproc:y.COPROC};function Hf(t){let e=t.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!e)return!1;let n=t.slice(e[0].length);if(n===""||n==="+")return!0;if(n[0]==="["){let r=0,s=0;for(;s<n.length;s++)if(n[s]==="[")r++;else if(n[s]==="]"&&(r--,r===0))break;if(r!==0||s>=n.length)return!1;let i=n.slice(s+1);return i===""||i==="+"}return!1}var Mx=[[";",";","&",y.SEMI_SEMI_AND],["<","<","<",y.TLESS],["&",">",">",y.AND_DGREAT]],_x=[["[","[",y.DBRACK_START],["]","]",y.DBRACK_END],["(","(",y.DPAREN_START],[")",")",y.DPAREN_END],["&","&",y.AND_AND],["|","|",y.OR_OR],[";",";",y.DSEMI],[";","&",y.SEMI_AND],["|","&",y.PIPE_AMP],[">",">",y.DGREAT],["<","&",y.LESSAND],[">","&",y.GREATAND],["<",">",y.LESSGREAT],[">","|",y.CLOBBER],["&",">",y.AND_GREAT]],Bx={"|":y.PIPE,"&":y.AMP,";":y.SEMICOLON,"(":y.LPAREN,")":y.RPAREN,"<":y.LESS,">":y.GREAT};function Wx(t){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)}var Lr=class{input;pos=0;line=1;column=1;tokens=[];pendingHeredocs=[];constructor(e){this.input=e}tokenize(){let n=this.input.length,r=this.tokens,s=this.pendingHeredocs;for(;this.pos<n&&(this.skipWhitespace(),!(this.pos>=n));){if(s.length>0&&r.length>0&&r[r.length-1].type===y.NEWLINE){this.readHeredocContent();continue}let i=this.nextToken();i&&r.push(i)}return r.push({type:y.EOF,value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),r}skipWhitespace(){let e=this.input,n=e.length,r=this.pos,s=this.column,i=this.line;for(;r<n;){let o=e[r];if(o===" "||o===" ")r++,s++;else if(o==="\\"&&e[r+1]===`
657
+ `){e+=2;continue}if(/\s/.test(t[e])){e++;continue}break}return e}var B={script(t){return{type:"Script",statements:t}},statement(t,e=[],n=!1){return{type:"Statement",pipelines:t,operators:e,background:n}},pipeline(t,e=!1){return{type:"Pipeline",commands:t,negated:e}},simpleCommand(t,e=[],n=[],r=[]){return{type:"SimpleCommand",name:t,args:e,assignments:n,redirections:r}},word(t){return{type:"Word",parts:t}},literal(t){return{type:"Literal",value:t}},singleQuoted(t){return{type:"SingleQuoted",value:t}},doubleQuoted(t){return{type:"DoubleQuoted",parts:t}},escaped(t){return{type:"Escaped",value:t}},parameterExpansion(t,e=null){return{type:"ParameterExpansion",parameter:t,operation:e}},commandSubstitution(t,e=!1){return{type:"CommandSubstitution",body:t,legacy:e}},arithmeticExpansion(t){return{type:"ArithmeticExpansion",expression:t}},assignment(t,e,n=!1,r=null){return{type:"Assignment",name:t,value:e,append:n,array:r}},redirection(t,e,n=null){return{type:"Redirection",fd:n,operator:t,target:e}},hereDoc(t,e,n=!1,r=!1){return{type:"HereDoc",delimiter:t,content:e,stripTabs:n,quoted:r}},ifNode(t,e=null,n=[]){return{type:"If",clauses:t,elseBody:e,redirections:n}},forNode(t,e,n,r=[]){return{type:"For",variable:t,words:e,body:n,redirections:r}},whileNode(t,e,n=[]){return{type:"While",condition:t,body:e,redirections:n}},untilNode(t,e,n=[]){return{type:"Until",condition:t,body:e,redirections:n}},caseNode(t,e,n=[]){return{type:"Case",word:t,items:e,redirections:n}},caseItem(t,e,n=";;"){return{type:"CaseItem",patterns:t,body:e,terminator:n}},subshell(t,e=[]){return{type:"Subshell",body:t,redirections:e}},group(t,e=[]){return{type:"Group",body:t,redirections:e}},functionDef(t,e,n=[]){return{type:"FunctionDef",name:t,body:e,redirections:n}},conditionalCommand(t,e=[]){return{type:"ConditionalCommand",expression:t,redirections:e}},arithmeticCommand(t,e=[]){return{type:"ArithmeticCommand",expression:t,redirections:e}}};var y;(function(t){t.EOF="EOF",t.NEWLINE="NEWLINE",t.SEMICOLON="SEMICOLON",t.AMP="AMP",t.PIPE="PIPE",t.PIPE_AMP="PIPE_AMP",t.AND_AND="AND_AND",t.OR_OR="OR_OR",t.BANG="BANG",t.LESS="LESS",t.GREAT="GREAT",t.DLESS="DLESS",t.DGREAT="DGREAT",t.LESSAND="LESSAND",t.GREATAND="GREATAND",t.LESSGREAT="LESSGREAT",t.DLESSDASH="DLESSDASH",t.CLOBBER="CLOBBER",t.TLESS="TLESS",t.AND_GREAT="AND_GREAT",t.AND_DGREAT="AND_DGREAT",t.LPAREN="LPAREN",t.RPAREN="RPAREN",t.LBRACE="LBRACE",t.RBRACE="RBRACE",t.DSEMI="DSEMI",t.SEMI_AND="SEMI_AND",t.SEMI_SEMI_AND="SEMI_SEMI_AND",t.DBRACK_START="DBRACK_START",t.DBRACK_END="DBRACK_END",t.DPAREN_START="DPAREN_START",t.DPAREN_END="DPAREN_END",t.IF="IF",t.THEN="THEN",t.ELSE="ELSE",t.ELIF="ELIF",t.FI="FI",t.FOR="FOR",t.WHILE="WHILE",t.UNTIL="UNTIL",t.DO="DO",t.DONE="DONE",t.CASE="CASE",t.ESAC="ESAC",t.IN="IN",t.FUNCTION="FUNCTION",t.SELECT="SELECT",t.TIME="TIME",t.COPROC="COPROC",t.WORD="WORD",t.NAME="NAME",t.NUMBER="NUMBER",t.ASSIGNMENT_WORD="ASSIGNMENT_WORD",t.COMMENT="COMMENT",t.HEREDOC_CONTENT="HEREDOC_CONTENT"})(y||(y={}));var Dr={if:y.IF,then:y.THEN,else:y.ELSE,elif:y.ELIF,fi:y.FI,for:y.FOR,while:y.WHILE,until:y.UNTIL,do:y.DO,done:y.DONE,case:y.CASE,esac:y.ESAC,in:y.IN,function:y.FUNCTION,select:y.SELECT,time:y.TIME,coproc:y.COPROC};function Hf(t){let e=t.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!e)return!1;let n=t.slice(e[0].length);if(n===""||n==="+")return!0;if(n[0]==="["){let r=0,s=0;for(;s<n.length;s++)if(n[s]==="[")r++;else if(n[s]==="]"&&(r--,r===0))break;if(r!==0||s>=n.length)return!1;let i=n.slice(s+1);return i===""||i==="+"}return!1}var Mx=[[";",";","&",y.SEMI_SEMI_AND],["<","<","<",y.TLESS],["&",">",">",y.AND_DGREAT]],_x=[["[","[",y.DBRACK_START],["]","]",y.DBRACK_END],["(","(",y.DPAREN_START],[")",")",y.DPAREN_END],["&","&",y.AND_AND],["|","|",y.OR_OR],[";",";",y.DSEMI],[";","&",y.SEMI_AND],["|","&",y.PIPE_AMP],[">",">",y.DGREAT],["<","&",y.LESSAND],[">","&",y.GREATAND],["<",">",y.LESSGREAT],[">","|",y.CLOBBER],["&",">",y.AND_GREAT]],Bx={"|":y.PIPE,"&":y.AMP,";":y.SEMICOLON,"(":y.LPAREN,")":y.RPAREN,"<":y.LESS,">":y.GREAT};function Wx(t){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)}var Lr=class{input;pos=0;line=1;column=1;tokens=[];pendingHeredocs=[];constructor(e){this.input=e}tokenize(){let n=this.input.length,r=this.tokens,s=this.pendingHeredocs;for(;this.pos<n;){if(s.length>0&&r.length>0&&r[r.length-1].type===y.NEWLINE){this.readHeredocContent();continue}if(this.skipWhitespace(),this.pos>=n)break;let i=this.nextToken();i&&r.push(i)}return r.push({type:y.EOF,value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),r}skipWhitespace(){let e=this.input,n=e.length,r=this.pos,s=this.column,i=this.line;for(;r<n;){let o=e[r];if(o===" "||o===" ")r++,s++;else if(o==="\\"&&e[r+1]===`
658
658
  `)r+=2,i++,s=1;else break}this.pos=r,this.column=s,this.line=i}nextToken(){let e=this.input,n=this.pos,r=this.line,s=this.column,i=e[n],o=e[n+1],a=e[n+2];if(i==="#")return this.readComment(n,r,s);if(i===`
659
659
  `)return this.pos=n+1,this.line++,this.column=1,{type:y.NEWLINE,value:`
660
660
  `,start:n,end:n+1,line:r,column:s};if(i==="<"&&o==="<"&&a==="-")return this.pos=n+3,this.column=s+3,this.registerHeredocFromLookahead(!0),this.makeToken(y.DLESSDASH,"<<-",n,r,s);for(let[c,u,f,d]of Mx)if(i===c&&o===u&&a===f)return this.pos=n+3,this.column=s+3,this.makeToken(d,c+u+f,n,r,s);if(i==="<"&&o==="<")return this.pos=n+2,this.column=s+2,this.registerHeredocFromLookahead(!1),this.makeToken(y.DLESS,"<<",n,r,s);for(let[c,u,f]of _x)if(i===c&&o===u)return this.pos=n+2,this.column=s+2,this.makeToken(f,c+u,n,r,s);let l=Bx[i];return l?(this.pos=n+1,this.column=s+1,this.makeToken(l,i,n,r,s)):i==="{"?o==="}"?(this.pos=n+2,this.column=s+2,{type:y.WORD,value:"{}",start:n,end:n+2,line:r,column:s,quoted:!1,singleQuoted:!1}):this.scanBraceExpansion(n)!==null?this.readWordWithBraceExpansion(n,r,s):this.scanLiteralBraceWord(n)!==null?this.readWordWithBraceExpansion(n,r,s):o!==void 0&&o!==" "&&o!==" "&&o!==`
@@ -792,11 +792,11 @@ ${Hr}`):(Qi(t,e.slice(n)),re)}return re}function Qi(t,e){let n=1;for(;t.state.en
792
792
  `,OSTYPE:"linux-gnu",MACHTYPE:"x86_64-pc-linux-gnu",HOSTTYPE:"x86_64",PWD:r,OLDPWD:r,...e.env};if(this.limits=Gd({...e.executionLimits,...e.maxCallDepth!==void 0&&{maxCallDepth:e.maxCallDepth},...e.maxCommandCount!==void 0&&{maxCommandCount:e.maxCommandCount},...e.maxLoopIterations!==void 0&&{maxLoopIterations:e.maxLoopIterations}}),e.network&&(this.secureFetch=oo(e.network)),this.sleepFn=e.sleep,this.traceFn=e.trace,this.logger=e.logger,this.state={env:s,cwd:r,previousDir:"/home/user",functions:new Map,localScopes:[],callDepth:0,sourceDepth:0,commandCount:0,lastExitCode:0,lastArg:"",startTime:Date.now(),lastBackgroundPid:0,currentLine:1,options:{errexit:!1,pipefail:!1,nounset:!1,xtrace:!1,verbose:!1},inCondition:!1,loopDepth:0},Pf(n,this.useDefaultLayout),r!=="/"&&n instanceof Bt)try{n.mkdirSync(r,{recursive:!0})}catch{}for(let i of Af(e.commands))this.registerCommand(i);if(e.network)for(let i of kf())this.registerCommand(i);if(e.customCommands)for(let i of e.customCommands)Nf(i)?this.registerCommand(If(i)):this.registerCommand(i)}registerCommand(e){this.commands.set(e.name,e);let n=this.fs;if(typeof n.writeFileSync=="function")try{n.writeFileSync(`/bin/${e.name}`,`#!/bin/bash
793
793
  # Built-in command: ${e.name}
794
794
  `)}catch{}}logResult(e){return this.logger&&(e.stdout&&this.logger.debug("stdout",{output:e.stdout}),e.stderr&&this.logger.info("stderr",{output:e.stderr}),this.logger.info("exit",{exitCode:e.exitCode})),e}async exec(e,n){if(this.state.callDepth===0&&(this.state.commandCount=0),this.state.commandCount++,this.state.commandCount>this.limits.maxCommandCount)return{stdout:"",stderr:`bash: maximum command count (${this.limits.maxCommandCount}) exceeded (possible infinite loop). Increase with executionLimits.maxCommandCount option.
795
- `,exitCode:1,env:{...this.state.env,...n?.env}};if(!e.trim())return{stdout:"",stderr:"",exitCode:0,env:{...this.state.env,...n?.env}};this.logger?.info("exec",{command:e});let r=n?.cwd??this.state.cwd,s={...this.state,env:{...this.state.env,...n?.env,...n?.cwd?{PWD:n.cwd}:{}},cwd:r,functions:new Map(this.state.functions),localScopes:[...this.state.localScopes],options:{...this.state.options}},i=e;n?.rawScript||(i=e.split(`
796
- `).map(a=>a.trimStart()).join(`
797
- `));try{let o=bt(i),a={fs:this.fs,commands:this.commands,limits:this.limits,exec:this.exec.bind(this),fetch:this.secureFetch,sleep:this.sleepFn,trace:this.traceFn},c=await new qn(a,s).executeScript(o);return this.logResult(c)}catch(o){if(o instanceof fe)return this.logResult({stdout:o.stdout,stderr:o.stderr,exitCode:o.exitCode,env:{...this.state.env,...n?.env}});if(o instanceof ke)return this.logResult({stdout:o.stdout,stderr:o.stderr,exitCode:1,env:{...this.state.env,...n?.env}});if(o instanceof Q)return this.logResult({stdout:o.stdout,stderr:o.stderr,exitCode:Q.EXIT_CODE,env:{...this.state.env,...n?.env}});if(o.name==="ParseException")return this.logResult({stdout:"",stderr:`bash: syntax error: ${o.message}
795
+ `,exitCode:1,env:{...this.state.env,...n?.env}};if(!e.trim())return{stdout:"",stderr:"",exitCode:0,env:{...this.state.env,...n?.env}};this.logger?.info("exec",{command:e});let r=n?.cwd??this.state.cwd,s={...this.state,env:{...this.state.env,...n?.env,...n?.cwd?{PWD:n.cwd}:{}},cwd:r,functions:new Map(this.state.functions),localScopes:[...this.state.localScopes],options:{...this.state.options}},i=e;n?.rawScript||(i=Ww(e));try{let o=bt(i),a={fs:this.fs,commands:this.commands,limits:this.limits,exec:this.exec.bind(this),fetch:this.secureFetch,sleep:this.sleepFn,trace:this.traceFn},c=await new qn(a,s).executeScript(o);return this.logResult(c)}catch(o){if(o instanceof fe)return this.logResult({stdout:o.stdout,stderr:o.stderr,exitCode:o.exitCode,env:{...this.state.env,...n?.env}});if(o instanceof ke)return this.logResult({stdout:o.stdout,stderr:o.stderr,exitCode:1,env:{...this.state.env,...n?.env}});if(o instanceof Q)return this.logResult({stdout:o.stdout,stderr:o.stderr,exitCode:Q.EXIT_CODE,env:{...this.state.env,...n?.env}});if(o.name==="ParseException")return this.logResult({stdout:"",stderr:`bash: syntax error: ${o.message}
798
796
  `,exitCode:2,env:{...this.state.env,...n?.env}});if(o instanceof RangeError)return this.logResult({stdout:"",stderr:`bash: ${o.message}
799
- `,exitCode:1,env:{...this.state.env,...n?.env}});throw o}}async readFile(e){return this.fs.readFile(this.fs.resolvePath(this.state.cwd,e))}async writeFile(e,n){return this.fs.writeFile(this.fs.resolvePath(this.state.cwd,e),n)}getCwd(){return this.state.cwd}getEnv(){return{...this.state.env}}};export{ao as Bash,Bt as InMemoryFs,gn as NetworkAccessDeniedError,xn as RedirectNotAllowedError,yn as TooManyRedirectsError,Ax as defineCommand,Sx as getCommandNames,Cx as getNetworkCommandNames};
797
+ `,exitCode:1,env:{...this.state.env,...n?.env}});throw o}}async readFile(e){return this.fs.readFile(this.fs.resolvePath(this.state.cwd,e))}async writeFile(e,n){return this.fs.writeFile(this.fs.resolvePath(this.state.cwd,e),n)}getCwd(){return this.state.cwd}getEnv(){return{...this.state.env}}};function Ww(t){let e=t.split(`
798
+ `),n=[],r=[];for(let s=0;s<e.length;s++){let i=e[s];if(r.length>0){let l=r[r.length-1];if((l.stripTabs?i.replace(/^\t+/,""):i)===l.delimiter){n.push(i.trimStart()),r.pop();continue}n.push(i);continue}let o=i.trimStart();n.push(o);let a=/<<(-?)\s*(['"]?)([\w-]+)\2/g;for(let l of o.matchAll(a)){let c=l[1]==="-",u=l[3];r.push({delimiter:u,stripTabs:c})}}return n.join(`
799
+ `)}export{ao as Bash,Bt as InMemoryFs,gn as NetworkAccessDeniedError,xn as RedirectNotAllowedError,yn as TooManyRedirectsError,Ax as defineCommand,Sx as getCommandNames,Cx as getNetworkCommandNames};
800
800
  /*! Bundled license information:
801
801
 
802
802
  ieee754/index.js: