just-bash 2.11.8 → 2.11.9

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.
@@ -35,8 +35,8 @@ Notes:
35
35
  `}},br=class extends yt{name="BraceExpansionError";constructor(t,n="",r=""){super(t,n,r),this.stderr=r||`bash: ${t}
36
36
  `}},J=class extends yt{limitType;name="ExecutionLimitError";static EXIT_CODE=126;constructor(t,n,r="",s=""){super(t,r,s),this.limitType=n,this.stderr=s||`bash: ${t}
37
37
  `}},pn=class extends yt{name="SubshellExitError";constructor(t="",n=""){super("subshell exit",t,n)}};Wt=class extends yt{exitCode;name="PosixFatalError";constructor(t,n="",r=""){super("posix fatal error",n,r),this.exitCode=t}}});function Ue(e){return e instanceof Error?e.message:String(e)}var zt=I(()=>{"use strict"});function qs(e,t,n){let r=e;n>=0&&r.length>n&&(r=r.slice(0,n));let s=Math.abs(t);return s>r.length&&(t<0?r=r.padEnd(s," "):r=r.padStart(s," ")),r}function Su(e,t){let n=t,r=0,s=-1,i=!1;for(n<e.length&&e[n]==="-"&&(i=!0,n++);n<e.length&&/\d/.test(e[n]);)r=r*10+parseInt(e[n],10),n++;if(n<e.length&&e[n]===".")for(n++,s=0;n<e.length&&/\d/.test(e[n]);)s=s*10+parseInt(e[n],10),n++;return i&&r>0&&(r=-r),[r,s,n-t]}function Zs(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length)switch(e[n+1]){case"n":t+=`
38
- `,n+=2;break;case"t":t+=" ",n+=2;break;case"r":t+="\r",n+=2;break;case"\\":t+="\\",n+=2;break;case"a":t+="\x07",n+=2;break;case"b":t+="\b",n+=2;break;case"f":t+="\f",n+=2;break;case"v":t+="\v",n+=2;break;case"e":case"E":t+="\x1B",n+=2;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let s="",i=n+1;for(;i<e.length&&i<n+4&&/[0-7]/.test(e[i]);)s+=e[i],i++;t+=String.fromCharCode(parseInt(s,8)),n=i;break}case"x":{let s=[],i=n;for(;i+3<e.length&&e[i]==="\\"&&e[i+1]==="x"&&/[0-9a-fA-F]{2}/.test(e.slice(i+2,i+4));)s.push(parseInt(e.slice(i+2,i+4),16)),i+=4;if(s.length>0){try{let a=new TextDecoder("utf-8",{fatal:!0});t+=a.decode(new Uint8Array(s))}catch{for(let a of s)t+=String.fromCharCode(a)}n=i}else t+=e[n],n++;break}case"u":{let s="",i=n+2;for(;i<e.length&&i<n+6&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;s?(t+=String.fromCodePoint(parseInt(s,16)),n=i):(t+="\\u",n+=2);break}case"U":{let s="",i=n+2;for(;i<e.length&&i<n+10&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;s?(t+=String.fromCodePoint(parseInt(s,16)),n=i):(t+="\\U",n+=2);break}default:t+=e[n],n++}else t+=e[n],n++;return t}var Ba=I(()=>{"use strict"});function ku(e,t,n){let r=new Date(t*1e3),s="",i=0;for(;i<e.length;)if(e[i]==="%"&&i+1<e.length){let a=e[i+1],o=o7(r,a,n);o!==null?(s+=o,i+=2):(s+=e[i],i++)}else s+=e[i],i++;return s}function a7(e,t){let n={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short",hour12:!1,timeZone:t};try{let s=new Intl.DateTimeFormat("en-US",n).formatToParts(e),i=l=>s.find(c=>c.type===l)?.value??"",a=new Map([["Sun",0],["Mon",1],["Tue",2],["Wed",3],["Thu",4],["Fri",5],["Sat",6]]),o=i("weekday");return{year:Number.parseInt(i("year"),10)||e.getFullYear(),month:Number.parseInt(i("month"),10)||e.getMonth()+1,day:Number.parseInt(i("day"),10)||e.getDate(),hour:Number.parseInt(i("hour"),10)||e.getHours(),minute:Number.parseInt(i("minute"),10)||e.getMinutes(),second:Number.parseInt(i("second"),10)||e.getSeconds(),weekday:a.get(o)??e.getDay()}}catch{return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),weekday:e.getDay()}}}function o7(e,t,n){let r=a7(e,n),s=(l,c=2)=>String(l).padStart(c,"0"),i=vu(r.year,r.month,r.day),a=Cu(r.year,r.month,r.day,r.weekday,0),o=Cu(r.year,r.month,r.day,r.weekday,1);switch(t){case"a":return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][r.weekday];case"A":return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.weekday];case"b":case"h":return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.month-1];case"B":return["January","February","March","April","May","June","July","August","September","October","November","December"][r.month-1];case"c":return`${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][r.weekday]} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.month-1]} ${String(r.day).padStart(2," ")} ${s(r.hour)}:${s(r.minute)}:${s(r.second)} ${r.year}`;case"C":return s(Math.floor(r.year/100));case"d":return s(r.day);case"D":return`${s(r.month)}/${s(r.day)}/${s(r.year%100)}`;case"e":return String(r.day).padStart(2," ");case"F":return`${r.year}-${s(r.month)}-${s(r.day)}`;case"g":return s(Nu(r.year,r.month,r.day)%100);case"G":return String(Nu(r.year,r.month,r.day));case"H":return s(r.hour);case"I":return s(r.hour%12||12);case"j":return String(i).padStart(3,"0");case"k":return String(r.hour).padStart(2," ");case"l":return String(r.hour%12||12).padStart(2," ");case"m":return s(r.month);case"M":return s(r.minute);case"n":return`
39
- `;case"N":return"000000000";case"p":return r.hour<12?"AM":"PM";case"P":return r.hour<12?"am":"pm";case"r":return`${s(r.hour%12||12)}:${s(r.minute)}:${s(r.second)} ${r.hour<12?"AM":"PM"}`;case"R":return`${s(r.hour)}:${s(r.minute)}`;case"s":return String(Math.floor(e.getTime()/1e3));case"S":return s(r.second);case"t":return" ";case"T":return`${s(r.hour)}:${s(r.minute)}:${s(r.second)}`;case"u":return String(r.weekday===0?7:r.weekday);case"U":return s(a);case"V":return s(u7(r.year,r.month,r.day));case"w":return String(r.weekday);case"W":return s(o);case"x":return`${s(r.month)}/${s(r.day)}/${s(r.year%100)}`;case"X":return`${s(r.hour)}:${s(r.minute)}:${s(r.second)}`;case"y":return s(r.year%100);case"Y":return String(r.year);case"z":return l7(e,n);case"Z":return c7(e,n);case"%":return"%";default:return null}}function l7(e,t){if(!t){let a=-e.getTimezoneOffset(),o=a>=0?"+":"-",l=Math.floor(Math.abs(a)/60),c=Math.abs(a)%60;return`${o}${String(l).padStart(2,"0")}${String(c).padStart(2,"0")}`}try{let l=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).formatToParts(e).find(c=>c.type==="timeZoneName");if(l){let c=l.value.match(/GMT([+-])(\d{2}):(\d{2})/);if(c)return`${c[1]}${c[2]}${c[3]}`;if(l.value==="GMT"||l.value==="UTC")return"+0000"}}catch{}let n=-e.getTimezoneOffset(),r=n>=0?"+":"-",s=Math.floor(Math.abs(n)/60),i=Math.abs(n)%60;return`${r}${String(s).padStart(2,"0")}${String(i).padStart(2,"0")}`}function c7(e,t){try{return new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"short"}).formatToParts(e).find(i=>i.type==="timeZoneName")?.value??"UTC"}catch{return"UTC"}}function vu(e,t,n){let r=[31,28,31,30,31,30,31,31,30,31,30,31];(e%4===0&&e%100!==0||e%400===0)&&(r[1]=29);let i=n;for(let a=0;a<t-1;a++)i+=r[a];return i}function Cu(e,t,n,r,s){let i=vu(e,t,n),l=(new Date(e,0,1).getDay()-s+7)%7,c=(r-s+7)%7,u=i-1+l;return Math.floor((u-c+7)/7)}function u7(e,t,n){let r=new Date(e,t-1,n,12,0,0);r.setDate(r.getDate()+3-(r.getDay()+6)%7);let s=new Date(r.getFullYear(),0,4);s.setDate(s.getDate()+3-(s.getDay()+6)%7);let i=r.getTime()-s.getTime();return 1+Math.round(i/(10080*60*1e3))}function Nu(e,t,n){let r=new Date(e,t-1,n,12,0,0);return r.setDate(r.getDate()+3-(r.getDay()+6)%7),r.getFullYear()}var Iu=I(()=>{"use strict"});var Ou={};K(Ou,{flagsForFuzzing:()=>S7,printfCommand:()=>h7});import{sprintf as xr}from"sprintf-js";function f7(e){let t="",n=0;for(;n<e.length;){let r=e[n];if(r<128){t+=String.fromCharCode(r),n++;continue}if((r&224)===192){if(n+1<e.length&&(e[n+1]&192)===128&&r>=194){let s=(r&31)<<6|e[n+1]&63;t+=String.fromCharCode(s),n+=2;continue}t+=String.fromCharCode(r),n++;continue}if((r&240)===224){if(n+2<e.length&&(e[n+1]&192)===128&&(e[n+2]&192)===128){if(r===224&&e[n+1]<160){t+=String.fromCharCode(r),n++;continue}let s=(r&15)<<12|(e[n+1]&63)<<6|e[n+2]&63;if(s>=55296&&s<=57343){t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(s),n+=3;continue}t+=String.fromCharCode(r),n++;continue}if((r&248)===240&&r<=244){if(n+3<e.length&&(e[n+1]&192)===128&&(e[n+2]&192)===128&&(e[n+3]&192)===128){if(r===240&&e[n+1]<144){t+=String.fromCharCode(r),n++;continue}let s=(r&7)<<18|(e[n+1]&63)<<12|(e[n+2]&63)<<6|e[n+3]&63;if(s>1114111){t+=String.fromCharCode(r),n++;continue}t+=String.fromCodePoint(s),n+=4;continue}t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(r),n++}return t}function d7(e,t,n,r){let s="",i=0,a=0,o=!1,l="";for(;i<e.length;)if(e[i]==="%"&&i+1<e.length){let c=i;if(i++,e[i]==="%"){s+="%",i++;continue}let u=e.slice(c).match(/^%(-?\d*)(?:\.(\d+))?\(([^)]*)\)T/);if(u){let S=u[1]?parseInt(u[1],10):0,$=u[2]?parseInt(u[2],10):-1,O=u[3],L=u[0],R=t[n+a]||"";a++;let W;R===""||R==="-1"||R==="-2"?W=Math.floor(Date.now()/1e3):W=parseInt(R,10)||0;let k=ku(O,W,r);if($>=0&&k.length>$&&(k=k.slice(0,$)),S!==0){let N=Math.abs(S);k.length<N&&(S<0?k=k.padEnd(N," "):k=k.padStart(N," "))}s+=k,i=c+L.length;continue}for(;i<e.length&&"+-0 #'".includes(e[i]);)i++;let f=!1;if(e[i]==="*")f=!0,i++;else for(;i<e.length&&/\d/.test(e[i]);)i++;let p=!1;if(e[i]===".")if(i++,e[i]==="*")p=!0,i++;else for(;i<e.length&&/\d/.test(e[i]);)i++;i<e.length&&"hlL".includes(e[i])&&i++;let h=e[i]||"";i++;let d=e.slice(c,i);if(f){let S=parseInt(t[n+a]||"0",10);a++,d=d.replace("*",String(S))}if(p){let S=parseInt(t[n+a]||"0",10);a++,d=d.replace(".*",`.${S}`)}let g=t[n+a]||"";a++;let{value:w,parseError:y,parseErrMsg:b,stopped:x}=m7(d,h,g);if(s+=w,y&&(o=!0,b&&(l=b)),x)return{result:s,argsConsumed:a,error:o,errMsg:l,stopped:!0}}else s+=e[i],i++;return{result:s,argsConsumed:a,error:o,errMsg:l,stopped:!1}}function m7(e,t,n){let r=!1,s="";switch(t){case"d":case"i":{let i=Ks(n);return r=Jt,r&&(s=`printf: ${n}: invalid number
38
+ `,n+=2;break;case"t":t+=" ",n+=2;break;case"r":t+="\r",n+=2;break;case"\\":t+="\\",n+=2;break;case"a":t+="\x07",n+=2;break;case"b":t+="\b",n+=2;break;case"f":t+="\f",n+=2;break;case"v":t+="\v",n+=2;break;case"e":case"E":t+="\x1B",n+=2;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let s="",i=n+1;for(;i<e.length&&i<n+4&&/[0-7]/.test(e[i]);)s+=e[i],i++;t+=String.fromCharCode(parseInt(s,8)),n=i;break}case"x":{let s=[],i=n;for(;i+3<e.length&&e[i]==="\\"&&e[i+1]==="x"&&/[0-9a-fA-F]{2}/.test(e.slice(i+2,i+4));)s.push(parseInt(e.slice(i+2,i+4),16)),i+=4;if(s.length>0){try{let a=new TextDecoder("utf-8",{fatal:!0});t+=a.decode(new Uint8Array(s))}catch{for(let a of s)t+=String.fromCharCode(a)}n=i}else t+=e[n],n++;break}case"u":{let s="",i=n+2;for(;i<e.length&&i<n+6&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;s?(t+=String.fromCodePoint(parseInt(s,16)),n=i):(t+="\\u",n+=2);break}case"U":{let s="",i=n+2;for(;i<e.length&&i<n+10&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;s?(t+=String.fromCodePoint(parseInt(s,16)),n=i):(t+="\\U",n+=2);break}default:t+=e[n],n++}else t+=e[n],n++;return t}var Ba=I(()=>{"use strict"});function vu(e,t,n){let r=new Date(t*1e3),s="",i=0;for(;i<e.length;)if(e[i]==="%"&&i+1<e.length){let a=e[i+1],o=o7(r,a,n);o!==null?(s+=o,i+=2):(s+=e[i],i++)}else s+=e[i],i++;return s}function a7(e,t){let n={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short",hour12:!1,timeZone:t};try{let s=new Intl.DateTimeFormat("en-US",n).formatToParts(e),i=l=>s.find(c=>c.type===l)?.value??"",a=new Map([["Sun",0],["Mon",1],["Tue",2],["Wed",3],["Thu",4],["Fri",5],["Sat",6]]),o=i("weekday");return{year:Number.parseInt(i("year"),10)||e.getFullYear(),month:Number.parseInt(i("month"),10)||e.getMonth()+1,day:Number.parseInt(i("day"),10)||e.getDate(),hour:Number.parseInt(i("hour"),10)||e.getHours(),minute:Number.parseInt(i("minute"),10)||e.getMinutes(),second:Number.parseInt(i("second"),10)||e.getSeconds(),weekday:a.get(o)??e.getDay()}}catch{return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),weekday:e.getDay()}}}function o7(e,t,n){let r=a7(e,n),s=(l,c=2)=>String(l).padStart(c,"0"),i=ku(r.year,r.month,r.day),a=Cu(r.year,r.month,r.day,r.weekday,0),o=Cu(r.year,r.month,r.day,r.weekday,1);switch(t){case"a":return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][r.weekday];case"A":return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.weekday];case"b":case"h":return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.month-1];case"B":return["January","February","March","April","May","June","July","August","September","October","November","December"][r.month-1];case"c":return`${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][r.weekday]} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.month-1]} ${String(r.day).padStart(2," ")} ${s(r.hour)}:${s(r.minute)}:${s(r.second)} ${r.year}`;case"C":return s(Math.floor(r.year/100));case"d":return s(r.day);case"D":return`${s(r.month)}/${s(r.day)}/${s(r.year%100)}`;case"e":return String(r.day).padStart(2," ");case"F":return`${r.year}-${s(r.month)}-${s(r.day)}`;case"g":return s(Nu(r.year,r.month,r.day)%100);case"G":return String(Nu(r.year,r.month,r.day));case"H":return s(r.hour);case"I":return s(r.hour%12||12);case"j":return String(i).padStart(3,"0");case"k":return String(r.hour).padStart(2," ");case"l":return String(r.hour%12||12).padStart(2," ");case"m":return s(r.month);case"M":return s(r.minute);case"n":return`
39
+ `;case"N":return"000000000";case"p":return r.hour<12?"AM":"PM";case"P":return r.hour<12?"am":"pm";case"r":return`${s(r.hour%12||12)}:${s(r.minute)}:${s(r.second)} ${r.hour<12?"AM":"PM"}`;case"R":return`${s(r.hour)}:${s(r.minute)}`;case"s":return String(Math.floor(e.getTime()/1e3));case"S":return s(r.second);case"t":return" ";case"T":return`${s(r.hour)}:${s(r.minute)}:${s(r.second)}`;case"u":return String(r.weekday===0?7:r.weekday);case"U":return s(a);case"V":return s(u7(r.year,r.month,r.day));case"w":return String(r.weekday);case"W":return s(o);case"x":return`${s(r.month)}/${s(r.day)}/${s(r.year%100)}`;case"X":return`${s(r.hour)}:${s(r.minute)}:${s(r.second)}`;case"y":return s(r.year%100);case"Y":return String(r.year);case"z":return l7(e,n);case"Z":return c7(e,n);case"%":return"%";default:return null}}function l7(e,t){if(!t){let a=-e.getTimezoneOffset(),o=a>=0?"+":"-",l=Math.floor(Math.abs(a)/60),c=Math.abs(a)%60;return`${o}${String(l).padStart(2,"0")}${String(c).padStart(2,"0")}`}try{let l=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).formatToParts(e).find(c=>c.type==="timeZoneName");if(l){let c=l.value.match(/GMT([+-])(\d{2}):(\d{2})/);if(c)return`${c[1]}${c[2]}${c[3]}`;if(l.value==="GMT"||l.value==="UTC")return"+0000"}}catch{}let n=-e.getTimezoneOffset(),r=n>=0?"+":"-",s=Math.floor(Math.abs(n)/60),i=Math.abs(n)%60;return`${r}${String(s).padStart(2,"0")}${String(i).padStart(2,"0")}`}function c7(e,t){try{return new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"short"}).formatToParts(e).find(i=>i.type==="timeZoneName")?.value??"UTC"}catch{return"UTC"}}function ku(e,t,n){let r=[31,28,31,30,31,30,31,31,30,31,30,31];(e%4===0&&e%100!==0||e%400===0)&&(r[1]=29);let i=n;for(let a=0;a<t-1;a++)i+=r[a];return i}function Cu(e,t,n,r,s){let i=ku(e,t,n),l=(new Date(e,0,1).getDay()-s+7)%7,c=(r-s+7)%7,u=i-1+l;return Math.floor((u-c+7)/7)}function u7(e,t,n){let r=new Date(e,t-1,n,12,0,0);r.setDate(r.getDate()+3-(r.getDay()+6)%7);let s=new Date(r.getFullYear(),0,4);s.setDate(s.getDate()+3-(s.getDay()+6)%7);let i=r.getTime()-s.getTime();return 1+Math.round(i/(10080*60*1e3))}function Nu(e,t,n){let r=new Date(e,t-1,n,12,0,0);return r.setDate(r.getDate()+3-(r.getDay()+6)%7),r.getFullYear()}var Iu=I(()=>{"use strict"});var Ou={};K(Ou,{flagsForFuzzing:()=>S7,printfCommand:()=>h7});import{sprintf as xr}from"sprintf-js";function f7(e){let t="",n=0;for(;n<e.length;){let r=e[n];if(r<128){t+=String.fromCharCode(r),n++;continue}if((r&224)===192){if(n+1<e.length&&(e[n+1]&192)===128&&r>=194){let s=(r&31)<<6|e[n+1]&63;t+=String.fromCharCode(s),n+=2;continue}t+=String.fromCharCode(r),n++;continue}if((r&240)===224){if(n+2<e.length&&(e[n+1]&192)===128&&(e[n+2]&192)===128){if(r===224&&e[n+1]<160){t+=String.fromCharCode(r),n++;continue}let s=(r&15)<<12|(e[n+1]&63)<<6|e[n+2]&63;if(s>=55296&&s<=57343){t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(s),n+=3;continue}t+=String.fromCharCode(r),n++;continue}if((r&248)===240&&r<=244){if(n+3<e.length&&(e[n+1]&192)===128&&(e[n+2]&192)===128&&(e[n+3]&192)===128){if(r===240&&e[n+1]<144){t+=String.fromCharCode(r),n++;continue}let s=(r&7)<<18|(e[n+1]&63)<<12|(e[n+2]&63)<<6|e[n+3]&63;if(s>1114111){t+=String.fromCharCode(r),n++;continue}t+=String.fromCodePoint(s),n+=4;continue}t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(r),n++}return t}function d7(e,t,n,r){let s="",i=0,a=0,o=!1,l="";for(;i<e.length;)if(e[i]==="%"&&i+1<e.length){let c=i;if(i++,e[i]==="%"){s+="%",i++;continue}let u=e.slice(c).match(/^%(-?\d*)(?:\.(\d+))?\(([^)]*)\)T/);if(u){let S=u[1]?parseInt(u[1],10):0,$=u[2]?parseInt(u[2],10):-1,O=u[3],L=u[0],R=t[n+a]||"";a++;let W;R===""||R==="-1"||R==="-2"?W=Math.floor(Date.now()/1e3):W=parseInt(R,10)||0;let v=vu(O,W,r);if($>=0&&v.length>$&&(v=v.slice(0,$)),S!==0){let N=Math.abs(S);v.length<N&&(S<0?v=v.padEnd(N," "):v=v.padStart(N," "))}s+=v,i=c+L.length;continue}for(;i<e.length&&"+-0 #'".includes(e[i]);)i++;let f=!1;if(e[i]==="*")f=!0,i++;else for(;i<e.length&&/\d/.test(e[i]);)i++;let p=!1;if(e[i]===".")if(i++,e[i]==="*")p=!0,i++;else for(;i<e.length&&/\d/.test(e[i]);)i++;i<e.length&&"hlL".includes(e[i])&&i++;let h=e[i]||"";i++;let d=e.slice(c,i);if(f){let S=parseInt(t[n+a]||"0",10);a++,d=d.replace("*",String(S))}if(p){let S=parseInt(t[n+a]||"0",10);a++,d=d.replace(".*",`.${S}`)}let g=t[n+a]||"";a++;let{value:w,parseError:y,parseErrMsg:b,stopped:x}=m7(d,h,g);if(s+=w,y&&(o=!0,b&&(l=b)),x)return{result:s,argsConsumed:a,error:o,errMsg:l,stopped:!0}}else s+=e[i],i++;return{result:s,argsConsumed:a,error:o,errMsg:l,stopped:!1}}function m7(e,t,n){let r=!1,s="";switch(t){case"d":case"i":{let i=Ks(n);return r=Jt,r&&(s=`printf: ${n}: invalid number
40
40
  `),{value:$u(e,i),parseError:r,parseErrMsg:s}}case"o":{let i=Ks(n);return r=Jt,r&&(s=`printf: ${n}: invalid number
41
41
  `),{value:g7(e,i),parseError:r,parseErrMsg:s}}case"u":{let i=Ks(n);r=Jt,r&&(s=`printf: ${n}: invalid number
42
42
  `);let a=i<0?i>>>0:i;return{value:$u(e.replace("u","d"),a),parseError:r,parseErrMsg:s}}case"x":case"X":{let i=Ks(n);return r=Jt,r&&(s=`printf: ${n}: invalid number
@@ -48,7 +48,7 @@ Notes:
48
48
  `,exitCode:1};if(n=e[r+1],!/^[a-zA-Z_][a-zA-Z0-9_]*(\[[^\]]+\])?$/.test(n))return{stdout:"",stderr:`printf: \`${n}': not a valid identifier
49
49
  `,exitCode:2};r+=2}else{if(a.startsWith("-")&&a!=="-")break;break}}if(r>=e.length)return{stdout:"",stderr:`printf: usage: printf format [arguments]
50
50
  `,exitCode:1};let s=e[r],i=e.slice(r+1);try{let a=Zs(s),o="",l=0,c=!1,u="",f=t.env.get("TZ"),p=t.limits?.maxStringLength;do{let{result:h,argsConsumed:m,error:d,errMsg:g,stopped:w}=d7(a,i,l,f);if(o+=h,p!==void 0&&p>0&&o.length>p)throw new J(`printf: output size limit exceeded (${p} bytes)`,"string_length");if(l+=m,d&&(c=!0,g&&(u=g)),w)break}while(l<i.length&&l>0);if(l===0&&i.length>0,n){let h=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(['"]?)(.+?)\2\]$/);if(h){let m=h[1],d=h[3];d=d.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(g,w)=>t.env.get(w)??""),t.env.set(`${m}_${d}`,o)}else t.env.set(n,o);return{stdout:"",stderr:u,exitCode:c?1:0}}return{stdout:o,stderr:u,exitCode:c?1:0}}catch(a){if(a instanceof J)throw a;return{stdout:"",stderr:`printf: ${Ue(a)}
51
- `,exitCode:1}}}};Jt=!1;S7={name:"printf",flags:[{flag:"-v",type:"value",valueHint:"string"}],stdinType:"none",needsArgs:!0}});var Du={};K(Du,{flagsForFuzzing:()=>I7,lsCommand:()=>k7});import{minimatch as Tu}from"minimatch";function Qs(e){if(e<1024)return String(e);if(e<1024*1024){let n=e/1024;return n<10?`${n.toFixed(1)}K`:`${Math.round(n)}K`}if(e<1024*1024*1024){let n=e/1048576;return n<10?`${n.toFixed(1)}M`:`${Math.round(n)}M`}let t=e/(1024*1024*1024);return t<10?`${t.toFixed(1)}G`:`${Math.round(t)}G`}function Xs(e){let n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],r=String(e.getDate()).padStart(2," "),s=new Date,i=new Date(s.getTime()-4320*60*60*1e3);if(e>i){let o=String(e.getHours()).padStart(2,"0"),l=String(e.getMinutes()).padStart(2,"0");return`${n} ${r} ${o}:${l}`}let a=e.getFullYear();return`${n} ${r} ${a}`}function Qn(e){return e.isDirectory?"/":e.isSymbolicLink?"@":(e.mode&73)!==0?"*":""}async function v7(e,t,n,r,s,i=!1,a=!1,o=!1,l=!1){let c=n||r,u=t.fs.getAllPaths(),f=t.fs.resolvePath(t.cwd,"."),p=[];for(let h of u){let m=h.startsWith(f)&&h.slice(f.length+1)||h;if(Tu(m,e)||Tu(h,e)){let d=m.split("/").pop()||m;if(!c&&d.startsWith("."))continue;p.push(m||h)}}if(p.length===0)return{stdout:"",stderr:`ls: ${e}: No such file or directory
51
+ `,exitCode:1}}}};Jt=!1;S7={name:"printf",flags:[{flag:"-v",type:"value",valueHint:"string"}],stdinType:"none",needsArgs:!0}});var Du={};K(Du,{flagsForFuzzing:()=>I7,lsCommand:()=>v7});import{minimatch as Tu}from"minimatch";function Qs(e){if(e<1024)return String(e);if(e<1024*1024){let n=e/1024;return n<10?`${n.toFixed(1)}K`:`${Math.round(n)}K`}if(e<1024*1024*1024){let n=e/1048576;return n<10?`${n.toFixed(1)}M`:`${Math.round(n)}M`}let t=e/(1024*1024*1024);return t<10?`${t.toFixed(1)}G`:`${Math.round(t)}G`}function Xs(e){let n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],r=String(e.getDate()).padStart(2," "),s=new Date,i=new Date(s.getTime()-4320*60*60*1e3);if(e>i){let o=String(e.getHours()).padStart(2,"0"),l=String(e.getMinutes()).padStart(2,"0");return`${n} ${r} ${o}:${l}`}let a=e.getFullYear();return`${n} ${r} ${a}`}function Qn(e){return e.isDirectory?"/":e.isSymbolicLink?"@":(e.mode&73)!==0?"*":""}async function k7(e,t,n,r,s,i=!1,a=!1,o=!1,l=!1){let c=n||r,u=t.fs.getAllPaths(),f=t.fs.resolvePath(t.cwd,"."),p=[];for(let h of u){let m=h.startsWith(f)&&h.slice(f.length+1)||h;if(Tu(m,e)||Tu(h,e)){let d=m.split("/").pop()||m;if(!c&&d.startsWith("."))continue;p.push(m||h)}}if(p.length===0)return{stdout:"",stderr:`ls: ${e}: No such file or directory
52
52
  `,exitCode:2};if(o){let h=[];for(let m of p){let d=t.fs.resolvePath(t.cwd,m);try{let g=await t.fs.stat(d);h.push({path:m,size:g.size??0})}catch{h.push({path:m,size:0})}}h.sort((m,d)=>d.size-m.size),p.length=0,p.push(...h.map(m=>m.path))}else p.sort();if(i&&p.reverse(),s){let h=[];for(let m of p){let d=t.fs.resolvePath(t.cwd,m);try{let g=await t.fs.stat(d),w=g.isDirectory?"drwxr-xr-x":"-rw-r--r--",y=l?Qn(await t.fs.lstat(d)):g.isDirectory?"/":"",b=g.size??0,x=a?Qs(b).padStart(5):String(b).padStart(5),S=g.mtime??new Date(0),$=Xs(S);h.push(`${w} 1 user user ${x} ${$} ${m}${y}`)}catch{h.push(`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${m}`)}}return{stdout:`${h.join(`
53
53
  `)}
54
54
  `,stderr:"",exitCode:0}}if(l){let h=[];for(let m of p){let d=t.fs.resolvePath(t.cwd,m);try{let g=await t.fs.lstat(d);h.push(`${m}${Qn(g)}`)}catch{h.push(m)}}return{stdout:`${h.join(`
@@ -60,7 +60,7 @@ Notes:
60
60
  `,stderr:"",exitCode:0}}let d=await t.fs.readdir(h);if(p||(d=d.filter(w=>!w.startsWith("."))),c){let w=[];for(let y of d){let b=h==="/"?`/${y}`:`${h}/${y}`;try{let x=await t.fs.stat(b);w.push({name:y,size:x.size??0})}catch{w.push({name:y,size:0})}}w.sort((y,b)=>b.size-y.size),d=w.map(y=>y.name)}else d.sort();n&&(d=[".","..",...d]),o&&d.reverse();let g="";if((i||a)&&(g+=`${e}:
61
61
  `),s){g+=`total ${d.length}
62
62
  `;let w=d.filter(S=>S==="."||S===".."),y=d.filter(S=>S!=="."&&S!=="..");for(let S of w)g+=`drwxr-xr-x 1 user user 0 Jan 1 00:00 ${S}
63
- `;let b=[];for(let S=0;S<y.length;S+=100){let $=y.slice(S,S+100),O=await Promise.all($.map(async L=>{let R=h==="/"?`/${L}`:`${h}/${L}`;try{let W=await t.fs.stat(R),k=W.isDirectory?"drwxr-xr-x":"-rw-r--r--",N=u?Qn(await t.fs.lstat(R)):W.isDirectory?"/":"",P=W.size??0,v=l?Qs(P).padStart(5):String(P).padStart(5),T=W.mtime??new Date(0),F=Xs(T);return{name:L,line:`${k} 1 user user ${v} ${F} ${L}${N}
63
+ `;let b=[];for(let S=0;S<y.length;S+=100){let $=y.slice(S,S+100),O=await Promise.all($.map(async L=>{let R=h==="/"?`/${L}`:`${h}/${L}`;try{let W=await t.fs.stat(R),v=W.isDirectory?"drwxr-xr-x":"-rw-r--r--",N=u?Qn(await t.fs.lstat(R)):W.isDirectory?"/":"",P=W.size??0,k=l?Qs(P).padStart(5):String(P).padStart(5),T=W.mtime??new Date(0),F=Xs(T);return{name:L,line:`${v} 1 user user ${k} ${F} ${L}${N}
64
64
  `}}catch{return{name:L,line:`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${L}
65
65
  `}}}));b.push(...O)}let x=new Map(y.map((S,$)=>[S,$]));b.sort((S,$)=>(x.get(S.name)??0)-(x.get($.name)??0));for(let{line:S}of b)g+=S}else if(u){let w=[],y=d.filter(x=>x!=="."&&x!==".."),b=d.filter(x=>x==="."||x==="..");for(let x of b)w.push(`${x}/`);for(let x=0;x<y.length;x+=100){let S=y.slice(x,x+100),$=await Promise.all(S.map(async O=>{let L=h==="/"?`/${O}`:`${h}/${O}`;try{let R=await t.fs.lstat(L);return`${O}${Qn(R)}`}catch{return O}}));w.push(...$)}g+=w.join(`
66
66
  `)+(w.length?`
@@ -68,13 +68,13 @@ Notes:
68
68
  `)+(d.length?`
69
69
  `:"");if(i){let w=d.filter(x=>x!=="."&&x!==".."),y=[];if(t.fs.readdirWithFileTypes)y=(await t.fs.readdirWithFileTypes(h)).filter(S=>S.isDirectory&&w.includes(S.name)).map(S=>({name:S.name,isDirectory:!0}));else for(let x=0;x<w.length;x+=100){let S=w.slice(x,x+100),$=await Promise.all(S.map(async O=>{let L=h==="/"?`/${O}`:`${h}/${O}`;try{let R=await t.fs.stat(L);return{name:O,isDirectory:R.isDirectory}}catch{return{name:O,isDirectory:!1}}}));y.push(...$.filter(O=>O.isDirectory))}y.sort((x,S)=>x.name.localeCompare(S.name)),o&&y.reverse();let b=[];for(let x=0;x<y.length;x+=100){let S=y.slice(x,x+100),$=await Promise.all(S.map(async O=>{let L=e==="."?`./${O.name}`:`${e}/${O.name}`,R=await Pu(L,t,n,r,s,i,!1,o,l,c,u,!0);return{name:O.name,result:R}}));b.push(...$)}b.sort((x,S)=>x.name.localeCompare(S.name)),o&&b.reverse();for(let{result:x}of b)g+=`
70
70
  `,g+=x.stdout}return{stdout:g,stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`ls: ${e}: No such file or directory
71
- `,exitCode:2}}}var C7,N7,k7,I7,_u=I(()=>{"use strict";Ze();yr();se();C7={name:"ls",summary:"list directory contents",usage:"ls [OPTION]... [FILE]...",options:["-a, --all do not ignore entries starting with .","-A, --almost-all do not list . and ..","-d, --directory list directories themselves, not their contents","-F, --classify append indicator (one of */=>@) to entries","-h, --human-readable with -l, print sizes like 1K 234M 2G etc.","-l use a long listing format","-r, --reverse reverse order while sorting","-R, --recursive list subdirectories recursively","-S sort by file size, largest first","-t sort by time, newest first","-1 list one file per line"," --help display this help and exit"]},N7={showAll:{short:"a",long:"all",type:"boolean"},showAlmostAll:{short:"A",long:"almost-all",type:"boolean"},longFormat:{short:"l",type:"boolean"},humanReadable:{short:"h",long:"human-readable",type:"boolean"},recursive:{short:"R",long:"recursive",type:"boolean"},reverse:{short:"r",long:"reverse",type:"boolean"},sortBySize:{short:"S",type:"boolean"},classifyFiles:{short:"F",long:"classify",type:"boolean"},directoryOnly:{short:"d",long:"directory",type:"boolean"},sortByTime:{short:"t",type:"boolean"},onePerLine:{short:"1",type:"boolean"}},k7={name:"ls",async execute(e,t){if(U(e))return M(C7);let n=be("ls",e,N7);if(!n.ok)return n.error;let r=n.result.flags.showAll,s=n.result.flags.showAlmostAll,i=n.result.flags.longFormat,a=n.result.flags.humanReadable,o=n.result.flags.recursive,l=n.result.flags.reverse,c=n.result.flags.sortBySize,u=n.result.flags.classifyFiles,f=n.result.flags.directoryOnly,p=n.result.flags.sortByTime;n.result.flags.onePerLine;let h=n.result.positional;h.length===0&&h.push(".");let m="",d="",g=0;for(let w=0;w<h.length;w++){let y=h[w];if(w>0&&m&&!m.endsWith(`
71
+ `,exitCode:2}}}var C7,N7,v7,I7,_u=I(()=>{"use strict";Ze();yr();se();C7={name:"ls",summary:"list directory contents",usage:"ls [OPTION]... [FILE]...",options:["-a, --all do not ignore entries starting with .","-A, --almost-all do not list . and ..","-d, --directory list directories themselves, not their contents","-F, --classify append indicator (one of */=>@) to entries","-h, --human-readable with -l, print sizes like 1K 234M 2G etc.","-l use a long listing format","-r, --reverse reverse order while sorting","-R, --recursive list subdirectories recursively","-S sort by file size, largest first","-t sort by time, newest first","-1 list one file per line"," --help display this help and exit"]},N7={showAll:{short:"a",long:"all",type:"boolean"},showAlmostAll:{short:"A",long:"almost-all",type:"boolean"},longFormat:{short:"l",type:"boolean"},humanReadable:{short:"h",long:"human-readable",type:"boolean"},recursive:{short:"R",long:"recursive",type:"boolean"},reverse:{short:"r",long:"reverse",type:"boolean"},sortBySize:{short:"S",type:"boolean"},classifyFiles:{short:"F",long:"classify",type:"boolean"},directoryOnly:{short:"d",long:"directory",type:"boolean"},sortByTime:{short:"t",type:"boolean"},onePerLine:{short:"1",type:"boolean"}},v7={name:"ls",async execute(e,t){if(U(e))return M(C7);let n=be("ls",e,N7);if(!n.ok)return n.error;let r=n.result.flags.showAll,s=n.result.flags.showAlmostAll,i=n.result.flags.longFormat,a=n.result.flags.humanReadable,o=n.result.flags.recursive,l=n.result.flags.reverse,c=n.result.flags.sortBySize,u=n.result.flags.classifyFiles,f=n.result.flags.directoryOnly,p=n.result.flags.sortByTime;n.result.flags.onePerLine;let h=n.result.positional;h.length===0&&h.push(".");let m="",d="",g=0;for(let w=0;w<h.length;w++){let y=h[w];if(w>0&&m&&!m.endsWith(`
72
72
 
73
73
  `)&&(m+=`
74
74
  `),f){let b=t.fs.resolvePath(t.cwd,y);try{let x=await t.fs.stat(b);if(i){let S=x.isDirectory?"drwxr-xr-x":"-rw-r--r--",$=u?Qn(await t.fs.lstat(b)):x.isDirectory?"/":"",O=x.size??0,L=a?Qs(O).padStart(5):String(O).padStart(5),R=x.mtime??new Date(0),W=Xs(R);m+=`${S} 1 user user ${L} ${W} ${y}${$}
75
75
  `}else{let S=u?Qn(await t.fs.lstat(b)):"";m+=`${y}${S}
76
76
  `}}catch{d+=`ls: cannot access '${y}': No such file or directory
77
- `,g=2}continue}if(y.includes("*")||y.includes("?")||y.includes("[")){let b=await v7(y,t,r,s,i,l,a,c,u);m+=b.stdout,d+=b.stderr,b.exitCode!==0&&(g=b.exitCode)}else{let b=await Pu(y,t,r,s,i,o,h.length>1,l,a,c,u);m+=b.stdout,d+=b.stderr,b.exitCode!==0&&(g=b.exitCode)}}return{stdout:m,stderr:d,exitCode:g}}};I7={name:"ls",flags:[{flag:"-a",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-1",type:"boolean"}],needsFiles:!0}});var Lu={};K(Lu,{flagsForFuzzing:()=>R7,mkdirCommand:()=>O7});var $7,O7,R7,Fu=I(()=>{"use strict";zt();Ze();$7={recursive:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},O7={name:"mkdir",async execute(e,t){let n=be("mkdir",e,$7);if(!n.ok)return n.error;let r=n.result.flags.recursive,s=n.result.flags.verbose,i=n.result.positional;if(i.length===0)return{stdout:"",stderr:`mkdir: missing operand
77
+ `,g=2}continue}if(y.includes("*")||y.includes("?")||y.includes("[")){let b=await k7(y,t,r,s,i,l,a,c,u);m+=b.stdout,d+=b.stderr,b.exitCode!==0&&(g=b.exitCode)}else{let b=await Pu(y,t,r,s,i,o,h.length>1,l,a,c,u);m+=b.stdout,d+=b.stderr,b.exitCode!==0&&(g=b.exitCode)}}return{stdout:m,stderr:d,exitCode:g}}};I7={name:"ls",flags:[{flag:"-a",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-1",type:"boolean"}],needsFiles:!0}});var Lu={};K(Lu,{flagsForFuzzing:()=>R7,mkdirCommand:()=>O7});var $7,O7,R7,Fu=I(()=>{"use strict";zt();Ze();$7={recursive:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},O7={name:"mkdir",async execute(e,t){let n=be("mkdir",e,$7);if(!n.ok)return n.error;let r=n.result.flags.recursive,s=n.result.flags.verbose,i=n.result.positional;if(i.length===0)return{stdout:"",stderr:`mkdir: missing operand
78
78
  `,exitCode:1};let a="",o="",l=0;for(let c of i)try{let u=t.fs.resolvePath(t.cwd,c);await t.fs.mkdir(u,{recursive:r}),s&&(a+=`mkdir: created directory '${c}'
79
79
  `)}catch(u){let f=Ue(u);f.includes("ENOENT")||f.includes("no such file")?o+=`mkdir: cannot create directory '${c}': No such file or directory
80
80
  `:f.includes("EEXIST")||f.includes("already exists")?o+=`mkdir: cannot create directory '${c}': File exists
@@ -159,7 +159,7 @@ Options:
159
159
  `,i+=`Access: (${f}/${p})
160
160
  `,i+=`Modify: ${u.mtime.toISOString()}
161
161
  `}}catch{a+=`stat: cannot stat '${l}': No such file or directory
162
- `,o=!0}}return{stdout:i,stderr:a,exitCode:o?1:0}}};Ey={name:"stat",flags:[{flag:"-c",type:"value",valueHint:"format"},{flag:"-L",type:"boolean"}],needsArgs:!0}});var Q,D,C,qt,he,Ne,Ff,Rn,ei,ja,Ar,Sr,De,Ga,en,Va,qa,dn,Za,Ka,Ge,we,Qa,ti,os,_,Xa,Er,Ya,Ja,Ce,wf,bf,xf,Ef,Af,Sf,Cf,Nf,kf,vf,If,$f,Of,Rf,Tf,Pf,Df,_f,Lf,hn,ls,eo,to,no,ro,so,Tn,Mf=I(()=>{Q=class e{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static MATCH_NL=e.CLASS_NL|e.DOT_NL;static PERL=e.CLASS_NL|e.ONE_LINE|e.PERL_X|e.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2},D=class{static CODES=new Map([["\x07",7],["\b",8],[" ",9],[`
162
+ `,o=!0}}return{stdout:i,stderr:a,exitCode:o?1:0}}};Ey={name:"stat",flags:[{flag:"-c",type:"value",valueHint:"format"},{flag:"-L",type:"boolean"}],needsArgs:!0}});var Q,D,C,qt,he,Ne,Ff,Rn,ei,ja,Ar,Sr,De,Ga,en,Va,qa,dn,Za,Ka,Ge,we,Qa,ti,os,_,Xa,Er,Ya,Ja,Ce,wf,bf,xf,Ef,Af,Sf,Cf,Nf,vf,kf,If,$f,Of,Rf,Tf,Pf,Df,_f,Lf,hn,ls,eo,to,no,ro,so,Tn,Mf=I(()=>{Q=class e{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static MATCH_NL=e.CLASS_NL|e.DOT_NL;static PERL=e.CLASS_NL|e.ONE_LINE|e.PERL_X|e.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2},D=class{static CODES=new Map([["\x07",7],["\b",8],[" ",9],[`
163
163
  `,10],["\v",11],["\f",12],["\r",13],[" ",32],['"',34],["$",36],["&",38],["(",40],[")",41],["*",42],["+",43],["-",45],[".",46],["0",48],["1",49],["2",50],["3",51],["4",52],["5",53],["6",54],["7",55],["8",56],["9",57],[":",58],["<",60],[">",62],["?",63],["A",65],["B",66],["C",67],["F",70],["P",80],["Q",81],["U",85],["Z",90],["[",91],["\\",92],["]",93],["^",94],["_",95],["a",97],["b",98],["f",102],["i",105],["m",109],["n",110],["r",114],["s",115],["t",116],["v",118],["x",120],["z",122],["{",123],["|",124],["}",125]]);static toUpperCase(t){let n=String.fromCodePoint(t).toUpperCase();if(n.length>1)return t;let r=String.fromCodePoint(n.codePointAt(0)).toLowerCase();return r.length>1||r.codePointAt(0)!==t?t:n.codePointAt(0)}static toLowerCase(t){let n=String.fromCodePoint(t).toLowerCase();if(n.length>1)return t;let r=String.fromCodePoint(n.codePointAt(0)).toUpperCase();return r.length>1||r.codePointAt(0)!==t?t:n.codePointAt(0)}},C=class{SIZE=3;constructor(t){this.data=t}getLo(t){return this.data[t*this.SIZE]}getHi(t){return this.data[t*this.SIZE+1]}getStride(t){return this.data[t*this.SIZE+2]}get(t){let n=t*this.SIZE;return[this.data[n],this.data[n+1],this.data[n+2]]}get length(){return this.data.length/this.SIZE}},qt=class e{static CASE_ORBIT=new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[68944,68976],[68976,68944],[68945,68977],[68977,68945],[68946,68978],[68978,68946],[68947,68979],[68979,68947],[68948,68980],[68980,68948],[68949,68981],[68981,68949],[68950,68982],[68982,68950],[68951,68983],[68983,68951],[68952,68984],[68984,68952],[68953,68985],[68985,68953],[68954,68986],[68986,68954],[68955,68987],[68987,68955],[68956,68988],[68988,68956],[68957,68989],[68989,68957],[68958,68990],[68990,68958],[68959,68991],[68991,68959],[68960,68992],[68992,68960],[68961,68993],[68993,68961],[68962,68994],[68994,68962],[68963,68995],[68995,68963],[68964,68996],[68996,68964],[68965,68997],[68997,68965],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[93771,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]);static C=new C(new Uint32Array([0,31,1,127,159,1,173,888,715,889,896,7,897,899,1,907,909,2,930,1328,398,1367,1368,1,1419,1420,1,1424,1480,56,1481,1487,1,1515,1518,1,1525,1541,1,1564,1757,193,1806,1807,1,1867,1868,1,1970,1983,1,2043,2044,1,2094,2095,1,2111,2140,29,2141,2143,2,2155,2159,1,2191,2198,1,2274,2436,162,2445,2446,1,2449,2450,1,2473,2481,8,2483,2485,1,2490,2491,1,2501,2502,1,2505,2506,1,2511,2518,1,2520,2523,1,2526,2532,6,2533,2559,26,2560,2564,4,2571,2574,1,2577,2578,1,2601,2609,8,2612,2618,3,2619,2621,2,2627,2630,1,2633,2634,1,2638,2640,1,2642,2648,1,2653,2655,2,2656,2661,1,2679,2688,1,2692,2702,10,2706,2729,23,2737,2740,3,2746,2747,1,2758,2766,4,2767,2769,2,2770,2783,1,2788,2789,1,2802,2808,1,2816,2820,4,2829,2830,1,2833,2834,1,2857,2865,8,2868,2874,6,2875,2885,10,2886,2889,3,2890,2894,4,2895,2900,1,2904,2907,1,2910,2916,6,2917,2936,19,2937,2945,1,2948,2955,7,2956,2957,1,2961,2966,5,2967,2968,1,2971,2973,2,2976,2978,1,2981,2983,1,2987,2989,1,3002,3005,1,3011,3013,1,3017,3022,5,3023,3025,2,3026,3030,1,3032,3045,1,3067,3071,1,3085,3089,4,3113,3130,17,3131,3141,10,3145,3150,5,3151,3156,1,3159,3163,4,3164,3166,2,3167,3172,5,3173,3184,11,3185,3190,1,3213,3217,4,3241,3252,11,3258,3259,1,3269,3273,4,3278,3284,1,3287,3292,1,3295,3300,5,3301,3312,11,3316,3327,1,3341,3345,4,3397,3401,4,3408,3411,1,3428,3429,1,3456,3460,4,3479,3481,1,3506,3516,10,3518,3519,1,3527,3529,1,3531,3534,1,3541,3543,2,3552,3557,1,3568,3569,1,3573,3584,1,3643,3646,1,3676,3712,1,3715,3717,2,3723,3748,25,3750,3774,24,3775,3781,6,3783,3791,8,3802,3803,1,3808,3839,1,3912,3949,37,3950,3952,1,3992,4029,37,4045,4059,14,4060,4095,1,4294,4296,2,4297,4300,1,4302,4303,1,4681,4686,5,4687,4695,8,4697,4702,5,4703,4745,42,4750,4751,1,4785,4790,5,4791,4799,8,4801,4806,5,4807,4823,16,4881,4886,5,4887,4955,68,4956,4989,33,4990,4991,1,5018,5023,1,5110,5111,1,5118,5119,1,5789,5791,1,5881,5887,1,5910,5918,1,5943,5951,1,5972,5983,1,5997,6001,4,6004,6015,1,6110,6111,1,6122,6127,1,6138,6143,1,6158,6170,12,6171,6175,1,6265,6271,1,6315,6319,1,6390,6399,1,6431,6444,13,6445,6447,1,6460,6463,1,6465,6467,1,6510,6511,1,6517,6527,1,6572,6575,1,6602,6607,1,6619,6621,1,6684,6685,1,6751,6781,30,6782,6794,12,6795,6799,1,6810,6815,1,6830,6831,1,6863,6911,1,6989,7156,167,7157,7163,1,7224,7226,1,7242,7244,1,7307,7311,1,7355,7356,1,7368,7375,1,7419,7423,1,7958,7959,1,7966,7967,1,8006,8007,1,8014,8015,1,8024,8030,2,8062,8063,1,8117,8133,16,8148,8149,1,8156,8176,20,8177,8181,4,8191,8203,12,8204,8207,1,8234,8238,1,8288,8303,1,8306,8307,1,8335,8349,14,8350,8351,1,8385,8399,1,8433,8447,1,8588,8591,1,9258,9279,1,9291,9311,1,11124,11125,1,11158,11508,350,11509,11512,1,11558,11560,2,11561,11564,1,11566,11567,1,11624,11630,1,11633,11646,1,11671,11679,1,11687,11743,8,11870,11903,1,11930,12020,90,12021,12031,1,12246,12271,1,12352,12439,87,12440,12544,104,12545,12548,1,12592,12687,95,12774,12782,1,12831,42125,29294,42126,42127,1,42183,42191,1,42540,42559,1,42744,42751,1,42958,42959,1,42962,42964,2,42973,42993,1,43053,43055,1,43066,43071,1,43128,43135,1,43206,43213,1,43226,43231,1,43348,43358,1,43389,43391,1,43470,43482,12,43483,43485,1,43519,43575,56,43576,43583,1,43598,43599,1,43610,43611,1,43715,43738,1,43767,43776,1,43783,43784,1,43791,43792,1,43799,43807,1,43815,43823,8,43884,43887,1,44014,44015,1,44026,44031,1,55204,55215,1,55239,55242,1,55292,63743,1,64110,64111,1,64218,64255,1,64263,64274,1,64280,64284,1,64311,64317,6,64319,64325,3,64451,64466,1,64912,64913,1,64968,64974,1,64976,65007,1,65050,65055,1,65107,65127,20,65132,65135,1,65141,65277,136,65278,65280,1,65471,65473,1,65480,65481,1,65488,65489,1,65496,65497,1,65501,65503,1,65511,65519,8,65520,65531,1,65534,65535,1,65548,65575,27,65595,65598,3,65614,65615,1,65630,65663,1,65787,65791,1,65795,65798,1,65844,65846,1,65935,65949,14,65950,65951,1,65953,65999,1,66046,66175,1,66205,66207,1,66257,66271,1,66300,66303,1,66340,66348,1,66379,66383,1,66427,66431,1,66462,66500,38,66501,66503,1,66518,66559,1,66718,66719,1,66730,66735,1,66772,66775,1,66812,66815,1,66856,66863,1,66916,66926,1,66939,66955,16,66963,66966,3,66978,66994,16,67002,67005,3,67006,67007,1,67060,67071,1,67383,67391,1,67414,67423,1,67432,67455,1,67462,67505,43,67515,67583,1,67590,67591,1,67593,67638,45,67641,67643,1,67645,67646,1,67670,67743,73,67744,67750,1,67760,67807,1,67827,67830,3,67831,67834,1,67868,67870,1,67898,67902,1,67904,67967,1,68024,68027,1,68048,68049,1,68100,68103,3,68104,68107,1,68116,68120,4,68150,68151,1,68155,68158,1,68169,68175,1,68185,68191,1,68256,68287,1,68327,68330,1,68343,68351,1,68406,68408,1,68438,68439,1,68467,68471,1,68498,68504,1,68509,68520,1,68528,68607,1,68681,68735,1,68787,68799,1,68851,68857,1,68904,68911,1,68922,68927,1,68966,68968,1,68998,69005,1,69008,69215,1,69247,69290,43,69294,69295,1,69298,69313,1,69317,69371,1,69416,69423,1,69466,69487,1,69514,69551,1,69580,69599,1,69623,69631,1,69710,69713,1,69750,69758,1,69821,69827,6,69828,69839,1,69865,69871,1,69882,69887,1,69941,69960,19,69961,69967,1,70007,70015,1,70112,70133,21,70134,70143,1,70162,70210,48,70211,70271,1,70279,70281,2,70286,70302,16,70314,70319,1,70379,70383,1,70394,70399,1,70404,70413,9,70414,70417,3,70418,70441,23,70449,70452,3,70458,70469,11,70470,70473,3,70474,70478,4,70479,70481,2,70482,70486,1,70488,70492,1,70500,70501,1,70509,70511,1,70517,70527,1,70538,70540,2,70541,70543,2,70582,70593,11,70595,70596,1,70598,70603,5,70614,70617,3,70618,70624,1,70627,70655,1,70748,70754,6,70755,70783,1,70856,70863,1,70874,71039,1,71094,71095,1,71134,71167,1,71237,71247,1,71258,71263,1,71277,71295,1,71354,71359,1,71370,71375,1,71396,71423,1,71451,71452,1,71468,71471,1,71495,71679,1,71740,71839,1,71923,71934,1,71943,71944,1,71946,71947,1,71956,71959,3,71990,71993,3,71994,72007,13,72008,72015,1,72026,72095,1,72104,72105,1,72152,72153,1,72165,72191,1,72264,72271,1,72355,72367,1,72441,72447,1,72458,72639,1,72674,72687,1,72698,72703,1,72713,72759,46,72774,72783,1,72813,72815,1,72848,72849,1,72872,72887,15,72888,72959,1,72967,72970,3,73015,73017,1,73019,73022,3,73032,73039,1,73050,73055,1,73062,73065,3,73103,73106,3,73113,73119,1,73130,73439,1,73465,73471,1,73489,73531,42,73532,73533,1,73563,73647,1,73649,73663,1,73714,73726,1,74650,74751,1,74863,74869,6,74870,74879,1,75076,77711,1,77811,77823,1,78896,78911,1,78934,78943,1,82939,82943,1,83527,90367,1,90426,92159,1,92729,92735,1,92767,92778,11,92779,92781,1,92863,92874,11,92875,92879,1,92910,92911,1,92918,92927,1,92998,93007,1,93018,93026,8,93048,93052,1,93072,93503,1,93562,93759,1,93851,93951,1,94027,94030,1,94088,94094,1,94112,94175,1,94181,94191,1,94194,94207,1,100344,100351,1,101590,101630,1,101641,110575,1,110580,110588,8,110591,110883,292,110884,110897,1,110899,110927,1,110931,110932,1,110934,110947,1,110952,110959,1,111356,113663,1,113771,113775,1,113789,113791,1,113801,113807,1,113818,113819,1,113824,117759,1,118010,118015,1,118452,118527,1,118574,118575,1,118599,118607,1,118724,118783,1,119030,119039,1,119079,119080,1,119155,119162,1,119275,119295,1,119366,119487,1,119508,119519,1,119540,119551,1,119639,119647,1,119673,119807,1,119893,119965,72,119968,119969,1,119971,119972,1,119975,119976,1,119981,119994,13,119996,120004,8,120070,120075,5,120076,120085,9,120093,120122,29,120127,120133,6,120135,120137,1,120145,120486,341,120487,120780,293,120781,121484,703,121485,121498,1,121504,121520,16,121521,122623,1,122655,122660,1,122667,122879,1,122887,122905,18,122906,122914,8,122917,122923,6,122924,122927,1,122990,123022,1,123024,123135,1,123181,123183,1,123198,123199,1,123210,123213,1,123216,123535,1,123567,123583,1,123642,123646,1,123648,124111,1,124154,124367,1,124411,124414,1,124416,124895,1,124903,124908,5,124911,124927,16,125125,125126,1,125143,125183,1,125260,125263,1,125274,125277,1,125280,126064,1,126133,126208,1,126270,126463,1,126468,126496,28,126499,126501,2,126502,126504,2,126515,126520,5,126522,126524,2,126525,126529,1,126531,126534,1,126536,126540,2,126544,126547,3,126549,126550,1,126552,126560,2,126563,126565,2,126566,126571,5,126579,126589,5,126591,126602,11,126620,126624,1,126628,126634,6,126652,126703,1,126706,126975,1,127020,127023,1,127124,127135,1,127151,127152,1,127168,127184,16,127222,127231,1,127406,127461,1,127491,127503,1,127548,127551,1,127561,127567,1,127570,127583,1,127590,127743,1,128728,128731,1,128749,128751,1,128765,128767,1,128887,128890,1,128986,128991,1,129004,129007,1,129009,129023,1,129036,129039,1,129096,129103,1,129114,129119,1,129160,129167,1,129198,129199,1,129212,129215,1,129218,129279,1,129620,129631,1,129646,129647,1,129661,129663,1,129674,129678,1,129735,129741,1,129757,129758,1,129770,129775,1,129785,129791,1,129939,130042,103,130043,131071,1,173792,173823,1,177978,177983,1,178206,178207,1,183970,183983,1,191457,191471,1,192094,194559,1,195102,196607,1,201547,201551,1,205744,917759,1,918e3,1114111,1]));static Cc=new C(new Uint32Array([0,31,1,127,159,1]));static Cf=new C(new Uint32Array([173,1536,1363,1537,1541,1,1564,1757,193,1807,2192,385,2193,2274,81,6158,8203,2045,8204,8207,1,8234,8238,1,8288,8292,1,8294,8303,1,65279,65529,250,65530,65531,1,69821,69837,16,78896,78911,1,113824,113827,1,119155,119162,1,917505,917536,31,917537,917631,1]));static Co=new C(new Uint32Array([57344,63743,1,983040,1048573,1,1048576,1114109,1]));static Cs=new C(new Uint32Array([55296,57343,1]));static L=new C(new Uint32Array([65,90,1,97,122,1,170,181,11,186,192,6,193,214,1,216,246,1,248,705,1,710,721,1,736,740,1,748,750,2,880,884,1,886,887,1,890,893,1,895,902,7,904,906,1,908,910,2,911,929,1,931,1013,1,1015,1153,1,1162,1327,1,1329,1366,1,1369,1376,7,1377,1416,1,1488,1514,1,1519,1522,1,1568,1610,1,1646,1647,1,1649,1747,1,1749,1765,16,1766,1774,8,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2036,2037,1,2042,2048,6,2049,2069,1,2074,2084,10,2088,2112,24,2113,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2249,1,2308,2361,1,2365,2384,19,2392,2401,1,2417,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3654,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3782,3804,22,3805,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4256,18,4257,4293,1,4295,4301,6,4304,4346,1,4348,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5024,5109,1,5112,5117,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6103,6108,5,6176,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6823,6917,94,6918,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7293,1,7296,7306,1,7312,7354,1,7357,7359,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,7424,6,7425,7615,1,7680,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8124,1,8126,8130,4,8131,8132,1,8134,8140,1,8144,8147,1,8150,8155,1,8160,8172,1,8178,8180,1,8182,8188,1,8305,8319,14,8336,8348,1,8450,8455,5,8458,8467,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8495,8505,1,8508,8511,1,8517,8521,1,8526,8579,53,8580,11264,2684,11265,11492,1,11499,11502,1,11506,11507,1,11520,11557,1,11559,11565,6,11568,11623,1,11631,11648,17,11649,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11823,12293,470,12294,12337,43,12338,12341,1,12347,12348,1,12353,12438,1,12445,12447,1,12449,12538,1,12540,12543,1,12549,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,42124,1,42192,42237,1,42240,42508,1,42512,42527,1,42538,42539,1,42560,42606,1,42623,42653,1,42656,42725,1,42775,42783,1,42786,42888,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43471,43488,17,43489,43492,1,43494,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43741,1,43744,43754,1,43762,43764,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43866,1,43868,43881,1,43888,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65313,65338,1,65345,65370,1,65382,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66560,66717,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68736,68786,1,68800,68850,1,68864,68899,1,68938,68965,1,68975,68997,1,69248,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71840,71903,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,92992,92995,1,93027,93047,1,93053,93071,1,93504,93548,1,93760,93823,1,93952,94026,1,94032,94099,67,94100,94111,1,94176,94177,1,94179,94208,29,94209,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120512,1,120514,120538,1,120540,120570,1,120572,120596,1,120598,120628,1,120630,120654,1,120656,120686,1,120688,120712,1,120714,120744,1,120746,120770,1,120772,120779,1,122624,122654,1,122661,122666,1,122928,122989,1,123136,123180,1,123191,123197,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124139,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125184,125251,1,125259,126464,1205,126465,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static foldL=new C(new Uint32Array([837,837,1]));static Ll=new C(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,311,2,312,328,2,329,375,2,378,382,2,383,384,1,387,389,2,392,396,4,397,402,5,405,409,4,410,411,1,414,417,3,419,421,2,424,426,2,427,429,2,432,436,4,438,441,3,442,445,3,446,447,1,454,460,3,462,476,2,477,495,2,496,499,3,501,505,4,507,563,2,564,569,1,572,575,3,576,578,2,583,591,2,592,659,1,661,687,1,881,883,2,887,891,4,892,893,1,912,940,28,941,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1020,1072,52,1073,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1376,1416,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7424,118,7425,7467,1,7531,7543,1,7545,7578,1,7681,7829,2,7830,7837,1,7839,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8016,8023,1,8032,8039,1,8048,8061,1,8064,8071,1,8080,8087,1,8096,8103,1,8112,8116,1,8118,8119,1,8126,8130,4,8131,8132,1,8134,8135,1,8144,8147,1,8150,8151,1,8160,8167,1,8178,8180,1,8182,8183,1,8458,8462,4,8463,8467,4,8495,8505,5,8508,8509,1,8518,8521,1,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11377,11379,2,11380,11382,2,11383,11387,1,11393,11491,2,11492,11500,8,11502,11507,5,11520,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42800,42801,1,42803,42865,2,42866,42872,1,42874,42876,2,42879,42887,2,42892,42894,2,42897,42899,2,42900,42901,1,42903,42921,2,42927,42933,6,42935,42947,2,42952,42954,2,42957,42961,4,42963,42971,2,42998,43002,4,43824,43866,1,43872,43880,1,43888,43967,1,64256,64262,1,64275,64279,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,119834,119859,1,119886,119892,1,119894,119911,1,119938,119963,1,119990,119993,1,119995,119997,2,119998,120003,1,120005,120015,1,120042,120067,1,120094,120119,1,120146,120171,1,120198,120223,1,120250,120275,1,120302,120327,1,120354,120379,1,120406,120431,1,120458,120485,1,120514,120538,1,120540,120545,1,120572,120596,1,120598,120603,1,120630,120654,1,120656,120661,1,120688,120712,1,120714,120719,1,120746,120770,1,120772,120777,1,120779,122624,1845,122625,122633,1,122635,122654,1,122661,122666,1,125218,125251,1]));static foldLl=new C(new Uint32Array([65,90,1,192,214,1,216,222,1,256,302,2,306,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,453,1,455,456,1,458,459,1,461,475,2,478,494,2,497,498,1,500,502,2,503,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,837,880,43,882,886,4,895,902,7,904,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,984,9,986,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8072,8079,1,8088,8095,1,8104,8111,1,8120,8124,1,8136,8140,1,8152,8155,1,8168,8172,1,8184,8188,1,8486,8490,4,8491,8498,7,8579,11264,2685,11265,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,125184,125217,1]));static Lm=new C(new Uint32Array([688,705,1,710,721,1,736,740,1,748,750,2,884,890,6,1369,1600,231,1765,1766,1,2036,2037,1,2042,2074,32,2084,2088,4,2249,2417,168,3654,3782,128,4348,6103,1755,6211,6823,612,7288,7293,1,7468,7530,1,7544,7579,35,7580,7615,1,8305,8319,14,8336,8348,1,11388,11389,1,11631,11823,192,12293,12337,44,12338,12341,1,12347,12445,98,12446,12540,94,12541,12542,1,40981,42232,1251,42233,42237,1,42508,42623,115,42652,42653,1,42775,42783,1,42864,42888,24,42994,42996,1,43e3,43001,1,43471,43494,23,43632,43741,109,43763,43764,1,43868,43871,1,43881,65392,21511,65438,65439,1,67456,67461,1,67463,67504,1,67506,67514,1,68942,68975,33,92992,92995,1,93504,93506,1,93547,93548,1,94099,94111,1,94176,94177,1,94179,110576,16397,110577,110579,1,110581,110587,1,110589,110590,1,122928,122989,1,123191,123197,1,124139,125259,1120]));static Lo=new C(new Uint32Array([170,186,16,443,448,5,449,451,1,660,1488,828,1489,1514,1,1519,1522,1,1568,1599,1,1601,1610,1,1646,1647,1,1649,1747,1,1749,1774,25,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2048,2069,1,2112,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2248,1,2308,2361,1,2365,2384,19,2392,2401,1,2418,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3653,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3804,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4352,114,4353,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6108,6176,68,6177,6210,1,6212,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6917,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7287,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,8501,1083,8502,8504,1,11568,11623,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,12294,12348,54,12353,12438,1,12447,12449,2,12450,12538,1,12543,12549,6,12550,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,40980,1,40982,42124,1,42192,42231,1,42240,42507,1,42512,42527,1,42538,42539,1,42606,42656,50,42657,42725,1,42895,42999,104,43003,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43488,43492,1,43495,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43631,1,43633,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43740,1,43744,43754,1,43762,43777,15,43778,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43968,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65382,65391,1,65393,65437,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66640,66717,1,66816,66855,1,66864,66915,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68864,68899,1,68938,68941,1,68943,69248,305,69249,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,93027,93047,1,93053,93071,1,93507,93546,1,93952,94026,1,94032,94208,176,94209,100343,1,100352,101589,1,101631,101640,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,122634,123136,502,123137,123180,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124138,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Lt=new C(new Uint32Array([453,459,3,498,8072,7574,8073,8079,1,8088,8095,1,8104,8111,1,8124,8140,16,8188,8188,1]));static foldLt=new C(new Uint32Array([452,454,2,455,457,2,458,460,2,497,499,2,8064,8071,1,8080,8087,1,8096,8103,1,8115,8131,16,8179,8179,1]));static Lu=new C(new Uint32Array([65,90,1,192,214,1,216,222,1,256,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,461,3,463,475,2,478,494,2,497,500,3,502,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,880,882,2,886,895,9,902,904,2,905,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,978,3,979,980,1,984,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8120,8123,1,8136,8139,1,8152,8155,1,8168,8172,1,8184,8187,1,8450,8455,5,8459,8461,1,8464,8466,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8496,8499,1,8510,8511,1,8517,8579,62,11264,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,119808,119833,1,119860,119885,1,119912,119937,1,119964,119966,2,119967,119973,3,119974,119977,3,119978,119980,1,119982,119989,1,120016,120041,1,120068,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120120,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120172,120197,1,120224,120249,1,120276,120301,1,120328,120353,1,120380,120405,1,120432,120457,1,120488,120512,1,120546,120570,1,120604,120628,1,120662,120686,1,120720,120744,1,120778,125184,4406,125185,125217,1]));static Upper=this.Lu;static foldLu=new C(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,303,2,307,311,2,314,328,2,331,375,2,378,382,2,383,384,1,387,389,2,392,396,4,402,405,3,409,411,1,414,417,3,419,421,2,424,429,5,432,436,4,438,441,3,445,447,2,453,454,1,456,457,1,459,460,1,462,476,2,477,495,2,498,499,1,501,505,4,507,543,2,547,563,2,572,575,3,576,578,2,583,591,2,592,596,1,598,599,1,601,603,2,604,608,4,609,611,2,612,614,1,616,620,1,623,625,2,626,629,3,637,640,3,642,643,1,647,652,1,658,669,11,670,837,167,881,883,2,887,891,4,892,893,1,940,943,1,945,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1072,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1377,1414,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7545,239,7549,7566,17,7681,7829,2,7835,7841,6,7843,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8017,8023,2,8032,8039,1,8048,8061,1,8112,8113,1,8126,8144,18,8145,8160,15,8161,8165,4,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11379,11382,3,11393,11491,2,11500,11502,2,11507,11520,13,11521,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42803,42863,2,42874,42876,2,42879,42887,2,42892,42897,5,42899,42900,1,42903,42921,2,42933,42947,2,42952,42954,2,42957,42961,4,42967,42971,2,42998,43859,861,43888,43967,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,125218,125251,1]));static M=new C(new Uint32Array([768,879,1,1155,1161,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2307,1,2362,2364,1,2366,2383,1,2385,2391,1,2402,2403,1,2433,2435,1,2492,2494,2,2495,2500,1,2503,2504,1,2507,2509,1,2519,2530,11,2531,2558,27,2561,2563,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2672,31,2673,2677,4,2689,2691,1,2748,2750,2,2751,2757,1,2759,2761,1,2763,2765,1,2786,2787,1,2810,2815,1,2817,2819,1,2876,2878,2,2879,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2914,2915,1,2946,3006,60,3007,3010,1,3014,3016,1,3018,3021,1,3031,3072,41,3073,3076,1,3132,3134,2,3135,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3203,1,3260,3262,2,3263,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3298,3299,1,3315,3328,13,3329,3331,1,3387,3388,1,3390,3396,1,3398,3400,1,3402,3405,1,3415,3426,11,3427,3457,30,3458,3459,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3570,3571,1,3633,3636,3,3637,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3902,3903,1,3953,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4139,101,4140,4158,1,4182,4185,1,4190,4192,1,4194,4196,1,4199,4205,1,4209,4212,1,4226,4237,1,4239,4250,11,4251,4253,1,4957,4959,1,5906,5909,1,5938,5940,1,5970,5971,1,6002,6003,1,6068,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6443,1,6448,6459,1,6679,6683,1,6741,6750,1,6752,6780,1,6783,6832,49,6833,6862,1,6912,6916,1,6964,6980,1,7019,7027,1,7040,7042,1,7073,7085,1,7142,7155,1,7204,7223,1,7376,7378,1,7380,7400,1,7405,7412,7,7415,7417,1,7616,7679,1,8400,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12335,1,12441,12442,1,42607,42610,1,42612,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43043,24,43044,43047,1,43052,43136,84,43137,43188,51,43189,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43347,1,43392,43395,1,43443,43456,1,43493,43561,68,43562,43574,1,43587,43596,9,43597,43643,46,43644,43645,1,43696,43698,2,43699,43700,1,43703,43704,1,43710,43711,1,43713,43755,42,43756,43759,1,43765,43766,1,44003,44010,1,44012,44013,1,64286,65024,738,65025,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69632,69634,1,69688,69702,1,69744,69747,3,69748,69759,11,69760,69762,1,69808,69818,1,69826,69888,62,69889,69890,1,69927,69940,1,69957,69958,1,70003,70016,13,70017,70018,1,70067,70080,1,70089,70092,1,70094,70095,1,70188,70199,1,70206,70209,3,70367,70378,1,70400,70403,1,70459,70460,1,70462,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70502,3,70503,70508,1,70512,70516,1,70584,70592,1,70594,70597,3,70599,70602,1,70604,70608,1,70610,70625,15,70626,70709,83,70710,70726,1,70750,70832,82,70833,70851,1,71087,71093,1,71096,71104,1,71132,71133,1,71216,71232,1,71339,71351,1,71453,71467,1,71724,71738,1,71984,71989,1,71991,71992,1,71995,71998,1,72e3,72002,2,72003,72145,142,72146,72151,1,72154,72160,1,72164,72193,29,72194,72202,1,72243,72249,1,72251,72254,1,72263,72273,10,72274,72283,1,72330,72345,1,72751,72758,1,72760,72767,1,72850,72871,1,72873,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73098,67,73099,73102,1,73104,73105,1,73107,73111,1,73459,73462,1,73472,73473,1,73475,73524,49,73525,73530,1,73534,73538,1,73562,78912,5350,78919,78933,1,90398,90415,1,92912,92916,1,92976,92982,1,94031,94033,2,94034,94087,1,94095,94098,1,94180,94192,12,94193,113821,19628,113822,118528,4706,118529,118573,1,118576,118598,1,119141,119145,1,119149,119154,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldM=new C(new Uint32Array([921,953,32,8126,8126,1]));static Mc=new C(new Uint32Array([2307,2363,56,2366,2368,1,2377,2380,1,2382,2383,1,2434,2435,1,2494,2496,1,2503,2504,1,2507,2508,1,2519,2563,44,2622,2624,1,2691,2750,59,2751,2752,1,2761,2763,2,2764,2818,54,2819,2878,59,2880,2887,7,2888,2891,3,2892,2903,11,3006,3007,1,3009,3010,1,3014,3016,1,3018,3020,1,3031,3073,42,3074,3075,1,3137,3140,1,3202,3203,1,3262,3264,2,3265,3268,1,3271,3272,1,3274,3275,1,3285,3286,1,3315,3330,15,3331,3390,59,3391,3392,1,3398,3400,1,3402,3404,1,3415,3458,43,3459,3535,76,3536,3537,1,3544,3551,1,3570,3571,1,3902,3903,1,3967,4139,172,4140,4145,5,4152,4155,3,4156,4182,26,4183,4194,11,4195,4196,1,4199,4205,1,4227,4228,1,4231,4236,1,4239,4250,11,4251,4252,1,5909,5940,31,6070,6078,8,6079,6085,1,6087,6088,1,6435,6438,1,6441,6443,1,6448,6449,1,6451,6456,1,6681,6682,1,6741,6743,2,6753,6755,2,6756,6765,9,6766,6770,1,6916,6965,49,6971,6973,2,6974,6977,1,6979,6980,1,7042,7073,31,7078,7079,1,7082,7143,61,7146,7148,1,7150,7154,4,7155,7204,49,7205,7211,1,7220,7221,1,7393,7415,22,12334,12335,1,43043,43044,1,43047,43136,89,43137,43188,51,43189,43203,1,43346,43347,1,43395,43444,49,43445,43450,5,43451,43454,3,43455,43456,1,43567,43568,1,43571,43572,1,43597,43643,46,43645,43755,110,43758,43759,1,43765,44003,238,44004,44006,2,44007,44009,2,44010,44012,2,69632,69634,2,69762,69808,46,69809,69810,1,69815,69816,1,69932,69957,25,69958,70018,60,70067,70069,1,70079,70080,1,70094,70188,94,70189,70190,1,70194,70195,1,70197,70368,171,70369,70370,1,70402,70403,1,70462,70463,1,70465,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70584,85,70585,70586,1,70594,70597,3,70599,70602,1,70604,70605,1,70607,70709,102,70710,70711,1,70720,70721,1,70725,70832,107,70833,70834,1,70841,70843,2,70844,70846,1,70849,71087,238,71088,71089,1,71096,71099,1,71102,71216,114,71217,71218,1,71227,71228,1,71230,71340,110,71342,71343,1,71350,71454,104,71456,71457,1,71462,71724,262,71725,71726,1,71736,71984,248,71985,71989,1,71991,71992,1,71997,72e3,3,72002,72145,143,72146,72147,1,72156,72159,1,72164,72249,85,72279,72280,1,72343,72751,408,72766,72873,107,72881,72884,3,73098,73102,1,73107,73108,1,73110,73461,351,73462,73475,13,73524,73525,1,73534,73535,1,73537,90410,16873,90411,90412,1,94033,94087,1,94192,94193,1,119141,119142,1,119149,119154,1]));static Me=new C(new Uint32Array([1160,1161,1,6846,8413,1567,8414,8416,1,8418,8420,1,42608,42610,1]));static Mn=new C(new Uint32Array([768,879,1,1155,1159,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2306,1,2362,2364,2,2369,2376,1,2381,2385,4,2386,2391,1,2402,2403,1,2433,2492,59,2497,2500,1,2509,2530,21,2531,2558,27,2561,2562,1,2620,2625,5,2626,2631,5,2632,2635,3,2636,2637,1,2641,2672,31,2673,2677,4,2689,2690,1,2748,2753,5,2754,2757,1,2759,2760,1,2765,2786,21,2787,2810,23,2811,2815,1,2817,2876,59,2879,2881,2,2882,2884,1,2893,2901,8,2902,2914,12,2915,2946,31,3008,3021,13,3072,3076,4,3132,3134,2,3135,3136,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3260,59,3263,3270,7,3276,3277,1,3298,3299,1,3328,3329,1,3387,3388,1,3393,3396,1,3405,3426,21,3427,3457,30,3530,3538,8,3539,3540,1,3542,3633,91,3636,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3953,3966,1,3968,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4141,103,4142,4144,1,4146,4151,1,4153,4154,1,4157,4158,1,4184,4185,1,4190,4192,1,4209,4212,1,4226,4229,3,4230,4237,7,4253,4957,704,4958,4959,1,5906,5908,1,5938,5939,1,5970,5971,1,6002,6003,1,6068,6069,1,6071,6077,1,6086,6089,3,6090,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6434,1,6439,6440,1,6450,6457,7,6458,6459,1,6679,6680,1,6683,6742,59,6744,6750,1,6752,6754,2,6757,6764,1,6771,6780,1,6783,6832,49,6833,6845,1,6847,6862,1,6912,6915,1,6964,6966,2,6967,6970,1,6972,6978,6,7019,7027,1,7040,7041,1,7074,7077,1,7080,7081,1,7083,7085,1,7142,7144,2,7145,7149,4,7151,7153,1,7212,7219,1,7222,7223,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8400,8412,1,8417,8421,4,8422,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12333,1,12441,12442,1,42607,42612,5,42613,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43045,26,43046,43052,6,43204,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43345,1,43392,43394,1,43443,43446,3,43447,43449,1,43452,43453,1,43493,43561,68,43562,43566,1,43569,43570,1,43573,43574,1,43587,43596,9,43644,43696,52,43698,43700,1,43703,43704,1,43710,43711,1,43713,43756,43,43757,43766,9,44005,44008,3,44013,64286,20273,65024,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69633,69688,55,69689,69702,1,69744,69747,3,69748,69759,11,69760,69761,1,69811,69814,1,69817,69818,1,69826,69888,62,69889,69890,1,69927,69931,1,69933,69940,1,70003,70016,13,70017,70070,53,70071,70078,1,70089,70092,1,70095,70191,96,70192,70193,1,70196,70198,2,70199,70206,7,70209,70367,158,70371,70378,1,70400,70401,1,70459,70460,1,70464,70502,38,70503,70508,1,70512,70516,1,70587,70592,1,70606,70610,2,70625,70626,1,70712,70719,1,70722,70724,1,70726,70750,24,70835,70840,1,70842,70847,5,70848,70850,2,70851,71090,239,71091,71093,1,71100,71101,1,71103,71104,1,71132,71133,1,71219,71226,1,71229,71231,2,71232,71339,107,71341,71344,3,71345,71349,1,71351,71453,102,71455,71458,3,71459,71461,1,71463,71467,1,71727,71735,1,71737,71738,1,71995,71996,1,71998,72003,5,72148,72151,1,72154,72155,1,72160,72193,33,72194,72202,1,72243,72248,1,72251,72254,1,72263,72273,10,72274,72278,1,72281,72283,1,72330,72342,1,72344,72345,1,72752,72758,1,72760,72765,1,72767,72850,83,72851,72871,1,72874,72880,1,72882,72883,1,72885,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73104,73,73105,73109,4,73111,73459,348,73460,73472,12,73473,73526,53,73527,73530,1,73536,73538,2,73562,78912,5350,78919,78933,1,90398,90409,1,90413,90415,1,92912,92916,1,92976,92982,1,94031,94095,64,94096,94098,1,94180,113821,19641,113822,118528,4706,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldMn=new C(new Uint32Array([921,953,32,8126,8126,1]));static N=new C(new Uint32Array([48,57,1,178,179,1,185,188,3,189,190,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2548,2553,1,2662,2671,1,2790,2799,1,2918,2927,1,2930,2935,1,3046,3058,1,3174,3183,1,3192,3198,1,3302,3311,1,3416,3422,1,3430,3448,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3891,1,4160,4169,1,4240,4249,1,4969,4988,1,5870,5872,1,6112,6121,1,6128,6137,1,6160,6169,1,6470,6479,1,6608,6618,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,8304,8308,4,8309,8313,1,8320,8329,1,8528,8578,1,8581,8585,1,9312,9371,1,9450,9471,1,10102,10131,1,11517,12295,778,12321,12329,1,12344,12346,1,12690,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,42528,42537,1,42726,42735,1,43056,43061,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,65799,65843,1,65856,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,66369,66378,9,66513,66517,1,66720,66729,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,68912,68921,1,68928,68937,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70113,70132,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71483,1,71904,71922,1,72016,72025,1,72688,72697,1,72784,72812,1,73040,73049,1,73120,73129,1,73552,73561,1,73664,73684,1,74752,74862,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93019,93025,1,93552,93561,1,93824,93846,1,118e3,118009,1,119488,119507,1,119520,119539,1,119648,119672,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125127,125135,1,125264,125273,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1,130032,130041,1]));static Nd=new C(new Uint32Array([48,57,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2662,2671,1,2790,2799,1,2918,2927,1,3046,3055,1,3174,3183,1,3302,3311,1,3430,3439,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3881,1,4160,4169,1,4240,4249,1,6112,6121,1,6160,6169,1,6470,6479,1,6608,6617,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,42528,42537,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,66720,66729,1,68912,68921,1,68928,68937,1,69734,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71481,1,71904,71913,1,72016,72025,1,72688,72697,1,72784,72793,1,73040,73049,1,73120,73129,1,73552,73561,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93552,93561,1,118e3,118009,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125264,125273,1,130032,130041,1]));static Nl=new C(new Uint32Array([5870,5872,1,8544,8578,1,8581,8584,1,12295,12321,26,12322,12329,1,12344,12346,1,42726,42735,1,65856,65908,1,66369,66378,9,66513,66517,1,74752,74862,1]));static No=new C(new Uint32Array([178,179,1,185,188,3,189,190,1,2548,2553,1,2930,2935,1,3056,3058,1,3192,3198,1,3416,3422,1,3440,3448,1,3882,3891,1,4969,4988,1,6128,6137,1,6618,8304,1686,8308,8313,1,8320,8329,1,8528,8543,1,8585,9312,727,9313,9371,1,9450,9471,1,10102,10131,1,11517,12690,1173,12691,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,43056,43061,1,65799,65843,1,65909,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69733,1,70113,70132,1,71482,71483,1,71914,71922,1,72794,72812,1,73664,73684,1,93019,93025,1,93824,93846,1,119488,119507,1,119520,119539,1,119648,119672,1,125127,125135,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1]));static P=new C(new Uint32Array([33,35,1,37,42,1,44,47,1,58,59,1,63,64,1,91,93,1,95,123,28,125,161,36,167,171,4,182,183,1,187,191,4,894,903,9,1370,1375,1,1417,1418,1,1470,1472,2,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3898,38,3899,3901,1,3973,4048,75,4049,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5120,5742,622,5787,5788,1,5867,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8208,829,8209,8231,1,8240,8259,1,8261,8273,1,8275,8286,1,8317,8318,1,8333,8334,1,8968,8971,1,9001,9002,1,10088,10101,1,10181,10182,1,10214,10223,1,10627,10648,1,10712,10715,1,10748,10749,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11822,1,11824,11855,1,11858,11869,1,12289,12291,1,12296,12305,1,12308,12319,1,12336,12349,13,12448,12539,91,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,64830,20819,64831,65040,209,65041,65049,1,65072,65106,1,65108,65121,1,65123,65128,5,65130,65131,1,65281,65283,1,65285,65290,1,65292,65295,1,65306,65307,1,65311,65312,1,65339,65341,1,65343,65371,28,65373,65375,2,65376,65381,1,65792,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,68974,69293,319,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Pc=new C(new Uint32Array([95,8255,8160,8256,8276,20,65075,65076,1,65101,65103,1,65343,65343,1]));static Pd=new C(new Uint32Array([45,1418,1373,1470,5120,3650,6150,8208,2058,8209,8213,1,11799,11802,3,11834,11835,1,11840,11869,29,12316,12336,20,12448,65073,52625,65074,65112,38,65123,65293,170,68974,69293,319]));static Pe=new C(new Uint32Array([41,93,52,125,3899,3774,3901,5788,1887,8262,8318,56,8334,8969,635,8971,9002,31,10089,10101,2,10182,10215,33,10217,10223,2,10628,10648,2,10713,10715,2,10749,11811,1062,11813,11817,2,11862,11868,2,12297,12305,2,12309,12315,2,12318,12319,1,64830,65048,218,65078,65092,2,65096,65114,18,65116,65118,2,65289,65341,52,65373,65379,3]));static Pf=new C(new Uint32Array([187,8217,8030,8221,8250,29,11779,11781,2,11786,11789,3,11805,11809,4]));static Pi=new C(new Uint32Array([171,8216,8045,8219,8220,1,8223,8249,26,11778,11780,2,11785,11788,3,11804,11808,4]));static Po=new C(new Uint32Array([33,35,1,37,39,1,42,46,2,47,58,11,59,63,4,64,92,28,161,167,6,182,183,1,191,894,703,903,1370,467,1371,1375,1,1417,1472,55,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3973,113,4048,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5742,5867,125,5868,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6149,1,6151,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8214,835,8215,8224,9,8225,8231,1,8240,8248,1,8251,8254,1,8257,8259,1,8263,8273,1,8275,8277,2,8278,8286,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11782,5,11783,11784,1,11787,11790,3,11791,11798,1,11800,11801,1,11803,11806,3,11807,11818,11,11819,11822,1,11824,11833,1,11836,11839,1,11841,11843,2,11844,11855,1,11858,11860,1,12289,12291,1,12349,12539,190,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,65040,21029,65041,65046,1,65049,65072,23,65093,65094,1,65097,65100,1,65104,65106,1,65108,65111,1,65119,65121,1,65128,65130,2,65131,65281,150,65282,65283,1,65285,65287,1,65290,65294,2,65295,65306,11,65307,65311,4,65312,65340,28,65377,65380,3,65381,65792,411,65793,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Ps=new C(new Uint32Array([40,91,51,123,3898,3775,3900,5787,1887,8218,8222,4,8261,8317,56,8333,8968,635,8970,9001,31,10088,10100,2,10181,10214,33,10216,10222,2,10627,10647,2,10712,10714,2,10748,11810,1062,11812,11816,2,11842,11861,19,11863,11867,2,12296,12304,2,12308,12314,2,12317,64831,52514,65047,65077,30,65079,65091,2,65095,65113,18,65115,65117,2,65288,65339,51,65371,65375,4,65378,65378,1]));static S=new C(new Uint32Array([36,43,7,60,62,1,94,96,2,124,126,2,162,166,1,168,169,1,172,174,2,175,177,1,180,184,4,215,247,32,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,1014,113,1154,1421,267,1422,1423,1,1542,1544,1,1547,1550,3,1551,1758,207,1769,1789,20,1790,2038,248,2046,2047,1,2184,2546,362,2547,2554,7,2555,2801,246,2928,3059,131,3060,3066,1,3199,3407,208,3449,3647,198,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6107,366,6464,6622,158,6623,6655,1,7009,7018,1,7028,7036,1,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,8260,8274,14,8314,8316,1,8330,8332,1,8352,8384,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8472,1,8478,8483,1,8485,8489,2,8494,8506,12,8507,8512,5,8513,8516,1,8522,8525,1,8527,8586,59,8587,8592,5,8593,8967,1,8972,9e3,1,9003,9257,1,9280,9290,1,9372,9449,1,9472,10087,1,10132,10180,1,10183,10213,1,10224,10626,1,10649,10711,1,10716,10747,1,10750,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12443,12444,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,42752,42774,1,42784,42785,1,42889,42890,1,43048,43051,1,43062,43065,1,43639,43641,1,43867,43882,15,43883,64297,20414,64434,64450,1,64832,64847,1,64975,65020,45,65021,65023,1,65122,65124,2,65125,65126,1,65129,65284,155,65291,65308,17,65309,65310,1,65342,65344,2,65372,65374,2,65504,65510,1,65512,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,69006,710,69007,71487,2480,73685,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,123647,432,126124,126128,4,126254,126704,450,126705,126976,271,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Sc=new C(new Uint32Array([36,162,126,163,165,1,1423,1547,124,2046,2047,1,2546,2547,1,2555,2801,246,3065,3647,582,6107,8352,2245,8353,8384,1,43064,65020,21956,65129,65284,155,65504,65505,1,65509,65510,1,73693,73696,1,123647,126128,2481]));static Sk=new C(new Uint32Array([94,96,2,168,175,7,180,184,4,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,2184,1283,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,12443,12444,1,42752,42774,1,42784,42785,1,42889,42890,1,43867,43882,15,43883,64434,20551,64435,64450,1,65342,65344,2,65507,127995,62488,127996,127999,1]));static Sm=new C(new Uint32Array([43,60,17,61,62,1,124,126,2,172,177,5,215,247,32,1014,1542,528,1543,1544,1,8260,8274,14,8314,8316,1,8330,8332,1,8472,8512,40,8513,8516,1,8523,8592,69,8593,8596,1,8602,8603,1,8608,8614,3,8622,8654,32,8655,8658,3,8660,8692,32,8693,8959,1,8992,8993,1,9084,9115,31,9116,9139,1,9180,9185,1,9655,9665,10,9720,9727,1,9839,10176,337,10177,10180,1,10183,10213,1,10224,10239,1,10496,10626,1,10649,10711,1,10716,10747,1,10750,11007,1,11056,11076,1,11079,11084,1,64297,65122,825,65124,65126,1,65291,65308,17,65309,65310,1,65372,65374,2,65506,65513,7,65514,65516,1,69006,69007,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,126704,126705,1]));static So=new C(new Uint32Array([166,169,3,174,176,2,1154,1421,267,1422,1550,128,1551,1758,207,1769,1789,20,1790,2038,248,2554,2928,374,3059,3064,1,3066,3199,133,3407,3449,42,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6464,723,6622,6655,1,7009,7018,1,7028,7036,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8478,7,8479,8483,1,8485,8489,2,8494,8506,12,8507,8522,15,8524,8525,1,8527,8586,59,8587,8597,10,8598,8601,1,8604,8607,1,8609,8610,1,8612,8613,1,8615,8621,1,8623,8653,1,8656,8657,1,8659,8661,2,8662,8691,1,8960,8967,1,8972,8991,1,8994,9e3,1,9003,9083,1,9085,9114,1,9140,9179,1,9186,9257,1,9280,9290,1,9372,9449,1,9472,9654,1,9656,9664,1,9666,9719,1,9728,9838,1,9840,10087,1,10132,10175,1,10240,10495,1,11008,11055,1,11077,11078,1,11085,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,43048,43051,1,43062,43063,1,43065,43639,574,43640,43641,1,64832,64847,1,64975,65021,46,65022,65023,1,65508,65512,4,65517,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,71487,3191,73685,73692,1,73697,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,126124,2909,126254,126976,722,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,127994,1,128e3,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Z=new C(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8232,8233,1,8239,8287,48,12288,12288,1]));static Zl=new C(new Uint32Array([8232,8232,1]));static Zp=new C(new Uint32Array([8233,8233,1]));static Zs=new C(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8239,8287,48,12288,12288,1]));static Adlam=new C(new Uint32Array([125184,125259,1,125264,125273,1,125278,125279,1]));static Ahom=new C(new Uint32Array([71424,71450,1,71453,71467,1,71472,71494,1]));static Anatolian_Hieroglyphs=new C(new Uint32Array([82944,83526,1]));static Arabic=new C(new Uint32Array([1536,1540,1,1542,1547,1,1549,1562,1,1564,1566,1,1568,1599,1,1601,1610,1,1622,1647,1,1649,1756,1,1758,1791,1,1872,1919,1,2160,2190,1,2192,2193,1,2199,2273,1,2275,2303,1,64336,64450,1,64467,64829,1,64832,64911,1,64914,64967,1,64975,65008,33,65009,65023,1,65136,65140,1,65142,65276,1,69216,69246,1,69314,69316,1,69372,69375,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1]));static Armenian=new C(new Uint32Array([1329,1366,1,1369,1418,1,1421,1423,1,64275,64279,1]));static Avestan=new C(new Uint32Array([68352,68405,1,68409,68415,1]));static Balinese=new C(new Uint32Array([6912,6988,1,6990,7039,1]));static Bamum=new C(new Uint32Array([42656,42743,1,92160,92728,1]));static Bassa_Vah=new C(new Uint32Array([92880,92909,1,92912,92917,1]));static Batak=new C(new Uint32Array([7104,7155,1,7164,7167,1]));static Bengali=new C(new Uint32Array([2432,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1]));static Bhaiksuki=new C(new Uint32Array([72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1]));static Bopomofo=new C(new Uint32Array([746,747,1,12549,12591,1,12704,12735,1]));static Brahmi=new C(new Uint32Array([69632,69709,1,69714,69749,1,69759,69759,1]));static Braille=new C(new Uint32Array([10240,10495,1]));static Buginese=new C(new Uint32Array([6656,6683,1,6686,6687,1]));static Buhid=new C(new Uint32Array([5952,5971,1]));static Canadian_Aboriginal=new C(new Uint32Array([5120,5759,1,6320,6389,1,72368,72383,1]));static Carian=new C(new Uint32Array([66208,66256,1]));static Caucasian_Albanian=new C(new Uint32Array([66864,66915,1,66927,66927,1]));static Chakma=new C(new Uint32Array([69888,69940,1,69942,69959,1]));static Cham=new C(new Uint32Array([43520,43574,1,43584,43597,1,43600,43609,1,43612,43615,1]));static Cherokee=new C(new Uint32Array([5024,5109,1,5112,5117,1,43888,43967,1]));static Chorasmian=new C(new Uint32Array([69552,69579,1]));static Common=new C(new Uint32Array([0,64,1,91,96,1,123,169,1,171,185,1,187,191,1,215,247,32,697,735,1,741,745,1,748,767,1,884,894,10,901,903,2,1541,1548,7,1563,1567,4,1600,1757,157,2274,2404,130,2405,3647,1242,4053,4056,1,4347,5867,1520,5868,5869,1,5941,5942,1,6146,6147,1,6149,7379,1230,7393,7401,8,7402,7404,1,7406,7411,1,7413,7415,1,7418,8192,774,8193,8203,1,8206,8292,1,8294,8304,1,8308,8318,1,8320,8334,1,8352,8384,1,8448,8485,1,8487,8489,1,8492,8497,1,8499,8525,1,8527,8543,1,8585,8587,1,8592,9257,1,9280,9290,1,9312,10239,1,10496,11123,1,11126,11157,1,11159,11263,1,11776,11869,1,12272,12292,1,12294,12296,2,12297,12320,1,12336,12343,1,12348,12351,1,12443,12444,1,12448,12539,91,12540,12688,148,12689,12703,1,12736,12773,1,12783,12832,49,12833,12895,1,12927,13007,1,13055,13144,89,13145,13311,1,19904,19967,1,42752,42785,1,42888,42890,1,43056,43065,1,43310,43471,161,43867,43882,15,43883,64830,20947,64831,65040,209,65041,65049,1,65072,65106,1,65108,65126,1,65128,65131,1,65279,65281,2,65282,65312,1,65339,65344,1,65371,65381,1,65392,65438,46,65439,65504,65,65505,65510,1,65512,65518,1,65529,65533,1,65792,65794,1,65799,65843,1,65847,65855,1,65936,65948,1,66e3,66044,1,66273,66299,1,113824,113827,1,117760,118009,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119142,1,119146,119162,1,119171,119172,1,119180,119209,1,119214,119274,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,120831,1,126065,126132,1,126209,126269,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127487,1,127489,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,917505,917536,31,917537,917631,1]));static foldCommon=new C(new Uint32Array([924,956,32]));static Coptic=new C(new Uint32Array([994,1007,1,11392,11507,1,11513,11519,1]));static Cuneiform=new C(new Uint32Array([73728,74649,1,74752,74862,1,74864,74868,1,74880,75075,1]));static Cypriot=new C(new Uint32Array([67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3]));static Cypro_Minoan=new C(new Uint32Array([77712,77810,1]));static Cyrillic=new C(new Uint32Array([1024,1156,1,1159,1327,1,7296,7306,1,7467,7544,77,11744,11775,1,42560,42655,1,65070,65071,1,122928,122989,1,123023,123023,1]));static Deseret=new C(new Uint32Array([66560,66639,1]));static Devanagari=new C(new Uint32Array([2304,2384,1,2389,2403,1,2406,2431,1,43232,43263,1,72448,72457,1]));static Dives_Akuru=new C(new Uint32Array([71936,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1]));static Dogra=new C(new Uint32Array([71680,71739,1]));static Duployan=new C(new Uint32Array([113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1]));static Egyptian_Hieroglyphs=new C(new Uint32Array([77824,78933,1,78944,82938,1]));static Elbasan=new C(new Uint32Array([66816,66855,1]));static Elymaic=new C(new Uint32Array([69600,69622,1]));static Ethiopic=new C(new Uint32Array([4608,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,124896,124902,1,124904,124907,1,124909,124910,1,124912,124926,1]));static Garay=new C(new Uint32Array([68928,68965,1,68969,68997,1,69006,69007,1]));static Georgian=new C(new Uint32Array([4256,4293,1,4295,4301,6,4304,4346,1,4348,4351,1,7312,7354,1,7357,7359,1,11520,11557,1,11559,11565,6]));static Glagolitic=new C(new Uint32Array([11264,11359,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1]));static Gothic=new C(new Uint32Array([66352,66378,1]));static Grantha=new C(new Uint32Array([70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70460,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1]));static Greek=new C(new Uint32Array([880,883,1,885,887,1,890,893,1,895,900,5,902,904,2,905,906,1,908,910,2,911,929,1,931,993,1,1008,1023,1,7462,7466,1,7517,7521,1,7526,7530,1,7615,7936,321,7937,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8486,43877,35391,65856,65934,1,65952,119296,53344,119297,119365,1]));static foldGreek=new C(new Uint32Array([181,837,656]));static Gujarati=new C(new Uint32Array([2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1]));static Gunjala_Gondi=new C(new Uint32Array([73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1]));static Gurmukhi=new C(new Uint32Array([2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1]));static Gurung_Khema=new C(new Uint32Array([90368,90425,1]));static Han=new C(new Uint32Array([11904,11929,1,11931,12019,1,12032,12245,1,12293,12295,2,12321,12329,1,12344,12347,1,13312,19903,1,19968,40959,1,63744,64109,1,64112,64217,1,94178,94179,1,94192,94193,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Hangul=new C(new Uint32Array([4352,4607,1,12334,12335,1,12593,12686,1,12800,12830,1,12896,12926,1,43360,43388,1,44032,55203,1,55216,55238,1,55243,55291,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1]));static Hanifi_Rohingya=new C(new Uint32Array([68864,68903,1,68912,68921,1]));static Hanunoo=new C(new Uint32Array([5920,5940,1]));static Hatran=new C(new Uint32Array([67808,67826,1,67828,67829,1,67835,67839,1]));static Hebrew=new C(new Uint32Array([1425,1479,1,1488,1514,1,1519,1524,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64335,1]));static Hiragana=new C(new Uint32Array([12353,12438,1,12445,12447,1,110593,110879,1,110898,110928,30,110929,110930,1,127488,127488,1]));static Imperial_Aramaic=new C(new Uint32Array([67648,67669,1,67671,67679,1]));static Inherited=new C(new Uint32Array([768,879,1,1157,1158,1,1611,1621,1,1648,2385,737,2386,2388,1,6832,6862,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8204,8205,1,8400,8432,1,12330,12333,1,12441,12442,1,65024,65039,1,65056,65069,1,66045,66272,227,70459,118528,48069,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,917760,917999,1]));static foldInherited=new C(new Uint32Array([921,953,32,8126,8126,1]));static Inscriptional_Pahlavi=new C(new Uint32Array([68448,68466,1,68472,68479,1]));static Inscriptional_Parthian=new C(new Uint32Array([68416,68437,1,68440,68447,1]));static Javanese=new C(new Uint32Array([43392,43469,1,43472,43481,1,43486,43487,1]));static Kaithi=new C(new Uint32Array([69760,69826,1,69837,69837,1]));static Kannada=new C(new Uint32Array([3200,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1]));static Katakana=new C(new Uint32Array([12449,12538,1,12541,12543,1,12784,12799,1,13008,13054,1,13056,13143,1,65382,65391,1,65393,65437,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110880,288,110881,110882,1,110933,110948,15,110949,110951,1]));static Kawi=new C(new Uint32Array([73472,73488,1,73490,73530,1,73534,73562,1]));static Kayah_Li=new C(new Uint32Array([43264,43309,1,43311,43311,1]));static Kharoshthi=new C(new Uint32Array([68096,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1]));static Khitan_Small_Script=new C(new Uint32Array([94180,101120,6940,101121,101589,1,101631,101631,1]));static Khmer=new C(new Uint32Array([6016,6109,1,6112,6121,1,6128,6137,1,6624,6655,1]));static Khojki=new C(new Uint32Array([70144,70161,1,70163,70209,1]));static Khudawadi=new C(new Uint32Array([70320,70378,1,70384,70393,1]));static Kirat_Rai=new C(new Uint32Array([93504,93561,1]));static Lao=new C(new Uint32Array([3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1]));static Latin=new C(new Uint32Array([65,90,1,97,122,1,170,186,16,192,214,1,216,246,1,248,696,1,736,740,1,7424,7461,1,7468,7516,1,7522,7525,1,7531,7543,1,7545,7614,1,7680,7935,1,8305,8319,14,8336,8348,1,8490,8491,1,8498,8526,28,8544,8584,1,11360,11391,1,42786,42887,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43007,1,43824,43866,1,43868,43876,1,43878,43881,1,64256,64262,1,65313,65338,1,65345,65370,1,67456,67461,1,67463,67504,1,67506,67514,1,122624,122654,1,122661,122666,1]));static Lepcha=new C(new Uint32Array([7168,7223,1,7227,7241,1,7245,7247,1]));static Limbu=new C(new Uint32Array([6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6479,1]));static Linear_A=new C(new Uint32Array([67072,67382,1,67392,67413,1,67424,67431,1]));static Linear_B=new C(new Uint32Array([65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1]));static Lisu=new C(new Uint32Array([42192,42239,1,73648,73648,1]));static Lycian=new C(new Uint32Array([66176,66204,1]));static Lydian=new C(new Uint32Array([67872,67897,1,67903,67903,1]));static Mahajani=new C(new Uint32Array([69968,70006,1]));static Makasar=new C(new Uint32Array([73440,73464,1]));static Malayalam=new C(new Uint32Array([3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1]));static Mandaic=new C(new Uint32Array([2112,2139,1,2142,2142,1]));static Manichaean=new C(new Uint32Array([68288,68326,1,68331,68342,1]));static Marchen=new C(new Uint32Array([72816,72847,1,72850,72871,1,72873,72886,1]));static Masaram_Gondi=new C(new Uint32Array([72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1]));static Medefaidrin=new C(new Uint32Array([93760,93850,1]));static Meetei_Mayek=new C(new Uint32Array([43744,43766,1,43968,44013,1,44016,44025,1]));static Mende_Kikakui=new C(new Uint32Array([124928,125124,1,125127,125142,1]));static Meroitic_Cursive=new C(new Uint32Array([68e3,68023,1,68028,68047,1,68050,68095,1]));static Meroitic_Hieroglyphs=new C(new Uint32Array([67968,67999,1]));static Miao=new C(new Uint32Array([93952,94026,1,94031,94087,1,94095,94111,1]));static Modi=new C(new Uint32Array([71168,71236,1,71248,71257,1]));static Mongolian=new C(new Uint32Array([6144,6145,1,6148,6150,2,6151,6169,1,6176,6264,1,6272,6314,1,71264,71276,1]));static Mro=new C(new Uint32Array([92736,92766,1,92768,92777,1,92782,92783,1]));static Multani=new C(new Uint32Array([70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1]));static Myanmar=new C(new Uint32Array([4096,4255,1,43488,43518,1,43616,43647,1,71376,71395,1]));static Nabataean=new C(new Uint32Array([67712,67742,1,67751,67759,1]));static Nag_Mundari=new C(new Uint32Array([124112,124153,1]));static Nandinagari=new C(new Uint32Array([72096,72103,1,72106,72151,1,72154,72164,1]));static New_Tai_Lue=new C(new Uint32Array([6528,6571,1,6576,6601,1,6608,6618,1,6622,6623,1]));static Newa=new C(new Uint32Array([70656,70747,1,70749,70753,1]));static Nko=new C(new Uint32Array([1984,2042,1,2045,2047,1]));static Nushu=new C(new Uint32Array([94177,110960,16783,110961,111355,1]));static Nyiakeng_Puachue_Hmong=new C(new Uint32Array([123136,123180,1,123184,123197,1,123200,123209,1,123214,123215,1]));static Ogham=new C(new Uint32Array([5760,5788,1]));static Ol_Chiki=new C(new Uint32Array([7248,7295,1]));static Ol_Onal=new C(new Uint32Array([124368,124410,1,124415,124415,1]));static Old_Hungarian=new C(new Uint32Array([68736,68786,1,68800,68850,1,68858,68863,1]));static Old_Italic=new C(new Uint32Array([66304,66339,1,66349,66351,1]));static Old_North_Arabian=new C(new Uint32Array([68224,68255,1]));static Old_Permic=new C(new Uint32Array([66384,66426,1]));static Old_Persian=new C(new Uint32Array([66464,66499,1,66504,66517,1]));static Old_Sogdian=new C(new Uint32Array([69376,69415,1]));static Old_South_Arabian=new C(new Uint32Array([68192,68223,1]));static Old_Turkic=new C(new Uint32Array([68608,68680,1]));static Old_Uyghur=new C(new Uint32Array([69488,69513,1]));static Oriya=new C(new Uint32Array([2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1]));static Osage=new C(new Uint32Array([66736,66771,1,66776,66811,1]));static Osmanya=new C(new Uint32Array([66688,66717,1,66720,66729,1]));static Pahawh_Hmong=new C(new Uint32Array([92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1]));static Palmyrene=new C(new Uint32Array([67680,67711,1]));static Pau_Cin_Hau=new C(new Uint32Array([72384,72440,1]));static Phags_Pa=new C(new Uint32Array([43072,43127,1]));static Phoenician=new C(new Uint32Array([67840,67867,1,67871,67871,1]));static Psalter_Pahlavi=new C(new Uint32Array([68480,68497,1,68505,68508,1,68521,68527,1]));static Rejang=new C(new Uint32Array([43312,43347,1,43359,43359,1]));static Runic=new C(new Uint32Array([5792,5866,1,5870,5880,1]));static Samaritan=new C(new Uint32Array([2048,2093,1,2096,2110,1]));static Saurashtra=new C(new Uint32Array([43136,43205,1,43214,43225,1]));static Sharada=new C(new Uint32Array([70016,70111,1]));static Shavian=new C(new Uint32Array([66640,66687,1]));static Siddham=new C(new Uint32Array([71040,71093,1,71096,71133,1]));static SignWriting=new C(new Uint32Array([120832,121483,1,121499,121503,1,121505,121519,1]));static Sinhala=new C(new Uint32Array([3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,70113,70132,1]));static Sogdian=new C(new Uint32Array([69424,69465,1]));static Sora_Sompeng=new C(new Uint32Array([69840,69864,1,69872,69881,1]));static Soyombo=new C(new Uint32Array([72272,72354,1]));static Sundanese=new C(new Uint32Array([7040,7103,1,7360,7367,1]));static Sunuwar=new C(new Uint32Array([72640,72673,1,72688,72697,1]));static Syloti_Nagri=new C(new Uint32Array([43008,43052,1]));static Syriac=new C(new Uint32Array([1792,1805,1,1807,1866,1,1869,1871,1,2144,2154,1]));static Tagalog=new C(new Uint32Array([5888,5909,1,5919,5919,1]));static Tagbanwa=new C(new Uint32Array([5984,5996,1,5998,6e3,1,6002,6003,1]));static Tai_Le=new C(new Uint32Array([6480,6509,1,6512,6516,1]));static Tai_Tham=new C(new Uint32Array([6688,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1]));static Tai_Viet=new C(new Uint32Array([43648,43714,1,43739,43743,1]));static Takri=new C(new Uint32Array([71296,71353,1,71360,71369,1]));static Tamil=new C(new Uint32Array([2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,73664,73713,1,73727,73727,1]));static Tangsa=new C(new Uint32Array([92784,92862,1,92864,92873,1]));static Tangut=new C(new Uint32Array([94176,94208,32,94209,100343,1,100352,101119,1,101632,101640,1]));static Telugu=new C(new Uint32Array([3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3199,1]));static Thaana=new C(new Uint32Array([1920,1969,1]));static Thai=new C(new Uint32Array([3585,3642,1,3648,3675,1]));static Tibetan=new C(new Uint32Array([3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4052,1,4057,4058,1]));static Tifinagh=new C(new Uint32Array([11568,11623,1,11631,11632,1,11647,11647,1]));static Tirhuta=new C(new Uint32Array([70784,70855,1,70864,70873,1]));static Todhri=new C(new Uint32Array([67008,67059,1]));static Toto=new C(new Uint32Array([123536,123566,1]));static Tulu_Tigalari=new C(new Uint32Array([70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1]));static Ugaritic=new C(new Uint32Array([66432,66461,1,66463,66463,1]));static Vai=new C(new Uint32Array([42240,42539,1]));static Vithkuqi=new C(new Uint32Array([66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1]));static Wancho=new C(new Uint32Array([123584,123641,1,123647,123647,1]));static Warang_Citi=new C(new Uint32Array([71840,71922,1,71935,71935,1]));static Yezidi=new C(new Uint32Array([69248,69289,1,69291,69293,1,69296,69297,1]));static Yi=new C(new Uint32Array([40960,42124,1,42128,42182,1]));static Zanabazar_Square=new C(new Uint32Array([72192,72263,1]));static CATEGORIES=new Map([["C",e.C],["Cc",e.Cc],["Cf",e.Cf],["Co",e.Co],["Cs",e.Cs],["L",e.L],["Ll",e.Ll],["Lm",e.Lm],["Lo",e.Lo],["Lt",e.Lt],["Lu",e.Lu],["M",e.M],["Mc",e.Mc],["Me",e.Me],["Mn",e.Mn],["N",e.N],["Nd",e.Nd],["Nl",e.Nl],["No",e.No],["P",e.P],["Pc",e.Pc],["Pd",e.Pd],["Pe",e.Pe],["Pf",e.Pf],["Pi",e.Pi],["Po",e.Po],["Ps",e.Ps],["S",e.S],["Sc",e.Sc],["Sk",e.Sk],["Sm",e.Sm],["So",e.So],["Z",e.Z],["Zl",e.Zl],["Zp",e.Zp],["Zs",e.Zs]]);static SCRIPTS=new Map([["Adlam",e.Adlam],["Ahom",e.Ahom],["Anatolian_Hieroglyphs",e.Anatolian_Hieroglyphs],["Arabic",e.Arabic],["Armenian",e.Armenian],["Avestan",e.Avestan],["Balinese",e.Balinese],["Bamum",e.Bamum],["Bassa_Vah",e.Bassa_Vah],["Batak",e.Batak],["Bengali",e.Bengali],["Bhaiksuki",e.Bhaiksuki],["Bopomofo",e.Bopomofo],["Brahmi",e.Brahmi],["Braille",e.Braille],["Buginese",e.Buginese],["Buhid",e.Buhid],["Canadian_Aboriginal",e.Canadian_Aboriginal],["Carian",e.Carian],["Caucasian_Albanian",e.Caucasian_Albanian],["Chakma",e.Chakma],["Cham",e.Cham],["Cherokee",e.Cherokee],["Chorasmian",e.Chorasmian],["Common",e.Common],["Coptic",e.Coptic],["Cuneiform",e.Cuneiform],["Cypriot",e.Cypriot],["Cypro_Minoan",e.Cypro_Minoan],["Cyrillic",e.Cyrillic],["Deseret",e.Deseret],["Devanagari",e.Devanagari],["Dives_Akuru",e.Dives_Akuru],["Dogra",e.Dogra],["Duployan",e.Duployan],["Egyptian_Hieroglyphs",e.Egyptian_Hieroglyphs],["Elbasan",e.Elbasan],["Elymaic",e.Elymaic],["Ethiopic",e.Ethiopic],["Garay",e.Garay],["Georgian",e.Georgian],["Glagolitic",e.Glagolitic],["Gothic",e.Gothic],["Grantha",e.Grantha],["Greek",e.Greek],["Gujarati",e.Gujarati],["Gunjala_Gondi",e.Gunjala_Gondi],["Gurmukhi",e.Gurmukhi],["Gurung_Khema",e.Gurung_Khema],["Han",e.Han],["Hangul",e.Hangul],["Hanifi_Rohingya",e.Hanifi_Rohingya],["Hanunoo",e.Hanunoo],["Hatran",e.Hatran],["Hebrew",e.Hebrew],["Hiragana",e.Hiragana],["Imperial_Aramaic",e.Imperial_Aramaic],["Inherited",e.Inherited],["Inscriptional_Pahlavi",e.Inscriptional_Pahlavi],["Inscriptional_Parthian",e.Inscriptional_Parthian],["Javanese",e.Javanese],["Kaithi",e.Kaithi],["Kannada",e.Kannada],["Katakana",e.Katakana],["Kawi",e.Kawi],["Kayah_Li",e.Kayah_Li],["Kharoshthi",e.Kharoshthi],["Khitan_Small_Script",e.Khitan_Small_Script],["Khmer",e.Khmer],["Khojki",e.Khojki],["Khudawadi",e.Khudawadi],["Kirat_Rai",e.Kirat_Rai],["Lao",e.Lao],["Latin",e.Latin],["Lepcha",e.Lepcha],["Limbu",e.Limbu],["Linear_A",e.Linear_A],["Linear_B",e.Linear_B],["Lisu",e.Lisu],["Lycian",e.Lycian],["Lydian",e.Lydian],["Mahajani",e.Mahajani],["Makasar",e.Makasar],["Malayalam",e.Malayalam],["Mandaic",e.Mandaic],["Manichaean",e.Manichaean],["Marchen",e.Marchen],["Masaram_Gondi",e.Masaram_Gondi],["Medefaidrin",e.Medefaidrin],["Meetei_Mayek",e.Meetei_Mayek],["Mende_Kikakui",e.Mende_Kikakui],["Meroitic_Cursive",e.Meroitic_Cursive],["Meroitic_Hieroglyphs",e.Meroitic_Hieroglyphs],["Miao",e.Miao],["Modi",e.Modi],["Mongolian",e.Mongolian],["Mro",e.Mro],["Multani",e.Multani],["Myanmar",e.Myanmar],["Nabataean",e.Nabataean],["Nag_Mundari",e.Nag_Mundari],["Nandinagari",e.Nandinagari],["New_Tai_Lue",e.New_Tai_Lue],["Newa",e.Newa],["Nko",e.Nko],["Nushu",e.Nushu],["Nyiakeng_Puachue_Hmong",e.Nyiakeng_Puachue_Hmong],["Ogham",e.Ogham],["Ol_Chiki",e.Ol_Chiki],["Ol_Onal",e.Ol_Onal],["Old_Hungarian",e.Old_Hungarian],["Old_Italic",e.Old_Italic],["Old_North_Arabian",e.Old_North_Arabian],["Old_Permic",e.Old_Permic],["Old_Persian",e.Old_Persian],["Old_Sogdian",e.Old_Sogdian],["Old_South_Arabian",e.Old_South_Arabian],["Old_Turkic",e.Old_Turkic],["Old_Uyghur",e.Old_Uyghur],["Oriya",e.Oriya],["Osage",e.Osage],["Osmanya",e.Osmanya],["Pahawh_Hmong",e.Pahawh_Hmong],["Palmyrene",e.Palmyrene],["Pau_Cin_Hau",e.Pau_Cin_Hau],["Phags_Pa",e.Phags_Pa],["Phoenician",e.Phoenician],["Psalter_Pahlavi",e.Psalter_Pahlavi],["Rejang",e.Rejang],["Runic",e.Runic],["Samaritan",e.Samaritan],["Saurashtra",e.Saurashtra],["Sharada",e.Sharada],["Shavian",e.Shavian],["Siddham",e.Siddham],["SignWriting",e.SignWriting],["Sinhala",e.Sinhala],["Sogdian",e.Sogdian],["Sora_Sompeng",e.Sora_Sompeng],["Soyombo",e.Soyombo],["Sundanese",e.Sundanese],["Sunuwar",e.Sunuwar],["Syloti_Nagri",e.Syloti_Nagri],["Syriac",e.Syriac],["Tagalog",e.Tagalog],["Tagbanwa",e.Tagbanwa],["Tai_Le",e.Tai_Le],["Tai_Tham",e.Tai_Tham],["Tai_Viet",e.Tai_Viet],["Takri",e.Takri],["Tamil",e.Tamil],["Tangsa",e.Tangsa],["Tangut",e.Tangut],["Telugu",e.Telugu],["Thaana",e.Thaana],["Thai",e.Thai],["Tibetan",e.Tibetan],["Tifinagh",e.Tifinagh],["Tirhuta",e.Tirhuta],["Todhri",e.Todhri],["Toto",e.Toto],["Tulu_Tigalari",e.Tulu_Tigalari],["Ugaritic",e.Ugaritic],["Vai",e.Vai],["Vithkuqi",e.Vithkuqi],["Wancho",e.Wancho],["Warang_Citi",e.Warang_Citi],["Yezidi",e.Yezidi],["Yi",e.Yi],["Zanabazar_Square",e.Zanabazar_Square]]);static FOLD_CATEGORIES=new Map([["L",e.foldL],["Ll",e.foldLl],["Lt",e.foldLt],["Lu",e.foldLu],["M",e.foldM],["Mn",e.foldMn]]);static FOLD_SCRIPT=new Map([["Common",e.foldCommon],["Greek",e.foldGreek],["Inherited",e.foldInherited]]);static Print=new C(new Uint32Array([33,126,1,161,172,1,174,887,1,890,895,1,900,906,1,908,910,2,911,929,1,931,1327,1,1329,1366,1,1369,1418,1,1421,1423,1,1425,1479,1,1488,1514,1,1519,1524,1,1542,1563,1,1565,1756,1,1758,1805,1,1808,1866,1,1869,1969,1,1984,2042,1,2045,2093,1,2096,2110,1,2112,2139,1,2142,2144,2,2145,2154,1,2160,2190,1,2199,2273,1,2275,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1,2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1,2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1,2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1,2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1,3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1,3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,3585,3642,1,3647,3675,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1,3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4058,1,4096,4293,1,4295,4301,6,4304,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,5024,5109,1,5112,5117,1,5120,5759,1,5761,5788,1,5792,5880,1,5888,5909,1,5919,5942,1,5952,5971,1,5984,5996,1,5998,6e3,1,6002,6003,1,6016,6109,1,6112,6121,1,6128,6137,1,6144,6157,1,6159,6169,1,6176,6264,1,6272,6314,1,6320,6389,1,6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6608,6618,1,6622,6683,1,6686,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1,6832,6862,1,6912,6988,1,6990,7155,1,7164,7223,1,7227,7241,1,7245,7306,1,7312,7354,1,7357,7367,1,7376,7418,1,7424,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8208,8231,1,8240,8286,1,8304,8305,1,8308,8334,1,8336,8348,1,8352,8384,1,8400,8432,1,8448,8587,1,8592,9257,1,9280,9290,1,9312,11123,1,11126,11157,1,11159,11507,1,11513,11557,1,11559,11565,6,11568,11623,1,11631,11632,1,11647,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11744,11869,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12289,12351,1,12353,12438,1,12441,12543,1,12549,12591,1,12593,12686,1,12688,12773,1,12783,12830,1,12832,42124,1,42128,42182,1,42192,42539,1,42560,42743,1,42752,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43052,1,43056,43065,1,43072,43127,1,43136,43205,1,43214,43225,1,43232,43347,1,43359,43388,1,43392,43469,1,43471,43481,1,43486,43518,1,43520,43574,1,43584,43597,1,43600,43609,1,43612,43714,1,43739,43766,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43883,1,43888,44013,1,44016,44025,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64450,1,64467,64911,1,64914,64967,1,64975,65008,33,65009,65049,1,65056,65106,1,65108,65126,1,65128,65131,1,65136,65140,1,65142,65276,1,65281,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65504,65510,1,65512,65518,1,65532,65533,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,65792,65794,1,65799,65843,1,65847,65934,1,65936,65948,1,65952,66e3,48,66001,66045,1,66176,66204,1,66208,66256,1,66272,66299,1,66304,66339,1,66349,66378,1,66384,66426,1,66432,66461,1,66463,66499,1,66504,66517,1,66560,66717,1,66720,66729,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66927,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67671,67742,1,67751,67759,1,67808,67826,1,67828,67829,1,67835,67867,1,67871,67897,1,67903,67968,65,67969,68023,1,68028,68047,1,68050,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1,68192,68255,1,68288,68326,1,68331,68342,1,68352,68405,1,68409,68437,1,68440,68466,1,68472,68497,1,68505,68508,1,68521,68527,1,68608,68680,1,68736,68786,1,68800,68850,1,68858,68903,1,68912,68921,1,68928,68965,1,68969,68997,1,69006,69007,1,69216,69246,1,69248,69289,1,69291,69293,1,69296,69297,1,69314,69316,1,69372,69415,1,69424,69465,1,69488,69513,1,69552,69579,1,69600,69622,1,69632,69709,1,69714,69749,1,69759,69820,1,69822,69826,1,69840,69864,1,69872,69881,1,69888,69940,1,69942,69959,1,69968,70006,1,70016,70111,1,70113,70132,1,70144,70161,1,70163,70209,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1,70320,70378,1,70384,70393,1,70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70459,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1,70656,70747,1,70749,70753,1,70784,70855,1,70864,70873,1,71040,71093,1,71096,71133,1,71168,71236,1,71248,71257,1,71264,71276,1,71296,71353,1,71360,71369,1,71376,71395,1,71424,71450,1,71453,71467,1,71472,71494,1,71680,71739,1,71840,71922,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1,72096,72103,1,72106,72151,1,72154,72164,1,72192,72263,1,72272,72354,1,72368,72440,1,72448,72457,1,72640,72673,1,72688,72697,1,72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1,72816,72847,1,72850,72871,1,72873,72886,1,72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1,73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1,73440,73464,1,73472,73488,1,73490,73530,1,73534,73562,1,73648,73664,16,73665,73713,1,73727,74649,1,74752,74862,1,74864,74868,1,74880,75075,1,77712,77810,1,77824,78895,1,78912,78933,1,78944,82938,1,82944,83526,1,90368,90425,1,92160,92728,1,92736,92766,1,92768,92777,1,92782,92862,1,92864,92873,1,92880,92909,1,92912,92917,1,92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1,93504,93561,1,93760,93850,1,93952,94026,1,94031,94087,1,94095,94111,1,94176,94180,1,94192,94193,1,94208,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1,117760,118009,1,118016,118451,1,118528,118573,1,118576,118598,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119154,1,119163,119274,1,119296,119365,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,121483,1,121499,121503,1,121505,121519,1,122624,122654,1,122661,122666,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,122928,122989,1,123023,123136,113,123137,123180,1,123184,123197,1,123200,123209,1,123214,123215,1,123536,123566,1,123584,123641,1,123647,124112,465,124113,124153,1,124368,124410,1,124415,124896,481,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125127,125142,1,125184,125259,1,125264,125273,1,125278,125279,1,126065,126132,1,126209,126269,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1,917760,917999,1]))},he=class{static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32(t,n){let r=0,s=t.length;for(;r<s;){let i=r+Math.floor((s-r)/2),a=t.getLo(i),o=t.getHi(i);if(a<=n&&n<=o){let l=t.getStride(i);return(n-a)%l===0}n<a?s=i:r=i+1}return!1}static is(t,n){if(n<=this.MAX_LATIN1){for(let r=0;r<t.length;r++){let s=t.getHi(r);if(n>s)continue;let i=t.getLo(r);if(n<i)return!1;let a=t.getStride(r);return(n-i)%a===0}return!1}return t.length>0&&n>=t.getLo(0)&&this.is32(t,n)}static isUpper(t){if(t<=this.MAX_LATIN1){let n=String.fromCodePoint(t);return n.toUpperCase()===n&&n.toLowerCase()!==n}return this.is(qt.Upper,t)}static isPrint(t){return t<=this.MAX_LATIN1?t>=32&&t<this.MAX_ASCII||t>=161&&t!==173:this.is(qt.Print,t)}static simpleFold(t){if(qt.CASE_ORBIT.has(t))return qt.CASE_ORBIT.get(t);let n=D.toLowerCase(t);return n!==t?n:D.toUpperCase(t)}static equalsIgnoreCase(t,n){if(t<0||n<0||t===n)return!0;if(t<=this.MAX_ASCII&&n<=this.MAX_ASCII)return D.CODES.get("A")<=t&&t<=D.CODES.get("Z")&&(t|=32),D.CODES.get("A")<=n&&n<=D.CODES.get("Z")&&(n|=32),t===n;for(let r=this.simpleFold(t);r!==t;r=this.simpleFold(r))if(r===n)return!0;return!1}},Ne=class{static METACHARACTERS="\\.+*?()|[]{}^$";static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isalnum(t){return D.CODES.get("0")<=t&&t<=D.CODES.get("9")||D.CODES.get("a")<=t&&t<=D.CODES.get("z")||D.CODES.get("A")<=t&&t<=D.CODES.get("Z")}static unhex(t){return D.CODES.get("0")<=t&&t<=D.CODES.get("9")?t-D.CODES.get("0"):D.CODES.get("a")<=t&&t<=D.CODES.get("f")?t-D.CODES.get("a")+10:D.CODES.get("A")<=t&&t<=D.CODES.get("F")?t-D.CODES.get("A")+10:-1}static escapeRune(t){let n="";if(he.isPrint(t))this.METACHARACTERS.indexOf(String.fromCodePoint(t))>=0&&(n+="\\"),n+=String.fromCodePoint(t);else switch(t){case D.CODES.get('"'):n+='\\"';break;case D.CODES.get("\\"):n+="\\\\";break;case D.CODES.get(" "):n+="\\t";break;case D.CODES.get(`
164
164
  `):n+="\\n";break;case D.CODES.get("\r"):n+="\\r";break;case D.CODES.get("\b"):n+="\\b";break;case D.CODES.get("\f"):n+="\\f";break;default:{let r=t.toString(16);t<256?(n+="\\x",r.length===1&&(n+="0"),n+=r):n+=`\\x{${r}}`;break}}return n}static stringToRunes(t){return String(t).split("").map(n=>n.codePointAt(0))}static runeToString(t){return String.fromCodePoint(t)}static isWordRune(t){return D.CODES.get("a")<=t&&t<=D.CODES.get("z")||D.CODES.get("A")<=t&&t<=D.CODES.get("Z")||D.CODES.get("0")<=t&&t<=D.CODES.get("9")||t===D.CODES.get("_")}static emptyOpContext(t,n){let r=0;return t<0&&(r|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),t===D.CODES.get(`
165
165
  `)&&(r|=this.EMPTY_BEGIN_LINE),n<0&&(r|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),n===D.CODES.get(`
@@ -169,7 +169,7 @@ Options:
169
169
  `)-1,D.CODES.get(`
170
170
  `)+1,he.MAX_RUNE]}static ANY_RUNE(){return[0,he.MAX_RUNE]}static compileRegexp(t){let n=new e,r=n.compile(t);return n.prog.patch(r.out,n.newInst(we.MATCH).i),n.prog.start=r.i,n.prog}constructor(){this.prog=new Xa,this.newInst(we.FAIL)}newInst(t){return this.prog.addInst(t),new Er(this.prog.numInst()-1,0,!0)}nop(){let t=this.newInst(we.NOP);return t.out=t.i<<1,t}fail(){return new Er}cap(t){let n=this.newInst(we.CAPTURE);return n.out=n.i<<1,this.prog.getInst(n.i).arg=t,this.prog.numCap<t+1&&(this.prog.numCap=t+1),n}cat(t,n){return t.i===0||n.i===0?this.fail():(this.prog.patch(t.out,n.i),new Er(t.i,n.out,t.nullable&&n.nullable))}alt(t,n){if(t.i===0)return n;if(n.i===0)return t;let r=this.newInst(we.ALT),s=this.prog.getInst(r.i);return s.out=t.i,s.arg=n.i,r.out=this.prog.append(t.out,n.out),r.nullable=t.nullable||n.nullable,r}loop(t,n){let r=this.newInst(we.ALT),s=this.prog.getInst(r.i);return n?(s.arg=t.i,r.out=r.i<<1):(s.out=t.i,r.out=r.i<<1|1),this.prog.patch(t.out,r.i),r}quest(t,n){let r=this.newInst(we.ALT),s=this.prog.getInst(r.i);return n?(s.arg=t.i,r.out=r.i<<1):(s.out=t.i,r.out=r.i<<1|1),r.out=this.prog.append(r.out,t.out),r}star(t,n){return t.nullable?this.quest(this.plus(t,n),n):this.loop(t,n)}plus(t,n){return new Er(t.i,this.loop(t,n).out,t.nullable)}empty(t){let n=this.newInst(we.EMPTY_WIDTH);return this.prog.getInst(n.i).arg=t,n.out=n.i<<1,n}rune(t,n){let r=this.newInst(we.RUNE);r.nullable=!1;let s=this.prog.getInst(r.i);return s.runes=t,n&=Q.FOLD_CASE,(t.length!==1||he.simpleFold(t[0])===t[0])&&(n&=-2),s.arg=n,r.out=r.i<<1,(n&Q.FOLD_CASE)===0&&t.length===1||t.length===2&&t[0]===t[1]?s.op=we.RUNE1:t.length===2&&t[0]===0&&t[1]===he.MAX_RUNE?s.op=we.RUNE_ANY:t.length===4&&t[0]===0&&t[1]===D.CODES.get(`
171
171
  `)-1&&t[2]===D.CODES.get(`
172
- `)+1&&t[3]===he.MAX_RUNE&&(s.op=we.RUNE_ANY_NOT_NL),r}compile(t){switch(t.op){case _.Op.NO_MATCH:return this.fail();case _.Op.EMPTY_MATCH:return this.nop();case _.Op.LITERAL:if(t.runes.length===0)return this.nop();{let n=null;for(let r of t.runes){let s=this.rune([r],t.flags);n=n===null?s:this.cat(n,s)}return n}case _.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case _.Op.ANY_CHAR_NOT_NL:return this.rune(e.ANY_RUNE_NOT_NL(),0);case _.Op.ANY_CHAR:return this.rune(e.ANY_RUNE(),0);case _.Op.BEGIN_LINE:return this.empty(Ne.EMPTY_BEGIN_LINE);case _.Op.END_LINE:return this.empty(Ne.EMPTY_END_LINE);case _.Op.BEGIN_TEXT:return this.empty(Ne.EMPTY_BEGIN_TEXT);case _.Op.END_TEXT:return this.empty(Ne.EMPTY_END_TEXT);case _.Op.WORD_BOUNDARY:return this.empty(Ne.EMPTY_WORD_BOUNDARY);case _.Op.NO_WORD_BOUNDARY:return this.empty(Ne.EMPTY_NO_WORD_BOUNDARY);case _.Op.CAPTURE:{let n=this.cap(t.cap<<1),r=this.compile(t.subs[0]),s=this.cap(t.cap<<1|1);return this.cat(this.cat(n,r),s)}case _.Op.STAR:return this.star(this.compile(t.subs[0]),(t.flags&Q.NON_GREEDY)!==0);case _.Op.PLUS:return this.plus(this.compile(t.subs[0]),(t.flags&Q.NON_GREEDY)!==0);case _.Op.QUEST:return this.quest(this.compile(t.subs[0]),(t.flags&Q.NON_GREEDY)!==0);case _.Op.CONCAT:{if(t.subs.length===0)return this.nop();{let n=null;for(let r of t.subs){let s=this.compile(r);n=n===null?s:this.cat(n,s)}return n}}case _.Op.ALTERNATE:{if(t.subs.length===0)return this.nop();{let n=null;for(let r of t.subs){let s=this.compile(r);n=n===null?s:this.alt(n,s)}return n}}default:throw new Ga("regexp: unhandled case in compile")}}},Ja=class e{static simplify(t){if(t===null)return null;switch(t.op){case _.Op.CAPTURE:case _.Op.CONCAT:case _.Op.ALTERNATE:{let n=t;for(let r=0;r<t.subs.length;r++){let s=t.subs[r],i=e.simplify(s);n===t&&i!==s&&(n=_.fromRegexp(t),n.runes=[],n.subs=t.subs.slice(0,t.subs.length)),n!==t&&(n.subs[r]=i)}return n}case _.Op.STAR:case _.Op.PLUS:case _.Op.QUEST:{let n=e.simplify(t.subs[0]);return e.simplify1(t.op,t.flags,n,t)}case _.Op.REPEAT:{if(t.min===0&&t.max===0)return new _(_.Op.EMPTY_MATCH);let n=e.simplify(t.subs[0]);if(t.max===-1){if(t.min===0)return e.simplify1(_.Op.STAR,t.flags,n,null);if(t.min===1)return e.simplify1(_.Op.PLUS,t.flags,n,null);let s=new _(_.Op.CONCAT),i=[];for(let a=0;a<t.min-1;a++)i.push(n);return i.push(e.simplify1(_.Op.PLUS,t.flags,n,null)),s.subs=i.slice(0),s}if(t.min===1&&t.max===1)return n;let r=null;if(t.min>0){r=[];for(let s=0;s<t.min;s++)r.push(n)}if(t.max>t.min){let s=e.simplify1(_.Op.QUEST,t.flags,n,null);for(let i=t.min+1;i<t.max;i++){let a=new _(_.Op.CONCAT);a.subs=[n,s],s=e.simplify1(_.Op.QUEST,t.flags,a,null)}if(r===null)return s;r.push(s)}if(r!==null){let s=new _(_.Op.CONCAT);return s.subs=r.slice(0),s}return new _(_.Op.NO_MATCH)}}return t}static simplify1(t,n,r,s){return r.op===_.Op.EMPTY_MATCH||t===r.op&&(n&Q.NON_GREEDY)===(r.flags&Q.NON_GREEDY)?r:(s!==null&&s.op===t&&(s.flags&Q.NON_GREEDY)===(n&Q.NON_GREEDY)&&r===s.subs[0]||(s=new _(t),s.flags=n,s.subs=[r]),s)}},Ce=class{constructor(t,n){this.sign=t,this.cls=n}},wf=[48,57],bf=[9,10,12,13,32,32],xf=[48,57,65,90,95,95,97,122],Ef=new Map([["\\d",new Ce(1,wf)],["\\D",new Ce(-1,wf)],["\\s",new Ce(1,bf)],["\\S",new Ce(-1,bf)],["\\w",new Ce(1,xf)],["\\W",new Ce(-1,xf)]]),Af=[48,57,65,90,97,122],Sf=[65,90,97,122],Cf=[0,127],Nf=[9,9,32,32],kf=[0,31,127,127],vf=[48,57],If=[33,126],$f=[97,122],Of=[32,126],Rf=[33,47,58,64,91,96,123,126],Tf=[9,13,32,32],Pf=[65,90],Df=[48,57,65,90,95,95,97,122],_f=[48,57,65,70,97,102],Lf=new Map([["[:alnum:]",new Ce(1,Af)],["[:^alnum:]",new Ce(-1,Af)],["[:alpha:]",new Ce(1,Sf)],["[:^alpha:]",new Ce(-1,Sf)],["[:ascii:]",new Ce(1,Cf)],["[:^ascii:]",new Ce(-1,Cf)],["[:blank:]",new Ce(1,Nf)],["[:^blank:]",new Ce(-1,Nf)],["[:cntrl:]",new Ce(1,kf)],["[:^cntrl:]",new Ce(-1,kf)],["[:digit:]",new Ce(1,vf)],["[:^digit:]",new Ce(-1,vf)],["[:graph:]",new Ce(1,If)],["[:^graph:]",new Ce(-1,If)],["[:lower:]",new Ce(1,$f)],["[:^lower:]",new Ce(-1,$f)],["[:print:]",new Ce(1,Of)],["[:^print:]",new Ce(-1,Of)],["[:punct:]",new Ce(1,Rf)],["[:^punct:]",new Ce(-1,Rf)],["[:space:]",new Ce(1,Tf)],["[:^space:]",new Ce(-1,Tf)],["[:upper:]",new Ce(1,Pf)],["[:^upper:]",new Ce(-1,Pf)],["[:word:]",new Ce(1,Df)],["[:^word:]",new Ce(-1,Df)],["[:xdigit:]",new Ce(1,_f)],["[:^xdigit:]",new Ce(-1,_f)]]),hn=class e{static charClassToString(t,n){let r="[";for(let s=0;s<n;s+=2){s>0&&(r+=" ");let i=t[s],a=t[s+1];i===a?r+=`0x${i.toString(16)}`:r+=`0x${i.toString(16)}-0x${a.toString(16)}`}return r+="]",r}static cmp(t,n,r,s){let i=t[n]-r;return i!==0?i:s-t[n+1]}static qsortIntPair(t,n,r){let s=((n+r)/2|0)&-2,i=t[s],a=t[s+1],o=n,l=r;for(;o<=l;){for(;o<r&&e.cmp(t,o,i,a)<0;)o+=2;for(;l>n&&e.cmp(t,l,i,a)>0;)l-=2;if(o<=l){if(o!==l){let c=t[o];t[o]=t[l],t[l]=c,c=t[o+1],t[o+1]=t[l+1],t[l+1]=c}o+=2,l-=2}}n<l&&e.qsortIntPair(t,n,l),o<r&&e.qsortIntPair(t,o,r)}constructor(t=Ne.emptyInts()){this.r=t,this.len=t.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;e.qsortIntPair(this.r,0,this.len-2);let t=2;for(let n=2;n<this.len;n+=2){let r=this.r[n],s=this.r[n+1];if(r<=this.r[t-1]+1){s>this.r[t-1]&&(this.r[t-1]=s);continue}this.r[t]=r,this.r[t+1]=s,t+=2}return this.len=t,this}appendLiteral(t,n){return(n&Q.FOLD_CASE)!==0?this.appendFoldedRange(t,t):this.appendRange(t,t)}appendRange(t,n){if(this.len>0){for(let r=2;r<=4;r+=2)if(this.len>=r){let s=this.r[this.len-r],i=this.r[this.len-r+1];if(t<=i+1&&s<=n+1)return t<s&&(this.r[this.len-r]=t),n>i&&(this.r[this.len-r+1]=n),this}}return this.r[this.len++]=t,this.r[this.len++]=n,this}appendFoldedRange(t,n){if(t<=he.MIN_FOLD&&n>=he.MAX_FOLD)return this.appendRange(t,n);if(n<he.MIN_FOLD||t>he.MAX_FOLD)return this.appendRange(t,n);t<he.MIN_FOLD&&(this.appendRange(t,he.MIN_FOLD-1),t=he.MIN_FOLD),n>he.MAX_FOLD&&(this.appendRange(he.MAX_FOLD+1,n),n=he.MAX_FOLD);for(let r=t;r<=n;r++){this.appendRange(r,r);for(let s=he.simpleFold(r);s!==r;s=he.simpleFold(s))this.appendRange(s,s)}return this}appendClass(t){for(let n=0;n<t.length;n+=2)this.appendRange(t[n],t[n+1]);return this}appendFoldedClass(t){for(let n=0;n<t.length;n+=2)this.appendFoldedRange(t[n],t[n+1]);return this}appendNegatedClass(t){let n=0;for(let r=0;r<t.length;r+=2){let s=t[r],i=t[r+1];n<=s-1&&this.appendRange(n,s-1),n=i+1}return n<=he.MAX_RUNE&&this.appendRange(n,he.MAX_RUNE),this}appendTable(t){for(let n=0;n<t.length;++n){let r=t.getLo(n),s=t.getHi(n),i=t.getStride(n);if(i===1){this.appendRange(r,s);continue}for(let a=r;a<=s;a+=i)this.appendRange(a,a)}return this}appendNegatedTable(t){let n=0;for(let r=0;r<t.length;++r){let s=t.getLo(r),i=t.getHi(r),a=t.getStride(r);if(a===1){n<=s-1&&this.appendRange(n,s-1),n=i+1;continue}for(let o=s;o<=i;o+=a)n<=o-1&&this.appendRange(n,o-1),n=o+1}return n<=he.MAX_RUNE&&this.appendRange(n,he.MAX_RUNE),this}appendTableWithSign(t,n){return n<0?this.appendNegatedTable(t):this.appendTable(t)}negateClass(){let t=0,n=0;for(let r=0;r<this.len;r+=2){let s=this.r[r],i=this.r[r+1];t<=s-1&&(this.r[n]=t,this.r[n+1]=s-1,n+=2),t=i+1}return this.len=n,t<=he.MAX_RUNE&&(this.r[this.len++]=t,this.r[this.len++]=he.MAX_RUNE),this}appendClassWithSign(t,n){return n<0?this.appendNegatedClass(t):this.appendClass(t)}appendGroup(t,n){let r=t.cls;return n&&(r=new e().appendFoldedClass(r).cleanClass().toArray()),this.appendClassWithSign(r,t.sign)}toString(){return e.charClassToString(this.r,this.len)}},ls=class e{static of(t,n){return new e(t,n)}constructor(t,n){this.first=t,this.second=n}},eo=class{constructor(t){this.str=t,this.position=0}pos(){return this.position}rewindTo(t){this.position=t}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(t){this.position+=t}skipString(t){this.position+=t.length}pop(){let t=this.str.codePointAt(this.position);return this.position+=Ne.charCount(t),t}lookingAt(t){return this.rest().startsWith(t)}rest(){return this.str.substring(this.position)}from(t){return this.str.substring(t,this.position)}toString(){return this.rest()}},to=class e{static ERR_INTERNAL_ERROR="regexp/syntax: internal error";static ERR_INVALID_CHAR_RANGE="invalid character class range";static ERR_INVALID_ESCAPE="invalid escape sequence";static ERR_INVALID_NAMED_CAPTURE="invalid named capture";static ERR_INVALID_PERL_OP="invalid or unsupported Perl syntax";static ERR_INVALID_REPEAT_OP="invalid nested repetition operator";static ERR_INVALID_REPEAT_SIZE="invalid repeat count";static ERR_MISSING_BRACKET="missing closing ]";static ERR_MISSING_PAREN="missing closing )";static ERR_MISSING_REPEAT_ARGUMENT="missing argument to repetition operator";static ERR_TRAILING_BACKSLASH="trailing backslash at end of expression";static ERR_DUPLICATE_NAMED_CAPTURE="duplicate capture group name";static ERR_UNEXPECTED_PAREN="unexpected )";static ERR_NESTING_DEPTH="expression nests too deeply";static ERR_LARGE="expression too large";static MAX_HEIGHT=1e3;static MAX_SIZE=3355443;static MAX_RUNES=33554432;static ANY_TABLE=new C(new Uint32Array([0,he.MAX_RUNE,1]));static unicodeTable(t){return t==="Any"?ls.of(e.ANY_TABLE,e.ANY_TABLE):qt.CATEGORIES.has(t)?ls.of(qt.CATEGORIES.get(t),qt.FOLD_CATEGORIES.get(t)):qt.SCRIPTS.has(t)?ls.of(qt.SCRIPTS.get(t),qt.FOLD_SCRIPT.get(t)):null}static minFoldRune(t){if(t<he.MIN_FOLD||t>he.MAX_FOLD)return t;let n=t,r=t;for(t=he.simpleFold(t);t!==r;t=he.simpleFold(t))n>t&&(n=t);return n}static leadingRegexp(t){if(t.op===_.Op.EMPTY_MATCH)return null;if(t.op===_.Op.CONCAT&&t.subs.length>0){let n=t.subs[0];return n.op===_.Op.EMPTY_MATCH?null:n}return t}static literalRegexp(t,n){let r=new _(_.Op.LITERAL);return r.flags=n,r.runes=Ne.stringToRunes(t),r}static parse(t,n){return new e(t,n).parseInternal()}static parseRepeat(t){let n=t.pos();if(!t.more()||!t.lookingAt("{"))return-1;t.skip(1);let r=e.parseInt(t);if(r===-1||!t.more())return-1;let s;if(!t.lookingAt(","))s=r;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt("}"))s=-1;else if((s=e.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt("}"))return-1;if(t.skip(1),r<0||r>1e3||s===-2||s>1e3||s>=0&&r>s)throw new De(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|s&he.MAX_BMP}static isValidCaptureName(t){if(t.length===0)return!1;for(let n=0;n<t.length;n++){let r=t.codePointAt(n);if(r!==D.CODES.get("_")&&!Ne.isalnum(r))return!1}return!0}static parseInt(t){let n=t.pos();for(;t.more()&&t.peek()>=D.CODES.get("0")&&t.peek()<=D.CODES.get("9");)t.skip(1);let r=t.from(n);return r.length===0||r.length>1&&r.codePointAt(0)===D.CODES.get("0")?-1:r.length>8?-2:parseFloat(r,10)}static isCharClass(t){return t.op===_.Op.LITERAL&&t.runes.length===1||t.op===_.Op.CHAR_CLASS||t.op===_.Op.ANY_CHAR_NOT_NL||t.op===_.Op.ANY_CHAR}static matchRune(t,n){switch(t.op){case _.Op.LITERAL:return t.runes.length===1&&t.runes[0]===n;case _.Op.CHAR_CLASS:for(let r=0;r<t.runes.length;r+=2)if(t.runes[r]<=n&&n<=t.runes[r+1])return!0;return!1;case _.Op.ANY_CHAR_NOT_NL:return n!==D.CODES.get(`
172
+ `)+1&&t[3]===he.MAX_RUNE&&(s.op=we.RUNE_ANY_NOT_NL),r}compile(t){switch(t.op){case _.Op.NO_MATCH:return this.fail();case _.Op.EMPTY_MATCH:return this.nop();case _.Op.LITERAL:if(t.runes.length===0)return this.nop();{let n=null;for(let r of t.runes){let s=this.rune([r],t.flags);n=n===null?s:this.cat(n,s)}return n}case _.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case _.Op.ANY_CHAR_NOT_NL:return this.rune(e.ANY_RUNE_NOT_NL(),0);case _.Op.ANY_CHAR:return this.rune(e.ANY_RUNE(),0);case _.Op.BEGIN_LINE:return this.empty(Ne.EMPTY_BEGIN_LINE);case _.Op.END_LINE:return this.empty(Ne.EMPTY_END_LINE);case _.Op.BEGIN_TEXT:return this.empty(Ne.EMPTY_BEGIN_TEXT);case _.Op.END_TEXT:return this.empty(Ne.EMPTY_END_TEXT);case _.Op.WORD_BOUNDARY:return this.empty(Ne.EMPTY_WORD_BOUNDARY);case _.Op.NO_WORD_BOUNDARY:return this.empty(Ne.EMPTY_NO_WORD_BOUNDARY);case _.Op.CAPTURE:{let n=this.cap(t.cap<<1),r=this.compile(t.subs[0]),s=this.cap(t.cap<<1|1);return this.cat(this.cat(n,r),s)}case _.Op.STAR:return this.star(this.compile(t.subs[0]),(t.flags&Q.NON_GREEDY)!==0);case _.Op.PLUS:return this.plus(this.compile(t.subs[0]),(t.flags&Q.NON_GREEDY)!==0);case _.Op.QUEST:return this.quest(this.compile(t.subs[0]),(t.flags&Q.NON_GREEDY)!==0);case _.Op.CONCAT:{if(t.subs.length===0)return this.nop();{let n=null;for(let r of t.subs){let s=this.compile(r);n=n===null?s:this.cat(n,s)}return n}}case _.Op.ALTERNATE:{if(t.subs.length===0)return this.nop();{let n=null;for(let r of t.subs){let s=this.compile(r);n=n===null?s:this.alt(n,s)}return n}}default:throw new Ga("regexp: unhandled case in compile")}}},Ja=class e{static simplify(t){if(t===null)return null;switch(t.op){case _.Op.CAPTURE:case _.Op.CONCAT:case _.Op.ALTERNATE:{let n=t;for(let r=0;r<t.subs.length;r++){let s=t.subs[r],i=e.simplify(s);n===t&&i!==s&&(n=_.fromRegexp(t),n.runes=[],n.subs=t.subs.slice(0,t.subs.length)),n!==t&&(n.subs[r]=i)}return n}case _.Op.STAR:case _.Op.PLUS:case _.Op.QUEST:{let n=e.simplify(t.subs[0]);return e.simplify1(t.op,t.flags,n,t)}case _.Op.REPEAT:{if(t.min===0&&t.max===0)return new _(_.Op.EMPTY_MATCH);let n=e.simplify(t.subs[0]);if(t.max===-1){if(t.min===0)return e.simplify1(_.Op.STAR,t.flags,n,null);if(t.min===1)return e.simplify1(_.Op.PLUS,t.flags,n,null);let s=new _(_.Op.CONCAT),i=[];for(let a=0;a<t.min-1;a++)i.push(n);return i.push(e.simplify1(_.Op.PLUS,t.flags,n,null)),s.subs=i.slice(0),s}if(t.min===1&&t.max===1)return n;let r=null;if(t.min>0){r=[];for(let s=0;s<t.min;s++)r.push(n)}if(t.max>t.min){let s=e.simplify1(_.Op.QUEST,t.flags,n,null);for(let i=t.min+1;i<t.max;i++){let a=new _(_.Op.CONCAT);a.subs=[n,s],s=e.simplify1(_.Op.QUEST,t.flags,a,null)}if(r===null)return s;r.push(s)}if(r!==null){let s=new _(_.Op.CONCAT);return s.subs=r.slice(0),s}return new _(_.Op.NO_MATCH)}}return t}static simplify1(t,n,r,s){return r.op===_.Op.EMPTY_MATCH||t===r.op&&(n&Q.NON_GREEDY)===(r.flags&Q.NON_GREEDY)?r:(s!==null&&s.op===t&&(s.flags&Q.NON_GREEDY)===(n&Q.NON_GREEDY)&&r===s.subs[0]||(s=new _(t),s.flags=n,s.subs=[r]),s)}},Ce=class{constructor(t,n){this.sign=t,this.cls=n}},wf=[48,57],bf=[9,10,12,13,32,32],xf=[48,57,65,90,95,95,97,122],Ef=new Map([["\\d",new Ce(1,wf)],["\\D",new Ce(-1,wf)],["\\s",new Ce(1,bf)],["\\S",new Ce(-1,bf)],["\\w",new Ce(1,xf)],["\\W",new Ce(-1,xf)]]),Af=[48,57,65,90,97,122],Sf=[65,90,97,122],Cf=[0,127],Nf=[9,9,32,32],vf=[0,31,127,127],kf=[48,57],If=[33,126],$f=[97,122],Of=[32,126],Rf=[33,47,58,64,91,96,123,126],Tf=[9,13,32,32],Pf=[65,90],Df=[48,57,65,90,95,95,97,122],_f=[48,57,65,70,97,102],Lf=new Map([["[:alnum:]",new Ce(1,Af)],["[:^alnum:]",new Ce(-1,Af)],["[:alpha:]",new Ce(1,Sf)],["[:^alpha:]",new Ce(-1,Sf)],["[:ascii:]",new Ce(1,Cf)],["[:^ascii:]",new Ce(-1,Cf)],["[:blank:]",new Ce(1,Nf)],["[:^blank:]",new Ce(-1,Nf)],["[:cntrl:]",new Ce(1,vf)],["[:^cntrl:]",new Ce(-1,vf)],["[:digit:]",new Ce(1,kf)],["[:^digit:]",new Ce(-1,kf)],["[:graph:]",new Ce(1,If)],["[:^graph:]",new Ce(-1,If)],["[:lower:]",new Ce(1,$f)],["[:^lower:]",new Ce(-1,$f)],["[:print:]",new Ce(1,Of)],["[:^print:]",new Ce(-1,Of)],["[:punct:]",new Ce(1,Rf)],["[:^punct:]",new Ce(-1,Rf)],["[:space:]",new Ce(1,Tf)],["[:^space:]",new Ce(-1,Tf)],["[:upper:]",new Ce(1,Pf)],["[:^upper:]",new Ce(-1,Pf)],["[:word:]",new Ce(1,Df)],["[:^word:]",new Ce(-1,Df)],["[:xdigit:]",new Ce(1,_f)],["[:^xdigit:]",new Ce(-1,_f)]]),hn=class e{static charClassToString(t,n){let r="[";for(let s=0;s<n;s+=2){s>0&&(r+=" ");let i=t[s],a=t[s+1];i===a?r+=`0x${i.toString(16)}`:r+=`0x${i.toString(16)}-0x${a.toString(16)}`}return r+="]",r}static cmp(t,n,r,s){let i=t[n]-r;return i!==0?i:s-t[n+1]}static qsortIntPair(t,n,r){let s=((n+r)/2|0)&-2,i=t[s],a=t[s+1],o=n,l=r;for(;o<=l;){for(;o<r&&e.cmp(t,o,i,a)<0;)o+=2;for(;l>n&&e.cmp(t,l,i,a)>0;)l-=2;if(o<=l){if(o!==l){let c=t[o];t[o]=t[l],t[l]=c,c=t[o+1],t[o+1]=t[l+1],t[l+1]=c}o+=2,l-=2}}n<l&&e.qsortIntPair(t,n,l),o<r&&e.qsortIntPair(t,o,r)}constructor(t=Ne.emptyInts()){this.r=t,this.len=t.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;e.qsortIntPair(this.r,0,this.len-2);let t=2;for(let n=2;n<this.len;n+=2){let r=this.r[n],s=this.r[n+1];if(r<=this.r[t-1]+1){s>this.r[t-1]&&(this.r[t-1]=s);continue}this.r[t]=r,this.r[t+1]=s,t+=2}return this.len=t,this}appendLiteral(t,n){return(n&Q.FOLD_CASE)!==0?this.appendFoldedRange(t,t):this.appendRange(t,t)}appendRange(t,n){if(this.len>0){for(let r=2;r<=4;r+=2)if(this.len>=r){let s=this.r[this.len-r],i=this.r[this.len-r+1];if(t<=i+1&&s<=n+1)return t<s&&(this.r[this.len-r]=t),n>i&&(this.r[this.len-r+1]=n),this}}return this.r[this.len++]=t,this.r[this.len++]=n,this}appendFoldedRange(t,n){if(t<=he.MIN_FOLD&&n>=he.MAX_FOLD)return this.appendRange(t,n);if(n<he.MIN_FOLD||t>he.MAX_FOLD)return this.appendRange(t,n);t<he.MIN_FOLD&&(this.appendRange(t,he.MIN_FOLD-1),t=he.MIN_FOLD),n>he.MAX_FOLD&&(this.appendRange(he.MAX_FOLD+1,n),n=he.MAX_FOLD);for(let r=t;r<=n;r++){this.appendRange(r,r);for(let s=he.simpleFold(r);s!==r;s=he.simpleFold(s))this.appendRange(s,s)}return this}appendClass(t){for(let n=0;n<t.length;n+=2)this.appendRange(t[n],t[n+1]);return this}appendFoldedClass(t){for(let n=0;n<t.length;n+=2)this.appendFoldedRange(t[n],t[n+1]);return this}appendNegatedClass(t){let n=0;for(let r=0;r<t.length;r+=2){let s=t[r],i=t[r+1];n<=s-1&&this.appendRange(n,s-1),n=i+1}return n<=he.MAX_RUNE&&this.appendRange(n,he.MAX_RUNE),this}appendTable(t){for(let n=0;n<t.length;++n){let r=t.getLo(n),s=t.getHi(n),i=t.getStride(n);if(i===1){this.appendRange(r,s);continue}for(let a=r;a<=s;a+=i)this.appendRange(a,a)}return this}appendNegatedTable(t){let n=0;for(let r=0;r<t.length;++r){let s=t.getLo(r),i=t.getHi(r),a=t.getStride(r);if(a===1){n<=s-1&&this.appendRange(n,s-1),n=i+1;continue}for(let o=s;o<=i;o+=a)n<=o-1&&this.appendRange(n,o-1),n=o+1}return n<=he.MAX_RUNE&&this.appendRange(n,he.MAX_RUNE),this}appendTableWithSign(t,n){return n<0?this.appendNegatedTable(t):this.appendTable(t)}negateClass(){let t=0,n=0;for(let r=0;r<this.len;r+=2){let s=this.r[r],i=this.r[r+1];t<=s-1&&(this.r[n]=t,this.r[n+1]=s-1,n+=2),t=i+1}return this.len=n,t<=he.MAX_RUNE&&(this.r[this.len++]=t,this.r[this.len++]=he.MAX_RUNE),this}appendClassWithSign(t,n){return n<0?this.appendNegatedClass(t):this.appendClass(t)}appendGroup(t,n){let r=t.cls;return n&&(r=new e().appendFoldedClass(r).cleanClass().toArray()),this.appendClassWithSign(r,t.sign)}toString(){return e.charClassToString(this.r,this.len)}},ls=class e{static of(t,n){return new e(t,n)}constructor(t,n){this.first=t,this.second=n}},eo=class{constructor(t){this.str=t,this.position=0}pos(){return this.position}rewindTo(t){this.position=t}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(t){this.position+=t}skipString(t){this.position+=t.length}pop(){let t=this.str.codePointAt(this.position);return this.position+=Ne.charCount(t),t}lookingAt(t){return this.rest().startsWith(t)}rest(){return this.str.substring(this.position)}from(t){return this.str.substring(t,this.position)}toString(){return this.rest()}},to=class e{static ERR_INTERNAL_ERROR="regexp/syntax: internal error";static ERR_INVALID_CHAR_RANGE="invalid character class range";static ERR_INVALID_ESCAPE="invalid escape sequence";static ERR_INVALID_NAMED_CAPTURE="invalid named capture";static ERR_INVALID_PERL_OP="invalid or unsupported Perl syntax";static ERR_INVALID_REPEAT_OP="invalid nested repetition operator";static ERR_INVALID_REPEAT_SIZE="invalid repeat count";static ERR_MISSING_BRACKET="missing closing ]";static ERR_MISSING_PAREN="missing closing )";static ERR_MISSING_REPEAT_ARGUMENT="missing argument to repetition operator";static ERR_TRAILING_BACKSLASH="trailing backslash at end of expression";static ERR_DUPLICATE_NAMED_CAPTURE="duplicate capture group name";static ERR_UNEXPECTED_PAREN="unexpected )";static ERR_NESTING_DEPTH="expression nests too deeply";static ERR_LARGE="expression too large";static MAX_HEIGHT=1e3;static MAX_SIZE=3355443;static MAX_RUNES=33554432;static ANY_TABLE=new C(new Uint32Array([0,he.MAX_RUNE,1]));static unicodeTable(t){return t==="Any"?ls.of(e.ANY_TABLE,e.ANY_TABLE):qt.CATEGORIES.has(t)?ls.of(qt.CATEGORIES.get(t),qt.FOLD_CATEGORIES.get(t)):qt.SCRIPTS.has(t)?ls.of(qt.SCRIPTS.get(t),qt.FOLD_SCRIPT.get(t)):null}static minFoldRune(t){if(t<he.MIN_FOLD||t>he.MAX_FOLD)return t;let n=t,r=t;for(t=he.simpleFold(t);t!==r;t=he.simpleFold(t))n>t&&(n=t);return n}static leadingRegexp(t){if(t.op===_.Op.EMPTY_MATCH)return null;if(t.op===_.Op.CONCAT&&t.subs.length>0){let n=t.subs[0];return n.op===_.Op.EMPTY_MATCH?null:n}return t}static literalRegexp(t,n){let r=new _(_.Op.LITERAL);return r.flags=n,r.runes=Ne.stringToRunes(t),r}static parse(t,n){return new e(t,n).parseInternal()}static parseRepeat(t){let n=t.pos();if(!t.more()||!t.lookingAt("{"))return-1;t.skip(1);let r=e.parseInt(t);if(r===-1||!t.more())return-1;let s;if(!t.lookingAt(","))s=r;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt("}"))s=-1;else if((s=e.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt("}"))return-1;if(t.skip(1),r<0||r>1e3||s===-2||s>1e3||s>=0&&r>s)throw new De(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|s&he.MAX_BMP}static isValidCaptureName(t){if(t.length===0)return!1;for(let n=0;n<t.length;n++){let r=t.codePointAt(n);if(r!==D.CODES.get("_")&&!Ne.isalnum(r))return!1}return!0}static parseInt(t){let n=t.pos();for(;t.more()&&t.peek()>=D.CODES.get("0")&&t.peek()<=D.CODES.get("9");)t.skip(1);let r=t.from(n);return r.length===0||r.length>1&&r.codePointAt(0)===D.CODES.get("0")?-1:r.length>8?-2:parseFloat(r,10)}static isCharClass(t){return t.op===_.Op.LITERAL&&t.runes.length===1||t.op===_.Op.CHAR_CLASS||t.op===_.Op.ANY_CHAR_NOT_NL||t.op===_.Op.ANY_CHAR}static matchRune(t,n){switch(t.op){case _.Op.LITERAL:return t.runes.length===1&&t.runes[0]===n;case _.Op.CHAR_CLASS:for(let r=0;r<t.runes.length;r+=2)if(t.runes[r]<=n&&n<=t.runes[r+1])return!0;return!1;case _.Op.ANY_CHAR_NOT_NL:return n!==D.CODES.get(`
173
173
  `);case _.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(t,n){switch(t.op){case _.Op.ANY_CHAR:break;case _.Op.ANY_CHAR_NOT_NL:e.matchRune(n,D.CODES.get(`
174
174
  `))&&(t.op=_.Op.ANY_CHAR);break;case _.Op.CHAR_CLASS:n.op===_.Op.LITERAL?t.runes=new hn(t.runes).appendLiteral(n.runes[0],n.flags).toArray():t.runes=new hn(t.runes).appendClass(n.runes).toArray();break;case _.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=_.Op.CHAR_CLASS,t.runes=new hn().appendLiteral(t.runes[0],t.flags).appendLiteral(n.runes[0],n.flags).toArray();break}}static parseEscape(t){let n=t.pos();if(t.skip(1),!t.more())throw new De(e.ERR_TRAILING_BACKSLASH);let r=t.pop();e:switch(r){case D.CODES.get("1"):case D.CODES.get("2"):case D.CODES.get("3"):case D.CODES.get("4"):case D.CODES.get("5"):case D.CODES.get("6"):case D.CODES.get("7"):if(!t.more()||t.peek()<D.CODES.get("0")||t.peek()>D.CODES.get("7"))break;case D.CODES.get("0"):{let s=r-D.CODES.get("0");for(let i=1;i<3&&!(!t.more()||t.peek()<D.CODES.get("0")||t.peek()>D.CODES.get("7"));i++)s=s*8+t.peek()-D.CODES.get("0"),t.skip(1);return s}case D.CODES.get("x"):{if(!t.more())break;if(r=t.pop(),r===D.CODES.get("{")){let a=0,o=0;for(;;){if(!t.more())break e;if(r=t.pop(),r===D.CODES.get("}"))break;let l=Ne.unhex(r);if(l<0||(o=o*16+l,o>he.MAX_RUNE))break e;a++}if(a===0)break e;return o}let s=Ne.unhex(r);if(!t.more())break;r=t.pop();let i=Ne.unhex(r);if(s<0||i<0)break;return s*16+i}case D.CODES.get("a"):return D.CODES.get("\x07");case D.CODES.get("f"):return D.CODES.get("\f");case D.CODES.get("n"):return D.CODES.get(`
175
175
  `);case D.CODES.get("r"):return D.CODES.get("\r");case D.CODES.get("t"):return D.CODES.get(" ");case D.CODES.get("v"):return D.CODES.get("\v");default:if(r<=he.MAX_ASCII&&!Ne.isalnum(r))return r;break}throw new De(e.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new De(e.ERR_MISSING_BRACKET,t.from(n));return t.lookingAt("\\")?e.parseEscape(t):t.pop()}static concatRunes(t,n){return[...t,...n]}constructor(t,n=0){this.wholeRegexp=t,this.flags=n,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null,this.numRegexp=0,this.numRunes=0,this.repeats=0,this.height=null,this.size=null}newRegexp(t){let n=this.free;return n!==null&&n.subs!==null&&n.subs.length>0?(this.free=n.subs[0],n.reinit(),n.op=t):(n=new _(t),this.numRegexp+=1),n}reuse(t){this.height!==null&&Object.prototype.hasOwnProperty.call(this.height,t)&&delete this.height[t],t.subs!==null&&t.subs.length>0&&(t.subs[0]=this.free),this.free=t}checkLimits(t){if(this.numRunes>e.MAX_RUNES)throw new De(e.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(this.size===null){if(this.repeats===0&&(this.repeats=1),t.op===_.Op.REPEAT){let n=t.max;n===-1&&(n=t.min),n<=0&&(n=1),n>e.MAX_SIZE/this.repeats?this.repeats=e.MAX_SIZE:this.repeats*=n}if(this.numRegexp<e.MAX_SIZE/this.repeats)return;this.size={};for(let n of this.stack)this.checkSize(n)}if(this.calcSize(t,!0)>e.MAX_SIZE)throw new De(e.ERR_LARGE)}calcSize(t,n=!1){if(!n&&Object.prototype.hasOwnProperty.call(this.size,t))return this.size[t];let r=0;switch(t.op){case _.Op.LITERAL:{r=t.runes.length;break}case _.Op.CAPTURE:case _.Op.STAR:{r=2+this.calcSize(t.subs[0]);break}case _.Op.PLUS:case _.Op.QUEST:{r=1+this.calcSize(t.subs[0]);break}case _.Op.CONCAT:{for(let s of t.subs)r=r+this.calcSize(s);break}case _.Op.ALTERNATE:{for(let s of t.subs)r=r+this.calcSize(s);t.subs.length>1&&(r=r+t.subs.length-1);break}case _.Op.REPEAT:{let s=this.calcSize(t.subs[0]);if(t.max===-1){t.min===0?r=2+s:r=1+t.min*s;break}r=t.max*s+(t.max-t.min);break}}return r=Math.max(1,r),this.size[t]=r,r}checkHeight(t){if(!(this.numRegexp<e.MAX_HEIGHT)){if(this.height===null){this.height={};for(let n of this.stack)this.checkHeight(n)}if(this.calcHeight(t,!0)>e.MAX_HEIGHT)throw new De(e.ERR_NESTING_DEPTH)}}calcHeight(t,n=!1){if(!n&&Object.prototype.hasOwnProperty.call(this.height,t))return this.height[t];let r=1;for(let s of t.subs){let i=this.calcHeight(s);r<1+i&&(r=1+i)}return this.height[t]=r,r}pop(){return this.stack.pop()}popToPseudo(){let t=this.stack.length,n=t;for(;n>0&&!_.isPseudoOp(this.stack[n-1].op);)n--;let r=this.stack.slice(n,t);return this.stack=this.stack.slice(0,n),r}push(t){if(this.numRunes+=t.runes.length,t.op===_.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]===t.runes[1]){if(this.maybeConcat(t.runes[0],this.flags&-2))return null;t.op=_.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags&-2}else if(t.op===_.Op.CHAR_CLASS&&t.runes.length===4&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&he.simpleFold(t.runes[0])===t.runes[2]&&he.simpleFold(t.runes[2])===t.runes[0]||t.op===_.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]+1===t.runes[1]&&he.simpleFold(t.runes[0])===t.runes[1]&&he.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|Q.FOLD_CASE))return null;t.op=_.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|Q.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(t),this.checkLimits(t),t}maybeConcat(t,n){let r=this.stack.length;if(r<2)return!1;let s=this.stack[r-1],i=this.stack[r-2];return s.op!==_.Op.LITERAL||i.op!==_.Op.LITERAL||(s.flags&Q.FOLD_CASE)!==(i.flags&Q.FOLD_CASE)?!1:(i.runes=e.concatRunes(i.runes,s.runes),t>=0?(s.runes=[t],s.flags=n,!0):(this.pop(),this.reuse(s),!1))}newLiteral(t,n){let r=this.newRegexp(_.Op.LITERAL);return r.flags=n,(n&Q.FOLD_CASE)!==0&&(t=e.minFoldRune(t)),r.runes=[t],r}literal(t){this.push(this.newLiteral(t,this.flags))}op(t){let n=this.newRegexp(t);return n.flags=this.flags,this.push(n)}repeat(t,n,r,s,i,a){let o=this.flags;if((o&Q.PERL_X)!==0&&(i.more()&&i.lookingAt("?")&&(i.skip(1),o^=Q.NON_GREEDY),a!==-1))throw new De(e.ERR_INVALID_REPEAT_OP,i.from(a));let l=this.stack.length;if(l===0)throw new De(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let c=this.stack[l-1];if(_.isPseudoOp(c.op))throw new De(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let u=this.newRegexp(t);if(u.min=n,u.max=r,u.flags=o,u.subs=[c],this.stack[l-1]=u,this.checkLimits(u),t===_.Op.REPEAT&&(n>=2||r>=2)&&!this.repeatIsValid(u,1e3))throw new De(e.ERR_INVALID_REPEAT_SIZE,i.from(s))}repeatIsValid(t,n){if(t.op===_.Op.REPEAT){let r=t.max;if(r===0)return!0;if(r<0&&(r=t.min),r>n)return!1;r>0&&(n=Math.trunc(n/r))}for(let r of t.subs)if(!this.repeatIsValid(r,n))return!1;return!0}concat(){this.maybeConcat(-1,0);let t=this.popToPseudo();return t.length===0?this.push(this.newRegexp(_.Op.EMPTY_MATCH)):this.push(this.collapse(t,_.Op.CONCAT))}alternate(){let t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),t.length===0?this.push(this.newRegexp(_.Op.NO_MATCH)):this.push(this.collapse(t,_.Op.ALTERNATE))}cleanAlt(t){t.op===_.Op.CHAR_CLASS&&(t.runes=new hn(t.runes).cleanClass().toArray(),t.runes.length===2&&t.runes[0]===0&&t.runes[1]===he.MAX_RUNE?(t.runes=[],t.op=_.Op.ANY_CHAR):t.runes.length===4&&t.runes[0]===0&&t.runes[1]===D.CODES.get(`
@@ -178,27 +178,27 @@ Options:
178
178
  `),D.CODES.get(`
179
179
  `)));let a=!0;for(;!t.more()||t.peek()!==D.CODES.get("]")||a;){if(t.more()&&t.lookingAt("-")&&(this.flags&Q.PERL_X)===0&&!a){let u=t.rest();if(u==="-"||!u.startsWith("-]"))throw t.rewindTo(n),new De(e.ERR_INVALID_CHAR_RANGE,t.rest())}a=!1;let o=t.pos();if(t.lookingAt("[:")){if(this.parseNamedClass(t,s))continue;t.rewindTo(o)}if(this.parseUnicodeClass(t,s)||this.parsePerlClassEscape(t,s))continue;t.rewindTo(o);let l=e.parseClassChar(t,n),c=l;if(t.more()&&t.lookingAt("-")){if(t.skip(1),t.more()&&t.lookingAt("]"))t.skip(-1);else if(c=e.parseClassChar(t,n),c<l)throw new De(e.ERR_INVALID_CHAR_RANGE,t.from(o))}(this.flags&Q.FOLD_CASE)===0?s.appendRange(l,c):s.appendFoldedRange(l,c)}t.skip(1),s.cleanClass(),i<0&&s.negateClass(),r.runes=s.toArray(),this.push(r)}},no=class{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}compareAndSet(t,n){return this.value===t?(this.value=n,!0):!1}},ro=class e{static initTest(t){let n=e.compile(t),r=new e(n.expr,n.prog,n.numSubexp,n.longest);return r.cond=n.cond,r.prefix=n.prefix,r.prefixUTF8=n.prefixUTF8,r.prefixComplete=n.prefixComplete,r.prefixRune=n.prefixRune,r}static compile(t){return e.compileImpl(t,Q.PERL,!1)}static compilePOSIX(t){return e.compileImpl(t,Q.POSIX,!0)}static compileImpl(t,n,r){let s=to.parse(t,n),i=s.maxCap();s=Ja.simplify(s);let a=Ya.compileRegexp(s),o=new e(t,a,i,r),[l,c]=a.prefix();return o.prefixComplete=l,o.prefix=c,o.prefixUTF8=Ne.stringToUtf8ByteArray(o.prefix),o.prefix.length>0&&(o.prefixRune=o.prefix.codePointAt(0)),o.namedGroups=s.namedGroups,o}static match(t,n){return e.compile(t).match(n)}constructor(t,n,r=0,s=0){this.expr=t,this.prog=n,this.numSubexp=r,this.longest=s,this.cond=n.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new no}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){let t;do t=this.pooled.get();while(t&&!this.pooled.compareAndSet(t,t.next));return t}reset(){this.pooled.set(null)}put(t,n){let r=this.pooled.get();do r=this.pooled.get(),!n&&r&&(t=os.fromMachine(t),n=!0),t.next!==r&&(t.next=r);while(!this.pooled.compareAndSet(r,t))}toString(){return this.expr}doExecute(t,n,r,s){let i=this.get(),a=!1;i?i.next!==null&&(i=os.fromMachine(i),a=!0):(i=os.fromRE2(this),a=!0),i.init(s);let o=i.match(t,n,r)?i.submatches():null;return this.put(i,a),o}match(t){return this.doExecute(Ge.fromUTF16(t),0,Q.UNANCHORED,0)!==null}matchWithGroup(t,n,r,s,i){return t instanceof Rn||(t=Ar.utf16(t)),this.matchMachineInput(t,n,r,s,i)}matchMachineInput(t,n,r,s,i){if(n>r)return[!1,null];let a=t.isUTF16Encoding()?Ge.fromUTF16(t.asCharSequence(),0,r):Ge.fromUTF8(t.asBytes(),0,r),o=this.doExecute(a,n,s,2*i);return o===null?[!1,null]:[!0,o]}matchUTF8(t){return this.doExecute(Ge.fromUTF8(t),0,Q.UNANCHORED,0)!==null}replaceAll(t,n){return this.replaceAllFunc(t,()=>n,2*t.length+1)}replaceFirst(t,n){return this.replaceAllFunc(t,()=>n,1)}replaceAllFunc(t,n,r){let s=0,i=0,a="",o=Ge.fromUTF16(t),l=0;for(;i<=t.length;){let c=this.doExecute(o,i,Q.UNANCHORED,2);if(c===null||c.length===0)break;a+=t.substring(s,c[0]),(c[1]>s||c[0]===0)&&(a+=n(t.substring(c[0],c[1])),l++),s=c[1];let u=o.step(i)&7;if(i+u>c[1]?i+=u:i+1>c[1]?i++:i=c[1],l>=r)break}return a+=t.substring(s),a}pad(t){if(t===null)return null;let n=(1+this.numSubexp)*2;if(t.length<n){let r=new Array(n).fill(-1);for(let s=0;s<t.length;s++)r[s]=t[s];t=r}return t}allMatches(t,n,r=s=>s){let s=[],i=t.endPos();n<0&&(n=i+1);let a=0,o=0,l=-1;for(;o<n&&a<=i;){let c=this.doExecute(t,a,Q.UNANCHORED,this.prog.numCap);if(c===null||c.length===0)break;let u=!0;if(c[1]===a){c[0]===l&&(u=!1);let f=t.step(a);f<0?a=i+1:a+=f&7}else a=c[1];l=c[1],u&&(s.push(r(this.pad(c))),o++)}return s}findUTF8(t){let n=this.doExecute(Ge.fromUTF8(t),0,Q.UNANCHORED,2);return n===null?null:t.slice(n[0],n[1])}findUTF8Index(t){let n=this.doExecute(Ge.fromUTF8(t),0,Q.UNANCHORED,2);return n===null?null:n.slice(0,2)}find(t){let n=this.doExecute(Ge.fromUTF16(t),0,Q.UNANCHORED,2);return n===null?"":t.substring(n[0],n[1])}findIndex(t){return this.doExecute(Ge.fromUTF16(t),0,Q.UNANCHORED,2)}findUTF8Submatch(t){let n=this.doExecute(Ge.fromUTF8(t),0,Q.UNANCHORED,this.prog.numCap);if(n===null)return null;let r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<n.length&&n[2*s]>=0&&(r[s]=t.slice(n[2*s],n[2*s+1]));return r}findUTF8SubmatchIndex(t){return this.pad(this.doExecute(Ge.fromUTF8(t),0,Q.UNANCHORED,this.prog.numCap))}findSubmatch(t){let n=this.doExecute(Ge.fromUTF16(t),0,Q.UNANCHORED,this.prog.numCap);if(n===null)return null;let r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<n.length&&n[2*s]>=0&&(r[s]=t.substring(n[2*s],n[2*s+1]));return r}findSubmatchIndex(t){return this.pad(this.doExecute(Ge.fromUTF16(t),0,Q.UNANCHORED,this.prog.numCap))}findAllUTF8(t,n){let r=this.allMatches(Ge.fromUTF8(t),n,s=>t.slice(s[0],s[1]));return r.length===0?null:r}findAllUTF8Index(t,n){let r=this.allMatches(Ge.fromUTF8(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAll(t,n){let r=this.allMatches(Ge.fromUTF16(t),n,s=>t.substring(s[0],s[1]));return r.length===0?null:r}findAllIndex(t,n){let r=this.allMatches(Ge.fromUTF16(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAllUTF8Submatch(t,n){let r=this.allMatches(Ge.fromUTF8(t),n,s=>{let i=new Array(s.length/2|0).fill(null);for(let a=0;a<i.length;a++)s[2*a]>=0&&(i[a]=t.slice(s[2*a],s[2*a+1]));return i});return r.length===0?null:r}findAllUTF8SubmatchIndex(t,n){let r=this.allMatches(Ge.fromUTF8(t),n);return r.length===0?null:r}findAllSubmatch(t,n){let r=this.allMatches(Ge.fromUTF16(t),n,s=>{let i=new Array(s.length/2|0).fill(null);for(let a=0;a<i.length;a++)s[2*a]>=0&&(i[a]=t.substring(s[2*a],s[2*a+1]));return i});return r.length===0?null:r}findAllSubmatchIndex(t,n){let r=this.allMatches(Ge.fromUTF16(t),n);return r.length===0?null:r}},so=class e{static isUpperCaseAlpha(t){return"A"<=t&&t<="Z"}static isHexadecimal(t){return"0"<=t&&t<="9"||"A"<=t&&t<="F"||"a"<=t&&t<="f"}static getUtf8CharSize(t){let n=t.charCodeAt(0);return n<128?1:n<2048?2:n<65536?3:4}static translate(t){if(typeof t!="string")return t;let n="",r=!1,s=t.length;s===0&&(n="(?:)",r=!0);let i=0;for(;i<s;){let a=t[i];if(a==="\\"){if(i+1<s)switch(a=t[i+1],a){case"\\":{n+="\\\\",i+=2;continue}case"c":{if(i+2<s){let l=t[i+2];if(e.isUpperCaseAlpha(l)){n+="\\x",n+=(l.charCodeAt(0)-64>>4).toString(16).toUpperCase(),n+=(l.charCodeAt(0)-64&15).toString(16).toUpperCase(),i+=3,r=!0;continue}}n+="\\c",i+=2;continue}case"u":{if(i+2<s){let l=t[i+2];if(e.isHexadecimal(l)){n+="\\x{"+l,i+=3;for(let c=0;c<3&&i<s&&(l=t[i],!!e.isHexadecimal(l));++i,++c)n+=l;n+="}",r=!0;continue}else if(l==="{"){n+="\\x",i+=2,r=!0;continue}}n+="\\u",i+=2;continue}default:{n+="\\";let l=e.getUtf8CharSize(a);n+=t.substring(i+1,i+1+l),i+=l+1;continue}}}else if(a==="/"){n+="\\/",i+=1,r=!0;continue}else if(a==="("&&i+2<s&&t[i+1]==="?"&&t[i+2]==="<"&&(i+3>=s||t[i+3]!=="="&&t[i+3]!=="!")){n+="(?P<",i+=3,r=!0;continue}let o=e.getUtf8CharSize(a);n+=t.substring(i,i+o),i+=o}return r?n:t}},Tn=class e{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(t){return Ne.quoteMeta(t)}static translateRegExp(t){return so.translate(t)}static compile(t,n=0){let r=t;if((n&e.CASE_INSENSITIVE)!==0&&(r=`(?i)${r}`),(n&e.DOTALL)!==0&&(r=`(?s)${r}`),(n&e.MULTILINE)!==0&&(r=`(?m)${r}`),(n&~(e.MULTILINE|e.DOTALL|e.CASE_INSENSITIVE|e.DISABLE_UNICODE_GROUPS|e.LONGEST_MATCH))!==0)throw new Va("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let s=Q.PERL;(n&e.DISABLE_UNICODE_GROUPS)!==0&&(s&=-129);let i=new e(t,n);return i.re2Input=ro.compileImpl(r,s,(n&e.LONGEST_MATCH)!==0),i}static matches(t,n){return e.compile(t).matcher(n).matches()}static initTest(t,n,r){if(t==null)throw new Error("pattern is null");if(r==null)throw new Error("re2 is null");let s=new e(t,n);return s.re2Input=r,s}constructor(t,n){this.patternInput=t,this.flagsInput=n}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(t){return this.matcher(t).matches()}matcher(t){return Array.isArray(t)&&(t=Ar.utf8(t)),new qa(this,t)}split(t,n=0){let r=this.matcher(t),s=[],i=0,a=0;for(;r.find();){if(a===0&&r.end()===0){a=r.end();continue}if(n>0&&s.length===n-1)break;if(a===r.start()){if(n===0){i+=1,a=r.end();continue}}else for(;i>0;)s.push(""),i-=1;s.push(r.substring(a,r.start())),a=r.end()}if(n===0&&a!==r.inputLength()){for(;i>0;)s.push(""),i-=1;s.push(r.substring(a,r.inputLength()))}return(n!==0||s.length===0)&&s.push(r.substring(a,r.inputLength())),s}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(t){return this===t?!0:t===null||this.constructor!==t.constructor?!1:this.flagsInput===t.flagsInput&&this.patternInput===t.patternInput}}});function Ay(e){let t=0;return e.includes("i")&&(t|=Tn.CASE_INSENSITIVE),e.includes("m")&&(t|=Tn.MULTILINE),e.includes("s")&&(t|=Tn.DOTALL),t}function Sy(e){return Tn.translateRegExp(e)}function V(e,t=""){return new ni(e,t)}var ni,Cn,Uf=I(()=>{"use strict";Mf();ni=class{_re2;_pattern;_flags;_global;_ignoreCase;_multiline;_lastIndex=0;_nativeRegex=null;constructor(t,n=""){this._pattern=t,this._flags=n,this._global=n.includes("g"),this._ignoreCase=n.includes("i"),this._multiline=n.includes("m");try{let r=Sy(t),s=Ay(n);this._re2=Tn.compile(r,s)}catch(r){if(r instanceof De){let s=r.message||"",i="";throw s.includes("(?=")||s.includes("(?!")||s.includes("(?<")||s.includes("(?<!")||t.includes("(?=")||t.includes("(?!")||t.includes("(?<=")||t.includes("(?<!")?i=" Lookahead (?=, ?!) and lookbehind (?<=, ?<!) assertions are not supported in this environment because the regex engine uses RE2 for ReDoS protection. RE2 guarantees linear-time matching but cannot support these features.":(s.includes("backreference")||/\\[1-9]/.test(t))&&(i=" Backreferences (\\1, \\2, etc.) are not supported in this environment because the regex engine uses RE2 for ReDoS protection. RE2 guarantees linear-time matching but cannot support backreferences."),new SyntaxError(`Invalid regular expression: /${t}/: ${s}${i}`)}throw r}}test(t){return this._global&&(this._lastIndex=0),this._re2.matcher(t).find()}exec(t){let n=this._re2.matcher(t),r=this._global?this._lastIndex:0;if(!n.find(r))return this._global&&(this._lastIndex=0),null;let s=this._re2.groupCount(),i=[];i.push(n.group(0)??"");for(let l=1;l<=s;l++){let c=n.group(l);i.push(c)}let a=i;a.index=n.start(0),a.input=t;let o=this._re2.namedGroups();if(o&&Object.keys(o).length>0){let l=Object.create(null);for(let[c,u]of Object.entries(o)){let f=n.group(u);f!==null&&(l[c]=f)}a.groups=l}return this._global&&(this._lastIndex=n.end(0),n.start(0)===n.end(0)&&this._lastIndex++),a}match(t){if(this._global&&(this._lastIndex=0),!this._global)return this.exec(t);let n=[],r=this._re2.matcher(t),s=0;for(;r.find(s);){let i=r.group(0)??"";if(n.push(i),s=r.end(0),r.start(0)===r.end(0)&&s++,s>t.length)break}return n.length>0?n:null}replace(t,n){if(this._global&&(this._lastIndex=0),typeof n=="string"){let c=this._re2.matcher(t);return this._global?c.replaceAll(n,!0):c.replaceFirst(n,!0)}let r=[],s=this._re2.matcher(t),i=0,a=0,o=this._re2.groupCount(),l=this._re2.namedGroups();for(;s.find(a);){r.push(t.slice(i,s.start(0)));let c=[],u=s.group(0)??"";for(let f=1;f<=o;f++)c.push(s.group(f));if(c.push(s.start(0)),c.push(t),l&&Object.keys(l).length>0){let f=Object.create(null);for(let[p,h]of Object.entries(l))f[p]=s.group(h)??"";c.push(f)}if(r.push(n(u,...c)),i=s.end(0),a=i,s.start(0)===s.end(0)&&a++,!this._global||a>t.length)break}return r.push(t.slice(i)),r.join("")}split(t,n){return n===void 0||n<0?this._re2.split(t,-1):n===0?[]:this._re2.split(t,-1).slice(0,n)}search(t){let n=this._re2.matcher(t);return n.find()?n.start(0):-1}*matchAll(t){if(!this._global)throw new Error("matchAll requires global flag");this._lastIndex=0;let n=this._re2.matcher(t),r=this._re2.groupCount(),s=this._re2.namedGroups(),i=0;for(;n.find(i);){let a=[];a.push(n.group(0)??"");for(let l=1;l<=r;l++)a.push(n.group(l));let o=a;if(o.index=n.start(0),o.input=t,s&&Object.keys(s).length>0){let l=Object.create(null);for(let[c,u]of Object.entries(s)){let f=n.group(u);f!==null&&(l[c]=f)}o.groups=l}if(yield o,i=n.end(0),n.start(0)===n.end(0)&&i++,i>t.length)break}}get native(){if(!this._nativeRegex)try{this._nativeRegex=new RegExp(this._pattern,this._flags)}catch{this._nativeRegex=new RegExp("",this._flags),Object.defineProperty(this._nativeRegex,"source",{value:this._pattern,writable:!1})}return this._nativeRegex}get source(){return this._pattern}get flags(){return this._flags}get global(){return this._global}get ignoreCase(){return this._ignoreCase}get multiline(){return this._multiline}get lastIndex(){return this._lastIndex}set lastIndex(t){this._lastIndex=t}};Cn=class{_regex;constructor(t){this._regex=t}test(t){return this._regex.global&&(this._regex.lastIndex=0),this._regex.test(t)}exec(t){return this._regex.exec(t)}match(t){return this._regex.global&&(this._regex.lastIndex=0),t.match(this._regex)}replace(t,n){return this._regex.global&&(this._regex.lastIndex=0),t.replace(this._regex,n)}split(t,n){return t.split(this._regex,n)}search(t){return t.search(this._regex)}*matchAll(t){if(!this._regex.global)throw new Error("matchAll requires global flag");this._regex.lastIndex=0;let n=this._regex.exec(t);for(;n!==null;)yield n,n[0].length===0&&this._regex.lastIndex++,n=this._regex.exec(t)}get native(){return this._regex}get source(){return this._regex.source}get flags(){return this._regex.flags}get global(){return this._regex.global}get ignoreCase(){return this._regex.ignoreCase}get multiline(){return this._regex.multiline}get lastIndex(){return this._regex.lastIndex}set lastIndex(t){this._regex.lastIndex=t}}});var Me=I(()=>{"use strict";Uf()});function xt(e,t,n){let r=typeof n=="boolean"?{ignoreCase:n}:n??{},s=t;r.stripQuotes&&(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1));let i=r.ignoreCase?`i:${s}`:s,a=Bf.get(i);return a||(a=Cy(s,r.ignoreCase),Bf.set(i,a)),a.test(e)}function Cy(e,t){let n="^";for(let r=0;r<e.length;r++){let s=e[r];if(s==="*")n+=".*";else if(s==="?")n+=".";else if(s==="["){let i=r+1;for(;i<e.length&&e[i]!=="]";)i++;n+=e.slice(r,i+1),r=i}else s==="."||s==="+"||s==="^"||s==="$"||s==="{"||s==="}"||s==="("||s===")"||s==="|"||s==="\\"?n+=`\\${s}`:n+=s}return n+="$",V(n,t?"i":"")}var Bf,io=I(()=>{"use strict";Me();Bf=new Map});function Wf(e,t){return e.replace(/\$(&|\d+|<([^>]+)>)/g,(n,r,s)=>{if(r==="&")return t[0];if(s!==void 0)return t.groups?.[s]??"";let i=parseInt(r,10);return t[i]??""})}function Cr(e,t,n={}){let{invertMatch:r=!1,showLineNumbers:s=!1,countOnly:i=!1,countMatches:a=!1,filename:o="",onlyMatching:l=!1,beforeContext:c=0,afterContext:u=0,maxCount:f=0,contextSeparator:p="--",showColumn:h=!1,vimgrep:m=!1,showByteOffset:d=!1,replace:g=null,passthru:w=!1,multiline:y=!1,kResetGroup:b}=n;if(y)return Ny(e,t,{invertMatch:r,showLineNumbers:s,countOnly:i,countMatches:a,filename:o,onlyMatching:l,beforeContext:c,afterContext:u,maxCount:f,contextSeparator:p,showColumn:h,showByteOffset:d,replace:g,kResetGroup:b});let x=e.split(`
180
180
  `),S=x.length,$=S>0&&x[S-1]===""?S-1:S;if(i||a){let N=0,P=(a||l)&&!r;for(let T=0;T<$;T++)if(t.lastIndex=0,P)for(let F=t.exec(x[T]);F!==null;F=t.exec(x[T]))N++,F[0].length===0&&t.lastIndex++;else t.test(x[T])!==r&&N++;return{output:`${o?`${o}:${N}`:String(N)}
181
- `,matched:N>0,matchCount:N}}if(c===0&&u===0&&!w){let N=[],P=!1,v=0,T=0;for(let F=0;F<$&&!(f>0&&v>=f);F++){let ue=x[F];if(t.lastIndex=0,t.test(ue)!==r)if(P=!0,v++,l){t.lastIndex=0;for(let te=t.exec(ue);te!==null;te=t.exec(ue)){let H=b!==void 0?te[b]??"":te[0],X=g!==null?Wf(g,te):H,Ee=o?`${o}:`:"";d&&(Ee+=`${T+te.index}:`),s&&(Ee+=`${F+1}:`),h&&(Ee+=`${te.index+1}:`),N.push(Ee+X),te[0].length===0&&t.lastIndex++}}else if(m){t.lastIndex=0;for(let te=t.exec(ue);te!==null;te=t.exec(ue)){let H=o?`${o}:`:"";d&&(H+=`${T+te.index}:`),s&&(H+=`${F+1}:`),h&&(H+=`${te.index+1}:`),N.push(H+ue),te[0].length===0&&t.lastIndex++}}else{t.lastIndex=0;let te=t.exec(ue),H=te?te.index+1:1,X=ue;g!==null&&(t.lastIndex=0,X=t.replace(ue,(...ae)=>{if(ae[0].length===0)return"";let j=ae,ve=ae[ae.length-1];return typeof ve=="object"&&ve!==null?(j.groups=ve,j.input=ae[ae.length-2],j.index=ae[ae.length-3]):(j.input=ae[ae.length-1],j.index=ae[ae.length-2]),Wf(g,j)}));let Ee=o?`${o}:`:"";d&&(Ee+=`${T+(te?te.index:0)}:`),s&&(Ee+=`${F+1}:`),h&&(Ee+=`${H}:`),N.push(Ee+X)}T+=ue.length+1}return{output:N.length>0?`${N.join(`
181
+ `,matched:N>0,matchCount:N}}if(c===0&&u===0&&!w){let N=[],P=!1,k=0,T=0;for(let F=0;F<$&&!(f>0&&k>=f);F++){let ue=x[F];if(t.lastIndex=0,t.test(ue)!==r)if(P=!0,k++,l){t.lastIndex=0;for(let te=t.exec(ue);te!==null;te=t.exec(ue)){let H=b!==void 0?te[b]??"":te[0],X=g!==null?Wf(g,te):H,Ee=o?`${o}:`:"";d&&(Ee+=`${T+te.index}:`),s&&(Ee+=`${F+1}:`),h&&(Ee+=`${te.index+1}:`),N.push(Ee+X),te[0].length===0&&t.lastIndex++}}else if(m){t.lastIndex=0;for(let te=t.exec(ue);te!==null;te=t.exec(ue)){let H=o?`${o}:`:"";d&&(H+=`${T+te.index}:`),s&&(H+=`${F+1}:`),h&&(H+=`${te.index+1}:`),N.push(H+ue),te[0].length===0&&t.lastIndex++}}else{t.lastIndex=0;let te=t.exec(ue),H=te?te.index+1:1,X=ue;g!==null&&(t.lastIndex=0,X=t.replace(ue,(...ae)=>{if(ae[0].length===0)return"";let j=ae,ke=ae[ae.length-1];return typeof ke=="object"&&ke!==null?(j.groups=ke,j.input=ae[ae.length-2],j.index=ae[ae.length-3]):(j.input=ae[ae.length-1],j.index=ae[ae.length-2]),Wf(g,j)}));let Ee=o?`${o}:`:"";d&&(Ee+=`${T+(te?te.index:0)}:`),s&&(Ee+=`${F+1}:`),h&&(Ee+=`${H}:`),N.push(Ee+X)}T+=ue.length+1}return{output:N.length>0?`${N.join(`
182
182
  `)}
183
- `:"",matched:P,matchCount:v}}if(w){let N=[],P=!1,v=0;for(let T=0;T<$;T++){let F=x[T];t.lastIndex=0;let re=t.test(F)!==r;re&&(P=!0,v++);let te=re?":":"-",H=o?`${o}${te}`:"";s&&(H+=`${T+1}${te}`),N.push(H+F)}return{output:N.length>0?`${N.join(`
183
+ `:"",matched:P,matchCount:k}}if(w){let N=[],P=!1,k=0;for(let T=0;T<$;T++){let F=x[T];t.lastIndex=0;let re=t.test(F)!==r;re&&(P=!0,k++);let te=re?":":"-",H=o?`${o}${te}`:"";s&&(H+=`${T+1}${te}`),N.push(H+F)}return{output:N.length>0?`${N.join(`
184
184
  `)}
185
- `:"",matched:P,matchCount:v}}let O=[],L=0,R=new Set,W=-1,k=[];for(let N=0;N<$&&!(f>0&&L>=f);N++)t.lastIndex=0,t.test(x[N])!==r&&(k.push(N),L++);for(let N of k){let P=Math.max(0,N-c);W>=0&&P>W+1&&O.push(p);for(let T=P;T<N;T++)if(!R.has(T)){R.add(T),W=T;let F=x[T];s&&(F=`${T+1}-${F}`),o&&(F=`${o}-${F}`),O.push(F)}if(!R.has(N)){R.add(N),W=N;let T=x[N];if(l){t.lastIndex=0;for(let F=t.exec(T);F!==null;F=t.exec(T)){let ue=b!==void 0?F[b]??"":F[0],re=g!==null?g:ue,te=o?`${o}:`:"";s&&(te+=`${N+1}:`),h&&(te+=`${F.index+1}:`),O.push(te+re),F[0].length===0&&t.lastIndex++}}else{let F=T;s&&(F=`${N+1}:${F}`),o&&(F=`${o}:${F}`),O.push(F)}}let v=Math.min($-1,N+u);for(let T=N+1;T<=v;T++)if(!R.has(T)){R.add(T),W=T;let F=x[T];s&&(F=`${T+1}-${F}`),o&&(F=`${o}-${F}`),O.push(F)}}return{output:O.length>0?`${O.join(`
185
+ `:"",matched:P,matchCount:k}}let O=[],L=0,R=new Set,W=-1,v=[];for(let N=0;N<$&&!(f>0&&L>=f);N++)t.lastIndex=0,t.test(x[N])!==r&&(v.push(N),L++);for(let N of v){let P=Math.max(0,N-c);W>=0&&P>W+1&&O.push(p);for(let T=P;T<N;T++)if(!R.has(T)){R.add(T),W=T;let F=x[T];s&&(F=`${T+1}-${F}`),o&&(F=`${o}-${F}`),O.push(F)}if(!R.has(N)){R.add(N),W=N;let T=x[N];if(l){t.lastIndex=0;for(let F=t.exec(T);F!==null;F=t.exec(T)){let ue=b!==void 0?F[b]??"":F[0],re=g!==null?g:ue,te=o?`${o}:`:"";s&&(te+=`${N+1}:`),h&&(te+=`${F.index+1}:`),O.push(te+re),F[0].length===0&&t.lastIndex++}}else{let F=T;s&&(F=`${N+1}:${F}`),o&&(F=`${o}:${F}`),O.push(F)}}let k=Math.min($-1,N+u);for(let T=N+1;T<=k;T++)if(!R.has(T)){R.add(T),W=T;let F=x[T];s&&(F=`${T+1}-${F}`),o&&(F=`${o}-${F}`),O.push(F)}}return{output:O.length>0?`${O.join(`
186
186
  `)}
187
187
  `:"",matched:L>0,matchCount:L}}function Ny(e,t,n){let{invertMatch:r,showLineNumbers:s,countOnly:i,countMatches:a,filename:o,onlyMatching:l,beforeContext:c,afterContext:u,maxCount:f,contextSeparator:p,showColumn:h,showByteOffset:m,replace:d,kResetGroup:g}=n,w=e.split(`
188
- `),y=w.length,b=y>0&&w[y-1]===""?y-1:y,x=[0];for(let k=0;k<e.length;k++)e[k]===`
189
- `&&x.push(k+1);let S=k=>{let N=0;for(let P=0;P<x.length&&!(x[P]>k);P++)N=P;return N},$=k=>{let N=S(k);return k-x[N]+1},O=[];t.lastIndex=0;for(let k=t.exec(e);k!==null&&!(f>0&&O.length>=f);k=t.exec(e)){let N=S(k.index),P=S(k.index+Math.max(0,k[0].length-1)),v=g!==void 0?k[g]??"":k[0];O.push({startLine:N,endLine:P,byteOffset:k.index,column:$(k.index),matchText:v}),k[0].length===0&&t.lastIndex++}if(i||a){let k;if(a)k=r?0:O.length;else{let P=new Set;for(let v of O)for(let T=v.startLine;T<=v.endLine;T++)P.add(T);k=r?b-P.size:P.size}return{output:`${o?`${o}:${k}`:String(k)}
190
- `,matched:k>0,matchCount:k}}if(r){let k=new Set;for(let P of O)for(let v=P.startLine;v<=P.endLine;v++)k.add(v);let N=[];for(let P=0;P<b;P++)if(!k.has(P)){let v=w[P];s&&(v=`${P+1}:${v}`),o&&(v=`${o}:${v}`),N.push(v)}return{output:N.length>0?`${N.join(`
188
+ `),y=w.length,b=y>0&&w[y-1]===""?y-1:y,x=[0];for(let v=0;v<e.length;v++)e[v]===`
189
+ `&&x.push(v+1);let S=v=>{let N=0;for(let P=0;P<x.length&&!(x[P]>v);P++)N=P;return N},$=v=>{let N=S(v);return v-x[N]+1},O=[];t.lastIndex=0;for(let v=t.exec(e);v!==null&&!(f>0&&O.length>=f);v=t.exec(e)){let N=S(v.index),P=S(v.index+Math.max(0,v[0].length-1)),k=g!==void 0?v[g]??"":v[0];O.push({startLine:N,endLine:P,byteOffset:v.index,column:$(v.index),matchText:k}),v[0].length===0&&t.lastIndex++}if(i||a){let v;if(a)v=r?0:O.length;else{let P=new Set;for(let k of O)for(let T=k.startLine;T<=k.endLine;T++)P.add(T);v=r?b-P.size:P.size}return{output:`${o?`${o}:${v}`:String(v)}
190
+ `,matched:v>0,matchCount:v}}if(r){let v=new Set;for(let P of O)for(let k=P.startLine;k<=P.endLine;k++)v.add(k);let N=[];for(let P=0;P<b;P++)if(!v.has(P)){let k=w[P];s&&(k=`${P+1}:${k}`),o&&(k=`${o}:${k}`),N.push(k)}return{output:N.length>0?`${N.join(`
191
191
  `)}
192
- `:"",matched:N.length>0,matchCount:N.length}}if(O.length===0)return{output:"",matched:!1,matchCount:0};let L=new Set,R=-1,W=[];for(let k of O){let N=Math.max(0,k.startLine-c),P=Math.min(b-1,k.endLine+u);R>=0&&N>R+1&&W.push(p);for(let v=N;v<k.startLine;v++)if(!L.has(v)){L.add(v),R=v;let T=w[v];s&&(T=`${v+1}-${T}`),o&&(T=`${o}-${T}`),W.push(T)}if(l){let v=d!==null?d:k.matchText,T=o?`${o}:`:"";m&&(T+=`${k.byteOffset}:`),s&&(T+=`${k.startLine+1}:`),h&&(T+=`${k.column}:`),W.push(T+v);for(let F=k.startLine;F<=k.endLine;F++)L.add(F),R=F}else for(let v=k.startLine;v<=k.endLine&&v<b;v++)if(!L.has(v)){L.add(v),R=v;let T=w[v];d!==null&&v===k.startLine&&(t.lastIndex=0,T=t.replace(T,d));let F=o?`${o}:`:"";m&&v===k.startLine&&(F+=`${k.byteOffset}:`),s&&(F+=`${v+1}:`),h&&v===k.startLine&&(F+=`${k.column}:`),W.push(F+T)}for(let v=k.endLine+1;v<=P;v++)if(!L.has(v)){L.add(v),R=v;let T=w[v];s&&(T=`${v+1}-${T}`),o&&(T=`${o}-${T}`),W.push(T)}}return{output:W.length>0?`${W.join(`
192
+ `:"",matched:N.length>0,matchCount:N.length}}if(O.length===0)return{output:"",matched:!1,matchCount:0};let L=new Set,R=-1,W=[];for(let v of O){let N=Math.max(0,v.startLine-c),P=Math.min(b-1,v.endLine+u);R>=0&&N>R+1&&W.push(p);for(let k=N;k<v.startLine;k++)if(!L.has(k)){L.add(k),R=k;let T=w[k];s&&(T=`${k+1}-${T}`),o&&(T=`${o}-${T}`),W.push(T)}if(l){let k=d!==null?d:v.matchText,T=o?`${o}:`:"";m&&(T+=`${v.byteOffset}:`),s&&(T+=`${v.startLine+1}:`),h&&(T+=`${v.column}:`),W.push(T+k);for(let F=v.startLine;F<=v.endLine;F++)L.add(F),R=F}else for(let k=v.startLine;k<=v.endLine&&k<b;k++)if(!L.has(k)){L.add(k),R=k;let T=w[k];d!==null&&k===v.startLine&&(t.lastIndex=0,T=t.replace(T,d));let F=o?`${o}:`:"";m&&k===v.startLine&&(F+=`${v.byteOffset}:`),s&&(F+=`${k+1}:`),h&&k===v.startLine&&(F+=`${v.column}:`),W.push(F+T)}for(let k=v.endLine+1;k<=P;k++)if(!L.has(k)){L.add(k),R=k;let T=w[k];s&&(T=`${k+1}-${T}`),o&&(T=`${o}-${T}`),W.push(T)}}return{output:W.length>0?`${W.join(`
193
193
  `)}
194
- `:"",matched:!0,matchCount:O.length}}var zf=I(()=>{"use strict"});function Hf(e){let t="",n=0;for(;n<e.length;){if(e.slice(n,n+7)==="[[:<:]]"){t+="\\b",n+=7;continue}if(e.slice(n,n+7)==="[[:>:]]"){t+="\\b",n+=7;continue}if(e[n]==="["){let r="[";for(n++,n<e.length&&(e[n]==="^"||e[n]==="!")&&(r+="^",n++),n<e.length&&e[n]==="]"&&(r+="\\]",n++);n<e.length&&e[n]!=="]";){if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s),a=ky.get(i);if(a){r+=a,n=s+2;continue}}}if(e[n]==="\\"&&n+1<e.length){r+=e[n]+e[n+1],n+=2;continue}r+=e[n],n++}n<e.length&&e[n]==="]"&&(r+="]",n++),t+=r;continue}if(e[n]==="\\"&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++}return t}function cs(e,t){let n,r;switch(t.mode){case"fixed":n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");break;case"extended":case"perl":{if(n=Hf(e),n=n.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),t.mode==="perl"){n=vy(n),n=Iy(n),n=$y(n);let a=Py(n);n=a.pattern,r=a.kResetGroup}break}default:n=Hf(e),n=Ly(n);break}t.wholeWord&&(n=`\\b(?:${n})\\b`),t.lineRegexp&&(n=`^${n}$`);let s=/\\u\{[0-9A-Fa-f]+\}/.test(n),i="g"+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.multilineDotall?"s":"")+(s?"u":"");return{regex:V(n,i),kResetGroup:r}}function vy(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length&&e[n+1]==="Q"){n+=2;let r="";for(;n<e.length;){if(e[n]==="\\"&&n+1<e.length&&e[n+1]==="E"){n+=2;break}r+=e[n],n++}t+=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}else t+=e[n],n++;return t}function Iy(e){return e.replace(/\\x\{([0-9A-Fa-f]+)\}/g,"\\u{$1}")}function $y(e){let t="",n=0;for(;n<e.length;){if(e[n]==="("&&n+1<e.length&&e[n+1]==="?"){let r=e.slice(n).match(/^\(\?([imsx]*)(-[imsx]*)?(:|$|\))/);if(r){let s=r[1]||"",i=r[2]||"",a=r[3];if(a===":"){let o=n+r[0].length-1,l=Oy(e,n);if(l!==-1){let c=e.slice(o+1,l),u=Ry(c,s,i);t+=`(?:${u})`,n=l+1;continue}}else if(a===")"||a===""){n+=r[0].length;continue}}}t+=e[n],n++}return t}function Oy(e,t){let n=0,r=t;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e[r]==="["){for(r++;r<e.length&&e[r]!=="]";)e[r]==="\\"&&r++,r++;r++;continue}if(e[r]==="(")n++;else if(e[r]===")"&&(n--,n===0))return r;r++}return-1}function Ry(e,t,n){let r=e;return t.includes("i")&&(r=Ty(r)),r}function Ty(e){let t="",n=0;for(;n<e.length;){let r=e[n];if(r==="\\"){n+1<e.length?(t+=r+e[n+1],n+=2):(t+=r,n++);continue}if(r==="["){t+=r,n++,n<e.length&&e[n]==="^"&&(t+=e[n],n++);let s=[];for(;n<e.length&&e[n]!=="]";)if(e[n]==="\\")s.push(e[n]),n++,n<e.length&&(s.push(e[n]),n++);else if(e[n]==="-"&&s.length>0&&n+1<e.length&&e[n+1]!=="]"){let i=s[s.length-1],a=e[n+1];s.push("-"),s.push(a),/[a-z]/.test(i)&&/[a-z]/.test(a)?(s.push(i.toUpperCase()),s.push("-"),s.push(a.toUpperCase())):/[A-Z]/.test(i)&&/[A-Z]/.test(a)&&(s.push(i.toLowerCase()),s.push("-"),s.push(a.toLowerCase())),n+=2}else{let i=e[n];if(s.push(i),/[a-zA-Z]/.test(i)){let a=i===i.toLowerCase()?i.toUpperCase():i.toLowerCase();s.includes(a)||s.push(a)}n++}t+=s.join(""),n<e.length&&(t+=e[n],n++);continue}if(/[a-zA-Z]/.test(r)){let s=r.toLowerCase(),i=r.toUpperCase();t+=`[${i}${s}]`}else t+=r;n++}return t}function Py(e){let t=Dy(e);if(t===-1)return{pattern:e};let n=e.slice(0,t),r=e.slice(t+2),s=_y(n);return{pattern:`(?:${n})(${r})`,kResetGroup:s+1}}function Dy(e){let t=0;for(;t<e.length-1;)if(e[t]==="\\"){if(e[t+1]==="K"){let n=0,r=t-1;for(;r>=0&&e[r]==="\\";)n++,r--;if(n%2===0)return t}t+=2}else t++;return-1}function _y(e){let t=0,n=0;for(;n<e.length;){if(e[n]==="\\"){n+=2;continue}if(e[n]==="["){for(n++;n<e.length&&e[n]!=="]";)e[n]==="\\"&&n++,n++;n++;continue}if(e[n]==="(")if(n+1<e.length&&e[n+1]==="?"){if(n+2<e.length){let r=e[n+2];if(r===":"||r==="="||r==="!"){n++;continue}if(r==="<"&&n+3<e.length){let s=e[n+3];if(s==="="||s==="!"){n++;continue}t++,n++;continue}}}else t++;n++}return t}function ao(e){let t=e.replace(/\$\{0\}|\$0(?![0-9])/g,"$$&");return t=t.replace(/\$\{([^0-9}][^}]*)\}/g,"$$<$1>"),t=t.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)(?![>0-9])/g,"$$<$1>"),t}function Ly(e){let t="",n=0,r=!0,s=0;for(;n<e.length;){let i=e[n];if(i==="["){for(t+=i,n++,n<e.length&&(e[n]==="^"||e[n]==="!")&&(t+=e[n],n++),n<e.length&&e[n]==="]"&&(t+=e[n],n++);n<e.length&&e[n]!=="]";)e[n]==="\\"&&n+1<e.length?(t+=e[n]+e[n+1],n+=2):(t+=e[n],n++);n<e.length&&e[n]==="]"&&(t+=e[n],n++),r=!1;continue}if(i==="\\"&&n+1<e.length){let a=e[n+1];if(a==="|"){t+="|",n+=2,r=!0;continue}if(a==="("){t+="(",n+=2,s++,r=!0;continue}if(a===")"){t+=")",n+=2,s=Math.max(0,s-1),r=!1;continue}if(a==="{"){let l=e.slice(n).match(/^\\{(\d+)(,(\d*)?)?\\}/);if(l){let c=l[1],u=l[2]!==void 0,f=l[3]||"";u?t+=`{${c},${f}}`:t+=`{${c}}`,n+=l[0].length,r=!1;continue}t+="\\{",n+=2,r=!1;continue}if(a==="}"){t+="\\}",n+=2,r=!1;continue}t+=i+a,n+=2,r=!1;continue}if(i==="*"&&r){t+="\\*",n++;continue}if(i==="^"){if(r){t+="^",n++;continue}t+="\\^",n++;continue}if(i==="$"){let a=n===e.length-1,o=n+2<e.length&&e[n+1]==="\\"&&e[n+2]===")";a||o?t+="$":t+="\\$",n++,r=!1;continue}i==="+"||i==="?"||i==="|"||i==="("||i===")"||i==="{"||i==="}"?t+=`\\${i}`:t+=i,n++,r=!1}return t}var ky,jf=I(()=>{"use strict";Me();ky=new Map([["alpha","a-zA-Z"],["digit","0-9"],["alnum","a-zA-Z0-9"],["lower","a-z"],["upper","A-Z"],["xdigit","0-9A-Fa-f"],["space"," \\t\\n\\r\\f\\v"],["blank"," \\t"],["punct","!-/:-@\\[-`{-~"],["graph","!-~"],["print"," -~"],["cntrl","\\x00-\\x1F\\x7F"],["ascii","\\x00-\\x7F"],["word","a-zA-Z0-9_"]])});var oo=I(()=>{"use strict";zf();jf()});var si={};K(si,{egrepCommand:()=>By,egrepFlagsForFuzzing:()=>Hy,fgrepCommand:()=>Uy,fgrepFlagsForFuzzing:()=>zy,flagsForFuzzing:()=>Wy,grepCommand:()=>lo});async function Gf(e,t,n,r){let s=n.fs.resolvePath(n.cwd,e);try{if(!(await n.fs.stat(s)).isDirectory){let o=e.split("/").pop()||"";if(t){let l=t.replace(/^\//,"");xt(o,l,{stripQuotes:!0})&&r.push(e)}return}let a=await n.fs.readdir(s);for(let o of a){let l=e==="."?o:`${e}/${o}`,c=n.fs.resolvePath(n.cwd,l);if((await n.fs.stat(c)).isDirectory)await Gf(l,t,n,r);else if(t){let f=t.replace(/^\//,"");xt(o,f,{stripQuotes:!0})&&r.push(l)}}}catch{}}async function My(e,t){let n=[],r=e.lastIndexOf("/"),s,i;if(r===-1?(s=t.cwd,i=e):(s=e.slice(0,r)||"/",i=e.slice(r+1)),e.includes("**")){let o=[],l=e.split("**"),c=l[0].replace(/\/$/,"")||".",u=l[1]||"";return await Gf(c,u,t,o),o.map(f=>({path:f}))}let a=t.fs.resolvePath(t.cwd,s);try{if(t.fs.readdirWithFileTypes){let o=await t.fs.readdirWithFileTypes(a);for(let l of o)if(xt(l.name,i,{stripQuotes:!0})){let c=r===-1?l.name:`${s}/${l.name}`;n.push({path:c,isFile:l.isFile})}}else{let o=await t.fs.readdir(a);for(let l of o)if(xt(l,i,{stripQuotes:!0})){let c=r===-1?l:`${s}/${l}`;n.push({path:c})}}}catch{}return n.sort((o,l)=>o.path.localeCompare(l.path))}async function ri(e,t,n=[],r=[],s=[],i){let a=t.fs.resolvePath(t.cwd,e),o=[];try{let l,c;if(i!==void 0)l=i,c=!i;else{let f=await t.fs.stat(a);l=f.isFile,c=f.isDirectory}if(l){let f=e.split("/").pop()||e;return r.length>0&&r.some(p=>xt(f,p,{stripQuotes:!0}))?[]:n.length>0&&!n.some(p=>xt(f,p,{stripQuotes:!0}))?[]:[{path:e,isFile:!0}]}if(!c)return[];let u=e.split("/").pop()||e;if(s.length>0&&s.some(f=>xt(u,f,{stripQuotes:!0})))return[];if(t.fs.readdirWithFileTypes){let f=await t.fs.readdirWithFileTypes(a);for(let p of f){if(p.name.startsWith("."))continue;let h=e==="."?p.name:`${e}/${p.name}`,m=await ri(h,t,n,r,s,p.isFile);o.push(...m)}}else{let f=await t.fs.readdir(a);for(let p of f){if(p.startsWith("."))continue;let h=e==="."?p:`${e}/${p}`,m=await ri(h,t,n,r,s);o.push(...m)}}}catch{}return o}var Fy,lo,Uy,By,Wy,zy,Hy,ii=I(()=>{"use strict";io();se();oo();Fy={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",options:["-E, --extended-regexp PATTERN is an extended regular expression","-P, --perl-regexp PATTERN is a Perl regular expression","-F, --fixed-strings PATTERN is a set of newline-separated strings","-i, --ignore-case ignore case distinctions","-v, --invert-match select non-matching lines","-w, --word-regexp match only whole words","-x, --line-regexp match only whole lines","-c, --count print only a count of matching lines","-l, --files-with-matches print only names of files with matches","-L, --files-without-match print names of files with no matches","-m NUM, --max-count=NUM stop after NUM matches","-n, --line-number print line number with output lines","-h, --no-filename suppress the file name prefix on output","-o, --only-matching show only nonempty parts of lines that match","-q, --quiet, --silent suppress all normal output","-r, -R, --recursive search directories recursively","-A NUM print NUM lines of trailing context","-B NUM print NUM lines of leading context","-C NUM print NUM lines of context","-e PATTERN use PATTERN for matching"," --include=GLOB search only files matching GLOB"," --exclude=GLOB skip files matching GLOB"," --exclude-dir=DIR skip directories matching DIR"," --help display this help and exit"]},lo={name:"grep",async execute(e,t){if(U(e))return M(Fy);let n=!1,r=!1,s=!1,i=!1,a=!1,o=!1,l=!1,c=!1,u=!1,f=!1,p=!1,h=!1,m=!1,d=!1,g=!1,w=0,y=0,b=0,x=[],S=[],$=[],O=null,L=[];for(let H=0;H<e.length;H++){let X=e[H];if(X.startsWith("-")&&X!=="-"){if(X==="-e"&&H+1<e.length){O=e[++H];continue}if(X.startsWith("--include=")){x.push(X.slice(10));continue}if(X.startsWith("--exclude=")){S.push(X.slice(10));continue}if(X.startsWith("--exclude-dir=")){$.push(X.slice(14));continue}if(X.startsWith("--max-count=")){w=parseInt(X.slice(12),10);continue}let Ee=X.match(/^-m(\d+)$/);if(Ee){w=parseInt(Ee[1],10);continue}if(X==="-m"&&H+1<e.length){w=parseInt(e[++H],10);continue}let ae=X.match(/^-([ABC])(\d+)$/);if(ae){let j=parseInt(ae[2],10);ae[1]==="A"?b=j:ae[1]==="B"?y=j:ae[1]==="C"&&(y=j,b=j);continue}if((X==="-A"||X==="-B"||X==="-C")&&H+1<e.length){let j=parseInt(e[++H],10);X==="-A"?b=j:X==="-B"?y=j:(y=j,b=j);continue}let ke=X.startsWith("--")?[X]:X.slice(1).split("");for(let j of ke)if(j==="i"||j==="--ignore-case")n=!0;else if(j==="n"||j==="--line-number")r=!0;else if(j==="v"||j==="--invert-match")s=!0;else if(j==="c"||j==="--count")i=!0;else if(j==="l"||j==="--files-with-matches")a=!0;else if(j==="L"||j==="--files-without-match")o=!0;else if(j==="r"||j==="R"||j==="--recursive")l=!0;else if(j==="w"||j==="--word-regexp")c=!0;else if(j==="x"||j==="--line-regexp")u=!0;else if(j==="E"||j==="--extended-regexp")f=!0;else if(j==="P"||j==="--perl-regexp")p=!0;else if(j==="F"||j==="--fixed-strings")h=!0;else if(j==="o"||j==="--only-matching")m=!0;else if(j==="h"||j==="--no-filename")d=!0;else if(j==="q"||j==="--quiet"||j==="--silent")g=!0;else{if(j.startsWith("--"))return Y("grep",j);if(j.length===1)return Y("grep",`-${j}`)}}else O===null?O=X:L.push(X)}if(O===null)return{stdout:"",stderr:`grep: missing pattern
195
- `,exitCode:2};let R=h?"fixed":f?"extended":p?"perl":"basic",W,k;try{let H=cs(O,{mode:R,ignoreCase:n,wholeWord:c,lineRegexp:u});W=H.regex,k=H.kResetGroup}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${O}
196
- `,exitCode:2}}if(L.length===0&&t.stdin!==void 0){let H=Cr(t.stdin,W,{invertMatch:s,showLineNumbers:r,countOnly:i,filename:"",onlyMatching:m,beforeContext:y,afterContext:b,maxCount:w,kResetGroup:k});return g?{stdout:"",stderr:"",exitCode:H.matched?0:1}:{stdout:H.output,stderr:"",exitCode:H.matched?0:1}}if(L.length===0)return{stdout:"",stderr:`grep: no input files
197
- `,exitCode:2};let N="",P="",v=!1,T=!1,F=[];for(let H of L)if(H.includes("*")||H.includes("?")||H.includes("[")){let X=await My(H,t);if(l)for(let Ee of X){let ae=await ri(Ee.path,t,x,S,$,Ee.isFile);F.push(...ae)}else F.push(...X)}else if(l){let X=await ri(H,t,x,S,$);F.push(...X)}else F.push({path:H});let ue=(F.length>1||l)&&!d,re=50;for(let H=0;H<F.length;H+=re){let X=F.slice(H,H+re),Ee=await Promise.all(X.map(async ae=>{let ke=ae.path,j=ke.split("/").pop()||ke;if(S.length>0&&!l&&S.some(ve=>xt(j,ve,{stripQuotes:!0}))||x.length>0&&!l&&!x.some(ve=>xt(j,ve,{stripQuotes:!0})))return null;try{let ve=t.fs.resolvePath(t.cwd,ke),Fe=!1;if(ae.isFile===void 0?Fe=(await t.fs.stat(ve)).isDirectory:Fe=!ae.isFile,Fe)return l?null:{error:`grep: ${ke}: Is a directory
198
- `};let je=await t.fs.readFile(ve),et=Cr(je,W,{invertMatch:s,showLineNumbers:r,countOnly:i,filename:ue?ke:"",onlyMatching:m,beforeContext:y,afterContext:b,maxCount:w,kResetGroup:k});return{file:ke,result:et}}catch{return{error:`grep: ${ke}: No such file or directory
199
- `}}}));for(let ae of Ee){if(ae===null)continue;if("error"in ae&&ae.error){P+=ae.error,ae.error.includes("Is a directory")||(T=!0);continue}if(!("file"in ae)||!ae.result)continue;let{file:ke,result:j}=ae;if(j.matched){if(v=!0,g)return{stdout:"",stderr:"",exitCode:0};a?N+=`${ke}
200
- `:o||(N+=j.output)}else o?N+=`${ke}
201
- `:i&&!a&&(N+=j.output)}}let te;return T?te=2:o?te=N.length>0?0:1:te=v?0:1,g?{stdout:"",stderr:"",exitCode:te}:{stdout:N,stderr:P,exitCode:te}}};Uy={name:"fgrep",async execute(e,t){return lo.execute(["-F",...e],t)}},By={name:"egrep",async execute(e,t){return lo.execute(["-E",...e],t)}},Wy={name:"grep",flags:[{flag:"-E",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-P",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-L",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-m",type:"value",valueHint:"number"},{flag:"-A",type:"value",valueHint:"number"},{flag:"-B",type:"value",valueHint:"number"},{flag:"-C",type:"value",valueHint:"number"},{flag:"-e",type:"value",valueHint:"pattern"}],stdinType:"text",needsArgs:!0},zy={name:"fgrep",flags:[],stdinType:"text",needsArgs:!0},Hy={name:"egrep",flags:[],stdinType:"text",needsArgs:!0}});function qf(){let e=[];for(let[t,n]of Object.entries(Vf).sort()){let r=[];for(let s of n.extensions)r.push(`*${s}`);for(let s of n.globs)r.push(s);e.push(`${t}: ${r.join(", ")}`)}return`${e.join(`
194
+ `:"",matched:!0,matchCount:O.length}}var zf=I(()=>{"use strict"});function Hf(e){let t="",n=0;for(;n<e.length;){if(e.slice(n,n+7)==="[[:<:]]"){t+="\\b",n+=7;continue}if(e.slice(n,n+7)==="[[:>:]]"){t+="\\b",n+=7;continue}if(e[n]==="["){let r="[";for(n++,n<e.length&&(e[n]==="^"||e[n]==="!")&&(r+="^",n++),n<e.length&&e[n]==="]"&&(r+="\\]",n++);n<e.length&&e[n]!=="]";){if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s),a=vy.get(i);if(a){r+=a,n=s+2;continue}}}if(e[n]==="\\"&&n+1<e.length){r+=e[n]+e[n+1],n+=2;continue}r+=e[n],n++}n<e.length&&e[n]==="]"&&(r+="]",n++),t+=r;continue}if(e[n]==="\\"&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++}return t}function cs(e,t){let n,r;switch(t.mode){case"fixed":n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");break;case"extended":case"perl":{if(n=Hf(e),n=n.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),t.mode==="perl"){n=ky(n),n=Iy(n),n=$y(n);let a=Py(n);n=a.pattern,r=a.kResetGroup}break}default:n=Hf(e),n=Ly(n);break}t.wholeWord&&(n=`\\b(?:${n})\\b`),t.lineRegexp&&(n=`^${n}$`);let s=/\\u\{[0-9A-Fa-f]+\}/.test(n),i="g"+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.multilineDotall?"s":"")+(s?"u":"");return{regex:V(n,i),kResetGroup:r}}function ky(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length&&e[n+1]==="Q"){n+=2;let r="";for(;n<e.length;){if(e[n]==="\\"&&n+1<e.length&&e[n+1]==="E"){n+=2;break}r+=e[n],n++}t+=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}else t+=e[n],n++;return t}function Iy(e){return e.replace(/\\x\{([0-9A-Fa-f]+)\}/g,"\\u{$1}")}function $y(e){let t="",n=0;for(;n<e.length;){if(e[n]==="("&&n+1<e.length&&e[n+1]==="?"){let r=e.slice(n).match(/^\(\?([imsx]*)(-[imsx]*)?(:|$|\))/);if(r){let s=r[1]||"",i=r[2]||"",a=r[3];if(a===":"){let o=n+r[0].length-1,l=Oy(e,n);if(l!==-1){let c=e.slice(o+1,l),u=Ry(c,s,i);t+=`(?:${u})`,n=l+1;continue}}else if(a===")"||a===""){n+=r[0].length;continue}}}t+=e[n],n++}return t}function Oy(e,t){let n=0,r=t;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e[r]==="["){for(r++;r<e.length&&e[r]!=="]";)e[r]==="\\"&&r++,r++;r++;continue}if(e[r]==="(")n++;else if(e[r]===")"&&(n--,n===0))return r;r++}return-1}function Ry(e,t,n){let r=e;return t.includes("i")&&(r=Ty(r)),r}function Ty(e){let t="",n=0;for(;n<e.length;){let r=e[n];if(r==="\\"){n+1<e.length?(t+=r+e[n+1],n+=2):(t+=r,n++);continue}if(r==="["){t+=r,n++,n<e.length&&e[n]==="^"&&(t+=e[n],n++);let s=[];for(;n<e.length&&e[n]!=="]";)if(e[n]==="\\")s.push(e[n]),n++,n<e.length&&(s.push(e[n]),n++);else if(e[n]==="-"&&s.length>0&&n+1<e.length&&e[n+1]!=="]"){let i=s[s.length-1],a=e[n+1];s.push("-"),s.push(a),/[a-z]/.test(i)&&/[a-z]/.test(a)?(s.push(i.toUpperCase()),s.push("-"),s.push(a.toUpperCase())):/[A-Z]/.test(i)&&/[A-Z]/.test(a)&&(s.push(i.toLowerCase()),s.push("-"),s.push(a.toLowerCase())),n+=2}else{let i=e[n];if(s.push(i),/[a-zA-Z]/.test(i)){let a=i===i.toLowerCase()?i.toUpperCase():i.toLowerCase();s.includes(a)||s.push(a)}n++}t+=s.join(""),n<e.length&&(t+=e[n],n++);continue}if(/[a-zA-Z]/.test(r)){let s=r.toLowerCase(),i=r.toUpperCase();t+=`[${i}${s}]`}else t+=r;n++}return t}function Py(e){let t=Dy(e);if(t===-1)return{pattern:e};let n=e.slice(0,t),r=e.slice(t+2),s=_y(n);return{pattern:`(?:${n})(${r})`,kResetGroup:s+1}}function Dy(e){let t=0;for(;t<e.length-1;)if(e[t]==="\\"){if(e[t+1]==="K"){let n=0,r=t-1;for(;r>=0&&e[r]==="\\";)n++,r--;if(n%2===0)return t}t+=2}else t++;return-1}function _y(e){let t=0,n=0;for(;n<e.length;){if(e[n]==="\\"){n+=2;continue}if(e[n]==="["){for(n++;n<e.length&&e[n]!=="]";)e[n]==="\\"&&n++,n++;n++;continue}if(e[n]==="(")if(n+1<e.length&&e[n+1]==="?"){if(n+2<e.length){let r=e[n+2];if(r===":"||r==="="||r==="!"){n++;continue}if(r==="<"&&n+3<e.length){let s=e[n+3];if(s==="="||s==="!"){n++;continue}t++,n++;continue}}}else t++;n++}return t}function ao(e){let t=e.replace(/\$\{0\}|\$0(?![0-9])/g,"$$&");return t=t.replace(/\$\{([^0-9}][^}]*)\}/g,"$$<$1>"),t=t.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)(?![>0-9])/g,"$$<$1>"),t}function Ly(e){let t="",n=0,r=!0,s=0;for(;n<e.length;){let i=e[n];if(i==="["){for(t+=i,n++,n<e.length&&(e[n]==="^"||e[n]==="!")&&(t+=e[n],n++),n<e.length&&e[n]==="]"&&(t+=e[n],n++);n<e.length&&e[n]!=="]";)e[n]==="\\"&&n+1<e.length?(t+=e[n]+e[n+1],n+=2):(t+=e[n],n++);n<e.length&&e[n]==="]"&&(t+=e[n],n++),r=!1;continue}if(i==="\\"&&n+1<e.length){let a=e[n+1];if(a==="|"){t+="|",n+=2,r=!0;continue}if(a==="("){t+="(",n+=2,s++,r=!0;continue}if(a===")"){t+=")",n+=2,s=Math.max(0,s-1),r=!1;continue}if(a==="{"){let l=e.slice(n).match(/^\\{(\d+)(,(\d*)?)?\\}/);if(l){let c=l[1],u=l[2]!==void 0,f=l[3]||"";u?t+=`{${c},${f}}`:t+=`{${c}}`,n+=l[0].length,r=!1;continue}t+="\\{",n+=2,r=!1;continue}if(a==="}"){t+="\\}",n+=2,r=!1;continue}t+=i+a,n+=2,r=!1;continue}if(i==="*"&&r){t+="\\*",n++;continue}if(i==="^"){if(r){t+="^",n++;continue}t+="\\^",n++;continue}if(i==="$"){let a=n===e.length-1,o=n+2<e.length&&e[n+1]==="\\"&&e[n+2]===")";a||o?t+="$":t+="\\$",n++,r=!1;continue}i==="+"||i==="?"||i==="|"||i==="("||i===")"||i==="{"||i==="}"?t+=`\\${i}`:t+=i,n++,r=!1}return t}var vy,jf=I(()=>{"use strict";Me();vy=new Map([["alpha","a-zA-Z"],["digit","0-9"],["alnum","a-zA-Z0-9"],["lower","a-z"],["upper","A-Z"],["xdigit","0-9A-Fa-f"],["space"," \\t\\n\\r\\f\\v"],["blank"," \\t"],["punct","!-/:-@\\[-`{-~"],["graph","!-~"],["print"," -~"],["cntrl","\\x00-\\x1F\\x7F"],["ascii","\\x00-\\x7F"],["word","a-zA-Z0-9_"]])});var oo=I(()=>{"use strict";zf();jf()});var si={};K(si,{egrepCommand:()=>By,egrepFlagsForFuzzing:()=>Hy,fgrepCommand:()=>Uy,fgrepFlagsForFuzzing:()=>zy,flagsForFuzzing:()=>Wy,grepCommand:()=>lo});async function Gf(e,t,n,r){let s=n.fs.resolvePath(n.cwd,e);try{if(!(await n.fs.stat(s)).isDirectory){let o=e.split("/").pop()||"";if(t){let l=t.replace(/^\//,"");xt(o,l,{stripQuotes:!0})&&r.push(e)}return}let a=await n.fs.readdir(s);for(let o of a){let l=e==="."?o:`${e}/${o}`,c=n.fs.resolvePath(n.cwd,l);if((await n.fs.stat(c)).isDirectory)await Gf(l,t,n,r);else if(t){let f=t.replace(/^\//,"");xt(o,f,{stripQuotes:!0})&&r.push(l)}}}catch{}}async function My(e,t){let n=[],r=e.lastIndexOf("/"),s,i;if(r===-1?(s=t.cwd,i=e):(s=e.slice(0,r)||"/",i=e.slice(r+1)),e.includes("**")){let o=[],l=e.split("**"),c=l[0].replace(/\/$/,"")||".",u=l[1]||"";return await Gf(c,u,t,o),o.map(f=>({path:f}))}let a=t.fs.resolvePath(t.cwd,s);try{if(t.fs.readdirWithFileTypes){let o=await t.fs.readdirWithFileTypes(a);for(let l of o)if(xt(l.name,i,{stripQuotes:!0})){let c=r===-1?l.name:`${s}/${l.name}`;n.push({path:c,isFile:l.isFile})}}else{let o=await t.fs.readdir(a);for(let l of o)if(xt(l,i,{stripQuotes:!0})){let c=r===-1?l:`${s}/${l}`;n.push({path:c})}}}catch{}return n.sort((o,l)=>o.path.localeCompare(l.path))}async function ri(e,t,n=[],r=[],s=[],i){let a=t.fs.resolvePath(t.cwd,e),o=[];try{let l,c;if(i!==void 0)l=i,c=!i;else{let f=await t.fs.stat(a);l=f.isFile,c=f.isDirectory}if(l){let f=e.split("/").pop()||e;return r.length>0&&r.some(p=>xt(f,p,{stripQuotes:!0}))?[]:n.length>0&&!n.some(p=>xt(f,p,{stripQuotes:!0}))?[]:[{path:e,isFile:!0}]}if(!c)return[];let u=e.split("/").pop()||e;if(s.length>0&&s.some(f=>xt(u,f,{stripQuotes:!0})))return[];if(t.fs.readdirWithFileTypes){let f=await t.fs.readdirWithFileTypes(a);for(let p of f){if(p.name.startsWith("."))continue;let h=e==="."?p.name:`${e}/${p.name}`,m=await ri(h,t,n,r,s,p.isFile);o.push(...m)}}else{let f=await t.fs.readdir(a);for(let p of f){if(p.startsWith("."))continue;let h=e==="."?p:`${e}/${p}`,m=await ri(h,t,n,r,s);o.push(...m)}}}catch{}return o}var Fy,lo,Uy,By,Wy,zy,Hy,ii=I(()=>{"use strict";io();se();oo();Fy={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",options:["-E, --extended-regexp PATTERN is an extended regular expression","-P, --perl-regexp PATTERN is a Perl regular expression","-F, --fixed-strings PATTERN is a set of newline-separated strings","-i, --ignore-case ignore case distinctions","-v, --invert-match select non-matching lines","-w, --word-regexp match only whole words","-x, --line-regexp match only whole lines","-c, --count print only a count of matching lines","-l, --files-with-matches print only names of files with matches","-L, --files-without-match print names of files with no matches","-m NUM, --max-count=NUM stop after NUM matches","-n, --line-number print line number with output lines","-h, --no-filename suppress the file name prefix on output","-o, --only-matching show only nonempty parts of lines that match","-q, --quiet, --silent suppress all normal output","-r, -R, --recursive search directories recursively","-A NUM print NUM lines of trailing context","-B NUM print NUM lines of leading context","-C NUM print NUM lines of context","-e PATTERN use PATTERN for matching"," --include=GLOB search only files matching GLOB"," --exclude=GLOB skip files matching GLOB"," --exclude-dir=DIR skip directories matching DIR"," --help display this help and exit"]},lo={name:"grep",async execute(e,t){if(U(e))return M(Fy);let n=!1,r=!1,s=!1,i=!1,a=!1,o=!1,l=!1,c=!1,u=!1,f=!1,p=!1,h=!1,m=!1,d=!1,g=!1,w=0,y=0,b=0,x=[],S=[],$=[],O=null,L=[];for(let H=0;H<e.length;H++){let X=e[H];if(X.startsWith("-")&&X!=="-"){if(X==="-e"&&H+1<e.length){O=e[++H];continue}if(X.startsWith("--include=")){x.push(X.slice(10));continue}if(X.startsWith("--exclude=")){S.push(X.slice(10));continue}if(X.startsWith("--exclude-dir=")){$.push(X.slice(14));continue}if(X.startsWith("--max-count=")){w=parseInt(X.slice(12),10);continue}let Ee=X.match(/^-m(\d+)$/);if(Ee){w=parseInt(Ee[1],10);continue}if(X==="-m"&&H+1<e.length){w=parseInt(e[++H],10);continue}let ae=X.match(/^-([ABC])(\d+)$/);if(ae){let j=parseInt(ae[2],10);ae[1]==="A"?b=j:ae[1]==="B"?y=j:ae[1]==="C"&&(y=j,b=j);continue}if((X==="-A"||X==="-B"||X==="-C")&&H+1<e.length){let j=parseInt(e[++H],10);X==="-A"?b=j:X==="-B"?y=j:(y=j,b=j);continue}let ve=X.startsWith("--")?[X]:X.slice(1).split("");for(let j of ve)if(j==="i"||j==="--ignore-case")n=!0;else if(j==="n"||j==="--line-number")r=!0;else if(j==="v"||j==="--invert-match")s=!0;else if(j==="c"||j==="--count")i=!0;else if(j==="l"||j==="--files-with-matches")a=!0;else if(j==="L"||j==="--files-without-match")o=!0;else if(j==="r"||j==="R"||j==="--recursive")l=!0;else if(j==="w"||j==="--word-regexp")c=!0;else if(j==="x"||j==="--line-regexp")u=!0;else if(j==="E"||j==="--extended-regexp")f=!0;else if(j==="P"||j==="--perl-regexp")p=!0;else if(j==="F"||j==="--fixed-strings")h=!0;else if(j==="o"||j==="--only-matching")m=!0;else if(j==="h"||j==="--no-filename")d=!0;else if(j==="q"||j==="--quiet"||j==="--silent")g=!0;else{if(j.startsWith("--"))return Y("grep",j);if(j.length===1)return Y("grep",`-${j}`)}}else O===null?O=X:L.push(X)}if(O===null)return{stdout:"",stderr:`grep: missing pattern
195
+ `,exitCode:2};let R=h?"fixed":f?"extended":p?"perl":"basic",W,v;try{let H=cs(O,{mode:R,ignoreCase:n,wholeWord:c,lineRegexp:u});W=H.regex,v=H.kResetGroup}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${O}
196
+ `,exitCode:2}}if(L.length===0&&t.stdin!==void 0){let H=Cr(t.stdin,W,{invertMatch:s,showLineNumbers:r,countOnly:i,filename:"",onlyMatching:m,beforeContext:y,afterContext:b,maxCount:w,kResetGroup:v});return g?{stdout:"",stderr:"",exitCode:H.matched?0:1}:{stdout:H.output,stderr:"",exitCode:H.matched?0:1}}if(L.length===0)return{stdout:"",stderr:`grep: no input files
197
+ `,exitCode:2};let N="",P="",k=!1,T=!1,F=[];for(let H of L)if(H.includes("*")||H.includes("?")||H.includes("[")){let X=await My(H,t);if(l)for(let Ee of X){let ae=await ri(Ee.path,t,x,S,$,Ee.isFile);F.push(...ae)}else F.push(...X)}else if(l){let X=await ri(H,t,x,S,$);F.push(...X)}else F.push({path:H});let ue=(F.length>1||l)&&!d,re=50;for(let H=0;H<F.length;H+=re){let X=F.slice(H,H+re),Ee=await Promise.all(X.map(async ae=>{let ve=ae.path,j=ve.split("/").pop()||ve;if(S.length>0&&!l&&S.some(ke=>xt(j,ke,{stripQuotes:!0}))||x.length>0&&!l&&!x.some(ke=>xt(j,ke,{stripQuotes:!0})))return null;try{let ke=t.fs.resolvePath(t.cwd,ve),Fe=!1;if(ae.isFile===void 0?Fe=(await t.fs.stat(ke)).isDirectory:Fe=!ae.isFile,Fe)return l?null:{error:`grep: ${ve}: Is a directory
198
+ `};let je=await t.fs.readFile(ke),et=Cr(je,W,{invertMatch:s,showLineNumbers:r,countOnly:i,filename:ue?ve:"",onlyMatching:m,beforeContext:y,afterContext:b,maxCount:w,kResetGroup:v});return{file:ve,result:et}}catch{return{error:`grep: ${ve}: No such file or directory
199
+ `}}}));for(let ae of Ee){if(ae===null)continue;if("error"in ae&&ae.error){P+=ae.error,ae.error.includes("Is a directory")||(T=!0);continue}if(!("file"in ae)||!ae.result)continue;let{file:ve,result:j}=ae;if(j.matched){if(k=!0,g)return{stdout:"",stderr:"",exitCode:0};a?N+=`${ve}
200
+ `:o||(N+=j.output)}else o?N+=`${ve}
201
+ `:i&&!a&&(N+=j.output)}}let te;return T?te=2:o?te=N.length>0?0:1:te=k?0:1,g?{stdout:"",stderr:"",exitCode:te}:{stdout:N,stderr:P,exitCode:te}}};Uy={name:"fgrep",async execute(e,t){return lo.execute(["-F",...e],t)}},By={name:"egrep",async execute(e,t){return lo.execute(["-E",...e],t)}},Wy={name:"grep",flags:[{flag:"-E",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-P",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-L",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-m",type:"value",valueHint:"number"},{flag:"-A",type:"value",valueHint:"number"},{flag:"-B",type:"value",valueHint:"number"},{flag:"-C",type:"value",valueHint:"number"},{flag:"-e",type:"value",valueHint:"pattern"}],stdinType:"text",needsArgs:!0},zy={name:"fgrep",flags:[],stdinType:"text",needsArgs:!0},Hy={name:"egrep",flags:[],stdinType:"text",needsArgs:!0}});function qf(){let e=[];for(let[t,n]of Object.entries(Vf).sort()){let r=[];for(let s of n.extensions)r.push(`*${s}`);for(let s of n.globs)r.push(s);e.push(`${t}: ${r.join(", ")}`)}return`${e.join(`
202
202
  `)}
203
203
  `}var Vf,us,co=I(()=>{"use strict";Me();Vf={js:{extensions:[".js",".mjs",".cjs",".jsx"],globs:[]},ts:{extensions:[".ts",".tsx",".mts",".cts"],globs:[]},html:{extensions:[".html",".htm",".xhtml"],globs:[]},css:{extensions:[".css",".scss",".sass",".less"],globs:[]},json:{extensions:[".json",".jsonc",".json5"],globs:[]},xml:{extensions:[".xml",".xsl",".xslt"],globs:[]},c:{extensions:[".c",".h"],globs:[]},cpp:{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx",".h"],globs:[]},rust:{extensions:[".rs"],globs:[]},go:{extensions:[".go"],globs:[]},zig:{extensions:[".zig"],globs:[]},java:{extensions:[".java"],globs:[]},kotlin:{extensions:[".kt",".kts"],globs:[]},scala:{extensions:[".scala",".sc"],globs:[]},clojure:{extensions:[".clj",".cljc",".cljs",".edn"],globs:[]},py:{extensions:[".py",".pyi",".pyw"],globs:[]},rb:{extensions:[".rb",".rake",".gemspec"],globs:["Rakefile","Gemfile"]},php:{extensions:[".php",".phtml",".php3",".php4",".php5"],globs:[]},perl:{extensions:[".pl",".pm",".pod",".t"],globs:[]},lua:{extensions:[".lua"],globs:[]},sh:{extensions:[".sh",".bash",".zsh",".fish"],globs:[".bashrc",".zshrc",".profile"]},bat:{extensions:[".bat",".cmd"],globs:[]},ps:{extensions:[".ps1",".psm1",".psd1"],globs:[]},yaml:{extensions:[".yaml",".yml"],globs:[]},toml:{extensions:[".toml"],globs:["Cargo.toml","pyproject.toml"]},ini:{extensions:[".ini",".cfg",".conf"],globs:[]},csv:{extensions:[".csv",".tsv"],globs:[]},md:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},markdown:{extensions:[".md",".mdx",".markdown",".mdown",".mkd"],globs:[]},rst:{extensions:[".rst"],globs:[]},txt:{extensions:[".txt",".text"],globs:[]},tex:{extensions:[".tex",".ltx",".sty",".cls"],globs:[]},sql:{extensions:[".sql"],globs:[]},graphql:{extensions:[".graphql",".gql"],globs:[]},proto:{extensions:[".proto"],globs:[]},make:{extensions:[".mk",".mak"],globs:["Makefile","GNUmakefile","makefile"]},docker:{extensions:[],globs:["Dockerfile","Dockerfile.*","*.dockerfile"]},tf:{extensions:[".tf",".tfvars"],globs:[]}},us=class{types;constructor(){this.types=new Map(Object.entries(Vf).map(([t,n])=>[t,{extensions:[...n.extensions],globs:[...n.globs]}]))}addType(t){let n=t.indexOf(":");if(n===-1)return;let r=t.slice(0,n),s=t.slice(n+1);if(s.startsWith("include:")){let i=s.slice(8),a=this.types.get(i);if(a){let o=this.types.get(r)||{extensions:[],globs:[]};o.extensions.push(...a.extensions),o.globs.push(...a.globs),this.types.set(r,o)}}else{let i=this.types.get(r)||{extensions:[],globs:[]};if(s.startsWith("*.")&&!s.slice(2).includes("*")){let a=s.slice(1);i.extensions.includes(a)||i.extensions.push(a)}else i.globs.includes(s)||i.globs.push(s);this.types.set(r,i)}}clearType(t){let n=this.types.get(t);n&&(n.extensions=[],n.globs=[])}getType(t){return this.types.get(t)}getAllTypes(){return this.types}matchesType(t,n){let r=t.toLowerCase();for(let s of n){if(s==="all"){if(this.matchesAnyType(t))return!0;continue}let i=this.types.get(s);if(i){for(let a of i.extensions)if(r.endsWith(a))return!0;for(let a of i.globs)if(a.includes("*")){let o=a.replace(/\./g,"\\.").replace(/\*/g,".*");if(V(`^${o}$`,"i").test(t))return!0}else if(r===a.toLowerCase())return!0}}return!1}matchesAnyType(t){let n=t.toLowerCase();for(let r of this.types.values()){for(let s of r.extensions)if(n.endsWith(s))return!0;for(let s of r.globs)if(s.includes("*")){let i=s.replace(/\./g,"\\.").replace(/\*/g,".*");if(V(`^${i}$`,"i").test(t))return!0}else if(n===s.toLowerCase())return!0}return!1}}});function Zf(){return{ignoreCase:!1,caseSensitive:!1,smartCase:!0,fixedStrings:!1,wordRegexp:!1,lineRegexp:!1,invertMatch:!1,multiline:!1,multilineDotall:!1,patterns:[],patternFiles:[],count:!1,countMatches:!1,files:!1,filesWithMatches:!1,filesWithoutMatch:!1,stats:!1,onlyMatching:!1,maxCount:0,lineNumber:!0,noFilename:!1,withFilename:!1,nullSeparator:!1,byteOffset:!1,column:!1,vimgrep:!1,replace:null,afterContext:0,beforeContext:0,contextSeparator:"--",quiet:!1,heading:!1,passthru:!1,includeZero:!1,sort:"path",json:!1,globs:[],iglobs:[],globCaseInsensitive:!1,types:[],typesNot:[],typeAdd:[],typeClear:[],hidden:!1,noIgnore:!1,noIgnoreDot:!1,noIgnoreVcs:!1,ignoreFiles:[],maxDepth:1/0,maxFilesize:0,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}var Kf=I(()=>{"use strict"});function jy(e){let t=e.match(/^(\d+)([KMG])?$/i);if(!t)return 0;let n=parseInt(t[1],10);switch((t[2]||"").toUpperCase()){case"K":return n*1024;case"M":return n*1024*1024;case"G":return n*1024*1024*1024;default:return n}}function Gy(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:"",stderr:`rg: invalid --max-filesize value: ${e}
204
204
  `,exitCode:1}}function Qf(e){return null}function Zy(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function Ky(e,t,n){let r=e[t];for(let s of Xf){if(r.startsWith(`--${s.long}=`)){let i=r.slice(`--${s.long}=`.length),a=ai(n,s,i);return a?{newIndex:t,error:a}:{newIndex:t}}if(s.short&&r.startsWith(`-${s.short}`)&&r.length>2){let i=r.slice(2),a=ai(n,s,i);return a?{newIndex:t,error:a}:{newIndex:t}}if(s.short&&r===`-${s.short}`||r===`--${s.long}`){if(t+1>=e.length)return null;let i=e[t+1],a=ai(n,s,i);return a?{newIndex:t+1,error:a}:{newIndex:t+1}}}return null}function Qy(e){return Xf.find(t=>t.short===e)}function ai(e,t,n){if(t.validate){let s=t.validate(n);if(s)return s}let r=t.parse?t.parse(n):n;t.multi?e[t.target].push(r):e[t.target]=r}function Xy(e,t){let n=e[t];if(n==="--sort"&&t+1<e.length){let r=e[t+1];if(r==="path"||r==="none")return{value:r,newIndex:t+1}}if(n.startsWith("--sort=")){let r=n.slice(7);if(r==="path"||r==="none")return{value:r,newIndex:t}}return null}function Yy(e,t){let n=e[t],r=n.match(/^-([ABC])(\d+)$/);return r?{flag:r[1],value:parseInt(r[2],10),newIndex:t}:(n==="-A"||n==="-B"||n==="-C")&&t+1<e.length?{flag:n[1],value:parseInt(e[t+1],10),newIndex:t+1}:null}function Jy(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function Yf(e){let t=Zf(),n=null,r=[],s=-1,i=-1,a=-1,o=!1;for(let l=0;l<e.length;l++){let c=e[l];if(c.startsWith("-")&&c!=="-"){let u=Yy(e,l);if(u){let{flag:g,value:w,newIndex:y}=u;g==="A"?s=Math.max(s,w):g==="B"?i=Math.max(i,w):a=w,l=y;continue}let f=Jy(c);if(f!==null){t.maxCount=f;continue}let p=Ky(e,l,t);if(p){if(p.error)return{success:!1,error:p.error};l=p.newIndex;continue}let h=Xy(e,l);if(h){t.sort=h.value,l=h.newIndex;continue}let m=c.startsWith("--")?[c]:c.slice(1).split(""),d=!1;for(let g of m){if(qy.has(g)){t.lineNumber=!0,o=!0;continue}if(g==="u"||g==="--unrestricted"){Zy(t);continue}if(g==="P"||g==="--pcre2")return{success:!1,error:{stdout:"",stderr:`rg: PCRE2 is not supported. Use standard regex syntax instead.
@@ -210,8 +210,8 @@ Options:
210
210
  `,exitCode:2};let a=r.length===0?["."]:r,o=r4(n,i),l,c;try{let g=s4(i,n,o);l=g.regex,c=g.kResetGroup}catch{return{stdout:"",stderr:`rg: invalid regex: ${i.join(", ")}
211
211
  `,exitCode:2}}let u=null;n.noIgnore||(u=await uo(t.fs,t.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let f=new us;for(let g of n.typeClear)f.clearType(g);for(let g of n.typeAdd)f.addType(g);let{files:p,singleExplicitFile:h}=await n1(t,a,n,u,f);if(p.length===0)return{stdout:"",stderr:"",exitCode:1};let m=!n.noFilename&&(n.withFilename||!h||p.length>1),d=n.lineNumber;return s||(h&&p.length===1&&(d=!1),n.onlyMatching&&(d=!1)),l4(t,p,l,n,m,d,c)}function r4(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(n=>/[A-Z]/.test(n)):!1}function s4(e,t,n){let r;return e.length===1?r=e[0]:r=e.map(s=>t.fixedStrings?s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):`(?:${s})`).join("|"),cs(r,{mode:t.fixedStrings&&e.length===1?"fixed":"perl",ignoreCase:n,wholeWord:t.wordRegexp,lineRegexp:t.lineRegexp,multiline:t.multiline,multilineDotall:t.multilineDotall})}async function n1(e,t,n,r,s){let i=[],a=0,o=0;for(let c of t){let u=e.fs.resolvePath(e.cwd,c);try{let f=await e.fs.stat(u);if(f.isFile){if(a++,n.maxFilesize>0&&f.size>n.maxFilesize)continue;s1(c,n,r,u,s)&&i.push(c)}else f.isDirectory&&(o++,await r1(e,c,u,0,n,r,s,i))}catch{}}return{files:n.sort==="path"?i.sort():i,singleExplicitFile:a===1&&o===0}}async function r1(e,t,n,r,s,i,a,o){if(!(r>=s.maxDepth)){i&&await i.loadForDirectory(n);try{let l=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(n):(await e.fs.readdir(n)).map(c=>({name:c,isFile:void 0}));for(let c of l){let u=c.name;if(!s.noIgnore&&ps.isCommonIgnored(u))continue;let f=u.startsWith("."),p=t==="."?u:t==="./"?`./${u}`:t.endsWith("/")?`${t}${u}`:`${t}/${u}`,h=e.fs.resolvePath(n,u),m,d,g=!1;if(c.isFile!==void 0&&"isDirectory"in c){let b=c;if(g=b.isSymbolicLink===!0,g&&!s.followSymlinks)continue;if(g&&s.followSymlinks)try{let x=await e.fs.stat(h);m=x.isFile,d=x.isDirectory}catch{continue}else m=b.isFile,d=b.isDirectory}else try{let b=e.fs.lstat?await e.fs.lstat(h):await e.fs.stat(h);if(g=b.isSymbolicLink===!0,g&&!s.followSymlinks)continue;let x=g&&s.followSymlinks?await e.fs.stat(h):b;m=x.isFile,d=x.isDirectory}catch{continue}if(!i?.matches(h,d)&&!(f&&!s.hidden&&!i?.isWhitelisted(h,d))){if(d)await r1(e,p,h,r+1,s,i,a,o);else if(m){if(s.maxFilesize>0)try{if((await e.fs.stat(h)).size>s.maxFilesize)continue}catch{continue}s1(p,s,i,h,a)&&o.push(p)}}}}catch{}}}function s1(e,t,n,r,s){let i=e.split("/").pop()||e;if(n?.matches(r,!1)||t.types.length>0&&!s.matchesType(i,t.types)||t.typesNot.length>0&&s.matchesType(i,t.typesNot))return!1;if(t.globs.length>0){let a=t.globCaseInsensitive,o=t.globs.filter(c=>!c.startsWith("!")),l=t.globs.filter(c=>c.startsWith("!")).map(c=>c.slice(1));if(o.length>0){let c=!1;for(let u of o)if(tn(i,u,a)||tn(e,u,a)){c=!0;break}if(!c)return!1}for(let c of l)if(c.startsWith("/")){let u=c.slice(1);if(tn(e,u,a))return!1}else if(tn(i,c,a)||tn(e,c,a))return!1}if(t.iglobs.length>0){let a=t.iglobs.filter(l=>!l.startsWith("!")),o=t.iglobs.filter(l=>l.startsWith("!")).map(l=>l.slice(1));if(a.length>0){let l=!1;for(let c of a)if(tn(i,c,!0)||tn(e,c,!0)){l=!0;break}if(!l)return!1}for(let l of o)if(l.startsWith("/")){let c=l.slice(1);if(tn(e,c,!0))return!1}else if(tn(i,l,!0)||tn(e,l,!0))return!1}return!0}function tn(e,t,n=!1){let r="^";for(let s=0;s<t.length;s++){let i=t[s];if(i==="*")t[s+1]==="*"?(r+=".*",s++):r+="[^/]*";else if(i==="?")r+="[^/]";else if(i==="["){let a=s+1;for(a<t.length&&t[a]==="!"&&a++,a<t.length&&t[a]==="]"&&a++;a<t.length&&t[a]!=="]";)a++;if(a<t.length){let o=t.slice(s,a+1);o.startsWith("[!")&&(o=`[^${o.slice(2)}`),r+=o,s=a}else r+="\\["}else r+=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return r+="$",V(r,n?"i":"").test(e)}async function i4(e,t,n){let r=null;n.noIgnore||(r=await uo(e.fs,e.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let s=new us;for(let c of n.typeClear)s.clearType(c);for(let c of n.typeAdd)s.addType(c);let i=t.length===0?["."]:t,{files:a}=await n1(e,i,n,r,s);if(a.length===0)return{stdout:"",stderr:"",exitCode:1};if(n.quiet)return{stdout:"",stderr:"",exitCode:0};let o=n.nullSeparator?"\0":`
212
212
  `;return{stdout:a.map(c=>c+o).join(""),stderr:"",exitCode:0}}function a4(e,t){if(t.length===0)return!0;for(let n of t)if(tn(e,n,!1))return!0;return!1}async function o4(e,t,n,r){try{if(r.preprocessor&&e.exec){let a=n.split("/").pop()||n;if(a4(a,r.preprocessorGlobs)){let o=await e.exec(`${r.preprocessor} "${t}"`,{cwd:e.cwd});if(o.exitCode===0&&o.stdout){let l=o.stdout.slice(0,8192);return{content:o.stdout,isBinary:l.includes("\0")}}}}if(r.searchZip&&n.endsWith(".gz")){let a=await e.fs.readFileBuffer(t);if(t4(a))try{let o=e4(a),l=new TextDecoder().decode(o),c=l.slice(0,8192);return{content:l,isBinary:c.includes("\0")}}catch{return null}}let s=await e.fs.readFile(t),i=s.slice(0,8192);return{content:s,isBinary:i.includes("\0")}}catch{return null}}async function l4(e,t,n,r,s,i,a){let o="",l=!1,c=[],u=0,f=0,p=0,h=50;e:for(let g=0;g<t.length;g+=h){let w=t.slice(g,g+h),y=await Promise.all(w.map(async b=>{let x=e.fs.resolvePath(e.cwd,b),S=await o4(e,x,b,r);if(!S)return null;let{content:$,isBinary:O}=S;if(p+=$.length,O&&!r.searchBinary)return null;let L=s&&!r.heading?b:"",R=Cr($,n,{invertMatch:r.invertMatch,showLineNumbers:i,countOnly:r.count,countMatches:r.countMatches,filename:L,onlyMatching:r.onlyMatching,beforeContext:r.beforeContext,afterContext:r.afterContext,maxCount:r.maxCount,contextSeparator:r.contextSeparator,showColumn:r.column,vimgrep:r.vimgrep,showByteOffset:r.byteOffset,replace:r.replace!==null?ao(r.replace):null,passthru:r.passthru,multiline:r.multiline,kResetGroup:a});return r.json&&R.matched?{file:b,result:R,content:$,isBinary:!1}:{file:b,result:R}}));for(let b of y){if(!b)continue;let{file:x,result:S}=b;if(S.matched){if(l=!0,f++,u+=S.matchCount,r.quiet&&!r.json)break e;if(r.json&&!r.quiet){let $=b.content||"";c.push(JSON.stringify({type:"begin",data:{path:{text:x}}}));let O=$.split(`
213
- `);n.lastIndex=0;let L=0;for(let R=0;R<O.length;R++){let W=O[R];n.lastIndex=0;let k=[];for(let N=n.exec(W);N!==null;N=n.exec(W)){let P={match:{text:N[0]},start:N.index,end:N.index+N[0].length};r.replace!==null&&(P.replacement={text:r.replace}),k.push(P),N[0].length===0&&n.lastIndex++}if(k.length>0){let N={type:"match",data:{path:{text:x},lines:{text:`${W}
214
- `},line_number:R+1,absolute_offset:L,submatches:k}};c.push(JSON.stringify(N))}L+=W.length+1}c.push(JSON.stringify({type:"end",data:{path:{text:x},binary_offset:null,stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:1,searches_with_match:1,bytes_searched:$.length,bytes_printed:0,matched_lines:S.matchCount,matches:S.matchCount}}}))}else if(r.filesWithMatches){let $=r.nullSeparator?"\0":`
213
+ `);n.lastIndex=0;let L=0;for(let R=0;R<O.length;R++){let W=O[R];n.lastIndex=0;let v=[];for(let N=n.exec(W);N!==null;N=n.exec(W)){let P={match:{text:N[0]},start:N.index,end:N.index+N[0].length};r.replace!==null&&(P.replacement={text:r.replace}),v.push(P),N[0].length===0&&n.lastIndex++}if(v.length>0){let N={type:"match",data:{path:{text:x},lines:{text:`${W}
214
+ `},line_number:R+1,absolute_offset:L,submatches:v}};c.push(JSON.stringify(N))}L+=W.length+1}c.push(JSON.stringify({type:"end",data:{path:{text:x},binary_offset:null,stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:1,searches_with_match:1,bytes_searched:$.length,bytes_printed:0,matched_lines:S.matchCount,matches:S.matchCount}}}))}else if(r.filesWithMatches){let $=r.nullSeparator?"\0":`
215
215
  `;o+=`${x}${$}`}else r.filesWithoutMatch||(r.heading&&!r.noFilename&&(o+=`${x}
216
216
  `),o+=S.output)}else if(r.filesWithoutMatch){let $=r.nullSeparator?"\0":`
217
217
  `;o+=`${x}${$}`}else r.includeZero&&(r.count||r.countMatches)&&(o+=S.output)}}r.json&&(c.push(JSON.stringify({type:"summary",data:{elapsed_total:{secs:0,nanos:0,human:"0s"},stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:t.length,searches_with_match:f,bytes_searched:p,bytes_printed:0,matched_lines:u,matches:u}}})),o=`${c.join(`
@@ -273,10 +273,10 @@ ${c}`,t.lineNumber=n.currentLineIndex+t.linesConsumedInCycle+1}else{t.quit=!0;br
273
273
  ${c}`}else s.push(c)}let i=s.join(`
274
274
  `),o=new wo([i],t||r).parse();if(!o.error&&o.commands.length>0){let l=b4(o.commands);if(l)return{commands:[],error:l,silentMode:n,extendedRegexMode:r}}return{...o,silentMode:n,extendedRegexMode:r}}function b4(e){let t=new Set;d1(e,t);let n=m1(e,t);if(n)return`undefined label '${n}'`}function d1(e,t){for(let n of e)n.type==="label"?t.add(n.name):n.type==="group"&&d1(n.commands,t)}function m1(e,t){for(let n of e){if((n.type==="branch"||n.type==="branchOnSubst"||n.type==="branchOnNoSubst")&&n.label&&!t.has(n.label))return n.label;if(n.type==="group"){let r=m1(n.commands,t);if(r)return r}}}var wo,g1=I(()=>{"use strict";p1();wo=class{scripts;tokens=[];pos=0;extendedRegex=!1;constructor(t,n=!1){this.scripts=t,this.extendedRegex=n}parse(){let t=[];for(let n of this.scripts){let r=new oi(n);for(this.tokens=r.tokenize(),this.pos=0;!this.isAtEnd();){if(this.check(ee.NEWLINE)||this.check(ee.SEMICOLON)){this.advance();continue}let s=this.pos,i=this.parseCommand();if(i.error)return{commands:[],error:i.error};if(i.command&&t.push(i.command),this.pos===s&&!this.isAtEnd())return{commands:[],error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}}return{commands:t}}parseCommand(){let t=this.parseAddressRange();if(t?.error)return{command:null,error:t.error};let n=t?.address;for(this.check(ee.NEGATION)&&(this.advance(),n&&(n.negated=!0));this.check(ee.NEWLINE)||this.check(ee.SEMICOLON);)this.advance();if(this.isAtEnd())return n&&(n.start!==void 0||n.end!==void 0)?{command:null,error:"command expected"}:{command:null};let r=this.peek();switch(r.type){case ee.COMMAND:return this.parseSimpleCommand(r,n);case ee.SUBSTITUTE:return this.parseSubstituteFromToken(r,n);case ee.TRANSLITERATE:return this.parseTransliterateFromToken(r,n);case ee.LABEL_DEF:return this.advance(),{command:{type:"label",name:r.label||""}};case ee.BRANCH:return this.advance(),{command:{type:"branch",address:n,label:r.label}};case ee.BRANCH_ON_SUBST:return this.advance(),{command:{type:"branchOnSubst",address:n,label:r.label}};case ee.BRANCH_ON_NO_SUBST:return this.advance(),{command:{type:"branchOnNoSubst",address:n,label:r.label}};case ee.TEXT_CMD:return this.advance(),this.parseTextCommand(r,n);case ee.FILE_READ:return this.advance(),{command:{type:"readFile",address:n,filename:r.filename||""}};case ee.FILE_READ_LINE:return this.advance(),{command:{type:"readFileLine",address:n,filename:r.filename||""}};case ee.FILE_WRITE:return this.advance(),{command:{type:"writeFile",address:n,filename:r.filename||""}};case ee.FILE_WRITE_LINE:return this.advance(),{command:{type:"writeFirstLine",address:n,filename:r.filename||""}};case ee.EXECUTE:return this.advance(),{command:{type:"execute",address:n,command:r.command}};case ee.VERSION:return this.advance(),{command:{type:"version",address:n,minVersion:r.label}};case ee.LBRACE:return this.parseGroup(n);case ee.RBRACE:return{command:null};case ee.ERROR:return{command:null,error:`invalid command: ${r.value}`};default:return n&&(n.start!==void 0||n.end!==void 0)?{command:null,error:"command expected"}:{command:null}}}parseSimpleCommand(t,n){this.advance();let r=t.value;switch(r){case"p":return{command:{type:"print",address:n}};case"P":return{command:{type:"printFirstLine",address:n}};case"d":return{command:{type:"delete",address:n}};case"D":return{command:{type:"deleteFirstLine",address:n}};case"h":return{command:{type:"hold",address:n}};case"H":return{command:{type:"holdAppend",address:n}};case"g":return{command:{type:"get",address:n}};case"G":return{command:{type:"getAppend",address:n}};case"x":return{command:{type:"exchange",address:n}};case"n":return{command:{type:"next",address:n}};case"N":return{command:{type:"nextAppend",address:n}};case"q":return{command:{type:"quit",address:n}};case"Q":return{command:{type:"quitSilent",address:n}};case"z":return{command:{type:"zap",address:n}};case"=":return{command:{type:"lineNumber",address:n}};case"l":return{command:{type:"list",address:n}};case"F":return{command:{type:"printFilename",address:n}};default:return{command:null,error:`unknown command: ${r}`}}}parseSubstituteFromToken(t,n){this.advance();let r=t.flags||"",s,i=r.match(/(\d+)/);return i&&(s=parseInt(i[1],10)),{command:{type:"substitute",address:n,pattern:t.pattern||"",replacement:t.replacement||"",global:r.includes("g"),ignoreCase:r.includes("i")||r.includes("I"),printOnMatch:r.includes("p"),nthOccurrence:s,extendedRegex:this.extendedRegex}}}parseTransliterateFromToken(t,n){this.advance();let r=t.source||"",s=t.dest||"";return r.length!==s.length?{command:null,error:"transliteration sets must have same length"}:{command:{type:"transliterate",address:n,source:r,dest:s}}}parseTextCommand(t,n){let r=t.value,s=t.text||"";switch(r){case"a":return{command:{type:"append",address:n,text:s}};case"i":return{command:{type:"insert",address:n,text:s}};case"c":return{command:{type:"change",address:n,text:s}};default:return{command:null,error:`unknown text command: ${r}`}}}parseGroup(t){this.advance();let n=[];for(;!this.isAtEnd()&&!this.check(ee.RBRACE);){if(this.check(ee.NEWLINE)||this.check(ee.SEMICOLON)){this.advance();continue}let r=this.pos,s=this.parseCommand();if(s.error)return{command:null,error:s.error};if(s.command&&n.push(s.command),this.pos===r&&!this.isAtEnd())return{command:null,error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}return this.check(ee.RBRACE)?(this.advance(),{command:{type:"group",address:t,commands:n}}):{command:null,error:"unmatched brace in grouped commands"}}parseAddressRange(){if(this.check(ee.COMMA))return{error:"expected context address"};let t=this.parseAddress();if(t===void 0)return;let n;if(this.check(ee.RELATIVE_OFFSET))n={offset:this.advance().offset||0};else if(this.check(ee.COMMA)&&(this.advance(),n=this.parseAddress(),n===void 0))return{error:"expected context address"};return{address:{start:t,end:n}}}parseAddress(){let t=this.peek();switch(t.type){case ee.NUMBER:return this.advance(),t.value;case ee.DOLLAR:return this.advance(),"$";case ee.PATTERN:return this.advance(),{pattern:t.pattern||t.value};case ee.STEP:return this.advance(),{first:t.first||0,step:t.step||0};case ee.RELATIVE_OFFSET:return this.advance(),{offset:t.offset||0};default:return}}peek(){return this.tokens[this.pos]||{type:ee.EOF,value:"",line:0,column:0}}advance(){return this.isAtEnd()||this.pos++,this.tokens[this.pos-1]}check(t){return this.peek().type===t}isAtEnd(){return this.peek().type===ee.EOF}}});var y1={};K(y1,{flagsForFuzzing:()=>A4,sedCommand:()=>E4});async function bo(e,t,n,r={}){let{limits:s,filename:i,fs:a,cwd:o,coverage:l}=r,c=e.endsWith(`
275
275
  `),u=e.split(`
276
- `);u.length>0&&u[u.length-1]===""&&u.pop();let f=u.length,p="",h,m=!1,d=s?.maxStringLength??0,g=L=>{if(p+=L,d>0&&p.length>d)throw new J(`sed: output size limit exceeded (${d} bytes)`,"string_length")},w="",y,b=new Map,x=new Map,S=new Map,$=new Map,O=s?{maxIterations:s.maxSedIterations}:void 0;for(let L=0;L<u.length;L++){let R={...u1(f,i,b),patternSpace:u[L],holdSpace:w,lastPattern:y,lineNumber:L+1,totalLines:f,substitutionMade:!1,coverage:l},W={lines:u,currentLineIndex:L},k=0,N=1e4;R.linesConsumedInCycle=0;do{if(k++,k>N)break;if(R.restartCycle=!1,R.pendingFileReads=[],R.pendingFileWrites=[],yo(t,R,W,O),a&&o){for(let re of R.pendingFileReads){let te=a.resolvePath(o,re.filename);try{if(re.wholeFile){let H=await a.readFile(te);R.appendBuffer.push(H.replace(/\n$/,""))}else{if(!x.has(te)){let Ee=await a.readFile(te);x.set(te,Ee.split(`
276
+ `);u.length>0&&u[u.length-1]===""&&u.pop();let f=u.length,p="",h,m=!1,d=s?.maxStringLength??0,g=L=>{if(p+=L,d>0&&p.length>d)throw new J(`sed: output size limit exceeded (${d} bytes)`,"string_length")},w="",y,b=new Map,x=new Map,S=new Map,$=new Map,O=s?{maxIterations:s.maxSedIterations}:void 0;for(let L=0;L<u.length;L++){let R={...u1(f,i,b),patternSpace:u[L],holdSpace:w,lastPattern:y,lineNumber:L+1,totalLines:f,substitutionMade:!1,coverage:l},W={lines:u,currentLineIndex:L},v=0,N=1e4;R.linesConsumedInCycle=0;do{if(v++,v>N)break;if(R.restartCycle=!1,R.pendingFileReads=[],R.pendingFileWrites=[],yo(t,R,W,O),a&&o){for(let re of R.pendingFileReads){let te=a.resolvePath(o,re.filename);try{if(re.wholeFile){let H=await a.readFile(te);R.appendBuffer.push(H.replace(/\n$/,""))}else{if(!x.has(te)){let Ee=await a.readFile(te);x.set(te,Ee.split(`
277
277
  `)),S.set(te,0)}let H=x.get(te),X=S.get(te);H&&X!==void 0&&X<H.length&&(R.appendBuffer.push(H[X]),S.set(te,X+1))}}catch{}}for(let re of R.pendingFileWrites){let te=a.resolvePath(o,re.filename),H=$.get(te)||"";$.set(te,H+re.content)}}}while(R.restartCycle&&!R.deleted&&!R.quit&&!R.quitSilent);if(L+=R.linesConsumedInCycle,w=R.holdSpace,y=R.lastPattern,!n)for(let re of R.nCommandOutput)g(`${re}
278
278
  `);let P=R.lineNumberOutput.length>0;for(let re of R.lineNumberOutput)g(`${re}
279
- `);let v=[],T=[];for(let re of R.appendBuffer)re.startsWith("__INSERT__")?v.push(re.slice(10)):T.push(re);for(let re of v)g(`${re}
279
+ `);let k=[],T=[];for(let re of R.appendBuffer)re.startsWith("__INSERT__")?k.push(re.slice(10)):T.push(re);for(let re of k)g(`${re}
280
280
  `);let F=!1;!R.deleted&&!R.quitSilent?n?R.printed&&(g(`${R.patternSpace}
281
281
  `),F=!0):(g(`${R.patternSpace}
282
282
  `),F=!0):R.changedText!==void 0&&(g(`${R.changedText}
@@ -328,19 +328,19 @@ Addresses:
328
328
  `),p+=d}try{let m=await bo(p,l,f,{limits:t.limits,filename:o.length===1?o[0]:void 0,fs:t.fs,cwd:t.cwd,coverage:t.coverage});return{stdout:m.output,stderr:m.errorMessage?`${m.errorMessage}
329
329
  `:"",exitCode:m.exitCode??0}}catch(m){if(m instanceof J)return{stdout:"",stderr:`sed: ${m.message}
330
330
  `,exitCode:J.EXIT_CODE};throw m}}},A4={name:"sed",flags:[{flag:"-n",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-E",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-e",type:"value",valueHint:"string"}],stdinType:"text",needsArgs:!0}});function Et(e){return Object.assign(Object.create(null),Object.fromEntries(e))}function nn(e,t){return Object.assign(Object.create(null),Object.fromEntries(e),t)}function li(...e){return Object.assign(Object.create(null),...e)}var Pn=I(()=>{"use strict"});function xo(e={}){let{fieldSep:t=N4,maxIterations:n=S4,maxRecursionDepth:r=C4,maxOutputSize:s=0,fs:i,cwd:a,exec:o,coverage:l}=e;return{FS:" ",OFS:" ",ORS:`
331
- `,OFMT:"%.6g",NR:0,NF:0,FNR:0,FILENAME:"",RSTART:0,RLENGTH:-1,SUBSEP:"",fields:[],line:"",vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:r,maxOutputSize:s,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:i,cwd:a,exec:o,coverage:l}}var S4,C4,N4,b1=I(()=>{"use strict";Me();S4=1e4,C4=100,N4=new Cn(/\s+/)});function x1(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return t!==0?e/t:0;case"%":return t!==0?e%t:0;case"^":case"**":return e**t;default:return 0}}var E1=I(()=>{"use strict"});function Zt(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function ft(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}async function ci(e,t){if(e.type==="regex")return e.pattern;let n=ft(await t.evalExpr(e));return n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)),n}async function S1(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(Zt(await t.evalExpr(e.index)))}`:"$0":"$0"}function C1(e,t){if(e==="$0")return t.line;if(e.startsWith("$")){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||""}return ft(t.vars[e]??"")}function N1(e,t,n){if(e==="$0")n.line=t,n.fields=n.FS===" "?t.trim().split(/\s+/).filter(Boolean):n.fieldSep.split(t),n.NF=n.fields.length;else if(e.startsWith("$")){let r=parseInt(e.slice(1),10)-1;for(;n.fields.length<=r;)n.fields.push("");n.fields[r]=t,n.NF=n.fields.length,n.line=n.fields.join(n.OFS)}else n.vars[e]=t}async function k4(e,t,n){return e.length===0?t.line.length:ft(await n.evalExpr(e[0])).length}async function v4(e,t,n){if(e.length<2)return"";let r=ft(await n.evalExpr(e[0])),s=Math.floor(Zt(await n.evalExpr(e[1])))-1;if(e.length>=3){let i=Math.floor(Zt(await n.evalExpr(e[2])));return r.substr(Math.max(0,s),i)}return r.substr(Math.max(0,s))}async function I4(e,t,n){if(e.length<2)return 0;let r=ft(await n.evalExpr(e[0])),s=ft(await n.evalExpr(e[1])),i=r.indexOf(s);return i===-1?0:i+1}async function $4(e,t,n){if(e.length<2)return 0;let r=ft(await n.evalExpr(e[0])),s=e[1];if(s.type!=="variable")return 0;let i=s.name,a=t.FS;if(e.length>=3){let l=e[2];if(l.type==="regex")a=V(l.pattern);else{let c=ft(await n.evalExpr(l));a=c===" "?V("\\s+"):c}}else t.FS===" "&&(a=V("\\s+"));let o=typeof a=="string"?r.split(a):a.split(r);t.arrays[i]=Object.create(null);for(let l=0;l<o.length;l++)t.arrays[i][String(l+1)]=o[l];return o.length}async function O4(e,t,n){if(e.length<2)return 0;let r=await ci(e[0],n),s=ft(await n.evalExpr(e[1])),i=await S1(e[2],n),a=C1(i,t);try{let l=V(r).replace(a,k1(s)),c=l!==a?1:0;return N1(i,l,t),c}catch{return 0}}async function R4(e,t,n){if(e.length<2)return 0;let r=await ci(e[0],n),s=ft(await n.evalExpr(e[1])),i=await S1(e[2],n),a=C1(i,t);try{let o=V(r,"g"),l=o.match(a),c=l?l.length:0,u=o.replace(a,k1(s));return N1(i,u,t),c}catch{return 0}}function k1(e){return t=>{let n="",r=0;for(;r<e.length;)if(e[r]==="\\"&&r+1<e.length){let s=e[r+1];s==="&"?(n+="&",r+=2):s==="\\"?(n+="\\",r+=2):(n+=e[r+1],r+=2)}else e[r]==="&"?(n+=t,r++):(n+=e[r],r++);return n}}async function T4(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let r=ft(await n.evalExpr(e[0])),s=await ci(e[1],n);try{let a=V(s).exec(r);if(a)return t.RSTART=a.index+1,t.RLENGTH=a[0].length,t.RSTART}catch{}return t.RSTART=0,t.RLENGTH=-1,0}async function P4(e,t,n){if(e.length<3)return"";let r=await ci(e[0],n),s=ft(await n.evalExpr(e[1])),i=ft(await n.evalExpr(e[2])),a=e.length>=4?ft(await n.evalExpr(e[3])):t.line;try{let o=i.toLowerCase()==="g",l=o?0:parseInt(i,10)||1;if(o)return V(r,"g").replace(a,(u,...f)=>A1(s,u,f.slice(0,-2)));{let c=0;return V(r,"g").replace(a,(f,...p)=>(c++,c===l?A1(s,f,p.slice(0,-2)):f))}}catch{return a}}function A1(e,t,n){let r="",s=0;for(;s<e.length;)if(e[s]==="\\"&&s+1<e.length){let i=e[s+1];if(i==="&")r+="&",s+=2;else if(i==="0")r+=t,s+=2;else if(i>="1"&&i<="9"){let a=parseInt(i,10)-1;r+=n[a]||"",s+=2}else i==="n"?(r+=`
331
+ `,OFMT:"%.6g",NR:0,NF:0,FNR:0,FILENAME:"",RSTART:0,RLENGTH:-1,SUBSEP:"",fields:[],line:"",vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:r,maxOutputSize:s,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:i,cwd:a,exec:o,coverage:l}}var S4,C4,N4,b1=I(()=>{"use strict";Me();S4=1e4,C4=100,N4=new Cn(/\s+/)});function x1(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return t!==0?e/t:0;case"%":return t!==0?e%t:0;case"^":case"**":return e**t;default:return 0}}var E1=I(()=>{"use strict"});function Zt(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function ft(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}async function ci(e,t){if(e.type==="regex")return e.pattern;let n=ft(await t.evalExpr(e));return n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)),n}async function S1(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(Zt(await t.evalExpr(e.index)))}`:"$0":"$0"}function C1(e,t){if(e==="$0")return t.line;if(e.startsWith("$")){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||""}return ft(t.vars[e]??"")}function N1(e,t,n){if(e==="$0")n.line=t,n.fields=n.FS===" "?t.trim().split(/\s+/).filter(Boolean):n.fieldSep.split(t),n.NF=n.fields.length;else if(e.startsWith("$")){let r=parseInt(e.slice(1),10)-1;for(;n.fields.length<=r;)n.fields.push("");n.fields[r]=t,n.NF=n.fields.length,n.line=n.fields.join(n.OFS)}else n.vars[e]=t}async function v4(e,t,n){return e.length===0?t.line.length:ft(await n.evalExpr(e[0])).length}async function k4(e,t,n){if(e.length<2)return"";let r=ft(await n.evalExpr(e[0])),s=Math.floor(Zt(await n.evalExpr(e[1])))-1;if(e.length>=3){let i=Math.floor(Zt(await n.evalExpr(e[2])));return r.substr(Math.max(0,s),i)}return r.substr(Math.max(0,s))}async function I4(e,t,n){if(e.length<2)return 0;let r=ft(await n.evalExpr(e[0])),s=ft(await n.evalExpr(e[1])),i=r.indexOf(s);return i===-1?0:i+1}async function $4(e,t,n){if(e.length<2)return 0;let r=ft(await n.evalExpr(e[0])),s=e[1];if(s.type!=="variable")return 0;let i=s.name,a=t.FS;if(e.length>=3){let l=e[2];if(l.type==="regex")a=V(l.pattern);else{let c=ft(await n.evalExpr(l));a=c===" "?V("\\s+"):c}}else t.FS===" "&&(a=V("\\s+"));let o=typeof a=="string"?r.split(a):a.split(r);t.arrays[i]=Object.create(null);for(let l=0;l<o.length;l++)t.arrays[i][String(l+1)]=o[l];return o.length}async function O4(e,t,n){if(e.length<2)return 0;let r=await ci(e[0],n),s=ft(await n.evalExpr(e[1])),i=await S1(e[2],n),a=C1(i,t);try{let l=V(r).replace(a,v1(s)),c=l!==a?1:0;return N1(i,l,t),c}catch{return 0}}async function R4(e,t,n){if(e.length<2)return 0;let r=await ci(e[0],n),s=ft(await n.evalExpr(e[1])),i=await S1(e[2],n),a=C1(i,t);try{let o=V(r,"g"),l=o.match(a),c=l?l.length:0,u=o.replace(a,v1(s));return N1(i,u,t),c}catch{return 0}}function v1(e){return t=>{let n="",r=0;for(;r<e.length;)if(e[r]==="\\"&&r+1<e.length){let s=e[r+1];s==="&"?(n+="&",r+=2):s==="\\"?(n+="\\",r+=2):(n+=e[r+1],r+=2)}else e[r]==="&"?(n+=t,r++):(n+=e[r],r++);return n}}async function T4(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let r=ft(await n.evalExpr(e[0])),s=await ci(e[1],n);try{let a=V(s).exec(r);if(a)return t.RSTART=a.index+1,t.RLENGTH=a[0].length,t.RSTART}catch{}return t.RSTART=0,t.RLENGTH=-1,0}async function P4(e,t,n){if(e.length<3)return"";let r=await ci(e[0],n),s=ft(await n.evalExpr(e[1])),i=ft(await n.evalExpr(e[2])),a=e.length>=4?ft(await n.evalExpr(e[3])):t.line;try{let o=i.toLowerCase()==="g",l=o?0:parseInt(i,10)||1;if(o)return V(r,"g").replace(a,(u,...f)=>A1(s,u,f.slice(0,-2)));{let c=0;return V(r,"g").replace(a,(f,...p)=>(c++,c===l?A1(s,f,p.slice(0,-2)):f))}}catch{return a}}function A1(e,t,n){let r="",s=0;for(;s<e.length;)if(e[s]==="\\"&&s+1<e.length){let i=e[s+1];if(i==="&")r+="&",s+=2;else if(i==="0")r+=t,s+=2;else if(i>="1"&&i<="9"){let a=parseInt(i,10)-1;r+=n[a]||"",s+=2}else i==="n"?(r+=`
332
332
  `,s+=2):i==="t"?(r+=" ",s+=2):(r+=i,s+=2)}else e[s]==="&"?(r+=t,s++):(r+=e[s],s++);return r}async function D4(e,t,n){return e.length===0?"":ft(await n.evalExpr(e[0])).toLowerCase()}async function _4(e,t,n){return e.length===0?"":ft(await n.evalExpr(e[0])).toUpperCase()}async function L4(e,t,n){if(e.length===0)return"";let r=ft(await n.evalExpr(e[0])),s=[];for(let i=1;i<e.length;i++)s.push(await n.evalExpr(e[i]));return ui(r,s)}async function F4(e,t,n){return e.length===0?0:Math.floor(Zt(await n.evalExpr(e[0])))}async function M4(e,t,n){return e.length===0?0:Math.sqrt(Zt(await n.evalExpr(e[0])))}async function U4(e,t,n){return e.length===0?0:Math.sin(Zt(await n.evalExpr(e[0])))}async function B4(e,t,n){return e.length===0?0:Math.cos(Zt(await n.evalExpr(e[0])))}async function W4(e,t,n){let r=e.length>0?Zt(await n.evalExpr(e[0])):0,s=e.length>1?Zt(await n.evalExpr(e[1])):0;return Math.atan2(r,s)}async function z4(e,t,n){return e.length===0?0:Math.log(Zt(await n.evalExpr(e[0])))}async function H4(e,t,n){return e.length===0?1:Math.exp(Zt(await n.evalExpr(e[0])))}function j4(e,t,n){return t.random?t.random():Math.random()}async function G4(e,t,n){let r=e.length>0?Zt(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=r,r}function V4(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function Eo(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}function ui(e,t){let n=0,r="",s=0;for(;s<e.length;)if(e[s]==="%"&&s+1<e.length){let i=s+1,a="",o="",l="",c,u=i;for(;i<e.length&&/\d/.test(e[i]);)i++;i>u&&e[i]==="$"?(c=parseInt(e.substring(u,i),10)-1,i++):i=u;let f=()=>{if(i<e.length){if(i+1<e.length&&(e[i]==="h"&&e[i+1]==="h"||e[i]==="l"&&e[i+1]==="l")){i+=2;return}/[lzjh]/.test(e[i])&&i++}};for(;i<e.length&&/[-+ #0]/.test(e[i]);)a+=e[i++];if(e[i]==="*"){let d=t[n++],g=d!==void 0?Math.floor(Number(d)):0;g<0?(a+="-",o=String(Math.min(-g,Yn))):o=String(Math.min(g,Yn)),i++}else for(;i<e.length&&/\d/.test(e[i]);)o+=e[i++];if(o&&parseInt(o,10)>Yn&&(o=String(Yn)),e[i]==="."){if(i++,e[i]==="*"){let d=t[n++];l=String(Math.min(d!==void 0?Math.floor(Number(d)):0,Yn)),i++}else for(;i<e.length&&/\d/.test(e[i]);)l+=e[i++];l&&parseInt(l,10)>Yn&&(l=String(Yn))}f();let p=e[i],m=t[c!==void 0?c:n];switch(p){case"s":{let d=m!==void 0?String(m):"";if(l&&(d=d.substring(0,parseInt(l,10))),o){let g=parseInt(o,10);a.includes("-")?d=d.padEnd(g):d=d.padStart(g)}r+=d,c===void 0&&n++;break}case"d":case"i":{let d=m!==void 0?Math.floor(Number(m)):0;Number.isNaN(d)&&(d=0);let g=d<0,w=Math.abs(d).toString();if(l){let x=parseInt(l,10);w=w.padStart(x,"0")}let y="";g?y="-":a.includes("+")?y="+":a.includes(" ")&&(y=" ");let b=y+w;if(o){let x=parseInt(o,10);a.includes("-")?b=b.padEnd(x):a.includes("0")&&!l?b=y+w.padStart(x-y.length,"0"):b=b.padStart(x)}r+=b,c===void 0&&n++;break}case"f":{let d=m!==void 0?Number(m):0;Number.isNaN(d)&&(d=0);let g=l?parseInt(l,10):6,w=d.toFixed(g);if(o){let y=parseInt(o,10);a.includes("-")?w=w.padEnd(y):w=w.padStart(y)}r+=w,c===void 0&&n++;break}case"e":case"E":{let d=m!==void 0?Number(m):0;Number.isNaN(d)&&(d=0);let g=l?parseInt(l,10):6,w=d.toExponential(g);if(p==="E"&&(w=w.toUpperCase()),o){let y=parseInt(o,10);a.includes("-")?w=w.padEnd(y):w=w.padStart(y)}r+=w,c===void 0&&n++;break}case"g":case"G":{let d=m!==void 0?Number(m):0;Number.isNaN(d)&&(d=0);let g=l?parseInt(l,10):6,w=d!==0?Math.floor(Math.log10(Math.abs(d))):0,y;if(d===0?y="0":w<-4||w>=g?(y=d.toExponential(g-1),p==="G"&&(y=y.toUpperCase())):y=d.toPrecision(g),y.includes(".")&&(y=y.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),y.includes("e")&&(y=y.replace(/\.?0+e/,"e")),o){let b=parseInt(o,10);a.includes("-")?y=y.padEnd(b):y=y.padStart(b)}r+=y,c===void 0&&n++;break}case"x":case"X":{let d=m!==void 0?Math.floor(Number(m)):0;Number.isNaN(d)&&(d=0);let g=Math.abs(d).toString(16);if(p==="X"&&(g=g.toUpperCase()),l){let b=parseInt(l,10);g=g.padStart(b,"0")}let w=d<0?"-":"",y=w+g;if(o){let b=parseInt(o,10);a.includes("-")?y=y.padEnd(b):a.includes("0")&&!l?y=w+g.padStart(b-w.length,"0"):y=y.padStart(b)}r+=y,c===void 0&&n++;break}case"o":{let d=m!==void 0?Math.floor(Number(m)):0;Number.isNaN(d)&&(d=0);let g=Math.abs(d).toString(8);if(l){let b=parseInt(l,10);g=g.padStart(b,"0")}let w=d<0?"-":"",y=w+g;if(o){let b=parseInt(o,10);a.includes("-")?y=y.padEnd(b):a.includes("0")&&!l?y=w+g.padStart(b-w.length,"0"):y=y.padStart(b)}r+=y,c===void 0&&n++;break}case"c":{typeof m=="number"?r+=String.fromCharCode(m):r+=String(m??"").charAt(0)||"",c===void 0&&n++;break}case"%":r+="%";break;default:r+=e.substring(s,i+1)}s=i+1}else if(e[s]==="\\"&&s+1<e.length){let i=e[s+1];switch(i){case"n":r+=`
333
- `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;default:r+=i}s+=2}else r+=e[s++];return r}var Yn,v1,Ao=I(()=>{"use strict";Me();Yn=1e4;v1=new Map([["length",k4],["substr",v4],["index",I4],["split",$4],["sub",O4],["gsub",R4],["match",T4],["gensub",P4],["tolower",D4],["toupper",_4],["sprintf",L4],["int",F4],["sqrt",M4],["sin",U4],["cos",B4],["atan2",W4],["log",z4],["exp",H4],["rand",j4],["srand",G4],["system",V4("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",Eo("systime")],["mktime",Eo("mktime")],["strftime",Eo("strftime")]])});function At(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function He(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function Re(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function So(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function hs(e,t){try{return V(e).test(t)}catch{return!1}}var kr=I(()=>{"use strict";Me()});function I1(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function fi(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function Co(e,t,n){if(t===0)e.line=Re(n),e.fields=I1(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=Re(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function vr(e,t){e.line=t,e.fields=I1(e,t),e.NF=e.fields.length}function $1(e,t){if(e.FS=t,t===" ")e.fieldSep=new Cn(/\s+/);else try{e.fieldSep=V(t)}catch{e.fieldSep=V(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}var pi=I(()=>{"use strict";Me();kr()});function hi(e,t){switch(t){case"FS":return e.FS;case"OFS":return e.OFS;case"ORS":return e.ORS;case"OFMT":return e.OFMT;case"NR":return e.NR;case"NF":return e.NF;case"FNR":return e.FNR;case"FILENAME":return e.FILENAME;case"RSTART":return e.RSTART;case"RLENGTH":return e.RLENGTH;case"SUBSEP":return e.SUBSEP;case"ARGC":return e.ARGC}return e.vars[t]??""}function Ir(e,t,n){switch(t){case"FS":$1(e,Re(n));return;case"OFS":e.OFS=Re(n);return;case"ORS":e.ORS=Re(n);return;case"OFMT":e.OFMT=Re(n);return;case"NR":e.NR=Math.floor(He(n));return;case"NF":{let r=Math.floor(He(n));if(r<e.NF)e.fields=e.fields.slice(0,r),e.line=e.fields.join(e.OFS);else if(r>e.NF){for(;e.fields.length<r;)e.fields.push("");e.line=e.fields.join(e.OFS)}e.NF=r;return}case"FNR":e.FNR=Math.floor(He(n));return;case"FILENAME":e.FILENAME=Re(n);return;case"RSTART":e.RSTART=Math.floor(He(n));return;case"RLENGTH":e.RLENGTH=Math.floor(He(n));return;case"SUBSEP":e.SUBSEP=Re(n);return}e.vars[t]=n}function ds(e,t){let n=t,r=new Set,s=e.arrayAliases.get(n);for(;s!==void 0&&!r.has(n);)r.add(n),n=s,s=e.arrayAliases.get(n);return n}function di(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let r=ds(e,t);return e.arrays[r]?.[n]??""}function No(e,t,n,r){let s=ds(e,t);e.arrays[s]||(e.arrays[s]=Object.create(null)),e.arrays[s][n]=r}function O1(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let r=ds(e,t);return e.arrays[r]?.[n]!==void 0}function R1(e,t,n){let r=ds(e,t);e.arrays[r]&&delete e.arrays[r][n]}function T1(e,t){let n=ds(e,t);delete e.arrays[n]}var ko=I(()=>{"use strict";pi();kr()});function P1(e){vo=e}async function le(e,t){switch(e.coverage?.hit(`awk:expr:${t.type}`),t.type){case"number":return t.value;case"string":return t.value;case"regex":return hs(t.pattern,e.line)?1:0;case"field":return q4(e,t);case"variable":return hi(e,t.name);case"array_access":return Z4(e,t);case"binary":return K4(e,t);case"unary":return Y4(e,t);case"ternary":return At(await le(e,t.condition))?await le(e,t.consequent):await le(e,t.alternate);case"call":return J4(e,t.name,t.args);case"assignment":return t3(e,t);case"pre_increment":return n3(e,t.operand);case"pre_decrement":return r3(e,t.operand);case"post_increment":return s3(e,t.operand);case"post_decrement":return i3(e,t.operand);case"in":return a3(e,t.key,t.array);case"getline":return o3(e,t.variable,t.file,t.command);case"tuple":return u3(e,t.elements);default:return""}}async function q4(e,t){let n=Math.floor(He(await le(e,t.index)));return fi(e,n)}async function Z4(e,t){let n=Re(await le(e,t.key));return di(e,t.array,n)}async function K4(e,t){let n=t.operator;if(n==="||")return At(await le(e,t.left))||At(await le(e,t.right))?1:0;if(n==="&&")return At(await le(e,t.left))&&At(await le(e,t.right))?1:0;if(n==="~"){let o=await le(e,t.left);t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:Re(await le(e,t.right));try{return V(l).test(Re(o))?1:0}catch{return 0}}if(n==="!~"){let o=await le(e,t.left);t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:Re(await le(e,t.right));try{return V(l).test(Re(o))?0:1}catch{return 1}}let r=await le(e,t.left),s=await le(e,t.right);if(n===" "){let o=Re(r)+Re(s);if(e.maxOutputSize>0&&o.length>e.maxOutputSize)throw new J(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return o}if(Q4(n))return X4(r,s,n);let i=He(r),a=He(s);return x1(i,a,n)}function Q4(e){return["<","<=",">",">=","==","!="].includes(e)}function X4(e,t,n){let r=So(e),s=So(t);if(r&&s){let o=He(e),l=He(t);switch(n){case"<":return o<l?1:0;case"<=":return o<=l?1:0;case">":return o>l?1:0;case">=":return o>=l?1:0;case"==":return o===l?1:0;case"!=":return o!==l?1:0}}let i=Re(e),a=Re(t);switch(n){case"<":return i<a?1:0;case"<=":return i<=a?1:0;case">":return i>a?1:0;case">=":return i>=a?1:0;case"==":return i===a?1:0;case"!=":return i!==a?1:0}return 0}async function Y4(e,t){let n=await le(e,t.operand);switch(t.operator){case"!":return At(n)?0:1;case"-":return-He(n);case"+":return+He(n);default:return n}}async function J4(e,t,n){let r=v1.get(t);if(r)return r(n,e,{evalExpr:i=>le(e,i)});let s=e.functions.get(t);return s?e3(e,s,n):""}async function e3(e,t,n){if(e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new J(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let r=Object.create(null);for(let a of t.params)r[a]=e.vars[a];let s=[];for(let a=0;a<t.params.length;a++){let o=t.params[a];if(a<n.length){let l=n[a];l.type==="variable"&&(e.arrayAliases.set(o,l.name),s.push(o));let c=await le(e,l);e.vars[o]=c}else e.vars[o]=""}e.hasReturn=!1,e.returnValue=void 0,vo&&await vo(e,t.body.statements);let i=e.returnValue??"";for(let a of t.params)r[a]!==void 0?e.vars[a]=r[a]:delete e.vars[a];for(let a of s)e.arrayAliases.delete(a);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,i}async function t3(e,t){let n=await le(e,t.value),r=t.target,s=t.operator,i;if(s==="=")i=n;else{let a;if(r.type==="field"){let c=Math.floor(He(await le(e,r.index)));a=fi(e,c)}else if(r.type==="variable")a=hi(e,r.name);else{let c=Re(await le(e,r.key));a=di(e,r.array,c)}let o=He(a),l=He(n);switch(s){case"+=":i=o+l;break;case"-=":i=o-l;break;case"*=":i=o*l;break;case"/=":i=l!==0?o/l:0;break;case"%=":i=l!==0?o%l:0;break;case"^=":i=o**l;break;default:i=n}}if(r.type==="field"){let a=Math.floor(He(await le(e,r.index)));Co(e,a,i)}else if(r.type==="variable")Ir(e,r.name,i);else{let a=Re(await le(e,r.key));No(e,r.array,a,i)}return i}async function mi(e,t,n,r){let s;if(t.type==="field"){let i=Math.floor(He(await le(e,t.index)));s=He(fi(e,i)),Co(e,i,s+n)}else if(t.type==="variable")s=He(hi(e,t.name)),Ir(e,t.name,s+n);else{let i=Re(await le(e,t.key));s=He(di(e,t.array,i)),No(e,t.array,i,s+n)}return r?s+n:s}async function n3(e,t){return mi(e,t,1,!0)}async function r3(e,t){return mi(e,t,-1,!0)}async function s3(e,t){return mi(e,t,1,!1)}async function i3(e,t){return mi(e,t,-1,!1)}async function a3(e,t,n){let r;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let s=[];for(let i of t.elements)s.push(Re(await le(e,i)));r=s.join(e.SUBSEP)}else r=Re(await le(e,t));return O1(e,n,r)?1:0}async function o3(e,t,n,r){if(r)return l3(e,t,r);if(n)return c3(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let s=e.lineIndex+1;if(s>=e.lines.length)return 0;let i=e.lines[s];return t?Ir(e,t,i):vr(e,i),e.NR++,e.lineIndex=s,1}async function l3(e,t,n){if(!e.exec)return-1;let r=Re(await le(e,n)),s=`__cmd_${r}`,i=`__cmdi_${r}`,a,o;if(e.vars[s]===void 0)try{a=(await e.exec(r)).stdout.split(`
334
- `),a.length>0&&a[a.length-1]===""&&a.pop(),e.vars[s]=JSON.stringify(a),e.vars[i]=-1,o=-1}catch{return-1}else a=JSON.parse(e.vars[s]),o=e.vars[i];let l=o+1;if(l>=a.length)return 0;let c=a[l];return e.vars[i]=l,t?Ir(e,t,c):vr(e,c),1}async function c3(e,t,n){if(!e.fs||!e.cwd)return-1;let r=Re(await le(e,n));if(r==="/dev/null")return 0;let s=e.fs.resolvePath(e.cwd,r),i=`__fc_${s}`,a=`__fi_${s}`,o,l;if(e.vars[i]===void 0)try{o=(await e.fs.readFile(s)).split(`
335
- `),o.length>0&&o[o.length-1]===""&&o.pop(),e.vars[i]=JSON.stringify(o),e.vars[a]=-1,l=-1}catch{return-1}else o=JSON.parse(e.vars[i]),l=e.vars[a];let c=l+1;if(c>=o.length)return 0;let u=o[c];return e.vars[a]=c,t?Ir(e,t,u):vr(e,u),1}async function u3(e,t){if(t.length===0)return"";for(let n=0;n<t.length-1;n++)await le(e,t[n]);return le(e,t[t.length-1])}var vo,Io=I(()=>{"use strict";ye();Me();E1();Ao();pi();kr();ko();vo=null});function $o(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new J(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}async function $r(e,t){for(let n of t)if(await Jn(e,n),f3(e))break}function f3(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function Jn(e,t){switch(e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await $r(e,t.statements);break;case"expr_stmt":await le(e,t.expression);break;case"print":await p3(e,t.args,t.output);break;case"printf":await h3(e,t.format,t.args,t.output);break;case"if":await d3(e,t);break;case"while":await m3(e,t);break;case"do_while":await g3(e,t);break;case"for":await y3(e,t);break;case"for_in":await w3(e,t);break;case"break":e.loopBreak=!0;break;case"continue":e.loopContinue=!0;break;case"next":e.shouldNext=!0;break;case"nextfile":e.shouldNextFile=!0;break;case"exit":e.shouldExit=!0,e.exitCode=t.code?Math.floor(He(await le(e,t.code))):0;break;case"return":e.hasReturn=!0,e.returnValue=t.value?await le(e,t.value):"";break;case"delete":await b3(e,t.target);break}}async function p3(e,t,n){let r=[];for(let i of t){let a=await le(e,i);typeof a=="number"?Number.isInteger(a)&&Math.abs(a)<Number.MAX_SAFE_INTEGER?r.push(String(a)):r.push(ui(e.OFMT,[a])):r.push(Re(a))}let s=r.join(e.OFS)+e.ORS;n?await D1(e,n.redirect,n.file,s):(e.output+=s,$o(e))}async function h3(e,t,n,r){let s=Re(await le(e,t)),i=[];for(let o of n)i.push(await le(e,o));let a=ui(s,i);r?await D1(e,r.redirect,r.file,a):(e.output+=a,$o(e))}async function D1(e,t,n,r){if(!e.fs||!e.cwd){e.output+=r,$o(e);return}let s=Re(await le(e,n)),i=e.fs.resolvePath(e.cwd,s);t===">"?e.openedFiles.has(i)?await e.fs.appendFile(i,r):(await e.fs.writeFile(i,r),e.openedFiles.add(i)):(e.openedFiles.has(i)||e.openedFiles.add(i),await e.fs.appendFile(i,r))}async function d3(e,t){At(await le(e,t.condition))?await Jn(e,t.consequent):t.alternate&&await Jn(e,t.alternate)}async function m3(e,t){let n=0;for(;At(await le(e,t.condition));){if(n++,n>e.maxIterations)throw new J(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Jn(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function g3(e,t){let n=0;do{if(n++,n>e.maxIterations)throw new J(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Jn(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(At(await le(e,t.condition)))}async function y3(e,t){t.init&&await le(e,t.init);let n=0;for(;!t.condition||At(await le(e,t.condition));){if(n++,n>e.maxIterations)throw new J(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Jn(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;t.update&&await le(e,t.update)}}async function w3(e,t){let n=e.arrays[t.array];if(n)for(let r of Object.keys(n)){if(e.vars[t.variable]=r,e.loopContinue=!1,await Jn(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function b3(e,t){if(t.type==="array_access"){let n=Re(await le(e,t.key));R1(e,t.array,n)}else t.type==="variable"&&T1(e,t.name)}var _1=I(()=>{"use strict";ye();Ao();Io();kr();ko();P1($r)});var ms,L1=I(()=>{"use strict";Io();pi();_1();kr();ms=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}execute(t){this.program=t,this.ctx.output="";for(let n of t.functions)this.ctx.functions.set(n.name,n);this.rangeStates=t.rules.map(()=>!1)}async executeBegin(){if(this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await $r(this.ctx,t.action.statements),this.ctx.shouldExit))break}}async executeLine(t){if(!(!this.program||this.ctx.shouldExit)){vr(this.ctx,t),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let n=0;n<this.program.rules.length&&!(this.ctx.shouldExit||this.ctx.shouldNext||this.ctx.shouldNextFile);n++){let r=this.program.rules[n];r.pattern?.type==="begin"||r.pattern?.type==="end"||await this.matchesRule(r,n)&&await $r(this.ctx,r.action.statements)}}}async executeEnd(){if(this.program&&!this.ctx.inEndBlock){this.ctx.inEndBlock=!0,this.ctx.shouldExit=!1;for(let t of this.program.rules)if(t.pattern?.type==="end"&&(await $r(this.ctx,t.action.statements),this.ctx.shouldExit))break;this.ctx.inEndBlock=!1}}getOutput(){return this.ctx.output}getExitCode(){return this.ctx.exitCode}getContext(){return this.ctx}async matchesRule(t,n){let r=t.pattern;if(!r)return!0;switch(r.type){case"begin":case"end":return!1;case"regex_pattern":return hs(r.pattern,this.ctx.line);case"expr_pattern":return At(await le(this.ctx,r.expression));case"range":{let s=await this.matchPattern(r.start),i=await this.matchPattern(r.end);return this.rangeStates[n]?(i&&(this.rangeStates[n]=!1),!0):s?(this.rangeStates[n]=!0,i&&(this.rangeStates[n]=!1),!0):!1}default:return!1}}async matchPattern(t){switch(t.type){case"regex_pattern":return hs(t.pattern,this.ctx.line);case"expr_pattern":return At(await le(this.ctx,t.expression));default:return!1}}}});var F1=I(()=>{"use strict";b1();L1()});function E3(e){return e.replace(/\[\[:space:\]\]/g,"[ \\t\\n\\r\\f\\v]").replace(/\[\[:blank:\]\]/g,"[ \\t]").replace(/\[\[:alpha:\]\]/g,"[a-zA-Z]").replace(/\[\[:digit:\]\]/g,"[0-9]").replace(/\[\[:alnum:\]\]/g,"[a-zA-Z0-9]").replace(/\[\[:upper:\]\]/g,"[A-Z]").replace(/\[\[:lower:\]\]/g,"[a-z]").replace(/\[\[:punct:\]\]/g,"[!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~]").replace(/\[\[:xdigit:\]\]/g,"[0-9A-Fa-f]").replace(/\[\[:graph:\]\]/g,"[!-~]").replace(/\[\[:print:\]\]/g,"[ -~]").replace(/\[\[:cntrl:\]\]/g,"[\\x00-\\x1f\\x7f]")}var A,x3,gi,M1=I(()=>{"use strict";(function(e){e.NUMBER="NUMBER",e.STRING="STRING",e.REGEX="REGEX",e.IDENT="IDENT",e.BEGIN="BEGIN",e.END="END",e.IF="IF",e.ELSE="ELSE",e.WHILE="WHILE",e.DO="DO",e.FOR="FOR",e.IN="IN",e.BREAK="BREAK",e.CONTINUE="CONTINUE",e.NEXT="NEXT",e.NEXTFILE="NEXTFILE",e.EXIT="EXIT",e.RETURN="RETURN",e.DELETE="DELETE",e.FUNCTION="FUNCTION",e.PRINT="PRINT",e.PRINTF="PRINTF",e.GETLINE="GETLINE",e.PLUS="PLUS",e.MINUS="MINUS",e.STAR="STAR",e.SLASH="SLASH",e.PERCENT="PERCENT",e.CARET="CARET",e.EQ="EQ",e.NE="NE",e.LT="LT",e.GT="GT",e.LE="LE",e.GE="GE",e.MATCH="MATCH",e.NOT_MATCH="NOT_MATCH",e.AND="AND",e.OR="OR",e.NOT="NOT",e.ASSIGN="ASSIGN",e.PLUS_ASSIGN="PLUS_ASSIGN",e.MINUS_ASSIGN="MINUS_ASSIGN",e.STAR_ASSIGN="STAR_ASSIGN",e.SLASH_ASSIGN="SLASH_ASSIGN",e.PERCENT_ASSIGN="PERCENT_ASSIGN",e.CARET_ASSIGN="CARET_ASSIGN",e.INCREMENT="INCREMENT",e.DECREMENT="DECREMENT",e.QUESTION="QUESTION",e.COLON="COLON",e.COMMA="COMMA",e.SEMICOLON="SEMICOLON",e.NEWLINE="NEWLINE",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.LBRACKET="LBRACKET",e.RBRACKET="RBRACKET",e.DOLLAR="DOLLAR",e.APPEND="APPEND",e.PIPE="PIPE",e.EOF="EOF"})(A||(A={}));x3=new Map([["BEGIN",A.BEGIN],["END",A.END],["if",A.IF],["else",A.ELSE],["while",A.WHILE],["do",A.DO],["for",A.FOR],["in",A.IN],["break",A.BREAK],["continue",A.CONTINUE],["next",A.NEXT],["nextfile",A.NEXTFILE],["exit",A.EXIT],["return",A.RETURN],["delete",A.DELETE],["function",A.FUNCTION],["print",A.PRINT],["printf",A.PRINTF],["getline",A.GETLINE]]);gi=class{input;pos=0;line=1;column=1;lastTokenType=null;constructor(t){this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();n&&(t.push(n),this.lastTokenType=n.type)}return t.push(this.makeToken(A.EOF,"")),t}makeToken(t,n){return{type:t,value:n,line:this.line,column:this.column}}peek(t=0){return this.input[this.pos+t]||""}advance(){let t=this.input[this.pos++]||"";return t===`
333
+ `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;default:r+=i}s+=2}else r+=e[s++];return r}var Yn,k1,Ao=I(()=>{"use strict";Me();Yn=1e4;k1=new Map([["length",v4],["substr",k4],["index",I4],["split",$4],["sub",O4],["gsub",R4],["match",T4],["gensub",P4],["tolower",D4],["toupper",_4],["sprintf",L4],["int",F4],["sqrt",M4],["sin",U4],["cos",B4],["atan2",W4],["log",z4],["exp",H4],["rand",j4],["srand",G4],["system",V4("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",Eo("systime")],["mktime",Eo("mktime")],["strftime",Eo("strftime")]])});function At(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function He(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function Re(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function So(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function hs(e,t){try{return V(e).test(t)}catch{return!1}}var vr=I(()=>{"use strict";Me()});function I1(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function fi(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function Co(e,t,n){if(t===0)e.line=Re(n),e.fields=I1(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=Re(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function kr(e,t){e.line=t,e.fields=I1(e,t),e.NF=e.fields.length}function $1(e,t){if(e.FS=t,t===" ")e.fieldSep=new Cn(/\s+/);else try{e.fieldSep=V(t)}catch{e.fieldSep=V(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}var pi=I(()=>{"use strict";Me();vr()});function hi(e,t){switch(t){case"FS":return e.FS;case"OFS":return e.OFS;case"ORS":return e.ORS;case"OFMT":return e.OFMT;case"NR":return e.NR;case"NF":return e.NF;case"FNR":return e.FNR;case"FILENAME":return e.FILENAME;case"RSTART":return e.RSTART;case"RLENGTH":return e.RLENGTH;case"SUBSEP":return e.SUBSEP;case"ARGC":return e.ARGC}return e.vars[t]??""}function Ir(e,t,n){switch(t){case"FS":$1(e,Re(n));return;case"OFS":e.OFS=Re(n);return;case"ORS":e.ORS=Re(n);return;case"OFMT":e.OFMT=Re(n);return;case"NR":e.NR=Math.floor(He(n));return;case"NF":{let r=Math.floor(He(n));if(r<e.NF)e.fields=e.fields.slice(0,r),e.line=e.fields.join(e.OFS);else if(r>e.NF){for(;e.fields.length<r;)e.fields.push("");e.line=e.fields.join(e.OFS)}e.NF=r;return}case"FNR":e.FNR=Math.floor(He(n));return;case"FILENAME":e.FILENAME=Re(n);return;case"RSTART":e.RSTART=Math.floor(He(n));return;case"RLENGTH":e.RLENGTH=Math.floor(He(n));return;case"SUBSEP":e.SUBSEP=Re(n);return}e.vars[t]=n}function ds(e,t){let n=t,r=new Set,s=e.arrayAliases.get(n);for(;s!==void 0&&!r.has(n);)r.add(n),n=s,s=e.arrayAliases.get(n);return n}function di(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let r=ds(e,t);return e.arrays[r]?.[n]??""}function No(e,t,n,r){let s=ds(e,t);e.arrays[s]||(e.arrays[s]=Object.create(null)),e.arrays[s][n]=r}function O1(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let r=ds(e,t);return e.arrays[r]?.[n]!==void 0}function R1(e,t,n){let r=ds(e,t);e.arrays[r]&&delete e.arrays[r][n]}function T1(e,t){let n=ds(e,t);delete e.arrays[n]}var vo=I(()=>{"use strict";pi();vr()});function P1(e){ko=e}async function le(e,t){switch(e.coverage?.hit(`awk:expr:${t.type}`),t.type){case"number":return t.value;case"string":return t.value;case"regex":return hs(t.pattern,e.line)?1:0;case"field":return q4(e,t);case"variable":return hi(e,t.name);case"array_access":return Z4(e,t);case"binary":return K4(e,t);case"unary":return Y4(e,t);case"ternary":return At(await le(e,t.condition))?await le(e,t.consequent):await le(e,t.alternate);case"call":return J4(e,t.name,t.args);case"assignment":return t3(e,t);case"pre_increment":return n3(e,t.operand);case"pre_decrement":return r3(e,t.operand);case"post_increment":return s3(e,t.operand);case"post_decrement":return i3(e,t.operand);case"in":return a3(e,t.key,t.array);case"getline":return o3(e,t.variable,t.file,t.command);case"tuple":return u3(e,t.elements);default:return""}}async function q4(e,t){let n=Math.floor(He(await le(e,t.index)));return fi(e,n)}async function Z4(e,t){let n=Re(await le(e,t.key));return di(e,t.array,n)}async function K4(e,t){let n=t.operator;if(n==="||")return At(await le(e,t.left))||At(await le(e,t.right))?1:0;if(n==="&&")return At(await le(e,t.left))&&At(await le(e,t.right))?1:0;if(n==="~"){let o=await le(e,t.left);t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:Re(await le(e,t.right));try{return V(l).test(Re(o))?1:0}catch{return 0}}if(n==="!~"){let o=await le(e,t.left);t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:Re(await le(e,t.right));try{return V(l).test(Re(o))?0:1}catch{return 1}}let r=await le(e,t.left),s=await le(e,t.right);if(n===" "){let o=Re(r)+Re(s);if(e.maxOutputSize>0&&o.length>e.maxOutputSize)throw new J(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return o}if(Q4(n))return X4(r,s,n);let i=He(r),a=He(s);return x1(i,a,n)}function Q4(e){return["<","<=",">",">=","==","!="].includes(e)}function X4(e,t,n){let r=So(e),s=So(t);if(r&&s){let o=He(e),l=He(t);switch(n){case"<":return o<l?1:0;case"<=":return o<=l?1:0;case">":return o>l?1:0;case">=":return o>=l?1:0;case"==":return o===l?1:0;case"!=":return o!==l?1:0}}let i=Re(e),a=Re(t);switch(n){case"<":return i<a?1:0;case"<=":return i<=a?1:0;case">":return i>a?1:0;case">=":return i>=a?1:0;case"==":return i===a?1:0;case"!=":return i!==a?1:0}return 0}async function Y4(e,t){let n=await le(e,t.operand);switch(t.operator){case"!":return At(n)?0:1;case"-":return-He(n);case"+":return+He(n);default:return n}}async function J4(e,t,n){let r=k1.get(t);if(r)return r(n,e,{evalExpr:i=>le(e,i)});let s=e.functions.get(t);return s?e3(e,s,n):""}async function e3(e,t,n){if(e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new J(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let r=Object.create(null);for(let a of t.params)r[a]=e.vars[a];let s=[];for(let a=0;a<t.params.length;a++){let o=t.params[a];if(a<n.length){let l=n[a];l.type==="variable"&&(e.arrayAliases.set(o,l.name),s.push(o));let c=await le(e,l);e.vars[o]=c}else e.vars[o]=""}e.hasReturn=!1,e.returnValue=void 0,ko&&await ko(e,t.body.statements);let i=e.returnValue??"";for(let a of t.params)r[a]!==void 0?e.vars[a]=r[a]:delete e.vars[a];for(let a of s)e.arrayAliases.delete(a);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,i}async function t3(e,t){let n=await le(e,t.value),r=t.target,s=t.operator,i;if(s==="=")i=n;else{let a;if(r.type==="field"){let c=Math.floor(He(await le(e,r.index)));a=fi(e,c)}else if(r.type==="variable")a=hi(e,r.name);else{let c=Re(await le(e,r.key));a=di(e,r.array,c)}let o=He(a),l=He(n);switch(s){case"+=":i=o+l;break;case"-=":i=o-l;break;case"*=":i=o*l;break;case"/=":i=l!==0?o/l:0;break;case"%=":i=l!==0?o%l:0;break;case"^=":i=o**l;break;default:i=n}}if(r.type==="field"){let a=Math.floor(He(await le(e,r.index)));Co(e,a,i)}else if(r.type==="variable")Ir(e,r.name,i);else{let a=Re(await le(e,r.key));No(e,r.array,a,i)}return i}async function mi(e,t,n,r){let s;if(t.type==="field"){let i=Math.floor(He(await le(e,t.index)));s=He(fi(e,i)),Co(e,i,s+n)}else if(t.type==="variable")s=He(hi(e,t.name)),Ir(e,t.name,s+n);else{let i=Re(await le(e,t.key));s=He(di(e,t.array,i)),No(e,t.array,i,s+n)}return r?s+n:s}async function n3(e,t){return mi(e,t,1,!0)}async function r3(e,t){return mi(e,t,-1,!0)}async function s3(e,t){return mi(e,t,1,!1)}async function i3(e,t){return mi(e,t,-1,!1)}async function a3(e,t,n){let r;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let s=[];for(let i of t.elements)s.push(Re(await le(e,i)));r=s.join(e.SUBSEP)}else r=Re(await le(e,t));return O1(e,n,r)?1:0}async function o3(e,t,n,r){if(r)return l3(e,t,r);if(n)return c3(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let s=e.lineIndex+1;if(s>=e.lines.length)return 0;let i=e.lines[s];return t?Ir(e,t,i):kr(e,i),e.NR++,e.lineIndex=s,1}async function l3(e,t,n){if(!e.exec)return-1;let r=Re(await le(e,n)),s=`__cmd_${r}`,i=`__cmdi_${r}`,a,o;if(e.vars[s]===void 0)try{a=(await e.exec(r)).stdout.split(`
334
+ `),a.length>0&&a[a.length-1]===""&&a.pop(),e.vars[s]=JSON.stringify(a),e.vars[i]=-1,o=-1}catch{return-1}else a=JSON.parse(e.vars[s]),o=e.vars[i];let l=o+1;if(l>=a.length)return 0;let c=a[l];return e.vars[i]=l,t?Ir(e,t,c):kr(e,c),1}async function c3(e,t,n){if(!e.fs||!e.cwd)return-1;let r=Re(await le(e,n));if(r==="/dev/null")return 0;let s=e.fs.resolvePath(e.cwd,r),i=`__fc_${s}`,a=`__fi_${s}`,o,l;if(e.vars[i]===void 0)try{o=(await e.fs.readFile(s)).split(`
335
+ `),o.length>0&&o[o.length-1]===""&&o.pop(),e.vars[i]=JSON.stringify(o),e.vars[a]=-1,l=-1}catch{return-1}else o=JSON.parse(e.vars[i]),l=e.vars[a];let c=l+1;if(c>=o.length)return 0;let u=o[c];return e.vars[a]=c,t?Ir(e,t,u):kr(e,u),1}async function u3(e,t){if(t.length===0)return"";for(let n=0;n<t.length-1;n++)await le(e,t[n]);return le(e,t[t.length-1])}var ko,Io=I(()=>{"use strict";ye();Me();E1();Ao();pi();vr();vo();ko=null});function $o(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new J(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}async function $r(e,t){for(let n of t)if(await Jn(e,n),f3(e))break}function f3(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function Jn(e,t){switch(e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await $r(e,t.statements);break;case"expr_stmt":await le(e,t.expression);break;case"print":await p3(e,t.args,t.output);break;case"printf":await h3(e,t.format,t.args,t.output);break;case"if":await d3(e,t);break;case"while":await m3(e,t);break;case"do_while":await g3(e,t);break;case"for":await y3(e,t);break;case"for_in":await w3(e,t);break;case"break":e.loopBreak=!0;break;case"continue":e.loopContinue=!0;break;case"next":e.shouldNext=!0;break;case"nextfile":e.shouldNextFile=!0;break;case"exit":e.shouldExit=!0,e.exitCode=t.code?Math.floor(He(await le(e,t.code))):0;break;case"return":e.hasReturn=!0,e.returnValue=t.value?await le(e,t.value):"";break;case"delete":await b3(e,t.target);break}}async function p3(e,t,n){let r=[];for(let i of t){let a=await le(e,i);typeof a=="number"?Number.isInteger(a)&&Math.abs(a)<Number.MAX_SAFE_INTEGER?r.push(String(a)):r.push(ui(e.OFMT,[a])):r.push(Re(a))}let s=r.join(e.OFS)+e.ORS;n?await D1(e,n.redirect,n.file,s):(e.output+=s,$o(e))}async function h3(e,t,n,r){let s=Re(await le(e,t)),i=[];for(let o of n)i.push(await le(e,o));let a=ui(s,i);r?await D1(e,r.redirect,r.file,a):(e.output+=a,$o(e))}async function D1(e,t,n,r){if(!e.fs||!e.cwd){e.output+=r,$o(e);return}let s=Re(await le(e,n)),i=e.fs.resolvePath(e.cwd,s);t===">"?e.openedFiles.has(i)?await e.fs.appendFile(i,r):(await e.fs.writeFile(i,r),e.openedFiles.add(i)):(e.openedFiles.has(i)||e.openedFiles.add(i),await e.fs.appendFile(i,r))}async function d3(e,t){At(await le(e,t.condition))?await Jn(e,t.consequent):t.alternate&&await Jn(e,t.alternate)}async function m3(e,t){let n=0;for(;At(await le(e,t.condition));){if(n++,n>e.maxIterations)throw new J(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Jn(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function g3(e,t){let n=0;do{if(n++,n>e.maxIterations)throw new J(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Jn(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(At(await le(e,t.condition)))}async function y3(e,t){t.init&&await le(e,t.init);let n=0;for(;!t.condition||At(await le(e,t.condition));){if(n++,n>e.maxIterations)throw new J(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Jn(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;t.update&&await le(e,t.update)}}async function w3(e,t){let n=e.arrays[t.array];if(n)for(let r of Object.keys(n)){if(e.vars[t.variable]=r,e.loopContinue=!1,await Jn(e,t.body),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function b3(e,t){if(t.type==="array_access"){let n=Re(await le(e,t.key));R1(e,t.array,n)}else t.type==="variable"&&T1(e,t.name)}var _1=I(()=>{"use strict";ye();Ao();Io();vr();vo();P1($r)});var ms,L1=I(()=>{"use strict";Io();pi();_1();vr();ms=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}execute(t){this.program=t,this.ctx.output="";for(let n of t.functions)this.ctx.functions.set(n.name,n);this.rangeStates=t.rules.map(()=>!1)}async executeBegin(){if(this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await $r(this.ctx,t.action.statements),this.ctx.shouldExit))break}}async executeLine(t){if(!(!this.program||this.ctx.shouldExit)){kr(this.ctx,t),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let n=0;n<this.program.rules.length&&!(this.ctx.shouldExit||this.ctx.shouldNext||this.ctx.shouldNextFile);n++){let r=this.program.rules[n];r.pattern?.type==="begin"||r.pattern?.type==="end"||await this.matchesRule(r,n)&&await $r(this.ctx,r.action.statements)}}}async executeEnd(){if(this.program&&!this.ctx.inEndBlock){this.ctx.inEndBlock=!0,this.ctx.shouldExit=!1;for(let t of this.program.rules)if(t.pattern?.type==="end"&&(await $r(this.ctx,t.action.statements),this.ctx.shouldExit))break;this.ctx.inEndBlock=!1}}getOutput(){return this.ctx.output}getExitCode(){return this.ctx.exitCode}getContext(){return this.ctx}async matchesRule(t,n){let r=t.pattern;if(!r)return!0;switch(r.type){case"begin":case"end":return!1;case"regex_pattern":return hs(r.pattern,this.ctx.line);case"expr_pattern":return At(await le(this.ctx,r.expression));case"range":{let s=await this.matchPattern(r.start),i=await this.matchPattern(r.end);return this.rangeStates[n]?(i&&(this.rangeStates[n]=!1),!0):s?(this.rangeStates[n]=!0,i&&(this.rangeStates[n]=!1),!0):!1}default:return!1}}async matchPattern(t){switch(t.type){case"regex_pattern":return hs(t.pattern,this.ctx.line);case"expr_pattern":return At(await le(this.ctx,t.expression));default:return!1}}}});var F1=I(()=>{"use strict";b1();L1()});function E3(e){return e.replace(/\[\[:space:\]\]/g,"[ \\t\\n\\r\\f\\v]").replace(/\[\[:blank:\]\]/g,"[ \\t]").replace(/\[\[:alpha:\]\]/g,"[a-zA-Z]").replace(/\[\[:digit:\]\]/g,"[0-9]").replace(/\[\[:alnum:\]\]/g,"[a-zA-Z0-9]").replace(/\[\[:upper:\]\]/g,"[A-Z]").replace(/\[\[:lower:\]\]/g,"[a-z]").replace(/\[\[:punct:\]\]/g,"[!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~]").replace(/\[\[:xdigit:\]\]/g,"[0-9A-Fa-f]").replace(/\[\[:graph:\]\]/g,"[!-~]").replace(/\[\[:print:\]\]/g,"[ -~]").replace(/\[\[:cntrl:\]\]/g,"[\\x00-\\x1f\\x7f]")}var A,x3,gi,M1=I(()=>{"use strict";(function(e){e.NUMBER="NUMBER",e.STRING="STRING",e.REGEX="REGEX",e.IDENT="IDENT",e.BEGIN="BEGIN",e.END="END",e.IF="IF",e.ELSE="ELSE",e.WHILE="WHILE",e.DO="DO",e.FOR="FOR",e.IN="IN",e.BREAK="BREAK",e.CONTINUE="CONTINUE",e.NEXT="NEXT",e.NEXTFILE="NEXTFILE",e.EXIT="EXIT",e.RETURN="RETURN",e.DELETE="DELETE",e.FUNCTION="FUNCTION",e.PRINT="PRINT",e.PRINTF="PRINTF",e.GETLINE="GETLINE",e.PLUS="PLUS",e.MINUS="MINUS",e.STAR="STAR",e.SLASH="SLASH",e.PERCENT="PERCENT",e.CARET="CARET",e.EQ="EQ",e.NE="NE",e.LT="LT",e.GT="GT",e.LE="LE",e.GE="GE",e.MATCH="MATCH",e.NOT_MATCH="NOT_MATCH",e.AND="AND",e.OR="OR",e.NOT="NOT",e.ASSIGN="ASSIGN",e.PLUS_ASSIGN="PLUS_ASSIGN",e.MINUS_ASSIGN="MINUS_ASSIGN",e.STAR_ASSIGN="STAR_ASSIGN",e.SLASH_ASSIGN="SLASH_ASSIGN",e.PERCENT_ASSIGN="PERCENT_ASSIGN",e.CARET_ASSIGN="CARET_ASSIGN",e.INCREMENT="INCREMENT",e.DECREMENT="DECREMENT",e.QUESTION="QUESTION",e.COLON="COLON",e.COMMA="COMMA",e.SEMICOLON="SEMICOLON",e.NEWLINE="NEWLINE",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.LBRACE="LBRACE",e.RBRACE="RBRACE",e.LBRACKET="LBRACKET",e.RBRACKET="RBRACKET",e.DOLLAR="DOLLAR",e.APPEND="APPEND",e.PIPE="PIPE",e.EOF="EOF"})(A||(A={}));x3=new Map([["BEGIN",A.BEGIN],["END",A.END],["if",A.IF],["else",A.ELSE],["while",A.WHILE],["do",A.DO],["for",A.FOR],["in",A.IN],["break",A.BREAK],["continue",A.CONTINUE],["next",A.NEXT],["nextfile",A.NEXTFILE],["exit",A.EXIT],["return",A.RETURN],["delete",A.DELETE],["function",A.FUNCTION],["print",A.PRINT],["printf",A.PRINTF],["getline",A.GETLINE]]);gi=class{input;pos=0;line=1;column=1;lastTokenType=null;constructor(t){this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();n&&(t.push(n),this.lastTokenType=n.type)}return t.push(this.makeToken(A.EOF,"")),t}makeToken(t,n){return{type:t,value:n,line:this.line,column:this.column}}peek(t=0){return this.input[this.pos+t]||""}advance(){let t=this.input[this.pos++]||"";return t===`
336
336
  `?(this.line++,this.column=1):this.column++,t}skipWhitespace(){for(;this.pos<this.input.length;){let t=this.peek();if(t===" "||t===" "||t==="\r")this.advance();else if(t==="\\")if(this.peek(1)===`
337
337
  `)this.advance(),this.advance();else break;else if(t==="#")for(;this.pos<this.input.length&&this.peek()!==`
338
338
  `;)this.advance();else break}}nextToken(){if(this.skipWhitespace(),this.pos>=this.input.length)return null;let t=this.line,n=this.column,r=this.peek();return r===`
339
339
  `?(this.advance(),{type:A.NEWLINE,value:`
340
340
  `,line:t,column:n}):r==='"'?this.readString():r==="/"&&this.canBeRegex()?this.readRegex():this.isDigit(r)||r==="."&&this.isDigit(this.peek(1))?this.readNumber():this.isAlpha(r)||r==="_"?this.readIdentifier():this.readOperator()}canBeRegex(){return new Set([null,A.NEWLINE,A.SEMICOLON,A.LBRACE,A.RBRACE,A.LPAREN,A.LBRACKET,A.COMMA,A.ASSIGN,A.PLUS_ASSIGN,A.MINUS_ASSIGN,A.STAR_ASSIGN,A.SLASH_ASSIGN,A.PERCENT_ASSIGN,A.CARET_ASSIGN,A.AND,A.OR,A.NOT,A.MATCH,A.NOT_MATCH,A.QUESTION,A.COLON,A.LT,A.GT,A.LE,A.GE,A.EQ,A.NE,A.PLUS,A.MINUS,A.STAR,A.PERCENT,A.CARET,A.PRINT,A.PRINTF,A.IF,A.WHILE,A.DO,A.FOR,A.RETURN]).has(this.lastTokenType)}readString(){let t=this.line,n=this.column;this.advance();let r="";for(;this.pos<this.input.length&&this.peek()!=='"';)if(this.peek()==="\\"){this.advance();let s=this.advance();switch(s){case"n":r+=`
341
341
  `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"f":r+="\f";break;case"b":r+="\b";break;case"v":r+="\v";break;case"a":r+="\x07";break;case"\\":r+="\\";break;case'"':r+='"';break;case"/":r+="/";break;case"x":{let i="";for(;i.length<2&&/[0-9a-fA-F]/.test(this.peek());)i+=this.advance();i.length>0?r+=String.fromCharCode(parseInt(i,16)):r+="x";break}default:if(/[0-7]/.test(s)){let i=s;for(;i.length<3&&/[0-7]/.test(this.peek());)i+=this.advance();r+=String.fromCharCode(parseInt(i,8))}else r+=s}}else r+=this.advance();return this.peek()==='"'&&this.advance(),{type:A.STRING,value:r,line:t,column:n}}readRegex(){let t=this.line,n=this.column;this.advance();let r="";for(;this.pos<this.input.length&&this.peek()!=="/";)if(this.peek()==="\\")r+=this.advance(),this.pos<this.input.length&&(r+=this.advance());else{if(this.peek()===`
342
- `)break;r+=this.advance()}return this.peek()==="/"&&this.advance(),r=E3(r),{type:A.REGEX,value:r,line:t,column:n}}readNumber(){let t=this.line,n=this.column,r="";for(;this.isDigit(this.peek());)r+=this.advance();if(this.peek()==="."&&this.isDigit(this.peek(1)))for(r+=this.advance();this.isDigit(this.peek());)r+=this.advance();if(this.peek()==="e"||this.peek()==="E")for(r+=this.advance(),(this.peek()==="+"||this.peek()==="-")&&(r+=this.advance());this.isDigit(this.peek());)r+=this.advance();return{type:A.NUMBER,value:parseFloat(r),line:t,column:n}}readIdentifier(){let t=this.line,n=this.column,r="";for(;this.isAlphaNumeric(this.peek())||this.peek()==="_";)r+=this.advance();let s=x3.get(r);return s!==void 0?{type:s,value:r,line:t,column:n}:{type:A.IDENT,value:r,line:t,column:n}}readOperator(){let t=this.line,n=this.column,r=this.advance(),s=this.peek();switch(r){case"+":return s==="+"?(this.advance(),{type:A.INCREMENT,value:"++",line:t,column:n}):s==="="?(this.advance(),{type:A.PLUS_ASSIGN,value:"+=",line:t,column:n}):{type:A.PLUS,value:"+",line:t,column:n};case"-":return s==="-"?(this.advance(),{type:A.DECREMENT,value:"--",line:t,column:n}):s==="="?(this.advance(),{type:A.MINUS_ASSIGN,value:"-=",line:t,column:n}):{type:A.MINUS,value:"-",line:t,column:n};case"*":return s==="*"?(this.advance(),{type:A.CARET,value:"**",line:t,column:n}):s==="="?(this.advance(),{type:A.STAR_ASSIGN,value:"*=",line:t,column:n}):{type:A.STAR,value:"*",line:t,column:n};case"/":return s==="="?(this.advance(),{type:A.SLASH_ASSIGN,value:"/=",line:t,column:n}):{type:A.SLASH,value:"/",line:t,column:n};case"%":return s==="="?(this.advance(),{type:A.PERCENT_ASSIGN,value:"%=",line:t,column:n}):{type:A.PERCENT,value:"%",line:t,column:n};case"^":return s==="="?(this.advance(),{type:A.CARET_ASSIGN,value:"^=",line:t,column:n}):{type:A.CARET,value:"^",line:t,column:n};case"=":return s==="="?(this.advance(),{type:A.EQ,value:"==",line:t,column:n}):{type:A.ASSIGN,value:"=",line:t,column:n};case"!":return s==="="?(this.advance(),{type:A.NE,value:"!=",line:t,column:n}):s==="~"?(this.advance(),{type:A.NOT_MATCH,value:"!~",line:t,column:n}):{type:A.NOT,value:"!",line:t,column:n};case"<":return s==="="?(this.advance(),{type:A.LE,value:"<=",line:t,column:n}):{type:A.LT,value:"<",line:t,column:n};case">":return s==="="?(this.advance(),{type:A.GE,value:">=",line:t,column:n}):s===">"?(this.advance(),{type:A.APPEND,value:">>",line:t,column:n}):{type:A.GT,value:">",line:t,column:n};case"&":return s==="&"?(this.advance(),{type:A.AND,value:"&&",line:t,column:n}):{type:A.IDENT,value:"&",line:t,column:n};case"|":return s==="|"?(this.advance(),{type:A.OR,value:"||",line:t,column:n}):{type:A.PIPE,value:"|",line:t,column:n};case"~":return{type:A.MATCH,value:"~",line:t,column:n};case"?":return{type:A.QUESTION,value:"?",line:t,column:n};case":":return{type:A.COLON,value:":",line:t,column:n};case",":return{type:A.COMMA,value:",",line:t,column:n};case";":return{type:A.SEMICOLON,value:";",line:t,column:n};case"(":return{type:A.LPAREN,value:"(",line:t,column:n};case")":return{type:A.RPAREN,value:")",line:t,column:n};case"{":return{type:A.LBRACE,value:"{",line:t,column:n};case"}":return{type:A.RBRACE,value:"}",line:t,column:n};case"[":return{type:A.LBRACKET,value:"[",line:t,column:n};case"]":return{type:A.RBRACKET,value:"]",line:t,column:n};case"$":return{type:A.DOLLAR,value:"$",line:t,column:n};default:return{type:A.IDENT,value:r,line:t,column:n}}}isDigit(t){return t>="0"&&t<="9"}isAlpha(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isAlphaNumeric(t){return this.isDigit(t)||this.isAlpha(t)}}});function H1(e){e.expect(Z.PRINT);let t=[];if(e.check(Z.NEWLINE)||e.check(Z.SEMICOLON)||e.check(Z.RBRACE)||e.check(Z.PIPE)||e.check(Z.GT)||e.check(Z.APPEND))t.push({type:"field",index:{type:"number",value:0}});else for(t.push(yi(e));e.check(Z.COMMA);)e.advance(),t.push(yi(e));let n;return e.check(Z.GT)?(e.advance(),n={redirect:">",file:e.parsePrimary()}):e.check(Z.APPEND)&&(e.advance(),n={redirect:">>",file:e.parsePrimary()}),{type:"print",args:t,output:n}}function yi(e){return A3(e)?Oo(e,!0):Oo(e,!1)}function Oo(e,t){let n=t?e.parseTernary():S3(e);if(e.match(Z.ASSIGN,Z.PLUS_ASSIGN,Z.MINUS_ASSIGN,Z.STAR_ASSIGN,Z.SLASH_ASSIGN,Z.PERCENT_ASSIGN,Z.CARET_ASSIGN)){let r=e.advance(),s=Oo(e,t);if(n.type!=="variable"&&n.type!=="field"&&n.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:new Map([["=","="],["+=","+="],["-=","-="],["*=","*="],["/=","/="],["%=","%="],["^=","^="]]).get(r.value)??"=",target:n,value:s}}return n}function A3(e){let t=0,n=e.pos;for(;n<e.tokens.length;){let r=e.tokens[n];if(r.type===Z.LPAREN&&t++,r.type===Z.RPAREN&&t--,r.type===Z.QUESTION&&t===0)return!0;if(r.type===Z.NEWLINE||r.type===Z.SEMICOLON||r.type===Z.RBRACE||r.type===Z.COMMA||r.type===Z.PIPE)return!1;n++}return!1}function S3(e){let t=U1(e);for(;e.check(Z.OR);){e.advance();let n=U1(e);t={type:"binary",operator:"||",left:t,right:n}}return t}function U1(e){let t=B1(e);for(;e.check(Z.AND);){e.advance();let n=B1(e);t={type:"binary",operator:"&&",left:t,right:n}}return t}function B1(e){let t=C3(e);if(e.check(Z.IN)){e.advance();let n=String(e.expect(Z.IDENT).value);return{type:"in",key:t,array:n}}return t}function C3(e){let t=W1(e);for(;N3(e)&&!k3(e);){let n=W1(e);t={type:"binary",operator:" ",left:t,right:n}}return t}function W1(e){let t=z1(e);for(;e.match(Z.MATCH,Z.NOT_MATCH);){let n=e.advance().type===Z.MATCH?"~":"!~",r=z1(e);t={type:"binary",operator:n,left:t,right:r}}return t}function z1(e){let t=e.parseAddSub();for(;e.match(Z.LT,Z.LE,Z.GE,Z.EQ,Z.NE);){let n=e.advance(),r=e.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:r}}return t}function N3(e){return e.match(Z.NUMBER,Z.STRING,Z.IDENT,Z.DOLLAR,Z.LPAREN,Z.NOT,Z.MINUS,Z.PLUS,Z.INCREMENT,Z.DECREMENT)}function k3(e){return e.match(Z.AND,Z.OR,Z.QUESTION,Z.ASSIGN,Z.PLUS_ASSIGN,Z.MINUS_ASSIGN,Z.STAR_ASSIGN,Z.SLASH_ASSIGN,Z.PERCENT_ASSIGN,Z.CARET_ASSIGN,Z.COMMA,Z.SEMICOLON,Z.NEWLINE,Z.RBRACE,Z.RPAREN,Z.RBRACKET,Z.COLON,Z.PIPE,Z.APPEND,Z.GT,Z.IN)}function j1(e){e.expect(Z.PRINTF);let t=e.check(Z.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():yi(e),r=[];for(;e.check(Z.COMMA);)e.advance(),t&&e.skipNewlines(),r.push(t?e.parseExpression():yi(e));t&&(e.skipNewlines(),e.expect(Z.RPAREN));let s;return e.check(Z.GT)?(e.advance(),s={redirect:">",file:e.parsePrimary()}):e.check(Z.APPEND)&&(e.advance(),s={redirect:">>",file:e.parsePrimary()}),{type:"printf",format:n,args:r,output:s}}var Z,G1=I(()=>{"use strict";Z={LPAREN:"LPAREN",RPAREN:"RPAREN",QUESTION:"QUESTION",NEWLINE:"NEWLINE",SEMICOLON:"SEMICOLON",RBRACE:"RBRACE",COMMA:"COMMA",PIPE:"PIPE",GT:"GT",APPEND:"APPEND",AND:"AND",OR:"OR",ASSIGN:"ASSIGN",PLUS_ASSIGN:"PLUS_ASSIGN",MINUS_ASSIGN:"MINUS_ASSIGN",STAR_ASSIGN:"STAR_ASSIGN",SLASH_ASSIGN:"SLASH_ASSIGN",PERCENT_ASSIGN:"PERCENT_ASSIGN",CARET_ASSIGN:"CARET_ASSIGN",RBRACKET:"RBRACKET",COLON:"COLON",IN:"IN",PRINT:"PRINT",PRINTF:"PRINTF",IDENT:"IDENT",LT:"LT",LE:"LE",GE:"GE",EQ:"EQ",NE:"NE",MATCH:"MATCH",NOT_MATCH:"NOT_MATCH",NUMBER:"NUMBER",STRING:"STRING",DOLLAR:"DOLLAR",NOT:"NOT",MINUS:"MINUS",PLUS:"PLUS",INCREMENT:"INCREMENT",DECREMENT:"DECREMENT"}});var wi,V1=I(()=>{"use strict";M1();G1();wi=class{tokens=[];pos=0;parse(t){let n=new gi(t);return this.tokens=n.tokenize(),this.pos=0,this.parseProgram()}setPos(t){this.pos=t}current(){return this.tokens[this.pos]||{type:A.EOF,value:"",line:0,column:0}}advance(){let t=this.current();return this.pos<this.tokens.length&&this.pos++,t}match(...t){return t.includes(this.current().type)}check(t){return this.current().type===t}expect(t,n){if(!this.check(t)){let r=this.current();throw new Error(n||`Expected ${t}, got ${r.type} at line ${r.line}:${r.column}`)}return this.advance()}skipNewlines(){for(;this.check(A.NEWLINE);)this.advance()}skipTerminators(){for(;this.check(A.NEWLINE)||this.check(A.SEMICOLON);)this.advance()}parseProgram(){let t=[],n=[];for(this.skipNewlines();!this.check(A.EOF)&&(this.skipNewlines(),!this.check(A.EOF));)this.check(A.FUNCTION)?t.push(this.parseFunction()):n.push(this.parseRule()),this.skipTerminators();return{functions:t,rules:n}}parseFunction(){this.expect(A.FUNCTION);let t=this.expect(A.IDENT).value;this.expect(A.LPAREN);let n=[];if(!this.check(A.RPAREN))for(n.push(this.expect(A.IDENT).value);this.check(A.COMMA);)this.advance(),n.push(this.expect(A.IDENT).value);this.expect(A.RPAREN),this.skipNewlines();let r=this.parseBlock();return{name:t,params:n,body:r}}parseRule(){let t;if(this.check(A.BEGIN))this.advance(),t={type:"begin"};else if(this.check(A.END))this.advance(),t={type:"end"};else if(this.check(A.LBRACE))t=void 0;else if(this.check(A.REGEX)){let r=this.advance();if(this.check(A.AND)||this.check(A.OR)){let s={type:"binary",operator:"~",left:{type:"field",index:{type:"number",value:0}},right:{type:"regex",pattern:r.value}};t={type:"expr_pattern",expression:this.parseLogicalOrRest(s)}}else{let s={type:"regex_pattern",pattern:r.value};if(this.check(A.COMMA)){this.advance();let i;this.check(A.REGEX)?i={type:"regex_pattern",pattern:this.advance().value}:i={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:i}}else t=s}}else{let s={type:"expr_pattern",expression:this.parseExpression()};if(this.check(A.COMMA)){this.advance();let i;this.check(A.REGEX)?i={type:"regex_pattern",pattern:this.advance().value}:i={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:i}}else t=s}this.skipNewlines();let n;return this.check(A.LBRACE)?n=this.parseBlock():n={type:"block",statements:[{type:"print",args:[{type:"field",index:{type:"number",value:0}}]}]},{pattern:t,action:n}}parseBlock(){this.expect(A.LBRACE),this.skipNewlines();let t=[];for(;!this.check(A.RBRACE)&&!this.check(A.EOF);)t.push(this.parseStatement()),this.skipTerminators();return this.expect(A.RBRACE),{type:"block",statements:t}}parseStatement(){if(this.check(A.SEMICOLON)||this.check(A.NEWLINE))return this.advance(),{type:"block",statements:[]};if(this.check(A.LBRACE))return this.parseBlock();if(this.check(A.IF))return this.parseIf();if(this.check(A.WHILE))return this.parseWhile();if(this.check(A.DO))return this.parseDoWhile();if(this.check(A.FOR))return this.parseFor();if(this.check(A.BREAK))return this.advance(),{type:"break"};if(this.check(A.CONTINUE))return this.advance(),{type:"continue"};if(this.check(A.NEXT))return this.advance(),{type:"next"};if(this.check(A.NEXTFILE))return this.advance(),{type:"nextfile"};if(this.check(A.EXIT)){this.advance();let n;return!this.check(A.NEWLINE)&&!this.check(A.SEMICOLON)&&!this.check(A.RBRACE)&&!this.check(A.EOF)&&(n=this.parseExpression()),{type:"exit",code:n}}if(this.check(A.RETURN)){this.advance();let n;return!this.check(A.NEWLINE)&&!this.check(A.SEMICOLON)&&!this.check(A.RBRACE)&&!this.check(A.EOF)&&(n=this.parseExpression()),{type:"return",value:n}}if(this.check(A.DELETE)){this.advance();let n=this.parsePrimary();if(n.type!=="array_access"&&n.type!=="variable")throw new Error("delete requires array element or array");return{type:"delete",target:n}}return this.check(A.PRINT)?H1(this):this.check(A.PRINTF)?j1(this):{type:"expr_stmt",expression:this.parseExpression()}}parseIf(){this.expect(A.IF),this.expect(A.LPAREN);let t=this.parseExpression();this.expect(A.RPAREN),this.skipNewlines();let n=this.parseStatement();this.skipTerminators();let r;return this.check(A.ELSE)&&(this.advance(),this.skipNewlines(),r=this.parseStatement()),{type:"if",condition:t,consequent:n,alternate:r}}parseWhile(){this.expect(A.WHILE),this.expect(A.LPAREN);let t=this.parseExpression();this.expect(A.RPAREN),this.skipNewlines();let n=this.parseStatement();return{type:"while",condition:t,body:n}}parseDoWhile(){this.expect(A.DO),this.skipNewlines();let t=this.parseStatement();this.skipNewlines(),this.expect(A.WHILE),this.expect(A.LPAREN);let n=this.parseExpression();return this.expect(A.RPAREN),{type:"do_while",body:t,condition:n}}parseFor(){if(this.expect(A.FOR),this.expect(A.LPAREN),this.check(A.IDENT)){let i=this.advance();if(this.check(A.IN)){this.advance();let a=this.expect(A.IDENT).value;this.expect(A.RPAREN),this.skipNewlines();let o=this.parseStatement();return{type:"for_in",variable:i.value,array:a,body:o}}this.pos--}let t;this.check(A.SEMICOLON)||(t=this.parseExpression()),this.expect(A.SEMICOLON);let n;this.check(A.SEMICOLON)||(n=this.parseExpression()),this.expect(A.SEMICOLON);let r;this.check(A.RPAREN)||(r=this.parseExpression()),this.expect(A.RPAREN),this.skipNewlines();let s=this.parseStatement();return{type:"for",init:t,condition:n,update:r,body:s}}parseExpression(){return this.parseAssignment()}parseAssignment(){let t=this.parseTernary();if(this.match(A.ASSIGN,A.PLUS_ASSIGN,A.MINUS_ASSIGN,A.STAR_ASSIGN,A.SLASH_ASSIGN,A.PERCENT_ASSIGN,A.CARET_ASSIGN)){let n=this.advance(),r=this.parseAssignment();if(t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:{"=":"=","+=":"+=","-=":"-=","*=":"*=","/=":"/=","%=":"%=","^=":"^="}[n.value],target:t,value:r}}return t}parseTernary(){let t=this.parsePipeGetline();if(this.check(A.QUESTION)){this.advance();let n=this.parseExpression();this.expect(A.COLON);let r=this.parseExpression();t={type:"ternary",condition:t,consequent:n,alternate:r}}return t}parsePipeGetline(){let t=this.parseOr();if(this.check(A.PIPE)){if(this.advance(),!this.check(A.GETLINE))throw new Error("Expected 'getline' after '|' in expression context");this.advance();let n;return this.check(A.IDENT)&&(n=this.advance().value),{type:"getline",command:t,variable:n}}return t}parseOr(){let t=this.parseAnd();for(;this.check(A.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalOrRest(t){for(t=this.parseLogicalAndRest(t);this.check(A.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalAndRest(t){for(;this.check(A.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseAnd(){let t=this.parseIn();for(;this.check(A.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseIn(){let t=this.parseConcatenation();if(this.check(A.IN)){this.advance();let n=this.expect(A.IDENT).value;return{type:"in",key:t,array:n}}return t}parseConcatenation(){let t=this.parseMatch();for(;this.canStartExpression()&&!this.isConcatTerminator();){let n=this.parseMatch();t={type:"binary",operator:" ",left:t,right:n}}return t}parseMatch(){let t=this.parseComparison();for(;this.match(A.MATCH,A.NOT_MATCH);){let n=this.advance().type===A.MATCH?"~":"!~",r=this.parseComparison();t={type:"binary",operator:n,left:t,right:r}}return t}parseComparison(){let t=this.parseAddSub();for(;this.match(A.LT,A.LE,A.GT,A.GE,A.EQ,A.NE);){let n=this.advance(),r=this.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">",">"],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:r}}return t}canStartExpression(){return this.match(A.NUMBER,A.STRING,A.IDENT,A.DOLLAR,A.LPAREN,A.NOT,A.MINUS,A.PLUS,A.INCREMENT,A.DECREMENT)}isConcatTerminator(){return this.match(A.AND,A.OR,A.QUESTION,A.ASSIGN,A.PLUS_ASSIGN,A.MINUS_ASSIGN,A.STAR_ASSIGN,A.SLASH_ASSIGN,A.PERCENT_ASSIGN,A.CARET_ASSIGN,A.COMMA,A.SEMICOLON,A.NEWLINE,A.RBRACE,A.RPAREN,A.RBRACKET,A.COLON,A.PIPE,A.APPEND,A.IN)}parseAddSub(){let t=this.parseMulDiv();for(;this.match(A.PLUS,A.MINUS);){let n=this.advance().value,r=this.parseMulDiv();t={type:"binary",operator:n,left:t,right:r}}return t}parseMulDiv(){let t=this.parseUnary();for(;this.match(A.STAR,A.SLASH,A.PERCENT);){let n=this.advance(),r=this.parseUnary();t={type:"binary",operator:new Map([["*","*"],["/","/"],["%","%"]]).get(n.value)??"*",left:t,right:r}}return t}parseUnary(){if(this.check(A.INCREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(A.DECREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(A.NOT,A.MINUS,A.PLUS)){let t=this.advance().value,n=this.parseUnary();return{type:"unary",operator:t,operand:n}}return this.parsePower()}parsePower(){let t=this.parsePostfix();if(this.check(A.CARET)){this.advance();let n=this.parsePower();t={type:"binary",operator:"^",left:t,right:n}}return t}parsePostfix(){let t=this.parsePrimary();if(this.check(A.INCREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid increment operand");return{type:"post_increment",operand:t}}if(this.check(A.DECREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid decrement operand");return{type:"post_decrement",operand:t}}return t}parseFieldIndex(){if(this.check(A.INCREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(A.DECREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(A.NOT,A.MINUS,A.PLUS)){let t=this.advance().value,n=this.parseFieldIndex();return{type:"unary",operator:t,operand:n}}return this.parseFieldIndexPower()}parseFieldIndexPower(){let t=this.parseFieldIndexPrimary();if(this.check(A.CARET)){this.advance();let n=this.parseFieldIndexPower();t={type:"binary",operator:"^",left:t,right:n}}return t}parseFieldIndexPrimary(){if(this.check(A.NUMBER))return{type:"number",value:this.advance().value};if(this.check(A.STRING))return{type:"string",value:this.advance().value};if(this.check(A.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(A.LPAREN)){this.advance();let t=this.parseExpression();return this.expect(A.RPAREN),t}if(this.check(A.IDENT)){let t=this.advance().value;if(this.check(A.LPAREN)){this.advance();let n=[];if(!this.check(A.RPAREN))for(n.push(this.parseExpression());this.check(A.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(A.RPAREN),{type:"call",name:t,args:n}}if(this.check(A.LBRACKET)){this.advance();let n=this.parseExpression();if(this.check(A.COMMA)){let r=[n];for(;this.check(A.COMMA);)this.advance(),r.push(this.parseExpression());this.expect(A.RBRACKET);let s=r.reduce((i,a)=>({type:"binary",operator:" ",left:{type:"binary",operator:" ",left:i,right:{type:"variable",name:"SUBSEP"}},right:a}));return{type:"array_access",array:t,key:s}}return this.expect(A.RBRACKET),{type:"array_access",array:t,key:n}}return{type:"variable",name:t}}throw new Error(`Unexpected token in field index: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}parsePrimary(){if(this.check(A.NUMBER))return{type:"number",value:this.advance().value};if(this.check(A.STRING))return{type:"string",value:this.advance().value};if(this.check(A.REGEX))return{type:"regex",pattern:this.advance().value};if(this.check(A.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(A.LPAREN)){this.advance();let t=this.parseExpression();if(this.check(A.COMMA)){let n=[t];for(;this.check(A.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(A.RPAREN),{type:"tuple",elements:n}}return this.expect(A.RPAREN),t}if(this.check(A.GETLINE)){this.advance();let t,n;return this.check(A.IDENT)&&(t=this.advance().value),this.check(A.LT)&&(this.advance(),n=this.parsePrimary()),{type:"getline",variable:t,file:n}}if(this.check(A.IDENT)){let t=this.advance().value;if(this.check(A.LPAREN)){this.advance();let n=[];if(this.skipNewlines(),!this.check(A.RPAREN))for(n.push(this.parseExpression());this.check(A.COMMA);)this.advance(),this.skipNewlines(),n.push(this.parseExpression());return this.skipNewlines(),this.expect(A.RPAREN),{type:"call",name:t,args:n}}if(this.check(A.LBRACKET)){this.advance();let n=[this.parseExpression()];for(;this.check(A.COMMA);)this.advance(),n.push(this.parseExpression());this.expect(A.RBRACKET);let r;if(n.length===1)r=n[0];else{r=n[0];for(let s=1;s<n.length;s++)r={type:"binary",operator:" ",left:{type:"binary",operator:" ",left:r,right:{type:"variable",name:"SUBSEP"}},right:n[s]}}return{type:"array_access",array:t,key:r}}return{type:"variable",name:t}}throw new Error(`Unexpected token: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}}});var K1={};K(K1,{awkCommand2:()=>I3,flagsForFuzzing:()=>$3});function Ro(e){return e.replace(/\\t/g," ").replace(/\\n/g,`
343
- `).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\a/g,"\x07").replace(/\\v/g,"\v").replace(/\\\\/g,"\\")}function q1(e){if(e===" ")return V("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return V(e)}catch{return V(Z1(e))}return V(Z1(e))}function Z1(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var v3,I3,$3,Q1=I(()=>{"use strict";Pn();ye();Me();se();F1();V1();v3={name:"awk",summary:"pattern scanning and text processing language",usage:"awk [OPTIONS] 'PROGRAM' [FILE...]",options:["-F FS use FS as field separator","-v VAR=VAL assign VAL to variable VAR"," --help display this help and exit"]},I3={name:"awk",async execute(e,t){if(U(e))return M(v3);let n=new Cn(/\s+/),r=" ",s=Object.create(null),i=0;for(let d=0;d<e.length;d++){let g=e[d];if(g==="-F"&&d+1<e.length)r=Ro(e[++d]),n=q1(r),i=d+1;else if(g.startsWith("-F"))r=Ro(g.slice(2)),n=q1(r),i=d+1;else if(g==="-v"&&d+1<e.length){let w=e[++d],y=w.indexOf("=");if(y>0){let b=w.slice(0,y),x=Ro(w.slice(y+1));s[b]=x}i=d+1}else{if(g.startsWith("--"))return Y("awk",g);if(g.startsWith("-")&&g.length>1){let w=g[1];if(w!=="F"&&w!=="v")return Y("awk",`-${w}`);i=d+1}else if(!g.startsWith("-")){i=d;break}}}if(i>=e.length)return{stdout:"",stderr:`awk: missing program
342
+ `)break;r+=this.advance()}return this.peek()==="/"&&this.advance(),r=E3(r),{type:A.REGEX,value:r,line:t,column:n}}readNumber(){let t=this.line,n=this.column,r="";for(;this.isDigit(this.peek());)r+=this.advance();if(this.peek()==="."&&this.isDigit(this.peek(1)))for(r+=this.advance();this.isDigit(this.peek());)r+=this.advance();if(this.peek()==="e"||this.peek()==="E")for(r+=this.advance(),(this.peek()==="+"||this.peek()==="-")&&(r+=this.advance());this.isDigit(this.peek());)r+=this.advance();return{type:A.NUMBER,value:parseFloat(r),line:t,column:n}}readIdentifier(){let t=this.line,n=this.column,r="";for(;this.isAlphaNumeric(this.peek())||this.peek()==="_";)r+=this.advance();let s=x3.get(r);return s!==void 0?{type:s,value:r,line:t,column:n}:{type:A.IDENT,value:r,line:t,column:n}}readOperator(){let t=this.line,n=this.column,r=this.advance(),s=this.peek();switch(r){case"+":return s==="+"?(this.advance(),{type:A.INCREMENT,value:"++",line:t,column:n}):s==="="?(this.advance(),{type:A.PLUS_ASSIGN,value:"+=",line:t,column:n}):{type:A.PLUS,value:"+",line:t,column:n};case"-":return s==="-"?(this.advance(),{type:A.DECREMENT,value:"--",line:t,column:n}):s==="="?(this.advance(),{type:A.MINUS_ASSIGN,value:"-=",line:t,column:n}):{type:A.MINUS,value:"-",line:t,column:n};case"*":return s==="*"?(this.advance(),{type:A.CARET,value:"**",line:t,column:n}):s==="="?(this.advance(),{type:A.STAR_ASSIGN,value:"*=",line:t,column:n}):{type:A.STAR,value:"*",line:t,column:n};case"/":return s==="="?(this.advance(),{type:A.SLASH_ASSIGN,value:"/=",line:t,column:n}):{type:A.SLASH,value:"/",line:t,column:n};case"%":return s==="="?(this.advance(),{type:A.PERCENT_ASSIGN,value:"%=",line:t,column:n}):{type:A.PERCENT,value:"%",line:t,column:n};case"^":return s==="="?(this.advance(),{type:A.CARET_ASSIGN,value:"^=",line:t,column:n}):{type:A.CARET,value:"^",line:t,column:n};case"=":return s==="="?(this.advance(),{type:A.EQ,value:"==",line:t,column:n}):{type:A.ASSIGN,value:"=",line:t,column:n};case"!":return s==="="?(this.advance(),{type:A.NE,value:"!=",line:t,column:n}):s==="~"?(this.advance(),{type:A.NOT_MATCH,value:"!~",line:t,column:n}):{type:A.NOT,value:"!",line:t,column:n};case"<":return s==="="?(this.advance(),{type:A.LE,value:"<=",line:t,column:n}):{type:A.LT,value:"<",line:t,column:n};case">":return s==="="?(this.advance(),{type:A.GE,value:">=",line:t,column:n}):s===">"?(this.advance(),{type:A.APPEND,value:">>",line:t,column:n}):{type:A.GT,value:">",line:t,column:n};case"&":return s==="&"?(this.advance(),{type:A.AND,value:"&&",line:t,column:n}):{type:A.IDENT,value:"&",line:t,column:n};case"|":return s==="|"?(this.advance(),{type:A.OR,value:"||",line:t,column:n}):{type:A.PIPE,value:"|",line:t,column:n};case"~":return{type:A.MATCH,value:"~",line:t,column:n};case"?":return{type:A.QUESTION,value:"?",line:t,column:n};case":":return{type:A.COLON,value:":",line:t,column:n};case",":return{type:A.COMMA,value:",",line:t,column:n};case";":return{type:A.SEMICOLON,value:";",line:t,column:n};case"(":return{type:A.LPAREN,value:"(",line:t,column:n};case")":return{type:A.RPAREN,value:")",line:t,column:n};case"{":return{type:A.LBRACE,value:"{",line:t,column:n};case"}":return{type:A.RBRACE,value:"}",line:t,column:n};case"[":return{type:A.LBRACKET,value:"[",line:t,column:n};case"]":return{type:A.RBRACKET,value:"]",line:t,column:n};case"$":return{type:A.DOLLAR,value:"$",line:t,column:n};default:return{type:A.IDENT,value:r,line:t,column:n}}}isDigit(t){return t>="0"&&t<="9"}isAlpha(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}isAlphaNumeric(t){return this.isDigit(t)||this.isAlpha(t)}}});function H1(e){e.expect(Z.PRINT);let t=[];if(e.check(Z.NEWLINE)||e.check(Z.SEMICOLON)||e.check(Z.RBRACE)||e.check(Z.PIPE)||e.check(Z.GT)||e.check(Z.APPEND))t.push({type:"field",index:{type:"number",value:0}});else for(t.push(yi(e));e.check(Z.COMMA);)e.advance(),t.push(yi(e));let n;return e.check(Z.GT)?(e.advance(),n={redirect:">",file:e.parsePrimary()}):e.check(Z.APPEND)&&(e.advance(),n={redirect:">>",file:e.parsePrimary()}),{type:"print",args:t,output:n}}function yi(e){return A3(e)?Oo(e,!0):Oo(e,!1)}function Oo(e,t){let n=t?e.parseTernary():S3(e);if(e.match(Z.ASSIGN,Z.PLUS_ASSIGN,Z.MINUS_ASSIGN,Z.STAR_ASSIGN,Z.SLASH_ASSIGN,Z.PERCENT_ASSIGN,Z.CARET_ASSIGN)){let r=e.advance(),s=Oo(e,t);if(n.type!=="variable"&&n.type!=="field"&&n.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:new Map([["=","="],["+=","+="],["-=","-="],["*=","*="],["/=","/="],["%=","%="],["^=","^="]]).get(r.value)??"=",target:n,value:s}}return n}function A3(e){let t=0,n=e.pos;for(;n<e.tokens.length;){let r=e.tokens[n];if(r.type===Z.LPAREN&&t++,r.type===Z.RPAREN&&t--,r.type===Z.QUESTION&&t===0)return!0;if(r.type===Z.NEWLINE||r.type===Z.SEMICOLON||r.type===Z.RBRACE||r.type===Z.COMMA||r.type===Z.PIPE)return!1;n++}return!1}function S3(e){let t=U1(e);for(;e.check(Z.OR);){e.advance();let n=U1(e);t={type:"binary",operator:"||",left:t,right:n}}return t}function U1(e){let t=B1(e);for(;e.check(Z.AND);){e.advance();let n=B1(e);t={type:"binary",operator:"&&",left:t,right:n}}return t}function B1(e){let t=C3(e);if(e.check(Z.IN)){e.advance();let n=String(e.expect(Z.IDENT).value);return{type:"in",key:t,array:n}}return t}function C3(e){let t=W1(e);for(;N3(e)&&!v3(e);){let n=W1(e);t={type:"binary",operator:" ",left:t,right:n}}return t}function W1(e){let t=z1(e);for(;e.match(Z.MATCH,Z.NOT_MATCH);){let n=e.advance().type===Z.MATCH?"~":"!~",r=z1(e);t={type:"binary",operator:n,left:t,right:r}}return t}function z1(e){let t=e.parseAddSub();for(;e.match(Z.LT,Z.LE,Z.GE,Z.EQ,Z.NE);){let n=e.advance(),r=e.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:r}}return t}function N3(e){return e.match(Z.NUMBER,Z.STRING,Z.IDENT,Z.DOLLAR,Z.LPAREN,Z.NOT,Z.MINUS,Z.PLUS,Z.INCREMENT,Z.DECREMENT)}function v3(e){return e.match(Z.AND,Z.OR,Z.QUESTION,Z.ASSIGN,Z.PLUS_ASSIGN,Z.MINUS_ASSIGN,Z.STAR_ASSIGN,Z.SLASH_ASSIGN,Z.PERCENT_ASSIGN,Z.CARET_ASSIGN,Z.COMMA,Z.SEMICOLON,Z.NEWLINE,Z.RBRACE,Z.RPAREN,Z.RBRACKET,Z.COLON,Z.PIPE,Z.APPEND,Z.GT,Z.IN)}function j1(e){e.expect(Z.PRINTF);let t=e.check(Z.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():yi(e),r=[];for(;e.check(Z.COMMA);)e.advance(),t&&e.skipNewlines(),r.push(t?e.parseExpression():yi(e));t&&(e.skipNewlines(),e.expect(Z.RPAREN));let s;return e.check(Z.GT)?(e.advance(),s={redirect:">",file:e.parsePrimary()}):e.check(Z.APPEND)&&(e.advance(),s={redirect:">>",file:e.parsePrimary()}),{type:"printf",format:n,args:r,output:s}}var Z,G1=I(()=>{"use strict";Z={LPAREN:"LPAREN",RPAREN:"RPAREN",QUESTION:"QUESTION",NEWLINE:"NEWLINE",SEMICOLON:"SEMICOLON",RBRACE:"RBRACE",COMMA:"COMMA",PIPE:"PIPE",GT:"GT",APPEND:"APPEND",AND:"AND",OR:"OR",ASSIGN:"ASSIGN",PLUS_ASSIGN:"PLUS_ASSIGN",MINUS_ASSIGN:"MINUS_ASSIGN",STAR_ASSIGN:"STAR_ASSIGN",SLASH_ASSIGN:"SLASH_ASSIGN",PERCENT_ASSIGN:"PERCENT_ASSIGN",CARET_ASSIGN:"CARET_ASSIGN",RBRACKET:"RBRACKET",COLON:"COLON",IN:"IN",PRINT:"PRINT",PRINTF:"PRINTF",IDENT:"IDENT",LT:"LT",LE:"LE",GE:"GE",EQ:"EQ",NE:"NE",MATCH:"MATCH",NOT_MATCH:"NOT_MATCH",NUMBER:"NUMBER",STRING:"STRING",DOLLAR:"DOLLAR",NOT:"NOT",MINUS:"MINUS",PLUS:"PLUS",INCREMENT:"INCREMENT",DECREMENT:"DECREMENT"}});var wi,V1=I(()=>{"use strict";M1();G1();wi=class{tokens=[];pos=0;parse(t){let n=new gi(t);return this.tokens=n.tokenize(),this.pos=0,this.parseProgram()}setPos(t){this.pos=t}current(){return this.tokens[this.pos]||{type:A.EOF,value:"",line:0,column:0}}advance(){let t=this.current();return this.pos<this.tokens.length&&this.pos++,t}match(...t){return t.includes(this.current().type)}check(t){return this.current().type===t}expect(t,n){if(!this.check(t)){let r=this.current();throw new Error(n||`Expected ${t}, got ${r.type} at line ${r.line}:${r.column}`)}return this.advance()}skipNewlines(){for(;this.check(A.NEWLINE);)this.advance()}skipTerminators(){for(;this.check(A.NEWLINE)||this.check(A.SEMICOLON);)this.advance()}parseProgram(){let t=[],n=[];for(this.skipNewlines();!this.check(A.EOF)&&(this.skipNewlines(),!this.check(A.EOF));)this.check(A.FUNCTION)?t.push(this.parseFunction()):n.push(this.parseRule()),this.skipTerminators();return{functions:t,rules:n}}parseFunction(){this.expect(A.FUNCTION);let t=this.expect(A.IDENT).value;this.expect(A.LPAREN);let n=[];if(!this.check(A.RPAREN))for(n.push(this.expect(A.IDENT).value);this.check(A.COMMA);)this.advance(),n.push(this.expect(A.IDENT).value);this.expect(A.RPAREN),this.skipNewlines();let r=this.parseBlock();return{name:t,params:n,body:r}}parseRule(){let t;if(this.check(A.BEGIN))this.advance(),t={type:"begin"};else if(this.check(A.END))this.advance(),t={type:"end"};else if(this.check(A.LBRACE))t=void 0;else if(this.check(A.REGEX)){let r=this.advance();if(this.check(A.AND)||this.check(A.OR)){let s={type:"binary",operator:"~",left:{type:"field",index:{type:"number",value:0}},right:{type:"regex",pattern:r.value}};t={type:"expr_pattern",expression:this.parseLogicalOrRest(s)}}else{let s={type:"regex_pattern",pattern:r.value};if(this.check(A.COMMA)){this.advance();let i;this.check(A.REGEX)?i={type:"regex_pattern",pattern:this.advance().value}:i={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:i}}else t=s}}else{let s={type:"expr_pattern",expression:this.parseExpression()};if(this.check(A.COMMA)){this.advance();let i;this.check(A.REGEX)?i={type:"regex_pattern",pattern:this.advance().value}:i={type:"expr_pattern",expression:this.parseExpression()},t={type:"range",start:s,end:i}}else t=s}this.skipNewlines();let n;return this.check(A.LBRACE)?n=this.parseBlock():n={type:"block",statements:[{type:"print",args:[{type:"field",index:{type:"number",value:0}}]}]},{pattern:t,action:n}}parseBlock(){this.expect(A.LBRACE),this.skipNewlines();let t=[];for(;!this.check(A.RBRACE)&&!this.check(A.EOF);)t.push(this.parseStatement()),this.skipTerminators();return this.expect(A.RBRACE),{type:"block",statements:t}}parseStatement(){if(this.check(A.SEMICOLON)||this.check(A.NEWLINE))return this.advance(),{type:"block",statements:[]};if(this.check(A.LBRACE))return this.parseBlock();if(this.check(A.IF))return this.parseIf();if(this.check(A.WHILE))return this.parseWhile();if(this.check(A.DO))return this.parseDoWhile();if(this.check(A.FOR))return this.parseFor();if(this.check(A.BREAK))return this.advance(),{type:"break"};if(this.check(A.CONTINUE))return this.advance(),{type:"continue"};if(this.check(A.NEXT))return this.advance(),{type:"next"};if(this.check(A.NEXTFILE))return this.advance(),{type:"nextfile"};if(this.check(A.EXIT)){this.advance();let n;return!this.check(A.NEWLINE)&&!this.check(A.SEMICOLON)&&!this.check(A.RBRACE)&&!this.check(A.EOF)&&(n=this.parseExpression()),{type:"exit",code:n}}if(this.check(A.RETURN)){this.advance();let n;return!this.check(A.NEWLINE)&&!this.check(A.SEMICOLON)&&!this.check(A.RBRACE)&&!this.check(A.EOF)&&(n=this.parseExpression()),{type:"return",value:n}}if(this.check(A.DELETE)){this.advance();let n=this.parsePrimary();if(n.type!=="array_access"&&n.type!=="variable")throw new Error("delete requires array element or array");return{type:"delete",target:n}}return this.check(A.PRINT)?H1(this):this.check(A.PRINTF)?j1(this):{type:"expr_stmt",expression:this.parseExpression()}}parseIf(){this.expect(A.IF),this.expect(A.LPAREN);let t=this.parseExpression();this.expect(A.RPAREN),this.skipNewlines();let n=this.parseStatement();this.skipTerminators();let r;return this.check(A.ELSE)&&(this.advance(),this.skipNewlines(),r=this.parseStatement()),{type:"if",condition:t,consequent:n,alternate:r}}parseWhile(){this.expect(A.WHILE),this.expect(A.LPAREN);let t=this.parseExpression();this.expect(A.RPAREN),this.skipNewlines();let n=this.parseStatement();return{type:"while",condition:t,body:n}}parseDoWhile(){this.expect(A.DO),this.skipNewlines();let t=this.parseStatement();this.skipNewlines(),this.expect(A.WHILE),this.expect(A.LPAREN);let n=this.parseExpression();return this.expect(A.RPAREN),{type:"do_while",body:t,condition:n}}parseFor(){if(this.expect(A.FOR),this.expect(A.LPAREN),this.check(A.IDENT)){let i=this.advance();if(this.check(A.IN)){this.advance();let a=this.expect(A.IDENT).value;this.expect(A.RPAREN),this.skipNewlines();let o=this.parseStatement();return{type:"for_in",variable:i.value,array:a,body:o}}this.pos--}let t;this.check(A.SEMICOLON)||(t=this.parseExpression()),this.expect(A.SEMICOLON);let n;this.check(A.SEMICOLON)||(n=this.parseExpression()),this.expect(A.SEMICOLON);let r;this.check(A.RPAREN)||(r=this.parseExpression()),this.expect(A.RPAREN),this.skipNewlines();let s=this.parseStatement();return{type:"for",init:t,condition:n,update:r,body:s}}parseExpression(){return this.parseAssignment()}parseAssignment(){let t=this.parseTernary();if(this.match(A.ASSIGN,A.PLUS_ASSIGN,A.MINUS_ASSIGN,A.STAR_ASSIGN,A.SLASH_ASSIGN,A.PERCENT_ASSIGN,A.CARET_ASSIGN)){let n=this.advance(),r=this.parseAssignment();if(t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid assignment target");return{type:"assignment",operator:{"=":"=","+=":"+=","-=":"-=","*=":"*=","/=":"/=","%=":"%=","^=":"^="}[n.value],target:t,value:r}}return t}parseTernary(){let t=this.parsePipeGetline();if(this.check(A.QUESTION)){this.advance();let n=this.parseExpression();this.expect(A.COLON);let r=this.parseExpression();t={type:"ternary",condition:t,consequent:n,alternate:r}}return t}parsePipeGetline(){let t=this.parseOr();if(this.check(A.PIPE)){if(this.advance(),!this.check(A.GETLINE))throw new Error("Expected 'getline' after '|' in expression context");this.advance();let n;return this.check(A.IDENT)&&(n=this.advance().value),{type:"getline",command:t,variable:n}}return t}parseOr(){let t=this.parseAnd();for(;this.check(A.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalOrRest(t){for(t=this.parseLogicalAndRest(t);this.check(A.OR);){this.advance();let n=this.parseAnd();t={type:"binary",operator:"||",left:t,right:n}}return t}parseLogicalAndRest(t){for(;this.check(A.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseAnd(){let t=this.parseIn();for(;this.check(A.AND);){this.advance();let n=this.parseIn();t={type:"binary",operator:"&&",left:t,right:n}}return t}parseIn(){let t=this.parseConcatenation();if(this.check(A.IN)){this.advance();let n=this.expect(A.IDENT).value;return{type:"in",key:t,array:n}}return t}parseConcatenation(){let t=this.parseMatch();for(;this.canStartExpression()&&!this.isConcatTerminator();){let n=this.parseMatch();t={type:"binary",operator:" ",left:t,right:n}}return t}parseMatch(){let t=this.parseComparison();for(;this.match(A.MATCH,A.NOT_MATCH);){let n=this.advance().type===A.MATCH?"~":"!~",r=this.parseComparison();t={type:"binary",operator:n,left:t,right:r}}return t}parseComparison(){let t=this.parseAddSub();for(;this.match(A.LT,A.LE,A.GT,A.GE,A.EQ,A.NE);){let n=this.advance(),r=this.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">",">"],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:r}}return t}canStartExpression(){return this.match(A.NUMBER,A.STRING,A.IDENT,A.DOLLAR,A.LPAREN,A.NOT,A.MINUS,A.PLUS,A.INCREMENT,A.DECREMENT)}isConcatTerminator(){return this.match(A.AND,A.OR,A.QUESTION,A.ASSIGN,A.PLUS_ASSIGN,A.MINUS_ASSIGN,A.STAR_ASSIGN,A.SLASH_ASSIGN,A.PERCENT_ASSIGN,A.CARET_ASSIGN,A.COMMA,A.SEMICOLON,A.NEWLINE,A.RBRACE,A.RPAREN,A.RBRACKET,A.COLON,A.PIPE,A.APPEND,A.IN)}parseAddSub(){let t=this.parseMulDiv();for(;this.match(A.PLUS,A.MINUS);){let n=this.advance().value,r=this.parseMulDiv();t={type:"binary",operator:n,left:t,right:r}}return t}parseMulDiv(){let t=this.parseUnary();for(;this.match(A.STAR,A.SLASH,A.PERCENT);){let n=this.advance(),r=this.parseUnary();t={type:"binary",operator:new Map([["*","*"],["/","/"],["%","%"]]).get(n.value)??"*",left:t,right:r}}return t}parseUnary(){if(this.check(A.INCREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(A.DECREMENT)){this.advance();let t=this.parseUnary();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(A.NOT,A.MINUS,A.PLUS)){let t=this.advance().value,n=this.parseUnary();return{type:"unary",operator:t,operand:n}}return this.parsePower()}parsePower(){let t=this.parsePostfix();if(this.check(A.CARET)){this.advance();let n=this.parsePower();t={type:"binary",operator:"^",left:t,right:n}}return t}parsePostfix(){let t=this.parsePrimary();if(this.check(A.INCREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid increment operand");return{type:"post_increment",operand:t}}if(this.check(A.DECREMENT)){if(this.advance(),t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access")throw new Error("Invalid decrement operand");return{type:"post_decrement",operand:t}}return t}parseFieldIndex(){if(this.check(A.INCREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"+",operand:{type:"unary",operator:"+",operand:t}}:{type:"pre_increment",operand:t}}if(this.check(A.DECREMENT)){this.advance();let t=this.parseFieldIndex();return t.type!=="variable"&&t.type!=="field"&&t.type!=="array_access"?{type:"unary",operator:"-",operand:{type:"unary",operator:"-",operand:t}}:{type:"pre_decrement",operand:t}}if(this.match(A.NOT,A.MINUS,A.PLUS)){let t=this.advance().value,n=this.parseFieldIndex();return{type:"unary",operator:t,operand:n}}return this.parseFieldIndexPower()}parseFieldIndexPower(){let t=this.parseFieldIndexPrimary();if(this.check(A.CARET)){this.advance();let n=this.parseFieldIndexPower();t={type:"binary",operator:"^",left:t,right:n}}return t}parseFieldIndexPrimary(){if(this.check(A.NUMBER))return{type:"number",value:this.advance().value};if(this.check(A.STRING))return{type:"string",value:this.advance().value};if(this.check(A.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(A.LPAREN)){this.advance();let t=this.parseExpression();return this.expect(A.RPAREN),t}if(this.check(A.IDENT)){let t=this.advance().value;if(this.check(A.LPAREN)){this.advance();let n=[];if(!this.check(A.RPAREN))for(n.push(this.parseExpression());this.check(A.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(A.RPAREN),{type:"call",name:t,args:n}}if(this.check(A.LBRACKET)){this.advance();let n=this.parseExpression();if(this.check(A.COMMA)){let r=[n];for(;this.check(A.COMMA);)this.advance(),r.push(this.parseExpression());this.expect(A.RBRACKET);let s=r.reduce((i,a)=>({type:"binary",operator:" ",left:{type:"binary",operator:" ",left:i,right:{type:"variable",name:"SUBSEP"}},right:a}));return{type:"array_access",array:t,key:s}}return this.expect(A.RBRACKET),{type:"array_access",array:t,key:n}}return{type:"variable",name:t}}throw new Error(`Unexpected token in field index: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}parsePrimary(){if(this.check(A.NUMBER))return{type:"number",value:this.advance().value};if(this.check(A.STRING))return{type:"string",value:this.advance().value};if(this.check(A.REGEX))return{type:"regex",pattern:this.advance().value};if(this.check(A.DOLLAR))return this.advance(),{type:"field",index:this.parseFieldIndex()};if(this.check(A.LPAREN)){this.advance();let t=this.parseExpression();if(this.check(A.COMMA)){let n=[t];for(;this.check(A.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(A.RPAREN),{type:"tuple",elements:n}}return this.expect(A.RPAREN),t}if(this.check(A.GETLINE)){this.advance();let t,n;return this.check(A.IDENT)&&(t=this.advance().value),this.check(A.LT)&&(this.advance(),n=this.parsePrimary()),{type:"getline",variable:t,file:n}}if(this.check(A.IDENT)){let t=this.advance().value;if(this.check(A.LPAREN)){this.advance();let n=[];if(this.skipNewlines(),!this.check(A.RPAREN))for(n.push(this.parseExpression());this.check(A.COMMA);)this.advance(),this.skipNewlines(),n.push(this.parseExpression());return this.skipNewlines(),this.expect(A.RPAREN),{type:"call",name:t,args:n}}if(this.check(A.LBRACKET)){this.advance();let n=[this.parseExpression()];for(;this.check(A.COMMA);)this.advance(),n.push(this.parseExpression());this.expect(A.RBRACKET);let r;if(n.length===1)r=n[0];else{r=n[0];for(let s=1;s<n.length;s++)r={type:"binary",operator:" ",left:{type:"binary",operator:" ",left:r,right:{type:"variable",name:"SUBSEP"}},right:n[s]}}return{type:"array_access",array:t,key:r}}return{type:"variable",name:t}}throw new Error(`Unexpected token: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}}});var K1={};K(K1,{awkCommand2:()=>I3,flagsForFuzzing:()=>$3});function Ro(e){return e.replace(/\\t/g," ").replace(/\\n/g,`
343
+ `).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\a/g,"\x07").replace(/\\v/g,"\v").replace(/\\\\/g,"\\")}function q1(e){if(e===" ")return V("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return V(e)}catch{return V(Z1(e))}return V(Z1(e))}function Z1(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var k3,I3,$3,Q1=I(()=>{"use strict";Pn();ye();Me();se();F1();V1();k3={name:"awk",summary:"pattern scanning and text processing language",usage:"awk [OPTIONS] 'PROGRAM' [FILE...]",options:["-F FS use FS as field separator","-v VAR=VAL assign VAL to variable VAR"," --help display this help and exit"]},I3={name:"awk",async execute(e,t){if(U(e))return M(k3);let n=new Cn(/\s+/),r=" ",s=Object.create(null),i=0;for(let d=0;d<e.length;d++){let g=e[d];if(g==="-F"&&d+1<e.length)r=Ro(e[++d]),n=q1(r),i=d+1;else if(g.startsWith("-F"))r=Ro(g.slice(2)),n=q1(r),i=d+1;else if(g==="-v"&&d+1<e.length){let w=e[++d],y=w.indexOf("=");if(y>0){let b=w.slice(0,y),x=Ro(w.slice(y+1));s[b]=x}i=d+1}else{if(g.startsWith("--"))return Y("awk",g);if(g.startsWith("-")&&g.length>1){let w=g[1];if(w!=="F"&&w!=="v")return Y("awk",`-${w}`);i=d+1}else if(!g.startsWith("-")){i=d;break}}}if(i>=e.length)return{stdout:"",stderr:`awk: missing program
344
344
  `,exitCode:1};let a=e[i],o=e.slice(i+1),l=new wi,c;try{c=l.parse(a)}catch(d){return{stdout:"",stderr:`awk: ${d instanceof Error?d.message:String(d)}
345
345
  `,exitCode:1}}let u={readFile:t.fs.readFile.bind(t.fs),writeFile:t.fs.writeFile.bind(t.fs),appendFile:async(d,g)=>{try{let w=await t.fs.readFile(d);await t.fs.writeFile(d,w+g)}catch{await t.fs.writeFile(d,g)}},resolvePath:t.fs.resolvePath.bind(t.fs)},f=xo({fieldSep:n,maxIterations:t.limits?.maxAwkIterations,maxOutputSize:t.limits?.maxStringLength,fs:u,cwd:t.cwd,exec:t.exec?d=>t.exec(d,{cwd:t.cwd}):void 0,coverage:t.coverage});f.FS=r,f.vars=Object.assign(Object.create(null),s),f.ARGC=o.length+1,f.ARGV=Object.create(null),f.ARGV[0]="awk";for(let d=0;d<o.length;d++)f.ARGV[String(d+1)]=o[d];f.ENVIRON=Et(t.env);let p=new ms(f);p.execute(c);let h=c.rules.some(d=>d.pattern?.type!=="begin"&&d.pattern?.type!=="end"),m=c.rules.some(d=>d.pattern?.type==="end");try{if(await p.executeBegin(),f.shouldExit)return await p.executeEnd(),{stdout:p.getOutput(),stderr:"",exitCode:p.getExitCode()};if(!h&&!m)return{stdout:p.getOutput(),stderr:"",exitCode:p.getExitCode()};let d=[];if(o.length>0)for(let g of o)try{let w=t.fs.resolvePath(t.cwd,g),b=(await t.fs.readFile(w)).split(`
346
346
  `);b.length>0&&b[b.length-1]===""&&b.pop(),d.push({filename:g,lines:b})}catch{return{stdout:"",stderr:`awk: ${g}: No such file or directory
@@ -427,12 +427,12 @@ Try 'comm --help' for more information.
427
427
  `),r=e.endsWith(`
428
428
  `)&&n[n.length-1]==="";return r&&n.pop(),n.map(i=>d8(i,t)).join(`
429
429
  `)+(r?`
430
- `:"")}var p8,m8,g8,kp=I(()=>{"use strict";se();p8={name:"fold",summary:"wrap each input line to fit in specified width",usage:"fold [OPTION]... [FILE]...",description:"Wrap input lines in each FILE, writing to standard output. If no FILE is specified, standard input is read.",options:["-w WIDTH Use WIDTH columns instead of 80","-s Break at spaces","-b Count bytes rather than columns"],examples:["fold -w 40 file.txt # Wrap at 40 columns","fold -sw 40 file.txt # Word wrap at 40 columns","echo 'long line' | fold -w 5 # Force wrap at 5"]};m8={name:"fold",execute:async(e,t)=>{if(U(e))return M(p8);let n={width:80,breakAtSpaces:!1,countBytes:!1},r=[],s=0;for(;s<e.length;){let a=e[s];if(a==="-w"&&s+1<e.length){let o=parseInt(e[s+1],10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${e[s+1]}'
430
+ `:"")}var p8,m8,g8,vp=I(()=>{"use strict";se();p8={name:"fold",summary:"wrap each input line to fit in specified width",usage:"fold [OPTION]... [FILE]...",description:"Wrap input lines in each FILE, writing to standard output. If no FILE is specified, standard input is read.",options:["-w WIDTH Use WIDTH columns instead of 80","-s Break at spaces","-b Count bytes rather than columns"],examples:["fold -w 40 file.txt # Wrap at 40 columns","fold -sw 40 file.txt # Word wrap at 40 columns","echo 'long line' | fold -w 5 # Force wrap at 5"]};m8={name:"fold",execute:async(e,t)=>{if(U(e))return M(p8);let n={width:80,breakAtSpaces:!1,countBytes:!1},r=[],s=0;for(;s<e.length;){let a=e[s];if(a==="-w"&&s+1<e.length){let o=parseInt(e[s+1],10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${e[s+1]}'
431
431
  `};n.width=o,s+=2}else if(a.startsWith("-w")&&a.length>2){let o=parseInt(a.slice(2),10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${a.slice(2)}'
432
432
  `};n.width=o,s++}else if(a==="-s")n.breakAtSpaces=!0,s++;else if(a==="-b")n.countBytes=!0,s++;else if(a==="-bs"||a==="-sb")n.breakAtSpaces=!0,n.countBytes=!0,s++;else if(a.match(/^-[sb]+w\d+$/)){a.includes("s")&&(n.breakAtSpaces=!0),a.includes("b")&&(n.countBytes=!0);let o=a.replace(/^-[sb]+w/,""),l=parseInt(o,10);if(Number.isNaN(l)||l<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${o}'
433
433
  `};n.width=l,s++}else if(a.match(/^-[sb]+w$/)&&s+1<e.length){a.includes("s")&&(n.breakAtSpaces=!0),a.includes("b")&&(n.countBytes=!0);let o=parseInt(e[s+1],10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`fold: invalid number of columns: '${e[s+1]}'
434
434
  `};n.width=o,s+=2}else if(a==="--"){r.push(...e.slice(s+1));break}else if(a.startsWith("-")&&a!=="-"){let o=a.slice(1),l=!1;for(let c of o)if(c==="s")n.breakAtSpaces=!0;else if(c==="b")n.countBytes=!0;else{l=!0;break}if(l)return Y("fold",a);s++}else r.push(a),s++}let i="";if(r.length===0){let a=t.stdin??"";i=Cp(a,n)}else for(let a of r){let o=t.fs.resolvePath(t.cwd,a),l=await t.fs.readFile(o);if(l===null)return{exitCode:1,stdout:i,stderr:`fold: ${a}: No such file or directory
435
- `};i+=Cp(l,n)}return{exitCode:0,stdout:i,stderr:""}}},g8={name:"fold",flags:[{flag:"-w",type:"value",valueHint:"number"},{flag:"-s",type:"boolean"},{flag:"-b",type:"boolean"}],stdinType:"text",needsFiles:!0}});var Ip={};K(Ip,{expand:()=>x8,flagsForFuzzing:()=>E8});function xi(e){let t=e.split(",").map(r=>r.trim()),n=[];for(let r of t){let s=parseInt(r,10);if(Number.isNaN(s)||s<1)return null;n.push(s)}for(let r=1;r<n.length;r++)if(n[r]<=n[r-1])return null;return n}function w8(e,t){if(t.length===1){let n=t[0];return n-e%n}for(let n of t)if(n>e)return n-e;if(t.length>=2){let n=t[t.length-1]-t[t.length-2],r=t[t.length-1],s=Math.floor((e-r)/n)+1;return r+s*n-e}return 1}function b8(e,t){let{tabStops:n,leadingOnly:r}=t,s="",i=0,a=!0;for(let o of e)if(o===" ")if(r&&!a)s+=o,i++;else{let l=w8(i,n);s+=" ".repeat(l),i+=l}else o!==" "&&o!==" "&&(a=!1),s+=o,i++;return s}function vp(e,t){if(e==="")return"";let n=e.split(`
435
+ `};i+=Cp(l,n)}return{exitCode:0,stdout:i,stderr:""}}},g8={name:"fold",flags:[{flag:"-w",type:"value",valueHint:"number"},{flag:"-s",type:"boolean"},{flag:"-b",type:"boolean"}],stdinType:"text",needsFiles:!0}});var Ip={};K(Ip,{expand:()=>x8,flagsForFuzzing:()=>E8});function xi(e){let t=e.split(",").map(r=>r.trim()),n=[];for(let r of t){let s=parseInt(r,10);if(Number.isNaN(s)||s<1)return null;n.push(s)}for(let r=1;r<n.length;r++)if(n[r]<=n[r-1])return null;return n}function w8(e,t){if(t.length===1){let n=t[0];return n-e%n}for(let n of t)if(n>e)return n-e;if(t.length>=2){let n=t[t.length-1]-t[t.length-2],r=t[t.length-1],s=Math.floor((e-r)/n)+1;return r+s*n-e}return 1}function b8(e,t){let{tabStops:n,leadingOnly:r}=t,s="",i=0,a=!0;for(let o of e)if(o===" ")if(r&&!a)s+=o,i++;else{let l=w8(i,n);s+=" ".repeat(l),i+=l}else o!==" "&&o!==" "&&(a=!1),s+=o,i++;return s}function kp(e,t){if(e==="")return"";let n=e.split(`
436
436
  `),r=e.endsWith(`
437
437
  `)&&n[n.length-1]==="";return r&&n.pop(),n.map(i=>b8(i,t)).join(`
438
438
  `)+(r?`
@@ -440,8 +440,8 @@ Try 'comm --help' for more information.
440
440
  `};n.tabStops=o,s+=2}else if(a.startsWith("-t")&&a.length>2){let o=xi(a.slice(2));if(!o)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${a.slice(2)}'
441
441
  `};n.tabStops=o,s++}else if(a==="--tabs"&&s+1<e.length){let o=xi(e[s+1]);if(!o)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${e[s+1]}'
442
442
  `};n.tabStops=o,s+=2}else if(a.startsWith("--tabs=")){let o=xi(a.slice(7));if(!o)return{exitCode:1,stdout:"",stderr:`expand: invalid tab size: '${a.slice(7)}'
443
- `};n.tabStops=o,s++}else if(a==="-i"||a==="--initial")n.leadingOnly=!0,s++;else if(a==="--"){r.push(...e.slice(s+1));break}else{if(a.startsWith("-")&&a!=="-")return Y("expand",a);r.push(a),s++}}let i="";if(r.length===0){let a=t.stdin??"";i=vp(a,n)}else for(let a of r){let o=t.fs.resolvePath(t.cwd,a),l=await t.fs.readFile(o);if(l===null)return{exitCode:1,stdout:i,stderr:`expand: ${a}: No such file or directory
444
- `};i+=vp(l,n)}return{exitCode:0,stdout:i,stderr:""}}},E8={name:"expand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0}});var Tp={};K(Tp,{flagsForFuzzing:()=>N8,unexpand:()=>C8});function Ei(e){let t=e.split(",").map(r=>r.trim()),n=[];for(let r of t){let s=parseInt(r,10);if(Number.isNaN(s)||s<1)return null;n.push(s)}for(let r=1;r<n.length;r++)if(n[r]<=n[r-1])return null;return n}function Op(e,t){if(t.length===1){let n=t[0];return e+(n-e%n)}for(let n of t)if(n>e)return n;if(t.length>=2){let n=t[t.length-1]-t[t.length-2],r=t[t.length-1],s=Math.floor((e-r)/n)+1;return r+s*n}return-1}function S8(e,t){let{tabStops:n,allBlanks:r}=t,s="",i=0,a="",o=0,l=!0,c=()=>{if(a.length===0)return;let u=o+a.length;if(!r&&!l){s+=a,a="";return}let f=o,p="";for(;f<u;){let m=Op(f,n);if(m<=u&&m>f)p+=" ",f=m;else break}let h=u-f;h>0&&(p+=" ".repeat(h)),s+=p,a=""};for(let u of e)u===" "?(a.length===0&&(o=i),a+=u,i++):u===" "?(c(),s+=u,i=Op(i,n)):(c(),s+=u,i++,l=!1);return c(),s}function Rp(e,t){if(e==="")return"";let n=e.split(`
443
+ `};n.tabStops=o,s++}else if(a==="-i"||a==="--initial")n.leadingOnly=!0,s++;else if(a==="--"){r.push(...e.slice(s+1));break}else{if(a.startsWith("-")&&a!=="-")return Y("expand",a);r.push(a),s++}}let i="";if(r.length===0){let a=t.stdin??"";i=kp(a,n)}else for(let a of r){let o=t.fs.resolvePath(t.cwd,a),l=await t.fs.readFile(o);if(l===null)return{exitCode:1,stdout:i,stderr:`expand: ${a}: No such file or directory
444
+ `};i+=kp(l,n)}return{exitCode:0,stdout:i,stderr:""}}},E8={name:"expand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0}});var Tp={};K(Tp,{flagsForFuzzing:()=>N8,unexpand:()=>C8});function Ei(e){let t=e.split(",").map(r=>r.trim()),n=[];for(let r of t){let s=parseInt(r,10);if(Number.isNaN(s)||s<1)return null;n.push(s)}for(let r=1;r<n.length;r++)if(n[r]<=n[r-1])return null;return n}function Op(e,t){if(t.length===1){let n=t[0];return e+(n-e%n)}for(let n of t)if(n>e)return n;if(t.length>=2){let n=t[t.length-1]-t[t.length-2],r=t[t.length-1],s=Math.floor((e-r)/n)+1;return r+s*n}return-1}function S8(e,t){let{tabStops:n,allBlanks:r}=t,s="",i=0,a="",o=0,l=!0,c=()=>{if(a.length===0)return;let u=o+a.length;if(!r&&!l){s+=a,a="";return}let f=o,p="";for(;f<u;){let m=Op(f,n);if(m<=u&&m>f)p+=" ",f=m;else break}let h=u-f;h>0&&(p+=" ".repeat(h)),s+=p,a=""};for(let u of e)u===" "?(a.length===0&&(o=i),a+=u,i++):u===" "?(c(),s+=u,i=Op(i,n)):(c(),s+=u,i++,l=!1);return c(),s}function Rp(e,t){if(e==="")return"";let n=e.split(`
445
445
  `),r=e.endsWith(`
446
446
  `)&&n[n.length-1]==="";return r&&n.pop(),n.map(i=>S8(i,t)).join(`
447
447
  `)+(r?`
@@ -450,7 +450,7 @@ Try 'comm --help' for more information.
450
450
  `};n.tabStops=o,s++}else if(a==="--tabs"&&s+1<e.length){let o=Ei(e[s+1]);if(!o)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${e[s+1]}'
451
451
  `};n.tabStops=o,s+=2}else if(a.startsWith("--tabs=")){let o=Ei(a.slice(7));if(!o)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${a.slice(7)}'
452
452
  `};n.tabStops=o,s++}else if(a==="-a"||a==="--all")n.allBlanks=!0,s++;else if(a==="--"){r.push(...e.slice(s+1));break}else{if(a.startsWith("-")&&a!=="-")return Y("unexpand",a);r.push(a),s++}}let i="";if(r.length===0){let a=t.stdin??"";i=Rp(a,n)}else for(let a of r){let o=t.fs.resolvePath(t.cwd,a),l=await t.fs.readFile(o);if(l===null)return{exitCode:1,stdout:i,stderr:`unexpand: ${a}: No such file or directory
453
- `};i+=Rp(l,n)}return{exitCode:0,stdout:i,stderr:""}}},N8={name:"unexpand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-a",type:"boolean"}],stdinType:"text",needsFiles:!0}});var Lp={};K(Lp,{flagsForFuzzing:()=>$8,strings:()=>I8});function v8(e){return e>=32&&e<=126||e===9}function Dp(e,t){if(t===null)return"";switch(t){case"o":return`${e.toString(8).padStart(7," ")} `;case"x":return`${e.toString(16).padStart(7," ")} `;case"d":return`${e.toString(10).padStart(7," ")} `;default:return t}}function _p(e,t){let n=[],r="",s=0,i=typeof e=="string"?new TextEncoder().encode(e):e;for(let a=0;a<i.length;a++){let o=i[a];if(v8(o))r.length===0&&(s=a),r+=String.fromCharCode(o);else{if(r.length>=t.minLength){let l=Dp(s,t.offsetFormat);n.push(`${l}${r}`)}r=""}}if(r.length>=t.minLength){let a=Dp(s,t.offsetFormat);n.push(`${a}${r}`)}return n}var k8,I8,$8,Fp=I(()=>{"use strict";se();k8={name:"strings",summary:"print the sequences of printable characters in files",usage:"strings [OPTION]... [FILE]...",description:"For each FILE, print the printable character sequences that are at least MIN characters long. If no FILE is specified, standard input is read.",options:["-n MIN Print sequences of at least MIN characters (default: 4)","-t FORMAT Print offset before each string (o=octal, x=hex, d=decimal)","-a Scan the entire file (default behavior)","-e ENCODING Select character encoding (s=7-bit, S=8-bit)"],examples:["strings file.bin # Extract strings (min 4 chars)","strings -n 8 file.bin # Extract strings (min 8 chars)","strings -t x file.bin # Show hex offset","echo 'hello' | strings # Read from stdin"]};I8={name:"strings",execute:async(e,t)=>{if(U(e))return M(k8);let n={minLength:4,offsetFormat:null},r=[],s=0;for(;s<e.length;){let a=e[s];if(a==="-n"&&s+1<e.length){let o=Number.parseInt(e[s+1],10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${e[s+1]}'
453
+ `};i+=Rp(l,n)}return{exitCode:0,stdout:i,stderr:""}}},N8={name:"unexpand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-a",type:"boolean"}],stdinType:"text",needsFiles:!0}});var Lp={};K(Lp,{flagsForFuzzing:()=>$8,strings:()=>I8});function k8(e){return e>=32&&e<=126||e===9}function Dp(e,t){if(t===null)return"";switch(t){case"o":return`${e.toString(8).padStart(7," ")} `;case"x":return`${e.toString(16).padStart(7," ")} `;case"d":return`${e.toString(10).padStart(7," ")} `;default:return t}}function _p(e,t){let n=[],r="",s=0,i=typeof e=="string"?new TextEncoder().encode(e):e;for(let a=0;a<i.length;a++){let o=i[a];if(k8(o))r.length===0&&(s=a),r+=String.fromCharCode(o);else{if(r.length>=t.minLength){let l=Dp(s,t.offsetFormat);n.push(`${l}${r}`)}r=""}}if(r.length>=t.minLength){let a=Dp(s,t.offsetFormat);n.push(`${a}${r}`)}return n}var v8,I8,$8,Fp=I(()=>{"use strict";se();v8={name:"strings",summary:"print the sequences of printable characters in files",usage:"strings [OPTION]... [FILE]...",description:"For each FILE, print the printable character sequences that are at least MIN characters long. If no FILE is specified, standard input is read.",options:["-n MIN Print sequences of at least MIN characters (default: 4)","-t FORMAT Print offset before each string (o=octal, x=hex, d=decimal)","-a Scan the entire file (default behavior)","-e ENCODING Select character encoding (s=7-bit, S=8-bit)"],examples:["strings file.bin # Extract strings (min 4 chars)","strings -n 8 file.bin # Extract strings (min 8 chars)","strings -t x file.bin # Show hex offset","echo 'hello' | strings # Read from stdin"]};I8={name:"strings",execute:async(e,t)=>{if(U(e))return M(v8);let n={minLength:4,offsetFormat:null},r=[],s=0;for(;s<e.length;){let a=e[s];if(a==="-n"&&s+1<e.length){let o=Number.parseInt(e[s+1],10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${e[s+1]}'
454
454
  `};n.minLength=o,s+=2}else if(a.match(/^-n\d+$/)){let o=Number.parseInt(a.slice(2),10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${a.slice(2)}'
455
455
  `};n.minLength=o,s++}else if(a.match(/^-\d+$/)){let o=Number.parseInt(a.slice(1),10);if(Number.isNaN(o)||o<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${a.slice(1)}'
456
456
  `};n.minLength=o,s++}else if(a==="-t"&&s+1<e.length){let o=e[s+1];if(o!=="o"&&o!=="x"&&o!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${o}'
@@ -497,12 +497,12 @@ Try 'comm --help' for more information.
497
497
  `:"",stderr:""}}},K8={name:"join",flags:[{flag:"-1",type:"value",valueHint:"number"},{flag:"-2",type:"value",valueHint:"number"},{flag:"-t",type:"value",valueHint:"delimiter"},{flag:"-a",type:"value",valueHint:"number"},{flag:"-v",type:"value",valueHint:"number"},{flag:"-e",type:"value",valueHint:"string"},{flag:"-o",type:"value",valueHint:"format"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2}});var Vp={};K(Vp,{flagsForFuzzing:()=>J8,teeCommand:()=>Y8});var Q8,X8,Y8,J8,qp=I(()=>{"use strict";Ze();se();Q8={name:"tee",summary:"read from stdin and write to stdout and files",usage:"tee [OPTION]... [FILE]...",options:["-a, --append append to the given FILEs, do not overwrite"," --help display this help and exit"]},X8={append:{short:"a",long:"append",type:"boolean"}},Y8={name:"tee",async execute(e,t){if(U(e))return M(Q8);let n=be("tee",e,X8);if(!n.ok)return n.error;let{append:r}=n.result.flags,s=n.result.positional,i=t.stdin,a="",o=0;for(let l of s)try{let c=t.fs.resolvePath(t.cwd,l);r?await t.fs.appendFile(c,i):await t.fs.writeFile(c,i)}catch{a+=`tee: ${l}: No such file or directory
498
498
  `,o=1}return{stdout:i,stderr:a,exitCode:o}}},J8={name:"tee",flags:[{flag:"-a",type:"boolean"}],stdinType:"text",needsArgs:!0}});function Kt(e,t){switch(e.type){case"name":{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let s=r[1],i=t.name;if(e.ignoreCase){if(!i.toLowerCase().endsWith(s.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!i.endsWith(s))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:xt(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,r=t.relativePath,s=n.split("/");for(let a=0;a<s.length-1;a++){let o=s[a];if(o&&o!=="."&&o!==".."&&!o.includes("*")&&!o.includes("?")&&!o.includes("[")){let l=`/${o}/`;if(e.ignoreCase){if(!r.toLowerCase().includes(l.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.includes(l))return{matches:!1,pruned:!1,printed:!1}}}let i=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(i){let a=i[1];if(e.ignoreCase){if(!r.toLowerCase().endsWith(a.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(a))return{matches:!1,pruned:!1,printed:!1}}return{matches:xt(r,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:V(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType==="d"?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"empty":return{matches:t.isEmpty,pruned:!1,printed:!1};case"mtime":{let r=(Date.now()-t.mtime)/(1e3*60*60*24),s;return e.comparison==="more"?s=r>e.days:e.comparison==="less"?s=r<e.days:s=Math.floor(r)===e.days,{matches:s,pruned:!1,printed:!1}}case"newer":{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let r;return e.comparison==="more"?r=t.size>n:e.comparison==="less"?r=t.size<n:e.unit==="b"?r=Math.ceil(t.size/512)===e.value:r=t.size===n,{matches:r,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,r=e.mode&511,s;return e.matchType==="exact"?s=n===r:e.matchType==="all"?s=(n&r)===r:s=(n&r)!==0,{matches:s,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let n=Kt(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case"and":{let n=Kt(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let r=Kt(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:n.printed||r.printed}}case"or":{let n=Kt(e.left,t);if(n.matches)return n;let r=Kt(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:r.printed}}}}function gs(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return gs(e.expr);case"and":case"or":return gs(e.left)||gs(e.right)}}function ys(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return ys(e.expr);case"and":case"or":return ys(e.left)||ys(e.right);default:return!1}}function Zp(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=e9(e);if(t9(e)&&n.length===1){let i=n[0].split("/").filter(a=>a.length>0);if(i.length>=2)for(let a=i.length-2;a>=0;a--){let o=i[a];if(!o.includes("*")&&!o.includes("?")&&!o.includes("[")&&o!=="."&&o!==".."){let l=i[a+1];if(l&&(l.includes("*")||l.includes("?"))){t.terminalDirName=o;let c=l.match(/^\*(\.[a-zA-Z0-9]+)$/);c&&(t.requiredExtension=c[1])}break}}}return t}function e9(e){let t=[],n=r=>{r.type==="path"?t.push(r.pattern):r.type==="not"?n(r.expr):(r.type==="and"||r.type==="or")&&(n(r.left),n(r.right))};return n(e),t}function t9(e){let t=n=>n.type==="type"&&n.fileType==="f"?!0:n.type==="not"?t(n.expr):n.type==="and"||n.type==="or"?t(n.left)||t(n.right):!1;return t(e)}function Kp(e){let t=[],n=r=>{r&&(r.type==="newer"?t.push(r.refPath):r.type==="not"?n(r.expr):(r.type==="and"||r.type==="or")&&(n(r.left),n(r.right)))};return n(e),t}function ws(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return ws(e.expr);case"and":case"or":return ws(e.left)&&ws(e.right)}}function er(e,t,n,r,s){switch(e.type){case"name":{let i=e.pattern,a=i.match(/^\*(\.[a-zA-Z0-9]+)$/);if(a){let o=a[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(o.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(o))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:xt(t,i,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let i=e.pattern,a=i.split("/");for(let l=0;l<a.length-1;l++){let c=a[l];if(c&&c!=="."&&c!==".."&&!c.includes("*")&&!c.includes("?")&&!c.includes("[")){let u=`/${c}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(u.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(u))return{matches:!1,pruned:!1,printed:!1}}}let o=i.match(/\*(\.[a-zA-Z0-9]+)$/);if(o){let l=o[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(l.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(l))return{matches:!1,pruned:!1,printed:!1}}return{matches:xt(n,i,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let i=e.ignoreCase?"i":"";return{matches:V(e.pattern,i).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:r,pruned:!1,printed:!1}:e.fileType==="d"?{matches:s,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let i=er(e.expr,t,n,r,s);return{matches:!i.matches,pruned:i.pruned,printed:!1}}case"and":{let i=er(e.left,t,n,r,s);if(!i.matches)return{matches:!1,pruned:i.pruned,printed:!1};let a=er(e.right,t,n,r,s);return{matches:a.matches,pruned:i.pruned||a.pruned,printed:i.printed||a.printed}}case"or":{let i=er(e.left,t,n,r,s);if(i.matches)return i;let a=er(e.right,t,n,r,s);return{matches:a.matches,pruned:i.pruned||a.pruned,printed:a.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function bs(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return bs(e.expr);case"and":case"or":return bs(e.left)||bs(e.right);default:return!1}}function Dn(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return Dn(e.expr);case"and":case"or":return Dn(e.left)&&Dn(e.right)}}function Qp(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!Dn(e))return Do(e,t);let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:Kt(e,n).pruned}}function Do(e,t){switch(e.type){case"or":{if(Dn(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(Kt(e.left,n).pruned)return{shouldPrune:!0}}return Do(e.right,t)}case"and":{if(Dn(e.left)&&Dn(e.right)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:Kt(e,n).pruned}}if(Dn(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return Kt(e.left,n).matches?Do(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}var Xp=I(()=>{"use strict";Me();io()});function Yp(e,t){let n=[],r=[],s=t;for(;s<e.length;){let a=e[s];if(a==="("||a==="\\("){n.push({type:"lparen"}),s++;continue}if(a===")"||a==="\\)"){n.push({type:"rparen"}),s++;continue}if(a==="-name"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s]}});else if(a==="-iname"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}});else if(a==="-path"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s]}});else if(a==="-ipath"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}});else if(a==="-regex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}});else if(a==="-iregex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}});else if(a==="-type"&&s+1<e.length){let o=e[++s];if(o==="f"||o==="d")n.push({type:"expr",expr:{type:"type",fileType:o}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${o}
499
499
  `,actions:[]}}else if(a==="-empty")n.push({type:"expr",expr:{type:"empty"}});else if(a==="-mtime"&&s+1<e.length){let o=e[++s],l="exact",c=o;o.startsWith("+")?(l="more",c=o.slice(1)):o.startsWith("-")&&(l="less",c=o.slice(1));let u=parseInt(c,10);Number.isNaN(u)||n.push({type:"expr",expr:{type:"mtime",days:u,comparison:l}})}else if(a==="-newer"&&s+1<e.length){let o=e[++s];n.push({type:"expr",expr:{type:"newer",refPath:o}})}else if(a==="-size"&&s+1<e.length){let o=e[++s],l="exact",c=o;o.startsWith("+")?(l="more",c=o.slice(1)):o.startsWith("-")&&(l="less",c=o.slice(1));let u=c.match(/^(\d+)([ckMGb])?$/);if(u){let f=parseInt(u[1],10),p=u[2]||"b";n.push({type:"expr",expr:{type:"size",value:f,unit:p,comparison:l}})}}else if(a==="-perm"&&s+1<e.length){let o=e[++s],l="exact",c=o;o.startsWith("-")?(l="all",c=o.slice(1)):o.startsWith("/")&&(l="any",c=o.slice(1));let u=parseInt(c,8);Number.isNaN(u)||n.push({type:"expr",expr:{type:"perm",mode:u,matchType:l}})}else if(a==="-prune")n.push({type:"expr",expr:{type:"prune"}});else if(a==="-not"||a==="!")n.push({type:"not"});else if(a==="-o"||a==="-or")n.push({type:"op",op:"or"});else if(a==="-a"||a==="-and")n.push({type:"op",op:"and"});else if(a==="-maxdepth"||a==="-mindepth")s++;else if(a!=="-depth")if(a==="-exec"){let o=[];for(s++;s<e.length&&e[s]!==";"&&e[s]!=="+";)o.push(e[s]),s++;if(s>=e.length)return{expr:null,pathIndex:s,error:"find: missing argument to `-exec'\n",actions:[]};let l=e[s]==="+";r.push({type:"exec",command:o,batchMode:l})}else if(a==="-print")n.push({type:"expr",expr:{type:"print"}}),r.push({type:"print"});else if(a==="-print0")r.push({type:"print0"});else if(a==="-printf"&&s+1<e.length){let o=e[++s];r.push({type:"printf",format:o})}else if(a==="-delete")r.push({type:"delete"});else{if(a.startsWith("-"))return{expr:null,pathIndex:s,error:`find: unknown predicate '${a}'
500
- `,actions:[]};if(n.length===0){s++;continue}break}s++}if(n.length===0)return{expr:null,pathIndex:s,actions:r};let i=n9(n);return i.error?{expr:null,pathIndex:s,error:i.error,actions:r}:{expr:i.expr,pathIndex:s,actions:r}}function n9(e){let t=0;function n(){let o=r();if(!o)return null;for(;t<e.length;){let l=e[t];if(l.type==="op"&&l.op==="or"){t++;let c=r();if(!c)return o;o={type:"or",left:o,right:c}}else break}return o}function r(){let o=s();if(!o)return null;for(;t<e.length;){let l=e[t];if(l.type==="op"&&l.op==="and"){t++;let c=s();if(!c)return o;o={type:"and",left:o,right:c}}else if(l.type==="expr"||l.type==="not"||l.type==="lparen"){let c=s();if(!c)return o;o={type:"and",left:o,right:c}}else break}return o}function s(){if(t<e.length&&e[t].type==="not"){t++;let o=s();return o?{type:"not",expr:o}:null}return i()}function i(){if(t>=e.length)return null;let o=e[t];if(o.type==="lparen"){t++;let l=n();return t<e.length&&e[t].type==="rparen"&&t++,l}return o.type==="expr"?(t++,o.expr):(o.type==="rparen",null)}return{expr:n()}}var Jp=I(()=>{"use strict"});var th={};K(th,{findCommand:()=>o9,flagsForFuzzing:()=>p9});function r9(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function s9(e,t,n){e({category:"find",name:"summary",durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}function l9(e,t){let n=Zs(e),r="",s=0;for(;s<n.length;)if(n[s]==="%"&&s+1<n.length){if(s++,n[s]==="%"){r+="%",s++;continue}let[i,a,o]=Su(n,s);if(s+=o,s>=n.length){r+="%";break}let l=n[s],c;switch(l){case"f":c=t.name,s++;break;case"h":{let u=t.path.lastIndexOf("/");c=u>0?t.path.slice(0,u):".",s++;break}case"p":c=t.path,s++;break;case"P":{let u=t.startingPoint;t.path===u?c="":t.path.startsWith(`${u}/`)?c=t.path.slice(u.length+1):u==="."&&t.path.startsWith("./")?c=t.path.slice(2):c=t.path,s++;break}case"s":c=String(t.size),s++;break;case"d":c=String(t.depth),s++;break;case"m":c=(t.mode&511).toString(8),s++;break;case"M":c=c9(t.mode,t.isDirectory),s++;break;case"t":{let u=new Date(t.mtime);c=u9(u),s++;break}case"T":{if(s+1<n.length){let u=n[s+1],f=new Date(t.mtime);c=f9(f,u),s+=2}else c="%T",s++;break}default:r+=`%${i!==0||a!==-1?`${i}.${a}`:""}${l}`,s++;continue}r+=qs(c,i,a)}else r+=n[s],s++;return r}function c9(e,t){let n=e&511,r=t?"d":"-";return r+=n&256?"r":"-",r+=n&128?"w":"-",r+=n&64?"x":"-",r+=n&32?"r":"-",r+=n&16?"w":"-",r+=n&8?"x":"-",r+=n&4?"r":"-",r+=n&2?"w":"-",r+=n&1?"x":"-",r}function u9(e){let t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=t[e.getDay()],s=n[e.getMonth()],i=String(e.getDate()).padStart(2," "),a=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0"),c=e.getFullYear();return`${r} ${s} ${i} ${a}:${o}:${l} ${c}`}function f9(e,t){switch(t){case"@":return String(e.getTime()/1e3);case"Y":return String(e.getFullYear());case"m":return String(e.getMonth()+1).padStart(2,"0");case"d":return String(e.getDate()).padStart(2,"0");case"H":return String(e.getHours()).padStart(2,"0");case"M":return String(e.getMinutes()).padStart(2,"0");case"S":return String(e.getSeconds()).padStart(2,"0");case"T":return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`;case"F":return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;default:return`%T${t}`}}var eh,i9,a9,o9,p9,nh=I(()=>{"use strict";se();Ba();Xp();Jp();eh=500;i9={name:"find",summary:"search for files in a directory hierarchy",usage:"find [path...] [expression]",options:["-name PATTERN file name matches shell pattern PATTERN","-iname PATTERN like -name but case insensitive","-path PATTERN file path matches shell pattern PATTERN","-ipath PATTERN like -path but case insensitive","-regex PATTERN file path matches regular expression PATTERN","-iregex PATTERN like -regex but case insensitive","-type TYPE file is of type: f (regular file), d (directory)","-empty file is empty or directory is empty","-mtime N file's data was modified N*24 hours ago","-newer FILE file was modified more recently than FILE","-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks)","-perm MODE file's permission bits are exactly MODE (octal)","-perm -MODE all permission bits MODE are set","-perm /MODE any permission bits MODE are set","-maxdepth LEVELS descend at most LEVELS directories","-mindepth LEVELS do not apply tests at levels less than LEVELS","-depth process directory contents before directory itself","-prune do not descend into this directory","-not, ! negate the following expression","-a, -and logical AND (default)","-o, -or logical OR","-exec CMD {} ; execute CMD on each file ({} is replaced by filename)","-exec CMD {} + execute CMD with multiple files at once","-print print the full file name (default action)","-print0 print the full file name followed by a null character","-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t","-delete delete found files/directories"," --help display this help and exit"]},a9=new Set(["-name","-iname","-path","-ipath","-regex","-iregex","-type","-maxdepth","-mindepth","-mtime","-newer","-size","-perm"]),o9={name:"find",async execute(e,t){if(U(e))return M(i9);let n=[],r=null,s=null,i=!1,a=!1;for(let N=0;N<e.length;N++){let P=e[N];if(P==="-maxdepth"&&N+1<e.length)a=!0,r=parseInt(e[++N],10);else if(P==="-mindepth"&&N+1<e.length)a=!0,s=parseInt(e[++N],10);else if(P==="-depth")a=!0,i=!0;else if(P==="-exec")for(a=!0,N++;N<e.length&&e[N]!==";"&&e[N]!=="+";)N++;else!P.startsWith("-")&&P!==";"&&P!=="+"&&P!=="("&&P!==")"&&P!=="\\("&&P!=="\\)"&&P!=="!"?a||n.push(P):a9.has(P)?(a=!0,N++):(P.startsWith("-")||P==="("||P==="\\("||P==="!")&&(a=!0)}n.length===0&&n.push(".");let{expr:o,error:l,actions:c}=Yp(e,0);if(l)return{stdout:"",stderr:l,exitCode:1};let u=c.some(N=>N.type==="print"),f=c.length===0,p=[],h=c.some(N=>N.type==="printf"),m=[],d="",g=0,w=Kp(o),y=new Map;for(let N of w){let P=t.fs.resolvePath(t.cwd,N);try{let v=await t.fs.stat(P);y.set(N,v.mtime?.getTime()??Date.now())}catch{}}let b=c.some(N=>{if(N.type!=="printf")return!1;let P=N.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(P)}),x=gs(o)||b,S=ys(o),$=Zp(o),O=bs(o),L=ws(o),R=typeof t.fs.readdirWithFileTypes=="function";for(let N of n){let ue=function(H){let Ee=s===null||H.depth>=s,ae=!1;if(Ee&&o!==null){let j=Date.now(),ve;if(L)ve=er(o,H.name,H.relativePath,H.isFile,H.isDirectory);else{let Fe={name:H.name,relativePath:H.relativePath,isFile:H.isFile,isDirectory:H.isDirectory,isEmpty:H.isEmpty,mtime:H.stat?.mtime?.getTime()??Date.now(),size:H.stat?.size??0,mode:H.stat?.mode??420,newerRefTimes:y};ve=Kt(o,Fe)}Ee=ve.matches,ae=u?ve.printed:Ee,v.evalCalls++,v.evalTime+=Date.now()-j}else Ee&&(ae=!0);return ae?{print:!0,printfData:h?{path:H.relativePath,name:H.name,size:H.stat?.size??0,mtime:H.stat?.mtime?.getTime()??Date.now(),mode:H.stat?.mode??420,isDirectory:H.isDirectory,depth:H.depth,startingPoint:N}:null}:{print:!1,printfData:null}};var k=ue;N.length>1&&N.endsWith("/")&&(N=N.slice(0,-1));let P=t.fs.resolvePath(t.cwd,N);try{await t.fs.stat(P)}catch{d+=`find: ${N}: No such file or directory
501
- `,g=1;continue}let v=r9(),T=Date.now();async function F(H){let{path:X,depth:Ee,typeInfo:ae}=H;if(v.nodeCount++,r!==null&&Ee>r)return null;let ke,j,ve;if(ae&&!x)ke=ae.isFile,j=ae.isDirectory;else{try{let qn=Date.now();ve=await t.fs.stat(X),v.statCalls++,v.statTime+=Date.now()-qn}catch{return null}if(!ve)return null;ke=ve.isFile,j=ve.isDirectory}let Fe;X===P?Fe=N.split("/").pop()||N:Fe=X.split("/").pop()||"";let je=X===P?N:N==="."?`./${X.slice(P==="/"?P.length:P.length+1)}`:N+X.slice(P.length),et=[],st=null,tt=null,nt=!1;j&&O&&!i&&(nt=Qp(o,{name:Fe,relativePath:je,isFile:ke,isDirectory:j}).shouldPrune,nt&&v.earlyPrunes++);let Ut=r!==null&&Ee>=r,Bt=$.terminalDirName!==null&&Fe===$.terminalDirName,as=!Ut&&!Bt&&!nt;if(j&&((as||S||Bt)&&!nt)){let qn=Date.now();if(R&&t.fs.readdirWithFileTypes){if(st=await t.fs.readdirWithFileTypes(X),tt=st.map(It=>It.name),v.readdirCalls++,v.readdirTime+=Date.now()-qn,as)et=st.map((It,Vt)=>({path:X==="/"?`/${It.name}`:`${X}/${It.name}`,depth:Ee+1,typeInfo:{isFile:It.isFile,isDirectory:It.isDirectory},resultIndex:Vt}));else if(Bt){let It=$.requiredExtension;et=st.filter(Vt=>Vt.isFile&&(!It||Vt.name.endsWith(It))).map((Vt,G6)=>({path:X==="/"?`/${Vt.name}`:`${X}/${Vt.name}`,depth:Ee+1,typeInfo:{isFile:Vt.isFile,isDirectory:Vt.isDirectory},resultIndex:G6}))}}else tt=await t.fs.readdir(X),v.readdirCalls++,v.readdirTime+=Date.now()-qn,as&&(et=tt.map((It,Vt)=>({path:X==="/"?`/${It}`:`${X}/${It}`,depth:Ee+1,resultIndex:Vt})))}let Hs=ke?(ve?.size??0)===0:tt!==null&&tt.length===0,gr=nt;if(!i&&o!==null&&!nt&&O){let qn=Date.now(),It={name:Fe,relativePath:je,isFile:ke,isDirectory:j,isEmpty:Hs,mtime:ve?.mtime?.getTime()??Date.now(),size:ve?.size??0,mode:ve?.mode??420,newerRefTimes:y};gr=Kt(o,It).pruned,v.evalCalls++,v.evalTime+=Date.now()-qn}return{relativePath:je,name:Fe,isFile:ke,isDirectory:j,isEmpty:Hs,stat:ve,depth:Ee,children:gr?[]:et,pruned:gr}}async function re(){let H={paths:[],printfData:[]};if(i){let ve=function(Fe){let je={paths:[],printfData:[]},et=ae[Fe];if(!et)return je;for(let nt of et.childIndices){let Ut=ve(nt);je.paths.push(...Ut.paths),je.printfData.push(...Ut.printfData)}let{print:st,printfData:tt}=ue(et.node);return st&&(je.paths.push(et.node.relativePath),tt&&je.printfData.push(tt)),je};var X=ve;let ae=[],ke=[{item:{path:P,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],j=new Map;for(;ke.length>0;){let Fe=Date.now(),je=ke.splice(0,eh),et=await Promise.all(je.map(st=>F(st.item)));v.batchCount++,v.batchTime+=Date.now()-Fe;for(let st=0;st<je.length;st++){let tt=et[st],nt=je[st];if(!tt)continue;let Ut=ae.length;if(nt.parentIndex>=0){let Bt=j.get(nt.parentIndex)||[];Bt.push(Ut),j.set(nt.parentIndex,Bt)}ae.push({node:tt,parentIndex:nt.parentIndex,childIndices:[]});for(let Bt=0;Bt<tt.children.length;Bt++)ke.push({item:tt.children[Bt],parentIndex:Ut,childOrderInParent:Bt})}}for(let[Fe,je]of j)Fe>=0&&Fe<ae.length&&(ae[Fe].childIndices=je);if(ae.length>0){let Fe=ve(0);H.paths.push(...Fe.paths),H.printfData.push(...Fe.printfData)}}else{let Fe=function(je){let et=ae.get(je);et&&(H.paths.push(et.path),et.printfData&&H.printfData.push(et.printfData));let st=ve.get(je);if(st)for(let tt of st)Fe(tt)};var Ee=Fe;let ae=new Map,ke=0,j=[{item:{path:P,depth:0,resultIndex:0},orderIndex:ke++}],ve=new Map;for(;j.length>0;){let je=Date.now(),et=j.splice(0,eh),st=await Promise.all(et.map(async({item:tt,orderIndex:nt})=>{let Ut=await F(tt);return Ut?{node:Ut,orderIndex:nt}:null}));v.batchCount++,v.batchTime+=Date.now()-je;for(let tt of st){if(!tt)continue;let{node:nt,orderIndex:Ut}=tt,{print:Bt,printfData:as}=ue(nt);if(Bt&&ae.set(Ut,{path:nt.relativePath,printfData:as}),nt.children.length>0){let Ma=[];for(let Hs of nt.children){let gr=ke++;Ma.push(gr),j.push({item:Hs,orderIndex:gr})}ve.set(Ut,Ma)}}}Fe(0)}return H}let te=await re();if(p.push(...te.paths),m.push(...te.printfData),t.trace){let H=Date.now()-T;s9(t.trace,v,H),t.trace({category:"find",name:"searchPath",durationMs:H,details:{path:N,resultsFound:te.paths.length}})}}let W="";if(c.length>0)for(let N of c)switch(N.type){case"print":W+=p.length>0?`${p.join(`
500
+ `,actions:[]};if(n.length===0){s++;continue}break}s++}if(n.length===0)return{expr:null,pathIndex:s,actions:r};let i=n9(n);return i.error?{expr:null,pathIndex:s,error:i.error,actions:r}:{expr:i.expr,pathIndex:s,actions:r}}function n9(e){let t=0;function n(){let o=r();if(!o)return null;for(;t<e.length;){let l=e[t];if(l.type==="op"&&l.op==="or"){t++;let c=r();if(!c)return o;o={type:"or",left:o,right:c}}else break}return o}function r(){let o=s();if(!o)return null;for(;t<e.length;){let l=e[t];if(l.type==="op"&&l.op==="and"){t++;let c=s();if(!c)return o;o={type:"and",left:o,right:c}}else if(l.type==="expr"||l.type==="not"||l.type==="lparen"){let c=s();if(!c)return o;o={type:"and",left:o,right:c}}else break}return o}function s(){if(t<e.length&&e[t].type==="not"){t++;let o=s();return o?{type:"not",expr:o}:null}return i()}function i(){if(t>=e.length)return null;let o=e[t];if(o.type==="lparen"){t++;let l=n();return t<e.length&&e[t].type==="rparen"&&t++,l}return o.type==="expr"?(t++,o.expr):(o.type==="rparen",null)}return{expr:n()}}var Jp=I(()=>{"use strict"});var th={};K(th,{findCommand:()=>o9,flagsForFuzzing:()=>p9});function r9(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function s9(e,t,n){e({category:"find",name:"summary",durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}function l9(e,t){let n=Zs(e),r="",s=0;for(;s<n.length;)if(n[s]==="%"&&s+1<n.length){if(s++,n[s]==="%"){r+="%",s++;continue}let[i,a,o]=Su(n,s);if(s+=o,s>=n.length){r+="%";break}let l=n[s],c;switch(l){case"f":c=t.name,s++;break;case"h":{let u=t.path.lastIndexOf("/");c=u>0?t.path.slice(0,u):".",s++;break}case"p":c=t.path,s++;break;case"P":{let u=t.startingPoint;t.path===u?c="":t.path.startsWith(`${u}/`)?c=t.path.slice(u.length+1):u==="."&&t.path.startsWith("./")?c=t.path.slice(2):c=t.path,s++;break}case"s":c=String(t.size),s++;break;case"d":c=String(t.depth),s++;break;case"m":c=(t.mode&511).toString(8),s++;break;case"M":c=c9(t.mode,t.isDirectory),s++;break;case"t":{let u=new Date(t.mtime);c=u9(u),s++;break}case"T":{if(s+1<n.length){let u=n[s+1],f=new Date(t.mtime);c=f9(f,u),s+=2}else c="%T",s++;break}default:r+=`%${i!==0||a!==-1?`${i}.${a}`:""}${l}`,s++;continue}r+=qs(c,i,a)}else r+=n[s],s++;return r}function c9(e,t){let n=e&511,r=t?"d":"-";return r+=n&256?"r":"-",r+=n&128?"w":"-",r+=n&64?"x":"-",r+=n&32?"r":"-",r+=n&16?"w":"-",r+=n&8?"x":"-",r+=n&4?"r":"-",r+=n&2?"w":"-",r+=n&1?"x":"-",r}function u9(e){let t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=t[e.getDay()],s=n[e.getMonth()],i=String(e.getDate()).padStart(2," "),a=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0"),c=e.getFullYear();return`${r} ${s} ${i} ${a}:${o}:${l} ${c}`}function f9(e,t){switch(t){case"@":return String(e.getTime()/1e3);case"Y":return String(e.getFullYear());case"m":return String(e.getMonth()+1).padStart(2,"0");case"d":return String(e.getDate()).padStart(2,"0");case"H":return String(e.getHours()).padStart(2,"0");case"M":return String(e.getMinutes()).padStart(2,"0");case"S":return String(e.getSeconds()).padStart(2,"0");case"T":return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`;case"F":return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;default:return`%T${t}`}}var eh,i9,a9,o9,p9,nh=I(()=>{"use strict";se();Ba();Xp();Jp();eh=500;i9={name:"find",summary:"search for files in a directory hierarchy",usage:"find [path...] [expression]",options:["-name PATTERN file name matches shell pattern PATTERN","-iname PATTERN like -name but case insensitive","-path PATTERN file path matches shell pattern PATTERN","-ipath PATTERN like -path but case insensitive","-regex PATTERN file path matches regular expression PATTERN","-iregex PATTERN like -regex but case insensitive","-type TYPE file is of type: f (regular file), d (directory)","-empty file is empty or directory is empty","-mtime N file's data was modified N*24 hours ago","-newer FILE file was modified more recently than FILE","-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks)","-perm MODE file's permission bits are exactly MODE (octal)","-perm -MODE all permission bits MODE are set","-perm /MODE any permission bits MODE are set","-maxdepth LEVELS descend at most LEVELS directories","-mindepth LEVELS do not apply tests at levels less than LEVELS","-depth process directory contents before directory itself","-prune do not descend into this directory","-not, ! negate the following expression","-a, -and logical AND (default)","-o, -or logical OR","-exec CMD {} ; execute CMD on each file ({} is replaced by filename)","-exec CMD {} + execute CMD with multiple files at once","-print print the full file name (default action)","-print0 print the full file name followed by a null character","-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t","-delete delete found files/directories"," --help display this help and exit"]},a9=new Set(["-name","-iname","-path","-ipath","-regex","-iregex","-type","-maxdepth","-mindepth","-mtime","-newer","-size","-perm"]),o9={name:"find",async execute(e,t){if(U(e))return M(i9);let n=[],r=null,s=null,i=!1,a=!1;for(let N=0;N<e.length;N++){let P=e[N];if(P==="-maxdepth"&&N+1<e.length)a=!0,r=parseInt(e[++N],10);else if(P==="-mindepth"&&N+1<e.length)a=!0,s=parseInt(e[++N],10);else if(P==="-depth")a=!0,i=!0;else if(P==="-exec")for(a=!0,N++;N<e.length&&e[N]!==";"&&e[N]!=="+";)N++;else!P.startsWith("-")&&P!==";"&&P!=="+"&&P!=="("&&P!==")"&&P!=="\\("&&P!=="\\)"&&P!=="!"?a||n.push(P):a9.has(P)?(a=!0,N++):(P.startsWith("-")||P==="("||P==="\\("||P==="!")&&(a=!0)}n.length===0&&n.push(".");let{expr:o,error:l,actions:c}=Yp(e,0);if(l)return{stdout:"",stderr:l,exitCode:1};let u=c.some(N=>N.type==="print"),f=c.length===0,p=[],h=c.some(N=>N.type==="printf"),m=[],d="",g=0,w=Kp(o),y=new Map;for(let N of w){let P=t.fs.resolvePath(t.cwd,N);try{let k=await t.fs.stat(P);y.set(N,k.mtime?.getTime()??Date.now())}catch{}}let b=c.some(N=>{if(N.type!=="printf")return!1;let P=N.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(P)}),x=gs(o)||b,S=ys(o),$=Zp(o),O=bs(o),L=ws(o),R=typeof t.fs.readdirWithFileTypes=="function";for(let N of n){let ue=function(H){let Ee=s===null||H.depth>=s,ae=!1;if(Ee&&o!==null){let j=Date.now(),ke;if(L)ke=er(o,H.name,H.relativePath,H.isFile,H.isDirectory);else{let Fe={name:H.name,relativePath:H.relativePath,isFile:H.isFile,isDirectory:H.isDirectory,isEmpty:H.isEmpty,mtime:H.stat?.mtime?.getTime()??Date.now(),size:H.stat?.size??0,mode:H.stat?.mode??420,newerRefTimes:y};ke=Kt(o,Fe)}Ee=ke.matches,ae=u?ke.printed:Ee,k.evalCalls++,k.evalTime+=Date.now()-j}else Ee&&(ae=!0);return ae?{print:!0,printfData:h?{path:H.relativePath,name:H.name,size:H.stat?.size??0,mtime:H.stat?.mtime?.getTime()??Date.now(),mode:H.stat?.mode??420,isDirectory:H.isDirectory,depth:H.depth,startingPoint:N}:null}:{print:!1,printfData:null}};var v=ue;N.length>1&&N.endsWith("/")&&(N=N.slice(0,-1));let P=t.fs.resolvePath(t.cwd,N);try{await t.fs.stat(P)}catch{d+=`find: ${N}: No such file or directory
501
+ `,g=1;continue}let k=r9(),T=Date.now();async function F(H){let{path:X,depth:Ee,typeInfo:ae}=H;if(k.nodeCount++,r!==null&&Ee>r)return null;let ve,j,ke;if(ae&&!x)ve=ae.isFile,j=ae.isDirectory;else{try{let qn=Date.now();ke=await t.fs.stat(X),k.statCalls++,k.statTime+=Date.now()-qn}catch{return null}if(!ke)return null;ve=ke.isFile,j=ke.isDirectory}let Fe;X===P?Fe=N.split("/").pop()||N:Fe=X.split("/").pop()||"";let je=X===P?N:N==="."?`./${X.slice(P==="/"?P.length:P.length+1)}`:N+X.slice(P.length),et=[],st=null,tt=null,nt=!1;j&&O&&!i&&(nt=Qp(o,{name:Fe,relativePath:je,isFile:ve,isDirectory:j}).shouldPrune,nt&&k.earlyPrunes++);let Ut=r!==null&&Ee>=r,Bt=$.terminalDirName!==null&&Fe===$.terminalDirName,as=!Ut&&!Bt&&!nt;if(j&&((as||S||Bt)&&!nt)){let qn=Date.now();if(R&&t.fs.readdirWithFileTypes){if(st=await t.fs.readdirWithFileTypes(X),tt=st.map(It=>It.name),k.readdirCalls++,k.readdirTime+=Date.now()-qn,as)et=st.map((It,Vt)=>({path:X==="/"?`/${It.name}`:`${X}/${It.name}`,depth:Ee+1,typeInfo:{isFile:It.isFile,isDirectory:It.isDirectory},resultIndex:Vt}));else if(Bt){let It=$.requiredExtension;et=st.filter(Vt=>Vt.isFile&&(!It||Vt.name.endsWith(It))).map((Vt,G6)=>({path:X==="/"?`/${Vt.name}`:`${X}/${Vt.name}`,depth:Ee+1,typeInfo:{isFile:Vt.isFile,isDirectory:Vt.isDirectory},resultIndex:G6}))}}else tt=await t.fs.readdir(X),k.readdirCalls++,k.readdirTime+=Date.now()-qn,as&&(et=tt.map((It,Vt)=>({path:X==="/"?`/${It}`:`${X}/${It}`,depth:Ee+1,resultIndex:Vt})))}let Hs=ve?(ke?.size??0)===0:tt!==null&&tt.length===0,gr=nt;if(!i&&o!==null&&!nt&&O){let qn=Date.now(),It={name:Fe,relativePath:je,isFile:ve,isDirectory:j,isEmpty:Hs,mtime:ke?.mtime?.getTime()??Date.now(),size:ke?.size??0,mode:ke?.mode??420,newerRefTimes:y};gr=Kt(o,It).pruned,k.evalCalls++,k.evalTime+=Date.now()-qn}return{relativePath:je,name:Fe,isFile:ve,isDirectory:j,isEmpty:Hs,stat:ke,depth:Ee,children:gr?[]:et,pruned:gr}}async function re(){let H={paths:[],printfData:[]};if(i){let ke=function(Fe){let je={paths:[],printfData:[]},et=ae[Fe];if(!et)return je;for(let nt of et.childIndices){let Ut=ke(nt);je.paths.push(...Ut.paths),je.printfData.push(...Ut.printfData)}let{print:st,printfData:tt}=ue(et.node);return st&&(je.paths.push(et.node.relativePath),tt&&je.printfData.push(tt)),je};var X=ke;let ae=[],ve=[{item:{path:P,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],j=new Map;for(;ve.length>0;){let Fe=Date.now(),je=ve.splice(0,eh),et=await Promise.all(je.map(st=>F(st.item)));k.batchCount++,k.batchTime+=Date.now()-Fe;for(let st=0;st<je.length;st++){let tt=et[st],nt=je[st];if(!tt)continue;let Ut=ae.length;if(nt.parentIndex>=0){let Bt=j.get(nt.parentIndex)||[];Bt.push(Ut),j.set(nt.parentIndex,Bt)}ae.push({node:tt,parentIndex:nt.parentIndex,childIndices:[]});for(let Bt=0;Bt<tt.children.length;Bt++)ve.push({item:tt.children[Bt],parentIndex:Ut,childOrderInParent:Bt})}}for(let[Fe,je]of j)Fe>=0&&Fe<ae.length&&(ae[Fe].childIndices=je);if(ae.length>0){let Fe=ke(0);H.paths.push(...Fe.paths),H.printfData.push(...Fe.printfData)}}else{let Fe=function(je){let et=ae.get(je);et&&(H.paths.push(et.path),et.printfData&&H.printfData.push(et.printfData));let st=ke.get(je);if(st)for(let tt of st)Fe(tt)};var Ee=Fe;let ae=new Map,ve=0,j=[{item:{path:P,depth:0,resultIndex:0},orderIndex:ve++}],ke=new Map;for(;j.length>0;){let je=Date.now(),et=j.splice(0,eh),st=await Promise.all(et.map(async({item:tt,orderIndex:nt})=>{let Ut=await F(tt);return Ut?{node:Ut,orderIndex:nt}:null}));k.batchCount++,k.batchTime+=Date.now()-je;for(let tt of st){if(!tt)continue;let{node:nt,orderIndex:Ut}=tt,{print:Bt,printfData:as}=ue(nt);if(Bt&&ae.set(Ut,{path:nt.relativePath,printfData:as}),nt.children.length>0){let Ma=[];for(let Hs of nt.children){let gr=ve++;Ma.push(gr),j.push({item:Hs,orderIndex:gr})}ke.set(Ut,Ma)}}}Fe(0)}return H}let te=await re();if(p.push(...te.paths),m.push(...te.printfData),t.trace){let H=Date.now()-T;s9(t.trace,k,H),t.trace({category:"find",name:"searchPath",durationMs:H,details:{path:N,resultsFound:te.paths.length}})}}let W="";if(c.length>0)for(let N of c)switch(N.type){case"print":W+=p.length>0?`${p.join(`
502
502
  `)}
503
- `:"";break;case"print0":W+=p.length>0?`${p.join("\0")}\0`:"";break;case"delete":{let P=[...p].sort((v,T)=>T.length-v.length);for(let v of P){let T=t.fs.resolvePath(t.cwd,v);try{await t.fs.rm(T,{recursive:!1})}catch(F){let ue=F instanceof Error?F.message:String(F);d+=`find: cannot delete '${v}': ${ue}
503
+ `:"";break;case"print0":W+=p.length>0?`${p.join("\0")}\0`:"";break;case"delete":{let P=[...p].sort((k,T)=>T.length-k.length);for(let k of P){let T=t.fs.resolvePath(t.cwd,k);try{await t.fs.rm(T,{recursive:!1})}catch(F){let ue=F instanceof Error?F.message:String(F);d+=`find: cannot delete '${k}': ${ue}
504
504
  `,g=1}}break}case"printf":for(let P of m)W+=l9(N.format,P);break;case"exec":if(!t.exec)return{stdout:"",stderr:`find: -exec not supported in this context
505
- `,exitCode:1};if(N.batchMode){let P=[];for(let F of N.command)F==="{}"?P.push(...p):P.push(F);let v=P.map(F=>`"${F}"`).join(" "),T=await t.exec(v,{cwd:t.cwd});W+=T.stdout,d+=T.stderr,T.exitCode!==0&&(g=T.exitCode)}else for(let P of p){let T=N.command.map(ue=>ue==="{}"?P:ue).map(ue=>`"${ue}"`).join(" "),F=await t.exec(T,{cwd:t.cwd});W+=F.stdout,d+=F.stderr,F.exitCode!==0&&(g=F.exitCode)}break}else f&&(W=p.length>0?`${p.join(`
505
+ `,exitCode:1};if(N.batchMode){let P=[];for(let F of N.command)F==="{}"?P.push(...p):P.push(F);let k=P.map(F=>`"${F}"`).join(" "),T=await t.exec(k,{cwd:t.cwd});W+=T.stdout,d+=T.stderr,T.exitCode!==0&&(g=T.exitCode)}else for(let P of p){let T=N.command.map(ue=>ue==="{}"?P:ue).map(ue=>`"${ue}"`).join(" "),F=await t.exec(T,{cwd:t.cwd});W+=F.stdout,d+=F.stderr,F.exitCode!==0&&(g=F.exitCode)}break}else f&&(W=p.length>0?`${p.join(`
506
506
  `)}
507
507
  `:"");return{stdout:W,stderr:d,exitCode:g}}};p9={name:"find",flags:[{flag:"-name",type:"value",valueHint:"pattern"},{flag:"-iname",type:"value",valueHint:"pattern"},{flag:"-type",type:"value",valueHint:"string"},{flag:"-maxdepth",type:"value",valueHint:"number"},{flag:"-mindepth",type:"value",valueHint:"number"},{flag:"-empty",type:"boolean"},{flag:"-print",type:"boolean"},{flag:"-print0",type:"boolean"}],needsFiles:!0}});var rh={};K(rh,{basenameCommand:()=>d9,flagsForFuzzing:()=>m9});var h9,d9,m9,sh=I(()=>{"use strict";se();h9={name:"basename",summary:"strip directory and suffix from filenames",usage:`basename NAME [SUFFIX]
508
508
  basename OPTION... NAME...`,options:["-a, --multiple support multiple arguments","-s, --suffix=SUFFIX remove a trailing SUFFIX"," --help display this help and exit"]},d9={name:"basename",async execute(e,t){if(U(e))return M(h9);let n=!1,r="",s=[];for(let a=0;a<e.length;a++){let o=e[a];o==="-a"||o==="--multiple"?n=!0:o==="-s"&&a+1<e.length?(r=e[++a],n=!0):o.startsWith("--suffix=")?(r=o.slice(9),n=!0):o.startsWith("-")||s.push(o)}if(s.length===0)return{stdout:"",stderr:`basename: missing operand
@@ -521,13 +521,13 @@ basename OPTION... NAME...`,options:["-a, --multiple support multiple argument
521
521
  `;let d=await oh(e,u,n,h,s+1);i.output+=d.output,i.dirCount+=d.dirCount,i.fileCount+=d.fileCount}else{i.fileCount++;let m=n.fullPath?u:c.name;i.output+=`${r+p+m}
522
522
  `}}}catch{}return i}var b9,x9,E9,S9,ch=I(()=>{"use strict";Ze();yr();se();b9={name:"tree",summary:"list contents of directories in a tree-like format",usage:"tree [OPTION]... [DIRECTORY]...",options:["-a include hidden files","-d list directories only","-L LEVEL limit depth of directory tree","-f print full path prefix for each file"," --help display this help and exit"]},x9={showHidden:{short:"a",type:"boolean"},directoriesOnly:{short:"d",type:"boolean"},fullPath:{short:"f",type:"boolean"},maxDepth:{short:"L",type:"number"}},E9={name:"tree",async execute(e,t){if(U(e))return M(b9);let n=be("tree",e,x9);if(!n.ok)return n.error;let r={showHidden:n.result.flags.showHidden,directoriesOnly:n.result.flags.directoriesOnly,maxDepth:n.result.flags.maxDepth??null,fullPath:n.result.flags.fullPath},s=n.result.positional;s.length===0&&s.push(".");let i="",a="",o=0,l=0;for(let c of s){let u=await A9(t,c,r,"",0);i+=u.output,a+=u.stderr,o+=u.dirCount,l+=u.fileCount}return i+=`
523
523
  ${o} director${o===1?"y":"ies"}`,r.directoriesOnly||(i+=`, ${l} file${l===1?"":"s"}`),i+=`
524
- `,{stdout:i,stderr:a,exitCode:a?1:0}}};S9={name:"tree",flags:[{flag:"-a",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-L",type:"value",valueHint:"number"}],needsFiles:!0}});var fh={};K(fh,{duCommand:()=>k9,flagsForFuzzing:()=>v9});async function uh(e,t,n,r,s){let i={output:"",totalSize:0,stderr:""};try{let a=await e.fs.stat(t);if(!a.isDirectory)return i.totalSize=a.size,(r.allFiles||s===0)&&(i.output=Ai(a.size,r.humanReadable)+" "+n+`
524
+ `,{stdout:i,stderr:a,exitCode:a?1:0}}};S9={name:"tree",flags:[{flag:"-a",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-L",type:"value",valueHint:"number"}],needsFiles:!0}});var fh={};K(fh,{duCommand:()=>v9,flagsForFuzzing:()=>k9});async function uh(e,t,n,r,s){let i={output:"",totalSize:0,stderr:""};try{let a=await e.fs.stat(t);if(!a.isDirectory)return i.totalSize=a.size,(r.allFiles||s===0)&&(i.output=Ai(a.size,r.humanReadable)+" "+n+`
525
525
  `),i;let o=0,l=[];if(e.fs.readdirWithFileTypes){let f=await e.fs.readdirWithFileTypes(t),p=f.filter(m=>m.isFile),h=f.filter(m=>m.isDirectory);for(let m=0;m<p.length;m+=100){let d=p.slice(m,m+100),g=await Promise.all(d.map(async w=>{let y=t==="/"?`/${w.name}`:`${t}/${w.name}`;try{let b=await e.fs.stat(y);return{name:w.name,isDirectory:!1,size:b.size}}catch{return{name:w.name,isDirectory:!1,size:0}}}));l.push(...g)}l.push(...h.map(m=>({name:m.name,isDirectory:!0})))}else{let f=await e.fs.readdir(t);for(let p=0;p<f.length;p+=100){let h=f.slice(p,p+100),m=await Promise.all(h.map(async d=>{let g=t==="/"?`/${d}`:`${t}/${d}`;try{let w=await e.fs.stat(g);return{name:d,isDirectory:w.isDirectory,size:w.isDirectory?void 0:w.size}}catch{return{name:d,isDirectory:!1,size:0}}}));l.push(...m)}}l.sort((f,p)=>f.name.localeCompare(p.name));let c=l.filter(f=>!f.isDirectory);for(let f of c){let p=f.size??0;if(o+=p,r.allFiles&&!r.summarize){let h=n==="."?f.name:`${n}/${f.name}`;i.output+=Ai(p,r.humanReadable)+" "+h+`
526
526
  `}}let u=l.filter(f=>f.isDirectory);for(let f=0;f<u.length;f+=100){let p=u.slice(f,f+100),h=await Promise.all(p.map(async m=>{let d=t==="/"?`/${m.name}`:`${t}/${m.name}`,g=n==="."?m.name:`${n}/${m.name}`;return{name:m.name,result:await uh(e,d,g,r,s+1)}}));h.sort((m,d)=>m.name.localeCompare(d.name));for(let{result:m}of h)o+=m.totalSize,r.summarize||(r.maxDepth===null||s+1<=r.maxDepth)&&(i.output+=m.output)}i.totalSize=o,(r.summarize||r.maxDepth===null||s<=r.maxDepth)&&(i.output+=`${Ai(o,r.humanReadable)} ${n}
527
527
  `)}catch{i.stderr=`du: cannot read directory '${n}': Permission denied
528
- `}return i}function Ai(e,t){return t?e<1024?`${e}`:e<1024*1024?`${(e/1024).toFixed(1)}K`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)}M`:`${(e/(1024*1024*1024)).toFixed(1)}G`:String(Math.ceil(e/1024)||1)}var C9,N9,k9,v9,ph=I(()=>{"use strict";Ze();yr();se();C9={name:"du",summary:"estimate file space usage",usage:"du [OPTION]... [FILE]...",options:["-a write counts for all files, not just directories","-h print sizes in human readable format","-s display only a total for each argument","-c produce a grand total","--max-depth=N print total for directory only if N or fewer levels deep"," --help display this help and exit"]},N9={allFiles:{short:"a",type:"boolean"},humanReadable:{short:"h",type:"boolean"},summarize:{short:"s",type:"boolean"},grandTotal:{short:"c",type:"boolean"},maxDepth:{long:"max-depth",type:"number"}},k9={name:"du",async execute(e,t){if(U(e))return M(C9);let n=be("du",e,N9);if(!n.ok)return n.error;let r={allFiles:n.result.flags.allFiles,humanReadable:n.result.flags.humanReadable,summarize:n.result.flags.summarize,grandTotal:n.result.flags.grandTotal,maxDepth:n.result.flags.maxDepth??null},s=n.result.positional;s.length===0&&s.push(".");let i="",a="",o=0;for(let l of s){let c=t.fs.resolvePath(t.cwd,l);try{await t.fs.stat(c);let u=await uh(t,c,l,r,0);i+=u.output,o+=u.totalSize,a+=u.stderr}catch{a+=`du: cannot access '${l}': No such file or directory
528
+ `}return i}function Ai(e,t){return t?e<1024?`${e}`:e<1024*1024?`${(e/1024).toFixed(1)}K`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)}M`:`${(e/(1024*1024*1024)).toFixed(1)}G`:String(Math.ceil(e/1024)||1)}var C9,N9,v9,k9,ph=I(()=>{"use strict";Ze();yr();se();C9={name:"du",summary:"estimate file space usage",usage:"du [OPTION]... [FILE]...",options:["-a write counts for all files, not just directories","-h print sizes in human readable format","-s display only a total for each argument","-c produce a grand total","--max-depth=N print total for directory only if N or fewer levels deep"," --help display this help and exit"]},N9={allFiles:{short:"a",type:"boolean"},humanReadable:{short:"h",type:"boolean"},summarize:{short:"s",type:"boolean"},grandTotal:{short:"c",type:"boolean"},maxDepth:{long:"max-depth",type:"number"}},v9={name:"du",async execute(e,t){if(U(e))return M(C9);let n=be("du",e,N9);if(!n.ok)return n.error;let r={allFiles:n.result.flags.allFiles,humanReadable:n.result.flags.humanReadable,summarize:n.result.flags.summarize,grandTotal:n.result.flags.grandTotal,maxDepth:n.result.flags.maxDepth??null},s=n.result.positional;s.length===0&&s.push(".");let i="",a="",o=0;for(let l of s){let c=t.fs.resolvePath(t.cwd,l);try{await t.fs.stat(c);let u=await uh(t,c,l,r,0);i+=u.output,o+=u.totalSize,a+=u.stderr}catch{a+=`du: cannot access '${l}': No such file or directory
529
529
  `}}return r.grandTotal&&s.length>0&&(i+=`${Ai(o,r.humanReadable)} total
530
- `),{stdout:i,stderr:a,exitCode:a?1:0}}};v9={name:"du",flags:[{flag:"-a",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"--max-depth",type:"value",valueHint:"number"}],needsFiles:!0}});var _o={};K(_o,{envCommand:()=>$9,flagsForFuzzing:()=>T9,printenvCommand:()=>R9,printenvFlagsForFuzzing:()=>P9});var I9,$9,O9,R9,T9,P9,Lo=I(()=>{"use strict";se();I9={name:"env",summary:"run a program in a modified environment",usage:"env [OPTION]... [NAME=VALUE]... [COMMAND [ARG]...]",options:["-i, --ignore-environment start with an empty environment","-u NAME, --unset=NAME remove NAME from the environment"," --help display this help and exit"]},$9={name:"env",async execute(e,t){if(U(e))return M(I9);let n=!1,r=[],s=new Map,i=-1;for(let m=0;m<e.length;m++){let d=e[m];if(d==="-i"||d==="--ignore-environment")n=!0;else if(d==="-u"&&m+1<e.length)r.push(e[++m]);else if(d.startsWith("-u"))r.push(d.slice(2));else if(d.startsWith("--unset="))r.push(d.slice(8));else{if(d.startsWith("--")&&d!=="--")return Y("env",d);if(d.startsWith("-")&&d!=="-"){for(let g of d.slice(1))if(g!=="i"&&g!=="u")return Y("env",`-${g}`);d.includes("i")&&(n=!0)}else if(d.includes("=")&&i===-1){let g=d.indexOf("="),w=d.slice(0,g),y=d.slice(g+1);s.set(w,y)}else{i=m;break}}}let a;if(n)a=new Map(s);else{a=new Map(t.env);for(let m of r)a.delete(m);for(let[m,d]of s)a.set(m,d)}if(i===-1){let m=[];for(let[d,g]of a)m.push(`${d}=${g}`);return{stdout:m.join(`
530
+ `),{stdout:i,stderr:a,exitCode:a?1:0}}};k9={name:"du",flags:[{flag:"-a",type:"boolean"},{flag:"-h",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"--max-depth",type:"value",valueHint:"number"}],needsFiles:!0}});var _o={};K(_o,{envCommand:()=>$9,flagsForFuzzing:()=>T9,printenvCommand:()=>R9,printenvFlagsForFuzzing:()=>P9});var I9,$9,O9,R9,T9,P9,Lo=I(()=>{"use strict";se();I9={name:"env",summary:"run a program in a modified environment",usage:"env [OPTION]... [NAME=VALUE]... [COMMAND [ARG]...]",options:["-i, --ignore-environment start with an empty environment","-u NAME, --unset=NAME remove NAME from the environment"," --help display this help and exit"]},$9={name:"env",async execute(e,t){if(U(e))return M(I9);let n=!1,r=[],s=new Map,i=-1;for(let m=0;m<e.length;m++){let d=e[m];if(d==="-i"||d==="--ignore-environment")n=!0;else if(d==="-u"&&m+1<e.length)r.push(e[++m]);else if(d.startsWith("-u"))r.push(d.slice(2));else if(d.startsWith("--unset="))r.push(d.slice(8));else{if(d.startsWith("--")&&d!=="--")return Y("env",d);if(d.startsWith("-")&&d!=="-"){for(let g of d.slice(1))if(g!=="i"&&g!=="u")return Y("env",`-${g}`);d.includes("i")&&(n=!0)}else if(d.includes("=")&&i===-1){let g=d.indexOf("="),w=d.slice(0,g),y=d.slice(g+1);s.set(w,y)}else{i=m;break}}}let a;if(n)a=new Map(s);else{a=new Map(t.env);for(let m of r)a.delete(m);for(let[m,d]of s)a.set(m,d)}if(i===-1){let m=[];for(let[d,g]of a)m.push(`${d}=${g}`);return{stdout:m.join(`
531
531
  `)+(m.length>0?`
532
532
  `:""),stderr:"",exitCode:0}}if(!t.exec)return{stdout:"",stderr:`env: command execution not supported in this context
533
533
  `,exitCode:1};let o=e.slice(i),l=o[0],u=o.slice(1).map(m=>/[\s"'\\$`!*?[\]{}|&;<>()]/.test(m)?`'${m.replace(/'/g,"'\\''")}'`:m),f=["command",l,...u].join(" "),p=Object.entries(s).map(([m,d])=>`${m}="${d}"`).join(" "),h=p?`${p} ${f}`:f;return t.exec(h,{cwd:t.cwd})}},O9={name:"printenv",summary:"print all or part of environment",usage:"printenv [OPTION]... [VARIABLE]...",options:[" --help display this help and exit"]},R9={name:"printenv",async execute(e,t){if(U(e))return M(O9);let n=e.filter(i=>!i.startsWith("-"));if(n.length===0){let i=[];for(let[a,o]of t.env)i.push(`${a}=${o}`);return{stdout:i.join(`
@@ -547,8 +547,8 @@ ${o} director${o===1?"y":"ies"}`,r.directoriesOnly||(i+=`, ${l} file${l===1?"":"
547
547
  `,exitCode:1};let s=li(r.exportedEnv||{},{0:t,"#":String(n.length),"@":n.join(" "),"*":n.join(" ")});n.forEach((o,l)=>{s[String(l+1)]=o});let i=e;if(i.startsWith("#!")){let o=i.indexOf(`
548
548
  `);o!==-1&&(i=i.slice(o+1))}return await r.exec(i,{env:s,cwd:r.cwd,stdin:r.stdin})}var xh,Y9,J9,e5,t5,zo=I(()=>{"use strict";Pn();se();xh={name:"bash",summary:"execute shell commands or scripts",usage:"bash [OPTIONS] [SCRIPT_FILE] [ARGUMENTS...]",options:["-c COMMAND execute COMMAND string"," --help display this help and exit"],notes:["Without -c, reads and executes commands from SCRIPT_FILE.","Arguments are passed as $1, $2, etc. to the script.",'$0 is set to the script name (or "bash" with -c).']},Y9={name:"bash",async execute(e,t){if(U(e))return M(xh);if(e[0]==="-c"&&e.length>=2){let s=e[1],i=e[2]||"bash",a=e.slice(3);return Rr(s,i,a,t)}if(e.length===0)return t.stdin?.trim()?Rr(t.stdin,"bash",[],t):{stdout:"",stderr:"",exitCode:0};let n=e[0],r=e.slice(1);try{let s=t.fs.resolvePath(t.cwd,n),i=await t.fs.readFile(s);return Rr(i,n,r,t)}catch{return{stdout:"",stderr:`bash: ${n}: No such file or directory
549
549
  `,exitCode:127}}}},J9={name:"sh",async execute(e,t){if(U(e))return M({...xh,name:"sh",summary:"execute shell commands or scripts (POSIX shell)"});if(e[0]==="-c"&&e.length>=2){let s=e[1],i=e[2]||"sh",a=e.slice(3);return Rr(s,i,a,t)}if(e.length===0)return t.stdin?.trim()?Rr(t.stdin,"sh",[],t):{stdout:"",stderr:"",exitCode:0};let n=e[0],r=e.slice(1);try{let s=t.fs.resolvePath(t.cwd,n),i=await t.fs.readFile(s);return Rr(i,n,r,t)}catch{return{stdout:"",stderr:`sh: ${n}: No such file or directory
550
- `,exitCode:127}}}};e5={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},t5={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"}});function $e(e){return!Eh.has(e)}function Pe(e,t,n){$e(t)&&(e[t]=n)}function mn(e,t){return Object.hasOwn(e,t)}function Ke(e){return Object.assign(Object.create(null),e)}function Ho(...e){return Object.assign(Object.create(null),...e)}var Eh,Ck,Nn=I(()=>{"use strict";Eh=new Set(["__proto__","constructor","prototype"]),Ck=new Set([...Eh,"__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])});function jo(e,t,n,r,s,i,a,o,l,c){switch(t){case"sort":return Array.isArray(e)?[[...e].sort(a)]:[null];case"sort_by":return!Array.isArray(e)||n.length===0?[null]:[[...e].sort((f,p)=>{let h=s(f,n[0],r)[0],m=s(p,n[0],r)[0];return a(h,m)})];case"bsearch":{if(!Array.isArray(e)){let f=e===null?"null":typeof e=="object"?"object":typeof e;throw new Error(`${f} (${JSON.stringify(e)}) cannot be searched from`)}return n.length===0?[null]:s(e,n[0],r).map(f=>{let p=0,h=e.length;for(;p<h;){let m=p+h>>>1;a(e[m],f)<0?p=m+1:h=m}return p<e.length&&a(e[p],f)===0?p:-p-1})}case"unique_by":{if(!Array.isArray(e)||n.length===0)return[null];let u=new Map;for(let p of e){let h=s(p,n[0],r)[0],m=JSON.stringify(h);u.has(m)||u.set(m,{item:p,key:h})}let f=[...u.values()];return f.sort((p,h)=>a(p.key,h.key)),[f.map(p=>p.item)]}case"group_by":{if(!Array.isArray(e)||n.length===0)return[null];let u=new Map;for(let f of e){let p=JSON.stringify(s(f,n[0],r)[0]);u.has(p)||u.set(p,[]),u.get(p)?.push(f)}return[[...u.values()]]}case"max":return Array.isArray(e)&&e.length>0?[e.reduce((u,f)=>a(u,f)>0?u:f)]:[null];case"max_by":return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((u,f)=>{let p=s(u,n[0],r)[0],h=s(f,n[0],r)[0];return a(p,h)>0?u:f})];case"min":return Array.isArray(e)&&e.length>0?[e.reduce((u,f)=>a(u,f)<0?u:f)]:[null];case"min_by":return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((u,f)=>{let p=s(u,n[0],r)[0],h=s(f,n[0],r)[0];return a(p,h)<0?u:f})];case"add":{let u=f=>{let p=f.filter(h=>h!==null);return p.length===0?null:p.every(h=>typeof h=="number")?p.reduce((h,m)=>h+m,0):p.every(h=>typeof h=="string")?p.join(""):p.every(h=>Array.isArray(h))?p.flat():p.every(h=>h&&typeof h=="object"&&!Array.isArray(h))?li(...p):null};if(n.length>=1){let f=s(e,n[0],r);return[u(f)]}return Array.isArray(e)?[u(e)]:[null]}case"any":{if(n.length>=2){try{let u=i(e,n[0],r);for(let f of u)if(s(f,n[1],r).some(o))return[!0]}catch(u){if(u instanceof c)throw u}return[!1]}return n.length===1?Array.isArray(e)?[e.some(u=>o(s(u,n[0],r)[0]))]:[!1]:Array.isArray(e)?[e.some(o)]:[!1]}case"all":{if(n.length>=2){try{let u=i(e,n[0],r);for(let f of u)if(!s(f,n[1],r).some(o))return[!1]}catch(u){if(u instanceof c)throw u}return[!0]}return n.length===1?Array.isArray(e)?[e.every(u=>o(s(u,n[0],r)[0]))]:[!0]:Array.isArray(e)?[e.every(o)]:[!0]}case"select":return n.length===0?[e]:s(e,n[0],r).some(o)?[e]:[];case"map":return n.length===0||!Array.isArray(e)?[null]:[e.flatMap(f=>s(f,n[0],r))];case"map_values":{if(n.length===0)return[null];if(Array.isArray(e))return[e.flatMap(u=>s(u,n[0],r))];if(e&&typeof e=="object"){let u=Object.create(null);for(let[f,p]of Object.entries(e)){if(!$e(f))continue;let h=s(p,n[0],r);h.length>0&&Pe(u,f,h[0])}return[u]}return[null]}case"has":{if(n.length===0)return[!1];let f=s(e,n[0],r)[0];return Array.isArray(e)&&typeof f=="number"?[f>=0&&f<e.length]:e&&typeof e=="object"&&typeof f=="string"?[mn(e,f)]:[!1]}case"in":{if(n.length===0)return[!1];let f=s(e,n[0],r)[0];return Array.isArray(f)&&typeof e=="number"?[e>=0&&e<f.length]:f&&typeof f=="object"&&typeof e=="string"?[mn(f,e)]:[!1]}case"contains":{if(n.length===0)return[!1];let u=s(e,n[0],r);return[l(e,u[0])]}case"inside":{if(n.length===0)return[!1];let u=s(e,n[0],r);return[l(u[0],e)]}default:return null}}var Ah=I(()=>{"use strict";Pn();Nn()});function Go(e,t,n,r,s,i,a,o){switch(t){case"first":if(n.length>0)try{let l=i(e,n[0],r);return l.length>0?[l[0]]:[]}catch(l){if(l instanceof o)throw l;return[]}return Array.isArray(e)&&e.length>0?[e[0]]:[null];case"last":if(n.length>0){let l=s(e,n[0],r);return l.length>0?[l[l.length-1]]:[]}return Array.isArray(e)&&e.length>0?[e[e.length-1]]:[null];case"nth":{if(n.length<1)return[null];let l=s(e,n[0],r);if(n.length>1){for(let u of l)if(u<0)throw new Error("nth doesn't support negative indices");let c;try{c=i(e,n[1],r)}catch(u){if(u instanceof o)throw u;c=[]}return l.flatMap(u=>{let f=u;return f<c.length?[c[f]]:[]})}return Array.isArray(e)?l.flatMap(c=>{let u=c;if(u<0)throw new Error("nth doesn't support negative indices");return u<e.length?[e[u]]:[null]}):[null]}case"range":{if(n.length===0)return[];let l=s(e,n[0],r);if(n.length===1){let p=[];for(let h of l){let m=h;for(let d=0;d<m;d++)p.push(d)}return p}let c=s(e,n[1],r);if(n.length===2){let p=[];for(let h of l)for(let m of c){let d=h,g=m;for(let w=d;w<g;w++)p.push(w)}return p}let u=s(e,n[2],r),f=[];for(let p of l)for(let h of c)for(let m of u){let d=p,g=h,w=m;if(w!==0)if(w>0)for(let y=d;y<g;y+=w)f.push(y);else for(let y=d;y>g;y+=w)f.push(y)}return f}case"limit":return n.length<2?[]:s(e,n[0],r).flatMap(c=>{let u=c;if(u<0)throw new Error("limit doesn't support negative count");if(u===0)return[];let f;try{f=i(e,n[1],r)}catch(p){if(p instanceof o)throw p;f=[]}return f.slice(0,u)});case"isempty":{if(n.length<1)return[!0];try{return[i(e,n[0],r).length===0]}catch(l){if(l instanceof o)throw l;return[!0]}}case"isvalid":{if(n.length<1)return[!0];try{return[s(e,n[0],r).length>0]}catch(l){if(l instanceof o)throw l;return[!1]}}case"skip":return n.length<2?[]:s(e,n[0],r).flatMap(c=>{let u=c;if(u<0)throw new Error("skip doesn't support negative count");return s(e,n[1],r).slice(u)});case"until":{if(n.length<2)return[e];let l=e,c=r.limits.maxIterations;for(let u=0;u<c;u++){if(s(l,n[0],r).some(a))return[l];let p=s(l,n[1],r);if(p.length===0)return[l];l=p[0]}throw new o(`jq until: too many iterations (${c}), increase executionLimits.maxJqIterations`,"iterations")}case"while":{if(n.length<2)return[e];let l=[],c=e,u=r.limits.maxIterations;for(let f=0;f<u&&s(c,n[0],r).some(a);f++){l.push(c);let h=s(c,n[1],r);if(h.length===0)break;c=h[0]}if(l.length>=u)throw new o(`jq while: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}case"repeat":{if(n.length===0)return[e];let l=[],c=e,u=r.limits.maxIterations;for(let f=0;f<u;f++){l.push(c);let p=s(c,n[0],r);if(p.length===0)break;c=p[0]}if(l.length>=u)throw new o(`jq repeat: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}default:return null}}var Sh=I(()=>{"use strict"});function Vo(e,t,n,r,s){switch(t){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof e!="number")return[null];let i=new Date(e*1e3),a=i.getUTCFullYear(),o=i.getUTCMonth(),l=i.getUTCDate(),c=i.getUTCHours(),u=i.getUTCMinutes(),f=i.getUTCSeconds(),p=i.getUTCDay(),h=Date.UTC(a,0,1),m=Math.floor((i.getTime()-h)/(1440*60*1e3));return[[a,o,l,c,u,f,p,m]]}case"mktime":{if(!Array.isArray(e))throw new Error("mktime requires parsed datetime inputs");let[i,a,o,l=0,c=0,u=0]=e;if(typeof i!="number"||typeof a!="number")throw new Error("mktime requires parsed datetime inputs");let f=Date.UTC(i,a,o??1,l??0,c??0,u??0);return[Math.floor(f/1e3)]}case"strftime":{if(n.length===0)return[null];let a=s(e,n[0],r)[0];if(typeof a!="string")throw new Error("strftime/1 requires a string format");let o;if(typeof e=="number")o=new Date(e*1e3);else if(Array.isArray(e)){let[p,h,m,d=0,g=0,w=0]=e;if(typeof p!="number"||typeof h!="number")throw new Error("strftime/1 requires parsed datetime inputs");o=new Date(Date.UTC(p,h,m??1,d??0,g??0,w??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"],u=(p,h=2)=>String(p).padStart(h,"0");return[a.replace(/%Y/g,String(o.getUTCFullYear())).replace(/%m/g,u(o.getUTCMonth()+1)).replace(/%d/g,u(o.getUTCDate())).replace(/%H/g,u(o.getUTCHours())).replace(/%M/g,u(o.getUTCMinutes())).replace(/%S/g,u(o.getUTCSeconds())).replace(/%A/g,l[o.getUTCDay()]).replace(/%B/g,c[o.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(n.length===0)return[null];if(typeof e!="string")throw new Error("strptime/1 requires a string input");let a=s(e,n[0],r)[0];if(typeof a!="string")throw new Error("strptime/1 requires a string format");if(a==="%Y-%m-%dT%H:%M:%SZ"){let l=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(l){let[,c,u,f,p,h,m]=l.map(Number),d=new Date(Date.UTC(c,u-1,f,p,h,m)),g=d.getUTCDay(),w=Date.UTC(c,0,1),y=Math.floor((d.getTime()-w)/(1440*60*1e3));return[[c,u-1,f,p,h,m,g,y]]}}let o=new Date(e);if(!Number.isNaN(o.getTime())){let l=o.getUTCFullYear(),c=o.getUTCMonth(),u=o.getUTCDate(),f=o.getUTCHours(),p=o.getUTCMinutes(),h=o.getUTCSeconds(),m=o.getUTCDay(),d=Date.UTC(l,0,1),g=Math.floor((o.getTime()-d)/(1440*60*1e3));return[[l,c,u,f,p,h,m,g]]}throw new Error(`Cannot parse date: ${e}`)}case"fromdate":{if(typeof e!="string")throw new Error("fromdate requires a string input");let i=new Date(e);if(Number.isNaN(i.getTime()))throw new Error(`date "${e}" does not match format "%Y-%m-%dT%H:%M:%SZ"`);return[Math.floor(i.getTime()/1e3)]}case"todate":{if(typeof e!="number")throw new Error("todate requires a number input");return[new Date(e*1e3).toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}var Ch=I(()=>{"use strict"});function Qt(e){return e!==!1&&e!==null}function Tr(e,t){return JSON.stringify(e)===JSON.stringify(t)}function xs(e,t){return typeof e=="number"&&typeof t=="number"?e-t:typeof e=="string"&&typeof t=="string"?e.localeCompare(t):0}function qo(e,t){let n=Ke(e);for(let r of Object.keys(t))$e(r)&&(mn(n,r)&&n[r]&&typeof n[r]=="object"&&!Array.isArray(n[r])&&t[r]&&typeof t[r]=="object"&&!Array.isArray(t[r])?Pe(n,r,qo(n[r],t[r])):Pe(n,r,t[r]));return n}function Pr(e,t=3e3){let n=0,r=e;for(;n<t;)if(Array.isArray(r)){if(r.length===0)return n+1;r=r[0],n++}else if(r!==null&&typeof r=="object"){let s=Object.keys(r);if(s.length===0)return n+1;r=r[s[0]],n++}else return n;return n}function Si(e,t){let n=i=>i===null?0:typeof i=="boolean"?1:typeof i=="number"?2:typeof i=="string"?3:Array.isArray(i)?4:typeof i=="object"?5:6,r=n(e),s=n(t);if(r!==s)return r-s;if(typeof e=="number"&&typeof t=="number")return e-t;if(typeof e=="string"&&typeof t=="string")return e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return(e?1:0)-(t?1:0);if(Array.isArray(e)&&Array.isArray(t)){for(let i=0;i<Math.min(e.length,t.length);i++){let a=Si(e[i],t[i]);if(a!==0)return a}return e.length-t.length}if(e&&t&&typeof e=="object"&&typeof t=="object"){let i=e,a=t,o=Object.keys(i).sort(),l=Object.keys(a).sort();for(let c=0;c<Math.min(o.length,l.length);c++){let u=o[c].localeCompare(l[c]);if(u!==0)return u}if(o.length!==l.length)return o.length-l.length;for(let c of o){let u=Si(i[c],a[c]);if(u!==0)return u}}return 0}function Ci(e,t){if(Tr(e,t))return!0;if(typeof e=="string"&&typeof t=="string")return e.includes(t);if(Array.isArray(e)&&Array.isArray(t))return t.every(n=>e.some(r=>Ci(r,n)));if(e&&t&&typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)){let n=e,r=t;return Object.keys(r).every(s=>mn(n,s)&&Ci(n[s],r[s]))}return!1}var Ni=I(()=>{"use strict";Nn()});function Zo(e,t,n){switch(t){case"@base64":return typeof e=="string"?typeof Buffer<"u"?[Buffer.from(e,"utf-8").toString("base64")]:[btoa(e)]:[null];case"@base64d":return typeof e=="string"?typeof Buffer<"u"?[Buffer.from(e,"base64").toString("utf-8")]:[atob(e)]:[null];case"@uri":return typeof e=="string"?[encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")]:[null];case"@urid":return typeof e=="string"?[decodeURIComponent(e)]:[null];case"@csv":return Array.isArray(e)?[e.map(s=>{if(s===null)return"";if(typeof s=="boolean")return s?"true":"false";if(typeof s=="number")return String(s);let i=String(s);return i.includes(",")||i.includes('"')||i.includes(`
551
- `)||i.includes("\r")?`"${i.replace(/"/g,'""')}"`:i}).join(",")]:[null];case"@tsv":return Array.isArray(e)?[e.map(r=>String(r??"").replace(/\t/g,"\\t").replace(/\n/g,"\\n")).join(" ")]:[null];case"@json":{let r=n??n5;return Pr(e,r+1)>r?[null]:[JSON.stringify(e)]}case"@html":return typeof e=="string"?[e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;")]:[null];case"@sh":return typeof e=="string"?[`'${e.replace(/'/g,"'\\''")}'`]:[null];case"@text":return typeof e=="string"?[e]:e==null?[""]:[String(e)];default:return null}}var n5,Nh=I(()=>{"use strict";Ni();n5=2e3});function Ko(e,t,n,r,s,i){switch(t){case"index":return n.length===0?[null]:s(e,n[0],r).map(o=>{if(typeof e=="string"&&typeof o=="string"){if(o===""&&e==="")return null;let l=e.indexOf(o);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(o)){for(let c=0;c<=e.length-o.length;c++){let u=!0;for(let f=0;f<o.length;f++)if(!i(e[c+f],o[f])){u=!1;break}if(u)return c}return null}let l=e.findIndex(c=>i(c,o));return l>=0?l:null}return null});case"rindex":return n.length===0?[null]:s(e,n[0],r).map(o=>{if(typeof e=="string"&&typeof o=="string"){let l=e.lastIndexOf(o);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(o)){for(let l=e.length-o.length;l>=0;l--){let c=!0;for(let u=0;u<o.length;u++)if(!i(e[l+u],o[u])){c=!1;break}if(c)return l}return null}for(let l=e.length-1;l>=0;l--)if(i(e[l],o))return l;return null}return null});case"indices":return n.length===0?[[]]:s(e,n[0],r).map(o=>{let l=[];if(typeof e=="string"&&typeof o=="string"){let c=e.indexOf(o);for(;c!==-1;)l.push(c),c=e.indexOf(o,c+1)}else if(Array.isArray(e))if(Array.isArray(o)){let c=o.length;if(c===0)for(let u=0;u<=e.length;u++)l.push(u);else for(let u=0;u<=e.length-c;u++){let f=!0;for(let p=0;p<c;p++)if(!i(e[u+p],o[p])){f=!1;break}f&&l.push(u)}}else for(let c=0;c<e.length;c++)i(e[c],o)&&l.push(c);return l});default:return null}}var kh=I(()=>{"use strict"});function Qo(e,t,n,r,s){switch(t){case"fabs":case"abs":return typeof e=="number"?[Math.abs(e)]:typeof e=="string"?[e]:[null];case"exp10":return typeof e=="number"?[10**e]:[null];case"exp2":return typeof e=="number"?[2**e]:[null];case"pow":{if(n.length<2)return[null];let i=s(e,n[0],r),a=s(e,n[1],r),o=i[0],l=a[0];return typeof o!="number"||typeof l!="number"?[null]:[o**l]}case"atan2":{if(n.length<2)return[null];let i=s(e,n[0],r),a=s(e,n[1],r),o=i[0],l=a[0];return typeof o!="number"||typeof l!="number"?[null]:[Math.atan2(o,l)]}case"hypot":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.hypot(e,i)]}case"fma":{if(typeof e!="number"||n.length<2)return[null];let i=s(e,n[0],r)[0],a=s(e,n[1],r)[0];return[e*i+a]}case"copysign":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.sign(i)*Math.abs(e)]}case"drem":case"remainder":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e-Math.round(e/i)*i]}case"fdim":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.max(0,e-i)]}case"fmax":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.max(e,i)]}case"fmin":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.min(e,i)]}case"ldexp":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e*2**i]}case"scalbn":case"scalbln":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e*2**i]}case"nearbyint":return typeof e=="number"?[Math.round(e)]:[null];case"logb":return typeof e=="number"?[Math.floor(Math.log2(Math.abs(e)))]:[null];case"significand":if(typeof e=="number"){let i=Math.floor(Math.log2(Math.abs(e)));return[e/2**i]}return[null];case"frexp":if(typeof e=="number"){if(e===0)return[[0,0]];let i=Math.floor(Math.log2(Math.abs(e)))+1;return[[e/2**i,i]]}return[null];case"modf":if(typeof e=="number"){let i=Math.trunc(e);return[[e-i,i]]}return[null];default:return null}}var vh=I(()=>{"use strict"});function Xo(e,t,n,r,s,i,a,o){switch(t){case"recurse":{if(n.length===0){let h=[],m=d=>{if(h.push(d),Array.isArray(d))for(let g of d)m(g);else if(d&&typeof d=="object")for(let g of Object.keys(d))m(d[g])};return m(e),h}let l=[],c=n.length>=2?n[1]:null,u=1e4,f=0,p=h=>{if(f++>u||c&&!s(h,c,r).some(i))return;l.push(h);let m=s(h,n[0],r);for(let d of m)d!=null&&p(d)};return p(e),l}case"recurse_down":return o(e,"recurse",n,r);case"walk":{if(n.length===0)return[e];let l=new WeakSet,c=u=>{if(u&&typeof u=="object"){if(l.has(u))return u;l.add(u)}let f;if(Array.isArray(u))f=u.map(c);else if(u&&typeof u=="object"){let h=Object.create(null);for(let[m,d]of Object.entries(u))$e(m)&&Pe(h,m,c(d));f=h}else f=u;return s(f,n[0],r)[0]};return[c(e)]}case"transpose":{if(!Array.isArray(e))return[null];if(e.length===0)return[[]];let l=Math.max(...e.map(u=>Array.isArray(u)?u.length:0)),c=[];for(let u=0;u<l;u++)c.push(e.map(f=>Array.isArray(f)?f[u]:null));return[c]}case"combinations":{if(n.length>0){let f=s(e,n[0],r)[0];if(!Array.isArray(e)||f<0)return[];if(f===0)return[[]];let p=[],h=(m,d)=>{if(d===f){p.push([...m]);return}for(let g of e)m.push(g),h(m,d+1),m.pop()};return h([],0),p}if(!Array.isArray(e))return[];if(e.length===0)return[[]];for(let u of e)if(!Array.isArray(u))return[];let l=[],c=(u,f)=>{if(u===e.length){l.push([...f]);return}let p=e[u];for(let h of p)f.push(h),c(u+1,f),f.pop()};return c(0,[]),l}case"parent":{if(r.root===void 0||r.currentPath===void 0)return[];let l=r.currentPath;if(l.length===0)return[];let c=n.length>0?s(e,n[0],r)[0]:1;if(c>=0){if(c>l.length)return[];let u=l.slice(0,l.length-c);return[a(r.root,u)]}else{let u=-c-1;if(u>=l.length)return[e];let f=l.slice(0,u);return[a(r.root,f)]}}case"parents":{if(r.root===void 0||r.currentPath===void 0)return[[]];let l=r.currentPath,c=[];for(let u=l.length-1;u>=0;u--)c.push(a(r.root,l.slice(0,u)));return[c]}case"root":return r.root!==void 0?[r.root]:[];default:return null}}var Ih=I(()=>{"use strict";Nn()});function Yo(e,t,n,r,s){switch(t){case"keys":return Array.isArray(e)?[e.map((i,a)=>a)]:e&&typeof e=="object"?[Object.keys(e).sort()]:[null];case"keys_unsorted":return Array.isArray(e)?[e.map((i,a)=>a)]:e&&typeof e=="object"?[Object.keys(e)]:[null];case"length":return typeof e=="string"?[e.length]:Array.isArray(e)?[e.length]:e&&typeof e=="object"?[Object.keys(e).length]:e===null?[0]:typeof e=="number"?[Math.abs(e)]:[null];case"utf8bytelength":{if(typeof e=="string")return[new TextEncoder().encode(e).length];let i=e===null?"null":Array.isArray(e)?"array":typeof e,a=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${a}) only strings have UTF-8 byte length`)}case"to_entries":return e&&typeof e=="object"&&!Array.isArray(e)?[Object.entries(e).map(([i,a])=>({key:i,value:a}))]:[null];case"from_entries":if(Array.isArray(e)){let i=Object.create(null);for(let a of e)if(a&&typeof a=="object"){let o=a,l=o.key??o.Key??o.name??o.Name??o.k,c=o.value??o.Value??o.v;if(l!==void 0){let u=String(l);$e(u)&&Pe(i,u,c)}}return[i]}return[null];case"with_entries":{if(n.length===0)return[e];if(e&&typeof e=="object"&&!Array.isArray(e)){let a=Object.entries(e).map(([l,c])=>({key:l,value:c})).flatMap(l=>s(l,n[0],r)),o=Object.create(null);for(let l of a)if(l&&typeof l=="object"){let c=l,u=c.key??c.name??c.k,f=c.value??c.v;if(u!==void 0){let p=String(u);$e(p)&&Pe(o,p,f)}}return[o]}return[null]}case"reverse":return Array.isArray(e)?[[...e].reverse()]:typeof e=="string"?[e.split("").reverse().join("")]:[null];case"flatten":return Array.isArray(e)?(n.length>0?s(e,n[0],r):[Number.POSITIVE_INFINITY]).map(a=>{let o=a;if(o<0)throw new Error("flatten depth must not be negative");return e.flat(o)}):[null];case"unique":if(Array.isArray(e)){let i=new Set,a=[];for(let o of e){let l=JSON.stringify(o);i.has(l)||(i.add(l),a.push(o))}return[a]}return[null];case"tojson":case"tojsonstream":{let i=r.limits.maxDepth??r5;return Pr(e,i+1)>i?[null]:[JSON.stringify(e)]}case"fromjson":{if(typeof e=="string"){let i=e.trim().toLowerCase();if(i==="nan")return[Number.NaN];if(i==="inf"||i==="infinity")return[Number.POSITIVE_INFINITY];if(i==="-inf"||i==="-infinity")return[Number.NEGATIVE_INFINITY];try{return[JSON.parse(e)]}catch{throw new Error(`Invalid JSON: ${e}`)}}return[e]}case"tostring":return typeof e=="string"?[e]:[JSON.stringify(e)];case"tonumber":if(typeof e=="number")return[e];if(typeof e=="string"){let i=Number(e);if(Number.isNaN(i))throw new Error(`${JSON.stringify(e)} cannot be parsed as a number`);return[i]}throw new Error(`${typeof e} cannot be parsed as a number`);case"toboolean":{if(typeof e=="boolean")return[e];if(typeof e=="string"){if(e==="true")return[!0];if(e==="false")return[!1];throw new Error(`string (${JSON.stringify(e)}) cannot be parsed as a boolean`)}let i=e===null?"null":Array.isArray(e)?"array":typeof e,a=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${a}) cannot be parsed as a boolean`)}case"tostream":{let i=[],a=(o,l)=>{if(o===null||typeof o!="object")i.push([l,o]);else if(Array.isArray(o))if(o.length===0)i.push([l,[]]);else for(let c=0;c<o.length;c++)a(o[c],[...l,c]);else{let c=Object.keys(o);if(c.length===0)i.push([l,Object.create(null)]);else for(let u of c)a(o[u],[...l,u])}};return a(e,[]),i.push([[]]),i}case"fromstream":{if(n.length===0)return[e];let i=s(e,n[0],r),a=null;for(let o of i){if(!Array.isArray(o)||o.length===1&&Array.isArray(o[0])&&o[0].length===0||o.length!==2)continue;let[l,c]=o;if(!Array.isArray(l))continue;if(l.length===0){a=c;continue}a===null&&(a=typeof l[0]=="number"?[]:{});let u=a;for(let p=0;p<l.length-1;p++){let h=l[p],m=l[p+1];if(Array.isArray(u)&&typeof h=="number"){for(;u.length<=h;)u.push(null);u[h]===null&&(u[h]=typeof m=="number"?[]:{}),u=u[h]}else if(u&&typeof u=="object"&&!Array.isArray(u)){let d=String(h);if(!$e(d))continue;let g=u;(g[d]===null||g[d]===void 0)&&Pe(g,d,typeof m=="number"?[]:{}),u=g[d]}}let f=l[l.length-1];if(Array.isArray(u)&&typeof f=="number"){for(;u.length<=f;)u.push(null);u[f]=c}else if(u&&typeof u=="object"&&!Array.isArray(u)){let p=String(f);$e(p)&&Pe(u,p,c)}}return[a]}case"truncate_stream":{let i=typeof e=="number"?Math.floor(e):0;if(n.length===0)return[];let a=[],o=s(e,n[0],r);for(let l of o)if(Array.isArray(l)){if(l.length===1&&Array.isArray(l[0])){let c=l[0];c.length>i&&a.push([c.slice(i)]);continue}if(l.length===2&&Array.isArray(l[0])){let c=l[0],u=l[1];c.length>i&&a.push([c.slice(i),u])}}return a}default:return null}}var r5,$h=I(()=>{"use strict";Nn();Ni();r5=2e3});function Jo(e,t,n,r,s,i,a,o,l,c){switch(t){case"getpath":{if(n.length===0)return[null];let u=s(e,n[0],r),f=[];for(let p of u){let h=p,m=e;for(let d of h){if(m==null){m=null;break}if(Array.isArray(m)&&typeof d=="number")m=m[d];else if(typeof m=="object"&&typeof d=="string"){let g=m;if(!Object.hasOwn(g,d)){m=null;break}m=g[d]}else{m=null;break}}f.push(m)}return f}case"setpath":{if(n.length<2)return[null];let f=s(e,n[0],r)[0],h=s(e,n[1],r)[0];return[a(e,f,h)]}case"delpaths":{if(n.length===0)return[e];let f=s(e,n[0],r)[0],p=e;for(let h of f.sort((m,d)=>d.length-m.length))p=o(p,h);return[p]}case"path":{if(n.length===0)return[[]];let u=[];return c(e,n[0],r,[],u),u}case"del":return n.length===0?[e]:[l(e,n[0],r)];case"pick":{if(n.length===0)return[null];let u=[];for(let p of n)c(e,p,r,[],u);let f=null;for(let p of u){for(let m of p)if(typeof m=="number"&&m<0)throw new Error("Out of bounds negative array index");let h=e;for(let m of p){if(h==null)break;if(Array.isArray(h)&&typeof m=="number")h=h[m];else if(typeof h=="object"&&typeof m=="string"){let d=h;if(!Object.hasOwn(d,m)){h=null;break}h=d[m]}else{h=null;break}}f=a(f,p,h)}return[f]}case"paths":{let u=[],f=(p,h)=>{if(p&&typeof p=="object")if(Array.isArray(p))for(let m=0;m<p.length;m++)u.push([...h,m]),f(p[m],[...h,m]);else for(let m of Object.keys(p))u.push([...h,m]),f(p[m],[...h,m])};return f(e,[]),n.length>0?u.filter(p=>{let h=e;for(let d of p)if(Array.isArray(h)&&typeof d=="number")h=h[d];else if(h&&typeof h=="object"&&typeof d=="string"){let g=h;if(!Object.hasOwn(g,d))return!1;h=g[d]}else return!1;return s(h,n[0],r).some(i)}):u}case"leaf_paths":{let u=[],f=(p,h)=>{if(p===null||typeof p!="object")u.push(h);else if(Array.isArray(p))for(let m=0;m<p.length;m++)f(p[m],[...h,m]);else for(let m of Object.keys(p))f(p[m],[...h,m])};return f(e,[]),u}default:return null}}var Oh=I(()=>{"use strict"});function el(e,t,n,r,s,i){switch(t){case"IN":{if(n.length===0)return[!1];if(n.length===1){let c=s(e,n[0],r);for(let u of c)if(i(e,u))return[!0];return[!1]}let a=s(e,n[0],r),o=s(e,n[1],r),l=new Set(o.map(c=>JSON.stringify(c)));for(let c of a)if(l.has(JSON.stringify(c)))return[!0];return[!1]}case"INDEX":{if(n.length===0)return[{}];if(n.length===1){let l=s(e,n[0],r),c=Object.create(null);for(let u of l){let f=String(u);$e(f)&&Pe(c,f,u)}return[c]}if(n.length===2){let l=s(e,n[0],r),c=Object.create(null);for(let u of l){let f=s(u,n[1],r);if(f.length>0){let p=String(f[0]);$e(p)&&Pe(c,p,u)}}return[c]}let a=s(e,n[0],r),o=Object.create(null);for(let l of a){let c=s(l,n[1],r),u=s(l,n[2],r);if(c.length>0&&u.length>0){let f=String(c[0]);$e(f)&&Pe(o,f,u[0])}}return[o]}case"JOIN":{if(n.length<2)return[null];let a=s(e,n[0],r)[0];if(!a||typeof a!="object"||Array.isArray(a))return[null];let o=a;if(!Array.isArray(e))return[null];let l=[];for(let c of e){let u=s(c,n[1],r),f=u.length>0?String(u[0]):"",p=mn(o,f)?o[f]:null;l.push([c,p])}return[l]}default:return null}}var Rh=I(()=>{"use strict";Nn()});function tl(e,t,n,r,s){switch(t){case"join":{if(!Array.isArray(e))return[null];let i=n.length>0?s(e,n[0],r):[""];for(let a of e)if(Array.isArray(a)||a!==null&&typeof a=="object")throw new Error("cannot join: contains arrays or objects");return i.map(a=>e.map(o=>o===null?"":typeof o=="string"?o:String(o)).join(String(a)))}case"split":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),a=String(i[0]);return[e.split(a)]}case"splits":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),a=String(i[0]);try{let o=n.length>1?String(s(e,n[1],r)[0]):"g";return V(a,o.includes("g")?o:`${o}g`).split(e)}catch{return[]}}case"scan":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),a=String(i[0]);try{let o=n.length>1?String(s(e,n[1],r)[0]):"";return[...V(a,o.includes("g")?o:`${o}g`).matchAll(e)].map(u=>u.length>1?u.slice(1):u[0])}catch{return[]}}case"test":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r),a=String(i[0]);try{let o=n.length>1?String(s(e,n[1],r)[0]):"";return[V(a,o).test(e)]}catch{return[!1]}}case"match":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),a=String(i[0]);try{let o=n.length>1?String(s(e,n[1],r)[0]):"",c=V(a,`${o}d`).exec(e);if(!c)return[];let u=c.indices;return[{offset:c.index,length:c[0].length,string:c[0],captures:c.slice(1).map((f,p)=>({offset:u?.[p+1]?.[0]??null,length:f?.length??0,string:f??"",name:null}))}]}catch{return[null]}}case"capture":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),a=String(i[0]);try{let o=n.length>1?String(s(e,n[1],r)[0]):"",c=V(a,o).match(e);return!c||!c.groups?[{}]:[c.groups]}catch{return[null]}}case"sub":{if(typeof e!="string"||n.length<2)return[null];let i=s(e,n[0],r),a=s(e,n[1],r),o=String(i[0]),l=String(a[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"";return[V(o,c).replace(e,l)]}catch{return[e]}}case"gsub":{if(typeof e!="string"||n.length<2)return[null];let i=s(e,n[0],r),a=s(e,n[1],r),o=String(i[0]),l=String(a[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"g",u=c.includes("g")?c:`${c}g`;return[V(o,u).replace(e,l)]}catch{return[e]}}case"ascii_downcase":return typeof e=="string"?[e.replace(/[A-Z]/g,i=>String.fromCharCode(i.charCodeAt(0)+32))]:[null];case"ascii_upcase":return typeof e=="string"?[e.replace(/[a-z]/g,i=>String.fromCharCode(i.charCodeAt(0)-32))]:[null];case"ltrimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),a=String(i[0]);return[e.startsWith(a)?e.slice(a.length):e]}case"rtrimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),a=String(i[0]);return a===""?[e]:[e.endsWith(a)?e.slice(0,-a.length):e]}case"trimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),a=String(i[0]);if(a==="")return[e];let o=e;return o.startsWith(a)&&(o=o.slice(a.length)),o.endsWith(a)&&(o=o.slice(0,-a.length)),[o]}case"trim":if(typeof e=="string")return[e.trim()];throw new Error("trim input must be a string");case"ltrim":if(typeof e=="string")return[e.trimStart()];throw new Error("trim input must be a string");case"rtrim":if(typeof e=="string")return[e.trimEnd()];throw new Error("trim input must be a string");case"startswith":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r);return[e.startsWith(String(i[0]))]}case"endswith":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r);return[e.endsWith(String(i[0]))]}case"ascii":return typeof e=="string"&&e.length>0?[e.charCodeAt(0)]:[null];case"explode":return typeof e=="string"?[Array.from(e).map(i=>i.codePointAt(0))]:[null];case"implode":if(!Array.isArray(e))throw new Error("implode input must be an array");return[e.map(o=>{if(typeof o=="string")throw new Error(`string (${JSON.stringify(o)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof o!="number"||Number.isNaN(o))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let l=Math.trunc(o);return l<0||l>1114111||l>=55296&&l<=57343?String.fromCodePoint(65533):String.fromCodePoint(l)}).join("")];default:return null}}var Th=I(()=>{"use strict";Me()});function nl(e,t){switch(t){case"type":return e===null?["null"]:Array.isArray(e)?["array"]:typeof e=="boolean"?["boolean"]:typeof e=="number"?["number"]:typeof e=="string"?["string"]:typeof e=="object"?["object"]:["null"];case"infinite":return[Number.POSITIVE_INFINITY];case"nan":return[Number.NaN];case"isinfinite":return[typeof e=="number"&&!Number.isFinite(e)];case"isnan":return[typeof e=="number"&&Number.isNaN(e)];case"isnormal":return[typeof e=="number"&&Number.isFinite(e)&&e!==0];case"isfinite":return[typeof e=="number"&&Number.isFinite(e)];case"numbers":return typeof e=="number"?[e]:[];case"strings":return typeof e=="string"?[e]:[];case"booleans":return typeof e=="boolean"?[e]:[];case"nulls":return e===null?[e]:[];case"arrays":return Array.isArray(e)?[e]:[];case"objects":return e&&typeof e=="object"&&!Array.isArray(e)?[e]:[];case"iterables":return Array.isArray(e)||e&&typeof e=="object"&&!Array.isArray(e)?[e]:[];case"scalars":return!Array.isArray(e)&&!(e&&typeof e=="object")?[e]:[];case"values":return e===null?[]:[e];case"not":return e===!1||e===null?[!0]:[!1];case"null":return[null];case"true":return[!0];case"false":return[!1];case"empty":return[];default:return null}}var Ph=I(()=>{"use strict"});var Dh=I(()=>{"use strict";Ah();Sh();Ch();Nh();kh();vh();Ih();$h();Oh();Rh();Th();Ph()});function ki(e,t,n){if(t.length===0)return n;let[r,...s]=t;if(typeof r=="number"){if(e&&typeof e=="object"&&!Array.isArray(e))throw new Error("Cannot index object with number");if(r>536870911)throw new Error("Array index too large");if(r<0)throw new Error("Out of bounds negative array index");let l=Array.isArray(e)?[...e]:[];for(;l.length<=r;)l.push(null);return l[r]=ki(l[r],s,n),l}if(Array.isArray(e))throw new Error("Cannot index array with string");if(!$e(r))return e??Object.create(null);let i=e&&typeof e=="object"&&!Array.isArray(e)?Ke(e):Object.create(null),a=Object.hasOwn(i,r)?i[r]:void 0;return Pe(i,r,ki(a,s,n)),i}function vi(e,t){if(t.length===0)return null;if(t.length===1){let s=t[0];if(Array.isArray(e)&&typeof s=="number"){let i=[...e];return i.splice(s,1),i}if(e&&typeof e=="object"&&!Array.isArray(e)){let i=String(s);if(!$e(i))return e;let a=Ke(e);return delete a[i],a}return e}let[n,...r]=t;if(Array.isArray(e)&&typeof n=="number"){let s=[...e];return s[n]=vi(s[n],r),s}if(e&&typeof e=="object"&&!Array.isArray(e)){let s=String(n);if(!$e(s))return e;let i=Ke(e);return Object.hasOwn(i,s)&&Pe(i,s,vi(i[s],r)),i}return e}var _h=I(()=>{"use strict";Nn()});function a5(e){return{vars:new Map,limits:{maxIterations:e?.limits?.maxIterations??s5,maxDepth:e?.limits?.maxDepth??Mh},env:e?.env,coverage:e?.coverage}}function Oi(e,t,n){let r=new Map(e.vars);return r.set(t,n),{vars:r,limits:e.limits,env:e.env,root:e.root,currentPath:e.currentPath,funcs:e.funcs,labels:e.labels,coverage:e.coverage}}function Es(e,t,n){switch(t.type){case"var":return Oi(e,t.name,n);case"array":{if(!Array.isArray(n))return null;let r=e;for(let s=0;s<t.elements.length;s++){let i=t.elements[s],a=s<n.length?n[s]:null,o=Es(r,i,a);if(o===null)return null;r=o}return r}case"object":{if(n===null||typeof n!="object"||Array.isArray(n))return null;let r=n,s=e;for(let i of t.fields){let a;if(typeof i.key=="string")a=i.key;else{let c=G(n,i.key,e);if(c.length===0)return null;a=String(c[0])}let o=mn(r,a)?r[a]:null;i.keyVar&&(s=Oi(s,i.keyVar,o));let l=Es(s,i.pattern,o);if(l===null)return null;s=l}return s}}}function o5(e,t){let n=e;for(let r of t)if(n&&typeof n=="object")if(Array.isArray(n))if(typeof r=="number")n=n[r];else return;else{let s=n;if(typeof r=="string"&&Object.hasOwn(s,r))n=s[r];else return}else return;return n}function _n(e){if(e.type==="Identity")return[];if(e.type==="Field"){let t=e.base?_n(e.base):[];return t===null?null:[...t,e.name]}if(e.type==="Index"&&e.index.type==="Literal"){let t=e.base?_n(e.base):[];if(t===null)return null;let n=e.index.value;return typeof n=="number"||typeof n=="string"?[...t,n]:null}if(e.type==="Pipe"){let t=_n(e.left);return t===null?null:rl(t,e.right)}if(e.type==="Call"){if(e.name==="parent"||e.name==="root")return null;if(e.name==="first"&&e.args.length===0)return[0];if(e.name==="last"&&e.args.length===0)return[-1]}return null}function rl(e,t){if(t.type==="Call"){if(t.name==="parent"){let n=1;if(t.args.length>0&&t.args[0].type==="Literal"){let r=t.args[0].value;typeof r=="number"&&(n=r)}if(n>=0)return e.slice(0,Math.max(0,e.length-n));{let r=-n-1;return e.slice(0,Math.min(r,e.length))}}if(t.name==="root")return[]}if(t.type==="Field"){let n=_n(t);if(n!==null)return[...e,...n]}if(t.type==="Index"&&t.index.type==="Literal"){let n=_n(t);if(n!==null)return[...e,...n]}if(t.type==="Pipe"){let n=rl(e,t.left);return n===null?null:rl(n,t.right)}return t.type==="Identity"?e:null}function Lh(e,t,n){if(t.type==="Comma"){let r=[];try{r.push(...G(e,t.left,n))}catch(s){if(s instanceof J)throw s;if(r.length>0)return r;throw new Error("evaluation failed")}try{r.push(...G(e,t.right,n))}catch(s){if(s instanceof J)throw s;return r}return r}return G(e,t,n)}function G(e,t,n){let r=n&&"vars"in n?n:a5(n);switch(r.root===void 0&&(r={...r,root:e,currentPath:[]}),r.coverage?.hit(`jq:node:${t.type}`),t.type){case"Identity":return[e];case"Field":return(t.base?G(e,t.base,r):[e]).flatMap(i=>{if(i&&typeof i=="object"&&!Array.isArray(i)){let o=i;if(!Object.hasOwn(o,t.name))return[null];let l=o[t.name];return[l===void 0?null:l]}if(i===null)return[null];let a=Array.isArray(i)?"array":typeof i;throw new Error(`Cannot index ${a} with string "${t.name}"`)});case"Index":return(t.base?G(e,t.base,r):[e]).flatMap(i=>G(i,t.index,r).flatMap(o=>{if(typeof o=="number"&&Array.isArray(i)){if(Number.isNaN(o))return[null];let l=Math.trunc(o),c=l<0?i.length+l:l;return c>=0&&c<i.length?[i[c]]:[null]}if(typeof o=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){let l=i;return Object.hasOwn(l,o)?[l[o]]:[null]}return[null]}));case"Slice":return(t.base?G(e,t.base,r):[e]).flatMap(i=>{if(i===null)return[null];if(!Array.isArray(i)&&typeof i!="string")throw new Error(`Cannot slice ${typeof i} (${JSON.stringify(i)})`);let a=i.length,o=t.start?G(e,t.start,r):[0],l=t.end?G(e,t.end,r):[a];return o.flatMap(c=>l.map(u=>{let f=c,p=u,h=Number.isNaN(f)?0:Number.isInteger(f)?f:Math.floor(f),m=Number.isNaN(p)?a:Number.isInteger(p)?p:Math.ceil(p),d=Fh(h,a),g=Fh(m,a);return Array.isArray(i),i.slice(d,g)}))});case"Iterate":return(t.base?G(e,t.base,r):[e]).flatMap(i=>Array.isArray(i)?i:i&&typeof i=="object"?Object.values(i):[]);case"Pipe":{let s=G(e,t.left,r),i=_n(t.left),a=[];for(let o of s)try{if(i!==null){let l={...r,currentPath:[...r.currentPath??[],...i]};a.push(...G(o,t.right,l))}else a.push(...G(o,t.right,r))}catch(l){throw l instanceof Dr?l.withPrependedResults(a):l}return a}case"Comma":{let s=G(e,t.left,r),i=G(e,t.right,r);return[...s,...i]}case"Literal":return[t.value];case"Array":return t.elements?[G(e,t.elements,r)]:[[]];case"Object":{let s=[Object.create(null)];for(let i of t.entries){let a=typeof i.key=="string"?[i.key]:G(e,i.key,r),o=G(e,i.value,r),l=[];for(let c of s)for(let u of a){if(typeof u!="string"){let f=u===null?"null":Array.isArray(u)?"array":typeof u;throw new Error(`Cannot use ${f} (${JSON.stringify(u)}) as object key`)}if(!$e(u)){for(let f of o)l.push(Ke(c));continue}for(let f of o){let p=Ke(c);Pe(p,u,f),l.push(p)}}s.length=0,s.push(...l)}return s}case"Paren":return G(e,t.expr,r);case"BinaryOp":return u5(e,t.op,t.left,t.right,r);case"UnaryOp":return G(e,t.operand,r).map(i=>{if(t.op==="-"){if(typeof i=="number")return-i;if(typeof i=="string"){let a=o=>o.length>5?`"${o.slice(0,3)}...`:JSON.stringify(o);throw new Error(`string (${a(i)}) cannot be negated`)}return null}return t.op==="not"?!Qt(i):null});case"Cond":return G(e,t.cond,r).flatMap(i=>{if(Qt(i))return G(e,t.then,r);for(let a of t.elifs)if(G(e,a.cond,r).some(Qt))return G(e,a.then,r);return t.else?G(e,t.else,r):[e]});case"Try":try{return G(e,t.body,r)}catch(s){if(t.catch){let i=s instanceof $i?s.value:s instanceof Error?s.message:String(s);return G(i,t.catch,r)}return[]}case"Call":return Uh(e,t.name,t.args,r);case"VarBind":return G(e,t.value,r).flatMap(i=>{let a=null,o=[];t.pattern?o.push(t.pattern):t.name&&o.push({type:"var",name:t.name}),t.alternatives&&o.push(...t.alternatives);for(let l of o)if(a=Es(r,l,i),a!==null)break;return a===null?[]:G(e,t.body,a)});case"VarRef":{if(t.name==="$ENV")return[r.env?Et(r.env):Object.create(null)];let s=r.vars.get(t.name);return s!==void 0?[s]:[null]}case"Recurse":{let s=[],i=new WeakSet,a=o=>{if(o&&typeof o=="object"){if(i.has(o))return;i.add(o)}if(s.push(o),Array.isArray(o))for(let l of o)a(l);else if(o&&typeof o=="object")for(let l of Object.keys(o))a(o[l])};return a(e),s}case"Optional":try{return G(e,t.expr,r)}catch{return[]}case"StringInterp":return[t.parts.map(i=>typeof i=="string"?i:G(e,i,r).map(o=>typeof o=="string"?o:JSON.stringify(o)).join("")).join("")];case"UpdateOp":return[l5(e,t.path,t.op,t.value,r)];case"Reduce":{let s=G(e,t.expr,r),i=G(e,t.init,r)[0],a=r.limits.maxDepth??Mh;for(let o of s){let l;if(t.pattern){if(l=Es(r,t.pattern,o),l===null)continue}else l=Oi(r,t.varName,o);if(i=G(i,t.update,l)[0],Pr(i,a+1)>a)return[null]}return[i]}case"Foreach":{let s=G(e,t.expr,r),i=G(e,t.init,r)[0],a=[];for(let o of s)try{let l;if(t.pattern){if(l=Es(r,t.pattern,o),l===null)continue}else l=Oi(r,t.varName,o);if(i=G(i,t.update,l)[0],t.extract){let c=G(i,t.extract,l);a.push(...c)}else a.push(i)}catch(l){throw l instanceof Dr?l.withPrependedResults(a):l}return a}case"Label":try{return G(e,t.body,{...r,labels:new Set([...r.labels??[],t.name])})}catch(s){if(s instanceof Dr&&s.label===t.name)return s.partialResults;throw s}case"Break":throw new Dr(t.name);case"Def":{let s=new Map(r.funcs??[]),i=`${t.name}/${t.params.length}`;s.set(i,{params:t.params,body:t.funcBody,closure:new Map(r.funcs??[])});let a={...r,funcs:s};return G(e,t.body,a)}default:{let s=t;throw new Error(`Unknown AST node type: ${s.type}`)}}}function Fh(e,t){return e<0?Math.max(0,t+e):Math.min(e,t)}function l5(e,t,n,r,s){function i(l,c){switch(n){case"=":return c;case"|=":return G(l,r,s)[0]??null;case"+=":return typeof l=="number"&&typeof c=="number"||typeof l=="string"&&typeof c=="string"?l+c:Array.isArray(l)&&Array.isArray(c)?[...l,...c]:l&&c&&typeof l=="object"&&typeof c=="object"?Ho(l,c):c;case"-=":return typeof l=="number"&&typeof c=="number"?l-c:l;case"*=":return typeof l=="number"&&typeof c=="number"?l*c:l;case"/=":return typeof l=="number"&&typeof c=="number"?l/c:l;case"%=":return typeof l=="number"&&typeof c=="number"?l%c:l;case"//=":return l===null||l===!1?c:l;default:return c}}function a(l,c,u){switch(c.type){case"Identity":return u(l);case"Field":{if(!$e(c.name))return l;if(c.base)return a(l,c.base,f=>{if(f&&typeof f=="object"&&!Array.isArray(f)){let p=Ke(f),h=Object.hasOwn(p,c.name)?p[c.name]:void 0;return Pe(p,c.name,u(h)),p}return f});if(l&&typeof l=="object"&&!Array.isArray(l)){let f=Ke(l),p=Object.hasOwn(f,c.name)?f[c.name]:void 0;return Pe(f,c.name,u(p)),f}return l}case"Index":{let p=G(e,c.index,s)[0];if(typeof p=="number"&&Number.isNaN(p))throw new Error("Cannot set array element at NaN index");if(typeof p=="number"&&!Number.isInteger(p)&&(p=Math.trunc(p)),c.base)return a(l,c.base,h=>{if(typeof p=="number"&&Array.isArray(h)){let m=[...h],d=p<0?m.length+p:p;if(d>=0){for(;m.length<=d;)m.push(null);m[d]=u(m[d])}return m}if(typeof p=="string"&&h&&typeof h=="object"&&!Array.isArray(h)){if(!$e(p))return h;let m=Ke(h),d=Object.hasOwn(m,p)?m[p]:void 0;return Pe(m,p,u(d)),m}return h});if(typeof p=="number"){if(p>536870911)throw new Error("Array index too large");if(p<0&&(!l||!Array.isArray(l)))throw new Error("Out of bounds negative array index");if(Array.isArray(l)){let m=[...l],d=p<0?m.length+p:p;if(d>=0){for(;m.length<=d;)m.push(null);m[d]=u(m[d])}return m}if(l==null){let m=[];for(;m.length<=p;)m.push(null);return m[p]=u(null),m}return l}if(typeof p=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!$e(p))return l;let h=Ke(l),m=Object.hasOwn(h,p)?h[p]:void 0;return Pe(h,p,u(m)),h}return l}case"Iterate":{let f=p=>{if(Array.isArray(p))return p.map(h=>u(h));if(p&&typeof p=="object"){let h=Object.create(null);for(let[m,d]of Object.entries(p))$e(m)&&Pe(h,m,u(d));return h}return p};return c.base?a(l,c.base,f):f(l)}case"Pipe":{let f=a(l,c.left,p=>p);return a(f,c.right,u)}default:return u(l)}}return a(e,t,l=>{if(n==="|=")return i(l,l);let c=G(e,r,s);return i(l,c[0]??null)})}function c5(e,t,n){function r(i,a,o){switch(a.type){case"Identity":return o;case"Field":{if(!$e(a.name))return i;if(a.base){let l=G(i,a.base,n)[0],c=r(l,{type:"Field",name:a.name},o);return r(i,a.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){let l=Ke(i);return Pe(l,a.name,o),l}return i}case"Index":{if(a.base){let u=G(i,a.base,n)[0],f=r(u,{type:"Index",index:a.index},o);return r(i,a.base,f)}let c=G(e,a.index,n)[0];if(typeof c=="number"&&Array.isArray(i)){let u=[...i],f=c<0?u.length+c:c;return f>=0&&f<u.length&&(u[f]=o),u}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!$e(c))return i;let u=Ke(i);return Pe(u,c,o),u}return i}default:return i}}function s(i,a){switch(a.type){case"Identity":return null;case"Field":{if(!$e(a.name))return i;if(a.base){let l=G(i,a.base,n)[0];if(l==null)return i;let c=s(l,{type:"Field",name:a.name});return r(i,a.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){if(!$e(a.name))return i;let l=Ke(i);return delete l[a.name],l}return i}case"Index":{if(a.base){let u=G(i,a.base,n)[0];if(u==null)return i;let f=s(u,{type:"Index",index:a.index});return r(i,a.base,f)}let c=G(e,a.index,n)[0];if(typeof c=="number"&&Array.isArray(i)){let u=[...i],f=c<0?u.length+c:c;return f>=0&&f<u.length&&u.splice(f,1),u}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!$e(c))return i;let u=Ke(i);return delete u[c],u}return i}case"Iterate":return Array.isArray(i)?[]:i&&typeof i=="object"?Object.create(null):i;case"Pipe":{let u=function(h,m,d){switch(m.type){case"Identity":return d;case"Field":{if(!$e(m.name))return h;if(h&&typeof h=="object"&&!Array.isArray(h)){let g=Ke(h);return Pe(g,m.name,d),g}return h}case"Index":{let w=G(e,m.index,n)[0];if(typeof w=="number"&&Array.isArray(h)){let y=[...h],b=w<0?y.length+w:w;return b>=0&&b<y.length&&(y[b]=d),y}if(typeof w=="string"&&h&&typeof h=="object"&&!Array.isArray(h)){if(!$e(w))return h;let y=Ke(h);return Pe(y,w,d),y}return h}case"Pipe":{let g=G(h,m.left,n)[0],w=u(g,m.right,d);return u(h,m.left,w)}default:return h}};var o=u;let l=a.left,c=a.right,f=G(i,l,n)[0];if(f==null)return i;let p=s(f,c);return u(i,l,p)}default:return i}}return s(e,t)}function u5(e,t,n,r,s){if(t==="and")return G(e,n,s).flatMap(l=>Qt(l)?G(e,r,s).map(u=>Qt(u)):[!1]);if(t==="or")return G(e,n,s).flatMap(l=>Qt(l)?[!0]:G(e,r,s).map(u=>Qt(u)));if(t==="//"){let l=G(e,n,s).filter(c=>c!=null&&c!==!1);return l.length>0?l:G(e,r,s)}let i=G(e,n,s),a=G(e,r,s);return i.flatMap(o=>a.map(l=>{switch(t){case"+":return o===null?l:l===null?o:typeof o=="number"&&typeof l=="number"||typeof o=="string"&&typeof l=="string"?o+l:Array.isArray(o)&&Array.isArray(l)?[...o,...l]:o&&l&&typeof o=="object"&&typeof l=="object"&&!Array.isArray(o)&&!Array.isArray(l)?Ho(o,l):null;case"-":if(typeof o=="number"&&typeof l=="number")return o-l;if(Array.isArray(o)&&Array.isArray(l)){let c=new Set(l.map(u=>JSON.stringify(u)));return o.filter(u=>!c.has(JSON.stringify(u)))}if(typeof o=="string"&&typeof l=="string"){let c=u=>u.length>10?`"${u.slice(0,10)}...`:JSON.stringify(u);throw new Error(`string (${c(o)}) and string (${c(l)}) cannot be subtracted`)}return null;case"*":return typeof o=="number"&&typeof l=="number"?o*l:typeof o=="string"&&typeof l=="number"?o.repeat(l):o&&l&&typeof o=="object"&&typeof l=="object"&&!Array.isArray(o)&&!Array.isArray(l)?qo(o,l):null;case"/":if(typeof o=="number"&&typeof l=="number"){if(l===0)throw new Error(`number (${o}) and number (${l}) cannot be divided because the divisor is zero`);return o/l}return typeof o=="string"&&typeof l=="string"?o.split(l):null;case"%":if(typeof o=="number"&&typeof l=="number"){if(l===0)throw new Error(`number (${o}) and number (${l}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(o)&&!Number.isNaN(o)?!Number.isFinite(l)&&!Number.isNaN(l)&&o<0&&l>0?-1:0:o%l}return null;case"==":return Tr(o,l);case"!=":return!Tr(o,l);case"<":return xs(o,l)<0;case"<=":return xs(o,l)<=0;case">":return xs(o,l)>0;case">=":return xs(o,l)>=0;default:return null}}))}function Uh(e,t,n,r){let s=i5.get(t);if(s)return typeof e=="number"?[s(e)]:[null];let i=Qo(e,t,n,r,G);if(i!==null)return i;let a=tl(e,t,n,r,G);if(a!==null)return a;let o=Vo(e,t,n,r,G);if(o!==null)return o;let l=Zo(e,t,r.limits.maxDepth);if(l!==null)return l;let c=nl(e,t);if(c!==null)return c;let u=Yo(e,t,n,r,G);if(u!==null)return u;let f=jo(e,t,n,r,G,Lh,Si,Qt,Ci,J);if(f!==null)return f;let p=Jo(e,t,n,r,G,Qt,ki,vi,c5,Ii);if(p!==null)return p;let h=Ko(e,t,n,r,G,Tr);if(h!==null)return h;let m=Go(e,t,n,r,G,Lh,Qt,J);if(m!==null)return m;let d=Xo(e,t,n,r,G,Qt,o5,Uh);if(d!==null)return d;let g=el(e,t,n,r,G,Tr);if(g!==null)return g;switch(t){case"builtins":return[["add/0","all/0","all/1","all/2","any/0","any/1","any/2","arrays/0","ascii/0","ascii_downcase/0","ascii_upcase/0","booleans/0","bsearch/1","builtins/0","combinations/0","combinations/1","contains/1","debug/0","del/1","delpaths/1","empty/0","env/0","error/0","error/1","explode/0","first/0","first/1","flatten/0","flatten/1","floor/0","from_entries/0","fromdate/0","fromjson/0","getpath/1","gmtime/0","group_by/1","gsub/2","gsub/3","has/1","implode/0","IN/1","IN/2","INDEX/1","INDEX/2","index/1","indices/1","infinite/0","inside/1","isempty/1","isnan/0","isnormal/0","isvalid/1","iterables/0","join/1","keys/0","keys_unsorted/0","last/0","last/1","length/0","limit/2","ltrimstr/1","map/1","map_values/1","match/1","match/2","max/0","max_by/1","min/0","min_by/1","mktime/0","modulemeta/1","nan/0","not/0","nth/1","nth/2","null/0","nulls/0","numbers/0","objects/0","path/1","paths/0","paths/1","pick/1","range/1","range/2","range/3","recurse/0","recurse/1","recurse_down/0","repeat/1","reverse/0","rindex/1","rtrimstr/1","scalars/0","scan/1","scan/2","select/1","setpath/2","skip/2","sort/0","sort_by/1","split/1","splits/1","splits/2","sqrt/0","startswith/1","strftime/1","strings/0","strptime/1","sub/2","sub/3","test/1","test/2","to_entries/0","toboolean/0","todate/0","tojson/0","tostream/0","fromstream/1","truncate_stream/1","tonumber/0","tostring/0","transpose/0","trim/0","ltrim/0","rtrim/0","type/0","unique/0","unique_by/1","until/2","utf8bytelength/0","values/0","walk/1","while/2","with_entries/1"]];case"error":{let w=n.length>0?G(e,n[0],r)[0]:e;throw new $i(w)}case"env":return[r.env?Et(r.env):Object.create(null)];case"debug":return[e];case"input_line_number":return[1];default:{let w=`${t}/${n.length}`,y=r.funcs?.get(w);if(y){let b=y.closure??r.funcs??new Map,x=new Map(b);x.set(w,y);for(let $=0;$<y.params.length;$++){let O=y.params[$],L=n[$];if(L){let R=G(e,L,r),W;if(R.length===0)W={type:"Call",name:"empty",args:[]};else if(R.length===1)W={type:"Literal",value:R[0]};else{W={type:"Literal",value:R[R.length-1]};for(let k=R.length-2;k>=0;k--)W={type:"Comma",left:{type:"Literal",value:R[k]},right:W}}x.set(`${O}/0`,{params:[],body:W})}}let S={...r,funcs:x};return G(e,y.body,S)}throw new Error(`Unknown function: ${t}`)}}}function Ii(e,t,n,r,s){if(t.type==="Comma"){let o=t;Ii(e,o.left,n,r,s),Ii(e,o.right,n,r,s);return}let i=_n(t);if(i!==null){s.push([...r,...i]);return}if(t.type==="Iterate"){if(Array.isArray(e))for(let o=0;o<e.length;o++)s.push([...r,o]);else if(e&&typeof e=="object")for(let o of Object.keys(e))s.push([...r,o]);return}if(t.type==="Recurse"){let o=(l,c)=>{if(s.push([...r,...c]),l&&typeof l=="object")if(Array.isArray(l))for(let u=0;u<l.length;u++)o(l[u],[...c,u]);else for(let u of Object.keys(l))o(l[u],[...c,u])};o(e,[]);return}if(t.type==="Pipe"){let o=_n(t.left);if(o!==null){let l=G(e,t.left,n);for(let c of l)Ii(c,t.right,n,[...r,...o],s);return}}G(e,t,n).length>0&&s.push(r)}var Dr,$i,s5,Mh,i5,Bh=I(()=>{"use strict";Pn();ye();Dh();_h();Nn();Ni();Dr=class e extends Error{label;partialResults;constructor(t,n=[]){super(`break ${t}`),this.label=t,this.partialResults=n,this.name="BreakError"}withPrependedResults(t){return new e(this.label,[...t,...this.partialResults])}},$i=class extends Error{value;constructor(t){super(typeof t=="string"?t:JSON.stringify(t)),this.value=t,this.name="JqError"}},s5=1e4,Mh=2e3,i5=new Map([["floor",Math.floor],["ceil",Math.ceil],["round",Math.round],["sqrt",Math.sqrt],["log",Math.log],["log10",Math.log10],["log2",Math.log2],["exp",Math.exp],["sin",Math.sin],["cos",Math.cos],["tan",Math.tan],["asin",Math.asin],["acos",Math.acos],["atan",Math.atan],["sinh",Math.sinh],["cosh",Math.cosh],["tanh",Math.tanh],["asinh",Math.asinh],["acosh",Math.acosh],["atanh",Math.atanh],["cbrt",Math.cbrt],["expm1",Math.expm1],["log1p",Math.log1p],["trunc",Math.trunc]])});function zh(e){let t=[],n=0,r=(c=0)=>e[n+c],s=()=>e[n++],i=()=>n>=e.length,a=c=>c>="0"&&c<="9",o=c=>c>="a"&&c<="z"||c>="A"&&c<="Z"||c==="_",l=c=>o(c)||a(c);for(;!i();){let c=n,u=s();if(!(u===" "||u===" "||u===`
550
+ `,exitCode:127}}}};e5={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},t5={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"}});function $e(e){return!Eh.has(e)}function Pe(e,t,n){$e(t)&&(e[t]=n)}function mn(e,t){return Object.hasOwn(e,t)}function Ke(e){return Object.assign(Object.create(null),e)}function Ho(...e){return Object.assign(Object.create(null),...e)}var Eh,Cv,Nn=I(()=>{"use strict";Eh=new Set(["__proto__","constructor","prototype"]),Cv=new Set([...Eh,"__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])});function jo(e,t,n,r,s,i,a,o,l,c){switch(t){case"sort":return Array.isArray(e)?[[...e].sort(a)]:[null];case"sort_by":return!Array.isArray(e)||n.length===0?[null]:[[...e].sort((f,p)=>{let h=s(f,n[0],r)[0],m=s(p,n[0],r)[0];return a(h,m)})];case"bsearch":{if(!Array.isArray(e)){let f=e===null?"null":typeof e=="object"?"object":typeof e;throw new Error(`${f} (${JSON.stringify(e)}) cannot be searched from`)}return n.length===0?[null]:s(e,n[0],r).map(f=>{let p=0,h=e.length;for(;p<h;){let m=p+h>>>1;a(e[m],f)<0?p=m+1:h=m}return p<e.length&&a(e[p],f)===0?p:-p-1})}case"unique_by":{if(!Array.isArray(e)||n.length===0)return[null];let u=new Map;for(let p of e){let h=s(p,n[0],r)[0],m=JSON.stringify(h);u.has(m)||u.set(m,{item:p,key:h})}let f=[...u.values()];return f.sort((p,h)=>a(p.key,h.key)),[f.map(p=>p.item)]}case"group_by":{if(!Array.isArray(e)||n.length===0)return[null];let u=new Map;for(let f of e){let p=JSON.stringify(s(f,n[0],r)[0]);u.has(p)||u.set(p,[]),u.get(p)?.push(f)}return[[...u.values()]]}case"max":return Array.isArray(e)&&e.length>0?[e.reduce((u,f)=>a(u,f)>0?u:f)]:[null];case"max_by":return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((u,f)=>{let p=s(u,n[0],r)[0],h=s(f,n[0],r)[0];return a(p,h)>0?u:f})];case"min":return Array.isArray(e)&&e.length>0?[e.reduce((u,f)=>a(u,f)<0?u:f)]:[null];case"min_by":return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((u,f)=>{let p=s(u,n[0],r)[0],h=s(f,n[0],r)[0];return a(p,h)<0?u:f})];case"add":{let u=f=>{let p=f.filter(h=>h!==null);return p.length===0?null:p.every(h=>typeof h=="number")?p.reduce((h,m)=>h+m,0):p.every(h=>typeof h=="string")?p.join(""):p.every(h=>Array.isArray(h))?p.flat():p.every(h=>h&&typeof h=="object"&&!Array.isArray(h))?li(...p):null};if(n.length>=1){let f=s(e,n[0],r);return[u(f)]}return Array.isArray(e)?[u(e)]:[null]}case"any":{if(n.length>=2){try{let u=i(e,n[0],r);for(let f of u)if(s(f,n[1],r).some(o))return[!0]}catch(u){if(u instanceof c)throw u}return[!1]}return n.length===1?Array.isArray(e)?[e.some(u=>o(s(u,n[0],r)[0]))]:[!1]:Array.isArray(e)?[e.some(o)]:[!1]}case"all":{if(n.length>=2){try{let u=i(e,n[0],r);for(let f of u)if(!s(f,n[1],r).some(o))return[!1]}catch(u){if(u instanceof c)throw u}return[!0]}return n.length===1?Array.isArray(e)?[e.every(u=>o(s(u,n[0],r)[0]))]:[!0]:Array.isArray(e)?[e.every(o)]:[!0]}case"select":return n.length===0?[e]:s(e,n[0],r).some(o)?[e]:[];case"map":return n.length===0||!Array.isArray(e)?[null]:[e.flatMap(f=>s(f,n[0],r))];case"map_values":{if(n.length===0)return[null];if(Array.isArray(e))return[e.flatMap(u=>s(u,n[0],r))];if(e&&typeof e=="object"){let u=Object.create(null);for(let[f,p]of Object.entries(e)){if(!$e(f))continue;let h=s(p,n[0],r);h.length>0&&Pe(u,f,h[0])}return[u]}return[null]}case"has":{if(n.length===0)return[!1];let f=s(e,n[0],r)[0];return Array.isArray(e)&&typeof f=="number"?[f>=0&&f<e.length]:e&&typeof e=="object"&&typeof f=="string"?[mn(e,f)]:[!1]}case"in":{if(n.length===0)return[!1];let f=s(e,n[0],r)[0];return Array.isArray(f)&&typeof e=="number"?[e>=0&&e<f.length]:f&&typeof f=="object"&&typeof e=="string"?[mn(f,e)]:[!1]}case"contains":{if(n.length===0)return[!1];let u=s(e,n[0],r);return[l(e,u[0])]}case"inside":{if(n.length===0)return[!1];let u=s(e,n[0],r);return[l(u[0],e)]}default:return null}}var Ah=I(()=>{"use strict";Pn();Nn()});function Go(e,t,n,r,s,i,a,o){switch(t){case"first":if(n.length>0)try{let l=i(e,n[0],r);return l.length>0?[l[0]]:[]}catch(l){if(l instanceof o)throw l;return[]}return Array.isArray(e)&&e.length>0?[e[0]]:[null];case"last":if(n.length>0){let l=s(e,n[0],r);return l.length>0?[l[l.length-1]]:[]}return Array.isArray(e)&&e.length>0?[e[e.length-1]]:[null];case"nth":{if(n.length<1)return[null];let l=s(e,n[0],r);if(n.length>1){for(let u of l)if(u<0)throw new Error("nth doesn't support negative indices");let c;try{c=i(e,n[1],r)}catch(u){if(u instanceof o)throw u;c=[]}return l.flatMap(u=>{let f=u;return f<c.length?[c[f]]:[]})}return Array.isArray(e)?l.flatMap(c=>{let u=c;if(u<0)throw new Error("nth doesn't support negative indices");return u<e.length?[e[u]]:[null]}):[null]}case"range":{if(n.length===0)return[];let l=s(e,n[0],r);if(n.length===1){let p=[];for(let h of l){let m=h;for(let d=0;d<m;d++)p.push(d)}return p}let c=s(e,n[1],r);if(n.length===2){let p=[];for(let h of l)for(let m of c){let d=h,g=m;for(let w=d;w<g;w++)p.push(w)}return p}let u=s(e,n[2],r),f=[];for(let p of l)for(let h of c)for(let m of u){let d=p,g=h,w=m;if(w!==0)if(w>0)for(let y=d;y<g;y+=w)f.push(y);else for(let y=d;y>g;y+=w)f.push(y)}return f}case"limit":return n.length<2?[]:s(e,n[0],r).flatMap(c=>{let u=c;if(u<0)throw new Error("limit doesn't support negative count");if(u===0)return[];let f;try{f=i(e,n[1],r)}catch(p){if(p instanceof o)throw p;f=[]}return f.slice(0,u)});case"isempty":{if(n.length<1)return[!0];try{return[i(e,n[0],r).length===0]}catch(l){if(l instanceof o)throw l;return[!0]}}case"isvalid":{if(n.length<1)return[!0];try{return[s(e,n[0],r).length>0]}catch(l){if(l instanceof o)throw l;return[!1]}}case"skip":return n.length<2?[]:s(e,n[0],r).flatMap(c=>{let u=c;if(u<0)throw new Error("skip doesn't support negative count");return s(e,n[1],r).slice(u)});case"until":{if(n.length<2)return[e];let l=e,c=r.limits.maxIterations;for(let u=0;u<c;u++){if(s(l,n[0],r).some(a))return[l];let p=s(l,n[1],r);if(p.length===0)return[l];l=p[0]}throw new o(`jq until: too many iterations (${c}), increase executionLimits.maxJqIterations`,"iterations")}case"while":{if(n.length<2)return[e];let l=[],c=e,u=r.limits.maxIterations;for(let f=0;f<u&&s(c,n[0],r).some(a);f++){l.push(c);let h=s(c,n[1],r);if(h.length===0)break;c=h[0]}if(l.length>=u)throw new o(`jq while: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}case"repeat":{if(n.length===0)return[e];let l=[],c=e,u=r.limits.maxIterations;for(let f=0;f<u;f++){l.push(c);let p=s(c,n[0],r);if(p.length===0)break;c=p[0]}if(l.length>=u)throw new o(`jq repeat: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}default:return null}}var Sh=I(()=>{"use strict"});function Vo(e,t,n,r,s){switch(t){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof e!="number")return[null];let i=new Date(e*1e3),a=i.getUTCFullYear(),o=i.getUTCMonth(),l=i.getUTCDate(),c=i.getUTCHours(),u=i.getUTCMinutes(),f=i.getUTCSeconds(),p=i.getUTCDay(),h=Date.UTC(a,0,1),m=Math.floor((i.getTime()-h)/(1440*60*1e3));return[[a,o,l,c,u,f,p,m]]}case"mktime":{if(!Array.isArray(e))throw new Error("mktime requires parsed datetime inputs");let[i,a,o,l=0,c=0,u=0]=e;if(typeof i!="number"||typeof a!="number")throw new Error("mktime requires parsed datetime inputs");let f=Date.UTC(i,a,o??1,l??0,c??0,u??0);return[Math.floor(f/1e3)]}case"strftime":{if(n.length===0)return[null];let a=s(e,n[0],r)[0];if(typeof a!="string")throw new Error("strftime/1 requires a string format");let o;if(typeof e=="number")o=new Date(e*1e3);else if(Array.isArray(e)){let[p,h,m,d=0,g=0,w=0]=e;if(typeof p!="number"||typeof h!="number")throw new Error("strftime/1 requires parsed datetime inputs");o=new Date(Date.UTC(p,h,m??1,d??0,g??0,w??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"],u=(p,h=2)=>String(p).padStart(h,"0");return[a.replace(/%Y/g,String(o.getUTCFullYear())).replace(/%m/g,u(o.getUTCMonth()+1)).replace(/%d/g,u(o.getUTCDate())).replace(/%H/g,u(o.getUTCHours())).replace(/%M/g,u(o.getUTCMinutes())).replace(/%S/g,u(o.getUTCSeconds())).replace(/%A/g,l[o.getUTCDay()]).replace(/%B/g,c[o.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(n.length===0)return[null];if(typeof e!="string")throw new Error("strptime/1 requires a string input");let a=s(e,n[0],r)[0];if(typeof a!="string")throw new Error("strptime/1 requires a string format");if(a==="%Y-%m-%dT%H:%M:%SZ"){let l=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(l){let[,c,u,f,p,h,m]=l.map(Number),d=new Date(Date.UTC(c,u-1,f,p,h,m)),g=d.getUTCDay(),w=Date.UTC(c,0,1),y=Math.floor((d.getTime()-w)/(1440*60*1e3));return[[c,u-1,f,p,h,m,g,y]]}}let o=new Date(e);if(!Number.isNaN(o.getTime())){let l=o.getUTCFullYear(),c=o.getUTCMonth(),u=o.getUTCDate(),f=o.getUTCHours(),p=o.getUTCMinutes(),h=o.getUTCSeconds(),m=o.getUTCDay(),d=Date.UTC(l,0,1),g=Math.floor((o.getTime()-d)/(1440*60*1e3));return[[l,c,u,f,p,h,m,g]]}throw new Error(`Cannot parse date: ${e}`)}case"fromdate":{if(typeof e!="string")throw new Error("fromdate requires a string input");let i=new Date(e);if(Number.isNaN(i.getTime()))throw new Error(`date "${e}" does not match format "%Y-%m-%dT%H:%M:%SZ"`);return[Math.floor(i.getTime()/1e3)]}case"todate":{if(typeof e!="number")throw new Error("todate requires a number input");return[new Date(e*1e3).toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}var Ch=I(()=>{"use strict"});function Qt(e){return e!==!1&&e!==null}function Tr(e,t){return JSON.stringify(e)===JSON.stringify(t)}function xs(e,t){return typeof e=="number"&&typeof t=="number"?e-t:typeof e=="string"&&typeof t=="string"?e.localeCompare(t):0}function qo(e,t){let n=Ke(e);for(let r of Object.keys(t))$e(r)&&(mn(n,r)&&n[r]&&typeof n[r]=="object"&&!Array.isArray(n[r])&&t[r]&&typeof t[r]=="object"&&!Array.isArray(t[r])?Pe(n,r,qo(n[r],t[r])):Pe(n,r,t[r]));return n}function Pr(e,t=3e3){let n=0,r=e;for(;n<t;)if(Array.isArray(r)){if(r.length===0)return n+1;r=r[0],n++}else if(r!==null&&typeof r=="object"){let s=Object.keys(r);if(s.length===0)return n+1;r=r[s[0]],n++}else return n;return n}function Si(e,t){let n=i=>i===null?0:typeof i=="boolean"?1:typeof i=="number"?2:typeof i=="string"?3:Array.isArray(i)?4:typeof i=="object"?5:6,r=n(e),s=n(t);if(r!==s)return r-s;if(typeof e=="number"&&typeof t=="number")return e-t;if(typeof e=="string"&&typeof t=="string")return e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return(e?1:0)-(t?1:0);if(Array.isArray(e)&&Array.isArray(t)){for(let i=0;i<Math.min(e.length,t.length);i++){let a=Si(e[i],t[i]);if(a!==0)return a}return e.length-t.length}if(e&&t&&typeof e=="object"&&typeof t=="object"){let i=e,a=t,o=Object.keys(i).sort(),l=Object.keys(a).sort();for(let c=0;c<Math.min(o.length,l.length);c++){let u=o[c].localeCompare(l[c]);if(u!==0)return u}if(o.length!==l.length)return o.length-l.length;for(let c of o){let u=Si(i[c],a[c]);if(u!==0)return u}}return 0}function Ci(e,t){if(Tr(e,t))return!0;if(typeof e=="string"&&typeof t=="string")return e.includes(t);if(Array.isArray(e)&&Array.isArray(t))return t.every(n=>e.some(r=>Ci(r,n)));if(e&&t&&typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)){let n=e,r=t;return Object.keys(r).every(s=>mn(n,s)&&Ci(n[s],r[s]))}return!1}var Ni=I(()=>{"use strict";Nn()});function Zo(e,t,n){switch(t){case"@base64":return typeof e=="string"?typeof Buffer<"u"?[Buffer.from(e,"utf-8").toString("base64")]:[btoa(e)]:[null];case"@base64d":return typeof e=="string"?typeof Buffer<"u"?[Buffer.from(e,"base64").toString("utf-8")]:[atob(e)]:[null];case"@uri":return typeof e=="string"?[encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")]:[null];case"@urid":return typeof e=="string"?[decodeURIComponent(e)]:[null];case"@csv":return Array.isArray(e)?[e.map(s=>{if(s===null)return"";if(typeof s=="boolean")return s?"true":"false";if(typeof s=="number")return String(s);let i=String(s);return i.includes(",")||i.includes('"')||i.includes(`
551
+ `)||i.includes("\r")?`"${i.replace(/"/g,'""')}"`:i}).join(",")]:[null];case"@tsv":return Array.isArray(e)?[e.map(r=>String(r??"").replace(/\t/g,"\\t").replace(/\n/g,"\\n")).join(" ")]:[null];case"@json":{let r=n??n5;return Pr(e,r+1)>r?[null]:[JSON.stringify(e)]}case"@html":return typeof e=="string"?[e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;")]:[null];case"@sh":return typeof e=="string"?[`'${e.replace(/'/g,"'\\''")}'`]:[null];case"@text":return typeof e=="string"?[e]:e==null?[""]:[String(e)];default:return null}}var n5,Nh=I(()=>{"use strict";Ni();n5=2e3});function Ko(e,t,n,r,s,i){switch(t){case"index":return n.length===0?[null]:s(e,n[0],r).map(o=>{if(typeof e=="string"&&typeof o=="string"){if(o===""&&e==="")return null;let l=e.indexOf(o);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(o)){for(let c=0;c<=e.length-o.length;c++){let u=!0;for(let f=0;f<o.length;f++)if(!i(e[c+f],o[f])){u=!1;break}if(u)return c}return null}let l=e.findIndex(c=>i(c,o));return l>=0?l:null}return null});case"rindex":return n.length===0?[null]:s(e,n[0],r).map(o=>{if(typeof e=="string"&&typeof o=="string"){let l=e.lastIndexOf(o);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(o)){for(let l=e.length-o.length;l>=0;l--){let c=!0;for(let u=0;u<o.length;u++)if(!i(e[l+u],o[u])){c=!1;break}if(c)return l}return null}for(let l=e.length-1;l>=0;l--)if(i(e[l],o))return l;return null}return null});case"indices":return n.length===0?[[]]:s(e,n[0],r).map(o=>{let l=[];if(typeof e=="string"&&typeof o=="string"){let c=e.indexOf(o);for(;c!==-1;)l.push(c),c=e.indexOf(o,c+1)}else if(Array.isArray(e))if(Array.isArray(o)){let c=o.length;if(c===0)for(let u=0;u<=e.length;u++)l.push(u);else for(let u=0;u<=e.length-c;u++){let f=!0;for(let p=0;p<c;p++)if(!i(e[u+p],o[p])){f=!1;break}f&&l.push(u)}}else for(let c=0;c<e.length;c++)i(e[c],o)&&l.push(c);return l});default:return null}}var vh=I(()=>{"use strict"});function Qo(e,t,n,r,s){switch(t){case"fabs":case"abs":return typeof e=="number"?[Math.abs(e)]:typeof e=="string"?[e]:[null];case"exp10":return typeof e=="number"?[10**e]:[null];case"exp2":return typeof e=="number"?[2**e]:[null];case"pow":{if(n.length<2)return[null];let i=s(e,n[0],r),a=s(e,n[1],r),o=i[0],l=a[0];return typeof o!="number"||typeof l!="number"?[null]:[o**l]}case"atan2":{if(n.length<2)return[null];let i=s(e,n[0],r),a=s(e,n[1],r),o=i[0],l=a[0];return typeof o!="number"||typeof l!="number"?[null]:[Math.atan2(o,l)]}case"hypot":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.hypot(e,i)]}case"fma":{if(typeof e!="number"||n.length<2)return[null];let i=s(e,n[0],r)[0],a=s(e,n[1],r)[0];return[e*i+a]}case"copysign":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.sign(i)*Math.abs(e)]}case"drem":case"remainder":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e-Math.round(e/i)*i]}case"fdim":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.max(0,e-i)]}case"fmax":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.max(e,i)]}case"fmin":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.min(e,i)]}case"ldexp":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e*2**i]}case"scalbn":case"scalbln":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e*2**i]}case"nearbyint":return typeof e=="number"?[Math.round(e)]:[null];case"logb":return typeof e=="number"?[Math.floor(Math.log2(Math.abs(e)))]:[null];case"significand":if(typeof e=="number"){let i=Math.floor(Math.log2(Math.abs(e)));return[e/2**i]}return[null];case"frexp":if(typeof e=="number"){if(e===0)return[[0,0]];let i=Math.floor(Math.log2(Math.abs(e)))+1;return[[e/2**i,i]]}return[null];case"modf":if(typeof e=="number"){let i=Math.trunc(e);return[[e-i,i]]}return[null];default:return null}}var kh=I(()=>{"use strict"});function Xo(e,t,n,r,s,i,a,o){switch(t){case"recurse":{if(n.length===0){let h=[],m=d=>{if(h.push(d),Array.isArray(d))for(let g of d)m(g);else if(d&&typeof d=="object")for(let g of Object.keys(d))m(d[g])};return m(e),h}let l=[],c=n.length>=2?n[1]:null,u=1e4,f=0,p=h=>{if(f++>u||c&&!s(h,c,r).some(i))return;l.push(h);let m=s(h,n[0],r);for(let d of m)d!=null&&p(d)};return p(e),l}case"recurse_down":return o(e,"recurse",n,r);case"walk":{if(n.length===0)return[e];let l=new WeakSet,c=u=>{if(u&&typeof u=="object"){if(l.has(u))return u;l.add(u)}let f;if(Array.isArray(u))f=u.map(c);else if(u&&typeof u=="object"){let h=Object.create(null);for(let[m,d]of Object.entries(u))$e(m)&&Pe(h,m,c(d));f=h}else f=u;return s(f,n[0],r)[0]};return[c(e)]}case"transpose":{if(!Array.isArray(e))return[null];if(e.length===0)return[[]];let l=Math.max(...e.map(u=>Array.isArray(u)?u.length:0)),c=[];for(let u=0;u<l;u++)c.push(e.map(f=>Array.isArray(f)?f[u]:null));return[c]}case"combinations":{if(n.length>0){let f=s(e,n[0],r)[0];if(!Array.isArray(e)||f<0)return[];if(f===0)return[[]];let p=[],h=(m,d)=>{if(d===f){p.push([...m]);return}for(let g of e)m.push(g),h(m,d+1),m.pop()};return h([],0),p}if(!Array.isArray(e))return[];if(e.length===0)return[[]];for(let u of e)if(!Array.isArray(u))return[];let l=[],c=(u,f)=>{if(u===e.length){l.push([...f]);return}let p=e[u];for(let h of p)f.push(h),c(u+1,f),f.pop()};return c(0,[]),l}case"parent":{if(r.root===void 0||r.currentPath===void 0)return[];let l=r.currentPath;if(l.length===0)return[];let c=n.length>0?s(e,n[0],r)[0]:1;if(c>=0){if(c>l.length)return[];let u=l.slice(0,l.length-c);return[a(r.root,u)]}else{let u=-c-1;if(u>=l.length)return[e];let f=l.slice(0,u);return[a(r.root,f)]}}case"parents":{if(r.root===void 0||r.currentPath===void 0)return[[]];let l=r.currentPath,c=[];for(let u=l.length-1;u>=0;u--)c.push(a(r.root,l.slice(0,u)));return[c]}case"root":return r.root!==void 0?[r.root]:[];default:return null}}var Ih=I(()=>{"use strict";Nn()});function Yo(e,t,n,r,s){switch(t){case"keys":return Array.isArray(e)?[e.map((i,a)=>a)]:e&&typeof e=="object"?[Object.keys(e).sort()]:[null];case"keys_unsorted":return Array.isArray(e)?[e.map((i,a)=>a)]:e&&typeof e=="object"?[Object.keys(e)]:[null];case"length":return typeof e=="string"?[e.length]:Array.isArray(e)?[e.length]:e&&typeof e=="object"?[Object.keys(e).length]:e===null?[0]:typeof e=="number"?[Math.abs(e)]:[null];case"utf8bytelength":{if(typeof e=="string")return[new TextEncoder().encode(e).length];let i=e===null?"null":Array.isArray(e)?"array":typeof e,a=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${a}) only strings have UTF-8 byte length`)}case"to_entries":return e&&typeof e=="object"&&!Array.isArray(e)?[Object.entries(e).map(([i,a])=>({key:i,value:a}))]:[null];case"from_entries":if(Array.isArray(e)){let i=Object.create(null);for(let a of e)if(a&&typeof a=="object"){let o=a,l=o.key??o.Key??o.name??o.Name??o.k,c=o.value??o.Value??o.v;if(l!==void 0){let u=String(l);$e(u)&&Pe(i,u,c)}}return[i]}return[null];case"with_entries":{if(n.length===0)return[e];if(e&&typeof e=="object"&&!Array.isArray(e)){let a=Object.entries(e).map(([l,c])=>({key:l,value:c})).flatMap(l=>s(l,n[0],r)),o=Object.create(null);for(let l of a)if(l&&typeof l=="object"){let c=l,u=c.key??c.name??c.k,f=c.value??c.v;if(u!==void 0){let p=String(u);$e(p)&&Pe(o,p,f)}}return[o]}return[null]}case"reverse":return Array.isArray(e)?[[...e].reverse()]:typeof e=="string"?[e.split("").reverse().join("")]:[null];case"flatten":return Array.isArray(e)?(n.length>0?s(e,n[0],r):[Number.POSITIVE_INFINITY]).map(a=>{let o=a;if(o<0)throw new Error("flatten depth must not be negative");return e.flat(o)}):[null];case"unique":if(Array.isArray(e)){let i=new Set,a=[];for(let o of e){let l=JSON.stringify(o);i.has(l)||(i.add(l),a.push(o))}return[a]}return[null];case"tojson":case"tojsonstream":{let i=r.limits.maxDepth??r5;return Pr(e,i+1)>i?[null]:[JSON.stringify(e)]}case"fromjson":{if(typeof e=="string"){let i=e.trim().toLowerCase();if(i==="nan")return[Number.NaN];if(i==="inf"||i==="infinity")return[Number.POSITIVE_INFINITY];if(i==="-inf"||i==="-infinity")return[Number.NEGATIVE_INFINITY];try{return[JSON.parse(e)]}catch{throw new Error(`Invalid JSON: ${e}`)}}return[e]}case"tostring":return typeof e=="string"?[e]:[JSON.stringify(e)];case"tonumber":if(typeof e=="number")return[e];if(typeof e=="string"){let i=Number(e);if(Number.isNaN(i))throw new Error(`${JSON.stringify(e)} cannot be parsed as a number`);return[i]}throw new Error(`${typeof e} cannot be parsed as a number`);case"toboolean":{if(typeof e=="boolean")return[e];if(typeof e=="string"){if(e==="true")return[!0];if(e==="false")return[!1];throw new Error(`string (${JSON.stringify(e)}) cannot be parsed as a boolean`)}let i=e===null?"null":Array.isArray(e)?"array":typeof e,a=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${a}) cannot be parsed as a boolean`)}case"tostream":{let i=[],a=(o,l)=>{if(o===null||typeof o!="object")i.push([l,o]);else if(Array.isArray(o))if(o.length===0)i.push([l,[]]);else for(let c=0;c<o.length;c++)a(o[c],[...l,c]);else{let c=Object.keys(o);if(c.length===0)i.push([l,Object.create(null)]);else for(let u of c)a(o[u],[...l,u])}};return a(e,[]),i.push([[]]),i}case"fromstream":{if(n.length===0)return[e];let i=s(e,n[0],r),a=null;for(let o of i){if(!Array.isArray(o)||o.length===1&&Array.isArray(o[0])&&o[0].length===0||o.length!==2)continue;let[l,c]=o;if(!Array.isArray(l))continue;if(l.length===0){a=c;continue}a===null&&(a=typeof l[0]=="number"?[]:{});let u=a;for(let p=0;p<l.length-1;p++){let h=l[p],m=l[p+1];if(Array.isArray(u)&&typeof h=="number"){for(;u.length<=h;)u.push(null);u[h]===null&&(u[h]=typeof m=="number"?[]:{}),u=u[h]}else if(u&&typeof u=="object"&&!Array.isArray(u)){let d=String(h);if(!$e(d))continue;let g=u;(g[d]===null||g[d]===void 0)&&Pe(g,d,typeof m=="number"?[]:{}),u=g[d]}}let f=l[l.length-1];if(Array.isArray(u)&&typeof f=="number"){for(;u.length<=f;)u.push(null);u[f]=c}else if(u&&typeof u=="object"&&!Array.isArray(u)){let p=String(f);$e(p)&&Pe(u,p,c)}}return[a]}case"truncate_stream":{let i=typeof e=="number"?Math.floor(e):0;if(n.length===0)return[];let a=[],o=s(e,n[0],r);for(let l of o)if(Array.isArray(l)){if(l.length===1&&Array.isArray(l[0])){let c=l[0];c.length>i&&a.push([c.slice(i)]);continue}if(l.length===2&&Array.isArray(l[0])){let c=l[0],u=l[1];c.length>i&&a.push([c.slice(i),u])}}return a}default:return null}}var r5,$h=I(()=>{"use strict";Nn();Ni();r5=2e3});function Jo(e,t,n,r,s,i,a,o,l,c){switch(t){case"getpath":{if(n.length===0)return[null];let u=s(e,n[0],r),f=[];for(let p of u){let h=p,m=e;for(let d of h){if(m==null){m=null;break}if(Array.isArray(m)&&typeof d=="number")m=m[d];else if(typeof m=="object"&&typeof d=="string"){let g=m;if(!Object.hasOwn(g,d)){m=null;break}m=g[d]}else{m=null;break}}f.push(m)}return f}case"setpath":{if(n.length<2)return[null];let f=s(e,n[0],r)[0],h=s(e,n[1],r)[0];return[a(e,f,h)]}case"delpaths":{if(n.length===0)return[e];let f=s(e,n[0],r)[0],p=e;for(let h of f.sort((m,d)=>d.length-m.length))p=o(p,h);return[p]}case"path":{if(n.length===0)return[[]];let u=[];return c(e,n[0],r,[],u),u}case"del":return n.length===0?[e]:[l(e,n[0],r)];case"pick":{if(n.length===0)return[null];let u=[];for(let p of n)c(e,p,r,[],u);let f=null;for(let p of u){for(let m of p)if(typeof m=="number"&&m<0)throw new Error("Out of bounds negative array index");let h=e;for(let m of p){if(h==null)break;if(Array.isArray(h)&&typeof m=="number")h=h[m];else if(typeof h=="object"&&typeof m=="string"){let d=h;if(!Object.hasOwn(d,m)){h=null;break}h=d[m]}else{h=null;break}}f=a(f,p,h)}return[f]}case"paths":{let u=[],f=(p,h)=>{if(p&&typeof p=="object")if(Array.isArray(p))for(let m=0;m<p.length;m++)u.push([...h,m]),f(p[m],[...h,m]);else for(let m of Object.keys(p))u.push([...h,m]),f(p[m],[...h,m])};return f(e,[]),n.length>0?u.filter(p=>{let h=e;for(let d of p)if(Array.isArray(h)&&typeof d=="number")h=h[d];else if(h&&typeof h=="object"&&typeof d=="string"){let g=h;if(!Object.hasOwn(g,d))return!1;h=g[d]}else return!1;return s(h,n[0],r).some(i)}):u}case"leaf_paths":{let u=[],f=(p,h)=>{if(p===null||typeof p!="object")u.push(h);else if(Array.isArray(p))for(let m=0;m<p.length;m++)f(p[m],[...h,m]);else for(let m of Object.keys(p))f(p[m],[...h,m])};return f(e,[]),u}default:return null}}var Oh=I(()=>{"use strict"});function el(e,t,n,r,s,i){switch(t){case"IN":{if(n.length===0)return[!1];if(n.length===1){let c=s(e,n[0],r);for(let u of c)if(i(e,u))return[!0];return[!1]}let a=s(e,n[0],r),o=s(e,n[1],r),l=new Set(o.map(c=>JSON.stringify(c)));for(let c of a)if(l.has(JSON.stringify(c)))return[!0];return[!1]}case"INDEX":{if(n.length===0)return[{}];if(n.length===1){let l=s(e,n[0],r),c=Object.create(null);for(let u of l){let f=String(u);$e(f)&&Pe(c,f,u)}return[c]}if(n.length===2){let l=s(e,n[0],r),c=Object.create(null);for(let u of l){let f=s(u,n[1],r);if(f.length>0){let p=String(f[0]);$e(p)&&Pe(c,p,u)}}return[c]}let a=s(e,n[0],r),o=Object.create(null);for(let l of a){let c=s(l,n[1],r),u=s(l,n[2],r);if(c.length>0&&u.length>0){let f=String(c[0]);$e(f)&&Pe(o,f,u[0])}}return[o]}case"JOIN":{if(n.length<2)return[null];let a=s(e,n[0],r)[0];if(!a||typeof a!="object"||Array.isArray(a))return[null];let o=a;if(!Array.isArray(e))return[null];let l=[];for(let c of e){let u=s(c,n[1],r),f=u.length>0?String(u[0]):"",p=mn(o,f)?o[f]:null;l.push([c,p])}return[l]}default:return null}}var Rh=I(()=>{"use strict";Nn()});function tl(e,t,n,r,s){switch(t){case"join":{if(!Array.isArray(e))return[null];let i=n.length>0?s(e,n[0],r):[""];for(let a of e)if(Array.isArray(a)||a!==null&&typeof a=="object")throw new Error("cannot join: contains arrays or objects");return i.map(a=>e.map(o=>o===null?"":typeof o=="string"?o:String(o)).join(String(a)))}case"split":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),a=String(i[0]);return[e.split(a)]}case"splits":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),a=String(i[0]);try{let o=n.length>1?String(s(e,n[1],r)[0]):"g";return V(a,o.includes("g")?o:`${o}g`).split(e)}catch{return[]}}case"scan":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),a=String(i[0]);try{let o=n.length>1?String(s(e,n[1],r)[0]):"";return[...V(a,o.includes("g")?o:`${o}g`).matchAll(e)].map(u=>u.length>1?u.slice(1):u[0])}catch{return[]}}case"test":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r),a=String(i[0]);try{let o=n.length>1?String(s(e,n[1],r)[0]):"";return[V(a,o).test(e)]}catch{return[!1]}}case"match":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),a=String(i[0]);try{let o=n.length>1?String(s(e,n[1],r)[0]):"",c=V(a,`${o}d`).exec(e);if(!c)return[];let u=c.indices;return[{offset:c.index,length:c[0].length,string:c[0],captures:c.slice(1).map((f,p)=>({offset:u?.[p+1]?.[0]??null,length:f?.length??0,string:f??"",name:null}))}]}catch{return[null]}}case"capture":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),a=String(i[0]);try{let o=n.length>1?String(s(e,n[1],r)[0]):"",c=V(a,o).match(e);return!c||!c.groups?[{}]:[c.groups]}catch{return[null]}}case"sub":{if(typeof e!="string"||n.length<2)return[null];let i=s(e,n[0],r),a=s(e,n[1],r),o=String(i[0]),l=String(a[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"";return[V(o,c).replace(e,l)]}catch{return[e]}}case"gsub":{if(typeof e!="string"||n.length<2)return[null];let i=s(e,n[0],r),a=s(e,n[1],r),o=String(i[0]),l=String(a[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"g",u=c.includes("g")?c:`${c}g`;return[V(o,u).replace(e,l)]}catch{return[e]}}case"ascii_downcase":return typeof e=="string"?[e.replace(/[A-Z]/g,i=>String.fromCharCode(i.charCodeAt(0)+32))]:[null];case"ascii_upcase":return typeof e=="string"?[e.replace(/[a-z]/g,i=>String.fromCharCode(i.charCodeAt(0)-32))]:[null];case"ltrimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),a=String(i[0]);return[e.startsWith(a)?e.slice(a.length):e]}case"rtrimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),a=String(i[0]);return a===""?[e]:[e.endsWith(a)?e.slice(0,-a.length):e]}case"trimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),a=String(i[0]);if(a==="")return[e];let o=e;return o.startsWith(a)&&(o=o.slice(a.length)),o.endsWith(a)&&(o=o.slice(0,-a.length)),[o]}case"trim":if(typeof e=="string")return[e.trim()];throw new Error("trim input must be a string");case"ltrim":if(typeof e=="string")return[e.trimStart()];throw new Error("trim input must be a string");case"rtrim":if(typeof e=="string")return[e.trimEnd()];throw new Error("trim input must be a string");case"startswith":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r);return[e.startsWith(String(i[0]))]}case"endswith":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r);return[e.endsWith(String(i[0]))]}case"ascii":return typeof e=="string"&&e.length>0?[e.charCodeAt(0)]:[null];case"explode":return typeof e=="string"?[Array.from(e).map(i=>i.codePointAt(0))]:[null];case"implode":if(!Array.isArray(e))throw new Error("implode input must be an array");return[e.map(o=>{if(typeof o=="string")throw new Error(`string (${JSON.stringify(o)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof o!="number"||Number.isNaN(o))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let l=Math.trunc(o);return l<0||l>1114111||l>=55296&&l<=57343?String.fromCodePoint(65533):String.fromCodePoint(l)}).join("")];default:return null}}var Th=I(()=>{"use strict";Me()});function nl(e,t){switch(t){case"type":return e===null?["null"]:Array.isArray(e)?["array"]:typeof e=="boolean"?["boolean"]:typeof e=="number"?["number"]:typeof e=="string"?["string"]:typeof e=="object"?["object"]:["null"];case"infinite":return[Number.POSITIVE_INFINITY];case"nan":return[Number.NaN];case"isinfinite":return[typeof e=="number"&&!Number.isFinite(e)];case"isnan":return[typeof e=="number"&&Number.isNaN(e)];case"isnormal":return[typeof e=="number"&&Number.isFinite(e)&&e!==0];case"isfinite":return[typeof e=="number"&&Number.isFinite(e)];case"numbers":return typeof e=="number"?[e]:[];case"strings":return typeof e=="string"?[e]:[];case"booleans":return typeof e=="boolean"?[e]:[];case"nulls":return e===null?[e]:[];case"arrays":return Array.isArray(e)?[e]:[];case"objects":return e&&typeof e=="object"&&!Array.isArray(e)?[e]:[];case"iterables":return Array.isArray(e)||e&&typeof e=="object"&&!Array.isArray(e)?[e]:[];case"scalars":return!Array.isArray(e)&&!(e&&typeof e=="object")?[e]:[];case"values":return e===null?[]:[e];case"not":return e===!1||e===null?[!0]:[!1];case"null":return[null];case"true":return[!0];case"false":return[!1];case"empty":return[];default:return null}}var Ph=I(()=>{"use strict"});var Dh=I(()=>{"use strict";Ah();Sh();Ch();Nh();vh();kh();Ih();$h();Oh();Rh();Th();Ph()});function vi(e,t,n){if(t.length===0)return n;let[r,...s]=t;if(typeof r=="number"){if(e&&typeof e=="object"&&!Array.isArray(e))throw new Error("Cannot index object with number");if(r>536870911)throw new Error("Array index too large");if(r<0)throw new Error("Out of bounds negative array index");let l=Array.isArray(e)?[...e]:[];for(;l.length<=r;)l.push(null);return l[r]=vi(l[r],s,n),l}if(Array.isArray(e))throw new Error("Cannot index array with string");if(!$e(r))return e??Object.create(null);let i=e&&typeof e=="object"&&!Array.isArray(e)?Ke(e):Object.create(null),a=Object.hasOwn(i,r)?i[r]:void 0;return Pe(i,r,vi(a,s,n)),i}function ki(e,t){if(t.length===0)return null;if(t.length===1){let s=t[0];if(Array.isArray(e)&&typeof s=="number"){let i=[...e];return i.splice(s,1),i}if(e&&typeof e=="object"&&!Array.isArray(e)){let i=String(s);if(!$e(i))return e;let a=Ke(e);return delete a[i],a}return e}let[n,...r]=t;if(Array.isArray(e)&&typeof n=="number"){let s=[...e];return s[n]=ki(s[n],r),s}if(e&&typeof e=="object"&&!Array.isArray(e)){let s=String(n);if(!$e(s))return e;let i=Ke(e);return Object.hasOwn(i,s)&&Pe(i,s,ki(i[s],r)),i}return e}var _h=I(()=>{"use strict";Nn()});function a5(e){return{vars:new Map,limits:{maxIterations:e?.limits?.maxIterations??s5,maxDepth:e?.limits?.maxDepth??Mh},env:e?.env,coverage:e?.coverage}}function Oi(e,t,n){let r=new Map(e.vars);return r.set(t,n),{vars:r,limits:e.limits,env:e.env,root:e.root,currentPath:e.currentPath,funcs:e.funcs,labels:e.labels,coverage:e.coverage}}function Es(e,t,n){switch(t.type){case"var":return Oi(e,t.name,n);case"array":{if(!Array.isArray(n))return null;let r=e;for(let s=0;s<t.elements.length;s++){let i=t.elements[s],a=s<n.length?n[s]:null,o=Es(r,i,a);if(o===null)return null;r=o}return r}case"object":{if(n===null||typeof n!="object"||Array.isArray(n))return null;let r=n,s=e;for(let i of t.fields){let a;if(typeof i.key=="string")a=i.key;else{let c=G(n,i.key,e);if(c.length===0)return null;a=String(c[0])}let o=mn(r,a)?r[a]:null;i.keyVar&&(s=Oi(s,i.keyVar,o));let l=Es(s,i.pattern,o);if(l===null)return null;s=l}return s}}}function o5(e,t){let n=e;for(let r of t)if(n&&typeof n=="object")if(Array.isArray(n))if(typeof r=="number")n=n[r];else return;else{let s=n;if(typeof r=="string"&&Object.hasOwn(s,r))n=s[r];else return}else return;return n}function _n(e){if(e.type==="Identity")return[];if(e.type==="Field"){let t=e.base?_n(e.base):[];return t===null?null:[...t,e.name]}if(e.type==="Index"&&e.index.type==="Literal"){let t=e.base?_n(e.base):[];if(t===null)return null;let n=e.index.value;return typeof n=="number"||typeof n=="string"?[...t,n]:null}if(e.type==="Pipe"){let t=_n(e.left);return t===null?null:rl(t,e.right)}if(e.type==="Call"){if(e.name==="parent"||e.name==="root")return null;if(e.name==="first"&&e.args.length===0)return[0];if(e.name==="last"&&e.args.length===0)return[-1]}return null}function rl(e,t){if(t.type==="Call"){if(t.name==="parent"){let n=1;if(t.args.length>0&&t.args[0].type==="Literal"){let r=t.args[0].value;typeof r=="number"&&(n=r)}if(n>=0)return e.slice(0,Math.max(0,e.length-n));{let r=-n-1;return e.slice(0,Math.min(r,e.length))}}if(t.name==="root")return[]}if(t.type==="Field"){let n=_n(t);if(n!==null)return[...e,...n]}if(t.type==="Index"&&t.index.type==="Literal"){let n=_n(t);if(n!==null)return[...e,...n]}if(t.type==="Pipe"){let n=rl(e,t.left);return n===null?null:rl(n,t.right)}return t.type==="Identity"?e:null}function Lh(e,t,n){if(t.type==="Comma"){let r=[];try{r.push(...G(e,t.left,n))}catch(s){if(s instanceof J)throw s;if(r.length>0)return r;throw new Error("evaluation failed")}try{r.push(...G(e,t.right,n))}catch(s){if(s instanceof J)throw s;return r}return r}return G(e,t,n)}function G(e,t,n){let r=n&&"vars"in n?n:a5(n);switch(r.root===void 0&&(r={...r,root:e,currentPath:[]}),r.coverage?.hit(`jq:node:${t.type}`),t.type){case"Identity":return[e];case"Field":return(t.base?G(e,t.base,r):[e]).flatMap(i=>{if(i&&typeof i=="object"&&!Array.isArray(i)){let o=i;if(!Object.hasOwn(o,t.name))return[null];let l=o[t.name];return[l===void 0?null:l]}if(i===null)return[null];let a=Array.isArray(i)?"array":typeof i;throw new Error(`Cannot index ${a} with string "${t.name}"`)});case"Index":return(t.base?G(e,t.base,r):[e]).flatMap(i=>G(i,t.index,r).flatMap(o=>{if(typeof o=="number"&&Array.isArray(i)){if(Number.isNaN(o))return[null];let l=Math.trunc(o),c=l<0?i.length+l:l;return c>=0&&c<i.length?[i[c]]:[null]}if(typeof o=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){let l=i;return Object.hasOwn(l,o)?[l[o]]:[null]}return[null]}));case"Slice":return(t.base?G(e,t.base,r):[e]).flatMap(i=>{if(i===null)return[null];if(!Array.isArray(i)&&typeof i!="string")throw new Error(`Cannot slice ${typeof i} (${JSON.stringify(i)})`);let a=i.length,o=t.start?G(e,t.start,r):[0],l=t.end?G(e,t.end,r):[a];return o.flatMap(c=>l.map(u=>{let f=c,p=u,h=Number.isNaN(f)?0:Number.isInteger(f)?f:Math.floor(f),m=Number.isNaN(p)?a:Number.isInteger(p)?p:Math.ceil(p),d=Fh(h,a),g=Fh(m,a);return Array.isArray(i),i.slice(d,g)}))});case"Iterate":return(t.base?G(e,t.base,r):[e]).flatMap(i=>Array.isArray(i)?i:i&&typeof i=="object"?Object.values(i):[]);case"Pipe":{let s=G(e,t.left,r),i=_n(t.left),a=[];for(let o of s)try{if(i!==null){let l={...r,currentPath:[...r.currentPath??[],...i]};a.push(...G(o,t.right,l))}else a.push(...G(o,t.right,r))}catch(l){throw l instanceof Dr?l.withPrependedResults(a):l}return a}case"Comma":{let s=G(e,t.left,r),i=G(e,t.right,r);return[...s,...i]}case"Literal":return[t.value];case"Array":return t.elements?[G(e,t.elements,r)]:[[]];case"Object":{let s=[Object.create(null)];for(let i of t.entries){let a=typeof i.key=="string"?[i.key]:G(e,i.key,r),o=G(e,i.value,r),l=[];for(let c of s)for(let u of a){if(typeof u!="string"){let f=u===null?"null":Array.isArray(u)?"array":typeof u;throw new Error(`Cannot use ${f} (${JSON.stringify(u)}) as object key`)}if(!$e(u)){for(let f of o)l.push(Ke(c));continue}for(let f of o){let p=Ke(c);Pe(p,u,f),l.push(p)}}s.length=0,s.push(...l)}return s}case"Paren":return G(e,t.expr,r);case"BinaryOp":return u5(e,t.op,t.left,t.right,r);case"UnaryOp":return G(e,t.operand,r).map(i=>{if(t.op==="-"){if(typeof i=="number")return-i;if(typeof i=="string"){let a=o=>o.length>5?`"${o.slice(0,3)}...`:JSON.stringify(o);throw new Error(`string (${a(i)}) cannot be negated`)}return null}return t.op==="not"?!Qt(i):null});case"Cond":return G(e,t.cond,r).flatMap(i=>{if(Qt(i))return G(e,t.then,r);for(let a of t.elifs)if(G(e,a.cond,r).some(Qt))return G(e,a.then,r);return t.else?G(e,t.else,r):[e]});case"Try":try{return G(e,t.body,r)}catch(s){if(t.catch){let i=s instanceof $i?s.value:s instanceof Error?s.message:String(s);return G(i,t.catch,r)}return[]}case"Call":return Uh(e,t.name,t.args,r);case"VarBind":return G(e,t.value,r).flatMap(i=>{let a=null,o=[];t.pattern?o.push(t.pattern):t.name&&o.push({type:"var",name:t.name}),t.alternatives&&o.push(...t.alternatives);for(let l of o)if(a=Es(r,l,i),a!==null)break;return a===null?[]:G(e,t.body,a)});case"VarRef":{if(t.name==="$ENV")return[r.env?Et(r.env):Object.create(null)];let s=r.vars.get(t.name);return s!==void 0?[s]:[null]}case"Recurse":{let s=[],i=new WeakSet,a=o=>{if(o&&typeof o=="object"){if(i.has(o))return;i.add(o)}if(s.push(o),Array.isArray(o))for(let l of o)a(l);else if(o&&typeof o=="object")for(let l of Object.keys(o))a(o[l])};return a(e),s}case"Optional":try{return G(e,t.expr,r)}catch{return[]}case"StringInterp":return[t.parts.map(i=>typeof i=="string"?i:G(e,i,r).map(o=>typeof o=="string"?o:JSON.stringify(o)).join("")).join("")];case"UpdateOp":return[l5(e,t.path,t.op,t.value,r)];case"Reduce":{let s=G(e,t.expr,r),i=G(e,t.init,r)[0],a=r.limits.maxDepth??Mh;for(let o of s){let l;if(t.pattern){if(l=Es(r,t.pattern,o),l===null)continue}else l=Oi(r,t.varName,o);if(i=G(i,t.update,l)[0],Pr(i,a+1)>a)return[null]}return[i]}case"Foreach":{let s=G(e,t.expr,r),i=G(e,t.init,r)[0],a=[];for(let o of s)try{let l;if(t.pattern){if(l=Es(r,t.pattern,o),l===null)continue}else l=Oi(r,t.varName,o);if(i=G(i,t.update,l)[0],t.extract){let c=G(i,t.extract,l);a.push(...c)}else a.push(i)}catch(l){throw l instanceof Dr?l.withPrependedResults(a):l}return a}case"Label":try{return G(e,t.body,{...r,labels:new Set([...r.labels??[],t.name])})}catch(s){if(s instanceof Dr&&s.label===t.name)return s.partialResults;throw s}case"Break":throw new Dr(t.name);case"Def":{let s=new Map(r.funcs??[]),i=`${t.name}/${t.params.length}`;s.set(i,{params:t.params,body:t.funcBody,closure:new Map(r.funcs??[])});let a={...r,funcs:s};return G(e,t.body,a)}default:{let s=t;throw new Error(`Unknown AST node type: ${s.type}`)}}}function Fh(e,t){return e<0?Math.max(0,t+e):Math.min(e,t)}function l5(e,t,n,r,s){function i(l,c){switch(n){case"=":return c;case"|=":return G(l,r,s)[0]??null;case"+=":return typeof l=="number"&&typeof c=="number"||typeof l=="string"&&typeof c=="string"?l+c:Array.isArray(l)&&Array.isArray(c)?[...l,...c]:l&&c&&typeof l=="object"&&typeof c=="object"?Ho(l,c):c;case"-=":return typeof l=="number"&&typeof c=="number"?l-c:l;case"*=":return typeof l=="number"&&typeof c=="number"?l*c:l;case"/=":return typeof l=="number"&&typeof c=="number"?l/c:l;case"%=":return typeof l=="number"&&typeof c=="number"?l%c:l;case"//=":return l===null||l===!1?c:l;default:return c}}function a(l,c,u){switch(c.type){case"Identity":return u(l);case"Field":{if(!$e(c.name))return l;if(c.base)return a(l,c.base,f=>{if(f&&typeof f=="object"&&!Array.isArray(f)){let p=Ke(f),h=Object.hasOwn(p,c.name)?p[c.name]:void 0;return Pe(p,c.name,u(h)),p}return f});if(l&&typeof l=="object"&&!Array.isArray(l)){let f=Ke(l),p=Object.hasOwn(f,c.name)?f[c.name]:void 0;return Pe(f,c.name,u(p)),f}return l}case"Index":{let p=G(e,c.index,s)[0];if(typeof p=="number"&&Number.isNaN(p))throw new Error("Cannot set array element at NaN index");if(typeof p=="number"&&!Number.isInteger(p)&&(p=Math.trunc(p)),c.base)return a(l,c.base,h=>{if(typeof p=="number"&&Array.isArray(h)){let m=[...h],d=p<0?m.length+p:p;if(d>=0){for(;m.length<=d;)m.push(null);m[d]=u(m[d])}return m}if(typeof p=="string"&&h&&typeof h=="object"&&!Array.isArray(h)){if(!$e(p))return h;let m=Ke(h),d=Object.hasOwn(m,p)?m[p]:void 0;return Pe(m,p,u(d)),m}return h});if(typeof p=="number"){if(p>536870911)throw new Error("Array index too large");if(p<0&&(!l||!Array.isArray(l)))throw new Error("Out of bounds negative array index");if(Array.isArray(l)){let m=[...l],d=p<0?m.length+p:p;if(d>=0){for(;m.length<=d;)m.push(null);m[d]=u(m[d])}return m}if(l==null){let m=[];for(;m.length<=p;)m.push(null);return m[p]=u(null),m}return l}if(typeof p=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!$e(p))return l;let h=Ke(l),m=Object.hasOwn(h,p)?h[p]:void 0;return Pe(h,p,u(m)),h}return l}case"Iterate":{let f=p=>{if(Array.isArray(p))return p.map(h=>u(h));if(p&&typeof p=="object"){let h=Object.create(null);for(let[m,d]of Object.entries(p))$e(m)&&Pe(h,m,u(d));return h}return p};return c.base?a(l,c.base,f):f(l)}case"Pipe":{let f=a(l,c.left,p=>p);return a(f,c.right,u)}default:return u(l)}}return a(e,t,l=>{if(n==="|=")return i(l,l);let c=G(e,r,s);return i(l,c[0]??null)})}function c5(e,t,n){function r(i,a,o){switch(a.type){case"Identity":return o;case"Field":{if(!$e(a.name))return i;if(a.base){let l=G(i,a.base,n)[0],c=r(l,{type:"Field",name:a.name},o);return r(i,a.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){let l=Ke(i);return Pe(l,a.name,o),l}return i}case"Index":{if(a.base){let u=G(i,a.base,n)[0],f=r(u,{type:"Index",index:a.index},o);return r(i,a.base,f)}let c=G(e,a.index,n)[0];if(typeof c=="number"&&Array.isArray(i)){let u=[...i],f=c<0?u.length+c:c;return f>=0&&f<u.length&&(u[f]=o),u}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!$e(c))return i;let u=Ke(i);return Pe(u,c,o),u}return i}default:return i}}function s(i,a){switch(a.type){case"Identity":return null;case"Field":{if(!$e(a.name))return i;if(a.base){let l=G(i,a.base,n)[0];if(l==null)return i;let c=s(l,{type:"Field",name:a.name});return r(i,a.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){if(!$e(a.name))return i;let l=Ke(i);return delete l[a.name],l}return i}case"Index":{if(a.base){let u=G(i,a.base,n)[0];if(u==null)return i;let f=s(u,{type:"Index",index:a.index});return r(i,a.base,f)}let c=G(e,a.index,n)[0];if(typeof c=="number"&&Array.isArray(i)){let u=[...i],f=c<0?u.length+c:c;return f>=0&&f<u.length&&u.splice(f,1),u}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!$e(c))return i;let u=Ke(i);return delete u[c],u}return i}case"Iterate":return Array.isArray(i)?[]:i&&typeof i=="object"?Object.create(null):i;case"Pipe":{let u=function(h,m,d){switch(m.type){case"Identity":return d;case"Field":{if(!$e(m.name))return h;if(h&&typeof h=="object"&&!Array.isArray(h)){let g=Ke(h);return Pe(g,m.name,d),g}return h}case"Index":{let w=G(e,m.index,n)[0];if(typeof w=="number"&&Array.isArray(h)){let y=[...h],b=w<0?y.length+w:w;return b>=0&&b<y.length&&(y[b]=d),y}if(typeof w=="string"&&h&&typeof h=="object"&&!Array.isArray(h)){if(!$e(w))return h;let y=Ke(h);return Pe(y,w,d),y}return h}case"Pipe":{let g=G(h,m.left,n)[0],w=u(g,m.right,d);return u(h,m.left,w)}default:return h}};var o=u;let l=a.left,c=a.right,f=G(i,l,n)[0];if(f==null)return i;let p=s(f,c);return u(i,l,p)}default:return i}}return s(e,t)}function u5(e,t,n,r,s){if(t==="and")return G(e,n,s).flatMap(l=>Qt(l)?G(e,r,s).map(u=>Qt(u)):[!1]);if(t==="or")return G(e,n,s).flatMap(l=>Qt(l)?[!0]:G(e,r,s).map(u=>Qt(u)));if(t==="//"){let l=G(e,n,s).filter(c=>c!=null&&c!==!1);return l.length>0?l:G(e,r,s)}let i=G(e,n,s),a=G(e,r,s);return i.flatMap(o=>a.map(l=>{switch(t){case"+":return o===null?l:l===null?o:typeof o=="number"&&typeof l=="number"||typeof o=="string"&&typeof l=="string"?o+l:Array.isArray(o)&&Array.isArray(l)?[...o,...l]:o&&l&&typeof o=="object"&&typeof l=="object"&&!Array.isArray(o)&&!Array.isArray(l)?Ho(o,l):null;case"-":if(typeof o=="number"&&typeof l=="number")return o-l;if(Array.isArray(o)&&Array.isArray(l)){let c=new Set(l.map(u=>JSON.stringify(u)));return o.filter(u=>!c.has(JSON.stringify(u)))}if(typeof o=="string"&&typeof l=="string"){let c=u=>u.length>10?`"${u.slice(0,10)}...`:JSON.stringify(u);throw new Error(`string (${c(o)}) and string (${c(l)}) cannot be subtracted`)}return null;case"*":return typeof o=="number"&&typeof l=="number"?o*l:typeof o=="string"&&typeof l=="number"?o.repeat(l):o&&l&&typeof o=="object"&&typeof l=="object"&&!Array.isArray(o)&&!Array.isArray(l)?qo(o,l):null;case"/":if(typeof o=="number"&&typeof l=="number"){if(l===0)throw new Error(`number (${o}) and number (${l}) cannot be divided because the divisor is zero`);return o/l}return typeof o=="string"&&typeof l=="string"?o.split(l):null;case"%":if(typeof o=="number"&&typeof l=="number"){if(l===0)throw new Error(`number (${o}) and number (${l}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(o)&&!Number.isNaN(o)?!Number.isFinite(l)&&!Number.isNaN(l)&&o<0&&l>0?-1:0:o%l}return null;case"==":return Tr(o,l);case"!=":return!Tr(o,l);case"<":return xs(o,l)<0;case"<=":return xs(o,l)<=0;case">":return xs(o,l)>0;case">=":return xs(o,l)>=0;default:return null}}))}function Uh(e,t,n,r){let s=i5.get(t);if(s)return typeof e=="number"?[s(e)]:[null];let i=Qo(e,t,n,r,G);if(i!==null)return i;let a=tl(e,t,n,r,G);if(a!==null)return a;let o=Vo(e,t,n,r,G);if(o!==null)return o;let l=Zo(e,t,r.limits.maxDepth);if(l!==null)return l;let c=nl(e,t);if(c!==null)return c;let u=Yo(e,t,n,r,G);if(u!==null)return u;let f=jo(e,t,n,r,G,Lh,Si,Qt,Ci,J);if(f!==null)return f;let p=Jo(e,t,n,r,G,Qt,vi,ki,c5,Ii);if(p!==null)return p;let h=Ko(e,t,n,r,G,Tr);if(h!==null)return h;let m=Go(e,t,n,r,G,Lh,Qt,J);if(m!==null)return m;let d=Xo(e,t,n,r,G,Qt,o5,Uh);if(d!==null)return d;let g=el(e,t,n,r,G,Tr);if(g!==null)return g;switch(t){case"builtins":return[["add/0","all/0","all/1","all/2","any/0","any/1","any/2","arrays/0","ascii/0","ascii_downcase/0","ascii_upcase/0","booleans/0","bsearch/1","builtins/0","combinations/0","combinations/1","contains/1","debug/0","del/1","delpaths/1","empty/0","env/0","error/0","error/1","explode/0","first/0","first/1","flatten/0","flatten/1","floor/0","from_entries/0","fromdate/0","fromjson/0","getpath/1","gmtime/0","group_by/1","gsub/2","gsub/3","has/1","implode/0","IN/1","IN/2","INDEX/1","INDEX/2","index/1","indices/1","infinite/0","inside/1","isempty/1","isnan/0","isnormal/0","isvalid/1","iterables/0","join/1","keys/0","keys_unsorted/0","last/0","last/1","length/0","limit/2","ltrimstr/1","map/1","map_values/1","match/1","match/2","max/0","max_by/1","min/0","min_by/1","mktime/0","modulemeta/1","nan/0","not/0","nth/1","nth/2","null/0","nulls/0","numbers/0","objects/0","path/1","paths/0","paths/1","pick/1","range/1","range/2","range/3","recurse/0","recurse/1","recurse_down/0","repeat/1","reverse/0","rindex/1","rtrimstr/1","scalars/0","scan/1","scan/2","select/1","setpath/2","skip/2","sort/0","sort_by/1","split/1","splits/1","splits/2","sqrt/0","startswith/1","strftime/1","strings/0","strptime/1","sub/2","sub/3","test/1","test/2","to_entries/0","toboolean/0","todate/0","tojson/0","tostream/0","fromstream/1","truncate_stream/1","tonumber/0","tostring/0","transpose/0","trim/0","ltrim/0","rtrim/0","type/0","unique/0","unique_by/1","until/2","utf8bytelength/0","values/0","walk/1","while/2","with_entries/1"]];case"error":{let w=n.length>0?G(e,n[0],r)[0]:e;throw new $i(w)}case"env":return[r.env?Et(r.env):Object.create(null)];case"debug":return[e];case"input_line_number":return[1];default:{let w=`${t}/${n.length}`,y=r.funcs?.get(w);if(y){let b=y.closure??r.funcs??new Map,x=new Map(b);x.set(w,y);for(let $=0;$<y.params.length;$++){let O=y.params[$],L=n[$];if(L){let R=G(e,L,r),W;if(R.length===0)W={type:"Call",name:"empty",args:[]};else if(R.length===1)W={type:"Literal",value:R[0]};else{W={type:"Literal",value:R[R.length-1]};for(let v=R.length-2;v>=0;v--)W={type:"Comma",left:{type:"Literal",value:R[v]},right:W}}x.set(`${O}/0`,{params:[],body:W})}}let S={...r,funcs:x};return G(e,y.body,S)}throw new Error(`Unknown function: ${t}`)}}}function Ii(e,t,n,r,s){if(t.type==="Comma"){let o=t;Ii(e,o.left,n,r,s),Ii(e,o.right,n,r,s);return}let i=_n(t);if(i!==null){s.push([...r,...i]);return}if(t.type==="Iterate"){if(Array.isArray(e))for(let o=0;o<e.length;o++)s.push([...r,o]);else if(e&&typeof e=="object")for(let o of Object.keys(e))s.push([...r,o]);return}if(t.type==="Recurse"){let o=(l,c)=>{if(s.push([...r,...c]),l&&typeof l=="object")if(Array.isArray(l))for(let u=0;u<l.length;u++)o(l[u],[...c,u]);else for(let u of Object.keys(l))o(l[u],[...c,u])};o(e,[]);return}if(t.type==="Pipe"){let o=_n(t.left);if(o!==null){let l=G(e,t.left,n);for(let c of l)Ii(c,t.right,n,[...r,...o],s);return}}G(e,t,n).length>0&&s.push(r)}var Dr,$i,s5,Mh,i5,Bh=I(()=>{"use strict";Pn();ye();Dh();_h();Nn();Ni();Dr=class e extends Error{label;partialResults;constructor(t,n=[]){super(`break ${t}`),this.label=t,this.partialResults=n,this.name="BreakError"}withPrependedResults(t){return new e(this.label,[...t,...this.partialResults])}},$i=class extends Error{value;constructor(t){super(typeof t=="string"?t:JSON.stringify(t)),this.value=t,this.name="JqError"}},s5=1e4,Mh=2e3,i5=new Map([["floor",Math.floor],["ceil",Math.ceil],["round",Math.round],["sqrt",Math.sqrt],["log",Math.log],["log10",Math.log10],["log2",Math.log2],["exp",Math.exp],["sin",Math.sin],["cos",Math.cos],["tan",Math.tan],["asin",Math.asin],["acos",Math.acos],["atan",Math.atan],["sinh",Math.sinh],["cosh",Math.cosh],["tanh",Math.tanh],["asinh",Math.asinh],["acosh",Math.acosh],["atanh",Math.atanh],["cbrt",Math.cbrt],["expm1",Math.expm1],["log1p",Math.log1p],["trunc",Math.trunc]])});function zh(e){let t=[],n=0,r=(c=0)=>e[n+c],s=()=>e[n++],i=()=>n>=e.length,a=c=>c>="0"&&c<="9",o=c=>c>="a"&&c<="z"||c>="A"&&c<="Z"||c==="_",l=c=>o(c)||a(c);for(;!i();){let c=n,u=s();if(!(u===" "||u===" "||u===`
552
552
  `||u==="\r")){if(u==="#"){for(;!i()&&r()!==`
553
553
  `;)s();continue}if(u==="."&&r()==="."){s(),t.push({type:"DOTDOT",pos:c});continue}if(u==="="&&r()==="="){s(),t.push({type:"EQ",pos:c});continue}if(u==="!"&&r()==="="){s(),t.push({type:"NE",pos:c});continue}if(u==="<"&&r()==="="){s(),t.push({type:"LE",pos:c});continue}if(u===">"&&r()==="="){s(),t.push({type:"GE",pos:c});continue}if(u==="/"&&r()==="/"){s(),r()==="="?(s(),t.push({type:"UPDATE_ALT",pos:c})):t.push({type:"ALT",pos:c});continue}if(u==="+"&&r()==="="){s(),t.push({type:"UPDATE_ADD",pos:c});continue}if(u==="-"&&r()==="="){s(),t.push({type:"UPDATE_SUB",pos:c});continue}if(u==="*"&&r()==="="){s(),t.push({type:"UPDATE_MUL",pos:c});continue}if(u==="/"&&r()==="="){s(),t.push({type:"UPDATE_DIV",pos:c});continue}if(u==="%"&&r()==="="){s(),t.push({type:"UPDATE_MOD",pos:c});continue}if(u==="="&&r()!=="="){t.push({type:"ASSIGN",pos:c});continue}if(u==="."){t.push({type:"DOT",pos:c});continue}if(u==="|"){r()==="="?(s(),t.push({type:"UPDATE_PIPE",pos:c})):t.push({type:"PIPE",pos:c});continue}if(u===","){t.push({type:"COMMA",pos:c});continue}if(u===":"){t.push({type:"COLON",pos:c});continue}if(u===";"){t.push({type:"SEMICOLON",pos:c});continue}if(u==="("){t.push({type:"LPAREN",pos:c});continue}if(u===")"){t.push({type:"RPAREN",pos:c});continue}if(u==="["){t.push({type:"LBRACKET",pos:c});continue}if(u==="]"){t.push({type:"RBRACKET",pos:c});continue}if(u==="{"){t.push({type:"LBRACE",pos:c});continue}if(u==="}"){t.push({type:"RBRACE",pos:c});continue}if(u==="?"){t.push({type:"QUESTION",pos:c});continue}if(u==="+"){t.push({type:"PLUS",pos:c});continue}if(u==="-"){t.push({type:"MINUS",pos:c});continue}if(u==="*"){t.push({type:"STAR",pos:c});continue}if(u==="/"){t.push({type:"SLASH",pos:c});continue}if(u==="%"){t.push({type:"PERCENT",pos:c});continue}if(u==="<"){t.push({type:"LT",pos:c});continue}if(u===">"){t.push({type:"GT",pos:c});continue}if(a(u)){let f=u;for(;!i()&&(a(r())||r()==="."||r()==="e"||r()==="E");)(r()==="e"||r()==="E")&&(e[n+1]==="+"||e[n+1]==="-")&&(f+=s()),f+=s();t.push({type:"NUMBER",value:Number(f),pos:c});continue}if(u==='"'){let f="";for(;!i()&&r()!=='"';)if(r()==="\\"){if(s(),i())break;let p=s();switch(p){case"n":f+=`
554
554
  `;break;case"r":f+="\r";break;case"t":f+=" ";break;case"\\":f+="\\";break;case'"':f+='"';break;case"(":f+="\\(";break;default:f+=p}}else f+=s();i()||s(),t.push({type:"STRING",value:f,pos:c});continue}if(o(u)||u==="$"||u==="@"){let f=u;for(;!i()&&l(r());)f+=s();let p=Wh.get(f);p?t.push({type:p,value:f,pos:c}):t.push({type:"IDENT",value:f,pos:c});continue}throw new Error(`Unexpected character '${u}' at position ${c}`)}}return t.push({type:"EOF",pos:n}),t}function Hh(e){let t=zh(e);return new sl(t).parse()}var Wh,Ri,sl,jh=I(()=>{"use strict";Wh=new Map([["and","AND"],["or","OR"],["not","NOT"],["if","IF"],["then","THEN"],["elif","ELIF"],["else","ELSE"],["end","END"],["as","AS"],["try","TRY"],["catch","CATCH"],["true","TRUE"],["false","FALSE"],["null","NULL"],["reduce","REDUCE"],["foreach","FOREACH"],["label","LABEL"],["break","BREAK"],["def","DEF"]]),Ri=new Set(Wh.values());sl=class e{tokens;pos=0;constructor(t){this.tokens=t}peek(t=0){return this.tokens[this.pos+t]??{type:"EOF",pos:-1}}advance(){return this.tokens[this.pos++]}check(t){return this.peek().type===t}match(...t){for(let n of t)if(this.check(n))return this.advance();return null}expect(t,n){if(!this.check(t))throw new Error(`${n} at position ${this.peek().pos}, got ${this.peek().type}`);return this.advance()}isFieldNameAfterDot(t=0){let n=this.peek(t),r=this.peek(t+1);return r.type==="STRING"?!0:r.type==="IDENT"||Ri.has(r.type)?r.pos===n.pos+1:!1}isIdentLike(){let t=this.peek().type;return t==="IDENT"||Ri.has(t)}consumeFieldNameAfterDot(t){let n=this.peek();return n.type==="STRING"?this.advance().value:(n.type==="IDENT"||Ri.has(n.type))&&n.pos===t.pos+1?this.advance().value:null}parse(){let t=this.parseExpr();if(!this.check("EOF"))throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`);return t}parseExpr(){return this.parsePipe()}parsePattern(){if(this.match("LBRACKET")){let r=[];if(!this.check("RBRACKET"))for(r.push(this.parsePattern());this.match("COMMA")&&!this.check("RBRACKET");)r.push(this.parsePattern());return this.expect("RBRACKET","Expected ']' after array pattern"),{type:"array",elements:r}}if(this.match("LBRACE")){let r=[];if(!this.check("RBRACE"))for(r.push(this.parsePatternField());this.match("COMMA")&&!this.check("RBRACE");)r.push(this.parsePatternField());return this.expect("RBRACE","Expected '}' after object pattern"),{type:"object",fields:r}}let t=this.expect("IDENT","Expected variable name in pattern"),n=t.value;if(!n.startsWith("$"))throw new Error(`Variable name must start with $ at position ${t.pos}`);return{type:"var",name:n}}parsePatternField(){if(this.match("LPAREN")){let n=this.parseExpr();this.expect("RPAREN","Expected ')' after computed key"),this.expect("COLON","Expected ':' after computed key");let r=this.parsePattern();return{key:n,pattern:r}}let t=this.peek();if(t.type==="IDENT"||Ri.has(t.type)){let n=t.value;if(n.startsWith("$")){if(this.advance(),this.match("COLON")){let r=this.parsePattern();return{key:n.slice(1),pattern:r,keyVar:n}}return{key:n.slice(1),pattern:{type:"var",name:n}}}if(this.advance(),this.match("COLON")){let r=this.parsePattern();return{key:n,pattern:r}}return{key:n,pattern:{type:"var",name:`$${n}`}}}throw new Error(`Expected field name in object pattern at position ${t.pos}`)}parsePipe(){let t=this.parseComma();for(;this.match("PIPE");){let n=this.parseComma();t={type:"Pipe",left:t,right:n}}return t}parseComma(){let t=this.parseVarBind();for(;this.match("COMMA");){let n=this.parseVarBind();t={type:"Comma",left:t,right:n}}return t}parseVarBind(){let t=this.parseUpdate();if(this.match("AS")){let n=this.parsePattern(),r=[];for(;this.check("QUESTION")&&this.peekAhead(1)?.type==="ALT";)this.advance(),this.advance(),r.push(this.parsePattern());this.expect("PIPE","Expected '|' after variable binding");let s=this.parseExpr();return n.type==="var"&&r.length===0?{type:"VarBind",name:n.name,value:t,body:s}:{type:"VarBind",name:n.type==="var"?n.name:"",value:t,body:s,pattern:n.type!=="var"?n:void 0,alternatives:r.length>0?r:void 0}}return t}peekAhead(t){let n=this.pos+t;return n<this.tokens.length?this.tokens[n]:void 0}parseUpdate(){let t=this.parseAlt(),n=new Map([["ASSIGN","="],["UPDATE_ADD","+="],["UPDATE_SUB","-="],["UPDATE_MUL","*="],["UPDATE_DIV","/="],["UPDATE_MOD","%="],["UPDATE_ALT","//="],["UPDATE_PIPE","|="]]),r=this.match("ASSIGN","UPDATE_ADD","UPDATE_SUB","UPDATE_MUL","UPDATE_DIV","UPDATE_MOD","UPDATE_ALT","UPDATE_PIPE");if(r){let s=this.parseVarBind(),i=n.get(r.type);if(i)return{type:"UpdateOp",op:i,path:t,value:s}}return t}parseAlt(){let t=this.parseOr();for(;this.match("ALT");){let n=this.parseOr();t={type:"BinaryOp",op:"//",left:t,right:n}}return t}parseOr(){let t=this.parseAnd();for(;this.match("OR");){let n=this.parseAnd();t={type:"BinaryOp",op:"or",left:t,right:n}}return t}parseAnd(){let t=this.parseNot();for(;this.match("AND");){let n=this.parseNot();t={type:"BinaryOp",op:"and",left:t,right:n}}return t}parseNot(){return this.parseComparison()}parseComparison(){let t=this.parseAddSub(),n=new Map([["EQ","=="],["NE","!="],["LT","<"],["LE","<="],["GT",">"],["GE",">="]]),r=this.match("EQ","NE","LT","LE","GT","GE");if(r){let s=n.get(r.type);if(s){let i=this.parseAddSub();t={type:"BinaryOp",op:s,left:t,right:i}}}return t}parseAddSub(){let t=this.parseMulDiv();for(;;)if(this.match("PLUS")){let n=this.parseMulDiv();t={type:"BinaryOp",op:"+",left:t,right:n}}else if(this.match("MINUS")){let n=this.parseMulDiv();t={type:"BinaryOp",op:"-",left:t,right:n}}else break;return t}parseMulDiv(){let t=this.parseUnary();for(;;)if(this.match("STAR")){let n=this.parseUnary();t={type:"BinaryOp",op:"*",left:t,right:n}}else if(this.match("SLASH")){let n=this.parseUnary();t={type:"BinaryOp",op:"/",left:t,right:n}}else if(this.match("PERCENT")){let n=this.parseUnary();t={type:"BinaryOp",op:"%",left:t,right:n}}else break;return t}parseUnary(){return this.match("MINUS")?{type:"UnaryOp",op:"-",operand:this.parseUnary()}:this.parsePostfix()}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match("QUESTION"))t={type:"Optional",expr:t};else if(this.check("DOT")&&this.isFieldNameAfterDot())this.advance(),t={type:"Field",name:this.advance().value,base:t};else if(this.check("LBRACKET"))if(this.advance(),this.match("RBRACKET"))t={type:"Iterate",base:t};else if(this.check("COLON")){this.advance();let n=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),t={type:"Slice",end:n,base:t}}else{let n=this.parseExpr();if(this.match("COLON")){let r=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),t={type:"Slice",start:n,end:r,base:t}}else this.expect("RBRACKET","Expected ']'"),t={type:"Index",index:n,base:t}}else break;return t}parsePrimary(){if(this.match("DOTDOT"))return{type:"Recurse"};if(this.check("DOT")){let t=this.advance();if(this.check("LBRACKET")){if(this.advance(),this.match("RBRACKET"))return{type:"Iterate"};if(this.check("COLON")){this.advance();let s=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",end:s}}let r=this.parseExpr();if(this.match("COLON")){let s=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",start:r,end:s}}return this.expect("RBRACKET","Expected ']'"),{type:"Index",index:r}}let n=this.consumeFieldNameAfterDot(t);return n!==null?{type:"Field",name:n}:{type:"Identity"}}if(this.match("TRUE"))return{type:"Literal",value:!0};if(this.match("FALSE"))return{type:"Literal",value:!1};if(this.match("NULL"))return{type:"Literal",value:null};if(this.check("NUMBER"))return{type:"Literal",value:this.advance().value};if(this.check("STRING")){let n=this.advance().value;return n.includes("\\(")?this.parseStringInterpolation(n):{type:"Literal",value:n}}if(this.match("LBRACKET")){if(this.match("RBRACKET"))return{type:"Array"};let t=this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Array",elements:t}}if(this.match("LBRACE"))return this.parseObjectConstruction();if(this.match("LPAREN")){let t=this.parseExpr();return this.expect("RPAREN","Expected ')'"),{type:"Paren",expr:t}}if(this.match("IF"))return this.parseIf();if(this.match("TRY")){let t=this.parsePostfix(),n;return this.match("CATCH")&&(n=this.parsePostfix()),{type:"Try",body:t,catch:n}}if(this.match("REDUCE")){let t=this.parseAddSub();this.expect("AS","Expected 'as' after reduce expression");let n=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let r=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let s=this.parseExpr();this.expect("RPAREN","Expected ')' after update expression");let i=n.type==="var"?n.name:"";return{type:"Reduce",expr:t,varName:i,init:r,update:s,pattern:n.type!=="var"?n:void 0}}if(this.match("FOREACH")){let t=this.parseAddSub();this.expect("AS","Expected 'as' after foreach expression");let n=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let r=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let s=this.parseExpr(),i;this.match("SEMICOLON")&&(i=this.parseExpr()),this.expect("RPAREN","Expected ')' after expressions");let a=n.type==="var"?n.name:"";return{type:"Foreach",expr:t,varName:a,init:r,update:s,extract:i,pattern:n.type!=="var"?n:void 0}}if(this.match("LABEL")){let t=this.expect("IDENT","Expected label name (e.g., $out)"),n=t.value;if(!n.startsWith("$"))throw new Error(`Label name must start with $ at position ${t.pos}`);this.expect("PIPE","Expected '|' after label name");let r=this.parseExpr();return{type:"Label",name:n,body:r}}if(this.match("BREAK")){let t=this.expect("IDENT","Expected label name to break to"),n=t.value;if(!n.startsWith("$"))throw new Error(`Break label must start with $ at position ${t.pos}`);return{type:"Break",name:n}}if(this.match("DEF")){let n=this.expect("IDENT","Expected function name after def").value,r=[];if(this.match("LPAREN")){if(!this.check("RPAREN")){let a=this.expect("IDENT","Expected parameter name");for(r.push(a.value);this.match("SEMICOLON");){let o=this.expect("IDENT","Expected parameter name");r.push(o.value)}}this.expect("RPAREN","Expected ')' after parameters")}this.expect("COLON","Expected ':' after function name");let s=this.parseExpr();this.expect("SEMICOLON","Expected ';' after function body");let i=this.parseExpr();return{type:"Def",name:n,params:r,funcBody:s,body:i}}if(this.match("NOT"))return{type:"Call",name:"not",args:[]};if(this.check("IDENT")){let n=this.advance().value;if(n.startsWith("$"))return{type:"VarRef",name:n};if(this.match("LPAREN")){let r=[];if(!this.check("RPAREN"))for(r.push(this.parseExpr());this.match("SEMICOLON");)r.push(this.parseExpr());return this.expect("RPAREN","Expected ')'"),{type:"Call",name:n,args:r}}return{type:"Call",name:n,args:[]}}throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`)}parseObjectConstruction(){let t=[];if(!this.check("RBRACE"))do{let n,r;if(this.match("LPAREN"))n=this.parseExpr(),this.expect("RPAREN","Expected ')'"),this.expect("COLON","Expected ':'"),r=this.parseObjectValue();else if(this.isIdentLike()){let s=this.advance().value;this.match("COLON")?(n=s,r=this.parseObjectValue()):(n=s,r={type:"Field",name:s})}else if(this.check("STRING"))n=this.advance().value,this.expect("COLON","Expected ':'"),r=this.parseObjectValue();else throw new Error(`Expected object key at position ${this.peek().pos}`);t.push({key:n,value:r})}while(this.match("COMMA"));return this.expect("RBRACE","Expected '}'"),{type:"Object",entries:t}}parseObjectValue(){let t=this.parseVarBind();for(;this.match("PIPE");){let n=this.parseVarBind();t={type:"Pipe",left:t,right:n}}return t}parseIf(){let t=this.parseExpr();this.expect("THEN","Expected 'then'");let n=this.parseExpr(),r=[];for(;this.match("ELIF");){let i=this.parseExpr();this.expect("THEN","Expected 'then' after elif");let a=this.parseExpr();r.push({cond:i,then:a})}let s;return this.match("ELSE")&&(s=this.parseExpr()),this.expect("END","Expected 'end'"),{type:"Cond",cond:t,then:n,elifs:r,else:s}}parseStringInterpolation(t){let n=[],r="",s=0;for(;s<t.length;)if(t[s]==="\\"&&t[s+1]==="("){r&&(n.push(r),r=""),s+=2;let i=1,a="";for(;s<t.length&&i>0;)t[s]==="("?i++:t[s]===")"&&i--,i>0&&(a+=t[s]),s++;let o=zh(a),l=new e(o);n.push(l.parse())}else r+=t[s],s++;return r&&n.push(r),{type:"StringInterp",parts:n}}}});var Gh=I(()=>{"use strict";Bh();jh()});var qh={};K(qh,{flagsForFuzzing:()=>h5,jqCommand:()=>p5});function Vh(e){let t=[],n=0,r=e.length;for(;n<r;){for(;n<r&&/\s/.test(e[n]);)n++;if(n>=r)break;let s=n,i=e[n];if(i==="{"||i==="["){let a=i,o=i==="{"?"}":"]",l=1,c=!1,u=!1;for(n++;n<r&&l>0;){let f=e[n];u?u=!1:f==="\\"?u=!0:f==='"'?c=!c:c||(f===a?l++:f===o&&l--),n++}if(l!==0)throw new Error(`Unexpected end of JSON input at position ${n} (unclosed ${a})`);t.push(JSON.parse(e.slice(s,n)))}else if(i==='"'){let a=!1;for(n++;n<r;){let o=e[n];if(a)a=!1;else if(o==="\\")a=!0;else if(o==='"'){n++;break}n++}t.push(JSON.parse(e.slice(s,n)))}else if(i==="-"||i>="0"&&i<="9"){for(;n<r&&/[\d.eE+-]/.test(e[n]);)n++;t.push(JSON.parse(e.slice(s,n)))}else if(e.slice(n,n+4)==="true")t.push(!0),n+=4;else if(e.slice(n,n+5)==="false")t.push(!1),n+=5;else if(e.slice(n,n+4)==="null")t.push(null),n+=4;else{let a=e.slice(n,n+10);throw new Error(`Invalid JSON at position ${s}: unexpected '${a.split(/\s/)[0]}'`)}}return t}function As(e,t,n,r,s,i=0){if(e===null||e===void 0)return"null";if(typeof e=="boolean")return String(e);if(typeof e=="number")return Number.isFinite(e)?String(e):"null";if(typeof e=="string")return n?e:JSON.stringify(e);let a=s?" ":" ";if(Array.isArray(e))return e.length===0?"[]":t?`[${e.map(l=>As(l,!0,!1,r,s)).join(",")}]`:`[
@@ -571,10 +571,10 @@ ${a.repeat(i)}}`}return String(e)}var f5,p5,h5,Zh=I(()=>{"use strict";ye();Kn();
571
571
  `,exitCode:2}}try{l=u==="-"?t.stdin:await t.fs.readFile(t.fs.resolvePath(t.cwd,u))}catch{return{stdout:"",stderr:`diff: ${u}: No such file or directory
572
572
  `,exitCode:2}}let f=o,p=l;return i&&(f=f.toLowerCase(),p=p.toLowerCase()),f===p?s?{stdout:`Files ${c} and ${u} are identical
573
573
  `,stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0}:r?{stdout:`Files ${c} and ${u} differ
574
- `,stderr:"",exitCode:1}:{stdout:Yh.createTwoFilesPatch(c,u,o,l,"","",{context:3}),stderr:"",exitCode:1}}},E5={name:"diff",flags:[{flag:"-u",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2}});var td={};K(td,{dateCommand:()=>k5,flagsForFuzzing:()=>v5});function Ot(e,t=2){return String(e).padStart(t,"0")}function Ti(e,t,n){let r={Y:e.getUTCFullYear(),m:e.getUTCMonth(),D:e.getUTCDate(),H:e.getUTCHours(),M:e.getUTCMinutes(),S:e.getUTCSeconds(),w:e.getUTCDay()},s="",i=0;for(;i<t.length;){if(t[i]==="%"&&i+1<t.length){let a=t[++i];switch(a){case"%":s+="%";break;case"a":s+=S5[r.w];break;case"b":case"h":s+=C5[r.m];break;case"d":s+=Ot(r.D);break;case"e":s+=String(r.D).padStart(2," ");break;case"F":s+=`${r.Y}-${Ot(r.m+1)}-${Ot(r.D)}`;break;case"H":s+=Ot(r.H);break;case"I":s+=Ot(r.H%12||12);break;case"m":s+=Ot(r.m+1);break;case"M":s+=Ot(r.M);break;case"n":s+=`
575
- `;break;case"p":s+=r.H<12?"AM":"PM";break;case"P":s+=r.H<12?"am":"pm";break;case"R":s+=`${Ot(r.H)}:${Ot(r.M)}`;break;case"s":s+=Math.floor(e.getTime()/1e3);break;case"S":s+=Ot(r.S);break;case"t":s+=" ";break;case"T":s+=`${Ot(r.H)}:${Ot(r.M)}:${Ot(r.S)}`;break;case"u":s+=r.w||7;break;case"w":s+=r.w;break;case"y":s+=Ot(r.Y%100);break;case"Y":s+=r.Y;break;case"z":s+="+0000";break;case"Z":s+="UTC";break;default:s+=`%${a}`}}else s+=t[i];i++}return s}function N5(e){let t=new Date(e);if(!Number.isNaN(t.getTime()))return t;if(/^\d+$/.test(e))return new Date(Number.parseInt(e,10)*1e3);let n=e.toLowerCase();return n==="now"||n==="today"?new Date:n==="yesterday"?new Date(Date.now()-864e5):n==="tomorrow"?new Date(Date.now()+864e5):null}var A5,S5,C5,k5,v5,nd=I(()=>{"use strict";se();A5={name:"date",summary:"display the current time in the given FORMAT",usage:"date [OPTION]... [+FORMAT]",options:["-d, --date=STRING display time described by STRING","-u, --utc print Coordinated Universal Time (UTC)","-I, --iso-8601 output date/time in ISO 8601 format","-R, --rfc-email output RFC 5322 date format"," --help display this help and exit"]},S5=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],C5=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];k5={name:"date",async execute(e,t){if(U(e))return M(A5);let n=!1,r=null,s=null,i=!1,a=!1;for(let c=0;c<e.length;c++){let u=e[c];if(u==="-u"||u==="--utc")n=!0;else if(u==="-d"||u==="--date")r=e[++c]??"";else if(u.startsWith("--date="))r=u.slice(7);else if(u==="-I"||u==="--iso-8601")i=!0;else if(u==="-R"||u==="--rfc-email")a=!0;else if(u.startsWith("+"))s=u.slice(1);else{if(u.startsWith("--"))return Y("date",u);if(u.startsWith("-"))for(let f of u.slice(1))if(f==="u")n=!0;else if(f==="I")i=!0;else if(f==="R")a=!0;else return Y("date",`-${f}`)}}let o=r!==null?N5(r):new Date;if(!o)return{stdout:"",stderr:`date: invalid date '${r}'
574
+ `,stderr:"",exitCode:1}:{stdout:Yh.createTwoFilesPatch(c,u,o,l,"","",{context:3}),stderr:"",exitCode:1}}},E5={name:"diff",flags:[{flag:"-u",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2}});var td={};K(td,{dateCommand:()=>v5,flagsForFuzzing:()=>k5});function Ot(e,t=2){return String(e).padStart(t,"0")}function Ti(e,t,n){let r={Y:e.getUTCFullYear(),m:e.getUTCMonth(),D:e.getUTCDate(),H:e.getUTCHours(),M:e.getUTCMinutes(),S:e.getUTCSeconds(),w:e.getUTCDay()},s="",i=0;for(;i<t.length;){if(t[i]==="%"&&i+1<t.length){let a=t[++i];switch(a){case"%":s+="%";break;case"a":s+=S5[r.w];break;case"b":case"h":s+=C5[r.m];break;case"d":s+=Ot(r.D);break;case"e":s+=String(r.D).padStart(2," ");break;case"F":s+=`${r.Y}-${Ot(r.m+1)}-${Ot(r.D)}`;break;case"H":s+=Ot(r.H);break;case"I":s+=Ot(r.H%12||12);break;case"m":s+=Ot(r.m+1);break;case"M":s+=Ot(r.M);break;case"n":s+=`
575
+ `;break;case"p":s+=r.H<12?"AM":"PM";break;case"P":s+=r.H<12?"am":"pm";break;case"R":s+=`${Ot(r.H)}:${Ot(r.M)}`;break;case"s":s+=Math.floor(e.getTime()/1e3);break;case"S":s+=Ot(r.S);break;case"t":s+=" ";break;case"T":s+=`${Ot(r.H)}:${Ot(r.M)}:${Ot(r.S)}`;break;case"u":s+=r.w||7;break;case"w":s+=r.w;break;case"y":s+=Ot(r.Y%100);break;case"Y":s+=r.Y;break;case"z":s+="+0000";break;case"Z":s+="UTC";break;default:s+=`%${a}`}}else s+=t[i];i++}return s}function N5(e){let t=new Date(e);if(!Number.isNaN(t.getTime()))return t;if(/^\d+$/.test(e))return new Date(Number.parseInt(e,10)*1e3);let n=e.toLowerCase();return n==="now"||n==="today"?new Date:n==="yesterday"?new Date(Date.now()-864e5):n==="tomorrow"?new Date(Date.now()+864e5):null}var A5,S5,C5,v5,k5,nd=I(()=>{"use strict";se();A5={name:"date",summary:"display the current time in the given FORMAT",usage:"date [OPTION]... [+FORMAT]",options:["-d, --date=STRING display time described by STRING","-u, --utc print Coordinated Universal Time (UTC)","-I, --iso-8601 output date/time in ISO 8601 format","-R, --rfc-email output RFC 5322 date format"," --help display this help and exit"]},S5=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],C5=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];v5={name:"date",async execute(e,t){if(U(e))return M(A5);let n=!1,r=null,s=null,i=!1,a=!1;for(let c=0;c<e.length;c++){let u=e[c];if(u==="-u"||u==="--utc")n=!0;else if(u==="-d"||u==="--date")r=e[++c]??"";else if(u.startsWith("--date="))r=u.slice(7);else if(u==="-I"||u==="--iso-8601")i=!0;else if(u==="-R"||u==="--rfc-email")a=!0;else if(u.startsWith("+"))s=u.slice(1);else{if(u.startsWith("--"))return Y("date",u);if(u.startsWith("-"))for(let f of u.slice(1))if(f==="u")n=!0;else if(f==="I")i=!0;else if(f==="R")a=!0;else return Y("date",`-${f}`)}}let o=r!==null?N5(r):new Date;if(!o)return{stdout:"",stderr:`date: invalid date '${r}'
576
576
  `,exitCode:1};let l;return s?l=Ti(o,s,n):i?l=Ti(o,"%Y-%m-%dT%H:%M:%S%z",n):a?l=Ti(o,"%a, %d %b %Y %H:%M:%S %z",n):l=Ti(o,"%a %b %e %H:%M:%S %Z %Y",n),{stdout:`${l}
577
- `,stderr:"",exitCode:0}}},v5={name:"date",flags:[{flag:"-d",type:"value",valueHint:"string"},{flag:"-u",type:"boolean"},{flag:"-I",type:"boolean"},{flag:"-R",type:"boolean"}]}});var rd={};K(rd,{flagsForFuzzing:()=>R5,sleepCommand:()=>O5});function $5(e){let t=e.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!t)return null;let n=parseFloat(t[1]);switch(t[2]||"s"){case"s":return n*1e3;case"m":return n*60*1e3;case"h":return n*60*60*1e3;case"d":return n*24*60*60*1e3;default:return null}}var I5,O5,R5,sd=I(()=>{"use strict";se();I5={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be:
577
+ `,stderr:"",exitCode:0}}},k5={name:"date",flags:[{flag:"-d",type:"value",valueHint:"string"},{flag:"-u",type:"boolean"},{flag:"-I",type:"boolean"},{flag:"-R",type:"boolean"}]}});var rd={};K(rd,{flagsForFuzzing:()=>R5,sleepCommand:()=>O5});function $5(e){let t=e.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!t)return null;let n=parseFloat(t[1]);switch(t[2]||"s"){case"s":return n*1e3;case"m":return n*60*1e3;case"h":return n*60*60*1e3;case"d":return n*24*60*60*1e3;default:return null}}var I5,O5,R5,sd=I(()=>{"use strict";se();I5={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be:
578
578
  s - seconds (default)
579
579
  m - minutes
580
580
  h - hours
@@ -619,12 +619,12 @@ sys 0.00
619
619
  `,x||f++}}return f>0&&(p+=`${e}: WARNING: ${f} computed checksum${f>1?"s":""} did NOT match
620
620
  `),{stdout:p,stderr:"",exitCode:f>0?1:0}}let c="",u=0;for(let f of o){let p=await l(f);if(p===null){c+=`${e}: ${f}: No such file or directory
621
621
  `,u=1;continue}c+=`${await hd(t,p)} ${f}
622
- `}return{stdout:c,stderr:"",exitCode:u}}}}var j5,Pi=I(()=>{"use strict";se();j5=new Map([["sha1","SHA-1"],["sha256","SHA-256"]])});var dd={};K(dd,{flagsForFuzzing:()=>q5,md5sumCommand:()=>V5});var V5,q5,md=I(()=>{"use strict";Pi();V5=_r("md5sum","md5","compute MD5 message digest"),q5={name:"md5sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var gd={};K(gd,{flagsForFuzzing:()=>K5,sha1sumCommand:()=>Z5});var Z5,K5,yd=I(()=>{"use strict";Pi();Z5=_r("sha1sum","sha1","compute SHA1 message digest"),K5={name:"sha1sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var wd={};K(wd,{flagsForFuzzing:()=>X5,sha256sumCommand:()=>Q5});var Q5,X5,bd=I(()=>{"use strict";Pi();Q5=_r("sha256sum","sha256","compute SHA256 message digest"),X5={name:"sha256sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var xd=Gs(il=>{il.read=function(e,t,n,r,s){var i,a,o=s*8-r-1,l=(1<<o)-1,c=l>>1,u=-7,f=n?s-1:0,p=n?-1:1,h=e[t+f];for(f+=p,i=h&(1<<-u)-1,h>>=-u,u+=o;u>0;i=i*256+e[t+f],f+=p,u-=8);for(a=i&(1<<-u)-1,i>>=-u,u+=r;u>0;a=a*256+e[t+f],f+=p,u-=8);if(i===0)i=1-c;else{if(i===l)return a?NaN:(h?-1:1)*(1/0);a=a+Math.pow(2,r),i=i-c}return(h?-1:1)*a*Math.pow(2,i-r)};il.write=function(e,t,n,r,s,i){var a,o,l,c=i*8-s-1,u=(1<<c)-1,f=u>>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,m=r?1:-1,d=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+f>=1?t+=p/l:t+=p*Math.pow(2,1-f),t*l>=2&&(a++,l/=2),a+f>=u?(o=0,a=u):a+f>=1?(o=(t*l-1)*Math.pow(2,s),a=a+f):(o=t*Math.pow(2,f-1)*Math.pow(2,s),a=0));s>=8;e[n+h]=o&255,h+=m,o/=256,s-=8);for(a=a<<s|o,c+=s;c>0;e[n+h]=a&255,h+=m,a/=256,c-=8);e[n+h-m]|=d*128}});function Ed(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":return typeof globalThis.TextDecoder<"u"?new globalThis.TextDecoder("utf-8").decode(e):J5(e);case"utf-16le":return ew(e);case"ascii":return tw(e);case"latin1":case"iso-8859-1":return nw(e);case"windows-1252":return rw(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function J5(e){let t="",n=0;for(;n<e.length;){let r=e[n++];if(r<128)t+=String.fromCharCode(r);else if(r<224){let s=e[n++]&63;t+=String.fromCharCode((r&31)<<6|s)}else if(r<240){let s=e[n++]&63,i=e[n++]&63;t+=String.fromCharCode((r&15)<<12|s<<6|i)}else{let s=e[n++]&63,i=e[n++]&63,a=e[n++]&63,o=(r&7)<<18|s<<12|i<<6|a;o-=65536,t+=String.fromCharCode(55296+(o>>10&1023),56320+(o&1023))}}return t}function ew(e){let t="";for(let n=0;n<e.length;n+=2)t+=String.fromCharCode(e[n]|e[n+1]<<8);return t}function tw(e){return String.fromCharCode(...e.map(t=>t&127))}function nw(e){return String.fromCharCode(...e)}function rw(e){let t="";for(let n of e)n>=128&&n<=159&&al[n]?t+=al[n]:t+=String.fromCharCode(n);return t}var al,Y5,Ad=I(()=>{al={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"},Y5={};for(let[e,t]of Object.entries(al))Y5[t]=Number.parseInt(e)});function Rt(e){return new DataView(e.buffer,e.byteOffset)}var Sd,Cd,Ve,Lr,Qe,Nd,kd,vd,Tt,Ss=I(()=>{Sd=wu(xd(),1);Ad();Cd={len:1,get(e,t){return Rt(e).getUint8(t)},put(e,t,n){return Rt(e).setUint8(t,n),t+1}},Ve={len:2,get(e,t){return Rt(e).getUint16(t,!0)},put(e,t,n){return Rt(e).setUint16(t,n,!0),t+2}},Lr={len:2,get(e,t){return Rt(e).getUint16(t)},put(e,t,n){return Rt(e).setUint16(t,n),t+2}},Qe={len:4,get(e,t){return Rt(e).getUint32(t,!0)},put(e,t,n){return Rt(e).setUint32(t,n,!0),t+4}},Nd={len:4,get(e,t){return Rt(e).getUint32(t)},put(e,t,n){return Rt(e).setUint32(t,n),t+4}},kd={len:4,get(e,t){return Rt(e).getInt32(t)},put(e,t,n){return Rt(e).setInt32(t,n),t+4}},vd={len:8,get(e,t){return Rt(e).getBigUint64(t,!0)},put(e,t,n){return Rt(e).setBigUint64(t,n,!0),t+8}},Tt=class{constructor(t,n){this.len=t,this.encoding=n}get(t,n=0){let r=t.subarray(n,n+this.len);return Ed(r,this.encoding)}}});var iw,Be,tr,Cs=I(()=>{iw="End-Of-Stream",Be=class extends Error{constructor(){super(iw),this.name="EndOfStreamError"}},tr=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}});var Id=I(()=>{});var nr,Di=I(()=>{Cs();nr=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,n=!1){let r=await this.read(t,n);return this.peekQueue.push(t.subarray(0,r)),r}async read(t,n=!1){if(t.length===0)return 0;let r=this.readFromPeekBuffer(t);if(this.endOfStream||(r+=await this.readRemainderFromStream(t.subarray(r),n)),r===0&&!n)throw new Be;return r}readFromPeekBuffer(t){let n=t.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);t.set(s.subarray(0,i),r),r+=i,n-=i,i<s.length&&this.peekQueue.push(s.subarray(i))}return r}async readRemainderFromStream(t,n){let r=0;for(;r<t.length&&!this.endOfStream;){if(this.interrupted)throw new tr;let s=await this.readFromStream(t.subarray(r),n);if(s===0)break;r+=s}if(!n&&r<t.length)throw new Be;return r}}});var $d=I(()=>{Cs();Id();Di()});var _i,Od=I(()=>{Di();_i=class extends nr{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var Ns,ol=I(()=>{Od();Ns=class extends _i{async readFromStream(t,n){if(t.length===0)return 0;let r=await this.reader.read(new Uint8Array(t.length),{min:n?void 0:t.length});return r.done&&(this.endOfStream=r.done),r.value?(t.set(r.value),r.value.length):0}}});var Fr,ll=I(()=>{Cs();Di();Fr=class extends nr{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,n){let r=Math.min(n.length,t.length);return t.set(n.subarray(0,r)),r<n.length?this.buffer=n.subarray(r):this.buffer=null,r}async readFromStream(t,n){if(t.length===0)return 0;let r=0;for(this.buffer&&(r+=this.writeChunk(t,this.buffer));r<t.length&&!this.endOfStream;){let s=await this.reader.read();if(s.done){this.endOfStream=!0;break}s.value&&(r+=this.writeChunk(t.subarray(r),s.value))}if(!n&&r===0&&this.endOfStream)throw new Be;return r}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}});function cl(e){try{let t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new Fr(t):new Ns(t)}catch(t){if(t instanceof TypeError)return new Fr(e.getReader());throw t}}var Rd=I(()=>{ol();ll()});var rr=I(()=>{Cs();$d();ol();ll();Rd()});var kn,ks=I(()=>{rr();kn=class{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t?.onClose,t?.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,n=this.position){let r=new Uint8Array(t.len);if(await this.readBuffer(r,{position:n})<t.len)throw new Be;return t.get(r,0)}async peekToken(t,n=this.position){let r=new Uint8Array(t.len);if(await this.peekBuffer(r,{position:n})<t.len)throw new Be;return t.get(r,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new Be;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new Be;return t.get(this.numBuffer,0)}async ignore(t){if(this.fileInfo.size!==void 0){let n=this.fileInfo.size-this.position;if(t>n)return this.position+=n,n}return this.position+=t,t}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(t,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:t.length,position:this.position,...n}}abort(){return Promise.resolve()}}});var ow,Li,Td=I(()=>{ks();rr();ow=256e3,Li=class extends kn{constructor(t,n){super(n),this.streamReader=t,this.fileInfo=n?.fileInfo??{}}async readBuffer(t,n){let r=this.normalizeOptions(t,n),s=r.position-this.position;if(s>0)return await this.ignore(s),this.readBuffer(t,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(t.subarray(0,r.length),r.mayBeLess);if(this.position+=i,(!n||!n.mayBeLess)&&i<r.length)throw new Be;return i}async peekBuffer(t,n){let r=this.normalizeOptions(t,n),s=0;if(r.position){let i=r.position-this.position;if(i>0){let a=new Uint8Array(r.length+i);return s=await this.peekBuffer(a,{mayBeLess:r.mayBeLess}),t.set(a.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(t.subarray(0,r.length),r.mayBeLess)}catch(i){if(n?.mayBeLess&&i instanceof Be)return 0;throw i}if(!r.mayBeLess&&s<r.length)throw new Be}return s}async ignore(t){let n=Math.min(ow,t),r=new Uint8Array(n),s=0;for(;s<t;){let i=t-s,a=await this.readBuffer(r,{length:Math.min(n,i)});if(a<0)return a;s+=a}return s}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}});var Fi,Pd=I(()=>{rr();ks();Fi=class extends kn{constructor(t,n){super(n),this.uint8Array=t,this.fileInfo={...n?.fileInfo??{},size:t.length}}async readBuffer(t,n){n?.position&&(this.position=n.position);let r=await this.peekBuffer(t,n);return this.position+=r,r}async peekBuffer(t,n){let r=this.normalizeOptions(t,n),s=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&s<r.length)throw new Be;return t.set(this.uint8Array.subarray(r.position,r.position+s)),s}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}});var Mi,Dd=I(()=>{rr();ks();Mi=class extends kn{constructor(t,n){super(n),this.blob=t,this.fileInfo={...n?.fileInfo??{},size:t.size,mimeType:t.type}}async readBuffer(t,n){n?.position&&(this.position=n.position);let r=await this.peekBuffer(t,n);return this.position+=r,r}async peekBuffer(t,n){let r=this.normalizeOptions(t,n),s=Math.min(this.blob.size-r.position,r.length);if(!r.mayBeLess&&s<r.length)throw new Be;let i=await this.blob.slice(r.position,r.position+s).arrayBuffer();return t.set(new Uint8Array(i)),s}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}});function _d(e,t){let n=cl(e),r=t??{},s=r.onClose;return r.onClose=async()=>{if(await n.close(),s)return s()},new Li(n,r)}function Ld(e,t){return new Fi(e,t)}function Fd(e,t){return new Mi(e,t)}var Md=I(()=>{rr();Td();Pd();Dd();rr();ks()});var Bd=Gs(($I,Ud)=>{var Mr=1e3,Ur=Mr*60,Br=Ur*60,sr=Br*24,cw=sr*7,uw=sr*365.25;Ud.exports=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return fw(e);if(n==="number"&&isFinite(e))return t.long?hw(e):pw(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function fw(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*uw;case"weeks":case"week":case"w":return n*cw;case"days":case"day":case"d":return n*sr;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Br;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ur;case"seconds":case"second":case"secs":case"sec":case"s":return n*Mr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function pw(e){var t=Math.abs(e);return t>=sr?Math.round(e/sr)+"d":t>=Br?Math.round(e/Br)+"h":t>=Ur?Math.round(e/Ur)+"m":t>=Mr?Math.round(e/Mr)+"s":e+"ms"}function hw(e){var t=Math.abs(e);return t>=sr?Ui(e,t,sr,"day"):t>=Br?Ui(e,t,Br,"hour"):t>=Ur?Ui(e,t,Ur,"minute"):t>=Mr?Ui(e,t,Mr,"second"):e+" ms"}function Ui(e,t,n,r){var s=t>=n*1.5;return Math.round(e/n)+" "+r+(s?"s":"")}});var zd=Gs((OI,Wd)=>{function dw(e){n.debug=n,n.default=n,n.coerce=l,n.disable=a,n.enable=s,n.enabled=o,n.humanize=Bd(),n.destroy=c,Object.keys(e).forEach(u=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let f=0;for(let p=0;p<u.length;p++)f=(f<<5)-f+u.charCodeAt(p),f|=0;return n.colors[Math.abs(f)%n.colors.length]}n.selectColor=t;function n(u){let f,p=null,h,m;function d(...g){if(!d.enabled)return;let w=d,y=Number(new Date),b=y-(f||y);w.diff=b,w.prev=f,w.curr=y,f=y,g[0]=n.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let x=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,($,O)=>{if($==="%%")return"%";x++;let L=n.formatters[O];if(typeof L=="function"){let R=g[x];$=L.call(w,R),g.splice(x,1),x--}return $}),n.formatArgs.call(w,g),(w.log||n.log).apply(w,g)}return d.namespace=u,d.useColors=n.useColors(),d.color=n.selectColor(u),d.extend=r,d.destroy=n.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(h!==n.namespaces&&(h=n.namespaces,m=n.enabled(u)),m),set:g=>{p=g}}),typeof n.init=="function"&&n.init(d),d}function r(u,f){let p=n(this.namespace+(typeof f>"u"?":":f)+u);return p.log=this.log,p}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 p of f)p[0]==="-"?n.skips.push(p.slice(1)):n.names.push(p)}function i(u,f){let p=0,h=0,m=-1,d=0;for(;p<u.length;)if(h<f.length&&(f[h]===u[p]||f[h]==="*"))f[h]==="*"?(m=h,d=p,h++):(p++,h++);else if(m!==-1)h=m+1,d++,p=d;else return!1;for(;h<f.length&&f[h]==="*";)h++;return h===f.length}function a(){let u=[...n.names,...n.skips.map(f=>"-"+f)].join(",");return n.enable(""),u}function o(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}Wd.exports=dw});var Hd=Gs((Pt,Bi)=>{Pt.formatArgs=gw;Pt.save=yw;Pt.load=ww;Pt.useColors=mw;Pt.storage=bw();Pt.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})();Pt.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 mw(){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 e;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&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function gw(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Bi.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let n=0,r=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(n++,s==="%c"&&(r=n))}),e.splice(r,0,t)}Pt.log=console.debug||console.log||(()=>{});function yw(e){try{e?Pt.storage.setItem("debug",e):Pt.storage.removeItem("debug")}catch{}}function ww(){let e;try{e=Pt.storage.getItem("debug")||Pt.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function bw(){try{return localStorage}catch{}}Bi.exports=zd()(Pt);var{formatters:xw}=Bi.exports;xw.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var ir,ul,jd,Gd,Vd,qd=I(()=>{Ss();ir={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},ul={get(e){return{signature:Qe.get(e,0),compressedSize:Qe.get(e,8),uncompressedSize:Qe.get(e,12)}},len:16},jd={get(e){let t=Ve.get(e,6);return{signature:Qe.get(e,0),minVersion:Ve.get(e,4),dataDescriptor:!!(t&8),compressedMethod:Ve.get(e,8),compressedSize:Qe.get(e,18),uncompressedSize:Qe.get(e,22),filenameLength:Ve.get(e,26),extraFieldLength:Ve.get(e,28),filename:null}},len:30},Gd={get(e){return{signature:Qe.get(e,0),nrOfThisDisk:Ve.get(e,4),nrOfThisDiskWithTheStart:Ve.get(e,6),nrOfEntriesOnThisDisk:Ve.get(e,8),nrOfEntriesOfSize:Ve.get(e,10),sizeOfCd:Qe.get(e,12),offsetOfStartOfCd:Qe.get(e,16),zipFileCommentLength:Ve.get(e,20)}},len:22},Vd={get(e){let t=Ve.get(e,8);return{signature:Qe.get(e,0),minVersion:Ve.get(e,6),dataDescriptor:!!(t&8),compressedMethod:Ve.get(e,10),compressedSize:Qe.get(e,20),uncompressedSize:Qe.get(e,24),filenameLength:Ve.get(e,28),extraFieldLength:Ve.get(e,30),fileCommentLength:Ve.get(e,32),relativeOffsetOfLocalHeader:Qe.get(e,42),filename:null}},len:46}});function Kd(e){let t=new Uint8Array(Qe.len);return Qe.put(t,0,e),t}function Aw(e,t){let n=e.length,r=t.length;if(r>n)return-1;for(let s=0;s<=n-r;s++){let i=!0;for(let a=0;a<r;a++)if(e[s+a]!==t[a]){i=!1;break}if(i)return s}return-1}function Sw(e){let t=e.reduce((s,i)=>s+i.length,0),n=new Uint8Array(t),r=0;for(let s of e)n.set(s,r),r+=s.length;return n}var Zd,gn,fl,Ew,Wi,vs,Qd=I(()=>{Ss();Zd=wu(Hd(),1);qd();gn=(0,Zd.default)("tokenizer:inflate"),fl=256*1024,Ew=Kd(ir.DataDescriptor),Wi=Kd(ir.EndOfCentralDirectory),vs=class e{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(fl)}async isZip(){return await this.peekSignature()===ir.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Qe)}async findEndOfCentralDirectoryLocator(){let t=this.tokenizer,n=Math.min(16*1024,t.fileInfo.size),r=this.syncBuffer.subarray(0,n);await this.tokenizer.readBuffer(r,{position:t.fileInfo.size-n});for(let s=r.length-4;s>=0;s--)if(r[s]===Wi[0]&&r[s+1]===Wi[1]&&r[s+2]===Wi[2]&&r[s+3]===Wi[3])return t.fileInfo.size-n+s;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){gn("Cannot reading central-directory without random-read support");return}gn("Reading central-directory...");let t=this.tokenizer.position,n=await this.findEndOfCentralDirectoryLocator();if(n>0){gn("Central-directory 32-bit signature found");let r=await this.tokenizer.readToken(Gd,n),s=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let i=0;i<r.nrOfEntriesOfSize;++i){let a=await this.tokenizer.readToken(Vd);if(a.signature!==ir.CentralFileHeader)throw new Error("Expected Central-File-Header signature");a.filename=await this.tokenizer.readToken(new Tt(a.filenameLength,"utf-8")),await this.tokenizer.ignore(a.extraFieldLength),await this.tokenizer.ignore(a.fileCommentLength),s.push(a),gn(`Add central-directory file-entry: n=${i+1}/${s.length}: filename=${s[i].filename}`)}return this.tokenizer.setPosition(t),s}this.tokenizer.setPosition(t)}async unzip(t){let n=await this.readCentralDirectory();if(n)return this.iterateOverCentralDirectory(n,t);let r=!1;do{let s=await this.readLocalFileHeader();if(!s)break;let i=t(s);r=!!i.stop;let a;if(await this.tokenizer.ignore(s.extraFieldLength),s.dataDescriptor&&s.compressedSize===0){let o=[],l=fl;gn("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let c=-1;for(;c<0&&l===fl;){l=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),c=Aw(this.syncBuffer.subarray(0,l),Ew);let u=c>=0?c:l;if(i.handler){let f=new Uint8Array(u);await this.tokenizer.readBuffer(f),o.push(f)}else await this.tokenizer.ignore(u)}gn(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),i.handler&&await this.inflate(s,Sw(o),i.handler)}else i.handler?(gn(`Reading compressed-file-data: ${s.compressedSize} bytes`),a=new Uint8Array(s.compressedSize),await this.tokenizer.readBuffer(a),await this.inflate(s,a,i.handler)):(gn(`Ignoring compressed-file-data: ${s.compressedSize} bytes`),await this.tokenizer.ignore(s.compressedSize));if(gn(`Reading data-descriptor at pos=${this.tokenizer.position}`),s.dataDescriptor&&(await this.tokenizer.readToken(ul)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-ul.len}`)}while(!r)}async iterateOverCentralDirectory(t,n){for(let r of t){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 a=new Uint8Array(r.compressedSize);await this.tokenizer.readBuffer(a),await this.inflate(i,a,s.handler)}}if(s.stop)break}}async inflate(t,n,r){if(t.compressedMethod===0)return r(n);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);gn(`Decompress filename=${t.filename}, compressed-size=${n.length}`);let s=await e.decompressDeflateRaw(n);return r(s)}static async decompressDeflateRaw(t){let n=new ReadableStream({start(i){i.enqueue(t),i.close()}}),r=new DecompressionStream("deflate-raw"),s=n.pipeThrough(r);try{let a=await new Response(s).arrayBuffer();return new Uint8Array(a)}catch(i){let a=i instanceof Error?`Failed to deflate ZIP entry: ${i.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(a)}}async readLocalFileHeader(){let t=await this.tokenizer.peekToken(Qe);if(t===ir.LocalFileHeader){let n=await this.tokenizer.readToken(jd);return n.filename=await this.tokenizer.readToken(new Tt(n.filenameLength,"utf-8")),n}if(t===ir.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var Is,Xd=I(()=>{Is=class{constructor(t){this.tokenizer=t}inflate(){let t=this.tokenizer;return new ReadableStream({async pull(n){let r=new Uint8Array(1024),s=await t.readBuffer(r,{mayBeLess:!0});if(s===0){n.close();return}n.enqueue(r.subarray(0,s))}}).pipeThrough(new DecompressionStream("gzip"))}}});var Yd=I(()=>{Qd();Xd()});function pl(e){let{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}var BI,WI,zI,Jd=I(()=>{BI={utf8:new globalThis.TextDecoder("utf8")},WI=new globalThis.TextEncoder,zI=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"))});function e0(e,t){if(t==="utf-16le"){let n=[];for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);n.push(s&255,s>>8&255)}return n}if(t==="utf-16be"){let n=[];for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);n.push(s>>8&255,s&255)}return n}return[...e].map(n=>n.charCodeAt(0))}function t0(e,t=0){let n=Number.parseInt(new Tt(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(n))return!1;let r=256;for(let s=t;s<t+148;s++)r+=e[s];for(let s=t+156;s<t+512;s++)r+=e[s];return n===r}var n0,r0=I(()=>{Ss();n0={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4}});var s0,i0,a0=I(()=>{s0=["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"],i0=["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 o0(e,t){return new ml(t).fromBuffer(e)}function dl(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};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:e};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:e};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:e};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:e};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:e};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 yn(e,t,n){n={offset:0,...n};for(let[r,s]of t.entries())if(n.mask){if(s!==(n.mask[r]&e[r+n.offset]))return!1}else if(s!==e[r+n.offset])return!1;return!0}var hl,ml,XI,YI,l0=I(()=>{Ss();Md();Yd();Jd();r0();a0();hl=4100;ml=class{constructor(t){this.options={mpegOffsetTolerance:0,...t},this.detectors=[...t?.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:t?.signal}}async fromTokenizer(t){let n=t.position;for(let r of this.detectors){let s=await r.detect(t);if(s)return s;if(n!==t.position)return}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);let n=t instanceof Uint8Array?t:new Uint8Array(t);if(n?.length>1)return this.fromTokenizer(Ld(n,this.tokenizerOptions))}async fromBlob(t){let n=Fd(t,this.tokenizerOptions);try{return await this.fromTokenizer(n)}finally{await n.close()}}async fromStream(t){let n=_d(t,this.tokenizerOptions);try{return await this.fromTokenizer(n)}finally{await n.close()}}async toDetectionStream(t,n){let{sampleSize:r=hl}=n,s,i,a=t.getReader({mode:"byob"});try{let{value:c,done:u}=await a.read(new Uint8Array(r));if(i=c,!u&&c)try{s=await this.fromBuffer(c.subarray(0,r))}catch(f){if(!(f instanceof Be))throw f;s=void 0}i=c}finally{a.releaseLock()}let o=new TransformStream({async start(c){c.enqueue(i)},transform(c,u){u.enqueue(c)}}),l=t.pipeThrough(o);return l.fileType=s,l}check(t,n){return yn(this.buffer,t,n)}checkString(t,n){return this.check(e0(t,n?.encoding),n)}detectConfident=async t=>{if(this.buffer=new Uint8Array(hl),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,await t.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 t.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(t);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 Is(t).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 t.ignore(6);let n=await t.readToken(n0);return t.position+n>t.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await t.ignore(n),this.fromTokenizer(t))}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 vs(t).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=dl(i)},stop:!0};case"[Content_Types].xml":return{async handler(s){let i=new TextDecoder("utf-8").decode(s),a=i.indexOf('.main+xml"');if(a===-1){let o="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";i.includes(`ContentType="${o}"`)&&(n=dl(o))}else{i=i.slice(0,Math.max(0,a));let o=i.lastIndexOf('"'),l=i.slice(Math.max(0,o+1));n=dl(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 Be))throw r}),n??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await t.ignore(28);let n=new Uint8Array(8);return await t.readBuffer(n),yn(n,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:yn(n,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:yn(n,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:yn(n,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:yn(n,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:yn(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 o=await t.peekNumber(Cd),l=128,c=0;for(;(o&l)===0&&l!==0;)++c,l>>=1;let u=new Uint8Array(c+1);return await t.readBuffer(u),u}async function r(){let o=await n(),l=await n();l[0]^=128>>l.length-1;let c=Math.min(6,l.length),u=new DataView(o.buffer),f=new DataView(l.buffer,l.length-c,c);return{id:pl(u),len:pl(f)}}async function s(o){for(;o>0;){let l=await r();if(l.id===17026)return(await t.readToken(new Tt(l.len))).replaceAll(/\00.*$/g,"");await t.ignore(l.len),--o}}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 Tt(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 t.ignore(8),await t.readToken(new Tt(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
623
- `,"\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 t.ignore(8);async function n(){return{length:await t.readToken(kd),type:await t.readToken(new Tt(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 t.ignore(r.length+4)}}while(t.position+8<t.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 Tt(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
624
- `))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 t.readBuffer(r),{id:r,size:Number(await t.readToken(vd))}}for(await t.ignore(30);t.position+24<t.fileInfo.size;){let r=await n(),s=r.size-24;if(yn(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 t.readBuffer(i),yn(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(yn(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 t.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 t.ignore(20),await t.readToken(new Tt(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 t.peekBuffer(this.buffer,{length:Math.min(256,t.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 t.peekBuffer(this.buffer,{length:Math.min(512,t.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})&&t0(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
625
- `,{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 t=>{if(this.buffer=new Uint8Array(hl),await t.peekBuffer(this.buffer,{length:Math.min(8,t.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 t.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,t.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(t){let n=await this.tokenizer.readToken(t?Lr:Ve);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(t){let n=await this.tokenizer.readToken(t?Lr:Ve);for(let r=0;r<n;++r){let s=await this.readTiffTag(t);if(s)return s}}async readTiffHeader(t){let n=(t?Lr:Ve).get(this.buffer,2),r=(t?Nd:Qe).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=(t?Lr:Ve).get(this.buffer,8),a=(t?Lr:Ve).get(this.buffer,10);if(i===28&&a===254||i===31&&a===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}return await this.tokenizer.ignore(r),await this.readTiffIFD(t)??{ext:"tif",mime:"image/tiff"}}if(n===43)return{ext:"tif",mime:"image/tiff"}}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},XI=new Set(s0),YI=new Set(i0)});var c0={};K(c0,{fileCommand:()=>Rw,flagsForFuzzing:()=>Tw});function vw(e,t){let n=kw.get(e);if(n)return n;let[r,s]=t.split("/"),i=s?.split("+")[0]?.replace(/-/g," ")||e;switch(r){case"image":return`${i.toUpperCase()} image data`;case"audio":return`${i.toUpperCase()} audio`;case"video":return`${i.toUpperCase()} video`;case"font":return`${i} font`;case"model":return`${i} 3D model`;case"application":return s?.includes("zip")||s?.includes("compressed")?`${i} archive data`:s?.includes("executable")?`${i} executable`:`${e.toUpperCase()} data`;default:return`${e.toUpperCase()} data`}}function Iw(e){let t=e.split("/").pop()||e;if(t.startsWith(".")&&!t.includes(".",1))return t;let n=t.lastIndexOf(".");return n===-1||n===0?"":t.slice(n).toLowerCase()}function $w(e,t){if(e.startsWith("#!")){let c=e.split(`
622
+ `}return{stdout:c,stderr:"",exitCode:u}}}}var j5,Pi=I(()=>{"use strict";se();j5=new Map([["sha1","SHA-1"],["sha256","SHA-256"]])});var dd={};K(dd,{flagsForFuzzing:()=>q5,md5sumCommand:()=>V5});var V5,q5,md=I(()=>{"use strict";Pi();V5=_r("md5sum","md5","compute MD5 message digest"),q5={name:"md5sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var gd={};K(gd,{flagsForFuzzing:()=>K5,sha1sumCommand:()=>Z5});var Z5,K5,yd=I(()=>{"use strict";Pi();Z5=_r("sha1sum","sha1","compute SHA1 message digest"),K5={name:"sha1sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var wd={};K(wd,{flagsForFuzzing:()=>X5,sha256sumCommand:()=>Q5});var Q5,X5,bd=I(()=>{"use strict";Pi();Q5=_r("sha256sum","sha256","compute SHA256 message digest"),X5={name:"sha256sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var xd=Gs(il=>{il.read=function(e,t,n,r,s){var i,a,o=s*8-r-1,l=(1<<o)-1,c=l>>1,u=-7,f=n?s-1:0,p=n?-1:1,h=e[t+f];for(f+=p,i=h&(1<<-u)-1,h>>=-u,u+=o;u>0;i=i*256+e[t+f],f+=p,u-=8);for(a=i&(1<<-u)-1,i>>=-u,u+=r;u>0;a=a*256+e[t+f],f+=p,u-=8);if(i===0)i=1-c;else{if(i===l)return a?NaN:(h?-1:1)*(1/0);a=a+Math.pow(2,r),i=i-c}return(h?-1:1)*a*Math.pow(2,i-r)};il.write=function(e,t,n,r,s,i){var a,o,l,c=i*8-s-1,u=(1<<c)-1,f=u>>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,m=r?1:-1,d=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+f>=1?t+=p/l:t+=p*Math.pow(2,1-f),t*l>=2&&(a++,l/=2),a+f>=u?(o=0,a=u):a+f>=1?(o=(t*l-1)*Math.pow(2,s),a=a+f):(o=t*Math.pow(2,f-1)*Math.pow(2,s),a=0));s>=8;e[n+h]=o&255,h+=m,o/=256,s-=8);for(a=a<<s|o,c+=s;c>0;e[n+h]=a&255,h+=m,a/=256,c-=8);e[n+h-m]|=d*128}});function Ed(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":return typeof globalThis.TextDecoder<"u"?new globalThis.TextDecoder("utf-8").decode(e):J5(e);case"utf-16le":return ew(e);case"ascii":return tw(e);case"latin1":case"iso-8859-1":return nw(e);case"windows-1252":return rw(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function J5(e){let t="",n=0;for(;n<e.length;){let r=e[n++];if(r<128)t+=String.fromCharCode(r);else if(r<224){let s=e[n++]&63;t+=String.fromCharCode((r&31)<<6|s)}else if(r<240){let s=e[n++]&63,i=e[n++]&63;t+=String.fromCharCode((r&15)<<12|s<<6|i)}else{let s=e[n++]&63,i=e[n++]&63,a=e[n++]&63,o=(r&7)<<18|s<<12|i<<6|a;o-=65536,t+=String.fromCharCode(55296+(o>>10&1023),56320+(o&1023))}}return t}function ew(e){let t="";for(let n=0;n<e.length;n+=2)t+=String.fromCharCode(e[n]|e[n+1]<<8);return t}function tw(e){return String.fromCharCode(...e.map(t=>t&127))}function nw(e){return String.fromCharCode(...e)}function rw(e){let t="";for(let n of e)n>=128&&n<=159&&al[n]?t+=al[n]:t+=String.fromCharCode(n);return t}var al,Y5,Ad=I(()=>{al={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"},Y5={};for(let[e,t]of Object.entries(al))Y5[t]=Number.parseInt(e)});function Rt(e){return new DataView(e.buffer,e.byteOffset)}var Sd,Cd,Ve,Lr,Qe,Nd,vd,kd,Tt,Ss=I(()=>{Sd=wu(xd(),1);Ad();Cd={len:1,get(e,t){return Rt(e).getUint8(t)},put(e,t,n){return Rt(e).setUint8(t,n),t+1}},Ve={len:2,get(e,t){return Rt(e).getUint16(t,!0)},put(e,t,n){return Rt(e).setUint16(t,n,!0),t+2}},Lr={len:2,get(e,t){return Rt(e).getUint16(t)},put(e,t,n){return Rt(e).setUint16(t,n),t+2}},Qe={len:4,get(e,t){return Rt(e).getUint32(t,!0)},put(e,t,n){return Rt(e).setUint32(t,n,!0),t+4}},Nd={len:4,get(e,t){return Rt(e).getUint32(t)},put(e,t,n){return Rt(e).setUint32(t,n),t+4}},vd={len:4,get(e,t){return Rt(e).getInt32(t)},put(e,t,n){return Rt(e).setInt32(t,n),t+4}},kd={len:8,get(e,t){return Rt(e).getBigUint64(t,!0)},put(e,t,n){return Rt(e).setBigUint64(t,n,!0),t+8}},Tt=class{constructor(t,n){this.len=t,this.encoding=n}get(t,n=0){let r=t.subarray(n,n+this.len);return Ed(r,this.encoding)}}});var iw,Be,tr,Cs=I(()=>{iw="End-Of-Stream",Be=class extends Error{constructor(){super(iw),this.name="EndOfStreamError"}},tr=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}});var Id=I(()=>{});var nr,Di=I(()=>{Cs();nr=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,n=!1){let r=await this.read(t,n);return this.peekQueue.push(t.subarray(0,r)),r}async read(t,n=!1){if(t.length===0)return 0;let r=this.readFromPeekBuffer(t);if(this.endOfStream||(r+=await this.readRemainderFromStream(t.subarray(r),n)),r===0&&!n)throw new Be;return r}readFromPeekBuffer(t){let n=t.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);t.set(s.subarray(0,i),r),r+=i,n-=i,i<s.length&&this.peekQueue.push(s.subarray(i))}return r}async readRemainderFromStream(t,n){let r=0;for(;r<t.length&&!this.endOfStream;){if(this.interrupted)throw new tr;let s=await this.readFromStream(t.subarray(r),n);if(s===0)break;r+=s}if(!n&&r<t.length)throw new Be;return r}}});var $d=I(()=>{Cs();Id();Di()});var _i,Od=I(()=>{Di();_i=class extends nr{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var Ns,ol=I(()=>{Od();Ns=class extends _i{async readFromStream(t,n){if(t.length===0)return 0;let r=await this.reader.read(new Uint8Array(t.length),{min:n?void 0:t.length});return r.done&&(this.endOfStream=r.done),r.value?(t.set(r.value),r.value.length):0}}});var Fr,ll=I(()=>{Cs();Di();Fr=class extends nr{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,n){let r=Math.min(n.length,t.length);return t.set(n.subarray(0,r)),r<n.length?this.buffer=n.subarray(r):this.buffer=null,r}async readFromStream(t,n){if(t.length===0)return 0;let r=0;for(this.buffer&&(r+=this.writeChunk(t,this.buffer));r<t.length&&!this.endOfStream;){let s=await this.reader.read();if(s.done){this.endOfStream=!0;break}s.value&&(r+=this.writeChunk(t.subarray(r),s.value))}if(!n&&r===0&&this.endOfStream)throw new Be;return r}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}});function cl(e){try{let t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new Fr(t):new Ns(t)}catch(t){if(t instanceof TypeError)return new Fr(e.getReader());throw t}}var Rd=I(()=>{ol();ll()});var rr=I(()=>{Cs();$d();ol();ll();Rd()});var vn,vs=I(()=>{rr();vn=class{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t?.onClose,t?.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,n=this.position){let r=new Uint8Array(t.len);if(await this.readBuffer(r,{position:n})<t.len)throw new Be;return t.get(r,0)}async peekToken(t,n=this.position){let r=new Uint8Array(t.len);if(await this.peekBuffer(r,{position:n})<t.len)throw new Be;return t.get(r,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new Be;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new Be;return t.get(this.numBuffer,0)}async ignore(t){if(this.fileInfo.size!==void 0){let n=this.fileInfo.size-this.position;if(t>n)return this.position+=n,n}return this.position+=t,t}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(t,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:t.length,position:this.position,...n}}abort(){return Promise.resolve()}}});var ow,Li,Td=I(()=>{vs();rr();ow=256e3,Li=class extends vn{constructor(t,n){super(n),this.streamReader=t,this.fileInfo=n?.fileInfo??{}}async readBuffer(t,n){let r=this.normalizeOptions(t,n),s=r.position-this.position;if(s>0)return await this.ignore(s),this.readBuffer(t,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(t.subarray(0,r.length),r.mayBeLess);if(this.position+=i,(!n||!n.mayBeLess)&&i<r.length)throw new Be;return i}async peekBuffer(t,n){let r=this.normalizeOptions(t,n),s=0;if(r.position){let i=r.position-this.position;if(i>0){let a=new Uint8Array(r.length+i);return s=await this.peekBuffer(a,{mayBeLess:r.mayBeLess}),t.set(a.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(t.subarray(0,r.length),r.mayBeLess)}catch(i){if(n?.mayBeLess&&i instanceof Be)return 0;throw i}if(!r.mayBeLess&&s<r.length)throw new Be}return s}async ignore(t){let n=Math.min(ow,t),r=new Uint8Array(n),s=0;for(;s<t;){let i=t-s,a=await this.readBuffer(r,{length:Math.min(n,i)});if(a<0)return a;s+=a}return s}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}});var Fi,Pd=I(()=>{rr();vs();Fi=class extends vn{constructor(t,n){super(n),this.uint8Array=t,this.fileInfo={...n?.fileInfo??{},size:t.length}}async readBuffer(t,n){n?.position&&(this.position=n.position);let r=await this.peekBuffer(t,n);return this.position+=r,r}async peekBuffer(t,n){let r=this.normalizeOptions(t,n),s=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&s<r.length)throw new Be;return t.set(this.uint8Array.subarray(r.position,r.position+s)),s}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}});var Mi,Dd=I(()=>{rr();vs();Mi=class extends vn{constructor(t,n){super(n),this.blob=t,this.fileInfo={...n?.fileInfo??{},size:t.size,mimeType:t.type}}async readBuffer(t,n){n?.position&&(this.position=n.position);let r=await this.peekBuffer(t,n);return this.position+=r,r}async peekBuffer(t,n){let r=this.normalizeOptions(t,n),s=Math.min(this.blob.size-r.position,r.length);if(!r.mayBeLess&&s<r.length)throw new Be;let i=await this.blob.slice(r.position,r.position+s).arrayBuffer();return t.set(new Uint8Array(i)),s}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}});function _d(e,t){let n=cl(e),r=t??{},s=r.onClose;return r.onClose=async()=>{if(await n.close(),s)return s()},new Li(n,r)}function Ld(e,t){return new Fi(e,t)}function Fd(e,t){return new Mi(e,t)}var Md=I(()=>{rr();Td();Pd();Dd();rr();vs()});var Bd=Gs(($I,Ud)=>{var Mr=1e3,Ur=Mr*60,Br=Ur*60,sr=Br*24,cw=sr*7,uw=sr*365.25;Ud.exports=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return fw(e);if(n==="number"&&isFinite(e))return t.long?hw(e):pw(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function fw(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*uw;case"weeks":case"week":case"w":return n*cw;case"days":case"day":case"d":return n*sr;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Br;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ur;case"seconds":case"second":case"secs":case"sec":case"s":return n*Mr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function pw(e){var t=Math.abs(e);return t>=sr?Math.round(e/sr)+"d":t>=Br?Math.round(e/Br)+"h":t>=Ur?Math.round(e/Ur)+"m":t>=Mr?Math.round(e/Mr)+"s":e+"ms"}function hw(e){var t=Math.abs(e);return t>=sr?Ui(e,t,sr,"day"):t>=Br?Ui(e,t,Br,"hour"):t>=Ur?Ui(e,t,Ur,"minute"):t>=Mr?Ui(e,t,Mr,"second"):e+" ms"}function Ui(e,t,n,r){var s=t>=n*1.5;return Math.round(e/n)+" "+r+(s?"s":"")}});var zd=Gs((OI,Wd)=>{function dw(e){n.debug=n,n.default=n,n.coerce=l,n.disable=a,n.enable=s,n.enabled=o,n.humanize=Bd(),n.destroy=c,Object.keys(e).forEach(u=>{n[u]=e[u]}),n.names=[],n.skips=[],n.formatters={};function t(u){let f=0;for(let p=0;p<u.length;p++)f=(f<<5)-f+u.charCodeAt(p),f|=0;return n.colors[Math.abs(f)%n.colors.length]}n.selectColor=t;function n(u){let f,p=null,h,m;function d(...g){if(!d.enabled)return;let w=d,y=Number(new Date),b=y-(f||y);w.diff=b,w.prev=f,w.curr=y,f=y,g[0]=n.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let x=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,($,O)=>{if($==="%%")return"%";x++;let L=n.formatters[O];if(typeof L=="function"){let R=g[x];$=L.call(w,R),g.splice(x,1),x--}return $}),n.formatArgs.call(w,g),(w.log||n.log).apply(w,g)}return d.namespace=u,d.useColors=n.useColors(),d.color=n.selectColor(u),d.extend=r,d.destroy=n.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(h!==n.namespaces&&(h=n.namespaces,m=n.enabled(u)),m),set:g=>{p=g}}),typeof n.init=="function"&&n.init(d),d}function r(u,f){let p=n(this.namespace+(typeof f>"u"?":":f)+u);return p.log=this.log,p}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 p of f)p[0]==="-"?n.skips.push(p.slice(1)):n.names.push(p)}function i(u,f){let p=0,h=0,m=-1,d=0;for(;p<u.length;)if(h<f.length&&(f[h]===u[p]||f[h]==="*"))f[h]==="*"?(m=h,d=p,h++):(p++,h++);else if(m!==-1)h=m+1,d++,p=d;else return!1;for(;h<f.length&&f[h]==="*";)h++;return h===f.length}function a(){let u=[...n.names,...n.skips.map(f=>"-"+f)].join(",");return n.enable(""),u}function o(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}Wd.exports=dw});var Hd=Gs((Pt,Bi)=>{Pt.formatArgs=gw;Pt.save=yw;Pt.load=ww;Pt.useColors=mw;Pt.storage=bw();Pt.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})();Pt.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 mw(){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 e;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&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function gw(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Bi.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let n=0,r=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(n++,s==="%c"&&(r=n))}),e.splice(r,0,t)}Pt.log=console.debug||console.log||(()=>{});function yw(e){try{e?Pt.storage.setItem("debug",e):Pt.storage.removeItem("debug")}catch{}}function ww(){let e;try{e=Pt.storage.getItem("debug")||Pt.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function bw(){try{return localStorage}catch{}}Bi.exports=zd()(Pt);var{formatters:xw}=Bi.exports;xw.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var ir,ul,jd,Gd,Vd,qd=I(()=>{Ss();ir={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},ul={get(e){return{signature:Qe.get(e,0),compressedSize:Qe.get(e,8),uncompressedSize:Qe.get(e,12)}},len:16},jd={get(e){let t=Ve.get(e,6);return{signature:Qe.get(e,0),minVersion:Ve.get(e,4),dataDescriptor:!!(t&8),compressedMethod:Ve.get(e,8),compressedSize:Qe.get(e,18),uncompressedSize:Qe.get(e,22),filenameLength:Ve.get(e,26),extraFieldLength:Ve.get(e,28),filename:null}},len:30},Gd={get(e){return{signature:Qe.get(e,0),nrOfThisDisk:Ve.get(e,4),nrOfThisDiskWithTheStart:Ve.get(e,6),nrOfEntriesOnThisDisk:Ve.get(e,8),nrOfEntriesOfSize:Ve.get(e,10),sizeOfCd:Qe.get(e,12),offsetOfStartOfCd:Qe.get(e,16),zipFileCommentLength:Ve.get(e,20)}},len:22},Vd={get(e){let t=Ve.get(e,8);return{signature:Qe.get(e,0),minVersion:Ve.get(e,6),dataDescriptor:!!(t&8),compressedMethod:Ve.get(e,10),compressedSize:Qe.get(e,20),uncompressedSize:Qe.get(e,24),filenameLength:Ve.get(e,28),extraFieldLength:Ve.get(e,30),fileCommentLength:Ve.get(e,32),relativeOffsetOfLocalHeader:Qe.get(e,42),filename:null}},len:46}});function Kd(e){let t=new Uint8Array(Qe.len);return Qe.put(t,0,e),t}function Aw(e,t){let n=e.length,r=t.length;if(r>n)return-1;for(let s=0;s<=n-r;s++){let i=!0;for(let a=0;a<r;a++)if(e[s+a]!==t[a]){i=!1;break}if(i)return s}return-1}function Sw(e){let t=e.reduce((s,i)=>s+i.length,0),n=new Uint8Array(t),r=0;for(let s of e)n.set(s,r),r+=s.length;return n}var Zd,gn,fl,Ew,Wi,ks,Qd=I(()=>{Ss();Zd=wu(Hd(),1);qd();gn=(0,Zd.default)("tokenizer:inflate"),fl=256*1024,Ew=Kd(ir.DataDescriptor),Wi=Kd(ir.EndOfCentralDirectory),ks=class e{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(fl)}async isZip(){return await this.peekSignature()===ir.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Qe)}async findEndOfCentralDirectoryLocator(){let t=this.tokenizer,n=Math.min(16*1024,t.fileInfo.size),r=this.syncBuffer.subarray(0,n);await this.tokenizer.readBuffer(r,{position:t.fileInfo.size-n});for(let s=r.length-4;s>=0;s--)if(r[s]===Wi[0]&&r[s+1]===Wi[1]&&r[s+2]===Wi[2]&&r[s+3]===Wi[3])return t.fileInfo.size-n+s;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){gn("Cannot reading central-directory without random-read support");return}gn("Reading central-directory...");let t=this.tokenizer.position,n=await this.findEndOfCentralDirectoryLocator();if(n>0){gn("Central-directory 32-bit signature found");let r=await this.tokenizer.readToken(Gd,n),s=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let i=0;i<r.nrOfEntriesOfSize;++i){let a=await this.tokenizer.readToken(Vd);if(a.signature!==ir.CentralFileHeader)throw new Error("Expected Central-File-Header signature");a.filename=await this.tokenizer.readToken(new Tt(a.filenameLength,"utf-8")),await this.tokenizer.ignore(a.extraFieldLength),await this.tokenizer.ignore(a.fileCommentLength),s.push(a),gn(`Add central-directory file-entry: n=${i+1}/${s.length}: filename=${s[i].filename}`)}return this.tokenizer.setPosition(t),s}this.tokenizer.setPosition(t)}async unzip(t){let n=await this.readCentralDirectory();if(n)return this.iterateOverCentralDirectory(n,t);let r=!1;do{let s=await this.readLocalFileHeader();if(!s)break;let i=t(s);r=!!i.stop;let a;if(await this.tokenizer.ignore(s.extraFieldLength),s.dataDescriptor&&s.compressedSize===0){let o=[],l=fl;gn("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let c=-1;for(;c<0&&l===fl;){l=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),c=Aw(this.syncBuffer.subarray(0,l),Ew);let u=c>=0?c:l;if(i.handler){let f=new Uint8Array(u);await this.tokenizer.readBuffer(f),o.push(f)}else await this.tokenizer.ignore(u)}gn(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),i.handler&&await this.inflate(s,Sw(o),i.handler)}else i.handler?(gn(`Reading compressed-file-data: ${s.compressedSize} bytes`),a=new Uint8Array(s.compressedSize),await this.tokenizer.readBuffer(a),await this.inflate(s,a,i.handler)):(gn(`Ignoring compressed-file-data: ${s.compressedSize} bytes`),await this.tokenizer.ignore(s.compressedSize));if(gn(`Reading data-descriptor at pos=${this.tokenizer.position}`),s.dataDescriptor&&(await this.tokenizer.readToken(ul)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-ul.len}`)}while(!r)}async iterateOverCentralDirectory(t,n){for(let r of t){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 a=new Uint8Array(r.compressedSize);await this.tokenizer.readBuffer(a),await this.inflate(i,a,s.handler)}}if(s.stop)break}}async inflate(t,n,r){if(t.compressedMethod===0)return r(n);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);gn(`Decompress filename=${t.filename}, compressed-size=${n.length}`);let s=await e.decompressDeflateRaw(n);return r(s)}static async decompressDeflateRaw(t){let n=new ReadableStream({start(i){i.enqueue(t),i.close()}}),r=new DecompressionStream("deflate-raw"),s=n.pipeThrough(r);try{let a=await new Response(s).arrayBuffer();return new Uint8Array(a)}catch(i){let a=i instanceof Error?`Failed to deflate ZIP entry: ${i.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(a)}}async readLocalFileHeader(){let t=await this.tokenizer.peekToken(Qe);if(t===ir.LocalFileHeader){let n=await this.tokenizer.readToken(jd);return n.filename=await this.tokenizer.readToken(new Tt(n.filenameLength,"utf-8")),n}if(t===ir.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var Is,Xd=I(()=>{Is=class{constructor(t){this.tokenizer=t}inflate(){let t=this.tokenizer;return new ReadableStream({async pull(n){let r=new Uint8Array(1024),s=await t.readBuffer(r,{mayBeLess:!0});if(s===0){n.close();return}n.enqueue(r.subarray(0,s))}}).pipeThrough(new DecompressionStream("gzip"))}}});var Yd=I(()=>{Qd();Xd()});function pl(e){let{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}var BI,WI,zI,Jd=I(()=>{BI={utf8:new globalThis.TextDecoder("utf8")},WI=new globalThis.TextEncoder,zI=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"))});function e0(e,t){if(t==="utf-16le"){let n=[];for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);n.push(s&255,s>>8&255)}return n}if(t==="utf-16be"){let n=[];for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);n.push(s>>8&255,s&255)}return n}return[...e].map(n=>n.charCodeAt(0))}function t0(e,t=0){let n=Number.parseInt(new Tt(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(n))return!1;let r=256;for(let s=t;s<t+148;s++)r+=e[s];for(let s=t+156;s<t+512;s++)r+=e[s];return n===r}var n0,r0=I(()=>{Ss();n0={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4}});var s0,i0,a0=I(()=>{s0=["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"],i0=["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 o0(e,t){return new ml(t).fromBuffer(e)}function dl(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};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:e};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:e};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:e};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:e};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:e};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 yn(e,t,n){n={offset:0,...n};for(let[r,s]of t.entries())if(n.mask){if(s!==(n.mask[r]&e[r+n.offset]))return!1}else if(s!==e[r+n.offset])return!1;return!0}var hl,ml,XI,YI,l0=I(()=>{Ss();Md();Yd();Jd();r0();a0();hl=4100;ml=class{constructor(t){this.options={mpegOffsetTolerance:0,...t},this.detectors=[...t?.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:t?.signal}}async fromTokenizer(t){let n=t.position;for(let r of this.detectors){let s=await r.detect(t);if(s)return s;if(n!==t.position)return}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);let n=t instanceof Uint8Array?t:new Uint8Array(t);if(n?.length>1)return this.fromTokenizer(Ld(n,this.tokenizerOptions))}async fromBlob(t){let n=Fd(t,this.tokenizerOptions);try{return await this.fromTokenizer(n)}finally{await n.close()}}async fromStream(t){let n=_d(t,this.tokenizerOptions);try{return await this.fromTokenizer(n)}finally{await n.close()}}async toDetectionStream(t,n){let{sampleSize:r=hl}=n,s,i,a=t.getReader({mode:"byob"});try{let{value:c,done:u}=await a.read(new Uint8Array(r));if(i=c,!u&&c)try{s=await this.fromBuffer(c.subarray(0,r))}catch(f){if(!(f instanceof Be))throw f;s=void 0}i=c}finally{a.releaseLock()}let o=new TransformStream({async start(c){c.enqueue(i)},transform(c,u){u.enqueue(c)}}),l=t.pipeThrough(o);return l.fileType=s,l}check(t,n){return yn(this.buffer,t,n)}checkString(t,n){return this.check(e0(t,n?.encoding),n)}detectConfident=async t=>{if(this.buffer=new Uint8Array(hl),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,await t.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 t.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(t);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 Is(t).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 t.ignore(6);let n=await t.readToken(n0);return t.position+n>t.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await t.ignore(n),this.fromTokenizer(t))}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 ks(t).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=dl(i)},stop:!0};case"[Content_Types].xml":return{async handler(s){let i=new TextDecoder("utf-8").decode(s),a=i.indexOf('.main+xml"');if(a===-1){let o="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";i.includes(`ContentType="${o}"`)&&(n=dl(o))}else{i=i.slice(0,Math.max(0,a));let o=i.lastIndexOf('"'),l=i.slice(Math.max(0,o+1));n=dl(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 Be))throw r}),n??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await t.ignore(28);let n=new Uint8Array(8);return await t.readBuffer(n),yn(n,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:yn(n,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:yn(n,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:yn(n,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:yn(n,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:yn(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 o=await t.peekNumber(Cd),l=128,c=0;for(;(o&l)===0&&l!==0;)++c,l>>=1;let u=new Uint8Array(c+1);return await t.readBuffer(u),u}async function r(){let o=await n(),l=await n();l[0]^=128>>l.length-1;let c=Math.min(6,l.length),u=new DataView(o.buffer),f=new DataView(l.buffer,l.length-c,c);return{id:pl(u),len:pl(f)}}async function s(o){for(;o>0;){let l=await r();if(l.id===17026)return(await t.readToken(new Tt(l.len))).replaceAll(/\00.*$/g,"");await t.ignore(l.len),--o}}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 Tt(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 t.ignore(8),await t.readToken(new Tt(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
623
+ `,"\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 t.ignore(8);async function n(){return{length:await t.readToken(vd),type:await t.readToken(new Tt(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 t.ignore(r.length+4)}}while(t.position+8<t.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 Tt(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
624
+ `))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 t.readBuffer(r),{id:r,size:Number(await t.readToken(kd))}}for(await t.ignore(30);t.position+24<t.fileInfo.size;){let r=await n(),s=r.size-24;if(yn(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 t.readBuffer(i),yn(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(yn(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 t.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 t.ignore(20),await t.readToken(new Tt(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 t.peekBuffer(this.buffer,{length:Math.min(256,t.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 t.peekBuffer(this.buffer,{length:Math.min(512,t.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})&&t0(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
625
+ `,{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 t=>{if(this.buffer=new Uint8Array(hl),await t.peekBuffer(this.buffer,{length:Math.min(8,t.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 t.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,t.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(t){let n=await this.tokenizer.readToken(t?Lr:Ve);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(t){let n=await this.tokenizer.readToken(t?Lr:Ve);for(let r=0;r<n;++r){let s=await this.readTiffTag(t);if(s)return s}}async readTiffHeader(t){let n=(t?Lr:Ve).get(this.buffer,2),r=(t?Nd:Qe).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=(t?Lr:Ve).get(this.buffer,8),a=(t?Lr:Ve).get(this.buffer,10);if(i===28&&a===254||i===31&&a===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}return await this.tokenizer.ignore(r),await this.readTiffIFD(t)??{ext:"tif",mime:"image/tiff"}}if(n===43)return{ext:"tif",mime:"image/tiff"}}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},XI=new Set(s0),YI=new Set(i0)});var c0={};K(c0,{fileCommand:()=>Rw,flagsForFuzzing:()=>Tw});function kw(e,t){let n=vw.get(e);if(n)return n;let[r,s]=t.split("/"),i=s?.split("+")[0]?.replace(/-/g," ")||e;switch(r){case"image":return`${i.toUpperCase()} image data`;case"audio":return`${i.toUpperCase()} audio`;case"video":return`${i.toUpperCase()} video`;case"font":return`${i} font`;case"model":return`${i} 3D model`;case"application":return s?.includes("zip")||s?.includes("compressed")?`${i} archive data`:s?.includes("executable")?`${i} executable`:`${e.toUpperCase()} data`;default:return`${e.toUpperCase()} data`}}function Iw(e){let t=e.split("/").pop()||e;if(t.startsWith(".")&&!t.includes(".",1))return t;let n=t.lastIndexOf(".");return n===-1||n===0?"":t.slice(n).toLowerCase()}function $w(e,t){if(e.startsWith("#!")){let c=e.split(`
626
626
  `)[0];return c.includes("python")?{description:"Python script, ASCII text executable",mime:"text/x-python"}:c.includes("node")||c.includes("bun")||c.includes("deno")?{description:"JavaScript script, ASCII text executable",mime:"text/javascript"}:c.includes("bash")?{description:"Bourne-Again shell script, ASCII text executable",mime:"text/x-shellscript"}:c.includes("sh")?{description:"POSIX shell script, ASCII text executable",mime:"text/x-shellscript"}:c.includes("ruby")?{description:"Ruby script, ASCII text executable",mime:"text/x-ruby"}:c.includes("perl")?{description:"Perl script, ASCII text executable",mime:"text/x-perl"}:{description:"script, ASCII text executable",mime:"text/plain"}}let n=e.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=e.includes(`\r
627
- `),s=e.includes("\r")&&!r,i="";r?i=", with CRLF line terminators":s&&(i=", with CR line terminators");let a=Iw(t),o=a?Nw.get(a):void 0;if(o)return o.mime.startsWith("text/")&&i?{description:`${o.description}${i}`,mime:o.mime}:o;let l=!1;for(let c=0;c<Math.min(e.length,8192);c++)if(e.charCodeAt(c)>127){l=!0;break}return l?{description:`UTF-8 Unicode text${i}`,mime:"text/plain; charset=utf-8"}:{description:`ASCII text${i}`,mime:"text/plain"}}async function Ow(e,t){if(t.length===0)return{description:"empty",mime:"inode/x-empty"};let n=await o0(t);if(n)return{description:vw(n.ext,n.mime),mime:n.mime};let r=new TextDecoder("utf-8",{fatal:!1}).decode(t);return $w(r,e)}var Cw,Nw,kw,Rw,Tw,u0=I(()=>{"use strict";l0();se();Cw={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"]},Nw=new Map([[".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"}]]),kw=new Map([["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"]]);Rw={name:"file",async execute(e,t){if(U(e))return M(Cw);let n=!1,r=!1,s=[];for(let o of e)if(o.startsWith("--")){if(o==="--brief")n=!0;else if(o==="--mime"||o==="--mime-type")r=!0;else if(o!=="--dereference")return Y("file",o)}else if(o.startsWith("-")&&o!=="-"){for(let l of o.slice(1))if(l==="b")n=!0;else if(l==="i")r=!0;else if(l!=="L")return Y("file",`-${l}`)}else s.push(o);if(s.length===0)return{stdout:"",stderr:`Usage: file [-bLi] FILE...
627
+ `),s=e.includes("\r")&&!r,i="";r?i=", with CRLF line terminators":s&&(i=", with CR line terminators");let a=Iw(t),o=a?Nw.get(a):void 0;if(o)return o.mime.startsWith("text/")&&i?{description:`${o.description}${i}`,mime:o.mime}:o;let l=!1;for(let c=0;c<Math.min(e.length,8192);c++)if(e.charCodeAt(c)>127){l=!0;break}return l?{description:`UTF-8 Unicode text${i}`,mime:"text/plain; charset=utf-8"}:{description:`ASCII text${i}`,mime:"text/plain"}}async function Ow(e,t){if(t.length===0)return{description:"empty",mime:"inode/x-empty"};let n=await o0(t);if(n)return{description:kw(n.ext,n.mime),mime:n.mime};let r=new TextDecoder("utf-8",{fatal:!1}).decode(t);return $w(r,e)}var Cw,Nw,vw,Rw,Tw,u0=I(()=>{"use strict";l0();se();Cw={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"]},Nw=new Map([[".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"}]]),vw=new Map([["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"]]);Rw={name:"file",async execute(e,t){if(U(e))return M(Cw);let n=!1,r=!1,s=[];for(let o of e)if(o.startsWith("--")){if(o==="--brief")n=!0;else if(o==="--mime"||o==="--mime-type")r=!0;else if(o!=="--dereference")return Y("file",o)}else if(o.startsWith("-")&&o!=="-"){for(let l of o.slice(1))if(l==="b")n=!0;else if(l==="i")r=!0;else if(l!=="L")return Y("file",`-${l}`)}else s.push(o);if(s.length===0)return{stdout:"",stderr:`Usage: file [-bLi] FILE...
628
628
  `,exitCode:1};let i="",a=0;for(let o of s)try{let l=t.fs.resolvePath(t.cwd,o);if((await t.fs.stat(l)).isDirectory){let h=r?"inode/directory":"directory";i+=n?`${h}
629
629
  `:`${o}: ${h}
630
630
  `;continue}let u=await t.fs.readFileBuffer(l),f=await Ow(o,u),p=r?f.mime:f.description;i+=n?`${p}
@@ -661,23 +661,23 @@ Otherwise, lists all available commands.
661
661
  `,stderr:"",exitCode:0}}var Yw,Jw,A0=I(()=>{"use strict";Yw={name:"whoami",execute:Xw},Jw={name:"whoami",flags:[]}});var S0={};K(S0,{flagsForFuzzing:()=>nb,od:()=>tb});async function eb(e,t){let n="octal",r=[],s=[];for(let h=0;h<e.length;h++){let m=e[h];if(m==="-c")r.push("char");else if(m==="-An"||m==="-A"&&e[h+1]==="n")n="none",m==="-A"&&h++;else if(m==="-t"&&e[h+1]){let d=e[++h];d==="x1"?r.push("hex"):d==="c"?r.push("char"):d.startsWith("o")&&r.push("octal")}else(!m.startsWith("-")||m==="-")&&s.push(m)}r.length===0&&r.push("octal");let i=t.stdin;if(s.length>0&&s[0]!=="-"){let h=s[0].startsWith("/")?s[0]:`${t.cwd}/${s[0]}`;try{i=await t.fs.readFile(h)}catch{return{stdout:"",stderr:`od: ${s[0]}: No such file or directory
662
662
  `,exitCode:1}}}let a=r.includes("char");function o(h){return h===0?" \\0":h===7?" \\a":h===8?" \\b":h===9?" \\t":h===10?" \\n":h===11?" \\v":h===12?" \\f":h===13?" \\r":h>=32&&h<127?` ${String.fromCharCode(h)}`:` ${h.toString(8).padStart(3,"0")}`}function l(h){return a?` ${h.toString(16).padStart(2,"0")}`:` ${h.toString(16).padStart(2,"0")}`}function c(h){return` ${h.toString(8).padStart(3,"0")}`}let u=[];for(let h of i)u.push(h.charCodeAt(0));let f=16,p=[];for(let h=0;h<u.length;h+=f){let m=u.slice(h,h+f);for(let d=0;d<r.length;d++){let g=r[d],w;g==="char"?w=m.map(o):g==="hex"?w=m.map(l):w=m.map(c);let y="";d===0&&n!=="none"?y=`${h.toString(8).padStart(7,"0")} `:(d>0||n==="none")&&(y=n==="none"?"":" "),p.push(y+w.join(""))}}return n!=="none"&&u.length>0&&p.push(u.length.toString(8).padStart(7,"0")),{stdout:p.length>0?`${p.join(`
663
663
  `)}
664
- `:"",stderr:"",exitCode:0}}var tb,nb,C0=I(()=>{"use strict";tb={name:"od",execute:eb},nb={name:"od",flags:[{flag:"-c",type:"boolean"},{flag:"-A",type:"value",valueHint:"string"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-N",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0}});var Hi={};K(Hi,{flagsForFuzzing:()=>hb,gunzipCommand:()=>fb,gunzipFlagsForFuzzing:()=>db,gzipCommand:()=>ub,zcatCommand:()=>pb,zcatFlagsForFuzzing:()=>mb});import{constants as gl,gunzipSync as yl,gzipSync as N0}from"node:zlib";function k0(e){return e.best?gl.Z_BEST_COMPRESSION:e.level8?8:e.level7?7:e.level6?6:e.level5?5:e.level4?4:e.level3?3:e.level2?2:e.fast?gl.Z_BEST_SPEED:gl.Z_DEFAULT_COMPRESSION}function v0(e){if(e.length<10)return{originalName:null,mtime:null,headerSize:0};if(e[0]!==31||e[1]!==139)return{originalName:null,mtime:null,headerSize:0};let t=e[3],n=e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r=10;if(t&4){if(r+2>e.length)return{originalName:null,mtime:null,headerSize:0};let i=e[r]|e[r+1]<<8;r+=2+i}let s=null;if(t&8){let i=r;for(;r<e.length&&e[r]!==0;)r++;r<e.length&&(s=new TextDecoder().decode(e.slice(i,r)),r++)}if(t&16){for(;r<e.length&&e[r]!==0;)r++;r++}return t&2&&(r+=2),{originalName:s,mtime:n>0?new Date(n*1e3):null,headerSize:r}}function ob(e){if(e.length<4)return 0;let t=e.length;return e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24}function zi(e){return e.length>=2&&e[0]===31&&e[1]===139}async function I0(e,t,n,r,s,i){let a=n.suffix,o,l,c;if(t==="-"||t==="")if(c=Uint8Array.from(e.stdin,u=>u.charCodeAt(0)),s){if(!zi(c))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: stdin: not in gzip format
664
+ `:"",stderr:"",exitCode:0}}var tb,nb,C0=I(()=>{"use strict";tb={name:"od",execute:eb},nb={name:"od",flags:[{flag:"-c",type:"boolean"},{flag:"-A",type:"value",valueHint:"string"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-N",type:"value",valueHint:"number"}],stdinType:"text",needsFiles:!0}});var Hi={};K(Hi,{flagsForFuzzing:()=>hb,gunzipCommand:()=>fb,gunzipFlagsForFuzzing:()=>db,gzipCommand:()=>ub,zcatCommand:()=>pb,zcatFlagsForFuzzing:()=>mb});import{constants as gl,gunzipSync as yl,gzipSync as N0}from"node:zlib";function v0(e){return e.best?gl.Z_BEST_COMPRESSION:e.level8?8:e.level7?7:e.level6?6:e.level5?5:e.level4?4:e.level3?3:e.level2?2:e.fast?gl.Z_BEST_SPEED:gl.Z_DEFAULT_COMPRESSION}function k0(e){if(e.length<10)return{originalName:null,mtime:null,headerSize:0};if(e[0]!==31||e[1]!==139)return{originalName:null,mtime:null,headerSize:0};let t=e[3],n=e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r=10;if(t&4){if(r+2>e.length)return{originalName:null,mtime:null,headerSize:0};let i=e[r]|e[r+1]<<8;r+=2+i}let s=null;if(t&8){let i=r;for(;r<e.length&&e[r]!==0;)r++;r<e.length&&(s=new TextDecoder().decode(e.slice(i,r)),r++)}if(t&16){for(;r<e.length&&e[r]!==0;)r++;r++}return t&2&&(r+=2),{originalName:s,mtime:n>0?new Date(n*1e3):null,headerSize:r}}function ob(e){if(e.length<4)return 0;let t=e.length;return e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24}function zi(e){return e.length>=2&&e[0]===31&&e[1]===139}async function I0(e,t,n,r,s,i){let a=n.suffix,o,l,c;if(t==="-"||t==="")if(c=Uint8Array.from(e.stdin,u=>u.charCodeAt(0)),s){if(!zi(c))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: stdin: not in gzip format
665
665
  `,exitCode:1};try{let u=yl(c);return{stdout:String.fromCharCode(...u),stderr:"",exitCode:0}}catch(u){let f=u instanceof Error?u.message:"unknown error";return{stdout:"",stderr:`${r}: stdin: ${f}
666
- `,exitCode:1}}}else{let u=k0(n),f=N0(c,{level:u});return{stdout:String.fromCharCode(...f),stderr:"",exitCode:0}}o=e.fs.resolvePath(e.cwd,t);try{if((await e.fs.stat(o)).isDirectory)return n.recursive?await $0(e,o,n,r,s,i):n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: is a directory -- ignored
666
+ `,exitCode:1}}}else{let u=v0(n),f=N0(c,{level:u});return{stdout:String.fromCharCode(...f),stderr:"",exitCode:0}}o=e.fs.resolvePath(e.cwd,t);try{if((await e.fs.stat(o)).isDirectory)return n.recursive?await $0(e,o,n,r,s,i):n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: is a directory -- ignored
667
667
  `,exitCode:1}}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
668
668
  `,exitCode:1}}try{c=await e.fs.readFileBuffer(o)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
669
669
  `,exitCode:1}}if(s){if(!t.endsWith(a))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: unknown suffix -- ignored
670
670
  `,exitCode:1};if(!zi(c))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
671
671
  `,exitCode:1};let u;try{u=yl(c)}catch(f){let p=f instanceof Error?f.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${p}
672
- `,exitCode:1}}if(i)return{stdout:String.fromCharCode(...u),stderr:"",exitCode:0};if(n.name){let f=v0(c);f.originalName?l=e.fs.resolvePath(e.cwd,f.originalName):l=o.slice(0,-a.length)}else l=o.slice(0,-a.length);if(!n.force)try{return await e.fs.stat(l),{stdout:"",stderr:`${r}: ${l} already exists; not overwritten
672
+ `,exitCode:1}}if(i)return{stdout:String.fromCharCode(...u),stderr:"",exitCode:0};if(n.name){let f=k0(c);f.originalName?l=e.fs.resolvePath(e.cwd,f.originalName):l=o.slice(0,-a.length)}else l=o.slice(0,-a.length);if(!n.force)try{return await e.fs.stat(l),{stdout:"",stderr:`${r}: ${l} already exists; not overwritten
673
673
  `,exitCode:1}}catch{}if(await e.fs.writeFile(l,u),!n.keep&&!i&&await e.fs.rm(o),n.verbose){let f=c.length>0?((1-c.length/u.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${f}% -- replaced with ${l.split("/").pop()}
674
674
  `,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}else{if(t.endsWith(a))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t} already has ${a} suffix -- unchanged
675
- `,exitCode:1};let u=k0(n),f;try{f=N0(c,{level:u})}catch(p){let h=p instanceof Error?p.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${h}
675
+ `,exitCode:1};let u=v0(n),f;try{f=N0(c,{level:u})}catch(p){let h=p instanceof Error?p.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${h}
676
676
  `,exitCode:1}}if(i)return{stdout:String.fromCharCode(...f),stderr:"",exitCode:0};if(l=o+a,!n.force)try{return await e.fs.stat(l),{stdout:"",stderr:`${r}: ${l} already exists; not overwritten
677
677
  `,exitCode:1}}catch{}if(await e.fs.writeFile(l,f),!n.keep&&!i&&await e.fs.rm(o),n.verbose){let p=c.length>0?((1-f.length/c.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${p}% -- replaced with ${l.split("/").pop()}
678
678
  `,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}}async function $0(e,t,n,r,s,i){let a=await e.fs.readdir(t),o="",l="",c=0;for(let u of a){let f=e.fs.resolvePath(t,u),p=await e.fs.stat(f);if(p.isDirectory){let h=await $0(e,f,n,r,s,i);o+=h.stdout,l+=h.stderr,h.exitCode!==0&&(c=h.exitCode)}else if(p.isFile){let h=n.suffix;if(s&&!u.endsWith(h)||!s&&u.endsWith(h))continue;let m=f.startsWith(`${e.cwd}/`)?f.slice(e.cwd.length+1):f,d=await I0(e,m,n,r,s,i);o+=d.stdout,l+=d.stderr,d.exitCode!==0&&(c=d.exitCode)}}return{stdout:o,stderr:l,exitCode:c}}async function lb(e,t,n,r){let s;if(t==="-"||t==="")s=Uint8Array.from(e.stdin,f=>f.charCodeAt(0));else{let f=e.fs.resolvePath(e.cwd,t);try{s=await e.fs.readFileBuffer(f)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
679
679
  `,exitCode:1}}}if(!zi(s))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
680
- `,exitCode:1};let i=s.length,a=ob(s),o=a>0?((1-i/a)*100).toFixed(1):"0.0",c=v0(s).originalName||(t==="-"?"":t.replace(/\.gz$/,""));return{stdout:`${i.toString().padStart(10)} ${a.toString().padStart(10)} ${o.padStart(5)}% ${c}
680
+ `,exitCode:1};let i=s.length,a=ob(s),o=a>0?((1-i/a)*100).toFixed(1):"0.0",c=k0(s).originalName||(t==="-"?"":t.replace(/\.gz$/,""));return{stdout:`${i.toString().padStart(10)} ${a.toString().padStart(10)} ${o.padStart(5)}% ${c}
681
681
  `,stderr:"",exitCode:0}}async function cb(e,t,n,r){let s;if(t==="-"||t==="")s=Uint8Array.from(e.stdin,i=>i.charCodeAt(0));else{let i=e.fs.resolvePath(e.cwd,t);try{s=await e.fs.readFileBuffer(i)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
682
682
  `,exitCode:1}}}if(!zi(s))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
683
683
  `,exitCode:1};try{return yl(s),n.verbose?{stdout:"",stderr:`${t}: OK
@@ -715,7 +715,7 @@ ${i}\r
715
715
  `,exitCode:2};if(!t.fetch)return{stdout:"",stderr:`curl: internal error: fetch not available
716
716
  `,exitCode:1};let s=r.url;s.match(/^https?:\/\//)||(s=`https://${s}`);try{let{body:i,contentType:a}=await gb(r,t),o=yb(r,a),l=await t.fetch(s,{method:r.method,headers:Object.keys(o).length>0?o:void 0,body:i,followRedirects:r.followRedirects,timeoutMs:r.timeoutMs});if(await wb(r,l.headers,t),r.failSilently&&l.status>=400)return{stdout:"",stderr:r.showError||!r.silent?`curl: (22) The requested URL returned error: ${l.status}
717
717
  `:"",exitCode:22};let c=bb(r,l,s);if(r.outputFile||r.useRemoteName){let u=r.outputFile||_0(s),f=t.fs.resolvePath(t.cwd,u);await t.fs.writeFile(f,r.headOnly?"":l.body),r.verbose||(c=""),r.writeOut&&(c=Sl(r.writeOut,{status:l.status,headers:l.headers,url:l.url,bodyLength:l.body.length}))}return{stdout:c,stderr:"",exitCode:0}}catch(i){let a=Ue(i),o=1;return a.includes("Network access denied")?o=7:a.includes("HTTP method")&&a.includes("not allowed")?o=3:a.includes("Redirect target not in allow-list")||a.includes("Too many redirects")?o=47:a.includes("aborted")&&(o=28),{stdout:"",stderr:!r.silent||r.showError?`curl: (${o}) ${a}
718
- `:"",exitCode:o}}}}});function vl(e){let{pid:t,ppid:n,uid:r,gid:s}=e;return`Name: bash
718
+ `:"",exitCode:o}}}}});function kl(e){let{pid:t,ppid:n,uid:r,gid:s}=e;return`Name: bash
719
719
  State: R (running)
720
720
  Pid: ${t}
721
721
  PPid: ${n}
@@ -737,12 +737,12 @@ Gid: ${s} ${s} ${s} ${s}
737
737
  `||b===";"||b==="&"||b==="|"||b==="("||b===")"||b==="<"||b===">")break}if(b==="$"&&a+1<i&&s[a+1]==="'"&&!h&&!m){for(u+="$'",a+=2,l+=2;a<i&&s[a]!=="'";)s[a]==="\\"&&a+1<i?(u+=s[a]+s[a+1],a+=2,l+=2):(u+=s[a],a++,l++);a<i&&(u+="'",a++,l++);continue}if(b==="$"&&a+1<i&&s[a+1]==='"'&&!h&&!m){a++,l++,m=!0,f=!0,u===""&&(d=!0),a++,l++;continue}if(b==="'"&&!m){if(h)if(h=!1,!d||g)u+=b;else{let x=a+1<i?s[a+1]:"";x&&!J0(x)&&x!=="'"&&(x==='"'?(g=!0,u+=b,p=!1,f=!1):(g=!0,u+=b))}else h=!0,d&&!g?(p=!0,f=!0):u+=b;a++,l++;continue}if(b==='"'&&!h){if(m)if(m=!1,!d||g)u+=b;else{let x=a+1<i?s[a+1]:"";x&&!J0(x)&&x!=='"'&&(x==="'"?(g=!0,u+=b,p=!1,f=!1):(g=!0,u+=b))}else m=!0,d&&!g?f=!0:u+=b;a++,l++;continue}if(b==="\\"&&!h&&a+1<i){let x=s[a+1];if(x===`
738
738
  `){a+=2,c++,l=1;continue}if(m){if(x==='"'||x==="\\"||x==="$"||x==="`"||x===`
739
739
  `){if(x===`
740
- `){a+=2,l=1,c++;continue}u+=b+x,a+=2,l+=2;continue}}else{x==="\\"||x==='"'||x==="'"||x==="`"||x==="*"||x==="?"||x==="["||x==="]"||x==="("||x===")"||x==="$"||x==="-"||x==="."||x==="^"||x==="+"||x==="{"||x==="}"?u+=b+x:u+=x,a+=2,l+=2;continue}}if(b==="$"&&a+1<i&&s[a+1]==="("&&!h){u+=b,a++,l++,u+=s[a],a++,l++;let x=1,S=!1,$=!1,O=0,L=!1,R="",W=s[a]==="("&&!this.dollarDparenIsSubshell(a);for(;x>0&&a<i;){let k=s[a];if(u+=k,S)k==="'"&&(S=!1);else if($)k==="\\"&&a+1<i?(u+=s[a+1],a++,l++):k==='"'&&($=!1);else if(k==="'")S=!0,R="";else if(k==='"')$=!0,R="";else if(k==="\\"&&a+1<i)u+=s[a+1],a++,l++,R="";else if(k==="$"&&a+1<i&&s[a+1]==="{"){a++,l++,u+=s[a],a++,l++;let N=1,P=!1,v=!1;for(;N>0&&a<i;){let T=s[a];if(T==="\\"&&a+1<i&&!P){u+=T,a++,l++,u+=s[a],a++,l++;continue}u+=T,P?T==="'"&&(P=!1):v?T==='"'&&(v=!1):T==="'"?P=!0:T==='"'?v=!0:T==="{"?N++:T==="}"&&N--,T===`
741
- `?(c++,l=0):l++,a++}R="";continue}else if(k==="#"&&!W&&(R===""||/\s/.test(s[a-1]||""))){for(;a+1<i&&s[a+1]!==`
742
- `;)a++,l++,u+=s[a];R=""}else/[a-zA-Z_]/.test(k)?R+=k:(R==="case"?(O++,L=!1):R==="in"&&O>0?L=!0:R==="esac"&&O>0&&(O--,L=!1),R="",k==="("?a>0&&s[a-1]==="$"?x++:L||x++:k===")"?L?L=!1:x--:k===";"&&O>0&&(a+1<i&&s[a+1]===";"||a+1<i&&s[a+1]==="&")&&(L=!0));k===`
740
+ `){a+=2,l=1,c++;continue}u+=b+x,a+=2,l+=2;continue}}else{x==="\\"||x==='"'||x==="'"||x==="`"||x==="*"||x==="?"||x==="["||x==="]"||x==="("||x===")"||x==="$"||x==="-"||x==="."||x==="^"||x==="+"||x==="{"||x==="}"?u+=b+x:u+=x,a+=2,l+=2;continue}}if(b==="$"&&a+1<i&&s[a+1]==="("&&!h){u+=b,a++,l++,u+=s[a],a++,l++;let x=1,S=!1,$=!1,O=0,L=!1,R="",W=s[a]==="("&&!this.dollarDparenIsSubshell(a);for(;x>0&&a<i;){let v=s[a];if(u+=v,S)v==="'"&&(S=!1);else if($)v==="\\"&&a+1<i?(u+=s[a+1],a++,l++):v==='"'&&($=!1);else if(v==="'")S=!0,R="";else if(v==='"')$=!0,R="";else if(v==="\\"&&a+1<i)u+=s[a+1],a++,l++,R="";else if(v==="$"&&a+1<i&&s[a+1]==="{"){a++,l++,u+=s[a],a++,l++;let N=1,P=!1,k=!1;for(;N>0&&a<i;){let T=s[a];if(T==="\\"&&a+1<i&&!P){u+=T,a++,l++,u+=s[a],a++,l++;continue}u+=T,P?T==="'"&&(P=!1):k?T==='"'&&(k=!1):T==="'"?P=!0:T==='"'?k=!0:T==="{"?N++:T==="}"&&N--,T===`
741
+ `?(c++,l=0):l++,a++}R="";continue}else if(v==="#"&&!W&&(R===""||/\s/.test(s[a-1]||""))){for(;a+1<i&&s[a+1]!==`
742
+ `;)a++,l++,u+=s[a];R=""}else/[a-zA-Z_]/.test(v)?R+=v:(R==="case"?(O++,L=!1):R==="in"&&O>0?L=!0:R==="esac"&&O>0&&(O--,L=!1),R="",v==="("?a>0&&s[a-1]==="$"?x++:L||x++:v===")"?L?L=!1:x--:v===";"&&O>0&&(a+1<i&&s[a+1]===";"||a+1<i&&s[a+1]==="&")&&(L=!0));v===`
743
743
  `&&(c++,l=0,R=""),a++,l++}continue}if(b==="$"&&a+1<i&&s[a+1]==="["&&!h){u+=b,a++,l++,u+=s[a],a++,l++;let x=1;for(;x>0&&a<i;){let S=s[a];u+=S,S==="["?x++:S==="]"?x--:S===`
744
- `&&(c++,l=0),a++,l++}continue}if(b==="$"&&a+1<i&&s[a+1]==="{"&&!h){u+=b,a++,l++,u+=s[a],a++,l++;let x=1,S=!1,$=!1,O=c,L=l,R=c,W=l;for(;x>0&&a<i;){let k=s[a];if(k==="\\"&&a+1<i&&s[a+1]===`
745
- `){a+=2,c++,l=1;continue}if(k==="\\"&&a+1<i&&!S){u+=k,a++,l++,u+=s[a],a++,l++;continue}u+=k,S?k==="'"&&(S=!1):$?k==='"'&&($=!1):k==="'"?(S=!0,O=c,L=l):k==='"'?($=!0,R=c,W=l):k==="{"?x++:k==="}"&&x--,k===`
744
+ `&&(c++,l=0),a++,l++}continue}if(b==="$"&&a+1<i&&s[a+1]==="{"&&!h){u+=b,a++,l++,u+=s[a],a++,l++;let x=1,S=!1,$=!1,O=c,L=l,R=c,W=l;for(;x>0&&a<i;){let v=s[a];if(v==="\\"&&a+1<i&&s[a+1]===`
745
+ `){a+=2,c++,l=1;continue}if(v==="\\"&&a+1<i&&!S){u+=v,a++,l++,u+=s[a],a++,l++;continue}u+=v,S?v==="'"&&(S=!1):$?v==='"'&&($=!1):v==="'"?(S=!0,O=c,L=l):v==='"'?($=!0,R=c,W=l):v==="{"?x++:v==="}"&&x--,v===`
746
746
  `&&(c++,l=0),a++,l++}if(S)throw new Ln("unexpected EOF while looking for matching `''",O,L);if($)throw new Ln("unexpected EOF while looking for matching `\"'",R,W);continue}if(b==="$"&&a+1<i&&!h){let x=s[a+1];if(x==="#"||x==="?"||x==="$"||x==="!"||x==="@"||x==="*"||x==="-"||x>="0"&&x<="9"){u+=b+x,a+=2,l+=2;continue}}if(b==="`"&&!h){for(u+=b,a++,l++;a<i&&s[a]!=="`";){let x=s[a];u+=x,x==="\\"&&a+1<i&&(u+=s[a+1],a++,l++),x===`
747
747
  `&&(c++,l=0),a++,l++}a<i&&(u+=s[a],a++,l++);continue}u+=b,a++,b===`
748
748
  `?(c++,l=1):l++}if(this.pos=a,this.column=l,this.line=c,g&&d&&(u=s[t]+u,f=!1,p=!1),h||m){let b=h?"'":'"';throw new Ln(`unexpected EOF while looking for matching \`${b}'`,n,r)}if(!d&&u.length>=2){if(u[0]==="'"&&u[u.length-1]==="'"){let b=u.slice(1,-1);!b.includes("'")&&!b.includes('"')&&(u=b,f=!0,p=!0)}else if(u[0]==='"'&&u[u.length-1]==='"'){let b=u.slice(1,-1),x=!1;for(let S=0;S<b.length;S++){if(b[S]==='"'){x=!0;break}b[S]==="\\"&&S+1<b.length&&S++}x||(u=b,f=!0,p=!1)}}if(u==="")return{type:E.WORD,value:"",start:t,end:a,line:n,column:r,quoted:f,singleQuoted:p};let y=Q0.get(u);if(!f&&y!==void 0)return{type:y,value:u,start:t,end:a,line:n,column:r};if(!d){let b=Y0(u);if(b>0&&X0(u.slice(0,b)))return{type:E.ASSIGNMENT_WORD,value:u,start:t,end:a,line:n,column:r,quoted:f,singleQuoted:p}}return/^[0-9]+$/.test(u)?{type:E.NUMBER,value:u,start:t,end:a,line:n,column:r}:Mb(u)?{type:E.NAME,value:u,start:t,end:a,line:n,column:r,quoted:f,singleQuoted:p}:{type:E.WORD,value:u,start:t,end:a,line:n,column:r,quoted:f,singleQuoted:p}}readHeredocContent(){for(;this.pendingHeredocs.length>0;){let t=this.pendingHeredocs.shift();if(!t)break;let n=this.pos,r=this.line,s=this.column,i="";for(;this.pos<this.input.length;){let a=this.pos,o="";for(;this.pos<this.input.length&&this.input[this.pos]!==`
@@ -763,47 +763,47 @@ Gid: ${s} ${s} ${s} ${s}
763
763
  `){t+=2;continue}if(/\s/.test(e[t])){t++;continue}break}return t}function $s(e){if(e.includes("#")){let[n,r]=e.split("#"),s=Number.parseInt(n,10);if(s<2||s>64)return Number.NaN;if(s<=36){let a=Number.parseInt(r,s);return a>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:a}let i=0;for(let a of r){let o;if(/[0-9]/.test(a))o=a.charCodeAt(0)-48;else if(/[a-z]/.test(a))o=a.charCodeAt(0)-97+10;else if(/[A-Z]/.test(a))o=a.charCodeAt(0)-65+36;else if(a==="@")o=62;else if(a==="_")o=63;else return Number.NaN;if(o>=s)return Number.NaN;if(i=i*s+o,i>Number.MAX_SAFE_INTEGER)return Number.MAX_SAFE_INTEGER}return i}if(e.startsWith("0x")||e.startsWith("0X")){let n=Number.parseInt(e.slice(2),16);return n>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:n}if(e.startsWith("0")&&e.length>1&&/^[0-9]+$/.test(e)){if(/[89]/.test(e))return Number.NaN;let n=Number.parseInt(e,8);return n>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:n}let t=Number.parseInt(e,10);return t>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:t}function sm(e,t,n,r){if(n.slice(r,r+3)!=="$((")return null;let s=r+3,i=1,a=s;for(;s<n.length-1&&i>0;)n[s]==="("&&n[s+1]==="("?(i++,s+=2):n[s]===")"&&n[s+1]===")"?(i--,i>0&&(s+=2)):s++;let o=n.slice(a,s),{expr:l}=e(t,o,0);return s+=2,{expr:{type:"ArithNested",expression:l},pos:s}}function im(e,t){if(e.slice(t,t+2)!=="$'")return null;let n=t+2,r="";for(;n<e.length&&e[n]!=="'";)if(e[n]==="\\"&&n+1<e.length){let i=e[n+1];switch(i){case"n":r+=`
764
764
  `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case"'":r+="'";break;default:r+=i}n+=2}else r+=e[n],n++;e[n]==="'"&&n++;let s=Number.parseInt(r,10);return{expr:{type:"ArithNumber",value:Number.isNaN(s)?0:s},pos:n}}function am(e,t){if(e.slice(t,t+2)!=='$"')return null;let n=t+2,r="";for(;n<e.length&&e[n]!=='"';)e[n]==="\\"&&n+1<e.length?(r+=e[n+1],n+=2):(r+=e[n],n++);e[n]==='"'&&n++;let s=Number.parseInt(r,10);return{expr:{type:"ArithNumber",value:Number.isNaN(s)?0:s},pos:n}}var qi,om=I(()=>{"use strict";qi=["=","+=","-=","*=","/=","%=","<<=",">>=","&=","|=","^="]});function Ub(e){let t="",n=0;for(;n<e.length;)if(e[n]==='"'){for(n++;n<e.length&&e[n]!=='"';)e[n]==="\\"&&n+1<e.length?(t+=e[n+1],n+=2):(t+=e[n],n++);n<e.length&&n++}else t+=e[n],n++;return t}function Ae(e,t){let n=Ub(t),{expr:r,pos:s}=Ht(e,n,0),i=We(n,s);if(i<n.length){let a=t.slice(i).trim();if(a)return{type:"ArithmeticExpression",originalText:t,expression:{type:"ArithSyntaxError",errorToken:a,message:`${a}: syntax error: invalid arithmetic operator (error token is "${a}")`}}}return{type:"ArithmeticExpression",expression:r,originalText:t}}function Dt(e,t){return{expr:{type:"ArithSyntaxError",errorToken:e,message:`syntax error: operand expected (error token is "${e}")`},pos:t}}function _t(e,t){return We(e,t)>=e.length}function Ht(e,t,n){return Bb(e,t,n)}function Bb(e,t,n){let{expr:r,pos:s}=Os(e,t,n);for(s=We(t,s);t[s]===",";){if(s++,_t(t,s))return Dt(",",s);let{expr:a,pos:o}=Os(e,t,s);r={type:"ArithBinary",operator:",",left:r,right:a},s=We(t,o)}return{expr:r,pos:s}}function Os(e,t,n){let{expr:r,pos:s}=Wb(e,t,n);if(s=We(t,s),t[s]==="?"){s++;let{expr:i,pos:a}=Ht(e,t,s);if(s=We(t,a),t[s]===":"){s++;let{expr:o,pos:l}=Ht(e,t,s);return{expr:{type:"ArithTernary",condition:r,consequent:i,alternate:o},pos:l}}}return{expr:r,pos:s}}function Wb(e,t,n){let{expr:r,pos:s}=lm(e,t,n);for(;s=We(t,s),t.slice(s,s+2)==="||";){if(s+=2,_t(t,s))return Dt("||",s);let{expr:a,pos:o}=lm(e,t,s);r={type:"ArithBinary",operator:"||",left:r,right:a},s=o}return{expr:r,pos:s}}function lm(e,t,n){let{expr:r,pos:s}=cm(e,t,n);for(;s=We(t,s),t.slice(s,s+2)==="&&";){if(s+=2,_t(t,s))return Dt("&&",s);let{expr:a,pos:o}=cm(e,t,s);r={type:"ArithBinary",operator:"&&",left:r,right:a},s=o}return{expr:r,pos:s}}function cm(e,t,n){let{expr:r,pos:s}=um(e,t,n);for(;s=We(t,s),t[s]==="|"&&t[s+1]!=="|";){if(s++,_t(t,s))return Dt("|",s);let{expr:a,pos:o}=um(e,t,s);r={type:"ArithBinary",operator:"|",left:r,right:a},s=o}return{expr:r,pos:s}}function um(e,t,n){let{expr:r,pos:s}=fm(e,t,n);for(;s=We(t,s),t[s]==="^";){if(s++,_t(t,s))return Dt("^",s);let{expr:a,pos:o}=fm(e,t,s);r={type:"ArithBinary",operator:"^",left:r,right:a},s=o}return{expr:r,pos:s}}function fm(e,t,n){let{expr:r,pos:s}=pm(e,t,n);for(;s=We(t,s),t[s]==="&"&&t[s+1]!=="&";){if(s++,_t(t,s))return Dt("&",s);let{expr:a,pos:o}=pm(e,t,s);r={type:"ArithBinary",operator:"&",left:r,right:a},s=o}return{expr:r,pos:s}}function pm(e,t,n){let{expr:r,pos:s}=hm(e,t,n);for(;s=We(t,s),t.slice(s,s+2)==="=="||t.slice(s,s+2)==="!=";){let i=t.slice(s,s+2);if(s+=2,_t(t,s))return Dt(i,s);let{expr:a,pos:o}=hm(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:a},s=o}return{expr:r,pos:s}}function hm(e,t,n){let{expr:r,pos:s}=_l(e,t,n);for(;;)if(s=We(t,s),t.slice(s,s+2)==="<="||t.slice(s,s+2)===">="){let i=t.slice(s,s+2);if(s+=2,_t(t,s))return Dt(i,s);let{expr:a,pos:o}=_l(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:a},s=o}else if(t[s]==="<"||t[s]===">"){let i=t[s];if(s++,_t(t,s))return Dt(i,s);let{expr:a,pos:o}=_l(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:a},s=o}else break;return{expr:r,pos:s}}function _l(e,t,n){let{expr:r,pos:s}=dm(e,t,n);for(;s=We(t,s),t.slice(s,s+2)==="<<"||t.slice(s,s+2)===">>";){let i=t.slice(s,s+2);if(s+=2,_t(t,s))return Dt(i,s);let{expr:a,pos:o}=dm(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:a},s=o}return{expr:r,pos:s}}function dm(e,t,n){let{expr:r,pos:s}=mm(e,t,n);for(;s=We(t,s),(t[s]==="+"||t[s]==="-")&&t[s+1]!==t[s];){let i=t[s];if(s++,_t(t,s))return Dt(i,s);let{expr:a,pos:o}=mm(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:a},s=o}return{expr:r,pos:s}}function mm(e,t,n){let{expr:r,pos:s}=Zi(e,t,n);for(;;)if(s=We(t,s),t[s]==="*"&&t[s+1]!=="*"){if(s++,_t(t,s))return Dt("*",s);let{expr:a,pos:o}=Zi(e,t,s);r={type:"ArithBinary",operator:"*",left:r,right:a},s=o}else if(t[s]==="/"||t[s]==="%"){let i=t[s];if(s++,_t(t,s))return Dt(i,s);let{expr:a,pos:o}=Zi(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:a},s=o}else break;return{expr:r,pos:s}}function Zi(e,t,n){let{expr:r,pos:s}=Ll(e,t,n),i=We(t,s);if(t.slice(i,i+2)==="**"){if(i+=2,_t(t,i))return Dt("**",i);let{expr:o,pos:l}=Zi(e,t,i);return{expr:{type:"ArithBinary",operator:"**",left:r,right:o},pos:l}}return{expr:r,pos:s}}function Ll(e,t,n){let r=We(t,n);if(t.slice(r,r+2)==="++"||t.slice(r,r+2)==="--"){let s=t.slice(r,r+2);r+=2;let{expr:i,pos:a}=Ll(e,t,r);return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:a}}if(t[r]==="+"||t[r]==="-"||t[r]==="!"||t[r]==="~"){let s=t[r];r++;let{expr:i,pos:a}=Ll(e,t,r);return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:a}}return Hb(e,t,r)}function zb(e,t){let n=e[t];return n==="$"||n==="`"}function Hb(e,t,n){let{expr:r,pos:s}=gm(e,t,n,!1),i=[r];for(;zb(t,s);){let{expr:o,pos:l}=gm(e,t,s,!0);i.push(o),s=l}i.length>1&&(r={type:"ArithConcat",parts:i});let a;if(t[s]==="["&&r.type==="ArithConcat"){s++;let{expr:o,pos:l}=Ht(e,t,s);a=o,s=l,t[s]==="]"&&s++}if(a&&r.type==="ArithConcat"&&(r={type:"ArithDynamicElement",nameExpr:r,subscript:a},a=void 0),s=We(t,s),r.type==="ArithConcat"||r.type==="ArithVariable"||r.type==="ArithDynamicElement"){for(let o of qi)if(t.slice(s,s+o.length)===o&&t.slice(s,s+o.length+1)!=="=="){s+=o.length;let{expr:l,pos:c}=Os(e,t,s);return r.type==="ArithDynamicElement"?{expr:{type:"ArithDynamicAssignment",operator:o,target:r.nameExpr,subscript:r.subscript,value:l},pos:c}:r.type==="ArithConcat"?{expr:{type:"ArithDynamicAssignment",operator:o,target:r,value:l},pos:c}:{expr:{type:"ArithAssignment",operator:o,variable:r.name,value:l},pos:c}}}if(t.slice(s,s+2)==="++"||t.slice(s,s+2)==="--"){let o=t.slice(s,s+2);return s+=2,{expr:{type:"ArithUnary",operator:o,operand:r,prefix:!1},pos:s}}return{expr:r,pos:s}}function gm(e,t,n,r=!1){let s=We(t,n),i=sm(Ht,e,t,s);if(i)return i;let a=im(t,s);if(a)return a;let o=am(t,s);if(o)return o;if(t.slice(s,s+2)==="$("&&t[s+2]!=="("){s+=2;let c=1,u=s;for(;s<t.length&&c>0;)t[s]==="("?c++:t[s]===")"&&c--,c>0&&s++;let f=t.slice(u,s);return s++,{expr:{type:"ArithCommandSubst",command:f},pos:s}}if(t[s]==="`"){s++;let c=s;for(;s<t.length&&t[s]!=="`";)s++;let u=t.slice(c,s);return t[s]==="`"&&s++,{expr:{type:"ArithCommandSubst",command:u},pos:s}}if(t[s]==="("){s++;let{expr:c,pos:u}=Ht(e,t,s);return s=We(t,u),t[s]===")"&&s++,{expr:{type:"ArithGroup",expression:c},pos:s}}if(t[s]==="'"){s++;let c="";for(;s<t.length&&t[s]!=="'";)c+=t[s],s++;t[s]==="'"&&s++;let u=Number.parseInt(c,10);return{expr:{type:"ArithSingleQuote",content:c,value:Number.isNaN(u)?0:u},pos:s}}if(t[s]==='"'){s++;let c="";for(;s<t.length&&t[s]!=='"';)t[s]==="\\"&&s+1<t.length?(c+=t[s+1],s+=2):(c+=t[s],s++);t[s]==='"'&&s++;let u=c.trim();if(!u)return{expr:{type:"ArithNumber",value:0},pos:s};let{expr:f}=Ht(e,u,0);return{expr:f,pos:s}}if(/[0-9]/.test(t[s])){let c="",u=!1,f=!1;for(;s<t.length;){let h=t[s];if(u)if(/[0-9a-zA-Z@_]/.test(h))c+=h,s++;else break;else if(h==="#")u=!0,c+=h,s++;else if(c==="0"&&(h==="x"||h==="X")&&s+1<t.length&&/[0-9a-fA-F]/.test(t[s+1]))f=!0,c+=h,s++;else if(f&&/[0-9a-fA-F]/.test(h))c+=h,s++;else if(!f&&/[0-9]/.test(h))c+=h,s++;else break}if(s<t.length&&/[a-zA-Z_]/.test(t[s])){let h=c;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)h+=t[s],s++;return{expr:{type:"ArithSyntaxError",errorToken:h,message:`${h}: value too great for base (error token is "${h}")`},pos:s}}if(t[s]==="."&&/[0-9]/.test(t[s+1]))throw new Oe(`${c}.${t[s+1]}...: syntax error: invalid arithmetic operator`);if(t[s]==="["){let h=t.slice(s).trim();return{expr:{type:"ArithNumberSubscript",number:c,errorToken:h},pos:t.length}}return{expr:{type:"ArithNumber",value:$s(c)},pos:s}}if(t[s]==="$"&&t[s+1]==="{"){let c=s+2,u=1,f=c;for(;f<t.length&&u>0;)t[f]==="{"?u++:t[f]==="}"&&u--,u>0&&f++;let p=t.slice(c,f),h=f+1;if(t[h]==="#"){let m=h+1;for(;m<t.length&&/[0-9a-zA-Z@_]/.test(t[m]);)m++;let d=t.slice(h+1,m);return{expr:{type:"ArithDynamicBase",baseExpr:p,value:d},pos:m}}if(/[0-9]/.test(t[h])||t[h]==="x"||t[h]==="X"){let m=h;if(t[h]==="x"||t[h]==="X")for(m++;m<t.length&&/[0-9a-fA-F]/.test(t[m]);)m++;else for(;m<t.length&&/[0-9]/.test(t[m]);)m++;let d=t.slice(h,m);return{expr:{type:"ArithDynamicNumber",prefix:p,suffix:d},pos:m}}return s=h,{expr:{type:"ArithBracedExpansion",content:p},pos:s}}if(t[s]==="$"&&s+1<t.length&&/[0-9]/.test(t[s+1])){s++;let c="";for(;s<t.length&&/[0-9]/.test(t[s]);)c+=t[s],s++;return{expr:{type:"ArithVariable",name:c,hasDollarPrefix:!0},pos:s}}if(t[s]==="$"&&s+1<t.length&&/[*@#?\-!$]/.test(t[s+1])){let c=t[s+1];return s+=2,{expr:{type:"ArithSpecialVar",name:c},pos:s}}let l=!1;if(t[s]==="$"&&s+1<t.length&&/[a-zA-Z_]/.test(t[s+1])&&(l=!0,s++),s<t.length&&/[a-zA-Z_]/.test(t[s])){let c="";for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)c+=t[s],s++;if(t[s]==="["&&!r){s++;let u;if(t[s]==="'"||t[s]==='"'){let p=t[s];for(s++,u="";s<t.length&&t[s]!==p;)u+=t[s],s++;t[s]===p&&s++,s=We(t,s),t[s]==="]"&&s++}let f;if(u===void 0){let{expr:p,pos:h}=Ht(e,t,s);f=p,s=h,t[s]==="]"&&s++}if(s=We(t,s),t[s]==="["&&f)return{expr:{type:"ArithDoubleSubscript",array:c,index:f},pos:s};if(!r){for(let p of qi)if(t.slice(s,s+p.length)===p&&t.slice(s,s+p.length+1)!=="=="){s+=p.length;let{expr:h,pos:m}=Os(e,t,s);return{expr:{type:"ArithAssignment",operator:p,variable:c,subscript:f,stringKey:u,value:h},pos:m}}}return{expr:{type:"ArithArrayElement",array:c,index:f,stringKey:u},pos:s}}if(s=We(t,s),!r){for(let u of qi)if(t.slice(s,s+u.length)===u&&t.slice(s,s+u.length+1)!=="=="){s+=u.length;let{expr:f,pos:p}=Os(e,t,s);return{expr:{type:"ArithAssignment",operator:u,variable:c,value:f},pos:p}}}return{expr:{type:"ArithVariable",name:c,hasDollarPrefix:l},pos:s}}if(t[s]==="#"){let c=s+1;for(;c<t.length&&t[c]!==`
765
765
  `;)c++;let u=t.slice(s,c).trim()||"#";return{expr:{type:"ArithSyntaxError",errorToken:u,message:`${u}: syntax error: invalid arithmetic operator (error token is "${u}")`},pos:t.length}}return{expr:{type:"ArithNumber",value:0},pos:s}}var mt=I(()=>{"use strict";ye();om()});function jb(e){let t="",n=0;for(;n<e.length;){let r=e[n];if(r<128){t+=String.fromCharCode(r),n++;continue}if((r&224)===192){if(n+1<e.length&&(e[n+1]&192)===128&&r>=194){let s=(r&31)<<6|e[n+1]&63;t+=String.fromCharCode(s),n+=2;continue}t+=String.fromCharCode(r),n++;continue}if((r&240)===224){if(n+2<e.length&&(e[n+1]&192)===128&&(e[n+2]&192)===128){if(r===224&&e[n+1]<160){t+=String.fromCharCode(r),n++;continue}let s=(r&15)<<12|(e[n+1]&63)<<6|e[n+2]&63;if(s>=55296&&s<=57343){t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(s),n+=3;continue}t+=String.fromCharCode(r),n++;continue}if((r&248)===240&&r<=244){if(n+3<e.length&&(e[n+1]&192)===128&&(e[n+2]&192)===128&&(e[n+3]&192)===128){if(r===240&&e[n+1]<144){t+=String.fromCharCode(r),n++;continue}let s=(r&7)<<18|(e[n+1]&63)<<12|(e[n+2]&63)<<6|e[n+3]&63;if(s>1114111){t+=String.fromCharCode(r),n++;continue}t+=String.fromCodePoint(s),n+=4;continue}t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(r),n++}return t}function bm(e,t,n){let r=n+1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;return r}function Fl(e,t,n,r,s){let i=1,a=n+1;for(;a<t.length&&i>0;)t[a]===r?i++:t[a]===s&&i--,i>0&&a++;return i===0?a:-1}function cr(e,t,n){let r=n,s=1;for(;r<t.length&&s>0;){let i=t[r];if(i==="\\"&&r+1<t.length){r+=2;continue}if(i==="'"){let a=t.indexOf("'",r+1);if(a!==-1){r=a+1;continue}}if(i==='"'){for(r++;r<t.length&&t[r]!=='"';)t[r]==="\\"&&r+1<t.length?r+=2:r++;r<t.length&&r++;continue}i==="{"?s++:i==="}"&&s--,s>0&&r++}return r}function xm(e,t,n){let r=n,s=!1;for(;r<t.length;){let i=t[r];if(i==="/"&&s||i==="}")break;if(i==="'"){let a=t.indexOf("'",r+1);if(a!==-1){r=a+1,s=!0;continue}}if(i==='"'){for(r++;r<t.length&&t[r]!=='"';)t[r]==="\\"&&r+1<t.length?r+=2:r++;r<t.length&&r++,s=!0;continue}i==="\\"?(r+=2,s=!0):(r++,s=!0)}return r}function Em(e,t,n){let r=n,s="";for(;r<t.length;){let i=t[r];if(i==="*"||i==="?")s+=i,r++;else if(i==="["){let a=Gb(t,r);a===-1?(s+=i,r++):(s+=t.slice(r,a+1),r=a+1)}else break}return{pattern:s,endIndex:r}}function Gb(e,t){let n=t+1;for(n<e.length&&e[n]==="^"&&n++,n<e.length&&e[n]==="]"&&n++;n<e.length;){let r=e[n];if(r==="\\"&&n+1<e.length){let s=e[n+1];if(s==='"'||s==="'")return-1;n+=2;continue}if(r==="]")return n;if(r==='"'||r==="$"||r==="`")return-1;if(r==="'"){let s=e.indexOf("'",n+1);if(s!==-1){n=s+1;continue}}if(r==="["&&n+1<e.length&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){n=s+2;continue}}if(r==="["&&n+1<e.length&&(e[n+1]==="."||e[n+1]==="=")){let i=`${e[n+1]}]`,a=e.indexOf(i,n+2);if(a!==-1){n=a+2;continue}}n++}return-1}function Am(e,t,n){let r="",s=n;for(;s<t.length&&t[s]!=="'";){let i=t[s];if(i==="\\"&&s+1<t.length)switch(t[s+1]){case"n":r+=`
766
- `,s+=2;break;case"t":r+=" ",s+=2;break;case"r":r+="\r",s+=2;break;case"\\":r+="\\",s+=2;break;case"'":r+="'",s+=2;break;case'"':r+='"',s+=2;break;case"a":r+="\x07",s+=2;break;case"b":r+="\b",s+=2;break;case"e":case"E":r+="\x1B",s+=2;break;case"f":r+="\f",s+=2;break;case"v":r+="\v",s+=2;break;case"x":{let o=[],l=s;for(;l+1<t.length&&t[l]==="\\"&&t[l+1]==="x";){let c=t.slice(l+2,l+4),u=parseInt(c,16);if(!Number.isNaN(u)&&c.length>0)o.push(u),l+=2+c.length;else break}o.length>0?(r+=jb(o),s=l):(r+="\\x",s+=2);break}case"u":{let o=t.slice(s+2,s+6),l=parseInt(o,16);Number.isNaN(l)?(r+="\\u",s+=2):(r+=String.fromCharCode(l),s+=6);break}case"c":{if(s+2<t.length){let l=t[s+2].charCodeAt(0)&31;r+=String.fromCharCode(l),s+=3}else r+="\\c",s+=2;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let o="",l=s+1;for(;l<t.length&&l<s+4&&/[0-7]/.test(t[l]);)o+=t[l],l++;let c=parseInt(o,8);r+=String.fromCharCode(c),s=l;break}default:r+=i,s++}else r+=i,s++}return s<t.length&&t[s]==="'"&&s++,{part:q.literal(r),endIndex:s}}function Ml(e,t){let n=t.trim();return n===""?{type:"ArithmeticExpression",expression:{type:"ArithNumber",value:0}}:Ae(e,n)}function wm(e){let t=[],n="",r=0;for(let s=0;s<e.length;s++){let i=e[s];i==="{"?(r++,n+=i):i==="}"?(r--,n+=i):i===","&&r===0?(t.push(n),n=""):n+=i}return t.push(n),t}function Sm(e,t,n,r){let s=Fl(e,t,n,"{","}");if(s===-1)return null;let i=t.slice(n+1,s),a=i.match(/^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/);if(a)return{part:{type:"BraceExpansion",items:[{type:"Range",start:Number.parseInt(a[1],10),end:Number.parseInt(a[2],10),step:a[3]?Number.parseInt(a[3],10):void 0,startStr:a[1],endStr:a[2]}]},endIndex:s+1};let o=i.match(/^([a-zA-Z])\.\.([a-zA-Z])(?:\.\.(-?\d+))?$/);return o?{part:{type:"BraceExpansion",items:[{type:"Range",start:o[1],end:o[2],step:o[3]?Number.parseInt(o[3],10):void 0}]},endIndex:s+1}:i.includes(",")&&r?{part:{type:"BraceExpansion",items:wm(i).map(u=>({type:"Word",word:q.word(r(e,u,!1,!1,!1))}))},endIndex:s+1}:i.includes(",")?{part:{type:"BraceExpansion",items:wm(i).map(u=>({type:"Word",word:q.word([q.literal(u)])}))},endIndex:s+1}:null}function Ul(e,t){let n="";for(let r of t.parts)switch(r.type){case"Literal":n+=r.value;break;case"SingleQuoted":n+=`'${r.value}'`;break;case"Escaped":n+=r.value;break;case"DoubleQuoted":n+='"';for(let s of r.parts)s.type==="Literal"||s.type==="Escaped"?n+=s.value:s.type==="ParameterExpansion"&&(n+=`\${${s.parameter}}`);n+='"';break;case"ParameterExpansion":n+=`\${${r.parameter}}`;break;case"Glob":n+=r.pattern;break;case"TildeExpansion":n+="~",r.user&&(n+=r.user);break;case"BraceExpansion":{n+="{";let s=[];for(let i of r.items)if(i.type==="Range"){let a=i.startStr??String(i.start),o=i.endStr??String(i.end);i.step!==void 0?s.push(`${a}..${o}..${i.step}`):s.push(`${a}..${o}`)}else s.push(Ul(e,i.word));s.length===1&&r.items[0].type==="Range"?n+=s[0]:n+=s.join(","),n+="}";break}default:n+=r.type}return n}function Cm(e,t){return{[E.LESS]:"<",[E.GREAT]:">",[E.DGREAT]:">>",[E.LESSAND]:"<&",[E.GREATAND]:">&",[E.LESSGREAT]:"<>",[E.CLOBBER]:">|",[E.TLESS]:"<<<",[E.AND_GREAT]:"&>",[E.AND_DGREAT]:"&>>",[E.DLESS]:"<",[E.DLESSDASH]:"<"}[t]||">"}var Bl=I(()=>{"use strict";lr();mt();Fn()});function Ki(e){let t=e.current(),n=t.type;if(n===E.NUMBER){let r=e.peek(1);return t.end!==r.start?!1:nm.has(r.type)}if(n===E.FD_VARIABLE){let r=e.peek(1);return rm.has(r.type)}return tm.has(n)}function Qi(e){let t=null,n;e.check(E.NUMBER)?t=Number.parseInt(e.advance().value,10):e.check(E.FD_VARIABLE)&&(n=e.advance().value);let r=e.advance(),s=Cm(e,r.type);if(r.type===E.DLESS||r.type===E.DLESSDASH)return Vb(e,s,t,r.type===E.DLESSDASH);e.isWord()||e.error("Expected redirection target");let i=e.parseWord();return q.redirection(s,i,t,n)}function Vb(e,t,n,r){e.isWord()||e.error("Expected here-document delimiter");let s=e.advance(),i=s.value,a=s.quoted||!1;(i.startsWith("'")&&i.endsWith("'")||i.startsWith('"')&&i.endsWith('"'))&&(i=i.slice(1,-1));let o=q.redirection(r?"<<-":"<<",q.hereDoc(i,q.word([]),r,a),n);return e.addPendingHeredoc(o,i,r,a),o}function km(e){let t=e.current().line,n=[],r=null,s=[],i=[];for(;e.check(E.ASSIGNMENT_WORD)||Ki(e);)e.checkIterationLimit(),e.check(E.ASSIGNMENT_WORD)?n.push(qb(e)):i.push(Qi(e));if(e.isWord())r=e.parseWord();else if(n.length>0&&(e.check(E.DBRACK_START)||e.check(E.DPAREN_START))){let o=e.advance();r=q.word([q.literal(o.value)])}for(;(!e.isStatementEnd()||e.check(E.RBRACE))&&!e.check(E.PIPE,E.PIPE_AMP);)if(e.checkIterationLimit(),Ki(e))i.push(Qi(e));else if(e.check(E.RBRACE)){let o=e.advance();s.push(e.parseWordFromString(o.value,!1,!1))}else if(e.check(E.LBRACE)){let o=e.advance();s.push(e.parseWordFromString(o.value,!1,!1))}else if(e.check(E.DBRACK_END)){let o=e.advance();s.push(e.parseWordFromString(o.value,!1,!1))}else if(e.isWord())s.push(e.parseWord());else if(e.check(E.ASSIGNMENT_WORD)){let o=e.advance(),l=o.value,c=l.endsWith("="),u=l.endsWith("=(");if((c||u)&&(u||e.check(E.LPAREN))){let f=u?l.slice(0,-2):l.slice(0,-1);u||e.expect(E.LPAREN);let p=Wl(e);e.expect(E.RPAREN);let h=p.map(d=>Ul(e,d)),m=`${f}=(${h.join(" ")})`;s.push(e.parseWordFromString(m,!1,!1))}else s.push(e.parseWordFromString(l,o.quoted,o.singleQuoted))}else if(e.check(E.LPAREN))e.error("syntax error near unexpected token `('");else break;let a=q.simpleCommand(r,s,n,i);return a.line=t,a}function qb(e){let t=e.expect(E.ASSIGNMENT_WORD),n=t.value,r=n.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);r||e.error(`Invalid assignment: ${n}`);let s=r[0],i,a=s.length;if(n[a]==="["){let f=0,p=a+1;for(;a<n.length;a++)if(n[a]==="[")f++;else if(n[a]==="]"&&(f--,f===0))break;f!==0&&e.error(`Invalid assignment: ${n}`),i=n.slice(p,a),a++}let o=n[a]==="+";o&&a++,n[a]!=="="&&e.error(`Invalid assignment: ${n}`),a++;let l=n.slice(a);if(l==="("){let f=Wl(e);e.expect(E.RPAREN);let p=i!==void 0?`${s}[${i}]`:s;return q.assignment(p,null,o,f)}if(l===""&&e.check(E.LPAREN)){let f=e.current();if(t.end===f.start){e.advance();let p=Wl(e);e.expect(E.RPAREN);let h=i!==void 0?`${s}[${i}]`:s;return q.assignment(h,null,o,p)}}let c=l?e.parseWordFromString(l,t.quoted,t.singleQuoted,!0):null,u=i!==void 0?`${s}[${i}]`:s;return q.assignment(u,c,o,null)}function Wl(e){let t=[];for(e.skipNewlines();!e.check(E.RPAREN,E.EOF);)e.checkIterationLimit(),e.isWord()?t.push(e.parseWord()):Zb.has(e.current().type)?e.error(`syntax error near unexpected token \`${e.current().value}'`):e.advance(),e.skipNewlines();return t}var Zb,vm=I(()=>{"use strict";lr();Fn();or();Bl();Zb=new Set([E.AMP,E.PIPE,E.PIPE_AMP,E.SEMICOLON,E.AND_AND,E.OR_OR,E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND])});function zl(e,t){e.expect(E.IF);let n=[],r=e.parseCompoundList();e.expect(E.THEN);let s=e.parseCompoundList();if(s.length===0){let o=e.check(E.FI)?"fi":e.check(E.ELSE)?"else":e.check(E.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${o}'`)}for(n.push({condition:r,body:s});e.check(E.ELIF);){e.advance();let o=e.parseCompoundList();e.expect(E.THEN);let l=e.parseCompoundList();if(l.length===0){let c=e.check(E.FI)?"fi":e.check(E.ELSE)?"else":e.check(E.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${c}'`)}n.push({condition:o,body:l})}let i=null;e.check(E.ELSE)&&(e.advance(),i=e.parseCompoundList(),i.length===0&&e.error("syntax error near unexpected token `fi'")),e.expect(E.FI);let a=t?.skipRedirections?[]:e.parseOptionalRedirections();return q.ifNode(n,i,a)}function Hl(e,t){let n=e.expect(E.FOR);if(e.check(E.DPAREN_START))return Qb(e,t,n.line);e.isWord()||e.error("Expected variable name in for loop");let s=e.advance().value,i=null;if(e.skipNewlines(),e.check(E.IN))for(e.advance(),i=[];!e.check(E.SEMICOLON,E.NEWLINE,E.DO,E.EOF)&&e.isWord();)i.push(e.parseWord());e.check(E.SEMICOLON)&&e.advance(),e.skipNewlines(),e.expect(E.DO);let a=e.parseCompoundList();e.expect(E.DONE);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return q.forNode(s,i,a,o)}function Qb(e,t,n){e.expect(E.DPAREN_START);let r=null,s=null,i=null,a=["","",""],o=0,l=0;for(;!e.check(E.DPAREN_END,E.EOF);){let f=e.advance();if(f.type===E.SEMICOLON&&l===0){if(o++,o>2)break}else f.value==="("&&l++,f.value===")"&&l--,a[o]+=f.value}e.expect(E.DPAREN_END),a[0].trim()&&(r=Ae(e,a[0].trim())),a[1].trim()&&(s=Ae(e,a[1].trim())),a[2].trim()&&(i=Ae(e,a[2].trim())),e.skipNewlines(),e.check(E.SEMICOLON)&&e.advance(),e.skipNewlines();let c;e.check(E.LBRACE)?(e.advance(),c=e.parseCompoundList(),e.expect(E.RBRACE)):(e.expect(E.DO),c=e.parseCompoundList(),e.expect(E.DONE));let u=t?.skipRedirections?[]:e.parseOptionalRedirections();return{type:"CStyleFor",init:r,condition:s,update:i,body:c,redirections:u,line:n}}function jl(e,t){e.expect(E.WHILE);let n=e.parseCompoundList();e.expect(E.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(E.DONE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return q.whileNode(n,r,s)}function Gl(e,t){e.expect(E.UNTIL);let n=e.parseCompoundList();e.expect(E.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(E.DONE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return q.untilNode(n,r,s)}function Vl(e,t){e.expect(E.CASE),e.isWord()||e.error("Expected word after 'case'");let n=e.parseWord();e.skipNewlines(),e.expect(E.IN),e.skipNewlines();let r=[];for(;!e.check(E.ESAC,E.EOF);){e.checkIterationLimit();let i=e.getPos(),a=Xb(e);if(a&&r.push(a),e.skipNewlines(),e.getPos()===i&&!a)break}e.expect(E.ESAC);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return q.caseNode(n,r,s)}function Xb(e){e.check(E.LPAREN)&&e.advance();let t=[];for(;e.isWord()&&(t.push(e.parseWord()),e.check(E.PIPE));)e.advance();if(t.length===0)return null;e.expect(E.RPAREN),e.skipNewlines();let n=[];for(;!e.check(E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND,E.ESAC,E.EOF);){e.checkIterationLimit(),e.isWord()&&e.peek(1).type===E.RPAREN&&e.error("syntax error near unexpected token `)'"),e.check(E.LPAREN)&&e.peek(1).type===E.WORD&&e.error(`syntax error near unexpected token \`${e.peek(1).value}'`);let s=e.getPos(),i=e.parseStatement();if(i&&n.push(i),e.skipSeparators(!1),e.getPos()===s&&!i)break}let r=";;";return e.check(E.DSEMI)?(e.advance(),r=";;"):e.check(E.SEMI_AND)?(e.advance(),r=";&"):e.check(E.SEMI_SEMI_AND)&&(e.advance(),r=";;&"),q.caseItem(t,n,r)}function ql(e,t){e.expect(E.LPAREN);let n=e.parseCompoundList();e.expect(E.RPAREN);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return q.subshell(n,r)}function Zl(e,t){e.expect(E.LBRACE);let n=e.parseCompoundList();e.expect(E.RBRACE);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return q.group(n,r)}var Im=I(()=>{"use strict";lr();mt();Fn()});function $m(e){return e.isWord()||e.check(E.LBRACE)||e.check(E.RBRACE)||e.check(E.ASSIGNMENT_WORD)}function Om(e){if(e.check(E.BANG)&&e.peek(1).type===E.LPAREN){e.advance(),e.advance();let t=1,n="!(";for(;t>0&&!e.check(E.EOF);)if(e.check(E.LPAREN))t++,n+="(",e.advance();else if(e.check(E.RPAREN))t--,t>0&&(n+=")"),e.advance();else if(e.isWord())n+=e.advance().value;else if(e.check(E.PIPE))n+="|",e.advance();else break;return n+=")",e.parseWordFromString(n,!1,!1,!1,!1,!0)}return e.parseWordNoBraceExpansion()}function Ql(e){return e.skipNewlines(),tx(e)}function tx(e){let t=Rm(e);for(e.skipNewlines();e.check(E.OR_OR);){e.advance(),e.skipNewlines();let n=Rm(e);t={type:"CondOr",left:t,right:n},e.skipNewlines()}return t}function Rm(e){let t=Kl(e);for(e.skipNewlines();e.check(E.AND_AND);){e.advance(),e.skipNewlines();let n=Kl(e);t={type:"CondAnd",left:t,right:n},e.skipNewlines()}return t}function Kl(e){return e.skipNewlines(),e.check(E.BANG)?(e.advance(),e.skipNewlines(),{type:"CondNot",operand:Kl(e)}):nx(e)}function nx(e){if(e.check(E.LPAREN)){e.advance();let t=Ql(e);return e.expect(E.RPAREN),{type:"CondGroup",expression:t}}if($m(e)){let t=e.current(),n=t.value;if(Jb.includes(n)&&!t.quoted){if(e.advance(),e.check(E.DBRACK_END)&&e.error(`Expected operand after ${n}`),$m(e)){let i=e.parseWordNoBraceExpansion();return{type:"CondUnary",operator:n,operand:i}}let s=e.current();e.error(`unexpected argument \`${s.value}' to conditional unary operator`)}let r=e.parseWordNoBraceExpansion();if(e.isWord()&&ex.includes(e.current().value)){let s=e.advance().value,i;return s==="=~"?i=rx(e):s==="=="||s==="!="?i=Om(e):i=e.parseWordNoBraceExpansion(),{type:"CondBinary",operator:s,left:r,right:i}}if(e.check(E.LESS)){e.advance();let s=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:"<",left:r,right:s}}if(e.check(E.GREAT)){e.advance();let s=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:">",left:r,right:s}}if(e.isWord()&&e.current().value==="="){e.advance();let s=Om(e);return{type:"CondBinary",operator:"==",left:r,right:s}}return{type:"CondWord",word:r}}e.error("Expected conditional expression")}function rx(e){let t=[],n=0,r=-1,s=e.getInput(),i=()=>e.check(E.DBRACK_END)||e.check(E.AND_AND)||e.check(E.OR_OR)||e.check(E.NEWLINE)||e.check(E.EOF);for(;!i();){let a=e.current(),o=r>=0&&a.start>r;if(n===0&&o)break;if(n>0&&o){let l=s.slice(r,a.start);t.push({type:"Literal",value:l})}if(e.isWord()||e.check(E.ASSIGNMENT_WORD)){let l=e.parseWordForRegex();t.push(...l.parts),r=e.peek(-1).end}else if(e.check(E.LPAREN)){let l=e.advance();t.push({type:"Literal",value:"("}),n++,r=l.end}else if(e.check(E.DPAREN_START)){let l=e.advance();t.push({type:"Literal",value:"(("}),n+=2,r=l.end}else if(e.check(E.DPAREN_END))if(n>=2){let l=e.advance();t.push({type:"Literal",value:"))"}),n-=2,r=l.end}else{if(n===1)break;break}else if(e.check(E.RPAREN))if(n>0){let l=e.advance();t.push({type:"Literal",value:")"}),n--,r=l.end}else break;else if(e.check(E.PIPE)){let l=e.advance();t.push({type:"Literal",value:"|"}),r=l.end}else if(e.check(E.SEMICOLON))if(n>0){let l=e.advance();t.push({type:"Literal",value:";"}),r=l.end}else break;else if(n>0&&e.check(E.LESS)){let l=e.advance();t.push({type:"Literal",value:"<"}),r=l.end}else if(n>0&&e.check(E.GREAT)){let l=e.advance();t.push({type:"Literal",value:">"}),r=l.end}else if(n>0&&e.check(E.DGREAT)){let l=e.advance();t.push({type:"Literal",value:">>"}),r=l.end}else if(n>0&&e.check(E.DLESS)){let l=e.advance();t.push({type:"Literal",value:"<<"}),r=l.end}else if(n>0&&e.check(E.LESSAND)){let l=e.advance();t.push({type:"Literal",value:"<&"}),r=l.end}else if(n>0&&e.check(E.GREATAND)){let l=e.advance();t.push({type:"Literal",value:">&"}),r=l.end}else if(n>0&&e.check(E.LESSGREAT)){let l=e.advance();t.push({type:"Literal",value:"<>"}),r=l.end}else if(n>0&&e.check(E.CLOBBER)){let l=e.advance();t.push({type:"Literal",value:">|"}),r=l.end}else if(n>0&&e.check(E.TLESS)){let l=e.advance();t.push({type:"Literal",value:"<<<"}),r=l.end}else if(n>0&&e.check(E.AMP)){let l=e.advance();t.push({type:"Literal",value:"&"}),r=l.end}else if(n>0&&e.check(E.LBRACE)){let l=e.advance();t.push({type:"Literal",value:"{"}),r=l.end}else if(n>0&&e.check(E.RBRACE)){let l=e.advance();t.push({type:"Literal",value:"}"}),r=l.end}else break}return t.length===0&&e.error("Expected regex pattern after =~"),{type:"Word",parts:t}}var Jb,ex,Tm=I(()=>{"use strict";Fn();Jb=["-a","-b","-c","-d","-e","-f","-g","-h","-k","-p","-r","-s","-t","-u","-w","-x","-G","-L","-N","-O","-S","-z","-n","-o","-v","-R"],ex=["==","!=","=~","<",">","-eq","-ne","-lt","-le","-gt","-ge","-nt","-ot","-ef"]});function ix(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if("@*+?!".includes(s)&&r+1<e.length&&e[r+1]==="("){r++,n++,r++;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function ax(e,t,n){let r=n+1,s=t[r];if("@*#?$!-0123456789".includes(s))return{part:q.parameterExpansion(s),endIndex:r+1};let i="";for(;r<t.length&&/[a-zA-Z0-9_]/.test(t[r]);)i+=t[r],r++;return{part:q.parameterExpansion(i),endIndex:r}}function ox(e,t,n,r=!1){let s=n+2,i=!1;t[s]==="!"&&(i=!0,s++);let a=!1;t[s]==="#"&&!/[}:#%/^,]/.test(t[s+1]||"}")&&(a=!0,s++);let o="",l=t[s];if(/[@*#?$!-]/.test(l)&&!/[a-zA-Z0-9_]/.test(t[s+1]||""))o=l,s++;else for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)o+=t[s],s++;if(t[s]==="["){let u=Fl(e,t,s,"[","]");if(o+=t.slice(s,u+1),s=u+1,t[s]==="["){let f=1,p=s;for(;p<t.length&&f>0;)t[p]==="{"?f++:t[p]==="}"&&f--,f>0&&p++;let h=t.slice(n+2,p);return{part:q.parameterExpansion("",{type:"BadSubstitution",text:h}),endIndex:p+1}}}if(o===""&&!i&&!a&&t[s]!=="}"){let u=1,f=s;for(;f<t.length&&u>0;)t[f]==="{"?u++:t[f]==="}"&&u--,u>0&&f++;if(u>0)throw new lt("unexpected EOF while looking for matching '}'",0,0);let p=t.slice(n+2,f);return{part:q.parameterExpansion("",{type:"BadSubstitution",text:p}),endIndex:f+1}}let c=null;if(i){let u=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(u)if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=Xl(e,t,s,o,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):(c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},o="")}else c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},o="";else if(t[s]==="*"||t[s]==="@"&&!/[QPaAEKkuUL]/.test(t[s+1]||"")){let f=t[s];s++,c={type:"VarNamePrefix",prefix:o,star:f==="*"},o=""}else if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=Xl(e,t,s,o,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):c={type:"Indirection"}}else c={type:"Indirection"}}else if(a)if(t[s]===":")for(c={type:"LengthSliceError"};s<t.length&&t[s]!=="}";)s++;else t[s]!=="}"&&/[-+=?]/.test(t[s])?e.error(`\${#${o}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):t[s]==="/"?e.error(`\${#${o}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):c={type:"Length"};if(!c&&s<t.length&&t[s]!=="}"){let u=Xl(e,t,s,o,r);c=u.operation,s=u.endIndex}if(s<t.length&&t[s]!=="}"){let u=t[s];if(!/[:\-+=?#%/^,@[]/.test(u)){let f=s;for(;f<t.length&&t[f]!=="}";)f++;let p=t.slice(n,f+1);e.error(`\${${p.slice(2,-1)}}: bad substitution`)}}for(;s<t.length&&t[s]!=="}";)s++;if(s>=t.length)throw new lt("unexpected EOF while looking for matching '}'",0,0);return{part:q.parameterExpansion(o,c),endIndex:s+1}}function Xl(e,t,n,r,s=!1){let i=n,a=t[i],o=t[i+1]||"";if(a===":"){let l=o;if("-=?+".includes(l)){i+=2;let w=cr(e,t,i),y=t.slice(i,w),b=Mn(e,y,!1,!1,!0,!1,s,!1,!1,!0),x=q.word(b.length>0?b:[q.literal("")]);if(l==="-")return{operation:{type:"DefaultValue",word:x,checkEmpty:!0},endIndex:w};if(l==="=")return{operation:{type:"AssignDefault",word:x,checkEmpty:!0},endIndex:w};if(l==="?")return{operation:{type:"ErrorIfUnset",word:x,checkEmpty:!0},endIndex:w};if(l==="+")return{operation:{type:"UseAlternative",word:x,checkEmpty:!0},endIndex:w}}i++;let c=cr(e,t,i),u=t.slice(i,c),f=-1,p=0,h=0;for(let g=0;g<u.length;g++){let w=u[g];if(w==="("||w==="[")p++;else if(w===")"||w==="]")p--;else if(w==="?"&&p===0)h++;else if(w===":"&&p===0)if(h>0)h--;else{f=g;break}}let m=f>=0?u.slice(0,f):u,d=f>=0?u.slice(f+1):null;return{operation:{type:"Substring",offset:Ml(e,m),length:d!==null?Ml(e,d):null},endIndex:c}}if("-=?+".includes(a)){i++;let l=cr(e,t,i),c=t.slice(i,l),u=Mn(e,c,!1,!1,!0,!1,s,!1,!1,!0),f=q.word(u.length>0?u:[q.literal("")]);if(a==="-")return{operation:{type:"DefaultValue",word:f,checkEmpty:!1},endIndex:l};if(a==="=")return{operation:{type:"AssignDefault",word:f,checkEmpty:!1},endIndex:l};if(a==="?")return{operation:{type:"ErrorIfUnset",word:c?f:null,checkEmpty:!1},endIndex:l};if(a==="+")return{operation:{type:"UseAlternative",word:f,checkEmpty:!1},endIndex:l}}if(a==="#"||a==="%"){let l=o===a,c=a==="#"?"prefix":"suffix";i+=l?2:1;let u=cr(e,t,i),f=t.slice(i,u),p=Mn(e,f,!1,!1,!1);return{operation:{type:"PatternRemoval",pattern:q.word(p.length>0?p:[q.literal("")]),side:c,greedy:l},endIndex:u}}if(a==="/"){let l=o==="/";i+=l?2:1;let c=null;t[i]==="#"?(c="start",i++):t[i]==="%"&&(c="end",i++);let u;c!==null&&(t[i]==="/"||t[i]==="}")?u=i:u=xm(e,t,i);let f=t.slice(i,u),p=Mn(e,f,!1,!1,!1),h=q.word(p.length>0?p:[q.literal("")]),m=null,d=u;if(t[u]==="/"){let g=u+1,w=cr(e,t,g),y=t.slice(g,w),b=Mn(e,y,!1,!1,!1);m=q.word(b.length>0?b:[q.literal("")]),d=w}return{operation:{type:"PatternReplacement",pattern:h,replacement:m,all:l,anchor:c},endIndex:d}}if(a==="^"||a===","){let l=o===a,c=a==="^"?"upper":"lower";i+=l?2:1;let u=cr(e,t,i),f=t.slice(i,u),p=f?q.word([q.literal(f)]):null;return{operation:{type:"CaseModification",direction:c,all:l,pattern:p},endIndex:u}}return a==="@"&&/[QPaAEKkuUL]/.test(o)?{operation:{type:"Transform",operator:o},endIndex:i+2}:{operation:null,endIndex:i}}function Yl(e,t,n,r=!1){let s=n+1;if(s>=t.length)return{part:q.literal("$"),endIndex:s};let i=t[s];if(i==="("&&t[s+1]==="(")return e.isDollarDparenSubshell(t,n)?e.parseCommandSubstitution(t,n):e.parseArithmeticExpansion(t,n);if(i==="["){let a=1,o=s+1;for(;o<t.length&&a>0;)t[o]==="["?a++:t[o]==="]"&&a--,a>0&&o++;if(a===0){let l=t.slice(s+1,o),c=Ae(e,l);return{part:q.arithmeticExpansion(c),endIndex:o+1}}}return i==="("?e.parseCommandSubstitution(t,n):i==="{"?ox(e,t,n,r):/[a-zA-Z_0-9@*#?$!-]/.test(i)?ax(e,t,n):{part:q.literal("$"),endIndex:s}}function Pm(e,t){let n=[],r=0,s="",i=()=>{s&&(n.push(q.literal(s)),s="")};for(;r<t.length;){let a=t[r];if(a==="\\"&&r+1<t.length){let o=t[r+1];if(o==="$"||o==="`"||o==='"'||o==="\\"){s+=o,r+=2;continue}s+=a,r++;continue}if(a==="$"){i();let{part:o,endIndex:l}=Yl(e,t,r,!0);o&&n.push(o),r=l;continue}if(a==="`"){i();let{part:o,endIndex:l}=e.parseBacktickSubstitution(t,r,!0);n.push(o),r=l;continue}s+=a,r++}return i(),n}function lx(e,t,n){let r=[],s=n,i="",a=()=>{i&&(r.push(q.literal(i)),i="")};for(;s<t.length&&t[s]!=='"';){let o=t[s];if(o==="\\"&&s+1<t.length){let l=t[s+1];if('"\\$`\n'.includes(l)){i+=l,s+=2;continue}i+=o,s++;continue}if(o==="$"){a();let{part:l,endIndex:c}=Yl(e,t,s,!0);l&&r.push(l),s=c;continue}if(o==="`"){a();let{part:l,endIndex:c}=e.parseBacktickSubstitution(t,s,!0);r.push(l),s=c;continue}i+=o,s++}return a(),{part:q.doubleQuoted(r),endIndex:s}}function Mn(e,t,n=!1,r=!1,s=!1,i=!1,a=!1,o=!1,l=!1,c=!1){if(r)return[q.singleQuoted(t)];if(n){let m=Pm(e,t);return[q.doubleQuoted(m)]}if(t.length>=2&&t[0]==='"'&&t[t.length-1]==='"'){let m=t.slice(1,-1),d=!1;for(let g=0;g<m.length;g++){if(m[g]==='"'){d=!0;break}m[g]==="\\"&&g+1<m.length&&g++}if(!d){let g=Pm(e,m);return[q.doubleQuoted(g)]}}let u=[],f=0,p="",h=()=>{p&&(u.push(q.literal(p)),p="")};for(;f<t.length;){let m=t[f];if(m==="\\"&&f+1<t.length){let d=t[f+1];if(l){h(),u.push(q.escaped(d)),f+=2;continue}let g=i?d==="$"||d==="`"||d===`
766
+ `,s+=2;break;case"t":r+=" ",s+=2;break;case"r":r+="\r",s+=2;break;case"\\":r+="\\",s+=2;break;case"'":r+="'",s+=2;break;case'"':r+='"',s+=2;break;case"a":r+="\x07",s+=2;break;case"b":r+="\b",s+=2;break;case"e":case"E":r+="\x1B",s+=2;break;case"f":r+="\f",s+=2;break;case"v":r+="\v",s+=2;break;case"x":{let o=[],l=s;for(;l+1<t.length&&t[l]==="\\"&&t[l+1]==="x";){let c=t.slice(l+2,l+4),u=parseInt(c,16);if(!Number.isNaN(u)&&c.length>0)o.push(u),l+=2+c.length;else break}o.length>0?(r+=jb(o),s=l):(r+="\\x",s+=2);break}case"u":{let o=t.slice(s+2,s+6),l=parseInt(o,16);Number.isNaN(l)?(r+="\\u",s+=2):(r+=String.fromCharCode(l),s+=6);break}case"c":{if(s+2<t.length){let l=t[s+2].charCodeAt(0)&31;r+=String.fromCharCode(l),s+=3}else r+="\\c",s+=2;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let o="",l=s+1;for(;l<t.length&&l<s+4&&/[0-7]/.test(t[l]);)o+=t[l],l++;let c=parseInt(o,8);r+=String.fromCharCode(c),s=l;break}default:r+=i,s++}else r+=i,s++}return s<t.length&&t[s]==="'"&&s++,{part:q.literal(r),endIndex:s}}function Ml(e,t){let n=t.trim();return n===""?{type:"ArithmeticExpression",expression:{type:"ArithNumber",value:0}}:Ae(e,n)}function wm(e){let t=[],n="",r=0;for(let s=0;s<e.length;s++){let i=e[s];i==="{"?(r++,n+=i):i==="}"?(r--,n+=i):i===","&&r===0?(t.push(n),n=""):n+=i}return t.push(n),t}function Sm(e,t,n,r){let s=Fl(e,t,n,"{","}");if(s===-1)return null;let i=t.slice(n+1,s),a=i.match(/^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/);if(a)return{part:{type:"BraceExpansion",items:[{type:"Range",start:Number.parseInt(a[1],10),end:Number.parseInt(a[2],10),step:a[3]?Number.parseInt(a[3],10):void 0,startStr:a[1],endStr:a[2]}]},endIndex:s+1};let o=i.match(/^([a-zA-Z])\.\.([a-zA-Z])(?:\.\.(-?\d+))?$/);return o?{part:{type:"BraceExpansion",items:[{type:"Range",start:o[1],end:o[2],step:o[3]?Number.parseInt(o[3],10):void 0}]},endIndex:s+1}:i.includes(",")&&r?{part:{type:"BraceExpansion",items:wm(i).map(u=>({type:"Word",word:q.word(r(e,u,!1,!1,!1))}))},endIndex:s+1}:i.includes(",")?{part:{type:"BraceExpansion",items:wm(i).map(u=>({type:"Word",word:q.word([q.literal(u)])}))},endIndex:s+1}:null}function Ul(e,t){let n="";for(let r of t.parts)switch(r.type){case"Literal":n+=r.value;break;case"SingleQuoted":n+=`'${r.value}'`;break;case"Escaped":n+=r.value;break;case"DoubleQuoted":n+='"';for(let s of r.parts)s.type==="Literal"||s.type==="Escaped"?n+=s.value:s.type==="ParameterExpansion"&&(n+=`\${${s.parameter}}`);n+='"';break;case"ParameterExpansion":n+=`\${${r.parameter}}`;break;case"Glob":n+=r.pattern;break;case"TildeExpansion":n+="~",r.user&&(n+=r.user);break;case"BraceExpansion":{n+="{";let s=[];for(let i of r.items)if(i.type==="Range"){let a=i.startStr??String(i.start),o=i.endStr??String(i.end);i.step!==void 0?s.push(`${a}..${o}..${i.step}`):s.push(`${a}..${o}`)}else s.push(Ul(e,i.word));s.length===1&&r.items[0].type==="Range"?n+=s[0]:n+=s.join(","),n+="}";break}default:n+=r.type}return n}function Cm(e,t){return{[E.LESS]:"<",[E.GREAT]:">",[E.DGREAT]:">>",[E.LESSAND]:"<&",[E.GREATAND]:">&",[E.LESSGREAT]:"<>",[E.CLOBBER]:">|",[E.TLESS]:"<<<",[E.AND_GREAT]:"&>",[E.AND_DGREAT]:"&>>",[E.DLESS]:"<",[E.DLESSDASH]:"<"}[t]||">"}var Bl=I(()=>{"use strict";lr();mt();Fn()});function Ki(e){let t=e.current(),n=t.type;if(n===E.NUMBER){let r=e.peek(1);return t.end!==r.start?!1:nm.has(r.type)}if(n===E.FD_VARIABLE){let r=e.peek(1);return rm.has(r.type)}return tm.has(n)}function Qi(e){let t=null,n;e.check(E.NUMBER)?t=Number.parseInt(e.advance().value,10):e.check(E.FD_VARIABLE)&&(n=e.advance().value);let r=e.advance(),s=Cm(e,r.type);if(r.type===E.DLESS||r.type===E.DLESSDASH)return Vb(e,s,t,r.type===E.DLESSDASH);e.isWord()||e.error("Expected redirection target");let i=e.parseWord();return q.redirection(s,i,t,n)}function Vb(e,t,n,r){e.isWord()||e.error("Expected here-document delimiter");let s=e.advance(),i=s.value,a=s.quoted||!1;(i.startsWith("'")&&i.endsWith("'")||i.startsWith('"')&&i.endsWith('"'))&&(i=i.slice(1,-1));let o=q.redirection(r?"<<-":"<<",q.hereDoc(i,q.word([]),r,a),n);return e.addPendingHeredoc(o,i,r,a),o}function vm(e){let t=e.current().line,n=[],r=null,s=[],i=[];for(;e.check(E.ASSIGNMENT_WORD)||Ki(e);)e.checkIterationLimit(),e.check(E.ASSIGNMENT_WORD)?n.push(qb(e)):i.push(Qi(e));if(e.isWord())r=e.parseWord();else if(n.length>0&&(e.check(E.DBRACK_START)||e.check(E.DPAREN_START))){let o=e.advance();r=q.word([q.literal(o.value)])}for(;(!e.isStatementEnd()||e.check(E.RBRACE))&&!e.check(E.PIPE,E.PIPE_AMP);)if(e.checkIterationLimit(),Ki(e))i.push(Qi(e));else if(e.check(E.RBRACE)){let o=e.advance();s.push(e.parseWordFromString(o.value,!1,!1))}else if(e.check(E.LBRACE)){let o=e.advance();s.push(e.parseWordFromString(o.value,!1,!1))}else if(e.check(E.DBRACK_END)){let o=e.advance();s.push(e.parseWordFromString(o.value,!1,!1))}else if(e.isWord())s.push(e.parseWord());else if(e.check(E.ASSIGNMENT_WORD)){let o=e.advance(),l=o.value,c=l.endsWith("="),u=l.endsWith("=(");if((c||u)&&(u||e.check(E.LPAREN))){let f=u?l.slice(0,-2):l.slice(0,-1);u||e.expect(E.LPAREN);let p=Wl(e);e.expect(E.RPAREN);let h=p.map(d=>Ul(e,d)),m=`${f}=(${h.join(" ")})`;s.push(e.parseWordFromString(m,!1,!1))}else s.push(e.parseWordFromString(l,o.quoted,o.singleQuoted))}else if(e.check(E.LPAREN))e.error("syntax error near unexpected token `('");else break;let a=q.simpleCommand(r,s,n,i);return a.line=t,a}function qb(e){let t=e.expect(E.ASSIGNMENT_WORD),n=t.value,r=n.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);r||e.error(`Invalid assignment: ${n}`);let s=r[0],i,a=s.length;if(n[a]==="["){let f=0,p=a+1;for(;a<n.length;a++)if(n[a]==="[")f++;else if(n[a]==="]"&&(f--,f===0))break;f!==0&&e.error(`Invalid assignment: ${n}`),i=n.slice(p,a),a++}let o=n[a]==="+";o&&a++,n[a]!=="="&&e.error(`Invalid assignment: ${n}`),a++;let l=n.slice(a);if(l==="("){let f=Wl(e);e.expect(E.RPAREN);let p=i!==void 0?`${s}[${i}]`:s;return q.assignment(p,null,o,f)}if(l===""&&e.check(E.LPAREN)){let f=e.current();if(t.end===f.start){e.advance();let p=Wl(e);e.expect(E.RPAREN);let h=i!==void 0?`${s}[${i}]`:s;return q.assignment(h,null,o,p)}}let c=l?e.parseWordFromString(l,t.quoted,t.singleQuoted,!0):null,u=i!==void 0?`${s}[${i}]`:s;return q.assignment(u,c,o,null)}function Wl(e){let t=[];for(e.skipNewlines();!e.check(E.RPAREN,E.EOF);)e.checkIterationLimit(),e.isWord()?t.push(e.parseWord()):Zb.has(e.current().type)?e.error(`syntax error near unexpected token \`${e.current().value}'`):e.advance(),e.skipNewlines();return t}var Zb,km=I(()=>{"use strict";lr();Fn();or();Bl();Zb=new Set([E.AMP,E.PIPE,E.PIPE_AMP,E.SEMICOLON,E.AND_AND,E.OR_OR,E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND])});function zl(e,t){e.expect(E.IF);let n=[],r=e.parseCompoundList();e.expect(E.THEN);let s=e.parseCompoundList();if(s.length===0){let o=e.check(E.FI)?"fi":e.check(E.ELSE)?"else":e.check(E.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${o}'`)}for(n.push({condition:r,body:s});e.check(E.ELIF);){e.advance();let o=e.parseCompoundList();e.expect(E.THEN);let l=e.parseCompoundList();if(l.length===0){let c=e.check(E.FI)?"fi":e.check(E.ELSE)?"else":e.check(E.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${c}'`)}n.push({condition:o,body:l})}let i=null;e.check(E.ELSE)&&(e.advance(),i=e.parseCompoundList(),i.length===0&&e.error("syntax error near unexpected token `fi'")),e.expect(E.FI);let a=t?.skipRedirections?[]:e.parseOptionalRedirections();return q.ifNode(n,i,a)}function Hl(e,t){let n=e.expect(E.FOR);if(e.check(E.DPAREN_START))return Qb(e,t,n.line);e.isWord()||e.error("Expected variable name in for loop");let s=e.advance().value,i=null;if(e.skipNewlines(),e.check(E.IN))for(e.advance(),i=[];!e.check(E.SEMICOLON,E.NEWLINE,E.DO,E.EOF)&&e.isWord();)i.push(e.parseWord());e.check(E.SEMICOLON)&&e.advance(),e.skipNewlines(),e.expect(E.DO);let a=e.parseCompoundList();e.expect(E.DONE);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return q.forNode(s,i,a,o)}function Qb(e,t,n){e.expect(E.DPAREN_START);let r=null,s=null,i=null,a=["","",""],o=0,l=0;for(;!e.check(E.DPAREN_END,E.EOF);){let f=e.advance();if(f.type===E.SEMICOLON&&l===0){if(o++,o>2)break}else f.value==="("&&l++,f.value===")"&&l--,a[o]+=f.value}e.expect(E.DPAREN_END),a[0].trim()&&(r=Ae(e,a[0].trim())),a[1].trim()&&(s=Ae(e,a[1].trim())),a[2].trim()&&(i=Ae(e,a[2].trim())),e.skipNewlines(),e.check(E.SEMICOLON)&&e.advance(),e.skipNewlines();let c;e.check(E.LBRACE)?(e.advance(),c=e.parseCompoundList(),e.expect(E.RBRACE)):(e.expect(E.DO),c=e.parseCompoundList(),e.expect(E.DONE));let u=t?.skipRedirections?[]:e.parseOptionalRedirections();return{type:"CStyleFor",init:r,condition:s,update:i,body:c,redirections:u,line:n}}function jl(e,t){e.expect(E.WHILE);let n=e.parseCompoundList();e.expect(E.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(E.DONE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return q.whileNode(n,r,s)}function Gl(e,t){e.expect(E.UNTIL);let n=e.parseCompoundList();e.expect(E.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(E.DONE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return q.untilNode(n,r,s)}function Vl(e,t){e.expect(E.CASE),e.isWord()||e.error("Expected word after 'case'");let n=e.parseWord();e.skipNewlines(),e.expect(E.IN),e.skipNewlines();let r=[];for(;!e.check(E.ESAC,E.EOF);){e.checkIterationLimit();let i=e.getPos(),a=Xb(e);if(a&&r.push(a),e.skipNewlines(),e.getPos()===i&&!a)break}e.expect(E.ESAC);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return q.caseNode(n,r,s)}function Xb(e){e.check(E.LPAREN)&&e.advance();let t=[];for(;e.isWord()&&(t.push(e.parseWord()),e.check(E.PIPE));)e.advance();if(t.length===0)return null;e.expect(E.RPAREN),e.skipNewlines();let n=[];for(;!e.check(E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND,E.ESAC,E.EOF);){e.checkIterationLimit(),e.isWord()&&e.peek(1).type===E.RPAREN&&e.error("syntax error near unexpected token `)'"),e.check(E.LPAREN)&&e.peek(1).type===E.WORD&&e.error(`syntax error near unexpected token \`${e.peek(1).value}'`);let s=e.getPos(),i=e.parseStatement();if(i&&n.push(i),e.skipSeparators(!1),e.getPos()===s&&!i)break}let r=";;";return e.check(E.DSEMI)?(e.advance(),r=";;"):e.check(E.SEMI_AND)?(e.advance(),r=";&"):e.check(E.SEMI_SEMI_AND)&&(e.advance(),r=";;&"),q.caseItem(t,n,r)}function ql(e,t){e.expect(E.LPAREN);let n=e.parseCompoundList();e.expect(E.RPAREN);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return q.subshell(n,r)}function Zl(e,t){e.expect(E.LBRACE);let n=e.parseCompoundList();e.expect(E.RBRACE);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return q.group(n,r)}var Im=I(()=>{"use strict";lr();mt();Fn()});function $m(e){return e.isWord()||e.check(E.LBRACE)||e.check(E.RBRACE)||e.check(E.ASSIGNMENT_WORD)}function Om(e){if(e.check(E.BANG)&&e.peek(1).type===E.LPAREN){e.advance(),e.advance();let t=1,n="!(";for(;t>0&&!e.check(E.EOF);)if(e.check(E.LPAREN))t++,n+="(",e.advance();else if(e.check(E.RPAREN))t--,t>0&&(n+=")"),e.advance();else if(e.isWord())n+=e.advance().value;else if(e.check(E.PIPE))n+="|",e.advance();else break;return n+=")",e.parseWordFromString(n,!1,!1,!1,!1,!0)}return e.parseWordNoBraceExpansion()}function Ql(e){return e.skipNewlines(),tx(e)}function tx(e){let t=Rm(e);for(e.skipNewlines();e.check(E.OR_OR);){e.advance(),e.skipNewlines();let n=Rm(e);t={type:"CondOr",left:t,right:n},e.skipNewlines()}return t}function Rm(e){let t=Kl(e);for(e.skipNewlines();e.check(E.AND_AND);){e.advance(),e.skipNewlines();let n=Kl(e);t={type:"CondAnd",left:t,right:n},e.skipNewlines()}return t}function Kl(e){return e.skipNewlines(),e.check(E.BANG)?(e.advance(),e.skipNewlines(),{type:"CondNot",operand:Kl(e)}):nx(e)}function nx(e){if(e.check(E.LPAREN)){e.advance();let t=Ql(e);return e.expect(E.RPAREN),{type:"CondGroup",expression:t}}if($m(e)){let t=e.current(),n=t.value;if(Jb.includes(n)&&!t.quoted){if(e.advance(),e.check(E.DBRACK_END)&&e.error(`Expected operand after ${n}`),$m(e)){let i=e.parseWordNoBraceExpansion();return{type:"CondUnary",operator:n,operand:i}}let s=e.current();e.error(`unexpected argument \`${s.value}' to conditional unary operator`)}let r=e.parseWordNoBraceExpansion();if(e.isWord()&&ex.includes(e.current().value)){let s=e.advance().value,i;return s==="=~"?i=rx(e):s==="=="||s==="!="?i=Om(e):i=e.parseWordNoBraceExpansion(),{type:"CondBinary",operator:s,left:r,right:i}}if(e.check(E.LESS)){e.advance();let s=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:"<",left:r,right:s}}if(e.check(E.GREAT)){e.advance();let s=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:">",left:r,right:s}}if(e.isWord()&&e.current().value==="="){e.advance();let s=Om(e);return{type:"CondBinary",operator:"==",left:r,right:s}}return{type:"CondWord",word:r}}e.error("Expected conditional expression")}function rx(e){let t=[],n=0,r=-1,s=e.getInput(),i=()=>e.check(E.DBRACK_END)||e.check(E.AND_AND)||e.check(E.OR_OR)||e.check(E.NEWLINE)||e.check(E.EOF);for(;!i();){let a=e.current(),o=r>=0&&a.start>r;if(n===0&&o)break;if(n>0&&o){let l=s.slice(r,a.start);t.push({type:"Literal",value:l})}if(e.isWord()||e.check(E.ASSIGNMENT_WORD)){let l=e.parseWordForRegex();t.push(...l.parts),r=e.peek(-1).end}else if(e.check(E.LPAREN)){let l=e.advance();t.push({type:"Literal",value:"("}),n++,r=l.end}else if(e.check(E.DPAREN_START)){let l=e.advance();t.push({type:"Literal",value:"(("}),n+=2,r=l.end}else if(e.check(E.DPAREN_END))if(n>=2){let l=e.advance();t.push({type:"Literal",value:"))"}),n-=2,r=l.end}else{if(n===1)break;break}else if(e.check(E.RPAREN))if(n>0){let l=e.advance();t.push({type:"Literal",value:")"}),n--,r=l.end}else break;else if(e.check(E.PIPE)){let l=e.advance();t.push({type:"Literal",value:"|"}),r=l.end}else if(e.check(E.SEMICOLON))if(n>0){let l=e.advance();t.push({type:"Literal",value:";"}),r=l.end}else break;else if(n>0&&e.check(E.LESS)){let l=e.advance();t.push({type:"Literal",value:"<"}),r=l.end}else if(n>0&&e.check(E.GREAT)){let l=e.advance();t.push({type:"Literal",value:">"}),r=l.end}else if(n>0&&e.check(E.DGREAT)){let l=e.advance();t.push({type:"Literal",value:">>"}),r=l.end}else if(n>0&&e.check(E.DLESS)){let l=e.advance();t.push({type:"Literal",value:"<<"}),r=l.end}else if(n>0&&e.check(E.LESSAND)){let l=e.advance();t.push({type:"Literal",value:"<&"}),r=l.end}else if(n>0&&e.check(E.GREATAND)){let l=e.advance();t.push({type:"Literal",value:">&"}),r=l.end}else if(n>0&&e.check(E.LESSGREAT)){let l=e.advance();t.push({type:"Literal",value:"<>"}),r=l.end}else if(n>0&&e.check(E.CLOBBER)){let l=e.advance();t.push({type:"Literal",value:">|"}),r=l.end}else if(n>0&&e.check(E.TLESS)){let l=e.advance();t.push({type:"Literal",value:"<<<"}),r=l.end}else if(n>0&&e.check(E.AMP)){let l=e.advance();t.push({type:"Literal",value:"&"}),r=l.end}else if(n>0&&e.check(E.LBRACE)){let l=e.advance();t.push({type:"Literal",value:"{"}),r=l.end}else if(n>0&&e.check(E.RBRACE)){let l=e.advance();t.push({type:"Literal",value:"}"}),r=l.end}else break}return t.length===0&&e.error("Expected regex pattern after =~"),{type:"Word",parts:t}}var Jb,ex,Tm=I(()=>{"use strict";Fn();Jb=["-a","-b","-c","-d","-e","-f","-g","-h","-k","-p","-r","-s","-t","-u","-w","-x","-G","-L","-N","-O","-S","-z","-n","-o","-v","-R"],ex=["==","!=","=~","<",">","-eq","-ne","-lt","-le","-gt","-ge","-nt","-ot","-ef"]});function ix(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if("@*+?!".includes(s)&&r+1<e.length&&e[r+1]==="("){r++,n++,r++;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function ax(e,t,n){let r=n+1,s=t[r];if("@*#?$!-0123456789".includes(s))return{part:q.parameterExpansion(s),endIndex:r+1};let i="";for(;r<t.length&&/[a-zA-Z0-9_]/.test(t[r]);)i+=t[r],r++;return{part:q.parameterExpansion(i),endIndex:r}}function ox(e,t,n,r=!1){let s=n+2,i=!1;t[s]==="!"&&(i=!0,s++);let a=!1;t[s]==="#"&&!/[}:#%/^,]/.test(t[s+1]||"}")&&(a=!0,s++);let o="",l=t[s];if(/[@*#?$!-]/.test(l)&&!/[a-zA-Z0-9_]/.test(t[s+1]||""))o=l,s++;else for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)o+=t[s],s++;if(t[s]==="["){let u=Fl(e,t,s,"[","]");if(o+=t.slice(s,u+1),s=u+1,t[s]==="["){let f=1,p=s;for(;p<t.length&&f>0;)t[p]==="{"?f++:t[p]==="}"&&f--,f>0&&p++;let h=t.slice(n+2,p);return{part:q.parameterExpansion("",{type:"BadSubstitution",text:h}),endIndex:p+1}}}if(o===""&&!i&&!a&&t[s]!=="}"){let u=1,f=s;for(;f<t.length&&u>0;)t[f]==="{"?u++:t[f]==="}"&&u--,u>0&&f++;if(u>0)throw new lt("unexpected EOF while looking for matching '}'",0,0);let p=t.slice(n+2,f);return{part:q.parameterExpansion("",{type:"BadSubstitution",text:p}),endIndex:f+1}}let c=null;if(i){let u=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(u)if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=Xl(e,t,s,o,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):(c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},o="")}else c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},o="";else if(t[s]==="*"||t[s]==="@"&&!/[QPaAEKkuUL]/.test(t[s+1]||"")){let f=t[s];s++,c={type:"VarNamePrefix",prefix:o,star:f==="*"},o=""}else if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=Xl(e,t,s,o,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):c={type:"Indirection"}}else c={type:"Indirection"}}else if(a)if(t[s]===":")for(c={type:"LengthSliceError"};s<t.length&&t[s]!=="}";)s++;else t[s]!=="}"&&/[-+=?]/.test(t[s])?e.error(`\${#${o}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):t[s]==="/"?e.error(`\${#${o}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):c={type:"Length"};if(!c&&s<t.length&&t[s]!=="}"){let u=Xl(e,t,s,o,r);c=u.operation,s=u.endIndex}if(s<t.length&&t[s]!=="}"){let u=t[s];if(!/[:\-+=?#%/^,@[]/.test(u)){let f=s;for(;f<t.length&&t[f]!=="}";)f++;let p=t.slice(n,f+1);e.error(`\${${p.slice(2,-1)}}: bad substitution`)}}for(;s<t.length&&t[s]!=="}";)s++;if(s>=t.length)throw new lt("unexpected EOF while looking for matching '}'",0,0);return{part:q.parameterExpansion(o,c),endIndex:s+1}}function Xl(e,t,n,r,s=!1){let i=n,a=t[i],o=t[i+1]||"";if(a===":"){let l=o;if("-=?+".includes(l)){i+=2;let w=cr(e,t,i),y=t.slice(i,w),b=Mn(e,y,!1,!1,!0,!1,s,!1,!1,!0),x=q.word(b.length>0?b:[q.literal("")]);if(l==="-")return{operation:{type:"DefaultValue",word:x,checkEmpty:!0},endIndex:w};if(l==="=")return{operation:{type:"AssignDefault",word:x,checkEmpty:!0},endIndex:w};if(l==="?")return{operation:{type:"ErrorIfUnset",word:x,checkEmpty:!0},endIndex:w};if(l==="+")return{operation:{type:"UseAlternative",word:x,checkEmpty:!0},endIndex:w}}i++;let c=cr(e,t,i),u=t.slice(i,c),f=-1,p=0,h=0;for(let g=0;g<u.length;g++){let w=u[g];if(w==="("||w==="[")p++;else if(w===")"||w==="]")p--;else if(w==="?"&&p===0)h++;else if(w===":"&&p===0)if(h>0)h--;else{f=g;break}}let m=f>=0?u.slice(0,f):u,d=f>=0?u.slice(f+1):null;return{operation:{type:"Substring",offset:Ml(e,m),length:d!==null?Ml(e,d):null},endIndex:c}}if("-=?+".includes(a)){i++;let l=cr(e,t,i),c=t.slice(i,l),u=Mn(e,c,!1,!1,!0,!1,s,!1,!1,!0),f=q.word(u.length>0?u:[q.literal("")]);if(a==="-")return{operation:{type:"DefaultValue",word:f,checkEmpty:!1},endIndex:l};if(a==="=")return{operation:{type:"AssignDefault",word:f,checkEmpty:!1},endIndex:l};if(a==="?")return{operation:{type:"ErrorIfUnset",word:c?f:null,checkEmpty:!1},endIndex:l};if(a==="+")return{operation:{type:"UseAlternative",word:f,checkEmpty:!1},endIndex:l}}if(a==="#"||a==="%"){let l=o===a,c=a==="#"?"prefix":"suffix";i+=l?2:1;let u=cr(e,t,i),f=t.slice(i,u),p=Mn(e,f,!1,!1,!1);return{operation:{type:"PatternRemoval",pattern:q.word(p.length>0?p:[q.literal("")]),side:c,greedy:l},endIndex:u}}if(a==="/"){let l=o==="/";i+=l?2:1;let c=null;t[i]==="#"?(c="start",i++):t[i]==="%"&&(c="end",i++);let u;c!==null&&(t[i]==="/"||t[i]==="}")?u=i:u=xm(e,t,i);let f=t.slice(i,u),p=Mn(e,f,!1,!1,!1),h=q.word(p.length>0?p:[q.literal("")]),m=null,d=u;if(t[u]==="/"){let g=u+1,w=cr(e,t,g),y=t.slice(g,w),b=Mn(e,y,!1,!1,!1);m=q.word(b.length>0?b:[q.literal("")]),d=w}return{operation:{type:"PatternReplacement",pattern:h,replacement:m,all:l,anchor:c},endIndex:d}}if(a==="^"||a===","){let l=o===a,c=a==="^"?"upper":"lower";i+=l?2:1;let u=cr(e,t,i),f=t.slice(i,u),p=f?q.word([q.literal(f)]):null;return{operation:{type:"CaseModification",direction:c,all:l,pattern:p},endIndex:u}}return a==="@"&&/[QPaAEKkuUL]/.test(o)?{operation:{type:"Transform",operator:o},endIndex:i+2}:{operation:null,endIndex:i}}function Yl(e,t,n,r=!1){let s=n+1;if(s>=t.length)return{part:q.literal("$"),endIndex:s};let i=t[s];if(i==="("&&t[s+1]==="(")return e.isDollarDparenSubshell(t,n)?e.parseCommandSubstitution(t,n):e.parseArithmeticExpansion(t,n);if(i==="["){let a=1,o=s+1;for(;o<t.length&&a>0;)t[o]==="["?a++:t[o]==="]"&&a--,a>0&&o++;if(a===0){let l=t.slice(s+1,o),c=Ae(e,l);return{part:q.arithmeticExpansion(c),endIndex:o+1}}}return i==="("?e.parseCommandSubstitution(t,n):i==="{"?ox(e,t,n,r):/[a-zA-Z_0-9@*#?$!-]/.test(i)?ax(e,t,n):{part:q.literal("$"),endIndex:s}}function Pm(e,t){let n=[],r=0,s="",i=()=>{s&&(n.push(q.literal(s)),s="")};for(;r<t.length;){let a=t[r];if(a==="\\"&&r+1<t.length){let o=t[r+1];if(o==="$"||o==="`"||o==='"'||o==="\\"){s+=o,r+=2;continue}s+=a,r++;continue}if(a==="$"){i();let{part:o,endIndex:l}=Yl(e,t,r,!0);o&&n.push(o),r=l;continue}if(a==="`"){i();let{part:o,endIndex:l}=e.parseBacktickSubstitution(t,r,!0);n.push(o),r=l;continue}s+=a,r++}return i(),n}function lx(e,t,n){let r=[],s=n,i="",a=()=>{i&&(r.push(q.literal(i)),i="")};for(;s<t.length&&t[s]!=='"';){let o=t[s];if(o==="\\"&&s+1<t.length){let l=t[s+1];if('"\\$`\n'.includes(l)){i+=l,s+=2;continue}i+=o,s++;continue}if(o==="$"){a();let{part:l,endIndex:c}=Yl(e,t,s,!0);l&&r.push(l),s=c;continue}if(o==="`"){a();let{part:l,endIndex:c}=e.parseBacktickSubstitution(t,s,!0);r.push(l),s=c;continue}i+=o,s++}return a(),{part:q.doubleQuoted(r),endIndex:s}}function Mn(e,t,n=!1,r=!1,s=!1,i=!1,a=!1,o=!1,l=!1,c=!1){if(r)return[q.singleQuoted(t)];if(n){let m=Pm(e,t);return[q.doubleQuoted(m)]}if(t.length>=2&&t[0]==='"'&&t[t.length-1]==='"'){let m=t.slice(1,-1),d=!1;for(let g=0;g<m.length;g++){if(m[g]==='"'){d=!0;break}m[g]==="\\"&&g+1<m.length&&g++}if(!d){let g=Pm(e,m);return[q.doubleQuoted(g)]}}let u=[],f=0,p="",h=()=>{p&&(u.push(q.literal(p)),p="")};for(;f<t.length;){let m=t[f];if(m==="\\"&&f+1<t.length){let d=t[f+1];if(l){h(),u.push(q.escaped(d)),f+=2;continue}let g=i?d==="$"||d==="`"||d===`
767
767
  `:d==="$"||d==="`"||d==='"'||d==="'"||d===`
768
768
  `||c&&d==="}",w=a?"*?[]\\".includes(d):"*?[]\\(){}.^+".includes(d);g?p+=d:w?(h(),u.push(q.escaped(d))):p+=`\\${d}`,f+=2;continue}if(m==="'"&&!a&&!i){h();let d=t.indexOf("'",f+1);if(d===-1){p+=t.slice(f);break}u.push(q.singleQuoted(t.slice(f+1,d))),f=d+1;continue}if(m==='"'&&!i){h();let{part:d,endIndex:g}=lx(e,t,f+1);u.push(d),f=g+1;continue}if(m==="$"&&t[f+1]==="'"){h();let{part:d,endIndex:g}=Am(e,t,f+2);u.push(d),f=g;continue}if(m==="$"){h();let{part:d,endIndex:g}=Yl(e,t,f);d&&u.push(d),f=g;continue}if(m==="`"){h();let{part:d,endIndex:g}=e.parseBacktickSubstitution(t,f);u.push(d),f=g;continue}if(m==="~"){let d=f>0?t[f-1]:"";if(f===0||d==="="||s&&d===":"){let w=bm(e,t,f),y=t[w];if(y===void 0||y==="/"||y===":"){h();let b=t.slice(f+1,w)||null;u.push({type:"TildeExpansion",user:b}),f=w;continue}}}if("@*+?!".includes(m)&&f+1<t.length&&t[f+1]==="("){let d=ix(t,f+1);if(d!==-1){h();let g=t.slice(f,d+1);u.push({type:"Glob",pattern:g}),f=d+1;continue}}if(m==="*"||m==="?"||m==="["){h();let{pattern:d,endIndex:g}=Em(e,t,f);u.push({type:"Glob",pattern:d}),f=g;continue}if(m==="{"&&!s&&!o){let d=Sm(e,t,f,Mn);if(d){h(),u.push(d.part),f=d.endIndex;continue}}p+=m,f++}return h(),u}var Dm=I(()=>{"use strict";lr();mt();or();Bl()});function _m(e,t){let n=e.length,r=t+3,s=2,i=!1,a=!1;for(;r<n&&s>0;){let o=e[r];if(i){o==="'"&&(i=!1),r++;continue}if(a){if(o==="\\"){r+=2;continue}o==='"'&&(a=!1),r++;continue}if(o==="'"){i=!0,r++;continue}if(o==='"'){a=!0,r++;continue}if(o==="\\"){r+=2;continue}if(o==="("){s++,r++;continue}if(o===")"){if(s--,s===1){let l=r+1;return!(l<n&&e[l]===")")}if(s===0)return!1;r++;continue}if(s===1&&(o==="|"&&r+1<n&&e[r+1]==="|"||o==="&"&&r+1<n&&e[r+1]==="&"||o==="|"&&r+1<n&&e[r+1]!=="|"))return!0;r++}return!1}function Lm(e,t,n,r){let s=t+2,i=1,a=s,o=!1,l=!1,c=0,u=!1,f="";for(;a<e.length&&i>0;){let d=e[a];o?d==="'"&&(o=!1):l?d==="\\"&&a+1<e.length?a++:d==='"'&&(l=!1):d==="'"?(o=!0,f=""):d==='"'?(l=!0,f=""):d==="\\"&&a+1<e.length?(a++,f=""):/[a-zA-Z_]/.test(d)?f+=d:(f==="case"?(c++,u=!1):f==="in"&&c>0?u=!0:f==="esac"&&c>0&&(c--,u=!1),f="",d==="("?a>0&&e[a-1]==="$"?i++:u||i++:d===")"?u?u=!1:i--:d===";"&&c>0&&a+1<e.length&&e[a+1]===";"&&(u=!0)),i>0&&a++}i>0&&r("unexpected EOF while looking for matching `)'");let p=e.slice(s,a),m=n().parse(p);return{part:q.commandSubstitution(m,!1),endIndex:a+1}}function Fm(e,t,n,r,s){let a=t+1,o="";for(;a<e.length&&e[a]!=="`";)if(e[a]==="\\"){let u=e[a+1];u==="$"||u==="`"||u==="\\"||u===`
769
769
  `||n&&u==='"'?(u!==`
770
- `&&(o+=u),a+=2):(o+=e[a],a++)}else o+=e[a],a++;a>=e.length&&s("unexpected EOF while looking for matching ``'");let c=r().parse(o);return{part:q.commandSubstitution(c,!0),endIndex:a+1}}var Mm=I(()=>{"use strict";lr()});function rn(e,t){return new ce().parse(e,t)}var ce,Xe=I(()=>{"use strict";lr();mt();vm();Im();Tm();Dm();Fn();Mm();or();or();ce=class e{tokens=[];pos=0;pendingHeredocs=[];parseIterations=0;parseDepth=0;_input="";getInput(){return this._input}checkIterationLimit(){if(this.parseIterations++,this.parseIterations>em)throw new lt("Maximum parse iterations exceeded (possible infinite loop)",this.current().line,this.current().column)}enterDepth(){if(this.parseDepth++,this.parseDepth>Dl)throw new lt(`Maximum parser nesting depth exceeded (${Dl})`,this.current().line,this.current().column);return()=>{this.parseDepth--}}parse(t,n){if(t.length>Tl)throw new lt(`Input too large: ${t.length} bytes exceeds limit of ${Tl}`,1,1);this._input=t;let r=new Vi(t,n);if(this.tokens=r.tokenize(),this.tokens.length>Pl)throw new lt(`Too many tokens: ${this.tokens.length} exceeds limit of ${Pl}`,1,1);return this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}parseTokens(t){return this.tokens=t,this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}current(){return this.tokens[this.pos]||this.tokens[this.tokens.length-1]}peek(t=0){return this.tokens[this.pos+t]||this.tokens[this.tokens.length-1]}advance(){let t=this.current();return this.pos<this.tokens.length-1&&this.pos++,t}getPos(){return this.pos}check(t,n,r,s,...i){let a=this.tokens[this.pos]?.type;return a===t||n!==void 0&&a===n||r!==void 0&&a===r||s!==void 0&&a===s?!0:i.length>0?i.includes(a):!1}expect(t,n){if(this.check(t))return this.advance();let r=this.current();throw new lt(n||`Expected ${t}, got ${r.type}`,r.line,r.column,r)}error(t){let n=this.current();throw new lt(t,n.line,n.column,n)}skipNewlines(){for(;this.check(E.NEWLINE,E.COMMENT);)this.check(E.NEWLINE)?(this.advance(),this.processHeredocs()):this.advance()}skipSeparators(t=!0){for(;;){if(this.check(E.NEWLINE)){this.advance(),this.processHeredocs();continue}if(this.check(E.SEMICOLON,E.COMMENT)){this.advance();continue}if(t&&this.check(E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND)){this.advance();continue}break}}addPendingHeredoc(t,n,r,s){this.pendingHeredocs.push({redirect:t,delimiter:n,stripTabs:r,quoted:s})}processHeredocs(){for(let t of this.pendingHeredocs)if(this.check(E.HEREDOC_CONTENT)){let n=this.advance(),r;t.quoted?r=q.word([q.literal(n.value)]):r=this.parseWordFromString(n.value,!1,!1,!1,!0),t.redirect.target=q.hereDoc(t.delimiter,r,t.stripTabs,t.quoted)}this.pendingHeredocs=[]}isStatementEnd(){return this.check(E.EOF,E.NEWLINE,E.SEMICOLON,E.AMP,E.AND_AND,E.OR_OR,E.RPAREN,E.RBRACE,E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND)}isCommandStart(){let t=this.current().type;return t===E.WORD||t===E.NAME||t===E.NUMBER||t===E.ASSIGNMENT_WORD||t===E.IF||t===E.FOR||t===E.WHILE||t===E.UNTIL||t===E.CASE||t===E.LPAREN||t===E.LBRACE||t===E.DPAREN_START||t===E.DBRACK_START||t===E.FUNCTION||t===E.BANG||t===E.TIME||t===E.IN||t===E.LESS||t===E.GREAT||t===E.DLESS||t===E.DGREAT||t===E.LESSAND||t===E.GREATAND||t===E.LESSGREAT||t===E.DLESSDASH||t===E.CLOBBER||t===E.TLESS||t===E.AND_GREAT||t===E.AND_DGREAT}parseScript(){let t=[],r=0;for(this.skipNewlines();!this.check(E.EOF);){r++,r>1e4&&this.error("Parser stuck: too many iterations (>10000)");let s=this.checkUnexpectedToken();if(s){t.push(s),this.skipSeparators(!1);continue}let i=this.pos,a=this.parseStatement();a&&t.push(a),this.skipSeparators(!1),this.check(E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${this.current().value}'`),this.pos===i&&!this.check(E.EOF)&&this.advance()}return q.script(t)}checkUnexpectedToken(){let t=this.current().type,n=this.current().value;if((t===E.DO||t===E.DONE||t===E.THEN||t===E.ELSE||t===E.ELIF||t===E.FI||t===E.ESAC)&&this.error(`syntax error near unexpected token \`${n}'`),t===E.RBRACE||t===E.RPAREN){let r=`syntax error near unexpected token \`${n}'`;return this.advance(),q.statement([q.pipeline([q.simpleCommand(null,[],[],[])])],[],!1,{message:r,token:n})}return(t===E.DSEMI||t===E.SEMI_AND||t===E.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${n}'`),t===E.SEMICOLON&&this.error(`syntax error near unexpected token \`${n}'`),(t===E.PIPE||t===E.PIPE_AMP)&&this.error(`syntax error near unexpected token \`${n}'`),null}parseStatement(){if(this.skipNewlines(),!this.isCommandStart())return null;let t=this.current().start,n=[],r=[],s=!1,i=this.parsePipeline();for(n.push(i);this.check(E.AND_AND,E.OR_OR);){let l=this.advance();r.push(l.type===E.AND_AND?"&&":"||"),this.skipNewlines();let c=this.parsePipeline();n.push(c)}this.check(E.AMP)&&(this.advance(),s=!0);let a=this.pos>0?this.tokens[this.pos-1].end:t,o=this._input.slice(t,a);return q.statement(n,r,s,void 0,o)}parsePipeline(){let t=!1,n=!1;this.check(E.TIME)&&(this.advance(),t=!0,this.check(E.WORD,E.NAME)&&this.current().value==="-p"&&(this.advance(),n=!0));let r=0;for(;this.check(E.BANG);)this.advance(),r++;let s=r%2===1,i=[],a=[],o=this.parseCommand();for(i.push(o);this.check(E.PIPE,E.PIPE_AMP);){let l=this.advance();this.skipNewlines(),a.push(l.type===E.PIPE_AMP);let c=this.parseCommand();i.push(c)}return q.pipeline(i,s,t,n,a.length>0?a:void 0)}parseCommand(){return this.check(E.IF)?zl(this):this.check(E.FOR)?Hl(this):this.check(E.WHILE)?jl(this):this.check(E.UNTIL)?Gl(this):this.check(E.CASE)?Vl(this):this.check(E.LPAREN)?ql(this):this.check(E.LBRACE)?Zl(this):this.check(E.DPAREN_START)?this.dparenClosesWithSpacedParens()?this.parseNestedSubshellsFromDparen():this.parseArithmeticCommand():this.check(E.DBRACK_START)?this.parseConditionalCommand():this.check(E.FUNCTION)?this.parseFunctionDef():this.check(E.NAME,E.WORD)&&this.peek(1).type===E.LPAREN&&this.peek(2).type===E.RPAREN?this.parseFunctionDef():km(this)}dparenClosesWithSpacedParens(){let t=1,n=1;for(;n<this.tokens.length-this.pos;){let r=this.peek(n);if(r.type===E.EOF)return!1;if(r.type===E.DPAREN_START||r.type===E.LPAREN)t++;else if(r.type===E.DPAREN_END){if(t-=2,t<=0)return!1}else if(r.type===E.RPAREN&&(t--,t===0&&this.peek(n+1).type===E.RPAREN))return!0;n++}return!1}parseNestedSubshellsFromDparen(){this.advance();let t=this.parseCompoundList();this.expect(E.RPAREN),this.expect(E.RPAREN);let n=this.parseOptionalRedirections(),r=q.subshell(t,[]);return q.subshell([q.statement([q.pipeline([r],!1,!1,!1)])],n)}isWord(){let t=this.current().type;return t===E.WORD||t===E.NAME||t===E.NUMBER||t===E.IF||t===E.FOR||t===E.WHILE||t===E.UNTIL||t===E.CASE||t===E.FUNCTION||t===E.ELSE||t===E.ELIF||t===E.FI||t===E.THEN||t===E.DO||t===E.DONE||t===E.ESAC||t===E.IN||t===E.SELECT||t===E.TIME||t===E.COPROC||t===E.BANG}parseWord(){let t=this.advance();return this.parseWordFromString(t.value,t.quoted,t.singleQuoted)}parseWordNoBraceExpansion(){let t=this.advance();return this.parseWordFromString(t.value,t.quoted,t.singleQuoted,!1,!1,!0)}parseWordForRegex(){let t=this.advance();return this.parseWordFromString(t.value,t.quoted,t.singleQuoted,!1,!1,!0,!0)}parseWordFromString(t,n=!1,r=!1,s=!1,i=!1,a=!1,o=!1){let l=Mn(this,t,n,r,s,i,!1,a,o);return q.word(l)}parseCommandSubstitution(t,n){return Lm(t,n,()=>new e,r=>this.error(r))}parseBacktickSubstitution(t,n,r=!1){return Fm(t,n,r,()=>new e,s=>this.error(s))}isDollarDparenSubshell(t,n){return _m(t,n)}parseArithmeticExpansion(t,n){let r=n+3,s=1,i=0,a=r;for(;a<t.length-1&&s>0;)t[a]==="$"&&t[a+1]==="("?t[a+2]==="("?(s++,a+=3):(i++,a+=2):t[a]==="("&&t[a+1]==="("?(s++,a+=2):t[a]===")"&&t[a+1]===")"?i>0?(i--,a++):(s--,s>0&&(a+=2)):t[a]==="("?(i++,a++):(t[a]===")"&&i>0&&i--,a++);let o=t.slice(r,a),l=this.parseArithmeticExpression(o);return{part:q.arithmeticExpansion(l),endIndex:a+2}}parseArithmeticCommand(){let t=this.expect(E.DPAREN_START),n="",r=1,s=0,i=!1,a=!1;for(;r>0&&!this.check(E.EOF);){if(i){if(i=!1,s>0){s--,n+=")";continue}if(this.check(E.RPAREN)){r--,a=!0,this.advance();continue}if(this.check(E.DPAREN_END)){r--,a=!0;continue}n+=")";continue}if(this.check(E.DPAREN_START))r++,n+="((",this.advance();else if(this.check(E.DPAREN_END))s>=2?(s-=2,n+="))",this.advance()):s===1?(s--,n+=")",i=!0,this.advance()):(r--,a=!0,r>0&&(n+="))"),this.advance());else if(this.check(E.LPAREN))s++,n+="(",this.advance();else if(this.check(E.RPAREN))s>0&&s--,n+=")",this.advance();else{let c=this.current().value,u=n.length>0?n[n.length-1]:"";n.length>0&&!n.endsWith(" ")&&!(c==="="&&/[|&^+\-*/%<>]$/.test(n))&&!(c==="<"&&u==="<")&&!(c===">"&&u===">")&&(n+=" "),n+=c,this.advance()}}a||this.expect(E.DPAREN_END);let o=this.parseArithmeticExpression(n.trim()),l=this.parseOptionalRedirections();return q.arithmeticCommand(o,l,t.line)}parseConditionalCommand(){let t=this.expect(E.DBRACK_START),n=Ql(this);this.expect(E.DBRACK_END);let r=this.parseOptionalRedirections();return q.conditionalCommand(n,r,t.line)}parseFunctionDef(){let t;if(this.check(E.FUNCTION)){if(this.advance(),this.check(E.NAME)||this.check(E.WORD))t=this.advance().value;else{let s=this.current();throw new lt("Expected function name",s.line,s.column,s)}this.check(E.LPAREN)&&(this.advance(),this.expect(E.RPAREN))}else t=this.advance().value,t.includes("$")&&this.error(`\`${t}': not a valid identifier`),this.expect(E.LPAREN),this.expect(E.RPAREN);this.skipNewlines();let n=this.parseCompoundCommandBody({forFunctionBody:!0}),r=this.parseOptionalRedirections();return q.functionDef(t,n,r)}parseCompoundCommandBody(t){let n=t?.forFunctionBody;if(this.check(E.LBRACE))return Zl(this,{skipRedirections:n});if(this.check(E.LPAREN))return ql(this,{skipRedirections:n});if(this.check(E.IF))return zl(this,{skipRedirections:n});if(this.check(E.FOR))return Hl(this,{skipRedirections:n});if(this.check(E.WHILE))return jl(this,{skipRedirections:n});if(this.check(E.UNTIL))return Gl(this,{skipRedirections:n});if(this.check(E.CASE))return Vl(this,{skipRedirections:n});this.error("Expected compound command for function body")}parseCompoundList(){let t=this.enterDepth(),n=[];for(this.skipNewlines();!this.check(E.EOF,E.FI,E.ELSE,E.ELIF,E.THEN,E.DO,E.DONE,E.ESAC,E.RPAREN,E.RBRACE,E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND)&&this.isCommandStart();){this.checkIterationLimit();let r=this.pos,s=this.parseStatement();if(s&&n.push(s),this.skipSeparators(),this.pos===r&&!s)break}return t(),n}parseOptionalRedirections(){let t=[];for(;Ki(this);){this.checkIterationLimit();let n=this.pos;if(t.push(Qi(this)),this.pos===n)break}return t}parseArithmeticExpression(t){return Ae(this,t)}}});function ec(e){return fx.get(e)??""}function jm(e){let t=[],n="",r=0;for(;r<e.length;){let s=e[r];if(s==="["){for(n+=s,r++,r<e.length&&(e[r]==="!"||e[r]==="^")&&(n+=e[r],r++),r<e.length&&e[r]==="]"&&(n+=e[r],r++);r<e.length&&e[r]!=="]";){if(e[r]==="["&&r+1<e.length&&e[r+1]===":"){let i=e.indexOf(":]",r+2);if(i!==-1){n+=e.slice(r,i+2),r=i+2;continue}}if(e[r]==="\\"&&r+1<e.length){n+=e[r]+e[r+1],r+=2;continue}n+=e[r],r++}r<e.length&&e[r]==="]"&&(n+=e[r],r++)}else s===":"?(n!==""&&t.push(n),n="",r++):s==="\\"&&r+1<e.length?(n+=s+e[r+1],r+=2):(n+=s,r++)}return n!==""&&t.push(n),t}function Gm(e){let t="^";for(let n=0;n<e.length;n++){let r=e[n];if(r==="*")t+="[^/]*";else if(r==="?")t+="[^/]";else if(r==="["){let s=n+1,i="[";s<e.length&&(e[s]==="^"||e[s]==="!")&&(i+="^",s++),s<e.length&&e[s]==="]"&&(i+="\\]",s++);let a=s;for(;a<e.length;){if(e[a]==="\\"&&a+1<e.length){a+=2;continue}if(e[a]==="["&&a+1<e.length&&e[a+1]===":"){let l=e.indexOf(":]",a+2);if(l!==-1){a=l+2;continue}}if(e[a]==="]")break;a++}let o=s;for(;s<e.length&&e[s]!=="]";){if(e[s]==="["&&s+1<e.length&&e[s+1]===":"){let l=e.indexOf(":]",s+2);if(l!==-1){let c=e.slice(s+2,l),u=ec(c);i+=u,s=l+2;continue}}if(e[s]==="\\"&&s+1<e.length){i+=`\\${e[s+1]}`,s+=2;continue}if(e[s]==="-"){let l=s===o,c=s+1===a;l||c?i+="\\-":i+="-"}else i+=e[s];s++}i+="]",t+=i,n=s}else if(r==="\\"&&n+1<e.length){let s=e[n+1];/[.+^${}()|\\*?[\]]/.test(s)?t+=`\\${s}`:t+=s,n++}else/[.+^${}()|]/.test(r)?t+=`\\${r}`:t+=r}return t+="$",V(t)}function tc(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function nc(e){let t=[],n="",r=0,s=!1,i=0;for(;i<e.length;){let a=e[i];if(a==="'"&&!s){s=!0,n+="\0QUOTE_START\0",i++;continue}if(a==="'"&&s){s=!1,n+="\0QUOTE_END\0",i++;continue}if(s){n+=a,i++;continue}if(a==="\\"){n+=a,i+1<e.length?(n+=e[i+1],i+=2):i++;continue}a==="("?(r++,n+=a):a===")"?(r--,n+=a):a==="|"&&r===0?(t.push(n),n=""):n+=a,i++}return t.push(n),t}var fx,Vm=I(()=>{"use strict";Me();fx=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9a-fA-F"]])});var Un,Xi=I(()=>{"use strict";ye();Me();yr();Vm();Un=class{fs;cwd;globignorePatterns=[];hasGlobignore=!1;globstar=!1;nullglob=!1;failglob=!1;dotglob=!1;extglob=!1;globskipdots=!0;ops={count:0};maxOps;constructor(t,n,r,s){this.fs=t,this.cwd=n,typeof s=="boolean"?(this.globstar=s,this.maxOps=1e5):s?(this.globstar=s.globstar??!1,this.nullglob=s.nullglob??!1,this.failglob=s.failglob??!1,this.dotglob=s.dotglob??!1,this.extglob=s.extglob??!1,this.globskipdots=s.globskipdots??!0,this.maxOps=s.maxGlobOperations??1e5):this.maxOps=1e5;let i=r?.get("GLOBIGNORE");i!==void 0&&i!==""&&(this.hasGlobignore=!0,this.globignorePatterns=jm(i))}checkOpsLimit(){if(++this.ops.count>this.maxOps)throw new J(`Glob operation limit exceeded (${this.maxOps})`,"glob_operations")}hasNullglob(){return this.nullglob}hasFailglob(){return this.failglob}filterGlobignore(t){return!this.hasGlobignore&&!this.globskipdots?t:t.filter(n=>{let r=n.split("/").pop()||n;if((this.hasGlobignore||this.globskipdots)&&(r==="."||r===".."))return!1;if(this.hasGlobignore){for(let s of this.globignorePatterns)if(this.matchGlobignorePattern(n,s))return!1}return!0})}matchGlobignorePattern(t,n){return Gm(n).test(t)}isGlobPattern(t){return!!(t.includes("*")||t.includes("?")||/\[.*\]/.test(t)||this.extglob&&/[@*+?!]\(/.test(t))}async expandArgs(t,n){let r=t.map((a,o)=>(n?.[o]??!1)||!this.isGlobPattern(a)?null:this.expand(a)),s=await Promise.all(r.map(a=>a||Promise.resolve(null))),i=[];for(let a=0;a<t.length;a++){let o=s[a];o===null?i.push(t[a]):o.length>0?i.push(...o):i.push(t[a])}return i}async expand(t){let n;if(t.includes("**")&&this.globstar&&this.isGlobstarValid(t))n=await this.expandRecursive(t);else{let r=t.replace(/\*\*+/g,"*");n=await this.expandSimple(r)}return this.filterGlobignore(n)}isGlobstarValid(t){let n=t.split("/");for(let r of n)if(r.includes("**")&&r!=="**")return!1;return!0}hasGlobChars(t){return!!(t.includes("*")||t.includes("?")||/\[.*\]/.test(t)||this.extglob&&/[@*+?!]\(/.test(t))}async expandSimple(t){let n=t.startsWith("/"),r=t.split("/").filter(c=>c!==""),s=-1;for(let c=0;c<r.length;c++)if(this.hasGlobChars(r[c])){s=c;break}if(s===-1)return[t];let i,a;if(s===0)n?(i="/",a="/"):(i=this.cwd,a="");else{let c=r.slice(0,s);n?(i=`/${c.join("/")}`,a=`/${c.join("/")}`):(i=this.fs.resolvePath(this.cwd,c.join("/")),a=c.join("/"))}let o=r.slice(s);return(await this.expandSegments(i,a,o)).sort()}async expandSegments(t,n,r){if(this.checkOpsLimit(),r.length===0)return[n];let[s,...i]=r,a=[];try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let o=await this.fs.readdirWithFileTypes(t),l=[],c=[...o],u=this.dotglob||this.hasGlobignore;if(s.startsWith(".")||this.dotglob){let p=o.some(m=>m.name==="."),h=o.some(m=>m.name==="..");p||c.push({name:".",isFile:!1,isDirectory:!0,isSymbolicLink:!1}),h||c.push({name:"..",isFile:!1,isDirectory:!0,isSymbolicLink:!1})}for(let p of c)if(!(p.name.startsWith(".")&&!s.startsWith(".")&&!u)&&this.matchPattern(p.name,s)){let h=t==="/"?`/${p.name}`:`${t}/${p.name}`,m;n===""?m=p.name:n==="/"?m=`/${p.name}`:m=`${n}/${p.name}`,i.length===0?l.push(Promise.resolve([m])):p.isDirectory&&l.push(this.expandSegments(h,m,i))}let f=await Promise.all(l);for(let p of f)a.push(...p)}else{this.checkOpsLimit();let o=await this.fs.readdir(t),l=[],c=[...o],u=this.dotglob||this.hasGlobignore;(s.startsWith(".")||this.dotglob)&&(o.includes(".")||c.push("."),o.includes("..")||c.push(".."));for(let p of c)if(!(p.startsWith(".")&&!s.startsWith(".")&&!u)&&this.matchPattern(p,s)){let h=t==="/"?`/${p}`:`${t}/${p}`,m;n===""?m=p:n==="/"?m=`/${p}`:m=`${n}/${p}`,i.length===0?l.push(Promise.resolve([m])):l.push((async()=>{try{if(this.checkOpsLimit(),(await this.fs.stat(h)).isDirectory)return this.expandSegments(h,m,i)}catch(d){if(d instanceof J)throw d}return[]})())}let f=await Promise.all(l);for(let p of f)a.push(...p)}}catch(o){if(o instanceof J)throw o}return a}async expandRecursive(t){let n=[],r=t.indexOf("**"),s=t.slice(0,r).replace(/\/$/,"")||".",a=t.slice(r+2).replace(/^\//,"");return a.includes("**")&&this.isGlobstarValid(a)?(await this.walkDirectoryMultiGlobstar(s,a,n),[...new Set(n)].sort()):(await this.walkDirectory(s,a,n),n.sort())}async walkDirectoryMultiGlobstar(t,n,r){this.checkOpsLimit();let s=this.fs.resolvePath(this.cwd,t);try{this.checkOpsLimit();let i=this.fs.readdirWithFileTypes?await this.fs.readdirWithFileTypes(s):null;if(i){let a=[];for(let c of i){let u=t==="."?c.name:`${t}/${c.name}`;c.isDirectory&&a.push(u)}let o=t==="."?n:`${t}/${n}`,l=await this.expandRecursive(o);r.push(...l);for(let c=0;c<a.length;c+=100){let u=a.slice(c,c+100);await Promise.all(u.map(f=>this.walkDirectoryMultiGlobstar(f,n,r)))}}else{this.checkOpsLimit();let a=await this.fs.readdir(s),o=[];for(let u of a){let f=t==="."?u:`${t}/${u}`,p=this.fs.resolvePath(this.cwd,f);try{this.checkOpsLimit(),(await this.fs.stat(p)).isDirectory&&o.push(f)}catch(h){if(h instanceof J)throw h}}let l=t==="."?n:`${t}/${n}`,c=await this.expandRecursive(l);r.push(...c);for(let u=0;u<o.length;u+=100){let f=o.slice(u,u+100);await Promise.all(f.map(p=>this.walkDirectoryMultiGlobstar(p,n,r)))}}}catch(i){if(i instanceof J)throw i}}async walkDirectory(t,n,r){this.checkOpsLimit();let s=this.fs.resolvePath(this.cwd,t);try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let i=await this.fs.readdirWithFileTypes(s),a=[],o=[];for(let l of i){let c=t==="."?l.name:`${t}/${l.name}`;l.isDirectory?o.push(c):n&&this.matchPattern(l.name,n)&&a.push(c)}r.push(...a);for(let l=0;l<o.length;l+=100){let c=o.slice(l,l+100);await Promise.all(c.map(u=>this.walkDirectory(u,n,r)))}}else{this.checkOpsLimit();let i=await this.fs.readdir(s),a=[];for(let l=0;l<i.length;l+=100){let c=i.slice(l,l+100),u=await Promise.all(c.map(async f=>{let p=t==="."?f:`${t}/${f}`,h=this.fs.resolvePath(this.cwd,p);try{this.checkOpsLimit();let m=await this.fs.stat(h);return{name:f,path:p,isDirectory:m.isDirectory}}catch(m){if(m instanceof J)throw m;return null}}));a.push(...u.filter(f=>f!==null))}for(let l of a)!l.isDirectory&&n&&this.matchPattern(l.name,n)&&r.push(l.path);let o=a.filter(l=>l.isDirectory);for(let l=0;l<o.length;l+=100){let c=o.slice(l,l+100);await Promise.all(c.map(u=>this.walkDirectory(u.path,n,r)))}}}catch(i){if(i instanceof J)throw i}}matchPattern(t,n){return this.patternToRegex(n).test(t)}patternToRegex(t){let n=this.patternToRegexStr(t);return V(`^${n}$`)}patternToRegexStr(t){let n="",r=!1;for(let s=0;s<t.length;s++){if(t.slice(s,s+13)==="\0QUOTE_START\0"){r=!0,s+=12;continue}if(t.slice(s,s+11)==="\0QUOTE_END\0"){r=!1,s+=10;continue}let i=t[s];if(r){/[.+^${}()|\\*?[\]]/.test(i)?n+=`\\${i}`:n+=i;continue}if(this.extglob&&(i==="@"||i==="*"||i==="+"||i==="?"||i==="!")&&s+1<t.length&&t[s+1]==="("){let a=tc(t,s+1);if(a!==-1){let o=t.slice(s+2,a),l=nc(o),c=l.map(f=>this.patternToRegexStr(f)),u=c.length>0?c.join("|"):"(?:)";if(i==="@")n+=`(?:${u})`;else if(i==="*")n+=`(?:${u})*`;else if(i==="+")n+=`(?:${u})+`;else if(i==="?")n+=`(?:${u})?`;else if(i==="!")if(a<t.length-1){let p=l.map(m=>this.computePatternLength(m));if(p.every(m=>m!==null)&&p.every(m=>m===p[0])&&p[0]!==null){let m=p[0];if(m===0)n+="(?:.+)";else{let d=[];m>0&&d.push(`.{0,${m-1}}`),d.push(`.{${m+1},}`),d.push(`(?!(?:${u})).{${m}}`),n+=`(?:${d.join("|")})`}}else n+=`(?:(?!(?:${u})).)*?`}else n+=`(?!(?:${u})$).*`;s=a;continue}}if(i==="*")n+=".*";else if(i==="?")n+=".";else if(i==="["){let a=s+1,o="[";a<t.length&&(t[a]==="^"||t[a]==="!")&&(o+="^",a++),a<t.length&&t[a]==="]"&&(o+="\\]",a++);let l=a;for(;l<t.length;){if(t[l]==="\\"&&l+1<t.length){l+=2;continue}if(t[l]==="["&&l+1<t.length&&t[l+1]===":"){let u=t.indexOf(":]",l+2);if(u!==-1){l=u+2;continue}}if(t[l]==="]")break;l++}let c=a;for(;a<t.length&&t[a]!=="]";){if(t[a]==="["&&a+1<t.length&&t[a+1]===":"){let u=t.indexOf(":]",a+2);if(u!==-1){let f=t.slice(a+2,u),p=ec(f);o+=p,a=u+2;continue}}if(t[a]==="\\"&&a+1<t.length){o+=`\\${t[a+1]}`,a+=2;continue}if(t[a]==="-"){let u=a===c,f=a+1===l;u||f?o+="\\-":o+="-"}else o+=t[a];a++}o+="]",n+=o,s=a}else if(i==="\\"&&s+1<t.length){let a=t[s+1];/[.+^${}()|\\*?[\]]/.test(a)?n+=`\\${a}`:n+=a,s++}else/[.+^${}()|]/.test(i)?n+=`\\${i}`:n+=i}return n}computePatternLength(t){let n=0,r=0,s=!1;for(;r<t.length;){if(t.slice(r,r+13)==="\0QUOTE_START\0"){s=!0,r+=13;continue}if(t.slice(r,r+11)==="\0QUOTE_END\0"){s=!1,r+=11;continue}let i=t[r];if(s){n+=1,r++;continue}if((i==="@"||i==="*"||i==="+"||i==="?"||i==="!")&&r+1<t.length&&t[r+1]==="("){let a=tc(t,r+1);if(a!==-1){if(i==="@"){let o=t.slice(r+2,a),c=nc(o).map(u=>this.computePatternLength(u));if(c.every(u=>u!==null)&&c.every(u=>u===c[0])){n+=c[0],r=a+1;continue}return null}return null}}if(i==="*")return null;if(i==="?"){n+=1,r++;continue}if(i==="["){let a=t.indexOf("]",r+1);if(a!==-1){n+=1,r=a+1;continue}n+=1,r++;continue}if(i==="\\"){n+=1,r+=2;continue}n+=1,r++}return n}}});function rc(e){for(let t=0;t<e.length;t++){if(e[t]==="\\"){t++;continue}if(e[t]==="$"){let n=e[t+1];if(n==="{"||n&&/[a-zA-Z_]/.test(n))return!0}}return!1}function px(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type==="DefaultValue"||t.type==="AssignDefault"||t.type==="UseAlternative"||t.type==="ErrorIfUnset")&&(n=t.word?.parts),!n)return!1;for(let r of n)if(r.type==="DoubleQuoted"||r.type==="SingleQuoted")return!0;return!1}function qm(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type==="DefaultValue"||t.type==="AssignDefault"||t.type==="UseAlternative"||t.type==="ErrorIfUnset")&&(n=t.word?.parts),!n||n.length===0)return!1;for(let r of n)if(r.type!=="DoubleQuoted"&&r.type!=="SingleQuoted")return!1;return!0}function Rs(e){let t=!1,n=!1,r=!1,s=!1,i=!1,a=!1,o=!1;for(let l of e){if((l.type==="SingleQuoted"||l.type==="DoubleQuoted")&&(t=!0,l.type==="DoubleQuoted"))for(let c of l.parts)c.type==="ParameterExpansion"&&(c.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/)&&(!c.operation||c.operation.type==="PatternRemoval"||c.operation.type==="PatternReplacement")&&(s=!0),(c.operation?.type==="VarNamePrefix"||c.operation?.type==="ArrayKeys")&&(a=!0),c.operation?.type==="Indirection"&&(o=!0));l.type==="CommandSubstitution"&&(n=!0),l.type==="ParameterExpansion"&&(i=!0,(l.parameter==="@"||l.parameter==="*")&&(r=!0),px(l)&&(t=!0),(l.operation?.type==="VarNamePrefix"||l.operation?.type==="ArrayKeys")&&(a=!0),l.operation?.type==="Indirection"&&(o=!0)),l.type==="Glob"&&rc(l.pattern)&&(i=!0)}return{hasQuoted:t,hasCommandSub:n,hasArrayVar:r,hasArrayAtExpansion:s,hasParamExpansion:i,hasVarNamePrefixExpansion:a,hasIndirection:o}}var Yi=I(()=>{"use strict"});function Ye(e,t){let n=`${t}_`,r=[];for(let s of e.state.env.keys())if(s.startsWith(n)){let i=s.slice(n.length),a=Number.parseInt(i,10);!Number.isNaN(a)&&String(a)===i&&r.push(a)}return r.sort((s,i)=>s-i)}function wn(e,t){let n=`${t}_`;for(let r of e.state.env.keys())r.startsWith(n)&&e.state.env.delete(r)}function sn(e,t){let n=`${t}_`,r=`${t}__length`,s=[];for(let i of e.state.env.keys())if(i!==r&&i.startsWith(n)){let a=i.slice(n.length);if(a.startsWith("_length"))continue;s.push(a)}return s.sort()}function Ji(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function sc(e){if(e.parts.length<2)return null;let t=e.parts[0],n=e.parts[1];if(t.type!=="Glob"||!t.pattern.startsWith("["))return null;let r,s=n,i=1;if(n.type==="Literal"&&n.value.startsWith("]")){let f=n.value.slice(1);if(f.startsWith("+=")||f.startsWith("="))r=t.pattern.slice(1);else if(f===""){if(e.parts.length<3)return null;let p=e.parts[2];if(p.type!=="Literal"||!p.value.startsWith("=")&&!p.value.startsWith("+="))return null;r=t.pattern.slice(1),s=p,i=2}else return null}else if(t.pattern==="["&&(n.type==="DoubleQuoted"||n.type==="SingleQuoted")){if(e.parts.length<3)return null;let f=e.parts[2];if(f.type!=="Literal"||!f.value.startsWith("]=")&&!f.value.startsWith("]+="))return null;if(n.type==="SingleQuoted")r=n.value;else{r="";for(let p of n.parts)(p.type==="Literal"||p.type==="Escaped")&&(r+=p.value)}s=f,i=2}else if(t.pattern.endsWith("]")){if(n.type!=="Literal"||!n.value.startsWith("=")&&!n.value.startsWith("+="))return null;r=t.pattern.slice(1,-1)}else return null;r=Ji(r);let a;if(s.type!=="Literal")return null;s.value.startsWith("]=")||s.value.startsWith("]+=")?a=s.value.slice(1):a=s.value;let o=a.startsWith("+=");if(!o&&!a.startsWith("="))return null;let l=[],c=o?2:1,u=a.slice(c);u&&l.push({type:"Literal",value:u});for(let f=i+1;f<e.parts.length;f++){let p=e.parts[f];p.type==="BraceExpansion"?l.push({type:"Literal",value:hx(p)}):l.push(p)}return{key:r,valueParts:l,append:o}}function hx(e){return`{${e.items.map(n=>{if(n.type==="Range"){let r=n.startStr??String(n.start),s=n.endStr??String(n.end),i=`${r}..${s}`;return n.step&&(i+=`..${n.step}`),i}return jr(n.word)}).join(",")}}`}function jr(e){let t="";for(let n of e.parts)switch(n.type){case"Literal":t+=n.value;break;case"Glob":t+=n.pattern;break;case"SingleQuoted":t+=n.value;break;case"DoubleQuoted":for(let r of n.parts)(r.type==="Literal"||r.type==="Escaped")&&(t+=r.value);break;case"Escaped":t+=n.value;break;case"BraceExpansion":t+="{",t+=n.items.map(r=>r.type==="Range"?`${r.startStr}..${r.endStr}${r.step?`..${r.step}`:""}`:jr(r.word)).join(","),t+="}";break;case"TildeExpansion":t+="~",n.user&&(t+=n.user);break}return t}var Xt=I(()=>{"use strict"});function rt(e){return e.get("IFS")??`
770
+ `&&(o+=u),a+=2):(o+=e[a],a++)}else o+=e[a],a++;a>=e.length&&s("unexpected EOF while looking for matching ``'");let c=r().parse(o);return{part:q.commandSubstitution(c,!0),endIndex:a+1}}var Mm=I(()=>{"use strict";lr()});function rn(e,t){return new ce().parse(e,t)}var ce,Xe=I(()=>{"use strict";lr();mt();km();Im();Tm();Dm();Fn();Mm();or();or();ce=class e{tokens=[];pos=0;pendingHeredocs=[];parseIterations=0;parseDepth=0;_input="";getInput(){return this._input}checkIterationLimit(){if(this.parseIterations++,this.parseIterations>em)throw new lt("Maximum parse iterations exceeded (possible infinite loop)",this.current().line,this.current().column)}enterDepth(){if(this.parseDepth++,this.parseDepth>Dl)throw new lt(`Maximum parser nesting depth exceeded (${Dl})`,this.current().line,this.current().column);return()=>{this.parseDepth--}}parse(t,n){if(t.length>Tl)throw new lt(`Input too large: ${t.length} bytes exceeds limit of ${Tl}`,1,1);this._input=t;let r=new Vi(t,n);if(this.tokens=r.tokenize(),this.tokens.length>Pl)throw new lt(`Too many tokens: ${this.tokens.length} exceeds limit of ${Pl}`,1,1);return this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}parseTokens(t){return this.tokens=t,this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}current(){return this.tokens[this.pos]||this.tokens[this.tokens.length-1]}peek(t=0){return this.tokens[this.pos+t]||this.tokens[this.tokens.length-1]}advance(){let t=this.current();return this.pos<this.tokens.length-1&&this.pos++,t}getPos(){return this.pos}check(t,n,r,s,...i){let a=this.tokens[this.pos]?.type;return a===t||n!==void 0&&a===n||r!==void 0&&a===r||s!==void 0&&a===s?!0:i.length>0?i.includes(a):!1}expect(t,n){if(this.check(t))return this.advance();let r=this.current();throw new lt(n||`Expected ${t}, got ${r.type}`,r.line,r.column,r)}error(t){let n=this.current();throw new lt(t,n.line,n.column,n)}skipNewlines(){for(;this.check(E.NEWLINE,E.COMMENT);)this.check(E.NEWLINE)?(this.advance(),this.processHeredocs()):this.advance()}skipSeparators(t=!0){for(;;){if(this.check(E.NEWLINE)){this.advance(),this.processHeredocs();continue}if(this.check(E.SEMICOLON,E.COMMENT)){this.advance();continue}if(t&&this.check(E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND)){this.advance();continue}break}}addPendingHeredoc(t,n,r,s){this.pendingHeredocs.push({redirect:t,delimiter:n,stripTabs:r,quoted:s})}processHeredocs(){for(let t of this.pendingHeredocs)if(this.check(E.HEREDOC_CONTENT)){let n=this.advance(),r;t.quoted?r=q.word([q.literal(n.value)]):r=this.parseWordFromString(n.value,!1,!1,!1,!0),t.redirect.target=q.hereDoc(t.delimiter,r,t.stripTabs,t.quoted)}this.pendingHeredocs=[]}isStatementEnd(){return this.check(E.EOF,E.NEWLINE,E.SEMICOLON,E.AMP,E.AND_AND,E.OR_OR,E.RPAREN,E.RBRACE,E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND)}isCommandStart(){let t=this.current().type;return t===E.WORD||t===E.NAME||t===E.NUMBER||t===E.ASSIGNMENT_WORD||t===E.IF||t===E.FOR||t===E.WHILE||t===E.UNTIL||t===E.CASE||t===E.LPAREN||t===E.LBRACE||t===E.DPAREN_START||t===E.DBRACK_START||t===E.FUNCTION||t===E.BANG||t===E.TIME||t===E.IN||t===E.LESS||t===E.GREAT||t===E.DLESS||t===E.DGREAT||t===E.LESSAND||t===E.GREATAND||t===E.LESSGREAT||t===E.DLESSDASH||t===E.CLOBBER||t===E.TLESS||t===E.AND_GREAT||t===E.AND_DGREAT}parseScript(){let t=[],r=0;for(this.skipNewlines();!this.check(E.EOF);){r++,r>1e4&&this.error("Parser stuck: too many iterations (>10000)");let s=this.checkUnexpectedToken();if(s){t.push(s),this.skipSeparators(!1);continue}let i=this.pos,a=this.parseStatement();a&&t.push(a),this.skipSeparators(!1),this.check(E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${this.current().value}'`),this.pos===i&&!this.check(E.EOF)&&this.advance()}return q.script(t)}checkUnexpectedToken(){let t=this.current().type,n=this.current().value;if((t===E.DO||t===E.DONE||t===E.THEN||t===E.ELSE||t===E.ELIF||t===E.FI||t===E.ESAC)&&this.error(`syntax error near unexpected token \`${n}'`),t===E.RBRACE||t===E.RPAREN){let r=`syntax error near unexpected token \`${n}'`;return this.advance(),q.statement([q.pipeline([q.simpleCommand(null,[],[],[])])],[],!1,{message:r,token:n})}return(t===E.DSEMI||t===E.SEMI_AND||t===E.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${n}'`),t===E.SEMICOLON&&this.error(`syntax error near unexpected token \`${n}'`),(t===E.PIPE||t===E.PIPE_AMP)&&this.error(`syntax error near unexpected token \`${n}'`),null}parseStatement(){if(this.skipNewlines(),!this.isCommandStart())return null;let t=this.current().start,n=[],r=[],s=!1,i=this.parsePipeline();for(n.push(i);this.check(E.AND_AND,E.OR_OR);){let l=this.advance();r.push(l.type===E.AND_AND?"&&":"||"),this.skipNewlines();let c=this.parsePipeline();n.push(c)}this.check(E.AMP)&&(this.advance(),s=!0);let a=this.pos>0?this.tokens[this.pos-1].end:t,o=this._input.slice(t,a);return q.statement(n,r,s,void 0,o)}parsePipeline(){let t=!1,n=!1;this.check(E.TIME)&&(this.advance(),t=!0,this.check(E.WORD,E.NAME)&&this.current().value==="-p"&&(this.advance(),n=!0));let r=0;for(;this.check(E.BANG);)this.advance(),r++;let s=r%2===1,i=[],a=[],o=this.parseCommand();for(i.push(o);this.check(E.PIPE,E.PIPE_AMP);){let l=this.advance();this.skipNewlines(),a.push(l.type===E.PIPE_AMP);let c=this.parseCommand();i.push(c)}return q.pipeline(i,s,t,n,a.length>0?a:void 0)}parseCommand(){return this.check(E.IF)?zl(this):this.check(E.FOR)?Hl(this):this.check(E.WHILE)?jl(this):this.check(E.UNTIL)?Gl(this):this.check(E.CASE)?Vl(this):this.check(E.LPAREN)?ql(this):this.check(E.LBRACE)?Zl(this):this.check(E.DPAREN_START)?this.dparenClosesWithSpacedParens()?this.parseNestedSubshellsFromDparen():this.parseArithmeticCommand():this.check(E.DBRACK_START)?this.parseConditionalCommand():this.check(E.FUNCTION)?this.parseFunctionDef():this.check(E.NAME,E.WORD)&&this.peek(1).type===E.LPAREN&&this.peek(2).type===E.RPAREN?this.parseFunctionDef():vm(this)}dparenClosesWithSpacedParens(){let t=1,n=1;for(;n<this.tokens.length-this.pos;){let r=this.peek(n);if(r.type===E.EOF)return!1;if(r.type===E.DPAREN_START||r.type===E.LPAREN)t++;else if(r.type===E.DPAREN_END){if(t-=2,t<=0)return!1}else if(r.type===E.RPAREN&&(t--,t===0&&this.peek(n+1).type===E.RPAREN))return!0;n++}return!1}parseNestedSubshellsFromDparen(){this.advance();let t=this.parseCompoundList();this.expect(E.RPAREN),this.expect(E.RPAREN);let n=this.parseOptionalRedirections(),r=q.subshell(t,[]);return q.subshell([q.statement([q.pipeline([r],!1,!1,!1)])],n)}isWord(){let t=this.current().type;return t===E.WORD||t===E.NAME||t===E.NUMBER||t===E.IF||t===E.FOR||t===E.WHILE||t===E.UNTIL||t===E.CASE||t===E.FUNCTION||t===E.ELSE||t===E.ELIF||t===E.FI||t===E.THEN||t===E.DO||t===E.DONE||t===E.ESAC||t===E.IN||t===E.SELECT||t===E.TIME||t===E.COPROC||t===E.BANG}parseWord(){let t=this.advance();return this.parseWordFromString(t.value,t.quoted,t.singleQuoted)}parseWordNoBraceExpansion(){let t=this.advance();return this.parseWordFromString(t.value,t.quoted,t.singleQuoted,!1,!1,!0)}parseWordForRegex(){let t=this.advance();return this.parseWordFromString(t.value,t.quoted,t.singleQuoted,!1,!1,!0,!0)}parseWordFromString(t,n=!1,r=!1,s=!1,i=!1,a=!1,o=!1){let l=Mn(this,t,n,r,s,i,!1,a,o);return q.word(l)}parseCommandSubstitution(t,n){return Lm(t,n,()=>new e,r=>this.error(r))}parseBacktickSubstitution(t,n,r=!1){return Fm(t,n,r,()=>new e,s=>this.error(s))}isDollarDparenSubshell(t,n){return _m(t,n)}parseArithmeticExpansion(t,n){let r=n+3,s=1,i=0,a=r;for(;a<t.length-1&&s>0;)t[a]==="$"&&t[a+1]==="("?t[a+2]==="("?(s++,a+=3):(i++,a+=2):t[a]==="("&&t[a+1]==="("?(s++,a+=2):t[a]===")"&&t[a+1]===")"?i>0?(i--,a++):(s--,s>0&&(a+=2)):t[a]==="("?(i++,a++):(t[a]===")"&&i>0&&i--,a++);let o=t.slice(r,a),l=this.parseArithmeticExpression(o);return{part:q.arithmeticExpansion(l),endIndex:a+2}}parseArithmeticCommand(){let t=this.expect(E.DPAREN_START),n="",r=1,s=0,i=!1,a=!1;for(;r>0&&!this.check(E.EOF);){if(i){if(i=!1,s>0){s--,n+=")";continue}if(this.check(E.RPAREN)){r--,a=!0,this.advance();continue}if(this.check(E.DPAREN_END)){r--,a=!0;continue}n+=")";continue}if(this.check(E.DPAREN_START))r++,n+="((",this.advance();else if(this.check(E.DPAREN_END))s>=2?(s-=2,n+="))",this.advance()):s===1?(s--,n+=")",i=!0,this.advance()):(r--,a=!0,r>0&&(n+="))"),this.advance());else if(this.check(E.LPAREN))s++,n+="(",this.advance();else if(this.check(E.RPAREN))s>0&&s--,n+=")",this.advance();else{let c=this.current().value,u=n.length>0?n[n.length-1]:"";n.length>0&&!n.endsWith(" ")&&!(c==="="&&/[|&^+\-*/%<>]$/.test(n))&&!(c==="<"&&u==="<")&&!(c===">"&&u===">")&&(n+=" "),n+=c,this.advance()}}a||this.expect(E.DPAREN_END);let o=this.parseArithmeticExpression(n.trim()),l=this.parseOptionalRedirections();return q.arithmeticCommand(o,l,t.line)}parseConditionalCommand(){let t=this.expect(E.DBRACK_START),n=Ql(this);this.expect(E.DBRACK_END);let r=this.parseOptionalRedirections();return q.conditionalCommand(n,r,t.line)}parseFunctionDef(){let t;if(this.check(E.FUNCTION)){if(this.advance(),this.check(E.NAME)||this.check(E.WORD))t=this.advance().value;else{let s=this.current();throw new lt("Expected function name",s.line,s.column,s)}this.check(E.LPAREN)&&(this.advance(),this.expect(E.RPAREN))}else t=this.advance().value,t.includes("$")&&this.error(`\`${t}': not a valid identifier`),this.expect(E.LPAREN),this.expect(E.RPAREN);this.skipNewlines();let n=this.parseCompoundCommandBody({forFunctionBody:!0}),r=this.parseOptionalRedirections();return q.functionDef(t,n,r)}parseCompoundCommandBody(t){let n=t?.forFunctionBody;if(this.check(E.LBRACE))return Zl(this,{skipRedirections:n});if(this.check(E.LPAREN))return ql(this,{skipRedirections:n});if(this.check(E.IF))return zl(this,{skipRedirections:n});if(this.check(E.FOR))return Hl(this,{skipRedirections:n});if(this.check(E.WHILE))return jl(this,{skipRedirections:n});if(this.check(E.UNTIL))return Gl(this,{skipRedirections:n});if(this.check(E.CASE))return Vl(this,{skipRedirections:n});this.error("Expected compound command for function body")}parseCompoundList(){let t=this.enterDepth(),n=[];for(this.skipNewlines();!this.check(E.EOF,E.FI,E.ELSE,E.ELIF,E.THEN,E.DO,E.DONE,E.ESAC,E.RPAREN,E.RBRACE,E.DSEMI,E.SEMI_AND,E.SEMI_SEMI_AND)&&this.isCommandStart();){this.checkIterationLimit();let r=this.pos,s=this.parseStatement();if(s&&n.push(s),this.skipSeparators(),this.pos===r&&!s)break}return t(),n}parseOptionalRedirections(){let t=[];for(;Ki(this);){this.checkIterationLimit();let n=this.pos;if(t.push(Qi(this)),this.pos===n)break}return t}parseArithmeticExpression(t){return Ae(this,t)}}});function ec(e){return fx.get(e)??""}function jm(e){let t=[],n="",r=0;for(;r<e.length;){let s=e[r];if(s==="["){for(n+=s,r++,r<e.length&&(e[r]==="!"||e[r]==="^")&&(n+=e[r],r++),r<e.length&&e[r]==="]"&&(n+=e[r],r++);r<e.length&&e[r]!=="]";){if(e[r]==="["&&r+1<e.length&&e[r+1]===":"){let i=e.indexOf(":]",r+2);if(i!==-1){n+=e.slice(r,i+2),r=i+2;continue}}if(e[r]==="\\"&&r+1<e.length){n+=e[r]+e[r+1],r+=2;continue}n+=e[r],r++}r<e.length&&e[r]==="]"&&(n+=e[r],r++)}else s===":"?(n!==""&&t.push(n),n="",r++):s==="\\"&&r+1<e.length?(n+=s+e[r+1],r+=2):(n+=s,r++)}return n!==""&&t.push(n),t}function Gm(e){let t="^";for(let n=0;n<e.length;n++){let r=e[n];if(r==="*")t+="[^/]*";else if(r==="?")t+="[^/]";else if(r==="["){let s=n+1,i="[";s<e.length&&(e[s]==="^"||e[s]==="!")&&(i+="^",s++),s<e.length&&e[s]==="]"&&(i+="\\]",s++);let a=s;for(;a<e.length;){if(e[a]==="\\"&&a+1<e.length){a+=2;continue}if(e[a]==="["&&a+1<e.length&&e[a+1]===":"){let l=e.indexOf(":]",a+2);if(l!==-1){a=l+2;continue}}if(e[a]==="]")break;a++}let o=s;for(;s<e.length&&e[s]!=="]";){if(e[s]==="["&&s+1<e.length&&e[s+1]===":"){let l=e.indexOf(":]",s+2);if(l!==-1){let c=e.slice(s+2,l),u=ec(c);i+=u,s=l+2;continue}}if(e[s]==="\\"&&s+1<e.length){i+=`\\${e[s+1]}`,s+=2;continue}if(e[s]==="-"){let l=s===o,c=s+1===a;l||c?i+="\\-":i+="-"}else i+=e[s];s++}i+="]",t+=i,n=s}else if(r==="\\"&&n+1<e.length){let s=e[n+1];/[.+^${}()|\\*?[\]]/.test(s)?t+=`\\${s}`:t+=s,n++}else/[.+^${}()|]/.test(r)?t+=`\\${r}`:t+=r}return t+="$",V(t)}function tc(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function nc(e){let t=[],n="",r=0,s=!1,i=0;for(;i<e.length;){let a=e[i];if(a==="'"&&!s){s=!0,n+="\0QUOTE_START\0",i++;continue}if(a==="'"&&s){s=!1,n+="\0QUOTE_END\0",i++;continue}if(s){n+=a,i++;continue}if(a==="\\"){n+=a,i+1<e.length?(n+=e[i+1],i+=2):i++;continue}a==="("?(r++,n+=a):a===")"?(r--,n+=a):a==="|"&&r===0?(t.push(n),n=""):n+=a,i++}return t.push(n),t}var fx,Vm=I(()=>{"use strict";Me();fx=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9a-fA-F"]])});var Un,Xi=I(()=>{"use strict";ye();Me();yr();Vm();Un=class{fs;cwd;globignorePatterns=[];hasGlobignore=!1;globstar=!1;nullglob=!1;failglob=!1;dotglob=!1;extglob=!1;globskipdots=!0;ops={count:0};maxOps;constructor(t,n,r,s){this.fs=t,this.cwd=n,typeof s=="boolean"?(this.globstar=s,this.maxOps=1e5):s?(this.globstar=s.globstar??!1,this.nullglob=s.nullglob??!1,this.failglob=s.failglob??!1,this.dotglob=s.dotglob??!1,this.extglob=s.extglob??!1,this.globskipdots=s.globskipdots??!0,this.maxOps=s.maxGlobOperations??1e5):this.maxOps=1e5;let i=r?.get("GLOBIGNORE");i!==void 0&&i!==""&&(this.hasGlobignore=!0,this.globignorePatterns=jm(i))}checkOpsLimit(){if(++this.ops.count>this.maxOps)throw new J(`Glob operation limit exceeded (${this.maxOps})`,"glob_operations")}hasNullglob(){return this.nullglob}hasFailglob(){return this.failglob}filterGlobignore(t){return!this.hasGlobignore&&!this.globskipdots?t:t.filter(n=>{let r=n.split("/").pop()||n;if((this.hasGlobignore||this.globskipdots)&&(r==="."||r===".."))return!1;if(this.hasGlobignore){for(let s of this.globignorePatterns)if(this.matchGlobignorePattern(n,s))return!1}return!0})}matchGlobignorePattern(t,n){return Gm(n).test(t)}isGlobPattern(t){return!!(t.includes("*")||t.includes("?")||/\[.*\]/.test(t)||this.extglob&&/[@*+?!]\(/.test(t))}async expandArgs(t,n){let r=t.map((a,o)=>(n?.[o]??!1)||!this.isGlobPattern(a)?null:this.expand(a)),s=await Promise.all(r.map(a=>a||Promise.resolve(null))),i=[];for(let a=0;a<t.length;a++){let o=s[a];o===null?i.push(t[a]):o.length>0?i.push(...o):i.push(t[a])}return i}async expand(t){let n;if(t.includes("**")&&this.globstar&&this.isGlobstarValid(t))n=await this.expandRecursive(t);else{let r=t.replace(/\*\*+/g,"*");n=await this.expandSimple(r)}return this.filterGlobignore(n)}isGlobstarValid(t){let n=t.split("/");for(let r of n)if(r.includes("**")&&r!=="**")return!1;return!0}hasGlobChars(t){return!!(t.includes("*")||t.includes("?")||/\[.*\]/.test(t)||this.extglob&&/[@*+?!]\(/.test(t))}async expandSimple(t){let n=t.startsWith("/"),r=t.split("/").filter(c=>c!==""),s=-1;for(let c=0;c<r.length;c++)if(this.hasGlobChars(r[c])){s=c;break}if(s===-1)return[t];let i,a;if(s===0)n?(i="/",a="/"):(i=this.cwd,a="");else{let c=r.slice(0,s);n?(i=`/${c.join("/")}`,a=`/${c.join("/")}`):(i=this.fs.resolvePath(this.cwd,c.join("/")),a=c.join("/"))}let o=r.slice(s);return(await this.expandSegments(i,a,o)).sort()}async expandSegments(t,n,r){if(this.checkOpsLimit(),r.length===0)return[n];let[s,...i]=r,a=[];try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let o=await this.fs.readdirWithFileTypes(t),l=[],c=[...o],u=this.dotglob||this.hasGlobignore;if(s.startsWith(".")||this.dotglob){let p=o.some(m=>m.name==="."),h=o.some(m=>m.name==="..");p||c.push({name:".",isFile:!1,isDirectory:!0,isSymbolicLink:!1}),h||c.push({name:"..",isFile:!1,isDirectory:!0,isSymbolicLink:!1})}for(let p of c)if(!(p.name.startsWith(".")&&!s.startsWith(".")&&!u)&&this.matchPattern(p.name,s)){let h=t==="/"?`/${p.name}`:`${t}/${p.name}`,m;n===""?m=p.name:n==="/"?m=`/${p.name}`:m=`${n}/${p.name}`,i.length===0?l.push(Promise.resolve([m])):p.isDirectory&&l.push(this.expandSegments(h,m,i))}let f=await Promise.all(l);for(let p of f)a.push(...p)}else{this.checkOpsLimit();let o=await this.fs.readdir(t),l=[],c=[...o],u=this.dotglob||this.hasGlobignore;(s.startsWith(".")||this.dotglob)&&(o.includes(".")||c.push("."),o.includes("..")||c.push(".."));for(let p of c)if(!(p.startsWith(".")&&!s.startsWith(".")&&!u)&&this.matchPattern(p,s)){let h=t==="/"?`/${p}`:`${t}/${p}`,m;n===""?m=p:n==="/"?m=`/${p}`:m=`${n}/${p}`,i.length===0?l.push(Promise.resolve([m])):l.push((async()=>{try{if(this.checkOpsLimit(),(await this.fs.stat(h)).isDirectory)return this.expandSegments(h,m,i)}catch(d){if(d instanceof J)throw d}return[]})())}let f=await Promise.all(l);for(let p of f)a.push(...p)}}catch(o){if(o instanceof J)throw o}return a}async expandRecursive(t){let n=[],r=t.indexOf("**"),s=t.slice(0,r).replace(/\/$/,"")||".",a=t.slice(r+2).replace(/^\//,"");return a.includes("**")&&this.isGlobstarValid(a)?(await this.walkDirectoryMultiGlobstar(s,a,n),[...new Set(n)].sort()):(await this.walkDirectory(s,a,n),n.sort())}async walkDirectoryMultiGlobstar(t,n,r){this.checkOpsLimit();let s=this.fs.resolvePath(this.cwd,t);try{this.checkOpsLimit();let i=this.fs.readdirWithFileTypes?await this.fs.readdirWithFileTypes(s):null;if(i){let a=[];for(let c of i){let u=t==="."?c.name:`${t}/${c.name}`;c.isDirectory&&a.push(u)}let o=t==="."?n:`${t}/${n}`,l=await this.expandRecursive(o);r.push(...l);for(let c=0;c<a.length;c+=100){let u=a.slice(c,c+100);await Promise.all(u.map(f=>this.walkDirectoryMultiGlobstar(f,n,r)))}}else{this.checkOpsLimit();let a=await this.fs.readdir(s),o=[];for(let u of a){let f=t==="."?u:`${t}/${u}`,p=this.fs.resolvePath(this.cwd,f);try{this.checkOpsLimit(),(await this.fs.stat(p)).isDirectory&&o.push(f)}catch(h){if(h instanceof J)throw h}}let l=t==="."?n:`${t}/${n}`,c=await this.expandRecursive(l);r.push(...c);for(let u=0;u<o.length;u+=100){let f=o.slice(u,u+100);await Promise.all(f.map(p=>this.walkDirectoryMultiGlobstar(p,n,r)))}}}catch(i){if(i instanceof J)throw i}}async walkDirectory(t,n,r){this.checkOpsLimit();let s=this.fs.resolvePath(this.cwd,t);try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let i=await this.fs.readdirWithFileTypes(s),a=[],o=[];for(let l of i){let c=t==="."?l.name:`${t}/${l.name}`;l.isDirectory?o.push(c):n&&this.matchPattern(l.name,n)&&a.push(c)}r.push(...a);for(let l=0;l<o.length;l+=100){let c=o.slice(l,l+100);await Promise.all(c.map(u=>this.walkDirectory(u,n,r)))}}else{this.checkOpsLimit();let i=await this.fs.readdir(s),a=[];for(let l=0;l<i.length;l+=100){let c=i.slice(l,l+100),u=await Promise.all(c.map(async f=>{let p=t==="."?f:`${t}/${f}`,h=this.fs.resolvePath(this.cwd,p);try{this.checkOpsLimit();let m=await this.fs.stat(h);return{name:f,path:p,isDirectory:m.isDirectory}}catch(m){if(m instanceof J)throw m;return null}}));a.push(...u.filter(f=>f!==null))}for(let l of a)!l.isDirectory&&n&&this.matchPattern(l.name,n)&&r.push(l.path);let o=a.filter(l=>l.isDirectory);for(let l=0;l<o.length;l+=100){let c=o.slice(l,l+100);await Promise.all(c.map(u=>this.walkDirectory(u.path,n,r)))}}}catch(i){if(i instanceof J)throw i}}matchPattern(t,n){return this.patternToRegex(n).test(t)}patternToRegex(t){let n=this.patternToRegexStr(t);return V(`^${n}$`)}patternToRegexStr(t){let n="",r=!1;for(let s=0;s<t.length;s++){if(t.slice(s,s+13)==="\0QUOTE_START\0"){r=!0,s+=12;continue}if(t.slice(s,s+11)==="\0QUOTE_END\0"){r=!1,s+=10;continue}let i=t[s];if(r){/[.+^${}()|\\*?[\]]/.test(i)?n+=`\\${i}`:n+=i;continue}if(this.extglob&&(i==="@"||i==="*"||i==="+"||i==="?"||i==="!")&&s+1<t.length&&t[s+1]==="("){let a=tc(t,s+1);if(a!==-1){let o=t.slice(s+2,a),l=nc(o),c=l.map(f=>this.patternToRegexStr(f)),u=c.length>0?c.join("|"):"(?:)";if(i==="@")n+=`(?:${u})`;else if(i==="*")n+=`(?:${u})*`;else if(i==="+")n+=`(?:${u})+`;else if(i==="?")n+=`(?:${u})?`;else if(i==="!")if(a<t.length-1){let p=l.map(m=>this.computePatternLength(m));if(p.every(m=>m!==null)&&p.every(m=>m===p[0])&&p[0]!==null){let m=p[0];if(m===0)n+="(?:.+)";else{let d=[];m>0&&d.push(`.{0,${m-1}}`),d.push(`.{${m+1},}`),d.push(`(?!(?:${u})).{${m}}`),n+=`(?:${d.join("|")})`}}else n+=`(?:(?!(?:${u})).)*?`}else n+=`(?!(?:${u})$).*`;s=a;continue}}if(i==="*")n+=".*";else if(i==="?")n+=".";else if(i==="["){let a=s+1,o="[";a<t.length&&(t[a]==="^"||t[a]==="!")&&(o+="^",a++),a<t.length&&t[a]==="]"&&(o+="\\]",a++);let l=a;for(;l<t.length;){if(t[l]==="\\"&&l+1<t.length){l+=2;continue}if(t[l]==="["&&l+1<t.length&&t[l+1]===":"){let u=t.indexOf(":]",l+2);if(u!==-1){l=u+2;continue}}if(t[l]==="]")break;l++}let c=a;for(;a<t.length&&t[a]!=="]";){if(t[a]==="["&&a+1<t.length&&t[a+1]===":"){let u=t.indexOf(":]",a+2);if(u!==-1){let f=t.slice(a+2,u),p=ec(f);o+=p,a=u+2;continue}}if(t[a]==="\\"&&a+1<t.length){o+=`\\${t[a+1]}`,a+=2;continue}if(t[a]==="-"){let u=a===c,f=a+1===l;u||f?o+="\\-":o+="-"}else o+=t[a];a++}o+="]",n+=o,s=a}else if(i==="\\"&&s+1<t.length){let a=t[s+1];/[.+^${}()|\\*?[\]]/.test(a)?n+=`\\${a}`:n+=a,s++}else/[.+^${}()|]/.test(i)?n+=`\\${i}`:n+=i}return n}computePatternLength(t){let n=0,r=0,s=!1;for(;r<t.length;){if(t.slice(r,r+13)==="\0QUOTE_START\0"){s=!0,r+=13;continue}if(t.slice(r,r+11)==="\0QUOTE_END\0"){s=!1,r+=11;continue}let i=t[r];if(s){n+=1,r++;continue}if((i==="@"||i==="*"||i==="+"||i==="?"||i==="!")&&r+1<t.length&&t[r+1]==="("){let a=tc(t,r+1);if(a!==-1){if(i==="@"){let o=t.slice(r+2,a),c=nc(o).map(u=>this.computePatternLength(u));if(c.every(u=>u!==null)&&c.every(u=>u===c[0])){n+=c[0],r=a+1;continue}return null}return null}}if(i==="*")return null;if(i==="?"){n+=1,r++;continue}if(i==="["){let a=t.indexOf("]",r+1);if(a!==-1){n+=1,r=a+1;continue}n+=1,r++;continue}if(i==="\\"){n+=1,r+=2;continue}n+=1,r++}return n}}});function rc(e){for(let t=0;t<e.length;t++){if(e[t]==="\\"){t++;continue}if(e[t]==="$"){let n=e[t+1];if(n==="{"||n&&/[a-zA-Z_]/.test(n))return!0}}return!1}function px(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type==="DefaultValue"||t.type==="AssignDefault"||t.type==="UseAlternative"||t.type==="ErrorIfUnset")&&(n=t.word?.parts),!n)return!1;for(let r of n)if(r.type==="DoubleQuoted"||r.type==="SingleQuoted")return!0;return!1}function qm(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type==="DefaultValue"||t.type==="AssignDefault"||t.type==="UseAlternative"||t.type==="ErrorIfUnset")&&(n=t.word?.parts),!n||n.length===0)return!1;for(let r of n)if(r.type!=="DoubleQuoted"&&r.type!=="SingleQuoted")return!1;return!0}function Rs(e){let t=!1,n=!1,r=!1,s=!1,i=!1,a=!1,o=!1;for(let l of e){if((l.type==="SingleQuoted"||l.type==="DoubleQuoted")&&(t=!0,l.type==="DoubleQuoted"))for(let c of l.parts)c.type==="ParameterExpansion"&&(c.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/)&&(!c.operation||c.operation.type==="PatternRemoval"||c.operation.type==="PatternReplacement")&&(s=!0),(c.operation?.type==="VarNamePrefix"||c.operation?.type==="ArrayKeys")&&(a=!0),c.operation?.type==="Indirection"&&(o=!0));l.type==="CommandSubstitution"&&(n=!0),l.type==="ParameterExpansion"&&(i=!0,(l.parameter==="@"||l.parameter==="*")&&(r=!0),px(l)&&(t=!0),(l.operation?.type==="VarNamePrefix"||l.operation?.type==="ArrayKeys")&&(a=!0),l.operation?.type==="Indirection"&&(o=!0)),l.type==="Glob"&&rc(l.pattern)&&(i=!0)}return{hasQuoted:t,hasCommandSub:n,hasArrayVar:r,hasArrayAtExpansion:s,hasParamExpansion:i,hasVarNamePrefixExpansion:a,hasIndirection:o}}var Yi=I(()=>{"use strict"});function Ye(e,t){let n=`${t}_`,r=[];for(let s of e.state.env.keys())if(s.startsWith(n)){let i=s.slice(n.length),a=Number.parseInt(i,10);!Number.isNaN(a)&&String(a)===i&&r.push(a)}return r.sort((s,i)=>s-i)}function wn(e,t){let n=`${t}_`;for(let r of e.state.env.keys())r.startsWith(n)&&e.state.env.delete(r)}function sn(e,t){let n=`${t}_`,r=`${t}__length`,s=[];for(let i of e.state.env.keys())if(i!==r&&i.startsWith(n)){let a=i.slice(n.length);if(a.startsWith("_length"))continue;s.push(a)}return s.sort()}function Ji(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function sc(e){if(e.parts.length<2)return null;let t=e.parts[0],n=e.parts[1];if(t.type!=="Glob"||!t.pattern.startsWith("["))return null;let r,s=n,i=1;if(n.type==="Literal"&&n.value.startsWith("]")){let f=n.value.slice(1);if(f.startsWith("+=")||f.startsWith("="))r=t.pattern.slice(1);else if(f===""){if(e.parts.length<3)return null;let p=e.parts[2];if(p.type!=="Literal"||!p.value.startsWith("=")&&!p.value.startsWith("+="))return null;r=t.pattern.slice(1),s=p,i=2}else return null}else if(t.pattern==="["&&(n.type==="DoubleQuoted"||n.type==="SingleQuoted")){if(e.parts.length<3)return null;let f=e.parts[2];if(f.type!=="Literal"||!f.value.startsWith("]=")&&!f.value.startsWith("]+="))return null;if(n.type==="SingleQuoted")r=n.value;else{r="";for(let p of n.parts)(p.type==="Literal"||p.type==="Escaped")&&(r+=p.value)}s=f,i=2}else if(t.pattern.endsWith("]")){if(n.type!=="Literal"||!n.value.startsWith("=")&&!n.value.startsWith("+="))return null;r=t.pattern.slice(1,-1)}else return null;r=Ji(r);let a;if(s.type!=="Literal")return null;s.value.startsWith("]=")||s.value.startsWith("]+=")?a=s.value.slice(1):a=s.value;let o=a.startsWith("+=");if(!o&&!a.startsWith("="))return null;let l=[],c=o?2:1,u=a.slice(c);u&&l.push({type:"Literal",value:u});for(let f=i+1;f<e.parts.length;f++){let p=e.parts[f];p.type==="BraceExpansion"?l.push({type:"Literal",value:hx(p)}):l.push(p)}return{key:r,valueParts:l,append:o}}function hx(e){return`{${e.items.map(n=>{if(n.type==="Range"){let r=n.startStr??String(n.start),s=n.endStr??String(n.end),i=`${r}..${s}`;return n.step&&(i+=`..${n.step}`),i}return jr(n.word)}).join(",")}}`}function jr(e){let t="";for(let n of e.parts)switch(n.type){case"Literal":t+=n.value;break;case"Glob":t+=n.pattern;break;case"SingleQuoted":t+=n.value;break;case"DoubleQuoted":for(let r of n.parts)(r.type==="Literal"||r.type==="Escaped")&&(t+=r.value);break;case"Escaped":t+=n.value;break;case"BraceExpansion":t+="{",t+=n.items.map(r=>r.type==="Range"?`${r.startStr}..${r.endStr}${r.step?`..${r.step}`:""}`:jr(r.word)).join(","),t+="}";break;case"TildeExpansion":t+="~",n.user&&(t+=n.user);break}return t}var Xt=I(()=>{"use strict"});function rt(e){return e.get("IFS")??`
771
771
  `}function pt(e){return e.get("IFS")===""}function ea(e){let t=rt(e);if(t==="")return!0;for(let n of t)if(n!==" "&&n!==" "&&n!==`
772
772
  `)return!1;return!0}function Zm(e){let t=!1,n=[];for(let r of e.split(""))r==="-"?t=!0:/[\\^$.*+?()[\]{}|]/.test(r)?n.push(`\\${r}`):r===" "?n.push("\\t"):r===`
773
773
  `?n.push("\\n"):n.push(r);return t&&n.push("\\-"),n.join("")}function fe(e){let t=e.get("IFS");return t===void 0?" ":t[0]||""}function mx(e){return dx.includes(e)}function ic(e){let t=new Set,n=new Set;for(let r of e)mx(r)?t.add(r):n.add(r);return{whitespace:t,nonWhitespace:n}}function ac(e,t,n,r){if(t==="")return e===""?{words:[],wordStarts:[]}:{words:[e],wordStarts:[0]};let{whitespace:s,nonWhitespace:i}=ic(t),a=[],o=[],l=0;for(;l<e.length&&s.has(e[l]);)l++;if(l>=e.length)return{words:[],wordStarts:[]};if(i.has(e[l]))for(a.push(""),o.push(l),l++;l<e.length&&s.has(e[l]);)l++;for(;l<e.length&&!(n!==void 0&&a.length>=n);){let c=l;for(o.push(c);l<e.length;){let u=e[l];if(!r&&u==="\\"){l++,l<e.length&&l++;continue}if(s.has(u)||i.has(u))break;l++}if(a.push(e.substring(c,l)),l>=e.length)break;for(;l<e.length&&s.has(e[l]);)l++;if(l<e.length&&i.has(e[l])){for(l++;l<e.length&&s.has(e[l]);)l++;for(;l<e.length&&i.has(e[l])&&!(n!==void 0&&a.length>=n);)for(a.push(""),o.push(l),l++;l<e.length&&s.has(e[l]);)l++}}return{words:a,wordStarts:o}}function ta(e,t){if(t==="")return{words:e?[e]:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};if(e==="")return{words:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};let{whitespace:n,nonWhitespace:r}=ic(t),s=[],i=0,a=!1,o=!1,l=i;for(;i<e.length&&n.has(e[i]);)i++;if(i>l&&(a=!0),i>=e.length)return{words:[],hadLeadingDelimiter:!0,hadTrailingDelimiter:!0};if(r.has(e[i]))for(s.push(""),i++;i<e.length&&n.has(e[i]);)i++;for(;i<e.length;){let c=i;for(;i<e.length;){let f=e[i];if(n.has(f)||r.has(f))break;i++}if(s.push(e.substring(c,i)),i>=e.length){o=!1;break}let u=i;for(;i<e.length&&n.has(e[i]);)i++;if(i<e.length&&r.has(e[i])){for(i++;i<e.length&&n.has(e[i]);)i++;for(;i<e.length&&r.has(e[i]);)for(s.push(""),i++;i<e.length&&n.has(e[i]);)i++}i>=e.length&&i>u&&(o=!0)}return{words:s,hadLeadingDelimiter:a,hadTrailingDelimiter:o}}function _e(e,t){return ta(e,t).words}function gx(e,t){for(let n of e)if(t.has(n))return!0;return!1}function Km(e,t,n){if(t==="")return e;let{whitespace:r,nonWhitespace:s}=ic(t),i=e.length;for(;i>0&&r.has(e[i-1]);){if(!n&&i>=2){let o=0,l=i-2;for(;l>=0&&e[l]==="\\";)o++,l--;if(o%2===1)break}i--}let a=e.substring(0,i);if(a.length>=1&&s.has(a[a.length-1])){if(!n&&a.length>=2){let l=0,c=a.length-2;for(;c>=0&&a[c]==="\\";)l++,c--;if(l%2===1)return a}let o=a.substring(0,a.length-1);if(!gx(o,s))return o}return a}var dx,jt=I(()=>{"use strict";dx=`
774
- `});function Te(e,t){return e.state.namerefs?.has(t)??!1}function vn(e,t){e.state.namerefs??=new Set,e.state.namerefs.add(t)}function Qm(e,t){e.state.namerefs?.delete(t),e.state.boundNamerefs?.delete(t),e.state.invalidNamerefs?.delete(t)}function Xm(e,t){e.state.invalidNamerefs??=new Set,e.state.invalidNamerefs.add(t)}function Ym(e,t){return e.state.invalidNamerefs?.has(t)??!1}function oc(e,t){e.state.boundNamerefs??=new Set,e.state.boundNamerefs.add(t)}function na(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let s=n[1],i=Array.from(e.state.env.keys()).some(o=>o.startsWith(`${s}_`)&&!o.includes("__")),a=e.state.associativeArrays?.has(s)??!1;return i||a}return Array.from(e.state.env.keys()).some(s=>s.startsWith(`${t}_`)&&!s.includes("__"))?!0:e.state.env.has(t)}function St(e,t,n=100){if(!Te(e,t)||Ym(e,t))return t;let r=new Set,s=t;for(;n-- >0;){if(r.has(s))return;if(r.add(s),!Te(e,s))return s;let i=e.state.env.get(s);if(i===void 0||i===""||!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(i))return s;s=i}}function ur(e,t){if(Te(e,t))return e.state.env.get(t)}function Jm(e,t,n,r=100){if(!Te(e,t)||Ym(e,t))return t;let s=new Set,i=t;for(;r-- >0;){if(s.has(i))return;if(s.add(i),!Te(e,i))return i;let a=e.state.env.get(i);if(a===void 0||a==="")return n!==void 0?/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)&&na(e,n)?i:null:i;if(!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(a))return i;i=a}}var an=I(()=>{"use strict"});function yx(e,t){let n=t.replace(/\$\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g,(r,s)=>e.state.env.get(s)??"");return n=n.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(r,s)=>e.state.env.get(s)??""),n}function oe(e,t){return t==="FUNCNAME"?(e.state.funcNameStack??[]).map((i,a)=>[a,i]):t==="BASH_LINENO"?(e.state.callLineStack??[]).map((i,a)=>[a,String(i)]):t==="BASH_SOURCE"?(e.state.sourceStack??[]).map((i,a)=>[a,i]):e.state.associativeArrays?.has(t)?sn(e,t).map(i=>[i,e.state.env.get(`${t}_${i}`)??""]):Ye(e,t).map(s=>[s,e.state.env.get(`${t}_${s}`)??""])}function In(e,t){return t==="FUNCNAME"?(e.state.funcNameStack?.length??0)>0:t==="BASH_LINENO"?(e.state.callLineStack?.length??0)>0:t==="BASH_SOURCE"?(e.state.sourceStack?.length??0)>0:e.state.associativeArrays?.has(t)?sn(e,t).length>0:Ye(e,t).length>0}async function Se(e,t,n=!0,r=!1){switch(t){case"?":return String(e.state.lastExitCode);case"$":return String(e.state.virtualPid);case"#":return e.state.env.get("#")||"0";case"@":return e.state.env.get("@")||"";case"_":return e.state.lastArg;case"-":{let a="";return a+="h",e.state.options.errexit&&(a+="e"),e.state.options.noglob&&(a+="f"),e.state.options.nounset&&(a+="u"),e.state.options.verbose&&(a+="v"),e.state.options.xtrace&&(a+="x"),a+="B",e.state.options.noclobber&&(a+="C"),a+="s",a}case"*":{let a=Number.parseInt(e.state.env.get("#")||"0",10);if(a===0)return"";let o=[];for(let l=1;l<=a;l++)o.push(e.state.env.get(String(l))||"");return o.join(fe(e.state.env))}case"0":return e.state.env.get("0")||"bash";case"PWD":return e.state.env.get("PWD")??"";case"OLDPWD":return e.state.env.get("OLDPWD")??"";case"PPID":return String(e.state.virtualPpid);case"UID":return String(e.state.virtualUid);case"EUID":return String(e.state.virtualUid);case"RANDOM":return String(Math.floor(Math.random()*32768));case"SECONDS":return String(Math.floor((Date.now()-e.state.startTime)/1e3));case"BASH_VERSION":return q0;case"!":return String(e.state.lastBackgroundPid);case"BASHPID":return String(e.state.bashPid);case"LINENO":return String(e.state.currentLine);case"FUNCNAME":{let a=e.state.funcNameStack?.[0];if(a!==void 0)return a;if(n&&e.state.options.nounset)throw new wt("FUNCNAME");return""}case"BASH_LINENO":{let a=e.state.callLineStack?.[0];if(a!==void 0)return String(a);if(n&&e.state.options.nounset)throw new wt("BASH_LINENO");return""}case"BASH_SOURCE":{let a=e.state.sourceStack?.[0];if(a!==void 0)return a;if(n&&e.state.options.nounset)throw new wt("BASH_SOURCE");return""}}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[\]$/.test(t))throw new bt(`\${${t}}`);let s=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(s){let a=s[1],o=s[2];if(Te(e,a)){let f=St(e,a);if(f&&f!==a){if(f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return"";a=f}}if(o==="@"||o==="*"){let f=oe(e,a);if(f.length>0)return f.map(([,h])=>h).join(" ");let p=e.state.env.get(a);return p!==void 0?p:""}if(a==="FUNCNAME"){let f=Number.parseInt(o,10);return!Number.isNaN(f)&&f>=0?e.state.funcNameStack?.[f]??"":""}if(a==="BASH_LINENO"){let f=Number.parseInt(o,10);if(!Number.isNaN(f)&&f>=0){let p=e.state.callLineStack?.[f];return p!==void 0?String(p):""}return""}if(a==="BASH_SOURCE"){let f=Number.parseInt(o,10);return!Number.isNaN(f)&&f>=0?e.state.sourceStack?.[f]??"":""}if(e.state.associativeArrays?.has(a)){let f=Ji(o);f=yx(e,f);let p=e.state.env.get(`${a}_${f}`);if(p===void 0&&n&&e.state.options.nounset)throw new wt(`${a}[${o}]`);return p||""}let c;if(/^-?\d+$/.test(o))c=Number.parseInt(o,10);else try{let f=new ce,p=Ae(f,o);c=await ne(e,p.expression)}catch{let f=e.state.env.get(o);c=f?Number.parseInt(f,10):0,Number.isNaN(c)&&(c=0)}if(c<0){let f=oe(e,a),p=e.state.currentLine;if(f.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${p}: ${a}: bad array subscript
774
+ `});function Te(e,t){return e.state.namerefs?.has(t)??!1}function kn(e,t){e.state.namerefs??=new Set,e.state.namerefs.add(t)}function Qm(e,t){e.state.namerefs?.delete(t),e.state.boundNamerefs?.delete(t),e.state.invalidNamerefs?.delete(t)}function Xm(e,t){e.state.invalidNamerefs??=new Set,e.state.invalidNamerefs.add(t)}function Ym(e,t){return e.state.invalidNamerefs?.has(t)??!1}function oc(e,t){e.state.boundNamerefs??=new Set,e.state.boundNamerefs.add(t)}function na(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let s=n[1],i=Array.from(e.state.env.keys()).some(o=>o.startsWith(`${s}_`)&&!o.includes("__")),a=e.state.associativeArrays?.has(s)??!1;return i||a}return Array.from(e.state.env.keys()).some(s=>s.startsWith(`${t}_`)&&!s.includes("__"))?!0:e.state.env.has(t)}function St(e,t,n=100){if(!Te(e,t)||Ym(e,t))return t;let r=new Set,s=t;for(;n-- >0;){if(r.has(s))return;if(r.add(s),!Te(e,s))return s;let i=e.state.env.get(s);if(i===void 0||i===""||!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(i))return s;s=i}}function ur(e,t){if(Te(e,t))return e.state.env.get(t)}function Jm(e,t,n,r=100){if(!Te(e,t)||Ym(e,t))return t;let s=new Set,i=t;for(;r-- >0;){if(s.has(i))return;if(s.add(i),!Te(e,i))return i;let a=e.state.env.get(i);if(a===void 0||a==="")return n!==void 0?/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)&&na(e,n)?i:null:i;if(!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(a))return i;i=a}}var an=I(()=>{"use strict"});function yx(e,t){let n=t.replace(/\$\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g,(r,s)=>e.state.env.get(s)??"");return n=n.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(r,s)=>e.state.env.get(s)??""),n}function oe(e,t){return t==="FUNCNAME"?(e.state.funcNameStack??[]).map((i,a)=>[a,i]):t==="BASH_LINENO"?(e.state.callLineStack??[]).map((i,a)=>[a,String(i)]):t==="BASH_SOURCE"?(e.state.sourceStack??[]).map((i,a)=>[a,i]):e.state.associativeArrays?.has(t)?sn(e,t).map(i=>[i,e.state.env.get(`${t}_${i}`)??""]):Ye(e,t).map(s=>[s,e.state.env.get(`${t}_${s}`)??""])}function In(e,t){return t==="FUNCNAME"?(e.state.funcNameStack?.length??0)>0:t==="BASH_LINENO"?(e.state.callLineStack?.length??0)>0:t==="BASH_SOURCE"?(e.state.sourceStack?.length??0)>0:e.state.associativeArrays?.has(t)?sn(e,t).length>0:Ye(e,t).length>0}async function Se(e,t,n=!0,r=!1){switch(t){case"?":return String(e.state.lastExitCode);case"$":return String(e.state.virtualPid);case"#":return e.state.env.get("#")||"0";case"@":return e.state.env.get("@")||"";case"_":return e.state.lastArg;case"-":{let a="";return a+="h",e.state.options.errexit&&(a+="e"),e.state.options.noglob&&(a+="f"),e.state.options.nounset&&(a+="u"),e.state.options.verbose&&(a+="v"),e.state.options.xtrace&&(a+="x"),a+="B",e.state.options.noclobber&&(a+="C"),a+="s",a}case"*":{let a=Number.parseInt(e.state.env.get("#")||"0",10);if(a===0)return"";let o=[];for(let l=1;l<=a;l++)o.push(e.state.env.get(String(l))||"");return o.join(fe(e.state.env))}case"0":return e.state.env.get("0")||"bash";case"PWD":return e.state.env.get("PWD")??"";case"OLDPWD":return e.state.env.get("OLDPWD")??"";case"PPID":return String(e.state.virtualPpid);case"UID":return String(e.state.virtualUid);case"EUID":return String(e.state.virtualUid);case"RANDOM":return String(Math.floor(Math.random()*32768));case"SECONDS":return String(Math.floor((Date.now()-e.state.startTime)/1e3));case"BASH_VERSION":return q0;case"!":return String(e.state.lastBackgroundPid);case"BASHPID":return String(e.state.bashPid);case"LINENO":return String(e.state.currentLine);case"FUNCNAME":{let a=e.state.funcNameStack?.[0];if(a!==void 0)return a;if(n&&e.state.options.nounset)throw new wt("FUNCNAME");return""}case"BASH_LINENO":{let a=e.state.callLineStack?.[0];if(a!==void 0)return String(a);if(n&&e.state.options.nounset)throw new wt("BASH_LINENO");return""}case"BASH_SOURCE":{let a=e.state.sourceStack?.[0];if(a!==void 0)return a;if(n&&e.state.options.nounset)throw new wt("BASH_SOURCE");return""}}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[\]$/.test(t))throw new bt(`\${${t}}`);let s=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(s){let a=s[1],o=s[2];if(Te(e,a)){let f=St(e,a);if(f&&f!==a){if(f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return"";a=f}}if(o==="@"||o==="*"){let f=oe(e,a);if(f.length>0)return f.map(([,h])=>h).join(" ");let p=e.state.env.get(a);return p!==void 0?p:""}if(a==="FUNCNAME"){let f=Number.parseInt(o,10);return!Number.isNaN(f)&&f>=0?e.state.funcNameStack?.[f]??"":""}if(a==="BASH_LINENO"){let f=Number.parseInt(o,10);if(!Number.isNaN(f)&&f>=0){let p=e.state.callLineStack?.[f];return p!==void 0?String(p):""}return""}if(a==="BASH_SOURCE"){let f=Number.parseInt(o,10);return!Number.isNaN(f)&&f>=0?e.state.sourceStack?.[f]??"":""}if(e.state.associativeArrays?.has(a)){let f=Ji(o);f=yx(e,f);let p=e.state.env.get(`${a}_${f}`);if(p===void 0&&n&&e.state.options.nounset)throw new wt(`${a}[${o}]`);return p||""}let c;if(/^-?\d+$/.test(o))c=Number.parseInt(o,10);else try{let f=new ce,p=Ae(f,o);c=await ne(e,p.expression)}catch{let f=e.state.env.get(o);c=f?Number.parseInt(f,10):0,Number.isNaN(c)&&(c=0)}if(c<0){let f=oe(e,a),p=e.state.currentLine;if(f.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${p}: ${a}: bad array subscript
775
775
  `,"";let m=Math.max(...f.map(([g])=>typeof g=="number"?g:0))+1+c;return m<0?(e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${p}: ${a}: bad array subscript
776
- `,""):e.state.env.get(`${a}_${m}`)||""}let u=e.state.env.get(`${a}_${c}`);if(u!==void 0)return u;if(c===0){let f=e.state.env.get(a);if(f!==void 0)return f}if(n&&e.state.options.nounset)throw new wt(`${a}[${c}]`);return""}if(/^[1-9][0-9]*$/.test(t)){let a=e.state.env.get(t);if(a===void 0&&n&&e.state.options.nounset)throw new wt(t);return a||""}if(Te(e,t)){let a=St(e,t);if(a===void 0)return"";if(a!==t)return await Se(e,a,n,r);let o=e.state.env.get(t);if((o===void 0||o==="")&&n&&e.state.options.nounset)throw new wt(t);return o||""}let i=e.state.env.get(t);if(i!==void 0)return e.state.tempEnvBindings?.some(a=>a.has(t))&&(e.state.accessedTempEnvVars=e.state.accessedTempEnvVars||new Set,e.state.accessedTempEnvVars.add(t)),i;if(In(e,t)){let a=e.state.env.get(`${t}_0`);return a!==void 0?a:""}if(n&&e.state.options.nounset)throw new wt(t);return""}async function bn(e,t){if(new Set(["?","$","#","_","-","0","PPID","UID","EUID","RANDOM","SECONDS","BASH_VERSION","!","BASHPID","LINENO"]).has(t))return!0;if(t==="@"||t==="*")return Number.parseInt(e.state.env.get("#")||"0",10)>0;if(t==="PWD"||t==="OLDPWD")return e.state.env.has(t);let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(r){let s=r[1],i=r[2];if(Te(e,s)){let l=St(e,s);if(l&&l!==s){if(l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;s=l}}if(i==="@"||i==="*")return oe(e,s).length>0?!0:e.state.env.has(s);if(e.state.associativeArrays?.has(s)){let l=Ji(i);return e.state.env.has(`${s}_${l}`)}let o;if(/^-?\d+$/.test(i))o=Number.parseInt(i,10);else try{let l=new ce,c=Ae(l,i);o=await ne(e,c.expression)}catch{let l=e.state.env.get(i);o=l?Number.parseInt(l,10):0,Number.isNaN(o)&&(o=0)}if(o<0){let l=oe(e,s);if(l.length===0)return!1;let u=Math.max(...l.map(([f])=>typeof f=="number"?f:0))+1+o;return u<0?!1:e.state.env.has(`${s}_${u}`)}return e.state.env.has(`${s}_${o}`)}if(Te(e,t)){let s=St(e,t);return s===void 0||s===t?e.state.env.has(t):bn(e,s)}return!!(e.state.env.has(t)||In(e,t))}var Lt=I(()=>{"use strict";mt();Xe();Il();Ct();ye();Xt();jt();an()});async function e2(e,t){let n="",r=0;for(;r<t.length;){if(t[r]==="$"){if(t[r+1]==="{"){let s=1,i=r+2;for(;i<t.length&&s>0;)t[i]==="{"?s++:t[i]==="}"&&s--,i++;n+=t.slice(r,i),r=i;continue}if(t[r+1]==="("){let s=1,i=r+2;for(;i<t.length&&s>0;)t[i]==="("?s++:t[i]===")"&&s--,i++;n+=t.slice(r,i),r=i;continue}if(/[a-zA-Z_]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)s++;let i=t.slice(r+1,s),a=await Se(e,i);n+=a,r=s;continue}if(/[0-9]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[0-9]/.test(t[s]);)s++;let i=t.slice(r+1,s),a=await Se(e,i);n+=a,r=s;continue}if(/[*@#?\-!$]/.test(t[r+1]||"")){let s=t[r+1],i=await Se(e,s);n+=i,r+=2;continue}}if(t[r]==='"'){for(n+='"',r++;r<t.length&&t[r]!=='"';)if(t[r]==="$"&&/[a-zA-Z_]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)s++;let i=t.slice(r+1,s),a=await Se(e,i);n+=a,r=s}else t[r]==="\\"?(n+=t[r],r++,r<t.length&&(n+=t[r],r++)):(n+=t[r],r++);r<t.length&&(n+='"',r++);continue}n+=t[r],r++}return n}async function lc(e,t){let n=t,r=t.startsWith('"')&&t.endsWith('"'),s=t.startsWith("'")&&t.endsWith("'");if((r||s)&&(n=t.slice(1,-1)),s)return n;let i="",a=0;for(;a<n.length;)if(n[a]==="$")if(n[a+1]==="("){let o=1,l=a+2;for(;l<n.length&&o>0;)n[l]==="("&&n[l-1]==="$"||n[l]==="("?o++:n[l]===")"&&o--,l++;let c=n.slice(a+2,l-1);if(e.execFn){let u=await e.execFn(c);i+=u.stdout.replace(/\n+$/,""),u.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+u.stderr)}a=l}else if(n[a+1]==="{"){let o=1,l=a+2;for(;l<n.length&&o>0;)n[l]==="{"?o++:n[l]==="}"&&o--,l++;let c=n.slice(a+2,l-1),u=await Se(e,c);i+=u,a=l}else if(/[a-zA-Z_]/.test(n[a+1]||"")){let o=a+1;for(;o<n.length&&/[a-zA-Z0-9_]/.test(n[o]);)o++;let l=n.slice(a+1,o),c=await Se(e,l);i+=c,a=o}else i+=n[a],a++;else if(n[a]==="`"){let o=a+1;for(;o<n.length&&n[o]!=="`";)o++;let l=n.slice(a+1,o);if(e.execFn){let c=await e.execFn(l);i+=c.stdout.replace(/\n+$/,""),c.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+c.stderr)}a=o+1}else i+=n[a],a++;return i}var t2=I(()=>{"use strict";Lt()});function wx(e,t,n,r,s){let i=n??1;i===0&&(i=1);let a=Math.abs(i),o=[],l=0;r?.match(/^-?0\d/)&&(l=Math.max(l,r.replace(/^-/,"").length)),s?.match(/^-?0\d/)&&(l=Math.max(l,s.replace(/^-/,"").length));let c=u=>{if(l>0){let f=u<0,p=String(Math.abs(u)).padStart(l,"0");return f?`-${p}`:p}return String(u)};if(e<=t)for(let u=e,f=0;u<=t&&f<ra;u+=a,f++)o.push(c(u));else for(let u=e,f=0;u>=t&&f<ra;u-=a,f++)o.push(c(u));return o}function bx(e,t,n){let r=n??1;r===0&&(r=1);let s=e.charCodeAt(0),i=t.charCodeAt(0),a=Math.abs(r),o=e>="A"&&e<="Z",l=e>="a"&&e<="z",c=t>="A"&&t<="Z",u=t>="a"&&t<="z";if(o&&u||l&&c){let p=n!==void 0?`..${n}`:"";throw new br(`{${e}..${t}${p}}: invalid sequence`)}let f=[];if(s<=i)for(let p=s,h=0;p<=i&&h<ra;p+=a,h++)f.push(String.fromCharCode(p));else for(let p=s,h=0;p>=i&&h<ra;p-=a,h++)f.push(String.fromCharCode(p));return f}function cc(e,t,n,r,s){let i=n!==void 0?`..${n}`:"";return typeof e=="number"&&typeof t=="number"?{expanded:wx(e,t,n,r,s),literal:`{${e}..${t}${i}}`}:typeof e=="string"&&typeof t=="string"?{expanded:bx(e,t,n),literal:`{${e}..${t}${i}}`}:{expanded:null,literal:`{${e}..${t}${i}}`}}var ra,n2=I(()=>{"use strict";ye();ra=1e4});function r2(e){if(e.statements.length!==1)return null;let t=e.statements[0];if(t.operators.length!==0||t.pipelines.length!==1)return null;let n=t.pipelines[0];if(n.negated||n.commands.length!==1)return null;let r=n.commands[0];if(r.type!=="SimpleCommand")return null;let s=r;if(s.name!==null||s.args.length!==0||s.assignments.length!==0||s.redirections.length!==1)return null;let i=s.redirections[0];return i.operator!=="<"||i.target.type!=="Word"?null:{target:i.target}}var s2=I(()=>{"use strict"});function xn(e,t){return!!(/[*?[]/.test(e)||t&&/[@*+?!]\(/.test(e))}function uc(e){let t="",n=0;for(;n<e.length;)e[n]==="\\"&&n+1<e.length?(t+=e[n+1],n+=2):(t+=e[n],n++);return t}function Ft(e){return e.replace(/([*?[\]\\()|])/g,"\\$1")}function Gr(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}var Vr=I(()=>{"use strict"});function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var qr=I(()=>{"use strict"});function me(e,t,n=!1){let r="",s=0;for(;s<e.length;){let i=e[s];if(n&&(i==="@"||i==="*"||i==="+"||i==="?"||i==="!")&&s+1<e.length&&e[s+1]==="("){let a=xx(e,s+1);if(a!==-1){let o=e.slice(s+2,a),c=Ex(o).map(f=>me(f,t,n)),u=c.length>0?c.join("|"):"(?:)";i==="@"?r+=`(?:${u})`:i==="*"?r+=`(?:${u})*`:i==="+"?r+=`(?:${u})+`:i==="?"?r+=`(?:${u})?`:i==="!"&&(r+=`(?!(?:${u})$).*`),s=a+1;continue}}if(i==="\\")if(s+1<e.length){let a=e[s+1];/[\\^$.|+(){}[\]*?]/.test(a)?r+=`\\${a}`:r+=a,s+=2}else r+="\\\\",s++;else if(i==="*")r+=t?".*":".*?",s++;else if(i==="?")r+=".",s++;else if(i==="["){let a=Ax(e,s);if(a===-1)r+="\\[",s++;else{let o=e.slice(s+1,a);r+=Sx(o),s=a+1}}else/[\^$.|+(){}]/.test(i)?(r+=`\\${i}`,s++):(r+=i,s++)}return r}function xx(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function Ex(e){let t=[],n="",r=0,s=0;for(;s<e.length;){let i=e[s];if(i==="\\"){n+=i,s+1<e.length?(n+=e[s+1],s+=2):s++;continue}i==="("?(r++,n+=i):i===")"?(r--,n+=i):i==="|"&&r===0?(t.push(n),n=""):n+=i,s++}return t.push(n),t}function Ax(e,t){let n=t+1;for(n<e.length&&e[n]==="^"&&n++,n<e.length&&e[n]==="]"&&n++;n<e.length;){if(e[n]==="\\"&&n+1<e.length){n+=2;continue}if(e[n]==="]")return n;if(e[n]==="'"){let r=e.indexOf("'",n+1);if(r!==-1){n=r+1;continue}}if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let r=e.indexOf(":]",n+2);if(r!==-1){n=r+2;continue}}n++}return-1}function Sx(e){let t="[",n=0;for((e[0]==="^"||e[0]==="!")&&(t+="^",n++);n<e.length;){if(e[n]==="'"){let s=e.indexOf("'",n+1);if(s!==-1){let i=e.slice(n+1,s);for(let a of i)a==="\\"?t+="\\\\":a==="]"?t+="\\]":a==="^"&&t==="["?t+="\\^":t+=a;n=s+1;continue}}if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s);t+=Nx(i),n=s+2;continue}}let r=e[n];r==="\\"?n+1<e.length?(t+=`\\${e[n+1]}`,n+=2):(t+="\\\\",n++):r==="-"&&n>0&&n<e.length-1?(t+="-",n++):r==="^"&&n===0?(t+="^",n++):(r==="]"&&n===0?t+="\\]":t+=r,n++)}return t+="]",t}function Nx(e){return Cx.get(e)??""}var Cx,Zr=I(()=>{"use strict";Cx=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]])});function $n(e,t,n,r){if(n==="prefix")return V(`^${t}`,"s").replace(e,"");let s=V(`${t}$`,"s");if(r)return s.replace(e,"");for(let i=e.length;i>=0;i--){let a=e.slice(i);if(s.test(a))return e.slice(0,i)}return e}function Kr(e,t){let n=Array.from(e.state.env.keys()),r=new Set,s=e.state.associativeArrays??new Set,i=new Set;for(let o of n){let l=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);l&&i.add(l[1]);let c=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);c&&i.add(c[1])}let a=o=>{for(let l of s){let c=`${l}_`;if(o.startsWith(c)&&o!==l)return!0}return!1};for(let o of n)if(o.startsWith(t))if(o.includes("__")){let l=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);l?.[1].startsWith(t)&&r.add(l[1])}else if(/_\d+$/.test(o)){let l=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);l?.[1].startsWith(t)&&r.add(l[1])}else a(o)||r.add(o);return[...r].sort()}var fr=I(()=>{"use strict";Me()});function kx(e,t){let n=(i,a=2)=>String(i).padStart(a,"0");if(e===""){let i=n(t.getHours()),a=n(t.getMinutes()),o=n(t.getSeconds());return`${i}:${a}:${o}`}let r="",s=0;for(;s<e.length;)if(e[s]==="%"){if(s+1>=e.length){r+="%",s++;continue}let i=e[s+1];switch(i){case"H":r+=n(t.getHours());break;case"M":r+=n(t.getMinutes());break;case"S":r+=n(t.getSeconds());break;case"d":r+=n(t.getDate());break;case"m":r+=n(t.getMonth()+1);break;case"Y":r+=t.getFullYear();break;case"y":r+=n(t.getFullYear()%100);break;case"I":{let a=t.getHours()%12;a===0&&(a=12),r+=n(a);break}case"p":r+=t.getHours()<12?"AM":"PM";break;case"P":r+=t.getHours()<12?"am":"pm";break;case"%":r+="%";break;case"a":{r+=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t.getDay()];break}case"b":{r+=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()];break}default:r+=`%${i}`}s+=2}else r+=e[s],s++;return r}function Ts(e,t){let n="",r=0,s=e.state.env.get("USER")||e.state.env.get("LOGNAME")||"user",i=e.state.env.get("HOSTNAME")||"localhost",a=i.split(".")[0],o=e.state.env.get("PWD")||"/",l=e.state.env.get("HOME")||"/",c=o.startsWith(l)?`~${o.slice(l.length)}`:o,u=o.split("/").pop()||o,f=new Date,p=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],m=e.state.env.get("__COMMAND_NUMBER")||"1";for(;r<t.length;){let d=t[r];if(d==="\\"){if(r+1>=t.length){n+="\\",r++;continue}let g=t[r+1];if(g>="0"&&g<="7"){let w="",y=r+1;for(;y<t.length&&y<r+4&&t[y]>="0"&&t[y]<="7";)w+=t[y],y++;let b=Number.parseInt(w,8)%256;n+=String.fromCharCode(b),r=y;continue}switch(g){case"\\":n+="\\",r+=2;break;case"a":n+="\x07",r+=2;break;case"e":n+="\x1B",r+=2;break;case"n":n+=`
777
- `,r+=2;break;case"r":n+="\r",r+=2;break;case"$":n+="$",r+=2;break;case"[":case"]":r+=2;break;case"u":n+=s,r+=2;break;case"h":n+=a,r+=2;break;case"H":n+=i,r+=2;break;case"w":n+=c,r+=2;break;case"W":n+=u,r+=2;break;case"d":{let w=String(f.getDate()).padStart(2," ");n+=`${p[f.getDay()]} ${h[f.getMonth()]} ${w}`,r+=2;break}case"t":{let w=String(f.getHours()).padStart(2,"0"),y=String(f.getMinutes()).padStart(2,"0"),b=String(f.getSeconds()).padStart(2,"0");n+=`${w}:${y}:${b}`,r+=2;break}case"T":{let w=f.getHours()%12;w===0&&(w=12);let y=String(w).padStart(2,"0"),b=String(f.getMinutes()).padStart(2,"0"),x=String(f.getSeconds()).padStart(2,"0");n+=`${y}:${b}:${x}`,r+=2;break}case"@":{let w=f.getHours()%12;w===0&&(w=12);let y=String(w).padStart(2,"0"),b=String(f.getMinutes()).padStart(2,"0"),x=f.getHours()<12?"AM":"PM";n+=`${y}:${b} ${x}`,r+=2;break}case"A":{let w=String(f.getHours()).padStart(2,"0"),y=String(f.getMinutes()).padStart(2,"0");n+=`${w}:${y}`,r+=2;break}case"D":if(r+2<t.length&&t[r+2]==="{"){let w=t.indexOf("}",r+3);if(w!==-1){let y=t.slice(r+3,w);n+=kx(y,f),r=w+1}else n+="\\D",r+=2}else n+="\\D",r+=2;break;case"s":n+="bash",r+=2;break;case"v":n+="5.0",r+=2;break;case"V":n+="5.0.0",r+=2;break;case"j":n+="0",r+=2;break;case"l":n+="tty",r+=2;break;case"#":n+=m,r+=2;break;case"!":n+=m,r+=2;break;case"x":n+="\\x",r+=2;break;default:n+=`\\${g}`,r+=2}}else n+=d,r++}return n}var fc=I(()=>{"use strict"});function Bn(e){if(e==="")return"''";if(/[\n\r\t\x00-\x1f\x7f']/.test(e)){let n="$'";for(let r of e)switch(r){case"'":n+="\\'";break;case"\\":n+="\\\\";break;case`
776
+ `,""):e.state.env.get(`${a}_${m}`)||""}let u=e.state.env.get(`${a}_${c}`);if(u!==void 0)return u;if(c===0){let f=e.state.env.get(a);if(f!==void 0)return f}if(n&&e.state.options.nounset)throw new wt(`${a}[${c}]`);return""}if(/^[1-9][0-9]*$/.test(t)){let a=e.state.env.get(t);if(a===void 0&&n&&e.state.options.nounset)throw new wt(t);return a||""}if(Te(e,t)){let a=St(e,t);if(a===void 0)return"";if(a!==t)return await Se(e,a,n,r);let o=e.state.env.get(t);if((o===void 0||o==="")&&n&&e.state.options.nounset)throw new wt(t);return o||""}let i=e.state.env.get(t);if(i!==void 0)return e.state.tempEnvBindings?.some(a=>a.has(t))&&(e.state.accessedTempEnvVars=e.state.accessedTempEnvVars||new Set,e.state.accessedTempEnvVars.add(t)),i;if(In(e,t)){let a=e.state.env.get(`${t}_0`);return a!==void 0?a:""}if(n&&e.state.options.nounset)throw new wt(t);return""}async function bn(e,t){if(new Set(["?","$","#","_","-","0","PPID","UID","EUID","RANDOM","SECONDS","BASH_VERSION","!","BASHPID","LINENO"]).has(t))return!0;if(t==="@"||t==="*")return Number.parseInt(e.state.env.get("#")||"0",10)>0;if(t==="PWD"||t==="OLDPWD")return e.state.env.has(t);let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(r){let s=r[1],i=r[2];if(Te(e,s)){let l=St(e,s);if(l&&l!==s){if(l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;s=l}}if(i==="@"||i==="*")return oe(e,s).length>0?!0:e.state.env.has(s);if(e.state.associativeArrays?.has(s)){let l=Ji(i);return e.state.env.has(`${s}_${l}`)}let o;if(/^-?\d+$/.test(i))o=Number.parseInt(i,10);else try{let l=new ce,c=Ae(l,i);o=await ne(e,c.expression)}catch{let l=e.state.env.get(i);o=l?Number.parseInt(l,10):0,Number.isNaN(o)&&(o=0)}if(o<0){let l=oe(e,s);if(l.length===0)return!1;let u=Math.max(...l.map(([f])=>typeof f=="number"?f:0))+1+o;return u<0?!1:e.state.env.has(`${s}_${u}`)}return e.state.env.has(`${s}_${o}`)}if(Te(e,t)){let s=St(e,t);return s===void 0||s===t?e.state.env.has(t):bn(e,s)}return!!(e.state.env.has(t)||In(e,t))}var Lt=I(()=>{"use strict";mt();Xe();Il();Ct();ye();Xt();jt();an()});async function e2(e,t){let n="",r=0;for(;r<t.length;){if(t[r]==="$"){if(t[r+1]==="{"){let s=1,i=r+2;for(;i<t.length&&s>0;)t[i]==="{"?s++:t[i]==="}"&&s--,i++;n+=t.slice(r,i),r=i;continue}if(t[r+1]==="("){let s=1,i=r+2;for(;i<t.length&&s>0;)t[i]==="("?s++:t[i]===")"&&s--,i++;n+=t.slice(r,i),r=i;continue}if(/[a-zA-Z_]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)s++;let i=t.slice(r+1,s),a=await Se(e,i);n+=a,r=s;continue}if(/[0-9]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[0-9]/.test(t[s]);)s++;let i=t.slice(r+1,s),a=await Se(e,i);n+=a,r=s;continue}if(/[*@#?\-!$]/.test(t[r+1]||"")){let s=t[r+1],i=await Se(e,s);n+=i,r+=2;continue}}if(t[r]==='"'){for(n+='"',r++;r<t.length&&t[r]!=='"';)if(t[r]==="$"&&/[a-zA-Z_]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)s++;let i=t.slice(r+1,s),a=await Se(e,i);n+=a,r=s}else t[r]==="\\"?(n+=t[r],r++,r<t.length&&(n+=t[r],r++)):(n+=t[r],r++);r<t.length&&(n+='"',r++);continue}n+=t[r],r++}return n}async function lc(e,t){let n=t,r=t.startsWith('"')&&t.endsWith('"'),s=t.startsWith("'")&&t.endsWith("'");if((r||s)&&(n=t.slice(1,-1)),s)return n;let i="",a=0;for(;a<n.length;)if(n[a]==="$")if(n[a+1]==="("){let o=1,l=a+2;for(;l<n.length&&o>0;)n[l]==="("&&n[l-1]==="$"||n[l]==="("?o++:n[l]===")"&&o--,l++;let c=n.slice(a+2,l-1);if(e.execFn){let u=await e.execFn(c);i+=u.stdout.replace(/\n+$/,""),u.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+u.stderr)}a=l}else if(n[a+1]==="{"){let o=1,l=a+2;for(;l<n.length&&o>0;)n[l]==="{"?o++:n[l]==="}"&&o--,l++;let c=n.slice(a+2,l-1),u=await Se(e,c);i+=u,a=l}else if(/[a-zA-Z_]/.test(n[a+1]||"")){let o=a+1;for(;o<n.length&&/[a-zA-Z0-9_]/.test(n[o]);)o++;let l=n.slice(a+1,o),c=await Se(e,l);i+=c,a=o}else i+=n[a],a++;else if(n[a]==="`"){let o=a+1;for(;o<n.length&&n[o]!=="`";)o++;let l=n.slice(a+1,o);if(e.execFn){let c=await e.execFn(l);i+=c.stdout.replace(/\n+$/,""),c.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+c.stderr)}a=o+1}else i+=n[a],a++;return i}var t2=I(()=>{"use strict";Lt()});function wx(e,t,n,r,s){let i=n??1;i===0&&(i=1);let a=Math.abs(i),o=[],l=0;r?.match(/^-?0\d/)&&(l=Math.max(l,r.replace(/^-/,"").length)),s?.match(/^-?0\d/)&&(l=Math.max(l,s.replace(/^-/,"").length));let c=u=>{if(l>0){let f=u<0,p=String(Math.abs(u)).padStart(l,"0");return f?`-${p}`:p}return String(u)};if(e<=t)for(let u=e,f=0;u<=t&&f<ra;u+=a,f++)o.push(c(u));else for(let u=e,f=0;u>=t&&f<ra;u-=a,f++)o.push(c(u));return o}function bx(e,t,n){let r=n??1;r===0&&(r=1);let s=e.charCodeAt(0),i=t.charCodeAt(0),a=Math.abs(r),o=e>="A"&&e<="Z",l=e>="a"&&e<="z",c=t>="A"&&t<="Z",u=t>="a"&&t<="z";if(o&&u||l&&c){let p=n!==void 0?`..${n}`:"";throw new br(`{${e}..${t}${p}}: invalid sequence`)}let f=[];if(s<=i)for(let p=s,h=0;p<=i&&h<ra;p+=a,h++)f.push(String.fromCharCode(p));else for(let p=s,h=0;p>=i&&h<ra;p-=a,h++)f.push(String.fromCharCode(p));return f}function cc(e,t,n,r,s){let i=n!==void 0?`..${n}`:"";return typeof e=="number"&&typeof t=="number"?{expanded:wx(e,t,n,r,s),literal:`{${e}..${t}${i}}`}:typeof e=="string"&&typeof t=="string"?{expanded:bx(e,t,n),literal:`{${e}..${t}${i}}`}:{expanded:null,literal:`{${e}..${t}${i}}`}}var ra,n2=I(()=>{"use strict";ye();ra=1e4});function r2(e){if(e.statements.length!==1)return null;let t=e.statements[0];if(t.operators.length!==0||t.pipelines.length!==1)return null;let n=t.pipelines[0];if(n.negated||n.commands.length!==1)return null;let r=n.commands[0];if(r.type!=="SimpleCommand")return null;let s=r;if(s.name!==null||s.args.length!==0||s.assignments.length!==0||s.redirections.length!==1)return null;let i=s.redirections[0];return i.operator!=="<"||i.target.type!=="Word"?null:{target:i.target}}var s2=I(()=>{"use strict"});function xn(e,t){return!!(/[*?[]/.test(e)||t&&/[@*+?!]\(/.test(e))}function uc(e){let t="",n=0;for(;n<e.length;)e[n]==="\\"&&n+1<e.length?(t+=e[n+1],n+=2):(t+=e[n],n++);return t}function Ft(e){return e.replace(/([*?[\]\\()|])/g,"\\$1")}function Gr(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}var Vr=I(()=>{"use strict"});function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var qr=I(()=>{"use strict"});function me(e,t,n=!1){let r="",s=0;for(;s<e.length;){let i=e[s];if(n&&(i==="@"||i==="*"||i==="+"||i==="?"||i==="!")&&s+1<e.length&&e[s+1]==="("){let a=xx(e,s+1);if(a!==-1){let o=e.slice(s+2,a),c=Ex(o).map(f=>me(f,t,n)),u=c.length>0?c.join("|"):"(?:)";i==="@"?r+=`(?:${u})`:i==="*"?r+=`(?:${u})*`:i==="+"?r+=`(?:${u})+`:i==="?"?r+=`(?:${u})?`:i==="!"&&(r+=`(?!(?:${u})$).*`),s=a+1;continue}}if(i==="\\")if(s+1<e.length){let a=e[s+1];/[\\^$.|+(){}[\]*?]/.test(a)?r+=`\\${a}`:r+=a,s+=2}else r+="\\\\",s++;else if(i==="*")r+=t?".*":".*?",s++;else if(i==="?")r+=".",s++;else if(i==="["){let a=Ax(e,s);if(a===-1)r+="\\[",s++;else{let o=e.slice(s+1,a);r+=Sx(o),s=a+1}}else/[\^$.|+(){}]/.test(i)?(r+=`\\${i}`,s++):(r+=i,s++)}return r}function xx(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function Ex(e){let t=[],n="",r=0,s=0;for(;s<e.length;){let i=e[s];if(i==="\\"){n+=i,s+1<e.length?(n+=e[s+1],s+=2):s++;continue}i==="("?(r++,n+=i):i===")"?(r--,n+=i):i==="|"&&r===0?(t.push(n),n=""):n+=i,s++}return t.push(n),t}function Ax(e,t){let n=t+1;for(n<e.length&&e[n]==="^"&&n++,n<e.length&&e[n]==="]"&&n++;n<e.length;){if(e[n]==="\\"&&n+1<e.length){n+=2;continue}if(e[n]==="]")return n;if(e[n]==="'"){let r=e.indexOf("'",n+1);if(r!==-1){n=r+1;continue}}if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let r=e.indexOf(":]",n+2);if(r!==-1){n=r+2;continue}}n++}return-1}function Sx(e){let t="[",n=0;for((e[0]==="^"||e[0]==="!")&&(t+="^",n++);n<e.length;){if(e[n]==="'"){let s=e.indexOf("'",n+1);if(s!==-1){let i=e.slice(n+1,s);for(let a of i)a==="\\"?t+="\\\\":a==="]"?t+="\\]":a==="^"&&t==="["?t+="\\^":t+=a;n=s+1;continue}}if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s);t+=Nx(i),n=s+2;continue}}let r=e[n];r==="\\"?n+1<e.length?(t+=`\\${e[n+1]}`,n+=2):(t+="\\\\",n++):r==="-"&&n>0&&n<e.length-1?(t+="-",n++):r==="^"&&n===0?(t+="^",n++):(r==="]"&&n===0?t+="\\]":t+=r,n++)}return t+="]",t}function Nx(e){return Cx.get(e)??""}var Cx,Zr=I(()=>{"use strict";Cx=new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]])});function $n(e,t,n,r){if(n==="prefix")return V(`^${t}`,"s").replace(e,"");let s=V(`${t}$`,"s");if(r)return s.replace(e,"");for(let i=e.length;i>=0;i--){let a=e.slice(i);if(s.test(a))return e.slice(0,i)}return e}function Kr(e,t){let n=Array.from(e.state.env.keys()),r=new Set,s=e.state.associativeArrays??new Set,i=new Set;for(let o of n){let l=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);l&&i.add(l[1]);let c=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);c&&i.add(c[1])}let a=o=>{for(let l of s){let c=`${l}_`;if(o.startsWith(c)&&o!==l)return!0}return!1};for(let o of n)if(o.startsWith(t))if(o.includes("__")){let l=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);l?.[1].startsWith(t)&&r.add(l[1])}else if(/_\d+$/.test(o)){let l=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);l?.[1].startsWith(t)&&r.add(l[1])}else a(o)||r.add(o);return[...r].sort()}var fr=I(()=>{"use strict";Me()});function vx(e,t){let n=(i,a=2)=>String(i).padStart(a,"0");if(e===""){let i=n(t.getHours()),a=n(t.getMinutes()),o=n(t.getSeconds());return`${i}:${a}:${o}`}let r="",s=0;for(;s<e.length;)if(e[s]==="%"){if(s+1>=e.length){r+="%",s++;continue}let i=e[s+1];switch(i){case"H":r+=n(t.getHours());break;case"M":r+=n(t.getMinutes());break;case"S":r+=n(t.getSeconds());break;case"d":r+=n(t.getDate());break;case"m":r+=n(t.getMonth()+1);break;case"Y":r+=t.getFullYear();break;case"y":r+=n(t.getFullYear()%100);break;case"I":{let a=t.getHours()%12;a===0&&(a=12),r+=n(a);break}case"p":r+=t.getHours()<12?"AM":"PM";break;case"P":r+=t.getHours()<12?"am":"pm";break;case"%":r+="%";break;case"a":{r+=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t.getDay()];break}case"b":{r+=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()];break}default:r+=`%${i}`}s+=2}else r+=e[s],s++;return r}function Ts(e,t){let n="",r=0,s=e.state.env.get("USER")||e.state.env.get("LOGNAME")||"user",i=e.state.env.get("HOSTNAME")||"localhost",a=i.split(".")[0],o=e.state.env.get("PWD")||"/",l=e.state.env.get("HOME")||"/",c=o.startsWith(l)?`~${o.slice(l.length)}`:o,u=o.split("/").pop()||o,f=new Date,p=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],m=e.state.env.get("__COMMAND_NUMBER")||"1";for(;r<t.length;){let d=t[r];if(d==="\\"){if(r+1>=t.length){n+="\\",r++;continue}let g=t[r+1];if(g>="0"&&g<="7"){let w="",y=r+1;for(;y<t.length&&y<r+4&&t[y]>="0"&&t[y]<="7";)w+=t[y],y++;let b=Number.parseInt(w,8)%256;n+=String.fromCharCode(b),r=y;continue}switch(g){case"\\":n+="\\",r+=2;break;case"a":n+="\x07",r+=2;break;case"e":n+="\x1B",r+=2;break;case"n":n+=`
777
+ `,r+=2;break;case"r":n+="\r",r+=2;break;case"$":n+="$",r+=2;break;case"[":case"]":r+=2;break;case"u":n+=s,r+=2;break;case"h":n+=a,r+=2;break;case"H":n+=i,r+=2;break;case"w":n+=c,r+=2;break;case"W":n+=u,r+=2;break;case"d":{let w=String(f.getDate()).padStart(2," ");n+=`${p[f.getDay()]} ${h[f.getMonth()]} ${w}`,r+=2;break}case"t":{let w=String(f.getHours()).padStart(2,"0"),y=String(f.getMinutes()).padStart(2,"0"),b=String(f.getSeconds()).padStart(2,"0");n+=`${w}:${y}:${b}`,r+=2;break}case"T":{let w=f.getHours()%12;w===0&&(w=12);let y=String(w).padStart(2,"0"),b=String(f.getMinutes()).padStart(2,"0"),x=String(f.getSeconds()).padStart(2,"0");n+=`${y}:${b}:${x}`,r+=2;break}case"@":{let w=f.getHours()%12;w===0&&(w=12);let y=String(w).padStart(2,"0"),b=String(f.getMinutes()).padStart(2,"0"),x=f.getHours()<12?"AM":"PM";n+=`${y}:${b} ${x}`,r+=2;break}case"A":{let w=String(f.getHours()).padStart(2,"0"),y=String(f.getMinutes()).padStart(2,"0");n+=`${w}:${y}`,r+=2;break}case"D":if(r+2<t.length&&t[r+2]==="{"){let w=t.indexOf("}",r+3);if(w!==-1){let y=t.slice(r+3,w);n+=vx(y,f),r=w+1}else n+="\\D",r+=2}else n+="\\D",r+=2;break;case"s":n+="bash",r+=2;break;case"v":n+="5.0",r+=2;break;case"V":n+="5.0.0",r+=2;break;case"j":n+="0",r+=2;break;case"l":n+="tty",r+=2;break;case"#":n+=m,r+=2;break;case"!":n+=m,r+=2;break;case"x":n+="\\x",r+=2;break;default:n+=`\\${g}`,r+=2}}else n+=d,r++}return n}var fc=I(()=>{"use strict"});function Bn(e){if(e==="")return"''";if(/[\n\r\t\x00-\x1f\x7f']/.test(e)){let n="$'";for(let r of e)switch(r){case"'":n+="\\'";break;case"\\":n+="\\\\";break;case`
778
778
  `:n+="\\n";break;case"\r":n+="\\r";break;case" ":n+="\\t";break;default:{let s=r.charCodeAt(0);s<32||s===127?n+=`\\${s.toString(8).padStart(3,"0")}`:n+=r}}return`${n}'`}return`'${e}'`}var pc=I(()=>{"use strict"});function Mt(e,t){e.state.readonlyVars=e.state.readonlyVars||new Set,e.state.readonlyVars.add(t)}function En(e,t){return e.state.readonlyVars?.has(t)??!1}function it(e,t,n="bash"){if(En(e,t)){let r=`${n}: ${t}: readonly variable
779
779
  `;throw new pe(1,"",r)}return null}function on(e,t){let n=e.state.exportedVars?.has(t)??!1;if(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(t),e.state.localScopes.length>0&&e.state.localScopes[e.state.localScopes.length-1].has(t)&&!n){for(e.state.localExportedVars||(e.state.localExportedVars=[]);e.state.localExportedVars.length<e.state.localScopes.length;)e.state.localExportedVars.push(new Set);e.state.localExportedVars[e.state.localExportedVars.length-1].add(t)}}function sa(e,t){e.state.exportedVars?.delete(t)}var Wn=I(()=>{"use strict";ye()});function zn(e,t){if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t))return"";let n="",r=e.state.env.has(`${t}__length`)||Array.from(e.state.env.keys()).some(i=>i.startsWith(`${t}_`)&&/^[0-9]+$/.test(i.slice(t.length+1))),s=e.state.associativeArrays?.has(t)??!1;return r&&!s&&(n+="a"),s&&(n+="A"),e.state.integerVars?.has(t)&&(n+="i"),Te(e,t)&&(n+="n"),En(e,t)&&(n+="r"),e.state.exportedVars?.has(t)&&(n+="x"),n}var ia=I(()=>{"use strict";an();Wn()});async function i2(e,t,n,r){return e.coverage?.hit("bash:expansion:default_value"),(n.isUnset||t.checkEmpty&&n.isEmpty)&&t.word?r(e,t.word.parts,n.inDoubleQuotes):n.effectiveValue}async function a2(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:assign_default"),(r.isUnset||n.checkEmpty&&r.isEmpty)&&n.word){let a=await s(e,n.word.parts,r.inDoubleQuotes),o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(o){let[,l,c]=o,u;if(/^\d+$/.test(c))u=Number.parseInt(c,10);else{try{let p=new ce,h=Ae(p,c);u=await ne(e,h.expression)}catch{let p=e.state.env.get(c);u=p?Number.parseInt(p,10):0}Number.isNaN(u)&&(u=0)}e.state.env.set(`${l}_${u}`,a);let f=Number.parseInt(e.state.env.get(`${l}__length`)||"0",10);u>=f&&e.state.env.set(`${l}__length`,String(u+1))}else e.state.env.set(t,a);return a}return r.effectiveValue}async function o2(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:error_if_unset"),r.isUnset||n.checkEmpty&&r.isEmpty){let a=n.word?await s(e,n.word.parts,r.inDoubleQuotes):`${t}: parameter null or not set`;throw new pe(1,"",`bash: ${a}
780
780
  `)}return r.effectiveValue}async function l2(e,t,n,r){return e.coverage?.hit("bash:expansion:use_alternative"),!(n.isUnset||t.checkEmpty&&n.isEmpty)&&t.word?r(e,t.word.parts,n.inDoubleQuotes):""}async function c2(e,t,n,r,s){e.coverage?.hit("bash:expansion:pattern_removal");let i="",a=e.state.shoptOptions.extglob;if(n.pattern)for(let l of n.pattern.parts)if(l.type==="Glob")i+=me(l.pattern,n.greedy,a);else if(l.type==="Literal")i+=me(l.value,n.greedy,a);else if(l.type==="SingleQuoted"||l.type==="Escaped")i+=xe(l.value);else if(l.type==="DoubleQuoted"){let c=await r(e,l.parts);i+=xe(c)}else if(l.type==="ParameterExpansion"){let c=await s(e,l);i+=me(c,n.greedy,a)}else{let c=await s(e,l);i+=xe(c)}if(n.side==="prefix")return V(`^${i}`,"s").replace(t,"");let o=V(`${i}$`,"s");if(n.greedy)return o.replace(t,"");for(let l=t.length;l>=0;l--){let c=t.slice(l);if(o.test(c))return t.slice(0,l)}return t}async function u2(e,t,n,r,s){e.coverage?.hit("bash:expansion:pattern_replacement");let i="",a=e.state.shoptOptions.extglob;if(n.pattern)for(let c of n.pattern.parts)if(c.type==="Glob")i+=me(c.pattern,!0,a);else if(c.type==="Literal")i+=me(c.value,!0,a);else if(c.type==="SingleQuoted"||c.type==="Escaped")i+=xe(c.value);else if(c.type==="DoubleQuoted"){let u=await r(e,c.parts);i+=xe(u)}else if(c.type==="ParameterExpansion"){let u=await s(e,c);i+=me(u,!0,a)}else{let u=await s(e,c);i+=xe(u)}let o=n.replacement?await r(e,n.replacement.parts):"";if(n.anchor==="start"?i=`^${i}`:n.anchor==="end"&&(i=`${i}$`),i==="")return t;let l=n.all?"gs":"s";try{let c=V(i,l);if(n.all){let u="",f=0,p=0,h=e.limits.maxStringLength,m=c.exec(t);for(;m!==null&&!(m[0].length===0&&m.index===t.length);){if(u+=t.slice(f,m.index)+o,f=m.index+m[0].length,m[0].length===0&&f++,p++,p%100===0&&u.length>h)throw new J(`pattern replacement: string length limit exceeded (${h} bytes)`,"string_length");m=c.exec(t)}return u+=t.slice(f),u}return c.replace(t,o)}catch(c){if(c instanceof J)throw c;return t}}function f2(e,t,n){e.coverage?.hit("bash:expansion:length");let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(r){let s=r[1],i=oe(e,s);return i.length>0?String(i.length):e.state.env.get(s)!==void 0?"1":"0"}if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)&&In(e,t)){if(t==="FUNCNAME"){let i=e.state.funcNameStack?.[0]||"";return String([...i].length)}if(t==="BASH_LINENO"){let i=e.state.callLineStack?.[0];return String(i!==void 0?[...String(i)].length:0)}let s=e.state.env.get(`${t}_0`)||"";return String([...s].length)}return String([...n].length)}async function p2(e,t,n,r){e.coverage?.hit("bash:expansion:substring");let s=await ne(e,r.offset.expression),i=r.length?await ne(e,r.length.expression):void 0;if(t==="@"||t==="*"){let c=Number.parseInt(e.state.env.get("#")||"0",10),u=[];for(let m=1;m<=c;m++)u.push(e.state.env.get(String(m))||"");let f=e.state.env.get("0")||"bash",p,h;if(s<=0)if(p=[f,...u],s<0){if(h=p.length+s,h<0)return""}else h=0;else p=u,h=s-1;if(h<0||h>=p.length)return"";if(i!==void 0){let m=i<0?p.length+i:h+i;return p.slice(h,Math.max(h,m)).join(" ")}return p.slice(h).join(" ")}let a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(a){let c=a[1];if(e.state.associativeArrays?.has(c))throw new pe(1,"",`bash: \${${c}[@]: 0: 3}: bad substitution
781
781
  `);let u=oe(e,c),f=0;if(s<0){if(u.length>0){let p=u[u.length-1][0],m=(typeof p=="number"?p:0)+1+s;if(m<0||(f=u.findIndex(([d])=>typeof d=="number"&&d>=m),f<0))return""}}else if(f=u.findIndex(([p])=>typeof p=="number"&&p>=s),f<0)return"";if(i!==void 0){if(i<0)throw new Oe(`${a[1]}[@]: substring expression < 0`);return u.slice(f,f+i).map(([,p])=>p).join(" ")}return u.slice(f).map(([,p])=>p).join(" ")}let o=[...n],l=s;if(l<0&&(l=Math.max(0,o.length+l)),i!==void 0){if(i<0){let c=o.length+i;return o.slice(l,Math.max(l,c)).join("")}return o.slice(l,l+i).join("")}return o.slice(l).join("")}async function h2(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:case_modification"),n.pattern){let i=e.state.shoptOptions.extglob,a="";for(let f of n.pattern.parts)if(f.type==="Glob")a+=me(f.pattern,!0,i);else if(f.type==="Literal")a+=me(f.value,!0,i);else if(f.type==="SingleQuoted"||f.type==="Escaped")a+=xe(f.value);else if(f.type==="DoubleQuoted"){let p=await r(e,f.parts);a+=xe(p)}else if(f.type==="ParameterExpansion"){let p=await s(e,f);a+=me(p,!0,i)}let o=V(`^(?:${a})$`),l=n.direction==="upper"?f=>f.toUpperCase():f=>f.toLowerCase(),c="",u=!1;for(let f of t)!n.all&&u?c+=f:o.test(f)?(c+=l(f),u=!0):c+=f;return c}return n.direction==="upper"?n.all?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1):n.all?t.toLowerCase():t.charAt(0).toLowerCase()+t.slice(1)}function d2(e,t,n,r,s){e.coverage?.hit("bash:expansion:transform");let i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(i&&s.operator==="Q")return oe(e,i[1]).map(([,c])=>Bn(c)).join(" ");if(i&&s.operator==="a")return zn(e,i[1]);let a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[.+\]$/);if(a&&s.operator==="a")return zn(e,a[1]);switch(s.operator){case"Q":return r?"":Bn(n);case"P":return Ts(e,n);case"a":return zn(e,t);case"A":return r?"":`${t}=${Bn(n)}`;case"E":return n.replace(/\\([\\abefnrtv'"?])/g,(o,l)=>{switch(l){case"\\":return"\\";case"a":return"\x07";case"b":return"\b";case"e":return"\x1B";case"f":return"\f";case"n":return`
782
- `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"'":return"'";case'"':return'"';case"?":return"?";default:return l}});case"K":case"k":return r?"":Bn(n);case"u":return n.charAt(0).toUpperCase()+n.slice(1);case"U":return n.toUpperCase();case"L":return n.toLowerCase();default:return n}}async function m2(e,t,n,r,s,i,a=!1){if(e.coverage?.hit("bash:expansion:indirection"),Te(e,t))return ur(e,t)||"";let o=/^[a-zA-Z_][a-zA-Z0-9_]*\[([@*])\]$/.test(t);if(r){if(s.innerOp?.type==="UseAlternative")return"";throw new bt(`\${!${t}}`)}let l=n;if(o&&(l===""||l.includes(" ")))throw new bt(`\${!${t}}`);let c=l.match(/^[a-zA-Z_][a-zA-Z0-9_]*\[(.+)\]$/);if(c&&c[1].includes("~"))throw new bt(`\${!${t}}`);if(s.innerOp){let u={type:"ParameterExpansion",parameter:l,operation:s.innerOp};return i(e,u,a)}return await Se(e,l)}function g2(e,t){e.coverage?.hit("bash:expansion:array_keys");let r=oe(e,t.array).map(([s])=>String(s));return t.star?r.join(fe(e.state.env)):r.join(" ")}function y2(e,t){e.coverage?.hit("bash:expansion:var_name_prefix");let n=Kr(e,t.prefix);return t.star?n.join(fe(e.state.env)):n.join(" ")}function w2(e,t,n,r){let s=Number.parseInt(e.state.env.get("#")||"0",10),i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t==="*")return{isEmpty:s===0,effectiveValue:n};if(t==="@")return{isEmpty:s===0||s===1&&e.state.env.get("1")==="",effectiveValue:n};if(i){let[,a,o]=i,l=oe(e,a);if(l.length===0)return{isEmpty:!0,effectiveValue:""};if(o==="*"){let c=fe(e.state.env),u=l.map(([,f])=>f).join(c);return{isEmpty:r?u==="":!1,effectiveValue:u}}return{isEmpty:l.length===1&&l.every(([,c])=>c===""),effectiveValue:l.map(([,c])=>c).join(" ")}}return{isEmpty:n==="",effectiveValue:n}}var b2=I(()=>{"use strict";mt();Xe();Me();Ct();ye();jt();an();qr();Zr();fr();fc();pc();Lt();ia()});function x2(e){let t=0;for(;t<e.length;){let n=e[t];if(n==="\\"&&t+1<e.length){t+=2;continue}if(n==="'"){let r=e.indexOf("'",t+1);if(r!==-1){t=r+1;continue}}if(n==="$"&&t+1<e.length&&e[t+1]==="("||n==="`")return!0;t++}return!1}function E2(e,t){let n=1,r=t,s=!1,i=!1;for(;r<e.length&&n>0;){let a=e[r];if(a==="\\"&&!s&&r+1<e.length){r+=2;continue}if(a==="'"&&!i){s=!s,r++;continue}if(a==='"'&&!s){i=!i,r++;continue}if(!s&&!i){if(a==="(")n++;else if(a===")"&&(n--,n===0))return r}r++}return-1}async function aa(e,t){let n=new ce,r;try{r=n.parse(t)}catch{return""}let s=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let i=new Map(e.state.env),a=e.state.cwd,o=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let l=await e.executeScript(r),c=l.exitCode;return e.state.env=i,e.state.cwd=a,e.state.suppressVerbose=o,e.state.lastExitCode=c,e.state.env.set("?",String(c)),l.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+l.stderr),e.state.bashPid=s,l.stdout.replace(/\n+$/,"")}catch(l){if(e.state.env=i,e.state.cwd=a,e.state.bashPid=s,e.state.suppressVerbose=o,l instanceof J)throw l;return l instanceof pe?(e.state.lastExitCode=l.exitCode,e.state.env.set("?",String(l.exitCode)),l.stdout?.replace(/\n+$/,"")??""):""}}function hc(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="'"){let i=t.indexOf("'",r+1);if(i!==-1){let a=t.slice(r+1,i);n+=Ft(a),r=i+1;continue}}if(s==='"'){let i=-1,a=r+1;for(;a<t.length;){if(t[a]==="\\"){a+=2;continue}if(t[a]==='"'){i=a;break}a++}if(i!==-1){let o=t.slice(r+1,i),l=vx(e,o);n+=Ft(l),r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let a=t.indexOf("}",r+2);if(a!==-1){let o=t.slice(r+2,a);n+=e.state.env.get(o)??"",r=a+1;continue}}else if(/[a-zA-Z_]/.test(i)){let a=r+1;for(;a<t.length&&/[a-zA-Z0-9_]/.test(t[a]);)a++;let o=t.slice(r+1,a);n+=e.state.env.get(o)??"",r=a;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}function vx(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="\\"&&r+1<t.length){let i=t[r+1];if(i==="$"||i==="`"||i==="\\"||i==='"'){n+=i,r+=2;continue}n+=s,r++;continue}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let a=t.indexOf("}",r+2);if(a!==-1){let o=t.slice(r+2,a);n+=e.state.env.get(o)??"",r=a+1;continue}}else if(/[a-zA-Z_]/.test(i)){let a=r+1;for(;a<t.length&&/[a-zA-Z0-9_]/.test(t[a]);)a++;let o=t.slice(r+1,a);n+=e.state.env.get(o)??"",r=a;continue}}n+=s,r++}return n}async function A2(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="'"){let i=t.indexOf("'",r+1);if(i!==-1){let a=t.slice(r+1,i);n+=Ft(a),r=i+1;continue}}if(s==='"'){let i=-1,a=r+1;for(;a<t.length;){if(t[a]==="\\"){a+=2;continue}if(t[a]==='"'){i=a;break}a++}if(i!==-1){let o=t.slice(r+1,i),l=await Ix(e,o);n+=Ft(l),r=i+1;continue}}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=E2(t,r+2);if(i!==-1){let a=t.slice(r+2,i),o=await aa(e,a);n+=o,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let a=t.slice(r+1,i),o=await aa(e,a);n+=o,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let a=t.indexOf("}",r+2);if(a!==-1){let o=t.slice(r+2,a);n+=e.state.env.get(o)??"",r=a+1;continue}}else if(/[a-zA-Z_]/.test(i)){let a=r+1;for(;a<t.length&&/[a-zA-Z0-9_]/.test(t[a]);)a++;let o=t.slice(r+1,a);n+=e.state.env.get(o)??"",r=a;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}async function Ix(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="\\"&&r+1<t.length){let i=t[r+1];if(i==="$"||i==="`"||i==="\\"||i==='"'){n+=i,r+=2;continue}n+=s,r++;continue}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=E2(t,r+2);if(i!==-1){let a=t.slice(r+2,i),o=await aa(e,a);n+=o,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let a=t.slice(r+1,i),o=await aa(e,a);n+=o,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let a=t.indexOf("}",r+2);if(a!==-1){let o=t.slice(r+2,a);n+=e.state.env.get(o)??"",r=a+1;continue}}else if(/[a-zA-Z_]/.test(i)){let a=r+1;for(;a<t.length&&/[a-zA-Z0-9_]/.test(t[a]);)a++;let o=t.slice(r+1,a);n+=e.state.env.get(o)??"",r=a;continue}}n+=s,r++}return n}var S2=I(()=>{"use strict";Xe();ye();Vr()});function C2(e,t){if(!t.startsWith("~"))return t;e.coverage?.hit("bash:expansion:tilde");let n=e.state.env.get("HOME")!==void 0?e.state.env.get("HOME"):"/home/user";if(t==="~"||t.startsWith("~/"))return n+t.slice(1);let r=1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;let s=t.slice(1,r),i=t.slice(r);return i!==""&&!i.startsWith("/")?t:s==="root"?`/root${i}`:t}var N2=I(()=>{"use strict"});async function $x(e,t,n,r){let s="";for(let i of t.parts)if(i.type==="Glob")s+=me(i.pattern,!0,e.state.shoptOptions.extglob);else if(i.type==="Literal")s+=me(i.value,!0,e.state.shoptOptions.extglob);else if(i.type==="SingleQuoted"||i.type==="Escaped")s+=xe(i.value);else if(i.type==="DoubleQuoted"){let a=await n(e,i.parts);s+=xe(a)}else if(i.type==="ParameterExpansion"){let a=await r(e,i);s+=me(a,!0,e.state.shoptOptions.extglob)}else{let a=await r(e,i);s+=xe(a)}return s}async function k2(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0];if(s.parts.length!==1||s.parts[0].type!=="ParameterExpansion"||s.parts[0].operation?.type!=="PatternReplacement")return null;let i=s.parts[0],a=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!a)return null;let o=a[1],l=a[2]==="*",c=i.operation,u=oe(e,o),f=u.map(([,g])=>g);if(u.length===0){let g=e.state.env.get(o);g!==void 0&&f.push(g)}if(f.length===0)return{values:[],quoted:!0};let p="";c.pattern&&(p=await $x(e,c.pattern,n,r));let h=c.replacement?await n(e,c.replacement.parts):"",m=p;c.anchor==="start"?m=`^${p}`:c.anchor==="end"&&(m=`${p}$`);let d=[];try{let g=V(m,c.all?"g":"");for(let w of f)d.push(g.replace(w,h))}catch{d.push(...f)}if(l){let g=fe(e.state.env);return{values:[d.join(g)],quoted:!0}}return{values:d,quoted:!0}}async function v2(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0];if(s.parts.length!==1||s.parts[0].type!=="ParameterExpansion"||s.parts[0].operation?.type!=="PatternRemoval")return null;let i=s.parts[0],a=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!a)return null;let o=a[1],l=a[2]==="*",c=i.operation,u=oe(e,o),f=u.map(([,d])=>d);if(u.length===0){let d=e.state.env.get(o);d!==void 0&&f.push(d)}if(f.length===0)return{values:[],quoted:!0};let p="",h=e.state.shoptOptions.extglob;if(c.pattern)for(let d of c.pattern.parts)if(d.type==="Glob")p+=me(d.pattern,c.greedy,h);else if(d.type==="Literal")p+=me(d.value,c.greedy,h);else if(d.type==="SingleQuoted"||d.type==="Escaped")p+=xe(d.value);else if(d.type==="DoubleQuoted"){let g=await n(e,d.parts);p+=xe(g)}else if(d.type==="ParameterExpansion"){let g=await r(e,d);p+=me(g,c.greedy,h)}else{let g=await r(e,d);p+=xe(g)}let m=[];for(let d of f)m.push($n(d,p,c.side,c.greedy));if(l){let d=fe(e.state.env);return{values:[m.join(d)],quoted:!0}}return{values:m,quoted:!0}}var I2=I(()=>{"use strict";Me();jt();qr();Zr();fr();Lt()});async function $2(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion"||n.parts[0].operation?.type!=="DefaultValue"&&n.parts[0].operation?.type!=="UseAlternative"&&n.parts[0].operation?.type!=="AssignDefault")return null;let r=n.parts[0],s=r.operation,i=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/),a,o=!1;if(i){let l=i[1];o=i[2]==="*";let c=oe(e,l),u=c.length>0||e.state.env.has(l),f=c.length===0||c.length===1&&c.every(([,h])=>h===""),p=s.checkEmpty??!1;if(s.type==="UseAlternative"?a=u&&!(p&&f):a=!u||p&&f,!a){if(c.length>0){let m=c.map(([,d])=>d);if(o){let d=fe(e.state.env);return{values:[m.join(d)],quoted:!0}}return{values:m,quoted:!0}}let h=e.state.env.get(l);return h!==void 0?{values:[h],quoted:!0}:{values:[],quoted:!0}}}else{let l=r.parameter,c=await bn(e,l),u=await Se(e,l),f=u==="",p=s.checkEmpty??!1;if(s.type==="UseAlternative"?a=c&&!(p&&f):a=!c||p&&f,!a)return{values:[u],quoted:!0}}if(a&&s.word){let l=s.word.parts,c=null,u=!1;for(let f of l)if(f.type==="ParameterExpansion"&&!f.operation){let p=f.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(p){c=p[1],u=p[2]==="*";break}}if(c){let f=oe(e,c);if(f.length>0){let h=f.map(([,m])=>m);if(u||o){let m=fe(e.state.env);return{values:[h.join(m)],quoted:!0}}return{values:h,quoted:!0}}let p=e.state.env.get(c);return p!==void 0?{values:[p],quoted:!0}:{values:[],quoted:!0}}}return null}async function O2(e,t,n,r,s){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0],a=-1,o="",l=!1,c=null;for(let d=0;d<i.parts.length;d++){let g=i.parts[d];if(g.type==="ParameterExpansion"&&(g.operation?.type==="PatternRemoval"||g.operation?.type==="PatternReplacement")){let w=g.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(w){a=d,o=w[1],l=w[2]==="*",c=g.operation;break}}}if(a===-1||a===0&&a===i.parts.length-1)return null;let u="";for(let d=0;d<a;d++)u+=await r(e,i.parts[d]);let f="";for(let d=a+1;d<i.parts.length;d++)f+=await r(e,i.parts[d]);let p=oe(e,o),h=p.map(([,d])=>d);if(p.length===0){let d=e.state.env.get(o);if(d!==void 0)h=[d];else{if(l)return{values:[u+f],quoted:!0};let g=u+f;return{values:g?[g]:[],quoted:!0}}}if(c?.type==="PatternRemoval"){let d=c,g="",w=e.state.shoptOptions.extglob;if(d.pattern)for(let y of d.pattern.parts)if(y.type==="Glob")g+=me(y.pattern,d.greedy,w);else if(y.type==="Literal")g+=me(y.value,d.greedy,w);else if(y.type==="SingleQuoted"||y.type==="Escaped")g+=xe(y.value);else if(y.type==="DoubleQuoted"){let b=await s(e,y.parts);g+=xe(b)}else if(y.type==="ParameterExpansion"){let b=await r(e,y);g+=me(b,d.greedy,w)}else{let b=await r(e,y);g+=xe(b)}h=h.map(y=>$n(y,g,d.side,d.greedy))}else if(c?.type==="PatternReplacement"){let d=c,g="";if(d.pattern)for(let b of d.pattern.parts)if(b.type==="Glob")g+=me(b.pattern,!0,e.state.shoptOptions.extglob);else if(b.type==="Literal")g+=me(b.value,!0,e.state.shoptOptions.extglob);else if(b.type==="SingleQuoted"||b.type==="Escaped")g+=xe(b.value);else if(b.type==="DoubleQuoted"){let x=await s(e,b.parts);g+=xe(x)}else if(b.type==="ParameterExpansion"){let x=await r(e,b);g+=me(x,!0,e.state.shoptOptions.extglob)}else{let x=await r(e,b);g+=xe(x)}let w=d.replacement?await s(e,d.replacement.parts):"",y=g;d.anchor==="start"?y=`^${g}`:d.anchor==="end"&&(y=`${g}$`);try{let b=V(y,d.all?"g":"");h=h.map(x=>b.replace(x,w))}catch{}}if(l){let d=fe(e.state.env);return{values:[u+h.join(d)+f],quoted:!0}}return h.length===1?{values:[u+h[0]+f],quoted:!0}:{values:[u+h[0],...h.slice(1,-1),h[h.length-1]+f],quoted:!0}}async function R2(e,t,n,r){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,a="",o=!1;for(let h=0;h<s.parts.length;h++){let m=s.parts[h];if(m.type==="ParameterExpansion"&&!m.operation){let d=m.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(d){i=h,a=d[1],o=d[2]==="*";break}}}if(i===-1)return null;let l="";for(let h=0;h<i;h++)l+=await r(e,s.parts[h]);let c="";for(let h=i+1;h<s.parts.length;h++)c+=await r(e,s.parts[h]);let u=oe(e,a),f=u.map(([,h])=>h);if(u.length===0){let h=e.state.env.get(a);if(h!==void 0)return{values:[l+h+c],quoted:!0};if(o)return{values:[l+c],quoted:!0};let m=l+c;return{values:m?[m]:[],quoted:!0}}if(o){let h=fe(e.state.env);return{values:[l+f.join(h)+c],quoted:!0}}return f.length===1?{values:[l+f[0]+c],quoted:!0}:{values:[l+f[0],...f.slice(1,-1),f[f.length-1]+c],quoted:!0}}var T2=I(()=>{"use strict";Me();jt();qr();Zr();fr();Lt()});async function P2(e,t,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!=="ParameterExpansion"||r.parts[0].operation?.type!=="Substring")return null;let s=r.parts[0],i=s.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!i)return null;let a=i[1],o=i[2]==="*",l=s.operation;if(e.state.associativeArrays?.has(a))throw new pe(1,"",`bash: \${${a}[@]: 0: 3}: bad substitution
783
- `);let c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=oe(e,a),p=0;if(c<0){if(f.length>0){let m=f[f.length-1][0],g=(typeof m=="number"?m:0)+1+c;if(g<0)return{values:[],quoted:!0};p=f.findIndex(([w])=>typeof w=="number"&&w>=g),p<0&&(p=f.length)}}else p=f.findIndex(([m])=>typeof m=="number"&&m>=c),p<0&&(p=f.length);let h;if(u!==void 0){if(u<0)throw new Oe(`${a}[@]: substring expression < 0`);h=f.slice(p,p+u).map(([,m])=>m)}else h=f.slice(p).map(([,m])=>m);if(h.length===0)return{values:[],quoted:!0};if(o){let m=fe(e.state.env);return{values:[h.join(m)],quoted:!0}}return{values:h,quoted:!0}}function D2(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion"||n.parts[0].operation?.type!=="Transform")return null;let r=n.parts[0],s=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let i=s[1],a=s[2]==="*",o=r.operation,l=oe(e,i);if(l.length===0){let f=e.state.env.get(i);if(f!==void 0){let p;switch(o.operator){case"a":p="";break;case"P":p=Ts(e,f);break;case"Q":p=Bn(f);break;default:p=f}return{values:[p],quoted:!0}}return a?{values:[""],quoted:!0}:{values:[],quoted:!0}}let c=zn(e,i),u;switch(o.operator){case"a":u=l.map(()=>c);break;case"P":u=l.map(([,f])=>Ts(e,f));break;case"Q":u=l.map(([,f])=>Bn(f));break;case"u":u=l.map(([,f])=>f.charAt(0).toUpperCase()+f.slice(1));break;case"U":u=l.map(([,f])=>f.toUpperCase());break;case"L":u=l.map(([,f])=>f.toLowerCase());break;default:u=l.map(([,f])=>f)}if(a){let f=fe(e.state.env);return{values:[u.join(f)],quoted:!0}}return{values:u,quoted:!0}}var _2=I(()=>{"use strict";ye();jt();fc();pc();Lt();ia()});function L2(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion")return null;let r=n.parts[0];if(r.operation)return null;let s=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!s)return null;let i=s[1];if(Te(e,i)){let l=ur(e,i);if(l?.endsWith("[@]")||l?.endsWith("[*]"))return{values:[],quoted:!0}}let a=oe(e,i);if(a.length>0)return{values:a.map(([,l])=>l),quoted:!0};let o=e.state.env.get(i);return o!==void 0?{values:[o],quoted:!0}:{values:[],quoted:!0}}function F2(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion"||n.parts[0].operation)return null;let s=n.parts[0].parameter;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)||!Te(e,s))return null;let i=ur(e,s);if(!i)return null;let a=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!a)return null;let o=a[1],l=oe(e,o);if(l.length>0)return{values:l.map(([,u])=>u),quoted:!0};let c=e.state.env.get(o);return c!==void 0?{values:[c],quoted:!0}:{values:[],quoted:!0}}var M2=I(()=>{"use strict";an();Lt()});async function U2(e,t,n,r,s){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0];if(i.parts.length!==1||i.parts[0].type!=="ParameterExpansion"||i.parts[0].operation?.type!=="Indirection")return null;let a=i.parts[0],o=a.operation,l=await Se(e,a.parameter),c=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c){if(!o.innerOp&&(l==="@"||l==="*")){let m=Number.parseInt(e.state.env.get("#")||"0",10),d=[];for(let g=1;g<=m;g++)d.push(e.state.env.get(String(g))||"");return l==="*"?{values:[d.join(fe(e.state.env))],quoted:!0}:{values:d,quoted:!0}}return null}let u=c[1],f=c[2]==="*",p=oe(e,u);if(o.innerOp){if(o.innerOp.type==="Substring")return Ox(e,p,u,f,o.innerOp);if(o.innerOp.type==="DefaultValue"||o.innerOp.type==="UseAlternative"||o.innerOp.type==="AssignDefault"||o.innerOp.type==="ErrorIfUnset")return Rx(e,p,u,f,o.innerOp,s);if(o.innerOp.type==="Transform"&&o.innerOp.operator==="a"){let d=zn(e,u),g=p.map(()=>d);return f?{values:[g.join(fe(e.state.env))],quoted:!0}:{values:g,quoted:!0}}let m=[];for(let[,d]of p){let g={type:"ParameterExpansion",parameter:"_indirect_elem_",operation:o.innerOp},w=e.state.env.get("_indirect_elem_");e.state.env.set("_indirect_elem_",d);try{let y=await r(e,g,!0);m.push(y)}finally{w!==void 0?e.state.env.set("_indirect_elem_",w):e.state.env.delete("_indirect_elem_")}}return f?{values:[m.join(fe(e.state.env))],quoted:!0}:{values:m,quoted:!0}}if(p.length>0){let m=p.map(([,d])=>d);return f?{values:[m.join(fe(e.state.env))],quoted:!0}:{values:m,quoted:!0}}let h=e.state.env.get(u);return h!==void 0?{values:[h],quoted:!0}:{values:[],quoted:!0}}async function Ox(e,t,n,r,s){let i=s.offset?await ne(e,s.offset.expression):0,a=s.length?await ne(e,s.length.expression):void 0,o=0;if(i<0){if(t.length>0){let u=t[t.length-1][0],p=(typeof u=="number"?u:0)+1+i;if(p<0)return{values:[],quoted:!0};if(o=t.findIndex(([h])=>typeof h=="number"&&h>=p),o<0)return{values:[],quoted:!0}}}else if(o=t.findIndex(([u])=>typeof u=="number"&&u>=i),o<0)return{values:[],quoted:!0};let l;if(a!==void 0){if(a<0)throw new Oe(`${n}[@]: substring expression < 0`);l=t.slice(o,o+a)}else l=t.slice(o);let c=l.map(([,u])=>u);return r?{values:[c.join(fe(e.state.env))],quoted:!0}:{values:c,quoted:!0}}async function Rx(e,t,n,r,s,i){let a=s.checkEmpty??!1,o=t.map(([,u])=>u),l=t.length===0,c=t.length===0;if(s.type==="UseAlternative")return!c&&!(a&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:{values:[],quoted:!0};if(s.type==="DefaultValue")return(c||a&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:r?{values:[o.join(fe(e.state.env))],quoted:!0}:{values:o,quoted:!0};if(s.type==="AssignDefault"){if((c||a&&l)&&s.word){let f=await i(e,s.word.parts,!0);return e.state.env.set(`${n}_0`,f),e.state.env.set(`${n}__length`,"1"),{values:[f],quoted:!0}}return r?{values:[o.join(fe(e.state.env))],quoted:!0}:{values:o,quoted:!0}}return r?{values:[o.join(fe(e.state.env))],quoted:!0}:{values:o,quoted:!0}}async function B2(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="UseAlternative"&&t[0].operation?.type!=="DefaultValue")return null;let n=t[0],r=n.operation,s=r?.word;if(!s||s.parts.length!==1||s.parts[0].type!=="DoubleQuoted")return null;let i=s.parts[0];if(i.parts.length!==1||i.parts[0].type!=="ParameterExpansion"||i.parts[0].operation?.type!=="Indirection")return null;let a=i.parts[0],l=(await Se(e,a.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!l)return null;let c=await bn(e,n.parameter),u=await Se(e,n.parameter)==="",f=r.checkEmpty??!1,p;if(r.type==="UseAlternative"?p=c&&!(f&&u):p=!c||f&&u,p){let h=l[1],m=l[2]==="*",d=oe(e,h);if(d.length>0){let w=d.map(([,y])=>y);return m?{values:[w.join(fe(e.state.env))],quoted:!0}:{values:w,quoted:!0}}let g=e.state.env.get(h);return g!==void 0?{values:[g],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}async function W2(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="Indirection")return null;let n=t[0],s=n.operation.innerOp;if(!s||s.type!=="UseAlternative"&&s.type!=="DefaultValue")return null;let i=s.word;if(!i||i.parts.length!==1||i.parts[0].type!=="DoubleQuoted")return null;let a=i.parts[0];if(a.parts.length!==1||a.parts[0].type!=="ParameterExpansion"||a.parts[0].operation?.type!=="Indirection")return null;let o=a.parts[0],c=(await Se(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c)return null;let u=await Se(e,n.parameter),f=await bn(e,n.parameter),p=u==="",h=s.checkEmpty??!1,m;if(s.type==="UseAlternative"?m=f&&!(h&&p):m=!f||h&&p,m){let d=c[1],g=c[2]==="*",w=oe(e,d);if(w.length>0){let b=w.map(([,x])=>x);return g?{values:[b.join(fe(e.state.env))],quoted:!0}:{values:b,quoted:!0}}let y=e.state.env.get(d);return y!==void 0?{values:[y],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}var z2=I(()=>{"use strict";Ct();ye();jt();Lt();ia()});function H2(e){let t=Number.parseInt(e.state.env.get("#")||"0",10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||"");return n}async function j2(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,a=!1;for(let y=0;y<s.parts.length;y++){let b=s.parts[y];if(b.type==="ParameterExpansion"&&(b.parameter==="@"||b.parameter==="*")&&b.operation?.type==="Substring"){i=y,a=b.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=Number.parseInt(e.state.env.get("#")||"0",10),p=[];for(let y=1;y<=f;y++)p.push(e.state.env.get(String(y))||"");let h=e.state.env.get("0")||"bash",m;if(c<=0){let y=[h,...p],b=y.length+c;if(b<0)m=[];else{let x=c<0?b:0;if(u!==void 0){let S=u<0?y.length+u:x+u;m=y.slice(x,Math.max(x,S))}else m=y.slice(x)}}else{let y=c-1;if(y>=p.length)m=[];else if(u!==void 0){let b=u<0?p.length+u:y+u;m=p.slice(y,Math.max(y,b))}else m=p.slice(y)}let d="";for(let y=0;y<i;y++)d+=await r(e,s.parts[y]);let g="";for(let y=i+1;y<s.parts.length;y++)g+=await r(e,s.parts[y]);if(m.length===0){let y=d+g;return{values:y?[y]:[],quoted:!0}}if(a){let y=fe(e.state.env);return{values:[d+m.join(y)+g],quoted:!0}}return m.length===1?{values:[d+m[0]+g],quoted:!0}:{values:[d+m[0],...m.slice(1,-1),m[m.length-1]+g],quoted:!0}}async function G2(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,a=!1;for(let w=0;w<s.parts.length;w++){let y=s.parts[w];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="PatternReplacement"){i=w,a=y.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=H2(e),u="";for(let w=0;w<i;w++)u+=await n(e,s.parts[w]);let f="";for(let w=i+1;w<s.parts.length;w++)f+=await n(e,s.parts[w]);if(c.length===0){let w=u+f;return{values:w?[w]:[],quoted:!0}}let p="";if(l.pattern)for(let w of l.pattern.parts)if(w.type==="Glob")p+=me(w.pattern,!0,e.state.shoptOptions.extglob);else if(w.type==="Literal")p+=me(w.value,!0,e.state.shoptOptions.extglob);else if(w.type==="SingleQuoted"||w.type==="Escaped")p+=xe(w.value);else if(w.type==="DoubleQuoted"){let y=await r(e,w.parts);p+=xe(y)}else if(w.type==="ParameterExpansion"){let y=await n(e,w);p+=me(y,!0,e.state.shoptOptions.extglob)}else{let y=await n(e,w);p+=xe(y)}let h=l.replacement?await r(e,l.replacement.parts):"",m=p;l.anchor==="start"?m=`^${p}`:l.anchor==="end"&&(m=`${p}$`);let d=[];try{let w=V(m,l.all?"g":"");for(let y of c)d.push(w.replace(y,h))}catch{d.push(...c)}if(a){let w=fe(e.state.env);return{values:[u+d.join(w)+f],quoted:!0}}return d.length===1?{values:[u+d[0]+f],quoted:!0}:{values:[u+d[0],...d.slice(1,-1),d[d.length-1]+f],quoted:!0}}async function V2(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,a=!1;for(let g=0;g<s.parts.length;g++){let w=s.parts[g];if(w.type==="ParameterExpansion"&&(w.parameter==="@"||w.parameter==="*")&&w.operation?.type==="PatternRemoval"){i=g,a=w.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=H2(e),u="";for(let g=0;g<i;g++)u+=await n(e,s.parts[g]);let f="";for(let g=i+1;g<s.parts.length;g++)f+=await n(e,s.parts[g]);if(c.length===0){let g=u+f;return{values:g?[g]:[],quoted:!0}}let p="",h=e.state.shoptOptions.extglob;if(l.pattern)for(let g of l.pattern.parts)if(g.type==="Glob")p+=me(g.pattern,l.greedy,h);else if(g.type==="Literal")p+=me(g.value,l.greedy,h);else if(g.type==="SingleQuoted"||g.type==="Escaped")p+=xe(g.value);else if(g.type==="DoubleQuoted"){let w=await r(e,g.parts);p+=xe(w)}else if(g.type==="ParameterExpansion"){let w=await n(e,g);p+=me(w,l.greedy,h)}else{let w=await n(e,g);p+=xe(w)}let m=[];for(let g of c)m.push($n(g,p,l.side,l.greedy));if(a){let g=fe(e.state.env);return{values:[u+m.join(g)+f],quoted:!0}}return m.length===1?{values:[u+m[0]+f],quoted:!0}:{values:[u+m[0],...m.slice(1,-1),m[m.length-1]+f],quoted:!0}}async function q2(e,t,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0],s=-1,i=!1;for(let p=0;p<r.parts.length;p++){let h=r.parts[p];if(h.type==="ParameterExpansion"&&(h.parameter==="@"||h.parameter==="*")){s=p,i=h.parameter==="*";break}}if(s===-1)return null;let a=r.parts[s];if(a.type==="ParameterExpansion"&&a.operation)return null;let o=Number.parseInt(e.state.env.get("#")||"0",10),l="";for(let p=0;p<s;p++)l+=await n(e,r.parts[p]);let c="";for(let p=s+1;p<r.parts.length;p++)c+=await n(e,r.parts[p]);if(o===0){if(i)return{values:[l+c],quoted:!0};let p=l+c;return{values:p?[p]:[],quoted:!0}}let u=[];for(let p=1;p<=o;p++)u.push(e.state.env.get(String(p))||"");if(i){let p=fe(e.state.env);return{values:[l+u.join(p)+c],quoted:!0}}return u.length===1?{values:[l+u[0]+c],quoted:!0}:{values:[l+u[0],...u.slice(1,-1),u[u.length-1]+c],quoted:!0}}var Z2=I(()=>{"use strict";Me();jt();qr();Zr();fr()});function Tx(e){return new Un(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations})}async function oa(e,t){if(e.state.options.noglob)return t;let n=Tx(e),r=[];for(let s of t)if(xn(s,e.state.shoptOptions.extglob)){let i=await n.expand(s);if(i.length>0)r.push(...i);else{if(n.hasFailglob())throw new fn(s);n.hasNullglob()||r.push(s)}}else r.push(s);return r}async function K2(e,t,n,r){let s=-1,i="",a=!1;for(let y=0;y<t.length;y++){let b=t[y];if(b.type==="ParameterExpansion"&&b.operation?.type==="PatternReplacement"){let x=b.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(x){s=y,i=x[1],a=x[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=oe(e,i),u=c.map(([,y])=>y);if(c.length===0){let y=e.state.env.get(i);y!==void 0&&(u=[y])}if(u.length===0)return{values:[],quoted:!1};let f="";if(l.pattern)for(let y of l.pattern.parts)if(y.type==="Glob")f+=me(y.pattern,!0,e.state.shoptOptions.extglob);else if(y.type==="Literal")f+=me(y.value,!0,e.state.shoptOptions.extglob);else if(y.type==="SingleQuoted"||y.type==="Escaped")f+=xe(y.value);else if(y.type==="DoubleQuoted"){let b=await n(e,y.parts);f+=xe(b)}else if(y.type==="ParameterExpansion"){let b=await r(e,y);f+=me(b,!0,e.state.shoptOptions.extglob)}else{let b=await r(e,y);f+=xe(b)}let p=l.replacement?await n(e,l.replacement.parts):"",h=f;l.anchor==="start"?h=`^${f}`:l.anchor==="end"&&(h=`${f}$`);let m=[];try{let y=V(h,l.all?"g":"");for(let b of u)m.push(y.replace(b,p))}catch{m.push(...u)}let d=rt(e.state.env),g=pt(e.state.env);if(a){let y=fe(e.state.env),b=m.join(y);return g?{values:b?[b]:[],quoted:!1}:{values:_e(b,d),quoted:!1}}if(g)return{values:m,quoted:!1};let w=[];for(let y of m)y===""?w.push(""):w.push(..._e(y,d));return{values:w,quoted:!1}}async function Q2(e,t,n,r){let s=-1,i="",a=!1;for(let w=0;w<t.length;w++){let y=t[w];if(y.type==="ParameterExpansion"&&y.operation?.type==="PatternRemoval"){let b=y.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(b){s=w,i=b[1],a=b[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=oe(e,i),u=c.map(([,w])=>w);if(c.length===0){let w=e.state.env.get(i);w!==void 0&&(u=[w])}if(u.length===0)return{values:[],quoted:!1};let f="",p=e.state.shoptOptions.extglob;if(l.pattern)for(let w of l.pattern.parts)if(w.type==="Glob")f+=me(w.pattern,l.greedy,p);else if(w.type==="Literal")f+=me(w.value,l.greedy,p);else if(w.type==="SingleQuoted"||w.type==="Escaped")f+=xe(w.value);else if(w.type==="DoubleQuoted"){let y=await n(e,w.parts);f+=xe(y)}else if(w.type==="ParameterExpansion"){let y=await r(e,w);f+=me(y,l.greedy,p)}else{let y=await r(e,w);f+=xe(y)}let h=[];for(let w of u)h.push($n(w,f,l.side,l.greedy));let m=rt(e.state.env),d=pt(e.state.env);if(a){let w=fe(e.state.env),y=h.join(w);return d?{values:y?[y]:[],quoted:!1}:{values:_e(y,m),quoted:!1}}if(d)return{values:h,quoted:!1};let g=[];for(let w of h)w===""?g.push(""):g.push(..._e(w,m));return{values:g,quoted:!1}}async function X2(e,t,n,r){let s=-1,i=!1;for(let g=0;g<t.length;g++){let w=t[g];if(w.type==="ParameterExpansion"&&(w.parameter==="@"||w.parameter==="*")&&w.operation?.type==="PatternRemoval"){s=g,i=w.parameter==="*";break}}if(s===-1)return null;let o=t[s].operation,l=Number.parseInt(e.state.env.get("#")||"0",10),c=[];for(let g=1;g<=l;g++)c.push(e.state.env.get(String(g))||"");if(c.length===0)return{values:[],quoted:!1};let u="",f=e.state.shoptOptions.extglob;if(o.pattern)for(let g of o.pattern.parts)if(g.type==="Glob")u+=me(g.pattern,o.greedy,f);else if(g.type==="Literal")u+=me(g.value,o.greedy,f);else if(g.type==="SingleQuoted"||g.type==="Escaped")u+=xe(g.value);else if(g.type==="DoubleQuoted"){let w=await n(e,g.parts);u+=xe(w)}else if(g.type==="ParameterExpansion"){let w=await r(e,g);u+=me(w,o.greedy,f)}else{let w=await r(e,g);u+=xe(w)}let p=[];for(let g of c)p.push($n(g,u,o.side,o.greedy));let h=rt(e.state.env),m=pt(e.state.env);if(i){let g=fe(e.state.env),w=p.join(g);return m?{values:w?[w]:[],quoted:!1}:{values:_e(w,h),quoted:!1}}if(m)return{values:p,quoted:!1};let d=[];for(let g of p)g===""?d.push(""):d.push(..._e(g,h));return{values:d,quoted:!1}}async function Y2(e,t,n,r){let s=-1,i=!1;for(let b=0;b<t.length;b++){let x=t[b];if(x.type==="ParameterExpansion"&&(x.parameter==="@"||x.parameter==="*")&&x.operation?.type==="Substring"){s=b,i=x.parameter==="*";break}}if(s===-1)return null;let o=t[s].operation,l=o.offset?await n(e,o.offset.expression):0,c=o.length?await n(e,o.length.expression):void 0,u=Number.parseInt(e.state.env.get("#")||"0",10),f=[];for(let b=1;b<=u;b++)f.push(e.state.env.get(String(b))||"");let p=e.state.env.get("0")||"bash",h;if(l<=0){let b=[p,...f],x=b.length+l;if(x<0)h=[];else{let S=l<0?x:0;if(c!==void 0){let $=c<0?b.length+c:S+c;h=b.slice(S,Math.max(S,$))}else h=b.slice(S)}}else{let b=l-1;if(b>=f.length)h=[];else if(c!==void 0){let x=c<0?f.length+c:b+c;h=f.slice(b,Math.max(b,x))}else h=f.slice(b)}let m="";for(let b=0;b<s;b++)m+=await r(e,t[b]);let d="";for(let b=s+1;b<t.length;b++)d+=await r(e,t[b]);let g=rt(e.state.env),w=pt(e.state.env);if(h.length===0){let b=m+d;return b?w?{values:[b],quoted:!1}:{values:_e(b,g),quoted:!1}:{values:[],quoted:!1}}let y;if(i){let b=fe(e.state.env),x=m+h.join(b)+d;w?y=x?[x]:[]:y=_e(x,g)}else if(w)h.length===1?y=[m+h[0]+d]:y=[m+h[0],...h.slice(1,-1),h[h.length-1]+d];else{y=[];for(let b=0;b<h.length;b++){let x=h[b];if(b===0&&(x=m+x),b===h.length-1&&(x=x+d),x==="")y.push("");else{let S=_e(x,g);y.push(...S)}}}return{values:await oa(e,y),quoted:!1}}async function J2(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].parameter!=="@"&&t[0].parameter!=="*"||t[0].operation)return null;let n=t[0].parameter==="*",r=Number.parseInt(e.state.env.get("#")||"0",10);if(r===0)return{values:[],quoted:!1};let s=[];for(let c=1;c<=r;c++)s.push(e.state.env.get(String(c))||"");let i=rt(e.state.env),a=pt(e.state.env),o=ea(e.state.env),l;if(n)if(a)l=s.filter(c=>c!=="");else{let c=fe(e.state.env),u=s.join(c);l=_e(u,i)}else if(a)l=s.filter(c=>c!=="");else if(o){l=[];for(let c of s){if(c==="")continue;let u=_e(c,i);l.push(...u)}}else{l=[];for(let c of s)if(c==="")l.push("");else{let u=_e(c,i);l.push(...u)}for(;l.length>0&&l[l.length-1]==="";)l.pop()}return{values:await oa(e,l),quoted:!1}}async function eg(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation)return null;let n=t[0].parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!n)return null;let r=n[1],s=n[2]==="*",i=oe(e,r),a;if(i.length===0){let f=e.state.env.get(r);if(f!==void 0)a=[f];else return{values:[],quoted:!1}}else a=i.map(([,f])=>f);let o=rt(e.state.env),l=pt(e.state.env),c=ea(e.state.env),u;if(s)if(l)u=a.filter(f=>f!=="");else{let f=fe(e.state.env),p=a.join(f);u=_e(p,o)}else if(l)u=a.filter(f=>f!=="");else if(c){u=[];for(let f of a){if(f==="")continue;let p=_e(f,o);u.push(...p)}}else{u=[];for(let f of a)if(f==="")u.push("");else{let p=_e(f,o);u.push(...p)}for(;u.length>0&&u[u.length-1]==="";)u.pop()}return{values:await oa(e,u),quoted:!1}}function tg(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="VarNamePrefix")return null;let n=t[0].operation,r=Kr(e,n.prefix);if(r.length===0)return{values:[],quoted:!1};let s=rt(e.state.env),i=pt(e.state.env),a;if(n.star)if(i)a=r;else{let o=fe(e.state.env),l=r.join(o);a=_e(l,s)}else if(i)a=r;else{a=[];for(let o of r){let l=_e(o,s);a.push(...l)}}return{values:a,quoted:!1}}function ng(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="ArrayKeys")return null;let n=t[0].operation,s=oe(e,n.array).map(([l])=>String(l));if(s.length===0)return{values:[],quoted:!1};let i=rt(e.state.env),a=pt(e.state.env),o;if(n.star)if(a)o=s;else{let l=fe(e.state.env),c=s.join(l);o=_e(c,i)}else if(a)o=s;else{o=[];for(let l of s){let c=_e(l,i);o.push(...c)}}return{values:o,quoted:!1}}async function rg(e,t,n){let r=-1;for(let p=0;p<t.length;p++){let h=t[p];if(h.type==="ParameterExpansion"&&(h.parameter==="@"||h.parameter==="*")&&!h.operation){r=p;break}}if(r===-1||t.length<=1)return null;let s=Number.parseInt(e.state.env.get("#")||"0",10),i=[];for(let p=1;p<=s;p++)i.push(e.state.env.get(String(p))||"");let a="";for(let p=0;p<r;p++)a+=await n(e,t[p]);let o="";for(let p=r+1;p<t.length;p++)o+=await n(e,t[p]);let l=rt(e.state.env),c=pt(e.state.env),u=ea(e.state.env);if(s===0){let p=a+o;return{values:p?[p]:[],quoted:!1}}let f;{let p=[];for(let h=0;h<i.length;h++){let m=i[h];h===0&&(m=a+m),h===i.length-1&&(m=m+o),p.push(m)}if(c)f=p.filter(h=>h!=="");else if(u){f=[];for(let h of p){if(h==="")continue;let m=_e(h,l);f.push(...m)}}else{f=[];for(let h of p)if(h==="")f.push("");else{let m=_e(h,l);f.push(...m)}for(;f.length>0&&f[f.length-1]==="";)f.pop()}}return f.length===0?{values:[],quoted:!1}:{values:await oa(e,f),quoted:!1}}var sg=I(()=>{"use strict";Me();Xi();ye();jt();qr();Vr();Zr();fr();Lt()});async function og(e,t,n){e.coverage?.hit("bash:expansion:word_glob");let r=t.parts,{hasQuoted:s,hasCommandSub:i,hasArrayVar:a,hasArrayAtExpansion:o,hasParamExpansion:l,hasVarNamePrefixExpansion:c,hasIndirection:u}=Rs(r),p=n.hasBraceExpansion(r)?await n.expandWordWithBracesAsync(e,t):null;if(p&&p.length>1)return Px(e,p,s);let h=await Dx(e,r,o,c,u,n);if(h!==null)return h;let m=await Lx(e,r,n);if(m!==null)return m;let d=await Fx(e,r,n);if(d!==null)return d;let g=await Ux(e,r,n.expandPart);if(g!==null)return ag(e,g);if((i||a||l)&&!pt(e.state.env)){let y=rt(e.state.env),b=n.buildIfsCharClassPattern(y),x=await n.smartWordSplit(e,r,y,b,n.expandPart);return ag(e,x)}let w=await n.expandWordAsync(e,t);return Bx(e,t,r,w,s,n.expandWordForGlobbing)}async function Px(e,t,n){let r=[];for(let s of t)if(!(!n&&s===""))if(!n&&!e.state.options.noglob&&xn(s,e.state.shoptOptions.extglob)){let i=await la(e,s);r.push(...i)}else r.push(s);return{values:r,quoted:!1}}async function Dx(e,t,n,r,s,i){if(n){let a=L2(e,t);if(a!==null)return a}{let a=F2(e,t);if(a!==null)return a}{let a=await $2(e,t);if(a!==null)return a}{let a=await O2(e,t,n,i.expandPart,i.expandWordPartsAsync);if(a!==null)return a}{let a=await R2(e,t,n,i.expandPart);if(a!==null)return a}{let a=await P2(e,t,i.evaluateArithmetic);if(a!==null)return a}{let a=D2(e,t);if(a!==null)return a}{let a=await k2(e,t,i.expandWordPartsAsync,i.expandPart);if(a!==null)return a}{let a=await v2(e,t,i.expandWordPartsAsync,i.expandPart);if(a!==null)return a}if(r&&t.length===1&&t[0].type==="DoubleQuoted"){let a=_x(e,t);if(a!==null)return a}{let a=await U2(e,t,s,i.expandParameterAsync,i.expandWordPartsAsync);if(a!==null)return a}{let a=await B2(e,t);if(a!==null)return a}{let a=await W2(e,t);if(a!==null)return a}return null}function _x(e,t){let n=t[0];if(n.type!=="DoubleQuoted")return null;if(n.parts.length===1&&n.parts[0].type==="ParameterExpansion"&&n.parts[0].operation?.type==="VarNamePrefix"){let r=n.parts[0].operation,s=Kr(e,r.prefix);return r.star?{values:[s.join(fe(e.state.env))],quoted:!0}:{values:s,quoted:!0}}if(n.parts.length===1&&n.parts[0].type==="ParameterExpansion"&&n.parts[0].operation?.type==="ArrayKeys"){let r=n.parts[0].operation,i=oe(e,r.array).map(([a])=>String(a));return r.star?{values:[i.join(fe(e.state.env))],quoted:!0}:{values:i,quoted:!0}}return null}async function Lx(e,t,n){{let r=await j2(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await G2(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await V2(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await q2(e,t,n.expandPart);if(r!==null)return r}return null}async function Fx(e,t,n){{let r=await K2(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await Q2(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await X2(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await Y2(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await J2(e,t);if(r!==null)return r}{let r=await eg(e,t);if(r!==null)return r}{let r=tg(e,t);if(r!==null)return r}{let r=ng(e,t);if(r!==null)return r}{let r=await rg(e,t,n.expandPart);if(r!==null)return r}return null}function ig(e){if(e.type!=="DoubleQuoted")return null;for(let t=0;t<e.parts.length;t++){let n=e.parts[t];if(n.type!=="ParameterExpansion"||n.operation)continue;let r=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(r)return{type:"array",name:r[1],atIndex:t,isStar:r[2]==="*"};if(n.parameter==="@"||n.parameter==="*")return{type:"positional",atIndex:t,isStar:n.parameter==="*"}}return null}async function Mx(e,t,n,r){let s="";for(let o=0;o<n.atIndex;o++)s+=await r(e,t.parts[o]);let i="";for(let o=n.atIndex+1;o<t.parts.length;o++)i+=await r(e,t.parts[o]);let a;if(n.type==="array"){if(a=oe(e,n.name).map(([,l])=>l),a.length===0){let l=e.state.env.get(n.name);l!==void 0&&(a=[l])}}else{let o=Number.parseInt(e.state.env.get("#")||"0",10);a=[];for(let l=1;l<=o;l++)a.push(e.state.env.get(String(l))||"")}if(n.isStar){let o=fe(e.state.env),l=a.join(o);return[s+l+i]}if(a.length===0){let o=s+i;return o?[o]:[]}return a.length===1?[s+a[0]+i]:[s+a[0],...a.slice(1,-1),a[a.length-1]+i]}async function Ux(e,t,n){if(t.length<2)return null;let r=!1;for(let l of t)if(ig(l)){r=!0;break}if(!r)return null;let s=rt(e.state.env),i=pt(e.state.env),a=[];for(let l of t){let c=ig(l);if(c&&l.type==="DoubleQuoted"){let u=await Mx(e,l,c,n);a.push(u)}else if(l.type==="DoubleQuoted"||l.type==="SingleQuoted"){let u=await n(e,l);a.push([u])}else if(l.type==="Literal")a.push([l.value]);else if(l.type==="ParameterExpansion"){let u=await n(e,l);if(i)a.push(u?[u]:[]);else{let f=_e(u,s);a.push(f)}}else{let u=await n(e,l);if(i)a.push(u?[u]:[]);else{let f=_e(u,s);a.push(f)}}}let o=[];for(let l of a)if(l.length!==0)if(o.length===0)o.push(...l);else{let c=o.length-1;o[c]=o[c]+l[0];for(let u=1;u<l.length;u++)o.push(l[u])}return o}async function ag(e,t){if(e.state.options.noglob)return{values:t,quoted:!1};let n=[];for(let r of t)if(xn(r,e.state.shoptOptions.extglob)){let s=await la(e,r);n.push(...s)}else n.push(r);return{values:n,quoted:!1}}async function la(e,t){let n=new Un(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations}),r=await n.expand(t);if(r.length>0)return r;if(n.hasFailglob())throw new fn(t);return n.hasNullglob()?[]:[t]}async function Bx(e,t,n,r,s,i){let a=n.some(o=>o.type==="Glob");if(!e.state.options.noglob&&a){let o=await i(e,t);if(xn(o,e.state.shoptOptions.extglob)){let c=await la(e,o);if(c.length>0&&c[0]!==o)return{values:c,quoted:!1};if(c.length===0)return{values:[],quoted:!1}}let l=uc(r);if(!pt(e.state.env)){let c=rt(e.state.env);return{values:_e(l,c),quoted:!1}}return{values:[l],quoted:!1}}if(!s&&!e.state.options.noglob&&xn(r,e.state.shoptOptions.extglob)){let o=await i(e,t);if(xn(o,e.state.shoptOptions.extglob)){let l=await la(e,o);if(l.length>0&&l[0]!==o)return{values:l,quoted:!1}}}if(r===""&&!s)return{values:[],quoted:!1};if(a&&!s){let o=uc(r);if(!pt(e.state.env)){let l=rt(e.state.env);return{values:_e(o,l),quoted:!1}}return{values:[o],quoted:!1}}return{values:[r],quoted:s}}var lg=I(()=>{"use strict";Xi();ye();jt();Yi();I2();T2();_2();M2();Vr();z2();fr();Z2();sg();Lt()});async function ug(e,t){let n=t.operation;if(!n||n.type!=="DefaultValue"&&n.type!=="AssignDefault"&&n.type!=="UseAlternative")return null;let r=n.word;if(!r||r.parts.length===0)return null;let s=await bn(e,t.parameter),a=await Se(e,t.parameter,!1)==="",o=n.checkEmpty??!1,l;return n.type==="UseAlternative"?l=s&&!(o&&a):l=!s||o&&a,l?r.parts:null}function Wx(e){return e.type==="SingleQuoted"?!0:e.type==="DoubleQuoted"?e.parts.every(n=>n.type==="Literal"):!1}async function zx(e,t){if(t.type!=="ParameterExpansion")return null;let n=await ug(e,t);if(!n||n.length<=1)return null;let r=n.some(i=>Wx(i)),s=n.some(i=>i.type==="Literal"||i.type==="ParameterExpansion"||i.type==="CommandSubstitution"||i.type==="ArithmeticExpansion");return r&&s?n:null}function Hx(e){return e.type==="DoubleQuoted"||e.type==="SingleQuoted"||e.type==="Literal"?!1:e.type==="Glob"?rc(e.pattern):!(!(e.type==="ParameterExpansion"||e.type==="CommandSubstitution"||e.type==="ArithmeticExpansion")||e.type==="ParameterExpansion"&&qm(e))}async function fg(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:word_split"),t.length===1&&t[0].type==="ParameterExpansion"){let p=t[0],h=await ug(e,p);if(h&&h.length>0&&h.length>1&&h.some(d=>d.type==="DoubleQuoted"||d.type==="SingleQuoted")&&h.some(d=>d.type==="Literal"||d.type==="ParameterExpansion"||d.type==="CommandSubstitution"||d.type==="ArithmeticExpansion"))return cg(e,h,n,r,s)}let i=[],a=!1;for(let p of t){let h=Hx(p),m=p.type==="DoubleQuoted"||p.type==="SingleQuoted",d=h?await zx(e,p):null,g=await s(e,p);i.push({value:g,isSplittable:h,isQuoted:m,mixedDefaultParts:d??void 0}),h&&(a=!0)}if(!a){let p=i.map(h=>h.value).join("");return p?[p]:[]}let o=[],l="",c=!1,u=!1,f=!1;for(let p of i)if(!p.isSplittable)u?p.isQuoted&&p.value===""?(l!==""&&o.push(l),o.push(""),c=!0,l="",u=!1,f=!0):p.value!==""?(l!==""&&o.push(l),l=p.value,u=!1,f=!1):(l+=p.value,f=!1):(l+=p.value,f=p.isQuoted&&p.value==="");else if(p.mixedDefaultParts){let h=await cg(e,p.mixedDefaultParts,n,r,s);if(h.length!==0)if(h.length===1)l+=h[0],c=!0;else{l+=h[0],o.push(l),c=!0;for(let m=1;m<h.length-1;m++)o.push(h[m]);l=h[h.length-1]}u=!1,f=!1}else{let{words:h,hadLeadingDelimiter:m,hadTrailingDelimiter:d}=ta(p.value,n);if(f&&m&&l===""&&(o.push(""),c=!0),h.length===0)d&&(u=!0);else if(h.length===1)l+=h[0],c=!0,u=d;else{l+=h[0],o.push(l),c=!0;for(let g=1;g<h.length-1;g++)o.push(h[g]);l=h[h.length-1],u=d}f=!1}return l!==""?o.push(l):o.length===0&&c&&o.push(""),o}function jx(e,t){return e.length>0&&t.includes(e[0])}async function cg(e,t,n,r,s){let i=[];for(let u of t){let p=!(u.type==="DoubleQuoted"||u.type==="SingleQuoted"),h=await s(e,u);i.push({value:h,isSplittable:p})}let a=[],o="",l=!1,c=!1;for(let u of i)if(!u.isSplittable)c&&u.value!==""?(o!==""&&a.push(o),o=u.value,c=!1):o+=u.value;else{jx(u.value,n)&&o!==""&&(a.push(o),o="",l=!0);let{words:p,hadTrailingDelimiter:h}=ta(u.value,n);if(p.length===0)h&&(c=!0);else if(p.length===1)o+=p[0],l=!0,c=h;else{o+=p[0],a.push(o),l=!0;for(let m=1;m<p.length-1;m++)a.push(p[m]);o=p[p.length-1],c=h}}return o!==""?a.push(o):a.length===0&&l&&a.push(""),a}var pg=I(()=>{"use strict";Lt();jt();Yi()});function hg(e){switch(e.type){case"Literal":return e.value;case"SingleQuoted":return e.value;case"Escaped":return e.value;default:return null}}function dg(e){switch(e.type){case"SingleQuoted":case"Escaped":case"DoubleQuoted":return!0;case"Literal":return e.value==="";default:return!1}}var mg=I(()=>{"use strict"});var bc={};K(bc,{escapeGlobChars:()=>Ft,escapeRegexChars:()=>Gr,expandRedirectTarget:()=>Ds,expandWord:()=>ie,expandWordForPattern:()=>yc,expandWordForRegex:()=>gc,expandWordWithGlob:()=>cn,getArrayElements:()=>oe,getVariable:()=>Se,hasQuotedMultiValueAt:()=>Ps,isArray:()=>In,isWordFullyQuoted:()=>mc});function Hn(e,t,n){if(e.length>t)throw new J(`${n}: string length limit exceeded (${t} bytes)`,"string_length")}async function ln(e,t,n=!1){let r=[];for(let s of t)r.push(await Gt(e,s,n));return r.join("")}function Gx(e){return dg(e)}function mc(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!Gx(t))return!1;return!0}function Vx(e,t,n=!1){let r=hg(t);if(r!==null)return r;switch(t.type){case"TildeExpansion":return n?t.user===null?"~":`~${t.user}`:(e.coverage?.hit("bash:expansion:tilde"),t.user===null?e.state.env.get("HOME")??"/home/user":t.user==="root"?"/root":`~${t.user}`);case"Glob":return hc(e,t.pattern);default:return null}}async function ie(e,t){return wc(e,t)}async function gc(e,t){let n=[];for(let r of t.parts)if(r.type==="Escaped")n.push(`\\${r.value}`);else if(r.type==="SingleQuoted")n.push(r.value);else if(r.type==="DoubleQuoted"){let s=await ln(e,r.parts);n.push(s)}else if(r.type==="TildeExpansion"){let s=await Gt(e,r);n.push(Gr(s))}else n.push(await Gt(e,r));return n.join("")}async function yc(e,t){let n=[];for(let r of t.parts)if(r.type==="Escaped"){let s=r.value;"()|*?[]".includes(s)?n.push(`\\${s}`):n.push(s)}else if(r.type==="SingleQuoted")n.push(Ft(r.value));else if(r.type==="DoubleQuoted"){let s=await ln(e,r.parts);n.push(Ft(s))}else n.push(await Gt(e,r));return n.join("")}async function gg(e,t){let n=[];for(let r of t.parts)if(r.type==="SingleQuoted")n.push(Ft(r.value));else if(r.type==="Escaped"){let s=r.value;"*?[]\\()|".includes(s)?n.push(`\\${s}`):n.push(s)}else if(r.type==="DoubleQuoted"){let s=await ln(e,r.parts);n.push(Ft(s))}else r.type==="Glob"?x2(r.pattern)?n.push(await A2(e,r.pattern)):n.push(hc(e,r.pattern)):r.type==="Literal"?n.push(r.value):n.push(await Gt(e,r));return n.join("")}function ua(e){for(let t of e)if(t.type==="BraceExpansion"||t.type==="DoubleQuoted"&&ua(t.parts))return!0;return!1}async function yg(e,t,n={count:0}){if(n.count>dc)return[[]];let r=[[]];for(let s of t)if(s.type==="BraceExpansion"){let i=[],a=!1,o="";for(let u of s.items)if(u.type==="Range"){let f=cc(u.start,u.end,u.step,u.startStr,u.endStr);if(f.expanded)for(let p of f.expanded)n.count++,i.push(p);else{a=!0,o=f.literal;break}}else{let f=await yg(e,u.word.parts,n);for(let p of f){n.count++;let h=[];for(let m of p)typeof m=="string"?h.push(m):h.push(await Gt(e,m));i.push(h.join(""))}}if(a){for(let u of r)n.count++,u.push(o);continue}if(r.length*i.length>e.limits.maxBraceExpansionResults||n.count>dc)return r;let c=[];for(let u of r)for(let f of i){if(n.count++,n.count>dc)return c.length>0?c:r;c.push([...u,f])}r=c}else for(let i of r)n.count++,i.push(s);return r}async function wg(e,t){let n=t.parts;if(!ua(n))return[await ie(e,t)];let r=await yg(e,n),s=[];for(let i of r){let a=[];for(let o of i)typeof o=="string"?a.push(o):a.push(await Gt(e,o));s.push(C2(e,a.join("")))}return s}function qx(){return{expandWordAsync:wc,expandWordForGlobbing:gg,expandWordWithBracesAsync:wg,expandWordPartsAsync:ln,expandPart:Gt,expandParameterAsync:ca,hasBraceExpansion:ua,evaluateArithmetic:ne,buildIfsCharClassPattern:Zm,smartWordSplit:fg}}async function cn(e,t){return og(e,t,qx())}function Zx(e){for(let t of e){if(t.type==="ParameterExpansion")return t.parameter;if(t.type==="Literal")return t.value}return""}function Ps(e,t){if(Number.parseInt(e.state.env.get("#")||"0",10)<2)return!1;function r(s){for(let i of s)if(i.type==="DoubleQuoted"){for(let a of i.parts)if(a.type==="ParameterExpansion"&&a.parameter==="@"&&!a.operation)return!0}return!1}return r(t.parts)}async function Ds(e,t){if(Ps(e,t))return{error:`bash: $@: ambiguous redirect
782
+ `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"'":return"'";case'"':return'"';case"?":return"?";default:return l}});case"K":case"k":return r?"":Bn(n);case"u":return n.charAt(0).toUpperCase()+n.slice(1);case"U":return n.toUpperCase();case"L":return n.toLowerCase();default:return n}}async function m2(e,t,n,r,s,i,a=!1){if(e.coverage?.hit("bash:expansion:indirection"),Te(e,t))return ur(e,t)||"";let o=/^[a-zA-Z_][a-zA-Z0-9_]*\[([@*])\]$/.test(t);if(r){if(s.innerOp?.type==="UseAlternative")return"";throw new bt(`\${!${t}}`)}let l=n;if(o&&(l===""||l.includes(" ")))throw new bt(`\${!${t}}`);let c=l.match(/^[a-zA-Z_][a-zA-Z0-9_]*\[(.+)\]$/);if(c&&c[1].includes("~"))throw new bt(`\${!${t}}`);if(s.innerOp){let u={type:"ParameterExpansion",parameter:l,operation:s.innerOp};return i(e,u,a)}return await Se(e,l)}function g2(e,t){e.coverage?.hit("bash:expansion:array_keys");let r=oe(e,t.array).map(([s])=>String(s));return t.star?r.join(fe(e.state.env)):r.join(" ")}function y2(e,t){e.coverage?.hit("bash:expansion:var_name_prefix");let n=Kr(e,t.prefix);return t.star?n.join(fe(e.state.env)):n.join(" ")}function w2(e,t,n,r){let s=Number.parseInt(e.state.env.get("#")||"0",10),i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t==="*")return{isEmpty:s===0,effectiveValue:n};if(t==="@")return{isEmpty:s===0||s===1&&e.state.env.get("1")==="",effectiveValue:n};if(i){let[,a,o]=i,l=oe(e,a);if(l.length===0)return{isEmpty:!0,effectiveValue:""};if(o==="*"){let c=fe(e.state.env),u=l.map(([,f])=>f).join(c);return{isEmpty:r?u==="":!1,effectiveValue:u}}return{isEmpty:l.length===1&&l.every(([,c])=>c===""),effectiveValue:l.map(([,c])=>c).join(" ")}}return{isEmpty:n==="",effectiveValue:n}}var b2=I(()=>{"use strict";mt();Xe();Me();Ct();ye();jt();an();qr();Zr();fr();fc();pc();Lt();ia()});function x2(e){let t=0;for(;t<e.length;){let n=e[t];if(n==="\\"&&t+1<e.length){t+=2;continue}if(n==="'"){let r=e.indexOf("'",t+1);if(r!==-1){t=r+1;continue}}if(n==="$"&&t+1<e.length&&e[t+1]==="("||n==="`")return!0;t++}return!1}function E2(e,t){let n=1,r=t,s=!1,i=!1;for(;r<e.length&&n>0;){let a=e[r];if(a==="\\"&&!s&&r+1<e.length){r+=2;continue}if(a==="'"&&!i){s=!s,r++;continue}if(a==='"'&&!s){i=!i,r++;continue}if(!s&&!i){if(a==="(")n++;else if(a===")"&&(n--,n===0))return r}r++}return-1}async function aa(e,t){let n=new ce,r;try{r=n.parse(t)}catch{return""}let s=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let i=new Map(e.state.env),a=e.state.cwd,o=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let l=await e.executeScript(r),c=l.exitCode;return e.state.env=i,e.state.cwd=a,e.state.suppressVerbose=o,e.state.lastExitCode=c,e.state.env.set("?",String(c)),l.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+l.stderr),e.state.bashPid=s,l.stdout.replace(/\n+$/,"")}catch(l){if(e.state.env=i,e.state.cwd=a,e.state.bashPid=s,e.state.suppressVerbose=o,l instanceof J)throw l;return l instanceof pe?(e.state.lastExitCode=l.exitCode,e.state.env.set("?",String(l.exitCode)),l.stdout?.replace(/\n+$/,"")??""):""}}function hc(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="'"){let i=t.indexOf("'",r+1);if(i!==-1){let a=t.slice(r+1,i);n+=Ft(a),r=i+1;continue}}if(s==='"'){let i=-1,a=r+1;for(;a<t.length;){if(t[a]==="\\"){a+=2;continue}if(t[a]==='"'){i=a;break}a++}if(i!==-1){let o=t.slice(r+1,i),l=kx(e,o);n+=Ft(l),r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let a=t.indexOf("}",r+2);if(a!==-1){let o=t.slice(r+2,a);n+=e.state.env.get(o)??"",r=a+1;continue}}else if(/[a-zA-Z_]/.test(i)){let a=r+1;for(;a<t.length&&/[a-zA-Z0-9_]/.test(t[a]);)a++;let o=t.slice(r+1,a);n+=e.state.env.get(o)??"",r=a;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}function kx(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="\\"&&r+1<t.length){let i=t[r+1];if(i==="$"||i==="`"||i==="\\"||i==='"'){n+=i,r+=2;continue}n+=s,r++;continue}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let a=t.indexOf("}",r+2);if(a!==-1){let o=t.slice(r+2,a);n+=e.state.env.get(o)??"",r=a+1;continue}}else if(/[a-zA-Z_]/.test(i)){let a=r+1;for(;a<t.length&&/[a-zA-Z0-9_]/.test(t[a]);)a++;let o=t.slice(r+1,a);n+=e.state.env.get(o)??"",r=a;continue}}n+=s,r++}return n}async function A2(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="'"){let i=t.indexOf("'",r+1);if(i!==-1){let a=t.slice(r+1,i);n+=Ft(a),r=i+1;continue}}if(s==='"'){let i=-1,a=r+1;for(;a<t.length;){if(t[a]==="\\"){a+=2;continue}if(t[a]==='"'){i=a;break}a++}if(i!==-1){let o=t.slice(r+1,i),l=await Ix(e,o);n+=Ft(l),r=i+1;continue}}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=E2(t,r+2);if(i!==-1){let a=t.slice(r+2,i),o=await aa(e,a);n+=o,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let a=t.slice(r+1,i),o=await aa(e,a);n+=o,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let a=t.indexOf("}",r+2);if(a!==-1){let o=t.slice(r+2,a);n+=e.state.env.get(o)??"",r=a+1;continue}}else if(/[a-zA-Z_]/.test(i)){let a=r+1;for(;a<t.length&&/[a-zA-Z0-9_]/.test(t[a]);)a++;let o=t.slice(r+1,a);n+=e.state.env.get(o)??"",r=a;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}async function Ix(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="\\"&&r+1<t.length){let i=t[r+1];if(i==="$"||i==="`"||i==="\\"||i==='"'){n+=i,r+=2;continue}n+=s,r++;continue}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=E2(t,r+2);if(i!==-1){let a=t.slice(r+2,i),o=await aa(e,a);n+=o,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let a=t.slice(r+1,i),o=await aa(e,a);n+=o,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let a=t.indexOf("}",r+2);if(a!==-1){let o=t.slice(r+2,a);n+=e.state.env.get(o)??"",r=a+1;continue}}else if(/[a-zA-Z_]/.test(i)){let a=r+1;for(;a<t.length&&/[a-zA-Z0-9_]/.test(t[a]);)a++;let o=t.slice(r+1,a);n+=e.state.env.get(o)??"",r=a;continue}}n+=s,r++}return n}var S2=I(()=>{"use strict";Xe();ye();Vr()});function C2(e,t){if(!t.startsWith("~"))return t;e.coverage?.hit("bash:expansion:tilde");let n=e.state.env.get("HOME")!==void 0?e.state.env.get("HOME"):"/home/user";if(t==="~"||t.startsWith("~/"))return n+t.slice(1);let r=1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;let s=t.slice(1,r),i=t.slice(r);return i!==""&&!i.startsWith("/")?t:s==="root"?`/root${i}`:t}var N2=I(()=>{"use strict"});async function $x(e,t,n,r){let s="";for(let i of t.parts)if(i.type==="Glob")s+=me(i.pattern,!0,e.state.shoptOptions.extglob);else if(i.type==="Literal")s+=me(i.value,!0,e.state.shoptOptions.extglob);else if(i.type==="SingleQuoted"||i.type==="Escaped")s+=xe(i.value);else if(i.type==="DoubleQuoted"){let a=await n(e,i.parts);s+=xe(a)}else if(i.type==="ParameterExpansion"){let a=await r(e,i);s+=me(a,!0,e.state.shoptOptions.extglob)}else{let a=await r(e,i);s+=xe(a)}return s}async function v2(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0];if(s.parts.length!==1||s.parts[0].type!=="ParameterExpansion"||s.parts[0].operation?.type!=="PatternReplacement")return null;let i=s.parts[0],a=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!a)return null;let o=a[1],l=a[2]==="*",c=i.operation,u=oe(e,o),f=u.map(([,g])=>g);if(u.length===0){let g=e.state.env.get(o);g!==void 0&&f.push(g)}if(f.length===0)return{values:[],quoted:!0};let p="";c.pattern&&(p=await $x(e,c.pattern,n,r));let h=c.replacement?await n(e,c.replacement.parts):"",m=p;c.anchor==="start"?m=`^${p}`:c.anchor==="end"&&(m=`${p}$`);let d=[];try{let g=V(m,c.all?"g":"");for(let w of f)d.push(g.replace(w,h))}catch{d.push(...f)}if(l){let g=fe(e.state.env);return{values:[d.join(g)],quoted:!0}}return{values:d,quoted:!0}}async function k2(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0];if(s.parts.length!==1||s.parts[0].type!=="ParameterExpansion"||s.parts[0].operation?.type!=="PatternRemoval")return null;let i=s.parts[0],a=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!a)return null;let o=a[1],l=a[2]==="*",c=i.operation,u=oe(e,o),f=u.map(([,d])=>d);if(u.length===0){let d=e.state.env.get(o);d!==void 0&&f.push(d)}if(f.length===0)return{values:[],quoted:!0};let p="",h=e.state.shoptOptions.extglob;if(c.pattern)for(let d of c.pattern.parts)if(d.type==="Glob")p+=me(d.pattern,c.greedy,h);else if(d.type==="Literal")p+=me(d.value,c.greedy,h);else if(d.type==="SingleQuoted"||d.type==="Escaped")p+=xe(d.value);else if(d.type==="DoubleQuoted"){let g=await n(e,d.parts);p+=xe(g)}else if(d.type==="ParameterExpansion"){let g=await r(e,d);p+=me(g,c.greedy,h)}else{let g=await r(e,d);p+=xe(g)}let m=[];for(let d of f)m.push($n(d,p,c.side,c.greedy));if(l){let d=fe(e.state.env);return{values:[m.join(d)],quoted:!0}}return{values:m,quoted:!0}}var I2=I(()=>{"use strict";Me();jt();qr();Zr();fr();Lt()});async function $2(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion"||n.parts[0].operation?.type!=="DefaultValue"&&n.parts[0].operation?.type!=="UseAlternative"&&n.parts[0].operation?.type!=="AssignDefault")return null;let r=n.parts[0],s=r.operation,i=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/),a,o=!1;if(i){let l=i[1];o=i[2]==="*";let c=oe(e,l),u=c.length>0||e.state.env.has(l),f=c.length===0||c.length===1&&c.every(([,h])=>h===""),p=s.checkEmpty??!1;if(s.type==="UseAlternative"?a=u&&!(p&&f):a=!u||p&&f,!a){if(c.length>0){let m=c.map(([,d])=>d);if(o){let d=fe(e.state.env);return{values:[m.join(d)],quoted:!0}}return{values:m,quoted:!0}}let h=e.state.env.get(l);return h!==void 0?{values:[h],quoted:!0}:{values:[],quoted:!0}}}else{let l=r.parameter,c=await bn(e,l),u=await Se(e,l),f=u==="",p=s.checkEmpty??!1;if(s.type==="UseAlternative"?a=c&&!(p&&f):a=!c||p&&f,!a)return{values:[u],quoted:!0}}if(a&&s.word){let l=s.word.parts,c=null,u=!1;for(let f of l)if(f.type==="ParameterExpansion"&&!f.operation){let p=f.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(p){c=p[1],u=p[2]==="*";break}}if(c){let f=oe(e,c);if(f.length>0){let h=f.map(([,m])=>m);if(u||o){let m=fe(e.state.env);return{values:[h.join(m)],quoted:!0}}return{values:h,quoted:!0}}let p=e.state.env.get(c);return p!==void 0?{values:[p],quoted:!0}:{values:[],quoted:!0}}}return null}async function O2(e,t,n,r,s){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0],a=-1,o="",l=!1,c=null;for(let d=0;d<i.parts.length;d++){let g=i.parts[d];if(g.type==="ParameterExpansion"&&(g.operation?.type==="PatternRemoval"||g.operation?.type==="PatternReplacement")){let w=g.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(w){a=d,o=w[1],l=w[2]==="*",c=g.operation;break}}}if(a===-1||a===0&&a===i.parts.length-1)return null;let u="";for(let d=0;d<a;d++)u+=await r(e,i.parts[d]);let f="";for(let d=a+1;d<i.parts.length;d++)f+=await r(e,i.parts[d]);let p=oe(e,o),h=p.map(([,d])=>d);if(p.length===0){let d=e.state.env.get(o);if(d!==void 0)h=[d];else{if(l)return{values:[u+f],quoted:!0};let g=u+f;return{values:g?[g]:[],quoted:!0}}}if(c?.type==="PatternRemoval"){let d=c,g="",w=e.state.shoptOptions.extglob;if(d.pattern)for(let y of d.pattern.parts)if(y.type==="Glob")g+=me(y.pattern,d.greedy,w);else if(y.type==="Literal")g+=me(y.value,d.greedy,w);else if(y.type==="SingleQuoted"||y.type==="Escaped")g+=xe(y.value);else if(y.type==="DoubleQuoted"){let b=await s(e,y.parts);g+=xe(b)}else if(y.type==="ParameterExpansion"){let b=await r(e,y);g+=me(b,d.greedy,w)}else{let b=await r(e,y);g+=xe(b)}h=h.map(y=>$n(y,g,d.side,d.greedy))}else if(c?.type==="PatternReplacement"){let d=c,g="";if(d.pattern)for(let b of d.pattern.parts)if(b.type==="Glob")g+=me(b.pattern,!0,e.state.shoptOptions.extglob);else if(b.type==="Literal")g+=me(b.value,!0,e.state.shoptOptions.extglob);else if(b.type==="SingleQuoted"||b.type==="Escaped")g+=xe(b.value);else if(b.type==="DoubleQuoted"){let x=await s(e,b.parts);g+=xe(x)}else if(b.type==="ParameterExpansion"){let x=await r(e,b);g+=me(x,!0,e.state.shoptOptions.extglob)}else{let x=await r(e,b);g+=xe(x)}let w=d.replacement?await s(e,d.replacement.parts):"",y=g;d.anchor==="start"?y=`^${g}`:d.anchor==="end"&&(y=`${g}$`);try{let b=V(y,d.all?"g":"");h=h.map(x=>b.replace(x,w))}catch{}}if(l){let d=fe(e.state.env);return{values:[u+h.join(d)+f],quoted:!0}}return h.length===1?{values:[u+h[0]+f],quoted:!0}:{values:[u+h[0],...h.slice(1,-1),h[h.length-1]+f],quoted:!0}}async function R2(e,t,n,r){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,a="",o=!1;for(let h=0;h<s.parts.length;h++){let m=s.parts[h];if(m.type==="ParameterExpansion"&&!m.operation){let d=m.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(d){i=h,a=d[1],o=d[2]==="*";break}}}if(i===-1)return null;let l="";for(let h=0;h<i;h++)l+=await r(e,s.parts[h]);let c="";for(let h=i+1;h<s.parts.length;h++)c+=await r(e,s.parts[h]);let u=oe(e,a),f=u.map(([,h])=>h);if(u.length===0){let h=e.state.env.get(a);if(h!==void 0)return{values:[l+h+c],quoted:!0};if(o)return{values:[l+c],quoted:!0};let m=l+c;return{values:m?[m]:[],quoted:!0}}if(o){let h=fe(e.state.env);return{values:[l+f.join(h)+c],quoted:!0}}return f.length===1?{values:[l+f[0]+c],quoted:!0}:{values:[l+f[0],...f.slice(1,-1),f[f.length-1]+c],quoted:!0}}var T2=I(()=>{"use strict";Me();jt();qr();Zr();fr();Lt()});async function P2(e,t,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!=="ParameterExpansion"||r.parts[0].operation?.type!=="Substring")return null;let s=r.parts[0],i=s.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!i)return null;let a=i[1],o=i[2]==="*",l=s.operation;if(e.state.associativeArrays?.has(a))throw new pe(1,"",`bash: \${${a}[@]: 0: 3}: bad substitution
783
+ `);let c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=oe(e,a),p=0;if(c<0){if(f.length>0){let m=f[f.length-1][0],g=(typeof m=="number"?m:0)+1+c;if(g<0)return{values:[],quoted:!0};p=f.findIndex(([w])=>typeof w=="number"&&w>=g),p<0&&(p=f.length)}}else p=f.findIndex(([m])=>typeof m=="number"&&m>=c),p<0&&(p=f.length);let h;if(u!==void 0){if(u<0)throw new Oe(`${a}[@]: substring expression < 0`);h=f.slice(p,p+u).map(([,m])=>m)}else h=f.slice(p).map(([,m])=>m);if(h.length===0)return{values:[],quoted:!0};if(o){let m=fe(e.state.env);return{values:[h.join(m)],quoted:!0}}return{values:h,quoted:!0}}function D2(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion"||n.parts[0].operation?.type!=="Transform")return null;let r=n.parts[0],s=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let i=s[1],a=s[2]==="*",o=r.operation,l=oe(e,i);if(l.length===0){let f=e.state.env.get(i);if(f!==void 0){let p;switch(o.operator){case"a":p="";break;case"P":p=Ts(e,f);break;case"Q":p=Bn(f);break;default:p=f}return{values:[p],quoted:!0}}return a?{values:[""],quoted:!0}:{values:[],quoted:!0}}let c=zn(e,i),u;switch(o.operator){case"a":u=l.map(()=>c);break;case"P":u=l.map(([,f])=>Ts(e,f));break;case"Q":u=l.map(([,f])=>Bn(f));break;case"u":u=l.map(([,f])=>f.charAt(0).toUpperCase()+f.slice(1));break;case"U":u=l.map(([,f])=>f.toUpperCase());break;case"L":u=l.map(([,f])=>f.toLowerCase());break;default:u=l.map(([,f])=>f)}if(a){let f=fe(e.state.env);return{values:[u.join(f)],quoted:!0}}return{values:u,quoted:!0}}var _2=I(()=>{"use strict";ye();jt();fc();pc();Lt();ia()});function L2(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion")return null;let r=n.parts[0];if(r.operation)return null;let s=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!s)return null;let i=s[1];if(Te(e,i)){let l=ur(e,i);if(l?.endsWith("[@]")||l?.endsWith("[*]"))return{values:[],quoted:!0}}let a=oe(e,i);if(a.length>0)return{values:a.map(([,l])=>l),quoted:!0};let o=e.state.env.get(i);return o!==void 0?{values:[o],quoted:!0}:{values:[],quoted:!0}}function F2(e,t){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!=="ParameterExpansion"||n.parts[0].operation)return null;let s=n.parts[0].parameter;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)||!Te(e,s))return null;let i=ur(e,s);if(!i)return null;let a=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!a)return null;let o=a[1],l=oe(e,o);if(l.length>0)return{values:l.map(([,u])=>u),quoted:!0};let c=e.state.env.get(o);return c!==void 0?{values:[c],quoted:!0}:{values:[],quoted:!0}}var M2=I(()=>{"use strict";an();Lt()});async function U2(e,t,n,r,s){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0];if(i.parts.length!==1||i.parts[0].type!=="ParameterExpansion"||i.parts[0].operation?.type!=="Indirection")return null;let a=i.parts[0],o=a.operation,l=await Se(e,a.parameter),c=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c){if(!o.innerOp&&(l==="@"||l==="*")){let m=Number.parseInt(e.state.env.get("#")||"0",10),d=[];for(let g=1;g<=m;g++)d.push(e.state.env.get(String(g))||"");return l==="*"?{values:[d.join(fe(e.state.env))],quoted:!0}:{values:d,quoted:!0}}return null}let u=c[1],f=c[2]==="*",p=oe(e,u);if(o.innerOp){if(o.innerOp.type==="Substring")return Ox(e,p,u,f,o.innerOp);if(o.innerOp.type==="DefaultValue"||o.innerOp.type==="UseAlternative"||o.innerOp.type==="AssignDefault"||o.innerOp.type==="ErrorIfUnset")return Rx(e,p,u,f,o.innerOp,s);if(o.innerOp.type==="Transform"&&o.innerOp.operator==="a"){let d=zn(e,u),g=p.map(()=>d);return f?{values:[g.join(fe(e.state.env))],quoted:!0}:{values:g,quoted:!0}}let m=[];for(let[,d]of p){let g={type:"ParameterExpansion",parameter:"_indirect_elem_",operation:o.innerOp},w=e.state.env.get("_indirect_elem_");e.state.env.set("_indirect_elem_",d);try{let y=await r(e,g,!0);m.push(y)}finally{w!==void 0?e.state.env.set("_indirect_elem_",w):e.state.env.delete("_indirect_elem_")}}return f?{values:[m.join(fe(e.state.env))],quoted:!0}:{values:m,quoted:!0}}if(p.length>0){let m=p.map(([,d])=>d);return f?{values:[m.join(fe(e.state.env))],quoted:!0}:{values:m,quoted:!0}}let h=e.state.env.get(u);return h!==void 0?{values:[h],quoted:!0}:{values:[],quoted:!0}}async function Ox(e,t,n,r,s){let i=s.offset?await ne(e,s.offset.expression):0,a=s.length?await ne(e,s.length.expression):void 0,o=0;if(i<0){if(t.length>0){let u=t[t.length-1][0],p=(typeof u=="number"?u:0)+1+i;if(p<0)return{values:[],quoted:!0};if(o=t.findIndex(([h])=>typeof h=="number"&&h>=p),o<0)return{values:[],quoted:!0}}}else if(o=t.findIndex(([u])=>typeof u=="number"&&u>=i),o<0)return{values:[],quoted:!0};let l;if(a!==void 0){if(a<0)throw new Oe(`${n}[@]: substring expression < 0`);l=t.slice(o,o+a)}else l=t.slice(o);let c=l.map(([,u])=>u);return r?{values:[c.join(fe(e.state.env))],quoted:!0}:{values:c,quoted:!0}}async function Rx(e,t,n,r,s,i){let a=s.checkEmpty??!1,o=t.map(([,u])=>u),l=t.length===0,c=t.length===0;if(s.type==="UseAlternative")return!c&&!(a&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:{values:[],quoted:!0};if(s.type==="DefaultValue")return(c||a&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:r?{values:[o.join(fe(e.state.env))],quoted:!0}:{values:o,quoted:!0};if(s.type==="AssignDefault"){if((c||a&&l)&&s.word){let f=await i(e,s.word.parts,!0);return e.state.env.set(`${n}_0`,f),e.state.env.set(`${n}__length`,"1"),{values:[f],quoted:!0}}return r?{values:[o.join(fe(e.state.env))],quoted:!0}:{values:o,quoted:!0}}return r?{values:[o.join(fe(e.state.env))],quoted:!0}:{values:o,quoted:!0}}async function B2(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="UseAlternative"&&t[0].operation?.type!=="DefaultValue")return null;let n=t[0],r=n.operation,s=r?.word;if(!s||s.parts.length!==1||s.parts[0].type!=="DoubleQuoted")return null;let i=s.parts[0];if(i.parts.length!==1||i.parts[0].type!=="ParameterExpansion"||i.parts[0].operation?.type!=="Indirection")return null;let a=i.parts[0],l=(await Se(e,a.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!l)return null;let c=await bn(e,n.parameter),u=await Se(e,n.parameter)==="",f=r.checkEmpty??!1,p;if(r.type==="UseAlternative"?p=c&&!(f&&u):p=!c||f&&u,p){let h=l[1],m=l[2]==="*",d=oe(e,h);if(d.length>0){let w=d.map(([,y])=>y);return m?{values:[w.join(fe(e.state.env))],quoted:!0}:{values:w,quoted:!0}}let g=e.state.env.get(h);return g!==void 0?{values:[g],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}async function W2(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="Indirection")return null;let n=t[0],s=n.operation.innerOp;if(!s||s.type!=="UseAlternative"&&s.type!=="DefaultValue")return null;let i=s.word;if(!i||i.parts.length!==1||i.parts[0].type!=="DoubleQuoted")return null;let a=i.parts[0];if(a.parts.length!==1||a.parts[0].type!=="ParameterExpansion"||a.parts[0].operation?.type!=="Indirection")return null;let o=a.parts[0],c=(await Se(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c)return null;let u=await Se(e,n.parameter),f=await bn(e,n.parameter),p=u==="",h=s.checkEmpty??!1,m;if(s.type==="UseAlternative"?m=f&&!(h&&p):m=!f||h&&p,m){let d=c[1],g=c[2]==="*",w=oe(e,d);if(w.length>0){let b=w.map(([,x])=>x);return g?{values:[b.join(fe(e.state.env))],quoted:!0}:{values:b,quoted:!0}}let y=e.state.env.get(d);return y!==void 0?{values:[y],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}var z2=I(()=>{"use strict";Ct();ye();jt();Lt();ia()});function H2(e){let t=Number.parseInt(e.state.env.get("#")||"0",10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||"");return n}async function j2(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,a=!1;for(let y=0;y<s.parts.length;y++){let b=s.parts[y];if(b.type==="ParameterExpansion"&&(b.parameter==="@"||b.parameter==="*")&&b.operation?.type==="Substring"){i=y,a=b.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=Number.parseInt(e.state.env.get("#")||"0",10),p=[];for(let y=1;y<=f;y++)p.push(e.state.env.get(String(y))||"");let h=e.state.env.get("0")||"bash",m;if(c<=0){let y=[h,...p],b=y.length+c;if(b<0)m=[];else{let x=c<0?b:0;if(u!==void 0){let S=u<0?y.length+u:x+u;m=y.slice(x,Math.max(x,S))}else m=y.slice(x)}}else{let y=c-1;if(y>=p.length)m=[];else if(u!==void 0){let b=u<0?p.length+u:y+u;m=p.slice(y,Math.max(y,b))}else m=p.slice(y)}let d="";for(let y=0;y<i;y++)d+=await r(e,s.parts[y]);let g="";for(let y=i+1;y<s.parts.length;y++)g+=await r(e,s.parts[y]);if(m.length===0){let y=d+g;return{values:y?[y]:[],quoted:!0}}if(a){let y=fe(e.state.env);return{values:[d+m.join(y)+g],quoted:!0}}return m.length===1?{values:[d+m[0]+g],quoted:!0}:{values:[d+m[0],...m.slice(1,-1),m[m.length-1]+g],quoted:!0}}async function G2(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,a=!1;for(let w=0;w<s.parts.length;w++){let y=s.parts[w];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="PatternReplacement"){i=w,a=y.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=H2(e),u="";for(let w=0;w<i;w++)u+=await n(e,s.parts[w]);let f="";for(let w=i+1;w<s.parts.length;w++)f+=await n(e,s.parts[w]);if(c.length===0){let w=u+f;return{values:w?[w]:[],quoted:!0}}let p="";if(l.pattern)for(let w of l.pattern.parts)if(w.type==="Glob")p+=me(w.pattern,!0,e.state.shoptOptions.extglob);else if(w.type==="Literal")p+=me(w.value,!0,e.state.shoptOptions.extglob);else if(w.type==="SingleQuoted"||w.type==="Escaped")p+=xe(w.value);else if(w.type==="DoubleQuoted"){let y=await r(e,w.parts);p+=xe(y)}else if(w.type==="ParameterExpansion"){let y=await n(e,w);p+=me(y,!0,e.state.shoptOptions.extglob)}else{let y=await n(e,w);p+=xe(y)}let h=l.replacement?await r(e,l.replacement.parts):"",m=p;l.anchor==="start"?m=`^${p}`:l.anchor==="end"&&(m=`${p}$`);let d=[];try{let w=V(m,l.all?"g":"");for(let y of c)d.push(w.replace(y,h))}catch{d.push(...c)}if(a){let w=fe(e.state.env);return{values:[u+d.join(w)+f],quoted:!0}}return d.length===1?{values:[u+d[0]+f],quoted:!0}:{values:[u+d[0],...d.slice(1,-1),d[d.length-1]+f],quoted:!0}}async function V2(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,a=!1;for(let g=0;g<s.parts.length;g++){let w=s.parts[g];if(w.type==="ParameterExpansion"&&(w.parameter==="@"||w.parameter==="*")&&w.operation?.type==="PatternRemoval"){i=g,a=w.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=H2(e),u="";for(let g=0;g<i;g++)u+=await n(e,s.parts[g]);let f="";for(let g=i+1;g<s.parts.length;g++)f+=await n(e,s.parts[g]);if(c.length===0){let g=u+f;return{values:g?[g]:[],quoted:!0}}let p="",h=e.state.shoptOptions.extglob;if(l.pattern)for(let g of l.pattern.parts)if(g.type==="Glob")p+=me(g.pattern,l.greedy,h);else if(g.type==="Literal")p+=me(g.value,l.greedy,h);else if(g.type==="SingleQuoted"||g.type==="Escaped")p+=xe(g.value);else if(g.type==="DoubleQuoted"){let w=await r(e,g.parts);p+=xe(w)}else if(g.type==="ParameterExpansion"){let w=await n(e,g);p+=me(w,l.greedy,h)}else{let w=await n(e,g);p+=xe(w)}let m=[];for(let g of c)m.push($n(g,p,l.side,l.greedy));if(a){let g=fe(e.state.env);return{values:[u+m.join(g)+f],quoted:!0}}return m.length===1?{values:[u+m[0]+f],quoted:!0}:{values:[u+m[0],...m.slice(1,-1),m[m.length-1]+f],quoted:!0}}async function q2(e,t,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0],s=-1,i=!1;for(let p=0;p<r.parts.length;p++){let h=r.parts[p];if(h.type==="ParameterExpansion"&&(h.parameter==="@"||h.parameter==="*")){s=p,i=h.parameter==="*";break}}if(s===-1)return null;let a=r.parts[s];if(a.type==="ParameterExpansion"&&a.operation)return null;let o=Number.parseInt(e.state.env.get("#")||"0",10),l="";for(let p=0;p<s;p++)l+=await n(e,r.parts[p]);let c="";for(let p=s+1;p<r.parts.length;p++)c+=await n(e,r.parts[p]);if(o===0){if(i)return{values:[l+c],quoted:!0};let p=l+c;return{values:p?[p]:[],quoted:!0}}let u=[];for(let p=1;p<=o;p++)u.push(e.state.env.get(String(p))||"");if(i){let p=fe(e.state.env);return{values:[l+u.join(p)+c],quoted:!0}}return u.length===1?{values:[l+u[0]+c],quoted:!0}:{values:[l+u[0],...u.slice(1,-1),u[u.length-1]+c],quoted:!0}}var Z2=I(()=>{"use strict";Me();jt();qr();Zr();fr()});function Tx(e){return new Un(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations})}async function oa(e,t){if(e.state.options.noglob)return t;let n=Tx(e),r=[];for(let s of t)if(xn(s,e.state.shoptOptions.extglob)){let i=await n.expand(s);if(i.length>0)r.push(...i);else{if(n.hasFailglob())throw new fn(s);n.hasNullglob()||r.push(s)}}else r.push(s);return r}async function K2(e,t,n,r){let s=-1,i="",a=!1;for(let y=0;y<t.length;y++){let b=t[y];if(b.type==="ParameterExpansion"&&b.operation?.type==="PatternReplacement"){let x=b.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(x){s=y,i=x[1],a=x[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=oe(e,i),u=c.map(([,y])=>y);if(c.length===0){let y=e.state.env.get(i);y!==void 0&&(u=[y])}if(u.length===0)return{values:[],quoted:!1};let f="";if(l.pattern)for(let y of l.pattern.parts)if(y.type==="Glob")f+=me(y.pattern,!0,e.state.shoptOptions.extglob);else if(y.type==="Literal")f+=me(y.value,!0,e.state.shoptOptions.extglob);else if(y.type==="SingleQuoted"||y.type==="Escaped")f+=xe(y.value);else if(y.type==="DoubleQuoted"){let b=await n(e,y.parts);f+=xe(b)}else if(y.type==="ParameterExpansion"){let b=await r(e,y);f+=me(b,!0,e.state.shoptOptions.extglob)}else{let b=await r(e,y);f+=xe(b)}let p=l.replacement?await n(e,l.replacement.parts):"",h=f;l.anchor==="start"?h=`^${f}`:l.anchor==="end"&&(h=`${f}$`);let m=[];try{let y=V(h,l.all?"g":"");for(let b of u)m.push(y.replace(b,p))}catch{m.push(...u)}let d=rt(e.state.env),g=pt(e.state.env);if(a){let y=fe(e.state.env),b=m.join(y);return g?{values:b?[b]:[],quoted:!1}:{values:_e(b,d),quoted:!1}}if(g)return{values:m,quoted:!1};let w=[];for(let y of m)y===""?w.push(""):w.push(..._e(y,d));return{values:w,quoted:!1}}async function Q2(e,t,n,r){let s=-1,i="",a=!1;for(let w=0;w<t.length;w++){let y=t[w];if(y.type==="ParameterExpansion"&&y.operation?.type==="PatternRemoval"){let b=y.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(b){s=w,i=b[1],a=b[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=oe(e,i),u=c.map(([,w])=>w);if(c.length===0){let w=e.state.env.get(i);w!==void 0&&(u=[w])}if(u.length===0)return{values:[],quoted:!1};let f="",p=e.state.shoptOptions.extglob;if(l.pattern)for(let w of l.pattern.parts)if(w.type==="Glob")f+=me(w.pattern,l.greedy,p);else if(w.type==="Literal")f+=me(w.value,l.greedy,p);else if(w.type==="SingleQuoted"||w.type==="Escaped")f+=xe(w.value);else if(w.type==="DoubleQuoted"){let y=await n(e,w.parts);f+=xe(y)}else if(w.type==="ParameterExpansion"){let y=await r(e,w);f+=me(y,l.greedy,p)}else{let y=await r(e,w);f+=xe(y)}let h=[];for(let w of u)h.push($n(w,f,l.side,l.greedy));let m=rt(e.state.env),d=pt(e.state.env);if(a){let w=fe(e.state.env),y=h.join(w);return d?{values:y?[y]:[],quoted:!1}:{values:_e(y,m),quoted:!1}}if(d)return{values:h,quoted:!1};let g=[];for(let w of h)w===""?g.push(""):g.push(..._e(w,m));return{values:g,quoted:!1}}async function X2(e,t,n,r){let s=-1,i=!1;for(let g=0;g<t.length;g++){let w=t[g];if(w.type==="ParameterExpansion"&&(w.parameter==="@"||w.parameter==="*")&&w.operation?.type==="PatternRemoval"){s=g,i=w.parameter==="*";break}}if(s===-1)return null;let o=t[s].operation,l=Number.parseInt(e.state.env.get("#")||"0",10),c=[];for(let g=1;g<=l;g++)c.push(e.state.env.get(String(g))||"");if(c.length===0)return{values:[],quoted:!1};let u="",f=e.state.shoptOptions.extglob;if(o.pattern)for(let g of o.pattern.parts)if(g.type==="Glob")u+=me(g.pattern,o.greedy,f);else if(g.type==="Literal")u+=me(g.value,o.greedy,f);else if(g.type==="SingleQuoted"||g.type==="Escaped")u+=xe(g.value);else if(g.type==="DoubleQuoted"){let w=await n(e,g.parts);u+=xe(w)}else if(g.type==="ParameterExpansion"){let w=await r(e,g);u+=me(w,o.greedy,f)}else{let w=await r(e,g);u+=xe(w)}let p=[];for(let g of c)p.push($n(g,u,o.side,o.greedy));let h=rt(e.state.env),m=pt(e.state.env);if(i){let g=fe(e.state.env),w=p.join(g);return m?{values:w?[w]:[],quoted:!1}:{values:_e(w,h),quoted:!1}}if(m)return{values:p,quoted:!1};let d=[];for(let g of p)g===""?d.push(""):d.push(..._e(g,h));return{values:d,quoted:!1}}async function Y2(e,t,n,r){let s=-1,i=!1;for(let b=0;b<t.length;b++){let x=t[b];if(x.type==="ParameterExpansion"&&(x.parameter==="@"||x.parameter==="*")&&x.operation?.type==="Substring"){s=b,i=x.parameter==="*";break}}if(s===-1)return null;let o=t[s].operation,l=o.offset?await n(e,o.offset.expression):0,c=o.length?await n(e,o.length.expression):void 0,u=Number.parseInt(e.state.env.get("#")||"0",10),f=[];for(let b=1;b<=u;b++)f.push(e.state.env.get(String(b))||"");let p=e.state.env.get("0")||"bash",h;if(l<=0){let b=[p,...f],x=b.length+l;if(x<0)h=[];else{let S=l<0?x:0;if(c!==void 0){let $=c<0?b.length+c:S+c;h=b.slice(S,Math.max(S,$))}else h=b.slice(S)}}else{let b=l-1;if(b>=f.length)h=[];else if(c!==void 0){let x=c<0?f.length+c:b+c;h=f.slice(b,Math.max(b,x))}else h=f.slice(b)}let m="";for(let b=0;b<s;b++)m+=await r(e,t[b]);let d="";for(let b=s+1;b<t.length;b++)d+=await r(e,t[b]);let g=rt(e.state.env),w=pt(e.state.env);if(h.length===0){let b=m+d;return b?w?{values:[b],quoted:!1}:{values:_e(b,g),quoted:!1}:{values:[],quoted:!1}}let y;if(i){let b=fe(e.state.env),x=m+h.join(b)+d;w?y=x?[x]:[]:y=_e(x,g)}else if(w)h.length===1?y=[m+h[0]+d]:y=[m+h[0],...h.slice(1,-1),h[h.length-1]+d];else{y=[];for(let b=0;b<h.length;b++){let x=h[b];if(b===0&&(x=m+x),b===h.length-1&&(x=x+d),x==="")y.push("");else{let S=_e(x,g);y.push(...S)}}}return{values:await oa(e,y),quoted:!1}}async function J2(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].parameter!=="@"&&t[0].parameter!=="*"||t[0].operation)return null;let n=t[0].parameter==="*",r=Number.parseInt(e.state.env.get("#")||"0",10);if(r===0)return{values:[],quoted:!1};let s=[];for(let c=1;c<=r;c++)s.push(e.state.env.get(String(c))||"");let i=rt(e.state.env),a=pt(e.state.env),o=ea(e.state.env),l;if(n)if(a)l=s.filter(c=>c!=="");else{let c=fe(e.state.env),u=s.join(c);l=_e(u,i)}else if(a)l=s.filter(c=>c!=="");else if(o){l=[];for(let c of s){if(c==="")continue;let u=_e(c,i);l.push(...u)}}else{l=[];for(let c of s)if(c==="")l.push("");else{let u=_e(c,i);l.push(...u)}for(;l.length>0&&l[l.length-1]==="";)l.pop()}return{values:await oa(e,l),quoted:!1}}async function eg(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation)return null;let n=t[0].parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!n)return null;let r=n[1],s=n[2]==="*",i=oe(e,r),a;if(i.length===0){let f=e.state.env.get(r);if(f!==void 0)a=[f];else return{values:[],quoted:!1}}else a=i.map(([,f])=>f);let o=rt(e.state.env),l=pt(e.state.env),c=ea(e.state.env),u;if(s)if(l)u=a.filter(f=>f!=="");else{let f=fe(e.state.env),p=a.join(f);u=_e(p,o)}else if(l)u=a.filter(f=>f!=="");else if(c){u=[];for(let f of a){if(f==="")continue;let p=_e(f,o);u.push(...p)}}else{u=[];for(let f of a)if(f==="")u.push("");else{let p=_e(f,o);u.push(...p)}for(;u.length>0&&u[u.length-1]==="";)u.pop()}return{values:await oa(e,u),quoted:!1}}function tg(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="VarNamePrefix")return null;let n=t[0].operation,r=Kr(e,n.prefix);if(r.length===0)return{values:[],quoted:!1};let s=rt(e.state.env),i=pt(e.state.env),a;if(n.star)if(i)a=r;else{let o=fe(e.state.env),l=r.join(o);a=_e(l,s)}else if(i)a=r;else{a=[];for(let o of r){let l=_e(o,s);a.push(...l)}}return{values:a,quoted:!1}}function ng(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="ArrayKeys")return null;let n=t[0].operation,s=oe(e,n.array).map(([l])=>String(l));if(s.length===0)return{values:[],quoted:!1};let i=rt(e.state.env),a=pt(e.state.env),o;if(n.star)if(a)o=s;else{let l=fe(e.state.env),c=s.join(l);o=_e(c,i)}else if(a)o=s;else{o=[];for(let l of s){let c=_e(l,i);o.push(...c)}}return{values:o,quoted:!1}}async function rg(e,t,n){let r=-1;for(let p=0;p<t.length;p++){let h=t[p];if(h.type==="ParameterExpansion"&&(h.parameter==="@"||h.parameter==="*")&&!h.operation){r=p;break}}if(r===-1||t.length<=1)return null;let s=Number.parseInt(e.state.env.get("#")||"0",10),i=[];for(let p=1;p<=s;p++)i.push(e.state.env.get(String(p))||"");let a="";for(let p=0;p<r;p++)a+=await n(e,t[p]);let o="";for(let p=r+1;p<t.length;p++)o+=await n(e,t[p]);let l=rt(e.state.env),c=pt(e.state.env),u=ea(e.state.env);if(s===0){let p=a+o;return{values:p?[p]:[],quoted:!1}}let f;{let p=[];for(let h=0;h<i.length;h++){let m=i[h];h===0&&(m=a+m),h===i.length-1&&(m=m+o),p.push(m)}if(c)f=p.filter(h=>h!=="");else if(u){f=[];for(let h of p){if(h==="")continue;let m=_e(h,l);f.push(...m)}}else{f=[];for(let h of p)if(h==="")f.push("");else{let m=_e(h,l);f.push(...m)}for(;f.length>0&&f[f.length-1]==="";)f.pop()}}return f.length===0?{values:[],quoted:!1}:{values:await oa(e,f),quoted:!1}}var sg=I(()=>{"use strict";Me();Xi();ye();jt();qr();Vr();Zr();fr();Lt()});async function og(e,t,n){e.coverage?.hit("bash:expansion:word_glob");let r=t.parts,{hasQuoted:s,hasCommandSub:i,hasArrayVar:a,hasArrayAtExpansion:o,hasParamExpansion:l,hasVarNamePrefixExpansion:c,hasIndirection:u}=Rs(r),p=n.hasBraceExpansion(r)?await n.expandWordWithBracesAsync(e,t):null;if(p&&p.length>1)return Px(e,p,s);let h=await Dx(e,r,o,c,u,n);if(h!==null)return h;let m=await Lx(e,r,n);if(m!==null)return m;let d=await Fx(e,r,n);if(d!==null)return d;let g=await Ux(e,r,n.expandPart);if(g!==null)return ag(e,g);if((i||a||l)&&!pt(e.state.env)){let y=rt(e.state.env),b=n.buildIfsCharClassPattern(y),x=await n.smartWordSplit(e,r,y,b,n.expandPart);return ag(e,x)}let w=await n.expandWordAsync(e,t);return Bx(e,t,r,w,s,n.expandWordForGlobbing)}async function Px(e,t,n){let r=[];for(let s of t)if(!(!n&&s===""))if(!n&&!e.state.options.noglob&&xn(s,e.state.shoptOptions.extglob)){let i=await la(e,s);r.push(...i)}else r.push(s);return{values:r,quoted:!1}}async function Dx(e,t,n,r,s,i){if(n){let a=L2(e,t);if(a!==null)return a}{let a=F2(e,t);if(a!==null)return a}{let a=await $2(e,t);if(a!==null)return a}{let a=await O2(e,t,n,i.expandPart,i.expandWordPartsAsync);if(a!==null)return a}{let a=await R2(e,t,n,i.expandPart);if(a!==null)return a}{let a=await P2(e,t,i.evaluateArithmetic);if(a!==null)return a}{let a=D2(e,t);if(a!==null)return a}{let a=await v2(e,t,i.expandWordPartsAsync,i.expandPart);if(a!==null)return a}{let a=await k2(e,t,i.expandWordPartsAsync,i.expandPart);if(a!==null)return a}if(r&&t.length===1&&t[0].type==="DoubleQuoted"){let a=_x(e,t);if(a!==null)return a}{let a=await U2(e,t,s,i.expandParameterAsync,i.expandWordPartsAsync);if(a!==null)return a}{let a=await B2(e,t);if(a!==null)return a}{let a=await W2(e,t);if(a!==null)return a}return null}function _x(e,t){let n=t[0];if(n.type!=="DoubleQuoted")return null;if(n.parts.length===1&&n.parts[0].type==="ParameterExpansion"&&n.parts[0].operation?.type==="VarNamePrefix"){let r=n.parts[0].operation,s=Kr(e,r.prefix);return r.star?{values:[s.join(fe(e.state.env))],quoted:!0}:{values:s,quoted:!0}}if(n.parts.length===1&&n.parts[0].type==="ParameterExpansion"&&n.parts[0].operation?.type==="ArrayKeys"){let r=n.parts[0].operation,i=oe(e,r.array).map(([a])=>String(a));return r.star?{values:[i.join(fe(e.state.env))],quoted:!0}:{values:i,quoted:!0}}return null}async function Lx(e,t,n){{let r=await j2(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await G2(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await V2(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await q2(e,t,n.expandPart);if(r!==null)return r}return null}async function Fx(e,t,n){{let r=await K2(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await Q2(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await X2(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await Y2(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await J2(e,t);if(r!==null)return r}{let r=await eg(e,t);if(r!==null)return r}{let r=tg(e,t);if(r!==null)return r}{let r=ng(e,t);if(r!==null)return r}{let r=await rg(e,t,n.expandPart);if(r!==null)return r}return null}function ig(e){if(e.type!=="DoubleQuoted")return null;for(let t=0;t<e.parts.length;t++){let n=e.parts[t];if(n.type!=="ParameterExpansion"||n.operation)continue;let r=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(r)return{type:"array",name:r[1],atIndex:t,isStar:r[2]==="*"};if(n.parameter==="@"||n.parameter==="*")return{type:"positional",atIndex:t,isStar:n.parameter==="*"}}return null}async function Mx(e,t,n,r){let s="";for(let o=0;o<n.atIndex;o++)s+=await r(e,t.parts[o]);let i="";for(let o=n.atIndex+1;o<t.parts.length;o++)i+=await r(e,t.parts[o]);let a;if(n.type==="array"){if(a=oe(e,n.name).map(([,l])=>l),a.length===0){let l=e.state.env.get(n.name);l!==void 0&&(a=[l])}}else{let o=Number.parseInt(e.state.env.get("#")||"0",10);a=[];for(let l=1;l<=o;l++)a.push(e.state.env.get(String(l))||"")}if(n.isStar){let o=fe(e.state.env),l=a.join(o);return[s+l+i]}if(a.length===0){let o=s+i;return o?[o]:[]}return a.length===1?[s+a[0]+i]:[s+a[0],...a.slice(1,-1),a[a.length-1]+i]}async function Ux(e,t,n){if(t.length<2)return null;let r=!1;for(let l of t)if(ig(l)){r=!0;break}if(!r)return null;let s=rt(e.state.env),i=pt(e.state.env),a=[];for(let l of t){let c=ig(l);if(c&&l.type==="DoubleQuoted"){let u=await Mx(e,l,c,n);a.push(u)}else if(l.type==="DoubleQuoted"||l.type==="SingleQuoted"){let u=await n(e,l);a.push([u])}else if(l.type==="Literal")a.push([l.value]);else if(l.type==="ParameterExpansion"){let u=await n(e,l);if(i)a.push(u?[u]:[]);else{let f=_e(u,s);a.push(f)}}else{let u=await n(e,l);if(i)a.push(u?[u]:[]);else{let f=_e(u,s);a.push(f)}}}let o=[];for(let l of a)if(l.length!==0)if(o.length===0)o.push(...l);else{let c=o.length-1;o[c]=o[c]+l[0];for(let u=1;u<l.length;u++)o.push(l[u])}return o}async function ag(e,t){if(e.state.options.noglob)return{values:t,quoted:!1};let n=[];for(let r of t)if(xn(r,e.state.shoptOptions.extglob)){let s=await la(e,r);n.push(...s)}else n.push(r);return{values:n,quoted:!1}}async function la(e,t){let n=new Un(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations}),r=await n.expand(t);if(r.length>0)return r;if(n.hasFailglob())throw new fn(t);return n.hasNullglob()?[]:[t]}async function Bx(e,t,n,r,s,i){let a=n.some(o=>o.type==="Glob");if(!e.state.options.noglob&&a){let o=await i(e,t);if(xn(o,e.state.shoptOptions.extglob)){let c=await la(e,o);if(c.length>0&&c[0]!==o)return{values:c,quoted:!1};if(c.length===0)return{values:[],quoted:!1}}let l=uc(r);if(!pt(e.state.env)){let c=rt(e.state.env);return{values:_e(l,c),quoted:!1}}return{values:[l],quoted:!1}}if(!s&&!e.state.options.noglob&&xn(r,e.state.shoptOptions.extglob)){let o=await i(e,t);if(xn(o,e.state.shoptOptions.extglob)){let l=await la(e,o);if(l.length>0&&l[0]!==o)return{values:l,quoted:!1}}}if(r===""&&!s)return{values:[],quoted:!1};if(a&&!s){let o=uc(r);if(!pt(e.state.env)){let l=rt(e.state.env);return{values:_e(o,l),quoted:!1}}return{values:[o],quoted:!1}}return{values:[r],quoted:s}}var lg=I(()=>{"use strict";Xi();ye();jt();Yi();I2();T2();_2();M2();Vr();z2();fr();Z2();sg();Lt()});async function ug(e,t){let n=t.operation;if(!n||n.type!=="DefaultValue"&&n.type!=="AssignDefault"&&n.type!=="UseAlternative")return null;let r=n.word;if(!r||r.parts.length===0)return null;let s=await bn(e,t.parameter),a=await Se(e,t.parameter,!1)==="",o=n.checkEmpty??!1,l;return n.type==="UseAlternative"?l=s&&!(o&&a):l=!s||o&&a,l?r.parts:null}function Wx(e){return e.type==="SingleQuoted"?!0:e.type==="DoubleQuoted"?e.parts.every(n=>n.type==="Literal"):!1}async function zx(e,t){if(t.type!=="ParameterExpansion")return null;let n=await ug(e,t);if(!n||n.length<=1)return null;let r=n.some(i=>Wx(i)),s=n.some(i=>i.type==="Literal"||i.type==="ParameterExpansion"||i.type==="CommandSubstitution"||i.type==="ArithmeticExpansion");return r&&s?n:null}function Hx(e){return e.type==="DoubleQuoted"||e.type==="SingleQuoted"||e.type==="Literal"?!1:e.type==="Glob"?rc(e.pattern):!(!(e.type==="ParameterExpansion"||e.type==="CommandSubstitution"||e.type==="ArithmeticExpansion")||e.type==="ParameterExpansion"&&qm(e))}async function fg(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:word_split"),t.length===1&&t[0].type==="ParameterExpansion"){let p=t[0],h=await ug(e,p);if(h&&h.length>0&&h.length>1&&h.some(d=>d.type==="DoubleQuoted"||d.type==="SingleQuoted")&&h.some(d=>d.type==="Literal"||d.type==="ParameterExpansion"||d.type==="CommandSubstitution"||d.type==="ArithmeticExpansion"))return cg(e,h,n,r,s)}let i=[],a=!1;for(let p of t){let h=Hx(p),m=p.type==="DoubleQuoted"||p.type==="SingleQuoted",d=h?await zx(e,p):null,g=await s(e,p);i.push({value:g,isSplittable:h,isQuoted:m,mixedDefaultParts:d??void 0}),h&&(a=!0)}if(!a){let p=i.map(h=>h.value).join("");return p?[p]:[]}let o=[],l="",c=!1,u=!1,f=!1;for(let p of i)if(!p.isSplittable)u?p.isQuoted&&p.value===""?(l!==""&&o.push(l),o.push(""),c=!0,l="",u=!1,f=!0):p.value!==""?(l!==""&&o.push(l),l=p.value,u=!1,f=!1):(l+=p.value,f=!1):(l+=p.value,f=p.isQuoted&&p.value==="");else if(p.mixedDefaultParts){let h=await cg(e,p.mixedDefaultParts,n,r,s);if(h.length!==0)if(h.length===1)l+=h[0],c=!0;else{l+=h[0],o.push(l),c=!0;for(let m=1;m<h.length-1;m++)o.push(h[m]);l=h[h.length-1]}u=!1,f=!1}else{let{words:h,hadLeadingDelimiter:m,hadTrailingDelimiter:d}=ta(p.value,n);if(f&&m&&l===""&&(o.push(""),c=!0),h.length===0)d&&(u=!0);else if(h.length===1)l+=h[0],c=!0,u=d;else{l+=h[0],o.push(l),c=!0;for(let g=1;g<h.length-1;g++)o.push(h[g]);l=h[h.length-1],u=d}f=!1}return l!==""?o.push(l):o.length===0&&c&&o.push(""),o}function jx(e,t){return e.length>0&&t.includes(e[0])}async function cg(e,t,n,r,s){let i=[];for(let u of t){let p=!(u.type==="DoubleQuoted"||u.type==="SingleQuoted"),h=await s(e,u);i.push({value:h,isSplittable:p})}let a=[],o="",l=!1,c=!1;for(let u of i)if(!u.isSplittable)c&&u.value!==""?(o!==""&&a.push(o),o=u.value,c=!1):o+=u.value;else{jx(u.value,n)&&o!==""&&(a.push(o),o="",l=!0);let{words:p,hadTrailingDelimiter:h}=ta(u.value,n);if(p.length===0)h&&(c=!0);else if(p.length===1)o+=p[0],l=!0,c=h;else{o+=p[0],a.push(o),l=!0;for(let m=1;m<p.length-1;m++)a.push(p[m]);o=p[p.length-1],c=h}}return o!==""?a.push(o):a.length===0&&l&&a.push(""),a}var pg=I(()=>{"use strict";Lt();jt();Yi()});function hg(e){switch(e.type){case"Literal":return e.value;case"SingleQuoted":return e.value;case"Escaped":return e.value;default:return null}}function dg(e){switch(e.type){case"SingleQuoted":case"Escaped":case"DoubleQuoted":return!0;case"Literal":return e.value==="";default:return!1}}var mg=I(()=>{"use strict"});var bc={};K(bc,{escapeGlobChars:()=>Ft,escapeRegexChars:()=>Gr,expandRedirectTarget:()=>Ds,expandWord:()=>ie,expandWordForPattern:()=>yc,expandWordForRegex:()=>gc,expandWordWithGlob:()=>cn,getArrayElements:()=>oe,getVariable:()=>Se,hasQuotedMultiValueAt:()=>Ps,isArray:()=>In,isWordFullyQuoted:()=>mc});function Hn(e,t,n){if(e.length>t)throw new J(`${n}: string length limit exceeded (${t} bytes)`,"string_length")}async function ln(e,t,n=!1){let r=[];for(let s of t)r.push(await Gt(e,s,n));return r.join("")}function Gx(e){return dg(e)}function mc(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!Gx(t))return!1;return!0}function Vx(e,t,n=!1){let r=hg(t);if(r!==null)return r;switch(t.type){case"TildeExpansion":return n?t.user===null?"~":`~${t.user}`:(e.coverage?.hit("bash:expansion:tilde"),t.user===null?e.state.env.get("HOME")??"/home/user":t.user==="root"?"/root":`~${t.user}`);case"Glob":return hc(e,t.pattern);default:return null}}async function ie(e,t){return wc(e,t)}async function gc(e,t){let n=[];for(let r of t.parts)if(r.type==="Escaped")n.push(`\\${r.value}`);else if(r.type==="SingleQuoted")n.push(r.value);else if(r.type==="DoubleQuoted"){let s=await ln(e,r.parts);n.push(s)}else if(r.type==="TildeExpansion"){let s=await Gt(e,r);n.push(Gr(s))}else n.push(await Gt(e,r));return n.join("")}async function yc(e,t){let n=[];for(let r of t.parts)if(r.type==="Escaped"){let s=r.value;"()|*?[]".includes(s)?n.push(`\\${s}`):n.push(s)}else if(r.type==="SingleQuoted")n.push(Ft(r.value));else if(r.type==="DoubleQuoted"){let s=await ln(e,r.parts);n.push(Ft(s))}else n.push(await Gt(e,r));return n.join("")}async function gg(e,t){let n=[];for(let r of t.parts)if(r.type==="SingleQuoted")n.push(Ft(r.value));else if(r.type==="Escaped"){let s=r.value;"*?[]\\()|".includes(s)?n.push(`\\${s}`):n.push(s)}else if(r.type==="DoubleQuoted"){let s=await ln(e,r.parts);n.push(Ft(s))}else r.type==="Glob"?x2(r.pattern)?n.push(await A2(e,r.pattern)):n.push(hc(e,r.pattern)):r.type==="Literal"?n.push(r.value):n.push(await Gt(e,r));return n.join("")}function ua(e){for(let t of e)if(t.type==="BraceExpansion"||t.type==="DoubleQuoted"&&ua(t.parts))return!0;return!1}async function yg(e,t,n={count:0}){if(n.count>dc)return[[]];let r=[[]];for(let s of t)if(s.type==="BraceExpansion"){let i=[],a=!1,o="";for(let u of s.items)if(u.type==="Range"){let f=cc(u.start,u.end,u.step,u.startStr,u.endStr);if(f.expanded)for(let p of f.expanded)n.count++,i.push(p);else{a=!0,o=f.literal;break}}else{let f=await yg(e,u.word.parts,n);for(let p of f){n.count++;let h=[];for(let m of p)typeof m=="string"?h.push(m):h.push(await Gt(e,m));i.push(h.join(""))}}if(a){for(let u of r)n.count++,u.push(o);continue}if(r.length*i.length>e.limits.maxBraceExpansionResults||n.count>dc)return r;let c=[];for(let u of r)for(let f of i){if(n.count++,n.count>dc)return c.length>0?c:r;c.push([...u,f])}r=c}else for(let i of r)n.count++,i.push(s);return r}async function wg(e,t){let n=t.parts;if(!ua(n))return[await ie(e,t)];let r=await yg(e,n),s=[];for(let i of r){let a=[];for(let o of i)typeof o=="string"?a.push(o):a.push(await Gt(e,o));s.push(C2(e,a.join("")))}return s}function qx(){return{expandWordAsync:wc,expandWordForGlobbing:gg,expandWordWithBracesAsync:wg,expandWordPartsAsync:ln,expandPart:Gt,expandParameterAsync:ca,hasBraceExpansion:ua,evaluateArithmetic:ne,buildIfsCharClassPattern:Zm,smartWordSplit:fg}}async function cn(e,t){return og(e,t,qx())}function Zx(e){for(let t of e){if(t.type==="ParameterExpansion")return t.parameter;if(t.type==="Literal")return t.value}return""}function Ps(e,t){if(Number.parseInt(e.state.env.get("#")||"0",10)<2)return!1;function r(s){for(let i of s)if(i.type==="DoubleQuoted"){for(let a of i.parts)if(a.type==="ParameterExpansion"&&a.parameter==="@"&&!a.operation)return!0}return!1}return r(t.parts)}async function Ds(e,t){if(Ps(e,t))return{error:`bash: $@: ambiguous redirect
784
784
  `};let n=t.parts,{hasQuoted:r}=Rs(n);if(ua(n)&&(await wg(e,t)).length>1)return{error:`bash: ${n.map(h=>h.type==="Literal"?h.value:h.type==="BraceExpansion"?`{${h.items.map(d=>{if(d.type==="Range"){let g=d.step?`..${d.step}`:"";return`${d.startStr??d.start}..${d.endStr??d.end}${g}`}return d.word.parts.map(g=>g.type==="Literal"?g.value:"").join("")}).join(",")}}`:"").join("")}: ambiguous redirect
785
785
  `};let s=await wc(e,t),{hasParamExpansion:i,hasCommandSub:a}=Rs(n);if((i||a)&&!r&&!pt(e.state.env)){let f=rt(e.state.env);if(_e(s,f).length>1)return{error:`bash: $${Zx(n)}: ambiguous redirect
786
786
  `}}if(r||e.state.options.noglob)return{target:s};let l=await gg(e,t);if(!xn(l,e.state.shoptOptions.extglob))return{target:s};let c=new Un(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations}),u=await c.expand(l);return u.length===0?c.hasFailglob()?{error:`bash: no match: ${s}
787
787
  `}:{target:s}:u.length===1?{target:u[0]}:{error:`bash: ${s}: ambiguous redirect
788
788
  `}}async function wc(e,t){let n=t.parts,r=n.length;if(r===1){let a=await Gt(e,n[0]);return Hn(a,e.limits.maxStringLength,"word expansion"),a}let s=[];for(let a=0;a<r;a++)s.push(await Gt(e,n[a]));let i=s.join("");return Hn(i,e.limits.maxStringLength,"word expansion"),i}async function Gt(e,t,n=!1){if(t.type==="ParameterExpansion")return ca(e,t,n);let r=Vx(e,t,n);if(r!==null)return r;switch(t.type){case"DoubleQuoted":{let s=[];for(let i of t.parts)s.push(await Gt(e,i,!0));return s.join("")}case"CommandSubstitution":{let s=r2(t.body);if(s)try{let p=await ie(e,s.target),h=p.startsWith("/")?p:`${e.state.cwd}/${p}`,m=await e.fs.readFile(h);e.state.lastExitCode=0,e.state.env.set("?","0");let d=m.replace(/\n+$/,"");return Hn(d,e.limits.maxStringLength,"command substitution"),d}catch(p){if(p instanceof J)throw p;return e.state.lastExitCode=1,e.state.env.set("?","1"),""}let i=e.substitutionDepth??0,a=e.limits.maxSubstitutionDepth;if(i>=a)throw new J(`Command substitution nesting limit exceeded (${a})`,"substitution_depth");let o=e.substitutionDepth;e.substitutionDepth=i+1;let l=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let c=new Map(e.state.env),u=e.state.cwd,f=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let p=await e.executeScript(t.body),h=p.exitCode;e.state.env=c,e.state.cwd=u,e.state.suppressVerbose=f,e.state.lastExitCode=h,e.state.env.set("?",String(h)),p.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+p.stderr),e.state.bashPid=l,e.substitutionDepth=o;let m=p.stdout.replace(/\n+$/,"");return Hn(m,e.limits.maxStringLength,"command substitution"),m}catch(p){if(e.state.env=c,e.state.cwd=u,e.state.bashPid=l,e.substitutionDepth=o,e.state.suppressVerbose=f,p instanceof J)throw p;if(p instanceof pe){e.state.lastExitCode=p.exitCode,e.state.env.set("?",String(p.exitCode)),p.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+p.stderr);let h=p.stdout.replace(/\n+$/,"");return Hn(h,e.limits.maxStringLength,"command substitution"),h}throw p}}case"ArithmeticExpansion":{let s=t.expression.originalText;if(s&&/\$[a-zA-Z_][a-zA-Z0-9_]*(?![{[(])/.test(s)){let a=await e2(e,s),o=new ce,l=Ae(o,a);return String(await ne(e,l.expression,!0))}return String(await ne(e,t.expression.expression,!0))}case"BraceExpansion":{let s=[];for(let i of t.items)if(i.type==="Range"){let a=cc(i.start,i.end,i.step,i.startStr,i.endStr);if(a.expanded)s.push(...a.expanded);else return a.literal}else s.push(await ie(e,i.word));return s.join(" ")}default:return""}}async function ca(e,t,n=!1){let{parameter:r}=t,{operation:s}=t,i=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(i){let[,p,h]=i;if(e.state.associativeArrays?.has(p)||h.includes("$(")||h.includes("`")||h.includes("${")){let d=await lc(e,h);r=`${p}[${d}]`}}else if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&Te(e,r)){let p=St(e,r);if(p&&p!==r){let h=p.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(h){let[,m,d]=h;if(e.state.associativeArrays?.has(m)||d.includes("$(")||d.includes("`")||d.includes("${")){let w=await lc(e,d);r=`${m}[${w}]`}}}}let a=s&&(s.type==="DefaultValue"||s.type==="AssignDefault"||s.type==="UseAlternative"||s.type==="ErrorIfUnset"),o=await Se(e,r,!a);if(!s)return o;let l=!await bn(e,r),{isEmpty:c,effectiveValue:u}=w2(e,r,o,n),f={value:o,isUnset:l,isEmpty:c,effectiveValue:u,inDoubleQuotes:n};switch(s.type){case"DefaultValue":return i2(e,s,f,ln);case"AssignDefault":return a2(e,r,s,f,ln);case"ErrorIfUnset":return o2(e,r,s,f,ln);case"UseAlternative":return l2(e,s,f,ln);case"PatternRemoval":{let p=await c2(e,o,s,ln,Gt);return Hn(p,e.limits.maxStringLength,"pattern removal"),p}case"PatternReplacement":{let p=await u2(e,o,s,ln,Gt);return Hn(p,e.limits.maxStringLength,"pattern replacement"),p}case"Length":return f2(e,r,o);case"LengthSliceError":throw new bt(r);case"BadSubstitution":throw new bt(s.text);case"Substring":return p2(e,r,o,s);case"CaseModification":{let p=await h2(e,o,s,ln,ca);return Hn(p,e.limits.maxStringLength,"case modification"),p}case"Transform":return d2(e,r,o,l,s);case"Indirection":return m2(e,r,o,l,s,ca,n);case"ArrayKeys":return g2(e,s);case"VarNamePrefix":return y2(e,s);default:return o}}var dc,Nt=I(()=>{"use strict";mt();Xe();Xi();Ct();ye();Yi();t2();n2();s2();Vr();b2();S2();N2();Lt();lg();pg();jt();an();mg();Vr();Lt();dc=1e5});function Kx(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":if(t===0)throw new Oe("division by 0");return Math.trunc(e/t);case"%":if(t===0)throw new Oe("division by 0");return e%t;case"**":if(t<0)throw new Oe("exponent less than 0");return e**t;case"<<":return e<<t;case">>":return e>>t;case"<":return e<t?1:0;case"<=":return e<=t?1:0;case">":return e>t?1:0;case">=":return e>=t?1:0;case"==":return e===t?1:0;case"!=":return e!==t?1:0;case"&":return e&t;case"|":return e|t;case"^":return e^t;case",":return t;default:return 0}}function bg(e,t,n){switch(n){case"=":return t;case"+=":return e+t;case"-=":return e-t;case"*=":return e*t;case"/=":return t!==0?Math.trunc(e/t):0;case"%=":return t!==0?e%t:0;case"<<=":return e<<t;case">>=":return e>>t;case"&=":return e&t;case"|=":return e|t;case"^=":return e^t;default:return t}}function Qx(e,t){switch(t){case"-":return-e;case"+":return+e;case"!":return e===0?1:0;case"~":return~e;default:return e}}async function Xx(e,t){let n=e.state.env.get(t);if(n!==void 0)return n;let r=e.state.env.get(`${t}_0`);return r!==void 0?r:await Se(e,t)}function Yx(e){if(!e)return 0;let t=Number.parseInt(e,10);if(!Number.isNaN(t)&&/^-?\d+$/.test(e.trim()))return t;let n=e.trim();if(!n)return 0;try{let r=new ce,{expr:s,pos:i}=Ht(r,n,0);if(i<n.length){let a=n.slice(i).trim().split(/\s+/)[0];throw new Oe(`${n}: syntax error in expression (error token is "${a}")`)}return s.type==="ArithNumber"?s.value:t||0}catch(r){if(r instanceof Oe)throw r;let s=n.split(/\s+/).slice(1)[0]||n;throw new Oe(`${n}: syntax error in expression (error token is "${s}")`)}}async function xc(e,t){if(!t)return 0;let n=Number.parseInt(t,10);if(!Number.isNaN(n)&&/^-?\d+$/.test(t.trim()))return n;let r=t.trim();if(!r)return 0;let s=new ce,{expr:i,pos:a}=Ht(s,r,0);if(a<r.length){let o=r.slice(a).trim(),l=o.split(/\s+/)[0]||o;throw new Oe(`syntax error in expression (error token is "${l}")`,"","")}return await ne(e,i)}async function Ec(e,t,n=new Set,r=0){if(r>100)throw new Oe("maximum variable indirection depth exceeded");if(n.has(t))return 0;n.add(t);let s=await Xx(e,t);if(!s)return 0;let i=Number.parseInt(s,10);if(!Number.isNaN(i)&&/^-?\d+$/.test(s.trim()))return i;let a=s.trim();if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a))return await Ec(e,a,n,r+1);let o=new ce,{expr:l,pos:c}=Ht(o,a,0);if(c<a.length){let u=a.slice(c).trim(),f=u.split(/\s+/)[0]||u;throw new Oe(`${a}: syntax error in expression (error token is "${f}")`)}return await ne(e,l)}async function fa(e,t){if(t.startsWith("#")){let f=t.slice(1),p=f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(p){let m=p[1],d=oe(e,m);return String(d.length)}let h=e.state.env.get(f)||"";return String(h.length)}if(t.startsWith("!")){let f=t.slice(1),p=e.state.env.get(f)||"";return e.state.env.get(p)||""}let n=[":-",":=",":?",":+","-","=","?","+"],r=-1,s="";for(let f of n){let p=t.indexOf(f);p>0&&(r===-1||p<r)&&(r=p,s=f)}if(r===-1)return await Se(e,t);let i=t.slice(0,r),a=t.slice(r+s.length),o=e.state.env.get(i),l=o===void 0,c=o==="",u=s.startsWith(":");switch(s){case":-":case"-":return l||u&&c?a:o||"";case":=":case"=":return l||u&&c?(e.state.env.set(i,a),a):o||"";case":+":case"+":return!(l||u&&c)?a:"";case":?":case"?":{if(l||u&&c)throw new Error(a||`${i}: parameter null or not set`);return o||""}default:return o||""}}async function ne(e,t,n=!1){switch(t.type){case"ArithNumber":if(Number.isNaN(t.value))throw new Oe("value too great for base");return t.value;case"ArithVariable":return await Ec(e,t.name);case"ArithSpecialVar":{let s=(await Se(e,t.name)).trim();if(!s)return 0;let i=Number.parseInt(s,10);if(!Number.isNaN(i)&&/^-?\d+$/.test(s))return i;let a=new ce,{expr:o}=Ht(a,s,0);return await ne(e,o)}case"ArithNested":return await ne(e,t.expression);case"ArithCommandSubst":{if(e.execFn){let r=await e.execFn(t.command);r.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+r.stderr);let s=r.stdout.trim();return Number.parseInt(s,10)||0}return 0}case"ArithBracedExpansion":{let r=await fa(e,t.content);return Number.parseInt(r,10)||0}case"ArithDynamicBase":{let r=await fa(e,t.baseExpr),s=Number.parseInt(r,10);if(s<2||s>64)return 0;let i=`${s}#${t.value}`;return $s(i)}case"ArithDynamicNumber":{let s=await fa(e,t.prefix)+t.suffix;return $s(s)}case"ArithArrayElement":{let r=e.state.associativeArrays?.has(t.array),s=async i=>{let a=e.state.env.get(i);return a!==void 0?await xc(e,a):0};if(t.stringKey!==void 0)return await s(`${t.array}_${t.stringKey}`);if(r&&t.index?.type==="ArithVariable"&&!t.index.hasDollarPrefix)return await s(`${t.array}_${t.index.name}`);if(r&&t.index?.type==="ArithVariable"&&t.index.hasDollarPrefix){let i=await Se(e,t.index.name);return await s(`${t.array}_${i}`)}if(t.index){let i=await ne(e,t.index,n);if(i<0){let l=oe(e,t.array),c=e.state.currentLine;if(l.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${c}: ${t.array}: bad array subscript
789
789
  `,0;let f=Math.max(...l.map(([p])=>typeof p=="number"?p:0))+1+i;if(f<0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${c}: ${t.array}: bad array subscript
790
- `,0;i=f}let a=`${t.array}_${i}`,o=e.state.env.get(a);if(o!==void 0)return xc(e,o);if(i===0){let l=e.state.env.get(t.array);if(l!==void 0)return xc(e,l)}if(e.state.options.nounset&&!Array.from(e.state.env.keys()).some(c=>c===t.array||c.startsWith(`${t.array}_`)))throw new wt(`${t.array}[${i}]`);return 0}return 0}case"ArithDoubleSubscript":throw new Oe("double subscript","","");case"ArithNumberSubscript":throw new Oe(`${t.number}${t.errorToken}: syntax error: invalid arithmetic operator (error token is "${t.errorToken}")`);case"ArithSyntaxError":throw new Oe(t.message,"","",!0);case"ArithSingleQuote":{if(n)throw new Oe(`syntax error: operand expected (error token is "'${t.content}'")`);return t.value}case"ArithBinary":{if(t.operator==="||")return await ne(e,t.left,n)||await ne(e,t.right,n)?1:0;if(t.operator==="&&")return await ne(e,t.left,n)&&await ne(e,t.right,n)?1:0;let r=await ne(e,t.left,n),s=await ne(e,t.right,n);return Kx(r,s,t.operator)}case"ArithUnary":{let r=await ne(e,t.operand,n);if(t.operator==="++"||t.operator==="--"){if(t.operand.type==="ArithVariable"){let s=t.operand.name,i=Number.parseInt(await Se(e,s),10)||0,a=t.operator==="++"?i+1:i-1;return e.state.env.set(s,String(a)),t.prefix?a:i}if(t.operand.type==="ArithArrayElement"){let s=t.operand.array,i=e.state.associativeArrays?.has(s),a;if(t.operand.stringKey!==void 0)a=`${s}_${t.operand.stringKey}`;else if(i&&t.operand.index?.type==="ArithVariable"&&!t.operand.index.hasDollarPrefix)a=`${s}_${t.operand.index.name}`;else if(i&&t.operand.index?.type==="ArithVariable"&&t.operand.index.hasDollarPrefix){let c=await Se(e,t.operand.index.name);a=`${s}_${c}`}else if(t.operand.index){let c=await ne(e,t.operand.index,n);a=`${s}_${c}`}else return r;let o=Number.parseInt(e.state.env.get(a)||"0",10)||0,l=t.operator==="++"?o+1:o-1;return e.state.env.set(a,String(l)),t.prefix?l:o}if(t.operand.type==="ArithConcat"){let s="";for(let i of t.operand.parts)s+=await Qr(e,i,n);if(s&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){let i=Number.parseInt(e.state.env.get(s)||"0",10)||0,a=t.operator==="++"?i+1:i-1;return e.state.env.set(s,String(a)),t.prefix?a:i}}if(t.operand.type==="ArithDynamicElement"){let s="";if(t.operand.nameExpr.type==="ArithConcat")for(let i of t.operand.nameExpr.parts)s+=await Qr(e,i,n);else t.operand.nameExpr.type==="ArithVariable"&&(s=t.operand.nameExpr.hasDollarPrefix?await Se(e,t.operand.nameExpr.name):t.operand.nameExpr.name);if(s&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){let i=await ne(e,t.operand.subscript,n),a=`${s}_${i}`,o=Number.parseInt(e.state.env.get(a)||"0",10)||0,l=t.operator==="++"?o+1:o-1;return e.state.env.set(a,String(l)),t.prefix?l:o}}return r}return Qx(r,t.operator)}case"ArithTernary":return await ne(e,t.condition,n)?await ne(e,t.consequent,n):await ne(e,t.alternate,n);case"ArithAssignment":{let r=t.variable,s=r;if(t.stringKey!==void 0)s=`${r}_${t.stringKey}`;else if(t.subscript){let l=e.state.associativeArrays?.has(r);if(l&&t.subscript.type==="ArithVariable"&&!t.subscript.hasDollarPrefix)s=`${r}_${t.subscript.name}`;else if(l&&t.subscript.type==="ArithVariable"&&t.subscript.hasDollarPrefix){let c=await Se(e,t.subscript.name);s=`${r}_${c||"\\"}`}else if(l){let c=await ne(e,t.subscript,n);s=`${r}_${c}`}else{let c=await ne(e,t.subscript,n);if(c<0){let u=oe(e,r);u.length>0&&(c=Math.max(...u.map(([p])=>typeof p=="number"?p:0))+1+c)}s=`${r}_${c}`}}let i=Number.parseInt(e.state.env.get(s)||"0",10)||0,a=await ne(e,t.value,n),o=bg(i,a,t.operator);return e.state.env.set(s,String(o)),o}case"ArithGroup":return await ne(e,t.expression,n);case"ArithConcat":{let r="";for(let s of t.parts)r+=await Qr(e,s,n);return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)?await Ec(e,r):Number.parseInt(r,10)||0}case"ArithDynamicAssignment":{let r="";if(t.target.type==="ArithConcat")for(let l of t.target.parts)r+=await Qr(e,l,n);else t.target.type==="ArithVariable"&&(r=t.target.hasDollarPrefix?await Se(e,t.target.name):t.target.name);if(!r||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))return 0;let s=r;if(t.subscript){let l=await ne(e,t.subscript,n);s=`${r}_${l}`}let i=Number.parseInt(e.state.env.get(s)||"0",10)||0,a=await ne(e,t.value,n),o=bg(i,a,t.operator);return e.state.env.set(s,String(o)),o}case"ArithDynamicElement":{let r="";if(t.nameExpr.type==="ArithConcat")for(let o of t.nameExpr.parts)r+=await Qr(e,o,n);else t.nameExpr.type==="ArithVariable"&&(r=t.nameExpr.hasDollarPrefix?await Se(e,t.nameExpr.name):t.nameExpr.name);if(!r||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))return 0;let s=await ne(e,t.subscript,n),i=`${r}_${s}`,a=e.state.env.get(i);return a!==void 0?Yx(a):0}default:return 0}}async function Qr(e,t,n=!1){switch(t.type){case"ArithNumber":return String(t.value);case"ArithSingleQuote":return String(await ne(e,t,n));case"ArithVariable":return t.hasDollarPrefix?await Se(e,t.name):t.name;case"ArithSpecialVar":return await Se(e,t.name);case"ArithBracedExpansion":return await fa(e,t.content);case"ArithCommandSubst":return e.execFn?(await e.execFn(t.command)).stdout.trim():"0";case"ArithConcat":{let r="";for(let s of t.parts)r+=await Qr(e,s,n);return r}default:return String(await ne(e,t,n))}}var Ct=I(()=>{"use strict";mt();Xe();ye();Nt()});var Cl=[{name:"echo",load:async()=>(await Promise.resolve().then(()=>(xu(),bu))).echoCommand},{name:"cat",load:async()=>(await Promise.resolve().then(()=>(Au(),Eu))).catCommand},{name:"printf",load:async()=>(await Promise.resolve().then(()=>(Ru(),Ou))).printfCommand},{name:"ls",load:async()=>(await Promise.resolve().then(()=>(_u(),Du))).lsCommand},{name:"mkdir",load:async()=>(await Promise.resolve().then(()=>(Fu(),Lu))).mkdirCommand},{name:"rmdir",load:async()=>(await Promise.resolve().then(()=>(Wu(),Bu))).rmdirCommand},{name:"touch",load:async()=>(await Promise.resolve().then(()=>(Hu(),zu))).touchCommand},{name:"rm",load:async()=>(await Promise.resolve().then(()=>(Gu(),ju))).rmCommand},{name:"cp",load:async()=>(await Promise.resolve().then(()=>(qu(),Vu))).cpCommand},{name:"mv",load:async()=>(await Promise.resolve().then(()=>(Ku(),Zu))).mvCommand},{name:"ln",load:async()=>(await Promise.resolve().then(()=>(Xu(),Qu))).lnCommand},{name:"chmod",load:async()=>(await Promise.resolve().then(()=>(ef(),Ju))).chmodCommand},{name:"pwd",load:async()=>(await Promise.resolve().then(()=>(nf(),tf))).pwdCommand},{name:"readlink",load:async()=>(await Promise.resolve().then(()=>(sf(),rf))).readlinkCommand},{name:"head",load:async()=>(await Promise.resolve().then(()=>(cf(),lf))).headCommand},{name:"tail",load:async()=>(await Promise.resolve().then(()=>(ff(),uf))).tailCommand},{name:"wc",load:async()=>(await Promise.resolve().then(()=>(df(),hf))).wcCommand},{name:"stat",load:async()=>(await Promise.resolve().then(()=>(yf(),gf))).statCommand},{name:"grep",load:async()=>(await Promise.resolve().then(()=>(ii(),si))).grepCommand},{name:"fgrep",load:async()=>(await Promise.resolve().then(()=>(ii(),si))).fgrepCommand},{name:"egrep",load:async()=>(await Promise.resolve().then(()=>(ii(),si))).egrepCommand},{name:"rg",load:async()=>(await Promise.resolve().then(()=>(o1(),a1))).rgCommand},{name:"sed",load:async()=>(await Promise.resolve().then(()=>(w1(),y1))).sedCommand},{name:"awk",load:async()=>(await Promise.resolve().then(()=>(Q1(),K1))).awkCommand2},{name:"sort",load:async()=>(await Promise.resolve().then(()=>(ap(),ip))).sortCommand},{name:"uniq",load:async()=>(await Promise.resolve().then(()=>(lp(),op))).uniqCommand},{name:"comm",load:async()=>(await Promise.resolve().then(()=>(up(),cp))).commCommand},{name:"cut",load:async()=>(await Promise.resolve().then(()=>(pp(),fp))).cutCommand},{name:"paste",load:async()=>(await Promise.resolve().then(()=>(mp(),dp))).pasteCommand},{name:"tr",load:async()=>(await Promise.resolve().then(()=>(wp(),yp))).trCommand},{name:"rev",load:async()=>(await Promise.resolve().then(()=>(xp(),bp))).rev},{name:"nl",load:async()=>(await Promise.resolve().then(()=>(Sp(),Ap))).nl},{name:"fold",load:async()=>(await Promise.resolve().then(()=>(kp(),Np))).fold},{name:"expand",load:async()=>(await Promise.resolve().then(()=>($p(),Ip))).expand},{name:"unexpand",load:async()=>(await Promise.resolve().then(()=>(Pp(),Tp))).unexpand},{name:"strings",load:async()=>(await Promise.resolve().then(()=>(Fp(),Lp))).strings},{name:"split",load:async()=>(await Promise.resolve().then(()=>(Bp(),Up))).split},{name:"column",load:async()=>(await Promise.resolve().then(()=>(Hp(),zp))).column},{name:"join",load:async()=>(await Promise.resolve().then(()=>(Gp(),jp))).join},{name:"tee",load:async()=>(await Promise.resolve().then(()=>(qp(),Vp))).teeCommand},{name:"find",load:async()=>(await Promise.resolve().then(()=>(nh(),th))).findCommand},{name:"basename",load:async()=>(await Promise.resolve().then(()=>(sh(),rh))).basenameCommand},{name:"dirname",load:async()=>(await Promise.resolve().then(()=>(ah(),ih))).dirnameCommand},{name:"tree",load:async()=>(await Promise.resolve().then(()=>(ch(),lh))).treeCommand},{name:"du",load:async()=>(await Promise.resolve().then(()=>(ph(),fh))).duCommand},{name:"env",load:async()=>(await Promise.resolve().then(()=>(Lo(),_o))).envCommand},{name:"printenv",load:async()=>(await Promise.resolve().then(()=>(Lo(),_o))).printenvCommand},{name:"alias",load:async()=>(await Promise.resolve().then(()=>(Mo(),Fo))).aliasCommand},{name:"unalias",load:async()=>(await Promise.resolve().then(()=>(Mo(),Fo))).unaliasCommand},{name:"history",load:async()=>(await Promise.resolve().then(()=>(mh(),dh))).historyCommand},{name:"xargs",load:async()=>(await Promise.resolve().then(()=>(yh(),gh))).xargsCommand},{name:"true",load:async()=>(await Promise.resolve().then(()=>(Bo(),Uo))).trueCommand},{name:"false",load:async()=>(await Promise.resolve().then(()=>(Bo(),Uo))).falseCommand},{name:"clear",load:async()=>(await Promise.resolve().then(()=>(bh(),wh))).clearCommand},{name:"bash",load:async()=>(await Promise.resolve().then(()=>(zo(),Wo))).bashCommand},{name:"sh",load:async()=>(await Promise.resolve().then(()=>(zo(),Wo))).shCommand},{name:"jq",load:async()=>(await Promise.resolve().then(()=>(Zh(),qh))).jqCommand},{name:"base64",load:async()=>(await Promise.resolve().then(()=>(Xh(),Qh))).base64Command},{name:"diff",load:async()=>(await Promise.resolve().then(()=>(ed(),Jh))).diffCommand},{name:"date",load:async()=>(await Promise.resolve().then(()=>(nd(),td))).dateCommand},{name:"sleep",load:async()=>(await Promise.resolve().then(()=>(sd(),rd))).sleepCommand},{name:"timeout",load:async()=>(await Promise.resolve().then(()=>(ad(),id))).timeoutCommand},{name:"time",load:async()=>(await Promise.resolve().then(()=>(ld(),od))).timeCommand},{name:"seq",load:async()=>(await Promise.resolve().then(()=>(ud(),cd))).seqCommand},{name:"expr",load:async()=>(await Promise.resolve().then(()=>(pd(),fd))).exprCommand},{name:"md5sum",load:async()=>(await Promise.resolve().then(()=>(md(),dd))).md5sumCommand},{name:"sha1sum",load:async()=>(await Promise.resolve().then(()=>(yd(),gd))).sha1sumCommand},{name:"sha256sum",load:async()=>(await Promise.resolve().then(()=>(bd(),wd))).sha256sumCommand},{name:"file",load:async()=>(await Promise.resolve().then(()=>(u0(),c0))).fileCommand},{name:"html-to-markdown",load:async()=>(await Promise.resolve().then(()=>(p0(),f0))).htmlToMarkdownCommand},{name:"help",load:async()=>(await Promise.resolve().then(()=>(d0(),h0))).helpCommand},{name:"which",load:async()=>(await Promise.resolve().then(()=>(g0(),m0))).whichCommand},{name:"tac",load:async()=>(await Promise.resolve().then(()=>(w0(),y0))).tac},{name:"hostname",load:async()=>(await Promise.resolve().then(()=>(x0(),b0))).hostname},{name:"whoami",load:async()=>(await Promise.resolve().then(()=>(A0(),E0))).whoami},{name:"od",load:async()=>(await Promise.resolve().then(()=>(C0(),S0))).od},{name:"gzip",load:async()=>(await Promise.resolve().then(()=>(ji(),Hi))).gzipCommand},{name:"gunzip",load:async()=>(await Promise.resolve().then(()=>(ji(),Hi))).gunzipCommand},{name:"zcat",load:async()=>(await Promise.resolve().then(()=>(ji(),Hi))).zcatCommand}],Eb=[],B0=[{name:"curl",load:async()=>(await Promise.resolve().then(()=>(M0(),F0))).curlCommand}],U0=new Map;function Nl(e){return{name:e.name,async execute(t,n){let r=U0.get(e.name);return r||(r=await e.load(),U0.set(e.name,r)),n.coverage,r.execute(t,n)}}}function Ab(){return Cl.map(e=>e.name)}function Sb(){return B0.map(e=>e.name)}function W0(e){return(e?Cl.filter(n=>e.includes(n.name)):Cl).map(Nl)}function z0(){return B0.map(Nl)}function H0(){return Eb.map(Nl)}function j0(e){return"load"in e&&typeof e.load=="function"}function Cb(e,t){return{name:e,execute:t}}function G0(e){let t=null;return{name:e.name,async execute(n,r){return t||(t=await e.load()),t.execute(n,r)}}}var Nb=new TextEncoder,kb=new TextDecoder;function kl(e,t){if(e instanceof Uint8Array)return e;if(t==="base64")return Uint8Array.from(atob(e),n=>n.charCodeAt(0));if(t==="hex"){let n=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)n[r/2]=parseInt(e.slice(r,r+2),16);return n}if(t==="binary"||t==="latin1"){if(e.length<=65536)return Uint8Array.from(e,s=>s.charCodeAt(0));let r=new Uint8Array(e.length);for(let s=0;s<e.length;s++)r[s]=e.charCodeAt(s);return r}return Nb.encode(e)}function V0(e,t){if(t==="base64"){if(typeof Buffer<"u")return Buffer.from(e).toString("base64");let n=65536,r="";for(let s=0;s<e.length;s+=n){let i=e.subarray(s,s+n);r+=String.fromCharCode(...i)}return btoa(r)}if(t==="hex")return Array.from(e).map(n=>n.toString(16).padStart(2,"0")).join("");if(t==="binary"||t==="latin1"){if(typeof Buffer<"u")return Buffer.from(e).toString(t);let n=65536;if(e.length<=n)return String.fromCharCode(...e);let r="";for(let s=0;s<e.length;s+=n){let i=e.subarray(s,s+n);r+=String.fromCharCode(...i)}return r}return kb.decode(e)}function Gi(e){if(e!=null)return typeof e=="string"?e:e.encoding??void 0}var Wr=new TextEncoder;function vb(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}function ot(e,t){if(e.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${t} '${e}'`)}var ar=class{data=new Map;constructor(t){if(this.data.set("/",{type:"directory",mode:493,mtime:new Date}),t)for(let[n,r]of Object.entries(t))typeof r=="function"?this.writeFileLazy(n,r):vb(r)?this.writeFileSync(n,r.content,void 0,{mode:r.mode,mtime:r.mtime}):this.writeFileSync(n,r)}normalizePath(t){if(!t||t==="/")return"/";let n=t.endsWith("/")&&t!=="/"?t.slice(0,-1):t;n.startsWith("/")||(n=`/${n}`);let r=n.split("/").filter(i=>i&&i!=="."),s=[];for(let i of r)i===".."?s.pop():s.push(i);return`/${s.join("/")}`||"/"}dirname(t){let n=this.normalizePath(t);if(n==="/")return"/";let r=n.lastIndexOf("/");return r===0?"/":n.slice(0,r)}ensureParentDirs(t){let n=this.dirname(t);n!=="/"&&(this.data.has(n)||(this.ensureParentDirs(n),this.data.set(n,{type:"directory",mode:493,mtime:new Date})))}writeFileSync(t,n,r,s){ot(t,"write");let i=this.normalizePath(t);this.ensureParentDirs(i);let a=Gi(r),o=kl(n,a);this.data.set(i,{type:"file",content:o,mode:s?.mode??420,mtime:s?.mtime??new Date})}writeFileLazy(t,n,r){ot(t,"write");let s=this.normalizePath(t);this.ensureParentDirs(s),this.data.set(s,{type:"file",lazy:n,mode:r?.mode??420,mtime:r?.mtime??new Date})}async materializeLazy(t,n){let r=await n.lazy(),i={type:"file",content:typeof r=="string"?Wr.encode(r):r,mode:n.mode,mtime:n.mtime};return this.data.set(t,i),i}async readFile(t,n){let r=await this.readFileBuffer(t),s=Gi(n);return V0(r,s)}async readFileBuffer(t){ot(t,"open");let n=this.resolvePathWithSymlinks(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, open '${t}'`);if(r.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${t}'`);if("lazy"in r){let s=await this.materializeLazy(n,r);return s.content instanceof Uint8Array?s.content:Wr.encode(s.content)}return r.content instanceof Uint8Array?r.content:Wr.encode(r.content)}async writeFile(t,n,r){this.writeFileSync(t,n,r)}async appendFile(t,n,r){ot(t,"append");let s=this.normalizePath(t),i=this.data.get(s);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let a=Gi(r),o=kl(n,a);if(i?.type==="file"){let l=i;"lazy"in l&&(l=await this.materializeLazy(s,l));let c="content"in l&&l.content instanceof Uint8Array?l.content:Wr.encode("content"in l?l.content:""),u=new Uint8Array(c.length+o.length);u.set(c),u.set(o,c.length),this.data.set(s,{type:"file",content:u,mode:l.mode,mtime:new Date})}else this.writeFileSync(t,n,r)}async exists(t){if(t.includes("\0"))return!1;try{let n=this.resolvePathWithSymlinks(t);return this.data.has(n)}catch{return!1}}async stat(t){ot(t,"stat");let n=this.resolvePathWithSymlinks(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, stat '${t}'`);r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(n,r));let s=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?s=r.content.length:s=Wr.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date}}async lstat(t){ot(t,"lstat");let n=this.resolveIntermediateSymlinks(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${t}'`);if(r.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:r.mode,size:r.target.length,mtime:r.mtime||new Date};r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(n,r));let s=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?s=r.content.length:s=Wr.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date}}resolveSymlink(t,n){if(n.startsWith("/"))return this.normalizePath(n);let r=this.dirname(t);return this.normalizePath(r==="/"?`/${n}`:`${r}/${n}`)}resolveIntermediateSymlinks(t){let n=this.normalizePath(t);if(n==="/")return"/";let r=n.slice(1).split("/");if(r.length<=1)return n;let s="",i=new Set;for(let a=0;a<r.length-1;a++){let o=r[a];s=`${s}/${o}`;let l=this.data.get(s),c=0,u=40;for(;l&&l.type==="symlink"&&c<u;){if(i.has(s))throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`);i.add(s),s=this.resolveSymlink(s,l.target),l=this.data.get(s),c++}if(c>=u)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`)}return`${s}/${r[r.length-1]}`}resolvePathWithSymlinks(t){let n=this.normalizePath(t);if(n==="/")return"/";let r=n.slice(1).split("/"),s="",i=new Set;for(let a of r){s=`${s}/${a}`;let o=this.data.get(s),l=0,c=40;for(;o&&o.type==="symlink"&&l<c;){if(i.has(s))throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`);i.add(s),s=this.resolveSymlink(s,o.target),o=this.data.get(s),l++}if(l>=c)throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`)}return s}async mkdir(t,n){this.mkdirSync(t,n)}mkdirSync(t,n){ot(t,"mkdir");let r=this.normalizePath(t);if(this.data.has(r)){if(this.data.get(r)?.type==="file")throw new Error(`EEXIST: file already exists, mkdir '${t}'`);if(!n?.recursive)throw new Error(`EEXIST: directory already exists, mkdir '${t}'`);return}let s=this.dirname(r);if(s!=="/"&&!this.data.has(s))if(n?.recursive)this.mkdirSync(s,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${t}'`);this.data.set(r,{type:"directory",mode:493,mtime:new Date})}async readdir(t){return(await this.readdirWithFileTypes(t)).map(r=>r.name)}async readdirWithFileTypes(t){ot(t,"scandir");let n=this.normalizePath(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);let s=new Set;for(;r&&r.type==="symlink";){if(s.has(n))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${t}'`);s.add(n),n=this.resolveSymlink(n,r.target),r=this.data.get(n)}if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);if(r.type!=="directory")throw new Error(`ENOTDIR: not a directory, scandir '${t}'`);let i=n==="/"?"/":`${n}/`,a=new Map;for(let[o,l]of this.data.entries())if(o!==n&&o.startsWith(i)){let c=o.slice(i.length),u=c.split("/")[0];u&&!c.includes("/",u.length)&&!a.has(u)&&a.set(u,{name:u,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(a.values()).sort((o,l)=>o.name<l.name?-1:o.name>l.name?1:0)}async rm(t,n){ot(t,"rm");let r=this.normalizePath(t),s=this.data.get(r);if(!s){if(n?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${t}'`)}if(s.type==="directory"){let i=await this.readdir(r);if(i.length>0){if(!n?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${t}'`);for(let a of i){let o=r==="/"?`/${a}`:`${r}/${a}`;await this.rm(o,n)}}}this.data.delete(r)}async cp(t,n,r){ot(t,"cp"),ot(n,"cp");let s=this.normalizePath(t),i=this.normalizePath(n),a=this.data.get(s);if(!a)throw new Error(`ENOENT: no such file or directory, cp '${t}'`);if(a.type==="file")if(this.ensureParentDirs(i),"content"in a){let o=a.content instanceof Uint8Array?new Uint8Array(a.content):a.content;this.data.set(i,{...a,content:o})}else this.data.set(i,{...a});else if(a.type==="symlink")this.ensureParentDirs(i),this.data.set(i,{...a});else if(a.type==="directory"){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${t}'`);await this.mkdir(i,{recursive:!0});let o=await this.readdir(s);for(let l of o){let c=s==="/"?`/${l}`:`${s}/${l}`,u=i==="/"?`/${l}`:`${i}/${l}`;await this.cp(c,u,r)}}}async mv(t,n){await this.cp(t,n,{recursive:!0}),await this.rm(t,{recursive:!0})}getAllPaths(){return Array.from(this.data.keys())}resolvePath(t,n){if(n.startsWith("/"))return this.normalizePath(n);let r=t==="/"?`/${n}`:`${t}/${n}`;return this.normalizePath(r)}async chmod(t,n){ot(t,"chmod");let r=this.normalizePath(t),s=this.data.get(r);if(!s)throw new Error(`ENOENT: no such file or directory, chmod '${t}'`);s.mode=n}async symlink(t,n){ot(n,"symlink");let r=this.normalizePath(n);if(this.data.has(r))throw new Error(`EEXIST: file already exists, symlink '${n}'`);this.ensureParentDirs(r),this.data.set(r,{type:"symlink",target:t,mode:511,mtime:new Date})}async link(t,n){ot(t,"link"),ot(n,"link");let r=this.normalizePath(t),s=this.normalizePath(n),i=this.data.get(r);if(!i)throw new Error(`ENOENT: no such file or directory, link '${t}'`);if(i.type!=="file")throw new Error(`EPERM: operation not permitted, link '${t}'`);if(this.data.has(s))throw new Error(`EEXIST: file already exists, link '${n}'`);let a=i;"lazy"in a&&(a=await this.materializeLazy(r,a)),this.ensureParentDirs(s),this.data.set(s,{type:"file",content:a.content,mode:a.mode,mtime:a.mtime})}async readlink(t){ot(t,"readlink");let n=this.normalizePath(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, readlink '${t}'`);if(r.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${t}'`);return r.target}async realpath(t){ot(t,"realpath");let n=this.resolvePathWithSymlinks(t);if(!this.data.has(n))throw new Error(`ENOENT: no such file or directory, realpath '${t}'`);return n}async utimes(t,n,r){ot(t,"utimes");let s=this.normalizePath(t),i=this.resolvePathWithSymlinks(s),a=this.data.get(i);if(!a)throw new Error(`ENOENT: no such file or directory, utimes '${t}'`);a.mtime=r}};Il();function Ib(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function $b(e,t){e.mkdirSync("/bin",{recursive:!0}),e.mkdirSync("/usr/bin",{recursive:!0}),t&&(e.mkdirSync("/home/user",{recursive:!0}),e.mkdirSync("/tmp",{recursive:!0}))}function Ob(e){e.mkdirSync("/dev",{recursive:!0}),e.writeFileSync("/dev/null",""),e.writeFileSync("/dev/zero",new Uint8Array(0)),e.writeFileSync("/dev/stdin",""),e.writeFileSync("/dev/stdout",""),e.writeFileSync("/dev/stderr","")}function Rb(e,t){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${Z0}
790
+ `,0;i=f}let a=`${t.array}_${i}`,o=e.state.env.get(a);if(o!==void 0)return xc(e,o);if(i===0){let l=e.state.env.get(t.array);if(l!==void 0)return xc(e,l)}if(e.state.options.nounset&&!Array.from(e.state.env.keys()).some(c=>c===t.array||c.startsWith(`${t.array}_`)))throw new wt(`${t.array}[${i}]`);return 0}return 0}case"ArithDoubleSubscript":throw new Oe("double subscript","","");case"ArithNumberSubscript":throw new Oe(`${t.number}${t.errorToken}: syntax error: invalid arithmetic operator (error token is "${t.errorToken}")`);case"ArithSyntaxError":throw new Oe(t.message,"","",!0);case"ArithSingleQuote":{if(n)throw new Oe(`syntax error: operand expected (error token is "'${t.content}'")`);return t.value}case"ArithBinary":{if(t.operator==="||")return await ne(e,t.left,n)||await ne(e,t.right,n)?1:0;if(t.operator==="&&")return await ne(e,t.left,n)&&await ne(e,t.right,n)?1:0;let r=await ne(e,t.left,n),s=await ne(e,t.right,n);return Kx(r,s,t.operator)}case"ArithUnary":{let r=await ne(e,t.operand,n);if(t.operator==="++"||t.operator==="--"){if(t.operand.type==="ArithVariable"){let s=t.operand.name,i=Number.parseInt(await Se(e,s),10)||0,a=t.operator==="++"?i+1:i-1;return e.state.env.set(s,String(a)),t.prefix?a:i}if(t.operand.type==="ArithArrayElement"){let s=t.operand.array,i=e.state.associativeArrays?.has(s),a;if(t.operand.stringKey!==void 0)a=`${s}_${t.operand.stringKey}`;else if(i&&t.operand.index?.type==="ArithVariable"&&!t.operand.index.hasDollarPrefix)a=`${s}_${t.operand.index.name}`;else if(i&&t.operand.index?.type==="ArithVariable"&&t.operand.index.hasDollarPrefix){let c=await Se(e,t.operand.index.name);a=`${s}_${c}`}else if(t.operand.index){let c=await ne(e,t.operand.index,n);a=`${s}_${c}`}else return r;let o=Number.parseInt(e.state.env.get(a)||"0",10)||0,l=t.operator==="++"?o+1:o-1;return e.state.env.set(a,String(l)),t.prefix?l:o}if(t.operand.type==="ArithConcat"){let s="";for(let i of t.operand.parts)s+=await Qr(e,i,n);if(s&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){let i=Number.parseInt(e.state.env.get(s)||"0",10)||0,a=t.operator==="++"?i+1:i-1;return e.state.env.set(s,String(a)),t.prefix?a:i}}if(t.operand.type==="ArithDynamicElement"){let s="";if(t.operand.nameExpr.type==="ArithConcat")for(let i of t.operand.nameExpr.parts)s+=await Qr(e,i,n);else t.operand.nameExpr.type==="ArithVariable"&&(s=t.operand.nameExpr.hasDollarPrefix?await Se(e,t.operand.nameExpr.name):t.operand.nameExpr.name);if(s&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){let i=await ne(e,t.operand.subscript,n),a=`${s}_${i}`,o=Number.parseInt(e.state.env.get(a)||"0",10)||0,l=t.operator==="++"?o+1:o-1;return e.state.env.set(a,String(l)),t.prefix?l:o}}return r}return Qx(r,t.operator)}case"ArithTernary":return await ne(e,t.condition,n)?await ne(e,t.consequent,n):await ne(e,t.alternate,n);case"ArithAssignment":{let r=t.variable,s=r;if(t.stringKey!==void 0)s=`${r}_${t.stringKey}`;else if(t.subscript){let l=e.state.associativeArrays?.has(r);if(l&&t.subscript.type==="ArithVariable"&&!t.subscript.hasDollarPrefix)s=`${r}_${t.subscript.name}`;else if(l&&t.subscript.type==="ArithVariable"&&t.subscript.hasDollarPrefix){let c=await Se(e,t.subscript.name);s=`${r}_${c||"\\"}`}else if(l){let c=await ne(e,t.subscript,n);s=`${r}_${c}`}else{let c=await ne(e,t.subscript,n);if(c<0){let u=oe(e,r);u.length>0&&(c=Math.max(...u.map(([p])=>typeof p=="number"?p:0))+1+c)}s=`${r}_${c}`}}let i=Number.parseInt(e.state.env.get(s)||"0",10)||0,a=await ne(e,t.value,n),o=bg(i,a,t.operator);return e.state.env.set(s,String(o)),o}case"ArithGroup":return await ne(e,t.expression,n);case"ArithConcat":{let r="";for(let s of t.parts)r+=await Qr(e,s,n);return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)?await Ec(e,r):Number.parseInt(r,10)||0}case"ArithDynamicAssignment":{let r="";if(t.target.type==="ArithConcat")for(let l of t.target.parts)r+=await Qr(e,l,n);else t.target.type==="ArithVariable"&&(r=t.target.hasDollarPrefix?await Se(e,t.target.name):t.target.name);if(!r||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))return 0;let s=r;if(t.subscript){let l=await ne(e,t.subscript,n);s=`${r}_${l}`}let i=Number.parseInt(e.state.env.get(s)||"0",10)||0,a=await ne(e,t.value,n),o=bg(i,a,t.operator);return e.state.env.set(s,String(o)),o}case"ArithDynamicElement":{let r="";if(t.nameExpr.type==="ArithConcat")for(let o of t.nameExpr.parts)r+=await Qr(e,o,n);else t.nameExpr.type==="ArithVariable"&&(r=t.nameExpr.hasDollarPrefix?await Se(e,t.nameExpr.name):t.nameExpr.name);if(!r||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))return 0;let s=await ne(e,t.subscript,n),i=`${r}_${s}`,a=e.state.env.get(i);return a!==void 0?Yx(a):0}default:return 0}}async function Qr(e,t,n=!1){switch(t.type){case"ArithNumber":return String(t.value);case"ArithSingleQuote":return String(await ne(e,t,n));case"ArithVariable":return t.hasDollarPrefix?await Se(e,t.name):t.name;case"ArithSpecialVar":return await Se(e,t.name);case"ArithBracedExpansion":return await fa(e,t.content);case"ArithCommandSubst":return e.execFn?(await e.execFn(t.command)).stdout.trim():"0";case"ArithConcat":{let r="";for(let s of t.parts)r+=await Qr(e,s,n);return r}default:return String(await ne(e,t,n))}}var Ct=I(()=>{"use strict";mt();Xe();ye();Nt()});var Cl=[{name:"echo",load:async()=>(await Promise.resolve().then(()=>(xu(),bu))).echoCommand},{name:"cat",load:async()=>(await Promise.resolve().then(()=>(Au(),Eu))).catCommand},{name:"printf",load:async()=>(await Promise.resolve().then(()=>(Ru(),Ou))).printfCommand},{name:"ls",load:async()=>(await Promise.resolve().then(()=>(_u(),Du))).lsCommand},{name:"mkdir",load:async()=>(await Promise.resolve().then(()=>(Fu(),Lu))).mkdirCommand},{name:"rmdir",load:async()=>(await Promise.resolve().then(()=>(Wu(),Bu))).rmdirCommand},{name:"touch",load:async()=>(await Promise.resolve().then(()=>(Hu(),zu))).touchCommand},{name:"rm",load:async()=>(await Promise.resolve().then(()=>(Gu(),ju))).rmCommand},{name:"cp",load:async()=>(await Promise.resolve().then(()=>(qu(),Vu))).cpCommand},{name:"mv",load:async()=>(await Promise.resolve().then(()=>(Ku(),Zu))).mvCommand},{name:"ln",load:async()=>(await Promise.resolve().then(()=>(Xu(),Qu))).lnCommand},{name:"chmod",load:async()=>(await Promise.resolve().then(()=>(ef(),Ju))).chmodCommand},{name:"pwd",load:async()=>(await Promise.resolve().then(()=>(nf(),tf))).pwdCommand},{name:"readlink",load:async()=>(await Promise.resolve().then(()=>(sf(),rf))).readlinkCommand},{name:"head",load:async()=>(await Promise.resolve().then(()=>(cf(),lf))).headCommand},{name:"tail",load:async()=>(await Promise.resolve().then(()=>(ff(),uf))).tailCommand},{name:"wc",load:async()=>(await Promise.resolve().then(()=>(df(),hf))).wcCommand},{name:"stat",load:async()=>(await Promise.resolve().then(()=>(yf(),gf))).statCommand},{name:"grep",load:async()=>(await Promise.resolve().then(()=>(ii(),si))).grepCommand},{name:"fgrep",load:async()=>(await Promise.resolve().then(()=>(ii(),si))).fgrepCommand},{name:"egrep",load:async()=>(await Promise.resolve().then(()=>(ii(),si))).egrepCommand},{name:"rg",load:async()=>(await Promise.resolve().then(()=>(o1(),a1))).rgCommand},{name:"sed",load:async()=>(await Promise.resolve().then(()=>(w1(),y1))).sedCommand},{name:"awk",load:async()=>(await Promise.resolve().then(()=>(Q1(),K1))).awkCommand2},{name:"sort",load:async()=>(await Promise.resolve().then(()=>(ap(),ip))).sortCommand},{name:"uniq",load:async()=>(await Promise.resolve().then(()=>(lp(),op))).uniqCommand},{name:"comm",load:async()=>(await Promise.resolve().then(()=>(up(),cp))).commCommand},{name:"cut",load:async()=>(await Promise.resolve().then(()=>(pp(),fp))).cutCommand},{name:"paste",load:async()=>(await Promise.resolve().then(()=>(mp(),dp))).pasteCommand},{name:"tr",load:async()=>(await Promise.resolve().then(()=>(wp(),yp))).trCommand},{name:"rev",load:async()=>(await Promise.resolve().then(()=>(xp(),bp))).rev},{name:"nl",load:async()=>(await Promise.resolve().then(()=>(Sp(),Ap))).nl},{name:"fold",load:async()=>(await Promise.resolve().then(()=>(vp(),Np))).fold},{name:"expand",load:async()=>(await Promise.resolve().then(()=>($p(),Ip))).expand},{name:"unexpand",load:async()=>(await Promise.resolve().then(()=>(Pp(),Tp))).unexpand},{name:"strings",load:async()=>(await Promise.resolve().then(()=>(Fp(),Lp))).strings},{name:"split",load:async()=>(await Promise.resolve().then(()=>(Bp(),Up))).split},{name:"column",load:async()=>(await Promise.resolve().then(()=>(Hp(),zp))).column},{name:"join",load:async()=>(await Promise.resolve().then(()=>(Gp(),jp))).join},{name:"tee",load:async()=>(await Promise.resolve().then(()=>(qp(),Vp))).teeCommand},{name:"find",load:async()=>(await Promise.resolve().then(()=>(nh(),th))).findCommand},{name:"basename",load:async()=>(await Promise.resolve().then(()=>(sh(),rh))).basenameCommand},{name:"dirname",load:async()=>(await Promise.resolve().then(()=>(ah(),ih))).dirnameCommand},{name:"tree",load:async()=>(await Promise.resolve().then(()=>(ch(),lh))).treeCommand},{name:"du",load:async()=>(await Promise.resolve().then(()=>(ph(),fh))).duCommand},{name:"env",load:async()=>(await Promise.resolve().then(()=>(Lo(),_o))).envCommand},{name:"printenv",load:async()=>(await Promise.resolve().then(()=>(Lo(),_o))).printenvCommand},{name:"alias",load:async()=>(await Promise.resolve().then(()=>(Mo(),Fo))).aliasCommand},{name:"unalias",load:async()=>(await Promise.resolve().then(()=>(Mo(),Fo))).unaliasCommand},{name:"history",load:async()=>(await Promise.resolve().then(()=>(mh(),dh))).historyCommand},{name:"xargs",load:async()=>(await Promise.resolve().then(()=>(yh(),gh))).xargsCommand},{name:"true",load:async()=>(await Promise.resolve().then(()=>(Bo(),Uo))).trueCommand},{name:"false",load:async()=>(await Promise.resolve().then(()=>(Bo(),Uo))).falseCommand},{name:"clear",load:async()=>(await Promise.resolve().then(()=>(bh(),wh))).clearCommand},{name:"bash",load:async()=>(await Promise.resolve().then(()=>(zo(),Wo))).bashCommand},{name:"sh",load:async()=>(await Promise.resolve().then(()=>(zo(),Wo))).shCommand},{name:"jq",load:async()=>(await Promise.resolve().then(()=>(Zh(),qh))).jqCommand},{name:"base64",load:async()=>(await Promise.resolve().then(()=>(Xh(),Qh))).base64Command},{name:"diff",load:async()=>(await Promise.resolve().then(()=>(ed(),Jh))).diffCommand},{name:"date",load:async()=>(await Promise.resolve().then(()=>(nd(),td))).dateCommand},{name:"sleep",load:async()=>(await Promise.resolve().then(()=>(sd(),rd))).sleepCommand},{name:"timeout",load:async()=>(await Promise.resolve().then(()=>(ad(),id))).timeoutCommand},{name:"time",load:async()=>(await Promise.resolve().then(()=>(ld(),od))).timeCommand},{name:"seq",load:async()=>(await Promise.resolve().then(()=>(ud(),cd))).seqCommand},{name:"expr",load:async()=>(await Promise.resolve().then(()=>(pd(),fd))).exprCommand},{name:"md5sum",load:async()=>(await Promise.resolve().then(()=>(md(),dd))).md5sumCommand},{name:"sha1sum",load:async()=>(await Promise.resolve().then(()=>(yd(),gd))).sha1sumCommand},{name:"sha256sum",load:async()=>(await Promise.resolve().then(()=>(bd(),wd))).sha256sumCommand},{name:"file",load:async()=>(await Promise.resolve().then(()=>(u0(),c0))).fileCommand},{name:"html-to-markdown",load:async()=>(await Promise.resolve().then(()=>(p0(),f0))).htmlToMarkdownCommand},{name:"help",load:async()=>(await Promise.resolve().then(()=>(d0(),h0))).helpCommand},{name:"which",load:async()=>(await Promise.resolve().then(()=>(g0(),m0))).whichCommand},{name:"tac",load:async()=>(await Promise.resolve().then(()=>(w0(),y0))).tac},{name:"hostname",load:async()=>(await Promise.resolve().then(()=>(x0(),b0))).hostname},{name:"whoami",load:async()=>(await Promise.resolve().then(()=>(A0(),E0))).whoami},{name:"od",load:async()=>(await Promise.resolve().then(()=>(C0(),S0))).od},{name:"gzip",load:async()=>(await Promise.resolve().then(()=>(ji(),Hi))).gzipCommand},{name:"gunzip",load:async()=>(await Promise.resolve().then(()=>(ji(),Hi))).gunzipCommand},{name:"zcat",load:async()=>(await Promise.resolve().then(()=>(ji(),Hi))).zcatCommand}],Eb=[],B0=[{name:"curl",load:async()=>(await Promise.resolve().then(()=>(M0(),F0))).curlCommand}],U0=new Map;function Nl(e){return{name:e.name,async execute(t,n){let r=U0.get(e.name);return r||(r=await e.load(),U0.set(e.name,r)),n.coverage,r.execute(t,n)}}}function Ab(){return Cl.map(e=>e.name)}function Sb(){return B0.map(e=>e.name)}function W0(e){return(e?Cl.filter(n=>e.includes(n.name)):Cl).map(Nl)}function z0(){return B0.map(Nl)}function H0(){return Eb.map(Nl)}function j0(e){return"load"in e&&typeof e.load=="function"}function Cb(e,t){return{name:e,execute:t}}function G0(e){let t=null;return{name:e.name,async execute(n,r){return t||(t=await e.load()),t.execute(n,r)}}}var Nb=new TextEncoder,vb=new TextDecoder;function vl(e,t){if(e instanceof Uint8Array)return e;if(t==="base64")return Uint8Array.from(atob(e),n=>n.charCodeAt(0));if(t==="hex"){let n=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)n[r/2]=parseInt(e.slice(r,r+2),16);return n}if(t==="binary"||t==="latin1"){if(e.length<=65536)return Uint8Array.from(e,s=>s.charCodeAt(0));let r=new Uint8Array(e.length);for(let s=0;s<e.length;s++)r[s]=e.charCodeAt(s);return r}return Nb.encode(e)}function V0(e,t){if(t==="base64"){if(typeof Buffer<"u")return Buffer.from(e).toString("base64");let n=65536,r="";for(let s=0;s<e.length;s+=n){let i=e.subarray(s,s+n);r+=String.fromCharCode(...i)}return btoa(r)}if(t==="hex")return Array.from(e).map(n=>n.toString(16).padStart(2,"0")).join("");if(t==="binary"||t==="latin1"){if(typeof Buffer<"u")return Buffer.from(e).toString(t);let n=65536;if(e.length<=n)return String.fromCharCode(...e);let r="";for(let s=0;s<e.length;s+=n){let i=e.subarray(s,s+n);r+=String.fromCharCode(...i)}return r}return vb.decode(e)}function Gi(e){if(e!=null)return typeof e=="string"?e:e.encoding??void 0}var Wr=new TextEncoder;function kb(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}function ot(e,t){if(e.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${t} '${e}'`)}var ar=class{data=new Map;constructor(t){if(this.data.set("/",{type:"directory",mode:493,mtime:new Date}),t)for(let[n,r]of Object.entries(t))typeof r=="function"?this.writeFileLazy(n,r):kb(r)?this.writeFileSync(n,r.content,void 0,{mode:r.mode,mtime:r.mtime}):this.writeFileSync(n,r)}normalizePath(t){if(!t||t==="/")return"/";let n=t.endsWith("/")&&t!=="/"?t.slice(0,-1):t;n.startsWith("/")||(n=`/${n}`);let r=n.split("/").filter(i=>i&&i!=="."),s=[];for(let i of r)i===".."?s.pop():s.push(i);return`/${s.join("/")}`||"/"}dirname(t){let n=this.normalizePath(t);if(n==="/")return"/";let r=n.lastIndexOf("/");return r===0?"/":n.slice(0,r)}ensureParentDirs(t){let n=this.dirname(t);n!=="/"&&(this.data.has(n)||(this.ensureParentDirs(n),this.data.set(n,{type:"directory",mode:493,mtime:new Date})))}writeFileSync(t,n,r,s){ot(t,"write");let i=this.normalizePath(t);this.ensureParentDirs(i);let a=Gi(r),o=vl(n,a);this.data.set(i,{type:"file",content:o,mode:s?.mode??420,mtime:s?.mtime??new Date})}writeFileLazy(t,n,r){ot(t,"write");let s=this.normalizePath(t);this.ensureParentDirs(s),this.data.set(s,{type:"file",lazy:n,mode:r?.mode??420,mtime:r?.mtime??new Date})}async materializeLazy(t,n){let r=await n.lazy(),i={type:"file",content:typeof r=="string"?Wr.encode(r):r,mode:n.mode,mtime:n.mtime};return this.data.set(t,i),i}async readFile(t,n){let r=await this.readFileBuffer(t),s=Gi(n);return V0(r,s)}async readFileBuffer(t){ot(t,"open");let n=this.resolvePathWithSymlinks(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, open '${t}'`);if(r.type!=="file")throw new Error(`EISDIR: illegal operation on a directory, read '${t}'`);if("lazy"in r){let s=await this.materializeLazy(n,r);return s.content instanceof Uint8Array?s.content:Wr.encode(s.content)}return r.content instanceof Uint8Array?r.content:Wr.encode(r.content)}async writeFile(t,n,r){this.writeFileSync(t,n,r)}async appendFile(t,n,r){ot(t,"append");let s=this.normalizePath(t),i=this.data.get(s);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let a=Gi(r),o=vl(n,a);if(i?.type==="file"){let l=i;"lazy"in l&&(l=await this.materializeLazy(s,l));let c="content"in l&&l.content instanceof Uint8Array?l.content:Wr.encode("content"in l?l.content:""),u=new Uint8Array(c.length+o.length);u.set(c),u.set(o,c.length),this.data.set(s,{type:"file",content:u,mode:l.mode,mtime:new Date})}else this.writeFileSync(t,n,r)}async exists(t){if(t.includes("\0"))return!1;try{let n=this.resolvePathWithSymlinks(t);return this.data.has(n)}catch{return!1}}async stat(t){ot(t,"stat");let n=this.resolvePathWithSymlinks(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, stat '${t}'`);r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(n,r));let s=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?s=r.content.length:s=Wr.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date}}async lstat(t){ot(t,"lstat");let n=this.resolveIntermediateSymlinks(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${t}'`);if(r.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:r.mode,size:r.target.length,mtime:r.mtime||new Date};r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(n,r));let s=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?s=r.content.length:s=Wr.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date}}resolveSymlink(t,n){if(n.startsWith("/"))return this.normalizePath(n);let r=this.dirname(t);return this.normalizePath(r==="/"?`/${n}`:`${r}/${n}`)}resolveIntermediateSymlinks(t){let n=this.normalizePath(t);if(n==="/")return"/";let r=n.slice(1).split("/");if(r.length<=1)return n;let s="",i=new Set;for(let a=0;a<r.length-1;a++){let o=r[a];s=`${s}/${o}`;let l=this.data.get(s),c=0,u=40;for(;l&&l.type==="symlink"&&c<u;){if(i.has(s))throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`);i.add(s),s=this.resolveSymlink(s,l.target),l=this.data.get(s),c++}if(c>=u)throw new Error(`ELOOP: too many levels of symbolic links, lstat '${t}'`)}return`${s}/${r[r.length-1]}`}resolvePathWithSymlinks(t){let n=this.normalizePath(t);if(n==="/")return"/";let r=n.slice(1).split("/"),s="",i=new Set;for(let a of r){s=`${s}/${a}`;let o=this.data.get(s),l=0,c=40;for(;o&&o.type==="symlink"&&l<c;){if(i.has(s))throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`);i.add(s),s=this.resolveSymlink(s,o.target),o=this.data.get(s),l++}if(l>=c)throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`)}return s}async mkdir(t,n){this.mkdirSync(t,n)}mkdirSync(t,n){ot(t,"mkdir");let r=this.normalizePath(t);if(this.data.has(r)){if(this.data.get(r)?.type==="file")throw new Error(`EEXIST: file already exists, mkdir '${t}'`);if(!n?.recursive)throw new Error(`EEXIST: directory already exists, mkdir '${t}'`);return}let s=this.dirname(r);if(s!=="/"&&!this.data.has(s))if(n?.recursive)this.mkdirSync(s,{recursive:!0});else throw new Error(`ENOENT: no such file or directory, mkdir '${t}'`);this.data.set(r,{type:"directory",mode:493,mtime:new Date})}async readdir(t){return(await this.readdirWithFileTypes(t)).map(r=>r.name)}async readdirWithFileTypes(t){ot(t,"scandir");let n=this.normalizePath(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);let s=new Set;for(;r&&r.type==="symlink";){if(s.has(n))throw new Error(`ELOOP: too many levels of symbolic links, scandir '${t}'`);s.add(n),n=this.resolveSymlink(n,r.target),r=this.data.get(n)}if(!r)throw new Error(`ENOENT: no such file or directory, scandir '${t}'`);if(r.type!=="directory")throw new Error(`ENOTDIR: not a directory, scandir '${t}'`);let i=n==="/"?"/":`${n}/`,a=new Map;for(let[o,l]of this.data.entries())if(o!==n&&o.startsWith(i)){let c=o.slice(i.length),u=c.split("/")[0];u&&!c.includes("/",u.length)&&!a.has(u)&&a.set(u,{name:u,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(a.values()).sort((o,l)=>o.name<l.name?-1:o.name>l.name?1:0)}async rm(t,n){ot(t,"rm");let r=this.normalizePath(t),s=this.data.get(r);if(!s){if(n?.force)return;throw new Error(`ENOENT: no such file or directory, rm '${t}'`)}if(s.type==="directory"){let i=await this.readdir(r);if(i.length>0){if(!n?.recursive)throw new Error(`ENOTEMPTY: directory not empty, rm '${t}'`);for(let a of i){let o=r==="/"?`/${a}`:`${r}/${a}`;await this.rm(o,n)}}}this.data.delete(r)}async cp(t,n,r){ot(t,"cp"),ot(n,"cp");let s=this.normalizePath(t),i=this.normalizePath(n),a=this.data.get(s);if(!a)throw new Error(`ENOENT: no such file or directory, cp '${t}'`);if(a.type==="file")if(this.ensureParentDirs(i),"content"in a){let o=a.content instanceof Uint8Array?new Uint8Array(a.content):a.content;this.data.set(i,{...a,content:o})}else this.data.set(i,{...a});else if(a.type==="symlink")this.ensureParentDirs(i),this.data.set(i,{...a});else if(a.type==="directory"){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${t}'`);await this.mkdir(i,{recursive:!0});let o=await this.readdir(s);for(let l of o){let c=s==="/"?`/${l}`:`${s}/${l}`,u=i==="/"?`/${l}`:`${i}/${l}`;await this.cp(c,u,r)}}}async mv(t,n){await this.cp(t,n,{recursive:!0}),await this.rm(t,{recursive:!0})}getAllPaths(){return Array.from(this.data.keys())}resolvePath(t,n){if(n.startsWith("/"))return this.normalizePath(n);let r=t==="/"?`/${n}`:`${t}/${n}`;return this.normalizePath(r)}async chmod(t,n){ot(t,"chmod");let r=this.normalizePath(t),s=this.data.get(r);if(!s)throw new Error(`ENOENT: no such file or directory, chmod '${t}'`);s.mode=n}async symlink(t,n){ot(n,"symlink");let r=this.normalizePath(n);if(this.data.has(r))throw new Error(`EEXIST: file already exists, symlink '${n}'`);this.ensureParentDirs(r),this.data.set(r,{type:"symlink",target:t,mode:511,mtime:new Date})}async link(t,n){ot(t,"link"),ot(n,"link");let r=this.normalizePath(t),s=this.normalizePath(n),i=this.data.get(r);if(!i)throw new Error(`ENOENT: no such file or directory, link '${t}'`);if(i.type!=="file")throw new Error(`EPERM: operation not permitted, link '${t}'`);if(this.data.has(s))throw new Error(`EEXIST: file already exists, link '${n}'`);let a=i;"lazy"in a&&(a=await this.materializeLazy(r,a)),this.ensureParentDirs(s),this.data.set(s,{type:"file",content:a.content,mode:a.mode,mtime:a.mtime})}async readlink(t){ot(t,"readlink");let n=this.normalizePath(t),r=this.data.get(n);if(!r)throw new Error(`ENOENT: no such file or directory, readlink '${t}'`);if(r.type!=="symlink")throw new Error(`EINVAL: invalid argument, readlink '${t}'`);return r.target}async realpath(t){ot(t,"realpath");let n=this.resolvePathWithSymlinks(t);if(!this.data.has(n))throw new Error(`ENOENT: no such file or directory, realpath '${t}'`);return n}async utimes(t,n,r){ot(t,"utimes");let s=this.normalizePath(t),i=this.resolvePathWithSymlinks(s),a=this.data.get(i);if(!a)throw new Error(`ENOENT: no such file or directory, utimes '${t}'`);a.mtime=r}};Il();function Ib(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function $b(e,t){e.mkdirSync("/bin",{recursive:!0}),e.mkdirSync("/usr/bin",{recursive:!0}),t&&(e.mkdirSync("/home/user",{recursive:!0}),e.mkdirSync("/tmp",{recursive:!0}))}function Ob(e){e.mkdirSync("/dev",{recursive:!0}),e.writeFileSync("/dev/null",""),e.writeFileSync("/dev/zero",new Uint8Array(0)),e.writeFileSync("/dev/stdin",""),e.writeFileSync("/dev/stdout",""),e.writeFileSync("/dev/stderr","")}function Rb(e,t){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${Z0}
791
791
  `),e.writeFileSync("/proc/self/exe","/bin/bash"),e.writeFileSync("/proc/self/cmdline","bash\0"),e.writeFileSync("/proc/self/comm",`bash
792
- `),e.writeFileLazy?e.writeFileLazy("/proc/self/status",()=>vl(t)):e.writeFileSync("/proc/self/status",vl(t)),e.writeFileSync("/proc/self/fd/0","/dev/stdin"),e.writeFileSync("/proc/self/fd/1","/dev/stdout"),e.writeFileSync("/proc/self/fd/2","/dev/stderr")}function K0(e,t,n={pid:1,ppid:0,uid:1e3,gid:1e3}){Ib(e)&&($b(e,t),Ob(e),Rb(e,n))}function zr(e){if(!e)return e;let t=e.replace(/\n\s+at\s.*/g,"");return t=t.replace(/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap))\b[^\s'",)}\]:]*/g,"<path>"),t=t.replace(/[A-Z]:\\[^\s'",)}\]:]+/g,"<path>"),t}Pn();ye();var Tb=["allexport","errexit","noglob","noclobber","noexec","nounset","pipefail","posix","verbose","xtrace"],Pb=["braceexpand","hashall","interactive-comments"];function $l(e){let t=[],n=[...Pb.map(r=>({name:r,enabled:!0})),...Tb.map(r=>({name:r,enabled:e[r]}))].sort((r,s)=>r.name.localeCompare(s.name));for(let r of n)r.enabled&&t.push(r.name);return t.join(":")}function Hr(e){e.state.env.set("SHELLOPTS",$l(e.state.options))}var Db=["dotglob","expand_aliases","extglob","failglob","globskipdots","globstar","lastpipe","nocaseglob","nocasematch","nullglob","xpg_echo"];function Ol(e){let t=[];for(let n of Db)e[n]&&t.push(n);return t.join(":")}function Rl(e){e.state.env.set("BASHOPTS",Ol(e.state.shoptOptions))}Pn();or();Xe();or();var ux="BASH_ALIAS_";function Um(e){return e.parts.length!==1?!1:e.parts[0].type==="Literal"}function Bm(e){if(e.parts.length!==1)return null;let t=e.parts[0];return t.type==="Literal"?t.value:null}function Wm(e,t){return e.env.get(`${ux}${t}`)}function Jl(e,t,n){if(!t.name||!Um(t.name))return t;let r=Bm(t.name);if(!r)return t;let s=Wm(e,r);if(!s||n.has(r))return t;try{n.add(r);let i=new ce,a=s,o=s.endsWith(" ");if(!o)for(let f of t.args){let p=Hm(f);a+=` ${p}`}let l;try{l=i.parse(a)}catch(f){if(f instanceof lt)throw f;return t}if(l.statements.length!==1||l.statements[0].pipelines.length!==1||l.statements[0].pipelines[0].commands.length!==1)return zm(t,s);let c=l.statements[0].pipelines[0].commands[0];if(c.type!=="SimpleCommand")return zm(t,s);let u={...c,assignments:[...t.assignments,...c.assignments],redirections:[...c.redirections,...t.redirections],line:t.line};if(o&&t.args.length>0&&(u={...u,args:[...u.args,...t.args]},u.args.length>0)){let f=u.args[0];if(Um(f)){let p=Bm(f);if(p&&Wm(e,p)){let h={type:"SimpleCommand",name:f,args:u.args.slice(1),assignments:[],redirections:[]},m=Jl(e,h,n);m!==h&&(u={...u,name:m.name,args:[...m.args]})}}}return u}catch(i){throw n.delete(r),i}}function zm(e,t){let n=t;for(let a of e.args){let o=Hm(a);n+=` ${o}`}let r=new ce,s=r.parseWordFromString("eval",!1,!1),i=r.parseWordFromString(`'${n.replace(/'/g,"'\\''")}'`,!1,!1);return{type:"SimpleCommand",name:s,args:[i],assignments:e.assignments,redirections:e.redirections,line:e.line}}function Hm(e){let t="";for(let n of e.parts)switch(n.type){case"Literal":t+=n.value.replace(/([\s"'$`\\*?[\]{}()<>|&;#!])/g,"\\$1");break;case"SingleQuoted":t+=`'${n.value}'`;break;case"DoubleQuoted":t+=`"${n.parts.map(r=>r.type==="Literal"?r.value:`$${r.type}`).join("")}"`;break;case"ParameterExpansion":t+=`\${${n.parameter}}`;break;case"CommandSubstitution":t+="$(...)";break;case"ArithmeticExpansion":t+=`$((${n.expression}))`;break;case"Glob":t+=n.pattern;break;default:break}return t}Ct();Nt();Xt();async function xg(e,t){let n=t.parts.map(u=>u.type==="Literal"?u.value:"\0").join(""),r=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);if(!r||!n.endsWith(")"))return null;let s=r[1],i=[],a=!1,o="",l=!1;for(let u of t.parts)if(u.type==="Literal"){let f=u.value;if(!a){let p=f.indexOf("=(");p!==-1&&(a=!0,f=f.slice(p+2))}if(a){f.endsWith(")")&&(f=f.slice(0,-1));let p=f.split(/(\s+)/);for(let h of p)/^\s+$/.test(h)?(o||l)&&(i.push(o),o="",l=!1):h&&(o+=h)}}else if(a)if(u.type==="BraceExpansion")if(/^\[.+\]=/.test(o))o+=jr({type:"Word",parts:[u]});else{(o||l)&&(i.push(o),o="",l=!1);let p=await cn(e,{type:"Word",parts:[u]});i.push(...p.values)}else{(u.type==="SingleQuoted"||u.type==="DoubleQuoted"||u.type==="Escaped")&&(l=!0);let f=await ie(e,{type:"Word",parts:[u]});o+=f}(o||l)&&i.push(o);let c=i.map(u=>/^\[.+\]=/.test(u)?u:u===""?"''":/[\s"'\\$`!*?[\]{}|&;<>()]/.test(u)&&!u.startsWith("'")&&!u.startsWith('"')?`'${u.replace(/'/g,"'\\''")}'`:u);return`${s}=(${c.join(" ")})`}async function Eg(e,t){let n=-1,r=-1,s=!1;for(let d=0;d<t.parts.length;d++){let g=t.parts[d];if(g.type==="Literal"){let w=g.value.indexOf("+=");if(w!==-1){let b=g.value.slice(0,w);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(b)){n=d,r=w,s=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(b)){n=d,r=w,s=!0;break}}let y=g.value.indexOf("=");if(y!==-1&&(y===0||g.value[y-1]!=="+")){let b=g.value.slice(0,y);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(b)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(b)){n=d,r=y;break}}}}if(n===-1)return null;let i=t.parts.slice(0,n),a=t.parts[n];if(a.type!=="Literal")return null;let o=s?2:1,l=a.value.slice(0,r),c=a.value.slice(r+o),u=t.parts.slice(n+1),f="";for(let d of i)f+=await ie(e,{type:"Word",parts:[d]});f+=l;let p={type:"Word",parts:c!==""?[{type:"Literal",value:c},...u]:u},h=p.parts.length>0?await ie(e,p):"";return`${f}${s?"+=":"="}${h}`}var Jx=["tar","yq","xan","sqlite3","python3","python"];function Ag(e){return Jx.includes(e)}ye();ye();var de=Object.freeze({stdout:"",stderr:"",exitCode:0});function ge(e=""){return{stdout:e,stderr:"",exitCode:0}}function B(e,t=1){return{stdout:"",stderr:e,exitCode:t}}function z(e,t,n){return{stdout:e,stderr:t,exitCode:n}}function Je(e){return{stdout:"",stderr:"",exitCode:e?0:1}}function On(e,t,n="",r=""){throw new J(e,t,n,r)}function Ac(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new pn;return de}if(t.length>1)throw new pe(1,"",`bash: break: too many arguments
792
+ `),e.writeFileLazy?e.writeFileLazy("/proc/self/status",()=>kl(t)):e.writeFileSync("/proc/self/status",kl(t)),e.writeFileSync("/proc/self/fd/0","/dev/stdin"),e.writeFileSync("/proc/self/fd/1","/dev/stdout"),e.writeFileSync("/proc/self/fd/2","/dev/stderr")}function K0(e,t,n={pid:1,ppid:0,uid:1e3,gid:1e3}){Ib(e)&&($b(e,t),Ob(e),Rb(e,n))}function zr(e){if(!e)return e;let t=e.replace(/\n\s+at\s.*/g,"");return t=t.replace(/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap))\b[^\s'",)}\]:]*/g,"<path>"),t=t.replace(/[A-Z]:\\[^\s'",)}\]:]+/g,"<path>"),t}Pn();ye();var Tb=["allexport","errexit","noglob","noclobber","noexec","nounset","pipefail","posix","verbose","xtrace"],Pb=["braceexpand","hashall","interactive-comments"];function $l(e){let t=[],n=[...Pb.map(r=>({name:r,enabled:!0})),...Tb.map(r=>({name:r,enabled:e[r]}))].sort((r,s)=>r.name.localeCompare(s.name));for(let r of n)r.enabled&&t.push(r.name);return t.join(":")}function Hr(e){e.state.env.set("SHELLOPTS",$l(e.state.options))}var Db=["dotglob","expand_aliases","extglob","failglob","globskipdots","globstar","lastpipe","nocaseglob","nocasematch","nullglob","xpg_echo"];function Ol(e){let t=[];for(let n of Db)e[n]&&t.push(n);return t.join(":")}function Rl(e){e.state.env.set("BASHOPTS",Ol(e.state.shoptOptions))}Pn();or();Xe();or();var ux="BASH_ALIAS_";function Um(e){return e.parts.length!==1?!1:e.parts[0].type==="Literal"}function Bm(e){if(e.parts.length!==1)return null;let t=e.parts[0];return t.type==="Literal"?t.value:null}function Wm(e,t){return e.env.get(`${ux}${t}`)}function Jl(e,t,n){if(!t.name||!Um(t.name))return t;let r=Bm(t.name);if(!r)return t;let s=Wm(e,r);if(!s||n.has(r))return t;try{n.add(r);let i=new ce,a=s,o=s.endsWith(" ");if(!o)for(let f of t.args){let p=Hm(f);a+=` ${p}`}let l;try{l=i.parse(a)}catch(f){if(f instanceof lt)throw f;return t}if(l.statements.length!==1||l.statements[0].pipelines.length!==1||l.statements[0].pipelines[0].commands.length!==1)return zm(t,s);let c=l.statements[0].pipelines[0].commands[0];if(c.type!=="SimpleCommand")return zm(t,s);let u={...c,assignments:[...t.assignments,...c.assignments],redirections:[...c.redirections,...t.redirections],line:t.line};if(o&&t.args.length>0&&(u={...u,args:[...u.args,...t.args]},u.args.length>0)){let f=u.args[0];if(Um(f)){let p=Bm(f);if(p&&Wm(e,p)){let h={type:"SimpleCommand",name:f,args:u.args.slice(1),assignments:[],redirections:[]},m=Jl(e,h,n);m!==h&&(u={...u,name:m.name,args:[...m.args]})}}}return u}catch(i){throw n.delete(r),i}}function zm(e,t){let n=t;for(let a of e.args){let o=Hm(a);n+=` ${o}`}let r=new ce,s=r.parseWordFromString("eval",!1,!1),i=r.parseWordFromString(`'${n.replace(/'/g,"'\\''")}'`,!1,!1);return{type:"SimpleCommand",name:s,args:[i],assignments:e.assignments,redirections:e.redirections,line:e.line}}function Hm(e){let t="";for(let n of e.parts)switch(n.type){case"Literal":t+=n.value.replace(/([\s"'$`\\*?[\]{}()<>|&;#!])/g,"\\$1");break;case"SingleQuoted":t+=`'${n.value}'`;break;case"DoubleQuoted":t+=`"${n.parts.map(r=>r.type==="Literal"?r.value:`$${r.type}`).join("")}"`;break;case"ParameterExpansion":t+=`\${${n.parameter}}`;break;case"CommandSubstitution":t+="$(...)";break;case"ArithmeticExpansion":t+=`$((${n.expression}))`;break;case"Glob":t+=n.pattern;break;default:break}return t}Ct();Nt();Xt();async function xg(e,t){let n=t.parts.map(u=>u.type==="Literal"?u.value:"\0").join(""),r=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);if(!r||!n.endsWith(")"))return null;let s=r[1],i=[],a=!1,o="",l=!1;for(let u of t.parts)if(u.type==="Literal"){let f=u.value;if(!a){let p=f.indexOf("=(");p!==-1&&(a=!0,f=f.slice(p+2))}if(a){f.endsWith(")")&&(f=f.slice(0,-1));let p=f.split(/(\s+)/);for(let h of p)/^\s+$/.test(h)?(o||l)&&(i.push(o),o="",l=!1):h&&(o+=h)}}else if(a)if(u.type==="BraceExpansion")if(/^\[.+\]=/.test(o))o+=jr({type:"Word",parts:[u]});else{(o||l)&&(i.push(o),o="",l=!1);let p=await cn(e,{type:"Word",parts:[u]});i.push(...p.values)}else{(u.type==="SingleQuoted"||u.type==="DoubleQuoted"||u.type==="Escaped")&&(l=!0);let f=await ie(e,{type:"Word",parts:[u]});o+=f}(o||l)&&i.push(o);let c=i.map(u=>/^\[.+\]=/.test(u)?u:u===""?"''":/[\s"'\\$`!*?[\]{}|&;<>()]/.test(u)&&!u.startsWith("'")&&!u.startsWith('"')?`'${u.replace(/'/g,"'\\''")}'`:u);return`${s}=(${c.join(" ")})`}async function Eg(e,t){let n=-1,r=-1,s=!1;for(let d=0;d<t.parts.length;d++){let g=t.parts[d];if(g.type==="Literal"){let w=g.value.indexOf("+=");if(w!==-1){let b=g.value.slice(0,w);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(b)){n=d,r=w,s=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(b)){n=d,r=w,s=!0;break}}let y=g.value.indexOf("=");if(y!==-1&&(y===0||g.value[y-1]!=="+")){let b=g.value.slice(0,y);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(b)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(b)){n=d,r=y;break}}}}if(n===-1)return null;let i=t.parts.slice(0,n),a=t.parts[n];if(a.type!=="Literal")return null;let o=s?2:1,l=a.value.slice(0,r),c=a.value.slice(r+o),u=t.parts.slice(n+1),f="";for(let d of i)f+=await ie(e,{type:"Word",parts:[d]});f+=l;let p={type:"Word",parts:c!==""?[{type:"Literal",value:c},...u]:u},h=p.parts.length>0?await ie(e,p):"";return`${f}${s?"+=":"="}${h}`}var Jx=["tar","yq","xan","sqlite3","python3","python"];function Ag(e){return Jx.includes(e)}ye();ye();var de=Object.freeze({stdout:"",stderr:"",exitCode:0});function ge(e=""){return{stdout:e,stderr:"",exitCode:0}}function B(e,t=1){return{stdout:"",stderr:e,exitCode:t}}function z(e,t,n){return{stdout:e,stderr:t,exitCode:n}}function Je(e){return{stdout:"",stderr:"",exitCode:e?0:1}}function On(e,t,n="",r=""){throw new J(e,t,n,r)}function Ac(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new pn;return de}if(t.length>1)throw new pe(1,"",`bash: break: too many arguments
793
793
  `);let n=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r)||r<1)throw new pe(128,"",`bash: break: ${t[0]}: numeric argument required
794
794
  `);n=r}throw new ht(n)}async function Sc(e,t){let n,r=!1,s=!1,i=0;for(;i<t.length;)if(t[i]==="--"){i++;break}else if(t[i]==="-L")s=!1,i++;else if(t[i]==="-P")s=!0,i++;else if(t[i].startsWith("-")&&t[i]!=="-")i++;else break;let a=t.slice(i);if(a.length===0||a[0]==="~"?n=e.state.env.get("HOME")||"/":a[0]==="-"?(n=e.state.previousDir,r=!0):n=a[0],!n.startsWith("/")&&!n.startsWith("./")&&!n.startsWith("../")&&n!=="."&&n!==".."){let f=e.state.env.get("CDPATH");if(f){let p=f.split(":").filter(h=>h);for(let h of p){let m=h.startsWith("/")?`${h}/${n}`:`${e.state.cwd}/${h}/${n}`;try{if((await e.fs.stat(m)).isDirectory){n=m,r=!0;break}}catch{}}}}let l=(n.startsWith("/")?n:`${e.state.cwd}/${n}`).split("/").filter(f=>f&&f!=="."),c="";for(let f of l)if(f==="..")c=c.split("/").slice(0,-1).join("/")||"/";else{c=c?`${c}/${f}`:`/${f}`;try{if(!(await e.fs.stat(c)).isDirectory)return B(`bash: cd: ${n}: Not a directory
795
795
  `)}catch{return B(`bash: cd: ${n}: No such file or directory
796
796
  `)}}let u=c||"/";if(s)try{u=await e.fs.realpath(u)}catch{}return e.state.previousDir=e.state.cwd,e.state.cwd=u,e.state.env.set("PWD",e.state.cwd),e.state.env.set("OLDPWD",e.state.previousDir),ge(r?`${u}
797
797
  `:"")}Xe();mt();Xe();Me();Ct();Nt();Xt();function Cc(e,t){return e.fs.resolvePath(e.state.cwd,t)}var eE=["-e","-a","-f","-d","-r","-w","-x","-s","-L","-h","-k","-g","-u","-G","-O","-b","-c","-p","-S","-t","-N"];function pa(e){return eE.includes(e)}async function ha(e,t,n){let r=Cc(e,n);switch(t){case"-e":case"-a":return e.fs.exists(r);case"-f":return await e.fs.exists(r)?(await e.fs.stat(r)).isFile:!1;case"-d":return await e.fs.exists(r)?(await e.fs.stat(r)).isDirectory:!1;case"-r":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&256)!==0:!1;case"-w":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&128)!==0:!1;case"-x":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&64)!==0:!1;case"-s":return await e.fs.exists(r)?(await e.fs.stat(r)).size>0:!1;case"-L":case"-h":try{return(await e.fs.lstat(r)).isSymbolicLink}catch{return!1}case"-k":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&512)!==0:!1;case"-g":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&1024)!==0:!1;case"-u":return await e.fs.exists(r)?((await e.fs.stat(r)).mode&2048)!==0:!1;case"-G":case"-O":return e.fs.exists(r);case"-b":return!1;case"-c":return["/dev/null","/dev/zero","/dev/random","/dev/urandom","/dev/tty","/dev/stdin","/dev/stdout","/dev/stderr"].includes(r);case"-p":return!1;case"-S":return!1;case"-t":return!1;case"-N":return e.fs.exists(r);default:return!1}}var tE=["-nt","-ot","-ef"];function da(e){return tE.includes(e)}async function ma(e,t,n,r){let s=Cc(e,n),i=Cc(e,r);switch(t){case"-nt":try{let a=await e.fs.stat(s),o=await e.fs.stat(i);return a.mtime>o.mtime}catch{return!1}case"-ot":try{let a=await e.fs.stat(s),o=await e.fs.stat(i);return a.mtime<o.mtime}catch{return!1}case"-ef":try{if(!await e.fs.exists(s)||!await e.fs.exists(i))return!1;let a=e.fs.resolvePath(e.state.cwd,s),o=e.fs.resolvePath(e.state.cwd,i);return a===o}catch{return!1}default:return!1}}var nE=new Set(["-eq","-ne","-lt","-le","-gt","-ge"]);function ga(e){return nE.has(e)}function ya(e,t,n){switch(e){case"-eq":return t===n;case"-ne":return t!==n;case"-lt":return t<n;case"-le":return t<=n;case"-gt":return t>n;case"-ge":return t>=n}}function _s(e){return e==="="||e==="=="||e==="!="}function wa(e,t,n,r=!1,s=!1,i=!1){if(r){let o=Xr(t,n,s,i);return e==="!="?!o:o}if(s){let o=t.toLowerCase()===n.toLowerCase();return e==="!="?!o:o}let a=t===n;return e==="!="?!a:a}var rE=new Set(["-z","-n"]);function ba(e){return rE.has(e)}function xa(e,t){switch(e){case"-z":return t==="";case"-n":return t!==""}}mt();Xe();Ct();Xt();async function Ea(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let r=n[1],s=n[2];if(e.state.associativeArrays?.has(r)){let o=s;return(o.startsWith("'")&&o.endsWith("'")||o.startsWith('"')&&o.endsWith('"'))&&(o=o.slice(1,-1)),o=o.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(l,c)=>e.state.env.get(c)||""),e.state.env.has(`${r}_${o}`)}let a;try{let o=new ce,l=Ae(o,s);a=await ne(e,l.expression)}catch{if(/^-?\d+$/.test(s))a=Number.parseInt(s,10);else{let o=e.state.env.get(s);a=o?Number.parseInt(o,10):0}}if(a<0){let o=Ye(e,r),l=e.state.currentLine;if(o.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${l}: ${r}: bad array subscript
798
798
  `,!1;if(a=Math.max(...o)+1+a,a<0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${l}: ${r}: bad array subscript
799
- `,!1}return e.state.env.has(`${r}_${a}`)}return e.state.env.has(t)?!0:e.state.associativeArrays?.has(t)?sn(e,t).length>0:Ye(e,t).length>0}async function jn(e,t){switch(t.type){case"CondBinary":{let n=await ie(e,t.left),r=t.right.parts.length>0&&t.right.parts.every(i=>i.type==="SingleQuoted"||i.type==="DoubleQuoted"||i.type==="Escaped"&&t.operator!=="=~"),s;if(t.operator==="=~")if(r){let i=await ie(e,t.right);s=Gr(i)}else s=await gc(e,t.right);else _s(t.operator)&&!r?s=await yc(e,t.right):s=await ie(e,t.right);if(_s(t.operator)){let i=e.state.shoptOptions.nocasematch;return wa(t.operator,n,s,!r,i,!0)}if(ga(t.operator))return ya(t.operator,await Cg(e,n),await Cg(e,s));if(da(t.operator))return ma(e,t.operator,n,s);switch(t.operator){case"=~":try{let i=e.state.shoptOptions.nocasematch,a=oE(s),l=V(a,i?"i":"").match(n);if(wn(e,"BASH_REMATCH"),l)for(let c=0;c<l.length;c++)e.state.env.set(`BASH_REMATCH_${c}`,l[c]||"");return l!==null}catch{throw new Error("syntax error in regular expression")}case"<":return n<s;case">":return n>s;default:return!1}}case"CondUnary":{let n=await ie(e,t.operand);return pa(t.operator)?ha(e,t.operator,n):ba(t.operator)?xa(t.operator,n):t.operator==="-v"?await Ea(e,n):t.operator==="-o"?kc(e,n):!1}case"CondNot":return e.state.shoptOptions.extglob&&t.operand.type==="CondGroup"&&t.operand.expression.type==="CondWord"?`!(${await ie(e,t.operand.expression.word)})`!=="":!await jn(e,t.operand);case"CondAnd":return await jn(e,t.left)?await jn(e,t.right):!1;case"CondOr":return await jn(e,t.left)?!0:await jn(e,t.right);case"CondGroup":return await jn(e,t.expression);case"CondWord":return await ie(e,t.word)!=="";default:return!1}}async function Ls(e,t){if(t.length===0)return z("","",1);if(t.length===1)return Je(!!t[0]);if(t.length===2){let r=t[0],s=t[1];return r==="("?B(`test: '(' without matching ')'
800
- `,2):pa(r)?Je(await ha(e,r,s)):ba(r)?Je(xa(r,s)):r==="!"?Je(!s):r==="-v"?Je(await Ea(e,s)):r==="-o"?Je(kc(e,s)):r==="="||r==="=="||r==="!="||r==="<"||r===">"||r==="-eq"||r==="-ne"||r==="-lt"||r==="-le"||r==="-gt"||r==="-ge"||r==="-nt"||r==="-ot"||r==="-ef"?B(`test: ${r}: unary operator expected
801
- `,2):z("","",1)}if(t.length===3){let r=t[0],s=t[1],i=t[2];if(_s(s))return Je(wa(s,r,i));if(ga(s)){let a=Aa(r),o=Aa(i);return!a.valid||!o.valid?z("","",2):Je(ya(s,a.value,o.value))}if(da(s))return Je(await ma(e,s,r,i));switch(s){case"-a":return Je(r!==""&&i!=="");case"-o":return Je(r!==""||i!=="");case">":return Je(r>i);case"<":return Je(r<i)}if(r==="!"){let a=await Ls(e,[s,i]);return z("",a.stderr,a.exitCode===0?1:a.exitCode===1?0:a.exitCode)}if(r==="("&&i===")")return Je(s!=="")}if(t.length===4){if(t[0]==="!"){let r=await Ls(e,t.slice(1));return z("",r.stderr,r.exitCode===0?1:r.exitCode===1?0:r.exitCode)}if(t[0]==="("&&t[3]===")")return Ls(e,[t[1],t[2]])}let n=await kg(e,t,0);return n.pos<t.length?B(`test: too many arguments
802
- `,2):Je(n.value)}async function kg(e,t,n){return sE(e,t,n)}async function sE(e,t,n){let{value:r,pos:s}=await Sg(e,t,n);for(;t[s]==="-o";){let i=await Sg(e,t,s+1);r=r||i.value,s=i.pos}return{value:r,pos:s}}async function Sg(e,t,n){let{value:r,pos:s}=await Nc(e,t,n);for(;t[s]==="-a";){let i=await Nc(e,t,s+1);r=r&&i.value,s=i.pos}return{value:r,pos:s}}async function Nc(e,t,n){if(t[n]==="!"){let{value:r,pos:s}=await Nc(e,t,n+1);return{value:!r,pos:s}}return iE(e,t,n)}async function iE(e,t,n){let r=t[n];if(r==="("){let{value:i,pos:a}=await kg(e,t,n+1);return{value:i,pos:t[a]===")"?a+1:a}}let s=t[n+1];if(_s(s)){let i=r,a=t[n+2]??"";return{value:wa(s,i,a),pos:n+3}}if(ga(s)){let i=Aa(r),a=Aa(t[n+2]??"0");return!i.valid||!a.valid?{value:!1,pos:n+3}:{value:ya(s,i.value,a.value),pos:n+3}}if(da(s)){let i=r,a=t[n+2]??"";return{value:await ma(e,s,i,a),pos:n+3}}if(pa(r)){let i=t[n+1]??"";return{value:await ha(e,r,i),pos:n+2}}if(ba(r)){let i=t[n+1]??"";return{value:xa(r,i),pos:n+2}}if(r==="-v"){let i=t[n+1]??"";return{value:await Ea(e,i),pos:n+2}}if(r==="-o"){let i=t[n+1]??"";return{value:kc(e,i),pos:n+2}}return{value:r!==void 0&&r!=="",pos:n+1}}function Xr(e,t,n=!1,r=!1){let s=`^${vg(t,r)}$`;return V(s,n?"is":"s").test(e)}function vg(e,t){let n="";for(let r=0;r<e.length;r++){let s=e[r];if(t&&(s==="@"||s==="*"||s==="+"||s==="?"||s==="!")&&r+1<e.length&&e[r+1]==="("){let i=Ig(e,r+1);if(i!==-1){let a=e.slice(r+2,i),o=$g(a),l=o.map(u=>vg(u,t)),c=l.length>0?l.join("|"):"(?:)";if(s==="@")n+=`(?:${c})`;else if(s==="*")n+=`(?:${c})*`;else if(s==="+")n+=`(?:${c})+`;else if(s==="?")n+=`(?:${c})?`;else if(s==="!")if(i<e.length-1){let f=o.map(h=>Og(h,t));if(f.every(h=>h!==null)&&f.every(h=>h===f[0])&&f[0]!==null){let h=f[0];if(h===0)n+="(?:.+)";else{let m=[];h>0&&m.push(`.{0,${h-1}}`),m.push(`.{${h+1},}`),m.push(`(?!(?:${c})).{${h}}`),n+=`(?:${m.join("|")})`}}else n+=`(?:(?!(?:${c})).)*?`}else n+=`(?!(?:${c})$).*`;r=i;continue}}if(s==="\\")if(r+1<e.length){let i=e[r+1];/[\\^$.|+(){}[\]*?]/.test(i)?n+=`\\${i}`:n+=i,r++}else n+="\\\\";else if(s==="*")n+=".*";else if(s==="?")n+=".";else if(s==="["){let i=e.indexOf("]",r+1);i!==-1?(n+=e.slice(r,i+1),r=i):n+="\\["}else/[\\^$.|+(){}]/.test(s)?n+=`\\${s}`:n+=s}return n}function Ig(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function $g(e){let t=[],n="",r=0,s=0;for(;s<e.length;){let i=e[s];if(i==="\\"){n+=i,s+1<e.length?(n+=e[s+1],s+=2):s++;continue}i==="("?(r++,n+=i):i===")"?(r--,n+=i):i==="|"&&r===0?(t.push(n),n=""):n+=i,s++}return t.push(n),t}function Og(e,t){let n=0,r=0;for(;r<e.length;){let s=e[r];if(t&&(s==="@"||s==="*"||s==="+"||s==="?"||s==="!")&&r+1<e.length&&e[r+1]==="("){let i=Ig(e,r+1);if(i!==-1){if(s==="@"){let a=e.slice(r+2,i),l=$g(a).map(c=>Og(c,t));if(l.every(c=>c!==null)&&l.every(c=>c===l[0])){n+=l[0],r=i+1;continue}return null}return null}}if(s==="*")return null;if(s==="?"){n+=1,r++;continue}if(s==="["){let i=e.indexOf("]",r+1);if(i!==-1){n+=1,r=i+1;continue}n+=1,r++;continue}if(s==="\\"){n+=1,r+=2;continue}n+=1,r++}return n}function kc(e,t){let r=new Map([["errexit",()=>e.state.options.errexit===!0],["nounset",()=>e.state.options.nounset===!0],["pipefail",()=>e.state.options.pipefail===!0],["xtrace",()=>e.state.options.xtrace===!0],["e",()=>e.state.options.errexit===!0],["u",()=>e.state.options.nounset===!0],["x",()=>e.state.options.xtrace===!0]]).get(t);return r?r():!1}async function Cg(e,t){if(t=t.trim(),t==="")return 0;if(/^[+-]?(\d+#[a-zA-Z0-9@_]+|0[xX][0-9a-fA-F]+|0[0-7]+|\d+)$/.test(t))return Ng(t);try{let n=new ce,r=Ae(n,t);return await ne(e,r.expression)}catch{return Ng(t)}}function aE(e,t){let n=0;for(let r of e){let s;if(r>="0"&&r<="9")s=r.charCodeAt(0)-48;else if(r>="a"&&r<="z")s=r.charCodeAt(0)-97+10;else if(r>="A"&&r<="Z")s=r.charCodeAt(0)-65+36;else if(r==="@")s=62;else if(r==="_")s=63;else return Number.NaN;if(s>=t)return Number.NaN;n=n*t+s}return n}function Ng(e){if(e=e.trim(),e==="")return 0;let t=!1;e.startsWith("-")?(t=!0,e=e.slice(1)):e.startsWith("+")&&(e=e.slice(1));let n,r=e.match(/^(\d+)#([a-zA-Z0-9@_]+)$/);if(r){let s=Number.parseInt(r[1],10);s>=2&&s<=64?n=aE(r[2],s):n=0}else/^0[xX][0-9a-fA-F]+$/.test(e)?n=Number.parseInt(e,16):/^0[0-7]+$/.test(e)?n=Number.parseInt(e,8):n=Number.parseInt(e,10);return Number.isNaN(n)&&(n=0),t?-n:n}function Aa(e){if(e=e.trim(),e==="")return{value:0,valid:!0};let t=!1;if(e.startsWith("-")?(t=!0,e=e.slice(1)):e.startsWith("+")&&(e=e.slice(1)),!/^\d+$/.test(e))return{value:0,valid:!1};let n=Number.parseInt(e,10);return Number.isNaN(n)?{value:0,valid:!1}:{value:t?-n:n,valid:!0}}function oE(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length)t+=e[n]+e[n+1],n+=2;else if(e[n]==="["){let r=lE(e,n);t+=r.converted,n=r.endIndex}else t+=e[n],n++;return t}function lE(e,t){let n=t+1,r="[";n<e.length&&(e[n]==="^"||e[n]==="!")&&(r+="^",n++);let s=!1;n<e.length&&e[n]==="]"&&(s=!0,n++);let i=!1;n<e.length&&e[n]==="["&&n+1<e.length&&e[n+1]!==":"&&(i=!0,n++);let a="",o=!1;for(;n<e.length;){let l=e[n];if(l==="]"){o=!0,n++;break}if(l==="["&&n+1<e.length&&e[n+1]===":"){let c=e.indexOf(":]",n+2);if(c!==-1){let u=e.slice(n+2,c);a+=cE(u),n=c+2;continue}}if(l==="["&&n+1<e.length){let c=e[n+1];if(c==="."||c==="="){let u=`${c}]`,f=e.indexOf(u,n+2);if(f!==-1){let p=e.slice(n+2,f);a+=p,n=f+2;continue}}}if(l==="\\"&&n+1<e.length){a+=l+e[n+1],n+=2;continue}a+=l,n++}return o?(s&&(r+="\\]"),i&&(r+="\\["),r+=a,r+="]",{converted:r,endIndex:n}):{converted:"\\[",endIndex:t+1}}function cE(e){return new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]]).get(e)??""}Nt();mt();Xe();Ct();Wn();function An(e){let t=[],n="",r=!1,s=!1,i=!1,a=!1;for(let o of e){if(i){n+=o,i=!1,a=!0;continue}if(o==="\\"){i=!0;continue}if(o==="'"&&!s){r||(a=!0),r=!r;continue}if(o==='"'&&!r){s||(a=!0),s=!s;continue}if((o===" "||o===" "||o===`
803
- `)&&!r&&!s){a&&(t.push(n),n="",a=!1);continue}n+=o,a=!0}return a&&t.push(n),t}function Sa(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&/\s/.test(e[n]);)n++;if(n>=e.length)break;if(e[n]!=="["){n++;continue}n++;let r="";if(e[n]==="'"||e[n]==='"'){let i=e[n];for(n++;n<e.length&&e[n]!==i;)r+=e[n],n++;e[n]===i&&n++}else for(;n<e.length&&e[n]!=="]"&&e[n]!=="=";)r+=e[n],n++;for(;n<e.length&&e[n]!=="]";)n++;if(e[n]==="]"&&n++,e[n]!=="=")continue;n++;let s="";if(e[n]==="'"||e[n]==='"'){let i=e[n];for(n++;n<e.length&&e[n]!==i;)e[n]==="\\"&&n+1<e.length&&n++,s+=e[n],n++;e[n]===i&&n++}else for(;n<e.length&&!/\s/.test(e[n]);)s+=e[n],n++;t.push([r,s])}return t}function Rg(e){let t=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(t)return{name:t[1],isArray:!0,arrayElements:An(t[2])};let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(n)return{name:n[1],isArray:!1,arrayIndex:n[2],value:n[3]};if(e.includes("=")){let r=e.indexOf("=");return{name:e.slice(0,r),isArray:!1,value:e.slice(r+1)}}return{name:e,isArray:!1}}async function uE(e,t){try{let n=new ce,r=Ae(n,t);return await ne(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}async function Tg(e,t,n={}){let{name:r,isArray:s,arrayElements:i,value:a,arrayIndex:o}=t,{makeReadonly:l=!1,checkReadonly:c=!0}=n;if(c){let u=it(e,r);if(u)return u}if(s&&i){for(let u=0;u<i.length;u++)e.state.env.set(`${r}_${u}`,i[u]);e.state.env.set(`${r}__length`,String(i.length))}else if(o!==void 0&&a!==void 0){let u=await uE(e,o);e.state.env.set(`${r}_${u}`,a);let f=parseInt(e.state.env.get(`${r}__length`)??"0",10);u>=f&&e.state.env.set(`${r}__length`,String(u+1))}else a!==void 0&&e.state.env.set(r,a);return l&&Mt(e,r),null}function Gn(e,t){e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,e.state.callDepth)}function Yr(e,t){return e.state.localVarDepth?.get(t)}function Ca(e,t){e.state.localVarDepth?.delete(t)}function Pg(e,t,n){e.state.localVarStack=e.state.localVarStack||new Map;let r=e.state.localVarStack.get(t)||[];r.push({value:n,scopeIndex:e.state.localScopes.length-1}),e.state.localVarStack.set(t,r)}function Na(e,t){let n=e.state.localVarStack?.get(t);if(!(!n||n.length===0))return n.pop()}function Dg(e,t){if(e.state.localVarStack)for(let[n,r]of e.state.localVarStack.entries()){for(;r.length>0&&r[r.length-1].scopeIndex===t;)r.pop();r.length===0&&e.state.localVarStack.delete(n)}}ye();Nt();var vc=new Set([":",".","break","continue","eval","exec","exit","export","readonly","return","set","shift","trap","unset"]);function _g(e){return vc.has(e)}var Ic=new Set(["if","then","else","elif","fi","case","esac","for","select","while","until","do","done","in","function","{","}","time","[[","]]","!"]),Jr=new Set([":","true","false","cd","export","unset","exit","local","set","break","continue","return","eval","shift","getopts","compgen","complete","compopt","pushd","popd","dirs","source",".","read","mapfile","readarray","declare","typeset","readonly","let","command","shopt","exec","test","[","echo","printf","pwd","alias","unalias","type","hash","ulimit","umask","trap","times","wait","kill","jobs","fg","bg","disown","suspend","fc","history","help","enable","builtin","caller"]);Nt();async function pr(e,t,n,r){try{if((await e.fs.stat(t)).isDirectory)return`bash: ${n}: Is a directory
799
+ `,!1}return e.state.env.has(`${r}_${a}`)}return e.state.env.has(t)?!0:e.state.associativeArrays?.has(t)?sn(e,t).length>0:Ye(e,t).length>0}async function jn(e,t){switch(t.type){case"CondBinary":{let n=await ie(e,t.left),r=t.right.parts.length>0&&t.right.parts.every(i=>i.type==="SingleQuoted"||i.type==="DoubleQuoted"||i.type==="Escaped"&&t.operator!=="=~"),s;if(t.operator==="=~")if(r){let i=await ie(e,t.right);s=Gr(i)}else s=await gc(e,t.right);else _s(t.operator)&&!r?s=await yc(e,t.right):s=await ie(e,t.right);if(_s(t.operator)){let i=e.state.shoptOptions.nocasematch;return wa(t.operator,n,s,!r,i,!0)}if(ga(t.operator))return ya(t.operator,await Cg(e,n),await Cg(e,s));if(da(t.operator))return ma(e,t.operator,n,s);switch(t.operator){case"=~":try{let i=e.state.shoptOptions.nocasematch,a=oE(s),l=V(a,i?"i":"").match(n);if(wn(e,"BASH_REMATCH"),l)for(let c=0;c<l.length;c++)e.state.env.set(`BASH_REMATCH_${c}`,l[c]||"");return l!==null}catch{throw new Error("syntax error in regular expression")}case"<":return n<s;case">":return n>s;default:return!1}}case"CondUnary":{let n=await ie(e,t.operand);return pa(t.operator)?ha(e,t.operator,n):ba(t.operator)?xa(t.operator,n):t.operator==="-v"?await Ea(e,n):t.operator==="-o"?vc(e,n):!1}case"CondNot":return e.state.shoptOptions.extglob&&t.operand.type==="CondGroup"&&t.operand.expression.type==="CondWord"?`!(${await ie(e,t.operand.expression.word)})`!=="":!await jn(e,t.operand);case"CondAnd":return await jn(e,t.left)?await jn(e,t.right):!1;case"CondOr":return await jn(e,t.left)?!0:await jn(e,t.right);case"CondGroup":return await jn(e,t.expression);case"CondWord":return await ie(e,t.word)!=="";default:return!1}}async function Ls(e,t){if(t.length===0)return z("","",1);if(t.length===1)return Je(!!t[0]);if(t.length===2){let r=t[0],s=t[1];return r==="("?B(`test: '(' without matching ')'
800
+ `,2):pa(r)?Je(await ha(e,r,s)):ba(r)?Je(xa(r,s)):r==="!"?Je(!s):r==="-v"?Je(await Ea(e,s)):r==="-o"?Je(vc(e,s)):r==="="||r==="=="||r==="!="||r==="<"||r===">"||r==="-eq"||r==="-ne"||r==="-lt"||r==="-le"||r==="-gt"||r==="-ge"||r==="-nt"||r==="-ot"||r==="-ef"?B(`test: ${r}: unary operator expected
801
+ `,2):z("","",1)}if(t.length===3){let r=t[0],s=t[1],i=t[2];if(_s(s))return Je(wa(s,r,i));if(ga(s)){let a=Aa(r),o=Aa(i);return!a.valid||!o.valid?z("","",2):Je(ya(s,a.value,o.value))}if(da(s))return Je(await ma(e,s,r,i));switch(s){case"-a":return Je(r!==""&&i!=="");case"-o":return Je(r!==""||i!=="");case">":return Je(r>i);case"<":return Je(r<i)}if(r==="!"){let a=await Ls(e,[s,i]);return z("",a.stderr,a.exitCode===0?1:a.exitCode===1?0:a.exitCode)}if(r==="("&&i===")")return Je(s!=="")}if(t.length===4){if(t[0]==="!"){let r=await Ls(e,t.slice(1));return z("",r.stderr,r.exitCode===0?1:r.exitCode===1?0:r.exitCode)}if(t[0]==="("&&t[3]===")")return Ls(e,[t[1],t[2]])}let n=await vg(e,t,0);return n.pos<t.length?B(`test: too many arguments
802
+ `,2):Je(n.value)}async function vg(e,t,n){return sE(e,t,n)}async function sE(e,t,n){let{value:r,pos:s}=await Sg(e,t,n);for(;t[s]==="-o";){let i=await Sg(e,t,s+1);r=r||i.value,s=i.pos}return{value:r,pos:s}}async function Sg(e,t,n){let{value:r,pos:s}=await Nc(e,t,n);for(;t[s]==="-a";){let i=await Nc(e,t,s+1);r=r&&i.value,s=i.pos}return{value:r,pos:s}}async function Nc(e,t,n){if(t[n]==="!"){let{value:r,pos:s}=await Nc(e,t,n+1);return{value:!r,pos:s}}return iE(e,t,n)}async function iE(e,t,n){let r=t[n];if(r==="("){let{value:i,pos:a}=await vg(e,t,n+1);return{value:i,pos:t[a]===")"?a+1:a}}let s=t[n+1];if(_s(s)){let i=r,a=t[n+2]??"";return{value:wa(s,i,a),pos:n+3}}if(ga(s)){let i=Aa(r),a=Aa(t[n+2]??"0");return!i.valid||!a.valid?{value:!1,pos:n+3}:{value:ya(s,i.value,a.value),pos:n+3}}if(da(s)){let i=r,a=t[n+2]??"";return{value:await ma(e,s,i,a),pos:n+3}}if(pa(r)){let i=t[n+1]??"";return{value:await ha(e,r,i),pos:n+2}}if(ba(r)){let i=t[n+1]??"";return{value:xa(r,i),pos:n+2}}if(r==="-v"){let i=t[n+1]??"";return{value:await Ea(e,i),pos:n+2}}if(r==="-o"){let i=t[n+1]??"";return{value:vc(e,i),pos:n+2}}return{value:r!==void 0&&r!=="",pos:n+1}}function Xr(e,t,n=!1,r=!1){let s=`^${kg(t,r)}$`;return V(s,n?"is":"s").test(e)}function kg(e,t){let n="";for(let r=0;r<e.length;r++){let s=e[r];if(t&&(s==="@"||s==="*"||s==="+"||s==="?"||s==="!")&&r+1<e.length&&e[r+1]==="("){let i=Ig(e,r+1);if(i!==-1){let a=e.slice(r+2,i),o=$g(a),l=o.map(u=>kg(u,t)),c=l.length>0?l.join("|"):"(?:)";if(s==="@")n+=`(?:${c})`;else if(s==="*")n+=`(?:${c})*`;else if(s==="+")n+=`(?:${c})+`;else if(s==="?")n+=`(?:${c})?`;else if(s==="!")if(i<e.length-1){let f=o.map(h=>Og(h,t));if(f.every(h=>h!==null)&&f.every(h=>h===f[0])&&f[0]!==null){let h=f[0];if(h===0)n+="(?:.+)";else{let m=[];h>0&&m.push(`.{0,${h-1}}`),m.push(`.{${h+1},}`),m.push(`(?!(?:${c})).{${h}}`),n+=`(?:${m.join("|")})`}}else n+=`(?:(?!(?:${c})).)*?`}else n+=`(?!(?:${c})$).*`;r=i;continue}}if(s==="\\")if(r+1<e.length){let i=e[r+1];/[\\^$.|+(){}[\]*?]/.test(i)?n+=`\\${i}`:n+=i,r++}else n+="\\\\";else if(s==="*")n+=".*";else if(s==="?")n+=".";else if(s==="["){let i=e.indexOf("]",r+1);i!==-1?(n+=e.slice(r,i+1),r=i):n+="\\["}else/[\\^$.|+(){}]/.test(s)?n+=`\\${s}`:n+=s}return n}function Ig(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function $g(e){let t=[],n="",r=0,s=0;for(;s<e.length;){let i=e[s];if(i==="\\"){n+=i,s+1<e.length?(n+=e[s+1],s+=2):s++;continue}i==="("?(r++,n+=i):i===")"?(r--,n+=i):i==="|"&&r===0?(t.push(n),n=""):n+=i,s++}return t.push(n),t}function Og(e,t){let n=0,r=0;for(;r<e.length;){let s=e[r];if(t&&(s==="@"||s==="*"||s==="+"||s==="?"||s==="!")&&r+1<e.length&&e[r+1]==="("){let i=Ig(e,r+1);if(i!==-1){if(s==="@"){let a=e.slice(r+2,i),l=$g(a).map(c=>Og(c,t));if(l.every(c=>c!==null)&&l.every(c=>c===l[0])){n+=l[0],r=i+1;continue}return null}return null}}if(s==="*")return null;if(s==="?"){n+=1,r++;continue}if(s==="["){let i=e.indexOf("]",r+1);if(i!==-1){n+=1,r=i+1;continue}n+=1,r++;continue}if(s==="\\"){n+=1,r+=2;continue}n+=1,r++}return n}function vc(e,t){let r=new Map([["errexit",()=>e.state.options.errexit===!0],["nounset",()=>e.state.options.nounset===!0],["pipefail",()=>e.state.options.pipefail===!0],["xtrace",()=>e.state.options.xtrace===!0],["e",()=>e.state.options.errexit===!0],["u",()=>e.state.options.nounset===!0],["x",()=>e.state.options.xtrace===!0]]).get(t);return r?r():!1}async function Cg(e,t){if(t=t.trim(),t==="")return 0;if(/^[+-]?(\d+#[a-zA-Z0-9@_]+|0[xX][0-9a-fA-F]+|0[0-7]+|\d+)$/.test(t))return Ng(t);try{let n=new ce,r=Ae(n,t);return await ne(e,r.expression)}catch{return Ng(t)}}function aE(e,t){let n=0;for(let r of e){let s;if(r>="0"&&r<="9")s=r.charCodeAt(0)-48;else if(r>="a"&&r<="z")s=r.charCodeAt(0)-97+10;else if(r>="A"&&r<="Z")s=r.charCodeAt(0)-65+36;else if(r==="@")s=62;else if(r==="_")s=63;else return Number.NaN;if(s>=t)return Number.NaN;n=n*t+s}return n}function Ng(e){if(e=e.trim(),e==="")return 0;let t=!1;e.startsWith("-")?(t=!0,e=e.slice(1)):e.startsWith("+")&&(e=e.slice(1));let n,r=e.match(/^(\d+)#([a-zA-Z0-9@_]+)$/);if(r){let s=Number.parseInt(r[1],10);s>=2&&s<=64?n=aE(r[2],s):n=0}else/^0[xX][0-9a-fA-F]+$/.test(e)?n=Number.parseInt(e,16):/^0[0-7]+$/.test(e)?n=Number.parseInt(e,8):n=Number.parseInt(e,10);return Number.isNaN(n)&&(n=0),t?-n:n}function Aa(e){if(e=e.trim(),e==="")return{value:0,valid:!0};let t=!1;if(e.startsWith("-")?(t=!0,e=e.slice(1)):e.startsWith("+")&&(e=e.slice(1)),!/^\d+$/.test(e))return{value:0,valid:!1};let n=Number.parseInt(e,10);return Number.isNaN(n)?{value:0,valid:!1}:{value:t?-n:n,valid:!0}}function oE(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length)t+=e[n]+e[n+1],n+=2;else if(e[n]==="["){let r=lE(e,n);t+=r.converted,n=r.endIndex}else t+=e[n],n++;return t}function lE(e,t){let n=t+1,r="[";n<e.length&&(e[n]==="^"||e[n]==="!")&&(r+="^",n++);let s=!1;n<e.length&&e[n]==="]"&&(s=!0,n++);let i=!1;n<e.length&&e[n]==="["&&n+1<e.length&&e[n+1]!==":"&&(i=!0,n++);let a="",o=!1;for(;n<e.length;){let l=e[n];if(l==="]"){o=!0,n++;break}if(l==="["&&n+1<e.length&&e[n+1]===":"){let c=e.indexOf(":]",n+2);if(c!==-1){let u=e.slice(n+2,c);a+=cE(u),n=c+2;continue}}if(l==="["&&n+1<e.length){let c=e[n+1];if(c==="."||c==="="){let u=`${c}]`,f=e.indexOf(u,n+2);if(f!==-1){let p=e.slice(n+2,f);a+=p,n=f+2;continue}}}if(l==="\\"&&n+1<e.length){a+=l+e[n+1],n+=2;continue}a+=l,n++}return o?(s&&(r+="\\]"),i&&(r+="\\["),r+=a,r+="]",{converted:r,endIndex:n}):{converted:"\\[",endIndex:t+1}}function cE(e){return new Map([["alnum","a-zA-Z0-9"],["alpha","a-zA-Z"],["ascii","\\x00-\\x7F"],["blank"," \\t"],["cntrl","\\x00-\\x1F\\x7F"],["digit","0-9"],["graph","!-~"],["lower","a-z"],["print"," -~"],["punct","!-/:-@\\[-`{-~"],["space"," \\t\\n\\r\\f\\v"],["upper","A-Z"],["word","a-zA-Z0-9_"],["xdigit","0-9A-Fa-f"]]).get(e)??""}Nt();mt();Xe();Ct();Wn();function An(e){let t=[],n="",r=!1,s=!1,i=!1,a=!1;for(let o of e){if(i){n+=o,i=!1,a=!0;continue}if(o==="\\"){i=!0;continue}if(o==="'"&&!s){r||(a=!0),r=!r;continue}if(o==='"'&&!r){s||(a=!0),s=!s;continue}if((o===" "||o===" "||o===`
803
+ `)&&!r&&!s){a&&(t.push(n),n="",a=!1);continue}n+=o,a=!0}return a&&t.push(n),t}function Sa(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&/\s/.test(e[n]);)n++;if(n>=e.length)break;if(e[n]!=="["){n++;continue}n++;let r="";if(e[n]==="'"||e[n]==='"'){let i=e[n];for(n++;n<e.length&&e[n]!==i;)r+=e[n],n++;e[n]===i&&n++}else for(;n<e.length&&e[n]!=="]"&&e[n]!=="=";)r+=e[n],n++;for(;n<e.length&&e[n]!=="]";)n++;if(e[n]==="]"&&n++,e[n]!=="=")continue;n++;let s="";if(e[n]==="'"||e[n]==='"'){let i=e[n];for(n++;n<e.length&&e[n]!==i;)e[n]==="\\"&&n+1<e.length&&n++,s+=e[n],n++;e[n]===i&&n++}else for(;n<e.length&&!/\s/.test(e[n]);)s+=e[n],n++;t.push([r,s])}return t}function Rg(e){let t=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(t)return{name:t[1],isArray:!0,arrayElements:An(t[2])};let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(n)return{name:n[1],isArray:!1,arrayIndex:n[2],value:n[3]};if(e.includes("=")){let r=e.indexOf("=");return{name:e.slice(0,r),isArray:!1,value:e.slice(r+1)}}return{name:e,isArray:!1}}async function uE(e,t){try{let n=new ce,r=Ae(n,t);return await ne(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}async function Tg(e,t,n={}){let{name:r,isArray:s,arrayElements:i,value:a,arrayIndex:o}=t,{makeReadonly:l=!1,checkReadonly:c=!0}=n;if(c){let u=it(e,r);if(u)return u}if(s&&i){for(let u=0;u<i.length;u++)e.state.env.set(`${r}_${u}`,i[u]);e.state.env.set(`${r}__length`,String(i.length))}else if(o!==void 0&&a!==void 0){let u=await uE(e,o);e.state.env.set(`${r}_${u}`,a);let f=parseInt(e.state.env.get(`${r}__length`)??"0",10);u>=f&&e.state.env.set(`${r}__length`,String(u+1))}else a!==void 0&&e.state.env.set(r,a);return l&&Mt(e,r),null}function Gn(e,t){e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,e.state.callDepth)}function Yr(e,t){return e.state.localVarDepth?.get(t)}function Ca(e,t){e.state.localVarDepth?.delete(t)}function Pg(e,t,n){e.state.localVarStack=e.state.localVarStack||new Map;let r=e.state.localVarStack.get(t)||[];r.push({value:n,scopeIndex:e.state.localScopes.length-1}),e.state.localVarStack.set(t,r)}function Na(e,t){let n=e.state.localVarStack?.get(t);if(!(!n||n.length===0))return n.pop()}function Dg(e,t){if(e.state.localVarStack)for(let[n,r]of e.state.localVarStack.entries()){for(;r.length>0&&r[r.length-1].scopeIndex===t;)r.pop();r.length===0&&e.state.localVarStack.delete(n)}}ye();Nt();var kc=new Set([":",".","break","continue","eval","exec","exit","export","readonly","return","set","shift","trap","unset"]);function _g(e){return kc.has(e)}var Ic=new Set(["if","then","else","elif","fi","case","esac","for","select","while","until","do","done","in","function","{","}","time","[[","]]","!"]),Jr=new Set([":","true","false","cd","export","unset","exit","local","set","break","continue","return","eval","shift","getopts","compgen","complete","compopt","pushd","popd","dirs","source",".","read","mapfile","readarray","declare","typeset","readonly","let","command","shopt","exec","test","[","echo","printf","pwd","alias","unalias","type","hash","ulimit","umask","trap","times","wait","kill","jobs","fg","bg","disown","suspend","fc","history","help","enable","builtin","caller"]);Nt();async function pr(e,t,n,r){try{if((await e.fs.stat(t)).isDirectory)return`bash: ${n}: Is a directory
804
804
  `;if(r.checkNoclobber&&e.state.options.noclobber&&!r.isClobber&&n!=="/dev/null")return`bash: ${n}: cannot overwrite existing file
805
805
  `}catch{}return null}function at(e){let n=Math.min(e.length,8192);for(let r=0;r<n;r++)if(e.charCodeAt(r)>255)return"utf8";return"binary"}function fE(e){if(!e.startsWith("__rw__:"))return null;let t=e.slice(7),n=t.indexOf(":");if(n===-1)return null;let r=Number.parseInt(t.slice(0,n),10);if(Number.isNaN(r)||r<0)return null;let s=n+1,i=t.slice(s,s+r),a=s+r+1,o=t.slice(a),l=o.indexOf(":");if(l===-1)return null;let c=Number.parseInt(o.slice(0,l),10);if(Number.isNaN(c)||c<0)return null;let u=o.slice(l+1);return{path:i,position:c,content:u}}async function Lg(e,t){let n=new Map;for(let r=0;r<t.length;r++){let s=t[r];if(s.target.type==="HereDoc")continue;if(s.operator===">&"||s.operator==="<&"){if(Ps(e,s.target))return{targets:n,error:`bash: $@: ambiguous redirect
806
- `};n.set(r,await ie(e,s.target))}else{let a=await Ds(e,s.target);if("error"in a)return{targets:n,error:a.error};n.set(r,a.target)}}return{targets:n}}function pE(e){e.state.nextFd===void 0&&(e.state.nextFd=10);let t=e.state.nextFd;return e.state.nextFd++,t}async function ka(e,t){for(let n of t){if(!n.fdVariable)continue;if(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),(n.operator===">&"||n.operator==="<&")&&n.target.type==="Word"&&await ie(e,n.target)==="-"){let i=e.state.env.get(n.fdVariable);if(i!==void 0){let a=Number.parseInt(i,10);Number.isNaN(a)||e.state.fileDescriptors.delete(a)}continue}let r=pE(e);if(e.state.env.set(n.fdVariable,String(r)),n.target.type==="Word"){let s=await ie(e,n.target);if(n.operator===">&"||n.operator==="<&"){let i=Number.parseInt(s,10);if(!Number.isNaN(i)){let a=e.state.fileDescriptors.get(i);a!==void 0&&e.state.fileDescriptors.set(r,a);continue}}if(n.operator===">"||n.operator===">>"||n.operator===">|"||n.operator==="&>"||n.operator==="&>>"){let i=e.fs.resolvePath(e.state.cwd,s);(n.operator===">"||n.operator===">|"||n.operator==="&>")&&await e.fs.writeFile(i,"","binary"),e.state.fileDescriptors.set(r,`__file__:${i}`)}else if(n.operator==="<<<")e.state.fileDescriptors.set(r,`${s}
806
+ `};n.set(r,await ie(e,s.target))}else{let a=await Ds(e,s.target);if("error"in a)return{targets:n,error:a.error};n.set(r,a.target)}}return{targets:n}}function pE(e){e.state.nextFd===void 0&&(e.state.nextFd=10);let t=e.state.nextFd;return e.state.nextFd++,t}async function va(e,t){for(let n of t){if(!n.fdVariable)continue;if(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),(n.operator===">&"||n.operator==="<&")&&n.target.type==="Word"&&await ie(e,n.target)==="-"){let i=e.state.env.get(n.fdVariable);if(i!==void 0){let a=Number.parseInt(i,10);Number.isNaN(a)||e.state.fileDescriptors.delete(a)}continue}let r=pE(e);if(e.state.env.set(n.fdVariable,String(r)),n.target.type==="Word"){let s=await ie(e,n.target);if(n.operator===">&"||n.operator==="<&"){let i=Number.parseInt(s,10);if(!Number.isNaN(i)){let a=e.state.fileDescriptors.get(i);a!==void 0&&e.state.fileDescriptors.set(r,a);continue}}if(n.operator===">"||n.operator===">>"||n.operator===">|"||n.operator==="&>"||n.operator==="&>>"){let i=e.fs.resolvePath(e.state.cwd,s);(n.operator===">"||n.operator===">|"||n.operator==="&>")&&await e.fs.writeFile(i,"","binary"),e.state.fileDescriptors.set(r,`__file__:${i}`)}else if(n.operator==="<<<")e.state.fileDescriptors.set(r,`${s}
807
807
  `);else if(n.operator==="<"||n.operator==="<>")try{let i=e.fs.resolvePath(e.state.cwd,s),a=await e.fs.readFile(i);e.state.fileDescriptors.set(r,a)}catch{return z("",`bash: ${s}: No such file or directory
808
808
  `,1)}}}return null}async function Sn(e,t){for(let n of t){if(n.target.type==="HereDoc")continue;let r=n.operator===">&";if(n.operator!==">"&&n.operator!==">|"&&n.operator!=="&>"&&!r)continue;let s;if(r){if(s=await ie(e,n.target),s==="-"||!Number.isNaN(Number.parseInt(s,10))||n.fd!=null)continue}else{let o=await Ds(e,n.target);if("error"in o)return z("",o.error,1);s=o.target}let i=e.fs.resolvePath(e.state.cwd,s),a=n.operator===">|";if(i.includes("\0"))return z("",`bash: ${s}: No such file or directory
809
809
  `,1);try{let o=await e.fs.stat(i);if(o.isDirectory)return z("",`bash: ${s}: Is a directory
@@ -820,11 +820,11 @@ Gid: ${s} ${s} ${s} ${s}
820
820
  `,a=1,s=""):m>=3&&(i+=`bash: ${m}: Bad file descriptor
821
821
  `,a=1,s="")}}break}case"&>":{if(f==="/dev/full"){i=`bash: echo: write error: No space left on device
822
822
  `,a=1,s="";break}let h=e.fs.resolvePath(e.state.cwd,f),m=await pr(e,h,f,{checkNoclobber:!0});if(m){i=m,a=1,s="";break}let d=s+i;await e.fs.writeFile(h,d,at(d)),s="",i="";break}case"&>>":{if(f==="/dev/full"){i=`bash: echo: write error: No space left on device
823
- `,a=1,s="";break}let h=e.fs.resolvePath(e.state.cwd,f),m=await pr(e,h,f,{});if(m){i=m,a=1,s="";break}let d=s+i;await e.fs.appendFile(h,d,at(d)),s="",i="";break}}}}let o=e.state.fileDescriptors?.get(1);if(o){if(o==="__dupout__:2")i+=s,s="";else if(o.startsWith("__file__:")){let c=o.slice(9);await e.fs.appendFile(c,s,at(s)),s=""}else if(o.startsWith("__file_append__:")){let c=o.slice(16);await e.fs.appendFile(c,s,at(s)),s=""}}let l=e.state.fileDescriptors?.get(2);if(l){if(l==="__dupout__:1")s+=i,i="";else if(l.startsWith("__file__:")){let c=l.slice(9);await e.fs.appendFile(c,i,at(i)),i=""}else if(l.startsWith("__file_append__:")){let c=l.slice(16);await e.fs.appendFile(c,i,at(i)),i=""}}return z(s,i,a)}function Fg(e,t){if(e.state.options.posix&&vc.has(t.name)){let r=`bash: line ${e.state.currentLine}: \`${t.name}': is a special builtin
823
+ `,a=1,s="";break}let h=e.fs.resolvePath(e.state.cwd,f),m=await pr(e,h,f,{});if(m){i=m,a=1,s="";break}let d=s+i;await e.fs.appendFile(h,d,at(d)),s="",i="";break}}}}let o=e.state.fileDescriptors?.get(1);if(o){if(o==="__dupout__:2")i+=s,s="";else if(o.startsWith("__file__:")){let c=o.slice(9);await e.fs.appendFile(c,s,at(s)),s=""}else if(o.startsWith("__file_append__:")){let c=o.slice(16);await e.fs.appendFile(c,s,at(s)),s=""}}let l=e.state.fileDescriptors?.get(2);if(l){if(l==="__dupout__:1")s+=i,i="";else if(l.startsWith("__file__:")){let c=l.slice(9);await e.fs.appendFile(c,i,at(i)),i=""}else if(l.startsWith("__file_append__:")){let c=l.slice(16);await e.fs.appendFile(c,i,at(i)),i=""}}return z(s,i,a)}function Fg(e,t){if(e.state.options.posix&&kc.has(t.name)){let r=`bash: line ${e.state.currentLine}: \`${t.name}': is a special builtin
824
824
  `;throw new pe(2,"",r)}let n={...t,sourceFile:t.sourceFile??e.state.currentSource??"main"};return e.state.functions.set(t.name,n),de}async function hE(e,t){let n="";for(let r of t)if((r.operator==="<<"||r.operator==="<<-")&&r.target.type==="HereDoc"){let s=r.target,i=await ie(e,s.content);s.stripTabs&&(i=i.split(`
825
825
  `).map(o=>o.replace(/^\t+/,"")).join(`
826
826
  `)),(r.fd??0)===0&&(n=i)}else if(r.operator==="<<<"&&r.target.type==="Word")n=`${await ie(e,r.target)}
827
- `;else if(r.operator==="<"&&r.target.type==="Word"){let s=await ie(e,r.target),i=e.fs.resolvePath(e.state.cwd,s);try{n=await e.fs.readFile(i)}catch{}}return n}async function va(e,t,n,r="",s){e.state.callDepth++,e.state.callDepth>e.limits.maxCallDepth&&(e.state.callDepth--,On(`${t.name}: maximum recursion depth (${e.limits.maxCallDepth}) exceeded, increase executionLimits.maxCallDepth`,"recursion")),e.state.funcNameStack||(e.state.funcNameStack=[]),e.state.callLineStack||(e.state.callLineStack=[]),e.state.sourceStack||(e.state.sourceStack=[]),e.state.funcNameStack.unshift(t.name),e.state.callLineStack.unshift(s??e.state.currentLine),e.state.sourceStack.unshift(t.sourceFile??"main"),e.state.localScopes.push(new Map),e.state.localExportedVars||(e.state.localExportedVars=[]),e.state.localExportedVars.push(new Set);let i=new Map;for(let c=0;c<n.length;c++)i.set(String(c+1),e.state.env.get(String(c+1))),e.state.env.set(String(c+1),n[c]);i.set("@",e.state.env.get("@")),i.set("#",e.state.env.get("#")),e.state.env.set("@",n.join(" ")),e.state.env.set("#",String(n.length));let a=()=>{let c=e.state.localScopes.length-1,u=e.state.localScopes.pop();if(u)for(let[f,p]of u)p===void 0?e.state.env.delete(f):e.state.env.set(f,p);if(Dg(e,c),e.state.fullyUnsetLocals)for(let[f,p]of e.state.fullyUnsetLocals.entries())p===c&&e.state.fullyUnsetLocals.delete(f);if(e.state.localExportedVars&&e.state.localExportedVars.length>0){let f=e.state.localExportedVars.pop();if(f)for(let p of f)e.state.exportedVars?.delete(p)}for(let[f,p]of i)p===void 0?e.state.env.delete(f):e.state.env.set(f,p);e.state.funcNameStack?.shift(),e.state.callLineStack?.shift(),e.state.sourceStack?.shift(),e.state.callDepth--},{targets:o,error:l}=await Lg(e,t.redirections);if(l)return a(),z("",l,1);try{let c=await hE(e,t.redirections),u=r||c,f=await e.executeCommand(t.body,u);return a(),ze(e,f,t.redirections,o)}catch(c){if(a(),c instanceof ut){let u=z(c.stdout,c.stderr,c.exitCode);return ze(e,u,t.redirections,o)}throw c}}var Ug=["!","[[","]]","case","do","done","elif","else","esac","fi","for","function","if","in","then","time","until","while","{","}"],Oc=[".",":","[","alias","bg","bind","break","builtin","caller","cd","command","compgen","complete","compopt","continue","declare","dirs","disown","echo","enable","eval","exec","exit","export","false","fc","fg","getopts","hash","help","history","jobs","kill","let","local","logout","mapfile","popd","printf","pushd","pwd","read","readarray","readonly","return","set","shift","shopt","source","suspend","test","times","trap","true","type","typeset","ulimit","umask","unalias","unset","wait"],dE=["autocd","assoc_expand_once","cdable_vars","cdspell","checkhash","checkjobs","checkwinsize","cmdhist","compat31","compat32","compat40","compat41","compat42","compat43","compat44","complete_fullquote","direxpand","dirspell","dotglob","execfail","expand_aliases","extdebug","extglob","extquote","failglob","force_fignore","globasciiranges","globstar","gnu_errfmt","histappend","histreedit","histverify","hostcomplete","huponexit","inherit_errexit","interactive_comments","lastpipe","lithist","localvar_inherit","localvar_unset","login_shell","mailwarn","no_empty_cmd_completion","nocaseglob","nocasematch","nullglob","progcomp","progcomp_alias","promptvars","restricted_shell","shift_verbose","sourcepath","xpg_echo"],mE=Oc;async function Rc(e,t){let n=[],r=null,s="",i="",a=null,o=!1,l=!1,c=!1,u=null,f=null,p=null,h=[],m=["alias","arrayvar","binding","builtin","command","directory","disabled","enabled","export","file","function","group","helptopic","hostname","job","keyword","running","service","setopt","shopt","signal","stopped","user","variable"];for(let x=0;x<t.length;x++){let S=t[x];if(S==="-v")n.push("variable");else if(S==="-e")n.push("export");else if(S==="-f")n.push("file");else if(S==="-d")n.push("directory");else if(S==="-k")n.push("keyword");else if(S==="-A"){if(x++,x>=t.length)return B(`compgen: -A: option requires an argument
827
+ `;else if(r.operator==="<"&&r.target.type==="Word"){let s=await ie(e,r.target),i=e.fs.resolvePath(e.state.cwd,s);try{n=await e.fs.readFile(i)}catch{}}return n}async function ka(e,t,n,r="",s){e.state.callDepth++,e.state.callDepth>e.limits.maxCallDepth&&(e.state.callDepth--,On(`${t.name}: maximum recursion depth (${e.limits.maxCallDepth}) exceeded, increase executionLimits.maxCallDepth`,"recursion")),e.state.funcNameStack||(e.state.funcNameStack=[]),e.state.callLineStack||(e.state.callLineStack=[]),e.state.sourceStack||(e.state.sourceStack=[]),e.state.funcNameStack.unshift(t.name),e.state.callLineStack.unshift(s??e.state.currentLine),e.state.sourceStack.unshift(t.sourceFile??"main"),e.state.localScopes.push(new Map),e.state.localExportedVars||(e.state.localExportedVars=[]),e.state.localExportedVars.push(new Set);let i=new Map;for(let c=0;c<n.length;c++)i.set(String(c+1),e.state.env.get(String(c+1))),e.state.env.set(String(c+1),n[c]);i.set("@",e.state.env.get("@")),i.set("#",e.state.env.get("#")),e.state.env.set("@",n.join(" ")),e.state.env.set("#",String(n.length));let a=()=>{let c=e.state.localScopes.length-1,u=e.state.localScopes.pop();if(u)for(let[f,p]of u)p===void 0?e.state.env.delete(f):e.state.env.set(f,p);if(Dg(e,c),e.state.fullyUnsetLocals)for(let[f,p]of e.state.fullyUnsetLocals.entries())p===c&&e.state.fullyUnsetLocals.delete(f);if(e.state.localExportedVars&&e.state.localExportedVars.length>0){let f=e.state.localExportedVars.pop();if(f)for(let p of f)e.state.exportedVars?.delete(p)}for(let[f,p]of i)p===void 0?e.state.env.delete(f):e.state.env.set(f,p);e.state.funcNameStack?.shift(),e.state.callLineStack?.shift(),e.state.sourceStack?.shift(),e.state.callDepth--},{targets:o,error:l}=await Lg(e,t.redirections);if(l)return a(),z("",l,1);try{let c=await hE(e,t.redirections),u=r||c,f=await e.executeCommand(t.body,u);return a(),ze(e,f,t.redirections,o)}catch(c){if(a(),c instanceof ut){let u=z(c.stdout,c.stderr,c.exitCode);return ze(e,u,t.redirections,o)}throw c}}var Ug=["!","[[","]]","case","do","done","elif","else","esac","fi","for","function","if","in","then","time","until","while","{","}"],Oc=[".",":","[","alias","bg","bind","break","builtin","caller","cd","command","compgen","complete","compopt","continue","declare","dirs","disown","echo","enable","eval","exec","exit","export","false","fc","fg","getopts","hash","help","history","jobs","kill","let","local","logout","mapfile","popd","printf","pushd","pwd","read","readarray","readonly","return","set","shift","shopt","source","suspend","test","times","trap","true","type","typeset","ulimit","umask","unalias","unset","wait"],dE=["autocd","assoc_expand_once","cdable_vars","cdspell","checkhash","checkjobs","checkwinsize","cmdhist","compat31","compat32","compat40","compat41","compat42","compat43","compat44","complete_fullquote","direxpand","dirspell","dotglob","execfail","expand_aliases","extdebug","extglob","extquote","failglob","force_fignore","globasciiranges","globstar","gnu_errfmt","histappend","histreedit","histverify","hostcomplete","huponexit","inherit_errexit","interactive_comments","lastpipe","lithist","localvar_inherit","localvar_unset","login_shell","mailwarn","no_empty_cmd_completion","nocaseglob","nocasematch","nullglob","progcomp","progcomp_alias","promptvars","restricted_shell","shift_verbose","sourcepath","xpg_echo"],mE=Oc;async function Rc(e,t){let n=[],r=null,s="",i="",a=null,o=!1,l=!1,c=!1,u=null,f=null,p=null,h=[],m=["alias","arrayvar","binding","builtin","command","directory","disabled","enabled","export","file","function","group","helptopic","hostname","job","keyword","running","service","setopt","shopt","signal","stopped","user","variable"];for(let x=0;x<t.length;x++){let S=t[x];if(S==="-v")n.push("variable");else if(S==="-e")n.push("export");else if(S==="-f")n.push("file");else if(S==="-d")n.push("directory");else if(S==="-k")n.push("keyword");else if(S==="-A"){if(x++,x>=t.length)return B(`compgen: -A: option requires an argument
828
828
  `,2);let $=t[x];if(!m.includes($))return B(`compgen: ${$}: invalid action name
829
829
  `,2);n.push($)}else if(S==="-W"){if(x++,x>=t.length)return B(`compgen: -W: option requires an argument
830
830
  `,2);r=t[x]}else if(S==="-P"){if(x++,x>=t.length)return B(`compgen: -P: option requires an argument
@@ -835,11 +835,11 @@ Gid: ${s} ${s} ${s} ${s}
835
835
  `,2);f=t[x]}else if(S==="-C"){if(x++,x>=t.length)return B(`compgen: -C: option requires an argument
836
836
  `,2);p=t[x]}else if(S==="-X"){if(x++,x>=t.length)return B(`compgen: -X: option requires an argument
837
837
  `,2);u=t[x]}else if(S==="-G"){if(x++,x>=t.length)return B(`compgen: -G: option requires an argument
838
- `,2)}else if(S==="--"){h.push(...t.slice(x+1));break}else S.startsWith("-")||h.push(S)}a=h[0]??null;let d=[];if(l){let x=await $c(e,a);d.push(...x)}if(c){let x=await Mg(e,a);d.push(...x)}for(let x of n)if(x==="variable"){let S=gE(e,a);d.push(...S)}else if(x==="export"){let S=yE(e,a);d.push(...S)}else if(x==="function"){let S=wE(e,a);d.push(...S)}else if(x==="builtin"){let S=bE(a);d.push(...S)}else if(x==="keyword"){let S=xE(a);d.push(...S)}else if(x==="alias"){let S=EE(e,a);d.push(...S)}else if(x==="shopt"){let S=AE(a);d.push(...S)}else if(x==="helptopic"){let S=SE(a);d.push(...S)}else if(x==="directory"){let S=await $c(e,a);d.push(...S)}else if(x==="file"){let S=await Mg(e,a);d.push(...S)}else if(x==="user"){let S=CE(a);d.push(...S)}else if(x==="command"){let S=await NE(e,a);d.push(...S)}if(r!==null)try{let x=await kE(e,r),S=vE(e,x);for(let $ of S)(a===null||$.startsWith(a))&&d.push($)}catch{return z("","",1)}if(o){let x=await $c(e,a);for(let S of x)d.includes(S)||d.push(S)}let g="";if(f!==null){let x=e.state.functions.get(f);if(x){let S=new Map;S.set("COMP_WORDS__length",e.state.env.get("COMP_WORDS__length")),e.state.env.set("COMP_WORDS__length","0"),S.set("COMP_CWORD",e.state.env.get("COMP_CWORD")),e.state.env.set("COMP_CWORD","-1"),S.set("COMP_LINE",e.state.env.get("COMP_LINE")),e.state.env.set("COMP_LINE",""),S.set("COMP_POINT",e.state.env.get("COMP_POINT")),e.state.env.set("COMP_POINT","0");let $=new Map;for(let L of e.state.env.keys())(L==="COMPREPLY"||L.startsWith("COMPREPLY_")||L==="COMPREPLY__length")&&($.set(L,e.state.env.get(L)),e.state.env.delete(L));let O=["compgen",h[0]??"",""];try{let L=await va(e,x,O,"");if(L.exitCode!==0)return es(e,S),es(e,$),z("",L.stderr,1);g=L.stdout;let R=IE(e);d.push(...R)}catch{return es(e,S),es(e,$),z("","",1)}es(e,S),es(e,$)}}if(p!==null)try{let x=rn(p),S=await e.executeScript(x);if(S.exitCode!==0)return z("",S.stderr,S.exitCode);if(S.stdout){let $=S.stdout.split(`
838
+ `,2)}else if(S==="--"){h.push(...t.slice(x+1));break}else S.startsWith("-")||h.push(S)}a=h[0]??null;let d=[];if(l){let x=await $c(e,a);d.push(...x)}if(c){let x=await Mg(e,a);d.push(...x)}for(let x of n)if(x==="variable"){let S=gE(e,a);d.push(...S)}else if(x==="export"){let S=yE(e,a);d.push(...S)}else if(x==="function"){let S=wE(e,a);d.push(...S)}else if(x==="builtin"){let S=bE(a);d.push(...S)}else if(x==="keyword"){let S=xE(a);d.push(...S)}else if(x==="alias"){let S=EE(e,a);d.push(...S)}else if(x==="shopt"){let S=AE(a);d.push(...S)}else if(x==="helptopic"){let S=SE(a);d.push(...S)}else if(x==="directory"){let S=await $c(e,a);d.push(...S)}else if(x==="file"){let S=await Mg(e,a);d.push(...S)}else if(x==="user"){let S=CE(a);d.push(...S)}else if(x==="command"){let S=await NE(e,a);d.push(...S)}if(r!==null)try{let x=await vE(e,r),S=kE(e,x);for(let $ of S)(a===null||$.startsWith(a))&&d.push($)}catch{return z("","",1)}if(o){let x=await $c(e,a);for(let S of x)d.includes(S)||d.push(S)}let g="";if(f!==null){let x=e.state.functions.get(f);if(x){let S=new Map;S.set("COMP_WORDS__length",e.state.env.get("COMP_WORDS__length")),e.state.env.set("COMP_WORDS__length","0"),S.set("COMP_CWORD",e.state.env.get("COMP_CWORD")),e.state.env.set("COMP_CWORD","-1"),S.set("COMP_LINE",e.state.env.get("COMP_LINE")),e.state.env.set("COMP_LINE",""),S.set("COMP_POINT",e.state.env.get("COMP_POINT")),e.state.env.set("COMP_POINT","0");let $=new Map;for(let L of e.state.env.keys())(L==="COMPREPLY"||L.startsWith("COMPREPLY_")||L==="COMPREPLY__length")&&($.set(L,e.state.env.get(L)),e.state.env.delete(L));let O=["compgen",h[0]??"",""];try{let L=await ka(e,x,O,"");if(L.exitCode!==0)return es(e,S),es(e,$),z("",L.stderr,1);g=L.stdout;let R=IE(e);d.push(...R)}catch{return es(e,S),es(e,$),z("","",1)}es(e,S),es(e,$)}}if(p!==null)try{let x=rn(p),S=await e.executeScript(x);if(S.exitCode!==0)return z("",S.stderr,S.exitCode);if(S.stdout){let $=S.stdout.split(`
839
839
  `);for(let O of $)O.length>0&&d.push(O)}}catch(x){if(x.name==="ParseException")return B(`compgen: -C: ${x.message}
840
840
  `,2);throw x}let w=d;if(u!==null){let x=u.startsWith("!"),S=x?u.slice(1):u;w=d.filter($=>{let O=Xr($,S,!1,!0);return x?O:!O})}if(w.length===0&&a!==null)return z(g,"",1);let y=w.map(x=>`${s}${x}${i}`).join(`
841
841
  `),b=g+(y?`${y}
842
- `:"");return ge(b)}function gE(e,t){let n=new Set;for(let s of e.state.env.keys()){if(s.includes("_")&&/^[a-zA-Z_][a-zA-Z0-9_]*_\d+$/.test(s)||s.endsWith("__length"))continue;let i=s.split("_")[0];/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)?n.add(s):i&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i)&&e.state.env.has(`${i}__length`)&&n.add(i)}let r=Array.from(n);return t!==null&&(r=r.filter(s=>s.startsWith(t))),r.sort()}function yE(e,t){let n=e.state.exportedVars??new Set,r=Array.from(n);return t!==null&&(r=r.filter(s=>s.startsWith(t))),r=r.filter(s=>s.includes("_")&&/^[a-zA-Z_][a-zA-Z0-9_]*_\d+$/.test(s)||s.endsWith("__length")?!1:e.state.env.has(s)),r.sort()}function wE(e,t){let n=Array.from(e.state.functions.keys());return t!==null&&(n=n.filter(r=>r.startsWith(t))),n.sort()}function bE(e){let t=[...Oc];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}function xE(e){let t=[...Ug];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}function EE(e,t){let n=[];for(let s of e.state.env.keys())if(s.startsWith("BASH_ALIAS_")){let i=s.slice(11);n.push(i)}let r=n;return t!==null&&(r=r.filter(s=>s.startsWith(t))),r.sort()}function AE(e){let t=[...dE];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}function SE(e){let t=[...mE];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}async function $c(e,t){let n=[];try{let r=e.state.cwd,s=t??"";if(t){let a=t.lastIndexOf("/");if(a!==-1){let o=t.slice(0,a)||"/";s=t.slice(a+1),o.startsWith("/")?r=o:r=`${e.state.cwd}/${o}`}}let i=await e.fs.readdir(r);for(let a of i){let o=`${r}/${a}`;try{if((await e.fs.stat(o)).isDirectory&&(!s||a.startsWith(s)))if(t?.includes("/")){let c=t.lastIndexOf("/"),u=t.slice(0,c+1);n.push(u+a)}else n.push(a)}catch{}}}catch{}return n.sort()}async function Mg(e,t){let n=[];try{let r=e.state.cwd,s=t??"";if(t){let a=t.lastIndexOf("/");if(a!==-1){let o=t.slice(0,a)||"/";s=t.slice(a+1),o.startsWith("/")?r=o:r=`${e.state.cwd}/${o}`}}let i=await e.fs.readdir(r);for(let a of i)if(!s||a.startsWith(s))if(t?.includes("/")){let o=t.lastIndexOf("/"),l=t.slice(0,o+1);n.push(l+a)}else n.push(a)}catch{}return n.sort()}function CE(e){return["root","nobody"]}async function NE(e,t){let n=new Set;for(let i of Oc)n.add(i);for(let i of e.state.functions.keys())n.add(i);for(let i of e.state.env.keys())i.startsWith("BASH_ALIAS_")&&n.add(i.slice(11));for(let i of Ug)n.add(i);let r=e.state.env.get("PATH")??"/usr/bin:/bin";for(let i of r.split(":"))if(i)try{let a=await e.fs.readdir(i);for(let o of a)n.add(o)}catch{}let s=Array.from(n);return t!==null&&(s=s.filter(i=>i.startsWith(t))),s.sort()}async function kE(e,t){let r=new ce().parseWordFromString(t,!1,!1);return await ie(e,r)}function vE(e,t){let n=e.state.env.get("IFS")??`
842
+ `:"");return ge(b)}function gE(e,t){let n=new Set;for(let s of e.state.env.keys()){if(s.includes("_")&&/^[a-zA-Z_][a-zA-Z0-9_]*_\d+$/.test(s)||s.endsWith("__length"))continue;let i=s.split("_")[0];/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)?n.add(s):i&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i)&&e.state.env.has(`${i}__length`)&&n.add(i)}let r=Array.from(n);return t!==null&&(r=r.filter(s=>s.startsWith(t))),r.sort()}function yE(e,t){let n=e.state.exportedVars??new Set,r=Array.from(n);return t!==null&&(r=r.filter(s=>s.startsWith(t))),r=r.filter(s=>s.includes("_")&&/^[a-zA-Z_][a-zA-Z0-9_]*_\d+$/.test(s)||s.endsWith("__length")?!1:e.state.env.has(s)),r.sort()}function wE(e,t){let n=Array.from(e.state.functions.keys());return t!==null&&(n=n.filter(r=>r.startsWith(t))),n.sort()}function bE(e){let t=[...Oc];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}function xE(e){let t=[...Ug];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}function EE(e,t){let n=[];for(let s of e.state.env.keys())if(s.startsWith("BASH_ALIAS_")){let i=s.slice(11);n.push(i)}let r=n;return t!==null&&(r=r.filter(s=>s.startsWith(t))),r.sort()}function AE(e){let t=[...dE];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}function SE(e){let t=[...mE];return e!==null&&(t=t.filter(n=>n.startsWith(e))),t.sort()}async function $c(e,t){let n=[];try{let r=e.state.cwd,s=t??"";if(t){let a=t.lastIndexOf("/");if(a!==-1){let o=t.slice(0,a)||"/";s=t.slice(a+1),o.startsWith("/")?r=o:r=`${e.state.cwd}/${o}`}}let i=await e.fs.readdir(r);for(let a of i){let o=`${r}/${a}`;try{if((await e.fs.stat(o)).isDirectory&&(!s||a.startsWith(s)))if(t?.includes("/")){let c=t.lastIndexOf("/"),u=t.slice(0,c+1);n.push(u+a)}else n.push(a)}catch{}}}catch{}return n.sort()}async function Mg(e,t){let n=[];try{let r=e.state.cwd,s=t??"";if(t){let a=t.lastIndexOf("/");if(a!==-1){let o=t.slice(0,a)||"/";s=t.slice(a+1),o.startsWith("/")?r=o:r=`${e.state.cwd}/${o}`}}let i=await e.fs.readdir(r);for(let a of i)if(!s||a.startsWith(s))if(t?.includes("/")){let o=t.lastIndexOf("/"),l=t.slice(0,o+1);n.push(l+a)}else n.push(a)}catch{}return n.sort()}function CE(e){return["root","nobody"]}async function NE(e,t){let n=new Set;for(let i of Oc)n.add(i);for(let i of e.state.functions.keys())n.add(i);for(let i of e.state.env.keys())i.startsWith("BASH_ALIAS_")&&n.add(i.slice(11));for(let i of Ug)n.add(i);let r=e.state.env.get("PATH")??"/usr/bin:/bin";for(let i of r.split(":"))if(i)try{let a=await e.fs.readdir(i);for(let o of a)n.add(o)}catch{}let s=Array.from(n);return t!==null&&(s=s.filter(i=>i.startsWith(t))),s.sort()}async function vE(e,t){let r=new ce().parseWordFromString(t,!1,!1);return await ie(e,r)}function kE(e,t){let n=e.state.env.get("IFS")??`
843
843
  `;if(n.length===0)return[t];let r=new Set(n.split("")),s=[],i="",a=0;for(;a<t.length;){let o=t[a];if(o==="\\"&&a+1<t.length){let l=t[a+1];i+=l,a+=2}else r.has(o)?(i.length>0&&(s.push(i),i=""),a++):(i+=o,a++)}return i.length>0&&s.push(i),s}function es(e,t){for(let[n,r]of t)r===void 0?e.state.env.delete(n):e.state.env.set(n,r)}function IE(e){let t=[];if(e.state.env.get("COMPREPLY__length")!==void 0){let s=oe(e,"COMPREPLY");for(let[,i]of s)t.push(i)}else{let s=e.state.env.get("COMPREPLY");s!==void 0&&t.push(s)}return t}var $E=["bashdefault","default","dirnames","filenames","noquote","nosort","nospace","plusdirs"];function Pc(e,t){e.state.completionSpecs||(e.state.completionSpecs=new Map);let n=!1,r=!1,s=!1,i,a,o,l=[],c=[],u=[];for(let f=0;f<t.length;f++){let p=t[f];if(p==="-p")n=!0;else if(p==="-r")r=!0;else if(p==="-D")s=!0;else if(p==="-W"){if(f++,f>=t.length)return B(`complete: -W: option requires an argument
844
844
  `,2);i=t[f]}else if(p==="-F"){if(f++,f>=t.length)return B(`complete: -F: option requires an argument
845
845
  `,2);a=t[f]}else if(p==="-o"){if(f++,f>=t.length)return B(`complete: -o: option requires an argument
@@ -881,21 +881,21 @@ Gid: ${s} ${s} ${s} ${s}
881
881
  `}}return ge(t)}function Gg(e){let t="",n=new Set;for(let s of e.state.env.keys()){if(s.startsWith("BASH_"))continue;if(s.endsWith("__length")){let a=s.slice(0,-8);e.state.associativeArrays?.has(a)||n.add(a);continue}let i=s.lastIndexOf("_");if(i>0){let a=s.slice(0,i),o=s.slice(i+1);/^\d+$/.test(o)&&(e.state.associativeArrays?.has(a)||n.add(a))}}let r=Array.from(n).sort();for(let s of r){let i=Ye(e,s);if(i.length===0)t+=`declare -a ${s}=()
882
882
  `;else{let a=i.map(o=>{let l=e.state.env.get(`${s}_${o}`)??"";return`[${o}]=${hr(l)}`});t+=`declare -a ${s}=(${a.join(" ")})
883
883
  `}}return ge(t)}function Vg(e){let t="",n=new Set;for(let s of e.state.env.keys()){if(s.startsWith("BASH_"))continue;if(s.endsWith("__length")){let a=s.slice(0,-8);n.add(a);continue}let i=s.lastIndexOf("_");if(i>0){let a=s.slice(0,i),o=s.slice(i+1);if(/^\d+$/.test(o)||e.state.associativeArrays?.has(a)){n.add(a);continue}}n.add(s)}let r=Array.from(n).sort();for(let s of r){if(e.state.associativeArrays?.has(s)||Ye(e,s).length>0||e.state.env.has(`${s}__length`))continue;let o=e.state.env.get(s);o!==void 0&&(t+=`${s}=${Ia(o)}
884
- `)}return ge(t)}function Bc(e,t){e.state.integerVars??=new Set,e.state.integerVars.add(t)}function Fs(e,t){return e.state.integerVars?.has(t)??!1}function Wc(e,t){e.state.lowercaseVars??=new Set,e.state.lowercaseVars.add(t),e.state.uppercaseVars?.delete(t)}function OE(e,t){return e.state.lowercaseVars?.has(t)??!1}function zc(e,t){e.state.uppercaseVars??=new Set,e.state.uppercaseVars.add(t),e.state.lowercaseVars?.delete(t)}function RE(e,t){return e.state.uppercaseVars?.has(t)??!1}function ts(e,t,n){return OE(e,t)?n.toLowerCase():RE(e,t)?n.toUpperCase():n}async function qg(e,t){try{let n=new ce,r=Ae(n,t),s=await ne(e,r.expression);return String(s)}catch{return"0"}}function TE(e){let t=e.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!t)return null;let n=t[0],r=n.length;if(e[r]!=="[")return null;let s=0,i=r+1;for(;r<e.length;r++)if(e[r]==="[")s++;else if(e[r]==="]"&&(s--,s===0))break;if(s!==0)return null;let a=e.slice(i,r);if(r++,e[r]!=="=")return null;r++;let o=e.slice(r);return{name:n,indexExpr:a,value:o}}async function Hc(e,t){let n=!1,r=!1,s=!1,i=!1,a=!1,o=!1,l=!1,c=!1,u=!1,f=!1,p=!1,h=!1,m=!1,d=!1,g=!1,w=[];for(let R=0;R<t.length;R++){let W=t[R];if(W==="-a")n=!0;else if(W==="-A")r=!0;else if(W==="-r")s=!0;else if(W==="-x")i=!0;else if(W==="-p")a=!0;else if(W==="-n")o=!0;else if(W==="+n")l=!0;else if(W==="+a")c=!0;else if(W==="+x")u=!0;else if(W==="--"){w.push(...t.slice(R+1));break}else if(W.startsWith("+")){for(let k of W.slice(1))if(k==="n")l=!0;else if(k==="a")c=!0;else if(k==="x")u=!0;else if(k!=="r"){if(k!=="i"){if(!(k==="f"||k==="F"))return z("",`bash: typeset: +${k}: invalid option
885
- `,2)}}}else if(W==="-i")f=!0;else if(W==="-l")p=!0;else if(W==="-u")h=!0;else if(W==="-f")m=!0;else if(W==="-F")d=!0;else if(W==="-g")g=!0;else if(W.startsWith("-"))for(let k of W.slice(1))if(k==="a")n=!0;else if(k==="A")r=!0;else if(k==="r")s=!0;else if(k==="x")i=!0;else if(k==="p")a=!0;else if(k==="n")o=!0;else if(k==="i")f=!0;else if(k==="l")p=!0;else if(k==="u")h=!0;else if(k==="f")m=!0;else if(k==="F")d=!0;else if(k==="g")g=!0;else return z("",`bash: typeset: -${k}: invalid option
886
- `,2);else w.push(W)}let b=e.state.localScopes.length>0&&!g,x=R=>{if(!b)return;let W=e.state.localScopes[e.state.localScopes.length-1];W.has(R)||W.set(R,e.state.env.get(R))},S=R=>{if(!b)return;let W=e.state.localScopes[e.state.localScopes.length-1];W.has(R)||W.set(R,e.state.env.get(R));let k=`${R}_`;for(let P of e.state.env.keys())P.startsWith(k)&&!P.includes("__")&&(W.has(P)||W.set(P,e.state.env.get(P)));let N=`${R}__length`;e.state.env.has(N)&&!W.has(N)&&W.set(N,e.state.env.get(N))},$=R=>{b&&Gn(e,R)};if(d){if(w.length===0){let k=Array.from(e.state.functions.keys()).sort(),N="";for(let P of k)N+=`declare -f ${P}
887
- `;return ge(N)}let R=!0,W="";for(let k of w)e.state.functions.has(k)?W+=`${k}
888
- `:R=!1;return z(W,"",R?0:1)}if(m){if(w.length===0){let W="",k=Array.from(e.state.functions.keys()).sort();for(let N of k)W+=`${N} ()
884
+ `)}return ge(t)}function Bc(e,t){e.state.integerVars??=new Set,e.state.integerVars.add(t)}function Fs(e,t){return e.state.integerVars?.has(t)??!1}function Wc(e,t){e.state.lowercaseVars??=new Set,e.state.lowercaseVars.add(t),e.state.uppercaseVars?.delete(t)}function OE(e,t){return e.state.lowercaseVars?.has(t)??!1}function zc(e,t){e.state.uppercaseVars??=new Set,e.state.uppercaseVars.add(t),e.state.lowercaseVars?.delete(t)}function RE(e,t){return e.state.uppercaseVars?.has(t)??!1}function ts(e,t,n){return OE(e,t)?n.toLowerCase():RE(e,t)?n.toUpperCase():n}async function qg(e,t){try{let n=new ce,r=Ae(n,t),s=await ne(e,r.expression);return String(s)}catch{return"0"}}function TE(e){let t=e.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!t)return null;let n=t[0],r=n.length;if(e[r]!=="[")return null;let s=0,i=r+1;for(;r<e.length;r++)if(e[r]==="[")s++;else if(e[r]==="]"&&(s--,s===0))break;if(s!==0)return null;let a=e.slice(i,r);if(r++,e[r]!=="=")return null;r++;let o=e.slice(r);return{name:n,indexExpr:a,value:o}}async function Hc(e,t){let n=!1,r=!1,s=!1,i=!1,a=!1,o=!1,l=!1,c=!1,u=!1,f=!1,p=!1,h=!1,m=!1,d=!1,g=!1,w=[];for(let R=0;R<t.length;R++){let W=t[R];if(W==="-a")n=!0;else if(W==="-A")r=!0;else if(W==="-r")s=!0;else if(W==="-x")i=!0;else if(W==="-p")a=!0;else if(W==="-n")o=!0;else if(W==="+n")l=!0;else if(W==="+a")c=!0;else if(W==="+x")u=!0;else if(W==="--"){w.push(...t.slice(R+1));break}else if(W.startsWith("+")){for(let v of W.slice(1))if(v==="n")l=!0;else if(v==="a")c=!0;else if(v==="x")u=!0;else if(v!=="r"){if(v!=="i"){if(!(v==="f"||v==="F"))return z("",`bash: typeset: +${v}: invalid option
885
+ `,2)}}}else if(W==="-i")f=!0;else if(W==="-l")p=!0;else if(W==="-u")h=!0;else if(W==="-f")m=!0;else if(W==="-F")d=!0;else if(W==="-g")g=!0;else if(W.startsWith("-"))for(let v of W.slice(1))if(v==="a")n=!0;else if(v==="A")r=!0;else if(v==="r")s=!0;else if(v==="x")i=!0;else if(v==="p")a=!0;else if(v==="n")o=!0;else if(v==="i")f=!0;else if(v==="l")p=!0;else if(v==="u")h=!0;else if(v==="f")m=!0;else if(v==="F")d=!0;else if(v==="g")g=!0;else return z("",`bash: typeset: -${v}: invalid option
886
+ `,2);else w.push(W)}let b=e.state.localScopes.length>0&&!g,x=R=>{if(!b)return;let W=e.state.localScopes[e.state.localScopes.length-1];W.has(R)||W.set(R,e.state.env.get(R))},S=R=>{if(!b)return;let W=e.state.localScopes[e.state.localScopes.length-1];W.has(R)||W.set(R,e.state.env.get(R));let v=`${R}_`;for(let P of e.state.env.keys())P.startsWith(v)&&!P.includes("__")&&(W.has(P)||W.set(P,e.state.env.get(P)));let N=`${R}__length`;e.state.env.has(N)&&!W.has(N)&&W.set(N,e.state.env.get(N))},$=R=>{b&&Gn(e,R)};if(d){if(w.length===0){let v=Array.from(e.state.functions.keys()).sort(),N="";for(let P of v)N+=`declare -f ${P}
887
+ `;return ge(N)}let R=!0,W="";for(let v of w)e.state.functions.has(v)?W+=`${v}
888
+ `:R=!1;return z(W,"",R?0:1)}if(m){if(w.length===0){let W="",v=Array.from(e.state.functions.keys()).sort();for(let N of v)W+=`${N} ()
889
889
  {
890
890
  # function body
891
891
  }
892
- `;return ge(W)}let R=!0;for(let W of w)e.state.functions.has(W)||(R=!1);return z("","",R?0:1)}if(a&&w.length>0)return zg(e,w);if(a&&w.length===0)return Hg(e,{filterExport:i,filterReadonly:s,filterNameref:o,filterIndexedArray:n,filterAssocArray:r});if(w.length===0&&r&&!a)return jg(e);if(w.length===0&&n&&!a)return Gg(e);if(w.length===0&&!a)return Vg(e);let O="",L=0;for(let R of w){let W=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(W&&!c){let v=W[1],T=W[2];if(r&&Ye(e,v).length>0){O+=`bash: declare: ${v}: cannot convert indexed to associative array
893
- `,L=1;continue}if((n||!r&&!n)&&e.state.associativeArrays?.has(v)){O+=`bash: declare: ${v}: cannot convert associative to indexed array
894
- `,L=1;continue}if(S(v),r&&(e.state.associativeArrays??=new Set,e.state.associativeArrays.add(v)),wn(e,v),e.state.env.delete(v),e.state.env.delete(`${v}__length`),r&&T.includes("[")){let F=Sa(T);for(let[ue,re]of F){let te=qe(e,re);e.state.env.set(`${v}_${ue}`,te)}}else if(r){let F=An(T);for(let ue=0;ue<F.length;ue+=2){let re=F[ue],te=ue+1<F.length?qe(e,F[ue+1]):"";e.state.env.set(`${v}_${re}`,te)}}else{let F=An(T);if(F.some(re=>/^\[[^\]]+\]=/.test(re))){let re=0;for(let te of F){let H=te.match(/^\[([^\]]+)\]=(.*)$/);if(H){let X=H[1],Ee=H[2],ae=qe(e,Ee),ke;if(/^-?\d+$/.test(X))ke=Number.parseInt(X,10);else try{let j=new ce,ve=Ae(j,X);ke=await ne(e,ve.expression)}catch{ke=0}e.state.env.set(`${v}_${ke}`,ae),re=ke+1}else{let X=qe(e,te);e.state.env.set(`${v}_${re}`,X),re++}}}else{for(let re=0;re<F.length;re++)e.state.env.set(`${v}_${re}`,F[re]);e.state.env.set(`${v}__length`,String(F.length))}}$(v),s&&Mt(e,v),i&&on(e,v);continue}if(l){let v=R.includes("=")?R.slice(0,R.indexOf("=")):R;if(Qm(e,v),!R.includes("="))continue}if(u){let v=R.includes("=")?R.slice(0,R.indexOf("=")):R;if(sa(e,v),!R.includes("="))continue}let k=TE(R);if(k){let{name:v,indexExpr:T,value:F}=k,ue=it(e,v);if(ue)return ue;S(v);let re;try{let H=new ce,X=Ae(H,T);re=await ne(e,X.expression)}catch{let H=parseInt(T,10);re=Number.isNaN(H)?0:H}e.state.env.set(`${v}_${re}`,F);let te=parseInt(e.state.env.get(`${v}__length`)??"0",10);re>=te&&e.state.env.set(`${v}__length`,String(re+1)),$(v),s&&Mt(e,v),i&&on(e,v);continue}let N=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(N&&!c){let v=N[1],T=N[2],F=it(e,v);if(F)return F;S(v);let ue=An(T);if(e.state.associativeArrays?.has(v)){let re=Sa(T);for(let[te,H]of re){let X=qe(e,H);e.state.env.set(`${v}_${te}`,X)}}else{let re=Ye(e,v),te=0,H=e.state.env.get(v);re.length===0&&H!==void 0?(e.state.env.set(`${v}_0`,H),e.state.env.delete(v),te=1):re.length>0&&(te=Math.max(...re)+1);for(let Ee=0;Ee<ue.length;Ee++)e.state.env.set(`${v}_${te+Ee}`,qe(e,ue[Ee]));let X=te+ue.length;e.state.env.set(`${v}__length`,String(X))}$(v),s&&Mt(e,v),i&&on(e,v);continue}let P=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(P){let v=P[1],T=qe(e,P[2]),F=it(e,v);if(F)return F;x(v),f&&Bc(e,v),p&&Wc(e,v),h&&zc(e,v);let re=Ye(e,v).length>0||e.state.associativeArrays?.has(v);if(Fs(e,v)){let te=e.state.env.get(v)??"0",H=parseInt(te,10)||0,X=parseInt(await qg(e,T),10)||0;T=String(H+X),e.state.env.set(v,T)}else if(re){T=ts(e,v,T);let te=`${v}_0`,H=e.state.env.get(te)??"";e.state.env.set(te,H+T)}else{T=ts(e,v,T);let te=e.state.env.get(v)??"";e.state.env.set(v,te+T)}$(v),s&&Mt(e,v),i&&on(e,v),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(v));continue}if(R.includes("=")){let v=R.indexOf("="),T=R.slice(0,v),F=R.slice(v+1);if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(T)){O+=`bash: typeset: \`${T}': not a valid identifier
892
+ `;return ge(W)}let R=!0;for(let W of w)e.state.functions.has(W)||(R=!1);return z("","",R?0:1)}if(a&&w.length>0)return zg(e,w);if(a&&w.length===0)return Hg(e,{filterExport:i,filterReadonly:s,filterNameref:o,filterIndexedArray:n,filterAssocArray:r});if(w.length===0&&r&&!a)return jg(e);if(w.length===0&&n&&!a)return Gg(e);if(w.length===0&&!a)return Vg(e);let O="",L=0;for(let R of w){let W=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(W&&!c){let k=W[1],T=W[2];if(r&&Ye(e,k).length>0){O+=`bash: declare: ${k}: cannot convert indexed to associative array
893
+ `,L=1;continue}if((n||!r&&!n)&&e.state.associativeArrays?.has(k)){O+=`bash: declare: ${k}: cannot convert associative to indexed array
894
+ `,L=1;continue}if(S(k),r&&(e.state.associativeArrays??=new Set,e.state.associativeArrays.add(k)),wn(e,k),e.state.env.delete(k),e.state.env.delete(`${k}__length`),r&&T.includes("[")){let F=Sa(T);for(let[ue,re]of F){let te=qe(e,re);e.state.env.set(`${k}_${ue}`,te)}}else if(r){let F=An(T);for(let ue=0;ue<F.length;ue+=2){let re=F[ue],te=ue+1<F.length?qe(e,F[ue+1]):"";e.state.env.set(`${k}_${re}`,te)}}else{let F=An(T);if(F.some(re=>/^\[[^\]]+\]=/.test(re))){let re=0;for(let te of F){let H=te.match(/^\[([^\]]+)\]=(.*)$/);if(H){let X=H[1],Ee=H[2],ae=qe(e,Ee),ve;if(/^-?\d+$/.test(X))ve=Number.parseInt(X,10);else try{let j=new ce,ke=Ae(j,X);ve=await ne(e,ke.expression)}catch{ve=0}e.state.env.set(`${k}_${ve}`,ae),re=ve+1}else{let X=qe(e,te);e.state.env.set(`${k}_${re}`,X),re++}}}else{for(let re=0;re<F.length;re++)e.state.env.set(`${k}_${re}`,F[re]);e.state.env.set(`${k}__length`,String(F.length))}}$(k),s&&Mt(e,k),i&&on(e,k);continue}if(l){let k=R.includes("=")?R.slice(0,R.indexOf("=")):R;if(Qm(e,k),!R.includes("="))continue}if(u){let k=R.includes("=")?R.slice(0,R.indexOf("=")):R;if(sa(e,k),!R.includes("="))continue}let v=TE(R);if(v){let{name:k,indexExpr:T,value:F}=v,ue=it(e,k);if(ue)return ue;S(k);let re;try{let H=new ce,X=Ae(H,T);re=await ne(e,X.expression)}catch{let H=parseInt(T,10);re=Number.isNaN(H)?0:H}e.state.env.set(`${k}_${re}`,F);let te=parseInt(e.state.env.get(`${k}__length`)??"0",10);re>=te&&e.state.env.set(`${k}__length`,String(re+1)),$(k),s&&Mt(e,k),i&&on(e,k);continue}let N=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(N&&!c){let k=N[1],T=N[2],F=it(e,k);if(F)return F;S(k);let ue=An(T);if(e.state.associativeArrays?.has(k)){let re=Sa(T);for(let[te,H]of re){let X=qe(e,H);e.state.env.set(`${k}_${te}`,X)}}else{let re=Ye(e,k),te=0,H=e.state.env.get(k);re.length===0&&H!==void 0?(e.state.env.set(`${k}_0`,H),e.state.env.delete(k),te=1):re.length>0&&(te=Math.max(...re)+1);for(let Ee=0;Ee<ue.length;Ee++)e.state.env.set(`${k}_${te+Ee}`,qe(e,ue[Ee]));let X=te+ue.length;e.state.env.set(`${k}__length`,String(X))}$(k),s&&Mt(e,k),i&&on(e,k);continue}let P=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(P){let k=P[1],T=qe(e,P[2]),F=it(e,k);if(F)return F;x(k),f&&Bc(e,k),p&&Wc(e,k),h&&zc(e,k);let re=Ye(e,k).length>0||e.state.associativeArrays?.has(k);if(Fs(e,k)){let te=e.state.env.get(k)??"0",H=parseInt(te,10)||0,X=parseInt(await qg(e,T),10)||0;T=String(H+X),e.state.env.set(k,T)}else if(re){T=ts(e,k,T);let te=`${k}_0`,H=e.state.env.get(te)??"";e.state.env.set(te,H+T)}else{T=ts(e,k,T);let te=e.state.env.get(k)??"";e.state.env.set(k,te+T)}$(k),s&&Mt(e,k),i&&on(e,k),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(k));continue}if(R.includes("=")){let k=R.indexOf("="),T=R.slice(0,k),F=R.slice(k+1);if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(T)){O+=`bash: typeset: \`${T}': not a valid identifier
895
895
  `,L=1;continue}let ue=it(e,T);if(ue)return ue;if(x(T),o){if(F!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(F)){O+=`bash: declare: \`${F}': invalid variable name for name reference
896
- `,L=1;continue}e.state.env.set(T,F),vn(e,T),F!==""&&na(e,F)&&oc(e,T),$(T),s&&Mt(e,T),i&&on(e,T);continue}if(f&&Bc(e,T),p&&Wc(e,T),h&&zc(e,T),Fs(e,T)&&(F=await qg(e,F)),F=ts(e,T,F),Te(e,T)){let re=St(e,T);re&&re!==T?e.state.env.set(re,F):e.state.env.set(T,F)}else e.state.env.set(T,F);$(T),s&&Mt(e,T),i&&on(e,T),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(T))}else{let v=R;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(v)){O+=`bash: typeset: \`${v}': not a valid identifier
897
- `,L=1;continue}if(n||r?S(v):x(v),o){vn(e,v);let F=e.state.env.get(v);F!==void 0&&F!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(F)?Xm(e,v):F&&na(e,F)&&oc(e,v),$(v),s&&Mt(e,v),i&&on(e,v);continue}if(f&&Bc(e,v),p&&Wc(e,v),h&&zc(e,v),r){if(Ye(e,v).length>0){O+=`bash: declare: ${v}: cannot convert indexed to associative array
898
- `,L=1;continue}e.state.associativeArrays??=new Set,e.state.associativeArrays.add(v)}let T=Array.from(e.state.env.keys()).some(F=>F.startsWith(`${v}_`)&&!F.startsWith(`${v}__length`));!e.state.env.has(v)&&!T&&(n||r?e.state.env.set(`${v}__length`,"0"):(e.state.declaredVars??=new Set,e.state.declaredVars.add(v))),$(v),s&&Mt(e,v),i&&on(e,v)}}return z("",O,L)}async function jc(e,t){let n=!1,r=!1,s=!1,i=[];for(let a=0;a<t.length;a++){let o=t[a];if(o==="-a")n=!0;else if(o==="-A")r=!0;else if(o==="-p")s=!0;else if(o==="--"){i.push(...t.slice(a+1));break}else o.startsWith("-")||i.push(o)}if(i.length===0){let a="",o=Array.from(e.state.readonlyVars||[]).sort();for(let l of o){let c=e.state.env.get(l);if(c!==void 0){let u=c.replace(/\\/g,"\\\\").replace(/"/g,'\\"');a+=`declare -r ${l}="${u}"
896
+ `,L=1;continue}e.state.env.set(T,F),kn(e,T),F!==""&&na(e,F)&&oc(e,T),$(T),s&&Mt(e,T),i&&on(e,T);continue}if(f&&Bc(e,T),p&&Wc(e,T),h&&zc(e,T),Fs(e,T)&&(F=await qg(e,F)),F=ts(e,T,F),Te(e,T)){let re=St(e,T);re&&re!==T?e.state.env.set(re,F):e.state.env.set(T,F)}else e.state.env.set(T,F);$(T),s&&Mt(e,T),i&&on(e,T),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(T))}else{let k=R;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(k)){O+=`bash: typeset: \`${k}': not a valid identifier
897
+ `,L=1;continue}if(n||r?S(k):x(k),o){kn(e,k);let F=e.state.env.get(k);F!==void 0&&F!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(F)?Xm(e,k):F&&na(e,F)&&oc(e,k),$(k),s&&Mt(e,k),i&&on(e,k);continue}if(f&&Bc(e,k),p&&Wc(e,k),h&&zc(e,k),r){if(Ye(e,k).length>0){O+=`bash: declare: ${k}: cannot convert indexed to associative array
898
+ `,L=1;continue}e.state.associativeArrays??=new Set,e.state.associativeArrays.add(k)}let T=Array.from(e.state.env.keys()).some(F=>F.startsWith(`${k}_`)&&!F.startsWith(`${k}__length`));!e.state.env.has(k)&&!T&&(n||r?e.state.env.set(`${k}__length`,"0"):(e.state.declaredVars??=new Set,e.state.declaredVars.add(k))),$(k),s&&Mt(e,k),i&&on(e,k)}}return z("",O,L)}async function jc(e,t){let n=!1,r=!1,s=!1,i=[];for(let a=0;a<t.length;a++){let o=t[a];if(o==="-a")n=!0;else if(o==="-A")r=!0;else if(o==="-p")s=!0;else if(o==="--"){i.push(...t.slice(a+1));break}else o.startsWith("-")||i.push(o)}if(i.length===0){let a="",o=Array.from(e.state.readonlyVars||[]).sort();for(let l of o){let c=e.state.env.get(l);if(c!==void 0){let u=c.replace(/\\/g,"\\\\").replace(/"/g,'\\"');a+=`declare -r ${l}="${u}"
899
899
  `}}return ge(a)}for(let a of i){let o=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(o){let f=o[1],p=o[2],h=it(e,f);if(h)return h;let m=An(p);if(e.state.associativeArrays?.has(f)){let d=Sa(p);for(let[g,w]of d){let y=qe(e,w);e.state.env.set(`${f}_${g}`,y)}}else{let d=Ye(e,f),g=0,w=e.state.env.get(f);d.length===0&&w!==void 0?(e.state.env.set(`${f}_0`,w),e.state.env.delete(f),g=1):d.length>0&&(g=Math.max(...d)+1);for(let b=0;b<m.length;b++)e.state.env.set(`${f}_${g+b}`,qe(e,m[b]));let y=g+m.length;e.state.env.set(`${f}__length`,String(y))}Mt(e,f);continue}let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(l){let f=l[1],p=qe(e,l[2]),h=it(e,f);if(h)return h;let m=e.state.env.get(f)??"";e.state.env.set(f,m+p),Mt(e,f);continue}let c=Rg(a);if(c.value===void 0&&!c.isArray){Mt(e,c.name);continue}let u=await Tg(e,c,{makeReadonly:!0});if(u)return u}return de}function Gc(e){return e.state.directoryStack??=[],e.state.directoryStack}function Ms(e,t){return t&&e===t?"~":t&&e.startsWith(`${t}/`)?`~${e.slice(t.length)}`:e}function PE(e){let t=e.split("/").filter(r=>r&&r!=="."),n=[];for(let r of t)r===".."?n.pop():n.push(r);return`/${n.join("/")}`}async function Vc(e,t){let n=Gc(e),r;for(let o=0;o<t.length;o++){let l=t[o];if(l==="--"){if(o+1<t.length){if(r!==void 0)return B(`bash: pushd: too many arguments
900
900
  `,2);r=t[o+1],o++}}else{if(l.startsWith("-")&&l!=="-")return B(`bash: pushd: ${l}: invalid option
901
901
  `,2);if(r!==void 0)return B(`bash: pushd: too many arguments
@@ -1297,19 +1297,19 @@ ${h}
1297
1297
  `)}return z("","",r===0?1:0)}mt();Xe();Ct();Xt();an();Wn();async function eu(e,t){if(e.state.localScopes.length===0)return B(`bash: local: can only be used in a function
1298
1298
  `);let n=e.state.localScopes[e.state.localScopes.length-1],r="",s=0,i=!1,a=!1,o=!1,l=[];for(let c of t)if(c==="-n")i=!0;else if(c==="-a")a=!0;else if(c==="-p")o=!0;else if(c.startsWith("-")&&!c.includes("="))for(let u of c.slice(1))u==="n"?i=!0:u==="a"?a=!0:u==="p"&&(o=!0);else l.push(c);if(l.length===0){let c="",u=Array.from(n.keys()).filter(f=>!f.includes("_")||!f.match(/_\d+$/)).filter(f=>!f.includes("__length")).sort();for(let f of u){let p=e.state.env.get(f);p!==void 0&&(c+=`${f}=${p}
1299
1299
  `)}return z(c,"",0)}for(let c of l){let u,f,p=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(p){u=p[1];let w=p[2];if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){r+=`bash: local: \`${c}': not a valid identifier
1300
- `,s=1;continue}if(it(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let x=`${u}_`;for(let S of e.state.env.keys())S.startsWith(x)&&!S.includes("__")&&(n.has(S)||n.set(S,e.state.env.get(S)))}let y=`${u}_`;for(let x of e.state.env.keys())x.startsWith(y)&&!x.includes("__")&&e.state.env.delete(x);let b=An(w);for(let x=0;x<b.length;x++)e.state.env.set(`${u}_${x}`,b[x]);e.state.env.set(`${u}__length`,String(b.length)),Gn(e,u),i&&vn(e,u);continue}let h=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(h){u=h[1];let w=h[2];if(it(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let O=`${u}_`;for(let R of e.state.env.keys())R.startsWith(O)&&!R.includes("__")&&(n.has(R)||n.set(R,e.state.env.get(R)));let L=`${u}__length`;e.state.env.has(L)&&!n.has(L)&&n.set(L,e.state.env.get(L))}let y=An(w),b=Ye(e,u),x=0,S=e.state.env.get(u);b.length===0&&S!==void 0?(e.state.env.set(`${u}_0`,S),e.state.env.delete(u),x=1):b.length>0&&(x=Math.max(...b)+1);for(let O=0;O<y.length;O++)e.state.env.set(`${u}_${x+O}`,qe(e,y[O]));let $=x+y.length;e.state.env.set(`${u}__length`,String($)),Gn(e,u),i&&vn(e,u);continue}let m=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(m){u=m[1];let w=qe(e,m[2]);it(e,u,"bash"),n.has(u)||n.set(u,e.state.env.get(u));let y=e.state.env.get(u)??"";e.state.env.set(u,y+w),Gn(e,u),i&&vn(e,u);continue}let d=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(d){u=d[1];let w=d[2],y=qe(e,d[3]);if(it(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let S=`${u}_`;for(let O of e.state.env.keys())O.startsWith(S)&&!O.includes("__")&&(n.has(O)||n.set(O,e.state.env.get(O)));let $=`${u}__length`;e.state.env.has($)&&!n.has($)&&n.set($,e.state.env.get($))}let b;try{let S=new ce,$=Ae(S,w);b=await ne(e,$.expression)}catch{let S=parseInt(w,10);b=Number.isNaN(S)?0:S}e.state.env.set(`${u}_${b}`,y);let x=parseInt(e.state.env.get(`${u}__length`)??"0",10);b>=x&&e.state.env.set(`${u}__length`,String(b+1)),Gn(e,u),i&&vn(e,u);continue}if(c.includes("=")){let w=c.indexOf("=");u=c.slice(0,w),f=qe(e,c.slice(w+1))}else u=c;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){r+=`bash: local: \`${c}': not a valid identifier
1300
+ `,s=1;continue}if(it(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let x=`${u}_`;for(let S of e.state.env.keys())S.startsWith(x)&&!S.includes("__")&&(n.has(S)||n.set(S,e.state.env.get(S)))}let y=`${u}_`;for(let x of e.state.env.keys())x.startsWith(y)&&!x.includes("__")&&e.state.env.delete(x);let b=An(w);for(let x=0;x<b.length;x++)e.state.env.set(`${u}_${x}`,b[x]);e.state.env.set(`${u}__length`,String(b.length)),Gn(e,u),i&&kn(e,u);continue}let h=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(h){u=h[1];let w=h[2];if(it(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let O=`${u}_`;for(let R of e.state.env.keys())R.startsWith(O)&&!R.includes("__")&&(n.has(R)||n.set(R,e.state.env.get(R)));let L=`${u}__length`;e.state.env.has(L)&&!n.has(L)&&n.set(L,e.state.env.get(L))}let y=An(w),b=Ye(e,u),x=0,S=e.state.env.get(u);b.length===0&&S!==void 0?(e.state.env.set(`${u}_0`,S),e.state.env.delete(u),x=1):b.length>0&&(x=Math.max(...b)+1);for(let O=0;O<y.length;O++)e.state.env.set(`${u}_${x+O}`,qe(e,y[O]));let $=x+y.length;e.state.env.set(`${u}__length`,String($)),Gn(e,u),i&&kn(e,u);continue}let m=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(m){u=m[1];let w=qe(e,m[2]);it(e,u,"bash"),n.has(u)||n.set(u,e.state.env.get(u));let y=e.state.env.get(u)??"";e.state.env.set(u,y+w),Gn(e,u),i&&kn(e,u);continue}let d=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(d){u=d[1];let w=d[2],y=qe(e,d[3]);if(it(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let S=`${u}_`;for(let O of e.state.env.keys())O.startsWith(S)&&!O.includes("__")&&(n.has(O)||n.set(O,e.state.env.get(O)));let $=`${u}__length`;e.state.env.has($)&&!n.has($)&&n.set($,e.state.env.get($))}let b;try{let S=new ce,$=Ae(S,w);b=await ne(e,$.expression)}catch{let S=parseInt(w,10);b=Number.isNaN(S)?0:S}e.state.env.set(`${u}_${b}`,y);let x=parseInt(e.state.env.get(`${u}__length`)??"0",10);b>=x&&e.state.env.set(`${u}__length`,String(b+1)),Gn(e,u),i&&kn(e,u);continue}if(c.includes("=")){let w=c.indexOf("=");u=c.slice(0,w),f=qe(e,c.slice(w+1))}else u=c;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){r+=`bash: local: \`${c}': not a valid identifier
1301
1301
  `,s=1;continue}let g=n.has(u);if(f!==void 0){let w=e.state.env.get(u);if(e.state.tempEnvBindings){let y=e.state.accessedTempEnvVars?.has(u),b=e.state.mutatedTempEnvVars?.has(u);if(!y&&!b)for(let x=e.state.tempEnvBindings.length-1;x>=0;x--){let S=e.state.tempEnvBindings[x];if(S.has(u)){w=S.get(u);break}}}Pg(e,u,w)}if(!g){let w=e.state.env.get(u);if(e.state.tempEnvBindings)for(let y=e.state.tempEnvBindings.length-1;y>=0;y--){let b=e.state.tempEnvBindings[y];if(b.has(u)){w=b.get(u);break}}if(n.set(u,w),a){let y=`${u}_`;for(let x of e.state.env.keys())x.startsWith(y)&&!x.includes("__")&&(n.has(x)||n.set(x,e.state.env.get(x)));let b=`${u}__length`;e.state.env.has(b)&&!n.has(b)&&n.set(b,e.state.env.get(b))}}if(a&&f===void 0){let w=`${u}_`;for(let y of e.state.env.keys())y.startsWith(w)&&!y.includes("__")&&e.state.env.delete(y);e.state.env.set(`${u}__length`,"0")}else if(f!==void 0){if(it(e,u,"bash"),i&&f!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(f)){r+=`bash: local: \`${f}': invalid variable name for name reference
1302
- `,s=1;continue}e.state.env.set(u,f),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(u))}else{let w=e.state.tempEnvBindings?.some(y=>y.has(u));!g&&!w&&e.state.env.delete(u)}Gn(e,u),i&&vn(e,u)}return z("",r,s)}Xt();function tu(e,t,n){let r=`
1302
+ `,s=1;continue}e.state.env.set(u,f),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(u))}else{let w=e.state.tempEnvBindings?.some(y=>y.has(u));!g&&!w&&e.state.env.delete(u)}Gn(e,u),i&&kn(e,u)}return z("",r,s)}Xt();function tu(e,t,n){let r=`
1303
1303
  `,s=0,i=0,a=0,o=!1,l="MAPFILE",c=0;for(;c<t.length;){let y=t[c];y==="-d"&&c+1<t.length?(r=t[c+1]===""?"\0":t[c+1]||`
1304
1304
  `,c+=2):y==="-n"&&c+1<t.length?(s=Number.parseInt(t[c+1],10)||0,c+=2):y==="-O"&&c+1<t.length?(i=Number.parseInt(t[c+1],10)||0,c+=2):y==="-s"&&c+1<t.length?(a=Number.parseInt(t[c+1],10)||0,c+=2):y==="-t"?(o=!0,c++):y==="-u"||y==="-C"||y==="-c"?c+=2:(y.startsWith("-")||(l=y),c++)}let u=n;!u&&e.state.groupStdin!==void 0&&(u=e.state.groupStdin);let f=[],p=u,h=0,m=0,d=e.limits?.maxArrayElements??1e5;for(;p.length>0;){let y=p.indexOf(r);if(y===-1){if(p.length>0){if(m<a)m++;else if(s===0||h<s){if(i+h>=d)return z("",`mapfile: array element limit exceeded (${d})
1305
1305
  `,1);let S=p,$=S.indexOf("\0");$!==-1&&(S=S.substring(0,$)),f.push(S),h++}}break}let b=p.substring(0,y),x=b.indexOf("\0");if(x!==-1&&(b=b.substring(0,x)),!o&&r!=="\0"&&(b+=r),p=p.substring(y+r.length),m<a){m++;continue}if(s>0&&h>=s)break;if(i+h>=d)return z("",`mapfile: array element limit exceeded (${d})
1306
1306
  `,1);f.push(b),h++}i===0&&wn(e,l);for(let y=0;y<f.length;y++)e.state.env.set(`${l}_${i+y}`,f[y]);let g=parseInt(e.state.env.get(`${l}__length`)||"0",10),w=i+f.length;return e.state.env.set(`${l}__length`,String(Math.max(g,w))),e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=""),z("","",0)}Xt();jt();function FE(e){if(!e.startsWith("__rw__:"))return null;let t=e.slice(7),n=t.indexOf(":");if(n===-1)return null;let r=Number.parseInt(t.slice(0,n),10);if(Number.isNaN(r)||r<0)return null;let s=n+1,i=t.slice(s,s+r),a=s+r+1,o=t.slice(a),l=o.indexOf(":");if(l===-1)return null;let c=Number.parseInt(o.slice(0,l),10);if(Number.isNaN(c)||c<0)return null;let u=o.slice(l+1);return{path:i,position:c,content:u}}function ME(e,t,n){return`__rw__:${e.length}:${e}:${t}:${n}`}function nu(e,t,n,r=-1){let s=!1,i=`
1307
- `,a="",o=-1,l=-1,c=null,u=-1,f=-1,p=[],h=0,m=!1,d=(k,N)=>{let P=1;for(;P<k.length;){let v=k[P];if(v==="r")s=!0,P++;else if(v==="s")P++;else{if(v==="d")return P+1<k.length?(i=k.substring(P+1),{nextArgIndex:N+1}):N+1<t.length?(i=t[N+1],{nextArgIndex:N+2}):{nextArgIndex:N+1};if(v==="n"){if(P+1<k.length){let T=k.substring(P+1);return o=Number.parseInt(T,10),(Number.isNaN(o)||o<0)&&(m=!0,o=0),{nextArgIndex:N+1}}else if(N+1<t.length)return o=Number.parseInt(t[N+1],10),(Number.isNaN(o)||o<0)&&(m=!0,o=0),{nextArgIndex:N+2};return{nextArgIndex:N+1}}else if(v==="N"){if(P+1<k.length){let T=k.substring(P+1);return l=Number.parseInt(T,10),(Number.isNaN(l)||l<0)&&(m=!0,l=0),{nextArgIndex:N+1}}else if(N+1<t.length)return l=Number.parseInt(t[N+1],10),(Number.isNaN(l)||l<0)&&(m=!0,l=0),{nextArgIndex:N+2};return{nextArgIndex:N+1}}else{if(v==="a")return P+1<k.length?(c=k.substring(P+1),{nextArgIndex:N+1}):N+1<t.length?(c=t[N+1],{nextArgIndex:N+2}):{nextArgIndex:N+1};if(v==="p")return P+1<k.length?(a=k.substring(P+1),{nextArgIndex:N+1}):N+1<t.length?(a=t[N+1],{nextArgIndex:N+2}):{nextArgIndex:N+1};if(v==="u"){if(P+1<k.length){let T=k.substring(P+1);return u=Number.parseInt(T,10),Number.isNaN(u)||u<0?{nextArgIndex:-2}:{nextArgIndex:N+1}}else if(N+1<t.length)return u=Number.parseInt(t[N+1],10),Number.isNaN(u)||u<0?{nextArgIndex:-2}:{nextArgIndex:N+2};return{nextArgIndex:N+1}}else if(v==="t"){if(P+1<k.length){let T=k.substring(P+1);return f=Number.parseFloat(T),Number.isNaN(f)&&(f=0),{nextArgIndex:N+1}}else if(N+1<t.length)return f=Number.parseFloat(t[N+1]),Number.isNaN(f)&&(f=0),{nextArgIndex:N+2};return{nextArgIndex:N+1}}else if(v==="e"||v==="i"||v==="P"){if(v==="i"&&N+1<t.length)return{nextArgIndex:N+2};P++}else P++}}}return{nextArgIndex:N+1}};for(;h<t.length;){let k=t[h];if(k.startsWith("-")&&k.length>1&&k!=="--"){let N=d(k,h);if(N.nextArgIndex===-1)return{stdout:"",stderr:"",exitCode:2};if(N.nextArgIndex===-2)return{stdout:"",stderr:"",exitCode:1};h=N.nextArgIndex}else if(k==="--")for(h++;h<t.length;)p.push(t[h]),h++;else p.push(k),h++}if(m)return z("","",1);if(p.length===0&&c===null&&p.push("REPLY"),f===0){if(c)wn(e,c);else{for(let k of p)e.state.env.set(k,"");p.length===0&&e.state.env.set("REPLY","")}return z("","",0)}if(f<0&&f!==-1)return z("","",1);let g=n;u>=0?e.state.fileDescriptors?g=e.state.fileDescriptors.get(u)||"":g="":!g&&e.state.groupStdin!==void 0&&(g=e.state.groupStdin);let w=i===""?"\0":i,y="",b=0,x=!0,S=k=>{if(u>=0&&e.state.fileDescriptors)e.state.fileDescriptors.set(u,g.substring(k));else if(r>=0&&e.state.fileDescriptors){let N=e.state.fileDescriptors.get(r);if(N?.startsWith("__rw__:")){let P=FE(N);if(P){let v=P.position+k;e.state.fileDescriptors.set(r,ME(P.path,v,P.content))}}}else e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=g.substring(k))};if(l>=0){let k=Math.min(l,g.length);y=g.substring(0,k),b=k,x=k>=l,S(b);let N=p[0]||"REPLY";e.state.env.set(N,y);for(let P=1;P<p.length;P++)e.state.env.set(p[P],"");return z("","",x?0:1)}else if(o>=0){let k=0,N=0,P=!1;for(;N<g.length&&k<o;){let v=g[N];if(v===w){b=N+1,P=!0;break}if(!s&&v==="\\"&&N+1<g.length){let T=g[N+1];if(T===w&&w===`
1308
- `){N+=2,b=N;continue}if(T===w){N+=2,k++,y+=T,b=N;continue}y+=T,N+=2,k++,b=N}else y+=v,N++,k++,b=N}x=k>=o||P,S(b)}else{b=0;let k=0;for(;k<g.length;){let N=g[k];if(N===w){b=k+w.length,x=!0;break}if(!s&&N==="\\"&&k+1<g.length){let P=g[k+1];if(P===`
1309
- `){k+=2;continue}if(P===w){y+=P,k+=2;continue}y+=N,y+=P,k+=2;continue}y+=N,k++}if(k>=g.length&&(x=!1,b=k,y.length===0&&g.length===0)){for(let N of p)e.state.env.set(N,"");return c&&wn(e,c),z("","",1)}S(b)}w===`
1307
+ `,a="",o=-1,l=-1,c=null,u=-1,f=-1,p=[],h=0,m=!1,d=(v,N)=>{let P=1;for(;P<v.length;){let k=v[P];if(k==="r")s=!0,P++;else if(k==="s")P++;else{if(k==="d")return P+1<v.length?(i=v.substring(P+1),{nextArgIndex:N+1}):N+1<t.length?(i=t[N+1],{nextArgIndex:N+2}):{nextArgIndex:N+1};if(k==="n"){if(P+1<v.length){let T=v.substring(P+1);return o=Number.parseInt(T,10),(Number.isNaN(o)||o<0)&&(m=!0,o=0),{nextArgIndex:N+1}}else if(N+1<t.length)return o=Number.parseInt(t[N+1],10),(Number.isNaN(o)||o<0)&&(m=!0,o=0),{nextArgIndex:N+2};return{nextArgIndex:N+1}}else if(k==="N"){if(P+1<v.length){let T=v.substring(P+1);return l=Number.parseInt(T,10),(Number.isNaN(l)||l<0)&&(m=!0,l=0),{nextArgIndex:N+1}}else if(N+1<t.length)return l=Number.parseInt(t[N+1],10),(Number.isNaN(l)||l<0)&&(m=!0,l=0),{nextArgIndex:N+2};return{nextArgIndex:N+1}}else{if(k==="a")return P+1<v.length?(c=v.substring(P+1),{nextArgIndex:N+1}):N+1<t.length?(c=t[N+1],{nextArgIndex:N+2}):{nextArgIndex:N+1};if(k==="p")return P+1<v.length?(a=v.substring(P+1),{nextArgIndex:N+1}):N+1<t.length?(a=t[N+1],{nextArgIndex:N+2}):{nextArgIndex:N+1};if(k==="u"){if(P+1<v.length){let T=v.substring(P+1);return u=Number.parseInt(T,10),Number.isNaN(u)||u<0?{nextArgIndex:-2}:{nextArgIndex:N+1}}else if(N+1<t.length)return u=Number.parseInt(t[N+1],10),Number.isNaN(u)||u<0?{nextArgIndex:-2}:{nextArgIndex:N+2};return{nextArgIndex:N+1}}else if(k==="t"){if(P+1<v.length){let T=v.substring(P+1);return f=Number.parseFloat(T),Number.isNaN(f)&&(f=0),{nextArgIndex:N+1}}else if(N+1<t.length)return f=Number.parseFloat(t[N+1]),Number.isNaN(f)&&(f=0),{nextArgIndex:N+2};return{nextArgIndex:N+1}}else if(k==="e"||k==="i"||k==="P"){if(k==="i"&&N+1<t.length)return{nextArgIndex:N+2};P++}else P++}}}return{nextArgIndex:N+1}};for(;h<t.length;){let v=t[h];if(v.startsWith("-")&&v.length>1&&v!=="--"){let N=d(v,h);if(N.nextArgIndex===-1)return{stdout:"",stderr:"",exitCode:2};if(N.nextArgIndex===-2)return{stdout:"",stderr:"",exitCode:1};h=N.nextArgIndex}else if(v==="--")for(h++;h<t.length;)p.push(t[h]),h++;else p.push(v),h++}if(m)return z("","",1);if(p.length===0&&c===null&&p.push("REPLY"),f===0){if(c)wn(e,c);else{for(let v of p)e.state.env.set(v,"");p.length===0&&e.state.env.set("REPLY","")}return z("","",0)}if(f<0&&f!==-1)return z("","",1);let g=n;u>=0?e.state.fileDescriptors?g=e.state.fileDescriptors.get(u)||"":g="":!g&&e.state.groupStdin!==void 0&&(g=e.state.groupStdin);let w=i===""?"\0":i,y="",b=0,x=!0,S=v=>{if(u>=0&&e.state.fileDescriptors)e.state.fileDescriptors.set(u,g.substring(v));else if(r>=0&&e.state.fileDescriptors){let N=e.state.fileDescriptors.get(r);if(N?.startsWith("__rw__:")){let P=FE(N);if(P){let k=P.position+v;e.state.fileDescriptors.set(r,ME(P.path,k,P.content))}}}else e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=g.substring(v))};if(l>=0){let v=Math.min(l,g.length);y=g.substring(0,v),b=v,x=v>=l,S(b);let N=p[0]||"REPLY";e.state.env.set(N,y);for(let P=1;P<p.length;P++)e.state.env.set(p[P],"");return z("","",x?0:1)}else if(o>=0){let v=0,N=0,P=!1;for(;N<g.length&&v<o;){let k=g[N];if(k===w){b=N+1,P=!0;break}if(!s&&k==="\\"&&N+1<g.length){let T=g[N+1];if(T===w&&w===`
1308
+ `){N+=2,b=N;continue}if(T===w){N+=2,v++,y+=T,b=N;continue}y+=T,N+=2,v++,b=N}else y+=k,N++,v++,b=N}x=v>=o||P,S(b)}else{b=0;let v=0;for(;v<g.length;){let N=g[v];if(N===w){b=v+w.length,x=!0;break}if(!s&&N==="\\"&&v+1<g.length){let P=g[v+1];if(P===`
1309
+ `){v+=2;continue}if(P===w){y+=P,v+=2;continue}y+=N,y+=P,v+=2;continue}y+=N,v++}if(v>=g.length&&(x=!1,b=v,y.length===0&&g.length===0)){for(let N of p)e.state.env.set(N,"");return c&&wn(e,c),z("","",1)}S(b)}w===`
1310
1310
  `&&y.endsWith(`
1311
- `)&&(y=y.slice(0,-1));let $=k=>s?k:k.replace(/\\(.)/g,"$1");if(p.length===1&&p[0]==="REPLY")return e.state.env.set("REPLY",$(y)),z("","",x?0:1);let O=rt(e.state.env);if(c){let{words:k}=ac(y,O,void 0,s),N=e.limits?.maxArrayElements??1e5;if(k.length>N)return z("",`read: array element limit exceeded (${N})
1312
- `,1);wn(e,c);for(let P=0;P<k.length;P++)e.state.env.set(`${c}_${P}`,$(k[P]));return z("","",x?0:1)}let L=p.length,{words:R,wordStarts:W}=ac(y,O,L,s);for(let k=0;k<p.length;k++){let N=p[k];if(k<p.length-1)e.state.env.set(N,$(R[k]??""));else if(k<W.length){let P=y.substring(W[k]);P=Km(P,O,s),P=$(P),e.state.env.set(N,P)}else e.state.env.set(N,"")}return z("","",x?0:1)}ye();function ru(e,t){if(e.state.callDepth===0&&e.state.sourceDepth===0)return B("bash: return: can only `return' from a function or sourced script\n");let n=e.state.lastExitCode;if(t.length>0){let r=t[0],s=Number.parseInt(r,10);if(r===""||Number.isNaN(s)||!/^-?\d+$/.test(r))return B(`bash: return: ${r}: numeric argument required
1311
+ `)&&(y=y.slice(0,-1));let $=v=>s?v:v.replace(/\\(.)/g,"$1");if(p.length===1&&p[0]==="REPLY")return e.state.env.set("REPLY",$(y)),z("","",x?0:1);let O=rt(e.state.env);if(c){let{words:v}=ac(y,O,void 0,s),N=e.limits?.maxArrayElements??1e5;if(v.length>N)return z("",`read: array element limit exceeded (${N})
1312
+ `,1);wn(e,c);for(let P=0;P<v.length;P++)e.state.env.set(`${c}_${P}`,$(v[P]));return z("","",x?0:1)}let L=p.length,{words:R,wordStarts:W}=ac(y,O,L,s);for(let v=0;v<p.length;v++){let N=p[v];if(v<p.length-1)e.state.env.set(N,$(R[v]??""));else if(v<W.length){let P=y.substring(W[v]);P=Km(P,O,s),P=$(P),e.state.env.set(N,P)}else e.state.env.set(N,"")}return z("","",x?0:1)}ye();function ru(e,t){if(e.state.callDepth===0&&e.state.sourceDepth===0)return B("bash: return: can only `return' from a function or sourced script\n");let n=e.state.lastExitCode;if(t.length>0){let r=t[0],s=Number.parseInt(r,10);if(r===""||Number.isNaN(s)||!/^-?\d+$/.test(r))return B(`bash: return: ${r}: numeric argument required
1313
1313
  `,2);n=(s%256+256)%256}throw new ut(n)}ye();Xt();var Ra=`set: usage: set [-eux] [+eux] [-o option] [+o option]
1314
1314
  Options:
1315
1315
  -e Exit immediately if a command exits with non-zero status
@@ -1404,7 +1404,7 @@ ${e} ()
1404
1404
  `),a=1)}else if(e.commands.has(o)){let u=(e.state.env.get("PATH")??"/usr/bin:/bin").split(":"),f=null;for(let p of u){if(!p)continue;let h=`${p}/${o}`;try{let m=await e.fs.stat(h);if(!m.isDirectory&&(m.mode&73)!==0){f=h;break}}catch{}}f||(f=`/usr/bin/${o}`),r?s+=`${o} is ${f}
1405
1405
  `:s+=`${f}
1406
1406
  `}else r&&(i+=`${o}: not found
1407
- `),a=1}return z(s,i,a)}async function p6(e,t){if(t.includes("/")){let s=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(s)){try{let i=await e.fs.stat(s);if(i.isDirectory||!((i.mode&73)!==0))return null}catch{return null}return t}return null}let r=(e.state.env.get("PATH")??"/usr/bin:/bin").split(":");for(let s of r){if(!s)continue;let a=`${s.startsWith("/")?s:e.fs.resolvePath(e.state.cwd,s)}/${t}`;if(await e.fs.exists(a)){try{if((await e.fs.stat(a)).isDirectory)continue}catch{continue}return`${s}/${t}`}}if(e.commands.has(t)){for(let s of r)if(s==="/usr/bin"||s==="/bin")return`${s}/${t}`;return`/usr/bin/${t}`}return null}async function h6(e,t,n,r,s,i,a,o){let{ctx:l,runCommand:c}=e;if(l.coverage&&Jr.has(t)&&l.coverage.hit(`bash:builtin:${t}`),t==="export")return Qc(l,n);if(t==="unset")return cu(l,n);if(t==="exit")return Kc(l,n);if(t==="local")return eu(l,n);if(t==="set")return iu(l,n);if(t==="break")return Ac(l,n);if(t==="continue")return _c(l,n);if(t==="return")return ru(l,n);if(t==="eval"&&l.state.options.posix)return $a(l,n,s);if(t==="shift")return au(l,n);if(t==="getopts")return Oa(l,n);if(t==="compgen")return Rc(l,n);if(t==="complete")return Pc(l,n);if(t==="compopt")return Dc(l,n);if(t==="pushd")return await Vc(l,n);if(t==="popd")return qc(l,n);if(t==="dirs")return Zc(l,n);if(t==="source"||t===".")return ou(l,n);if(t==="read")return nu(l,n,s,o);if(t==="mapfile"||t==="readarray")return tu(l,n,s);if(t==="declare"||t==="typeset")return Hc(l,n);if(t==="readonly")return jc(l,n);if(!i){let u=l.state.functions.get(t);if(u)return va(l,u,n,s)}if(t==="eval")return $a(l,n,s);if(t==="cd")return await Sc(l,n);if(t===":"||t==="true")return de;if(t==="false")return Je(!1);if(t==="let")return Jc(l,n);if(t==="command")return QE(e,n,s);if(t==="builtin")return XE(e,n,s);if(t==="shopt")return i6(l,n);if(t==="exec"){if(n.length===0)return de;let[u,...f]=n;return c(u,f,[],s,!1,!1,-1)}if(t==="wait")return de;if(t==="type")return await u6(l,n,u=>p6(l,u),u=>Pa(l,u));if(t==="hash")return Xc(l,n);if(t==="help")return Yc(l,n);if(t==="["||t==="test"){let u=n;if(t==="["){if(n[n.length-1]!=="]")return B("[: missing `]'\n",2);u=n.slice(0,-1)}return Ls(l,u)}return null}async function QE(e,t,n){let{ctx:r,runCommand:s}=e;if(t.length===0)return de;let i=!1,a=!1,o=!1,l=t;for(;l.length>0&&l[0].startsWith("-");){let f=l[0];if(f==="--"){l=l.slice(1);break}for(let p of f.slice(1))p==="p"?i=!0:p==="V"?a=!0:p==="v"&&(o=!0);l=l.slice(1)}if(l.length===0)return de;if(o||a)return await f6(r,l,o,a);let[c,...u]=l;return s(c,u,[],n,!0,i,-1)}async function XE(e,t,n){let{runCommand:r}=e;if(t.length===0)return de;let s=t;if(s[0]==="--"&&(s=s.slice(1),s.length===0))return de;let i=s[0];if(!Jr.has(i))return B(`bash: builtin: ${i}: not a shell builtin
1407
+ `),a=1}return z(s,i,a)}async function p6(e,t){if(t.includes("/")){let s=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(s)){try{let i=await e.fs.stat(s);if(i.isDirectory||!((i.mode&73)!==0))return null}catch{return null}return t}return null}let r=(e.state.env.get("PATH")??"/usr/bin:/bin").split(":");for(let s of r){if(!s)continue;let a=`${s.startsWith("/")?s:e.fs.resolvePath(e.state.cwd,s)}/${t}`;if(await e.fs.exists(a)){try{if((await e.fs.stat(a)).isDirectory)continue}catch{continue}return`${s}/${t}`}}if(e.commands.has(t)){for(let s of r)if(s==="/usr/bin"||s==="/bin")return`${s}/${t}`;return`/usr/bin/${t}`}return null}async function h6(e,t,n,r,s,i,a,o){let{ctx:l,runCommand:c}=e;if(l.coverage&&Jr.has(t)&&l.coverage.hit(`bash:builtin:${t}`),t==="export")return Qc(l,n);if(t==="unset")return cu(l,n);if(t==="exit")return Kc(l,n);if(t==="local")return eu(l,n);if(t==="set")return iu(l,n);if(t==="break")return Ac(l,n);if(t==="continue")return _c(l,n);if(t==="return")return ru(l,n);if(t==="eval"&&l.state.options.posix)return $a(l,n,s);if(t==="shift")return au(l,n);if(t==="getopts")return Oa(l,n);if(t==="compgen")return Rc(l,n);if(t==="complete")return Pc(l,n);if(t==="compopt")return Dc(l,n);if(t==="pushd")return await Vc(l,n);if(t==="popd")return qc(l,n);if(t==="dirs")return Zc(l,n);if(t==="source"||t===".")return ou(l,n);if(t==="read")return nu(l,n,s,o);if(t==="mapfile"||t==="readarray")return tu(l,n,s);if(t==="declare"||t==="typeset")return Hc(l,n);if(t==="readonly")return jc(l,n);if(!i){let u=l.state.functions.get(t);if(u)return ka(l,u,n,s)}if(t==="eval")return $a(l,n,s);if(t==="cd")return await Sc(l,n);if(t===":"||t==="true")return de;if(t==="false")return Je(!1);if(t==="let")return Jc(l,n);if(t==="command")return QE(e,n,s);if(t==="builtin")return XE(e,n,s);if(t==="shopt")return i6(l,n);if(t==="exec"){if(n.length===0)return de;let[u,...f]=n;return c(u,f,[],s,!1,!1,-1)}if(t==="wait")return de;if(t==="type")return await u6(l,n,u=>p6(l,u),u=>Pa(l,u));if(t==="hash")return Xc(l,n);if(t==="help")return Yc(l,n);if(t==="["||t==="test"){let u=n;if(t==="["){if(n[n.length-1]!=="]")return B("[: missing `]'\n",2);u=n.slice(0,-1)}return Ls(l,u)}return null}async function QE(e,t,n){let{ctx:r,runCommand:s}=e;if(t.length===0)return de;let i=!1,a=!1,o=!1,l=t;for(;l.length>0&&l[0].startsWith("-");){let f=l[0];if(f==="--"){l=l.slice(1);break}for(let p of f.slice(1))p==="p"?i=!0:p==="V"?a=!0:p==="v"&&(o=!0);l=l.slice(1)}if(l.length===0)return de;if(o||a)return await f6(r,l,o,a);let[c,...u]=l;return s(c,u,[],n,!0,i,-1)}async function XE(e,t,n){let{runCommand:r}=e;if(t.length===0)return de;let s=t;if(s[0]==="--"&&(s=s.slice(1),s.length===0))return de;let i=s[0];if(!Jr.has(i))return B(`bash: builtin: ${i}: not a shell builtin
1408
1408
  `);let[,...a]=s;return r(i,a,[],n,!0,!1,-1)}async function d6(e,t,n,r,s){let{ctx:i,buildExportedEnv:a,executeUserScript:o}=e,c=await a6(i,t,s?"/usr/bin:/bin":void 0);if(!c)return Ag(t)?B(`bash: ${t}: command not available in browser environments. Exclude '${t}' from your commands or use the Node.js bundle.
1409
1409
  `,127):B(`bash: ${t}: command not found
1410
1410
  `,127);if("error"in c)return c.error==="permission_denied"?B(`bash: ${t}: Permission denied
@@ -1422,14 +1422,14 @@ ${e} ()
1422
1422
  `),s=e.includes(" "),i=e.includes("\\"),a=e.includes("'");if(n||r||s||i){let l="";for(let c of e){let u=c.charCodeAt(0);c===`
1423
1423
  `?l+="\\n":c===" "?l+="\\t":c==="\\"?l+="\\\\":c==="'"?l+="'":c==='"'?l+='"':u<32||u===127?u<256?l+=`\\x${u.toString(16).padStart(2,"0")}`:l+=`\\u${u.toString(16).padStart(4,"0")}`:l+=c}return`$'${l}'`}return a?`"${e.replace(/([\\$`"])/g,"\\$1")}"`:`'${e}'`}async function C6(e,t,n){if(!e.state.options.xtrace)return"";let r=await S6(e),s=[t,...n],i=YE(s);return`${r}${i}
1424
1424
  `}async function N6(e,t,n){return e.state.options.xtrace?`${await S6(e)}${t}=${n}
1425
- `:""}ye();async function k6(e,t,n){let r=t.timed?performance.now():0,s="",i=de,a=0,o=[],l="",c=t.commands.length>1,u=e.state.lastArg;for(let p=0;p<t.commands.length;p++){let h=t.commands[p],m=p===t.commands.length-1,d=p===0;c&&(e.state.lastArg="",d||(e.state.groupStdin=void 0));let w=c&&(!m||!e.state.shoptOptions.lastpipe)?new Map(e.state.env):null,y;try{y=await n(h,s)}catch(b){if(b instanceof bt)y={stdout:b.stdout,stderr:b.stderr,exitCode:1};else if(b instanceof pe&&t.commands.length>1)y={stdout:b.stdout,stderr:b.stderr,exitCode:b.exitCode};else if(b instanceof $t&&t.commands.length>1)y={stdout:b.stdout,stderr:b.stderr,exitCode:b.exitCode};else throw w&&(e.state.env=w),b}w&&(e.state.env=w),o.push(y.exitCode),y.exitCode!==0&&(a=y.exitCode),m?i=y:(t.pipeStderr?.[p]??!1?s=y.stderr+y.stdout:(s=y.stdout,l+=y.stderr),i={stdout:"",stderr:"",exitCode:y.exitCode})}if(l&&(i={...i,stderr:l+i.stderr}),t.commands.length>1||t.commands.length===1&&t.commands[0].type==="SimpleCommand"){for(let p of e.state.env.keys())p.startsWith("PIPESTATUS_")&&e.state.env.delete(p);for(let p=0;p<o.length;p++)e.state.env.set(`PIPESTATUS_${p}`,String(o[p]));e.state.env.set("PIPESTATUS__length",String(o.length))}if(e.state.options.pipefail&&a!==0&&(i={...i,exitCode:a}),t.negated&&(i={...i,exitCode:i.exitCode===0?1:0}),t.timed){let h=(performance.now()-r)/1e3,m=Math.floor(h/60),d=h%60,g;t.timePosix?g=`real ${h.toFixed(2)}
1425
+ `:""}ye();async function v6(e,t,n){let r=t.timed?performance.now():0,s="",i=de,a=0,o=[],l="",c=t.commands.length>1,u=e.state.lastArg;for(let p=0;p<t.commands.length;p++){let h=t.commands[p],m=p===t.commands.length-1,d=p===0;c&&(e.state.lastArg="",d||(e.state.groupStdin=void 0));let w=c&&(!m||!e.state.shoptOptions.lastpipe)?new Map(e.state.env):null,y;try{y=await n(h,s)}catch(b){if(b instanceof bt)y={stdout:b.stdout,stderr:b.stderr,exitCode:1};else if(b instanceof pe&&t.commands.length>1)y={stdout:b.stdout,stderr:b.stderr,exitCode:b.exitCode};else if(b instanceof $t&&t.commands.length>1)y={stdout:b.stdout,stderr:b.stderr,exitCode:b.exitCode};else throw w&&(e.state.env=w),b}w&&(e.state.env=w),o.push(y.exitCode),y.exitCode!==0&&(a=y.exitCode),m?i=y:(t.pipeStderr?.[p]??!1?s=y.stderr+y.stdout:(s=y.stdout,l+=y.stderr),i={stdout:"",stderr:"",exitCode:y.exitCode})}if(l&&(i={...i,stderr:l+i.stderr}),t.commands.length>1||t.commands.length===1&&t.commands[0].type==="SimpleCommand"){for(let p of e.state.env.keys())p.startsWith("PIPESTATUS_")&&e.state.env.delete(p);for(let p=0;p<o.length;p++)e.state.env.set(`PIPESTATUS_${p}`,String(o[p]));e.state.env.set("PIPESTATUS__length",String(o.length))}if(e.state.options.pipefail&&a!==0&&(i={...i,exitCode:a}),t.negated&&(i={...i,exitCode:i.exitCode===0?1:0}),t.timed){let h=(performance.now()-r)/1e3,m=Math.floor(h/60),d=h%60,g;t.timePosix?g=`real ${h.toFixed(2)}
1426
1426
  user 0.00
1427
1427
  sys 0.00
1428
1428
  `:g=`
1429
1429
  real ${`${m}m${d.toFixed(3)}s`}
1430
1430
  user 0m0.000s
1431
1431
  sys 0m0.000s
1432
- `,i={...i,stderr:i.stderr+g}}return c&&!e.state.shoptOptions.lastpipe&&(e.state.lastArg=u),i}mt();Xe();Ct();ye();Nt();Xt();an();Wn();async function v6(e,t){let n=new Map,r="";for(let s of t.assignments){let i=s.name;if(s.array){let u=await eA(e,t,i,s.array,s.append,n);if(u.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:u.error};if(r+=u.xtraceOutput,u.continueToNext)continue}let a=s.value?await ie(e,s.value):"";if(i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[\]$/))return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:z("",`bash: ${i}: bad array subscript
1432
+ `,i={...i,stderr:i.stderr+g}}return c&&!e.state.shoptOptions.lastpipe&&(e.state.lastArg=u),i}mt();Xe();Ct();ye();Nt();Xt();an();Wn();async function k6(e,t){let n=new Map,r="";for(let s of t.assignments){let i=s.name;if(s.array){let u=await eA(e,t,i,s.array,s.append,n);if(u.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:u.error};if(r+=u.xtraceOutput,u.continueToNext)continue}let a=s.value?await ie(e,s.value):"";if(i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[\]$/))return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:z("",`bash: ${i}: bad array subscript
1433
1433
  `,1)};let l=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(l){let u=await iA(e,t,l[1],l[2],a,s.append,n);if(u.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:u.error};if(u.continueToNext)continue}let c=await oA(e,t,i,a,s.append,n);if(c.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:c.error};r+=c.xtraceOutput,c.continueToNext}return{continueToNext:!1,xtraceOutput:r,tempAssignments:n}}async function eA(e,t,n,r,s,i){let a="";if(/\[.+\]$/.test(n))return{continueToNext:!1,xtraceOutput:"",error:z("",`bash: ${n}: cannot assign list to array member
1434
1434
  `,1)};if(Te(e,n)){let u=ur(e,n);if(u===void 0||u==="")throw new pe(1,"","");let f=St(e,n);if(f&&/^[a-zA-Z_][a-zA-Z0-9_]*\[@\]$/.test(f))return{continueToNext:!1,xtraceOutput:"",error:z("",`bash: ${n}: cannot assign list to array member
1435
1435
  `,1)}}if(En(e,n)){if(t.name)return a+=`bash: ${n}: readonly variable
@@ -1441,7 +1441,7 @@ sys 0m0.000s
1441
1441
  `,1)}}}return{index:s}}async function oA(e,t,n,r,s,i){let a="",o=n,l=null;if(Te(e,n)){let f=Jm(e,n,r);if(f===void 0)return{continueToNext:!1,xtraceOutput:"",error:z("",`bash: ${n}: circular name reference
1442
1442
  `,1)};if(f===null)return{continueToNext:!0,xtraceOutput:""};o=f;let p=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);p&&(l={arrayName:p[1],subscriptExpr:p[2]},o=p[1])}if(En(e,o)){if(t.name)return a+=`bash: ${o}: readonly variable
1443
1443
  `,{continueToNext:!0,xtraceOutput:a};let f=it(e,o);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let c;if(Fs(e,o))try{let f=new ce;if(s){let h=`(${e.state.env.get(o)||"0"}) + (${r})`,m=Ae(f,h);c=String(await ne(e,m.expression))}else{let p=Ae(f,r);c=String(await ne(e,p.expression))}}catch{c="0"}else{let{isArray:f}=await Promise.resolve().then(()=>(Nt(),bc)),p=f(e,o)?`${o}_0`:o;c=s?(e.state.env.get(p)||"")+r:r}c=ts(e,o,c),a+=await N6(e,o,c);let u=o;if(l)u=await lA(e,l);else{let{isArray:f}=await Promise.resolve().then(()=>(Nt(),bc));f(e,o)&&(u=`${o}_0`)}return t.name?(i.set(u,e.state.env.get(u)),e.state.env.set(u,c)):(e.state.env.set(u,c),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(o)),e.state.tempEnvBindings?.some(f=>f.has(o))&&(e.state.mutatedTempEnvVars=e.state.mutatedTempEnvVars||new Set,e.state.mutatedTempEnvVars.add(o))),{continueToNext:!1,xtraceOutput:a}}async function lA(e,t){let{arrayName:n,subscriptExpr:r}=t;if(e.state.associativeArrays?.has(n))return I6(e,n,r);let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else{try{let a=new ce,o=Ae(a,r);i=await ne(e,o.expression,!1)}catch{let a=e.state.env.get(r);i=a?Number.parseInt(a,10):0}Number.isNaN(i)&&(i=0)}if(i<0){let a=oe(e,n);a.length>0&&(i=Math.max(...a.map(l=>l[0]))+1+i)}return`${n}_${i}`}Xe();ye();Nt();zt();async function $6(e,t,n,r){let s=await Sn(e,t.redirections);if(s)return s;let i=new Map(e.state.env),a=e.state.cwd,o={...e.state.options},l=new Map(e.state.functions),c=e.state.localScopes,u=e.state.localVarStack,f=e.state.localVarDepth,p=e.state.fullyUnsetLocals;if(e.state.localScopes=c.map(O=>new Map(O)),u){e.state.localVarStack=new Map;for(let[O,L]of u.entries())e.state.localVarStack.set(O,L.map(R=>({...R})))}f&&(e.state.localVarDepth=new Map(f)),p&&(e.state.fullyUnsetLocals=new Map(p));let h=e.state.loopDepth,m=e.state.parentHasLoopContext;e.state.parentHasLoopContext=h>0,e.state.loopDepth=0;let d=e.state.lastArg,g=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let w=e.state.groupStdin;n&&(e.state.groupStdin=n);let y="",b="",x=0,S=()=>{e.state.env=i,e.state.cwd=a,e.state.options=o,e.state.functions=l,e.state.localScopes=c,e.state.localVarStack=u,e.state.localVarDepth=f,e.state.fullyUnsetLocals=p,e.state.loopDepth=h,e.state.parentHasLoopContext=m,e.state.groupStdin=w,e.state.bashPid=g,e.state.lastArg=d};try{for(let O of t.body){let L=await r(O);y+=L.stdout,b+=L.stderr,x=L.exitCode}}catch(O){if(S(),O instanceof J)throw O;if(O instanceof pn){y+=O.stdout,b+=O.stderr;let R=z(y,b,0);return ze(e,R,t.redirections)}if(O instanceof ht||O instanceof dt){y+=O.stdout,b+=O.stderr;let R=z(y,b,0);return ze(e,R,t.redirections)}if(O instanceof pe){y+=O.stdout,b+=O.stderr;let R=z(y,b,O.exitCode);return ze(e,R,t.redirections)}if(O instanceof ut){y+=O.stdout,b+=O.stderr;let R=z(y,b,O.exitCode);return ze(e,R,t.redirections)}if(O instanceof $t){let R=z(y+O.stdout,b+O.stderr,O.exitCode);return ze(e,R,t.redirections)}let L=z(y,`${b}${Ue(O)}
1444
- `,1);return ze(e,L,t.redirections)}S();let $=z(y,b,x);return ze(e,$,t.redirections)}async function O6(e,t,n,r){let s="",i="",a=0,o=await ka(e,t.redirections);if(o)return o;let l=n;for(let f of t.redirections)if((f.operator==="<<"||f.operator==="<<-")&&f.target.type==="HereDoc"){let p=f.target,h=await ie(e,p.content);p.stripTabs&&(h=h.split(`
1444
+ `,1);return ze(e,L,t.redirections)}S();let $=z(y,b,x);return ze(e,$,t.redirections)}async function O6(e,t,n,r){let s="",i="",a=0,o=await va(e,t.redirections);if(o)return o;let l=n;for(let f of t.redirections)if((f.operator==="<<"||f.operator==="<<-")&&f.target.type==="HereDoc"){let p=f.target,h=await ie(e,p.content);p.stripTabs&&(h=h.split(`
1445
1445
  `).map(d=>d.replace(/^\t+/,"")).join(`
1446
1446
  `));let m=f.fd??0;m!==0?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),e.state.fileDescriptors.set(m,h)):l=h}else if(f.operator==="<<<"&&f.target.type==="Word")l=`${await ie(e,f.target)}
1447
1447
  `;else if(f.operator==="<"&&f.target.type==="Word")try{let p=await ie(e,f.target),h=e.fs.resolvePath(e.state.cwd,p);l=await e.fs.readFile(h)}catch{let p=await ie(e,f.target);return z("",`bash: ${p}: No such file or directory
@@ -1450,7 +1450,7 @@ sys 0m0.000s
1450
1450
  `,127)}if(i.startsWith("#!")){let g=i.indexOf(`
1451
1451
  `);g!==-1&&(i=i.slice(g+1))}let a=new Map(e.state.env),o=e.state.cwd,l={...e.state.options},c=e.state.loopDepth,u=e.state.parentHasLoopContext,f=e.state.lastArg,p=e.state.bashPid,h=e.state.groupStdin,m=e.state.currentSource;e.state.parentHasLoopContext=c>0,e.state.loopDepth=0,e.state.bashPid=e.state.nextVirtualPid++,r&&(e.state.groupStdin=r),e.state.currentSource=t,e.state.env.set("0",t),e.state.env.set("#",String(n.length)),e.state.env.set("@",n.join(" ")),e.state.env.set("*",n.join(" "));for(let g=0;g<n.length&&g<9;g++)e.state.env.set(String(g+1),n[g]);for(let g=n.length+1;g<=9;g++)e.state.env.delete(String(g));let d=()=>{e.state.env=a,e.state.cwd=o,e.state.options=l,e.state.loopDepth=c,e.state.parentHasLoopContext=u,e.state.lastArg=f,e.state.bashPid=p,e.state.groupStdin=h,e.state.currentSource=m};try{let w=new ce().parse(i),y=await s(w);return d(),y}catch(g){if(d(),g instanceof pe||g instanceof J)throw g;if(g.name==="ParseException")return B(`bash: ${t}: ${g.message}
1452
1452
  `);throw g}}var Ws=class{ctx;constructor(t,n){this.ctx={state:n,fs:t.fs,commands:t.commands,limits:t.limits,execFn:t.exec,executeScript:this.executeScript.bind(this),executeStatement:this.executeStatement.bind(this),executeCommand:this.executeCommand.bind(this),fetch:t.fetch,sleep:t.sleep,trace:t.trace,coverage:t.coverage}}buildExportedEnv(){let t=this.ctx.state.exportedVars,n=this.ctx.state.tempExportedVars,r=new Set;if(t)for(let i of t)r.add(i);if(n)for(let i of n)r.add(i);if(r.size===0)return Object.create(null);let s=Object.create(null);for(let i of r){let a=this.ctx.state.env.get(i);a!==void 0&&(s[i]=a)}return s}async executeScript(t){let n="",r="",s=0;for(let i of t.statements)try{let a=await this.executeStatement(i);n+=a.stdout,r+=a.stderr,s=a.exitCode,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s))}catch(a){if(a instanceof pe)throw a.prependOutput(n,r),a;if(a instanceof Wt)return n+=a.stdout,r+=a.stderr,s=a.exitCode,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:Et(this.ctx.state.env)};if(a instanceof J)throw a;if(a instanceof $t)return n+=a.stdout,r+=a.stderr,s=a.exitCode,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:Et(this.ctx.state.env)};if(a instanceof wt)return n+=a.stdout,r+=a.stderr,s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:Et(this.ctx.state.env)};if(a instanceof bt)return n+=a.stdout,r+=a.stderr,s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:Et(this.ctx.state.env)};if(a instanceof Oe){n+=a.stdout,r+=a.stderr,s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s));continue}if(a instanceof br){n+=a.stdout,r+=a.stderr,s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s));continue}if(a instanceof ht||a instanceof dt){if(this.ctx.state.loopDepth>0)throw a.prependOutput(n,r),a;n+=a.stdout,r+=a.stderr;continue}throw a instanceof ut&&a.prependOutput(n,r),a}return{stdout:n,stderr:r,exitCode:s,env:Et(this.ctx.state.env)}}async executeUserScript(t,n,r=""){return R6(this.ctx,t,n,r,s=>this.executeScript(s))}async executeStatement(t){if(this.ctx.state.commandCount++,this.ctx.state.commandCount>this.ctx.limits.maxCommandCount&&On(`too many commands executed (>${this.ctx.limits.maxCommandCount}), increase executionLimits.maxCommandCount`,"commands"),t.deferredError)throw new lt(t.deferredError.message,t.line??1,1);if(this.ctx.state.options.noexec)return de;this.ctx.state.errexitSafe=!1;let n="",r="";this.ctx.state.options.verbose&&!this.ctx.state.suppressVerbose&&t.sourceText&&(r+=`${t.sourceText}
1453
- `);let s=0,i=-1,a=!1;for(let c=0;c<t.pipelines.length;c++){let u=t.pipelines[c],f=c>0?t.operators[c-1]:null;if(f==="&&"&&s!==0||f==="||"&&s===0)continue;let p=await this.executePipeline(u);n+=p.stdout,r+=p.stderr,s=p.exitCode,i=c,a=u.negated,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s))}let o=i<t.pipelines.length-1,l=this.ctx.state.errexitSafe;if(this.ctx.state.errexitSafe=o||a||l,this.ctx.state.options.errexit&&s!==0&&i===t.pipelines.length-1&&!a&&!this.ctx.state.inCondition&&!l)throw new $t(s,n,r);return z(n,r,s)}async executePipeline(t){return k6(this.ctx,t,(n,r)=>this.executeCommand(n,r))}async executeCommand(t,n){switch(this.ctx.coverage?.hit(`bash:cmd:${t.type}`),t.type){case"SimpleCommand":return this.executeSimpleCommand(t,n);case"If":return m6(this.ctx,t);case"For":return g6(this.ctx,t);case"CStyleFor":return y6(this.ctx,t);case"While":return w6(this.ctx,t,n);case"Until":return b6(this.ctx,t);case"Case":return x6(this.ctx,t);case"Subshell":return this.executeSubshell(t,n);case"Group":return this.executeGroup(t,n);case"FunctionDef":return Fg(this.ctx,t);case"ArithmeticCommand":return this.executeArithmeticCommand(t);case"ConditionalCommand":return this.executeConditionalCommand(t);default:return de}}async executeSimpleCommand(t,n){try{return await this.executeSimpleCommandInner(t,n)}catch(r){if(r instanceof fn)return B(r.stderr);throw r}}async executeSimpleCommandInner(t,n){if(t.line!==void 0&&(this.ctx.state.currentLine=t.line),this.ctx.state.shoptOptions.expand_aliases&&t.name){let x=t,S=100;for(;S>0;){let $=this.expandAlias(x);if($===x)break;x=$,S--}this.aliasExpansionStack.clear(),x!==t&&(t=x)}this.ctx.state.expansionStderr="";let r=await v6(this.ctx,t);if(r.error)return r.error;let s=r.tempAssignments,i=r.xtraceOutput;if(!t.name){if(t.redirections.length>0){let S=await Sn(this.ctx,t.redirections);if(S)return S;let $=z("",i,0);return ze(this.ctx,$,t.redirections)}this.ctx.state.lastArg="";let x=(this.ctx.state.expansionStderr||"")+i;return this.ctx.state.expansionStderr="",z("",x,this.ctx.state.lastExitCode)}let a=t.name&&pu(t.name,["local","declare","typeset","export","readonly"]),o=Array.from(s.keys());if(o.length>0&&!a){this.ctx.state.tempExportedVars=this.ctx.state.tempExportedVars||new Set;for(let x of o)this.ctx.state.tempExportedVars.add(x)}let l=await ka(this.ctx,t.redirections);if(l){for(let[x,S]of s)S===void 0?this.ctx.state.env.delete(x):this.ctx.state.env.set(x,S);return l}let c=-1;for(let x of t.redirections){if((x.operator==="<<"||x.operator==="<<-")&&x.target.type==="HereDoc"){let S=x.target,$=await ie(this.ctx,S.content);S.stripTabs&&($=$.split(`
1453
+ `);let s=0,i=-1,a=!1;for(let c=0;c<t.pipelines.length;c++){let u=t.pipelines[c],f=c>0?t.operators[c-1]:null;if(f==="&&"&&s!==0||f==="||"&&s===0)continue;let p=await this.executePipeline(u);n+=p.stdout,r+=p.stderr,s=p.exitCode,i=c,a=u.negated,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s))}let o=i<t.pipelines.length-1,l=this.ctx.state.errexitSafe;if(this.ctx.state.errexitSafe=o||a||l,this.ctx.state.options.errexit&&s!==0&&i===t.pipelines.length-1&&!a&&!this.ctx.state.inCondition&&!l)throw new $t(s,n,r);return z(n,r,s)}async executePipeline(t){return v6(this.ctx,t,(n,r)=>this.executeCommand(n,r))}async executeCommand(t,n){switch(this.ctx.coverage?.hit(`bash:cmd:${t.type}`),t.type){case"SimpleCommand":return this.executeSimpleCommand(t,n);case"If":return m6(this.ctx,t);case"For":return g6(this.ctx,t);case"CStyleFor":return y6(this.ctx,t);case"While":return w6(this.ctx,t,n);case"Until":return b6(this.ctx,t);case"Case":return x6(this.ctx,t);case"Subshell":return this.executeSubshell(t,n);case"Group":return this.executeGroup(t,n);case"FunctionDef":return Fg(this.ctx,t);case"ArithmeticCommand":return this.executeArithmeticCommand(t);case"ConditionalCommand":return this.executeConditionalCommand(t);default:return de}}async executeSimpleCommand(t,n){try{return await this.executeSimpleCommandInner(t,n)}catch(r){if(r instanceof fn)return B(r.stderr);throw r}}async executeSimpleCommandInner(t,n){if(t.line!==void 0&&(this.ctx.state.currentLine=t.line),this.ctx.state.shoptOptions.expand_aliases&&t.name){let x=t,S=100;for(;S>0;){let $=this.expandAlias(x);if($===x)break;x=$,S--}this.aliasExpansionStack.clear(),x!==t&&(t=x)}this.ctx.state.expansionStderr="";let r=await k6(this.ctx,t);if(r.error)return r.error;let s=r.tempAssignments,i=r.xtraceOutput;if(!t.name){if(t.redirections.length>0){let S=await Sn(this.ctx,t.redirections);if(S)return S;let $=z("",i,0);return ze(this.ctx,$,t.redirections)}this.ctx.state.lastArg="";let x=(this.ctx.state.expansionStderr||"")+i;return this.ctx.state.expansionStderr="",z("",x,this.ctx.state.lastExitCode)}let a=t.name&&pu(t.name,["local","declare","typeset","export","readonly"]),o=Array.from(s.keys());if(o.length>0&&!a){this.ctx.state.tempExportedVars=this.ctx.state.tempExportedVars||new Set;for(let x of o)this.ctx.state.tempExportedVars.add(x)}let l=await va(this.ctx,t.redirections);if(l){for(let[x,S]of s)S===void 0?this.ctx.state.env.delete(x):this.ctx.state.env.set(x,S);return l}let c=-1;for(let x of t.redirections){if((x.operator==="<<"||x.operator==="<<-")&&x.target.type==="HereDoc"){let S=x.target,$=await ie(this.ctx,S.content);S.stripTabs&&($=$.split(`
1454
1454
  `).map(L=>L.replace(/^\t+/,"")).join(`
1455
1455
  `));let O=x.fd??0;O!==0?(this.ctx.state.fileDescriptors||(this.ctx.state.fileDescriptors=new Map),this.ctx.state.fileDescriptors.set(O,$)):n=$;continue}if(x.operator==="<<<"&&x.target.type==="Word"){n=`${await ie(this.ctx,x.target)}
1456
1456
  `;continue}if(x.operator==="<"&&x.target.type==="Word")try{let S=await ie(this.ctx,x.target),$=this.ctx.fs.resolvePath(this.ctx.state.cwd,S);n=await this.ctx.fs.readFile($)}catch{let S=await ie(this.ctx,x.target);for(let[$,O]of s)O===void 0?this.ctx.state.env.delete($):this.ctx.state.env.set($,O);return B(`bash: ${S}: No such file or directory
@@ -1458,16 +1458,16 @@ sys 0m0.000s
1458
1458
  `,127)}if(u==="exec"&&(f.length===0||f[0]==="--")){for(let x of t.redirections){if(x.target.type==="HereDoc"||x.fdVariable)continue;let S=await ie(this.ctx,x.target),$=x.fd??(x.operator==="<"||x.operator==="<>"?0:1);switch(this.ctx.state.fileDescriptors||(this.ctx.state.fileDescriptors=new Map),x.operator){case">":case">|":{let O=this.ctx.fs.resolvePath(this.ctx.state.cwd,S);await this.ctx.fs.writeFile(O,"","utf8"),this.ctx.state.fileDescriptors.set($,`__file__:${O}`);break}case">>":{let O=this.ctx.fs.resolvePath(this.ctx.state.cwd,S);this.ctx.state.fileDescriptors.set($,`__file_append__:${O}`);break}case"<":{let O=this.ctx.fs.resolvePath(this.ctx.state.cwd,S);try{let L=await this.ctx.fs.readFile(O);this.ctx.state.fileDescriptors.set($,L)}catch{return B(`bash: ${S}: No such file or directory
1459
1459
  `)}break}case"<>":{let O=this.ctx.fs.resolvePath(this.ctx.state.cwd,S);try{let L=await this.ctx.fs.readFile(O);this.ctx.state.fileDescriptors.set($,`__rw__:${O.length}:${O}:0:${L}`)}catch{await this.ctx.fs.writeFile(O,"","utf8"),this.ctx.state.fileDescriptors.set($,`__rw__:${O.length}:${O}:0:`)}break}case">&":{if(S==="-")this.ctx.state.fileDescriptors.delete($);else if(S.endsWith("-")){let O=S.slice(0,-1),L=Number.parseInt(O,10);if(!Number.isNaN(L)){let R=this.ctx.state.fileDescriptors.get(L);R!==void 0?this.ctx.state.fileDescriptors.set($,R):this.ctx.state.fileDescriptors.set($,`__dupout__:${L}`),this.ctx.state.fileDescriptors.delete(L)}}else{let O=Number.parseInt(S,10);Number.isNaN(O)||this.ctx.state.fileDescriptors.set($,`__dupout__:${O}`)}break}case"<&":{if(S==="-")this.ctx.state.fileDescriptors.delete($);else if(S.endsWith("-")){let O=S.slice(0,-1),L=Number.parseInt(O,10);if(!Number.isNaN(L)){let R=this.ctx.state.fileDescriptors.get(L);R!==void 0?this.ctx.state.fileDescriptors.set($,R):this.ctx.state.fileDescriptors.set($,`__dupin__:${L}`),this.ctx.state.fileDescriptors.delete(L)}}else{let O=Number.parseInt(S,10);Number.isNaN(O)||this.ctx.state.fileDescriptors.set($,`__dupin__:${O}`)}break}}}for(let[x,S]of s)S===void 0?this.ctx.state.env.delete(x):this.ctx.state.env.set(x,S);if(this.ctx.state.tempExportedVars)for(let x of s.keys())this.ctx.state.tempExportedVars.delete(x);return de}let m=await C6(this.ctx,u,f);s.size>0&&(this.ctx.state.tempEnvBindings=this.ctx.state.tempEnvBindings||[],this.ctx.state.tempEnvBindings.push(new Map(s)));let d,g=null;try{d=await this.runCommand(u,f,p,n,!1,!1,c)}catch(x){if(x instanceof ht||x instanceof dt)g=x,d=de;else throw x}let w=i+m;if(w&&(d={...d,stderr:w+d.stderr}),d=await ze(this.ctx,d,t.redirections),g)throw g;if(f.length>0){let x=f[f.length-1];if((u==="declare"||u==="local"||u==="typeset")&&/^[a-zA-Z_][a-zA-Z0-9_]*=\(/.test(x)){let S=x.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);S&&(x=S[1])}this.ctx.state.lastArg=x}else this.ctx.state.lastArg=u;let y=_g(u)&&u!=="unset"&&u!=="eval";if(!this.ctx.state.options.posix||!y)for(let[x,S]of s)this.ctx.state.fullyUnsetLocals?.has(x)||(S===void 0?this.ctx.state.env.delete(x):this.ctx.state.env.set(x,S));if(this.ctx.state.tempExportedVars)for(let x of s.keys())this.ctx.state.tempExportedVars.delete(x);return s.size>0&&this.ctx.state.tempEnvBindings&&this.ctx.state.tempEnvBindings.pop(),this.ctx.state.expansionStderr&&(d={...d,stderr:this.ctx.state.expansionStderr+d.stderr},this.ctx.state.expansionStderr=""),d}async runCommand(t,n,r,s,i=!1,a=!1,o=-1){let l={ctx:this.ctx,runCommand:(u,f,p,h,m,d,g)=>this.runCommand(u,f,p,h,m,d,g),buildExportedEnv:()=>this.buildExportedEnv(),executeUserScript:(u,f,p)=>this.executeUserScript(u,f,p)},c=await h6(l,t,n,r,s,i,a,o);return c!==null?c:d6(l,t,n,s,a)}aliasExpansionStack=new Set;expandAlias(t){return Jl(this.ctx.state,t,this.aliasExpansionStack)}async findCommandInPath(t){return Pa(this.ctx,t)}async executeSubshell(t,n=""){return $6(this.ctx,t,n,r=>this.executeStatement(r))}async executeGroup(t,n=""){return O6(this.ctx,t,n,r=>this.executeStatement(r))}async executeArithmeticCommand(t){t.line!==void 0&&(this.ctx.state.currentLine=t.line);let n=await Sn(this.ctx,t.redirections);if(n)return n;try{let r=await ne(this.ctx,t.expression.expression),s=Je(r!==0);return this.ctx.state.expansionStderr&&(s={...s,stderr:this.ctx.state.expansionStderr+s.stderr},this.ctx.state.expansionStderr=""),ze(this.ctx,s,t.redirections)}catch(r){let s=B(`bash: arithmetic expression: ${r.message}
1460
1460
  `);return ze(this.ctx,s,t.redirections)}}async executeConditionalCommand(t){t.line!==void 0&&(this.ctx.state.currentLine=t.line);let n=await Sn(this.ctx,t.redirections);if(n)return n;try{let r=await jn(this.ctx,t.expression),s=Je(r);return this.ctx.state.expansionStderr&&(s={...s,stderr:this.ctx.state.expansionStderr+s.stderr},this.ctx.state.expansionStderr=""),ze(this.ctx,s,t.redirections)}catch(r){let s=r instanceof Oe?1:2,i=B(`bash: conditional expression: ${r.message}
1461
- `,s);return ze(this.ctx,i,t.redirections)}}};var kt={maxCallDepth:100,maxCommandCount:1e4,maxLoopIterations:1e4,maxAwkIterations:1e4,maxSedIterations:1e4,maxJqIterations:1e4,maxSqliteTimeoutMs:5e3,maxPythonTimeoutMs:3e4,maxGlobOperations:1e5,maxStringLength:10485760,maxArrayElements:1e5,maxHeredocSize:10485760,maxSubstitutionDepth:50,maxBraceExpansionResults:1e4};function T6(e){return e?{maxCallDepth:e.maxCallDepth??kt.maxCallDepth,maxCommandCount:e.maxCommandCount??kt.maxCommandCount,maxLoopIterations:e.maxLoopIterations??kt.maxLoopIterations,maxAwkIterations:e.maxAwkIterations??kt.maxAwkIterations,maxSedIterations:e.maxSedIterations??kt.maxSedIterations,maxJqIterations:e.maxJqIterations??kt.maxJqIterations,maxSqliteTimeoutMs:e.maxSqliteTimeoutMs??kt.maxSqliteTimeoutMs,maxPythonTimeoutMs:e.maxPythonTimeoutMs??kt.maxPythonTimeoutMs,maxGlobOperations:e.maxGlobOperations??kt.maxGlobOperations,maxStringLength:e.maxStringLength??kt.maxStringLength,maxArrayElements:e.maxArrayElements??kt.maxArrayElements,maxHeredocSize:e.maxHeredocSize??kt.maxHeredocSize,maxSubstitutionDepth:e.maxSubstitutionDepth??kt.maxSubstitutionDepth,maxBraceExpansionResults:e.maxBraceExpansionResults??kt.maxBraceExpansionResults}:{...kt}}function P6(e){try{let t=new URL(e);return{origin:t.origin,pathname:t.pathname,href:t.href}}catch{return null}}function cA(e){let t=P6(e);return t?{origin:t.origin,pathPrefix:t.pathname}:null}function uA(e,t){let n=P6(e);if(!n)return!1;let r=cA(t);return!r||n.origin!==r.origin?!1:r.pathPrefix==="/"||r.pathPrefix===""?!0:n.pathname.startsWith(r.pathPrefix)}function hu(e,t){return!t||t.length===0?!1:t.some(n=>uA(e,n))}var ns=class extends Error{constructor(t){super(`Network access denied: URL not in allow-list: ${t}`),this.name="NetworkAccessDeniedError"}},rs=class extends Error{constructor(t){super(`Too many redirects (max: ${t})`),this.name="TooManyRedirectsError"}},ss=class extends Error{constructor(t){super(`Redirect target not in allow-list: ${t}`),this.name="RedirectNotAllowedError"}},_a=class extends Error{constructor(t,n){super(`HTTP method '${t}' not allowed. Allowed methods: ${n.join(", ")}`),this.name="MethodNotAllowedError"}},zs=class extends Error{constructor(t){super(`Response body too large (max: ${t} bytes)`),this.name="ResponseTooLargeError"}};var fA=20,pA=3e4,hA=10485760,dA=["GET","HEAD"],mA=new Set(["GET","HEAD","OPTIONS"]),gA=new Set([301,302,303,307,308]);function du(e){let t=e.maxRedirects??fA,n=e.timeoutMs??pA,r=e.maxResponseSize??hA,s=e.dangerouslyAllowFullInternetAccess?["GET","HEAD","POST","PUT","DELETE","PATCH","OPTIONS"]:e.allowedMethods??dA;function i(l){if(!e.dangerouslyAllowFullInternetAccess&&!hu(l,e.allowedUrlPrefixes??[]))throw new ns(l)}function a(l){if(e.dangerouslyAllowFullInternetAccess)return;let c=l.toUpperCase();if(!s.includes(c))throw new _a(c,s)}async function o(l,c={}){let u=c.method?.toUpperCase()??"GET";i(l),a(u);let f=l,p=0,h=c.followRedirects??!0,m=c.timeoutMs!==void 0?Math.min(c.timeoutMs,n):n;for(;;){let d=new AbortController,g=setTimeout(()=>d.abort(),m);try{let w={method:u,headers:c.headers,signal:d.signal,redirect:"manual"};c.body&&!mA.has(u)&&(w.body=c.body);let y=await fetch(f,w);if(gA.has(y.status)&&h){let b=y.headers.get("location");if(!b)return await D6(y,f,r);let x=new URL(b,f).href;if(!e.dangerouslyAllowFullInternetAccess&&!hu(x,e.allowedUrlPrefixes??[]))throw new ss(x);if(p++,p>t)throw new rs(t);f=x;continue}return await D6(y,f,r)}finally{clearTimeout(g)}}}return o}async function D6(e,t,n){let r=Object.create(null);if(e.headers.forEach((i,a)=>{r[a.toLowerCase()]=i}),n>0){let i=e.headers.get("content-length");if(i){let a=parseInt(i,10);if(!Number.isNaN(a)&&a>n)throw new zs(n)}}let s;if(n>0&&e.body){let i=e.body.getReader(),a=new TextDecoder,o=[],l=0;for(;;){let{done:c,value:u}=await i.read();if(c)break;if(l+=u.byteLength,l>n)throw i.cancel(),new zs(n);o.push(a.decode(u,{stream:!0}))}o.push(a.decode()),s=o.join("")}else s=await e.text();return{status:e.status,statusText:e.statusText,headers:r,body:s,url:t}}Fn();Xe();function _6(){let e=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables"},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"exit",target:process,violationType:"process_exit",strategy:"throw",reason:"process.exit could terminate the interpreter"},{prop:"abort",target:process,violationType:"process_exit",strategy:"throw",reason:"process.abort could crash the interpreter"},{prop:"kill",target:process,violationType:"process_kill",strategy:"throw",reason:"process.kill could signal other processes"},{prop:"setuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setuid could escalate privileges"},{prop:"setgid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgid could escalate privileges"},{prop:"umask",target:process,violationType:"process_umask",strategy:"throw",reason:"process.umask could modify file creation permissions"},{prop:"argv",target:process,violationType:"process_argv",strategy:"throw",reason:"process.argv may contain secrets in CLI arguments"},{prop:"chdir",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.chdir could confuse the interpreter's CWD tracking"},{prop:"send",target:process,violationType:"process_send",strategy:"throw",reason:"process.send could communicate with parent process in IPC contexts"},{prop:"channel",target:process,violationType:"process_channel",strategy:"throw",reason:"process.channel could access IPC channel to parent process"},{prop:"cpuUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.cpuUsage could enable timing side-channel attacks"},{prop:"memoryUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.memoryUsage could enable timing side-channel attacks"},{prop:"hrtime",target:process,violationType:"process_timing",strategy:"throw",reason:"process.hrtime could enable timing side-channel attacks"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"}];try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&e.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&e.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let t=Object.getPrototypeOf(async function*(){}).constructor;t&&t!==Function&&t!==Object.getPrototypeOf(async()=>{}).constructor&&e.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}return e.filter(t=>{try{return t.target[t.prop]!==void 0}catch{return!1}})}import{AsyncLocalStorage as yA}from"node:async_hooks";var is=!0;function L6(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var gu=null;is||(gu=yA);var wA=`
1461
+ `,s);return ze(this.ctx,i,t.redirections)}}};var vt={maxCallDepth:100,maxCommandCount:1e4,maxLoopIterations:1e4,maxAwkIterations:1e4,maxSedIterations:1e4,maxJqIterations:1e4,maxSqliteTimeoutMs:5e3,maxPythonTimeoutMs:3e4,maxGlobOperations:1e5,maxStringLength:10485760,maxArrayElements:1e5,maxHeredocSize:10485760,maxSubstitutionDepth:50,maxBraceExpansionResults:1e4};function T6(e){return e?{maxCallDepth:e.maxCallDepth??vt.maxCallDepth,maxCommandCount:e.maxCommandCount??vt.maxCommandCount,maxLoopIterations:e.maxLoopIterations??vt.maxLoopIterations,maxAwkIterations:e.maxAwkIterations??vt.maxAwkIterations,maxSedIterations:e.maxSedIterations??vt.maxSedIterations,maxJqIterations:e.maxJqIterations??vt.maxJqIterations,maxSqliteTimeoutMs:e.maxSqliteTimeoutMs??vt.maxSqliteTimeoutMs,maxPythonTimeoutMs:e.maxPythonTimeoutMs??vt.maxPythonTimeoutMs,maxGlobOperations:e.maxGlobOperations??vt.maxGlobOperations,maxStringLength:e.maxStringLength??vt.maxStringLength,maxArrayElements:e.maxArrayElements??vt.maxArrayElements,maxHeredocSize:e.maxHeredocSize??vt.maxHeredocSize,maxSubstitutionDepth:e.maxSubstitutionDepth??vt.maxSubstitutionDepth,maxBraceExpansionResults:e.maxBraceExpansionResults??vt.maxBraceExpansionResults}:{...vt}}function P6(e){try{let t=new URL(e);return{origin:t.origin,pathname:t.pathname,href:t.href}}catch{return null}}function cA(e){let t=P6(e);return t?{origin:t.origin,pathPrefix:t.pathname}:null}function uA(e,t){let n=P6(e);if(!n)return!1;let r=cA(t);return!r||n.origin!==r.origin?!1:r.pathPrefix==="/"||r.pathPrefix===""?!0:n.pathname.startsWith(r.pathPrefix)}function hu(e,t){return!t||t.length===0?!1:t.some(n=>uA(e,n))}var ns=class extends Error{constructor(t){super(`Network access denied: URL not in allow-list: ${t}`),this.name="NetworkAccessDeniedError"}},rs=class extends Error{constructor(t){super(`Too many redirects (max: ${t})`),this.name="TooManyRedirectsError"}},ss=class extends Error{constructor(t){super(`Redirect target not in allow-list: ${t}`),this.name="RedirectNotAllowedError"}},_a=class extends Error{constructor(t,n){super(`HTTP method '${t}' not allowed. Allowed methods: ${n.join(", ")}`),this.name="MethodNotAllowedError"}},zs=class extends Error{constructor(t){super(`Response body too large (max: ${t} bytes)`),this.name="ResponseTooLargeError"}};var fA=20,pA=3e4,hA=10485760,dA=["GET","HEAD"],mA=new Set(["GET","HEAD","OPTIONS"]),gA=new Set([301,302,303,307,308]);function du(e){let t=e.maxRedirects??fA,n=e.timeoutMs??pA,r=e.maxResponseSize??hA,s=e.dangerouslyAllowFullInternetAccess?["GET","HEAD","POST","PUT","DELETE","PATCH","OPTIONS"]:e.allowedMethods??dA;function i(l){if(!e.dangerouslyAllowFullInternetAccess&&!hu(l,e.allowedUrlPrefixes??[]))throw new ns(l)}function a(l){if(e.dangerouslyAllowFullInternetAccess)return;let c=l.toUpperCase();if(!s.includes(c))throw new _a(c,s)}async function o(l,c={}){let u=c.method?.toUpperCase()??"GET";i(l),a(u);let f=l,p=0,h=c.followRedirects??!0,m=c.timeoutMs!==void 0?Math.min(c.timeoutMs,n):n;for(;;){let d=new AbortController,g=setTimeout(()=>d.abort(),m);try{let w={method:u,headers:c.headers,signal:d.signal,redirect:"manual"};c.body&&!mA.has(u)&&(w.body=c.body);let y=await fetch(f,w);if(gA.has(y.status)&&h){let b=y.headers.get("location");if(!b)return await D6(y,f,r);let x=new URL(b,f).href;if(!e.dangerouslyAllowFullInternetAccess&&!hu(x,e.allowedUrlPrefixes??[]))throw new ss(x);if(p++,p>t)throw new rs(t);f=x;continue}return await D6(y,f,r)}finally{clearTimeout(g)}}}return o}async function D6(e,t,n){let r=Object.create(null);if(e.headers.forEach((i,a)=>{r[a.toLowerCase()]=i}),n>0){let i=e.headers.get("content-length");if(i){let a=parseInt(i,10);if(!Number.isNaN(a)&&a>n)throw new zs(n)}}let s;if(n>0&&e.body){let i=e.body.getReader(),a=new TextDecoder,o=[],l=0;for(;;){let{done:c,value:u}=await i.read();if(c)break;if(l+=u.byteLength,l>n)throw i.cancel(),new zs(n);o.push(a.decode(u,{stream:!0}))}o.push(a.decode()),s=o.join("")}else s=await e.text();return{status:e.status,statusText:e.statusText,headers:r,body:s,url:t}}Fn();Xe();function _6(){let e=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables"},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"getBuiltinModule",target:process,violationType:"process_get_builtin_module",strategy:"throw",reason:"process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)"},{prop:"exit",target:process,violationType:"process_exit",strategy:"throw",reason:"process.exit could terminate the interpreter"},{prop:"abort",target:process,violationType:"process_exit",strategy:"throw",reason:"process.abort could crash the interpreter"},{prop:"kill",target:process,violationType:"process_kill",strategy:"throw",reason:"process.kill could signal other processes"},{prop:"setuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setuid could escalate privileges"},{prop:"setgid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgid could escalate privileges"},{prop:"umask",target:process,violationType:"process_umask",strategy:"throw",reason:"process.umask could modify file creation permissions"},{prop:"argv",target:process,violationType:"process_argv",strategy:"throw",reason:"process.argv may contain secrets in CLI arguments"},{prop:"chdir",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.chdir could confuse the interpreter's CWD tracking"},{prop:"send",target:process,violationType:"process_send",strategy:"throw",reason:"process.send could communicate with parent process in IPC contexts"},{prop:"channel",target:process,violationType:"process_channel",strategy:"throw",reason:"process.channel could access IPC channel to parent process"},{prop:"cpuUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.cpuUsage could enable timing side-channel attacks"},{prop:"memoryUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.memoryUsage could enable timing side-channel attacks"},{prop:"hrtime",target:process,violationType:"process_timing",strategy:"throw",reason:"process.hrtime could enable timing side-channel attacks"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"}];try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&e.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&e.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let t=Object.getPrototypeOf(async function*(){}).constructor;t&&t!==Function&&t!==Object.getPrototypeOf(async()=>{}).constructor&&e.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}return e.filter(t=>{try{return t.target[t.prop]!==void 0}catch{return!1}})}import{AsyncLocalStorage as yA}from"node:async_hooks";var is=!0;function L6(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var gu=null;is||(gu=yA);var wA=`
1462
1462
 
1463
1463
  This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`,ct=class extends Error{violation;constructor(t,n){super(t+wA),this.violation=n,this.name="SecurityViolationError"}},gt=!is&&gu?new gu:null,bA=1e3,mu={enabled:!0,auditMode:!1};function xA(e){return e===void 0?{...mu,enabled:!1}:typeof e=="boolean"?{...mu,enabled:e}:{...mu,...e}}var La=class e{static instance=null;config;refCount=0;originalDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(t){this.config=t}static getInstance(t){return e.instance||(e.instance=new e(xA(t))),e.instance}static resetInstance(){e.instance&&(e.instance.forceDeactivate(),e.instance=null)}static isInSandboxedContext(){return gt?gt?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(gt)return gt?.getStore()?.executionId}isEnabled(){return this.config.enabled===!0&&gt!==null&&!is}updateConfig(t){this.config={...this.config,...t}}activate(){if(is||!this.config.enabled){let n=L6();return{run:r=>r(),deactivate:()=>{},executionId:n}}this.refCount++,this.refCount===1&&(this.applyPatches(),this.activationTime=Date.now());let t=L6();return{run:n=>gt.run({sandboxActive:!0,executionId:t},n),deactivate:()=>{this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0)},executionId:t}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}clearViolations(){this.violations=[]}getPathForTarget(t,n){return t===globalThis?`globalThis.${n}`:t===process?`process.${n}`:t===Error?`Error.${n}`:t===Function.prototype?`Function.prototype.${n}`:t===Object.prototype?`Object.prototype.${n}`:`<object>.${n}`}shouldBlock(){return is||this.config.auditMode||!gt?!1:gt?.getStore()?.sandboxActive===!0}recordViolation(t,n,r){let s={timestamp:Date.now(),type:t,message:r,path:n,stack:new Error().stack,executionId:gt?.getStore()?.executionId};if(this.violations.length<bA&&this.violations.push(s),this.config.onViolation)try{this.config.onViolation(s)}catch(i){console.debug("[DefenseInDepthBox] onViolation callback threw:",i instanceof Error?i.message:i)}return s}createBlockingProxy(t,n,r){let s=this;return new Proxy(t,{apply(i,a,o){if(s.shouldBlock()){let l=`${n} is blocked during script execution`,c=s.recordViolation(r,n,l);throw new ct(l,c)}return s.config.auditMode&&gt?.getStore()?.sandboxActive===!0&&s.recordViolation(r,n,`${n} called (audit mode)`),Reflect.apply(i,a,o)},construct(i,a,o){if(s.shouldBlock()){let l=`${n} constructor is blocked during script execution`,c=s.recordViolation(r,n,l);throw new ct(l,c)}return s.config.auditMode&&gt?.getStore()?.sandboxActive===!0&&s.recordViolation(r,n,`${n} constructor called (audit mode)`),Reflect.construct(i,a,o)}})}createBlockingObjectProxy(t,n,r){let s=this;return new Proxy(t,{get(i,a,o){if(s.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} is blocked during script execution`,u=s.recordViolation(r,l,c);throw new ct(c,u)}if(s.config.auditMode&&gt?.getStore()?.sandboxActive===!0){let l=`${n}.${String(a)}`;s.recordViolation(r,l,`${l} accessed (audit mode)`)}return Reflect.get(i,a,o)},set(i,a,o,l){if(s.shouldBlock()){let c=`${n}.${String(a)}`,u=`${c} modification is blocked during script execution`,f=s.recordViolation(r,c,u);throw new ct(u,f)}return Reflect.set(i,a,o,l)},ownKeys(i){if(s.shouldBlock()){let a=`${n} enumeration is blocked during script execution`,o=s.recordViolation(r,n,a);throw new ct(a,o)}return Reflect.ownKeys(i)},getOwnPropertyDescriptor(i,a){if(s.shouldBlock()){let o=`${n}.${String(a)}`,l=`${o} descriptor access is blocked during script execution`,c=s.recordViolation(r,o,l);throw new ct(l,c)}return Reflect.getOwnPropertyDescriptor(i,a)},has(i,a){if(s.shouldBlock()){let o=`${n}.${String(a)}`,l=`${o} existence check is blocked during script execution`,c=s.recordViolation(r,o,l);throw new ct(l,c)}return Reflect.has(i,a)}})}applyPatches(){let t=_6(),n=new Set(["process_send","process_channel"]);for(let r of t)n.has(r.violationType)||this.applyPatch(r);this.protectConstructorChain(),this.protectErrorPrepareStackTrace(),this.protectModuleLoad(),this.protectProcessMainModule(),this.protectProcessExecPath()}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&this.patchPrototypeConstructor(t.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(t){console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",t instanceof Error?t.message:t)}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&this.patchPrototypeConstructor(t.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(t){console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",t instanceof Error?t.message:t)}try{let t=Object.getPrototypeOf(async function*(){}).constructor,n=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&t!==n&&this.patchPrototypeConstructor(t.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(t){console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",t instanceof Error?t.message:t)}}protectErrorPrepareStackTrace(){let t=this;try{let n=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:n});let r=n?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return r},set(s){if(t.shouldBlock()){let i="Error.prepareStackTrace modification is blocked during script execution",a=t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",i);throw new ct(i,a)}t.config.auditMode&&gt?.getStore()?.sandboxActive===!0&&t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),r=s},configurable:!0})}catch(n){console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",n instanceof Error?n.message:n)}}patchPrototypeConstructor(t,n,r){let s=this;try{let i=Object.getOwnPropertyDescriptor(t,"constructor");this.originalDescriptors.push({target:t,prop:"constructor",descriptor:i});let a=i?.value;Object.defineProperty(t,"constructor",{get(){if(s.shouldBlock()){let o=`${n} access is blocked during script execution`,l=s.recordViolation(r,n,o);throw new ct(o,l)}return s.config.auditMode&&gt?.getStore()?.sandboxActive===!0&&s.recordViolation(r,n,`${n} accessed (audit mode)`),a},set(o){if(s.shouldBlock()){let l=`${n} modification is blocked during script execution`,c=s.recordViolation(r,n,l);throw new ct(l,c)}Object.defineProperty(this,"constructor",{value:o,writable:!0,configurable:!0})},configurable:!0})}catch(i){console.debug(`[DefenseInDepthBox] Could not patch ${n}:`,i instanceof Error?i.message:i)}}protectProcessMainModule(){if(typeof process>"u")return;let t=this;try{let n=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:n});let r=n?.value;r!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(t.shouldBlock()){let s="process.mainModule access is blocked during script execution",i=t.recordViolation("process_main_module","process.mainModule",s);throw new ct(s,i)}return t.config.auditMode&&gt?.getStore()?.sandboxActive===!0&&t.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),r},set(s){if(t.shouldBlock()){let i="process.mainModule modification is blocked during script execution",a=t.recordViolation("process_main_module","process.mainModule",i);throw new ct(i,a)}Object.defineProperty(process,"mainModule",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(n){console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",n instanceof Error?n.message:n)}}protectProcessExecPath(){if(typeof process>"u")return;let t=this;try{let n=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:n});let r=n?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(t.shouldBlock()){let s="process.execPath access is blocked during script execution",i=t.recordViolation("process_exec_path","process.execPath",s);throw new ct(s,i)}return t.config.auditMode&&gt?.getStore()?.sandboxActive===!0&&t.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),r},set(s){if(t.shouldBlock()){let i="process.execPath modification is blocked during script execution",a=t.recordViolation("process_exec_path","process.execPath",i);throw new ct(i,a)}Object.defineProperty(process,"execPath",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(n){console.debug("[DefenseInDepthBox] Could not protect process.execPath:",n instanceof Error?n.message:n)}}protectModuleLoad(){if(!is)try{let t=null;if(typeof process<"u"){let a=process.mainModule;a&&typeof a=="object"&&(t=a.constructor)}if(!t&&typeof js<"u"&&typeof js.main<"u"&&(t=js.main.constructor),!t||typeof t._load!="function")return;let n=t._load,r=Object.getOwnPropertyDescriptor(t,"_load");this.originalDescriptors.push({target:t,prop:"_load",descriptor:r});let i=this.createBlockingProxy(n,"Module._load","module_load");Object.defineProperty(t,"_load",{value:i,writable:!0,configurable:!0})}catch(t){console.debug("[DefenseInDepthBox] Could not protect Module._load:",t instanceof Error?t.message:t)}}applyPatch(t){let{target:n,prop:r,violationType:s,strategy:i}=t;try{let a=n[r];if(a===void 0)return;let o=Object.getOwnPropertyDescriptor(n,r);if(this.originalDescriptors.push({target:n,prop:r,descriptor:o}),i==="freeze")typeof a=="object"&&a!==null&&Object.freeze(a);else{let l=this.getPathForTarget(n,r),c=typeof a=="function"?this.createBlockingProxy(a,l,s):this.createBlockingObjectProxy(a,l,s);Object.defineProperty(n,r,{value:c,writable:!0,configurable:!0})}}catch(a){let o=this.getPathForTarget(n,r);console.debug(`[DefenseInDepthBox] Could not patch ${o}:`,a instanceof Error?a.message:a)}}restorePatches(){for(let t=this.originalDescriptors.length-1;t>=0;t--){let{target:n,prop:r,descriptor:s}=this.originalDescriptors[t];try{s?Object.defineProperty(n,r,s):delete n[r]}catch(i){let a=this.getPathForTarget(n,r);console.debug(`[DefenseInDepthBox] Could not restore ${a}:`,i instanceof Error?i.message:i)}}this.originalDescriptors=[]}};function F6(e){return mr(e)}function mr(e){return e.statements.map(M6).join(`
1464
- `)}function M6(e){let t=[];for(let r=0;r<e.pipelines.length;r++)t.push(EA(e.pipelines[r])),r<e.operators.length&&t.push(e.operators[r]);let n=t.join(" ");return e.background&&(n+=" &"),n}function EA(e){let t=[];e.timed&&t.push(e.timePosix?"time -p":"time"),e.negated&&t.push("!");let n=[];for(let s=0;s<e.commands.length;s++)if(n.push(U6(e.commands[s])),s<e.commands.length-1){let i=e.pipeStderr?.[s];n.push(i?"|&":"|")}return(t.length>0?`${t.join(" ")} `:"")+n.join(" ")}function U6(e){switch(e.type){case"SimpleCommand":return AA(e);case"If":return RA(e);case"For":return TA(e);case"CStyleFor":return PA(e);case"While":return DA(e);case"Until":return _A(e);case"Case":return LA(e);case"Subshell":return MA(e);case"Group":return UA(e);case"ArithmeticCommand":return BA(e);case"ConditionalCommand":return WA(e);case"FunctionDef":return zA(e);default:{let t=e;throw new Error(`Unsupported command type: ${t.type}`)}}}function AA(e){let t=[];for(let n of e.assignments)t.push(SA(n));e.name&&t.push(vt(e.name));for(let n of e.args)t.push(vt(n));for(let n of e.redirections)t.push(z6(n));return t.join(" ")}function SA(e){let t=e.append?"+=":"=";if(e.array){let n=e.array.map(vt).join(" ");return`${e.name}${t}(${n})`}return e.value?`${e.name}${t}${vt(e.value)}`:`${e.name}${t}`}function vt(e){return e.parts.map(t=>Fa(t,!1)).join("")}function Vn(e){return e.parts.map(t=>Fa(t,!0)).join("")}function Fa(e,t){switch(e.type){case"Literal":return t?NA(e.value):CA(e.value);case"SingleQuoted":return`'${e.value}'`;case"DoubleQuoted":return`"${e.parts.map(n=>Fa(n,!0)).join("")}"`;case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return B6(e);case"CommandSubstitution":return e.legacy?`\`${mr(e.body)}\``:`$(${mr(e.body)})`;case"ArithmeticExpansion":return`$((${Le(e.expression.expression)}))`;case"ProcessSubstitution":return e.direction==="input"?`<(${mr(e.body)})`:`>(${mr(e.body)})`;case"BraceExpansion":return $A(e);case"TildeExpansion":return e.user!==null?`~${e.user}`:"~";case"Glob":return e.pattern;default:{let n=e;throw new Error(`Unsupported word part type: ${n.type}`)}}}function CA(e){return e.replace(/[\s\\'"`!|&;()<>{}[\]*?~#]/g,"\\$&")}function NA(e){return e.replace(/[$`"\\]/g,"\\$&")}function kA(e,t){return e.parts.map(n=>vA(n,t)).join("")}function vA(e,t){switch(e.type){case"Literal":return t?e.value:e.value.replace(/[$`]/g,"\\$&");case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return B6(e);case"CommandSubstitution":return e.legacy?`\`${mr(e.body)}\``:`$(${mr(e.body)})`;case"ArithmeticExpansion":return`$((${Le(e.expression.expression)}))`;default:return Fa(e,!1)}}function B6(e){return e.operation?`\${${W6(e.parameter,e.operation)}}`:IA(e.parameter)?`\${${e.parameter}}`:`$${e.parameter}`}function IA(e){return!(/^[?#@*$!\-0-9]$/.test(e)||/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))}function W6(e,t){switch(t.type){case"Length":return`#${e}`;case"LengthSliceError":return`#${e}:`;case"BadSubstitution":return t.text;case"DefaultValue":return`${e}${t.checkEmpty?":":""}-${Vn(t.word)}`;case"AssignDefault":return`${e}${t.checkEmpty?":":""}=${Vn(t.word)}`;case"ErrorIfUnset":return`${e}${t.checkEmpty?":":""}?${t.word?Vn(t.word):""}`;case"UseAlternative":return`${e}${t.checkEmpty?":":""}+${Vn(t.word)}`;case"Substring":{let n=Le(t.offset.expression);return t.length?`${e}:${n}:${Le(t.length.expression)}`:`${e}:${n}`}case"PatternRemoval":{let n=t.side==="prefix"?"#":"%",r=t.greedy?`${n}${n}`:n;return`${e}${r}${Vn(t.pattern)}`}case"PatternReplacement":{let n="/";t.all?n="//":t.anchor==="start"?n="/#":t.anchor==="end"&&(n="/%");let r=t.replacement?`/${Vn(t.replacement)}`:"";return`${e}${n}${Vn(t.pattern)}${r}`}case"CaseModification":{let n=t.direction==="upper"?"^":",",r=t.all?`${n}${n}`:n,s=t.pattern?Vn(t.pattern):"";return`${e}${r}${s}`}case"Transform":return`${e}@${t.operator}`;case"Indirection":return t.innerOp?`!${W6(e,t.innerOp)}`:`!${e}`;case"ArrayKeys":return`!${t.array}[${t.star?"*":"@"}]`;case"VarNamePrefix":return`!${t.prefix}${t.star?"*":"@"}`;default:{let n=t;throw new Error(`Unsupported parameter operation type: ${n.type}`)}}}function $A(e){return`{${e.items.map(OA).join(",")}}`}function OA(e){if(e.type==="Word")return vt(e.word);let t=e.startStr??String(e.start),n=e.endStr??String(e.end);return e.step!==void 0?`${t}..${n}..${e.step}`:`${t}..${n}`}function z6(e){let t=e.fdVariable?`{${e.fdVariable}}`:e.fd!==null?String(e.fd):"";if(e.operator==="<<"||e.operator==="<<-"){let n=e.target,r=n.quoted?`'${n.delimiter}'`:n.delimiter,s=kA(n.content,n.quoted);return`${t}${e.operator}${r}
1465
- ${s}${n.delimiter}`}return e.operator==="<<<"?`${t}<<< ${vt(e.target)}`:e.operator==="&>"||e.operator==="&>>"?`${e.operator} ${vt(e.target)}`:`${t}${e.operator} ${vt(e.target)}`}function un(e){return e.length===0?"":` ${e.map(z6).join(" ")}`}function Yt(e){return e.map(M6).join(`
1464
+ `)}function M6(e){let t=[];for(let r=0;r<e.pipelines.length;r++)t.push(EA(e.pipelines[r])),r<e.operators.length&&t.push(e.operators[r]);let n=t.join(" ");return e.background&&(n+=" &"),n}function EA(e){let t=[];e.timed&&t.push(e.timePosix?"time -p":"time"),e.negated&&t.push("!");let n=[];for(let s=0;s<e.commands.length;s++)if(n.push(U6(e.commands[s])),s<e.commands.length-1){let i=e.pipeStderr?.[s];n.push(i?"|&":"|")}return(t.length>0?`${t.join(" ")} `:"")+n.join(" ")}function U6(e){switch(e.type){case"SimpleCommand":return AA(e);case"If":return RA(e);case"For":return TA(e);case"CStyleFor":return PA(e);case"While":return DA(e);case"Until":return _A(e);case"Case":return LA(e);case"Subshell":return MA(e);case"Group":return UA(e);case"ArithmeticCommand":return BA(e);case"ConditionalCommand":return WA(e);case"FunctionDef":return zA(e);default:{let t=e;throw new Error(`Unsupported command type: ${t.type}`)}}}function AA(e){let t=[];for(let n of e.assignments)t.push(SA(n));e.name&&t.push(kt(e.name));for(let n of e.args)t.push(kt(n));for(let n of e.redirections)t.push(z6(n));return t.join(" ")}function SA(e){let t=e.append?"+=":"=";if(e.array){let n=e.array.map(kt).join(" ");return`${e.name}${t}(${n})`}return e.value?`${e.name}${t}${kt(e.value)}`:`${e.name}${t}`}function kt(e){return e.parts.map(t=>Fa(t,!1)).join("")}function Vn(e){return e.parts.map(t=>Fa(t,!0)).join("")}function Fa(e,t){switch(e.type){case"Literal":return t?NA(e.value):CA(e.value);case"SingleQuoted":return`'${e.value}'`;case"DoubleQuoted":return`"${e.parts.map(n=>Fa(n,!0)).join("")}"`;case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return B6(e);case"CommandSubstitution":return e.legacy?`\`${mr(e.body)}\``:`$(${mr(e.body)})`;case"ArithmeticExpansion":return`$((${Le(e.expression.expression)}))`;case"ProcessSubstitution":return e.direction==="input"?`<(${mr(e.body)})`:`>(${mr(e.body)})`;case"BraceExpansion":return $A(e);case"TildeExpansion":return e.user!==null?`~${e.user}`:"~";case"Glob":return e.pattern;default:{let n=e;throw new Error(`Unsupported word part type: ${n.type}`)}}}function CA(e){return e.replace(/[\s\\'"`!|&;()<>{}[\]*?~#]/g,"\\$&")}function NA(e){return e.replace(/[$`"\\]/g,"\\$&")}function vA(e,t){return e.parts.map(n=>kA(n,t)).join("")}function kA(e,t){switch(e.type){case"Literal":return t?e.value:e.value.replace(/[$`]/g,"\\$&");case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return B6(e);case"CommandSubstitution":return e.legacy?`\`${mr(e.body)}\``:`$(${mr(e.body)})`;case"ArithmeticExpansion":return`$((${Le(e.expression.expression)}))`;default:return Fa(e,!1)}}function B6(e){return e.operation?`\${${W6(e.parameter,e.operation)}}`:IA(e.parameter)?`\${${e.parameter}}`:`$${e.parameter}`}function IA(e){return!(/^[?#@*$!\-0-9]$/.test(e)||/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))}function W6(e,t){switch(t.type){case"Length":return`#${e}`;case"LengthSliceError":return`#${e}:`;case"BadSubstitution":return t.text;case"DefaultValue":return`${e}${t.checkEmpty?":":""}-${Vn(t.word)}`;case"AssignDefault":return`${e}${t.checkEmpty?":":""}=${Vn(t.word)}`;case"ErrorIfUnset":return`${e}${t.checkEmpty?":":""}?${t.word?Vn(t.word):""}`;case"UseAlternative":return`${e}${t.checkEmpty?":":""}+${Vn(t.word)}`;case"Substring":{let n=Le(t.offset.expression);return t.length?`${e}:${n}:${Le(t.length.expression)}`:`${e}:${n}`}case"PatternRemoval":{let n=t.side==="prefix"?"#":"%",r=t.greedy?`${n}${n}`:n;return`${e}${r}${Vn(t.pattern)}`}case"PatternReplacement":{let n="/";t.all?n="//":t.anchor==="start"?n="/#":t.anchor==="end"&&(n="/%");let r=t.replacement?`/${Vn(t.replacement)}`:"";return`${e}${n}${Vn(t.pattern)}${r}`}case"CaseModification":{let n=t.direction==="upper"?"^":",",r=t.all?`${n}${n}`:n,s=t.pattern?Vn(t.pattern):"";return`${e}${r}${s}`}case"Transform":return`${e}@${t.operator}`;case"Indirection":return t.innerOp?`!${W6(e,t.innerOp)}`:`!${e}`;case"ArrayKeys":return`!${t.array}[${t.star?"*":"@"}]`;case"VarNamePrefix":return`!${t.prefix}${t.star?"*":"@"}`;default:{let n=t;throw new Error(`Unsupported parameter operation type: ${n.type}`)}}}function $A(e){return`{${e.items.map(OA).join(",")}}`}function OA(e){if(e.type==="Word")return kt(e.word);let t=e.startStr??String(e.start),n=e.endStr??String(e.end);return e.step!==void 0?`${t}..${n}..${e.step}`:`${t}..${n}`}function z6(e){let t=e.fdVariable?`{${e.fdVariable}}`:e.fd!==null?String(e.fd):"";if(e.operator==="<<"||e.operator==="<<-"){let n=e.target,r=n.quoted?`'${n.delimiter}'`:n.delimiter,s=vA(n.content,n.quoted);return`${t}${e.operator}${r}
1465
+ ${s}${n.delimiter}`}return e.operator==="<<<"?`${t}<<< ${kt(e.target)}`:e.operator==="&>"||e.operator==="&>>"?`${e.operator} ${kt(e.target)}`:`${t}${e.operator} ${kt(e.target)}`}function un(e){return e.length===0?"":` ${e.map(z6).join(" ")}`}function Yt(e){return e.map(M6).join(`
1466
1466
  `)}function RA(e){let t=[];for(let n=0;n<e.clauses.length;n++){let r=e.clauses[n],s=n===0?"if":"elif";t.push(`${s} ${Yt(r.condition)}; then
1467
1467
  ${Yt(r.body)}`)}return e.elseBody&&t.push(`else
1468
1468
  ${Yt(e.elseBody)}`),`${t.join(`
1469
1469
  `)}
1470
- fi${un(e.redirections)}`}function TA(e){let t;if(e.words===null)t=`for ${e.variable}`;else{let n=e.words.map(vt).join(" ");t=`for ${e.variable} in ${n}`}return`${t}; do
1470
+ fi${un(e.redirections)}`}function TA(e){let t;if(e.words===null)t=`for ${e.variable}`;else{let n=e.words.map(kt).join(" ");t=`for ${e.variable} in ${n}`}return`${t}; do
1471
1471
  ${Yt(e.body)}
1472
1472
  done${un(e.redirections)}`}function PA(e){let t=e.init?Le(e.init.expression):"",n=e.condition?Le(e.condition.expression):"",r=e.update?Le(e.update.expression):"";return`for ((${t}; ${n}; ${r})); do
1473
1473
  ${Yt(e.body)}
@@ -1476,12 +1476,12 @@ ${Yt(e.body)}
1476
1476
  done${un(e.redirections)}`}function _A(e){return`until ${Yt(e.condition)}; do
1477
1477
  ${Yt(e.body)}
1478
1478
  done${un(e.redirections)}`}function LA(e){let t=e.items.map(FA).join(`
1479
- `);return`case ${vt(e.word)} in
1479
+ `);return`case ${kt(e.word)} in
1480
1480
  ${t}
1481
- esac${un(e.redirections)}`}function FA(e){let t=e.patterns.map(vt).join(" | "),n=Yt(e.body);return n?`${t})
1481
+ esac${un(e.redirections)}`}function FA(e){let t=e.patterns.map(kt).join(" | "),n=Yt(e.body);return n?`${t})
1482
1482
  ${n}
1483
1483
  ${e.terminator}`:`${t})
1484
- ${e.terminator}`}function MA(e){return`(${Yt(e.body)})${un(e.redirections)}`}function UA(e){return`{ ${Yt(e.body)}; }${un(e.redirections)}`}function BA(e){return`((${Le(e.expression.expression)}))${un(e.redirections)}`}function WA(e){return`[[ ${dr(e.expression)} ]]${un(e.redirections)}`}function zA(e){let t=U6(e.body);return`${e.name}() ${t}${un(e.redirections)}`}function Le(e){switch(e.type){case"ArithNumber":return String(e.value);case"ArithVariable":return e.hasDollarPrefix?`$${e.name}`:e.name;case"ArithSpecialVar":return`$${e.name}`;case"ArithBinary":return`${Le(e.left)} ${e.operator} ${Le(e.right)}`;case"ArithUnary":return e.prefix?`${e.operator}${Le(e.operand)}`:`${Le(e.operand)}${e.operator}`;case"ArithTernary":return`${Le(e.condition)} ? ${Le(e.consequent)} : ${Le(e.alternate)}`;case"ArithAssignment":return`${e.subscript?`${e.variable}[${Le(e.subscript)}]`:e.stringKey!==void 0?`${e.variable}[${e.stringKey}]`:e.variable} ${e.operator} ${Le(e.value)}`;case"ArithDynamicAssignment":return`${e.subscript?`${Le(e.target)}[${Le(e.subscript)}]`:Le(e.target)} ${e.operator} ${Le(e.value)}`;case"ArithDynamicElement":return`${Le(e.nameExpr)}[${Le(e.subscript)}]`;case"ArithGroup":return`(${Le(e.expression)})`;case"ArithNested":return`$((${Le(e.expression)}))`;case"ArithCommandSubst":return`$(${e.command})`;case"ArithBracedExpansion":return`\${${e.content}}`;case"ArithArrayElement":return e.stringKey!==void 0?`${e.array}[${e.stringKey}]`:e.index?`${e.array}[${Le(e.index)}]`:e.array;case"ArithDynamicBase":return`\${${e.baseExpr}}#${e.value}`;case"ArithDynamicNumber":return`\${${e.prefix}}${e.suffix}`;case"ArithConcat":return e.parts.map(Le).join("");case"ArithDoubleSubscript":return`${e.array}[${Le(e.index)}]`;case"ArithNumberSubscript":return`${e.number}[${e.errorToken}]`;case"ArithSyntaxError":return e.errorToken;case"ArithSingleQuote":return`'${e.content}'`;default:{let t=e;throw new Error(`Unsupported arithmetic expression type: ${t.type}`)}}}function dr(e){switch(e.type){case"CondBinary":return`${vt(e.left)} ${e.operator} ${vt(e.right)}`;case"CondUnary":return`${e.operator} ${vt(e.operand)}`;case"CondNot":return`! ${dr(e.operand)}`;case"CondAnd":return`${dr(e.left)} && ${dr(e.right)}`;case"CondOr":return`${dr(e.left)} || ${dr(e.right)}`;case"CondGroup":return`( ${dr(e.expression)} )`;case"CondWord":return vt(e.word);default:{let t=e;throw new Error(`Unsupported conditional expression type: ${t.type}`)}}}var yu=class{fs;commands=new Map;useDefaultLayout=!1;limits;secureFetch;sleepFn;traceFn;logger;defenseInDepthConfig;coverageWriter;transformPlugins=[];state;constructor(t={}){let n=t.fs??new ar(t.files);this.fs=n,this.useDefaultLayout=!t.cwd&&!t.files;let r=t.cwd||(this.useDefaultLayout?"/home/user":"/"),s=new Map([["HOME",this.useDefaultLayout?"/home/user":"/"],["PATH","/usr/bin:/bin"],["IFS",`
1484
+ ${e.terminator}`}function MA(e){return`(${Yt(e.body)})${un(e.redirections)}`}function UA(e){return`{ ${Yt(e.body)}; }${un(e.redirections)}`}function BA(e){return`((${Le(e.expression.expression)}))${un(e.redirections)}`}function WA(e){return`[[ ${dr(e.expression)} ]]${un(e.redirections)}`}function zA(e){let t=U6(e.body);return`${e.name}() ${t}${un(e.redirections)}`}function Le(e){switch(e.type){case"ArithNumber":return String(e.value);case"ArithVariable":return e.hasDollarPrefix?`$${e.name}`:e.name;case"ArithSpecialVar":return`$${e.name}`;case"ArithBinary":return`${Le(e.left)} ${e.operator} ${Le(e.right)}`;case"ArithUnary":return e.prefix?`${e.operator}${Le(e.operand)}`:`${Le(e.operand)}${e.operator}`;case"ArithTernary":return`${Le(e.condition)} ? ${Le(e.consequent)} : ${Le(e.alternate)}`;case"ArithAssignment":return`${e.subscript?`${e.variable}[${Le(e.subscript)}]`:e.stringKey!==void 0?`${e.variable}[${e.stringKey}]`:e.variable} ${e.operator} ${Le(e.value)}`;case"ArithDynamicAssignment":return`${e.subscript?`${Le(e.target)}[${Le(e.subscript)}]`:Le(e.target)} ${e.operator} ${Le(e.value)}`;case"ArithDynamicElement":return`${Le(e.nameExpr)}[${Le(e.subscript)}]`;case"ArithGroup":return`(${Le(e.expression)})`;case"ArithNested":return`$((${Le(e.expression)}))`;case"ArithCommandSubst":return`$(${e.command})`;case"ArithBracedExpansion":return`\${${e.content}}`;case"ArithArrayElement":return e.stringKey!==void 0?`${e.array}[${e.stringKey}]`:e.index?`${e.array}[${Le(e.index)}]`:e.array;case"ArithDynamicBase":return`\${${e.baseExpr}}#${e.value}`;case"ArithDynamicNumber":return`\${${e.prefix}}${e.suffix}`;case"ArithConcat":return e.parts.map(Le).join("");case"ArithDoubleSubscript":return`${e.array}[${Le(e.index)}]`;case"ArithNumberSubscript":return`${e.number}[${e.errorToken}]`;case"ArithSyntaxError":return e.errorToken;case"ArithSingleQuote":return`'${e.content}'`;default:{let t=e;throw new Error(`Unsupported arithmetic expression type: ${t.type}`)}}}function dr(e){switch(e.type){case"CondBinary":return`${kt(e.left)} ${e.operator} ${kt(e.right)}`;case"CondUnary":return`${e.operator} ${kt(e.operand)}`;case"CondNot":return`! ${dr(e.operand)}`;case"CondAnd":return`${dr(e.left)} && ${dr(e.right)}`;case"CondOr":return`${dr(e.left)} || ${dr(e.right)}`;case"CondGroup":return`( ${dr(e.expression)} )`;case"CondWord":return kt(e.word);default:{let t=e;throw new Error(`Unsupported conditional expression type: ${t.type}`)}}}var yu=class{fs;commands=new Map;useDefaultLayout=!1;limits;secureFetch;sleepFn;traceFn;logger;defenseInDepthConfig;coverageWriter;transformPlugins=[];state;constructor(t={}){let n=t.fs??new ar(t.files);this.fs=n,this.useDefaultLayout=!t.cwd&&!t.files;let r=t.cwd||(this.useDefaultLayout?"/home/user":"/"),s=new Map([["HOME",this.useDefaultLayout?"/home/user":"/"],["PATH","/usr/bin:/bin"],["IFS",`
1485
1485
  `],["OSTYPE","linux-gnu"],["MACHTYPE","x86_64-pc-linux-gnu"],["HOSTTYPE","x86_64"],["HOSTNAME","localhost"],["PWD",r],["OLDPWD",r],["OPTIND","1"],...Object.entries(t.env??{})]);if(this.limits=T6({...t.executionLimits,...t.maxCallDepth!==void 0&&{maxCallDepth:t.maxCallDepth},...t.maxCommandCount!==void 0&&{maxCommandCount:t.maxCommandCount},...t.maxLoopIterations!==void 0&&{maxLoopIterations:t.maxLoopIterations}}),t.fetch?this.secureFetch=t.fetch:t.network&&(this.secureFetch=du(t.network)),this.sleepFn=t.sleep,this.traceFn=t.trace,this.logger=t.logger,this.defenseInDepthConfig=t.defenseInDepth,this.coverageWriter=t.coverage,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,virtualPid:t.processInfo?.pid??1,virtualPpid:t.processInfo?.ppid??0,virtualUid:t.processInfo?.uid??1e3,virtualGid:t.processInfo?.gid??1e3,bashPid:t.processInfo?.pid??1,nextVirtualPid:(t.processInfo?.pid??1)+1,currentLine:1,options:{errexit:!1,pipefail:!1,nounset:!1,xtrace:!1,verbose:!1,posix:!1,allexport:!1,noclobber:!1,noglob:!1,noexec:!1,vi:!1,emacs:!1},shoptOptions:{extglob:!1,dotglob:!1,nullglob:!1,failglob:!1,globstar:!1,globskipdots:!0,nocaseglob:!1,nocasematch:!1,expand_aliases:!1,lastpipe:!1,xpg_echo:!1},inCondition:!1,loopDepth:0,exportedVars:new Set(["HOME","PATH","PWD","OLDPWD",...Object.keys(t.env||{})]),readonlyVars:new Set(["SHELLOPTS","BASHOPTS"]),hashTable:new Map},this.state.env.set("SHELLOPTS",$l(this.state.options)),this.state.env.set("BASHOPTS",Ol(this.state.shoptOptions)),K0(n,this.useDefaultLayout,{pid:this.state.virtualPid,ppid:this.state.virtualPpid,uid:this.state.virtualUid,gid:this.state.virtualGid}),r!=="/"&&n instanceof ar)try{n.mkdirSync(r,{recursive:!0})}catch{}for(let i of W0(t.commands))this.registerCommand(i);if(t.fetch||t.network)for(let i of z0())this.registerCommand(i);if(t.python)for(let i of H0())this.registerCommand(i);if(t.customCommands)for(let i of t.customCommands)j0(i)?this.registerCommand(G0(i)):this.registerCommand(i)}registerCommand(t){this.commands.set(t.name,t);let n=this.fs;if(typeof n.writeFileSync=="function"){let r=`#!/bin/bash
1486
1486
  # Built-in command: ${t.name}
1487
1487
  `;try{n.writeFileSync(`/bin/${t.name}`,r)}catch{}try{n.writeFileSync(`/usr/bin/${t.name}`,r)}catch{}}}logResult(t){return this.logger&&(t.stdout&&this.logger.debug("stdout",{output:t.stdout}),t.stderr&&this.logger.info("stderr",{output:t.stderr}),this.logger.info("exit",{exitCode:t.exitCode})),t.stdout=j6(t.stdout),t.stderr=j6(t.stderr),t}async exec(t,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.