just-bash-nx 3.0.6 → 3.0.8

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.
@@ -3,7 +3,7 @@ var j7=Object.create;var Ga=Object.defineProperty;var G7=Object.getOwnPropertyDe
3
3
  This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`,me=class extends Error{violation;constructor(t,n){super(t+Q7),this.violation=n,this.name="SecurityViolationError"}},Ue=!ar&&qa?new qa:null,X7=1e3;Va={enabled:!0,auditMode:!1};Et=class e{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(t){this.config=t}static getInstance(t){let n=J7(t);if(!e.instance)e.instance=new e(n);else{let r=e.instance.config;if(n.enabled!==r.enabled||n.auditMode!==r.auditMode)throw new Error(`DefenseInDepthBox config conflict: requested {enabled: ${n.enabled}, auditMode: ${n.auditMode}} but singleton already has {enabled: ${r.enabled}, auditMode: ${r.auditMode}}. All Bash instances must use the same defense-in-depth security settings, or call DefenseInDepthBox.resetInstance() between incompatible configurations.`)}return e.instance}static resetInstance(){e.instance&&(e.instance.forceDeactivate(),e.instance=null),e.trustedExecutionDepth.clear()}static isInSandboxedContext(){return Ue?Ue?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(Ue)return Ue?.getStore()?.executionId}static enterTrustedScope(t){let n=e.trustedExecutionDepth.get(t)??0;e.trustedExecutionDepth.set(t,n+1)}static leaveTrustedScope(t){let n=e.trustedExecutionDepth.get(t);if(n){if(n===1){e.trustedExecutionDepth.delete(t);return}e.trustedExecutionDepth.set(t,n-1)}}static isTrustedScopeActive(t){return t?(e.trustedExecutionDepth.get(t)??0)>0:!1}isExecutionIdActive(t){return this.activeExecutionIds.has(t)}getCachedContext(t){let n=this.contextCache.get(t);return n||(n={sandboxActive:!0,executionId:t},this.contextCache.set(t,n)),n}getPreferredActiveExecutionId(){if(this.activeExecutionIds.size!==0)for(let t of this.activeExecutionIds)return t}static bindCurrentContext(t){if(!Ue)return t;let n=e.instance,r=Ue.getStore(),s=r?.sandboxActive===!0?r.executionId:n?.getPreferredActiveExecutionId();if(!s)return t;let i=n?.getCachedContext(s)??{sandboxActive:!0,executionId:s};return((...o)=>{let a=e.instance;if(!(a&&!a.isExecutionIdActive(s)&&(a.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!a.config.auditMode)))return Y7(i,t,...o)})}isEnabled(){return this.config.enabled===!0&&Ue!==null&&!ar}updateConfig(t){this.config={...this.config,...t}}activate(){if(ar||!this.config.enabled||!Ue){let r=Ff(),s=!1;return{run:i=>s?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):i(),deactivate:()=>{s=!0},executionId:r}}this.refCount++,this.refCount===1&&(this.applyPatches(),this.activationTime=Date.now());let t=Ff(),n=!1;return{run:r=>n?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(t),Ue.run({sandboxActive:!0,executionId:t},r)),deactivate:()=>{n||(n=!0,this.activeExecutionIds.delete(t),this.contextCache.delete(t),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.activeExecutionIds.clear(),this.contextCache.clear(),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}}getPatchFailures(){return[...this.patchFailures]}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}`}static runTrusted(t){if(!Ue)return t();let n=Ue.getStore();if(!n)return t();let{executionId:r}=n;return Ue.run({...n,trusted:!0},()=>{e.enterTrustedScope(r);try{let s=t();return typeof s=="object"&&s!==null&&"finally"in s&&typeof s.finally=="function"?s.finally(()=>{e.leaveTrustedScope(r)}):(e.leaveTrustedScope(r),s)}catch(s){throw e.leaveTrustedScope(r),s}})}static async runTrustedAsync(t){if(!Ue)return t();let n=Ue.getStore();if(!n)return t();let{executionId:r}=n;return Ue.run({...n,trusted:!0},async()=>{e.enterTrustedScope(r);try{return await t()}finally{e.leaveTrustedScope(r)}})}shouldBlock(){if(ar||this.config.auditMode||!Ue)return!1;let t=Ue?.getStore();return!(t?.sandboxActive!==!0||t.trusted||e.isTrustedScopeActive(t.executionId))}recordViolation(t,n,r){let s={timestamp:Date.now(),type:t,message:r,path:n,stack:new Error().stack,executionId:Ue?.getStore()?.executionId};if(this.violations.length<X7&&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,o,a){if(s.shouldBlock()){let l=`${n} is blocked during script execution`,c=s.recordViolation(r,n,l);throw new me(l,c)}return s.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&s.recordViolation(r,n,`${n} called (audit mode)`),Reflect.apply(i,o,a)},construct(i,o,a){if(s.shouldBlock()){let l=`${n} constructor is blocked during script execution`,c=s.recordViolation(r,n,l);throw new me(l,c)}return s.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&s.recordViolation(r,n,`${n} constructor called (audit mode)`),Reflect.construct(i,o,a)}})}createBlockingObjectProxy(t,n,r,s){let i=this;return new Proxy(t,{get(o,a,l){if(i.shouldBlock()){if(s&&typeof a=="string"&&s.has(a))return Reflect.get(o,a,l);let c=`${n}.${String(a)}`,u=`${c} is blocked during script execution`,f=i.recordViolation(r,c,u);throw new me(u,f)}if(i.config.auditMode&&Ue?.getStore()?.sandboxActive===!0){let c=`${n}.${String(a)}`;i.recordViolation(r,c,`${c} accessed (audit mode)`)}return Reflect.get(o,a,l)},set(o,a,l,c){if(i.shouldBlock()){let u=`${n}.${String(a)}`,f=`${u} modification is blocked during script execution`,p=i.recordViolation(r,u,f);throw new me(f,p)}return Reflect.set(o,a,l,c)},ownKeys(o){if(i.shouldBlock()){let a=`${n} enumeration is blocked during script execution`,l=i.recordViolation(r,n,a);throw new me(a,l)}return Reflect.ownKeys(o)},getOwnPropertyDescriptor(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} descriptor access is blocked during script execution`,u=i.recordViolation(r,l,c);throw new me(c,u)}return Reflect.getOwnPropertyDescriptor(o,a)},has(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} existence check is blocked during script execution`,u=i.recordViolation(r,l,c);throw new me(c,u)}return Reflect.has(o,a)},deleteProperty(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} deletion is blocked during script execution`,u=i.recordViolation(r,l,c);throw new me(c,u)}return Reflect.deleteProperty(o,a)},setPrototypeOf(o,a){if(i.shouldBlock()){let l=`${n} setPrototypeOf is blocked during script execution`,c=i.recordViolation(r,n,l);throw new me(l,c)}return Reflect.setPrototypeOf(o,a)},defineProperty(o,a,l){if(i.shouldBlock()){let c=`${n}.${String(a)}`,u=`${c} defineProperty is blocked during script execution`,f=i.recordViolation(r,c,u);throw new me(u,f)}return Reflect.defineProperty(o,a,l)}})}applyPatches(){this.patchFailures=[];let t=Df(),n=new Set(["process_send","process_channel","process_stdout","process_stderr"]);for(let i of t)n.has(i.violationType)||this.applyPatch(i);this.protectConstructorChain(),this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.lockWellKnownSymbols(),this.protectProxyRevocable();let r=["Function.prototype.constructor","Module._load"],s=this.patchFailures.filter(i=>r.includes(i));if(s.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${s.join(", ")}`)}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){this.patchFailures.push("AsyncFunction.prototype.constructor"),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){this.patchFailures.push("GeneratorFunction.prototype.constructor"),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){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),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",o=t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",i);throw new me(i,o)}t.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),r=s},configurable:!0})}catch(n){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",n instanceof Error?n.message:n)}}protectPromiseThen(){let t=this;try{let i=function(...o){return Ue.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation("promise_then_after_deactivate","Promise.then","Promise.then callback is blocked after defense deactivation"),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,o);if(this.kind==="fulfilled")return o[0];throw o[0]}return Reflect.apply(this.cb,void 0,o)})};var n=i;let r=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:r});let s=r?.value;if(typeof s!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(a,l){if(!Ue)return Reflect.apply(s,this,[a,l]);let c=Ue.getStore(),u=c?.sandboxActive===!0&&c.trusted!==!0?c.executionId:void 0;if(!u)return Reflect.apply(s,this,[a,l]);let f=t.getCachedContext(u),p=(h,d)=>typeof h!="function"?h:i.bind({box:t,executionId:u,captured:f,cb:h,kind:d});return Reflect.apply(s,this,[p(a,"fulfilled"),p(l,"rejected")])},writable:!0,configurable:!0})}catch(r){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",r instanceof Error?r.message:r)}}patchPrototypeConstructor(t,n,r){let s=this;try{let i=Object.getOwnPropertyDescriptor(t,"constructor");this.originalDescriptors.push({target:t,prop:"constructor",descriptor:i});let o=i?.value;Object.defineProperty(t,"constructor",{get(){if(s.shouldBlock()){let a=`${n} access is blocked during script execution`,l=s.recordViolation(r,n,a);throw new me(a,l)}return s.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&s.recordViolation(r,n,`${n} accessed (audit mode)`),o},set(a){if(s.shouldBlock()){let l=`${n} modification is blocked during script execution`,c=s.recordViolation(r,n,l);throw new me(l,c)}Object.defineProperty(this,"constructor",{value:a,writable:!0,configurable:!0})},configurable:!0})}catch(i){this.patchFailures.push(n),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 me(s,i)}return t.config.auditMode&&Ue?.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",o=t.recordViolation("process_main_module","process.mainModule",i);throw new me(i,o)}Object.defineProperty(process,"mainModule",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(n){this.patchFailures.push("process.mainModule"),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 me(s,i)}return t.config.auditMode&&Ue?.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",o=t.recordViolation("process_exec_path","process.execPath",i);throw new me(i,o)}Object.defineProperty(process,"execPath",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(n){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",n instanceof Error?n.message:n)}}lockWellKnownSymbols(){let t=(n,r)=>{try{let s=Object.getOwnPropertyDescriptor(n,r);if(s?.configurable){if("value"in s){Object.defineProperty(n,r,{...s,configurable:!1,writable:!1});return}Object.defineProperty(n,r,{...s,configurable:!1})}}catch{}};for(let n of[Array,Map,Set,RegExp,Promise])t(n,Symbol.species);for(let n of[Array.prototype,String.prototype,Map.prototype,Set.prototype])t(n,Symbol.iterator);t(Symbol.prototype,Symbol.toPrimitive),t(Date.prototype,Symbol.toPrimitive);for(let n of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])t(RegExp.prototype,n);t(Function.prototype,Symbol.hasInstance),t(Array.prototype,Symbol.unscopables);for(let n of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])t(n,Symbol.toStringTag);try{let n=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");this.originalDescriptors.push({target:Error,prop:"stackTraceLimit",descriptor:n}),Object.defineProperty(Error,"stackTraceLimit",{value:Error.stackTraceLimit,writable:!1,configurable:!0})}catch{}}protectProxyRevocable(){let t=this;try{let n=Proxy.revocable;if(typeof n!="function")return;let r=Object.getOwnPropertyDescriptor(Proxy,"revocable");this.originalDescriptors.push({target:Proxy,prop:"revocable",descriptor:r}),Object.defineProperty(Proxy,"revocable",{value:function(i,o){if(t.shouldBlock()){let a="Proxy.revocable is blocked during script execution",l=t.recordViolation("proxy","Proxy.revocable",a);throw new me(a,l)}return t.config.auditMode&&Ue?.getStore()?.sandboxActive===!0&&t.recordViolation("proxy","Proxy.revocable","Proxy.revocable called (audit mode)"),n(i,o)},writable:!1,configurable:!0})}catch(n){this.patchFailures.push("Proxy.revocable"),console.debug("[DefenseInDepthBox] Could not protect Proxy.revocable:",n instanceof Error?n.message:n)}}protectDynamicImport(){if(!(ar||e.importHooksRegistered))try{let t=this,n=Yn("node:module"),r=new Set;for(let o of n.builtinModules??[]){let a=o.startsWith("node:")?o.slice(5):o;r.add(a);let l=a.indexOf("/");l>0&&r.add(a.slice(0,l))}let s=o=>{if(o.startsWith("./")||o.startsWith("../")||o.startsWith("/")||o.startsWith("file:")||o.startsWith("data:")||o.startsWith("blob:")||o.startsWith("http:")||o.startsWith("https:"))return!1;let a=o.startsWith("node:")?o.slice(5):o;if(!a)return!1;if(typeof n.isBuiltin=="function"&&n.isBuiltin(a)||r.has(a))return!0;let l=a.indexOf("/");return l>0&&r.has(a.slice(0,l))},i=()=>{let o=Ue?.getStore();return t.config.auditMode===!0&&o?.sandboxActive===!0&&o.trusted!==!0&&!e.isTrustedScopeActive(o.executionId)};if(typeof n.registerHooks=="function"){n.registerHooks({resolve(o,a,l){if(o.startsWith("data:")||o.startsWith("blob:"))throw new Error(`dynamic import of ${o.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`);if(s(o)){let c=`import(${o})`,u=`dynamic import of Node.js builtin '${o}' is blocked during script execution`;if(t.shouldBlock()){let f=t.recordViolation("dynamic_import_builtin",c,u);throw new me(u,f)}i()&&t.recordViolation("dynamic_import_builtin",c,`dynamic import of Node.js builtin '${o}' called (audit mode)`)}return l(o,a)}}),e.importHooksRegistered=!0;return}if(typeof n.register=="function"){let o=["export async function resolve(specifier, context, nextResolve) {",' if (specifier.startsWith("data:") || specifier.startsWith("blob:")) {',' throw new Error("dynamic import of " + (specifier.startsWith("data:") ? "data:" : "blob:") + " URLs is blocked by defense-in-depth");'," }"," return nextResolve(specifier, context);","}"].join(`
4
4
  `);n.register(`data:text/javascript,${encodeURIComponent(o)}`),e.importHooksRegistered=!0}}catch(t){console.debug("[DefenseInDepthBox] Could not register import() hooks:",t instanceof Error?t.message:t)}}protectModuleLoad(){if(!ar)try{let t=null;if(typeof process<"u"){let o=process.mainModule;o&&typeof o=="object"&&(t=o.constructor)}if(!t&&typeof Yn<"u"&&typeof Yn.main<"u"&&(t=Yn.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){this.patchFailures.push("Module._load"),console.debug("[DefenseInDepthBox] Could not protect Module._load:",t instanceof Error?t.message:t)}}protectModuleResolveFilename(){if(!ar)try{let t=null;if(typeof process<"u"){let o=process.mainModule;o&&typeof o=="object"&&(t=o.constructor)}if(!t&&typeof Yn<"u"&&typeof Yn.main<"u"&&(t=Yn.main.constructor),!t||typeof t._resolveFilename!="function")return;let n=t._resolveFilename,r=Object.getOwnPropertyDescriptor(t,"_resolveFilename");this.originalDescriptors.push({target:t,prop:"_resolveFilename",descriptor:r});let i=this.createBlockingProxy(n,"Module._resolveFilename","module_resolve_filename");Object.defineProperty(t,"_resolveFilename",{value:i,writable:!0,configurable:!0})}catch(t){this.patchFailures.push("Module._resolveFilename"),console.debug("[DefenseInDepthBox] Could not protect Module._resolveFilename:",t instanceof Error?t.message:t)}}applyPatch(t){let{target:n,prop:r,violationType:s,strategy:i}=t;try{let o=n[r];if(o===void 0)return;let a=Object.getOwnPropertyDescriptor(n,r);if(this.originalDescriptors.push({target:n,prop:r,descriptor:a}),i==="freeze")typeof o=="object"&&o!==null&&Object.freeze(o);else{let l=this.getPathForTarget(n,r),c=typeof o=="function"?this.createBlockingProxy(o,l,s):this.createBlockingObjectProxy(o,l,s,t.allowedKeys);Object.defineProperty(n,r,{value:c,writable:!0,configurable:!0})}}catch(o){let a=this.getPathForTarget(n,r);this.patchFailures.push(a),console.debug(`[DefenseInDepthBox] Could not patch ${a}:`,o instanceof Error?o.message:o)}}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 o=this.getPathForTarget(n,r);console.debug(`[DefenseInDepthBox] Could not restore ${o}:`,i instanceof Error?i.message:i)}}this.originalDescriptors=[]}}});function n4(e){return typeof e!="function"?e:Et.bindCurrentContext(e)}var e4,t4,sk,ik,Ir,ts,Zs=k(()=>{"use strict";un();e4=globalThis.setTimeout.bind(globalThis),t4=globalThis.clearTimeout.bind(globalThis),sk=globalThis.setInterval.bind(globalThis),ik=globalThis.clearInterval.bind(globalThis);Ir=((e,t,...n)=>e4(n4(e),t,...n)),ts=t4});var Lf={};ee(Lf,{echoCommand:()=>s4,flagsForFuzzing:()=>i4});function r4(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"){if(n+1>=e.length){t+="\\";break}let r=e[n+1];switch(r){case"\\":t+="\\",n+=2;break;case"n":t+=`
5
5
  `,n+=2;break;case"t":t+=" ",n+=2;break;case"r":t+="\r",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"c":return{output:t,stop:!0};case"0":{let s="",i=n+2;for(;i<e.length&&i<n+5&&/[0-7]/.test(e[i]);)s+=e[i],i++;if(s.length===0)t+="\0";else{let o=parseInt(s,8)%256;t+=String.fromCharCode(o)}n=i;break}case"x":{let s="",i=n+2;for(;i<e.length&&i<n+4&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;if(s.length===0)t+="\\x",n+=2;else{let o=parseInt(s,16);t+=String.fromCharCode(o),n=i}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++;if(s.length===0)t+="\\u",n+=2;else{let o=parseInt(s,16);t+=String.fromCodePoint(o),n=i}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++;if(s.length===0)t+="\\U",n+=2;else{let o=parseInt(s,16);try{t+=String.fromCodePoint(o)}catch{t+=`\\U${s}`}n=i}break}default:t+=`\\${r}`,n+=2}}else t+=e[n],n++;return{output:t,stop:!1}}var s4,i4,Mf=k(()=>{"use strict";s4={name:"echo",async execute(e,t){let n=!1,r=t.xpgEcho??!1,s=0;for(;s<e.length;){let o=e[s];if(o==="-n")n=!0,s++;else if(o==="-e")r=!0,s++;else if(o==="-E")r=!1,s++;else if(o==="-ne"||o==="-en")n=!0,r=!0,s++;else break}let i=e.slice(s).join(" ");if(r){let o=r4(i);if(i=o.output,o.stop)return{stdout:i,stderr:"",exitCode:0}}return n||(i+=`
6
- `),{stdout:i,stderr:"",exitCode:0}}},i4={name:"echo",flags:[{flag:"-n",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-E",type:"boolean"}],stdinType:"none",needsArgs:!0}});function se(e){let t=e;if(!t)return t;let n=!1;for(let s=0;s<t.length;s++){let i=t.charCodeAt(s);if(i>255)return t;i>127&&(n=!0)}if(!n)return t;let r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);try{return o4.decode(r)}catch{return t}}function Dn(e){if(!e)return e;let t=a4.encode(e),n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return n}function l4(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}async function _n(e,t){return typeof e.readFileBytes=="function"?e.readFileBytes(t):l4(await e.readFileBuffer(t))}function c4(e){return e.stdoutKind?e.stdoutKind:e.stdoutEncoding==="binary"?"bytes":"text"}function Za(e){return c4(e)==="bytes"?e.stdout:Dn(e.stdout)}var o4,a4,Uf,he=k(()=>{"use strict";o4=new TextDecoder("utf-8",{fatal:!0}),a4=new TextEncoder;Uf=""});function M(e){let t=`${e.name} - ${e.summary}
6
+ `),{stdout:i,stderr:"",exitCode:0}}},i4={name:"echo",flags:[{flag:"-n",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-E",type:"boolean"}],stdinType:"none",needsArgs:!0}});function se(e){let t=e;if(!t)return t;let n=!1;for(let s=0;s<t.length;s++){let i=t.charCodeAt(s);if(i>255)return t;i>127&&(n=!0)}if(!n)return t;let r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);try{return o4.decode(r)}catch{return t}}function _n(e){if(!e)return e;let t=a4.encode(e),n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return n}function l4(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}async function Fn(e,t){return typeof e.readFileBytes=="function"?e.readFileBytes(t):l4(await e.readFileBuffer(t))}function c4(e){return e.stdoutKind?e.stdoutKind:e.stdoutEncoding==="binary"?"bytes":"text"}function Za(e){return c4(e)==="bytes"?e.stdout:_n(e.stdout)}var o4,a4,Uf,he=k(()=>{"use strict";o4=new TextDecoder("utf-8",{fatal:!0}),a4=new TextEncoder;Uf=""});function M(e){let t=`${e.name} - ${e.summary}
7
7
 
8
8
  `;if(t+=`Usage: ${e.usage}
9
9
  `,e.description){if(t+=`
@@ -26,18 +26,18 @@ Notes:
26
26
  `:`${e}: invalid option -- '${t.replace(/^-/,"")}'
27
27
  `,exitCode:1}}var oe=k(()=>{"use strict"});function Se(e,t,n){let r=new Map,s=new Map;for(let[l,c]of Object.entries(n)){let u={name:l,type:c.type};c.short&&r.set(c.short,u),c.long&&s.set(c.long,u)}let i=Object.create(null);for(let[l,c]of Object.entries(n))c.default!==void 0?i[l]=c.default:c.type==="boolean"&&(i[l]=!1);let o=[],a=!1;for(let l=0;l<t.length;l++){let c=t[l];if(a||!c.startsWith("-")||c==="-"){o.push(c);continue}if(c==="--"){a=!0;continue}if(c.startsWith("--")){let u=c.indexOf("="),f,p;u!==-1?(f=c.slice(2,u),p=c.slice(u+1)):f=c.slice(2);let h=s.get(f);if(!h)return{ok:!1,error:K(e,c)};let{name:d,type:m}=h;if(m==="boolean")i[d]=!0;else{if(p===void 0){if(l+1>=t.length)return{ok:!1,error:{stdout:"",stderr:`${e}: option '--${f}' requires an argument
28
28
  `,exitCode:1}};p=t[++l]}i[d]=m==="number"?parseInt(p,10):p}}else{let u=c.slice(1);for(let f=0;f<u.length;f++){let p=u[f],h=r.get(p);if(!h)return{ok:!1,error:K(e,`-${p}`)};let{name:d,type:m}=h;if(m==="boolean")i[d]=!0;else{let g;if(f+1<u.length)g=u.slice(f+1);else if(l+1<t.length)g=t[++l];else return{ok:!1,error:{stdout:"",stderr:`${e}: option requires an argument -- '${p}'
29
- `,exitCode:1}};i[d]=m==="number"?parseInt(g,10):g;break}}}}return{ok:!0,result:{flags:i,positional:o}}}var at=k(()=>{"use strict";oe()});var ns=k(()=>{"use strict"});async function $r(e,t,n){let{cmdName:r,allowStdinMarker:s=!0,stopOnError:i=!1,batchSize:o=100}=n;if(t.length===0)return{files:[{filename:"",content:e.stdin}],stderr:"",exitCode:0};let a=[],l="",c=0;for(let u=0;u<t.length;u+=o){let f=t.slice(u,u+o),p=await Promise.all(f.map(async h=>{if(s&&h==="-")return{filename:"-",content:e.stdin,error:null};try{let d=e.fs.resolvePath(e.cwd,h),m=await _n(e.fs,d);return{filename:h,content:m,error:null}}catch{return{filename:h,content:Uf,error:`${r}: ${h}: No such file or directory
29
+ `,exitCode:1}};i[d]=m==="number"?parseInt(g,10):g;break}}}}return{ok:!0,result:{flags:i,positional:o}}}var at=k(()=>{"use strict";oe()});var ns=k(()=>{"use strict"});async function $r(e,t,n){let{cmdName:r,allowStdinMarker:s=!0,stopOnError:i=!1,batchSize:o=100}=n;if(t.length===0)return{files:[{filename:"",content:e.stdin}],stderr:"",exitCode:0};let a=[],l="",c=0;for(let u=0;u<t.length;u+=o){let f=t.slice(u,u+o),p=await Promise.all(f.map(async h=>{if(s&&h==="-")return{filename:"-",content:e.stdin,error:null};try{let d=e.fs.resolvePath(e.cwd,h),m=await Fn(e.fs,d);return{filename:h,content:m,error:null}}catch{return{filename:h,content:Uf,error:`${r}: ${h}: No such file or directory
30
30
  `}}}));for(let h of p)if(h.error){if(l+=h.error,c=1,i)return{files:a,stderr:l,exitCode:c}}else a.push({filename:h.filename,content:h.content})}return{files:a,stderr:l,exitCode:c}}async function rs(e,t,n){let r=await $r(e,t,{...n,stopOnError:!0});return r.exitCode!==0?{ok:!1,error:{stdout:"",stderr:r.stderr,exitCode:r.exitCode}}:{ok:!0,content:r.files.map(i=>i.content).join("")}}var Tr=k(()=>{"use strict";he();ns()});var Bf={};ee(Bf,{catCommand:()=>p4,flagsForFuzzing:()=>d4});function h4(e,t){let n=e.split(`
31
31
  `),r=e.endsWith(`
32
32
  `),s=r?n.slice(0,-1):n;return{content:s.map((o,a)=>`${String(t+a).padStart(6," ")} ${o}`).join(`
33
33
  `)+(r?`
34
- `:""),nextLineNumber:t+s.length}}var u4,f4,p4,d4,Wf=k(()=>{"use strict";he();at();Tr();oe();u4={name:"cat",summary:"concatenate files and print on the standard output",usage:"cat [OPTION]... [FILE]...",options:["-n, --number number all output lines"," --help display this help and exit"]},f4={number:{short:"n",long:"number",type:"boolean"}},p4={name:"cat",async execute(e,t){if(U(e))return M(u4);let n=Se("cat",e,f4);if(!n.ok)return n.error;let r=n.result.flags.number,s=n.result.positional,i=await $r(t,s,{cmdName:"cat",allowStdinMarker:!0,stopOnError:!1}),o="",a=1;for(let{content:l}of i.files){let c=l;if(r){let u=h4(c,a);o+=u.content,a=u.nextLineNumber}else o+=c}return{stdout:o,stderr:i.stderr,exitCode:i.exitCode,stdoutEncoding:"binary"}}};d4={name:"cat",flags:[{flag:"-n",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-b",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-t",type:"boolean"}],stdinType:"text",needsFiles:!0}});function Mi(e){return e instanceof It||e instanceof $t||e instanceof St}var Nt,It,$t,St,Ht,Rt,we,Le,Pt,Fn,ss,X,is,Ln,nn,Ae=k(()=>{"use strict";Nt=class extends Error{stdout;stderr;constructor(t,n="",r=""){super(t),this.stdout=n,this.stderr=r}prependOutput(t,n){this.stdout=t+this.stdout,this.stderr=n+this.stderr}},It=class extends Nt{levels;name="BreakError";constructor(t=1,n="",r=""){super("break",n,r),this.levels=t}},$t=class extends Nt{levels;name="ContinueError";constructor(t=1,n="",r=""){super("continue",n,r),this.levels=t}},St=class extends Nt{exitCode;name="ReturnError";constructor(t=0,n="",r=""){super("return",n,r),this.exitCode=t}},Ht=class extends Nt{exitCode;name="ErrexitError";constructor(t,n="",r=""){super(`errexit: command exited with status ${t}`,n,r),this.exitCode=t}},Rt=class extends Nt{varName;name="NounsetError";constructor(t,n=""){super(`${t}: unbound variable`,n,`bash: ${t}: unbound variable
34
+ `:""),nextLineNumber:t+s.length}}var u4,f4,p4,d4,Wf=k(()=>{"use strict";he();at();Tr();oe();u4={name:"cat",summary:"concatenate files and print on the standard output",usage:"cat [OPTION]... [FILE]...",options:["-n, --number number all output lines"," --help display this help and exit"]},f4={number:{short:"n",long:"number",type:"boolean"}},p4={name:"cat",async execute(e,t){if(U(e))return M(u4);let n=Se("cat",e,f4);if(!n.ok)return n.error;let r=n.result.flags.number,s=n.result.positional,i=await $r(t,s,{cmdName:"cat",allowStdinMarker:!0,stopOnError:!1}),o="",a=1;for(let{content:l}of i.files){let c=l;if(r){let u=h4(c,a);o+=u.content,a=u.nextLineNumber}else o+=c}return{stdout:o,stderr:i.stderr,exitCode:i.exitCode,stdoutEncoding:"binary"}}};d4={name:"cat",flags:[{flag:"-n",type:"boolean"},{flag:"-A",type:"boolean"},{flag:"-b",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-t",type:"boolean"}],stdinType:"text",needsFiles:!0}});function Mi(e){return e instanceof It||e instanceof $t||e instanceof St}var Nt,It,$t,St,Ht,Rt,we,Le,Pt,Ln,ss,X,is,Mn,nn,Ae=k(()=>{"use strict";Nt=class extends Error{stdout;stderr;constructor(t,n="",r=""){super(t),this.stdout=n,this.stderr=r}prependOutput(t,n){this.stdout=t+this.stdout,this.stderr=n+this.stderr}},It=class extends Nt{levels;name="BreakError";constructor(t=1,n="",r=""){super("break",n,r),this.levels=t}},$t=class extends Nt{levels;name="ContinueError";constructor(t=1,n="",r=""){super("continue",n,r),this.levels=t}},St=class extends Nt{exitCode;name="ReturnError";constructor(t=0,n="",r=""){super("return",n,r),this.exitCode=t}},Ht=class extends Nt{exitCode;name="ErrexitError";constructor(t,n="",r=""){super(`errexit: command exited with status ${t}`,n,r),this.exitCode=t}},Rt=class extends Nt{varName;name="NounsetError";constructor(t,n=""){super(`${t}: unbound variable`,n,`bash: ${t}: unbound variable
35
35
  `),this.varName=t}},we=class extends Nt{exitCode;stdoutKind;stdoutEncoding;name="ExitError";constructor(t,n="",r="",s,i){super("exit",n,r),this.exitCode=t,this.stdoutKind=s,this.stdoutEncoding=i}},Le=class extends Nt{name="ArithmeticError";fatal;constructor(t,n="",r="",s=!1){super(t,n,r),this.stderr=r||`bash: ${t}
36
36
  `,this.fatal=s}},Pt=class extends Nt{name="BadSubstitutionError";constructor(t,n="",r=""){super(t,n,r),this.stderr=r||`bash: ${t}: bad substitution
37
- `}},Fn=class extends Nt{name="GlobError";constructor(t,n="",r=""){super(`no match: ${t}`,n,r),this.stderr=r||`bash: no match: ${t}
37
+ `}},Ln=class extends Nt{name="GlobError";constructor(t,n="",r=""){super(`no match: ${t}`,n,r),this.stderr=r||`bash: no match: ${t}
38
38
  `}},ss=class extends Nt{name="BraceExpansionError";constructor(t,n="",r=""){super(t,n,r),this.stderr=r||`bash: ${t}
39
39
  `}},X=class extends Nt{limitType;name="ExecutionLimitError";static EXIT_CODE=126;constructor(t,n,r="",s=""){super(t,r,s),this.limitType=n,this.stderr=s||`bash: ${t}
40
- `}},is=class extends Nt{name="ExecutionAbortedError";constructor(t="",n=""){super("execution aborted",t,n)}},Ln=class extends Nt{name="SubshellExitError";constructor(t="",n=""){super("subshell exit",t,n)}};nn=class extends Nt{exitCode;name="PosixFatalError";constructor(t,n="",r=""){super("posix fatal error",n,r),this.exitCode=t}}});function Xe(e){return e instanceof Error?e.message:String(e)}var rn=k(()=>{"use strict"});function Ui(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 zf(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 Bi(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length)switch(e[n+1]){case"n":t+=`
40
+ `}},is=class extends Nt{name="ExecutionAbortedError";constructor(t="",n=""){super("execution aborted",t,n)}},Mn=class extends Nt{name="SubshellExitError";constructor(t="",n=""){super("subshell exit",t,n)}};nn=class extends Nt{exitCode;name="PosixFatalError";constructor(t,n="",r=""){super("posix fatal error",n,r),this.exitCode=t}}});function Xe(e){return e instanceof Error?e.message:String(e)}var rn=k(()=>{"use strict"});function Ui(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 zf(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 Bi(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"&&n+1<e.length)switch(e[n+1]){case"n":t+=`
41
41
  `,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 o=new TextDecoder("utf-8",{fatal:!0});t+=o.decode(new Uint8Array(s))}catch{for(let o of s)t+=String.fromCharCode(o)}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 Ka=k(()=>{"use strict"});function Gf(e,t,n){let r=new Date(t*1e3),s="",i=0;for(;i<e.length;)if(e[i]==="%"&&i+1<e.length){let o=e[i+1],a=g4(r,o,n);a!==null?(s+=a,i+=2):(s+=e[i],i++)}else s+=e[i],i++;return s}function m4(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??"",o=new Map([["Sun",0],["Mon",1],["Tue",2],["Wed",3],["Thu",4],["Fri",5],["Sat",6]]),a=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:o.get(a)??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 g4(e,t,n){let r=m4(e,n),s=(l,c=2)=>String(l).padStart(c,"0"),i=Vf(r.year,r.month,r.day),o=Hf(r.year,r.month,r.day,r.weekday,0),a=Hf(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(jf(r.year,r.month,r.day)%100);case"G":return String(jf(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`
42
42
  `;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(o);case"V":return s(b4(r.year,r.month,r.day));case"w":return String(r.weekday);case"W":return s(a);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 y4(e,n);case"Z":return w4(e,n);case"%":return"%";default:return null}}function y4(e,t){if(!t){let o=-e.getTimezoneOffset(),a=o>=0?"+":"-",l=Math.floor(Math.abs(o)/60),c=Math.abs(o)%60;return`${a}${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 w4(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 Vf(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 o=0;o<t-1;o++)i+=r[o];return i}function Hf(e,t,n,r,s){let i=Vf(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 b4(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 jf(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 qf=k(()=>{"use strict"});var Kf={};ee(Kf,{flagsForFuzzing:()=>R4,printfCommand:()=>A4});import{sprintf as os}from"sprintf-js";function x4(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 S4(e,t,n,r){let s="",i=0,o=0,a=!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,v=u[2]?parseInt(u[2],10):-1,$=u[3],_=u[0],R=t[n+o]||"";o++;let P;R===""||R==="-1"||R==="-2"?P=Math.floor(Date.now()/1e3):P=parseInt(R,10)||0;let C=Gf($,P,r);if(v>=0&&C.length>v&&(C=C.slice(0,v)),S!==0){let T=Math.abs(S);C.length<T&&(S<0?C=C.padEnd(T," "):C=C.padStart(T," "))}s+=C,i=c+_.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 m=e.slice(c,i);if(f){let S=parseInt(t[n+o]||"0",10);o++,m=m.replace("*",String(S))}if(p){let S=parseInt(t[n+o]||"0",10);o++,m=m.replace(".*",`.${S}`)}let g=t[n+o]||"";o++;let{value:y,parseError:w,parseErrMsg:b,stopped:x}=C4(m,h,g);if(s+=y,w&&(a=!0,b&&(l=b)),x)return{result:s,argsConsumed:o,error:a,errMsg:l,stopped:!0}}else s+=e[i],i++;return{result:s,argsConsumed:o,error:a,errMsg:l,stopped:!1}}function C4(e,t,n){let r=!1,s="";switch(t){case"d":case"i":{let i=Wi(n);return r=xn,r&&(s=`printf: ${n}: invalid number
43
43
  `),{value:Zf(e,i),parseError:r,parseErrMsg:s}}case"o":{let i=Wi(n);return r=xn,r&&(s=`printf: ${n}: invalid number
@@ -159,22 +159,22 @@ Options:
159
159
  `,i+=`Access: (${f}/${p})
160
160
  `,i+=`Modify: ${u.mtime.toISOString()}
161
161
  `}}catch{o+=`stat: cannot stat '${l}': No such file or directory
162
- `,a=!0}}return{stdout:i,stderr:o,exitCode:a?1:0}}},O3={name:"stat",flags:[{flag:"-c",type:"value",valueHint:"format"},{flag:"-L",type:"boolean"}],needsArgs:!0}});var G,D,N,fn,ue,Te,ep,lr,Vi,el,ls,Un,tl,nl,Ye,cs,je,rl,An,sl,qi,de,il,Zi,Qs,R3,P3,ol,al,F,ll,as,cl,ul,$e,_1,F1,L1,M1,U1,B1,W1,z1,H1,j1,G1,V1,q1,Z1,K1,Q1,X1,Y1,J1,Mn,Xs,fl,pl,hl,dl,ml,cr,tp=k(()=>{G=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
+ `,a=!0}}return{stdout:i,stderr:o,exitCode:a?1:0}}},O3={name:"stat",flags:[{flag:"-c",type:"value",valueHint:"format"},{flag:"-L",type:"boolean"}],needsArgs:!0}});var G,D,N,fn,ue,Te,ep,lr,Vi,el,ls,Bn,tl,nl,Ye,cs,je,rl,An,sl,qi,de,il,Zi,Qs,R3,P3,ol,al,F,ll,as,cl,ul,$e,_1,F1,L1,M1,U1,B1,W1,z1,H1,j1,G1,V1,q1,Z1,K1,Q1,X1,Y1,J1,Un,Xs,fl,pl,hl,dl,ml,cr,tp=k(()=>{G=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)}},N=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}},fn=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 N(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 N(new Uint32Array([0,31,1,127,159,1]));static Cf=new N(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 N(new Uint32Array([57344,63743,1,983040,1048573,1,1048576,1114109,1]));static Cs=new N(new Uint32Array([55296,57343,1]));static L=new N(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 N(new Uint32Array([837,837,1]));static Ll=new N(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 N(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 N(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 N(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 N(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 N(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 N(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 N(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 N(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 N(new Uint32Array([921,953,32,8126,8126,1]));static Mc=new N(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 N(new Uint32Array([1160,1161,1,6846,8413,1567,8414,8416,1,8418,8420,1,42608,42610,1]));static Mn=new N(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 N(new Uint32Array([921,953,32,8126,8126,1]));static N=new N(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 N(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 N(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 N(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 N(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 N(new Uint32Array([95,8255,8160,8256,8276,20,65075,65076,1,65101,65103,1,65343,65343,1]));static Pd=new N(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 N(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 N(new Uint32Array([187,8217,8030,8221,8250,29,11779,11781,2,11786,11789,3,11805,11809,4]));static Pi=new N(new Uint32Array([171,8216,8045,8219,8220,1,8223,8249,26,11778,11780,2,11785,11788,3,11804,11808,4]));static Po=new N(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 N(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 N(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 N(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 N(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 N(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 N(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 N(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8232,8233,1,8239,8287,48,12288,12288,1]));static Zl=new N(new Uint32Array([8232,8232,1]));static Zp=new N(new Uint32Array([8233,8233,1]));static Zs=new N(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8239,8287,48,12288,12288,1]));static Adlam=new N(new Uint32Array([125184,125259,1,125264,125273,1,125278,125279,1]));static Ahom=new N(new Uint32Array([71424,71450,1,71453,71467,1,71472,71494,1]));static Anatolian_Hieroglyphs=new N(new Uint32Array([82944,83526,1]));static Arabic=new N(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 N(new Uint32Array([1329,1366,1,1369,1418,1,1421,1423,1,64275,64279,1]));static Avestan=new N(new Uint32Array([68352,68405,1,68409,68415,1]));static Balinese=new N(new Uint32Array([6912,6988,1,6990,7039,1]));static Bamum=new N(new Uint32Array([42656,42743,1,92160,92728,1]));static Bassa_Vah=new N(new Uint32Array([92880,92909,1,92912,92917,1]));static Batak=new N(new Uint32Array([7104,7155,1,7164,7167,1]));static Bengali=new N(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 N(new Uint32Array([72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1]));static Bopomofo=new N(new Uint32Array([746,747,1,12549,12591,1,12704,12735,1]));static Brahmi=new N(new Uint32Array([69632,69709,1,69714,69749,1,69759,69759,1]));static Braille=new N(new Uint32Array([10240,10495,1]));static Buginese=new N(new Uint32Array([6656,6683,1,6686,6687,1]));static Buhid=new N(new Uint32Array([5952,5971,1]));static Canadian_Aboriginal=new N(new Uint32Array([5120,5759,1,6320,6389,1,72368,72383,1]));static Carian=new N(new Uint32Array([66208,66256,1]));static Caucasian_Albanian=new N(new Uint32Array([66864,66915,1,66927,66927,1]));static Chakma=new N(new Uint32Array([69888,69940,1,69942,69959,1]));static Cham=new N(new Uint32Array([43520,43574,1,43584,43597,1,43600,43609,1,43612,43615,1]));static Cherokee=new N(new Uint32Array([5024,5109,1,5112,5117,1,43888,43967,1]));static Chorasmian=new N(new Uint32Array([69552,69579,1]));static Common=new N(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 N(new Uint32Array([924,956,32]));static Coptic=new N(new Uint32Array([994,1007,1,11392,11507,1,11513,11519,1]));static Cuneiform=new N(new Uint32Array([73728,74649,1,74752,74862,1,74864,74868,1,74880,75075,1]));static Cypriot=new N(new Uint32Array([67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3]));static Cypro_Minoan=new N(new Uint32Array([77712,77810,1]));static Cyrillic=new N(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 N(new Uint32Array([66560,66639,1]));static Devanagari=new N(new Uint32Array([2304,2384,1,2389,2403,1,2406,2431,1,43232,43263,1,72448,72457,1]));static Dives_Akuru=new N(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 N(new Uint32Array([71680,71739,1]));static Duployan=new N(new Uint32Array([113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1]));static Egyptian_Hieroglyphs=new N(new Uint32Array([77824,78933,1,78944,82938,1]));static Elbasan=new N(new Uint32Array([66816,66855,1]));static Elymaic=new N(new Uint32Array([69600,69622,1]));static Ethiopic=new N(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 N(new Uint32Array([68928,68965,1,68969,68997,1,69006,69007,1]));static Georgian=new N(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 N(new Uint32Array([11264,11359,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1]));static Gothic=new N(new Uint32Array([66352,66378,1]));static Grantha=new N(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 N(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 N(new Uint32Array([181,837,656]));static Gujarati=new N(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 N(new Uint32Array([73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1]));static Gurmukhi=new N(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 N(new Uint32Array([90368,90425,1]));static Han=new N(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 N(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 N(new Uint32Array([68864,68903,1,68912,68921,1]));static Hanunoo=new N(new Uint32Array([5920,5940,1]));static Hatran=new N(new Uint32Array([67808,67826,1,67828,67829,1,67835,67839,1]));static Hebrew=new N(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 N(new Uint32Array([12353,12438,1,12445,12447,1,110593,110879,1,110898,110928,30,110929,110930,1,127488,127488,1]));static Imperial_Aramaic=new N(new Uint32Array([67648,67669,1,67671,67679,1]));static Inherited=new N(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 N(new Uint32Array([921,953,32,8126,8126,1]));static Inscriptional_Pahlavi=new N(new Uint32Array([68448,68466,1,68472,68479,1]));static Inscriptional_Parthian=new N(new Uint32Array([68416,68437,1,68440,68447,1]));static Javanese=new N(new Uint32Array([43392,43469,1,43472,43481,1,43486,43487,1]));static Kaithi=new N(new Uint32Array([69760,69826,1,69837,69837,1]));static Kannada=new N(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 N(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 N(new Uint32Array([73472,73488,1,73490,73530,1,73534,73562,1]));static Kayah_Li=new N(new Uint32Array([43264,43309,1,43311,43311,1]));static Kharoshthi=new N(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 N(new Uint32Array([94180,101120,6940,101121,101589,1,101631,101631,1]));static Khmer=new N(new Uint32Array([6016,6109,1,6112,6121,1,6128,6137,1,6624,6655,1]));static Khojki=new N(new Uint32Array([70144,70161,1,70163,70209,1]));static Khudawadi=new N(new Uint32Array([70320,70378,1,70384,70393,1]));static Kirat_Rai=new N(new Uint32Array([93504,93561,1]));static Lao=new N(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 N(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 N(new Uint32Array([7168,7223,1,7227,7241,1,7245,7247,1]));static Limbu=new N(new Uint32Array([6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6479,1]));static Linear_A=new N(new Uint32Array([67072,67382,1,67392,67413,1,67424,67431,1]));static Linear_B=new N(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 N(new Uint32Array([42192,42239,1,73648,73648,1]));static Lycian=new N(new Uint32Array([66176,66204,1]));static Lydian=new N(new Uint32Array([67872,67897,1,67903,67903,1]));static Mahajani=new N(new Uint32Array([69968,70006,1]));static Makasar=new N(new Uint32Array([73440,73464,1]));static Malayalam=new N(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 N(new Uint32Array([2112,2139,1,2142,2142,1]));static Manichaean=new N(new Uint32Array([68288,68326,1,68331,68342,1]));static Marchen=new N(new Uint32Array([72816,72847,1,72850,72871,1,72873,72886,1]));static Masaram_Gondi=new N(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 N(new Uint32Array([93760,93850,1]));static Meetei_Mayek=new N(new Uint32Array([43744,43766,1,43968,44013,1,44016,44025,1]));static Mende_Kikakui=new N(new Uint32Array([124928,125124,1,125127,125142,1]));static Meroitic_Cursive=new N(new Uint32Array([68e3,68023,1,68028,68047,1,68050,68095,1]));static Meroitic_Hieroglyphs=new N(new Uint32Array([67968,67999,1]));static Miao=new N(new Uint32Array([93952,94026,1,94031,94087,1,94095,94111,1]));static Modi=new N(new Uint32Array([71168,71236,1,71248,71257,1]));static Mongolian=new N(new Uint32Array([6144,6145,1,6148,6150,2,6151,6169,1,6176,6264,1,6272,6314,1,71264,71276,1]));static Mro=new N(new Uint32Array([92736,92766,1,92768,92777,1,92782,92783,1]));static Multani=new N(new Uint32Array([70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1]));static Myanmar=new N(new Uint32Array([4096,4255,1,43488,43518,1,43616,43647,1,71376,71395,1]));static Nabataean=new N(new Uint32Array([67712,67742,1,67751,67759,1]));static Nag_Mundari=new N(new Uint32Array([124112,124153,1]));static Nandinagari=new N(new Uint32Array([72096,72103,1,72106,72151,1,72154,72164,1]));static New_Tai_Lue=new N(new Uint32Array([6528,6571,1,6576,6601,1,6608,6618,1,6622,6623,1]));static Newa=new N(new Uint32Array([70656,70747,1,70749,70753,1]));static Nko=new N(new Uint32Array([1984,2042,1,2045,2047,1]));static Nushu=new N(new Uint32Array([94177,110960,16783,110961,111355,1]));static Nyiakeng_Puachue_Hmong=new N(new Uint32Array([123136,123180,1,123184,123197,1,123200,123209,1,123214,123215,1]));static Ogham=new N(new Uint32Array([5760,5788,1]));static Ol_Chiki=new N(new Uint32Array([7248,7295,1]));static Ol_Onal=new N(new Uint32Array([124368,124410,1,124415,124415,1]));static Old_Hungarian=new N(new Uint32Array([68736,68786,1,68800,68850,1,68858,68863,1]));static Old_Italic=new N(new Uint32Array([66304,66339,1,66349,66351,1]));static Old_North_Arabian=new N(new Uint32Array([68224,68255,1]));static Old_Permic=new N(new Uint32Array([66384,66426,1]));static Old_Persian=new N(new Uint32Array([66464,66499,1,66504,66517,1]));static Old_Sogdian=new N(new Uint32Array([69376,69415,1]));static Old_South_Arabian=new N(new Uint32Array([68192,68223,1]));static Old_Turkic=new N(new Uint32Array([68608,68680,1]));static Old_Uyghur=new N(new Uint32Array([69488,69513,1]));static Oriya=new N(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 N(new Uint32Array([66736,66771,1,66776,66811,1]));static Osmanya=new N(new Uint32Array([66688,66717,1,66720,66729,1]));static Pahawh_Hmong=new N(new Uint32Array([92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1]));static Palmyrene=new N(new Uint32Array([67680,67711,1]));static Pau_Cin_Hau=new N(new Uint32Array([72384,72440,1]));static Phags_Pa=new N(new Uint32Array([43072,43127,1]));static Phoenician=new N(new Uint32Array([67840,67867,1,67871,67871,1]));static Psalter_Pahlavi=new N(new Uint32Array([68480,68497,1,68505,68508,1,68521,68527,1]));static Rejang=new N(new Uint32Array([43312,43347,1,43359,43359,1]));static Runic=new N(new Uint32Array([5792,5866,1,5870,5880,1]));static Samaritan=new N(new Uint32Array([2048,2093,1,2096,2110,1]));static Saurashtra=new N(new Uint32Array([43136,43205,1,43214,43225,1]));static Sharada=new N(new Uint32Array([70016,70111,1]));static Shavian=new N(new Uint32Array([66640,66687,1]));static Siddham=new N(new Uint32Array([71040,71093,1,71096,71133,1]));static SignWriting=new N(new Uint32Array([120832,121483,1,121499,121503,1,121505,121519,1]));static Sinhala=new N(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 N(new Uint32Array([69424,69465,1]));static Sora_Sompeng=new N(new Uint32Array([69840,69864,1,69872,69881,1]));static Soyombo=new N(new Uint32Array([72272,72354,1]));static Sundanese=new N(new Uint32Array([7040,7103,1,7360,7367,1]));static Sunuwar=new N(new Uint32Array([72640,72673,1,72688,72697,1]));static Syloti_Nagri=new N(new Uint32Array([43008,43052,1]));static Syriac=new N(new Uint32Array([1792,1805,1,1807,1866,1,1869,1871,1,2144,2154,1]));static Tagalog=new N(new Uint32Array([5888,5909,1,5919,5919,1]));static Tagbanwa=new N(new Uint32Array([5984,5996,1,5998,6e3,1,6002,6003,1]));static Tai_Le=new N(new Uint32Array([6480,6509,1,6512,6516,1]));static Tai_Tham=new N(new Uint32Array([6688,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1]));static Tai_Viet=new N(new Uint32Array([43648,43714,1,43739,43743,1]));static Takri=new N(new Uint32Array([71296,71353,1,71360,71369,1]));static Tamil=new N(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 N(new Uint32Array([92784,92862,1,92864,92873,1]));static Tangut=new N(new Uint32Array([94176,94208,32,94209,100343,1,100352,101119,1,101632,101640,1]));static Telugu=new N(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 N(new Uint32Array([1920,1969,1]));static Thai=new N(new Uint32Array([3585,3642,1,3648,3675,1]));static Tibetan=new N(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 N(new Uint32Array([11568,11623,1,11631,11632,1,11647,11647,1]));static Tirhuta=new N(new Uint32Array([70784,70855,1,70864,70873,1]));static Todhri=new N(new Uint32Array([67008,67059,1]));static Toto=new N(new Uint32Array([123536,123566,1]));static Tulu_Tigalari=new N(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 N(new Uint32Array([66432,66461,1,66463,66463,1]));static Vai=new N(new Uint32Array([42240,42539,1]));static Vithkuqi=new N(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 N(new Uint32Array([123584,123641,1,123647,123647,1]));static Warang_Citi=new N(new Uint32Array([71840,71922,1,71935,71935,1]));static Yezidi=new N(new Uint32Array([69248,69289,1,69291,69293,1,69296,69297,1]));static Yi=new N(new Uint32Array([40960,42124,1,42128,42182,1]));static Zanabazar_Square=new N(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 N(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]))},ue=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),o=t.getLo(i),a=t.getHi(i);if(o<=n&&n<=a){let l=t.getStride(i);return(n-o)%l===0}n<o?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 o=t.getStride(r);return(n-i)%o===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(fn.Upper,t)}static isPrint(t){return t<=this.MAX_LATIN1?t>=32&&t<this.MAX_ASCII||t>=161&&t!==173:this.is(fn.Print,t)}static simpleFold(t){if(fn.CASE_ORBIT.has(t))return fn.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}},Te=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(ue.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(`
166
- `)&&(r|=this.EMPTY_END_LINE),this.isWordRune(t)!==this.isWordRune(n)?r|=this.EMPTY_WORD_BOUNDARY:r|=this.EMPTY_NO_WORD_BOUNDARY,r}static quoteMeta(t){return t.split("").map(n=>this.METACHARACTERS.indexOf(n)>=0?`\\${n}`:n).join("")}static charCount(t){return t>ue.MAX_BMP?2:1}static stringToUtf8ByteArray(t){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(t));{let n=[],r=0;for(let s=0;s<t.length;s++){let i=t.charCodeAt(s);i<128?n[r++]=i:i<2048?(n[r++]=i>>6|192,n[r++]=i&63|128):(i&64512)===55296&&s+1<t.length&&(t.charCodeAt(s+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++s)&1023),n[r++]=i>>18|240,n[r++]=i>>12&63|128,n[r++]=i>>6&63|128,n[r++]=i&63|128):(n[r++]=i>>12|224,n[r++]=i>>6&63|128,n[r++]=i&63|128)}return n}}static utf8ByteArrayToString(t){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array(t));{let n=[],r=0,s=0;for(;r<t.length;){let i=t[r++];if(i<128)n[s++]=String.fromCharCode(i);else if(i>191&&i<224){let o=t[r++];n[s++]=String.fromCharCode((i&31)<<6|o&63)}else if(i>239&&i<365){let o=t[r++],a=t[r++],l=t[r++],c=((i&7)<<18|(o&63)<<12|(a&63)<<6|l&63)-65536;n[s++]=String.fromCharCode(55296+(c>>10)),n[s++]=String.fromCharCode(56320+(c&1023))}else{let o=t[r++],a=t[r++];n[s++]=String.fromCharCode((i&15)<<12|(o&63)<<6|a&63)}}return n.join("")}}},ep=(e=[],t=0)=>{let n={};for(let r=0;r<e.length;r++){let s=e[r],i=t+r;n[s]=i,n[i]=s}return Object.freeze(n)},lr=class e{static Encoding=ep(["UTF_16","UTF_8"]);getEncoding(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===e.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===e.Encoding.UTF_16}},Vi=class extends lr{constructor(t=null){super(),this.bytes=t}getEncoding(){return lr.Encoding.UTF_8}asCharSequence(){return Te.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},el=class extends lr{constructor(t=null){super(),this.charSequence=t}getEncoding(){return lr.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split("").map(t=>t.codePointAt(0))}length(){return this.charSequence.length}},ls=class{static utf16(t){return new el(t)}static utf8(t){return Array.isArray(t)?new Vi(t):new Vi(Te.stringToUtf8ByteArray(t))}},Un=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},tl=class extends Un{constructor(t,n=0,r=t.length){super(),this.bytes=t,this.start=n,this.end=r}step(t){if(t+=this.start,t>=this.end)return Un.EOF();let n=this.bytes[t++]&255;return(n&128)===0?n<<3|1:(n&224)===192?(n=n&31,t>=this.end?Un.EOF():(n=n<<6|this.bytes[t++]&63,n<<3|2)):(n&240)===224?(n=n&15,t+1>=this.end?Un.EOF():(n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n<<3|3)):(n=n&7,t+2>=this.end?Un.EOF():(n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n<<3|4))}index(t,n){n+=this.start;let r=this.indexOf(this.bytes,t.prefixUTF8,n);return r<0?r:r-n}context(t){t+=this.start;let n=-1;if(t>this.start&&t<=this.end){let s=t-1;if(n=this.bytes[s--],n>=128){let i=t-4;for(i<this.start&&(i=this.start);s>=i&&(this.bytes[s]&192)===128;)s--;s<this.start&&(s=this.start),n=this.step(s)>>3}}let r=t<this.end?this.step(t)>>3:-1;return Te.emptyOpContext(n,r)}indexOf(t,n,r=0){let s=n.length;if(s===0)return-1;let i=t.length;for(let o=r;o<=i-s;o++)for(let a=0;a<s&&t[o+a]===n[a];a++)if(a===s-1)return o;return-1}},nl=class extends Un{constructor(t,n=0,r=t.length){super(),this.charSequence=t,this.start=n,this.end=r}step(t){if(t+=this.start,t<this.end){let n=this.charSequence.codePointAt(t);return n<<3|Te.charCount(n)}else return Un.EOF()}index(t,n){n+=this.start;let r=this.charSequence.indexOf(t.prefix,n);return r<0?r:r-n}context(t){t+=this.start;let n=t>0&&t<=this.charSequence.length?this.charSequence.codePointAt(t-1):-1,r=t<this.charSequence.length?this.charSequence.codePointAt(t):-1;return Te.emptyOpContext(n,r)}},Ye=class{static fromUTF8(t,n=0,r=t.length){return new tl(t,n,r)}static fromUTF16(t,n=0,r=t.length){return new nl(t,n,r)}},cs=class extends Error{constructor(t){super(t),this.name="RE2JSException"}},je=class extends cs{constructor(t,n=null){let r=`error parsing regexp: ${t}`;n&&(r+=`: \`${n}\``),super(r),this.name="RE2JSSyntaxException",this.message=r,this.error=t,this.input=n}getDescription(){return this.error}getPattern(){return this.input}},rl=class extends cs{constructor(t){super(t),this.name="RE2JSCompileException"}},An=class extends cs{constructor(t){super(t),this.name="RE2JSGroupException"}},sl=class extends cs{constructor(t){super(t),this.name="RE2JSFlagsException"}},qi=class{static quoteReplacement(t,n=!1){return n?t.indexOf("\\")<0&&t.indexOf("$")<0?t:t.split("").map(r=>{let s=r.codePointAt(0);return s===D.CODES.get("\\")||s===D.CODES.get("$")?`\\${r}`:r}).join(""):t.indexOf("$")<0?t:t.split("").map(r=>r.codePointAt(0)===D.CODES.get("$")?"$$":r).join("")}constructor(t,n){if(t===null)throw new Error("pattern is null");this.patternInput=t;let r=this.patternInput.re2();this.patternGroupCount=r.numberOfCapturingGroups(),this.groups=[],this.namedGroups=r.namedGroups,this.numberOfInstructions=r.numberOfInstructions(),n instanceof lr?this.resetMatcherInput(n):Array.isArray(n)?this.resetMatcherInput(ls.utf8(n)):this.resetMatcherInput(ls.utf16(n))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(t){if(t===null)throw new Error("input is null");return this.matcherInput=t,this.reset(),this}start(t=0){if(typeof t=="string"){let n=this.namedGroups[t];if(!Number.isFinite(n))throw new An(`group '${t}' not found`);t=n}return this.loadGroup(t),this.groups[2*t]}end(t=0){if(typeof t=="string"){let n=this.namedGroups[t];if(!Number.isFinite(n))throw new An(`group '${t}' not found`);t=n}return this.loadGroup(t),this.groups[2*t+1]}programSize(){return this.numberOfInstructions}group(t=0){if(typeof t=="string"){let s=this.namedGroups[t];if(!Number.isFinite(s))throw new An(`group '${t}' not found`);t=s}let n=this.start(t),r=this.end(t);return n<0&&r<0?null:this.substring(n,r)}groupCount(){return this.patternGroupCount}loadGroup(t){if(t<0||t>this.patternGroupCount)throw new An(`Group index out of bounds: ${t}`);if(!this.hasMatch)throw new An("perhaps no match attempted");if(t===0||this.hasGroups)return;let n=this.groups[1]+1;n>this.matcherInputLength&&(n=this.matcherInputLength);let r=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],n,this.anchorFlag,1+this.patternGroupCount);if(!r[0])throw new An("inconsistency in matching group data");this.groups=r[1],this.hasGroups=!0}matches(){return this.genMatch(0,G.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,G.ANCHOR_START)}find(t=null){if(t!==null){if(t<0||t>this.matcherInputLength)throw new An(`start index out of bounds: ${t}`);return this.reset(),this.genMatch(t,0)}return t=0,this.hasMatch&&(t=this.groups[1],this.groups[0]===this.groups[1]&&t++),this.genMatch(t,G.UNANCHORED)}genMatch(t,n){let r=this.patternInput.re2().matchMachineInput(this.matcherInput,t,this.matcherInputLength,n,1);return r[0]?(this.groups=r[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=n,!0):!1}substring(t,n){return this.matcherInput.isUTF8Encoding()?Te.utf8ByteArrayToString(this.matcherInput.asBytes().slice(t,n)):this.matcherInput.asCharSequence().substring(t,n).toString()}inputLength(){return this.matcherInputLength}appendReplacement(t,n=!1){let r="",s=this.start(),i=this.end();return this.appendPos<s&&(r+=this.substring(this.appendPos,s)),this.appendPos=i,r+=n?this.appendReplacementInternalJava(t):this.appendReplacementInternalJs(t),r}appendReplacementInternalJava(t){let n="",r=0,s=t.length;for(let i=0;i<s-1;i++){if(t.codePointAt(i)===D.CODES.get("\\")){r<i&&(n+=t.substring(r,i)),i++,r=i;continue}if(t.codePointAt(i)===D.CODES.get("$")){let o=t.codePointAt(i+1);if(D.CODES.get("0")<=o&&o<=D.CODES.get("9")){let a=o-D.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<D.CODES.get("0")||o>D.CODES.get("9")||a*10+o-D.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-D.CODES.get("0");if(a>this.patternGroupCount)throw new An(`n > number of groups: ${a}`);let l=this.group(a);l!==null&&(n+=l),r=i,i--;continue}else if(o===D.CODES.get("{")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==D.CODES.get("}")&&t.codePointAt(a)!==D.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==D.CODES.get("}"))throw new An("named capture group is missing trailing '}'");let l=t.substring(i+1,a);n+=this.group(l),r=a+1}}}return r<s&&(n+=t.substring(r,s)),n}appendReplacementInternalJs(t){let n="",r=0,s=t.length;for(let i=0;i<s-1;i++)if(t.codePointAt(i)===D.CODES.get("$")){let o=t.codePointAt(i+1);if(D.CODES.get("$")===o){r<i&&(n+=t.substring(r,i)),n+="$",i++,r=i+1;continue}else if(D.CODES.get("&")===o){r<i&&(n+=t.substring(r,i));let a=this.group(0);a!==null?n+=a:n+="$&",i++,r=i+1;continue}else if(D.CODES.get("1")<=o&&o<=D.CODES.get("9")){let a=o-D.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<D.CODES.get("0")||o>D.CODES.get("9")||a*10+o-D.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-D.CODES.get("0");if(a>this.patternGroupCount){n+=`$${a}`,r=i,i--;continue}let l=this.group(a);l!==null&&(n+=l),r=i,i--;continue}else if(o===D.CODES.get("<")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==D.CODES.get(">")&&t.codePointAt(a)!==D.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==D.CODES.get(">")){n+=t.substring(i-1,a+1),r=a+1;continue}let l=t.substring(i+1,a);Object.prototype.hasOwnProperty.call(this.namedGroups,l)?n+=this.group(l):n+=`$<${l}>`,r=a+1}}return r<s&&(n+=t.substring(r,s)),n}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(t,n=!1){return this.replace(t,!0,n)}replaceFirst(t,n=!1){return this.replace(t,!1,n)}replace(t,n=!0,r=!1){let s="";for(this.reset();this.find()&&(s+=this.appendReplacement(t,r),!!n););return s+=this.appendTail(),s}},de=class e{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static isRuneOp(t){return e.RUNE<=t&&t<=e.RUNE_ANY_NOT_NL}static escapeRunes(t){let n='"';for(let r of t)n+=Te.escapeRune(r);return n+='"',n}constructor(t){this.op=t,this.out=0,this.arg=0,this.runes=[]}matchRune(t){if(this.runes.length===1){let s=this.runes[0];return(this.arg&G.FOLD_CASE)!==0?ue.equalsIgnoreCase(s,t):t===s}for(let s=0;s<this.runes.length&&s<=8;s+=2){if(t<this.runes[s])return!1;if(t<=this.runes[s+1])return!0}let n=0,r=this.runes.length/2|0;for(;n<r;){let s=n+((r-n)/2|0);if(this.runes[2*s]<=t){if(t<=this.runes[2*s+1])return!0;n=s+1}else r=s}return!1}toString(){switch(this.op){case e.ALT:return`alt -> ${this.out}, ${this.arg}`;case e.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case e.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case e.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case e.MATCH:return"match";case e.FAIL:return"fail";case e.NOP:return`nop -> ${this.out}`;case e.RUNE:return this.runes===null?"rune <null>":["rune ",e.escapeRunes(this.runes),(this.arg&G.FOLD_CASE)!==0?"/i":""," -> ",this.out].join("");case e.RUNE1:return`rune1 ${e.escapeRunes(this.runes)} -> ${this.out}`;case e.RUNE_ANY:return`any -> ${this.out}`;case e.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}},il=class{constructor(){this.inst=null,this.cap=[]}},Zi=class{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(t){let n=this.sparse[t];return n<this.size&&this.densePcs[n]===t}isEmpty(){return this.size===0}add(t){let n=this.size++;return this.sparse[t]=n,this.denseThreads[n]=null,this.densePcs[n]=t,n}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let t="{";for(let n=0;n<this.size;n++)n!==0&&(t+=", "),t+=this.densePcs[n];return t+="}",t}},Qs=class e{static fromRE2(t){let n=new e;return n.prog=t.prog,n.re2=t,n.q0=new Zi(n.prog.numInst()),n.q1=new Zi(n.prog.numInst()),n.pool=[],n.poolSize=0,n.matched=!1,n.matchcap=Array(n.prog.numCap<2?2:n.prog.numCap).fill(0),n.ncap=0,n}static fromMachine(t){let n=new e;return n.re2=t.re2,n.prog=t.prog,n.q0=t.q0,n.q1=t.q1,n.pool=t.pool,n.poolSize=t.poolSize,n.matched=t.matched,n.matchcap=t.matchcap,n.ncap=t.ncap,n}init(t){this.ncap=t,t>this.matchcap.length?this.initNewCap(t):this.resetCap(t)}resetCap(t){for(let n=0;n<this.poolSize;n++){let r=this.pool[n];r.cap=Array(t).fill(0)}}initNewCap(t){for(let n=0;n<this.poolSize;n++){let r=this.pool[n];r.cap=Array(t).fill(0)}this.matchcap=Array(t).fill(0)}submatches(){return this.ncap===0?Te.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(t){let n;return this.poolSize>0?(this.poolSize--,n=this.pool[this.poolSize]):n=new il,n.inst=t,n}freeQueue(t,n=0){let r=t.size-n,s=this.poolSize+r;this.pool.length<s&&(this.pool=this.pool.slice(0,Math.max(this.pool.length*2,s)));for(let i=n;i<t.size;i++){let o=t.denseThreads[i];o!==null&&(this.pool[this.poolSize]=o,this.poolSize++)}t.clear()}freeThread(t){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,this.pool.length*2)),this.pool[this.poolSize]=t,this.poolSize++}match(t,n,r){let s=this.re2.cond;if(s===Te.EMPTY_ALL||(r===G.ANCHOR_START||r===G.ANCHOR_BOTH)&&n!==0)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let i=this.q0,o=this.q1,a=t.step(n),l=a>>3,c=a&7,u=-1,f=0;a!==Un.EOF()&&(a=t.step(n+c),u=a>>3,f=a&7);let p;for(n===0?p=Te.emptyOpContext(-1,l):p=t.context(n);;){if(i.isEmpty()){if((s&Te.EMPTY_BEGIN_TEXT)!==0&&n!==0||this.matched)break;if(this.re2.prefix.length!==0&&u!==this.re2.prefixRune&&t.canCheckPrefix()){let m=t.index(this.re2,n);if(m<0)break;n+=m,a=t.step(n),l=a>>3,c=a&7,a=t.step(n+c),u=a>>3,f=a&7}}!this.matched&&(n===0||r===G.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=n),this.add(i,this.prog.start,n,this.matchcap,p,null));let h=n+c;if(p=t.context(h),this.step(i,o,n,h,l,p,r,n===t.endPos()),c===0||this.ncap===0&&this.matched)break;n+=c,l=u,c=f,l!==-1&&(a=t.step(n+c),u=a>>3,f=a&7);let d=i;i=o,o=d}return this.freeQueue(o),this.matched}step(t,n,r,s,i,o,a,l){let c=this.re2.longest;for(let u=0;u<t.size;u++){let f=t.denseThreads[u];if(f===null)continue;if(c&&this.matched&&this.ncap>0&&this.matchcap[0]<f.cap[0]){this.freeThread(f);continue}let p=f.inst,h=!1;switch(p.op){case de.MATCH:if(a===G.ANCHOR_BOTH&&!l)break;this.ncap>0&&(!c||!this.matched||this.matchcap[1]<r)&&(f.cap[1]=r,this.matchcap=f.cap.slice(0,this.ncap)),c||this.freeQueue(t,u+1),this.matched=!0;break;case de.RUNE:h=p.matchRune(i);break;case de.RUNE1:h=i===p.runes[0];break;case de.RUNE_ANY:h=!0;break;case de.RUNE_ANY_NOT_NL:h=i!==D.CODES.get(`
166
+ `)&&(r|=this.EMPTY_END_LINE),this.isWordRune(t)!==this.isWordRune(n)?r|=this.EMPTY_WORD_BOUNDARY:r|=this.EMPTY_NO_WORD_BOUNDARY,r}static quoteMeta(t){return t.split("").map(n=>this.METACHARACTERS.indexOf(n)>=0?`\\${n}`:n).join("")}static charCount(t){return t>ue.MAX_BMP?2:1}static stringToUtf8ByteArray(t){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(t));{let n=[],r=0;for(let s=0;s<t.length;s++){let i=t.charCodeAt(s);i<128?n[r++]=i:i<2048?(n[r++]=i>>6|192,n[r++]=i&63|128):(i&64512)===55296&&s+1<t.length&&(t.charCodeAt(s+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++s)&1023),n[r++]=i>>18|240,n[r++]=i>>12&63|128,n[r++]=i>>6&63|128,n[r++]=i&63|128):(n[r++]=i>>12|224,n[r++]=i>>6&63|128,n[r++]=i&63|128)}return n}}static utf8ByteArrayToString(t){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array(t));{let n=[],r=0,s=0;for(;r<t.length;){let i=t[r++];if(i<128)n[s++]=String.fromCharCode(i);else if(i>191&&i<224){let o=t[r++];n[s++]=String.fromCharCode((i&31)<<6|o&63)}else if(i>239&&i<365){let o=t[r++],a=t[r++],l=t[r++],c=((i&7)<<18|(o&63)<<12|(a&63)<<6|l&63)-65536;n[s++]=String.fromCharCode(55296+(c>>10)),n[s++]=String.fromCharCode(56320+(c&1023))}else{let o=t[r++],a=t[r++];n[s++]=String.fromCharCode((i&15)<<12|(o&63)<<6|a&63)}}return n.join("")}}},ep=(e=[],t=0)=>{let n={};for(let r=0;r<e.length;r++){let s=e[r],i=t+r;n[s]=i,n[i]=s}return Object.freeze(n)},lr=class e{static Encoding=ep(["UTF_16","UTF_8"]);getEncoding(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===e.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===e.Encoding.UTF_16}},Vi=class extends lr{constructor(t=null){super(),this.bytes=t}getEncoding(){return lr.Encoding.UTF_8}asCharSequence(){return Te.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},el=class extends lr{constructor(t=null){super(),this.charSequence=t}getEncoding(){return lr.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split("").map(t=>t.codePointAt(0))}length(){return this.charSequence.length}},ls=class{static utf16(t){return new el(t)}static utf8(t){return Array.isArray(t)?new Vi(t):new Vi(Te.stringToUtf8ByteArray(t))}},Bn=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},tl=class extends Bn{constructor(t,n=0,r=t.length){super(),this.bytes=t,this.start=n,this.end=r}step(t){if(t+=this.start,t>=this.end)return Bn.EOF();let n=this.bytes[t++]&255;return(n&128)===0?n<<3|1:(n&224)===192?(n=n&31,t>=this.end?Bn.EOF():(n=n<<6|this.bytes[t++]&63,n<<3|2)):(n&240)===224?(n=n&15,t+1>=this.end?Bn.EOF():(n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n<<3|3)):(n=n&7,t+2>=this.end?Bn.EOF():(n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n<<3|4))}index(t,n){n+=this.start;let r=this.indexOf(this.bytes,t.prefixUTF8,n);return r<0?r:r-n}context(t){t+=this.start;let n=-1;if(t>this.start&&t<=this.end){let s=t-1;if(n=this.bytes[s--],n>=128){let i=t-4;for(i<this.start&&(i=this.start);s>=i&&(this.bytes[s]&192)===128;)s--;s<this.start&&(s=this.start),n=this.step(s)>>3}}let r=t<this.end?this.step(t)>>3:-1;return Te.emptyOpContext(n,r)}indexOf(t,n,r=0){let s=n.length;if(s===0)return-1;let i=t.length;for(let o=r;o<=i-s;o++)for(let a=0;a<s&&t[o+a]===n[a];a++)if(a===s-1)return o;return-1}},nl=class extends Bn{constructor(t,n=0,r=t.length){super(),this.charSequence=t,this.start=n,this.end=r}step(t){if(t+=this.start,t<this.end){let n=this.charSequence.codePointAt(t);return n<<3|Te.charCount(n)}else return Bn.EOF()}index(t,n){n+=this.start;let r=this.charSequence.indexOf(t.prefix,n);return r<0?r:r-n}context(t){t+=this.start;let n=t>0&&t<=this.charSequence.length?this.charSequence.codePointAt(t-1):-1,r=t<this.charSequence.length?this.charSequence.codePointAt(t):-1;return Te.emptyOpContext(n,r)}},Ye=class{static fromUTF8(t,n=0,r=t.length){return new tl(t,n,r)}static fromUTF16(t,n=0,r=t.length){return new nl(t,n,r)}},cs=class extends Error{constructor(t){super(t),this.name="RE2JSException"}},je=class extends cs{constructor(t,n=null){let r=`error parsing regexp: ${t}`;n&&(r+=`: \`${n}\``),super(r),this.name="RE2JSSyntaxException",this.message=r,this.error=t,this.input=n}getDescription(){return this.error}getPattern(){return this.input}},rl=class extends cs{constructor(t){super(t),this.name="RE2JSCompileException"}},An=class extends cs{constructor(t){super(t),this.name="RE2JSGroupException"}},sl=class extends cs{constructor(t){super(t),this.name="RE2JSFlagsException"}},qi=class{static quoteReplacement(t,n=!1){return n?t.indexOf("\\")<0&&t.indexOf("$")<0?t:t.split("").map(r=>{let s=r.codePointAt(0);return s===D.CODES.get("\\")||s===D.CODES.get("$")?`\\${r}`:r}).join(""):t.indexOf("$")<0?t:t.split("").map(r=>r.codePointAt(0)===D.CODES.get("$")?"$$":r).join("")}constructor(t,n){if(t===null)throw new Error("pattern is null");this.patternInput=t;let r=this.patternInput.re2();this.patternGroupCount=r.numberOfCapturingGroups(),this.groups=[],this.namedGroups=r.namedGroups,this.numberOfInstructions=r.numberOfInstructions(),n instanceof lr?this.resetMatcherInput(n):Array.isArray(n)?this.resetMatcherInput(ls.utf8(n)):this.resetMatcherInput(ls.utf16(n))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(t){if(t===null)throw new Error("input is null");return this.matcherInput=t,this.reset(),this}start(t=0){if(typeof t=="string"){let n=this.namedGroups[t];if(!Number.isFinite(n))throw new An(`group '${t}' not found`);t=n}return this.loadGroup(t),this.groups[2*t]}end(t=0){if(typeof t=="string"){let n=this.namedGroups[t];if(!Number.isFinite(n))throw new An(`group '${t}' not found`);t=n}return this.loadGroup(t),this.groups[2*t+1]}programSize(){return this.numberOfInstructions}group(t=0){if(typeof t=="string"){let s=this.namedGroups[t];if(!Number.isFinite(s))throw new An(`group '${t}' not found`);t=s}let n=this.start(t),r=this.end(t);return n<0&&r<0?null:this.substring(n,r)}groupCount(){return this.patternGroupCount}loadGroup(t){if(t<0||t>this.patternGroupCount)throw new An(`Group index out of bounds: ${t}`);if(!this.hasMatch)throw new An("perhaps no match attempted");if(t===0||this.hasGroups)return;let n=this.groups[1]+1;n>this.matcherInputLength&&(n=this.matcherInputLength);let r=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],n,this.anchorFlag,1+this.patternGroupCount);if(!r[0])throw new An("inconsistency in matching group data");this.groups=r[1],this.hasGroups=!0}matches(){return this.genMatch(0,G.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,G.ANCHOR_START)}find(t=null){if(t!==null){if(t<0||t>this.matcherInputLength)throw new An(`start index out of bounds: ${t}`);return this.reset(),this.genMatch(t,0)}return t=0,this.hasMatch&&(t=this.groups[1],this.groups[0]===this.groups[1]&&t++),this.genMatch(t,G.UNANCHORED)}genMatch(t,n){let r=this.patternInput.re2().matchMachineInput(this.matcherInput,t,this.matcherInputLength,n,1);return r[0]?(this.groups=r[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=n,!0):!1}substring(t,n){return this.matcherInput.isUTF8Encoding()?Te.utf8ByteArrayToString(this.matcherInput.asBytes().slice(t,n)):this.matcherInput.asCharSequence().substring(t,n).toString()}inputLength(){return this.matcherInputLength}appendReplacement(t,n=!1){let r="",s=this.start(),i=this.end();return this.appendPos<s&&(r+=this.substring(this.appendPos,s)),this.appendPos=i,r+=n?this.appendReplacementInternalJava(t):this.appendReplacementInternalJs(t),r}appendReplacementInternalJava(t){let n="",r=0,s=t.length;for(let i=0;i<s-1;i++){if(t.codePointAt(i)===D.CODES.get("\\")){r<i&&(n+=t.substring(r,i)),i++,r=i;continue}if(t.codePointAt(i)===D.CODES.get("$")){let o=t.codePointAt(i+1);if(D.CODES.get("0")<=o&&o<=D.CODES.get("9")){let a=o-D.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<D.CODES.get("0")||o>D.CODES.get("9")||a*10+o-D.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-D.CODES.get("0");if(a>this.patternGroupCount)throw new An(`n > number of groups: ${a}`);let l=this.group(a);l!==null&&(n+=l),r=i,i--;continue}else if(o===D.CODES.get("{")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==D.CODES.get("}")&&t.codePointAt(a)!==D.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==D.CODES.get("}"))throw new An("named capture group is missing trailing '}'");let l=t.substring(i+1,a);n+=this.group(l),r=a+1}}}return r<s&&(n+=t.substring(r,s)),n}appendReplacementInternalJs(t){let n="",r=0,s=t.length;for(let i=0;i<s-1;i++)if(t.codePointAt(i)===D.CODES.get("$")){let o=t.codePointAt(i+1);if(D.CODES.get("$")===o){r<i&&(n+=t.substring(r,i)),n+="$",i++,r=i+1;continue}else if(D.CODES.get("&")===o){r<i&&(n+=t.substring(r,i));let a=this.group(0);a!==null?n+=a:n+="$&",i++,r=i+1;continue}else if(D.CODES.get("1")<=o&&o<=D.CODES.get("9")){let a=o-D.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<D.CODES.get("0")||o>D.CODES.get("9")||a*10+o-D.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-D.CODES.get("0");if(a>this.patternGroupCount){n+=`$${a}`,r=i,i--;continue}let l=this.group(a);l!==null&&(n+=l),r=i,i--;continue}else if(o===D.CODES.get("<")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==D.CODES.get(">")&&t.codePointAt(a)!==D.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==D.CODES.get(">")){n+=t.substring(i-1,a+1),r=a+1;continue}let l=t.substring(i+1,a);Object.prototype.hasOwnProperty.call(this.namedGroups,l)?n+=this.group(l):n+=`$<${l}>`,r=a+1}}return r<s&&(n+=t.substring(r,s)),n}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(t,n=!1){return this.replace(t,!0,n)}replaceFirst(t,n=!1){return this.replace(t,!1,n)}replace(t,n=!0,r=!1){let s="";for(this.reset();this.find()&&(s+=this.appendReplacement(t,r),!!n););return s+=this.appendTail(),s}},de=class e{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static isRuneOp(t){return e.RUNE<=t&&t<=e.RUNE_ANY_NOT_NL}static escapeRunes(t){let n='"';for(let r of t)n+=Te.escapeRune(r);return n+='"',n}constructor(t){this.op=t,this.out=0,this.arg=0,this.runes=[]}matchRune(t){if(this.runes.length===1){let s=this.runes[0];return(this.arg&G.FOLD_CASE)!==0?ue.equalsIgnoreCase(s,t):t===s}for(let s=0;s<this.runes.length&&s<=8;s+=2){if(t<this.runes[s])return!1;if(t<=this.runes[s+1])return!0}let n=0,r=this.runes.length/2|0;for(;n<r;){let s=n+((r-n)/2|0);if(this.runes[2*s]<=t){if(t<=this.runes[2*s+1])return!0;n=s+1}else r=s}return!1}toString(){switch(this.op){case e.ALT:return`alt -> ${this.out}, ${this.arg}`;case e.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case e.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case e.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case e.MATCH:return"match";case e.FAIL:return"fail";case e.NOP:return`nop -> ${this.out}`;case e.RUNE:return this.runes===null?"rune <null>":["rune ",e.escapeRunes(this.runes),(this.arg&G.FOLD_CASE)!==0?"/i":""," -> ",this.out].join("");case e.RUNE1:return`rune1 ${e.escapeRunes(this.runes)} -> ${this.out}`;case e.RUNE_ANY:return`any -> ${this.out}`;case e.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}},il=class{constructor(){this.inst=null,this.cap=[]}},Zi=class{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(t){let n=this.sparse[t];return n<this.size&&this.densePcs[n]===t}isEmpty(){return this.size===0}add(t){let n=this.size++;return this.sparse[t]=n,this.denseThreads[n]=null,this.densePcs[n]=t,n}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let t="{";for(let n=0;n<this.size;n++)n!==0&&(t+=", "),t+=this.densePcs[n];return t+="}",t}},Qs=class e{static fromRE2(t){let n=new e;return n.prog=t.prog,n.re2=t,n.q0=new Zi(n.prog.numInst()),n.q1=new Zi(n.prog.numInst()),n.pool=[],n.poolSize=0,n.matched=!1,n.matchcap=Array(n.prog.numCap<2?2:n.prog.numCap).fill(0),n.ncap=0,n}static fromMachine(t){let n=new e;return n.re2=t.re2,n.prog=t.prog,n.q0=t.q0,n.q1=t.q1,n.pool=t.pool,n.poolSize=t.poolSize,n.matched=t.matched,n.matchcap=t.matchcap,n.ncap=t.ncap,n}init(t){this.ncap=t,t>this.matchcap.length?this.initNewCap(t):this.resetCap(t)}resetCap(t){for(let n=0;n<this.poolSize;n++){let r=this.pool[n];r.cap=Array(t).fill(0)}}initNewCap(t){for(let n=0;n<this.poolSize;n++){let r=this.pool[n];r.cap=Array(t).fill(0)}this.matchcap=Array(t).fill(0)}submatches(){return this.ncap===0?Te.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(t){let n;return this.poolSize>0?(this.poolSize--,n=this.pool[this.poolSize]):n=new il,n.inst=t,n}freeQueue(t,n=0){let r=t.size-n,s=this.poolSize+r;this.pool.length<s&&(this.pool=this.pool.slice(0,Math.max(this.pool.length*2,s)));for(let i=n;i<t.size;i++){let o=t.denseThreads[i];o!==null&&(this.pool[this.poolSize]=o,this.poolSize++)}t.clear()}freeThread(t){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,this.pool.length*2)),this.pool[this.poolSize]=t,this.poolSize++}match(t,n,r){let s=this.re2.cond;if(s===Te.EMPTY_ALL||(r===G.ANCHOR_START||r===G.ANCHOR_BOTH)&&n!==0)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let i=this.q0,o=this.q1,a=t.step(n),l=a>>3,c=a&7,u=-1,f=0;a!==Bn.EOF()&&(a=t.step(n+c),u=a>>3,f=a&7);let p;for(n===0?p=Te.emptyOpContext(-1,l):p=t.context(n);;){if(i.isEmpty()){if((s&Te.EMPTY_BEGIN_TEXT)!==0&&n!==0||this.matched)break;if(this.re2.prefix.length!==0&&u!==this.re2.prefixRune&&t.canCheckPrefix()){let m=t.index(this.re2,n);if(m<0)break;n+=m,a=t.step(n),l=a>>3,c=a&7,a=t.step(n+c),u=a>>3,f=a&7}}!this.matched&&(n===0||r===G.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=n),this.add(i,this.prog.start,n,this.matchcap,p,null));let h=n+c;if(p=t.context(h),this.step(i,o,n,h,l,p,r,n===t.endPos()),c===0||this.ncap===0&&this.matched)break;n+=c,l=u,c=f,l!==-1&&(a=t.step(n+c),u=a>>3,f=a&7);let d=i;i=o,o=d}return this.freeQueue(o),this.matched}step(t,n,r,s,i,o,a,l){let c=this.re2.longest;for(let u=0;u<t.size;u++){let f=t.denseThreads[u];if(f===null)continue;if(c&&this.matched&&this.ncap>0&&this.matchcap[0]<f.cap[0]){this.freeThread(f);continue}let p=f.inst,h=!1;switch(p.op){case de.MATCH:if(a===G.ANCHOR_BOTH&&!l)break;this.ncap>0&&(!c||!this.matched||this.matchcap[1]<r)&&(f.cap[1]=r,this.matchcap=f.cap.slice(0,this.ncap)),c||this.freeQueue(t,u+1),this.matched=!0;break;case de.RUNE:h=p.matchRune(i);break;case de.RUNE1:h=i===p.runes[0];break;case de.RUNE_ANY:h=!0;break;case de.RUNE_ANY_NOT_NL:h=i!==D.CODES.get(`
167
167
  `);break;default:throw new Error("bad inst")}h&&(f=this.add(n,p.out,s,f.cap,o,f)),f!==null&&(this.freeThread(f),t.denseThreads[u]=null)}t.clear()}add(t,n,r,s,i,o){if(n===0||t.contains(n))return o;let a=t.add(n),l=this.prog.inst[n];switch(l.op){case de.FAIL:break;case de.ALT:case de.ALT_MATCH:o=this.add(t,l.out,r,s,i,o),o=this.add(t,l.arg,r,s,i,o);break;case de.EMPTY_WIDTH:(l.arg&~i)===0&&(o=this.add(t,l.out,r,s,i,o));break;case de.NOP:o=this.add(t,l.out,r,s,i,o);break;case de.CAPTURE:if(l.arg<this.ncap){let c=s[l.arg];s[l.arg]=r,this.add(t,l.out,r,s,i,null),s[l.arg]=c}else o=this.add(t,l.out,r,s,i,o);break;case de.MATCH:case de.RUNE:case de.RUNE1:case de.RUNE_ANY:case de.RUNE_ANY_NOT_NL:o===null?o=this.alloc(l):o.inst=l,this.ncap>0&&o.cap!==s&&(o.cap=s.slice(0,this.ncap)),t.denseThreads[a]=o,o=null;break;default:throw new Error("unhandled")}return o}},R3=e=>{let t=-2128831035;for(let n=0;n<e.length;n++)t^=e[n],t=Math.imul(t,16777619);return t},P3=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},ol=class{constructor(t,n){this.nfaStates=t,this.isMatch=n,this.nextAscii=new Array(ue.MAX_ASCII+1).fill(null),this.nextMap=new Map}},al=class{constructor(t){this.prog=t,this.stateCache=new Map,this.stateCount=0,this.startState=null,this.stateLimit=1e4}computeClosure(t){let n=new Set,r=[...t],s=!1;for(;r.length>0;){let o=r.pop();if(n.has(o))continue;n.add(o);let a=this.prog.getInst(o);switch(a.op){case de.MATCH:s=!0;break;case de.ALT:case de.ALT_MATCH:r.push(a.out),r.push(a.arg);break;case de.NOP:case de.CAPTURE:r.push(a.out);break;case de.EMPTY_WIDTH:return null}}return{pcs:Int32Array.from(n).sort(),isMatch:s}}getState(t){let n=this.computeClosure(t);if(!n)return null;let r=n.pcs,s=R3(r),i=this.stateCache.get(s);if(i)for(let a=0;a<i.length;a++){let l=i[a];if(P3(l.nfaStates,r))return l}else i=[],this.stateCache.set(s,i);if(this.stateCount>=this.stateLimit)return this.stateCache.clear(),this.stateCount=0,this.startState=null,null;let o=new ol(r,n.isMatch);return i.push(o),this.stateCount++,o}step(t,n,r){if(r===G.UNANCHORED&&n<=ue.MAX_ASCII){let o=t.nextAscii[n];if(o!==null)return o}else{let o=n+(r===G.UNANCHORED?0:ue.MAX_RUNE+1);if(t.nextMap.has(o))return t.nextMap.get(o)}let s=[];for(let o=0;o<t.nfaStates.length;o++){let a=t.nfaStates[o],l=this.prog.getInst(a);de.isRuneOp(l.op)&&l.matchRune(n)&&s.push(l.out)}r===G.UNANCHORED&&s.push(this.prog.start);let i=this.getState(s);if(r===G.UNANCHORED&&n<=ue.MAX_ASCII)t.nextAscii[n]=i;else{let o=n+(r===G.UNANCHORED?0:ue.MAX_RUNE+1);t.nextMap.set(o,i)}return i}match(t,n,r){if((r===G.ANCHOR_START||r===G.ANCHOR_BOTH)&&n!==0)return!1;if(!this.startState&&(this.startState=this.getState([this.prog.start]),!this.startState))return null;let s=t.endPos(),i=this.startState;if(i.isMatch)if(r===G.ANCHOR_BOTH){if(n===s)return!0}else return!0;let o=n;for(;o<s;){let a=t.step(o),l=a>>3,c=a&7;if(c===0)break;if(i=this.step(i,l,r),i===null)return null;if(i.isMatch)if(r===G.ANCHOR_BOTH){if(o+c===s)return!0}else return!0;if(i.nfaStates.length===0&&r!==G.UNANCHORED)return!1;o+=c}return!1}},F=class e{static Op=ep(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","LEFT_PAREN","VERTICAL_BAR"]);static isPseudoOp(t){return t>=e.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(t){return t===D.CODES.get("-")?"\\":""}static fromRegexp(t){let n=new e(t.op);return n.flags=t.flags,n.subs=t.subs,n.runes=t.runes,n.cap=t.cap,n.min=t.min,n.max=t.max,n.name=t.name,n.namedGroups=t.namedGroups,n}constructor(t){this.op=t,this.flags=0,this.subs=e.emptySubs(),this.runes=[],this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=e.emptySubs(),this.runes=[],this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let t="";switch(this.op){case e.Op.NO_MATCH:t+="[^\\x00-\\x{10FFFF}]";break;case e.Op.EMPTY_MATCH:t+="(?:)";break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:case e.Op.REPEAT:{let n=this.subs[0];switch(n.op>e.Op.CAPTURE||n.op===e.Op.LITERAL&&n.runes.length>1?t+=`(?:${n.appendTo()})`:t+=n.appendTo(),this.op){case e.Op.STAR:t+="*";break;case e.Op.PLUS:t+="+";break;case e.Op.QUEST:t+="?";break;case e.Op.REPEAT:t+=`{${this.min}`,this.min!==this.max&&(t+=",",this.max>=0&&(t+=this.max)),t+="}";break}(this.flags&G.NON_GREEDY)!==0&&(t+="?");break}case e.Op.CONCAT:{for(let n of this.subs)n.op===e.Op.ALTERNATE?t+=`(?:${n.appendTo()})`:t+=n.appendTo();break}case e.Op.ALTERNATE:{let n="";for(let r of this.subs)t+=n,n="|",t+=r.appendTo();break}case e.Op.LITERAL:(this.flags&G.FOLD_CASE)!==0&&(t+="(?i:");for(let n of this.runes)t+=Te.escapeRune(n);(this.flags&G.FOLD_CASE)!==0&&(t+=")");break;case e.Op.ANY_CHAR_NOT_NL:t+="(?-s:.)";break;case e.Op.ANY_CHAR:t+="(?s:.)";break;case e.Op.CAPTURE:this.name===null||this.name.length===0?t+="(":t+=`(?P<${this.name}>`,this.subs[0].op!==e.Op.EMPTY_MATCH&&(t+=this.subs[0].appendTo()),t+=")";break;case e.Op.BEGIN_TEXT:t+="\\A";break;case e.Op.END_TEXT:(this.flags&G.WAS_DOLLAR)!==0?t+="(?-m:$)":t+="\\z";break;case e.Op.BEGIN_LINE:t+="^";break;case e.Op.END_LINE:t+="$";break;case e.Op.WORD_BOUNDARY:t+="\\b";break;case e.Op.NO_WORD_BOUNDARY:t+="\\B";break;case e.Op.CHAR_CLASS:if(this.runes.length%2!==0){t+="[invalid char class]";break}if(t+="[",this.runes.length===0)t+="^\\x00-\\x{10FFFF}";else if(this.runes[0]===0&&this.runes[this.runes.length-1]===ue.MAX_RUNE){t+="^";for(let n=1;n<this.runes.length-1;n+=2){let r=this.runes[n]+1,s=this.runes[n+1]-1;t+=e.quoteIfHyphen(r),t+=Te.escapeRune(r),r!==s&&(t+="-",t+=e.quoteIfHyphen(s),t+=Te.escapeRune(s))}}else for(let n=0;n<this.runes.length;n+=2){let r=this.runes[n],s=this.runes[n+1];t+=e.quoteIfHyphen(r),t+=Te.escapeRune(r),r!==s&&(t+="-",t+=e.quoteIfHyphen(s),t+=Te.escapeRune(s))}t+="]";break;default:t+=this.op;break}return t}maxCap(){let t=0;if(this.op===e.Op.CAPTURE&&(t=this.cap),this.subs!==null)for(let n of this.subs){let r=n.maxCap();t<r&&(t=r)}return t}equals(t){if(!(t!==null&&t instanceof e)||this.op!==t.op)return!1;switch(this.op){case e.Op.END_TEXT:{if((this.flags&G.WAS_DOLLAR)!==(t.flags&G.WAS_DOLLAR))return!1;break}case e.Op.LITERAL:case e.Op.CHAR_CLASS:{if(this.runes===null&&t.runes===null)break;if(this.runes===null||t.runes===null||this.runes.length!==t.runes.length)return!1;for(let n=0;n<this.runes.length;n++)if(this.runes[n]!==t.runes[n])return!1;break}case e.Op.ALTERNATE:case e.Op.CONCAT:{if(this.subs.length!==t.subs.length)return!1;for(let n=0;n<this.subs.length;++n)if(!this.subs[n].equals(t.subs[n]))return!1;break}case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:{if((this.flags&G.NON_GREEDY)!==(t.flags&G.NON_GREEDY)||!this.subs[0].equals(t.subs[0]))return!1;break}case e.Op.REPEAT:{if((this.flags&G.NON_GREEDY)!==(t.flags&G.NON_GREEDY)||this.min!==t.min||this.max!==t.max||!this.subs[0].equals(t.subs[0]))return!1;break}case e.Op.CAPTURE:{if(this.cap!==t.cap||(this.name===null?t.name!==null:this.name!==t.name)||!this.subs[0].equals(t.subs[0]))return!1;break}}return!0}},ll=class{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(t){return this.inst[t]}numInst(){return this.inst.length}addInst(t){this.inst.push(new de(t))}skipNop(t){let n=this.inst[t];for(;n.op===de.NOP||n.op===de.CAPTURE;)n=this.inst[t],t=n.out;return n}prefix(){let t="",n=this.skipNop(this.start);if(!de.isRuneOp(n.op)||n.runes.length!==1)return[n.op===de.MATCH,t];for(;de.isRuneOp(n.op)&&n.runes.length===1&&(n.arg&G.FOLD_CASE)===0;)t+=String.fromCodePoint(n.runes[0]),n=this.skipNop(n.out);return[n.op===de.MATCH,t]}startCond(){let t=0,n=this.start;e:for(;;){let r=this.inst[n];switch(r.op){case de.EMPTY_WIDTH:t|=r.arg;break;case de.FAIL:return-1;case de.CAPTURE:case de.NOP:break;default:break e}n=r.out}return t}next(t){let n=this.inst[t>>1];return(t&1)===0?n.out:n.arg}patch(t,n){for(;t!==0;){let r=this.inst[t>>1];(t&1)===0?(t=r.out,r.out=n):(t=r.arg,r.arg=n)}}append(t,n){if(t===0)return n;if(n===0)return t;let r=t;for(;;){let i=this.next(r);if(i===0)break;r=i}let s=this.inst[r>>1];return(r&1)===0?s.out=n:s.arg=n,t}toString(){let t="";for(let n=0;n<this.inst.length;n++){let r=t.length;t+=n,n===this.start&&(t+="*"),t+=" ".substring(t.length-r),t+=this.inst[n],t+=`
168
168
  `}return t}},as=class{constructor(t=0,n=0,r=!1){this.i=t,this.out=n,this.nullable=r}},cl=class e{static ANY_RUNE_NOT_NL(){return[0,D.CODES.get(`
169
169
  `)-1,D.CODES.get(`
170
170
  `)+1,ue.MAX_RUNE]}static ANY_RUNE(){return[0,ue.MAX_RUNE]}static compileRegexp(t){let n=new e,r=n.compile(t);return n.prog.patch(r.out,n.newInst(de.MATCH).i),n.prog.start=r.i,n.prog}constructor(){this.prog=new ll,this.newInst(de.FAIL)}newInst(t){return this.prog.addInst(t),new as(this.prog.numInst()-1,0,!0)}nop(){let t=this.newInst(de.NOP);return t.out=t.i<<1,t}fail(){return new as}cap(t){let n=this.newInst(de.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 as(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(de.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(de.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(de.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 as(t.i,this.loop(t,n).out,t.nullable)}empty(t){let n=this.newInst(de.EMPTY_WIDTH);return this.prog.getInst(n.i).arg=t,n.out=n.i<<1,n}rune(t,n){let r=this.newInst(de.RUNE);r.nullable=!1;let s=this.prog.getInst(r.i);return s.runes=t,n&=G.FOLD_CASE,(t.length!==1||ue.simpleFold(t[0])===t[0])&&(n&=-2),s.arg=n,r.out=r.i<<1,(n&G.FOLD_CASE)===0&&t.length===1||t.length===2&&t[0]===t[1]?s.op=de.RUNE1:t.length===2&&t[0]===0&&t[1]===ue.MAX_RUNE?s.op=de.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]===ue.MAX_RUNE&&(s.op=de.RUNE_ANY_NOT_NL),r}compile(t){switch(t.op){case F.Op.NO_MATCH:return this.fail();case F.Op.EMPTY_MATCH:return this.nop();case F.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 F.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case F.Op.ANY_CHAR_NOT_NL:return this.rune(e.ANY_RUNE_NOT_NL(),0);case F.Op.ANY_CHAR:return this.rune(e.ANY_RUNE(),0);case F.Op.BEGIN_LINE:return this.empty(Te.EMPTY_BEGIN_LINE);case F.Op.END_LINE:return this.empty(Te.EMPTY_END_LINE);case F.Op.BEGIN_TEXT:return this.empty(Te.EMPTY_BEGIN_TEXT);case F.Op.END_TEXT:return this.empty(Te.EMPTY_END_TEXT);case F.Op.WORD_BOUNDARY:return this.empty(Te.EMPTY_WORD_BOUNDARY);case F.Op.NO_WORD_BOUNDARY:return this.empty(Te.EMPTY_NO_WORD_BOUNDARY);case F.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 F.Op.STAR:return this.star(this.compile(t.subs[0]),(t.flags&G.NON_GREEDY)!==0);case F.Op.PLUS:return this.plus(this.compile(t.subs[0]),(t.flags&G.NON_GREEDY)!==0);case F.Op.QUEST:return this.quest(this.compile(t.subs[0]),(t.flags&G.NON_GREEDY)!==0);case F.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 F.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 rl("regexp: unhandled case in compile")}}},ul=class e{static simplify(t){if(t===null)return null;switch(t.op){case F.Op.CAPTURE:case F.Op.CONCAT:case F.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=F.fromRegexp(t),n.runes=[],n.subs=t.subs.slice(0,t.subs.length)),n!==t&&(n.subs[r]=i)}return n}case F.Op.STAR:case F.Op.PLUS:case F.Op.QUEST:{let n=e.simplify(t.subs[0]);return e.simplify1(t.op,t.flags,n,t)}case F.Op.REPEAT:{if(t.min===0&&t.max===0)return new F(F.Op.EMPTY_MATCH);let n=e.simplify(t.subs[0]);if(t.max===-1){if(t.min===0)return e.simplify1(F.Op.STAR,t.flags,n,null);if(t.min===1)return e.simplify1(F.Op.PLUS,t.flags,n,null);let s=new F(F.Op.CONCAT),i=[];for(let o=0;o<t.min-1;o++)i.push(n);return i.push(e.simplify1(F.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(F.Op.QUEST,t.flags,n,null);for(let i=t.min+1;i<t.max;i++){let o=new F(F.Op.CONCAT);o.subs=[n,s],s=e.simplify1(F.Op.QUEST,t.flags,o,null)}if(r===null)return s;r.push(s)}if(r!==null){let s=new F(F.Op.CONCAT);return s.subs=r.slice(0),s}return new F(F.Op.NO_MATCH)}}return t}static simplify1(t,n,r,s){return r.op===F.Op.EMPTY_MATCH||t===r.op&&(n&G.NON_GREEDY)===(r.flags&G.NON_GREEDY)?r:(s!==null&&s.op===t&&(s.flags&G.NON_GREEDY)===(n&G.NON_GREEDY)&&r===s.subs[0]||(s=new F(t),s.flags=n,s.subs=[r]),s)}},$e=class{constructor(t,n){this.sign=t,this.cls=n}},_1=[48,57],F1=[9,10,12,13,32,32],L1=[48,57,65,90,95,95,97,122],M1=new Map([["\\d",new $e(1,_1)],["\\D",new $e(-1,_1)],["\\s",new $e(1,F1)],["\\S",new $e(-1,F1)],["\\w",new $e(1,L1)],["\\W",new $e(-1,L1)]]),U1=[48,57,65,90,97,122],B1=[65,90,97,122],W1=[0,127],z1=[9,9,32,32],H1=[0,31,127,127],j1=[48,57],G1=[33,126],V1=[97,122],q1=[32,126],Z1=[33,47,58,64,91,96,123,126],K1=[9,13,32,32],Q1=[65,90],X1=[48,57,65,90,95,95,97,122],Y1=[48,57,65,70,97,102],J1=new Map([["[:alnum:]",new $e(1,U1)],["[:^alnum:]",new $e(-1,U1)],["[:alpha:]",new $e(1,B1)],["[:^alpha:]",new $e(-1,B1)],["[:ascii:]",new $e(1,W1)],["[:^ascii:]",new $e(-1,W1)],["[:blank:]",new $e(1,z1)],["[:^blank:]",new $e(-1,z1)],["[:cntrl:]",new $e(1,H1)],["[:^cntrl:]",new $e(-1,H1)],["[:digit:]",new $e(1,j1)],["[:^digit:]",new $e(-1,j1)],["[:graph:]",new $e(1,G1)],["[:^graph:]",new $e(-1,G1)],["[:lower:]",new $e(1,V1)],["[:^lower:]",new $e(-1,V1)],["[:print:]",new $e(1,q1)],["[:^print:]",new $e(-1,q1)],["[:punct:]",new $e(1,Z1)],["[:^punct:]",new $e(-1,Z1)],["[:space:]",new $e(1,K1)],["[:^space:]",new $e(-1,K1)],["[:upper:]",new $e(1,Q1)],["[:^upper:]",new $e(-1,Q1)],["[:word:]",new $e(1,X1)],["[:^word:]",new $e(-1,X1)],["[:xdigit:]",new $e(1,Y1)],["[:^xdigit:]",new $e(-1,Y1)]]),Mn=class e{static charClassToString(t,n){let r="[";for(let s=0;s<n;s+=2){s>0&&(r+=" ");let i=t[s],o=t[s+1];i===o?r+=`0x${i.toString(16)}`:r+=`0x${i.toString(16)}-0x${o.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],o=t[s+1],a=n,l=r;for(;a<=l;){for(;a<r&&e.cmp(t,a,i,o)<0;)a+=2;for(;l>n&&e.cmp(t,l,i,o)>0;)l-=2;if(a<=l){if(a!==l){let c=t[a];t[a]=t[l],t[l]=c,c=t[a+1],t[a+1]=t[l+1],t[l+1]=c}a+=2,l-=2}}n<l&&e.qsortIntPair(t,n,l),a<r&&e.qsortIntPair(t,a,r)}constructor(t=Te.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&G.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<=ue.MIN_FOLD&&n>=ue.MAX_FOLD)return this.appendRange(t,n);if(n<ue.MIN_FOLD||t>ue.MAX_FOLD)return this.appendRange(t,n);t<ue.MIN_FOLD&&(this.appendRange(t,ue.MIN_FOLD-1),t=ue.MIN_FOLD),n>ue.MAX_FOLD&&(this.appendRange(ue.MAX_FOLD+1,n),n=ue.MAX_FOLD);for(let r=t;r<=n;r++){this.appendRange(r,r);for(let s=ue.simpleFold(r);s!==r;s=ue.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<=ue.MAX_RUNE&&this.appendRange(n,ue.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 o=r;o<=s;o+=i)this.appendRange(o,o)}return this}appendNegatedTable(t){let n=0;for(let r=0;r<t.length;++r){let s=t.getLo(r),i=t.getHi(r),o=t.getStride(r);if(o===1){n<=s-1&&this.appendRange(n,s-1),n=i+1;continue}for(let a=s;a<=i;a+=o)n<=a-1&&this.appendRange(n,a-1),n=a+1}return n<=ue.MAX_RUNE&&this.appendRange(n,ue.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<=ue.MAX_RUNE&&(this.r[this.len++]=t,this.r[this.len++]=ue.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)}},Xs=class e{static of(t,n){return new e(t,n)}constructor(t,n){this.first=t,this.second=n}},fl=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+=Te.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()}},pl=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 N(new Uint32Array([0,ue.MAX_RUNE,1]));static unicodeTable(t){return t==="Any"?Xs.of(e.ANY_TABLE,e.ANY_TABLE):fn.CATEGORIES.has(t)?Xs.of(fn.CATEGORIES.get(t),fn.FOLD_CATEGORIES.get(t)):fn.SCRIPTS.has(t)?Xs.of(fn.SCRIPTS.get(t),fn.FOLD_SCRIPT.get(t)):null}static minFoldRune(t){if(t<ue.MIN_FOLD||t>ue.MAX_FOLD)return t;let n=t,r=t;for(t=ue.simpleFold(t);t!==r;t=ue.simpleFold(t))n>t&&(n=t);return n}static leadingRegexp(t){if(t.op===F.Op.EMPTY_MATCH)return null;if(t.op===F.Op.CONCAT&&t.subs.length>0){let n=t.subs[0];return n.op===F.Op.EMPTY_MATCH?null:n}return t}static literalRegexp(t,n){let r=new F(F.Op.LITERAL);return r.flags=n,r.runes=Te.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 je(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|s&ue.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("_")&&!Te.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===F.Op.LITERAL&&t.runes.length===1||t.op===F.Op.CHAR_CLASS||t.op===F.Op.ANY_CHAR_NOT_NL||t.op===F.Op.ANY_CHAR}static matchRune(t,n){switch(t.op){case F.Op.LITERAL:return t.runes.length===1&&t.runes[0]===n;case F.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 F.Op.ANY_CHAR_NOT_NL:return n!==D.CODES.get(`
172
+ `)+1&&t[3]===ue.MAX_RUNE&&(s.op=de.RUNE_ANY_NOT_NL),r}compile(t){switch(t.op){case F.Op.NO_MATCH:return this.fail();case F.Op.EMPTY_MATCH:return this.nop();case F.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 F.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case F.Op.ANY_CHAR_NOT_NL:return this.rune(e.ANY_RUNE_NOT_NL(),0);case F.Op.ANY_CHAR:return this.rune(e.ANY_RUNE(),0);case F.Op.BEGIN_LINE:return this.empty(Te.EMPTY_BEGIN_LINE);case F.Op.END_LINE:return this.empty(Te.EMPTY_END_LINE);case F.Op.BEGIN_TEXT:return this.empty(Te.EMPTY_BEGIN_TEXT);case F.Op.END_TEXT:return this.empty(Te.EMPTY_END_TEXT);case F.Op.WORD_BOUNDARY:return this.empty(Te.EMPTY_WORD_BOUNDARY);case F.Op.NO_WORD_BOUNDARY:return this.empty(Te.EMPTY_NO_WORD_BOUNDARY);case F.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 F.Op.STAR:return this.star(this.compile(t.subs[0]),(t.flags&G.NON_GREEDY)!==0);case F.Op.PLUS:return this.plus(this.compile(t.subs[0]),(t.flags&G.NON_GREEDY)!==0);case F.Op.QUEST:return this.quest(this.compile(t.subs[0]),(t.flags&G.NON_GREEDY)!==0);case F.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 F.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 rl("regexp: unhandled case in compile")}}},ul=class e{static simplify(t){if(t===null)return null;switch(t.op){case F.Op.CAPTURE:case F.Op.CONCAT:case F.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=F.fromRegexp(t),n.runes=[],n.subs=t.subs.slice(0,t.subs.length)),n!==t&&(n.subs[r]=i)}return n}case F.Op.STAR:case F.Op.PLUS:case F.Op.QUEST:{let n=e.simplify(t.subs[0]);return e.simplify1(t.op,t.flags,n,t)}case F.Op.REPEAT:{if(t.min===0&&t.max===0)return new F(F.Op.EMPTY_MATCH);let n=e.simplify(t.subs[0]);if(t.max===-1){if(t.min===0)return e.simplify1(F.Op.STAR,t.flags,n,null);if(t.min===1)return e.simplify1(F.Op.PLUS,t.flags,n,null);let s=new F(F.Op.CONCAT),i=[];for(let o=0;o<t.min-1;o++)i.push(n);return i.push(e.simplify1(F.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(F.Op.QUEST,t.flags,n,null);for(let i=t.min+1;i<t.max;i++){let o=new F(F.Op.CONCAT);o.subs=[n,s],s=e.simplify1(F.Op.QUEST,t.flags,o,null)}if(r===null)return s;r.push(s)}if(r!==null){let s=new F(F.Op.CONCAT);return s.subs=r.slice(0),s}return new F(F.Op.NO_MATCH)}}return t}static simplify1(t,n,r,s){return r.op===F.Op.EMPTY_MATCH||t===r.op&&(n&G.NON_GREEDY)===(r.flags&G.NON_GREEDY)?r:(s!==null&&s.op===t&&(s.flags&G.NON_GREEDY)===(n&G.NON_GREEDY)&&r===s.subs[0]||(s=new F(t),s.flags=n,s.subs=[r]),s)}},$e=class{constructor(t,n){this.sign=t,this.cls=n}},_1=[48,57],F1=[9,10,12,13,32,32],L1=[48,57,65,90,95,95,97,122],M1=new Map([["\\d",new $e(1,_1)],["\\D",new $e(-1,_1)],["\\s",new $e(1,F1)],["\\S",new $e(-1,F1)],["\\w",new $e(1,L1)],["\\W",new $e(-1,L1)]]),U1=[48,57,65,90,97,122],B1=[65,90,97,122],W1=[0,127],z1=[9,9,32,32],H1=[0,31,127,127],j1=[48,57],G1=[33,126],V1=[97,122],q1=[32,126],Z1=[33,47,58,64,91,96,123,126],K1=[9,13,32,32],Q1=[65,90],X1=[48,57,65,90,95,95,97,122],Y1=[48,57,65,70,97,102],J1=new Map([["[:alnum:]",new $e(1,U1)],["[:^alnum:]",new $e(-1,U1)],["[:alpha:]",new $e(1,B1)],["[:^alpha:]",new $e(-1,B1)],["[:ascii:]",new $e(1,W1)],["[:^ascii:]",new $e(-1,W1)],["[:blank:]",new $e(1,z1)],["[:^blank:]",new $e(-1,z1)],["[:cntrl:]",new $e(1,H1)],["[:^cntrl:]",new $e(-1,H1)],["[:digit:]",new $e(1,j1)],["[:^digit:]",new $e(-1,j1)],["[:graph:]",new $e(1,G1)],["[:^graph:]",new $e(-1,G1)],["[:lower:]",new $e(1,V1)],["[:^lower:]",new $e(-1,V1)],["[:print:]",new $e(1,q1)],["[:^print:]",new $e(-1,q1)],["[:punct:]",new $e(1,Z1)],["[:^punct:]",new $e(-1,Z1)],["[:space:]",new $e(1,K1)],["[:^space:]",new $e(-1,K1)],["[:upper:]",new $e(1,Q1)],["[:^upper:]",new $e(-1,Q1)],["[:word:]",new $e(1,X1)],["[:^word:]",new $e(-1,X1)],["[:xdigit:]",new $e(1,Y1)],["[:^xdigit:]",new $e(-1,Y1)]]),Un=class e{static charClassToString(t,n){let r="[";for(let s=0;s<n;s+=2){s>0&&(r+=" ");let i=t[s],o=t[s+1];i===o?r+=`0x${i.toString(16)}`:r+=`0x${i.toString(16)}-0x${o.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],o=t[s+1],a=n,l=r;for(;a<=l;){for(;a<r&&e.cmp(t,a,i,o)<0;)a+=2;for(;l>n&&e.cmp(t,l,i,o)>0;)l-=2;if(a<=l){if(a!==l){let c=t[a];t[a]=t[l],t[l]=c,c=t[a+1],t[a+1]=t[l+1],t[l+1]=c}a+=2,l-=2}}n<l&&e.qsortIntPair(t,n,l),a<r&&e.qsortIntPair(t,a,r)}constructor(t=Te.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&G.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<=ue.MIN_FOLD&&n>=ue.MAX_FOLD)return this.appendRange(t,n);if(n<ue.MIN_FOLD||t>ue.MAX_FOLD)return this.appendRange(t,n);t<ue.MIN_FOLD&&(this.appendRange(t,ue.MIN_FOLD-1),t=ue.MIN_FOLD),n>ue.MAX_FOLD&&(this.appendRange(ue.MAX_FOLD+1,n),n=ue.MAX_FOLD);for(let r=t;r<=n;r++){this.appendRange(r,r);for(let s=ue.simpleFold(r);s!==r;s=ue.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<=ue.MAX_RUNE&&this.appendRange(n,ue.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 o=r;o<=s;o+=i)this.appendRange(o,o)}return this}appendNegatedTable(t){let n=0;for(let r=0;r<t.length;++r){let s=t.getLo(r),i=t.getHi(r),o=t.getStride(r);if(o===1){n<=s-1&&this.appendRange(n,s-1),n=i+1;continue}for(let a=s;a<=i;a+=o)n<=a-1&&this.appendRange(n,a-1),n=a+1}return n<=ue.MAX_RUNE&&this.appendRange(n,ue.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<=ue.MAX_RUNE&&(this.r[this.len++]=t,this.r[this.len++]=ue.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)}},Xs=class e{static of(t,n){return new e(t,n)}constructor(t,n){this.first=t,this.second=n}},fl=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+=Te.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()}},pl=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 N(new Uint32Array([0,ue.MAX_RUNE,1]));static unicodeTable(t){return t==="Any"?Xs.of(e.ANY_TABLE,e.ANY_TABLE):fn.CATEGORIES.has(t)?Xs.of(fn.CATEGORIES.get(t),fn.FOLD_CATEGORIES.get(t)):fn.SCRIPTS.has(t)?Xs.of(fn.SCRIPTS.get(t),fn.FOLD_SCRIPT.get(t)):null}static minFoldRune(t){if(t<ue.MIN_FOLD||t>ue.MAX_FOLD)return t;let n=t,r=t;for(t=ue.simpleFold(t);t!==r;t=ue.simpleFold(t))n>t&&(n=t);return n}static leadingRegexp(t){if(t.op===F.Op.EMPTY_MATCH)return null;if(t.op===F.Op.CONCAT&&t.subs.length>0){let n=t.subs[0];return n.op===F.Op.EMPTY_MATCH?null:n}return t}static literalRegexp(t,n){let r=new F(F.Op.LITERAL);return r.flags=n,r.runes=Te.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 je(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|s&ue.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("_")&&!Te.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===F.Op.LITERAL&&t.runes.length===1||t.op===F.Op.CHAR_CLASS||t.op===F.Op.ANY_CHAR_NOT_NL||t.op===F.Op.ANY_CHAR}static matchRune(t,n){switch(t.op){case F.Op.LITERAL:return t.runes.length===1&&t.runes[0]===n;case F.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 F.Op.ANY_CHAR_NOT_NL:return n!==D.CODES.get(`
173
173
  `);case F.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(t,n){switch(t.op){case F.Op.ANY_CHAR:break;case F.Op.ANY_CHAR_NOT_NL:e.matchRune(n,D.CODES.get(`
174
- `))&&(t.op=F.Op.ANY_CHAR);break;case F.Op.CHAR_CLASS:n.op===F.Op.LITERAL?t.runes=new Mn(t.runes).appendLiteral(n.runes[0],n.flags).toArray():t.runes=new Mn(t.runes).appendClass(n.runes).toArray();break;case F.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=F.Op.CHAR_CLASS,t.runes=new Mn().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 je(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 o=0,a=0;for(;;){if(!t.more())break e;if(r=t.pop(),r===D.CODES.get("}"))break;let l=Te.unhex(r);if(l<0||(a=a*16+l,a>ue.MAX_RUNE))break e;o++}if(o===0)break e;return a}let s=Te.unhex(r);if(!t.more())break;r=t.pop();let i=Te.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
- `);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<=ue.MAX_ASCII&&!Te.isalnum(r))return r;break}throw new je(e.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new je(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 F(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 je(e.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(this.size===null){if(this.repeats===0&&(this.repeats=1),t.op===F.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 je(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 F.Op.LITERAL:{r=t.runes.length;break}case F.Op.CAPTURE:case F.Op.STAR:{r=2+this.calcSize(t.subs[0]);break}case F.Op.PLUS:case F.Op.QUEST:{r=1+this.calcSize(t.subs[0]);break}case F.Op.CONCAT:{for(let s of t.subs)r=r+this.calcSize(s);break}case F.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 F.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 je(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&&!F.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===F.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=F.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags&-2}else if(t.op===F.Op.CHAR_CLASS&&t.runes.length===4&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&ue.simpleFold(t.runes[0])===t.runes[2]&&ue.simpleFold(t.runes[2])===t.runes[0]||t.op===F.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]+1===t.runes[1]&&ue.simpleFold(t.runes[0])===t.runes[1]&&ue.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|G.FOLD_CASE))return null;t.op=F.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|G.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!==F.Op.LITERAL||i.op!==F.Op.LITERAL||(s.flags&G.FOLD_CASE)!==(i.flags&G.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(F.Op.LITERAL);return r.flags=n,(n&G.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,o){let a=this.flags;if((a&G.PERL_X)!==0&&(i.more()&&i.lookingAt("?")&&(i.skip(1),a^=G.NON_GREEDY),o!==-1))throw new je(e.ERR_INVALID_REPEAT_OP,i.from(o));let l=this.stack.length;if(l===0)throw new je(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let c=this.stack[l-1];if(F.isPseudoOp(c.op))throw new je(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let u=this.newRegexp(t);if(u.min=n,u.max=r,u.flags=a,u.subs=[c],this.stack[l-1]=u,this.checkLimits(u),t===F.Op.REPEAT&&(n>=2||r>=2)&&!this.repeatIsValid(u,1e3))throw new je(e.ERR_INVALID_REPEAT_SIZE,i.from(s))}repeatIsValid(t,n){if(t.op===F.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(F.Op.EMPTY_MATCH)):this.push(this.collapse(t,F.Op.CONCAT))}alternate(){let t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),t.length===0?this.push(this.newRegexp(F.Op.NO_MATCH)):this.push(this.collapse(t,F.Op.ALTERNATE))}cleanAlt(t){t.op===F.Op.CHAR_CLASS&&(t.runes=new Mn(t.runes).cleanClass().toArray(),t.runes.length===2&&t.runes[0]===0&&t.runes[1]===ue.MAX_RUNE?(t.runes=[],t.op=F.Op.ANY_CHAR):t.runes.length===4&&t.runes[0]===0&&t.runes[1]===D.CODES.get(`
174
+ `))&&(t.op=F.Op.ANY_CHAR);break;case F.Op.CHAR_CLASS:n.op===F.Op.LITERAL?t.runes=new Un(t.runes).appendLiteral(n.runes[0],n.flags).toArray():t.runes=new Un(t.runes).appendClass(n.runes).toArray();break;case F.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=F.Op.CHAR_CLASS,t.runes=new Un().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 je(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 o=0,a=0;for(;;){if(!t.more())break e;if(r=t.pop(),r===D.CODES.get("}"))break;let l=Te.unhex(r);if(l<0||(a=a*16+l,a>ue.MAX_RUNE))break e;o++}if(o===0)break e;return a}let s=Te.unhex(r);if(!t.more())break;r=t.pop();let i=Te.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
+ `);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<=ue.MAX_ASCII&&!Te.isalnum(r))return r;break}throw new je(e.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new je(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 F(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 je(e.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(this.size===null){if(this.repeats===0&&(this.repeats=1),t.op===F.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 je(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 F.Op.LITERAL:{r=t.runes.length;break}case F.Op.CAPTURE:case F.Op.STAR:{r=2+this.calcSize(t.subs[0]);break}case F.Op.PLUS:case F.Op.QUEST:{r=1+this.calcSize(t.subs[0]);break}case F.Op.CONCAT:{for(let s of t.subs)r=r+this.calcSize(s);break}case F.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 F.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 je(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&&!F.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===F.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=F.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags&-2}else if(t.op===F.Op.CHAR_CLASS&&t.runes.length===4&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&ue.simpleFold(t.runes[0])===t.runes[2]&&ue.simpleFold(t.runes[2])===t.runes[0]||t.op===F.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]+1===t.runes[1]&&ue.simpleFold(t.runes[0])===t.runes[1]&&ue.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|G.FOLD_CASE))return null;t.op=F.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|G.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!==F.Op.LITERAL||i.op!==F.Op.LITERAL||(s.flags&G.FOLD_CASE)!==(i.flags&G.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(F.Op.LITERAL);return r.flags=n,(n&G.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,o){let a=this.flags;if((a&G.PERL_X)!==0&&(i.more()&&i.lookingAt("?")&&(i.skip(1),a^=G.NON_GREEDY),o!==-1))throw new je(e.ERR_INVALID_REPEAT_OP,i.from(o));let l=this.stack.length;if(l===0)throw new je(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let c=this.stack[l-1];if(F.isPseudoOp(c.op))throw new je(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let u=this.newRegexp(t);if(u.min=n,u.max=r,u.flags=a,u.subs=[c],this.stack[l-1]=u,this.checkLimits(u),t===F.Op.REPEAT&&(n>=2||r>=2)&&!this.repeatIsValid(u,1e3))throw new je(e.ERR_INVALID_REPEAT_SIZE,i.from(s))}repeatIsValid(t,n){if(t.op===F.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(F.Op.EMPTY_MATCH)):this.push(this.collapse(t,F.Op.CONCAT))}alternate(){let t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),t.length===0?this.push(this.newRegexp(F.Op.NO_MATCH)):this.push(this.collapse(t,F.Op.ALTERNATE))}cleanAlt(t){t.op===F.Op.CHAR_CLASS&&(t.runes=new Un(t.runes).cleanClass().toArray(),t.runes.length===2&&t.runes[0]===0&&t.runes[1]===ue.MAX_RUNE?(t.runes=[],t.op=F.Op.ANY_CHAR):t.runes.length===4&&t.runes[0]===0&&t.runes[1]===D.CODES.get(`
176
176
  `)-1&&t.runes[2]===D.CODES.get(`
177
- `)+1&&t.runes[3]===ue.MAX_RUNE&&(t.runes=[],t.op=F.Op.ANY_CHAR_NOT_NL))}collapse(t,n){if(t.length===1)return t[0];let r=0;for(let a of t)r+=a.op===n?a.subs.length:1;let s=new Array(r).fill(null),i=0;for(let a of t)a.op===n?(s.splice(i,a.subs.length,...a.subs),i+=a.subs.length,this.reuse(a)):s[i++]=a;let o=this.newRegexp(n);if(o.subs=s,n===F.Op.ALTERNATE&&(o.subs=this.factor(o.subs),o.subs.length===1)){let a=o;o=o.subs[0],this.reuse(a)}return o}factor(t){if(t.length<2)return t;let n=0,r=t.length,s=0,i=null,o=0,a=0,l=0;for(let u=0;u<=r;u++){let f=null,p=0,h=0;if(u<r){let d=t[n+u];if(d.op===F.Op.CONCAT&&d.subs.length>0&&(d=d.subs[0]),d.op===F.Op.LITERAL&&(f=d.runes,p=d.runes.length,h=d.flags&G.FOLD_CASE),h===a){let m=0;for(;m<o&&m<p&&i[m]===f[m];)m++;if(m>0){o=m;continue}}}if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let d=this.newRegexp(F.Op.LITERAL);d.flags=a,d.runes=i.slice(0,o);for(let y=l;y<u;y++)t[n+y]=this.removeLeadingString(t[n+y],o),this.checkLimits(t[n+y]);let m=this.collapse(t.slice(n+l,n+u),F.Op.ALTERNATE),g=this.newRegexp(F.Op.CONCAT);g.subs=[d,m],t[s++]=g}l=u,i=f,o=p,a=h}r=s,n=0,l=0,s=0;let c=null;for(let u=0;u<=r;u++){let f=null;if(!(u<r&&(f=e.leadingRegexp(t[n+u]),c!==null&&c.equals(f)&&(e.isCharClass(c)||c.op===F.Op.REPEAT&&c.min===c.max&&e.isCharClass(c.subs[0]))))){if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let p=c;for(let m=l;m<u;m++){let g=m!==l;t[n+m]=this.removeLeadingRegexp(t[n+m],g),this.checkLimits(t[n+m])}let h=this.collapse(t.slice(n+l,n+u),F.Op.ALTERNATE),d=this.newRegexp(F.Op.CONCAT);d.subs=[p,h],t[s++]=d}l=u,c=f}}r=s,n=0,l=0,s=0;for(let u=0;u<=r;u++)if(!(u<r&&e.isCharClass(t[n+u]))){if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let f=l;for(let h=l+1;h<u;h++){let d=t[n+f],m=t[n+h];(d.op<m.op||d.op===m.op&&(d.runes!==null?d.runes.length:0)<(m.runes!==null?m.runes.length:0))&&(f=h)}let p=t[n+l];t[n+l]=t[n+f],t[n+f]=p;for(let h=l+1;h<u;h++)e.mergeCharClass(t[n+l],t[n+h]),this.reuse(t[n+h]);this.cleanAlt(t[n+l]),t[s++]=t[n+l]}u<r&&(t[s++]=t[n+u]),l=u+1}r=s,n=0,l=0,s=0;for(let u=0;u<r;++u)u+1<r&&t[n+u].op===F.Op.EMPTY_MATCH&&t[n+u+1].op===F.Op.EMPTY_MATCH||(t[s++]=t[n+u]);return r=s,n=0,t.slice(n,r)}removeLeadingString(t,n){if(t.op===F.Op.CONCAT&&t.subs.length>0){let r=this.removeLeadingString(t.subs[0],n);if(t.subs[0]=r,r.op===F.Op.EMPTY_MATCH)switch(this.reuse(r),t.subs.length){case 0:case 1:t.op=F.Op.EMPTY_MATCH,t.subs=null;break;case 2:{let s=t;t=t.subs[1],this.reuse(s);break}default:t.subs=t.subs.slice(1,t.subs.length);break}return t}return t.op===F.Op.LITERAL&&(t.runes=t.runes.slice(n,t.runes.length),t.runes.length===0&&(t.op=F.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,n){if(t.op===F.Op.CONCAT&&t.subs.length>0){switch(n&&this.reuse(t.subs[0]),t.subs=t.subs.slice(1,t.subs.length),t.subs.length){case 0:{t.op=F.Op.EMPTY_MATCH,t.subs=F.emptySubs();break}case 1:{let r=t;t=t.subs[0],this.reuse(r);break}}return t}return n&&this.reuse(t),this.newRegexp(F.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&G.LITERAL)!==0)return e.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,r=-1,s=new fl(this.wholeRegexp);for(;s.more();){let o=-1;e:switch(s.peek()){case D.CODES.get("("):if((this.flags&G.PERL_X)!==0&&s.lookingAt("(?")){this.parsePerlFlags(s);break}this.op(F.Op.LEFT_PAREN).cap=++this.numCap,s.skip(1);break;case D.CODES.get("|"):this.parseVerticalBar(),s.skip(1);break;case D.CODES.get(")"):this.parseRightParen(),s.skip(1);break;case D.CODES.get("^"):(this.flags&G.ONE_LINE)!==0?this.op(F.Op.BEGIN_TEXT):this.op(F.Op.BEGIN_LINE),s.skip(1);break;case D.CODES.get("$"):(this.flags&G.ONE_LINE)!==0?this.op(F.Op.END_TEXT).flags|=G.WAS_DOLLAR:this.op(F.Op.END_LINE),s.skip(1);break;case D.CODES.get("."):(this.flags&G.DOT_NL)!==0?this.op(F.Op.ANY_CHAR):this.op(F.Op.ANY_CHAR_NOT_NL),s.skip(1);break;case D.CODES.get("["):this.parseClass(s);break;case D.CODES.get("*"):case D.CODES.get("+"):case D.CODES.get("?"):{o=s.pos();let a=null;switch(s.pop()){case D.CODES.get("*"):a=F.Op.STAR;break;case D.CODES.get("+"):a=F.Op.PLUS;break;case D.CODES.get("?"):a=F.Op.QUEST;break}this.repeat(a,n,r,o,s,t);break}case D.CODES.get("{"):{o=s.pos();let a=e.parseRepeat(s);if(a<0){s.rewindTo(o),this.literal(s.pop());break}n=a>>16,r=(a&ue.MAX_BMP)<<16>>16,this.repeat(F.Op.REPEAT,n,r,o,s,t);break}case D.CODES.get("\\"):{let a=s.pos();if(s.skip(1),(this.flags&G.PERL_X)!==0&&s.more())switch(s.pop()){case D.CODES.get("A"):this.op(F.Op.BEGIN_TEXT);break e;case D.CODES.get("b"):this.op(F.Op.WORD_BOUNDARY);break e;case D.CODES.get("B"):this.op(F.Op.NO_WORD_BOUNDARY);break e;case D.CODES.get("C"):throw new je(e.ERR_INVALID_ESCAPE,"\\C");case D.CODES.get("Q"):{let f=s.rest(),p=f.indexOf("\\E");p>=0&&(f=f.substring(0,p)),s.skipString(f),s.skipString("\\E");let h=0;for(;h<f.length;){let d=f.codePointAt(h);this.literal(d),h+=Te.charCount(d)}break e}case D.CODES.get("z"):this.op(F.Op.END_TEXT);break e;default:s.rewindTo(a);break}let l=this.newRegexp(F.Op.CHAR_CLASS);if(l.flags=this.flags,s.lookingAt("\\p")||s.lookingAt("\\P")){let u=new Mn;if(this.parseUnicodeClass(s,u)){l.runes=u.toArray(),this.push(l);break e}}let c=new Mn;if(this.parsePerlClassEscape(s,c)){l.runes=c.toArray(),this.push(l);break e}s.rewindTo(a),this.reuse(l),this.literal(e.parseEscape(s));break}default:this.literal(s.pop());break}t=o}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new je(e.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(t){let n=t.pos(),r=t.rest();if(r.startsWith("(?P<")||r.startsWith("(?<")){let a=r.charAt(2)==="P"?4:3,l=r.indexOf(">");if(l<0)throw new je(e.ERR_INVALID_NAMED_CAPTURE,r);let c=r.substring(a,l);if(t.skipString(c),t.skip(a+1),!e.isValidCaptureName(c))throw new je(e.ERR_INVALID_NAMED_CAPTURE,r.substring(0,l+1));let u=this.op(F.Op.LEFT_PAREN);if(u.cap=++this.numCap,this.namedGroups[c])throw new je(e.ERR_DUPLICATE_NAMED_CAPTURE,c);this.namedGroups[c]=this.numCap,u.name=c;return}t.skip(2);let s=this.flags,i=1,o=!1;e:for(;t.more();){let a=t.pop();switch(a){case D.CODES.get("i"):s|=G.FOLD_CASE,o=!0;break;case D.CODES.get("m"):s&=-17,o=!0;break;case D.CODES.get("s"):s|=G.DOT_NL,o=!0;break;case D.CODES.get("U"):s|=G.NON_GREEDY,o=!0;break;case D.CODES.get("-"):if(i<0)break e;i=-1,s=~s,o=!1;break;case D.CODES.get(":"):case D.CODES.get(")"):if(i<0){if(!o)break e;s=~s}a===D.CODES.get(":")&&this.op(F.Op.LEFT_PAREN),this.flags=s;return;default:break e}}throw new je(e.ERR_INVALID_PERL_OP,t.from(n))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(F.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===F.Op.VERTICAL_BAR&&e.isCharClass(this.stack[t-1])&&e.isCharClass(this.stack[t-3])){let n=this.stack[t-1],r=this.stack[t-3];if(n.op>r.op){let s=r;r=n,n=s,this.stack[t-3]=r}return e.mergeCharClass(r,n),this.reuse(n),this.pop(),!0}if(t>=2){let n=this.stack[t-1],r=this.stack[t-2];if(r.op===F.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=n,this.stack[t-1]=r,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new je(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);let n=this.pop(),r=this.pop();if(r.op!==F.Op.LEFT_PAREN)throw new je(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);this.flags=r.flags,r.cap===0?this.push(n):(r.op=F.Op.CAPTURE,r.subs=[n],this.push(r))}parsePerlClassEscape(t,n){let r=t.pos();if((this.flags&G.PERL_X)===0||!t.more()||t.pop()!==D.CODES.get("\\")||!t.more())return!1;t.pop();let s=t.from(r),i=M1.has(s)?M1.get(s):null;return i===null?!1:(n.appendGroup(i,(this.flags&G.FOLD_CASE)!==0),!0)}parseNamedClass(t,n){let r=t.rest(),s=r.indexOf(":]");if(s<0)return!1;let i=r.substring(0,s+2);t.skipString(i);let o=J1.has(i)?J1.get(i):null;if(o===null)throw new je(e.ERR_INVALID_CHAR_RANGE,i);return n.appendGroup(o,(this.flags&G.FOLD_CASE)!==0),!0}parseUnicodeClass(t,n){let r=t.pos();if((this.flags&G.UNICODE_GROUPS)===0||!t.lookingAt("\\p")&&!t.lookingAt("\\P"))return!1;t.skip(1);let s=1,i=t.pop();if(i===D.CODES.get("P")&&(s=-1),!t.more())throw t.rewindTo(r),new je(e.ERR_INVALID_CHAR_RANGE,t.rest());i=t.pop();let o;if(i!==D.CODES.get("{"))o=Te.runeToString(i);else{let u=t.rest(),f=u.indexOf("}");if(f<0)throw t.rewindTo(r),new je(e.ERR_INVALID_CHAR_RANGE,t.rest());o=u.substring(0,f),t.skipString(o),t.skip(1)}o.length!==0&&o.codePointAt(0)===D.CODES.get("^")&&(s=0-s,o=o.substring(1));let a=e.unicodeTable(o);if(a===null)throw new je(e.ERR_INVALID_CHAR_RANGE,t.from(r));let l=a.first,c=a.second;if((this.flags&G.FOLD_CASE)===0||c===null)n.appendTableWithSign(l,s);else{let u=new Mn().appendTable(l).appendTable(c).cleanClass().toArray();n.appendClassWithSign(u,s)}return!0}parseClass(t){let n=t.pos();t.skip(1);let r=this.newRegexp(F.Op.CHAR_CLASS);r.flags=this.flags;let s=new Mn,i=1;t.more()&&t.lookingAt("^")&&(i=-1,t.skip(1),(this.flags&G.CLASS_NL)===0&&s.appendRange(D.CODES.get(`
177
+ `)+1&&t.runes[3]===ue.MAX_RUNE&&(t.runes=[],t.op=F.Op.ANY_CHAR_NOT_NL))}collapse(t,n){if(t.length===1)return t[0];let r=0;for(let a of t)r+=a.op===n?a.subs.length:1;let s=new Array(r).fill(null),i=0;for(let a of t)a.op===n?(s.splice(i,a.subs.length,...a.subs),i+=a.subs.length,this.reuse(a)):s[i++]=a;let o=this.newRegexp(n);if(o.subs=s,n===F.Op.ALTERNATE&&(o.subs=this.factor(o.subs),o.subs.length===1)){let a=o;o=o.subs[0],this.reuse(a)}return o}factor(t){if(t.length<2)return t;let n=0,r=t.length,s=0,i=null,o=0,a=0,l=0;for(let u=0;u<=r;u++){let f=null,p=0,h=0;if(u<r){let d=t[n+u];if(d.op===F.Op.CONCAT&&d.subs.length>0&&(d=d.subs[0]),d.op===F.Op.LITERAL&&(f=d.runes,p=d.runes.length,h=d.flags&G.FOLD_CASE),h===a){let m=0;for(;m<o&&m<p&&i[m]===f[m];)m++;if(m>0){o=m;continue}}}if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let d=this.newRegexp(F.Op.LITERAL);d.flags=a,d.runes=i.slice(0,o);for(let y=l;y<u;y++)t[n+y]=this.removeLeadingString(t[n+y],o),this.checkLimits(t[n+y]);let m=this.collapse(t.slice(n+l,n+u),F.Op.ALTERNATE),g=this.newRegexp(F.Op.CONCAT);g.subs=[d,m],t[s++]=g}l=u,i=f,o=p,a=h}r=s,n=0,l=0,s=0;let c=null;for(let u=0;u<=r;u++){let f=null;if(!(u<r&&(f=e.leadingRegexp(t[n+u]),c!==null&&c.equals(f)&&(e.isCharClass(c)||c.op===F.Op.REPEAT&&c.min===c.max&&e.isCharClass(c.subs[0]))))){if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let p=c;for(let m=l;m<u;m++){let g=m!==l;t[n+m]=this.removeLeadingRegexp(t[n+m],g),this.checkLimits(t[n+m])}let h=this.collapse(t.slice(n+l,n+u),F.Op.ALTERNATE),d=this.newRegexp(F.Op.CONCAT);d.subs=[p,h],t[s++]=d}l=u,c=f}}r=s,n=0,l=0,s=0;for(let u=0;u<=r;u++)if(!(u<r&&e.isCharClass(t[n+u]))){if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let f=l;for(let h=l+1;h<u;h++){let d=t[n+f],m=t[n+h];(d.op<m.op||d.op===m.op&&(d.runes!==null?d.runes.length:0)<(m.runes!==null?m.runes.length:0))&&(f=h)}let p=t[n+l];t[n+l]=t[n+f],t[n+f]=p;for(let h=l+1;h<u;h++)e.mergeCharClass(t[n+l],t[n+h]),this.reuse(t[n+h]);this.cleanAlt(t[n+l]),t[s++]=t[n+l]}u<r&&(t[s++]=t[n+u]),l=u+1}r=s,n=0,l=0,s=0;for(let u=0;u<r;++u)u+1<r&&t[n+u].op===F.Op.EMPTY_MATCH&&t[n+u+1].op===F.Op.EMPTY_MATCH||(t[s++]=t[n+u]);return r=s,n=0,t.slice(n,r)}removeLeadingString(t,n){if(t.op===F.Op.CONCAT&&t.subs.length>0){let r=this.removeLeadingString(t.subs[0],n);if(t.subs[0]=r,r.op===F.Op.EMPTY_MATCH)switch(this.reuse(r),t.subs.length){case 0:case 1:t.op=F.Op.EMPTY_MATCH,t.subs=null;break;case 2:{let s=t;t=t.subs[1],this.reuse(s);break}default:t.subs=t.subs.slice(1,t.subs.length);break}return t}return t.op===F.Op.LITERAL&&(t.runes=t.runes.slice(n,t.runes.length),t.runes.length===0&&(t.op=F.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,n){if(t.op===F.Op.CONCAT&&t.subs.length>0){switch(n&&this.reuse(t.subs[0]),t.subs=t.subs.slice(1,t.subs.length),t.subs.length){case 0:{t.op=F.Op.EMPTY_MATCH,t.subs=F.emptySubs();break}case 1:{let r=t;t=t.subs[0],this.reuse(r);break}}return t}return n&&this.reuse(t),this.newRegexp(F.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&G.LITERAL)!==0)return e.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,r=-1,s=new fl(this.wholeRegexp);for(;s.more();){let o=-1;e:switch(s.peek()){case D.CODES.get("("):if((this.flags&G.PERL_X)!==0&&s.lookingAt("(?")){this.parsePerlFlags(s);break}this.op(F.Op.LEFT_PAREN).cap=++this.numCap,s.skip(1);break;case D.CODES.get("|"):this.parseVerticalBar(),s.skip(1);break;case D.CODES.get(")"):this.parseRightParen(),s.skip(1);break;case D.CODES.get("^"):(this.flags&G.ONE_LINE)!==0?this.op(F.Op.BEGIN_TEXT):this.op(F.Op.BEGIN_LINE),s.skip(1);break;case D.CODES.get("$"):(this.flags&G.ONE_LINE)!==0?this.op(F.Op.END_TEXT).flags|=G.WAS_DOLLAR:this.op(F.Op.END_LINE),s.skip(1);break;case D.CODES.get("."):(this.flags&G.DOT_NL)!==0?this.op(F.Op.ANY_CHAR):this.op(F.Op.ANY_CHAR_NOT_NL),s.skip(1);break;case D.CODES.get("["):this.parseClass(s);break;case D.CODES.get("*"):case D.CODES.get("+"):case D.CODES.get("?"):{o=s.pos();let a=null;switch(s.pop()){case D.CODES.get("*"):a=F.Op.STAR;break;case D.CODES.get("+"):a=F.Op.PLUS;break;case D.CODES.get("?"):a=F.Op.QUEST;break}this.repeat(a,n,r,o,s,t);break}case D.CODES.get("{"):{o=s.pos();let a=e.parseRepeat(s);if(a<0){s.rewindTo(o),this.literal(s.pop());break}n=a>>16,r=(a&ue.MAX_BMP)<<16>>16,this.repeat(F.Op.REPEAT,n,r,o,s,t);break}case D.CODES.get("\\"):{let a=s.pos();if(s.skip(1),(this.flags&G.PERL_X)!==0&&s.more())switch(s.pop()){case D.CODES.get("A"):this.op(F.Op.BEGIN_TEXT);break e;case D.CODES.get("b"):this.op(F.Op.WORD_BOUNDARY);break e;case D.CODES.get("B"):this.op(F.Op.NO_WORD_BOUNDARY);break e;case D.CODES.get("C"):throw new je(e.ERR_INVALID_ESCAPE,"\\C");case D.CODES.get("Q"):{let f=s.rest(),p=f.indexOf("\\E");p>=0&&(f=f.substring(0,p)),s.skipString(f),s.skipString("\\E");let h=0;for(;h<f.length;){let d=f.codePointAt(h);this.literal(d),h+=Te.charCount(d)}break e}case D.CODES.get("z"):this.op(F.Op.END_TEXT);break e;default:s.rewindTo(a);break}let l=this.newRegexp(F.Op.CHAR_CLASS);if(l.flags=this.flags,s.lookingAt("\\p")||s.lookingAt("\\P")){let u=new Un;if(this.parseUnicodeClass(s,u)){l.runes=u.toArray(),this.push(l);break e}}let c=new Un;if(this.parsePerlClassEscape(s,c)){l.runes=c.toArray(),this.push(l);break e}s.rewindTo(a),this.reuse(l),this.literal(e.parseEscape(s));break}default:this.literal(s.pop());break}t=o}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new je(e.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(t){let n=t.pos(),r=t.rest();if(r.startsWith("(?P<")||r.startsWith("(?<")){let a=r.charAt(2)==="P"?4:3,l=r.indexOf(">");if(l<0)throw new je(e.ERR_INVALID_NAMED_CAPTURE,r);let c=r.substring(a,l);if(t.skipString(c),t.skip(a+1),!e.isValidCaptureName(c))throw new je(e.ERR_INVALID_NAMED_CAPTURE,r.substring(0,l+1));let u=this.op(F.Op.LEFT_PAREN);if(u.cap=++this.numCap,this.namedGroups[c])throw new je(e.ERR_DUPLICATE_NAMED_CAPTURE,c);this.namedGroups[c]=this.numCap,u.name=c;return}t.skip(2);let s=this.flags,i=1,o=!1;e:for(;t.more();){let a=t.pop();switch(a){case D.CODES.get("i"):s|=G.FOLD_CASE,o=!0;break;case D.CODES.get("m"):s&=-17,o=!0;break;case D.CODES.get("s"):s|=G.DOT_NL,o=!0;break;case D.CODES.get("U"):s|=G.NON_GREEDY,o=!0;break;case D.CODES.get("-"):if(i<0)break e;i=-1,s=~s,o=!1;break;case D.CODES.get(":"):case D.CODES.get(")"):if(i<0){if(!o)break e;s=~s}a===D.CODES.get(":")&&this.op(F.Op.LEFT_PAREN),this.flags=s;return;default:break e}}throw new je(e.ERR_INVALID_PERL_OP,t.from(n))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(F.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===F.Op.VERTICAL_BAR&&e.isCharClass(this.stack[t-1])&&e.isCharClass(this.stack[t-3])){let n=this.stack[t-1],r=this.stack[t-3];if(n.op>r.op){let s=r;r=n,n=s,this.stack[t-3]=r}return e.mergeCharClass(r,n),this.reuse(n),this.pop(),!0}if(t>=2){let n=this.stack[t-1],r=this.stack[t-2];if(r.op===F.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=n,this.stack[t-1]=r,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new je(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);let n=this.pop(),r=this.pop();if(r.op!==F.Op.LEFT_PAREN)throw new je(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);this.flags=r.flags,r.cap===0?this.push(n):(r.op=F.Op.CAPTURE,r.subs=[n],this.push(r))}parsePerlClassEscape(t,n){let r=t.pos();if((this.flags&G.PERL_X)===0||!t.more()||t.pop()!==D.CODES.get("\\")||!t.more())return!1;t.pop();let s=t.from(r),i=M1.has(s)?M1.get(s):null;return i===null?!1:(n.appendGroup(i,(this.flags&G.FOLD_CASE)!==0),!0)}parseNamedClass(t,n){let r=t.rest(),s=r.indexOf(":]");if(s<0)return!1;let i=r.substring(0,s+2);t.skipString(i);let o=J1.has(i)?J1.get(i):null;if(o===null)throw new je(e.ERR_INVALID_CHAR_RANGE,i);return n.appendGroup(o,(this.flags&G.FOLD_CASE)!==0),!0}parseUnicodeClass(t,n){let r=t.pos();if((this.flags&G.UNICODE_GROUPS)===0||!t.lookingAt("\\p")&&!t.lookingAt("\\P"))return!1;t.skip(1);let s=1,i=t.pop();if(i===D.CODES.get("P")&&(s=-1),!t.more())throw t.rewindTo(r),new je(e.ERR_INVALID_CHAR_RANGE,t.rest());i=t.pop();let o;if(i!==D.CODES.get("{"))o=Te.runeToString(i);else{let u=t.rest(),f=u.indexOf("}");if(f<0)throw t.rewindTo(r),new je(e.ERR_INVALID_CHAR_RANGE,t.rest());o=u.substring(0,f),t.skipString(o),t.skip(1)}o.length!==0&&o.codePointAt(0)===D.CODES.get("^")&&(s=0-s,o=o.substring(1));let a=e.unicodeTable(o);if(a===null)throw new je(e.ERR_INVALID_CHAR_RANGE,t.from(r));let l=a.first,c=a.second;if((this.flags&G.FOLD_CASE)===0||c===null)n.appendTableWithSign(l,s);else{let u=new Un().appendTable(l).appendTable(c).cleanClass().toArray();n.appendClassWithSign(u,s)}return!0}parseClass(t){let n=t.pos();t.skip(1);let r=this.newRegexp(F.Op.CHAR_CLASS);r.flags=this.flags;let s=new Un,i=1;t.more()&&t.lookingAt("^")&&(i=-1,t.skip(1),(this.flags&G.CLASS_NL)===0&&s.appendRange(D.CODES.get(`
178
178
  `),D.CODES.get(`
179
179
  `)));let o=!0;for(;!t.more()||t.peek()!==D.CODES.get("]")||o;){if(t.more()&&t.lookingAt("-")&&(this.flags&G.PERL_X)===0&&!o){let u=t.rest();if(u==="-"||!u.startsWith("-]"))throw t.rewindTo(n),new je(e.ERR_INVALID_CHAR_RANGE,t.rest())}o=!1;let a=t.pos();if(t.lookingAt("[:")){if(this.parseNamedClass(t,s))continue;t.rewindTo(a)}if(this.parseUnicodeClass(t,s)||this.parsePerlClassEscape(t,s))continue;t.rewindTo(a);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 je(e.ERR_INVALID_CHAR_RANGE,t.from(a))}(this.flags&G.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)}},hl=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}},dl=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,G.PERL,!1)}static compilePOSIX(t){return e.compileImpl(t,G.POSIX,!0)}static compileImpl(t,n,r){let s=pl.parse(t,n),i=s.maxCap();s=ul.simplify(s);let o=cl.compileRegexp(s),a=new e(t,o,i,r),[l,c]=o.prefix();return a.prefixComplete=l,a.prefix=c,a.prefixUTF8=Te.stringToUtf8ByteArray(a.prefix),a.prefix.length>0&&(a.prefixRune=a.prefix.codePointAt(0)),a.namedGroups=s.namedGroups,a}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 hl,this.dfa=new al(n)}executeEngine(t,n,r,s){if(s>0)return this.doExecuteNFA(t,n,r,s);let i=this.dfa.match(t,n,r);return i!==null?i?[]:null:this.doExecuteNFA(t,n,r,s)}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=Qs.fromMachine(t),n=!0),t.next!==r&&(t.next=r);while(!this.pooled.compareAndSet(r,t))}toString(){return this.expr}doExecuteNFA(t,n,r,s){let i=this.get(),o=!1;i?i.next!==null&&(i=Qs.fromMachine(i),o=!0):(i=Qs.fromRE2(this),o=!0),i.init(s);let a=i.match(t,n,r)?i.submatches():null;return this.put(i,o),a}match(t){return this.executeEngine(Ye.fromUTF16(t),0,G.UNANCHORED,0)!==null}matchWithGroup(t,n,r,s,i){return t instanceof lr||(t=ls.utf16(t)),this.matchMachineInput(t,n,r,s,i)}matchMachineInput(t,n,r,s,i){if(n>r)return[!1,null];let o=t.isUTF16Encoding()?Ye.fromUTF16(t.asCharSequence(),0,r):Ye.fromUTF8(t.asBytes(),0,r),a=this.executeEngine(o,n,s,2*i);return a===null?[!1,null]:[!0,a]}matchUTF8(t){return this.executeEngine(Ye.fromUTF8(t),0,G.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,o="",a=Ye.fromUTF16(t),l=0;for(;i<=t.length;){let c=this.executeEngine(a,i,G.UNANCHORED,2);if(c===null||c.length===0)break;o+=t.substring(s,c[0]),(c[1]>s||c[0]===0)&&(o+=n(t.substring(c[0],c[1])),l++),s=c[1];let u=a.step(i)&7;if(i+u>c[1]?i+=u:i+1>c[1]?i++:i=c[1],l>=r)break}return o+=t.substring(s),o}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 o=0,a=0,l=-1;for(;a<n&&o<=i;){let c=this.executeEngine(t,o,G.UNANCHORED,this.prog.numCap);if(c===null||c.length===0)break;let u=!0;if(c[1]===o){c[0]===l&&(u=!1);let f=t.step(o);f<0?o=i+1:o+=f&7}else o=c[1];l=c[1],u&&(s.push(r(this.pad(c))),a++)}return s}findUTF8(t){let n=this.executeEngine(Ye.fromUTF8(t),0,G.UNANCHORED,2);return n===null?null:t.slice(n[0],n[1])}findUTF8Index(t){let n=this.executeEngine(Ye.fromUTF8(t),0,G.UNANCHORED,2);return n===null?null:n.slice(0,2)}find(t){let n=this.executeEngine(Ye.fromUTF16(t),0,G.UNANCHORED,2);return n===null?"":t.substring(n[0],n[1])}findIndex(t){return this.executeEngine(Ye.fromUTF16(t),0,G.UNANCHORED,2)}findUTF8Submatch(t){let n=this.executeEngine(Ye.fromUTF8(t),0,G.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.executeEngine(Ye.fromUTF8(t),0,G.UNANCHORED,this.prog.numCap))}findSubmatch(t){let n=this.executeEngine(Ye.fromUTF16(t),0,G.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.executeEngine(Ye.fromUTF16(t),0,G.UNANCHORED,this.prog.numCap))}findAllUTF8(t,n){let r=this.allMatches(Ye.fromUTF8(t),n,s=>t.slice(s[0],s[1]));return r.length===0?null:r}findAllUTF8Index(t,n){let r=this.allMatches(Ye.fromUTF8(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAll(t,n){let r=this.allMatches(Ye.fromUTF16(t),n,s=>t.substring(s[0],s[1]));return r.length===0?null:r}findAllIndex(t,n){let r=this.allMatches(Ye.fromUTF16(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAllUTF8Submatch(t,n){let r=this.allMatches(Ye.fromUTF8(t),n,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=t.slice(s[2*o],s[2*o+1]));return i});return r.length===0?null:r}findAllUTF8SubmatchIndex(t,n){let r=this.allMatches(Ye.fromUTF8(t),n);return r.length===0?null:r}findAllSubmatch(t,n){let r=this.allMatches(Ye.fromUTF16(t),n,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=t.substring(s[2*o],s[2*o+1]));return i});return r.length===0?null:r}findAllSubmatchIndex(t,n){let r=this.allMatches(Ye.fromUTF16(t),n);return r.length===0?null:r}},ml=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 o=t[i];if(o==="\\"){if(i+1<s)switch(o=t[i+1],o){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(o);n+=t.substring(i+1,i+1+l),i+=l+1;continue}}}else if(o==="/"){n+="\\/",i+=1,r=!0;continue}else if(o==="("&&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 a=e.getUtf8CharSize(o);n+=t.substring(i,i+a),i+=a}return r?n:t}},cr=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 Te.quoteMeta(t)}static quoteReplacement(t,n=!1){return qi.quoteReplacement(t,n)}static translateRegExp(t){return ml.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 sl("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let s=G.PERL;(n&e.DISABLE_UNICODE_GROUPS)!==0&&(s&=-129);let i=new e(t,n);return i.re2Input=dl.compileImpl(r,s,(n&e.LONGEST_MATCH)!==0),i}static matches(t,n){return e.compile(t).testExact(n)}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.testExact(t)}matcher(t){return Array.isArray(t)&&(t=ls.utf8(t)),new qi(this,t)}test(t){return Array.isArray(t)?this.re2Input.matchUTF8(t):this.re2Input.match(t)}testExact(t){let n=Array.isArray(t)?Ye.fromUTF8(t):Ye.fromUTF16(t);return this.re2Input.executeEngine(n,0,G.ANCHOR_BOTH,0)!==null}split(t,n=0){let r=this.matcher(t),s=[],i=0,o=0;for(;r.find();){if(o===0&&r.end()===0){o=r.end();continue}if(n>0&&s.length===n-1)break;if(o===r.start()){if(n===0){i+=1,o=r.end();continue}}else for(;i>0;)s.push(""),i-=1;s.push(r.substring(o,r.start())),o=r.end()}if(n===0&&o!==r.inputLength()){for(;i>0;)s.push(""),i-=1;s.push(r.substring(o,r.inputLength()))}return(n!==0||s.length===0)&&s.push(r.substring(o,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 D3(e){let t=0;return e.includes("i")&&(t|=cr.CASE_INSENSITIVE),e.includes("m")&&(t|=cr.MULTILINE),e.includes("s")&&(t|=cr.DOTALL),t}function _3(e){return cr.translateRegExp(e)}function Q(e,t=""){return new Ki(e,t)}var Ki,Jn,np=k(()=>{"use strict";tp();Ki=class{_re2;_pattern;_flags;_global;_ignoreCase;_multiline;_lastIndex=0;_nativeRegex=null;_matcher=null;_matcherInput=null;acquireMatcher(t){return this._matcher===null?(this._matcher=this._re2.matcher(t),this._matcherInput=t,this._matcher):(this._matcherInput!==t&&(this._matcher.matcherInput.charSequence=t,this._matcherInput=t),this._matcher.reset(),this._matcher)}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=_3(t),s=D3(n);this._re2=cr.compile(r,s)}catch(r){if(r instanceof je){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.acquireMatcher(t).find()}exec(t){let n=this.acquireMatcher(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 o=i;o.index=n.start(0),o.input=t;let a=this._re2.namedGroups();if(a&&Object.keys(a).length>0){let l=Object.create(null);for(let[c,u]of Object.entries(a)){let f=n.group(u);f!==null&&(l[c]=f)}o.groups=l}return this._global&&(this._lastIndex=n.end(0),n.start(0)===n.end(0)&&this._lastIndex++),o}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,o=0,a=this._re2.groupCount(),l=this._re2.namedGroups();for(;s.find(o);){r.push(t.slice(i,s.start(0)));let c=[],u=s.group(0)??"";for(let f=1;f<=a;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),o=i,s.start(0)===s.end(0)&&o++,!this._global||o>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 o=[];o.push(n.group(0)??"");for(let l=1;l<=r;l++)o.push(n.group(l));let a=o;if(a.index=n.start(0),a.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)}a.groups=l}if(yield a,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}};Jn=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 Ze=k(()=>{"use strict";np()});function Dt(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,o=Ys.get(i);if(!o){if(o=L3(s,r.ignoreCase),Ys.size>=F3){let a=Ys.keys().next().value;a!==void 0&&Ys.delete(a)}Ys.set(i,o)}return o.test(e)}function L3(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+="$",Q(n,t?"i":"")}var F3,Ys,gl=k(()=>{"use strict";Ze();F3=2048,Ys=new Map});function Qi(e,t){let n=e.ignoreCase?t.toLowerCase():t,r=e.needles;for(let s=0;s<r.length;s++)if(n.indexOf(r[s])!==-1)return!0;return!1}function rp(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 us(e,t,n={}){let{invertMatch:r=!1,showLineNumbers:s=!1,countOnly:i=!1,countMatches:o=!1,filename:a="",onlyMatching:l=!1,beforeContext:c=0,afterContext:u=0,maxCount:f=0,contextSeparator:p="--",showColumn:h=!1,vimgrep:d=!1,showByteOffset:m=!1,replace:g=null,passthru:y=!1,multiline:w=!1,kResetGroup:b,preFilter:x}=n;if(w)return M3(e,t,{invertMatch:r,showLineNumbers:s,countOnly:i,countMatches:o,filename:a,onlyMatching:l,beforeContext:c,afterContext:u,maxCount:f,contextSeparator:p,showColumn:h,showByteOffset:m,replace:g,kResetGroup:b});let S=e.split(`
180
180
  `),v=S.length,$=v>0&&S[v-1]===""?v-1:v;if(i||o){let O=0,I=(o||l)&&!r;for(let B=0;B<$;B++){let Z=S[B];if(!(x&&!r&&!Qi(x,Z)))if(t.lastIndex=0,I)for(let ae=t.exec(Z);ae!==null;ae=t.exec(Z))O++,ae[0].length===0&&t.lastIndex++;else t.test(Z)!==r&&O++}return{output:`${a?`${a}:${O}`:String(O)}
@@ -199,7 +199,7 @@ Options:
199
199
  `};let pt=await t.fs.readFile(Re),ht=us(pt,P,{invertMatch:s,showLineNumbers:r,countOnly:i,filename:ae?Pe:"",onlyMatching:d,beforeContext:w,afterContext:b,maxCount:y,kResetGroup:C,preFilter:T});return{file:Pe,result:ht}}catch{return{error:`grep: ${Pe}: No such file or directory
200
200
  `}}}));for(let ie of ve){if(ie===null)continue;if("error"in ie&&ie.error){I+=ie.error,ie.error.includes("Is a directory")||(B=!0);continue}if(!("file"in ie)||!ie.result)continue;let{file:Pe,result:j}=ie;if(j.matched){if(L=!0,g)return{stdout:"",stderr:"",exitCode:0};o?O+=`${Pe}
201
201
  `:a||(O+=j.output)}else a?O+=`${Pe}
202
- `:i&&!o&&(O+=j.output)}}let q;return B?q=2:a?q=O.length>0?0:1:q=L?0:1,g?{stdout:"",stderr:"",exitCode:q}:{stdout:O,stderr:I,exitCode:q}}},ap=256;t8={name:"fgrep",async execute(e,t){return bl.execute(["-F",...e],t)}},n8={name:"egrep",async execute(e,t){return bl.execute(["-E",...e],t)}},r8={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},s8={name:"fgrep",flags:[],stdinType:"text",needsArgs:!0},i8={name:"egrep",flags:[],stdinType:"text",needsArgs:!0}});function up(e,t){if(Array.isArray(e))throw new TypeError(`${t}: expected object, got array`);if(Object.getPrototypeOf(e)!==null)throw new TypeError(`${t}: expected null-prototype object, got prototypal object`)}function _e(e){return!cp.has(e)}function ze(e,t,n){up(e,"safeSet"),_e(t)&&(e[t]=n)}function Bn(e,t){return up(e,"safeHasOwn"),Object.hasOwn(e,t)}function fs(e){let t=new WeakMap,n=r=>{if(r===null||typeof r!="object"||r instanceof Date)return r;let s=t.get(r);if(s!==void 0)return s;if(Array.isArray(r)){let o=[];t.set(r,o);for(let a of r)o.push(n(a));return o}let i=Object.create(null);t.set(r,i);for(let o of Object.keys(r))i[o]=n(r[o]);return i};return n(e)}function Ge(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function fp(e){return Object.assign(Object.create(null),e)}function wt(e){return Object.assign(Object.create(null),e)}function xl(...e){return Object.assign(Object.create(null),...e)}var cp,RN,Sn=k(()=>{"use strict";cp=new Set(["__proto__","constructor","prototype"]),RN=new Set([...cp,"__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])});function hp(){let e=[];for(let[t,n]of Object.entries(pp).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
+ `:i&&!o&&(O+=j.output)}}let q;return B?q=2:a?q=O.length>0?0:1:q=L?0:1,g?{stdout:"",stderr:"",exitCode:q}:{stdout:O,stderr:I,exitCode:q}}},ap=256;t8={name:"fgrep",async execute(e,t){return bl.execute(["-F",...e],t)}},n8={name:"egrep",async execute(e,t){return bl.execute(["-E",...e],t)}},r8={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},s8={name:"fgrep",flags:[],stdinType:"text",needsArgs:!0},i8={name:"egrep",flags:[],stdinType:"text",needsArgs:!0}});function up(e,t){if(Array.isArray(e))throw new TypeError(`${t}: expected object, got array`);if(Object.getPrototypeOf(e)!==null)throw new TypeError(`${t}: expected null-prototype object, got prototypal object`)}function _e(e){return!cp.has(e)}function ze(e,t,n){up(e,"safeSet"),_e(t)&&(e[t]=n)}function Wn(e,t){return up(e,"safeHasOwn"),Object.hasOwn(e,t)}function fs(e){let t=new WeakMap,n=r=>{if(r===null||typeof r!="object"||r instanceof Date)return r;let s=t.get(r);if(s!==void 0)return s;if(Array.isArray(r)){let o=[];t.set(r,o);for(let a of r)o.push(n(a));return o}let i=Object.create(null);t.set(r,i);for(let o of Object.keys(r))i[o]=n(r[o]);return i};return n(e)}function Ge(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function fp(e){return Object.assign(Object.create(null),e)}function wt(e){return Object.assign(Object.create(null),e)}function xl(...e){return Object.assign(Object.create(null),...e)}var cp,RN,Sn=k(()=>{"use strict";cp=new Set(["__proto__","constructor","prototype"]),RN=new Set([...cp,"__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])});function hp(){let e=[];for(let[t,n]of Object.entries(pp).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(`
203
203
  `)}
204
204
  `}var pp,ei,El=k(()=>{"use strict";Ze();Sn();pp=fp({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:[]}}),ei=class{types;constructor(){this.types=new Map(Object.entries(pp).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),o=this.types.get(i);if(o){let a=this.types.get(r)||{extensions:[],globs:[]};a.extensions.push(...o.extensions),a.globs.push(...o.globs),this.types.set(r,a)}}else{let i=this.types.get(r)||{extensions:[],globs:[]};if(s.startsWith("*.")&&!s.slice(2).includes("*")){let o=s.slice(1);i.extensions.includes(o)||i.extensions.push(o)}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 o of i.extensions)if(r.endsWith(o))return!0;for(let o of i.globs)if(o.includes("*")){let a=o.replace(/\./g,"\\.").replace(/\*/g,".*");if(Q(`^${a}$`,"i").test(t))return!0}else if(r===o.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(Q(`^${i}$`,"i").test(t))return!0}else if(n===s.toLowerCase())return!0}return!1}}});function dp(){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:256,maxFilesize:0,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}var mp=k(()=>{"use strict"});function o8(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 a8(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:"",stderr:`rg: invalid --max-filesize value: ${e}
205
205
  `,exitCode:1}}function gp(e){return null}function u8(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function f8(e,t,n){let r=e[t];for(let s of yp){if(r.startsWith(`--${s.long}=`)){let i=r.slice(`--${s.long}=`.length),o=eo(n,s,i);return o?{newIndex:t,error:o}:{newIndex:t}}if(s.short&&r.startsWith(`-${s.short}`)&&r.length>2){let i=r.slice(2),o=eo(n,s,i);return o?{newIndex:t,error:o}:{newIndex:t}}if(s.short&&r===`-${s.short}`||r===`--${s.long}`){if(t+1>=e.length)return null;let i=e[t+1],o=eo(n,s,i);return o?{newIndex:t+1,error:o}:{newIndex:t+1}}}return null}function p8(e){return yp.find(t=>t.short===e)}function eo(e,t,n){if(t.validate){let s=t.validate(n);if(s)return s}if(t.ignored||!t.target)return;let r=t.parse?t.parse(n):n;t.multi?e[t.target].push(r):e[t.target]=r}function h8(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 d8(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 m8(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function wp(e){let t=dp(),n=null,r=[],s=-1,i=-1,o=-1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(c.startsWith("-")&&c!=="-"){let u=d8(e,l);if(u){let{flag:g,value:y,newIndex:w}=u;g==="A"?s=Math.max(s,y):g==="B"?i=Math.max(i,y):o=y,l=w;continue}let f=m8(c);if(f!==null){t.maxCount=f;continue}let p=f8(e,l,t);if(p){if(p.error)return{success:!1,error:p.error};l=p.newIndex;continue}let h=h8(e,l);if(h){t.sort=h.value,l=h.newIndex;continue}let d=c.startsWith("--")?[c]:c.slice(1).split(""),m=!1;for(let g of d){if(c8.has(g)){t.lineNumber=!0,a=!0;continue}if(g==="u"||g==="--unrestricted"){u8(t);continue}if(g==="P"||g==="--pcre2")return{success:!1,error:{stdout:"",stderr:`rg: PCRE2 is not supported. Use standard regex syntax instead.
@@ -230,7 +230,7 @@ EXAMPLES:
230
230
  rg -t js foo Search only JavaScript files
231
231
  rg -g '*.ts' foo Search files matching glob
232
232
  rg --hidden foo Include hidden files
233
- rg -l foo List files with matches only`,options:["-e, --regexp PATTERN search for PATTERN (can be used multiple times)","-f, --file FILE read patterns from FILE, one per line","-i, --ignore-case case-insensitive search","-s, --case-sensitive case-sensitive search (overrides smart-case)","-S, --smart-case smart case (default: case-insensitive unless pattern has uppercase)","-F, --fixed-strings treat pattern as literal string","-w, --word-regexp match whole words only","-x, --line-regexp match whole lines only","-v, --invert-match select non-matching lines","-r, --replace TEXT replace matches with TEXT","-c, --count print count of matching lines per file"," --count-matches print count of individual matches per file","-l, --files-with-matches print only file names with matches"," --files-without-match print file names without matches"," --files list files that would be searched","-o, --only-matching print only matching parts","-m, --max-count NUM stop after NUM matches per file","-q, --quiet suppress output, exit 0 on match"," --stats print search statistics","-n, --line-number print line numbers (default: on)","-N, --no-line-number do not print line numbers","-I, --no-filename suppress the prefixing of file names","-0, --null use NUL as filename separator","-b, --byte-offset show byte offset of each match"," --column show column number of first match"," --vimgrep show results in vimgrep format"," --json show results in JSON Lines format","-A NUM print NUM lines after each match","-B NUM print NUM lines before each match","-C NUM print NUM lines before and after each match"," --context-separator SEP separator for context groups (default: --)","-U, --multiline match patterns across lines","-z, --search-zip search in compressed files (gzip only)","-g, --glob GLOB include files matching GLOB","-t, --type TYPE only search files of TYPE (e.g., js, py, ts)","-T, --type-not TYPE exclude files of TYPE","-L, --follow follow symbolic links","-u, --unrestricted reduce filtering (-u: no ignore, -uu: +hidden, -uuu: +binary)","-a, --text search binary files as text"," --hidden search hidden files and directories"," --no-ignore don't respect .gitignore/.ignore files","-d, --max-depth NUM maximum search depth"," --sort TYPE sort files (path, none)"," --heading show file path above matches"," --passthru print all lines (non-matches use - separator)"," --include-zero include files with 0 matches in count output"," --type-list list all available file types"," --help display this help and exit"]},N8={name:"rg",async execute(e,t){if(U(e))return M(k8);if(e.includes("--type-list"))return{stdout:hp(),stderr:"",exitCode:0};let n=wp(e);return n.success?Ep({ctx:t,options:n.options,paths:n.paths,explicitLineNumbers:n.explicitLineNumbers}):n.error}},I8={name:"rg",flags:[{flag:"-i",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-N",type:"boolean"},{flag:"--hidden",type:"boolean"},{flag:"--no-ignore",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:"-g",type:"value",valueHint:"pattern"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-T",type:"value",valueHint:"string"}],needsArgs:!0}});function it(e,t,n){if(!e||Et.isInSandboxedContext())return;let r=`${t} ${n} attempted outside defense context`;throw new me(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:Et.getCurrentExecutionId()})}async function _t(e,t,n,r){it(e,t,`${n} (pre-await)`);let s=await r();return it(e,t,`${n} (post-await)`),s}var Wn=k(()=>{"use strict";un()});function Cl(e){let t="",n=0,r=!1;for(;n<e.length;){if(e[n]==="["&&!r){if(e[n+1]==="["&&e[n+2]===":"){let s=e.indexOf(":]]",n+3);if(s!==-1){let i=e.slice(n+3,s),o=Sl.get(i);if(o){t+=`[${o}]`,n=s+3;continue}}}if(e[n+1]==="^"&&e[n+2]==="["&&e[n+3]===":"){let s=e.indexOf(":]]",n+4);if(s!==-1){let i=e.slice(n+4,s),o=Sl.get(i);if(o){t+=`[^${o}]`,n=s+3;continue}}}t+="[",n++,r=!0,n<e.length&&e[n]==="^"&&(t+="^",n++),n<e.length&&e[n]==="]"&&(t+="\\]",n++);continue}if(r){if(e[n]==="]"){t+="]",n++,r=!1;continue}if(e[n]==="["&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s),o=Sl.get(i);if(o){t+=o,n=s+2;continue}}}if(e[n]==="\\"&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++;continue}if(e[n]==="\\"&&n+1<e.length){let s=e[n+1];if(s==="+"||s==="?"||s==="|"){t+=s,n+=2;continue}if(s==="("||s===")"){t+=s,n+=2;continue}if(s==="{"||s==="}"){t+=s,n+=2;continue}if(s==="t"){t+=" ",n+=2;continue}if(s==="n"){t+=`
233
+ rg -l foo List files with matches only`,options:["-e, --regexp PATTERN search for PATTERN (can be used multiple times)","-f, --file FILE read patterns from FILE, one per line","-i, --ignore-case case-insensitive search","-s, --case-sensitive case-sensitive search (overrides smart-case)","-S, --smart-case smart case (default: case-insensitive unless pattern has uppercase)","-F, --fixed-strings treat pattern as literal string","-w, --word-regexp match whole words only","-x, --line-regexp match whole lines only","-v, --invert-match select non-matching lines","-r, --replace TEXT replace matches with TEXT","-c, --count print count of matching lines per file"," --count-matches print count of individual matches per file","-l, --files-with-matches print only file names with matches"," --files-without-match print file names without matches"," --files list files that would be searched","-o, --only-matching print only matching parts","-m, --max-count NUM stop after NUM matches per file","-q, --quiet suppress output, exit 0 on match"," --stats print search statistics","-n, --line-number print line numbers (default: on)","-N, --no-line-number do not print line numbers","-I, --no-filename suppress the prefixing of file names","-0, --null use NUL as filename separator","-b, --byte-offset show byte offset of each match"," --column show column number of first match"," --vimgrep show results in vimgrep format"," --json show results in JSON Lines format","-A NUM print NUM lines after each match","-B NUM print NUM lines before each match","-C NUM print NUM lines before and after each match"," --context-separator SEP separator for context groups (default: --)","-U, --multiline match patterns across lines","-z, --search-zip search in compressed files (gzip only)","-g, --glob GLOB include files matching GLOB","-t, --type TYPE only search files of TYPE (e.g., js, py, ts)","-T, --type-not TYPE exclude files of TYPE","-L, --follow follow symbolic links","-u, --unrestricted reduce filtering (-u: no ignore, -uu: +hidden, -uuu: +binary)","-a, --text search binary files as text"," --hidden search hidden files and directories"," --no-ignore don't respect .gitignore/.ignore files","-d, --max-depth NUM maximum search depth"," --sort TYPE sort files (path, none)"," --heading show file path above matches"," --passthru print all lines (non-matches use - separator)"," --include-zero include files with 0 matches in count output"," --type-list list all available file types"," --help display this help and exit"]},N8={name:"rg",async execute(e,t){if(U(e))return M(k8);if(e.includes("--type-list"))return{stdout:hp(),stderr:"",exitCode:0};let n=wp(e);return n.success?Ep({ctx:t,options:n.options,paths:n.paths,explicitLineNumbers:n.explicitLineNumbers}):n.error}},I8={name:"rg",flags:[{flag:"-i",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-N",type:"boolean"},{flag:"--hidden",type:"boolean"},{flag:"--no-ignore",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:"-g",type:"value",valueHint:"pattern"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-T",type:"value",valueHint:"string"}],needsArgs:!0}});function it(e,t,n){if(!e||Et.isInSandboxedContext())return;let r=`${t} ${n} attempted outside defense context`;throw new me(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:Et.getCurrentExecutionId()})}async function _t(e,t,n,r){it(e,t,`${n} (pre-await)`);let s=await r();return it(e,t,`${n} (post-await)`),s}var zn=k(()=>{"use strict";un()});function Cl(e){let t="",n=0,r=!1;for(;n<e.length;){if(e[n]==="["&&!r){if(e[n+1]==="["&&e[n+2]===":"){let s=e.indexOf(":]]",n+3);if(s!==-1){let i=e.slice(n+3,s),o=Sl.get(i);if(o){t+=`[${o}]`,n=s+3;continue}}}if(e[n+1]==="^"&&e[n+2]==="["&&e[n+3]===":"){let s=e.indexOf(":]]",n+4);if(s!==-1){let i=e.slice(n+4,s),o=Sl.get(i);if(o){t+=`[^${o}]`,n=s+3;continue}}}t+="[",n++,r=!0,n<e.length&&e[n]==="^"&&(t+="^",n++),n<e.length&&e[n]==="]"&&(t+="\\]",n++);continue}if(r){if(e[n]==="]"){t+="]",n++,r=!1;continue}if(e[n]==="["&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s),o=Sl.get(i);if(o){t+=o,n=s+2;continue}}}if(e[n]==="\\"&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++;continue}if(e[n]==="\\"&&n+1<e.length){let s=e[n+1];if(s==="+"||s==="?"||s==="|"){t+=s,n+=2;continue}if(s==="("||s===")"){t+=s,n+=2;continue}if(s==="{"||s==="}"){t+=s,n+=2;continue}if(s==="t"){t+=" ",n+=2;continue}if(s==="n"){t+=`
234
234
  `,n+=2;continue}if(s==="r"){t+="\r",n+=2;continue}t+=e[n]+s,n+=2;continue}if(e[n]==="+"||e[n]==="?"||e[n]==="|"||e[n]==="("||e[n]===")"){t+=`\\${e[n]}`,n++;continue}if(e[n]==="^"&&!(t===""||t.endsWith("("))){t+="\\^",n++;continue}if(e[n]==="$"){let s=n===e.length-1,i=n+2<e.length&&e[n+1]==="\\"&&e[n+2]===")";if(!s&&!i){t+="\\$",n++;continue}}t+=e[n],n++}return t}function vl(e){let t="",n=!1;for(let r=0;r<e.length;r++)e[r]==="["&&!n?(n=!0,t+="[",r++,r<e.length&&e[r]==="^"&&(t+="^",r++),r<e.length&&e[r]==="]"&&(t+="]",r++),r--):e[r]==="]"&&n?(n=!1,t+="]"):!n&&e[r]==="{"&&e[r+1]===","?(t+="{0,",r++):t+=e[r];return t}function Ip(e){let t="";for(let n=0;n<e.length;n++){let r=e[n],s=r.charCodeAt(0);r==="\\"?t+="\\\\":r===" "?t+="\\t":r===`
235
235
  `?t+=`$
236
236
  `:r==="\r"?t+="\\r":r==="\x07"?t+="\\a":r==="\b"?t+="\\b":r==="\f"?t+="\\f":r==="\v"?t+="\\v":s<32||s>=127?t+=`\\${s.toString(8).padStart(3,"0")}`:t+=r}return`${t}$`}var Sl,$p=k(()=>{"use strict";Sl=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 Op(e,t,n){return{patternSpace:"",holdSpace:"",lineNumber:0,totalLines:e,deleted:!1,printed:!1,quit:!1,quitSilent:!1,exitCode:void 0,errorMessage:void 0,appendBuffer:[],substitutionMade:!1,lineNumberOutput:[],nCommandOutput:[],restartCycle:!1,inDRestartedCycle:!1,currentFilename:t,pendingFileReads:[],pendingFileWrites:[],rangeStates:n||new Map,linesConsumedInCycle:0}}function T8(e){return typeof e=="object"&&"first"in e&&"step"in e}function O8(e){return typeof e=="object"&&"offset"in e}function hs(e,t,n,r,s){if(e==="$")return t===n;if(typeof e=="number")return t===e;if(T8(e)){let{first:i,step:o}=e;return o===0?t===i:(t-i)%o===0&&t>=i}if(typeof e=="object"&&"pattern"in e)try{let i=e.pattern;i===""&&s?.lastPattern?i=s.lastPattern:i!==""&&s&&(s.lastPattern=i);let o=vl(Cl(i));return Q(o).test(r)}catch{return!1}return!1}function kl(e){let t=n=>n===void 0?"undefined":n==="$"?"$":typeof n=="number"?String(n):"pattern"in n?`/${n.pattern}/`:"first"in n?`${n.first}~${n.step}`:"unknown";return`${t(e.start)},${t(e.end)}`}function R8(e,t,n,r,s,i){if(!e||!e.start&&!e.end)return!0;let o=e.start,a=e.end;if(o!==void 0&&a===void 0)return hs(o,t,n,r,i);if(o!==void 0&&a!==void 0){let l=typeof o=="object"&&"pattern"in o,c=typeof a=="object"&&"pattern"in a,u=O8(a);if(u&&s){let p=kl(e),h=s.get(p);if(h||(h={active:!1},s.set(p,h)),h.active){let d=h.startLine||t;return t>=d+a.offset&&(h.active=!1,s.set(p,h)),!0}else return hs(o,t,n,r,i)?(h.active=!0,h.startLine=t,s.set(p,h),a.offset===0&&(h.active=!1,s.set(p,h)),!0):!1}if(!l&&!c&&!u){let p=typeof o=="number"?o:o==="$"?n:1,h=typeof a=="number"?a:n;if(p<=h)return t>=p&&t<=h;if(s){let d=kl(e),m=s.get(d);return m||(m={active:!1},s.set(d,m)),!m.completed&&t>=p?(m.completed=!0,s.set(d,m),!0):!1}return!1}if(s){let p=kl(e),h=s.get(p);if(h||(h={active:!1},s.set(p,h)),h.active)return hs(a,t,n,r,i)&&(h.active=!1,typeof o=="number"&&(h.completed=!0),s.set(p,h)),!0;{if(h.completed)return!1;let d=!1;return typeof o=="number"?d=t>=o:d=hs(o,t,n,r,i),d?(h.active=!0,h.startLine=t,s.set(p,h),hs(a,t,n,r,i)&&(h.active=!1,typeof o=="number"&&(h.completed=!0),s.set(p,h)),!0):!1}}return hs(o,t,n,r,i)}return!0}function Pr(e,t,n,r,s,i){let o=R8(e,t,n,r,s,i);return e?.negated?!o:o}function P8(e,t,n,r){let s="",i=0,o=!1;for(;i<=e.length;){t.lastIndex=i;let a=t.exec(e);if(!a){s+=e.slice(i);break}if(a.index!==i){s+=e.slice(i,a.index),i=a.index,o=!1;continue}let l=a[0],c=a.slice(1);if(o&&l.length===0){if(i<e.length)s+=e[i],i++;else break;o=!1;continue}if(s+=r(l,c),o=!1,l.length===0)if(i<e.length)s+=e[i],i++;else break;else i+=l.length,o=!0}return s}function Nl(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;continue}if(i==="n"){r+=`
@@ -283,7 +283,7 @@ ${c}`}else s.push(c)}let i=s.join(`
283
283
  `),ae=!0):C.changedText!==void 0&&(w(`${C.changedText}
284
284
  `),ae=!0);for(let q of Z)w(`${q}
285
285
  `);if(g=(L||ae)&&Z.length===0,C.quit||C.quitSilent){if(C.exitCode!==void 0&&(m=C.exitCode),C.errorMessage)return{output:"",exitCode:m||1,errorMessage:C.errorMessage};break}}if(o&&a)for(let[P,C]of _)try{await u("flush pending file writes",()=>o.writeFile(P,C))}catch(T){if(T instanceof me)throw T}return!f&&g&&d.endsWith(`
286
- `)&&(d=d.slice(0,-1)),{output:d,exitCode:m}}var L8,M8,U8,Up=k(()=>{"use strict";he();En();Ae();Wn();un();oe();Rp();Lp();L8={name:"sed",summary:"stream editor for filtering and transforming text",usage:"sed [OPTION]... {script} [input-file]...",options:["-n, --quiet, --silent suppress automatic printing of pattern space","-e script add the script to commands to be executed","-f script-file read script from file","-i, --in-place edit files in place","-E, -r, --regexp-extended use extended regular expressions"," --help display this help and exit"],description:`Commands:
286
+ `)&&(d=d.slice(0,-1)),{output:d,exitCode:m}}var L8,M8,U8,Up=k(()=>{"use strict";he();En();Ae();zn();un();oe();Rp();Lp();L8={name:"sed",summary:"stream editor for filtering and transforming text",usage:"sed [OPTION]... {script} [input-file]...",options:["-n, --quiet, --silent suppress automatic printing of pattern space","-e script add the script to commands to be executed","-f script-file read script from file","-i, --in-place edit files in place","-E, -r, --regexp-extended use extended regular expressions"," --help display this help and exit"],description:`Commands:
287
287
  s/regexp/replacement/[flags] substitute
288
288
  d delete pattern space
289
289
  p print pattern space
@@ -333,7 +333,7 @@ Addresses:
333
333
  `,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 X8(e,t,n){return e.length===0?"":vt(await n.evalExpr(e[0])).toLowerCase()}async function Y8(e,t,n){return e.length===0?"":vt(await n.evalExpr(e[0])).toUpperCase()}async function J8(e,t,n){if(e.length===0)return"";let r=vt(await n.evalExpr(e[0])),s=[];for(let i=1;i<e.length;i++)s.push(await n.evalExpr(e[i]));return ro(r,s)}async function e9(e,t,n){return e.length===0?0:Math.floor(hn(await n.evalExpr(e[0])))}async function t9(e,t,n){return e.length===0?0:Math.sqrt(hn(await n.evalExpr(e[0])))}async function n9(e,t,n){return e.length===0?0:Math.sin(hn(await n.evalExpr(e[0])))}async function r9(e,t,n){return e.length===0?0:Math.cos(hn(await n.evalExpr(e[0])))}async function s9(e,t,n){let r=e.length>0?hn(await n.evalExpr(e[0])):0,s=e.length>1?hn(await n.evalExpr(e[1])):0;return Math.atan2(r,s)}async function i9(e,t,n){return e.length===0?0:Math.log(hn(await n.evalExpr(e[0])))}async function o9(e,t,n){return e.length===0?1:Math.exp(hn(await n.evalExpr(e[0])))}function a9(e,t,n){return t.random?t.random():Math.random()}async function l9(e,t,n){let r=e.length>0?hn(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=r,r}function c9(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function Rl(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}function ro(e,t){let n=0,r="",s=0;for(;s<e.length;)if(e[s]==="%"&&s+1<e.length){let i=s+1,o="",a="",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]);)o+=e[i++];if(e[i]==="*"){let m=t[n++],g=m!==void 0?Math.floor(Number(m)):0;g<0?(o+="-",a=String(Math.min(-g,_r))):a=String(Math.min(g,_r)),i++}else for(;i<e.length&&/\d/.test(e[i]);)a+=e[i++];if(a&&parseInt(a,10)>_r&&(a=String(_r)),e[i]==="."){if(i++,e[i]==="*"){let m=t[n++];l=String(Math.min(m!==void 0?Math.floor(Number(m)):0,_r)),i++}else for(;i<e.length&&/\d/.test(e[i]);)l+=e[i++];l&&parseInt(l,10)>_r&&(l=String(_r))}f();let p=e[i],d=t[c!==void 0?c:n];switch(p){case"s":{let m=d!==void 0?String(d):"";if(l&&(m=m.substring(0,parseInt(l,10))),a){let g=parseInt(a,10);o.includes("-")?m=m.padEnd(g):m=m.padStart(g)}r+=m,c===void 0&&n++;break}case"d":case"i":{let m=d!==void 0?Math.floor(Number(d)):0;Number.isNaN(m)&&(m=0);let g=m<0,y=Math.abs(m).toString();if(l){let x=parseInt(l,10);y=y.padStart(x,"0")}let w="";g?w="-":o.includes("+")?w="+":o.includes(" ")&&(w=" ");let b=w+y;if(a){let x=parseInt(a,10);o.includes("-")?b=b.padEnd(x):o.includes("0")&&!l?b=w+y.padStart(x-w.length,"0"):b=b.padStart(x)}r+=b,c===void 0&&n++;break}case"f":{let m=d!==void 0?Number(d):0;Number.isNaN(m)&&(m=0);let g=l?parseInt(l,10):6,y=m.toFixed(g);if(a){let w=parseInt(a,10);o.includes("-")?y=y.padEnd(w):y=y.padStart(w)}r+=y,c===void 0&&n++;break}case"e":case"E":{let m=d!==void 0?Number(d):0;Number.isNaN(m)&&(m=0);let g=l?parseInt(l,10):6,y=m.toExponential(g);if(p==="E"&&(y=y.toUpperCase()),a){let w=parseInt(a,10);o.includes("-")?y=y.padEnd(w):y=y.padStart(w)}r+=y,c===void 0&&n++;break}case"g":case"G":{let m=d!==void 0?Number(d):0;Number.isNaN(m)&&(m=0);let g=l?parseInt(l,10):6,y=m!==0?Math.floor(Math.log10(Math.abs(m))):0,w;if(m===0?w="0":y<-4||y>=g?(w=m.toExponential(g-1),p==="G"&&(w=w.toUpperCase())):w=m.toPrecision(g),w.includes(".")&&(w=w.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),w.includes("e")&&(w=w.replace(/\.?0+e/,"e")),a){let b=parseInt(a,10);o.includes("-")?w=w.padEnd(b):w=w.padStart(b)}r+=w,c===void 0&&n++;break}case"x":case"X":{let m=d!==void 0?Math.floor(Number(d)):0;Number.isNaN(m)&&(m=0);let g=Math.abs(m).toString(16);if(p==="X"&&(g=g.toUpperCase()),l){let b=parseInt(l,10);g=g.padStart(b,"0")}let y=m<0?"-":"",w=y+g;if(a){let b=parseInt(a,10);o.includes("-")?w=w.padEnd(b):o.includes("0")&&!l?w=y+g.padStart(b-y.length,"0"):w=w.padStart(b)}r+=w,c===void 0&&n++;break}case"o":{let m=d!==void 0?Math.floor(Number(d)):0;Number.isNaN(m)&&(m=0);let g=Math.abs(m).toString(8);if(l){let b=parseInt(l,10);g=g.padStart(b,"0")}let y=m<0?"-":"",w=y+g;if(a){let b=parseInt(a,10);o.includes("-")?w=w.padEnd(b):o.includes("0")&&!l?w=y+g.padStart(b-y.length,"0"):w=w.padStart(b)}r+=w,c===void 0&&n++;break}case"c":{typeof d=="number"?r+=String.fromCharCode(d):r+=String(d??"").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+=`
334
334
  `;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 _r,Zp,Pl=k(()=>{"use strict";Ze();_r=1e4;Zp=new Map([["length",H8],["substr",j8],["index",G8],["split",V8],["sub",q8],["gsub",Z8],["match",K8],["gensub",Q8],["tolower",X8],["toupper",Y8],["sprintf",J8],["int",e9],["sqrt",t9],["sin",n9],["cos",r9],["atan2",s9],["log",i9],["exp",o9],["rand",a9],["srand",l9],["system",c9("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",Rl("systime")],["mktime",Rl("mktime")],["strftime",Rl("strftime")]])});function Ft(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function tt(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function Me(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function Dl(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function ri(e,t){try{return Q(e).test(t)}catch{return!1}}var ds=k(()=>{"use strict";Ze()});function Kp(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function so(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function _l(e,t,n){if(t===0)e.line=Me(n),e.fields=Kp(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=Me(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function ms(e,t){e.line=t,e.fields=Kp(e,t),e.NF=e.fields.length}function Qp(e,t){if(e.FS=t,t===" ")e.fieldSep=new Jn(/\s+/);else try{e.fieldSep=Q(t)}catch{e.fieldSep=Q(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}var io=k(()=>{"use strict";Ze();ds()});function oo(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 gs(e,t,n){switch(t){case"FS":Qp(e,Me(n));return;case"OFS":e.OFS=Me(n);return;case"ORS":e.ORS=Me(n);return;case"OFMT":e.OFMT=Me(n);return;case"NR":e.NR=Math.floor(tt(n));return;case"NF":{let r=Math.floor(tt(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(tt(n));return;case"FILENAME":e.FILENAME=Me(n);return;case"RSTART":e.RSTART=Math.floor(tt(n));return;case"RLENGTH":e.RLENGTH=Math.floor(tt(n));return;case"SUBSEP":e.SUBSEP=Me(n);return}e.vars[t]=n}function si(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 ao(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let r=si(e,t);return e.arrays[r]?.[n]??""}function Fl(e,t,n,r){let s=si(e,t);e.arrays[s]||(e.arrays[s]=Object.create(null)),e.arrays[s][n]=r}function Xp(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let r=si(e,t);return e.arrays[r]?.[n]!==void 0}function Yp(e,t,n){let r=si(e,t);e.arrays[r]&&delete e.arrays[r][n]}function Jp(e,t){let n=si(e,t);delete e.arrays[n]}var Ll=k(()=>{"use strict";io();ds()});function th(e){eh=e}function jt(e,t){it(e.requireDefenseContext,"awk",t)}function Fe(e,t,n){return _t(e.requireDefenseContext,"awk",t,n)}async function fe(e,t){switch(jt(e,"expression evaluation"),e.coverage?.hit(`awk:expr:${t.type}`),t.type){case"number":return t.value;case"string":return t.value;case"regex":return ri(t.pattern,e.line)?1:0;case"field":return u9(e,t);case"variable":return oo(e,t.name);case"array_access":return f9(e,t);case"binary":return p9(e,t);case"unary":return m9(e,t);case"ternary":return Ft(await Fe(e,"ternary condition evaluation",()=>fe(e,t.condition)))?await Fe(e,"ternary consequent evaluation",()=>fe(e,t.consequent)):await Fe(e,"ternary alternate evaluation",()=>fe(e,t.alternate));case"call":return g9(e,t.name,t.args);case"assignment":return w9(e,t);case"pre_increment":return b9(e,t.operand);case"pre_decrement":return x9(e,t.operand);case"post_increment":return E9(e,t.operand);case"post_decrement":return A9(e,t.operand);case"in":return S9(e,t.key,t.array);case"getline":return C9(e,t.variable,t.file,t.command);case"tuple":return N9(e,t.elements);default:return""}}async function u9(e,t){jt(e,"field reference evaluation");let n=Math.floor(tt(await Fe(e,"field index evaluation",()=>fe(e,t.index))));return so(e,n)}async function f9(e,t){jt(e,"array access evaluation");let n=Me(await Fe(e,"array key evaluation",()=>fe(e,t.key)));return ao(e,t.array,n)}async function p9(e,t){jt(e,"binary expression evaluation");let n=t.operator;if(n==="||")return Ft(await Fe(e,"logical-or left evaluation",()=>fe(e,t.left)))||Ft(await Fe(e,"logical-or right evaluation",()=>fe(e,t.right)))?1:0;if(n==="&&")return Ft(await Fe(e,"logical-and left evaluation",()=>fe(e,t.left)))&&Ft(await Fe(e,"logical-and right evaluation",()=>fe(e,t.right)))?1:0;if(n==="~"){let a=await Fe(e,"regex left evaluation",()=>fe(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:Me(await Fe(e,"regex right evaluation",()=>fe(e,t.right)));try{return Q(l).test(Me(a))?1:0}catch{return 0}}if(n==="!~"){let a=await Fe(e,"negated-regex left evaluation",()=>fe(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:Me(await Fe(e,"negated-regex right evaluation",()=>fe(e,t.right)));try{return Q(l).test(Me(a))?0:1}catch{return 1}}let r=await Fe(e,"binary left evaluation",()=>fe(e,t.left)),s=await Fe(e,"binary right evaluation",()=>fe(e,t.right));if(n===" "){let a=Me(r)+Me(s);if(e.maxOutputSize>0&&a.length>e.maxOutputSize)throw new X(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return a}if(h9(n))return d9(r,s,n);let i=tt(r),o=tt(s);return Wp(i,o,n)}function h9(e){return["<","<=",">",">=","==","!="].includes(e)}function d9(e,t,n){let r=Dl(e),s=Dl(t);if(r&&s){let a=tt(e),l=tt(t);switch(n){case"<":return a<l?1:0;case"<=":return a<=l?1:0;case">":return a>l?1:0;case">=":return a>=l?1:0;case"==":return a===l?1:0;case"!=":return a!==l?1:0}}let i=Me(e),o=Me(t);switch(n){case"<":return i<o?1:0;case"<=":return i<=o?1:0;case">":return i>o?1:0;case">=":return i>=o?1:0;case"==":return i===o?1:0;case"!=":return i!==o?1:0}return 0}async function m9(e,t){jt(e,"unary expression evaluation");let n=await Fe(e,"unary operand evaluation",()=>fe(e,t.operand));switch(t.operator){case"!":return Ft(n)?0:1;case"-":return-tt(n);case"+":return+tt(n);default:return n}}async function g9(e,t,n){jt(e,"function call evaluation");let r=Zp.get(t);if(r)return r(n,e,{evalExpr:i=>fe(e,i)});let s=e.functions.get(t);return s?y9(e,s,n):""}async function y9(e,t,n){if(jt(e,"user function call"),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new X(`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 l=t.params[a];if(a<n.length){let c=n[a];c.type==="variable"&&(e.arrayAliases.set(l,c.name),s.push(l));let u=await Fe(e,"user function argument evaluation",()=>fe(e,c));e.vars[l]=u}else e.vars[l]=""}e.hasReturn=!1,e.returnValue=void 0;let i=eh;i&&await Fe(e,"user function body execution",()=>i(e,t.body.statements));let o=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--,o}async function w9(e,t){jt(e,"assignment evaluation");let n=await Fe(e,"assignment value evaluation",()=>fe(e,t.value)),r=t.target,s=t.operator,i;if(s==="=")i=n;else{let o;if(r.type==="field"){let c=Math.floor(tt(await Fe(e,"assignment field index",()=>fe(e,r.index))));o=so(e,c)}else if(r.type==="variable")o=oo(e,r.name);else{let c=Me(await Fe(e,"assignment array key",()=>fe(e,r.key)));o=ao(e,r.array,c)}let a=tt(o),l=tt(n);switch(s){case"+=":i=a+l;break;case"-=":i=a-l;break;case"*=":i=a*l;break;case"/=":i=l!==0?a/l:0;break;case"%=":i=l!==0?a%l:0;break;case"^=":i=a**l;break;default:i=n}}if(r.type==="field"){let o=Math.floor(tt(await Fe(e,"assignment target field index",()=>fe(e,r.index))));_l(e,o,i)}else if(r.type==="variable")gs(e,r.name,i);else{let o=Me(await Fe(e,"assignment target array key",()=>fe(e,r.key)));Fl(e,r.array,o,i)}return i}async function lo(e,t,n,r){jt(e,"inc/dec evaluation");let s;if(t.type==="field"){let i=Math.floor(tt(await Fe(e,"inc/dec field index",()=>fe(e,t.index))));s=tt(so(e,i)),_l(e,i,s+n)}else if(t.type==="variable")s=tt(oo(e,t.name)),gs(e,t.name,s+n);else{let i=Me(await Fe(e,"inc/dec array key",()=>fe(e,t.key)));s=tt(ao(e,t.array,i)),Fl(e,t.array,i,s+n)}return r?s+n:s}async function b9(e,t){return lo(e,t,1,!0)}async function x9(e,t){return lo(e,t,-1,!0)}async function E9(e,t){return lo(e,t,1,!1)}async function A9(e,t){return lo(e,t,-1,!1)}async function S9(e,t,n){jt(e,"in-expression evaluation");let r;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let s=[];for(let i of t.elements)s.push(Me(await Fe(e,"tuple key element evaluation",()=>fe(e,i))));r=s.join(e.SUBSEP)}else r=Me(await Fe(e,"in-expression key evaluation",()=>fe(e,t)));return Xp(e,n,r)?1:0}async function C9(e,t,n,r){if(jt(e,"getline evaluation"),r)return v9(e,t,r);if(n)return k9(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?gs(e,t,i):ms(e,i),e.NR++,e.lineIndex=s,1}async function v9(e,t,n){let r=e.exec;if(!r)return-1;jt(e,"getline command source");let s=Me(await Fe(e,"getline command expression",()=>fe(e,n))),i=`__cmd_${s}`,o=`__cmdi_${s}`,a,l;if(e.vars[i]===void 0)try{let f=await Fe(e,"getline command exec",()=>r(s));a=se(f.stdout).split(`
335
335
  `),a.length>0&&a[a.length-1]===""&&a.pop(),e.vars[i]=JSON.stringify(a),e.vars[o]=-1,l=-1}catch(f){if(f instanceof me)throw f;return-1}else a=JSON.parse(e.vars[i]),l=e.vars[o];let c=l+1;if(c>=a.length)return 0;let u=a[c];return e.vars[o]=c,t?gs(e,t,u):ms(e,u),1}async function k9(e,t,n){let r=e.fs;if(!r||!e.cwd)return-1;jt(e,"getline file source");let s=Me(await Fe(e,"getline filename evaluation",()=>fe(e,n)));if(s==="/dev/null")return 0;let i=r.resolvePath(e.cwd,s),o=`__fc_${i}`,a=`__fi_${i}`,l,c;if(e.vars[o]===void 0)try{l=(await Fe(e,"getline file read",()=>r.readFile(i))).split(`
336
- `),l.length>0&&l[l.length-1]===""&&l.pop(),e.vars[o]=JSON.stringify(l),e.vars[a]=-1,c=-1}catch(p){if(p instanceof me)throw p;return-1}else l=JSON.parse(e.vars[o]),c=e.vars[a];let u=c+1;if(u>=l.length)return 0;let f=l[u];return e.vars[a]=u,t?gs(e,t,f):ms(e,f),1}async function N9(e,t){if(jt(e,"tuple evaluation"),t.length===0)return"";for(let n=0;n<t.length-1;n++)await Fe(e,"tuple intermediate element",()=>fe(e,t[n]));return Fe(e,"tuple final element",()=>fe(e,t[t.length-1]))}var eh,Ml=k(()=>{"use strict";he();Ae();Ze();Wn();un();zp();Pl();io();ds();Ll();eh=null});function Ul(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new X(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}function vn(e,t){it(e.requireDefenseContext,"awk",t)}function Oe(e,t,n){return _t(e.requireDefenseContext,"awk",t,n)}async function ys(e,t){vn(e,"block execution");for(let n of t)if(await Oe(e,"statement execution",()=>Fr(e,n)),I9(e))break}function I9(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function Fr(e,t){switch(vn(e,"single statement execution"),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await Oe(e,"nested block statement",()=>ys(e,t.statements));break;case"expr_stmt":await Oe(e,"expression statement",()=>fe(e,t.expression));break;case"print":await Oe(e,"print statement",()=>$9(e,t.args,t.output));break;case"printf":await Oe(e,"printf statement",()=>T9(e,t.format,t.args,t.output));break;case"if":await Oe(e,"if statement",()=>O9(e,t));break;case"while":await Oe(e,"while statement",()=>R9(e,t));break;case"do_while":await Oe(e,"do-while statement",()=>P9(e,t));break;case"for":await Oe(e,"for statement",()=>D9(e,t));break;case"for_in":await Oe(e,"for-in statement",()=>_9(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;{let n=t.code;e.exitCode=n?Math.floor(tt(await Oe(e,"exit code expression",()=>fe(e,n)))):0}break;case"return":e.hasReturn=!0;{let n=t.value;e.returnValue=n?await Oe(e,"return expression",()=>fe(e,n)):""}break;case"delete":await Oe(e,"delete statement",()=>F9(e,t.target));break}}async function $9(e,t,n){vn(e,"print execution");let r=[];for(let i of t){let o=await Oe(e,"print argument evaluation",()=>fe(e,i));typeof o=="number"?Number.isInteger(o)&&Math.abs(o)<Number.MAX_SAFE_INTEGER?r.push(String(o)):r.push(ro(e.OFMT,[o])):r.push(Me(o))}let s=r.join(e.OFS)+e.ORS;n?await Oe(e,"print redirection write",()=>nh(e,n.redirect,n.file,s)):(e.output+=s,Ul(e))}async function T9(e,t,n,r){vn(e,"printf execution");let s=Me(await Oe(e,"printf format evaluation",()=>fe(e,t))),i=[];for(let a of n)i.push(await Oe(e,"printf argument evaluation",()=>fe(e,a)));let o=ro(s,i);r?await Oe(e,"printf redirection write",()=>nh(e,r.redirect,r.file,o)):(e.output+=o,Ul(e))}async function nh(e,t,n,r){vn(e,"file write execution");let s=e.fs;if(!s||!e.cwd){e.output+=r,Ul(e);return}let i=Me(await Oe(e,"redirection filename evaluation",()=>fe(e,n))),o=s.resolvePath(e.cwd,i);t===">"?e.openedFiles.has(o)?await Oe(e,"redirection append write",()=>s.appendFile(o,r)):(await Oe(e,"redirection overwrite write",()=>s.writeFile(o,r)),e.openedFiles.add(o)):(e.openedFiles.has(o)||e.openedFiles.add(o),await Oe(e,"redirection append mode write",()=>s.appendFile(o,r)))}async function O9(e,t){if(vn(e,"if execution"),Ft(await Oe(e,"if condition evaluation",()=>fe(e,t.condition))))await Oe(e,"if consequent execution",()=>Fr(e,t.consequent));else if(t.alternate){let n=t.alternate;await Oe(e,"if alternate execution",()=>Fr(e,n))}}async function R9(e,t){vn(e,"while execution");let n=0;for(;Ft(await Oe(e,"while condition evaluation",()=>fe(e,t.condition)));){if(n++,n>e.maxIterations)throw new X(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Oe(e,"while body execution",()=>Fr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function P9(e,t){vn(e,"do-while execution");let n=0;do{if(n++,n>e.maxIterations)throw new X(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Oe(e,"do-while body execution",()=>Fr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(Ft(await Oe(e,"do-while condition evaluation",()=>fe(e,t.condition))))}async function D9(e,t){vn(e,"for execution");let n=t.init,r=t.condition,s=t.update;n&&await Oe(e,"for init evaluation",()=>fe(e,n));let i=0;for(;!r||Ft(await Oe(e,"for condition evaluation",()=>fe(e,r)));){if(i++,i>e.maxIterations)throw new X(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Oe(e,"for body execution",()=>Fr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;s&&await Oe(e,"for update evaluation",()=>fe(e,s))}}async function _9(e,t){vn(e,"for-in execution");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 Oe(e,"for-in body execution",()=>Fr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function F9(e,t){if(vn(e,"delete execution"),t.type==="array_access"){let n=Me(await Oe(e,"delete key evaluation",()=>fe(e,t.key)));Yp(e,t.array,n)}else t.type==="variable"&&Jp(e,t.name)}var rh=k(()=>{"use strict";Ae();Wn();Pl();Ml();ds();Ll();th(ys)});var ii,sh=k(()=>{"use strict";Wn();Ml();io();rh();ds();ii=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}assertDefenseContext(t){it(this.ctx.requireDefenseContext,"awk",t)}withDefenseContext(t,n){return _t(this.ctx.requireDefenseContext,"awk",t,n)}execute(t){this.assertDefenseContext("program initialization"),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.assertDefenseContext("BEGIN execution entry"),!!this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await this.withDefenseContext("BEGIN block execution",()=>ys(this.ctx,t.action.statements)),this.ctx.shouldExit))break}}async executeLine(t){if(this.assertDefenseContext("line execution entry"),!(!this.program||this.ctx.shouldExit)){ms(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.withDefenseContext("rule match",()=>this.matchesRule(r,n))&&await this.withDefenseContext("rule block execution",()=>ys(this.ctx,r.action.statements))}}}async executeEnd(){if(this.assertDefenseContext("END execution entry"),!!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 this.withDefenseContext("END block execution",()=>ys(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){this.assertDefenseContext("rule matching");let r=t.pattern;if(!r)return!0;switch(r.type){case"begin":case"end":return!1;case"regex_pattern":return ri(r.pattern,this.ctx.line);case"expr_pattern":return Ft(await this.withDefenseContext("expression pattern evaluation",()=>fe(this.ctx,r.expression)));case"range":{let s=await this.withDefenseContext("range start pattern",()=>this.matchPattern(r.start)),i=await this.withDefenseContext("range end pattern",()=>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(this.assertDefenseContext("pattern matching"),t.type){case"regex_pattern":return ri(t.pattern,this.ctx.line);case"expr_pattern":return Ft(await this.withDefenseContext("nested expression pattern",()=>fe(this.ctx,t.expression)));default:return!1}}}});var ih=k(()=>{"use strict";Bp();sh()});function M9(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,L9,U9,co,oh=k(()=>{"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={}));L9=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]]);U9=new Set([A.COMMA,A.LBRACE,A.AND,A.OR,A.QUESTION,A.COLON,A.DO,A.ELSE,A.IF,A.WHILE]),co=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
+ `),l.length>0&&l[l.length-1]===""&&l.pop(),e.vars[o]=JSON.stringify(l),e.vars[a]=-1,c=-1}catch(p){if(p instanceof me)throw p;return-1}else l=JSON.parse(e.vars[o]),c=e.vars[a];let u=c+1;if(u>=l.length)return 0;let f=l[u];return e.vars[a]=u,t?gs(e,t,f):ms(e,f),1}async function N9(e,t){if(jt(e,"tuple evaluation"),t.length===0)return"";for(let n=0;n<t.length-1;n++)await Fe(e,"tuple intermediate element",()=>fe(e,t[n]));return Fe(e,"tuple final element",()=>fe(e,t[t.length-1]))}var eh,Ml=k(()=>{"use strict";he();Ae();Ze();zn();un();zp();Pl();io();ds();Ll();eh=null});function Ul(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new X(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}function vn(e,t){it(e.requireDefenseContext,"awk",t)}function Oe(e,t,n){return _t(e.requireDefenseContext,"awk",t,n)}async function ys(e,t){vn(e,"block execution");for(let n of t)if(await Oe(e,"statement execution",()=>Fr(e,n)),I9(e))break}function I9(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function Fr(e,t){switch(vn(e,"single statement execution"),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await Oe(e,"nested block statement",()=>ys(e,t.statements));break;case"expr_stmt":await Oe(e,"expression statement",()=>fe(e,t.expression));break;case"print":await Oe(e,"print statement",()=>$9(e,t.args,t.output));break;case"printf":await Oe(e,"printf statement",()=>T9(e,t.format,t.args,t.output));break;case"if":await Oe(e,"if statement",()=>O9(e,t));break;case"while":await Oe(e,"while statement",()=>R9(e,t));break;case"do_while":await Oe(e,"do-while statement",()=>P9(e,t));break;case"for":await Oe(e,"for statement",()=>D9(e,t));break;case"for_in":await Oe(e,"for-in statement",()=>_9(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;{let n=t.code;e.exitCode=n?Math.floor(tt(await Oe(e,"exit code expression",()=>fe(e,n)))):0}break;case"return":e.hasReturn=!0;{let n=t.value;e.returnValue=n?await Oe(e,"return expression",()=>fe(e,n)):""}break;case"delete":await Oe(e,"delete statement",()=>F9(e,t.target));break}}async function $9(e,t,n){vn(e,"print execution");let r=[];for(let i of t){let o=await Oe(e,"print argument evaluation",()=>fe(e,i));typeof o=="number"?Number.isInteger(o)&&Math.abs(o)<Number.MAX_SAFE_INTEGER?r.push(String(o)):r.push(ro(e.OFMT,[o])):r.push(Me(o))}let s=r.join(e.OFS)+e.ORS;n?await Oe(e,"print redirection write",()=>nh(e,n.redirect,n.file,s)):(e.output+=s,Ul(e))}async function T9(e,t,n,r){vn(e,"printf execution");let s=Me(await Oe(e,"printf format evaluation",()=>fe(e,t))),i=[];for(let a of n)i.push(await Oe(e,"printf argument evaluation",()=>fe(e,a)));let o=ro(s,i);r?await Oe(e,"printf redirection write",()=>nh(e,r.redirect,r.file,o)):(e.output+=o,Ul(e))}async function nh(e,t,n,r){vn(e,"file write execution");let s=e.fs;if(!s||!e.cwd){e.output+=r,Ul(e);return}let i=Me(await Oe(e,"redirection filename evaluation",()=>fe(e,n))),o=s.resolvePath(e.cwd,i);t===">"?e.openedFiles.has(o)?await Oe(e,"redirection append write",()=>s.appendFile(o,r)):(await Oe(e,"redirection overwrite write",()=>s.writeFile(o,r)),e.openedFiles.add(o)):(e.openedFiles.has(o)||e.openedFiles.add(o),await Oe(e,"redirection append mode write",()=>s.appendFile(o,r)))}async function O9(e,t){if(vn(e,"if execution"),Ft(await Oe(e,"if condition evaluation",()=>fe(e,t.condition))))await Oe(e,"if consequent execution",()=>Fr(e,t.consequent));else if(t.alternate){let n=t.alternate;await Oe(e,"if alternate execution",()=>Fr(e,n))}}async function R9(e,t){vn(e,"while execution");let n=0;for(;Ft(await Oe(e,"while condition evaluation",()=>fe(e,t.condition)));){if(n++,n>e.maxIterations)throw new X(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Oe(e,"while body execution",()=>Fr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function P9(e,t){vn(e,"do-while execution");let n=0;do{if(n++,n>e.maxIterations)throw new X(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Oe(e,"do-while body execution",()=>Fr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(Ft(await Oe(e,"do-while condition evaluation",()=>fe(e,t.condition))))}async function D9(e,t){vn(e,"for execution");let n=t.init,r=t.condition,s=t.update;n&&await Oe(e,"for init evaluation",()=>fe(e,n));let i=0;for(;!r||Ft(await Oe(e,"for condition evaluation",()=>fe(e,r)));){if(i++,i>e.maxIterations)throw new X(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Oe(e,"for body execution",()=>Fr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;s&&await Oe(e,"for update evaluation",()=>fe(e,s))}}async function _9(e,t){vn(e,"for-in execution");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 Oe(e,"for-in body execution",()=>Fr(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function F9(e,t){if(vn(e,"delete execution"),t.type==="array_access"){let n=Me(await Oe(e,"delete key evaluation",()=>fe(e,t.key)));Yp(e,t.array,n)}else t.type==="variable"&&Jp(e,t.name)}var rh=k(()=>{"use strict";Ae();zn();Pl();Ml();ds();Ll();th(ys)});var ii,sh=k(()=>{"use strict";zn();Ml();io();rh();ds();ii=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}assertDefenseContext(t){it(this.ctx.requireDefenseContext,"awk",t)}withDefenseContext(t,n){return _t(this.ctx.requireDefenseContext,"awk",t,n)}execute(t){this.assertDefenseContext("program initialization"),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.assertDefenseContext("BEGIN execution entry"),!!this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await this.withDefenseContext("BEGIN block execution",()=>ys(this.ctx,t.action.statements)),this.ctx.shouldExit))break}}async executeLine(t){if(this.assertDefenseContext("line execution entry"),!(!this.program||this.ctx.shouldExit)){ms(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.withDefenseContext("rule match",()=>this.matchesRule(r,n))&&await this.withDefenseContext("rule block execution",()=>ys(this.ctx,r.action.statements))}}}async executeEnd(){if(this.assertDefenseContext("END execution entry"),!!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 this.withDefenseContext("END block execution",()=>ys(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){this.assertDefenseContext("rule matching");let r=t.pattern;if(!r)return!0;switch(r.type){case"begin":case"end":return!1;case"regex_pattern":return ri(r.pattern,this.ctx.line);case"expr_pattern":return Ft(await this.withDefenseContext("expression pattern evaluation",()=>fe(this.ctx,r.expression)));case"range":{let s=await this.withDefenseContext("range start pattern",()=>this.matchPattern(r.start)),i=await this.withDefenseContext("range end pattern",()=>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(this.assertDefenseContext("pattern matching"),t.type){case"regex_pattern":return ri(t.pattern,this.ctx.line);case"expr_pattern":return Ft(await this.withDefenseContext("nested expression pattern",()=>fe(this.ctx,t.expression)));default:return!1}}}});var ih=k(()=>{"use strict";Bp();sh()});function M9(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,L9,U9,co,oh=k(()=>{"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={}));L9=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]]);U9=new Set([A.COMMA,A.LBRACE,A.AND,A.OR,A.QUESTION,A.COLON,A.DO,A.ELSE,A.IF,A.WHILE]),co=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===`
337
337
  `?(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)===`
338
338
  `)this.advance(),this.advance();else break;else if(t==="#")for(;this.pos<this.input.length&&this.peek()!==`
339
339
  `;)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===`
@@ -341,7 +341,7 @@ Addresses:
341
341
  `,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+=`
342
342
  `;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()===`
343
343
  `)break;r+=this.advance()}return this.peek()==="/"&&this.advance(),r=M9(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=L9.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 fh(e){e.expect(Y.PRINT);let t=[];if(e.check(Y.NEWLINE)||e.check(Y.SEMICOLON)||e.check(Y.RBRACE)||e.check(Y.PIPE)||e.check(Y.GT)||e.check(Y.APPEND))t.push({type:"field",index:{type:"number",value:0}});else for(t.push(uo(e));e.check(Y.COMMA);)e.advance(),t.push(uo(e));let n;return e.check(Y.GT)?(e.advance(),n={redirect:">",file:e.parsePrimary()}):e.check(Y.APPEND)&&(e.advance(),n={redirect:">>",file:e.parsePrimary()}),{type:"print",args:t,output:n}}function uo(e){return B9(e)?Bl(e,!0):Bl(e,!1)}function Bl(e,t){let n=t?e.parseTernary():W9(e);if(e.match(Y.ASSIGN,Y.PLUS_ASSIGN,Y.MINUS_ASSIGN,Y.STAR_ASSIGN,Y.SLASH_ASSIGN,Y.PERCENT_ASSIGN,Y.CARET_ASSIGN)){let r=e.advance(),s=Bl(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 B9(e){let t=0,n=e.pos;for(;n<e.tokens.length;){let r=e.tokens[n];if(r.type===Y.LPAREN&&t++,r.type===Y.RPAREN&&t--,r.type===Y.QUESTION&&t===0)return!0;if(r.type===Y.NEWLINE||r.type===Y.SEMICOLON||r.type===Y.RBRACE||r.type===Y.COMMA||r.type===Y.PIPE)return!1;n++}return!1}function W9(e){let t=ah(e);for(;e.check(Y.OR);){e.advance();let n=ah(e);t={type:"binary",operator:"||",left:t,right:n}}return t}function ah(e){let t=lh(e);for(;e.check(Y.AND);){e.advance();let n=lh(e);t={type:"binary",operator:"&&",left:t,right:n}}return t}function lh(e){let t=z9(e);if(e.check(Y.IN)){e.advance();let n=String(e.expect(Y.IDENT).value);return{type:"in",key:t,array:n}}return t}function z9(e){let t=ch(e);for(;H9(e)&&!j9(e);){let n=ch(e);t={type:"binary",operator:" ",left:t,right:n}}return t}function ch(e){let t=uh(e);for(;e.match(Y.MATCH,Y.NOT_MATCH);){let n=e.advance().type===Y.MATCH?"~":"!~",r=uh(e);t={type:"binary",operator:n,left:t,right:r}}return t}function uh(e){let t=e.parseAddSub();for(;e.match(Y.LT,Y.LE,Y.GE,Y.EQ,Y.NE);){let n=e.advance(),r=e.parseAddSub();t={type:"binary",operator:new Map([["<","<"],["<=","<="],[">=",">="],["==","=="],["!=","!="]]).get(n.value)??"==",left:t,right:r}}return t}function H9(e){return e.match(Y.NUMBER,Y.STRING,Y.IDENT,Y.DOLLAR,Y.LPAREN,Y.NOT,Y.MINUS,Y.PLUS,Y.INCREMENT,Y.DECREMENT)}function j9(e){return e.match(Y.AND,Y.OR,Y.QUESTION,Y.ASSIGN,Y.PLUS_ASSIGN,Y.MINUS_ASSIGN,Y.STAR_ASSIGN,Y.SLASH_ASSIGN,Y.PERCENT_ASSIGN,Y.CARET_ASSIGN,Y.COMMA,Y.SEMICOLON,Y.NEWLINE,Y.RBRACE,Y.RPAREN,Y.RBRACKET,Y.COLON,Y.PIPE,Y.APPEND,Y.GT,Y.IN)}function ph(e){e.expect(Y.PRINTF);let t=e.check(Y.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():uo(e),r=[];for(;e.check(Y.COMMA);)e.advance(),t&&e.skipNewlines(),r.push(t?e.parseExpression():uo(e));t&&(e.skipNewlines(),e.expect(Y.RPAREN));let s;return e.check(Y.GT)?(e.advance(),s={redirect:">",file:e.parsePrimary()}):e.check(Y.APPEND)&&(e.advance(),s={redirect:">>",file:e.parsePrimary()}),{type:"printf",format:n,args:r,output:s}}var Y,hh=k(()=>{"use strict";Y={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 fo,dh=k(()=>{"use strict";oh();hh();fo=class{tokens=[];pos=0;parse(t){let n=new co(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)?fh(this):this.check(A.PRINTF)?ph(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 o=this.expect(A.IDENT).value;this.expect(A.RPAREN),this.skipNewlines();let a=this.parseStatement();return{type:"for_in",variable:i.value,array:o,body:a}}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");let s=new Set(["=","+=","-=","*=","/=","%=","^="]),i=n.value;if(!s.has(i))throw new Error(`Unknown assignment operator: ${i}`);return{type:"assignment",operator:i,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,o)=>({type:"binary",operator:" ",left:{type:"binary",operator:" ",left:i,right:{type:"variable",name:"SUBSEP"}},right:o}));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 yh={};ee(yh,{awkCommand2:()=>V9,flagsForFuzzing:()=>q9});function Wl(e){return e.replace(/\\t/g," ").replace(/\\n/g,`
344
- `).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\a/g,"\x07").replace(/\\v/g,"\v").replace(/\\\\/g,"\\")}function mh(e){if(e===" ")return Q("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return Q(e)}catch{return Q(gh(e))}return Q(gh(e))}function gh(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var G9,V9,q9,wh=k(()=>{"use strict";he();er();Ae();Ze();Wn();un();oe();ih();dh();G9={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"]},V9={name:"awk",async execute(e,t){it(t.requireDefenseContext,"awk","execution entry");let n=(y,w)=>_t(t.requireDefenseContext,"awk",y,w);if(U(e))return M(G9);let r=new Jn(/\s+/),s=" ",i=Object.create(null),o=0;for(let y=0;y<e.length;y++){let w=e[y];if(w==="-F"&&y+1<e.length)s=Wl(e[++y]),r=mh(s),o=y+1;else if(w.startsWith("-F"))s=Wl(w.slice(2)),r=mh(s),o=y+1;else if(w==="-v"&&y+1<e.length){let b=e[++y],x=b.indexOf("=");if(x>0){let S=b.slice(0,x),v=Wl(b.slice(x+1));i[S]=v}o=y+1}else{if(w.startsWith("--"))return K("awk",w);if(w.startsWith("-")&&w.length>1){let b=w[1];if(b!=="F"&&b!=="v")return K("awk",`-${b}`);o=y+1}else if(!w.startsWith("-")){o=y;break}}}if(o>=e.length)return{stdout:"",stderr:`awk: missing program
344
+ `).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\a/g,"\x07").replace(/\\v/g,"\v").replace(/\\\\/g,"\\")}function mh(e){if(e===" ")return Q("\\s+");if(/[[\](){}.*+?^$|\\]/.test(e))try{return Q(e)}catch{return Q(gh(e))}return Q(gh(e))}function gh(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var G9,V9,q9,wh=k(()=>{"use strict";he();er();Ae();Ze();zn();un();oe();ih();dh();G9={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"]},V9={name:"awk",async execute(e,t){it(t.requireDefenseContext,"awk","execution entry");let n=(y,w)=>_t(t.requireDefenseContext,"awk",y,w);if(U(e))return M(G9);let r=new Jn(/\s+/),s=" ",i=Object.create(null),o=0;for(let y=0;y<e.length;y++){let w=e[y];if(w==="-F"&&y+1<e.length)s=Wl(e[++y]),r=mh(s),o=y+1;else if(w.startsWith("-F"))s=Wl(w.slice(2)),r=mh(s),o=y+1;else if(w==="-v"&&y+1<e.length){let b=e[++y],x=b.indexOf("=");if(x>0){let S=b.slice(0,x),v=Wl(b.slice(x+1));i[S]=v}o=y+1}else{if(w.startsWith("--"))return K("awk",w);if(w.startsWith("-")&&w.length>1){let b=w[1];if(b!=="F"&&b!=="v")return K("awk",`-${b}`);o=y+1}else if(!w.startsWith("-")){o=y;break}}}if(o>=e.length)return{stdout:"",stderr:`awk: missing program
345
345
  `,exitCode:1};let a=e[o],l=e.slice(o+1),c=new fo,u;try{u=c.parse(a)}catch(y){return{stdout:"",stderr:`awk: ${y instanceof Error?y.message:String(y)}
346
346
  `,exitCode:1}}let f={readFile:t.fs.readFile.bind(t.fs),writeFile:t.fs.writeFile.bind(t.fs),appendFile:async(y,w)=>{try{let b=await n("appendFile read",()=>t.fs.readFile(y));await n("appendFile write",()=>t.fs.writeFile(y,b+w))}catch(b){if(b instanceof me)throw b;await n("appendFile create",()=>t.fs.writeFile(y,w))}},resolvePath:t.fs.resolvePath.bind(t.fs)},p=t.exec,h=Ol({fieldSep:r,maxIterations:t.limits?.maxAwkIterations,maxOutputSize:t.limits?.maxStringLength,fs:f,cwd:t.cwd,exec:p?y=>n("command pipe exec",()=>p(y,{cwd:t.cwd,signal:t.signal})):void 0,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext});h.FS=s,h.vars=Object.assign(Object.create(null),i),h.ARGC=l.length+1,h.ARGV=Object.create(null),h.ARGV[0]="awk";for(let y=0;y<l.length;y++)h.ARGV[String(y+1)]=l[y];h.ENVIRON=Ct(t.env);let d=new ii(h);d.execute(u);let m=u.rules.some(y=>y.pattern?.type!=="begin"&&y.pattern?.type!=="end"),g=u.rules.some(y=>y.pattern?.type==="end");try{if(await n("BEGIN execution",()=>d.executeBegin()),h.shouldExit)return await n("END execution after BEGIN exit",()=>d.executeEnd()),{stdout:d.getOutput(),stderr:"",exitCode:d.getExitCode()};if(!m&&!g)return{stdout:d.getOutput(),stderr:"",exitCode:d.getExitCode()};let y=[];if(l.length>0)for(let w of l)try{let b=t.fs.resolvePath(t.cwd,w),S=(await n("input file read",()=>t.fs.readFile(b))).split(`
347
347
  `);S.length>0&&S[S.length-1]===""&&S.pop(),y.push({filename:w,lines:S})}catch(b){if(b instanceof me)throw b;return{stdout:"",stderr:`awk: ${w}: No such file or directory
@@ -477,7 +477,7 @@ Try 'comm --help' for more information.
477
477
  `};n.mode="chunks",n.chunks=u,s+=2}else if(c.match(/^-n\d+$/)){let u=Number.parseInt(c.slice(2),10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid number of chunks: '${c.slice(2)}'
478
478
  `};n.mode="chunks",n.chunks=u,s++}else if(c==="-a"&&s+1<e.length){let u=Number.parseInt(e[s+1],10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${e[s+1]}'
479
479
  `};n.suffixLength=u,s+=2}else if(c.match(/^-a\d+$/)){let u=Number.parseInt(c.slice(2),10);if(Number.isNaN(u)||u<1)return{exitCode:1,stdout:"",stderr:`split: invalid suffix length: '${c.slice(2)}'
480
- `};n.suffixLength=u,s++}else if(c==="-d"||c==="--numeric-suffixes")n.useNumericSuffix=!0,s++;else if(c.startsWith("--additional-suffix="))n.additionalSuffix=c.slice(20),s++;else if(c==="--additional-suffix"&&s+1<e.length)n.additionalSuffix=e[s+1],s+=2;else if(c==="--"){r.push(...e.slice(s+1));break}else{if(c.startsWith("-")&&c!=="-")return K("split",c);r.push(c),s++}}let i="-",o="x";r.length>=1&&(i=r[0]),r.length>=2&&(o=r[1]);let a;if(i==="-")a=t.stdin??"";else{let c=t.fs.resolvePath(t.cwd,i);try{let u=await _n(t.fs,c);a=u}catch{return{exitCode:1,stdout:"",stderr:`split: ${i}: No such file or directory
480
+ `};n.suffixLength=u,s++}else if(c==="-d"||c==="--numeric-suffixes")n.useNumericSuffix=!0,s++;else if(c.startsWith("--additional-suffix="))n.additionalSuffix=c.slice(20),s++;else if(c==="--additional-suffix"&&s+1<e.length)n.additionalSuffix=e[s+1],s+=2;else if(c==="--"){r.push(...e.slice(s+1));break}else{if(c.startsWith("-")&&c!=="-")return K("split",c);r.push(c),s++}}let i="-",o="x";r.length>=1&&(i=r[0]),r.length>=2&&(o=r[1]);let a;if(i==="-")a=t.stdin??"";else{let c=t.fs.resolvePath(t.cwd,i);try{let u=await Fn(t.fs,c);a=u}catch{return{exitCode:1,stdout:"",stderr:`split: ${i}: No such file or directory
481
481
  `}}}if(a==="")return{exitCode:0,stdout:"",stderr:""};let l;switch(n.mode){case"lines":l=Qw(a,n.lines);break;case"bytes":l=Xw(a,n.bytes);break;case"chunks":l=Yw(a,n.chunks);break;default:return n.mode}if(l.length>od)return{exitCode:1,stdout:"",stderr:`split: too many output files (${l.length}), limit is ${od}
482
482
  `};for(let c=0;c<l.length;c++){let u=l[c];if(!u.hasContent)continue;let f=Kw(c,n.useNumericSuffix,n.suffixLength),p=`${o}${f}${n.additionalSuffix}`,h=t.fs.resolvePath(t.cwd,p);await t.fs.writeFile(h,u.content,"binary")}return{exitCode:0,stdout:"",stderr:""}}},eb={name:"split",flags:[{flag:"-l",type:"value",valueHint:"number"},{flag:"-b",type:"value",valueHint:"string"},{flag:"-n",type:"value",valueHint:"number"},{flag:"-d",type:"boolean"},{flag:"-a",type:"value",valueHint:"number"}],needsFiles:!0}});var fd={};ee(fd,{column:()=>ob,flagsForFuzzing:()=>ab});function ud(e,t,n){return t?n?e.split(t):e.split(t).filter(r=>r.length>0):n?e.split(/[ \t]/):e.split(/[ \t]+/).filter(r=>r.length>0)}function rb(e){let t=[];for(let n of e)for(let r=0;r<n.length;r++){let s=n[r].length;(t[r]===void 0||s>t[r])&&(t[r]=s)}return t}function sb(e,t){if(e.length===0)return"";let n=rb(e),r=[];for(let s of e){let i=[];for(let o=0;o<s.length;o++)o===s.length-1?i.push(s[o]):i.push(s[o].padEnd(n[o]));r.push(i.join(t))}return r.join(`
483
483
  `)}function ib(e,t,n){if(e.length===0)return"";let r=Math.max(...e.map(c=>c.length)),s=n.length,i=r+s,o=Math.max(1,Math.floor((t+s)/i)),a=Math.ceil(e.length/o),l=[];for(let c=0;c<a;c++){let u=[];for(let f=0;f<o;f++){let p=f*a+c;p<e.length&&(f===o-1||(f+1)*a+c>=e.length?u.push(e[p]):u.push(e[p].padEnd(r)))}l.push(u.join(n))}return l.join(`
@@ -495,7 +495,7 @@ Try 'comm --help' for more information.
495
495
  `};let i=[];for(let p of r)if(p==="-")i.push(se(t.stdin)??"");else{let h=t.fs.resolvePath(t.cwd,p),d=await t.fs.readFile(h);if(d===null)return{exitCode:1,stdout:"",stderr:`join: ${p}: No such file or directory
496
496
  `};i.push(d)}let o=(p,h)=>{let d=p.split(`
497
497
  `);return p.endsWith(`
498
- `)&&d[d.length-1]===""&&d.pop(),d.filter(m=>m.length>0).map(m=>ub(m,n.separator,h,n.ignoreCase))},a=o(i[0],n.field1),l=o(i[1],n.field2),c=new Map;for(let p of l){let h=c.get(p.joinKey);h?h.push(p):c.set(p.joinKey,[p])}let u=[],f=new Set;for(let p of a){let h=c.get(p.joinKey);if(h&&h.length>0){if(f.add(p.joinKey),n.onlyUnpairable.size===0)for(let d of h)u.push(Hl(p,d,n))}else(n.printUnpairable.has(1)||n.onlyUnpairable.has(1))&&u.push(Hl(p,null,n))}if(n.printUnpairable.has(2)||n.onlyUnpairable.has(2))for(let p of l)f.has(p.joinKey)||u.push(Hl(null,p,n));return{exitCode:0,stdout:Dn(u.length>0?`${u.join(`
498
+ `)&&d[d.length-1]===""&&d.pop(),d.filter(m=>m.length>0).map(m=>ub(m,n.separator,h,n.ignoreCase))},a=o(i[0],n.field1),l=o(i[1],n.field2),c=new Map;for(let p of l){let h=c.get(p.joinKey);h?h.push(p):c.set(p.joinKey,[p])}let u=[],f=new Set;for(let p of a){let h=c.get(p.joinKey);if(h&&h.length>0){if(f.add(p.joinKey),n.onlyUnpairable.size===0)for(let d of h)u.push(Hl(p,d,n))}else(n.printUnpairable.has(1)||n.onlyUnpairable.has(1))&&u.push(Hl(p,null,n))}if(n.printUnpairable.has(2)||n.onlyUnpairable.has(2))for(let p of l)f.has(p.joinKey)||u.push(Hl(null,p,n));return{exitCode:0,stdout:_n(u.length>0?`${u.join(`
499
499
  `)}
500
500
  `:""),stderr:"",stdoutEncoding:"binary"}}},hb={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 md={};ee(md,{flagsForFuzzing:()=>yb,teeCommand:()=>gb});var db,mb,gb,yb,gd=k(()=>{"use strict";he();at();oe();db={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"]},mb={append:{short:"a",long:"append",type:"boolean"}},gb={name:"tee",async execute(e,t){if(U(e))return M(db);let n=Se("tee",e,mb);if(!n.ok)return n.error;let{append:r}=n.result.flags,s=n.result.positional,i=t.stdin,o="",a=0;for(let l of s)try{let c=t.fs.resolvePath(t.cwd,l);r?await t.fs.appendFile(c,i,"binary"):await t.fs.writeFile(c,i,"binary")}catch{o+=`tee: ${l}: No such file or directory
501
501
  `,a=1}return{stdout:i,stderr:o,exitCode:a,stdoutEncoding:"binary"}}},yb={name:"tee",flags:[{flag:"-a",type:"boolean"}],stdinType:"text",needsArgs:!0}});function dn(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:Dt(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,r=t.relativePath,s=n.split("/");for(let o=0;o<s.length-1;o++){let a=s[o];if(a&&a!=="."&&a!==".."&&!a.includes("*")&&!a.includes("?")&&!a.includes("[")){let l=`/${a}/`;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 o=i[1];if(e.ignoreCase){if(!r.toLowerCase().endsWith(o.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(o))return{matches:!1,pruned:!1,printed:!1}}return{matches:Dt(r,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:Q(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=dn(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case"and":{let n=dn(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let r=dn(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:n.printed||r.printed}}case"or":{let n=dn(e.left,t);if(n.matches)return n;let r=dn(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:r.printed}}}}function oi(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 oi(e.expr);case"and":case"or":return oi(e.left)||oi(e.right)}}function ai(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return ai(e.expr);case"and":case"or":return ai(e.left)||ai(e.right);default:return!1}}function yd(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=wb(e);if(bb(e)&&n.length===1){let i=n[0].split("/").filter(o=>o.length>0);if(i.length>=2)for(let o=i.length-2;o>=0;o--){let a=i[o];if(!a.includes("*")&&!a.includes("?")&&!a.includes("[")&&a!=="."&&a!==".."){let l=i[o+1];if(l&&(l.includes("*")||l.includes("?"))){t.terminalDirName=a;let c=l.match(/^\*(\.[a-zA-Z0-9]+)$/);c&&(t.requiredExtension=c[1])}break}}}return t}function wb(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 bb(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 wd(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 li(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 li(e.expr);case"and":case"or":return li(e.left)&&li(e.right)}}function Lr(e,t,n,r,s){switch(e.type){case"name":{let i=e.pattern,o=i.match(/^\*(\.[a-zA-Z0-9]+)$/);if(o){let a=o[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(a.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(a))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Dt(t,i,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let i=e.pattern,o=i.split("/");for(let l=0;l<o.length-1;l++){let c=o[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 a=i.match(/\*(\.[a-zA-Z0-9]+)$/);if(a){let l=a[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:Dt(n,i,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let i=e.ignoreCase?"i":"";return{matches:Q(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=Lr(e.expr,t,n,r,s);return{matches:!i.matches,pruned:i.pruned,printed:!1}}case"and":{let i=Lr(e.left,t,n,r,s);if(!i.matches)return{matches:!1,pruned:i.pruned,printed:!1};let o=Lr(e.right,t,n,r,s);return{matches:o.matches,pruned:i.pruned||o.pruned,printed:i.printed||o.printed}}case"or":{let i=Lr(e.left,t,n,r,s);if(i.matches)return i;let o=Lr(e.right,t,n,r,s);return{matches:o.matches,pruned:i.pruned||o.pruned,printed:o.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function ci(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return ci(e.expr);case"and":case"or":return ci(e.left)||ci(e.right);default:return!1}}function ur(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 ur(e.expr);case"and":case"or":return ur(e.left)&&ur(e.right)}}function bd(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!ur(e))return jl(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:dn(e,n).pruned}}function jl(e,t){switch(e.type){case"or":{if(ur(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(dn(e.left,n).pruned)return{shouldPrune:!0}}return jl(e.right,t)}case"and":{if(ur(e.left)&&ur(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:dn(e,n).pruned}}if(ur(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 dn(e.left,n).matches?jl(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}var xd=k(()=>{"use strict";Ze();gl()});function Ed(e,t){let n=[],r=[],s=t;for(;s<e.length;){let o=e[s];if(o==="("||o==="\\("){n.push({type:"lparen"}),s++;continue}if(o===")"||o==="\\)"){n.push({type:"rparen"}),s++;continue}if(o==="-name"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s]}});else if(o==="-iname"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}});else if(o==="-path"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s]}});else if(o==="-ipath"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}});else if(o==="-regex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}});else if(o==="-iregex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}});else if(o==="-type"&&s+1<e.length){let a=e[++s];if(a==="f"||a==="d")n.push({type:"expr",expr:{type:"type",fileType:a}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${a}
@@ -550,8 +550,8 @@ ${a} director${a===1?"y":"ies"}`,r.directoriesOnly||(i+=`, ${l} file${l===1?"":"
550
550
  `,exitCode:1};let s=Dr(r.exportedEnv||{},{0:t,"#":String(n.length),"@":n.join(" "),"*":n.join(" ")});n.forEach((a,l)=>{s[String(l+1)]=a});let i=e;if(i.startsWith("#!")){let a=i.indexOf(`
551
551
  `);a!==-1&&(i=i.slice(a+1))}return await r.exec(i,{env:s,cwd:r.cwd,stdin:r.stdin,stdinKind:"bytes",signal:r.signal})}var Hd,g5,y5,w5,b5,Yl=k(()=>{"use strict";he();er();oe();Hd={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).']},g5={name:"bash",async execute(e,t){if(U(e))return M(Hd);if(e[0]==="-c"&&e.length>=2){let s=e[1],i=e[2]||"bash",o=e.slice(3);return bs(s,i,o,t)}if(e.length===0){let s=se(t.stdin);return s.trim()?bs(s,"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 bs(i,n,r,t)}catch{return{stdout:"",stderr:`bash: ${n}: No such file or directory
552
552
  `,exitCode:127}}}},y5={name:"sh",async execute(e,t){if(U(e))return M({...Hd,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",o=e.slice(3);return bs(s,i,o,t)}if(e.length===0){let s=se(t.stdin);return s.trim()?bs(s,"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 bs(i,n,r,t)}catch{return{stdout:"",stderr:`sh: ${n}: No such file or directory
553
- `,exitCode:127}}}};w5={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},b5={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"}});function Jl(e,t,n,r,s,i,o,a,l,c){switch(t){case"sort":return Array.isArray(e)?[[...e].sort(o)]:[null];case"sort_by":return!Array.isArray(e)||n.length===0?[null]:[[...e].sort((f,p)=>{let h=s(f,n[0],r)[0],d=s(p,n[0],r)[0];return o(h,d)})];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 d=p+h>>>1;o(e[d],f)<0?p=d+1:h=d}return p<e.length&&o(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],d=JSON.stringify(h);u.has(d)||u.set(d,{item:p,key:h})}let f=[...u.values()];return f.sort((p,h)=>o(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)=>o(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 o(p,h)>0?u:f})];case"min":return Array.isArray(e)&&e.length>0?[e.reduce((u,f)=>o(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 o(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,d)=>h+d,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))?Dr(...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(a))return[!0]}catch(u){if(u instanceof c)throw u}return[!1]}return n.length===1?Array.isArray(e)?[e.some(u=>a(s(u,n[0],r)[0]))]:[!1]:Array.isArray(e)?[e.some(a)]:[!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(a))return[!1]}catch(u){if(u instanceof c)throw u}return[!0]}return n.length===1?Array.isArray(e)?[e.every(u=>a(s(u,n[0],r)[0]))]:[!0]:Array.isArray(e)?[e.every(a)]:[!0]}case"select":return n.length===0?[e]:s(e,n[0],r).some(a)?[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&&ze(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"?[Bn(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"?[Bn(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 jd=k(()=>{"use strict";er();Sn()});function ec(e,t,n,r,s,i,o,a){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 a)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 a)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=Math.max(r.limits.maxIterations*100,1e6),c=d=>d.length>=l,u=s(e,n[0],r);if(n.length===1){let d=[];for(let m of u){let g=m;for(let y=0;y<g;y++)if(d.push(y),c(d))return d}return d}let f=s(e,n[1],r);if(n.length===2){let d=[];for(let m of u)for(let g of f){let y=m,w=g;for(let b=y;b<w;b++)if(d.push(b),c(d))return d}return d}let p=s(e,n[2],r),h=[];for(let d of u)for(let m of f)for(let g of p){let y=d,w=m,b=g;if(b!==0){if(b>0){for(let x=y;x<w;x+=b)if(h.push(x),c(h))return h}else for(let x=y;x>w;x+=b)if(h.push(x),c(h))return h}}return h}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 a)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 a)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 a)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(o))return[l];let p=s(l,n[1],r);if(p.length===0)return[l];l=p[0]}throw new a(`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(o);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 a(`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 a(`jq repeat: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}default:return null}}var Gd=k(()=>{"use strict"});function tc(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),o=i.getUTCFullYear(),a=i.getUTCMonth(),l=i.getUTCDate(),c=i.getUTCHours(),u=i.getUTCMinutes(),f=i.getUTCSeconds(),p=i.getUTCDay(),h=Date.UTC(o,0,1),d=Math.floor((i.getTime()-h)/(1440*60*1e3));return[[o,a,l,c,u,f,p,d]]}case"mktime":{if(!Array.isArray(e))throw new Error("mktime requires parsed datetime inputs");let[i,o,a,l=0,c=0,u=0]=e;if(typeof i!="number"||typeof o!="number")throw new Error("mktime requires parsed datetime inputs");let f=Date.UTC(i,o,a??1,l??0,c??0,u??0);return[Math.floor(f/1e3)]}case"strftime":{if(n.length===0)return[null];let o=s(e,n[0],r)[0];if(typeof o!="string")throw new Error("strftime/1 requires a string format");let a;if(typeof e=="number")a=new Date(e*1e3);else if(Array.isArray(e)){let[p,h,d,m=0,g=0,y=0]=e;if(typeof p!="number"||typeof h!="number")throw new Error("strftime/1 requires parsed datetime inputs");a=new Date(Date.UTC(p,h,d??1,m??0,g??0,y??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[o.replace(/%Y/g,String(a.getUTCFullYear())).replace(/%m/g,u(a.getUTCMonth()+1)).replace(/%d/g,u(a.getUTCDate())).replace(/%H/g,u(a.getUTCHours())).replace(/%M/g,u(a.getUTCMinutes())).replace(/%S/g,u(a.getUTCSeconds())).replace(/%A/g,l[a.getUTCDay()]).replace(/%B/g,c[a.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 o=s(e,n[0],r)[0];if(typeof o!="string")throw new Error("strptime/1 requires a string format");if(o==="%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,d]=l.map(Number),m=new Date(Date.UTC(c,u-1,f,p,h,d)),g=m.getUTCDay(),y=Date.UTC(c,0,1),w=Math.floor((m.getTime()-y)/(1440*60*1e3));return[[c,u-1,f,p,h,d,g,w]]}}let a=new Date(e);if(!Number.isNaN(a.getTime())){let l=a.getUTCFullYear(),c=a.getUTCMonth(),u=a.getUTCDate(),f=a.getUTCHours(),p=a.getUTCMinutes(),h=a.getUTCSeconds(),d=a.getUTCDay(),m=Date.UTC(l,0,1),g=Math.floor((a.getTime()-m)/(1440*60*1e3));return[[l,c,u,f,p,h,d,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 Vd=k(()=>{"use strict"});function mn(e){return e!==!1&&e!==null}function xs(e,t){return JSON.stringify(e)===JSON.stringify(t)}function ui(e,t){return typeof e=="number"&&typeof t=="number"?e-t:typeof e=="string"&&typeof t=="string"?e.localeCompare(t):0}function nc(e,t){let n=wt(e);for(let r of Object.keys(t)){if(!_e(r))continue;let s=Bn(n,r)?Ge(n[r]):null,i=Ge(t[r]);s&&i?ze(n,r,nc(s,i)):ze(n,r,t[r])}return n}function Es(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 yo(e,t){let n=a=>a===null?0:typeof a=="boolean"?1:typeof a=="number"?2:typeof a=="string"?3:Array.isArray(a)?4:typeof a=="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 a=0;a<Math.min(e.length,t.length);a++){let l=yo(e[a],t[a]);if(l!==0)return l}return e.length-t.length}let i=Ge(e),o=Ge(t);if(i&&o){let a=Object.keys(i).sort(),l=Object.keys(o).sort();for(let c=0;c<Math.min(a.length,l.length);c++){let u=a[c].localeCompare(l[c]);if(u!==0)return u}if(a.length!==l.length)return a.length-l.length;for(let c of a){let u=yo(i[c],o[c]);if(u!==0)return u}}return 0}function wo(e,t){if(xs(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(s=>e.some(i=>wo(i,s)));let n=Ge(e),r=Ge(t);return n&&r?Object.keys(r).every(s=>Bn(n,s)&&wo(n[s],r[s])):!1}var bo=k(()=>{"use strict";Sn()});function rc(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(`
554
- `)||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??x5;return Es(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 x5,qd=k(()=>{"use strict";bo();x5=2e3});function sc(e,t,n,r,s,i){switch(t){case"index":return n.length===0?[null]:s(e,n[0],r).map(a=>{if(typeof e=="string"&&typeof a=="string"){if(a===""&&e==="")return null;let l=e.indexOf(a);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(a)){for(let c=0;c<=e.length-a.length;c++){let u=!0;for(let f=0;f<a.length;f++)if(!i(e[c+f],a[f])){u=!1;break}if(u)return c}return null}let l=e.findIndex(c=>i(c,a));return l>=0?l:null}return null});case"rindex":return n.length===0?[null]:s(e,n[0],r).map(a=>{if(typeof e=="string"&&typeof a=="string"){let l=e.lastIndexOf(a);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(a)){for(let l=e.length-a.length;l>=0;l--){let c=!0;for(let u=0;u<a.length;u++)if(!i(e[l+u],a[u])){c=!1;break}if(c)return l}return null}for(let l=e.length-1;l>=0;l--)if(i(e[l],a))return l;return null}return null});case"indices":return n.length===0?[[]]:s(e,n[0],r).map(a=>{let l=[];if(typeof e=="string"&&typeof a=="string"){let c=e.indexOf(a);for(;c!==-1;)l.push(c),c=e.indexOf(a,c+1)}else if(Array.isArray(e))if(Array.isArray(a)){let c=a.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],a[p])){f=!1;break}f&&l.push(u)}}else for(let c=0;c<e.length;c++)i(e[c],a)&&l.push(c);return l});default:return null}}var Zd=k(()=>{"use strict"});function ic(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),o=s(e,n[1],r),a=i[0],l=o[0];return typeof a!="number"||typeof l!="number"?[null]:[a**l]}case"atan2":{if(n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=i[0],l=o[0];return typeof a!="number"||typeof l!="number"?[null]:[Math.atan2(a,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],o=s(e,n[1],r)[0];return[e*i+o]}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 Kd=k(()=>{"use strict"});function oc(e,t,n,r,s,i,o,a){switch(t){case"recurse":{if(n.length===0){let h=[],d=m=>{if(h.push(m),Array.isArray(m))for(let g of m)d(g);else if(m&&typeof m=="object")for(let g of Object.keys(m))d(m[g])};return d(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 d=s(h,n[0],r);for(let m of d)m!=null&&p(m)};return p(e),l}case"recurse_down":return a(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[d,m]of Object.entries(u))_e(d)&&ze(h,d,c(m));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=(d,m)=>{if(m===f){p.push([...d]);return}for(let g of e)d.push(g),h(d,m+1),d.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[o(r.root,u)]}else{let u=-c-1;if(u>=l.length)return[e];let f=l.slice(0,u);return[o(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(o(r.root,l.slice(0,u)));return[c]}case"root":return r.root!==void 0?[r.root]:[];default:return null}}var Qd=k(()=>{"use strict";Sn()});function ac(e,t,n,r,s){switch(t){case"keys":return Array.isArray(e)?[e.map((i,o)=>o)]:e&&typeof e=="object"?[Object.keys(e).sort()]:[null];case"keys_unsorted":return Array.isArray(e)?[e.map((i,o)=>o)]: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,o=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${o}) only strings have UTF-8 byte length`)}case"to_entries":{let i=Ge(e);return i?[Object.entries(i).map(([o,a])=>({key:o,value:a}))]:[null]}case"from_entries":if(Array.isArray(e)){let i=Object.create(null);for(let o of e){let a=Ge(o);if(a){let l=a.key??a.Key??a.name??a.Name??a.k,c=a.value??a.Value??a.v;if(l!==void 0){let u=String(l);_e(u)&&ze(i,u,c)}}}return[i]}return[null];case"with_entries":{if(n.length===0)return[e];let i=Ge(e);if(i){let a=Object.entries(i).map(([c,u])=>({key:c,value:u})).flatMap(c=>s(c,n[0],r)),l=Object.create(null);for(let c of a){let u=Ge(c);if(u){let f=u.key??u.name??u.k,p=u.value??u.v;if(f!==void 0){let h=String(f);_e(h)&&ze(l,h,p)}}}return[l]}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(o=>{let a=o;if(a<0)throw new Error("flatten depth must not be negative");return e.flat(a)}):[null];case"unique":if(Array.isArray(e)){let i=new Set,o=[];for(let a of e){let l=JSON.stringify(a);i.has(l)||(i.add(l),o.push(a))}return[o]}return[null];case"tojson":case"tojsonstream":{let i=r.limits.maxDepth??E5;return Es(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[fs(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,o=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${o}) cannot be parsed as a boolean`)}case"tostream":{let i=[],o=(a,l)=>{if(a===null||typeof a!="object")i.push([l,a]);else if(Array.isArray(a))if(a.length===0)i.push([l,[]]);else for(let c=0;c<a.length;c++)o(a[c],[...l,c]);else{let c=Object.keys(a);if(c.length===0)i.push([l,Object.create(null)]);else for(let u of c)o(a[u],[...l,u])}};return o(e,[]),i.push([[]]),i}case"fromstream":{if(n.length===0)return[e];let i=s(e,n[0],r),o=null;for(let a of i){if(!Array.isArray(a)||a.length===1&&Array.isArray(a[0])&&a[0].length===0||a.length!==2)continue;let[l,c]=a;if(!Array.isArray(l))continue;if(l.length===0){o=c;continue}o===null&&(o=typeof l[0]=="number"?[]:Object.create(null));let u=o;for(let p=0;p<l.length-1;p++){let h=l[p],d=l[p+1];if(Array.isArray(u)&&typeof h=="number"){for(;u.length<=h;)u.push(null);u[h]===null&&(u[h]=typeof d=="number"?[]:Object.create(null)),u=u[h]}else{let m=Ge(u);if(m){let g=String(h);if(!_e(g))continue;(m[g]===null||m[g]===void 0)&&ze(m,g,typeof d=="number"?[]:Object.create(null)),u=m[g]}}}let f=l[l.length-1];if(Array.isArray(u)&&typeof f=="number"){for(;u.length<=f;)u.push(null);u[f]=c}else{let p=Ge(u);if(p){let h=String(f);_e(h)&&ze(p,h,c)}}}return[o]}case"truncate_stream":{let i=typeof e=="number"?Math.floor(e):0;if(n.length===0)return[];let o=[],a=s(e,n[0],r);for(let l of a)if(Array.isArray(l)){if(l.length===1&&Array.isArray(l[0])){let c=l[0];c.length>i&&o.push([c.slice(i)]);continue}if(l.length===2&&Array.isArray(l[0])){let c=l[0],u=l[1];c.length>i&&o.push([c.slice(i),u])}}return o}default:return null}}var E5,Xd=k(()=>{"use strict";Sn();bo();E5=2e3});function lc(e,t,n,r,s,i,o,a,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,d=e;for(let m of h){if(d==null){d=null;break}if(Array.isArray(d)&&typeof m=="number")d=d[m];else if(typeof m=="string"){let g=Ge(d);if(!g||!Object.hasOwn(g,m)){d=null;break}d=g[m]}else{d=null;break}}f.push(d)}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[o(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((d,m)=>m.length-d.length))p=a(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 d of p)if(typeof d=="number"&&d<0)throw new Error("Out of bounds negative array index");let h=e;for(let d of p){if(h==null)break;if(Array.isArray(h)&&typeof d=="number")h=h[d];else if(typeof d=="string"){let m=Ge(h);if(!m||!Object.hasOwn(m,d)){h=null;break}h=m[d]}else{h=null;break}}f=o(f,p,h)}return[f]}case"paths":{let u=[],f=(p,h)=>{if(p&&typeof p=="object")if(Array.isArray(p))for(let d=0;d<p.length;d++)u.push([...h,d]),f(p[d],[...h,d]);else for(let d of Object.keys(p))u.push([...h,d]),f(p[d],[...h,d])};return f(e,[]),n.length>0?u.filter(p=>{let h=e;for(let m of p)if(Array.isArray(h)&&typeof m=="number")h=h[m];else if(typeof m=="string"){let g=Ge(h);if(!g||!Object.hasOwn(g,m))return!1;h=g[m]}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 d=0;d<p.length;d++)f(p[d],[...h,d]);else for(let d of Object.keys(p))f(p[d],[...h,d])};return f(e,[]),u}default:return null}}var Yd=k(()=>{"use strict";Sn()});function cc(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 o=s(e,n[0],r),a=s(e,n[1],r),l=new Set(a.map(c=>JSON.stringify(c)));for(let c of o)if(l.has(JSON.stringify(c)))return[!0];return[!1]}case"INDEX":{if(n.length===0)return[Object.create(null)];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)&&ze(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)&&ze(c,p,u)}}return[c]}let o=s(e,n[0],r),a=Object.create(null);for(let l of o){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)&&ze(a,f,u[0])}}return[a]}case"JOIN":{if(n.length<2)return[null];let o=Ge(s(e,n[0],r)[0]);if(!o)return[null];if(!Array.isArray(e))return[null];let a=[];for(let l of e){let c=s(l,n[1],r),u=c.length>0?String(c[0]):"",f=Bn(o,u)?o[u]:null;a.push([l,f])}return[a]}default:return null}}var Jd=k(()=>{"use strict";Sn()});function uc(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 o of e)if(Array.isArray(o)||o!==null&&typeof o=="object")throw new Error("cannot join: contains arrays or objects");return i.map(o=>e.map(a=>a===null?"":typeof a=="string"?a:String(a)).join(String(o)))}case"split":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);return[e.split(o)]}case"splits":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"g";return Q(o,a.includes("g")?a:`${a}g`).split(e)}catch{return[]}}case"scan":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"";return[...Q(o,a.includes("g")?a:`${a}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),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"";return[Q(o,a).test(e)]}catch{return[!1]}}case"match":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",c=Q(o,`${a}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),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",c=Q(o,a).match(e);return!c||!c.groups?[Object.create(null)]:[c.groups]}catch{return[null]}}case"sub":{if(typeof e!="string"||n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=String(i[0]),l=String(o[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"";return[Q(a,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),o=s(e,n[1],r),a=String(i[0]),l=String(o[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"g",u=c.includes("g")?c:`${c}g`;return[Q(a,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),o=String(i[0]);return[e.startsWith(o)?e.slice(o.length):e]}case"rtrimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);return o===""?[e]:[e.endsWith(o)?e.slice(0,-o.length):e]}case"trimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);if(o==="")return[e];let a=e;return a.startsWith(o)&&(a=a.slice(o.length)),a.endsWith(o)&&(a=a.slice(0,-o.length)),[a]}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(a=>{if(typeof a=="string")throw new Error(`string (${JSON.stringify(a)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof a!="number"||Number.isNaN(a))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let l=Math.trunc(a);return l<0||l>1114111||l>=55296&&l<=57343?String.fromCodePoint(65533):String.fromCodePoint(l)}).join("")];default:return null}}var em=k(()=>{"use strict";Ze()});function fc(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 tm=k(()=>{"use strict"});var nm=k(()=>{"use strict";jd();Gd();Vd();qd();Zd();Kd();Qd();Xd();Yd();Jd();em();tm()});function xo(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 c=Array.isArray(e)?[...e]:[];for(;c.length<=r;)c.push(null);return c[r]=xo(c[r],s,n),c}if(Array.isArray(e))throw new Error("Cannot index array with string");if(!_e(r))return e??Object.create(null);let i=Ge(e),o=i?wt(i):Object.create(null),a=Object.hasOwn(o,r)?o[r]:void 0;return ze(o,r,xo(a,s,n)),o}function Eo(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 o=wt(e);return delete o[i],o}return e}let[n,...r]=t;if(Array.isArray(e)&&typeof n=="number"){let s=[...e];return s[n]=Eo(s[n],r),s}if(e&&typeof e=="object"&&!Array.isArray(e)){let s=String(n);if(!_e(s))return e;let i=wt(e);return Object.hasOwn(i,s)&&ze(i,s,Eo(i[s],r)),i}return e}var rm=k(()=>{"use strict";Sn()});function C5(e){return{vars:e?.vars?new Map(e.vars):new Map,limits:{maxIterations:e?.limits?.maxIterations??A5,maxDepth:e?.limits?.maxDepth??om},env:e?.env,coverage:e?.coverage,requireDefenseContext:e?.requireDefenseContext,defenseContextChecked:!1}}function Co(e,t,n){let r=new Map(e.vars);return r.set(t,n),{vars:r,limits:e.limits,env:e.env,requireDefenseContext:e.requireDefenseContext,defenseContextChecked:e.defenseContextChecked,root:e.root,currentPath:e.currentPath,funcs:e.funcs,labels:e.labels,coverage:e.coverage}}function fi(e,t,n){switch(t.type){case"var":return Co(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],o=s<n.length?n[s]:null,a=fi(r,i,o);if(a===null)return null;r=a}return r}case"object":{let r=Ge(n);if(!r)return null;let s=e;for(let i of t.fields){let o;if(typeof i.key=="string")o=i.key;else{let c=V(n,i.key,e);if(c.length===0)return null;o=String(c[0])}let a=Bn(r,o)?r[o]:null;i.keyVar&&(s=Co(s,i.keyVar,a));let l=fi(s,i.pattern,a);if(l===null)return null;s=l}return s}}}function v5(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=Ge(n);if(s&&typeof r=="string"&&Object.hasOwn(s,r))n=s[r];else return}else return;return n}function fr(e){if(e.type==="Identity")return[];if(e.type==="Field"){let t=e.base?fr(e.base):[];return t===null?null:[...t,e.name]}if(e.type==="Index"&&e.index.type==="Literal"){let t=e.base?fr(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=fr(e.left);return t===null?null:pc(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 pc(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=fr(t);if(n!==null)return[...e,...n]}if(t.type==="Index"&&t.index.type==="Literal"){let n=fr(t);if(n!==null)return[...e,...n]}if(t.type==="Pipe"){let n=pc(e,t.left);return n===null?null:pc(n,t.right)}return t.type==="Identity"?e:null}function k5(e){return e!==void 0&&e.vars instanceof Map&&"defenseContextChecked"in e}function sm(e,t,n){if(t.type==="Comma"){let r=[];try{r.push(...V(e,t.left,n))}catch(s){if(s instanceof X)throw s;if(r.length>0)return r;throw new Error("evaluation failed")}try{r.push(...V(e,t.right,n))}catch(s){if(s instanceof X)throw s;return r}return r}return V(e,t,n)}function V(e,t,n){let r=k5(n)?n:C5(n);switch(r.defenseContextChecked||(it(r.requireDefenseContext,"query-engine","evaluation"),r={...r,defenseContextChecked:!0}),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?V(e,t.base,r):[e]).flatMap(i=>{let o=Ge(i);if(o){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?V(e,t.base,r):[e]).flatMap(i=>V(i,t.index,r).flatMap(a=>{if(typeof a=="number"&&Array.isArray(i)){if(Number.isNaN(a))return[null];let l=Math.trunc(a),c=l<0?i.length+l:l;return c>=0&&c<i.length?[i[c]]:[null]}if(typeof a=="string"){let l=Ge(i);return!l||!Object.hasOwn(l,a)?[null]:[l[a]]}return[null]}));case"Slice":return(t.base?V(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 o=i.length,a=t.start?V(e,t.start,r):[0],l=t.end?V(e,t.end,r):[o];return a.flatMap(c=>l.map(u=>{let f=c,p=u,h=Number.isNaN(f)?0:Number.isInteger(f)?f:Math.floor(f),d=Number.isNaN(p)?o:Number.isInteger(p)?p:Math.ceil(p),m=im(h,o),g=im(d,o);return Array.isArray(i),i.slice(m,g)}))});case"Iterate":return(t.base?V(e,t.base,r):[e]).flatMap(i=>Array.isArray(i)?i:i&&typeof i=="object"?Object.values(i):[]);case"Pipe":{let s=V(e,t.left,r),i=fr(t.left),o=[];for(let a of s)try{if(i!==null){let l={...r,currentPath:[...r.currentPath??[],...i]};o.push(...V(a,t.right,l))}else o.push(...V(a,t.right,r))}catch(l){throw l instanceof As?l.withPrependedResults(o):l}return o}case"Comma":{let s=V(e,t.left,r),i=V(e,t.right,r);return[...s,...i]}case"Literal":return[t.value];case"Array":return t.elements?[V(e,t.elements,r)]:[[]];case"Object":{let s=[Object.create(null)];for(let i of t.entries){let o=typeof i.key=="string"?[i.key]:V(e,i.key,r),a=V(e,i.value,r),l=[];for(let c of s)for(let u of o){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 a)l.push(wt(c));continue}for(let f of a){let p=wt(c);ze(p,u,f),l.push(p)}}s.length=0,s.push(...l)}return s}case"Paren":return V(e,t.expr,r);case"BinaryOp":return $5(e,t.op,t.left,t.right,r);case"UnaryOp":return V(e,t.operand,r).map(i=>{if(t.op==="-"){if(typeof i=="number")return-i;if(typeof i=="string"){let o=a=>a.length>5?`"${a.slice(0,3)}...`:JSON.stringify(a);throw new Error(`string (${o(i)}) cannot be negated`)}return null}return t.op==="not"?!mn(i):null});case"Cond":return V(e,t.cond,r).flatMap(i=>{if(mn(i))return V(e,t.then,r);for(let o of t.elifs)if(V(e,o.cond,r).some(mn))return V(e,o.then,r);return t.else?V(e,t.else,r):[e]});case"Try":try{return V(e,t.body,r)}catch(s){if(t.catch){let i=s instanceof So?s.value:s instanceof Error?s.message:String(s);return V(i,t.catch,r)}return[]}case"Call":return am(e,t.name,t.args,r);case"VarBind":return V(e,t.value,r).flatMap(i=>{let o=null,a=[];t.pattern?a.push(t.pattern):t.name&&a.push({type:"var",name:t.name}),t.alternatives&&a.push(...t.alternatives);for(let l of a)if(o=fi(r,l,i),o!==null)break;return o===null?[]:V(e,t.body,o)});case"VarRef":{if(t.name==="$ENV")return[r.env?Ct(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,o=a=>{if(a&&typeof a=="object"){if(i.has(a))return;i.add(a)}if(s.push(a),Array.isArray(a))for(let l of a)o(l);else if(a&&typeof a=="object")for(let l of Object.keys(a))o(a[l])};return o(e),s}case"Optional":try{return V(e,t.expr,r)}catch{return[]}case"StringInterp":return[t.parts.map(i=>typeof i=="string"?i:V(e,i,r).map(a=>typeof a=="string"?a:JSON.stringify(a)).join("")).join("")];case"UpdateOp":return[N5(e,t.path,t.op,t.value,r)];case"Reduce":{let s=V(e,t.expr,r),i=V(e,t.init,r)[0],o=r.limits.maxDepth??om;for(let a of s){let l;if(t.pattern){if(l=fi(r,t.pattern,a),l===null)continue}else l=Co(r,t.varName,a);if(i=V(i,t.update,l)[0],Es(i,o+1)>o)return[null]}return[i]}case"Foreach":{let s=V(e,t.expr,r),i=V(e,t.init,r)[0],o=[];for(let a of s)try{let l;if(t.pattern){if(l=fi(r,t.pattern,a),l===null)continue}else l=Co(r,t.varName,a);if(i=V(i,t.update,l)[0],t.extract){let c=V(i,t.extract,l);o.push(...c)}else o.push(i)}catch(l){throw l instanceof As?l.withPrependedResults(o):l}return o}case"Label":try{return V(e,t.body,{...r,labels:new Set([...r.labels??[],t.name])})}catch(s){if(s instanceof As&&s.label===t.name)return s.partialResults;throw s}case"Break":throw new As(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 o={...r,funcs:s};return V(e,t.body,o)}default:{let s=t;throw new Error(`Unknown AST node type: ${s.type}`)}}}function im(e,t){return e<0?Math.max(0,t+e):Math.min(e,t)}function N5(e,t,n,r,s){function i(l,c){switch(n){case"=":return c;case"|=":return V(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"?xl(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 o(l,c,u){switch(c.type){case"Identity":return u(l);case"Field":{if(!_e(c.name))return l;if(c.base)return o(l,c.base,f=>{if(f&&typeof f=="object"&&!Array.isArray(f)){let p=wt(f),h=Object.hasOwn(p,c.name)?p[c.name]:void 0;return ze(p,c.name,u(h)),p}return f});if(l&&typeof l=="object"&&!Array.isArray(l)){let f=wt(l),p=Object.hasOwn(f,c.name)?f[c.name]:void 0;return ze(f,c.name,u(p)),f}return l}case"Index":{let p=V(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 o(l,c.base,h=>{if(typeof p=="number"&&Array.isArray(h)){let d=[...h],m=p<0?d.length+p:p;if(m>=0){for(;d.length<=m;)d.push(null);d[m]=u(d[m])}return d}if(typeof p=="string"&&h&&typeof h=="object"&&!Array.isArray(h)){if(!_e(p))return h;let d=wt(h),m=Object.hasOwn(d,p)?d[p]:void 0;return ze(d,p,u(m)),d}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 d=[...l],m=p<0?d.length+p:p;if(m>=0){for(;d.length<=m;)d.push(null);d[m]=u(d[m])}return d}if(l==null){let d=[];for(;d.length<=p;)d.push(null);return d[p]=u(null),d}return l}if(typeof p=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!_e(p))return l;let h=wt(l),d=Object.hasOwn(h,p)?h[p]:void 0;return ze(h,p,u(d)),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[d,m]of Object.entries(p))_e(d)&&ze(h,d,u(m));return h}return p};return c.base?o(l,c.base,f):f(l)}case"Pipe":{let f=o(l,c.left,p=>p);return o(f,c.right,u)}default:return u(l)}}return o(e,t,l=>{if(n==="|=")return i(l,l);let c=V(e,r,s);return i(l,c[0]??null)})}function I5(e,t,n){function r(i,o,a){switch(o.type){case"Identity":return a;case"Field":{if(!_e(o.name))return i;if(o.base){let l=V(i,o.base,n)[0],c=r(l,{type:"Field",name:o.name},a);return r(i,o.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){let l=wt(i);return ze(l,o.name,a),l}return i}case"Index":{if(o.base){let u=V(i,o.base,n)[0],f=r(u,{type:"Index",index:o.index},a);return r(i,o.base,f)}let c=V(e,o.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]=a),u}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!_e(c))return i;let u=wt(i);return ze(u,c,a),u}return i}default:return i}}function s(i,o){switch(o.type){case"Identity":return null;case"Field":{if(!_e(o.name))return i;if(o.base){let l=V(i,o.base,n)[0];if(l==null)return i;let c=s(l,{type:"Field",name:o.name});return r(i,o.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){if(!_e(o.name))return i;let l=wt(i);return delete l[o.name],l}return i}case"Index":{if(o.base){let u=V(i,o.base,n)[0];if(u==null)return i;let f=s(u,{type:"Index",index:o.index});return r(i,o.base,f)}let c=V(e,o.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=wt(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,d,m){switch(d.type){case"Identity":return m;case"Field":{if(!_e(d.name))return h;if(h&&typeof h=="object"&&!Array.isArray(h)){let g=wt(h);return ze(g,d.name,m),g}return h}case"Index":{let y=V(e,d.index,n)[0];if(typeof y=="number"&&Array.isArray(h)){let w=[...h],b=y<0?w.length+y:y;return b>=0&&b<w.length&&(w[b]=m),w}if(typeof y=="string"&&h&&typeof h=="object"&&!Array.isArray(h)){if(!_e(y))return h;let w=wt(h);return ze(w,y,m),w}return h}case"Pipe":{let g=V(h,d.left,n)[0],y=u(g,d.right,m);return u(h,d.left,y)}default:return h}};var a=u;let l=o.left,c=o.right,f=V(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 $5(e,t,n,r,s){if(t==="and")return V(e,n,s).flatMap(l=>mn(l)?V(e,r,s).map(u=>mn(u)):[!1]);if(t==="or")return V(e,n,s).flatMap(l=>mn(l)?[!0]:V(e,r,s).map(u=>mn(u)));if(t==="//"){let l=V(e,n,s).filter(c=>c!=null&&c!==!1);return l.length>0?l:V(e,r,s)}let i=V(e,n,s),o=V(e,r,s);return i.flatMap(a=>o.map(l=>{switch(t){case"+":return a===null?l:l===null?a:typeof a=="number"&&typeof l=="number"||typeof a=="string"&&typeof l=="string"?a+l:Array.isArray(a)&&Array.isArray(l)?[...a,...l]:a&&l&&typeof a=="object"&&typeof l=="object"&&!Array.isArray(a)&&!Array.isArray(l)?xl(a,l):null;case"-":if(typeof a=="number"&&typeof l=="number")return a-l;if(Array.isArray(a)&&Array.isArray(l)){let c=new Set(l.map(u=>JSON.stringify(u)));return a.filter(u=>!c.has(JSON.stringify(u)))}if(typeof a=="string"&&typeof l=="string"){let c=u=>u.length>10?`"${u.slice(0,10)}...`:JSON.stringify(u);throw new Error(`string (${c(a)}) and string (${c(l)}) cannot be subtracted`)}return null;case"*":if(typeof a=="number"&&typeof l=="number")return a*l;if(typeof a=="string"&&typeof l=="number")return a.repeat(l);{let c=Ge(a),u=Ge(l);if(c&&u)return nc(c,u)}return null;case"/":if(typeof a=="number"&&typeof l=="number"){if(l===0)throw new Error(`number (${a}) and number (${l}) cannot be divided because the divisor is zero`);return a/l}return typeof a=="string"&&typeof l=="string"?a.split(l):null;case"%":if(typeof a=="number"&&typeof l=="number"){if(l===0)throw new Error(`number (${a}) and number (${l}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(a)&&!Number.isNaN(a)?!Number.isFinite(l)&&!Number.isNaN(l)&&a<0&&l>0?-1:0:a%l}return null;case"==":return xs(a,l);case"!=":return!xs(a,l);case"<":return ui(a,l)<0;case"<=":return ui(a,l)<=0;case">":return ui(a,l)>0;case">=":return ui(a,l)>=0;default:return null}}))}function am(e,t,n,r){let s=S5.get(t);if(s)return typeof e=="number"?[s(e)]:[null];let i=ic(e,t,n,r,V);if(i!==null)return i;let o=uc(e,t,n,r,V);if(o!==null)return o;let a=tc(e,t,n,r,V);if(a!==null)return a;let l=rc(e,t,r.limits.maxDepth);if(l!==null)return l;let c=fc(e,t);if(c!==null)return c;let u=ac(e,t,n,r,V);if(u!==null)return u;let f=Jl(e,t,n,r,V,sm,yo,mn,wo,X);if(f!==null)return f;let p=lc(e,t,n,r,V,mn,xo,Eo,I5,Ao);if(p!==null)return p;let h=sc(e,t,n,r,V,xs);if(h!==null)return h;let d=ec(e,t,n,r,V,sm,mn,X);if(d!==null)return d;let m=oc(e,t,n,r,V,mn,v5,am);if(m!==null)return m;let g=cc(e,t,n,r,V,xs);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 y=n.length>0?V(e,n[0],r)[0]:e;throw new So(y)}case"env":return[r.env?Ct(r.env):Object.create(null)];case"debug":return[e];case"input_line_number":return[1];default:{let y=`${t}/${n.length}`,w=r.funcs?.get(y);if(w){let b=w.closure??r.funcs??new Map,x=new Map(b);x.set(y,w);for(let v=0;v<w.params.length;v++){let $=w.params[v],_=n[v];if(_){let R=V(e,_,r),P;if(R.length===0)P={type:"Call",name:"empty",args:[]};else if(R.length===1)P={type:"Literal",value:R[0]};else{P={type:"Literal",value:R[R.length-1]};for(let C=R.length-2;C>=0;C--)P={type:"Comma",left:{type:"Literal",value:R[C]},right:P}}x.set(`${$}/0`,{params:[],body:P})}}let S={...r,funcs:x};return V(e,w.body,S)}throw new Error(`Unknown function: ${t}`)}}}function Ao(e,t,n,r,s){if(t.type==="Comma"){let a=t;Ao(e,a.left,n,r,s),Ao(e,a.right,n,r,s);return}let i=fr(t);if(i!==null){s.push([...r,...i]);return}if(t.type==="Iterate"){if(Array.isArray(e))for(let a=0;a<e.length;a++)s.push([...r,a]);else if(e&&typeof e=="object")for(let a of Object.keys(e))s.push([...r,a]);return}if(t.type==="Recurse"){let a=(l,c)=>{if(s.push([...r,...c]),l&&typeof l=="object")if(Array.isArray(l))for(let u=0;u<l.length;u++)a(l[u],[...c,u]);else for(let u of Object.keys(l))a(l[u],[...c,u])};a(e,[]);return}if(t.type==="Pipe"){let a=fr(t.left);if(a!==null){let l=V(e,t.left,n);for(let c of l)Ao(c,t.right,n,[...r,...a],s);return}}V(e,t,n).length>0&&s.push(r)}var As,So,A5,om,S5,lm=k(()=>{"use strict";er();Ae();Wn();nm();rm();Sn();bo();As=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])}},So=class extends Error{value;constructor(t){super(typeof t=="string"?t:JSON.stringify(t)),this.value=t,this.name="JqError"}},A5=1e4,om=2e3,S5=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 um(e){let t=[],n=0,r=(c=0)=>e[n+c],s=()=>e[n++],i=()=>n>=e.length,o=c=>c>="0"&&c<="9",a=c=>c>="a"&&c<="z"||c>="A"&&c<="Z"||c==="_",l=c=>a(c)||o(c);for(;!i();){let c=n,u=s();if(!(u===" "||u===" "||u===`
553
+ `,exitCode:127}}}};w5={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},b5={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"}});function Jl(e,t,n,r,s,i,o,a,l,c){switch(t){case"sort":return Array.isArray(e)?[[...e].sort(o)]:[null];case"sort_by":return!Array.isArray(e)||n.length===0?[null]:[[...e].sort((f,p)=>{let h=s(f,n[0],r)[0],d=s(p,n[0],r)[0];return o(h,d)})];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 d=p+h>>>1;o(e[d],f)<0?p=d+1:h=d}return p<e.length&&o(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],d=JSON.stringify(h);u.has(d)||u.set(d,{item:p,key:h})}let f=[...u.values()];return f.sort((p,h)=>o(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)=>o(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 o(p,h)>0?u:f})];case"min":return Array.isArray(e)&&e.length>0?[e.reduce((u,f)=>o(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 o(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,d)=>h+d,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))?Dr(...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(a))return[!0]}catch(u){if(u instanceof c)throw u}return[!1]}return n.length===1?Array.isArray(e)?[e.some(u=>a(s(u,n[0],r)[0]))]:[!1]:Array.isArray(e)?[e.some(a)]:[!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(a))return[!1]}catch(u){if(u instanceof c)throw u}return[!0]}return n.length===1?Array.isArray(e)?[e.every(u=>a(s(u,n[0],r)[0]))]:[!0]:Array.isArray(e)?[e.every(a)]:[!0]}case"select":return n.length===0?[e]:s(e,n[0],r).some(a)?[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&&ze(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"?[Wn(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"?[Wn(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 jd=k(()=>{"use strict";er();Sn()});function ec(e,t,n,r,s,i,o,a){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 a)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 a)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=Math.max(r.limits.maxIterations*100,1e6),c=d=>d.length>=l,u=s(e,n[0],r);if(n.length===1){let d=[];for(let m of u){let g=m;for(let y=0;y<g;y++)if(d.push(y),c(d))return d}return d}let f=s(e,n[1],r);if(n.length===2){let d=[];for(let m of u)for(let g of f){let y=m,w=g;for(let b=y;b<w;b++)if(d.push(b),c(d))return d}return d}let p=s(e,n[2],r),h=[];for(let d of u)for(let m of f)for(let g of p){let y=d,w=m,b=g;if(b!==0){if(b>0){for(let x=y;x<w;x+=b)if(h.push(x),c(h))return h}else for(let x=y;x>w;x+=b)if(h.push(x),c(h))return h}}return h}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 a)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 a)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 a)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(o))return[l];let p=s(l,n[1],r);if(p.length===0)return[l];l=p[0]}throw new a(`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(o);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 a(`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 a(`jq repeat: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}default:return null}}var Gd=k(()=>{"use strict"});function tc(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),o=i.getUTCFullYear(),a=i.getUTCMonth(),l=i.getUTCDate(),c=i.getUTCHours(),u=i.getUTCMinutes(),f=i.getUTCSeconds(),p=i.getUTCDay(),h=Date.UTC(o,0,1),d=Math.floor((i.getTime()-h)/(1440*60*1e3));return[[o,a,l,c,u,f,p,d]]}case"mktime":{if(!Array.isArray(e))throw new Error("mktime requires parsed datetime inputs");let[i,o,a,l=0,c=0,u=0]=e;if(typeof i!="number"||typeof o!="number")throw new Error("mktime requires parsed datetime inputs");let f=Date.UTC(i,o,a??1,l??0,c??0,u??0);return[Math.floor(f/1e3)]}case"strftime":{if(n.length===0)return[null];let o=s(e,n[0],r)[0];if(typeof o!="string")throw new Error("strftime/1 requires a string format");let a;if(typeof e=="number")a=new Date(e*1e3);else if(Array.isArray(e)){let[p,h,d,m=0,g=0,y=0]=e;if(typeof p!="number"||typeof h!="number")throw new Error("strftime/1 requires parsed datetime inputs");a=new Date(Date.UTC(p,h,d??1,m??0,g??0,y??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[o.replace(/%Y/g,String(a.getUTCFullYear())).replace(/%m/g,u(a.getUTCMonth()+1)).replace(/%d/g,u(a.getUTCDate())).replace(/%H/g,u(a.getUTCHours())).replace(/%M/g,u(a.getUTCMinutes())).replace(/%S/g,u(a.getUTCSeconds())).replace(/%A/g,l[a.getUTCDay()]).replace(/%B/g,c[a.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 o=s(e,n[0],r)[0];if(typeof o!="string")throw new Error("strptime/1 requires a string format");if(o==="%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,d]=l.map(Number),m=new Date(Date.UTC(c,u-1,f,p,h,d)),g=m.getUTCDay(),y=Date.UTC(c,0,1),w=Math.floor((m.getTime()-y)/(1440*60*1e3));return[[c,u-1,f,p,h,d,g,w]]}}let a=new Date(e);if(!Number.isNaN(a.getTime())){let l=a.getUTCFullYear(),c=a.getUTCMonth(),u=a.getUTCDate(),f=a.getUTCHours(),p=a.getUTCMinutes(),h=a.getUTCSeconds(),d=a.getUTCDay(),m=Date.UTC(l,0,1),g=Math.floor((a.getTime()-m)/(1440*60*1e3));return[[l,c,u,f,p,h,d,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 Vd=k(()=>{"use strict"});function mn(e){return e!==!1&&e!==null}function xs(e,t){return JSON.stringify(e)===JSON.stringify(t)}function ui(e,t){return typeof e=="number"&&typeof t=="number"?e-t:typeof e=="string"&&typeof t=="string"?e.localeCompare(t):0}function nc(e,t){let n=wt(e);for(let r of Object.keys(t)){if(!_e(r))continue;let s=Wn(n,r)?Ge(n[r]):null,i=Ge(t[r]);s&&i?ze(n,r,nc(s,i)):ze(n,r,t[r])}return n}function Es(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 yo(e,t){let n=a=>a===null?0:typeof a=="boolean"?1:typeof a=="number"?2:typeof a=="string"?3:Array.isArray(a)?4:typeof a=="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 a=0;a<Math.min(e.length,t.length);a++){let l=yo(e[a],t[a]);if(l!==0)return l}return e.length-t.length}let i=Ge(e),o=Ge(t);if(i&&o){let a=Object.keys(i).sort(),l=Object.keys(o).sort();for(let c=0;c<Math.min(a.length,l.length);c++){let u=a[c].localeCompare(l[c]);if(u!==0)return u}if(a.length!==l.length)return a.length-l.length;for(let c of a){let u=yo(i[c],o[c]);if(u!==0)return u}}return 0}function wo(e,t){if(xs(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(s=>e.some(i=>wo(i,s)));let n=Ge(e),r=Ge(t);return n&&r?Object.keys(r).every(s=>Wn(n,s)&&wo(n[s],r[s])):!1}var bo=k(()=>{"use strict";Sn()});function rc(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(`
554
+ `)||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??x5;return Es(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 x5,qd=k(()=>{"use strict";bo();x5=2e3});function sc(e,t,n,r,s,i){switch(t){case"index":return n.length===0?[null]:s(e,n[0],r).map(a=>{if(typeof e=="string"&&typeof a=="string"){if(a===""&&e==="")return null;let l=e.indexOf(a);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(a)){for(let c=0;c<=e.length-a.length;c++){let u=!0;for(let f=0;f<a.length;f++)if(!i(e[c+f],a[f])){u=!1;break}if(u)return c}return null}let l=e.findIndex(c=>i(c,a));return l>=0?l:null}return null});case"rindex":return n.length===0?[null]:s(e,n[0],r).map(a=>{if(typeof e=="string"&&typeof a=="string"){let l=e.lastIndexOf(a);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(a)){for(let l=e.length-a.length;l>=0;l--){let c=!0;for(let u=0;u<a.length;u++)if(!i(e[l+u],a[u])){c=!1;break}if(c)return l}return null}for(let l=e.length-1;l>=0;l--)if(i(e[l],a))return l;return null}return null});case"indices":return n.length===0?[[]]:s(e,n[0],r).map(a=>{let l=[];if(typeof e=="string"&&typeof a=="string"){let c=e.indexOf(a);for(;c!==-1;)l.push(c),c=e.indexOf(a,c+1)}else if(Array.isArray(e))if(Array.isArray(a)){let c=a.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],a[p])){f=!1;break}f&&l.push(u)}}else for(let c=0;c<e.length;c++)i(e[c],a)&&l.push(c);return l});default:return null}}var Zd=k(()=>{"use strict"});function ic(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),o=s(e,n[1],r),a=i[0],l=o[0];return typeof a!="number"||typeof l!="number"?[null]:[a**l]}case"atan2":{if(n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=i[0],l=o[0];return typeof a!="number"||typeof l!="number"?[null]:[Math.atan2(a,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],o=s(e,n[1],r)[0];return[e*i+o]}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 Kd=k(()=>{"use strict"});function oc(e,t,n,r,s,i,o,a){switch(t){case"recurse":{if(n.length===0){let h=[],d=m=>{if(h.push(m),Array.isArray(m))for(let g of m)d(g);else if(m&&typeof m=="object")for(let g of Object.keys(m))d(m[g])};return d(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 d=s(h,n[0],r);for(let m of d)m!=null&&p(m)};return p(e),l}case"recurse_down":return a(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[d,m]of Object.entries(u))_e(d)&&ze(h,d,c(m));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=(d,m)=>{if(m===f){p.push([...d]);return}for(let g of e)d.push(g),h(d,m+1),d.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[o(r.root,u)]}else{let u=-c-1;if(u>=l.length)return[e];let f=l.slice(0,u);return[o(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(o(r.root,l.slice(0,u)));return[c]}case"root":return r.root!==void 0?[r.root]:[];default:return null}}var Qd=k(()=>{"use strict";Sn()});function ac(e,t,n,r,s){switch(t){case"keys":return Array.isArray(e)?[e.map((i,o)=>o)]:e&&typeof e=="object"?[Object.keys(e).sort()]:[null];case"keys_unsorted":return Array.isArray(e)?[e.map((i,o)=>o)]: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,o=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${o}) only strings have UTF-8 byte length`)}case"to_entries":{let i=Ge(e);return i?[Object.entries(i).map(([o,a])=>({key:o,value:a}))]:[null]}case"from_entries":if(Array.isArray(e)){let i=Object.create(null);for(let o of e){let a=Ge(o);if(a){let l=a.key??a.Key??a.name??a.Name??a.k,c=a.value??a.Value??a.v;if(l!==void 0){let u=String(l);_e(u)&&ze(i,u,c)}}}return[i]}return[null];case"with_entries":{if(n.length===0)return[e];let i=Ge(e);if(i){let a=Object.entries(i).map(([c,u])=>({key:c,value:u})).flatMap(c=>s(c,n[0],r)),l=Object.create(null);for(let c of a){let u=Ge(c);if(u){let f=u.key??u.name??u.k,p=u.value??u.v;if(f!==void 0){let h=String(f);_e(h)&&ze(l,h,p)}}}return[l]}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(o=>{let a=o;if(a<0)throw new Error("flatten depth must not be negative");return e.flat(a)}):[null];case"unique":if(Array.isArray(e)){let i=new Set,o=[];for(let a of e){let l=JSON.stringify(a);i.has(l)||(i.add(l),o.push(a))}return[o]}return[null];case"tojson":case"tojsonstream":{let i=r.limits.maxDepth??E5;return Es(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[fs(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,o=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${o}) cannot be parsed as a boolean`)}case"tostream":{let i=[],o=(a,l)=>{if(a===null||typeof a!="object")i.push([l,a]);else if(Array.isArray(a))if(a.length===0)i.push([l,[]]);else for(let c=0;c<a.length;c++)o(a[c],[...l,c]);else{let c=Object.keys(a);if(c.length===0)i.push([l,Object.create(null)]);else for(let u of c)o(a[u],[...l,u])}};return o(e,[]),i.push([[]]),i}case"fromstream":{if(n.length===0)return[e];let i=s(e,n[0],r),o=null;for(let a of i){if(!Array.isArray(a)||a.length===1&&Array.isArray(a[0])&&a[0].length===0||a.length!==2)continue;let[l,c]=a;if(!Array.isArray(l))continue;if(l.length===0){o=c;continue}o===null&&(o=typeof l[0]=="number"?[]:Object.create(null));let u=o;for(let p=0;p<l.length-1;p++){let h=l[p],d=l[p+1];if(Array.isArray(u)&&typeof h=="number"){for(;u.length<=h;)u.push(null);u[h]===null&&(u[h]=typeof d=="number"?[]:Object.create(null)),u=u[h]}else{let m=Ge(u);if(m){let g=String(h);if(!_e(g))continue;(m[g]===null||m[g]===void 0)&&ze(m,g,typeof d=="number"?[]:Object.create(null)),u=m[g]}}}let f=l[l.length-1];if(Array.isArray(u)&&typeof f=="number"){for(;u.length<=f;)u.push(null);u[f]=c}else{let p=Ge(u);if(p){let h=String(f);_e(h)&&ze(p,h,c)}}}return[o]}case"truncate_stream":{let i=typeof e=="number"?Math.floor(e):0;if(n.length===0)return[];let o=[],a=s(e,n[0],r);for(let l of a)if(Array.isArray(l)){if(l.length===1&&Array.isArray(l[0])){let c=l[0];c.length>i&&o.push([c.slice(i)]);continue}if(l.length===2&&Array.isArray(l[0])){let c=l[0],u=l[1];c.length>i&&o.push([c.slice(i),u])}}return o}default:return null}}var E5,Xd=k(()=>{"use strict";Sn();bo();E5=2e3});function lc(e,t,n,r,s,i,o,a,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,d=e;for(let m of h){if(d==null){d=null;break}if(Array.isArray(d)&&typeof m=="number")d=d[m];else if(typeof m=="string"){let g=Ge(d);if(!g||!Object.hasOwn(g,m)){d=null;break}d=g[m]}else{d=null;break}}f.push(d)}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[o(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((d,m)=>m.length-d.length))p=a(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 d of p)if(typeof d=="number"&&d<0)throw new Error("Out of bounds negative array index");let h=e;for(let d of p){if(h==null)break;if(Array.isArray(h)&&typeof d=="number")h=h[d];else if(typeof d=="string"){let m=Ge(h);if(!m||!Object.hasOwn(m,d)){h=null;break}h=m[d]}else{h=null;break}}f=o(f,p,h)}return[f]}case"paths":{let u=[],f=(p,h)=>{if(p&&typeof p=="object")if(Array.isArray(p))for(let d=0;d<p.length;d++)u.push([...h,d]),f(p[d],[...h,d]);else for(let d of Object.keys(p))u.push([...h,d]),f(p[d],[...h,d])};return f(e,[]),n.length>0?u.filter(p=>{let h=e;for(let m of p)if(Array.isArray(h)&&typeof m=="number")h=h[m];else if(typeof m=="string"){let g=Ge(h);if(!g||!Object.hasOwn(g,m))return!1;h=g[m]}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 d=0;d<p.length;d++)f(p[d],[...h,d]);else for(let d of Object.keys(p))f(p[d],[...h,d])};return f(e,[]),u}default:return null}}var Yd=k(()=>{"use strict";Sn()});function cc(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 o=s(e,n[0],r),a=s(e,n[1],r),l=new Set(a.map(c=>JSON.stringify(c)));for(let c of o)if(l.has(JSON.stringify(c)))return[!0];return[!1]}case"INDEX":{if(n.length===0)return[Object.create(null)];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)&&ze(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)&&ze(c,p,u)}}return[c]}let o=s(e,n[0],r),a=Object.create(null);for(let l of o){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)&&ze(a,f,u[0])}}return[a]}case"JOIN":{if(n.length<2)return[null];let o=Ge(s(e,n[0],r)[0]);if(!o)return[null];if(!Array.isArray(e))return[null];let a=[];for(let l of e){let c=s(l,n[1],r),u=c.length>0?String(c[0]):"",f=Wn(o,u)?o[u]:null;a.push([l,f])}return[a]}default:return null}}var Jd=k(()=>{"use strict";Sn()});function uc(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 o of e)if(Array.isArray(o)||o!==null&&typeof o=="object")throw new Error("cannot join: contains arrays or objects");return i.map(o=>e.map(a=>a===null?"":typeof a=="string"?a:String(a)).join(String(o)))}case"split":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);return[e.split(o)]}case"splits":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"g";return Q(o,a.includes("g")?a:`${a}g`).split(e)}catch{return[]}}case"scan":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"";return[...Q(o,a.includes("g")?a:`${a}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),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"";return[Q(o,a).test(e)]}catch{return[!1]}}case"match":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",c=Q(o,`${a}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),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",c=Q(o,a).match(e);return!c||!c.groups?[Object.create(null)]:[c.groups]}catch{return[null]}}case"sub":{if(typeof e!="string"||n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=String(i[0]),l=String(o[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"";return[Q(a,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),o=s(e,n[1],r),a=String(i[0]),l=String(o[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"g",u=c.includes("g")?c:`${c}g`;return[Q(a,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),o=String(i[0]);return[e.startsWith(o)?e.slice(o.length):e]}case"rtrimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);return o===""?[e]:[e.endsWith(o)?e.slice(0,-o.length):e]}case"trimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);if(o==="")return[e];let a=e;return a.startsWith(o)&&(a=a.slice(o.length)),a.endsWith(o)&&(a=a.slice(0,-o.length)),[a]}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(a=>{if(typeof a=="string")throw new Error(`string (${JSON.stringify(a)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof a!="number"||Number.isNaN(a))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let l=Math.trunc(a);return l<0||l>1114111||l>=55296&&l<=57343?String.fromCodePoint(65533):String.fromCodePoint(l)}).join("")];default:return null}}var em=k(()=>{"use strict";Ze()});function fc(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 tm=k(()=>{"use strict"});var nm=k(()=>{"use strict";jd();Gd();Vd();qd();Zd();Kd();Qd();Xd();Yd();Jd();em();tm()});function xo(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 c=Array.isArray(e)?[...e]:[];for(;c.length<=r;)c.push(null);return c[r]=xo(c[r],s,n),c}if(Array.isArray(e))throw new Error("Cannot index array with string");if(!_e(r))return e??Object.create(null);let i=Ge(e),o=i?wt(i):Object.create(null),a=Object.hasOwn(o,r)?o[r]:void 0;return ze(o,r,xo(a,s,n)),o}function Eo(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 o=wt(e);return delete o[i],o}return e}let[n,...r]=t;if(Array.isArray(e)&&typeof n=="number"){let s=[...e];return s[n]=Eo(s[n],r),s}if(e&&typeof e=="object"&&!Array.isArray(e)){let s=String(n);if(!_e(s))return e;let i=wt(e);return Object.hasOwn(i,s)&&ze(i,s,Eo(i[s],r)),i}return e}var rm=k(()=>{"use strict";Sn()});function C5(e){return{vars:e?.vars?new Map(e.vars):new Map,limits:{maxIterations:e?.limits?.maxIterations??A5,maxDepth:e?.limits?.maxDepth??om},env:e?.env,coverage:e?.coverage,requireDefenseContext:e?.requireDefenseContext,defenseContextChecked:!1}}function Co(e,t,n){let r=new Map(e.vars);return r.set(t,n),{vars:r,limits:e.limits,env:e.env,requireDefenseContext:e.requireDefenseContext,defenseContextChecked:e.defenseContextChecked,root:e.root,currentPath:e.currentPath,funcs:e.funcs,labels:e.labels,coverage:e.coverage}}function fi(e,t,n){switch(t.type){case"var":return Co(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],o=s<n.length?n[s]:null,a=fi(r,i,o);if(a===null)return null;r=a}return r}case"object":{let r=Ge(n);if(!r)return null;let s=e;for(let i of t.fields){let o;if(typeof i.key=="string")o=i.key;else{let c=V(n,i.key,e);if(c.length===0)return null;o=String(c[0])}let a=Wn(r,o)?r[o]:null;i.keyVar&&(s=Co(s,i.keyVar,a));let l=fi(s,i.pattern,a);if(l===null)return null;s=l}return s}}}function v5(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=Ge(n);if(s&&typeof r=="string"&&Object.hasOwn(s,r))n=s[r];else return}else return;return n}function fr(e){if(e.type==="Identity")return[];if(e.type==="Field"){let t=e.base?fr(e.base):[];return t===null?null:[...t,e.name]}if(e.type==="Index"&&e.index.type==="Literal"){let t=e.base?fr(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=fr(e.left);return t===null?null:pc(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 pc(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=fr(t);if(n!==null)return[...e,...n]}if(t.type==="Index"&&t.index.type==="Literal"){let n=fr(t);if(n!==null)return[...e,...n]}if(t.type==="Pipe"){let n=pc(e,t.left);return n===null?null:pc(n,t.right)}return t.type==="Identity"?e:null}function k5(e){return e!==void 0&&e.vars instanceof Map&&"defenseContextChecked"in e}function sm(e,t,n){if(t.type==="Comma"){let r=[];try{r.push(...V(e,t.left,n))}catch(s){if(s instanceof X)throw s;if(r.length>0)return r;throw new Error("evaluation failed")}try{r.push(...V(e,t.right,n))}catch(s){if(s instanceof X)throw s;return r}return r}return V(e,t,n)}function V(e,t,n){let r=k5(n)?n:C5(n);switch(r.defenseContextChecked||(it(r.requireDefenseContext,"query-engine","evaluation"),r={...r,defenseContextChecked:!0}),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?V(e,t.base,r):[e]).flatMap(i=>{let o=Ge(i);if(o){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?V(e,t.base,r):[e]).flatMap(i=>V(i,t.index,r).flatMap(a=>{if(typeof a=="number"&&Array.isArray(i)){if(Number.isNaN(a))return[null];let l=Math.trunc(a),c=l<0?i.length+l:l;return c>=0&&c<i.length?[i[c]]:[null]}if(typeof a=="string"){let l=Ge(i);return!l||!Object.hasOwn(l,a)?[null]:[l[a]]}return[null]}));case"Slice":return(t.base?V(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 o=i.length,a=t.start?V(e,t.start,r):[0],l=t.end?V(e,t.end,r):[o];return a.flatMap(c=>l.map(u=>{let f=c,p=u,h=Number.isNaN(f)?0:Number.isInteger(f)?f:Math.floor(f),d=Number.isNaN(p)?o:Number.isInteger(p)?p:Math.ceil(p),m=im(h,o),g=im(d,o);return Array.isArray(i),i.slice(m,g)}))});case"Iterate":return(t.base?V(e,t.base,r):[e]).flatMap(i=>Array.isArray(i)?i:i&&typeof i=="object"?Object.values(i):[]);case"Pipe":{let s=V(e,t.left,r),i=fr(t.left),o=[];for(let a of s)try{if(i!==null){let l={...r,currentPath:[...r.currentPath??[],...i]};o.push(...V(a,t.right,l))}else o.push(...V(a,t.right,r))}catch(l){throw l instanceof As?l.withPrependedResults(o):l}return o}case"Comma":{let s=V(e,t.left,r),i=V(e,t.right,r);return[...s,...i]}case"Literal":return[t.value];case"Array":return t.elements?[V(e,t.elements,r)]:[[]];case"Object":{let s=[Object.create(null)];for(let i of t.entries){let o=typeof i.key=="string"?[i.key]:V(e,i.key,r),a=V(e,i.value,r),l=[];for(let c of s)for(let u of o){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 a)l.push(wt(c));continue}for(let f of a){let p=wt(c);ze(p,u,f),l.push(p)}}s.length=0,s.push(...l)}return s}case"Paren":return V(e,t.expr,r);case"BinaryOp":return $5(e,t.op,t.left,t.right,r);case"UnaryOp":return V(e,t.operand,r).map(i=>{if(t.op==="-"){if(typeof i=="number")return-i;if(typeof i=="string"){let o=a=>a.length>5?`"${a.slice(0,3)}...`:JSON.stringify(a);throw new Error(`string (${o(i)}) cannot be negated`)}return null}return t.op==="not"?!mn(i):null});case"Cond":return V(e,t.cond,r).flatMap(i=>{if(mn(i))return V(e,t.then,r);for(let o of t.elifs)if(V(e,o.cond,r).some(mn))return V(e,o.then,r);return t.else?V(e,t.else,r):[e]});case"Try":try{return V(e,t.body,r)}catch(s){if(t.catch){let i=s instanceof So?s.value:s instanceof Error?s.message:String(s);return V(i,t.catch,r)}return[]}case"Call":return am(e,t.name,t.args,r);case"VarBind":return V(e,t.value,r).flatMap(i=>{let o=null,a=[];t.pattern?a.push(t.pattern):t.name&&a.push({type:"var",name:t.name}),t.alternatives&&a.push(...t.alternatives);for(let l of a)if(o=fi(r,l,i),o!==null)break;return o===null?[]:V(e,t.body,o)});case"VarRef":{if(t.name==="$ENV")return[r.env?Ct(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,o=a=>{if(a&&typeof a=="object"){if(i.has(a))return;i.add(a)}if(s.push(a),Array.isArray(a))for(let l of a)o(l);else if(a&&typeof a=="object")for(let l of Object.keys(a))o(a[l])};return o(e),s}case"Optional":try{return V(e,t.expr,r)}catch{return[]}case"StringInterp":return[t.parts.map(i=>typeof i=="string"?i:V(e,i,r).map(a=>typeof a=="string"?a:JSON.stringify(a)).join("")).join("")];case"UpdateOp":return[N5(e,t.path,t.op,t.value,r)];case"Reduce":{let s=V(e,t.expr,r),i=V(e,t.init,r)[0],o=r.limits.maxDepth??om;for(let a of s){let l;if(t.pattern){if(l=fi(r,t.pattern,a),l===null)continue}else l=Co(r,t.varName,a);if(i=V(i,t.update,l)[0],Es(i,o+1)>o)return[null]}return[i]}case"Foreach":{let s=V(e,t.expr,r),i=V(e,t.init,r)[0],o=[];for(let a of s)try{let l;if(t.pattern){if(l=fi(r,t.pattern,a),l===null)continue}else l=Co(r,t.varName,a);if(i=V(i,t.update,l)[0],t.extract){let c=V(i,t.extract,l);o.push(...c)}else o.push(i)}catch(l){throw l instanceof As?l.withPrependedResults(o):l}return o}case"Label":try{return V(e,t.body,{...r,labels:new Set([...r.labels??[],t.name])})}catch(s){if(s instanceof As&&s.label===t.name)return s.partialResults;throw s}case"Break":throw new As(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 o={...r,funcs:s};return V(e,t.body,o)}default:{let s=t;throw new Error(`Unknown AST node type: ${s.type}`)}}}function im(e,t){return e<0?Math.max(0,t+e):Math.min(e,t)}function N5(e,t,n,r,s){function i(l,c){switch(n){case"=":return c;case"|=":return V(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"?xl(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 o(l,c,u){switch(c.type){case"Identity":return u(l);case"Field":{if(!_e(c.name))return l;if(c.base)return o(l,c.base,f=>{if(f&&typeof f=="object"&&!Array.isArray(f)){let p=wt(f),h=Object.hasOwn(p,c.name)?p[c.name]:void 0;return ze(p,c.name,u(h)),p}return f});if(l&&typeof l=="object"&&!Array.isArray(l)){let f=wt(l),p=Object.hasOwn(f,c.name)?f[c.name]:void 0;return ze(f,c.name,u(p)),f}return l}case"Index":{let p=V(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 o(l,c.base,h=>{if(typeof p=="number"&&Array.isArray(h)){let d=[...h],m=p<0?d.length+p:p;if(m>=0){for(;d.length<=m;)d.push(null);d[m]=u(d[m])}return d}if(typeof p=="string"&&h&&typeof h=="object"&&!Array.isArray(h)){if(!_e(p))return h;let d=wt(h),m=Object.hasOwn(d,p)?d[p]:void 0;return ze(d,p,u(m)),d}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 d=[...l],m=p<0?d.length+p:p;if(m>=0){for(;d.length<=m;)d.push(null);d[m]=u(d[m])}return d}if(l==null){let d=[];for(;d.length<=p;)d.push(null);return d[p]=u(null),d}return l}if(typeof p=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!_e(p))return l;let h=wt(l),d=Object.hasOwn(h,p)?h[p]:void 0;return ze(h,p,u(d)),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[d,m]of Object.entries(p))_e(d)&&ze(h,d,u(m));return h}return p};return c.base?o(l,c.base,f):f(l)}case"Pipe":{let f=o(l,c.left,p=>p);return o(f,c.right,u)}default:return u(l)}}return o(e,t,l=>{if(n==="|=")return i(l,l);let c=V(e,r,s);return i(l,c[0]??null)})}function I5(e,t,n){function r(i,o,a){switch(o.type){case"Identity":return a;case"Field":{if(!_e(o.name))return i;if(o.base){let l=V(i,o.base,n)[0],c=r(l,{type:"Field",name:o.name},a);return r(i,o.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){let l=wt(i);return ze(l,o.name,a),l}return i}case"Index":{if(o.base){let u=V(i,o.base,n)[0],f=r(u,{type:"Index",index:o.index},a);return r(i,o.base,f)}let c=V(e,o.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]=a),u}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!_e(c))return i;let u=wt(i);return ze(u,c,a),u}return i}default:return i}}function s(i,o){switch(o.type){case"Identity":return null;case"Field":{if(!_e(o.name))return i;if(o.base){let l=V(i,o.base,n)[0];if(l==null)return i;let c=s(l,{type:"Field",name:o.name});return r(i,o.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){if(!_e(o.name))return i;let l=wt(i);return delete l[o.name],l}return i}case"Index":{if(o.base){let u=V(i,o.base,n)[0];if(u==null)return i;let f=s(u,{type:"Index",index:o.index});return r(i,o.base,f)}let c=V(e,o.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=wt(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,d,m){switch(d.type){case"Identity":return m;case"Field":{if(!_e(d.name))return h;if(h&&typeof h=="object"&&!Array.isArray(h)){let g=wt(h);return ze(g,d.name,m),g}return h}case"Index":{let y=V(e,d.index,n)[0];if(typeof y=="number"&&Array.isArray(h)){let w=[...h],b=y<0?w.length+y:y;return b>=0&&b<w.length&&(w[b]=m),w}if(typeof y=="string"&&h&&typeof h=="object"&&!Array.isArray(h)){if(!_e(y))return h;let w=wt(h);return ze(w,y,m),w}return h}case"Pipe":{let g=V(h,d.left,n)[0],y=u(g,d.right,m);return u(h,d.left,y)}default:return h}};var a=u;let l=o.left,c=o.right,f=V(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 $5(e,t,n,r,s){if(t==="and")return V(e,n,s).flatMap(l=>mn(l)?V(e,r,s).map(u=>mn(u)):[!1]);if(t==="or")return V(e,n,s).flatMap(l=>mn(l)?[!0]:V(e,r,s).map(u=>mn(u)));if(t==="//"){let l=V(e,n,s).filter(c=>c!=null&&c!==!1);return l.length>0?l:V(e,r,s)}let i=V(e,n,s),o=V(e,r,s);return i.flatMap(a=>o.map(l=>{switch(t){case"+":return a===null?l:l===null?a:typeof a=="number"&&typeof l=="number"||typeof a=="string"&&typeof l=="string"?a+l:Array.isArray(a)&&Array.isArray(l)?[...a,...l]:a&&l&&typeof a=="object"&&typeof l=="object"&&!Array.isArray(a)&&!Array.isArray(l)?xl(a,l):null;case"-":if(typeof a=="number"&&typeof l=="number")return a-l;if(Array.isArray(a)&&Array.isArray(l)){let c=new Set(l.map(u=>JSON.stringify(u)));return a.filter(u=>!c.has(JSON.stringify(u)))}if(typeof a=="string"&&typeof l=="string"){let c=u=>u.length>10?`"${u.slice(0,10)}...`:JSON.stringify(u);throw new Error(`string (${c(a)}) and string (${c(l)}) cannot be subtracted`)}return null;case"*":if(typeof a=="number"&&typeof l=="number")return a*l;if(typeof a=="string"&&typeof l=="number")return a.repeat(l);{let c=Ge(a),u=Ge(l);if(c&&u)return nc(c,u)}return null;case"/":if(typeof a=="number"&&typeof l=="number"){if(l===0)throw new Error(`number (${a}) and number (${l}) cannot be divided because the divisor is zero`);return a/l}return typeof a=="string"&&typeof l=="string"?a.split(l):null;case"%":if(typeof a=="number"&&typeof l=="number"){if(l===0)throw new Error(`number (${a}) and number (${l}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(a)&&!Number.isNaN(a)?!Number.isFinite(l)&&!Number.isNaN(l)&&a<0&&l>0?-1:0:a%l}return null;case"==":return xs(a,l);case"!=":return!xs(a,l);case"<":return ui(a,l)<0;case"<=":return ui(a,l)<=0;case">":return ui(a,l)>0;case">=":return ui(a,l)>=0;default:return null}}))}function am(e,t,n,r){let s=S5.get(t);if(s)return typeof e=="number"?[s(e)]:[null];let i=ic(e,t,n,r,V);if(i!==null)return i;let o=uc(e,t,n,r,V);if(o!==null)return o;let a=tc(e,t,n,r,V);if(a!==null)return a;let l=rc(e,t,r.limits.maxDepth);if(l!==null)return l;let c=fc(e,t);if(c!==null)return c;let u=ac(e,t,n,r,V);if(u!==null)return u;let f=Jl(e,t,n,r,V,sm,yo,mn,wo,X);if(f!==null)return f;let p=lc(e,t,n,r,V,mn,xo,Eo,I5,Ao);if(p!==null)return p;let h=sc(e,t,n,r,V,xs);if(h!==null)return h;let d=ec(e,t,n,r,V,sm,mn,X);if(d!==null)return d;let m=oc(e,t,n,r,V,mn,v5,am);if(m!==null)return m;let g=cc(e,t,n,r,V,xs);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 y=n.length>0?V(e,n[0],r)[0]:e;throw new So(y)}case"env":return[r.env?Ct(r.env):Object.create(null)];case"debug":return[e];case"input_line_number":return[1];default:{let y=`${t}/${n.length}`,w=r.funcs?.get(y);if(w){let b=w.closure??r.funcs??new Map,x=new Map(b);x.set(y,w);for(let v=0;v<w.params.length;v++){let $=w.params[v],_=n[v];if(_){let R=V(e,_,r),P;if(R.length===0)P={type:"Call",name:"empty",args:[]};else if(R.length===1)P={type:"Literal",value:R[0]};else{P={type:"Literal",value:R[R.length-1]};for(let C=R.length-2;C>=0;C--)P={type:"Comma",left:{type:"Literal",value:R[C]},right:P}}x.set(`${$}/0`,{params:[],body:P})}}let S={...r,funcs:x};return V(e,w.body,S)}throw new Error(`Unknown function: ${t}`)}}}function Ao(e,t,n,r,s){if(t.type==="Comma"){let a=t;Ao(e,a.left,n,r,s),Ao(e,a.right,n,r,s);return}let i=fr(t);if(i!==null){s.push([...r,...i]);return}if(t.type==="Iterate"){if(Array.isArray(e))for(let a=0;a<e.length;a++)s.push([...r,a]);else if(e&&typeof e=="object")for(let a of Object.keys(e))s.push([...r,a]);return}if(t.type==="Recurse"){let a=(l,c)=>{if(s.push([...r,...c]),l&&typeof l=="object")if(Array.isArray(l))for(let u=0;u<l.length;u++)a(l[u],[...c,u]);else for(let u of Object.keys(l))a(l[u],[...c,u])};a(e,[]);return}if(t.type==="Pipe"){let a=fr(t.left);if(a!==null){let l=V(e,t.left,n);for(let c of l)Ao(c,t.right,n,[...r,...a],s);return}}V(e,t,n).length>0&&s.push(r)}var As,So,A5,om,S5,lm=k(()=>{"use strict";er();Ae();zn();nm();rm();Sn();bo();As=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])}},So=class extends Error{value;constructor(t){super(typeof t=="string"?t:JSON.stringify(t)),this.value=t,this.name="JqError"}},A5=1e4,om=2e3,S5=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 um(e){let t=[],n=0,r=(c=0)=>e[n+c],s=()=>e[n++],i=()=>n>=e.length,o=c=>c>="0"&&c<="9",a=c=>c>="a"&&c<="z"||c>="A"&&c<="Z"||c==="_",l=c=>a(c)||o(c);for(;!i();){let c=n,u=s();if(!(u===" "||u===" "||u===`
555
555
  `||u==="\r")){if(u==="#"){for(;!i()&&r()!==`
556
556
  `;)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(o(u)){let f=u;for(;!i()&&(o(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+=`
557
557
  `;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(a(u)||u==="$"||u==="@"){let f=u;for(;!i()&&l(r());)f+=s();let p=cm.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 fm(e){let t=um(e);return new hc(t).parse()}var cm,vo,hc,pm=k(()=>{"use strict";cm=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"]]),vo=new Set(cm.values());hc=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"||vo.has(r.type)?r.pos===n.pos+1:!1}isIdentLike(){let t=this.peek().type;return t==="IDENT"||vo.has(t)}consumeFieldNameAfterDot(t){let n=this.peek();return n.type==="STRING"?this.advance().value:(n.type==="IDENT"||vo.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"||vo.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 o=n.type==="var"?n.name:"";return{type:"Foreach",expr:t,varName:o,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 o=this.expect("IDENT","Expected parameter name");for(r.push(o.value);this.match("SEMICOLON");){let a=this.expect("IDENT","Expected parameter name");r.push(a.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 o=this.parseExpr();r.push({cond:i,then:o})}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,o="";for(;s<t.length&&i>0;)t[s]==="("?i++:t[s]===")"&&i--,i>0&&(o+=t[s]),s++;let a=um(o),l=new e(a);n.push(l.parse())}else r+=t[s],s++;return r&&n.push(r),{type:"StringInterp",parts:n}}}});var hm=k(()=>{"use strict";lm();pm()});var mm={};ee(mm,{flagsForFuzzing:()=>D5,jqCommand:()=>P5});function T5(e){switch(e){case"\b":return"\\b";case"\f":return"\\f";case`
@@ -561,7 +561,7 @@ ${e.map(l=>o.repeat(i+1)+pi(l,!1,!1,r,s,i+1)).join(`,
561
561
  ${o.repeat(i)}]`;if(typeof e=="object"){let a=Object.keys(e);return r&&(a=a.sort()),a.length===0?"{}":t?`{${a.map(c=>`${JSON.stringify(c)}:${pi(e[c],!0,!1,r,s)}`).join(",")}}`:`{
562
562
  ${a.map(c=>{let u=pi(e[c],!1,!1,r,s,i+1);return`${o.repeat(i+1)}${JSON.stringify(c)}: ${u}`}).join(`,
563
563
  `)}
564
- ${o.repeat(i)}}`}return String(e)}var R5,P5,D5,gm=k(()=>{"use strict";he();En();Ae();Wn();un();Tr();oe();hm();Sn();R5={name:"jq",summary:"command-line JSON processor",usage:"jq [OPTIONS] FILTER [FILE]",options:["-R, --raw-input read input as raw strings, not JSON","-r, --raw-output output strings without quotes","-c, --compact compact output (no pretty printing)","-e, --exit-status set exit status based on output","-s, --slurp read entire input into array","-n, --null-input don't read any input","-j, --join-output don't print newlines after each output","-a, --ascii force ASCII output","-S, --sort-keys sort object keys","-C, --color colorize output (ignored)","-M, --monochrome monochrome output (ignored)"," --arg name value bind $name to string value"," --tab use tabs for indentation"," --help display this help and exit"]};P5={name:"jq",async execute(e,t){it(t.requireDefenseContext,"jq","execution entry");let n=(y,w)=>_t(t.requireDefenseContext,"jq",y,w);if(U(e))return M(R5);let r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,p=new Map,h=".",d=!1,m=[];for(let y=0;y<e.length;y++){let w=e[y];if(w==="-R"||w==="--raw-input")s=!0;else if(w==="-r"||w==="--raw-output")r=!0;else if(w==="-c"||w==="--compact-output")i=!0;else if(w==="-e"||w==="--exit-status")o=!0;else if(w==="-s"||w==="--slurp")a=!0;else if(w==="-n"||w==="--null-input")l=!0;else if(w==="-j"||w==="--join-output")c=!0;else if(!(w==="-a"||w==="--ascii")){if(w==="-S"||w==="--sort-keys")u=!0;else if(!(w==="-C"||w==="--color")){if(!(w==="-M"||w==="--monochrome"))if(w==="--tab")f=!0;else if(w==="--arg"){let b=e[y+1],x=e[y+2];if(b===void 0||x===void 0)return{stdout:"",stderr:`jq: --arg requires two arguments
564
+ ${o.repeat(i)}}`}return String(e)}var R5,P5,D5,gm=k(()=>{"use strict";he();En();Ae();zn();un();Tr();oe();hm();Sn();R5={name:"jq",summary:"command-line JSON processor",usage:"jq [OPTIONS] FILTER [FILE]",options:["-R, --raw-input read input as raw strings, not JSON","-r, --raw-output output strings without quotes","-c, --compact compact output (no pretty printing)","-e, --exit-status set exit status based on output","-s, --slurp read entire input into array","-n, --null-input don't read any input","-j, --join-output don't print newlines after each output","-a, --ascii force ASCII output","-S, --sort-keys sort object keys","-C, --color colorize output (ignored)","-M, --monochrome monochrome output (ignored)"," --arg name value bind $name to string value"," --tab use tabs for indentation"," --help display this help and exit"]};P5={name:"jq",async execute(e,t){it(t.requireDefenseContext,"jq","execution entry");let n=(y,w)=>_t(t.requireDefenseContext,"jq",y,w);if(U(e))return M(R5);let r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,p=new Map,h=".",d=!1,m=[];for(let y=0;y<e.length;y++){let w=e[y];if(w==="-R"||w==="--raw-input")s=!0;else if(w==="-r"||w==="--raw-output")r=!0;else if(w==="-c"||w==="--compact-output")i=!0;else if(w==="-e"||w==="--exit-status")o=!0;else if(w==="-s"||w==="--slurp")a=!0;else if(w==="-n"||w==="--null-input")l=!0;else if(w==="-j"||w==="--join-output")c=!0;else if(!(w==="-a"||w==="--ascii")){if(w==="-S"||w==="--sort-keys")u=!0;else if(!(w==="-C"||w==="--color")){if(!(w==="-M"||w==="--monochrome"))if(w==="--tab")f=!0;else if(w==="--arg"){let b=e[y+1],x=e[y+2];if(b===void 0||x===void 0)return{stdout:"",stderr:`jq: --arg requires two arguments
565
565
  `,exitCode:2};p.set(`$${b}`,x),y+=2}else if(w==="-")m.push("-");else{if(w.startsWith("--"))return K("jq",w);if(w.startsWith("-")){for(let b of w.slice(1))if(b==="R")s=!0;else if(b==="r")r=!0;else if(b==="c")i=!0;else if(b==="e")o=!0;else if(b==="s")a=!0;else if(b==="n")l=!0;else if(b==="j")c=!0;else if(b!=="a"){if(b==="S")u=!0;else if(b!=="C"){if(b!=="M")return K("jq",`-${b}`)}}}else d?m.push(w):(h=w,d=!0)}}}}let g=[];if(!l)if(m.length===0||m.length===1&&m[0]==="-")g.push({source:"stdin",content:se(t.stdin)});else{let y=await n("file read",()=>$r(t,m,{cmdName:"jq",stopOnError:!0}));if(y.exitCode!==0)return{stdout:"",stderr:y.stderr,exitCode:2};g=y.files.map(w=>({source:w.filename||"stdin",content:se(w.content)}))}try{let y=fm(h),w=[],b={limits:t.limits?{maxIterations:t.limits.maxJqIterations}:void 0,env:t.env,vars:p,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext};if(l)w=V(null,y,b);else if(s&&a){let P=g.map(({content:C})=>C).join("");w=V(P,y,b)}else if(s)for(let{content:P}of g){let C=P.split(`
566
566
  `);C.length>0&&C.at(-1)===""&&C.pop();for(let T of C)w.push(...V(T,y,b))}else if(a){let P=[];for(let{content:C}of g){let T=C.trim();T&&P.push(...dm(T))}w=V(P,y,b)}else for(let{content:P}of g){let C=P.trim();if(!C)continue;let T=dm(C);for(let O of T)w.push(...V(O,y,b))}let x=w.map(P=>pi(P,i,r,u,f)),S=c?"":`
567
567
  `,v=x.join(S),$=t.limits?.maxStringLength;if($!==void 0&&$>0&&v.length>$)throw new X(`jq: output size limit exceeded (${$} bytes)`,"string_length");let _=o&&(w.length===0||w.every(P=>P==null||P===!1))?1:0;return{stdout:v?c?v:`${v}
@@ -625,9 +625,9 @@ sys 0.00
625
625
  `,x||f++}}return f>0&&(p+=`${e}: WARNING: ${f} computed checksum${f>1?"s":""} did NOT match
626
626
  `),{stdout:p,stderr:"",exitCode:f>0?1:0}}let c="",u=0;for(let f of a){let p=await l(f);if(p===null){c+=`${e}: ${f}: No such file or directory
627
627
  `,u=1;continue}c+=`${await Fm(t,p)} ${f}
628
- `}return{stdout:c,stderr:"",exitCode:u}}}}var cx,$o=k(()=>{"use strict";he();oe();cx=new Map([["sha1","SHA-1"],["sha256","SHA-256"]])});var Lm={};ee(Lm,{flagsForFuzzing:()=>px,md5sumCommand:()=>fx});var fx,px,Mm=k(()=>{"use strict";$o();fx=Cs("md5sum","md5","compute MD5 message digest"),px={name:"md5sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var Um={};ee(Um,{flagsForFuzzing:()=>dx,sha1sumCommand:()=>hx});var hx,dx,Bm=k(()=>{"use strict";$o();hx=Cs("sha1sum","sha1","compute SHA1 message digest"),dx={name:"sha1sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var Wm={};ee(Wm,{flagsForFuzzing:()=>gx,sha256sumCommand:()=>mx});var mx,gx,zm=k(()=>{"use strict";$o();mx=Cs("sha256sum","sha256","compute SHA256 message digest"),gx={name:"sha256sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var Hm=Li(gc=>{gc.read=function(e,t,n,r,s){var i,o,a=s*8-r-1,l=(1<<a)-1,c=l>>1,u=-7,f=n?s-1:0,p=n?-1:1,h=e[t+f];for(f+=p,i=h&(1<<-u)-1,h>>=-u,u+=a;u>0;i=i*256+e[t+f],f+=p,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=r;u>0;o=o*256+e[t+f],f+=p,u-=8);if(i===0)i=1-c;else{if(i===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-c}return(h?-1:1)*o*Math.pow(2,i-r)};gc.write=function(e,t,n,r,s,i){var o,a,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,d=r?1:-1,m=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?t+=p/l:t+=p*Math.pow(2,1-f),t*l>=2&&(o++,l/=2),o+f>=u?(a=0,o=u):o+f>=1?(a=(t*l-1)*Math.pow(2,s),o=o+f):(a=t*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;e[n+h]=a&255,h+=d,a/=256,s-=8);for(o=o<<s|a,c+=s;c>0;e[n+h]=o&255,h+=d,o/=256,c-=8);e[n+h-d]|=m*128}});function wx(){if(!(typeof globalThis.TextDecoder>"u"))return To??(To=new globalThis.TextDecoder("utf-8"))}function Gm(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{let n=wx();return n?n.decode(e):xx(e)}case"utf-16le":return Ex(e);case"us-ascii":case"ascii":return Ax(e);case"latin1":case"iso-8859-1":return Sx(e);case"windows-1252":return Cx(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function yc(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function gt(e,t,n){t.push(n),t.length>=vs&&yc(e,t)}function bx(e,t,n){if(n<=65535){gt(e,t,n);return}n-=65536,gt(e,t,55296+(n>>10)),gt(e,t,56320+(n&1023))}function xx(e){let t=[],n=[],r=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(r=3);r<e.length;){let s=e[r];if(s<=127){gt(t,n,s),r++;continue}if(s<194||s>244){gt(t,n,kn),r++;continue}if(s<=223){if(r+1>=e.length){gt(t,n,kn),r++;continue}let u=e[r+1];if((u&192)!==128){gt(t,n,kn),r++;continue}let f=(s&31)<<6|u&63;gt(t,n,f),r+=2;continue}if(s<=239){if(r+2>=e.length){gt(t,n,kn),r++;continue}let u=e[r+1],f=e[r+2];if(!((u&192)===128&&(f&192)===128&&!(s===224&&u<160)&&!(s===237&&u>=160))){gt(t,n,kn),r++;continue}let h=(s&15)<<12|(u&63)<<6|f&63;gt(t,n,h),r+=3;continue}if(r+3>=e.length){gt(t,n,kn),r++;continue}let i=e[r+1],o=e[r+2],a=e[r+3];if(!((i&192)===128&&(o&192)===128&&(a&192)===128&&!(s===240&&i<144)&&!(s===244&&i>143))){gt(t,n,kn),r++;continue}let c=(s&7)<<18|(i&63)<<12|(o&63)<<6|a&63;bx(t,n,c),r+=4}return yc(t,n),t.join("")}function Ex(e){let t=[],n=[],r=e.length,s=0;for(;s+1<r;){let i=e[s]|e[s+1]<<8;if(s+=2,i>=55296&&i<=56319){if(s+1<r){let o=e[s]|e[s+1]<<8;o>=56320&&o<=57343?(gt(t,n,i),gt(t,n,o),s+=2):gt(t,n,kn)}else gt(t,n,kn);continue}if(i>=56320&&i<=57343){gt(t,n,kn);continue}gt(t,n,i)}return s<r&&gt(t,n,kn),yc(t,n),t.join("")}function Ax(e){let t=[];for(let n=0;n<e.length;n+=vs){let r=Math.min(e.length,n+vs),s=new Array(r-n);for(let i=n,o=0;i<r;i++,o++)s[o]=e[i]&127;t.push(String.fromCharCode.apply(null,s))}return t.join("")}function Sx(e){let t=[];for(let n=0;n<e.length;n+=vs){let r=Math.min(e.length,n+vs),s=new Array(r-n);for(let i=n,o=0;i<r;i++,o++)s[o]=e[i];t.push(String.fromCharCode.apply(null,s))}return t.join("")}function Cx(e){let t=[],n="";for(let r=0;r<e.length;r++){let s=e[r],i=s>=128&&s<=159?jm[s]:void 0;n+=i??String.fromCharCode(s),n.length>=vs&&(t.push(n),n="")}return n&&t.push(n),t.join("")}var jm,yx,To,vs,kn,Vm=k(()=>{jm={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"},yx={};for(let[e,t]of Object.entries(jm))yx[t]=Number.parseInt(e,10);vs=32*1024,kn=65533});function Vt(e){return new DataView(e.buffer,e.byteOffset)}var qm,Zm,rt,Mr,nt,wc,Km,Qm,qt,di=k(()=>{qm=Pf(Hm(),1);Vm();Zm={len:1,get(e,t){return Vt(e).getUint8(t)},put(e,t,n){return Vt(e).setUint8(t,n),t+1}},rt={len:2,get(e,t){return Vt(e).getUint16(t,!0)},put(e,t,n){return Vt(e).setUint16(t,n,!0),t+2}},Mr={len:2,get(e,t){return Vt(e).getUint16(t)},put(e,t,n){return Vt(e).setUint16(t,n),t+2}},nt={len:4,get(e,t){return Vt(e).getUint32(t,!0)},put(e,t,n){return Vt(e).setUint32(t,n,!0),t+4}},wc={len:4,get(e,t){return Vt(e).getUint32(t)},put(e,t,n){return Vt(e).setUint32(t,n),t+4}},Km={len:4,get(e,t){return Vt(e).getInt32(t)},put(e,t,n){return Vt(e).setInt32(t,n),t+4}},Qm={len:8,get(e,t){return Vt(e).getBigUint64(t,!0)},put(e,t,n){return Vt(e).setBigUint64(t,n,!0),t+8}},qt=class{constructor(t,n){this.len=t,this.encoding=n}get(t,n=0){let r=t.subarray(n,n+this.len);return Gm(r,this.encoding)}}});var kx,Be,Ur,mi=k(()=>{kx="End-Of-Stream",Be=class extends Error{constructor(){super(kx),this.name="EndOfStreamError"}},Ur=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}});var Xm=k(()=>{});var Br,Oo=k(()=>{mi();Br=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 Ur;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 Ym=k(()=>{mi();Xm();Oo()});var Ro,Jm=k(()=>{Oo();Ro=class extends Br{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var gi,bc=k(()=>{Jm();gi=class extends Ro{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 ks,xc=k(()=>{mi();Oo();ks=class extends Br{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 Ec(e){try{let t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new ks(t):new gi(t)}catch(t){if(t instanceof TypeError)return new ks(e.getReader());throw t}}var e0=k(()=>{bc();xc()});var Wr=k(()=>{mi();Ym();bc();xc();e0()});var tr,yi=k(()=>{Wr();tr=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(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");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 Ix,Po,t0=k(()=>{yi();Wr();Ix=256e3,Po=class extends tr{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 o=new Uint8Array(r.length+i);return s=await this.peekBuffer(o,{mayBeLess:r.mayBeLess}),t.set(o.subarray(i)),s-i}if(i<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{s=await this.streamReader.peek(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){if(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");let n=Math.min(Ix,t),r=new Uint8Array(n),s=0;for(;s<t;){let i=t-s,o=await this.readBuffer(r,{length:Math.min(n,i)});if(o<0)return o;s+=o}return s}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}});var Do,n0=k(()=>{Wr();yi();Do=class extends tr{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 _o,r0=k(()=>{Wr();yi();_o=class extends tr{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 s0(e,t){let n=Ec(e),r=t??{},s=r.onClose;return r.onClose=async()=>{if(await n.close(),s)return s()},new Po(n,r)}function i0(e,t){return new Do(e,t)}function o0(e,t){return new _o(e,t)}var a0=k(()=>{Wr();t0();n0();r0();Wr();yi()});var c0=Li((gP,l0)=>{var Ns=1e3,Is=Ns*60,$s=Is*60,zr=$s*24,Tx=zr*7,Ox=zr*365.25;l0.exports=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return Rx(e);if(n==="number"&&isFinite(e))return t.long?Dx(e):Px(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Rx(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*Ox;case"weeks":case"week":case"w":return n*Tx;case"days":case"day":case"d":return n*zr;case"hours":case"hour":case"hrs":case"hr":case"h":return n*$s;case"minutes":case"minute":case"mins":case"min":case"m":return n*Is;case"seconds":case"second":case"secs":case"sec":case"s":return n*Ns;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function Px(e){var t=Math.abs(e);return t>=zr?Math.round(e/zr)+"d":t>=$s?Math.round(e/$s)+"h":t>=Is?Math.round(e/Is)+"m":t>=Ns?Math.round(e/Ns)+"s":e+"ms"}function Dx(e){var t=Math.abs(e);return t>=zr?Fo(e,t,zr,"day"):t>=$s?Fo(e,t,$s,"hour"):t>=Is?Fo(e,t,Is,"minute"):t>=Ns?Fo(e,t,Ns,"second"):e+" ms"}function Fo(e,t,n,r){var s=t>=n*1.5;return Math.round(e/n)+" "+r+(s?"s":"")}});var f0=Li((yP,u0)=>{function _x(e){n.debug=n,n.default=n,n.coerce=l,n.disable=o,n.enable=s,n.enabled=a,n.humanize=c0(),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,d;function m(...g){if(!m.enabled)return;let y=m,w=Number(new Date),b=w-(f||w);y.diff=b,y.prev=f,y.curr=w,f=w,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,(v,$)=>{if(v==="%%")return"%";x++;let _=n.formatters[$];if(typeof _=="function"){let R=g[x];v=_.call(y,R),g.splice(x,1),x--}return v}),n.formatArgs.call(y,g),(y.log||n.log).apply(y,g)}return m.namespace=u,m.useColors=n.useColors(),m.color=n.selectColor(u),m.extend=r,m.destroy=n.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(h!==n.namespaces&&(h=n.namespaces,d=n.enabled(u)),d),set:g=>{p=g}}),typeof n.init=="function"&&n.init(m),m}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,d=-1,m=0;for(;p<u.length;)if(h<f.length&&(f[h]===u[p]||f[h]==="*"))f[h]==="*"?(d=h,m=p,h++):(p++,h++);else if(d!==-1)h=d+1,m++,p=m;else return!1;for(;h<f.length&&f[h]==="*";)h++;return h===f.length}function o(){let u=[...n.names,...n.skips.map(f=>"-"+f)].join(",");return n.enable(""),u}function a(u){for(let f of n.skips)if(i(u,f))return!1;for(let f of n.names)if(i(u,f))return!0;return!1}function l(u){return u instanceof Error?u.stack||u.message:u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}u0.exports=_x});var p0=Li((Zt,Lo)=>{Zt.formatArgs=Lx;Zt.save=Mx;Zt.load=Ux;Zt.useColors=Fx;Zt.storage=Bx();Zt.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`."))}})();Zt.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 Fx(){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 Lx(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Lo.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)}Zt.log=console.debug||console.log||(()=>{});function Mx(e){try{e?Zt.storage.setItem("debug",e):Zt.storage.removeItem("debug")}catch{}}function Ux(){let e;try{e=Zt.storage.getItem("debug")||Zt.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Bx(){try{return localStorage}catch{}}Lo.exports=f0()(Zt);var{formatters:Wx}=Lo.exports;Wx.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Hr,Ac,h0,d0,m0,g0=k(()=>{di();Hr={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Ac={get(e){return{signature:nt.get(e,0),compressedSize:nt.get(e,8),uncompressedSize:nt.get(e,12)}},len:16},h0={get(e){let t=rt.get(e,6);return{signature:nt.get(e,0),minVersion:rt.get(e,4),dataDescriptor:!!(t&8),compressedMethod:rt.get(e,8),compressedSize:nt.get(e,18),uncompressedSize:nt.get(e,22),filenameLength:rt.get(e,26),extraFieldLength:rt.get(e,28),filename:null}},len:30},d0={get(e){return{signature:nt.get(e,0),nrOfThisDisk:rt.get(e,4),nrOfThisDiskWithTheStart:rt.get(e,6),nrOfEntriesOnThisDisk:rt.get(e,8),nrOfEntriesOfSize:rt.get(e,10),sizeOfCd:nt.get(e,12),offsetOfStartOfCd:nt.get(e,16),zipFileCommentLength:rt.get(e,20)}},len:22},m0={get(e){let t=rt.get(e,8);return{signature:nt.get(e,0),minVersion:rt.get(e,6),dataDescriptor:!!(t&8),compressedMethod:rt.get(e,10),compressedSize:nt.get(e,20),uncompressedSize:nt.get(e,24),filenameLength:rt.get(e,28),extraFieldLength:rt.get(e,30),fileCommentLength:rt.get(e,32),relativeOffsetOfLocalHeader:nt.get(e,42),filename:null}},len:46}});function w0(e){let t=new Uint8Array(nt.len);return nt.put(t,0,e),t}function Hx(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 o=0;o<r;o++)if(e[s+o]!==t[o]){i=!1;break}if(i)return s}return-1}function jx(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 y0,zn,Sc,zx,Mo,jr,b0=k(()=>{di();y0=Pf(p0(),1);g0();zn=(0,y0.default)("tokenizer:inflate"),Sc=256*1024,zx=w0(Hr.DataDescriptor),Mo=w0(Hr.EndOfCentralDirectory),jr=class e{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Sc)}async isZip(){return await this.peekSignature()===Hr.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(nt)}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]===Mo[0]&&r[s+1]===Mo[1]&&r[s+2]===Mo[2]&&r[s+3]===Mo[3])return t.fileInfo.size-n+s;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){zn("Cannot reading central-directory without random-read support");return}zn("Reading central-directory...");let t=this.tokenizer.position,n=await this.findEndOfCentralDirectoryLocator();if(n>0){zn("Central-directory 32-bit signature found");let r=await this.tokenizer.readToken(d0,n),s=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let i=0;i<r.nrOfEntriesOfSize;++i){let o=await this.tokenizer.readToken(m0);if(o.signature!==Hr.CentralFileHeader)throw new Error("Expected Central-File-Header signature");o.filename=await this.tokenizer.readToken(new qt(o.filenameLength,"utf-8")),await this.tokenizer.ignore(o.extraFieldLength),await this.tokenizer.ignore(o.fileCommentLength),s.push(o),zn(`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 o;if(await this.tokenizer.ignore(s.extraFieldLength),s.dataDescriptor&&s.compressedSize===0){let a=[],l=Sc;zn("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let c=-1;for(;c<0&&l===Sc;){l=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),c=Hx(this.syncBuffer.subarray(0,l),zx);let u=c>=0?c:l;if(i.handler){let f=new Uint8Array(u);await this.tokenizer.readBuffer(f),a.push(f)}else await this.tokenizer.ignore(u)}zn(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),i.handler&&await this.inflate(s,jx(a),i.handler)}else i.handler?(zn(`Reading compressed-file-data: ${s.compressedSize} bytes`),o=new Uint8Array(s.compressedSize),await this.tokenizer.readBuffer(o),await this.inflate(s,o,i.handler)):(zn(`Ignoring compressed-file-data: ${s.compressedSize} bytes`),await this.tokenizer.ignore(s.compressedSize));if(zn(`Reading data-descriptor at pos=${this.tokenizer.position}`),s.dataDescriptor&&(await this.tokenizer.readToken(Ac)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Ac.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 o=new Uint8Array(r.compressedSize);await this.tokenizer.readBuffer(o),await this.inflate(i,o,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}`);zn(`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 o=await new Response(s).arrayBuffer();return new Uint8Array(o)}catch(i){let o=i instanceof Error?`Failed to deflate ZIP entry: ${i.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(o)}}async readLocalFileHeader(){let t=await this.tokenizer.peekToken(nt);if(t===Hr.LocalFileHeader){let n=await this.tokenizer.readToken(h0);return n.filename=await this.tokenizer.readToken(new qt(n.filenameLength,"utf-8")),n}if(t===Hr.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var wi,x0=k(()=>{wi=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 E0=k(()=>{b0();x0()});function Cc(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 NP,IP,$P,A0=k(()=>{NP={utf8:new globalThis.TextDecoder("utf8")},IP=new globalThis.TextEncoder,$P=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"))});function S0(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 C0(e,t=0){let n=Number.parseInt(new qt(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 v0,k0=k(()=>{di();v0={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4}});var N0,I0,$0=k(()=>{N0=["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"]});function sE(e){let t=e?.streamReader;if(t?.constructor?.name!=="WebStreamByobReader")return e;let{reader:n}=t,r=async()=>{await n.cancel(),n.releaseLock()};return t.close=r,t.abort=async()=>{t.interrupted=!0,await r()},e}function Ic(e,t,n){if(!Number.isFinite(e)||e<0||e>t)throw new nr(`${n} has invalid size ${e} (maximum ${t} bytes)`);return e}async function pr(e,t,{maximumLength:n=gn,reason:r="skip"}={}){let s=Ic(t,n,r);await e.ignore(s)}async function kc(e,t,n,{maximumLength:r=t.length,reason:s="read"}={}){let i=n?.length??t.length,o=Ic(i,r,s);return e.readBuffer(t,{...n,length:o})}async function iE(e,{maximumLength:t=jn}={}){let s=new ReadableStream({start(c){c.enqueue(e),c.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),i=[],o=0;try{for(;;){let{done:c,value:u}=await s.read();if(c)break;if(o+=u.length,o>t)throw await s.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);i.push(u)}}finally{s.releaseLock()}let a=new Uint8Array(o),l=0;for(let c of i)a.set(c,l),l+=c.length;return a}function aE(e,t){if(e.length<Uo)return-1;let n=e.length-Uo;for(let r=0;r<=n;r++)if(nt.get(e,r)===z0&&nt.get(e,r+8)===t+r)return r;return-1}function lE(e){return(e.codePointAt(0)&32)!==0}function cE(e,t){let n=new Uint8Array(t),r=0;for(let s of e)n.set(s,r),r+=s.length;return n}async function uE(e,{shouldBuffer:t,maximumLength:n=jn}={}){let{syncBuffer:r}=e,{length:s}=r,i=[],o=0;for(;;){let a=await e.tokenizer.peekBuffer(r,{mayBeLess:!0}),l=aE(r.subarray(0,a),o),c=l>=0?0:a===s?Math.min(oE,a-1):0,u=l>=0?l:a-c;if(u===0)break;if(o+=u,o>n)throw new Error(`ZIP entry compressed data exceeds ${n} bytes`);if(t){let f=new Uint8Array(u);await e.tokenizer.readBuffer(f),i.push(f)}else await e.tokenizer.ignore(u);if(l>=0)break}if(Lt(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=o),!!t)return cE(i,o)}function fE(e,t){return Lt(e.tokenizer)?Math.max(0,gn-(e.tokenizer.position-t)):Math.max(0,jn-e.knownSizeDescriptorScannedBytes)}async function pE(e,t,{shouldBuffer:n,maximumDescriptorLength:r=jn}={}){if(t.dataDescriptor&&t.compressedSize===0)return uE(e,{shouldBuffer:n,maximumLength:r});if(!n){await pr(e.tokenizer,t.compressedSize,{maximumLength:Lt(e.tokenizer)?jn:e.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let s=wE(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>s)throw new Error(`ZIP entry compressed data exceeds ${s} bytes`);let i=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(i),i}function hE(e,t){let n=e.getReader(),r=0,s=!1,i=!1,o=async a=>{s||i||(i=!0,await n.cancel(a))};return new ReadableStream({async pull(a){if(r>=t){a.close(),await o();return}let{done:l,value:c}=await n.read();if(l||!c){s=!0,a.close();return}let u=t-r;if(c.length>u){a.enqueue(c.subarray(0,u)),r+=u,a.close(),await o();return}a.enqueue(c),r+=c.length},async cancel(a){await o(a)}})}async function H0(e,t){return new Nc(t).fromBuffer(e)}function U0(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 Hn(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}function dE(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):bi}function mE(e,t,n){return n===void 0?e.read(t):(n.throwIfAborted(),new Promise((r,s)=>{let i=()=>{n.removeEventListener("abort",o)},o=()=>{let a=n.reason;i(),(async()=>{try{await e.cancel(a)}catch{}})(),s(a)};n.addEventListener("abort",o,{once:!0}),(async()=>{try{let a=await e.read(t);i(),r(a)}catch(a){i(),s(a)}})()}))}function gE(e){return Number.isFinite(e)?Math.max(0,Math.min(Gx,Math.trunc(e))):0}function yE(e){return Number.isFinite(e)?Math.max(0,e):Number.MAX_SAFE_INTEGER}function Lt(e){let t=e.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function xi(e,t,n){return Lt(e)&&e.position-t>n}function wE(e){let t=e.fileInfo.size,n=Number.isFinite(t)?Math.max(0,t-e.position):Number.MAX_SAFE_INTEGER;return Math.min(n,Vx)}function bE(e){if(e instanceof Be||e instanceof nr)return!0;if(!(e instanceof Error))return!1;if(tE.has(e.message)||rE.has(e.code))return!0;for(let t of nE)if(e.message.startsWith(t))return!0;return!1}function B0(e,t=jn){let n=[e.compressedSize,e.uncompressedSize];for(let r of n)if(!Number.isFinite(r)||r<0||r>t)return!1;return!0}function xE(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function EE(e,t){t.startsWith("word/")&&(e.hasWordDirectory=!0),t.startsWith("ppt/")&&(e.hasPresentationDirectory=!0),t.startsWith("xl/")&&(e.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(e.hasThreeDimensionalModelEntry=!0)}function W0(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(e.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(e.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(e.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function AE(e){let t=e.indexOf('.main+xml"');if(t===-1){let s="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return e.includes(`ContentType="${s}"`)?s:void 0}let n=e.slice(0,t),r=n.lastIndexOf('"');return n.slice(r+1)}var bi,Gx,jn,T0,Vx,gn,Bo,O0,qx,Zx,R0,vc,P0,D0,Kx,Qx,Xx,Yx,Jx,_0,F0,L0,eE,M0,tE,nE,rE,nr,z0,Uo,oE,Nc,MP,UP,j0=k(()=>{di();a0();E0();A0();k0();$0();bi=4100,Gx=bi-2,jn=1024*1024,T0=1024,Vx=2**31-1,gn=16*1024*1024,Bo=jn,O0=jn,qx=gn,Zx=1,R0=100,vc=gn,P0=64,D0=Bo,Kx=256,Qx=512,Xx=gn,Yx=512,Jx=512,_0=256,F0=Bo,L0=Bo,eE=Bo,M0=gn,tE=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),nE=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],rE=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]),nr=class extends Error{};z0=134695760,Uo=16,oE=Uo-1;jr.prototype.inflate=async function(e,t,n){if(e.compressedMethod===0)return n(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);let r=await iE(t,{maximumLength:jn});return n(r)};jr.prototype.unzip=async function(e){let t=!1,n=0,r=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(xi(this.tokenizer,r,gn))throw new nr(`ZIP stream probing exceeds ${gn} bytes`);let s=await this.readLocalFileHeader();if(!s)break;if(n++,n>T0)throw new Error(`ZIP entry count exceeds ${T0}`);let i=e(s);t=!!i.stop,await this.tokenizer.ignore(s.extraFieldLength);let o=await pE(this,s,{shouldBuffer:!!i.handler,maximumDescriptorLength:Math.min(jn,fE(this,r))});if(i.handler&&await this.inflate(s,o,i.handler),s.dataDescriptor){let a=new Uint8Array(Uo);if(await this.tokenizer.readBuffer(a),nt.get(a,0)!==z0)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-a.length}`)}if(xi(this.tokenizer,r,gn))throw new nr(`ZIP stream probing exceeds ${gn} bytes`)}while(!t)};Nc=class e{constructor(t){let n=gE(t?.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:n},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return sE(s0(t,this.getTokenizerOptions()))}async parseTokenizer(t,n=0){this.detectionReentryCount=n;let r=t.position;for(let s of this.detectors){let i;try{i=await s.detect(t)}catch(o){if(o instanceof Be||o instanceof nr)return;throw o}if(i)return i;if(r!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}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(i0(n,this.getTokenizerOptions()))}async fromBlob(t){this.options.signal?.throwIfAborted();let n=o0(t,this.getTokenizerOptions());return this.fromTokenizer(n)}async fromStream(t){this.options.signal?.throwIfAborted();let n=this.createTokenizerFromWebStream(t);return this.fromTokenizer(n)}async toDetectionStream(t,n){let r=dE(n?.sampleSize??bi),s,i,o=t.getReader({mode:"byob"});try{let{value:c,done:u}=await mE(o,new Uint8Array(r),this.options.signal);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{o.releaseLock()}let a=new TransformStream({async start(c){c.enqueue(i)},transform(c,u){u.enqueue(c)}}),l=t.pipeThrough(a);return l.fileType=s,l}async detectGzip(t){if(this.gzipProbeDepth>=Zx)return{ext:"gz",mime:"application/gzip"};let n=new wi(t),r=hE(n.inflate(),qx),s=Lt(t),i,o,a,l;if(s){let c=new AbortController;i=setTimeout(()=>{c.abort(new DOMException(`Operation timed out after ${R0} ms`,"TimeoutError"))},R0),o=this.options.signal===void 0?c.signal:AbortSignal.any([this.options.signal,c.signal]),a=new e({...this.options,signal:o}),a.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{l=await(a??this).fromStream(r)}catch(c){if(c?.name==="AbortError"&&o?.reason?.name!=="TimeoutError")throw c}finally{clearTimeout(i),s||this.gzipProbeDepth--}return l?.ext==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,n){return Hn(this.buffer,t,n)}checkString(t,n){return this.check(S0(t,n?.encoding),n)}detectConfident=async t=>{if(this.buffer=new Uint8Array(bi),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,Lt(t)&&(await t.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(t);if(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.detectionReentryCount>=_0?void 0:(this.detectionReentryCount++,await 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]))return this.detectGzip(t);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await pr(t,6,{maximumLength:6,reason:"ID3 header prefix"});let n=await t.readToken(v0),r=Lt(t);if(!Number.isFinite(n)||n<0||r&&(n>vc||t.position+n>vc))return;if(t.position+n>t.fileInfo.size)return r?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await pr(t,n,{maximumLength:r?vc:t.fileInfo.size,reason:"ID3 payload"})}catch(s){if(s instanceof Be)return;throw s}return this.detectionReentryCount>=_0?void 0:(this.detectionReentryCount++,this.parseTokenizer(t,this.detectionReentryCount))}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,r=xE();try{await new jr(t).unzip(s=>{EE(r,s.filename);let i=s.filename==="[Content_Types].xml",o=W0(r);if(!i&&o)return n=o,{stop:!0};switch(s.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 B0(s,O0)?{async handler(a){let l=new TextDecoder("utf-8").decode(a).trim();n=U0(l)},stop:!0}:{};case"[Content_Types].xml":return r.hasContentTypesEntry=!0,B0(s,O0)?(r.isParsingContentTypes=!0,{async handler(a){let l=new TextDecoder("utf-8").decode(a),c=AE(l);c&&(n=U0(c)),r.hasParsedContentTypesEntry=!0,r.isParsingContentTypes=!1},stop:!0}):(r.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(s.filename)?(n={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(s){if(!bE(s))throw s;r.isParsingContentTypes&&(r.isParsingContentTypes=!1,r.hasUnparseableContentTypes=!0)}return n??W0(r)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await t.ignore(28);let n=new Uint8Array(8);return await t.readBuffer(n),Hn(n,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:Hn(n,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Hn(n,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Hn(n,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Hn(n,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Hn(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 l=await t.peekNumber(Zm),c=128,u=0;for(;(l&c)===0&&c!==0;)++u,c>>=1;let f=new Uint8Array(u+1);return await kc(t,f,void 0,{maximumLength:f.length,reason:"EBML field"}),f}async function r(){let l=await n(),c=await n();c[0]^=128>>c.length-1;let u=Math.min(6,c.length),f=new DataView(l.buffer),p=new DataView(c.buffer,c.length-u,u);return{id:Cc(f),len:Cc(p)}}async function s(l){let c=0;for(;l>0;){if(c++,c>Kx||xi(t,o,gn))return;let u=t.position,f=await r();if(f.id===17026){if(f.len>P0)return;let p=Ic(f.len,P0,"EBML DocType");return(await t.readToken(new qt(p))).replaceAll(/\00.*$/g,"")}if(Lt(t)&&(!Number.isFinite(f.len)||f.len<0||f.len>D0)||(await pr(t,f.len,{maximumLength:Lt(t)?D0:t.fileInfo.size,reason:"EBML payload"}),--l,t.position<=u))return}}let i=await r(),o=t.position;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([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||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])){let n=wc.get(this.buffer,4),r=Mr.get(this.buffer,6);if(n>0&&n<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(r>30)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 qt(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 qt(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
628
+ `}return{stdout:c,stderr:"",exitCode:u}}}}var cx,$o=k(()=>{"use strict";he();oe();cx=new Map([["sha1","SHA-1"],["sha256","SHA-256"]])});var Lm={};ee(Lm,{flagsForFuzzing:()=>px,md5sumCommand:()=>fx});var fx,px,Mm=k(()=>{"use strict";$o();fx=Cs("md5sum","md5","compute MD5 message digest"),px={name:"md5sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var Um={};ee(Um,{flagsForFuzzing:()=>dx,sha1sumCommand:()=>hx});var hx,dx,Bm=k(()=>{"use strict";$o();hx=Cs("sha1sum","sha1","compute SHA1 message digest"),dx={name:"sha1sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var Wm={};ee(Wm,{flagsForFuzzing:()=>gx,sha256sumCommand:()=>mx});var mx,gx,zm=k(()=>{"use strict";$o();mx=Cs("sha256sum","sha256","compute SHA256 message digest"),gx={name:"sha256sum",flags:[{flag:"-c",type:"boolean"}],needsFiles:!0}});var Hm=Li(gc=>{gc.read=function(e,t,n,r,s){var i,o,a=s*8-r-1,l=(1<<a)-1,c=l>>1,u=-7,f=n?s-1:0,p=n?-1:1,h=e[t+f];for(f+=p,i=h&(1<<-u)-1,h>>=-u,u+=a;u>0;i=i*256+e[t+f],f+=p,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=r;u>0;o=o*256+e[t+f],f+=p,u-=8);if(i===0)i=1-c;else{if(i===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-c}return(h?-1:1)*o*Math.pow(2,i-r)};gc.write=function(e,t,n,r,s,i){var o,a,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,d=r?1:-1,m=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?t+=p/l:t+=p*Math.pow(2,1-f),t*l>=2&&(o++,l/=2),o+f>=u?(a=0,o=u):o+f>=1?(a=(t*l-1)*Math.pow(2,s),o=o+f):(a=t*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;e[n+h]=a&255,h+=d,a/=256,s-=8);for(o=o<<s|a,c+=s;c>0;e[n+h]=o&255,h+=d,o/=256,c-=8);e[n+h-d]|=m*128}});function wx(){if(!(typeof globalThis.TextDecoder>"u"))return To??(To=new globalThis.TextDecoder("utf-8"))}function Gm(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{let n=wx();return n?n.decode(e):xx(e)}case"utf-16le":return Ex(e);case"us-ascii":case"ascii":return Ax(e);case"latin1":case"iso-8859-1":return Sx(e);case"windows-1252":return Cx(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function yc(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function gt(e,t,n){t.push(n),t.length>=vs&&yc(e,t)}function bx(e,t,n){if(n<=65535){gt(e,t,n);return}n-=65536,gt(e,t,55296+(n>>10)),gt(e,t,56320+(n&1023))}function xx(e){let t=[],n=[],r=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(r=3);r<e.length;){let s=e[r];if(s<=127){gt(t,n,s),r++;continue}if(s<194||s>244){gt(t,n,kn),r++;continue}if(s<=223){if(r+1>=e.length){gt(t,n,kn),r++;continue}let u=e[r+1];if((u&192)!==128){gt(t,n,kn),r++;continue}let f=(s&31)<<6|u&63;gt(t,n,f),r+=2;continue}if(s<=239){if(r+2>=e.length){gt(t,n,kn),r++;continue}let u=e[r+1],f=e[r+2];if(!((u&192)===128&&(f&192)===128&&!(s===224&&u<160)&&!(s===237&&u>=160))){gt(t,n,kn),r++;continue}let h=(s&15)<<12|(u&63)<<6|f&63;gt(t,n,h),r+=3;continue}if(r+3>=e.length){gt(t,n,kn),r++;continue}let i=e[r+1],o=e[r+2],a=e[r+3];if(!((i&192)===128&&(o&192)===128&&(a&192)===128&&!(s===240&&i<144)&&!(s===244&&i>143))){gt(t,n,kn),r++;continue}let c=(s&7)<<18|(i&63)<<12|(o&63)<<6|a&63;bx(t,n,c),r+=4}return yc(t,n),t.join("")}function Ex(e){let t=[],n=[],r=e.length,s=0;for(;s+1<r;){let i=e[s]|e[s+1]<<8;if(s+=2,i>=55296&&i<=56319){if(s+1<r){let o=e[s]|e[s+1]<<8;o>=56320&&o<=57343?(gt(t,n,i),gt(t,n,o),s+=2):gt(t,n,kn)}else gt(t,n,kn);continue}if(i>=56320&&i<=57343){gt(t,n,kn);continue}gt(t,n,i)}return s<r&&gt(t,n,kn),yc(t,n),t.join("")}function Ax(e){let t=[];for(let n=0;n<e.length;n+=vs){let r=Math.min(e.length,n+vs),s=new Array(r-n);for(let i=n,o=0;i<r;i++,o++)s[o]=e[i]&127;t.push(String.fromCharCode.apply(null,s))}return t.join("")}function Sx(e){let t=[];for(let n=0;n<e.length;n+=vs){let r=Math.min(e.length,n+vs),s=new Array(r-n);for(let i=n,o=0;i<r;i++,o++)s[o]=e[i];t.push(String.fromCharCode.apply(null,s))}return t.join("")}function Cx(e){let t=[],n="";for(let r=0;r<e.length;r++){let s=e[r],i=s>=128&&s<=159?jm[s]:void 0;n+=i??String.fromCharCode(s),n.length>=vs&&(t.push(n),n="")}return n&&t.push(n),t.join("")}var jm,yx,To,vs,kn,Vm=k(()=>{jm={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"},yx={};for(let[e,t]of Object.entries(jm))yx[t]=Number.parseInt(e,10);vs=32*1024,kn=65533});function Vt(e){return new DataView(e.buffer,e.byteOffset)}var qm,Zm,rt,Mr,nt,wc,Km,Qm,qt,di=k(()=>{qm=Pf(Hm(),1);Vm();Zm={len:1,get(e,t){return Vt(e).getUint8(t)},put(e,t,n){return Vt(e).setUint8(t,n),t+1}},rt={len:2,get(e,t){return Vt(e).getUint16(t,!0)},put(e,t,n){return Vt(e).setUint16(t,n,!0),t+2}},Mr={len:2,get(e,t){return Vt(e).getUint16(t)},put(e,t,n){return Vt(e).setUint16(t,n),t+2}},nt={len:4,get(e,t){return Vt(e).getUint32(t,!0)},put(e,t,n){return Vt(e).setUint32(t,n,!0),t+4}},wc={len:4,get(e,t){return Vt(e).getUint32(t)},put(e,t,n){return Vt(e).setUint32(t,n),t+4}},Km={len:4,get(e,t){return Vt(e).getInt32(t)},put(e,t,n){return Vt(e).setInt32(t,n),t+4}},Qm={len:8,get(e,t){return Vt(e).getBigUint64(t,!0)},put(e,t,n){return Vt(e).setBigUint64(t,n,!0),t+8}},qt=class{constructor(t,n){this.len=t,this.encoding=n}get(t,n=0){let r=t.subarray(n,n+this.len);return Gm(r,this.encoding)}}});var kx,Be,Ur,mi=k(()=>{kx="End-Of-Stream",Be=class extends Error{constructor(){super(kx),this.name="EndOfStreamError"}},Ur=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}});var Xm=k(()=>{});var Br,Oo=k(()=>{mi();Br=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 Ur;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 Ym=k(()=>{mi();Xm();Oo()});var Ro,Jm=k(()=>{Oo();Ro=class extends Br{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var gi,bc=k(()=>{Jm();gi=class extends Ro{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 ks,xc=k(()=>{mi();Oo();ks=class extends Br{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 Ec(e){try{let t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new ks(t):new gi(t)}catch(t){if(t instanceof TypeError)return new ks(e.getReader());throw t}}var e0=k(()=>{bc();xc()});var Wr=k(()=>{mi();Ym();bc();xc();e0()});var tr,yi=k(()=>{Wr();tr=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(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");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 Ix,Po,t0=k(()=>{yi();Wr();Ix=256e3,Po=class extends tr{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 o=new Uint8Array(r.length+i);return s=await this.peekBuffer(o,{mayBeLess:r.mayBeLess}),t.set(o.subarray(i)),s-i}if(i<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{s=await this.streamReader.peek(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){if(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");let n=Math.min(Ix,t),r=new Uint8Array(n),s=0;for(;s<t;){let i=t-s,o=await this.readBuffer(r,{length:Math.min(n,i)});if(o<0)return o;s+=o}return s}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}});var Do,n0=k(()=>{Wr();yi();Do=class extends tr{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 _o,r0=k(()=>{Wr();yi();_o=class extends tr{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 s0(e,t){let n=Ec(e),r=t??{},s=r.onClose;return r.onClose=async()=>{if(await n.close(),s)return s()},new Po(n,r)}function i0(e,t){return new Do(e,t)}function o0(e,t){return new _o(e,t)}var a0=k(()=>{Wr();t0();n0();r0();Wr();yi()});var c0=Li((gP,l0)=>{var Ns=1e3,Is=Ns*60,$s=Is*60,zr=$s*24,Tx=zr*7,Ox=zr*365.25;l0.exports=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return Rx(e);if(n==="number"&&isFinite(e))return t.long?Dx(e):Px(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Rx(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*Ox;case"weeks":case"week":case"w":return n*Tx;case"days":case"day":case"d":return n*zr;case"hours":case"hour":case"hrs":case"hr":case"h":return n*$s;case"minutes":case"minute":case"mins":case"min":case"m":return n*Is;case"seconds":case"second":case"secs":case"sec":case"s":return n*Ns;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function Px(e){var t=Math.abs(e);return t>=zr?Math.round(e/zr)+"d":t>=$s?Math.round(e/$s)+"h":t>=Is?Math.round(e/Is)+"m":t>=Ns?Math.round(e/Ns)+"s":e+"ms"}function Dx(e){var t=Math.abs(e);return t>=zr?Fo(e,t,zr,"day"):t>=$s?Fo(e,t,$s,"hour"):t>=Is?Fo(e,t,Is,"minute"):t>=Ns?Fo(e,t,Ns,"second"):e+" ms"}function Fo(e,t,n,r){var s=t>=n*1.5;return Math.round(e/n)+" "+r+(s?"s":"")}});var f0=Li((yP,u0)=>{function _x(e){n.debug=n,n.default=n,n.coerce=l,n.disable=o,n.enable=s,n.enabled=a,n.humanize=c0(),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,d;function m(...g){if(!m.enabled)return;let y=m,w=Number(new Date),b=w-(f||w);y.diff=b,y.prev=f,y.curr=w,f=w,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,(v,$)=>{if(v==="%%")return"%";x++;let _=n.formatters[$];if(typeof _=="function"){let R=g[x];v=_.call(y,R),g.splice(x,1),x--}return v}),n.formatArgs.call(y,g),(y.log||n.log).apply(y,g)}return m.namespace=u,m.useColors=n.useColors(),m.color=n.selectColor(u),m.extend=r,m.destroy=n.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(h!==n.namespaces&&(h=n.namespaces,d=n.enabled(u)),d),set:g=>{p=g}}),typeof n.init=="function"&&n.init(m),m}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,d=-1,m=0;for(;p<u.length;)if(h<f.length&&(f[h]===u[p]||f[h]==="*"))f[h]==="*"?(d=h,m=p,h++):(p++,h++);else if(d!==-1)h=d+1,m++,p=m;else return!1;for(;h<f.length&&f[h]==="*";)h++;return h===f.length}function o(){let u=[...n.names,...n.skips.map(f=>"-"+f)].join(",");return n.enable(""),u}function a(u){for(let f of n.skips)if(i(u,f))return!1;for(let f of n.names)if(i(u,f))return!0;return!1}function l(u){return u instanceof Error?u.stack||u.message:u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}u0.exports=_x});var p0=Li((Zt,Lo)=>{Zt.formatArgs=Lx;Zt.save=Mx;Zt.load=Ux;Zt.useColors=Fx;Zt.storage=Bx();Zt.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`."))}})();Zt.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 Fx(){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 Lx(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Lo.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)}Zt.log=console.debug||console.log||(()=>{});function Mx(e){try{e?Zt.storage.setItem("debug",e):Zt.storage.removeItem("debug")}catch{}}function Ux(){let e;try{e=Zt.storage.getItem("debug")||Zt.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Bx(){try{return localStorage}catch{}}Lo.exports=f0()(Zt);var{formatters:Wx}=Lo.exports;Wx.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Hr,Ac,h0,d0,m0,g0=k(()=>{di();Hr={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Ac={get(e){return{signature:nt.get(e,0),compressedSize:nt.get(e,8),uncompressedSize:nt.get(e,12)}},len:16},h0={get(e){let t=rt.get(e,6);return{signature:nt.get(e,0),minVersion:rt.get(e,4),dataDescriptor:!!(t&8),compressedMethod:rt.get(e,8),compressedSize:nt.get(e,18),uncompressedSize:nt.get(e,22),filenameLength:rt.get(e,26),extraFieldLength:rt.get(e,28),filename:null}},len:30},d0={get(e){return{signature:nt.get(e,0),nrOfThisDisk:rt.get(e,4),nrOfThisDiskWithTheStart:rt.get(e,6),nrOfEntriesOnThisDisk:rt.get(e,8),nrOfEntriesOfSize:rt.get(e,10),sizeOfCd:nt.get(e,12),offsetOfStartOfCd:nt.get(e,16),zipFileCommentLength:rt.get(e,20)}},len:22},m0={get(e){let t=rt.get(e,8);return{signature:nt.get(e,0),minVersion:rt.get(e,6),dataDescriptor:!!(t&8),compressedMethod:rt.get(e,10),compressedSize:nt.get(e,20),uncompressedSize:nt.get(e,24),filenameLength:rt.get(e,28),extraFieldLength:rt.get(e,30),fileCommentLength:rt.get(e,32),relativeOffsetOfLocalHeader:nt.get(e,42),filename:null}},len:46}});function w0(e){let t=new Uint8Array(nt.len);return nt.put(t,0,e),t}function Hx(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 o=0;o<r;o++)if(e[s+o]!==t[o]){i=!1;break}if(i)return s}return-1}function jx(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 y0,Hn,Sc,zx,Mo,jr,b0=k(()=>{di();y0=Pf(p0(),1);g0();Hn=(0,y0.default)("tokenizer:inflate"),Sc=256*1024,zx=w0(Hr.DataDescriptor),Mo=w0(Hr.EndOfCentralDirectory),jr=class e{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Sc)}async isZip(){return await this.peekSignature()===Hr.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(nt)}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]===Mo[0]&&r[s+1]===Mo[1]&&r[s+2]===Mo[2]&&r[s+3]===Mo[3])return t.fileInfo.size-n+s;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){Hn("Cannot reading central-directory without random-read support");return}Hn("Reading central-directory...");let t=this.tokenizer.position,n=await this.findEndOfCentralDirectoryLocator();if(n>0){Hn("Central-directory 32-bit signature found");let r=await this.tokenizer.readToken(d0,n),s=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let i=0;i<r.nrOfEntriesOfSize;++i){let o=await this.tokenizer.readToken(m0);if(o.signature!==Hr.CentralFileHeader)throw new Error("Expected Central-File-Header signature");o.filename=await this.tokenizer.readToken(new qt(o.filenameLength,"utf-8")),await this.tokenizer.ignore(o.extraFieldLength),await this.tokenizer.ignore(o.fileCommentLength),s.push(o),Hn(`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 o;if(await this.tokenizer.ignore(s.extraFieldLength),s.dataDescriptor&&s.compressedSize===0){let a=[],l=Sc;Hn("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let c=-1;for(;c<0&&l===Sc;){l=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),c=Hx(this.syncBuffer.subarray(0,l),zx);let u=c>=0?c:l;if(i.handler){let f=new Uint8Array(u);await this.tokenizer.readBuffer(f),a.push(f)}else await this.tokenizer.ignore(u)}Hn(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),i.handler&&await this.inflate(s,jx(a),i.handler)}else i.handler?(Hn(`Reading compressed-file-data: ${s.compressedSize} bytes`),o=new Uint8Array(s.compressedSize),await this.tokenizer.readBuffer(o),await this.inflate(s,o,i.handler)):(Hn(`Ignoring compressed-file-data: ${s.compressedSize} bytes`),await this.tokenizer.ignore(s.compressedSize));if(Hn(`Reading data-descriptor at pos=${this.tokenizer.position}`),s.dataDescriptor&&(await this.tokenizer.readToken(Ac)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Ac.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 o=new Uint8Array(r.compressedSize);await this.tokenizer.readBuffer(o),await this.inflate(i,o,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}`);Hn(`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 o=await new Response(s).arrayBuffer();return new Uint8Array(o)}catch(i){let o=i instanceof Error?`Failed to deflate ZIP entry: ${i.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(o)}}async readLocalFileHeader(){let t=await this.tokenizer.peekToken(nt);if(t===Hr.LocalFileHeader){let n=await this.tokenizer.readToken(h0);return n.filename=await this.tokenizer.readToken(new qt(n.filenameLength,"utf-8")),n}if(t===Hr.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var wi,x0=k(()=>{wi=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 E0=k(()=>{b0();x0()});function Cc(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 NP,IP,$P,A0=k(()=>{NP={utf8:new globalThis.TextDecoder("utf8")},IP=new globalThis.TextEncoder,$P=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"))});function S0(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 C0(e,t=0){let n=Number.parseInt(new qt(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 v0,k0=k(()=>{di();v0={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4}});var N0,I0,$0=k(()=>{N0=["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"]});function sE(e){let t=e?.streamReader;if(t?.constructor?.name!=="WebStreamByobReader")return e;let{reader:n}=t,r=async()=>{await n.cancel(),n.releaseLock()};return t.close=r,t.abort=async()=>{t.interrupted=!0,await r()},e}function Ic(e,t,n){if(!Number.isFinite(e)||e<0||e>t)throw new nr(`${n} has invalid size ${e} (maximum ${t} bytes)`);return e}async function pr(e,t,{maximumLength:n=gn,reason:r="skip"}={}){let s=Ic(t,n,r);await e.ignore(s)}async function kc(e,t,n,{maximumLength:r=t.length,reason:s="read"}={}){let i=n?.length??t.length,o=Ic(i,r,s);return e.readBuffer(t,{...n,length:o})}async function iE(e,{maximumLength:t=Gn}={}){let s=new ReadableStream({start(c){c.enqueue(e),c.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),i=[],o=0;try{for(;;){let{done:c,value:u}=await s.read();if(c)break;if(o+=u.length,o>t)throw await s.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);i.push(u)}}finally{s.releaseLock()}let a=new Uint8Array(o),l=0;for(let c of i)a.set(c,l),l+=c.length;return a}function aE(e,t){if(e.length<Uo)return-1;let n=e.length-Uo;for(let r=0;r<=n;r++)if(nt.get(e,r)===z0&&nt.get(e,r+8)===t+r)return r;return-1}function lE(e){return(e.codePointAt(0)&32)!==0}function cE(e,t){let n=new Uint8Array(t),r=0;for(let s of e)n.set(s,r),r+=s.length;return n}async function uE(e,{shouldBuffer:t,maximumLength:n=Gn}={}){let{syncBuffer:r}=e,{length:s}=r,i=[],o=0;for(;;){let a=await e.tokenizer.peekBuffer(r,{mayBeLess:!0}),l=aE(r.subarray(0,a),o),c=l>=0?0:a===s?Math.min(oE,a-1):0,u=l>=0?l:a-c;if(u===0)break;if(o+=u,o>n)throw new Error(`ZIP entry compressed data exceeds ${n} bytes`);if(t){let f=new Uint8Array(u);await e.tokenizer.readBuffer(f),i.push(f)}else await e.tokenizer.ignore(u);if(l>=0)break}if(Lt(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=o),!!t)return cE(i,o)}function fE(e,t){return Lt(e.tokenizer)?Math.max(0,gn-(e.tokenizer.position-t)):Math.max(0,Gn-e.knownSizeDescriptorScannedBytes)}async function pE(e,t,{shouldBuffer:n,maximumDescriptorLength:r=Gn}={}){if(t.dataDescriptor&&t.compressedSize===0)return uE(e,{shouldBuffer:n,maximumLength:r});if(!n){await pr(e.tokenizer,t.compressedSize,{maximumLength:Lt(e.tokenizer)?Gn:e.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let s=wE(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>s)throw new Error(`ZIP entry compressed data exceeds ${s} bytes`);let i=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(i),i}function hE(e,t){let n=e.getReader(),r=0,s=!1,i=!1,o=async a=>{s||i||(i=!0,await n.cancel(a))};return new ReadableStream({async pull(a){if(r>=t){a.close(),await o();return}let{done:l,value:c}=await n.read();if(l||!c){s=!0,a.close();return}let u=t-r;if(c.length>u){a.enqueue(c.subarray(0,u)),r+=u,a.close(),await o();return}a.enqueue(c),r+=c.length},async cancel(a){await o(a)}})}async function H0(e,t){return new Nc(t).fromBuffer(e)}function U0(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 jn(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}function dE(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):bi}function mE(e,t,n){return n===void 0?e.read(t):(n.throwIfAborted(),new Promise((r,s)=>{let i=()=>{n.removeEventListener("abort",o)},o=()=>{let a=n.reason;i(),(async()=>{try{await e.cancel(a)}catch{}})(),s(a)};n.addEventListener("abort",o,{once:!0}),(async()=>{try{let a=await e.read(t);i(),r(a)}catch(a){i(),s(a)}})()}))}function gE(e){return Number.isFinite(e)?Math.max(0,Math.min(Gx,Math.trunc(e))):0}function yE(e){return Number.isFinite(e)?Math.max(0,e):Number.MAX_SAFE_INTEGER}function Lt(e){let t=e.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function xi(e,t,n){return Lt(e)&&e.position-t>n}function wE(e){let t=e.fileInfo.size,n=Number.isFinite(t)?Math.max(0,t-e.position):Number.MAX_SAFE_INTEGER;return Math.min(n,Vx)}function bE(e){if(e instanceof Be||e instanceof nr)return!0;if(!(e instanceof Error))return!1;if(tE.has(e.message)||rE.has(e.code))return!0;for(let t of nE)if(e.message.startsWith(t))return!0;return!1}function B0(e,t=Gn){let n=[e.compressedSize,e.uncompressedSize];for(let r of n)if(!Number.isFinite(r)||r<0||r>t)return!1;return!0}function xE(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function EE(e,t){t.startsWith("word/")&&(e.hasWordDirectory=!0),t.startsWith("ppt/")&&(e.hasPresentationDirectory=!0),t.startsWith("xl/")&&(e.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(e.hasThreeDimensionalModelEntry=!0)}function W0(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(e.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(e.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(e.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function AE(e){let t=e.indexOf('.main+xml"');if(t===-1){let s="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return e.includes(`ContentType="${s}"`)?s:void 0}let n=e.slice(0,t),r=n.lastIndexOf('"');return n.slice(r+1)}var bi,Gx,Gn,T0,Vx,gn,Bo,O0,qx,Zx,R0,vc,P0,D0,Kx,Qx,Xx,Yx,Jx,_0,F0,L0,eE,M0,tE,nE,rE,nr,z0,Uo,oE,Nc,MP,UP,j0=k(()=>{di();a0();E0();A0();k0();$0();bi=4100,Gx=bi-2,Gn=1024*1024,T0=1024,Vx=2**31-1,gn=16*1024*1024,Bo=Gn,O0=Gn,qx=gn,Zx=1,R0=100,vc=gn,P0=64,D0=Bo,Kx=256,Qx=512,Xx=gn,Yx=512,Jx=512,_0=256,F0=Bo,L0=Bo,eE=Bo,M0=gn,tE=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),nE=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],rE=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]),nr=class extends Error{};z0=134695760,Uo=16,oE=Uo-1;jr.prototype.inflate=async function(e,t,n){if(e.compressedMethod===0)return n(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);let r=await iE(t,{maximumLength:Gn});return n(r)};jr.prototype.unzip=async function(e){let t=!1,n=0,r=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(xi(this.tokenizer,r,gn))throw new nr(`ZIP stream probing exceeds ${gn} bytes`);let s=await this.readLocalFileHeader();if(!s)break;if(n++,n>T0)throw new Error(`ZIP entry count exceeds ${T0}`);let i=e(s);t=!!i.stop,await this.tokenizer.ignore(s.extraFieldLength);let o=await pE(this,s,{shouldBuffer:!!i.handler,maximumDescriptorLength:Math.min(Gn,fE(this,r))});if(i.handler&&await this.inflate(s,o,i.handler),s.dataDescriptor){let a=new Uint8Array(Uo);if(await this.tokenizer.readBuffer(a),nt.get(a,0)!==z0)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-a.length}`)}if(xi(this.tokenizer,r,gn))throw new nr(`ZIP stream probing exceeds ${gn} bytes`)}while(!t)};Nc=class e{constructor(t){let n=gE(t?.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:n},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return sE(s0(t,this.getTokenizerOptions()))}async parseTokenizer(t,n=0){this.detectionReentryCount=n;let r=t.position;for(let s of this.detectors){let i;try{i=await s.detect(t)}catch(o){if(o instanceof Be||o instanceof nr)return;throw o}if(i)return i;if(r!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}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(i0(n,this.getTokenizerOptions()))}async fromBlob(t){this.options.signal?.throwIfAborted();let n=o0(t,this.getTokenizerOptions());return this.fromTokenizer(n)}async fromStream(t){this.options.signal?.throwIfAborted();let n=this.createTokenizerFromWebStream(t);return this.fromTokenizer(n)}async toDetectionStream(t,n){let r=dE(n?.sampleSize??bi),s,i,o=t.getReader({mode:"byob"});try{let{value:c,done:u}=await mE(o,new Uint8Array(r),this.options.signal);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{o.releaseLock()}let a=new TransformStream({async start(c){c.enqueue(i)},transform(c,u){u.enqueue(c)}}),l=t.pipeThrough(a);return l.fileType=s,l}async detectGzip(t){if(this.gzipProbeDepth>=Zx)return{ext:"gz",mime:"application/gzip"};let n=new wi(t),r=hE(n.inflate(),qx),s=Lt(t),i,o,a,l;if(s){let c=new AbortController;i=setTimeout(()=>{c.abort(new DOMException(`Operation timed out after ${R0} ms`,"TimeoutError"))},R0),o=this.options.signal===void 0?c.signal:AbortSignal.any([this.options.signal,c.signal]),a=new e({...this.options,signal:o}),a.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{l=await(a??this).fromStream(r)}catch(c){if(c?.name==="AbortError"&&o?.reason?.name!=="TimeoutError")throw c}finally{clearTimeout(i),s||this.gzipProbeDepth--}return l?.ext==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,n){return jn(this.buffer,t,n)}checkString(t,n){return this.check(S0(t,n?.encoding),n)}detectConfident=async t=>{if(this.buffer=new Uint8Array(bi),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,Lt(t)&&(await t.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(t);if(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.detectionReentryCount>=_0?void 0:(this.detectionReentryCount++,await 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]))return this.detectGzip(t);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await pr(t,6,{maximumLength:6,reason:"ID3 header prefix"});let n=await t.readToken(v0),r=Lt(t);if(!Number.isFinite(n)||n<0||r&&(n>vc||t.position+n>vc))return;if(t.position+n>t.fileInfo.size)return r?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await pr(t,n,{maximumLength:r?vc:t.fileInfo.size,reason:"ID3 payload"})}catch(s){if(s instanceof Be)return;throw s}return this.detectionReentryCount>=_0?void 0:(this.detectionReentryCount++,this.parseTokenizer(t,this.detectionReentryCount))}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,r=xE();try{await new jr(t).unzip(s=>{EE(r,s.filename);let i=s.filename==="[Content_Types].xml",o=W0(r);if(!i&&o)return n=o,{stop:!0};switch(s.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 B0(s,O0)?{async handler(a){let l=new TextDecoder("utf-8").decode(a).trim();n=U0(l)},stop:!0}:{};case"[Content_Types].xml":return r.hasContentTypesEntry=!0,B0(s,O0)?(r.isParsingContentTypes=!0,{async handler(a){let l=new TextDecoder("utf-8").decode(a),c=AE(l);c&&(n=U0(c)),r.hasParsedContentTypesEntry=!0,r.isParsingContentTypes=!1},stop:!0}):(r.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(s.filename)?(n={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(s){if(!bE(s))throw s;r.isParsingContentTypes&&(r.isParsingContentTypes=!1,r.hasUnparseableContentTypes=!0)}return n??W0(r)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await t.ignore(28);let n=new Uint8Array(8);return await t.readBuffer(n),jn(n,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:jn(n,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:jn(n,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:jn(n,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:jn(n,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:jn(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 l=await t.peekNumber(Zm),c=128,u=0;for(;(l&c)===0&&c!==0;)++u,c>>=1;let f=new Uint8Array(u+1);return await kc(t,f,void 0,{maximumLength:f.length,reason:"EBML field"}),f}async function r(){let l=await n(),c=await n();c[0]^=128>>c.length-1;let u=Math.min(6,c.length),f=new DataView(l.buffer),p=new DataView(c.buffer,c.length-u,u);return{id:Cc(f),len:Cc(p)}}async function s(l){let c=0;for(;l>0;){if(c++,c>Kx||xi(t,o,gn))return;let u=t.position,f=await r();if(f.id===17026){if(f.len>P0)return;let p=Ic(f.len,P0,"EBML DocType");return(await t.readToken(new qt(p))).replaceAll(/\00.*$/g,"")}if(Lt(t)&&(!Number.isFinite(f.len)||f.len<0||f.len>D0)||(await pr(t,f.len,{maximumLength:Lt(t)?D0:t.fileInfo.size,reason:"EBML payload"}),--l,t.position<=u))return}}let i=await r(),o=t.position;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([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||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])){let n=wc.get(this.buffer,4),r=Mr.get(this.buffer,6);if(n>0&&n<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(r>30)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 qt(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 qt(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
629
629
  `,"\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])){let n={ext:"png",mime:"image/png"},r={ext:"apng",mime:"image/apng"};await t.ignore(8);async function s(){return{length:await t.readToken(Km),type:await t.readToken(new qt(4,"latin1"))}}let i=Lt(t),o=t.position,a=0,l=!1;do{if(a++,a>Qx||xi(t,o,Xx))break;let c=t.position,u=await s();if(u.length<0)return;if(u.type==="IHDR"){if(u.length!==13)return;l=!0}switch(u.type){case"IDAT":return n;case"acTL":return r;default:if(!l&&u.type!=="CgBI")return;if(i&&u.length>F0)return l&&lE(u.type)?n:void 0;try{await pr(t,u.length+4,{maximumLength:i?F0+4:t.fileInfo.size,reason:"PNG chunk payload"})}catch(f){if(!i&&(f instanceof nr||f instanceof Be))return n;throw f}}if(t.position<=c)break}while(t.position+8<t.fileInfo.size);return n}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 qt(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
630
- `))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])){let n=!1;try{async function r(){let a=new Uint8Array(16);return await kc(t,a,void 0,{maximumLength:a.length,reason:"ASF header GUID"}),{id:a,size:Number(await t.readToken(Qm))}}await pr(t,30,{maximumLength:30,reason:"ASF header prelude"});let s=Lt(t),i=t.position,o=0;for(;t.position+24<t.fileInfo.size&&(o++,!(o>Yx||xi(t,i,gn)));){let a=t.position,l=await r(),c=l.size-24;if(!Number.isFinite(c)||c<0){n=!0;break}if(Hn(l.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let u=new Uint8Array(16);if(c-=await kc(t,u,void 0,{maximumLength:u.length,reason:"ASF stream type GUID"}),Hn(u,[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(Hn(u,[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}if(s&&c>L0){n=!0;break}if(await pr(t,c,{maximumLength:s?L0:t.fileInfo.size,reason:"ASF header payload"}),t.position<=a){n=!0;break}}}catch(r){if(r instanceof Be||r instanceof nr)Lt(t)&&(n=!0);else throw r}return n?void 0:{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 qt(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})&&C0(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
630
+ `))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])){let n=!1;try{async function r(){let a=new Uint8Array(16);return await kc(t,a,void 0,{maximumLength:a.length,reason:"ASF header GUID"}),{id:a,size:Number(await t.readToken(Qm))}}await pr(t,30,{maximumLength:30,reason:"ASF header prelude"});let s=Lt(t),i=t.position,o=0;for(;t.position+24<t.fileInfo.size&&(o++,!(o>Yx||xi(t,i,gn)));){let a=t.position,l=await r(),c=l.size-24;if(!Number.isFinite(c)||c<0){n=!0;break}if(jn(l.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let u=new Uint8Array(16);if(c-=await kc(t,u,void 0,{maximumLength:u.length,reason:"ASF stream type GUID"}),jn(u,[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(jn(u,[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}if(s&&c>L0){n=!0;break}if(await pr(t,c,{maximumLength:s?L0:t.fileInfo.size,reason:"ASF header payload"}),t.position<=a){n=!0;break}}}catch(r){if(r instanceof Be||r instanceof nr)Lt(t)&&(n=!0);else throw r}return n?void 0:{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 qt(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})&&C0(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
631
631
  `,{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=>{this.buffer=new Uint8Array(bi);let n=yE(t.fileInfo.size);if(await t.peekBuffer(this.buffer,{length:Math.min(8,n),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,n),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let r=0;r<=this.options.mpegOffsetTolerance;++r){let s=this.scanMpeg(r);if(s)return s}};async readTiffTag(t){let n=await this.tokenizer.readToken(t?Mr:rt);switch(await 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?Mr:rt);if(!(n>Jx)&&!(Lt(this.tokenizer)&&2+n*12>M0))for(let r=0;r<n;++r){let s=await this.readTiffTag(t);if(s)return s}}async readTiffHeader(t){let n={ext:"tif",mime:"image/tiff"},r=(t?Mr:rt).get(this.buffer,2),s=(t?wc:nt).get(this.buffer,4);if(r===42){if(s>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(s>=8){let a=(t?Mr:rt).get(this.buffer,8),l=(t?Mr:rt).get(this.buffer,10);if(a===28&&l===254||a===31&&l===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(Lt(this.tokenizer)&&s>eE)return n;let i=Lt(this.tokenizer)?M0:this.tokenizer.fileInfo.size;try{await pr(this.tokenizer,s,{maximumLength:i,reason:"TIFF IFD offset"})}catch(a){if(a instanceof Be)return;throw a}let o;try{o=await this.readTiffIFD(t)}catch(a){if(a instanceof Be)return;throw a}return o??n}if(r===43)return n}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"}}}},MP=new Set(N0),UP=new Set(I0)});var G0={};ee(G0,{fileCommand:()=>TE,flagsForFuzzing:()=>OE});function kE(e,t){let n=vE.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 NE(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 IE(e,t){if(e.startsWith("#!")){let c=e.split(`
632
632
  `)[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
633
633
  `),s=e.includes("\r")&&!r,i="";r?i=", with CRLF line terminators":s&&(i=", with CR line terminators");let o=NE(t),a=o?CE.get(o):void 0;if(a)return a.mime.startsWith("text/")&&i?{description:`${a.description}${i}`,mime:a.mime}:a;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 $E(e,t){if(t.length===0)return{description:"empty",mime:"inode/x-empty"};let n=await H0(t);if(n)return{description:kE(n.ext,n.mime),mime:n.mime};let r=new TextDecoder("utf-8",{fatal:!1}).decode(t);return IE(r,e)}var SE,CE,vE,TE,OE,V0=k(()=>{"use strict";j0();oe();SE={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"]},CE=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"}]]),vE=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"]]);TE={name:"file",async execute(e,t){if(U(e))return M(SE);let n=!1,r=!1,s=[];for(let a of e)if(a.startsWith("--")){if(a==="--brief")n=!0;else if(a==="--mime"||a==="--mime-type")r=!0;else if(a!=="--dereference")return K("file",a)}else if(a.startsWith("-")&&a!=="-"){for(let l of a.slice(1))if(l==="b")n=!0;else if(l==="i")r=!0;else if(l!=="L")return K("file",`-${l}`)}else s.push(a);if(s.length===0)return{stdout:"",stderr:`Usage: file [-bLi] FILE...
@@ -665,7 +665,7 @@ Otherwise, lists all available commands.
665
665
  `)}
666
666
  `:"",stderr:"",exitCode:0}}var GE,VE,e2=k(()=>{"use strict";he();GE={name:"tac",execute:jE},VE={name:"tac",flags:[],stdinType:"text",needsFiles:!0}});var t2={};ee(t2,{flagsForFuzzing:()=>KE,hostname:()=>ZE});async function qE(e,t){return{stdout:`localhost
667
667
  `,stderr:"",exitCode:0}}var ZE,KE,n2=k(()=>{"use strict";ZE={name:"hostname",execute:qE},KE={name:"hostname",flags:[]}});var r2={};ee(r2,{flagsForFuzzing:()=>YE,whoami:()=>XE});async function QE(e,t){return{stdout:`user
668
- `,stderr:"",exitCode:0}}var XE,YE,s2=k(()=>{"use strict";XE={name:"whoami",execute:QE},YE={name:"whoami",flags:[]}});var i2={};ee(i2,{flagsForFuzzing:()=>tA,od:()=>eA});async function JE(e,t){let n="octal",r=[],s=[];for(let h=0;h<e.length;h++){let d=e[h];if(d==="-c")r.push("char");else if(d==="-An"||d==="-A"&&e[h+1]==="n")n="none",d==="-A"&&h++;else if(d==="-t"&&e[h+1]){let m=e[++h];m==="x1"?r.push("hex"):m==="c"?r.push("char"):m.startsWith("o")&&r.push("octal")}else(!d.startsWith("-")||d==="-")&&s.push(d)}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 _n(t.fs,h)}catch{return{stdout:"",stderr:`od: ${s[0]}: No such file or directory
668
+ `,stderr:"",exitCode:0}}var XE,YE,s2=k(()=>{"use strict";XE={name:"whoami",execute:QE},YE={name:"whoami",flags:[]}});var i2={};ee(i2,{flagsForFuzzing:()=>tA,od:()=>eA});async function JE(e,t){let n="octal",r=[],s=[];for(let h=0;h<e.length;h++){let d=e[h];if(d==="-c")r.push("char");else if(d==="-An"||d==="-A"&&e[h+1]==="n")n="none",d==="-A"&&h++;else if(d==="-t"&&e[h+1]){let m=e[++h];m==="x1"?r.push("hex"):m==="c"?r.push("char"):m.startsWith("o")&&r.push("octal")}else(!d.startsWith("-")||d==="-")&&s.push(d)}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 Fn(t.fs,h)}catch{return{stdout:"",stderr:`od: ${s[0]}: No such file or directory
669
669
  `,exitCode:1}}}let o=r.includes("char");function a(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 o?` ${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 d=u.slice(h,h+f);for(let m=0;m<r.length;m++){let g=r[m],y;g==="char"?y=d.map(a):g==="hex"?y=d.map(l):y=d.map(c);let w="";m===0&&n!=="none"?w=`${h.toString(8).padStart(7,"0")} `:(m>0||n==="none")&&(w=n==="none"?"":" "),p.push(w+y.join(""))}}return n!=="none"&&u.length>0&&p.push(u.length.toString(8).padStart(7,"0")),{stdout:p.length>0?`${p.join(`
670
670
  `)}
671
671
  `:"",stderr:"",exitCode:0}}var eA,tA,o2=k(()=>{"use strict";he();eA={name:"od",execute:JE},tA={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 Ho={};ee(Ho,{flagsForFuzzing:()=>fA,gunzipCommand:()=>cA,gunzipFlagsForFuzzing:()=>pA,gzipCommand:()=>lA,zcatCommand:()=>uA,zcatFlagsForFuzzing:()=>hA});import{constants as $c,gunzipSync as a2,gzipSync as l2}from"node:zlib";function c2(e){return e.best?$c.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?$c.Z_BEST_SPEED:$c.Z_DEFAULT_COMPRESSION}function u2(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 f2(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 zo(e){return e.length>=2&&e[0]===31&&e[1]===139}function Wo(e){return Buffer.from(e).toString("latin1")}function p2(e){return e.limits?.maxOutputSize??0}function Tc(e,t){if(t>0){if(f2(e)>t)throw new Error(`decompressed data exceeds limit (${t} bytes)`);return a2(e,{maxOutputLength:t})}return a2(e)}async function h2(e,t,n,r,s,i){let o=n.suffix,a,l,c,u=p2(e);if(t==="-"||t==="")if(c=Uint8Array.from(e.stdin,f=>f.charCodeAt(0)),s){if(!zo(c))return n.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: stdin: not in gzip format
@@ -768,46 +768,46 @@ Gid: ${s} ${s} ${s} ${s}
768
768
  `);)p=!0,f++;if(p&&f<r&&n[f]===")"||l)return!0}if(i===0)return!1;s++;continue}s++}return!1}dparenClosesWithSpacedParens(t){let n=this.input,r=n.length,s=t,i=2,o=!1,a=!1;for(;s<r&&i>0;){let l=n[s];if(o){l==="'"&&(o=!1),s++;continue}if(a){if(l==="\\"){s+=2;continue}l==='"'&&(a=!1),s++;continue}if(l==="'"){o=!0,s++;continue}if(l==='"'){a=!0,s++;continue}if(l==="\\"){s+=2;continue}if(l==="("){i++,s++;continue}if(l===")"){if(i--,i===1){let c=s+1;if(c<r&&n[c]===")")return!1;let u=c,f=!1;for(;u<r&&(n[u]===" "||n[u]===" "||n[u]===`
769
769
  `);)f=!0,u++;if(f&&u<r&&n[u]===")")return!0}if(i===0)return!1;s++;continue}if(i===1&&(l==="|"&&s+1<r&&n[s+1]==="|"||l==="&"&&s+1<r&&n[s+1]==="&"||l==="|"&&s+1<r&&n[s+1]!=="|"))return!0;s++}return!1}}});var Gc,Vc,W2,qc,z2,H2,j2,At,Gr=k(()=>{"use strict";gr();Gc=1e6,Vc=1e5,W2=1e6,qc=200,z2=new Set([E.LESS,E.GREAT,E.DLESS,E.DGREAT,E.LESSAND,E.GREATAND,E.LESSGREAT,E.DLESSDASH,E.CLOBBER,E.TLESS,E.AND_GREAT,E.AND_DGREAT]),H2=new Set([E.LESS,E.GREAT,E.DLESS,E.DGREAT,E.LESSAND,E.GREATAND,E.LESSGREAT,E.DLESSDASH,E.CLOBBER,E.TLESS]),j2=new Set([E.LESS,E.GREAT,E.DLESS,E.DGREAT,E.LESSAND,E.GREATAND,E.LESSGREAT,E.DLESSDASH,E.CLOBBER,E.TLESS,E.AND_GREAT,E.AND_DGREAT]),At=class extends Error{line;column;token;constructor(t,n,r,s=void 0){super(`Parse error at ${n}:${r}: ${t}`),this.line=n,this.column=r,this.token=s,this.name="ParseException"}}});var J,Vr=k(()=>{"use strict";J={script(e){return{type:"Script",statements:e}},statement(e,t=[],n=!1,r,s){let i={type:"Statement",pipelines:e,operators:t,background:n};return r&&(i.deferredError=r),s!==void 0&&(i.sourceText=s),i},pipeline(e,t=!1,n=!1,r=!1,s){return{type:"Pipeline",commands:e,negated:t,timed:n,timePosix:r,pipeStderr:s}},simpleCommand(e,t=[],n=[],r=[]){return{type:"SimpleCommand",name:e,args:t,assignments:n,redirections:r}},word(e){return{type:"Word",parts:e}},literal(e){return{type:"Literal",value:e}},singleQuoted(e){return{type:"SingleQuoted",value:e}},doubleQuoted(e){return{type:"DoubleQuoted",parts:e}},escaped(e){return{type:"Escaped",value:e}},parameterExpansion(e,t=null){return{type:"ParameterExpansion",parameter:e,operation:t}},commandSubstitution(e,t=!1){return{type:"CommandSubstitution",body:e,legacy:t}},arithmeticExpansion(e){return{type:"ArithmeticExpansion",expression:e}},assignment(e,t,n=!1,r=null){return{type:"Assignment",name:e,value:t,append:n,array:r}},redirection(e,t,n=null,r){let s={type:"Redirection",fd:n,operator:e,target:t};return r&&(s.fdVariable=r),s},hereDoc(e,t,n=!1,r=!1){return{type:"HereDoc",delimiter:e,content:t,stripTabs:n,quoted:r}},ifNode(e,t=null,n=[]){return{type:"If",clauses:e,elseBody:t,redirections:n}},forNode(e,t,n,r=[]){return{type:"For",variable:e,words:t,body:n,redirections:r}},whileNode(e,t,n=[]){return{type:"While",condition:e,body:t,redirections:n}},untilNode(e,t,n=[]){return{type:"Until",condition:e,body:t,redirections:n}},caseNode(e,t,n=[]){return{type:"Case",word:e,items:t,redirections:n}},caseItem(e,t,n=";;"){return{type:"CaseItem",patterns:e,body:t,terminator:n}},subshell(e,t=[]){return{type:"Subshell",body:e,redirections:t}},group(e,t=[]){return{type:"Group",body:e,redirections:t}},functionDef(e,t,n=[],r){return{type:"FunctionDef",name:e,body:t,redirections:n,sourceFile:r}},conditionalCommand(e,t=[],n){return{type:"ConditionalCommand",expression:e,redirections:t,line:n}},arithmeticCommand(e,t=[],n){return{type:"ArithmeticCommand",expression:e,redirections:t,line:n}}}});function Je(e,t){for(;t<e.length;){if(e[t]==="\\"&&e[t+1]===`
770
770
  `){t+=2;continue}if(/\s/.test(e[t])){t++;continue}break}return t}function Ai(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 o=Number.parseInt(r,s);return o>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:o}let i=0;for(let o of r){let a;if(/[0-9]/.test(o))a=o.charCodeAt(0)-48;else if(/[a-z]/.test(o))a=o.charCodeAt(0)-97+10;else if(/[A-Z]/.test(o))a=o.charCodeAt(0)-65+36;else if(o==="@")a=62;else if(o==="_")a=63;else return Number.NaN;if(a>=s)return Number.NaN;if(i=i*s+a,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 G2(e,t,n,r){if(n.slice(r,r+3)!=="$((")return null;let s=r+3,i=1,o=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 a=n.slice(o,s),{expr:l}=e(t,a,0);return s+=2,{expr:{type:"ArithNested",expression:l},pos:s}}function V2(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+=`
771
- `;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 q2(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 Xo,Z2=k(()=>{"use strict";Xo=["=","+=","-=","*=","/=","%=","<<=",">>=","&=","|=","^="]});function BA(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 Ne(e,t){let n=BA(t),{expr:r,pos:s}=on(e,n,0),i=Je(n,s);if(i<n.length){let o=t.slice(i).trim();if(o)return{type:"ArithmeticExpression",originalText:t,expression:{type:"ArithSyntaxError",errorToken:o,message:`${o}: syntax error: invalid arithmetic operator (error token is "${o}")`}}}return{type:"ArithmeticExpression",expression:r,originalText:t}}function Kt(e,t){return{expr:{type:"ArithSyntaxError",errorToken:e,message:`syntax error: operand expected (error token is "${e}")`},pos:t}}function Qt(e,t){return Je(e,t)>=e.length}function on(e,t,n){return WA(e,t,n)}function WA(e,t,n){let{expr:r,pos:s}=Si(e,t,n);for(s=Je(t,s);t[s]===",";){if(s++,Qt(t,s))return Kt(",",s);let{expr:o,pos:a}=Si(e,t,s);r={type:"ArithBinary",operator:",",left:r,right:o},s=Je(t,a)}return{expr:r,pos:s}}function Si(e,t,n){let{expr:r,pos:s}=zA(e,t,n);if(s=Je(t,s),t[s]==="?"){s++;let{expr:i,pos:o}=on(e,t,s);if(s=Je(t,o),t[s]===":"){s++;let{expr:a,pos:l}=on(e,t,s);return{expr:{type:"ArithTernary",condition:r,consequent:i,alternate:a},pos:l}}}return{expr:r,pos:s}}function zA(e,t,n){let{expr:r,pos:s}=K2(e,t,n);for(;s=Je(t,s),t.slice(s,s+2)==="||";){if(s+=2,Qt(t,s))return Kt("||",s);let{expr:o,pos:a}=K2(e,t,s);r={type:"ArithBinary",operator:"||",left:r,right:o},s=a}return{expr:r,pos:s}}function K2(e,t,n){let{expr:r,pos:s}=Q2(e,t,n);for(;s=Je(t,s),t.slice(s,s+2)==="&&";){if(s+=2,Qt(t,s))return Kt("&&",s);let{expr:o,pos:a}=Q2(e,t,s);r={type:"ArithBinary",operator:"&&",left:r,right:o},s=a}return{expr:r,pos:s}}function Q2(e,t,n){let{expr:r,pos:s}=X2(e,t,n);for(;s=Je(t,s),t[s]==="|"&&t[s+1]!=="|";){if(s++,Qt(t,s))return Kt("|",s);let{expr:o,pos:a}=X2(e,t,s);r={type:"ArithBinary",operator:"|",left:r,right:o},s=a}return{expr:r,pos:s}}function X2(e,t,n){let{expr:r,pos:s}=Y2(e,t,n);for(;s=Je(t,s),t[s]==="^";){if(s++,Qt(t,s))return Kt("^",s);let{expr:o,pos:a}=Y2(e,t,s);r={type:"ArithBinary",operator:"^",left:r,right:o},s=a}return{expr:r,pos:s}}function Y2(e,t,n){let{expr:r,pos:s}=J2(e,t,n);for(;s=Je(t,s),t[s]==="&"&&t[s+1]!=="&";){if(s++,Qt(t,s))return Kt("&",s);let{expr:o,pos:a}=J2(e,t,s);r={type:"ArithBinary",operator:"&",left:r,right:o},s=a}return{expr:r,pos:s}}function J2(e,t,n){let{expr:r,pos:s}=eg(e,t,n);for(;s=Je(t,s),t.slice(s,s+2)==="=="||t.slice(s,s+2)==="!=";){let i=t.slice(s,s+2);if(s+=2,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=eg(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function eg(e,t,n){let{expr:r,pos:s}=Zc(e,t,n);for(;;)if(s=Je(t,s),t.slice(s,s+2)==="<="||t.slice(s,s+2)===">="){let i=t.slice(s,s+2);if(s+=2,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=Zc(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else if(t[s]==="<"||t[s]===">"){let i=t[s];if(s++,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=Zc(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Zc(e,t,n){let{expr:r,pos:s}=tg(e,t,n);for(;s=Je(t,s),t.slice(s,s+2)==="<<"||t.slice(s,s+2)===">>";){let i=t.slice(s,s+2);if(s+=2,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=tg(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function tg(e,t,n){let{expr:r,pos:s}=ng(e,t,n);for(;s=Je(t,s),(t[s]==="+"||t[s]==="-")&&t[s+1]!==t[s];){let i=t[s];if(s++,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=ng(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function ng(e,t,n){let{expr:r,pos:s}=Yo(e,t,n);for(;;)if(s=Je(t,s),t[s]==="*"&&t[s+1]!=="*"){if(s++,Qt(t,s))return Kt("*",s);let{expr:o,pos:a}=Yo(e,t,s);r={type:"ArithBinary",operator:"*",left:r,right:o},s=a}else if(t[s]==="/"||t[s]==="%"){let i=t[s];if(s++,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=Yo(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Yo(e,t,n){let{expr:r,pos:s}=Kc(e,t,n),i=Je(t,s);if(t.slice(i,i+2)==="**"){if(i+=2,Qt(t,i))return Kt("**",i);let{expr:a,pos:l}=Yo(e,t,i);return{expr:{type:"ArithBinary",operator:"**",left:r,right:a},pos:l}}return{expr:r,pos:s}}function Kc(e,t,n){let r=Je(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:o}=Kc(e,t,r);return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}if(t[r]==="+"||t[r]==="-"||t[r]==="!"||t[r]==="~"){let s=t[r];r++;let{expr:i,pos:o}=Kc(e,t,r);return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}return jA(e,t,r)}function HA(e,t){let n=e[t];return n==="$"||n==="`"}function jA(e,t,n){let{expr:r,pos:s}=rg(e,t,n,!1),i=[r];for(;HA(t,s);){let{expr:a,pos:l}=rg(e,t,s,!0);i.push(a),s=l}i.length>1&&(r={type:"ArithConcat",parts:i});let o;if(t[s]==="["&&r.type==="ArithConcat"){s++;let{expr:a,pos:l}=on(e,t,s);o=a,s=l,t[s]==="]"&&s++}if(o&&r.type==="ArithConcat"&&(r={type:"ArithDynamicElement",nameExpr:r,subscript:o},o=void 0),s=Je(t,s),r.type==="ArithConcat"||r.type==="ArithVariable"||r.type==="ArithDynamicElement"){for(let a of Xo)if(t.slice(s,s+a.length)===a&&t.slice(s,s+a.length+1)!=="=="){s+=a.length;let{expr:l,pos:c}=Si(e,t,s);return r.type==="ArithDynamicElement"?{expr:{type:"ArithDynamicAssignment",operator:a,target:r.nameExpr,subscript:r.subscript,value:l},pos:c}:r.type==="ArithConcat"?{expr:{type:"ArithDynamicAssignment",operator:a,target:r,value:l},pos:c}:{expr:{type:"ArithAssignment",operator:a,variable:r.name,value:l},pos:c}}}if(t.slice(s,s+2)==="++"||t.slice(s,s+2)==="--"){let a=t.slice(s,s+2);return s+=2,{expr:{type:"ArithUnary",operator:a,operand:r,prefix:!1},pos:s}}return{expr:r,pos:s}}function rg(e,t,n,r=!1){let s=Je(t,n),i=G2(on,e,t,s);if(i)return i;let o=V2(t,s);if(o)return o;let a=q2(t,s);if(a)return a;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}=on(e,t,s);return s=Je(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}=on(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 Le(`${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:Ai(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 d=h+1;for(;d<t.length&&/[0-9a-zA-Z@_]/.test(t[d]);)d++;let m=t.slice(h+1,d);return{expr:{type:"ArithDynamicBase",baseExpr:p,value:m},pos:d}}if(/[0-9]/.test(t[h])||t[h]==="x"||t[h]==="X"){let d=h;if(t[h]==="x"||t[h]==="X")for(d++;d<t.length&&/[0-9a-fA-F]/.test(t[d]);)d++;else for(;d<t.length&&/[0-9]/.test(t[d]);)d++;let m=t.slice(h,d);return{expr:{type:"ArithDynamicNumber",prefix:p,suffix:m},pos:d}}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=Je(t,s),t[s]==="]"&&s++}let f;if(u===void 0){let{expr:p,pos:h}=on(e,t,s);f=p,s=h,t[s]==="]"&&s++}if(s=Je(t,s),t[s]==="["&&f)return{expr:{type:"ArithDoubleSubscript",array:c,index:f},pos:s};if(!r){for(let p of Xo)if(t.slice(s,s+p.length)===p&&t.slice(s,s+p.length+1)!=="=="){s+=p.length;let{expr:h,pos:d}=Si(e,t,s);return{expr:{type:"ArithAssignment",operator:p,variable:c,subscript:f,stringKey:u,value:h},pos:d}}}return{expr:{type:"ArithArrayElement",array:c,index:f,stringKey:u},pos:s}}if(s=Je(t,s),!r){for(let u of Xo)if(t.slice(s,s+u.length)===u&&t.slice(s,s+u.length+1)!=="=="){s+=u.length;let{expr:f,pos:p}=Si(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]!==`
771
+ `;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 q2(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 Xo,Z2=k(()=>{"use strict";Xo=["=","+=","-=","*=","/=","%=","<<=",">>=","&=","|=","^="]});function BA(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 Ie(e,t){let n=BA(t),{expr:r,pos:s}=on(e,n,0),i=Je(n,s);if(i<n.length){let o=t.slice(i).trim();if(o)return{type:"ArithmeticExpression",originalText:t,expression:{type:"ArithSyntaxError",errorToken:o,message:`${o}: syntax error: invalid arithmetic operator (error token is "${o}")`}}}return{type:"ArithmeticExpression",expression:r,originalText:t}}function Kt(e,t){return{expr:{type:"ArithSyntaxError",errorToken:e,message:`syntax error: operand expected (error token is "${e}")`},pos:t}}function Qt(e,t){return Je(e,t)>=e.length}function on(e,t,n){return WA(e,t,n)}function WA(e,t,n){let{expr:r,pos:s}=Si(e,t,n);for(s=Je(t,s);t[s]===",";){if(s++,Qt(t,s))return Kt(",",s);let{expr:o,pos:a}=Si(e,t,s);r={type:"ArithBinary",operator:",",left:r,right:o},s=Je(t,a)}return{expr:r,pos:s}}function Si(e,t,n){let{expr:r,pos:s}=zA(e,t,n);if(s=Je(t,s),t[s]==="?"){s++;let{expr:i,pos:o}=on(e,t,s);if(s=Je(t,o),t[s]===":"){s++;let{expr:a,pos:l}=on(e,t,s);return{expr:{type:"ArithTernary",condition:r,consequent:i,alternate:a},pos:l}}}return{expr:r,pos:s}}function zA(e,t,n){let{expr:r,pos:s}=K2(e,t,n);for(;s=Je(t,s),t.slice(s,s+2)==="||";){if(s+=2,Qt(t,s))return Kt("||",s);let{expr:o,pos:a}=K2(e,t,s);r={type:"ArithBinary",operator:"||",left:r,right:o},s=a}return{expr:r,pos:s}}function K2(e,t,n){let{expr:r,pos:s}=Q2(e,t,n);for(;s=Je(t,s),t.slice(s,s+2)==="&&";){if(s+=2,Qt(t,s))return Kt("&&",s);let{expr:o,pos:a}=Q2(e,t,s);r={type:"ArithBinary",operator:"&&",left:r,right:o},s=a}return{expr:r,pos:s}}function Q2(e,t,n){let{expr:r,pos:s}=X2(e,t,n);for(;s=Je(t,s),t[s]==="|"&&t[s+1]!=="|";){if(s++,Qt(t,s))return Kt("|",s);let{expr:o,pos:a}=X2(e,t,s);r={type:"ArithBinary",operator:"|",left:r,right:o},s=a}return{expr:r,pos:s}}function X2(e,t,n){let{expr:r,pos:s}=Y2(e,t,n);for(;s=Je(t,s),t[s]==="^";){if(s++,Qt(t,s))return Kt("^",s);let{expr:o,pos:a}=Y2(e,t,s);r={type:"ArithBinary",operator:"^",left:r,right:o},s=a}return{expr:r,pos:s}}function Y2(e,t,n){let{expr:r,pos:s}=J2(e,t,n);for(;s=Je(t,s),t[s]==="&"&&t[s+1]!=="&";){if(s++,Qt(t,s))return Kt("&",s);let{expr:o,pos:a}=J2(e,t,s);r={type:"ArithBinary",operator:"&",left:r,right:o},s=a}return{expr:r,pos:s}}function J2(e,t,n){let{expr:r,pos:s}=eg(e,t,n);for(;s=Je(t,s),t.slice(s,s+2)==="=="||t.slice(s,s+2)==="!=";){let i=t.slice(s,s+2);if(s+=2,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=eg(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function eg(e,t,n){let{expr:r,pos:s}=Zc(e,t,n);for(;;)if(s=Je(t,s),t.slice(s,s+2)==="<="||t.slice(s,s+2)===">="){let i=t.slice(s,s+2);if(s+=2,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=Zc(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else if(t[s]==="<"||t[s]===">"){let i=t[s];if(s++,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=Zc(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Zc(e,t,n){let{expr:r,pos:s}=tg(e,t,n);for(;s=Je(t,s),t.slice(s,s+2)==="<<"||t.slice(s,s+2)===">>";){let i=t.slice(s,s+2);if(s+=2,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=tg(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function tg(e,t,n){let{expr:r,pos:s}=ng(e,t,n);for(;s=Je(t,s),(t[s]==="+"||t[s]==="-")&&t[s+1]!==t[s];){let i=t[s];if(s++,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=ng(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function ng(e,t,n){let{expr:r,pos:s}=Yo(e,t,n);for(;;)if(s=Je(t,s),t[s]==="*"&&t[s+1]!=="*"){if(s++,Qt(t,s))return Kt("*",s);let{expr:o,pos:a}=Yo(e,t,s);r={type:"ArithBinary",operator:"*",left:r,right:o},s=a}else if(t[s]==="/"||t[s]==="%"){let i=t[s];if(s++,Qt(t,s))return Kt(i,s);let{expr:o,pos:a}=Yo(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Yo(e,t,n){let{expr:r,pos:s}=Kc(e,t,n),i=Je(t,s);if(t.slice(i,i+2)==="**"){if(i+=2,Qt(t,i))return Kt("**",i);let{expr:a,pos:l}=Yo(e,t,i);return{expr:{type:"ArithBinary",operator:"**",left:r,right:a},pos:l}}return{expr:r,pos:s}}function Kc(e,t,n){let r=Je(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:o}=Kc(e,t,r);return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}if(t[r]==="+"||t[r]==="-"||t[r]==="!"||t[r]==="~"){let s=t[r];r++;let{expr:i,pos:o}=Kc(e,t,r);return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}return jA(e,t,r)}function HA(e,t){let n=e[t];return n==="$"||n==="`"}function jA(e,t,n){let{expr:r,pos:s}=rg(e,t,n,!1),i=[r];for(;HA(t,s);){let{expr:a,pos:l}=rg(e,t,s,!0);i.push(a),s=l}i.length>1&&(r={type:"ArithConcat",parts:i});let o;if(t[s]==="["&&r.type==="ArithConcat"){s++;let{expr:a,pos:l}=on(e,t,s);o=a,s=l,t[s]==="]"&&s++}if(o&&r.type==="ArithConcat"&&(r={type:"ArithDynamicElement",nameExpr:r,subscript:o},o=void 0),s=Je(t,s),r.type==="ArithConcat"||r.type==="ArithVariable"||r.type==="ArithDynamicElement"){for(let a of Xo)if(t.slice(s,s+a.length)===a&&t.slice(s,s+a.length+1)!=="=="){s+=a.length;let{expr:l,pos:c}=Si(e,t,s);return r.type==="ArithDynamicElement"?{expr:{type:"ArithDynamicAssignment",operator:a,target:r.nameExpr,subscript:r.subscript,value:l},pos:c}:r.type==="ArithConcat"?{expr:{type:"ArithDynamicAssignment",operator:a,target:r,value:l},pos:c}:{expr:{type:"ArithAssignment",operator:a,variable:r.name,value:l},pos:c}}}if(t.slice(s,s+2)==="++"||t.slice(s,s+2)==="--"){let a=t.slice(s,s+2);return s+=2,{expr:{type:"ArithUnary",operator:a,operand:r,prefix:!1},pos:s}}return{expr:r,pos:s}}function rg(e,t,n,r=!1){let s=Je(t,n),i=G2(on,e,t,s);if(i)return i;let o=V2(t,s);if(o)return o;let a=q2(t,s);if(a)return a;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}=on(e,t,s);return s=Je(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}=on(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 Le(`${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:Ai(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 d=h+1;for(;d<t.length&&/[0-9a-zA-Z@_]/.test(t[d]);)d++;let m=t.slice(h+1,d);return{expr:{type:"ArithDynamicBase",baseExpr:p,value:m},pos:d}}if(/[0-9]/.test(t[h])||t[h]==="x"||t[h]==="X"){let d=h;if(t[h]==="x"||t[h]==="X")for(d++;d<t.length&&/[0-9a-fA-F]/.test(t[d]);)d++;else for(;d<t.length&&/[0-9]/.test(t[d]);)d++;let m=t.slice(h,d);return{expr:{type:"ArithDynamicNumber",prefix:p,suffix:m},pos:d}}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=Je(t,s),t[s]==="]"&&s++}let f;if(u===void 0){let{expr:p,pos:h}=on(e,t,s);f=p,s=h,t[s]==="]"&&s++}if(s=Je(t,s),t[s]==="["&&f)return{expr:{type:"ArithDoubleSubscript",array:c,index:f},pos:s};if(!r){for(let p of Xo)if(t.slice(s,s+p.length)===p&&t.slice(s,s+p.length+1)!=="=="){s+=p.length;let{expr:h,pos:d}=Si(e,t,s);return{expr:{type:"ArithAssignment",operator:p,variable:c,subscript:f,stringKey:u,value:h},pos:d}}}return{expr:{type:"ArithArrayElement",array:c,index:f,stringKey:u},pos:s}}if(s=Je(t,s),!r){for(let u of Xo)if(t.slice(s,s+u.length)===u&&t.slice(s,s+u.length+1)!=="=="){s+=u.length;let{expr:f,pos:p}=Si(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]!==`
772
772
  `;)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 Tt=k(()=>{"use strict";Ae();Z2()});function GA(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 og(e,t,n){let r=n+1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;return r}function Qc(e,t,n,r,s){let i=1,o=n+1;for(;o<t.length&&i>0;)t[o]===r?i++:t[o]===s&&i--,i>0&&o++;return i===0?o:-1}function qr(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 o=t.indexOf("'",r+1);if(o!==-1){r=o+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 ag(e,t,n){let r=n,s=!1;for(;r<t.length;){let i=t[r];if(i==="/"&&s||i==="}")break;if(i==="'"){let o=t.indexOf("'",r+1);if(o!==-1){r=o+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 lg(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 o=VA(t,r);o===-1?(s+=i,r++):(s+=t.slice(r,o+1),r=o+1)}else break}return{pattern:s,endIndex:r}}function VA(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]}]`,o=e.indexOf(i,n+2);if(o!==-1){n=o+2;continue}}n++}return-1}function cg(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+=`
773
- `,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 a=[],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)a.push(u),l+=2+c.length;else break}a.length>0?(r+=GA(a),s=l):(r+="\\x",s+=2);break}case"u":{let a=t.slice(s+2,s+6),l=parseInt(a,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 a="",l=s+1;for(;l<t.length&&l<s+4&&/[0-7]/.test(t[l]);)a+=t[l],l++;let c=parseInt(a,8);r+=String.fromCharCode(c),s=l;break}default:r+=i,s++}else r+=i,s++}return s<t.length&&t[s]==="'"&&s++,{part:J.literal(r),endIndex:s}}function Xc(e,t){let n=t.trim();return n===""?{type:"ArithmeticExpression",expression:{type:"ArithNumber",value:0}}:Ne(e,n)}function ig(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 ug(e,t,n,r){let s=Qc(e,t,n,"{","}");if(s===-1)return null;let i=t.slice(n+1,s),o=i.match(/^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/);if(o)return{part:{type:"BraceExpansion",items:[{type:"Range",start:Number.parseInt(o[1],10),end:Number.parseInt(o[2],10),step:o[3]?Number.parseInt(o[3],10):void 0,startStr:o[1],endStr:o[2]}]},endIndex:s+1};let a=i.match(/^([a-zA-Z])\.\.([a-zA-Z])(?:\.\.(-?\d+))?$/);return a?{part:{type:"BraceExpansion",items:[{type:"Range",start:a[1],end:a[2],step:a[3]?Number.parseInt(a[3],10):void 0}]},endIndex:s+1}:i.includes(",")&&r?{part:{type:"BraceExpansion",items:ig(i).map(u=>({type:"Word",word:J.word(r(e,u,!1,!1,!1))}))},endIndex:s+1}:i.includes(",")?{part:{type:"BraceExpansion",items:ig(i).map(u=>({type:"Word",word:J.word([J.literal(u)])}))},endIndex:s+1}:null}function Yc(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 o=i.startStr??String(i.start),a=i.endStr??String(i.end);i.step!==void 0?s.push(`${o}..${a}..${i.step}`):s.push(`${o}..${a}`)}else s.push(Yc(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 fg(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 Jc=k(()=>{"use strict";Vr();Tt();gr()});function Jo(e){let t=e.current(),n=t.type;if(n===E.NUMBER){let r=e.peek(1);return t.end!==r.start?!1:H2.has(r.type)}if(n===E.FD_VARIABLE){let r=e.peek(1);return j2.has(r.type)}return z2.has(n)}function ea(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=fg(e,r.type);if(r.type===E.DLESS||r.type===E.DLESSDASH)return qA(e,s,t,r.type===E.DLESSDASH);e.isWord()||e.error("Expected redirection target");let i=e.parseWord();return J.redirection(s,i,t,n)}function qA(e,t,n,r){e.isWord()||e.error("Expected here-document delimiter");let s=e.advance(),i=s.value,o=s.quoted||!1;(i.startsWith("'")&&i.endsWith("'")||i.startsWith('"')&&i.endsWith('"'))&&(i=i.slice(1,-1));let a=J.redirection(r?"<<-":"<<",J.hereDoc(i,J.word([]),r,o),n);return e.addPendingHeredoc(a,i,r,o),a}function hg(e){let t=e.current().line,n=[],r=null,s=[],i=[];for(;e.check(E.ASSIGNMENT_WORD)||Jo(e);)e.checkIterationLimit(),e.check(E.ASSIGNMENT_WORD)?n.push(ZA(e)):i.push(ea(e));if(e.isWord())r=e.parseWord();else if(n.length>0&&(e.check(E.DBRACK_START)||e.check(E.DPAREN_START))){let a=e.advance();r=J.word([J.literal(a.value)])}for(;(!e.isStatementEnd()||e.check(E.RBRACE))&&!e.check(E.PIPE,E.PIPE_AMP);)if(e.checkIterationLimit(),Jo(e))i.push(ea(e));else if(e.check(E.RBRACE)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(E.LBRACE)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(E.DBRACK_END)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.isWord())s.push(e.parseWord());else if(e.check(E.ASSIGNMENT_WORD)){let a=e.advance(),l=a.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=eu(e);e.expect(E.RPAREN);let h=p.map(m=>Yc(e,m)),d=`${f}=(${h.join(" ")})`;s.push(e.parseWordFromString(d,!1,!1))}else s.push(e.parseWordFromString(l,a.quoted,a.singleQuoted))}else if(e.check(E.LPAREN))e.error("syntax error near unexpected token `('");else break;let o=J.simpleCommand(r,s,n,i);return o.line=t,o}function ZA(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,o=s.length;if(n[o]==="["){let f=0,p=o+1;for(;o<n.length;o++)if(n[o]==="[")f++;else if(n[o]==="]"&&(f--,f===0))break;f!==0&&e.error(`Invalid assignment: ${n}`),i=n.slice(p,o),o++}let a=n[o]==="+";a&&o++,n[o]!=="="&&e.error(`Invalid assignment: ${n}`),o++;let l=n.slice(o);if(l==="("){let f=eu(e);e.expect(E.RPAREN);let p=i!==void 0?`${s}[${i}]`:s;return J.assignment(p,null,a,f)}if(l===""&&e.check(E.LPAREN)){let f=e.current();if(t.end===f.start){e.advance();let p=eu(e);e.expect(E.RPAREN);let h=i!==void 0?`${s}[${i}]`:s;return J.assignment(h,null,a,p)}}let c=l?e.parseWordFromString(l,t.quoted,t.singleQuoted,!0):null,u=i!==void 0?`${s}[${i}]`:s;return J.assignment(u,c,a,null)}function eu(e){let t=[];for(e.skipNewlines();!e.check(E.RPAREN,E.EOF);)e.checkIterationLimit(),e.isWord()?t.push(e.parseWord()):KA.has(e.current().type)?e.error(`syntax error near unexpected token \`${e.current().value}'`):e.advance(),e.skipNewlines();return t}var KA,dg=k(()=>{"use strict";Vr();gr();Gr();Jc();KA=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 tu(e,t){e.expect(E.IF);let n=[],r=e.parseCompoundList();e.expect(E.THEN);let s=e.parseCompoundList();if(s.length===0){let a=e.check(E.FI)?"fi":e.check(E.ELSE)?"else":e.check(E.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${a}'`)}for(n.push({condition:r,body:s});e.check(E.ELIF);){e.advance();let a=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:a,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 o=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.ifNode(n,i,o)}function nu(e,t){let n=e.expect(E.FOR);if(e.check(E.DPAREN_START))return XA(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 o=e.parseCompoundList();e.expect(E.DONE);let a=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.forNode(s,i,o,a)}function XA(e,t,n){e.expect(E.DPAREN_START);let r=null,s=null,i=null,o=["","",""],a=0,l=0;for(;!e.check(E.DPAREN_END,E.EOF);){let f=e.advance();if(f.type===E.SEMICOLON&&l===0){if(a++,a>2)break}else f.value==="("&&l++,f.value===")"&&l--,o[a]+=f.value}e.expect(E.DPAREN_END),o[0].trim()&&(r=Ne(e,o[0].trim())),o[1].trim()&&(s=Ne(e,o[1].trim())),o[2].trim()&&(i=Ne(e,o[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 ru(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 J.whileNode(n,r,s)}function su(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 J.untilNode(n,r,s)}function iu(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(),o=YA(e);if(o&&r.push(o),e.skipNewlines(),e.getPos()===i&&!o)break}e.expect(E.ESAC);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.caseNode(n,r,s)}function YA(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=";;&"),J.caseItem(t,n,r)}function ou(e,t){e.expect(E.LPAREN);let n=e.parseCompoundList();e.expect(E.RPAREN);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.subshell(n,r)}function au(e,t){e.expect(E.LBRACE);let n=e.parseCompoundList();e.expect(E.RBRACE);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.group(n,r)}var mg=k(()=>{"use strict";Vr();Tt();gr()});function gg(e){return e.isWord()||e.check(E.LBRACE)||e.check(E.RBRACE)||e.check(E.ASSIGNMENT_WORD)}function yg(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 cu(e){return e.skipNewlines(),nS(e)}function nS(e){let t=wg(e);for(e.skipNewlines();e.check(E.OR_OR);){e.advance(),e.skipNewlines();let n=wg(e);t={type:"CondOr",left:t,right:n},e.skipNewlines()}return t}function wg(e){let t=lu(e);for(e.skipNewlines();e.check(E.AND_AND);){e.advance(),e.skipNewlines();let n=lu(e);t={type:"CondAnd",left:t,right:n},e.skipNewlines()}return t}function lu(e){return e.skipNewlines(),e.check(E.BANG)?(e.advance(),e.skipNewlines(),{type:"CondNot",operand:lu(e)}):rS(e)}function rS(e){if(e.check(E.LPAREN)){e.advance();let t=cu(e);return e.expect(E.RPAREN),{type:"CondGroup",expression:t}}if(gg(e)){let t=e.current(),n=t.value;if(eS.includes(n)&&!t.quoted){if(e.advance(),e.check(E.DBRACK_END)&&e.error(`Expected operand after ${n}`),gg(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()&&tS.includes(e.current().value)){let s=e.advance().value,i;return s==="=~"?i=sS(e):s==="=="||s==="!="?i=yg(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=yg(e);return{type:"CondBinary",operator:"==",left:r,right:s}}return{type:"CondWord",word:r}}e.error("Expected conditional expression")}function sS(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 o=e.current(),a=r>=0&&o.start>r;if(n===0&&a)break;if(n>0&&a){let l=s.slice(r,o.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 eS,tS,bg=k(()=>{"use strict";gr();eS=["-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"],tS=["==","!=","=~","<",">","-eq","-ne","-lt","-le","-gt","-ge","-nt","-ot","-ef"]});function Ci(e){return e.length>0?e:[J.literal("")]}function oS(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 aS(e,t,n){let r=n+1,s=t[r];if("@*#?$!-0123456789".includes(s))return{part:J.parameterExpansion(s),endIndex:r+1};let i="";for(;r<t.length&&/[a-zA-Z0-9_]/.test(t[r]);)i+=t[r],r++;return{part:J.parameterExpansion(i),endIndex:r}}function lS(e,t,n,r=!1){let s=n+2,i=!1;t[s]==="!"&&(i=!0,s++);let o=!1;t[s]==="#"&&!/[}:#%/^,]/.test(t[s+1]||"}")&&(o=!0,s++);let a="",l=t[s];if(/[@*#?$!-]/.test(l)&&!/[a-zA-Z0-9_]/.test(t[s+1]||""))a=l,s++;else for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)a+=t[s],s++;if(t[s]==="["){let u=Qc(e,t,s,"[","]");if(a+=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:J.parameterExpansion("",{type:"BadSubstitution",text:h}),endIndex:p+1}}}if(a===""&&!i&&!o&&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 At("unexpected EOF while looking for matching '}'",0,0);let p=t.slice(n+2,f);return{part:J.parameterExpansion("",{type:"BadSubstitution",text:p}),endIndex:f+1}}let c=null;if(i){let u=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(u)if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=uu(e,t,s,a,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):(c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},a="")}else c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},a="";else if(t[s]==="*"||t[s]==="@"&&!/[QPaAEKkuUL]/.test(t[s+1]||"")){let f=t[s];s++,c={type:"VarNamePrefix",prefix:a,star:f==="*"},a=""}else if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=uu(e,t,s,a,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):c={type:"Indirection"}}else c={type:"Indirection"}}else if(o)if(t[s]===":")for(c={type:"LengthSliceError"};s<t.length&&t[s]!=="}";)s++;else t[s]!=="}"&&/[-+=?]/.test(t[s])?e.error(`\${#${a}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):t[s]==="/"?e.error(`\${#${a}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):c={type:"Length"};if(!c&&s<t.length&&t[s]!=="}"){let u=uu(e,t,s,a,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 At("unexpected EOF while looking for matching '}'",0,0);return{part:J.parameterExpansion(a,c),endIndex:s+1}}function uu(e,t,n,r,s=!1){let i=n,o=t[i],a=t[i+1]||"";if(o===":"){let l=a;if("-=?+".includes(l)){i+=2;let y=qr(e,t,i),w=t.slice(i,y),b=yr(e,w,!1,!1,!0,!1,s,!1,!1,!0),x=J.word(Ci(b));if(l==="-")return{operation:{type:"DefaultValue",word:x,checkEmpty:!0},endIndex:y};if(l==="=")return{operation:{type:"AssignDefault",word:x,checkEmpty:!0},endIndex:y};if(l==="?")return{operation:{type:"ErrorIfUnset",word:x,checkEmpty:!0},endIndex:y};if(l==="+")return{operation:{type:"UseAlternative",word:x,checkEmpty:!0},endIndex:y}}i++;let c=qr(e,t,i),u=t.slice(i,c),f=-1,p=0,h=0;for(let g=0;g<u.length;g++){let y=u[g];if(y==="("||y==="[")p++;else if(y===")"||y==="]")p--;else if(y==="?"&&p===0)h++;else if(y===":"&&p===0)if(h>0)h--;else{f=g;break}}let d=f>=0?u.slice(0,f):u,m=f>=0?u.slice(f+1):null;return{operation:{type:"Substring",offset:Xc(e,d),length:m!==null?Xc(e,m):null},endIndex:c}}if("-=?+".includes(o)){i++;let l=qr(e,t,i),c=t.slice(i,l),u=yr(e,c,!1,!1,!0,!1,s,!1,!1,!0),f=J.word(Ci(u));if(o==="-")return{operation:{type:"DefaultValue",word:f,checkEmpty:!1},endIndex:l};if(o==="=")return{operation:{type:"AssignDefault",word:f,checkEmpty:!1},endIndex:l};if(o==="?")return{operation:{type:"ErrorIfUnset",word:c?f:null,checkEmpty:!1},endIndex:l};if(o==="+")return{operation:{type:"UseAlternative",word:f,checkEmpty:!1},endIndex:l}}if(o==="#"||o==="%"){let l=a===o,c=o==="#"?"prefix":"suffix";i+=l?2:1;let u=qr(e,t,i),f=t.slice(i,u),p=yr(e,f,!1,!1,!1);return{operation:{type:"PatternRemoval",pattern:J.word(Ci(p)),side:c,greedy:l},endIndex:u}}if(o==="/"){let l=a==="/";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=ag(e,t,i);let f=t.slice(i,u),p=yr(e,f,!1,!1,!1),h=J.word(Ci(p)),d=null,m=u;if(t[u]==="/"){let g=u+1,y=qr(e,t,g),w=t.slice(g,y),b=yr(e,w,!1,!1,!1);d=J.word(Ci(b)),m=y}return{operation:{type:"PatternReplacement",pattern:h,replacement:d,all:l,anchor:c},endIndex:m}}if(o==="^"||o===","){let l=a===o,c=o==="^"?"upper":"lower";i+=l?2:1;let u=qr(e,t,i),f=t.slice(i,u),p=f?J.word([J.literal(f)]):null;return{operation:{type:"CaseModification",direction:c,all:l,pattern:p},endIndex:u}}return o==="@"&&/[QPaAEKkuUL]/.test(a)?{operation:{type:"Transform",operator:a},endIndex:i+2}:{operation:null,endIndex:i}}function fu(e,t,n,r=!1){let s=n+1;if(s>=t.length)return{part:J.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 o=1,a=s+1;for(;a<t.length&&o>0;)t[a]==="["?o++:t[a]==="]"&&o--,o>0&&a++;if(o===0){let l=t.slice(s+1,a),c=Ne(e,l);return{part:J.arithmeticExpansion(c),endIndex:a+1}}}return i==="("?e.parseCommandSubstitution(t,n):i==="{"?lS(e,t,n,r):/[a-zA-Z_0-9@*#?$!-]/.test(i)?aS(e,t,n):{part:J.literal("$"),endIndex:s}}function xg(e,t){let n=[],r=0,s="",i=()=>{s&&(n.push(J.literal(s)),s="")};for(;r<t.length;){let o=t[r];if(o==="\\"&&r+1<t.length){let a=t[r+1];if(a==="$"||a==="`"||a==='"'||a==="\\"){s+=a,r+=2;continue}s+=o,r++;continue}if(o==="$"){i();let{part:a,endIndex:l}=fu(e,t,r,!0);a&&n.push(a),r=l;continue}if(o==="`"){i();let{part:a,endIndex:l}=e.parseBacktickSubstitution(t,r,!0);n.push(a),r=l;continue}s+=o,r++}return i(),n}function cS(e,t,n){let r=[],s=n,i="",o=()=>{i&&(r.push(J.literal(i)),i="")};for(;s<t.length&&t[s]!=='"';){let a=t[s];if(a==="\\"&&s+1<t.length){let l=t[s+1];if('"\\$`\n'.includes(l)){i+=l,s+=2;continue}i+=a,s++;continue}if(a==="$"){o();let{part:l,endIndex:c}=fu(e,t,s,!0);l&&r.push(l),s=c;continue}if(a==="`"){o();let{part:l,endIndex:c}=e.parseBacktickSubstitution(t,s,!0);r.push(l),s=c;continue}i+=a,s++}return o(),{part:J.doubleQuoted(r),endIndex:s}}function yr(e,t,n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1){if(r)return[J.singleQuoted(t)];if(n){let d=xg(e,t);return[J.doubleQuoted(d)]}if(t.length>=2&&t[0]==='"'&&t[t.length-1]==='"'){let d=t.slice(1,-1),m=!1;for(let g=0;g<d.length;g++){if(d[g]==='"'){m=!0;break}d[g]==="\\"&&g+1<d.length&&g++}if(!m){let g=xg(e,d);return[J.doubleQuoted(g)]}}let u=[],f=0,p="",h=()=>{p&&(u.push(J.literal(p)),p="")};for(;f<t.length;){let d=t[f];if(d==="\\"&&f+1<t.length){let m=t[f+1];if(l){h(),u.push(J.escaped(m)),f+=2;continue}let g=i?m==="$"||m==="`"||m===`
773
+ `,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 a=[],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)a.push(u),l+=2+c.length;else break}a.length>0?(r+=GA(a),s=l):(r+="\\x",s+=2);break}case"u":{let a=t.slice(s+2,s+6),l=parseInt(a,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 a="",l=s+1;for(;l<t.length&&l<s+4&&/[0-7]/.test(t[l]);)a+=t[l],l++;let c=parseInt(a,8);r+=String.fromCharCode(c),s=l;break}default:r+=i,s++}else r+=i,s++}return s<t.length&&t[s]==="'"&&s++,{part:J.literal(r),endIndex:s}}function Xc(e,t){let n=t.trim();return n===""?{type:"ArithmeticExpression",expression:{type:"ArithNumber",value:0}}:Ie(e,n)}function ig(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 ug(e,t,n,r){let s=Qc(e,t,n,"{","}");if(s===-1)return null;let i=t.slice(n+1,s),o=i.match(/^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/);if(o)return{part:{type:"BraceExpansion",items:[{type:"Range",start:Number.parseInt(o[1],10),end:Number.parseInt(o[2],10),step:o[3]?Number.parseInt(o[3],10):void 0,startStr:o[1],endStr:o[2]}]},endIndex:s+1};let a=i.match(/^([a-zA-Z])\.\.([a-zA-Z])(?:\.\.(-?\d+))?$/);return a?{part:{type:"BraceExpansion",items:[{type:"Range",start:a[1],end:a[2],step:a[3]?Number.parseInt(a[3],10):void 0}]},endIndex:s+1}:i.includes(",")&&r?{part:{type:"BraceExpansion",items:ig(i).map(u=>({type:"Word",word:J.word(r(e,u,!1,!1,!1))}))},endIndex:s+1}:i.includes(",")?{part:{type:"BraceExpansion",items:ig(i).map(u=>({type:"Word",word:J.word([J.literal(u)])}))},endIndex:s+1}:null}function Yc(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 o=i.startStr??String(i.start),a=i.endStr??String(i.end);i.step!==void 0?s.push(`${o}..${a}..${i.step}`):s.push(`${o}..${a}`)}else s.push(Yc(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 fg(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 Jc=k(()=>{"use strict";Vr();Tt();gr()});function Jo(e){let t=e.current(),n=t.type;if(n===E.NUMBER){let r=e.peek(1);return t.end!==r.start?!1:H2.has(r.type)}if(n===E.FD_VARIABLE){let r=e.peek(1);return j2.has(r.type)}return z2.has(n)}function ea(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=fg(e,r.type);if(r.type===E.DLESS||r.type===E.DLESSDASH)return qA(e,s,t,r.type===E.DLESSDASH);e.isWord()||e.error("Expected redirection target");let i=e.parseWord();return J.redirection(s,i,t,n)}function qA(e,t,n,r){e.isWord()||e.error("Expected here-document delimiter");let s=e.advance(),i=s.value,o=s.quoted||!1;(i.startsWith("'")&&i.endsWith("'")||i.startsWith('"')&&i.endsWith('"'))&&(i=i.slice(1,-1));let a=J.redirection(r?"<<-":"<<",J.hereDoc(i,J.word([]),r,o),n);return e.addPendingHeredoc(a,i,r,o),a}function hg(e){let t=e.current().line,n=[],r=null,s=[],i=[];for(;e.check(E.ASSIGNMENT_WORD)||Jo(e);)e.checkIterationLimit(),e.check(E.ASSIGNMENT_WORD)?n.push(ZA(e)):i.push(ea(e));if(e.isWord())r=e.parseWord();else if(n.length>0&&(e.check(E.DBRACK_START)||e.check(E.DPAREN_START))){let a=e.advance();r=J.word([J.literal(a.value)])}for(;(!e.isStatementEnd()||e.check(E.RBRACE))&&!e.check(E.PIPE,E.PIPE_AMP);)if(e.checkIterationLimit(),Jo(e))i.push(ea(e));else if(e.check(E.RBRACE)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(E.LBRACE)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(E.DBRACK_END)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.isWord())s.push(e.parseWord());else if(e.check(E.ASSIGNMENT_WORD)){let a=e.advance(),l=a.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=eu(e);e.expect(E.RPAREN);let h=p.map(m=>Yc(e,m)),d=`${f}=(${h.join(" ")})`;s.push(e.parseWordFromString(d,!1,!1))}else s.push(e.parseWordFromString(l,a.quoted,a.singleQuoted))}else if(e.check(E.LPAREN))e.error("syntax error near unexpected token `('");else break;let o=J.simpleCommand(r,s,n,i);return o.line=t,o}function ZA(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,o=s.length;if(n[o]==="["){let f=0,p=o+1;for(;o<n.length;o++)if(n[o]==="[")f++;else if(n[o]==="]"&&(f--,f===0))break;f!==0&&e.error(`Invalid assignment: ${n}`),i=n.slice(p,o),o++}let a=n[o]==="+";a&&o++,n[o]!=="="&&e.error(`Invalid assignment: ${n}`),o++;let l=n.slice(o);if(l==="("){let f=eu(e);e.expect(E.RPAREN);let p=i!==void 0?`${s}[${i}]`:s;return J.assignment(p,null,a,f)}if(l===""&&e.check(E.LPAREN)){let f=e.current();if(t.end===f.start){e.advance();let p=eu(e);e.expect(E.RPAREN);let h=i!==void 0?`${s}[${i}]`:s;return J.assignment(h,null,a,p)}}let c=l?e.parseWordFromString(l,t.quoted,t.singleQuoted,!0):null,u=i!==void 0?`${s}[${i}]`:s;return J.assignment(u,c,a,null)}function eu(e){let t=[];for(e.skipNewlines();!e.check(E.RPAREN,E.EOF);)e.checkIterationLimit(),e.isWord()?t.push(e.parseWord()):KA.has(e.current().type)?e.error(`syntax error near unexpected token \`${e.current().value}'`):e.advance(),e.skipNewlines();return t}var KA,dg=k(()=>{"use strict";Vr();gr();Gr();Jc();KA=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 tu(e,t){e.expect(E.IF);let n=[],r=e.parseCompoundList();e.expect(E.THEN);let s=e.parseCompoundList();if(s.length===0){let a=e.check(E.FI)?"fi":e.check(E.ELSE)?"else":e.check(E.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${a}'`)}for(n.push({condition:r,body:s});e.check(E.ELIF);){e.advance();let a=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:a,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 o=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.ifNode(n,i,o)}function nu(e,t){let n=e.expect(E.FOR);if(e.check(E.DPAREN_START))return XA(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 o=e.parseCompoundList();e.expect(E.DONE);let a=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.forNode(s,i,o,a)}function XA(e,t,n){e.expect(E.DPAREN_START);let r=null,s=null,i=null,o=["","",""],a=0,l=0;for(;!e.check(E.DPAREN_END,E.EOF);){let f=e.advance();if(f.type===E.SEMICOLON&&l===0){if(a++,a>2)break}else f.value==="("&&l++,f.value===")"&&l--,o[a]+=f.value}e.expect(E.DPAREN_END),o[0].trim()&&(r=Ie(e,o[0].trim())),o[1].trim()&&(s=Ie(e,o[1].trim())),o[2].trim()&&(i=Ie(e,o[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 ru(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 J.whileNode(n,r,s)}function su(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 J.untilNode(n,r,s)}function iu(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(),o=YA(e);if(o&&r.push(o),e.skipNewlines(),e.getPos()===i&&!o)break}e.expect(E.ESAC);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.caseNode(n,r,s)}function YA(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=";;&"),J.caseItem(t,n,r)}function ou(e,t){e.expect(E.LPAREN);let n=e.parseCompoundList();e.expect(E.RPAREN);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.subshell(n,r)}function au(e,t){e.expect(E.LBRACE);let n=e.parseCompoundList();e.expect(E.RBRACE);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.group(n,r)}var mg=k(()=>{"use strict";Vr();Tt();gr()});function gg(e){return e.isWord()||e.check(E.LBRACE)||e.check(E.RBRACE)||e.check(E.ASSIGNMENT_WORD)}function yg(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 cu(e){return e.skipNewlines(),nS(e)}function nS(e){let t=wg(e);for(e.skipNewlines();e.check(E.OR_OR);){e.advance(),e.skipNewlines();let n=wg(e);t={type:"CondOr",left:t,right:n},e.skipNewlines()}return t}function wg(e){let t=lu(e);for(e.skipNewlines();e.check(E.AND_AND);){e.advance(),e.skipNewlines();let n=lu(e);t={type:"CondAnd",left:t,right:n},e.skipNewlines()}return t}function lu(e){return e.skipNewlines(),e.check(E.BANG)?(e.advance(),e.skipNewlines(),{type:"CondNot",operand:lu(e)}):rS(e)}function rS(e){if(e.check(E.LPAREN)){e.advance();let t=cu(e);return e.expect(E.RPAREN),{type:"CondGroup",expression:t}}if(gg(e)){let t=e.current(),n=t.value;if(eS.includes(n)&&!t.quoted){if(e.advance(),e.check(E.DBRACK_END)&&e.error(`Expected operand after ${n}`),gg(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()&&tS.includes(e.current().value)){let s=e.advance().value,i;return s==="=~"?i=sS(e):s==="=="||s==="!="?i=yg(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=yg(e);return{type:"CondBinary",operator:"==",left:r,right:s}}return{type:"CondWord",word:r}}e.error("Expected conditional expression")}function sS(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 o=e.current(),a=r>=0&&o.start>r;if(n===0&&a)break;if(n>0&&a){let l=s.slice(r,o.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 eS,tS,bg=k(()=>{"use strict";gr();eS=["-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"],tS=["==","!=","=~","<",">","-eq","-ne","-lt","-le","-gt","-ge","-nt","-ot","-ef"]});function Ci(e){return e.length>0?e:[J.literal("")]}function oS(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 aS(e,t,n){let r=n+1,s=t[r];if("@*#?$!-0123456789".includes(s))return{part:J.parameterExpansion(s),endIndex:r+1};let i="";for(;r<t.length&&/[a-zA-Z0-9_]/.test(t[r]);)i+=t[r],r++;return{part:J.parameterExpansion(i),endIndex:r}}function lS(e,t,n,r=!1){let s=n+2,i=!1;t[s]==="!"&&(i=!0,s++);let o=!1;t[s]==="#"&&!/[}:#%/^,]/.test(t[s+1]||"}")&&(o=!0,s++);let a="",l=t[s];if(/[@*#?$!-]/.test(l)&&!/[a-zA-Z0-9_]/.test(t[s+1]||""))a=l,s++;else for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)a+=t[s],s++;if(t[s]==="["){let u=Qc(e,t,s,"[","]");if(a+=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:J.parameterExpansion("",{type:"BadSubstitution",text:h}),endIndex:p+1}}}if(a===""&&!i&&!o&&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 At("unexpected EOF while looking for matching '}'",0,0);let p=t.slice(n+2,f);return{part:J.parameterExpansion("",{type:"BadSubstitution",text:p}),endIndex:f+1}}let c=null;if(i){let u=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(u)if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=uu(e,t,s,a,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):(c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},a="")}else c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},a="";else if(t[s]==="*"||t[s]==="@"&&!/[QPaAEKkuUL]/.test(t[s+1]||"")){let f=t[s];s++,c={type:"VarNamePrefix",prefix:a,star:f==="*"},a=""}else if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=uu(e,t,s,a,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):c={type:"Indirection"}}else c={type:"Indirection"}}else if(o)if(t[s]===":")for(c={type:"LengthSliceError"};s<t.length&&t[s]!=="}";)s++;else t[s]!=="}"&&/[-+=?]/.test(t[s])?e.error(`\${#${a}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):t[s]==="/"?e.error(`\${#${a}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):c={type:"Length"};if(!c&&s<t.length&&t[s]!=="}"){let u=uu(e,t,s,a,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 At("unexpected EOF while looking for matching '}'",0,0);return{part:J.parameterExpansion(a,c),endIndex:s+1}}function uu(e,t,n,r,s=!1){let i=n,o=t[i],a=t[i+1]||"";if(o===":"){let l=a;if("-=?+".includes(l)){i+=2;let y=qr(e,t,i),w=t.slice(i,y),b=yr(e,w,!1,!1,!0,!1,s,!1,!1,!0),x=J.word(Ci(b));if(l==="-")return{operation:{type:"DefaultValue",word:x,checkEmpty:!0},endIndex:y};if(l==="=")return{operation:{type:"AssignDefault",word:x,checkEmpty:!0},endIndex:y};if(l==="?")return{operation:{type:"ErrorIfUnset",word:x,checkEmpty:!0},endIndex:y};if(l==="+")return{operation:{type:"UseAlternative",word:x,checkEmpty:!0},endIndex:y}}i++;let c=qr(e,t,i),u=t.slice(i,c),f=-1,p=0,h=0;for(let g=0;g<u.length;g++){let y=u[g];if(y==="("||y==="[")p++;else if(y===")"||y==="]")p--;else if(y==="?"&&p===0)h++;else if(y===":"&&p===0)if(h>0)h--;else{f=g;break}}let d=f>=0?u.slice(0,f):u,m=f>=0?u.slice(f+1):null;return{operation:{type:"Substring",offset:Xc(e,d),length:m!==null?Xc(e,m):null},endIndex:c}}if("-=?+".includes(o)){i++;let l=qr(e,t,i),c=t.slice(i,l),u=yr(e,c,!1,!1,!0,!1,s,!1,!1,!0),f=J.word(Ci(u));if(o==="-")return{operation:{type:"DefaultValue",word:f,checkEmpty:!1},endIndex:l};if(o==="=")return{operation:{type:"AssignDefault",word:f,checkEmpty:!1},endIndex:l};if(o==="?")return{operation:{type:"ErrorIfUnset",word:c?f:null,checkEmpty:!1},endIndex:l};if(o==="+")return{operation:{type:"UseAlternative",word:f,checkEmpty:!1},endIndex:l}}if(o==="#"||o==="%"){let l=a===o,c=o==="#"?"prefix":"suffix";i+=l?2:1;let u=qr(e,t,i),f=t.slice(i,u),p=yr(e,f,!1,!1,!1);return{operation:{type:"PatternRemoval",pattern:J.word(Ci(p)),side:c,greedy:l},endIndex:u}}if(o==="/"){let l=a==="/";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=ag(e,t,i);let f=t.slice(i,u),p=yr(e,f,!1,!1,!1),h=J.word(Ci(p)),d=null,m=u;if(t[u]==="/"){let g=u+1,y=qr(e,t,g),w=t.slice(g,y),b=yr(e,w,!1,!1,!1);d=J.word(Ci(b)),m=y}return{operation:{type:"PatternReplacement",pattern:h,replacement:d,all:l,anchor:c},endIndex:m}}if(o==="^"||o===","){let l=a===o,c=o==="^"?"upper":"lower";i+=l?2:1;let u=qr(e,t,i),f=t.slice(i,u),p=f?J.word([J.literal(f)]):null;return{operation:{type:"CaseModification",direction:c,all:l,pattern:p},endIndex:u}}return o==="@"&&/[QPaAEKkuUL]/.test(a)?{operation:{type:"Transform",operator:a},endIndex:i+2}:{operation:null,endIndex:i}}function fu(e,t,n,r=!1){let s=n+1;if(s>=t.length)return{part:J.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 o=1,a=s+1;for(;a<t.length&&o>0;)t[a]==="["?o++:t[a]==="]"&&o--,o>0&&a++;if(o===0){let l=t.slice(s+1,a),c=Ie(e,l);return{part:J.arithmeticExpansion(c),endIndex:a+1}}}return i==="("?e.parseCommandSubstitution(t,n):i==="{"?lS(e,t,n,r):/[a-zA-Z_0-9@*#?$!-]/.test(i)?aS(e,t,n):{part:J.literal("$"),endIndex:s}}function xg(e,t){let n=[],r=0,s="",i=()=>{s&&(n.push(J.literal(s)),s="")};for(;r<t.length;){let o=t[r];if(o==="\\"&&r+1<t.length){let a=t[r+1];if(a==="$"||a==="`"||a==='"'||a==="\\"){s+=a,r+=2;continue}s+=o,r++;continue}if(o==="$"){i();let{part:a,endIndex:l}=fu(e,t,r,!0);a&&n.push(a),r=l;continue}if(o==="`"){i();let{part:a,endIndex:l}=e.parseBacktickSubstitution(t,r,!0);n.push(a),r=l;continue}s+=o,r++}return i(),n}function cS(e,t,n){let r=[],s=n,i="",o=()=>{i&&(r.push(J.literal(i)),i="")};for(;s<t.length&&t[s]!=='"';){let a=t[s];if(a==="\\"&&s+1<t.length){let l=t[s+1];if('"\\$`\n'.includes(l)){i+=l,s+=2;continue}i+=a,s++;continue}if(a==="$"){o();let{part:l,endIndex:c}=fu(e,t,s,!0);l&&r.push(l),s=c;continue}if(a==="`"){o();let{part:l,endIndex:c}=e.parseBacktickSubstitution(t,s,!0);r.push(l),s=c;continue}i+=a,s++}return o(),{part:J.doubleQuoted(r),endIndex:s}}function yr(e,t,n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1){if(r)return[J.singleQuoted(t)];if(n){let d=xg(e,t);return[J.doubleQuoted(d)]}if(t.length>=2&&t[0]==='"'&&t[t.length-1]==='"'){let d=t.slice(1,-1),m=!1;for(let g=0;g<d.length;g++){if(d[g]==='"'){m=!0;break}d[g]==="\\"&&g+1<d.length&&g++}if(!m){let g=xg(e,d);return[J.doubleQuoted(g)]}}let u=[],f=0,p="",h=()=>{p&&(u.push(J.literal(p)),p="")};for(;f<t.length;){let d=t[f];if(d==="\\"&&f+1<t.length){let m=t[f+1];if(l){h(),u.push(J.escaped(m)),f+=2;continue}let g=i?m==="$"||m==="`"||m===`
774
774
  `:m==="$"||m==="`"||m==='"'||m==="'"||m===`
775
775
  `||c&&m==="}",y=o?"*?[]\\".includes(m):"*?[]\\(){}.^+".includes(m);g?p+=m:y?(h(),u.push(J.escaped(m))):p+=`\\${m}`,f+=2;continue}if(d==="'"&&!o&&!i){h();let m=t.indexOf("'",f+1);if(m===-1){p+=t.slice(f);break}u.push(J.singleQuoted(t.slice(f+1,m))),f=m+1;continue}if(d==='"'&&!i){h();let{part:m,endIndex:g}=cS(e,t,f+1);u.push(m),f=g+1;continue}if(d==="$"&&t[f+1]==="'"){h();let{part:m,endIndex:g}=cg(e,t,f+2);u.push(m),f=g;continue}if(d==="$"){h();let{part:m,endIndex:g}=fu(e,t,f);m&&u.push(m),f=g;continue}if(d==="`"){h();let{part:m,endIndex:g}=e.parseBacktickSubstitution(t,f);u.push(m),f=g;continue}if(d==="~"){let m=f>0?t[f-1]:"";if(f===0||m==="="||s&&m===":"){let y=og(e,t,f),w=t[y];if(w===void 0||w==="/"||w===":"){h();let b=t.slice(f+1,y)||null;u.push({type:"TildeExpansion",user:b}),f=y;continue}}}if("@*+?!".includes(d)&&f+1<t.length&&t[f+1]==="("){let m=oS(t,f+1);if(m!==-1){h();let g=t.slice(f,m+1);u.push({type:"Glob",pattern:g}),f=m+1;continue}}if(d==="*"||d==="?"||d==="["){h();let{pattern:m,endIndex:g}=lg(e,t,f);u.push({type:"Glob",pattern:m}),f=g;continue}if(d==="{"&&!s&&!a&&!i){let m=ug(e,t,f,yr);if(m){h(),u.push(m.part),f=m.endIndex;continue}}p+=d,f++}return h(),u}var Eg=k(()=>{"use strict";Vr();Tt();Gr();Jc()});function Ag(e,t){let n=e.length,r=t+3,s=2,i=!1,o=!1;for(;r<n&&s>0;){let a=e[r];if(i){a==="'"&&(i=!1),r++;continue}if(o){if(a==="\\"){r+=2;continue}a==='"'&&(o=!1),r++;continue}if(a==="'"){i=!0,r++;continue}if(a==='"'){o=!0,r++;continue}if(a==="\\"){r+=2;continue}if(a==="("){s++,r++;continue}if(a===")"){if(s--,s===1){let l=r+1;return!(l<n&&e[l]===")")}if(s===0)return!1;r++;continue}if(s===1&&(a==="|"&&r+1<n&&e[r+1]==="|"||a==="&"&&r+1<n&&e[r+1]==="&"||a==="|"&&r+1<n&&e[r+1]!=="|"))return!0;r++}return!1}function Sg(e,t,n,r){let s=t+2,i=1,o=s,a=!1,l=!1,c=0,u=!1,f="";for(;o<e.length&&i>0;){let m=e[o];a?m==="'"&&(a=!1):l?m==="\\"&&o+1<e.length?o++:m==='"'&&(l=!1):m==="'"?(a=!0,f=""):m==='"'?(l=!0,f=""):m==="\\"&&o+1<e.length?(o++,f=""):/[a-zA-Z_]/.test(m)?f+=m:(f==="case"?(c++,u=!1):f==="in"&&c>0?u=!0:f==="esac"&&c>0&&(c--,u=!1),f="",m==="("?o>0&&e[o-1]==="$"?i++:u||i++:m===")"?u?u=!1:i--:m===";"&&c>0&&o+1<e.length&&e[o+1]===";"&&(u=!0)),i>0&&o++}i>0&&r("unexpected EOF while looking for matching `)'");let p=e.slice(s,o),d=n().parse(p);return{part:J.commandSubstitution(d,!1),endIndex:o+1}}function Cg(e,t,n,r,s){let o=t+1,a="";for(;o<e.length&&e[o]!=="`";)if(e[o]==="\\"){let u=e[o+1];u==="$"||u==="`"||u==="\\"||u===`
776
776
  `||n&&u==='"'?(u!==`
777
- `&&(a+=u),o+=2):(a+=e[o],o++)}else a+=e[o],o++;o>=e.length&&s("unexpected EOF while looking for matching ``'");let c=r().parse(a);return{part:J.commandSubstitution(c,!0),endIndex:o+1}}var vg=k(()=>{"use strict";Vr()});function Nn(e,t){return new pe().parse(e,t)}var pe,ct=k(()=>{"use strict";Vr();Tt();dg();mg();bg();Eg();gr();vg();Gr();Gr();pe=class e{tokens=[];pos=0;pendingHeredocs=[];parseIterations=0;parseDepth=0;_input="";getInput(){return this._input}checkIterationLimit(){if(this.parseIterations++,this.parseIterations>W2)throw new At("Maximum parse iterations exceeded (possible infinite loop)",this.current().line,this.current().column)}enterDepth(){if(this.parseDepth++,this.parseDepth>qc)throw new At(`Maximum parser nesting depth exceeded (${qc})`,this.current().line,this.current().column);return()=>{this.parseDepth--}}parse(t,n){if(t.length>Gc)throw new At(`Input too large: ${t.length} bytes exceeds limit of ${Gc}`,1,1);this._input=t;let r=new Qo(t,n);if(this.tokens=r.tokenize(),this.tokens.length>Vc)throw new At(`Too many tokens: ${this.tokens.length} exceeds limit of ${Vc}`,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 o=this.tokens[this.pos]?.type;return o===t||n!==void 0&&o===n||r!==void 0&&o===r||s!==void 0&&o===s?!0:i.length>0?i.includes(o):!1}expect(t,n){if(this.check(t))return this.advance();let r=this.current();throw new At(n||`Expected ${t}, got ${r.type}`,r.line,r.column,r)}error(t){let n=this.current();throw new At(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=J.word([J.literal(n.value)]):r=this.parseWordFromString(n.value,!1,!1,!1,!0),t.redirect.target=J.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,o=this.parseStatement();o&&t.push(o),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 J.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(),J.statement([J.pipeline([J.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 o=this.pos>0?this.tokens[this.pos-1].end:t,a=this._input.slice(t,o);return J.statement(n,r,s,void 0,a)}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=[],o=[],a=this.parseCommand();for(i.push(a);this.check(E.PIPE,E.PIPE_AMP);){let l=this.advance();this.skipNewlines(),o.push(l.type===E.PIPE_AMP);let c=this.parseCommand();i.push(c)}return J.pipeline(i,s,t,n,o.length>0?o:void 0)}parseCommand(){return this.check(E.IF)?tu(this):this.check(E.FOR)?nu(this):this.check(E.WHILE)?ru(this):this.check(E.UNTIL)?su(this):this.check(E.CASE)?iu(this):this.check(E.LPAREN)?ou(this):this.check(E.LBRACE)?au(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():hg(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=J.subshell(t,[]);return J.subshell([J.statement([J.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,o=!1,a=!1){let l=yr(this,t,n,r,s,i,!1,o,a);return J.word(l)}parseCommandSubstitution(t,n){return Sg(t,n,()=>new e,r=>this.error(r))}parseBacktickSubstitution(t,n,r=!1){return Cg(t,n,r,()=>new e,s=>this.error(s))}isDollarDparenSubshell(t,n){return Ag(t,n)}parseArithmeticExpansion(t,n){let r=n+3,s=1,i=0,o=r;for(;o<t.length-1&&s>0;)t[o]==="$"&&t[o+1]==="("?t[o+2]==="("?(s++,o+=3):(i++,o+=2):t[o]==="("&&t[o+1]==="("?(s++,o+=2):t[o]===")"&&t[o+1]===")"?i>0?(i--,o++):(s--,s>0&&(o+=2)):t[o]==="("?(i++,o++):(t[o]===")"&&i>0&&i--,o++);let a=t.slice(r,o),l=this.parseArithmeticExpression(a);return{part:J.arithmeticExpansion(l),endIndex:o+2}}parseArithmeticCommand(){let t=this.expect(E.DPAREN_START),n="",r=1,s=0,i=!1,o=!1;for(;r>0&&!this.check(E.EOF);){if(i){if(i=!1,s>0){s--,n+=")";continue}if(this.check(E.RPAREN)){r--,o=!0,this.advance();continue}if(this.check(E.DPAREN_END)){r--,o=!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--,o=!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()}}o||this.expect(E.DPAREN_END);let a=this.parseArithmeticExpression(n.trim()),l=this.parseOptionalRedirections();return J.arithmeticCommand(a,l,t.line)}parseConditionalCommand(){let t=this.expect(E.DBRACK_START),n=cu(this);this.expect(E.DBRACK_END);let r=this.parseOptionalRedirections();return J.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 At("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 J.functionDef(t,n,r)}parseCompoundCommandBody(t){let n=t?.forFunctionBody;if(this.check(E.LBRACE))return au(this,{skipRedirections:n});if(this.check(E.LPAREN))return ou(this,{skipRedirections:n});if(this.check(E.IF))return tu(this,{skipRedirections:n});if(this.check(E.FOR))return nu(this,{skipRedirections:n});if(this.check(E.WHILE))return ru(this,{skipRedirections:n});if(this.check(E.UNTIL))return su(this,{skipRedirections:n});if(this.check(E.CASE))return iu(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(;Jo(this);){this.checkIterationLimit();let n=this.pos;if(t.push(ea(this)),this.pos===n)break}return t}parseArithmeticExpression(t){return Ne(this,t)}}});function hu(e){return pS.get(e)??""}function Og(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 Rg(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 o=s;for(;o<e.length;){if(e[o]==="\\"&&o+1<e.length){o+=2;continue}if(e[o]==="["&&o+1<e.length&&e[o+1]===":"){let l=e.indexOf(":]",o+2);if(l!==-1){o=l+2;continue}}if(e[o]==="]")break;o++}let a=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=hu(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===a,c=s+1===o;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+="$",Q(t)}function du(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 mu(e){let t=[],n="",r=0,s=!1,i=0;for(;i<e.length;){let o=e[i];if(o==="'"&&!s){s=!0,n+="\0QUOTE_START\0",i++;continue}if(o==="'"&&s){s=!1,n+="\0QUOTE_END\0",i++;continue}if(s){n+=o,i++;continue}if(o==="\\"){n+=o,i+1<e.length?(n+=e[i+1],i+=2):i++;continue}o==="("?(r++,n+=o):o===")"?(r--,n+=o):o==="|"&&r===0?(t.push(n),n=""):n+=o,i++}return t.push(n),t}var pS,Pg=k(()=>{"use strict";Ze();pS=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 Dg,wr,ta=k(()=>{"use strict";Ae();Ze();ns();Pg();Dg=5,wr=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=Og(i))}checkOpsLimit(){if(++this.ops.count>this.maxOps)throw new X(`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 Rg(n).test(t)}isGlobPattern(t){return!!(t.includes("*")||t.includes("?")||/\[.*\]/.test(t)||this.extglob&&/[@*+?!]\(/.test(t))}async expandArgs(t,n){let r=t.map((o,a)=>(n?.[a]??!1)||!this.isGlobPattern(o)?null:this.expand(o)),s=await Promise.all(r.map(o=>o||Promise.resolve(null))),i=[];for(let o=0;o<t.length;o++){let a=s[o];a===null?i.push(t[o]):a.length>0?i.push(...a):i.push(t[o])}return i}async expand(t){if(this.globstar){let r=t.split("/"),s=0;for(let i of r)if(i==="**"&&(s++,s>Dg))throw new X(`Glob pattern has too many ** segments (max ${Dg})`,"glob_operations")}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,o;if(s===0)n?(i="/",o="/"):(i=this.cwd,o="");else{let c=r.slice(0,s);n?(i=`/${c.join("/")}`,o=`/${c.join("/")}`):(i=this.fs.resolvePath(this.cwd,c.join("/")),o=c.join("/"))}let a=r.slice(s);return(await this.expandSegments(i,o,a)).sort()}async expandSegments(t,n,r){if(this.checkOpsLimit(),r.length===0)return[n];let[s,...i]=r,o=[];try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let a=await this.fs.readdirWithFileTypes(t),l=[],c=[...a],u=this.dotglob||this.hasGlobignore;if(s.startsWith(".")||this.dotglob){let p=a.some(d=>d.name==="."),h=a.some(d=>d.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}`,d;n===""?d=p.name:n==="/"?d=`/${p.name}`:d=`${n}/${p.name}`,i.length===0?l.push(Promise.resolve([d])):p.isDirectory&&l.push(this.expandSegments(h,d,i))}let f=await Promise.all(l);for(let p of f)o.push(...p)}else{this.checkOpsLimit();let a=await this.fs.readdir(t),l=[],c=[...a],u=this.dotglob||this.hasGlobignore;(s.startsWith(".")||this.dotglob)&&(a.includes(".")||c.push("."),a.includes("..")||c.push(".."));for(let p of c)if(!(p.startsWith(".")&&!s.startsWith(".")&&!u)&&this.matchPattern(p,s)){let h=t==="/"?`/${p}`:`${t}/${p}`,d;n===""?d=p:n==="/"?d=`/${p}`:d=`${n}/${p}`,i.length===0?l.push(Promise.resolve([d])):l.push((async()=>{try{if(this.checkOpsLimit(),(await this.fs.stat(h)).isDirectory)return this.expandSegments(h,d,i)}catch(m){if(m instanceof X)throw m}return[]})())}let f=await Promise.all(l);for(let p of f)o.push(...p)}}catch(a){if(a instanceof X)throw a}return o}async expandRecursive(t){let n=[],r=t.indexOf("**"),s=t.slice(0,r).replace(/\/$/,"")||".",o=t.slice(r+2).replace(/^\//,"");return o.includes("**")&&this.isGlobstarValid(o)?(await this.walkDirectoryMultiGlobstar(s,o,n),[...new Set(n)].sort()):(await this.walkDirectory(s,o,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 o=[];for(let c of i){let u=t==="."?c.name:`${t}/${c.name}`;c.isDirectory&&o.push(u)}let a=t==="."?n:`${t}/${n}`,l=await this.expandRecursive(a);r.push(...l);for(let c=0;c<o.length;c+=100){let u=o.slice(c,c+100);await Promise.all(u.map(f=>this.walkDirectoryMultiGlobstar(f,n,r)))}}else{this.checkOpsLimit();let o=await this.fs.readdir(s),a=[];for(let u of o){let f=t==="."?u:`${t}/${u}`,p=this.fs.resolvePath(this.cwd,f);try{this.checkOpsLimit(),(await this.fs.stat(p)).isDirectory&&a.push(f)}catch(h){if(h instanceof X)throw h}}let l=t==="."?n:`${t}/${n}`,c=await this.expandRecursive(l);r.push(...c);for(let u=0;u<a.length;u+=100){let f=a.slice(u,u+100);await Promise.all(f.map(p=>this.walkDirectoryMultiGlobstar(p,n,r)))}}}catch(i){if(i instanceof X)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),o=[],a=[];for(let l of i){let c=t==="."?l.name:`${t}/${l.name}`;l.isDirectory?a.push(c):n&&this.matchPattern(l.name,n)&&o.push(c)}r.push(...o);for(let l=0;l<a.length;l+=100){let c=a.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),o=[];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 d=await this.fs.stat(h);return{name:f,path:p,isDirectory:d.isDirectory}}catch(d){if(d instanceof X)throw d;return null}}));o.push(...u.filter(f=>f!==null))}for(let l of o)!l.isDirectory&&n&&this.matchPattern(l.name,n)&&r.push(l.path);let a=o.filter(l=>l.isDirectory);for(let l=0;l<a.length;l+=100){let c=a.slice(l,l+100);await Promise.all(c.map(u=>this.walkDirectory(u.path,n,r)))}}}catch(i){if(i instanceof X)throw i}}matchPattern(t,n){return this.patternToRegex(n).test(t)}patternToRegex(t){let n=this.patternToRegexStr(t);return Q(`^${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 o=du(t,s+1);if(o!==-1){let a=t.slice(s+2,o),l=mu(a),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(o<t.length-1){let p=l.map(d=>this.computePatternLength(d));if(p.every(d=>d!==null)&&p.every(d=>d===p[0])&&p[0]!==null){let d=p[0];if(d===0)n+="(?:.+)";else{let m=[];d>0&&m.push(`.{0,${d-1}}`),m.push(`.{${d+1},}`),m.push(`(?!(?:${u})).{${d}}`),n+=`(?:${m.join("|")})`}}else n+=`(?:(?!(?:${u})).)*?`}else n+=`(?!(?:${u})$).*`;s=o;continue}}if(i==="*")n+=".*";else if(i==="?")n+=".";else if(i==="["){let o=s+1,a="[";o<t.length&&(t[o]==="^"||t[o]==="!")&&(a+="^",o++),o<t.length&&t[o]==="]"&&(a+="\\]",o++);let l=o;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=o;for(;o<t.length&&t[o]!=="]";){if(t[o]==="["&&o+1<t.length&&t[o+1]===":"){let u=t.indexOf(":]",o+2);if(u!==-1){let f=t.slice(o+2,u),p=hu(f);a+=p,o=u+2;continue}}if(t[o]==="\\"&&o+1<t.length){a+=`\\${t[o+1]}`,o+=2;continue}if(t[o]==="-"){let u=o===c,f=o+1===l;u||f?a+="\\-":a+="-"}else a+=t[o];o++}a+="]",n+=a,s=o}else if(i==="\\"&&s+1<t.length){let o=t[s+1];/[.+^${}()|\\*?[\]]/.test(o)?n+=`\\${o}`:n+=o,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 o=du(t,r+1);if(o!==-1){if(i==="@"){let a=t.slice(r+2,o),c=mu(a).map(u=>this.computePatternLength(u));if(c.every(u=>u!==null)&&c.every(u=>u===c[0])){n+=c[0],r=o+1;continue}return null}return null}}if(i==="*")return null;if(i==="?"){n+=1,r++;continue}if(i==="["){let o=t.indexOf("]",r+1);if(o!==-1){n+=1,r=o+1;continue}n+=1,r++;continue}if(i==="\\"){n+=1,r+=2;continue}n+=1,r++}return n}}});function gu(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 hS(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 _g(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 vi(e){let t=!1,n=!1,r=!1,s=!1,i=!1,o=!1,a=!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")&&(o=!0),c.operation?.type==="Indirection"&&(a=!0));l.type==="CommandSubstitution"&&(n=!0),l.type==="ParameterExpansion"&&(i=!0,(l.parameter==="@"||l.parameter==="*")&&(r=!0),hS(l)&&(t=!0),(l.operation?.type==="VarNamePrefix"||l.operation?.type==="ArrayKeys")&&(o=!0),l.operation?.type==="Indirection"&&(a=!0)),l.type==="Glob"&&gu(l.pattern)&&(i=!0)}return{hasQuoted:t,hasCommandSub:n,hasArrayVar:r,hasArrayAtExpansion:s,hasParamExpansion:i,hasVarNamePrefixExpansion:o,hasIndirection:a}}var na=k(()=>{"use strict"});function ut(e,t){let n=`${t}_`,r=[];for(let s of e.state.env.keys())if(s.startsWith(n)){let i=s.slice(n.length),o=Number.parseInt(i,10);!Number.isNaN(o)&&String(o)===i&&r.push(o)}return r.sort((s,i)=>s-i)}function Gn(e,t){let n=`${t}_`;for(let r of e.state.env.keys())r.startsWith(n)&&e.state.env.delete(r)}function In(e,t){let n=`${t}_`,r=`${t}__length`,s=[];for(let i of e.state.env.keys())if(i!==r&&i.startsWith(n)){let o=i.slice(n.length);if(o.startsWith("_length"))continue;s.push(o)}return s.sort()}function ra(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function yu(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=ra(r);let o;if(s.type!=="Literal")return null;s.value.startsWith("]=")||s.value.startsWith("]+=")?o=s.value.slice(1):o=s.value;let a=o.startsWith("+=");if(!a&&!o.startsWith("="))return null;let l=[],c=a?2:1,u=o.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:dS(p)}):l.push(p)}return{key:r,valueParts:l,append:a}}function dS(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 Rs(n.word)}).join(",")}}`}function Rs(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}`:""}`:Rs(r.word)).join(","),t+="}";break;case"TildeExpansion":t+="~",n.user&&(t+=n.user);break}return t}var yn=k(()=>{"use strict"});function yt(e){return e.get("IFS")??`
777
+ `&&(a+=u),o+=2):(a+=e[o],o++)}else a+=e[o],o++;o>=e.length&&s("unexpected EOF while looking for matching ``'");let c=r().parse(a);return{part:J.commandSubstitution(c,!0),endIndex:o+1}}var vg=k(()=>{"use strict";Vr()});function Nn(e,t){return new pe().parse(e,t)}var pe,ct=k(()=>{"use strict";Vr();Tt();dg();mg();bg();Eg();gr();vg();Gr();Gr();pe=class e{tokens=[];pos=0;pendingHeredocs=[];parseIterations=0;parseDepth=0;_input="";getInput(){return this._input}checkIterationLimit(){if(this.parseIterations++,this.parseIterations>W2)throw new At("Maximum parse iterations exceeded (possible infinite loop)",this.current().line,this.current().column)}enterDepth(){if(this.parseDepth++,this.parseDepth>qc)throw new At(`Maximum parser nesting depth exceeded (${qc})`,this.current().line,this.current().column);return()=>{this.parseDepth--}}parse(t,n){if(t.length>Gc)throw new At(`Input too large: ${t.length} bytes exceeds limit of ${Gc}`,1,1);this._input=t;let r=new Qo(t,n);if(this.tokens=r.tokenize(),this.tokens.length>Vc)throw new At(`Too many tokens: ${this.tokens.length} exceeds limit of ${Vc}`,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 o=this.tokens[this.pos]?.type;return o===t||n!==void 0&&o===n||r!==void 0&&o===r||s!==void 0&&o===s?!0:i.length>0?i.includes(o):!1}expect(t,n){if(this.check(t))return this.advance();let r=this.current();throw new At(n||`Expected ${t}, got ${r.type}`,r.line,r.column,r)}error(t){let n=this.current();throw new At(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=J.word([J.literal(n.value)]):r=this.parseWordFromString(n.value,!1,!1,!1,!0),t.redirect.target=J.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,o=this.parseStatement();o&&t.push(o),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 J.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(),J.statement([J.pipeline([J.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 o=this.pos>0?this.tokens[this.pos-1].end:t,a=this._input.slice(t,o);return J.statement(n,r,s,void 0,a)}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=[],o=[],a=this.parseCommand();for(i.push(a);this.check(E.PIPE,E.PIPE_AMP);){let l=this.advance();this.skipNewlines(),o.push(l.type===E.PIPE_AMP);let c=this.parseCommand();i.push(c)}return J.pipeline(i,s,t,n,o.length>0?o:void 0)}parseCommand(){return this.check(E.IF)?tu(this):this.check(E.FOR)?nu(this):this.check(E.WHILE)?ru(this):this.check(E.UNTIL)?su(this):this.check(E.CASE)?iu(this):this.check(E.LPAREN)?ou(this):this.check(E.LBRACE)?au(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():hg(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=J.subshell(t,[]);return J.subshell([J.statement([J.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,o=!1,a=!1){let l=yr(this,t,n,r,s,i,!1,o,a);return J.word(l)}parseCommandSubstitution(t,n){return Sg(t,n,()=>new e,r=>this.error(r))}parseBacktickSubstitution(t,n,r=!1){return Cg(t,n,r,()=>new e,s=>this.error(s))}isDollarDparenSubshell(t,n){return Ag(t,n)}parseArithmeticExpansion(t,n){let r=n+3,s=1,i=0,o=r;for(;o<t.length-1&&s>0;)t[o]==="$"&&t[o+1]==="("?t[o+2]==="("?(s++,o+=3):(i++,o+=2):t[o]==="("&&t[o+1]==="("?(s++,o+=2):t[o]===")"&&t[o+1]===")"?i>0?(i--,o++):(s--,s>0&&(o+=2)):t[o]==="("?(i++,o++):(t[o]===")"&&i>0&&i--,o++);let a=t.slice(r,o),l=this.parseArithmeticExpression(a);return{part:J.arithmeticExpansion(l),endIndex:o+2}}parseArithmeticCommand(){let t=this.expect(E.DPAREN_START),n="",r=1,s=0,i=!1,o=!1;for(;r>0&&!this.check(E.EOF);){if(i){if(i=!1,s>0){s--,n+=")";continue}if(this.check(E.RPAREN)){r--,o=!0,this.advance();continue}if(this.check(E.DPAREN_END)){r--,o=!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--,o=!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()}}o||this.expect(E.DPAREN_END);let a=this.parseArithmeticExpression(n.trim()),l=this.parseOptionalRedirections();return J.arithmeticCommand(a,l,t.line)}parseConditionalCommand(){let t=this.expect(E.DBRACK_START),n=cu(this);this.expect(E.DBRACK_END);let r=this.parseOptionalRedirections();return J.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 At("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 J.functionDef(t,n,r)}parseCompoundCommandBody(t){let n=t?.forFunctionBody;if(this.check(E.LBRACE))return au(this,{skipRedirections:n});if(this.check(E.LPAREN))return ou(this,{skipRedirections:n});if(this.check(E.IF))return tu(this,{skipRedirections:n});if(this.check(E.FOR))return nu(this,{skipRedirections:n});if(this.check(E.WHILE))return ru(this,{skipRedirections:n});if(this.check(E.UNTIL))return su(this,{skipRedirections:n});if(this.check(E.CASE))return iu(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(;Jo(this);){this.checkIterationLimit();let n=this.pos;if(t.push(ea(this)),this.pos===n)break}return t}parseArithmeticExpression(t){return Ie(this,t)}}});function hu(e){return pS.get(e)??""}function Og(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 Rg(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 o=s;for(;o<e.length;){if(e[o]==="\\"&&o+1<e.length){o+=2;continue}if(e[o]==="["&&o+1<e.length&&e[o+1]===":"){let l=e.indexOf(":]",o+2);if(l!==-1){o=l+2;continue}}if(e[o]==="]")break;o++}let a=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=hu(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===a,c=s+1===o;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+="$",Q(t)}function du(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 mu(e){let t=[],n="",r=0,s=!1,i=0;for(;i<e.length;){let o=e[i];if(o==="'"&&!s){s=!0,n+="\0QUOTE_START\0",i++;continue}if(o==="'"&&s){s=!1,n+="\0QUOTE_END\0",i++;continue}if(s){n+=o,i++;continue}if(o==="\\"){n+=o,i+1<e.length?(n+=e[i+1],i+=2):i++;continue}o==="("?(r++,n+=o):o===")"?(r--,n+=o):o==="|"&&r===0?(t.push(n),n=""):n+=o,i++}return t.push(n),t}var pS,Pg=k(()=>{"use strict";Ze();pS=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 Dg,wr,ta=k(()=>{"use strict";Ae();Ze();ns();Pg();Dg=5,wr=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=Og(i))}checkOpsLimit(){if(++this.ops.count>this.maxOps)throw new X(`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 Rg(n).test(t)}isGlobPattern(t){return!!(t.includes("*")||t.includes("?")||/\[.*\]/.test(t)||this.extglob&&/[@*+?!]\(/.test(t))}async expandArgs(t,n){let r=t.map((o,a)=>(n?.[a]??!1)||!this.isGlobPattern(o)?null:this.expand(o)),s=await Promise.all(r.map(o=>o||Promise.resolve(null))),i=[];for(let o=0;o<t.length;o++){let a=s[o];a===null?i.push(t[o]):a.length>0?i.push(...a):i.push(t[o])}return i}async expand(t){if(this.globstar){let r=t.split("/"),s=0;for(let i of r)if(i==="**"&&(s++,s>Dg))throw new X(`Glob pattern has too many ** segments (max ${Dg})`,"glob_operations")}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,o;if(s===0)n?(i="/",o="/"):(i=this.cwd,o="");else{let c=r.slice(0,s);n?(i=`/${c.join("/")}`,o=`/${c.join("/")}`):(i=this.fs.resolvePath(this.cwd,c.join("/")),o=c.join("/"))}let a=r.slice(s);return(await this.expandSegments(i,o,a)).sort()}async expandSegments(t,n,r){if(this.checkOpsLimit(),r.length===0)return[n];let[s,...i]=r,o=[];try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let a=await this.fs.readdirWithFileTypes(t),l=[],c=[...a],u=this.dotglob||this.hasGlobignore;if(s.startsWith(".")||this.dotglob){let p=a.some(d=>d.name==="."),h=a.some(d=>d.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}`,d;n===""?d=p.name:n==="/"?d=`/${p.name}`:d=`${n}/${p.name}`,i.length===0?l.push(Promise.resolve([d])):p.isDirectory&&l.push(this.expandSegments(h,d,i))}let f=await Promise.all(l);for(let p of f)o.push(...p)}else{this.checkOpsLimit();let a=await this.fs.readdir(t),l=[],c=[...a],u=this.dotglob||this.hasGlobignore;(s.startsWith(".")||this.dotglob)&&(a.includes(".")||c.push("."),a.includes("..")||c.push(".."));for(let p of c)if(!(p.startsWith(".")&&!s.startsWith(".")&&!u)&&this.matchPattern(p,s)){let h=t==="/"?`/${p}`:`${t}/${p}`,d;n===""?d=p:n==="/"?d=`/${p}`:d=`${n}/${p}`,i.length===0?l.push(Promise.resolve([d])):l.push((async()=>{try{if(this.checkOpsLimit(),(await this.fs.stat(h)).isDirectory)return this.expandSegments(h,d,i)}catch(m){if(m instanceof X)throw m}return[]})())}let f=await Promise.all(l);for(let p of f)o.push(...p)}}catch(a){if(a instanceof X)throw a}return o}async expandRecursive(t){let n=[],r=t.indexOf("**"),s=t.slice(0,r).replace(/\/$/,"")||".",o=t.slice(r+2).replace(/^\//,"");return o.includes("**")&&this.isGlobstarValid(o)?(await this.walkDirectoryMultiGlobstar(s,o,n),[...new Set(n)].sort()):(await this.walkDirectory(s,o,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 o=[];for(let c of i){let u=t==="."?c.name:`${t}/${c.name}`;c.isDirectory&&o.push(u)}let a=t==="."?n:`${t}/${n}`,l=await this.expandRecursive(a);r.push(...l);for(let c=0;c<o.length;c+=100){let u=o.slice(c,c+100);await Promise.all(u.map(f=>this.walkDirectoryMultiGlobstar(f,n,r)))}}else{this.checkOpsLimit();let o=await this.fs.readdir(s),a=[];for(let u of o){let f=t==="."?u:`${t}/${u}`,p=this.fs.resolvePath(this.cwd,f);try{this.checkOpsLimit(),(await this.fs.stat(p)).isDirectory&&a.push(f)}catch(h){if(h instanceof X)throw h}}let l=t==="."?n:`${t}/${n}`,c=await this.expandRecursive(l);r.push(...c);for(let u=0;u<a.length;u+=100){let f=a.slice(u,u+100);await Promise.all(f.map(p=>this.walkDirectoryMultiGlobstar(p,n,r)))}}}catch(i){if(i instanceof X)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),o=[],a=[];for(let l of i){let c=t==="."?l.name:`${t}/${l.name}`;l.isDirectory?a.push(c):n&&this.matchPattern(l.name,n)&&o.push(c)}r.push(...o);for(let l=0;l<a.length;l+=100){let c=a.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),o=[];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 d=await this.fs.stat(h);return{name:f,path:p,isDirectory:d.isDirectory}}catch(d){if(d instanceof X)throw d;return null}}));o.push(...u.filter(f=>f!==null))}for(let l of o)!l.isDirectory&&n&&this.matchPattern(l.name,n)&&r.push(l.path);let a=o.filter(l=>l.isDirectory);for(let l=0;l<a.length;l+=100){let c=a.slice(l,l+100);await Promise.all(c.map(u=>this.walkDirectory(u.path,n,r)))}}}catch(i){if(i instanceof X)throw i}}matchPattern(t,n){return this.patternToRegex(n).test(t)}patternToRegex(t){let n=this.patternToRegexStr(t);return Q(`^${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 o=du(t,s+1);if(o!==-1){let a=t.slice(s+2,o),l=mu(a),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(o<t.length-1){let p=l.map(d=>this.computePatternLength(d));if(p.every(d=>d!==null)&&p.every(d=>d===p[0])&&p[0]!==null){let d=p[0];if(d===0)n+="(?:.+)";else{let m=[];d>0&&m.push(`.{0,${d-1}}`),m.push(`.{${d+1},}`),m.push(`(?!(?:${u})).{${d}}`),n+=`(?:${m.join("|")})`}}else n+=`(?:(?!(?:${u})).)*?`}else n+=`(?!(?:${u})$).*`;s=o;continue}}if(i==="*")n+=".*";else if(i==="?")n+=".";else if(i==="["){let o=s+1,a="[";o<t.length&&(t[o]==="^"||t[o]==="!")&&(a+="^",o++),o<t.length&&t[o]==="]"&&(a+="\\]",o++);let l=o;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=o;for(;o<t.length&&t[o]!=="]";){if(t[o]==="["&&o+1<t.length&&t[o+1]===":"){let u=t.indexOf(":]",o+2);if(u!==-1){let f=t.slice(o+2,u),p=hu(f);a+=p,o=u+2;continue}}if(t[o]==="\\"&&o+1<t.length){a+=`\\${t[o+1]}`,o+=2;continue}if(t[o]==="-"){let u=o===c,f=o+1===l;u||f?a+="\\-":a+="-"}else a+=t[o];o++}a+="]",n+=a,s=o}else if(i==="\\"&&s+1<t.length){let o=t[s+1];/[.+^${}()|\\*?[\]]/.test(o)?n+=`\\${o}`:n+=o,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 o=du(t,r+1);if(o!==-1){if(i==="@"){let a=t.slice(r+2,o),c=mu(a).map(u=>this.computePatternLength(u));if(c.every(u=>u!==null)&&c.every(u=>u===c[0])){n+=c[0],r=o+1;continue}return null}return null}}if(i==="*")return null;if(i==="?"){n+=1,r++;continue}if(i==="["){let o=t.indexOf("]",r+1);if(o!==-1){n+=1,r=o+1;continue}n+=1,r++;continue}if(i==="\\"){n+=1,r+=2;continue}n+=1,r++}return n}}});function gu(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 hS(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 _g(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 vi(e){let t=!1,n=!1,r=!1,s=!1,i=!1,o=!1,a=!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")&&(o=!0),c.operation?.type==="Indirection"&&(a=!0));l.type==="CommandSubstitution"&&(n=!0),l.type==="ParameterExpansion"&&(i=!0,(l.parameter==="@"||l.parameter==="*")&&(r=!0),hS(l)&&(t=!0),(l.operation?.type==="VarNamePrefix"||l.operation?.type==="ArrayKeys")&&(o=!0),l.operation?.type==="Indirection"&&(a=!0)),l.type==="Glob"&&gu(l.pattern)&&(i=!0)}return{hasQuoted:t,hasCommandSub:n,hasArrayVar:r,hasArrayAtExpansion:s,hasParamExpansion:i,hasVarNamePrefixExpansion:o,hasIndirection:a}}var na=k(()=>{"use strict"});function ut(e,t){let n=`${t}_`,r=[];for(let s of e.state.env.keys())if(s.startsWith(n)){let i=s.slice(n.length),o=Number.parseInt(i,10);!Number.isNaN(o)&&String(o)===i&&r.push(o)}return r.sort((s,i)=>s-i)}function Vn(e,t){let n=`${t}_`;for(let r of e.state.env.keys())r.startsWith(n)&&e.state.env.delete(r)}function In(e,t){let n=`${t}_`,r=`${t}__length`,s=[];for(let i of e.state.env.keys())if(i!==r&&i.startsWith(n)){let o=i.slice(n.length);if(o.startsWith("_length"))continue;s.push(o)}return s.sort()}function ra(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function yu(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=ra(r);let o;if(s.type!=="Literal")return null;s.value.startsWith("]=")||s.value.startsWith("]+=")?o=s.value.slice(1):o=s.value;let a=o.startsWith("+=");if(!a&&!o.startsWith("="))return null;let l=[],c=a?2:1,u=o.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:dS(p)}):l.push(p)}return{key:r,valueParts:l,append:a}}function dS(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 Rs(n.word)}).join(",")}}`}function Rs(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}`:""}`:Rs(r.word)).join(","),t+="}";break;case"TildeExpansion":t+="~",n.user&&(t+=n.user);break}return t}var yn=k(()=>{"use strict"});function yt(e){return e.get("IFS")??`
778
778
  `}function kt(e){return e.get("IFS")===""}function sa(e){let t=yt(e);if(t==="")return!0;for(let n of t)if(n!==" "&&n!==" "&&n!==`
779
779
  `)return!1;return!0}function Fg(e){let t=!1,n=[];for(let r of e.split(""))r==="-"?t=!0:/[\\^$.*+?()[\]{}|]/.test(r)?n.push(`\\${r}`):r===" "?n.push("\\t"):r===`
780
780
  `?n.push("\\n"):n.push(r);return t&&n.push("\\-"),n.join("")}function ge(e){let t=e.get("IFS");return t===void 0?" ":t[0]||""}function gS(e){return mS.includes(e)}function wu(e){let t=new Set,n=new Set;for(let r of e)gS(r)?t.add(r):n.add(r);return{whitespace:t,nonWhitespace:n}}function bu(e,t,n,r){if(t==="")return e===""?{words:[],wordStarts:[]}:{words:[e],wordStarts:[0]};let{whitespace:s,nonWhitespace:i}=wu(t),o=[],a=[],l=0;for(;l<e.length&&s.has(e[l]);)l++;if(l>=e.length)return{words:[],wordStarts:[]};if(i.has(e[l]))for(o.push(""),a.push(l),l++;l<e.length&&s.has(e[l]);)l++;for(;l<e.length&&!(n!==void 0&&o.length>=n);){let c=l;for(a.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(o.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&&o.length>=n);)for(o.push(""),a.push(l),l++;l<e.length&&s.has(e[l]);)l++}}return{words:o,wordStarts:a}}function ia(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}=wu(t),s=[],i=0,o=!1,a=!1,l=i;for(;i<e.length&&n.has(e[i]);)i++;if(i>l&&(o=!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){a=!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&&(a=!0)}return{words:s,hadLeadingDelimiter:o,hadTrailingDelimiter:a}}function Ve(e,t){return ia(e,t).words}function yS(e,t){for(let n of e)if(t.has(n))return!0;return!1}function Lg(e,t,n){if(t==="")return e;let{whitespace:r,nonWhitespace:s}=wu(t),i=e.length;for(;i>0&&r.has(e[i-1]);){if(!n&&i>=2){let a=0,l=i-2;for(;l>=0&&e[l]==="\\";)a++,l--;if(a%2===1)break}i--}let o=e.substring(0,i);if(o.length>=1&&s.has(o[o.length-1])){if(!n&&o.length>=2){let l=0,c=o.length-2;for(;c>=0&&o[c]==="\\";)l++,c--;if(l%2===1)return o}let a=o.substring(0,o.length-1);if(!yS(a,s))return a}return o}var mS,an=k(()=>{"use strict";mS=`
781
- `});function We(e,t){return e.state.namerefs?.has(t)??!1}function sr(e,t){e.state.namerefs??=new Set,e.state.namerefs.add(t)}function Mg(e,t){e.state.namerefs?.delete(t),e.state.boundNamerefs?.delete(t),e.state.invalidNamerefs?.delete(t)}function Ug(e,t){e.state.invalidNamerefs??=new Set,e.state.invalidNamerefs.add(t)}function Bg(e,t){return e.state.invalidNamerefs?.has(t)??!1}function xu(e,t){e.state.boundNamerefs??=new Set,e.state.boundNamerefs.add(t)}function oa(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(a=>a.startsWith(`${s}_`)&&!a.includes("__")),o=e.state.associativeArrays?.has(s)??!1;return i||o}return Array.from(e.state.env.keys()).some(s=>s.startsWith(`${t}_`)&&!s.includes("__"))?!0:e.state.env.has(t)}function Mt(e,t,n=100){if(!We(e,t)||Bg(e,t))return t;let r=new Set,s=t;for(;n-- >0;){if(r.has(s))return;if(r.add(s),!We(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 Zr(e,t){if(We(e,t))return e.state.env.get(t)}function Wg(e,t,n,r=100){if(!We(e,t)||Bg(e,t))return t;let s=new Set,i=t;for(;r-- >0;){if(s.has(i))return;if(s.add(i),!We(e,i))return i;let o=e.state.env.get(i);if(o===void 0||o==="")return n!==void 0?/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)&&oa(e,n)?i:null:i;if(!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(o))return i;i=o}}var $n=k(()=>{"use strict"});function wS(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 ce(e,t){return t==="FUNCNAME"?(e.state.funcNameStack??[]).map((i,o)=>[o,i]):t==="BASH_LINENO"?(e.state.callLineStack??[]).map((i,o)=>[o,String(i)]):t==="BASH_SOURCE"?(e.state.sourceStack??[]).map((i,o)=>[o,i]):e.state.associativeArrays?.has(t)?In(e,t).map(i=>[i,e.state.env.get(`${t}_${i}`)??""]):ut(e,t).map(s=>[s,e.state.env.get(`${t}_${s}`)??""])}function ir(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)?In(e,t).length>0:ut(e,t).length>0}async function Ie(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 o="";return o+="h",e.state.options.errexit&&(o+="e"),e.state.options.noglob&&(o+="f"),e.state.options.nounset&&(o+="u"),e.state.options.verbose&&(o+="v"),e.state.options.xtrace&&(o+="x"),o+="B",e.state.options.noclobber&&(o+="C"),o+="s",o}case"*":{let o=Number.parseInt(e.state.env.get("#")||"0",10);if(o===0)return"";let a=[];for(let l=1;l<=o;l++)a.push(e.state.env.get(String(l))||"");return a.join(ge(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 D2;case"!":return String(e.state.lastBackgroundPid);case"BASHPID":return String(e.state.bashPid);case"LINENO":return String(e.state.currentLine);case"FUNCNAME":{let o=e.state.funcNameStack?.[0];if(o!==void 0)return o;if(n&&e.state.options.nounset)throw new Rt("FUNCNAME");return""}case"BASH_LINENO":{let o=e.state.callLineStack?.[0];if(o!==void 0)return String(o);if(n&&e.state.options.nounset)throw new Rt("BASH_LINENO");return""}case"BASH_SOURCE":{let o=e.state.sourceStack?.[0];if(o!==void 0)return o;if(n&&e.state.options.nounset)throw new Rt("BASH_SOURCE");return""}}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[\]$/.test(t))throw new Pt(`\${${t}}`);let s=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(s){let o=s[1],a=s[2];if(We(e,o)){let f=Mt(e,o);if(f&&f!==o){if(f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return"";o=f}}if(a==="@"||a==="*"){let f=ce(e,o);if(f.length>0)return f.map(([,h])=>h).join(" ");let p=e.state.env.get(o);return p!==void 0?p:""}if(o==="FUNCNAME"){let f=Number.parseInt(a,10);return!Number.isNaN(f)&&f>=0?e.state.funcNameStack?.[f]??"":""}if(o==="BASH_LINENO"){let f=Number.parseInt(a,10);if(!Number.isNaN(f)&&f>=0){let p=e.state.callLineStack?.[f];return p!==void 0?String(p):""}return""}if(o==="BASH_SOURCE"){let f=Number.parseInt(a,10);return!Number.isNaN(f)&&f>=0?e.state.sourceStack?.[f]??"":""}if(e.state.associativeArrays?.has(o)){let f=ra(a);f=wS(e,f);let p=e.state.env.get(`${o}_${f}`);if(p===void 0&&n&&e.state.options.nounset)throw new Rt(`${o}[${a}]`);return p||""}let c;if(/^-?\d+$/.test(a))c=Number.parseInt(a,10);else try{let f=new pe,p=Ne(f,a);c=await re(e,p.expression)}catch{let f=e.state.env.get(a);c=f?Number.parseInt(f,10):0,Number.isNaN(c)&&(c=0)}if(c<0){let f=ce(e,o),p=e.state.currentLine;if(f.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${p}: ${o}: bad array subscript
781
+ `});function We(e,t){return e.state.namerefs?.has(t)??!1}function sr(e,t){e.state.namerefs??=new Set,e.state.namerefs.add(t)}function Mg(e,t){e.state.namerefs?.delete(t),e.state.boundNamerefs?.delete(t),e.state.invalidNamerefs?.delete(t)}function Ug(e,t){e.state.invalidNamerefs??=new Set,e.state.invalidNamerefs.add(t)}function Bg(e,t){return e.state.invalidNamerefs?.has(t)??!1}function xu(e,t){e.state.boundNamerefs??=new Set,e.state.boundNamerefs.add(t)}function oa(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(a=>a.startsWith(`${s}_`)&&!a.includes("__")),o=e.state.associativeArrays?.has(s)??!1;return i||o}return Array.from(e.state.env.keys()).some(s=>s.startsWith(`${t}_`)&&!s.includes("__"))?!0:e.state.env.has(t)}function Mt(e,t,n=100){if(!We(e,t)||Bg(e,t))return t;let r=new Set,s=t;for(;n-- >0;){if(r.has(s))return;if(r.add(s),!We(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 Zr(e,t){if(We(e,t))return e.state.env.get(t)}function Wg(e,t,n,r=100){if(!We(e,t)||Bg(e,t))return t;let s=new Set,i=t;for(;r-- >0;){if(s.has(i))return;if(s.add(i),!We(e,i))return i;let o=e.state.env.get(i);if(o===void 0||o==="")return n!==void 0?/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)&&oa(e,n)?i:null:i;if(!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(o))return i;i=o}}var $n=k(()=>{"use strict"});function wS(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 ce(e,t){return t==="FUNCNAME"?(e.state.funcNameStack??[]).map((i,o)=>[o,i]):t==="BASH_LINENO"?(e.state.callLineStack??[]).map((i,o)=>[o,String(i)]):t==="BASH_SOURCE"?(e.state.sourceStack??[]).map((i,o)=>[o,i]):e.state.associativeArrays?.has(t)?In(e,t).map(i=>[i,e.state.env.get(`${t}_${i}`)??""]):ut(e,t).map(s=>[s,e.state.env.get(`${t}_${s}`)??""])}function ir(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)?In(e,t).length>0:ut(e,t).length>0}async function ke(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 o="";return o+="h",e.state.options.errexit&&(o+="e"),e.state.options.noglob&&(o+="f"),e.state.options.nounset&&(o+="u"),e.state.options.verbose&&(o+="v"),e.state.options.xtrace&&(o+="x"),o+="B",e.state.options.noclobber&&(o+="C"),o+="s",o}case"*":{let o=Number.parseInt(e.state.env.get("#")||"0",10);if(o===0)return"";let a=[];for(let l=1;l<=o;l++)a.push(e.state.env.get(String(l))||"");return a.join(ge(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 D2;case"!":return String(e.state.lastBackgroundPid);case"BASHPID":return String(e.state.bashPid);case"LINENO":return String(e.state.currentLine);case"FUNCNAME":{let o=e.state.funcNameStack?.[0];if(o!==void 0)return o;if(n&&e.state.options.nounset)throw new Rt("FUNCNAME");return""}case"BASH_LINENO":{let o=e.state.callLineStack?.[0];if(o!==void 0)return String(o);if(n&&e.state.options.nounset)throw new Rt("BASH_LINENO");return""}case"BASH_SOURCE":{let o=e.state.sourceStack?.[0];if(o!==void 0)return o;if(n&&e.state.options.nounset)throw new Rt("BASH_SOURCE");return""}}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[\]$/.test(t))throw new Pt(`\${${t}}`);let s=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(s){let o=s[1],a=s[2];if(We(e,o)){let f=Mt(e,o);if(f&&f!==o){if(f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return"";o=f}}if(a==="@"||a==="*"){let f=ce(e,o);if(f.length>0)return f.map(([,h])=>h).join(" ");let p=e.state.env.get(o);return p!==void 0?p:""}if(o==="FUNCNAME"){let f=Number.parseInt(a,10);return!Number.isNaN(f)&&f>=0?e.state.funcNameStack?.[f]??"":""}if(o==="BASH_LINENO"){let f=Number.parseInt(a,10);if(!Number.isNaN(f)&&f>=0){let p=e.state.callLineStack?.[f];return p!==void 0?String(p):""}return""}if(o==="BASH_SOURCE"){let f=Number.parseInt(a,10);return!Number.isNaN(f)&&f>=0?e.state.sourceStack?.[f]??"":""}if(e.state.associativeArrays?.has(o)){let f=ra(a);f=wS(e,f);let p=e.state.env.get(`${o}_${f}`);if(p===void 0&&n&&e.state.options.nounset)throw new Rt(`${o}[${a}]`);return p||""}let c;if(/^-?\d+$/.test(a))c=Number.parseInt(a,10);else try{let f=new pe,p=Ie(f,a);c=await re(e,p.expression)}catch{let f=e.state.env.get(a);c=f?Number.parseInt(f,10):0,Number.isNaN(c)&&(c=0)}if(c<0){let f=ce(e,o),p=e.state.currentLine;if(f.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${p}: ${o}: bad array subscript
782
782
  `,"";let d=Math.max(...f.map(([g])=>typeof g=="number"?g:0))+1+c;return d<0?(e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${p}: ${o}: bad array subscript
783
- `,""):e.state.env.get(`${o}_${d}`)||""}let u=e.state.env.get(`${o}_${c}`);if(u!==void 0)return u;if(c===0){let f=e.state.env.get(o);if(f!==void 0)return f}if(n&&e.state.options.nounset)throw new Rt(`${o}[${c}]`);return""}if(/^[1-9][0-9]*$/.test(t)){let o=e.state.env.get(t);if(o===void 0&&n&&e.state.options.nounset)throw new Rt(t);return o||""}if(We(e,t)){let o=Mt(e,t);if(o===void 0)return"";if(o!==t)return await Ie(e,o,n,r);let a=e.state.env.get(t);if((a===void 0||a==="")&&n&&e.state.options.nounset)throw new Rt(t);return a||""}let i=e.state.env.get(t);if(i!==void 0)return e.state.tempEnvBindings?.some(o=>o.has(t))&&(e.state.accessedTempEnvVars=e.state.accessedTempEnvVars||new Set,e.state.accessedTempEnvVars.add(t)),i;if(ir(e,t)){let o=e.state.env.get(`${t}_0`);return o!==void 0?o:""}if(n&&e.state.options.nounset)throw new Rt(t);return""}async function Vn(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(We(e,s)){let l=Mt(e,s);if(l&&l!==s){if(l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;s=l}}if(i==="@"||i==="*")return ce(e,s).length>0?!0:e.state.env.has(s);if(e.state.associativeArrays?.has(s)){let l=ra(i);return e.state.env.has(`${s}_${l}`)}let a;if(/^-?\d+$/.test(i))a=Number.parseInt(i,10);else try{let l=new pe,c=Ne(l,i);a=await re(e,c.expression)}catch{let l=e.state.env.get(i);a=l?Number.parseInt(l,10):0,Number.isNaN(a)&&(a=0)}if(a<0){let l=ce(e,s);if(l.length===0)return!1;let u=Math.max(...l.map(([f])=>typeof f=="number"?f:0))+1+a;return u<0?!1:e.state.env.has(`${s}_${u}`)}return e.state.env.has(`${s}_${a}`)}if(We(e,t)){let s=Mt(e,t);return s===void 0||s===t?e.state.env.has(t):Vn(e,s)}return!!(e.state.env.has(t)||ir(e,t))}var Xt=k(()=>{"use strict";Tt();ct();Wc();Ut();Ae();yn();an();$n()});function zg(e){return se(e.stdout)}async function Hg(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),o=await Ie(e,i);n+=o,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),o=await Ie(e,i);n+=o,r=s;continue}if(/[*@#?\-!$]/.test(t[r+1]||"")){let s=t[r+1],i=await Ie(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),o=await Ie(e,i);n+=o,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 Eu(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="",o=0;for(;o<n.length;)if(n[o]==="$")if(n[o+1]==="("){let a=1,l=o+2;for(;l<n.length&&a>0;)n[l]==="("&&n[l-1]==="$"||n[l]==="("?a++:n[l]===")"&&a--,l++;let c=n.slice(o+2,l-1);if(e.execFn){let u=await e.execFn(c,{signal:e.state.signal});i+=zg(u).replace(/\n+$/,""),u.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+u.stderr)}o=l}else if(n[o+1]==="{"){let a=1,l=o+2;for(;l<n.length&&a>0;)n[l]==="{"?a++:n[l]==="}"&&a--,l++;let c=n.slice(o+2,l-1),u=await Ie(e,c);i+=u,o=l}else if(/[a-zA-Z_]/.test(n[o+1]||"")){let a=o+1;for(;a<n.length&&/[a-zA-Z0-9_]/.test(n[a]);)a++;let l=n.slice(o+1,a),c=await Ie(e,l);i+=c,o=a}else i+=n[o],o++;else if(n[o]==="`"){let a=o+1;for(;a<n.length&&n[a]!=="`";)a++;let l=n.slice(o+1,a);if(e.execFn){let c=await e.execFn(l,{signal:e.state.signal});i+=zg(c).replace(/\n+$/,""),c.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+c.stderr)}o=a+1}else i+=n[o],o++;return i}var jg=k(()=>{"use strict";he();Xt()});function bS(e,t,n,r,s){let i=n??1;i===0&&(i=1);let o=Math.abs(i),a=[],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<aa;u+=o,f++)a.push(c(u));else for(let u=e,f=0;u>=t&&f<aa;u-=o,f++)a.push(c(u));return a}function xS(e,t,n){let r=n??1;r===0&&(r=1);let s=e.charCodeAt(0),i=t.charCodeAt(0),o=Math.abs(r),a=e>="A"&&e<="Z",l=e>="a"&&e<="z",c=t>="A"&&t<="Z",u=t>="a"&&t<="z";if(a&&u||l&&c){let p=n!==void 0?`..${n}`:"";throw new ss(`{${e}..${t}${p}}: invalid sequence`)}let f=[];if(s<=i)for(let p=s,h=0;p<=i&&h<aa;p+=o,h++)f.push(String.fromCharCode(p));else for(let p=s,h=0;p>=i&&h<aa;p-=o,h++)f.push(String.fromCharCode(p));return f}function Au(e,t,n,r,s){let i=n!==void 0?`..${n}`:"";return typeof e=="number"&&typeof t=="number"?{expanded:bS(e,t,n,r,s),literal:`{${e}..${t}${i}}`}:typeof e=="string"&&typeof t=="string"?{expanded:xS(e,t,n),literal:`{${e}..${t}${i}}`}:{expanded:null,literal:`{${e}..${t}${i}}`}}var aa,Gg=k(()=>{"use strict";Ae();aa=1e4});function Vg(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 qg=k(()=>{"use strict"});function qn(e,t){return!!(/[*?[]/.test(e)||t&&/[@*+?!]\(/.test(e))}function Su(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 Yt(e){return e.replace(/([*?[\]\\()|])/g,"\\$1")}function Ps(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}var Ds=k(()=>{"use strict"});function Ce(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var _s=k(()=>{"use strict"});function xe(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 o=ES(e,s+1);if(o!==-1){let a=e.slice(s+2,o),c=AS(a).map(f=>xe(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=o+1;continue}}if(i==="\\")if(s+1<e.length){let o=e[s+1];/[\\^$.|+(){}[\]*?]/.test(o)?r+=`\\${o}`:r+=o,s+=2}else r+="\\\\",s++;else if(i==="*")r+=t?".*":".*?",s++;else if(i==="?")r+=".",s++;else if(i==="["){let o=SS(e,s);if(o===-1)r+="\\[",s++;else{let a=e.slice(s+1,o);r+=CS(a),s=o+1}}else/[\^$.|+(){}]/.test(i)?(r+=`\\${i}`,s++):(r+=i,s++)}return r}function ES(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 AS(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 SS(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 CS(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 o of i)o==="\\"?t+="\\\\":o==="]"?t+="\\]":o==="^"&&t==="["?t+="\\^":t+=o;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+=kS(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 kS(e){return vS.get(e)??""}var vS,Fs=k(()=>{"use strict";vS=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 or(e,t,n,r){if(n==="prefix")return Q(`^${t}`,"s").replace(e,"");let s=Q(`${t}$`,"s");if(r)return s.replace(e,"");for(let i=e.length;i>=0;i--){let o=e.slice(i);if(s.test(o))return e.slice(0,i)}return e}function Ls(e,t){let n=Array.from(e.state.env.keys()),r=new Set,s=e.state.associativeArrays??new Set,i=new Set;for(let a of n){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);l&&i.add(l[1]);let c=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);c&&i.add(c[1])}let o=a=>{for(let l of s){let c=`${l}_`;if(a.startsWith(c)&&a!==l)return!0}return!1};for(let a of n)if(a.startsWith(t))if(a.includes("__")){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);l?.[1].startsWith(t)&&r.add(l[1])}else if(/_\d+$/.test(a)){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);l?.[1].startsWith(t)&&r.add(l[1])}else o(a)||r.add(a);return[...r].sort()}var Kr=k(()=>{"use strict";Ze()});function NS(e,t){let n=(i,o=2)=>String(i).padStart(o,"0");if(e===""){let i=n(t.getHours()),o=n(t.getMinutes()),a=n(t.getSeconds());return`${i}:${o}:${a}`}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 o=t.getHours()%12;o===0&&(o=12),r+=n(o);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 ki(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",o=i.split(".")[0],a=e.state.env.get("PWD")||"/",l=e.state.env.get("HOME")||"/",c=a.startsWith(l)?`~${a.slice(l.length)}`:a,u=a.split("/").pop()||a,f=new Date,p=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],d=e.state.env.get("__COMMAND_NUMBER")||"1";for(;r<t.length;){let m=t[r];if(m==="\\"){if(r+1>=t.length){n+="\\",r++;continue}let g=t[r+1];if(g>="0"&&g<="7"){let y="",w=r+1;for(;w<t.length&&w<r+4&&t[w]>="0"&&t[w]<="7";)y+=t[w],w++;let b=Number.parseInt(y,8)%256;n+=String.fromCharCode(b),r=w;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+=`
783
+ `,""):e.state.env.get(`${o}_${d}`)||""}let u=e.state.env.get(`${o}_${c}`);if(u!==void 0)return u;if(c===0){let f=e.state.env.get(o);if(f!==void 0)return f}if(n&&e.state.options.nounset)throw new Rt(`${o}[${c}]`);return""}if(/^[1-9][0-9]*$/.test(t)){let o=e.state.env.get(t);if(o===void 0&&n&&e.state.options.nounset)throw new Rt(t);return o||""}if(We(e,t)){let o=Mt(e,t);if(o===void 0)return"";if(o!==t)return await ke(e,o,n,r);let a=e.state.env.get(t);if((a===void 0||a==="")&&n&&e.state.options.nounset)throw new Rt(t);return a||""}let i=e.state.env.get(t);if(i!==void 0)return e.state.tempEnvBindings?.some(o=>o.has(t))&&(e.state.accessedTempEnvVars=e.state.accessedTempEnvVars||new Set,e.state.accessedTempEnvVars.add(t)),i;if(ir(e,t)){let o=e.state.env.get(`${t}_0`);return o!==void 0?o:""}if(n&&e.state.options.nounset)throw new Rt(t);return""}async function Tn(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(We(e,s)){let l=Mt(e,s);if(l&&l!==s){if(l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;s=l}}if(i==="@"||i==="*")return ce(e,s).length>0?!0:e.state.env.has(s);if(e.state.associativeArrays?.has(s)){let l=ra(i);return e.state.env.has(`${s}_${l}`)}let a;if(/^-?\d+$/.test(i))a=Number.parseInt(i,10);else try{let l=new pe,c=Ie(l,i);a=await re(e,c.expression)}catch{let l=e.state.env.get(i);a=l?Number.parseInt(l,10):0,Number.isNaN(a)&&(a=0)}if(a<0){let l=ce(e,s);if(l.length===0)return!1;let u=Math.max(...l.map(([f])=>typeof f=="number"?f:0))+1+a;return u<0?!1:e.state.env.has(`${s}_${u}`)}return e.state.env.has(`${s}_${a}`)}if(We(e,t)){let s=Mt(e,t);return s===void 0||s===t?e.state.env.has(t):Tn(e,s)}return!!(e.state.env.has(t)||ir(e,t))}var Xt=k(()=>{"use strict";Tt();ct();Wc();Ut();Ae();yn();an();$n()});function zg(e){return se(e.stdout)}async function Hg(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),o=await ke(e,i);n+=o,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),o=await ke(e,i);n+=o,r=s;continue}if(/[*@#?\-!$]/.test(t[r+1]||"")){let s=t[r+1],i=await ke(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),o=await ke(e,i);n+=o,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 Eu(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="",o=0;for(;o<n.length;)if(n[o]==="$")if(n[o+1]==="("){let a=1,l=o+2;for(;l<n.length&&a>0;)n[l]==="("&&n[l-1]==="$"||n[l]==="("?a++:n[l]===")"&&a--,l++;let c=n.slice(o+2,l-1);if(e.execFn){let u=await e.execFn(c,{signal:e.state.signal});i+=zg(u).replace(/\n+$/,""),u.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+u.stderr)}o=l}else if(n[o+1]==="{"){let a=1,l=o+2;for(;l<n.length&&a>0;)n[l]==="{"?a++:n[l]==="}"&&a--,l++;let c=n.slice(o+2,l-1),u=await ke(e,c);i+=u,o=l}else if(/[a-zA-Z_]/.test(n[o+1]||"")){let a=o+1;for(;a<n.length&&/[a-zA-Z0-9_]/.test(n[a]);)a++;let l=n.slice(o+1,a),c=await ke(e,l);i+=c,o=a}else i+=n[o],o++;else if(n[o]==="`"){let a=o+1;for(;a<n.length&&n[a]!=="`";)a++;let l=n.slice(o+1,a);if(e.execFn){let c=await e.execFn(l,{signal:e.state.signal});i+=zg(c).replace(/\n+$/,""),c.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+c.stderr)}o=a+1}else i+=n[o],o++;return i}var jg=k(()=>{"use strict";he();Xt()});function bS(e,t,n,r,s){let i=n??1;i===0&&(i=1);let o=Math.abs(i),a=[],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<aa;u+=o,f++)a.push(c(u));else for(let u=e,f=0;u>=t&&f<aa;u-=o,f++)a.push(c(u));return a}function xS(e,t,n){let r=n??1;r===0&&(r=1);let s=e.charCodeAt(0),i=t.charCodeAt(0),o=Math.abs(r),a=e>="A"&&e<="Z",l=e>="a"&&e<="z",c=t>="A"&&t<="Z",u=t>="a"&&t<="z";if(a&&u||l&&c){let p=n!==void 0?`..${n}`:"";throw new ss(`{${e}..${t}${p}}: invalid sequence`)}let f=[];if(s<=i)for(let p=s,h=0;p<=i&&h<aa;p+=o,h++)f.push(String.fromCharCode(p));else for(let p=s,h=0;p>=i&&h<aa;p-=o,h++)f.push(String.fromCharCode(p));return f}function Au(e,t,n,r,s){let i=n!==void 0?`..${n}`:"";return typeof e=="number"&&typeof t=="number"?{expanded:bS(e,t,n,r,s),literal:`{${e}..${t}${i}}`}:typeof e=="string"&&typeof t=="string"?{expanded:xS(e,t,n),literal:`{${e}..${t}${i}}`}:{expanded:null,literal:`{${e}..${t}${i}}`}}var aa,Gg=k(()=>{"use strict";Ae();aa=1e4});function Vg(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 qg=k(()=>{"use strict"});function qn(e,t){return!!(/[*?[]/.test(e)||t&&/[@*+?!]\(/.test(e))}function Su(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 Yt(e){return e.replace(/([*?[\]\\()|])/g,"\\$1")}function Ps(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}var Ds=k(()=>{"use strict"});function Ce(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var _s=k(()=>{"use strict"});function xe(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 o=ES(e,s+1);if(o!==-1){let a=e.slice(s+2,o),c=AS(a).map(f=>xe(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=o+1;continue}}if(i==="\\")if(s+1<e.length){let o=e[s+1];/[\\^$.|+(){}[\]*?]/.test(o)?r+=`\\${o}`:r+=o,s+=2}else r+="\\\\",s++;else if(i==="*")r+=t?".*":".*?",s++;else if(i==="?")r+=".",s++;else if(i==="["){let o=SS(e,s);if(o===-1)r+="\\[",s++;else{let a=e.slice(s+1,o);r+=CS(a),s=o+1}}else/[\^$.|+(){}]/.test(i)?(r+=`\\${i}`,s++):(r+=i,s++)}return r}function ES(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 AS(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 SS(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 CS(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 o of i)o==="\\"?t+="\\\\":o==="]"?t+="\\]":o==="^"&&t==="["?t+="\\^":t+=o;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+=kS(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 kS(e){return vS.get(e)??""}var vS,Fs=k(()=>{"use strict";vS=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 or(e,t,n,r){if(n==="prefix")return Q(`^${t}`,"s").replace(e,"");let s=Q(`${t}$`,"s");if(r)return s.replace(e,"");for(let i=e.length;i>=0;i--){let o=e.slice(i);if(s.test(o))return e.slice(0,i)}return e}function Ls(e,t){let n=Array.from(e.state.env.keys()),r=new Set,s=e.state.associativeArrays??new Set,i=new Set;for(let a of n){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);l&&i.add(l[1]);let c=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);c&&i.add(c[1])}let o=a=>{for(let l of s){let c=`${l}_`;if(a.startsWith(c)&&a!==l)return!0}return!1};for(let a of n)if(a.startsWith(t))if(a.includes("__")){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);l?.[1].startsWith(t)&&r.add(l[1])}else if(/_\d+$/.test(a)){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);l?.[1].startsWith(t)&&r.add(l[1])}else o(a)||r.add(a);return[...r].sort()}var Kr=k(()=>{"use strict";Ze()});function NS(e,t){let n=(i,o=2)=>String(i).padStart(o,"0");if(e===""){let i=n(t.getHours()),o=n(t.getMinutes()),a=n(t.getSeconds());return`${i}:${o}:${a}`}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 o=t.getHours()%12;o===0&&(o=12),r+=n(o);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 ki(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",o=i.split(".")[0],a=e.state.env.get("PWD")||"/",l=e.state.env.get("HOME")||"/",c=a.startsWith(l)?`~${a.slice(l.length)}`:a,u=a.split("/").pop()||a,f=new Date,p=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],d=e.state.env.get("__COMMAND_NUMBER")||"1";for(;r<t.length;){let m=t[r];if(m==="\\"){if(r+1>=t.length){n+="\\",r++;continue}let g=t[r+1];if(g>="0"&&g<="7"){let y="",w=r+1;for(;w<t.length&&w<r+4&&t[w]>="0"&&t[w]<="7";)y+=t[w],w++;let b=Number.parseInt(y,8)%256;n+=String.fromCharCode(b),r=w;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+=`
784
784
  `,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+=o,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 y=String(f.getDate()).padStart(2," ");n+=`${p[f.getDay()]} ${h[f.getMonth()]} ${y}`,r+=2;break}case"t":{let y=String(f.getHours()).padStart(2,"0"),w=String(f.getMinutes()).padStart(2,"0"),b=String(f.getSeconds()).padStart(2,"0");n+=`${y}:${w}:${b}`,r+=2;break}case"T":{let y=f.getHours()%12;y===0&&(y=12);let w=String(y).padStart(2,"0"),b=String(f.getMinutes()).padStart(2,"0"),x=String(f.getSeconds()).padStart(2,"0");n+=`${w}:${b}:${x}`,r+=2;break}case"@":{let y=f.getHours()%12;y===0&&(y=12);let w=String(y).padStart(2,"0"),b=String(f.getMinutes()).padStart(2,"0"),x=f.getHours()<12?"AM":"PM";n+=`${w}:${b} ${x}`,r+=2;break}case"A":{let y=String(f.getHours()).padStart(2,"0"),w=String(f.getMinutes()).padStart(2,"0");n+=`${y}:${w}`,r+=2;break}case"D":if(r+2<t.length&&t[r+2]==="{"){let y=t.indexOf("}",r+3);if(y!==-1){let w=t.slice(r+3,y);n+=NS(w,f),r=y+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+=d,r+=2;break;case"!":n+=d,r+=2;break;case"x":n+="\\x",r+=2;break;default:n+=`\\${g}`,r+=2}}else n+=m,r++}return n}var Cu=k(()=>{"use strict"});function br(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`
785
785
  `: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 vu=k(()=>{"use strict"});function Jt(e,t){e.state.readonlyVars=e.state.readonlyVars||new Set,e.state.readonlyVars.add(t)}function Zn(e,t){return e.state.readonlyVars?.has(t)??!1}function bt(e,t,n="bash"){if(Zn(e,t)){let r=`${n}: ${t}: readonly variable
786
- `;throw new we(1,"",r)}return null}function Tn(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 la(e,t){e.state.exportedVars?.delete(t)}var xr=k(()=>{"use strict";Ae()});function Er(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"),We(e,t)&&(n+="n"),Zn(e,t)&&(n+="r"),e.state.exportedVars?.has(t)&&(n+="x"),n}var ca=k(()=>{"use strict";$n();xr()});async function Zg(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 Kg(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:assign_default"),(r.isUnset||n.checkEmpty&&r.isEmpty)&&n.word){let o=await s(e,n.word.parts,r.inDoubleQuotes),a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(a){let[,l,c]=a,u;if(/^\d+$/.test(c))u=Number.parseInt(c,10);else{try{let p=new pe,h=Ne(p,c);u=await re(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}`,o);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,o);return o}return r.effectiveValue}async function Qg(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:error_if_unset"),r.isUnset||n.checkEmpty&&r.isEmpty){let o=n.word?await s(e,n.word.parts,r.inDoubleQuotes):`${t}: parameter null or not set`;throw new we(1,"",`bash: ${o}
786
+ `;throw new we(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 la(e,t){e.state.exportedVars?.delete(t)}var xr=k(()=>{"use strict";Ae()});function Er(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"),We(e,t)&&(n+="n"),Zn(e,t)&&(n+="r"),e.state.exportedVars?.has(t)&&(n+="x"),n}var ca=k(()=>{"use strict";$n();xr()});async function Zg(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 Kg(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:assign_default"),(r.isUnset||n.checkEmpty&&r.isEmpty)&&n.word){let o=await s(e,n.word.parts,r.inDoubleQuotes),a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(a){let[,l,c]=a,u;if(/^\d+$/.test(c))u=Number.parseInt(c,10);else{try{let p=new pe,h=Ie(p,c);u=await re(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}`,o);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,o);return o}return r.effectiveValue}async function Qg(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:error_if_unset"),r.isUnset||n.checkEmpty&&r.isEmpty){let o=n.word?await s(e,n.word.parts,r.inDoubleQuotes):`${t}: parameter null or not set`;throw new we(1,"",`bash: ${o}
787
787
  `)}return r.effectiveValue}async function Xg(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 Yg(e,t,n,r,s){e.coverage?.hit("bash:expansion:pattern_removal");let i="",o=e.state.shoptOptions.extglob;if(n.pattern)for(let l of n.pattern.parts)if(l.type==="Glob")i+=xe(l.pattern,n.greedy,o);else if(l.type==="Literal")i+=xe(l.value,n.greedy,o);else if(l.type==="SingleQuoted"||l.type==="Escaped")i+=Ce(l.value);else if(l.type==="DoubleQuoted"){let c=await r(e,l.parts);i+=Ce(c)}else if(l.type==="ParameterExpansion"){let c=await s(e,l);i+=xe(c,n.greedy,o)}else{let c=await s(e,l);i+=Ce(c)}if(n.side==="prefix")return Q(`^${i}`,"s").replace(t,"");let a=Q(`${i}$`,"s");if(n.greedy)return a.replace(t,"");for(let l=t.length;l>=0;l--){let c=t.slice(l);if(a.test(c))return t.slice(0,l)}return t}async function Jg(e,t,n,r,s){e.coverage?.hit("bash:expansion:pattern_replacement");let i="",o=e.state.shoptOptions.extglob;if(n.pattern)for(let c of n.pattern.parts)if(c.type==="Glob")i+=xe(c.pattern,!0,o);else if(c.type==="Literal")i+=xe(c.value,!0,o);else if(c.type==="SingleQuoted"||c.type==="Escaped")i+=Ce(c.value);else if(c.type==="DoubleQuoted"){let u=await r(e,c.parts);i+=Ce(u)}else if(c.type==="ParameterExpansion"){let u=await s(e,c);i+=xe(u,!0,o)}else{let u=await s(e,c);i+=Ce(u)}let a=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=Q(i,l);if(n.all){let u="",f=0,p=0,h=e.limits.maxStringLength,d=c.exec(t);for(;d!==null&&!(d[0].length===0&&d.index===t.length);){if(u+=t.slice(f,d.index)+a,f=d.index+d[0].length,d[0].length===0&&f++,p++,p%100===0&&u.length>h)throw new X(`pattern replacement: string length limit exceeded (${h} bytes)`,"string_length");d=c.exec(t)}return u+=t.slice(f),u}return c.replace(t,a)}catch(c){if(c instanceof X)throw c;return t}}function e6(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=ce(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)&&ir(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 t6(e,t,n,r){e.coverage?.hit("bash:expansion:substring");let s=await re(e,r.offset.expression),i=r.length?await re(e,r.length.expression):void 0;if(t==="@"||t==="*"){let c=Number.parseInt(e.state.env.get("#")||"0",10),u=[];for(let d=1;d<=c;d++)u.push(e.state.env.get(String(d))||"");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 d=i<0?p.length+i:h+i;return p.slice(h,Math.max(h,d)).join(" ")}return p.slice(h).join(" ")}let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(o){let c=o[1];if(e.state.associativeArrays?.has(c))throw new we(1,"",`bash: \${${c}[@]: 0: 3}: bad substitution
788
788
  `);let u=ce(e,c),f=0;if(s<0){if(u.length>0){let p=u[u.length-1][0],d=(typeof p=="number"?p:0)+1+s;if(d<0||(f=u.findIndex(([m])=>typeof m=="number"&&m>=d),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 Le(`${o[1]}[@]: substring expression < 0`);return u.slice(f,f+i).map(([,p])=>p).join(" ")}return u.slice(f).map(([,p])=>p).join(" ")}let a=[...n],l=s;if(l<0&&(l=Math.max(0,a.length+l)),i!==void 0){if(i<0){let c=a.length+i;return a.slice(l,Math.max(l,c)).join("")}return a.slice(l,l+i).join("")}return a.slice(l).join("")}async function n6(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:case_modification"),n.pattern){let i=e.state.shoptOptions.extglob,o="";for(let f of n.pattern.parts)if(f.type==="Glob")o+=xe(f.pattern,!0,i);else if(f.type==="Literal")o+=xe(f.value,!0,i);else if(f.type==="SingleQuoted"||f.type==="Escaped")o+=Ce(f.value);else if(f.type==="DoubleQuoted"){let p=await r(e,f.parts);o+=Ce(p)}else if(f.type==="ParameterExpansion"){let p=await s(e,f);o+=xe(p,!0,i)}let a=Q(`^(?:${o})$`),l=n.direction==="upper"?f=>f.toUpperCase():f=>f.toLowerCase(),c="",u=!1;for(let f of t)!n.all&&u?c+=f:a.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 r6(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 ce(e,i[1]).map(([,c])=>br(c)).join(" ");if(i&&s.operator==="a")return Er(e,i[1]);let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[.+\]$/);if(o&&s.operator==="a")return Er(e,o[1]);switch(s.operator){case"Q":return r?"":br(n);case"P":return ki(e,n);case"a":return Er(e,t);case"A":return r?"":`${t}=${br(n)}`;case"E":return n.replace(/\\([\\abefnrtv'"?])/g,(a,l)=>{switch(l){case"\\":return"\\";case"a":return"\x07";case"b":return"\b";case"e":return"\x1B";case"f":return"\f";case"n":return`
789
- `;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?"":br(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 s6(e,t,n,r,s,i,o=!1){if(e.coverage?.hit("bash:expansion:indirection"),We(e,t))return Zr(e,t)||"";let a=/^[a-zA-Z_][a-zA-Z0-9_]*\[([@*])\]$/.test(t);if(r){if(s.innerOp?.type==="UseAlternative")return"";throw new Pt(`\${!${t}}`)}let l=n;if(a&&(l===""||l.includes(" ")))throw new Pt(`\${!${t}}`);let c=l.match(/^[a-zA-Z_][a-zA-Z0-9_]*\[(.+)\]$/);if(c&&c[1].includes("~"))throw new Pt(`\${!${t}}`);if(s.innerOp){let u={type:"ParameterExpansion",parameter:l,operation:s.innerOp};return i(e,u,o)}return await Ie(e,l)}function i6(e,t){e.coverage?.hit("bash:expansion:array_keys");let r=ce(e,t.array).map(([s])=>String(s));return t.star?r.join(ge(e.state.env)):r.join(" ")}function o6(e,t){e.coverage?.hit("bash:expansion:var_name_prefix");let n=Ls(e,t.prefix);return t.star?n.join(ge(e.state.env)):n.join(" ")}function a6(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[,o,a]=i,l=ce(e,o);if(l.length===0)return{isEmpty:!0,effectiveValue:""};if(a==="*"){let c=ge(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 l6=k(()=>{"use strict";Tt();ct();Ze();Ut();Ae();an();$n();_s();Fs();Kr();Cu();vu();Xt();ca()});function c6(e){return se(e.stdout)}function u6(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 f6(e,t){let n=1,r=t,s=!1,i=!1;for(;r<e.length&&n>0;){let o=e[r];if(o==="\\"&&!s&&r+1<e.length){r+=2;continue}if(o==="'"&&!i){s=!s,r++;continue}if(o==='"'&&!s){i=!i,r++;continue}if(!s&&!i){if(o==="(")n++;else if(o===")"&&(n--,n===0))return r}r++}return-1}async function ua(e,t){let n=new pe,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),o=e.state.cwd,a=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=o,e.state.suppressVerbose=a,e.state.lastExitCode=c,e.state.env.set("?",String(c)),l.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+l.stderr),e.state.bashPid=s,c6(l).replace(/\n+$/,"")}catch(l){if(e.state.env=i,e.state.cwd=o,e.state.bashPid=s,e.state.suppressVerbose=a,l instanceof X)throw l;return l instanceof we?(e.state.lastExitCode=l.exitCode,e.state.env.set("?",String(l.exitCode)),c6({stdout:l.stdout??"",stdoutKind:l.stdoutKind,stdoutEncoding:l.stdoutEncoding}).replace(/\n+$/,"")):""}}function ku(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 o=t.slice(r+1,i);n+=Yt(o),r=i+1;continue}}if(s==='"'){let i=-1,o=r+1;for(;o<t.length;){if(t[o]==="\\"){o+=2;continue}if(t[o]==='"'){i=o;break}o++}if(i!==-1){let a=t.slice(r+1,i),l=IS(e,a);n+=Yt(l),r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}function IS(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 o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}n+=s,r++}return n}async function p6(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 o=t.slice(r+1,i);n+=Yt(o),r=i+1;continue}}if(s==='"'){let i=-1,o=r+1;for(;o<t.length;){if(t[o]==="\\"){o+=2;continue}if(t[o]==='"'){i=o;break}o++}if(i!==-1){let a=t.slice(r+1,i),l=await $S(e,a);n+=Yt(l),r=i+1;continue}}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=f6(t,r+2);if(i!==-1){let o=t.slice(r+2,i),a=await ua(e,o);n+=a,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let o=t.slice(r+1,i),a=await ua(e,o);n+=a,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}async function $S(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=f6(t,r+2);if(i!==-1){let o=t.slice(r+2,i),a=await ua(e,o);n+=a,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let o=t.slice(r+1,i),a=await ua(e,o);n+=a,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}n+=s,r++}return n}var h6=k(()=>{"use strict";he();ct();Ae();Ds()});function d6(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 m6=k(()=>{"use strict"});async function TS(e,t,n,r){let s="";for(let i of t.parts)if(i.type==="Glob")s+=xe(i.pattern,!0,e.state.shoptOptions.extglob);else if(i.type==="Literal")s+=xe(i.value,!0,e.state.shoptOptions.extglob);else if(i.type==="SingleQuoted"||i.type==="Escaped")s+=Ce(i.value);else if(i.type==="DoubleQuoted"){let o=await n(e,i.parts);s+=Ce(o)}else if(i.type==="ParameterExpansion"){let o=await r(e,i);s+=xe(o,!0,e.state.shoptOptions.extglob)}else{let o=await r(e,i);s+=Ce(o)}return s}async function g6(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],o=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let a=o[1],l=o[2]==="*",c=i.operation,u=ce(e,a),f=u.map(([,g])=>g);if(u.length===0){let g=e.state.env.get(a);g!==void 0&&f.push(g)}if(f.length===0)return{values:[],quoted:!0};let p="";c.pattern&&(p=await TS(e,c.pattern,n,r));let h=c.replacement?await n(e,c.replacement.parts):"",d=p;c.anchor==="start"?d=`^${p}`:c.anchor==="end"&&(d=`${p}$`);let m=[];try{let g=Q(d,c.all?"g":"");for(let y of f)m.push(g.replace(y,h))}catch{m.push(...f)}if(l){let g=ge(e.state.env);return{values:[m.join(g)],quoted:!0}}return{values:m,quoted:!0}}async function y6(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],o=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let a=o[1],l=o[2]==="*",c=i.operation,u=ce(e,a),f=u.map(([,m])=>m);if(u.length===0){let m=e.state.env.get(a);m!==void 0&&f.push(m)}if(f.length===0)return{values:[],quoted:!0};let p="",h=e.state.shoptOptions.extglob;if(c.pattern)for(let m of c.pattern.parts)if(m.type==="Glob")p+=xe(m.pattern,c.greedy,h);else if(m.type==="Literal")p+=xe(m.value,c.greedy,h);else if(m.type==="SingleQuoted"||m.type==="Escaped")p+=Ce(m.value);else if(m.type==="DoubleQuoted"){let g=await n(e,m.parts);p+=Ce(g)}else if(m.type==="ParameterExpansion"){let g=await r(e,m);p+=xe(g,c.greedy,h)}else{let g=await r(e,m);p+=Ce(g)}let d=[];for(let m of f)d.push(or(m,p,c.side,c.greedy));if(l){let m=ge(e.state.env);return{values:[d.join(m)],quoted:!0}}return{values:d,quoted:!0}}var w6=k(()=>{"use strict";Ze();an();_s();Fs();Kr();Xt()});async function b6(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_]*)\[([@*])\]$/),o,a=!1;if(i){let l=i[1];a=i[2]==="*";let c=ce(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"?o=u&&!(p&&f):o=!u||p&&f,!o){if(c.length>0){let d=c.map(([,m])=>m);if(a){let m=ge(e.state.env);return{values:[d.join(m)],quoted:!0}}return{values:d,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 Vn(e,l),u=await Ie(e,l),f=u==="",p=s.checkEmpty??!1;if(s.type==="UseAlternative"?o=c&&!(p&&f):o=!c||p&&f,!o)return{values:[u],quoted:!0}}if(o&&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=ce(e,c);if(f.length>0){let h=f.map(([,d])=>d);if(u||a){let d=ge(e.state.env);return{values:[h.join(d)],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 x6(e,t,n,r,s){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0],o=-1,a="",l=!1,c=null;for(let m=0;m<i.parts.length;m++){let g=i.parts[m];if(g.type==="ParameterExpansion"&&(g.operation?.type==="PatternRemoval"||g.operation?.type==="PatternReplacement")){let y=g.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(y){o=m,a=y[1],l=y[2]==="*",c=g.operation;break}}}if(o===-1||o===0&&o===i.parts.length-1)return null;let u="";for(let m=0;m<o;m++)u+=await r(e,i.parts[m]);let f="";for(let m=o+1;m<i.parts.length;m++)f+=await r(e,i.parts[m]);let p=ce(e,a),h=p.map(([,m])=>m);if(p.length===0){let m=e.state.env.get(a);if(m!==void 0)h=[m];else{if(l)return{values:[u+f],quoted:!0};let g=u+f;return{values:g?[g]:[],quoted:!0}}}if(c?.type==="PatternRemoval"){let m=c,g="",y=e.state.shoptOptions.extglob;if(m.pattern)for(let w of m.pattern.parts)if(w.type==="Glob")g+=xe(w.pattern,m.greedy,y);else if(w.type==="Literal")g+=xe(w.value,m.greedy,y);else if(w.type==="SingleQuoted"||w.type==="Escaped")g+=Ce(w.value);else if(w.type==="DoubleQuoted"){let b=await s(e,w.parts);g+=Ce(b)}else if(w.type==="ParameterExpansion"){let b=await r(e,w);g+=xe(b,m.greedy,y)}else{let b=await r(e,w);g+=Ce(b)}h=h.map(w=>or(w,g,m.side,m.greedy))}else if(c?.type==="PatternReplacement"){let m=c,g="";if(m.pattern)for(let b of m.pattern.parts)if(b.type==="Glob")g+=xe(b.pattern,!0,e.state.shoptOptions.extglob);else if(b.type==="Literal")g+=xe(b.value,!0,e.state.shoptOptions.extglob);else if(b.type==="SingleQuoted"||b.type==="Escaped")g+=Ce(b.value);else if(b.type==="DoubleQuoted"){let x=await s(e,b.parts);g+=Ce(x)}else if(b.type==="ParameterExpansion"){let x=await r(e,b);g+=xe(x,!0,e.state.shoptOptions.extglob)}else{let x=await r(e,b);g+=Ce(x)}let y=m.replacement?await s(e,m.replacement.parts):"",w=g;m.anchor==="start"?w=`^${g}`:m.anchor==="end"&&(w=`${g}$`);try{let b=Q(w,m.all?"g":"");h=h.map(x=>b.replace(x,y))}catch{}}if(l){let m=ge(e.state.env);return{values:[u+h.join(m)+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 E6(e,t,n,r){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o="",a=!1;for(let h=0;h<s.parts.length;h++){let d=s.parts[h];if(d.type==="ParameterExpansion"&&!d.operation){let m=d.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(m){i=h,o=m[1],a=m[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=ce(e,o),f=u.map(([,h])=>h);if(u.length===0){let h=e.state.env.get(o);if(h!==void 0)return{values:[l+h+c],quoted:!0};if(a)return{values:[l+c],quoted:!0};let d=l+c;return{values:d?[d]:[],quoted:!0}}if(a){let h=ge(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 A6=k(()=>{"use strict";Ze();an();_s();Fs();Kr();Xt()});async function S6(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 o=i[1],a=i[2]==="*",l=s.operation;if(e.state.associativeArrays?.has(o))throw new we(1,"",`bash: \${${o}[@]: 0: 3}: bad substitution
790
- `);let c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=ce(e,o),p=0;if(c<0){if(f.length>0){let d=f[f.length-1][0],g=(typeof d=="number"?d:0)+1+c;if(g<0)return{values:[],quoted:!0};p=f.findIndex(([y])=>typeof y=="number"&&y>=g),p<0&&(p=f.length)}}else p=f.findIndex(([d])=>typeof d=="number"&&d>=c),p<0&&(p=f.length);let h;if(u!==void 0){if(u<0)throw new Le(`${o}[@]: substring expression < 0`);h=f.slice(p,p+u).map(([,d])=>d)}else h=f.slice(p).map(([,d])=>d);if(h.length===0)return{values:[],quoted:!0};if(a){let d=ge(e.state.env);return{values:[h.join(d)],quoted:!0}}return{values:h,quoted:!0}}function C6(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],o=s[2]==="*",a=r.operation,l=ce(e,i);if(l.length===0){let f=e.state.env.get(i);if(f!==void 0){let p;switch(a.operator){case"a":p="";break;case"P":p=ki(e,f);break;case"Q":p=br(f);break;default:p=f}return{values:[p],quoted:!0}}return o?{values:[""],quoted:!0}:{values:[],quoted:!0}}let c=Er(e,i),u;switch(a.operator){case"a":u=l.map(()=>c);break;case"P":u=l.map(([,f])=>ki(e,f));break;case"Q":u=l.map(([,f])=>br(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(o){let f=ge(e.state.env);return{values:[u.join(f)],quoted:!0}}return{values:u,quoted:!0}}var v6=k(()=>{"use strict";Ae();an();Cu();vu();Xt();ca()});function k6(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(We(e,i)){let l=Zr(e,i);if(l?.endsWith("[@]")||l?.endsWith("[*]"))return{values:[],quoted:!0}}let o=ce(e,i);if(o.length>0)return{values:o.map(([,l])=>l),quoted:!0};let a=e.state.env.get(i);return a!==void 0?{values:[a],quoted:!0}:{values:[],quoted:!0}}function N6(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)||!We(e,s))return null;let i=Zr(e,s);if(!i)return null;let o=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!o)return null;let a=o[1],l=ce(e,a);if(l.length>0)return{values:l.map(([,u])=>u),quoted:!0};let c=e.state.env.get(a);return c!==void 0?{values:[c],quoted:!0}:{values:[],quoted:!0}}var I6=k(()=>{"use strict";$n();Xt()});async function $6(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 o=i.parts[0],a=o.operation,l=await Ie(e,o.parameter),c=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c){if(!a.innerOp&&(l==="@"||l==="*")){let d=Number.parseInt(e.state.env.get("#")||"0",10),m=[];for(let g=1;g<=d;g++)m.push(e.state.env.get(String(g))||"");return l==="*"?{values:[m.join(ge(e.state.env))],quoted:!0}:{values:m,quoted:!0}}return null}let u=c[1],f=c[2]==="*",p=ce(e,u);if(a.innerOp){if(a.innerOp.type==="Substring")return OS(e,p,u,f,a.innerOp);if(a.innerOp.type==="DefaultValue"||a.innerOp.type==="UseAlternative"||a.innerOp.type==="AssignDefault"||a.innerOp.type==="ErrorIfUnset")return RS(e,p,u,f,a.innerOp,s);if(a.innerOp.type==="Transform"&&a.innerOp.operator==="a"){let m=Er(e,u),g=p.map(()=>m);return f?{values:[g.join(ge(e.state.env))],quoted:!0}:{values:g,quoted:!0}}let d=[];for(let[,m]of p){let g={type:"ParameterExpansion",parameter:"_indirect_elem_",operation:a.innerOp},y=e.state.env.get("_indirect_elem_");e.state.env.set("_indirect_elem_",m);try{let w=await r(e,g,!0);d.push(w)}finally{y!==void 0?e.state.env.set("_indirect_elem_",y):e.state.env.delete("_indirect_elem_")}}return f?{values:[d.join(ge(e.state.env))],quoted:!0}:{values:d,quoted:!0}}if(p.length>0){let d=p.map(([,m])=>m);return f?{values:[d.join(ge(e.state.env))],quoted:!0}:{values:d,quoted:!0}}let h=e.state.env.get(u);return h!==void 0?{values:[h],quoted:!0}:{values:[],quoted:!0}}async function OS(e,t,n,r,s){let i=s.offset?await re(e,s.offset.expression):0,o=s.length?await re(e,s.length.expression):void 0,a=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(a=t.findIndex(([h])=>typeof h=="number"&&h>=p),a<0)return{values:[],quoted:!0}}}else if(a=t.findIndex(([u])=>typeof u=="number"&&u>=i),a<0)return{values:[],quoted:!0};let l;if(o!==void 0){if(o<0)throw new Le(`${n}[@]: substring expression < 0`);l=t.slice(a,a+o)}else l=t.slice(a);let c=l.map(([,u])=>u);return r?{values:[c.join(ge(e.state.env))],quoted:!0}:{values:c,quoted:!0}}async function RS(e,t,n,r,s,i){let o=s.checkEmpty??!1,a=t.map(([,u])=>u),l=t.length===0,c=t.length===0;if(s.type==="UseAlternative")return!c&&!(o&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:{values:[],quoted:!0};if(s.type==="DefaultValue")return(c||o&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:r?{values:[a.join(ge(e.state.env))],quoted:!0}:{values:a,quoted:!0};if(s.type==="AssignDefault"){if((c||o&&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:[a.join(ge(e.state.env))],quoted:!0}:{values:a,quoted:!0}}return r?{values:[a.join(ge(e.state.env))],quoted:!0}:{values:a,quoted:!0}}async function T6(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 o=i.parts[0],l=(await Ie(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!l)return null;let c=await Vn(e,n.parameter),u=await Ie(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],d=l[2]==="*",m=ce(e,h);if(m.length>0){let y=m.map(([,w])=>w);return d?{values:[y.join(ge(e.state.env))],quoted:!0}:{values:y,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 O6(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 o=i.parts[0];if(o.parts.length!==1||o.parts[0].type!=="ParameterExpansion"||o.parts[0].operation?.type!=="Indirection")return null;let a=o.parts[0],c=(await Ie(e,a.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c)return null;let u=await Ie(e,n.parameter),f=await Vn(e,n.parameter),p=u==="",h=s.checkEmpty??!1,d;if(s.type==="UseAlternative"?d=f&&!(h&&p):d=!f||h&&p,d){let m=c[1],g=c[2]==="*",y=ce(e,m);if(y.length>0){let b=y.map(([,x])=>x);return g?{values:[b.join(ge(e.state.env))],quoted:!0}:{values:b,quoted:!0}}let w=e.state.env.get(m);return w!==void 0?{values:[w],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}var R6=k(()=>{"use strict";Ut();Ae();an();Xt();ca()});function P6(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 D6(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let w=0;w<s.parts.length;w++){let b=s.parts[w];if(b.type==="ParameterExpansion"&&(b.parameter==="@"||b.parameter==="*")&&b.operation?.type==="Substring"){i=w,o=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 w=1;w<=f;w++)p.push(e.state.env.get(String(w))||"");let h=e.state.env.get("0")||"bash",d;if(c<=0){let w=[h,...p],b=w.length+c;if(b<0)d=[];else{let x=c<0?b:0;if(u!==void 0){let S=u<0?w.length+u:x+u;d=w.slice(x,Math.max(x,S))}else d=w.slice(x)}}else{let w=c-1;if(w>=p.length)d=[];else if(u!==void 0){let b=u<0?p.length+u:w+u;d=p.slice(w,Math.max(w,b))}else d=p.slice(w)}let m="";for(let w=0;w<i;w++)m+=await r(e,s.parts[w]);let g="";for(let w=i+1;w<s.parts.length;w++)g+=await r(e,s.parts[w]);if(d.length===0){let w=m+g;return{values:w?[w]:[],quoted:!0}}if(o){let w=ge(e.state.env);return{values:[m+d.join(w)+g],quoted:!0}}return d.length===1?{values:[m+d[0]+g],quoted:!0}:{values:[m+d[0],...d.slice(1,-1),d[d.length-1]+g],quoted:!0}}async function _6(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let y=0;y<s.parts.length;y++){let w=s.parts[y];if(w.type==="ParameterExpansion"&&(w.parameter==="@"||w.parameter==="*")&&w.operation?.type==="PatternReplacement"){i=y,o=w.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=P6(e),u="";for(let y=0;y<i;y++)u+=await n(e,s.parts[y]);let f="";for(let y=i+1;y<s.parts.length;y++)f+=await n(e,s.parts[y]);if(c.length===0){let y=u+f;return{values:y?[y]:[],quoted:!0}}let p="";if(l.pattern)for(let y of l.pattern.parts)if(y.type==="Glob")p+=xe(y.pattern,!0,e.state.shoptOptions.extglob);else if(y.type==="Literal")p+=xe(y.value,!0,e.state.shoptOptions.extglob);else if(y.type==="SingleQuoted"||y.type==="Escaped")p+=Ce(y.value);else if(y.type==="DoubleQuoted"){let w=await r(e,y.parts);p+=Ce(w)}else if(y.type==="ParameterExpansion"){let w=await n(e,y);p+=xe(w,!0,e.state.shoptOptions.extglob)}else{let w=await n(e,y);p+=Ce(w)}let h=l.replacement?await r(e,l.replacement.parts):"",d=p;l.anchor==="start"?d=`^${p}`:l.anchor==="end"&&(d=`${p}$`);let m=[];try{let y=Q(d,l.all?"g":"");for(let w of c)m.push(y.replace(w,h))}catch{m.push(...c)}if(o){let y=ge(e.state.env);return{values:[u+m.join(y)+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 F6(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let g=0;g<s.parts.length;g++){let y=s.parts[g];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="PatternRemoval"){i=g,o=y.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=P6(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+=xe(g.pattern,l.greedy,h);else if(g.type==="Literal")p+=xe(g.value,l.greedy,h);else if(g.type==="SingleQuoted"||g.type==="Escaped")p+=Ce(g.value);else if(g.type==="DoubleQuoted"){let y=await r(e,g.parts);p+=Ce(y)}else if(g.type==="ParameterExpansion"){let y=await n(e,g);p+=xe(y,l.greedy,h)}else{let y=await n(e,g);p+=Ce(y)}let d=[];for(let g of c)d.push(or(g,p,l.side,l.greedy));if(o){let g=ge(e.state.env);return{values:[u+d.join(g)+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 L6(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 o=r.parts[s];if(o.type==="ParameterExpansion"&&o.operation)return null;let a=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(a===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<=a;p++)u.push(e.state.env.get(String(p))||"");if(i){let p=ge(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 M6=k(()=>{"use strict";Ze();an();_s();Fs();Kr()});function PS(e){return new wr(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 fa(e,t){if(e.state.options.noglob)return t;let n=PS(e),r=[];for(let s of t)if(qn(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 U6(e,t,n,r){let s=-1,i="",o=!1;for(let w=0;w<t.length;w++){let b=t[w];if(b.type==="ParameterExpansion"&&b.operation?.type==="PatternReplacement"){let x=b.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(x){s=w,i=x[1],o=x[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=ce(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="";if(l.pattern)for(let w of l.pattern.parts)if(w.type==="Glob")f+=xe(w.pattern,!0,e.state.shoptOptions.extglob);else if(w.type==="Literal")f+=xe(w.value,!0,e.state.shoptOptions.extglob);else if(w.type==="SingleQuoted"||w.type==="Escaped")f+=Ce(w.value);else if(w.type==="DoubleQuoted"){let b=await n(e,w.parts);f+=Ce(b)}else if(w.type==="ParameterExpansion"){let b=await r(e,w);f+=xe(b,!0,e.state.shoptOptions.extglob)}else{let b=await r(e,w);f+=Ce(b)}let p=l.replacement?await n(e,l.replacement.parts):"",h=f;l.anchor==="start"?h=`^${f}`:l.anchor==="end"&&(h=`${f}$`);let d=[];try{let w=Q(h,l.all?"g":"");for(let b of u)d.push(w.replace(b,p))}catch{d.push(...u)}let m=yt(e.state.env),g=kt(e.state.env);if(o){let w=ge(e.state.env),b=d.join(w);return g?{values:b?[b]:[],quoted:!1}:{values:Ve(b,m),quoted:!1}}if(g)return{values:d,quoted:!1};let y=[];for(let w of d)w===""?y.push(""):y.push(...Ve(w,m));return{values:y,quoted:!1}}async function B6(e,t,n,r){let s=-1,i="",o=!1;for(let y=0;y<t.length;y++){let w=t[y];if(w.type==="ParameterExpansion"&&w.operation?.type==="PatternRemoval"){let b=w.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(b){s=y,i=b[1],o=b[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=ce(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="",p=e.state.shoptOptions.extglob;if(l.pattern)for(let y of l.pattern.parts)if(y.type==="Glob")f+=xe(y.pattern,l.greedy,p);else if(y.type==="Literal")f+=xe(y.value,l.greedy,p);else if(y.type==="SingleQuoted"||y.type==="Escaped")f+=Ce(y.value);else if(y.type==="DoubleQuoted"){let w=await n(e,y.parts);f+=Ce(w)}else if(y.type==="ParameterExpansion"){let w=await r(e,y);f+=xe(w,l.greedy,p)}else{let w=await r(e,y);f+=Ce(w)}let h=[];for(let y of u)h.push(or(y,f,l.side,l.greedy));let d=yt(e.state.env),m=kt(e.state.env);if(o){let y=ge(e.state.env),w=h.join(y);return m?{values:w?[w]:[],quoted:!1}:{values:Ve(w,d),quoted:!1}}if(m)return{values:h,quoted:!1};let g=[];for(let y of h)y===""?g.push(""):g.push(...Ve(y,d));return{values:g,quoted:!1}}async function W6(e,t,n,r){let s=-1,i=!1;for(let g=0;g<t.length;g++){let y=t[g];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="PatternRemoval"){s=g,i=y.parameter==="*";break}}if(s===-1)return null;let a=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(a.pattern)for(let g of a.pattern.parts)if(g.type==="Glob")u+=xe(g.pattern,a.greedy,f);else if(g.type==="Literal")u+=xe(g.value,a.greedy,f);else if(g.type==="SingleQuoted"||g.type==="Escaped")u+=Ce(g.value);else if(g.type==="DoubleQuoted"){let y=await n(e,g.parts);u+=Ce(y)}else if(g.type==="ParameterExpansion"){let y=await r(e,g);u+=xe(y,a.greedy,f)}else{let y=await r(e,g);u+=Ce(y)}let p=[];for(let g of c)p.push(or(g,u,a.side,a.greedy));let h=yt(e.state.env),d=kt(e.state.env);if(i){let g=ge(e.state.env),y=p.join(g);return d?{values:y?[y]:[],quoted:!1}:{values:Ve(y,h),quoted:!1}}if(d)return{values:p,quoted:!1};let m=[];for(let g of p)g===""?m.push(""):m.push(...Ve(g,h));return{values:m,quoted:!1}}async function z6(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 a=t[s].operation,l=a.offset?await n(e,a.offset.expression):0,c=a.length?await n(e,a.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 v=c<0?b.length+c:S+c;h=b.slice(S,Math.max(S,v))}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 d="";for(let b=0;b<s;b++)d+=await r(e,t[b]);let m="";for(let b=s+1;b<t.length;b++)m+=await r(e,t[b]);let g=yt(e.state.env),y=kt(e.state.env);if(h.length===0){let b=d+m;return b?y?{values:[b],quoted:!1}:{values:Ve(b,g),quoted:!1}:{values:[],quoted:!1}}let w;if(i){let b=ge(e.state.env),x=d+h.join(b)+m;y?w=x?[x]:[]:w=Ve(x,g)}else if(y)h.length===1?w=[d+h[0]+m]:w=[d+h[0],...h.slice(1,-1),h[h.length-1]+m];else{w=[];for(let b=0;b<h.length;b++){let x=h[b];if(b===0&&(x=d+x),b===h.length-1&&(x=x+m),x==="")w.push("");else{let S=Ve(x,g);w.push(...S)}}}return{values:await fa(e,w),quoted:!1}}async function H6(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=yt(e.state.env),o=kt(e.state.env),a=sa(e.state.env),l;if(n)if(o)l=s.filter(c=>c!=="");else{let c=ge(e.state.env),u=s.join(c);l=Ve(u,i)}else if(o)l=s.filter(c=>c!=="");else if(a){l=[];for(let c of s){if(c==="")continue;let u=Ve(c,i);l.push(...u)}}else{l=[];for(let c of s)if(c==="")l.push("");else{let u=Ve(c,i);l.push(...u)}for(;l.length>0&&l[l.length-1]==="";)l.pop()}return{values:await fa(e,l),quoted:!1}}async function j6(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=ce(e,r),o;if(i.length===0){let f=e.state.env.get(r);if(f!==void 0)o=[f];else return{values:[],quoted:!1}}else o=i.map(([,f])=>f);let a=yt(e.state.env),l=kt(e.state.env),c=sa(e.state.env),u;if(s)if(l)u=o.filter(f=>f!=="");else{let f=ge(e.state.env),p=o.join(f);u=Ve(p,a)}else if(l)u=o.filter(f=>f!=="");else if(c){u=[];for(let f of o){if(f==="")continue;let p=Ve(f,a);u.push(...p)}}else{u=[];for(let f of o)if(f==="")u.push("");else{let p=Ve(f,a);u.push(...p)}for(;u.length>0&&u[u.length-1]==="";)u.pop()}return{values:await fa(e,u),quoted:!1}}function G6(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="VarNamePrefix")return null;let n=t[0].operation,r=Ls(e,n.prefix);if(r.length===0)return{values:[],quoted:!1};let s=yt(e.state.env),i=kt(e.state.env),o;if(n.star)if(i)o=r;else{let a=ge(e.state.env),l=r.join(a);o=Ve(l,s)}else if(i)o=r;else{o=[];for(let a of r){let l=Ve(a,s);o.push(...l)}}return{values:o,quoted:!1}}function V6(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="ArrayKeys")return null;let n=t[0].operation,s=ce(e,n.array).map(([l])=>String(l));if(s.length===0)return{values:[],quoted:!1};let i=yt(e.state.env),o=kt(e.state.env),a;if(n.star)if(o)a=s;else{let l=ge(e.state.env),c=s.join(l);a=Ve(c,i)}else if(o)a=s;else{a=[];for(let l of s){let c=Ve(l,i);a.push(...c)}}return{values:a,quoted:!1}}async function q6(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 o="";for(let p=0;p<r;p++)o+=await n(e,t[p]);let a="";for(let p=r+1;p<t.length;p++)a+=await n(e,t[p]);let l=yt(e.state.env),c=kt(e.state.env),u=sa(e.state.env);if(s===0){let p=o+a;return{values:p?[p]:[],quoted:!1}}let f;{let p=[];for(let h=0;h<i.length;h++){let d=i[h];h===0&&(d=o+d),h===i.length-1&&(d=d+a),p.push(d)}if(c)f=p.filter(h=>h!=="");else if(u){f=[];for(let h of p){if(h==="")continue;let d=Ve(h,l);f.push(...d)}}else{f=[];for(let h of p)if(h==="")f.push("");else{let d=Ve(h,l);f.push(...d)}for(;f.length>0&&f[f.length-1]==="";)f.pop()}}return f.length===0?{values:[],quoted:!1}:{values:await fa(e,f),quoted:!1}}var Z6=k(()=>{"use strict";Ze();ta();Ae();an();_s();Ds();Fs();Kr();Xt()});async function X6(e,t,n){e.coverage?.hit("bash:expansion:word_glob");let r=t.parts,{hasQuoted:s,hasCommandSub:i,hasArrayVar:o,hasArrayAtExpansion:a,hasParamExpansion:l,hasVarNamePrefixExpansion:c,hasIndirection:u}=vi(r),p=n.hasBraceExpansion(r)?await n.expandWordWithBracesAsync(e,t):null;if(p&&p.length>1)return DS(e,p,s);let h=await _S(e,r,a,c,u,n);if(h!==null)return h;let d=await LS(e,r,n);if(d!==null)return d;let m=await MS(e,r,n);if(m!==null)return m;let g=await BS(e,r,n.expandPart);if(g!==null)return Q6(e,g);if((i||o||l)&&!kt(e.state.env)){let w=yt(e.state.env),b=n.buildIfsCharClassPattern(w),x=await n.smartWordSplit(e,r,w,b,n.expandPart);return Q6(e,x)}let y=await n.expandWordAsync(e,t);return WS(e,t,r,y,s,n.expandWordForGlobbing)}async function DS(e,t,n){let r=[];for(let s of t)if(!(!n&&s===""))if(!n&&!e.state.options.noglob&&qn(s,e.state.shoptOptions.extglob)){let i=await pa(e,s);r.push(...i)}else r.push(s);return{values:r,quoted:!1}}async function _S(e,t,n,r,s,i){if(n){let o=k6(e,t);if(o!==null)return o}{let o=N6(e,t);if(o!==null)return o}{let o=await b6(e,t);if(o!==null)return o}{let o=await x6(e,t,n,i.expandPart,i.expandWordPartsAsync);if(o!==null)return o}{let o=await E6(e,t,n,i.expandPart);if(o!==null)return o}{let o=await S6(e,t,i.evaluateArithmetic);if(o!==null)return o}{let o=C6(e,t);if(o!==null)return o}{let o=await g6(e,t,i.expandWordPartsAsync,i.expandPart);if(o!==null)return o}{let o=await y6(e,t,i.expandWordPartsAsync,i.expandPart);if(o!==null)return o}if(r&&t.length===1&&t[0].type==="DoubleQuoted"){let o=FS(e,t);if(o!==null)return o}{let o=await $6(e,t,s,i.expandParameterAsync,i.expandWordPartsAsync);if(o!==null)return o}{let o=await T6(e,t);if(o!==null)return o}{let o=await O6(e,t);if(o!==null)return o}return null}function FS(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=Ls(e,r.prefix);return r.star?{values:[s.join(ge(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=ce(e,r.array).map(([o])=>String(o));return r.star?{values:[i.join(ge(e.state.env))],quoted:!0}:{values:i,quoted:!0}}return null}async function LS(e,t,n){{let r=await D6(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await _6(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await F6(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await L6(e,t,n.expandPart);if(r!==null)return r}return null}async function MS(e,t,n){{let r=await U6(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await B6(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await W6(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await z6(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await H6(e,t);if(r!==null)return r}{let r=await j6(e,t);if(r!==null)return r}{let r=G6(e,t);if(r!==null)return r}{let r=V6(e,t);if(r!==null)return r}{let r=await q6(e,t,n.expandPart);if(r!==null)return r}return null}function K6(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 US(e,t,n,r){let s="";for(let a=0;a<n.atIndex;a++)s+=await r(e,t.parts[a]);let i="";for(let a=n.atIndex+1;a<t.parts.length;a++)i+=await r(e,t.parts[a]);let o;if(n.type==="array"){if(o=ce(e,n.name).map(([,l])=>l),o.length===0){let l=e.state.env.get(n.name);l!==void 0&&(o=[l])}}else{let a=Number.parseInt(e.state.env.get("#")||"0",10);o=[];for(let l=1;l<=a;l++)o.push(e.state.env.get(String(l))||"")}if(n.isStar){let a=ge(e.state.env),l=o.join(a);return[s+l+i]}if(o.length===0){let a=s+i;return a?[a]:[]}return o.length===1?[s+o[0]+i]:[s+o[0],...o.slice(1,-1),o[o.length-1]+i]}async function BS(e,t,n){if(t.length<2)return null;let r=!1;for(let l of t)if(K6(l)){r=!0;break}if(!r)return null;let s=yt(e.state.env),i=kt(e.state.env),o=[];for(let l of t){let c=K6(l);if(c&&l.type==="DoubleQuoted"){let u=await US(e,l,c,n);o.push(u)}else if(l.type==="DoubleQuoted"||l.type==="SingleQuoted"){let u=await n(e,l);o.push([u])}else if(l.type==="Literal")o.push([l.value]);else if(l.type==="ParameterExpansion"){let u=await n(e,l);if(i)o.push(u?[u]:[]);else{let f=Ve(u,s);o.push(f)}}else{let u=await n(e,l);if(i)o.push(u?[u]:[]);else{let f=Ve(u,s);o.push(f)}}}let a=[];for(let l of o)if(l.length!==0)if(a.length===0)a.push(...l);else{let c=a.length-1;a[c]=a[c]+l[0];for(let u=1;u<l.length;u++)a.push(l[u])}return a}async function Q6(e,t){if(e.state.options.noglob)return{values:t,quoted:!1};let n=[];for(let r of t)if(qn(r,e.state.shoptOptions.extglob)){let s=await pa(e,r);n.push(...s)}else n.push(r);return{values:n,quoted:!1}}async function pa(e,t){let n=new wr(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 WS(e,t,n,r,s,i){let o=n.some(a=>a.type==="Glob");if(!e.state.options.noglob&&o){let a=await i(e,t);if(qn(a,e.state.shoptOptions.extglob)){let c=await pa(e,a);if(c.length>0&&c[0]!==a)return{values:c,quoted:!1};if(c.length===0)return{values:[],quoted:!1}}let l=Su(r);if(!kt(e.state.env)){let c=yt(e.state.env);return{values:Ve(l,c),quoted:!1}}return{values:[l],quoted:!1}}if(!s&&!e.state.options.noglob&&qn(r,e.state.shoptOptions.extglob)){let a=await i(e,t);if(qn(a,e.state.shoptOptions.extglob)){let l=await pa(e,a);if(l.length>0&&l[0]!==a)return{values:l,quoted:!1}}}if(r===""&&!s)return{values:[],quoted:!1};if(o&&!s){let a=Su(r);if(!kt(e.state.env)){let l=yt(e.state.env);return{values:Ve(a,l),quoted:!1}}return{values:[a],quoted:!1}}return{values:[r],quoted:s}}var Y6=k(()=>{"use strict";ta();Ae();an();na();w6();A6();v6();I6();Ds();R6();Kr();M6();Z6();Xt()});async function ey(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 Vn(e,t.parameter),o=await Ie(e,t.parameter,!1)==="",a=n.checkEmpty??!1,l;return n.type==="UseAlternative"?l=s&&!(a&&o):l=!s||a&&o,l?r.parts:null}function zS(e){return e.type==="SingleQuoted"?!0:e.type==="DoubleQuoted"?e.parts.every(n=>n.type==="Literal"):!1}async function HS(e,t){if(t.type!=="ParameterExpansion")return null;let n=await ey(e,t);if(!n||n.length<=1)return null;let r=n.some(i=>zS(i)),s=n.some(i=>i.type==="Literal"||i.type==="ParameterExpansion"||i.type==="CommandSubstitution"||i.type==="ArithmeticExpansion");return r&&s?n:null}function jS(e){return e.type==="DoubleQuoted"||e.type==="SingleQuoted"||e.type==="Literal"?!1:e.type==="Glob"?gu(e.pattern):!(!(e.type==="ParameterExpansion"||e.type==="CommandSubstitution"||e.type==="ArithmeticExpansion")||e.type==="ParameterExpansion"&&_g(e))}async function ty(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 ey(e,p);if(h&&h.length>0&&h.length>1&&h.some(m=>m.type==="DoubleQuoted"||m.type==="SingleQuoted")&&h.some(m=>m.type==="Literal"||m.type==="ParameterExpansion"||m.type==="CommandSubstitution"||m.type==="ArithmeticExpansion"))return J6(e,h,n,r,s)}let i=[],o=!1;for(let p of t){let h=jS(p),d=p.type==="DoubleQuoted"||p.type==="SingleQuoted",m=h?await HS(e,p):null,g=await s(e,p);i.push({value:g,isSplittable:h,isQuoted:d,mixedDefaultParts:m??void 0}),h&&(o=!0)}if(!o){let p=i.map(h=>h.value).join("");return p?[p]:[]}let a=[],l="",c=!1,u=!1,f=!1;for(let p of i)if(!p.isSplittable)u?p.isQuoted&&p.value===""?(l!==""&&a.push(l),a.push(""),c=!0,l="",u=!1,f=!0):p.value!==""?(l!==""&&a.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 J6(e,p.mixedDefaultParts,n,r,s);if(h.length!==0)if(h.length===1)l+=h[0],c=!0;else{l+=h[0],a.push(l),c=!0;for(let d=1;d<h.length-1;d++)a.push(h[d]);l=h[h.length-1]}u=!1,f=!1}else{let{words:h,hadLeadingDelimiter:d,hadTrailingDelimiter:m}=ia(p.value,n);if(f&&d&&l===""&&(a.push(""),c=!0),h.length===0)m&&(u=!0);else if(h.length===1)l+=h[0],c=!0,u=m;else{l+=h[0],a.push(l),c=!0;for(let g=1;g<h.length-1;g++)a.push(h[g]);l=h[h.length-1],u=m}f=!1}return l!==""?a.push(l):a.length===0&&c&&a.push(""),a}function GS(e,t){return e.length>0&&t.includes(e[0])}async function J6(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 o=[],a="",l=!1,c=!1;for(let u of i)if(!u.isSplittable)c&&u.value!==""?(a!==""&&o.push(a),a=u.value,c=!1):a+=u.value;else{GS(u.value,n)&&a!==""&&(o.push(a),a="",l=!0);let{words:p,hadTrailingDelimiter:h}=ia(u.value,n);if(p.length===0)h&&(c=!0);else if(p.length===1)a+=p[0],l=!0,c=h;else{a+=p[0],o.push(a),l=!0;for(let d=1;d<p.length-1;d++)o.push(p[d]);a=p[p.length-1],c=h}}return a!==""?o.push(a):o.length===0&&l&&o.push(""),o}var ny=k(()=>{"use strict";Xt();an();na()});function ry(e){switch(e.type){case"Literal":return e.value;case"SingleQuoted":return e.value;case"Escaped":return e.value;default:return null}}function sy(e){switch(e.type){case"SingleQuoted":case"Escaped":case"DoubleQuoted":return!0;case"Literal":return e.value==="";default:return!1}}var iy=k(()=>{"use strict"});var Ru={};ee(Ru,{escapeGlobChars:()=>Yt,escapeRegexChars:()=>Ps,expandRedirectTarget:()=>Ii,expandWord:()=>le,expandWordForPattern:()=>Tu,expandWordForRegex:()=>$u,expandWordWithGlob:()=>wn,getArrayElements:()=>ce,getVariable:()=>Ie,hasQuotedMultiValueAt:()=>Ni,isArray:()=>ir,isWordFullyQuoted:()=>Iu});function Ar(e,t,n){if(e.length>t)throw new X(`${n}: string length limit exceeded (${t} bytes)`,"string_length")}function oy(e){return se(e.stdout)}async function On(e,t,n=!1){let r=[];for(let s of t)r.push(await ln(e,s,n));return r.join("")}function VS(e){return sy(e)}function Iu(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!VS(t))return!1;return!0}function qS(e,t,n=!1){let r=ry(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 ku(e,t.pattern);default:return null}}async function le(e,t){return Ou(e,t)}async function $u(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 On(e,r.parts);n.push(s)}else if(r.type==="TildeExpansion"){let s=await ln(e,r);n.push(Ps(s))}else n.push(await ln(e,r));return n.join("")}async function Tu(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(Yt(r.value));else if(r.type==="DoubleQuoted"){let s=await On(e,r.parts);n.push(Yt(s))}else n.push(await ln(e,r));return n.join("")}async function ay(e,t){let n=[];for(let r of t.parts)if(r.type==="SingleQuoted")n.push(Yt(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 On(e,r.parts);n.push(Yt(s))}else r.type==="Glob"?u6(r.pattern)?n.push(await p6(e,r.pattern)):n.push(ku(e,r.pattern)):r.type==="Literal"?n.push(r.value):n.push(await ln(e,r));return n.join("")}function da(e){for(let t of e)if(t.type==="BraceExpansion"||t.type==="DoubleQuoted"&&da(t.parts))return!0;return!1}async function ly(e,t,n={count:0}){if(n.count>Nu)return[[]];let r=[[]];for(let s of t)if(s.type==="BraceExpansion"){let i=[],o=!1,a="";for(let u of s.items)if(u.type==="Range"){let f=Au(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{o=!0,a=f.literal;break}}else{let f=await ly(e,u.word.parts,n);for(let p of f){n.count++;let h=[];for(let d of p)typeof d=="string"?h.push(d):h.push(await ln(e,d));i.push(h.join(""))}}if(o){for(let u of r)n.count++,u.push(a);continue}if(r.length*i.length>e.limits.maxBraceExpansionResults||n.count>Nu)return r;let c=[];for(let u of r)for(let f of i){if(n.count++,n.count>Nu)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 cy(e,t){let n=t.parts;if(!da(n))return[await le(e,t)];let r=await ly(e,n),s=[];for(let i of r){let o=[];for(let a of i)typeof a=="string"?o.push(a):o.push(await ln(e,a));s.push(d6(e,o.join("")))}return s}function ZS(){return{expandWordAsync:Ou,expandWordForGlobbing:ay,expandWordWithBracesAsync:cy,expandWordPartsAsync:On,expandPart:ln,expandParameterAsync:ha,hasBraceExpansion:da,evaluateArithmetic:re,buildIfsCharClassPattern:Fg,smartWordSplit:ty}}async function wn(e,t){return X6(e,t,ZS())}function KS(e){for(let t of e){if(t.type==="ParameterExpansion")return t.parameter;if(t.type==="Literal")return t.value}return""}function Ni(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 o of i.parts)if(o.type==="ParameterExpansion"&&o.parameter==="@"&&!o.operation)return!0}return!1}return r(t.parts)}async function Ii(e,t){if(Ni(e,t))return{error:`bash: $@: ambiguous redirect
789
+ `;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?"":br(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 s6(e,t,n,r,s,i,o=!1){if(e.coverage?.hit("bash:expansion:indirection"),We(e,t))return Zr(e,t)||"";let a=/^[a-zA-Z_][a-zA-Z0-9_]*\[([@*])\]$/.test(t);if(r){if(s.innerOp?.type==="UseAlternative")return"";throw new Pt(`\${!${t}}`)}let l=n;if(a&&(l===""||l.includes(" ")))throw new Pt(`\${!${t}}`);let c=l.match(/^[a-zA-Z_][a-zA-Z0-9_]*\[(.+)\]$/);if(c&&c[1].includes("~"))throw new Pt(`\${!${t}}`);if(s.innerOp){let u={type:"ParameterExpansion",parameter:l,operation:s.innerOp};return i(e,u,o)}return await ke(e,l)}function i6(e,t){e.coverage?.hit("bash:expansion:array_keys");let r=ce(e,t.array).map(([s])=>String(s));return t.star?r.join(ge(e.state.env)):r.join(" ")}function o6(e,t){e.coverage?.hit("bash:expansion:var_name_prefix");let n=Ls(e,t.prefix);return t.star?n.join(ge(e.state.env)):n.join(" ")}function a6(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[,o,a]=i,l=ce(e,o);if(l.length===0)return{isEmpty:!0,effectiveValue:""};if(a==="*"){let c=ge(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 l6=k(()=>{"use strict";Tt();ct();Ze();Ut();Ae();an();$n();_s();Fs();Kr();Cu();vu();Xt();ca()});function c6(e){return se(e.stdout)}function u6(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 f6(e,t){let n=1,r=t,s=!1,i=!1;for(;r<e.length&&n>0;){let o=e[r];if(o==="\\"&&!s&&r+1<e.length){r+=2;continue}if(o==="'"&&!i){s=!s,r++;continue}if(o==='"'&&!s){i=!i,r++;continue}if(!s&&!i){if(o==="(")n++;else if(o===")"&&(n--,n===0))return r}r++}return-1}async function ua(e,t){let n=new pe,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),o=e.state.cwd,a=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=o,e.state.suppressVerbose=a,e.state.lastExitCode=c,e.state.env.set("?",String(c)),l.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+l.stderr),e.state.bashPid=s,c6(l).replace(/\n+$/,"")}catch(l){if(e.state.env=i,e.state.cwd=o,e.state.bashPid=s,e.state.suppressVerbose=a,l instanceof X)throw l;return l instanceof we?(e.state.lastExitCode=l.exitCode,e.state.env.set("?",String(l.exitCode)),c6({stdout:l.stdout??"",stdoutKind:l.stdoutKind,stdoutEncoding:l.stdoutEncoding}).replace(/\n+$/,"")):""}}function ku(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 o=t.slice(r+1,i);n+=Yt(o),r=i+1;continue}}if(s==='"'){let i=-1,o=r+1;for(;o<t.length;){if(t[o]==="\\"){o+=2;continue}if(t[o]==='"'){i=o;break}o++}if(i!==-1){let a=t.slice(r+1,i),l=IS(e,a);n+=Yt(l),r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}function IS(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 o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}n+=s,r++}return n}async function p6(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 o=t.slice(r+1,i);n+=Yt(o),r=i+1;continue}}if(s==='"'){let i=-1,o=r+1;for(;o<t.length;){if(t[o]==="\\"){o+=2;continue}if(t[o]==='"'){i=o;break}o++}if(i!==-1){let a=t.slice(r+1,i),l=await $S(e,a);n+=Yt(l),r=i+1;continue}}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=f6(t,r+2);if(i!==-1){let o=t.slice(r+2,i),a=await ua(e,o);n+=a,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let o=t.slice(r+1,i),a=await ua(e,o);n+=a,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}async function $S(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=f6(t,r+2);if(i!==-1){let o=t.slice(r+2,i),a=await ua(e,o);n+=a,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let o=t.slice(r+1,i),a=await ua(e,o);n+=a,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}n+=s,r++}return n}var h6=k(()=>{"use strict";he();ct();Ae();Ds()});function d6(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 m6=k(()=>{"use strict"});async function TS(e,t,n,r){let s="";for(let i of t.parts)if(i.type==="Glob")s+=xe(i.pattern,!0,e.state.shoptOptions.extglob);else if(i.type==="Literal")s+=xe(i.value,!0,e.state.shoptOptions.extglob);else if(i.type==="SingleQuoted"||i.type==="Escaped")s+=Ce(i.value);else if(i.type==="DoubleQuoted"){let o=await n(e,i.parts);s+=Ce(o)}else if(i.type==="ParameterExpansion"){let o=await r(e,i);s+=xe(o,!0,e.state.shoptOptions.extglob)}else{let o=await r(e,i);s+=Ce(o)}return s}async function g6(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],o=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let a=o[1],l=o[2]==="*",c=i.operation,u=ce(e,a),f=u.map(([,g])=>g);if(u.length===0){let g=e.state.env.get(a);g!==void 0&&f.push(g)}if(f.length===0)return{values:[],quoted:!0};let p="";c.pattern&&(p=await TS(e,c.pattern,n,r));let h=c.replacement?await n(e,c.replacement.parts):"",d=p;c.anchor==="start"?d=`^${p}`:c.anchor==="end"&&(d=`${p}$`);let m=[];try{let g=Q(d,c.all?"g":"");for(let y of f)m.push(g.replace(y,h))}catch{m.push(...f)}if(l){let g=ge(e.state.env);return{values:[m.join(g)],quoted:!0}}return{values:m,quoted:!0}}async function y6(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],o=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let a=o[1],l=o[2]==="*",c=i.operation,u=ce(e,a),f=u.map(([,m])=>m);if(u.length===0){let m=e.state.env.get(a);m!==void 0&&f.push(m)}if(f.length===0)return{values:[],quoted:!0};let p="",h=e.state.shoptOptions.extglob;if(c.pattern)for(let m of c.pattern.parts)if(m.type==="Glob")p+=xe(m.pattern,c.greedy,h);else if(m.type==="Literal")p+=xe(m.value,c.greedy,h);else if(m.type==="SingleQuoted"||m.type==="Escaped")p+=Ce(m.value);else if(m.type==="DoubleQuoted"){let g=await n(e,m.parts);p+=Ce(g)}else if(m.type==="ParameterExpansion"){let g=await r(e,m);p+=xe(g,c.greedy,h)}else{let g=await r(e,m);p+=Ce(g)}let d=[];for(let m of f)d.push(or(m,p,c.side,c.greedy));if(l){let m=ge(e.state.env);return{values:[d.join(m)],quoted:!0}}return{values:d,quoted:!0}}var w6=k(()=>{"use strict";Ze();an();_s();Fs();Kr();Xt()});async function b6(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_]*)\[([@*])\]$/),o,a=!1;if(i){let l=i[1];a=i[2]==="*";let c=ce(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"?o=u&&!(p&&f):o=!u||p&&f,!o){if(c.length>0){let d=c.map(([,m])=>m);if(a){let m=ge(e.state.env);return{values:[d.join(m)],quoted:!0}}return{values:d,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 Tn(e,l),u=await ke(e,l,!1),f=u==="",p=s.checkEmpty??!1;if(s.type==="UseAlternative"?o=c&&!(p&&f):o=!c||p&&f,!o)return{values:[u],quoted:!0}}if(o&&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=ce(e,c);if(f.length>0){let h=f.map(([,d])=>d);if(u||a){let d=ge(e.state.env);return{values:[h.join(d)],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 x6(e,t,n,r,s){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0],o=-1,a="",l=!1,c=null;for(let m=0;m<i.parts.length;m++){let g=i.parts[m];if(g.type==="ParameterExpansion"&&(g.operation?.type==="PatternRemoval"||g.operation?.type==="PatternReplacement")){let y=g.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(y){o=m,a=y[1],l=y[2]==="*",c=g.operation;break}}}if(o===-1||o===0&&o===i.parts.length-1)return null;let u="";for(let m=0;m<o;m++)u+=await r(e,i.parts[m]);let f="";for(let m=o+1;m<i.parts.length;m++)f+=await r(e,i.parts[m]);let p=ce(e,a),h=p.map(([,m])=>m);if(p.length===0){let m=e.state.env.get(a);if(m!==void 0)h=[m];else{if(l)return{values:[u+f],quoted:!0};let g=u+f;return{values:g?[g]:[],quoted:!0}}}if(c?.type==="PatternRemoval"){let m=c,g="",y=e.state.shoptOptions.extglob;if(m.pattern)for(let w of m.pattern.parts)if(w.type==="Glob")g+=xe(w.pattern,m.greedy,y);else if(w.type==="Literal")g+=xe(w.value,m.greedy,y);else if(w.type==="SingleQuoted"||w.type==="Escaped")g+=Ce(w.value);else if(w.type==="DoubleQuoted"){let b=await s(e,w.parts);g+=Ce(b)}else if(w.type==="ParameterExpansion"){let b=await r(e,w);g+=xe(b,m.greedy,y)}else{let b=await r(e,w);g+=Ce(b)}h=h.map(w=>or(w,g,m.side,m.greedy))}else if(c?.type==="PatternReplacement"){let m=c,g="";if(m.pattern)for(let b of m.pattern.parts)if(b.type==="Glob")g+=xe(b.pattern,!0,e.state.shoptOptions.extglob);else if(b.type==="Literal")g+=xe(b.value,!0,e.state.shoptOptions.extglob);else if(b.type==="SingleQuoted"||b.type==="Escaped")g+=Ce(b.value);else if(b.type==="DoubleQuoted"){let x=await s(e,b.parts);g+=Ce(x)}else if(b.type==="ParameterExpansion"){let x=await r(e,b);g+=xe(x,!0,e.state.shoptOptions.extglob)}else{let x=await r(e,b);g+=Ce(x)}let y=m.replacement?await s(e,m.replacement.parts):"",w=g;m.anchor==="start"?w=`^${g}`:m.anchor==="end"&&(w=`${g}$`);try{let b=Q(w,m.all?"g":"");h=h.map(x=>b.replace(x,y))}catch{}}if(l){let m=ge(e.state.env);return{values:[u+h.join(m)+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 E6(e,t,n,r){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o="",a=!1;for(let h=0;h<s.parts.length;h++){let d=s.parts[h];if(d.type==="ParameterExpansion"&&!d.operation){let m=d.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(m){i=h,o=m[1],a=m[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=ce(e,o),f=u.map(([,h])=>h);if(u.length===0){let h=e.state.env.get(o);if(h!==void 0)return{values:[l+h+c],quoted:!0};if(a)return{values:[l+c],quoted:!0};let d=l+c;return{values:d?[d]:[],quoted:!0}}if(a){let h=ge(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 A6=k(()=>{"use strict";Ze();an();_s();Fs();Kr();Xt()});async function S6(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 o=i[1],a=i[2]==="*",l=s.operation;if(e.state.associativeArrays?.has(o))throw new we(1,"",`bash: \${${o}[@]: 0: 3}: bad substitution
790
+ `);let c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=ce(e,o),p=0;if(c<0){if(f.length>0){let d=f[f.length-1][0],g=(typeof d=="number"?d:0)+1+c;if(g<0)return{values:[],quoted:!0};p=f.findIndex(([y])=>typeof y=="number"&&y>=g),p<0&&(p=f.length)}}else p=f.findIndex(([d])=>typeof d=="number"&&d>=c),p<0&&(p=f.length);let h;if(u!==void 0){if(u<0)throw new Le(`${o}[@]: substring expression < 0`);h=f.slice(p,p+u).map(([,d])=>d)}else h=f.slice(p).map(([,d])=>d);if(h.length===0)return{values:[],quoted:!0};if(a){let d=ge(e.state.env);return{values:[h.join(d)],quoted:!0}}return{values:h,quoted:!0}}function C6(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],o=s[2]==="*",a=r.operation,l=ce(e,i);if(l.length===0){let f=e.state.env.get(i);if(f!==void 0){let p;switch(a.operator){case"a":p="";break;case"P":p=ki(e,f);break;case"Q":p=br(f);break;default:p=f}return{values:[p],quoted:!0}}return o?{values:[""],quoted:!0}:{values:[],quoted:!0}}let c=Er(e,i),u;switch(a.operator){case"a":u=l.map(()=>c);break;case"P":u=l.map(([,f])=>ki(e,f));break;case"Q":u=l.map(([,f])=>br(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(o){let f=ge(e.state.env);return{values:[u.join(f)],quoted:!0}}return{values:u,quoted:!0}}var v6=k(()=>{"use strict";Ae();an();Cu();vu();Xt();ca()});function k6(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(We(e,i)){let l=Zr(e,i);if(l?.endsWith("[@]")||l?.endsWith("[*]"))return{values:[],quoted:!0}}let o=ce(e,i);if(o.length>0)return{values:o.map(([,l])=>l),quoted:!0};let a=e.state.env.get(i);return a!==void 0?{values:[a],quoted:!0}:{values:[],quoted:!0}}function N6(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)||!We(e,s))return null;let i=Zr(e,s);if(!i)return null;let o=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!o)return null;let a=o[1],l=ce(e,a);if(l.length>0)return{values:l.map(([,u])=>u),quoted:!0};let c=e.state.env.get(a);return c!==void 0?{values:[c],quoted:!0}:{values:[],quoted:!0}}var I6=k(()=>{"use strict";$n();Xt()});async function $6(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 o=i.parts[0],a=o.operation,l=await ke(e,o.parameter),c=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c){if(!a.innerOp&&(l==="@"||l==="*")){let d=Number.parseInt(e.state.env.get("#")||"0",10),m=[];for(let g=1;g<=d;g++)m.push(e.state.env.get(String(g))||"");return l==="*"?{values:[m.join(ge(e.state.env))],quoted:!0}:{values:m,quoted:!0}}return null}let u=c[1],f=c[2]==="*",p=ce(e,u);if(a.innerOp){if(a.innerOp.type==="Substring")return OS(e,p,u,f,a.innerOp);if(a.innerOp.type==="DefaultValue"||a.innerOp.type==="UseAlternative"||a.innerOp.type==="AssignDefault"||a.innerOp.type==="ErrorIfUnset")return RS(e,p,u,f,a.innerOp,s);if(a.innerOp.type==="Transform"&&a.innerOp.operator==="a"){let m=Er(e,u),g=p.map(()=>m);return f?{values:[g.join(ge(e.state.env))],quoted:!0}:{values:g,quoted:!0}}let d=[];for(let[,m]of p){let g={type:"ParameterExpansion",parameter:"_indirect_elem_",operation:a.innerOp},y=e.state.env.get("_indirect_elem_");e.state.env.set("_indirect_elem_",m);try{let w=await r(e,g,!0);d.push(w)}finally{y!==void 0?e.state.env.set("_indirect_elem_",y):e.state.env.delete("_indirect_elem_")}}return f?{values:[d.join(ge(e.state.env))],quoted:!0}:{values:d,quoted:!0}}if(p.length>0){let d=p.map(([,m])=>m);return f?{values:[d.join(ge(e.state.env))],quoted:!0}:{values:d,quoted:!0}}let h=e.state.env.get(u);return h!==void 0?{values:[h],quoted:!0}:{values:[],quoted:!0}}async function OS(e,t,n,r,s){let i=s.offset?await re(e,s.offset.expression):0,o=s.length?await re(e,s.length.expression):void 0,a=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(a=t.findIndex(([h])=>typeof h=="number"&&h>=p),a<0)return{values:[],quoted:!0}}}else if(a=t.findIndex(([u])=>typeof u=="number"&&u>=i),a<0)return{values:[],quoted:!0};let l;if(o!==void 0){if(o<0)throw new Le(`${n}[@]: substring expression < 0`);l=t.slice(a,a+o)}else l=t.slice(a);let c=l.map(([,u])=>u);return r?{values:[c.join(ge(e.state.env))],quoted:!0}:{values:c,quoted:!0}}async function RS(e,t,n,r,s,i){let o=s.checkEmpty??!1,a=t.map(([,u])=>u),l=t.length===0,c=t.length===0;if(s.type==="UseAlternative")return!c&&!(o&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:{values:[],quoted:!0};if(s.type==="DefaultValue")return(c||o&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:r?{values:[a.join(ge(e.state.env))],quoted:!0}:{values:a,quoted:!0};if(s.type==="AssignDefault"){if((c||o&&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:[a.join(ge(e.state.env))],quoted:!0}:{values:a,quoted:!0}}return r?{values:[a.join(ge(e.state.env))],quoted:!0}:{values:a,quoted:!0}}async function T6(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 o=i.parts[0],l=(await ke(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!l)return null;let c=await Tn(e,n.parameter),u=await ke(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],d=l[2]==="*",m=ce(e,h);if(m.length>0){let y=m.map(([,w])=>w);return d?{values:[y.join(ge(e.state.env))],quoted:!0}:{values:y,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 O6(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 o=i.parts[0];if(o.parts.length!==1||o.parts[0].type!=="ParameterExpansion"||o.parts[0].operation?.type!=="Indirection")return null;let a=o.parts[0],c=(await ke(e,a.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c)return null;let u=await ke(e,n.parameter),f=await Tn(e,n.parameter),p=u==="",h=s.checkEmpty??!1,d;if(s.type==="UseAlternative"?d=f&&!(h&&p):d=!f||h&&p,d){let m=c[1],g=c[2]==="*",y=ce(e,m);if(y.length>0){let b=y.map(([,x])=>x);return g?{values:[b.join(ge(e.state.env))],quoted:!0}:{values:b,quoted:!0}}let w=e.state.env.get(m);return w!==void 0?{values:[w],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}var R6=k(()=>{"use strict";Ut();Ae();an();Xt();ca()});function P6(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 D6(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let w=0;w<s.parts.length;w++){let b=s.parts[w];if(b.type==="ParameterExpansion"&&(b.parameter==="@"||b.parameter==="*")&&b.operation?.type==="Substring"){i=w,o=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 w=1;w<=f;w++)p.push(e.state.env.get(String(w))||"");let h=e.state.env.get("0")||"bash",d;if(c<=0){let w=[h,...p],b=w.length+c;if(b<0)d=[];else{let x=c<0?b:0;if(u!==void 0){let S=u<0?w.length+u:x+u;d=w.slice(x,Math.max(x,S))}else d=w.slice(x)}}else{let w=c-1;if(w>=p.length)d=[];else if(u!==void 0){let b=u<0?p.length+u:w+u;d=p.slice(w,Math.max(w,b))}else d=p.slice(w)}let m="";for(let w=0;w<i;w++)m+=await r(e,s.parts[w]);let g="";for(let w=i+1;w<s.parts.length;w++)g+=await r(e,s.parts[w]);if(d.length===0){let w=m+g;return{values:w?[w]:[],quoted:!0}}if(o){let w=ge(e.state.env);return{values:[m+d.join(w)+g],quoted:!0}}return d.length===1?{values:[m+d[0]+g],quoted:!0}:{values:[m+d[0],...d.slice(1,-1),d[d.length-1]+g],quoted:!0}}async function _6(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let y=0;y<s.parts.length;y++){let w=s.parts[y];if(w.type==="ParameterExpansion"&&(w.parameter==="@"||w.parameter==="*")&&w.operation?.type==="PatternReplacement"){i=y,o=w.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=P6(e),u="";for(let y=0;y<i;y++)u+=await n(e,s.parts[y]);let f="";for(let y=i+1;y<s.parts.length;y++)f+=await n(e,s.parts[y]);if(c.length===0){let y=u+f;return{values:y?[y]:[],quoted:!0}}let p="";if(l.pattern)for(let y of l.pattern.parts)if(y.type==="Glob")p+=xe(y.pattern,!0,e.state.shoptOptions.extglob);else if(y.type==="Literal")p+=xe(y.value,!0,e.state.shoptOptions.extglob);else if(y.type==="SingleQuoted"||y.type==="Escaped")p+=Ce(y.value);else if(y.type==="DoubleQuoted"){let w=await r(e,y.parts);p+=Ce(w)}else if(y.type==="ParameterExpansion"){let w=await n(e,y);p+=xe(w,!0,e.state.shoptOptions.extglob)}else{let w=await n(e,y);p+=Ce(w)}let h=l.replacement?await r(e,l.replacement.parts):"",d=p;l.anchor==="start"?d=`^${p}`:l.anchor==="end"&&(d=`${p}$`);let m=[];try{let y=Q(d,l.all?"g":"");for(let w of c)m.push(y.replace(w,h))}catch{m.push(...c)}if(o){let y=ge(e.state.env);return{values:[u+m.join(y)+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 F6(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let g=0;g<s.parts.length;g++){let y=s.parts[g];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="PatternRemoval"){i=g,o=y.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=P6(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+=xe(g.pattern,l.greedy,h);else if(g.type==="Literal")p+=xe(g.value,l.greedy,h);else if(g.type==="SingleQuoted"||g.type==="Escaped")p+=Ce(g.value);else if(g.type==="DoubleQuoted"){let y=await r(e,g.parts);p+=Ce(y)}else if(g.type==="ParameterExpansion"){let y=await n(e,g);p+=xe(y,l.greedy,h)}else{let y=await n(e,g);p+=Ce(y)}let d=[];for(let g of c)d.push(or(g,p,l.side,l.greedy));if(o){let g=ge(e.state.env);return{values:[u+d.join(g)+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 L6(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 o=r.parts[s];if(o.type==="ParameterExpansion"&&o.operation)return null;let a=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(a===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<=a;p++)u.push(e.state.env.get(String(p))||"");if(i){let p=ge(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 M6=k(()=>{"use strict";Ze();an();_s();Fs();Kr()});function PS(e){return new wr(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 fa(e,t){if(e.state.options.noglob)return t;let n=PS(e),r=[];for(let s of t)if(qn(s,e.state.shoptOptions.extglob)){let i=await n.expand(s);if(i.length>0)r.push(...i);else{if(n.hasFailglob())throw new Ln(s);n.hasNullglob()||r.push(s)}}else r.push(s);return r}async function U6(e,t,n,r){let s=-1,i="",o=!1;for(let w=0;w<t.length;w++){let b=t[w];if(b.type==="ParameterExpansion"&&b.operation?.type==="PatternReplacement"){let x=b.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(x){s=w,i=x[1],o=x[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=ce(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="";if(l.pattern)for(let w of l.pattern.parts)if(w.type==="Glob")f+=xe(w.pattern,!0,e.state.shoptOptions.extglob);else if(w.type==="Literal")f+=xe(w.value,!0,e.state.shoptOptions.extglob);else if(w.type==="SingleQuoted"||w.type==="Escaped")f+=Ce(w.value);else if(w.type==="DoubleQuoted"){let b=await n(e,w.parts);f+=Ce(b)}else if(w.type==="ParameterExpansion"){let b=await r(e,w);f+=xe(b,!0,e.state.shoptOptions.extglob)}else{let b=await r(e,w);f+=Ce(b)}let p=l.replacement?await n(e,l.replacement.parts):"",h=f;l.anchor==="start"?h=`^${f}`:l.anchor==="end"&&(h=`${f}$`);let d=[];try{let w=Q(h,l.all?"g":"");for(let b of u)d.push(w.replace(b,p))}catch{d.push(...u)}let m=yt(e.state.env),g=kt(e.state.env);if(o){let w=ge(e.state.env),b=d.join(w);return g?{values:b?[b]:[],quoted:!1}:{values:Ve(b,m),quoted:!1}}if(g)return{values:d,quoted:!1};let y=[];for(let w of d)w===""?y.push(""):y.push(...Ve(w,m));return{values:y,quoted:!1}}async function B6(e,t,n,r){let s=-1,i="",o=!1;for(let y=0;y<t.length;y++){let w=t[y];if(w.type==="ParameterExpansion"&&w.operation?.type==="PatternRemoval"){let b=w.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(b){s=y,i=b[1],o=b[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=ce(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="",p=e.state.shoptOptions.extglob;if(l.pattern)for(let y of l.pattern.parts)if(y.type==="Glob")f+=xe(y.pattern,l.greedy,p);else if(y.type==="Literal")f+=xe(y.value,l.greedy,p);else if(y.type==="SingleQuoted"||y.type==="Escaped")f+=Ce(y.value);else if(y.type==="DoubleQuoted"){let w=await n(e,y.parts);f+=Ce(w)}else if(y.type==="ParameterExpansion"){let w=await r(e,y);f+=xe(w,l.greedy,p)}else{let w=await r(e,y);f+=Ce(w)}let h=[];for(let y of u)h.push(or(y,f,l.side,l.greedy));let d=yt(e.state.env),m=kt(e.state.env);if(o){let y=ge(e.state.env),w=h.join(y);return m?{values:w?[w]:[],quoted:!1}:{values:Ve(w,d),quoted:!1}}if(m)return{values:h,quoted:!1};let g=[];for(let y of h)y===""?g.push(""):g.push(...Ve(y,d));return{values:g,quoted:!1}}async function W6(e,t,n,r){let s=-1,i=!1;for(let g=0;g<t.length;g++){let y=t[g];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="PatternRemoval"){s=g,i=y.parameter==="*";break}}if(s===-1)return null;let a=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(a.pattern)for(let g of a.pattern.parts)if(g.type==="Glob")u+=xe(g.pattern,a.greedy,f);else if(g.type==="Literal")u+=xe(g.value,a.greedy,f);else if(g.type==="SingleQuoted"||g.type==="Escaped")u+=Ce(g.value);else if(g.type==="DoubleQuoted"){let y=await n(e,g.parts);u+=Ce(y)}else if(g.type==="ParameterExpansion"){let y=await r(e,g);u+=xe(y,a.greedy,f)}else{let y=await r(e,g);u+=Ce(y)}let p=[];for(let g of c)p.push(or(g,u,a.side,a.greedy));let h=yt(e.state.env),d=kt(e.state.env);if(i){let g=ge(e.state.env),y=p.join(g);return d?{values:y?[y]:[],quoted:!1}:{values:Ve(y,h),quoted:!1}}if(d)return{values:p,quoted:!1};let m=[];for(let g of p)g===""?m.push(""):m.push(...Ve(g,h));return{values:m,quoted:!1}}async function z6(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 a=t[s].operation,l=a.offset?await n(e,a.offset.expression):0,c=a.length?await n(e,a.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 v=c<0?b.length+c:S+c;h=b.slice(S,Math.max(S,v))}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 d="";for(let b=0;b<s;b++)d+=await r(e,t[b]);let m="";for(let b=s+1;b<t.length;b++)m+=await r(e,t[b]);let g=yt(e.state.env),y=kt(e.state.env);if(h.length===0){let b=d+m;return b?y?{values:[b],quoted:!1}:{values:Ve(b,g),quoted:!1}:{values:[],quoted:!1}}let w;if(i){let b=ge(e.state.env),x=d+h.join(b)+m;y?w=x?[x]:[]:w=Ve(x,g)}else if(y)h.length===1?w=[d+h[0]+m]:w=[d+h[0],...h.slice(1,-1),h[h.length-1]+m];else{w=[];for(let b=0;b<h.length;b++){let x=h[b];if(b===0&&(x=d+x),b===h.length-1&&(x=x+m),x==="")w.push("");else{let S=Ve(x,g);w.push(...S)}}}return{values:await fa(e,w),quoted:!1}}async function H6(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=yt(e.state.env),o=kt(e.state.env),a=sa(e.state.env),l;if(n)if(o)l=s.filter(c=>c!=="");else{let c=ge(e.state.env),u=s.join(c);l=Ve(u,i)}else if(o)l=s.filter(c=>c!=="");else if(a){l=[];for(let c of s){if(c==="")continue;let u=Ve(c,i);l.push(...u)}}else{l=[];for(let c of s)if(c==="")l.push("");else{let u=Ve(c,i);l.push(...u)}for(;l.length>0&&l[l.length-1]==="";)l.pop()}return{values:await fa(e,l),quoted:!1}}async function j6(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=ce(e,r),o;if(i.length===0){let f=e.state.env.get(r);if(f!==void 0)o=[f];else return{values:[],quoted:!1}}else o=i.map(([,f])=>f);let a=yt(e.state.env),l=kt(e.state.env),c=sa(e.state.env),u;if(s)if(l)u=o.filter(f=>f!=="");else{let f=ge(e.state.env),p=o.join(f);u=Ve(p,a)}else if(l)u=o.filter(f=>f!=="");else if(c){u=[];for(let f of o){if(f==="")continue;let p=Ve(f,a);u.push(...p)}}else{u=[];for(let f of o)if(f==="")u.push("");else{let p=Ve(f,a);u.push(...p)}for(;u.length>0&&u[u.length-1]==="";)u.pop()}return{values:await fa(e,u),quoted:!1}}function G6(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="VarNamePrefix")return null;let n=t[0].operation,r=Ls(e,n.prefix);if(r.length===0)return{values:[],quoted:!1};let s=yt(e.state.env),i=kt(e.state.env),o;if(n.star)if(i)o=r;else{let a=ge(e.state.env),l=r.join(a);o=Ve(l,s)}else if(i)o=r;else{o=[];for(let a of r){let l=Ve(a,s);o.push(...l)}}return{values:o,quoted:!1}}function V6(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="ArrayKeys")return null;let n=t[0].operation,s=ce(e,n.array).map(([l])=>String(l));if(s.length===0)return{values:[],quoted:!1};let i=yt(e.state.env),o=kt(e.state.env),a;if(n.star)if(o)a=s;else{let l=ge(e.state.env),c=s.join(l);a=Ve(c,i)}else if(o)a=s;else{a=[];for(let l of s){let c=Ve(l,i);a.push(...c)}}return{values:a,quoted:!1}}async function q6(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 o="";for(let p=0;p<r;p++)o+=await n(e,t[p]);let a="";for(let p=r+1;p<t.length;p++)a+=await n(e,t[p]);let l=yt(e.state.env),c=kt(e.state.env),u=sa(e.state.env);if(s===0){let p=o+a;return{values:p?[p]:[],quoted:!1}}let f;{let p=[];for(let h=0;h<i.length;h++){let d=i[h];h===0&&(d=o+d),h===i.length-1&&(d=d+a),p.push(d)}if(c)f=p.filter(h=>h!=="");else if(u){f=[];for(let h of p){if(h==="")continue;let d=Ve(h,l);f.push(...d)}}else{f=[];for(let h of p)if(h==="")f.push("");else{let d=Ve(h,l);f.push(...d)}for(;f.length>0&&f[f.length-1]==="";)f.pop()}}return f.length===0?{values:[],quoted:!1}:{values:await fa(e,f),quoted:!1}}var Z6=k(()=>{"use strict";Ze();ta();Ae();an();_s();Ds();Fs();Kr();Xt()});async function X6(e,t,n){e.coverage?.hit("bash:expansion:word_glob");let r=t.parts,{hasQuoted:s,hasCommandSub:i,hasArrayVar:o,hasArrayAtExpansion:a,hasParamExpansion:l,hasVarNamePrefixExpansion:c,hasIndirection:u}=vi(r),p=n.hasBraceExpansion(r)?await n.expandWordWithBracesAsync(e,t):null;if(p&&p.length>1)return DS(e,p,s);let h=await _S(e,r,a,c,u,n);if(h!==null)return h;let d=await LS(e,r,n);if(d!==null)return d;let m=await MS(e,r,n);if(m!==null)return m;let g=await BS(e,r,n.expandPart);if(g!==null)return Q6(e,g);if((i||o||l)&&!kt(e.state.env)){let w=yt(e.state.env),b=n.buildIfsCharClassPattern(w),x=await n.smartWordSplit(e,r,w,b,n.expandPart);return Q6(e,x)}let y=await n.expandWordAsync(e,t);return WS(e,t,r,y,s,n.expandWordForGlobbing)}async function DS(e,t,n){let r=[];for(let s of t)if(!(!n&&s===""))if(!n&&!e.state.options.noglob&&qn(s,e.state.shoptOptions.extglob)){let i=await pa(e,s);r.push(...i)}else r.push(s);return{values:r,quoted:!1}}async function _S(e,t,n,r,s,i){if(n){let o=k6(e,t);if(o!==null)return o}{let o=N6(e,t);if(o!==null)return o}{let o=await b6(e,t);if(o!==null)return o}{let o=await x6(e,t,n,i.expandPart,i.expandWordPartsAsync);if(o!==null)return o}{let o=await E6(e,t,n,i.expandPart);if(o!==null)return o}{let o=await S6(e,t,i.evaluateArithmetic);if(o!==null)return o}{let o=C6(e,t);if(o!==null)return o}{let o=await g6(e,t,i.expandWordPartsAsync,i.expandPart);if(o!==null)return o}{let o=await y6(e,t,i.expandWordPartsAsync,i.expandPart);if(o!==null)return o}if(r&&t.length===1&&t[0].type==="DoubleQuoted"){let o=FS(e,t);if(o!==null)return o}{let o=await $6(e,t,s,i.expandParameterAsync,i.expandWordPartsAsync);if(o!==null)return o}{let o=await T6(e,t);if(o!==null)return o}{let o=await O6(e,t);if(o!==null)return o}return null}function FS(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=Ls(e,r.prefix);return r.star?{values:[s.join(ge(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=ce(e,r.array).map(([o])=>String(o));return r.star?{values:[i.join(ge(e.state.env))],quoted:!0}:{values:i,quoted:!0}}return null}async function LS(e,t,n){{let r=await D6(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await _6(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await F6(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await L6(e,t,n.expandPart);if(r!==null)return r}return null}async function MS(e,t,n){{let r=await U6(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await B6(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await W6(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await z6(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await H6(e,t);if(r!==null)return r}{let r=await j6(e,t);if(r!==null)return r}{let r=G6(e,t);if(r!==null)return r}{let r=V6(e,t);if(r!==null)return r}{let r=await q6(e,t,n.expandPart);if(r!==null)return r}return null}function K6(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 US(e,t,n,r){let s="";for(let a=0;a<n.atIndex;a++)s+=await r(e,t.parts[a]);let i="";for(let a=n.atIndex+1;a<t.parts.length;a++)i+=await r(e,t.parts[a]);let o;if(n.type==="array"){if(o=ce(e,n.name).map(([,l])=>l),o.length===0){let l=e.state.env.get(n.name);l!==void 0&&(o=[l])}}else{let a=Number.parseInt(e.state.env.get("#")||"0",10);o=[];for(let l=1;l<=a;l++)o.push(e.state.env.get(String(l))||"")}if(n.isStar){let a=ge(e.state.env),l=o.join(a);return[s+l+i]}if(o.length===0){let a=s+i;return a?[a]:[]}return o.length===1?[s+o[0]+i]:[s+o[0],...o.slice(1,-1),o[o.length-1]+i]}async function BS(e,t,n){if(t.length<2)return null;let r=!1;for(let l of t)if(K6(l)){r=!0;break}if(!r)return null;let s=yt(e.state.env),i=kt(e.state.env),o=[];for(let l of t){let c=K6(l);if(c&&l.type==="DoubleQuoted"){let u=await US(e,l,c,n);o.push(u)}else if(l.type==="DoubleQuoted"||l.type==="SingleQuoted"){let u=await n(e,l);o.push([u])}else if(l.type==="Literal")o.push([l.value]);else if(l.type==="ParameterExpansion"){let u=await n(e,l);if(i)o.push(u?[u]:[]);else{let f=Ve(u,s);o.push(f)}}else{let u=await n(e,l);if(i)o.push(u?[u]:[]);else{let f=Ve(u,s);o.push(f)}}}let a=[];for(let l of o)if(l.length!==0)if(a.length===0)a.push(...l);else{let c=a.length-1;a[c]=a[c]+l[0];for(let u=1;u<l.length;u++)a.push(l[u])}return a}async function Q6(e,t){if(e.state.options.noglob)return{values:t,quoted:!1};let n=[];for(let r of t)if(qn(r,e.state.shoptOptions.extglob)){let s=await pa(e,r);n.push(...s)}else n.push(r);return{values:n,quoted:!1}}async function pa(e,t){let n=new wr(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 Ln(t);return n.hasNullglob()?[]:[t]}async function WS(e,t,n,r,s,i){let o=n.some(a=>a.type==="Glob");if(!e.state.options.noglob&&o){let a=await i(e,t);if(qn(a,e.state.shoptOptions.extglob)){let c=await pa(e,a);if(c.length>0&&c[0]!==a)return{values:c,quoted:!1};if(c.length===0)return{values:[],quoted:!1}}let l=Su(r);if(!kt(e.state.env)){let c=yt(e.state.env);return{values:Ve(l,c),quoted:!1}}return{values:[l],quoted:!1}}if(!s&&!e.state.options.noglob&&qn(r,e.state.shoptOptions.extglob)){let a=await i(e,t);if(qn(a,e.state.shoptOptions.extglob)){let l=await pa(e,a);if(l.length>0&&l[0]!==a)return{values:l,quoted:!1}}}if(r===""&&!s)return{values:[],quoted:!1};if(o&&!s){let a=Su(r);if(!kt(e.state.env)){let l=yt(e.state.env);return{values:Ve(a,l),quoted:!1}}return{values:[a],quoted:!1}}return{values:[r],quoted:s}}var Y6=k(()=>{"use strict";ta();Ae();an();na();w6();A6();v6();I6();Ds();R6();Kr();M6();Z6();Xt()});async function ey(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 Tn(e,t.parameter),o=await ke(e,t.parameter,!1)==="",a=n.checkEmpty??!1,l;return n.type==="UseAlternative"?l=s&&!(a&&o):l=!s||a&&o,l?r.parts:null}function zS(e){return e.type==="SingleQuoted"?!0:e.type==="DoubleQuoted"?e.parts.every(n=>n.type==="Literal"):!1}async function HS(e,t){if(t.type!=="ParameterExpansion")return null;let n=await ey(e,t);if(!n||n.length<=1)return null;let r=n.some(i=>zS(i)),s=n.some(i=>i.type==="Literal"||i.type==="ParameterExpansion"||i.type==="CommandSubstitution"||i.type==="ArithmeticExpansion");return r&&s?n:null}function jS(e){return e.type==="DoubleQuoted"||e.type==="SingleQuoted"||e.type==="Literal"?!1:e.type==="Glob"?gu(e.pattern):!(!(e.type==="ParameterExpansion"||e.type==="CommandSubstitution"||e.type==="ArithmeticExpansion")||e.type==="ParameterExpansion"&&_g(e))}async function ty(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 ey(e,p);if(h&&h.length>0&&h.length>1&&h.some(m=>m.type==="DoubleQuoted"||m.type==="SingleQuoted")&&h.some(m=>m.type==="Literal"||m.type==="ParameterExpansion"||m.type==="CommandSubstitution"||m.type==="ArithmeticExpansion"))return J6(e,h,n,r,s)}let i=[],o=!1;for(let p of t){let h=jS(p),d=p.type==="DoubleQuoted"||p.type==="SingleQuoted",m=h?await HS(e,p):null,g=await s(e,p);i.push({value:g,isSplittable:h,isQuoted:d,mixedDefaultParts:m??void 0}),h&&(o=!0)}if(!o){let p=i.map(h=>h.value).join("");return p?[p]:[]}let a=[],l="",c=!1,u=!1,f=!1;for(let p of i)if(!p.isSplittable)u?p.isQuoted&&p.value===""?(l!==""&&a.push(l),a.push(""),c=!0,l="",u=!1,f=!0):p.value!==""?(l!==""&&a.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 J6(e,p.mixedDefaultParts,n,r,s);if(h.length!==0)if(h.length===1)l+=h[0],c=!0;else{l+=h[0],a.push(l),c=!0;for(let d=1;d<h.length-1;d++)a.push(h[d]);l=h[h.length-1]}u=!1,f=!1}else{let{words:h,hadLeadingDelimiter:d,hadTrailingDelimiter:m}=ia(p.value,n);if(f&&d&&l===""&&(a.push(""),c=!0),h.length===0)m&&(u=!0);else if(h.length===1)l+=h[0],c=!0,u=m;else{l+=h[0],a.push(l),c=!0;for(let g=1;g<h.length-1;g++)a.push(h[g]);l=h[h.length-1],u=m}f=!1}return l!==""?a.push(l):a.length===0&&c&&a.push(""),a}function GS(e,t){return e.length>0&&t.includes(e[0])}async function J6(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 o=[],a="",l=!1,c=!1;for(let u of i)if(!u.isSplittable)c&&u.value!==""?(a!==""&&o.push(a),a=u.value,c=!1):a+=u.value;else{GS(u.value,n)&&a!==""&&(o.push(a),a="",l=!0);let{words:p,hadTrailingDelimiter:h}=ia(u.value,n);if(p.length===0)h&&(c=!0);else if(p.length===1)a+=p[0],l=!0,c=h;else{a+=p[0],o.push(a),l=!0;for(let d=1;d<p.length-1;d++)o.push(p[d]);a=p[p.length-1],c=h}}return a!==""?o.push(a):o.length===0&&l&&o.push(""),o}var ny=k(()=>{"use strict";Xt();an();na()});function ry(e){switch(e.type){case"Literal":return e.value;case"SingleQuoted":return e.value;case"Escaped":return e.value;default:return null}}function sy(e){switch(e.type){case"SingleQuoted":case"Escaped":case"DoubleQuoted":return!0;case"Literal":return e.value==="";default:return!1}}var iy=k(()=>{"use strict"});var Ru={};ee(Ru,{escapeGlobChars:()=>Yt,escapeRegexChars:()=>Ps,expandRedirectTarget:()=>Ii,expandWord:()=>le,expandWordForPattern:()=>Tu,expandWordForRegex:()=>$u,expandWordWithGlob:()=>wn,getArrayElements:()=>ce,getVariable:()=>ke,hasQuotedMultiValueAt:()=>Ni,isArray:()=>ir,isWordFullyQuoted:()=>Iu});function Ar(e,t,n){if(e.length>t)throw new X(`${n}: string length limit exceeded (${t} bytes)`,"string_length")}function oy(e){return se(e.stdout)}async function Rn(e,t,n=!1){let r=[];for(let s of t)r.push(await ln(e,s,n));return r.join("")}function VS(e){return sy(e)}function Iu(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!VS(t))return!1;return!0}function qS(e,t,n=!1){let r=ry(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 ku(e,t.pattern);default:return null}}async function le(e,t){return Ou(e,t)}async function $u(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 Rn(e,r.parts);n.push(s)}else if(r.type==="TildeExpansion"){let s=await ln(e,r);n.push(Ps(s))}else n.push(await ln(e,r));return n.join("")}async function Tu(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(Yt(r.value));else if(r.type==="DoubleQuoted"){let s=await Rn(e,r.parts);n.push(Yt(s))}else n.push(await ln(e,r));return n.join("")}async function ay(e,t){let n=[];for(let r of t.parts)if(r.type==="SingleQuoted")n.push(Yt(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 Rn(e,r.parts);n.push(Yt(s))}else r.type==="Glob"?u6(r.pattern)?n.push(await p6(e,r.pattern)):n.push(ku(e,r.pattern)):r.type==="Literal"?n.push(r.value):n.push(await ln(e,r));return n.join("")}function da(e){for(let t of e)if(t.type==="BraceExpansion"||t.type==="DoubleQuoted"&&da(t.parts))return!0;return!1}async function ly(e,t,n={count:0}){if(n.count>Nu)return[[]];let r=[[]];for(let s of t)if(s.type==="BraceExpansion"){let i=[],o=!1,a="";for(let u of s.items)if(u.type==="Range"){let f=Au(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{o=!0,a=f.literal;break}}else{let f=await ly(e,u.word.parts,n);for(let p of f){n.count++;let h=[];for(let d of p)typeof d=="string"?h.push(d):h.push(await ln(e,d));i.push(h.join(""))}}if(o){for(let u of r)n.count++,u.push(a);continue}if(r.length*i.length>e.limits.maxBraceExpansionResults||n.count>Nu)return r;let c=[];for(let u of r)for(let f of i){if(n.count++,n.count>Nu)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 cy(e,t){let n=t.parts;if(!da(n))return[await le(e,t)];let r=await ly(e,n),s=[];for(let i of r){let o=[];for(let a of i)typeof a=="string"?o.push(a):o.push(await ln(e,a));s.push(d6(e,o.join("")))}return s}function ZS(){return{expandWordAsync:Ou,expandWordForGlobbing:ay,expandWordWithBracesAsync:cy,expandWordPartsAsync:Rn,expandPart:ln,expandParameterAsync:ha,hasBraceExpansion:da,evaluateArithmetic:re,buildIfsCharClassPattern:Fg,smartWordSplit:ty}}async function wn(e,t){return X6(e,t,ZS())}function KS(e){for(let t of e){if(t.type==="ParameterExpansion")return t.parameter;if(t.type==="Literal")return t.value}return""}function Ni(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 o of i.parts)if(o.type==="ParameterExpansion"&&o.parameter==="@"&&!o.operation)return!0}return!1}return r(t.parts)}async function Ii(e,t){if(Ni(e,t))return{error:`bash: $@: ambiguous redirect
791
791
  `};let n=t.parts,{hasQuoted:r}=vi(n);if(da(n)&&(await cy(e,t)).length>1)return{error:`bash: ${n.map(h=>h.type==="Literal"?h.value:h.type==="BraceExpansion"?`{${h.items.map(m=>{if(m.type==="Range"){let g=m.step?`..${m.step}`:"";return`${m.startStr??m.start}..${m.endStr??m.end}${g}`}return m.word.parts.map(g=>g.type==="Literal"?g.value:"").join("")}).join(",")}}`:"").join("")}: ambiguous redirect
792
792
  `};let s=await Ou(e,t),{hasParamExpansion:i,hasCommandSub:o}=vi(n);if((i||o)&&!r&&!kt(e.state.env)){let f=yt(e.state.env);if(Ve(s,f).length>1)return{error:`bash: $${KS(n)}: ambiguous redirect
793
793
  `}}if(r||e.state.options.noglob)return{target:s};let l=await ay(e,t);if(!qn(l,e.state.shoptOptions.extglob))return{target:s};let c=new wr(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}
794
794
  `}:{target:s}:u.length===1?{target:u[0]}:{error:`bash: ${s}: ambiguous redirect
795
- `}}async function Ou(e,t){let n=t.parts,r=n.length;if(r===1){let o=await ln(e,n[0]);return Ar(o,e.limits.maxStringLength,"word expansion"),o}let s=[];for(let o=0;o<r;o++)s.push(await ln(e,n[o]));let i=s.join("");return Ar(i,e.limits.maxStringLength,"word expansion"),i}async function ln(e,t,n=!1){if(t.type==="ParameterExpansion")return ha(e,t,n);let r=qS(e,t,n);if(r!==null)return r;switch(t.type){case"DoubleQuoted":{let s=[];for(let i of t.parts)s.push(await ln(e,i,!0));return s.join("")}case"CommandSubstitution":{let s=Vg(t.body);if(s)try{let p=await le(e,s.target),h=p.startsWith("/")?p:`${e.state.cwd}/${p}`,d=await e.fs.readFile(h);e.state.lastExitCode=0,e.state.env.set("?","0");let m=d.replace(/\n+$/,"");return Ar(m,e.limits.maxStringLength,"command substitution"),m}catch(p){if(p instanceof X)throw p;return e.state.lastExitCode=1,e.state.env.set("?","1"),""}let i=e.substitutionDepth??0,o=e.limits.maxSubstitutionDepth;if(i>=o)throw new X(`Command substitution nesting limit exceeded (${o})`,"substitution_depth");let a=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=a;let d=oy(p).replace(/\n+$/,"");return Ar(d,e.limits.maxStringLength,"command substitution"),d}catch(p){if(e.state.env=c,e.state.cwd=u,e.state.bashPid=l,e.substitutionDepth=a,e.state.suppressVerbose=f,p instanceof X)throw p;if(p instanceof we){e.state.lastExitCode=p.exitCode,e.state.env.set("?",String(p.exitCode)),p.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+p.stderr);let h=oy({stdout:p.stdout,stdoutKind:p.stdoutKind,stdoutEncoding:p.stdoutEncoding}).replace(/\n+$/,"");return Ar(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 o=await Hg(e,s),a=new pe,l=Ne(a,o);return String(await re(e,l.expression,!0))}return String(await re(e,t.expression.expression,!0))}case"BraceExpansion":{let s=[];for(let i of t.items)if(i.type==="Range"){let o=Au(i.start,i.end,i.step,i.startStr,i.endStr);if(o.expanded)s.push(...o.expanded);else return o.literal}else s.push(await le(e,i.word));return s.join(" ")}default:return""}}async function ha(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 m=await Eu(e,h);r=`${p}[${m}]`}}else if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&We(e,r)){let p=Mt(e,r);if(p&&p!==r){let h=p.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(h){let[,d,m]=h;if(e.state.associativeArrays?.has(d)||m.includes("$(")||m.includes("`")||m.includes("${")){let y=await Eu(e,m);r=`${d}[${y}]`}}}}let o=s&&(s.type==="DefaultValue"||s.type==="AssignDefault"||s.type==="UseAlternative"||s.type==="ErrorIfUnset"),a=await Ie(e,r,!o);if(!s)return a;let l=!await Vn(e,r),{isEmpty:c,effectiveValue:u}=a6(e,r,a,n),f={value:a,isUnset:l,isEmpty:c,effectiveValue:u,inDoubleQuotes:n};switch(s.type){case"DefaultValue":return Zg(e,s,f,On);case"AssignDefault":return Kg(e,r,s,f,On);case"ErrorIfUnset":return Qg(e,r,s,f,On);case"UseAlternative":return Xg(e,s,f,On);case"PatternRemoval":{let p=await Yg(e,a,s,On,ln);return Ar(p,e.limits.maxStringLength,"pattern removal"),p}case"PatternReplacement":{let p=await Jg(e,a,s,On,ln);return Ar(p,e.limits.maxStringLength,"pattern replacement"),p}case"Length":return e6(e,r,a);case"LengthSliceError":throw new Pt(r);case"BadSubstitution":throw new Pt(s.text);case"Substring":return t6(e,r,a,s);case"CaseModification":{let p=await n6(e,a,s,On,ha);return Ar(p,e.limits.maxStringLength,"case modification"),p}case"Transform":return r6(e,r,a,l,s);case"Indirection":return s6(e,r,a,l,s,ha,n);case"ArrayKeys":return i6(e,s);case"VarNamePrefix":return o6(e,s);default:return a}}var Nu,Bt=k(()=>{"use strict";Tt();ct();ta();he();Ut();Ae();na();jg();Gg();qg();Ds();l6();h6();m6();Xt();Y6();ny();an();$n();iy();Ds();Xt();Nu=1e5});function QS(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":if(t===0)throw new Le("division by 0");return Math.trunc(e/t);case"%":if(t===0)throw new Le("division by 0");return e%t;case"**":if(t<0)throw new Le("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 uy(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 XS(e,t){switch(t){case"-":return-e;case"+":return+e;case"!":return e===0?1:0;case"~":return~e;default:return e}}async function YS(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 Ie(e,t)}function JS(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 pe,{expr:s,pos:i}=on(r,n,0);if(i<n.length){let o=n.slice(i).trim().split(/\s+/)[0];throw new Le(`${n}: syntax error in expression (error token is "${o}")`)}return s.type==="ArithNumber"?s.value:t||0}catch(r){if(r instanceof Le)throw r;let s=n.split(/\s+/).slice(1)[0]||n;throw new Le(`${n}: syntax error in expression (error token is "${s}")`)}}async function Pu(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 pe,{expr:i,pos:o}=on(s,r,0);if(o<r.length){let a=r.slice(o).trim(),l=a.split(/\s+/)[0]||a;throw new Le(`syntax error in expression (error token is "${l}")`,"","")}return await re(e,i)}async function Du(e,t,n=new Set,r=0){if(r>100)throw new Le("maximum variable indirection depth exceeded");if(n.has(t))return 0;n.add(t);let s=await YS(e,t);if(!s)return 0;let i=Number.parseInt(s,10);if(!Number.isNaN(i)&&/^-?\d+$/.test(s.trim()))return i;let o=s.trim();if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o))return await Du(e,o,n,r+1);let a=new pe,{expr:l,pos:c}=on(a,o,0);if(c<o.length){let u=o.slice(c).trim(),f=u.split(/\s+/)[0]||u;throw new Le(`${o}: syntax error in expression (error token is "${f}")`)}return await re(e,l)}async function ma(e,t){if(t.startsWith("#")){let f=t.slice(1),p=f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(p){let d=p[1],m=ce(e,d);return String(m.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 Ie(e,t);let i=t.slice(0,r),o=t.slice(r+s.length),a=e.state.env.get(i),l=a===void 0,c=a==="",u=s.startsWith(":");switch(s){case":-":case"-":return l||u&&c?o:a||"";case":=":case"=":return l||u&&c?(e.state.env.set(i,o),o):a||"";case":+":case"+":return!(l||u&&c)?o:"";case":?":case"?":{if(l||u&&c)throw new Error(o||`${i}: parameter null or not set`);return a||""}default:return a||""}}async function re(e,t,n=!1){switch(t.type){case"ArithNumber":if(Number.isNaN(t.value))throw new Le("value too great for base");return t.value;case"ArithVariable":return await Du(e,t.name);case"ArithSpecialVar":{let s=(await Ie(e,t.name)).trim();if(!s)return 0;let i=Number.parseInt(s,10);if(!Number.isNaN(i)&&/^-?\d+$/.test(s))return i;let o=new pe,{expr:a}=on(o,s,0);return await re(e,a)}case"ArithNested":return await re(e,t.expression);case"ArithCommandSubst":{if(e.execFn){let r=await e.execFn(t.command,{signal:e.state.signal});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 ma(e,t.content);return Number.parseInt(r,10)||0}case"ArithDynamicBase":{let r=await ma(e,t.baseExpr),s=Number.parseInt(r,10);if(s<2||s>64)return 0;let i=`${s}#${t.value}`;return Ai(i)}case"ArithDynamicNumber":{let s=await ma(e,t.prefix)+t.suffix;return Ai(s)}case"ArithArrayElement":{let r=e.state.associativeArrays?.has(t.array),s=async i=>{let o=e.state.env.get(i);return o!==void 0?await Pu(e,o):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 Ie(e,t.index.name);return await s(`${t.array}_${i}`)}if(t.index){let i=await re(e,t.index,n);if(i<0){let l=ce(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
795
+ `}}async function Ou(e,t){let n=t.parts,r=n.length;if(r===1){let o=await ln(e,n[0]);return Ar(o,e.limits.maxStringLength,"word expansion"),o}let s=[];for(let o=0;o<r;o++)s.push(await ln(e,n[o]));let i=s.join("");return Ar(i,e.limits.maxStringLength,"word expansion"),i}async function ln(e,t,n=!1){if(t.type==="ParameterExpansion")return ha(e,t,n);let r=qS(e,t,n);if(r!==null)return r;switch(t.type){case"DoubleQuoted":{let s=[];for(let i of t.parts)s.push(await ln(e,i,!0));return s.join("")}case"CommandSubstitution":{let s=Vg(t.body);if(s)try{let p=await le(e,s.target),h=p.startsWith("/")?p:`${e.state.cwd}/${p}`,d=await e.fs.readFile(h);e.state.lastExitCode=0,e.state.env.set("?","0");let m=d.replace(/\n+$/,"");return Ar(m,e.limits.maxStringLength,"command substitution"),m}catch(p){if(p instanceof X)throw p;return e.state.lastExitCode=1,e.state.env.set("?","1"),""}let i=e.substitutionDepth??0,o=e.limits.maxSubstitutionDepth;if(i>=o)throw new X(`Command substitution nesting limit exceeded (${o})`,"substitution_depth");let a=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=a;let d=oy(p).replace(/\n+$/,"");return Ar(d,e.limits.maxStringLength,"command substitution"),d}catch(p){if(e.state.env=c,e.state.cwd=u,e.state.bashPid=l,e.substitutionDepth=a,e.state.suppressVerbose=f,p instanceof X)throw p;if(p instanceof we){e.state.lastExitCode=p.exitCode,e.state.env.set("?",String(p.exitCode)),p.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+p.stderr);let h=oy({stdout:p.stdout,stdoutKind:p.stdoutKind,stdoutEncoding:p.stdoutEncoding}).replace(/\n+$/,"");return Ar(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 o=await Hg(e,s),a=new pe,l=Ie(a,o);return String(await re(e,l.expression,!0))}return String(await re(e,t.expression.expression,!0))}case"BraceExpansion":{let s=[];for(let i of t.items)if(i.type==="Range"){let o=Au(i.start,i.end,i.step,i.startStr,i.endStr);if(o.expanded)s.push(...o.expanded);else return o.literal}else s.push(await le(e,i.word));return s.join(" ")}default:return""}}async function ha(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 m=await Eu(e,h);r=`${p}[${m}]`}}else if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&We(e,r)){let p=Mt(e,r);if(p&&p!==r){let h=p.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(h){let[,d,m]=h;if(e.state.associativeArrays?.has(d)||m.includes("$(")||m.includes("`")||m.includes("${")){let y=await Eu(e,m);r=`${d}[${y}]`}}}}let o=s&&(s.type==="DefaultValue"||s.type==="AssignDefault"||s.type==="UseAlternative"||s.type==="ErrorIfUnset"),a=!1;o&&(a=!await Tn(e,r));let l=o?a?"":await ke(e,r,!1):await ke(e,r,!0);if(!s)return l;o||(a=!await Tn(e,r));let{isEmpty:c,effectiveValue:u}=a6(e,r,l,n),f={value:l,isUnset:a,isEmpty:c,effectiveValue:u,inDoubleQuotes:n};switch(s.type){case"DefaultValue":return Zg(e,s,f,Rn);case"AssignDefault":return Kg(e,r,s,f,Rn);case"ErrorIfUnset":return Qg(e,r,s,f,Rn);case"UseAlternative":return Xg(e,s,f,Rn);case"PatternRemoval":{let p=await Yg(e,l,s,Rn,ln);return Ar(p,e.limits.maxStringLength,"pattern removal"),p}case"PatternReplacement":{let p=await Jg(e,l,s,Rn,ln);return Ar(p,e.limits.maxStringLength,"pattern replacement"),p}case"Length":return e6(e,r,l);case"LengthSliceError":throw new Pt(r);case"BadSubstitution":throw new Pt(s.text);case"Substring":return t6(e,r,l,s);case"CaseModification":{let p=await n6(e,l,s,Rn,ha);return Ar(p,e.limits.maxStringLength,"case modification"),p}case"Transform":return r6(e,r,l,a,s);case"Indirection":return s6(e,r,l,a,s,ha,n);case"ArrayKeys":return i6(e,s);case"VarNamePrefix":return o6(e,s);default:return l}}var Nu,Bt=k(()=>{"use strict";he();Tt();ct();ta();Ut();Ae();na();jg();Gg();qg();Ds();l6();h6();m6();Xt();Y6();ny();an();$n();iy();Ds();Xt();Nu=1e5});function QS(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":if(t===0)throw new Le("division by 0");return Math.trunc(e/t);case"%":if(t===0)throw new Le("division by 0");return e%t;case"**":if(t<0)throw new Le("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 uy(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 XS(e,t){switch(t){case"-":return-e;case"+":return+e;case"!":return e===0?1:0;case"~":return~e;default:return e}}async function YS(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 ke(e,t)}function JS(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 pe,{expr:s,pos:i}=on(r,n,0);if(i<n.length){let o=n.slice(i).trim().split(/\s+/)[0];throw new Le(`${n}: syntax error in expression (error token is "${o}")`)}return s.type==="ArithNumber"?s.value:t||0}catch(r){if(r instanceof Le)throw r;let s=n.split(/\s+/).slice(1)[0]||n;throw new Le(`${n}: syntax error in expression (error token is "${s}")`)}}async function Pu(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 pe,{expr:i,pos:o}=on(s,r,0);if(o<r.length){let a=r.slice(o).trim(),l=a.split(/\s+/)[0]||a;throw new Le(`syntax error in expression (error token is "${l}")`,"","")}return await re(e,i)}async function Du(e,t,n=new Set,r=0){if(r>100)throw new Le("maximum variable indirection depth exceeded");if(n.has(t))return 0;n.add(t);let s=await YS(e,t);if(!s)return 0;let i=Number.parseInt(s,10);if(!Number.isNaN(i)&&/^-?\d+$/.test(s.trim()))return i;let o=s.trim();if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o))return await Du(e,o,n,r+1);let a=new pe,{expr:l,pos:c}=on(a,o,0);if(c<o.length){let u=o.slice(c).trim(),f=u.split(/\s+/)[0]||u;throw new Le(`${o}: syntax error in expression (error token is "${f}")`)}return await re(e,l)}async function ma(e,t){if(t.startsWith("#")){let f=t.slice(1),p=f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(p){let d=p[1],m=ce(e,d);return String(m.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 ke(e,t);let i=t.slice(0,r),o=t.slice(r+s.length),a=e.state.env.get(i),l=a===void 0,c=a==="",u=s.startsWith(":");switch(s){case":-":case"-":return l||u&&c?o:a||"";case":=":case"=":return l||u&&c?(e.state.env.set(i,o),o):a||"";case":+":case"+":return!(l||u&&c)?o:"";case":?":case"?":{if(l||u&&c)throw new Error(o||`${i}: parameter null or not set`);return a||""}default:return a||""}}async function re(e,t,n=!1){switch(t.type){case"ArithNumber":if(Number.isNaN(t.value))throw new Le("value too great for base");return t.value;case"ArithVariable":return await Du(e,t.name);case"ArithSpecialVar":{let s=(await ke(e,t.name)).trim();if(!s)return 0;let i=Number.parseInt(s,10);if(!Number.isNaN(i)&&/^-?\d+$/.test(s))return i;let o=new pe,{expr:a}=on(o,s,0);return await re(e,a)}case"ArithNested":return await re(e,t.expression);case"ArithCommandSubst":{if(e.execFn){let r=await e.execFn(t.command,{signal:e.state.signal});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 ma(e,t.content);return Number.parseInt(r,10)||0}case"ArithDynamicBase":{let r=await ma(e,t.baseExpr),s=Number.parseInt(r,10);if(s<2||s>64)return 0;let i=`${s}#${t.value}`;return Ai(i)}case"ArithDynamicNumber":{let s=await ma(e,t.prefix)+t.suffix;return Ai(s)}case"ArithArrayElement":{let r=e.state.associativeArrays?.has(t.array),s=async i=>{let o=e.state.env.get(i);return o!==void 0?await Pu(e,o):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 ke(e,t.index.name);return await s(`${t.array}_${i}`)}if(t.index){let i=await re(e,t.index,n);if(i<0){let l=ce(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
796
796
  `,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
797
- `,0;i=f}let o=`${t.array}_${i}`,a=e.state.env.get(o);if(a!==void 0)return Pu(e,a);if(i===0){let l=e.state.env.get(t.array);if(l!==void 0)return Pu(e,l)}if(e.state.options.nounset&&!Array.from(e.state.env.keys()).some(c=>c===t.array||c.startsWith(`${t.array}_`)))throw new Rt(`${t.array}[${i}]`);return 0}return 0}case"ArithDoubleSubscript":throw new Le("double subscript","","");case"ArithNumberSubscript":throw new Le(`${t.number}${t.errorToken}: syntax error: invalid arithmetic operator (error token is "${t.errorToken}")`);case"ArithSyntaxError":throw new Le(t.message,"","",!0);case"ArithSingleQuote":{if(n)throw new Le(`syntax error: operand expected (error token is "'${t.content}'")`);return t.value}case"ArithBinary":{if(t.operator==="||")return await re(e,t.left,n)||await re(e,t.right,n)?1:0;if(t.operator==="&&")return await re(e,t.left,n)&&await re(e,t.right,n)?1:0;let r=await re(e,t.left,n),s=await re(e,t.right,n);return QS(r,s,t.operator)}case"ArithUnary":{let r=await re(e,t.operand,n);if(t.operator==="++"||t.operator==="--"){if(t.operand.type==="ArithVariable"){let s=t.operand.name,i=Number.parseInt(await Ie(e,s),10)||0,o=t.operator==="++"?i+1:i-1;return e.state.env.set(s,String(o)),t.prefix?o:i}if(t.operand.type==="ArithArrayElement"){let s=t.operand.array,i=e.state.associativeArrays?.has(s),o;if(t.operand.stringKey!==void 0)o=`${s}_${t.operand.stringKey}`;else if(i&&t.operand.index?.type==="ArithVariable"&&!t.operand.index.hasDollarPrefix)o=`${s}_${t.operand.index.name}`;else if(i&&t.operand.index?.type==="ArithVariable"&&t.operand.index.hasDollarPrefix){let c=await Ie(e,t.operand.index.name);o=`${s}_${c}`}else if(t.operand.index){let c=await re(e,t.operand.index,n);o=`${s}_${c}`}else return r;let a=Number.parseInt(e.state.env.get(o)||"0",10)||0,l=t.operator==="++"?a+1:a-1;return e.state.env.set(o,String(l)),t.prefix?l:a}if(t.operand.type==="ArithConcat"){let s="";for(let i of t.operand.parts)s+=await Ms(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,o=t.operator==="++"?i+1:i-1;return e.state.env.set(s,String(o)),t.prefix?o:i}}if(t.operand.type==="ArithDynamicElement"){let s="";if(t.operand.nameExpr.type==="ArithConcat")for(let i of t.operand.nameExpr.parts)s+=await Ms(e,i,n);else t.operand.nameExpr.type==="ArithVariable"&&(s=t.operand.nameExpr.hasDollarPrefix?await Ie(e,t.operand.nameExpr.name):t.operand.nameExpr.name);if(s&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){let i=await re(e,t.operand.subscript,n),o=`${s}_${i}`,a=Number.parseInt(e.state.env.get(o)||"0",10)||0,l=t.operator==="++"?a+1:a-1;return e.state.env.set(o,String(l)),t.prefix?l:a}}return r}return XS(r,t.operator)}case"ArithTernary":return await re(e,t.condition,n)?await re(e,t.consequent,n):await re(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 Ie(e,t.subscript.name);s=`${r}_${c||"\\"}`}else if(l){let c=await re(e,t.subscript,n);s=`${r}_${c}`}else{let c=await re(e,t.subscript,n);if(c<0){let u=ce(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,o=await re(e,t.value,n),a=uy(i,o,t.operator);return e.state.env.set(s,String(a)),a}case"ArithGroup":return await re(e,t.expression,n);case"ArithConcat":{let r="";for(let s of t.parts)r+=await Ms(e,s,n);return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)?await Du(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 Ms(e,l,n);else t.target.type==="ArithVariable"&&(r=t.target.hasDollarPrefix?await Ie(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 re(e,t.subscript,n);s=`${r}_${l}`}let i=Number.parseInt(e.state.env.get(s)||"0",10)||0,o=await re(e,t.value,n),a=uy(i,o,t.operator);return e.state.env.set(s,String(a)),a}case"ArithDynamicElement":{let r="";if(t.nameExpr.type==="ArithConcat")for(let a of t.nameExpr.parts)r+=await Ms(e,a,n);else t.nameExpr.type==="ArithVariable"&&(r=t.nameExpr.hasDollarPrefix?await Ie(e,t.nameExpr.name):t.nameExpr.name);if(!r||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))return 0;let s=await re(e,t.subscript,n),i=`${r}_${s}`,o=e.state.env.get(i);return o!==void 0?JS(o):0}default:return 0}}async function Ms(e,t,n=!1){switch(t.type){case"ArithNumber":return String(t.value);case"ArithSingleQuote":return String(await re(e,t,n));case"ArithVariable":return t.hasDollarPrefix?await Ie(e,t.name):t.name;case"ArithSpecialVar":return await Ie(e,t.name);case"ArithBracedExpansion":return await ma(e,t.content);case"ArithCommandSubst":return e.execFn?(await e.execFn(t.command,{signal:e.state.signal})).stdout.trim():"0";case"ArithConcat":{let r="";for(let s of t.parts)r+=await Ms(e,s,n);return r}default:return String(await re(e,t,n))}}var Ut=k(()=>{"use strict";Tt();ct();Ae();Bt()});function v7(){throw new Error("node:dns is not available in browser environments")}var k7=k(()=>{"use strict"});Zs();un();var Uc=[{name:"echo",load:async()=>(await Promise.resolve().then(()=>(Mf(),Lf))).echoCommand},{name:"cat",load:async()=>(await Promise.resolve().then(()=>(Wf(),Bf))).catCommand},{name:"printf",load:async()=>(await Promise.resolve().then(()=>(Qf(),Kf))).printfCommand},{name:"ls",load:async()=>(await Promise.resolve().then(()=>(e1(),Jf))).lsCommand},{name:"mkdir",load:async()=>(await Promise.resolve().then(()=>(n1(),t1))).mkdirCommand},{name:"rmdir",load:async()=>(await Promise.resolve().then(()=>(o1(),i1))).rmdirCommand},{name:"touch",load:async()=>(await Promise.resolve().then(()=>(l1(),a1))).touchCommand},{name:"rm",load:async()=>(await Promise.resolve().then(()=>(u1(),c1))).rmCommand},{name:"cp",load:async()=>(await Promise.resolve().then(()=>(p1(),f1))).cpCommand},{name:"mv",load:async()=>(await Promise.resolve().then(()=>(d1(),h1))).mvCommand},{name:"ln",load:async()=>(await Promise.resolve().then(()=>(g1(),m1))).lnCommand},{name:"chmod",load:async()=>(await Promise.resolve().then(()=>(b1(),w1))).chmodCommand},{name:"pwd",load:async()=>(await Promise.resolve().then(()=>(E1(),x1))).pwdCommand},{name:"readlink",load:async()=>(await Promise.resolve().then(()=>(S1(),A1))).readlinkCommand},{name:"head",load:async()=>(await Promise.resolve().then(()=>(N1(),k1))).headCommand},{name:"tail",load:async()=>(await Promise.resolve().then(()=>($1(),I1))).tailCommand},{name:"wc",load:async()=>(await Promise.resolve().then(()=>(R1(),O1))).wcCommand},{name:"stat",load:async()=>(await Promise.resolve().then(()=>(D1(),P1))).statCommand},{name:"grep",load:async()=>(await Promise.resolve().then(()=>(Ji(),Yi))).grepCommand},{name:"fgrep",load:async()=>(await Promise.resolve().then(()=>(Ji(),Yi))).fgrepCommand},{name:"egrep",load:async()=>(await Promise.resolve().then(()=>(Ji(),Yi))).egrepCommand},{name:"rg",load:async()=>(await Promise.resolve().then(()=>(Np(),kp))).rgCommand},{name:"sed",load:async()=>(await Promise.resolve().then(()=>(Up(),Mp))).sedCommand},{name:"awk",load:async()=>(await Promise.resolve().then(()=>(wh(),yh))).awkCommand2},{name:"sort",load:async()=>(await Promise.resolve().then(()=>(Ih(),Nh))).sortCommand},{name:"uniq",load:async()=>(await Promise.resolve().then(()=>(Th(),$h))).uniqCommand},{name:"comm",load:async()=>(await Promise.resolve().then(()=>(Rh(),Oh))).commCommand},{name:"cut",load:async()=>(await Promise.resolve().then(()=>(Dh(),Ph))).cutCommand},{name:"paste",load:async()=>(await Promise.resolve().then(()=>(Lh(),Fh))).pasteCommand},{name:"tr",load:async()=>(await Promise.resolve().then(()=>(Bh(),Uh))).trCommand},{name:"rev",load:async()=>(await Promise.resolve().then(()=>(zh(),Wh))).rev},{name:"nl",load:async()=>(await Promise.resolve().then(()=>(Gh(),jh))).nl},{name:"fold",load:async()=>(await Promise.resolve().then(()=>(Zh(),qh))).fold},{name:"expand",load:async()=>(await Promise.resolve().then(()=>(Xh(),Qh))).expand},{name:"unexpand",load:async()=>(await Promise.resolve().then(()=>(td(),ed))).unexpand},{name:"strings",load:async()=>(await Promise.resolve().then(()=>(id(),sd))).strings},{name:"split",load:async()=>(await Promise.resolve().then(()=>(cd(),ld))).split},{name:"column",load:async()=>(await Promise.resolve().then(()=>(pd(),fd))).column},{name:"join",load:async()=>(await Promise.resolve().then(()=>(dd(),hd))).join},{name:"tee",load:async()=>(await Promise.resolve().then(()=>(gd(),md))).teeCommand},{name:"find",load:async()=>(await Promise.resolve().then(()=>(vd(),Cd))).findCommand},{name:"basename",load:async()=>(await Promise.resolve().then(()=>(Nd(),kd))).basenameCommand},{name:"dirname",load:async()=>(await Promise.resolve().then(()=>($d(),Id))).dirnameCommand},{name:"tree",load:async()=>(await Promise.resolve().then(()=>(Rd(),Od))).treeCommand},{name:"du",load:async()=>(await Promise.resolve().then(()=>(_d(),Dd))).duCommand},{name:"env",load:async()=>(await Promise.resolve().then(()=>(Vl(),Gl))).envCommand},{name:"printenv",load:async()=>(await Promise.resolve().then(()=>(Vl(),Gl))).printenvCommand},{name:"alias",load:async()=>(await Promise.resolve().then(()=>(Zl(),ql))).aliasCommand},{name:"unalias",load:async()=>(await Promise.resolve().then(()=>(Zl(),ql))).unaliasCommand},{name:"history",load:async()=>(await Promise.resolve().then(()=>(Md(),Ld))).historyCommand},{name:"xargs",load:async()=>(await Promise.resolve().then(()=>(Bd(),Ud))).xargsCommand},{name:"true",load:async()=>(await Promise.resolve().then(()=>(Ql(),Kl))).trueCommand},{name:"false",load:async()=>(await Promise.resolve().then(()=>(Ql(),Kl))).falseCommand},{name:"clear",load:async()=>(await Promise.resolve().then(()=>(zd(),Wd))).clearCommand},{name:"bash",load:async()=>(await Promise.resolve().then(()=>(Yl(),Xl))).bashCommand},{name:"sh",load:async()=>(await Promise.resolve().then(()=>(Yl(),Xl))).shCommand},{name:"jq",load:async()=>(await Promise.resolve().then(()=>(gm(),mm))).jqCommand},{name:"base64",load:async()=>(await Promise.resolve().then(()=>(bm(),wm))).base64Command},{name:"diff",load:async()=>(await Promise.resolve().then(()=>(Am(),Em))).diffCommand},{name:"date",load:async()=>(await Promise.resolve().then(()=>(Cm(),Sm))).dateCommand},{name:"sleep",load:async()=>(await Promise.resolve().then(()=>(Nm(),km))).sleepCommand},{name:"timeout",load:async()=>(await Promise.resolve().then(()=>($m(),Im))).timeoutCommand},{name:"time",load:async()=>(await Promise.resolve().then(()=>(Om(),Tm))).timeCommand},{name:"seq",load:async()=>(await Promise.resolve().then(()=>(Pm(),Rm))).seqCommand},{name:"expr",load:async()=>(await Promise.resolve().then(()=>(_m(),Dm))).exprCommand},{name:"md5sum",load:async()=>(await Promise.resolve().then(()=>(Mm(),Lm))).md5sumCommand},{name:"sha1sum",load:async()=>(await Promise.resolve().then(()=>(Bm(),Um))).sha1sumCommand},{name:"sha256sum",load:async()=>(await Promise.resolve().then(()=>(zm(),Wm))).sha256sumCommand},{name:"file",load:async()=>(await Promise.resolve().then(()=>(V0(),G0))).fileCommand},{name:"html-to-markdown",load:async()=>(await Promise.resolve().then(()=>(Z0(),q0))).htmlToMarkdownCommand},{name:"help",load:async()=>(await Promise.resolve().then(()=>(Q0(),K0))).helpCommand},{name:"which",load:async()=>(await Promise.resolve().then(()=>(Y0(),X0))).whichCommand},{name:"tac",load:async()=>(await Promise.resolve().then(()=>(e2(),J0))).tac},{name:"hostname",load:async()=>(await Promise.resolve().then(()=>(n2(),t2))).hostname},{name:"whoami",load:async()=>(await Promise.resolve().then(()=>(s2(),r2))).whoami},{name:"od",load:async()=>(await Promise.resolve().then(()=>(o2(),i2))).od},{name:"gzip",load:async()=>(await Promise.resolve().then(()=>(jo(),Ho))).gzipCommand},{name:"gunzip",load:async()=>(await Promise.resolve().then(()=>(jo(),Ho))).gunzipCommand},{name:"zcat",load:async()=>(await Promise.resolve().then(()=>(jo(),Ho))).zcatCommand}],AA=[],SA=[],v2=[{name:"curl",load:async()=>(await Promise.resolve().then(()=>(S2(),A2))).curlCommand}],C2=new Map;function Vo(e){return{name:e.name,async execute(t,n){let r=C2.get(e.name);return r||(r=await Et.runTrustedAsync(()=>e.load()),C2.set(e.name,r)),n.coverage,r.execute(t,n)}}}function CA(){return Uc.map(e=>e.name)}function vA(){return v2.map(e=>e.name)}function k2(e){return(e?Uc.filter(n=>e.includes(n.name)):Uc).map(Vo)}function N2(){return v2.map(Vo)}function I2(){return AA.map(Vo)}function $2(){return SA.map(Vo)}function T2(e){return"load"in e&&typeof e.load=="function"}function kA(e,t){return{name:e,trusted:!0,execute:t}}function O2(e){let t=null;return{name:e.name,trusted:!0,async execute(n,r){return t||(t=await e.load()),t.execute(n,r)}}}he();he();Pc();function ke(e){if(!e||e==="/")return"/";let t=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;t.startsWith("/")||(t=`/${t}`);let n=t.split("/").filter(s=>s&&s!=="."),r=[];for(let s of n)s===".."?r.pop():r.push(s);return`/${r.join("/")}`||"/"}function lt(e,t){if(e.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${t} '${e}'`)}function qo(e){let t=ke(e);if(t==="/")return"/";let n=t.lastIndexOf("/");return n===0?"/":t.slice(0,n)}function Zo(e,t){if(t.startsWith("/"))return ke(t);let n=e==="/"?`/${t}`:`${e}/${t}`;return ke(n)}function hr(e,t){return e==="/"?`/${t}`:`${e}/${t}`}function Ko(e,t){if(t.startsWith("/"))return ke(t);let n=qo(e);return ke(hr(n,t))}var Ts=new TextEncoder;function IA(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}var rr=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):IA(r)?this.writeFileSync(n,r.content,void 0,{mode:r.mode,mtime:r.mtime}):this.writeFileSync(n,r)}ensureParentDirs(t){let n=qo(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){lt(t,"write");let i=ke(t);this.ensureParentDirs(i);let o=Go(r),a=Rc(n,o);this.data.set(i,{type:"file",content:a,mode:s?.mode??420,mtime:s?.mtime??new Date})}writeFileLazy(t,n,r){lt(t,"write");let s=ke(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"?Ts.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=Go(n);return Ei(r,s)}async readFileBytes(t){let n=await this.readFileBuffer(t);return Ei(n,"binary")}async readFileBuffer(t){lt(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:Ts.encode(s.content)}return r.content instanceof Uint8Array?r.content:Ts.encode(r.content)}async writeFile(t,n,r){this.writeFileSync(t,n,r)}async appendFile(t,n,r){lt(t,"append");let s=ke(t),i=this.data.get(s);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let o=Go(r),a=Rc(n,o);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:Ts.encode("content"in l?l.content:""),u=new Uint8Array(c.length+a.length);u.set(c),u.set(a,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){lt(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=Ts.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){lt(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=Ts.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date}}resolveIntermediateSymlinks(t){let n=ke(t);if(n==="/")return"/";let r=n.slice(1).split("/");if(r.length<=1)return n;let s="",i=new Set;for(let o=0;o<r.length-1;o++){let a=r[o];s=`${s}/${a}`;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=Ko(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=ke(t);if(n==="/")return"/";let r=n.slice(1).split("/"),s="",i=new Set;for(let o of r){s=`${s}/${o}`;let a=this.data.get(s),l=0,c=40;for(;a&&a.type==="symlink"&&l<c;){if(i.has(s))throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`);i.add(s),s=Ko(s,a.target),a=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){lt(t,"mkdir");let r=ke(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=qo(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){lt(t,"scandir");let n=ke(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=Ko(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}/`,o=new Map;for(let[a,l]of this.data.entries())if(a!==n&&a.startsWith(i)){let c=a.slice(i.length),u=c.split("/")[0];u&&!c.includes("/",u.length)&&!o.has(u)&&o.set(u,{name:u,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(o.values()).sort((a,l)=>a.name<l.name?-1:a.name>l.name?1:0)}async rm(t,n){lt(t,"rm");let r=ke(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 o of i){let a=hr(r,o);await this.rm(a,n)}}}this.data.delete(r)}async cp(t,n,r){lt(t,"cp"),lt(n,"cp");let s=ke(t),i=ke(n),o=this.data.get(s);if(!o)throw new Error(`ENOENT: no such file or directory, cp '${t}'`);if(o.type==="file")if(this.ensureParentDirs(i),"content"in o){let a=o.content instanceof Uint8Array?new Uint8Array(o.content):o.content;this.data.set(i,{...o,content:a})}else this.data.set(i,{...o});else if(o.type==="symlink")this.ensureParentDirs(i),this.data.set(i,{...o});else if(o.type==="directory"){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${t}'`);await this.mkdir(i,{recursive:!0});let a=await this.readdir(s);for(let l of a){let c=hr(s,l),u=hr(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){return Zo(t,n)}async chmod(t,n){lt(t,"chmod");let r=ke(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){lt(n,"symlink");let r=ke(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){lt(t,"link"),lt(n,"link");let r=ke(t),s=ke(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 o=i;"lazy"in o&&(o=await this.materializeLazy(r,o)),this.ensureParentDirs(s),this.data.set(s,{type:"file",content:o.content,mode:o.mode,mtime:o.mtime})}async readlink(t){lt(t,"readlink");let n=ke(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){lt(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){lt(t,"utimes");let s=ke(t),i=this.resolvePathWithSymlinks(s),o=this.data.get(i);if(!o)throw new Error(`ENOENT: no such file or directory, utimes '${t}'`);o.mtime=r}};Wc();function $A(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function TA(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 OA(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 RA(e,t){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${_2}
797
+ `,0;i=f}let o=`${t.array}_${i}`,a=e.state.env.get(o);if(a!==void 0)return Pu(e,a);if(i===0){let l=e.state.env.get(t.array);if(l!==void 0)return Pu(e,l)}if(e.state.options.nounset&&!Array.from(e.state.env.keys()).some(c=>c===t.array||c.startsWith(`${t.array}_`)))throw new Rt(`${t.array}[${i}]`);return 0}return 0}case"ArithDoubleSubscript":throw new Le("double subscript","","");case"ArithNumberSubscript":throw new Le(`${t.number}${t.errorToken}: syntax error: invalid arithmetic operator (error token is "${t.errorToken}")`);case"ArithSyntaxError":throw new Le(t.message,"","",!0);case"ArithSingleQuote":{if(n)throw new Le(`syntax error: operand expected (error token is "'${t.content}'")`);return t.value}case"ArithBinary":{if(t.operator==="||")return await re(e,t.left,n)||await re(e,t.right,n)?1:0;if(t.operator==="&&")return await re(e,t.left,n)&&await re(e,t.right,n)?1:0;let r=await re(e,t.left,n),s=await re(e,t.right,n);return QS(r,s,t.operator)}case"ArithUnary":{let r=await re(e,t.operand,n);if(t.operator==="++"||t.operator==="--"){if(t.operand.type==="ArithVariable"){let s=t.operand.name,i=Number.parseInt(await ke(e,s),10)||0,o=t.operator==="++"?i+1:i-1;return e.state.env.set(s,String(o)),t.prefix?o:i}if(t.operand.type==="ArithArrayElement"){let s=t.operand.array,i=e.state.associativeArrays?.has(s),o;if(t.operand.stringKey!==void 0)o=`${s}_${t.operand.stringKey}`;else if(i&&t.operand.index?.type==="ArithVariable"&&!t.operand.index.hasDollarPrefix)o=`${s}_${t.operand.index.name}`;else if(i&&t.operand.index?.type==="ArithVariable"&&t.operand.index.hasDollarPrefix){let c=await ke(e,t.operand.index.name);o=`${s}_${c}`}else if(t.operand.index){let c=await re(e,t.operand.index,n);o=`${s}_${c}`}else return r;let a=Number.parseInt(e.state.env.get(o)||"0",10)||0,l=t.operator==="++"?a+1:a-1;return e.state.env.set(o,String(l)),t.prefix?l:a}if(t.operand.type==="ArithConcat"){let s="";for(let i of t.operand.parts)s+=await Ms(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,o=t.operator==="++"?i+1:i-1;return e.state.env.set(s,String(o)),t.prefix?o:i}}if(t.operand.type==="ArithDynamicElement"){let s="";if(t.operand.nameExpr.type==="ArithConcat")for(let i of t.operand.nameExpr.parts)s+=await Ms(e,i,n);else t.operand.nameExpr.type==="ArithVariable"&&(s=t.operand.nameExpr.hasDollarPrefix?await ke(e,t.operand.nameExpr.name):t.operand.nameExpr.name);if(s&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){let i=await re(e,t.operand.subscript,n),o=`${s}_${i}`,a=Number.parseInt(e.state.env.get(o)||"0",10)||0,l=t.operator==="++"?a+1:a-1;return e.state.env.set(o,String(l)),t.prefix?l:a}}return r}return XS(r,t.operator)}case"ArithTernary":return await re(e,t.condition,n)?await re(e,t.consequent,n):await re(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 ke(e,t.subscript.name);s=`${r}_${c||"\\"}`}else if(l){let c=await re(e,t.subscript,n);s=`${r}_${c}`}else{let c=await re(e,t.subscript,n);if(c<0){let u=ce(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,o=await re(e,t.value,n),a=uy(i,o,t.operator);return e.state.env.set(s,String(a)),a}case"ArithGroup":return await re(e,t.expression,n);case"ArithConcat":{let r="";for(let s of t.parts)r+=await Ms(e,s,n);return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)?await Du(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 Ms(e,l,n);else t.target.type==="ArithVariable"&&(r=t.target.hasDollarPrefix?await ke(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 re(e,t.subscript,n);s=`${r}_${l}`}let i=Number.parseInt(e.state.env.get(s)||"0",10)||0,o=await re(e,t.value,n),a=uy(i,o,t.operator);return e.state.env.set(s,String(a)),a}case"ArithDynamicElement":{let r="";if(t.nameExpr.type==="ArithConcat")for(let a of t.nameExpr.parts)r+=await Ms(e,a,n);else t.nameExpr.type==="ArithVariable"&&(r=t.nameExpr.hasDollarPrefix?await ke(e,t.nameExpr.name):t.nameExpr.name);if(!r||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))return 0;let s=await re(e,t.subscript,n),i=`${r}_${s}`,o=e.state.env.get(i);return o!==void 0?JS(o):0}default:return 0}}async function Ms(e,t,n=!1){switch(t.type){case"ArithNumber":return String(t.value);case"ArithSingleQuote":return String(await re(e,t,n));case"ArithVariable":return t.hasDollarPrefix?await ke(e,t.name):t.name;case"ArithSpecialVar":return await ke(e,t.name);case"ArithBracedExpansion":return await ma(e,t.content);case"ArithCommandSubst":return e.execFn?(await e.execFn(t.command,{signal:e.state.signal})).stdout.trim():"0";case"ArithConcat":{let r="";for(let s of t.parts)r+=await Ms(e,s,n);return r}default:return String(await re(e,t,n))}}var Ut=k(()=>{"use strict";Tt();ct();Ae();Bt()});function v7(){throw new Error("node:dns is not available in browser environments")}var k7=k(()=>{"use strict"});Zs();un();var Uc=[{name:"echo",load:async()=>(await Promise.resolve().then(()=>(Mf(),Lf))).echoCommand},{name:"cat",load:async()=>(await Promise.resolve().then(()=>(Wf(),Bf))).catCommand},{name:"printf",load:async()=>(await Promise.resolve().then(()=>(Qf(),Kf))).printfCommand},{name:"ls",load:async()=>(await Promise.resolve().then(()=>(e1(),Jf))).lsCommand},{name:"mkdir",load:async()=>(await Promise.resolve().then(()=>(n1(),t1))).mkdirCommand},{name:"rmdir",load:async()=>(await Promise.resolve().then(()=>(o1(),i1))).rmdirCommand},{name:"touch",load:async()=>(await Promise.resolve().then(()=>(l1(),a1))).touchCommand},{name:"rm",load:async()=>(await Promise.resolve().then(()=>(u1(),c1))).rmCommand},{name:"cp",load:async()=>(await Promise.resolve().then(()=>(p1(),f1))).cpCommand},{name:"mv",load:async()=>(await Promise.resolve().then(()=>(d1(),h1))).mvCommand},{name:"ln",load:async()=>(await Promise.resolve().then(()=>(g1(),m1))).lnCommand},{name:"chmod",load:async()=>(await Promise.resolve().then(()=>(b1(),w1))).chmodCommand},{name:"pwd",load:async()=>(await Promise.resolve().then(()=>(E1(),x1))).pwdCommand},{name:"readlink",load:async()=>(await Promise.resolve().then(()=>(S1(),A1))).readlinkCommand},{name:"head",load:async()=>(await Promise.resolve().then(()=>(N1(),k1))).headCommand},{name:"tail",load:async()=>(await Promise.resolve().then(()=>($1(),I1))).tailCommand},{name:"wc",load:async()=>(await Promise.resolve().then(()=>(R1(),O1))).wcCommand},{name:"stat",load:async()=>(await Promise.resolve().then(()=>(D1(),P1))).statCommand},{name:"grep",load:async()=>(await Promise.resolve().then(()=>(Ji(),Yi))).grepCommand},{name:"fgrep",load:async()=>(await Promise.resolve().then(()=>(Ji(),Yi))).fgrepCommand},{name:"egrep",load:async()=>(await Promise.resolve().then(()=>(Ji(),Yi))).egrepCommand},{name:"rg",load:async()=>(await Promise.resolve().then(()=>(Np(),kp))).rgCommand},{name:"sed",load:async()=>(await Promise.resolve().then(()=>(Up(),Mp))).sedCommand},{name:"awk",load:async()=>(await Promise.resolve().then(()=>(wh(),yh))).awkCommand2},{name:"sort",load:async()=>(await Promise.resolve().then(()=>(Ih(),Nh))).sortCommand},{name:"uniq",load:async()=>(await Promise.resolve().then(()=>(Th(),$h))).uniqCommand},{name:"comm",load:async()=>(await Promise.resolve().then(()=>(Rh(),Oh))).commCommand},{name:"cut",load:async()=>(await Promise.resolve().then(()=>(Dh(),Ph))).cutCommand},{name:"paste",load:async()=>(await Promise.resolve().then(()=>(Lh(),Fh))).pasteCommand},{name:"tr",load:async()=>(await Promise.resolve().then(()=>(Bh(),Uh))).trCommand},{name:"rev",load:async()=>(await Promise.resolve().then(()=>(zh(),Wh))).rev},{name:"nl",load:async()=>(await Promise.resolve().then(()=>(Gh(),jh))).nl},{name:"fold",load:async()=>(await Promise.resolve().then(()=>(Zh(),qh))).fold},{name:"expand",load:async()=>(await Promise.resolve().then(()=>(Xh(),Qh))).expand},{name:"unexpand",load:async()=>(await Promise.resolve().then(()=>(td(),ed))).unexpand},{name:"strings",load:async()=>(await Promise.resolve().then(()=>(id(),sd))).strings},{name:"split",load:async()=>(await Promise.resolve().then(()=>(cd(),ld))).split},{name:"column",load:async()=>(await Promise.resolve().then(()=>(pd(),fd))).column},{name:"join",load:async()=>(await Promise.resolve().then(()=>(dd(),hd))).join},{name:"tee",load:async()=>(await Promise.resolve().then(()=>(gd(),md))).teeCommand},{name:"find",load:async()=>(await Promise.resolve().then(()=>(vd(),Cd))).findCommand},{name:"basename",load:async()=>(await Promise.resolve().then(()=>(Nd(),kd))).basenameCommand},{name:"dirname",load:async()=>(await Promise.resolve().then(()=>($d(),Id))).dirnameCommand},{name:"tree",load:async()=>(await Promise.resolve().then(()=>(Rd(),Od))).treeCommand},{name:"du",load:async()=>(await Promise.resolve().then(()=>(_d(),Dd))).duCommand},{name:"env",load:async()=>(await Promise.resolve().then(()=>(Vl(),Gl))).envCommand},{name:"printenv",load:async()=>(await Promise.resolve().then(()=>(Vl(),Gl))).printenvCommand},{name:"alias",load:async()=>(await Promise.resolve().then(()=>(Zl(),ql))).aliasCommand},{name:"unalias",load:async()=>(await Promise.resolve().then(()=>(Zl(),ql))).unaliasCommand},{name:"history",load:async()=>(await Promise.resolve().then(()=>(Md(),Ld))).historyCommand},{name:"xargs",load:async()=>(await Promise.resolve().then(()=>(Bd(),Ud))).xargsCommand},{name:"true",load:async()=>(await Promise.resolve().then(()=>(Ql(),Kl))).trueCommand},{name:"false",load:async()=>(await Promise.resolve().then(()=>(Ql(),Kl))).falseCommand},{name:"clear",load:async()=>(await Promise.resolve().then(()=>(zd(),Wd))).clearCommand},{name:"bash",load:async()=>(await Promise.resolve().then(()=>(Yl(),Xl))).bashCommand},{name:"sh",load:async()=>(await Promise.resolve().then(()=>(Yl(),Xl))).shCommand},{name:"jq",load:async()=>(await Promise.resolve().then(()=>(gm(),mm))).jqCommand},{name:"base64",load:async()=>(await Promise.resolve().then(()=>(bm(),wm))).base64Command},{name:"diff",load:async()=>(await Promise.resolve().then(()=>(Am(),Em))).diffCommand},{name:"date",load:async()=>(await Promise.resolve().then(()=>(Cm(),Sm))).dateCommand},{name:"sleep",load:async()=>(await Promise.resolve().then(()=>(Nm(),km))).sleepCommand},{name:"timeout",load:async()=>(await Promise.resolve().then(()=>($m(),Im))).timeoutCommand},{name:"time",load:async()=>(await Promise.resolve().then(()=>(Om(),Tm))).timeCommand},{name:"seq",load:async()=>(await Promise.resolve().then(()=>(Pm(),Rm))).seqCommand},{name:"expr",load:async()=>(await Promise.resolve().then(()=>(_m(),Dm))).exprCommand},{name:"md5sum",load:async()=>(await Promise.resolve().then(()=>(Mm(),Lm))).md5sumCommand},{name:"sha1sum",load:async()=>(await Promise.resolve().then(()=>(Bm(),Um))).sha1sumCommand},{name:"sha256sum",load:async()=>(await Promise.resolve().then(()=>(zm(),Wm))).sha256sumCommand},{name:"file",load:async()=>(await Promise.resolve().then(()=>(V0(),G0))).fileCommand},{name:"html-to-markdown",load:async()=>(await Promise.resolve().then(()=>(Z0(),q0))).htmlToMarkdownCommand},{name:"help",load:async()=>(await Promise.resolve().then(()=>(Q0(),K0))).helpCommand},{name:"which",load:async()=>(await Promise.resolve().then(()=>(Y0(),X0))).whichCommand},{name:"tac",load:async()=>(await Promise.resolve().then(()=>(e2(),J0))).tac},{name:"hostname",load:async()=>(await Promise.resolve().then(()=>(n2(),t2))).hostname},{name:"whoami",load:async()=>(await Promise.resolve().then(()=>(s2(),r2))).whoami},{name:"od",load:async()=>(await Promise.resolve().then(()=>(o2(),i2))).od},{name:"gzip",load:async()=>(await Promise.resolve().then(()=>(jo(),Ho))).gzipCommand},{name:"gunzip",load:async()=>(await Promise.resolve().then(()=>(jo(),Ho))).gunzipCommand},{name:"zcat",load:async()=>(await Promise.resolve().then(()=>(jo(),Ho))).zcatCommand}],AA=[],SA=[],v2=[{name:"curl",load:async()=>(await Promise.resolve().then(()=>(S2(),A2))).curlCommand}],C2=new Map;function Vo(e){return{name:e.name,async execute(t,n){let r=C2.get(e.name);return r||(r=await Et.runTrustedAsync(()=>e.load()),C2.set(e.name,r)),n.coverage,r.execute(t,n)}}}function CA(){return Uc.map(e=>e.name)}function vA(){return v2.map(e=>e.name)}function k2(e){return(e?Uc.filter(n=>e.includes(n.name)):Uc).map(Vo)}function N2(){return v2.map(Vo)}function I2(){return AA.map(Vo)}function $2(){return SA.map(Vo)}function T2(e){return"load"in e&&typeof e.load=="function"}function kA(e,t){return{name:e,trusted:!0,execute:t}}function O2(e){let t=null;return{name:e.name,trusted:!0,async execute(n,r){return t||(t=await e.load()),t.execute(n,r)}}}he();he();Pc();function Ne(e){if(!e||e==="/")return"/";let t=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;t.startsWith("/")||(t=`/${t}`);let n=t.split("/").filter(s=>s&&s!=="."),r=[];for(let s of n)s===".."?r.pop():r.push(s);return`/${r.join("/")}`||"/"}function lt(e,t){if(e.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${t} '${e}'`)}function qo(e){let t=Ne(e);if(t==="/")return"/";let n=t.lastIndexOf("/");return n===0?"/":t.slice(0,n)}function Zo(e,t){if(t.startsWith("/"))return Ne(t);let n=e==="/"?`/${t}`:`${e}/${t}`;return Ne(n)}function hr(e,t){return e==="/"?`/${t}`:`${e}/${t}`}function Ko(e,t){if(t.startsWith("/"))return Ne(t);let n=qo(e);return Ne(hr(n,t))}var Ts=new TextEncoder;function IA(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}var rr=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):IA(r)?this.writeFileSync(n,r.content,void 0,{mode:r.mode,mtime:r.mtime}):this.writeFileSync(n,r)}ensureParentDirs(t){let n=qo(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){lt(t,"write");let i=Ne(t);this.ensureParentDirs(i);let o=Go(r),a=Rc(n,o);this.data.set(i,{type:"file",content:a,mode:s?.mode??420,mtime:s?.mtime??new Date})}writeFileLazy(t,n,r){lt(t,"write");let s=Ne(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"?Ts.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=Go(n);return Ei(r,s)}async readFileBytes(t){let n=await this.readFileBuffer(t);return Ei(n,"binary")}async readFileBuffer(t){lt(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:Ts.encode(s.content)}return r.content instanceof Uint8Array?r.content:Ts.encode(r.content)}async writeFile(t,n,r){this.writeFileSync(t,n,r)}async appendFile(t,n,r){lt(t,"append");let s=Ne(t),i=this.data.get(s);if(i&&i.type==="directory")throw new Error(`EISDIR: illegal operation on a directory, write '${t}'`);let o=Go(r),a=Rc(n,o);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:Ts.encode("content"in l?l.content:""),u=new Uint8Array(c.length+a.length);u.set(c),u.set(a,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){lt(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=Ts.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){lt(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=Ts.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date}}resolveIntermediateSymlinks(t){let n=Ne(t);if(n==="/")return"/";let r=n.slice(1).split("/");if(r.length<=1)return n;let s="",i=new Set;for(let o=0;o<r.length-1;o++){let a=r[o];s=`${s}/${a}`;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=Ko(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=Ne(t);if(n==="/")return"/";let r=n.slice(1).split("/"),s="",i=new Set;for(let o of r){s=`${s}/${o}`;let a=this.data.get(s),l=0,c=40;for(;a&&a.type==="symlink"&&l<c;){if(i.has(s))throw new Error(`ELOOP: too many levels of symbolic links, open '${t}'`);i.add(s),s=Ko(s,a.target),a=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){lt(t,"mkdir");let r=Ne(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=qo(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){lt(t,"scandir");let n=Ne(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=Ko(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}/`,o=new Map;for(let[a,l]of this.data.entries())if(a!==n&&a.startsWith(i)){let c=a.slice(i.length),u=c.split("/")[0];u&&!c.includes("/",u.length)&&!o.has(u)&&o.set(u,{name:u,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(o.values()).sort((a,l)=>a.name<l.name?-1:a.name>l.name?1:0)}async rm(t,n){lt(t,"rm");let r=Ne(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 o of i){let a=hr(r,o);await this.rm(a,n)}}}this.data.delete(r)}async cp(t,n,r){lt(t,"cp"),lt(n,"cp");let s=Ne(t),i=Ne(n),o=this.data.get(s);if(!o)throw new Error(`ENOENT: no such file or directory, cp '${t}'`);if(o.type==="file")if(this.ensureParentDirs(i),"content"in o){let a=o.content instanceof Uint8Array?new Uint8Array(o.content):o.content;this.data.set(i,{...o,content:a})}else this.data.set(i,{...o});else if(o.type==="symlink")this.ensureParentDirs(i),this.data.set(i,{...o});else if(o.type==="directory"){if(!r?.recursive)throw new Error(`EISDIR: is a directory, cp '${t}'`);await this.mkdir(i,{recursive:!0});let a=await this.readdir(s);for(let l of a){let c=hr(s,l),u=hr(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){return Zo(t,n)}async chmod(t,n){lt(t,"chmod");let r=Ne(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){lt(n,"symlink");let r=Ne(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){lt(t,"link"),lt(n,"link");let r=Ne(t),s=Ne(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 o=i;"lazy"in o&&(o=await this.materializeLazy(r,o)),this.ensureParentDirs(s),this.data.set(s,{type:"file",content:o.content,mode:o.mode,mtime:o.mtime})}async readlink(t){lt(t,"readlink");let n=Ne(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){lt(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){lt(t,"utimes");let s=Ne(t),i=this.resolvePathWithSymlinks(s),o=this.data.get(i);if(!o)throw new Error(`ENOENT: no such file or directory, utimes '${t}'`);o.mtime=r}};Wc();function $A(e){let t=e;return typeof t.mkdirSync=="function"&&typeof t.writeFileSync=="function"}function TA(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 OA(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 RA(e,t){e.mkdirSync("/proc/self/fd",{recursive:!0}),e.writeFileSync("/proc/version",`${_2}
798
798
  `),e.writeFileSync("/proc/self/exe","/bin/bash"),e.writeFileSync("/proc/self/cmdline","bash\0"),e.writeFileSync("/proc/self/comm",`bash
799
- `),e.writeFileLazy?e.writeFileLazy("/proc/self/status",()=>Bc(t)):e.writeFileSync("/proc/self/status",Bc(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 F2(e,t,n={pid:1,ppid:0,uid:1e3,gid:1e3}){$A(e)&&(TA(e,t),OA(e),RA(e,n))}En();er();Ae();var PA=["allexport","errexit","noglob","noclobber","noexec","nounset","pipefail","posix","verbose","xtrace"],DA=["braceexpand","hashall","interactive-comments"];function zc(e){let t=[],n=[...DA.map(r=>({name:r,enabled:!0})),...PA.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 Os(e){e.state.env.set("SHELLOPTS",zc(e.state.options))}var _A=["dotglob","expand_aliases","extglob","failglob","globskipdots","globstar","lastpipe","nocaseglob","nocasematch","nullglob","xpg_echo"];function Hc(e){let t=[];for(let n of _A)e[n]&&t.push(n);return t.join(":")}function jc(e){e.state.env.set("BASHOPTS",Hc(e.state.shoptOptions))}he();er();Gr();un();ct();Gr();var fS="BASH_ALIAS_";function kg(e){return e.parts.length!==1?!1:e.parts[0].type==="Literal"}function Ng(e){if(e.parts.length!==1)return null;let t=e.parts[0];return t.type==="Literal"?t.value:null}function Ig(e,t){return e.env.get(`${fS}${t}`)}function pu(e,t,n){if(!t.name||!kg(t.name))return t;let r=Ng(t.name);if(!r)return t;let s=Ig(e,r);if(!s||n.has(r))return t;try{n.add(r);let i=new pe,o=s,a=s.endsWith(" ");if(!a)for(let f of t.args){let p=Tg(f);o+=` ${p}`}let l;try{l=i.parse(o)}catch(f){if(f instanceof At)throw f;return t}if(l.statements.length!==1||l.statements[0].pipelines.length!==1||l.statements[0].pipelines[0].commands.length!==1)return $g(t,s);let c=l.statements[0].pipelines[0].commands[0];if(c.type!=="SimpleCommand")return $g(t,s);let u={...c,assignments:[...t.assignments,...c.assignments],redirections:[...c.redirections,...t.redirections],line:t.line};if(a&&t.args.length>0&&(u={...u,args:[...u.args,...t.args]},u.args.length>0)){let f=u.args[0];if(kg(f)){let p=Ng(f);if(p&&Ig(e,p)){let h={type:"SimpleCommand",name:f,args:u.args.slice(1),assignments:[],redirections:[]},d=pu(e,h,n);d!==h&&(u={...u,name:d.name,args:[...d.args]})}}}return u}catch(i){throw n.delete(r),i}}function $g(e,t){let n=t;for(let o of e.args){let a=Tg(o);n+=` ${a}`}let r=new pe,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 Tg(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}Ut();Bt();yn();async function fy(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=[],o=!1,a="",l=!1;for(let u of t.parts)if(u.type==="Literal"){let f=u.value;if(!o){let p=f.indexOf("=(");p!==-1&&(o=!0,f=f.slice(p+2))}if(o){f.endsWith(")")&&(f=f.slice(0,-1));let p=f.split(/(\s+)/);for(let h of p)/^\s+$/.test(h)?(a||l)&&(i.push(a),a="",l=!1):h&&(a+=h)}}else if(o)if(u.type==="BraceExpansion")if(/^\[.+\]=/.test(a))a+=Rs({type:"Word",parts:[u]});else{(a||l)&&(i.push(a),a="",l=!1);let p=await wn(e,{type:"Word",parts:[u]});i.push(...p.values)}else{(u.type==="SingleQuoted"||u.type==="DoubleQuoted"||u.type==="Escaped")&&(l=!0);let f=await le(e,{type:"Word",parts:[u]});a+=f}(a||l)&&i.push(a);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 py(e,t){let n=-1,r=-1,s=!1;for(let m=0;m<t.parts.length;m++){let g=t.parts[m];if(g.type==="Literal"){let y=g.value.indexOf("+=");if(y!==-1){let b=g.value.slice(0,y);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(b)){n=m,r=y,s=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(b)){n=m,r=y,s=!0;break}}let w=g.value.indexOf("=");if(w!==-1&&(w===0||g.value[w-1]!=="+")){let b=g.value.slice(0,w);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(b)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(b)){n=m,r=w;break}}}}if(n===-1)return null;let i=t.parts.slice(0,n),o=t.parts[n];if(o.type!=="Literal")return null;let a=s?2:1,l=o.value.slice(0,r),c=o.value.slice(r+a),u=t.parts.slice(n+1),f="";for(let m of i)f+=await le(e,{type:"Word",parts:[m]});f+=l;let p={type:"Word",parts:c!==""?[{type:"Literal",value:c},...u]:u},h=p.parts.length>0?await le(e,p):"";return`${f}${s?"+=":"="}${h}`}var eC=["tar","yq","xan","sqlite3","python3","python"];function hy(e){return eC.includes(e)}he();En();Wn();un();Ae();Ae();var be=Object.freeze({stdout:"",stderr:"",exitCode:0});function Ee(e=""){return{stdout:e,stderr:"",exitCode:0}}function W(e,t=1){return{stdout:"",stderr:e,exitCode:t}}function z(e,t,n){return{stdout:e,stderr:t,exitCode:n}}function ft(e){return{stdout:"",stderr:"",exitCode:e?0:1}}function Kn(e,t,n="",r=""){throw new X(e,t,n,r)}function Ot(e){let t=e.state.fileDescriptors;if(t&&t.size>=e.limits.maxFileDescriptors)throw new X(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,"file_descriptors")}function _u(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Ln;return be}if(t.length>1)throw new we(1,"",`bash: break: too many arguments
799
+ `),e.writeFileLazy?e.writeFileLazy("/proc/self/status",()=>Bc(t)):e.writeFileSync("/proc/self/status",Bc(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 F2(e,t,n={pid:1,ppid:0,uid:1e3,gid:1e3}){$A(e)&&(TA(e,t),OA(e),RA(e,n))}En();er();Ae();var PA=["allexport","errexit","noglob","noclobber","noexec","nounset","pipefail","posix","verbose","xtrace"],DA=["braceexpand","hashall","interactive-comments"];function zc(e){let t=[],n=[...DA.map(r=>({name:r,enabled:!0})),...PA.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 Os(e){e.state.env.set("SHELLOPTS",zc(e.state.options))}var _A=["dotglob","expand_aliases","extglob","failglob","globskipdots","globstar","lastpipe","nocaseglob","nocasematch","nullglob","xpg_echo"];function Hc(e){let t=[];for(let n of _A)e[n]&&t.push(n);return t.join(":")}function jc(e){e.state.env.set("BASHOPTS",Hc(e.state.shoptOptions))}he();er();Gr();un();ct();Gr();var fS="BASH_ALIAS_";function kg(e){return e.parts.length!==1?!1:e.parts[0].type==="Literal"}function Ng(e){if(e.parts.length!==1)return null;let t=e.parts[0];return t.type==="Literal"?t.value:null}function Ig(e,t){return e.env.get(`${fS}${t}`)}function pu(e,t,n){if(!t.name||!kg(t.name))return t;let r=Ng(t.name);if(!r)return t;let s=Ig(e,r);if(!s||n.has(r))return t;try{n.add(r);let i=new pe,o=s,a=s.endsWith(" ");if(!a)for(let f of t.args){let p=Tg(f);o+=` ${p}`}let l;try{l=i.parse(o)}catch(f){if(f instanceof At)throw f;return t}if(l.statements.length!==1||l.statements[0].pipelines.length!==1||l.statements[0].pipelines[0].commands.length!==1)return $g(t,s);let c=l.statements[0].pipelines[0].commands[0];if(c.type!=="SimpleCommand")return $g(t,s);let u={...c,assignments:[...t.assignments,...c.assignments],redirections:[...c.redirections,...t.redirections],line:t.line};if(a&&t.args.length>0&&(u={...u,args:[...u.args,...t.args]},u.args.length>0)){let f=u.args[0];if(kg(f)){let p=Ng(f);if(p&&Ig(e,p)){let h={type:"SimpleCommand",name:f,args:u.args.slice(1),assignments:[],redirections:[]},d=pu(e,h,n);d!==h&&(u={...u,name:d.name,args:[...d.args]})}}}return u}catch(i){throw n.delete(r),i}}function $g(e,t){let n=t;for(let o of e.args){let a=Tg(o);n+=` ${a}`}let r=new pe,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 Tg(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}Ut();Bt();yn();async function fy(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=[],o=!1,a="",l=!1;for(let u of t.parts)if(u.type==="Literal"){let f=u.value;if(!o){let p=f.indexOf("=(");p!==-1&&(o=!0,f=f.slice(p+2))}if(o){f.endsWith(")")&&(f=f.slice(0,-1));let p=f.split(/(\s+)/);for(let h of p)/^\s+$/.test(h)?(a||l)&&(i.push(a),a="",l=!1):h&&(a+=h)}}else if(o)if(u.type==="BraceExpansion")if(/^\[.+\]=/.test(a))a+=Rs({type:"Word",parts:[u]});else{(a||l)&&(i.push(a),a="",l=!1);let p=await wn(e,{type:"Word",parts:[u]});i.push(...p.values)}else{(u.type==="SingleQuoted"||u.type==="DoubleQuoted"||u.type==="Escaped")&&(l=!0);let f=await le(e,{type:"Word",parts:[u]});a+=f}(a||l)&&i.push(a);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 py(e,t){let n=-1,r=-1,s=!1;for(let m=0;m<t.parts.length;m++){let g=t.parts[m];if(g.type==="Literal"){let y=g.value.indexOf("+=");if(y!==-1){let b=g.value.slice(0,y);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(b)){n=m,r=y,s=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(b)){n=m,r=y,s=!0;break}}let w=g.value.indexOf("=");if(w!==-1&&(w===0||g.value[w-1]!=="+")){let b=g.value.slice(0,w);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(b)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(b)){n=m,r=w;break}}}}if(n===-1)return null;let i=t.parts.slice(0,n),o=t.parts[n];if(o.type!=="Literal")return null;let a=s?2:1,l=o.value.slice(0,r),c=o.value.slice(r+a),u=t.parts.slice(n+1),f="";for(let m of i)f+=await le(e,{type:"Word",parts:[m]});f+=l;let p={type:"Word",parts:c!==""?[{type:"Literal",value:c},...u]:u},h=p.parts.length>0?await le(e,p):"";return`${f}${s?"+=":"="}${h}`}var eC=["tar","yq","xan","sqlite3","python3","python"];function hy(e){return eC.includes(e)}he();En();zn();un();Ae();Ae();var be=Object.freeze({stdout:"",stderr:"",exitCode:0});function Ee(e=""){return{stdout:e,stderr:"",exitCode:0}}function W(e,t=1){return{stdout:"",stderr:e,exitCode:t}}function z(e,t,n){return{stdout:e,stderr:t,exitCode:n}}function ft(e){return{stdout:"",stderr:"",exitCode:e?0:1}}function Kn(e,t,n="",r=""){throw new X(e,t,n,r)}function Ot(e){let t=e.state.fileDescriptors;if(t&&t.size>=e.limits.maxFileDescriptors)throw new X(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,"file_descriptors")}function _u(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Mn;return be}if(t.length>1)throw new we(1,"",`bash: break: too many arguments
800
800
  `);let n=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r)||r<1)throw new we(128,"",`bash: break: ${t[0]}: numeric argument required
801
801
  `);n=r}throw new It(n)}async function Fu(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 o=t.slice(i);if(o.length===0||o[0]==="~"?n=e.state.env.get("HOME")||"/":o[0]==="-"?(n=e.state.previousDir,r=!0):n=o[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 d=h.startsWith("/")?`${h}/${n}`:`${e.state.cwd}/${h}/${n}`;try{if((await e.fs.stat(d)).isDirectory){n=d,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 W(`bash: cd: ${n}: Not a directory
802
802
  `)}catch{return W(`bash: cd: ${n}: No such file or directory
803
803
  `)}}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),Ee(r?`${u}
804
- `:"")}ct();Tt();ct();Ze();Ut();Bt();yn();function Lu(e,t){return e.fs.resolvePath(e.state.cwd,t)}var tC=["-e","-a","-f","-d","-r","-w","-x","-s","-L","-h","-k","-g","-u","-G","-O","-b","-c","-p","-S","-t","-N"];function ga(e){return tC.includes(e)}async function ya(e,t,n){let r=Lu(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 nC=["-nt","-ot","-ef"];function wa(e){return nC.includes(e)}async function ba(e,t,n,r){let s=Lu(e,n),i=Lu(e,r);switch(t){case"-nt":try{let o=await e.fs.stat(s),a=await e.fs.stat(i);return o.mtime>a.mtime}catch{return!1}case"-ot":try{let o=await e.fs.stat(s),a=await e.fs.stat(i);return o.mtime<a.mtime}catch{return!1}case"-ef":try{if(!await e.fs.exists(s)||!await e.fs.exists(i))return!1;let o=e.fs.resolvePath(e.state.cwd,s),a=e.fs.resolvePath(e.state.cwd,i);return o===a}catch{return!1}default:return!1}}var rC=new Set(["-eq","-ne","-lt","-le","-gt","-ge"]);function xa(e){return rC.has(e)}function Ea(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 $i(e){return e==="="||e==="=="||e==="!="}function Aa(e,t,n,r=!1,s=!1,i=!1){if(r){let a=Us(t,n,s,i);return e==="!="?!a:a}if(s){let a=t.toLowerCase()===n.toLowerCase();return e==="!="?!a:a}let o=t===n;return e==="!="?!o:o}var sC=new Set(["-z","-n"]);function Sa(e){return sC.has(e)}function Ca(e,t){switch(e){case"-z":return t==="";case"-n":return t!==""}}Tt();ct();Ut();yn();async function va(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 a=s;return(a.startsWith("'")&&a.endsWith("'")||a.startsWith('"')&&a.endsWith('"'))&&(a=a.slice(1,-1)),a=a.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(l,c)=>e.state.env.get(c)||""),e.state.env.has(`${r}_${a}`)}let o;try{let a=new pe,l=Ne(a,s);o=await re(e,l.expression)}catch{if(/^-?\d+$/.test(s))o=Number.parseInt(s,10);else{let a=e.state.env.get(s);o=a?Number.parseInt(a,10):0}}if(o<0){let a=ut(e,r),l=e.state.currentLine;if(a.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${l}: ${r}: bad array subscript
804
+ `:"")}ct();Tt();ct();Ze();Ut();Bt();yn();function Lu(e,t){return e.fs.resolvePath(e.state.cwd,t)}var tC=["-e","-a","-f","-d","-r","-w","-x","-s","-L","-h","-k","-g","-u","-G","-O","-b","-c","-p","-S","-t","-N"];function ga(e){return tC.includes(e)}async function ya(e,t,n){let r=Lu(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 nC=["-nt","-ot","-ef"];function wa(e){return nC.includes(e)}async function ba(e,t,n,r){let s=Lu(e,n),i=Lu(e,r);switch(t){case"-nt":try{let o=await e.fs.stat(s),a=await e.fs.stat(i);return o.mtime>a.mtime}catch{return!1}case"-ot":try{let o=await e.fs.stat(s),a=await e.fs.stat(i);return o.mtime<a.mtime}catch{return!1}case"-ef":try{if(!await e.fs.exists(s)||!await e.fs.exists(i))return!1;let o=e.fs.resolvePath(e.state.cwd,s),a=e.fs.resolvePath(e.state.cwd,i);return o===a}catch{return!1}default:return!1}}var rC=new Set(["-eq","-ne","-lt","-le","-gt","-ge"]);function xa(e){return rC.has(e)}function Ea(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 $i(e){return e==="="||e==="=="||e==="!="}function Aa(e,t,n,r=!1,s=!1,i=!1){if(r){let a=Us(t,n,s,i);return e==="!="?!a:a}if(s){let a=t.toLowerCase()===n.toLowerCase();return e==="!="?!a:a}let o=t===n;return e==="!="?!o:o}var sC=new Set(["-z","-n"]);function Sa(e){return sC.has(e)}function Ca(e,t){switch(e){case"-z":return t==="";case"-n":return t!==""}}Tt();ct();Ut();yn();async function va(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 a=s;return(a.startsWith("'")&&a.endsWith("'")||a.startsWith('"')&&a.endsWith('"'))&&(a=a.slice(1,-1)),a=a.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(l,c)=>e.state.env.get(c)||""),e.state.env.has(`${r}_${a}`)}let o;try{let a=new pe,l=Ie(a,s);o=await re(e,l.expression)}catch{if(/^-?\d+$/.test(s))o=Number.parseInt(s,10);else{let a=e.state.env.get(s);o=a?Number.parseInt(a,10):0}}if(o<0){let a=ut(e,r),l=e.state.currentLine;if(a.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${l}: ${r}: bad array subscript
805
805
  `,!1;if(o=Math.max(...a)+1+o,o<0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${l}: ${r}: bad array subscript
806
- `,!1}return e.state.env.has(`${r}_${o}`)}return e.state.env.has(t)?!0:e.state.associativeArrays?.has(t)?In(e,t).length>0:ut(e,t).length>0}async function Sr(e,t){switch(t.type){case"CondBinary":{let n=await le(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 le(e,t.right);s=Ps(i)}else s=await $u(e,t.right);else $i(t.operator)&&!r?s=await Tu(e,t.right):s=await le(e,t.right);if($i(t.operator)){let i=e.state.shoptOptions.nocasematch;return Aa(t.operator,n,s,!r,i,!0)}if(xa(t.operator))return Ea(t.operator,await my(e,n),await my(e,s));if(wa(t.operator))return ba(e,t.operator,n,s);switch(t.operator){case"=~":try{let i=e.state.shoptOptions.nocasematch,o=lC(s),l=Q(o,i?"i":"").match(n);if(Gn(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 le(e,t.operand);return ga(t.operator)?ya(e,t.operator,n):Sa(t.operator)?Ca(t.operator,n):t.operator==="-v"?await va(e,n):t.operator==="-o"?Uu(e,n):!1}case"CondNot":return e.state.shoptOptions.extglob&&t.operand.type==="CondGroup"&&t.operand.expression.type==="CondWord"?`!(${await le(e,t.operand.expression.word)})`!=="":!await Sr(e,t.operand);case"CondAnd":return await Sr(e,t.left)?await Sr(e,t.right):!1;case"CondOr":return await Sr(e,t.left)?!0:await Sr(e,t.right);case"CondGroup":return await Sr(e,t.expression);case"CondWord":return await le(e,t.word)!=="";default:return!1}}async function Ti(e,t){if(t.length===0)return z("","",1);if(t.length===1)return ft(!!t[0]);if(t.length===2){let r=t[0],s=t[1];return r==="("?W(`test: '(' without matching ')'
806
+ `,!1}return e.state.env.has(`${r}_${o}`)}return e.state.env.has(t)?!0:e.state.associativeArrays?.has(t)?In(e,t).length>0:ut(e,t).length>0}async function Sr(e,t){switch(t.type){case"CondBinary":{let n=await le(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 le(e,t.right);s=Ps(i)}else s=await $u(e,t.right);else $i(t.operator)&&!r?s=await Tu(e,t.right):s=await le(e,t.right);if($i(t.operator)){let i=e.state.shoptOptions.nocasematch;return Aa(t.operator,n,s,!r,i,!0)}if(xa(t.operator))return Ea(t.operator,await my(e,n),await my(e,s));if(wa(t.operator))return ba(e,t.operator,n,s);switch(t.operator){case"=~":try{let i=e.state.shoptOptions.nocasematch,o=lC(s),l=Q(o,i?"i":"").match(n);if(Vn(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 le(e,t.operand);return ga(t.operator)?ya(e,t.operator,n):Sa(t.operator)?Ca(t.operator,n):t.operator==="-v"?await va(e,n):t.operator==="-o"?Uu(e,n):!1}case"CondNot":return e.state.shoptOptions.extglob&&t.operand.type==="CondGroup"&&t.operand.expression.type==="CondWord"?`!(${await le(e,t.operand.expression.word)})`!=="":!await Sr(e,t.operand);case"CondAnd":return await Sr(e,t.left)?await Sr(e,t.right):!1;case"CondOr":return await Sr(e,t.left)?!0:await Sr(e,t.right);case"CondGroup":return await Sr(e,t.expression);case"CondWord":return await le(e,t.word)!=="";default:return!1}}async function Ti(e,t){if(t.length===0)return z("","",1);if(t.length===1)return ft(!!t[0]);if(t.length===2){let r=t[0],s=t[1];return r==="("?W(`test: '(' without matching ')'
807
807
  `,2):ga(r)?ft(await ya(e,r,s)):Sa(r)?ft(Ca(r,s)):r==="!"?ft(!s):r==="-v"?ft(await va(e,s)):r==="-o"?ft(Uu(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"?W(`test: ${r}: unary operator expected
808
808
  `,2):z("","",1)}if(t.length===3){let r=t[0],s=t[1],i=t[2];if($i(s))return ft(Aa(s,r,i));if(xa(s)){let o=ka(r),a=ka(i);return!o.valid||!a.valid?z("","",2):ft(Ea(s,o.value,a.value))}if(wa(s))return ft(await ba(e,s,r,i));switch(s){case"-a":return ft(r!==""&&i!=="");case"-o":return ft(r!==""||i!=="");case">":return ft(r>i);case"<":return ft(r<i)}if(r==="!"){let o=await Ti(e,[s,i]);return z("",o.stderr,o.exitCode===0?1:o.exitCode===1?0:o.exitCode)}if(r==="("&&i===")")return ft(s!=="")}if(t.length===4){if(t[0]==="!"){let r=await Ti(e,t.slice(1));return z("",r.stderr,r.exitCode===0?1:r.exitCode===1?0:r.exitCode)}if(t[0]==="("&&t[3]===")")return Ti(e,[t[1],t[2]])}let n=await yy(e,t,0);return n.pos<t.length?W(`test: too many arguments
809
- `,2):ft(n.value)}async function yy(e,t,n){return iC(e,t,n)}async function iC(e,t,n){let{value:r,pos:s}=await dy(e,t,n);for(;t[s]==="-o";){let i=await dy(e,t,s+1);r=r||i.value,s=i.pos}return{value:r,pos:s}}async function dy(e,t,n){let{value:r,pos:s}=await Mu(e,t,n);for(;t[s]==="-a";){let i=await Mu(e,t,s+1);r=r&&i.value,s=i.pos}return{value:r,pos:s}}async function Mu(e,t,n){if(t[n]==="!"){let{value:r,pos:s}=await Mu(e,t,n+1);return{value:!r,pos:s}}return oC(e,t,n)}async function oC(e,t,n){let r=t[n];if(r==="("){let{value:i,pos:o}=await yy(e,t,n+1);return{value:i,pos:t[o]===")"?o+1:o}}let s=t[n+1];if($i(s)){let i=r,o=t[n+2]??"";return{value:Aa(s,i,o),pos:n+3}}if(xa(s)){let i=ka(r),o=ka(t[n+2]??"0");return!i.valid||!o.valid?{value:!1,pos:n+3}:{value:Ea(s,i.value,o.value),pos:n+3}}if(wa(s)){let i=r,o=t[n+2]??"";return{value:await ba(e,s,i,o),pos:n+3}}if(ga(r)){let i=t[n+1]??"";return{value:await ya(e,r,i),pos:n+2}}if(Sa(r)){let i=t[n+1]??"";return{value:Ca(r,i),pos:n+2}}if(r==="-v"){let i=t[n+1]??"";return{value:await va(e,i),pos:n+2}}if(r==="-o"){let i=t[n+1]??"";return{value:Uu(e,i),pos:n+2}}return{value:r!==void 0&&r!=="",pos:n+1}}function Us(e,t,n=!1,r=!1){let s=`^${wy(t,r)}$`;return Q(s,n?"is":"s").test(e)}function wy(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=by(e,r+1);if(i!==-1){let o=e.slice(r+2,i),a=xy(o),l=a.map(u=>wy(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=a.map(h=>Ey(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 d=[];h>0&&d.push(`.{0,${h-1}}`),d.push(`.{${h+1},}`),d.push(`(?!(?:${c})).{${h}}`),n+=`(?:${d.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 by(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 xy(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 Ey(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=by(e,r+1);if(i!==-1){if(s==="@"){let o=e.slice(r+2,i),l=xy(o).map(c=>Ey(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 Uu(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 my(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 gy(t);try{let n=new pe,r=Ne(n,t);return await re(e,r.expression)}catch{return gy(t)}}function aC(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 gy(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=aC(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 ka(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 lC(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=cC(e,n);t+=r.converted,n=r.endIndex}else t+=e[n],n++;return t}function cC(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 o="",a=!1;for(;n<e.length;){let l=e[n];if(l==="]"){a=!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);o+=uC(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);o+=p,n=f+2;continue}}}if(l==="\\"&&n+1<e.length){o+=l+e[n+1],n+=2;continue}o+=l,n++}return a?(s&&(r+="\\]"),i&&(r+="\\["),r+=o,r+="]",{converted:r,endIndex:n}):{converted:"\\[",endIndex:t+1}}function uC(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)??""}Bt();Tt();ct();Ut();xr();function Qn(e){let t=[],n="",r=!1,s=!1,i=!1,o=!1;for(let a of e){if(i){n+=a,i=!1,o=!0;continue}if(a==="\\"){i=!0;continue}if(a==="'"&&!s){r||(o=!0),r=!r;continue}if(a==='"'&&!r){s||(o=!0),s=!s;continue}if((a===" "||a===" "||a===`
810
- `)&&!r&&!s){o&&(t.push(n),n="",o=!1);continue}n+=a,o=!0}return o&&t.push(n),t}function Na(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 Ay(e){let t=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(t)return{name:t[1],isArray:!0,arrayElements:Qn(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 fC(e,t){try{let n=new pe,r=Ne(n,t);return await re(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}async function Sy(e,t,n={}){let{name:r,isArray:s,arrayElements:i,value:o,arrayIndex:a}=t,{makeReadonly:l=!1,checkReadonly:c=!0}=n;if(c){let u=bt(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(a!==void 0&&o!==void 0){let u=await fC(e,a);e.state.env.set(`${r}_${u}`,o);let f=parseInt(e.state.env.get(`${r}__length`)??"0",10);u>=f&&e.state.env.set(`${r}__length`,String(u+1))}else o!==void 0&&e.state.env.set(r,o);return l&&Jt(e,r),null}function Cr(e,t){e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,e.state.callDepth)}function Bs(e,t){return e.state.localVarDepth?.get(t)}function Ia(e,t){e.state.localVarDepth?.delete(t)}function Cy(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 $a(e,t){let n=e.state.localVarStack?.get(t);if(!(!n||n.length===0))return n.pop()}function vy(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)}}Ae();Bt();var Bu=new Set([":",".","break","continue","eval","exec","exit","export","readonly","return","set","shift","trap","unset"]);function ky(e){return Bu.has(e)}var Wu=new Set(["if","then","else","elif","fi","case","esac","for","select","while","until","do","done","in","function","{","}","time","[[","]]","!"]),Ws=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"]);Bt();async function Qr(e,t,n,r){try{if((await e.fs.stat(t)).isDirectory)return`bash: ${n}: Is a directory
809
+ `,2):ft(n.value)}async function yy(e,t,n){return iC(e,t,n)}async function iC(e,t,n){let{value:r,pos:s}=await dy(e,t,n);for(;t[s]==="-o";){let i=await dy(e,t,s+1);r=r||i.value,s=i.pos}return{value:r,pos:s}}async function dy(e,t,n){let{value:r,pos:s}=await Mu(e,t,n);for(;t[s]==="-a";){let i=await Mu(e,t,s+1);r=r&&i.value,s=i.pos}return{value:r,pos:s}}async function Mu(e,t,n){if(t[n]==="!"){let{value:r,pos:s}=await Mu(e,t,n+1);return{value:!r,pos:s}}return oC(e,t,n)}async function oC(e,t,n){let r=t[n];if(r==="("){let{value:i,pos:o}=await yy(e,t,n+1);return{value:i,pos:t[o]===")"?o+1:o}}let s=t[n+1];if($i(s)){let i=r,o=t[n+2]??"";return{value:Aa(s,i,o),pos:n+3}}if(xa(s)){let i=ka(r),o=ka(t[n+2]??"0");return!i.valid||!o.valid?{value:!1,pos:n+3}:{value:Ea(s,i.value,o.value),pos:n+3}}if(wa(s)){let i=r,o=t[n+2]??"";return{value:await ba(e,s,i,o),pos:n+3}}if(ga(r)){let i=t[n+1]??"";return{value:await ya(e,r,i),pos:n+2}}if(Sa(r)){let i=t[n+1]??"";return{value:Ca(r,i),pos:n+2}}if(r==="-v"){let i=t[n+1]??"";return{value:await va(e,i),pos:n+2}}if(r==="-o"){let i=t[n+1]??"";return{value:Uu(e,i),pos:n+2}}return{value:r!==void 0&&r!=="",pos:n+1}}function Us(e,t,n=!1,r=!1){let s=`^${wy(t,r)}$`;return Q(s,n?"is":"s").test(e)}function wy(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=by(e,r+1);if(i!==-1){let o=e.slice(r+2,i),a=xy(o),l=a.map(u=>wy(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=a.map(h=>Ey(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 d=[];h>0&&d.push(`.{0,${h-1}}`),d.push(`.{${h+1},}`),d.push(`(?!(?:${c})).{${h}}`),n+=`(?:${d.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 by(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 xy(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 Ey(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=by(e,r+1);if(i!==-1){if(s==="@"){let o=e.slice(r+2,i),l=xy(o).map(c=>Ey(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 Uu(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 my(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 gy(t);try{let n=new pe,r=Ie(n,t);return await re(e,r.expression)}catch{return gy(t)}}function aC(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 gy(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=aC(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 ka(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 lC(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=cC(e,n);t+=r.converted,n=r.endIndex}else t+=e[n],n++;return t}function cC(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 o="",a=!1;for(;n<e.length;){let l=e[n];if(l==="]"){a=!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);o+=uC(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);o+=p,n=f+2;continue}}}if(l==="\\"&&n+1<e.length){o+=l+e[n+1],n+=2;continue}o+=l,n++}return a?(s&&(r+="\\]"),i&&(r+="\\["),r+=o,r+="]",{converted:r,endIndex:n}):{converted:"\\[",endIndex:t+1}}function uC(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)??""}Bt();Tt();ct();Ut();xr();function Qn(e){let t=[],n="",r=!1,s=!1,i=!1,o=!1;for(let a of e){if(i){n+=a,i=!1,o=!0;continue}if(a==="\\"){i=!0;continue}if(a==="'"&&!s){r||(o=!0),r=!r;continue}if(a==='"'&&!r){s||(o=!0),s=!s;continue}if((a===" "||a===" "||a===`
810
+ `)&&!r&&!s){o&&(t.push(n),n="",o=!1);continue}n+=a,o=!0}return o&&t.push(n),t}function Na(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 Ay(e){let t=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(t)return{name:t[1],isArray:!0,arrayElements:Qn(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 fC(e,t){try{let n=new pe,r=Ie(n,t);return await re(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}async function Sy(e,t,n={}){let{name:r,isArray:s,arrayElements:i,value:o,arrayIndex:a}=t,{makeReadonly:l=!1,checkReadonly:c=!0}=n;if(c){let u=bt(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(a!==void 0&&o!==void 0){let u=await fC(e,a);e.state.env.set(`${r}_${u}`,o);let f=parseInt(e.state.env.get(`${r}__length`)??"0",10);u>=f&&e.state.env.set(`${r}__length`,String(u+1))}else o!==void 0&&e.state.env.set(r,o);return l&&Jt(e,r),null}function Cr(e,t){e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,e.state.callDepth)}function Bs(e,t){return e.state.localVarDepth?.get(t)}function Ia(e,t){e.state.localVarDepth?.delete(t)}function Cy(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 $a(e,t){let n=e.state.localVarStack?.get(t);if(!(!n||n.length===0))return n.pop()}function vy(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)}}Ae();Bt();var Bu=new Set([":",".","break","continue","eval","exec","exit","export","readonly","return","set","shift","trap","unset"]);function ky(e){return Bu.has(e)}var Wu=new Set(["if","then","else","elif","fi","case","esac","for","select","while","until","do","done","in","function","{","}","time","[[","]]","!"]),Ws=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"]);Bt();async function Qr(e,t,n,r){try{if((await e.fs.stat(t)).isDirectory)return`bash: ${n}: Is a directory
811
811
  `;if(r.checkNoclobber&&e.state.options.noclobber&&!r.isClobber&&n!=="/dev/null")return`bash: ${n}: cannot overwrite existing file
812
812
  `}catch{}return null}function vr(e){let n=Math.min(e.length,8192);for(let r=0;r<n;r++)if(e.charCodeAt(r)>127)return"utf8";return"binary"}function pC(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),o=s+r+1,a=t.slice(o),l=a.indexOf(":");if(l===-1)return null;let c=Number.parseInt(a.slice(0,l),10);if(Number.isNaN(c)||c<0)return null;let u=a.slice(l+1);return{path:i,position:c,content:u}}async function Ny(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(Ni(e,s.target))return{targets:n,error:`bash: $@: ambiguous redirect
813
813
  `};n.set(r,await le(e,s.target))}else{let o=await Ii(e,s.target);if("error"in o)return{targets:n,error:o.error};n.set(r,o.target)}}return{targets:n}}function hC(e){e.state.nextFd===void 0&&(e.state.nextFd=10);let t=e.state.nextFd,n=e.limits.maxFileDescriptors;if(t>=n)throw new Error(`bash: cannot allocate file descriptor: too many open files (max ${n})`);return e.state.nextFd++,t}async function Ta(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 le(e,n.target)==="-"){let i=e.state.env.get(n.fdVariable);if(i!==void 0){let o=Number.parseInt(i,10);Number.isNaN(o)||e.state.fileDescriptors.delete(o)}continue}let r=hC(e);if(e.state.env.set(n.fdVariable,String(r)),n.target.type==="Word"){let s=await le(e,n.target);if(n.operator===">&"||n.operator==="<&"){let i=Number.parseInt(s,10);if(!Number.isNaN(i)){let o=e.state.fileDescriptors.get(i);o!==void 0&&(Ot(e),e.state.fileDescriptors.set(r,o));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"),Ot(e),e.state.fileDescriptors.set(r,`__file__:${i}`)}else if(n.operator==="<<<")Ot(e),e.state.fileDescriptors.set(r,`${s}
@@ -869,7 +869,7 @@ Gid: ${s} ${s} ${s} ${s}
869
869
  `,2);s.push(c)}else if(l==="+o"){if(a++,a>=t.length)return W(`compopt: +o: option requires an argument
870
870
  `,2);let c=t[a];if(!Oy.includes(c))return W(`compopt: ${c}: invalid option name
871
871
  `,2);i.push(c)}else if(l==="--"){o.push(...t.slice(a+1));break}else!l.startsWith("-")&&!l.startsWith("+")&&o.push(l)}if(n){let a=e.state.completionSpecs.get("__default__")??{isDefault:!0},l=new Set(a.options??[]);for(let c of s)l.add(c);for(let c of i)l.delete(c);return a.options=l.size>0?Array.from(l):void 0,e.state.completionSpecs.set("__default__",a),Ee("")}if(r){let a=e.state.completionSpecs.get("__empty__")??{},l=new Set(a.options??[]);for(let c of s)l.add(c);for(let c of i)l.delete(c);return a.options=l.size>0?Array.from(l):void 0,e.state.completionSpecs.set("__empty__",a),Ee("")}if(o.length>0){for(let a of o){let l=e.state.completionSpecs.get(a)??{},c=new Set(l.options??[]);for(let u of s)c.add(u);for(let u of i)c.delete(u);l.options=c.size>0?Array.from(c):void 0,e.state.completionSpecs.set(a,l)}return Ee("")}return W(`compopt: not currently executing completion function
872
- `,1)}Ae();function Zu(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Ln;return be}if(t.length>1)throw new we(1,"",`bash: continue: too many arguments
872
+ `,1)}Ae();function Zu(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Mn;return be}if(t.length>1)throw new we(1,"",`bash: continue: too many arguments
873
873
  `);let n=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r)||r<1)throw new we(1,"",`bash: continue: ${t[0]}: numeric argument required
874
874
  `);n=r}throw new $t(n)}Tt();ct();Ut();yn();$n();xr();function st(e,t){let n=e.state.env.get("HOME")||"/home/user";return t.split(":").map(i=>i==="~"?n:i==="~root"?"/root":i.startsWith("~/")?n+i.slice(1):i.startsWith("~root/")?`/root${i.slice(5)}`:i).join(":")}yn();$n();function Ku(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return!0}return!1}function Qu(e){let t="$'";for(let n=0;n<e.length;n++){let r=e[n],s=e.charCodeAt(n);s===7?t+="\\a":s===8?t+="\\b":s===9?t+="\\t":s===10?t+="\\n":s===11?t+="\\v":s===12?t+="\\f":s===13?t+="\\r":s===27?t+="\\e":s===39?t+="\\'":s===92?t+="\\\\":s<32||s===127?t+=`\\${s.toString(8).padStart(3,"0")}`:t+=r}return t+="'",t}function Ra(e){return Ku(e)?Qu(e):/^[a-zA-Z0-9_/.:\-@%+,=]*$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}function Xr(e){return Ku(e)?Qu(e):`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Xu(e){return Ku(e)?Qu(e):`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Ry(e,t){let n="";return e.state.integerVars?.has(t)&&(n+="i"),e.state.lowercaseVars?.has(t)&&(n+="l"),We(e,t)&&(n+="n"),e.state.readonlyVars?.has(t)&&(n+="r"),e.state.uppercaseVars?.has(t)&&(n+="u"),e.state.exportedVars?.has(t)&&(n+="x"),n===""?"--":`-${n}`}function Yu(e){return e===""?"''":/[\s'\\]/.test(e)?`'${e.replace(/'/g,"'\\''")}'`:e}function Py(e,t){let n="",r="",s=!1;for(let i of t){let o=Ry(e,i);if(e.state.associativeArrays?.has(i)){let u=In(e,i);if(u.length===0)n+=`declare -A ${i}=()
875
875
  `;else{let f=u.map(p=>{let h=e.state.env.get(`${i}_${p}`)??"",d=Yu(h);return`['${p}']=${d}`});n+=`declare -A ${i}=(${f.join(" ")})
@@ -888,7 +888,7 @@ Gid: ${s} ${s} ${s} ${s}
888
888
  `}}return Ee(t)}function Fy(e){let t="",n=new Set;for(let s of e.state.env.keys()){if(s.startsWith("BASH_"))continue;if(s.endsWith("__length")){let o=s.slice(0,-8);e.state.associativeArrays?.has(o)||n.add(o);continue}let i=s.lastIndexOf("_");if(i>0){let o=s.slice(0,i),a=s.slice(i+1);/^\d+$/.test(a)&&(e.state.associativeArrays?.has(o)||n.add(o))}}let r=Array.from(n).sort();for(let s of r){let i=ut(e,s);if(i.length===0)t+=`declare -a ${s}=()
889
889
  `;else{let o=i.map(a=>{let l=e.state.env.get(`${s}_${a}`)??"";return`[${a}]=${Xr(l)}`});t+=`declare -a ${s}=(${o.join(" ")})
890
890
  `}}return Ee(t)}function Ly(e){let t="",n=new Set;for(let s of e.state.env.keys()){if(s.startsWith("BASH_"))continue;if(s.endsWith("__length")){let o=s.slice(0,-8);n.add(o);continue}let i=s.lastIndexOf("_");if(i>0){let o=s.slice(0,i),a=s.slice(i+1);if(/^\d+$/.test(a)||e.state.associativeArrays?.has(o)){n.add(o);continue}}n.add(s)}let r=Array.from(n).sort();for(let s of r){if(e.state.associativeArrays?.has(s)||ut(e,s).length>0||e.state.env.has(`${s}__length`))continue;let a=e.state.env.get(s);a!==void 0&&(t+=`${s}=${Ra(a)}
891
- `)}return Ee(t)}function Ju(e,t){e.state.integerVars??=new Set,e.state.integerVars.add(t)}function Oi(e,t){return e.state.integerVars?.has(t)??!1}function ef(e,t){e.state.lowercaseVars??=new Set,e.state.lowercaseVars.add(t),e.state.uppercaseVars?.delete(t)}function OC(e,t){return e.state.lowercaseVars?.has(t)??!1}function tf(e,t){e.state.uppercaseVars??=new Set,e.state.uppercaseVars.add(t),e.state.lowercaseVars?.delete(t)}function RC(e,t){return e.state.uppercaseVars?.has(t)??!1}function Hs(e,t,n){return OC(e,t)?n.toLowerCase():RC(e,t)?n.toUpperCase():n}async function My(e,t){try{let n=new pe,r=Ne(n,t),s=await re(e,r.expression);return String(s)}catch{return"0"}}function PC(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 o=e.slice(i,r);if(r++,e[r]!=="=")return null;r++;let a=e.slice(r);return{name:n,indexExpr:o,value:a}}async function nf(e,t){let n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,p=!1,h=!1,d=!1,m=!1,g=!1,y=[];for(let R=0;R<t.length;R++){let P=t[R];if(P==="-a")n=!0;else if(P==="-A")r=!0;else if(P==="-r")s=!0;else if(P==="-x")i=!0;else if(P==="-p")o=!0;else if(P==="-n")a=!0;else if(P==="+n")l=!0;else if(P==="+a")c=!0;else if(P==="+x")u=!0;else if(P==="--"){y.push(...t.slice(R+1));break}else if(P.startsWith("+")){for(let C of P.slice(1))if(C==="n")l=!0;else if(C==="a")c=!0;else if(C==="x")u=!0;else if(C!=="r"){if(C!=="i"){if(!(C==="f"||C==="F"))return z("",`bash: typeset: +${C}: invalid option
891
+ `)}return Ee(t)}function Ju(e,t){e.state.integerVars??=new Set,e.state.integerVars.add(t)}function Oi(e,t){return e.state.integerVars?.has(t)??!1}function ef(e,t){e.state.lowercaseVars??=new Set,e.state.lowercaseVars.add(t),e.state.uppercaseVars?.delete(t)}function OC(e,t){return e.state.lowercaseVars?.has(t)??!1}function tf(e,t){e.state.uppercaseVars??=new Set,e.state.uppercaseVars.add(t),e.state.lowercaseVars?.delete(t)}function RC(e,t){return e.state.uppercaseVars?.has(t)??!1}function Hs(e,t,n){return OC(e,t)?n.toLowerCase():RC(e,t)?n.toUpperCase():n}async function My(e,t){try{let n=new pe,r=Ie(n,t),s=await re(e,r.expression);return String(s)}catch{return"0"}}function PC(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 o=e.slice(i,r);if(r++,e[r]!=="=")return null;r++;let a=e.slice(r);return{name:n,indexExpr:o,value:a}}async function nf(e,t){let n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,p=!1,h=!1,d=!1,m=!1,g=!1,y=[];for(let R=0;R<t.length;R++){let P=t[R];if(P==="-a")n=!0;else if(P==="-A")r=!0;else if(P==="-r")s=!0;else if(P==="-x")i=!0;else if(P==="-p")o=!0;else if(P==="-n")a=!0;else if(P==="+n")l=!0;else if(P==="+a")c=!0;else if(P==="+x")u=!0;else if(P==="--"){y.push(...t.slice(R+1));break}else if(P.startsWith("+")){for(let C of P.slice(1))if(C==="n")l=!0;else if(C==="a")c=!0;else if(C==="x")u=!0;else if(C!=="r"){if(C!=="i"){if(!(C==="f"||C==="F"))return z("",`bash: typeset: +${C}: invalid option
892
892
  `,2)}}}else if(P==="-i")f=!0;else if(P==="-l")p=!0;else if(P==="-u")h=!0;else if(P==="-f")d=!0;else if(P==="-F")m=!0;else if(P==="-g")g=!0;else if(P.startsWith("-"))for(let C of P.slice(1))if(C==="a")n=!0;else if(C==="A")r=!0;else if(C==="r")s=!0;else if(C==="x")i=!0;else if(C==="p")o=!0;else if(C==="n")a=!0;else if(C==="i")f=!0;else if(C==="l")p=!0;else if(C==="u")h=!0;else if(C==="f")d=!0;else if(C==="F")m=!0;else if(C==="g")g=!0;else return z("",`bash: typeset: -${C}: invalid option
893
893
  `,2);else y.push(P)}let b=e.state.localScopes.length>0&&!g,x=R=>{if(!b)return;let P=e.state.localScopes[e.state.localScopes.length-1];P.has(R)||P.set(R,e.state.env.get(R))},S=R=>{if(!b)return;let P=e.state.localScopes[e.state.localScopes.length-1];P.has(R)||P.set(R,e.state.env.get(R));let C=`${R}_`;for(let O of e.state.env.keys())O.startsWith(C)&&!O.includes("__")&&(P.has(O)||P.set(O,e.state.env.get(O)));let T=`${R}__length`;e.state.env.has(T)&&!P.has(T)&&P.set(T,e.state.env.get(T))},v=R=>{b&&Cr(e,R)};if(m){if(y.length===0){let C=Array.from(e.state.functions.keys()).sort(),T="";for(let O of C)T+=`declare -f ${O}
894
894
  `;return Ee(T)}let R=!0,P="";for(let C of y)e.state.functions.has(C)?P+=`${C}
@@ -898,11 +898,11 @@ Gid: ${s} ${s} ${s} ${s}
898
898
  }
899
899
  `;return Ee(P)}let R=!0;for(let P of y)e.state.functions.has(P)||(R=!1);return z("","",R?0:1)}if(o&&y.length>0)return Py(e,y);if(o&&y.length===0)return Dy(e,{filterExport:i,filterReadonly:s,filterNameref:a,filterIndexedArray:n,filterAssocArray:r});if(y.length===0&&r&&!o)return _y(e);if(y.length===0&&n&&!o)return Fy(e);if(y.length===0&&!o)return Ly(e);let $="",_=0;for(let R of y){let P=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(P&&!c){let I=P[1],L=P[2];if(r&&ut(e,I).length>0){$+=`bash: declare: ${I}: cannot convert indexed to associative array
900
900
  `,_=1;continue}if((n||!r&&!n)&&e.state.associativeArrays?.has(I)){$+=`bash: declare: ${I}: cannot convert associative to indexed array
901
- `,_=1;continue}if(S(I),r&&(e.state.associativeArrays??=new Set,e.state.associativeArrays.add(I)),Gn(e,I),e.state.env.delete(I),e.state.env.delete(`${I}__length`),r&&L.includes("[")){let B=Na(L);for(let[Z,ae]of B){let ye=st(e,ae);e.state.env.set(`${I}_${Z}`,ye)}}else if(r){let B=Qn(L);for(let Z=0;Z<B.length;Z+=2){let ae=B[Z],ye=Z+1<B.length?st(e,B[Z+1]):"";e.state.env.set(`${I}_${ae}`,ye)}}else{let B=Qn(L);if(B.some(ae=>/^\[[^\]]+\]=/.test(ae))){let ae=0;for(let ye of B){let q=ye.match(/^\[([^\]]+)\]=(.*)$/);if(q){let H=q[1],te=q[2],ve=st(e,te),ie;if(/^-?\d+$/.test(H))ie=Number.parseInt(H,10);else try{let Pe=new pe,j=Ne(Pe,H);ie=await re(e,j.expression)}catch{ie=0}e.state.env.set(`${I}_${ie}`,ve),ae=ie+1}else{let H=st(e,ye);e.state.env.set(`${I}_${ae}`,H),ae++}}}else{for(let ae=0;ae<B.length;ae++)e.state.env.set(`${I}_${ae}`,B[ae]);e.state.env.set(`${I}__length`,String(B.length))}}v(I),s&&Jt(e,I),i&&Tn(e,I);continue}if(l){let I=R.includes("=")?R.slice(0,R.indexOf("=")):R;if(Mg(e,I),!R.includes("="))continue}if(u){let I=R.includes("=")?R.slice(0,R.indexOf("=")):R;if(la(e,I),!R.includes("="))continue}let C=PC(R);if(C){let{name:I,indexExpr:L,value:B}=C,Z=bt(e,I);if(Z)return Z;S(I);let ae;try{let q=new pe,H=Ne(q,L);ae=await re(e,H.expression)}catch{let q=parseInt(L,10);ae=Number.isNaN(q)?0:q}e.state.env.set(`${I}_${ae}`,B);let ye=parseInt(e.state.env.get(`${I}__length`)??"0",10);ae>=ye&&e.state.env.set(`${I}__length`,String(ae+1)),v(I),s&&Jt(e,I),i&&Tn(e,I);continue}let T=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(T&&!c){let I=T[1],L=T[2],B=bt(e,I);if(B)return B;S(I);let Z=Qn(L);if(e.state.associativeArrays?.has(I)){let ae=Na(L);for(let[ye,q]of ae){let H=st(e,q);e.state.env.set(`${I}_${ye}`,H)}}else{let ae=ut(e,I),ye=0,q=e.state.env.get(I);ae.length===0&&q!==void 0?(e.state.env.set(`${I}_0`,q),e.state.env.delete(I),ye=1):ae.length>0&&(ye=Math.max(...ae)+1);for(let te=0;te<Z.length;te++)e.state.env.set(`${I}_${ye+te}`,st(e,Z[te]));let H=ye+Z.length;e.state.env.set(`${I}__length`,String(H))}v(I),s&&Jt(e,I),i&&Tn(e,I);continue}let O=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(O){let I=O[1],L=st(e,O[2]),B=bt(e,I);if(B)return B;x(I),f&&Ju(e,I),p&&ef(e,I),h&&tf(e,I);let ae=ut(e,I).length>0||e.state.associativeArrays?.has(I);if(Oi(e,I)){let ye=e.state.env.get(I)??"0",q=parseInt(ye,10)||0,H=parseInt(await My(e,L),10)||0;L=String(q+H),e.state.env.set(I,L)}else if(ae){L=Hs(e,I,L);let ye=`${I}_0`,q=e.state.env.get(ye)??"";e.state.env.set(ye,q+L)}else{L=Hs(e,I,L);let ye=e.state.env.get(I)??"";e.state.env.set(I,ye+L)}v(I),s&&Jt(e,I),i&&Tn(e,I),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(I));continue}if(R.includes("=")){let I=R.indexOf("="),L=R.slice(0,I),B=R.slice(I+1);if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(L)){$+=`bash: typeset: \`${L}': not a valid identifier
901
+ `,_=1;continue}if(S(I),r&&(e.state.associativeArrays??=new Set,e.state.associativeArrays.add(I)),Vn(e,I),e.state.env.delete(I),e.state.env.delete(`${I}__length`),r&&L.includes("[")){let B=Na(L);for(let[Z,ae]of B){let ye=st(e,ae);e.state.env.set(`${I}_${Z}`,ye)}}else if(r){let B=Qn(L);for(let Z=0;Z<B.length;Z+=2){let ae=B[Z],ye=Z+1<B.length?st(e,B[Z+1]):"";e.state.env.set(`${I}_${ae}`,ye)}}else{let B=Qn(L);if(B.some(ae=>/^\[[^\]]+\]=/.test(ae))){let ae=0;for(let ye of B){let q=ye.match(/^\[([^\]]+)\]=(.*)$/);if(q){let H=q[1],te=q[2],ve=st(e,te),ie;if(/^-?\d+$/.test(H))ie=Number.parseInt(H,10);else try{let Pe=new pe,j=Ie(Pe,H);ie=await re(e,j.expression)}catch{ie=0}e.state.env.set(`${I}_${ie}`,ve),ae=ie+1}else{let H=st(e,ye);e.state.env.set(`${I}_${ae}`,H),ae++}}}else{for(let ae=0;ae<B.length;ae++)e.state.env.set(`${I}_${ae}`,B[ae]);e.state.env.set(`${I}__length`,String(B.length))}}v(I),s&&Jt(e,I),i&&On(e,I);continue}if(l){let I=R.includes("=")?R.slice(0,R.indexOf("=")):R;if(Mg(e,I),!R.includes("="))continue}if(u){let I=R.includes("=")?R.slice(0,R.indexOf("=")):R;if(la(e,I),!R.includes("="))continue}let C=PC(R);if(C){let{name:I,indexExpr:L,value:B}=C,Z=bt(e,I);if(Z)return Z;S(I);let ae;try{let q=new pe,H=Ie(q,L);ae=await re(e,H.expression)}catch{let q=parseInt(L,10);ae=Number.isNaN(q)?0:q}e.state.env.set(`${I}_${ae}`,B);let ye=parseInt(e.state.env.get(`${I}__length`)??"0",10);ae>=ye&&e.state.env.set(`${I}__length`,String(ae+1)),v(I),s&&Jt(e,I),i&&On(e,I);continue}let T=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(T&&!c){let I=T[1],L=T[2],B=bt(e,I);if(B)return B;S(I);let Z=Qn(L);if(e.state.associativeArrays?.has(I)){let ae=Na(L);for(let[ye,q]of ae){let H=st(e,q);e.state.env.set(`${I}_${ye}`,H)}}else{let ae=ut(e,I),ye=0,q=e.state.env.get(I);ae.length===0&&q!==void 0?(e.state.env.set(`${I}_0`,q),e.state.env.delete(I),ye=1):ae.length>0&&(ye=Math.max(...ae)+1);for(let te=0;te<Z.length;te++)e.state.env.set(`${I}_${ye+te}`,st(e,Z[te]));let H=ye+Z.length;e.state.env.set(`${I}__length`,String(H))}v(I),s&&Jt(e,I),i&&On(e,I);continue}let O=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(O){let I=O[1],L=st(e,O[2]),B=bt(e,I);if(B)return B;x(I),f&&Ju(e,I),p&&ef(e,I),h&&tf(e,I);let ae=ut(e,I).length>0||e.state.associativeArrays?.has(I);if(Oi(e,I)){let ye=e.state.env.get(I)??"0",q=parseInt(ye,10)||0,H=parseInt(await My(e,L),10)||0;L=String(q+H),e.state.env.set(I,L)}else if(ae){L=Hs(e,I,L);let ye=`${I}_0`,q=e.state.env.get(ye)??"";e.state.env.set(ye,q+L)}else{L=Hs(e,I,L);let ye=e.state.env.get(I)??"";e.state.env.set(I,ye+L)}v(I),s&&Jt(e,I),i&&On(e,I),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(I));continue}if(R.includes("=")){let I=R.indexOf("="),L=R.slice(0,I),B=R.slice(I+1);if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(L)){$+=`bash: typeset: \`${L}': not a valid identifier
902
902
  `,_=1;continue}let Z=bt(e,L);if(Z)return Z;if(x(L),a){if(B!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(B)){$+=`bash: declare: \`${B}': invalid variable name for name reference
903
- `,_=1;continue}e.state.env.set(L,B),sr(e,L),B!==""&&oa(e,B)&&xu(e,L),v(L),s&&Jt(e,L),i&&Tn(e,L);continue}if(f&&Ju(e,L),p&&ef(e,L),h&&tf(e,L),Oi(e,L)&&(B=await My(e,B)),B=Hs(e,L,B),We(e,L)){let ae=Mt(e,L);ae&&ae!==L?e.state.env.set(ae,B):e.state.env.set(L,B)}else e.state.env.set(L,B);v(L),s&&Jt(e,L),i&&Tn(e,L),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(L))}else{let I=R;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(I)){$+=`bash: typeset: \`${I}': not a valid identifier
904
- `,_=1;continue}if(n||r?S(I):x(I),a){sr(e,I);let B=e.state.env.get(I);B!==void 0&&B!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(B)?Ug(e,I):B&&oa(e,B)&&xu(e,I),v(I),s&&Jt(e,I),i&&Tn(e,I);continue}if(f&&Ju(e,I),p&&ef(e,I),h&&tf(e,I),r){if(ut(e,I).length>0){$+=`bash: declare: ${I}: cannot convert indexed to associative array
905
- `,_=1;continue}e.state.associativeArrays??=new Set,e.state.associativeArrays.add(I)}let L=Array.from(e.state.env.keys()).some(B=>B.startsWith(`${I}_`)&&!B.startsWith(`${I}__length`));!e.state.env.has(I)&&!L&&(n||r?e.state.env.set(`${I}__length`,"0"):(e.state.declaredVars??=new Set,e.state.declaredVars.add(I))),v(I),s&&Jt(e,I),i&&Tn(e,I)}}return z("",$,_)}async function rf(e,t){let n=!1,r=!1,s=!1,i=[];for(let o=0;o<t.length;o++){let a=t[o];if(a==="-a")n=!0;else if(a==="-A")r=!0;else if(a==="-p")s=!0;else if(a==="--"){i.push(...t.slice(o+1));break}else a.startsWith("-")||i.push(a)}if(i.length===0){let o="",a=Array.from(e.state.readonlyVars||[]).sort();for(let l of a){let c=e.state.env.get(l);if(c!==void 0){let u=c.replace(/\\/g,"\\\\").replace(/"/g,'\\"');o+=`declare -r ${l}="${u}"
903
+ `,_=1;continue}e.state.env.set(L,B),sr(e,L),B!==""&&oa(e,B)&&xu(e,L),v(L),s&&Jt(e,L),i&&On(e,L);continue}if(f&&Ju(e,L),p&&ef(e,L),h&&tf(e,L),Oi(e,L)&&(B=await My(e,B)),B=Hs(e,L,B),We(e,L)){let ae=Mt(e,L);ae&&ae!==L?e.state.env.set(ae,B):e.state.env.set(L,B)}else e.state.env.set(L,B);v(L),s&&Jt(e,L),i&&On(e,L),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(L))}else{let I=R;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(I)){$+=`bash: typeset: \`${I}': not a valid identifier
904
+ `,_=1;continue}if(n||r?S(I):x(I),a){sr(e,I);let B=e.state.env.get(I);B!==void 0&&B!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(B)?Ug(e,I):B&&oa(e,B)&&xu(e,I),v(I),s&&Jt(e,I),i&&On(e,I);continue}if(f&&Ju(e,I),p&&ef(e,I),h&&tf(e,I),r){if(ut(e,I).length>0){$+=`bash: declare: ${I}: cannot convert indexed to associative array
905
+ `,_=1;continue}e.state.associativeArrays??=new Set,e.state.associativeArrays.add(I)}let L=Array.from(e.state.env.keys()).some(B=>B.startsWith(`${I}_`)&&!B.startsWith(`${I}__length`));!e.state.env.has(I)&&!L&&(n||r?e.state.env.set(`${I}__length`,"0"):(e.state.declaredVars??=new Set,e.state.declaredVars.add(I))),v(I),s&&Jt(e,I),i&&On(e,I)}}return z("",$,_)}async function rf(e,t){let n=!1,r=!1,s=!1,i=[];for(let o=0;o<t.length;o++){let a=t[o];if(a==="-a")n=!0;else if(a==="-A")r=!0;else if(a==="-p")s=!0;else if(a==="--"){i.push(...t.slice(o+1));break}else a.startsWith("-")||i.push(a)}if(i.length===0){let o="",a=Array.from(e.state.readonlyVars||[]).sort();for(let l of a){let c=e.state.env.get(l);if(c!==void 0){let u=c.replace(/\\/g,"\\\\").replace(/"/g,'\\"');o+=`declare -r ${l}="${u}"
906
906
  `}}return Ee(o)}for(let o of i){let a=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(a){let f=a[1],p=a[2],h=bt(e,f);if(h)return h;let d=Qn(p);if(e.state.associativeArrays?.has(f)){let m=Na(p);for(let[g,y]of m){let w=st(e,y);e.state.env.set(`${f}_${g}`,w)}}else{let m=ut(e,f),g=0,y=e.state.env.get(f);m.length===0&&y!==void 0?(e.state.env.set(`${f}_0`,y),e.state.env.delete(f),g=1):m.length>0&&(g=Math.max(...m)+1);for(let b=0;b<d.length;b++)e.state.env.set(`${f}_${g+b}`,st(e,d[b]));let w=g+d.length;e.state.env.set(`${f}__length`,String(w))}Jt(e,f);continue}let l=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(l){let f=l[1],p=st(e,l[2]),h=bt(e,f);if(h)return h;let d=e.state.env.get(f)??"";e.state.env.set(f,d+p),Jt(e,f);continue}let c=Ay(o);if(c.value===void 0&&!c.isArray){Jt(e,c.name);continue}let u=await Sy(e,c,{makeReadonly:!0});if(u)return u}return be}function sf(e){return e.state.directoryStack??=[],e.state.directoryStack}function Ri(e,t){return t&&e===t?"~":t&&e.startsWith(`${t}/`)?`~${e.slice(t.length)}`:e}function DC(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 of(e,t){let n=sf(e),r;for(let a=0;a<t.length;a++){let l=t[a];if(l==="--"){if(a+1<t.length){if(r!==void 0)return W(`bash: pushd: too many arguments
907
907
  `,2);r=t[a+1],a++}}else{if(l.startsWith("-")&&l!=="-")return W(`bash: pushd: ${l}: invalid option
908
908
  `,2);if(r!==void 0)return W(`bash: pushd: too many arguments
@@ -928,7 +928,7 @@ eval: usage: eval [arg ...]
928
928
  `);throw a}finally{e.state.groupStdin=i}}Ae();function cf(e,t){let n,r="";if(t.length===0)n=e.state.lastExitCode;else{let s=t[0],i=Number.parseInt(s,10);s===""||Number.isNaN(i)||!/^-?\d+$/.test(s)?(r=`bash: exit: ${s}: numeric argument required
929
929
  `,n=2):n=(i%256+256)%256}throw new we(n,"",r)}xr();function uf(e,t){let n=!1,r=[];for(let o of t)o==="-n"?n=!0:o==="-p"||o==="--"||r.push(o);if(r.length===0&&!n){let o="",a=e.state.exportedVars??new Set,l=Array.from(a).sort();for(let c of l){let u=e.state.env.get(c);if(u!==void 0){let f=u.replace(/\\/g,"\\\\").replace(/"/g,'\\"');o+=`declare -x ${c}="${f}"
930
930
  `}}return Ee(o)}if(n){for(let o of r){let a,l;if(o.includes("=")){let c=o.indexOf("=");a=o.slice(0,c),l=st(e,o.slice(c+1)),e.state.env.set(a,l)}else a=o;la(e,a)}return be}let s="",i=0;for(let o of r){let a,l,c=!1,u=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(u)a=u[1],l=st(e,u[2]),c=!0;else if(o.includes("=")){let f=o.indexOf("=");a=o.slice(0,f),l=st(e,o.slice(f+1))}else a=o;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a)){s+=`bash: export: \`${o}': not a valid identifier
931
- `,i=1;continue}if(l!==void 0)if(c){let f=e.state.env.get(a)??"";e.state.env.set(a,f+l)}else e.state.env.set(a,l);else e.state.env.has(a)||e.state.env.set(a,"");Tn(e,a)}return z("",s,i)}function Da(e,t){if(t.length<2)return W(`bash: getopts: usage: getopts optstring name [arg ...]
931
+ `,i=1;continue}if(l!==void 0)if(c){let f=e.state.env.get(a)??"";e.state.env.set(a,f+l)}else e.state.env.set(a,l);else e.state.env.has(a)||e.state.env.set(a,"");On(e,a)}return z("",s,i)}function Da(e,t){if(t.length<2)return W(`bash: getopts: usage: getopts optstring name [arg ...]
932
932
  `);let n=t[0],r=t[1],s=!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r),i=n.startsWith(":"),o=i?n.slice(1):n,a;if(t.length>2)a=t.slice(2);else{let m=Number.parseInt(e.state.env.get("#")||"0",10);a=[];for(let g=1;g<=m;g++)a.push(e.state.env.get(String(g))||"")}let l=Number.parseInt(e.state.env.get("OPTIND")||"1",10);l<1&&(l=1);let c=Number.parseInt(e.state.env.get("__GETOPTS_CHARINDEX")||"0",10);if(e.state.env.set("OPTARG",""),l>a.length)return s||e.state.env.set(r,"?"),e.state.env.set("OPTIND",String(a.length+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),{exitCode:s?2:1,stdout:"",stderr:""};let u=a[l-1];if(!u||u==="-"||!u.startsWith("-"))return s||e.state.env.set(r,"?"),{exitCode:s?2:1,stdout:"",stderr:""};if(u==="--")return e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),s||e.state.env.set(r,"?"),{exitCode:s?2:1,stdout:"",stderr:""};let f=c===0?1:c,p=u[f];if(!p)return e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),Da(e,t);let h=o.indexOf(p);if(h===-1){let m="";return i?e.state.env.set("OPTARG",p):m=`bash: illegal option -- ${p}
933
933
  `,s||e.state.env.set(r,"?"),f+1<u.length?(e.state.env.set("__GETOPTS_CHARINDEX",String(f+1)),e.state.env.set("OPTIND",String(l))):(e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0")),{exitCode:s?2:0,stdout:"",stderr:m}}if(h+1<o.length&&o[h+1]===":")if(f+1<u.length)e.state.env.set("OPTARG",u.slice(f+1)),e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0");else{if(l>=a.length){let m="";return i?(e.state.env.set("OPTARG",p),s||e.state.env.set(r,":")):(m=`bash: option requires an argument -- ${p}
934
934
  `,s||e.state.env.set(r,"?")),e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),{exitCode:s?2:0,stdout:"",stderr:m}}e.state.env.set("OPTARG",a[l]),e.state.env.set("OPTIND",String(l+2)),e.state.env.set("__GETOPTS_CHARINDEX","0")}else f+1<u.length?(e.state.env.set("__GETOPTS_CHARINDEX",String(f+1)),e.state.env.set("OPTIND",String(l))):(e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"));return s||e.state.env.set(r,p),{exitCode:s?2:0,stdout:"",stderr:""}}async function ff(e,t){e.state.hashTable||(e.state.hashTable=new Map);let n=!1,r=!1,s=!1,i=!1,o=!1,a="",l=[],c=0;for(;c<t.length;){let d=t[c];if(d==="--"){c++,l.push(...t.slice(c));break}if(d==="-r")n=!0,c++;else if(d==="-d")r=!0,c++;else if(d==="-l")s=!0,c++;else if(d==="-t")o=!0,c++;else if(d==="-p"){if(i=!0,c++,c>=t.length)return W(`bash: hash: -p: option requires an argument
@@ -1304,19 +1304,19 @@ ${h}
1304
1304
  `)}return z("","",r===0?1:0)}Tt();ct();Ut();yn();$n();xr();async function df(e,t){if(e.state.localScopes.length===0)return W(`bash: local: can only be used in a function
1305
1305
  `);let n=e.state.localScopes[e.state.localScopes.length-1],r="",s=0,i=!1,o=!1,a=!1,l=[];for(let c of t)if(c==="-n")i=!0;else if(c==="-a")o=!0;else if(c==="-p")a=!0;else if(c.startsWith("-")&&!c.includes("="))for(let u of c.slice(1))u==="n"?i=!0:u==="a"?o=!0:u==="p"&&(a=!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}
1306
1306
  `)}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 y=p[2];if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){r+=`bash: local: \`${c}': not a valid identifier
1307
- `,s=1;continue}if(bt(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 w=`${u}_`;for(let x of e.state.env.keys())x.startsWith(w)&&!x.includes("__")&&e.state.env.delete(x);let b=Qn(y);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)),Cr(e,u),i&&sr(e,u);continue}let h=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(h){u=h[1];let y=h[2];if(bt(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let $=`${u}_`;for(let R of e.state.env.keys())R.startsWith($)&&!R.includes("__")&&(n.has(R)||n.set(R,e.state.env.get(R)));let _=`${u}__length`;e.state.env.has(_)&&!n.has(_)&&n.set(_,e.state.env.get(_))}let w=Qn(y),b=ut(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 $=0;$<w.length;$++)e.state.env.set(`${u}_${x+$}`,st(e,w[$]));let v=x+w.length;e.state.env.set(`${u}__length`,String(v)),Cr(e,u),i&&sr(e,u);continue}let d=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(d){u=d[1];let y=st(e,d[2]);bt(e,u,"bash"),n.has(u)||n.set(u,e.state.env.get(u));let w=e.state.env.get(u)??"";e.state.env.set(u,w+y),Cr(e,u),i&&sr(e,u);continue}let m=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(m){u=m[1];let y=m[2],w=st(e,m[3]);if(bt(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let S=`${u}_`;for(let $ of e.state.env.keys())$.startsWith(S)&&!$.includes("__")&&(n.has($)||n.set($,e.state.env.get($)));let v=`${u}__length`;e.state.env.has(v)&&!n.has(v)&&n.set(v,e.state.env.get(v))}let b;try{let S=new pe,v=Ne(S,y);b=await re(e,v.expression)}catch{let S=parseInt(y,10);b=Number.isNaN(S)?0:S}e.state.env.set(`${u}_${b}`,w);let x=parseInt(e.state.env.get(`${u}__length`)??"0",10);b>=x&&e.state.env.set(`${u}__length`,String(b+1)),Cr(e,u),i&&sr(e,u);continue}if(c.includes("=")){let y=c.indexOf("=");u=c.slice(0,y),f=st(e,c.slice(y+1))}else u=c;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){r+=`bash: local: \`${c}': not a valid identifier
1307
+ `,s=1;continue}if(bt(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 w=`${u}_`;for(let x of e.state.env.keys())x.startsWith(w)&&!x.includes("__")&&e.state.env.delete(x);let b=Qn(y);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)),Cr(e,u),i&&sr(e,u);continue}let h=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(h){u=h[1];let y=h[2];if(bt(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let $=`${u}_`;for(let R of e.state.env.keys())R.startsWith($)&&!R.includes("__")&&(n.has(R)||n.set(R,e.state.env.get(R)));let _=`${u}__length`;e.state.env.has(_)&&!n.has(_)&&n.set(_,e.state.env.get(_))}let w=Qn(y),b=ut(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 $=0;$<w.length;$++)e.state.env.set(`${u}_${x+$}`,st(e,w[$]));let v=x+w.length;e.state.env.set(`${u}__length`,String(v)),Cr(e,u),i&&sr(e,u);continue}let d=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(d){u=d[1];let y=st(e,d[2]);bt(e,u,"bash"),n.has(u)||n.set(u,e.state.env.get(u));let w=e.state.env.get(u)??"";e.state.env.set(u,w+y),Cr(e,u),i&&sr(e,u);continue}let m=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(m){u=m[1];let y=m[2],w=st(e,m[3]);if(bt(e,u,"bash"),!n.has(u)){n.set(u,e.state.env.get(u));let S=`${u}_`;for(let $ of e.state.env.keys())$.startsWith(S)&&!$.includes("__")&&(n.has($)||n.set($,e.state.env.get($)));let v=`${u}__length`;e.state.env.has(v)&&!n.has(v)&&n.set(v,e.state.env.get(v))}let b;try{let S=new pe,v=Ie(S,y);b=await re(e,v.expression)}catch{let S=parseInt(y,10);b=Number.isNaN(S)?0:S}e.state.env.set(`${u}_${b}`,w);let x=parseInt(e.state.env.get(`${u}__length`)??"0",10);b>=x&&e.state.env.set(`${u}__length`,String(b+1)),Cr(e,u),i&&sr(e,u);continue}if(c.includes("=")){let y=c.indexOf("=");u=c.slice(0,y),f=st(e,c.slice(y+1))}else u=c;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)){r+=`bash: local: \`${c}': not a valid identifier
1308
1308
  `,s=1;continue}let g=n.has(u);if(f!==void 0){let y=e.state.env.get(u);if(e.state.tempEnvBindings){let w=e.state.accessedTempEnvVars?.has(u),b=e.state.mutatedTempEnvVars?.has(u);if(!w&&!b)for(let x=e.state.tempEnvBindings.length-1;x>=0;x--){let S=e.state.tempEnvBindings[x];if(S.has(u)){y=S.get(u);break}}}Cy(e,u,y)}if(!g){let y=e.state.env.get(u);if(e.state.tempEnvBindings)for(let w=e.state.tempEnvBindings.length-1;w>=0;w--){let b=e.state.tempEnvBindings[w];if(b.has(u)){y=b.get(u);break}}if(n.set(u,y),o){let w=`${u}_`;for(let x of e.state.env.keys())x.startsWith(w)&&!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(o&&f===void 0){let y=`${u}_`;for(let w of e.state.env.keys())w.startsWith(y)&&!w.includes("__")&&e.state.env.delete(w);e.state.env.set(`${u}__length`,"0")}else if(f!==void 0){if(bt(e,u,"bash"),i&&f!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(f)){r+=`bash: local: \`${f}': invalid variable name for name reference
1309
1309
  `,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 y=e.state.tempEnvBindings?.some(w=>w.has(u));!g&&!y&&e.state.env.delete(u)}Cr(e,u),i&&sr(e,u)}return z("",r,s)}yn();function mf(e,t,n){let r=`
1310
1310
  `,s=0,i=0,o=0,a=!1,l="MAPFILE",c=0;for(;c<t.length;){let w=t[c];w==="-d"&&c+1<t.length?(r=t[c+1]===""?"\0":t[c+1]||`
1311
1311
  `,c+=2):w==="-n"&&c+1<t.length?(s=Number.parseInt(t[c+1],10)||0,c+=2):w==="-O"&&c+1<t.length?(i=Number.parseInt(t[c+1],10)||0,c+=2):w==="-s"&&c+1<t.length?(o=Number.parseInt(t[c+1],10)||0,c+=2):w==="-t"?(a=!0,c++):w==="-u"||w==="-C"||w==="-c"?c+=2:(w.startsWith("-")||(l=w),c++)}let u=n;!u&&e.state.groupStdin!==void 0&&(u=e.state.groupStdin);let f=[],p=u,h=0,d=0,m=e.limits?.maxArrayElements??1e5;for(;p.length>0;){let w=p.indexOf(r);if(w===-1){if(p.length>0){if(d<o)d++;else if(s===0||h<s){if(i+h>=m)return z("",`mapfile: array element limit exceeded (${m})
1312
1312
  `,1);let S=p,v=S.indexOf("\0");v!==-1&&(S=S.substring(0,v)),f.push(S),h++}}break}let b=p.substring(0,w),x=b.indexOf("\0");if(x!==-1&&(b=b.substring(0,x)),!a&&r!=="\0"&&(b+=r),p=p.substring(w+r.length),d<o){d++;continue}if(s>0&&h>=s)break;if(i+h>=m)return z("",`mapfile: array element limit exceeded (${m})
1313
- `,1);f.push(b),h++}i===0&&Gn(e,l);for(let w=0;w<f.length;w++)e.state.env.set(`${l}_${i+w}`,f[w]);let g=parseInt(e.state.env.get(`${l}__length`)||"0",10),y=i+f.length;return e.state.env.set(`${l}__length`,String(Math.max(g,y))),e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=""),z("","",0)}yn();an();function MC(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),o=s+r+1,a=t.slice(o),l=a.indexOf(":");if(l===-1)return null;let c=Number.parseInt(a.slice(0,l),10);if(Number.isNaN(c)||c<0)return null;let u=a.slice(l+1);return{path:i,position:c,content:u}}function UC(e,t,n){return`__rw__:${e.length}:${e}:${t}:${n}`}function gf(e,t,n,r=-1){let s=!1,i=`
1314
- `,o="",a=-1,l=-1,c=null,u=-1,f=-1,p=[],h=0,d=!1,m=(C,T)=>{let O=1;for(;O<C.length;){let I=C[O];if(I==="r")s=!0,O++;else if(I==="s")O++;else{if(I==="d")return O+1<C.length?(i=C.substring(O+1),{nextArgIndex:T+1}):T+1<t.length?(i=t[T+1],{nextArgIndex:T+2}):{nextArgIndex:T+1};if(I==="n"){if(O+1<C.length){let L=C.substring(O+1);return a=Number.parseInt(L,10),(Number.isNaN(a)||a<0)&&(d=!0,a=0),{nextArgIndex:T+1}}else if(T+1<t.length)return a=Number.parseInt(t[T+1],10),(Number.isNaN(a)||a<0)&&(d=!0,a=0),{nextArgIndex:T+2};return{nextArgIndex:T+1}}else if(I==="N"){if(O+1<C.length){let L=C.substring(O+1);return l=Number.parseInt(L,10),(Number.isNaN(l)||l<0)&&(d=!0,l=0),{nextArgIndex:T+1}}else if(T+1<t.length)return l=Number.parseInt(t[T+1],10),(Number.isNaN(l)||l<0)&&(d=!0,l=0),{nextArgIndex:T+2};return{nextArgIndex:T+1}}else{if(I==="a")return O+1<C.length?(c=C.substring(O+1),{nextArgIndex:T+1}):T+1<t.length?(c=t[T+1],{nextArgIndex:T+2}):{nextArgIndex:T+1};if(I==="p")return O+1<C.length?(o=C.substring(O+1),{nextArgIndex:T+1}):T+1<t.length?(o=t[T+1],{nextArgIndex:T+2}):{nextArgIndex:T+1};if(I==="u"){if(O+1<C.length){let L=C.substring(O+1);return u=Number.parseInt(L,10),Number.isNaN(u)||u<0?{nextArgIndex:-2}:{nextArgIndex:T+1}}else if(T+1<t.length)return u=Number.parseInt(t[T+1],10),Number.isNaN(u)||u<0?{nextArgIndex:-2}:{nextArgIndex:T+2};return{nextArgIndex:T+1}}else if(I==="t"){if(O+1<C.length){let L=C.substring(O+1);return f=Number.parseFloat(L),Number.isNaN(f)&&(f=0),{nextArgIndex:T+1}}else if(T+1<t.length)return f=Number.parseFloat(t[T+1]),Number.isNaN(f)&&(f=0),{nextArgIndex:T+2};return{nextArgIndex:T+1}}else if(I==="e"||I==="i"||I==="P"){if(I==="i"&&T+1<t.length)return{nextArgIndex:T+2};O++}else O++}}}return{nextArgIndex:T+1}};for(;h<t.length;){let C=t[h];if(C.startsWith("-")&&C.length>1&&C!=="--"){let T=m(C,h);if(T.nextArgIndex===-1)return{stdout:"",stderr:"",exitCode:2};if(T.nextArgIndex===-2)return{stdout:"",stderr:"",exitCode:1};h=T.nextArgIndex}else if(C==="--")for(h++;h<t.length;)p.push(t[h]),h++;else p.push(C),h++}if(d)return z("","",1);if(p.length===0&&c===null&&p.push("REPLY"),f===0){if(c)Gn(e,c);else{for(let C of p)e.state.env.set(C,"");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 y=i===""?"\0":i,w="",b=0,x=!0,S=C=>{if(u>=0&&e.state.fileDescriptors)e.state.fileDescriptors.set(u,g.substring(C));else if(r>=0&&e.state.fileDescriptors){let T=e.state.fileDescriptors.get(r);if(T?.startsWith("__rw__:")){let O=MC(T);if(O){let I=O.position+C;e.state.fileDescriptors.set(r,UC(O.path,I,O.content))}}}else e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=g.substring(C))};if(l>=0){let C=Math.min(l,g.length);w=g.substring(0,C),b=C,x=C>=l,S(b);let T=p[0]||"REPLY";e.state.env.set(T,w);for(let O=1;O<p.length;O++)e.state.env.set(p[O],"");return z("","",x?0:1)}else if(a>=0){let C=0,T=0,O=!1;for(;T<g.length&&C<a;){let I=g[T];if(I===y){b=T+1,O=!0;break}if(!s&&I==="\\"&&T+1<g.length){let L=g[T+1];if(L===y&&y===`
1313
+ `,1);f.push(b),h++}i===0&&Vn(e,l);for(let w=0;w<f.length;w++)e.state.env.set(`${l}_${i+w}`,f[w]);let g=parseInt(e.state.env.get(`${l}__length`)||"0",10),y=i+f.length;return e.state.env.set(`${l}__length`,String(Math.max(g,y))),e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=""),z("","",0)}yn();an();function MC(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),o=s+r+1,a=t.slice(o),l=a.indexOf(":");if(l===-1)return null;let c=Number.parseInt(a.slice(0,l),10);if(Number.isNaN(c)||c<0)return null;let u=a.slice(l+1);return{path:i,position:c,content:u}}function UC(e,t,n){return`__rw__:${e.length}:${e}:${t}:${n}`}function gf(e,t,n,r=-1){let s=!1,i=`
1314
+ `,o="",a=-1,l=-1,c=null,u=-1,f=-1,p=[],h=0,d=!1,m=(C,T)=>{let O=1;for(;O<C.length;){let I=C[O];if(I==="r")s=!0,O++;else if(I==="s")O++;else{if(I==="d")return O+1<C.length?(i=C.substring(O+1),{nextArgIndex:T+1}):T+1<t.length?(i=t[T+1],{nextArgIndex:T+2}):{nextArgIndex:T+1};if(I==="n"){if(O+1<C.length){let L=C.substring(O+1);return a=Number.parseInt(L,10),(Number.isNaN(a)||a<0)&&(d=!0,a=0),{nextArgIndex:T+1}}else if(T+1<t.length)return a=Number.parseInt(t[T+1],10),(Number.isNaN(a)||a<0)&&(d=!0,a=0),{nextArgIndex:T+2};return{nextArgIndex:T+1}}else if(I==="N"){if(O+1<C.length){let L=C.substring(O+1);return l=Number.parseInt(L,10),(Number.isNaN(l)||l<0)&&(d=!0,l=0),{nextArgIndex:T+1}}else if(T+1<t.length)return l=Number.parseInt(t[T+1],10),(Number.isNaN(l)||l<0)&&(d=!0,l=0),{nextArgIndex:T+2};return{nextArgIndex:T+1}}else{if(I==="a")return O+1<C.length?(c=C.substring(O+1),{nextArgIndex:T+1}):T+1<t.length?(c=t[T+1],{nextArgIndex:T+2}):{nextArgIndex:T+1};if(I==="p")return O+1<C.length?(o=C.substring(O+1),{nextArgIndex:T+1}):T+1<t.length?(o=t[T+1],{nextArgIndex:T+2}):{nextArgIndex:T+1};if(I==="u"){if(O+1<C.length){let L=C.substring(O+1);return u=Number.parseInt(L,10),Number.isNaN(u)||u<0?{nextArgIndex:-2}:{nextArgIndex:T+1}}else if(T+1<t.length)return u=Number.parseInt(t[T+1],10),Number.isNaN(u)||u<0?{nextArgIndex:-2}:{nextArgIndex:T+2};return{nextArgIndex:T+1}}else if(I==="t"){if(O+1<C.length){let L=C.substring(O+1);return f=Number.parseFloat(L),Number.isNaN(f)&&(f=0),{nextArgIndex:T+1}}else if(T+1<t.length)return f=Number.parseFloat(t[T+1]),Number.isNaN(f)&&(f=0),{nextArgIndex:T+2};return{nextArgIndex:T+1}}else if(I==="e"||I==="i"||I==="P"){if(I==="i"&&T+1<t.length)return{nextArgIndex:T+2};O++}else O++}}}return{nextArgIndex:T+1}};for(;h<t.length;){let C=t[h];if(C.startsWith("-")&&C.length>1&&C!=="--"){let T=m(C,h);if(T.nextArgIndex===-1)return{stdout:"",stderr:"",exitCode:2};if(T.nextArgIndex===-2)return{stdout:"",stderr:"",exitCode:1};h=T.nextArgIndex}else if(C==="--")for(h++;h<t.length;)p.push(t[h]),h++;else p.push(C),h++}if(d)return z("","",1);if(p.length===0&&c===null&&p.push("REPLY"),f===0){if(c)Vn(e,c);else{for(let C of p)e.state.env.set(C,"");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 y=i===""?"\0":i,w="",b=0,x=!0,S=C=>{if(u>=0&&e.state.fileDescriptors)e.state.fileDescriptors.set(u,g.substring(C));else if(r>=0&&e.state.fileDescriptors){let T=e.state.fileDescriptors.get(r);if(T?.startsWith("__rw__:")){let O=MC(T);if(O){let I=O.position+C;e.state.fileDescriptors.set(r,UC(O.path,I,O.content))}}}else e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=g.substring(C))};if(l>=0){let C=Math.min(l,g.length);w=g.substring(0,C),b=C,x=C>=l,S(b);let T=p[0]||"REPLY";e.state.env.set(T,w);for(let O=1;O<p.length;O++)e.state.env.set(p[O],"");return z("","",x?0:1)}else if(a>=0){let C=0,T=0,O=!1;for(;T<g.length&&C<a;){let I=g[T];if(I===y){b=T+1,O=!0;break}if(!s&&I==="\\"&&T+1<g.length){let L=g[T+1];if(L===y&&y===`
1315
1315
  `){T+=2,b=T;continue}if(L===y){T+=2,C++,w+=L,b=T;continue}w+=L,T+=2,C++,b=T}else w+=I,T++,C++,b=T}x=C>=a||O,S(b)}else{b=0;let C=0;for(;C<g.length;){let T=g[C];if(T===y){b=C+y.length,x=!0;break}if(!s&&T==="\\"&&C+1<g.length){let O=g[C+1];if(O===`
1316
- `){C+=2;continue}if(O===y){w+=O,C+=2;continue}w+=T,w+=O,C+=2;continue}w+=T,C++}if(C>=g.length&&(x=!1,b=C,w.length===0&&g.length===0)){for(let T of p)e.state.env.set(T,"");return c&&Gn(e,c),z("","",1)}S(b)}y===`
1316
+ `){C+=2;continue}if(O===y){w+=O,C+=2;continue}w+=T,w+=O,C+=2;continue}w+=T,C++}if(C>=g.length&&(x=!1,b=C,w.length===0&&g.length===0)){for(let T of p)e.state.env.set(T,"");return c&&Vn(e,c),z("","",1)}S(b)}y===`
1317
1317
  `&&w.endsWith(`
1318
1318
  `)&&(w=w.slice(0,-1));let v=C=>s?C:C.replace(/\\(.)/g,"$1");if(p.length===1&&p[0]==="REPLY")return e.state.env.set("REPLY",v(w)),z("","",x?0:1);let $=yt(e.state.env);if(c){let{words:C}=bu(w,$,void 0,s),T=e.limits?.maxArrayElements??1e5;if(C.length>T)return z("",`read: array element limit exceeded (${T})
1319
- `,1);Gn(e,c);for(let O=0;O<C.length;O++)e.state.env.set(`${c}_${O}`,v(C[O]));return z("","",x?0:1)}let _=p.length,{words:R,wordStarts:P}=bu(w,$,_,s);for(let C=0;C<p.length;C++){let T=p[C];if(C<p.length-1)e.state.env.set(T,v(R[C]??""));else if(C<P.length){let O=w.substring(P[C]);O=Lg(O,$,s),O=v(O),e.state.env.set(T,O)}else e.state.env.set(T,"")}return z("","",x?0:1)}Ae();function yf(e,t){if(e.state.callDepth===0&&e.state.sourceDepth===0)return W("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 W(`bash: return: ${r}: numeric argument required
1319
+ `,1);Vn(e,c);for(let O=0;O<C.length;O++)e.state.env.set(`${c}_${O}`,v(C[O]));return z("","",x?0:1)}let _=p.length,{words:R,wordStarts:P}=bu(w,$,_,s);for(let C=0;C<p.length;C++){let T=p[C];if(C<p.length-1)e.state.env.set(T,v(R[C]??""));else if(C<P.length){let O=w.substring(P[C]);O=Lg(O,$,s),O=v(O),e.state.env.set(T,O)}else e.state.env.set(T,"")}return z("","",x?0:1)}Ae();function yf(e,t){if(e.state.callDepth===0&&e.state.sourceDepth===0)return W("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 W(`bash: return: ${r}: numeric argument required
1320
1320
  `,2);n=(s%256+256)%256}throw new St(n)}Ae();yn();var _a=`set: usage: set [-eux] [+eux] [-o option] [+o option]
1321
1321
  Options:
1322
1322
  -e Exit immediately if a command exits with non-zero status
@@ -1344,10 +1344,10 @@ ${_a}`;if(e.state.options.posix)throw new nn(1,"",i);return W(i)}Gy(e,zy.get(s)?
1344
1344
  ${_a}`;if(e.state.options.posix)throw new nn(1,"",a);return W(a)}Gy(e,Wy.get(o)??null,s)}n++;continue}if(r==="--")return wf(e,t.slice(n+1)),be;if(r==="-"){if(e.state.options.xtrace=!1,e.state.options.verbose=!1,Os(e),n+1<t.length)return wf(e,t.slice(n+1)),be;n++;continue}if(r==="+"){n++;continue}if(r.startsWith("-")||r.startsWith("+")){let s=`bash: set: ${r}: invalid option
1345
1345
  ${_a}`;if(e.state.options.posix)throw new nn(1,"",s);return W(s)}return wf(e,t.slice(n)),be}return be}function wf(e,t){let n=1;for(;e.state.env.has(String(n));)e.state.env.delete(String(n)),n++;for(let r=0;r<t.length;r++)e.state.env.set(String(r+1),t[r]);e.state.env.set("#",String(t.length)),e.state.env.set("@",t.join(" ")),e.state.env.set("*",t.join(" "))}Ae();function xf(e,t){let n=1;if(t.length>0){let o=Number.parseInt(t[0],10);if(Number.isNaN(o)||o<0){let a=`bash: shift: ${t[0]}: numeric argument required
1346
1346
  `;if(e.state.options.posix)throw new nn(1,"",a);return W(a)}n=o}let r=Number.parseInt(e.state.env.get("#")||"0",10);if(n>r){let o=`bash: shift: shift count out of range
1347
- `;if(e.state.options.posix)throw new nn(1,"",o);return W(o)}if(n===0)return be;let s=[];for(let o=1;o<=r;o++)s.push(e.state.env.get(String(o))||"");let i=s.slice(n);for(let o=1;o<=r;o++)e.state.env.delete(String(o));for(let o=0;o<i.length;o++)e.state.env.set(String(o+1),i[o]);return e.state.env.set("#",String(i.length)),e.state.env.set("@",i.join(" ")),be}ct();Ae();async function Ef(e,t){let n=t;if(n.length>0&&n[0]==="--"&&(n=n.slice(1)),n.length===0)return z("",`bash: source: filename argument required
1348
- `,2);let r=n[0],s=null,i=null;if(r.includes("/")){let c=e.fs.resolvePath(e.state.cwd,r);try{i=await e.fs.readFile(c),s=c}catch{}}else{let u=(e.state.env.get("PATH")||"").split(":").filter(f=>f);for(let f of u){let p=e.fs.resolvePath(e.state.cwd,`${f}/${r}`);try{if((await e.fs.stat(p)).isDirectory)continue;i=await e.fs.readFile(p),s=p;break}catch{}}if(i===null){let f=e.fs.resolvePath(e.state.cwd,r);try{i=await e.fs.readFile(f),s=f}catch{}}}if(i===null)return W(`bash: ${r}: No such file or directory
1349
- `);let o=new Map;if(n.length>1){for(let u=1;u<=9;u++)o.set(String(u),e.state.env.get(String(u)));o.set("#",e.state.env.get("#")),o.set("@",e.state.env.get("@"));let c=n.slice(1);e.state.env.set("#",String(c.length)),e.state.env.set("@",c.join(" "));for(let u=0;u<c.length&&u<9;u++)e.state.env.set(String(u+1),c[u]);for(let u=c.length+1;u<=9;u++)e.state.env.delete(String(u))}let a=e.state.currentSource,l=()=>{if(e.state.sourceDepth--,e.state.currentSource=a,n.length>1)for(let[c,u]of o)u===void 0?e.state.env.delete(c):e.state.env.set(c,u)};if(e.state.sourceDepth++,e.state.sourceDepth>e.limits.maxSourceDepth)throw e.state.sourceDepth--,new X(`source: maximum nesting depth (${e.limits.maxSourceDepth}) exceeded, increase executionLimits.maxSourceDepth`,"recursion");e.state.currentSource=r;try{let c=Nn(i),u=await e.executeScript(c);return l(),u}catch(c){if(l(),c instanceof we)throw c;if(c instanceof St)return z(c.stdout,c.stderr,c.exitCode);if(c.name==="ParseException")return W(`bash: ${r}: ${c.message}
1350
- `);throw c}}Tt();ct();Ut();Xt();Bt();$n();xr();function Vy(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function VC(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')}async function qy(e,t){if(VC(t))return null;try{let n=new pe,r=Ne(n,t);return await re(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}function Zy(e,t){if(e.state.localVarStack?.has(t)){let r=$a(e,t);if(r){r.value===void 0?e.state.env.delete(t):e.state.env.set(t,r.value);let s=e.state.localVarStack?.get(t);if(!s||s.length===0)Ia(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,r.scopeIndex),Af(e,t);else{let i=s[s.length-1];e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,i.scopeIndex+1)}return!0}return e.state.env.delete(t),Ia(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,0),!0}for(let r=e.state.localScopes.length-1;r>=0;r--){let s=e.state.localScopes[r];if(s.has(t)){let i=s.get(t);i===void 0?e.state.env.delete(t):e.state.env.set(t,i),s.delete(t);let o=!1;for(let a=r-1;a>=0;a--)if(e.state.localScopes[a].has(t)){e.state.localVarDepth&&e.state.localVarDepth.set(t,a+1),o=!0;break}return o||Ia(e,t),!0}}return!1}function Af(e,t){if(!e.state.tempEnvBindings||e.state.tempEnvBindings.length===0)return!1;for(let n=e.state.tempEnvBindings.length-1;n>=0;n--){let r=e.state.tempEnvBindings[n];if(r.has(t)){let s=r.get(t);return s===void 0?e.state.env.delete(t):e.state.env.set(t,s),r.delete(t),!0}}return!1}async function Ky(e,t){if(t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t.startsWith('"')&&t.endsWith('"')){let n=t.slice(1,-1),s=new pe().parseWordFromString(n,!0,!1);return le(e,s)}if(t.includes("$")){let r=new pe().parseWordFromString(t,!1,!1);return le(e,r)}return t}async function Sf(e,t){let n="both",r="",s=0;for(let i of t){if(i==="-v"){n="variable";continue}if(i==="-f"){n="function";continue}if(n==="function"){e.state.functions.delete(i);continue}if(n==="variable"){let c=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(c){let p=c[1],h=c[2];if(h==="@"||h==="*"){let b=ce(e,p);for(let[x]of b)e.state.env.delete(`${p}_${x}`);e.state.env.delete(p);continue}let d=e.state.associativeArrays?.has(p);if(d){let b=await Ky(e,h);e.state.env.delete(`${p}_${b}`);continue}let m=ir(e,p),g=e.state.declaredVars?.has(p);if((e.state.env.has(p)||g)&&!m&&!d){r+=`bash: unset: ${p}: not an array variable
1347
+ `;if(e.state.options.posix)throw new nn(1,"",o);return W(o)}if(n===0)return be;let s=[];for(let o=1;o<=r;o++)s.push(e.state.env.get(String(o))||"");let i=s.slice(n);for(let o=1;o<=r;o++)e.state.env.delete(String(o));for(let o=0;o<i.length;o++)e.state.env.set(String(o+1),i[o]);return e.state.env.set("#",String(i.length)),e.state.env.set("@",i.join(" ")),be}ct();Ae();async function Ef(e,t,n){let r=t;if(r.length>0&&r[0]==="--"&&(r=r.slice(1)),r.length===0)return z("",`bash: source: filename argument required
1348
+ `,2);let s=r[0],i=null,o=null;if(s.includes("/")){let p=e.fs.resolvePath(e.state.cwd,s);try{o=await e.fs.readFile(p),i=p}catch{}}else{let h=(e.state.env.get("PATH")||"").split(":").filter(d=>d);for(let d of h){let m=e.fs.resolvePath(e.state.cwd,`${d}/${s}`);try{if((await e.fs.stat(m)).isDirectory)continue;o=await e.fs.readFile(m),i=m;break}catch{}}if(o===null){let d=e.fs.resolvePath(e.state.cwd,s);try{o=await e.fs.readFile(d),i=d}catch{}}}if(o===null)return W(`bash: ${s}: No such file or directory
1349
+ `);let a=new Map;if(r.length>1){for(let h=1;h<=9;h++)a.set(String(h),e.state.env.get(String(h)));a.set("#",e.state.env.get("#")),a.set("@",e.state.env.get("@"));let p=r.slice(1);e.state.env.set("#",String(p.length)),e.state.env.set("@",p.join(" "));for(let h=0;h<p.length&&h<9;h++)e.state.env.set(String(h+1),p[h]);for(let h=p.length+1;h<=9;h++)e.state.env.delete(String(h))}let l=e.state.currentSource,c=()=>{if(e.state.sourceDepth--,e.state.currentSource=l,r.length>1)for(let[p,h]of a)h===void 0?e.state.env.delete(p):e.state.env.set(p,h)};if(e.state.sourceDepth++,e.state.sourceDepth>e.limits.maxSourceDepth)throw e.state.sourceDepth--,new X(`source: maximum nesting depth (${e.limits.maxSourceDepth}) exceeded, increase executionLimits.maxSourceDepth`,"recursion");e.state.currentSource=s;let u=e.state.groupStdin,f=n??e.state.groupStdin;f!==void 0&&(e.state.groupStdin=f);try{let p=Nn(o),h=await e.executeScript(p);return c(),h}catch(p){if(c(),p instanceof we)throw p;if(p instanceof St)return z(p.stdout,p.stderr,p.exitCode);if(p.name==="ParseException")return W(`bash: ${s}: ${p.message}
1350
+ `);throw p}finally{e.state.groupStdin=u}}Tt();ct();Ut();Xt();Bt();$n();xr();function Vy(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function VC(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')}async function qy(e,t){if(VC(t))return null;try{let n=new pe,r=Ie(n,t);return await re(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}function Zy(e,t){if(e.state.localVarStack?.has(t)){let r=$a(e,t);if(r){r.value===void 0?e.state.env.delete(t):e.state.env.set(t,r.value);let s=e.state.localVarStack?.get(t);if(!s||s.length===0)Ia(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,r.scopeIndex),Af(e,t);else{let i=s[s.length-1];e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,i.scopeIndex+1)}return!0}return e.state.env.delete(t),Ia(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,0),!0}for(let r=e.state.localScopes.length-1;r>=0;r--){let s=e.state.localScopes[r];if(s.has(t)){let i=s.get(t);i===void 0?e.state.env.delete(t):e.state.env.set(t,i),s.delete(t);let o=!1;for(let a=r-1;a>=0;a--)if(e.state.localScopes[a].has(t)){e.state.localVarDepth&&e.state.localVarDepth.set(t,a+1),o=!0;break}return o||Ia(e,t),!0}}return!1}function Af(e,t){if(!e.state.tempEnvBindings||e.state.tempEnvBindings.length===0)return!1;for(let n=e.state.tempEnvBindings.length-1;n>=0;n--){let r=e.state.tempEnvBindings[n];if(r.has(t)){let s=r.get(t);return s===void 0?e.state.env.delete(t):e.state.env.set(t,s),r.delete(t),!0}}return!1}async function Ky(e,t){if(t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t.startsWith('"')&&t.endsWith('"')){let n=t.slice(1,-1),s=new pe().parseWordFromString(n,!0,!1);return le(e,s)}if(t.includes("$")){let r=new pe().parseWordFromString(t,!1,!1);return le(e,r)}return t}async function Sf(e,t){let n="both",r="",s=0;for(let i of t){if(i==="-v"){n="variable";continue}if(i==="-f"){n="function";continue}if(n==="function"){e.state.functions.delete(i);continue}if(n==="variable"){let c=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(c){let p=c[1],h=c[2];if(h==="@"||h==="*"){let b=ce(e,p);for(let[x]of b)e.state.env.delete(`${p}_${x}`);e.state.env.delete(p);continue}let d=e.state.associativeArrays?.has(p);if(d){let b=await Ky(e,h);e.state.env.delete(`${p}_${b}`);continue}let m=ir(e,p),g=e.state.declaredVars?.has(p);if((e.state.env.has(p)||g)&&!m&&!d){r+=`bash: unset: ${p}: not an array variable
1351
1351
  `,s=1;continue}let w=await qy(e,h);if(w===null&&m){r+=`bash: unset: ${h}: not a valid identifier
1352
1352
  `,s=1;continue}if(w===null)continue;if(w<0){let b=ce(e,p),x=b.length,S=e.state.currentLine;if(x===0){r+=`bash: line ${S}: unset: [${w}]: bad array subscript
1353
1353
  `,s=1;continue}let v=x+w;if(v<0){r+=`bash: line ${S}: unset: [${w}]: bad array subscript
@@ -1373,7 +1373,7 @@ ${_a}`;if(e.state.options.posix)throw new nn(1,"",s);return W(s)}return wf(e,t.s
1373
1373
  `:"",stderr:""}}let c=!1,u="",f=[];for(let p of t){let h=o.has(p),d=a.includes(p);if(!h&&!d){u+=`shopt: ${p}: invalid option name
1374
1374
  `,c=!0;continue}if(d){n||r||(i?c=!0:s?(f.push(`set +o ${p}`),c=!0):(f.push(`${p} off`),c=!0));continue}let m=o.get(p);if(m)if(n)m==="vi"?e.state.options.emacs=!1:m==="emacs"&&(e.state.options.vi=!1),e.state.options[m]=!0,Os(e);else if(r)e.state.options[m]=!1,Os(e);else{let g=e.state.options[m];i?g||(c=!0):s?(f.push(`set ${g?"-o":"+o"} ${p}`),g||(c=!0)):(f.push(`${p} ${g?"on":"off"}`),g||(c=!0))}}return{exitCode:c?1:0,stdout:f.length>0?`${f.join(`
1375
1375
  `)}
1376
- `:"",stderr:u}}async function Xy(e,t,n){if(t.includes("/")){let o=e.fs.resolvePath(e.state.cwd,t);if(!await e.fs.exists(o))return{error:"not_found",path:o};let a=o.split("/").pop()||t,l=e.commands.get(a);try{let c=await e.fs.stat(o);return c.isDirectory?{error:"permission_denied",path:o}:l?{cmd:l,path:o}:(c.mode&73)!==0?{script:!0,path:o}:{error:"permission_denied",path:o}}catch{return{error:"not_found",path:o}}}if(!n&&e.state.hashTable){let o=e.state.hashTable.get(t);if(o)if(await e.fs.exists(o)){let a=e.commands.get(t);if(a)return{cmd:a,path:o};try{let l=await e.fs.stat(o);if(!l.isDirectory&&(l.mode&73)!==0)return{script:!0,path:o}}catch{}}else e.state.hashTable.delete(t)}let s=(n??e.state.env.get("PATH")??"/usr/bin:/bin").split(":");for(let o of s){if(!o)continue;let l=`${o.startsWith("/")?o:e.fs.resolvePath(e.state.cwd,o)}/${t}`;if(await e.fs.exists(l))try{let c=await e.fs.stat(l);if(c.isDirectory)continue;let u=(c.mode&73)!==0,f=e.commands.get(t),p=o==="/bin"||o==="/usr/bin";if(f&&p)return{cmd:f,path:l};if(u){if(f&&!p)return{script:!0,path:l};if(!f)return{script:!0,path:l}}}catch{}}if(!await e.fs.exists("/usr/bin")){let o=e.commands.get(t);if(o)return{cmd:o,path:`/usr/bin/${t}`}}return null}async function La(e,t){let n=[];if(t.includes("/")){let i=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(i))try{let o=await e.fs.stat(i);o.isDirectory||(o.mode&73)!==0&&n.push(t)}catch{}return n}let s=(e.state.env.get("PATH")||"/usr/bin:/bin").split(":");for(let i of s){if(!i)continue;let a=`${i.startsWith("/")?i:e.fs.resolvePath(e.state.cwd,i)}/${t}`;if(await e.fs.exists(a)){try{if((await e.fs.stat(a)).isDirectory)continue}catch{continue}n.push(i.startsWith("/")?a:`${i}/${t}`)}}return n}Wn();function QC(e){return e!==null&&typeof e=="object"&&"then"in e&&typeof e.then=="function"}function Ke(e,t,n,r){return((...s)=>{it(t,n,`${r} call`);let i=e(...s);return QC(i)?i.then(o=>(it(t,n,`${r} post-await`),o),o=>{throw it(t,n,`${r} post-await`),o}):(it(t,n,`${r} return`),i)})}function XC(e,t,n){let r={readFile:Ke(e.readFile.bind(e),t,n,"fs.readFile"),...typeof e.readFileBytes=="function"?{readFileBytes:Ke(e.readFileBytes.bind(e),t,n,"fs.readFileBytes")}:Object.create(null),readFileBuffer:Ke(e.readFileBuffer.bind(e),t,n,"fs.readFileBuffer"),writeFile:Ke(e.writeFile.bind(e),t,n,"fs.writeFile"),appendFile:Ke(e.appendFile.bind(e),t,n,"fs.appendFile"),exists:Ke(e.exists.bind(e),t,n,"fs.exists"),stat:Ke(e.stat.bind(e),t,n,"fs.stat"),mkdir:Ke(e.mkdir.bind(e),t,n,"fs.mkdir"),readdir:Ke(e.readdir.bind(e),t,n,"fs.readdir"),rm:Ke(e.rm.bind(e),t,n,"fs.rm"),cp:Ke(e.cp.bind(e),t,n,"fs.cp"),mv:Ke(e.mv.bind(e),t,n,"fs.mv"),resolvePath:Ke(e.resolvePath.bind(e),t,n,"fs.resolvePath"),getAllPaths:Ke(e.getAllPaths.bind(e),t,n,"fs.getAllPaths"),chmod:Ke(e.chmod.bind(e),t,n,"fs.chmod"),symlink:Ke(e.symlink.bind(e),t,n,"fs.symlink"),link:Ke(e.link.bind(e),t,n,"fs.link"),readlink:Ke(e.readlink.bind(e),t,n,"fs.readlink"),lstat:Ke(e.lstat.bind(e),t,n,"fs.lstat"),realpath:Ke(e.realpath.bind(e),t,n,"fs.realpath"),utimes:Ke(e.utimes.bind(e),t,n,"fs.utimes")};return e.readdirWithFileTypes&&(r.readdirWithFileTypes=Ke(e.readdirWithFileTypes.bind(e),t,n,"fs.readdirWithFileTypes")),r}function Yy(e,t){if(!e.requireDefenseContext)return e;let n=`command:${t}`,r={...e,fs:XC(e.fs,e.requireDefenseContext,n)};return e.exec&&(r.exec=Ke(e.exec,e.requireDefenseContext,n,"exec")),e.fetch&&(r.fetch=Ke(e.fetch,e.requireDefenseContext,n,"fetch")),e.sleep&&(r.sleep=Ke(e.sleep,e.requireDefenseContext,n,"sleep")),e.getRegisteredCommands&&(r.getRegisteredCommands=Ke(e.getRegisteredCommands,e.requireDefenseContext,n,"getRegisteredCommands")),r}Ae();rn();async function n7(e,t,n,r){let s=!1,i=!1,o=!1,a=!1,l=!1,c=[];for(let m of t)if(m.startsWith("-")&&m.length>1)for(let g of m.slice(1))g==="t"?s=!0:g==="p"?i=!0:g==="P"?o=!0:g==="a"?a=!0:g==="f"&&(l=!0);else c.push(m);let u="",f="",p=0,h=!1,d=!1;for(let m of c){let g=!1;if(o){if(a){let v=await r(m);if(v.length>0){for(let $ of v)u+=`${$}
1376
+ `:"",stderr:u}}async function Xy(e,t,n){if(t.includes("/")){let o=e.fs.resolvePath(e.state.cwd,t);if(!await e.fs.exists(o))return{error:"not_found",path:o};let a=o.split("/").pop()||t,l=e.commands.get(a);try{let c=await e.fs.stat(o);return c.isDirectory?{error:"permission_denied",path:o}:l?{cmd:l,path:o}:(c.mode&73)!==0?{script:!0,path:o}:{error:"permission_denied",path:o}}catch{return{error:"not_found",path:o}}}if(!n&&e.state.hashTable){let o=e.state.hashTable.get(t);if(o)if(await e.fs.exists(o)){let a=e.commands.get(t);if(a)return{cmd:a,path:o};try{let l=await e.fs.stat(o);if(!l.isDirectory&&(l.mode&73)!==0)return{script:!0,path:o}}catch{}}else e.state.hashTable.delete(t)}let s=(n??e.state.env.get("PATH")??"/usr/bin:/bin").split(":");for(let o of s){if(!o)continue;let l=`${o.startsWith("/")?o:e.fs.resolvePath(e.state.cwd,o)}/${t}`;if(await e.fs.exists(l))try{let c=await e.fs.stat(l);if(c.isDirectory)continue;let u=(c.mode&73)!==0,f=e.commands.get(t),p=o==="/bin"||o==="/usr/bin";if(f&&p)return{cmd:f,path:l};if(u){if(f&&!p)return{script:!0,path:l};if(!f)return{script:!0,path:l}}}catch{}}if(!await e.fs.exists("/usr/bin")){let o=e.commands.get(t);if(o)return{cmd:o,path:`/usr/bin/${t}`}}return null}async function La(e,t){let n=[];if(t.includes("/")){let i=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(i))try{let o=await e.fs.stat(i);o.isDirectory||(o.mode&73)!==0&&n.push(t)}catch{}return n}let s=(e.state.env.get("PATH")||"/usr/bin:/bin").split(":");for(let i of s){if(!i)continue;let a=`${i.startsWith("/")?i:e.fs.resolvePath(e.state.cwd,i)}/${t}`;if(await e.fs.exists(a)){try{if((await e.fs.stat(a)).isDirectory)continue}catch{continue}n.push(i.startsWith("/")?a:`${i}/${t}`)}}return n}zn();function QC(e){return e!==null&&typeof e=="object"&&"then"in e&&typeof e.then=="function"}function Ke(e,t,n,r){return((...s)=>{it(t,n,`${r} call`);let i=e(...s);return QC(i)?i.then(o=>(it(t,n,`${r} post-await`),o),o=>{throw it(t,n,`${r} post-await`),o}):(it(t,n,`${r} return`),i)})}function XC(e,t,n){let r={readFile:Ke(e.readFile.bind(e),t,n,"fs.readFile"),...typeof e.readFileBytes=="function"?{readFileBytes:Ke(e.readFileBytes.bind(e),t,n,"fs.readFileBytes")}:Object.create(null),readFileBuffer:Ke(e.readFileBuffer.bind(e),t,n,"fs.readFileBuffer"),writeFile:Ke(e.writeFile.bind(e),t,n,"fs.writeFile"),appendFile:Ke(e.appendFile.bind(e),t,n,"fs.appendFile"),exists:Ke(e.exists.bind(e),t,n,"fs.exists"),stat:Ke(e.stat.bind(e),t,n,"fs.stat"),mkdir:Ke(e.mkdir.bind(e),t,n,"fs.mkdir"),readdir:Ke(e.readdir.bind(e),t,n,"fs.readdir"),rm:Ke(e.rm.bind(e),t,n,"fs.rm"),cp:Ke(e.cp.bind(e),t,n,"fs.cp"),mv:Ke(e.mv.bind(e),t,n,"fs.mv"),resolvePath:Ke(e.resolvePath.bind(e),t,n,"fs.resolvePath"),getAllPaths:Ke(e.getAllPaths.bind(e),t,n,"fs.getAllPaths"),chmod:Ke(e.chmod.bind(e),t,n,"fs.chmod"),symlink:Ke(e.symlink.bind(e),t,n,"fs.symlink"),link:Ke(e.link.bind(e),t,n,"fs.link"),readlink:Ke(e.readlink.bind(e),t,n,"fs.readlink"),lstat:Ke(e.lstat.bind(e),t,n,"fs.lstat"),realpath:Ke(e.realpath.bind(e),t,n,"fs.realpath"),utimes:Ke(e.utimes.bind(e),t,n,"fs.utimes")};return e.readdirWithFileTypes&&(r.readdirWithFileTypes=Ke(e.readdirWithFileTypes.bind(e),t,n,"fs.readdirWithFileTypes")),r}function Yy(e,t){if(!e.requireDefenseContext)return e;let n=`command:${t}`,r={...e,fs:XC(e.fs,e.requireDefenseContext,n)};return e.exec&&(r.exec=Ke(e.exec,e.requireDefenseContext,n,"exec")),e.fetch&&(r.fetch=Ke(e.fetch,e.requireDefenseContext,n,"fetch")),e.sleep&&(r.sleep=Ke(e.sleep,e.requireDefenseContext,n,"sleep")),e.getRegisteredCommands&&(r.getRegisteredCommands=Ke(e.getRegisteredCommands,e.requireDefenseContext,n,"getRegisteredCommands")),r}Ae();rn();async function n7(e,t,n,r){let s=!1,i=!1,o=!1,a=!1,l=!1,c=[];for(let m of t)if(m.startsWith("-")&&m.length>1)for(let g of m.slice(1))g==="t"?s=!0:g==="p"?i=!0:g==="P"?o=!0:g==="a"?a=!0:g==="f"&&(l=!0);else c.push(m);let u="",f="",p=0,h=!1,d=!1;for(let m of c){let g=!1;if(o){if(a){let v=await r(m);if(v.length>0){for(let $ of v)u+=`${$}
1377
1377
  `;h=!0,g=!0}}else{let v=await n(m);v&&(u+=`${v}
1378
1378
  `,h=!0,g=!0)}g||(d=!0);continue}let y=!l&&e.state.functions.has(m);if(a&&y){if(!i)if(s)u+=`function
1379
1379
  `;else{let v=e.state.functions.get(m),$=v?Jy(m,v):`${m} is a function
@@ -1411,16 +1411,16 @@ ${e} ()
1411
1411
  `),o=1)}else if(e.commands.has(a)){let u=(e.state.env.get("PATH")??"/usr/bin:/bin").split(":"),f=null;for(let p of u){if(!p)continue;let h=`${p}/${a}`;try{let d=await e.fs.stat(h);if(!d.isDirectory&&(d.mode&73)!==0){f=h;break}}catch{}}f||(f=`/usr/bin/${a}`),r?s+=`${a} is ${f}
1412
1412
  `:s+=`${f}
1413
1413
  `}else r&&(i+=`${a}: not found
1414
- `),o=1}return z(s,i,o)}async function s7(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 o=`${s.startsWith("/")?s:e.fs.resolvePath(e.state.cwd,s)}/${t}`;if(await e.fs.exists(o)){try{if((await e.fs.stat(o)).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 i7(e,t,n,r,s,i,o,a){let{ctx:l,runCommand:c}=e;if(l.coverage&&Ws.has(t)&&l.coverage.hit(`bash:builtin:${t}`),t==="export")return uf(l,n);if(t==="unset")return Sf(l,n);if(t==="exit")return cf(l,n);if(t==="local")return df(l,n);if(t==="set")return bf(l,n);if(t==="break")return _u(l,n);if(t==="continue")return Zu(l,n);if(t==="return")return yf(l,n);if(t==="eval"&&l.state.options.posix)return Pa(l,n,s);if(t==="shift")return xf(l,n);if(t==="getopts")return Da(l,n);if(t==="compgen")return ju(l,n);if(t==="complete")return Vu(l,n);if(t==="compopt")return qu(l,n);if(t==="pushd")return await of(l,n);if(t==="popd")return af(l,n);if(t==="dirs")return lf(l,n);if(t==="source"||t===".")return Ef(l,n);if(t==="read")return gf(l,n,s,a);if(t==="mapfile"||t==="readarray")return mf(l,n,s);if(t==="declare"||t==="typeset")return nf(l,n);if(t==="readonly")return rf(l,n);if(!i){let u=l.state.functions.get(t);if(u)return Oa(l,u,n,s)}if(t==="eval")return Pa(l,n,s);if(t==="cd")return await Fu(l,n);if(t===":"||t==="true")return be;if(t==="false")return ft(!1);if(t==="let")return hf(l,n);if(t==="command")return JC(e,n,s);if(t==="builtin")return ev(e,n,s);if(t==="shopt")return Qy(l,n);if(t==="exec"){if(n.length===0)return be;let[u,...f]=n;return c(u,f,[],s,!1,!1,-1)}if(t==="wait")return be;if(t==="type")return await n7(l,n,u=>s7(l,u),u=>La(l,u));if(t==="hash")return ff(l,n);if(t==="help")return pf(l,n);if(t==="["||t==="test"){let u=n;if(t==="["){if(n[n.length-1]!=="]")return W("[: missing `]'\n",2);u=n.slice(0,-1)}return Ti(l,u)}return null}async function JC(e,t,n){let{ctx:r,runCommand:s}=e;if(t.length===0)return be;let i=!1,o=!1,a=!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"?o=!0:p==="v"&&(a=!0);l=l.slice(1)}if(l.length===0)return be;if(a||o)return await r7(r,l,a,o);let[c,...u]=l;return s(c,u,[],n,!0,i,-1)}async function ev(e,t,n){let{runCommand:r}=e;if(t.length===0)return be;let s=t;if(s[0]==="--"&&(s=s.slice(1),s.length===0))return be;let i=s[0];if(!Ws.has(i))return W(`bash: builtin: ${i}: not a shell builtin
1414
+ `),o=1}return z(s,i,o)}async function s7(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 o=`${s.startsWith("/")?s:e.fs.resolvePath(e.state.cwd,s)}/${t}`;if(await e.fs.exists(o)){try{if((await e.fs.stat(o)).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 i7(e,t,n,r,s,i,o,a){let{ctx:l,runCommand:c}=e;if(l.coverage&&Ws.has(t)&&l.coverage.hit(`bash:builtin:${t}`),t==="export")return uf(l,n);if(t==="unset")return Sf(l,n);if(t==="exit")return cf(l,n);if(t==="local")return df(l,n);if(t==="set")return bf(l,n);if(t==="break")return _u(l,n);if(t==="continue")return Zu(l,n);if(t==="return")return yf(l,n);if(t==="eval"&&l.state.options.posix)return Pa(l,n,s);if(t==="shift")return xf(l,n);if(t==="getopts")return Da(l,n);if(t==="compgen")return ju(l,n);if(t==="complete")return Vu(l,n);if(t==="compopt")return qu(l,n);if(t==="pushd")return await of(l,n);if(t==="popd")return af(l,n);if(t==="dirs")return lf(l,n);if(t==="source"||t===".")return Ef(l,n,s);if(t==="read")return gf(l,n,s,a);if(t==="mapfile"||t==="readarray")return mf(l,n,s);if(t==="declare"||t==="typeset")return nf(l,n);if(t==="readonly")return rf(l,n);if(!i){let u=l.state.functions.get(t);if(u)return Oa(l,u,n,s)}if(t==="eval")return Pa(l,n,s);if(t==="cd")return await Fu(l,n);if(t===":"||t==="true")return be;if(t==="false")return ft(!1);if(t==="let")return hf(l,n);if(t==="command")return JC(e,n,s);if(t==="builtin")return ev(e,n,s);if(t==="shopt")return Qy(l,n);if(t==="exec"){if(n.length===0)return be;let[u,...f]=n;return c(u,f,[],s,!1,!1,-1)}if(t==="wait")return be;if(t==="type")return await n7(l,n,u=>s7(l,u),u=>La(l,u));if(t==="hash")return ff(l,n);if(t==="help")return pf(l,n);if(t==="["||t==="test"){let u=n;if(t==="["){if(n[n.length-1]!=="]")return W("[: missing `]'\n",2);u=n.slice(0,-1)}return Ti(l,u)}return null}async function JC(e,t,n){let{ctx:r,runCommand:s}=e;if(t.length===0)return be;let i=!1,o=!1,a=!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"?o=!0:p==="v"&&(a=!0);l=l.slice(1)}if(l.length===0)return be;if(a||o)return await r7(r,l,a,o);let[c,...u]=l;return s(c,u,[],n,!0,i,-1)}async function ev(e,t,n){let{runCommand:r}=e;if(t.length===0)return be;let s=t;if(s[0]==="--"&&(s=s.slice(1),s.length===0))return be;let i=s[0];if(!Ws.has(i))return W(`bash: builtin: ${i}: not a shell builtin
1415
1415
  `);let[,...o]=s;return r(i,o,[],n,!0,!1,-1)}async function o7(e,t,n,r,s){let{ctx:i,buildExportedEnv:o,executeUserScript:a}=e,c=await Xy(i,t,s?"/usr/bin:/bin":void 0);if(!c)return hy(t)?W(`bash: ${t}: command not available in browser environments. Exclude '${t}' from your commands or use the Node.js bundle.
1416
1416
  `,127):W(`bash: ${t}: command not found
1417
1417
  `,127);if("error"in c)return c.error==="permission_denied"?W(`bash: ${t}: Permission denied
1418
1418
  `,126):W(`bash: ${t}: No such file or directory
1419
1419
  `,127);if("script"in c)return t.includes("/")||(i.state.hashTable||(i.state.hashTable=new Map),i.state.hashTable.set(t,c.path)),await a(c.path,n,r);let{cmd:u,path:f}=c;t.includes("/")||(i.state.hashTable||(i.state.hashTable=new Map),i.state.hashTable.set(t,f));let p=r||i.state.groupStdin||"",h=o(),d={fs:i.fs,cwd:i.state.cwd,env:i.state.env,exportedEnv:h,stdin:p,limits:i.limits,exec:i.execFn,fetch:i.fetch,getRegisteredCommands:()=>Array.from(i.commands.keys()),sleep:i.sleep,trace:i.trace,fileDescriptors:i.state.fileDescriptors,xpgEcho:i.state.shoptOptions.xpg_echo,coverage:i.coverage,signal:i.state.signal,requireDefenseContext:i.requireDefenseContext,jsBootstrapCode:i.jsBootstrapCode,invokeTool:i.invokeTool},m=Yy(d,t);try{let g=()=>_t(i.requireDefenseContext,"command",`${t} execution`,()=>u.execute(n,m));return u.trusted?await Et.runTrustedAsync(()=>g()):await g()}catch(g){if(g instanceof X||g instanceof me)throw g;return W(`${t}: ${He(Xe(g))}
1420
1420
  `)}}Ut();Ae();Bt();async function vf(e,t){let n=e.state.inCondition;e.state.inCondition=!0;let r="",s="",i=0;try{for(let o of t){let a=await e.executeStatement(o);r+=a.stdout,s+=a.stderr,i=a.exitCode}}finally{e.state.inCondition=n}return{stdout:r,stderr:s,exitCode:i}}Ae();rn();function Di(e,t,n,r){if(e instanceof It)return t+=e.stdout,n+=e.stderr,e.levels>1&&r>1?(e.levels--,e.stdout=t,e.stderr=n,{action:"rethrow",stdout:t,stderr:n,error:e}):{action:"break",stdout:t,stderr:n};if(e instanceof $t)return t+=e.stdout,n+=e.stderr,e.levels>1&&r>1?(e.levels--,e.stdout=t,e.stderr=n,{action:"rethrow",stdout:t,stderr:n,error:e}):{action:"continue",stdout:t,stderr:n};if(e instanceof St||e instanceof Ht||e instanceof we||e instanceof X)return e.prependOutput(t,n),{action:"rethrow",stdout:t,stderr:n,error:e};let s=Xe(e);return{action:"error",stdout:t,stderr:`${n}${s}
1421
- `,exitCode:1}}Ae();rn();async function Ma(e,t,n="",r=""){let s=n,i=r,o=0;try{for(let a of t){let l=await e.executeStatement(a);s+=l.stdout,i+=l.stderr,o=l.exitCode}}catch(a){if(Mi(a)||a instanceof Ht||a instanceof we||a instanceof X||a instanceof Ln)throw a.prependOutput(s,i),a;return{stdout:s,stderr:`${i}${Xe(a)}
1421
+ `,exitCode:1}}Ae();rn();async function Ma(e,t,n="",r=""){let s=n,i=r,o=0;try{for(let a of t){let l=await e.executeStatement(a);s+=l.stdout,i+=l.stderr,o=l.exitCode}}catch(a){if(Mi(a)||a instanceof Ht||a instanceof we||a instanceof X||a instanceof Mn)throw a.prependOutput(s,i),a;return{stdout:s,stderr:`${i}${Xe(a)}
1422
1422
  `,exitCode:1}}return{stdout:s,stderr:i,exitCode:o}}async function a7(e,t){let n="",r="";for(let s of t.clauses){let i=await vf(e,s.condition);if(n+=i.stdout,r+=i.stderr,i.exitCode===0)return Ma(e,s.body,n,r)}return t.elseBody?Ma(e,t.elseBody,n,r):z(n,r,0)}async function l7(e,t){let n=await Xn(e,t.redirections);if(n)return n;let r="",s="",i=0,o=0;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t.variable))return W(`bash: \`${t.variable}': not a valid identifier
1423
- `);let a=[];if(t.words===null)a=(e.state.env.get("@")||"").split(" ").filter(Boolean);else if(t.words.length===0)a=[];else try{for(let c of t.words){let u=await wn(e,c);a.push(...u.values)}}catch(c){if(c instanceof Fn)return{stdout:"",stderr:c.stderr,exitCode:1};throw c}e.state.loopDepth++;try{for(let c of a){o++,o>e.limits.maxLoopIterations&&Kn(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",r,s),e.state.env.set(t.variable,c);try{for(let u of t.body){let f=await e.executeStatement(u);r+=f.stdout,s+=f.stderr,i=f.exitCode}}catch(u){let f=Di(u,r,s,e.state.loopDepth);if(r=f.stdout,s=f.stderr,f.action==="break")break;if(f.action==="continue")continue;if(f.action==="error"){let p=z(r,s,f.exitCode??1);return et(e,p,t.redirections)}throw f.error}}}finally{e.state.loopDepth--}let l=z(r,s,i);return et(e,l,t.redirections)}async function c7(e,t){let n=await Xn(e,t.redirections);if(n)return n;let r=t.line;r!==void 0&&(e.state.currentLine=r);let s="",i="",o=0,a=0;t.init&&await re(e,t.init.expression),e.state.loopDepth++;try{for(;a++,a>e.limits.maxLoopIterations&&Kn(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",s,i),!(t.condition&&(r!==void 0&&(e.state.currentLine=r),await re(e,t.condition.expression)===0));){try{for(let c of t.body){let u=await e.executeStatement(c);s+=u.stdout,i+=u.stderr,o=u.exitCode}}catch(c){let u=Di(c,s,i,e.state.loopDepth);if(s=u.stdout,i=u.stderr,u.action==="break")break;if(u.action==="continue"){t.update&&await re(e,t.update.expression);continue}if(u.action==="error"){let f=z(s,i,u.exitCode??1);return et(e,f,t.redirections)}throw u.error}t.update&&await re(e,t.update.expression)}}finally{e.state.loopDepth--}let l=z(s,i,o);return et(e,l,t.redirections)}async function u7(e,t,n=""){let r="",s="",i=0,o=0,a=n;for(let c of t.redirections)if((c.operator==="<<"||c.operator==="<<-")&&c.target.type==="HereDoc"){let u=c.target,f=await le(e,u.content);u.stripTabs&&(f=f.split(`
1423
+ `);let a=[];if(t.words===null)a=(e.state.env.get("@")||"").split(" ").filter(Boolean);else if(t.words.length===0)a=[];else try{for(let c of t.words){let u=await wn(e,c);a.push(...u.values)}}catch(c){if(c instanceof Ln)return{stdout:"",stderr:c.stderr,exitCode:1};throw c}e.state.loopDepth++;try{for(let c of a){o++,o>e.limits.maxLoopIterations&&Kn(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",r,s),e.state.env.set(t.variable,c);try{for(let u of t.body){let f=await e.executeStatement(u);r+=f.stdout,s+=f.stderr,i=f.exitCode}}catch(u){let f=Di(u,r,s,e.state.loopDepth);if(r=f.stdout,s=f.stderr,f.action==="break")break;if(f.action==="continue")continue;if(f.action==="error"){let p=z(r,s,f.exitCode??1);return et(e,p,t.redirections)}throw f.error}}}finally{e.state.loopDepth--}let l=z(r,s,i);return et(e,l,t.redirections)}async function c7(e,t){let n=await Xn(e,t.redirections);if(n)return n;let r=t.line;r!==void 0&&(e.state.currentLine=r);let s="",i="",o=0,a=0;t.init&&await re(e,t.init.expression),e.state.loopDepth++;try{for(;a++,a>e.limits.maxLoopIterations&&Kn(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",s,i),!(t.condition&&(r!==void 0&&(e.state.currentLine=r),await re(e,t.condition.expression)===0));){try{for(let c of t.body){let u=await e.executeStatement(c);s+=u.stdout,i+=u.stderr,o=u.exitCode}}catch(c){let u=Di(c,s,i,e.state.loopDepth);if(s=u.stdout,i=u.stderr,u.action==="break")break;if(u.action==="continue"){t.update&&await re(e,t.update.expression);continue}if(u.action==="error"){let f=z(s,i,u.exitCode??1);return et(e,f,t.redirections)}throw u.error}t.update&&await re(e,t.update.expression)}}finally{e.state.loopDepth--}let l=z(s,i,o);return et(e,l,t.redirections)}async function u7(e,t,n=""){let r="",s="",i=0,o=0,a=n;for(let c of t.redirections)if((c.operator==="<<"||c.operator==="<<-")&&c.target.type==="HereDoc"){let u=c.target,f=await le(e,u.content);u.stripTabs&&(f=f.split(`
1424
1424
  `).map(p=>p.replace(/^\t+/,"")).join(`
1425
1425
  `)),a=f}else if(c.operator==="<<<"&&c.target.type==="Word")a=`${await le(e,c.target)}
1426
1426
  `;else if(c.operator==="<"&&c.target.type==="Word")try{let u=await le(e,c.target),f=e.fs.resolvePath(e.state.cwd,u);a=await e.fs.readFile(f)}catch{let u=await le(e,c.target);return W(`bash: ${u}: No such file or directory
@@ -1429,7 +1429,7 @@ ${e} ()
1429
1429
  `),s=e.includes(" "),i=e.includes("\\"),o=e.includes("'");if(n||r||s||i){let l="";for(let c of e){let u=c.charCodeAt(0);c===`
1430
1430
  `?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 o?`"${e.replace(/([\\$`"])/g,"\\$1")}"`:`'${e}'`}async function g7(e,t,n){if(!e.state.options.xtrace)return"";let r=await m7(e),s=[t,...n],i=tv(s);return`${r}${i}
1431
1431
  `}async function y7(e,t,n){return e.state.options.xtrace?`${await m7(e)}${t}=${n}
1432
- `:""}he();hi();Ae();async function w7(e,t,n){let r=t.timed?Ss():0,s="",i=be,o=0,a=[],l="",c=t.commands.length>1,u=e.state.lastArg;for(let p=0;p<t.commands.length;p++){let h=t.commands[p],d=p===t.commands.length-1,m=p===0;c&&(e.state.lastArg="",m||(e.state.groupStdin=void 0));let y=c&&(!d||!e.state.shoptOptions.lastpipe)?new Map(e.state.env):null,w;try{w=await n(h,s)}catch(b){if(b instanceof Pt)w={stdout:b.stdout,stderr:b.stderr,exitCode:1};else if(b instanceof we&&t.commands.length>1)w={stdout:b.stdout,stderr:b.stderr,exitCode:b.exitCode};else if(b instanceof Ht&&t.commands.length>1)w={stdout:b.stdout,stderr:b.stderr,exitCode:b.exitCode};else throw y&&(e.state.env=y),b}y&&(e.state.env=y),a.push(w.exitCode),w.exitCode!==0&&(o=w.exitCode),d?i=w:(t.pipeStderr?.[p]??!1?s=Dn(w.stderr)+Za(w):(s=Za(w),l+=w.stderr),i={stdout:"",stderr:"",exitCode:w.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<a.length;p++)e.state.env.set(`PIPESTATUS_${p}`,String(a[p]));e.state.env.set("PIPESTATUS__length",String(a.length))}if(e.state.options.pipefail&&o!==0&&(i={...i,exitCode:o}),t.negated&&(i={...i,exitCode:i.exitCode===0?1:0}),t.timed){let h=(Ss()-r)/1e3,d=Math.floor(h/60),m=h%60,g;t.timePosix?g=`real ${h.toFixed(2)}
1432
+ `:""}he();hi();Ae();async function w7(e,t,n){let r=t.timed?Ss():0,s="",i=be,o=0,a=[],l="",c=t.commands.length>1,u=e.state.lastArg;for(let p=0;p<t.commands.length;p++){let h=t.commands[p],d=p===t.commands.length-1,m=p===0;c&&(e.state.lastArg="",m||(e.state.groupStdin=void 0));let y=c&&(!d||!e.state.shoptOptions.lastpipe)?new Map(e.state.env):null,w;try{w=await n(h,s)}catch(b){if(b instanceof Pt)w={stdout:b.stdout,stderr:b.stderr,exitCode:1};else if(b instanceof we&&t.commands.length>1)w={stdout:b.stdout,stderr:b.stderr,exitCode:b.exitCode};else if(b instanceof Ht&&t.commands.length>1)w={stdout:b.stdout,stderr:b.stderr,exitCode:b.exitCode};else throw y&&(e.state.env=y),b}y&&(e.state.env=y),a.push(w.exitCode),w.exitCode!==0&&(o=w.exitCode),d?i=w:(t.pipeStderr?.[p]??!1?s=_n(w.stderr)+Za(w):(s=Za(w),l+=w.stderr),i={stdout:"",stderr:"",exitCode:w.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<a.length;p++)e.state.env.set(`PIPESTATUS_${p}`,String(a[p]));e.state.env.set("PIPESTATUS__length",String(a.length))}if(e.state.options.pipefail&&o!==0&&(i={...i,exitCode:o}),t.negated&&(i={...i,exitCode:i.exitCode===0?1:0}),t.timed){let h=(Ss()-r)/1e3,d=Math.floor(h/60),m=h%60,g;t.timePosix?g=`real ${h.toFixed(2)}
1433
1433
  user 0.00
1434
1434
  sys 0.00
1435
1435
  `:g=`
@@ -1441,13 +1441,13 @@ sys 0m0.000s
1441
1441
  `,1)};if(We(e,n)){let u=Zr(e,n);if(u===void 0||u==="")throw new we(1,"","");let f=Mt(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
1442
1442
  `,1)}}if(Zn(e,n)){if(t.name)return o+=`bash: ${n}: readonly variable
1443
1443
  `,{continueToNext:!0,xtraceOutput:o};let u=bt(e,n);if(u)return{continueToNext:!1,xtraceOutput:"",error:u}}let a=e.state.associativeArrays?.has(n),l=sv(r),c=()=>{let u=`${n}_`;for(let f of e.state.env.keys())f.startsWith(u)&&!f.includes("__")&&e.state.env.delete(f);e.state.env.delete(n)};if(a&&l?await iv(e,t,n,r,s,c,u=>{o+=u}):l?await ov(e,n,r,s,c):await av(e,n,r,s,c),t.name){i.set(n,e.state.env.get(n));let f=`(${r.map(p=>Rs(p)).join(" ")})`;e.state.env.set(n,f)}return{continueToNext:!0,xtraceOutput:o}}function sv(e){return e.some(t=>{if(t.parts.length>=2){let n=t.parts[0],r=t.parts[1];if(n.type!=="Glob"||!n.pattern.startsWith("["))return!1;if(n.pattern==="["&&(r.type==="DoubleQuoted"||r.type==="SingleQuoted")){if(t.parts.length<3)return!1;let s=t.parts[2];return s.type!=="Literal"?!1:s.value.startsWith("]=")||s.value.startsWith("]+=")}return r.type!=="Literal"?!1:r.value.startsWith("]")?r.value.startsWith("]=")||r.value.startsWith("]+="):n.pattern.endsWith("]")?r.value.startsWith("=")||r.value.startsWith("+="):!1}return!1})}async function iv(e,t,n,r,s,i,o){let a=[];for(let l of r){let c=yu(l);if(c){let{key:u,valueParts:f,append:p}=c,h;f.length>0?h=await le(e,{type:"Word",parts:f}):h="",h=st(e,h),a.push({type:"keyed",key:u,value:h,append:p})}else{let u=await le(e,l);a.push({type:"invalid",expandedValue:u})}}s||i();for(let l of a)if(l.type==="keyed")if(l.append){let c=e.state.env.get(`${n}_${l.key}`)??"";e.state.env.set(`${n}_${l.key}`,c+l.value)}else e.state.env.set(`${n}_${l.key}`,l.value);else{let c=t.line??e.state.currentLine??1;o(`bash: line ${c}: ${n}: ${l.expandedValue}: must use subscript when assigning associative array
1444
- `)}}async function ov(e,t,n,r,s){let i=[];for(let a of n){let l=yu(a);if(l){let{key:c,valueParts:u,append:f}=l,p;u.length>0?p=await le(e,{type:"Word",parts:u}):p="",p=st(e,p),i.push({type:"keyed",indexExpr:c,value:p,append:f})}else{let c=await wn(e,a);i.push({type:"non-keyed",values:c.values})}}r||s();let o=0;for(let a of i)if(a.type==="keyed"){let l;try{let c=new pe,u=Ne(c,a.indexExpr);l=await re(e,u.expression,!1)}catch{if(/^-?\d+$/.test(a.indexExpr))l=Number.parseInt(a.indexExpr,10);else{let c=e.state.env.get(a.indexExpr);l=c?Number.parseInt(c,10):0,Number.isNaN(l)&&(l=0)}}if(a.append){let c=e.state.env.get(`${t}_${l}`)??"";e.state.env.set(`${t}_${l}`,c+a.value)}else e.state.env.set(`${t}_${l}`,a.value);o=l+1}else for(let l of a.values)e.state.env.set(`${t}_${o++}`,l)}async function av(e,t,n,r,s){let i=[];for(let a of n){let l=await wn(e,a);i.push(...l.values)}let o=0;if(r){let a=ce(e,t);if(a.length>0)o=Math.max(...a.map(([c])=>typeof c=="number"?c:0))+1;else{let l=e.state.env.get(t);l!==void 0&&(e.state.env.set(`${t}_0`,l),e.state.env.delete(t),o=1)}}else s();for(let a=0;a<i.length;a++)e.state.env.set(`${t}_${o+a}`,i[a]);r||e.state.env.set(`${t}__length`,String(i.length))}async function lv(e,t,n,r,s,i,o){let a=n;if(We(e,n)){let f=Mt(e,n);if(f&&f!==n){if(f.includes("["))return{continueToNext:!1,xtraceOutput:"",error:z("",`bash: \`${f}': not a valid identifier
1445
- `,1)};a=f}}if(Zn(e,a)){if(t.name)return{continueToNext:!0,xtraceOutput:""};let f=bt(e,a);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let l=e.state.associativeArrays?.has(a),c;if(l)c=await x7(e,a,r);else{let f=await cv(e,a,r);if(f.error)return{continueToNext:!1,xtraceOutput:"",error:f.error};c=`${a}_${f.index}`}let u=i?(e.state.env.get(c)||"")+s:s;if(t.name)o.set(c,e.state.env.get(c)),e.state.env.set(c,u);else{let f=Bs(e,a);if(f!==void 0&&f===e.state.callDepth&&e.state.localScopes.length>0){let p=e.state.localScopes[e.state.localScopes.length-1];p.has(c)||p.set(c,e.state.env.get(c))}e.state.env.set(c,u)}return{continueToNext:!0,xtraceOutput:""}}async function x7(e,t,n){let r;if(n.startsWith("'")&&n.endsWith("'"))r=n.slice(1,-1);else if(n.startsWith('"')&&n.endsWith('"')){let s=n.slice(1,-1),o=new pe().parseWordFromString(s,!0,!1);r=await le(e,o)}else if(n.includes("$")){let i=new pe().parseWordFromString(n,!1,!1);r=await le(e,i)}else r=n;return`${t}_${r}`}async function cv(e,t,n){let r=n;n.startsWith('"')&&n.endsWith('"')&&n.length>=2&&(r=n.slice(1,-1));let s;if(/^-?\d+$/.test(r))s=Number.parseInt(r,10);else{try{let i=new pe,o=Ne(i,r);s=await re(e,o.expression,!1)}catch(i){if(i instanceof Le){let l=`bash: line ${e.state.currentLine}: ${n}: ${i.message}
1444
+ `)}}async function ov(e,t,n,r,s){let i=[];for(let a of n){let l=yu(a);if(l){let{key:c,valueParts:u,append:f}=l,p;u.length>0?p=await le(e,{type:"Word",parts:u}):p="",p=st(e,p),i.push({type:"keyed",indexExpr:c,value:p,append:f})}else{let c=await wn(e,a);i.push({type:"non-keyed",values:c.values})}}r||s();let o=0;for(let a of i)if(a.type==="keyed"){let l;try{let c=new pe,u=Ie(c,a.indexExpr);l=await re(e,u.expression,!1)}catch{if(/^-?\d+$/.test(a.indexExpr))l=Number.parseInt(a.indexExpr,10);else{let c=e.state.env.get(a.indexExpr);l=c?Number.parseInt(c,10):0,Number.isNaN(l)&&(l=0)}}if(a.append){let c=e.state.env.get(`${t}_${l}`)??"";e.state.env.set(`${t}_${l}`,c+a.value)}else e.state.env.set(`${t}_${l}`,a.value);o=l+1}else for(let l of a.values)e.state.env.set(`${t}_${o++}`,l)}async function av(e,t,n,r,s){let i=[];for(let a of n){let l=await wn(e,a);i.push(...l.values)}let o=0;if(r){let a=ce(e,t);if(a.length>0)o=Math.max(...a.map(([c])=>typeof c=="number"?c:0))+1;else{let l=e.state.env.get(t);l!==void 0&&(e.state.env.set(`${t}_0`,l),e.state.env.delete(t),o=1)}}else s();for(let a=0;a<i.length;a++)e.state.env.set(`${t}_${o+a}`,i[a]);r||e.state.env.set(`${t}__length`,String(i.length))}async function lv(e,t,n,r,s,i,o){let a=n;if(We(e,n)){let f=Mt(e,n);if(f&&f!==n){if(f.includes("["))return{continueToNext:!1,xtraceOutput:"",error:z("",`bash: \`${f}': not a valid identifier
1445
+ `,1)};a=f}}if(Zn(e,a)){if(t.name)return{continueToNext:!0,xtraceOutput:""};let f=bt(e,a);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let l=e.state.associativeArrays?.has(a),c;if(l)c=await x7(e,a,r);else{let f=await cv(e,a,r);if(f.error)return{continueToNext:!1,xtraceOutput:"",error:f.error};c=`${a}_${f.index}`}let u=i?(e.state.env.get(c)||"")+s:s;if(t.name)o.set(c,e.state.env.get(c)),e.state.env.set(c,u);else{let f=Bs(e,a);if(f!==void 0&&f===e.state.callDepth&&e.state.localScopes.length>0){let p=e.state.localScopes[e.state.localScopes.length-1];p.has(c)||p.set(c,e.state.env.get(c))}e.state.env.set(c,u)}return{continueToNext:!0,xtraceOutput:""}}async function x7(e,t,n){let r;if(n.startsWith("'")&&n.endsWith("'"))r=n.slice(1,-1);else if(n.startsWith('"')&&n.endsWith('"')){let s=n.slice(1,-1),o=new pe().parseWordFromString(s,!0,!1);r=await le(e,o)}else if(n.includes("$")){let i=new pe().parseWordFromString(n,!1,!1);r=await le(e,i)}else r=n;return`${t}_${r}`}async function cv(e,t,n){let r=n;n.startsWith('"')&&n.endsWith('"')&&n.length>=2&&(r=n.slice(1,-1));let s;if(/^-?\d+$/.test(r))s=Number.parseInt(r,10);else{try{let i=new pe,o=Ie(i,r);s=await re(e,o.expression,!1)}catch(i){if(i instanceof Le){let l=`bash: line ${e.state.currentLine}: ${n}: ${i.message}
1446
1446
  `;if(i.fatal)throw new we(1,"",l);return{index:0,error:z("",l,1)}}let o=e.state.env.get(n);s=o?Number.parseInt(o,10):0}Number.isNaN(s)&&(s=0)}if(s<0){let i=ce(e,t);if(i.length===0){let a=e.state.currentLine;return{index:0,error:z("",`bash: line ${a}: ${t}[${n}]: bad array subscript
1447
1447
  `,1)}}if(s=Math.max(...i.map(([a])=>typeof a=="number"?a:0))+1+s,s<0){let a=e.state.currentLine;return{index:0,error:z("",`bash: line ${a}: ${t}[${n}]: bad array subscript
1448
1448
  `,1)}}}return{index:s}}async function uv(e,t,n,r,s,i){let o="",a=n,l=null;if(We(e,n)){let f=Wg(e,n,r);if(f===void 0)return{continueToNext:!1,xtraceOutput:"",error:z("",`bash: ${n}: circular name reference
1449
1449
  `,1)};if(f===null)return{continueToNext:!0,xtraceOutput:""};a=f;let p=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);p&&(l={arrayName:p[1],subscriptExpr:p[2]},a=p[1])}if(Zn(e,a)){if(t.name)return o+=`bash: ${a}: readonly variable
1450
- `,{continueToNext:!0,xtraceOutput:o};let f=bt(e,a);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let c;if(Oi(e,a))try{let f=new pe;if(s){let h=`(${e.state.env.get(a)||"0"}) + (${r})`,d=Ne(f,h);c=String(await re(e,d.expression))}else{let p=Ne(f,r);c=String(await re(e,p.expression))}}catch{c="0"}else{let{isArray:f}=await Promise.resolve().then(()=>(Bt(),Ru)),p=f(e,a)?`${a}_0`:a;c=s?(e.state.env.get(p)||"")+r:r}c=Hs(e,a,c),o+=await y7(e,a,c);let u=a;if(l)u=await fv(e,l);else{let{isArray:f}=await Promise.resolve().then(()=>(Bt(),Ru));f(e,a)&&(u=`${a}_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(a)),e.state.tempEnvBindings?.some(f=>f.has(a))&&(e.state.mutatedTempEnvVars=e.state.mutatedTempEnvVars||new Set,e.state.mutatedTempEnvVars.add(a))),{continueToNext:!1,xtraceOutput:o}}async function fv(e,t){let{arrayName:n,subscriptExpr:r}=t;if(e.state.associativeArrays?.has(n))return x7(e,n,r);let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else{try{let o=new pe,a=Ne(o,r);i=await re(e,a.expression,!1)}catch{let o=e.state.env.get(r);i=o?Number.parseInt(o,10):0}Number.isNaN(i)&&(i=0)}if(i<0){let o=ce(e,n);o.length>0&&(i=Math.max(...o.map(l=>l[0]))+1+i)}return`${n}_${i}`}ct();Ae();Bt();rn();async function E7(e,t,n,r){let s=await Xn(e,t.redirections);if(s)return s;let i=new Map(e.state.env),o=e.state.cwd,a={...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($=>new Map($)),u){e.state.localVarStack=new Map;for(let[$,_]of u.entries())e.state.localVarStack.set($,_.map(R=>({...R})))}f&&(e.state.localVarDepth=new Map(f)),p&&(e.state.fullyUnsetLocals=new Map(p));let h=e.state.loopDepth,d=e.state.parentHasLoopContext;e.state.parentHasLoopContext=h>0,e.state.loopDepth=0;let m=e.state.lastArg,g=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let y=e.state.groupStdin;n&&(e.state.groupStdin=n);let w="",b="",x=0,S=()=>{e.state.env=i,e.state.cwd=o,e.state.options=a,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=d,e.state.groupStdin=y,e.state.bashPid=g,e.state.lastArg=m};try{for(let $ of t.body){let _=await r($);w+=_.stdout,b+=_.stderr,x=_.exitCode}}catch($){if(S(),$ instanceof X)throw $;if($ instanceof Ln){w+=$.stdout,b+=$.stderr;let R=z(w,b,0);return et(e,R,t.redirections)}if($ instanceof It||$ instanceof $t){w+=$.stdout,b+=$.stderr;let R=z(w,b,0);return et(e,R,t.redirections)}if($ instanceof we){w+=$.stdout,b+=$.stderr;let R=z(w,b,$.exitCode);return et(e,R,t.redirections)}if($ instanceof St){w+=$.stdout,b+=$.stderr;let R=z(w,b,$.exitCode);return et(e,R,t.redirections)}if($ instanceof Ht){let R=z(w+$.stdout,b+$.stderr,$.exitCode);return et(e,R,t.redirections)}let _=z(w,`${b}${Xe($)}
1450
+ `,{continueToNext:!0,xtraceOutput:o};let f=bt(e,a);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let c;if(Oi(e,a))try{let f=new pe;if(s){let h=`(${e.state.env.get(a)||"0"}) + (${r})`,d=Ie(f,h);c=String(await re(e,d.expression))}else{let p=Ie(f,r);c=String(await re(e,p.expression))}}catch{c="0"}else{let{isArray:f}=await Promise.resolve().then(()=>(Bt(),Ru)),p=f(e,a)?`${a}_0`:a;c=s?(e.state.env.get(p)||"")+r:r}c=Hs(e,a,c),o+=await y7(e,a,c);let u=a;if(l)u=await fv(e,l);else{let{isArray:f}=await Promise.resolve().then(()=>(Bt(),Ru));f(e,a)&&(u=`${a}_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(a)),e.state.tempEnvBindings?.some(f=>f.has(a))&&(e.state.mutatedTempEnvVars=e.state.mutatedTempEnvVars||new Set,e.state.mutatedTempEnvVars.add(a))),{continueToNext:!1,xtraceOutput:o}}async function fv(e,t){let{arrayName:n,subscriptExpr:r}=t;if(e.state.associativeArrays?.has(n))return x7(e,n,r);let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else{try{let o=new pe,a=Ie(o,r);i=await re(e,a.expression,!1)}catch{let o=e.state.env.get(r);i=o?Number.parseInt(o,10):0}Number.isNaN(i)&&(i=0)}if(i<0){let o=ce(e,n);o.length>0&&(i=Math.max(...o.map(l=>l[0]))+1+i)}return`${n}_${i}`}ct();Ae();Bt();rn();async function E7(e,t,n,r){let s=await Xn(e,t.redirections);if(s)return s;let i=new Map(e.state.env),o=e.state.cwd,a={...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($=>new Map($)),u){e.state.localVarStack=new Map;for(let[$,_]of u.entries())e.state.localVarStack.set($,_.map(R=>({...R})))}f&&(e.state.localVarDepth=new Map(f)),p&&(e.state.fullyUnsetLocals=new Map(p));let h=e.state.loopDepth,d=e.state.parentHasLoopContext;e.state.parentHasLoopContext=h>0,e.state.loopDepth=0;let m=e.state.lastArg,g=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let y=e.state.groupStdin;n&&(e.state.groupStdin=n);let w="",b="",x=0,S=()=>{e.state.env=i,e.state.cwd=o,e.state.options=a,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=d,e.state.groupStdin=y,e.state.bashPid=g,e.state.lastArg=m};try{for(let $ of t.body){let _=await r($);w+=_.stdout,b+=_.stderr,x=_.exitCode}}catch($){if(S(),$ instanceof X)throw $;if($ instanceof Mn){w+=$.stdout,b+=$.stderr;let R=z(w,b,0);return et(e,R,t.redirections)}if($ instanceof It||$ instanceof $t){w+=$.stdout,b+=$.stderr;let R=z(w,b,0);return et(e,R,t.redirections)}if($ instanceof we){w+=$.stdout,b+=$.stderr;let R=z(w,b,$.exitCode);return et(e,R,t.redirections)}if($ instanceof St){w+=$.stdout,b+=$.stderr;let R=z(w,b,$.exitCode);return et(e,R,t.redirections)}if($ instanceof Ht){let R=z(w+$.stdout,b+$.stderr,$.exitCode);return et(e,R,t.redirections)}let _=z(w,`${b}${Xe($)}
1451
1451
  `,1);return et(e,_,t.redirections)}S();let v=z(w,b,x);return et(e,v,t.redirections)}async function A7(e,t,n,r){let s="",i="",o=0,a=await Ta(e,t.redirections);if(a)return a;let l=n;for(let f of t.redirections)if((f.operator==="<<"||f.operator==="<<-")&&f.target.type==="HereDoc"){let p=f.target,h=await le(e,p.content);p.stripTabs&&(h=h.split(`
1452
1452
  `).map(m=>m.replace(/^\t+/,"")).join(`
1453
1453
  `));let d=f.fd??0;d!==0?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),Ot(e),e.state.fileDescriptors.set(d,h)):l=h}else if(f.operator==="<<<"&&f.target.type==="Word")l=`${await le(e,f.target)}
@@ -1457,38 +1457,38 @@ sys 0m0.000s
1457
1457
  `,127)}if(i.startsWith("#!")){let g=i.indexOf(`
1458
1458
  `);g!==-1&&(i=i.slice(g+1))}let o=new Map(e.state.env),a=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,d=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 m=()=>{e.state.env=o,e.state.cwd=a,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=d};try{let y=new pe().parse(i),w=await s(y);return m(),w}catch(g){if(m(),g instanceof we||g instanceof X)throw g;if(g.name==="ParseException")return W(`bash: ${t}: ${g.message}
1459
1459
  `);throw g}}function pv(e){let t=n=>{for(let r of n){if(r.type==="CommandSubstitution"||r.type==="DoubleQuoted"&&t(r.parts))return!0;if(r.type==="BraceExpansion"){for(let s of r.items)if(s.type==="Word"&&t(s.word.parts))return!0}}return!1};return t(e.parts)}var _i=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,requireDefenseContext:t.requireDefenseContext??!1,jsBootstrapCode:t.jsBootstrapCode,invokeTool:t.invokeTool}}assertDefenseContext(t){if(!this.ctx.requireDefenseContext||Et.isInSandboxedContext())return;let n=`interpreter ${t} attempted outside defense context`;throw new me(n,{timestamp:Date.now(),type:"missing_defense_context",message:n,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:Et.getCurrentExecutionId()})}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 o=this.ctx.state.env.get(i);o!==void 0&&(s[i]=o)}return s}async executeScript(t){this.assertDefenseContext("execution");let n="",r="",s=0,i=this.ctx.limits.maxOutputSize,o=(a,l)=>{n.length+r.length+a.length+l.length>i&&Kn(`total output size exceeded (>${i} bytes), increase executionLimits.maxOutputSize`,"output_size"),n+=a,r+=l};for(let a of t.statements)try{let l=await this.executeStatement(a);o(l.stdout,l.stderr),s=l.exitCode,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s))}catch(l){if(l instanceof we)throw l.prependOutput(n,r),l;if(l instanceof nn)return o(l.stdout,l.stderr),s=l.exitCode,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:Ct(this.ctx.state.env)};if(l instanceof X)throw l;if(l instanceof Ht)return o(l.stdout,l.stderr),s=l.exitCode,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:Ct(this.ctx.state.env)};if(l instanceof Rt)return o(l.stdout,l.stderr),s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:Ct(this.ctx.state.env)};if(l instanceof Pt)return o(l.stdout,l.stderr),s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s)),{stdout:n,stderr:r,exitCode:s,env:Ct(this.ctx.state.env)};if(l instanceof Le){o(l.stdout,l.stderr),s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s));continue}if(l instanceof ss){o(l.stdout,l.stderr),s=1,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s));continue}if(l instanceof It||l instanceof $t){if(this.ctx.state.loopDepth>0)throw l.prependOutput(n,r),l;o(l.stdout,l.stderr);continue}throw l instanceof St&&l.prependOutput(n,r),l}return{stdout:n,stderr:r,exitCode:s,env:Ct(this.ctx.state.env)}}async executeUserScript(t,n,r=""){return S7(this.ctx,t,n,r,s=>this.executeScript(s))}async executeStatement(t){if(this.assertDefenseContext("statement"),this.ctx.state.signal?.aborted)throw new is;if(this.ctx.state.commandCount++,this.ctx.state.commandCount>this.ctx.limits.maxCommandCount&&Kn(`too many commands executed (>${this.ctx.limits.maxCommandCount}), increase executionLimits.maxCommandCount`,"commands"),t.deferredError)throw new At(t.deferredError.message,t.line??1,1);if(this.ctx.state.options.noexec)return be;this.ctx.state.errexitSafe=!1;let n="",r="";this.ctx.state.options.verbose&&!this.ctx.state.suppressVerbose&&t.sourceText&&(r+=`${t.sourceText}
1460
- `);let s=0,i=-1,o=!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,o=u.negated,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s))}let a=i<t.pipelines.length-1,l=this.ctx.state.errexitSafe;if(this.ctx.state.errexitSafe=a||o||l,this.ctx.state.options.errexit&&s!==0&&i===t.pipelines.length-1&&!o&&!this.ctx.state.inCondition&&!l)throw new Ht(s,n,r);return z(n,r,s)}async executePipeline(t){return w7(this.ctx,t,(n,r)=>this.executeCommand(n,r))}async executeCommand(t,n){switch(this.assertDefenseContext("command"),this.ctx.coverage?.hit(`bash:cmd:${t.type}`),t.type){case"SimpleCommand":return this.executeSimpleCommand(t,n);case"If":return a7(this.ctx,t);case"For":return l7(this.ctx,t);case"CStyleFor":return c7(this.ctx,t);case"While":return u7(this.ctx,t,n);case"Until":return f7(this.ctx,t);case"Case":return p7(this.ctx,t);case"Subshell":return this.executeSubshell(t,n);case"Group":return this.executeGroup(t,n);case"FunctionDef":return Iy(this.ctx,t);case"ArithmeticCommand":return this.executeArithmeticCommand(t);case"ConditionalCommand":return this.executeConditionalCommand(t);default:return be}}async executeSimpleCommand(t,n){try{return await this.executeSimpleCommandInner(t,n)}catch(r){if(r instanceof Fn)return W(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 v=t,$=100;for(;$>0;){let _=this.expandAlias(v);if(_===v)break;v=_,$--}this.aliasExpansionStack.clear(),v!==t&&(t=v)}this.ctx.state.expansionStderr="";let r=await b7(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 $=await Xn(this.ctx,t.redirections);if($)return $;let _=z("",i,0);return et(this.ctx,_,t.redirections)}this.ctx.state.lastArg="";let v=(this.ctx.state.expansionStderr||"")+i;return this.ctx.state.expansionStderr="",z("",v,this.ctx.state.lastExitCode)}let o=t.name&&kf(t.name,["local","declare","typeset","export","readonly"]),a=Array.from(s.keys());if(a.length>0&&!o){this.ctx.state.tempExportedVars=this.ctx.state.tempExportedVars||new Set;for(let v of a)this.ctx.state.tempExportedVars.add(v)}let l=await Ta(this.ctx,t.redirections);if(l){for(let[v,$]of s)$===void 0?this.ctx.state.env.delete(v):this.ctx.state.env.set(v,$);return l}let c=-1;for(let v of t.redirections){if((v.operator==="<<"||v.operator==="<<-")&&v.target.type==="HereDoc"){let $=v.target,_=await le(this.ctx,$.content);$.stripTabs&&(_=_.split(`
1460
+ `);let s=0,i=-1,o=!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,o=u.negated,this.ctx.state.lastExitCode=s,this.ctx.state.env.set("?",String(s))}let a=i<t.pipelines.length-1,l=this.ctx.state.errexitSafe;if(this.ctx.state.errexitSafe=a||o||l,this.ctx.state.options.errexit&&s!==0&&i===t.pipelines.length-1&&!o&&!this.ctx.state.inCondition&&!l)throw new Ht(s,n,r);return z(n,r,s)}async executePipeline(t){return w7(this.ctx,t,(n,r)=>this.executeCommand(n,r))}async executeCommand(t,n){switch(this.assertDefenseContext("command"),this.ctx.coverage?.hit(`bash:cmd:${t.type}`),t.type){case"SimpleCommand":return this.executeSimpleCommand(t,n);case"If":return a7(this.ctx,t);case"For":return l7(this.ctx,t);case"CStyleFor":return c7(this.ctx,t);case"While":return u7(this.ctx,t,n);case"Until":return f7(this.ctx,t);case"Case":return p7(this.ctx,t);case"Subshell":return this.executeSubshell(t,n);case"Group":return this.executeGroup(t,n);case"FunctionDef":return Iy(this.ctx,t);case"ArithmeticCommand":return this.executeArithmeticCommand(t);case"ConditionalCommand":return this.executeConditionalCommand(t);default:return be}}async executeSimpleCommand(t,n){try{return await this.executeSimpleCommandInner(t,n)}catch(r){if(r instanceof Ln)return W(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 v=t,$=100;for(;$>0;){let _=this.expandAlias(v);if(_===v)break;v=_,$--}this.aliasExpansionStack.clear(),v!==t&&(t=v)}this.ctx.state.expansionStderr="";let r=await b7(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 $=await Xn(this.ctx,t.redirections);if($)return $;let _=z("",i,0);return et(this.ctx,_,t.redirections)}this.ctx.state.lastArg="";let v=(this.ctx.state.expansionStderr||"")+i;return this.ctx.state.expansionStderr="",z("",v,this.ctx.state.lastExitCode)}let o=t.name&&kf(t.name,["local","declare","typeset","export","readonly"]),a=Array.from(s.keys());if(a.length>0&&!o){this.ctx.state.tempExportedVars=this.ctx.state.tempExportedVars||new Set;for(let v of a)this.ctx.state.tempExportedVars.add(v)}let l=await Ta(this.ctx,t.redirections);if(l){for(let[v,$]of s)$===void 0?this.ctx.state.env.delete(v):this.ctx.state.env.set(v,$);return l}let c=-1;for(let v of t.redirections){if((v.operator==="<<"||v.operator==="<<-")&&v.target.type==="HereDoc"){let $=v.target,_=await le(this.ctx,$.content);$.stripTabs&&(_=_.split(`
1461
1461
  `).map(P=>P.replace(/^\t+/,"")).join(`
1462
- `)),_=Dn(_);let R=v.fd??0;R!==0?(this.ctx.state.fileDescriptors||(this.ctx.state.fileDescriptors=new Map),Ot(this.ctx),this.ctx.state.fileDescriptors.set(R,_)):n=_;continue}if(v.operator==="<<<"&&v.target.type==="Word"){n=Dn(`${await le(this.ctx,v.target)}
1463
- `);continue}if(v.operator==="<"&&v.target.type==="Word")try{let $=await le(this.ctx,v.target),_=this.ctx.fs.resolvePath(this.ctx.state.cwd,$);n=await _n(this.ctx.fs,_)}catch{let $=await le(this.ctx,v.target);for(let[_,R]of s)R===void 0?this.ctx.state.env.delete(_):this.ctx.state.env.set(_,R);return W(`bash: ${$}: No such file or directory
1462
+ `)),_=_n(_);let R=v.fd??0;R!==0?(this.ctx.state.fileDescriptors||(this.ctx.state.fileDescriptors=new Map),Ot(this.ctx),this.ctx.state.fileDescriptors.set(R,_)):n=_;continue}if(v.operator==="<<<"&&v.target.type==="Word"){n=_n(`${await le(this.ctx,v.target)}
1463
+ `);continue}if(v.operator==="<"&&v.target.type==="Word")try{let $=await le(this.ctx,v.target),_=this.ctx.fs.resolvePath(this.ctx.state.cwd,$);n=await Fn(this.ctx.fs,_)}catch{let $=await le(this.ctx,v.target);for(let[_,R]of s)R===void 0?this.ctx.state.env.delete(_):this.ctx.state.env.set(_,R);return W(`bash: ${$}: No such file or directory
1464
1464
  `)}if(v.operator==="<&"&&v.target.type==="Word"){let $=await le(this.ctx,v.target),_=Number.parseInt($,10);if(!Number.isNaN(_)&&this.ctx.state.fileDescriptors){let R=this.ctx.state.fileDescriptors.get(_);if(R!==void 0)if(R.startsWith("__rw__:")){let P=h7(R);P&&(n=P.content.slice(P.position),c=_)}else R.startsWith("__file__:")||R.startsWith("__file_append__:")||(n=R)}}}let u=await wn(this.ctx,t.name),f=u.values.length===0,p=u.values[0]??"",h=u.values.slice(1),d=h.map(()=>u.quoted);if(kf(t.name,["local","declare","typeset","export","readonly"])&&(p==="local"||p==="declare"||p==="typeset"||p==="export"||p==="readonly"))for(let v of t.args){let $=await fy(this.ctx,v);if($)h.push($),d.push(!0);else{let _=await py(this.ctx,v);if(_!==null)h.push(_),d.push(!0);else{let R=await wn(this.ctx,v);for(let P of R.values)h.push(P),d.push(R.quoted)}}}else for(let v of t.args){let $=await wn(this.ctx,v);for(let _ of $.values)h.push(_),d.push($.quoted)}if(!p){if(f){if(h.length>0){let $=h.shift();return d.shift(),await this.runCommand($,h,d,n,!1,!1,c)}let v=pv(t.name)?this.ctx.state.lastExitCode:0;return z("","",v)}return W(`bash: : command not found
1465
1465
  `,127)}if(p==="exec"&&(h.length===0||h[0]==="--")){for(let v of t.redirections){if(v.target.type==="HereDoc"||v.fdVariable)continue;let $=await le(this.ctx,v.target),_=v.fd??(v.operator==="<"||v.operator==="<>"?0:1);switch(this.ctx.state.fileDescriptors||(this.ctx.state.fileDescriptors=new Map),v.operator){case">":case">|":{let R=this.ctx.fs.resolvePath(this.ctx.state.cwd,$);await this.ctx.fs.writeFile(R,"","utf8"),Ot(this.ctx),this.ctx.state.fileDescriptors.set(_,`__file__:${R}`);break}case">>":{let R=this.ctx.fs.resolvePath(this.ctx.state.cwd,$);Ot(this.ctx),this.ctx.state.fileDescriptors.set(_,`__file_append__:${R}`);break}case"<":{let R=this.ctx.fs.resolvePath(this.ctx.state.cwd,$);try{let P=await this.ctx.fs.readFile(R);Ot(this.ctx),this.ctx.state.fileDescriptors.set(_,P)}catch{return W(`bash: ${$}: No such file or directory
1466
1466
  `)}break}case"<>":{let R=this.ctx.fs.resolvePath(this.ctx.state.cwd,$);try{let P=await this.ctx.fs.readFile(R);Ot(this.ctx),this.ctx.state.fileDescriptors.set(_,`__rw__:${R.length}:${R}:0:${P}`)}catch{await this.ctx.fs.writeFile(R,"","utf8"),Ot(this.ctx),this.ctx.state.fileDescriptors.set(_,`__rw__:${R.length}:${R}:0:`)}break}case">&":{if($==="-")this.ctx.state.fileDescriptors.delete(_);else if($.endsWith("-")){let R=$.slice(0,-1),P=Number.parseInt(R,10);if(!Number.isNaN(P)){let C=this.ctx.state.fileDescriptors.get(P);C!==void 0?this.ctx.state.fileDescriptors.set(_,C):this.ctx.state.fileDescriptors.set(_,`__dupout__:${P}`),this.ctx.state.fileDescriptors.delete(P)}}else{let R=Number.parseInt($,10);Number.isNaN(R)||(Ot(this.ctx),this.ctx.state.fileDescriptors.set(_,`__dupout__:${R}`))}break}case"<&":{if($==="-")this.ctx.state.fileDescriptors.delete(_);else if($.endsWith("-")){let R=$.slice(0,-1),P=Number.parseInt(R,10);if(!Number.isNaN(P)){let C=this.ctx.state.fileDescriptors.get(P);C!==void 0?this.ctx.state.fileDescriptors.set(_,C):this.ctx.state.fileDescriptors.set(_,`__dupin__:${P}`),this.ctx.state.fileDescriptors.delete(P)}}else{let R=Number.parseInt($,10);Number.isNaN(R)||(Ot(this.ctx),this.ctx.state.fileDescriptors.set(_,`__dupin__:${R}`))}break}}}for(let[v,$]of s)$===void 0?this.ctx.state.env.delete(v):this.ctx.state.env.set(v,$);if(this.ctx.state.tempExportedVars)for(let v of s.keys())this.ctx.state.tempExportedVars.delete(v);return be}if(this.ctx.state.extraArgs){h.push(...this.ctx.state.extraArgs);for(let v=0;v<this.ctx.state.extraArgs.length;v++)d.push(!0);this.ctx.state.extraArgs=void 0}let g=await g7(this.ctx,p,h);s.size>0&&(this.ctx.state.tempEnvBindings=this.ctx.state.tempEnvBindings||[],this.ctx.state.tempEnvBindings.push(new Map(s)));let y,w=null;try{y=await this.runCommand(p,h,d,n,!1,!1,c)}catch(v){if(v instanceof It||v instanceof $t)w=v,y=be;else throw v}let b=i+g;if(b&&(y={...y,stderr:b+y.stderr}),y=await et(this.ctx,y,t.redirections),w)throw w;if(h.length>0){let v=h[h.length-1];if((p==="declare"||p==="local"||p==="typeset")&&/^[a-zA-Z_][a-zA-Z0-9_]*=\(/.test(v)){let $=v.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);$&&(v=$[1])}this.ctx.state.lastArg=v}else this.ctx.state.lastArg=p;let x=ky(p)&&p!=="unset"&&p!=="eval";if(!this.ctx.state.options.posix||!x)for(let[v,$]of s)this.ctx.state.fullyUnsetLocals?.has(v)||($===void 0?this.ctx.state.env.delete(v):this.ctx.state.env.set(v,$));if(this.ctx.state.tempExportedVars)for(let v of s.keys())this.ctx.state.tempExportedVars.delete(v);return s.size>0&&this.ctx.state.tempEnvBindings&&this.ctx.state.tempEnvBindings.pop(),this.ctx.state.expansionStderr&&(y={...y,stderr:this.ctx.state.expansionStderr+y.stderr},this.ctx.state.expansionStderr=""),y}async runCommand(t,n,r,s,i=!1,o=!1,a=-1){let l={ctx:this.ctx,runCommand:(u,f,p,h,d,m,g)=>this.runCommand(u,f,p,h,d,m,g),buildExportedEnv:()=>this.buildExportedEnv(),executeUserScript:(u,f,p)=>this.executeUserScript(u,f,p)},c=await i7(l,t,n,r,s,i,o,a);return c!==null?c:o7(l,t,n,s,o)}aliasExpansionStack=new Set;expandAlias(t){return pu(this.ctx.state,t,this.aliasExpansionStack)}async findCommandInPath(t){return La(this.ctx,t)}async executeSubshell(t,n=""){return E7(this.ctx,t,n,r=>this.executeStatement(r))}async executeGroup(t,n=""){return A7(this.ctx,t,n,r=>this.executeStatement(r))}async executeArithmeticCommand(t){t.line!==void 0&&(this.ctx.state.currentLine=t.line);let n=await Xn(this.ctx,t.redirections);if(n)return n;try{let r=await re(this.ctx,t.expression.expression),s=ft(r!==0);return this.ctx.state.expansionStderr&&(s={...s,stderr:this.ctx.state.expansionStderr+s.stderr},this.ctx.state.expansionStderr=""),et(this.ctx,s,t.redirections)}catch(r){let s=W(`bash: arithmetic expression: ${r.message}
1467
1467
  `);return et(this.ctx,s,t.redirections)}}async executeConditionalCommand(t){t.line!==void 0&&(this.ctx.state.currentLine=t.line);let n=await Xn(this.ctx,t.redirections);if(n)return n;try{let r=await Sr(this.ctx,t.expression),s=ft(r);return this.ctx.state.expansionStderr&&(s={...s,stderr:this.ctx.state.expansionStderr+s.stderr},this.ctx.state.expansionStderr=""),et(this.ctx,s,t.redirections)}catch(r){let s=r instanceof Le?1:2,i=W(`bash: conditional expression: ${r.message}
1468
- `,s);return et(this.ctx,i,t.redirections)}}};var xt={maxCallDepth:100,maxCommandCount:1e4,maxLoopIterations:1e4,maxAwkIterations:1e4,maxSedIterations:1e4,maxJqIterations:1e4,maxSqliteTimeoutMs:5e3,maxPythonTimeoutMs:1e4,maxJsTimeoutMs:1e4,maxGlobOperations:1e5,maxStringLength:10485760,maxArrayElements:1e5,maxHeredocSize:10485760,maxSubstitutionDepth:50,maxBraceExpansionResults:1e4,maxOutputSize:10485760,maxFileDescriptors:1024,maxSourceDepth:100};function C7(e){return e?{maxCallDepth:e.maxCallDepth??xt.maxCallDepth,maxCommandCount:e.maxCommandCount??xt.maxCommandCount,maxLoopIterations:e.maxLoopIterations??xt.maxLoopIterations,maxAwkIterations:e.maxAwkIterations??xt.maxAwkIterations,maxSedIterations:e.maxSedIterations??xt.maxSedIterations,maxJqIterations:e.maxJqIterations??xt.maxJqIterations,maxSqliteTimeoutMs:e.maxSqliteTimeoutMs??xt.maxSqliteTimeoutMs,maxPythonTimeoutMs:e.maxPythonTimeoutMs??xt.maxPythonTimeoutMs,maxJsTimeoutMs:e.maxJsTimeoutMs??xt.maxJsTimeoutMs,maxGlobOperations:e.maxGlobOperations??xt.maxGlobOperations,maxStringLength:e.maxStringLength??xt.maxStringLength,maxArrayElements:e.maxArrayElements??xt.maxArrayElements,maxHeredocSize:e.maxHeredocSize??xt.maxHeredocSize,maxSubstitutionDepth:e.maxSubstitutionDepth??xt.maxSubstitutionDepth,maxBraceExpansionResults:e.maxBraceExpansionResults??xt.maxBraceExpansionResults,maxOutputSize:e.maxOutputSize??xt.maxOutputSize,maxFileDescriptors:e.maxFileDescriptors??xt.maxFileDescriptors,maxSourceDepth:e.maxSourceDepth??xt.maxSourceDepth}:{...xt}}k7();un();Zs();function Nf(e){try{let t=new URL(e);return{origin:t.origin,pathname:t.pathname,href:t.href}}catch{return null}}function hv(e){let t=Nf(e);return t?{origin:t.origin,pathPrefix:t.pathname}:null}function N7(e){if(e.includes("\\"))return!0;let t=e.toLowerCase();return t.includes("%2f")||t.includes("%5c")}function dv(e,t){return t==="/"||t===""?!0:t.endsWith("/")?e.startsWith(t):e===t||e.startsWith(`${t}/`)}function If(e,t){let n=Nf(e);if(!n)return!1;let r=hv(t);return!r||n.origin!==r.origin||r.pathPrefix!=="/"&&r.pathPrefix!==""&&N7(n.pathname)?!1:dv(n.pathname,r.pathPrefix)}function I7(e){return typeof e=="string"?e:e.url}function $7(e,t){return!t||t.length===0?!1:t.some(n=>If(e,I7(n)))}function $f(e){let t=mv(e);if(t==="localhost"||t.endsWith(".localhost"))return!0;let n=T7(t);if(n)return Ua(n);let r=yv(t);return r?wv(r):!1}function mv(e){let t=e.trim().toLowerCase();return t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1):t}function gv(e){if(!e)return null;let t=10,n=e;if(n.startsWith("0x")||n.startsWith("0X")?(t=16,n=n.slice(2)):n.length>1&&n.startsWith("0")&&(t=8),!n||t===16&&!/^[0-9a-fA-F]+$/.test(n)||t===10&&!/^\d+$/.test(n)||t===8&&!/^[0-7]+$/.test(n))return null;let r=Number.parseInt(n,t);return!Number.isFinite(r)||r<0?null:r}function T7(e){let t=e.split(".");if(t.length===0||t.length>4)return null;let n=t.map(l=>gv(l));if(n.some(l=>l===null))return null;let r=n;if(t.length===1){let l=r[0];return l>4294967295?null:[l>>>24&255,l>>>16&255,l>>>8&255,l&255]}if(t.length===2){let[l,c]=r;return l>255||c>16777215?null:[l,c>>>16&255,c>>>8&255,c&255]}if(t.length===3){let[l,c,u]=r;return l>255||c>255||u>65535?null:[l,c,u>>>8&255,u&255]}let[s,i,o,a]=r;return s>255||i>255||o>255||a>255?null:[s,i,o,a]}function yv(e){let t=e,n=null;if(t.includes(".")){let m=t.lastIndexOf(":");if(m<0)return null;let g=t.slice(m+1),y=T7(g);if(!y)return null;n=y,t=t.slice(0,m)}let r=t.includes("::")?t.split("::").length-1:0;if(r>1)return null;let[s,i]=t.split("::"),o=s?s.split(":").filter(Boolean):[],a=i?i.split(":").filter(Boolean):[],l=m=>/^[0-9a-f]{1,4}$/i.test(m)?Number.parseInt(m,16):null,c=o.map(l),u=a.map(l);if(c.some(m=>m===null)||u.some(m=>m===null))return null;let f=n?2:0,p=c.length+u.length+f,h=0;if(r===1){if(h=8-p,h<0)return null}else if(p!==8)return null;let d=[...c,...new Array(h).fill(0),...u];return n&&(d.push(n[0]<<8|n[1]),d.push(n[2]<<8|n[3])),d.length===8?d:null}function Ua(e){let[t,n]=e;return t===127||t===10||t===172&&n>=16&&n<=31||t===192&&n===168||t===169&&n===254||t===0||t===100&&n>=64&&n<=127||t===198&&(n===18||n===19)||t===192&&n===0&&e[2]===0||t===192&&n===0&&e[2]===2||t===198&&n===51&&e[2]===100||t===203&&n===0&&e[2]===113||t>=240}function wv(e){if(e.every(s=>s===0)||e.slice(0,7).every(s=>s===0)&&e[7]===1||(e[0]&65472)===65152||(e[0]&65024)===64512)return!0;if(e[0]===0&&e[1]===0&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===65535){let s=[e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255];return Ua(s)}if(e[0]===8193&&e[1]===3512)return!0;if(e[0]===100&&e[1]===65435&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===0){let s=[e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255];return Ua(s)}if(e[0]===100&&e[1]===65435&&e[2]===1)return!0;if(e[0]===8194){let s=[e[1]>>>8&255,e[1]&255,e[2]>>>8&255,e[2]&255];return Ua(s)}return!1}function O7(e){let t=[];for(let n of e){if(typeof n!="string"&&(n===null||typeof n!="object"||!("url"in n)||typeof n.url!="string")){t.push('Invalid allow-list entry: must be a string URL or an object with a "url" string property');continue}let r=I7(n);if(!Nf(r)){t.push(`Invalid URL in allow-list: "${r}" - must be a valid URL with scheme and host (e.g., "https://example.com")`);continue}let i=new URL(r);if(i.protocol!=="http:"&&i.protocol!=="https:"){t.push(`Only http and https URLs are allowed in allow-list: "${r}"`);continue}if(!i.hostname){t.push(`Allow-list entry must include a hostname: "${r}"`);continue}if(i.pathname!=="/"&&i.pathname!==""&&N7(i.pathname)){t.push(`Allow-list entry contains ambiguous path separators: "${r}"`);continue}(i.search||i.hash)&&t.push(`Query strings and fragments are ignored in allow-list entries: "${r}"`)}return t}var Ba=null,Tf=null,R7=!1;function bv(){if(R7||(!Ba||!Tf))return;R7=!0;let e=Ba,t=Tf.lookup;function n(...r){let s=r[0],i=e.getStore();if(typeof s!="string"||!i||i.hostname.toLowerCase()!==s.toLowerCase())return t.apply(this,r);let o={},a;if(r.length===2)a=r[1];else if(r.length>=3){let c=r[1];typeof c=="number"?o={family:c}:c&&typeof c=="object"&&(o=c),a=r[2]}if(typeof a!="function")return t.apply(this,r);let l=a;if(o.family!==void 0&&o.family!==0&&o.family!==i.family){let c=new Error(`ENOTFOUND ${s}`);c.code="ENOTFOUND",c.errno=-3008,c.syscall="getaddrinfo",c.hostname=s,process.nextTick(()=>l(c));return}process.nextTick(()=>{o.all?l(null,[{address:i.address,family:i.family}]):l(null,i.address,i.family)})}Object.defineProperty(Tf,"lookup",{value:n,writable:!0,configurable:!0})}function P7(e,t){return bv(),Ba?Ba.run(e,t):t()}var Rn=class extends Error{constructor(t,n){let r=n??"URL not in allow-list";super(`Network access denied: ${r}: ${t}`),this.name="NetworkAccessDeniedError"}},js=class extends Error{constructor(t){super(`Too many redirects (max: ${t})`),this.name="TooManyRedirectsError"}},Gs=class extends Error{constructor(t){super(`Redirect target not in allow-list: ${t}`),this.name="RedirectNotAllowedError"}},Wa=class extends Error{constructor(t,n){super(`HTTP method '${t}' not allowed. Allowed methods: ${n.join(", ")}`),this.name="MethodNotAllowedError"}},Vs=class extends Error{constructor(t){super(`Response body too large (max: ${t} bytes)`),this.name="ResponseTooLargeError"}};function xv(e){return new Promise((t,n)=>{v7(e,{all:!0},(r,s)=>{r?n(r):t(s)})})}var Ev=20,Av=3e4,Sv=10485760,Cv=["GET","HEAD"],vv=new Set(["GET","HEAD","OPTIONS"]),kv=new Set([301,302,303,307,308]);function Of(e){let t=e.allowedUrlPrefixes??[];if(!e.dangerouslyAllowFullInternetAccess){let h=O7(t);if(h.length>0)throw new Error(`Invalid network allow-list:
1468
+ `,s);return et(this.ctx,i,t.redirections)}}};var xt={maxCallDepth:100,maxCommandCount:1e4,maxLoopIterations:1e4,maxAwkIterations:1e4,maxSedIterations:1e4,maxJqIterations:1e4,maxSqliteTimeoutMs:5e3,maxPythonTimeoutMs:1e4,maxJsTimeoutMs:1e4,maxGlobOperations:1e5,maxStringLength:10485760,maxArrayElements:1e5,maxHeredocSize:10485760,maxSubstitutionDepth:50,maxBraceExpansionResults:1e4,maxOutputSize:10485760,maxFileDescriptors:1024,maxSourceDepth:100};function C7(e){return e?{maxCallDepth:e.maxCallDepth??xt.maxCallDepth,maxCommandCount:e.maxCommandCount??xt.maxCommandCount,maxLoopIterations:e.maxLoopIterations??xt.maxLoopIterations,maxAwkIterations:e.maxAwkIterations??xt.maxAwkIterations,maxSedIterations:e.maxSedIterations??xt.maxSedIterations,maxJqIterations:e.maxJqIterations??xt.maxJqIterations,maxSqliteTimeoutMs:e.maxSqliteTimeoutMs??xt.maxSqliteTimeoutMs,maxPythonTimeoutMs:e.maxPythonTimeoutMs??xt.maxPythonTimeoutMs,maxJsTimeoutMs:e.maxJsTimeoutMs??xt.maxJsTimeoutMs,maxGlobOperations:e.maxGlobOperations??xt.maxGlobOperations,maxStringLength:e.maxStringLength??xt.maxStringLength,maxArrayElements:e.maxArrayElements??xt.maxArrayElements,maxHeredocSize:e.maxHeredocSize??xt.maxHeredocSize,maxSubstitutionDepth:e.maxSubstitutionDepth??xt.maxSubstitutionDepth,maxBraceExpansionResults:e.maxBraceExpansionResults??xt.maxBraceExpansionResults,maxOutputSize:e.maxOutputSize??xt.maxOutputSize,maxFileDescriptors:e.maxFileDescriptors??xt.maxFileDescriptors,maxSourceDepth:e.maxSourceDepth??xt.maxSourceDepth}:{...xt}}k7();un();Zs();function Nf(e){try{let t=new URL(e);return{origin:t.origin,pathname:t.pathname,href:t.href}}catch{return null}}function hv(e){let t=Nf(e);return t?{origin:t.origin,pathPrefix:t.pathname}:null}function N7(e){if(e.includes("\\"))return!0;let t=e.toLowerCase();return t.includes("%2f")||t.includes("%5c")}function dv(e,t){return t==="/"||t===""?!0:t.endsWith("/")?e.startsWith(t):e===t||e.startsWith(`${t}/`)}function If(e,t){let n=Nf(e);if(!n)return!1;let r=hv(t);return!r||n.origin!==r.origin||r.pathPrefix!=="/"&&r.pathPrefix!==""&&N7(n.pathname)?!1:dv(n.pathname,r.pathPrefix)}function I7(e){return typeof e=="string"?e:e.url}function $7(e,t){return!t||t.length===0?!1:t.some(n=>If(e,I7(n)))}function $f(e){let t=mv(e);if(t==="localhost"||t.endsWith(".localhost"))return!0;let n=T7(t);if(n)return Ua(n);let r=yv(t);return r?wv(r):!1}function mv(e){let t=e.trim().toLowerCase();return t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1):t}function gv(e){if(!e)return null;let t=10,n=e;if(n.startsWith("0x")||n.startsWith("0X")?(t=16,n=n.slice(2)):n.length>1&&n.startsWith("0")&&(t=8),!n||t===16&&!/^[0-9a-fA-F]+$/.test(n)||t===10&&!/^\d+$/.test(n)||t===8&&!/^[0-7]+$/.test(n))return null;let r=Number.parseInt(n,t);return!Number.isFinite(r)||r<0?null:r}function T7(e){let t=e.split(".");if(t.length===0||t.length>4)return null;let n=t.map(l=>gv(l));if(n.some(l=>l===null))return null;let r=n;if(t.length===1){let l=r[0];return l>4294967295?null:[l>>>24&255,l>>>16&255,l>>>8&255,l&255]}if(t.length===2){let[l,c]=r;return l>255||c>16777215?null:[l,c>>>16&255,c>>>8&255,c&255]}if(t.length===3){let[l,c,u]=r;return l>255||c>255||u>65535?null:[l,c,u>>>8&255,u&255]}let[s,i,o,a]=r;return s>255||i>255||o>255||a>255?null:[s,i,o,a]}function yv(e){let t=e,n=null;if(t.includes(".")){let m=t.lastIndexOf(":");if(m<0)return null;let g=t.slice(m+1),y=T7(g);if(!y)return null;n=y,t=t.slice(0,m)}let r=t.includes("::")?t.split("::").length-1:0;if(r>1)return null;let[s,i]=t.split("::"),o=s?s.split(":").filter(Boolean):[],a=i?i.split(":").filter(Boolean):[],l=m=>/^[0-9a-f]{1,4}$/i.test(m)?Number.parseInt(m,16):null,c=o.map(l),u=a.map(l);if(c.some(m=>m===null)||u.some(m=>m===null))return null;let f=n?2:0,p=c.length+u.length+f,h=0;if(r===1){if(h=8-p,h<0)return null}else if(p!==8)return null;let d=[...c,...new Array(h).fill(0),...u];return n&&(d.push(n[0]<<8|n[1]),d.push(n[2]<<8|n[3])),d.length===8?d:null}function Ua(e){let[t,n]=e;return t===127||t===10||t===172&&n>=16&&n<=31||t===192&&n===168||t===169&&n===254||t===0||t===100&&n>=64&&n<=127||t===198&&(n===18||n===19)||t===192&&n===0&&e[2]===0||t===192&&n===0&&e[2]===2||t===198&&n===51&&e[2]===100||t===203&&n===0&&e[2]===113||t>=240}function wv(e){if(e.every(s=>s===0)||e.slice(0,7).every(s=>s===0)&&e[7]===1||(e[0]&65472)===65152||(e[0]&65024)===64512)return!0;if(e[0]===0&&e[1]===0&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===65535){let s=[e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255];return Ua(s)}if(e[0]===8193&&e[1]===3512)return!0;if(e[0]===100&&e[1]===65435&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===0){let s=[e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255];return Ua(s)}if(e[0]===100&&e[1]===65435&&e[2]===1)return!0;if(e[0]===8194){let s=[e[1]>>>8&255,e[1]&255,e[2]>>>8&255,e[2]&255];return Ua(s)}return!1}function O7(e){let t=[];for(let n of e){if(typeof n!="string"&&(n===null||typeof n!="object"||!("url"in n)||typeof n.url!="string")){t.push('Invalid allow-list entry: must be a string URL or an object with a "url" string property');continue}let r=I7(n);if(!Nf(r)){t.push(`Invalid URL in allow-list: "${r}" - must be a valid URL with scheme and host (e.g., "https://example.com")`);continue}let i=new URL(r);if(i.protocol!=="http:"&&i.protocol!=="https:"){t.push(`Only http and https URLs are allowed in allow-list: "${r}"`);continue}if(!i.hostname){t.push(`Allow-list entry must include a hostname: "${r}"`);continue}if(i.pathname!=="/"&&i.pathname!==""&&N7(i.pathname)){t.push(`Allow-list entry contains ambiguous path separators: "${r}"`);continue}(i.search||i.hash)&&t.push(`Query strings and fragments are ignored in allow-list entries: "${r}"`)}return t}var Ba=null,Tf=null,R7=!1;function bv(){if(R7||(!Ba||!Tf))return;R7=!0;let e=Ba,t=Tf.lookup;function n(...r){let s=r[0],i=e.getStore();if(typeof s!="string"||!i||i.hostname.toLowerCase()!==s.toLowerCase())return t.apply(this,r);let o={},a;if(r.length===2)a=r[1];else if(r.length>=3){let c=r[1];typeof c=="number"?o={family:c}:c&&typeof c=="object"&&(o=c),a=r[2]}if(typeof a!="function")return t.apply(this,r);let l=a;if(o.family!==void 0&&o.family!==0&&o.family!==i.family){let c=new Error(`ENOTFOUND ${s}`);c.code="ENOTFOUND",c.errno=-3008,c.syscall="getaddrinfo",c.hostname=s,process.nextTick(()=>l(c));return}process.nextTick(()=>{o.all?l(null,[{address:i.address,family:i.family}]):l(null,i.address,i.family)})}Object.defineProperty(Tf,"lookup",{value:n,writable:!0,configurable:!0})}function P7(e,t){return bv(),Ba?Ba.run(e,t):t()}var Pn=class extends Error{constructor(t,n){let r=n??"URL not in allow-list";super(`Network access denied: ${r}: ${t}`),this.name="NetworkAccessDeniedError"}},js=class extends Error{constructor(t){super(`Too many redirects (max: ${t})`),this.name="TooManyRedirectsError"}},Gs=class extends Error{constructor(t){super(`Redirect target not in allow-list: ${t}`),this.name="RedirectNotAllowedError"}},Wa=class extends Error{constructor(t,n){super(`HTTP method '${t}' not allowed. Allowed methods: ${n.join(", ")}`),this.name="MethodNotAllowedError"}},Vs=class extends Error{constructor(t){super(`Response body too large (max: ${t} bytes)`),this.name="ResponseTooLargeError"}};function xv(e){return new Promise((t,n)=>{v7(e,{all:!0},(r,s)=>{r?n(r):t(s)})})}var Ev=20,Av=3e4,Sv=10485760,Cv=["GET","HEAD"],vv=new Set(["GET","HEAD","OPTIONS"]),kv=new Set([301,302,303,307,308]);function Of(e){let t=e.allowedUrlPrefixes??[];if(!e.dangerouslyAllowFullInternetAccess){let h=O7(t);if(h.length>0)throw new Error(`Invalid network allow-list:
1469
1469
  ${h.join(`
1470
- `)}`)}let n=[];for(let h of t)typeof h=="object"&&h.transform&&h.transform.length>0&&n.push(h);function r(h){if(n.length===0)return null;let d=null;for(let m of n)if(If(h,m.url)&&m.transform){d||(d=new Headers);for(let g of m.transform)for(let[y,w]of Object.entries(g.headers))d.set(y,w)}return d}let s=e.maxRedirects??Ev,i=e.timeoutMs??Av,o=e.maxResponseSize??Sv,a=e.dangerouslyAllowFullInternetAccess?["GET","HEAD","POST","PUT","DELETE","PATCH","OPTIONS"]:e.allowedMethods??Cv,l=e.denyPrivateRanges??(typeof process<"u"&&!0),c=e._dnsResolve??xv;async function u(h){if(!e.dangerouslyAllowFullInternetAccess&&!$7(h,t))throw new Rn(h);if(l)try{let d=new URL(h);if($f(d.hostname))throw new Rn(h,"private/loopback IP address blocked");let m=d.hostname;if(/[a-zA-Z]/.test(m))try{let y=await c(m);for(let{address:b}of y)if($f(b))throw new Rn(h,"hostname resolves to private/loopback IP address");let w=y[0];if(w)return{hostname:m,address:w.address,family:w.family===6?6:4}}catch(y){if(y instanceof Rn)throw y;let w=y?.code;if(!(w==="ENOTFOUND"||w==="ENODATA"))throw new Rn(h,"DNS resolution failed for private IP check")}}catch(d){if(d instanceof Rn)throw d}return null}function f(h){if(e.dangerouslyAllowFullInternetAccess)return;let d=h.toUpperCase();if(!a.includes(d))throw new Wa(d,a)}async function p(h,d={}){let m=d.method?.toUpperCase()??"GET",g=await u(h);f(m);let y=h,w=0,b=d.followRedirects??!0,x=d.timeoutMs!==void 0?Math.min(d.timeoutMs,i):i;for(;;){let S=new AbortController,v=Ir(()=>S.abort(),x);try{let $=await Et.runTrustedAsync(()=>{let _=r(y),R=Nv(d.headers,_),P={method:m,headers:R,signal:S.signal,redirect:"manual"};return d.body&&!vv.has(m)&&(P.body=d.body),g?P7(g,()=>fetch(y,P)):fetch(y,P)});if(kv.has($.status)&&b){let _=$.headers.get("location");if(!_)return await D7($,y,o);let R=new URL(_,y).href;try{g=await u(R)}catch{throw new Gs(R)}if(w++,w>s)throw new js(s);y=R;continue}return await D7($,y,o)}finally{ts(v)}}}return p}function Nv(e,t){if(!e&&!t)return;if(!t)return e;let n=e instanceof Headers?new Headers(e):new Headers(e);for(let[r,s]of t)n.set(r,s);return n}async function D7(e,t,n){let r=Object.create(null);if(e.headers.forEach((i,o)=>{r[o.toLowerCase()]=i}),n>0){let i=e.headers.get("content-length");if(i){let o=parseInt(i,10);if(!Number.isNaN(o)&&o>n)throw new Vs(n)}}let s;if(n>0&&e.body){let i=e.body.getReader(),o=[],a=0;for(;;){let{done:c,value:u}=await i.read();if(c)break;if(u){if(a+=u.byteLength,a>n)throw i.cancel(),new Vs(n);o.push(u)}}s=new Uint8Array(a);let l=0;for(let c of o)s.set(c,l),l+=c.byteLength}else{let i=await e.arrayBuffer();if(n>0&&i.byteLength>n)throw new Vs(n);s=new Uint8Array(i)}return{status:e.status,statusText:e.statusText,headers:r,body:s,url:t}}gr();ct();un();function _7(e){return Jr(e)}function Jr(e){return e.statements.map(F7).join(`
1470
+ `)}`)}let n=[];for(let h of t)typeof h=="object"&&h.transform&&h.transform.length>0&&n.push(h);function r(h){if(n.length===0)return null;let d=null;for(let m of n)if(If(h,m.url)&&m.transform){d||(d=new Headers);for(let g of m.transform)for(let[y,w]of Object.entries(g.headers))d.set(y,w)}return d}let s=e.maxRedirects??Ev,i=e.timeoutMs??Av,o=e.maxResponseSize??Sv,a=e.dangerouslyAllowFullInternetAccess?["GET","HEAD","POST","PUT","DELETE","PATCH","OPTIONS"]:e.allowedMethods??Cv,l=e.denyPrivateRanges??(typeof process<"u"&&!0),c=e._dnsResolve??xv;async function u(h){if(!e.dangerouslyAllowFullInternetAccess&&!$7(h,t))throw new Pn(h);if(l)try{let d=new URL(h);if($f(d.hostname))throw new Pn(h,"private/loopback IP address blocked");let m=d.hostname;if(/[a-zA-Z]/.test(m))try{let y=await c(m);for(let{address:b}of y)if($f(b))throw new Pn(h,"hostname resolves to private/loopback IP address");let w=y[0];if(w)return{hostname:m,address:w.address,family:w.family===6?6:4}}catch(y){if(y instanceof Pn)throw y;let w=y?.code;if(!(w==="ENOTFOUND"||w==="ENODATA"))throw new Pn(h,"DNS resolution failed for private IP check")}}catch(d){if(d instanceof Pn)throw d}return null}function f(h){if(e.dangerouslyAllowFullInternetAccess)return;let d=h.toUpperCase();if(!a.includes(d))throw new Wa(d,a)}async function p(h,d={}){let m=d.method?.toUpperCase()??"GET",g=await u(h);f(m);let y=h,w=0,b=d.followRedirects??!0,x=d.timeoutMs!==void 0?Math.min(d.timeoutMs,i):i;for(;;){let S=new AbortController,v=Ir(()=>S.abort(),x);try{let $=await Et.runTrustedAsync(()=>{let _=r(y),R=Nv(d.headers,_),P={method:m,headers:R,signal:S.signal,redirect:"manual"};return d.body&&!vv.has(m)&&(P.body=d.body),g?P7(g,()=>fetch(y,P)):fetch(y,P)});if(kv.has($.status)&&b){let _=$.headers.get("location");if(!_)return await D7($,y,o);let R=new URL(_,y).href;try{g=await u(R)}catch{throw new Gs(R)}if(w++,w>s)throw new js(s);y=R;continue}return await D7($,y,o)}finally{ts(v)}}}return p}function Nv(e,t){if(!e&&!t)return;if(!t)return e;let n=e instanceof Headers?new Headers(e):new Headers(e);for(let[r,s]of t)n.set(r,s);return n}async function D7(e,t,n){let r=Object.create(null);if(e.headers.forEach((i,o)=>{r[o.toLowerCase()]=i}),n>0){let i=e.headers.get("content-length");if(i){let o=parseInt(i,10);if(!Number.isNaN(o)&&o>n)throw new Vs(n)}}let s;if(n>0&&e.body){let i=e.body.getReader(),o=[],a=0;for(;;){let{done:c,value:u}=await i.read();if(c)break;if(u){if(a+=u.byteLength,a>n)throw i.cancel(),new Vs(n);o.push(u)}}s=new Uint8Array(a);let l=0;for(let c of o)s.set(c,l),l+=c.byteLength}else{let i=await e.arrayBuffer();if(n>0&&i.byteLength>n)throw new Vs(n);s=new Uint8Array(i)}return{status:e.status,statusText:e.statusText,headers:r,body:s,url:t}}gr();ct();un();function _7(e){return Jr(e)}function Jr(e){return e.statements.map(F7).join(`
1471
1471
  `)}function F7(e){let t=[];for(let r=0;r<e.pipelines.length;r++)t.push(Iv(e.pipelines[r])),r<e.operators.length&&t.push(e.operators[r]);let n=t.join(" ");return e.background&&(n+=" &"),n}function Iv(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(L7(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 L7(e){switch(e.type){case"SimpleCommand":return $v(e);case"If":return Mv(e);case"For":return Uv(e);case"CStyleFor":return Bv(e);case"While":return Wv(e);case"Until":return zv(e);case"Case":return Hv(e);case"Subshell":return Gv(e);case"Group":return Vv(e);case"ArithmeticCommand":return qv(e);case"ConditionalCommand":return Zv(e);case"FunctionDef":return Kv(e);default:{let t=e;throw new Error(`Unsupported command type: ${t.type}`)}}}function $v(e){let t=[];for(let n of e.assignments)t.push(Tv(n));e.name&&t.push(Wt(e.name));for(let n of e.args)t.push(Wt(n));for(let n of e.redirections)t.push(B7(n));return t.join(" ")}function Tv(e){let t=e.append?"+=":"=";if(e.array){let n=e.array.map(Wt).join(" ");return`${e.name}${t}(${n})`}return e.value?`${e.name}${t}${Wt(e.value)}`:`${e.name}${t}`}function Wt(e){return e.parts.map(t=>za(t,!1)).join("")}function kr(e){return e.parts.map(t=>za(t,!0)).join("")}function za(e,t){switch(e.type){case"Literal":return t?Rv(e.value):Ov(e.value);case"SingleQuoted":return`'${e.value}'`;case"DoubleQuoted":return`"${e.parts.map(n=>za(n,!0)).join("")}"`;case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return M7(e);case"CommandSubstitution":return e.legacy?`\`${Jr(e.body)}\``:`$(${Jr(e.body)})`;case"ArithmeticExpansion":return`$((${qe(e.expression.expression)}))`;case"ProcessSubstitution":return e.direction==="input"?`<(${Jr(e.body)})`:`>(${Jr(e.body)})`;case"BraceExpansion":return Fv(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 Ov(e){return e.replace(/[\s\\'"`!|&;()<>{}[\]*?~#]/g,"\\$&")}function Rv(e){return e.replace(/[$`"\\]/g,"\\$&")}function Pv(e,t){return e.parts.map(n=>Dv(n,t)).join("")}function Dv(e,t){switch(e.type){case"Literal":return t?e.value:e.value.replace(/[$`]/g,"\\$&");case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return M7(e);case"CommandSubstitution":return e.legacy?`\`${Jr(e.body)}\``:`$(${Jr(e.body)})`;case"ArithmeticExpansion":return`$((${qe(e.expression.expression)}))`;default:return za(e,!1)}}function M7(e){return e.operation?`\${${U7(e.parameter,e.operation)}}`:_v(e.parameter)?`\${${e.parameter}}`:`$${e.parameter}`}function _v(e){return!(/^[?#@*$!\-0-9]$/.test(e)||/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))}function U7(e,t){switch(t.type){case"Length":return`#${e}`;case"LengthSliceError":return`#${e}:`;case"BadSubstitution":return t.text;case"DefaultValue":return`${e}${t.checkEmpty?":":""}-${kr(t.word)}`;case"AssignDefault":return`${e}${t.checkEmpty?":":""}=${kr(t.word)}`;case"ErrorIfUnset":return`${e}${t.checkEmpty?":":""}?${t.word?kr(t.word):""}`;case"UseAlternative":return`${e}${t.checkEmpty?":":""}+${kr(t.word)}`;case"Substring":{let n=qe(t.offset.expression);return t.length?`${e}:${n}:${qe(t.length.expression)}`:`${e}:${n}`}case"PatternRemoval":{let n=t.side==="prefix"?"#":"%",r=t.greedy?`${n}${n}`:n;return`${e}${r}${kr(t.pattern)}`}case"PatternReplacement":{let n="/";t.all?n="//":t.anchor==="start"?n="/#":t.anchor==="end"&&(n="/%");let r=t.replacement?`/${kr(t.replacement)}`:"";return`${e}${n}${kr(t.pattern)}${r}`}case"CaseModification":{let n=t.direction==="upper"?"^":",",r=t.all?`${n}${n}`:n,s=t.pattern?kr(t.pattern):"";return`${e}${r}${s}`}case"Transform":return`${e}@${t.operator}`;case"Indirection":return t.innerOp?`!${U7(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 Fv(e){return`{${e.items.map(Lv).join(",")}}`}function Lv(e){if(e.type==="Word")return Wt(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 B7(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=Pv(n.content,n.quoted);return`${t}${e.operator}${r}
1472
- ${s}${n.delimiter}`}return e.operator==="<<<"?`${t}<<< ${Wt(e.target)}`:e.operator==="&>"||e.operator==="&>>"?`${e.operator} ${Wt(e.target)}`:`${t}${e.operator} ${Wt(e.target)}`}function Pn(e){return e.length===0?"":` ${e.map(B7).join(" ")}`}function bn(e){return e.map(F7).join(`
1472
+ ${s}${n.delimiter}`}return e.operator==="<<<"?`${t}<<< ${Wt(e.target)}`:e.operator==="&>"||e.operator==="&>>"?`${e.operator} ${Wt(e.target)}`:`${t}${e.operator} ${Wt(e.target)}`}function Dn(e){return e.length===0?"":` ${e.map(B7).join(" ")}`}function bn(e){return e.map(F7).join(`
1473
1473
  `)}function Mv(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} ${bn(r.condition)}; then
1474
1474
  ${bn(r.body)}`)}return e.elseBody&&t.push(`else
1475
1475
  ${bn(e.elseBody)}`),`${t.join(`
1476
1476
  `)}
1477
- fi${Pn(e.redirections)}`}function Uv(e){let t;if(e.words===null)t=`for ${e.variable}`;else{let n=e.words.map(Wt).join(" ");t=`for ${e.variable} in ${n}`}return`${t}; do
1477
+ fi${Dn(e.redirections)}`}function Uv(e){let t;if(e.words===null)t=`for ${e.variable}`;else{let n=e.words.map(Wt).join(" ");t=`for ${e.variable} in ${n}`}return`${t}; do
1478
1478
  ${bn(e.body)}
1479
- done${Pn(e.redirections)}`}function Bv(e){let t=e.init?qe(e.init.expression):"",n=e.condition?qe(e.condition.expression):"",r=e.update?qe(e.update.expression):"";return`for ((${t}; ${n}; ${r})); do
1479
+ done${Dn(e.redirections)}`}function Bv(e){let t=e.init?qe(e.init.expression):"",n=e.condition?qe(e.condition.expression):"",r=e.update?qe(e.update.expression):"";return`for ((${t}; ${n}; ${r})); do
1480
1480
  ${bn(e.body)}
1481
- done${Pn(e.redirections)}`}function Wv(e){return`while ${bn(e.condition)}; do
1481
+ done${Dn(e.redirections)}`}function Wv(e){return`while ${bn(e.condition)}; do
1482
1482
  ${bn(e.body)}
1483
- done${Pn(e.redirections)}`}function zv(e){return`until ${bn(e.condition)}; do
1483
+ done${Dn(e.redirections)}`}function zv(e){return`until ${bn(e.condition)}; do
1484
1484
  ${bn(e.body)}
1485
- done${Pn(e.redirections)}`}function Hv(e){let t=e.items.map(jv).join(`
1485
+ done${Dn(e.redirections)}`}function Hv(e){let t=e.items.map(jv).join(`
1486
1486
  `);return`case ${Wt(e.word)} in
1487
1487
  ${t}
1488
- esac${Pn(e.redirections)}`}function jv(e){let t=e.patterns.map(Wt).join(" | "),n=bn(e.body);return n?`${t})
1488
+ esac${Dn(e.redirections)}`}function jv(e){let t=e.patterns.map(Wt).join(" | "),n=bn(e.body);return n?`${t})
1489
1489
  ${n}
1490
1490
  ${e.terminator}`:`${t})
1491
- ${e.terminator}`}function Gv(e){return`(${bn(e.body)})${Pn(e.redirections)}`}function Vv(e){return`{ ${bn(e.body)}; }${Pn(e.redirections)}`}function qv(e){return`((${qe(e.expression.expression)}))${Pn(e.redirections)}`}function Zv(e){return`[[ ${Yr(e.expression)} ]]${Pn(e.redirections)}`}function Kv(e){let t=L7(e.body);return`${e.name}() ${t}${Pn(e.redirections)}`}function qe(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`${qe(e.left)} ${e.operator} ${qe(e.right)}`;case"ArithUnary":return e.prefix?`${e.operator}${qe(e.operand)}`:`${qe(e.operand)}${e.operator}`;case"ArithTernary":return`${qe(e.condition)} ? ${qe(e.consequent)} : ${qe(e.alternate)}`;case"ArithAssignment":return`${e.subscript?`${e.variable}[${qe(e.subscript)}]`:e.stringKey!==void 0?`${e.variable}[${e.stringKey}]`:e.variable} ${e.operator} ${qe(e.value)}`;case"ArithDynamicAssignment":return`${e.subscript?`${qe(e.target)}[${qe(e.subscript)}]`:qe(e.target)} ${e.operator} ${qe(e.value)}`;case"ArithDynamicElement":return`${qe(e.nameExpr)}[${qe(e.subscript)}]`;case"ArithGroup":return`(${qe(e.expression)})`;case"ArithNested":return`$((${qe(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}[${qe(e.index)}]`:e.array;case"ArithDynamicBase":return`\${${e.baseExpr}}#${e.value}`;case"ArithDynamicNumber":return`\${${e.prefix}}${e.suffix}`;case"ArithConcat":return e.parts.map(qe).join("");case"ArithDoubleSubscript":return`${e.array}[${qe(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 Yr(e){switch(e.type){case"CondBinary":return`${Wt(e.left)} ${e.operator} ${Wt(e.right)}`;case"CondUnary":return`${e.operator} ${Wt(e.operand)}`;case"CondNot":return`! ${Yr(e.operand)}`;case"CondAnd":return`${Yr(e.left)} && ${Yr(e.right)}`;case"CondOr":return`${Yr(e.left)} || ${Yr(e.right)}`;case"CondGroup":return`( ${Yr(e.expression)} )`;case"CondWord":return Wt(e.word);default:{let t=e;throw new Error(`Unsupported conditional expression type: ${t.type}`)}}}var Rf=class{fs;commands=new Map;useDefaultLayout=!1;limits;secureFetch;sleepFn;traceFn;logger;defenseInDepthConfig;coverageWriter;jsBootstrapCode;invokeToolFn;transformPlugins=[];state;constructor(t={}){let n=t.fs??new rr(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",`
1491
+ ${e.terminator}`}function Gv(e){return`(${bn(e.body)})${Dn(e.redirections)}`}function Vv(e){return`{ ${bn(e.body)}; }${Dn(e.redirections)}`}function qv(e){return`((${qe(e.expression.expression)}))${Dn(e.redirections)}`}function Zv(e){return`[[ ${Yr(e.expression)} ]]${Dn(e.redirections)}`}function Kv(e){let t=L7(e.body);return`${e.name}() ${t}${Dn(e.redirections)}`}function qe(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`${qe(e.left)} ${e.operator} ${qe(e.right)}`;case"ArithUnary":return e.prefix?`${e.operator}${qe(e.operand)}`:`${qe(e.operand)}${e.operator}`;case"ArithTernary":return`${qe(e.condition)} ? ${qe(e.consequent)} : ${qe(e.alternate)}`;case"ArithAssignment":return`${e.subscript?`${e.variable}[${qe(e.subscript)}]`:e.stringKey!==void 0?`${e.variable}[${e.stringKey}]`:e.variable} ${e.operator} ${qe(e.value)}`;case"ArithDynamicAssignment":return`${e.subscript?`${qe(e.target)}[${qe(e.subscript)}]`:qe(e.target)} ${e.operator} ${qe(e.value)}`;case"ArithDynamicElement":return`${qe(e.nameExpr)}[${qe(e.subscript)}]`;case"ArithGroup":return`(${qe(e.expression)})`;case"ArithNested":return`$((${qe(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}[${qe(e.index)}]`:e.array;case"ArithDynamicBase":return`\${${e.baseExpr}}#${e.value}`;case"ArithDynamicNumber":return`\${${e.prefix}}${e.suffix}`;case"ArithConcat":return e.parts.map(qe).join("");case"ArithDoubleSubscript":return`${e.array}[${qe(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 Yr(e){switch(e.type){case"CondBinary":return`${Wt(e.left)} ${e.operator} ${Wt(e.right)}`;case"CondUnary":return`${e.operator} ${Wt(e.operand)}`;case"CondNot":return`! ${Yr(e.operand)}`;case"CondAnd":return`${Yr(e.left)} && ${Yr(e.right)}`;case"CondOr":return`${Yr(e.left)} || ${Yr(e.right)}`;case"CondGroup":return`( ${Yr(e.expression)} )`;case"CondWord":return Wt(e.word);default:{let t=e;throw new Error(`Unsupported conditional expression type: ${t.type}`)}}}var Rf=class{fs;commands=new Map;useDefaultLayout=!1;limits;secureFetch;sleepFn;traceFn;logger;defenseInDepthConfig;coverageWriter;jsBootstrapCode;invokeToolFn;transformPlugins=[];state;constructor(t={}){let n=t.fs??new rr(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",`
1492
1492
  `],["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=C7({...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=Of(t.network)),this.sleepFn=t.sleep,this.traceFn=t.trace,this.logger=t.logger,this.defenseInDepthConfig=t.defenseInDepth??!0,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",zc(this.state.options)),this.state.env.set("BASHOPTS",Hc(this.state.shoptOptions)),F2(n,this.useDefaultLayout,{pid:this.state.virtualPid,ppid:this.state.virtualPpid,uid:this.state.virtualUid,gid:this.state.virtualGid}),r!=="/"&&n instanceof rr)try{n.mkdirSync(r,{recursive:!0})}catch{}for(let o of k2(t.commands))this.registerCommand(o);if(t.fetch||t.network)for(let o of N2())this.registerCommand(o);if(t.python)for(let o of I2())this.registerCommand(o);let i=typeof t.javascript=="object"?t.javascript:Object.create(null);if(t.javascript||i.invokeTool){for(let o of $2())this.registerCommand(o);i.bootstrap&&(this.jsBootstrapCode=i.bootstrap),i.invokeTool&&(this.invokeToolFn=i.invokeTool)}if(t.customCommands)for(let o of t.customCommands)T2(o)?this.registerCommand(O2(o)):this.registerCommand({...o,trusted:o.trusted??!0})}registerCommand(t){this.commands.set(t.name,t);let n=this.fs;if(typeof n.writeFileSync=="function"){let r=`#!/bin/bash
1493
1493
  # Built-in command: ${t.name}
1494
1494
  `;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=z7(t.stdout),t.stderr=z7(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.
@@ -1498,7 +1498,7 @@ ${e.terminator}`}function Gv(e){return`(${bn(e.body)})${Pn(e.redirections)}`}fun
1498
1498
  `,exitCode:2,env:pn(this.state.env,n?.env)});if(f instanceof RangeError)return this.logResult({stdout:"",stderr:`bash: ${He(f.message)}
1499
1499
  `,exitCode:1,env:pn(this.state.env,n?.env)});throw f}finally{u?.deactivate()}}async readFile(t){return this.fs.readFile(this.fs.resolvePath(this.state.cwd,t))}async writeFile(t,n){return this.fs.writeFile(this.fs.resolvePath(this.state.cwd,t),n)}getCwd(){return this.state.cwd}getEnv(){return Ct(this.state.env)}registerTransformPlugin(t){this.transformPlugins.push(t)}transform(t){let n=W7(t),r=Nn(n,{maxHeredocSize:this.limits.maxHeredocSize}),s=Object.create(null);for(let i of this.transformPlugins){let o=i.transform({ast:r,metadata:s});r=o.ast,o.metadata&&(s=Dr(s,o.metadata))}return{script:_7(r),ast:r,metadata:s}}};function W7(e){let t=e.split(`
1500
1500
  `),n=[],r=[];for(let s=0;s<t.length;s++){let i=t[s];if(r.length>0){let l=r[r.length-1];if((l.stripTabs?i.replace(/^\t+/,""):i)===l.delimiter){n.push(i.trimStart()),r.pop();continue}n.push(i);continue}let o=i.trimStart();n.push(o);let a=/<<(-?)\s*(['"]?)([\w-]+)\2/g;for(let l of o.matchAll(a)){let c=l[1]==="-",u=l[3];r.push({delimiter:u,stripTabs:c})}}return n.join(`
1501
- `)}var Qv=new TextDecoder("utf-8",{fatal:!0});function z7(e){if(!e)return e;let t=!1;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);if(s>255)return e;s>127&&(t=!0)}if(!t)return e;let n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);try{return Qv.decode(n)}catch{return e}}function Xv(e,t){if(e!==void 0)return t==="bytes"?e:Dn(e)}he();var Ha=class{baseFs;mounts=new Map;constructor(t){if(this.baseFs=t?.base??new rr,t?.mounts)for(let{mountPoint:n,filesystem:r}of t.mounts)this.mount(n,r)}mount(t,n){this.validateMountPath(t);let r=ke(t);this.validateMount(r),this.mounts.set(r,{mountPoint:r,filesystem:n})}unmount(t){let n=ke(t);if(!this.mounts.has(n))throw new Error(`No filesystem mounted at '${t}'`);this.mounts.delete(n)}getMounts(){return Array.from(this.mounts.values()).map(t=>({mountPoint:t.mountPoint,filesystem:t.filesystem}))}isMountPoint(t){let n=ke(t);return this.mounts.has(n)}validateMountPath(t){let n=t.split("/");for(let r of n)if(r==="."||r==="..")throw new Error(`Invalid mount point '${t}': contains '.' or '..' segments`)}validateMount(t){if(t==="/")throw new Error("Cannot mount at root '/'");for(let n of this.mounts.keys())if(n!==t){if(t.startsWith(`${n}/`))throw new Error(`Cannot mount at '${t}': inside existing mount '${n}'`);if(n.startsWith(`${t}/`))throw new Error(`Cannot mount at '${t}': would contain existing mount '${n}'`)}}routePath(t){lt(t,"access");let n=ke(t),r=null,s=0;for(let i of this.mounts.values()){let o=i.mountPoint;if(n===o)return{fs:i.filesystem,relativePath:"/"};n.startsWith(`${o}/`)&&o.length>s&&(r=i,s=o.length)}if(r){let i=n.slice(s);return{fs:r.filesystem,relativePath:i||"/"}}return{fs:this.baseFs,relativePath:n}}getChildMountPoints(t){let n=ke(t),r=n==="/"?"/":`${n}/`,s=[];for(let i of this.mounts.keys())if(i.startsWith(r)){let a=i.slice(r.length).split("/")[0];a&&!s.includes(a)&&s.push(a)}return s}async readFile(t,n){let{fs:r,relativePath:s}=this.routePath(t);return r.readFile(s,n)}async readFileBytes(t){let{fs:n,relativePath:r}=this.routePath(t);return _n(n,r)}async readFileBuffer(t){let{fs:n,relativePath:r}=this.routePath(t);return n.readFileBuffer(r)}async writeFile(t,n,r){let{fs:s,relativePath:i}=this.routePath(t);return s.writeFile(i,n,r)}async appendFile(t,n,r){let{fs:s,relativePath:i}=this.routePath(t);return s.appendFile(i,n,r)}async exists(t){let n=ke(t);if(this.mounts.has(n)||this.getChildMountPoints(n).length>0)return!0;let{fs:s,relativePath:i}=this.routePath(t);return s.exists(i)}async stat(t){let n=ke(t),r=this.mounts.get(n);if(r)try{return await r.filesystem.stat("/")}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}if(this.getChildMountPoints(n).length>0)try{return await this.baseFs.stat(n)}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}let{fs:i,relativePath:o}=this.routePath(t);return i.stat(o)}async lstat(t){let n=ke(t),r=this.mounts.get(n);if(r)try{return await r.filesystem.lstat("/")}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}if(this.getChildMountPoints(n).length>0)try{return await this.baseFs.lstat(n)}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}let{fs:i,relativePath:o}=this.routePath(t);return i.lstat(o)}async mkdir(t,n){let r=ke(t);if(this.mounts.has(r)){if(n?.recursive)return;throw new Error(`EEXIST: directory already exists, mkdir '${t}'`)}if(this.getChildMountPoints(r).length>0&&n?.recursive)return;let{fs:i,relativePath:o}=this.routePath(t);return i.mkdir(o,n)}async readdir(t){let n=ke(t),r=new Set,s=null,{fs:i,relativePath:o}=this.routePath(t);try{let l=await i.readdir(o);for(let c of l)r.add(c)}catch(l){let c=l.code,u=l.message||"";if(c!=="ENOENT"&&!u.includes("ENOENT"))throw l;s=l}let a=this.getChildMountPoints(n);for(let l of a)r.add(l);if(r.size===0&&s&&!this.mounts.has(n))throw s;return Array.from(r).sort()}async rm(t,n){let r=ke(t);if(this.mounts.has(r))throw new Error(`EBUSY: mount point, cannot remove '${t}'`);if(this.getChildMountPoints(r).length>0)throw new Error(`EBUSY: contains mount points, cannot remove '${t}'`);let{fs:i,relativePath:o}=this.routePath(t);return i.rm(o,n)}async cp(t,n,r){let s=this.routePath(t),i=this.routePath(n);return s.fs===i.fs?s.fs.cp(s.relativePath,i.relativePath,r):this.crossMountCopy(t,n,r)}async mv(t,n){let r=ke(t);if(this.mounts.has(r))throw new Error(`EBUSY: mount point, cannot move '${t}'`);let s=this.routePath(t),i=this.routePath(n);if(s.fs===i.fs)return s.fs.mv(s.relativePath,i.relativePath);await this.cp(t,n,{recursive:!0}),await this.rm(t,{recursive:!0})}resolvePath(t,n){return Zo(t,n)}getAllPaths(){let t=new Set;for(let n of this.baseFs.getAllPaths())t.add(n);for(let n of this.mounts.keys()){let r=n.split("/").filter(Boolean),s="";for(let o of r)s=`${s}/${o}`,t.add(s);let i=this.mounts.get(n);if(i)for(let o of i.filesystem.getAllPaths())o==="/"?t.add(n):t.add(`${n}${o}`)}return Array.from(t).sort()}async chmod(t,n){let r=ke(t),s=this.mounts.get(r);if(s)return s.filesystem.chmod("/",n);let{fs:i,relativePath:o}=this.routePath(t);return i.chmod(o,n)}async symlink(t,n){let{fs:r,relativePath:s}=this.routePath(n);return r.symlink(t,s)}async link(t,n){let r=this.routePath(t),s=this.routePath(n);if(r.fs!==s.fs)throw new Error(`EXDEV: cross-device link not permitted, link '${t}' -> '${n}'`);return r.fs.link(r.relativePath,s.relativePath)}async readlink(t){let{fs:n,relativePath:r}=this.routePath(t);return n.readlink(r)}async realpath(t){let n=ke(t);if(this.mounts.get(n))return n;let{fs:s,relativePath:i}=this.routePath(t),o=await s.realpath(i);for(let[a,l]of this.mounts)if(n===a||n.startsWith(`${a}/`))return o==="/"?a:`${a}${o}`;return o}async crossMountCopy(t,n,r){let s=await this.lstat(t);if(s.isFile){let i=await this.readFileBuffer(t);await this.writeFile(n,i),await this.chmod(n,s.mode)}else if(s.isDirectory){if(!r?.recursive)throw new Error(`cp: ${t} is a directory (not copied)`);await this.mkdir(n,{recursive:!0});let i=await this.readdir(t);for(let o of i){let a=hr(t,o),l=hr(n,o);await this.crossMountCopy(a,l,r)}}else if(s.isSymbolicLink){let i=await this.readlink(t);await this.symlink(i,n)}}async utimes(t,n,r){let{fs:s,relativePath:i}=this.routePath(t);return s.utimes(i,n,r)}};export{Rf as Bash,rr as InMemoryFs,Ha as MountableFs,Rn as NetworkAccessDeniedError,Gs as RedirectNotAllowedError,js as TooManyRedirectsError,kA as defineCommand,CA as getCommandNames,vA as getNetworkCommandNames};
1501
+ `)}var Qv=new TextDecoder("utf-8",{fatal:!0});function z7(e){if(!e)return e;let t=!1;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);if(s>255)return e;s>127&&(t=!0)}if(!t)return e;let n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);try{return Qv.decode(n)}catch{return e}}function Xv(e,t){if(e!==void 0)return t==="bytes"?e:_n(e)}he();var Ha=class{baseFs;mounts=new Map;constructor(t){if(this.baseFs=t?.base??new rr,t?.mounts)for(let{mountPoint:n,filesystem:r}of t.mounts)this.mount(n,r)}mount(t,n){this.validateMountPath(t);let r=Ne(t);this.validateMount(r),this.mounts.set(r,{mountPoint:r,filesystem:n})}unmount(t){let n=Ne(t);if(!this.mounts.has(n))throw new Error(`No filesystem mounted at '${t}'`);this.mounts.delete(n)}getMounts(){return Array.from(this.mounts.values()).map(t=>({mountPoint:t.mountPoint,filesystem:t.filesystem}))}isMountPoint(t){let n=Ne(t);return this.mounts.has(n)}validateMountPath(t){let n=t.split("/");for(let r of n)if(r==="."||r==="..")throw new Error(`Invalid mount point '${t}': contains '.' or '..' segments`)}validateMount(t){if(t==="/")throw new Error("Cannot mount at root '/'");for(let n of this.mounts.keys())if(n!==t){if(t.startsWith(`${n}/`))throw new Error(`Cannot mount at '${t}': inside existing mount '${n}'`);if(n.startsWith(`${t}/`))throw new Error(`Cannot mount at '${t}': would contain existing mount '${n}'`)}}routePath(t){lt(t,"access");let n=Ne(t),r=null,s=0;for(let i of this.mounts.values()){let o=i.mountPoint;if(n===o)return{fs:i.filesystem,relativePath:"/"};n.startsWith(`${o}/`)&&o.length>s&&(r=i,s=o.length)}if(r){let i=n.slice(s);return{fs:r.filesystem,relativePath:i||"/"}}return{fs:this.baseFs,relativePath:n}}getChildMountPoints(t){let n=Ne(t),r=n==="/"?"/":`${n}/`,s=[];for(let i of this.mounts.keys())if(i.startsWith(r)){let a=i.slice(r.length).split("/")[0];a&&!s.includes(a)&&s.push(a)}return s}async readFile(t,n){let{fs:r,relativePath:s}=this.routePath(t);return r.readFile(s,n)}async readFileBytes(t){let{fs:n,relativePath:r}=this.routePath(t);return Fn(n,r)}async readFileBuffer(t){let{fs:n,relativePath:r}=this.routePath(t);return n.readFileBuffer(r)}async writeFile(t,n,r){let{fs:s,relativePath:i}=this.routePath(t);return s.writeFile(i,n,r)}async appendFile(t,n,r){let{fs:s,relativePath:i}=this.routePath(t);return s.appendFile(i,n,r)}async exists(t){let n=Ne(t);if(this.mounts.has(n)||this.getChildMountPoints(n).length>0)return!0;let{fs:s,relativePath:i}=this.routePath(t);return s.exists(i)}async stat(t){let n=Ne(t),r=this.mounts.get(n);if(r)try{return await r.filesystem.stat("/")}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}if(this.getChildMountPoints(n).length>0)try{return await this.baseFs.stat(n)}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}let{fs:i,relativePath:o}=this.routePath(t);return i.stat(o)}async lstat(t){let n=Ne(t),r=this.mounts.get(n);if(r)try{return await r.filesystem.lstat("/")}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}if(this.getChildMountPoints(n).length>0)try{return await this.baseFs.lstat(n)}catch{return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,mode:493,size:0,mtime:new Date}}let{fs:i,relativePath:o}=this.routePath(t);return i.lstat(o)}async mkdir(t,n){let r=Ne(t);if(this.mounts.has(r)){if(n?.recursive)return;throw new Error(`EEXIST: directory already exists, mkdir '${t}'`)}if(this.getChildMountPoints(r).length>0&&n?.recursive)return;let{fs:i,relativePath:o}=this.routePath(t);return i.mkdir(o,n)}async readdir(t){let n=Ne(t),r=new Set,s=null,{fs:i,relativePath:o}=this.routePath(t);try{let l=await i.readdir(o);for(let c of l)r.add(c)}catch(l){let c=l.code,u=l.message||"";if(c!=="ENOENT"&&!u.includes("ENOENT"))throw l;s=l}let a=this.getChildMountPoints(n);for(let l of a)r.add(l);if(r.size===0&&s&&!this.mounts.has(n))throw s;return Array.from(r).sort()}async rm(t,n){let r=Ne(t);if(this.mounts.has(r))throw new Error(`EBUSY: mount point, cannot remove '${t}'`);if(this.getChildMountPoints(r).length>0)throw new Error(`EBUSY: contains mount points, cannot remove '${t}'`);let{fs:i,relativePath:o}=this.routePath(t);return i.rm(o,n)}async cp(t,n,r){let s=this.routePath(t),i=this.routePath(n);return s.fs===i.fs?s.fs.cp(s.relativePath,i.relativePath,r):this.crossMountCopy(t,n,r)}async mv(t,n){let r=Ne(t);if(this.mounts.has(r))throw new Error(`EBUSY: mount point, cannot move '${t}'`);let s=this.routePath(t),i=this.routePath(n);if(s.fs===i.fs)return s.fs.mv(s.relativePath,i.relativePath);await this.cp(t,n,{recursive:!0}),await this.rm(t,{recursive:!0})}resolvePath(t,n){return Zo(t,n)}getAllPaths(){let t=new Set;for(let n of this.baseFs.getAllPaths())t.add(n);for(let n of this.mounts.keys()){let r=n.split("/").filter(Boolean),s="";for(let o of r)s=`${s}/${o}`,t.add(s);let i=this.mounts.get(n);if(i)for(let o of i.filesystem.getAllPaths())o==="/"?t.add(n):t.add(`${n}${o}`)}return Array.from(t).sort()}async chmod(t,n){let r=Ne(t),s=this.mounts.get(r);if(s)return s.filesystem.chmod("/",n);let{fs:i,relativePath:o}=this.routePath(t);return i.chmod(o,n)}async symlink(t,n){let{fs:r,relativePath:s}=this.routePath(n);return r.symlink(t,s)}async link(t,n){let r=this.routePath(t),s=this.routePath(n);if(r.fs!==s.fs)throw new Error(`EXDEV: cross-device link not permitted, link '${t}' -> '${n}'`);return r.fs.link(r.relativePath,s.relativePath)}async readlink(t){let{fs:n,relativePath:r}=this.routePath(t);return n.readlink(r)}async realpath(t){let n=Ne(t);if(this.mounts.get(n))return n;let{fs:s,relativePath:i}=this.routePath(t),o=await s.realpath(i);for(let[a,l]of this.mounts)if(n===a||n.startsWith(`${a}/`))return o==="/"?a:`${a}${o}`;return o}async crossMountCopy(t,n,r){let s=await this.lstat(t);if(s.isFile){let i=await this.readFileBuffer(t);await this.writeFile(n,i),await this.chmod(n,s.mode)}else if(s.isDirectory){if(!r?.recursive)throw new Error(`cp: ${t} is a directory (not copied)`);await this.mkdir(n,{recursive:!0});let i=await this.readdir(t);for(let o of i){let a=hr(t,o),l=hr(n,o);await this.crossMountCopy(a,l,r)}}else if(s.isSymbolicLink){let i=await this.readlink(t);await this.symlink(i,n)}}async utimes(t,n,r){let{fs:s,relativePath:i}=this.routePath(t);return s.utimes(i,n,r)}};export{Rf as Bash,rr as InMemoryFs,Ha as MountableFs,Pn as NetworkAccessDeniedError,Gs as RedirectNotAllowedError,js as TooManyRedirectsError,kA as defineCommand,CA as getCommandNames,vA as getNetworkCommandNames};
1502
1502
  /*! Bundled license information:
1503
1503
 
1504
1504
  re2js/build/index.esm.js: