brsh 2.4.0 → 2.4.1

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.
@@ -1,4 +1,4 @@
1
- "use strict";var Terminal=(function(){var e=(e,t)=>()=>(e&&(t=e(e=0)),t),t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),n,r=e((()=>{n=globalThis||self})),i=t(((e,t)=>{var n=new Set([`getFileByPath`,`setFileByPath`,`deleteFileByPath`,`exists`,`stat`,`absolutePath`,`getMode`,`setMode`,`isReadable`,`isWritable`,`isExecutable`,`getSize`,`autoComplete`,`isRealFilesystem`,`isSymlink`]);t.exports=class{isReadable(e){let t=this.getMode(e);return t===null?!1:(t&256)!=0}isWritable(e){let t=this.getMode(e);return t===null?!1:(t&128)!=0}isExecutable(e){let t=this.getMode(e);return t===null?!1:(t&64)!=0}sandbox(){let e=this;return new Proxy(Object.create(null),{get(t,r){if(!n.has(r))return;let i=e[r];return typeof i==`function`?i.bind(e):i},set(){return!1},has(e,t){return n.has(t)}})}_triggerChange(){!this._onChange||this._changeScheduled||(this._changeScheduled=!0,Promise.resolve().then(()=>{this._changeScheduled=!1,typeof this._onChange==`function`&&this._onChange(this.getRaw(),this.getRawPermissions())}))}}})),a=t(((e,t)=>{var n=i();t.exports=class extends n{constructor(e=`/`,t={},n={},r=null){super(),this.fileSystem=t,this.permissions=Object.assign({},n),this.cwd=e,this._onChange=r,this._changeScheduled=!1}getFileByPath(e){let t=this._getFileByAbsolutePath(this._pathToAbsolute(e));return t==null||!this.isReadable(e)?null:t}_getFileRaw(e){return this._getFileByAbsolutePath(this._pathToAbsolute(e))}exists(e){return this._getFileByAbsolutePath(this._pathToAbsolute(e))!=null}stat(e){let t=this._getFileByAbsolutePath(this._pathToAbsolute(e));return t==null?null:{isDirectory:t.constructor===Object,isFile:typeof t==`string`,isCommand:typeof t==`function`}}_pathToAbsolute(e){return e.startsWith(`./`)&&(e=e.substring(2)),e.startsWith(`/`)||(e=this.cwd+e),this._traverseComplexAbsolutePath(e)}_traverseComplexAbsolutePath(e){let t=e.split(`/`);for(;t.includes(`..`);){let e=t.indexOf(`..`)-1;t.splice(e,2)}return t.join(`/`)}absolutePath(e){return this._pathToAbsolute(e)}setFileByPath(e,t,n=!1){let r=this._pathToAbsolute(e);if(this._getFileByAbsolutePath(r)!=null){if(!this.isWritable(e))throw Error(`Permission denied`)}else{let e=r.split(`/`);e.pop();let t=e.join(`/`)||`/`,n=this.getMode(t);if(n!==null&&!(n&128))throw Error(`Permission denied`)}this._setFileByAbsolutePath(r,t,n),this._triggerChange()}_setFileRaw(e,t,n=!1){let r=this._pathToAbsolute(e);this._setFileByAbsolutePath(r,t,n),this._triggerChange()}_setFileByAbsolutePath(e,t,n=!0){let r=e.split(`/`);r.shift();let i=r.pop(),a=r.reduce((e,t)=>{if(!e[t]){if(!n)throw Error(`${t}: No such file or directory`);e[t]={}}return e[t]},this.fileSystem);a[i]=t}_getFileByAbsolutePath(e){let t=e.split(`/`);return t.shift(),t[t.length-1].length<1&&t.pop(),t.reduce((e,t)=>e&&e[t]?e[t]:null,this.fileSystem)}deleteFileByPath(e){let t=this._pathToAbsolute(e),n=t.split(`/`);n.pop();let r=n.join(`/`)||`/`,i=this.getMode(r);if(i!==null&&!(i&128))throw Error(`${e}: Permission denied`);this._deleteByAbsolutePath(t);let a=t+`/`;Object.keys(this.permissions).forEach(e=>{(e===t||e.startsWith(a))&&delete this.permissions[e]}),this._triggerChange()}_deleteByAbsolutePath(e){let t=e.split(`/`);t.shift(),t[t.length-1]===``&&t.pop();let n=t.pop();if(!n)return;let r=t.reduce((e,t)=>e&&e[t]?e[t]:null,this.fileSystem);r&&n in r&&delete r[n]}getMode(e){let t=this._pathToAbsolute(e);if(this.permissions[t]!==void 0)return this.permissions[t];let n=this._getFileByAbsolutePath(t);return n==null?null:n.constructor===Object?493:typeof n==`function`?365:420}setMode(e,t){let n=this._pathToAbsolute(e);this.permissions[n]=t,this._triggerChange()}getSize(e){let t=this._pathToAbsolute(e),n=this._getFileByAbsolutePath(t);return n==null?0:n.constructor===Object?JSON.stringify(n).length:n.toString().length}getRawPermissions(){return Object.assign({},this.permissions)}setCwd(e){this.cwd=this._pathToAbsolute(e.endsWith(`/`)?e:e+`/`)}getRaw(){return this.fileSystem}addFiles(e){Object.entries(e).forEach(([e,t])=>{this._setFileRaw(e,t,!0)})}autoComplete(e,t){let n=this._pathToAbsolute(e).split(`/`),r=n.pop(),i=this._getFileRaw(n.length>1?n.join(`/`):`/`),a=this._getFileRaw(t);if(i&&i.constructor===Object){let t=Object.keys(i).filter(e=>e.startsWith(r));r.length<1&&(t=t.filter(e=>!e.startsWith(`.`)));let n=e.split(`/`);n.pop();let o=i;if(t.length<1&&n.length<1&&a&&(t=Object.keys(a).filter(e=>e.startsWith(r)),o=a),t.length)return{path:n.length?n.join(`/`):null,options:t.map(e=>o[e]&&o[e].constructor===Object?e.concat(`/`):e)}}return null}}}));function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function s(){throw Error(`setTimeout has not been defined`)}function c(){throw Error(`clearTimeout has not been defined`)}function l(e){if(_===setTimeout)return setTimeout(e,0);if((_===s||!_)&&setTimeout)return _=setTimeout,setTimeout(e,0);try{return _(e,0)}catch{try{return _.call(null,e,0)}catch{return _.call(this,e,0)}}}function u(e){if(v===clearTimeout)return clearTimeout(e);if((v===c||!v)&&clearTimeout)return v=clearTimeout,clearTimeout(e);try{return v(e)}catch{try{return v.call(null,e)}catch{return v.call(this,e)}}}function d(){!b||!x||(b=!1,x.length?y=x.concat(y):S=-1,y.length&&f())}function f(){if(!b){var e=l(d);b=!0;for(var t=y.length;t;){for(x=y,y=[];++S<t;)x&&x[S].run();S=-1,t=y.length}x=null,b=!1,u(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}var h,g,_,v,y,b,x,S,C,w,T=e((()=>{h={exports:{}},g=h.exports={},(function(){try{_=typeof setTimeout==`function`?setTimeout:s}catch{_=s}try{v=typeof clearTimeout==`function`?clearTimeout:c}catch{v=c}})(),y=[],b=!1,S=-1,g.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];y.push(new p(e,t)),y.length===1&&!b&&l(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},g.title=`browser`,g.browser=!0,g.env={},g.argv=[],g.version=``,g.versions={},g.on=m,g.addListener=m,g.once=m,g.off=m,g.removeListener=m,g.removeAllListeners=m,g.emit=m,g.prependListener=m,g.prependOnceListener=m,g.listeners=function(e){return[]},g.binding=function(e){throw Error(`process.binding is not supported`)},g.cwd=function(){return`/`},g.chdir=function(e){throw Error(`process.chdir is not supported`)},g.umask=function(){return 0},C=h.exports,w=o(C)})),E=t(((e,t)=>{t.exports=null})),D=t(((e,t)=>{T();function n(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}function r(e,t){for(var n=``,r=0,i=-1,a=0,o,s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else if(o===47)break;else o=47;if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){var c=n.lastIndexOf(`/`);if(c!==n.length-1){c===-1?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}}else if(n.length===2||n.length===1){n=``,r=0,i=s,a=0;continue}}t&&(n.length>0?n+=`/..`:n=`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a!==-1?++a:a=-1}return n}function i(e,t){var n=t.dir||t.root,r=t.base||(t.name||``)+(t.ext||``);return n?n===t.root?n+r:n+e+r:r}var a={resolve:function(){for(var e=``,t=!1,i,a=arguments.length-1;a>=-1&&!t;a--){var o;a>=0?o=arguments[a]:(i===void 0&&(i=w.cwd()),o=i),n(o),o.length!==0&&(e=o+`/`+e,t=o.charCodeAt(0)===47)}return e=r(e,!t),t?e.length>0?`/`+e:`/`:e.length>0?e:`.`},normalize:function(e){if(n(e),e.length===0)return`.`;var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=r(e,!t),e.length===0&&!t&&(e=`.`),e.length>0&&i&&(e+=`/`),t?`/`+e:e},isAbsolute:function(e){return n(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return`.`;for(var e,t=0;t<arguments.length;++t){var r=arguments[t];n(r),r.length>0&&(e===void 0?e=r:e+=`/`+r)}return e===void 0?`.`:a.normalize(e)},relative:function(e,t){if(n(e),n(t),e===t||(e=a.resolve(e),t=a.resolve(t),e===t))return``;for(var r=1;r<e.length&&e.charCodeAt(r)===47;++r);for(var i=e.length,o=i-r,s=1;s<t.length&&t.charCodeAt(s)===47;++s);for(var c=t.length-s,l=o<c?o:c,u=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(t.charCodeAt(s+d)===47)return t.slice(s+d+1);if(d===0)return t.slice(s+d)}else o>l&&(e.charCodeAt(r+d)===47?u=d:d===0&&(u=0));break}var f=e.charCodeAt(r+d);if(f!==t.charCodeAt(s+d))break;f===47&&(u=d)}var p=``;for(d=r+u+1;d<=i;++d)(d===i||e.charCodeAt(d)===47)&&(p.length===0?p+=`..`:p+=`/..`);return p.length>0?p+t.slice(s+u):(s+=u,t.charCodeAt(s)===47&&++s,t.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(n(e),e.length===0)return`.`;for(var t=e.charCodeAt(0),r=t===47,i=-1,a=!0,o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!a){i=o;break}}else a=!1;return i===-1?r?`/`:`.`:r&&i===1?`//`:e.slice(0,i)},basename:function(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);n(e);var r=0,i=-1,a=!0,o;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;var s=t.length-1,c=-1;for(o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!a){r=o+1;break}}else c===-1&&(a=!1,c=o+1),s>=0&&(l===t.charCodeAt(s)?--s===-1&&(i=o):(s=-1,i=c))}return r===i?i=c:i===-1&&(i=e.length),e.slice(r,i)}else{for(o=e.length-1;o>=0;--o)if(e.charCodeAt(o)===47){if(!a){r=o+1;break}}else i===-1&&(a=!1,i=o+1);return i===-1?``:e.slice(r,i)}},extname:function(e){n(e);for(var t=-1,r=0,i=-1,a=!0,o=0,s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(c===47){if(!a){r=s+1;break}continue}i===-1&&(a=!1,i=s+1),c===46?t===-1?t=s:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===r+1?``:e.slice(t,i)},format:function(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return i(`/`,e)},parse:function(e){n(e);var t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;var r=e.charCodeAt(0),i=r===47,a;i?(t.root=`/`,a=1):a=0;for(var o=-1,s=0,c=-1,l=!0,u=e.length-1,d=0;u>=a;--u){if(r=e.charCodeAt(u),r===47){if(!l){s=u+1;break}continue}c===-1&&(l=!1,c=u+1),r===46?o===-1?o=u:d!==1&&(d=1):o!==-1&&(d=-1)}return o===-1||c===-1||d===0||d===1&&o===c-1&&o===s+1?c!==-1&&(s===0&&i?t.base=t.name=e.slice(1,c):t.base=t.name=e.slice(s,c)):(s===0&&i?(t.name=e.slice(1,o),t.base=e.slice(1,c)):(t.name=e.slice(s,o),t.base=e.slice(s,c)),t.ext=e.slice(o,c)),s>0?t.dir=e.slice(0,s-1):i&&(t.dir=`/`),t},sep:`/`,delimiter:`:`,win32:null,posix:null};a.posix=a,t.exports=a})),O=t(((e,t)=>{T();var n=E(),r=D(),a=i(),o=class extends a{constructor(e,t=null){super(),this._onChange=t,this._changeScheduled=!1,this._virtualFiles={},this.cwd=this._normalizeCwd(e||w.cwd())}get isRealFilesystem(){return!0}_normalizeCwd(e){let t=r.resolve(e);return t===`/`?`/`:t+`/`}absolutePath(e){e.startsWith(`./`)&&(e=e.slice(2));let t=e.startsWith(`/`)?e:r.join(this.cwd,e);return r.normalize(t)}setCwd(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=this.absolutePath(t);this.cwd=n===`/`?`/`:n+`/`}getFileByPath(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return this._virtualFiles[t];let i;try{i=n.statSync(t)}catch{return null}if(i.isDirectory()){let e={};try{for(let i of n.readdirSync(t)){let a=r.join(t,i);if(this._virtualFiles[a]!==void 0)e[i]=this._virtualFiles[a];else try{e[i]=n.statSync(a).isDirectory()?{}:``}catch{}}}catch{}let i=t===`/`?`/`:t+`/`;for(let t of Object.keys(this._virtualFiles))if(t.startsWith(i)&&!t.slice(i.length).includes(`/`)){let n=t.slice(i.length);n in e||(e[n]=this._virtualFiles[t])}return e}try{return n.readFileSync(t,`utf8`)}catch{return null}}setFileByPath(e,t,i=!1){let a=this.absolutePath(e);if(typeof t==`function`){this._virtualFiles[a]=t;return}if(t!=null&&t.constructor===Object){n.mkdirSync(a,{recursive:i}),this._triggerChange();return}i&&n.mkdirSync(r.dirname(a),{recursive:!0}),n.writeFileSync(a,String(t)),this._triggerChange()}deleteFileByPath(e){let t=this.absolutePath(e);delete this._virtualFiles[t];try{n.lstatSync(t).isDirectory()?n.rmdirSync(t):n.unlinkSync(t),this._triggerChange()}catch{}}getMode(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return typeof this._virtualFiles[t]==`function`?493:420;try{return n.statSync(t).mode&511}catch{return null}}setMode(e,t){let r=this.absolutePath(e);this._virtualFiles[r]===void 0&&(n.chmodSync(r,t),this._triggerChange())}getSize(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return 0;try{return n.statSync(t).size}catch{return 0}}isSymlink(e){let t=this.absolutePath(e);try{return n.lstatSync(t).isSymbolicLink()}catch{return!1}}readSymlink(e){let t=this.absolutePath(e);try{return n.readlinkSync(t)}catch{return null}}createSymlink(e,t){let i=this.absolutePath(t);n.mkdirSync(r.dirname(i),{recursive:!0}),n.symlinkSync(e,i),this._triggerChange()}getRaw(){return null}getRawPermissions(){return{}}addFiles(e){Object.entries(e).forEach(([e,t])=>{this.setFileByPath(e,t,!0)})}autoComplete(e,t){let i=this.absolutePath(e).split(`/`),a=i.pop(),o=i.join(`/`)||`/`,s=[];try{s=n.readdirSync(o)}catch{}let c=o===`/`?`/`:o+`/`;for(let e of Object.keys(this._virtualFiles))if(e.startsWith(c)&&!e.slice(c.length).includes(`/`)){let t=e.slice(c.length);s.includes(t)||s.push(t)}let l=s.filter(e=>e.startsWith(a));if(l.length===0&&!e.includes(`/`)){let n=this.getFileByPath(t);if(n&&n.constructor===Object&&(l=Object.keys(n).filter(t=>t.startsWith(e)),l.length))return{path:null,options:l}}if(!l.length)return null;let u=e.split(`/`);return u.pop(),{path:u.length?u.join(`/`):null,options:l.map(e=>{let t=r.join(o,e);if(this._virtualFiles[t]!==void 0)return e;try{return n.statSync(t).isDirectory()?e+`/`:e}catch{return e}})}}_getFileRaw(e){return this.getFileByPath(e)}exists(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return!0;try{return n.statSync(t),!0}catch{return!1}}stat(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0){let e=this._virtualFiles[t];return{isDirectory:e!=null&&e.constructor===Object,isFile:typeof e==`string`,isCommand:typeof e==`function`}}try{let e=n.statSync(t);return{isDirectory:e.isDirectory(),isFile:e.isFile(),isCommand:!1}}catch{return null}}};t.exports=o,t.exports=o})),k=t(((e,t)=>{var n=a();t.exports=class{constructor(e){this.options=e;let{cwd:t=`/`,clearFn:r,destroyFn:i,onFsChange:a}=this.options;this.vars={},this.aliases={},this.fs=new n(t,{},{},a||null),this._clearFn=r,this._destroyFn=i}setVar(e,t){t?this.vars[e]=t:delete this.vars[e]}unsetVar(e){this.setVar(e)}getVar(e){return this.vars[e]||``}setAlias(e,t){t?this.aliases[e]=t:delete this.aliases[e]}unsetAlias(e){this.setAlias(e)}getAlias(e){return this.aliases[e]||null}setCommand(e){let t=`${this.getVar(`PATH`)}/${e.name.toLowerCase()}`;this.fs.addFiles({[t]:e}),this.fs.setMode(t,365)}getCommand(e){let t=`${this.getVar(`PATH`)}/${e}`;return this.fs._getFileRaw(t)||null}setNodeFilesystem(e){let t=O(),n=this.fs._onChange;this.fs=new t(e,n)}setFilesystem(e,t={}){let r=this.fs._getFileRaw(this.getVar(`PATH`))||{},i=this.fs.getRawPermissions(),a=this.fs._onChange;this.fs=new n(this.fs.cwd,e,Object.assign({},i,t),a),this.fs.addFiles(r)}setCwd(e){this.fs.setCwd(e)}source(e){this.vars=Object.assign({},this.vars,e.vars),this.aliases=Object.assign({},this.aliases,e.aliases)}clear(){typeof this._clearFn==`function`&&this._clearFn()}destroy(e=0){typeof this._destroyFn==`function`&&this._destroyFn(e)}}})),A=t(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),j=t(((e,t)=>{var n=[`out`,`err`];t.exports=class{constructor(e,t){if(!n.includes(e))throw Error(`incorrect std output type`);this.type=e,this.string=t}}})),M=t(((e,t)=>{var n=j();t.exports=class{constructor(e=[],t=0){if(typeof t!=`number`)throw Error(`Command Result ExitCode must be a number`);if(!Array.isArray(e))throw Error(`Command Result be array`);this.std=e,this.exitCode=t}addStdOutLine(e){this.std.push(new n(`out`,e))}addStdErrLine(e){this.std.push(new n(`err`,e))}getStdOutput(){return this.std}getExitCode(){return this.exitCode}flush(){let e=this.std;return this.std=[],e}}})),N=t(((e,t)=>{var n=A(),r=M(),i=n.EventEmitter||n.default||n;t.exports=class extends i{constructor(e){super(),this.arguments=e,this.result=new r}get name(){return`unnamed`}run(){return Promise.reject(`Command not implemented...`)}runCommand(){return this.run().then(e=>(e&&e.split(/\r?\n/).forEach(e=>this.stdOut=e),this.result)).catch(e=>(e&&(this.stdErr=e.message||e),this.exitCode=127,this.result))}onInput(e){}set exitCode(e){this.result.exitCode=e}set stdOut(e){this.result.addStdOutLine(e)}set stdErr(e){this.result.addStdErrLine(e)}flush(){this.emit(`flush`,this.result.flush())}}})),P=t(((e,t)=>{var n=N();t.exports=class extends n{constructor(e,t){super(e),this.context=t}}})),F=t(((e,t)=>{r();var i=P();function a(e){return/^#!\/(sh\.js|bin\/(sh|brsh))/.test(e)}t.exports=class extends i{constructor(e,t,n,r=!1){super(t,n),this.script=e,this.source=r}get captureInput(){return!!(this.sandbox&&this.sandbox.runningCommand&&this.sandbox.runningCommand.captureInput)}onInput(e){this.sandbox&&this.sandbox.onInput(e)}run(){let e=this.context.fs.isRealFilesystem?{useRealFilesystem:!0}:{filesystem:this.context.fs.getRaw(),permissions:this.context.fs.getRawPermissions()};this.sandbox=new n.shell({cwd:this.context.fs.cwd,...e}),this.sandbox.context.source(this.context),this.sandbox.on(`stdOut`,e=>{this.stdOut=e,this.flush()}),this.sandbox.on(`stdErr`,e=>{this.stdErr=e,this.flush()}),this._scriptFunctions={};let t=this.script.split(/\r?\n/);if(!a(t[0])){let e=t[0].startsWith(`#!`)?t[0].slice(2).split(/\s/)[0]:t[0];return Promise.reject(`${e}: bad interpreter: No such file or directory`)}let r=this._parseLines(t.slice(1));return this._executeNodes(r).catch(e=>{if(e&&e.__type===`return`)this.sandbox.lastCode=e.code;else if(e&&e.__type===`errexit`)this.sandbox.lastCode=e.code;else return Promise.reject(e)}).then(()=>{this.exitCode=this.sandbox.lastCode,this.source&&this.context.source(this.sandbox.context)})}_parseLines(e){let t=[],n=0;for(;n<e.length;){let r=e[n].trim();if(!r||r.startsWith(`#`)){n++;continue}if(r.startsWith(`if `)||r===`if`){let r=this._parseIf(e,n);t.push(r.node),n+=r.consumed;continue}if(r.startsWith(`while `)){let r=this._parseWhile(e,n);t.push(r.node),n+=r.consumed;continue}if(r.startsWith(`for `)){let r=this._parseFor(e,n);t.push(r.node),n+=r.consumed;continue}if(r.startsWith(`case `)||r===`case`){let r=this._parseCase(e,n);t.push(r.node),n+=r.consumed;continue}if(/^(?:function\s+[\w\d_]+|[\w\d_]+\s*\(\s*\))\s*(?:\{.*)?$/.test(r)){let r=this._parseFunction(e,n);t.push(r.node),n+=r.consumed;continue}t.push({type:`command`,line:r}),n++}return t}_parseIf(e,t){let n=e=>e.replace(/^(?:if|elif)\s+/,``).replace(/\s*;\s*then\s*$/,``).replace(/\s+then\s*$/,``).trim(),r=[{condition:n(e[t].trim()),bodyLines:[]}],i=[],a=r[0],o=!1,s=1,c=t+1;for(c<e.length&&e[c].trim()===`then`&&c++;c<e.length;){let t=e[c].trim();if((t.startsWith(`if `)||t===`if`)&&s++,t===`fi`&&(s--,s===0)){c++;break}if(s===1&&t.startsWith(`elif `)){let i={condition:n(t),bodyLines:[]};r.push(i),a=i,c++,c<e.length&&e[c].trim()===`then`&&c++;continue}if(s===1&&t===`else`){o=!0,c++;continue}o?i.push(e[c]):a.bodyLines.push(e[c]),c++}return{node:{type:`if`,clauses:r,elseLines:i},consumed:c-t}}_parseWhile(e,t){let n=e[t].trim().replace(/^while\s+/,``).replace(/\s*;\s*do\s*$/,``).replace(/\s+do\s*$/,``).trim(),r=t+1;r<e.length&&e[r].trim()===`do`&&r++;let i=[],a=1;for(;r<e.length;){let t=e[r].trim();if((t.startsWith(`while `)||t.startsWith(`for `))&&a++,t===`done`&&(a--,a===0)){r++;break}i.push(e[r]),r++}return{node:{type:`while`,condition:n,bodyLines:i},consumed:r-t}}_parseFor(e,t){let n=e[t].trim().replace(/\s*;\s*do\s*$/,``).replace(/\s+do\s*$/,``).match(/^for\s+(\w+)\s+in\s+(.+)$/),r=n?n[1]:``,i=n?n[2].trim():``,a=t+1;a<e.length&&e[a].trim()===`do`&&a++;let o=[],s=1;for(;a<e.length;){let t=e[a].trim();if((t.startsWith(`while `)||t.startsWith(`for `))&&s++,t===`done`&&(s--,s===0)){a++;break}o.push(e[a]),a++}return{node:{type:`for`,variable:r,list:i,bodyLines:o},consumed:a-t}}_executeNodes(e){return e.reduce((e,t)=>e.then(()=>this._executeNode(t)),Promise.resolve())}_executeNode(e){if(e.type===`function`){let t=e.name,n=e.bodyLines,r=this,i=P(),a=class extends i{static get name(){return t}run(){let e=this.arguments.map((e,t)=>({key:String(t+1),prev:r.sandbox.context.getVar(String(t+1))}));this.arguments.forEach((e,t)=>r.sandbox.context.setVar(String(t+1),e));let t=()=>e.forEach(({key:e,prev:t})=>t?r.sandbox.context.setVar(e,t):r.sandbox.context.unsetVar(e));return r._executeFunctionBody(n).then(()=>{t()}).catch(e=>{if(t(),e&&e.__type===`return`){this.exitCode=e.code;return}return Promise.reject(e)})}};return this.sandbox.context.setCommand(a),Promise.resolve()}if(e.type===`command`){if(/^return(\s+\d+)?\s*$/.test(e.line.trim())){let t=e.line.trim().match(/^return\s+(\d+)/),n=t?parseInt(t[1],10):0;return Promise.reject({__type:`return`,code:n})}return(this.sandbox.context.getVar(`-`)||``).includes(`x`)&&(this.stdErr=`+ ${e.line.trim()}`,this.flush()),this.sandbox.onCommand(e.line,!1).then(()=>{if((this.sandbox.context.getVar(`-`)||``).includes(`e`)&&this.sandbox.lastCode!==0)return Promise.reject({__type:`errexit`,code:this.sandbox.lastCode})})}return e.type===`if`?this._executeIf(e):e.type===`while`?this._executeWhile(e):e.type===`for`?this._executeFor(e):e.type===`case`?this._executeCase(e):Promise.resolve()}_executeIf(e){let t=n=>{if(n>=e.clauses.length)return e.elseLines.length>0?this._executeNodes(this._parseLines(e.elseLines)):Promise.resolve();let r=e.clauses[n];return this.sandbox.onCommand(r.condition,!1).then(()=>this.sandbox.lastCode===0?this._executeNodes(this._parseLines(r.bodyLines)):t(n+1))};return t(0)}_executeWhile(e){let t=()=>this.sandbox.onCommand(e.condition,!1).then(()=>{if(this.sandbox.lastCode===0)return this._executeNodes(this._parseLines(e.bodyLines)).then(t)});return t()}_executeFor(e){return e.list.replace(/\${?([\w\d]+)}?/g,(e,t)=>this.sandbox.context.getVar(t)||``).split(/\s+/).filter(Boolean).reduce((t,n)=>t.then(()=>(this.sandbox.context.setVar(e.variable,n),this._executeNodes(this._parseLines(e.bodyLines)))),Promise.resolve())}_parseFunction(e,t){let n=e[t].trim(),r=n.match(/^function\s+([\w\d_]+)/)||n.match(/^([\w\d_]+)\s*\(/),i=r?r[1]:``,a=t+1;if(!n.includes(`{`)){for(;a<e.length&&!e[a].includes(`{`);)a++;a++}let o=[],s=1;for(;a<e.length;){if(e[a].trim()===`}`){a++;break}let t=(e[a].match(/\{/g)||[]).length,n=(e[a].match(/\}/g)||[]).length;if(s+=t-n,s<=0){a++;break}o.push(e[a]),a++}return{node:{type:`function`,name:i,bodyLines:o},consumed:a-t}}_parseCase(e,t){let n=e[t].trim().match(/^case\s+(.+?)\s+in\s*$/),r=n?n[1]:``,i=t+1,a=[],o=null,s=[];for(;i<e.length;){let t=e[i],n=t.trim();if(i++,!(!n||n.startsWith(`#`))){if(n===`esac`)break;if(o===null){let e=n.match(/^(.+?)\)\s*(.*)$/);if(e){o=e[1].trim();let t=e[2].trim();if(t===`;;`)a.push({pattern:o,bodyLines:[]}),o=null;else if(t.endsWith(`;;`)){let e=t.slice(0,-2).trim();a.push({pattern:o,bodyLines:e?[e]:[]}),o=null}else s=t?[t]:[]}}else n===`;;`?(a.push({pattern:o,bodyLines:s}),o=null,s=[]):n.endsWith(`;;`)?(s.push(n.slice(0,-2).trim()),a.push({pattern:o,bodyLines:s}),o=null,s=[]):s.push(t)}}return o!==null&&a.push({pattern:o,bodyLines:s}),{node:{type:`case`,word:r,clauses:a},consumed:i-t}}_executeFunctionBody(e){return this._executeNodes(this._parseLines(e))}_executeCase(e){return this.sandbox._replaceVariables(e.word).then(t=>{let n=t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t;for(let t of e.clauses)if(this._matchPattern(t.pattern,n))return this._executeNodes(this._parseLines(t.bodyLines))})}_matchPattern(e,t){let n=``,r=0;for(;r<e.length;){let t=e[r];if(t===`[`){let t=e.indexOf(`]`,r+1);t===-1?(n+=`\\[`,r++):(n+=e.slice(r,t+1),r=t+1)}else t===`*`?(n+=`.*`,r++):t===`?`?(n+=`.`,r++):/[.+^${}()|\\]/.test(t)?(n+=`\\`+t,r++):(n+=t,r++)}try{return RegExp(`^`+n+`$`).test(t)}catch{return!1}}},t.exports.isKnownInterpreter=a}));function I(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function L(e){var t=I(e),n=t[0],r=t[1];return(n+r)*3/4-r}function ee(e,t,n){return(t+n)*3/4-n}function te(e){var t,n=I(e),r=n[0],i=n[1],a=new re(ee(e,r,i)),o=0,s=i>0?r-4:r,c;for(c=0;c<s;c+=4)t=U[e.charCodeAt(c)]<<18|U[e.charCodeAt(c+1)]<<12|U[e.charCodeAt(c+2)]<<6|U[e.charCodeAt(c+3)],a[o++]=t>>16&255,a[o++]=t>>8&255,a[o++]=t&255;return i===2&&(t=U[e.charCodeAt(c)]<<2|U[e.charCodeAt(c+1)]>>4,a[o++]=t&255),i===1&&(t=U[e.charCodeAt(c)]<<10|U[e.charCodeAt(c+1)]<<4|U[e.charCodeAt(c+2)]>>2,a[o++]=t>>8&255,a[o++]=t&255),a}function R(e){return H[e>>18&63]+H[e>>12&63]+H[e>>6&63]+H[e&63]}function z(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(R(r));return i.join(``)}function ne(e){for(var t,n=e.length,r=n%3,i=[],a=16383,o=0,s=n-r;o<s;o+=a)i.push(z(e,o,o+a>s?s:o+a));return r===1?(t=e[n-1],i.push(H[t>>2]+H[t<<4&63]+`==`)):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(H[t>>10]+H[t>>4&63]+H[t<<2&63]+`=`)),i.join(``)}var B,V,H,U,re,W,G,ie,ae,oe,se=e((()=>{for(B={},V={},V.byteLength=L,V.toByteArray=te,V.fromByteArray=ne,H=[],U=[],re=typeof Uint8Array<`u`?Uint8Array:Array,W=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,G=0,ie=W.length;G<ie;++G)H[G]=W[G],U[W.charCodeAt(G)]=G;U[45]=62,U[95]=63,ae={},ae.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},ae.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128},(function(e){let t=V,n=ae,r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=u,e.SlowBuffer=x,e.INSPECT_MAX_BYTES=50;let i=2147483647;e.kMaxLength=i;let{Uint8Array:a,ArrayBuffer:o,SharedArrayBuffer:s}=globalThis;u.TYPED_ARRAY_SUPPORT=c(),!u.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{let e=new a(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,a.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function l(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new a(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return m(e)}return d(e,t,n)}u.poolSize=8192;function d(e,t,n){if(typeof e==`string`)return h(e,t);if(o.isView(e))return _(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(J(e,o)||e&&J(e.buffer,o)||s!==void 0&&(J(e,s)||e&&J(e.buffer,s)))return v(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return u.from(r,t,n);let i=y(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return u.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}u.from=function(e,t,n){return d(e,t,n)},Object.setPrototypeOf(u.prototype,a.prototype),Object.setPrototypeOf(u,a);function f(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function p(e,t,n){return f(e),e<=0||t===void 0?l(e):typeof n==`string`?l(e).fill(t,n):l(e).fill(t)}u.alloc=function(e,t,n){return p(e,t,n)};function m(e){return f(e),l(e<0?0:b(e)|0)}u.allocUnsafe=function(e){return m(e)},u.allocUnsafeSlow=function(e){return m(e)};function h(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!u.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=S(e,t)|0,r=l(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function g(e){let t=e.length<0?0:b(e.length)|0,n=l(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function _(e){if(J(e,a)){let t=new a(e);return v(t.buffer,t.byteOffset,t.byteLength)}return g(e)}function v(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new a(e):n===void 0?new a(e,t):new a(e,t,n),Object.setPrototypeOf(r,u.prototype),r}function y(e){if(u.isBuffer(e)){let t=b(e.length)|0,n=l(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||he(e.length)?l(0):g(e);if(e.type===`Buffer`&&Array.isArray(e.data))return g(e.data)}function b(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function x(e){return+e!=e&&(e=0),u.alloc(+e)}u.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==u.prototype},u.compare=function(e,t){if(J(e,a)&&(e=u.from(e,e.offset,e.byteLength)),J(t,a)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},u.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},u.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return u.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=u.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(J(t,a))i+t.length>r.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(r,i)):a.prototype.set.call(r,t,i);else if(u.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function S(e,t){if(u.isBuffer(e))return e.length;if(o.isView(e)||J(e,o))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return ue(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return pe(e).length;default:if(i)return r?-1:ue(e).length;t=(``+t).toLowerCase(),i=!0}}u.byteLength=S;function C(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return ee(this,t,n);case`utf8`:case`utf-8`:return N(this,t,n);case`ascii`:return I(this,t,n);case`latin1`:case`binary`:return L(this,t,n);case`base64`:return M(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return te(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}u.prototype._isBuffer=!0;function w(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}u.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)w(this,t,t+1);return this},u.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)w(this,t,t+3),w(this,t+1,t+2);return this},u.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)w(this,t,t+7),w(this,t+1,t+6),w(this,t+2,t+5),w(this,t+3,t+4);return this},u.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?N(this,0,e):C.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:u.compare(this,e)===0},u.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(u.prototype[r]=u.prototype.inspect),u.prototype.compare=function(e,t,n,r,i){if(J(e,a)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let o=i-r,s=n-t,c=Math.min(o,s),l=this.slice(r,i),d=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==d[e]){o=l[e],s=d[e];break}return o<s?-1:+(s<o)};function T(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,he(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=u.from(t,r)),u.isBuffer(t))return t.length===0?-1:E(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof a.prototype.indexOf==`function`?i?a.prototype.indexOf.call(e,t,n):a.prototype.lastIndexOf.call(e,t,n):E(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function E(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}u.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},u.prototype.indexOf=function(e,t,n){return T(this,e,t,n,!0)},u.prototype.lastIndexOf=function(e,t,n){return T(this,e,t,n,!1)};function D(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(he(r))return o;e[n+o]=r}return o}function O(e,t,n,r){return me(ue(t,e.length-n),e,n,r)}function k(e,t,n,r){return me(de(t),e,n,r)}function A(e,t,n,r){return me(pe(t),e,n,r)}function j(e,t,n,r){return me(fe(t,e.length-n),e,n,r)}u.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return D(this,e,t,n);case`utf8`:case`utf-8`:return O(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return k(this,e,t,n);case`base64`:return A(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return j(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function M(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function N(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return F(r)}let P=4096;function F(e){let t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=P));return n}function I(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function L(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function ee(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=ge[e[r]];return i}function te(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}u.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,u.prototype),r};function R(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||R(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||R(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||R(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||R(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||R(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=Y(function(e){e>>>=0,K(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&q(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),u.prototype.readBigUInt64BE=Y(function(e){e>>>=0,K(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&q(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),u.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||R(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},u.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||R(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},u.prototype.readInt8=function(e,t){return e>>>=0,t||R(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||R(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},u.prototype.readInt16BE=function(e,t){e>>>=0,t||R(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=Y(function(e){e>>>=0,K(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&q(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),u.prototype.readBigInt64BE=Y(function(e){e>>>=0,K(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&q(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||R(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||R(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||R(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||R(e,8,this.length),n.read(this,e,!1,52,8)};function z(e,t,n,r,i,a){if(!u.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;z(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;z(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,1,255,0),this[t]=e&255,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function ne(e,t,n,r,i){se(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function B(e,t,n,r,i){se(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}u.prototype.writeBigUInt64LE=Y(function(e,t=0){return ne(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),u.prototype.writeBigUInt64BE=Y(function(e,t=0){return B(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);z(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);z(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},u.prototype.writeBigInt64LE=Y(function(e,t=0){return ne(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),u.prototype.writeBigInt64BE=Y(function(e,t=0){return B(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function H(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function U(e,t,r,i,a){return t=+t,r>>>=0,a||H(e,t,r,4),n.write(e,t,r,i,23,4),r+4}u.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)};function re(e,t,r,i,a){return t=+t,r>>>=0,a||H(e,t,r,8),n.write(e,t,r,i,52,8),r+8}u.prototype.writeDoubleLE=function(e,t,n){return re(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return re(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(!u.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof a.prototype.copyWithin==`function`?this.copyWithin(t,n,r):a.prototype.set.call(e,this.subarray(n,r),t),i},u.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!u.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=u.isBuffer(e)?e:u.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let W={};function G(e,t,n){W[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}G(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),G(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),G(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=ie(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=ie(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function ie(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function oe(e,t,n){K(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&q(t,e.length-(n+1))}function se(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new W.ERR_OUT_OF_RANGE(`value`,i,e)}oe(r,i,a)}function K(e,t){if(typeof e!=`number`)throw new W.ERR_INVALID_ARG_TYPE(t,`number`,e)}function q(e,t,n){throw Math.floor(e)===e?t<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(K(e,n),new W.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let ce=/[^+/0-9A-Za-z-_]/g;function le(e){if(e=e.split(`=`)[0],e=e.trim().replace(ce,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function ue(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function de(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function fe(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function pe(e){return t.toByteArray(le(e))}function me(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function J(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function he(e){return e!==e}let ge=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function Y(e){return typeof BigInt>`u`?_e:e}function _e(){throw Error(`BigInt not supported`)}})(B),oe=B.Buffer,B.Blob,B.BlobOptions,B.Buffer,B.File,B.FileOptions,B.INSPECT_MAX_BYTES,B.SlowBuffer,B.TranscodeEncoding,B.atob,B.btoa,B.constants,B.isAscii,B.isUtf8,B.kMaxLength,B.kStringMaxLength,B.resolveObjectURL,B.transcode})),K=t(((e,t)=>{se();var n=F();t.exports=class extends n{get name(){return`wasm`}get requiresFilesystem(){return!0}run(){let e=this.script,t=(()=>{try{return E()}catch{return null}})();return this._loadBytes(e,t).then(({bytes:e,isWat:t})=>t?this._runWat(e):this._runWasm(e)).catch(e=>{this.stdErr=e.message||String(e),this.exitCode=1})}_loadBytes(e,t){if(this.context.fs.isRealFilesystem&&t)try{let n=t.readFileSync(this.context.fs.absolutePath(e)),r=new Uint8Array(n);return Promise.resolve({bytes:r,isWat:this._isWat(e,r)})}catch(t){return Promise.reject(Error(`${e}: ${t.message}`))}let n=this.context.fs.getFileByPath(e);if(n==null)return Promise.reject(Error(`${e}: No such file or directory`));let r=this._contentToBytes(n);return Promise.resolve({bytes:r,isWat:this._isWat(e,r)})}_isWat(e,t){return e.endsWith(`.wat`)?!0:t.length>0&&t[0]===40}_contentToBytes(e){if(e instanceof Uint8Array)return e;if(oe!==void 0&&oe.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(e instanceof ArrayBuffer)return new Uint8Array(e);let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}async _runWat(e){let t=new TextDecoder().decode(e),n,r;try{r=await import(`wabt`)}catch{this.stdErr=`${this.script}: WAT execution requires the 'wabt' package\nInstall it with: npm install wabt`,this.exitCode=1;return}try{let e=r.default??r,{buffer:i}=(typeof e==`function`?await e():e).parseWat(this.script,t,{mutable_globals:!0}).toBinary({});n=new Uint8Array(i)}catch(e){this.stdErr=`${this.script}: WAT compilation error: ${e.message}`,this.exitCode=1;return}return this._runWasm(n)}async _runWasm(e){if(typeof WebAssembly>`u`){this.stdErr=`${this.script}: WebAssembly is not available in this environment`,this.exitCode=1;return}let t={1:``,2:``},n=new TextDecoder,r=null,i=(e,n)=>{t[e]=(t[e]||``)+n;let r=t[e].split(`
1
+ "use strict";var Terminal=(function(){var e=(e,t)=>()=>(e&&(t=e(e=0)),t),t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),n,r=e((()=>{n=globalThis||self})),i=t(((e,t)=>{var n=new Set([`getFileByPath`,`setFileByPath`,`deleteFileByPath`,`exists`,`stat`,`absolutePath`,`getMode`,`setMode`,`isReadable`,`isWritable`,`isExecutable`,`getSize`,`autoComplete`,`isRealFilesystem`,`isSymlink`]);t.exports=class{isReadable(e){let t=this.getMode(e);return t===null?!1:(t&256)!=0}isWritable(e){let t=this.getMode(e);return t===null?!1:(t&128)!=0}isExecutable(e){let t=this.getMode(e);return t===null?!1:(t&64)!=0}sandbox(){let e=this;return new Proxy(Object.create(null),{get(t,r){if(!n.has(r))return;let i=e[r];return typeof i==`function`?i.bind(e):i},set(){return!1},has(e,t){return n.has(t)}})}_triggerChange(){!this._onChange||this._changeScheduled||(this._changeScheduled=!0,Promise.resolve().then(()=>{this._changeScheduled=!1,typeof this._onChange==`function`&&this._onChange(this.getRaw(),this.getRawPermissions())}))}}})),a=t(((e,t)=>{var n=i();t.exports=class extends n{constructor(e=`/`,t={},n={},r=null){super(),this.fileSystem=t,this.permissions=Object.assign({},n),this.cwd=e,this._onChange=r,this._changeScheduled=!1}getFileByPath(e){let t=this._getFileByAbsolutePath(this._pathToAbsolute(e));return t==null||!this.isReadable(e)?null:t}_getFileRaw(e){return this._getFileByAbsolutePath(this._pathToAbsolute(e))}exists(e){return this._getFileByAbsolutePath(this._pathToAbsolute(e))!=null}stat(e){let t=this._getFileByAbsolutePath(this._pathToAbsolute(e));return t==null?null:{isDirectory:t.constructor===Object,isFile:typeof t==`string`,isCommand:typeof t==`function`}}_pathToAbsolute(e){return e.startsWith(`./`)&&(e=e.substring(2)),e.startsWith(`/`)||(e=this.cwd+e),this._traverseComplexAbsolutePath(e)}_traverseComplexAbsolutePath(e){let t=e.split(`/`);for(;t.includes(`..`);){let e=t.indexOf(`..`)-1;t.splice(e,2)}return t.join(`/`)}absolutePath(e){return this._pathToAbsolute(e)}setFileByPath(e,t,n=!1){let r=this._pathToAbsolute(e);if(this._getFileByAbsolutePath(r)!=null){if(!this.isWritable(e))throw Error(`Permission denied`)}else{let e=r.split(`/`);e.pop();let t=e.join(`/`)||`/`,n=this.getMode(t);if(n!==null&&!(n&128))throw Error(`Permission denied`)}this._setFileByAbsolutePath(r,t,n),this._triggerChange()}_setFileRaw(e,t,n=!1){let r=this._pathToAbsolute(e);this._setFileByAbsolutePath(r,t,n),this._triggerChange()}_setFileByAbsolutePath(e,t,n=!0){let r=e.split(`/`);r.shift();let i=r.pop(),a=r.reduce((e,t)=>{if(!e[t]){if(!n)throw Error(`${t}: No such file or directory`);e[t]={}}return e[t]},this.fileSystem);a[i]=t}_getFileByAbsolutePath(e){let t=e.split(`/`);return t.shift(),t[t.length-1].length<1&&t.pop(),t.reduce((e,t)=>e&&e[t]?e[t]:null,this.fileSystem)}deleteFileByPath(e){let t=this._pathToAbsolute(e),n=t.split(`/`);n.pop();let r=n.join(`/`)||`/`,i=this.getMode(r);if(i!==null&&!(i&128))throw Error(`${e}: Permission denied`);this._deleteByAbsolutePath(t);let a=t+`/`;Object.keys(this.permissions).forEach(e=>{(e===t||e.startsWith(a))&&delete this.permissions[e]}),this._triggerChange()}_deleteByAbsolutePath(e){let t=e.split(`/`);t.shift(),t[t.length-1]===``&&t.pop();let n=t.pop();if(!n)return;let r=t.reduce((e,t)=>e&&e[t]?e[t]:null,this.fileSystem);r&&n in r&&delete r[n]}getMode(e){let t=this._pathToAbsolute(e);if(this.permissions[t]!==void 0)return this.permissions[t];let n=this._getFileByAbsolutePath(t);return n==null?null:n.constructor===Object?493:typeof n==`function`?365:420}setMode(e,t){let n=this._pathToAbsolute(e);this.permissions[n]=t,this._triggerChange()}getSize(e){let t=this._pathToAbsolute(e),n=this._getFileByAbsolutePath(t);return n==null?0:n.constructor===Object?JSON.stringify(n).length:n.toString().length}getRawPermissions(){return Object.assign({},this.permissions)}setCwd(e){this.cwd=this._pathToAbsolute(e.endsWith(`/`)?e:e+`/`)}getRaw(){return this.fileSystem}addFiles(e){Object.entries(e).forEach(([e,t])=>{this._setFileRaw(e,t,!0)})}autoComplete(e,t){let n=this._pathToAbsolute(e).split(`/`),r=n.pop(),i=this._getFileRaw(n.length>1?n.join(`/`):`/`),a=this._getFileRaw(t);if(i&&i.constructor===Object){let t=Object.keys(i).filter(e=>e.startsWith(r));r.length<1&&(t=t.filter(e=>!e.startsWith(`.`)));let n=e.split(`/`);n.pop();let o=i;if(t.length<1&&n.length<1&&a&&(t=Object.keys(a).filter(e=>e.startsWith(r)),o=a),t.length)return{path:n.length?n.join(`/`):null,options:t.map(e=>o[e]&&o[e].constructor===Object?e.concat(`/`):e)}}return null}}}));function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function s(){throw Error(`setTimeout has not been defined`)}function c(){throw Error(`clearTimeout has not been defined`)}function l(e){if(_===setTimeout)return setTimeout(e,0);if((_===s||!_)&&setTimeout)return _=setTimeout,setTimeout(e,0);try{return _(e,0)}catch{try{return _.call(null,e,0)}catch{return _.call(this,e,0)}}}function u(e){if(v===clearTimeout)return clearTimeout(e);if((v===c||!v)&&clearTimeout)return v=clearTimeout,clearTimeout(e);try{return v(e)}catch{try{return v.call(null,e)}catch{return v.call(this,e)}}}function d(){!b||!x||(b=!1,x.length?y=x.concat(y):S=-1,y.length&&f())}function f(){if(!b){var e=l(d);b=!0;for(var t=y.length;t;){for(x=y,y=[];++S<t;)x&&x[S].run();S=-1,t=y.length}x=null,b=!1,u(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}var h,g,_,v,y,b,x,S,C,w,T=e((()=>{h={exports:{}},g=h.exports={},(function(){try{_=typeof setTimeout==`function`?setTimeout:s}catch{_=s}try{v=typeof clearTimeout==`function`?clearTimeout:c}catch{v=c}})(),y=[],b=!1,S=-1,g.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];y.push(new p(e,t)),y.length===1&&!b&&l(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},g.title=`browser`,g.browser=!0,g.env={},g.argv=[],g.version=``,g.versions={},g.on=m,g.addListener=m,g.once=m,g.off=m,g.removeListener=m,g.removeAllListeners=m,g.emit=m,g.prependListener=m,g.prependOnceListener=m,g.listeners=function(e){return[]},g.binding=function(e){throw Error(`process.binding is not supported`)},g.cwd=function(){return`/`},g.chdir=function(e){throw Error(`process.chdir is not supported`)},g.umask=function(){return 0},C=h.exports,w=o(C)})),E=t(((e,t)=>{t.exports=null})),D=t(((e,t)=>{T();function n(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}function r(e,t){for(var n=``,r=0,i=-1,a=0,o,s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else if(o===47)break;else o=47;if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){var c=n.lastIndexOf(`/`);if(c!==n.length-1){c===-1?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}}else if(n.length===2||n.length===1){n=``,r=0,i=s,a=0;continue}}t&&(n.length>0?n+=`/..`:n=`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a!==-1?++a:a=-1}return n}function i(e,t){var n=t.dir||t.root,r=t.base||(t.name||``)+(t.ext||``);return n?n===t.root?n+r:n+e+r:r}var a={resolve:function(){for(var e=``,t=!1,i,a=arguments.length-1;a>=-1&&!t;a--){var o;a>=0?o=arguments[a]:(i===void 0&&(i=w.cwd()),o=i),n(o),o.length!==0&&(e=o+`/`+e,t=o.charCodeAt(0)===47)}return e=r(e,!t),t?e.length>0?`/`+e:`/`:e.length>0?e:`.`},normalize:function(e){if(n(e),e.length===0)return`.`;var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=r(e,!t),e.length===0&&!t&&(e=`.`),e.length>0&&i&&(e+=`/`),t?`/`+e:e},isAbsolute:function(e){return n(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return`.`;for(var e,t=0;t<arguments.length;++t){var r=arguments[t];n(r),r.length>0&&(e===void 0?e=r:e+=`/`+r)}return e===void 0?`.`:a.normalize(e)},relative:function(e,t){if(n(e),n(t),e===t||(e=a.resolve(e),t=a.resolve(t),e===t))return``;for(var r=1;r<e.length&&e.charCodeAt(r)===47;++r);for(var i=e.length,o=i-r,s=1;s<t.length&&t.charCodeAt(s)===47;++s);for(var c=t.length-s,l=o<c?o:c,u=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(t.charCodeAt(s+d)===47)return t.slice(s+d+1);if(d===0)return t.slice(s+d)}else o>l&&(e.charCodeAt(r+d)===47?u=d:d===0&&(u=0));break}var f=e.charCodeAt(r+d);if(f!==t.charCodeAt(s+d))break;f===47&&(u=d)}var p=``;for(d=r+u+1;d<=i;++d)(d===i||e.charCodeAt(d)===47)&&(p.length===0?p+=`..`:p+=`/..`);return p.length>0?p+t.slice(s+u):(s+=u,t.charCodeAt(s)===47&&++s,t.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(n(e),e.length===0)return`.`;for(var t=e.charCodeAt(0),r=t===47,i=-1,a=!0,o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!a){i=o;break}}else a=!1;return i===-1?r?`/`:`.`:r&&i===1?`//`:e.slice(0,i)},basename:function(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);n(e);var r=0,i=-1,a=!0,o;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;var s=t.length-1,c=-1;for(o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!a){r=o+1;break}}else c===-1&&(a=!1,c=o+1),s>=0&&(l===t.charCodeAt(s)?--s===-1&&(i=o):(s=-1,i=c))}return r===i?i=c:i===-1&&(i=e.length),e.slice(r,i)}else{for(o=e.length-1;o>=0;--o)if(e.charCodeAt(o)===47){if(!a){r=o+1;break}}else i===-1&&(a=!1,i=o+1);return i===-1?``:e.slice(r,i)}},extname:function(e){n(e);for(var t=-1,r=0,i=-1,a=!0,o=0,s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(c===47){if(!a){r=s+1;break}continue}i===-1&&(a=!1,i=s+1),c===46?t===-1?t=s:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===r+1?``:e.slice(t,i)},format:function(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return i(`/`,e)},parse:function(e){n(e);var t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;var r=e.charCodeAt(0),i=r===47,a;i?(t.root=`/`,a=1):a=0;for(var o=-1,s=0,c=-1,l=!0,u=e.length-1,d=0;u>=a;--u){if(r=e.charCodeAt(u),r===47){if(!l){s=u+1;break}continue}c===-1&&(l=!1,c=u+1),r===46?o===-1?o=u:d!==1&&(d=1):o!==-1&&(d=-1)}return o===-1||c===-1||d===0||d===1&&o===c-1&&o===s+1?c!==-1&&(s===0&&i?t.base=t.name=e.slice(1,c):t.base=t.name=e.slice(s,c)):(s===0&&i?(t.name=e.slice(1,o),t.base=e.slice(1,c)):(t.name=e.slice(s,o),t.base=e.slice(s,c)),t.ext=e.slice(o,c)),s>0?t.dir=e.slice(0,s-1):i&&(t.dir=`/`),t},sep:`/`,delimiter:`:`,win32:null,posix:null};a.posix=a,t.exports=a})),O=t(((e,t)=>{T();var n=E(),r=D(),a=i(),o=class extends a{constructor(e,t=null){super(),this._onChange=t,this._changeScheduled=!1,this._virtualFiles={},this.cwd=this._normalizeCwd(e||w.cwd())}get isRealFilesystem(){return!0}_normalizeCwd(e){let t=r.resolve(e);return t===`/`?`/`:t+`/`}absolutePath(e){e.startsWith(`./`)&&(e=e.slice(2));let t=e.startsWith(`/`)?e:r.join(this.cwd,e);return r.normalize(t)}setCwd(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=this.absolutePath(t);this.cwd=n===`/`?`/`:n+`/`}getFileByPath(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return this._virtualFiles[t];let i;try{i=n.statSync(t)}catch{return null}if(i.isDirectory()){let e={};try{for(let i of n.readdirSync(t)){let a=r.join(t,i);if(this._virtualFiles[a]!==void 0)e[i]=this._virtualFiles[a];else try{e[i]=n.statSync(a).isDirectory()?{}:``}catch{}}}catch{}let i=t===`/`?`/`:t+`/`;for(let t of Object.keys(this._virtualFiles))if(t.startsWith(i)&&!t.slice(i.length).includes(`/`)){let n=t.slice(i.length);n in e||(e[n]=this._virtualFiles[t])}return e}try{return n.readFileSync(t,`utf8`)}catch{return null}}setFileByPath(e,t,i=!1){let a=this.absolutePath(e);if(typeof t==`function`){this._virtualFiles[a]=t;return}if(t!=null&&t.constructor===Object){n.mkdirSync(a,{recursive:i}),this._triggerChange();return}i&&n.mkdirSync(r.dirname(a),{recursive:!0}),n.writeFileSync(a,String(t)),this._triggerChange()}deleteFileByPath(e){let t=this.absolutePath(e);delete this._virtualFiles[t];try{n.lstatSync(t).isDirectory()?n.rmdirSync(t):n.unlinkSync(t),this._triggerChange()}catch{}}getMode(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return typeof this._virtualFiles[t]==`function`?493:420;try{return n.statSync(t).mode&511}catch{return null}}setMode(e,t){let r=this.absolutePath(e);this._virtualFiles[r]===void 0&&(n.chmodSync(r,t),this._triggerChange())}getSize(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return 0;try{return n.statSync(t).size}catch{return 0}}isSymlink(e){let t=this.absolutePath(e);try{return n.lstatSync(t).isSymbolicLink()}catch{return!1}}readSymlink(e){let t=this.absolutePath(e);try{return n.readlinkSync(t)}catch{return null}}createSymlink(e,t){let i=this.absolutePath(t);n.mkdirSync(r.dirname(i),{recursive:!0}),n.symlinkSync(e,i),this._triggerChange()}getRaw(){return null}getRawPermissions(){return{}}addFiles(e){Object.entries(e).forEach(([e,t])=>{this.setFileByPath(e,t,!0)})}autoComplete(e,t){let i=this.absolutePath(e).split(`/`),a=i.pop(),o=i.join(`/`)||`/`,s=[];try{s=n.readdirSync(o)}catch{}let c=o===`/`?`/`:o+`/`;for(let e of Object.keys(this._virtualFiles))if(e.startsWith(c)&&!e.slice(c.length).includes(`/`)){let t=e.slice(c.length);s.includes(t)||s.push(t)}let l=s.filter(e=>e.startsWith(a));if(l.length===0&&!e.includes(`/`)){let n=this.getFileByPath(t);if(n&&n.constructor===Object&&(l=Object.keys(n).filter(t=>t.startsWith(e)),l.length))return{path:null,options:l}}if(!l.length)return null;let u=e.split(`/`);return u.pop(),{path:u.length?u.join(`/`):null,options:l.map(e=>{let t=r.join(o,e);if(this._virtualFiles[t]!==void 0)return e;try{return n.statSync(t).isDirectory()?e+`/`:e}catch{return e}})}}_getFileRaw(e){return this.getFileByPath(e)}exists(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0)return!0;try{return n.statSync(t),!0}catch{return!1}}stat(e){let t=this.absolutePath(e);if(this._virtualFiles[t]!==void 0){let e=this._virtualFiles[t];return{isDirectory:e!=null&&e.constructor===Object,isFile:typeof e==`string`,isCommand:typeof e==`function`}}try{let e=n.statSync(t);return{isDirectory:e.isDirectory(),isFile:e.isFile(),isCommand:!1}}catch{return null}}};t.exports=o,t.exports=o})),k=t(((e,t)=>{var n=a();t.exports=class{constructor(e){this.options=e;let{cwd:t=`/`,clearFn:r,destroyFn:i,onFsChange:a}=this.options;this.vars={},this.aliases={},this.fs=new n(t,{},{},a||null),this._clearFn=r,this._destroyFn=i}setVar(e,t){t?this.vars[e]=t:delete this.vars[e]}unsetVar(e){this.setVar(e)}getVar(e){return this.vars[e]||``}setAlias(e,t){t?this.aliases[e]=t:delete this.aliases[e]}unsetAlias(e){this.setAlias(e)}getAlias(e){return this.aliases[e]||null}setCommand(e){let t=`${this.getVar(`PATH`)}/${e.name.toLowerCase()}`;this.fs.addFiles({[t]:e}),this.fs.setMode(t,365)}getCommand(e){let t=`${this.getVar(`PATH`)}/${e}`;return this.fs._getFileRaw(t)||null}setNodeFilesystem(e){let t=O(),n=this.fs._onChange;this.fs=new t(e,n)}setFilesystem(e,t={}){let r=this.fs._getFileRaw(this.getVar(`PATH`))||{},i=this.fs.getRawPermissions(),a=this.fs._onChange;this.fs=new n(this.fs.cwd,e,Object.assign({},i,t),a),this.fs.addFiles(r)}setCwd(e){this.fs.setCwd(e)}source(e){this.vars=Object.assign({},this.vars,e.vars),this.aliases=Object.assign({},this.aliases,e.aliases)}clear(){typeof this._clearFn==`function`&&this._clearFn()}destroy(e=0){typeof this._destroyFn==`function`&&this._destroyFn(e)}}})),A=t(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),j=t(((e,t)=>{var n=[`out`,`err`];t.exports=class{constructor(e,t){if(!n.includes(e))throw Error(`incorrect std output type`);this.type=e,this.string=t}}})),M=t(((e,t)=>{var n=j();t.exports=class{constructor(e=[],t=0){if(typeof t!=`number`)throw Error(`Command Result ExitCode must be a number`);if(!Array.isArray(e))throw Error(`Command Result be array`);this.std=e,this.exitCode=t}addStdOutLine(e){this.std.push(new n(`out`,e))}addStdErrLine(e){this.std.push(new n(`err`,e))}getStdOutput(){return this.std}getExitCode(){return this.exitCode}flush(){let e=this.std;return this.std=[],e}}})),N=t(((e,t)=>{var n=A(),r=M(),i=n.EventEmitter||n.default||n;t.exports=class extends i{constructor(e){super(),this.arguments=e,this.result=new r}get name(){return`unnamed`}run(){return Promise.reject(`Command not implemented...`)}runCommand(){return this.run().then(e=>(e&&e.split(/\r?\n/).forEach(e=>this.stdOut=e),this.result)).catch(e=>{if(e&&e.__type)throw e;return e&&(this.stdErr=e.message||e),this.exitCode=127,this.result})}onInput(e){}set exitCode(e){this.result.exitCode=e}set stdOut(e){this.result.addStdOutLine(e)}set stdErr(e){this.result.addStdErrLine(e)}flush(){this.emit(`flush`,this.result.flush())}}})),P=t(((e,t)=>{var n=N();t.exports=class extends n{constructor(e,t){super(e),this.context=t}}})),F=t(((e,t)=>{r();var i=P();function a(e){return/^#!\/(sh\.js|bin\/(sh|brsh))/.test(e)}t.exports=class extends i{constructor(e,t,n,r=!1){super(t,n),this.script=e,this.source=r}get captureInput(){return!!(this.sandbox&&this.sandbox.runningCommand&&this.sandbox.runningCommand.captureInput)}onInput(e){this.sandbox&&this.sandbox.onInput(e)}run(){let e=this.context.fs.isRealFilesystem?{useRealFilesystem:!0}:{filesystem:this.context.fs.getRaw(),permissions:this.context.fs.getRawPermissions()};this.sandbox=new n.shell({cwd:this.context.fs.cwd,...e}),this.sandbox.context.source(this.context),this.sandbox.on(`stdOut`,e=>{this.stdOut=e,this.flush()}),this.sandbox.on(`stdErr`,e=>{this.stdErr=e,this.flush()}),this._scriptFunctions={};let t=this.script.split(/\r?\n/);if(!a(t[0])){let e=t[0].startsWith(`#!`)?t[0].slice(2).split(/\s/)[0]:t[0];return Promise.reject(`${e}: bad interpreter: No such file or directory`)}let r=this._parseLines(t.slice(1));return this._executeNodes(r).catch(e=>{if(e&&e.__type===`return`)this.sandbox.lastCode=e.code;else if(e&&e.__type===`errexit`)this.sandbox.lastCode=e.code;else if(e&&(e.__type===`break`||e.__type===`continue`))this.stdErr=`${e.__type}: only meaningful in a for or while loop`,this.sandbox.lastCode=1;else return Promise.reject(e)}).then(()=>{this.exitCode=this.sandbox.lastCode,this.source&&this.context.source(this.sandbox.context)})}_parseLines(e){let t=[],n=0;for(;n<e.length;){let r=e[n].trim();if(!r||r.startsWith(`#`)){n++;continue}if(r.startsWith(`if `)||r===`if`){let r=this._parseIf(e,n);t.push(r.node),n+=r.consumed;continue}if(r.startsWith(`while `)){let r=this._parseWhile(e,n);t.push(r.node),n+=r.consumed;continue}if(r.startsWith(`for `)){let r=this._parseFor(e,n);t.push(r.node),n+=r.consumed;continue}if(r.startsWith(`case `)||r===`case`){let r=this._parseCase(e,n);t.push(r.node),n+=r.consumed;continue}if(/^(?:function\s+[\w\d_]+|[\w\d_]+\s*\(\s*\))\s*(?:\{.*)?$/.test(r)){let r=this._parseFunction(e,n);t.push(r.node),n+=r.consumed;continue}t.push({type:`command`,line:r}),n++}return t}_parseIf(e,t){let n=e=>e.replace(/^(?:if|elif)\s+/,``).replace(/\s*;\s*then\s*$/,``).replace(/\s+then\s*$/,``).trim(),r=[{condition:n(e[t].trim()),bodyLines:[]}],i=[],a=r[0],o=!1,s=1,c=t+1;for(c<e.length&&e[c].trim()===`then`&&c++;c<e.length;){let t=e[c].trim();if((t.startsWith(`if `)||t===`if`)&&s++,t===`fi`&&(s--,s===0)){c++;break}if(s===1&&t.startsWith(`elif `)){let i={condition:n(t),bodyLines:[]};r.push(i),a=i,c++,c<e.length&&e[c].trim()===`then`&&c++;continue}if(s===1&&t===`else`){o=!0,c++;continue}o?i.push(e[c]):a.bodyLines.push(e[c]),c++}return{node:{type:`if`,clauses:r,elseLines:i},consumed:c-t}}_parseWhile(e,t){let n=e[t].trim().replace(/^while\s+/,``).replace(/\s*;\s*do\s*$/,``).replace(/\s+do\s*$/,``).trim(),r=t+1;r<e.length&&e[r].trim()===`do`&&r++;let i=[],a=1;for(;r<e.length;){let t=e[r].trim();if((t.startsWith(`while `)||t.startsWith(`for `))&&a++,t===`done`&&(a--,a===0)){r++;break}i.push(e[r]),r++}return{node:{type:`while`,condition:n,bodyLines:i},consumed:r-t}}_parseFor(e,t){let n=e[t].trim().replace(/\s*;\s*do\s*$/,``).replace(/\s+do\s*$/,``).match(/^for\s+(\w+)\s+in\s+(.+)$/),r=n?n[1]:``,i=n?n[2].trim():``,a=t+1;a<e.length&&e[a].trim()===`do`&&a++;let o=[],s=1;for(;a<e.length;){let t=e[a].trim();if((t.startsWith(`while `)||t.startsWith(`for `))&&s++,t===`done`&&(s--,s===0)){a++;break}o.push(e[a]),a++}return{node:{type:`for`,variable:r,list:i,bodyLines:o},consumed:a-t}}async _executeNodes(e){for(let t of e)await this._executeNode(t)}_executeNode(e){if(e.type===`function`){let t=e.name,n=e.bodyLines,r=this,i=P(),a=class extends i{static get name(){return t}run(){let e=this.arguments.map((e,t)=>({key:String(t+1),prev:r.sandbox.context.getVar(String(t+1))}));this.arguments.forEach((e,t)=>r.sandbox.context.setVar(String(t+1),e));let t=()=>e.forEach(({key:e,prev:t})=>t?r.sandbox.context.setVar(e,t):r.sandbox.context.unsetVar(e));return r._executeFunctionBody(n).then(()=>{t()}).catch(e=>{if(t(),e&&e.__type===`return`){this.exitCode=e.code;return}return Promise.reject(e)})}};return this.sandbox.context.setCommand(a),Promise.resolve()}if(e.type===`command`){if(/^return(\s+\d+)?\s*$/.test(e.line.trim())){let t=e.line.trim().match(/^return\s+(\d+)/),n=t?parseInt(t[1],10):0;return Promise.reject({__type:`return`,code:n})}if(/^break(\s+\d+)?\s*$/.test(e.line.trim())){let t=e.line.trim().match(/^break\s+(\d+)/),n=t?parseInt(t[1],10):1;return Promise.reject({__type:`break`,count:n})}if(/^continue(\s+\d+)?\s*$/.test(e.line.trim())){let t=e.line.trim().match(/^continue\s+(\d+)/),n=t?parseInt(t[1],10):1;return Promise.reject({__type:`continue`,count:n})}return(this.sandbox.context.getVar(`-`)||``).includes(`x`)&&(this.stdErr=`+ ${e.line.trim()}`,this.flush()),this.sandbox.onCommand(e.line,!1).then(()=>{if((this.sandbox.context.getVar(`-`)||``).includes(`e`)&&this.sandbox.lastCode!==0)return Promise.reject({__type:`errexit`,code:this.sandbox.lastCode})})}return e.type===`if`?this._executeIf(e):e.type===`while`?this._executeWhile(e):e.type===`for`?this._executeFor(e):e.type===`case`?this._executeCase(e):Promise.resolve()}async _executeIf(e){for(let t of e.clauses)if(await this.sandbox.onCommand(t.condition,!1),this.sandbox.lastCode===0)return this._executeNodes(this._parseLines(t.bodyLines));if(e.elseLines.length>0)return this._executeNodes(this._parseLines(e.elseLines))}async _executeWhile(e){for(;await this.sandbox.onCommand(e.condition,!1),this.sandbox.lastCode===0;)try{await this._executeNodes(this._parseLines(e.bodyLines))}catch(e){if(e&&e.__type===`break`){if(e.count<=1)break;throw{__type:`break`,count:e.count-1}}if(e&&e.__type===`continue`){if(e.count<=1)continue;throw{__type:`continue`,count:e.count-1}}throw e}}async _executeFor(e){let t=e.list.replace(/\${?([\w\d]+)}?/g,(e,t)=>this.sandbox.context.getVar(t)||``).split(/\s+/).filter(Boolean);for(let n of t){this.sandbox.context.setVar(e.variable,n);try{await this._executeNodes(this._parseLines(e.bodyLines))}catch(e){if(e&&e.__type===`break`){if(e.count<=1)break;throw{__type:`break`,count:e.count-1}}if(e&&e.__type===`continue`){if(e.count<=1)continue;throw{__type:`continue`,count:e.count-1}}throw e}}}_parseFunction(e,t){let n=e[t].trim(),r=n.match(/^function\s+([\w\d_]+)/)||n.match(/^([\w\d_]+)\s*\(/),i=r?r[1]:``,a=t+1;if(!n.includes(`{`)){for(;a<e.length&&!e[a].includes(`{`);)a++;a++}let o=[],s=1;for(;a<e.length;){if(e[a].trim()===`}`){a++;break}let t=(e[a].match(/\{/g)||[]).length,n=(e[a].match(/\}/g)||[]).length;if(s+=t-n,s<=0){a++;break}o.push(e[a]),a++}return{node:{type:`function`,name:i,bodyLines:o},consumed:a-t}}_parseCase(e,t){let n=e[t].trim().match(/^case\s+(.+?)\s+in\s*$/),r=n?n[1]:``,i=t+1,a=[],o=null,s=[];for(;i<e.length;){let t=e[i],n=t.trim();if(i++,!(!n||n.startsWith(`#`))){if(n===`esac`)break;if(o===null){let e=n.match(/^(.+?)\)\s*(.*)$/);if(e){o=e[1].trim();let t=e[2].trim();if(t===`;;`)a.push({pattern:o,bodyLines:[]}),o=null;else if(t.endsWith(`;;`)){let e=t.slice(0,-2).trim();a.push({pattern:o,bodyLines:e?[e]:[]}),o=null}else s=t?[t]:[]}}else n===`;;`?(a.push({pattern:o,bodyLines:s}),o=null,s=[]):n.endsWith(`;;`)?(s.push(n.slice(0,-2).trim()),a.push({pattern:o,bodyLines:s}),o=null,s=[]):s.push(t)}}return o!==null&&a.push({pattern:o,bodyLines:s}),{node:{type:`case`,word:r,clauses:a},consumed:i-t}}_executeFunctionBody(e){return this._executeNodes(this._parseLines(e))}async _executeCase(e){let t=await this.sandbox._replaceVariables(e.word),n=t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t;for(let t of e.clauses)if(this._matchPattern(t.pattern,n))return this._executeNodes(this._parseLines(t.bodyLines))}_matchPattern(e,t){let n=``,r=0;for(;r<e.length;){let t=e[r];if(t===`[`){let t=e.indexOf(`]`,r+1);t===-1?(n+=`\\[`,r++):(n+=e.slice(r,t+1),r=t+1)}else t===`*`?(n+=`.*`,r++):t===`?`?(n+=`.`,r++):/[.+^${}()|\\]/.test(t)?(n+=`\\`+t,r++):(n+=t,r++)}try{return RegExp(`^`+n+`$`).test(t)}catch{return!1}}},t.exports.isKnownInterpreter=a}));function I(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function L(e){var t=I(e),n=t[0],r=t[1];return(n+r)*3/4-r}function ee(e,t,n){return(t+n)*3/4-n}function te(e){var t,n=I(e),r=n[0],i=n[1],a=new re(ee(e,r,i)),o=0,s=i>0?r-4:r,c;for(c=0;c<s;c+=4)t=U[e.charCodeAt(c)]<<18|U[e.charCodeAt(c+1)]<<12|U[e.charCodeAt(c+2)]<<6|U[e.charCodeAt(c+3)],a[o++]=t>>16&255,a[o++]=t>>8&255,a[o++]=t&255;return i===2&&(t=U[e.charCodeAt(c)]<<2|U[e.charCodeAt(c+1)]>>4,a[o++]=t&255),i===1&&(t=U[e.charCodeAt(c)]<<10|U[e.charCodeAt(c+1)]<<4|U[e.charCodeAt(c+2)]>>2,a[o++]=t>>8&255,a[o++]=t&255),a}function R(e){return H[e>>18&63]+H[e>>12&63]+H[e>>6&63]+H[e&63]}function z(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(R(r));return i.join(``)}function ne(e){for(var t,n=e.length,r=n%3,i=[],a=16383,o=0,s=n-r;o<s;o+=a)i.push(z(e,o,o+a>s?s:o+a));return r===1?(t=e[n-1],i.push(H[t>>2]+H[t<<4&63]+`==`)):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(H[t>>10]+H[t>>4&63]+H[t<<2&63]+`=`)),i.join(``)}var B,V,H,U,re,W,G,ie,ae,oe,se=e((()=>{for(B={},V={},V.byteLength=L,V.toByteArray=te,V.fromByteArray=ne,H=[],U=[],re=typeof Uint8Array<`u`?Uint8Array:Array,W=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,G=0,ie=W.length;G<ie;++G)H[G]=W[G],U[W.charCodeAt(G)]=G;U[45]=62,U[95]=63,ae={},ae.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},ae.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128},(function(e){let t=V,n=ae,r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=u,e.SlowBuffer=x,e.INSPECT_MAX_BYTES=50;let i=2147483647;e.kMaxLength=i;let{Uint8Array:a,ArrayBuffer:o,SharedArrayBuffer:s}=globalThis;u.TYPED_ARRAY_SUPPORT=c(),!u.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{let e=new a(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,a.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function l(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new a(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return m(e)}return d(e,t,n)}u.poolSize=8192;function d(e,t,n){if(typeof e==`string`)return h(e,t);if(o.isView(e))return _(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(J(e,o)||e&&J(e.buffer,o)||s!==void 0&&(J(e,s)||e&&J(e.buffer,s)))return v(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return u.from(r,t,n);let i=y(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return u.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}u.from=function(e,t,n){return d(e,t,n)},Object.setPrototypeOf(u.prototype,a.prototype),Object.setPrototypeOf(u,a);function f(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function p(e,t,n){return f(e),e<=0||t===void 0?l(e):typeof n==`string`?l(e).fill(t,n):l(e).fill(t)}u.alloc=function(e,t,n){return p(e,t,n)};function m(e){return f(e),l(e<0?0:b(e)|0)}u.allocUnsafe=function(e){return m(e)},u.allocUnsafeSlow=function(e){return m(e)};function h(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!u.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=S(e,t)|0,r=l(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function g(e){let t=e.length<0?0:b(e.length)|0,n=l(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function _(e){if(J(e,a)){let t=new a(e);return v(t.buffer,t.byteOffset,t.byteLength)}return g(e)}function v(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new a(e):n===void 0?new a(e,t):new a(e,t,n),Object.setPrototypeOf(r,u.prototype),r}function y(e){if(u.isBuffer(e)){let t=b(e.length)|0,n=l(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||he(e.length)?l(0):g(e);if(e.type===`Buffer`&&Array.isArray(e.data))return g(e.data)}function b(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function x(e){return+e!=e&&(e=0),u.alloc(+e)}u.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==u.prototype},u.compare=function(e,t){if(J(e,a)&&(e=u.from(e,e.offset,e.byteLength)),J(t,a)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},u.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},u.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return u.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=u.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(J(t,a))i+t.length>r.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(r,i)):a.prototype.set.call(r,t,i);else if(u.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function S(e,t){if(u.isBuffer(e))return e.length;if(o.isView(e)||J(e,o))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return ue(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return pe(e).length;default:if(i)return r?-1:ue(e).length;t=(``+t).toLowerCase(),i=!0}}u.byteLength=S;function C(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return ee(this,t,n);case`utf8`:case`utf-8`:return N(this,t,n);case`ascii`:return I(this,t,n);case`latin1`:case`binary`:return L(this,t,n);case`base64`:return M(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return te(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}u.prototype._isBuffer=!0;function w(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}u.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)w(this,t,t+1);return this},u.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)w(this,t,t+3),w(this,t+1,t+2);return this},u.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)w(this,t,t+7),w(this,t+1,t+6),w(this,t+2,t+5),w(this,t+3,t+4);return this},u.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?N(this,0,e):C.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:u.compare(this,e)===0},u.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(u.prototype[r]=u.prototype.inspect),u.prototype.compare=function(e,t,n,r,i){if(J(e,a)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let o=i-r,s=n-t,c=Math.min(o,s),l=this.slice(r,i),d=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==d[e]){o=l[e],s=d[e];break}return o<s?-1:+(s<o)};function T(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,he(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=u.from(t,r)),u.isBuffer(t))return t.length===0?-1:E(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof a.prototype.indexOf==`function`?i?a.prototype.indexOf.call(e,t,n):a.prototype.lastIndexOf.call(e,t,n):E(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function E(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}u.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},u.prototype.indexOf=function(e,t,n){return T(this,e,t,n,!0)},u.prototype.lastIndexOf=function(e,t,n){return T(this,e,t,n,!1)};function D(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(he(r))return o;e[n+o]=r}return o}function O(e,t,n,r){return me(ue(t,e.length-n),e,n,r)}function k(e,t,n,r){return me(de(t),e,n,r)}function A(e,t,n,r){return me(pe(t),e,n,r)}function j(e,t,n,r){return me(fe(t,e.length-n),e,n,r)}u.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return D(this,e,t,n);case`utf8`:case`utf-8`:return O(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return k(this,e,t,n);case`base64`:return A(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return j(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function M(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function N(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return F(r)}let P=4096;function F(e){let t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=P));return n}function I(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function L(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function ee(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=ge[e[r]];return i}function te(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}u.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,u.prototype),r};function R(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||R(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||R(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||R(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||R(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||R(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=Y(function(e){e>>>=0,K(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&q(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),u.prototype.readBigUInt64BE=Y(function(e){e>>>=0,K(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&q(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),u.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||R(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},u.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||R(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},u.prototype.readInt8=function(e,t){return e>>>=0,t||R(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||R(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},u.prototype.readInt16BE=function(e,t){e>>>=0,t||R(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=Y(function(e){e>>>=0,K(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&q(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),u.prototype.readBigInt64BE=Y(function(e){e>>>=0,K(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&q(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||R(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||R(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||R(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||R(e,8,this.length),n.read(this,e,!1,52,8)};function z(e,t,n,r,i,a){if(!u.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;z(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;z(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,1,255,0),this[t]=e&255,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function ne(e,t,n,r,i){se(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function B(e,t,n,r,i){se(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}u.prototype.writeBigUInt64LE=Y(function(e,t=0){return ne(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),u.prototype.writeBigUInt64BE=Y(function(e,t=0){return B(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);z(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);z(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||z(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},u.prototype.writeBigInt64LE=Y(function(e,t=0){return ne(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),u.prototype.writeBigInt64BE=Y(function(e,t=0){return B(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function H(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function U(e,t,r,i,a){return t=+t,r>>>=0,a||H(e,t,r,4),n.write(e,t,r,i,23,4),r+4}u.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)};function re(e,t,r,i,a){return t=+t,r>>>=0,a||H(e,t,r,8),n.write(e,t,r,i,52,8),r+8}u.prototype.writeDoubleLE=function(e,t,n){return re(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return re(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(!u.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof a.prototype.copyWithin==`function`?this.copyWithin(t,n,r):a.prototype.set.call(e,this.subarray(n,r),t),i},u.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!u.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=u.isBuffer(e)?e:u.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let W={};function G(e,t,n){W[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}G(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),G(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),G(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=ie(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=ie(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function ie(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function oe(e,t,n){K(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&q(t,e.length-(n+1))}function se(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new W.ERR_OUT_OF_RANGE(`value`,i,e)}oe(r,i,a)}function K(e,t){if(typeof e!=`number`)throw new W.ERR_INVALID_ARG_TYPE(t,`number`,e)}function q(e,t,n){throw Math.floor(e)===e?t<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(K(e,n),new W.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let ce=/[^+/0-9A-Za-z-_]/g;function le(e){if(e=e.split(`=`)[0],e=e.trim().replace(ce,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function ue(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function de(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function fe(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function pe(e){return t.toByteArray(le(e))}function me(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function J(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function he(e){return e!==e}let ge=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function Y(e){return typeof BigInt>`u`?_e:e}function _e(){throw Error(`BigInt not supported`)}})(B),oe=B.Buffer,B.Blob,B.BlobOptions,B.Buffer,B.File,B.FileOptions,B.INSPECT_MAX_BYTES,B.SlowBuffer,B.TranscodeEncoding,B.atob,B.btoa,B.constants,B.isAscii,B.isUtf8,B.kMaxLength,B.kStringMaxLength,B.resolveObjectURL,B.transcode})),K=t(((e,t)=>{se();var n=F();t.exports=class extends n{get name(){return`wasm`}get requiresFilesystem(){return!0}run(){let e=this.script,t=(()=>{try{return E()}catch{return null}})();return this._loadBytes(e,t).then(({bytes:e,isWat:t})=>t?this._runWat(e):this._runWasm(e)).catch(e=>{this.stdErr=e.message||String(e),this.exitCode=1})}_loadBytes(e,t){if(this.context.fs.isRealFilesystem&&t)try{let n=t.readFileSync(this.context.fs.absolutePath(e)),r=new Uint8Array(n);return Promise.resolve({bytes:r,isWat:this._isWat(e,r)})}catch(t){return Promise.reject(Error(`${e}: ${t.message}`))}let n=this.context.fs.getFileByPath(e);if(n==null)return Promise.reject(Error(`${e}: No such file or directory`));let r=this._contentToBytes(n);return Promise.resolve({bytes:r,isWat:this._isWat(e,r)})}_isWat(e,t){return e.endsWith(`.wat`)?!0:t.length>0&&t[0]===40}_contentToBytes(e){if(e instanceof Uint8Array)return e;if(oe!==void 0&&oe.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(e instanceof ArrayBuffer)return new Uint8Array(e);let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t}async _runWat(e){let t=new TextDecoder().decode(e),n,r;try{r=await import(`wabt`)}catch{this.stdErr=`${this.script}: WAT execution requires the 'wabt' package\nInstall it with: npm install wabt`,this.exitCode=1;return}try{let e=r.default??r,{buffer:i}=(typeof e==`function`?await e():e).parseWat(this.script,t,{mutable_globals:!0}).toBinary({});n=new Uint8Array(i)}catch(e){this.stdErr=`${this.script}: WAT compilation error: ${e.message}`,this.exitCode=1;return}return this._runWasm(n)}async _runWasm(e){if(typeof WebAssembly>`u`){this.stdErr=`${this.script}: WebAssembly is not available in this environment`,this.exitCode=1;return}let t={1:``,2:``},n=new TextDecoder,r=null,i=(e,n)=>{t[e]=(t[e]||``)+n;let r=t[e].split(`
2
2
  `);t[e]=r.pop();for(let t of r)e===1?this.stdOut=t:this.stdErr=t},a=()=>{t[1]&&=(this.stdOut=t[1],``),t[2]&&=(this.stdErr=t[2],``)},o=new TextEncoder().encode(this.stdin||``),s=0,c=new Proxy({fd_write:(e,t,a,o)=>{if(!r)return 8;let s=new DataView(r.buffer),c=0;for(let o=0;o<a;o++){let a=s.getUint32(t+o*8,!0),l=s.getUint32(t+o*8+4,!0);l>0&&i(e,n.decode(new Uint8Array(r.buffer,a,l))),c+=l}return s.setUint32(o,c,!0),0},fd_read:(e,t,n,i)=>{if(e!==0||!r)return 8;let a=new DataView(r.buffer),c=0;for(let e=0;e<n&&s<o.length;e++){let n=a.getUint32(t+e*8,!0),i=a.getUint32(t+e*8+4,!0),l=Math.min(i,o.length-s);new Uint8Array(r.buffer).set(o.slice(s,s+l),n),s+=l,c+=l}return a.setUint32(i,c,!0),0},proc_exit:e=>{throw e!==0&&(this.exitCode=e),{_wasmExit:!0,code:e}},args_sizes_get:(e,t)=>{if(!r)return 28;let n=[this.script,...this.arguments||[]],i=new DataView(r.buffer);return i.setUint32(e,n.length,!0),i.setUint32(t,n.reduce((e,t)=>e+t.length+1,0),!0),0},args_get:(e,t)=>{if(!r)return 28;let n=[this.script,...this.arguments||[]],i=new DataView(r.buffer),a=new TextEncoder,o=t;for(let t=0;t<n.length;t++){i.setUint32(e+t*4,o,!0);let s=a.encode(n[t]+`\0`);new Uint8Array(r.buffer).set(s,o),o+=s.length}return 0},environ_sizes_get:(e,t)=>{if(r){let n=new DataView(r.buffer);n.setUint32(e,0,!0),n.setUint32(t,0,!0)}return 0},environ_get:()=>0,clock_time_get:(e,t,n)=>{if(r){let e=BigInt(Date.now())*1000000n;new DataView(r.buffer).setBigUint64(n,e,!0)}return 0},fd_close:()=>0,fd_seek:()=>70,fd_prestat_get:()=>8,fd_prestat_dir_name:()=>8,path_open:()=>76,random_get:(e,t)=>{if(r){let n=new Uint8Array(r.buffer,e,t);for(let e=0;e<t;e++)n[e]=Math.random()*256|0}return 0}},{get(e,t){return t in e?e[t]:()=>0}}),l={wasi_snapshot_preview1:c,wasi_unstable:c,env:new Proxy({print:(e,t)=>{r&&i(1,n.decode(new Uint8Array(r.buffer,e,t)))},eprint:(e,t)=>{r&&i(2,n.decode(new Uint8Array(r.buffer,e,t)))},abort:()=>{throw this.exitCode=134,{_wasmExit:!0,code:134}}},{get(e,t){return t in e?e[t]:()=>0}})};try{let t=await WebAssembly.compile(e);for(let e of WebAssembly.Module.imports(t))if(e.kind===`memory`){let t=new WebAssembly.Memory({initial:1,maximum:256});r=t,l[e.module]||(l[e.module]={}),l[e.module][e.name]=t}let n=await WebAssembly.instantiate(t,l);n.exports.memory&&(r=n.exports.memory);let i=n.exports._start||n.exports.__wasi_command||n.exports.main||n.exports.run;if(!i)this.stdErr=`${this.script}: no entry point found (export _start, main, or run)`,this.exitCode=1;else try{await i()}catch(e){(!e||!e._wasmExit)&&(this.stdErr=`${this.script}: runtime error: ${e?.message||String(e)}`,this.exitCode=1)}}catch(e){(!e||!e._wasmExit)&&(this.stdErr=`${this.script}: ${e?.message||String(e)}`,this.exitCode=1)}a()}}})),q=t(((e,t)=>{var n=N(),r=class extends n{static get name(){return`test`}get requiresFilesystem(){return!0}run(){let e=[...this.arguments];return e[e.length-1]===`]`&&e.pop(),this._evaluate(e)||(this.exitCode=1),Promise.resolve()}_evaluate(e){if(e.length===0)return!1;let t=e.indexOf(`-o`);if(t!==-1)return this._evaluate(e.slice(0,t))||this._evaluate(e.slice(t+1));let n=e.indexOf(`-a`);if(n!==-1)return this._evaluate(e.slice(0,n))&&this._evaluate(e.slice(n+1));if(e[0]===`!`)return!this._evaluate(e.slice(1));if(e.length===1)return e[0].length>0;if(e.length===2){let[t,n]=e;switch(t){case`-n`:return n.length>0;case`-z`:return n.length===0;case`-e`:return this.fs?this.fs.getFileByPath(n)!=null:!1;case`-f`:{if(!this.fs)return!1;let e=this.fs.getFileByPath(n);return e!=null&&e.constructor!==Object}case`-d`:{if(!this.fs)return!1;let e=this.fs.getFileByPath(n);return e!=null&&e.constructor===Object}case`-r`:{if(!this.fs)return!1;let e=this.fs.getMode(n);return e!==null&&(e&292)!=0}case`-w`:{if(!this.fs)return!1;let e=this.fs.getMode(n);return e!==null&&(e&146)!=0}case`-x`:{if(!this.fs)return!1;let e=this.fs.getMode(n);return e!==null&&(e&73)!=0}case`-s`:{if(!this.fs)return!1;let e=this.fs.getFileByPath(n);return e==null||e.constructor===Object?!1:e.toString().length>0}default:return!1}}if(e.length===3){let[t,n,r]=e;switch(n){case`=`:case`==`:return t===r;case`!=`:return t!==r;case`-eq`:return parseInt(t)===parseInt(r);case`-ne`:return parseInt(t)!==parseInt(r);case`-lt`:return parseInt(t)<parseInt(r);case`-le`:return parseInt(t)<=parseInt(r);case`-gt`:return parseInt(t)>parseInt(r);case`-ge`:return parseInt(t)>=parseInt(r);default:return!1}}return!1}};t.exports={Test:r,TestBracket:class extends r{static get name(){return`[`}}}})),ce=t(((e,t)=>{var n=N();t.exports=class extends n{static get name(){return`cat`}get requiresFilesystem(){return!0}run(){let e=!1,t=!1,n=!1,r=[];for(let i of this.arguments)if(i.startsWith(`-`)&&i.length>1)for(let r of i.slice(1))r===`n`?e=!0:r===`b`?(t=!0,e=!1):r===`s`&&(n=!0);else r.push(i);let i=[];if(r.length===0){let e=this.stdin;if(e==null)return this.stdErr=`cat: no file specified`,this.exitCode=1,Promise.resolve();i.push(e)}else for(let e of r){if(e===`-`){i.push(this.stdin||``);continue}let t=this.fs.getFileByPath(e);if(t==null){let t=this.fs.exists(e)?`Permission denied`:`No such file or directory`;return this.stdErr=`${e}: ${t}`,this.exitCode=1,Promise.resolve()}if(t.constructor===Object)return this.stdErr=`${e}: Is a directory`,this.exitCode=1,Promise.resolve();i.push(t.toString())}let a=i.join(``);a.endsWith(`
3
3
  `)&&(a=a.slice(0,-1));let o=a.split(`
4
4
  `);if(n&&(o=o.reduce((e,t)=>(t===``&&e.length>0&&e[e.length-1]===``||e.push(t),e),[])),t||e){let e=0;o=o.map(n=>t&&n===``?n:(e++,`${String(e).padStart(6)}\t${n}`))}return o.forEach(e=>this.stdOut=e),Promise.resolve()}}})),le=t(((e,t)=>{function n(e){return typeof e==`object`&&!!e}function r(e){return n(e)&&typeof e.length==`number`}function i(e){return Array.isArray(e)?e:e===void 0?[]:r(e)||e instanceof Set?Array.from(e):[e]}t.exports=i})),ue=t(((e,t)=>{function n(e,t,...n){let r=[];if(!Array.isArray(e))throw Error(`Input must be an array`);for(let[i,a]of e.entries()){let e=[];n.forEach(t=>{typeof t==`function`?e=e.concat(t(a)):e.push(t)}),t(a)&&r.push({index:i,replaceWithValue:e})}for(let t of r.reverse()){let n=[t.index,1].concat(t.replaceWithValue);e.splice.apply(e,n)}return e}t.exports=n})),de=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){return!isNaN(parseFloat(e))}function n(e){return!isNaN(parseFloat(e))&&isFinite(e)}function r(e){return typeof e==`object`&&!!e&&e.constructor===Object}function i(e){return a(e)&&typeof e.length==`number`}function a(e){return typeof e==`object`&&!!e}function o(e){return e!==void 0}function s(e){return!o(e)}function c(e){return e===null}function l(e){return o(e)&&!c(e)&&!Number.isNaN(e)}function u(e){return typeof e==`function`?/^class /.test(Function.prototype.toString.call(e)):!1}function d(e){if(e===null)return!0;switch(typeof e){case`string`:case`number`:case`symbol`:case`undefined`:case`boolean`:return!0;default:return!1}}function f(e){if(e){let t=o(Promise)&&e instanceof Promise,n=e.then&&typeof e.then==`function`;return!!(t||n)}else return!1}function p(e){return e===null||!o(e)?!1:typeof e[Symbol.iterator]==`function`||typeof e[Symbol.asyncIterator]==`function`}function m(e){return typeof e==`string`}function h(e){return typeof e==`function`}function g(e){return typeof e==`function`&&e.constructor.name===`AsyncFunction`}e.default={isNumber:t,isFiniteNumber:n,isPlainObject:r,isArrayLike:i,isObject:a,isDefined:o,isUndefined:s,isNull:c,isDefinedValue:l,isClass:u,isPrimitive:d,isPromise:f,isIterable:p,isString:m,isFunction:h,isAsyncFunction:g},e.isArrayLike=i,e.isAsyncFunction=g,e.isClass=u,e.isDefined=o,e.isDefinedValue=l,e.isFiniteNumber=n,e.isFunction=h,e.isIterable=p,e.isNull=c,e.isNumber=t,e.isObject=a,e.isPlainObject=r,e.isPrimitive=d,e.isPromise=f,e.isString=m,e.isUndefined=s})),fe=t(((e,t)=>{r();var i=1/0,a=`[object Symbol]`,o=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,s=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,c=`\\ud800-\\udfff`,l=`\\u0300-\\u036f\\ufe20-\\ufe23`,u=`\\u20d0-\\u20f0`,d=`\\u2700-\\u27bf`,f=`a-z\\xdf-\\xf6\\xf8-\\xff`,p=`\\xac\\xb1\\xd7\\xf7`,m=`\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf`,h=`\\u2000-\\u206f`,g=` \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000`,_=`A-Z\\xc0-\\xd6\\xd8-\\xde`,v=`\\ufe0e\\ufe0f`,y=p+m+h+g,b=`['’]`,x=`[`+c+`]`,S=`[`+y+`]`,C=`[`+l+u+`]`,w=`\\d+`,T=`[`+d+`]`,E=`[`+f+`]`,D=`[^`+c+y+w+d+f+_+`]`,O=`\\ud83c[\\udffb-\\udfff]`,k=`(?:`+C+`|`+O+`)`,A=`[^`+c+`]`,j=`(?:\\ud83c[\\udde6-\\uddff]){2}`,M=`[\\ud800-\\udbff][\\udc00-\\udfff]`,N=`[`+_+`]`,P=`\\u200d`,F=`(?:`+E+`|`+D+`)`,I=`(?:`+N+`|`+D+`)`,L=`(?:`+b+`(?:d|ll|m|re|s|t|ve))?`,ee=`(?:`+b+`(?:D|LL|M|RE|S|T|VE))?`,te=k+`?`,R=`[`+v+`]?`,z=`(?:`+P+`(?:`+[A,j,M].join(`|`)+`)`+R+te+`)*`,ne=R+te+z,B=`(?:`+[T,j,M].join(`|`)+`)`+ne,V=`(?:`+[A+C+`?`,C,j,M,x].join(`|`)+`)`,H=RegExp(b,`g`),U=RegExp(C,`g`),re=RegExp(O+`(?=`+O+`)|`+V+ne,`g`),W=RegExp([N+`?`+E+`+`+L+`(?=`+[S,N,`$`].join(`|`)+`)`,I+`+`+ee+`(?=`+[S,N+F,`$`].join(`|`)+`)`,N+`?`+F+`+`+L,N+`+`+ee,w,B].join(`|`),`g`),G=RegExp(`[`+P+c+l+u+v+`]`),ie=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ae={À:`A`,Á:`A`,Â:`A`,Ã:`A`,Ä:`A`,Å:`A`,à:`a`,á:`a`,â:`a`,ã:`a`,ä:`a`,å:`a`,Ç:`C`,ç:`c`,Ð:`D`,ð:`d`,È:`E`,É:`E`,Ê:`E`,Ë:`E`,è:`e`,é:`e`,ê:`e`,ë:`e`,Ì:`I`,Í:`I`,Î:`I`,Ï:`I`,ì:`i`,í:`i`,î:`i`,ï:`i`,Ñ:`N`,ñ:`n`,Ò:`O`,Ó:`O`,Ô:`O`,Õ:`O`,Ö:`O`,Ø:`O`,ò:`o`,ó:`o`,ô:`o`,õ:`o`,ö:`o`,ø:`o`,Ù:`U`,Ú:`U`,Û:`U`,Ü:`U`,ù:`u`,ú:`u`,û:`u`,ü:`u`,Ý:`Y`,ý:`y`,ÿ:`y`,Æ:`Ae`,æ:`ae`,Þ:`Th`,þ:`th`,ß:`ss`,Ā:`A`,Ă:`A`,Ą:`A`,ā:`a`,ă:`a`,ą:`a`,Ć:`C`,Ĉ:`C`,Ċ:`C`,Č:`C`,ć:`c`,ĉ:`c`,ċ:`c`,č:`c`,Ď:`D`,Đ:`D`,ď:`d`,đ:`d`,Ē:`E`,Ĕ:`E`,Ė:`E`,Ę:`E`,Ě:`E`,ē:`e`,ĕ:`e`,ė:`e`,ę:`e`,ě:`e`,Ĝ:`G`,Ğ:`G`,Ġ:`G`,Ģ:`G`,ĝ:`g`,ğ:`g`,ġ:`g`,ģ:`g`,Ĥ:`H`,Ħ:`H`,ĥ:`h`,ħ:`h`,Ĩ:`I`,Ī:`I`,Ĭ:`I`,Į:`I`,İ:`I`,ĩ:`i`,ī:`i`,ĭ:`i`,į:`i`,ı:`i`,Ĵ:`J`,ĵ:`j`,Ķ:`K`,ķ:`k`,ĸ:`k`,Ĺ:`L`,Ļ:`L`,Ľ:`L`,Ŀ:`L`,Ł:`L`,ĺ:`l`,ļ:`l`,ľ:`l`,ŀ:`l`,ł:`l`,Ń:`N`,Ņ:`N`,Ň:`N`,Ŋ:`N`,ń:`n`,ņ:`n`,ň:`n`,ŋ:`n`,Ō:`O`,Ŏ:`O`,Ő:`O`,ō:`o`,ŏ:`o`,ő:`o`,Ŕ:`R`,Ŗ:`R`,Ř:`R`,ŕ:`r`,ŗ:`r`,ř:`r`,Ś:`S`,Ŝ:`S`,Ş:`S`,Š:`S`,ś:`s`,ŝ:`s`,ş:`s`,š:`s`,Ţ:`T`,Ť:`T`,Ŧ:`T`,ţ:`t`,ť:`t`,ŧ:`t`,Ũ:`U`,Ū:`U`,Ŭ:`U`,Ů:`U`,Ű:`U`,Ų:`U`,ũ:`u`,ū:`u`,ŭ:`u`,ů:`u`,ű:`u`,ų:`u`,Ŵ:`W`,ŵ:`w`,Ŷ:`Y`,ŷ:`y`,Ÿ:`Y`,Ź:`Z`,Ż:`Z`,Ž:`Z`,ź:`z`,ż:`z`,ž:`z`,IJ:`IJ`,ij:`ij`,Œ:`Oe`,œ:`oe`,ʼn:`'n`,ſ:`ss`},oe=typeof n==`object`&&n&&n.Object===Object&&n,se=typeof self==`object`&&self&&self.Object===Object&&self,K=oe||se||Function(`return this`)();function q(e,t,n,r){var i=-1,a=e?e.length:0;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function ce(e){return e.split(``)}function le(e){return e.match(o)||[]}function ue(e){return function(t){return e?.[t]}}var de=ue(ae);function fe(e){return G.test(e)}function pe(e){return ie.test(e)}function me(e){return fe(e)?J(e):ce(e)}function J(e){return e.match(re)||[]}function he(e){return e.match(W)||[]}var ge=Object.prototype.toString,Y=K.Symbol,_e=Y?Y.prototype:void 0,ve=_e?_e.toString:void 0;function ye(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}function be(e){if(typeof e==`string`)return e;if(Te(e))return ve?ve.call(e):``;var t=e+``;return t==`0`&&1/e==-i?`-0`:t}function xe(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:ye(e,t,n)}function Se(e){return function(t){t=Ee(t);var n=fe(t)?me(t):void 0,r=n?n[0]:t.charAt(0),i=n?xe(n,1).join(``):t.slice(1);return r[e]()+i}}function Ce(e){return function(t){return q(je(ke(t).replace(H,``)),e,``)}}function we(e){return!!e&&typeof e==`object`}function Te(e){return typeof e==`symbol`||we(e)&&ge.call(e)==a}function Ee(e){return e==null?``:be(e)}var De=Ce(function(e,t,n){return t=t.toLowerCase(),e+(n?Oe(t):t)});function Oe(e){return Ae(Ee(e).toLowerCase())}function ke(e){return e=Ee(e),e&&e.replace(s,de).replace(U,``)}var Ae=Se(`toUpperCase`);function je(e,t,n){return e=Ee(e),t=n?void 0:t,t===void 0?pe(e)?he(e):le(e):e.match(t)||[]}t.exports=De})),pe=t(((e,t)=>{T();var n=le(),r=ue(),i=de(),a=fe(),o={short:/^-([^\d-])$/,long:/^--(\S+)/,combinedShort:/^-[^\d-]{2,}$/,optEquals:/^(--\S+?)=(.*)/},s=class extends Array{load(e){if(this.clear(),e&&e!==w.argv)e=n(e);else{e=w.argv.slice(0);let t=w.execArgv.some(m)?1:2;e.splice(0,t)}e.forEach(e=>this.push(String(e)))}clear(){this.length=0}expandOptionEqualsNotation(){if(this.some(e=>o.optEquals.test(e))){let e=[];this.forEach(t=>{let n=t.match(o.optEquals);n?e.push(n[1],n[2]):e.push(t)}),this.clear(),this.load(e)}}expandGetoptNotation(){this.hasCombinedShortOptions()&&r(this,o.combinedShort,c)}hasCombinedShortOptions(){return this.some(e=>o.combinedShort.test(e))}static from(e){let t=new this;return t.load(e),t}};function c(e){return e=e.slice(1),e.split(``).map(e=>`-`+e)}function l(e){return o.optEquals.test(e)}function u(e){return(o.short.test(e)||o.long.test(e))&&!o.optEquals.test(e)}function d(e){return o.long.test(e)&&!l(e)}function f(e){return o.short.test(e)?e.match(o.short)[1]:d(e)?e.match(o.long)[1]:l(e)?e.match(o.optEquals)[1].replace(/^--/,``):null}function p(e){return!(u(e)||o.combinedShort.test(e)||o.optEquals.test(e))}function m(e){return[`--eval`,`-e`].indexOf(e)>-1||e.startsWith(`--eval=`)}var h=class{constructor(e){this.name=e.name,this.type=e.type||String,this.alias=e.alias,this.multiple=e.multiple,this.lazyMultiple=e.lazyMultiple,this.defaultOption=e.defaultOption,this.defaultValue=e.defaultValue,this.group=e.group;for(let t in e)this[t]||(this[t]=e[t])}isBoolean(){return this.type===Boolean||i.isFunction(this.type)&&this.type.name===`Boolean`}isMultiple(){return this.multiple||this.lazyMultiple}static create(e){return new this(e)}},g=class extends Array{validate(e){this.some(e=>!e.name)&&_(`INVALID_DEFINITIONS`,"Invalid option definitions: the `name` property is required on each definition"),this.some(e=>e.type&&typeof e.type!=`function`)&&_(`INVALID_DEFINITIONS`,"Invalid option definitions: the `type` property must be a setter fuction (default: `Boolean`)");let t;this.some(e=>(t=e,i.isDefined(e.alias)&&i.isNumber(e.alias)))&&_(`INVALID_DEFINITIONS`,`Invalid option definition: to avoid ambiguity an alias cannot be numeric [--`+t.name+` alias is -`+t.alias+`]`),this.some(e=>(t=e,i.isDefined(e.alias)&&e.alias.length!==1))&&_(`INVALID_DEFINITIONS`,`Invalid option definition: an alias must be a single character`),this.some(e=>(t=e,e.alias===`-`))&&_(`INVALID_DEFINITIONS`,`Invalid option definition: an alias cannot be "-"`),y(this.map(t=>e?t.name.toLowerCase():t.name))&&_(`INVALID_DEFINITIONS`,`Two or more option definitions have the same name`),y(this.map(t=>e&&i.isDefined(t.alias)?t.alias.toLowerCase():t.alias))&&_(`INVALID_DEFINITIONS`,`Two or more option definitions have the same alias`),this.filter(e=>e.defaultOption===!0).length>1&&_(`INVALID_DEFINITIONS`,`Only one option definition can be the defaultOption`),this.some(e=>(t=e,e.isBoolean()&&e.defaultOption))&&_(`INVALID_DEFINITIONS`,`A boolean option ["${t.name}"] can not also be the defaultOption.`)}get(e,t){if(u(e))if(o.short.test(e)){let n=f(e);if(t){let e=n.toLowerCase();return this.find(t=>i.isDefined(t.alias)&&t.alias.toLowerCase()===e)}else return this.find(e=>e.alias===n)}else{let n=f(e);if(t){let e=n.toLowerCase();return this.find(t=>t.name.toLowerCase()===e)}else return this.find(e=>e.name===n)}else return this.find(t=>t.name===e)}getDefault(){return this.find(e=>e.defaultOption===!0)}isGrouped(){return this.some(e=>e.group)}whereGrouped(){return this.filter(v)}whereNotGrouped(){return this.filter(e=>!v(e))}whereDefaultValueSet(){return this.filter(e=>i.isDefined(e.defaultValue))}static from(e,t){if(e instanceof this)return e;let r=super.from(n(e),e=>h.create(e));return r.validate(t),r}};function _(e,t){let n=Error(t);throw n.name=e,n}function v(e){return n(e.group).some(e=>e)}function y(e){let t={};for(let n=0;n<e.length;n++){let r=e[n];if(t[r])return!0;i.isDefined(r)&&(t[r]=!0)}}var b=class{constructor(e,t){this.options=Object.assign({},t),this.definitions=g.from(e,this.options.caseInsensitive),this.argv=s.from(this.options.argv),this.argv.hasCombinedShortOptions()&&r(this.argv,o.combinedShort.test.bind(o.combinedShort),e=>(e=e.slice(1),e.split(``).map(t=>({origArg:`-${e}`,arg:`-`+t}))))}*[Symbol.iterator](){let e=this.definitions,t,n,r,a,s=!1,c=!1,d;for(let f of this.argv){if(i.isPlainObject(f)&&(d=f.origArg,f=f.arg),c&&this.options.stopAtFirstUnknown){yield{event:`unknown_value`,arg:f,name:`_unknown`,value:void 0};continue}if(u(f))t=e.get(f,this.options.caseInsensitive),n=void 0,t?(n=t.isBoolean()?!0:null,a=`set`):a=`unknown_option`;else if(l(f)){let r=f.match(o.optEquals);t=e.get(r[1],this.options.caseInsensitive),t?t.isBoolean()?(yield{event:`unknown_value`,arg:f,name:`_unknown`,value:n,def:t},a=`set`,n=!0):(a=`set`,n=r[2]):a=`unknown_option`}else p(f)&&(t?(n=f,a=`set`):(t=this.definitions.getDefault(),t&&!s?(n=f,a=`set`):(a=`unknown_value`,t=void 0)));r=t?t.name:`_unknown`;let m={event:a,arg:f,name:r,value:n,def:t};d&&(m.subArg=f,m.arg=d),yield m,r===`_unknown`&&(c=!0),t&&t.defaultOption&&!t.isMultiple()&&a===`set`&&(s=!0),t&&t.isBoolean()&&(t=void 0),t&&!t.multiple&&i.isDefined(n)&&n!==null&&(t=void 0),n=void 0,a=void 0,r=void 0,d=void 0}}},x=new WeakMap,S=class{constructor(e){this.definition=new h(e),this.state=null,this.resetToDefault()}get(){return x.get(this)}set(e){this._set(e,`set`)}_set(e,t){let n=this.definition;if(n.isMultiple()){if(e!=null){let r=this.get();this.state===`default`&&(r.length=0),r.push(n.type(e)),this.state=t}}else if(!n.isMultiple()&&this.state===`set`){let t=Error(`Singular option already set [${this.definition.name}=${this.get()}]`);throw t.name=`ALREADY_SET`,t.value=e,t.optionName=n.name,t}else e==null?x.set(this,e):(x.set(this,n.type(e)),this.state=t)}resetToDefault(){i.isDefined(this.definition.defaultValue)?this.definition.isMultiple()?x.set(this,n(this.definition.defaultValue).slice()):x.set(this,this.definition.defaultValue):this.definition.isMultiple()?x.set(this,[]):x.set(this,null),this.state=`default`}static create(e){return e=new h(e),e.isBoolean()?C.create(e):new this(e)}},C=class extends S{set(e){super.set(!0)}static create(e){return new this(e)}},E=class extends Map{constructor(e){super(),this.definitions=g.from(e),this.set(`_unknown`,S.create({name:`_unknown`,multiple:!0}));for(let e of this.definitions.whereDefaultValueSet())this.set(e.name,S.create(e))}toObject(e){e||={};let t={};for(let n of this){let r=e.camelCase&&n[0]!==`_unknown`?a(n[0]):n[0],i=n[1];r===`_unknown`&&!i.get().length||(t[r]=i.get())}return e.skipUnknown&&delete t._unknown,t}},D=class extends E{toObject(e){let t=super.toObject({skipUnknown:e.skipUnknown}),r=super.toObject(e),o=r._unknown;delete r._unknown;let s={_all:r};return o&&o.length&&(s._unknown=o),this.definitions.whereGrouped().forEach(r=>{let o=e.camelCase?a(r.name):r.name,c=t[r.name];for(let e of n(r.group))s[e]=s[e]||{},i.isDefined(c)&&(s[e][o]=c)}),this.definitions.whereNotGrouped().forEach(n=>{let r=e.camelCase?a(n.name):n.name,o=t[n.name];i.isDefined(o)&&(s._none||={},s._none[r]=o)}),s}};function O(e,t){t||={},t.stopAtFirstUnknown&&(t.partial=!0),e=g.from(e,t.caseInsensitive);let n=new b(e,{argv:t.argv,stopAtFirstUnknown:t.stopAtFirstUnknown,caseInsensitive:t.caseInsensitive}),r=new(e.isGrouped()?D:E)(e);for(let e of n){let n=e.subArg||e.arg;if(!t.partial){if(e.event===`unknown_value`){let e=Error(`Unknown value: ${n}`);throw e.name=`UNKNOWN_VALUE`,e.value=n,e}else if(e.event===`unknown_option`){let e=Error(`Unknown option: ${n}`);throw e.name=`UNKNOWN_OPTION`,e.optionName=n,e}}let i;r.has(e.name)?i=r.get(e.name):(i=S.create(e.def),r.set(e.name,i)),e.name===`_unknown`?i.set(n):i.set(e.value)}return r.toObject({skipUnknown:!t.partial,camelCase:t.camelCase})}t.exports=O})),me=t(((e,t)=>{var n=N(),r=pe();t.exports=class extends n{static get name(){return`ls`}get requiresFilesystem(){return!0}run(){let e=this.arguments.filter(e=>e!==`-1`),t=e.length!==this.arguments.length,n;try{n=this.parseArgs(e)}catch(e){return this.printHelp(e),Promise.reject()}if(n.one=n.one||t,n.help)return this.printHelp(),Promise.resolve();let r=this.fs.getFileByPath(n.path);if(!r){let e=this.fs.exists(n.path)?`Permission denied`:`No such file or directory`;return Promise.reject(`${n.path}: ${e}`)}if(r.constructor===Object){let e=r;n.all||(e=Object.entries(e).reduce((e,[t,n])=>(t.startsWith(`.`)||(e[t]=n),e),{}));let t=this.fs.absolutePath(n.path);return n.long?this.printLong(e,t):n.one?Object.entries(e).forEach(([e,t])=>{this.stdOut=this._applyIndicator(e,t,n.classify)}):this.printSimple(e,n.classify),n.recursive&&Object.entries(e).forEach(([e,r])=>{if(r&&r.constructor===Object){let r=t.endsWith(`/`)?t+e:t+`/`+e;this.stdOut=``,this.stdOut=r+`:`,this.run.call(Object.create(this,{arguments:{value:[...this.arguments.filter(e=>e!==n.path&&e!==`./`),r]}}))}}),Promise.resolve()}return Promise.resolve(n.path)}printHelp(e){e&&(this.stdOut=e.message),this.stdOut=`usage: ls [-alRF1h] [file ...]`}printSimple(e,t){this.stdOut=Object.entries(e).reduce((e,[n,r])=>e+this.padString(this._applyIndicator(n,r,t)),``)}printLong(e,t){let n=t.endsWith(`/`)?t.slice(0,-1):t;Object.entries(e).forEach(([e,t])=>{let r=n+`/`+e,i=t!=null&&t.constructor===Object,a=this.fs.getMode(r),o=a===null?i?493:420:a,s=this._modeToString(o,i),c=this.fs.getSize(r);return this.stdOut=`${s} root users ${this.padString(c,10)} ${e}`})}_applyIndicator(e,t,n){return n?t&&t.constructor===Object?e+`/`:typeof t==`function`||this.fs.isExecutable(e)?e+`*`:e:e}_modeToString(e,t){return(t?`d`:`-`)+(e&256?`r`:`-`)+(e&128?`w`:`-`)+(e&64?`x`:`-`)+(e&32?`r`:`-`)+(e&16?`w`:`-`)+(e&8?`x`:`-`)+(e&4?`r`:`-`)+(e&2?`w`:`-`)+(e&1?`x`:`-`)}padString(e,t=16){let n=t-e.toString().length,r=``;for(let e=0;e<n;e++)r+=` `;return e.toString()+r}parseArgs(e=this.arguments){return r([{name:`path`,defaultOption:!0,defaultValue:`./`,type:String},{name:`all`,alias:`a`,type:Boolean},{name:`long`,alias:`l`,type:Boolean},{name:`recursive`,alias:`R`,type:Boolean},{name:`one`,type:Boolean},{name:`classify`,alias:`F`,type:Boolean},{name:`help`,alias:`h`,type:Boolean}],{argv:e})}}})),J=t(((e,t)=>{var n=N();t.exports=class extends n{static get name(){return`echo`}run(){let e=[...this.arguments],t=!1,n=!1;for(;e.length>0&&/^-[neE]+$/.test(e[0]);){let r=e.shift();r.includes(`n`)&&(t=!0),r.includes(`e`)&&(n=!0),r===`-E`&&(n=!1)}let r=e.join(` `);return n&&(r=r.replace(/\\c.*$/s,()=>(t=!0,``)).replace(/\\0([0-7]{1,3})/g,(e,t)=>String.fromCharCode(parseInt(t,8))).replace(/\\x([0-9a-fA-F]{1,2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\n/g,`
@@ -14,7 +14,7 @@
14
14
  `+n.join(`
15
15
  `):n.join(`
16
16
  `)})():n.join(`
17
- `);try{this.context.fs.setFileByPath(e,r,!0)}catch{this.emit(`stdErr`,`${i}: Permission denied`),this.lastCode=1,this.emit(`exitCode`,this.lastCode),delete this.runningCommand;return}this._emitOutput(t.filter(e=>e.type===`err`))}else this._emitOutput(t);this.lastCode=e.getExitCode(),this.emit(`exitCode`,this.lastCode),delete this.runningCommand})}_emitOutput(e){e.forEach(({type:e,string:t})=>{e===`out`?this.emit(`stdOut`,t):e===`err`&&this.emit(`stdErr`,t)})}getPrompt(){let e=this.context.fs.cwd.split(`/`);return`${this.context.getVar(`HOST`)}:${e[e.length-2]}$`}destroy(t=0){this.destroyed||(this.destroyed=!0,this.emit(`status`,e.STATUS_DESTROYED),this.emit(`exit`,t))}clear(){this.emit(`clear`)}_splitInput(e){let t=e.split(`#`)[0];return this._parseOperators(t)}_parseOperators(e){let t=[],n=``,r=0,i=!1,a=!1;for(;r<e.length;){let o=e[r];if(o===`'`&&!a){i=!i,n+=o,r++;continue}if(o===`"`&&!i){a=!a,n+=o,r++;continue}if(!i&&!a){if(o===`&`&&e[r+1]===`&`){t.push({command:n.trim(),op:`&&`}),n=``,r+=2;continue}if(o===`|`&&e[r+1]===`|`){t.push({command:n.trim(),op:`||`}),n=``,r+=2;continue}if(o===`|`){t.push({command:n.trim(),op:`|`}),n=``,r++;continue}if(o===`;`){t.push({command:n.trim(),op:`;`}),n=``,r++;continue}}n+=o,r++}return n.trim()&&t.push({command:n.trim(),op:null}),t}_parseCommand(e){if(e.startsWith(`./`)||e.startsWith(`/`)){let t=this.context.fs._getFileRaw(e);if(!t)throw Error(`${e}: No such file or directory`);if(t.constructor===Object)throw Error(`${e}: is a directory`);if(t.prototype&&typeof t.prototype.run==`function`&&typeof t.prototype.runCommand==`function`){if(!this.context.fs.isExecutable(e))throw Error(`${e}: permission denied`);return t}if(t.constructor===String&&t.startsWith(`#!`)){if(!this.context.fs.isExecutable(e))throw Error(`${e}: permission denied`);return s.bind(this,t)}if(this._isWasmFile(e,t)){if(!this.context.fs.isExecutable(e))throw Error(`${e}: permission denied`);return c.bind(null,e)}if(this.context.fs.isRealFilesystem&&typeof t==`string`&&e.endsWith(`.js`)){if(!this.context.fs.isExecutable(e))throw Error(`${e}: permission denied`);let t=this.context.fs.absolutePath(e);try{let e=require(t),n=e.default||e;if(typeof n==`function`&&typeof n.prototype.run==`function`&&typeof n.prototype.runCommand==`function`)return n}catch{}}throw Error(`${e}: permission denied`)}let t=this.context.getCommand(e);if(!t)throw Error(`${e}: Command not found`);return t}async _parseCommandLine(t){let n=e._splitCommand(t);return(await Promise.all(n.map(({value:e,hasQuote:t})=>this._replaceVariables(e).then(e=>({value:e,hasQuote:t}))))).filter(({value:e,hasQuote:t})=>e.length>0||t)}static _sanitiseCommandPart(e){return e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)?e.substring(1,e.length-1):e}static _sanitiseArray(e){return e.filter(e=>e.length>0)}async _replaceVariables(t){let n=[...t.matchAll(/\$\(\(([^)]+)\)\)/g)];for(let e of n)t=t.replace(e[0],String(this._evalArithmetic(e[1])));let r=[...t.matchAll(/\$\((?!\()([^)]+)\)/g)];for(let e of r){let n=await this._runAndCapture(e[1]);t=t.replace(e[0],n)}let i=t.matchAll(m),a=i.next();for(;!a.done;){let n=this.context.getVar(a.value[1]);t=t.replace(new RegExp(e._escapeRegExp(a.value[0]),`g`),String(n)),a=i.next()}return t}_evalArithmetic(e){let t=e.replace(/\${?([\w\d]+)}?/g,(e,t)=>String(parseInt(this.context.getVar(t))||0));if(!/^[\d\s+\-*/%()]+$/.test(t.trim()))return 0;try{return Function(`return (`+t+`)`)()}catch{return 0}}async _runAndCapture(e){let t=new n.shell({cwd:this.context.fs.cwd,filesystem:this.context.fs.getRaw(),permissions:this.context.fs.getRawPermissions()});t.context.source(this.context);let r=[];return t.on(`stdOut`,e=>r.push(e)),await t.onCommand(e,!1),r.join(`
17
+ `);try{this.context.fs.setFileByPath(e,r,!0)}catch{this.emit(`stdErr`,`${i}: Permission denied`),this.lastCode=1,this.emit(`exitCode`,this.lastCode),delete this.runningCommand;return}this._emitOutput(t.filter(e=>e.type===`err`))}else this._emitOutput(t);this.lastCode=e.getExitCode(),this.emit(`exitCode`,this.lastCode),delete this.runningCommand})}_emitOutput(e){e.forEach(({type:e,string:t})=>{e===`out`?this.emit(`stdOut`,t):e===`err`&&this.emit(`stdErr`,t)})}getPrompt(){let e=this.context.fs.cwd.split(`/`);return`${this.context.getVar(`HOST`)}:${e[e.length-2]}$`}destroy(t=0){this.destroyed||(this.destroyed=!0,this.emit(`status`,e.STATUS_DESTROYED),this.emit(`exit`,t))}clear(){this.emit(`clear`)}_splitInput(e){let t=e.split(`#`)[0];return this._parseOperators(t)}_parseOperators(e){let t=[],n=``,r=0,i=!1,a=!1;for(;r<e.length;){let o=e[r];if(o===`'`&&!a){i=!i,n+=o,r++;continue}if(o===`"`&&!i){a=!a,n+=o,r++;continue}if(!i&&!a){if(o===`&`&&e[r+1]===`&`){t.push({command:n.trim(),op:`&&`}),n=``,r+=2;continue}if(o===`|`&&e[r+1]===`|`){t.push({command:n.trim(),op:`||`}),n=``,r+=2;continue}if(o===`|`){t.push({command:n.trim(),op:`|`}),n=``,r++;continue}if(o===`;`){t.push({command:n.trim(),op:`;`}),n=``,r++;continue}}n+=o,r++}return n.trim()&&t.push({command:n.trim(),op:null}),t}_parseCommand(e){if(e.startsWith(`./`)||e.startsWith(`/`)){let t=this.context.fs._getFileRaw(e);if(!t)throw Error(`${e}: No such file or directory`);if(t.constructor===Object)throw Error(`${e}: is a directory`);if(t.prototype&&typeof t.prototype.run==`function`&&typeof t.prototype.runCommand==`function`){if(!this.context.fs.isExecutable(e))throw Error(`${e}: permission denied`);return t}if(t.constructor===String&&t.startsWith(`#!`)){if(!this.context.fs.isExecutable(e))throw Error(`${e}: permission denied`);return s.bind(this,t)}if(this._isWasmFile(e,t)){if(!this.context.fs.isExecutable(e))throw Error(`${e}: permission denied`);return c.bind(null,e)}if(this.context.fs.isRealFilesystem&&typeof t==`string`&&e.endsWith(`.js`)){if(!this.context.fs.isExecutable(e))throw Error(`${e}: permission denied`);let t=this.context.fs.absolutePath(e);try{let e=require(t),n=e.default||e;if(typeof n==`function`&&typeof n.prototype.run==`function`&&typeof n.prototype.runCommand==`function`)return n}catch{}}throw Error(`${e}: permission denied`)}let t=this.context.getCommand(e);if(!t)throw Error(`${e}: Command not found`);return t}async _parseCommandLine(t){let n=e._splitCommand(t);return(await Promise.all(n.map(({value:e,hasQuote:t})=>this._replaceVariables(e).then(e=>({value:e,hasQuote:t}))))).filter(({value:e,hasQuote:t})=>e.length>0||t)}static _sanitiseCommandPart(e){return e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)?e.substring(1,e.length-1):e}static _sanitiseArray(e){return e.filter(e=>e.length>0)}async _replaceVariables(t){let n=[...t.matchAll(/\$\(\(([^)]+)\)\)/g)];for(let e of n)t=t.replace(e[0],String(this._evalArithmetic(e[1])));let r=[...t.matchAll(/\$\((?!\()([^)]+)\)/g)];for(let e of r){let n=await this._runAndCapture(e[1]);t=t.replace(e[0],n)}let i=t.matchAll(m),a=i.next();for(;!a.done;){let n=this.context.getVar(a.value[1]);t=t.replace(new RegExp(e._escapeRegExp(a.value[0]),`g`),String(n)),a=i.next()}return t}_evalArithmetic(e){let t=e.replace(/\${?([\w\d]+)}?/g,(e,t)=>String(parseInt(this.context.getVar(t))||0));if(t=t.replace(/\b([A-Za-z_]\w*)\b/g,(e,t)=>String(parseInt(this.context.getVar(t))||0)),!/^[\d\s+\-*/%()]+$/.test(t.trim()))return 0;try{return Function(`return (`+t+`)`)()}catch{return 0}}async _runAndCapture(e){let t=new n.shell({cwd:this.context.fs.cwd,filesystem:this.context.fs.getRaw(),permissions:this.context.fs.getRawPermissions()});t.context.source(this.context);let r=[];return t.on(`stdOut`,e=>r.push(e)),await t.onCommand(e,!1),r.join(`
18
18
  `).trimEnd()}_groupPipes(e){let t=[],n=[];for(let{command:r,op:i}of e)n.push(r),i!==`|`&&(t.push({commands:n,op:i}),n=[]);return n.length&&t.push({commands:n,op:null}),t}async _runPipeChain(e){if(e.length===1)return this._runCommand(e[0]);let t;for(let n=0;n<e.length;n++)if(n===e.length-1){t!==void 0&&(this._stdin=t);try{await this._runCommand(e[n])}finally{delete this._stdin}}else t=await this._captureForPipe(e[n],t)}async _captureForPipe(e,t){let r=new n.shell({cwd:this.context.fs.cwd,filesystem:this.context.fs.getRaw(),permissions:this.context.fs.getRawPermissions()});r.context.source(this.context),t!==void 0&&(r.stdin=t);let i=[];return r.on(`stdOut`,e=>i.push(e)),r.on(`stdErr`,e=>this.emit(`stdErr`,e)),await r.onCommand(e,!1),this.lastCode=r.lastCode,i.join(`
19
19
  `)}static _splitCommand(e){let t=/\s/g,n=!1,r=!1,i=0,a=[],o=!1,s=[];for(let c=0;c<e.length;c++){let l=e[c];if(i>0){a.push(l),l===`(`?i++:l===`)`&&i--;continue}if(l===`'`&&!r){n=!n,o=!0;continue}if(l===`"`&&!n){r=!r,o=!0;continue}if(!n&&!r){if(l===`$`&&c+1<e.length&&e[c+1]===`(`){i=1,a.push(`$`),a.push(`(`),c++;continue}if(l.match(t)){(a.length>0||o)&&(s.push({value:a.join(``),hasQuote:o}),a=[],o=!1);continue}}a.push(l)}if((a.length>0||o)&&s.push({value:a.join(``),hasQuote:o}),n||r)throw Error(`quote expression not closed`);return s}_isWasmFile(e,t){return e.endsWith(`.wasm`)||e.endsWith(`.wat`)?!0:typeof t==`string`?t.charCodeAt(0)===0&&t.slice(1,4)===`asm`?!0:t.trimStart().startsWith(`(module`):!1}static _escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}};g.STATUS_READY=`READY`,g.STATUS_WORKING=`WORKING`,g.STATUS_DESTROYED=`DESTROYED`,g.Command=l,g.FS=p,n.shell=g,t.exports=g})),tr=t((e=>{(function(t,n){if(typeof define==`function`&&define.amd)define([`exports`],n);else if(typeof e==`object`&&typeof e.nodeName!=`string`)n(e);else{var r={};n(r),t.AnsiUp=r.default}})(e,function(e){var t=this&&this.__makeTemplateObject||function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},n;(function(e){e[e.EOS=0]=`EOS`,e[e.Text=1]=`Text`,e[e.Incomplete=2]=`Incomplete`,e[e.ESC=3]=`ESC`,e[e.Unknown=4]=`Unknown`,e[e.SGR=5]=`SGR`,e[e.OSCURL=6]=`OSCURL`})(n||={});var r=function(){function e(){this.VERSION=`5.0.1`,this.setup_palettes(),this._use_classes=!1,this.bold=!1,this.underline=!1,this.italic=!1,this.fg=this.bg=null,this._buffer=``,this._url_whitelist={http:1,https:1}}return Object.defineProperty(e.prototype,"use_classes",{get:function(){return this._use_classes},set:function(e){this._use_classes=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"url_whitelist",{get:function(){return this._url_whitelist},set:function(e){this._url_whitelist=e},enumerable:!1,configurable:!0}),e.prototype.setup_palettes=function(){var e=this;this.ansi_colors=[[{rgb:[0,0,0],class_name:`ansi-black`},{rgb:[187,0,0],class_name:`ansi-red`},{rgb:[0,187,0],class_name:`ansi-green`},{rgb:[187,187,0],class_name:`ansi-yellow`},{rgb:[0,0,187],class_name:`ansi-blue`},{rgb:[187,0,187],class_name:`ansi-magenta`},{rgb:[0,187,187],class_name:`ansi-cyan`},{rgb:[255,255,255],class_name:`ansi-white`}],[{rgb:[85,85,85],class_name:`ansi-bright-black`},{rgb:[255,85,85],class_name:`ansi-bright-red`},{rgb:[0,255,0],class_name:`ansi-bright-green`},{rgb:[255,255,85],class_name:`ansi-bright-yellow`},{rgb:[85,85,255],class_name:`ansi-bright-blue`},{rgb:[255,85,255],class_name:`ansi-bright-magenta`},{rgb:[85,255,255],class_name:`ansi-bright-cyan`},{rgb:[255,255,255],class_name:`ansi-bright-white`}]],this.palette_256=[],this.ansi_colors.forEach(function(t){t.forEach(function(t){e.palette_256.push(t)})});for(var t=[0,95,135,175,215,255],n=0;n<6;++n)for(var r=0;r<6;++r)for(var i=0;i<6;++i){var a={rgb:[t[n],t[r],t[i]],class_name:`truecolor`};this.palette_256.push(a)}for(var o=8,s=0;s<24;++s,o+=10){var c={rgb:[o,o,o],class_name:`truecolor`};this.palette_256.push(c)}},e.prototype.escape_txt_for_html=function(e){return e.replace(/[&<>"']/gm,function(e){if(e===`&`)return`&amp;`;if(e===`<`)return`&lt;`;if(e===`>`)return`&gt;`;if(e===`"`)return`&quot;`;if(e===`'`)return`&#x27;`})},e.prototype.append_buffer=function(e){var t=this._buffer+e;this._buffer=t},e.prototype.get_next_packet=function(e){e===void 0&&(e=this);var r={kind:n.EOS,text:``,url:``},o=e._buffer.length;if(o==0)return r;var s=e._buffer.indexOf(`\x1B`);if(s==-1)return r.kind=n.Text,r.text=e._buffer,e._buffer=``,r;if(s>0)return r.kind=n.Text,r.text=e._buffer.slice(0,s),e._buffer=e._buffer.slice(s),r;if(s==0){if(o==1)return r.kind=n.Incomplete,r;var c=e._buffer.charAt(1);if(c!=`[`&&c!=`]`)return r.kind=n.ESC,r.text=e._buffer.slice(0,1),e._buffer=e._buffer.slice(1),r;if(c==`[`){this._csi_regex||=i(t([`
20
20
  ^ # beginning of line